@bkm016/basalt 0.1.2 → 0.1.4

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 (152) hide show
  1. package/{chunk-x1xss1d7.js → chunk-1vd0f74z.js} +2 -2
  2. package/{chunk-v9fea96h.js → chunk-2hbfk5xd.js} +2 -2
  3. package/{chunk-5j1krv9v.js → chunk-2zp1mv3q.js} +1 -1
  4. package/{chunk-d2j735sd.js → chunk-3ct2tkr8.js} +2 -2
  5. package/{chunk-c7x1zq39.js → chunk-3x94302m.js} +1 -1
  6. package/{chunk-gzxnene8.js → chunk-4w17tzp5.js} +2 -2
  7. package/{chunk-1zdwrgd4.js → chunk-5dfbezv9.js} +1 -1
  8. package/{chunk-shhrr741.js → chunk-5x1sankd.js} +24 -24
  9. package/{chunk-pmqtkqsf.js → chunk-71h08f4g.js} +1 -1
  10. package/{chunk-fm0k0qtz.js → chunk-7afmgncg.js} +2 -2
  11. package/{chunk-v258nxcz.js → chunk-7nzhdrv9.js} +1 -1
  12. package/{chunk-zmsgwr3s.js → chunk-7q51n619.js} +1 -1
  13. package/{chunk-y0m980k3.js → chunk-7tbya5b5.js} +3 -3
  14. package/{chunk-8tjad3r0.js → chunk-8wc8qdx8.js} +5 -5
  15. package/{chunk-gp7y0fja.js → chunk-9rmqgc3c.js} +9 -9
  16. package/{chunk-nbb9trwz.js → chunk-akr0a8nc.js} +2 -2
  17. package/{chunk-k506w58v.js → chunk-aky4tztg.js} +2 -2
  18. package/{chunk-8296hw9m.js → chunk-em187cy3.js} +2 -2
  19. package/{chunk-2esbgxps.js → chunk-ev6yvy5y.js} +5 -5
  20. package/{chunk-75m78j7x.js → chunk-f3xadvab.js} +2 -2
  21. package/{chunk-5c9j8qe4.js → chunk-fvn32nzj.js} +26 -26
  22. package/{chunk-bannb9xm.js → chunk-jk25nt60.js} +1 -1
  23. package/{chunk-27gntzs5.js → chunk-kp22kaez.js} +1 -1
  24. package/{chunk-6hssbcgj.js → chunk-nmca5h6m.js} +1 -1
  25. package/{chunk-d8gtbw9g.js → chunk-pjyn2s97.js} +1 -1
  26. package/{chunk-rtzqqngy.js → chunk-q7t30zz2.js} +2 -2
  27. package/{chunk-aefadsy6.js → chunk-r0scgfwx.js} +1 -1
  28. package/{chunk-hwr56pfj.js → chunk-rmj5b73e.js} +1 -1
  29. package/{chunk-1qpces5a.js → chunk-vexrrw1b.js} +2 -2
  30. package/chunk-vkpvcxjr.js +2 -0
  31. package/{chunk-3cjsd292.js → chunk-whvj83b7.js} +2 -2
  32. package/{chunk-z55bmysw.js → chunk-xh3vr5vz.js} +1 -1
  33. package/{chunk-10xzzn07.js → chunk-zggzfa7j.js} +2 -2
  34. package/compiled.js +3 -3
  35. package/package.json +1 -1
  36. package/ui-test-worker.js +13 -13
  37. package/web/{chunk-shbw6wg8.js → chunk-0b47eyrf.js} +1 -1
  38. package/web/{chunk-vz5ck6x9.js → chunk-0h0vb6gt.js} +1 -1
  39. package/web/{chunk-24k0r5aq.js → chunk-0rmkpsgp.js} +1 -1
  40. package/web/{chunk-3mvr2gwh.js → chunk-0xkyryrq.js} +1 -1
  41. package/web/{chunk-284a17k8.js → chunk-0z0y25zf.js} +1 -1
  42. package/web/{chunk-ezkqa7we.js → chunk-1eg9sbbt.js} +1 -1
  43. package/web/{chunk-raqqscwa.js → chunk-1gbd61z0.js} +1 -1
  44. package/web/{chunk-s3rdx28k.js → chunk-2s0bmrkv.js} +1 -1
  45. package/web/{chunk-9re6yttj.js → chunk-2z1rwr28.js} +1 -1
  46. package/web/{chunk-avwpjsxw.js → chunk-344bq59c.js} +1 -1
  47. package/web/{chunk-kgerjbn4.js → chunk-3re8y26v.js} +1 -1
  48. package/web/chunk-3t0211rw.js +1 -0
  49. package/web/{chunk-q1pkntc6.js → chunk-42e3b9hv.js} +1 -1
  50. package/web/chunk-44rmrmcn.js +1 -0
  51. package/web/{chunk-aqm3spxt.js → chunk-4bzqrwr0.js} +89 -89
  52. package/web/{chunk-5e7ygjdn.js → chunk-4d3a7xs2.js} +1 -1
  53. package/web/{chunk-2pjdtesn.js → chunk-4jmazh6x.js} +1 -1
  54. package/web/{chunk-r92sbgwv.js → chunk-4re74xwm.js} +1 -1
  55. package/web/{chunk-rc2vq9wz.js → chunk-5qtyq3ce.js} +1 -1
  56. package/web/{chunk-vj6kstpp.js → chunk-5z4jcqct.js} +1 -1
  57. package/web/{chunk-abbvjt4e.js → chunk-5z6x2n5h.js} +1 -1
  58. package/web/{chunk-yen2kkn2.js → chunk-6cnek1xh.js} +1 -1
  59. package/web/chunk-6f5ke0x9.js +1 -0
  60. package/web/{chunk-vkc149rb.js → chunk-6xaqxcq8.js} +1 -1
  61. package/web/chunk-7q6wvv2x.js +1 -0
  62. package/web/{chunk-43jqvsrg.js → chunk-7qsa4p8h.js} +1 -1
  63. package/web/chunk-8nja0ygy.js +1 -0
  64. package/web/{chunk-4bry4xds.js → chunk-8y64fkpz.js} +1 -1
  65. package/web/{chunk-rkj743fg.js → chunk-92ssjk2y.js} +1 -1
  66. package/web/chunk-9ad7v7bm.js +8 -0
  67. package/web/{chunk-xdcs8qz3.js → chunk-9cx1be43.js} +1 -1
  68. package/web/{chunk-jf2ehmvp.js → chunk-9dzxv335.js} +1 -1
  69. package/web/{chunk-t1xk6hca.js → chunk-9t5dnjaz.js} +2 -2
  70. package/web/{chunk-h31p43qa.js → chunk-a408enpy.js} +1 -1
  71. package/web/{chunk-z24vs8q9.js → chunk-a497tykb.js} +1 -1
  72. package/web/{chunk-qryrg2pq.js → chunk-aqfpnhmt.js} +2 -2
  73. package/web/{chunk-rrws61wf.js → chunk-b1bgzz66.js} +1 -1
  74. package/web/{chunk-cwvtraca.js → chunk-b53bfkys.js} +1 -1
  75. package/web/{chunk-5jbf7n5q.js → chunk-b6k9w215.js} +1 -1
  76. package/web/{chunk-ctcrk3qn.js → chunk-bhsaj6qq.js} +1 -1
  77. package/web/chunk-cjfssg3m.js +2 -0
  78. package/web/{chunk-znvnb9dh.js → chunk-d11v5s7w.js} +1 -1
  79. package/web/{chunk-ctd8bfg2.js → chunk-df5zx17h.js} +1 -1
  80. package/web/chunk-e0zre35a.js +1 -0
  81. package/web/{chunk-3z93efr4.js → chunk-e9twvs9n.js} +1 -1
  82. package/web/chunk-f2kgtyfp.js +1 -0
  83. package/web/{chunk-8wye0wbb.js → chunk-f4tacm06.js} +1 -1
  84. package/web/chunk-f8bn5tzf.js +1 -0
  85. package/web/chunk-fdp9bsj7.js +1 -0
  86. package/web/{chunk-8ah6ce1b.js → chunk-fh2vj0wv.js} +1 -1
  87. package/web/{chunk-5rx8rtsa.js → chunk-gmzqdm7v.js} +1 -1
  88. package/web/{chunk-fqj9kry9.js → chunk-hvw3gn2a.js} +1 -1
  89. package/web/{chunk-fy8ey195.js → chunk-khxcn8tt.js} +1 -1
  90. package/web/{chunk-z760wagr.js → chunk-kmr7r9xj.js} +1 -1
  91. package/web/chunk-kqqmp1am.js +1 -0
  92. package/web/{chunk-s3hwejnr.js → chunk-kwccs9f6.js} +1 -1
  93. package/web/chunk-nbgqbxcy.js +1 -0
  94. package/web/{chunk-yjv2c45j.js → chunk-ncpnpe9w.js} +1 -1
  95. package/web/{chunk-g8ee1csm.js → chunk-ne0v8mfb.js} +1 -1
  96. package/web/{chunk-f078k1ej.js → chunk-ngx2cp8x.js} +1 -1
  97. package/web/{chunk-xa88zgkr.js → chunk-nvhmq4z5.js} +1 -1
  98. package/web/chunk-nxcgf7ec.js +1 -0
  99. package/web/{chunk-anbn2ttv.js → chunk-p0kvmf28.js} +1 -1
  100. package/web/chunk-p3k7m5nr.js +1 -0
  101. package/web/{chunk-jzmzhj8z.js → chunk-pggaffrh.js} +1 -1
  102. package/web/{chunk-zrzq29e6.js → chunk-pjkdrgm0.js} +1 -1
  103. package/web/{chunk-jmnaq7c1.js → chunk-pws2seas.js} +1 -1
  104. package/web/{chunk-1z5p7a1h.js → chunk-pz9ps2jm.js} +1 -1
  105. package/web/chunk-qh15dxav.css +1 -0
  106. package/web/chunk-qpmbxhh6.js +1 -0
  107. package/web/chunk-r0rctnxz.js +1 -0
  108. package/web/chunk-rn3dnqm8.js +1 -0
  109. package/web/{chunk-jvj66qhs.js → chunk-rvrf0f3h.js} +1 -1
  110. package/web/{chunk-pk3ap3wh.js → chunk-sfg2wkhe.js} +1 -1
  111. package/web/{chunk-tn1xzmgx.js → chunk-sspfxp5e.js} +1 -1
  112. package/web/{chunk-dt8ss97f.js → chunk-t4c8xavd.js} +1 -1
  113. package/web/{chunk-vny496ba.js → chunk-tdr6x2xc.js} +1 -1
  114. package/web/chunk-tncvg1nn.js +1 -0
  115. package/web/{chunk-6qejm5s2.js → chunk-vyp0ns1f.js} +1 -1
  116. package/web/{chunk-kww4azv5.js → chunk-wnskxerq.js} +1 -1
  117. package/web/{chunk-9dd1c37b.js → chunk-wvdehm9y.js} +66 -66
  118. package/web/chunk-x7ahcpj7.js +1 -0
  119. package/web/chunk-y38bf0wm.js +1 -0
  120. package/web/{chunk-vjqmnkh2.js → chunk-y56aaba5.js} +1 -1
  121. package/web/{chunk-mjpjkyd1.js → chunk-ybrf9mhz.js} +1 -1
  122. package/web/{chunk-8e43yaq3.js → chunk-ye58t45p.js} +3 -3
  123. package/web/{chunk-dk90px7g.js → chunk-yqbnps3a.js} +1 -1
  124. package/web/{chunk-bt1m87ck.js → chunk-z1h20s8c.js} +1 -1
  125. package/web/{chunk-693m9kt7.js → chunk-zj4q9jth.js} +1 -1
  126. package/web/{chunk-tnv7z83q.js → chunk-zj5k94dk.js} +1 -1
  127. package/web/{chunk-986z0p48.js → chunk-zqch0sc8.js} +1 -1
  128. package/web/{chunk-agmkx996.js → chunk-zx8zec24.js} +1 -1
  129. package/web/index.html +1 -1
  130. package/chunk-09rj27b2.js +0 -2
  131. package/web/chunk-0sewdyz1.js +0 -1
  132. package/web/chunk-21ke27j6.js +0 -1
  133. package/web/chunk-3t3zwx9j.js +0 -1
  134. package/web/chunk-5xc9d5ft.js +0 -1
  135. package/web/chunk-b470hvpk.js +0 -1
  136. package/web/chunk-fekjj24p.css +0 -1
  137. package/web/chunk-frjfamx7.js +0 -8
  138. package/web/chunk-h5p5jsrw.js +0 -1
  139. package/web/chunk-h9fmr6ch.js +0 -1
  140. package/web/chunk-jq0pw0k2.js +0 -1
  141. package/web/chunk-k4cfnvyq.js +0 -1
  142. package/web/chunk-m29dhjkh.js +0 -1
  143. package/web/chunk-mj6tee5h.js +0 -1
  144. package/web/chunk-szcy5z56.js +0 -1
  145. package/web/chunk-t2hhdg9r.js +0 -1
  146. package/web/chunk-tj4cmkwe.js +0 -1
  147. package/web/chunk-v2b5q0n5.js +0 -1
  148. package/web/chunk-y5x74t89.js +0 -1
  149. package/web/chunk-yx3dh5hg.js +0 -1
  150. package/web/chunk-yz4fmtk2.js +0 -1
  151. package/web/chunk-z5j6x6j8.js +0 -2
  152. package/web/chunk-z5stjrhc.js +0 -1
@@ -0,0 +1 @@
1
+ import{ki}from"./chunk-aqfpnhmt.js";export{ki as createPieServices};
@@ -0,0 +1 @@
1
+ import{_i}from"./chunk-aqfpnhmt.js";export{_i as createInfoServices};
@@ -1,2 +1,2 @@
1
- import{e}from"./chunk-9dd1c37b.js";function W(c,i){if(c.accDescr)i.setAccDescription?.(c.accDescr);if(c.accTitle)i.setAccTitle?.(c.accTitle);if(c.title)i.setDiagramTitle?.(c.title)}e(W,"populateCommonDb");
1
+ import{e}from"./chunk-wvdehm9y.js";function W(c,i){if(c.accDescr)i.setAccDescription?.(c.accDescr);if(c.accTitle)i.setAccTitle?.(c.accTitle);if(c.title)i.setDiagramTitle?.(c.title)}e(W,"populateCommonDb");
2
2
  export{W};
@@ -1,4 +1,4 @@
1
- import{e,r,ne,O,y,B,S,E,T,A,s,p,Dn,Yr,He,w,Kr}from"./chunk-9dd1c37b.js";import{nn}from"./chunk-jvj66qhs.js";var Gt=function(){var t=e(function(wt,k,R,D){for(R=R||{},D=wt.length;D--;R[wt[D]]=k);return R},"o"),n=[1,24],o=[1,25],l=[1,26],f=[1,27],u=[1,28],a=[1,63],d=[1,64],i=[1,65],_=[1,66],g=[1,67],m=[1,68],v=[1,69],P=[1,29],Y=[1,30],z=[1,31],F=[1,32],U=[1,33],H=[1,34],rt=[1,35],st=[1,36],at=[1,37],it=[1,38],ot=[1,39],lt=[1,40],ct=[1,41],ut=[1,42],ht=[1,43],dt=[1,44],pt=[1,45],ft=[1,46],yt=[1,47],_t=[1,48],bt=[1,50],mt=[1,51],gt=[1,52],xt=[1,53],vt=[1,54],kt=[1,55],Et=[1,56],St=[1,57],Tt=[1,58],Ct=[1,59],Rt=[1,60],Bt=[14,42],$t=[14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],Yt=[12,14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],N=[1,82],L=[1,83],I=[1,84],M=[1,85],V=[12,14,42],ye=[12,14,33,42],Xt=[12,14,33,42,76,77,79,80],Nt=[12,33],te=[34,36,37,38,39,40,41,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],ee={trace:e(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,direction:5,direction_tb:6,direction_bt:7,direction_rl:8,direction_lr:9,graphConfig:10,C4_CONTEXT:11,NEWLINE:12,statements:13,EOF:14,C4_CONTAINER:15,C4_COMPONENT:16,C4_DYNAMIC:17,C4_DEPLOYMENT:18,otherStatements:19,diagramStatements:20,otherStatement:21,title:22,accDescription:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,boundaryStatement:29,boundaryStartStatement:30,boundaryStopStatement:31,boundaryStart:32,LBRACE:33,ENTERPRISE_BOUNDARY:34,attributes:35,SYSTEM_BOUNDARY:36,BOUNDARY:37,CONTAINER_BOUNDARY:38,NODE:39,NODE_L:40,NODE_R:41,RBRACE:42,diagramStatement:43,PERSON:44,PERSON_EXT:45,SYSTEM:46,SYSTEM_DB:47,SYSTEM_QUEUE:48,SYSTEM_EXT:49,SYSTEM_EXT_DB:50,SYSTEM_EXT_QUEUE:51,CONTAINER:52,CONTAINER_DB:53,CONTAINER_QUEUE:54,CONTAINER_EXT:55,CONTAINER_EXT_DB:56,CONTAINER_EXT_QUEUE:57,COMPONENT:58,COMPONENT_DB:59,COMPONENT_QUEUE:60,COMPONENT_EXT:61,COMPONENT_EXT_DB:62,COMPONENT_EXT_QUEUE:63,REL:64,BIREL:65,REL_U:66,REL_D:67,REL_L:68,REL_R:69,REL_B:70,REL_INDEX:71,UPDATE_EL_STYLE:72,UPDATE_REL_STYLE:73,UPDATE_LAYOUT_CONFIG:74,attribute:75,STR:76,STR_KEY:77,STR_VALUE:78,ATTRIBUTE:79,ATTRIBUTE_EMPTY:80,$accept:0,$end:1},terminals_:{2:"error",6:"direction_tb",7:"direction_bt",8:"direction_rl",9:"direction_lr",11:"C4_CONTEXT",12:"NEWLINE",14:"EOF",15:"C4_CONTAINER",16:"C4_COMPONENT",17:"C4_DYNAMIC",18:"C4_DEPLOYMENT",22:"title",23:"accDescription",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"LBRACE",34:"ENTERPRISE_BOUNDARY",36:"SYSTEM_BOUNDARY",37:"BOUNDARY",38:"CONTAINER_BOUNDARY",39:"NODE",40:"NODE_L",41:"NODE_R",42:"RBRACE",44:"PERSON",45:"PERSON_EXT",46:"SYSTEM",47:"SYSTEM_DB",48:"SYSTEM_QUEUE",49:"SYSTEM_EXT",50:"SYSTEM_EXT_DB",51:"SYSTEM_EXT_QUEUE",52:"CONTAINER",53:"CONTAINER_DB",54:"CONTAINER_QUEUE",55:"CONTAINER_EXT",56:"CONTAINER_EXT_DB",57:"CONTAINER_EXT_QUEUE",58:"COMPONENT",59:"COMPONENT_DB",60:"COMPONENT_QUEUE",61:"COMPONENT_EXT",62:"COMPONENT_EXT_DB",63:"COMPONENT_EXT_QUEUE",64:"REL",65:"BIREL",66:"REL_U",67:"REL_D",68:"REL_L",69:"REL_R",70:"REL_B",71:"REL_INDEX",72:"UPDATE_EL_STYLE",73:"UPDATE_REL_STYLE",74:"UPDATE_LAYOUT_CONFIG",76:"STR",77:"STR_KEY",78:"STR_VALUE",79:"ATTRIBUTE",80:"ATTRIBUTE_EMPTY"},productions_:[0,[3,1],[3,1],[5,1],[5,1],[5,1],[5,1],[4,1],[10,4],[10,4],[10,4],[10,4],[10,4],[13,1],[13,1],[13,2],[19,1],[19,2],[19,3],[21,1],[21,1],[21,2],[21,2],[21,1],[29,3],[30,3],[30,3],[30,4],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[31,1],[20,1],[20,2],[20,3],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,1],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[35,1],[35,2],[75,1],[75,2],[75,1],[75,1]],performAction:e(function(k,R,D,x,j,h,Ft){var b=h.length-1;switch(j){case 3:x.setDirection("TB");break;case 4:x.setDirection("BT");break;case 5:x.setDirection("RL");break;case 6:x.setDirection("LR");break;case 8:case 9:case 10:case 11:case 12:x.setC4Type(h[b-3]);break;case 19:x.setTitle(h[b].substring(6)),this.$=h[b].substring(6);break;case 20:x.setAccDescription(h[b].substring(15)),this.$=h[b].substring(15);break;case 21:this.$=h[b].trim(),x.setTitle(this.$);break;case 22:case 23:this.$=h[b].trim(),x.setAccDescription(this.$);break;case 28:h[b].splice(2,0,"ENTERPRISE"),x.addPersonOrSystemBoundary(...h[b]),this.$=h[b];break;case 29:h[b].splice(2,0,"SYSTEM"),x.addPersonOrSystemBoundary(...h[b]),this.$=h[b];break;case 30:x.addPersonOrSystemBoundary(...h[b]),this.$=h[b];break;case 31:h[b].splice(2,0,"CONTAINER"),x.addContainerBoundary(...h[b]),this.$=h[b];break;case 32:x.addDeploymentNode("node",...h[b]),this.$=h[b];break;case 33:x.addDeploymentNode("nodeL",...h[b]),this.$=h[b];break;case 34:x.addDeploymentNode("nodeR",...h[b]),this.$=h[b];break;case 35:x.popBoundaryParseStack();break;case 39:x.addPersonOrSystem("person",...h[b]),this.$=h[b];break;case 40:x.addPersonOrSystem("external_person",...h[b]),this.$=h[b];break;case 41:x.addPersonOrSystem("system",...h[b]),this.$=h[b];break;case 42:x.addPersonOrSystem("system_db",...h[b]),this.$=h[b];break;case 43:x.addPersonOrSystem("system_queue",...h[b]),this.$=h[b];break;case 44:x.addPersonOrSystem("external_system",...h[b]),this.$=h[b];break;case 45:x.addPersonOrSystem("external_system_db",...h[b]),this.$=h[b];break;case 46:x.addPersonOrSystem("external_system_queue",...h[b]),this.$=h[b];break;case 47:x.addContainer("container",...h[b]),this.$=h[b];break;case 48:x.addContainer("container_db",...h[b]),this.$=h[b];break;case 49:x.addContainer("container_queue",...h[b]),this.$=h[b];break;case 50:x.addContainer("external_container",...h[b]),this.$=h[b];break;case 51:x.addContainer("external_container_db",...h[b]),this.$=h[b];break;case 52:x.addContainer("external_container_queue",...h[b]),this.$=h[b];break;case 53:x.addComponent("component",...h[b]),this.$=h[b];break;case 54:x.addComponent("component_db",...h[b]),this.$=h[b];break;case 55:x.addComponent("component_queue",...h[b]),this.$=h[b];break;case 56:x.addComponent("external_component",...h[b]),this.$=h[b];break;case 57:x.addComponent("external_component_db",...h[b]),this.$=h[b];break;case 58:x.addComponent("external_component_queue",...h[b]),this.$=h[b];break;case 60:x.addRel("rel",...h[b]),this.$=h[b];break;case 61:x.addRel("birel",...h[b]),this.$=h[b];break;case 62:x.addRel("rel_u",...h[b]),this.$=h[b];break;case 63:x.addRel("rel_d",...h[b]),this.$=h[b];break;case 64:x.addRel("rel_l",...h[b]),this.$=h[b];break;case 65:x.addRel("rel_r",...h[b]),this.$=h[b];break;case 66:x.addRel("rel_b",...h[b]),this.$=h[b];break;case 67:h[b].splice(0,1),x.addRel("rel",...h[b]),this.$=h[b];break;case 68:x.updateElStyle("update_el_style",...h[b]),this.$=h[b];break;case 69:x.updateRelStyle("update_rel_style",...h[b]),this.$=h[b];break;case 70:x.updateLayoutConfig("update_layout_config",...h[b]),this.$=h[b];break;case 71:this.$=[h[b]];break;case 72:h[b].unshift(h[b-1]),this.$=h[b];break;case 73:case 75:this.$=h[b].trim();break;case 74:let At={};At[h[b-1].trim()]=h[b].trim(),this.$=At;break;case 76:this.$="";break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],7:[1,6],8:[1,7],9:[1,8],10:4,11:[1,9],15:[1,10],16:[1,11],17:[1,12],18:[1,13]},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,7]},{1:[2,3]},{1:[2,4]},{1:[2,5]},{1:[2,6]},{12:[1,14]},{12:[1,15]},{12:[1,16]},{12:[1,17]},{12:[1,18]},{13:19,19:20,20:21,21:22,22:n,23:o,24:l,26:f,28:u,29:49,30:61,32:62,34:a,36:d,37:i,38:_,39:g,40:m,41:v,43:23,44:P,45:Y,46:z,47:F,48:U,49:H,50:rt,51:st,52:at,53:it,54:ot,55:lt,56:ct,57:ut,58:ht,59:dt,60:pt,61:ft,62:yt,63:_t,64:bt,65:mt,66:gt,67:xt,68:vt,69:kt,70:Et,71:St,72:Tt,73:Ct,74:Rt},{13:70,19:20,20:21,21:22,22:n,23:o,24:l,26:f,28:u,29:49,30:61,32:62,34:a,36:d,37:i,38:_,39:g,40:m,41:v,43:23,44:P,45:Y,46:z,47:F,48:U,49:H,50:rt,51:st,52:at,53:it,54:ot,55:lt,56:ct,57:ut,58:ht,59:dt,60:pt,61:ft,62:yt,63:_t,64:bt,65:mt,66:gt,67:xt,68:vt,69:kt,70:Et,71:St,72:Tt,73:Ct,74:Rt},{13:71,19:20,20:21,21:22,22:n,23:o,24:l,26:f,28:u,29:49,30:61,32:62,34:a,36:d,37:i,38:_,39:g,40:m,41:v,43:23,44:P,45:Y,46:z,47:F,48:U,49:H,50:rt,51:st,52:at,53:it,54:ot,55:lt,56:ct,57:ut,58:ht,59:dt,60:pt,61:ft,62:yt,63:_t,64:bt,65:mt,66:gt,67:xt,68:vt,69:kt,70:Et,71:St,72:Tt,73:Ct,74:Rt},{13:72,19:20,20:21,21:22,22:n,23:o,24:l,26:f,28:u,29:49,30:61,32:62,34:a,36:d,37:i,38:_,39:g,40:m,41:v,43:23,44:P,45:Y,46:z,47:F,48:U,49:H,50:rt,51:st,52:at,53:it,54:ot,55:lt,56:ct,57:ut,58:ht,59:dt,60:pt,61:ft,62:yt,63:_t,64:bt,65:mt,66:gt,67:xt,68:vt,69:kt,70:Et,71:St,72:Tt,73:Ct,74:Rt},{13:73,19:20,20:21,21:22,22:n,23:o,24:l,26:f,28:u,29:49,30:61,32:62,34:a,36:d,37:i,38:_,39:g,40:m,41:v,43:23,44:P,45:Y,46:z,47:F,48:U,49:H,50:rt,51:st,52:at,53:it,54:ot,55:lt,56:ct,57:ut,58:ht,59:dt,60:pt,61:ft,62:yt,63:_t,64:bt,65:mt,66:gt,67:xt,68:vt,69:kt,70:Et,71:St,72:Tt,73:Ct,74:Rt},{14:[1,74]},t(Bt,[2,13],{43:23,29:49,30:61,32:62,20:75,34:a,36:d,37:i,38:_,39:g,40:m,41:v,44:P,45:Y,46:z,47:F,48:U,49:H,50:rt,51:st,52:at,53:it,54:ot,55:lt,56:ct,57:ut,58:ht,59:dt,60:pt,61:ft,62:yt,63:_t,64:bt,65:mt,66:gt,67:xt,68:vt,69:kt,70:Et,71:St,72:Tt,73:Ct,74:Rt}),t(Bt,[2,14]),t($t,[2,16],{12:[1,76]}),t(Bt,[2,36],{12:[1,77]}),t(Yt,[2,19]),t(Yt,[2,20]),{25:[1,78]},{27:[1,79]},t(Yt,[2,23]),{35:80,75:81,76:N,77:L,79:I,80:M},{35:86,75:81,76:N,77:L,79:I,80:M},{35:87,75:81,76:N,77:L,79:I,80:M},{35:88,75:81,76:N,77:L,79:I,80:M},{35:89,75:81,76:N,77:L,79:I,80:M},{35:90,75:81,76:N,77:L,79:I,80:M},{35:91,75:81,76:N,77:L,79:I,80:M},{35:92,75:81,76:N,77:L,79:I,80:M},{35:93,75:81,76:N,77:L,79:I,80:M},{35:94,75:81,76:N,77:L,79:I,80:M},{35:95,75:81,76:N,77:L,79:I,80:M},{35:96,75:81,76:N,77:L,79:I,80:M},{35:97,75:81,76:N,77:L,79:I,80:M},{35:98,75:81,76:N,77:L,79:I,80:M},{35:99,75:81,76:N,77:L,79:I,80:M},{35:100,75:81,76:N,77:L,79:I,80:M},{35:101,75:81,76:N,77:L,79:I,80:M},{35:102,75:81,76:N,77:L,79:I,80:M},{35:103,75:81,76:N,77:L,79:I,80:M},{35:104,75:81,76:N,77:L,79:I,80:M},t(V,[2,59]),{35:105,75:81,76:N,77:L,79:I,80:M},{35:106,75:81,76:N,77:L,79:I,80:M},{35:107,75:81,76:N,77:L,79:I,80:M},{35:108,75:81,76:N,77:L,79:I,80:M},{35:109,75:81,76:N,77:L,79:I,80:M},{35:110,75:81,76:N,77:L,79:I,80:M},{35:111,75:81,76:N,77:L,79:I,80:M},{35:112,75:81,76:N,77:L,79:I,80:M},{35:113,75:81,76:N,77:L,79:I,80:M},{35:114,75:81,76:N,77:L,79:I,80:M},{35:115,75:81,76:N,77:L,79:I,80:M},{20:116,29:49,30:61,32:62,34:a,36:d,37:i,38:_,39:g,40:m,41:v,43:23,44:P,45:Y,46:z,47:F,48:U,49:H,50:rt,51:st,52:at,53:it,54:ot,55:lt,56:ct,57:ut,58:ht,59:dt,60:pt,61:ft,62:yt,63:_t,64:bt,65:mt,66:gt,67:xt,68:vt,69:kt,70:Et,71:St,72:Tt,73:Ct,74:Rt},{12:[1,118],33:[1,117]},{35:119,75:81,76:N,77:L,79:I,80:M},{35:120,75:81,76:N,77:L,79:I,80:M},{35:121,75:81,76:N,77:L,79:I,80:M},{35:122,75:81,76:N,77:L,79:I,80:M},{35:123,75:81,76:N,77:L,79:I,80:M},{35:124,75:81,76:N,77:L,79:I,80:M},{35:125,75:81,76:N,77:L,79:I,80:M},{14:[1,126]},{14:[1,127]},{14:[1,128]},{14:[1,129]},{1:[2,8]},t(Bt,[2,15]),t($t,[2,17],{21:22,19:130,22:n,23:o,24:l,26:f,28:u}),t(Bt,[2,37],{19:20,20:21,21:22,43:23,29:49,30:61,32:62,13:131,22:n,23:o,24:l,26:f,28:u,34:a,36:d,37:i,38:_,39:g,40:m,41:v,44:P,45:Y,46:z,47:F,48:U,49:H,50:rt,51:st,52:at,53:it,54:ot,55:lt,56:ct,57:ut,58:ht,59:dt,60:pt,61:ft,62:yt,63:_t,64:bt,65:mt,66:gt,67:xt,68:vt,69:kt,70:Et,71:St,72:Tt,73:Ct,74:Rt}),t(Yt,[2,21]),t(Yt,[2,22]),t(V,[2,39]),t(ye,[2,71],{75:81,35:132,76:N,77:L,79:I,80:M}),t(Xt,[2,73]),{78:[1,133]},t(Xt,[2,75]),t(Xt,[2,76]),t(V,[2,40]),t(V,[2,41]),t(V,[2,42]),t(V,[2,43]),t(V,[2,44]),t(V,[2,45]),t(V,[2,46]),t(V,[2,47]),t(V,[2,48]),t(V,[2,49]),t(V,[2,50]),t(V,[2,51]),t(V,[2,52]),t(V,[2,53]),t(V,[2,54]),t(V,[2,55]),t(V,[2,56]),t(V,[2,57]),t(V,[2,58]),t(V,[2,60]),t(V,[2,61]),t(V,[2,62]),t(V,[2,63]),t(V,[2,64]),t(V,[2,65]),t(V,[2,66]),t(V,[2,67]),t(V,[2,68]),t(V,[2,69]),t(V,[2,70]),{31:134,42:[1,135]},{12:[1,136]},{33:[1,137]},t(Nt,[2,28]),t(Nt,[2,29]),t(Nt,[2,30]),t(Nt,[2,31]),t(Nt,[2,32]),t(Nt,[2,33]),t(Nt,[2,34]),{1:[2,9]},{1:[2,10]},{1:[2,11]},{1:[2,12]},t($t,[2,18]),t(Bt,[2,38]),t(ye,[2,72]),t(Xt,[2,74]),t(V,[2,24]),t(V,[2,35]),t(te,[2,25]),t(te,[2,26],{12:[1,138]}),t(te,[2,27])],defaultActions:{2:[2,1],3:[2,2],4:[2,7],5:[2,3],6:[2,4],7:[2,5],8:[2,6],74:[2,8],126:[2,9],127:[2,10],128:[2,11],129:[2,12]},parseError:e(function(k,R){if(R.recoverable)this.trace(k);else{var D=Error(k);throw D.hash=R,D}},"parseError"),parse:e(function(k){var R=this,D=[0],x=[],j=[null],h=[],Ft=this.table,b="",At=0,_e=0,be=0,Be=2,me=1,Ve=h.slice.call(arguments,1),W=Object.create(this.lexer),Lt={yy:{}};for(var re in this.yy)if(Object.prototype.hasOwnProperty.call(this.yy,re))Lt.yy[re]=this.yy[re];if(W.setInput(k,Lt.yy),Lt.yy.lexer=W,Lt.yy.parser=this,typeof W.yylloc>"u")W.yylloc={};var se=W.yylloc;h.push(se);var Ye=W.options&&W.options.ranges;if(typeof Lt.yy.parseError==="function")this.parseError=Lt.yy.parseError;else this.parseError=Object.getPrototypeOf(this).parseError;function Fe(K){D.length=D.length-2*K,j.length=j.length-K,h.length=h.length-K}e(Fe,"popStack");function ge(){var K=x.pop()||W.lex()||me;if(typeof K!=="number"){if(K instanceof Array)x=K,K=x.pop();K=R.symbols_[K]||K}return K}e(ge,"lex");var X,ae,It,Q,X0,ie,Vt={},Ht,et,xe,Qt;while(!0){if(It=D[D.length-1],this.defaultActions[It])Q=this.defaultActions[It];else{if(X===null||typeof X>"u")X=ge();Q=Ft[It]&&Ft[It][X]}if(typeof Q>"u"||!Q.length||!Q[0]){var oe="";Qt=[];for(Ht in Ft[It])if(this.terminals_[Ht]&&Ht>Be)Qt.push("'"+this.terminals_[Ht]+"'");if(W.showPosition)oe="Parse error on line "+(At+1)+`:
1
+ import{e,r,ne,O,y,B,S,E,T,A,s,p,Dn,Yr,He,w,Kr}from"./chunk-wvdehm9y.js";import{nn}from"./chunk-rvrf0f3h.js";var Gt=function(){var t=e(function(wt,k,R,D){for(R=R||{},D=wt.length;D--;R[wt[D]]=k);return R},"o"),n=[1,24],o=[1,25],l=[1,26],f=[1,27],u=[1,28],a=[1,63],d=[1,64],i=[1,65],_=[1,66],g=[1,67],m=[1,68],v=[1,69],P=[1,29],Y=[1,30],z=[1,31],F=[1,32],U=[1,33],H=[1,34],rt=[1,35],st=[1,36],at=[1,37],it=[1,38],ot=[1,39],lt=[1,40],ct=[1,41],ut=[1,42],ht=[1,43],dt=[1,44],pt=[1,45],ft=[1,46],yt=[1,47],_t=[1,48],bt=[1,50],mt=[1,51],gt=[1,52],xt=[1,53],vt=[1,54],kt=[1,55],Et=[1,56],St=[1,57],Tt=[1,58],Ct=[1,59],Rt=[1,60],Bt=[14,42],$t=[14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],Yt=[12,14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],N=[1,82],L=[1,83],I=[1,84],M=[1,85],V=[12,14,42],ye=[12,14,33,42],Xt=[12,14,33,42,76,77,79,80],Nt=[12,33],te=[34,36,37,38,39,40,41,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],ee={trace:e(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,direction:5,direction_tb:6,direction_bt:7,direction_rl:8,direction_lr:9,graphConfig:10,C4_CONTEXT:11,NEWLINE:12,statements:13,EOF:14,C4_CONTAINER:15,C4_COMPONENT:16,C4_DYNAMIC:17,C4_DEPLOYMENT:18,otherStatements:19,diagramStatements:20,otherStatement:21,title:22,accDescription:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,boundaryStatement:29,boundaryStartStatement:30,boundaryStopStatement:31,boundaryStart:32,LBRACE:33,ENTERPRISE_BOUNDARY:34,attributes:35,SYSTEM_BOUNDARY:36,BOUNDARY:37,CONTAINER_BOUNDARY:38,NODE:39,NODE_L:40,NODE_R:41,RBRACE:42,diagramStatement:43,PERSON:44,PERSON_EXT:45,SYSTEM:46,SYSTEM_DB:47,SYSTEM_QUEUE:48,SYSTEM_EXT:49,SYSTEM_EXT_DB:50,SYSTEM_EXT_QUEUE:51,CONTAINER:52,CONTAINER_DB:53,CONTAINER_QUEUE:54,CONTAINER_EXT:55,CONTAINER_EXT_DB:56,CONTAINER_EXT_QUEUE:57,COMPONENT:58,COMPONENT_DB:59,COMPONENT_QUEUE:60,COMPONENT_EXT:61,COMPONENT_EXT_DB:62,COMPONENT_EXT_QUEUE:63,REL:64,BIREL:65,REL_U:66,REL_D:67,REL_L:68,REL_R:69,REL_B:70,REL_INDEX:71,UPDATE_EL_STYLE:72,UPDATE_REL_STYLE:73,UPDATE_LAYOUT_CONFIG:74,attribute:75,STR:76,STR_KEY:77,STR_VALUE:78,ATTRIBUTE:79,ATTRIBUTE_EMPTY:80,$accept:0,$end:1},terminals_:{2:"error",6:"direction_tb",7:"direction_bt",8:"direction_rl",9:"direction_lr",11:"C4_CONTEXT",12:"NEWLINE",14:"EOF",15:"C4_CONTAINER",16:"C4_COMPONENT",17:"C4_DYNAMIC",18:"C4_DEPLOYMENT",22:"title",23:"accDescription",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"LBRACE",34:"ENTERPRISE_BOUNDARY",36:"SYSTEM_BOUNDARY",37:"BOUNDARY",38:"CONTAINER_BOUNDARY",39:"NODE",40:"NODE_L",41:"NODE_R",42:"RBRACE",44:"PERSON",45:"PERSON_EXT",46:"SYSTEM",47:"SYSTEM_DB",48:"SYSTEM_QUEUE",49:"SYSTEM_EXT",50:"SYSTEM_EXT_DB",51:"SYSTEM_EXT_QUEUE",52:"CONTAINER",53:"CONTAINER_DB",54:"CONTAINER_QUEUE",55:"CONTAINER_EXT",56:"CONTAINER_EXT_DB",57:"CONTAINER_EXT_QUEUE",58:"COMPONENT",59:"COMPONENT_DB",60:"COMPONENT_QUEUE",61:"COMPONENT_EXT",62:"COMPONENT_EXT_DB",63:"COMPONENT_EXT_QUEUE",64:"REL",65:"BIREL",66:"REL_U",67:"REL_D",68:"REL_L",69:"REL_R",70:"REL_B",71:"REL_INDEX",72:"UPDATE_EL_STYLE",73:"UPDATE_REL_STYLE",74:"UPDATE_LAYOUT_CONFIG",76:"STR",77:"STR_KEY",78:"STR_VALUE",79:"ATTRIBUTE",80:"ATTRIBUTE_EMPTY"},productions_:[0,[3,1],[3,1],[5,1],[5,1],[5,1],[5,1],[4,1],[10,4],[10,4],[10,4],[10,4],[10,4],[13,1],[13,1],[13,2],[19,1],[19,2],[19,3],[21,1],[21,1],[21,2],[21,2],[21,1],[29,3],[30,3],[30,3],[30,4],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[31,1],[20,1],[20,2],[20,3],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,1],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[35,1],[35,2],[75,1],[75,2],[75,1],[75,1]],performAction:e(function(k,R,D,x,j,h,Ft){var b=h.length-1;switch(j){case 3:x.setDirection("TB");break;case 4:x.setDirection("BT");break;case 5:x.setDirection("RL");break;case 6:x.setDirection("LR");break;case 8:case 9:case 10:case 11:case 12:x.setC4Type(h[b-3]);break;case 19:x.setTitle(h[b].substring(6)),this.$=h[b].substring(6);break;case 20:x.setAccDescription(h[b].substring(15)),this.$=h[b].substring(15);break;case 21:this.$=h[b].trim(),x.setTitle(this.$);break;case 22:case 23:this.$=h[b].trim(),x.setAccDescription(this.$);break;case 28:h[b].splice(2,0,"ENTERPRISE"),x.addPersonOrSystemBoundary(...h[b]),this.$=h[b];break;case 29:h[b].splice(2,0,"SYSTEM"),x.addPersonOrSystemBoundary(...h[b]),this.$=h[b];break;case 30:x.addPersonOrSystemBoundary(...h[b]),this.$=h[b];break;case 31:h[b].splice(2,0,"CONTAINER"),x.addContainerBoundary(...h[b]),this.$=h[b];break;case 32:x.addDeploymentNode("node",...h[b]),this.$=h[b];break;case 33:x.addDeploymentNode("nodeL",...h[b]),this.$=h[b];break;case 34:x.addDeploymentNode("nodeR",...h[b]),this.$=h[b];break;case 35:x.popBoundaryParseStack();break;case 39:x.addPersonOrSystem("person",...h[b]),this.$=h[b];break;case 40:x.addPersonOrSystem("external_person",...h[b]),this.$=h[b];break;case 41:x.addPersonOrSystem("system",...h[b]),this.$=h[b];break;case 42:x.addPersonOrSystem("system_db",...h[b]),this.$=h[b];break;case 43:x.addPersonOrSystem("system_queue",...h[b]),this.$=h[b];break;case 44:x.addPersonOrSystem("external_system",...h[b]),this.$=h[b];break;case 45:x.addPersonOrSystem("external_system_db",...h[b]),this.$=h[b];break;case 46:x.addPersonOrSystem("external_system_queue",...h[b]),this.$=h[b];break;case 47:x.addContainer("container",...h[b]),this.$=h[b];break;case 48:x.addContainer("container_db",...h[b]),this.$=h[b];break;case 49:x.addContainer("container_queue",...h[b]),this.$=h[b];break;case 50:x.addContainer("external_container",...h[b]),this.$=h[b];break;case 51:x.addContainer("external_container_db",...h[b]),this.$=h[b];break;case 52:x.addContainer("external_container_queue",...h[b]),this.$=h[b];break;case 53:x.addComponent("component",...h[b]),this.$=h[b];break;case 54:x.addComponent("component_db",...h[b]),this.$=h[b];break;case 55:x.addComponent("component_queue",...h[b]),this.$=h[b];break;case 56:x.addComponent("external_component",...h[b]),this.$=h[b];break;case 57:x.addComponent("external_component_db",...h[b]),this.$=h[b];break;case 58:x.addComponent("external_component_queue",...h[b]),this.$=h[b];break;case 60:x.addRel("rel",...h[b]),this.$=h[b];break;case 61:x.addRel("birel",...h[b]),this.$=h[b];break;case 62:x.addRel("rel_u",...h[b]),this.$=h[b];break;case 63:x.addRel("rel_d",...h[b]),this.$=h[b];break;case 64:x.addRel("rel_l",...h[b]),this.$=h[b];break;case 65:x.addRel("rel_r",...h[b]),this.$=h[b];break;case 66:x.addRel("rel_b",...h[b]),this.$=h[b];break;case 67:h[b].splice(0,1),x.addRel("rel",...h[b]),this.$=h[b];break;case 68:x.updateElStyle("update_el_style",...h[b]),this.$=h[b];break;case 69:x.updateRelStyle("update_rel_style",...h[b]),this.$=h[b];break;case 70:x.updateLayoutConfig("update_layout_config",...h[b]),this.$=h[b];break;case 71:this.$=[h[b]];break;case 72:h[b].unshift(h[b-1]),this.$=h[b];break;case 73:case 75:this.$=h[b].trim();break;case 74:let At={};At[h[b-1].trim()]=h[b].trim(),this.$=At;break;case 76:this.$="";break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],7:[1,6],8:[1,7],9:[1,8],10:4,11:[1,9],15:[1,10],16:[1,11],17:[1,12],18:[1,13]},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,7]},{1:[2,3]},{1:[2,4]},{1:[2,5]},{1:[2,6]},{12:[1,14]},{12:[1,15]},{12:[1,16]},{12:[1,17]},{12:[1,18]},{13:19,19:20,20:21,21:22,22:n,23:o,24:l,26:f,28:u,29:49,30:61,32:62,34:a,36:d,37:i,38:_,39:g,40:m,41:v,43:23,44:P,45:Y,46:z,47:F,48:U,49:H,50:rt,51:st,52:at,53:it,54:ot,55:lt,56:ct,57:ut,58:ht,59:dt,60:pt,61:ft,62:yt,63:_t,64:bt,65:mt,66:gt,67:xt,68:vt,69:kt,70:Et,71:St,72:Tt,73:Ct,74:Rt},{13:70,19:20,20:21,21:22,22:n,23:o,24:l,26:f,28:u,29:49,30:61,32:62,34:a,36:d,37:i,38:_,39:g,40:m,41:v,43:23,44:P,45:Y,46:z,47:F,48:U,49:H,50:rt,51:st,52:at,53:it,54:ot,55:lt,56:ct,57:ut,58:ht,59:dt,60:pt,61:ft,62:yt,63:_t,64:bt,65:mt,66:gt,67:xt,68:vt,69:kt,70:Et,71:St,72:Tt,73:Ct,74:Rt},{13:71,19:20,20:21,21:22,22:n,23:o,24:l,26:f,28:u,29:49,30:61,32:62,34:a,36:d,37:i,38:_,39:g,40:m,41:v,43:23,44:P,45:Y,46:z,47:F,48:U,49:H,50:rt,51:st,52:at,53:it,54:ot,55:lt,56:ct,57:ut,58:ht,59:dt,60:pt,61:ft,62:yt,63:_t,64:bt,65:mt,66:gt,67:xt,68:vt,69:kt,70:Et,71:St,72:Tt,73:Ct,74:Rt},{13:72,19:20,20:21,21:22,22:n,23:o,24:l,26:f,28:u,29:49,30:61,32:62,34:a,36:d,37:i,38:_,39:g,40:m,41:v,43:23,44:P,45:Y,46:z,47:F,48:U,49:H,50:rt,51:st,52:at,53:it,54:ot,55:lt,56:ct,57:ut,58:ht,59:dt,60:pt,61:ft,62:yt,63:_t,64:bt,65:mt,66:gt,67:xt,68:vt,69:kt,70:Et,71:St,72:Tt,73:Ct,74:Rt},{13:73,19:20,20:21,21:22,22:n,23:o,24:l,26:f,28:u,29:49,30:61,32:62,34:a,36:d,37:i,38:_,39:g,40:m,41:v,43:23,44:P,45:Y,46:z,47:F,48:U,49:H,50:rt,51:st,52:at,53:it,54:ot,55:lt,56:ct,57:ut,58:ht,59:dt,60:pt,61:ft,62:yt,63:_t,64:bt,65:mt,66:gt,67:xt,68:vt,69:kt,70:Et,71:St,72:Tt,73:Ct,74:Rt},{14:[1,74]},t(Bt,[2,13],{43:23,29:49,30:61,32:62,20:75,34:a,36:d,37:i,38:_,39:g,40:m,41:v,44:P,45:Y,46:z,47:F,48:U,49:H,50:rt,51:st,52:at,53:it,54:ot,55:lt,56:ct,57:ut,58:ht,59:dt,60:pt,61:ft,62:yt,63:_t,64:bt,65:mt,66:gt,67:xt,68:vt,69:kt,70:Et,71:St,72:Tt,73:Ct,74:Rt}),t(Bt,[2,14]),t($t,[2,16],{12:[1,76]}),t(Bt,[2,36],{12:[1,77]}),t(Yt,[2,19]),t(Yt,[2,20]),{25:[1,78]},{27:[1,79]},t(Yt,[2,23]),{35:80,75:81,76:N,77:L,79:I,80:M},{35:86,75:81,76:N,77:L,79:I,80:M},{35:87,75:81,76:N,77:L,79:I,80:M},{35:88,75:81,76:N,77:L,79:I,80:M},{35:89,75:81,76:N,77:L,79:I,80:M},{35:90,75:81,76:N,77:L,79:I,80:M},{35:91,75:81,76:N,77:L,79:I,80:M},{35:92,75:81,76:N,77:L,79:I,80:M},{35:93,75:81,76:N,77:L,79:I,80:M},{35:94,75:81,76:N,77:L,79:I,80:M},{35:95,75:81,76:N,77:L,79:I,80:M},{35:96,75:81,76:N,77:L,79:I,80:M},{35:97,75:81,76:N,77:L,79:I,80:M},{35:98,75:81,76:N,77:L,79:I,80:M},{35:99,75:81,76:N,77:L,79:I,80:M},{35:100,75:81,76:N,77:L,79:I,80:M},{35:101,75:81,76:N,77:L,79:I,80:M},{35:102,75:81,76:N,77:L,79:I,80:M},{35:103,75:81,76:N,77:L,79:I,80:M},{35:104,75:81,76:N,77:L,79:I,80:M},t(V,[2,59]),{35:105,75:81,76:N,77:L,79:I,80:M},{35:106,75:81,76:N,77:L,79:I,80:M},{35:107,75:81,76:N,77:L,79:I,80:M},{35:108,75:81,76:N,77:L,79:I,80:M},{35:109,75:81,76:N,77:L,79:I,80:M},{35:110,75:81,76:N,77:L,79:I,80:M},{35:111,75:81,76:N,77:L,79:I,80:M},{35:112,75:81,76:N,77:L,79:I,80:M},{35:113,75:81,76:N,77:L,79:I,80:M},{35:114,75:81,76:N,77:L,79:I,80:M},{35:115,75:81,76:N,77:L,79:I,80:M},{20:116,29:49,30:61,32:62,34:a,36:d,37:i,38:_,39:g,40:m,41:v,43:23,44:P,45:Y,46:z,47:F,48:U,49:H,50:rt,51:st,52:at,53:it,54:ot,55:lt,56:ct,57:ut,58:ht,59:dt,60:pt,61:ft,62:yt,63:_t,64:bt,65:mt,66:gt,67:xt,68:vt,69:kt,70:Et,71:St,72:Tt,73:Ct,74:Rt},{12:[1,118],33:[1,117]},{35:119,75:81,76:N,77:L,79:I,80:M},{35:120,75:81,76:N,77:L,79:I,80:M},{35:121,75:81,76:N,77:L,79:I,80:M},{35:122,75:81,76:N,77:L,79:I,80:M},{35:123,75:81,76:N,77:L,79:I,80:M},{35:124,75:81,76:N,77:L,79:I,80:M},{35:125,75:81,76:N,77:L,79:I,80:M},{14:[1,126]},{14:[1,127]},{14:[1,128]},{14:[1,129]},{1:[2,8]},t(Bt,[2,15]),t($t,[2,17],{21:22,19:130,22:n,23:o,24:l,26:f,28:u}),t(Bt,[2,37],{19:20,20:21,21:22,43:23,29:49,30:61,32:62,13:131,22:n,23:o,24:l,26:f,28:u,34:a,36:d,37:i,38:_,39:g,40:m,41:v,44:P,45:Y,46:z,47:F,48:U,49:H,50:rt,51:st,52:at,53:it,54:ot,55:lt,56:ct,57:ut,58:ht,59:dt,60:pt,61:ft,62:yt,63:_t,64:bt,65:mt,66:gt,67:xt,68:vt,69:kt,70:Et,71:St,72:Tt,73:Ct,74:Rt}),t(Yt,[2,21]),t(Yt,[2,22]),t(V,[2,39]),t(ye,[2,71],{75:81,35:132,76:N,77:L,79:I,80:M}),t(Xt,[2,73]),{78:[1,133]},t(Xt,[2,75]),t(Xt,[2,76]),t(V,[2,40]),t(V,[2,41]),t(V,[2,42]),t(V,[2,43]),t(V,[2,44]),t(V,[2,45]),t(V,[2,46]),t(V,[2,47]),t(V,[2,48]),t(V,[2,49]),t(V,[2,50]),t(V,[2,51]),t(V,[2,52]),t(V,[2,53]),t(V,[2,54]),t(V,[2,55]),t(V,[2,56]),t(V,[2,57]),t(V,[2,58]),t(V,[2,60]),t(V,[2,61]),t(V,[2,62]),t(V,[2,63]),t(V,[2,64]),t(V,[2,65]),t(V,[2,66]),t(V,[2,67]),t(V,[2,68]),t(V,[2,69]),t(V,[2,70]),{31:134,42:[1,135]},{12:[1,136]},{33:[1,137]},t(Nt,[2,28]),t(Nt,[2,29]),t(Nt,[2,30]),t(Nt,[2,31]),t(Nt,[2,32]),t(Nt,[2,33]),t(Nt,[2,34]),{1:[2,9]},{1:[2,10]},{1:[2,11]},{1:[2,12]},t($t,[2,18]),t(Bt,[2,38]),t(ye,[2,72]),t(Xt,[2,74]),t(V,[2,24]),t(V,[2,35]),t(te,[2,25]),t(te,[2,26],{12:[1,138]}),t(te,[2,27])],defaultActions:{2:[2,1],3:[2,2],4:[2,7],5:[2,3],6:[2,4],7:[2,5],8:[2,6],74:[2,8],126:[2,9],127:[2,10],128:[2,11],129:[2,12]},parseError:e(function(k,R){if(R.recoverable)this.trace(k);else{var D=Error(k);throw D.hash=R,D}},"parseError"),parse:e(function(k){var R=this,D=[0],x=[],j=[null],h=[],Ft=this.table,b="",At=0,_e=0,be=0,Be=2,me=1,Ve=h.slice.call(arguments,1),W=Object.create(this.lexer),Lt={yy:{}};for(var re in this.yy)if(Object.prototype.hasOwnProperty.call(this.yy,re))Lt.yy[re]=this.yy[re];if(W.setInput(k,Lt.yy),Lt.yy.lexer=W,Lt.yy.parser=this,typeof W.yylloc>"u")W.yylloc={};var se=W.yylloc;h.push(se);var Ye=W.options&&W.options.ranges;if(typeof Lt.yy.parseError==="function")this.parseError=Lt.yy.parseError;else this.parseError=Object.getPrototypeOf(this).parseError;function Fe(K){D.length=D.length-2*K,j.length=j.length-K,h.length=h.length-K}e(Fe,"popStack");function ge(){var K=x.pop()||W.lex()||me;if(typeof K!=="number"){if(K instanceof Array)x=K,K=x.pop();K=R.symbols_[K]||K}return K}e(ge,"lex");var X,ae,It,Q,X0,ie,Vt={},Ht,et,xe,Qt;while(!0){if(It=D[D.length-1],this.defaultActions[It])Q=this.defaultActions[It];else{if(X===null||typeof X>"u")X=ge();Q=Ft[It]&&Ft[It][X]}if(typeof Q>"u"||!Q.length||!Q[0]){var oe="";Qt=[];for(Ht in Ft[It])if(this.terminals_[Ht]&&Ht>Be)Qt.push("'"+this.terminals_[Ht]+"'");if(W.showPosition)oe="Parse error on line "+(At+1)+`:
2
2
  `+W.showPosition()+`
3
3
  Expecting `+Qt.join(", ")+", got '"+(this.terminals_[X]||X)+"'";else oe="Parse error on line "+(At+1)+": Unexpected "+(X==me?"end of input":"'"+(this.terminals_[X]||X)+"'");this.parseError(oe,{text:W.match,token:this.terminals_[X]||X,line:W.yylineno,loc:se,expected:Qt})}if(Q[0]instanceof Array&&Q.length>1)throw Error("Parse Error: multiple actions possible at state: "+It+", token: "+X);switch(Q[0]){case 1:if(D.push(X),j.push(W.yytext),h.push(W.yylloc),D.push(Q[1]),X=null,!ae){if(_e=W.yyleng,b=W.yytext,At=W.yylineno,se=W.yylloc,be>0)be--}else X=ae,ae=null;break;case 2:if(et=this.productions_[Q[1]][1],Vt.$=j[j.length-et],Vt._$={first_line:h[h.length-(et||1)].first_line,last_line:h[h.length-1].last_line,first_column:h[h.length-(et||1)].first_column,last_column:h[h.length-1].last_column},Ye)Vt._$.range=[h[h.length-(et||1)].range[0],h[h.length-1].range[1]];if(ie=this.performAction.apply(Vt,[b,_e,At,Lt.yy,Q[1],j,h].concat(Ve)),typeof ie<"u")return ie;if(et)D=D.slice(0,-1*et*2),j=j.slice(0,-1*et),h=h.slice(0,-1*et);D.push(this.productions_[Q[1]][0]),j.push(Vt.$),h.push(Vt._$),xe=Ft[D[D.length-2]][D[D.length-1]],D.push(xe);break;case 3:return!0}}return!0},"parse")},Me=function(){var wt={EOF:1,parseError:e(function(R,D){if(this.yy.parser)this.yy.parser.parseError(R,D);else throw Error(R)},"parseError"),setInput:e(function(k,R){if(this.yy=R||this.yy||{},this._input=k,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges)this.yylloc.range=[0,0];return this.offset=0,this},"setInput"),input:e(function(){var k=this._input[0];this.yytext+=k,this.yyleng++,this.offset++,this.match+=k,this.matched+=k;var R=k.match(/(?:\r\n?|\n).*/g);if(R)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),k},"input"),unput:e(function(k){var R=k.length,D=k.split(/(?:\r\n?|\n)/g);this._input=k+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-R),this.offset-=R;var x=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),D.length-1)this.yylineno-=D.length-1;var j=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:D?(D.length===x.length?this.yylloc.first_column:0)+x[x.length-D.length].length-D[0].length:this.yylloc.first_column-R},this.options.ranges)this.yylloc.range=[j[0],j[0]+this.yyleng-R];return this.yyleng=this.yytext.length,this},"unput"),more:e(function(){return this._more=!0,this},"more"),reject:e(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:e(function(k){this.unput(this.match.slice(k))},"less"),pastInput:e(function(){var k=this.matched.substr(0,this.matched.length-this.match.length);return(k.length>20?"...":"")+k.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:e(function(){var k=this.match;if(k.length<20)k+=this._input.substr(0,20-k.length);return(k.substr(0,20)+(k.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:e(function(){var k=this.pastInput(),R=Array(k.length+1).join("-");return k+this.upcomingInput()+`
@@ -1,4 +1,4 @@
1
- import{z,o,g,i,a,v,t,n,_,q,li,bo,Hi,Mr,tr,xo,Yi,_o,Jr,ea,Pn,ci,ui}from"./chunk-aqm3spxt.js";var M={sealed:"已封存",folded:"已折叠",archived:"已移出"},T=["bg-accent","bg-accent-strong","bg-warning","bg-success"];function P(e,d){if(e.startsWith("recent-"))return"json";let c=d.trimStart();if(!c)return"markdown";if(c.startsWith("{")||c.startsWith("["))return"json";if(/^<[a-zA-Z_][\w.-]*(?:\s+[^>]*)?>/.test(c))return"xml";return"markdown"}function W(e){if(!e||e.length>32000)return e;if(!e.trimStart().startsWith("<"))return e;let c=[],m=0,s=(p)=>" ".repeat(p),l=/(<([a-zA-Z_][\w.-]*)(?:\s+[^>]*)?>([^\r\n<]*)<\/\2>)|(<\/[a-zA-Z_][\w.-]*>)|(<[a-zA-Z_][\w.-]*(?:\s+[^>]*)?\/>)|(<[a-zA-Z_][\w.-]*(?:\s+[^>]*)?>)|([^<]+)/g,u;while((u=l.exec(e))!==null){let[,p,,,f,r,x,y]=u;if(p)c.push(`${s(m)}${p.trim()}`);else if(f)m=Math.max(0,m-1),c.push(`${s(m)}${f.trim()}`);else if(x)c.push(`${s(m)}${x.trim()}`),m++;else if(r)c.push(`${s(m)}${r.trim()}`);else if(y){let h=y.trim();if(h)for(let w of h.split(/\r?\n/)){let E=w.trim();if(E)c.push(`${s(m)}${E}`)}}}return c.length>0?c.join(`
2
- `):e}function R(){return n("div",{role:"status","aria-busy":"true","aria-label":"正在加载上下文",className:"space-y-2 animate-pulse",children:[t("div",{className:"h-10 rounded-xl border border-line bg-panel/40"}),t("div",{className:"h-10 rounded-xl border border-line bg-panel/40"}),t("div",{className:"h-10 rounded-xl border border-line bg-panel/40"})]})}function k(e){let{style:d}=_();return t("p",{className:d("surface.empty"),children:e.children})}function B(e){let{cn:d}=_();if(!e.items.length)return t(k,{children:"新会话还没有上下文。发送第一条消息后,这里会显示构成。"});let c=e.items.reduce((m,s)=>m+s.tokens,0)||1;return n("div",{className:"space-y-2.5",children:[t("div",{className:"flex h-2 overflow-hidden rounded-full bg-raised",children:e.items.map((m,s)=>t("span",{className:d(T[s%T.length],"transition-[width] duration-300 ease-out-quint"),title:`${m.label}:${m.tokens.toLocaleString()} token`,style:{width:`${m.tokens/c*100}%`}},m.id))}),t("div",{className:"space-y-1.5",children:e.items.map((m,s)=>t(K,{item:m,total:c,index:s,color:T[s%T.length]??"bg-accent"},m.id))})]})}function K(e){let{cn:d,Chevron:c,CopyButton:m,Code:s,style:l,useTheme:u}=_();u();let[p,f]=a(!1),r=(e.item.tokens/e.total*100).toFixed(1),x=g(()=>p&&e.item.detail?tr(e.item.detail):"",[p,e.item.detail]),y=g(()=>x?P(e.item.id,x):"markdown",[x,e.item.id]),h=g(()=>{if(!x)return"";return y==="xml"?W(x):x},[x,y]);return n("div",{"data-state":p?"open":"closed",className:l("surface.interactive","group/collapsible"),children:[n("button",{type:"button","aria-expanded":p,onClick:()=>f((w)=>!w),className:"flex w-full items-center gap-2 px-3 py-2 text-left text-xs",children:[t("span",{className:d("size-2 shrink-0 rounded-full",e.color),"aria-hidden":!0}),t("span",{className:"min-w-0 flex-1 truncate font-medium text-ink",children:e.item.label}),e.item.state&&t("span",{className:l("control.badge","text-[10px]"),children:M[e.item.state]}),t("span",{className:"font-mono tabular-nums text-dim",children:e.item.tokens.toLocaleString()}),n("span",{className:"w-10 text-right font-mono text-[11px] tabular-nums text-faint",children:[r,"%"]}),t(c,{className:"-rotate-90 text-faint group-data-[state=open]/collapsible:rotate-90"})]}),p&&n("div",{className:"border-t border-line/60 bg-raised/20 px-3 py-2 text-xs text-dim",children:[t("div",{className:"mb-2 h-1 overflow-hidden rounded-full bg-raised",children:t("div",{className:d("h-full",e.color),style:{width:`${r}%`}})}),h?n("div",{className:l("surface.subtle","group/detail relative overflow-hidden rounded-lg bg-panel/70 p-2.5"),children:[t("div",{className:"absolute right-1.5 top-1.5 z-10",children:t(m,{text:e.item.detail,size:"icon-xs",className:"bg-raised/60 hover:bg-raised text-faint hover:text-ink backdrop-blur-sm"})}),t("div",{className:"max-h-80 overflow-y-auto pr-6 text-dim",children:t(s,{code:h,lang:y,className:"text-[11px]! leading-relaxed! [&_pre]:whitespace-pre-wrap [&_pre]:break-words [&_pre]:[overflow-wrap:anywhere]"})})]}):t("p",{className:"py-2 text-center text-xs text-faint",children:"(空)"})]})]})}var I=40,H={accent:"bg-accent/15 text-accent",success:"bg-success/15 text-success",warning:"bg-warning/15 text-warning",danger:"bg-danger/15 text-danger",neutral:"bg-raised text-dim"};function A(e){let{Button:d,CopyButton:c,style:m,useTheme:s}=_();s();let[l,u]=a(I),p=i(null),f=l<e.entries.length;o(()=>{let x=p.current;if(!x||!f||typeof IntersectionObserver>"u")return;let y=new IntersectionObserver((h)=>{if(h.some((w)=>w.isIntersecting))u((w)=>Math.min(e.entries.length,w+I))},{rootMargin:"480px"});return y.observe(x),()=>y.disconnect()},[f,e.entries.length]);let r=g(()=>e.entries.slice(-l).reverse(),[e.entries,l]);if(!e.entries.length)return t(k,{children:"还没有消息。"});return n("div",{className:"space-y-1.5",children:[n("div",{className:m("surface.subtle","flex items-center justify-between px-3 py-1.5 text-xs text-faint"),children:[n("span",{children:["共 ",e.entries.length," 条记录"]}),t(c,{text:()=>e.entries.map((x)=>JSON.stringify(x,null,2)).join(`
1
+ import{F,o,g,i,a,v,t,n,_,q,li,bo,Hi,Mr,tr,xo,Yi,_o,Jr,ea,Pn,ci,ui}from"./chunk-4bzqrwr0.js";var z={sealed:"已封存",folded:"已折叠",archived:"已移出"},T=["bg-accent","bg-accent-strong","bg-warning","bg-success"];function M(e,d){if(e.startsWith("recent-"))return"json";let c=d.trimStart();if(!c)return"markdown";if(c.startsWith("{")||c.startsWith("["))return"json";if(/^<[a-zA-Z_][\w.-]*(?:\s+[^>]*)?>/.test(c))return"xml";return"markdown"}function P(e){if(!e||e.length>32000)return e;if(!e.trimStart().startsWith("<"))return e;let c=[],m=0,s=(p)=>" ".repeat(p),l=/(<([a-zA-Z_][\w.-]*)(?:\s+[^>]*)?>([^\r\n<]*)<\/\2>)|(<\/[a-zA-Z_][\w.-]*>)|(<[a-zA-Z_][\w.-]*(?:\s+[^>]*)?\/>)|(<[a-zA-Z_][\w.-]*(?:\s+[^>]*)?>)|([^<]+)/g,u;while((u=l.exec(e))!==null){let[,p,,,f,r,x,y]=u;if(p)c.push(`${s(m)}${p.trim()}`);else if(f)m=Math.max(0,m-1),c.push(`${s(m)}${f.trim()}`);else if(x)c.push(`${s(m)}${x.trim()}`),m++;else if(r)c.push(`${s(m)}${r.trim()}`);else if(y){let h=y.trim();if(h)for(let w of h.split(/\r?\n/)){let E=w.trim();if(E)c.push(`${s(m)}${E}`)}}}return c.length>0?c.join(`
2
+ `):e}function R(){return n("div",{role:"status","aria-busy":"true","aria-label":"正在加载上下文",className:"space-y-2 animate-pulse",children:[t("div",{className:"h-10 rounded-xl border border-line bg-panel/40"}),t("div",{className:"h-10 rounded-xl border border-line bg-panel/40"}),t("div",{className:"h-10 rounded-xl border border-line bg-panel/40"})]})}function k(e){let{style:d}=_();return t("p",{className:d("surface.empty"),children:e.children})}function W(e){let{cn:d}=_();if(!e.items.length)return t(k,{children:"新会话还没有上下文。发送第一条消息后,这里会显示构成。"});let c=e.items.reduce((m,s)=>m+s.tokens,0)||1;return n("div",{className:"space-y-2.5",children:[t("div",{className:"flex h-2 overflow-hidden rounded-full bg-raised",children:e.items.map((m,s)=>t("span",{className:d(T[s%T.length],"transition-[width] duration-300 ease-out-quint"),title:`${m.label}:${m.tokens.toLocaleString()} token`,style:{width:`${m.tokens/c*100}%`}},m.id))}),t("div",{className:"space-y-1.5",children:e.items.map((m,s)=>t(K,{item:m,total:c,index:s,color:T[s%T.length]??"bg-accent"},m.id))})]})}function K(e){let{cn:d,Chevron:c,CopyButton:m,Code:s,style:l,useTheme:u}=_();u();let[p,f]=a(!1),r=(e.item.tokens/e.total*100).toFixed(1),x=g(()=>p&&e.item.detail?tr(e.item.detail):"",[p,e.item.detail]),y=g(()=>x?M(e.item.id,x):"markdown",[x,e.item.id]),h=g(()=>{if(!x)return"";return y==="xml"?P(x):x},[x,y]);return n("div",{"data-state":p?"open":"closed",className:l("surface.interactive","group/collapsible"),children:[n("button",{type:"button","aria-expanded":p,onClick:()=>f((w)=>!w),className:"flex w-full items-center gap-2 px-3 py-2 text-left text-xs",children:[t("span",{className:d("size-2 shrink-0 rounded-full",e.color),"aria-hidden":!0}),t("span",{className:"min-w-0 flex-1 truncate font-medium text-ink",children:e.item.label}),e.item.state&&t("span",{className:l("control.badge","text-[10px]"),children:z[e.item.state]}),t("span",{className:"font-mono tabular-nums text-dim",children:e.item.tokens.toLocaleString()}),n("span",{className:"w-10 text-right font-mono text-[11px] tabular-nums text-faint",children:[r,"%"]}),t(c,{className:"-rotate-90 text-faint group-data-[state=open]/collapsible:rotate-90"})]}),p&&n("div",{className:"border-t border-line/60 bg-raised/20 px-3 py-2 text-xs text-dim",children:[t("div",{className:"mb-2 h-1 overflow-hidden rounded-full bg-raised",children:t("div",{className:d("h-full",e.color),style:{width:`${r}%`}})}),h?n("div",{className:l("surface.subtle","group/detail relative overflow-hidden rounded-lg bg-panel/70 p-2.5"),children:[t("div",{className:"absolute right-1.5 top-1.5 z-10",children:t(m,{text:e.item.detail,size:"icon-xs",className:"bg-raised/60 hover:bg-raised text-faint hover:text-ink backdrop-blur-sm"})}),t("div",{className:"max-h-80 overflow-y-auto pr-6 text-dim",children:t(s,{code:h,lang:y,className:"text-[11px]! leading-relaxed! [&_pre]:whitespace-pre-wrap [&_pre]:break-words [&_pre]:[overflow-wrap:anywhere]"})})]}):t("p",{className:"py-2 text-center text-xs text-faint",children:"(空)"})]})]})}var I=40,H={accent:"bg-accent/15 text-accent",success:"bg-success/15 text-success",warning:"bg-warning/15 text-warning",danger:"bg-danger/15 text-danger",neutral:"bg-raised text-dim"};function B(e){let{Button:d,CopyButton:c,style:m,useTheme:s}=_();s();let[l,u]=a(I),p=i(null),f=l<e.entries.length;o(()=>{let x=p.current;if(!x||!f||typeof IntersectionObserver>"u")return;let y=new IntersectionObserver((h)=>{if(h.some((w)=>w.isIntersecting))u((w)=>Math.min(e.entries.length,w+I))},{rootMargin:"480px"});return y.observe(x),()=>y.disconnect()},[f,e.entries.length]);let r=g(()=>e.entries.slice(-l).reverse(),[e.entries,l]);if(!e.entries.length)return t(k,{children:"还没有消息。"});return n("div",{className:"space-y-1.5",children:[n("div",{className:m("surface.subtle","flex items-center justify-between px-3 py-1.5 text-xs text-faint"),children:[n("span",{children:["共 ",e.entries.length," 条记录"]}),t(c,{text:()=>e.entries.map((x)=>JSON.stringify(x,null,2)).join(`
3
3
 
4
- `),size:"icon-xs",label:"复制全部原始 JSON",className:"hover:bg-raised text-faint hover:text-ink"})]}),r.map((x)=>t(V,{entry:x},x.seq)),f&&n("div",{ref:p,className:m("surface.subtle","flex items-center justify-between bg-panel/40 px-3 py-2 text-xs text-faint"),children:[n("span",{children:["已显示 ",r.length," / ",e.entries.length," 条"]}),n("div",{className:"flex items-center gap-1.5",children:[t(d,{size:"sm",variant:"ghost",onClick:()=>u((x)=>Math.min(e.entries.length,x+I)),children:"加载更多"}),t(d,{size:"sm",variant:"ghost",onClick:()=>u(e.entries.length),children:"显示全部"})]})]})]})}var V=z(function(d){let{Chevron:c,CopyButton:m,style:s,useTheme:l}=_();l();let[u,p]=a(!1),f=xo(d.entry),r=g(()=>bo(d.entry.time),[d.entry.time]);return n("div",{"data-state":u?"open":"closed",className:s("surface.interactive","group/collapsible"),children:[n("button",{type:"button","aria-expanded":u,onClick:()=>p((x)=>!x),className:"flex w-full items-center gap-2 px-3 py-2 text-left text-xs",children:[n("span",{className:"shrink-0 font-mono text-[10.5px] tabular-nums text-faint",children:["#",d.entry.seq]}),t("span",{className:s("control.badge","shrink-0 font-medium text-[10px]",H[f.tone]),children:f.badge}),t("span",{className:"min-w-0 flex-1 truncate text-ink",children:f.title}),f.meta&&t("span",{className:s("control.badge","shrink-0 font-mono text-[10px] text-faint"),children:f.meta}),t("span",{className:"shrink-0 font-mono text-[10.5px] tabular-nums text-faint",children:r}),t(c,{className:"-rotate-90 text-faint group-data-[state=open]/collapsible:rotate-90"})]}),u&&t("div",{className:"border-t border-line/60 bg-raised/20 px-3 py-2.5 text-xs text-dim",children:n("div",{className:"space-y-2",children:[n("div",{className:"flex items-center justify-between text-[11px] text-faint",children:[n("span",{className:"font-mono",children:[d.entry.type," · #",d.entry.seq]}),t(m,{text:()=>JSON.stringify(d.entry,null,2),size:"icon-xs",label:"复制此条 JSON",className:"bg-raised/60 hover:bg-raised text-faint hover:text-ink"})]}),t(X,{entry:d.entry})]})})]})});function X(e){let{Code:d,style:c,useTheme:m}=_();m();let s=e.entry;if(s.type==="user")return n("div",{className:"space-y-2",children:[s.text&&t("pre",{className:c("surface.subtle","max-h-72 overflow-y-auto p-2.5 font-sans text-xs leading-relaxed text-ink whitespace-pre-wrap break-words [overflow-wrap:anywhere]"),children:Mr(s.text)}),s.attachments&&s.attachments.length>0&&n("div",{className:"space-y-1",children:[n("div",{className:"text-[10.5px] font-medium text-faint",children:["附件(",s.attachments.length,")"]}),t("div",{className:"flex flex-wrap gap-1.5",children:s.attachments.map((l,u)=>{let p=l.kind==="image"?Math.floor(l.data.length*0.75):l.data.length;return n("div",{className:c("surface.subtle","inline-flex items-center gap-1.5 px-2 py-1 text-[11px]"),children:[t("span",{className:c("control.badge","text-[10px] text-faint"),children:l.kind==="image"?"图片":l.kind==="path"?"路径":"文本"}),t("span",{className:"max-w-40 truncate font-medium text-ink",children:l.name}),n("span",{className:"font-mono text-[10px] text-faint",children:[l.mimeType," · ",Hi(p)]})]},`${l.name}-${u}`)})})]}),s.notices&&s.notices.length>0&&n("div",{className:"space-y-1",children:[n("div",{className:"text-[10.5px] font-medium text-faint",children:["通知来源(",s.notices.length,")"]}),s.notices.map((l)=>n("div",{className:c("surface.subtle","flex items-center justify-between px-2.5 py-1.5 font-mono text-[11px]"),children:[n("span",{className:"truncate text-ink",children:[l.sourceKind,"/",l.sourceID]}),t("span",{className:"text-faint",children:l.state})]},l.dedupeKey))]})]});if(s.type==="assistant")return n("div",{className:"space-y-2",children:[n("div",{className:"font-mono text-[11px] text-faint",children:["模型:",s.model]}),s.error&&t("div",{className:"rounded-lg border border-danger/30 bg-danger/8 px-2.5 py-2 text-xs text-danger",children:s.error}),s.parts.map((l,u)=>{if(l.type==="thinking")return n("div",{className:c("surface.subtle","p-2.5 space-y-1"),children:[t("div",{className:"text-[10.5px] font-medium text-faint",children:"思考"}),t("pre",{className:"max-h-60 overflow-y-auto font-sans text-xs italic leading-relaxed text-dim whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:Mr(l.text)})]},`thinking-${u}`);if(l.type==="text")return n("div",{className:c("surface.subtle","p-2.5 space-y-1"),children:[t("div",{className:"text-[10.5px] font-medium text-faint",children:"回复"}),t("pre",{className:"max-h-60 overflow-y-auto font-sans text-xs leading-relaxed text-ink whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:Mr(l.text)})]},`text-${u}`);return n("div",{className:c("surface.subtle","p-2.5 space-y-1.5"),children:[n("div",{className:"flex items-center justify-between gap-2 text-[11px]",children:[n("span",{className:"font-mono font-medium text-ink",children:["工具调用 · ",l.name]}),t("span",{className:"truncate font-mono text-[10px] text-faint",children:l.id})]}),t("div",{className:"max-h-60 overflow-y-auto text-dim",children:t(d,{code:tr(JSON.stringify(l.input,Yi,2)),lang:"json",className:"text-[11px]! leading-relaxed! [&_pre]:whitespace-pre-wrap [&_pre]:break-words [&_pre]:[overflow-wrap:anywhere]"})})]},l.id||`tool-${u}`)})]});if(s.type==="tool_result")return n("div",{className:"space-y-2",children:[n("div",{className:"flex flex-wrap items-center gap-2 font-mono text-[11px] text-faint",children:[t("span",{className:"text-ink",children:s.name}),t("span",{children:"·"}),t("span",{className:"truncate",children:s.callID}),t("span",{className:c("control.badge","ml-auto font-sans text-[10px]",s.isError?"bg-danger/15 text-danger":"text-dim"),children:s.isError?"执行失败":"执行完成"})]}),s.images&&s.images.length>0&&t("div",{className:"flex flex-wrap gap-1.5",children:s.images.map((l,u)=>n("span",{className:c("surface.subtle","px-2 py-1 font-mono text-[10.5px] text-faint"),children:["图片 #",u+1," · ",l.mimeType," · ",Hi(Math.floor(l.data.length*0.75))]},`${l.mimeType}-${u}`))}),li(s.output)?t("pre",{className:c("surface.subtle","max-h-72 overflow-y-auto p-2.5 font-mono text-[11px] leading-relaxed whitespace-pre-wrap break-words [overflow-wrap:anywhere]",s.isError?"text-danger":"text-dim"),children:Mr(s.output)}):t("p",{className:"py-1 text-faint",children:"(无文本输出)"})]});return t("pre",{className:c("surface.subtle","max-h-72 overflow-y-auto p-2.5 font-mono text-[11px] leading-relaxed text-dim whitespace-pre-wrap break-words [overflow-wrap:anywhere]"),children:_o(s)})}function L(e){let{cn:d,style:c,useTheme:m}=_();if(m(),!e.todos.length)return t(k,{children:"暂无待办。"});return t("ul",{className:"space-y-1.5",children:e.todos.map((s)=>n("li",{className:c("surface.interactive","flex items-start gap-2.5 px-3 py-2 text-xs"),children:[n("span",{className:d("mt-0.5 flex size-4 shrink-0 items-center justify-center rounded-full border transition-colors duration-300",s.status==="completed"&&"border-success bg-success text-panel",s.status==="in_progress"&&"border-accent",s.status==="pending"&&"border-line-strong"),children:[s.status==="completed"&&t(q,{className:"size-2.5 animate-pop",strokeWidth:3.5}),s.status==="in_progress"&&t("span",{className:"size-1.5 animate-pulse rounded-full bg-accent"})]}),t("span",{className:d("min-w-0 flex-1 break-words leading-relaxed [overflow-wrap:anywhere]",s.status==="completed"&&"text-faint line-through decoration-faint/60",s.status==="in_progress"&&"font-medium text-ink",s.status==="pending"&&"text-dim"),children:s.content})]},`${s.status}-${s.content}`))})}function O(e){let{cn:d,style:c,useTheme:m}=_();m();let[s,l]=a("all"),u=g(()=>e.tools.filter((r)=>r.deferred).length,[e.tools]),p=e.tools.length-u,f=g(()=>{if(s==="deferred")return e.tools.filter((r)=>r.deferred);if(s==="active")return e.tools.filter((r)=>!r.deferred);return e.tools},[e.tools,s]);if(!e.tools.length)return t(k,{children:"当前会话没有可用工具。"});return n("div",{className:"space-y-2",children:[u>0&&n("div",{className:"flex items-center gap-1 text-[11px]",children:[n("button",{type:"button",onClick:()=>l("all"),className:d("rounded-lg px-2 py-1 transition-colors",s==="all"?"bg-raised font-medium text-ink":"text-faint hover:text-dim"),children:["全部 (",e.tools.length,")"]}),n("button",{type:"button",onClick:()=>l("active"),className:d("rounded-lg px-2 py-1 transition-colors",s==="active"?"bg-raised font-medium text-ink":"text-faint hover:text-dim"),children:["常驻 (",p,")"]}),n("button",{type:"button",onClick:()=>l("deferred"),className:d("rounded-lg px-2 py-1 transition-colors",s==="deferred"?"bg-raised font-medium text-ink":"text-faint hover:text-dim"),children:["延迟加载 (",u,")"]})]}),t("div",{className:"space-y-1.5",children:f.map((r)=>t(G,{tool:r},`${r.group}-${r.name}`))})]})}function G(e){let{Chevron:d,CopyButton:c,Code:m,style:s,useTheme:l}=_();l();let[u,p]=a(!1),f=g(()=>u?JSON.stringify(e.tool.schema,null,2):"",[u,e.tool.schema]);return n("div",{"data-state":u?"open":"closed",className:s("surface.interactive","group/collapsible"),children:[n("button",{type:"button","aria-expanded":u,onClick:()=>p((r)=>!r),className:"flex w-full items-center justify-between px-3 py-2 text-left text-xs",children:[n("div",{className:"flex min-w-0 flex-1 items-center gap-1.5 truncate font-mono text-ink",children:[t("span",{className:"truncate",children:e.tool.name}),e.tool.group&&t("span",{className:s("control.badge","font-sans text-[10px]"),children:e.tool.group}),e.tool.deferred&&t("span",{className:s("control.badge","font-sans text-[10px]"),children:"延迟加载"})]}),t(d,{className:"-rotate-90 text-faint group-data-[state=open]/collapsible:rotate-90"})]}),u&&n("div",{className:"border-t border-line/60 bg-raised/20 px-3 py-2 text-xs text-dim",children:[e.tool.deferred&&t("div",{className:s("surface.subtle","mb-2 px-2.5 py-1.5 text-[11px] text-faint"),children:"延迟加载:此工具默认以精简描述挂载,模型通过 toolsearch 取回定义后才向上下文注入完整参数 Schema。"}),e.tool.description&&t("pre",{className:"mb-2 max-h-60 overflow-y-auto font-sans text-xs leading-relaxed text-dim whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:tr(e.tool.description)}),n("div",{className:s("surface.subtle","group/schema relative overflow-hidden rounded-lg p-2.5"),children:[t("div",{className:"absolute right-1.5 top-1.5 z-10",children:t(c,{text:f,size:"icon-xs",className:"bg-raised/60 hover:bg-raised text-faint hover:text-ink backdrop-blur-sm"})}),t("div",{className:"max-h-72 overflow-y-auto pr-6 text-dim",children:t(m,{code:tr(f),lang:"json",className:"text-[11px]! leading-relaxed! [&_pre]:whitespace-pre-wrap [&_pre]:break-words [&_pre]:[overflow-wrap:anywhere]"})})]})]})]})}function Q(){try{let e=localStorage.getItem("basalt.contextSidebar.tab");if(e==="tools"||e==="todos"||e==="raw")return e}catch{}return"breakdown"}function Y(e){let{style:d,useTheme:c}=_();return c(),n("div",{className:d("surface.panel","bg-panel/70 px-3 py-2"),children:[t("div",{className:"text-[10px] font-medium uppercase tracking-wider text-faint",children:e.label}),t("div",{className:"mt-0.5 truncate font-mono text-xs font-semibold tabular-nums text-ink",children:e.value})]})}function Pe(e){let{Button:d,StatusChip:c,Segmented:m,cn:s,style:l,useTheme:u}=_();u();let[p,f]=a(Q),[r,x]=a(()=>Pn.get(e.session.id)),[y,h]=a(!1),[w,E]=a(0),[D,j]=a(!1);o(()=>{let b=setTimeout(()=>j(!0),140);return()=>clearTimeout(b)},[]),o(()=>{let b=Pn.get(e.session.id);if(b)x(b);return ci((C,Z)=>{if(C===e.session.id)x(Z)})},[e.session.id]),o(()=>{let b=new AbortController;return h(!1),e.connection.request(`/api/sessions/${encodeURIComponent(e.session.id)}/context`,{signal:AbortSignal.any([b.signal,AbortSignal.timeout(15000)])}).then((C)=>{if(!b.signal.aborted)ui(e.session.id,C),x(C)},()=>{if(!b.signal.aborted)h(!0)}),()=>b.abort()},[e.connection,e.session.id,e.session.updated,e.entries.length,w]);let N=Jr(r?.items??[],r?.usableWindow,r?.calibratedTokens,r?.lastInputTokens,r?.hasPendingOutput),S=ea(N.percent),U=(b)=>{f(b);try{localStorage.setItem("basalt.contextSidebar.tab",b)}catch{}},J=[{value:"breakdown",label:"构成"},{value:"tools",label:n("span",{className:"inline-flex items-center gap-1",children:["工具",r&&t("span",{className:"text-[10px] text-faint tabular-nums",children:r.tools.length})]})},{value:"todos",label:n("span",{className:"inline-flex items-center gap-1",children:["待办",e.session.todos.length>0&&t("span",{className:"text-[10px] text-faint tabular-nums",children:e.session.todos.length})]})},{value:"raw",label:"原始消息"}],F=n("div",{className:"border-b border-line px-3.5 py-3",children:[n("div",{className:"flex items-start justify-between gap-3",children:[n("div",{children:[t("div",{className:"text-[10.5px] font-medium uppercase tracking-wider text-faint",children:"上下文用量"}),n("div",{className:"mt-0.5 flex items-baseline gap-1.5",children:[t("span",{className:"font-mono text-xl font-semibold tabular-nums text-ink",children:r?N.totalTokens.toLocaleString():"—"}),n("span",{className:"font-mono text-xs text-dim",children:["/ ",r?.usableWindow.toLocaleString()??"—"]})]})]}),t(c,{tone:S==="overflow"||S==="near_limit"?"danger":S==="sealing"?"warning":"success",children:S==="overflow"?"预计超限":S==="near_limit"?"接近上限":S==="sealing"?"接近封存":"正常"})]}),N.percent!==null&&t("meter",{className:"sr-only","aria-label":"可用上下文窗口占比",min:0,max:100,value:Math.min(100,N.percent)}),t("div",{"aria-hidden":!0,className:s("relative mt-2.5 h-2 w-full overflow-hidden rounded-full bg-raised",!r&&"animate-pulse"),children:t("div",{className:"h-full rounded-full bg-accent transition-[width] duration-500 ease-out-quint",style:{width:`${Math.min(100,N.percent??0)}%`}})}),n("div",{className:"mt-2 flex items-center justify-between text-[11px]",children:[t("span",{className:"text-dim",children:N.percent===null?"暂无窗口数据":`${N.percent.toFixed(1)}% 可用窗口`}),n("span",{className:"text-faint",children:["总窗口 ",r?.contextWindow.toLocaleString()??"—"," · 80% 封存 · 97% 折叠"]})]}),r?.usage&&(r.usage.input>0||r.usage.output>0||r.usage.cacheRead>0||r.usage.cacheWrite>0||r.usage.cost>0)&&t("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[["Input",r.usage.input.toLocaleString()],["Output",r.usage.output.toLocaleString()],["Cache",`${r.usage.cacheRead.toLocaleString()} / ${r.usage.cacheWrite.toLocaleString()}`],["平均 TPS",r.usage.tps!==void 0?`${r.usage.tps.toFixed(1)} tok/s`:"—"]].map(([b,C])=>t(Y,{label:b,value:C},b))})]});return n(v,{children:[F,t("div",{className:"border-b border-line px-3 py-2",children:t(m,{value:p,onChange:U,options:J,className:"w-full grid grid-cols-4"})}),n("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 py-3",children:[y&&!r&&n("div",{role:"alert",className:"flex items-center justify-between rounded-xl border border-danger/30 bg-danger/8 px-3 py-2 text-xs text-danger",children:[t("span",{children:"上下文加载失败。"}),t(d,{size:"sm",variant:"ghost",onClick:()=>E((b)=>b+1),children:"重试"})]}),t("div",{children:!D?t(R,{}):n(v,{children:[p==="raw"&&t(A,{entries:e.entries}),p==="todos"&&t(L,{todos:e.session.todos}),p==="breakdown"&&(r?t(B,{items:N.items}):!y?t(R,{}):null),p==="tools"&&(r?t(O,{tools:r.tools??[]}):!y?t(R,{}):null)]})},p)]})]})}export{Pe as ContextSidebar};
4
+ `),size:"icon-xs",label:"复制全部原始 JSON",className:"hover:bg-raised text-faint hover:text-ink"})]}),r.map((x)=>t(V,{entry:x},x.seq)),f&&n("div",{ref:p,className:m("surface.subtle","flex items-center justify-between bg-panel/40 px-3 py-2 text-xs text-faint"),children:[n("span",{children:["已显示 ",r.length," / ",e.entries.length," 条"]}),n("div",{className:"flex items-center gap-1.5",children:[t(d,{size:"sm",variant:"ghost",onClick:()=>u((x)=>Math.min(e.entries.length,x+I)),children:"加载更多"}),t(d,{size:"sm",variant:"ghost",onClick:()=>u(e.entries.length),children:"显示全部"})]})]})]})}var V=F(function(d){let{Chevron:c,CopyButton:m,style:s,useTheme:l}=_();l();let[u,p]=a(!1),f=xo(d.entry),r=g(()=>bo(d.entry.time),[d.entry.time]);return n("div",{"data-state":u?"open":"closed",className:s("surface.interactive","group/collapsible"),children:[n("button",{type:"button","aria-expanded":u,onClick:()=>p((x)=>!x),className:"flex w-full items-center gap-2 px-3 py-2 text-left text-xs",children:[n("span",{className:"shrink-0 font-mono text-[10.5px] tabular-nums text-faint",children:["#",d.entry.seq]}),t("span",{className:s("control.badge","shrink-0 font-medium text-[10px]",H[f.tone]),children:f.badge}),t("span",{className:"min-w-0 flex-1 truncate text-ink",children:f.title}),f.meta&&t("span",{className:s("control.badge","shrink-0 font-mono text-[10px] text-faint"),children:f.meta}),t("span",{className:"shrink-0 font-mono text-[10.5px] tabular-nums text-faint",children:r}),t(c,{className:"-rotate-90 text-faint group-data-[state=open]/collapsible:rotate-90"})]}),u&&t("div",{className:"border-t border-line/60 bg-raised/20 px-3 py-2.5 text-xs text-dim",children:n("div",{className:"space-y-2",children:[n("div",{className:"flex items-center justify-between text-[11px] text-faint",children:[n("span",{className:"font-mono",children:[d.entry.type," · #",d.entry.seq]}),t(m,{text:()=>JSON.stringify(d.entry,null,2),size:"icon-xs",label:"复制此条 JSON",className:"bg-raised/60 hover:bg-raised text-faint hover:text-ink"})]}),t(X,{entry:d.entry})]})})]})});function X(e){let{Code:d,style:c,useTheme:m}=_();m();let s=e.entry;if(s.type==="user")return n("div",{className:"space-y-2",children:[s.text&&t("pre",{className:c("surface.subtle","max-h-72 overflow-y-auto p-2.5 font-sans text-xs leading-relaxed text-ink whitespace-pre-wrap break-words [overflow-wrap:anywhere]"),children:Mr(s.text)}),s.attachments&&s.attachments.length>0&&n("div",{className:"space-y-1",children:[n("div",{className:"text-[10.5px] font-medium text-faint",children:["附件(",s.attachments.length,")"]}),t("div",{className:"flex flex-wrap gap-1.5",children:s.attachments.map((l,u)=>{let p=l.kind==="image"?Math.floor(l.data.length*0.75):l.data.length;return n("div",{className:c("surface.subtle","inline-flex items-center gap-1.5 px-2 py-1 text-[11px]"),children:[t("span",{className:c("control.badge","text-[10px] text-faint"),children:l.kind==="image"?"图片":l.kind==="path"?"路径":"文本"}),t("span",{className:"max-w-40 truncate font-medium text-ink",children:l.name}),n("span",{className:"font-mono text-[10px] text-faint",children:[l.mimeType," · ",Hi(p)]})]},`${l.name}-${u}`)})})]}),s.notices&&s.notices.length>0&&n("div",{className:"space-y-1",children:[n("div",{className:"text-[10.5px] font-medium text-faint",children:["通知来源(",s.notices.length,")"]}),s.notices.map((l)=>n("div",{className:c("surface.subtle","flex items-center justify-between px-2.5 py-1.5 font-mono text-[11px]"),children:[n("span",{className:"truncate text-ink",children:[l.sourceKind,"/",l.sourceID]}),t("span",{className:"text-faint",children:l.state})]},l.dedupeKey))]})]});if(s.type==="assistant")return n("div",{className:"space-y-2",children:[n("div",{className:"font-mono text-[11px] text-faint",children:["模型:",s.model]}),s.error&&t("div",{className:"rounded-lg border border-danger/30 bg-danger/8 px-2.5 py-2 text-xs text-danger",children:s.error}),s.parts.map((l,u)=>{if(l.type==="thinking")return n("div",{className:c("surface.subtle","p-2.5 space-y-1"),children:[t("div",{className:"text-[10.5px] font-medium text-faint",children:"思考"}),t("pre",{className:"max-h-60 overflow-y-auto font-sans text-xs italic leading-relaxed text-dim whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:Mr(l.text)})]},`thinking-${u}`);if(l.type==="text")return n("div",{className:c("surface.subtle","p-2.5 space-y-1"),children:[t("div",{className:"text-[10.5px] font-medium text-faint",children:"回复"}),t("pre",{className:"max-h-60 overflow-y-auto font-sans text-xs leading-relaxed text-ink whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:Mr(l.text)})]},`text-${u}`);return n("div",{className:c("surface.subtle","p-2.5 space-y-1.5"),children:[n("div",{className:"flex items-center justify-between gap-2 text-[11px]",children:[n("span",{className:"font-mono font-medium text-ink",children:["工具调用 · ",l.name]}),t("span",{className:"truncate font-mono text-[10px] text-faint",children:l.id})]}),t("div",{className:"max-h-60 overflow-y-auto text-dim",children:t(d,{code:tr(JSON.stringify(l.input,Yi,2)),lang:"json",className:"text-[11px]! leading-relaxed! [&_pre]:whitespace-pre-wrap [&_pre]:break-words [&_pre]:[overflow-wrap:anywhere]"})})]},l.id||`tool-${u}`)})]});if(s.type==="tool_result")return n("div",{className:"space-y-2",children:[n("div",{className:"flex flex-wrap items-center gap-2 font-mono text-[11px] text-faint",children:[t("span",{className:"text-ink",children:s.name}),t("span",{children:"·"}),t("span",{className:"truncate",children:s.callID}),t("span",{className:c("control.badge","ml-auto font-sans text-[10px]",s.isError?"bg-danger/15 text-danger":"text-dim"),children:s.isError?"执行失败":"执行完成"})]}),s.images&&s.images.length>0&&t("div",{className:"flex flex-wrap gap-1.5",children:s.images.map((l,u)=>n("span",{className:c("surface.subtle","px-2 py-1 font-mono text-[10.5px] text-faint"),children:["图片 #",u+1," · ",l.mimeType," · ",Hi(Math.floor(l.data.length*0.75))]},`${l.mimeType}-${u}`))}),li(s.output)?t("pre",{className:c("surface.subtle","max-h-72 overflow-y-auto p-2.5 font-mono text-[11px] leading-relaxed whitespace-pre-wrap break-words [overflow-wrap:anywhere]",s.isError?"text-danger":"text-dim"),children:Mr(s.output)}):t("p",{className:"py-1 text-faint",children:"(无文本输出)"})]});return t("pre",{className:c("surface.subtle","max-h-72 overflow-y-auto p-2.5 font-mono text-[11px] leading-relaxed text-dim whitespace-pre-wrap break-words [overflow-wrap:anywhere]"),children:_o(s)})}function A(e){let{cn:d,style:c,useTheme:m}=_();if(m(),!e.todos.length)return t(k,{children:"暂无待办。"});return t("ul",{className:"space-y-1.5",children:e.todos.map((s)=>n("li",{className:c("surface.interactive","flex items-start gap-2.5 px-3 py-2 text-xs"),children:[n("span",{className:d("mt-0.5 flex size-4 shrink-0 items-center justify-center rounded-full border transition-colors duration-300",s.status==="completed"&&"border-success bg-success text-panel",s.status==="in_progress"&&"border-accent",s.status==="pending"&&"border-line-strong"),children:[s.status==="completed"&&t(q,{className:"size-2.5 animate-pop",strokeWidth:3.5}),s.status==="in_progress"&&t("span",{className:"size-1.5 animate-pulse rounded-full bg-accent"})]}),t("span",{className:d("min-w-0 flex-1 break-words leading-relaxed [overflow-wrap:anywhere]",s.status==="completed"&&"text-faint line-through decoration-faint/60",s.status==="in_progress"&&"font-medium text-ink",s.status==="pending"&&"text-dim"),children:s.content})]},`${s.status}-${s.content}`))})}function L(e){let{cn:d,style:c,useTheme:m}=_();m();let[s,l]=a("all"),u=g(()=>e.tools.filter((r)=>r.deferred).length,[e.tools]),p=e.tools.length-u,f=g(()=>{if(s==="deferred")return e.tools.filter((r)=>r.deferred);if(s==="active")return e.tools.filter((r)=>!r.deferred);return e.tools},[e.tools,s]);if(!e.tools.length)return t(k,{children:"当前会话没有可用工具。"});return n("div",{className:"space-y-2",children:[u>0&&n("div",{className:"flex items-center gap-1 text-[11px]",children:[n("button",{type:"button",onClick:()=>l("all"),className:d("rounded-lg px-2 py-1 transition-colors",s==="all"?"bg-raised font-medium text-ink":"text-faint hover:text-dim"),children:["全部 (",e.tools.length,")"]}),n("button",{type:"button",onClick:()=>l("active"),className:d("rounded-lg px-2 py-1 transition-colors",s==="active"?"bg-raised font-medium text-ink":"text-faint hover:text-dim"),children:["常驻 (",p,")"]}),n("button",{type:"button",onClick:()=>l("deferred"),className:d("rounded-lg px-2 py-1 transition-colors",s==="deferred"?"bg-raised font-medium text-ink":"text-faint hover:text-dim"),children:["延迟加载 (",u,")"]})]}),t("div",{className:"space-y-1.5",children:f.map((r)=>t(G,{tool:r},`${r.group}-${r.name}`))})]})}function G(e){let{Chevron:d,CopyButton:c,Code:m,style:s,useTheme:l}=_();l();let[u,p]=a(!1),f=g(()=>u?JSON.stringify(e.tool.schema,null,2):"",[u,e.tool.schema]);return n("div",{"data-state":u?"open":"closed",className:s("surface.interactive","group/collapsible"),children:[n("button",{type:"button","aria-expanded":u,onClick:()=>p((r)=>!r),className:"flex w-full items-center justify-between px-3 py-2 text-left text-xs",children:[n("div",{className:"flex min-w-0 flex-1 items-center gap-1.5 truncate font-mono text-ink",children:[t("span",{className:"truncate",children:e.tool.name}),e.tool.group&&t("span",{className:s("control.badge","font-sans text-[10px]"),children:e.tool.group}),e.tool.deferred&&t("span",{className:s("control.badge","font-sans text-[10px]"),children:"延迟加载"})]}),t(d,{className:"-rotate-90 text-faint group-data-[state=open]/collapsible:rotate-90"})]}),u&&n("div",{className:"border-t border-line/60 bg-raised/20 px-3 py-2 text-xs text-dim",children:[e.tool.deferred&&t("div",{className:s("surface.subtle","mb-2 px-2.5 py-1.5 text-[11px] text-faint"),children:"延迟加载:此工具默认以精简描述挂载,模型通过 toolsearch 取回定义后才向上下文注入完整参数 Schema。"}),e.tool.description&&t("pre",{className:"mb-2 max-h-60 overflow-y-auto font-sans text-xs leading-relaxed text-dim whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:tr(e.tool.description)}),n("div",{className:s("surface.subtle","group/schema relative overflow-hidden rounded-lg p-2.5"),children:[t("div",{className:"absolute right-1.5 top-1.5 z-10",children:t(c,{text:f,size:"icon-xs",className:"bg-raised/60 hover:bg-raised text-faint hover:text-ink backdrop-blur-sm"})}),t("div",{className:"max-h-72 overflow-y-auto pr-6 text-dim",children:t(m,{code:tr(f),lang:"json",className:"text-[11px]! leading-relaxed! [&_pre]:whitespace-pre-wrap [&_pre]:break-words [&_pre]:[overflow-wrap:anywhere]"})})]})]})]})}function Q(){try{let e=localStorage.getItem("basalt.contextSidebar.tab");if(e==="tools"||e==="todos"||e==="raw")return e}catch{}return"breakdown"}function Y(e){let{style:d,useTheme:c}=_();return c(),n("div",{className:d("surface.panel","bg-panel/70 px-3 py-2"),children:[t("div",{className:"text-[10px] font-medium uppercase tracking-wider text-faint",children:e.label}),t("div",{className:"mt-0.5 truncate font-mono text-xs font-semibold tabular-nums text-ink",children:e.value})]})}function Pe(e){let{Button:d,StatusChip:c,Segmented:m,cn:s,style:l,useTheme:u}=_();u();let[p,f]=a(Q),[r,x]=a(()=>Pn.get(e.session.id)),[y,h]=a(!1),[w,E]=a(0),[O,D]=a(!1);o(()=>{let b=setTimeout(()=>D(!0),140);return()=>clearTimeout(b)},[]),o(()=>{let b=Pn.get(e.session.id);if(b)x(b);return ci((C,Z)=>{if(C===e.session.id)x(Z)})},[e.session.id]),o(()=>{let b=new AbortController;return h(!1),e.connection.request(`/api/sessions/${encodeURIComponent(e.session.id)}/context`,{signal:AbortSignal.any([b.signal,AbortSignal.timeout(15000)])}).then((C)=>{if(!b.signal.aborted)ui(e.session.id,C),x(C)},()=>{if(!b.signal.aborted)h(!0)}),()=>b.abort()},[e.connection,e.session.id,e.session.updated,e.entries.length,w]);let N=Jr(r?.items??[],r?.usableWindow,r?.calibratedTokens,r?.lastInputTokens,r?.hasPendingOutput),S=ea(N.percent),j=(b)=>{f(b);try{localStorage.setItem("basalt.contextSidebar.tab",b)}catch{}},U=[{value:"breakdown",label:"构成"},{value:"tools",label:n("span",{className:"inline-flex items-center gap-1",children:["工具",r&&t("span",{className:"text-[10px] text-faint tabular-nums",children:r.tools.length})]})},{value:"todos",label:n("span",{className:"inline-flex items-center gap-1",children:["待办",e.session.todos.length>0&&t("span",{className:"text-[10px] text-faint tabular-nums",children:e.session.todos.length})]})},{value:"raw",label:"原始消息"}],J=n("div",{className:"border-b border-line px-3.5 py-3",children:[n("div",{className:"flex items-start justify-between gap-3",children:[n("div",{children:[t("div",{className:"text-[10.5px] font-medium uppercase tracking-wider text-faint",children:"上下文用量"}),n("div",{className:"mt-0.5 flex items-baseline gap-1.5",children:[t("span",{className:"font-mono text-xl font-semibold tabular-nums text-ink",children:r?N.totalTokens.toLocaleString():"—"}),n("span",{className:"font-mono text-xs text-dim",children:["/ ",r?.usableWindow.toLocaleString()??"—"]})]})]}),t(c,{tone:S==="overflow"||S==="near_limit"?"danger":S==="sealing"?"warning":"success",children:S==="overflow"?"预计超限":S==="near_limit"?"接近上限":S==="sealing"?"接近封存":"正常"})]}),N.percent!==null&&t("meter",{className:"sr-only","aria-label":"可用上下文窗口占比",min:0,max:100,value:Math.min(100,N.percent)}),t("div",{"aria-hidden":!0,className:s("relative mt-2.5 h-2 w-full overflow-hidden rounded-full bg-raised",!r&&"animate-pulse"),children:t("div",{className:"h-full rounded-full bg-accent transition-[width] duration-500 ease-out-quint",style:{width:`${Math.min(100,N.percent??0)}%`}})}),n("div",{className:"mt-2 flex items-center justify-between text-[11px]",children:[t("span",{className:"text-dim",children:N.percent===null?"暂无窗口数据":`${N.percent.toFixed(1)}% 可用窗口`}),n("span",{className:"text-faint",children:["总窗口 ",r?.contextWindow.toLocaleString()??"—"," · 80% 封存 · 97% 折叠"]})]}),r?.usage&&(r.usage.input>0||r.usage.output>0||r.usage.cacheRead>0||r.usage.cacheWrite>0||r.usage.cost>0)&&t("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[["Input",r.usage.input.toLocaleString()],["Output",r.usage.output.toLocaleString()],["Cache",`${r.usage.cacheRead.toLocaleString()} / ${r.usage.cacheWrite.toLocaleString()}`],["平均 TPS",r.usage.tps!==void 0?`${r.usage.tps.toFixed(1)} tok/s`:"—"]].map(([b,C])=>t(Y,{label:b,value:C},b))})]});return n(v,{children:[J,t("div",{className:"border-b border-line px-3 py-2",children:t(m,{value:p,onChange:j,options:U,className:"w-full grid grid-cols-4"})}),n("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 py-3",children:[y&&!r&&n("div",{role:"alert",className:"flex items-center justify-between rounded-xl border border-danger/30 bg-danger/8 px-3 py-2 text-xs text-danger",children:[t("span",{children:"上下文加载失败。"}),t(d,{size:"sm",variant:"ghost",onClick:()=>E((b)=>b+1),children:"重试"})]}),t("div",{children:!O?t(R,{}):n(v,{children:[p==="raw"&&t(B,{entries:e.entries}),p==="todos"&&t(A,{todos:e.session.todos}),p==="breakdown"&&(r?t(W,{items:N.items}):!y?t(R,{}):null),p==="tools"&&(r?t(L,{tools:r.tools??[]}):!y?t(R,{}):null)]})},p)]})]})}export{Pe as ContextSidebar};
@@ -1 +1 @@
1
- import{o,ee,i,a,v,t,n,_,Z,te,rt,vt}from"./chunk-aqm3spxt.js";import{gn}from"./chunk-f078k1ej.js";var U=[{id:"exa",name:"Exa",description:"免密钥 · 综合搜索"},{id:"tavily",name:"Tavily",description:"免密钥 · 支持域名筛选"},{id:"parallel",name:"Parallel",description:"免密钥 · 网页搜索"},{id:"firecrawl",name:"Firecrawl",description:"免密钥 · 网页内容"},{id:"tinyfish",name:"TinyFish",description:"免密钥 · 搜索摘要"},{id:"searxng",name:"SearXNG",description:"免密钥 · 需自建服务"},{id:"brave",name:"Brave",description:"需密钥 · 独立搜索引擎"}];function R(e){return{enabled:e.search.provider!=="off",provider:e.search.provider==="off"?"auto":e.search.provider,searxngUrl:e.search.searxngUrl??"",proxy:e.proxy??"",acceptLanguage:e.acceptLanguage??""}}function A(e,d){return{search:{provider:e.enabled?e.provider:"off",searxngUrl:e.searxngUrl},keys:{...d},proxy:e.proxy,acceptLanguage:e.acceptLanguage}}function z(e,d,x){let g=R(e);if(d.enabled!==g.enabled)return!0;if(d.enabled&&d.provider!==g.provider)return!0;return d.searxngUrl!==g.searxngUrl||d.proxy!==g.proxy||d.acceptLanguage!==g.acceptLanguage||Object.keys(x).length>0}function B({notice:e}){let{cn:d}=_();if(!e)return null;let x=e.type==="success"?gn:Z;return n("div",{role:e.type==="error"?"alert":"status",className:d("flex items-start gap-2 text-xs",e.type==="success"?"text-success":"text-danger"),children:[t(x,{className:"mt-0.5 size-4 shrink-0","aria-hidden":"true"}),t("span",{className:"min-w-0 break-words",children:e.text})]})}function F(e){let{Button:d,Input:x,Switch:g,Select:W,StatusChip:p,SettingGroup:h,SettingRow:C,cn:w}=_(),f=ee(),c=e.busy!==void 0;return n("form",{className:"min-w-0 space-y-6",onSubmit:async(s)=>{s.preventDefault(),await e.onSave()},children:[n(h,{title:"联网搜索",children:[t(C,{title:"启用搜索",description:"查询会发送至所选搜索服务。",children:n("div",{className:"flex items-center gap-3",children:[t("span",{className:"text-xs text-dim",children:e.draft.enabled?"已开启":"已关闭"}),t(g,{label:"启用联网搜索",disabled:c,checked:e.draft.enabled,onCheckedChange:(s)=>e.onDraft({...e.draft,enabled:s})})]})}),n("div",{className:"space-y-4 p-4",children:[n("div",{children:[t("label",{htmlFor:`${f}-provider`,className:"mb-1.5 block text-[13px] font-medium text-dim",children:"搜索渠道"}),t(W,{id:`${f}-provider`,value:e.draft.provider,disabled:c||!e.draft.enabled,className:"min-w-0",groups:[{options:[{value:"auto",label:"自动",description:"失败时依次切换渠道"},...U.map((s)=>({value:s.id,label:s.name}))]}],onValueChange:(s)=>{let r=s==="auto"?s:U.find((k)=>k.id===s)?.id;if(r)e.onDraft({...e.draft,provider:r})}}),t("p",{className:"mt-1.5 text-xs leading-5 text-faint",children:"自动:Exa → Tavily → Parallel → Firecrawl → TinyFish"})]}),(e.draft.provider==="searxng"||e.draft.searxngUrl)&&n("div",{children:[t("label",{htmlFor:`${f}-searxng`,className:"mb-1.5 block text-[13px] font-medium text-dim",children:"自建 SearXNG 地址"}),t(x,{id:`${f}-searxng`,type:"url",maxLength:2000,disabled:c||!e.draft.enabled,value:e.draft.searxngUrl,placeholder:"https://search.example.com",onChange:(s)=>e.onDraft({...e.draft,searxngUrl:s.target.value})})]})]})]}),t(h,{title:"渠道与密钥",description:"检测使用已保存配置,按下列顺序执行。",action:n(d,{type:"button",size:"sm",variant:"ghost",disabled:c,onClick:async()=>await e.onCheck("all"),children:[t(te,{className:w("size-3.5",e.checking==="all"&&"animate-spin"),"aria-hidden":"true"}),e.checking==="all"?"正在检测…":"检测全部渠道"]}),children:U.map((s)=>{let r=s.id,k=r==="searxng"?void 0:e.saved.keys[r],N=k?.source==="environment",D=r==="searxng"?void 0:e.keys[r],K=D==="",y=e.checks[r],m=e.checking==="all"||e.checking===r,S=k?.configured?"已配置密钥":"未配置";if(r==="searxng")S=e.saved.search.searxngUrl?"已配置地址":"未配置地址";if(N)S="来自环境变量";if(K)S="待移除";if(D)S="待保存密钥";return n("div",{className:"min-w-0 p-4",children:[n("div",{className:"flex min-w-0 flex-wrap items-center justify-between gap-x-3 gap-y-2",children:[n("div",{className:"min-w-0 flex-1 basis-28",children:[t("div",{className:"text-sm font-medium text-ink",children:s.name}),t("p",{className:"mt-0.5 text-xs text-faint",children:s.description})]}),n("div",{className:"flex max-w-full flex-wrap items-center justify-end gap-2",children:[t(p,{tone:D!==void 0?"warning":"neutral",children:S}),y&&!m&&t(p,{tone:y.ok?"success":"danger",children:y.ok?`可用 ${y.elapsedMs} ms`:"不可用"}),m&&t(p,{tone:"neutral",pulse:!0,children:"检测中"}),r!=="searxng"&&!N&&n(v,{children:[t(d,{type:"button",size:"sm",variant:"ghost",disabled:c,"aria-label":`${k?.configured?"更换":"设置"} ${s.name} 密钥`,"aria-expanded":e.editingKey===r,"aria-controls":`${f}-${r}-key-editor`,onClick:()=>e.onEditKey(e.editingKey===r?void 0:r),children:k?.configured?"更换":"设置密钥"}),k?.configured&&!K&&t(d,{type:"button",size:"sm",variant:"ghost",disabled:c,"aria-label":`移除 ${s.name} 密钥`,onClick:()=>{e.onKeys({...e.keys,[r]:""}),e.onEditKey(void 0)},children:"移除"})]}),t(d,{type:"button",size:"sm",variant:"ghost",disabled:c,"aria-label":`检测 ${s.name}`,onClick:async()=>await e.onCheck(r),children:"检测"})]})]}),N&&t("p",{className:"mt-1 text-xs text-faint",children:"请在服务端环境变量中更换或移除。"}),r!=="searxng"&&e.editingKey===r&&n("div",{id:`${f}-${r}-key-editor`,className:"mt-3 space-y-2",children:[n("label",{htmlFor:`${f}-${r}-key`,className:"block text-xs font-medium text-dim",children:[s.name," API 密钥"]}),t(x,{id:`${f}-${r}-key`,type:"password",autoComplete:"new-password",maxLength:4000,disabled:c,value:e.keys[r]??"",placeholder:"输入新密钥,保存后生效",onChange:(P)=>{let b={...e.keys};if(P.target.value.trim())b[r]=P.target.value;else delete b[r];e.onKeys(b)}}),n("div",{className:"flex items-center justify-between gap-2",children:[t("p",{className:"min-w-0 text-xs text-faint",children:"密钥只写入,不回显。"}),t(d,{type:"button",size:"sm",variant:"ghost",disabled:c,onClick:()=>{let P={...e.keys};delete P[r],e.onKeys(P),e.onEditKey(void 0)},children:"取消"})]})]}),y&&!y.ok&&!m&&t("p",{role:"status",className:"mt-2 break-words text-xs leading-5 text-danger",children:y.error??(y.kind==="search"?y.meta?.failed[0]?.error:y.meta?.error)??"检测失败,请检查配置。"})]},r)})}),n(h,{title:"网络",children:[n("div",{className:"p-4",children:[t("label",{htmlFor:`${f}-proxy`,className:"mb-1.5 block text-[13px] font-medium text-dim",children:"代理 URL"}),t(x,{id:`${f}-proxy`,type:"url",maxLength:2000,disabled:c,value:e.draft.proxy,placeholder:"http://127.0.0.1:7890",onChange:(s)=>e.onDraft({...e.draft,proxy:s.target.value})}),t("p",{className:"mt-1.5 text-xs text-faint",children:"留空使用服务端环境代理。"})]}),n("div",{className:"p-4",children:[t("label",{htmlFor:`${f}-language`,className:"mb-1.5 block text-[13px] font-medium text-dim",children:"Accept-Language"}),t(x,{id:`${f}-language`,maxLength:200,disabled:c,value:e.draft.acceptLanguage,placeholder:"en-US,en;q=0.9",onChange:(s)=>e.onDraft({...e.draft,acceptLanguage:s.target.value})})]})]}),n("div",{className:"mt-4 flex flex-wrap items-center justify-between gap-3 px-0.5",children:[t("div",{className:"min-w-0 flex-1",children:t(B,{notice:e.notice})}),n("div",{className:"flex flex-wrap items-center gap-2",children:[e.dirty&&n(d,{type:"button",size:"sm",variant:"ghost",disabled:c,onClick:e.onRestore,children:[t(rt,{className:"size-3.5","aria-hidden":"true"}),"重置"]}),n(d,{type:"submit",size:"sm",variant:"primary",disabled:c||!e.dirty,children:[t(vt,{className:"size-3.5","aria-hidden":"true"}),e.busy==="save"?"保存中…":"保存"]}),e.onClose&&t(d,{type:"button",size:"sm",variant:"secondary",onClick:e.onClose,children:"关闭"})]})]})]})}function q({connection:e,onClose:d}){let{Button:x}=_(),[g,W]=a(),[p,h]=a(),[C,w]=a({}),[f,c]=a(),[s,r]=a("load"),[k,N]=a(),[D,K]=a({}),[y,m]=a(),[S,P]=a(0),b=i(void 0);o(()=>{let l=new AbortController;return b.current=l,r("load"),m(void 0),W(void 0),h(void 0),w({}),c(void 0),K({}),e.request("/api/plugins/webfetch/settings",{signal:l.signal,cache:S>0?"reload":"default"}).then((u)=>{if(l.signal.aborted)return;W(u),h(R(u))}).catch((u)=>{if(!l.signal.aborted)m({type:"error",text:u instanceof Error?u.message:"加载设置失败,请重试。"})}).finally(()=>{if(!l.signal.aborted)b.current=void 0,r(void 0)}),()=>{l.abort(),b.current?.abort(),b.current=void 0}},[e,S]);async function G(){if(b.current||!g||!p||!z(g,p,C))return;let l=new AbortController;b.current=l,r("save"),m(void 0);try{let u=await e.request("/api/plugins/webfetch/settings",{method:"PATCH",signal:l.signal,headers:{"Content-Type":"application/json"},body:JSON.stringify(A(p,C))});if(l.signal.aborted)return;W(u),h(R(u)),w({}),c(void 0),K({}),m({type:"success",text:"设置已保存。"})}catch(u){if(!l.signal.aborted)m({type:"error",text:u instanceof Error?u.message:"保存失败,请重试。"})}finally{if(!l.signal.aborted)b.current=void 0,r(void 0)}}async function I(l){if(b.current||!g)return;let u=new AbortController;b.current=u,r("test"),N(l),m(void 0);try{let L=await e.request(`/api/plugins/webfetch/test?provider=${l}`,{method:"POST",signal:u.signal});if(u.signal.aborted)return;K((j)=>{let T={...j};for(let E of L.checks)if(E.kind==="search"&&E.provider)T[E.provider]=E;return T})}catch(L){if(!u.signal.aborted)m({type:"error",text:L instanceof Error?L.message:"检测失败,请重试。"})}finally{if(!u.signal.aborted)b.current=void 0,r(void 0),N(void 0)}}if(!g||!p)return n("div",{className:"min-w-0 space-y-3",children:[s==="load"&&t("p",{role:"status",className:"text-sm text-dim",children:"正在加载设置…"}),t(B,{notice:y}),d&&t(x,{type:"button",size:"sm",variant:"secondary",onClick:d,children:"关闭"}),s!=="load"&&t(x,{type:"button",size:"sm",variant:"ghost",onClick:()=>P(S+1),children:"重新加载"})]});return t(F,{saved:g,draft:p,keys:C,editingKey:f,dirty:z(g,p,C),busy:s==="load"?void 0:s,checking:k,checks:D,notice:y,onDraft:(l)=>{h(l),m(void 0)},onKeys:(l)=>{w(l),m(void 0)},onEditKey:c,onClose:d,onSave:G,onCheck:I,onRestore:()=>{h(R(g)),w({}),c(void 0),m(void 0)}})}export{F as SettingsForm,q as default};
1
+ import{o,ee,i,a,v,t,n,_,Z,te,rt,vt}from"./chunk-4bzqrwr0.js";import{gn}from"./chunk-ngx2cp8x.js";var U=[{id:"exa",name:"Exa",description:"免密钥 · 综合搜索"},{id:"tavily",name:"Tavily",description:"免密钥 · 支持域名筛选"},{id:"parallel",name:"Parallel",description:"免密钥 · 网页搜索"},{id:"firecrawl",name:"Firecrawl",description:"免密钥 · 网页内容"},{id:"tinyfish",name:"TinyFish",description:"免密钥 · 搜索摘要"},{id:"searxng",name:"SearXNG",description:"免密钥 · 需自建服务"},{id:"brave",name:"Brave",description:"需密钥 · 独立搜索引擎"}];function R(e){return{enabled:e.search.provider!=="off",provider:e.search.provider==="off"?"auto":e.search.provider,searxngUrl:e.search.searxngUrl??"",proxy:e.proxy??"",acceptLanguage:e.acceptLanguage??""}}function A(e,d){return{search:{provider:e.enabled?e.provider:"off",searxngUrl:e.searxngUrl},keys:{...d},proxy:e.proxy,acceptLanguage:e.acceptLanguage}}function z(e,d,x){let g=R(e);if(d.enabled!==g.enabled)return!0;if(d.enabled&&d.provider!==g.provider)return!0;return d.searxngUrl!==g.searxngUrl||d.proxy!==g.proxy||d.acceptLanguage!==g.acceptLanguage||Object.keys(x).length>0}function B({notice:e}){let{cn:d}=_();if(!e)return null;let x=e.type==="success"?gn:Z;return n("div",{role:e.type==="error"?"alert":"status",className:d("flex items-start gap-2 text-xs",e.type==="success"?"text-success":"text-danger"),children:[t(x,{className:"mt-0.5 size-4 shrink-0","aria-hidden":"true"}),t("span",{className:"min-w-0 break-words",children:e.text})]})}function F(e){let{Button:d,Input:x,Switch:g,Select:W,StatusChip:p,SettingGroup:h,SettingRow:C,cn:w}=_(),f=ee(),c=e.busy!==void 0;return n("form",{className:"min-w-0 space-y-6",onSubmit:async(s)=>{s.preventDefault(),await e.onSave()},children:[n(h,{title:"联网搜索",children:[t(C,{title:"启用搜索",description:"查询会发送至所选搜索服务。",children:n("div",{className:"flex items-center gap-3",children:[t("span",{className:"text-xs text-dim",children:e.draft.enabled?"已开启":"已关闭"}),t(g,{label:"启用联网搜索",disabled:c,checked:e.draft.enabled,onCheckedChange:(s)=>e.onDraft({...e.draft,enabled:s})})]})}),n("div",{className:"space-y-4 p-4",children:[n("div",{children:[t("label",{htmlFor:`${f}-provider`,className:"mb-1.5 block text-[13px] font-medium text-dim",children:"搜索渠道"}),t(W,{id:`${f}-provider`,value:e.draft.provider,disabled:c||!e.draft.enabled,className:"min-w-0",groups:[{options:[{value:"auto",label:"自动",description:"失败时依次切换渠道"},...U.map((s)=>({value:s.id,label:s.name}))]}],onValueChange:(s)=>{let r=s==="auto"?s:U.find((k)=>k.id===s)?.id;if(r)e.onDraft({...e.draft,provider:r})}}),t("p",{className:"mt-1.5 text-xs leading-5 text-faint",children:"自动:Exa → Tavily → Parallel → Firecrawl → TinyFish"})]}),(e.draft.provider==="searxng"||e.draft.searxngUrl)&&n("div",{children:[t("label",{htmlFor:`${f}-searxng`,className:"mb-1.5 block text-[13px] font-medium text-dim",children:"自建 SearXNG 地址"}),t(x,{id:`${f}-searxng`,type:"url",maxLength:2000,disabled:c||!e.draft.enabled,value:e.draft.searxngUrl,placeholder:"https://search.example.com",onChange:(s)=>e.onDraft({...e.draft,searxngUrl:s.target.value})})]})]})]}),t(h,{title:"渠道与密钥",description:"检测使用已保存配置,按下列顺序执行。",action:n(d,{type:"button",size:"sm",variant:"ghost",disabled:c,onClick:async()=>await e.onCheck("all"),children:[t(te,{className:w("size-3.5",e.checking==="all"&&"animate-spin"),"aria-hidden":"true"}),e.checking==="all"?"正在检测…":"检测全部渠道"]}),children:U.map((s)=>{let r=s.id,k=r==="searxng"?void 0:e.saved.keys[r],N=k?.source==="environment",D=r==="searxng"?void 0:e.keys[r],K=D==="",y=e.checks[r],m=e.checking==="all"||e.checking===r,S=k?.configured?"已配置密钥":"未配置";if(r==="searxng")S=e.saved.search.searxngUrl?"已配置地址":"未配置地址";if(N)S="来自环境变量";if(K)S="待移除";if(D)S="待保存密钥";return n("div",{className:"min-w-0 p-4",children:[n("div",{className:"flex min-w-0 flex-wrap items-center justify-between gap-x-3 gap-y-2",children:[n("div",{className:"min-w-0 flex-1 basis-28",children:[t("div",{className:"text-sm font-medium text-ink",children:s.name}),t("p",{className:"mt-0.5 text-xs text-faint",children:s.description})]}),n("div",{className:"flex max-w-full flex-wrap items-center justify-end gap-2",children:[t(p,{tone:D!==void 0?"warning":"neutral",children:S}),y&&!m&&t(p,{tone:y.ok?"success":"danger",children:y.ok?`可用 ${y.elapsedMs} ms`:"不可用"}),m&&t(p,{tone:"neutral",pulse:!0,children:"检测中"}),r!=="searxng"&&!N&&n(v,{children:[t(d,{type:"button",size:"sm",variant:"ghost",disabled:c,"aria-label":`${k?.configured?"更换":"设置"} ${s.name} 密钥`,"aria-expanded":e.editingKey===r,"aria-controls":`${f}-${r}-key-editor`,onClick:()=>e.onEditKey(e.editingKey===r?void 0:r),children:k?.configured?"更换":"设置密钥"}),k?.configured&&!K&&t(d,{type:"button",size:"sm",variant:"ghost",disabled:c,"aria-label":`移除 ${s.name} 密钥`,onClick:()=>{e.onKeys({...e.keys,[r]:""}),e.onEditKey(void 0)},children:"移除"})]}),t(d,{type:"button",size:"sm",variant:"ghost",disabled:c,"aria-label":`检测 ${s.name}`,onClick:async()=>await e.onCheck(r),children:"检测"})]})]}),N&&t("p",{className:"mt-1 text-xs text-faint",children:"请在服务端环境变量中更换或移除。"}),r!=="searxng"&&e.editingKey===r&&n("div",{id:`${f}-${r}-key-editor`,className:"mt-3 space-y-2",children:[n("label",{htmlFor:`${f}-${r}-key`,className:"block text-xs font-medium text-dim",children:[s.name," API 密钥"]}),t(x,{id:`${f}-${r}-key`,type:"password",autoComplete:"new-password",maxLength:4000,disabled:c,value:e.keys[r]??"",placeholder:"输入新密钥,保存后生效",onChange:(P)=>{let b={...e.keys};if(P.target.value.trim())b[r]=P.target.value;else delete b[r];e.onKeys(b)}}),n("div",{className:"flex items-center justify-between gap-2",children:[t("p",{className:"min-w-0 text-xs text-faint",children:"密钥只写入,不回显。"}),t(d,{type:"button",size:"sm",variant:"ghost",disabled:c,onClick:()=>{let P={...e.keys};delete P[r],e.onKeys(P),e.onEditKey(void 0)},children:"取消"})]})]}),y&&!y.ok&&!m&&t("p",{role:"status",className:"mt-2 break-words text-xs leading-5 text-danger",children:y.error??(y.kind==="search"?y.meta?.failed[0]?.error:y.meta?.error)??"检测失败,请检查配置。"})]},r)})}),n(h,{title:"网络",children:[n("div",{className:"p-4",children:[t("label",{htmlFor:`${f}-proxy`,className:"mb-1.5 block text-[13px] font-medium text-dim",children:"代理 URL"}),t(x,{id:`${f}-proxy`,type:"url",maxLength:2000,disabled:c,value:e.draft.proxy,placeholder:"http://127.0.0.1:7890",onChange:(s)=>e.onDraft({...e.draft,proxy:s.target.value})}),t("p",{className:"mt-1.5 text-xs text-faint",children:"留空使用服务端环境代理。"})]}),n("div",{className:"p-4",children:[t("label",{htmlFor:`${f}-language`,className:"mb-1.5 block text-[13px] font-medium text-dim",children:"Accept-Language"}),t(x,{id:`${f}-language`,maxLength:200,disabled:c,value:e.draft.acceptLanguage,placeholder:"en-US,en;q=0.9",onChange:(s)=>e.onDraft({...e.draft,acceptLanguage:s.target.value})})]})]}),n("div",{className:"mt-4 flex flex-wrap items-center justify-between gap-3 px-0.5",children:[t("div",{className:"min-w-0 flex-1",children:t(B,{notice:e.notice})}),n("div",{className:"flex flex-wrap items-center gap-2",children:[e.dirty&&n(d,{type:"button",size:"sm",variant:"ghost",disabled:c,onClick:e.onRestore,children:[t(rt,{className:"size-3.5","aria-hidden":"true"}),"重置"]}),n(d,{type:"submit",size:"sm",variant:"primary",disabled:c||!e.dirty,children:[t(vt,{className:"size-3.5","aria-hidden":"true"}),e.busy==="save"?"保存中…":"保存"]}),e.onClose&&t(d,{type:"button",size:"sm",variant:"secondary",onClick:e.onClose,children:"关闭"})]})]})]})}function q({connection:e,onClose:d}){let{Button:x}=_(),[g,W]=a(),[p,h]=a(),[C,w]=a({}),[f,c]=a(),[s,r]=a("load"),[k,N]=a(),[D,K]=a({}),[y,m]=a(),[S,P]=a(0),b=i(void 0);o(()=>{let l=new AbortController;return b.current=l,r("load"),m(void 0),W(void 0),h(void 0),w({}),c(void 0),K({}),e.request("/api/plugins/webfetch/settings",{signal:l.signal,cache:S>0?"reload":"default"}).then((u)=>{if(l.signal.aborted)return;W(u),h(R(u))}).catch((u)=>{if(!l.signal.aborted)m({type:"error",text:u instanceof Error?u.message:"加载设置失败,请重试。"})}).finally(()=>{if(!l.signal.aborted)b.current=void 0,r(void 0)}),()=>{l.abort(),b.current?.abort(),b.current=void 0}},[e,S]);async function G(){if(b.current||!g||!p||!z(g,p,C))return;let l=new AbortController;b.current=l,r("save"),m(void 0);try{let u=await e.request("/api/plugins/webfetch/settings",{method:"PATCH",signal:l.signal,headers:{"Content-Type":"application/json"},body:JSON.stringify(A(p,C))});if(l.signal.aborted)return;W(u),h(R(u)),w({}),c(void 0),K({}),m({type:"success",text:"设置已保存。"})}catch(u){if(!l.signal.aborted)m({type:"error",text:u instanceof Error?u.message:"保存失败,请重试。"})}finally{if(!l.signal.aborted)b.current=void 0,r(void 0)}}async function I(l){if(b.current||!g)return;let u=new AbortController;b.current=u,r("test"),N(l),m(void 0);try{let L=await e.request(`/api/plugins/webfetch/test?provider=${l}`,{method:"POST",signal:u.signal});if(u.signal.aborted)return;K((j)=>{let T={...j};for(let E of L.checks)if(E.kind==="search"&&E.provider)T[E.provider]=E;return T})}catch(L){if(!u.signal.aborted)m({type:"error",text:L instanceof Error?L.message:"检测失败,请重试。"})}finally{if(!u.signal.aborted)b.current=void 0,r(void 0),N(void 0)}}if(!g||!p)return n("div",{className:"min-w-0 space-y-3",children:[s==="load"&&t("p",{role:"status",className:"text-sm text-dim",children:"正在加载设置…"}),t(B,{notice:y}),d&&t(x,{type:"button",size:"sm",variant:"secondary",onClick:d,children:"关闭"}),s!=="load"&&t(x,{type:"button",size:"sm",variant:"ghost",onClick:()=>P(S+1),children:"重新加载"})]});return t(F,{saved:g,draft:p,keys:C,editingKey:f,dirty:z(g,p,C),busy:s==="load"?void 0:s,checking:k,checks:D,notice:y,onDraft:(l)=>{h(l),m(void 0)},onKeys:(l)=>{w(l),m(void 0)},onEditKey:c,onClose:d,onSave:G,onCheck:I,onRestore:()=>{h(R(g)),w({}),c(void 0),m(void 0)}})}export{F as SettingsForm,q as default};
@@ -1,4 +1,4 @@
1
- import{W}from"./chunk-vjqmnkh2.js";import{e,r,we,b,B,C,S,E,T,A,I,L,s,V,U}from"./chunk-9dd1c37b.js";import{X}from"./chunk-qryrg2pq.js";var ot=e((a,d)=>{let n=a<=1?a*100:a;if(n<0||n>100)throw Error(`${d} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${a}`);return n},"toPercent"),j=e((a,d,n)=>({x:ot(d,`${n} evolution`),y:ot(a,`${n} visibility`)}),"toCoordinates"),pt=e((a)=>{if(!a)return;if(a==="+<>")return"bidirectional";if(a==="+<")return"backward";if(a==="+>")return"forward";return},"getFlowFromPort"),Bt=e((a)=>{if(!a?.startsWith("+"))return{};let n=/^\+'([^']*)'/.exec(a)?.[1];if(a.includes("<>"))return{flow:"bidirectional",label:n};if(a.includes("<"))return{flow:"backward",label:n};if(a.includes(">"))return{flow:"forward",label:n};return{label:n}},"extractFlowFromArrow"),Ft=e((a,d)=>{if(W(a,d),a.size)d.setSize(a.size.width,a.size.height);if(a.evolution){let n=a.evolution.stages.map((o)=>{if(o.secondName)return`${o.name.trim()} / ${o.secondName.trim()}`;return o.name.trim()}),y=a.evolution.stages.filter((o)=>o.boundary!==void 0).map((o)=>o.boundary);d.updateAxes({stages:n,stageBoundaries:y})}if(a.anchors.forEach((n)=>{let y=j(n.visibility,n.evolution,`Anchor "${n.name}"`);d.addNode(n.name,n.name,y.x,y.y,"anchor")}),a.components.forEach((n)=>{let y=j(n.visibility,n.evolution,`Component "${n.name}"`),o=n.label?(n.label.negX?-1:1)*n.label.offsetX:void 0,p=n.label?(n.label.negY?-1:1)*n.label.offsetY:void 0,k=n.decorator?.strategy;d.addNode(n.name,n.name,y.x,y.y,"component",o,p,n.inertia,k)}),a.notes.forEach((n)=>{let y=j(n.visibility,n.evolution,`Note "${n.text}"`);d.addNote(n.text,y.x,y.y)}),a.pipelines.forEach((n)=>{let y=d.getNode(n.parent);if(!y||typeof y.y!=="number")throw Error(`Pipeline "${n.parent}" must reference an existing component with coordinates.`);let o=y.y;d.startPipeline(n.parent),n.components.forEach((p)=>{let k=`${n.parent}_${p.name}`,Y=p.label?(p.label.negX?-1:1)*p.label.offsetX:void 0,w=p.label?(p.label.negY?-1:1)*p.label.offsetY:void 0,tt=ot(p.evolution,`Pipeline component "${p.name}" evolution`);d.addNode(k,p.name,tt,o,"pipeline-component",Y,w),d.addPipelineComponent(n.parent,k)})}),a.links.forEach((n)=>{let y=!!n.arrow&&(n.arrow.includes("-.->")||n.arrow.includes(".-.")),o=pt(n.fromPort)??pt(n.toPort),{flow:p,label:k}=Bt(n.arrow);if(!o&&p)o=p;let Y=n.linkLabel,w=k??Y;d.addLink(d.resolveNodeId(n.from),d.resolveNodeId(n.to),y,w,o)}),a.evolves.forEach((n)=>{let y=d.getNode(n.component);if(y?.y!==void 0){let o=ot(n.target,`Evolve target for "${n.component}"`);d.addTrend(n.component,o,y.y)}}),a.annotations.length>0){let n=a.annotations[0],y=j(n.x,n.y,"Annotations box");d.setAnnotationsBox(y.x,y.y)}a.annotation.forEach((n)=>{let y=j(n.x,n.y,`Annotation ${n.number}`);d.addAnnotation(n.number,[{x:y.x,y:y.y}],n.text)}),a.accelerators.forEach((n)=>{let y=j(n.x,n.y,`Accelerator "${n.name}"`);d.addAccelerator(n.name,y.x,y.y)}),a.deaccelerators.forEach((n)=>{let y=j(n.x,n.y,`Deaccelerator "${n.name}"`);d.addDeaccelerator(n.name,y.x,y.y)})},"populateDb"),ht={parser:{yy:void 0},parse:e(async(a)=>{let d=await X("wardley",a);r.debug(d);let n=ht.parser?.yy;if(!n||typeof n.addNode!=="function")throw Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Ft(d,n)},"parse")},Rt=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}static{e(this,"WardleyBuilder")}addNode(a){let d=this.nodes.get(a.id)??{id:a.id,label:a.label},n={...d,...a,className:a.className??d.className,labelOffsetX:a.labelOffsetX??d.labelOffsetX,labelOffsetY:a.labelOffsetY??d.labelOffsetY};this.nodes.set(a.id,n)}addLink(a){this.links.push(a)}addTrend(a){this.trends.set(a.nodeId,a)}startPipeline(a){this.pipelines.set(a,{nodeId:a,componentIds:[]});let d=this.nodes.get(a);if(d)d.isPipelineParent=!0}addPipelineComponent(a,d){let n=this.pipelines.get(a);if(n)n.componentIds.push(d);let y=this.nodes.get(d);if(y)y.inPipeline=!0}addAnnotation(a){this.annotations.push(a)}addNote(a){this.notes.push(a)}addAccelerator(a){this.accelerators.push(a)}addDeaccelerator(a){this.deaccelerators.push(a)}setAnnotationsBox(a,d){this.annotationsBox={x:a,y:d}}setAxes(a){this.axes={...this.axes,...a}}setSize(a,d){this.size={width:a,height:d}}getNode(a){return this.nodes.get(a)}resolveNodeId(a){if(this.nodes.has(a))return a;for(let[d,n]of this.nodes)if(n.label===a)return d;return a}build(){let a=[];for(let d of this.nodes.values()){if(typeof d.x!=="number"||typeof d.y!=="number")throw Error(`Node "${d.label}" is missing coordinates`);a.push(d)}return{nodes:a,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}},P=new Rt;function ft(){return s()["wardley-beta"]}e(ft,"getConfig");function xt(a,d,n,y,o,p,k,Y,w){P.addNode({id:a,label:d,x:n,y,className:o,labelOffsetX:p,labelOffsetY:k,inertia:Y,sourceStrategy:w})}e(xt,"addNode");function gt(a,d,n=!1,y,o){P.addLink({source:a,target:d,dashed:n,label:y,flow:o})}e(gt,"addLink");function yt(a,d,n){P.addTrend({nodeId:a,targetX:d,targetY:n})}e(yt,"addTrend");function ut(a,d,n){P.addAnnotation({number:a,coordinates:d,text:n})}e(ut,"addAnnotation");function wt(a,d,n){P.addNote({text:a,x:d,y:n})}e(wt,"addNote");function mt(a,d,n){P.addAccelerator({name:a,x:d,y:n})}e(mt,"addAccelerator");function kt(a,d,n){P.addDeaccelerator({name:a,x:d,y:n})}e(kt,"addDeaccelerator");function bt(a,d){P.setAnnotationsBox(a,d)}e(bt,"setAnnotationsBox");function $t(a,d){P.setSize(a,d)}e($t,"setSize");function vt(a){P.startPipeline(a)}e(vt,"startPipeline");function Pt(a,d){P.addPipelineComponent(a,d)}e(Pt,"addPipelineComponent");function Ct(a){P.setAxes(a)}e(Ct,"updateAxes");function St(a){return P.getNode(a)}e(St,"getNode");function Mt(a){return P.resolveNodeId(a)}e(Mt,"resolveNodeId");function Nt(){return P.build()}e(Nt,"getWardleyData");function zt(){P.clear(),C()}e(zt,"clear");var Ot={getConfig:ft,addNode:xt,addLink:gt,addTrend:yt,addAnnotation:ut,addNote:wt,addAccelerator:mt,addDeaccelerator:kt,setAnnotationsBox:bt,setSize:$t,startPipeline:vt,addPipelineComponent:Pt,updateAxes:Ct,getNode:St,resolveNodeId:Mt,getWardleyData:Nt,clear:zt,setAccTitle:S,getAccTitle:E,setDiagramTitle:I,getDiagramTitle:L,getAccDescription:A,setAccDescription:T},Dt=["Genesis","Custom Built","Product","Commodity"],Gt=e(()=>{let{themeVariables:a}=s();return{backgroundColor:a.wardley?.backgroundColor??a.background??"#fff",axisColor:a.wardley?.axisColor??"#000",axisTextColor:a.wardley?.axisTextColor??a.primaryTextColor??"#222",gridColor:a.wardley?.gridColor??"rgba(100, 100, 100, 0.2)",componentFill:a.wardley?.componentFill??"#fff",componentStroke:a.wardley?.componentStroke??"#000",componentLabelColor:a.wardley?.componentLabelColor??a.primaryTextColor??"#222",linkStroke:a.wardley?.linkStroke??"#000",evolutionStroke:a.wardley?.evolutionStroke??"#dc3545",annotationStroke:a.wardley?.annotationStroke??"#000",annotationTextColor:a.wardley?.annotationTextColor??a.primaryTextColor??"#222",annotationFill:a.wardley?.annotationFill??a.background??"#fff"}},"getTheme"),qt=e(()=>{let a=s()["wardley-beta"];return{width:a?.width??900,height:a?.height??600,padding:a?.padding??48,nodeRadius:a?.nodeRadius??6,nodeLabelOffset:a?.nodeLabelOffset??8,axisFontSize:a?.axisFontSize??12,labelFontSize:a?.labelFontSize??10,showGrid:a?.showGrid??!1,useMaxWidth:a?.useMaxWidth??!0}},"getConfigValues"),jt=e((a,d,n,y)=>{r.debug(`Rendering Wardley map
1
+ import{W}from"./chunk-y56aaba5.js";import{e,r,we,b,B,C,S,E,T,A,I,L,s,V,U}from"./chunk-wvdehm9y.js";import{X}from"./chunk-aqfpnhmt.js";var ot=e((a,d)=>{let n=a<=1?a*100:a;if(n<0||n>100)throw Error(`${d} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${a}`);return n},"toPercent"),j=e((a,d,n)=>({x:ot(d,`${n} evolution`),y:ot(a,`${n} visibility`)}),"toCoordinates"),pt=e((a)=>{if(!a)return;if(a==="+<>")return"bidirectional";if(a==="+<")return"backward";if(a==="+>")return"forward";return},"getFlowFromPort"),Bt=e((a)=>{if(!a?.startsWith("+"))return{};let n=/^\+'([^']*)'/.exec(a)?.[1];if(a.includes("<>"))return{flow:"bidirectional",label:n};if(a.includes("<"))return{flow:"backward",label:n};if(a.includes(">"))return{flow:"forward",label:n};return{label:n}},"extractFlowFromArrow"),Ft=e((a,d)=>{if(W(a,d),a.size)d.setSize(a.size.width,a.size.height);if(a.evolution){let n=a.evolution.stages.map((o)=>{if(o.secondName)return`${o.name.trim()} / ${o.secondName.trim()}`;return o.name.trim()}),y=a.evolution.stages.filter((o)=>o.boundary!==void 0).map((o)=>o.boundary);d.updateAxes({stages:n,stageBoundaries:y})}if(a.anchors.forEach((n)=>{let y=j(n.visibility,n.evolution,`Anchor "${n.name}"`);d.addNode(n.name,n.name,y.x,y.y,"anchor")}),a.components.forEach((n)=>{let y=j(n.visibility,n.evolution,`Component "${n.name}"`),o=n.label?(n.label.negX?-1:1)*n.label.offsetX:void 0,p=n.label?(n.label.negY?-1:1)*n.label.offsetY:void 0,k=n.decorator?.strategy;d.addNode(n.name,n.name,y.x,y.y,"component",o,p,n.inertia,k)}),a.notes.forEach((n)=>{let y=j(n.visibility,n.evolution,`Note "${n.text}"`);d.addNote(n.text,y.x,y.y)}),a.pipelines.forEach((n)=>{let y=d.getNode(n.parent);if(!y||typeof y.y!=="number")throw Error(`Pipeline "${n.parent}" must reference an existing component with coordinates.`);let o=y.y;d.startPipeline(n.parent),n.components.forEach((p)=>{let k=`${n.parent}_${p.name}`,Y=p.label?(p.label.negX?-1:1)*p.label.offsetX:void 0,w=p.label?(p.label.negY?-1:1)*p.label.offsetY:void 0,tt=ot(p.evolution,`Pipeline component "${p.name}" evolution`);d.addNode(k,p.name,tt,o,"pipeline-component",Y,w),d.addPipelineComponent(n.parent,k)})}),a.links.forEach((n)=>{let y=!!n.arrow&&(n.arrow.includes("-.->")||n.arrow.includes(".-.")),o=pt(n.fromPort)??pt(n.toPort),{flow:p,label:k}=Bt(n.arrow);if(!o&&p)o=p;let Y=n.linkLabel,w=k??Y;d.addLink(d.resolveNodeId(n.from),d.resolveNodeId(n.to),y,w,o)}),a.evolves.forEach((n)=>{let y=d.getNode(n.component);if(y?.y!==void 0){let o=ot(n.target,`Evolve target for "${n.component}"`);d.addTrend(n.component,o,y.y)}}),a.annotations.length>0){let n=a.annotations[0],y=j(n.x,n.y,"Annotations box");d.setAnnotationsBox(y.x,y.y)}a.annotation.forEach((n)=>{let y=j(n.x,n.y,`Annotation ${n.number}`);d.addAnnotation(n.number,[{x:y.x,y:y.y}],n.text)}),a.accelerators.forEach((n)=>{let y=j(n.x,n.y,`Accelerator "${n.name}"`);d.addAccelerator(n.name,y.x,y.y)}),a.deaccelerators.forEach((n)=>{let y=j(n.x,n.y,`Deaccelerator "${n.name}"`);d.addDeaccelerator(n.name,y.x,y.y)})},"populateDb"),ht={parser:{yy:void 0},parse:e(async(a)=>{let d=await X("wardley",a);r.debug(d);let n=ht.parser?.yy;if(!n||typeof n.addNode!=="function")throw Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Ft(d,n)},"parse")},Rt=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}static{e(this,"WardleyBuilder")}addNode(a){let d=this.nodes.get(a.id)??{id:a.id,label:a.label},n={...d,...a,className:a.className??d.className,labelOffsetX:a.labelOffsetX??d.labelOffsetX,labelOffsetY:a.labelOffsetY??d.labelOffsetY};this.nodes.set(a.id,n)}addLink(a){this.links.push(a)}addTrend(a){this.trends.set(a.nodeId,a)}startPipeline(a){this.pipelines.set(a,{nodeId:a,componentIds:[]});let d=this.nodes.get(a);if(d)d.isPipelineParent=!0}addPipelineComponent(a,d){let n=this.pipelines.get(a);if(n)n.componentIds.push(d);let y=this.nodes.get(d);if(y)y.inPipeline=!0}addAnnotation(a){this.annotations.push(a)}addNote(a){this.notes.push(a)}addAccelerator(a){this.accelerators.push(a)}addDeaccelerator(a){this.deaccelerators.push(a)}setAnnotationsBox(a,d){this.annotationsBox={x:a,y:d}}setAxes(a){this.axes={...this.axes,...a}}setSize(a,d){this.size={width:a,height:d}}getNode(a){return this.nodes.get(a)}resolveNodeId(a){if(this.nodes.has(a))return a;for(let[d,n]of this.nodes)if(n.label===a)return d;return a}build(){let a=[];for(let d of this.nodes.values()){if(typeof d.x!=="number"||typeof d.y!=="number")throw Error(`Node "${d.label}" is missing coordinates`);a.push(d)}return{nodes:a,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}},P=new Rt;function ft(){return s()["wardley-beta"]}e(ft,"getConfig");function xt(a,d,n,y,o,p,k,Y,w){P.addNode({id:a,label:d,x:n,y,className:o,labelOffsetX:p,labelOffsetY:k,inertia:Y,sourceStrategy:w})}e(xt,"addNode");function gt(a,d,n=!1,y,o){P.addLink({source:a,target:d,dashed:n,label:y,flow:o})}e(gt,"addLink");function yt(a,d,n){P.addTrend({nodeId:a,targetX:d,targetY:n})}e(yt,"addTrend");function ut(a,d,n){P.addAnnotation({number:a,coordinates:d,text:n})}e(ut,"addAnnotation");function wt(a,d,n){P.addNote({text:a,x:d,y:n})}e(wt,"addNote");function mt(a,d,n){P.addAccelerator({name:a,x:d,y:n})}e(mt,"addAccelerator");function kt(a,d,n){P.addDeaccelerator({name:a,x:d,y:n})}e(kt,"addDeaccelerator");function bt(a,d){P.setAnnotationsBox(a,d)}e(bt,"setAnnotationsBox");function $t(a,d){P.setSize(a,d)}e($t,"setSize");function vt(a){P.startPipeline(a)}e(vt,"startPipeline");function Pt(a,d){P.addPipelineComponent(a,d)}e(Pt,"addPipelineComponent");function Ct(a){P.setAxes(a)}e(Ct,"updateAxes");function St(a){return P.getNode(a)}e(St,"getNode");function Mt(a){return P.resolveNodeId(a)}e(Mt,"resolveNodeId");function Nt(){return P.build()}e(Nt,"getWardleyData");function zt(){P.clear(),C()}e(zt,"clear");var Ot={getConfig:ft,addNode:xt,addLink:gt,addTrend:yt,addAnnotation:ut,addNote:wt,addAccelerator:mt,addDeaccelerator:kt,setAnnotationsBox:bt,setSize:$t,startPipeline:vt,addPipelineComponent:Pt,updateAxes:Ct,getNode:St,resolveNodeId:Mt,getWardleyData:Nt,clear:zt,setAccTitle:S,getAccTitle:E,setDiagramTitle:I,getDiagramTitle:L,getAccDescription:A,setAccDescription:T},Dt=["Genesis","Custom Built","Product","Commodity"],Gt=e(()=>{let{themeVariables:a}=s();return{backgroundColor:a.wardley?.backgroundColor??a.background??"#fff",axisColor:a.wardley?.axisColor??"#000",axisTextColor:a.wardley?.axisTextColor??a.primaryTextColor??"#222",gridColor:a.wardley?.gridColor??"rgba(100, 100, 100, 0.2)",componentFill:a.wardley?.componentFill??"#fff",componentStroke:a.wardley?.componentStroke??"#000",componentLabelColor:a.wardley?.componentLabelColor??a.primaryTextColor??"#222",linkStroke:a.wardley?.linkStroke??"#000",evolutionStroke:a.wardley?.evolutionStroke??"#dc3545",annotationStroke:a.wardley?.annotationStroke??"#000",annotationTextColor:a.wardley?.annotationTextColor??a.primaryTextColor??"#222",annotationFill:a.wardley?.annotationFill??a.background??"#fff"}},"getTheme"),qt=e(()=>{let a=s()["wardley-beta"];return{width:a?.width??900,height:a?.height??600,padding:a?.padding??48,nodeRadius:a?.nodeRadius??6,nodeLabelOffset:a?.nodeLabelOffset??8,axisFontSize:a?.axisFontSize??12,labelFontSize:a?.labelFontSize??10,showGrid:a?.showGrid??!1,useMaxWidth:a?.useMaxWidth??!0}},"getConfigValues"),jt=e((a,d,n,y)=>{r.debug(`Rendering Wardley map
2
2
  `+a);let o=qt(),p=Gt(),k=o.nodeRadius*1.6,Y=y.db,w=Y.getWardleyData(),tt=Y.getDiagramTitle(),F=w.size?.width??o.width,M=w.size?.height??o.height,Z=V(d);Z.selectAll("*").remove(),B(Z,M,F,o.useMaxWidth),Z.attr("viewBox",`0 0 ${F} ${M}`);let z=Z.append("g").attr("class","wardley-map"),nt=Z.append("defs");nt.append("marker").attr("id",`arrow-${d}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",p.evolutionStroke).attr("stroke","none"),nt.append("marker").attr("id",`link-arrow-end-${d}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",p.linkStroke).attr("stroke","none"),nt.append("marker").attr("id",`link-arrow-start-${d}`).attr("viewBox","0 0 10 10").attr("refX",1).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z").attr("fill",p.linkStroke).attr("stroke","none"),z.append("rect").attr("class","wardley-background").attr("width",F).attr("height",M).attr("fill",p.backgroundColor);let J=F-o.padding*2,K=M-o.padding*2;if(tt)z.append("text").attr("class","wardley-title").attr("x",F/2).attr("y",o.padding/2).attr("fill",p.axisTextColor).attr("font-size",o.axisFontSize*1.05).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","middle").text(tt);let D=e((t)=>o.padding+t/100*J,"projectX"),G=e((t)=>M-o.padding-t/100*K,"projectY"),et=z.append("g").attr("class","wardley-axes");et.append("line").attr("x1",o.padding).attr("x2",F-o.padding).attr("y1",M-o.padding).attr("y2",M-o.padding).attr("stroke",p.axisColor).attr("stroke-width",1),et.append("line").attr("x1",o.padding).attr("x2",o.padding).attr("y1",o.padding).attr("y2",M-o.padding).attr("stroke",p.axisColor).attr("stroke-width",1);let Lt=w.axes.xLabel??"Evolution",Tt=w.axes.yLabel??"Visibility";et.append("text").attr("class","wardley-axis-label wardley-axis-label-x").attr("x",o.padding+J/2).attr("y",M-o.padding/4).attr("fill",p.axisTextColor).attr("font-size",o.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").text(Lt),et.append("text").attr("class","wardley-axis-label wardley-axis-label-y").attr("x",o.padding/3).attr("y",o.padding+K/2).attr("fill",p.axisTextColor).attr("font-size",o.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("transform",`rotate(-90 ${o.padding/3} ${o.padding+K/2})`).text(Tt);let Q=w.axes.stages&&w.axes.stages.length>0?w.axes.stages:Dt;if(Q.length>0){let t=z.append("g").attr("class","wardley-stages"),l=w.axes.stageBoundaries,i=[];if(l&&l.length===Q.length){let c=0;l.forEach((f)=>{i.push({start:c,end:f}),c=f})}else{let c=1/Q.length;Q.forEach((f,x)=>{i.push({start:x*c,end:(x+1)*c})})}Q.forEach((c,f)=>{let x=i[f],u=o.padding+x.start*J,g=o.padding+x.end*J,m=(u+g)/2;if(f>0)t.append("line").attr("x1",u).attr("x2",u).attr("y1",o.padding).attr("y2",M-o.padding).attr("stroke","#000").attr("stroke-width",1).attr("stroke-dasharray","5 5").attr("opacity",0.8);t.append("text").attr("class","wardley-stage-label").attr("x",m).attr("y",M-o.padding/1.5).attr("fill",p.axisTextColor).attr("font-size",o.axisFontSize-2).attr("text-anchor","middle").text(c)})}if(o.showGrid){let t=z.append("g").attr("class","wardley-grid");for(let l=1;l<4;l++){let i=l/4,c=o.padding+J*i;t.append("line").attr("x1",c).attr("x2",c).attr("y1",o.padding).attr("y2",M-o.padding).attr("stroke",p.gridColor).attr("stroke-dasharray","2 6"),t.append("line").attr("x1",o.padding).attr("x2",F-o.padding).attr("y1",M-o.padding-K*i).attr("y2",M-o.padding-K*i).attr("stroke",p.gridColor).attr("stroke-dasharray","2 6")}}let h=new Map;if(w.nodes.forEach((t)=>{h.set(t.id,{x:D(t.x),y:G(t.y),node:t})}),w.pipelines.length>0){let t=z.append("g").attr("class","wardley-pipelines"),l=z.append("g").attr("class","wardley-pipeline-links");w.pipelines.forEach((i)=>{if(i.componentIds.length===0)return;let c=i.componentIds.map((g)=>({id:g,pos:h.get(g),node:w.nodes.find((m)=>m.id===g)})).filter((g)=>g.pos&&g.node).sort((g,m)=>g.node.x-m.node.x);for(let g=0;g<c.length-1;g++){let m=c[g],v=c[g+1];l.append("line").attr("class","wardley-pipeline-evolution-link").attr("x1",m.pos.x).attr("y1",m.pos.y).attr("x2",v.pos.x).attr("y2",v.pos.y).attr("stroke",p.linkStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4")}let f=1/0,x=-1/0,u=0;if(i.componentIds.forEach((g)=>{let m=h.get(g);if(m)f=Math.min(f,m.x),x=Math.max(x,m.x),u=m.y}),f!==1/0&&x!==-1/0){let m=o.nodeRadius*4,v=u-m/2,H=h.get(i.nodeId);if(H){let O=(f+x)/2;H.x=O,H.y=v-k/6}t.append("rect").attr("class","wardley-pipeline-box").attr("x",f-15).attr("y",v).attr("width",x-f+30).attr("height",m).attr("fill","none").attr("stroke",p.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}})}let dt=z.append("g").attr("class","wardley-links"),lt=new Map;w.pipelines.forEach((t)=>{lt.set(t.nodeId,new Set(t.componentIds))});let ct=w.links.filter((t)=>{if(!h.has(t.source)||!h.has(t.target))return!1;if(lt.get(t.target)?.has(t.source))return!1;return!0});dt.selectAll("line").data(ct).enter().append("line").attr("class",(t)=>`wardley-link${t.dashed?" wardley-link--dashed":""}`).attr("x1",(t)=>{let l=h.get(t.source),i=h.get(t.target),f=w.nodes.find((m)=>m.id===t.source).isPipelineParent?k/Math.sqrt(2):o.nodeRadius,x=i.x-l.x,u=i.y-l.y,g=Math.sqrt(x*x+u*u);return l.x+x/g*f}).attr("y1",(t)=>{let l=h.get(t.source),i=h.get(t.target),f=w.nodes.find((m)=>m.id===t.source).isPipelineParent?k/Math.sqrt(2):o.nodeRadius,x=i.x-l.x,u=i.y-l.y,g=Math.sqrt(x*x+u*u);return l.y+u/g*f}).attr("x2",(t)=>{let l=h.get(t.source),i=h.get(t.target),f=w.nodes.find((m)=>m.id===t.target).isPipelineParent?k/Math.sqrt(2):o.nodeRadius,x=l.x-i.x,u=l.y-i.y,g=Math.sqrt(x*x+u*u);return i.x+x/g*f}).attr("y2",(t)=>{let l=h.get(t.source),i=h.get(t.target),f=w.nodes.find((m)=>m.id===t.target).isPipelineParent?k/Math.sqrt(2):o.nodeRadius,x=l.x-i.x,u=l.y-i.y,g=Math.sqrt(x*x+u*u);return i.y+u/g*f}).attr("stroke",p.linkStroke).attr("stroke-width",1).attr("stroke-dasharray",(t)=>t.dashed?"6 6":null).attr("marker-end",(t)=>{if(t.flow==="forward"||t.flow==="bidirectional")return`url(#link-arrow-end-${d})`;return null}).attr("marker-start",(t)=>{if(t.flow==="backward"||t.flow==="bidirectional")return`url(#link-arrow-start-${d})`;return null}),dt.selectAll("text").data(ct.filter((t)=>t.label)).enter().append("text").attr("class","wardley-link-label").attr("x",(t)=>{let l=h.get(t.source),i=h.get(t.target),c=(l.x+i.x)/2,f=i.y-l.y,x=i.x-l.x,u=Math.sqrt(x*x+f*f),g=8,m=f/u;return c+m*8}).attr("y",(t)=>{let l=h.get(t.source),i=h.get(t.target),c=(l.y+i.y)/2,f=i.x-l.x,x=i.y-l.y,u=Math.sqrt(f*f+x*x),g=8,m=-f/u;return c+m*8}).attr("fill",p.axisTextColor).attr("font-size",o.labelFontSize).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform",(t)=>{let l=h.get(t.source),i=h.get(t.target),c=(l.x+i.x)/2,f=(l.y+i.y)/2,x=i.x-l.x,u=i.y-l.y,g=Math.sqrt(x*x+u*u),m=8,v=u/g,H=-x/g,O=c+v*8,at=f+H*8,_=Math.atan2(u,x)*180/Math.PI;if(_>90||_<-90)_+=180;return`rotate(${_} ${O} ${at})`}).text((t)=>t.label);let Wt=z.append("g").attr("class","wardley-trends"),At=w.trends.map((t)=>{let l=h.get(t.nodeId);if(!l)return null;let i=D(t.targetX),c=G(t.targetY),f=i-l.x,x=c-l.y,u=Math.sqrt(f*f+x*x),g=o.nodeRadius+2,m=u>g?i-f/u*g:i,v=u>g?c-x/u*g:c;return{origin:l,targetX:i,targetY:c,adjustedX2:m,adjustedY2:v}}).filter((t)=>t!==null);Wt.selectAll("line").data(At).enter().append("line").attr("class","wardley-trend").attr("x1",(t)=>t.origin.x).attr("y1",(t)=>t.origin.y).attr("x2",(t)=>t.adjustedX2).attr("y2",(t)=>t.adjustedY2).attr("stroke",p.evolutionStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4").attr("marker-end",`url(#arrow-${d})`);let R=z.append("g").attr("class","wardley-nodes").selectAll("g").data(w.nodes).enter().append("g").attr("class",(t)=>["wardley-node",t.className?`wardley-node--${t.className}`:""].filter(Boolean).join(" "));R.filter((t)=>t.sourceStrategy==="outsource").append("circle").attr("class","wardley-outsource-overlay").attr("cx",(t)=>h.get(t.id).x).attr("cy",(t)=>h.get(t.id).y).attr("r",o.nodeRadius*2).attr("fill","#666").attr("stroke",p.componentStroke).attr("stroke-width",1),R.filter((t)=>t.sourceStrategy==="buy").append("circle").attr("class","wardley-buy-overlay").attr("cx",(t)=>h.get(t.id).x).attr("cy",(t)=>h.get(t.id).y).attr("r",o.nodeRadius*2).attr("fill","#ccc").attr("stroke",p.componentStroke).attr("stroke-width",1),R.filter((t)=>t.sourceStrategy==="build").append("circle").attr("class","wardley-build-overlay").attr("cx",(t)=>h.get(t.id).x).attr("cy",(t)=>h.get(t.id).y).attr("r",o.nodeRadius*2).attr("fill","#eee").attr("stroke","#000").attr("stroke-width",1);let q=R.filter((t)=>t.sourceStrategy==="market");q.append("circle").attr("class","wardley-market-overlay").attr("cx",(t)=>h.get(t.id).x).attr("cy",(t)=>h.get(t.id).y).attr("r",o.nodeRadius*2).attr("fill","white").attr("stroke",p.componentStroke).attr("stroke-width",1),R.filter((t)=>!t.isPipelineParent&&t.sourceStrategy!=="market"&&t.className!=="anchor").append("circle").attr("cx",(t)=>h.get(t.id).x).attr("cy",(t)=>h.get(t.id).y).attr("r",o.nodeRadius).attr("fill",p.componentFill).attr("stroke",p.componentStroke).attr("stroke-width",1);let st=o.nodeRadius*0.7,N=o.nodeRadius*1.2;if(q.append("line").attr("class","wardley-market-line").attr("x1",(t)=>h.get(t.id).x).attr("y1",(t)=>h.get(t.id).y-N).attr("x2",(t)=>h.get(t.id).x-N*Math.cos(Math.PI/6)).attr("y2",(t)=>h.get(t.id).y+N*Math.sin(Math.PI/6)).attr("stroke",p.componentStroke).attr("stroke-width",1),q.append("line").attr("class","wardley-market-line").attr("x1",(t)=>h.get(t.id).x-N*Math.cos(Math.PI/6)).attr("y1",(t)=>h.get(t.id).y+N*Math.sin(Math.PI/6)).attr("x2",(t)=>h.get(t.id).x+N*Math.cos(Math.PI/6)).attr("y2",(t)=>h.get(t.id).y+N*Math.sin(Math.PI/6)).attr("stroke",p.componentStroke).attr("stroke-width",1),q.append("line").attr("class","wardley-market-line").attr("x1",(t)=>h.get(t.id).x+N*Math.cos(Math.PI/6)).attr("y1",(t)=>h.get(t.id).y+N*Math.sin(Math.PI/6)).attr("x2",(t)=>h.get(t.id).x).attr("y2",(t)=>h.get(t.id).y-N).attr("stroke",p.componentStroke).attr("stroke-width",1),q.append("circle").attr("class","wardley-market-dot").attr("cx",(t)=>h.get(t.id).x).attr("cy",(t)=>h.get(t.id).y-N).attr("r",st).attr("fill","white").attr("stroke",p.componentStroke).attr("stroke-width",2),q.append("circle").attr("class","wardley-market-dot").attr("cx",(t)=>h.get(t.id).x-N*Math.cos(Math.PI/6)).attr("cy",(t)=>h.get(t.id).y+N*Math.sin(Math.PI/6)).attr("r",st).attr("fill","white").attr("stroke",p.componentStroke).attr("stroke-width",2),q.append("circle").attr("class","wardley-market-dot").attr("cx",(t)=>h.get(t.id).x+N*Math.cos(Math.PI/6)).attr("cy",(t)=>h.get(t.id).y+N*Math.sin(Math.PI/6)).attr("r",st).attr("fill","white").attr("stroke",p.componentStroke).attr("stroke-width",2),R.filter((t)=>t.isPipelineParent===!0).append("rect").attr("x",(t)=>h.get(t.id).x-k/2).attr("y",(t)=>h.get(t.id).y-k/2).attr("width",k).attr("height",k).attr("fill",p.componentFill).attr("stroke",p.componentStroke).attr("stroke-width",1),R.filter((t)=>t.inertia===!0).append("line").attr("class","wardley-inertia").attr("x1",(t)=>{let l=h.get(t.id),i=t.isPipelineParent?k/2+15:o.nodeRadius+15;if(t.sourceStrategy)i+=o.nodeRadius+10;return l.x+i}).attr("y1",(t)=>{let l=h.get(t.id),i=t.isPipelineParent?k:o.nodeRadius*2;return l.y-i/2}).attr("x2",(t)=>{let l=h.get(t.id),i=t.isPipelineParent?k/2+15:o.nodeRadius+15;if(t.sourceStrategy)i+=o.nodeRadius+10;return l.x+i}).attr("y2",(t)=>{let l=h.get(t.id),i=t.isPipelineParent?k:o.nodeRadius*2;return l.y+i/2}).attr("stroke",p.componentStroke).attr("stroke-width",6),R.append("text").attr("x",(t)=>{let l=h.get(t.id);if(t.className==="anchor")return t.labelOffsetX!==void 0?l.x+t.labelOffsetX:l.x;let i=o.nodeLabelOffset;if(t.sourceStrategy&&t.labelOffsetX===void 0)i+=10;let c=t.labelOffsetX??i;return l.x+c}).attr("y",(t)=>{let l=h.get(t.id);if(t.className==="anchor")return t.labelOffsetY!==void 0?l.y+t.labelOffsetY:l.y-3;let i=-o.nodeLabelOffset;if(t.sourceStrategy&&t.labelOffsetY===void 0)i-=10;let c=t.labelOffsetY??i;return l.y+c}).attr("class","wardley-node-label").attr("fill",(t)=>{if(t.className==="evolved")return p.evolutionStroke;if(t.className==="anchor")return"#000";return p.componentLabelColor}).attr("font-size",o.labelFontSize).attr("font-weight",(t)=>t.className==="anchor"?"bold":"normal").attr("text-anchor",(t)=>t.className==="anchor"?"middle":"start").attr("dominant-baseline",(t)=>t.className==="anchor"?"middle":"auto").text((t)=>t.label),w.annotations.length>0){let t=z.append("g").attr("class","wardley-annotations");if(w.annotations.forEach((l)=>{let i=l.coordinates.map((c)=>({x:D(c.x),y:G(c.y)}));if(i.length>1)for(let c=0;c<i.length-1;c++)t.append("line").attr("class","wardley-annotation-line").attr("x1",i[c].x).attr("y1",i[c].y).attr("x2",i[c+1].x).attr("y2",i[c+1].y).attr("stroke",p.axisColor).attr("stroke-width",1.5).attr("stroke-dasharray","4 4");i.forEach((c)=>{let f=t.append("g").attr("class","wardley-annotation");f.append("circle").attr("cx",c.x).attr("cy",c.y).attr("r",10).attr("fill","white").attr("stroke",p.axisColor).attr("stroke-width",1.5),f.append("text").attr("x",c.x).attr("y",c.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",10).attr("fill",p.axisTextColor).attr("font-weight","bold").text(l.number)})}),w.annotationsBox){let l=D(w.annotationsBox.x),i=G(w.annotationsBox.y),c=10,f=16,x=11,u=t.append("g").attr("class","wardley-annotations-box"),g=[...w.annotations].filter((v)=>v.text).sort((v,H)=>v.number-H.number),m=[];if(g.forEach((v,H)=>{let O=u.append("text").attr("x",l+c).attr("y",i+c+(H+1)*f).attr("font-size",x).attr("fill",p.axisTextColor).attr("text-anchor","start").attr("dominant-baseline","middle").text(`${v.number}. ${v.text}`);m.push(O)}),m.length>0){let v=0,H=0;m.forEach((it)=>{let rt=it.node(),Yt=rt.getComputedTextLength();v=Math.max(v,Yt);let It=rt.getBBox();H=Math.max(H,It.height)});let O=v+c*2+105,at=g.length*f+c*2+H/2,_=o.padding,Xt=F-o.padding-O,Et=o.padding,Ht=M-o.padding-at;l=Math.max(_,Math.min(l,Xt)),i=Math.max(Et,Math.min(i,Ht)),m.forEach((it,rt)=>{it.attr("x",l+c).attr("y",i+c+(rt+1)*f)}),u.insert("rect","text").attr("x",l).attr("y",i).attr("width",O).attr("height",at).attr("fill","white").attr("stroke",p.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}}}if(w.notes.length>0){let t=z.append("g").attr("class","wardley-notes");w.notes.forEach((l)=>{let i=D(l.x),c=G(l.y);t.append("text").attr("x",i).attr("y",c).attr("text-anchor","start").attr("font-size",11).attr("fill",p.axisTextColor).attr("font-weight","bold").text(l.text)})}if(w.accelerators.length>0){let t=z.append("g").attr("class","wardley-accelerators");w.accelerators.forEach((l)=>{let i=D(l.x),c=G(l.y),f=60,x=30,u=20,g=`
3
3
  M ${i} ${c-15}
4
4
  L ${i+60-20} ${c-15}
@@ -1,4 +1,4 @@
1
- import{W}from"./chunk-vjqmnkh2.js";import{e,r,D,b,O,mt,C,S,E,T,A,I,L,s,p,V,Bi,In,nt,U,Fe,Ie}from"./chunk-9dd1c37b.js";import{X}from"./chunk-qryrg2pq.js";import{lt,sr}from"./chunk-kgerjbn4.js";import{Ce,Se}from"./chunk-aqm3spxt.js";var ut=Se(function(rt,st){(function(n,l){if(typeof rt==="object"&&typeof st==="object")st.exports=l(sr());else if(typeof define==="function"&&define.amd)define(["cose-base"],l);else if(typeof rt==="object")rt.cytoscapeFcose=l(sr());else n.cytoscapeFcose=l(n.coseBase)})(rt,function(t){return(()=>{var n={658:(k)=>{k.exports=Object.assign!=null?Object.assign.bind(Object):function(z){for(var v=arguments.length,N=Array(v>1?v-1:0),c=1;c<v;c++)N[c-1]=arguments[c];return N.forEach(function(y){Object.keys(y).forEach(function(d){return z[d]=y[d]})}),z}},548:(k,z,v)=>{var N=function(){function d(f,u){var g=[],i=!0,B=!1,F=void 0;try{for(var o=f[Symbol.iterator](),h;!(i=(h=o.next()).done);i=!0)if(g.push(h.value),u&&g.length===u)break}catch(R){B=!0,F=R}finally{try{if(!i&&o.return)o.return()}finally{if(B)throw F}}return g}return function(f,u){if(Array.isArray(f))return f;else if(Symbol.iterator in Object(f))return d(f,u);else throw TypeError("Invalid attempt to destructure non-iterable instance")}}(),c=v(140).layoutBase.LinkedList,y={};y.getTopMostNodes=function(d){var f={};for(var u=0;u<d.length;u++)f[d[u].id()]=!0;var g=d.filter(function(i,B){if(typeof i==="number")i=B;var F=i.parent()[0];while(F!=null){if(f[F.id()])return!1;F=F.parent()[0]}return!0});return g},y.connectComponents=function(d,f,u,g){var i=new c,B=new Set,F=[],o=void 0,h=void 0,R=void 0,a=!1,P=1,H=[],M=[],j=function(){var x=d.collection();M.push(x);var Y=u[0],Z=d.collection();Z.merge(Y).merge(Y.descendants().intersection(f)),F.push(Y),Z.forEach(function(re){i.push(re),B.add(re),x.merge(re)});var Q=function(){Y=i.shift();var ue=d.collection();Y.neighborhood().nodes().forEach(function(q){if(f.intersection(Y.edgesWith(q)).length>0)ue.merge(q)});for(var Ae=0;Ae<ue.length;Ae++){var Pe=ue[Ae];if(o=u.intersection(Pe.union(Pe.ancestors())),o!=null&&!B.has(o[0])){var de=o.union(o.descendants());de.forEach(function(q){if(i.push(q),B.add(q),x.merge(q),u.has(q))F.push(q)})}}};while(i.length!=0)Q();if(x.forEach(function(re){f.intersection(re.connectedEdges()).forEach(function(ue){if(x.has(ue.source())&&x.has(ue.target()))x.merge(ue)})}),F.length==u.length)a=!0;if(!a||a&&P>1){h=F[0],R=h.connectedEdges().length,F.forEach(function(re){if(re.connectedEdges().length<R)R=re.connectedEdges().length,h=re}),H.push(h.id());var se=d.collection();se.merge(F[0]),F.forEach(function(re){se.merge(re)}),F=[],u=u.difference(se),P++}};do j();while(!a);if(g){if(H.length>0)g.set("dummy"+(g.size+1),H)}return M},y.relocateComponent=function(d,f,u){if(!u.fixedNodeConstraint){var{POSITIVE_INFINITY:g,NEGATIVE_INFINITY:i,POSITIVE_INFINITY:B,NEGATIVE_INFINITY:F}=Number;if(u.quality=="draft"){var o=!0,h=!1,R=void 0;try{for(var a=f.nodeIndexes[Symbol.iterator](),P;!(o=(P=a.next()).done);o=!0){var H=P.value,M=N(H,2),j=M[0],_=M[1],x=u.cy.getElementById(j);if(x){var Y=x.boundingBox(),Z=f.xCoords[_]-Y.w/2,Q=f.xCoords[_]+Y.w/2,se=f.yCoords[_]-Y.h/2,re=f.yCoords[_]+Y.h/2;if(Z<g)g=Z;if(Q>i)i=Q;if(se<B)B=se;if(re>F)F=re}}}catch(q){h=!0,R=q}finally{try{if(!o&&a.return)a.return()}finally{if(h)throw R}}var ue=d.x-(i+g)/2,Ae=d.y-(F+B)/2;f.xCoords=f.xCoords.map(function(q){return q+ue}),f.yCoords=f.yCoords.map(function(q){return q+Ae})}else{Object.keys(f).forEach(function(q){var oe=f[q],Ne=oe.getRect().x,ke=oe.getRect().x+oe.getRect().width,De=oe.getRect().y,xe=oe.getRect().y+oe.getRect().height;if(Ne<g)g=Ne;if(ke>i)i=ke;if(De<B)B=De;if(xe>F)F=xe});var Pe=d.x-(i+g)/2,de=d.y-(F+B)/2;Object.keys(f).forEach(function(q){var oe=f[q];oe.setCenter(oe.getCenterX()+Pe,oe.getCenterY()+de)})}}},y.calcBoundingBox=function(d,f,u,g){var{MAX_SAFE_INTEGER:i,MIN_SAFE_INTEGER:B,MAX_SAFE_INTEGER:F,MIN_SAFE_INTEGER:o}=Number,h=void 0,R=void 0,a=void 0,P=void 0,H=d.descendants().not(":parent"),M=H.length;for(var j=0;j<M;j++){var _=H[j];if(h=f[g.get(_.id())]-_.width()/2,R=f[g.get(_.id())]+_.width()/2,a=u[g.get(_.id())]-_.height()/2,P=u[g.get(_.id())]+_.height()/2,i>h)i=h;if(B<R)B=R;if(F>a)F=a;if(o<P)o=P}var x={};return x.topLeftX=i,x.topLeftY=F,x.width=B-i,x.height=o-F,x},y.calcParentsWithoutChildren=function(d,f){var u=d.collection();return f.nodes(":parent").forEach(function(g){var i=!1;if(g.children().forEach(function(B){if(B.css("display")!="none")i=!0}),!i)u.merge(g)}),u},k.exports=y},816:(k,z,v)=>{var N=v(548),c=v(140).CoSELayout,y=v(140).CoSENode,d=v(140).layoutBase.PointD,f=v(140).layoutBase.DimensionD,u=v(140).layoutBase.LayoutConstants,g=v(140).layoutBase.FDLayoutConstants,i=v(140).CoSEConstants,B=function(o,h){var{cy:R,eles:a}=o,P=a.nodes(),H=a.edges(),M=void 0,j=void 0,_=void 0,x={};if(o.randomize)M=h.nodeIndexes,j=h.xCoords,_=h.yCoords;var Y=function(q){return typeof q==="function"},Z=function(q,oe){if(Y(q))return q(oe);else return q},Q=N.calcParentsWithoutChildren(R,a),se=function de(q,oe,Ne,ke){var De=oe.length;for(var xe=0;xe<De;xe++){var J=oe[xe],Te=null;if(J.intersection(Q).length==0)Te=J.children();var ie=void 0,ve=J.layoutDimensions({nodeDimensionsIncludeLabels:ke.nodeDimensionsIncludeLabels});if(J.outerWidth()!=null&&J.outerHeight()!=null)if(ke.randomize)if(!J.isParent())ie=q.add(new y(Ne.graphManager,new d(j[M.get(J.id())]-ve.w/2,_[M.get(J.id())]-ve.h/2),new f(parseFloat(ve.w),parseFloat(ve.h))));else{var Me=N.calcBoundingBox(J,j,_,M);if(J.intersection(Q).length==0)ie=q.add(new y(Ne.graphManager,new d(Me.topLeftX,Me.topLeftY),new f(Me.width,Me.height)));else ie=q.add(new y(Ne.graphManager,new d(Me.topLeftX,Me.topLeftY),new f(parseFloat(ve.w),parseFloat(ve.h))))}else ie=q.add(new y(Ne.graphManager,new d(J.position("x")-ve.w/2,J.position("y")-ve.h/2),new f(parseFloat(ve.w),parseFloat(ve.h))));else ie=q.add(new y(this.graphManager));if(ie.id=J.data("id"),ie.nodeRepulsion=Z(ke.nodeRepulsion,J),ie.paddingLeft=parseInt(J.css("padding")),ie.paddingTop=parseInt(J.css("padding")),ie.paddingRight=parseInt(J.css("padding")),ie.paddingBottom=parseInt(J.css("padding")),ke.nodeDimensionsIncludeLabels)ie.labelWidth=J.boundingBox({includeLabels:!0,includeNodes:!1,includeOverlays:!1}).w,ie.labelHeight=J.boundingBox({includeLabels:!0,includeNodes:!1,includeOverlays:!1}).h,ie.labelPosVertical=J.css("text-valign"),ie.labelPosHorizontal=J.css("text-halign");if(x[J.data("id")]=ie,isNaN(ie.rect.x))ie.rect.x=0;if(isNaN(ie.rect.y))ie.rect.y=0;if(Te!=null&&Te.length>0){var ze=void 0;ze=Ne.getGraphManager().add(Ne.newGraph(),ie),de(ze,Te,Ne,ke)}}},re=function(q,oe,Ne){var ke=0,De=0;for(var xe=0;xe<Ne.length;xe++){var J=Ne[xe],Te=x[J.data("source")],ie=x[J.data("target")];if(Te&&ie&&Te!==ie&&Te.getEdgesBetween(ie).length==0){var ve=oe.add(q.newEdge(),Te,ie);ve.id=J.id(),ve.idealLength=Z(o.idealEdgeLength,J),ve.edgeElasticity=Z(o.edgeElasticity,J),ke+=ve.idealLength,De++}}if(o.idealEdgeLength!=null){if(De>0)i.DEFAULT_EDGE_LENGTH=g.DEFAULT_EDGE_LENGTH=ke/De;else if(!Y(o.idealEdgeLength))i.DEFAULT_EDGE_LENGTH=g.DEFAULT_EDGE_LENGTH=o.idealEdgeLength;else i.DEFAULT_EDGE_LENGTH=g.DEFAULT_EDGE_LENGTH=50;i.MIN_REPULSION_DIST=g.MIN_REPULSION_DIST=g.DEFAULT_EDGE_LENGTH/10,i.DEFAULT_RADIAL_SEPARATION=g.DEFAULT_EDGE_LENGTH}},ue=function(q,oe){if(oe.fixedNodeConstraint)q.constraints.fixedNodeConstraint=oe.fixedNodeConstraint;if(oe.alignmentConstraint)q.constraints.alignmentConstraint=oe.alignmentConstraint;if(oe.relativePlacementConstraint)q.constraints.relativePlacementConstraint=oe.relativePlacementConstraint};if(o.nestingFactor!=null)i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=g.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=o.nestingFactor;if(o.gravity!=null)i.DEFAULT_GRAVITY_STRENGTH=g.DEFAULT_GRAVITY_STRENGTH=o.gravity;if(o.numIter!=null)i.MAX_ITERATIONS=g.MAX_ITERATIONS=o.numIter;if(o.gravityRange!=null)i.DEFAULT_GRAVITY_RANGE_FACTOR=g.DEFAULT_GRAVITY_RANGE_FACTOR=o.gravityRange;if(o.gravityCompound!=null)i.DEFAULT_COMPOUND_GRAVITY_STRENGTH=g.DEFAULT_COMPOUND_GRAVITY_STRENGTH=o.gravityCompound;if(o.gravityRangeCompound!=null)i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=g.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=o.gravityRangeCompound;if(o.initialEnergyOnIncremental!=null)i.DEFAULT_COOLING_FACTOR_INCREMENTAL=g.DEFAULT_COOLING_FACTOR_INCREMENTAL=o.initialEnergyOnIncremental;if(o.tilingCompareBy!=null)i.TILING_COMPARE_BY=o.tilingCompareBy;if(o.quality=="proof")u.QUALITY=2;else u.QUALITY=0;if(i.NODE_DIMENSIONS_INCLUDE_LABELS=g.NODE_DIMENSIONS_INCLUDE_LABELS=u.NODE_DIMENSIONS_INCLUDE_LABELS=o.nodeDimensionsIncludeLabels,i.DEFAULT_INCREMENTAL=g.DEFAULT_INCREMENTAL=u.DEFAULT_INCREMENTAL=!o.randomize,i.ANIMATE=g.ANIMATE=u.ANIMATE=o.animate,i.TILE=o.tile,i.TILING_PADDING_VERTICAL=typeof o.tilingPaddingVertical==="function"?o.tilingPaddingVertical.call():o.tilingPaddingVertical,i.TILING_PADDING_HORIZONTAL=typeof o.tilingPaddingHorizontal==="function"?o.tilingPaddingHorizontal.call():o.tilingPaddingHorizontal,i.DEFAULT_INCREMENTAL=g.DEFAULT_INCREMENTAL=u.DEFAULT_INCREMENTAL=!0,i.PURE_INCREMENTAL=!o.randomize,u.DEFAULT_UNIFORM_LEAF_NODE_SIZES=o.uniformNodeDimensions,o.step=="transformed")i.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,i.ENFORCE_CONSTRAINTS=!1,i.APPLY_LAYOUT=!1;if(o.step=="enforced")i.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,i.ENFORCE_CONSTRAINTS=!0,i.APPLY_LAYOUT=!1;if(o.step=="cose")i.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,i.ENFORCE_CONSTRAINTS=!1,i.APPLY_LAYOUT=!0;if(o.step=="all"){if(o.randomize)i.TRANSFORM_ON_CONSTRAINT_HANDLING=!0;else i.TRANSFORM_ON_CONSTRAINT_HANDLING=!1;i.ENFORCE_CONSTRAINTS=!0,i.APPLY_LAYOUT=!0}if(o.fixedNodeConstraint||o.alignmentConstraint||o.relativePlacementConstraint)i.TREE_REDUCTION_ON_INCREMENTAL=!1;else i.TREE_REDUCTION_ON_INCREMENTAL=!0;var Ae=new c,Pe=Ae.newGraphManager();return se(Pe.addRoot(),N.getTopMostNodes(P),Ae,o),re(Ae,Pe,H),ue(Ae,o),Ae.runLayout(),x};k.exports={coseLayout:B}},212:(k,z,v)=>{var N=function(){function o(h,R){for(var a=0;a<R.length;a++){var P=R[a];if(P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P)P.writable=!0;Object.defineProperty(h,P.key,P)}}return function(h,R,a){if(R)o(h.prototype,R);if(a)o(h,a);return h}}();function c(o,h){if(!(o instanceof h))throw TypeError("Cannot call a class as a function")}var y=v(658),d=v(548),f=v(657),u=f.spectralLayout,g=v(816),i=g.coseLayout,B=Object.freeze({quality:"default",randomize:!0,animate:!0,animationDuration:1000,animationEasing:void 0,fit:!0,padding:30,nodeDimensionsIncludeLabels:!1,uniformNodeDimensions:!1,packComponents:!0,step:"all",samplingType:!0,sampleSize:25,nodeSeparation:75,piTol:0.0000001,nodeRepulsion:function(h){return 4500},idealEdgeLength:function(h){return 50},edgeElasticity:function(h){return 0.45},nestingFactor:0.1,gravity:0.25,numIter:2500,tile:!0,tilingCompareBy:void 0,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:0.3,fixedNodeConstraint:void 0,alignmentConstraint:void 0,relativePlacementConstraint:void 0,ready:function(){},stop:function(){}}),F=function(){function o(h){c(this,o),this.options=y({},B,h)}return N(o,[{key:"run",value:function(){var R=this,a=this.options,{cy:P,eles:H}=a,M=[],j=void 0,_=void 0,x=[],Y=void 0,Z=[];if(a.fixedNodeConstraint&&(!Array.isArray(a.fixedNodeConstraint)||a.fixedNodeConstraint.length==0))a.fixedNodeConstraint=void 0;if(a.alignmentConstraint){if(a.alignmentConstraint.vertical&&(!Array.isArray(a.alignmentConstraint.vertical)||a.alignmentConstraint.vertical.length==0))a.alignmentConstraint.vertical=void 0;if(a.alignmentConstraint.horizontal&&(!Array.isArray(a.alignmentConstraint.horizontal)||a.alignmentConstraint.horizontal.length==0))a.alignmentConstraint.horizontal=void 0}if(a.relativePlacementConstraint&&(!Array.isArray(a.relativePlacementConstraint)||a.relativePlacementConstraint.length==0))a.relativePlacementConstraint=void 0;var Q=a.fixedNodeConstraint||a.alignmentConstraint||a.relativePlacementConstraint;if(Q)a.tile=!1,a.packComponents=!1;var se=void 0,re=!1;if(P.layoutUtilities&&a.packComponents){if(se=P.layoutUtilities("get"),!se)se=P.layoutUtilities();re=!0}if(H.nodes().length>0)if(!re){var ue=a.eles.boundingBox();if(Z.push({x:ue.x1+ue.w/2,y:ue.y1+ue.h/2}),a.randomize){var Ae=u(a);M.push(Ae)}if(a.quality=="default"||a.quality=="proof")x.push(i(a,M[0])),d.relocateComponent(Z[0],x[0],a);else d.relocateComponent(Z[0],M[0],a)}else{var Pe=d.getTopMostNodes(a.eles.nodes());if(Y=d.connectComponents(P,a.eles,Pe),Y.forEach(function(K){var G=K.boundingBox();Z.push({x:G.x1+G.w/2,y:G.y1+G.h/2})}),a.randomize)Y.forEach(function(K){a.eles=K,M.push(u(a))});if(a.quality=="default"||a.quality=="proof"){var de=P.collection();if(a.tile){var q=new Map,oe=[],Ne=[],ke=0,De={nodeIndexes:q,xCoords:oe,yCoords:Ne},xe=[];if(Y.forEach(function(K,G){if(K.edges().length==0)K.nodes().forEach(function(pe,le){if(de.merge(K.nodes()[le]),!pe.isParent())De.nodeIndexes.set(K.nodes()[le].id(),ke++),De.xCoords.push(K.nodes()[0].position().x),De.yCoords.push(K.nodes()[0].position().y)}),xe.push(G)}),de.length>1){var J=de.boundingBox();Z.push({x:J.x1+J.w/2,y:J.y1+J.h/2}),Y.push(de),M.push(De);for(var Te=xe.length-1;Te>=0;Te--)Y.splice(xe[Te],1),M.splice(xe[Te],1),Z.splice(xe[Te],1)}}Y.forEach(function(K,G){a.eles=K,x.push(i(a,M[G])),d.relocateComponent(Z[G],x[G],a)})}else Y.forEach(function(K,G){d.relocateComponent(Z[G],M[G],a)});var ie=new Set;if(Y.length>1){var ve=[],Me=H.filter(function(K){return K.css("display")=="none"});Y.forEach(function(K,G){var pe=void 0;if(a.quality=="draft")pe=M[G].nodeIndexes;if(K.nodes().not(Me).length>0){var le={};le.edges=[],le.nodes=[];var me=void 0;if(K.nodes().not(Me).forEach(function(fe){if(a.quality=="draft")if(!fe.isParent())me=pe.get(fe.id()),le.nodes.push({x:M[G].xCoords[me]-fe.boundingbox().w/2,y:M[G].yCoords[me]-fe.boundingbox().h/2,width:fe.boundingbox().w,height:fe.boundingbox().h});else{var he=d.calcBoundingBox(fe,M[G].xCoords,M[G].yCoords,pe);le.nodes.push({x:he.topLeftX,y:he.topLeftY,width:he.width,height:he.height})}else if(x[G][fe.id()])le.nodes.push({x:x[G][fe.id()].getLeft(),y:x[G][fe.id()].getTop(),width:x[G][fe.id()].getWidth(),height:x[G][fe.id()].getHeight()})}),K.edges().forEach(function(fe){var he=fe.source(),Ee=fe.target();if(he.css("display")!="none"&&Ee.css("display")!="none"){if(a.quality=="draft"){var Be=pe.get(he.id()),et=pe.get(Ee.id()),Oe=[],Ye=[];if(he.isParent()){var We=d.calcBoundingBox(he,M[G].xCoords,M[G].yCoords,pe);Oe.push(We.topLeftX+We.width/2),Oe.push(We.topLeftY+We.height/2)}else Oe.push(M[G].xCoords[Be]),Oe.push(M[G].yCoords[Be]);if(Ee.isParent()){var Je=d.calcBoundingBox(Ee,M[G].xCoords,M[G].yCoords,pe);Ye.push(Je.topLeftX+Je.width/2),Ye.push(Je.topLeftY+Je.height/2)}else Ye.push(M[G].xCoords[et]),Ye.push(M[G].yCoords[et]);le.edges.push({startX:Oe[0],startY:Oe[1],endX:Ye[0],endY:Ye[1]})}else if(x[G][he.id()]&&x[G][Ee.id()])le.edges.push({startX:x[G][he.id()].getCenterX(),startY:x[G][he.id()].getCenterY(),endX:x[G][Ee.id()].getCenterX(),endY:x[G][Ee.id()].getCenterY()})}}),le.nodes.length>0)ve.push(le),ie.add(G)}});var ze=se.packComponents(ve,a.randomize).shifts;if(a.quality=="draft")M.forEach(function(K,G){var pe=K.xCoords.map(function(me){return me+ze[G].dx}),le=K.yCoords.map(function(me){return me+ze[G].dy});K.xCoords=pe,K.yCoords=le});else{var Ke=0;ie.forEach(function(K){Object.keys(x[K]).forEach(function(G){var pe=x[K][G];pe.setCenter(pe.getCenterX()+ze[Ke].dx,pe.getCenterY()+ze[Ke].dy)}),Ke++})}}}var je=function(G,pe){if(a.quality=="default"||a.quality=="proof"){if(typeof G==="number")G=pe;var le=void 0,me=void 0,fe=G.data("id");if(x.forEach(function(Ee){if(fe in Ee)le={x:Ee[fe].getRect().getCenterX(),y:Ee[fe].getRect().getCenterY()},me=Ee[fe]}),a.nodeDimensionsIncludeLabels){if(me.labelWidth){if(me.labelPosHorizontal=="left")le.x+=me.labelWidth/2;else if(me.labelPosHorizontal=="right")le.x-=me.labelWidth/2}if(me.labelHeight){if(me.labelPosVertical=="top")le.y+=me.labelHeight/2;else if(me.labelPosVertical=="bottom")le.y-=me.labelHeight/2}}if(le==null)le={x:G.position("x"),y:G.position("y")};return{x:le.x,y:le.y}}else{var he=void 0;if(M.forEach(function(Ee){var Be=Ee.nodeIndexes.get(G.id());if(Be!=null)he={x:Ee.xCoords[Be],y:Ee.yCoords[Be]}}),he==null)he={x:G.position("x"),y:G.position("y")};return{x:he.x,y:he.y}}};if(a.quality=="default"||a.quality=="proof"||a.randomize){var at=d.calcParentsWithoutChildren(P,H),qe=H.filter(function(K){return K.css("display")=="none"});if(a.eles=H.not(qe),H.nodes().not(":parent").not(qe).layoutPositions(R,a,je),at.length>0)at.forEach(function(K){K.position(je(K))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),o}();k.exports=F},657:(k,z,v)=>{var N=v(548),c=v(140).layoutBase.Matrix,y=v(140).layoutBase.SVD,d=function(u){var{cy:g,eles:i}=u,B=i.nodes(),F=i.nodes(":parent"),o=new Map,h=new Map,R=new Map,a=[],P=[],H=[],M=[],j=[],_=[],x=[],Y=[],Z=void 0,Q=void 0,se=1e8,re=0.000000001,{piTol:ue,samplingType:Ae,nodeSeparation:Pe}=u,de=void 0,q=function(){var ee=0,te=0,ne=!1;while(te<de){ee=Math.floor(Math.random()*Q),ne=!1;for(var ae=0;ae<te;ae++)if(M[ae]==ee){ne=!0;break}if(!ne)M[te]=ee,te++;else continue}},oe=function(ee,te,ne){var ae=[],we=0,ge=0,ce=0,Le=void 0,be=[],$e=0,_e=1;for(var Ue=0;Ue<Q;Ue++)be[Ue]=se;ae[ge]=ee,be[ee]=0;while(ge>=we){ce=ae[we++];var Xe=a[ce];for(var He=0;He<Xe.length;He++)if(Le=h.get(Xe[He]),be[Le]==se)be[Le]=be[ce]+1,ae[++ge]=Le;_[ce][te]=be[ce]*Pe}if(ne){for(var Ge=0;Ge<Q;Ge++)if(_[Ge][te]<j[Ge])j[Ge]=_[Ge][te];for(var tt=0;tt<Q;tt++)if(j[tt]>$e)$e=j[tt],_e=tt}return _e},Ne=function(ee){var te=void 0;if(!ee){q();for(var ne=0;ne<de;ne++)oe(M[ne],ne,ee,!1)}else{te=Math.floor(Math.random()*Q),Z=te;for(var ae=0;ae<Q;ae++)j[ae]=se;for(var we=0;we<de;we++)M[we]=te,te=oe(te,we,ee)}for(var ge=0;ge<Q;ge++)for(var ce=0;ce<de;ce++)_[ge][ce]*=_[ge][ce];for(var Le=0;Le<de;Le++)x[Le]=[];for(var be=0;be<de;be++)for(var $e=0;$e<de;$e++)x[be][$e]=_[M[$e]][be]},ke=function(){var ee=y.svd(x),{S:te,U:ne,V:ae}=ee,we=te[0]*te[0]*te[0],ge=[];for(var ce=0;ce<de;ce++){ge[ce]=[];for(var Le=0;Le<de;Le++)if(ge[ce][Le]=0,ce==Le)ge[ce][Le]=te[ce]/(te[ce]*te[ce]+we/(te[ce]*te[ce]))}Y=c.multMat(c.multMat(ae,ge),c.transpose(ne))},De=function(){var ee=void 0,te=void 0,ne=[],ae=[],we=[],ge=[];for(var ce=0;ce<Q;ce++)ne[ce]=Math.random(),ae[ce]=Math.random();ne=c.normalize(ne),ae=c.normalize(ae);var Le=0,be=re,$e=re,_e=void 0;while(!0){Le++;for(var Ue=0;Ue<Q;Ue++)we[Ue]=ne[Ue];if(ne=c.multGamma(c.multL(c.multGamma(we),_,Y)),ee=c.dotProduct(we,ne),ne=c.normalize(ne),be=c.dotProduct(we,ne),_e=Math.abs(be/$e),_e<=1+ue&&_e>=1)break;$e=be}for(var Xe=0;Xe<Q;Xe++)we[Xe]=ne[Xe];Le=0,$e=re;while(!0){Le++;for(var He=0;He<Q;He++)ge[He]=ae[He];if(ge=c.minusOp(ge,c.multCons(we,c.dotProduct(we,ge))),ae=c.multGamma(c.multL(c.multGamma(ge),_,Y)),te=c.dotProduct(ge,ae),ae=c.normalize(ae),be=c.dotProduct(ge,ae),_e=Math.abs(be/$e),_e<=1+ue&&_e>=1)break;$e=be}for(var Ge=0;Ge<Q;Ge++)ge[Ge]=ae[Ge];P=c.multCons(we,Math.sqrt(Math.abs(ee))),H=c.multCons(ge,Math.sqrt(Math.abs(te)))};N.connectComponents(g,i,N.getTopMostNodes(B),o),F.forEach(function(ye){N.connectComponents(g,i,N.getTopMostNodes(ye.descendants().intersection(i)),o)});var xe=0;for(var J=0;J<B.length;J++)if(!B[J].isParent())h.set(B[J].id(),xe++);var Te=!0,ie=!1,ve=void 0;try{for(var Me=o.keys()[Symbol.iterator](),ze;!(Te=(ze=Me.next()).done);Te=!0){var Ke=ze.value;h.set(Ke,xe++)}}catch(ye){ie=!0,ve=ye}finally{try{if(!Te&&Me.return)Me.return()}finally{if(ie)throw ve}}for(var je=0;je<h.size;je++)a[je]=[];F.forEach(function(ye){var ee=ye.children().intersection(i);while(ee.nodes(":childless").length==0)ee=ee.nodes()[0].children().intersection(i);var te=0,ne=ee.nodes(":childless")[0].connectedEdges().length;ee.nodes(":childless").forEach(function(ae,we){if(ae.connectedEdges().length<ne)ne=ae.connectedEdges().length,te=we}),R.set(ye.id(),ee.nodes(":childless")[te].id())}),B.forEach(function(ye){var ee=void 0;if(ye.isParent())ee=h.get(R.get(ye.id()));else ee=h.get(ye.id());ye.neighborhood().nodes().forEach(function(te){if(i.intersection(ye.edgesWith(te)).length>0)if(te.isParent())a[ee].push(R.get(te.id()));else a[ee].push(te.id())})});var at=function(ee){var te=h.get(ee),ne=void 0;o.get(ee).forEach(function(ae){if(g.getElementById(ae).isParent())ne=R.get(ae);else ne=ae;a[te].push(ne),a[h.get(ne)].push(ee)})},qe=!0,K=!1,G=void 0;try{for(var pe=o.keys()[Symbol.iterator](),le;!(qe=(le=pe.next()).done);qe=!0){var me=le.value;at(me)}}catch(ye){K=!0,G=ye}finally{try{if(!qe&&pe.return)pe.return()}finally{if(K)throw G}}Q=h.size;var fe=void 0;if(Q>2){de=Q<u.sampleSize?Q:u.sampleSize;for(var he=0;he<Q;he++)_[he]=[];for(var Ee=0;Ee<de;Ee++)Y[Ee]=[];if(u.quality=="draft"||u.step=="all")Ne(Ae),ke(),De(),fe={nodeIndexes:h,xCoords:P,yCoords:H};else h.forEach(function(ye,ee){P.push(g.getElementById(ee).position("x")),H.push(g.getElementById(ee).position("y"))}),fe={nodeIndexes:h,xCoords:P,yCoords:H};return fe}else{var Be=h.keys(),et=g.getElementById(Be.next().value),Oe=et.position(),Ye=et.outerWidth();if(P.push(Oe.x),H.push(Oe.y),Q==2){var We=g.getElementById(Be.next().value),Je=We.outerWidth();P.push(Oe.x+Ye/2+Je/2+u.idealEdgeLength),H.push(Oe.y)}return fe={nodeIndexes:h,xCoords:P,yCoords:H},fe}};k.exports={spectralLayout:d}},579:(k,z,v)=>{var N=v(212),c=function(d){if(!d)return;d("layout","fcose",N)};if(typeof cytoscape<"u")c(cytoscape);k.exports=c},140:(k)=>{k.exports=t}},l={};function w(k){var z=l[k];if(z!==void 0)return z.exports;var v=l[k]={exports:{}};return n[k](v,v.exports,w),v.exports}var m=w(579);return m})()})});var xt=Ce(ut(),1);var gt={L:"left",R:"right",T:"top",B:"bottom"},ht={L:e((t)=>`${t},${t/2} 0,${t} 0,0`,"L"),R:e((t)=>`0,${t/2} ${t},0 ${t},${t}`,"R"),T:e((t)=>`0,0 ${t},0 ${t/2},${t}`,"T"),B:e((t)=>`${t/2},0 ${t},${t} 0,${t}`,"B")},ot={L:e((t,n)=>t-n+2,"L"),R:e((t,n)=>t-2,"R"),T:e((t,n)=>t-n+2,"T"),B:e((t,n)=>t-2,"B")},kt=e(function(t){if(Re(t))return t==="L"?"R":"L";else return t==="T"?"B":"T"},"getOppositeArchitectureDirection"),vt=e(function(t){let n=t;return n==="L"||n==="R"||n==="T"||n==="B"},"isArchitectureDirection"),Re=e(function(t){let n=t;return n==="L"||n==="R"},"isArchitectureDirectionX"),Ve=e(function(t){let n=t;return n==="T"||n==="B"},"isArchitectureDirectionY"),ft=e(function(t,n){let l=Re(t)&&Ve(n),w=Ve(t)&&Re(n);return l||w},"isArchitectureDirectionXY"),Dt=e(function(t){let n=t[0],l=t[1],w=Re(n)&&Ve(l),m=Ve(n)&&Re(l);return w||m},"isArchitecturePairXY"),Rt=e(function(t){return t!=="LL"&&t!=="RR"&&t!=="TT"&&t!=="BB"},"isValidArchitectureDirectionPair"),ct=e(function(t,n){let l=`${t}${n}`;return Rt(l)?l:void 0},"getArchitectureDirectionPair"),Mt=e(function([t,n],l){let w=l[0],m=l[1];if(Re(w))if(Ve(m))return[t+(w==="L"?-1:1),n+(m==="T"?1:-1)];else return[t+(w==="L"?-1:1),n];else if(Re(m))return[t+(m==="L"?1:-1),n+(w==="T"?1:-1)];else return[t,n+(w==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),Ft=e(function(t){if(t==="LT"||t==="TL")return[1,1];else if(t==="BL"||t==="LB")return[1,-1];else if(t==="BR"||t==="RB")return[-1,-1];else return[-1,1]},"getArchitectureDirectionXYFactors"),$t=e(function(t,n){if(ft(t,n))return"bend";else if(Re(t))return"horizontal";return"vertical"},"getArchitectureDirectionAlignment"),Pt=e(function(t){return t.type==="service"},"isArchitectureService"),Ot=e(function(t){return t.type==="junction"},"isArchitectureJunction"),pt=e((t,n)=>{let[l,w]=[t,n].sort();return`${JSON.stringify(l)}-${JSON.stringify(w)}`},"architectureGroupAlignmentKey"),yt=e((t)=>t.data(),"edgeData"),Qe=e((t)=>t.data(),"nodeData"),Gt=D.architecture,Et=class{constructor(){this.nodes=new Map,this.groups=new Map,this.edges=[],this.layoutHints=[],this.registeredIds=new Map,this.elements=new Map,this.diagramId="",this.setAccTitle=S,this.getAccTitle=E,this.setDiagramTitle=I,this.getDiagramTitle=L,this.getAccDescription=A,this.setAccDescription=T,this.clear()}static{e(this,"ArchitectureDB")}setDiagramId(t){this.diagramId=t}getDiagramId(){return this.diagramId}clear(){this.nodes=new Map,this.groups=new Map,this.edges=[],this.layoutHints=[],this.registeredIds=new Map,this.dataStructures=void 0,this.elements=new Map,this.diagramId="",C()}addService({id:t,icon:n,in:l,title:w,iconText:m}){if(this.registeredIds.has(t))throw Error(`The service id [${t}] is already in use by another ${this.registeredIds.get(t)}`);if(l!==void 0){if(t===l)throw Error(`The service [${t}] cannot be placed within itself`);if(!this.registeredIds.has(l))throw Error(`The service [${t}]'s parent does not exist. Please make sure the parent is created before this service`);if(this.registeredIds.get(l)==="node")throw Error(`The service [${t}]'s parent is not a group`)}this.registeredIds.set(t,"node"),this.nodes.set(t,{id:t,type:"service",icon:n,iconText:m,title:w,edges:[],in:l})}getServices(){return[...this.nodes.values()].filter(Pt)}addJunction({id:t,in:n}){if(this.registeredIds.has(t))throw Error(`The junction id [${t}] is already in use by another ${this.registeredIds.get(t)}`);if(n!==void 0){if(t===n)throw Error(`The junction [${t}] cannot be placed within itself`);if(!this.registeredIds.has(n))throw Error(`The junction [${t}]'s parent does not exist. Please make sure the parent is created before this junction`);if(this.registeredIds.get(n)==="node")throw Error(`The junction [${t}]'s parent is not a group`)}this.registeredIds.set(t,"node"),this.nodes.set(t,{id:t,type:"junction",edges:[],in:n})}getJunctions(){return[...this.nodes.values()].filter(Ot)}getNodes(){return[...this.nodes.values()]}getNode(t){return this.nodes.get(t)??null}addGroup({id:t,icon:n,in:l,title:w}){if(this.registeredIds.has(t))throw Error(`The group id [${t}] is already in use by another ${this.registeredIds.get(t)}`);if(l!==void 0){if(t===l)throw Error(`The group [${t}] cannot be placed within itself`);if(!this.registeredIds.has(l))throw Error(`The group [${t}]'s parent does not exist. Please make sure the parent is created before this group`);if(this.registeredIds.get(l)==="node")throw Error(`The group [${t}]'s parent is not a group`)}this.registeredIds.set(t,"group"),this.groups.set(t,{id:t,icon:n,title:w,in:l})}getGroups(){return[...this.groups.values()]}addEdge({lhsId:t,rhsId:n,lhsDir:l,rhsDir:w,lhsInto:m,rhsInto:k,lhsGroup:z,rhsGroup:v,title:N}){if(!vt(l))throw Error(`Invalid direction given for left hand side of edge ${t}--${n}. Expected (L,R,T,B) got ${String(l)}`);if(!vt(w))throw Error(`Invalid direction given for right hand side of edge ${t}--${n}. Expected (L,R,T,B) got ${String(w)}`);if(!this.nodes.has(t)&&!this.groups.has(t))throw Error(`The left-hand id [${t}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(!this.nodes.has(n)&&!this.groups.has(n))throw Error(`The right-hand id [${n}] does not yet exist. Please create the service/group before declaring an edge to it.`);let c=this.nodes.get(t).in,y=this.nodes.get(n).in;if(z&&c&&y&&c==y)throw Error(`The left-hand id [${t}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(v&&c&&y&&c==y)throw Error(`The right-hand id [${n}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);let d={lhsId:t,lhsDir:l,lhsInto:m,lhsGroup:z,rhsId:n,rhsDir:w,rhsInto:k,rhsGroup:v,title:N};this.edges.push(d);let f=this.nodes.get(t),u=this.nodes.get(n);if(f&&u)f.edges.push(this.edges[this.edges.length-1]),u.edges.push(this.edges[this.edges.length-1])}getEdges(){return this.edges}addLayoutHint(t){if(t.members.length<2)throw Error(`An align directive requires at least two members; got ${t.members.length}`);let n=new Set;t.members.forEach((l)=>{if(this.registeredIds.get(l)!=="node")throw Error(`align ${t.direction} references [${l}], which is not a service or junction`);if(n.has(l))throw Error(`align ${t.direction} lists [${l}] more than once`);n.add(l)}),this.layoutHints.push(t)}getLayoutHints(){return this.layoutHints}getDataStructures(){if(this.dataStructures===void 0){let t=new Map,n=new Map;for(let[z,v]of this.nodes.entries()){let N=new Map;for(let c of v.edges){let y=this.getNode(c.lhsId)?.in,d=this.getNode(c.rhsId)?.in;if(y&&d&&y!==d){let f=$t(c.lhsDir,c.rhsDir);if(f!=="bend")t.set(pt(y,d),f)}if(c.lhsId===z){let f=ct(c.lhsDir,c.rhsDir);if(f)N.set(f,c.rhsId)}else{let f=ct(c.rhsDir,c.lhsDir);if(f)N.set(f,c.lhsId)}}n.set(z,N)}let l=new Set,w=new Set(n.keys()),m=e((z)=>{let v=new Map([[z,[0,0]]]),N=[z];while(N.length>0){let c=N.shift();if(c){l.add(c),w.delete(c);let y=n.get(c);if(!y)throw Error(`BFS error: adjacency list for id ${c} not found. Please report this as a bug.`);let d=v.get(c);if(!d)throw Error(`BFS error: position for id ${c} not found in spatial map. Please report this as a bug.`);let[f,u]=d;y.forEach((g,i)=>{if(!l.has(g))v.set(g,Mt([f,u],i)),N.push(g)})}}return v},"BFS"),k=[];while(w.size>0){let z=w.values().next().value;k.push(m(z))}this.dataStructures={adjList:n,spatialMaps:k,groupAlignments:t}}return this.dataStructures}setElementForId(t,n){this.elements.set(t,n)}getElementById(t){return this.elements.get(t)}getConfig(){return U({...Gt,...b().architecture})}getConfigField(t){return this.getConfig()[t]}},zt=e((t,n)=>{W(t,n),t.groups.map((l)=>n.addGroup(l)),t.services.map((l)=>n.addService({...l,type:"service"})),t.junctions.map((l)=>n.addJunction({...l,type:"junction"})),t.edges.map((l)=>n.addEdge(l)),t.alignments?.map((l)=>n.addLayoutHint({direction:l.direction,members:[...l.members]}))},"populateDb"),wt={parser:{yy:void 0},parse:e(async(t)=>{let n=await X("architecture",t);r.debug(n);let l=wt.parser?.yy;if(!(l instanceof Et))throw Error("parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");zt(n,l)},"parse")},Bt=e((t)=>`
1
+ import{W}from"./chunk-y56aaba5.js";import{e,r,D,b,O,mt,C,S,E,T,A,I,L,s,p,V,Bi,In,nt,U,Fe,Ie}from"./chunk-wvdehm9y.js";import{X}from"./chunk-aqfpnhmt.js";import{lt,sr}from"./chunk-3re8y26v.js";import{Ce,Se}from"./chunk-4bzqrwr0.js";var ut=Se(function(rt,st){(function(n,l){if(typeof rt==="object"&&typeof st==="object")st.exports=l(sr());else if(typeof define==="function"&&define.amd)define(["cose-base"],l);else if(typeof rt==="object")rt.cytoscapeFcose=l(sr());else n.cytoscapeFcose=l(n.coseBase)})(rt,function(t){return(()=>{var n={658:(k)=>{k.exports=Object.assign!=null?Object.assign.bind(Object):function(z){for(var v=arguments.length,N=Array(v>1?v-1:0),c=1;c<v;c++)N[c-1]=arguments[c];return N.forEach(function(y){Object.keys(y).forEach(function(d){return z[d]=y[d]})}),z}},548:(k,z,v)=>{var N=function(){function d(f,u){var g=[],i=!0,B=!1,F=void 0;try{for(var o=f[Symbol.iterator](),h;!(i=(h=o.next()).done);i=!0)if(g.push(h.value),u&&g.length===u)break}catch(R){B=!0,F=R}finally{try{if(!i&&o.return)o.return()}finally{if(B)throw F}}return g}return function(f,u){if(Array.isArray(f))return f;else if(Symbol.iterator in Object(f))return d(f,u);else throw TypeError("Invalid attempt to destructure non-iterable instance")}}(),c=v(140).layoutBase.LinkedList,y={};y.getTopMostNodes=function(d){var f={};for(var u=0;u<d.length;u++)f[d[u].id()]=!0;var g=d.filter(function(i,B){if(typeof i==="number")i=B;var F=i.parent()[0];while(F!=null){if(f[F.id()])return!1;F=F.parent()[0]}return!0});return g},y.connectComponents=function(d,f,u,g){var i=new c,B=new Set,F=[],o=void 0,h=void 0,R=void 0,a=!1,P=1,H=[],M=[],j=function(){var x=d.collection();M.push(x);var Y=u[0],Z=d.collection();Z.merge(Y).merge(Y.descendants().intersection(f)),F.push(Y),Z.forEach(function(re){i.push(re),B.add(re),x.merge(re)});var Q=function(){Y=i.shift();var ue=d.collection();Y.neighborhood().nodes().forEach(function(q){if(f.intersection(Y.edgesWith(q)).length>0)ue.merge(q)});for(var Ae=0;Ae<ue.length;Ae++){var Pe=ue[Ae];if(o=u.intersection(Pe.union(Pe.ancestors())),o!=null&&!B.has(o[0])){var de=o.union(o.descendants());de.forEach(function(q){if(i.push(q),B.add(q),x.merge(q),u.has(q))F.push(q)})}}};while(i.length!=0)Q();if(x.forEach(function(re){f.intersection(re.connectedEdges()).forEach(function(ue){if(x.has(ue.source())&&x.has(ue.target()))x.merge(ue)})}),F.length==u.length)a=!0;if(!a||a&&P>1){h=F[0],R=h.connectedEdges().length,F.forEach(function(re){if(re.connectedEdges().length<R)R=re.connectedEdges().length,h=re}),H.push(h.id());var se=d.collection();se.merge(F[0]),F.forEach(function(re){se.merge(re)}),F=[],u=u.difference(se),P++}};do j();while(!a);if(g){if(H.length>0)g.set("dummy"+(g.size+1),H)}return M},y.relocateComponent=function(d,f,u){if(!u.fixedNodeConstraint){var{POSITIVE_INFINITY:g,NEGATIVE_INFINITY:i,POSITIVE_INFINITY:B,NEGATIVE_INFINITY:F}=Number;if(u.quality=="draft"){var o=!0,h=!1,R=void 0;try{for(var a=f.nodeIndexes[Symbol.iterator](),P;!(o=(P=a.next()).done);o=!0){var H=P.value,M=N(H,2),j=M[0],_=M[1],x=u.cy.getElementById(j);if(x){var Y=x.boundingBox(),Z=f.xCoords[_]-Y.w/2,Q=f.xCoords[_]+Y.w/2,se=f.yCoords[_]-Y.h/2,re=f.yCoords[_]+Y.h/2;if(Z<g)g=Z;if(Q>i)i=Q;if(se<B)B=se;if(re>F)F=re}}}catch(q){h=!0,R=q}finally{try{if(!o&&a.return)a.return()}finally{if(h)throw R}}var ue=d.x-(i+g)/2,Ae=d.y-(F+B)/2;f.xCoords=f.xCoords.map(function(q){return q+ue}),f.yCoords=f.yCoords.map(function(q){return q+Ae})}else{Object.keys(f).forEach(function(q){var oe=f[q],Ne=oe.getRect().x,ke=oe.getRect().x+oe.getRect().width,De=oe.getRect().y,xe=oe.getRect().y+oe.getRect().height;if(Ne<g)g=Ne;if(ke>i)i=ke;if(De<B)B=De;if(xe>F)F=xe});var Pe=d.x-(i+g)/2,de=d.y-(F+B)/2;Object.keys(f).forEach(function(q){var oe=f[q];oe.setCenter(oe.getCenterX()+Pe,oe.getCenterY()+de)})}}},y.calcBoundingBox=function(d,f,u,g){var{MAX_SAFE_INTEGER:i,MIN_SAFE_INTEGER:B,MAX_SAFE_INTEGER:F,MIN_SAFE_INTEGER:o}=Number,h=void 0,R=void 0,a=void 0,P=void 0,H=d.descendants().not(":parent"),M=H.length;for(var j=0;j<M;j++){var _=H[j];if(h=f[g.get(_.id())]-_.width()/2,R=f[g.get(_.id())]+_.width()/2,a=u[g.get(_.id())]-_.height()/2,P=u[g.get(_.id())]+_.height()/2,i>h)i=h;if(B<R)B=R;if(F>a)F=a;if(o<P)o=P}var x={};return x.topLeftX=i,x.topLeftY=F,x.width=B-i,x.height=o-F,x},y.calcParentsWithoutChildren=function(d,f){var u=d.collection();return f.nodes(":parent").forEach(function(g){var i=!1;if(g.children().forEach(function(B){if(B.css("display")!="none")i=!0}),!i)u.merge(g)}),u},k.exports=y},816:(k,z,v)=>{var N=v(548),c=v(140).CoSELayout,y=v(140).CoSENode,d=v(140).layoutBase.PointD,f=v(140).layoutBase.DimensionD,u=v(140).layoutBase.LayoutConstants,g=v(140).layoutBase.FDLayoutConstants,i=v(140).CoSEConstants,B=function(o,h){var{cy:R,eles:a}=o,P=a.nodes(),H=a.edges(),M=void 0,j=void 0,_=void 0,x={};if(o.randomize)M=h.nodeIndexes,j=h.xCoords,_=h.yCoords;var Y=function(q){return typeof q==="function"},Z=function(q,oe){if(Y(q))return q(oe);else return q},Q=N.calcParentsWithoutChildren(R,a),se=function de(q,oe,Ne,ke){var De=oe.length;for(var xe=0;xe<De;xe++){var J=oe[xe],Te=null;if(J.intersection(Q).length==0)Te=J.children();var ie=void 0,ve=J.layoutDimensions({nodeDimensionsIncludeLabels:ke.nodeDimensionsIncludeLabels});if(J.outerWidth()!=null&&J.outerHeight()!=null)if(ke.randomize)if(!J.isParent())ie=q.add(new y(Ne.graphManager,new d(j[M.get(J.id())]-ve.w/2,_[M.get(J.id())]-ve.h/2),new f(parseFloat(ve.w),parseFloat(ve.h))));else{var Me=N.calcBoundingBox(J,j,_,M);if(J.intersection(Q).length==0)ie=q.add(new y(Ne.graphManager,new d(Me.topLeftX,Me.topLeftY),new f(Me.width,Me.height)));else ie=q.add(new y(Ne.graphManager,new d(Me.topLeftX,Me.topLeftY),new f(parseFloat(ve.w),parseFloat(ve.h))))}else ie=q.add(new y(Ne.graphManager,new d(J.position("x")-ve.w/2,J.position("y")-ve.h/2),new f(parseFloat(ve.w),parseFloat(ve.h))));else ie=q.add(new y(this.graphManager));if(ie.id=J.data("id"),ie.nodeRepulsion=Z(ke.nodeRepulsion,J),ie.paddingLeft=parseInt(J.css("padding")),ie.paddingTop=parseInt(J.css("padding")),ie.paddingRight=parseInt(J.css("padding")),ie.paddingBottom=parseInt(J.css("padding")),ke.nodeDimensionsIncludeLabels)ie.labelWidth=J.boundingBox({includeLabels:!0,includeNodes:!1,includeOverlays:!1}).w,ie.labelHeight=J.boundingBox({includeLabels:!0,includeNodes:!1,includeOverlays:!1}).h,ie.labelPosVertical=J.css("text-valign"),ie.labelPosHorizontal=J.css("text-halign");if(x[J.data("id")]=ie,isNaN(ie.rect.x))ie.rect.x=0;if(isNaN(ie.rect.y))ie.rect.y=0;if(Te!=null&&Te.length>0){var ze=void 0;ze=Ne.getGraphManager().add(Ne.newGraph(),ie),de(ze,Te,Ne,ke)}}},re=function(q,oe,Ne){var ke=0,De=0;for(var xe=0;xe<Ne.length;xe++){var J=Ne[xe],Te=x[J.data("source")],ie=x[J.data("target")];if(Te&&ie&&Te!==ie&&Te.getEdgesBetween(ie).length==0){var ve=oe.add(q.newEdge(),Te,ie);ve.id=J.id(),ve.idealLength=Z(o.idealEdgeLength,J),ve.edgeElasticity=Z(o.edgeElasticity,J),ke+=ve.idealLength,De++}}if(o.idealEdgeLength!=null){if(De>0)i.DEFAULT_EDGE_LENGTH=g.DEFAULT_EDGE_LENGTH=ke/De;else if(!Y(o.idealEdgeLength))i.DEFAULT_EDGE_LENGTH=g.DEFAULT_EDGE_LENGTH=o.idealEdgeLength;else i.DEFAULT_EDGE_LENGTH=g.DEFAULT_EDGE_LENGTH=50;i.MIN_REPULSION_DIST=g.MIN_REPULSION_DIST=g.DEFAULT_EDGE_LENGTH/10,i.DEFAULT_RADIAL_SEPARATION=g.DEFAULT_EDGE_LENGTH}},ue=function(q,oe){if(oe.fixedNodeConstraint)q.constraints.fixedNodeConstraint=oe.fixedNodeConstraint;if(oe.alignmentConstraint)q.constraints.alignmentConstraint=oe.alignmentConstraint;if(oe.relativePlacementConstraint)q.constraints.relativePlacementConstraint=oe.relativePlacementConstraint};if(o.nestingFactor!=null)i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=g.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=o.nestingFactor;if(o.gravity!=null)i.DEFAULT_GRAVITY_STRENGTH=g.DEFAULT_GRAVITY_STRENGTH=o.gravity;if(o.numIter!=null)i.MAX_ITERATIONS=g.MAX_ITERATIONS=o.numIter;if(o.gravityRange!=null)i.DEFAULT_GRAVITY_RANGE_FACTOR=g.DEFAULT_GRAVITY_RANGE_FACTOR=o.gravityRange;if(o.gravityCompound!=null)i.DEFAULT_COMPOUND_GRAVITY_STRENGTH=g.DEFAULT_COMPOUND_GRAVITY_STRENGTH=o.gravityCompound;if(o.gravityRangeCompound!=null)i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=g.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=o.gravityRangeCompound;if(o.initialEnergyOnIncremental!=null)i.DEFAULT_COOLING_FACTOR_INCREMENTAL=g.DEFAULT_COOLING_FACTOR_INCREMENTAL=o.initialEnergyOnIncremental;if(o.tilingCompareBy!=null)i.TILING_COMPARE_BY=o.tilingCompareBy;if(o.quality=="proof")u.QUALITY=2;else u.QUALITY=0;if(i.NODE_DIMENSIONS_INCLUDE_LABELS=g.NODE_DIMENSIONS_INCLUDE_LABELS=u.NODE_DIMENSIONS_INCLUDE_LABELS=o.nodeDimensionsIncludeLabels,i.DEFAULT_INCREMENTAL=g.DEFAULT_INCREMENTAL=u.DEFAULT_INCREMENTAL=!o.randomize,i.ANIMATE=g.ANIMATE=u.ANIMATE=o.animate,i.TILE=o.tile,i.TILING_PADDING_VERTICAL=typeof o.tilingPaddingVertical==="function"?o.tilingPaddingVertical.call():o.tilingPaddingVertical,i.TILING_PADDING_HORIZONTAL=typeof o.tilingPaddingHorizontal==="function"?o.tilingPaddingHorizontal.call():o.tilingPaddingHorizontal,i.DEFAULT_INCREMENTAL=g.DEFAULT_INCREMENTAL=u.DEFAULT_INCREMENTAL=!0,i.PURE_INCREMENTAL=!o.randomize,u.DEFAULT_UNIFORM_LEAF_NODE_SIZES=o.uniformNodeDimensions,o.step=="transformed")i.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,i.ENFORCE_CONSTRAINTS=!1,i.APPLY_LAYOUT=!1;if(o.step=="enforced")i.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,i.ENFORCE_CONSTRAINTS=!0,i.APPLY_LAYOUT=!1;if(o.step=="cose")i.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,i.ENFORCE_CONSTRAINTS=!1,i.APPLY_LAYOUT=!0;if(o.step=="all"){if(o.randomize)i.TRANSFORM_ON_CONSTRAINT_HANDLING=!0;else i.TRANSFORM_ON_CONSTRAINT_HANDLING=!1;i.ENFORCE_CONSTRAINTS=!0,i.APPLY_LAYOUT=!0}if(o.fixedNodeConstraint||o.alignmentConstraint||o.relativePlacementConstraint)i.TREE_REDUCTION_ON_INCREMENTAL=!1;else i.TREE_REDUCTION_ON_INCREMENTAL=!0;var Ae=new c,Pe=Ae.newGraphManager();return se(Pe.addRoot(),N.getTopMostNodes(P),Ae,o),re(Ae,Pe,H),ue(Ae,o),Ae.runLayout(),x};k.exports={coseLayout:B}},212:(k,z,v)=>{var N=function(){function o(h,R){for(var a=0;a<R.length;a++){var P=R[a];if(P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P)P.writable=!0;Object.defineProperty(h,P.key,P)}}return function(h,R,a){if(R)o(h.prototype,R);if(a)o(h,a);return h}}();function c(o,h){if(!(o instanceof h))throw TypeError("Cannot call a class as a function")}var y=v(658),d=v(548),f=v(657),u=f.spectralLayout,g=v(816),i=g.coseLayout,B=Object.freeze({quality:"default",randomize:!0,animate:!0,animationDuration:1000,animationEasing:void 0,fit:!0,padding:30,nodeDimensionsIncludeLabels:!1,uniformNodeDimensions:!1,packComponents:!0,step:"all",samplingType:!0,sampleSize:25,nodeSeparation:75,piTol:0.0000001,nodeRepulsion:function(h){return 4500},idealEdgeLength:function(h){return 50},edgeElasticity:function(h){return 0.45},nestingFactor:0.1,gravity:0.25,numIter:2500,tile:!0,tilingCompareBy:void 0,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:0.3,fixedNodeConstraint:void 0,alignmentConstraint:void 0,relativePlacementConstraint:void 0,ready:function(){},stop:function(){}}),F=function(){function o(h){c(this,o),this.options=y({},B,h)}return N(o,[{key:"run",value:function(){var R=this,a=this.options,{cy:P,eles:H}=a,M=[],j=void 0,_=void 0,x=[],Y=void 0,Z=[];if(a.fixedNodeConstraint&&(!Array.isArray(a.fixedNodeConstraint)||a.fixedNodeConstraint.length==0))a.fixedNodeConstraint=void 0;if(a.alignmentConstraint){if(a.alignmentConstraint.vertical&&(!Array.isArray(a.alignmentConstraint.vertical)||a.alignmentConstraint.vertical.length==0))a.alignmentConstraint.vertical=void 0;if(a.alignmentConstraint.horizontal&&(!Array.isArray(a.alignmentConstraint.horizontal)||a.alignmentConstraint.horizontal.length==0))a.alignmentConstraint.horizontal=void 0}if(a.relativePlacementConstraint&&(!Array.isArray(a.relativePlacementConstraint)||a.relativePlacementConstraint.length==0))a.relativePlacementConstraint=void 0;var Q=a.fixedNodeConstraint||a.alignmentConstraint||a.relativePlacementConstraint;if(Q)a.tile=!1,a.packComponents=!1;var se=void 0,re=!1;if(P.layoutUtilities&&a.packComponents){if(se=P.layoutUtilities("get"),!se)se=P.layoutUtilities();re=!0}if(H.nodes().length>0)if(!re){var ue=a.eles.boundingBox();if(Z.push({x:ue.x1+ue.w/2,y:ue.y1+ue.h/2}),a.randomize){var Ae=u(a);M.push(Ae)}if(a.quality=="default"||a.quality=="proof")x.push(i(a,M[0])),d.relocateComponent(Z[0],x[0],a);else d.relocateComponent(Z[0],M[0],a)}else{var Pe=d.getTopMostNodes(a.eles.nodes());if(Y=d.connectComponents(P,a.eles,Pe),Y.forEach(function(K){var G=K.boundingBox();Z.push({x:G.x1+G.w/2,y:G.y1+G.h/2})}),a.randomize)Y.forEach(function(K){a.eles=K,M.push(u(a))});if(a.quality=="default"||a.quality=="proof"){var de=P.collection();if(a.tile){var q=new Map,oe=[],Ne=[],ke=0,De={nodeIndexes:q,xCoords:oe,yCoords:Ne},xe=[];if(Y.forEach(function(K,G){if(K.edges().length==0)K.nodes().forEach(function(pe,le){if(de.merge(K.nodes()[le]),!pe.isParent())De.nodeIndexes.set(K.nodes()[le].id(),ke++),De.xCoords.push(K.nodes()[0].position().x),De.yCoords.push(K.nodes()[0].position().y)}),xe.push(G)}),de.length>1){var J=de.boundingBox();Z.push({x:J.x1+J.w/2,y:J.y1+J.h/2}),Y.push(de),M.push(De);for(var Te=xe.length-1;Te>=0;Te--)Y.splice(xe[Te],1),M.splice(xe[Te],1),Z.splice(xe[Te],1)}}Y.forEach(function(K,G){a.eles=K,x.push(i(a,M[G])),d.relocateComponent(Z[G],x[G],a)})}else Y.forEach(function(K,G){d.relocateComponent(Z[G],M[G],a)});var ie=new Set;if(Y.length>1){var ve=[],Me=H.filter(function(K){return K.css("display")=="none"});Y.forEach(function(K,G){var pe=void 0;if(a.quality=="draft")pe=M[G].nodeIndexes;if(K.nodes().not(Me).length>0){var le={};le.edges=[],le.nodes=[];var me=void 0;if(K.nodes().not(Me).forEach(function(fe){if(a.quality=="draft")if(!fe.isParent())me=pe.get(fe.id()),le.nodes.push({x:M[G].xCoords[me]-fe.boundingbox().w/2,y:M[G].yCoords[me]-fe.boundingbox().h/2,width:fe.boundingbox().w,height:fe.boundingbox().h});else{var he=d.calcBoundingBox(fe,M[G].xCoords,M[G].yCoords,pe);le.nodes.push({x:he.topLeftX,y:he.topLeftY,width:he.width,height:he.height})}else if(x[G][fe.id()])le.nodes.push({x:x[G][fe.id()].getLeft(),y:x[G][fe.id()].getTop(),width:x[G][fe.id()].getWidth(),height:x[G][fe.id()].getHeight()})}),K.edges().forEach(function(fe){var he=fe.source(),Ee=fe.target();if(he.css("display")!="none"&&Ee.css("display")!="none"){if(a.quality=="draft"){var Be=pe.get(he.id()),et=pe.get(Ee.id()),Oe=[],Ye=[];if(he.isParent()){var We=d.calcBoundingBox(he,M[G].xCoords,M[G].yCoords,pe);Oe.push(We.topLeftX+We.width/2),Oe.push(We.topLeftY+We.height/2)}else Oe.push(M[G].xCoords[Be]),Oe.push(M[G].yCoords[Be]);if(Ee.isParent()){var Je=d.calcBoundingBox(Ee,M[G].xCoords,M[G].yCoords,pe);Ye.push(Je.topLeftX+Je.width/2),Ye.push(Je.topLeftY+Je.height/2)}else Ye.push(M[G].xCoords[et]),Ye.push(M[G].yCoords[et]);le.edges.push({startX:Oe[0],startY:Oe[1],endX:Ye[0],endY:Ye[1]})}else if(x[G][he.id()]&&x[G][Ee.id()])le.edges.push({startX:x[G][he.id()].getCenterX(),startY:x[G][he.id()].getCenterY(),endX:x[G][Ee.id()].getCenterX(),endY:x[G][Ee.id()].getCenterY()})}}),le.nodes.length>0)ve.push(le),ie.add(G)}});var ze=se.packComponents(ve,a.randomize).shifts;if(a.quality=="draft")M.forEach(function(K,G){var pe=K.xCoords.map(function(me){return me+ze[G].dx}),le=K.yCoords.map(function(me){return me+ze[G].dy});K.xCoords=pe,K.yCoords=le});else{var Ke=0;ie.forEach(function(K){Object.keys(x[K]).forEach(function(G){var pe=x[K][G];pe.setCenter(pe.getCenterX()+ze[Ke].dx,pe.getCenterY()+ze[Ke].dy)}),Ke++})}}}var je=function(G,pe){if(a.quality=="default"||a.quality=="proof"){if(typeof G==="number")G=pe;var le=void 0,me=void 0,fe=G.data("id");if(x.forEach(function(Ee){if(fe in Ee)le={x:Ee[fe].getRect().getCenterX(),y:Ee[fe].getRect().getCenterY()},me=Ee[fe]}),a.nodeDimensionsIncludeLabels){if(me.labelWidth){if(me.labelPosHorizontal=="left")le.x+=me.labelWidth/2;else if(me.labelPosHorizontal=="right")le.x-=me.labelWidth/2}if(me.labelHeight){if(me.labelPosVertical=="top")le.y+=me.labelHeight/2;else if(me.labelPosVertical=="bottom")le.y-=me.labelHeight/2}}if(le==null)le={x:G.position("x"),y:G.position("y")};return{x:le.x,y:le.y}}else{var he=void 0;if(M.forEach(function(Ee){var Be=Ee.nodeIndexes.get(G.id());if(Be!=null)he={x:Ee.xCoords[Be],y:Ee.yCoords[Be]}}),he==null)he={x:G.position("x"),y:G.position("y")};return{x:he.x,y:he.y}}};if(a.quality=="default"||a.quality=="proof"||a.randomize){var at=d.calcParentsWithoutChildren(P,H),qe=H.filter(function(K){return K.css("display")=="none"});if(a.eles=H.not(qe),H.nodes().not(":parent").not(qe).layoutPositions(R,a,je),at.length>0)at.forEach(function(K){K.position(je(K))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),o}();k.exports=F},657:(k,z,v)=>{var N=v(548),c=v(140).layoutBase.Matrix,y=v(140).layoutBase.SVD,d=function(u){var{cy:g,eles:i}=u,B=i.nodes(),F=i.nodes(":parent"),o=new Map,h=new Map,R=new Map,a=[],P=[],H=[],M=[],j=[],_=[],x=[],Y=[],Z=void 0,Q=void 0,se=1e8,re=0.000000001,{piTol:ue,samplingType:Ae,nodeSeparation:Pe}=u,de=void 0,q=function(){var ee=0,te=0,ne=!1;while(te<de){ee=Math.floor(Math.random()*Q),ne=!1;for(var ae=0;ae<te;ae++)if(M[ae]==ee){ne=!0;break}if(!ne)M[te]=ee,te++;else continue}},oe=function(ee,te,ne){var ae=[],we=0,ge=0,ce=0,Le=void 0,be=[],$e=0,_e=1;for(var Ue=0;Ue<Q;Ue++)be[Ue]=se;ae[ge]=ee,be[ee]=0;while(ge>=we){ce=ae[we++];var Xe=a[ce];for(var He=0;He<Xe.length;He++)if(Le=h.get(Xe[He]),be[Le]==se)be[Le]=be[ce]+1,ae[++ge]=Le;_[ce][te]=be[ce]*Pe}if(ne){for(var Ge=0;Ge<Q;Ge++)if(_[Ge][te]<j[Ge])j[Ge]=_[Ge][te];for(var tt=0;tt<Q;tt++)if(j[tt]>$e)$e=j[tt],_e=tt}return _e},Ne=function(ee){var te=void 0;if(!ee){q();for(var ne=0;ne<de;ne++)oe(M[ne],ne,ee,!1)}else{te=Math.floor(Math.random()*Q),Z=te;for(var ae=0;ae<Q;ae++)j[ae]=se;for(var we=0;we<de;we++)M[we]=te,te=oe(te,we,ee)}for(var ge=0;ge<Q;ge++)for(var ce=0;ce<de;ce++)_[ge][ce]*=_[ge][ce];for(var Le=0;Le<de;Le++)x[Le]=[];for(var be=0;be<de;be++)for(var $e=0;$e<de;$e++)x[be][$e]=_[M[$e]][be]},ke=function(){var ee=y.svd(x),{S:te,U:ne,V:ae}=ee,we=te[0]*te[0]*te[0],ge=[];for(var ce=0;ce<de;ce++){ge[ce]=[];for(var Le=0;Le<de;Le++)if(ge[ce][Le]=0,ce==Le)ge[ce][Le]=te[ce]/(te[ce]*te[ce]+we/(te[ce]*te[ce]))}Y=c.multMat(c.multMat(ae,ge),c.transpose(ne))},De=function(){var ee=void 0,te=void 0,ne=[],ae=[],we=[],ge=[];for(var ce=0;ce<Q;ce++)ne[ce]=Math.random(),ae[ce]=Math.random();ne=c.normalize(ne),ae=c.normalize(ae);var Le=0,be=re,$e=re,_e=void 0;while(!0){Le++;for(var Ue=0;Ue<Q;Ue++)we[Ue]=ne[Ue];if(ne=c.multGamma(c.multL(c.multGamma(we),_,Y)),ee=c.dotProduct(we,ne),ne=c.normalize(ne),be=c.dotProduct(we,ne),_e=Math.abs(be/$e),_e<=1+ue&&_e>=1)break;$e=be}for(var Xe=0;Xe<Q;Xe++)we[Xe]=ne[Xe];Le=0,$e=re;while(!0){Le++;for(var He=0;He<Q;He++)ge[He]=ae[He];if(ge=c.minusOp(ge,c.multCons(we,c.dotProduct(we,ge))),ae=c.multGamma(c.multL(c.multGamma(ge),_,Y)),te=c.dotProduct(ge,ae),ae=c.normalize(ae),be=c.dotProduct(ge,ae),_e=Math.abs(be/$e),_e<=1+ue&&_e>=1)break;$e=be}for(var Ge=0;Ge<Q;Ge++)ge[Ge]=ae[Ge];P=c.multCons(we,Math.sqrt(Math.abs(ee))),H=c.multCons(ge,Math.sqrt(Math.abs(te)))};N.connectComponents(g,i,N.getTopMostNodes(B),o),F.forEach(function(ye){N.connectComponents(g,i,N.getTopMostNodes(ye.descendants().intersection(i)),o)});var xe=0;for(var J=0;J<B.length;J++)if(!B[J].isParent())h.set(B[J].id(),xe++);var Te=!0,ie=!1,ve=void 0;try{for(var Me=o.keys()[Symbol.iterator](),ze;!(Te=(ze=Me.next()).done);Te=!0){var Ke=ze.value;h.set(Ke,xe++)}}catch(ye){ie=!0,ve=ye}finally{try{if(!Te&&Me.return)Me.return()}finally{if(ie)throw ve}}for(var je=0;je<h.size;je++)a[je]=[];F.forEach(function(ye){var ee=ye.children().intersection(i);while(ee.nodes(":childless").length==0)ee=ee.nodes()[0].children().intersection(i);var te=0,ne=ee.nodes(":childless")[0].connectedEdges().length;ee.nodes(":childless").forEach(function(ae,we){if(ae.connectedEdges().length<ne)ne=ae.connectedEdges().length,te=we}),R.set(ye.id(),ee.nodes(":childless")[te].id())}),B.forEach(function(ye){var ee=void 0;if(ye.isParent())ee=h.get(R.get(ye.id()));else ee=h.get(ye.id());ye.neighborhood().nodes().forEach(function(te){if(i.intersection(ye.edgesWith(te)).length>0)if(te.isParent())a[ee].push(R.get(te.id()));else a[ee].push(te.id())})});var at=function(ee){var te=h.get(ee),ne=void 0;o.get(ee).forEach(function(ae){if(g.getElementById(ae).isParent())ne=R.get(ae);else ne=ae;a[te].push(ne),a[h.get(ne)].push(ee)})},qe=!0,K=!1,G=void 0;try{for(var pe=o.keys()[Symbol.iterator](),le;!(qe=(le=pe.next()).done);qe=!0){var me=le.value;at(me)}}catch(ye){K=!0,G=ye}finally{try{if(!qe&&pe.return)pe.return()}finally{if(K)throw G}}Q=h.size;var fe=void 0;if(Q>2){de=Q<u.sampleSize?Q:u.sampleSize;for(var he=0;he<Q;he++)_[he]=[];for(var Ee=0;Ee<de;Ee++)Y[Ee]=[];if(u.quality=="draft"||u.step=="all")Ne(Ae),ke(),De(),fe={nodeIndexes:h,xCoords:P,yCoords:H};else h.forEach(function(ye,ee){P.push(g.getElementById(ee).position("x")),H.push(g.getElementById(ee).position("y"))}),fe={nodeIndexes:h,xCoords:P,yCoords:H};return fe}else{var Be=h.keys(),et=g.getElementById(Be.next().value),Oe=et.position(),Ye=et.outerWidth();if(P.push(Oe.x),H.push(Oe.y),Q==2){var We=g.getElementById(Be.next().value),Je=We.outerWidth();P.push(Oe.x+Ye/2+Je/2+u.idealEdgeLength),H.push(Oe.y)}return fe={nodeIndexes:h,xCoords:P,yCoords:H},fe}};k.exports={spectralLayout:d}},579:(k,z,v)=>{var N=v(212),c=function(d){if(!d)return;d("layout","fcose",N)};if(typeof cytoscape<"u")c(cytoscape);k.exports=c},140:(k)=>{k.exports=t}},l={};function w(k){var z=l[k];if(z!==void 0)return z.exports;var v=l[k]={exports:{}};return n[k](v,v.exports,w),v.exports}var m=w(579);return m})()})});var xt=Ce(ut(),1);var gt={L:"left",R:"right",T:"top",B:"bottom"},ht={L:e((t)=>`${t},${t/2} 0,${t} 0,0`,"L"),R:e((t)=>`0,${t/2} ${t},0 ${t},${t}`,"R"),T:e((t)=>`0,0 ${t},0 ${t/2},${t}`,"T"),B:e((t)=>`${t/2},0 ${t},${t} 0,${t}`,"B")},ot={L:e((t,n)=>t-n+2,"L"),R:e((t,n)=>t-2,"R"),T:e((t,n)=>t-n+2,"T"),B:e((t,n)=>t-2,"B")},kt=e(function(t){if(Re(t))return t==="L"?"R":"L";else return t==="T"?"B":"T"},"getOppositeArchitectureDirection"),vt=e(function(t){let n=t;return n==="L"||n==="R"||n==="T"||n==="B"},"isArchitectureDirection"),Re=e(function(t){let n=t;return n==="L"||n==="R"},"isArchitectureDirectionX"),Ve=e(function(t){let n=t;return n==="T"||n==="B"},"isArchitectureDirectionY"),ft=e(function(t,n){let l=Re(t)&&Ve(n),w=Ve(t)&&Re(n);return l||w},"isArchitectureDirectionXY"),Dt=e(function(t){let n=t[0],l=t[1],w=Re(n)&&Ve(l),m=Ve(n)&&Re(l);return w||m},"isArchitecturePairXY"),Rt=e(function(t){return t!=="LL"&&t!=="RR"&&t!=="TT"&&t!=="BB"},"isValidArchitectureDirectionPair"),ct=e(function(t,n){let l=`${t}${n}`;return Rt(l)?l:void 0},"getArchitectureDirectionPair"),Mt=e(function([t,n],l){let w=l[0],m=l[1];if(Re(w))if(Ve(m))return[t+(w==="L"?-1:1),n+(m==="T"?1:-1)];else return[t+(w==="L"?-1:1),n];else if(Re(m))return[t+(m==="L"?1:-1),n+(w==="T"?1:-1)];else return[t,n+(w==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),Ft=e(function(t){if(t==="LT"||t==="TL")return[1,1];else if(t==="BL"||t==="LB")return[1,-1];else if(t==="BR"||t==="RB")return[-1,-1];else return[-1,1]},"getArchitectureDirectionXYFactors"),$t=e(function(t,n){if(ft(t,n))return"bend";else if(Re(t))return"horizontal";return"vertical"},"getArchitectureDirectionAlignment"),Pt=e(function(t){return t.type==="service"},"isArchitectureService"),Ot=e(function(t){return t.type==="junction"},"isArchitectureJunction"),pt=e((t,n)=>{let[l,w]=[t,n].sort();return`${JSON.stringify(l)}-${JSON.stringify(w)}`},"architectureGroupAlignmentKey"),yt=e((t)=>t.data(),"edgeData"),Qe=e((t)=>t.data(),"nodeData"),Gt=D.architecture,Et=class{constructor(){this.nodes=new Map,this.groups=new Map,this.edges=[],this.layoutHints=[],this.registeredIds=new Map,this.elements=new Map,this.diagramId="",this.setAccTitle=S,this.getAccTitle=E,this.setDiagramTitle=I,this.getDiagramTitle=L,this.getAccDescription=A,this.setAccDescription=T,this.clear()}static{e(this,"ArchitectureDB")}setDiagramId(t){this.diagramId=t}getDiagramId(){return this.diagramId}clear(){this.nodes=new Map,this.groups=new Map,this.edges=[],this.layoutHints=[],this.registeredIds=new Map,this.dataStructures=void 0,this.elements=new Map,this.diagramId="",C()}addService({id:t,icon:n,in:l,title:w,iconText:m}){if(this.registeredIds.has(t))throw Error(`The service id [${t}] is already in use by another ${this.registeredIds.get(t)}`);if(l!==void 0){if(t===l)throw Error(`The service [${t}] cannot be placed within itself`);if(!this.registeredIds.has(l))throw Error(`The service [${t}]'s parent does not exist. Please make sure the parent is created before this service`);if(this.registeredIds.get(l)==="node")throw Error(`The service [${t}]'s parent is not a group`)}this.registeredIds.set(t,"node"),this.nodes.set(t,{id:t,type:"service",icon:n,iconText:m,title:w,edges:[],in:l})}getServices(){return[...this.nodes.values()].filter(Pt)}addJunction({id:t,in:n}){if(this.registeredIds.has(t))throw Error(`The junction id [${t}] is already in use by another ${this.registeredIds.get(t)}`);if(n!==void 0){if(t===n)throw Error(`The junction [${t}] cannot be placed within itself`);if(!this.registeredIds.has(n))throw Error(`The junction [${t}]'s parent does not exist. Please make sure the parent is created before this junction`);if(this.registeredIds.get(n)==="node")throw Error(`The junction [${t}]'s parent is not a group`)}this.registeredIds.set(t,"node"),this.nodes.set(t,{id:t,type:"junction",edges:[],in:n})}getJunctions(){return[...this.nodes.values()].filter(Ot)}getNodes(){return[...this.nodes.values()]}getNode(t){return this.nodes.get(t)??null}addGroup({id:t,icon:n,in:l,title:w}){if(this.registeredIds.has(t))throw Error(`The group id [${t}] is already in use by another ${this.registeredIds.get(t)}`);if(l!==void 0){if(t===l)throw Error(`The group [${t}] cannot be placed within itself`);if(!this.registeredIds.has(l))throw Error(`The group [${t}]'s parent does not exist. Please make sure the parent is created before this group`);if(this.registeredIds.get(l)==="node")throw Error(`The group [${t}]'s parent is not a group`)}this.registeredIds.set(t,"group"),this.groups.set(t,{id:t,icon:n,title:w,in:l})}getGroups(){return[...this.groups.values()]}addEdge({lhsId:t,rhsId:n,lhsDir:l,rhsDir:w,lhsInto:m,rhsInto:k,lhsGroup:z,rhsGroup:v,title:N}){if(!vt(l))throw Error(`Invalid direction given for left hand side of edge ${t}--${n}. Expected (L,R,T,B) got ${String(l)}`);if(!vt(w))throw Error(`Invalid direction given for right hand side of edge ${t}--${n}. Expected (L,R,T,B) got ${String(w)}`);if(!this.nodes.has(t)&&!this.groups.has(t))throw Error(`The left-hand id [${t}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(!this.nodes.has(n)&&!this.groups.has(n))throw Error(`The right-hand id [${n}] does not yet exist. Please create the service/group before declaring an edge to it.`);let c=this.nodes.get(t).in,y=this.nodes.get(n).in;if(z&&c&&y&&c==y)throw Error(`The left-hand id [${t}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(v&&c&&y&&c==y)throw Error(`The right-hand id [${n}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);let d={lhsId:t,lhsDir:l,lhsInto:m,lhsGroup:z,rhsId:n,rhsDir:w,rhsInto:k,rhsGroup:v,title:N};this.edges.push(d);let f=this.nodes.get(t),u=this.nodes.get(n);if(f&&u)f.edges.push(this.edges[this.edges.length-1]),u.edges.push(this.edges[this.edges.length-1])}getEdges(){return this.edges}addLayoutHint(t){if(t.members.length<2)throw Error(`An align directive requires at least two members; got ${t.members.length}`);let n=new Set;t.members.forEach((l)=>{if(this.registeredIds.get(l)!=="node")throw Error(`align ${t.direction} references [${l}], which is not a service or junction`);if(n.has(l))throw Error(`align ${t.direction} lists [${l}] more than once`);n.add(l)}),this.layoutHints.push(t)}getLayoutHints(){return this.layoutHints}getDataStructures(){if(this.dataStructures===void 0){let t=new Map,n=new Map;for(let[z,v]of this.nodes.entries()){let N=new Map;for(let c of v.edges){let y=this.getNode(c.lhsId)?.in,d=this.getNode(c.rhsId)?.in;if(y&&d&&y!==d){let f=$t(c.lhsDir,c.rhsDir);if(f!=="bend")t.set(pt(y,d),f)}if(c.lhsId===z){let f=ct(c.lhsDir,c.rhsDir);if(f)N.set(f,c.rhsId)}else{let f=ct(c.rhsDir,c.lhsDir);if(f)N.set(f,c.lhsId)}}n.set(z,N)}let l=new Set,w=new Set(n.keys()),m=e((z)=>{let v=new Map([[z,[0,0]]]),N=[z];while(N.length>0){let c=N.shift();if(c){l.add(c),w.delete(c);let y=n.get(c);if(!y)throw Error(`BFS error: adjacency list for id ${c} not found. Please report this as a bug.`);let d=v.get(c);if(!d)throw Error(`BFS error: position for id ${c} not found in spatial map. Please report this as a bug.`);let[f,u]=d;y.forEach((g,i)=>{if(!l.has(g))v.set(g,Mt([f,u],i)),N.push(g)})}}return v},"BFS"),k=[];while(w.size>0){let z=w.values().next().value;k.push(m(z))}this.dataStructures={adjList:n,spatialMaps:k,groupAlignments:t}}return this.dataStructures}setElementForId(t,n){this.elements.set(t,n)}getElementById(t){return this.elements.get(t)}getConfig(){return U({...Gt,...b().architecture})}getConfigField(t){return this.getConfig()[t]}},zt=e((t,n)=>{W(t,n),t.groups.map((l)=>n.addGroup(l)),t.services.map((l)=>n.addService({...l,type:"service"})),t.junctions.map((l)=>n.addJunction({...l,type:"junction"})),t.edges.map((l)=>n.addEdge(l)),t.alignments?.map((l)=>n.addLayoutHint({direction:l.direction,members:[...l.members]}))},"populateDb"),wt={parser:{yy:void 0},parse:e(async(t)=>{let n=await X("architecture",t);r.debug(n);let l=wt.parser?.yy;if(!(l instanceof Et))throw Error("parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");zt(n,l)},"parse")},Bt=e((t)=>`
2
2
  .edge {
3
3
  stroke-width: ${t.archEdgeWidth};
4
4
  stroke: ${t.archEdgeColor};