@bkm016/basalt 0.1.9 → 0.1.11

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 (188) hide show
  1. package/{chunk-0xd9mnc2.js → chunk-jymx3a77.js} +165 -152
  2. package/{chunk-66h5qpc6.js → chunk-zq32mwxj.js} +134 -134
  3. package/compiled.js +1 -1
  4. package/package.json +1 -1
  5. package/ui-test-worker.js +1 -1
  6. package/web/{chunk-9yfftz38.js → chunk-05mvzx00.js} +1 -1
  7. package/web/chunk-086dshck.js +1 -0
  8. package/web/chunk-0fy590s0.js +1 -0
  9. package/web/{chunk-4a6gdrbs.js → chunk-0hvxb5d5.js} +1 -1
  10. package/web/chunk-0mdf1qja.js +1 -0
  11. package/web/{chunk-dz7g1gnv.js → chunk-0y971zgq.js} +2 -2
  12. package/web/{chunk-fjb3ksfd.js → chunk-1t38sgrk.js} +2 -2
  13. package/web/{chunk-66wb0p6e.js → chunk-1zfxaafq.js} +1 -1
  14. package/web/{chunk-p9hfcamx.js → chunk-27812gqr.js} +5 -5
  15. package/web/{chunk-sk1wkgjw.js → chunk-2ds0a2z1.js} +3 -3
  16. package/web/{chunk-ddyyc20r.js → chunk-2f2agfpj.js} +11 -11
  17. package/web/{chunk-3ecrkvr3.js → chunk-2tsxj613.js} +3 -3
  18. package/web/{chunk-y2rzeb4v.js → chunk-2weaa3gn.js} +2 -2
  19. package/web/{chunk-0pghpg4y.js → chunk-3020mmp1.js} +1 -1
  20. package/web/{chunk-mykrm8ba.js → chunk-30aeb767.js} +2 -2
  21. package/web/chunk-32zmk3f5.js +1 -0
  22. package/web/{chunk-zb2bkr7f.js → chunk-36dc7tcg.js} +2 -2
  23. package/web/{chunk-nnyc889n.js → chunk-3a57m7xm.js} +3 -3
  24. package/web/{chunk-8w7fyb3v.js → chunk-3b4wqmnh.js} +7 -7
  25. package/web/chunk-3d3wnh8a.js +2 -0
  26. package/web/{chunk-601k823s.js → chunk-3ftb27f3.js} +8 -8
  27. package/web/{chunk-c6yacwbc.js → chunk-47mbbmst.js} +3 -3
  28. package/web/chunk-48479gnx.js +1 -0
  29. package/web/{chunk-qsqtwf34.js → chunk-4gc663j0.js} +2 -2
  30. package/web/{chunk-kcjz03h5.js → chunk-4rwwtfnd.js} +2 -2
  31. package/web/{chunk-eqndhs21.js → chunk-4wwd3pfz.js} +2 -2
  32. package/web/{chunk-myd6sc76.js → chunk-57pyz29y.js} +2 -2
  33. package/web/{chunk-mdfksj61.js → chunk-59nk506k.js} +1 -1
  34. package/web/{chunk-db3twjvk.js → chunk-5ahx98zj.js} +9 -9
  35. package/web/chunk-6cjm2yr7.js +1 -0
  36. package/web/{chunk-frnh4zqf.js → chunk-6jb2zyp6.js} +2 -2
  37. package/web/{chunk-ts6jsfdk.js → chunk-793m5jjh.js} +1 -1
  38. package/web/{chunk-3ak5dg10.js → chunk-7dycbjxn.js} +4 -4
  39. package/web/chunk-7ycxz39p.js +1 -0
  40. package/web/{chunk-tftc5v89.js → chunk-8151c970.js} +1 -1
  41. package/web/{chunk-jccz14ye.js → chunk-885kpj14.js} +2 -2
  42. package/web/{chunk-79e08rk1.js → chunk-8csw0mvf.js} +2 -2
  43. package/web/{chunk-m9q5nr8f.js → chunk-8z7texmv.js} +1 -1
  44. package/web/{chunk-v1exk5wd.js → chunk-90fkdzx3.js} +8 -8
  45. package/web/chunk-94denx9h.js +39 -0
  46. package/web/{chunk-5baeh8q7.js → chunk-96xhmmqz.js} +6 -6
  47. package/web/chunk-9jy8nc4r.js +1 -0
  48. package/web/{chunk-5dr4tkem.js → chunk-9kkzmss7.js} +3 -3
  49. package/web/chunk-9wr33d0t.js +1 -0
  50. package/web/{chunk-3pd0qt83.js → chunk-a3pye9ag.js} +3 -3
  51. package/web/chunk-a4tdrxdh.js +1 -0
  52. package/web/chunk-a9fvsyc1.js +1 -0
  53. package/web/chunk-apvbvg4d.js +1 -0
  54. package/web/{chunk-gn8kyz76.js → chunk-b3j07x0n.js} +6 -6
  55. package/web/{chunk-ff1pmd3g.js → chunk-b6sqwmq7.js} +1 -1
  56. package/web/chunk-bkxcc7v5.js +1 -0
  57. package/web/chunk-bve354k7.js +1 -0
  58. package/web/{chunk-zdyys4ar.js → chunk-cbwvfedy.js} +8 -8
  59. package/web/{chunk-eadfxfkw.js → chunk-cpshsp24.js} +1 -1
  60. package/web/chunk-cwpxakby.js +1 -0
  61. package/web/chunk-d3f763n7.js +2 -0
  62. package/web/{chunk-8z0r0wtk.js → chunk-d4519smc.js} +14 -14
  63. package/web/chunk-de29pe57.js +1 -0
  64. package/web/chunk-dk0fnj87.js +1 -0
  65. package/web/{chunk-c57f714b.js → chunk-drchr3yn.js} +2 -2
  66. package/web/chunk-dsbyfvwz.js +1 -0
  67. package/web/{chunk-3hr3ew9w.js → chunk-dtrh40vr.js} +1 -1
  68. package/web/chunk-e68jw0bg.js +1 -0
  69. package/web/{chunk-veam6vk4.js → chunk-e763h2px.js} +67 -67
  70. package/web/{chunk-nvpp0ghj.js → chunk-enryqmj7.js} +5 -5
  71. package/web/{chunk-fpb2dd2d.js → chunk-f79ajymt.js} +2 -2
  72. package/web/{chunk-qq6m2my8.js → chunk-fj753yzt.js} +2 -2
  73. package/web/{chunk-9ctg0f30.js → chunk-g0rtcedn.js} +3 -3
  74. package/web/{chunk-2x4g9t37.js → chunk-g31dbnzm.js} +4 -4
  75. package/web/{chunk-w3w18stt.js → chunk-g4as4zzd.js} +4 -4
  76. package/web/{chunk-6e87m0nm.js → chunk-gten0rpx.js} +2 -2
  77. package/web/{chunk-a0ryzdnp.js → chunk-gyhr27dm.js} +1 -1
  78. package/web/{chunk-98y92vmh.js → chunk-hjyev38w.js} +6 -6
  79. package/web/{chunk-wzd2a4k5.js → chunk-hm8thq7c.js} +4 -4
  80. package/web/{chunk-07agqp8h.js → chunk-j4gvtszc.js} +2 -2
  81. package/web/chunk-jd7npyv9.js +8 -0
  82. package/web/chunk-jhpg2kcf.js +1 -0
  83. package/web/{chunk-9fnr00kv.js → chunk-jqqbkdtw.js} +2 -2
  84. package/web/chunk-jzz5htxp.js +1 -0
  85. package/web/chunk-ka3q31t1.js +1 -0
  86. package/web/chunk-kahab58k.js +1139 -0
  87. package/web/{chunk-af9evdza.js → chunk-kfbgvh0c.js} +1 -1
  88. package/web/chunk-krgvx75q.js +1 -0
  89. package/web/chunk-kxeaj44h.js +1 -0
  90. package/web/chunk-m1rdyvb5.js +1 -0
  91. package/web/{chunk-5v2c0aqk.js → chunk-m24yb8md.js} +2 -2
  92. package/web/chunk-m7k4wr3k.js +1 -0
  93. package/web/chunk-mdj3r75b.js +1 -0
  94. package/web/{chunk-ewx42c11.js → chunk-mpdeqzc9.js} +10 -10
  95. package/web/{chunk-b5h52neg.js → chunk-mykbcvqz.js} +1 -1
  96. package/web/{chunk-7qkav30b.js → chunk-n33753da.js} +1 -1
  97. package/web/{chunk-rasjtvsb.js → chunk-nafe18y9.js} +10 -10
  98. package/web/chunk-nbcpbqq4.js +1 -0
  99. package/web/{chunk-24jhbz82.js → chunk-nhx8pw7p.js} +1 -1
  100. package/web/chunk-nkpdd9hw.js +1 -0
  101. package/web/{chunk-dwjmr0zj.js → chunk-p1yc8hwn.js} +1 -1
  102. package/web/chunk-p29brxyt.js +1 -0
  103. package/web/chunk-p8fbes0t.js +1 -0
  104. package/web/chunk-pbp1p5ex.js +1 -0
  105. package/web/{chunk-xx11yv61.js → chunk-ppjw1mps.js} +4 -4
  106. package/web/{chunk-7tkgbbf9.js → chunk-pq56b3mq.js} +2 -2
  107. package/web/{chunk-vvvd3grf.js → chunk-pzg25qqe.js} +2 -2
  108. package/web/{chunk-spbs56wz.js → chunk-q65zxczs.js} +7 -7
  109. package/web/{chunk-t893141g.js → chunk-q8v5j963.js} +2 -2
  110. package/web/{chunk-vsjpnwsr.js → chunk-qykt7avq.js} +2 -2
  111. package/web/chunk-r6q1301x.js +1 -0
  112. package/web/chunk-r8kghrkb.js +1 -0
  113. package/web/chunk-rhxn7mxg.js +1 -0
  114. package/web/{chunk-2dvbeqt0.js → chunk-rqympya7.js} +2 -2
  115. package/web/{chunk-30b33r2w.js → chunk-s0xy00v5.js} +2 -2
  116. package/web/chunk-svqshmpg.js +1 -0
  117. package/web/chunk-swzxq7r3.css +1 -0
  118. package/web/{chunk-8jcvdd5d.js → chunk-t18tn37m.js} +2 -2
  119. package/web/chunk-tbsaseer.js +1 -0
  120. package/web/{chunk-5jdrev9p.js → chunk-tggja45g.js} +3 -3
  121. package/web/chunk-tgkdyxbn.js +1 -0
  122. package/web/{chunk-rrpn5r5w.js → chunk-tpdcrrf1.js} +1 -1
  123. package/web/chunk-v0zfnvc1.js +1 -0
  124. package/web/{chunk-5a4mj3qz.js → chunk-v3dn9bfw.js} +1 -1
  125. package/web/chunk-vj31fs16.js +1 -0
  126. package/web/chunk-vr79r8vh.js +1 -0
  127. package/web/chunk-wb9tax0m.js +1 -0
  128. package/web/{chunk-rayf24gy.js → chunk-wbwets5x.js} +23 -23
  129. package/web/chunk-x9eghjjd.js +1 -0
  130. package/web/{chunk-awkdw9rw.js → chunk-xbyrgyy0.js} +2 -2
  131. package/web/{chunk-60axh4sa.js → chunk-xjc5fmcr.js} +24 -24
  132. package/web/{chunk-qh62nkem.js → chunk-ydtrc1ay.js} +2 -2
  133. package/web/chunk-yrh86m0n.js +1 -0
  134. package/web/chunk-z3ky5ews.js +2 -0
  135. package/web/{chunk-ctzkqx2g.js → chunk-zdhyq3ch.js} +13 -13
  136. package/web/{chunk-0zwc2rvh.js → chunk-zv73g4qq.js} +2 -2
  137. package/web/index.html +1 -1
  138. package/web/chunk-08sq3cwm.js +0 -1
  139. package/web/chunk-12qf1r6m.js +0 -1
  140. package/web/chunk-24fjnnee.js +0 -1
  141. package/web/chunk-2hrswh3d.js +0 -2
  142. package/web/chunk-2j2atyjw.js +0 -1
  143. package/web/chunk-3h3g3ca3.js +0 -1
  144. package/web/chunk-3pcrxg6m.js +0 -1
  145. package/web/chunk-3txxt0a7.js +0 -1
  146. package/web/chunk-43g4wd7a.js +0 -1
  147. package/web/chunk-5z2n4z9x.css +0 -1
  148. package/web/chunk-6y55gk1n.js +0 -1
  149. package/web/chunk-7qq1ypvj.js +0 -1
  150. package/web/chunk-814kkkmq.js +0 -8
  151. package/web/chunk-8w8atrdh.js +0 -1
  152. package/web/chunk-935mjq1c.js +0 -39
  153. package/web/chunk-942g3eqn.js +0 -1
  154. package/web/chunk-a61zrp66.js +0 -1
  155. package/web/chunk-arnzrqnm.js +0 -1
  156. package/web/chunk-avxk6jpc.js +0 -2
  157. package/web/chunk-bwy3e58v.js +0 -1
  158. package/web/chunk-dnv8dx72.js +0 -1
  159. package/web/chunk-f7jpakwh.js +0 -1
  160. package/web/chunk-fmthkpff.js +0 -1
  161. package/web/chunk-gv99c8zv.js +0 -1
  162. package/web/chunk-h0767tjv.js +0 -1
  163. package/web/chunk-h0c42zy3.js +0 -1
  164. package/web/chunk-hqynf99g.js +0 -1
  165. package/web/chunk-ket6g0yd.js +0 -1
  166. package/web/chunk-mbwwj216.js +0 -1
  167. package/web/chunk-me7dza1c.js +0 -1
  168. package/web/chunk-mzzaet63.js +0 -1
  169. package/web/chunk-n0wazxgz.js +0 -1
  170. package/web/chunk-nvt9tkt4.js +0 -1139
  171. package/web/chunk-ph1dgffm.js +0 -1
  172. package/web/chunk-q34as3v6.js +0 -1
  173. package/web/chunk-qz6r9v1z.js +0 -1
  174. package/web/chunk-rad2s9ha.js +0 -1
  175. package/web/chunk-s37beysw.js +0 -1
  176. package/web/chunk-s60s09mb.js +0 -1
  177. package/web/chunk-tfvcs2xx.js +0 -1
  178. package/web/chunk-tj1fn8v2.js +0 -1
  179. package/web/chunk-vqmj6peg.js +0 -1
  180. package/web/chunk-wdq2tp9e.js +0 -1
  181. package/web/chunk-wkf5xfyr.js +0 -1
  182. package/web/chunk-xa43ndfj.js +0 -2
  183. package/web/chunk-xh4xn1az.js +0 -1
  184. package/web/chunk-xzwxcxb4.js +0 -1
  185. package/web/chunk-y1qty77a.js +0 -1
  186. package/web/chunk-ys2tns0p.js +0 -1
  187. package/web/chunk-z05x9cbm.js +0 -1
  188. package/web/chunk-zgavhnt8.js +0 -1
@@ -0,0 +1,39 @@
1
+ import{G}from"./chunk-p1yc8hwn.js";import{t,a,M,F,C,S,E,T,A,L,R,l,ae,zn,Gr,V,Ge,U}from"./chunk-e763h2px.js";import{Q}from"./chunk-xjc5fmcr.js";import{xt}from"./chunk-rqympya7.js";import{Ke}from"./chunk-j4gvtszc.js";function rt(e,o){return o<e?-1:o>e?1:o>=e?0:NaN}function at(e){return e}function nt(){var e=at,o=rt,b=null,N=ae(0),g=ae(zn),h=ae(0);function s(r){var i,u=(r=Gr(r)).length,m,k,W=0,v=Array(u),c=Array(u),H=+N.apply(this,arguments),B=Math.min(zn,Math.max(-zn,g.apply(this,arguments)-H)),P,X=Math.min(Math.abs(B)/u,h.apply(this,arguments)),p=X*(B<0?-1:1),z;for(i=0;i<u;++i)if((z=c[v[i]=i]=+e(r[i],i,r))>0)W+=z;if(o!=null)v.sort(function(I,x){return o(c[I],c[x])});else if(b!=null)v.sort(function(I,x){return b(r[I],r[x])});for(i=0,k=W?(B-u*p)/W:0;i<u;++i,H=P)m=v[i],z=c[m],P=H+(z>0?z*k:0)+p,c[m]={data:r[m],index:i,value:z,startAngle:H,endAngle:P,padAngle:X};return c}return s.value=function(r){return arguments.length?(e=typeof r==="function"?r:ae(+r),s):e},s.sortValues=function(r){return arguments.length?(o=r,b=null,s):o},s.sort=function(r){return arguments.length?(b=r,o=null,s):b},s.startAngle=function(r){return arguments.length?(N=typeof r==="function"?r:ae(+r),s):N},s.endAngle=function(r){return arguments.length?(g=typeof r==="function"?r:ae(+r),s):g},s.padAngle=function(r){return arguments.length?(h=typeof r==="function"?r:ae(+r),s):h},s}var gt=M.pie,it={sections:new Map,showData:!1,config:gt},{sections:J,showData:ot}=it,St=structuredClone(gt),yt=t(()=>structuredClone(St),"getConfig"),wt=t(()=>{J=new Map,ot=it.showData,C()},"clear"),At=t(({label:e,value:o})=>{if(o<0)throw Error(`"${e}" has invalid value: ${o}. Negative values are not allowed in pie charts. All slice values must be >= 0.`);if(!J.has(e))J.set(e,o),a.debug(`added new section: ${e}, with value: ${o}`)},"addSection"),Ct=t(()=>J,"getSections"),$t=t((e)=>{ot=e},"setShowData"),Dt=t(()=>ot,"getShowData"),dt={getConfig:yt,clear:wt,setDiagramTitle:L,getDiagramTitle:R,setAccTitle:S,getAccTitle:E,setAccDescription:T,getAccDescription:A,addSection:At,getSections:Ct,setShowData:$t,getShowData:Dt},Tt=t((e,o)=>{G(e,o),o.setShowData(e.showData),e.sections.map(o.addSection)},"populateDb"),bt={parse:t(async(e)=>{let o=await Q("pie",e);a.debug(o),Tt(o,dt)},"parse")},kt=t((e)=>`
2
+ .pieCircle{
3
+ stroke: ${e.pieStrokeColor};
4
+ stroke-width : ${e.pieStrokeWidth};
5
+ opacity : ${e.pieOpacity};
6
+ }
7
+ .pieCircle.highlighted{
8
+ scale: 1.05;
9
+ opacity: 1;
10
+ }
11
+ .pieCircle.highlightedOnHover:hover{
12
+ transition-duration: 250ms;
13
+ scale: 1.05;
14
+ opacity: 1;
15
+ }
16
+ .pieOuterCircle{
17
+ stroke: ${e.pieOuterStrokeColor};
18
+ stroke-width: ${e.pieOuterStrokeWidth};
19
+ fill: none;
20
+ }
21
+ .pieTitleText {
22
+ text-anchor: middle;
23
+ font-size: ${e.pieTitleTextSize};
24
+ fill: ${e.pieTitleTextColor};
25
+ font-family: ${e.fontFamily};
26
+ }
27
+ .slice {
28
+ font-family: ${e.fontFamily};
29
+ fill: ${e.pieSectionTextColor};
30
+ font-size:${e.pieSectionTextSize};
31
+ // fill: white;
32
+ }
33
+ .legend text {
34
+ fill: ${e.pieLegendTextColor};
35
+ font-family: ${e.fontFamily};
36
+ font-size: ${e.pieLegendTextSize};
37
+ }
38
+ `,"getStyles"),zt=kt,Et=t((e)=>{let o=[...e.values()].reduce((g,h)=>g+h,0),b=[...e.entries()].map(([g,h])=>({label:g,value:h})).filter((g)=>g.value/o*100>=1);return nt().value((g)=>g.value).sort(null)(b)},"createPieArcs"),Mt=t((e,o,b,N)=>{a.debug(`rendering pie chart
39
+ `+e);let g=N.db,h=l(),s=U(g.getConfig(),h.pie),r=40,i=18,u=4,m=450,k=m,W=V(o),v=W.append("g");v.attr("transform","translate("+k/2+","+m/2+")");let{themeVariables:c}=h,[H]=Ge(c.pieOuterStrokeWidth);H??=2;let{legendPosition:B,textPosition:P}=s,X=s.donutHole>0&&s.donutHole<=0.9?s.donutHole:0,p=Math.min(k,m)/2-r,z=xt().innerRadius(X*p).outerRadius(p),I=xt().innerRadius(p*P).outerRadius(p*P),x=v.append("g");x.append("circle").attr("cx",0).attr("cy",0).attr("r",p+H/2).attr("class","pieOuterCircle");let Z=g.getSections(),pt=Et(Z),ft=[c.pie1,c.pie2,c.pie3,c.pie4,c.pie5,c.pie6,c.pie7,c.pie8,c.pie9,c.pie10,c.pie11,c.pie12],K=0;Z.forEach((n)=>{K+=n});let lt=pt.filter((n)=>(n.data.value/K*100).toFixed(0)!=="0"),Y=Ke(ft).domain([...Z.keys()]);x.selectAll("mySlices").data(lt).enter().append("path").attr("d",z).attr("fill",(n)=>Y(n.data.label)).attr("class",(n)=>{let d="pieCircle";if(s.highlightSlice==="hover")d+=" highlightedOnHover";else if(s.highlightSlice===n.data.label)d+=" highlighted";return d}),x.selectAll("mySlices").data(lt).enter().append("text").text((n)=>(n.data.value/K*100).toFixed(0)+"%").attr("transform",(n)=>"translate("+I.centroid(n)+")").style("text-anchor","middle").attr("class","slice");let ht=v.append("text").text(g.getDiagramTitle()).attr("x",0).attr("y",-(m-50)/2).attr("class","pieTitleText"),j=[...Z.entries()].map(([n,d])=>({label:n,value:d})),O=v.selectAll(".legend").data(j).enter().append("g").attr("class","legend");O.append("rect").attr("width",i).attr("height",i).style("fill",(n)=>Y(n.label)).style("stroke",(n)=>Y(n.label)),O.append("text").attr("x",i+u).attr("y",i-u).text((n)=>{if(g.getShowData())return`${n.label} [${n.value}]`;return n.label});let _=Math.max(...O.selectAll("text").nodes().map((n)=>n?.getBoundingClientRect().width??0)),q=m,tt=k+r,f=i+u,et=j.length*f;switch(B){case"center":O.attr("transform",(n,d)=>{let y=f*j.length/2,w=-_/2-(i+u),D=d*f-y;return"translate("+w+","+D+")"});break;case"top":q+=et,O.attr("transform",(n,d)=>{let y=p,w=-_/2-(i+u),D=d*f-y;return`translate(${w}, ${D})`}),x.attr("transform",()=>`translate(0, ${et+f})`);break;case"bottom":q+=et,O.attr("transform",(n,d)=>{let y=-p-f,w=-_/2-(i+u),D=d*f-y;return"translate("+w+","+D+")"});break;case"left":tt+=i+u+_,O.attr("transform",(n,d)=>{let y=f*j.length/2,w=-p-(i+u),D=d*f-y;return"translate("+w+","+D+")"}),x.attr("transform",()=>`translate(${_+i+u}, 0)`);break;case"right":default:tt+=i+u+_,O.attr("transform",(n,d)=>{let y=f*j.length/2,w=12*i,D=d*f-y;return"translate("+w+","+D+")"});break}let st=ht.node()?.getBoundingClientRect().width??0,mt=k/2-st/2,vt=k/2+st/2,ct=Math.min(0,mt),ut=Math.max(tt,vt)-ct;W.attr("viewBox",`${ct} 0 ${ut} ${q}`),F(W,q,ut,s.useMaxWidth)},"draw"),Rt={draw:Mt},Jt={parser:bt,db:dt,renderer:Rt,styles:zt};export{Jt as diagram};
@@ -1,15 +1,15 @@
1
- import{t,a,de,x,b,F,C,l,p,za,In,cn,Ua,Ar,Rr,Lr,Ir,ja,qa,Va,Wa,Ga,Ha,Ya,Za,Xa,Ka,Qa,Ja,ei,ti,ni,ri,ai,un,oi,pe,se,le,Ye,Ze,Et,yt,At,Yn,tn,Zn}from"./chunk-veam6vk4.js";import{re}from"./chunk-kcjz03h5.js";import{je}from"./chunk-5v2c0aqk.js";import{Bt}from"./chunk-avxk6jpc.js";function Te(e){return Array.isArray(e)}function Ne(e){if(In(e))return e;let o=cn(e);if(!Qe(e))return{};if(Te(e)){let i=Array.from(e);if(e.length>0&&typeof e[0]==="string"&&Object.hasOwn(e,"index"))i.index=e.index,i.input=e.input;return i}if(un(e)){let i=e;return new i.constructor(i.buffer,i.byteOffset,i.length)}if(o==="[object ArrayBuffer]")return new ArrayBuffer(e.byteLength);if(o==="[object DataView]"){let i=e,{buffer:g,byteOffset:f,byteLength:r}=i,d=new ArrayBuffer(r),w=new Uint8Array(g,f,r);return new Uint8Array(d).set(w),new DataView(d)}if(o==="[object Boolean]"||o==="[object Number]"||o==="[object String]"){let g=new e.constructor(e.valueOf());if(o==="[object String]")et(g,e);else ge(g,e);return g}if(o==="[object Date]")return new Date(Number(e));if(o==="[object RegExp]"){let i=e,g=new RegExp(i.source,i.flags);return g.lastIndex=i.lastIndex,g}if(o==="[object Symbol]")return Object(Symbol.prototype.valueOf.call(e));if(o==="[object Map]"){let i=e,g=new Map;return i.forEach((f,r)=>{g.set(r,f)}),g}if(o==="[object Set]"){let i=e,g=new Set;return i.forEach((f)=>{g.add(f)}),g}if(o==="[object Arguments]"){let i=e,g={};return ge(g,i),g.length=i.length,g[Symbol.iterator]=i[Symbol.iterator],g}let u={};return tt(u,e),ge(u,e),$e(u,e),u}function Qe(e){switch(cn(e)){case Ir:case Ga:case Ha:case Za:case Lr:case qa:case ri:case ai:case ei:case ti:case ni:case Va:case Rr:case Ya:case Ua:case Wa:case Ar:case ja:case Xa:case Ka:case Qa:case Ja:return!0;default:return!1}}function ge(e,o){for(let u in o)if(Object.hasOwn(o,u))e[u]=o[u]}function $e(e,o){let u=Object.getOwnPropertySymbols(o);for(let i=0;i<u.length;i++){let g=u[i];if(Object.prototype.propertyIsEnumerable.call(o,g))e[g]=o[g]}}function et(e,o){let u=o.valueOf().length;for(let i in o)if(Object.hasOwn(o,i)&&(Number.isNaN(Number(i))||Number(i)>=u))e[i]=o[i]}function tt(e,o){let u=Object.getPrototypeOf(o);if(u!==null){if(typeof o.constructor==="function")Object.setPrototypeOf(e,u)}}var be=function(){var e=t(function(B,S,n,h){for(n=n||{},h=B.length;h--;n[B[h]]=S);return n},"o"),o=[1,15],u=[1,7],i=[1,13],g=[1,14],f=[1,19],r=[1,16],d=[1,17],w=[1,18],E=[8,30],k=[8,10,21,28,29,30,31,39,43,46],L=[1,23],_=[1,24],T=[8,10,15,16,21,28,29,30,31,39,43,46],y=[8,10,15,16,21,27,28,29,30,31,39,43,46],I=[1,49],N={trace:t(function(){},"trace"),yy:{},symbols_:{error:2,spaceLines:3,SPACELINE:4,NL:5,separator:6,SPACE:7,EOF:8,start:9,BLOCK_DIAGRAM_KEY:10,document:11,stop:12,statement:13,link:14,LINK:15,START_LINK:16,LINK_LABEL:17,STR:18,nodeStatement:19,columnsStatement:20,SPACE_BLOCK:21,blockStatement:22,classDefStatement:23,cssClassStatement:24,styleStatement:25,node:26,SIZE:27,COLUMNS:28,"id-block":29,end:30,NODE_ID:31,nodeShapeNLabel:32,dirList:33,DIR:34,NODE_DSTART:35,NODE_DEND:36,BLOCK_ARROW_START:37,BLOCK_ARROW_END:38,classDef:39,CLASSDEF_ID:40,CLASSDEF_STYLEOPTS:41,DEFAULT:42,class:43,CLASSENTITY_IDS:44,STYLECLASS:45,style:46,STYLE_ENTITY_IDS:47,STYLE_DEFINITION_DATA:48,$accept:0,$end:1},terminals_:{2:"error",4:"SPACELINE",5:"NL",7:"SPACE",8:"EOF",10:"BLOCK_DIAGRAM_KEY",15:"LINK",16:"START_LINK",17:"LINK_LABEL",18:"STR",21:"SPACE_BLOCK",27:"SIZE",28:"COLUMNS",29:"id-block",30:"end",31:"NODE_ID",34:"DIR",35:"NODE_DSTART",36:"NODE_DEND",37:"BLOCK_ARROW_START",38:"BLOCK_ARROW_END",39:"classDef",40:"CLASSDEF_ID",41:"CLASSDEF_STYLEOPTS",42:"DEFAULT",43:"class",44:"CLASSENTITY_IDS",45:"STYLECLASS",46:"style",47:"STYLE_ENTITY_IDS",48:"STYLE_DEFINITION_DATA"},productions_:[0,[3,1],[3,2],[3,2],[6,1],[6,1],[6,1],[9,3],[12,1],[12,1],[12,2],[12,2],[11,1],[11,2],[14,1],[14,4],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[19,3],[19,2],[19,1],[20,1],[22,4],[22,3],[26,1],[26,2],[33,1],[33,2],[32,3],[32,4],[23,3],[23,3],[24,3],[25,3]],performAction:t(function(S,n,h,m,D,s,H){var c=s.length-1;switch(D){case 4:m.getLogger().debug("Rule: separator (NL) ");break;case 5:m.getLogger().debug("Rule: separator (Space) ");break;case 6:m.getLogger().debug("Rule: separator (EOF) ");break;case 7:m.getLogger().debug("Rule: hierarchy: ",s[c-1]),m.setHierarchy(s[c-1]);break;case 8:m.getLogger().debug("Stop NL ");break;case 9:m.getLogger().debug("Stop EOF ");break;case 10:m.getLogger().debug("Stop NL2 ");break;case 11:m.getLogger().debug("Stop EOF2 ");break;case 12:m.getLogger().debug("Rule: statement: ",s[c]),typeof s[c].length==="number"?this.$=s[c]:this.$=[s[c]];break;case 13:m.getLogger().debug("Rule: statement #2: ",s[c-1]),this.$=[s[c-1]].concat(s[c]);break;case 14:m.getLogger().debug("Rule: link: ",s[c],S),this.$={edgeTypeStr:s[c],label:""};break;case 15:m.getLogger().debug("Rule: LABEL link: ",s[c-3],s[c-1],s[c]),this.$={edgeTypeStr:s[c],label:s[c-1]};break;case 18:let V=parseInt(s[c]),j=m.generateId();this.$={id:j,type:"space",label:"",width:V,children:[]};break;case 23:m.getLogger().debug("Rule: (nodeStatement link node) ",s[c-2],s[c-1],s[c]," typestr: ",s[c-1].edgeTypeStr);let G=m.edgeStrToEdgeData(s[c-1].edgeTypeStr),ie=m.edgeStrToEdgeStartData(s[c-1].edgeTypeStr),q=m.edgeStrToThickness(s[c-1].edgeTypeStr),ae=m.edgeStrToPattern(s[c-1].edgeTypeStr);this.$=[{id:s[c-2].id,label:s[c-2].label,type:s[c-2].type,directions:s[c-2].directions},{id:s[c-2].id+"-"+s[c].id,start:s[c-2].id,end:s[c].id,label:s[c-1].label,type:"edge",thickness:q,pattern:ae,directions:s[c].directions,arrowTypeEnd:G,arrowTypeStart:ie},{id:s[c].id,label:s[c].label,type:m.typeStr2Type(s[c].typeStr),directions:s[c].directions}];break;case 24:m.getLogger().debug("Rule: nodeStatement (abc88 node size) ",s[c-1],s[c]),this.$={id:s[c-1].id,label:s[c-1].label,type:m.typeStr2Type(s[c-1].typeStr),directions:s[c-1].directions,widthInColumns:parseInt(s[c],10)};break;case 25:m.getLogger().debug("Rule: nodeStatement (node) ",s[c]),this.$={id:s[c].id,label:s[c].label,type:m.typeStr2Type(s[c].typeStr),directions:s[c].directions,widthInColumns:1};break;case 26:m.getLogger().debug("APA123",this?this:"na"),m.getLogger().debug("COLUMNS: ",s[c]),this.$={type:"column-setting",columns:s[c]==="auto"?-1:parseInt(s[c])};break;case 27:m.getLogger().debug("Rule: id-block statement : ",s[c-2],s[c-1]);let O=m.generateId();this.$={...s[c-2],type:"composite",children:s[c-1]};break;case 28:m.getLogger().debug("Rule: blockStatement : ",s[c-2],s[c-1],s[c]);let K=m.generateId();this.$={id:K,type:"composite",label:"",children:s[c-1]};break;case 29:m.getLogger().debug("Rule: node (NODE_ID separator): ",s[c]),this.$={id:s[c]};break;case 30:m.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",s[c-1],s[c]),this.$={id:s[c-1],label:s[c].label,typeStr:s[c].typeStr,directions:s[c].directions};break;case 31:m.getLogger().debug("Rule: dirList: ",s[c]),this.$=[s[c]];break;case 32:m.getLogger().debug("Rule: dirList: ",s[c-1],s[c]),this.$=[s[c-1]].concat(s[c]);break;case 33:m.getLogger().debug("Rule: nodeShapeNLabel: ",s[c-2],s[c-1],s[c]),this.$={typeStr:s[c-2]+s[c],label:s[c-1]};break;case 34:m.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",s[c-3],s[c-2]," #3:",s[c-1],s[c]),this.$={typeStr:s[c-3]+s[c],label:s[c-2],directions:s[c-1]};break;case 35:case 36:this.$={type:"classDef",id:s[c-1].trim(),css:s[c].trim()};break;case 37:this.$={type:"applyClass",id:s[c-1].trim(),styleClass:s[c].trim()};break;case 38:this.$={type:"applyStyles",id:s[c-1].trim(),stylesStr:s[c].trim()};break}},"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{10:o,11:3,13:4,19:5,20:6,21:u,22:8,23:9,24:10,25:11,26:12,28:i,29:g,31:f,39:r,43:d,46:w},{8:[1,20]},e(E,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,10:o,21:u,28:i,29:g,31:f,39:r,43:d,46:w}),e(k,[2,16],{14:22,15:L,16:_}),e(k,[2,17]),e(k,[2,18]),e(k,[2,19]),e(k,[2,20]),e(k,[2,21]),e(k,[2,22]),e(T,[2,25],{27:[1,25]}),e(k,[2,26]),{19:26,26:12,31:f},{10:o,11:27,13:4,19:5,20:6,21:u,22:8,23:9,24:10,25:11,26:12,28:i,29:g,31:f,39:r,43:d,46:w},{40:[1,28],42:[1,29]},{44:[1,30]},{47:[1,31]},e(y,[2,29],{32:32,35:[1,33],37:[1,34]}),{1:[2,7]},e(E,[2,13]),{26:35,31:f},{31:[2,14]},{17:[1,36]},e(T,[2,24]),{10:o,11:37,13:4,14:22,15:L,16:_,19:5,20:6,21:u,22:8,23:9,24:10,25:11,26:12,28:i,29:g,31:f,39:r,43:d,46:w},{30:[1,38]},{41:[1,39]},{41:[1,40]},{45:[1,41]},{48:[1,42]},e(y,[2,30]),{18:[1,43]},{18:[1,44]},e(T,[2,23]),{18:[1,45]},{30:[1,46]},e(k,[2,28]),e(k,[2,35]),e(k,[2,36]),e(k,[2,37]),e(k,[2,38]),{36:[1,47]},{33:48,34:I},{15:[1,50]},e(k,[2,27]),e(y,[2,33]),{38:[1,51]},{33:52,34:I,38:[2,31]},{31:[2,15]},e(y,[2,34]),{38:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:t(function(S,n){if(n.recoverable)this.trace(S);else{var h=Error(S);throw h.hash=n,h}},"parseError"),parse:t(function(S){var n=this,h=[0],m=[],D=[null],s=[],H=this.table,c="",V=0,j=0,G=0,ie=2,q=1,ae=s.slice.call(arguments,1),O=Object.create(this.lexer),K={yy:{}};for(var ne in this.yy)if(Object.prototype.hasOwnProperty.call(this.yy,ne))K.yy[ne]=this.yy[ne];if(O.setInput(S,K.yy),K.yy.lexer=O,K.yy.parser=this,typeof O.yylloc>"u")O.yylloc={};var oe=O.yylloc;s.push(oe);var qe=O.options&&O.options.ranges;if(typeof K.yy.parseError==="function")this.parseError=K.yy.parseError;else this.parseError=Object.getPrototypeOf(this).parseError;function Je(P){h.length=h.length-2*P,D.length=D.length-P,s.length=s.length-P}t(Je,"popStack");function _e(){var P=m.pop()||O.lex()||q;if(typeof P!=="number"){if(P instanceof Array)m=P,P=m.pop();P=n.symbols_[P]||P}return P}t(_e,"lex");var A,ce,W,R,vt,ue,U={},J,Y,De,Z;while(!0){if(W=h[h.length-1],this.defaultActions[W])R=this.defaultActions[W];else{if(A===null||typeof A>"u")A=_e();R=H[W]&&H[W][A]}if(typeof R>"u"||!R.length||!R[0]){var he="";Z=[];for(J in H[W])if(this.terminals_[J]&&J>ie)Z.push("'"+this.terminals_[J]+"'");if(O.showPosition)he="Parse error on line "+(V+1)+`:
1
+ import{t,a,de,x,b,F,C,l,p,Ba,Rn,sn,Fa,Tr,Er,Ar,Rr,za,Ua,ja,qa,Va,Wa,Ga,Ha,Ya,Za,Xa,Ka,Qa,Ja,ei,ti,ni,ln,ai,pe,se,le,Ze,Xe,Tt,bt,Et,Gn,Jt,Hn}from"./chunk-e763h2px.js";import{re}from"./chunk-4rwwtfnd.js";import{qe}from"./chunk-m24yb8md.js";import{$t}from"./chunk-3d3wnh8a.js";function Te(e){return Array.isArray(e)}function Ne(e){if(Rn(e))return e;let o=sn(e);if(!Qe(e))return{};if(Te(e)){let i=Array.from(e);if(e.length>0&&typeof e[0]==="string"&&Object.hasOwn(e,"index"))i.index=e.index,i.input=e.input;return i}if(ln(e)){let i=e;return new i.constructor(i.buffer,i.byteOffset,i.length)}if(o==="[object ArrayBuffer]")return new ArrayBuffer(e.byteLength);if(o==="[object DataView]"){let i=e,{buffer:g,byteOffset:f,byteLength:r}=i,d=new ArrayBuffer(r),w=new Uint8Array(g,f,r);return new Uint8Array(d).set(w),new DataView(d)}if(o==="[object Boolean]"||o==="[object Number]"||o==="[object String]"){let g=new e.constructor(e.valueOf());if(o==="[object String]")et(g,e);else ge(g,e);return g}if(o==="[object Date]")return new Date(Number(e));if(o==="[object RegExp]"){let i=e,g=new RegExp(i.source,i.flags);return g.lastIndex=i.lastIndex,g}if(o==="[object Symbol]")return Object(Symbol.prototype.valueOf.call(e));if(o==="[object Map]"){let i=e,g=new Map;return i.forEach((f,r)=>{g.set(r,f)}),g}if(o==="[object Set]"){let i=e,g=new Set;return i.forEach((f)=>{g.add(f)}),g}if(o==="[object Arguments]"){let i=e,g={};return ge(g,i),g.length=i.length,g[Symbol.iterator]=i[Symbol.iterator],g}let u={};return tt(u,e),ge(u,e),$e(u,e),u}function Qe(e){switch(sn(e)){case Rr:case Va:case Wa:case Ha:case Ar:case Ua:case ti:case ni:case Qa:case Ja:case ei:case ja:case Er:case Ga:case Fa:case qa:case Tr:case za:case Ya:case Za:case Xa:case Ka:return!0;default:return!1}}function ge(e,o){for(let u in o)if(Object.hasOwn(o,u))e[u]=o[u]}function $e(e,o){let u=Object.getOwnPropertySymbols(o);for(let i=0;i<u.length;i++){let g=u[i];if(Object.prototype.propertyIsEnumerable.call(o,g))e[g]=o[g]}}function et(e,o){let u=o.valueOf().length;for(let i in o)if(Object.hasOwn(o,i)&&(Number.isNaN(Number(i))||Number(i)>=u))e[i]=o[i]}function tt(e,o){let u=Object.getPrototypeOf(o);if(u!==null){if(typeof o.constructor==="function")Object.setPrototypeOf(e,u)}}var be=function(){var e=t(function(B,S,n,h){for(n=n||{},h=B.length;h--;n[B[h]]=S);return n},"o"),o=[1,15],u=[1,7],i=[1,13],g=[1,14],f=[1,19],r=[1,16],d=[1,17],w=[1,18],E=[8,30],k=[8,10,21,28,29,30,31,39,43,46],L=[1,23],_=[1,24],T=[8,10,15,16,21,28,29,30,31,39,43,46],y=[8,10,15,16,21,27,28,29,30,31,39,43,46],I=[1,49],N={trace:t(function(){},"trace"),yy:{},symbols_:{error:2,spaceLines:3,SPACELINE:4,NL:5,separator:6,SPACE:7,EOF:8,start:9,BLOCK_DIAGRAM_KEY:10,document:11,stop:12,statement:13,link:14,LINK:15,START_LINK:16,LINK_LABEL:17,STR:18,nodeStatement:19,columnsStatement:20,SPACE_BLOCK:21,blockStatement:22,classDefStatement:23,cssClassStatement:24,styleStatement:25,node:26,SIZE:27,COLUMNS:28,"id-block":29,end:30,NODE_ID:31,nodeShapeNLabel:32,dirList:33,DIR:34,NODE_DSTART:35,NODE_DEND:36,BLOCK_ARROW_START:37,BLOCK_ARROW_END:38,classDef:39,CLASSDEF_ID:40,CLASSDEF_STYLEOPTS:41,DEFAULT:42,class:43,CLASSENTITY_IDS:44,STYLECLASS:45,style:46,STYLE_ENTITY_IDS:47,STYLE_DEFINITION_DATA:48,$accept:0,$end:1},terminals_:{2:"error",4:"SPACELINE",5:"NL",7:"SPACE",8:"EOF",10:"BLOCK_DIAGRAM_KEY",15:"LINK",16:"START_LINK",17:"LINK_LABEL",18:"STR",21:"SPACE_BLOCK",27:"SIZE",28:"COLUMNS",29:"id-block",30:"end",31:"NODE_ID",34:"DIR",35:"NODE_DSTART",36:"NODE_DEND",37:"BLOCK_ARROW_START",38:"BLOCK_ARROW_END",39:"classDef",40:"CLASSDEF_ID",41:"CLASSDEF_STYLEOPTS",42:"DEFAULT",43:"class",44:"CLASSENTITY_IDS",45:"STYLECLASS",46:"style",47:"STYLE_ENTITY_IDS",48:"STYLE_DEFINITION_DATA"},productions_:[0,[3,1],[3,2],[3,2],[6,1],[6,1],[6,1],[9,3],[12,1],[12,1],[12,2],[12,2],[11,1],[11,2],[14,1],[14,4],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[19,3],[19,2],[19,1],[20,1],[22,4],[22,3],[26,1],[26,2],[33,1],[33,2],[32,3],[32,4],[23,3],[23,3],[24,3],[25,3]],performAction:t(function(S,n,h,m,D,s,H){var c=s.length-1;switch(D){case 4:m.getLogger().debug("Rule: separator (NL) ");break;case 5:m.getLogger().debug("Rule: separator (Space) ");break;case 6:m.getLogger().debug("Rule: separator (EOF) ");break;case 7:m.getLogger().debug("Rule: hierarchy: ",s[c-1]),m.setHierarchy(s[c-1]);break;case 8:m.getLogger().debug("Stop NL ");break;case 9:m.getLogger().debug("Stop EOF ");break;case 10:m.getLogger().debug("Stop NL2 ");break;case 11:m.getLogger().debug("Stop EOF2 ");break;case 12:m.getLogger().debug("Rule: statement: ",s[c]),typeof s[c].length==="number"?this.$=s[c]:this.$=[s[c]];break;case 13:m.getLogger().debug("Rule: statement #2: ",s[c-1]),this.$=[s[c-1]].concat(s[c]);break;case 14:m.getLogger().debug("Rule: link: ",s[c],S),this.$={edgeTypeStr:s[c],label:""};break;case 15:m.getLogger().debug("Rule: LABEL link: ",s[c-3],s[c-1],s[c]),this.$={edgeTypeStr:s[c],label:s[c-1]};break;case 18:let V=parseInt(s[c]),j=m.generateId();this.$={id:j,type:"space",label:"",width:V,children:[]};break;case 23:m.getLogger().debug("Rule: (nodeStatement link node) ",s[c-2],s[c-1],s[c]," typestr: ",s[c-1].edgeTypeStr);let G=m.edgeStrToEdgeData(s[c-1].edgeTypeStr),ie=m.edgeStrToEdgeStartData(s[c-1].edgeTypeStr),q=m.edgeStrToThickness(s[c-1].edgeTypeStr),ae=m.edgeStrToPattern(s[c-1].edgeTypeStr);this.$=[{id:s[c-2].id,label:s[c-2].label,type:s[c-2].type,directions:s[c-2].directions},{id:s[c-2].id+"-"+s[c].id,start:s[c-2].id,end:s[c].id,label:s[c-1].label,type:"edge",thickness:q,pattern:ae,directions:s[c].directions,arrowTypeEnd:G,arrowTypeStart:ie},{id:s[c].id,label:s[c].label,type:m.typeStr2Type(s[c].typeStr),directions:s[c].directions}];break;case 24:m.getLogger().debug("Rule: nodeStatement (abc88 node size) ",s[c-1],s[c]),this.$={id:s[c-1].id,label:s[c-1].label,type:m.typeStr2Type(s[c-1].typeStr),directions:s[c-1].directions,widthInColumns:parseInt(s[c],10)};break;case 25:m.getLogger().debug("Rule: nodeStatement (node) ",s[c]),this.$={id:s[c].id,label:s[c].label,type:m.typeStr2Type(s[c].typeStr),directions:s[c].directions,widthInColumns:1};break;case 26:m.getLogger().debug("APA123",this?this:"na"),m.getLogger().debug("COLUMNS: ",s[c]),this.$={type:"column-setting",columns:s[c]==="auto"?-1:parseInt(s[c])};break;case 27:m.getLogger().debug("Rule: id-block statement : ",s[c-2],s[c-1]);let O=m.generateId();this.$={...s[c-2],type:"composite",children:s[c-1]};break;case 28:m.getLogger().debug("Rule: blockStatement : ",s[c-2],s[c-1],s[c]);let K=m.generateId();this.$={id:K,type:"composite",label:"",children:s[c-1]};break;case 29:m.getLogger().debug("Rule: node (NODE_ID separator): ",s[c]),this.$={id:s[c]};break;case 30:m.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",s[c-1],s[c]),this.$={id:s[c-1],label:s[c].label,typeStr:s[c].typeStr,directions:s[c].directions};break;case 31:m.getLogger().debug("Rule: dirList: ",s[c]),this.$=[s[c]];break;case 32:m.getLogger().debug("Rule: dirList: ",s[c-1],s[c]),this.$=[s[c-1]].concat(s[c]);break;case 33:m.getLogger().debug("Rule: nodeShapeNLabel: ",s[c-2],s[c-1],s[c]),this.$={typeStr:s[c-2]+s[c],label:s[c-1]};break;case 34:m.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",s[c-3],s[c-2]," #3:",s[c-1],s[c]),this.$={typeStr:s[c-3]+s[c],label:s[c-2],directions:s[c-1]};break;case 35:case 36:this.$={type:"classDef",id:s[c-1].trim(),css:s[c].trim()};break;case 37:this.$={type:"applyClass",id:s[c-1].trim(),styleClass:s[c].trim()};break;case 38:this.$={type:"applyStyles",id:s[c-1].trim(),stylesStr:s[c].trim()};break}},"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{10:o,11:3,13:4,19:5,20:6,21:u,22:8,23:9,24:10,25:11,26:12,28:i,29:g,31:f,39:r,43:d,46:w},{8:[1,20]},e(E,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,10:o,21:u,28:i,29:g,31:f,39:r,43:d,46:w}),e(k,[2,16],{14:22,15:L,16:_}),e(k,[2,17]),e(k,[2,18]),e(k,[2,19]),e(k,[2,20]),e(k,[2,21]),e(k,[2,22]),e(T,[2,25],{27:[1,25]}),e(k,[2,26]),{19:26,26:12,31:f},{10:o,11:27,13:4,19:5,20:6,21:u,22:8,23:9,24:10,25:11,26:12,28:i,29:g,31:f,39:r,43:d,46:w},{40:[1,28],42:[1,29]},{44:[1,30]},{47:[1,31]},e(y,[2,29],{32:32,35:[1,33],37:[1,34]}),{1:[2,7]},e(E,[2,13]),{26:35,31:f},{31:[2,14]},{17:[1,36]},e(T,[2,24]),{10:o,11:37,13:4,14:22,15:L,16:_,19:5,20:6,21:u,22:8,23:9,24:10,25:11,26:12,28:i,29:g,31:f,39:r,43:d,46:w},{30:[1,38]},{41:[1,39]},{41:[1,40]},{45:[1,41]},{48:[1,42]},e(y,[2,30]),{18:[1,43]},{18:[1,44]},e(T,[2,23]),{18:[1,45]},{30:[1,46]},e(k,[2,28]),e(k,[2,35]),e(k,[2,36]),e(k,[2,37]),e(k,[2,38]),{36:[1,47]},{33:48,34:I},{15:[1,50]},e(k,[2,27]),e(y,[2,33]),{38:[1,51]},{33:52,34:I,38:[2,31]},{31:[2,15]},e(y,[2,34]),{38:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:t(function(S,n){if(n.recoverable)this.trace(S);else{var h=Error(S);throw h.hash=n,h}},"parseError"),parse:t(function(S){var n=this,h=[0],m=[],D=[null],s=[],H=this.table,c="",V=0,j=0,G=0,ie=2,q=1,ae=s.slice.call(arguments,1),O=Object.create(this.lexer),K={yy:{}};for(var ne in this.yy)if(Object.prototype.hasOwnProperty.call(this.yy,ne))K.yy[ne]=this.yy[ne];if(O.setInput(S,K.yy),K.yy.lexer=O,K.yy.parser=this,typeof O.yylloc>"u")O.yylloc={};var oe=O.yylloc;s.push(oe);var Ge=O.options&&O.options.ranges;if(typeof K.yy.parseError==="function")this.parseError=K.yy.parseError;else this.parseError=Object.getPrototypeOf(this).parseError;function Je(P){h.length=h.length-2*P,D.length=D.length-P,s.length=s.length-P}t(Je,"popStack");function _e(){var P=m.pop()||O.lex()||q;if(typeof P!=="number"){if(P instanceof Array)m=P,P=m.pop();P=n.symbols_[P]||P}return P}t(_e,"lex");var A,ce,W,R,At,ue,U={},J,Y,De,Z;while(!0){if(W=h[h.length-1],this.defaultActions[W])R=this.defaultActions[W];else{if(A===null||typeof A>"u")A=_e();R=H[W]&&H[W][A]}if(typeof R>"u"||!R.length||!R[0]){var he="";Z=[];for(J in H[W])if(this.terminals_[J]&&J>ie)Z.push("'"+this.terminals_[J]+"'");if(O.showPosition)he="Parse error on line "+(V+1)+`:
2
2
  `+O.showPosition()+`
3
- Expecting `+Z.join(", ")+", got '"+(this.terminals_[A]||A)+"'";else he="Parse error on line "+(V+1)+": Unexpected "+(A==q?"end of input":"'"+(this.terminals_[A]||A)+"'");this.parseError(he,{text:O.match,token:this.terminals_[A]||A,line:O.yylineno,loc:oe,expected:Z})}if(R[0]instanceof Array&&R.length>1)throw Error("Parse Error: multiple actions possible at state: "+W+", token: "+A);switch(R[0]){case 1:if(h.push(A),D.push(O.yytext),s.push(O.yylloc),h.push(R[1]),A=null,!ce){if(j=O.yyleng,c=O.yytext,V=O.yylineno,oe=O.yylloc,G>0)G--}else A=ce,ce=null;break;case 2:if(Y=this.productions_[R[1]][1],U.$=D[D.length-Y],U._$={first_line:s[s.length-(Y||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-(Y||1)].first_column,last_column:s[s.length-1].last_column},qe)U._$.range=[s[s.length-(Y||1)].range[0],s[s.length-1].range[1]];if(ue=this.performAction.apply(U,[c,j,V,K.yy,R[1],D,s].concat(ae)),typeof ue<"u")return ue;if(Y)h=h.slice(0,-1*Y*2),D=D.slice(0,-1*Y),s=s.slice(0,-1*Y);h.push(this.productions_[R[1]][0]),D.push(U.$),s.push(U._$),De=H[h[h.length-2]][h[h.length-1]],h.push(De);break;case 3:return!0}}return!0},"parse")},v=function(){var B={EOF:1,parseError:t(function(n,h){if(this.yy.parser)this.yy.parser.parseError(n,h);else throw Error(n)},"parseError"),setInput:t(function(S,n){if(this.yy=n||this.yy||{},this._input=S,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:t(function(){var S=this._input[0];this.yytext+=S,this.yyleng++,this.offset++,this.match+=S,this.matched+=S;var n=S.match(/(?:\r\n?|\n).*/g);if(n)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),S},"input"),unput:t(function(S){var n=S.length,h=S.split(/(?:\r\n?|\n)/g);this._input=S+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var m=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),h.length-1)this.yylineno-=h.length-1;var D=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:h?(h.length===m.length?this.yylloc.first_column:0)+m[m.length-h.length].length-h[0].length:this.yylloc.first_column-n},this.options.ranges)this.yylloc.range=[D[0],D[0]+this.yyleng-n];return this.yyleng=this.yytext.length,this},"unput"),more:t(function(){return this._more=!0,this},"more"),reject:t(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).
3
+ Expecting `+Z.join(", ")+", got '"+(this.terminals_[A]||A)+"'";else he="Parse error on line "+(V+1)+": Unexpected "+(A==q?"end of input":"'"+(this.terminals_[A]||A)+"'");this.parseError(he,{text:O.match,token:this.terminals_[A]||A,line:O.yylineno,loc:oe,expected:Z})}if(R[0]instanceof Array&&R.length>1)throw Error("Parse Error: multiple actions possible at state: "+W+", token: "+A);switch(R[0]){case 1:if(h.push(A),D.push(O.yytext),s.push(O.yylloc),h.push(R[1]),A=null,!ce){if(j=O.yyleng,c=O.yytext,V=O.yylineno,oe=O.yylloc,G>0)G--}else A=ce,ce=null;break;case 2:if(Y=this.productions_[R[1]][1],U.$=D[D.length-Y],U._$={first_line:s[s.length-(Y||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-(Y||1)].first_column,last_column:s[s.length-1].last_column},Ge)U._$.range=[s[s.length-(Y||1)].range[0],s[s.length-1].range[1]];if(ue=this.performAction.apply(U,[c,j,V,K.yy,R[1],D,s].concat(ae)),typeof ue<"u")return ue;if(Y)h=h.slice(0,-1*Y*2),D=D.slice(0,-1*Y),s=s.slice(0,-1*Y);h.push(this.productions_[R[1]][0]),D.push(U.$),s.push(U._$),De=H[h[h.length-2]][h[h.length-1]],h.push(De);break;case 3:return!0}}return!0},"parse")},v=function(){var B={EOF:1,parseError:t(function(n,h){if(this.yy.parser)this.yy.parser.parseError(n,h);else throw Error(n)},"parseError"),setInput:t(function(S,n){if(this.yy=n||this.yy||{},this._input=S,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:t(function(){var S=this._input[0];this.yytext+=S,this.yyleng++,this.offset++,this.match+=S,this.matched+=S;var n=S.match(/(?:\r\n?|\n).*/g);if(n)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),S},"input"),unput:t(function(S){var n=S.length,h=S.split(/(?:\r\n?|\n)/g);this._input=S+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var m=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),h.length-1)this.yylineno-=h.length-1;var D=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:h?(h.length===m.length?this.yylloc.first_column:0)+m[m.length-h.length].length-h[0].length:this.yylloc.first_column-n},this.options.ranges)this.yylloc.range=[D[0],D[0]+this.yyleng-n];return this.yyleng=this.yytext.length,this},"unput"),more:t(function(){return this._more=!0,this},"more"),reject:t(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).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:t(function(S){this.unput(this.match.slice(S))},"less"),pastInput:t(function(){var S=this.matched.substr(0,this.matched.length-this.match.length);return(S.length>20?"...":"")+S.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:t(function(){var S=this.match;if(S.length<20)S+=this._input.substr(0,20-S.length);return(S.substr(0,20)+(S.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:t(function(){var S=this.pastInput(),n=Array(S.length+1).join("-");return S+this.upcomingInput()+`
5
5
  `+n+"^"},"showPosition"),test_match:t(function(S,n){var h,m,D;if(this.options.backtrack_lexer){if(D={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)D.yylloc.range=this.yylloc.range.slice(0)}if(m=S[0].match(/(?:\r\n?|\n).*/g),m)this.yylineno+=m.length;if(this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:m?m[m.length-1].length-m[m.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+S[0].length},this.yytext+=S[0],this.match+=S[0],this.matches=S,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(S[0].length),this.matched+=S[0],h=this.performAction.call(this,this.yy,this,n,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input)this.done=!1;if(h)return h;else if(this._backtrack){for(var s in D)this[s]=D[s];return!1}return!1},"test_match"),next:t(function(){if(this.done)return this.EOF;if(!this._input)this.done=!0;var S,n,h,m;if(!this._more)this.yytext="",this.match="";var D=this._currentRules();for(var s=0;s<D.length;s++)if(h=this._input.match(this.rules[D[s]]),h&&(!n||h[0].length>n[0].length)){if(n=h,m=s,this.options.backtrack_lexer)if(S=this.test_match(h,D[s]),S!==!1)return S;else if(this._backtrack){n=!1;continue}else return!1;else if(!this.options.flex)break}if(n){if(S=this.test_match(n,D[m]),S!==!1)return S;return!1}if(this._input==="")return this.EOF;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
6
- `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:t(function(){var n=this.next();if(n)return n;else return this.lex()},"lex"),begin:t(function(n){this.conditionStack.push(n)},"begin"),popState:t(function(){var n=this.conditionStack.length-1;if(n>0)return this.conditionStack.pop();else return this.conditionStack[0]},"popState"),_currentRules:t(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:t(function(n){if(n=this.conditionStack.length-1-Math.abs(n||0),n>=0)return this.conditionStack[n];else return"INITIAL"},"topState"),pushState:t(function(n){this.begin(n)},"pushState"),stateStackSize:t(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:t(function(n,h,m,D){var s=D;switch(m){case 0:return n.getLogger().debug("Found block-beta"),10;break;case 1:return n.getLogger().debug("Found id-block"),29;break;case 2:return n.getLogger().debug("Found block"),10;break;case 3:n.getLogger().debug(".",h.yytext);break;case 4:n.getLogger().debug("_",h.yytext);break;case 5:return 5;case 6:return h.yytext=-1,28;break;case 7:return h.yytext=h.yytext.replace(/columns\s+/,""),n.getLogger().debug("COLUMNS (LEX)",h.yytext),28;break;case 8:this.pushState("md_string");break;case 9:return"MD_STR";case 10:this.popState();break;case 11:this.pushState("string");break;case 12:n.getLogger().debug("LEX: POPPING STR:",h.yytext),this.popState();break;case 13:return n.getLogger().debug("LEX: STR end:",h.yytext),"STR";break;case 14:return h.yytext=h.yytext.replace(/space\:/,""),n.getLogger().debug("SPACE NUM (LEX)",h.yytext),21;break;case 15:return h.yytext="1",n.getLogger().debug("COLUMNS (LEX)",h.yytext),21;break;case 16:return 42;case 17:return"LINKSTYLE";case 18:return"INTERPOLATE";case 19:return this.pushState("CLASSDEF"),39;break;case 20:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";break;case 21:return this.popState(),this.pushState("CLASSDEFID"),40;break;case 22:return this.popState(),41;break;case 23:return this.pushState("CLASS"),43;break;case 24:return this.popState(),this.pushState("CLASS_STYLE"),44;break;case 25:return this.popState(),45;break;case 26:return this.pushState("STYLE_STMNT"),46;break;case 27:return this.popState(),this.pushState("STYLE_DEFINITION"),47;break;case 28:return this.popState(),48;break;case 29:return this.pushState("acc_title"),"acc_title";break;case 30:return this.popState(),"acc_title_value";break;case 31:return this.pushState("acc_descr"),"acc_descr";break;case 32:return this.popState(),"acc_descr_value";break;case 33:this.pushState("acc_descr_multiline");break;case 34:this.popState();break;case 35:return"acc_descr_multiline_value";case 36:return 30;case 37:return this.popState(),n.getLogger().debug("Lex: (("),"NODE_DEND";break;case 38:return this.popState(),n.getLogger().debug("Lex: (("),"NODE_DEND";break;case 39:return this.popState(),n.getLogger().debug("Lex: ))"),"NODE_DEND";break;case 40:return this.popState(),n.getLogger().debug("Lex: (("),"NODE_DEND";break;case 41:return this.popState(),n.getLogger().debug("Lex: (("),"NODE_DEND";break;case 42:return this.popState(),n.getLogger().debug("Lex: (-"),"NODE_DEND";break;case 43:return this.popState(),n.getLogger().debug("Lex: -)"),"NODE_DEND";break;case 44:return this.popState(),n.getLogger().debug("Lex: (("),"NODE_DEND";break;case 45:return this.popState(),n.getLogger().debug("Lex: ]]"),"NODE_DEND";break;case 46:return this.popState(),n.getLogger().debug("Lex: ("),"NODE_DEND";break;case 47:return this.popState(),n.getLogger().debug("Lex: ])"),"NODE_DEND";break;case 48:return this.popState(),n.getLogger().debug("Lex: /]"),"NODE_DEND";break;case 49:return this.popState(),n.getLogger().debug("Lex: /]"),"NODE_DEND";break;case 50:return this.popState(),n.getLogger().debug("Lex: )]"),"NODE_DEND";break;case 51:return this.popState(),n.getLogger().debug("Lex: )"),"NODE_DEND";break;case 52:return this.popState(),n.getLogger().debug("Lex: ]>"),"NODE_DEND";break;case 53:return this.popState(),n.getLogger().debug("Lex: ]"),"NODE_DEND";break;case 54:return n.getLogger().debug("Lexa: -)"),this.pushState("NODE"),35;break;case 55:return n.getLogger().debug("Lexa: (-"),this.pushState("NODE"),35;break;case 56:return n.getLogger().debug("Lexa: ))"),this.pushState("NODE"),35;break;case 57:return n.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;break;case 58:return n.getLogger().debug("Lex: ((("),this.pushState("NODE"),35;break;case 59:return n.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;break;case 60:return n.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;break;case 61:return n.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;break;case 62:return n.getLogger().debug("Lexc: >"),this.pushState("NODE"),35;break;case 63:return n.getLogger().debug("Lexa: (["),this.pushState("NODE"),35;break;case 64:return n.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;break;case 65:return this.pushState("NODE"),35;break;case 66:return this.pushState("NODE"),35;break;case 67:return this.pushState("NODE"),35;break;case 68:return this.pushState("NODE"),35;break;case 69:return this.pushState("NODE"),35;break;case 70:return this.pushState("NODE"),35;break;case 71:return this.pushState("NODE"),35;break;case 72:return n.getLogger().debug("Lexa: ["),this.pushState("NODE"),35;break;case 73:return this.pushState("BLOCK_ARROW"),n.getLogger().debug("LEX ARR START"),37;break;case 74:return n.getLogger().debug("Lex: NODE_ID",h.yytext),31;break;case 75:return n.getLogger().debug("Lex: EOF",h.yytext),8;break;case 76:this.pushState("md_string");break;case 77:this.pushState("md_string");break;case 78:return"NODE_DESCR";case 79:this.popState();break;case 80:n.getLogger().debug("Lex: Starting string"),this.pushState("string");break;case 81:n.getLogger().debug("LEX ARR: Starting string"),this.pushState("string");break;case 82:return n.getLogger().debug("LEX: NODE_DESCR:",h.yytext),"NODE_DESCR";break;case 83:n.getLogger().debug("LEX POPPING"),this.popState();break;case 84:n.getLogger().debug("Lex: =>BAE"),this.pushState("ARROW_DIR");break;case 85:return h.yytext=h.yytext.replace(/^,\s*/,""),n.getLogger().debug("Lex (right): dir:",h.yytext),"DIR";break;case 86:return h.yytext=h.yytext.replace(/^,\s*/,""),n.getLogger().debug("Lex (left):",h.yytext),"DIR";break;case 87:return h.yytext=h.yytext.replace(/^,\s*/,""),n.getLogger().debug("Lex (x):",h.yytext),"DIR";break;case 88:return h.yytext=h.yytext.replace(/^,\s*/,""),n.getLogger().debug("Lex (y):",h.yytext),"DIR";break;case 89:return h.yytext=h.yytext.replace(/^,\s*/,""),n.getLogger().debug("Lex (up):",h.yytext),"DIR";break;case 90:return h.yytext=h.yytext.replace(/^,\s*/,""),n.getLogger().debug("Lex (down):",h.yytext),"DIR";break;case 91:return h.yytext="]>",n.getLogger().debug("Lex (ARROW_DIR end):",h.yytext),this.popState(),this.popState(),"BLOCK_ARROW_END";break;case 92:return n.getLogger().debug("Lex: LINK","#"+h.yytext+"#"),15;break;case 93:return n.getLogger().debug("Lex: LINK",h.yytext),15;break;case 94:return n.getLogger().debug("Lex: LINK",h.yytext),15;break;case 95:return n.getLogger().debug("Lex: LINK",h.yytext),15;break;case 96:return n.getLogger().debug("Lex: START_LINK",h.yytext),this.pushState("LLABEL"),16;break;case 97:return n.getLogger().debug("Lex: START_LINK",h.yytext),this.pushState("LLABEL"),16;break;case 98:return n.getLogger().debug("Lex: START_LINK",h.yytext),this.pushState("LLABEL"),16;break;case 99:this.pushState("md_string");break;case 100:return n.getLogger().debug("Lex: Starting string"),this.pushState("string"),"LINK_LABEL";break;case 101:return this.popState(),n.getLogger().debug("Lex: LINK","#"+h.yytext+"#"),15;break;case 102:return this.popState(),n.getLogger().debug("Lex: LINK",h.yytext),15;break;case 103:return this.popState(),n.getLogger().debug("Lex: LINK",h.yytext),15;break;case 104:return n.getLogger().debug("Lex: COLON",h.yytext),h.yytext=h.yytext.slice(1),27;break}},"anonymous"),rules:[/^(?:block-beta\b)/,/^(?:block:)/,/^(?:block\b)/,/^(?:[\s]+)/,/^(?:[\n]+)/,/^(?:((\u000D\u000A)|(\u000A)))/,/^(?:columns\s+auto\b)/,/^(?:columns\s+[\d]+)/,/^(?:["][`])/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:space[:]\d+)/,/^(?:space\b)/,/^(?:default\b)/,/^(?:linkStyle\b)/,/^(?:interpolate\b)/,/^(?:classDef\s+)/,/^(?:DEFAULT\s+)/,/^(?:\w+\s+)/,/^(?:[^\n]*)/,/^(?:class\s+)/,/^(?:(\w+)+((,\s*\w+)*))/,/^(?:[^\n]*)/,/^(?:style\s+)/,/^(?:(\w+)+((,\s*\w+)*))/,/^(?:[^\n]*)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:end\b\s*)/,/^(?:\(\(\()/,/^(?:\)\)\))/,/^(?:[\)]\))/,/^(?:\}\})/,/^(?:\})/,/^(?:\(-)/,/^(?:-\))/,/^(?:\(\()/,/^(?:\]\])/,/^(?:\()/,/^(?:\]\))/,/^(?:\\\])/,/^(?:\/\])/,/^(?:\)\])/,/^(?:[\)])/,/^(?:\]>)/,/^(?:[\]])/,/^(?:-\))/,/^(?:\(-)/,/^(?:\)\))/,/^(?:\))/,/^(?:\(\(\()/,/^(?:\(\()/,/^(?:\{\{)/,/^(?:\{)/,/^(?:>)/,/^(?:\(\[)/,/^(?:\()/,/^(?:\[\[)/,/^(?:\[\|)/,/^(?:\[\()/,/^(?:\)\)\))/,/^(?:\[\\)/,/^(?:\[\/)/,/^(?:\[\\)/,/^(?:\[)/,/^(?:<\[)/,/^(?:[^\(\[\n\-\)\{\}\s\<\>:=]+)/,/^(?:$)/,/^(?:["][`])/,/^(?:["][`])/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["])/,/^(?:["])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:\]>\s*\()/,/^(?:,?\s*right\s*)/,/^(?:,?\s*left\s*)/,/^(?:,?\s*x\s*)/,/^(?:,?\s*y\s*)/,/^(?:,?\s*up\s*)/,/^(?:,?\s*down\s*)/,/^(?:\)\s*)/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?:\s*~~[\~]+\s*)/,/^(?:\s*[xo<]?--\s*)/,/^(?:\s*[xo<]?==\s*)/,/^(?:\s*[xo<]?-\.\s*)/,/^(?:["][`])/,/^(?:["])/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?::\d+)/],conditions:{STYLE_DEFINITION:{rules:[28],inclusive:!1},STYLE_STMNT:{rules:[27],inclusive:!1},CLASSDEFID:{rules:[22],inclusive:!1},CLASSDEF:{rules:[20,21],inclusive:!1},CLASS_STYLE:{rules:[25],inclusive:!1},CLASS:{rules:[24],inclusive:!1},LLABEL:{rules:[99,100,101,102,103],inclusive:!1},ARROW_DIR:{rules:[85,86,87,88,89,90,91],inclusive:!1},BLOCK_ARROW:{rules:[76,81,84],inclusive:!1},NODE:{rules:[37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,77,80],inclusive:!1},md_string:{rules:[9,10,78,79],inclusive:!1},space:{rules:[],inclusive:!1},string:{rules:[12,13,82,83],inclusive:!1},acc_descr_multiline:{rules:[34,35],inclusive:!1},acc_descr:{rules:[32],inclusive:!1},acc_title:{rules:[30],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,11,14,15,16,17,18,19,23,26,29,31,33,36,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,92,93,94,95,96,97,98,104],inclusive:!0}}};return B}();N.lexer=v;function z(){this.yy={}}return t(z,"Parser"),z.prototype=N,N.Parser=z,new z}();be.parser=be;var rt=be,M=new Map,me=[],Se=new Map,Ie="color",Oe="fill",st="bgFill",ve=",",Q=new Map,Le="",it=t((e)=>b.sanitizeText(e,l()),"sanitizeText"),at=t(function(e,o=""){let u=Q.get(e);if(!u)u={id:e,styles:[],textStyles:[]},Q.set(e,u);if(o!==void 0&&o!==null)o.split(ve).forEach((i)=>{let g=i.replace(/([^;]*);/,"$1").trim();if(RegExp(Ie).exec(i)){let r=g.replace(Oe,st).replace(Ie,Oe);u.textStyles.push(r)}u.styles.push(g)})},"addStyleClass"),nt=t(function(e,o=""){let u=M.get(e);if(o!==void 0&&o!==null)u.styles=o.split(ve)},"addStyle2Node"),ot=t(function(e,o){e.split(",").forEach(function(u){let i=M.get(u);if(i===void 0){let g=u.trim();i={id:g,type:"na",children:[]},M.set(g,i)}if(!i.classes)i.classes=[];i.classes.push(o)})},"setCssClass"),Ae=0,ze=t((e,o)=>{let u=e.flat(),i=[],f=u.find((r)=>r?.type==="column-setting")?.columns??-1;for(let r of u){if(typeof f==="number"&&f>0&&r.type!=="column-setting"&&typeof r.widthInColumns==="number"&&r.widthInColumns>f)a.warn(`Block ${r.id} width ${r.widthInColumns} exceeds configured column width ${f}`);if(r.label)r.label=it(r.label);if(r.type==="classDef"){at(r.id,r.css);continue}if(r.type==="applyClass"){ot(r.id,r?.styleClass??"");continue}if(r.type==="applyStyles"){if(r?.stylesStr)nt(r.id,r?.stylesStr);continue}if(r.type==="column-setting")o.columns=r.columns??-1;else if(r.type==="edge"){let d=(Se.get(r.id)??0)+1;Se.set(r.id,d),r.id=d+"-"+r.id,me.push(r)}else{if(!r.label)if(r.type==="composite")r.label="";else r.label=r.id;let d=M.get(r.id);if(d===void 0){if(r.type==="composite")r.colorIndex=Ae++;M.set(r.id,r)}else{if(r.type!=="na")d.type=r.type;if(r.label!==r.id)d.label=r.label}if(r.children)ze(r.children,r);if(r.type==="space"){let w=r.width??1;for(let E=0;E<w;E++){let k=Ne(r);k.id=k.id+"-"+E,M.set(k.id,k),i.push(k)}}else if(d===void 0)i.push(r)}}o.children=i},"populateBlockDatabase"),ke=[],X={id:"root",type:"composite",children:[],columns:-1},lt=t(()=>{a.debug("Clear called"),C(),X={id:"root",type:"composite",children:[],columns:-1},M=new Map([["root",X]]),ke=[],Q=new Map,me=[],Se=new Map,Le="",Ae=0},"clear");function Be(e){switch(a.debug("typeStr2Type",e),e){case"[]":return"square";case"()":return a.debug("we have a round"),"round";case"(())":return"circle";case">]":return"rect_left_inv_arrow";case"{}":return"diamond";case"{{}}":return"hexagon";case"([])":return"stadium";case"[[]]":return"subroutine";case"[()]":return"cylinder";case"((()))":return"doublecircle";case"[//]":return"lean_right";case"[\\\\]":return"lean_left";case"[/\\]":return"trapezoid";case"[\\/]":return"inv_trapezoid";case"<[]>":return"block_arrow";default:return"na"}}t(Be,"typeStr2Type");function Re(e){switch(a.debug("typeStr2Type",e),e){case"==":return"thick";default:return"normal"}}t(Re,"edgeTypeStr2Type");function Pe(e){switch(e.trim().slice(-1)){case"x":return"arrow_cross";case"o":return"arrow_circle";case">":return"arrow_point";default:return""}}t(Pe,"edgeStrToEdgeData");function Fe(e){switch(e.trim().charAt(0)){case"x":return"arrow_cross";case"o":return"arrow_circle";case"<":return"arrow_point";default:return"arrow_open"}}t(Fe,"edgeStrToEdgeStartData");function Me(e){return e.includes("==")?"thick":"normal"}t(Me,"edgeStrToThickness");function Ke(e){if(e.includes(".-"))return"dotted";return"solid"}t(Ke,"edgeStrToPattern");var Ce=0,ct=t(()=>(Ce++,"id-"+Math.random().toString(36).substr(2,12)+"-"+Ce),"generateId"),ut=t((e)=>{X.children=e,ze(e,X),ke=X.children},"setHierarchy"),ht=t((e)=>{let o=M.get(e);if(!o)return-1;if(o.columns)return o.columns;if(!o.children)return-1;return o.children.length},"getColumns"),gt=t(()=>[...M.values()],"getBlocksFlat"),dt=t(()=>ke||[],"getBlocks"),pt=t(()=>me,"getEdges"),ft=t((e)=>M.get(e),"getBlock"),bt=t((e)=>{M.set(e.id,e)},"setBlock"),St=t((e)=>{Le=e},"setDiagramId"),xt=t(()=>Le,"getDiagramId"),mt=t(()=>a,"getLogger"),Lt=t(function(){return Q},"getClasses"),kt={getConfig:t(()=>x().block,"getConfig"),typeStr2Type:Be,edgeTypeStr2Type:Re,edgeStrToEdgeData:Pe,edgeStrToEdgeStartData:Fe,edgeStrToThickness:Me,edgeStrToPattern:Ke,getLogger:mt,getBlocksFlat:gt,getBlocks:dt,getEdges:pt,setHierarchy:ut,getBlock:ft,setBlock:bt,getColumns:ht,getClasses:Lt,clear:lt,generateId:ct,setDiagramId:St,getDiagramId:xt},wt=kt,_t=t((e)=>{let{theme:o,bkgColorArray:u,borderColorArray:i}=e;if(!se(o,i))return"";let g=le(e.look),f=pe(u),r="";for(let d=0;d<Ye(e.THEME_COLOR_LIMIT,i);d++){let w=i[d%i.length],E=f?`fill: ${u[d%u.length]};`:"",k=`[data-look="${g}"][data-color-id="color-${d}"]`;r+=`
6
+ `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:t(function(){var n=this.next();if(n)return n;else return this.lex()},"lex"),begin:t(function(n){this.conditionStack.push(n)},"begin"),popState:t(function(){var n=this.conditionStack.length-1;if(n>0)return this.conditionStack.pop();else return this.conditionStack[0]},"popState"),_currentRules:t(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:t(function(n){if(n=this.conditionStack.length-1-Math.abs(n||0),n>=0)return this.conditionStack[n];else return"INITIAL"},"topState"),pushState:t(function(n){this.begin(n)},"pushState"),stateStackSize:t(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:t(function(n,h,m,D){var s=D;switch(m){case 0:return n.getLogger().debug("Found block-beta"),10;break;case 1:return n.getLogger().debug("Found id-block"),29;break;case 2:return n.getLogger().debug("Found block"),10;break;case 3:n.getLogger().debug(".",h.yytext);break;case 4:n.getLogger().debug("_",h.yytext);break;case 5:return 5;case 6:return h.yytext=-1,28;break;case 7:return h.yytext=h.yytext.replace(/columns\s+/,""),n.getLogger().debug("COLUMNS (LEX)",h.yytext),28;break;case 8:this.pushState("md_string");break;case 9:return"MD_STR";case 10:this.popState();break;case 11:this.pushState("string");break;case 12:n.getLogger().debug("LEX: POPPING STR:",h.yytext),this.popState();break;case 13:return n.getLogger().debug("LEX: STR end:",h.yytext),"STR";break;case 14:return h.yytext=h.yytext.replace(/space\:/,""),n.getLogger().debug("SPACE NUM (LEX)",h.yytext),21;break;case 15:return h.yytext="1",n.getLogger().debug("COLUMNS (LEX)",h.yytext),21;break;case 16:return 42;case 17:return"LINKSTYLE";case 18:return"INTERPOLATE";case 19:return this.pushState("CLASSDEF"),39;break;case 20:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";break;case 21:return this.popState(),this.pushState("CLASSDEFID"),40;break;case 22:return this.popState(),41;break;case 23:return this.pushState("CLASS"),43;break;case 24:return this.popState(),this.pushState("CLASS_STYLE"),44;break;case 25:return this.popState(),45;break;case 26:return this.pushState("STYLE_STMNT"),46;break;case 27:return this.popState(),this.pushState("STYLE_DEFINITION"),47;break;case 28:return this.popState(),48;break;case 29:return this.pushState("acc_title"),"acc_title";break;case 30:return this.popState(),"acc_title_value";break;case 31:return this.pushState("acc_descr"),"acc_descr";break;case 32:return this.popState(),"acc_descr_value";break;case 33:this.pushState("acc_descr_multiline");break;case 34:this.popState();break;case 35:return"acc_descr_multiline_value";case 36:return 30;case 37:return this.popState(),n.getLogger().debug("Lex: (("),"NODE_DEND";break;case 38:return this.popState(),n.getLogger().debug("Lex: (("),"NODE_DEND";break;case 39:return this.popState(),n.getLogger().debug("Lex: ))"),"NODE_DEND";break;case 40:return this.popState(),n.getLogger().debug("Lex: (("),"NODE_DEND";break;case 41:return this.popState(),n.getLogger().debug("Lex: (("),"NODE_DEND";break;case 42:return this.popState(),n.getLogger().debug("Lex: (-"),"NODE_DEND";break;case 43:return this.popState(),n.getLogger().debug("Lex: -)"),"NODE_DEND";break;case 44:return this.popState(),n.getLogger().debug("Lex: (("),"NODE_DEND";break;case 45:return this.popState(),n.getLogger().debug("Lex: ]]"),"NODE_DEND";break;case 46:return this.popState(),n.getLogger().debug("Lex: ("),"NODE_DEND";break;case 47:return this.popState(),n.getLogger().debug("Lex: ])"),"NODE_DEND";break;case 48:return this.popState(),n.getLogger().debug("Lex: /]"),"NODE_DEND";break;case 49:return this.popState(),n.getLogger().debug("Lex: /]"),"NODE_DEND";break;case 50:return this.popState(),n.getLogger().debug("Lex: )]"),"NODE_DEND";break;case 51:return this.popState(),n.getLogger().debug("Lex: )"),"NODE_DEND";break;case 52:return this.popState(),n.getLogger().debug("Lex: ]>"),"NODE_DEND";break;case 53:return this.popState(),n.getLogger().debug("Lex: ]"),"NODE_DEND";break;case 54:return n.getLogger().debug("Lexa: -)"),this.pushState("NODE"),35;break;case 55:return n.getLogger().debug("Lexa: (-"),this.pushState("NODE"),35;break;case 56:return n.getLogger().debug("Lexa: ))"),this.pushState("NODE"),35;break;case 57:return n.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;break;case 58:return n.getLogger().debug("Lex: ((("),this.pushState("NODE"),35;break;case 59:return n.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;break;case 60:return n.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;break;case 61:return n.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;break;case 62:return n.getLogger().debug("Lexc: >"),this.pushState("NODE"),35;break;case 63:return n.getLogger().debug("Lexa: (["),this.pushState("NODE"),35;break;case 64:return n.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;break;case 65:return this.pushState("NODE"),35;break;case 66:return this.pushState("NODE"),35;break;case 67:return this.pushState("NODE"),35;break;case 68:return this.pushState("NODE"),35;break;case 69:return this.pushState("NODE"),35;break;case 70:return this.pushState("NODE"),35;break;case 71:return this.pushState("NODE"),35;break;case 72:return n.getLogger().debug("Lexa: ["),this.pushState("NODE"),35;break;case 73:return this.pushState("BLOCK_ARROW"),n.getLogger().debug("LEX ARR START"),37;break;case 74:return n.getLogger().debug("Lex: NODE_ID",h.yytext),31;break;case 75:return n.getLogger().debug("Lex: EOF",h.yytext),8;break;case 76:this.pushState("md_string");break;case 77:this.pushState("md_string");break;case 78:return"NODE_DESCR";case 79:this.popState();break;case 80:n.getLogger().debug("Lex: Starting string"),this.pushState("string");break;case 81:n.getLogger().debug("LEX ARR: Starting string"),this.pushState("string");break;case 82:return n.getLogger().debug("LEX: NODE_DESCR:",h.yytext),"NODE_DESCR";break;case 83:n.getLogger().debug("LEX POPPING"),this.popState();break;case 84:n.getLogger().debug("Lex: =>BAE"),this.pushState("ARROW_DIR");break;case 85:return h.yytext=h.yytext.replace(/^,\s*/,""),n.getLogger().debug("Lex (right): dir:",h.yytext),"DIR";break;case 86:return h.yytext=h.yytext.replace(/^,\s*/,""),n.getLogger().debug("Lex (left):",h.yytext),"DIR";break;case 87:return h.yytext=h.yytext.replace(/^,\s*/,""),n.getLogger().debug("Lex (x):",h.yytext),"DIR";break;case 88:return h.yytext=h.yytext.replace(/^,\s*/,""),n.getLogger().debug("Lex (y):",h.yytext),"DIR";break;case 89:return h.yytext=h.yytext.replace(/^,\s*/,""),n.getLogger().debug("Lex (up):",h.yytext),"DIR";break;case 90:return h.yytext=h.yytext.replace(/^,\s*/,""),n.getLogger().debug("Lex (down):",h.yytext),"DIR";break;case 91:return h.yytext="]>",n.getLogger().debug("Lex (ARROW_DIR end):",h.yytext),this.popState(),this.popState(),"BLOCK_ARROW_END";break;case 92:return n.getLogger().debug("Lex: LINK","#"+h.yytext+"#"),15;break;case 93:return n.getLogger().debug("Lex: LINK",h.yytext),15;break;case 94:return n.getLogger().debug("Lex: LINK",h.yytext),15;break;case 95:return n.getLogger().debug("Lex: LINK",h.yytext),15;break;case 96:return n.getLogger().debug("Lex: START_LINK",h.yytext),this.pushState("LLABEL"),16;break;case 97:return n.getLogger().debug("Lex: START_LINK",h.yytext),this.pushState("LLABEL"),16;break;case 98:return n.getLogger().debug("Lex: START_LINK",h.yytext),this.pushState("LLABEL"),16;break;case 99:this.pushState("md_string");break;case 100:return n.getLogger().debug("Lex: Starting string"),this.pushState("string"),"LINK_LABEL";break;case 101:return this.popState(),n.getLogger().debug("Lex: LINK","#"+h.yytext+"#"),15;break;case 102:return this.popState(),n.getLogger().debug("Lex: LINK",h.yytext),15;break;case 103:return this.popState(),n.getLogger().debug("Lex: LINK",h.yytext),15;break;case 104:return n.getLogger().debug("Lex: COLON",h.yytext),h.yytext=h.yytext.slice(1),27;break}},"anonymous"),rules:[/^(?:block-beta\b)/,/^(?:block:)/,/^(?:block\b)/,/^(?:[\s]+)/,/^(?:[\n]+)/,/^(?:((\u000D\u000A)|(\u000A)))/,/^(?:columns\s+auto\b)/,/^(?:columns\s+[\d]+)/,/^(?:["][`])/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:space[:]\d+)/,/^(?:space\b)/,/^(?:default\b)/,/^(?:linkStyle\b)/,/^(?:interpolate\b)/,/^(?:classDef\s+)/,/^(?:DEFAULT\s+)/,/^(?:\w+\s+)/,/^(?:[^\n]*)/,/^(?:class\s+)/,/^(?:(\w+)+((,\s*\w+)*))/,/^(?:[^\n]*)/,/^(?:style\s+)/,/^(?:(\w+)+((,\s*\w+)*))/,/^(?:[^\n]*)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:end\b\s*)/,/^(?:\(\(\()/,/^(?:\)\)\))/,/^(?:[\)]\))/,/^(?:\}\})/,/^(?:\})/,/^(?:\(-)/,/^(?:-\))/,/^(?:\(\()/,/^(?:\]\])/,/^(?:\()/,/^(?:\]\))/,/^(?:\\\])/,/^(?:\/\])/,/^(?:\)\])/,/^(?:[\)])/,/^(?:\]>)/,/^(?:[\]])/,/^(?:-\))/,/^(?:\(-)/,/^(?:\)\))/,/^(?:\))/,/^(?:\(\(\()/,/^(?:\(\()/,/^(?:\{\{)/,/^(?:\{)/,/^(?:>)/,/^(?:\(\[)/,/^(?:\()/,/^(?:\[\[)/,/^(?:\[\|)/,/^(?:\[\()/,/^(?:\)\)\))/,/^(?:\[\\)/,/^(?:\[\/)/,/^(?:\[\\)/,/^(?:\[)/,/^(?:<\[)/,/^(?:[^\(\[\n\-\)\{\}\s\<\>:=]+)/,/^(?:$)/,/^(?:["][`])/,/^(?:["][`])/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["])/,/^(?:["])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:\]>\s*\()/,/^(?:,?\s*right\s*)/,/^(?:,?\s*left\s*)/,/^(?:,?\s*x\s*)/,/^(?:,?\s*y\s*)/,/^(?:,?\s*up\s*)/,/^(?:,?\s*down\s*)/,/^(?:\)\s*)/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?:\s*~~[\~]+\s*)/,/^(?:\s*[xo<]?--\s*)/,/^(?:\s*[xo<]?==\s*)/,/^(?:\s*[xo<]?-\.\s*)/,/^(?:["][`])/,/^(?:["])/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?::\d+)/],conditions:{STYLE_DEFINITION:{rules:[28],inclusive:!1},STYLE_STMNT:{rules:[27],inclusive:!1},CLASSDEFID:{rules:[22],inclusive:!1},CLASSDEF:{rules:[20,21],inclusive:!1},CLASS_STYLE:{rules:[25],inclusive:!1},CLASS:{rules:[24],inclusive:!1},LLABEL:{rules:[99,100,101,102,103],inclusive:!1},ARROW_DIR:{rules:[85,86,87,88,89,90,91],inclusive:!1},BLOCK_ARROW:{rules:[76,81,84],inclusive:!1},NODE:{rules:[37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,77,80],inclusive:!1},md_string:{rules:[9,10,78,79],inclusive:!1},space:{rules:[],inclusive:!1},string:{rules:[12,13,82,83],inclusive:!1},acc_descr_multiline:{rules:[34,35],inclusive:!1},acc_descr:{rules:[32],inclusive:!1},acc_title:{rules:[30],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,11,14,15,16,17,18,19,23,26,29,31,33,36,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,92,93,94,95,96,97,98,104],inclusive:!0}}};return B}();N.lexer=v;function z(){this.yy={}}return t(z,"Parser"),z.prototype=N,N.Parser=z,new z}();be.parser=be;var rt=be,M=new Map,me=[],Se=new Map,Ie="color",Oe="fill",st="bgFill",ve=",",Q=new Map,Le="",it=t((e)=>b.sanitizeText(e,l()),"sanitizeText"),at=t(function(e,o=""){let u=Q.get(e);if(!u)u={id:e,styles:[],textStyles:[]},Q.set(e,u);if(o!==void 0&&o!==null)o.split(ve).forEach((i)=>{let g=i.replace(/([^;]*);/,"$1").trim();if(RegExp(Ie).exec(i)){let r=g.replace(Oe,st).replace(Ie,Oe);u.textStyles.push(r)}u.styles.push(g)})},"addStyleClass"),nt=t(function(e,o=""){let u=M.get(e);if(o!==void 0&&o!==null)u.styles=o.split(ve)},"addStyle2Node"),ot=t(function(e,o){e.split(",").forEach(function(u){let i=M.get(u);if(i===void 0){let g=u.trim();i={id:g,type:"na",children:[]},M.set(g,i)}if(!i.classes)i.classes=[];i.classes.push(o)})},"setCssClass"),Ae=0,ze=t((e,o)=>{let u=e.flat(),i=[],f=u.find((r)=>r?.type==="column-setting")?.columns??-1;for(let r of u){if(typeof f==="number"&&f>0&&r.type!=="column-setting"&&typeof r.widthInColumns==="number"&&r.widthInColumns>f)a.warn(`Block ${r.id} width ${r.widthInColumns} exceeds configured column width ${f}`);if(r.label)r.label=it(r.label);if(r.type==="classDef"){at(r.id,r.css);continue}if(r.type==="applyClass"){ot(r.id,r?.styleClass??"");continue}if(r.type==="applyStyles"){if(r?.stylesStr)nt(r.id,r?.stylesStr);continue}if(r.type==="column-setting")o.columns=r.columns??-1;else if(r.type==="edge"){let d=(Se.get(r.id)??0)+1;Se.set(r.id,d),r.id=d+"-"+r.id,me.push(r)}else{if(!r.label)if(r.type==="composite")r.label="";else r.label=r.id;let d=M.get(r.id);if(d===void 0){if(r.type==="composite")r.colorIndex=Ae++;M.set(r.id,r)}else{if(r.type!=="na")d.type=r.type;if(r.label!==r.id)d.label=r.label}if(r.children)ze(r.children,r);if(r.type==="space"){let w=r.width??1;for(let E=0;E<w;E++){let k=Ne(r);k.id=k.id+"-"+E,M.set(k.id,k),i.push(k)}}else if(d===void 0)i.push(r)}}o.children=i},"populateBlockDatabase"),ke=[],X={id:"root",type:"composite",children:[],columns:-1},lt=t(()=>{a.debug("Clear called"),C(),X={id:"root",type:"composite",children:[],columns:-1},M=new Map([["root",X]]),ke=[],Q=new Map,me=[],Se=new Map,Le="",Ae=0},"clear");function Be(e){switch(a.debug("typeStr2Type",e),e){case"[]":return"square";case"()":return a.debug("we have a round"),"round";case"(())":return"circle";case">]":return"rect_left_inv_arrow";case"{}":return"diamond";case"{{}}":return"hexagon";case"([])":return"stadium";case"[[]]":return"subroutine";case"[()]":return"cylinder";case"((()))":return"doublecircle";case"[//]":return"lean_right";case"[\\\\]":return"lean_left";case"[/\\]":return"trapezoid";case"[\\/]":return"inv_trapezoid";case"<[]>":return"block_arrow";default:return"na"}}t(Be,"typeStr2Type");function Re(e){switch(a.debug("typeStr2Type",e),e){case"==":return"thick";default:return"normal"}}t(Re,"edgeTypeStr2Type");function Pe(e){switch(e.trim().slice(-1)){case"x":return"arrow_cross";case"o":return"arrow_circle";case">":return"arrow_point";default:return""}}t(Pe,"edgeStrToEdgeData");function Fe(e){switch(e.trim().charAt(0)){case"x":return"arrow_cross";case"o":return"arrow_circle";case"<":return"arrow_point";default:return"arrow_open"}}t(Fe,"edgeStrToEdgeStartData");function Me(e){return e.includes("==")?"thick":"normal"}t(Me,"edgeStrToThickness");function Ke(e){if(e.includes(".-"))return"dotted";return"solid"}t(Ke,"edgeStrToPattern");var Ce=0,ct=t(()=>(Ce++,"id-"+Math.random().toString(36).substr(2,12)+"-"+Ce),"generateId"),ut=t((e)=>{X.children=e,ze(e,X),ke=X.children},"setHierarchy"),ht=t((e)=>{let o=M.get(e);if(!o)return-1;if(o.columns)return o.columns;if(!o.children)return-1;return o.children.length},"getColumns"),gt=t(()=>[...M.values()],"getBlocksFlat"),dt=t(()=>ke||[],"getBlocks"),pt=t(()=>me,"getEdges"),ft=t((e)=>M.get(e),"getBlock"),St=t((e)=>{M.set(e.id,e)},"setBlock"),xt=t((e)=>{Le=e},"setDiagramId"),mt=t(()=>Le,"getDiagramId"),Lt=t(()=>a,"getLogger"),kt=t(function(){return Q},"getClasses"),yt={getConfig:t(()=>x().block,"getConfig"),typeStr2Type:Be,edgeTypeStr2Type:Re,edgeStrToEdgeData:Pe,edgeStrToEdgeStartData:Fe,edgeStrToThickness:Me,edgeStrToPattern:Ke,getLogger:Lt,getBlocksFlat:gt,getBlocks:dt,getEdges:pt,setHierarchy:ut,getBlock:ft,setBlock:St,getColumns:ht,getClasses:kt,clear:lt,generateId:ct,setDiagramId:xt,getDiagramId:mt},wt=yt,_t=t((e)=>{let{theme:o,bkgColorArray:u,borderColorArray:i}=e;if(!se(o,i))return"";let g=le(e.look),f=pe(u),r="";for(let d=0;d<Ze(e.THEME_COLOR_LIMIT,i);d++){let w=i[d%i.length],E=f?`fill: ${u[d%u.length]};`:"",k=`[data-look="${g}"][data-color-id="color-${d}"]`;r+=`
7
7
 
8
8
  ${k}.node rect.composite {
9
9
  stroke: ${w};
10
10
  ${E}
11
11
  }
12
- `}return r},"genColor"),fe=t((e,o)=>{let u=Bt,i=u(e,"r"),g=u(e,"g"),f=u(e,"b");return de(i,g,f,o)},"fade"),Dt=t((e)=>`${_t(e)}
12
+ `}return r},"genColor"),fe=t((e,o)=>{let u=$t,i=u(e,"r"),g=u(e,"g"),f=u(e,"b");return de(i,g,f,o)},"fade"),Dt=t((e)=>`${_t(e)}
13
13
  .label {
14
14
  font-family: ${e.fontFamily};
15
15
  color: ${e.nodeTextColor||e.textColor};
@@ -136,5 +136,5 @@ Expecting `+Z.join(", ")+", got '"+(this.terminals_[A]||A)+"'";else he="Parse er
136
136
  font-size: 18px;
137
137
  fill: ${e.textColor};
138
138
  }
139
- ${je()}
140
- `,"getStyles"),Tt=Dt;function xe(e,o){if(e===0||!Number.isInteger(e))throw Error("Columns must be an integer !== 0.");if(o<0||!Number.isInteger(o))throw Error("Position must be a non-negative integer."+o);if(e<0)return{px:o,py:0};if(e===1)return{px:0,py:o};let u=o%e,i=Math.floor(o/e);return{px:u,py:i}}t(xe,"calculateBlockPosition");var Nt=t((e)=>{let o=0,u=0;for(let i of e.children){let{width:g,height:f,x:r,y:d}=i.size??{width:0,height:0,x:0,y:0};if(a.debug("getMaxChildSize abc95 child:",i.id,"width:",g,"height:",f,"x:",r,"y:",d,i.type),i.type==="space")continue;let w=g/(i.widthInColumns??1);if(w>o)o=w;if(f>u)u=f}return{width:o,height:u}},"getMaxChildSize");function ee(e,o,u=0,i=0,g=8){if(a.debug("setBlockSizes abc95 (start)",e.id,e?.size?.x,"block width =",e?.size,"siblingWidth",u),!e?.size?.width)e.size={width:u,height:i,x:0,y:0};let f=0,r=0;if(e.children?.length>0){for(let y of e.children)ee(y,o,0,0,g);let d=Nt(e);f=d.width,r=d.height,a.debug("setBlockSizes abc95 maxWidth of",e.id,":s children is ",f,r);for(let y of e.children)if(y.size)a.debug(`abc95 Setting size of children of ${e.id} id=${y.id} ${f} ${r} ${JSON.stringify(y.size)}`),y.size.width=f*(y.widthInColumns??1)+g*((y.widthInColumns??1)-1),y.size.height=r,y.size.x=0,y.size.y=0,a.debug(`abc95 updating size of ${e.id} children child:${y.id} maxWidth:${f} maxHeight:${r}`);for(let y of e.children)ee(y,o,f,r,g);let w=e.columns??-1,E=0;for(let y of e.children)E+=y.widthInColumns??1;let k=e.children.length;if(w>0&&w<E)k=w;let L=Math.ceil(E/k),_=k*(f+g)+g,T=L*(r+g)+g;if(_<u){a.debug(`Detected to small sibling: abc95 ${e.id} siblingWidth ${u} siblingHeight ${i} width ${_}`),_=u,T=i;let y=(u-k*g-g)/k,I=(i-L*g-g)/L;a.debug("Size indata abc88",e.id,"childWidth",y,"maxWidth",f),a.debug("Size indata abc88",e.id,"childHeight",I,"maxHeight",r),a.debug("Size indata abc88 xSize",k,"padding",g);for(let N of e.children)if(N.size)N.size.width=y,N.size.height=I,N.size.x=0,N.size.y=0}if(a.debug(`abc95 (finale calc) ${e.id} xSize ${k} ySize ${L} columns ${w}${e.children.length} width=${Math.max(_,e.size?.width||0)}`),_<(e?.size?.width||0)){_=e?.size?.width||0;let y=w>0?Math.min(e.children.length,w):e.children.length;if(y>0){let I=(_-y*g-g)/y;a.debug("abc95 (growing to fit) width",e.id,_,e.size?.width,I);for(let N of e.children)if(N.size)N.size.width=I}}e.size={width:_,height:T,x:0,y:0}}a.debug("setBlockSizes abc94 (done)",e.id,e?.size?.x,e?.size?.width,e?.size?.y,e?.size?.height)}t(ee,"setBlockSizes");function ye(e,o,u=8){a.debug(`abc85 layout blocks (=>layoutBlocks) ${e.id} x: ${e?.size?.x} y: ${e?.size?.y} width: ${e?.size?.width}`);let i=e.columns??-1;if(a.debug("layoutBlocks columns abc95",e.id,"=>",i,e),e.children&&e.children.length>0){let g=e?.children[0]?.size?.width??0,f=e.children.length*g+(e.children.length-1)*u;a.debug("widthOfChildren 88",f,"posX");let r=new Map;{let L=0;for(let _ of e.children){if(!_.size)continue;let{py:T}=xe(i,L),y=r.get(T)??0;if(_.size.height>y)r.set(T,_.size.height);let I=_?.widthInColumns??1;if(i>0)I=Math.min(I,i-L%i);L+=I}}let d=new Map;{let L=0,_=[...r.keys()].sort((T,y)=>T-y);for(let T of _)d.set(T,L),L+=(r.get(T)??0)+u}let w=0;a.debug("abc91 block?.size?.x",e.id,e?.size?.x);let E=e?.size?.x?e?.size?.x+(-e?.size?.width/2||0):-u,k=0;for(let L of e.children){let _=e;if(!L.size)continue;let{width:T,height:y}=L.size,{px:I,py:N}=xe(i,w);if(N!=k)k=N,E=e?.size?.x?e?.size?.x+(-e?.size?.width/2||0):-u,a.debug("New row in layout for block",e.id," and child ",L.id,k);if(a.debug(`abc89 layout blocks (child) id: ${L.id} Pos: ${w} (px, py) ${I},${N} (${_?.size?.x},${_?.size?.y}) parent: ${_.id} width: ${T}${u}`),_.size){let z=T/2;L.size.x=E+u+z,a.debug(`abc91 layout blocks (calc) px, pyid:${L.id} startingPos=X${E} new startingPosX${L.size.x} ${z} padding=${u} width=${T} halfWidth=${z} => x:${L.size.x} y:${L.size.y} ${L.widthInColumns} (width * (child?.w || 1)) / 2 ${T*(L?.widthInColumns??1)/2}`),E=L.size.x+z;let B=d.get(N)??0,S=r.get(N)??y;L.size.y=_.size.y-_.size.height/2+B+S/2+u,a.debug(`abc88 layout blocks (calc) px, pyid:${L.id}startingPosX${E}${u}${z}=>x:${L.size.x}y:${L.size.y}${L.widthInColumns}(width * (child?.w || 1)) / 2${T*(L?.widthInColumns??1)/2}`)}if(L.children)ye(L,o,u);let v=L?.widthInColumns??1;if(i>0)v=Math.min(v,i-w%i);w+=v,a.debug("abc88 columnsPos",L,w)}}a.debug(`layout blocks (<==layoutBlocks) ${e.id} x: ${e?.size?.x} y: ${e?.size?.y} width: ${e?.size?.width}`)}t(ye,"layoutBlocks");function we(e,{minX:o,minY:u,maxX:i,maxY:g}={minX:0,minY:0,maxX:0,maxY:0}){if(e.size&&e.id!=="root"){let{x:f,y:r,width:d,height:w}=e.size;if(f-d/2<o)o=f-d/2;if(r-w/2<u)u=r-w/2;if(f+d/2>i)i=f+d/2;if(r+w/2>g)g=r+w/2}if(e.children)for(let f of e.children)({minX:o,minY:u,maxX:i,maxY:g}=we(f,{minX:o,minY:u,maxX:i,maxY:g}));return{minX:o,minY:u,maxX:i,maxY:g}}t(we,"findBounds");function We(e){let o=e.getBlock("root");if(!o)return;let u=l()?.block?.padding??8;ee(o,e,0,0,u),ye(o,e,u),a.debug("getBlocks",JSON.stringify(o,null,2));let{minX:i,minY:g,maxX:f,maxY:r}=we(o),d=r-g,w=f-i;return{x:i,y:g,width:w,height:d}}t(We,"layout");function Ee(e,o,u=!1){let i=e,g="default";if((i?.classes?.length||0)>0)g=(i?.classes??[]).join(" ");g=g+" flowchart-label";let f=(i?.classes??[]).flatMap((y)=>o.getClasses().get(y)?.styles??[]),r=0,d="rect",w;switch(i.type){case"round":r=5,d="rect";break;case"composite":r=0,d="composite",w=0;break;case"square":d="rect";break;case"diamond":d="question";break;case"hexagon":d="hexagon";break;case"block_arrow":d="block_arrow";break;case"odd":d="rect_left_inv_arrow";break;case"lean_right":d="lean_right";break;case"lean_left":d="lean_left";break;case"trapezoid":d="trapezoid";break;case"inv_trapezoid":d="inv_trapezoid";break;case"rect_left_inv_arrow":d="rect_left_inv_arrow";break;case"circle":d="circle";break;case"ellipse":d="ellipse";break;case"stadium":d="stadium";break;case"subroutine":d="subroutine";break;case"cylinder":d="cylinder";break;case"group":d="rect";break;case"doublecircle":d="doublecircle";break;default:d="rect"}let E=oi(i?.styles??[]),k=i.label,L=i.size??{width:0,height:0,x:0,y:0},_=o.getDiagramId();return{labelStyle:E.labelStyle,shape:d,label:k,labelText:k,rx:r,ry:r,class:g,cssClasses:g,cssStyles:i?.styles??[],cssCompiledStyles:f,style:E.style,id:i.id,domId:_?`${_}-${i.id}`:i.id,isGroup:!1,directions:i.directions,width:L.width||void 0,height:L.height||void 0,wrappingWidth:L.width||Number.POSITIVE_INFINITY,x:L.x,y:L.y,positioned:u,intersect:void 0,padding:w??x()?.block?.padding??0,widthInColumns:i.widthInColumns??1,colorIndex:i.colorIndex,look:x().look}}t(Ee,"getNodeFromBlock");async function Ve(e,o,u){let i=Ee(o,u,!1);if(o.type==="group")return;let g=x(),f=await Et(e,i,{config:g}),r=f.node()?.getBBox()??{width:0,height:0},d=u.getBlock(i.id);d.size={width:r.width,height:r.height,x:0,y:0,node:f},u.setBlock(d),f.remove()}t(Ve,"calculateBlockSize");async function Ue(e,o,u){let i=Ee(o,u,!0);if(u.getBlock(i.id).type!=="space"){let f=x(),r=await Et(e,i,{config:f});if(i.colorIndex!==void 0)Ze(r,i.colorIndex,f.theme,f.themeVariables?.borderColorArray);o.intersect=i?.intersect,yt(i)}}t(Ue,"insertBlockPositioned");async function te(e,o,u,i){for(let g of o)if(await i(e,g,u),g.children)await te(e,g.children,u,i)}t(te,"performOperations");async function He(e,o,u){await te(e,o,u,Ve)}t(He,"calculateBlockSizes");async function Xe(e,o,u){await te(e,o,u,Ue)}t(Xe,"insertBlocks");async function Ge(e,o,u,i,g){let f=new re({multigraph:!0,compound:!0});f.setGraph({rankdir:"TB",nodesep:10,ranksep:10,marginx:8,marginy:8});for(let r of u)if(r.size)f.setNode(r.id,{width:r.size.width,height:r.size.height,intersect:r.intersect});for(let r of o)if(r.start&&r.end){let d=i.getBlock(r.start),w=i.getBlock(r.end);if(d?.size&&w?.size){let E=d.size,k=w.size,L=[{x:E.x,y:E.y},{x:E.x+(k.x-E.x)/2,y:E.y+(k.y-E.y)/2},{x:k.x,y:k.y}],_=g?`${g}-${r.id}`:r.id,T=r.thickness==="thick"?"edge-thickness-thick":"edge-thickness-normal",y=r.pattern==="dotted"?"edge-pattern-dotted":"edge-pattern-solid",I=`${T} ${y} flowchart-link LS-a1 LE-b1`;if(tn(e,{...r,id:_,arrowTypeEnd:r.arrowTypeEnd,arrowTypeStart:r.arrowTypeStart,points:L,classes:I},{},"block",f.node(r.start),f.node(r.end),g),r.label)await At(e,{...r,label:r.label,labelStyle:"stroke: #333; stroke-width: 1.5px;fill:none;",arrowTypeEnd:r.arrowTypeEnd,arrowTypeStart:r.arrowTypeStart,points:L,classes:I}),Yn({...r,x:L[1].x,y:L[1].y},{originalPath:L})}}}t(Ge,"insertEdges");var It=t(function(e,o){return o.db.getClasses()},"getClasses"),Ot=t(async function(e,o,u,i){let{securityLevel:g,block:f}=x(),r=i.db;r.setDiagramId(o);let d;if(g==="sandbox")d=p("#i"+o);let w=g==="sandbox"?p(d.nodes()[0].contentDocument.body):p("body"),E=g==="sandbox"?w.select(`[id="${o}"]`):p(`[id="${o}"]`);za(E,x()),Zn(E,["point","circle","cross"],i.type,o);let L=r.getBlocks(),_=r.getBlocksFlat(),T=r.getEdges(),y=E.insert("g").attr("class","block");await He(y,L,r);let I=We(r);await Xe(y,L,r),await Ge(y,T,_,r,o);let N=y.node()?.getBBox(),v=N&&Number.isFinite(N.width)&&Number.isFinite(N.height)?N:I;if(v){let z=Math.max(1,Math.round(0.125*(v.width/v.height))),B=v.height+z+10,S=v.width+10,{useMaxWidth:n}=f;F(E,B,S,!!n),a.debug("Here Bounds",I,v),E.attr("viewBox",`${v.x-5} ${v.y-5} ${v.width+10} ${v.height+10}`)}},"draw"),Ct={draw:Ot,getClasses:It},ar={parser:rt,db:wt,renderer:Ct,styles:Tt};export{ar as diagram};
139
+ ${qe()}
140
+ `,"getStyles"),Nt=Dt;function xe(e,o){if(e===0||!Number.isInteger(e))throw Error("Columns must be an integer !== 0.");if(o<0||!Number.isInteger(o))throw Error("Position must be a non-negative integer."+o);if(e<0)return{px:o,py:0};if(e===1)return{px:0,py:o};let u=o%e,i=Math.floor(o/e);return{px:u,py:i}}t(xe,"calculateBlockPosition");var It=t((e)=>{let o=0,u=0;for(let i of e.children){let{width:g,height:f,x:r,y:d}=i.size??{width:0,height:0,x:0,y:0};if(a.debug("getMaxChildSize abc95 child:",i.id,"width:",g,"height:",f,"x:",r,"y:",d,i.type),i.type==="space")continue;let w=g/(i.widthInColumns??1);if(w>o)o=w;if(f>u)u=f}return{width:o,height:u}},"getMaxChildSize");function ee(e,o,u=0,i=0,g=8){if(a.debug("setBlockSizes abc95 (start)",e.id,e?.size?.x,"block width =",e?.size,"siblingWidth",u),!e?.size?.width)e.size={width:u,height:i,x:0,y:0};let f=0,r=0;if(e.children?.length>0){for(let y of e.children)ee(y,o,0,0,g);let d=It(e);f=d.width,r=d.height,a.debug("setBlockSizes abc95 maxWidth of",e.id,":s children is ",f,r);for(let y of e.children)if(y.size)a.debug(`abc95 Setting size of children of ${e.id} id=${y.id} ${f} ${r} ${JSON.stringify(y.size)}`),y.size.width=f*(y.widthInColumns??1)+g*((y.widthInColumns??1)-1),y.size.height=r,y.size.x=0,y.size.y=0,a.debug(`abc95 updating size of ${e.id} children child:${y.id} maxWidth:${f} maxHeight:${r}`);for(let y of e.children)ee(y,o,f,r,g);let w=e.columns??-1,E=0;for(let y of e.children)E+=y.widthInColumns??1;let k=e.children.length;if(w>0&&w<E)k=w;let L=Math.ceil(E/k),_=k*(f+g)+g,T=L*(r+g)+g;if(_<u){a.debug(`Detected to small sibling: abc95 ${e.id} siblingWidth ${u} siblingHeight ${i} width ${_}`),_=u,T=i;let y=(u-k*g-g)/k,I=(i-L*g-g)/L;a.debug("Size indata abc88",e.id,"childWidth",y,"maxWidth",f),a.debug("Size indata abc88",e.id,"childHeight",I,"maxHeight",r),a.debug("Size indata abc88 xSize",k,"padding",g);for(let N of e.children)if(N.size)N.size.width=y,N.size.height=I,N.size.x=0,N.size.y=0}if(a.debug(`abc95 (finale calc) ${e.id} xSize ${k} ySize ${L} columns ${w}${e.children.length} width=${Math.max(_,e.size?.width||0)}`),_<(e?.size?.width||0)){_=e?.size?.width||0;let y=w>0?Math.min(e.children.length,w):e.children.length;if(y>0){let I=(_-y*g-g)/y;a.debug("abc95 (growing to fit) width",e.id,_,e.size?.width,I);for(let N of e.children)if(N.size)N.size.width=I}}e.size={width:_,height:T,x:0,y:0}}a.debug("setBlockSizes abc94 (done)",e.id,e?.size?.x,e?.size?.width,e?.size?.y,e?.size?.height)}t(ee,"setBlockSizes");function ye(e,o,u=8){a.debug(`abc85 layout blocks (=>layoutBlocks) ${e.id} x: ${e?.size?.x} y: ${e?.size?.y} width: ${e?.size?.width}`);let i=e.columns??-1;if(a.debug("layoutBlocks columns abc95",e.id,"=>",i,e),e.children&&e.children.length>0){let g=e?.children[0]?.size?.width??0,f=e.children.length*g+(e.children.length-1)*u;a.debug("widthOfChildren 88",f,"posX");let r=new Map;{let L=0;for(let _ of e.children){if(!_.size)continue;let{py:T}=xe(i,L),y=r.get(T)??0;if(_.size.height>y)r.set(T,_.size.height);let I=_?.widthInColumns??1;if(i>0)I=Math.min(I,i-L%i);L+=I}}let d=new Map;{let L=0,_=[...r.keys()].sort((T,y)=>T-y);for(let T of _)d.set(T,L),L+=(r.get(T)??0)+u}let w=0;a.debug("abc91 block?.size?.x",e.id,e?.size?.x);let E=e?.size?.x?e?.size?.x+(-e?.size?.width/2||0):-u,k=0;for(let L of e.children){let _=e;if(!L.size)continue;let{width:T,height:y}=L.size,{px:I,py:N}=xe(i,w);if(N!=k)k=N,E=e?.size?.x?e?.size?.x+(-e?.size?.width/2||0):-u,a.debug("New row in layout for block",e.id," and child ",L.id,k);if(a.debug(`abc89 layout blocks (child) id: ${L.id} Pos: ${w} (px, py) ${I},${N} (${_?.size?.x},${_?.size?.y}) parent: ${_.id} width: ${T}${u}`),_.size){let z=T/2;L.size.x=E+u+z,a.debug(`abc91 layout blocks (calc) px, pyid:${L.id} startingPos=X${E} new startingPosX${L.size.x} ${z} padding=${u} width=${T} halfWidth=${z} => x:${L.size.x} y:${L.size.y} ${L.widthInColumns} (width * (child?.w || 1)) / 2 ${T*(L?.widthInColumns??1)/2}`),E=L.size.x+z;let B=d.get(N)??0,S=r.get(N)??y;L.size.y=_.size.y-_.size.height/2+B+S/2+u,a.debug(`abc88 layout blocks (calc) px, pyid:${L.id}startingPosX${E}${u}${z}=>x:${L.size.x}y:${L.size.y}${L.widthInColumns}(width * (child?.w || 1)) / 2${T*(L?.widthInColumns??1)/2}`)}if(L.children)ye(L,o,u);let v=L?.widthInColumns??1;if(i>0)v=Math.min(v,i-w%i);w+=v,a.debug("abc88 columnsPos",L,w)}}a.debug(`layout blocks (<==layoutBlocks) ${e.id} x: ${e?.size?.x} y: ${e?.size?.y} width: ${e?.size?.width}`)}t(ye,"layoutBlocks");function we(e,{minX:o,minY:u,maxX:i,maxY:g}={minX:0,minY:0,maxX:0,maxY:0}){if(e.size&&e.id!=="root"){let{x:f,y:r,width:d,height:w}=e.size;if(f-d/2<o)o=f-d/2;if(r-w/2<u)u=r-w/2;if(f+d/2>i)i=f+d/2;if(r+w/2>g)g=r+w/2}if(e.children)for(let f of e.children)({minX:o,minY:u,maxX:i,maxY:g}=we(f,{minX:o,minY:u,maxX:i,maxY:g}));return{minX:o,minY:u,maxX:i,maxY:g}}t(we,"findBounds");function Ye(e){let o=e.getBlock("root");if(!o)return;let u=l()?.block?.padding??8;ee(o,e,0,0,u),ye(o,e,u),a.debug("getBlocks",JSON.stringify(o,null,2));let{minX:i,minY:g,maxX:f,maxY:r}=we(o),d=r-g,w=f-i;return{x:i,y:g,width:w,height:d}}t(Ye,"layout");function Ee(e,o,u=!1){let i=e,g="default";if((i?.classes?.length||0)>0)g=(i?.classes??[]).join(" ");g=g+" flowchart-label";let f=(i?.classes??[]).flatMap((y)=>o.getClasses().get(y)?.styles??[]),r=0,d="rect",w;switch(i.type){case"round":r=5,d="rect";break;case"composite":r=0,d="composite",w=0;break;case"square":d="rect";break;case"diamond":d="question";break;case"hexagon":d="hexagon";break;case"block_arrow":d="block_arrow";break;case"odd":d="rect_left_inv_arrow";break;case"lean_right":d="lean_right";break;case"lean_left":d="lean_left";break;case"trapezoid":d="trapezoid";break;case"inv_trapezoid":d="inv_trapezoid";break;case"rect_left_inv_arrow":d="rect_left_inv_arrow";break;case"circle":d="circle";break;case"ellipse":d="ellipse";break;case"stadium":d="stadium";break;case"subroutine":d="subroutine";break;case"cylinder":d="cylinder";break;case"group":d="rect";break;case"doublecircle":d="doublecircle";break;default:d="rect"}let E=ai(i?.styles??[]),k=i.label,L=i.size??{width:0,height:0,x:0,y:0},_=o.getDiagramId();return{labelStyle:E.labelStyle,shape:d,label:k,labelText:k,rx:r,ry:r,class:g,cssClasses:g,cssStyles:i?.styles??[],cssCompiledStyles:f,style:E.style,id:i.id,domId:_?`${_}-${i.id}`:i.id,isGroup:!1,directions:i.directions,width:L.width||void 0,height:L.height||void 0,wrappingWidth:L.width||Number.POSITIVE_INFINITY,x:L.x,y:L.y,positioned:u,intersect:void 0,padding:w??x()?.block?.padding??0,widthInColumns:i.widthInColumns??1,colorIndex:i.colorIndex,look:x().look}}t(Ee,"getNodeFromBlock");async function We(e,o,u){let i=Ee(o,u,!1);if(o.type==="group")return;let g=x(),f=await Tt(e,i,{config:g}),r=f.node()?.getBBox()??{width:0,height:0},d=u.getBlock(i.id);d.size={width:r.width,height:r.height,x:0,y:0,node:f},u.setBlock(d),f.remove()}t(We,"calculateBlockSize");async function Ve(e,o,u){let i=Ee(o,u,!0);if(u.getBlock(i.id).type!=="space"){let f=x(),r=await Tt(e,i,{config:f});if(i.colorIndex!==void 0)Xe(r,i.colorIndex,f.theme,f.themeVariables?.borderColorArray);o.intersect=i?.intersect,bt(i)}}t(Ve,"insertBlockPositioned");async function te(e,o,u,i){for(let g of o)if(await i(e,g,u),g.children)await te(e,g.children,u,i)}t(te,"performOperations");async function Ue(e,o,u){await te(e,o,u,We)}t(Ue,"calculateBlockSizes");async function He(e,o,u){await te(e,o,u,Ve)}t(He,"insertBlocks");async function je(e,o,u,i,g){let f=new re({multigraph:!0,compound:!0});f.setGraph({rankdir:"TB",nodesep:10,ranksep:10,marginx:8,marginy:8});for(let r of u)if(r.size)f.setNode(r.id,{width:r.size.width,height:r.size.height,intersect:r.intersect});for(let r of o)if(r.start&&r.end){let d=i.getBlock(r.start),w=i.getBlock(r.end);if(d?.size&&w?.size){let E=d.size,k=w.size,L=[{x:E.x,y:E.y},{x:E.x+(k.x-E.x)/2,y:E.y+(k.y-E.y)/2},{x:k.x,y:k.y}],_=g?`${g}-${r.id}`:r.id,T=r.thickness==="thick"?"edge-thickness-thick":"edge-thickness-normal",y=r.pattern==="dotted"?"edge-pattern-dotted":"edge-pattern-solid",I=`${T} ${y} flowchart-link LS-a1 LE-b1`;if(Jt(e,{...r,id:_,arrowTypeEnd:r.arrowTypeEnd,arrowTypeStart:r.arrowTypeStart,points:L,classes:I},{},"block",f.node(r.start),f.node(r.end),g),r.label)await Et(e,{...r,label:r.label,labelStyle:"stroke: #333; stroke-width: 1.5px;fill:none;",arrowTypeEnd:r.arrowTypeEnd,arrowTypeStart:r.arrowTypeStart,points:L,classes:I}),Gn({...r,x:L[1].x,y:L[1].y},{originalPath:L})}}}t(je,"insertEdges");var Ot=t(function(e,o){return o.db.getClasses()},"getClasses"),Ct=t(async function(e,o,u,i){let{securityLevel:g,block:f}=x(),r=i.db;r.setDiagramId(o);let d;if(g==="sandbox")d=p("#i"+o);let w=g==="sandbox"?p(d.nodes()[0].contentDocument.body):p("body"),E=g==="sandbox"?w.select(`[id="${o}"]`):p(`[id="${o}"]`);Ba(E,x()),Hn(E,["point","circle","cross"],i.type,o);let L=r.getBlocks(),_=r.getBlocksFlat(),T=r.getEdges(),y=E.insert("g").attr("class","block");await Ue(y,L,r);let I=Ye(r);await He(y,L,r),await je(y,T,_,r,o);let N=y.node()?.getBBox(),v=N&&Number.isFinite(N.width)&&Number.isFinite(N.height)?N:I;if(v){let z=Math.max(1,Math.round(0.125*(v.width/v.height))),B=v.height+z+10,S=v.width+10,{useMaxWidth:n}=f;F(E,B,S,!!n),a.debug("Here Bounds",I,v),E.attr("viewBox",`${v.x-5} ${v.y-5} ${v.width+10} ${v.height+10}`)}},"draw"),vt={draw:Ct,getClasses:Ot},nr={parser:rt,db:wt,renderer:vt,styles:Nt};export{nr as diagram};
@@ -0,0 +1 @@
1
+ import{sa}from"./chunk-4wwd3pfz.js";export{sa as default};
@@ -1,10 +1,10 @@
1
- import{t,b,ht,C,S,E,T,A,L,R,l,Tn,p,ae,qn,xo,Ba,Fa,Wn}from"./chunk-veam6vk4.js";import{$n,hn}from"./chunk-y2rzeb4v.js";import{Xe}from"./chunk-07agqp8h.js";function nt(n,c){let y=0;if(c===void 0){for(let g of n)if(g=+g)y+=g}else{let g=-1;for(let _ of n)if(_=+c(_,++g,n))y+=_}return y}function dt(n){var c=n.length/6|0,y=Array(c),g=0;while(g<c)y[g]="#"+n.slice(g*6,++g*6);return y}var pt=dt("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");function Et(n){return n.source}function Pt(n){return n.target}function At(n){let c=Et,y=Pt,g=Ba,_=Fa,P=null,m=null,G=qn(i);function i(){let o,f=xo.call(arguments),v=c.apply(this,f),x=y.apply(this,f);if(P==null)m=n(o=G());if(m.lineStart(),f[0]=v,m.point(+g.apply(this,f),+_.apply(this,f)),f[0]=x,m.point(+g.apply(this,f),+_.apply(this,f)),m.lineEnd(),o)return m=null,o+""||null}return i.source=function(o){return arguments.length?(c=o,i):c},i.target=function(o){return arguments.length?(y=o,i):y},i.x=function(o){return arguments.length?(g=typeof o==="function"?o:ae(+o),i):g},i.y=function(o){return arguments.length?(_=typeof o==="function"?o:ae(+o),i):_},i.context=function(o){return arguments.length?(o==null?P=m=null:m=n(P=o),i):P},i}function bt(){return At(Wn)}function Tt(n){return n.target.depth}function yt(n){return n.depth}function mt(n,c){return c-1-n.height}function rt(n,c){return n.sourceLinks.length?n.depth:c-1}function gt(n){return n.targetLinks.length?n.depth:n.sourceLinks.length?hn(n.sourceLinks,Tt)-1:0}function tt(n){return function(){return n}}function vt(n,c){return st(n.source,c.source)||n.index-c.index}function _t(n,c){return st(n.target,c.target)||n.index-c.index}function st(n,c){return n.y0-c.y0}function xt(n){return n.value}function Ct(n){return n.index}function Bt(n){return n.nodes}function Ot(n){return n.links}function St(n,c){let y=n.get(c);if(!y)throw Error("missing: "+c);return y}function wt({nodes:n}){for(let c of n){let y=c.y0,g=y;for(let _ of c.sourceLinks)_.y0=y+_.width/2,y+=_.width;for(let _ of c.targetLinks)_.y1=g+_.width/2,g+=_.width}}function ot(){let n=0,c=0,y=1,g=1,_=24,P=8,m,G=Ct,i=rt,o,f,v=Bt,x=Ot,h=6;function w(){let e={nodes:v.apply(null,arguments),links:x.apply(null,arguments)};return I(e),M(e),W(e),U(e),z(e),wt(e),e}w.update=function(e){return wt(e),e},w.nodeId=function(e){return arguments.length?(G=typeof e==="function"?e:tt(e),w):G},w.nodeAlign=function(e){return arguments.length?(i=typeof e==="function"?e:tt(e),w):i},w.nodeSort=function(e){return arguments.length?(o=e,w):o},w.nodeWidth=function(e){return arguments.length?(_=+e,w):_},w.nodePadding=function(e){return arguments.length?(P=m=+e,w):P},w.nodes=function(e){return arguments.length?(v=typeof e==="function"?e:tt(e),w):v},w.links=function(e){return arguments.length?(x=typeof e==="function"?e:tt(e),w):x},w.linkSort=function(e){return arguments.length?(f=e,w):f},w.size=function(e){return arguments.length?(n=c=0,y=+e[0],g=+e[1],w):[y-n,g-c]},w.extent=function(e){return arguments.length?(n=+e[0][0],y=+e[1][0],c=+e[0][1],g=+e[1][1],w):[[n,c],[y,g]]},w.iterations=function(e){return arguments.length?(h=+e,w):h};function I({nodes:e,links:a}){for(let[r,s]of e.entries())s.index=r,s.sourceLinks=[],s.targetLinks=[];let u=new Map(e.map((r,s)=>[G(r,s,e),r]));for(let[r,s]of a.entries()){s.index=r;let{source:d,target:k}=s;if(typeof d!=="object")d=s.source=St(u,d);if(typeof k!=="object")k=s.target=St(u,k);d.sourceLinks.push(s),k.targetLinks.push(s)}if(f!=null)for(let{sourceLinks:r,targetLinks:s}of e)r.sort(f),s.sort(f)}function M({nodes:e}){for(let a of e)a.value=a.fixedValue===void 0?Math.max(nt(a.sourceLinks,xt),nt(a.targetLinks,xt)):a.fixedValue}function W({nodes:e}){let a=e.length,u=new Set(e),r=new Set,s=0;while(u.size){for(let d of u){d.depth=s;for(let{target:k}of d.sourceLinks)r.add(k)}if(++s>a)throw Error("circular link");u=r,r=new Set}}function U({nodes:e}){let a=e.length,u=new Set(e),r=new Set,s=0;while(u.size){for(let d of u){d.height=s;for(let{source:k}of d.targetLinks)r.add(k)}if(++s>a)throw Error("circular link");u=r,r=new Set}}function Q({nodes:e}){let a=$n(e,(s)=>s.depth)+1,u=(y-n-_)/(a-1),r=Array(a);for(let s of e){let d=Math.max(0,Math.min(a-1,Math.floor(i.call(null,s,a))));if(s.layer=d,s.x0=n+d*u,s.x1=s.x0+_,r[d])r[d].push(s);else r[d]=[s]}if(o)for(let s of r)s.sort(o);return r}function q(e){let a=hn(e,(u)=>(g-c-(u.length-1)*m)/nt(u,xt));for(let u of e){let r=c;for(let s of u){s.y0=r,s.y1=r+s.value*a,r=s.y1+m;for(let d of s.sourceLinks)d.width=d.value*a}r=(g-r+m)/(u.length+1);for(let s=0;s<u.length;++s){let d=u[s];d.y0+=r*(s+1),d.y1+=r*(s+1)}K(u)}}function z(e){let a=Q(e);m=Math.min(P,(g-c)/($n(a,(u)=>u.length)-1)),q(a);for(let u=0;u<h;++u){let r=Math.pow(0.99,u),s=Math.max(1-r,(u+1)/h);D(a,r,s),B(a,r,s)}}function B(e,a,u){for(let r=1,s=e.length;r<s;++r){let d=e[r];for(let k of d){let J=0,Y=0;for(let{source:N,value:ft}of k.targetLinks){let et=ft*(k.layer-N.layer);J+=O(N,k)*et,Y+=et}if(!(Y>0))continue;let F=(J/Y-k.y0)*a;k.y0+=F,k.y1+=F,Z(k)}if(o===void 0)d.sort(st);H(d,u)}}function D(e,a,u){for(let r=e.length,s=r-2;s>=0;--s){let d=e[s];for(let k of d){let J=0,Y=0;for(let{target:N,value:ft}of k.sourceLinks){let et=ft*(N.layer-k.layer);J+=V(k,N)*et,Y+=et}if(!(Y>0))continue;let F=(J/Y-k.y0)*a;k.y0+=F,k.y1+=F,Z(k)}if(o===void 0)d.sort(st);H(d,u)}}function H(e,a){let u=e.length>>1,r=e[u];j(e,r.y0-m,u-1,a),X(e,r.y1+m,u+1,a),j(e,g,e.length-1,a),X(e,c,0,a)}function X(e,a,u,r){for(;u<e.length;++u){let s=e[u],d=(a-s.y0)*r;if(d>0.000001)s.y0+=d,s.y1+=d;a=s.y1+m}}function j(e,a,u,r){for(;u>=0;--u){let s=e[u],d=(s.y1-a)*r;if(d>0.000001)s.y0-=d,s.y1-=d;a=s.y0-m}}function Z({sourceLinks:e,targetLinks:a}){if(f===void 0){for(let{source:{sourceLinks:u}}of a)u.sort(_t);for(let{target:{targetLinks:u}}of e)u.sort(vt)}}function K(e){if(f===void 0)for(let{sourceLinks:a,targetLinks:u}of e)a.sort(_t),u.sort(vt)}function O(e,a){let u=e.y0-(e.sourceLinks.length-1)*m/2;for(let{target:r,width:s}of e.sourceLinks){if(r===a)break;u+=s+m}for(let{source:r,width:s}of a.targetLinks){if(r===e)break;u-=s}return u}function V(e,a){let u=a.y0-(a.targetLinks.length-1)*m/2;for(let{source:r,width:s}of a.targetLinks){if(r===e)break;u+=s+m}for(let{target:r,width:s}of e.sourceLinks){if(r===a)break;u-=s}return u}return w}function Rt(n){return[n.source.x1,n.y0]}function Nt(n){return[n.target.x0,n.y1]}function it(){return bt().source(Rt).target(Nt)}var kt=function(){var n=t(function(G,i,o,f){for(o=o||{},f=G.length;f--;o[G[f]]=i);return o},"o"),c=[1,9],y=[1,10],g=[1,5,10,12],_={trace:t(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SANKEY:4,NEWLINE:5,csv:6,opt_eof:7,record:8,csv_tail:9,EOF:10,"field[source]":11,COMMA:12,"field[target]":13,"field[value]":14,field:15,escaped:16,non_escaped:17,DQUOTE:18,ESCAPED_TEXT:19,NON_ESCAPED_TEXT:20,$accept:0,$end:1},terminals_:{2:"error",4:"SANKEY",5:"NEWLINE",10:"EOF",11:"field[source]",12:"COMMA",13:"field[target]",14:"field[value]",18:"DQUOTE",19:"ESCAPED_TEXT",20:"NON_ESCAPED_TEXT"},productions_:[0,[3,4],[6,2],[9,2],[9,0],[7,1],[7,0],[8,5],[15,1],[15,1],[16,3],[17,1]],performAction:t(function(i,o,f,v,x,h,w){var I=h.length-1;switch(x){case 7:let M=v.findOrCreateNode(h[I-4].trim().replaceAll('""','"')),W=v.findOrCreateNode(h[I-2].trim().replaceAll('""','"')),U=parseFloat(h[I].trim());v.addLink(M,W,U);break;case 8:case 9:case 11:this.$=h[I];break;case 10:this.$=h[I-1];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},{5:[1,3]},{6:4,8:5,15:6,16:7,17:8,18:c,20:y},{1:[2,6],7:11,10:[1,12]},n(y,[2,4],{9:13,5:[1,14]}),{12:[1,15]},n(g,[2,8]),n(g,[2,9]),{19:[1,16]},n(g,[2,11]),{1:[2,1]},{1:[2,5]},n(y,[2,2]),{6:17,8:5,15:6,16:7,17:8,18:c,20:y},{15:18,16:7,17:8,18:c,20:y},{18:[1,19]},n(y,[2,3]),{12:[1,20]},n(g,[2,10]),{15:21,16:7,17:8,18:c,20:y},n([1,5,10],[2,7])],defaultActions:{11:[2,1],12:[2,5]},parseError:t(function(i,o){if(o.recoverable)this.trace(i);else{var f=Error(i);throw f.hash=o,f}},"parseError"),parse:t(function(i){var o=this,f=[0],v=[],x=[null],h=[],w=this.table,I="",M=0,W=0,U=0,Q=2,q=1,z=h.slice.call(arguments,1),B=Object.create(this.lexer),D={yy:{}};for(var H in this.yy)if(Object.prototype.hasOwnProperty.call(this.yy,H))D.yy[H]=this.yy[H];if(B.setInput(i,D.yy),D.yy.lexer=B,D.yy.parser=this,typeof B.yylloc>"u")B.yylloc={};var X=B.yylloc;h.push(X);var j=B.options&&B.options.ranges;if(typeof D.yy.parseError==="function")this.parseError=D.yy.parseError;else this.parseError=Object.getPrototypeOf(this).parseError;function Z(N){f.length=f.length-2*N,x.length=x.length-N,h.length=h.length-N}t(Z,"popStack");function K(){var N=v.pop()||B.lex()||q;if(typeof N!=="number"){if(N instanceof Array)v=N,N=v.pop();N=o.symbols_[N]||N}return N}t(K,"lex");var O,V,e,a,u,r,s={},d,k,J,Y;while(!0){if(e=f[f.length-1],this.defaultActions[e])a=this.defaultActions[e];else{if(O===null||typeof O>"u")O=K();a=w[e]&&w[e][O]}if(typeof a>"u"||!a.length||!a[0]){var F="";Y=[];for(d in w[e])if(this.terminals_[d]&&d>Q)Y.push("'"+this.terminals_[d]+"'");if(B.showPosition)F="Parse error on line "+(M+1)+`:
1
+ import{t,b,yt,C,S,E,T,A,L,R,l,Cn,p,ae,Un,vo,Oa,$a,qn}from"./chunk-e763h2px.js";import{Pn,mn}from"./chunk-2weaa3gn.js";import{Ke}from"./chunk-j4gvtszc.js";function nt(n,c){let y=0;if(c===void 0){for(let g of n)if(g=+g)y+=g}else{let g=-1;for(let _ of n)if(_=+c(_,++g,n))y+=_}return y}function ht(n){var c=n.length/6|0,y=Array(c),g=0;while(g<c)y[g]="#"+n.slice(g*6,++g*6);return y}var dt=ht("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");function Et(n){return n.source}function Pt(n){return n.target}function At(n){let c=Et,y=Pt,g=Oa,_=$a,P=null,m=null,G=Un(i);function i(){let o,f=vo.call(arguments),v=c.apply(this,f),x=y.apply(this,f);if(P==null)m=n(o=G());if(m.lineStart(),f[0]=v,m.point(+g.apply(this,f),+_.apply(this,f)),f[0]=x,m.point(+g.apply(this,f),+_.apply(this,f)),m.lineEnd(),o)return m=null,o+""||null}return i.source=function(o){return arguments.length?(c=o,i):c},i.target=function(o){return arguments.length?(y=o,i):y},i.x=function(o){return arguments.length?(g=typeof o==="function"?o:ae(+o),i):g},i.y=function(o){return arguments.length?(_=typeof o==="function"?o:ae(+o),i):_},i.context=function(o){return arguments.length?(o==null?P=m=null:m=n(P=o),i):P},i}function bt(){return At(qn)}function Tt(n){return n.target.depth}function pt(n){return n.depth}function mt(n,c){return c-1-n.height}function rt(n,c){return n.sourceLinks.length?n.depth:c-1}function gt(n){return n.targetLinks.length?n.depth:n.sourceLinks.length?mn(n.sourceLinks,Tt)-1:0}function tt(n){return function(){return n}}function vt(n,c){return st(n.source,c.source)||n.index-c.index}function _t(n,c){return st(n.target,c.target)||n.index-c.index}function st(n,c){return n.y0-c.y0}function xt(n){return n.value}function Ct(n){return n.index}function Bt(n){return n.nodes}function Ot(n){return n.links}function St(n,c){let y=n.get(c);if(!y)throw Error("missing: "+c);return y}function wt({nodes:n}){for(let c of n){let y=c.y0,g=y;for(let _ of c.sourceLinks)_.y0=y+_.width/2,y+=_.width;for(let _ of c.targetLinks)_.y1=g+_.width/2,g+=_.width}}function ot(){let n=0,c=0,y=1,g=1,_=24,P=8,m,G=Ct,i=rt,o,f,v=Bt,x=Ot,h=6;function w(){let e={nodes:v.apply(null,arguments),links:x.apply(null,arguments)};return I(e),M(e),W(e),U(e),z(e),wt(e),e}w.update=function(e){return wt(e),e},w.nodeId=function(e){return arguments.length?(G=typeof e==="function"?e:tt(e),w):G},w.nodeAlign=function(e){return arguments.length?(i=typeof e==="function"?e:tt(e),w):i},w.nodeSort=function(e){return arguments.length?(o=e,w):o},w.nodeWidth=function(e){return arguments.length?(_=+e,w):_},w.nodePadding=function(e){return arguments.length?(P=m=+e,w):P},w.nodes=function(e){return arguments.length?(v=typeof e==="function"?e:tt(e),w):v},w.links=function(e){return arguments.length?(x=typeof e==="function"?e:tt(e),w):x},w.linkSort=function(e){return arguments.length?(f=e,w):f},w.size=function(e){return arguments.length?(n=c=0,y=+e[0],g=+e[1],w):[y-n,g-c]},w.extent=function(e){return arguments.length?(n=+e[0][0],y=+e[1][0],c=+e[0][1],g=+e[1][1],w):[[n,c],[y,g]]},w.iterations=function(e){return arguments.length?(h=+e,w):h};function I({nodes:e,links:a}){for(let[r,s]of e.entries())s.index=r,s.sourceLinks=[],s.targetLinks=[];let u=new Map(e.map((r,s)=>[G(r,s,e),r]));for(let[r,s]of a.entries()){s.index=r;let{source:d,target:k}=s;if(typeof d!=="object")d=s.source=St(u,d);if(typeof k!=="object")k=s.target=St(u,k);d.sourceLinks.push(s),k.targetLinks.push(s)}if(f!=null)for(let{sourceLinks:r,targetLinks:s}of e)r.sort(f),s.sort(f)}function M({nodes:e}){for(let a of e)a.value=a.fixedValue===void 0?Math.max(nt(a.sourceLinks,xt),nt(a.targetLinks,xt)):a.fixedValue}function W({nodes:e}){let a=e.length,u=new Set(e),r=new Set,s=0;while(u.size){for(let d of u){d.depth=s;for(let{target:k}of d.sourceLinks)r.add(k)}if(++s>a)throw Error("circular link");u=r,r=new Set}}function U({nodes:e}){let a=e.length,u=new Set(e),r=new Set,s=0;while(u.size){for(let d of u){d.height=s;for(let{source:k}of d.targetLinks)r.add(k)}if(++s>a)throw Error("circular link");u=r,r=new Set}}function Q({nodes:e}){let a=Pn(e,(s)=>s.depth)+1,u=(y-n-_)/(a-1),r=Array(a);for(let s of e){let d=Math.max(0,Math.min(a-1,Math.floor(i.call(null,s,a))));if(s.layer=d,s.x0=n+d*u,s.x1=s.x0+_,r[d])r[d].push(s);else r[d]=[s]}if(o)for(let s of r)s.sort(o);return r}function q(e){let a=mn(e,(u)=>(g-c-(u.length-1)*m)/nt(u,xt));for(let u of e){let r=c;for(let s of u){s.y0=r,s.y1=r+s.value*a,r=s.y1+m;for(let d of s.sourceLinks)d.width=d.value*a}r=(g-r+m)/(u.length+1);for(let s=0;s<u.length;++s){let d=u[s];d.y0+=r*(s+1),d.y1+=r*(s+1)}K(u)}}function z(e){let a=Q(e);m=Math.min(P,(g-c)/(Pn(a,(u)=>u.length)-1)),q(a);for(let u=0;u<h;++u){let r=Math.pow(0.99,u),s=Math.max(1-r,(u+1)/h);D(a,r,s),B(a,r,s)}}function B(e,a,u){for(let r=1,s=e.length;r<s;++r){let d=e[r];for(let k of d){let J=0,Y=0;for(let{source:N,value:ft}of k.targetLinks){let et=ft*(k.layer-N.layer);J+=O(N,k)*et,Y+=et}if(!(Y>0))continue;let F=(J/Y-k.y0)*a;k.y0+=F,k.y1+=F,Z(k)}if(o===void 0)d.sort(st);H(d,u)}}function D(e,a,u){for(let r=e.length,s=r-2;s>=0;--s){let d=e[s];for(let k of d){let J=0,Y=0;for(let{target:N,value:ft}of k.sourceLinks){let et=ft*(N.layer-k.layer);J+=V(k,N)*et,Y+=et}if(!(Y>0))continue;let F=(J/Y-k.y0)*a;k.y0+=F,k.y1+=F,Z(k)}if(o===void 0)d.sort(st);H(d,u)}}function H(e,a){let u=e.length>>1,r=e[u];j(e,r.y0-m,u-1,a),X(e,r.y1+m,u+1,a),j(e,g,e.length-1,a),X(e,c,0,a)}function X(e,a,u,r){for(;u<e.length;++u){let s=e[u],d=(a-s.y0)*r;if(d>0.000001)s.y0+=d,s.y1+=d;a=s.y1+m}}function j(e,a,u,r){for(;u>=0;--u){let s=e[u],d=(s.y1-a)*r;if(d>0.000001)s.y0-=d,s.y1-=d;a=s.y0-m}}function Z({sourceLinks:e,targetLinks:a}){if(f===void 0){for(let{source:{sourceLinks:u}}of a)u.sort(_t);for(let{target:{targetLinks:u}}of e)u.sort(vt)}}function K(e){if(f===void 0)for(let{sourceLinks:a,targetLinks:u}of e)a.sort(_t),u.sort(vt)}function O(e,a){let u=e.y0-(e.sourceLinks.length-1)*m/2;for(let{target:r,width:s}of e.sourceLinks){if(r===a)break;u+=s+m}for(let{source:r,width:s}of a.targetLinks){if(r===e)break;u-=s}return u}function V(e,a){let u=a.y0-(a.targetLinks.length-1)*m/2;for(let{source:r,width:s}of a.targetLinks){if(r===e)break;u+=s+m}for(let{target:r,width:s}of e.sourceLinks){if(r===a)break;u-=s}return u}return w}function Rt(n){return[n.source.x1,n.y0]}function Nt(n){return[n.target.x0,n.y1]}function it(){return bt().source(Rt).target(Nt)}var kt=function(){var n=t(function(G,i,o,f){for(o=o||{},f=G.length;f--;o[G[f]]=i);return o},"o"),c=[1,9],y=[1,10],g=[1,5,10,12],_={trace:t(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SANKEY:4,NEWLINE:5,csv:6,opt_eof:7,record:8,csv_tail:9,EOF:10,"field[source]":11,COMMA:12,"field[target]":13,"field[value]":14,field:15,escaped:16,non_escaped:17,DQUOTE:18,ESCAPED_TEXT:19,NON_ESCAPED_TEXT:20,$accept:0,$end:1},terminals_:{2:"error",4:"SANKEY",5:"NEWLINE",10:"EOF",11:"field[source]",12:"COMMA",13:"field[target]",14:"field[value]",18:"DQUOTE",19:"ESCAPED_TEXT",20:"NON_ESCAPED_TEXT"},productions_:[0,[3,4],[6,2],[9,2],[9,0],[7,1],[7,0],[8,5],[15,1],[15,1],[16,3],[17,1]],performAction:t(function(i,o,f,v,x,h,w){var I=h.length-1;switch(x){case 7:let M=v.findOrCreateNode(h[I-4].trim().replaceAll('""','"')),W=v.findOrCreateNode(h[I-2].trim().replaceAll('""','"')),U=parseFloat(h[I].trim());v.addLink(M,W,U);break;case 8:case 9:case 11:this.$=h[I];break;case 10:this.$=h[I-1];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},{5:[1,3]},{6:4,8:5,15:6,16:7,17:8,18:c,20:y},{1:[2,6],7:11,10:[1,12]},n(y,[2,4],{9:13,5:[1,14]}),{12:[1,15]},n(g,[2,8]),n(g,[2,9]),{19:[1,16]},n(g,[2,11]),{1:[2,1]},{1:[2,5]},n(y,[2,2]),{6:17,8:5,15:6,16:7,17:8,18:c,20:y},{15:18,16:7,17:8,18:c,20:y},{18:[1,19]},n(y,[2,3]),{12:[1,20]},n(g,[2,10]),{15:21,16:7,17:8,18:c,20:y},n([1,5,10],[2,7])],defaultActions:{11:[2,1],12:[2,5]},parseError:t(function(i,o){if(o.recoverable)this.trace(i);else{var f=Error(i);throw f.hash=o,f}},"parseError"),parse:t(function(i){var o=this,f=[0],v=[],x=[null],h=[],w=this.table,I="",M=0,W=0,U=0,Q=2,q=1,z=h.slice.call(arguments,1),B=Object.create(this.lexer),D={yy:{}};for(var H in this.yy)if(Object.prototype.hasOwnProperty.call(this.yy,H))D.yy[H]=this.yy[H];if(B.setInput(i,D.yy),D.yy.lexer=B,D.yy.parser=this,typeof B.yylloc>"u")B.yylloc={};var X=B.yylloc;h.push(X);var j=B.options&&B.options.ranges;if(typeof D.yy.parseError==="function")this.parseError=D.yy.parseError;else this.parseError=Object.getPrototypeOf(this).parseError;function Z(N){f.length=f.length-2*N,x.length=x.length-N,h.length=h.length-N}t(Z,"popStack");function K(){var N=v.pop()||B.lex()||q;if(typeof N!=="number"){if(N instanceof Array)v=N,N=v.pop();N=o.symbols_[N]||N}return N}t(K,"lex");var O,V,e,a,u,r,s={},d,k,J,Y;while(!0){if(e=f[f.length-1],this.defaultActions[e])a=this.defaultActions[e];else{if(O===null||typeof O>"u")O=K();a=w[e]&&w[e][O]}if(typeof a>"u"||!a.length||!a[0]){var F="";Y=[];for(d in w[e])if(this.terminals_[d]&&d>Q)Y.push("'"+this.terminals_[d]+"'");if(B.showPosition)F="Parse error on line "+(M+1)+`:
2
2
  `+B.showPosition()+`
3
3
  Expecting `+Y.join(", ")+", got '"+(this.terminals_[O]||O)+"'";else F="Parse error on line "+(M+1)+": Unexpected "+(O==q?"end of input":"'"+(this.terminals_[O]||O)+"'");this.parseError(F,{text:B.match,token:this.terminals_[O]||O,line:B.yylineno,loc:X,expected:Y})}if(a[0]instanceof Array&&a.length>1)throw Error("Parse Error: multiple actions possible at state: "+e+", token: "+O);switch(a[0]){case 1:if(f.push(O),x.push(B.yytext),h.push(B.yylloc),f.push(a[1]),O=null,!V){if(W=B.yyleng,I=B.yytext,M=B.yylineno,X=B.yylloc,U>0)U--}else O=V,V=null;break;case 2:if(k=this.productions_[a[1]][1],s.$=x[x.length-k],s._$={first_line:h[h.length-(k||1)].first_line,last_line:h[h.length-1].last_line,first_column:h[h.length-(k||1)].first_column,last_column:h[h.length-1].last_column},j)s._$.range=[h[h.length-(k||1)].range[0],h[h.length-1].range[1]];if(r=this.performAction.apply(s,[I,W,M,D.yy,a[1],x,h].concat(z)),typeof r<"u")return r;if(k)f=f.slice(0,-1*k*2),x=x.slice(0,-1*k),h=h.slice(0,-1*k);f.push(this.productions_[a[1]][0]),x.push(s.$),h.push(s._$),J=w[f[f.length-2]][f[f.length-1]],f.push(J);break;case 3:return!0}}return!0},"parse")},P=function(){var G={EOF:1,parseError:t(function(o,f){if(this.yy.parser)this.yy.parser.parseError(o,f);else throw Error(o)},"parseError"),setInput:t(function(i,o){if(this.yy=o||this.yy||{},this._input=i,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:t(function(){var i=this._input[0];this.yytext+=i,this.yyleng++,this.offset++,this.match+=i,this.matched+=i;var o=i.match(/(?:\r\n?|\n).*/g);if(o)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),i},"input"),unput:t(function(i){var o=i.length,f=i.split(/(?:\r\n?|\n)/g);this._input=i+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-o),this.offset-=o;var v=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),f.length-1)this.yylineno-=f.length-1;var x=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:f?(f.length===v.length?this.yylloc.first_column:0)+v[v.length-f.length].length-f[0].length:this.yylloc.first_column-o},this.options.ranges)this.yylloc.range=[x[0],x[0]+this.yyleng-o];return this.yyleng=this.yytext.length,this},"unput"),more:t(function(){return this._more=!0,this},"more"),reject:t(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).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:t(function(i){this.unput(this.match.slice(i))},"less"),pastInput:t(function(){var i=this.matched.substr(0,this.matched.length-this.match.length);return(i.length>20?"...":"")+i.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:t(function(){var i=this.match;if(i.length<20)i+=this._input.substr(0,20-i.length);return(i.substr(0,20)+(i.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:t(function(){var i=this.pastInput(),o=Array(i.length+1).join("-");return i+this.upcomingInput()+`
5
5
  `+o+"^"},"showPosition"),test_match:t(function(i,o){var f,v,x;if(this.options.backtrack_lexer){if(x={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)x.yylloc.range=this.yylloc.range.slice(0)}if(v=i[0].match(/(?:\r\n?|\n).*/g),v)this.yylineno+=v.length;if(this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:v?v[v.length-1].length-v[v.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+i[0].length},this.yytext+=i[0],this.match+=i[0],this.matches=i,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(i[0].length),this.matched+=i[0],f=this.performAction.call(this,this.yy,this,o,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input)this.done=!1;if(f)return f;else if(this._backtrack){for(var h in x)this[h]=x[h];return!1}return!1},"test_match"),next:t(function(){if(this.done)return this.EOF;if(!this._input)this.done=!0;var i,o,f,v;if(!this._more)this.yytext="",this.match="";var x=this._currentRules();for(var h=0;h<x.length;h++)if(f=this._input.match(this.rules[x[h]]),f&&(!o||f[0].length>o[0].length)){if(o=f,v=h,this.options.backtrack_lexer)if(i=this.test_match(f,x[h]),i!==!1)return i;else if(this._backtrack){o=!1;continue}else return!1;else if(!this.options.flex)break}if(o){if(i=this.test_match(o,x[v]),i!==!1)return i;return!1}if(this._input==="")return this.EOF;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
6
- `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:t(function(){var o=this.next();if(o)return o;else return this.lex()},"lex"),begin:t(function(o){this.conditionStack.push(o)},"begin"),popState:t(function(){var o=this.conditionStack.length-1;if(o>0)return this.conditionStack.pop();else return this.conditionStack[0]},"popState"),_currentRules:t(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:t(function(o){if(o=this.conditionStack.length-1-Math.abs(o||0),o>=0)return this.conditionStack[o];else return"INITIAL"},"topState"),pushState:t(function(o){this.begin(o)},"pushState"),stateStackSize:t(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:t(function(o,f,v,x){var h=x;switch(v){case 0:return this.pushState("csv"),4;break;case 1:return this.pushState("csv"),4;break;case 2:return 10;case 3:return 5;case 4:return 12;case 5:return this.pushState("escaped_text"),18;break;case 6:return 20;case 7:return this.popState("escaped_text"),18;break;case 8:return 19}},"anonymous"),rules:[/^(?:sankey-beta\b)/i,/^(?:sankey\b)/i,/^(?:$)/i,/^(?:((\u000D\u000A)|(\u000A)))/i,/^(?:(\u002C))/i,/^(?:(\u0022))/i,/^(?:([\u0020-\u0021\u0023-\u002B\u002D-\u007E])*)/i,/^(?:(\u0022)(?!(\u0022)))/i,/^(?:(([\u0020-\u0021\u0023-\u002B\u002D-\u007E])|(\u002C)|(\u000D)|(\u000A)|(\u0022)(\u0022))*)/i],conditions:{csv:{rules:[2,3,4,5,6,7,8],inclusive:!1},escaped_text:{rules:[7,8],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8],inclusive:!0}}};return G}();_.lexer=P;function m(){this.yy={}}return t(m,"Parser"),m.prototype=_,_.Parser=m,new m}();kt.parser=kt;var at=kt,ct=[],ut=[],lt=new Map,Gt=t(()=>{ct=[],ut=[],lt=new Map,C()},"clear"),It=class{constructor(n,c,y=0){this.source=n,this.target=c,this.value=y}static{t(this,"SankeyLink")}},Mt=t((n,c,y)=>{ct.push(new It(n,c,y))},"addLink"),Yt=class{constructor(n){this.ID=n}static{t(this,"SankeyNode")}},Dt=t((n)=>{n=b.sanitizeText(n,l());let c=lt.get(n);if(c===void 0)c=new Yt(n),lt.set(n,c),ut.push(c);return c},"findOrCreateNode"),jt=t(()=>ut,"getNodes"),$t=t(()=>ct,"getLinks"),zt=t(()=>({nodes:ut.map((n)=>({id:n.ID})),links:ct.map((n)=>({source:n.source.ID,target:n.target.ID,value:n.value}))}),"getGraph"),Vt={nodesMap:lt,getConfig:t(()=>l().sankey,"getConfig"),getNodes:jt,getLinks:$t,getGraph:zt,addLink:Mt,findOrCreateNode:Dt,getAccTitle:E,setAccTitle:S,getAccDescription:A,setAccDescription:T,getDiagramTitle:R,setDiagramTitle:L,clear:Gt},Lt=class n{static{t(this,"Uid")}static{this.count=0}static next(c){return new n(c+ ++n.count)}constructor(c){this.id=c,this.href=`#${c}`}toString(){return"url("+this.href+")"}},Ft={left:yt,right:mt,center:gt,justify:rt},Wt=t((n)=>{let c=0,y=0;for(let g of n){let _=g.value??0;if(_>c)c=_,y=g.layer??0}return y},"findCentralNodeLayer"),Ut=t(function(n,c,y,g){let{securityLevel:_,sankey:P}=l(),m=Tn.sankey,G;if(_==="sandbox")G=p("#i"+c);let i=_==="sandbox"?p(G.nodes()[0].contentDocument.body):p("body"),o=_==="sandbox"?i.select(`[id="${c}"]`):p(`[id="${c}"]`),f=P?.width??m.width,v=P?.height??m.width,x=P?.useMaxWidth??m.useMaxWidth,h=P?.nodeAlignment??m.nodeAlignment,w=P?.prefix??m.prefix,I=P?.suffix??m.suffix,M=P?.showValues??m.showValues,W=P?.nodeWidth??m.nodeWidth??10,U=P?.nodePadding??m.nodePadding??12,Q=P?.labelStyle??m.labelStyle??"legacy",q=P?.nodeColors??{},z=g.db.getGraph(),B=Ft[h];ot().nodeId((r)=>r.id).nodeWidth(W).nodePadding(U+(M?15:0)).nodeAlign(B).extent([[0,0],[f,v]])(z);let H=Wt(z.nodes),X=Xe(pt),j=t((r)=>q[r]??X(r),"getNodeColor");o.append("g").attr("class","nodes").selectAll(".node").data(z.nodes).join("g").attr("class","node").attr("id",(r)=>(r.uid=Lt.next("node-")).id).attr("transform",function(r){return"translate("+r.x0+","+r.y0+")"}).attr("x",(r)=>r.x0).attr("y",(r)=>r.y0).append("rect").attr("height",(r)=>r.y1-r.y0).attr("width",(r)=>r.x1-r.x0).attr("fill",(r)=>j(r.id));let Z=t(({id:r,value:s})=>{if(!M)return r;return`${r}
7
- ${w}${Math.round(s*100)/100}${I}`},"getText"),K=t((r)=>{if(Q==="outlined"){if((r.layer??0)<H)return{x:r.x0-6,anchor:"end"};return{x:r.x1+6,anchor:"start"}}if(r.x0<f/2)return{x:r.x1+6,anchor:"start"};return{x:r.x0-6,anchor:"end"}},"getLabelPosition"),O=o.append("g").attr("class","node-labels").attr("font-size",14),V=t((r)=>O.selectAll(r?`.${r}`:"text").data(z.nodes).join("text").attr("class",r??null).attr("x",(s)=>K(s).x).attr("y",(s)=>(s.y1+s.y0)/2).attr("dy",`${M?"0":"0.35"}em`).attr("text-anchor",(s)=>K(s).anchor).text(Z),"appendLabel");if(Q==="outlined")V("sankey-label-bg"),V("sankey-label-fg");else V();let e=o.append("g").attr("class","links").attr("fill","none").attr("stroke-opacity",0.5).selectAll(".link").data(z.links).join("g").attr("class","link").style("mix-blend-mode","multiply"),a=P?.linkColor??"gradient";if(a==="gradient"){let r=e.append("linearGradient").attr("id",(s)=>(s.uid=Lt.next("linearGradient-")).id).attr("gradientUnits","userSpaceOnUse").attr("x1",(s)=>s.source.x1).attr("x2",(s)=>s.target.x0);r.append("stop").attr("offset","0%").attr("stop-color",(s)=>j(s.source.id)),r.append("stop").attr("offset","100%").attr("stop-color",(s)=>j(s.target.id))}let u;switch(a){case"gradient":u=t((r)=>r.uid,"coloring");break;case"source":u=t((r)=>j(r.source.id),"coloring");break;case"target":u=t((r)=>j(r.target.id),"coloring");break;default:u=a}e.append("path").attr("d",it()).attr("stroke",u).attr("stroke-width",(r)=>Math.max(1,r.width)),ht(void 0,o,0,x)},"draw"),Ht={draw:Ut},Xt=t((n)=>n.replaceAll(/^[^\S\n\r]+|[^\S\n\r]+$/g,"").replaceAll(/([\n\r])+/g,`
6
+ `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:t(function(){var o=this.next();if(o)return o;else return this.lex()},"lex"),begin:t(function(o){this.conditionStack.push(o)},"begin"),popState:t(function(){var o=this.conditionStack.length-1;if(o>0)return this.conditionStack.pop();else return this.conditionStack[0]},"popState"),_currentRules:t(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:t(function(o){if(o=this.conditionStack.length-1-Math.abs(o||0),o>=0)return this.conditionStack[o];else return"INITIAL"},"topState"),pushState:t(function(o){this.begin(o)},"pushState"),stateStackSize:t(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:t(function(o,f,v,x){var h=x;switch(v){case 0:return this.pushState("csv"),4;break;case 1:return this.pushState("csv"),4;break;case 2:return 10;case 3:return 5;case 4:return 12;case 5:return this.pushState("escaped_text"),18;break;case 6:return 20;case 7:return this.popState("escaped_text"),18;break;case 8:return 19}},"anonymous"),rules:[/^(?:sankey-beta\b)/i,/^(?:sankey\b)/i,/^(?:$)/i,/^(?:((\u000D\u000A)|(\u000A)))/i,/^(?:(\u002C))/i,/^(?:(\u0022))/i,/^(?:([\u0020-\u0021\u0023-\u002B\u002D-\u007E])*)/i,/^(?:(\u0022)(?!(\u0022)))/i,/^(?:(([\u0020-\u0021\u0023-\u002B\u002D-\u007E])|(\u002C)|(\u000D)|(\u000A)|(\u0022)(\u0022))*)/i],conditions:{csv:{rules:[2,3,4,5,6,7,8],inclusive:!1},escaped_text:{rules:[7,8],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8],inclusive:!0}}};return G}();_.lexer=P;function m(){this.yy={}}return t(m,"Parser"),m.prototype=_,_.Parser=m,new m}();kt.parser=kt;var at=kt,ct=[],ut=[],lt=new Map,Gt=t(()=>{ct=[],ut=[],lt=new Map,C()},"clear"),It=class{constructor(n,c,y=0){this.source=n,this.target=c,this.value=y}static{t(this,"SankeyLink")}},Mt=t((n,c,y)=>{ct.push(new It(n,c,y))},"addLink"),Yt=class{constructor(n){this.ID=n}static{t(this,"SankeyNode")}},Dt=t((n)=>{n=b.sanitizeText(n,l());let c=lt.get(n);if(c===void 0)c=new Yt(n),lt.set(n,c),ut.push(c);return c},"findOrCreateNode"),jt=t(()=>ut,"getNodes"),$t=t(()=>ct,"getLinks"),zt=t(()=>({nodes:ut.map((n)=>({id:n.ID})),links:ct.map((n)=>({source:n.source.ID,target:n.target.ID,value:n.value}))}),"getGraph"),Vt={nodesMap:lt,getConfig:t(()=>l().sankey,"getConfig"),getNodes:jt,getLinks:$t,getGraph:zt,addLink:Mt,findOrCreateNode:Dt,getAccTitle:E,setAccTitle:S,getAccDescription:A,setAccDescription:T,getDiagramTitle:R,setDiagramTitle:L,clear:Gt},Lt=class n{static{t(this,"Uid")}static{this.count=0}static next(c){return new n(c+ ++n.count)}constructor(c){this.id=c,this.href=`#${c}`}toString(){return"url("+this.href+")"}},Ft={left:pt,right:mt,center:gt,justify:rt},Wt=t((n)=>{let c=0,y=0;for(let g of n){let _=g.value??0;if(_>c)c=_,y=g.layer??0}return y},"findCentralNodeLayer"),Ut=t(function(n,c,y,g){let{securityLevel:_,sankey:P}=l(),m=Cn.sankey,G;if(_==="sandbox")G=p("#i"+c);let i=_==="sandbox"?p(G.nodes()[0].contentDocument.body):p("body"),o=_==="sandbox"?i.select(`[id="${c}"]`):p(`[id="${c}"]`),f=P?.width??m.width,v=P?.height??m.width,x=P?.useMaxWidth??m.useMaxWidth,h=P?.nodeAlignment??m.nodeAlignment,w=P?.prefix??m.prefix,I=P?.suffix??m.suffix,M=P?.showValues??m.showValues,W=P?.nodeWidth??m.nodeWidth??10,U=P?.nodePadding??m.nodePadding??12,Q=P?.labelStyle??m.labelStyle??"legacy",q=P?.nodeColors??{},z=g.db.getGraph(),B=Ft[h];ot().nodeId((r)=>r.id).nodeWidth(W).nodePadding(U+(M?15:0)).nodeAlign(B).extent([[0,0],[f,v]])(z);let H=Wt(z.nodes),X=Ke(dt),j=t((r)=>q[r]??X(r),"getNodeColor");o.append("g").attr("class","nodes").selectAll(".node").data(z.nodes).join("g").attr("class","node").attr("id",(r)=>(r.uid=Lt.next("node-")).id).attr("transform",function(r){return"translate("+r.x0+","+r.y0+")"}).attr("x",(r)=>r.x0).attr("y",(r)=>r.y0).append("rect").attr("height",(r)=>r.y1-r.y0).attr("width",(r)=>r.x1-r.x0).attr("fill",(r)=>j(r.id));let Z=t(({id:r,value:s})=>{if(!M)return r;return`${r}
7
+ ${w}${Math.round(s*100)/100}${I}`},"getText"),K=t((r)=>{if(Q==="outlined"){if((r.layer??0)<H)return{x:r.x0-6,anchor:"end"};return{x:r.x1+6,anchor:"start"}}if(r.x0<f/2)return{x:r.x1+6,anchor:"start"};return{x:r.x0-6,anchor:"end"}},"getLabelPosition"),O=o.append("g").attr("class","node-labels").attr("font-size",14),V=t((r)=>O.selectAll(r?`.${r}`:"text").data(z.nodes).join("text").attr("class",r??null).attr("x",(s)=>K(s).x).attr("y",(s)=>(s.y1+s.y0)/2).attr("dy",`${M?"0":"0.35"}em`).attr("text-anchor",(s)=>K(s).anchor).text(Z),"appendLabel");if(Q==="outlined")V("sankey-label-bg"),V("sankey-label-fg");else V();let e=o.append("g").attr("class","links").attr("fill","none").attr("stroke-opacity",0.5).selectAll(".link").data(z.links).join("g").attr("class","link").style("mix-blend-mode","multiply"),a=P?.linkColor??"gradient";if(a==="gradient"){let r=e.append("linearGradient").attr("id",(s)=>(s.uid=Lt.next("linearGradient-")).id).attr("gradientUnits","userSpaceOnUse").attr("x1",(s)=>s.source.x1).attr("x2",(s)=>s.target.x0);r.append("stop").attr("offset","0%").attr("stop-color",(s)=>j(s.source.id)),r.append("stop").attr("offset","100%").attr("stop-color",(s)=>j(s.target.id))}let u;switch(a){case"gradient":u=t((r)=>r.uid,"coloring");break;case"source":u=t((r)=>j(r.source.id),"coloring");break;case"target":u=t((r)=>j(r.target.id),"coloring");break;default:u=a}e.append("path").attr("d",it()).attr("stroke",u).attr("stroke-width",(r)=>Math.max(1,r.width)),yt(void 0,o,0,x)},"draw"),Ht={draw:Ut},Xt=t((n)=>n.replaceAll(/^[^\S\n\r]+|[^\S\n\r]+$/g,"").replaceAll(/([\n\r])+/g,`
8
8
  `).trim(),"prepareTextForParsing"),Jt=t((n)=>`.label {
9
9
  font-family: ${n.fontFamily};
10
10
  }
@@ -0,0 +1 @@
1
+ import{g,o,i,r,f,e,n,y,s,te,ot,ve,ce,ne,je,ut,ee,X}from"./chunk-kahab58k.js";import{Nr,Pr,Or}from"./chunk-f79ajymt.js";var $e=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],xe=s("rotate-cw",$e);function Ce(t){let m=[],h="",v,j=!1;for(let l=0;l<t.length;l++){let p=t.charAt(l);if(v)if(p===v)v=void 0;else if(p==="\\"&&v==='"'&&l+1<t.length)h+=t[++l];else h+=p;else if(p==='"'||p==="'")v=p,j=!0;else if(p==="\\"&&l+1<t.length)h+=t[++l],j=!0;else if(/\s/.test(p)){if(j||h)m.push(h);h="",j=!1}else h+=p,j=!0}if(j||h)m.push(h);return m}function fe(t){return t.map((m)=>m===""||/[\s"'\\]/.test(m)?`"${m.replace(/(["\\])/g,"\\$1")}"`:m).join(" ")}var Ne="size-4 cursor-pointer rounded border-line text-accent accent-accent focus-visible:outline-2 focus-visible:outline-accent",Pe={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 ge(t){if(t==="project")return"项目";if(t==="file")return".mcp.json";return"全局"}function de(t){return t.type==="local"?fe(t.command):t.url}function he({info:t,tools:m=!1}){let h=Pe[t.status.status];return n("span",{className:"inline-flex shrink-0 items-center gap-1.5 text-xs text-dim",children:[e("span",{"aria-hidden":!0,className:`size-1.5 shrink-0 rounded-full ${h.dot}`}),e("span",{className:m?void 0:"hidden @md/panel:inline",children:h.label}),m&&t.status.status==="connected"&&n("span",{className:"text-faint",children:[t.toolCount," 个工具"]})]})}function we(t){let{Button:m,CopyButton:h,DetailChip:v,DetailList:j,DetailRow:l,DetailTitle:p,Dialog:I,Switch:E,Tooltip:ie,cn:c,confirm:x,useTheme:re}=y();re();let{info:d,connection:R}=t,C=t.projectID?`?projectID=${encodeURIComponent(t.projectID)}`:"",[J,le]=r(),[K,_]=r(),[M,P]=r(!1),W=d.status.status==="connected",S=d.status.status==="needs_auth",z=d.status.status==="failed",L=d.config.type==="remote"&&Boolean(d.config.oauth),H=d.scope==="file";o(()=>{function u(w){if(w&&w!==d.name)return;R.request(`/api/mcp/${encodeURIComponent(d.name)}/connect${C}`,{method:"POST"}).then((se)=>t.onChanged(se)).catch(()=>{})}function oe(w){if(w.data?.type==="mcp-oauth-success")u(w.data.name)}function ue(w){if(w.key==="basalt-mcp-oauth-event"&&w.newValue)try{let se=JSON.parse(w.newValue);u(se.name)}catch(se){}}window.addEventListener("message",oe),window.addEventListener("storage",ue);let U;if("BroadcastChannel"in window)U=new BroadcastChannel("basalt-mcp-oauth"),U.onmessage=(w)=>{if(w.data?.type==="mcp-oauth-success")u(w.data.name)};return()=>{window.removeEventListener("message",oe),window.removeEventListener("storage",ue),U?.close()}},[R,d.name,C,t]),o(()=>{if(d.status.status!=="connected")return;R.request(`/api/mcp/${encodeURIComponent(d.name)}/tools${C}`).then((u)=>{if(Array.isArray(u))le(u),_(void 0)}).catch((u)=>{_(u instanceof Error?u.message:"获取工具失败")})},[R,d.name,C,d.status.status]);async function ae(u){P(!0);try{let oe=await R.request(`/api/mcp/${encodeURIComponent(d.name)}/${u}${C}`,{method:"POST"});t.onChanged(oe)}catch{}finally{P(!1)}}async function B(){P(!0);try{let u=d.status.status==="needs_auth"?d.status.authorizationUrl:void 0;if(!u)u=(await R.request(`/api/mcp/${encodeURIComponent(d.name)}/oauth/authorize${C}`,{method:"POST"})).authorizationUrl;if(u)window.open(u,"_blank","width=600,height=700")}catch(u){_(u instanceof Error?u.message:"获取授权链接失败")}finally{P(!1)}}async function a(){P(!0);try{let u=await R.request(`/api/mcp/${encodeURIComponent(d.name)}/oauth/clear${C}`,{method:"POST"});t.onChanged(u)}finally{P(!1)}}async function T(){if(!await x({title:`删除 ${d.name}?`,description:"删除后将断开连接并不再向会话提供其工具。",action:"删除",danger:!0}))return;P(!0);try{await R.request(`/api/mcp/${encodeURIComponent(d.name)}${C}`,{method:"DELETE"}),t.onChanged(),t.onClose()}finally{P(!1)}}let N=d.config,D=de(N),G="error"in d.status?d.status.error:void 0,Q=N.enabled===!1,Z=!Q&&!S;return e(I,{open:!0,onOpenChange:(u)=>{if(!u&&!M)t.onClose()},title:e(p,{icon:N.type==="local"?e(ut,{}):e(ve,{}),name:d.name,meta:[N.type==="local"?"本地命令":"远程服务",ge(d.scope),L&&"OAuth 2.0"]}),size:"lg",footer:n("div",{className:"flex w-full items-center justify-between gap-2 max-sm:[&>*]:flex-none",children:[n("div",{className:"inline-flex items-center gap-2.5 text-[13px] text-dim",children:[!H&&e(E,{label:`启用 ${d.name}`,checked:!Q,disabled:M||t.toggling,onCheckedChange:t.onToggle}),e(he,{info:d,tools:!0})]}),n("div",{className:"flex items-center gap-1.5",children:[L&&e(m,{type:"button",variant:"ghost",size:"sm",onClick:a,disabled:M,children:"清除凭据"}),!H&&e(ie,{label:"删除服务器",children:e(m,{type:"button",variant:"danger-ghost",size:"icon","aria-label":"删除服务器",onClick:T,disabled:M,children:e(ee,{className:"size-4"})})}),Z&&e(ie,{label:"终止服务进程并重新启动,让更新后的代码生效",children:e(m,{type:"button",variant:"ghost",size:"icon","aria-label":"重启",onClick:()=>ae("restart"),disabled:M,children:e(xe,{className:c("size-4",M&&"animate-spin")})})}),Z&&e(m,{type:"button",size:"sm",onClick:()=>ae(W?"disconnect":"connect"),disabled:M,children:W?"断开连接":"连接"}),!H&&n(m,{type:"button",size:"sm",onClick:t.onEdit,disabled:M,children:[e(je,{className:"size-3.5"}),e("span",{children:"编辑配置"})]})]})]}),children:n(j,{children:[n(l,{label:N.type==="local"?"命令":"地址",children:[e("span",{className:"min-w-0 font-mono text-[12px] text-dim leading-5.5 [overflow-wrap:anywhere]",children:D}),e(h,{text:D,label:"复制",size:"icon-xs",className:"shrink-0 text-faint hover:text-ink"})]}),S&&n(l,{label:"授权",children:[e("span",{className:"text-dim leading-7",children:"需要完成 OAuth 授权后才能使用,令牌会自动保存。"}),e(m,{type:"button",variant:"primary",size:"sm",onClick:B,disabled:M,children:"前往授权"})]}),z&&e(l,{label:"错误",children:e("p",{className:"min-w-0 font-mono text-[11.5px] text-danger leading-5 [overflow-wrap:anywhere]",children:G})}),e(l,{label:"工具",children:K?e("span",{className:"text-danger",children:K}):!W?e("span",{className:"text-faint",children:"连接后列出工具"}):!J?e("span",{role:"status",className:"text-faint",children:"正在获取"}):J.length===0?e("span",{className:"text-faint",children:"服务器没有声明任何工具"}):J.map((u)=>e(v,{mono:!0,title:u.description,children:u.name},u.name))})]})})}var De=/^[A-Za-z0-9_-]{1,64}$/;function V(t){return e("span",{className:"truncate text-xs text-faint",children:t.children})}function ke(t){let{pairs:m,onChange:h,InputComponent:v}=t,j=(l,p)=>h(m.map((I,E)=>E===l?{...I,...p}:I));return n("div",{className:"space-y-2",children:[n("div",{className:"flex min-h-7 items-center gap-2",children:[e("span",{className:"shrink-0 text-[13px] font-medium text-dim",children:t.label}),e(V,{children:t.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:()=>h([...m,{key:"",value:"",saved:!1}]),children:[e(ce,{className:"size-3.5"}),"添加"]})]}),m.map((l,p)=>n("div",{className:"flex min-w-0 items-center gap-1.5",children:[e(v,{"aria-label":`${t.keyLabel} ${p+1}`,placeholder:t.keyLabel,value:l.key,readOnly:l.saved,onChange:(I)=>j(p,{key:I.target.value}),className:"min-w-0 flex-[2] font-mono text-xs"}),e(v,{"aria-label":`${t.keyLabel} ${l.key||p+1} 的值`,type:"password",autoComplete:"off",placeholder:l.saved?"已保存,留空保持不变":"值",value:l.value,onChange:(I)=>j(p,{value:I.target.value}),className:"min-w-0 flex-[3] font-mono text-xs"}),e("button",{type:"button","aria-label":`删除 ${l.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:()=>h(m.filter((I,E)=>E!==p)),children:e(X,{className:"size-4"})})]},p))]})}function Ie(t){return Object.keys(t??{}).map((m)=>({key:m,value:"",saved:!0}))}function Se(t){let{Button:m,Segmented:h,Dialog:v,Form:j,Field:l,Input:p,Switch:I,style:E,useTheme:ie}=y();ie();let{existing:c}=t,[x,re]=r(c?.config.type??"local"),[d,R]=r(c?.name??""),[C,J]=r(c?.config.type==="local"?fe(c.config.command):""),[le,K]=r(c?.config.type==="remote"?c.config.url:""),[_,M]=r(Ie(c?.config.type==="local"?c.config.environment:void 0)),[P,W]=r(Ie(c?.config.type==="remote"?c.config.headers:void 0)),S=c?.config.type==="remote"?c.config.oauth:void 0,[z,L]=r(Boolean(S)),[H,ae]=r(typeof S==="object"&&S.clientId?S.clientId:""),[B,a]=r(""),[T,N]=r(typeof S==="object"&&S.scope?S.scope:""),[D,G]=r(c?.config.defer??"default"),[Q,Z]=r(c?.config.timeout!==void 0?String(c.config.timeout):""),[u,oe]=r(c?.config.defer!==void 0||c?.config.timeout!==void 0),[ue,U]=r(),[w,se]=r(!1);async function Te(b){b.preventDefault(),U(void 0);let k=d.trim();if(!c&&!De.test(k)){U("名称只能包含英文字母、数字、下划线与中划线,长度 1-64");return}if(!c&&t.taken.includes(k)){U("同名服务器已存在");return}let me=Q.trim()?Number.parseInt(Q.trim(),10):void 0;if(me!==void 0&&(!Number.isFinite(me)||me<=0)){U("超时时间须为大于 0 的毫秒数");return}let be;if(x==="local"){let A=Ce(C.trim());if(!A.length){U("请输入启动命令");return}let F={};for(let q of _){let O=q.key.trim();if(!O)continue;if(!q.saved||q.value)F[O]=q.value}be={type:"local",command:A,environment:Object.keys(F).length?F:void 0,enabled:c?c.config.enabled:!0,defer:D==="default"?void 0:D,timeout:me}}else{let A=le.trim();try{let O=new URL(A);if(O.protocol!=="http:"&&O.protocol!=="https:")throw Error("bad protocol")}catch{U("请输入合法的 HTTP 或 HTTPS 地址");return}let F={};for(let O of P){let pe=O.key.trim();if(!pe)continue;if(!O.saved||O.value)F[pe]=O.value}let q;if(z){let O=H.trim(),pe=B.trim(),ye=T.trim();if(O||pe||ye)q={clientId:O||void 0,clientSecret:pe||void 0,scope:ye||void 0};else q=!0}else q=!1;be={type:"remote",url:A,headers:Object.keys(F).length?F:void 0,oauth:q,enabled:c?c.config.enabled:!0,defer:D==="default"?void 0:D,timeout:me}}se(!0);try{let A=c?.name??k,F=c?c.projectID:t.projectID,q=F?`?projectID=${encodeURIComponent(F)}`:"";await t.connection.request(`/api/mcp/${encodeURIComponent(A)}${q}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(be)}),t.onSaved()}catch(A){U(A instanceof Error?A.message:"保存失败")}finally{se(!1)}}return e(v,{open:!0,onOpenChange:(b)=>{if(!b&&!w)t.onClose()},title:c?`编辑 ${c.name}`:"添加 MCP 服务器",size:"lg",footer:n("div",{className:"flex w-full justify-end gap-2.5",children:[e(m,{type:"button",variant:"ghost",onClick:t.onClose,disabled:w,className:"min-w-20",children:"取消"}),e(m,{type:"submit",form:"mcp-server-form",variant:"primary",disabled:w,className:"min-w-24",children:w?"保存中...":"保存"})]}),children:n(j,{id:"mcp-server-form",onSubmit:Te,children:[e(h,{value:x,onChange:(b)=>re(b),className:"w-full [&>button]:flex-1",options:[{value:"local",label:"本地(标准输入输出)"},{value:"remote",label:"远程(HTTP / SSE)"}]}),!c&&e(l,{label:"名称",aside:e(V,{children:"唯一标识,如 postgres"}),children:(b)=>e(p,{id:b,value:d,onChange:(k)=>R(k.target.value),placeholder:"postgres",className:"font-mono text-xs"})}),x==="local"?n(f,{children:[e(l,{label:"启动命令",aside:e(V,{children:"完整命令及参数"}),children:(b)=>e(p,{id:b,value:C,onChange:(k)=>J(k.target.value),placeholder:"npx -y @modelcontextprotocol/server-postgres ...",className:"font-mono text-xs"})}),e(ke,{label:"环境变量",tip:"启动进程时注入",keyLabel:"变量名",pairs:_,onChange:M,InputComponent:p})]}):n(f,{children:[e(l,{label:"服务地址",aside:e(V,{children:"HTTP / HTTPS 端点"}),children:(b)=>e(p,{id:b,value:le,onChange:(k)=>K(k.target.value),placeholder:"https://example.com/mcp",className:"font-mono text-xs"})}),e(ke,{label:"请求头",tip:"随每次请求发送",keyLabel:"头字段",pairs:P,onChange:W,InputComponent:p}),n("div",{className:"flex items-center justify-between gap-4",children:[n("div",{className:"min-w-0",children:[e("span",{className:"block text-[13px] font-medium text-dim",children:"OAuth 2.0 认证"}),e("span",{className:"block truncate text-xs text-faint",children:"自动发现授权端点,使用 PKCE 并刷新令牌"})]}),e(I,{checked:z,onCheckedChange:L,label:"启用 OAuth 2.0"})]}),z&&n(f,{children:[e(l,{label:"Client ID",aside:e(V,{children:"留空自动动态注册(DCR)"}),children:(b)=>e(p,{id:b,value:H,onChange:(k)=>ae(k.target.value),placeholder:"留空自动动态注册",className:"font-mono text-xs"})}),e(l,{label:"Client Secret",aside:e(V,{children:"留空保持不变"}),children:(b)=>e(p,{id:b,type:"password",autoComplete:"off",value:B,onChange:(k)=>a(k.target.value),placeholder:"••••••••",className:"font-mono text-xs"})}),e(l,{label:"Scope",aside:e(V,{children:"选填授权范围"}),children:(b)=>e(p,{id:b,value:T,onChange:(k)=>N(k.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":u,className:"flex w-full cursor-pointer items-center gap-1.5 text-[13px] font-medium text-dim transition-colors hover:text-ink",onClick:()=>oe(!u),children:[e(ot,{className:`size-3.5 transition-transform ${u?"rotate-90":""}`}),"高级设置",e("span",{className:"truncate text-xs font-normal text-faint",children:"加载时机、超时"})]}),u&&n("div",{className:"grid grid-cols-2 gap-3 max-sm:grid-cols-1",children:[e(l,{label:"加载时机",aside:e(V,{children:"延迟 = 按需加载"}),children:()=>e(h,{value:D,onChange:(b)=>G(b),className:"w-full [&>button]:flex-1",options:[{value:"default",label:"默认"},{value:"defer",label:"延迟"},{value:"always",label:"常驻"}]})}),e(l,{label:"超时(毫秒)",aside:e(V,{children:"留空用默认"}),children:(b)=>e(p,{id:b,value:Q,onChange:(k)=>Z(k.target.value),placeholder:"默认",className:"font-mono text-xs"})})]})]}),ue&&n("div",{role:"alert",className:E("callout.base",E("callout.danger"),"px-3 py-2.5 text-xs"),children:[e(te,{className:"mt-0.5 size-3.5 shrink-0"}),e("span",{className:"min-w-0 break-words",children:ue})]})]})})}var Y="global";function at({connection:t}){let{Button:m,Select:h,style:v,useTheme:j}=y();j();let[l,p]=r(""),[I,E]=r(),[ie,c]=r([]),[x,re]=r(Y),[d,R]=r(),[C,J]=r(!1),[le,K]=r(),[_,M]=r(!1),P=i(!1),[W,S]=r(),z=i(0),L=g(async()=>{let a=++z.current;J(!0);try{let T=x===Y?"":`?projectID=${encodeURIComponent(x)}`,[N,D]=await Promise.all([t.request(`/api/mcp${T}`),t.request("/api/mcp/projects")]);if(a!==z.current)return;if(E(N),c(D),x!==Y&&!D.some((G)=>G.id===x))re(Y);R(void 0)}catch(T){if(a===z.current)R(T instanceof Error?T.message:"读取失败")}finally{if(a===z.current)J(!1)}},[t,x]);o(()=>(L(),()=>{z.current++}),[L]);async function H(a,T){if(P.current)return;P.current=!0,M(!0);let N=z.current;try{let D=a.projectID?`?projectID=${encodeURIComponent(a.projectID)}`:"",G=await t.request(`/api/mcp/${encodeURIComponent(a.name)}${D}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({...a.config,enabled:T})});if(N===z.current)E((Q)=>Q?.map((Z)=>Z.name===G.name&&Z.projectID===G.projectID?G:Z))}finally{P.current=!1,M(!1)}}let ae=I?.filter((a)=>`${a.name} ${de(a.config)}`.toLowerCase().includes(l.trim().toLowerCase())),B=I?.find((a)=>a.name===le);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:[e("h2",{className:v("settings.groupTitle"),children:"MCP 服务器"}),e("p",{className:v("settings.groupDesc"),children:"外部工具与数据源管理"})]}),n("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[e(h,{value:x,disabled:C,onValueChange:(a)=>{K(void 0),S(void 0),E(void 0),re(a)},groups:[{options:[{value:Y,label:"全局"}]},...Nr(ie)],className:"w-44"}),e(m,{variant:"ghost",disabled:C,onClick:L,className:"h-9 px-2.5 text-xs",children:e(ne,{className:`size-3.5 ${C?"animate-spin":""}`})}),n(m,{variant:"secondary",onClick:()=>S({}),className:"h-9 px-2.5 text-xs",children:[e(ce,{className:"size-3.5 mr-1"}),"添加服务器"]})]})]}),d&&n("div",{role:"alert",className:v("callout.base",v("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 服务器:",d]}),e(m,{disabled:C,onClick:L,children:"重试"})]}),e(Pr,{label:"搜索 MCP 服务器",placeholder:"搜索服务器",value:l,onChange:p}),e("div",{className:v("settings.groupBox"),children:!I?e(Or,{}):ae?.length===0?e("p",{className:"p-4 text-sm text-dim",children:"没有匹配的 MCP 服务器"}):e("ul",{className:"divide-y divide-line",children:ae?.map((a)=>{let T=a.config.enabled===!1,N=a.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 ${T?"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":`查看 ${a.name}`,title:N?"来自项目的 .mcp.json,配置只读,可查看工具与重启":void 0,onClick:()=>K(a.name),children:[e("span",{"aria-hidden":!0,className:"flex size-9 shrink-0 items-center justify-center rounded-lg bg-raised text-dim",children:a.config.type==="local"?e(ut,{className:"size-4"}):e(ve,{className:"size-4"})}),n("span",{className:"min-w-0 flex-1",children:[e("span",{className:"block truncate text-sm font-medium text-ink",title:a.name,children:a.name}),e("span",{className:"mt-0.5 block truncate font-mono text-xs text-dim",title:de(a.config),children:de(a.config)})]}),e("span",{className:v("control.badge","shrink-0 text-[11px] text-dim"),children:ge(a.scope)}),e(he,{info:a})]}),!N&&e("span",{className:"relative flex size-10 shrink-0 items-center justify-center",children:e("input",{type:"checkbox","aria-label":`启用服务器 ${a.name}`,className:Ne,disabled:_||C,checked:!T,onChange:(D)=>H(a,D.target.checked)})})]},a.name)})})})]}),B&&!W&&e(we,{connection:t,info:B,toggling:_,onToggle:(a)=>H(B,a),projectID:x===Y?void 0:x,onClose:()=>K(void 0),onEdit:()=>S({info:B}),onChanged:(a)=>a?E((T)=>T?.map((N)=>N.name===a.name?a:N)):L()},`${B.projectID}:${B.name}`),W&&e(Se,{connection:t,projectID:x===Y?void 0:x,existing:W.info,taken:(I??[]).filter((a)=>a.scope===(x===Y?"global":"project")).map((a)=>a.name),onClose:()=>S(void 0),onSaved:()=>{S(void 0),L()}})]})}export{at as McpSection};