@bkm016/basalt 0.1.1 → 0.1.2

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 (196) hide show
  1. package/README.md +16 -22
  2. package/chunk-06hdzq5n.js +2 -0
  3. package/chunk-09rj27b2.js +2 -0
  4. package/{chunk-qnr1f5pj.js → chunk-0y7ne3d0.js} +2 -2
  5. package/{chunk-vgvq3q12.js → chunk-10xzzn07.js} +2 -2
  6. package/{chunk-6qertm2t.js → chunk-1qpces5a.js} +1 -1
  7. package/{chunk-nt2gntad.js → chunk-1zdwrgd4.js} +1 -1
  8. package/{chunk-sh74qzvt.js → chunk-27gntzs5.js} +4 -4
  9. package/{chunk-1v7st27a.js → chunk-2esbgxps.js} +14 -14
  10. package/{chunk-exnn1867.js → chunk-362g64pd.js} +1 -1
  11. package/{chunk-1aspj1hn.js → chunk-3cjsd292.js} +2 -2
  12. package/chunk-5c9j8qe4.js +478 -0
  13. package/{chunk-8dxzqwq3.js → chunk-5j1krv9v.js} +1 -1
  14. package/{chunk-vkkj4awb.js → chunk-6hssbcgj.js} +1 -1
  15. package/{chunk-1b7gbe8g.js → chunk-75m78j7x.js} +2 -2
  16. package/{chunk-kfq8wyd3.js → chunk-8296hw9m.js} +1 -1
  17. package/{chunk-szat3vp4.js → chunk-8d46jtbj.js} +2 -2
  18. package/{chunk-qczbfccb.js → chunk-8tjad3r0.js} +4 -4
  19. package/{chunk-agntrqs9.js → chunk-97rzj7f6.js} +1 -1
  20. package/{chunk-k7w7ac9q.js → chunk-981f9dw8.js} +8 -8
  21. package/{chunk-xysny0ve.js → chunk-aefadsy6.js} +2 -2
  22. package/{chunk-jhd54p1b.js → chunk-bannb9xm.js} +1 -1
  23. package/{chunk-a3tqx584.js → chunk-c7x1zq39.js} +1 -1
  24. package/{chunk-rv06x0kn.js → chunk-cjc90f84.js} +1 -1
  25. package/{chunk-x3dnb9sz.js → chunk-d2j735sd.js} +2 -2
  26. package/{chunk-yskm0hsy.js → chunk-d8gtbw9g.js} +1 -1
  27. package/{chunk-rm3kcxq9.js → chunk-fjtvjrkg.js} +13 -13
  28. package/{chunk-h6sw8fbt.js → chunk-fm0k0qtz.js} +1 -1
  29. package/{chunk-1yzt0qm0.js → chunk-fw2bpqmw.js} +1 -1
  30. package/{chunk-45cz26ap.js → chunk-gp7y0fja.js} +13 -13
  31. package/{chunk-2bb01ddq.js → chunk-gzxnene8.js} +1 -1
  32. package/{chunk-a8nyk4k9.js → chunk-hwr56pfj.js} +1 -1
  33. package/{chunk-0hbjv3y6.js → chunk-jwdb0ccj.js} +3 -3
  34. package/{chunk-kf8hq21a.js → chunk-k23t7vhs.js} +5 -5
  35. package/{chunk-bhqyxyap.js → chunk-k506w58v.js} +1 -1
  36. package/{chunk-44ek81ad.js → chunk-k6w6y71k.js} +2 -2
  37. package/chunk-m40gxwq4.js +5 -0
  38. package/chunk-m8vkwdgr.js +5 -0
  39. package/{chunk-f7egr55n.js → chunk-mvfsxdx6.js} +13 -13
  40. package/{chunk-pvncysbb.js → chunk-nbb9trwz.js} +1 -1
  41. package/{chunk-0szjy61m.js → chunk-pbcy6zdt.js} +1 -1
  42. package/chunk-pmqtkqsf.js +2 -0
  43. package/{chunk-hat3s3pr.js → chunk-pxsrqrd0.js} +1 -1
  44. package/{chunk-xsbxykr4.js → chunk-qe0teyn1.js} +1 -1
  45. package/{chunk-2zqny2sy.js → chunk-r7fpkb49.js} +1 -1
  46. package/{chunk-3m7qwfm3.js → chunk-rtzqqngy.js} +3 -3
  47. package/{chunk-6e49xsf5.js → chunk-shadcb9z.js} +2 -2
  48. package/{chunk-0qqb6v41.js → chunk-shhrr741.js} +120 -120
  49. package/{chunk-cv5wsd9m.js → chunk-t6zs4kw0.js} +2 -2
  50. package/{chunk-hcn9cf6v.js → chunk-v258nxcz.js} +1 -1
  51. package/{chunk-a6r4z44b.js → chunk-vk1gxk1t.js} +1 -1
  52. package/{chunk-s37s3k24.js → chunk-x1xss1d7.js} +2 -2
  53. package/{chunk-dakrpbe6.js → chunk-x4874m8e.js} +2 -2
  54. package/{chunk-wx7kdf0b.js → chunk-xfvvh1s5.js} +1 -1
  55. package/{chunk-0yytz0r1.js → chunk-y0m980k3.js} +5 -5
  56. package/{chunk-dhm42y04.js → chunk-y58ygzn9.js} +3 -3
  57. package/{chunk-2wkaw73s.js → chunk-y648fzx0.js} +5 -5
  58. package/{chunk-32at88hc.js → chunk-y7nma9rk.js} +1 -1
  59. package/{chunk-pmc3y1z8.js → chunk-ykens1hy.js} +1 -1
  60. package/{chunk-q8zx3kt6.js → chunk-z55bmysw.js} +1 -1
  61. package/{chunk-qx0m82rw.js → chunk-zmsgwr3s.js} +1 -1
  62. package/{chunk-501zkf9b.js → chunk-ztsjgssj.js} +1 -1
  63. package/compiled.js +5 -5
  64. package/package.json +1 -1
  65. package/ui-test-worker.js +63 -63
  66. package/web/chunk-0sewdyz1.js +1 -0
  67. package/web/{chunk-xbty0rv7.js → chunk-1z5p7a1h.js} +1 -1
  68. package/web/chunk-21ke27j6.js +1 -0
  69. package/web/{chunk-2msj52w6.js → chunk-24k0r5aq.js} +1 -1
  70. package/web/{chunk-a5x2zveg.js → chunk-284a17k8.js} +1 -1
  71. package/web/{chunk-ca682sm6.js → chunk-2pjdtesn.js} +14 -14
  72. package/web/{chunk-z7dcbxws.js → chunk-3mvr2gwh.js} +1 -1
  73. package/web/chunk-3t3zwx9j.js +1 -0
  74. package/web/{chunk-e6jxqbv7.js → chunk-3z93efr4.js} +1 -1
  75. package/web/{chunk-05w4fyzc.js → chunk-43jqvsrg.js} +1 -1
  76. package/web/{chunk-jwzd9tzk.js → chunk-4bry4xds.js} +2 -2
  77. package/web/{chunk-4ks96e4r.js → chunk-5e7ygjdn.js} +1 -1
  78. package/web/{chunk-qefasa1j.js → chunk-5jbf7n5q.js} +1 -1
  79. package/web/{chunk-e32y85kx.js → chunk-5rx8rtsa.js} +1 -1
  80. package/web/chunk-5xc9d5ft.js +1 -0
  81. package/web/{chunk-a1z5qx1r.js → chunk-693m9kt7.js} +3 -3
  82. package/web/{chunk-70qwwwak.js → chunk-6qejm5s2.js} +1 -1
  83. package/web/{chunk-kdyjnwdx.js → chunk-8ah6ce1b.js} +2 -2
  84. package/web/{chunk-5vw9rs4r.js → chunk-8e43yaq3.js} +3 -3
  85. package/web/{chunk-qnaqf0cr.js → chunk-8wye0wbb.js} +1 -1
  86. package/web/{chunk-45fzdcgz.js → chunk-986z0p48.js} +5 -5
  87. package/web/{chunk-y0m8hrwz.js → chunk-9dd1c37b.js} +77 -77
  88. package/web/{chunk-9yakxvjb.js → chunk-9re6yttj.js} +2 -2
  89. package/web/{chunk-2scce33n.js → chunk-abbvjt4e.js} +1 -1
  90. package/web/{chunk-b4wbk7vc.js → chunk-agmkx996.js} +3 -3
  91. package/web/{chunk-hev4hq89.js → chunk-anbn2ttv.js} +2 -2
  92. package/web/chunk-aqm3spxt.js +1139 -0
  93. package/web/{chunk-fk0dh93x.js → chunk-avwpjsxw.js} +5 -5
  94. package/web/chunk-b470hvpk.js +1 -0
  95. package/web/{chunk-9dxjafp2.js → chunk-bt1m87ck.js} +2 -2
  96. package/web/chunk-cqp1d4p0.js +1 -0
  97. package/web/{chunk-ss1bcb0n.js → chunk-ctcrk3qn.js} +2 -2
  98. package/web/{chunk-pf2ab8p8.js → chunk-ctd8bfg2.js} +1 -1
  99. package/web/{chunk-q5ke7a33.js → chunk-cwvtraca.js} +1 -1
  100. package/web/{chunk-yd46jhqv.js → chunk-dk90px7g.js} +1 -1
  101. package/web/{chunk-0mrkjnte.js → chunk-ds7srg4p.js} +1 -1
  102. package/web/{chunk-fscafg24.js → chunk-dt8ss97f.js} +5 -5
  103. package/web/{chunk-9p12mgs6.js → chunk-ezkqa7we.js} +1 -1
  104. package/web/{chunk-f26smjjf.js → chunk-f078k1ej.js} +1 -1
  105. package/web/chunk-fekjj24p.css +1 -0
  106. package/web/{chunk-a3verqw9.js → chunk-fqj9kry9.js} +5 -5
  107. package/web/chunk-frjfamx7.js +8 -0
  108. package/web/{chunk-g4azyef7.js → chunk-fy8ey195.js} +1 -1
  109. package/web/{chunk-wptv8atc.js → chunk-g8ee1csm.js} +1 -1
  110. package/web/{chunk-w880psmw.js → chunk-h31p43qa.js} +1 -1
  111. package/web/chunk-h5p5jsrw.js +1 -0
  112. package/web/chunk-h9fmr6ch.js +1 -0
  113. package/web/{chunk-qh7265qw.js → chunk-jf2ehmvp.js} +2 -2
  114. package/web/{chunk-fz06t6km.js → chunk-jmnaq7c1.js} +1 -1
  115. package/web/chunk-jq0pw0k2.js +1 -0
  116. package/web/{chunk-p3b9crsa.js → chunk-jvj66qhs.js} +2 -2
  117. package/web/{chunk-xjxv8dg8.js → chunk-jzmzhj8z.js} +4 -4
  118. package/web/chunk-k4cfnvyq.js +1 -0
  119. package/web/{chunk-dt462hk9.js → chunk-kgerjbn4.js} +1 -1
  120. package/web/{chunk-bc78qf1m.js → chunk-kww4azv5.js} +5 -5
  121. package/web/chunk-m29dhjkh.js +1 -0
  122. package/web/chunk-mj6tee5h.js +1 -0
  123. package/web/{chunk-jrcyc9s9.js → chunk-mjpjkyd1.js} +1 -1
  124. package/web/{chunk-20q90epj.js → chunk-n8sky2q6.js} +1 -1
  125. package/web/{chunk-fm2ybfj5.js → chunk-pk3ap3wh.js} +4 -4
  126. package/web/{chunk-bgnnrpna.js → chunk-q1pkntc6.js} +4 -4
  127. package/web/{chunk-taynqrgq.js → chunk-qryrg2pq.js} +2 -2
  128. package/web/{chunk-gqw3f02j.js → chunk-r92sbgwv.js} +5 -5
  129. package/web/{chunk-0vt9fg48.js → chunk-raqqscwa.js} +2 -2
  130. package/web/{chunk-3jhyzmnf.js → chunk-rc2vq9wz.js} +3 -3
  131. package/web/{chunk-2ps6mepk.js → chunk-rkj743fg.js} +3 -3
  132. package/web/{chunk-e53wfgb8.js → chunk-rrws61wf.js} +1 -1
  133. package/web/{chunk-9an7cjd9.js → chunk-s3hwejnr.js} +2 -2
  134. package/web/{chunk-dzwxgqgm.js → chunk-s3rdx28k.js} +2 -2
  135. package/web/{chunk-2m12wyrb.js → chunk-shbw6wg8.js} +1 -1
  136. package/web/chunk-szcy5z56.js +1 -0
  137. package/web/{chunk-tmvakq7n.js → chunk-t1xk6hca.js} +4 -4
  138. package/web/chunk-t2hhdg9r.js +1 -0
  139. package/web/chunk-tj4cmkwe.js +1 -0
  140. package/web/{chunk-bjkc94mv.js → chunk-tn1xzmgx.js} +1 -1
  141. package/web/{chunk-4v8en1yw.js → chunk-tnv7z83q.js} +1 -1
  142. package/web/chunk-v2b5q0n5.js +1 -0
  143. package/web/{chunk-3ee04tmm.js → chunk-vj6kstpp.js} +5 -5
  144. package/web/{chunk-b1pe46zz.js → chunk-vjqmnkh2.js} +1 -1
  145. package/web/{chunk-qd8bxxdj.js → chunk-vkc149rb.js} +1 -1
  146. package/web/{chunk-v28fx2nd.js → chunk-vny496ba.js} +1 -1
  147. package/web/{chunk-rpmpttbk.js → chunk-vz5ck6x9.js} +1 -1
  148. package/web/{chunk-y49fhfda.js → chunk-xa88zgkr.js} +1 -1
  149. package/web/{chunk-q0p5xqe1.js → chunk-xdcs8qz3.js} +4 -4
  150. package/web/chunk-y5x74t89.js +1 -0
  151. package/web/{chunk-xrxne80b.js → chunk-yen2kkn2.js} +1 -1
  152. package/web/{chunk-bj90t5gh.js → chunk-yjv2c45j.js} +4 -4
  153. package/web/chunk-yx3dh5hg.js +1 -0
  154. package/web/chunk-yz4fmtk2.js +1 -0
  155. package/web/{chunk-8p4tc9f4.js → chunk-z24vs8q9.js} +3 -3
  156. package/web/chunk-z5j6x6j8.js +2 -0
  157. package/web/chunk-z5stjrhc.js +1 -0
  158. package/web/{chunk-90kp4pnz.js → chunk-z760wagr.js} +1 -1
  159. package/web/{chunk-tqmwd9qp.js → chunk-znvnb9dh.js} +1 -1
  160. package/web/{chunk-22a4ety5.js → chunk-zrzq29e6.js} +1 -1
  161. package/web/{icon-yx2p2pye.svg → icon-1wgy7kzy.svg} +13 -13
  162. package/web/icon.svg +13 -13
  163. package/web/index.html +2 -2
  164. package/web/install.sh +0 -0
  165. package/web/sw.js +9 -0
  166. package/worker.js +1 -1
  167. package/chunk-09vr609h.js +0 -2
  168. package/chunk-58vz2qsq.js +0 -2
  169. package/chunk-c25s4w6a.js +0 -5
  170. package/chunk-t057xfrt.js +0 -5
  171. package/chunk-wjd9fr23.js +0 -2
  172. package/chunk-zef13k3h.js +0 -471
  173. package/web/chunk-2pver6r4.js +0 -1
  174. package/web/chunk-37ajk6zg.js +0 -2
  175. package/web/chunk-4wkm9fda.js +0 -1
  176. package/web/chunk-amzgyy1k.js +0 -1
  177. package/web/chunk-cff5hcm8.js +0 -8
  178. package/web/chunk-esp1mmgr.js +0 -1
  179. package/web/chunk-ew3cgdtd.js +0 -1
  180. package/web/chunk-gjq1pxw3.js +0 -1
  181. package/web/chunk-h5ejbf6e.js +0 -1
  182. package/web/chunk-jjh5jvva.js +0 -1
  183. package/web/chunk-k5btcvbg.js +0 -1
  184. package/web/chunk-kpvgecwy.js +0 -1
  185. package/web/chunk-kq40ss39.js +0 -1
  186. package/web/chunk-q7dsnvpf.js +0 -1
  187. package/web/chunk-rg426vkf.js +0 -1
  188. package/web/chunk-ry9256r7.js +0 -1
  189. package/web/chunk-scpwc9ev.js +0 -1
  190. package/web/chunk-ssy07dd2.js +0 -1
  191. package/web/chunk-tgpbhzn9.js +0 -1
  192. package/web/chunk-vt40e1kp.js +0 -1136
  193. package/web/chunk-w53rba6g.js +0 -1
  194. package/web/chunk-w86n42dy.js +0 -1
  195. package/web/chunk-wtawdeej.css +0 -1
  196. package/web/chunk-zde7mj43.js +0 -1
@@ -1,4 +1,4 @@
1
- import{e,r,se,Le,y,C,S,E,T,A,I,L,s,an,Tn,p,et,tt,N,Fe,le,ae,ie,Ye,Dr,he,ge}from"./chunk-y0m8hrwz.js";import{Mt}from"./chunk-p3b9crsa.js";import{je}from"./chunk-2m12wyrb.js";import{Pt}from"./chunk-37ajk6zg.js";import{fe}from"./chunk-ss1bcb0n.js";import{oe}from"./chunk-hev4hq89.js";var Dt={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"},U1=new Set([Dt.SHAPE_UNSUPPORTED,Dt.SHAPE_REMOVED,Dt.CONTAINMENT_VIOLATION]),Ds=new Set(Object.values(Dt).filter((t)=>!U1.has(t))),j1=new Map([["task","roundedRect"],["tool","subroutine"],["input","lean-right"],["decision","diamond"],["refdoc","lin-doc"],["action","hexagon"],["round","rect"]]),z1=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"]),W1=new Set(["roundedRect","subroutine","subprocess","subproc","framed-rectangle","lean-right","diamond","lin-doc","lined-document","hexagon","hex","connector","collapsedGroup"]),xt="roundedRect";function Tt(t){if(!t)return t;return j1.get(t)??t}e(Tt,"resolveShapeAlias");function v1(t,a){for(let o of t){if(o.isGroup)continue;if(!o.shape||o.shape==="squareRect"||o.shape==="rect")o.shape=xt;if(z1.has(o.shape)){let u=`shape "${o.shape}" was removed in v0.8.1, using "${xt}"`;if(a?.emitError)a.emitError("SHAPE_REMOVED",u,{nodeId:o.id});else r.warn(`agentflow: ${u}`);o.shape=xt;continue}if(!W1.has(o.shape)){let u=`shape "${o.shape}" is not supported, using "${xt}"`;if(a?.emitWarning)a.emitWarning("SHAPE_UNSUPPORTED",u,{nodeId:o.id});else r.warn(`agentflow: ${u}`);o.shape=xt}}}e(v1,"normaliseNodeShapes");var i1=new Map([["tool",0],["task",1],["decision",2],["input",3],["refdoc",4],["connector",5],["action",6]]),F1=i1.size,V1=e((t)=>`af-kind-${t}`,"kindClass"),K1=[...i1.keys()],I1=e((t)=>Math.max(1,t-F1),"containerSlotCount"),L1=e((t,a)=>{let o=F1+t%I1(a);return a>0?o%a:o},"containerSlot");function B1(t,a,o){let u=s().themeVariables?.borderColorArray,d=Array.isArray(u)?u.length:0,h=o.size;for(let l of t??[]){if(l.isGroup||l.shape==="collapsedGroup"){let m=o.get(String(l.id))??h++;l.colorIndex=L1(m,d);continue}let f=a(String(l.id));if(f&&i1.has(f))l.cssClasses=`${l.cssClasses??""} ${V1(f)}`.replace(/\s+/g," ").trim()}}e(B1,"assignColorSlots");var _1="agentflow-",c1=new Set(["shape","view","icon","img","form","pos","w","h","class","style","labelType"]),H1=new Set(["subroutine","subprocess","subproc","framed-rectangle","tool"]),Y1={flow:"flowGroup"};function s1(t){if(Array.isArray(t))return t.map((o)=>s1(o));if(t===null||typeof t!=="object")return t;let a={};for(let o of Object.keys(t)){if(o==="__proto__"||o==="constructor"||o==="prototype")continue;a[o]=s1(t[o])}return a}e(s1,"stripPrototypeKeys");function M1(t){let a=!1,o=!1,u=0,d,h=[];for(let l of t.split(`
1
+ import{e,r,le,Le,y,C,S,E,T,A,I,L,s,an,Tn,p,et,tt,N,Fe,ce,ae,ie,Ye,Dr,ge,ye}from"./chunk-9dd1c37b.js";import{Pt}from"./chunk-jvj66qhs.js";import{je}from"./chunk-shbw6wg8.js";import{Ot}from"./chunk-z5j6x6j8.js";import{he}from"./chunk-ctcrk3qn.js";import{se}from"./chunk-anbn2ttv.js";var Dt={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"},U1=new Set([Dt.SHAPE_UNSUPPORTED,Dt.SHAPE_REMOVED,Dt.CONTAINMENT_VIOLATION]),Ds=new Set(Object.values(Dt).filter((t)=>!U1.has(t))),j1=new Map([["task","roundedRect"],["tool","subroutine"],["input","lean-right"],["decision","diamond"],["refdoc","lin-doc"],["action","hexagon"],["round","rect"]]),z1=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"]),W1=new Set(["roundedRect","subroutine","subprocess","subproc","framed-rectangle","lean-right","diamond","lin-doc","lined-document","hexagon","hex","connector","collapsedGroup"]),xt="roundedRect";function Tt(t){if(!t)return t;return j1.get(t)??t}e(Tt,"resolveShapeAlias");function v1(t,a){for(let o of t){if(o.isGroup)continue;if(!o.shape||o.shape==="squareRect"||o.shape==="rect")o.shape=xt;if(z1.has(o.shape)){let u=`shape "${o.shape}" was removed in v0.8.1, using "${xt}"`;if(a?.emitError)a.emitError("SHAPE_REMOVED",u,{nodeId:o.id});else r.warn(`agentflow: ${u}`);o.shape=xt;continue}if(!W1.has(o.shape)){let u=`shape "${o.shape}" is not supported, using "${xt}"`;if(a?.emitWarning)a.emitWarning("SHAPE_UNSUPPORTED",u,{nodeId:o.id});else r.warn(`agentflow: ${u}`);o.shape=xt}}}e(v1,"normaliseNodeShapes");var i1=new Map([["tool",0],["task",1],["decision",2],["input",3],["refdoc",4],["connector",5],["action",6]]),F1=i1.size,V1=e((t)=>`af-kind-${t}`,"kindClass"),K1=[...i1.keys()],I1=e((t)=>Math.max(1,t-F1),"containerSlotCount"),L1=e((t,a)=>{let o=F1+t%I1(a);return a>0?o%a:o},"containerSlot");function B1(t,a,o){let u=s().themeVariables?.borderColorArray,d=Array.isArray(u)?u.length:0,h=o.size;for(let l of t??[]){if(l.isGroup||l.shape==="collapsedGroup"){let m=o.get(String(l.id))??h++;l.colorIndex=L1(m,d);continue}let f=a(String(l.id));if(f&&i1.has(f))l.cssClasses=`${l.cssClasses??""} ${V1(f)}`.replace(/\s+/g," ").trim()}}e(B1,"assignColorSlots");var _1="agentflow-",c1=new Set(["shape","view","icon","img","form","pos","w","h","class","style","labelType"]),H1=new Set(["subroutine","subprocess","subproc","framed-rectangle","tool"]),Y1={flow:"flowGroup"};function s1(t){if(Array.isArray(t))return t.map((o)=>s1(o));if(t===null||typeof t!=="object")return t;let a={};for(let o of Object.keys(t)){if(o==="__proto__"||o==="constructor"||o==="prototype")continue;a[o]=s1(t[o])}return a}e(s1,"stripPrototypeKeys");function M1(t){let a=!1,o=!1,u=0,d,h=[];for(let l of t.split(`
2
2
  `)){if(d!==void 0){let x=l.length-l.trimStart().length;if(l.trim()===""||x>d){h.push(l);continue}d=void 0}let f=-1;for(let x=0;x<l.length;x++){let _=l[x];if(o){if(_==="\\")x++;else if(_==='"')o=!1}else if(a){if(_==="'")a=!1}else if(_==='"')o=!0;else if(_==="'")a=!0;else if(_==="#"&&(x===0||l[x-1]===" "||l[x-1]==="\t")){f=x;break}else if(_==="["||_==="{")u++;else if(_==="]"||_==="}")u=Math.max(0,u-1)}if(a||o||u>0){h.push(l);continue}let m=f>=0?l.slice(0,f):l,k=f>=0?l.slice(f):"";if(/:\s*[>|][\d+-]*\s*$/.test(m)){d=l.length-l.trimStart().length,h.push(l);continue}h.push(m.replace(/,([\t ]*)$/,"$1")+k)}return h.join(`
3
3
  `)}e(M1,"stripLineTrailingCommas");var q1=class{constructor(){this.vertexCounter=0,this.config=s(),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=S,this.setAccDescription=T,this.setDiagramTitle=I,this.getAccTitle=E,this.getAccDescription=A,this.getDiagramTitle=L,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(t){return y.sanitizeText(t,this.config)}sanitizeNodeLabelType(t){switch(t){case"markdown":case"string":case"text":return t;default:return"markdown"}}setDiagramId(t){this.diagramId=t}lookUpDomId(t){for(let a of this.vertices.values())if(a.id===t)return this.diagramId?`${this.diagramId}-${a.domId}`:a.domId;return this.diagramId?`${this.diagramId}-${t}`:t}addVertex(t,a,o,u,d,h,l={},f,m){if(!t||t.trim().length===0)return;let k;if(f!==void 0){let D;if(!f.includes(`
4
4
  `))D=`{
@@ -19,13 +19,13 @@ ${w.join(`
19
19
 
20
20
  Initialize mermaid with maxEdges set to a higher number to allow more edges.
21
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(t){return t!==null&&typeof t==="object"&&"id"in t&&typeof t.id==="string"}addLink(t,a,o){let u=this.isLinkData(o)?o.id.replace("@",""):void 0;r.info("addLink",t,a,u);for(let d of t)for(let h of a){let l=d===t[t.length-1],f=h===a[0];if(l&&f)this.addSingleLink(d,h,o,u);else this.addSingleLink(d,h,o,void 0)}}updateLinkInterpolate(t,a){t.forEach((o)=>{if(o==="default"){this.edges.defaultInterpolate=a;return}if(typeof o==="number"&&o>=this.edges.length)throw Error(`The index ${o} 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[o].interpolate=a})}updateLink(t,a){t.forEach((o)=>{if(typeof o==="number"&&o>=this.edges.length)throw Error(`The index ${o} 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.)`);if(o==="default")this.edges.defaultStyle=a;else if(this.edges[o].style=a,(this.edges[o]?.style?.length??0)>0&&!this.edges[o]?.style?.some((u)=>u?.startsWith("fill")))this.edges[o]?.style?.push("fill:none")})}addClass(t,a){let o=a.join().replace(/\\,/g,"§§§").replace(/,/g,";").replace(/§§§/g,",").split(";");t.split(",").forEach((u)=>{let d=this.classes.get(u);if(d===void 0)d={id:u,styles:[],textStyles:[]},this.classes.set(u,d);if(o!==void 0&&o!==null)o.forEach((h)=>{if(/color/.exec(h)){let l=h.replace("fill","bgFill");d.textStyles.push(l)}d.styles.push(h)})})}setDirection(t){if(this.direction=t.trim(),/.*</.exec(this.direction))this.direction="RL";if(/.*\^/.exec(this.direction))this.direction="BT";if(/.*>/.exec(this.direction))this.direction="LR";if(/.*v/.exec(this.direction))this.direction="TB";if(this.direction==="TD")this.direction="TB"}setClass(t,a){for(let o of t.split(",")){let u=this.vertices.get(o);if(u)u.classes.push(a);let d=this.edges.find((l)=>l.id===o);if(d)d.classes.push(a);let h=this.subGraphLookup.get(o);if(h)h.classes.push(a)}}setTooltip(t,a){if(a===void 0)return;a=this.sanitizeText(a);for(let o of t.split(","))this.tooltips.set(this.version==="gen-1"?this.lookUpDomId(o):o,a)}setClickFun(t,a,o){if(s().securityLevel!=="loose")return;if(a===void 0)return;let u=[];if(typeof o==="string"){u=o.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);for(let h=0;h<u.length;h++){let l=u[h].trim();if(l.startsWith('"')&&l.endsWith('"'))l=l.substr(1,l.length-2);u[h]=l}}if(u.length===0)u.push(t);let d=this.vertices.get(t);if(d)d.haveCallback=!0,this.funs.push(()=>{let h=this.lookUpDomId(t),l=document.querySelector(`[id="${h}"]`);if(l!==null)l.addEventListener("click",()=>{N.runFunc(a,...u)},!1)})}setLink(t,a,o){t.split(",").forEach((u)=>{let d=this.vertices.get(u);if(d!==void 0)d.link=N.formatUrl(a,this.config),d.linkTarget=o}),this.setClass(t,"clickable")}getTooltip(t){return this.tooltips.get(t)}setClickEvent(t,a,o){t.split(",").forEach((u)=>{this.setClickFun(u,a,o)}),this.setClass(t,"clickable")}bindFunctions(t){this.funs.forEach((a)=>{a(t)})}getDirection(){return this.direction?.trim()}getVertices(){return this.vertices}getEdges(){return this.edges}isToolDefinition(t){return H1.has(t.type)}getTools(){let t=[];for(let a of this.vertices.values())if(this.isToolDefinition(a))t.push(a);return t}getClasses(){return this.classes}setupToolTips(t){let a=Mt();p(t).select("svg").selectAll("g.node").on("mouseover",(d)=>{let h=p(d.currentTarget),l=h.attr("title");if(l===null)return;let f=d.currentTarget?.getBoundingClientRect();a.transition().duration(200).style("opacity",".9"),a.text(h.attr("title")).style("left",window.scrollX+f.left+(f.right-f.left)/2+"px").style("top",window.scrollY+f.bottom+"px"),a.html(Le.sanitize(l)),h.classed("hover",!0)}).on("mouseout",(d)=>{a.transition().duration(500).style("opacity",0),p(d.currentTarget).classed("hover",!1)})}clear(t="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=t,this.config=s(),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(t){this.version=t||"gen-2"}defaultStyle(){return"fill:#ffa;stroke: #f66; stroke-width: 3px; stroke-dasharray: 5, 5;fill:#ffa;stroke: #666;"}addSubGraph(t,a,o,u){let d=t?.text?.trim(),h=o?.text;if(t===o&&o?.text&&/\s/.exec(o.text))d=void 0;let f=e((B)=>{let W={boolean:{},number:{},string:{}},w=[],D;return{nodeList:B.filter(function(b){let M=typeof b;if(b.stmt&&b.stmt==="dir")return D=b.value,!1;if(b.trim()==="")return!1;if(M in W)return W[M].hasOwnProperty(b)?!1:W[M][b]=!0;else return w.includes(b)?!1:w.push(b)}),dir:D}},"uniq")(a.flat()),{nodeList:m,dir:k}=f,x=s().flowchart??{};if(k=k??(x.inheritDir?this.getDirection()??s().direction??void 0:void 0),this.version==="gen-1")for(let B=0;B<m.length;B++)m[B]=this.lookUpDomId(m[B]);d=d??"subGraph"+this.subCount,h=h||"",h=this.sanitizeText(h),this.subCount=this.subCount+1;let _={id:d,nodes:m.filter((B)=>B!==d&&!this.globalNodes.has(B)),title:h.trim(),classes:[],dir:k,labelType:this.sanitizeNodeLabelType(o?.type),type:u??"flow"};r.info("Adding",_.id,_.nodes,_.dir),_.nodes=this.makeUniq(_,this.subGraphs).nodes;let P=this.getPosForId(d);if(P!==-1){let B=this.subGraphs[P];for(let W of _.nodes)if(!B.nodes.includes(W))B.nodes.push(W);if(_.title)B.title=_.title;if(_.dir)B.dir=_.dir;if(_.type)B.type=_.type;this.subGraphLookup.set(d,B)}else this.subGraphs.push(_),this.subGraphLookup.set(d,_);return d}addGlobal(t){for(let a of t.flat()){if(typeof a!=="string")continue;let o=a.trim();if(o!=="")this.globalNodes.add(o)}for(let a of this.subGraphs)a.nodes=a.nodes.filter((o)=>!this.globalNodes.has(o))}getPosForId(t){for(let[a,o]of this.subGraphs.entries())if(o.id===t)return a;return-1}indexNodes2(t,a){let o=this.subGraphs[a].nodes;if(this.secCount=this.secCount+1,this.secCount>2000)return{result:!1,count:0};if(this.posCrossRef[this.secCount]=a,this.subGraphs[a].id===t)return{result:!0,count:0};let u=0,d=1;while(u<o.length){let h=this.getPosForId(o[u]);if(h>=0){let l=this.indexNodes2(t,h);if(l.result)return{result:!0,count:d+l.count};else d=d+l.count}u=u+1}return{result:!1,count:d}}getDepthFirstPos(t){return this.posCrossRef[t]}indexNodes(){if(this.secCount=-1,this.subGraphs.length>0)this.indexNodes2("none",this.subGraphs.length-1)}addConnector(t,a){let o=t?.text?.trim();if(!o)return"";let u=a?.text?.trim()??"",d=u.length>0?this.sanitizeText(u):o,h=this.connectors.get(o);if(!h)h={id:o,labelType:"text",domId:_1+o+"-"+this.vertexCounter,styles:[],classes:[],isConnector:!0,text:d},this.connectors.set(o,h),this.vertices.set(o,h),this.vertexCounter++;else if(u.length>0)h.text=d;return o}getSubGraphs(){return this.subGraphs}getConnectors(){return[...this.connectors.values()]}firstGraph(){if(this.firstGraphFlag)return this.firstGraphFlag=!1,!0;return!1}computeEdgeSemantic(t,a){if(t==="arrow_point"&&a==="normal")return"sequence";if(t==="arrow_cross"&&a==="normal")return"failure";if(t==="arrow_open"&&a==="dotted")return"reference";return}destructStartLink(t){let a=t.trim(),o="arrow_open",u="normal";if(a.includes("."))u="dotted";return{type:"arrow_open",stroke:u}}countChar(t,a){let o=a.length,u=0;for(let d=0;d<o;++d)if(a[d]===t)++u;return u}destructEndLink(t){let a=t.trim(),o=a.slice(0,-1),u="arrow_open";switch(a.slice(-1)){case"x":u="arrow_cross";break;case">":u="arrow_point";break;case"-":case".":u="arrow_open",o=a;break}let d="normal",h=o.length-1,l=this.countChar(".",o);if(l>0)d="dotted",h=l;return{type:u,stroke:d,length:h}}destructLink(t,a){let o=this.destructEndLink(t),u;if(a){if(u=this.destructStartLink(a),u.stroke!==o.stroke)return{type:"INVALID",stroke:"INVALID"};return u.type=o.type,u.length=o.length,{...u,edgeSemantic:this.computeEdgeSemantic(u.type,u.stroke)}}return{...o,edgeSemantic:this.computeEdgeSemantic(o.type,o.stroke)}}exists(t,a){for(let o of t)if(o.nodes.includes(a))return!0;return!1}makeUniq(t,a){let o=[];return t.nodes.forEach((u,d)=>{if(!this.exists(a,u))o.push(t.nodes[d])}),{nodes:o}}getTypeFromVertex(t){let a=typeof t.type==="string"?Tt(t.type):t.type;switch(a){case"square":case void 0:return"squareRect";case"round":return"roundedRect";case"ellipse":return"ellipse";default:return a}}findNode(t,a){return t.find((o)=>o.id===a)}destructEdgeType(t){let a="none",o="arrow_point";switch(t){case"arrow_point":case"arrow_circle":case"arrow_cross":case"arrow_hierarchy":o=t;break;case"double_arrow_point":case"double_arrow_circle":case"double_arrow_cross":a=t.replace("double_",""),o=a;break}return{arrowTypeStart:a,arrowTypeEnd:o}}addNodeFromVertex(t,a,o,u,d,h){let l=o.get(t.id),f=u.get(t.id)??!1,m=this.findNode(a,t.id);if(m)m.cssStyles=t.styles,m.cssCompiledStyles=this.getCompiledStyles(t.classes),m.cssClasses=t.classes.join(" ");else{let k={id:t.id,label:t.text,labelType:t.labelType,labelStyle:"",parentId:l,padding:d.flowchart?.padding||8,cssStyles:t.styles,cssCompiledStyles:this.getCompiledStyles(["default","node",...t.classes]),cssClasses:"default "+t.classes.join(" "),dir:t.dir,domId:t.domId,look:h,link:t.link,linkTarget:t.linkTarget,tooltip:this.getTooltip(t.id),metadata:t.metadata};if(f)a.push({...k,isGroup:!0,shape:"rect"});else a.push({...k,isGroup:!1,shape:this.getTypeFromVertex(t),wrappingWidth:d.agentflow?.wrappingWidth,minWidth:d.agentflow?.minNodeWidth})}}getCompiledStyles(t){let a=[];for(let o of t){let u=this.classes.get(o);if(u?.styles)a=[...a,...u.styles??[]].map((d)=>d.trim());if(u?.textStyles)a=[...a,...u.textStyles??[]].map((d)=>d.trim())}return a}runPostParseValidators(){if(this.postParseValidationRun)return;this.postParseValidationRun=!0}getData(){this.runPostParseValidators();let t=s(),a=[],o=[],u=this.getSubGraphs(),d=new Map,h=new Map,l=new Set,f=new Map,m=e((g,b,M=new Set)=>{if(M.has(g))return;M.add(g);let q=this.subGraphLookup.get(g);if(!q)return;for(let Se of q.nodes){if(Se===b||M.has(Se))continue;l.add(Se),f.set(Se,b),m(Se,b,M)}},"collectDescendants");for(let g of u)if(g.metadata?.view==="collapsed"&&!l.has(g.id))m(g.id,g.id);let k=e((g,b)=>{let M=new Set,q=b;while(q!==void 0&&!M.has(q)){if(q===g)return!0;M.add(q),q=d.get(q)}return!1},"wouldCloseContainmentCycle");for(let g=u.length-1;g>=0;g--){let b=u[g];if(l.has(b.id))continue;if(b.nodes.length>0)h.set(b.id,!0);for(let M of b.nodes){if(k(M,b.id)){this.emitWarning(Dt.CONTAINMENT_VIOLATION,`Container "${b.id}" cannot contain "${M}" because "${M}" already contains it. The nesting that would close the loop is dropped.`,{nodeId:M});continue}d.set(M,b.id)}}for(let g=u.length-1;g>=0;g--){let b=u[g];if(l.has(b.id))continue;if(b.metadata?.view==="collapsed"){let q={...b.metadata,containerType:b.type};a.push({id:b.id,label:b.title,labelStyle:"",labelType:b.labelType,parentId:d.get(b.id),padding:8,cssCompiledStyles:this.getCompiledStyles(b.classes),cssClasses:b.classes.join(" "),shape:"collapsedGroup",dir:b.dir,isGroup:!1,look:t.look,metadata:q})}else a.push({id:b.id,label:b.title,labelStyle:"",labelType:b.labelType,parentId:d.get(b.id),padding:8,cssCompiledStyles:this.getCompiledStyles(b.classes),cssClasses:b.classes.join(" "),shape:Y1[b.type??"flow"],dir:b.dir,isGroup:!0,look:t.look,metadata:b.metadata})}this.getVertices().forEach((g)=>{if(l.has(g.id))return;this.addNodeFromVertex(g,a,d,h,t,t.look||"classic")});let _=this.getEdges();_.forEach((g,b)=>{let M=f.get(g.start)??g.start,q=f.get(g.end)??g.end;if(M===q&&g.start!==g.end)return;let{arrowTypeStart:Se,arrowTypeEnd:Be}=this.destructEdgeType(g.type),Ve=[..._.defaultStyle??[]];if(g.style)Ve.push(...g.style);let Me={id:Fe(M,q,{counter:b,prefix:"L"},g.id),isUserDefinedId:g.isUserDefinedId,start:M,end:q,type:g.type??"normal",label:g.text,labelType:g.labelType,labelpos:"c",thickness:g.stroke,minlen:g.length,classes:g?.stroke==="invisible"?"":"edge-thickness-normal edge-pattern-solid flowchart-link",arrowTypeStart:g?.stroke==="invisible"||g?.type==="arrow_open"?"none":Se,arrowTypeEnd:g?.stroke==="invisible"||g?.type==="arrow_open"?"none":Be,arrowheadStyle:"fill: #333",cssCompiledStyles:this.getCompiledStyles(g.classes),labelStyle:Ve,style:Ve,pattern:g.stroke,look:t.look,animate:g.animate,animation:g.animation,curve:g.interpolate||this.edges.defaultInterpolate||t.flowchart?.curve,metadata:g.metadata};o.push(Me)}),v1(a,this);let P=new Map,B=new Map;for(let g of u){let b=d.get(g.id);if(b!==void 0)B.set(b,[...B.get(b)??[],g.id])}let W=0,w=e((g)=>{if(P.has(g))return;P.set(g,W++);for(let b of B.get(g)??[])w(b)},"walkContainers");for(let g of u)if(d.get(g.id)===void 0)w(g.id);let D=new Set(this.getConnectors().map((g)=>g.id));return B1(a,(g)=>{if(D.has(g))return"connector";let b=this.vertices.get(g);return b?this.deriveVertexKind(b,Tt(b.type)):void 0},P),{nodes:a,edges:o,other:{},config:t,connectors:this.getConnectors()}}defaultConfig(){return Tn.flowchart}deriveVertexKind(t,a){if(this.isToolDefinition(t))return"tool";if(a==="hexagon"||a==="hex")return"action";if(a==="lean-right"||a==="lean_right")return"input";if(a==="lin-doc"||a==="lined-document")return"refdoc";if(a==="diamond")return"decision";return"task"}getSemanticModel(){this.runPostParseValidators();let t=new Set(this.subGraphs.map((l)=>l.id)),a=[],o=[];for(let[l,f]of this.vertices){if(t.has(l))continue;if(f.isConnector){let x={id:l};if(f.text!==void 0&&f.text!==l)x.title=f.text;if(f.metadata&&Object.keys(f.metadata).length>0){let _={};for(let[P,B]of Object.entries(f.metadata)){if(c1.has(P))continue;_[P]=B}if(Object.keys(_).length>0)x.metadata=_}o.push(x);continue}let m={id:l};if(f.text!==void 0)m.label=f.text;let k=typeof f.type==="string"?Tt(f.type):f.type;if(k!==void 0)m.shape=k;if(m.vertexKind=this.deriveVertexKind(f,k),f.metadata&&Object.keys(f.metadata).length>0){let x={};for(let[_,P]of Object.entries(f.metadata)){if(c1.has(_))continue;x[_]=P}if(Object.keys(x).length>0)m.metadata=x}a.push(m)}let u=this.edges.map((l)=>{let f={start:l.start,end:l.end};if(l.id!==void 0)f.id=l.id;if(typeof l.text==="string"&&l.text.length>0)f.label=l.text;if(l.type!==void 0)f.type=l.type;if(l.stroke!==void 0)f.stroke=l.stroke;if(l.edgeSemantic!==void 0)f.edgeSemantic=l.edgeSemantic;if(l.length!==void 0)f.length=l.length;if(l.metadata&&Object.keys(l.metadata).length>0)f.metadata={...l.metadata};return f}),d=this.subGraphs.map((l)=>{let f={id:l.id,nodes:[...l.nodes]};if(l.type!==void 0)f.type=l.type;if(l.title!==void 0)f.title=l.title;if(l.dir!==void 0)f.direction=l.dir;if(l.metadata&&Object.keys(l.metadata).length>0){let m={};for(let[k,x]of Object.entries(l.metadata)){if(c1.has(k))continue;m[k]=x}if(Object.keys(m).length>0)f.metadata=m}return f}),h={vertices:a,edges:u,subGraphs:d,connectors:o,diagnostics:this.diagnostics};if(this.direction!==void 0)h.direction=this.direction;return h}setFrontmatterLineOffset(t){this.frontmatterLineOffset=t??0}toElementPosition(t){let a=t?.first_line??0,o=t?.first_column??0,u=t?.last_line??a,d=t?.last_column??o,[h,l]=t?.range??[0,0];return{startLine:a+this.frontmatterLineOffset,startColumn:o,endLine:u+this.frontmatterLineOffset,endColumn:d,startIndex:h,endIndex:l}}pushMapping(t,a,o){if(!t)return;let u={id:t,type:a,position:this.toElementPosition(o)};return this.elementMappings.push(u),u}addVertexMapping(t,a,o,u){let d=this.pushMapping(t,"vertex",u);if(d&&o==null)this.bareVertexMappings.add(d)}extendVertexMapping(t,a){if(!t||!a)return;let o=this.toElementPosition(a);for(let u=this.elementMappings.length-1;u>=0;u--){let d=this.elementMappings[u];if(d.type==="vertex"&&d.id===t){if(this.bareVertexMappings.has(d))d.type="attachment",this.bareVertexMappings.delete(d);if(o.endLine>d.position.endLine||o.endLine===d.position.endLine&&o.endColumn>d.position.endColumn)d.position.endLine=o.endLine,d.position.endColumn=o.endColumn,d.position.endIndex=o.endIndex;return}}this.pushMapping(t,"attachment",a)}addEdgeMapping(t,a,o,u){let d=Array.isArray(a)?a.map((l)=>typeof l==="string"?l:l?.id??"").filter(Boolean):[],h=d.length>0?d.join(">"):"edge";this.pushMapping(h,"edge",u)}addSubgraphMapping(t,a,o,u){let d=(typeof t==="string"?t:t?.text)??"",h=this.toElementPosition(o),l=u?this.toElementPosition(u):h;if(!d)return;this.elementMappings.push({id:d,type:"subgraph",position:{startLine:h.startLine,startColumn:h.startColumn,endLine:l.endLine,endColumn:l.endColumn,startIndex:h.startIndex,endIndex:l.endIndex}})}addConnectorMapping(t,a,o,u){let d=t?.text?.trim()??"";if(!d)return;let h=this.toElementPosition(o),l=u?this.toElementPosition(u):h;this.elementMappings.push({id:d,type:"connector",position:{startLine:h.startLine,startColumn:h.startColumn,endLine:l.endLine,endColumn:l.endColumn,startIndex:h.startIndex,endIndex:l.endIndex}})}getElementMappings(){return[...this.elementMappings]}getElementById(t){return this.elementMappings.find((a)=>a.id===t)}getElementsOnLine(t){return this.elementMappings.filter((a)=>t>=a.position.startLine&&t<=a.position.endLine)}getElementAtPosition(t,a){let o=this.elementMappings.filter((d)=>{let{startLine:h,startColumn:l,endLine:f,endColumn:m}=d.position;if(t<h||t>f)return!1;if(t===h&&a<l)return!1;if(t===f&&a>m)return!1;return!0});if(o.length===0)return;let u=e(({position:d})=>[d.endLine-d.startLine,d.endColumn-d.startColumn],"span");return o.reduce((d,h)=>{let[l,f]=u(d),[m,k]=u(h);if(m!==l)return m<l?h:d;return k<f?h:d})}getMappingStats(){let t=0,a=0,o=0,u=0,d=0;for(let h of this.elementMappings)if(h.type==="vertex")t++;else if(h.type==="edge")a++;else if(h.type==="subgraph")o++;else if(h.type==="connector")u++;else if(h.type==="attachment")d++;return{vertices:t,edges:a,subgraphs:o,connectors:u,attachments:d,totalElements:this.elementMappings.length}}emitDiagnostic(t,a,o,u){let d=u?.nodeId??u?.edgeId,h=d?this.getElementById(d):void 0,l={id:t,severity:a,message:o,...u?.nodeId?{nodeId:u.nodeId}:{},...u?.edgeId&&!u?.nodeId?{edgeId:u.edgeId}:{},...h?{position:h.position}:{}};if(this.diagnostics.some((k)=>k.id===l.id&&k.severity===l.severity&&k.message===l.message&&k.nodeId===l.nodeId&&k.edgeId===l.edgeId))return;this.diagnostics.push(l);let m=`agentflow[${t}]: ${o}`;if(a==="error")r.error(m);else r.warn(m)}emitWarning(t,a,o){this.emitDiagnostic(t,"warning",a,o)}emitError(t,a,o){this.emitDiagnostic(t,"error",a,o)}getDiagnostics(){return[...this.diagnostics]}},X1=e(function(t,a){return a.db.getClasses()},"getClasses"),Q1=e(async function(t,a,o,u){r.debug("Drawing agentflow diagram",a);let{securityLevel:d,agentflow:h,layout:l}=s();u.db.setDiagramId(a),r.debug("Before getData: ");let f=u.db.getData();r.debug("Data: ",f);let m=fe(a,d),k=u.db.getDirection();if(f.type=u.type,f.layoutAlgorithm=ge(l),f.layoutAlgorithm==="dagre"&&l==="elk")r.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.");f.direction=k,f.nodeSpacing=h?.nodeSpacing||50,f.rankSpacing=h?.rankSpacing||50,f.markers=["point","circle","cross","hierarchy"],f.diagramId=a,r.debug("REF1:",f),await he(f,m);let x=h?.diagramPadding??8;N.insertTitle(m,"agentflowTitleText",h?.titleTopMargin??0,u.db.getDiagramTitle()),oe(m,x,"agentflow",h?.useMaxWidth??!0)},"draw"),J1={getClasses:X1,draw:Q1},d1=function(){var t=e(function(He,v,F,V){for(F=F||{},V=He.length;V--;F[He[V]]=v);return F},"o"),a=[1,5],o=[1,4],u=[1,3],d=[1,6],h=[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],l=[2,2],f=[1,15],m=[1,16],k=[1,17],x=[1,18],_=[1,19],P=[1,26],B=[1,27],W=[1,28],w=[1,30],D=[1,31],g=[1,32],b=[1,55],M=[1,54],q=[1,34],Se=[1,35],Be=[1,36],Ve=[1,37],Me=[1,38],Q=[1,50],J=[1,52],Z=[1,48],ee=[1,53],te=[1,49],re=[1,56],ne=[1,51],ue=[1,57],ce=[1,58],qe=[1,39],Xe=[1,40],Qe=[1,41],Je=[1,42],Ze=[1,43],We=[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],me=[1,70],Ae=[1,68],Ee=[1,67],Ce=[1,69],rt=[8,9,10,12,78,80,81],nt=[1,88],at=[1,101],ot=[1,106],ut=[1,105],lt=[1,102],ct=[1,98],dt=[1,104],ht=[1,100],pt=[1,107],ft=[1,103],gt=[1,108],bt=[1,99],$e=[8,9,10,11,12,43,78,80,81],pe=[8,9,10,11,12,43,49,78,80,81],Te=[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],h1=[8,9,10,12,47,63,78,80,81,92,105,108,109,112,114,117,118,119],kt=[47,63,92,105,108,109,112,114,117,118,119],p1=[1,131],f1=[1,132],_t=[1,134],vt=[1,133],g1=[47,63,65,77,92,105,108,109,112,114,117,118,119],Ft=[1,143],Vt=[1,157],It=[1,158],Lt=[1,159],Bt=[1,162],yt=[1,161],wt=[1,160],Nt=[1,145],Rt=[1,147],Ot=[1,151],b1=[1,139],k1=[1,140],Gt=[1,152],Ut=[1,153],jt=[1,154],zt=[1,155],Wt=[1,156],Kt=[1,163],Ht=[1,164],Yt=[1,141],qt=[1,142],Xt=[1,149],Qt=[1,144],Jt=[1,148],Zt=[1,146],mt=[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],m1=[1,168],At=[1,170],X=[8,9,10,12],De=[8,9,10,11,12,15,47,63,92,108,109,112,114,117,118,119],G=[1,190],be=[1,186],ke=[1,187],U=[1,191],j=[1,188],z=[1,189],Et=[80,119,122],K=[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],A1=[11,109],Ke=[32,52,54,56,58,60,65,67,69,70,72,74,119,120,121],ye=[1,269],we=[1,267],Ne=[1,271],Re=[1,265],Oe=[1,266],Pe=[1,268],Ge=[1,270],Ue=[1,272],Ct=[1,292],E1=[8,9,10,12,109],Ie=[8,9,10,11,12,63,87,108,109,112,113,114,115],r1={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(v,F,V,c,H,i,O){var n=i.length-1;switch(H){case 2:this.$=[];break;case 3:if(!Array.isArray(i[n])||i[n].length>0)i[n-1].push(i[n]);this.$=i[n-1];break;case 4:case 198:this.$=i[n];break;case 5:case 33:case 34:case 35:case 36:case 37:this.$=[];break;case 13:c.setDirection("TB"),this.$="TB";break;case 14:c.setDirection(i[n-1]),this.$=i[n-1];break;case 32:this.$=i[n-1].nodes;break;case 38:if(this.$=c.addSubGraph(i[n-6],i[n-1],i[n-4],"flow"),c.addSubgraphMapping)c.addSubgraphMapping(i[n-6],i[n-4],O[n-8],O[n]);break;case 39:if(this.$=c.addSubGraph(i[n-7],i[n-1],i[n-5],"flow"),c.addVertex(this.$,void 0,void 0,void 0,void 0,void 0,void 0,i[n-3],O[n-3]),c.addSubgraphMapping)c.addSubgraphMapping(i[n-7],i[n-5],O[n-9],O[n]);break;case 40:if(this.$=c.addSubGraph(i[n-3],i[n-1],{text:"",type:"text"},"flow"),c.addSubgraphMapping)c.addSubgraphMapping(i[n-3],{text:"",type:"text"},O[n-5],O[n]);break;case 41:if(this.$=c.addSubGraph(i[n-4],i[n-1],{text:"",type:"text"},"flow"),c.addVertex(this.$,void 0,void 0,void 0,void 0,void 0,void 0,i[n-3],O[n-3]),c.addSubgraphMapping)c.addSubgraphMapping(i[n-4],{text:"",type:"text"},O[n-6],O[n]);break;case 42:if(this.$=c.addSubGraph(void 0,i[n-1],void 0,"flow"),c.addSubgraphMapping)c.addSubgraphMapping(void 0,void 0,O[n-3],O[n]);break;case 43:c.addGlobal(i[n-1]),this.$=[];break;case 44:if(this.$=c.addConnector(i[n-4],i[n-2]),c.addConnectorMapping)c.addConnectorMapping(i[n-4],i[n-2],O[n-6],O[n]);break;case 45:if(this.$=c.addConnector(i[n-5],i[n-3]),c.addVertex(this.$,void 0,void 0,void 0,void 0,void 0,void 0,i[n-1],O[n-1]),c.addConnectorMapping)c.addConnectorMapping(i[n-5],i[n-3],O[n-7],O[n]);break;case 46:if(this.$=c.addConnector(i[n-1],{text:"",type:"text"}),c.addConnectorMapping)c.addConnectorMapping(i[n-1],{text:"",type:"text"},O[n-3],O[n]);break;case 47:if(this.$=c.addConnector(i[n-2],{text:"",type:"text"}),c.addVertex(this.$,void 0,void 0,void 0,void 0,void 0,void 0,i[n-1],O[n-1]),c.addConnectorMapping)c.addConnectorMapping(i[n-2],{text:"",type:"text"},O[n-4],O[n]);break;case 49:this.$=i[n].trim(),c.setAccTitle(this.$);break;case 50:case 51:this.$=i[n].trim(),c.setAccDescription(this.$);break;case 56:this.$=i[n-1]+i[n];break;case 57:this.$=i[n];break;case 58:if(c.addVertex(i[n-1][i[n-1].length-1],void 0,void 0,void 0,void 0,void 0,void 0,i[n],O[n]),c.extendVertexMapping)c.extendVertexMapping(i[n-1][i[n-1].length-1],O[n]);if(c.addLink(i[n-3].stmt,i[n-1],i[n-2]),c.addEdgeMapping)c.addEdgeMapping(i[n-3].stmt,i[n-1],i[n-2],this._$);this.$={stmt:i[n-1],nodes:i[n-1].concat(i[n-3].nodes)};break;case 59:if(c.addLink(i[n-2].stmt,i[n],i[n-1]),c.addEdgeMapping)c.addEdgeMapping(i[n-2].stmt,i[n],i[n-1],this._$);this.$={stmt:i[n],nodes:i[n].concat(i[n-2].nodes)};break;case 60:if(c.addLink(i[n-3].stmt,i[n-1],i[n-2]),c.addEdgeMapping)c.addEdgeMapping(i[n-3].stmt,i[n-1],i[n-2],this._$);this.$={stmt:i[n-1],nodes:i[n-1].concat(i[n-3].nodes)};break;case 61:this.$={stmt:i[n-1],nodes:i[n-1]};break;case 62:if(c.addVertex(i[n-1][i[n-1].length-1],void 0,void 0,void 0,void 0,void 0,void 0,i[n],O[n]),c.extendVertexMapping)c.extendVertexMapping(i[n-1][i[n-1].length-1],O[n]);this.$={stmt:i[n-1],nodes:i[n-1],shapeData:i[n]};break;case 63:this.$={stmt:i[n],nodes:i[n]};break;case 64:this.$=[i[n]];break;case 65:if(c.addVertex(i[n-5][i[n-5].length-1],void 0,void 0,void 0,void 0,void 0,void 0,i[n-4],O[n-4]),c.extendVertexMapping)c.extendVertexMapping(i[n-5][i[n-5].length-1],O[n-4]);this.$=i[n-5].concat(i[n]);break;case 66:this.$=i[n-4].concat(i[n]);break;case 67:this.$=i[n];break;case 68:this.$=i[n-2],c.setClass(i[n-2],i[n]);break;case 69:if(this.$=i[n-3],c.addVertex(i[n-3],i[n-1],"square"),c.addVertexMapping)c.addVertexMapping(i[n-3],i[n-1],"square",this._$);break;case 70:if(this.$=i[n-3],c.addVertex(i[n-3],i[n-1],"doublecircle"),c.addVertexMapping)c.addVertexMapping(i[n-3],i[n-1],"doublecircle",this._$);break;case 71:if(this.$=i[n-5],c.addVertex(i[n-5],i[n-2],"circle"),c.addVertexMapping)c.addVertexMapping(i[n-5],i[n-2],"circle",this._$);break;case 72:if(this.$=i[n-3],c.addVertex(i[n-3],i[n-1],"ellipse"),c.addVertexMapping)c.addVertexMapping(i[n-3],i[n-1],"ellipse",this._$);break;case 73:if(this.$=i[n-3],c.addVertex(i[n-3],i[n-1],"stadium"),c.addVertexMapping)c.addVertexMapping(i[n-3],i[n-1],"stadium",this._$);break;case 74:if(this.$=i[n-3],c.addVertex(i[n-3],i[n-1],"subroutine"),c.addVertexMapping)c.addVertexMapping(i[n-3],i[n-1],"subroutine",this._$);break;case 75:if(this.$=i[n-7],c.addVertex(i[n-7],i[n-1],"rect",void 0,void 0,void 0,Object.fromEntries([[i[n-5],i[n-3]]])),c.addVertexMapping)c.addVertexMapping(i[n-7],i[n-1],"rect",this._$);break;case 76:if(this.$=i[n-3],c.addVertex(i[n-3],i[n-1],"cylinder"),c.addVertexMapping)c.addVertexMapping(i[n-3],i[n-1],"cylinder",this._$);break;case 77:if(this.$=i[n-3],c.addVertex(i[n-3],i[n-1],"round"),c.addVertexMapping)c.addVertexMapping(i[n-3],i[n-1],"round",this._$);break;case 78:if(this.$=i[n-3],c.addVertex(i[n-3],i[n-1],"diamond"),c.addVertexMapping)c.addVertexMapping(i[n-3],i[n-1],"diamond",this._$);break;case 79:if(this.$=i[n-5],c.addVertex(i[n-5],i[n-2],"hexagon"),c.addVertexMapping)c.addVertexMapping(i[n-5],i[n-2],"hexagon",this._$);break;case 80:if(this.$=i[n-3],c.addVertex(i[n-3],i[n-1],"odd"),c.addVertexMapping)c.addVertexMapping(i[n-3],i[n-1],"odd",this._$);break;case 81:if(this.$=i[n-3],c.addVertex(i[n-3],i[n-1],"trapezoid"),c.addVertexMapping)c.addVertexMapping(i[n-3],i[n-1],"trapezoid",this._$);break;case 82:if(this.$=i[n-3],c.addVertex(i[n-3],i[n-1],"inv_trapezoid"),c.addVertexMapping)c.addVertexMapping(i[n-3],i[n-1],"inv_trapezoid",this._$);break;case 83:if(this.$=i[n-3],c.addVertex(i[n-3],i[n-1],"lean_right"),c.addVertexMapping)c.addVertexMapping(i[n-3],i[n-1],"lean_right",this._$);break;case 84:if(this.$=i[n-3],c.addVertex(i[n-3],i[n-1],"lean_left"),c.addVertexMapping)c.addVertexMapping(i[n-3],i[n-1],"lean_left",this._$);break;case 85:if(this.$=i[n],c.addVertex(i[n]),c.addVertexMapping)c.addVertexMapping(i[n],void 0,void 0,this._$);break;case 86:i[n-1].text=i[n],this.$=i[n-1];break;case 87:case 88:i[n-2].text=i[n-1],this.$=i[n-2];break;case 89:this.$=i[n];break;case 90:var Y=c.destructLink(i[n],i[n-2]);this.$={type:Y.type,stroke:Y.stroke,length:Y.length,edgeSemantic:Y.edgeSemantic,text:i[n-1]};break;case 91:var Y=c.destructLink(i[n],i[n-2]);this.$={type:Y.type,stroke:Y.stroke,length:Y.length,edgeSemantic:Y.edgeSemantic,text:i[n-1],id:i[n-3]};break;case 92:this.$={text:i[n],type:"text"};break;case 93:this.$={text:i[n-1].text+""+i[n],type:i[n-1].type};break;case 94:this.$={text:i[n],type:"string"};break;case 95:this.$={text:i[n],type:"markdown"};break;case 96:var Y=c.destructLink(i[n]);this.$={type:Y.type,stroke:Y.stroke,length:Y.length,edgeSemantic:Y.edgeSemantic};break;case 97:var Y=c.destructLink(i[n]);this.$={type:Y.type,stroke:Y.stroke,length:Y.length,edgeSemantic:Y.edgeSemantic,id:i[n-1]};break;case 98:this.$=i[n-1];break;case 99:this.$={text:i[n],type:"text"};break;case 100:this.$={text:i[n-1].text+""+i[n],type:i[n-1].type};break;case 101:this.$={text:i[n],type:"string"};break;case 102:case 119:this.$={text:i[n],type:"markdown"};break;case 116:this.$={text:i[n],type:"text"};break;case 117:this.$={text:i[n-1].text+""+i[n],type:i[n-1].type};break;case 118:this.$={text:i[n],type:"text"};break;case 120:this.$=i[n-4],c.addClass(i[n-2],i[n]);break;case 121:this.$=i[n-4],c.setClass(i[n-2],i[n]);break;case 122:case 130:this.$=i[n-1],c.setClickEvent(i[n-1],i[n]);break;case 123:case 131:this.$=i[n-3],c.setClickEvent(i[n-3],i[n-2]),c.setTooltip(i[n-3],i[n]);break;case 124:this.$=i[n-2],c.setClickEvent(i[n-2],i[n-1],i[n]);break;case 125:this.$=i[n-4],c.setClickEvent(i[n-4],i[n-3],i[n-2]),c.setTooltip(i[n-4],i[n]);break;case 126:this.$=i[n-2],c.setLink(i[n-2],i[n]);break;case 127:this.$=i[n-4],c.setLink(i[n-4],i[n-2]),c.setTooltip(i[n-4],i[n]);break;case 128:this.$=i[n-4],c.setLink(i[n-4],i[n-2],i[n]);break;case 129:this.$=i[n-6],c.setLink(i[n-6],i[n-4],i[n]),c.setTooltip(i[n-6],i[n-2]);break;case 132:this.$=i[n-1],c.setLink(i[n-1],i[n]);break;case 133:this.$=i[n-3],c.setLink(i[n-3],i[n-2]),c.setTooltip(i[n-3],i[n]);break;case 134:this.$=i[n-3],c.setLink(i[n-3],i[n-2],i[n]);break;case 135:this.$=i[n-5],c.setLink(i[n-5],i[n-4],i[n]),c.setTooltip(i[n-5],i[n-2]);break;case 136:this.$=i[n-4],c.addVertex(i[n-2],void 0,void 0,i[n]);break;case 137:this.$=i[n-4],c.updateLink([i[n-2]],i[n]);break;case 138:this.$=i[n-4],c.updateLink(i[n-2],i[n]);break;case 139:this.$=i[n-8],c.updateLinkInterpolate([i[n-6]],i[n-2]),c.updateLink([i[n-6]],i[n]);break;case 140:this.$=i[n-8],c.updateLinkInterpolate(i[n-6],i[n-2]),c.updateLink(i[n-6],i[n]);break;case 141:this.$=i[n-6],c.updateLinkInterpolate([i[n-4]],i[n]);break;case 142:this.$=i[n-6],c.updateLinkInterpolate(i[n-4],i[n]);break;case 143:case 145:this.$=[i[n]];break;case 144:case 146:i[n-2].push(i[n]),this.$=i[n-2];break;case 148:this.$=i[n-1]+i[n];break;case 196:this.$=i[n];break;case 197:this.$=i[n-1]+""+i[n];break;case 199:this.$=i[n-1]+""+i[n];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"};break}},"anonymous"),table:[{3:1,4:2,8:a,10:o,11:u,13:d},{1:[3]},t(h,l,{5:7}),{4:8,8:a,10:o,11:u,13:d},{4:9,8:a,10:o,11:u,13:d},{4:10,8:a,10:o,11:u,13:d},{14:[1,11],15:[1,12]},{1:[2,1],6:13,7:14,8:f,9:m,10:k,11:x,12:_,21:20,23:21,24:22,25:23,26:24,27:25,28:P,35:B,36:W,37:29,38:w,40:D,42:g,45:33,46:44,47:b,48:45,50:46,63:M,87:q,88:Se,89:Be,90:Ve,91:Me,92:Q,105:J,108:Z,109:ee,112:te,114:re,116:47,117:ne,118:ue,119:ce,124:qe,125:Xe,126:Qe,127:Je,128:Ze},t(h,[2,10]),t(h,[2,11]),t(h,[2,12]),t(h,[2,13]),{8:[1,63],9:[1,60],10:[1,61],11:We,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:me,9:Ae,10:Ee,12:Ce,22:65,44:66,75:71,78:[1,72],80:[1,74],81:[1,73]},{8:me,9:Ae,10:Ee,12:Ce,22:75},{8:me,9:Ae,10:Ee,12:Ce,22:76},{8:me,9:Ae,10:Ee,12:Ce,22:77},{8:me,9:Ae,10:Ee,12:Ce,22:78},{8:me,9:Ae,10:Ee,12:Ce,22:79},{8:me,9:Ae,10:Ee,11:[1,80],12:Ce,22:81},{8:me,9:Ae,10:Ee,12:Ce,22:82},{11:[1,83]},t(R,[2,48]),{39:[1,84]},{41:[1,85]},t(R,[2,51]),t(rt,[2,63],{19:86,34:87,11:We,43:nt}),{11:[1,89]},{11:[1,90]},{11:[1,91]},{11:[1,92]},{15:at,47:ot,63:ut,83:[1,96],92:lt,98:[1,93],100:[1,94],104:95,108:ct,109:dt,112:ht,114:pt,117:ft,118:gt,119:bt,123:97},t(R,[2,200]),t(R,[2,201]),t(R,[2,202]),t(R,[2,203]),t(R,[2,204]),t($e,[2,64]),t($e,[2,67],{49:[1,109]}),t(pe,[2,85],{116:122,30:[1,110],47:b,51:[1,111],53:[1,112],55:[1,113],57:[1,114],59:[1,115],61:[1,116],63:M,66:[1,117],68:[1,118],70:[1,119],71:[1,120],73:[1,121],92:Q,105:J,108:Z,109:ee,112:te,114:re,117:ne,118:ue,119:ce}),t(Te,[2,196]),t(Te,[2,157]),t(Te,[2,158]),t(Te,[2,159]),t(Te,[2,160]),t(Te,[2,161]),t(Te,[2,162]),t(Te,[2,163]),t(Te,[2,164]),t(Te,[2,165]),t(Te,[2,166]),t(Te,[2,167]),t(h,[2,14]),t(h,[2,20]),t(h,[2,21]),{10:[1,123]},t(h,[2,23]),t(h1,[2,31],{19:124,11:We}),t(R,[2,32]),{45:125,46:44,47:b,48:45,50:46,63:M,92:Q,105:J,108:Z,109:ee,112:te,114:re,116:47,117:ne,118:ue,119:ce},t(R,[2,52]),t(R,[2,53]),t(R,[2,54]),t(R,[2,55]),t(kt,[2,89],{76:126,65:[1,128],77:[1,127]}),{79:129,82:130,83:p1,84:f1,119:_t,122:vt},{78:[1,135],80:[1,136]},t(g1,[2,96]),t(R,[2,33]),t(R,[2,34]),t(R,[2,35]),t(R,[2,36]),t(R,[2,37]),{11:Ft,13:Vt,15:It,28:Lt,29:137,33:Bt,35:yt,36:wt,47:Nt,63:Rt,78:Ot,83:b1,84:k1,86:150,87:Gt,88:Ut,89:jt,90:zt,91:Wt,92:Kt,93:Ht,94:138,108:Yt,112:qt,114:Xt,117:Qt,118:Jt,119:Zt},t(mt,l,{5:165}),t(mt,l,{5:166}),{11:Ft,13:Vt,15:It,28:Lt,29:167,33:Bt,35:yt,36:wt,47:Nt,63:Rt,78:Ot,83:b1,84:k1,86:150,87:Gt,88:Ut,89:jt,90:zt,91:Wt,92:Kt,93:Ht,94:138,108:Yt,112:qt,114:Xt,117:Qt,118:Jt,119:Zt},t(R,[2,49]),t(R,[2,50]),t(rt,[2,61],{47:m1}),t(rt,[2,62],{19:169,11:We,43:At}),t($e,[2,57]),{47:b,50:171,63:M,92:Q,105:J,108:Z,109:ee,112:te,114:re,116:47,117:ne,118:ue,119:ce},{105:[1,172],106:173,108:[1,174]},{47:b,50:175,63:M,92:Q,105:J,108:Z,109:ee,112:te,114:re,116:47,117:ne,118:ue,119:ce},{47:b,50:176,63:M,92:Q,105:J,108:Z,109:ee,112:te,114:re,116:47,117:ne,118:ue,119:ce},t(X,[2,122],{11:[1,177],99:[1,178]}),{83:[1,179]},t(X,[2,130],{123:181,11:[1,180],15:at,47:ot,63:ut,92:lt,108:ct,109:dt,112:ht,114:pt,117:ft,118:gt,119:bt}),t(X,[2,132],{11:[1,182]}),t(De,[2,198]),t(De,[2,185]),t(De,[2,186]),t(De,[2,187]),t(De,[2,188]),t(De,[2,189]),t(De,[2,190]),t(De,[2,191]),t(De,[2,192]),t(De,[2,193]),t(De,[2,194]),t(De,[2,195]),{47:b,50:183,63:M,92:Q,105:J,108:Z,109:ee,112:te,114:re,116:47,117:ne,118:ue,119:ce},{31:184,70:G,83:be,84:ke,85:185,119:U,120:j,121:z},{31:192,70:G,83:be,84:ke,85:185,119:U,120:j,121:z},{31:194,53:[1,193],70:G,83:be,84:ke,85:185,119:U,120:j,121:z},{31:195,70:G,83:be,84:ke,85:185,119:U,120:j,121:z},{31:196,70:G,83:be,84:ke,85:185,119:U,120:j,121:z},{31:197,70:G,83:be,84:ke,85:185,119:U,120:j,121:z},{112:[1,198]},{31:199,70:G,83:be,84:ke,85:185,119:U,120:j,121:z},{31:200,68:[1,201],70:G,83:be,84:ke,85:185,119:U,120:j,121:z},{31:202,70:G,83:be,84:ke,85:185,119:U,120:j,121:z},{31:203,70:G,83:be,84:ke,85:185,119:U,120:j,121:z},{31:204,70:G,83:be,84:ke,85:185,119:U,120:j,121:z},t(Te,[2,197]),t(h,[2,22]),t(h1,[2,30]),t(rt,[2,59],{34:205,19:206,11:We,43:nt}),t(kt,[2,86],{11:[1,207]}),{11:[1,208]},{31:209,70:G,83:be,84:ke,85:185,119:U,120:j,121:z},{80:[1,210],82:211,119:_t,122:vt},t(Et,[2,92]),t(Et,[2,94]),t(Et,[2,95]),t(Et,[2,183]),t(Et,[2,184]),{79:212,82:130,83:p1,84:f1,119:_t,122:vt},t(g1,[2,97]),{8:me,9:Ae,10:Ee,11:Ft,12:Ce,13:Vt,15:It,22:214,28:Lt,30:[1,213],33:Bt,34:215,35:yt,36:wt,43:nt,47:Nt,63:Rt,78:Ot,86:150,87:Gt,88:Ut,89:jt,90:zt,91:Wt,92:Kt,93:Ht,94:216,108:Yt,112:qt,114:Xt,117:Qt,118:Jt,119:Zt},t(K,[2,116]),t(K,[2,118]),t(K,[2,119]),t(K,[2,172]),t(K,[2,173]),t(K,[2,174]),t(K,[2,175]),t(K,[2,176]),t(K,[2,177]),t(K,[2,178]),t(K,[2,179]),t(K,[2,180]),t(K,[2,181]),t(K,[2,182]),t(K,[2,103]),t(K,[2,104]),t(K,[2,105]),t(K,[2,106]),t(K,[2,107]),t(K,[2,108]),t(K,[2,109]),t(K,[2,110]),t(K,[2,111]),t(K,[2,112]),t(K,[2,113]),t(K,[2,114]),t(K,[2,115]),{6:13,7:14,8:f,9:m,10:k,11:x,12:_,21:20,23:21,24:22,25:23,26:24,27:25,28:P,33:[1,217],35:B,36:W,37:29,38:w,40:D,42:g,45:33,46:44,47:b,48:45,50:46,63:M,87:q,88:Se,89:Be,90:Ve,91:Me,92:Q,105:J,108:Z,109:ee,112:te,114:re,116:47,117:ne,118:ue,119:ce,124:qe,125:Xe,126:Qe,127:Je,128:Ze},{6:13,7:14,8:f,9:m,10:k,11:x,12:_,21:20,23:21,24:22,25:23,26:24,27:25,28:P,33:[1,218],35:B,36:W,37:29,38:w,40:D,42:g,45:33,46:44,47:b,48:45,50:46,63:M,87:q,88:Se,89:Be,90:Ve,91:Me,92:Q,105:J,108:Z,109:ee,112:te,114:re,116:47,117:ne,118:ue,119:ce,124:qe,125:Xe,126:Qe,127:Je,128:Ze},{8:me,9:Ae,10:Ee,11:Ft,12:Ce,13:Vt,15:It,22:220,28:Lt,30:[1,219],33:Bt,34:221,35:yt,36:wt,43:nt,47:Nt,63:Rt,78:Ot,86:150,87:Gt,88:Ut,89:jt,90:zt,91:Wt,92:Kt,93:Ht,94:216,108:Yt,112:qt,114:Xt,117:Qt,118:Jt,119:Zt},{11:We,19:222},{47:[1,223]},t($e,[2,56]),{11:[1,224],47:b,63:M,92:Q,105:J,108:Z,109:ee,112:te,114:re,116:122,117:ne,118:ue,119:ce},{11:[1,225]},{11:[1,226],109:[1,227]},t(A1,[2,143]),{11:[1,228],47:b,63:M,92:Q,105:J,108:Z,109:ee,112:te,114:re,116:122,117:ne,118:ue,119:ce},{11:[1,229],47:b,63:M,92:Q,105:J,108:Z,109:ee,112:te,114:re,116:122,117:ne,118:ue,119:ce},{83:[1,230]},t(X,[2,124],{11:[1,231]}),t(X,[2,126],{11:[1,232]}),{83:[1,233]},t(De,[2,199]),{83:[1,234],101:[1,235]},t($e,[2,68],{116:122,47:b,63:M,92:Q,105:J,108:Z,109:ee,112:te,114:re,117:ne,118:ue,119:ce}),{32:[1,236],70:G,85:237,119:U,120:j,121:z},t(Ke,[2,99]),t(Ke,[2,101]),t(Ke,[2,102]),t(Ke,[2,168]),t(Ke,[2,169]),t(Ke,[2,170]),t(Ke,[2,171]),{52:[1,238],70:G,85:237,119:U,120:j,121:z},{31:239,70:G,83:be,84:ke,85:185,119:U,120:j,121:z},{54:[1,240],70:G,85:237,119:U,120:j,121:z},{56:[1,241],70:G,85:237,119:U,120:j,121:z},{58:[1,242],70:G,85:237,119:U,120:j,121:z},{60:[1,243],70:G,85:237,119:U,120:j,121:z},{63:[1,244]},{67:[1,245],70:G,85:237,119:U,120:j,121:z},{69:[1,246],70:G,85:237,119:U,120:j,121:z},{31:247,70:G,83:be,84:ke,85:185,119:U,120:j,121:z},{32:[1,248],70:G,85:237,119:U,120:j,121:z},{70:G,72:[1,249],74:[1,250],85:237,119:U,120:j,121:z},{70:G,72:[1,252],74:[1,251],85:237,119:U,120:j,121:z},t(rt,[2,58],{19:169,11:We,43:At}),t(rt,[2,60],{47:m1}),t(kt,[2,88]),t(kt,[2,87]),{65:[1,253],70:G,85:237,119:U,120:j,121:z},t(kt,[2,90]),t(Et,[2,93]),{80:[1,254],82:211,119:_t,122:vt},{31:255,70:G,83:be,84:ke,85:185,119:U,120:j,121:z},t(mt,l,{5:256}),{8:me,9:Ae,10:Ee,12:Ce,22:257,43:At},t(K,[2,117]),t(R,[2,42]),t(R,[2,43]),{31:258,70:G,83:be,84:ke,85:185,119:U,120:j,121:z},t(R,[2,46]),{8:me,9:Ae,10:Ee,12:Ce,22:259,43:At},{46:260,47:b,48:45,50:46,63:M,92:Q,105:J,108:Z,109:ee,112:te,114:re,116:47,117:ne,118:ue,119:ce},{11:We,19:261},{11:ye,63:we,87:Ne,95:262,108:Re,110:263,111:264,112:Oe,113:Pe,114:Ge,115:Ue},{11:ye,63:we,87:Ne,95:273,107:[1,274],108:Re,110:263,111:264,112:Oe,113:Pe,114:Ge,115:Ue},{11:ye,63:we,87:Ne,95:275,107:[1,276],108:Re,110:263,111:264,112:Oe,113:Pe,114:Ge,115:Ue},{108:[1,277]},{11:ye,63:we,87:Ne,95:278,108:Re,110:263,111:264,112:Oe,113:Pe,114:Ge,115:Ue},{47:b,50:279,63:M,92:Q,105:J,108:Z,109:ee,112:te,114:re,116:47,117:ne,118:ue,119:ce},t(X,[2,123]),{83:[1,280]},{83:[1,281],101:[1,282]},t(X,[2,131]),t(X,[2,133],{11:[1,283]}),t(X,[2,134]),t(pe,[2,69]),t(Ke,[2,100]),t(pe,[2,70]),{54:[1,284],70:G,85:237,119:U,120:j,121:z},t(pe,[2,77]),t(pe,[2,72]),t(pe,[2,73]),t(pe,[2,74]),{112:[1,285]},t(pe,[2,76]),t(pe,[2,78]),{69:[1,286],70:G,85:237,119:U,120:j,121:z},t(pe,[2,80]),t(pe,[2,81]),t(pe,[2,83]),t(pe,[2,82]),t(pe,[2,84]),t([11,47,63,92,105,108,109,112,114,117,118,119],[2,98]),t(kt,[2,91]),{32:[1,287],70:G,85:237,119:U,120:j,121:z},{6:13,7:14,8:f,9:m,10:k,11:x,12:_,21:20,23:21,24:22,25:23,26:24,27:25,28:P,33:[1,288],35:B,36:W,37:29,38:w,40:D,42:g,45:33,46:44,47:b,48:45,50:46,63:M,87:q,88:Se,89:Be,90:Ve,91:Me,92:Q,105:J,108:Z,109:ee,112:te,114:re,116:47,117:ne,118:ue,119:ce,124:qe,125:Xe,126:Qe,127:Je,128:Ze},t(mt,l,{5:289}),{32:[1,290],70:G,85:237,119:U,120:j,121:z},t(R,[2,47]),t($e,[2,66]),{46:291,47:b,48:45,50:46,63:M,92:Q,105:J,108:Z,109:ee,112:te,114:re,116:47,117:ne,118:ue,119:ce},t(X,[2,136],{109:Ct}),t(E1,[2,145],{111:293,11:ye,63:we,87:Ne,108:Re,112:Oe,113:Pe,114:Ge,115:Ue}),t(Ie,[2,147]),t(Ie,[2,149]),t(Ie,[2,150]),t(Ie,[2,151]),t(Ie,[2,152]),t(Ie,[2,153]),t(Ie,[2,154]),t(Ie,[2,155]),t(Ie,[2,156]),t(X,[2,137],{109:Ct}),{11:[1,294]},t(X,[2,138],{109:Ct}),{11:[1,295]},t(A1,[2,144]),t(X,[2,120],{109:Ct}),t(X,[2,121],{116:122,47:b,63:M,92:Q,105:J,108:Z,109:ee,112:te,114:re,117:ne,118:ue,119:ce}),t(X,[2,125]),t(X,[2,127],{11:[1,296]}),t(X,[2,128]),{101:[1,297]},{54:[1,298]},{65:[1,299]},{69:[1,300]},{8:me,9:Ae,10:Ee,12:Ce,22:301,34:302,43:nt},t(R,[2,40]),{6:13,7:14,8:f,9:m,10:k,11:x,12:_,21:20,23:21,24:22,25:23,26:24,27:25,28:P,33:[1,303],35:B,36:W,37:29,38:w,40:D,42:g,45:33,46:44,47:b,48:45,50:46,63:M,87:q,88:Se,89:Be,90:Ve,91:Me,92:Q,105:J,108:Z,109:ee,112:te,114:re,116:47,117:ne,118:ue,119:ce,124:qe,125:Xe,126:Qe,127:Je,128:Ze},{8:me,9:Ae,10:Ee,12:Ce,22:304,34:305,43:nt},t($e,[2,65]),{11:ye,63:we,87:Ne,108:Re,110:306,111:264,112:Oe,113:Pe,114:Ge,115:Ue},t(Ie,[2,148]),{15:at,47:ot,63:ut,92:lt,104:307,108:ct,109:dt,112:ht,114:pt,117:ft,118:gt,119:bt,123:97},{15:at,47:ot,63:ut,92:lt,104:308,108:ct,109:dt,112:ht,114:pt,117:ft,118:gt,119:bt,123:97},{101:[1,309]},t(X,[2,135]),t(pe,[2,71]),{31:310,70:G,83:be,84:ke,85:185,119:U,120:j,121:z},t(pe,[2,79]),t(mt,l,{5:311}),{8:me,9:Ae,10:Ee,12:Ce,22:312,43:At},t(R,[2,41]),t(R,[2,44]),{8:me,9:Ae,10:Ee,12:Ce,22:313,43:At},t(E1,[2,146],{111:293,11:ye,63:we,87:Ne,108:Re,112:Oe,113:Pe,114:Ge,115:Ue}),t(X,[2,141],{123:181,11:[1,314],15:at,47:ot,63:ut,92:lt,108:ct,109:dt,112:ht,114:pt,117:ft,118:gt,119:bt}),t(X,[2,142],{123:181,11:[1,315],15:at,47:ot,63:ut,92:lt,108:ct,109:dt,112:ht,114:pt,117:ft,118:gt,119:bt}),t(X,[2,129]),{32:[1,316],70:G,85:237,119:U,120:j,121:z},{6:13,7:14,8:f,9:m,10:k,11:x,12:_,21:20,23:21,24:22,25:23,26:24,27:25,28:P,33:[1,317],35:B,36:W,37:29,38:w,40:D,42:g,45:33,46:44,47:b,48:45,50:46,63:M,87:q,88:Se,89:Be,90:Ve,91:Me,92:Q,105:J,108:Z,109:ee,112:te,114:re,116:47,117:ne,118:ue,119:ce,124:qe,125:Xe,126:Qe,127:Je,128:Ze},t(mt,l,{5:318}),t(R,[2,45]),{11:ye,63:we,87:Ne,95:319,108:Re,110:263,111:264,112:Oe,113:Pe,114:Ge,115:Ue},{11:ye,63:we,87:Ne,95:320,108:Re,110:263,111:264,112:Oe,113:Pe,114:Ge,115:Ue},t(pe,[2,75]),t(R,[2,38]),{6:13,7:14,8:f,9:m,10:k,11:x,12:_,21:20,23:21,24:22,25:23,26:24,27:25,28:P,33:[1,321],35:B,36:W,37:29,38:w,40:D,42:g,45:33,46:44,47:b,48:45,50:46,63:M,87:q,88:Se,89:Be,90:Ve,91:Me,92:Q,105:J,108:Z,109:ee,112:te,114:re,116:47,117:ne,118:ue,119:ce,124:qe,125:Xe,126:Qe,127:Je,128:Ze},t(X,[2,139],{109:Ct}),t(X,[2,140],{109:Ct}),t(R,[2,39])],defaultActions:{},parseError:e(function(v,F){if(F.recoverable)this.trace(v);else{var V=Error(v);throw V.hash=F,V}},"parseError"),parse:e(function(v){var F=this,V=[0],c=[],H=[null],i=[],O=this.table,n="",Y=0,C1=0,S1=0,R1=2,x1=1,O1=i.slice.call(arguments,1),de=Object.create(this.lexer),st={yy:{}};for(var n1 in this.yy)if(Object.prototype.hasOwnProperty.call(this.yy,n1))st.yy[n1]=this.yy[n1];if(de.setInput(v,st.yy),st.yy.lexer=de,st.yy.parser=this,typeof de.yylloc>"u")de.yylloc={};var a1=de.yylloc;i.push(a1);var P1=de.options&&de.options.ranges;if(typeof st.yy.parseError==="function")this.parseError=st.yy.parseError;else this.parseError=Object.getPrototypeOf(this).parseError;function G1(ve){V.length=V.length-2*ve,H.length=H.length-ve,i.length=i.length-ve}e(G1,"popStack");function T1(){var ve=c.pop()||de.lex()||x1;if(typeof ve!=="number"){if(ve instanceof Array)c=ve,ve=c.pop();ve=F.symbols_[ve]||ve}return ve}e(T1,"lex");var xe,o1,it,_e,is,u1,St={},e1,ze,D1,t1;while(!0){if(it=V[V.length-1],this.defaultActions[it])_e=this.defaultActions[it];else{if(xe===null||typeof xe>"u")xe=T1();_e=O[it]&&O[it][xe]}if(typeof _e>"u"||!_e.length||!_e[0]){var l1="";t1=[];for(e1 in O[it])if(this.terminals_[e1]&&e1>R1)t1.push("'"+this.terminals_[e1]+"'");if(de.showPosition)l1="Parse error on line "+(Y+1)+`:
22
+ You have to call mermaid.initialize.`)}isLinkData(t){return t!==null&&typeof t==="object"&&"id"in t&&typeof t.id==="string"}addLink(t,a,o){let u=this.isLinkData(o)?o.id.replace("@",""):void 0;r.info("addLink",t,a,u);for(let d of t)for(let h of a){let l=d===t[t.length-1],f=h===a[0];if(l&&f)this.addSingleLink(d,h,o,u);else this.addSingleLink(d,h,o,void 0)}}updateLinkInterpolate(t,a){t.forEach((o)=>{if(o==="default"){this.edges.defaultInterpolate=a;return}if(typeof o==="number"&&o>=this.edges.length)throw Error(`The index ${o} 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[o].interpolate=a})}updateLink(t,a){t.forEach((o)=>{if(typeof o==="number"&&o>=this.edges.length)throw Error(`The index ${o} 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.)`);if(o==="default")this.edges.defaultStyle=a;else if(this.edges[o].style=a,(this.edges[o]?.style?.length??0)>0&&!this.edges[o]?.style?.some((u)=>u?.startsWith("fill")))this.edges[o]?.style?.push("fill:none")})}addClass(t,a){let o=a.join().replace(/\\,/g,"§§§").replace(/,/g,";").replace(/§§§/g,",").split(";");t.split(",").forEach((u)=>{let d=this.classes.get(u);if(d===void 0)d={id:u,styles:[],textStyles:[]},this.classes.set(u,d);if(o!==void 0&&o!==null)o.forEach((h)=>{if(/color/.exec(h)){let l=h.replace("fill","bgFill");d.textStyles.push(l)}d.styles.push(h)})})}setDirection(t){if(this.direction=t.trim(),/.*</.exec(this.direction))this.direction="RL";if(/.*\^/.exec(this.direction))this.direction="BT";if(/.*>/.exec(this.direction))this.direction="LR";if(/.*v/.exec(this.direction))this.direction="TB";if(this.direction==="TD")this.direction="TB"}setClass(t,a){for(let o of t.split(",")){let u=this.vertices.get(o);if(u)u.classes.push(a);let d=this.edges.find((l)=>l.id===o);if(d)d.classes.push(a);let h=this.subGraphLookup.get(o);if(h)h.classes.push(a)}}setTooltip(t,a){if(a===void 0)return;a=this.sanitizeText(a);for(let o of t.split(","))this.tooltips.set(this.version==="gen-1"?this.lookUpDomId(o):o,a)}setClickFun(t,a,o){if(s().securityLevel!=="loose")return;if(a===void 0)return;let u=[];if(typeof o==="string"){u=o.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);for(let h=0;h<u.length;h++){let l=u[h].trim();if(l.startsWith('"')&&l.endsWith('"'))l=l.substr(1,l.length-2);u[h]=l}}if(u.length===0)u.push(t);let d=this.vertices.get(t);if(d)d.haveCallback=!0,this.funs.push(()=>{let h=this.lookUpDomId(t),l=document.querySelector(`[id="${h}"]`);if(l!==null)l.addEventListener("click",()=>{N.runFunc(a,...u)},!1)})}setLink(t,a,o){t.split(",").forEach((u)=>{let d=this.vertices.get(u);if(d!==void 0)d.link=N.formatUrl(a,this.config),d.linkTarget=o}),this.setClass(t,"clickable")}getTooltip(t){return this.tooltips.get(t)}setClickEvent(t,a,o){t.split(",").forEach((u)=>{this.setClickFun(u,a,o)}),this.setClass(t,"clickable")}bindFunctions(t){this.funs.forEach((a)=>{a(t)})}getDirection(){return this.direction?.trim()}getVertices(){return this.vertices}getEdges(){return this.edges}isToolDefinition(t){return H1.has(t.type)}getTools(){let t=[];for(let a of this.vertices.values())if(this.isToolDefinition(a))t.push(a);return t}getClasses(){return this.classes}setupToolTips(t){let a=Pt();p(t).select("svg").selectAll("g.node").on("mouseover",(d)=>{let h=p(d.currentTarget),l=h.attr("title");if(l===null)return;let f=d.currentTarget?.getBoundingClientRect();a.transition().duration(200).style("opacity",".9"),a.text(h.attr("title")).style("left",window.scrollX+f.left+(f.right-f.left)/2+"px").style("top",window.scrollY+f.bottom+"px"),a.html(Le.sanitize(l)),h.classed("hover",!0)}).on("mouseout",(d)=>{a.transition().duration(500).style("opacity",0),p(d.currentTarget).classed("hover",!1)})}clear(t="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=t,this.config=s(),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(t){this.version=t||"gen-2"}defaultStyle(){return"fill:#ffa;stroke: #f66; stroke-width: 3px; stroke-dasharray: 5, 5;fill:#ffa;stroke: #666;"}addSubGraph(t,a,o,u){let d=t?.text?.trim(),h=o?.text;if(t===o&&o?.text&&/\s/.exec(o.text))d=void 0;let f=e((B)=>{let W={boolean:{},number:{},string:{}},w=[],D;return{nodeList:B.filter(function(b){let M=typeof b;if(b.stmt&&b.stmt==="dir")return D=b.value,!1;if(b.trim()==="")return!1;if(M in W)return W[M].hasOwnProperty(b)?!1:W[M][b]=!0;else return w.includes(b)?!1:w.push(b)}),dir:D}},"uniq")(a.flat()),{nodeList:m,dir:k}=f,x=s().flowchart??{};if(k=k??(x.inheritDir?this.getDirection()??s().direction??void 0:void 0),this.version==="gen-1")for(let B=0;B<m.length;B++)m[B]=this.lookUpDomId(m[B]);d=d??"subGraph"+this.subCount,h=h||"",h=this.sanitizeText(h),this.subCount=this.subCount+1;let _={id:d,nodes:m.filter((B)=>B!==d&&!this.globalNodes.has(B)),title:h.trim(),classes:[],dir:k,labelType:this.sanitizeNodeLabelType(o?.type),type:u??"flow"};r.info("Adding",_.id,_.nodes,_.dir),_.nodes=this.makeUniq(_,this.subGraphs).nodes;let P=this.getPosForId(d);if(P!==-1){let B=this.subGraphs[P];for(let W of _.nodes)if(!B.nodes.includes(W))B.nodes.push(W);if(_.title)B.title=_.title;if(_.dir)B.dir=_.dir;if(_.type)B.type=_.type;this.subGraphLookup.set(d,B)}else this.subGraphs.push(_),this.subGraphLookup.set(d,_);return d}addGlobal(t){for(let a of t.flat()){if(typeof a!=="string")continue;let o=a.trim();if(o!=="")this.globalNodes.add(o)}for(let a of this.subGraphs)a.nodes=a.nodes.filter((o)=>!this.globalNodes.has(o))}getPosForId(t){for(let[a,o]of this.subGraphs.entries())if(o.id===t)return a;return-1}indexNodes2(t,a){let o=this.subGraphs[a].nodes;if(this.secCount=this.secCount+1,this.secCount>2000)return{result:!1,count:0};if(this.posCrossRef[this.secCount]=a,this.subGraphs[a].id===t)return{result:!0,count:0};let u=0,d=1;while(u<o.length){let h=this.getPosForId(o[u]);if(h>=0){let l=this.indexNodes2(t,h);if(l.result)return{result:!0,count:d+l.count};else d=d+l.count}u=u+1}return{result:!1,count:d}}getDepthFirstPos(t){return this.posCrossRef[t]}indexNodes(){if(this.secCount=-1,this.subGraphs.length>0)this.indexNodes2("none",this.subGraphs.length-1)}addConnector(t,a){let o=t?.text?.trim();if(!o)return"";let u=a?.text?.trim()??"",d=u.length>0?this.sanitizeText(u):o,h=this.connectors.get(o);if(!h)h={id:o,labelType:"text",domId:_1+o+"-"+this.vertexCounter,styles:[],classes:[],isConnector:!0,text:d},this.connectors.set(o,h),this.vertices.set(o,h),this.vertexCounter++;else if(u.length>0)h.text=d;return o}getSubGraphs(){return this.subGraphs}getConnectors(){return[...this.connectors.values()]}firstGraph(){if(this.firstGraphFlag)return this.firstGraphFlag=!1,!0;return!1}computeEdgeSemantic(t,a){if(t==="arrow_point"&&a==="normal")return"sequence";if(t==="arrow_cross"&&a==="normal")return"failure";if(t==="arrow_open"&&a==="dotted")return"reference";return}destructStartLink(t){let a=t.trim(),o="arrow_open",u="normal";if(a.includes("."))u="dotted";return{type:"arrow_open",stroke:u}}countChar(t,a){let o=a.length,u=0;for(let d=0;d<o;++d)if(a[d]===t)++u;return u}destructEndLink(t){let a=t.trim(),o=a.slice(0,-1),u="arrow_open";switch(a.slice(-1)){case"x":u="arrow_cross";break;case">":u="arrow_point";break;case"-":case".":u="arrow_open",o=a;break}let d="normal",h=o.length-1,l=this.countChar(".",o);if(l>0)d="dotted",h=l;return{type:u,stroke:d,length:h}}destructLink(t,a){let o=this.destructEndLink(t),u;if(a){if(u=this.destructStartLink(a),u.stroke!==o.stroke)return{type:"INVALID",stroke:"INVALID"};return u.type=o.type,u.length=o.length,{...u,edgeSemantic:this.computeEdgeSemantic(u.type,u.stroke)}}return{...o,edgeSemantic:this.computeEdgeSemantic(o.type,o.stroke)}}exists(t,a){for(let o of t)if(o.nodes.includes(a))return!0;return!1}makeUniq(t,a){let o=[];return t.nodes.forEach((u,d)=>{if(!this.exists(a,u))o.push(t.nodes[d])}),{nodes:o}}getTypeFromVertex(t){let a=typeof t.type==="string"?Tt(t.type):t.type;switch(a){case"square":case void 0:return"squareRect";case"round":return"roundedRect";case"ellipse":return"ellipse";default:return a}}findNode(t,a){return t.find((o)=>o.id===a)}destructEdgeType(t){let a="none",o="arrow_point";switch(t){case"arrow_point":case"arrow_circle":case"arrow_cross":case"arrow_hierarchy":o=t;break;case"double_arrow_point":case"double_arrow_circle":case"double_arrow_cross":a=t.replace("double_",""),o=a;break}return{arrowTypeStart:a,arrowTypeEnd:o}}addNodeFromVertex(t,a,o,u,d,h){let l=o.get(t.id),f=u.get(t.id)??!1,m=this.findNode(a,t.id);if(m)m.cssStyles=t.styles,m.cssCompiledStyles=this.getCompiledStyles(t.classes),m.cssClasses=t.classes.join(" ");else{let k={id:t.id,label:t.text,labelType:t.labelType,labelStyle:"",parentId:l,padding:d.flowchart?.padding||8,cssStyles:t.styles,cssCompiledStyles:this.getCompiledStyles(["default","node",...t.classes]),cssClasses:"default "+t.classes.join(" "),dir:t.dir,domId:t.domId,look:h,link:t.link,linkTarget:t.linkTarget,tooltip:this.getTooltip(t.id),metadata:t.metadata};if(f)a.push({...k,isGroup:!0,shape:"rect"});else a.push({...k,isGroup:!1,shape:this.getTypeFromVertex(t),wrappingWidth:d.agentflow?.wrappingWidth,minWidth:d.agentflow?.minNodeWidth})}}getCompiledStyles(t){let a=[];for(let o of t){let u=this.classes.get(o);if(u?.styles)a=[...a,...u.styles??[]].map((d)=>d.trim());if(u?.textStyles)a=[...a,...u.textStyles??[]].map((d)=>d.trim())}return a}runPostParseValidators(){if(this.postParseValidationRun)return;this.postParseValidationRun=!0}getData(){this.runPostParseValidators();let t=s(),a=[],o=[],u=this.getSubGraphs(),d=new Map,h=new Map,l=new Set,f=new Map,m=e((g,b,M=new Set)=>{if(M.has(g))return;M.add(g);let q=this.subGraphLookup.get(g);if(!q)return;for(let Ce of q.nodes){if(Ce===b||M.has(Ce))continue;l.add(Ce),f.set(Ce,b),m(Ce,b,M)}},"collectDescendants");for(let g of u)if(g.metadata?.view==="collapsed"&&!l.has(g.id))m(g.id,g.id);let k=e((g,b)=>{let M=new Set,q=b;while(q!==void 0&&!M.has(q)){if(q===g)return!0;M.add(q),q=d.get(q)}return!1},"wouldCloseContainmentCycle");for(let g=u.length-1;g>=0;g--){let b=u[g];if(l.has(b.id))continue;if(b.nodes.length>0)h.set(b.id,!0);for(let M of b.nodes){if(k(M,b.id)){this.emitWarning(Dt.CONTAINMENT_VIOLATION,`Container "${b.id}" cannot contain "${M}" because "${M}" already contains it. The nesting that would close the loop is dropped.`,{nodeId:M});continue}d.set(M,b.id)}}for(let g=u.length-1;g>=0;g--){let b=u[g];if(l.has(b.id))continue;if(b.metadata?.view==="collapsed"){let q={...b.metadata,containerType:b.type};a.push({id:b.id,label:b.title,labelStyle:"",labelType:b.labelType,parentId:d.get(b.id),padding:8,cssCompiledStyles:this.getCompiledStyles(b.classes),cssClasses:b.classes.join(" "),shape:"collapsedGroup",dir:b.dir,isGroup:!1,look:t.look,metadata:q})}else a.push({id:b.id,label:b.title,labelStyle:"",labelType:b.labelType,parentId:d.get(b.id),padding:8,cssCompiledStyles:this.getCompiledStyles(b.classes),cssClasses:b.classes.join(" "),shape:Y1[b.type??"flow"],dir:b.dir,isGroup:!0,look:t.look,metadata:b.metadata})}this.getVertices().forEach((g)=>{if(l.has(g.id))return;this.addNodeFromVertex(g,a,d,h,t,t.look||"classic")});let _=this.getEdges();_.forEach((g,b)=>{let M=f.get(g.start)??g.start,q=f.get(g.end)??g.end;if(M===q&&g.start!==g.end)return;let{arrowTypeStart:Ce,arrowTypeEnd:Ie}=this.destructEdgeType(g.type),ve=[..._.defaultStyle??[]];if(g.style)ve.push(...g.style);let Be={id:Fe(M,q,{counter:b,prefix:"L"},g.id),isUserDefinedId:g.isUserDefinedId,start:M,end:q,type:g.type??"normal",label:g.text,labelType:g.labelType,labelpos:"c",thickness:g.stroke,minlen:g.length,classes:g?.stroke==="invisible"?"":"edge-thickness-normal edge-pattern-solid flowchart-link",arrowTypeStart:g?.stroke==="invisible"||g?.type==="arrow_open"?"none":Ce,arrowTypeEnd:g?.stroke==="invisible"||g?.type==="arrow_open"?"none":Ie,arrowheadStyle:"fill: #333",cssCompiledStyles:this.getCompiledStyles(g.classes),labelStyle:ve,style:ve,pattern:g.stroke,look:t.look,animate:g.animate,animation:g.animation,curve:g.interpolate||this.edges.defaultInterpolate||t.flowchart?.curve,metadata:g.metadata};o.push(Be)}),v1(a,this);let P=new Map,B=new Map;for(let g of u){let b=d.get(g.id);if(b!==void 0)B.set(b,[...B.get(b)??[],g.id])}let W=0,w=e((g)=>{if(P.has(g))return;P.set(g,W++);for(let b of B.get(g)??[])w(b)},"walkContainers");for(let g of u)if(d.get(g.id)===void 0)w(g.id);let D=new Set(this.getConnectors().map((g)=>g.id));return B1(a,(g)=>{if(D.has(g))return"connector";let b=this.vertices.get(g);return b?this.deriveVertexKind(b,Tt(b.type)):void 0},P),{nodes:a,edges:o,other:{},config:t,connectors:this.getConnectors()}}defaultConfig(){return Tn.flowchart}deriveVertexKind(t,a){if(this.isToolDefinition(t))return"tool";if(a==="hexagon"||a==="hex")return"action";if(a==="lean-right"||a==="lean_right")return"input";if(a==="lin-doc"||a==="lined-document")return"refdoc";if(a==="diamond")return"decision";return"task"}getSemanticModel(){this.runPostParseValidators();let t=new Set(this.subGraphs.map((l)=>l.id)),a=[],o=[];for(let[l,f]of this.vertices){if(t.has(l))continue;if(f.isConnector){let x={id:l};if(f.text!==void 0&&f.text!==l)x.title=f.text;if(f.metadata&&Object.keys(f.metadata).length>0){let _={};for(let[P,B]of Object.entries(f.metadata)){if(c1.has(P))continue;_[P]=B}if(Object.keys(_).length>0)x.metadata=_}o.push(x);continue}let m={id:l};if(f.text!==void 0)m.label=f.text;let k=typeof f.type==="string"?Tt(f.type):f.type;if(k!==void 0)m.shape=k;if(m.vertexKind=this.deriveVertexKind(f,k),f.metadata&&Object.keys(f.metadata).length>0){let x={};for(let[_,P]of Object.entries(f.metadata)){if(c1.has(_))continue;x[_]=P}if(Object.keys(x).length>0)m.metadata=x}a.push(m)}let u=this.edges.map((l)=>{let f={start:l.start,end:l.end};if(l.id!==void 0)f.id=l.id;if(typeof l.text==="string"&&l.text.length>0)f.label=l.text;if(l.type!==void 0)f.type=l.type;if(l.stroke!==void 0)f.stroke=l.stroke;if(l.edgeSemantic!==void 0)f.edgeSemantic=l.edgeSemantic;if(l.length!==void 0)f.length=l.length;if(l.metadata&&Object.keys(l.metadata).length>0)f.metadata={...l.metadata};return f}),d=this.subGraphs.map((l)=>{let f={id:l.id,nodes:[...l.nodes]};if(l.type!==void 0)f.type=l.type;if(l.title!==void 0)f.title=l.title;if(l.dir!==void 0)f.direction=l.dir;if(l.metadata&&Object.keys(l.metadata).length>0){let m={};for(let[k,x]of Object.entries(l.metadata)){if(c1.has(k))continue;m[k]=x}if(Object.keys(m).length>0)f.metadata=m}return f}),h={vertices:a,edges:u,subGraphs:d,connectors:o,diagnostics:this.diagnostics};if(this.direction!==void 0)h.direction=this.direction;return h}setFrontmatterLineOffset(t){this.frontmatterLineOffset=t??0}toElementPosition(t){let a=t?.first_line??0,o=t?.first_column??0,u=t?.last_line??a,d=t?.last_column??o,[h,l]=t?.range??[0,0];return{startLine:a+this.frontmatterLineOffset,startColumn:o,endLine:u+this.frontmatterLineOffset,endColumn:d,startIndex:h,endIndex:l}}pushMapping(t,a,o){if(!t)return;let u={id:t,type:a,position:this.toElementPosition(o)};return this.elementMappings.push(u),u}addVertexMapping(t,a,o,u){let d=this.pushMapping(t,"vertex",u);if(d&&o==null)this.bareVertexMappings.add(d)}extendVertexMapping(t,a){if(!t||!a)return;let o=this.toElementPosition(a);for(let u=this.elementMappings.length-1;u>=0;u--){let d=this.elementMappings[u];if(d.type==="vertex"&&d.id===t){if(this.bareVertexMappings.has(d))d.type="attachment",this.bareVertexMappings.delete(d);if(o.endLine>d.position.endLine||o.endLine===d.position.endLine&&o.endColumn>d.position.endColumn)d.position.endLine=o.endLine,d.position.endColumn=o.endColumn,d.position.endIndex=o.endIndex;return}}this.pushMapping(t,"attachment",a)}addEdgeMapping(t,a,o,u){let d=Array.isArray(a)?a.map((l)=>typeof l==="string"?l:l?.id??"").filter(Boolean):[],h=d.length>0?d.join(">"):"edge";this.pushMapping(h,"edge",u)}addSubgraphMapping(t,a,o,u){let d=(typeof t==="string"?t:t?.text)??"",h=this.toElementPosition(o),l=u?this.toElementPosition(u):h;if(!d)return;this.elementMappings.push({id:d,type:"subgraph",position:{startLine:h.startLine,startColumn:h.startColumn,endLine:l.endLine,endColumn:l.endColumn,startIndex:h.startIndex,endIndex:l.endIndex}})}addConnectorMapping(t,a,o,u){let d=t?.text?.trim()??"";if(!d)return;let h=this.toElementPosition(o),l=u?this.toElementPosition(u):h;this.elementMappings.push({id:d,type:"connector",position:{startLine:h.startLine,startColumn:h.startColumn,endLine:l.endLine,endColumn:l.endColumn,startIndex:h.startIndex,endIndex:l.endIndex}})}getElementMappings(){return[...this.elementMappings]}getElementById(t){return this.elementMappings.find((a)=>a.id===t)}getElementsOnLine(t){return this.elementMappings.filter((a)=>t>=a.position.startLine&&t<=a.position.endLine)}getElementAtPosition(t,a){let o=this.elementMappings.filter((d)=>{let{startLine:h,startColumn:l,endLine:f,endColumn:m}=d.position;if(t<h||t>f)return!1;if(t===h&&a<l)return!1;if(t===f&&a>m)return!1;return!0});if(o.length===0)return;let u=e(({position:d})=>[d.endLine-d.startLine,d.endColumn-d.startColumn],"span");return o.reduce((d,h)=>{let[l,f]=u(d),[m,k]=u(h);if(m!==l)return m<l?h:d;return k<f?h:d})}getMappingStats(){let t=0,a=0,o=0,u=0,d=0;for(let h of this.elementMappings)if(h.type==="vertex")t++;else if(h.type==="edge")a++;else if(h.type==="subgraph")o++;else if(h.type==="connector")u++;else if(h.type==="attachment")d++;return{vertices:t,edges:a,subgraphs:o,connectors:u,attachments:d,totalElements:this.elementMappings.length}}emitDiagnostic(t,a,o,u){let d=u?.nodeId??u?.edgeId,h=d?this.getElementById(d):void 0,l={id:t,severity:a,message:o,...u?.nodeId?{nodeId:u.nodeId}:{},...u?.edgeId&&!u?.nodeId?{edgeId:u.edgeId}:{},...h?{position:h.position}:{}};if(this.diagnostics.some((k)=>k.id===l.id&&k.severity===l.severity&&k.message===l.message&&k.nodeId===l.nodeId&&k.edgeId===l.edgeId))return;this.diagnostics.push(l);let m=`agentflow[${t}]: ${o}`;if(a==="error")r.error(m);else r.warn(m)}emitWarning(t,a,o){this.emitDiagnostic(t,"warning",a,o)}emitError(t,a,o){this.emitDiagnostic(t,"error",a,o)}getDiagnostics(){return[...this.diagnostics]}},X1=e(function(t,a){return a.db.getClasses()},"getClasses"),Q1=e(async function(t,a,o,u){r.debug("Drawing agentflow diagram",a);let{securityLevel:d,agentflow:h,layout:l}=s();u.db.setDiagramId(a),r.debug("Before getData: ");let f=u.db.getData();r.debug("Data: ",f);let m=he(a,d),k=u.db.getDirection();if(f.type=u.type,f.layoutAlgorithm=ye(l),f.layoutAlgorithm==="dagre"&&l==="elk")r.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.");f.direction=k,f.nodeSpacing=h?.nodeSpacing||50,f.rankSpacing=h?.rankSpacing||50,f.markers=["point","circle","cross","hierarchy"],f.diagramId=a,r.debug("REF1:",f),await ge(f,m);let x=h?.diagramPadding??8;N.insertTitle(m,"agentflowTitleText",h?.titleTopMargin??0,u.db.getDiagramTitle()),se(m,x,"agentflow",h?.useMaxWidth??!0)},"draw"),J1={getClasses:X1,draw:Q1},d1=function(){var t=e(function(He,v,F,V){for(F=F||{},V=He.length;V--;F[He[V]]=v);return F},"o"),a=[1,5],o=[1,4],u=[1,3],d=[1,6],h=[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],l=[2,2],f=[1,15],m=[1,16],k=[1,17],x=[1,18],_=[1,19],P=[1,26],B=[1,27],W=[1,28],w=[1,30],D=[1,31],g=[1,32],b=[1,55],M=[1,54],q=[1,34],Ce=[1,35],Ie=[1,36],ve=[1,37],Be=[1,38],Q=[1,50],J=[1,52],Z=[1,48],ee=[1,53],te=[1,49],re=[1,56],ne=[1,51],oe=[1,57],ue=[1,58],qe=[1,39],Xe=[1,40],Qe=[1,41],Je=[1,42],Ze=[1,43],We=[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],ke=[1,70],me=[1,68],Ae=[1,67],Ee=[1,69],rt=[8,9,10,12,78,80,81],nt=[1,88],at=[1,101],ot=[1,106],ut=[1,105],lt=[1,102],ct=[1,98],dt=[1,104],ht=[1,100],pt=[1,107],ft=[1,103],gt=[1,108],bt=[1,99],$e=[8,9,10,11,12,43,78,80,81],pe=[8,9,10,11,12,43,49,78,80,81],xe=[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],h1=[8,9,10,12,47,63,78,80,81,92,105,108,109,112,114,117,118,119],kt=[47,63,92,105,108,109,112,114,117,118,119],p1=[1,131],f1=[1,132],_t=[1,134],vt=[1,133],g1=[47,63,65,77,92,105,108,109,112,114,117,118,119],Ft=[1,143],Vt=[1,157],It=[1,158],Lt=[1,159],Bt=[1,162],Mt=[1,161],yt=[1,160],wt=[1,145],Nt=[1,147],Rt=[1,151],b1=[1,139],k1=[1,140],Gt=[1,152],Ut=[1,153],jt=[1,154],zt=[1,155],Wt=[1,156],Kt=[1,163],Ht=[1,164],Yt=[1,141],qt=[1,142],Xt=[1,149],Qt=[1,144],Jt=[1,148],Zt=[1,146],mt=[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],m1=[1,168],At=[1,170],X=[8,9,10,12],Te=[8,9,10,11,12,15,47,63,92,108,109,112,114,117,118,119],G=[1,190],fe=[1,186],be=[1,187],U=[1,191],j=[1,188],z=[1,189],Et=[80,119,122],K=[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],A1=[11,109],Ke=[32,52,54,56,58,60,65,67,69,70,72,74,119,120,121],Me=[1,269],we=[1,267],Ne=[1,271],Re=[1,265],Oe=[1,266],Pe=[1,268],Ge=[1,270],Ue=[1,272],Ct=[1,292],E1=[8,9,10,12,109],Ve=[8,9,10,11,12,63,87,108,109,112,113,114,115],r1={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(v,F,V,c,H,i,O){var n=i.length-1;switch(H){case 2:this.$=[];break;case 3:if(!Array.isArray(i[n])||i[n].length>0)i[n-1].push(i[n]);this.$=i[n-1];break;case 4:case 198:this.$=i[n];break;case 5:case 33:case 34:case 35:case 36:case 37:this.$=[];break;case 13:c.setDirection("TB"),this.$="TB";break;case 14:c.setDirection(i[n-1]),this.$=i[n-1];break;case 32:this.$=i[n-1].nodes;break;case 38:if(this.$=c.addSubGraph(i[n-6],i[n-1],i[n-4],"flow"),c.addSubgraphMapping)c.addSubgraphMapping(i[n-6],i[n-4],O[n-8],O[n]);break;case 39:if(this.$=c.addSubGraph(i[n-7],i[n-1],i[n-5],"flow"),c.addVertex(this.$,void 0,void 0,void 0,void 0,void 0,void 0,i[n-3],O[n-3]),c.addSubgraphMapping)c.addSubgraphMapping(i[n-7],i[n-5],O[n-9],O[n]);break;case 40:if(this.$=c.addSubGraph(i[n-3],i[n-1],{text:"",type:"text"},"flow"),c.addSubgraphMapping)c.addSubgraphMapping(i[n-3],{text:"",type:"text"},O[n-5],O[n]);break;case 41:if(this.$=c.addSubGraph(i[n-4],i[n-1],{text:"",type:"text"},"flow"),c.addVertex(this.$,void 0,void 0,void 0,void 0,void 0,void 0,i[n-3],O[n-3]),c.addSubgraphMapping)c.addSubgraphMapping(i[n-4],{text:"",type:"text"},O[n-6],O[n]);break;case 42:if(this.$=c.addSubGraph(void 0,i[n-1],void 0,"flow"),c.addSubgraphMapping)c.addSubgraphMapping(void 0,void 0,O[n-3],O[n]);break;case 43:c.addGlobal(i[n-1]),this.$=[];break;case 44:if(this.$=c.addConnector(i[n-4],i[n-2]),c.addConnectorMapping)c.addConnectorMapping(i[n-4],i[n-2],O[n-6],O[n]);break;case 45:if(this.$=c.addConnector(i[n-5],i[n-3]),c.addVertex(this.$,void 0,void 0,void 0,void 0,void 0,void 0,i[n-1],O[n-1]),c.addConnectorMapping)c.addConnectorMapping(i[n-5],i[n-3],O[n-7],O[n]);break;case 46:if(this.$=c.addConnector(i[n-1],{text:"",type:"text"}),c.addConnectorMapping)c.addConnectorMapping(i[n-1],{text:"",type:"text"},O[n-3],O[n]);break;case 47:if(this.$=c.addConnector(i[n-2],{text:"",type:"text"}),c.addVertex(this.$,void 0,void 0,void 0,void 0,void 0,void 0,i[n-1],O[n-1]),c.addConnectorMapping)c.addConnectorMapping(i[n-2],{text:"",type:"text"},O[n-4],O[n]);break;case 49:this.$=i[n].trim(),c.setAccTitle(this.$);break;case 50:case 51:this.$=i[n].trim(),c.setAccDescription(this.$);break;case 56:this.$=i[n-1]+i[n];break;case 57:this.$=i[n];break;case 58:if(c.addVertex(i[n-1][i[n-1].length-1],void 0,void 0,void 0,void 0,void 0,void 0,i[n],O[n]),c.extendVertexMapping)c.extendVertexMapping(i[n-1][i[n-1].length-1],O[n]);if(c.addLink(i[n-3].stmt,i[n-1],i[n-2]),c.addEdgeMapping)c.addEdgeMapping(i[n-3].stmt,i[n-1],i[n-2],this._$);this.$={stmt:i[n-1],nodes:i[n-1].concat(i[n-3].nodes)};break;case 59:if(c.addLink(i[n-2].stmt,i[n],i[n-1]),c.addEdgeMapping)c.addEdgeMapping(i[n-2].stmt,i[n],i[n-1],this._$);this.$={stmt:i[n],nodes:i[n].concat(i[n-2].nodes)};break;case 60:if(c.addLink(i[n-3].stmt,i[n-1],i[n-2]),c.addEdgeMapping)c.addEdgeMapping(i[n-3].stmt,i[n-1],i[n-2],this._$);this.$={stmt:i[n-1],nodes:i[n-1].concat(i[n-3].nodes)};break;case 61:this.$={stmt:i[n-1],nodes:i[n-1]};break;case 62:if(c.addVertex(i[n-1][i[n-1].length-1],void 0,void 0,void 0,void 0,void 0,void 0,i[n],O[n]),c.extendVertexMapping)c.extendVertexMapping(i[n-1][i[n-1].length-1],O[n]);this.$={stmt:i[n-1],nodes:i[n-1],shapeData:i[n]};break;case 63:this.$={stmt:i[n],nodes:i[n]};break;case 64:this.$=[i[n]];break;case 65:if(c.addVertex(i[n-5][i[n-5].length-1],void 0,void 0,void 0,void 0,void 0,void 0,i[n-4],O[n-4]),c.extendVertexMapping)c.extendVertexMapping(i[n-5][i[n-5].length-1],O[n-4]);this.$=i[n-5].concat(i[n]);break;case 66:this.$=i[n-4].concat(i[n]);break;case 67:this.$=i[n];break;case 68:this.$=i[n-2],c.setClass(i[n-2],i[n]);break;case 69:if(this.$=i[n-3],c.addVertex(i[n-3],i[n-1],"square"),c.addVertexMapping)c.addVertexMapping(i[n-3],i[n-1],"square",this._$);break;case 70:if(this.$=i[n-3],c.addVertex(i[n-3],i[n-1],"doublecircle"),c.addVertexMapping)c.addVertexMapping(i[n-3],i[n-1],"doublecircle",this._$);break;case 71:if(this.$=i[n-5],c.addVertex(i[n-5],i[n-2],"circle"),c.addVertexMapping)c.addVertexMapping(i[n-5],i[n-2],"circle",this._$);break;case 72:if(this.$=i[n-3],c.addVertex(i[n-3],i[n-1],"ellipse"),c.addVertexMapping)c.addVertexMapping(i[n-3],i[n-1],"ellipse",this._$);break;case 73:if(this.$=i[n-3],c.addVertex(i[n-3],i[n-1],"stadium"),c.addVertexMapping)c.addVertexMapping(i[n-3],i[n-1],"stadium",this._$);break;case 74:if(this.$=i[n-3],c.addVertex(i[n-3],i[n-1],"subroutine"),c.addVertexMapping)c.addVertexMapping(i[n-3],i[n-1],"subroutine",this._$);break;case 75:if(this.$=i[n-7],c.addVertex(i[n-7],i[n-1],"rect",void 0,void 0,void 0,Object.fromEntries([[i[n-5],i[n-3]]])),c.addVertexMapping)c.addVertexMapping(i[n-7],i[n-1],"rect",this._$);break;case 76:if(this.$=i[n-3],c.addVertex(i[n-3],i[n-1],"cylinder"),c.addVertexMapping)c.addVertexMapping(i[n-3],i[n-1],"cylinder",this._$);break;case 77:if(this.$=i[n-3],c.addVertex(i[n-3],i[n-1],"round"),c.addVertexMapping)c.addVertexMapping(i[n-3],i[n-1],"round",this._$);break;case 78:if(this.$=i[n-3],c.addVertex(i[n-3],i[n-1],"diamond"),c.addVertexMapping)c.addVertexMapping(i[n-3],i[n-1],"diamond",this._$);break;case 79:if(this.$=i[n-5],c.addVertex(i[n-5],i[n-2],"hexagon"),c.addVertexMapping)c.addVertexMapping(i[n-5],i[n-2],"hexagon",this._$);break;case 80:if(this.$=i[n-3],c.addVertex(i[n-3],i[n-1],"odd"),c.addVertexMapping)c.addVertexMapping(i[n-3],i[n-1],"odd",this._$);break;case 81:if(this.$=i[n-3],c.addVertex(i[n-3],i[n-1],"trapezoid"),c.addVertexMapping)c.addVertexMapping(i[n-3],i[n-1],"trapezoid",this._$);break;case 82:if(this.$=i[n-3],c.addVertex(i[n-3],i[n-1],"inv_trapezoid"),c.addVertexMapping)c.addVertexMapping(i[n-3],i[n-1],"inv_trapezoid",this._$);break;case 83:if(this.$=i[n-3],c.addVertex(i[n-3],i[n-1],"lean_right"),c.addVertexMapping)c.addVertexMapping(i[n-3],i[n-1],"lean_right",this._$);break;case 84:if(this.$=i[n-3],c.addVertex(i[n-3],i[n-1],"lean_left"),c.addVertexMapping)c.addVertexMapping(i[n-3],i[n-1],"lean_left",this._$);break;case 85:if(this.$=i[n],c.addVertex(i[n]),c.addVertexMapping)c.addVertexMapping(i[n],void 0,void 0,this._$);break;case 86:i[n-1].text=i[n],this.$=i[n-1];break;case 87:case 88:i[n-2].text=i[n-1],this.$=i[n-2];break;case 89:this.$=i[n];break;case 90:var Y=c.destructLink(i[n],i[n-2]);this.$={type:Y.type,stroke:Y.stroke,length:Y.length,edgeSemantic:Y.edgeSemantic,text:i[n-1]};break;case 91:var Y=c.destructLink(i[n],i[n-2]);this.$={type:Y.type,stroke:Y.stroke,length:Y.length,edgeSemantic:Y.edgeSemantic,text:i[n-1],id:i[n-3]};break;case 92:this.$={text:i[n],type:"text"};break;case 93:this.$={text:i[n-1].text+""+i[n],type:i[n-1].type};break;case 94:this.$={text:i[n],type:"string"};break;case 95:this.$={text:i[n],type:"markdown"};break;case 96:var Y=c.destructLink(i[n]);this.$={type:Y.type,stroke:Y.stroke,length:Y.length,edgeSemantic:Y.edgeSemantic};break;case 97:var Y=c.destructLink(i[n]);this.$={type:Y.type,stroke:Y.stroke,length:Y.length,edgeSemantic:Y.edgeSemantic,id:i[n-1]};break;case 98:this.$=i[n-1];break;case 99:this.$={text:i[n],type:"text"};break;case 100:this.$={text:i[n-1].text+""+i[n],type:i[n-1].type};break;case 101:this.$={text:i[n],type:"string"};break;case 102:case 119:this.$={text:i[n],type:"markdown"};break;case 116:this.$={text:i[n],type:"text"};break;case 117:this.$={text:i[n-1].text+""+i[n],type:i[n-1].type};break;case 118:this.$={text:i[n],type:"text"};break;case 120:this.$=i[n-4],c.addClass(i[n-2],i[n]);break;case 121:this.$=i[n-4],c.setClass(i[n-2],i[n]);break;case 122:case 130:this.$=i[n-1],c.setClickEvent(i[n-1],i[n]);break;case 123:case 131:this.$=i[n-3],c.setClickEvent(i[n-3],i[n-2]),c.setTooltip(i[n-3],i[n]);break;case 124:this.$=i[n-2],c.setClickEvent(i[n-2],i[n-1],i[n]);break;case 125:this.$=i[n-4],c.setClickEvent(i[n-4],i[n-3],i[n-2]),c.setTooltip(i[n-4],i[n]);break;case 126:this.$=i[n-2],c.setLink(i[n-2],i[n]);break;case 127:this.$=i[n-4],c.setLink(i[n-4],i[n-2]),c.setTooltip(i[n-4],i[n]);break;case 128:this.$=i[n-4],c.setLink(i[n-4],i[n-2],i[n]);break;case 129:this.$=i[n-6],c.setLink(i[n-6],i[n-4],i[n]),c.setTooltip(i[n-6],i[n-2]);break;case 132:this.$=i[n-1],c.setLink(i[n-1],i[n]);break;case 133:this.$=i[n-3],c.setLink(i[n-3],i[n-2]),c.setTooltip(i[n-3],i[n]);break;case 134:this.$=i[n-3],c.setLink(i[n-3],i[n-2],i[n]);break;case 135:this.$=i[n-5],c.setLink(i[n-5],i[n-4],i[n]),c.setTooltip(i[n-5],i[n-2]);break;case 136:this.$=i[n-4],c.addVertex(i[n-2],void 0,void 0,i[n]);break;case 137:this.$=i[n-4],c.updateLink([i[n-2]],i[n]);break;case 138:this.$=i[n-4],c.updateLink(i[n-2],i[n]);break;case 139:this.$=i[n-8],c.updateLinkInterpolate([i[n-6]],i[n-2]),c.updateLink([i[n-6]],i[n]);break;case 140:this.$=i[n-8],c.updateLinkInterpolate(i[n-6],i[n-2]),c.updateLink(i[n-6],i[n]);break;case 141:this.$=i[n-6],c.updateLinkInterpolate([i[n-4]],i[n]);break;case 142:this.$=i[n-6],c.updateLinkInterpolate(i[n-4],i[n]);break;case 143:case 145:this.$=[i[n]];break;case 144:case 146:i[n-2].push(i[n]),this.$=i[n-2];break;case 148:this.$=i[n-1]+i[n];break;case 196:this.$=i[n];break;case 197:this.$=i[n-1]+""+i[n];break;case 199:this.$=i[n-1]+""+i[n];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"};break}},"anonymous"),table:[{3:1,4:2,8:a,10:o,11:u,13:d},{1:[3]},t(h,l,{5:7}),{4:8,8:a,10:o,11:u,13:d},{4:9,8:a,10:o,11:u,13:d},{4:10,8:a,10:o,11:u,13:d},{14:[1,11],15:[1,12]},{1:[2,1],6:13,7:14,8:f,9:m,10:k,11:x,12:_,21:20,23:21,24:22,25:23,26:24,27:25,28:P,35:B,36:W,37:29,38:w,40:D,42:g,45:33,46:44,47:b,48:45,50:46,63:M,87:q,88:Ce,89:Ie,90:ve,91:Be,92:Q,105:J,108:Z,109:ee,112:te,114:re,116:47,117:ne,118:oe,119:ue,124:qe,125:Xe,126:Qe,127:Je,128:Ze},t(h,[2,10]),t(h,[2,11]),t(h,[2,12]),t(h,[2,13]),{8:[1,63],9:[1,60],10:[1,61],11:We,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:ke,9:me,10:Ae,12:Ee,22:65,44:66,75:71,78:[1,72],80:[1,74],81:[1,73]},{8:ke,9:me,10:Ae,12:Ee,22:75},{8:ke,9:me,10:Ae,12:Ee,22:76},{8:ke,9:me,10:Ae,12:Ee,22:77},{8:ke,9:me,10:Ae,12:Ee,22:78},{8:ke,9:me,10:Ae,12:Ee,22:79},{8:ke,9:me,10:Ae,11:[1,80],12:Ee,22:81},{8:ke,9:me,10:Ae,12:Ee,22:82},{11:[1,83]},t(R,[2,48]),{39:[1,84]},{41:[1,85]},t(R,[2,51]),t(rt,[2,63],{19:86,34:87,11:We,43:nt}),{11:[1,89]},{11:[1,90]},{11:[1,91]},{11:[1,92]},{15:at,47:ot,63:ut,83:[1,96],92:lt,98:[1,93],100:[1,94],104:95,108:ct,109:dt,112:ht,114:pt,117:ft,118:gt,119:bt,123:97},t(R,[2,200]),t(R,[2,201]),t(R,[2,202]),t(R,[2,203]),t(R,[2,204]),t($e,[2,64]),t($e,[2,67],{49:[1,109]}),t(pe,[2,85],{116:122,30:[1,110],47:b,51:[1,111],53:[1,112],55:[1,113],57:[1,114],59:[1,115],61:[1,116],63:M,66:[1,117],68:[1,118],70:[1,119],71:[1,120],73:[1,121],92:Q,105:J,108:Z,109:ee,112:te,114:re,117:ne,118:oe,119:ue}),t(xe,[2,196]),t(xe,[2,157]),t(xe,[2,158]),t(xe,[2,159]),t(xe,[2,160]),t(xe,[2,161]),t(xe,[2,162]),t(xe,[2,163]),t(xe,[2,164]),t(xe,[2,165]),t(xe,[2,166]),t(xe,[2,167]),t(h,[2,14]),t(h,[2,20]),t(h,[2,21]),{10:[1,123]},t(h,[2,23]),t(h1,[2,31],{19:124,11:We}),t(R,[2,32]),{45:125,46:44,47:b,48:45,50:46,63:M,92:Q,105:J,108:Z,109:ee,112:te,114:re,116:47,117:ne,118:oe,119:ue},t(R,[2,52]),t(R,[2,53]),t(R,[2,54]),t(R,[2,55]),t(kt,[2,89],{76:126,65:[1,128],77:[1,127]}),{79:129,82:130,83:p1,84:f1,119:_t,122:vt},{78:[1,135],80:[1,136]},t(g1,[2,96]),t(R,[2,33]),t(R,[2,34]),t(R,[2,35]),t(R,[2,36]),t(R,[2,37]),{11:Ft,13:Vt,15:It,28:Lt,29:137,33:Bt,35:Mt,36:yt,47:wt,63:Nt,78:Rt,83:b1,84:k1,86:150,87:Gt,88:Ut,89:jt,90:zt,91:Wt,92:Kt,93:Ht,94:138,108:Yt,112:qt,114:Xt,117:Qt,118:Jt,119:Zt},t(mt,l,{5:165}),t(mt,l,{5:166}),{11:Ft,13:Vt,15:It,28:Lt,29:167,33:Bt,35:Mt,36:yt,47:wt,63:Nt,78:Rt,83:b1,84:k1,86:150,87:Gt,88:Ut,89:jt,90:zt,91:Wt,92:Kt,93:Ht,94:138,108:Yt,112:qt,114:Xt,117:Qt,118:Jt,119:Zt},t(R,[2,49]),t(R,[2,50]),t(rt,[2,61],{47:m1}),t(rt,[2,62],{19:169,11:We,43:At}),t($e,[2,57]),{47:b,50:171,63:M,92:Q,105:J,108:Z,109:ee,112:te,114:re,116:47,117:ne,118:oe,119:ue},{105:[1,172],106:173,108:[1,174]},{47:b,50:175,63:M,92:Q,105:J,108:Z,109:ee,112:te,114:re,116:47,117:ne,118:oe,119:ue},{47:b,50:176,63:M,92:Q,105:J,108:Z,109:ee,112:te,114:re,116:47,117:ne,118:oe,119:ue},t(X,[2,122],{11:[1,177],99:[1,178]}),{83:[1,179]},t(X,[2,130],{123:181,11:[1,180],15:at,47:ot,63:ut,92:lt,108:ct,109:dt,112:ht,114:pt,117:ft,118:gt,119:bt}),t(X,[2,132],{11:[1,182]}),t(Te,[2,198]),t(Te,[2,185]),t(Te,[2,186]),t(Te,[2,187]),t(Te,[2,188]),t(Te,[2,189]),t(Te,[2,190]),t(Te,[2,191]),t(Te,[2,192]),t(Te,[2,193]),t(Te,[2,194]),t(Te,[2,195]),{47:b,50:183,63:M,92:Q,105:J,108:Z,109:ee,112:te,114:re,116:47,117:ne,118:oe,119:ue},{31:184,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{31:192,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{31:194,53:[1,193],70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{31:195,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{31:196,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{31:197,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{112:[1,198]},{31:199,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{31:200,68:[1,201],70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{31:202,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{31:203,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{31:204,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},t(xe,[2,197]),t(h,[2,22]),t(h1,[2,30]),t(rt,[2,59],{34:205,19:206,11:We,43:nt}),t(kt,[2,86],{11:[1,207]}),{11:[1,208]},{31:209,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{80:[1,210],82:211,119:_t,122:vt},t(Et,[2,92]),t(Et,[2,94]),t(Et,[2,95]),t(Et,[2,183]),t(Et,[2,184]),{79:212,82:130,83:p1,84:f1,119:_t,122:vt},t(g1,[2,97]),{8:ke,9:me,10:Ae,11:Ft,12:Ee,13:Vt,15:It,22:214,28:Lt,30:[1,213],33:Bt,34:215,35:Mt,36:yt,43:nt,47:wt,63:Nt,78:Rt,86:150,87:Gt,88:Ut,89:jt,90:zt,91:Wt,92:Kt,93:Ht,94:216,108:Yt,112:qt,114:Xt,117:Qt,118:Jt,119:Zt},t(K,[2,116]),t(K,[2,118]),t(K,[2,119]),t(K,[2,172]),t(K,[2,173]),t(K,[2,174]),t(K,[2,175]),t(K,[2,176]),t(K,[2,177]),t(K,[2,178]),t(K,[2,179]),t(K,[2,180]),t(K,[2,181]),t(K,[2,182]),t(K,[2,103]),t(K,[2,104]),t(K,[2,105]),t(K,[2,106]),t(K,[2,107]),t(K,[2,108]),t(K,[2,109]),t(K,[2,110]),t(K,[2,111]),t(K,[2,112]),t(K,[2,113]),t(K,[2,114]),t(K,[2,115]),{6:13,7:14,8:f,9:m,10:k,11:x,12:_,21:20,23:21,24:22,25:23,26:24,27:25,28:P,33:[1,217],35:B,36:W,37:29,38:w,40:D,42:g,45:33,46:44,47:b,48:45,50:46,63:M,87:q,88:Ce,89:Ie,90:ve,91:Be,92:Q,105:J,108:Z,109:ee,112:te,114:re,116:47,117:ne,118:oe,119:ue,124:qe,125:Xe,126:Qe,127:Je,128:Ze},{6:13,7:14,8:f,9:m,10:k,11:x,12:_,21:20,23:21,24:22,25:23,26:24,27:25,28:P,33:[1,218],35:B,36:W,37:29,38:w,40:D,42:g,45:33,46:44,47:b,48:45,50:46,63:M,87:q,88:Ce,89:Ie,90:ve,91:Be,92:Q,105:J,108:Z,109:ee,112:te,114:re,116:47,117:ne,118:oe,119:ue,124:qe,125:Xe,126:Qe,127:Je,128:Ze},{8:ke,9:me,10:Ae,11:Ft,12:Ee,13:Vt,15:It,22:220,28:Lt,30:[1,219],33:Bt,34:221,35:Mt,36:yt,43:nt,47:wt,63:Nt,78:Rt,86:150,87:Gt,88:Ut,89:jt,90:zt,91:Wt,92:Kt,93:Ht,94:216,108:Yt,112:qt,114:Xt,117:Qt,118:Jt,119:Zt},{11:We,19:222},{47:[1,223]},t($e,[2,56]),{11:[1,224],47:b,63:M,92:Q,105:J,108:Z,109:ee,112:te,114:re,116:122,117:ne,118:oe,119:ue},{11:[1,225]},{11:[1,226],109:[1,227]},t(A1,[2,143]),{11:[1,228],47:b,63:M,92:Q,105:J,108:Z,109:ee,112:te,114:re,116:122,117:ne,118:oe,119:ue},{11:[1,229],47:b,63:M,92:Q,105:J,108:Z,109:ee,112:te,114:re,116:122,117:ne,118:oe,119:ue},{83:[1,230]},t(X,[2,124],{11:[1,231]}),t(X,[2,126],{11:[1,232]}),{83:[1,233]},t(Te,[2,199]),{83:[1,234],101:[1,235]},t($e,[2,68],{116:122,47:b,63:M,92:Q,105:J,108:Z,109:ee,112:te,114:re,117:ne,118:oe,119:ue}),{32:[1,236],70:G,85:237,119:U,120:j,121:z},t(Ke,[2,99]),t(Ke,[2,101]),t(Ke,[2,102]),t(Ke,[2,168]),t(Ke,[2,169]),t(Ke,[2,170]),t(Ke,[2,171]),{52:[1,238],70:G,85:237,119:U,120:j,121:z},{31:239,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{54:[1,240],70:G,85:237,119:U,120:j,121:z},{56:[1,241],70:G,85:237,119:U,120:j,121:z},{58:[1,242],70:G,85:237,119:U,120:j,121:z},{60:[1,243],70:G,85:237,119:U,120:j,121:z},{63:[1,244]},{67:[1,245],70:G,85:237,119:U,120:j,121:z},{69:[1,246],70:G,85:237,119:U,120:j,121:z},{31:247,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{32:[1,248],70:G,85:237,119:U,120:j,121:z},{70:G,72:[1,249],74:[1,250],85:237,119:U,120:j,121:z},{70:G,72:[1,252],74:[1,251],85:237,119:U,120:j,121:z},t(rt,[2,58],{19:169,11:We,43:At}),t(rt,[2,60],{47:m1}),t(kt,[2,88]),t(kt,[2,87]),{65:[1,253],70:G,85:237,119:U,120:j,121:z},t(kt,[2,90]),t(Et,[2,93]),{80:[1,254],82:211,119:_t,122:vt},{31:255,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},t(mt,l,{5:256}),{8:ke,9:me,10:Ae,12:Ee,22:257,43:At},t(K,[2,117]),t(R,[2,42]),t(R,[2,43]),{31:258,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},t(R,[2,46]),{8:ke,9:me,10:Ae,12:Ee,22:259,43:At},{46:260,47:b,48:45,50:46,63:M,92:Q,105:J,108:Z,109:ee,112:te,114:re,116:47,117:ne,118:oe,119:ue},{11:We,19:261},{11:Me,63:we,87:Ne,95:262,108:Re,110:263,111:264,112:Oe,113:Pe,114:Ge,115:Ue},{11:Me,63:we,87:Ne,95:273,107:[1,274],108:Re,110:263,111:264,112:Oe,113:Pe,114:Ge,115:Ue},{11:Me,63:we,87:Ne,95:275,107:[1,276],108:Re,110:263,111:264,112:Oe,113:Pe,114:Ge,115:Ue},{108:[1,277]},{11:Me,63:we,87:Ne,95:278,108:Re,110:263,111:264,112:Oe,113:Pe,114:Ge,115:Ue},{47:b,50:279,63:M,92:Q,105:J,108:Z,109:ee,112:te,114:re,116:47,117:ne,118:oe,119:ue},t(X,[2,123]),{83:[1,280]},{83:[1,281],101:[1,282]},t(X,[2,131]),t(X,[2,133],{11:[1,283]}),t(X,[2,134]),t(pe,[2,69]),t(Ke,[2,100]),t(pe,[2,70]),{54:[1,284],70:G,85:237,119:U,120:j,121:z},t(pe,[2,77]),t(pe,[2,72]),t(pe,[2,73]),t(pe,[2,74]),{112:[1,285]},t(pe,[2,76]),t(pe,[2,78]),{69:[1,286],70:G,85:237,119:U,120:j,121:z},t(pe,[2,80]),t(pe,[2,81]),t(pe,[2,83]),t(pe,[2,82]),t(pe,[2,84]),t([11,47,63,92,105,108,109,112,114,117,118,119],[2,98]),t(kt,[2,91]),{32:[1,287],70:G,85:237,119:U,120:j,121:z},{6:13,7:14,8:f,9:m,10:k,11:x,12:_,21:20,23:21,24:22,25:23,26:24,27:25,28:P,33:[1,288],35:B,36:W,37:29,38:w,40:D,42:g,45:33,46:44,47:b,48:45,50:46,63:M,87:q,88:Ce,89:Ie,90:ve,91:Be,92:Q,105:J,108:Z,109:ee,112:te,114:re,116:47,117:ne,118:oe,119:ue,124:qe,125:Xe,126:Qe,127:Je,128:Ze},t(mt,l,{5:289}),{32:[1,290],70:G,85:237,119:U,120:j,121:z},t(R,[2,47]),t($e,[2,66]),{46:291,47:b,48:45,50:46,63:M,92:Q,105:J,108:Z,109:ee,112:te,114:re,116:47,117:ne,118:oe,119:ue},t(X,[2,136],{109:Ct}),t(E1,[2,145],{111:293,11:Me,63:we,87:Ne,108:Re,112:Oe,113:Pe,114:Ge,115:Ue}),t(Ve,[2,147]),t(Ve,[2,149]),t(Ve,[2,150]),t(Ve,[2,151]),t(Ve,[2,152]),t(Ve,[2,153]),t(Ve,[2,154]),t(Ve,[2,155]),t(Ve,[2,156]),t(X,[2,137],{109:Ct}),{11:[1,294]},t(X,[2,138],{109:Ct}),{11:[1,295]},t(A1,[2,144]),t(X,[2,120],{109:Ct}),t(X,[2,121],{116:122,47:b,63:M,92:Q,105:J,108:Z,109:ee,112:te,114:re,117:ne,118:oe,119:ue}),t(X,[2,125]),t(X,[2,127],{11:[1,296]}),t(X,[2,128]),{101:[1,297]},{54:[1,298]},{65:[1,299]},{69:[1,300]},{8:ke,9:me,10:Ae,12:Ee,22:301,34:302,43:nt},t(R,[2,40]),{6:13,7:14,8:f,9:m,10:k,11:x,12:_,21:20,23:21,24:22,25:23,26:24,27:25,28:P,33:[1,303],35:B,36:W,37:29,38:w,40:D,42:g,45:33,46:44,47:b,48:45,50:46,63:M,87:q,88:Ce,89:Ie,90:ve,91:Be,92:Q,105:J,108:Z,109:ee,112:te,114:re,116:47,117:ne,118:oe,119:ue,124:qe,125:Xe,126:Qe,127:Je,128:Ze},{8:ke,9:me,10:Ae,12:Ee,22:304,34:305,43:nt},t($e,[2,65]),{11:Me,63:we,87:Ne,108:Re,110:306,111:264,112:Oe,113:Pe,114:Ge,115:Ue},t(Ve,[2,148]),{15:at,47:ot,63:ut,92:lt,104:307,108:ct,109:dt,112:ht,114:pt,117:ft,118:gt,119:bt,123:97},{15:at,47:ot,63:ut,92:lt,104:308,108:ct,109:dt,112:ht,114:pt,117:ft,118:gt,119:bt,123:97},{101:[1,309]},t(X,[2,135]),t(pe,[2,71]),{31:310,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},t(pe,[2,79]),t(mt,l,{5:311}),{8:ke,9:me,10:Ae,12:Ee,22:312,43:At},t(R,[2,41]),t(R,[2,44]),{8:ke,9:me,10:Ae,12:Ee,22:313,43:At},t(E1,[2,146],{111:293,11:Me,63:we,87:Ne,108:Re,112:Oe,113:Pe,114:Ge,115:Ue}),t(X,[2,141],{123:181,11:[1,314],15:at,47:ot,63:ut,92:lt,108:ct,109:dt,112:ht,114:pt,117:ft,118:gt,119:bt}),t(X,[2,142],{123:181,11:[1,315],15:at,47:ot,63:ut,92:lt,108:ct,109:dt,112:ht,114:pt,117:ft,118:gt,119:bt}),t(X,[2,129]),{32:[1,316],70:G,85:237,119:U,120:j,121:z},{6:13,7:14,8:f,9:m,10:k,11:x,12:_,21:20,23:21,24:22,25:23,26:24,27:25,28:P,33:[1,317],35:B,36:W,37:29,38:w,40:D,42:g,45:33,46:44,47:b,48:45,50:46,63:M,87:q,88:Ce,89:Ie,90:ve,91:Be,92:Q,105:J,108:Z,109:ee,112:te,114:re,116:47,117:ne,118:oe,119:ue,124:qe,125:Xe,126:Qe,127:Je,128:Ze},t(mt,l,{5:318}),t(R,[2,45]),{11:Me,63:we,87:Ne,95:319,108:Re,110:263,111:264,112:Oe,113:Pe,114:Ge,115:Ue},{11:Me,63:we,87:Ne,95:320,108:Re,110:263,111:264,112:Oe,113:Pe,114:Ge,115:Ue},t(pe,[2,75]),t(R,[2,38]),{6:13,7:14,8:f,9:m,10:k,11:x,12:_,21:20,23:21,24:22,25:23,26:24,27:25,28:P,33:[1,321],35:B,36:W,37:29,38:w,40:D,42:g,45:33,46:44,47:b,48:45,50:46,63:M,87:q,88:Ce,89:Ie,90:ve,91:Be,92:Q,105:J,108:Z,109:ee,112:te,114:re,116:47,117:ne,118:oe,119:ue,124:qe,125:Xe,126:Qe,127:Je,128:Ze},t(X,[2,139],{109:Ct}),t(X,[2,140],{109:Ct}),t(R,[2,39])],defaultActions:{},parseError:e(function(v,F){if(F.recoverable)this.trace(v);else{var V=Error(v);throw V.hash=F,V}},"parseError"),parse:e(function(v){var F=this,V=[0],c=[],H=[null],i=[],O=this.table,n="",Y=0,C1=0,S1=0,R1=2,x1=1,O1=i.slice.call(arguments,1),de=Object.create(this.lexer),st={yy:{}};for(var n1 in this.yy)if(Object.prototype.hasOwnProperty.call(this.yy,n1))st.yy[n1]=this.yy[n1];if(de.setInput(v,st.yy),st.yy.lexer=de,st.yy.parser=this,typeof de.yylloc>"u")de.yylloc={};var a1=de.yylloc;i.push(a1);var P1=de.options&&de.options.ranges;if(typeof st.yy.parseError==="function")this.parseError=st.yy.parseError;else this.parseError=Object.getPrototypeOf(this).parseError;function G1(_e){V.length=V.length-2*_e,H.length=H.length-_e,i.length=i.length-_e}e(G1,"popStack");function T1(){var _e=c.pop()||de.lex()||x1;if(typeof _e!=="number"){if(_e instanceof Array)c=_e,_e=c.pop();_e=F.symbols_[_e]||_e}return _e}e(T1,"lex");var Se,o1,it,De,is,u1,St={},e1,ze,D1,t1;while(!0){if(it=V[V.length-1],this.defaultActions[it])De=this.defaultActions[it];else{if(Se===null||typeof Se>"u")Se=T1();De=O[it]&&O[it][Se]}if(typeof De>"u"||!De.length||!De[0]){var l1="";t1=[];for(e1 in O[it])if(this.terminals_[e1]&&e1>R1)t1.push("'"+this.terminals_[e1]+"'");if(de.showPosition)l1="Parse error on line "+(Y+1)+`:
23
23
  `+de.showPosition()+`
24
- Expecting `+t1.join(", ")+", got '"+(this.terminals_[xe]||xe)+"'";else l1="Parse error on line "+(Y+1)+": Unexpected "+(xe==x1?"end of input":"'"+(this.terminals_[xe]||xe)+"'");this.parseError(l1,{text:de.match,token:this.terminals_[xe]||xe,line:de.yylineno,loc:a1,expected:t1})}if(_e[0]instanceof Array&&_e.length>1)throw Error("Parse Error: multiple actions possible at state: "+it+", token: "+xe);switch(_e[0]){case 1:if(V.push(xe),H.push(de.yytext),i.push(de.yylloc),V.push(_e[1]),xe=null,!o1){if(C1=de.yyleng,n=de.yytext,Y=de.yylineno,a1=de.yylloc,S1>0)S1--}else xe=o1,o1=null;break;case 2:if(ze=this.productions_[_e[1]][1],St.$=H[H.length-ze],St._$={first_line:i[i.length-(ze||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(ze||1)].first_column,last_column:i[i.length-1].last_column},P1)St._$.range=[i[i.length-(ze||1)].range[0],i[i.length-1].range[1]];if(u1=this.performAction.apply(St,[n,C1,Y,st.yy,_e[1],H,i].concat(O1)),typeof u1<"u")return u1;if(ze)V=V.slice(0,-1*ze*2),H=H.slice(0,-1*ze),i=i.slice(0,-1*ze);V.push(this.productions_[_e[1]][0]),H.push(St.$),i.push(St._$),D1=O[V[V.length-2]][V[V.length-1]],V.push(D1);break;case 3:return!0}}return!0},"parse")},N1=function(){var He={EOF:1,parseError:e(function(F,V){if(this.yy.parser)this.yy.parser.parseError(F,V);else throw Error(F)},"parseError"),setInput:e(function(v,F){if(this.yy=F||this.yy||{},this._input=v,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];return this.offset=0,this},"setInput"),input:e(function(){var v=this._input[0];this.yytext+=v,this.yyleng++,this.offset++,this.match+=v,this.matched+=v;var F=v.match(/(?:\r\n?|\n).*/g);if(F)this.yylineno++,this.yylloc.last_line++;else this.yylloc.last_column++;if(this.options.ranges)this.yylloc.range[1]++;return this._input=this._input.slice(1),v},"input"),unput:e(function(v){var F=v.length,V=v.split(/(?:\r\n?|\n)/g);this._input=v+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-F),this.offset-=F;var c=this.match.split(/(?:\r\n?|\n)/g);if(this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),V.length-1)this.yylineno-=V.length-1;var H=this.yylloc.range;if(this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:V?(V.length===c.length?this.yylloc.first_column:0)+c[c.length-V.length].length-V[0].length:this.yylloc.first_column-F},this.options.ranges)this.yylloc.range=[H[0],H[0]+this.yyleng-F];return 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).
24
+ Expecting `+t1.join(", ")+", got '"+(this.terminals_[Se]||Se)+"'";else l1="Parse error on line "+(Y+1)+": Unexpected "+(Se==x1?"end of input":"'"+(this.terminals_[Se]||Se)+"'");this.parseError(l1,{text:de.match,token:this.terminals_[Se]||Se,line:de.yylineno,loc:a1,expected:t1})}if(De[0]instanceof Array&&De.length>1)throw Error("Parse Error: multiple actions possible at state: "+it+", token: "+Se);switch(De[0]){case 1:if(V.push(Se),H.push(de.yytext),i.push(de.yylloc),V.push(De[1]),Se=null,!o1){if(C1=de.yyleng,n=de.yytext,Y=de.yylineno,a1=de.yylloc,S1>0)S1--}else Se=o1,o1=null;break;case 2:if(ze=this.productions_[De[1]][1],St.$=H[H.length-ze],St._$={first_line:i[i.length-(ze||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(ze||1)].first_column,last_column:i[i.length-1].last_column},P1)St._$.range=[i[i.length-(ze||1)].range[0],i[i.length-1].range[1]];if(u1=this.performAction.apply(St,[n,C1,Y,st.yy,De[1],H,i].concat(O1)),typeof u1<"u")return u1;if(ze)V=V.slice(0,-1*ze*2),H=H.slice(0,-1*ze),i=i.slice(0,-1*ze);V.push(this.productions_[De[1]][0]),H.push(St.$),i.push(St._$),D1=O[V[V.length-2]][V[V.length-1]],V.push(D1);break;case 3:return!0}}return!0},"parse")},N1=function(){var He={EOF:1,parseError:e(function(F,V){if(this.yy.parser)this.yy.parser.parseError(F,V);else throw Error(F)},"parseError"),setInput:e(function(v,F){if(this.yy=F||this.yy||{},this._input=v,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];return this.offset=0,this},"setInput"),input:e(function(){var v=this._input[0];this.yytext+=v,this.yyleng++,this.offset++,this.match+=v,this.matched+=v;var F=v.match(/(?:\r\n?|\n).*/g);if(F)this.yylineno++,this.yylloc.last_line++;else this.yylloc.last_column++;if(this.options.ranges)this.yylloc.range[1]++;return this._input=this._input.slice(1),v},"input"),unput:e(function(v){var F=v.length,V=v.split(/(?:\r\n?|\n)/g);this._input=v+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-F),this.offset-=F;var c=this.match.split(/(?:\r\n?|\n)/g);if(this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),V.length-1)this.yylineno-=V.length-1;var H=this.yylloc.range;if(this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:V?(V.length===c.length?this.yylloc.first_column:0)+c[c.length-V.length].length-V[0].length:this.yylloc.first_column-F},this.options.ranges)this.yylloc.range=[H[0],H[0]+this.yyleng-F];return 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
25
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:e(function(v){this.unput(this.match.slice(v))},"less"),pastInput:e(function(){var v=this.matched.substr(0,this.matched.length-this.match.length);return(v.length>20?"...":"")+v.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:e(function(){var v=this.match;if(v.length<20)v+=this._input.substr(0,20-v.length);return(v.substr(0,20)+(v.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:e(function(){var v=this.pastInput(),F=Array(v.length+1).join("-");return v+this.upcomingInput()+`
26
26
  `+F+"^"},"showPosition"),test_match:e(function(v,F){var V,c,H;if(this.options.backtrack_lexer){if(H={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)H.yylloc.range=this.yylloc.range.slice(0)}if(c=v[0].match(/(?:\r\n?|\n).*/g),c)this.yylineno+=c.length;if(this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:c?c[c.length-1].length-c[c.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+v[0].length},this.yytext+=v[0],this.match+=v[0],this.matches=v,this.yyleng=this.yytext.length,this.options.ranges)this.yylloc.range=[this.offset,this.offset+=this.yyleng];if(this._more=!1,this._backtrack=!1,this._input=this._input.slice(v[0].length),this.matched+=v[0],V=this.performAction.call(this,this.yy,this,F,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input)this.done=!1;if(V)return V;else if(this._backtrack){for(var i in H)this[i]=H[i];return!1}return!1},"test_match"),next:e(function(){if(this.done)return this.EOF;if(!this._input)this.done=!0;var v,F,V,c;if(!this._more)this.yytext="",this.match="";var H=this._currentRules();for(var i=0;i<H.length;i++)if(V=this._input.match(this.rules[H[i]]),V&&(!F||V[0].length>F[0].length)){if(F=V,c=i,this.options.backtrack_lexer)if(v=this.test_match(V,H[i]),v!==!1)return v;else if(this._backtrack){F=!1;continue}else return!1;else if(!this.options.flex)break}if(F){if(v=this.test_match(F,H[c]),v!==!1)return v;return!1}if(this._input==="")return this.EOF;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
27
27
  `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:e(function(){var F=this.next();if(F)return F;else return this.lex()},"lex"),begin:e(function(F){this.conditionStack.push(F)},"begin"),popState:e(function(){var F=this.conditionStack.length-1;if(F>0)return this.conditionStack.pop();else return this.conditionStack[0]},"popState"),_currentRules:e(function(){if(this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1])return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;else return this.conditions.INITIAL.rules},"_currentRules"),topState:e(function(F){if(F=this.conditionStack.length-1-Math.abs(F||0),F>=0)return this.conditionStack[F];else return"INITIAL"},"topState"),pushState:e(function(F){this.begin(F)},"pushState"),stateStackSize:e(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:e(function(F,V,c,H){var i=H;switch(c){case 0:return this.begin("acc_title"),38;break;case 1:return this.popState(),"acc_title_value";break;case 2:return this.begin("acc_descr"),40;break;case 3:return this.popState(),"acc_descr_value";break;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"),V.yytext="",43;break;case 8:return this.pushState("shapeDataStr"),43;break;case 9:return this.popState(),43;break;case 10:let O=/\n\s*/g;return V.yytext=V.yytext.replace(O,"<br/>"),43;break;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:if(F.lex.firstGraph())this.begin("dir");return 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;break;case 45:return this.popState(),15;break;case 46:return this.popState(),15;break;case 47:return this.popState(),15;break;case 48:return this.popState(),15;break;case 49:return this.popState(),15;break;case 50:return this.popState(),15;break;case 51:return this.popState(),15;break;case 52:return this.popState(),15;break;case 53:return this.popState(),15;break;case 54:return this.popState(),15;break;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;break;case 70:return this.pushState("edgeText"),78;break;case 71:return 122;case 72:return 80;case 73:break;case 74:return this.popState(),56;break;case 75:return"TEXT";case 76:return this.pushState("ellipseText"),55;break;case 77:return this.popState(),58;break;case 78:return this.pushState("text"),57;break;case 79:return this.popState(),60;break;case 80:return this.pushState("text"),59;break;case 81:return 61;case 82:return this.pushState("text"),70;break;case 83:return this.popState(),67;break;case 84:return this.pushState("text"),66;break;case 85:return this.popState(),52;break;case 86:return this.pushState("text"),51;break;case 87:break;case 88:return this.popState(),72;break;case 89:return this.popState(),74;break;case 90:return 120;case 91:return this.pushState("trapText"),71;break;case 92:return this.pushState("trapText"),73;break;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;break;case 106:return this.pushState("text"),65;break;case 107:return this.popState(),54;break;case 108:return this.pushState("text"),53;break;case 109:return this.popState(),32;break;case 110:return this.pushState("text"),30;break;case 111:return this.popState(),69;break;case 112:return this.pushState("text"),68;break;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}}};return He}();r1.lexer=N1;function $t(){this.yy={}}return e($t,"Parser"),$t.prototype=r1,r1.Parser=$t,new $t}();d1.parser=d1;var y1=d1,w1=Object.assign({},y1);w1.parse=(t)=>{let a=t.replace(/}[^\S\n]*\n/g,`}
28
- `);return y1.parse(a)};var Z1=w1,$1=e((t)=>{let{theme:a,bkgColorArray:o,borderColorArray:u}=t;if(!ae(a,u))return"";let d=ie(t.look),h=le(o),l=Ye(t.THEME_COLOR_LIMIT,u),f=e((x)=>u[x%u.length],"border"),m=e((x)=>h?`fill: ${o[x%o.length]};`:"","fill"),k="";for(let x of K1){let _=i1.get(x),P=`[data-look="${d}"].node.${V1(x)}`;k+=`
28
+ `);return y1.parse(a)};var Z1=w1,$1=e((t)=>{let{theme:a,bkgColorArray:o,borderColorArray:u}=t;if(!ae(a,u))return"";let d=ie(t.look),h=ce(o),l=Ye(t.THEME_COLOR_LIMIT,u),f=e((x)=>u[x%u.length],"border"),m=e((x)=>h?`fill: ${o[x%o.length]};`:"","fill"),k="";for(let x of K1){let _=i1.get(x),P=`[data-look="${d}"].node.${V1(x)}`;k+=`
29
29
 
30
30
  ${P} rect,
31
31
  ${P} path,
@@ -40,7 +40,7 @@ Expecting `+t1.join(", ")+", got '"+(this.terminals_[xe]||xe)+"'";else l1="Parse
40
40
  stroke: ${f(_)};
41
41
  ${m(_)}
42
42
  }
43
- `}return k},"genColor"),es=e((t,a)=>{let o=Pt,u=o(t,"r"),d=o(t,"g"),h=o(t,"b");return se(u,d,h,a)},"fade"),ts=e((t)=>`${$1(t)}
43
+ `}return k},"genColor"),es=e((t,a)=>{let o=Ot,u=o(t,"r"),d=o(t,"g"),h=o(t,"b");return le(u,d,h,a)},"fade"),ts=e((t)=>`${$1(t)}
44
44
  .label {
45
45
  font-family: ${t.fontFamily};
46
46
  color: ${t.nodeTextColor||t.textColor};
@@ -1,2 +1,2 @@
1
- import{e}from"./chunk-y0m8hrwz.js";function W(c,i){if(c.accDescr)i.setAccDescription?.(c.accDescr);if(c.accTitle)i.setAccTitle?.(c.accTitle);if(c.title)i.setDiagramTitle?.(c.title)}e(W,"populateCommonDb");
1
+ import{e}from"./chunk-9dd1c37b.js";function W(c,i){if(c.accDescr)i.setAccDescription?.(c.accDescr);if(c.accTitle)i.setAccTitle?.(c.accTitle);if(c.title)i.setDiagramTitle?.(c.title)}e(W,"populateCommonDb");
2
2
  export{W};
@@ -1 +1 @@
1
- import{e,r}from"./chunk-y0m8hrwz.js";import{K,Lt,It}from"./chunk-fk0dh93x.js";import{W}from"./chunk-b1pe46zz.js";import{ar,_t}from"./chunk-taynqrgq.js";var i=ar().RailroadEbnf.parser.LangiumParser,o=e((t)=>{let n=t.alternatives.map(m);if(n.length===1)return n[0];return{type:"choice",alternatives:n}},"transformChoice"),m=e((t)=>{let n=t.elements.map(p);if(n.length===1)return n[0];return{type:"sequence",elements:n}},"transformSequence"),s=e((t)=>{switch(t.$type){case"EbnfTerminal":return{type:"terminal",value:t.value};case"EbnfNonTerminal":return{type:"nonterminal",name:t.name};case"EbnfSpecial":return{type:"special",text:t.text};case"EbnfGroup":return o(t.element);case"EbnfOptional":return{type:"optional",element:o(t.element)};case"EbnfRepetition":return{type:"repetition",element:o(t.element),min:0,max:1/0};default:throw Error(`Unsupported EBNF primary node: ${t.$type}`)}},"transformPrimary"),l=e((t,n)=>{switch(n.$type){case"EbnfOptionalPostfix":return{type:"optional",element:t};case"EbnfZeroOrMorePostfix":return{type:"repetition",element:t,min:0,max:1/0};case"EbnfOneOrMorePostfix":return{type:"repetition",element:t,min:1,max:1/0};case"EbnfExceptionPostfix":return{type:"sequence",elements:[t,{type:"terminal",value:"-"},s(n.except)]};default:throw Error(`Unsupported EBNF postfix node: ${n.$type}`)}},"transformPostfix"),p=e((t)=>t.postfixes.reduce((n,a)=>l(n,a),s(t.base)),"transformTerm"),f=e((t)=>({name:t.name,definition:o(t.definition)}),"transformRule"),u=e((t)=>{if(W(t,K),t.title)K.setTitle(t.title);t.rules.map((n)=>K.addRule(f(n)))},"populateDb"),c={parse:e((t)=>{K.clear(),r.debug("[EBNF Parser] Starting Langium parse");let n=i.parse(t);if(n.lexerErrors.length>0||n.parserErrors.length>0)throw new _t(n);let a=n.value;r.debug("[EBNF Parser] Parsed rules:",a.rules.length),u(a),r.debug("[EBNF Parser] Parse complete")},"parse"),parser:{yy:K}},x={parser:c,db:K,renderer:It,styles:Lt};export{x as diagram};
1
+ import{e,r}from"./chunk-9dd1c37b.js";import{K,It,Rt}from"./chunk-avwpjsxw.js";import{W}from"./chunk-vjqmnkh2.js";import{ar,_t}from"./chunk-qryrg2pq.js";var i=ar().RailroadEbnf.parser.LangiumParser,o=e((t)=>{let n=t.alternatives.map(m);if(n.length===1)return n[0];return{type:"choice",alternatives:n}},"transformChoice"),m=e((t)=>{let n=t.elements.map(p);if(n.length===1)return n[0];return{type:"sequence",elements:n}},"transformSequence"),s=e((t)=>{switch(t.$type){case"EbnfTerminal":return{type:"terminal",value:t.value};case"EbnfNonTerminal":return{type:"nonterminal",name:t.name};case"EbnfSpecial":return{type:"special",text:t.text};case"EbnfGroup":return o(t.element);case"EbnfOptional":return{type:"optional",element:o(t.element)};case"EbnfRepetition":return{type:"repetition",element:o(t.element),min:0,max:1/0};default:throw Error(`Unsupported EBNF primary node: ${t.$type}`)}},"transformPrimary"),l=e((t,n)=>{switch(n.$type){case"EbnfOptionalPostfix":return{type:"optional",element:t};case"EbnfZeroOrMorePostfix":return{type:"repetition",element:t,min:0,max:1/0};case"EbnfOneOrMorePostfix":return{type:"repetition",element:t,min:1,max:1/0};case"EbnfExceptionPostfix":return{type:"sequence",elements:[t,{type:"terminal",value:"-"},s(n.except)]};default:throw Error(`Unsupported EBNF postfix node: ${n.$type}`)}},"transformPostfix"),p=e((t)=>t.postfixes.reduce((n,a)=>l(n,a),s(t.base)),"transformTerm"),f=e((t)=>({name:t.name,definition:o(t.definition)}),"transformRule"),u=e((t)=>{if(W(t,K),t.title)K.setTitle(t.title);t.rules.map((n)=>K.addRule(f(n)))},"populateDb"),c={parse:e((t)=>{K.clear(),r.debug("[EBNF Parser] Starting Langium parse");let n=i.parse(t);if(n.lexerErrors.length>0||n.parserErrors.length>0)throw new _t(n);let a=n.value;r.debug("[EBNF Parser] Parsed rules:",a.rules.length),u(a),r.debug("[EBNF Parser] Parse complete")},"parse"),parser:{yy:K}},x={parser:c,db:K,renderer:Rt,styles:It};export{x as diagram};
@@ -1 +1 @@
1
- import{h,o,i,a,v,t,n,_,l,Z,gt,yt,un,ye,Re,te,ue,Ut,ot,re,tn,ve}from"./chunk-vt40e1kp.js";var Se=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],pe=l("key-round",Se);function fe(e){let d=[],g="",y,N=!1;for(let u=0;u<e.length;u++){let c=e[u];if(y)if(c===y)y=void 0;else if(c==="\\"&&y==='"'&&u+1<e.length)g+=e[++u];else g+=c;else if(c==='"'||c==="'")y=c,N=!0;else if(c==="\\"&&u+1<e.length)g+=e[++u],N=!0;else if(/\s/.test(c)){if(N||g)d.push(g);g="",N=!1}else g+=c,N=!0}if(N||g)d.push(g);return d}function ie(e){return e.map((d)=>d===""||/[\s"'\\]/.test(d)?`"${d.replace(/(["\\])/g,"\\$1")}"`:d).join(" ")}var ge="size-4 cursor-pointer rounded border-line text-accent accent-accent focus-visible:outline-2 focus-visible:outline-accent",je={connected:{label:"已连接",dot:"bg-success"},idle:{label:"待连接",dot:"bg-faint"},disabled:{label:"已停用",dot:"bg-faint"},failed:{label:"连接失败",dot:"bg-danger"},needs_auth:{label:"需要认证",dot:"bg-warning"}};function X(e){return e.type==="local"?ie(e.command):e.url}function xe({info:e,tools:d=!1}){let g=je[e.status.status];return n("span",{className:"inline-flex shrink-0 items-center gap-1.5 text-xs text-dim",children:[t("span",{"aria-hidden":!0,className:`size-1.5 shrink-0 rounded-full ${g.dot}`}),t("span",{className:d?void 0:"hidden @md/panel:inline",children:g.label}),d&&e.status.status==="connected"&&n("span",{className:"text-faint",children:["· ",e.toolCount," 个工具"]})]})}function Te(e){if(typeof e!=="object"||e===null||!("type"in e))return"any";let d=e.type;if(typeof d==="string")return d;if(Array.isArray(d))return d.filter((g)=>typeof g==="string").join(" | ")||"any";return"any"}function he(e){let{Button:d,CopyButton:g,Dialog:y,StatusChip:N,confirm:u,style:c,useTheme:k}=_();k();let{info:s,connection:I}=e,[m,q]=a(),[G,K]=a(),[S,j]=a(!1),W=s.status.status==="connected",z=s.status.status==="needs_auth",V=s.status.status==="failed",A=s.config.type==="remote"&&Boolean(s.config.oauth);o(()=>{function p(x){if(x&&x!==s.name)return;let J=s.projectID?`?projectID=${encodeURIComponent(s.projectID)}`:"";I.request(`/api/mcp/${encodeURIComponent(s.name)}/connect${J}`,{method:"POST"}).then((ee)=>e.onChanged(ee)).catch(()=>{})}function f(x){if(x.data?.type==="mcp-oauth-success")p(x.data.name)}function D(x){if(x.key==="basalt-mcp-oauth-event"&&x.newValue)try{let J=JSON.parse(x.newValue);p(J.name)}catch(J){}}window.addEventListener("message",f),window.addEventListener("storage",D);let R;if("BroadcastChannel"in window)R=new BroadcastChannel("basalt-mcp-oauth"),R.onmessage=(x)=>{if(x.data?.type==="mcp-oauth-success")p(x.data.name)};return()=>{window.removeEventListener("message",f),window.removeEventListener("storage",D),R?.close()}},[I,s.name,s.projectID,e]),o(()=>{if(s.status.status!=="connected")return;let p=s.projectID?`?projectID=${encodeURIComponent(s.projectID)}`:"";I.request(`/api/mcp/${encodeURIComponent(s.name)}/tools${p}`).then((f)=>{if(Array.isArray(f))q(f),K(void 0)}).catch((f)=>{K(f instanceof Error?f.message:"获取工具失败")})},[I,s.name,s.projectID,s.status.status]);async function O(p){j(!0);try{let f=s.projectID?`?projectID=${encodeURIComponent(s.projectID)}`:"",D=await I.request(`/api/mcp/${encodeURIComponent(s.name)}/${p}${f}`,{method:"POST"});e.onChanged(D)}catch{}finally{j(!1)}}async function U(){j(!0);try{let p=s.projectID?`?projectID=${encodeURIComponent(s.projectID)}`:"",f=s.status.status==="needs_auth"?s.status.authorizationUrl:void 0;if(!f)f=(await I.request(`/api/mcp/${encodeURIComponent(s.name)}/oauth/authorize${p}`,{method:"POST"})).authorizationUrl;if(f)window.open(f,"_blank","width=600,height=700")}catch(p){K(p instanceof Error?p.message:"获取授权链接失败")}finally{j(!1)}}async function Y(){j(!0);try{let p=s.projectID?`?projectID=${encodeURIComponent(s.projectID)}`:"",f=await I.request(`/api/mcp/${encodeURIComponent(s.name)}/oauth/clear${p}`,{method:"POST"});e.onChanged(f)}finally{j(!1)}}async function E(){if(!await u({title:`删除 ${s.name}?`,description:"删除后将断开连接并不再向会话提供其工具。",action:"删除",danger:!0}))return;j(!0);try{let f=s.projectID?`?projectID=${encodeURIComponent(s.projectID)}`:"";await I.request(`/api/mcp/${encodeURIComponent(s.name)}${f}`,{method:"DELETE"}),e.onChanged(),e.onClose()}finally{j(!1)}}let T=s.config,r=X(T),C="error"in s.status?s.status.error:void 0,M=m?.length??s.toolCount??0;return t(y,{open:!0,className:"bg-panel shadow-float",onOpenChange:(p)=>{if(!p&&!S)e.onClose()},title:n("div",{className:"flex flex-wrap items-center gap-3",children:[t("div",{className:"flex size-8 items-center justify-center rounded-[10px] border border-accent/20 bg-accent-soft text-accent",children:T.type==="local"?t(ot,{className:"size-4"}):t(ye,{className:"size-4"})}),t("span",{className:"font-serif text-lg font-semibold tracking-tight text-ink",children:s.name}),W?t(N,{tone:"success",pulse:!0,children:"已连接"}):z?t(N,{tone:"warning",pulse:!0,children:"需要授权"}):V?t(N,{tone:"danger",children:"连接失败"}):s.status.status==="disabled"?t(N,{tone:"neutral",children:"已停用"}):t(N,{tone:"neutral",children:"未连接"})]}),description:n("div",{className:"mt-2 flex min-w-0 flex-wrap items-center gap-1.5 text-xs",children:[n("span",{className:"flex min-w-0 max-w-full items-center gap-1 rounded-lg border border-line bg-raised/60 py-0.5 pr-1 pl-2.5 font-mono text-[11.5px] text-ink",children:[t("span",{className:"min-w-0 truncate",title:r,children:r}),t(g,{text:r,label:"复制地址",size:"icon-xs",className:"shrink-0 text-dim hover:text-ink"})]}),t("span",{className:"rounded-lg border border-line px-2 py-1 text-[11px] leading-none text-dim",children:T.type==="local"?"本地命令":"远程 HTTP"}),A&&n("span",{className:c("control.badgeAccent","gap-1 rounded-lg border border-accent/25 px-2 py-1"),children:[t(Ut,{className:"size-3"}),"OAuth 2.0"]})]}),size:"lg",footer:n("div",{className:"flex w-full items-center justify-between gap-2 max-sm:flex-col",children:[n("div",{className:"flex items-center gap-1 max-sm:w-full",children:[A&&t(d,{type:"button",variant:"ghost",onClick:Y,disabled:S,title:"清除已保存的 OAuth 凭据",children:"清除凭据"}),t(d,{type:"button",variant:"danger-ghost",size:"icon-sm","aria-label":"删除服务器",onClick:E,disabled:S,title:"删除服务器",children:t(re,{className:"size-4"})})]}),n("div",{className:"flex items-center gap-2 max-sm:w-full max-sm:justify-end",children:[t(d,{type:"button",variant:"ghost",onClick:e.onEdit,disabled:S,children:"编辑配置"}),!z&&t(d,{type:"button",variant:"secondary",onClick:()=>O(W?"disconnect":"connect"),disabled:S,children:S?"处理中...":W?"断开连接":"立即连接"}),t(d,{type:"button",variant:"primary",onClick:e.onClose,children:"完成"})]})]}),children:n("div",{className:"space-y-6 pt-1",children:[z&&t("div",{className:"relative overflow-hidden rounded-2xl border border-warning/30 bg-[radial-gradient(120%_140%_at_0%_0%,color-mix(in_oklch,var(--color-warning)_16%,transparent),transparent_65%)] p-5",children:n("div",{className:"flex items-start gap-4 max-sm:flex-col",children:[t("div",{className:"relative flex size-11 shrink-0 items-center justify-center rounded-xl border border-warning/30 bg-panel text-warning shadow-[0_0_28px_-4px_color-mix(in_oklch,var(--color-warning)_55%,transparent)]",children:t(pe,{className:"size-5"})}),n("div",{className:"min-w-0 flex-1 space-y-1.5",children:[t("h4",{className:"text-sm font-semibold text-ink",children:"授权后即可使用此服务器"}),t("p",{className:"text-[13px] leading-relaxed text-dim",children:"该端点要求 OAuth 2.0 身份许可。在浏览器中完成授权后,令牌会自动保存并载入全部工具。"}),C&&t("p",{className:"line-clamp-2 break-words font-mono text-[11.5px] text-faint",title:C,children:C})]}),n(d,{type:"button",variant:"primary",onClick:U,disabled:S,className:"shrink-0",children:[t(un,{className:"mr-1.5 size-3.5"}),S?"正在拉起授权...":"前往授权"]})]})}),V&&n("div",{className:c("callout.base",c("callout.danger"),"gap-3 rounded-2xl p-4"),children:[t(gt,{className:"mt-0.5 size-4 shrink-0 text-danger"}),n("div",{className:"min-w-0 space-y-1",children:[t("h4",{className:"text-sm font-medium text-ink",children:"连接失败"}),t("p",{className:"font-mono text-[11.5px] leading-relaxed break-words text-dim",children:C})]})]}),n("section",{className:"space-y-3",children:[n("div",{className:"flex items-baseline justify-between gap-3 px-0.5",children:[n("h4",{className:"flex items-center gap-2 text-[13px] font-medium text-ink",children:["可用工具",t("span",{className:"rounded-full bg-raised px-1.5 py-0.5 font-mono text-[11px] leading-none text-dim",children:M})]}),t("span",{className:"text-[11.5px] text-faint",children:"对所有会话可用"})]}),G?t("div",{className:c("callout.base",c("callout.danger"),"text-xs leading-relaxed break-words"),children:G}):!W?n("div",{className:c("surface.emptyDashed","gap-2 py-10"),children:[t("div",{className:"flex size-10 items-center justify-center rounded-full bg-raised text-faint",children:t(tn,{className:"size-4.5"})}),t("p",{className:"text-[13px] font-medium text-dim",children:z?"等待授权":"尚未连接"}),t("p",{className:"max-w-xs text-xs leading-relaxed text-faint",children:z?"授权完成后会自动连接并列出工具。":"连接服务器后,这里会列出它提供的全部工具。"})]}):!m?t("div",{role:"status","aria-label":"正在获取工具列表",className:"grid gap-2",children:[0,1,2].map((p)=>n("div",{className:"animate-pulse space-y-2.5 rounded-xl border border-line p-3.5",children:[t("div",{className:"h-3.5 w-32 rounded bg-raised"}),t("div",{className:"h-3 w-4/5 rounded bg-raised/70"})]},p))}):m.length===0?n("div",{className:c("surface.emptyDashed","gap-2 py-10"),children:[t("div",{className:"flex size-10 items-center justify-center rounded-full bg-raised text-faint",children:t(tn,{className:"size-4.5"})}),t("p",{className:"text-[13px] font-medium text-dim",children:"没有可用工具"}),t("p",{className:"max-w-xs text-xs leading-relaxed text-faint",children:"已连接成功,但该服务器没有声明任何工具。"})]}):t("ul",{className:"grid gap-2",children:m.map((p)=>{let f=p.inputSchema?.properties??{},D=p.inputSchema?.required??[],R=Object.entries(f);return n("li",{className:c("surface.subtle","border-line bg-raised/30 p-3.5 transition-colors hover:border-line-strong hover:bg-raised/60"),children:[t("span",{className:"font-mono text-[13px] font-medium break-all text-accent",children:p.name}),p.description&&t("p",{className:"mt-1.5 text-[13px] leading-relaxed break-words text-dim",children:p.description}),R.length>0&&t("div",{className:"mt-3 flex flex-wrap gap-1.5",children:R.map(([x,J])=>n("span",{title:D.includes(x)?"必填参数":"可选参数",className:"inline-flex items-center gap-1 rounded-md border border-line bg-panel px-1.5 py-1 font-mono text-[11px] leading-none",children:[t("span",{className:"text-ink",children:x}),D.includes(x)&&t("span",{className:"text-warning",children:"*"}),t("span",{className:"text-faint",children:Te(J)})]},x))})]},p.name)})})]})]})})}var $e=/^[A-Za-z0-9_-]{1,64}$/;function H(e){return t("span",{className:"truncate text-xs text-faint",children:e.children})}function be(e){let{pairs:d,onChange:g,InputComponent:y}=e,N=(u,c)=>g(d.map((k,s)=>s===u?{...k,...c}:k));return n("div",{className:"space-y-2",children:[n("div",{className:"flex min-h-7 items-center gap-2",children:[t("span",{className:"shrink-0 text-[13px] font-medium text-dim",children:e.label}),t(H,{children:e.tip}),n("button",{type:"button",className:"ml-auto inline-flex h-7 shrink-0 cursor-pointer items-center gap-1 rounded-lg px-2 text-xs font-medium text-dim transition-colors hover:bg-raised hover:text-ink",onClick:()=>g([...d,{key:"",value:"",saved:!1}]),children:[t(Re,{className:"size-3.5"}),"添加"]})]}),d.map((u,c)=>n("div",{className:"flex min-w-0 items-center gap-1.5",children:[t(y,{"aria-label":`${e.keyLabel} ${c+1}`,placeholder:e.keyLabel,value:u.key,readOnly:u.saved,onChange:(k)=>N(c,{key:k.target.value}),className:"min-w-0 flex-[2] font-mono text-xs"}),t(y,{"aria-label":`${e.keyLabel} ${u.key||c+1} 的值`,type:"password",autoComplete:"off",placeholder:u.saved?"已保存,留空保持不变":"值",value:u.value,onChange:(k)=>N(c,{value:k.target.value}),className:"min-w-0 flex-[3] font-mono text-xs"}),t("button",{type:"button","aria-label":`删除 ${u.key||"该项"}`,className:"flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-lg text-faint transition-colors hover:bg-danger/10 hover:text-danger",onClick:()=>g(d.filter((k,s)=>s!==c)),children:t(ve,{className:"size-4"})})]},c))]})}function Ne(e){return Object.keys(e??{}).map((d)=>({key:d,value:"",saved:!0}))}function Ce(e){let{Button:d,Segmented:g,Dialog:y,Form:N,Field:u,Input:c,Switch:k,style:s,useTheme:I}=_();I();let{existing:m}=e,[q,G]=a(m?.config.type??"local"),[K,S]=a(m?.name??""),[j,W]=a(m?.config.type==="local"?ie(m.config.command):""),[z,V]=a(m?.config.type==="remote"?m.config.url:""),[A,O]=a(Ne(m?.config.type==="local"?m.config.environment:void 0)),[U,Y]=a(Ne(m?.config.type==="remote"?m.config.headers:void 0)),E=m?.config.type==="remote"?m.config.oauth:void 0,[T,r]=a(Boolean(E)),[C,M]=a(typeof E==="object"&&E.clientId?E.clientId:""),[p,f]=a(""),[D,R]=a(typeof E==="object"&&E.scope?E.scope:""),[x,J]=a(m?.config.defer??"default"),[ee,we]=a(m?.config.timeout!==void 0?String(m.config.timeout):""),[se,ke]=a(m?.config.defer!==void 0||m?.config.timeout!==void 0),[ce,Q]=a(),[oe,de]=a(!1);async function Ie(b){b.preventDefault(),Q(void 0);let w=K.trim();if(!m&&!$e.test(w)){Q("名称只能包含英文字母、数字、下划线与中划线,长度 1-64");return}if(!m&&e.taken.includes(w)){Q("同名服务器已存在");return}let ne=ee.trim()?Number.parseInt(ee.trim(),10):void 0;if(ne!==void 0&&(!Number.isFinite(ne)||ne<=0)){Q("超时时间须为大于 0 的毫秒数");return}let le;if(q==="local"){let L=fe(j.trim());if(!L.length){Q("请输入启动命令");return}let F={};for(let B of A){let P=B.key.trim();if(!P)continue;if(!B.saved||B.value)F[P]=B.value}le={type:"local",command:L,environment:Object.keys(F).length?F:void 0,enabled:m?m.config.enabled:!0,defer:x==="default"?void 0:x,timeout:ne}}else{let L=z.trim();try{let P=new URL(L);if(P.protocol!=="http:"&&P.protocol!=="https:")throw Error("bad protocol")}catch{Q("请输入合法的 HTTP 或 HTTPS 地址");return}let F={};for(let P of U){let ae=P.key.trim();if(!ae)continue;if(!P.saved||P.value)F[ae]=P.value}let B;if(T){let P=C.trim(),ae=p.trim(),me=D.trim();if(P||ae||me)B={clientId:P||void 0,clientSecret:ae||void 0,scope:me||void 0};else B=!0}else B=!1;le={type:"remote",url:L,headers:Object.keys(F).length?F:void 0,oauth:B,enabled:m?m.config.enabled:!0,defer:x==="default"?void 0:x,timeout:ne}}de(!0);try{let L=m?.name??w,F=m?m.projectID:e.projectID,B=F?`?projectID=${encodeURIComponent(F)}`:"";await e.connection.request(`/api/mcp/${encodeURIComponent(L)}${B}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(le)}),e.onSaved()}catch(L){Q(L instanceof Error?L.message:"保存失败")}finally{de(!1)}}return t(y,{open:!0,onOpenChange:(b)=>{if(!b&&!oe)e.onClose()},title:m?`编辑 ${m.name}`:"添加 MCP 服务器",size:"lg",footer:n("div",{className:"flex w-full justify-end gap-2.5",children:[t(d,{type:"button",variant:"ghost",onClick:e.onClose,disabled:oe,className:"min-w-20",children:"取消"}),t(d,{type:"submit",form:"mcp-server-form",variant:"primary",disabled:oe,className:"min-w-24",children:oe?"保存中...":"保存"})]}),children:n(N,{id:"mcp-server-form",onSubmit:Ie,children:[t(g,{value:q,onChange:(b)=>G(b),className:"w-full [&>button]:flex-1",options:[{value:"local",label:"本地(标准输入输出)"},{value:"remote",label:"远程(HTTP / SSE)"}]}),!m&&t(u,{label:"名称",aside:t(H,{children:"唯一标识,如 postgres"}),children:(b)=>t(c,{id:b,value:K,onChange:(w)=>S(w.target.value),placeholder:"postgres",className:"font-mono text-xs"})}),q==="local"?n(v,{children:[t(u,{label:"启动命令",aside:t(H,{children:"完整命令及参数"}),children:(b)=>t(c,{id:b,value:j,onChange:(w)=>W(w.target.value),placeholder:"npx -y @modelcontextprotocol/server-postgres ...",className:"font-mono text-xs"})}),t(be,{label:"环境变量",tip:"启动进程时注入",keyLabel:"变量名",pairs:A,onChange:O,InputComponent:c})]}):n(v,{children:[t(u,{label:"服务地址",aside:t(H,{children:"HTTP / HTTPS 端点"}),children:(b)=>t(c,{id:b,value:z,onChange:(w)=>V(w.target.value),placeholder:"https://example.com/mcp",className:"font-mono text-xs"})}),t(be,{label:"请求头",tip:"随每次请求发送",keyLabel:"头字段",pairs:U,onChange:Y,InputComponent:c}),n("div",{className:"flex items-center justify-between gap-4",children:[n("div",{className:"min-w-0",children:[t("span",{className:"block text-[13px] font-medium text-dim",children:"OAuth 2.0 认证"}),t("span",{className:"block truncate text-xs text-faint",children:"自动发现授权端点,使用 PKCE 并刷新令牌"})]}),t(k,{checked:T,onCheckedChange:r,label:"启用 OAuth 2.0"})]}),T&&n(v,{children:[t(u,{label:"Client ID",aside:t(H,{children:"留空自动动态注册(DCR)"}),children:(b)=>t(c,{id:b,value:C,onChange:(w)=>M(w.target.value),placeholder:"留空自动动态注册",className:"font-mono text-xs"})}),t(u,{label:"Client Secret",aside:t(H,{children:"留空保持不变"}),children:(b)=>t(c,{id:b,type:"password",autoComplete:"off",value:p,onChange:(w)=>f(w.target.value),placeholder:"••••••••",className:"font-mono text-xs"})}),t(u,{label:"Scope",aside:t(H,{children:"选填授权范围"}),children:(b)=>t(c,{id:b,value:D,onChange:(w)=>R(w.target.value),placeholder:"repo read:org",className:"font-mono text-xs"})})]})]}),n("div",{className:"space-y-3 border-t border-line/60 pt-3",children:[n("button",{type:"button","aria-expanded":se,className:"flex w-full cursor-pointer items-center gap-1.5 text-[13px] font-medium text-dim transition-colors hover:text-ink",onClick:()=>ke(!se),children:[t(yt,{className:`size-3.5 transition-transform ${se?"rotate-90":""}`}),"高级设置",t("span",{className:"truncate text-xs font-normal text-faint",children:"加载时机、超时"})]}),se&&n("div",{className:"grid grid-cols-2 gap-3 max-sm:grid-cols-1",children:[t(u,{label:"加载时机",aside:t(H,{children:"延迟 = 按需加载"}),children:()=>t(g,{value:x,onChange:(b)=>J(b),className:"w-full [&>button]:flex-1",options:[{value:"default",label:"默认"},{value:"defer",label:"延迟"},{value:"always",label:"常驻"}]})}),t(u,{label:"超时(毫秒)",aside:t(H,{children:"留空用默认"}),children:(b)=>t(c,{id:b,value:ee,onChange:(w)=>we(w.target.value),placeholder:"默认",className:"font-mono text-xs"})})]})]}),ce&&n("div",{role:"alert",className:s("callout.base",s("callout.danger"),"px-3 py-2.5 text-xs"),children:[t(Z,{className:"mt-0.5 size-3.5 shrink-0"}),t("span",{className:"min-w-0 break-words",children:ce})]})]})})}function tt({connection:e}){let{Button:d,Input:g,style:y,useTheme:N}=_();N();let[u,c]=a(""),[k,s]=a(),[I,m]=a(),[q,G]=a(!1),[K,S]=a(),[j,W]=a(!1),z=i(!1),[V,A]=a(),O=i(0),U=h(async()=>{let r=++O.current;G(!0);try{let C=await e.request("/api/mcp");if(r!==O.current)return;s(C),m(void 0)}catch(C){if(r===O.current)m(C instanceof Error?C.message:"读取失败")}finally{if(r===O.current)G(!1)}},[e]);o(()=>(U(),()=>{O.current++}),[U]);async function Y(r,C){if(z.current)return;z.current=!0,W(!0);let M=O.current;try{let p=r.projectID?`?projectID=${encodeURIComponent(r.projectID)}`:"",f=await e.request(`/api/mcp/${encodeURIComponent(r.name)}${p}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({...r.config,enabled:C})});if(M===O.current)s((D)=>D?.map((R)=>R.name===f.name&&R.projectID===f.projectID?f:R))}finally{z.current=!1,W(!1)}}let E=k?.filter((r)=>`${r.name} ${X(r.config)}`.toLowerCase().includes(u.trim().toLowerCase())),T=k?.find((r)=>r.name===K);return n("div",{className:"min-w-0 space-y-6",children:[n("section",{className:"min-w-0",children:[n("div",{className:"mb-2.5 flex flex-wrap items-end justify-between gap-3 px-0.5",children:[n("div",{className:"min-w-0 flex-1 basis-48",children:[t("h2",{className:y("settings.groupTitle"),children:"MCP 服务器"}),t("p",{className:y("settings.groupDesc"),children:"外部工具与数据源管理"})]}),n("div",{className:"flex gap-2",children:[t(d,{variant:"ghost",disabled:q,onClick:U,className:"h-9 px-2.5 text-xs",children:t(te,{className:`size-3.5 ${q?"animate-spin":""}`})}),n(d,{variant:"secondary",onClick:()=>A({}),className:"h-9 px-2.5 text-xs",children:[t(Re,{className:"size-3.5 mr-1"}),"添加服务器"]})]})]}),I&&n("div",{role:"alert",className:y("callout.base",y("callout.danger"),"mb-3 flex-wrap items-center justify-between"),children:[n("p",{className:"min-w-0 flex-1 break-words text-sm text-danger",children:["无法读取 MCP 服务器:",I]}),t(d,{disabled:q,onClick:U,children:"重试"})]}),n("div",{className:"relative mb-3 min-w-0",children:[t(ue,{"aria-hidden":!0,className:"pointer-events-none absolute top-3 left-3 size-4 text-faint"}),t(g,{type:"search","aria-label":"搜索 MCP 服务器",placeholder:"搜索服务器",value:u,onChange:(r)=>c(r.target.value),className:"h-10 min-w-0 pl-9"})]}),t("div",{className:y("settings.groupBox"),children:!k?t("div",{role:"status","aria-label":"正在加载",className:"divide-y divide-line",children:[0,1,2].map((r)=>n("div",{className:"h-16 space-y-2 px-4 py-3",children:[t("div",{className:"h-3 w-24 animate-pulse rounded bg-raised"}),t("div",{className:"h-3 w-2/3 animate-pulse rounded bg-raised"})]},r))}):E?.length===0?t("p",{className:"p-4 text-sm text-dim",children:"没有匹配的 MCP 服务器"}):t("ul",{className:"divide-y divide-line",children:E?.map((r)=>{let C=r.config.enabled===!1,M=r.scope==="file";return n("li",{className:`flex min-w-0 items-center justify-between gap-3 px-4 py-2.5 transition-colors hover:bg-raised/40 ${C?"opacity-55":""}`,children:[n("button",{type:"button",className:"group flex min-h-12 min-w-0 flex-1 cursor-pointer items-center gap-3 py-1 text-left focus-visible:outline-2 focus-visible:outline-accent","aria-label":`查看 ${r.name}`,disabled:M,title:M?"来自项目的 .mcp.json,只读":void 0,onClick:()=>S(r.name),children:[t("span",{"aria-hidden":!0,className:"flex size-9 shrink-0 items-center justify-center rounded-lg bg-raised text-dim",children:r.config.type==="local"?t(ot,{className:"size-4"}):t(ye,{className:"size-4"})}),n("span",{className:"min-w-0 flex-1",children:[t("span",{className:"block truncate text-sm font-medium text-ink",title:r.name,children:r.name}),t("span",{className:"mt-0.5 block truncate font-mono text-xs text-dim",title:X(r.config),children:X(r.config)})]}),t("span",{className:y("control.badge","shrink-0 text-[11px] text-dim"),children:r.scope==="project"?"项目":r.scope==="file"?".mcp.json":"全局"}),t(xe,{info:r})]}),t("span",{className:"relative flex size-10 shrink-0 items-center justify-center",children:!M&&t("input",{type:"checkbox","aria-label":`启用服务器 ${r.name}`,className:ge,disabled:j||q,checked:!C,onChange:(p)=>Y(r,p.target.checked)})})]},r.name)})})})]}),T&&!V&&t(he,{connection:e,info:T,onClose:()=>S(void 0),onEdit:()=>A({info:T}),onChanged:(r)=>r?s((C)=>C?.map((M)=>M.name===r.name?r:M)):U()},`${T.projectID}:${T.name}`),V&&t(Ce,{connection:e,existing:V.info,taken:(k??[]).map((r)=>r.name),onClose:()=>A(void 0),onSaved:()=>{A(void 0),U()}})]})}export{tt as McpSection};
1
+ import{h,o,i,a,v,t,n,_,l,Z,gt,yt,un,ve,Re,te,de,jt,ot,re,tn,oe}from"./chunk-aqm3spxt.js";var Se=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],fe=l("key-round",Se);function ge(e){let d=[],g="",y,N=!1;for(let u=0;u<e.length;u++){let c=e[u];if(y)if(c===y)y=void 0;else if(c==="\\"&&y==='"'&&u+1<e.length)g+=e[++u];else g+=c;else if(c==='"'||c==="'")y=c,N=!0;else if(c==="\\"&&u+1<e.length)g+=e[++u],N=!0;else if(/\s/.test(c)){if(N||g)d.push(g);g="",N=!1}else g+=c,N=!0}if(N||g)d.push(g);return d}function le(e){return e.map((d)=>d===""||/[\s"'\\]/.test(d)?`"${d.replace(/(["\\])/g,"\\$1")}"`:d).join(" ")}var xe="size-4 cursor-pointer rounded border-line text-accent accent-accent focus-visible:outline-2 focus-visible:outline-accent",je={connected:{label:"已连接",dot:"bg-success"},idle:{label:"待连接",dot:"bg-faint"},disabled:{label:"已停用",dot:"bg-faint"},failed:{label:"连接失败",dot:"bg-danger"},needs_auth:{label:"需要认证",dot:"bg-warning"}};function X(e){return e.type==="local"?le(e.command):e.url}function he({info:e,tools:d=!1}){let g=je[e.status.status];return n("span",{className:"inline-flex shrink-0 items-center gap-1.5 text-xs text-dim",children:[t("span",{"aria-hidden":!0,className:`size-1.5 shrink-0 rounded-full ${g.dot}`}),t("span",{className:d?void 0:"hidden @md/panel:inline",children:g.label}),d&&e.status.status==="connected"&&n("span",{className:"text-faint",children:["· ",e.toolCount," 个工具"]})]})}function Te(e){if(typeof e!=="object"||e===null||!("type"in e))return"any";let d=e.type;if(typeof d==="string")return d;if(Array.isArray(d))return d.filter((g)=>typeof g==="string").join(" | ")||"any";return"any"}function be(e){let{Button:d,CopyButton:g,Dialog:y,StatusChip:N,confirm:u,style:c,useTheme:k}=_();k();let{info:s,connection:I}=e,[m,q]=a(),[G,K]=a(),[S,j]=a(!1),W=s.status.status==="connected",z=s.status.status==="needs_auth",V=s.status.status==="failed",A=s.config.type==="remote"&&Boolean(s.config.oauth);o(()=>{function p(x){if(x&&x!==s.name)return;let J=s.projectID?`?projectID=${encodeURIComponent(s.projectID)}`:"";I.request(`/api/mcp/${encodeURIComponent(s.name)}/connect${J}`,{method:"POST"}).then((ee)=>e.onChanged(ee)).catch(()=>{})}function f(x){if(x.data?.type==="mcp-oauth-success")p(x.data.name)}function D(x){if(x.key==="basalt-mcp-oauth-event"&&x.newValue)try{let J=JSON.parse(x.newValue);p(J.name)}catch(J){}}window.addEventListener("message",f),window.addEventListener("storage",D);let R;if("BroadcastChannel"in window)R=new BroadcastChannel("basalt-mcp-oauth"),R.onmessage=(x)=>{if(x.data?.type==="mcp-oauth-success")p(x.data.name)};return()=>{window.removeEventListener("message",f),window.removeEventListener("storage",D),R?.close()}},[I,s.name,s.projectID,e]),o(()=>{if(s.status.status!=="connected")return;let p=s.projectID?`?projectID=${encodeURIComponent(s.projectID)}`:"";I.request(`/api/mcp/${encodeURIComponent(s.name)}/tools${p}`).then((f)=>{if(Array.isArray(f))q(f),K(void 0)}).catch((f)=>{K(f instanceof Error?f.message:"获取工具失败")})},[I,s.name,s.projectID,s.status.status]);async function O(p){j(!0);try{let f=s.projectID?`?projectID=${encodeURIComponent(s.projectID)}`:"",D=await I.request(`/api/mcp/${encodeURIComponent(s.name)}/${p}${f}`,{method:"POST"});e.onChanged(D)}catch{}finally{j(!1)}}async function U(){j(!0);try{let p=s.projectID?`?projectID=${encodeURIComponent(s.projectID)}`:"",f=s.status.status==="needs_auth"?s.status.authorizationUrl:void 0;if(!f)f=(await I.request(`/api/mcp/${encodeURIComponent(s.name)}/oauth/authorize${p}`,{method:"POST"})).authorizationUrl;if(f)window.open(f,"_blank","width=600,height=700")}catch(p){K(p instanceof Error?p.message:"获取授权链接失败")}finally{j(!1)}}async function Y(){j(!0);try{let p=s.projectID?`?projectID=${encodeURIComponent(s.projectID)}`:"",f=await I.request(`/api/mcp/${encodeURIComponent(s.name)}/oauth/clear${p}`,{method:"POST"});e.onChanged(f)}finally{j(!1)}}async function E(){if(!await u({title:`删除 ${s.name}?`,description:"删除后将断开连接并不再向会话提供其工具。",action:"删除",danger:!0}))return;j(!0);try{let f=s.projectID?`?projectID=${encodeURIComponent(s.projectID)}`:"";await I.request(`/api/mcp/${encodeURIComponent(s.name)}${f}`,{method:"DELETE"}),e.onChanged(),e.onClose()}finally{j(!1)}}let T=s.config,r=X(T),C="error"in s.status?s.status.error:void 0,M=m?.length??s.toolCount??0;return t(y,{open:!0,className:"bg-panel shadow-float",onOpenChange:(p)=>{if(!p&&!S)e.onClose()},title:n("div",{className:"flex flex-wrap items-center gap-3",children:[t("div",{className:"flex size-8 items-center justify-center rounded-[10px] border border-accent/20 bg-accent-soft text-accent",children:T.type==="local"?t(ot,{className:"size-4"}):t(ve,{className:"size-4"})}),t("span",{className:"font-serif text-lg font-semibold tracking-tight text-ink",children:s.name}),W?t(N,{tone:"success",pulse:!0,children:"已连接"}):z?t(N,{tone:"warning",pulse:!0,children:"需要授权"}):V?t(N,{tone:"danger",children:"连接失败"}):s.status.status==="disabled"?t(N,{tone:"neutral",children:"已停用"}):t(N,{tone:"neutral",children:"未连接"})]}),description:n("div",{className:"mt-2 flex min-w-0 flex-wrap items-center gap-1.5 text-xs",children:[n("span",{className:"flex min-w-0 max-w-full items-center gap-1 rounded-lg border border-line bg-raised/60 py-0.5 pr-1 pl-2.5 font-mono text-[11.5px] text-ink",children:[t("span",{className:"min-w-0 truncate",title:r,children:r}),t(g,{text:r,label:"复制地址",size:"icon-xs",className:"shrink-0 text-dim hover:text-ink"})]}),t("span",{className:"rounded-lg border border-line px-2 py-1 text-[11px] leading-none text-dim",children:T.type==="local"?"本地命令":"远程 HTTP"}),A&&n("span",{className:c("control.badgeAccent","gap-1 rounded-lg border border-accent/25 px-2 py-1"),children:[t(jt,{className:"size-3"}),"OAuth 2.0"]})]}),size:"lg",footer:n("div",{className:"flex w-full items-center justify-between gap-2 max-sm:flex-col",children:[n("div",{className:"flex items-center gap-1 max-sm:w-full",children:[A&&t(d,{type:"button",variant:"ghost",onClick:Y,disabled:S,title:"清除已保存的 OAuth 凭据",children:"清除凭据"}),t(d,{type:"button",variant:"danger-ghost",size:"icon-sm","aria-label":"删除服务器",onClick:E,disabled:S,title:"删除服务器",children:t(re,{className:"size-4"})})]}),n("div",{className:"flex items-center gap-2 max-sm:w-full max-sm:justify-end",children:[t(d,{type:"button",variant:"ghost",onClick:e.onEdit,disabled:S,children:"编辑配置"}),!z&&t(d,{type:"button",variant:"secondary",onClick:()=>O(W?"disconnect":"connect"),disabled:S,children:S?"处理中...":W?"断开连接":"立即连接"}),t(d,{type:"button",variant:"primary",onClick:e.onClose,children:"完成"})]})]}),children:n("div",{className:"space-y-6 pt-1",children:[z&&t("div",{className:"relative overflow-hidden rounded-2xl border border-warning/30 bg-[radial-gradient(120%_140%_at_0%_0%,color-mix(in_oklch,var(--color-warning)_16%,transparent),transparent_65%)] p-5",children:n("div",{className:"flex items-start gap-4 max-sm:flex-col",children:[t("div",{className:"relative flex size-11 shrink-0 items-center justify-center rounded-xl border border-warning/30 bg-panel text-warning shadow-[0_0_28px_-4px_color-mix(in_oklch,var(--color-warning)_55%,transparent)]",children:t(fe,{className:"size-5"})}),n("div",{className:"min-w-0 flex-1 space-y-1.5",children:[t("h4",{className:"text-sm font-semibold text-ink",children:"授权后即可使用此服务器"}),t("p",{className:"text-[13px] leading-relaxed text-dim",children:"该端点要求 OAuth 2.0 身份许可。在浏览器中完成授权后,令牌会自动保存并载入全部工具。"}),C&&t("p",{className:"line-clamp-2 break-words font-mono text-[11.5px] text-faint",title:C,children:C})]}),n(d,{type:"button",variant:"primary",onClick:U,disabled:S,className:"shrink-0",children:[t(un,{className:"mr-1.5 size-3.5"}),S?"正在拉起授权...":"前往授权"]})]})}),V&&n("div",{className:c("callout.base",c("callout.danger"),"gap-3 rounded-2xl p-4"),children:[t(gt,{className:"mt-0.5 size-4 shrink-0 text-danger"}),n("div",{className:"min-w-0 space-y-1",children:[t("h4",{className:"text-sm font-medium text-ink",children:"连接失败"}),t("p",{className:"font-mono text-[11.5px] leading-relaxed break-words text-dim",children:C})]})]}),n("section",{className:"space-y-3",children:[n("div",{className:"flex items-baseline justify-between gap-3 px-0.5",children:[n("h4",{className:"flex items-center gap-2 text-[13px] font-medium text-ink",children:["可用工具",t("span",{className:"rounded-full bg-raised px-1.5 py-0.5 font-mono text-[11px] leading-none text-dim",children:M})]}),t("span",{className:"text-[11.5px] text-faint",children:"对所有会话可用"})]}),G?t("div",{className:c("callout.base",c("callout.danger"),"text-xs leading-relaxed break-words"),children:G}):!W?n("div",{className:c("surface.emptyDashed","gap-2 py-10"),children:[t("div",{className:"flex size-10 items-center justify-center rounded-full bg-raised text-faint",children:t(tn,{className:"size-4.5"})}),t("p",{className:"text-[13px] font-medium text-dim",children:z?"等待授权":"尚未连接"}),t("p",{className:"max-w-xs text-xs leading-relaxed text-faint",children:z?"授权完成后会自动连接并列出工具。":"连接服务器后,这里会列出它提供的全部工具。"})]}):!m?t("div",{role:"status","aria-label":"正在获取工具列表",className:"grid gap-2",children:[0,1,2].map((p)=>n("div",{className:"animate-pulse space-y-2.5 rounded-xl border border-line p-3.5",children:[t("div",{className:"h-3.5 w-32 rounded bg-raised"}),t("div",{className:"h-3 w-4/5 rounded bg-raised/70"})]},p))}):m.length===0?n("div",{className:c("surface.emptyDashed","gap-2 py-10"),children:[t("div",{className:"flex size-10 items-center justify-center rounded-full bg-raised text-faint",children:t(tn,{className:"size-4.5"})}),t("p",{className:"text-[13px] font-medium text-dim",children:"没有可用工具"}),t("p",{className:"max-w-xs text-xs leading-relaxed text-faint",children:"已连接成功,但该服务器没有声明任何工具。"})]}):t("ul",{className:"grid gap-2",children:m.map((p)=>{let f=p.inputSchema?.properties??{},D=p.inputSchema?.required??[],R=Object.entries(f);return n("li",{className:c("surface.subtle","border-line bg-raised/30 p-3.5 transition-colors hover:border-line-strong hover:bg-raised/60"),children:[t("span",{className:"font-mono text-[13px] font-medium break-all text-accent",children:p.name}),p.description&&t("p",{className:"mt-1.5 text-[13px] leading-relaxed break-words text-dim",children:p.description}),R.length>0&&t("div",{className:"mt-3 flex flex-wrap gap-1.5",children:R.map(([x,J])=>n("span",{title:D.includes(x)?"必填参数":"可选参数",className:"inline-flex items-center gap-1 rounded-md border border-line bg-panel px-1.5 py-1 font-mono text-[11px] leading-none",children:[t("span",{className:"text-ink",children:x}),D.includes(x)&&t("span",{className:"text-warning",children:"*"}),t("span",{className:"text-faint",children:Te(J)})]},x))})]},p.name)})})]})]})})}var $e=/^[A-Za-z0-9_-]{1,64}$/;function H(e){return t("span",{className:"truncate text-xs text-faint",children:e.children})}function ye(e){let{pairs:d,onChange:g,InputComponent:y}=e,N=(u,c)=>g(d.map((k,s)=>s===u?{...k,...c}:k));return n("div",{className:"space-y-2",children:[n("div",{className:"flex min-h-7 items-center gap-2",children:[t("span",{className:"shrink-0 text-[13px] font-medium text-dim",children:e.label}),t(H,{children:e.tip}),n("button",{type:"button",className:"ml-auto inline-flex h-7 shrink-0 cursor-pointer items-center gap-1 rounded-lg px-2 text-xs font-medium text-dim transition-colors hover:bg-raised hover:text-ink",onClick:()=>g([...d,{key:"",value:"",saved:!1}]),children:[t(Re,{className:"size-3.5"}),"添加"]})]}),d.map((u,c)=>n("div",{className:"flex min-w-0 items-center gap-1.5",children:[t(y,{"aria-label":`${e.keyLabel} ${c+1}`,placeholder:e.keyLabel,value:u.key,readOnly:u.saved,onChange:(k)=>N(c,{key:k.target.value}),className:"min-w-0 flex-[2] font-mono text-xs"}),t(y,{"aria-label":`${e.keyLabel} ${u.key||c+1} 的值`,type:"password",autoComplete:"off",placeholder:u.saved?"已保存,留空保持不变":"值",value:u.value,onChange:(k)=>N(c,{value:k.target.value}),className:"min-w-0 flex-[3] font-mono text-xs"}),t("button",{type:"button","aria-label":`删除 ${u.key||"该项"}`,className:"flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-lg text-faint transition-colors hover:bg-danger/10 hover:text-danger",onClick:()=>g(d.filter((k,s)=>s!==c)),children:t(oe,{className:"size-4"})})]},c))]})}function Ne(e){return Object.keys(e??{}).map((d)=>({key:d,value:"",saved:!0}))}function Ce(e){let{Button:d,Segmented:g,Dialog:y,Form:N,Field:u,Input:c,Switch:k,style:s,useTheme:I}=_();I();let{existing:m}=e,[q,G]=a(m?.config.type??"local"),[K,S]=a(m?.name??""),[j,W]=a(m?.config.type==="local"?le(m.config.command):""),[z,V]=a(m?.config.type==="remote"?m.config.url:""),[A,O]=a(Ne(m?.config.type==="local"?m.config.environment:void 0)),[U,Y]=a(Ne(m?.config.type==="remote"?m.config.headers:void 0)),E=m?.config.type==="remote"?m.config.oauth:void 0,[T,r]=a(Boolean(E)),[C,M]=a(typeof E==="object"&&E.clientId?E.clientId:""),[p,f]=a(""),[D,R]=a(typeof E==="object"&&E.scope?E.scope:""),[x,J]=a(m?.config.defer??"default"),[ee,we]=a(m?.config.timeout!==void 0?String(m.config.timeout):""),[se,ke]=a(m?.config.defer!==void 0||m?.config.timeout!==void 0),[me,Q]=a(),[ie,pe]=a(!1);async function Ie(b){b.preventDefault(),Q(void 0);let w=K.trim();if(!m&&!$e.test(w)){Q("名称只能包含英文字母、数字、下划线与中划线,长度 1-64");return}if(!m&&e.taken.includes(w)){Q("同名服务器已存在");return}let ne=ee.trim()?Number.parseInt(ee.trim(),10):void 0;if(ne!==void 0&&(!Number.isFinite(ne)||ne<=0)){Q("超时时间须为大于 0 的毫秒数");return}let ce;if(q==="local"){let L=ge(j.trim());if(!L.length){Q("请输入启动命令");return}let F={};for(let B of A){let P=B.key.trim();if(!P)continue;if(!B.saved||B.value)F[P]=B.value}ce={type:"local",command:L,environment:Object.keys(F).length?F:void 0,enabled:m?m.config.enabled:!0,defer:x==="default"?void 0:x,timeout:ne}}else{let L=z.trim();try{let P=new URL(L);if(P.protocol!=="http:"&&P.protocol!=="https:")throw Error("bad protocol")}catch{Q("请输入合法的 HTTP 或 HTTPS 地址");return}let F={};for(let P of U){let ae=P.key.trim();if(!ae)continue;if(!P.saved||P.value)F[ae]=P.value}let B;if(T){let P=C.trim(),ae=p.trim(),ue=D.trim();if(P||ae||ue)B={clientId:P||void 0,clientSecret:ae||void 0,scope:ue||void 0};else B=!0}else B=!1;ce={type:"remote",url:L,headers:Object.keys(F).length?F:void 0,oauth:B,enabled:m?m.config.enabled:!0,defer:x==="default"?void 0:x,timeout:ne}}pe(!0);try{let L=m?.name??w,F=m?m.projectID:e.projectID,B=F?`?projectID=${encodeURIComponent(F)}`:"";await e.connection.request(`/api/mcp/${encodeURIComponent(L)}${B}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(ce)}),e.onSaved()}catch(L){Q(L instanceof Error?L.message:"保存失败")}finally{pe(!1)}}return t(y,{open:!0,onOpenChange:(b)=>{if(!b&&!ie)e.onClose()},title:m?`编辑 ${m.name}`:"添加 MCP 服务器",size:"lg",footer:n("div",{className:"flex w-full justify-end gap-2.5",children:[t(d,{type:"button",variant:"ghost",onClick:e.onClose,disabled:ie,className:"min-w-20",children:"取消"}),t(d,{type:"submit",form:"mcp-server-form",variant:"primary",disabled:ie,className:"min-w-24",children:ie?"保存中...":"保存"})]}),children:n(N,{id:"mcp-server-form",onSubmit:Ie,children:[t(g,{value:q,onChange:(b)=>G(b),className:"w-full [&>button]:flex-1",options:[{value:"local",label:"本地(标准输入输出)"},{value:"remote",label:"远程(HTTP / SSE)"}]}),!m&&t(u,{label:"名称",aside:t(H,{children:"唯一标识,如 postgres"}),children:(b)=>t(c,{id:b,value:K,onChange:(w)=>S(w.target.value),placeholder:"postgres",className:"font-mono text-xs"})}),q==="local"?n(v,{children:[t(u,{label:"启动命令",aside:t(H,{children:"完整命令及参数"}),children:(b)=>t(c,{id:b,value:j,onChange:(w)=>W(w.target.value),placeholder:"npx -y @modelcontextprotocol/server-postgres ...",className:"font-mono text-xs"})}),t(ye,{label:"环境变量",tip:"启动进程时注入",keyLabel:"变量名",pairs:A,onChange:O,InputComponent:c})]}):n(v,{children:[t(u,{label:"服务地址",aside:t(H,{children:"HTTP / HTTPS 端点"}),children:(b)=>t(c,{id:b,value:z,onChange:(w)=>V(w.target.value),placeholder:"https://example.com/mcp",className:"font-mono text-xs"})}),t(ye,{label:"请求头",tip:"随每次请求发送",keyLabel:"头字段",pairs:U,onChange:Y,InputComponent:c}),n("div",{className:"flex items-center justify-between gap-4",children:[n("div",{className:"min-w-0",children:[t("span",{className:"block text-[13px] font-medium text-dim",children:"OAuth 2.0 认证"}),t("span",{className:"block truncate text-xs text-faint",children:"自动发现授权端点,使用 PKCE 并刷新令牌"})]}),t(k,{checked:T,onCheckedChange:r,label:"启用 OAuth 2.0"})]}),T&&n(v,{children:[t(u,{label:"Client ID",aside:t(H,{children:"留空自动动态注册(DCR)"}),children:(b)=>t(c,{id:b,value:C,onChange:(w)=>M(w.target.value),placeholder:"留空自动动态注册",className:"font-mono text-xs"})}),t(u,{label:"Client Secret",aside:t(H,{children:"留空保持不变"}),children:(b)=>t(c,{id:b,type:"password",autoComplete:"off",value:p,onChange:(w)=>f(w.target.value),placeholder:"••••••••",className:"font-mono text-xs"})}),t(u,{label:"Scope",aside:t(H,{children:"选填授权范围"}),children:(b)=>t(c,{id:b,value:D,onChange:(w)=>R(w.target.value),placeholder:"repo read:org",className:"font-mono text-xs"})})]})]}),n("div",{className:"space-y-3 border-t border-line/60 pt-3",children:[n("button",{type:"button","aria-expanded":se,className:"flex w-full cursor-pointer items-center gap-1.5 text-[13px] font-medium text-dim transition-colors hover:text-ink",onClick:()=>ke(!se),children:[t(yt,{className:`size-3.5 transition-transform ${se?"rotate-90":""}`}),"高级设置",t("span",{className:"truncate text-xs font-normal text-faint",children:"加载时机、超时"})]}),se&&n("div",{className:"grid grid-cols-2 gap-3 max-sm:grid-cols-1",children:[t(u,{label:"加载时机",aside:t(H,{children:"延迟 = 按需加载"}),children:()=>t(g,{value:x,onChange:(b)=>J(b),className:"w-full [&>button]:flex-1",options:[{value:"default",label:"默认"},{value:"defer",label:"延迟"},{value:"always",label:"常驻"}]})}),t(u,{label:"超时(毫秒)",aside:t(H,{children:"留空用默认"}),children:(b)=>t(c,{id:b,value:ee,onChange:(w)=>we(w.target.value),placeholder:"默认",className:"font-mono text-xs"})})]})]}),me&&n("div",{role:"alert",className:s("callout.base",s("callout.danger"),"px-3 py-2.5 text-xs"),children:[t(Z,{className:"mt-0.5 size-3.5 shrink-0"}),t("span",{className:"min-w-0 break-words",children:me})]})]})})}function tt({connection:e}){let{Button:d,Input:g,style:y,useTheme:N}=_();N();let[u,c]=a(""),[k,s]=a(),[I,m]=a(),[q,G]=a(!1),[K,S]=a(),[j,W]=a(!1),z=i(!1),[V,A]=a(),O=i(0),U=h(async()=>{let r=++O.current;G(!0);try{let C=await e.request("/api/mcp");if(r!==O.current)return;s(C),m(void 0)}catch(C){if(r===O.current)m(C instanceof Error?C.message:"读取失败")}finally{if(r===O.current)G(!1)}},[e]);o(()=>(U(),()=>{O.current++}),[U]);async function Y(r,C){if(z.current)return;z.current=!0,W(!0);let M=O.current;try{let p=r.projectID?`?projectID=${encodeURIComponent(r.projectID)}`:"",f=await e.request(`/api/mcp/${encodeURIComponent(r.name)}${p}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({...r.config,enabled:C})});if(M===O.current)s((D)=>D?.map((R)=>R.name===f.name&&R.projectID===f.projectID?f:R))}finally{z.current=!1,W(!1)}}let E=k?.filter((r)=>`${r.name} ${X(r.config)}`.toLowerCase().includes(u.trim().toLowerCase())),T=k?.find((r)=>r.name===K);return n("div",{className:"min-w-0 space-y-6",children:[n("section",{className:"min-w-0",children:[n("div",{className:"mb-2.5 flex flex-wrap items-end justify-between gap-3 px-0.5",children:[n("div",{className:"min-w-0 flex-1 basis-48",children:[t("h2",{className:y("settings.groupTitle"),children:"MCP 服务器"}),t("p",{className:y("settings.groupDesc"),children:"外部工具与数据源管理"})]}),n("div",{className:"flex gap-2",children:[t(d,{variant:"ghost",disabled:q,onClick:U,className:"h-9 px-2.5 text-xs",children:t(te,{className:`size-3.5 ${q?"animate-spin":""}`})}),n(d,{variant:"secondary",onClick:()=>A({}),className:"h-9 px-2.5 text-xs",children:[t(Re,{className:"size-3.5 mr-1"}),"添加服务器"]})]})]}),I&&n("div",{role:"alert",className:y("callout.base",y("callout.danger"),"mb-3 flex-wrap items-center justify-between"),children:[n("p",{className:"min-w-0 flex-1 break-words text-sm text-danger",children:["无法读取 MCP 服务器:",I]}),t(d,{disabled:q,onClick:U,children:"重试"})]}),n("div",{className:"relative mb-3 min-w-0",children:[t(de,{"aria-hidden":!0,className:"pointer-events-none absolute top-3 left-3 size-4 text-faint"}),t(g,{type:"search","aria-label":"搜索 MCP 服务器",placeholder:"搜索服务器",value:u,onChange:(r)=>c(r.target.value),className:"h-10 min-w-0 pl-9"})]}),t("div",{className:y("settings.groupBox"),children:!k?t("div",{role:"status","aria-label":"正在加载",className:"divide-y divide-line",children:[0,1,2].map((r)=>n("div",{className:"h-16 space-y-2 px-4 py-3",children:[t("div",{className:"h-3 w-24 animate-pulse rounded bg-raised"}),t("div",{className:"h-3 w-2/3 animate-pulse rounded bg-raised"})]},r))}):E?.length===0?t("p",{className:"p-4 text-sm text-dim",children:"没有匹配的 MCP 服务器"}):t("ul",{className:"divide-y divide-line",children:E?.map((r)=>{let C=r.config.enabled===!1,M=r.scope==="file";return n("li",{className:`flex min-w-0 items-center justify-between gap-3 px-4 py-2.5 transition-colors hover:bg-raised/40 ${C?"opacity-55":""}`,children:[n("button",{type:"button",className:"group flex min-h-12 min-w-0 flex-1 cursor-pointer items-center gap-3 py-1 text-left focus-visible:outline-2 focus-visible:outline-accent","aria-label":`查看 ${r.name}`,disabled:M,title:M?"来自项目的 .mcp.json,只读":void 0,onClick:()=>S(r.name),children:[t("span",{"aria-hidden":!0,className:"flex size-9 shrink-0 items-center justify-center rounded-lg bg-raised text-dim",children:r.config.type==="local"?t(ot,{className:"size-4"}):t(ve,{className:"size-4"})}),n("span",{className:"min-w-0 flex-1",children:[t("span",{className:"block truncate text-sm font-medium text-ink",title:r.name,children:r.name}),t("span",{className:"mt-0.5 block truncate font-mono text-xs text-dim",title:X(r.config),children:X(r.config)})]}),t("span",{className:y("control.badge","shrink-0 text-[11px] text-dim"),children:r.scope==="project"?"项目":r.scope==="file"?".mcp.json":"全局"}),t(he,{info:r})]}),t("span",{className:"relative flex size-10 shrink-0 items-center justify-center",children:!M&&t("input",{type:"checkbox","aria-label":`启用服务器 ${r.name}`,className:xe,disabled:j||q,checked:!C,onChange:(p)=>Y(r,p.target.checked)})})]},r.name)})})})]}),T&&!V&&t(be,{connection:e,info:T,onClose:()=>S(void 0),onEdit:()=>A({info:T}),onChanged:(r)=>r?s((C)=>C?.map((M)=>M.name===r.name?r:M)):U()},`${T.projectID}:${T.name}`),V&&t(Ce,{connection:e,existing:V.info,taken:(k??[]).map((r)=>r.name),onClose:()=>A(void 0),onSaved:()=>{A(void 0),U()}})]})}export{tt as McpSection};