@coopcli/specplan 2026.826.3 → 2026.831.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/dist/cli/index.js +87 -14
  2. package/dist/client/assets/{abnfDiagram-VRR7QNED-DG21UC5n.js → abnfDiagram-VCTEODGH-CfNYg36y.js} +1 -1
  3. package/dist/client/assets/architecture-7GRP2DOG-ClcyuJeM.js +1 -0
  4. package/dist/client/assets/architectureDiagram-5GKGNRK7-EUaFLg_N.js +36 -0
  5. package/dist/client/assets/blockDiagram-I7D4REHJ-D5aVJWK4.js +129 -0
  6. package/dist/client/assets/c4Diagram-7LVT6UL2-BZXD1Ljd.js +38 -0
  7. package/dist/client/assets/channel-BAs8lRyw.js +1 -0
  8. package/dist/client/assets/chunk-2E4U76K2-Cw3KAY14.js +2 -0
  9. package/dist/client/assets/chunk-4HAMMTFA-e90ut0hg.js +62 -0
  10. package/dist/client/assets/{chunk-ICXQ74PX-Cq2aKGhh.js → chunk-75Z2AOVW-BSJ7TCsD.js} +1 -1
  11. package/dist/client/assets/chunk-CLGD4ZFX-C0R2i_19.js +1 -0
  12. package/dist/client/assets/chunk-DU6HZSFF-B9PGrM0S.js +127 -0
  13. package/dist/client/assets/{chunk-32BRIVSS-DnOQr5Hs.js → chunk-F27PBJKO-DDITEZtq.js} +1 -1
  14. package/dist/client/assets/{chunk-KEIR6QF5-BfrZ3jm6.js → chunk-FOHPRMQF-CyTuVbu3.js} +2 -2
  15. package/dist/client/assets/chunk-GMAD6QVW-CYVpwKkW.js +72 -0
  16. package/dist/client/assets/chunk-GVQU2GXP-BJblveWS.js +1 -0
  17. package/dist/client/assets/{chunk-EX3LRPZG-Bi8XxiOh.js → chunk-IMKFNOWR-DAGJCpt6.js} +2 -2
  18. package/dist/client/assets/{chunk-K2UTITRG-BltRQECA.js → chunk-K2UTITRG-H9sh0oLh.js} +3 -3
  19. package/dist/client/assets/chunk-L3NEJ4N5-DxCFFP_W.js +1 -0
  20. package/dist/client/assets/chunk-LNGE3PJU-DNNNwF8Y.js +34 -0
  21. package/dist/client/assets/chunk-OSK3NFVY-BMSa3Vfd.js +10 -0
  22. package/dist/client/assets/chunk-P2QGCYS3-Bu8IRfP3.js +1 -0
  23. package/dist/client/assets/{chunk-VR4S4FIN-BFByvgIN.js → chunk-POPQ4Y6H-D5kqONCm.js} +1 -1
  24. package/dist/client/assets/{chunk-HOUHSVGY-Bl0rPEPe.js → chunk-PWAF6VOD-Dvb7qjWz.js} +1 -1
  25. package/dist/client/assets/chunk-SHT3W25Y-D2BW6_3D.js +168 -0
  26. package/dist/client/assets/{chunk-MOJQB5TN-JtGqXlt7.js → chunk-SVP7TREG-80pA_2GH.js} +1 -1
  27. package/dist/client/assets/{chunk-V7JOEXUC-DY3oUmK_.js → chunk-TICWLB2K-33YpH19H.js} +1 -1
  28. package/dist/client/assets/chunk-TLUHSLCS-DB6mQIZ1.js +2 -0
  29. package/dist/client/assets/chunk-XXDRQBXY-UjAooa0y.js +1 -0
  30. package/dist/client/assets/classDiagram-ZZMXUADV-Dr70HO4g.js +1 -0
  31. package/dist/client/assets/classDiagram-v2-VYDZK3BY-Dr70HO4g.js +1 -0
  32. package/dist/client/assets/{cose-bilkent-JH36ORCC-BZq8oTdP.js → cose-bilkent-JH36ORCC-Cxpw52Vn.js} +1 -1
  33. package/dist/client/assets/cynefin-OW5HDTMX-DGOAC9pl.js +1 -0
  34. package/dist/client/assets/{cynefinDiagram-TSTJHNR4-CSWGdCZG.js → cynefinDiagram-5FMLGOSQ-BBadT3J7.js} +1 -1
  35. package/dist/client/assets/dagre-BJJUWK_n.js +1 -0
  36. package/dist/client/assets/dagre-GXQ25YYZ-uK9Aj9gR.js +4 -0
  37. package/dist/client/assets/{diagram-OA4YK3LP-B57UNui7.js → diagram-S7CK7UJ4-Bx7un_r7.js} +4 -4
  38. package/dist/client/assets/diagram-UQ7AKVKN-D_FPs5n4.js +41 -0
  39. package/dist/client/assets/{diagram-FQU43EPY-lDfjbNDh.js → diagram-VSXAHHWV-DOlaViPU.js} +1 -1
  40. package/dist/client/assets/{diagram-G47NLZAW-Bqb_3tmg.js → diagram-VX7I27RA-W3tftqeG.js} +1 -1
  41. package/dist/client/assets/{diagram-NH7WQ7WH-BArVFXm1.js → diagram-Z3DM3KII-BlTEnFH3.js} +1 -1
  42. package/dist/client/assets/dist-DIRxRVHE.js +29 -0
  43. package/dist/client/assets/{ebnfDiagram-CCIWWBDH-83eSAR_O.js → ebnfDiagram-PWID7BFC-V5TBUB27.js} +1 -1
  44. package/dist/client/assets/erDiagram-RLTQ6QDP-DfsK-we8.js +99 -0
  45. package/dist/client/assets/eventmodeling-NTZA5JFV-Bm8UblGS.js +1 -0
  46. package/dist/client/assets/flowDiagram-HODETNUW-CDbLbKxh.js +1 -0
  47. package/dist/client/assets/{ganttDiagram-NO4QXBWP-Bgga29Au.js → ganttDiagram-EL5Y4UJY--q244SRn.js} +1 -1
  48. package/dist/client/assets/gitGraph-4MIJSDKK-DnrVWqiy.js +1 -0
  49. package/dist/client/assets/{gitGraphDiagram-IHSO6WYX-Br2TGk_K.js → gitGraphDiagram-WWUBYQGX-VNkA4Uf5.js} +1 -1
  50. package/dist/client/assets/image-GAAHSSAO-CD1o-YMR.js +1 -0
  51. package/dist/client/assets/{index-CJ_b6AjB.js → index-B11N7mVL.js} +2 -2
  52. package/dist/client/assets/info-A6RAGUB7-DHahP2t1.js +1 -0
  53. package/dist/client/assets/{infoDiagram-FWYZ7A6U-DHDrXFI4.js → infoDiagram-27XIBGKW-BqdWJsQl.js} +1 -1
  54. package/dist/client/assets/{ishikawaDiagram-FXEZZL3T-O9cNcghb.js → ishikawaDiagram-5VMMS53U-BQDvfXPM.js} +1 -1
  55. package/dist/client/assets/{journeyDiagram-5HDEW3XC-D-xRZp9P.js → journeyDiagram-3NMN7TZE-CUxgRucN.js} +2 -2
  56. package/dist/client/assets/{kanban-definition-HUTT4EX6-BJaeijjD.js → kanban-definition-UXKFOSKX-NRYyPh3u.js} +4 -4
  57. package/dist/client/assets/{line-BNyITG_F.js → line--mn93uFO.js} +1 -1
  58. package/dist/client/assets/{linear-C8fpJQ9Y.js → linear-nn1qWWVx.js} +1 -1
  59. package/dist/client/assets/{mermaid-parser.core-0GwuEqeW.js → mermaid-parser.core-cJplg8ws.js} +3 -3
  60. package/dist/client/assets/{mindmap-definition-LN4V7U3C-C_xpI67d.js → mindmap-definition-YA3MSWOX-5mxipwqK.js} +1 -1
  61. package/dist/client/assets/packet-AYTQ26CC-D_CzDsxi.js +1 -0
  62. package/dist/client/assets/{pegDiagram-2B236MQR-BgEyEYUz.js → pegDiagram-XKGWAZYB-CZgEH2ik.js} +1 -1
  63. package/dist/client/assets/pie-WAS4IAKB-Bbi2nBDh.js +1 -0
  64. package/dist/client/assets/{pieDiagram-ENE6RG2P-_eb7ATmh.js → pieDiagram-E7YTZNPT-BeIds11Q.js} +1 -1
  65. package/dist/client/assets/{prod-Ba4uM3Ch.js → prod-ebIQ9pCZ.js} +5 -5
  66. package/dist/client/assets/{quadrantDiagram-ABIIQ3AL-BfWuKeAQ.js → quadrantDiagram-AXDQQJYC-CU25DqZi.js} +1 -1
  67. package/dist/client/assets/radar-RG4KPBEZ-D9XlnJuS.js +1 -0
  68. package/dist/client/assets/railroad-74A4TZTK-C8zhynVQ.js +1 -0
  69. package/dist/client/assets/railroad-abnf-HS5TGJTU-BTpzeL6Q.js +1 -0
  70. package/dist/client/assets/railroad-ebnf-LZEXJU2U-CDp0cVj8.js +1 -0
  71. package/dist/client/assets/railroad-peg-WCYAUIDC-COHlAN_m.js +1 -0
  72. package/dist/client/assets/{railroadDiagram-RFXS5EU6-Dc-cMKD7.js → railroadDiagram-O6MQD6OU-B3-CeGkJ.js} +1 -1
  73. package/dist/client/assets/{requirementDiagram-TGXJPOKE-DV1943Gb.js → requirementDiagram-BXWQKSXE-BOtLvnrn.js} +2 -2
  74. package/dist/client/assets/{sankeyDiagram-HTMAVEWB-BLoYtcaW.js → sankeyDiagram-P5KCCOFB-d8cZjl2R.js} +1 -1
  75. package/dist/client/assets/{sequenceDiagram-DBY2YBRQ-B6DaItWI.js → sequenceDiagram-WJ2MYXX4-xPYJuZXx.js} +1 -1
  76. package/dist/client/assets/{src-BhL2Ylf6.js → src-vDqOmCca.js} +1 -1
  77. package/dist/client/assets/{stateDiagram-2N3HPSRC-DPj2INXk.js → stateDiagram-D77RDMKH-CoSi3U2M.js} +1 -1
  78. package/dist/client/assets/stateDiagram-v2-MP3YSRHH-rm3bOnma.js +1 -0
  79. package/dist/client/assets/swimlanes-42K2YHIH-Dfmn2Xue.js +1 -0
  80. package/dist/client/assets/swimlanesDiagram-VR7AAH4N-DNMa4iz7.js +8 -0
  81. package/dist/client/assets/{timeline-definition-FHXFAJF6-DGOKXG2b.js → timeline-definition-24CTP7MA-5lxZ3j2p.js} +1 -1
  82. package/dist/client/assets/treeView-Q6P3EWNA-WvBrpL2m.js +1 -0
  83. package/dist/client/assets/treemap-WGGIJYW6-BIRckr4X.js +1 -0
  84. package/dist/client/assets/{vennDiagram-L72KCM5P-C5_1kk6U.js → vennDiagram-4TSXK5OY-BNF-a0iW.js} +1 -1
  85. package/dist/client/assets/wardley-WFR3VGLG-BLEFW6m8.js +1 -0
  86. package/dist/client/assets/{wardleyDiagram-EHGQE667-BEkVslCX.js → wardleyDiagram-VM6X3IG4-X0WeO3Ol.js} +1 -1
  87. package/dist/client/assets/{xychartDiagram-FW5EYKEG-CPIaD3HD.js → xychartDiagram-S5SC5T6Z-zv0t5rP8.js} +3 -3
  88. package/dist/client/index.html +1 -1
  89. package/package.json +1 -1
  90. package/dist/client/assets/architecture-TIHT7OUA-DYAR8PGt.js +0 -1
  91. package/dist/client/assets/architectureDiagram-ZJ3FMSHR-C0V7EMlK.js +0 -36
  92. package/dist/client/assets/blockDiagram-677ZJIJ3-Q-VuK37S.js +0 -132
  93. package/dist/client/assets/c4Diagram-LMCZKHZV-Dhz1hxI-.js +0 -10
  94. package/dist/client/assets/channel-SlrdwMao.js +0 -1
  95. package/dist/client/assets/chunk-52WLFC77-BI8xz4Ng.js +0 -10
  96. package/dist/client/assets/chunk-7BUUIJ7U-Bb538aSH.js +0 -1
  97. package/dist/client/assets/chunk-C7G6YPKG-zsqJHbjz.js +0 -1
  98. package/dist/client/assets/chunk-FWX5IMBZ-BFofqCmB.js +0 -2
  99. package/dist/client/assets/chunk-OGEWGWER-CLzHww9d.js +0 -1
  100. package/dist/client/assets/chunk-PUDLZKDR-C2gIwlIm.js +0 -156
  101. package/dist/client/assets/chunk-Q4XR5HBZ-Dju-tUQs.js +0 -70
  102. package/dist/client/assets/chunk-RYQCIY6F-C1vISHVj.js +0 -1
  103. package/dist/client/assets/chunk-VAUOI2AC-BTR1oUbp.js +0 -1
  104. package/dist/client/assets/chunk-WYO6CB5R-2sVpzpwa.js +0 -127
  105. package/dist/client/assets/chunk-XXDRQBXY-CoR8hY2w.js +0 -1
  106. package/dist/client/assets/chunk-ZGVPDNZ5-CPSkfYQU.js +0 -62
  107. package/dist/client/assets/chunk-ZIRB5QZD-C6fEPe3t.js +0 -32
  108. package/dist/client/assets/classDiagram-OUVF2IWQ-C12ZdCSq.js +0 -1
  109. package/dist/client/assets/classDiagram-v2-EOCWNBFH-C12ZdCSq.js +0 -1
  110. package/dist/client/assets/cynefin-VYW2F7L2-Qefl_a7r.js +0 -1
  111. package/dist/client/assets/dagre-CXRCoUWR.js +0 -1
  112. package/dist/client/assets/dagre-VKFMJZFB-8Lzbq-nm.js +0 -4
  113. package/dist/client/assets/diagram-WEI45ONY-BFLTZHeD.js +0 -41
  114. package/dist/client/assets/dist-BXJAQ5z7.js +0 -29
  115. package/dist/client/assets/erDiagram-Q63AITRT-XJGCrYfA.js +0 -85
  116. package/dist/client/assets/eventmodeling-45OFAUF4-CySgleMT.js +0 -1
  117. package/dist/client/assets/flowDiagram-23GEKE2U-CpHOSlUH.js +0 -1
  118. package/dist/client/assets/gitGraph-TEB2WS4Q-wTeiF0vP.js +0 -1
  119. package/dist/client/assets/image-GAAHSSAO-DddoQEI3.js +0 -1
  120. package/dist/client/assets/info-DKCQHKI2-CLYkJTfv.js +0 -1
  121. package/dist/client/assets/map-DsCK-0Cs.js +0 -1
  122. package/dist/client/assets/packet-7NZHBO7P-oaZIsx8j.js +0 -1
  123. package/dist/client/assets/pie-RZYD4A2V-Dc3Fwoex.js +0 -1
  124. package/dist/client/assets/radar-I7S5WNFK-CB0kWg3t.js +0 -1
  125. package/dist/client/assets/railroad-3IZDKUUU-amr7bLB-.js +0 -1
  126. package/dist/client/assets/railroad-abnf-AHOZXSZD-BjM-VtEb.js +0 -1
  127. package/dist/client/assets/railroad-ebnf-EBAXGLYW-CywxI5pS.js +0 -1
  128. package/dist/client/assets/railroad-peg-LSFZ7HO6-C7lj-TYo.js +0 -1
  129. package/dist/client/assets/stateDiagram-v2-6OUMAXLB-_0YmrsU4.js +0 -1
  130. package/dist/client/assets/swimlanes-5IMT3BWC-BeEj60g4.js +0 -2
  131. package/dist/client/assets/swimlanesDiagram-G3AALYLV-B-KepWf4.js +0 -8
  132. package/dist/client/assets/treeView-QDETBFTQ-DTEVOLrT.js +0 -1
  133. package/dist/client/assets/treemap-6X3UGDF4-JYJwO9Vr.js +0 -1
  134. package/dist/client/assets/wardley-OPB4EBWU-B7P-bikf.js +0 -1
  135. /package/dist/client/assets/{sizeCapture-X5ZJPWSS-B0uUizjq.js → sizeCapture-INFHLROL-B0uUizjq.js} +0 -0
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/prod-Ba4uM3Ch.js","assets/rolldown-runtime-aKtaBQYM.js","assets/chunk-ZUYEQ4TG-BzFOpW--.js","assets/chunk-SRAX5OIU-Bpn6XoyU.js","assets/chunk-K2UTITRG-BltRQECA.js","assets/chunk-6U3AYISY-C6-Mtja1.js","assets/chunk-Z3N5DIM6-D9TMVU7m.js","assets/prod-DtRVLazd.css"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/prod-ebIQ9pCZ.js","assets/rolldown-runtime-aKtaBQYM.js","assets/chunk-ZUYEQ4TG-BzFOpW--.js","assets/chunk-SRAX5OIU-Bpn6XoyU.js","assets/chunk-K2UTITRG-H9sh0oLh.js","assets/chunk-6U3AYISY-C6-Mtja1.js","assets/chunk-Z3N5DIM6-D9TMVU7m.js","assets/prod-DtRVLazd.css"])))=>i.map(i=>d[i]);
2
2
  import{i as e,n as t,t as n}from"./rolldown-runtime-aKtaBQYM.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var r=n((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function ee(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,ee(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),ee(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=ee(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=ee(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return ee(M(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function te(e,t,n){if(e==null)return e;var r=[],i=0;return ee(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function ne(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var N=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},P={map:te,forEach:function(e,t,n){te(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return te(e,function(){t++}),t},toArray:function(e){return te(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=P,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:ne}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,N)}catch(e){N(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.7`})),i=n(((e,t)=>{t.exports=r()})),a=n((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),o=n(((e,t)=>{t.exports=a()})),s=n((e=>{var t=i();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var a={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},o=Symbol.for(`react.portal`);function s(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return s(e,t,null,r)},e.flushSync=function(e){var t=c.T,n=a.p;try{if(c.T=null,a.p=2,e)return e()}finally{c.T=t,a.p=n,a.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??a.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=l(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else a.d.m(e)},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.7`})),c=n(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=s()})),l=n((e=>{var t=o(),n=i(),r=c();function a(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function s(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function l(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function u(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function f(e){if(l(e)!==e)throw Error(a(188))}function p(e){var t=e.alternate;if(!t){if(t=l(e),t===null)throw Error(a(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return f(i),e;if(o===r)return f(i),t;o=o.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=o;else{for(var s=!1,c=i.child;c;){if(c===n){s=!0,n=i,r=o;break}if(c===r){s=!0,r=i,n=o;break}c=c.sibling}if(!s){for(c=o.child;c;){if(c===n){s=!0,n=o,r=i;break}if(c===r){s=!0,r=o,n=i;break}c=c.sibling}if(!s)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(n.tag!==3)throw Error(a(188));return n.stateNode.current===n?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),k=Symbol.for(`react.activity`),A=Symbol.for(`react.memo_cache_sentinel`),j=Symbol.iterator;function M(e){return typeof e!=`object`||!e?null:(e=j&&e[j]||e[`@@iterator`],typeof e==`function`?e:null)}var ee=Symbol.for(`react.client.reference`);function te(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ee?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case k:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?te(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return te(e(t))}catch{}}return null}var ne=Array.isArray,N=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,re={pending:!1,data:null,method:null,action:null},F=[],I=-1;function ie(e){return{current:e}}function L(e){0>I||(e.current=F[I],F[I]=null,I--)}function R(e,t){I++,F[I]=e.current,e.current=t}var ae=ie(null),oe=ie(null),se=ie(null),ce=ie(null);function le(e,t){switch(R(se,t),R(oe,e),R(ae,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Ud(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Ud(t),e=Wd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}L(ae),R(ae,e)}function ue(){L(ae),L(oe),L(se)}function de(e){e.memoizedState!==null&&R(ce,e);var t=ae.current,n=Wd(t,e.type);t!==n&&(R(oe,e),R(ae,n))}function fe(e){oe.current===e&&(L(ae),L(oe)),ce.current===e&&(L(ce),ep._currentValue=re)}var pe,me;function he(e){if(pe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);pe=t&&t[1]||``,me=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+pe+e+me}var ge=!1;function _e(e,t){if(!e||ge)return``;ge=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
@@ -89,4 +89,4 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
89
89
  `,`
90
90
  +`).split(`
91
91
  `));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return(0,G.useEffect)(()=>{let n=t?.target??vb,c=t?.actInsideInputWithModifier??!0;if(e!==null){let e=e=>{if(i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!i.current||i.current&&!c)&&K_(e))return!1;let n=xb(e.code,s);if(a.current.add(e[n]),bb(o,a.current,!1)){let n=e.composedPath?.()?.[0]||e.target,a=n?.nodeName===`BUTTON`||n?.nodeName===`A`;t.preventDefault!==!1&&(i.current||!a)&&e.preventDefault(),r(!0)}},l=e=>{let t=xb(e.code,s);bb(o,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[t]),e.key===`Meta`&&a.current.clear(),i.current=!1},u=()=>{a.current.clear(),r(!1)};return n?.addEventListener(`keydown`,e),n?.addEventListener(`keyup`,l),window.addEventListener(`blur`,u),window.addEventListener(`contextmenu`,u),()=>{n?.removeEventListener(`keydown`,e),n?.removeEventListener(`keyup`,l),window.removeEventListener(`blur`,u),window.removeEventListener(`contextmenu`,u)}}},[e,r]),n}function bb(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function xb(e,t){return t.includes(e)?`code`:`key`}var Sb=()=>{let e=Gy();return(0,G.useMemo)(()=>({zoomIn:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{let{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{let{transform:[r,i,a],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??a},n),!0):!1},getViewport:()=>{let[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{let{width:r,height:i,minZoom:a,maxZoom:o,panZoom:s}=e.getState(),c=N_(t,r,i,a,o,n?.padding??.1);return s?(await s.setViewport(c,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{let{transform:r,snapGrid:i,snapToGrid:a,domNode:o}=e.getState();if(!o)return t;let{x:s,y:c}=o.getBoundingClientRect(),l={x:t.x-s,y:t.y-c},u=n.snapGrid??i;return O_(l,r,n.snapToGrid??a,u)},flowToScreenPosition:t=>{let{transform:n,domNode:r}=e.getState();if(!r)return t;let{x:i,y:a}=r.getBoundingClientRect(),o=k_(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function Cb(e,t){let n=[],r=new Map,i=[];for(let t of e)if(t.type===`add`){i.push(t);continue}else if(t.type===`remove`||t.type===`replace`)r.set(t.id,[t]);else{let e=r.get(t.id);e?e.push(t):r.set(t.id,[t])}for(let e of t){let t=r.get(e.id);if(!t){n.push(e);continue}if(t[0].type===`remove`)continue;if(t[0].type===`replace`){n.push({...t[0].item});continue}let i={...e};for(let e of t)wb(e,i);n.push(i)}return i.length&&i.forEach(e=>{e.index===void 0?n.push({...e.item}):n.splice(e.index,0,{...e.item})}),n}function wb(e,t){switch(e.type){case`select`:t.selected=e.selected;break;case`position`:e.position!==void 0&&(t.position=e.position),e.dragging!==void 0&&(t.dragging=e.dragging);break;case`dimensions`:e.dimensions!==void 0&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes===`width`)&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes===`height`)&&(t.height=e.dimensions.height))),typeof e.resizing==`boolean`&&(t.resizing=e.resizing);break}}function Tb(e,t){return Cb(e,t)}function Eb(e,t){return Cb(e,t)}function Db(e,t){return{id:e,type:`select`,selected:t}}function Ob(e,t=new Set,n=!1){let r=[];for(let[i,a]of e){let e=t.has(i);!(a.selected===void 0&&!e)&&a.selected!==e&&(n&&(a.selected=e),r.push(Db(a.id,e)))}return r}function kb({items:e=[],lookup:t}){let n=[],r=new Map(e.map(e=>[e.id,e]));for(let[r,i]of e.entries()){let e=t.get(i.id),a=e?.internals?.userNode??e;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:`replace`}),a===void 0&&n.push({item:i,type:`add`,index:r})}for(let[e]of t)r.get(e)===void 0&&n.push({id:e,type:`remove`});return n}function Ab(e){return{id:e.id,type:`remove`}}var jb=E_(`React Flow`,`https://reactflow.dev/`);function Mb(e,t,n={}){return av(e,t,{...n,onError:n.onError??jb})}var Nb=e=>e_(e),Pb=e=>$g(e);function Fb(e){return(0,G.forwardRef)(e)}var Ib=typeof window<`u`?G.useLayoutEffect:G.useEffect;function Lb(e){let[t,n]=(0,G.useState)(BigInt(0)),[r]=(0,G.useState)(()=>Rb(()=>n(e=>e+BigInt(1))));return Ib(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function Rb(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var zb=(0,G.createContext)(null);function Bb({children:e}){let t=Gy(),n=Lb((0,G.useCallback)(e=>{let{nodes:n=[],setNodes:r,hasDefaultNodes:i,onNodesChange:a,nodeLookup:o,fitViewQueued:s,onNodesChangeMiddlewareMap:c}=t.getState(),l=n;for(let t of e)l=typeof t==`function`?t(l):t;let u=kb({items:l,lookup:o});for(let e of c.values())u=e(u);i&&r(l),u.length>0?a?.(u):s&&window.requestAnimationFrame(()=>{let{fitViewQueued:e,nodes:n,setNodes:r}=t.getState();e&&r(n)})},[])),r=Lb((0,G.useCallback)(e=>{let{edges:n=[],setEdges:r,hasDefaultEdges:i,onEdgesChange:a,edgeLookup:o}=t.getState(),s=n;for(let t of e)s=typeof t==`function`?t(s):t;i?r(s):a&&a(kb({items:s,lookup:o}))},[])),i=(0,G.useMemo)(()=>({nodeQueue:n,edgeQueue:r}),[]);return(0,X.jsx)(zb.Provider,{value:i,children:e})}function Vb(){let e=(0,G.useContext)(zb);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var Hb=e=>!!e.panZoom;function Ub(){let e=Sb(),t=Gy(),n=Vb(),r=$(Hb),i=(0,G.useMemo)(()=>{let e=e=>t.getState().nodeLookup.get(e),r=e=>{n.nodeQueue.push(e)},i=e=>{n.edgeQueue.push(e)},a=e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState(),i=Nb(e)?e:n.get(e.id),a=i.parentId?R_(i.position,i.measured,i.parentId,n,r):i.position;return y_({...i,position:a,width:i.measured?.width??i.width,height:i.measured?.height??i.height})},o=(e,t,n={replace:!1})=>{r(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&Nb(e)?e:{...r,...e}}return r}))},s=(e,t,n={replace:!1})=>{i(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&Pb(e)?e:{...r,...e}}return r}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{let{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:r,setEdges:i,addNodes:e=>{let t=Array.isArray(e)?e:[e];n.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{let t=Array.isArray(e)?e:[e];n.edgeQueue.push(e=>[...e,...t])},toObject:()=>{let{nodes:e=[],edges:n=[],transform:r}=t.getState(),[i,a,o]=r;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:i,y:a,zoom:o}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{let{nodes:r,edges:i,onNodesDelete:a,onEdgesDelete:o,triggerNodeChanges:s,triggerEdgeChanges:c,onDelete:l,onBeforeDelete:u}=t.getState(),{nodes:d,edges:f}=await u_({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(Ab);o?.(f),c(e)}if(m){let e=d.map(Ab);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=w_(e),o=i?e:a(e),s=r!==void 0;return o?(r||t.getState().nodes).filter(r=>{let a=t.getState().nodeLookup.get(r.id);if(a&&!i&&(r.id===e.id||!a.internals.positionAbsolute))return!1;let c=y_(s?r:a),l=C_(c,o);return n&&l>0||l>=c.width*c.height||l>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=w_(e)?e:a(e);if(!r)return!1;let i=C_(r,t);return n&&i>0||i>=t.width*t.height||i>=r.width*r.height},updateNode:o,updateNodeData:(e,t,n={replace:!1})=>{o(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},updateEdge:s,updateEdgeData:(e,t,n={replace:!1})=>{s(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},getNodesBounds:e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState();return r_(e,{nodeLookup:n,nodeOrigin:r})},getHandleConnections:({type:e,id:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}-${e}${n?`-${n}`:``}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}${e?n?`-${e}-${n}`:`-${e}`:``}`)?.values()??[]),fitView:async e=>{let r=t.getState().fitViewResolver??B_();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:r}),n.nodeQueue.push(e=>[...e]),r.promise}}},[]);return(0,G.useMemo)(()=>({...i,...e,viewportInitialized:r}),[r])}var Wb=e=>e.selected,Gb=typeof window<`u`?window:void 0;function Kb({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=Gy(),{deleteElements:r}=Ub(),i=yb(e,{actInsideInputWithModifier:!1}),a=yb(t,{target:Gb});(0,G.useEffect)(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(Wb),edges:e.filter(Wb)}),n.setState({nodesSelectionActive:!1})}},[i]),(0,G.useEffect)(()=>{n.setState({multiSelectionActive:a})},[a])}function qb(e){let t=Gy();(0,G.useEffect)(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=U_(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,Vg.error004()),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener(`resize`,n);let t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener(`resize`,n),t&&e.current&&t.unobserve(e.current)}}},[])}var Jb={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},Yb=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Xb({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:a=Kg.Free,zoomOnDoubleClick:o=!0,panOnDrag:s=!0,defaultViewport:c,translateExtent:l,minZoom:u,maxZoom:d,zoomActivationKeyCode:f,preventScrolling:p=!0,children:m,noWheelClassName:h,noPanClassName:g,onViewportChange:_,isControlledViewport:v,paneClickDistance:y,selectionOnDrag:b}){let x=Gy(),S=(0,G.useRef)(null),{userSelectionActive:C,lib:w,connectionInProgress:T}=$(Yb,By),E=yb(f),D=(0,G.useRef)();qb(S);let O=(0,G.useCallback)(e=>{_?.({x:e[0],y:e[1],zoom:e[2]}),v||x.setState({transform:e})},[_,v]);return(0,G.useEffect)(()=>{if(S.current){D.current=my({domNode:S.current,minZoom:u,maxZoom:d,translateExtent:l,viewport:c,onDraggingChange:e=>x.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{let{onViewportChangeStart:n,onMoveStart:r}=x.getState();r?.(e,t),n?.(t)},onPanZoom:(e,t)=>{let{onViewportChange:n,onMove:r}=x.getState();r?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{let{onViewportChangeEnd:n,onMoveEnd:r}=x.getState();r?.(e,t),n?.(t)}});let{x:e,y:t,zoom:n}=D.current.getViewport();return x.setState({panZoom:D.current,transform:[e,t,n],domNode:S.current.closest(`.react-flow`)}),()=>{D.current?.destroy()}}},[]),(0,G.useEffect)(()=>{D.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:a,zoomOnDoubleClick:o,panOnDrag:s,zoomActivationKeyPressed:E,preventScrolling:p,noPanClassName:g,userSelectionActive:C,noWheelClassName:h,lib:w,onTransformChange:O,connectionInProgress:T,selectionOnDrag:b,paneClickDistance:y})},[e,t,n,r,i,a,o,s,E,p,g,C,h,w,O,T,b,y]),(0,X.jsx)(`div`,{className:`react-flow__renderer`,ref:S,style:Jb,children:m})}var Zb=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Qb(){let{userSelectionActive:e,userSelectionRect:t}=$(Zb,By);return e&&t?(0,X.jsx)(`div`,{className:`react-flow__selection react-flow__container`,style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}var $b=(e,t)=>n=>{n.target===t.current&&e?.(n)},ex=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function tx({isSelecting:e,selectionKeyPressed:t,selectionMode:n=qg.Full,panOnDrag:r,autoPanOnSelection:i,paneClickDistance:a,selectionOnDrag:o,onSelectionStart:s,onSelectionEnd:c,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:m,children:h}){let g=(0,G.useRef)(0),_=Gy(),{userSelectionActive:v,elementsSelectable:y,dragging:b,panBy:x,autoPanSpeed:S}=$(ex,By),C=y&&(e||v),w=(0,G.useRef)(null),T=(0,G.useRef)(),E=(0,G.useRef)(new Set),D=(0,G.useRef)(new Set),O=(0,G.useRef)(!1),k=(0,G.useRef)(!1),A=(0,G.useRef)({x:0,y:0}),j=(0,G.useRef)(!1),M=e=>{if(k.current||O.current||_.getState().connection.inProgress){k.current=!1,O.current=!1;return}l?.(e),_.getState().resetSelectedElements(),_.setState({nodesSelectionActive:!1})},ee=e=>{if(Array.isArray(r)&&r?.includes(2)){e.preventDefault();return}u?.(e)},te=d?e=>d(e):void 0,ne=e=>{k.current&&=(e.stopPropagation(),!1)},N=n=>{let{domNode:r,transform:i}=_.getState();if(T.current=r?.getBoundingClientRect(),!T.current)return;let a=n.target===w.current;if(!a&&n.target.closest(`.nokey`)||!e||!(o&&a||t)||n.button!==0||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),k.current=!1;let{x:s,y:c}=J_(n.nativeEvent,T.current),l=O_({x:s,y:c},i);_.setState({userSelectionRect:{width:0,height:0,startX:l.x,startY:l.y,x:s,y:c}}),a||(n.stopPropagation(),n.preventDefault())};function P(e,t){let{userSelectionRect:r}=_.getState();if(!r)return;let{transform:i,nodeLookup:a,edgeLookup:o,connectionLookup:s,triggerNodeChanges:c,triggerEdgeChanges:l,defaultEdgeOptions:u}=_.getState(),d={x:r.startX,y:r.startY},{x:f,y:p}=k_(d,i),m={startX:d.x,startY:d.y,x:e<f?e:f,y:t<p?t:p,width:Math.abs(e-f),height:Math.abs(t-p)},h=E.current,g=D.current;E.current=new Set(a_(a,m,i,n===qg.Partial,!0).map(e=>e.id)),D.current=new Set;let v=u?.selectable??!0;for(let e of E.current){let t=s.get(e);if(t)for(let{edgeId:e}of t.values()){let t=o.get(e);t&&(t.selectable??v)&&D.current.add(e)}}z_(h,E.current)||c(Ob(a,E.current,!0)),z_(g,D.current)||l(Ob(o,D.current)),_.setState({userSelectionRect:m,userSelectionActive:!0,nodesSelectionActive:!1})}function re(){if(!i||!T.current)return;let[e,t]=h_(A.current,T.current,S);x({x:e,y:t}).then(e=>{if(!k.current||!e){g.current=requestAnimationFrame(re);return}let{x:t,y:n}=A.current;P(t,n),g.current=requestAnimationFrame(re)})}let F=()=>{cancelAnimationFrame(g.current),g.current=0,j.current=!1};return(0,G.useEffect)(()=>()=>F(),[]),(0,X.jsxs)(`div`,{className:nd([`react-flow__pane`,{draggable:r===!0||Array.isArray(r)&&r.includes(0),dragging:b,selection:e}]),onClick:C?void 0:$b(M,w),onContextMenu:$b(ee,w),onWheel:$b(te,w),onPointerEnter:C?void 0:f,onPointerMove:C?e=>{let{userSelectionRect:n,transform:r,resetSelectedElements:i}=_.getState();if(!T.current||!n)return;let{x:o,y:c}=J_(e.nativeEvent,T.current);A.current={x:o,y:c};let l=k_({x:n.startX,y:n.startY},r);if(!k.current){let n=t?0:a;if(Math.hypot(o-l.x,c-l.y)<=n)return;i(),s?.(e)}k.current=!0,j.current||=(re(),!0),P(o,c)}:p,onPointerUp:e=>{if(!C){e.target===w.current&&_.getState().connection.inProgress&&(O.current=!0);return}e.button===0&&(e.target?.releasePointerCapture?.(e.pointerId),!v&&e.target===w.current&&_.getState().userSelectionRect&&M?.(e),_.setState({userSelectionActive:!1,userSelectionRect:null}),k.current&&(c?.(e),_.setState({nodesSelectionActive:E.current.size>0})),F())},onPointerCancel:C?e=>{e.target?.releasePointerCapture?.(e.pointerId),F()}:void 0,onPointerDownCapture:C?N:void 0,onClickCapture:C?ne:void 0,onPointerLeave:m,ref:w,style:Jb,children:[h,(0,X.jsx)(Qb,{})]})}function nx({id:e,store:t,unselect:n=!1,nodeRef:r}){let{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeLookup:s,onError:c}=t.getState(),l=s.get(e);if(!l){c?.(`012`,Vg.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function rx({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=Gy(),[c,l]=(0,G.useState)(!1),u=(0,G.useRef)();return(0,G.useEffect)(()=>{if(!t)return u.current=Uv({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{nx({id:t,store:s,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}}),()=>{u.current?.destroy(),u.current=void 0}},[t,s,e]),(0,G.useEffect)(()=>{t||!e.current||!u.current||u.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:o})},[n,r,t,a,e,i,o]),c}var ix=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function ax(){let e=Gy();return(0,G.useCallback)(t=>{let{nodeExtent:n,snapToGrid:r,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:s,nodeLookup:c,nodeOrigin:l}=e.getState(),u=new Map,d=ix(a),f=r?i[0]:5,p=r?i[1]:5,m=t.direction.x*f*t.factor,h=t.direction.y*p*t.factor;for(let[,e]of c){if(!d(e))continue;let t={x:e.internals.positionAbsolute.x+m,y:e.internals.positionAbsolute.y+h};r&&(t=D_(t,i));let{position:a,positionAbsolute:s}=l_({nodeId:e.id,nextPosition:t,nodeLookup:c,nodeExtent:n,nodeOrigin:l,onError:o});e.position=a,e.internals.positionAbsolute=s,u.set(e.id,e)}s(u)},[])}var ox=(0,G.createContext)(null),sx=ox.Provider;ox.Consumer;var cx=()=>(0,G.useContext)(ox),lx=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),ux=(0,G.createContext)(null);function dx({children:e}){let t=$(lx,By);return(0,X.jsx)(ux.Provider,{value:t,children:e})}function fx(){let e=(0,G.useContext)(ux);if(!e)throw Error(`useHandleConfig must be used within a HandleConfigProvider`);return e}var px={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},mx=(e,t,n)=>r=>{let{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:c,isValid:l}=o;if(!s&&!i)return px;let u=c?.nodeId===e&&c?.id===t&&c?.type===n;return{connectingFrom:s?.nodeId===e&&s?.id===t&&s?.type===n,connectingTo:u,clickConnecting:i?.nodeId===e&&i?.id===t&&i?.type===n,isPossibleEndHandle:a===Gg.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function hx({type:e=`source`,position:t=Q.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:c,className:l,onMouseDown:u,onTouchStart:d,...f},p){let m=o||null,h=e===`target`,g=Gy(),_=cx(),{connectOnClick:v,noPanClassName:y,rfId:b}=fx(),{connectingFrom:x,connectingTo:S,clickConnecting:C,isPossibleEndHandle:w,connectionInProcess:T,clickConnectionInProcess:E,valid:D}=$(mx(_,m,e),By);_||g.getState().onError?.(`010`,Vg.error010());let O=e=>{let{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=g.getState(),i={...t,...e};if(r){let{edges:e,setEdges:t,onError:n}=g.getState();t(Mb(i,e,{onError:n}))}n?.(i),s?.(i)},k=e=>{if(!_)return;let t=q_(e.nativeEvent);if(i&&(t&&e.button===0||!t)){let t=g.getState();$v.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:h,handleId:m,nodeId:_,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:(...e)=>g.getState().onConnectEnd?.(...e),updateConnection:t.updateConnection,onConnect:O,isValidConnection:n||((...e)=>g.getState().isValidConnection?.(...e)??!0),getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?u?.(e):d?.(e)};return(0,X.jsx)(`div`,{"data-handleid":m,"data-nodeid":_,"data-handlepos":t,"data-id":`${b}-${_}-${m}-${e}`,className:nd([`react-flow__handle`,`react-flow__handle-${t}`,`nodrag`,y,l,{source:!h,target:h,connectable:r,connectablestart:i,connectableend:a,clickconnecting:C,connectingfrom:x,connectingto:S,valid:D,connectionindicator:r&&(!T||w)&&(T||E?a:i)}]),onMouseDown:k,onTouchStart:k,onClick:v?t=>{let{onClickConnectStart:r,onClickConnectEnd:a,connectionClickStartHandle:o,connectionMode:s,isValidConnection:c,lib:l,rfId:u,nodeLookup:d,connection:f}=g.getState();if(!_||!o&&!i)return;if(!o){r?.(t.nativeEvent,{nodeId:_,handleId:m,handleType:e}),g.setState({connectionClickStartHandle:{nodeId:_,type:e,id:m}});return}let p=W_(t.target),h=n||c,{connection:v,isValid:y}=$v.isValid(t.nativeEvent,{handle:{nodeId:_,id:m,type:e},connectionMode:s,fromNodeId:o.nodeId,fromHandleId:o.id||null,fromType:o.type,isValidConnection:h,flowId:u,doc:p,lib:l,nodeLookup:d});y&&v&&O(v);let b=structuredClone(f);delete b.inProgress,b.toPosition=b.toHandle?b.toHandle.position:null,a?.(t,b),g.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f,children:c})}var gx=(0,G.memo)(Fb(hx));function _x({data:e,isConnectable:t,sourcePosition:n=Q.Bottom}){return(0,X.jsxs)(X.Fragment,{children:[e?.label,(0,X.jsx)(gx,{type:`source`,position:n,isConnectable:t})]})}function vx({data:e,isConnectable:t,targetPosition:n=Q.Top,sourcePosition:r=Q.Bottom}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(gx,{type:`target`,position:n,isConnectable:t}),e?.label,(0,X.jsx)(gx,{type:`source`,position:r,isConnectable:t})]})}function yx(){return null}function bx({data:e,isConnectable:t,targetPosition:n=Q.Top}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(gx,{type:`target`,position:n,isConnectable:t}),e?.label]})}var xx={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Sx={input:_x,default:vx,output:bx,group:yx};function Cx(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}var wx=e=>{let{width:t,height:n,x:r,y:i}=i_(e.nodeLookup,{filter:e=>!!e.selected});return{width:T_(t)?t:null,height:T_(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function Tx({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=Gy(),{width:i,height:a,transformString:o,userSelectionActive:s}=$(wx,By),c=ax(),l=(0,G.useRef)(null);(0,G.useEffect)(()=>{n||l.current?.focus({preventScroll:!0})},[n]);let u=!s&&i!==null&&a!==null;if(rx({nodeRef:l,disabled:!u}),!u)return null;let d=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return(0,X.jsx)(`div`,{className:nd([`react-flow__nodesselection`,`react-flow__container`,t]),style:{transform:o},children:(0,X.jsx)(`div`,{ref:l,className:`react-flow__nodesselection-rect`,onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(xx,e.key)&&(e.preventDefault(),c({direction:xx[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var Ex=typeof window<`u`?window:void 0,Dx=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Ox({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,paneClickDistance:s,deleteKeyCode:c,selectionKeyCode:l,selectionOnDrag:u,selectionMode:d,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:h,zoomActivationKeyCode:g,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:b,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:w,autoPanOnSelection:T,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,preventScrolling:A,onSelectionContextMenu:j,noWheelClassName:M,noPanClassName:ee,disableKeyboardA11y:te,onViewportChange:ne,isControlledViewport:N}){let{nodesSelectionActive:P,userSelectionActive:re}=$(Dx,By),F=yb(l,{target:Ex}),I=yb(h,{target:Ex}),ie=I||w,L=I||b,R=u&&ie!==!0,ae=F||re||R;return Kb({deleteKeyCode:c,multiSelectionKeyCode:m}),(0,X.jsx)(Xb,{onPaneContextMenu:a,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:L,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:!F&&ie,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,zoomActivationKeyCode:g,preventScrolling:A,noWheelClassName:M,noPanClassName:ee,onViewportChange:ne,isControlledViewport:N,paneClickDistance:s,selectionOnDrag:R,children:(0,X.jsxs)(tx,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:ie,autoPanOnSelection:T,isSelecting:!!ae,selectionMode:d,selectionKeyPressed:F,paneClickDistance:s,selectionOnDrag:R,children:[e,P&&(0,X.jsx)(Tx,{onSelectionContextMenu:j,noPanClassName:ee,disableKeyboardA11y:te})]})})}Ox.displayName=`FlowRenderer`;var kx=(0,G.memo)(Ox),Ax=e=>t=>e?a_(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys());function jx(e){return $((0,G.useCallback)(Ax(e),[e]),By)}var Mx=e=>e.updateNodeInternals;function Nx(){let e=$(Mx),[t]=(0,G.useState)(()=>typeof ResizeObserver>`u`?null:new ResizeObserver(t=>{let n=new Map;t.forEach(e=>{let t=e.target.getAttribute(`data-id`);n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return(0,G.useEffect)(()=>()=>{t?.disconnect()},[t]),t}function Px({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=Gy(),a=(0,G.useRef)(null),o=(0,G.useRef)(null),s=(0,G.useRef)(e.sourcePosition),c=(0,G.useRef)(e.targetPosition),l=(0,G.useRef)(t),u=n&&!!e.internals.handleBounds;return(0,G.useEffect)(()=>{a.current&&!e.hidden&&(!u||o.current!==a.current)&&(o.current&&r?.unobserve(o.current),r?.observe(a.current),o.current=a.current)},[u,e.hidden]),(0,G.useEffect)(()=>()=>{o.current&&=(r?.unobserve(o.current),null)},[]),(0,G.useEffect)(()=>{if(a.current){let n=l.current!==t,r=s.current!==e.sourcePosition,o=c.current!==e.targetPosition;(n||r||o)&&(l.current=t,s.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function Fx({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:a,onDoubleClick:o,nodesDraggable:s,elementsSelectable:c,nodesConnectable:l,nodesFocusable:u,resizeObserver:d,noDragClassName:f,noPanClassName:p,disableKeyboardA11y:m,rfId:h,nodeTypes:g,nodeClickDistance:_,onError:v}){let{node:y,internals:b,isParent:x}=$(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},By),S=y.type||`default`,C=g?.[S]||Sx[S];C===void 0&&(v?.(`003`,Vg.error003(S)),S=`default`,C=g?.default||Sx.default);let w=!!(y.draggable||s&&y.draggable===void 0),T=!!(y.selectable||c&&y.selectable===void 0),E=!!(y.connectable||l&&y.connectable===void 0),D=!!(y.focusable||u&&y.focusable===void 0),O=Gy(),k=L_(y),A=Px({node:y,nodeType:S,hasDimensions:k,resizeObserver:d}),j=rx({nodeRef:A,disabled:y.hidden||!w,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:_}),M=ax();if(y.hidden)return null;let ee=I_(y),te=Cx(y),ne=T||w||t||n||r||i,N=n?e=>n(e,{...b.userNode}):void 0,P=r?e=>r(e,{...b.userNode}):void 0,re=i?e=>i(e,{...b.userNode}):void 0,F=a?e=>a(e,{...b.userNode}):void 0,I=o?e=>o(e,{...b.userNode}):void 0,ie=n=>{let{selectNodesOnDrag:r,nodeDragThreshold:i}=O.getState();T&&(!r||!w||i>0)&&nx({id:e,store:O,nodeRef:A}),t&&t(n,{...b.userNode})},L=t=>{if(!(K_(t.nativeEvent)||m)){if(Ug.includes(t.key)&&T){let n=t.key===`Escape`;nx({id:e,store:O,unselect:n,nodeRef:A})}else if(w&&y.selected&&Object.prototype.hasOwnProperty.call(xx,t.key)){t.preventDefault();let{ariaLabelConfig:e}=O.getState();O.setState({ariaLiveMessage:e[`node.a11yDescription.ariaLiveMessage`]({direction:t.key.replace(`Arrow`,``).toLowerCase(),x:~~b.positionAbsolute.x,y:~~b.positionAbsolute.y})}),M({direction:xx[t.key],factor:t.shiftKey?4:1})}}},R=()=>{if(m||!A.current?.matches(`:focus-visible`))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=O.getState();i&&(a_(new Map([[e,y]]),{x:0,y:0,width:n,height:r},t,!0).length>0||a(y.position.x+ee.width/2,y.position.y+ee.height/2,{zoom:t[2]}))};return(0,X.jsx)(`div`,{className:nd([`react-flow__node`,`react-flow__node-${S}`,{[p]:w},y.className,{selected:y.selected,selectable:T,parent:x,draggable:w,dragging:j}]),ref:A,style:{zIndex:b.z,transform:`translate(${b.positionAbsolute.x}px,${b.positionAbsolute.y}px)`,pointerEvents:ne?`all`:`none`,visibility:k?`visible`:`hidden`,...y.style,...te},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:N,onMouseMove:P,onMouseLeave:re,onContextMenu:F,onClick:ie,onDoubleClick:I,onKeyDown:D?L:void 0,tabIndex:D?0:void 0,onFocus:D?R:void 0,role:y.ariaRole??(D?`group`:void 0),"aria-roledescription":`node`,"aria-describedby":m?void 0:`${Jy}-${h}`,"aria-label":y.ariaLabel,...y.domAttributes,children:(0,X.jsx)(sx,{value:e,children:(0,X.jsx)(C,{id:e,data:y.data,type:S,positionAbsoluteX:b.positionAbsolute.x,positionAbsoluteY:b.positionAbsolute.y,selected:y.selected??!1,selectable:T,draggable:w,deletable:y.deletable??!0,isConnectable:E,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:j,dragHandle:y.dragHandle,zIndex:b.z,parentId:y.parentId,...ee})})})}var Ix=(0,G.memo)(Fx),Lx=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Rx(e){let{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:i}=$(Lx,By),a=jx(e.onlyRenderVisibleElements),o=Nx();return(0,X.jsx)(`div`,{className:`react-flow__nodes`,style:Jb,children:a.map(a=>(0,X.jsx)(Ix,{id:a,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:o,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:i},a))})}Rx.displayName=`NodeRenderer`;var zx=(0,G.memo)(Rx);function Bx(e){return $((0,G.useCallback)(t=>{if(!e)return t.edges.map(e=>e.id);let n=[];if(t.width&&t.height)for(let e of t.edges){let r=t.nodeLookup.get(e.source),i=t.nodeLookup.get(e.target);r&&i&&nv({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),By)}var Vx=({color:e=`none`,strokeWidth:t=1})=>(0,X.jsx)(`polyline`,{className:`arrow`,style:{strokeWidth:t,...e&&{stroke:e}},strokeLinecap:`round`,fill:`none`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4`}),Hx=({color:e=`none`,strokeWidth:t=1})=>(0,X.jsx)(`polyline`,{className:`arrowclosed`,style:{strokeWidth:t,...e&&{stroke:e,fill:e}},strokeLinecap:`round`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4 -5,-4`}),Ux={[Xg.Arrow]:Vx,[Xg.ArrowClosed]:Hx};function Wx(e){let t=Gy();return(0,G.useMemo)(()=>Object.prototype.hasOwnProperty.call(Ux,e)?Ux[e]:(t.getState().onError?.(`009`,Vg.error009(e)),null),[e])}var Gx=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:a=`strokeWidth`,strokeWidth:o,orient:s=`auto-start-reverse`})=>{let c=Wx(t);return c?(0,X.jsx)(`marker`,{className:`react-flow__arrowhead`,id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:`-10 -10 20 20`,markerUnits:a,orient:s,refX:`0`,refY:`0`,children:(0,X.jsx)(c,{color:n,strokeWidth:o})}):null},Kx=({defaultColor:e,rfId:t})=>{let n=$(e=>e.edges),r=$(e=>e.defaultEdgeOptions),i=(0,G.useMemo)(()=>yv(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?(0,X.jsx)(`svg`,{className:`react-flow__marker`,"aria-hidden":`true`,children:(0,X.jsx)(`defs`,{children:i.map(e=>(0,X.jsx)(Gx,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};Kx.displayName=`MarkerDefinitions`;var qx=(0,G.memo)(Kx);function Jx({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:a,labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:c,className:l,...u}){let[d,f]=(0,G.useState)({x:1,y:0,width:0,height:0}),p=nd([`react-flow__edge-textwrapper`,l]),m=(0,G.useRef)(null);return(0,G.useEffect)(()=>{if(m.current){let e=m.current.getBBox();f({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n?(0,X.jsxs)(`g`,{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:p,visibility:d.width?`visible`:`hidden`,...u,children:[i&&(0,X.jsx)(`rect`,{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:`react-flow__edge-textbg`,style:a,rx:s,ry:s}),(0,X.jsx)(`text`,{className:`react-flow__edge-text`,y:d.height/2,dy:`0.3em`,ref:m,style:r,children:n}),c]}):null}Jx.displayName=`EdgeText`;var Yx=(0,G.memo)(Jx);function Xx({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c,interactionWidth:l=20,...u}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`path`,{...u,d:e,fill:`none`,className:nd([`react-flow__edge-path`,u.className])}),l?(0,X.jsx)(`path`,{d:e,fill:`none`,strokeOpacity:0,strokeWidth:l,className:`react-flow__edge-interaction`}):null,r&&T_(t)&&T_(n)?(0,X.jsx)(Yx,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function Zx({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===Q.Left||e===Q.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function Qx({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top}){let[o,s]=Zx({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=Zx({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=X_({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:s,targetControlX:c,targetControlY:l});return[`M${e},${t} C${o},${s} ${c},${l} ${r},${i}`,u,d,f,p]}function $x(e){return(0,G.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o,targetPosition:s,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})=>{let[v,y,b]=Qx({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s});return(0,X.jsx)(Xx,{id:e.isInternal?void 0:t,path:v,labelX:y,labelY:b,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})})}var eS=$x({isInternal:!1}),tS=$x({isInternal:!0});eS.displayName=`SimpleBezierEdge`,tS.displayName=`SimpleBezierEdgeInternal`;function nS(e){return(0,G.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,sourcePosition:p=Q.Bottom,targetPosition:m=Q.Top,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=fv({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:_?.borderRadius,offset:_?.offset,stepPosition:_?.stepPosition});return(0,X.jsx)(Xx,{id:e.isInternal?void 0:t,path:y,labelX:b,labelY:x,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:g,interactionWidth:v})})}var rS=nS({isInternal:!1}),iS=nS({isInternal:!0});rS.displayName=`SmoothStepEdge`,iS.displayName=`SmoothStepEdgeInternal`;function aS(e){return(0,G.memo)(({id:t,...n})=>{let r=e.isInternal?void 0:t;return(0,X.jsx)(rS,{...n,id:r,pathOptions:(0,G.useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var oS=aS({isInternal:!1}),sS=aS({isInternal:!0});oS.displayName=`StepEdge`,sS.displayName=`StepEdgeInternal`;function cS(e){return(0,G.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})=>{let[g,_,v]=ov({sourceX:n,sourceY:r,targetX:i,targetY:a});return(0,X.jsx)(Xx,{id:e.isInternal?void 0:t,path:g,labelX:_,labelY:v,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})})}var lS=cS({isInternal:!1}),uS=cS({isInternal:!0});lS.displayName=`StraightEdge`,uS.displayName=`StraightEdgeInternal`;function dS(e){return(0,G.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o=Q.Bottom,targetPosition:s=Q.Top,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=$_({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:_?.curvature});return(0,X.jsx)(Xx,{id:e.isInternal?void 0:t,path:y,labelX:b,labelY:x,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:v})})}var fS=dS({isInternal:!1}),pS=dS({isInternal:!0});fS.displayName=`BezierEdge`,pS.displayName=`BezierEdgeInternal`;var mS={default:pS,straight:uS,step:sS,smoothstep:iS,simplebezier:tS},hS={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},gS=(e,t,n)=>n===Q.Left?e-t:n===Q.Right?e+t:e,_S=(e,t,n)=>n===Q.Top?e-t:n===Q.Bottom?e+t:e,vS=`react-flow__edgeupdater`;function yS({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s}){return(0,X.jsx)(`circle`,{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:nd([vS,`${vS}-${s}`]),cx:gS(t,r,e),cy:_S(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function bS({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:a,targetY:o,sourcePosition:s,targetPosition:c,onReconnect:l,onReconnectStart:u,onReconnectEnd:d,setReconnecting:f,setUpdateHover:p}){let m=Gy(),h=(e,t)=>{if(e.button!==0)return;let{autoPanOnConnect:r,domNode:i,connectionMode:a,connectionRadius:o,lib:s,onConnectStart:c,cancelConnection:p,nodeLookup:h,rfId:g,panBy:_,updateConnection:v}=m.getState(),y=t.type===`target`;$v.onPointerDown(e.nativeEvent,{autoPanOnConnect:r,connectionMode:a,connectionRadius:o,domNode:i,handleId:t.id,nodeId:t.nodeId,nodeLookup:h,isTarget:y,edgeUpdaterType:t.type,lib:s,flowId:g,cancelConnection:p,panBy:_,isValidConnection:(...e)=>m.getState().isValidConnection?.(...e)??!0,onConnect:e=>l?.(n,e),onConnectStart:(r,i)=>{f(!0),u?.(e,n,t.type),c?.(r,i)},onConnectEnd:(...e)=>m.getState().onConnectEnd?.(...e),onReconnectEnd:(e,r)=>{f(!1),d?.(e,n,t.type,r)},updateConnection:v,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},g=e=>h(e,{nodeId:n.target,id:n.targetHandle??null,type:`target`}),_=e=>h(e,{nodeId:n.source,id:n.sourceHandle??null,type:`source`}),v=()=>p(!0),y=()=>p(!1);return(0,X.jsxs)(X.Fragment,{children:[(e===!0||e===`source`)&&(0,X.jsx)(yS,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:y,type:`source`}),(e===!0||e===`target`)&&(0,X.jsx)(yS,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:_,onMouseEnter:v,onMouseOut:y,type:`target`})]})}function xS({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,rfId:m,edgeTypes:h,noPanClassName:g,onError:_,disableKeyboardA11y:v}){let y=$(t=>t.edgeLookup.get(e)),b=$(e=>e.defaultEdgeOptions);y=b?{...b,...y}:y;let x=y.type||`default`,S=h?.[x]||mS[x];S===void 0&&(_?.(`011`,Vg.error011(x)),x=`default`,S=h?.default||mS.default);let C=!!(y.focusable||t&&y.focusable===void 0),w=d!==void 0&&(y.reconnectable||n&&y.reconnectable===void 0),T=!!(y.selectable||r&&y.selectable===void 0),E=(0,G.useRef)(null),[D,O]=(0,G.useState)(!1),[k,A]=(0,G.useState)(!1),j=Gy(),{zIndex:M=y.zIndex,sourceX:ee,sourceY:te,targetX:ne,targetY:N,sourcePosition:P,targetPosition:re}=$((0,G.useCallback)(t=>{let n=t.nodeLookup.get(y.source),r=t.nodeLookup.get(y.target);if(!n||!r)return hS;let i=mv({id:e,sourceNode:n,targetNode:r,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:t.connectionMode,onError:_}),a=tv({selected:y.selected,zIndex:y.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...i||hS,zIndex:a}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex]),By),F=(0,G.useMemo)(()=>y.markerStart?`url('#${vv(y.markerStart,m)}')`:void 0,[y.markerStart,m]),I=(0,G.useMemo)(()=>y.markerEnd?`url('#${vv(y.markerEnd,m)}')`:void 0,[y.markerEnd,m]);if(y.hidden||ee===null||te===null||ne===null||N===null)return null;let ie=t=>{let{addSelectedEdges:n,unselectNodesAndEdges:r,multiSelectionActive:a}=j.getState();T&&(j.setState({nodesSelectionActive:!1}),y.selected&&a?(r({nodes:[],edges:[y]}),E.current?.blur()):n([e])),i&&i(t,y)},L=a?e=>{a(e,{...y})}:void 0,R=o?e=>{o(e,{...y})}:void 0,ae=s?e=>{s(e,{...y})}:void 0,oe=c?e=>{c(e,{...y})}:void 0,se=l?e=>{l(e,{...y})}:void 0;return(0,X.jsx)(`svg`,{style:{zIndex:M},children:(0,X.jsxs)(`g`,{className:nd([`react-flow__edge`,`react-flow__edge-${x}`,y.className,g,{selected:y.selected,animated:y.animated,inactive:!T&&!i,updating:D,selectable:T}]),onClick:ie,onDoubleClick:L,onContextMenu:R,onMouseEnter:ae,onMouseMove:oe,onMouseLeave:se,onKeyDown:C?t=>{if(!v&&Ug.includes(t.key)&&T){let{unselectNodesAndEdges:n,addSelectedEdges:r}=j.getState();t.key===`Escape`?(E.current?.blur(),n({edges:[y]})):r([e])}}:void 0,tabIndex:C?0:void 0,role:y.ariaRole??(C?`group`:`img`),"aria-roledescription":`edge`,"data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":C?`${Yy}-${m}`:void 0,ref:E,...y.domAttributes,children:[!k&&(0,X.jsx)(S,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:T,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:ee,sourceY:te,targetX:ne,targetY:N,sourcePosition:P,targetPosition:re,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:F,markerEnd:I,pathOptions:`pathOptions`in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),w&&(0,X.jsx)(bS,{edge:y,isReconnectable:w,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:ee,sourceY:te,targetX:ne,targetY:N,sourcePosition:P,targetPosition:re,setUpdateHover:O,setReconnecting:A})]})})}var SS=(0,G.memo)(xS),CS=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function wS({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:u,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:h}){let{edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,onError:y}=$(CS,By),b=Bx(t);return(0,X.jsxs)(`div`,{className:`react-flow__edges`,children:[(0,X.jsx)(qx,{defaultColor:e,rfId:n}),b.map(e=>(0,X.jsx)(SS,{id:e,edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,noPanClassName:i,onReconnect:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,onClick:u,reconnectRadius:d,onDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:y,edgeTypes:r,disableKeyboardA11y:h},e))]})}wS.displayName=`EdgeRenderer`;var TS=(0,G.memo)(wS),ES=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function DS({children:e}){let t=Gy(),n=(0,G.useRef)(null),[r]=(0,G.useState)(()=>t.getState().transform);return Ib(()=>{let e=null,r=()=>{let r=t.getState().transform;e&&r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]||(e=r,n.current&&(n.current.style.transform=ES(r)))};return r(),t.subscribe(r)},[t]),(0,X.jsx)(`div`,{ref:n,className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:ES(r)},children:e})}function OS(e){let t=Ub(),n=(0,G.useRef)(!1);(0,G.useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var kS=e=>e.panZoom?.syncViewport;function AS(e){let t=$(kS),n=Gy();return(0,G.useEffect)(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function jS(e){return e.connection.inProgress?{...e.connection,to:O_(e.connection.to,e.transform)}:{...e.connection}}function MS(e){return e?t=>e(jS(t)):jS}function NS(e){return $(MS(e),By)}var PS=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function FS({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=$(PS,By);return a&&i&&c?(0,X.jsx)(`svg`,{style:e,width:a,height:o,className:`react-flow__connectionline react-flow__container`,children:(0,X.jsx)(`g`,{className:nd([`react-flow__connection`,Qg(s)]),children:(0,X.jsx)(IS,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var IS=({style:e,type:t=Yg.Bezier,CustomComponent:n,isValid:r})=>{let{inProgress:i,from:a,fromNode:o,fromHandle:s,fromPosition:c,to:l,toNode:u,toHandle:d,toPosition:f,pointer:p}=NS();if(!i)return;if(n)return(0,X.jsx)(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:s,fromX:a.x,fromY:a.y,toX:l.x,toY:l.y,fromPosition:c,toPosition:f,connectionStatus:Qg(r),toNode:u,toHandle:d,pointer:p});let m=``,h={sourceX:a.x,sourceY:a.y,sourcePosition:c,targetX:l.x,targetY:l.y,targetPosition:f};switch(t){case Yg.Bezier:[m]=$_(h);break;case Yg.SimpleBezier:[m]=Qx(h);break;case Yg.Step:[m]=fv({...h,borderRadius:0});break;case Yg.SmoothStep:[m]=fv(h);break;default:[m]=ov(h)}return(0,X.jsx)(`path`,{d:m,fill:`none`,className:`react-flow__connection-path`,style:e})};IS.displayName=`ConnectionLine`;var LS={};function RS(e=LS){(0,G.useRef)(e),Gy(),(0,G.useEffect)(()=>{},[e])}function zS(){Gy(),(0,G.useRef)(!1),(0,G.useEffect)(()=>{},[])}function BS({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:a,onEdgeDoubleClick:o,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:h,connectionLineComponent:g,connectionLineContainerStyle:_,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,deleteKeyCode:w,onlyRenderVisibleElements:T,elementsSelectable:E,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,preventScrolling:j,defaultMarkerColor:M,zoomOnScroll:ee,zoomOnPinch:te,panOnScroll:ne,panOnScrollSpeed:N,panOnScrollMode:P,zoomOnDoubleClick:re,panOnDrag:F,autoPanOnSelection:I,onPaneClick:ie,onPaneMouseEnter:L,onPaneMouseMove:R,onPaneMouseLeave:ae,onPaneScroll:oe,onPaneContextMenu:se,paneClickDistance:ce,nodeClickDistance:le,onEdgeContextMenu:ue,onEdgeMouseEnter:de,onEdgeMouseMove:fe,onEdgeMouseLeave:pe,reconnectRadius:me,onReconnect:he,onReconnectStart:ge,onReconnectEnd:_e,noDragClassName:ve,noWheelClassName:ye,noPanClassName:be,disableKeyboardA11y:xe,nodeExtent:Se,rfId:Ce,viewport:we,onViewportChange:Te,nodesDraggable:Ee}){return RS(e),RS(t),zS(),OS(n),AS(we),(0,X.jsx)(kx,{onPaneClick:ie,onPaneMouseEnter:L,onPaneMouseMove:R,onPaneMouseLeave:ae,onPaneContextMenu:se,onPaneScroll:oe,paneClickDistance:ce,deleteKeyCode:w,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,elementsSelectable:E,zoomOnScroll:ee,zoomOnPinch:te,zoomOnDoubleClick:re,panOnScroll:ne,panOnScrollSpeed:N,panOnScrollMode:P,panOnDrag:F,autoPanOnSelection:I,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,onSelectionContextMenu:d,preventScrolling:j,noDragClassName:ve,noWheelClassName:ye,noPanClassName:be,disableKeyboardA11y:xe,onViewportChange:Te,isControlledViewport:!!we,children:(0,X.jsxs)(DS,{children:[(0,X.jsx)(TS,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:he,onReconnectStart:ge,onReconnectEnd:_e,onlyRenderVisibleElements:T,onEdgeContextMenu:ue,onEdgeMouseEnter:de,onEdgeMouseMove:fe,onEdgeMouseLeave:pe,reconnectRadius:me,defaultMarkerColor:M,noPanClassName:be,disableKeyboardA11y:xe,rfId:Ce}),(0,X.jsx)(FS,{style:h,type:m,component:g,containerStyle:_}),(0,X.jsx)(`div`,{className:`react-flow__edgelabel-renderer`}),(0,X.jsx)(zx,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:le,onlyRenderVisibleElements:T,noPanClassName:be,noDragClassName:ve,disableKeyboardA11y:xe,nodeExtent:Se,rfId:Ce,nodesDraggable:Ee}),(0,X.jsx)(`div`,{className:`react-flow__viewport-portal`})]})})}BS.displayName=`GraphView`;var VS=(0,G.memo)(BS),HS=E_(`React Flow`,`https://reactflow.dev/`),US=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c=.5,maxZoom:l=2,nodeOrigin:u,nodeExtent:d,zIndexMode:f=`basic`}={})=>{let p=new Map,m=new Map,h=new Map,g=new Map,_=r??t??[],v=n??e??[],y=u??[0,0],b=d??Hg;Lv(h,g,_);let{nodesInitialized:x}=Ov(v,p,m,{nodeOrigin:y,nodeExtent:b,zIndexMode:f}),S=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=N_(i_(p,{filter:e=>!!((e.width||e.initialWidth)&&(e.height||e.initialHeight))}),i,a,c,l,s?.padding??.1);S=[e,t,n]}return{rfId:`1`,width:i??0,height:a??0,transform:S,nodes:v,nodesInitialized:x,nodeLookup:p,parentLookup:m,edges:_,edgeLookup:g,connectionLookup:h,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:l,translateExtent:Hg,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Gg.Strict,domNode:null,paneDragging:!1,noPanClassName:`nopan`,nodeOrigin:y,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:o??!1,fitViewOptions:s,fitViewResolver:null,connection:{...Jg},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:HS,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:Wg,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},WS=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f})=>zy((p,m)=>{async function h(){let{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:r,width:i,height:a,minZoom:o,maxZoom:s}=m();t&&(await c_({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),p({fitViewResolver:null}))}return{...US({nodes:e,edges:t,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:e=>{let{nodeLookup:t,parentLookup:n,nodeOrigin:r,elevateNodesOnSelect:i,fitViewQueued:a,zIndexMode:o,nodesSelectionActive:s}=m(),{nodesInitialized:c,hasSelectedNodes:l}=Ov(e,t,n,{nodeOrigin:r,nodeExtent:d,elevateNodesOnSelect:i,checkEquality:!0,zIndexMode:o}),u=s&&l;a&&c?(h(),p({nodes:e,nodesInitialized:c,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:u})):p({nodes:e,nodesInitialized:c,nodesSelectionActive:u})},setEdges:e=>{let{connectionLookup:t,edgeLookup:n}=m();Lv(t,n,e),p({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){let{setNodes:t}=m();t(e),p({hasDefaultNodes:!0})}if(t){let{setEdges:e}=m();e(t),p({hasDefaultEdges:!0})}},updateNodeInternals:e=>{let{triggerNodeChanges:t,nodeLookup:n,parentLookup:r,domNode:i,nodeOrigin:a,nodeExtent:o,debug:s,fitViewQueued:c,zIndexMode:l}=m(),{changes:u,updatedInternals:d}=Pv(e,n,r,i,a,o,l);d&&(Tv(n,r,{nodeOrigin:a,nodeExtent:o,zIndexMode:l}),c?(h(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),u?.length>0&&(s&&console.log(`React Flow: trigger node changes`,u),t?.(u)))},updateNodePositions:(e,t=!1)=>{let n=[],r=[],{nodeLookup:i,triggerNodeChanges:a,connection:o,updateConnection:s,onNodesChangeMiddlewareMap:c}=m();for(let[a,c]of e){let e=i.get(a),l=!!(e?.expandParent&&e?.parentId&&c?.position),u={id:a,type:`position`,position:l?{x:Math.max(0,c.position.x),y:Math.max(0,c.position.y)}:c.position,dragging:t};if(e&&o.inProgress&&o.fromNode.id===e.id){let t=gv(e,o.fromHandle,Q.Left,!0);s({...o,from:t})}l&&e.parentId&&n.push({id:a,parentId:e.parentId,rect:{...c.internals.positionAbsolute,width:c.measured.width??0,height:c.measured.height??0}}),r.push(u)}if(n.length>0){let{parentLookup:e,nodeOrigin:t}=m(),a=Nv(n,i,e,t);r.push(...a)}for(let e of c.values())r=e(r);a(r)},triggerNodeChanges:e=>{let{onNodesChange:t,setNodes:n,nodes:r,hasDefaultNodes:i,debug:a}=m();e?.length&&(i&&n(Tb(e,r)),a&&console.log(`React Flow: trigger node changes`,e),t?.(e))},triggerEdgeChanges:e=>{let{onEdgesChange:t,setEdges:n,edges:r,hasDefaultEdges:i,debug:a}=m();e?.length&&(i&&n(Eb(e,r)),a&&console.log(`React Flow: trigger edge changes`,e),t?.(e))},addSelectedNodes:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){i(e.map(e=>Db(e,!0)));return}i(Ob(r,new Set([...e]),!0)),a(Ob(n))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){a(e.map(e=>Db(e,!0)));return}a(Ob(n,new Set([...e]))),i(Ob(r,new Set,!0))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{let{edges:n,nodes:r,nodeLookup:i,triggerNodeChanges:a,triggerEdgeChanges:o}=m(),s=e||r,c=t||n,l=[];for(let e of s){if(!e.selected)continue;let t=i.get(e.id);t&&(t.selected=!1),l.push(Db(e.id,!1))}let u=[];for(let e of c)e.selected&&u.push(Db(e.id,!1));a(l),o(u)},setMinZoom:e=>{let{panZoom:t,maxZoom:n}=m();t?.setScaleExtent([e,n]),p({minZoom:e})},setMaxZoom:e=>{let{panZoom:t,minZoom:n}=m();t?.setScaleExtent([n,e]),p({maxZoom:e})},setTranslateExtent:e=>{m().panZoom?.setTranslateExtent(e),p({translateExtent:e})},resetSelectedElements:()=>{let{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:r,elementsSelectable:i}=m();if(!i)return;let a=t.reduce((e,t)=>t.selected?[...e,Db(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,Db(t.id,!1)]:e,[]);n(a),r(o)},setNodeExtent:e=>{let{nodes:t,nodeLookup:n,parentLookup:r,nodeOrigin:i,elevateNodesOnSelect:a,nodeExtent:o,zIndexMode:s}=m();e[0][0]===o[0][0]&&e[0][1]===o[0][1]&&e[1][0]===o[1][0]&&e[1][1]===o[1][1]||(Ov(t,n,r,{nodeOrigin:i,nodeExtent:e,elevateNodesOnSelect:a,checkEquality:!1,zIndexMode:s}),p({nodeExtent:e}))},panBy:e=>{let{transform:t,width:n,height:r,panZoom:i,translateExtent:a}=m();return Fv({delta:e,panZoom:i,transform:t,translateExtent:a,width:n,height:r})},setCenter:async(e,t,n)=>{let{width:r,height:i,maxZoom:a,panZoom:o}=m();if(!o)return!1;let s=n?.zoom===void 0?a:n.zoom;return await o.setViewport({x:r/2-e*s,y:i/2-t*s,zoom:s},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0},cancelConnection:()=>{p({connection:{...Jg}})},updateConnection:e=>{p({connection:e})},reset:()=>p({...US()})}},Object.is);function GS({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:a,initialMinZoom:o,initialMaxZoom:s,initialFitViewOptions:c,fitView:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f,children:p}){let[m]=(0,G.useState)(()=>WS({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:l,minZoom:o,maxZoom:s,fitViewOptions:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f}));return(0,X.jsx)(Uy,{value:m,children:(0,X.jsx)(Bb,{children:(0,X.jsx)(dx,{children:p})})})}function KS({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:a,height:o,fitView:s,fitViewOptions:c,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p}){return(0,G.useContext)(Hy)?(0,X.jsx)(X.Fragment,{children:e}):(0,X.jsx)(GS,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:a,initialHeight:o,fitView:s,initialFitViewOptions:c,initialMinZoom:l,initialMaxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p,children:e})}var qS={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function JS({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:a,edgeTypes:o,onNodeClick:s,onEdgeClick:c,onInit:l,onMove:u,onMoveStart:d,onMoveEnd:f,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onSelectionChange:k,onSelectionDragStart:A,onSelectionDrag:j,onSelectionDragStop:M,onSelectionContextMenu:ee,onSelectionStart:te,onSelectionEnd:ne,onBeforeDelete:N,connectionMode:P,connectionLineType:re=Yg.Bezier,connectionLineStyle:F,connectionLineComponent:I,connectionLineContainerStyle:ie,deleteKeyCode:L=`Backspace`,selectionKeyCode:R=`Shift`,selectionOnDrag:ae=!1,selectionMode:oe=qg.Full,panActivationKeyCode:se=`Space`,multiSelectionKeyCode:ce=P_()?`Meta`:`Control`,zoomActivationKeyCode:le=P_()?`Meta`:`Control`,snapToGrid:ue,snapGrid:de,onlyRenderVisibleElements:fe=!1,selectNodesOnDrag:pe,nodesDraggable:me,autoPanOnNodeFocus:he,nodesConnectable:ge,nodesFocusable:_e,nodeOrigin:ve=ub,edgesFocusable:ye,edgesReconnectable:be,elementsSelectable:xe=!0,defaultViewport:Se=db,minZoom:Ce=.5,maxZoom:we=2,translateExtent:Te=Hg,preventScrolling:Ee=!0,nodeExtent:De,defaultMarkerColor:Oe=`#b1b1b7`,zoomOnScroll:ke=!0,zoomOnPinch:Ae=!0,panOnScroll:je=!1,panOnScrollSpeed:Me=.5,panOnScrollMode:Ne=Kg.Free,zoomOnDoubleClick:Pe=!0,panOnDrag:Fe=!0,onPaneClick:Ie,onPaneMouseEnter:Le,onPaneMouseMove:Re,onPaneMouseLeave:ze,onPaneScroll:Be,onPaneContextMenu:Ve,paneClickDistance:He=1,nodeClickDistance:Ue=0,children:We,onReconnect:Ge,onReconnectStart:Ke,onReconnectEnd:qe,onEdgeContextMenu:Je,onEdgeDoubleClick:Ye,onEdgeMouseEnter:Xe,onEdgeMouseMove:Ze,onEdgeMouseLeave:Qe,reconnectRadius:$e=10,onNodesChange:et,onEdgesChange:tt,noDragClassName:nt=`nodrag`,noWheelClassName:rt=`nowheel`,noPanClassName:it=`nopan`,fitView:at,fitViewOptions:ot,connectOnClick:st,attributionPosition:ct,proOptions:lt,defaultEdgeOptions:ut,elevateNodesOnSelect:dt=!0,elevateEdgesOnSelect:ft=!1,disableKeyboardA11y:pt=!1,autoPanOnConnect:mt,autoPanOnNodeDrag:ht,autoPanOnSelection:gt=!0,autoPanSpeed:_t,connectionRadius:vt,isValidConnection:yt,onError:bt,style:xt,id:St,nodeDragThreshold:Ct,connectionDragThreshold:wt,viewport:Tt,onViewportChange:Et,width:Dt,height:Ot,colorMode:kt=`light`,debug:z,onScroll:At,ariaLabelConfig:jt,zIndexMode:Mt=`basic`,...Nt},Pt){let Ft=St||`1`,It=_b(kt),Lt=(0,G.useCallback)(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:`instant`}),At?.(e)},[At]);return(0,X.jsx)(`div`,{"data-testid":`rf__wrapper`,...Nt,onScroll:Lt,style:{...xt,...qS},ref:Pt,className:nd([`react-flow`,i,It]),id:St,role:`application`,children:(0,X.jsxs)(KS,{nodes:e,edges:t,width:Dt,height:Ot,fitView:at,fitViewOptions:ot,minZoom:Ce,maxZoom:we,nodeOrigin:ve,nodeExtent:De,zIndexMode:Mt,children:[(0,X.jsx)(hb,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,nodesDraggable:me,autoPanOnNodeFocus:he,nodesConnectable:ge,nodesFocusable:_e,edgesFocusable:ye,edgesReconnectable:be,elementsSelectable:xe,elevateNodesOnSelect:dt,elevateEdgesOnSelect:ft,minZoom:Ce,maxZoom:we,nodeExtent:De,onNodesChange:et,onEdgesChange:tt,snapToGrid:ue,snapGrid:de,connectionMode:P,translateExtent:Te,connectOnClick:st,defaultEdgeOptions:ut,fitView:at,fitViewOptions:ot,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onSelectionDrag:j,onSelectionDragStart:A,onSelectionDragStop:M,onMove:u,onMoveStart:d,onMoveEnd:f,noPanClassName:it,nodeOrigin:ve,rfId:Ft,autoPanOnConnect:mt,autoPanOnNodeDrag:ht,autoPanSpeed:_t,onError:bt,connectionRadius:vt,isValidConnection:yt,selectNodesOnDrag:pe,nodeDragThreshold:Ct,connectionDragThreshold:wt,onBeforeDelete:N,debug:z,ariaLabelConfig:jt,zIndexMode:Mt}),(0,X.jsx)(VS,{onInit:l,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:o,connectionLineType:re,connectionLineStyle:F,connectionLineComponent:I,connectionLineContainerStyle:ie,selectionKeyCode:R,selectionOnDrag:ae,selectionMode:oe,deleteKeyCode:L,multiSelectionKeyCode:ce,panActivationKeyCode:se,zoomActivationKeyCode:le,onlyRenderVisibleElements:fe,defaultViewport:Se,translateExtent:Te,minZoom:Ce,maxZoom:we,preventScrolling:Ee,zoomOnScroll:ke,zoomOnPinch:Ae,zoomOnDoubleClick:Pe,panOnScroll:je,panOnScrollSpeed:Me,panOnScrollMode:Ne,panOnDrag:Fe,autoPanOnSelection:gt,onPaneClick:Ie,onPaneMouseEnter:Le,onPaneMouseMove:Re,onPaneMouseLeave:ze,onPaneScroll:Be,onPaneContextMenu:Ve,paneClickDistance:He,nodeClickDistance:Ue,onSelectionContextMenu:ee,onSelectionStart:te,onSelectionEnd:ne,onReconnect:Ge,onReconnectStart:Ke,onReconnectEnd:qe,onEdgeContextMenu:Je,onEdgeDoubleClick:Ye,onEdgeMouseEnter:Xe,onEdgeMouseMove:Ze,onEdgeMouseLeave:Qe,reconnectRadius:$e,defaultMarkerColor:Oe,noDragClassName:nt,noWheelClassName:rt,noPanClassName:it,rfId:Ft,disableKeyboardA11y:pt,nodeExtent:De,viewport:Tt,onViewportChange:Et,nodesDraggable:me}),(0,X.jsx)(lb,{onSelectionChange:k}),We,(0,X.jsx)(rb,{proOptions:lt,position:ct}),(0,X.jsx)(eb,{rfId:Ft,disableKeyboardA11y:pt})]})})}var YS=Fb(JS),XS=e=>e.domNode?.querySelector(`.react-flow__viewport-portal`);function ZS({children:e}){let t=$(XS);return t?(0,Vy.createPortal)(e,t):null}Vg.error014();function QS({dimensions:e,lineWidth:t,variant:n,className:r}){return(0,X.jsx)(`path`,{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:nd([`react-flow__background-pattern`,n,r])})}function $S({radius:e,className:t}){return(0,X.jsx)(`circle`,{cx:e,cy:e,r:e,className:nd([`react-flow__background-pattern`,`dots`,t])})}var eC;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(eC||={});var tC={[eC.Dots]:1,[eC.Lines]:1,[eC.Cross]:6},nC=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function rC({id:e,variant:t=eC.Dots,gap:n=20,size:r,lineWidth:i=1,offset:a=0,color:o,bgColor:s,style:c,className:l,patternClassName:u}){let d=(0,G.useRef)(null),{transform:f,patternId:p}=$(nC,By),m=r||tC[t],h=t===eC.Dots,g=t===eC.Cross,_=Array.isArray(n)?n:[n,n],v=[_[0]*f[2]||1,_[1]*f[2]||1],y=m*f[2],b=Array.isArray(a)?a:[a,a],x=g?[y,y]:v,S=[b[0]*f[2]||1+x[0]/2,b[1]*f[2]||1+x[1]/2],C=`${p}${e||``}`;return(0,X.jsxs)(`svg`,{className:nd([`react-flow__background`,l]),style:{...c,...Jb,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:d,"data-testid":`rf__background`,children:[(0,X.jsx)(`pattern`,{id:C,x:f[0]%v[0],y:f[1]%v[1],width:v[0],height:v[1],patternUnits:`userSpaceOnUse`,patternTransform:`translate(-${S[0]},-${S[1]})`,children:h?(0,X.jsx)($S,{radius:y/2,className:u}):(0,X.jsx)(QS,{dimensions:x,lineWidth:i,variant:t,className:u})}),(0,X.jsx)(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${C})`})]})}rC.displayName=`Background`;var iC=(0,G.memo)(rC);function aC(){return(0,X.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,children:(0,X.jsx)(`path`,{d:`M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z`})})}function oC(){return(0,X.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 5`,children:(0,X.jsx)(`path`,{d:`M0 0h32v4.2H0z`})})}function sC(){return(0,X.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 30`,children:(0,X.jsx)(`path`,{d:`M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z`})})}function cC(){return(0,X.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,X.jsx)(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z`})})}function lC(){return(0,X.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,X.jsx)(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z`})})}function uC({children:e,className:t,...n}){return(0,X.jsx)(`button`,{type:`button`,className:nd([`react-flow__controls-button`,t]),...n,children:e})}var dC=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function fC({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:o,onFitView:s,onInteractiveChange:c,className:l,children:u,position:d=`bottom-left`,orientation:f=`vertical`,"aria-label":p}){let m=Gy(),{isInteractive:h,minZoomReached:g,maxZoomReached:_,ariaLabelConfig:v}=$(dC,By),{zoomIn:y,zoomOut:b,fitView:x}=Ub();return(0,X.jsxs)(tb,{className:nd([`react-flow__controls`,f===`horizontal`?`horizontal`:`vertical`,l]),position:d,style:e,"data-testid":`rf__controls`,"aria-label":p??v[`controls.ariaLabel`],children:[t&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(uC,{onClick:()=>{y(),a?.()},className:`react-flow__controls-zoomin`,title:v[`controls.zoomIn.ariaLabel`],"aria-label":v[`controls.zoomIn.ariaLabel`],disabled:_,children:(0,X.jsx)(aC,{})}),(0,X.jsx)(uC,{onClick:()=>{b(),o?.()},className:`react-flow__controls-zoomout`,title:v[`controls.zoomOut.ariaLabel`],"aria-label":v[`controls.zoomOut.ariaLabel`],disabled:g,children:(0,X.jsx)(oC,{})})]}),n&&(0,X.jsx)(uC,{className:`react-flow__controls-fitview`,onClick:()=>{x(i),s?.()},title:v[`controls.fitView.ariaLabel`],"aria-label":v[`controls.fitView.ariaLabel`],children:(0,X.jsx)(sC,{})}),r&&(0,X.jsx)(uC,{className:`react-flow__controls-interactive`,onClick:()=>{m.setState({nodesDraggable:!h,nodesConnectable:!h,elementsSelectable:!h}),c?.(!h)},title:v[`controls.interactive.ariaLabel`],"aria-label":v[`controls.interactive.ariaLabel`],children:h?(0,X.jsx)(lC,{}):(0,X.jsx)(cC,{})}),u]})}fC.displayName=`Controls`;var pC=(0,G.memo)(fC);function mC({id:e,x:t,y:n,width:r,height:i,style:a,color:o,strokeColor:s,strokeWidth:c,className:l,borderRadius:u,shapeRendering:d,selected:f,onClick:p}){let{background:m,backgroundColor:h}=a||{},g=o||m||h;return(0,X.jsx)(`rect`,{className:nd([`react-flow__minimap-node`,{selected:f},l]),x:t,y:n,rx:u,ry:u,width:r,height:i,style:{fill:g,stroke:s,strokeWidth:c},shapeRendering:d,onClick:p?t=>p(t,e):void 0})}var hC=(0,G.memo)(mC),gC=e=>e.nodes.map(e=>e.id),_C=e=>e instanceof Function?e:()=>e;function vC({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=hC,onClick:o}){let s=$(gC,By),c=_C(t),l=_C(e),u=_C(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return(0,X.jsx)(X.Fragment,{children:s.map(e=>(0,X.jsx)(bC,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function yC({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:a,shapeRendering:o,NodeComponent:s,onClick:c}){let{node:l,x:u,y:d,width:f,height:p}=$(t=>{let n=t.nodeLookup.get(e);if(!n)return{node:void 0,x:0,y:0,width:0,height:0};let r=n.internals.userNode,{x:i,y:a}=n.internals.positionAbsolute,{width:o,height:s}=I_(r);return{node:r,x:i,y:a,width:o,height:s}},By);return!l||l.hidden||!L_(l)?null:(0,X.jsx)(s,{x:u,y:d,width:f,height:p,style:l.style,selected:!!l.selected,className:r(l),color:t(l),borderRadius:i,strokeColor:n(l),strokeWidth:a,shapeRendering:o,onClick:c,id:l.id})}var bC=(0,G.memo)(yC),xC=(0,G.memo)(vC),SC=200,CC=150,wC=e=>!e.hidden,TC=e=>{let t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?x_(i_(e.nodeLookup,{filter:wC}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},EC=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,DC=(e,t)=>EC(e.viewBB,t.viewBB)&&EC(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig,OC=`react-flow__minimap-desc`;function kC({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i=``,nodeBorderRadius:a=5,nodeStrokeWidth:o,nodeComponent:s,bgColor:c,maskColor:l,maskStrokeColor:u,maskStrokeWidth:d,position:f=`bottom-right`,onClick:p,onNodeClick:m,pannable:h=!1,zoomable:g=!1,ariaLabel:_,inversePan:v,zoomStep:y=1,offsetScale:b=5}){let x=Gy(),S=(0,G.useRef)(null),{boundingRect:C,viewBB:w,rfId:T,panZoom:E,translateExtent:D,flowWidth:O,flowHeight:k,ariaLabelConfig:A}=$(TC,DC),j=e?.width??SC,M=e?.height??CC,ee=C.width/j,te=C.height/M,ne=Math.max(ee,te),N=ne*j,P=ne*M,re=b*ne,F=C.x-(N-C.width)/2-re,I=C.y-(P-C.height)/2-re,ie=N+re*2,L=P+re*2,R=`${OC}-${T}`,ae=(0,G.useRef)(0),oe=(0,G.useRef)();ae.current=ne,(0,G.useEffect)(()=>{if(S.current&&E)return oe.current=ey({domNode:S.current,panZoom:E,getTransform:()=>x.getState().transform,getViewScale:()=>ae.current}),()=>{oe.current?.destroy()}},[E]),(0,G.useEffect)(()=>{oe.current?.update({translateExtent:D,width:O,height:k,inversePan:v,pannable:h,zoomStep:y,zoomable:g})},[h,g,v,y,D,O,k]);let se=p?e=>{let[t,n]=oe.current?.pointer(e)||[0,0];p(e,{x:t,y:n})}:void 0,ce=m?(0,G.useCallback)((e,t)=>{let n=x.getState().nodeLookup.get(t).internals.userNode;m(e,n)},[]):void 0,le=_??A[`minimap.ariaLabel`];return(0,X.jsx)(tb,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c==`string`?c:void 0,"--xy-minimap-mask-background-color-props":typeof l==`string`?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof u==`string`?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof d==`number`?d*ne:void 0,"--xy-minimap-node-background-color-props":typeof r==`string`?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n==`string`?n:void 0,"--xy-minimap-node-stroke-width-props":typeof o==`number`?o:void 0},className:nd([`react-flow__minimap`,t]),"data-testid":`rf__minimap`,children:(0,X.jsxs)(`svg`,{width:j,height:M,viewBox:`${F} ${I} ${ie} ${L}`,className:`react-flow__minimap-svg`,role:`img`,"aria-labelledby":R,ref:S,onClick:se,children:[le&&(0,X.jsx)(`title`,{id:R,children:le}),(0,X.jsx)(xC,{onClick:ce,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),(0,X.jsx)(`path`,{className:`react-flow__minimap-mask`,d:`M${F-re},${I-re}h${ie+re*2}v${L+re*2}h${-ie-re*2}z
92
- M${w.x},${w.y}h${w.width}v${w.height}h${-w.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}kC.displayName=`MiniMap`;var AC=(0,G.memo)(kC),jC=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,MC={[hy.Line]:`right`,[hy.Handle]:`bottom-right`};function NC({nodeId:e,position:t,variant:n=hy.Handle,className:r,style:i=void 0,children:a,color:o,minWidth:s=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:p=!0,shouldResize:m,onResizeStart:h,onResize:g,onResizeEnd:_}){let v=cx(),y=typeof e==`string`?e:v,b=Gy(),x=(0,G.useRef)(null),S=n===hy.Handle,C=$((0,G.useCallback)(jC(S&&p),[S,p]),By),w=(0,G.useRef)(null),T=t??MC[n];return(0,G.useEffect)(()=>{if(!(!x.current||!y))return w.current||=Ey({domNode:x.current,nodeId:y,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=b.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=b.getState(),o=[],s={x:e.x,y:e.y},c=r.get(y);if(c&&c.expandParent&&c.parentId){let t=c.origin??a,n=e.width??c.measured.width??0,l=e.height??c.measured.height??0,u=Nv([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...R_({x:e.x??c.position.x,y:e.y??c.position.y},{width:n,height:l},c.parentId,r,t)}}],r,i,a);o.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*l,e.y):void 0}if(s.x!==void 0&&s.y!==void 0){let e={id:y,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:y,type:`dimensions`,resizing:!0,setAttributes:f?f===`horizontal`?`width`:`height`:!0,dimensions:{width:e.width,height:e.height}};o.push(t)}for(let e of t){let t={...e,type:`position`};o.push(t)}n(o)},onEnd:({width:e,height:t})=>{let n={id:y,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};b.getState().triggerNodeChanges([n])}}),w.current.update({controlPosition:T,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:_,shouldResize:m}),()=>{w.current?.destroy()}},[T,s,c,l,u,d,h,g,_,m]),(0,X.jsx)(`div`,{className:nd([`react-flow__resize-control`,`nodrag`,...T.split(`-`),n,r]),ref:x,style:{...i,scale:C,...o&&{[S?`backgroundColor`:`borderColor`]:o}},children:a})}(0,G.memo)(NC);function PC(e,t){return e.edges.filter(e=>e.type===`stacked`&&e.from===t).map(e=>e.to)}function FC(e){let t=new Set(e.edges.flatMap(e=>[e.from,e.to])),n=e.nodes.filter(e=>!t.has(e.id));return{specs:IC(n.filter(e=>e.type===`proposal`)),stories:IC(n.filter(e=>e.type===`user_story`))}}function IC(e){return[...e].sort((e,t)=>e.order-t.order)}var LC=`__unscheduled`,RC=`__stories`,zC=`group:`;function BC(e){return`${zC}${e}`}function VC(e){return e.startsWith(`group:`)?e.slice(6):null}function HC(e,t){return`${e}@${t}`}function UC(e){let t=e.indexOf(`@`);return t===-1?e:e.slice(0,t)}function WC(e){let t=e.indexOf(`@`);return t===-1?null:e.slice(t+1)}function GC(e){let t=new Map;for(let n of e.edges){if(n.type!==`targets`)continue;let e=t.get(n.to)??[];e.push(n.from),t.set(n.to,e)}let n=new Map(e.nodes.map(e=>[e.id,e.order])),r=new Map,i=a=>{let o=r.get(a);if(o)return o;r.set(a,[]);let s=t.get(a),c=[];if(s&&s.length>0)c=[...s];else{let t=PC(e,a).slice().sort((e,t)=>(n.get(e)??0)-(n.get(t)??0)||e.localeCompare(t));for(let e of t){let t=i(e);if(t.length>0){c=t;break}}}return r.set(a,c),c},a=new Map;for(let t of e.nodes)t.type===`proposal`&&a.set(t.id,i(t.id));return a}function KC(e,t,n){let r={positions:{},cells:[],rowKeys:[],rowIndexByKey:new Map,rowContainerByCap:new Map,capsByRow:new Map,memberRowsByProp:new Map,occupantsByRow:new Map,hidden:new Set,groupMeta:new Map},i=GC(e),a=IC(e.nodes.filter(e=>e.type===`capability`)).map(e=>e.id);if(n?.hideEmptyCaps){let e=new Set;for(let t of i.values())for(let n of t)e.add(n);a=a.filter(t=>e.has(t))}ew(a,t).forEach((e,t)=>{if(e.kind===`node`)r.rowContainerByCap.set(e.id,e.id),r.capsByRow.set(e.id,[e.id]),r.rowKeys.push(e.id),r.rowIndexByKey.set(e.id,t);else{let n=BC(e.key);if(r.groupMeta.set(n,{key:e.key,count:e.memberIds.length,collapsed:e.collapsed}),e.collapsed){r.capsByRow.set(n,e.memberIds.slice());for(let t of e.memberIds)r.rowContainerByCap.set(t,n),r.hidden.add(t)}else r.capsByRow.set(n,[]);r.rowKeys.push(n),r.rowIndexByKey.set(n,t)}});let o=IC(e.nodes.filter(e=>e.type===`proposal`)),s=[];for(let e of o){let t=i.get(e.id)??[],n=[];for(let e of t){let t=r.rowContainerByCap.get(e);t!==void 0&&!n.includes(t)&&n.push(t)}if(r.memberRowsByProp.set(e.id,n),n.length===0){s.push(e.id);continue}for(let t of n){let n=r.occupantsByRow.get(t)??[];n.push(e.id),r.occupantsByRow.set(t,n)}}let c=new Map(e.nodes.map(e=>[e.id,e.order])),l=(e,t)=>(c.get(e)??0)-(c.get(t)??0)||e.localeCompare(t);for(let[t,n]of r.occupantsByRow)r.occupantsByRow.set(t,YC(n.sort(l),e));let u=(e,t,n,i,a,o)=>{r.positions[e]={x:80+a*280,y:80+o*170},r.cells.push({nodeId:e,baseId:t,kind:n,rowKey:i,col:a})};r.rowKeys.forEach((e,t)=>{let n=VC(e)===null?`capability`:`group`;u(e,e,n,e,0,t),(r.occupantsByRow.get(e)??[]).forEach((n,r)=>{u(HC(n,e),n,`proposal`,e,r+1,t)})});let d=r.rowKeys.length,f=(e,t,n)=>{e.length!==0&&(r.occupantsByRow.set(t,e),r.rowKeys.push(t),r.rowIndexByKey.set(t,d),e.forEach((e,r)=>{let i=Math.floor(r/6);u(e,e,n,t,r%6,d+i)}),d+=Math.ceil(e.length/6))};return f(YC(s.slice().sort(l),e),LC,`proposal`),f(IC(e.nodes.filter(e=>e.type===`user_story`)).map(e=>e.id),RC,`story`),r}function qC(e,t){return{rowIndex:Math.round((t-80)/170),col:Math.round((e-80)/280)}}function JC(e,t,n){let r=n-1;if(r>=0&&r<e.length)return[...e.slice(0,r+1),t,...e.slice(r+1)];let i=Math.max(0,Math.min(r,e.length));return[...e.slice(0,i),t,...e.slice(i)]}function YC(e,t){let n=new Set(e),r=new Map;for(let t of e)r.set(t,new Set);for(let e of t.edges)e.type===`stacked`&&n.has(e.from)&&n.has(e.to)&&r.get(e.from).add(e.to);let i=new Set,a=[];for(;a.length<e.length;){let t=e.find(e=>!i.has(e)&&[...r.get(e)].every(e=>i.has(e)));if(t===void 0){for(let t of e)i.has(t)||a.push(t);break}i.add(t),a.push(t)}return a}function XC(e,t){return e.split(`-`).slice(0,t).join(`-`)}function ZC(e,t=1){let n=[],r=new Map;for(let i of e){let e=XC(i,t),a=r.get(e);a?a.push(i):(r.set(e,[i]),n.push(e))}let i=[];for(let e of n){let n=r.get(e)??[];n.length<2||i.push({key:e,depth:t,memberIds:n,children:ZC(n.filter(t=>t!==e),t+1)})}return i}function QC(e,t){for(let n of e){if(n.key===t)return n;let e=QC(n.children,t);if(e)return e}return null}function $C(e){return ZC(e).map(e=>e.key)}function ew(e,t){let n=new Set(t),r=(e,t)=>{let i=[],a=new Map;for(let n of e){let e=XC(n,t),r=a.get(e);r?r.push(n):(a.set(e,[n]),i.push(e))}let o=[];for(let e of i){let i=a.get(e)??[],s=i[0];if(i.length<2){s!==void 0&&o.push({kind:`node`,id:s});continue}let c=n.has(e);if(o.push({kind:`group`,key:e,depth:t,memberIds:i,collapsed:c}),!c){for(let t of i)t===e&&o.push({kind:`node`,id:t});o.push(...r(i.filter(t=>t!==e),t+1))}}return o};return r(e,1)}function tw({rootName:e,model:t,onModelChange:n,hideEmptySpecs:r,onToggleHideEmpty:i}){return(0,X.jsxs)(`header`,{className:`topbar`,children:[(0,X.jsxs)(`div`,{className:`brand`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`logo`,children:`◇`}),(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`h1`,{children:[(0,X.jsx)(`span`,{className:`brand-coop`,children:`coop`}),` specplan`]}),(0,X.jsxs)(`p`,{children:[`Plan `,(0,X.jsx)(`code`,{className:`canvas-id`,children:e}),` — autosaves to specplan.yaml`]})]})]}),(0,X.jsxs)(`div`,{className:`actions`,children:[i&&(0,X.jsx)(`button`,{"aria-pressed":!!r,className:`hide-empty-toggle${r?` active`:``}`,"data-testid":`hide-empty-toggle`,onClick:i,title:`Hide capability rows with no scheduled items (view only)`,type:`button`,children:r?`Show empty specs`:`Hide empty specs`}),t!==void 0&&n&&(0,X.jsx)(`select`,{"aria-label":`Model`,className:`model-select`,onChange:e=>n(e.target.value),title:`Model used by chat and Generate OpenSpec`,value:t,children:so.map(e=>(0,X.jsx)(`option`,{value:e,children:e.replace(/^claude-/,``)},e))})]})]})}function nw({specId:e,title:t,apply:n,onApplied:r,onClose:i}){let[a,o]=(0,G.useState)(`confirm`),[s,c]=(0,G.useState)(!1),[l,u]=(0,G.useState)();(0,G.useEffect)(()=>{let e=e=>{e.key===`Escape`&&!s&&i()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[i,s]);let d=async e=>{c(!0),u(void 0);try{let t=await n(e);if(t.status===`ok`){r(t.result),i();return}if(t.status===`hand-edit`){o(`hand-edit`);return}u(t.message)}finally{c(!1)}};return(0,X.jsx)(`div`,{className:`dialog-overlay`,onClick:()=>!s&&i(),role:`presentation`,children:(0,X.jsxs)(`div`,{"aria-label":`Apply / Close proposal ${t}`,className:`dialog dialog-apply nodrag nopan`,"data-testid":`apply-dialog`,onClick:e=>e.stopPropagation(),role:`dialog`,children:[(0,X.jsx)(`div`,{className:`dialog-head`,children:(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`div`,{className:`dialog-title`,children:a===`confirm`?`Apply / Close proposal`:`Fold a hand-edited proposal?`}),(0,X.jsx)(`code`,{className:`dialog-path`,children:e})]})}),a===`confirm`?(0,X.jsxs)(`p`,{className:`dialog-notice`,"data-state":`confirm`,"data-testid":`apply-confirm-message`,children:[`Fold `,(0,X.jsx)(`strong`,{children:t}),`'s delta into `,(0,X.jsx)(`code`,{children:`specs/`}),` and archive the change. This is irreversible from the canvas.`]}):(0,X.jsxs)(`p`,{className:`dialog-notice dialog-notice--warning`,"data-state":`hand-edit`,"data-testid":`apply-hand-edit-message`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,children:`⚠`}),` `,(0,X.jsx)(`strong`,{children:t}),`'s body was hand-edited since it was last generated. Applying will fold the hand-edited body as-is — confirm to fold it anyway.`]}),l&&(0,X.jsx)(`div`,{className:`empty error`,"data-testid":`apply-error`,children:l}),(0,X.jsxs)(`div`,{className:`dialog-actions`,children:[(0,X.jsx)(`button`,{className:`chat-clear`,disabled:s,onClick:i,type:`button`,children:`Cancel`}),a===`confirm`?(0,X.jsx)(`button`,{className:`chat-send`,"data-testid":`apply-confirm`,disabled:s,onClick:()=>void d(!1),type:`button`,children:s?`Applying…`:`Apply / Close`}):(0,X.jsx)(`button`,{className:`chat-send`,"data-testid":`apply-confirm-hand-edit`,disabled:s,onClick:()=>void d(!0),type:`button`,children:s?`Applying…`:`Fold hand-edited body`})]})]})})}function rw(e){return e.approved?e.implemented?`implemented`:e.status===`in-progress`?`in-progress`:`approved`:`draft`}var iw=[`in-progress`,`implemented`];function aw(e){return typeof e.onApply==`function`&&e.approved!==!0}function ow({data:e}){let[t,n]=(0,G.useState)(!1),r=rw(e);(0,G.useEffect)(()=>{if(!t)return;let e=()=>n(!1);return window.addEventListener(`click`,e),()=>window.removeEventListener(`click`,e)},[t]);let i=t=>{if(t===`implemented`){e.implemented||e.onImplemented?.(!0);return}e.implemented&&e.onImplemented?.(!1),e.status!==`in-progress`&&e.onStatus?.(`in-progress`)};return(0,X.jsxs)(`div`,{className:`card card-spec${e.hasSpec?` card-has-spec`:``}`,title:e.hasSpec?`An OpenSpec change exists — click to view it`:void 0,children:[(0,X.jsx)(gx,{type:`target`,position:Q.Left}),(0,X.jsxs)(`div`,{className:`card-kind`,children:[`PROPOSAL`,e.hasSpec&&(0,X.jsx)(`span`,{className:`card-badge`,children:`openspec ✓`}),e.specCount!==void 0&&e.specCount>0&&(0,X.jsxs)(`span`,{className:`card-implicated`,children:[e.specCount,` spec`,e.specCount===1?``:`s`]}),e.onStatus&&(e.approved?(0,X.jsxs)(`span`,{className:`card-status-wrap nodrag nopan`,children:[(0,X.jsxs)(`button`,{"aria-label":`Status: ${r}`,className:`card-status status-${r}`,onClick:e=>{e.stopPropagation(),n(e=>!e)},title:`Working state — advance to in-progress / implemented (approved is set by the fold, never here)`,type:`button`,children:[r,` `,(0,X.jsx)(`span`,{"aria-hidden":`true`,children:`▾`})]}),t&&(0,X.jsx)(`span`,{className:`status-menu`,role:`menu`,children:iw.map(e=>(0,X.jsx)(`button`,{className:`status-option status-${e}${e===r?` current`:``}`,onClick:t=>{t.stopPropagation(),n(!1),e!==r&&i(e)},role:`menuitem`,type:`button`,children:e},e))})]}):(0,X.jsx)(`span`,{"aria-label":`Status: draft`,className:`card-status status-draft card-status-static`,children:`draft`}))]}),(0,X.jsx)(`div`,{className:`card-title`,children:e.title}),e.description&&(0,X.jsx)(`div`,{className:`card-text card-description`,children:e.description.length>110?`${e.description.slice(0,110)}…`:e.description}),(e.tasks||e.ledgerStatus)&&(0,X.jsxs)(`div`,{className:`card-completion`,"data-testid":`card-completion`,children:[e.tasks&&(0,X.jsxs)(`span`,{className:`completion-tasks`,children:[e.tasks.done,`/`,e.tasks.total,` tasks`]}),e.ledgerStatus&&(0,X.jsx)(`span`,{className:`completion-ledger`,children:e.ledgerStatus})]}),(!e.hasSpec&&e.onGenerate||aw(e))&&(0,X.jsxs)(`div`,{className:`card-actions`,children:[!e.hasSpec&&e.onGenerate&&(0,X.jsx)(`button`,{className:`card-generate`,disabled:e.generating,onClick:t=>{t.stopPropagation(),e.onGenerate?.()},title:`Generate the OpenSpec change for this spec from its contained stories and dependencies`,type:`button`,children:e.generating?`Generating…`:`Generate OpenSpec`}),aw(e)&&(0,X.jsx)(`button`,{className:`card-apply nodrag nopan`,"data-testid":`card-apply`,onClick:t=>{t.stopPropagation(),e.onApply?.()},title:`Apply / Close — fold this change's delta into specs/ and archive it (irreversible from the canvas)`,type:`button`,children:`Apply / Close`})]}),(0,X.jsx)(gx,{type:`source`,position:Q.Right})]})}function sw({data:e}){return(0,X.jsxs)(`div`,{className:`card card-capability`,title:`Current-truth capability (openspec/specs/) — click to view its spec`,children:[(0,X.jsx)(gx,{type:`target`,position:Q.Left}),(0,X.jsx)(`div`,{className:`card-kind`,children:`SPEC`}),(0,X.jsx)(`div`,{className:`card-title`,children:e.title}),(0,X.jsx)(gx,{type:`source`,position:Q.Right})]})}function cw({data:e}){return(0,X.jsxs)(`div`,{className:`card card-story`,children:[(0,X.jsx)(gx,{type:`target`,position:Q.Left}),(0,X.jsx)(`div`,{className:`card-kind`,children:`user story`}),(0,X.jsx)(`div`,{className:`card-text`,children:e.text})]})}function lw({data:e}){return(0,X.jsxs)(`div`,{className:`card card-group${e.collapsed?` card-group-collapsed`:` card-group-expanded`}`,title:e.collapsed?`Group ${e.label} — click to expand its ${e.count} capabilities`:`Group ${e.label} (expanded) — click to collapse`,children:[(0,X.jsx)(gx,{isConnectable:!1,position:Q.Left,type:`target`}),(0,X.jsxs)(`div`,{className:`card-kind`,children:[`GROUP`,(0,X.jsx)(`span`,{className:`group-count`,children:e.count})]}),(0,X.jsxs)(`div`,{className:`card-title`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`group-caret`,children:e.collapsed?`▸`:`▾`}),e.label]}),(0,X.jsx)(gx,{isConnectable:!1,position:Q.Right,type:`source`})]})}var uw={capability:sw,proposal:ow,story:cw,capGroup:lw};function dw(e,t,n,r){let i=new Map(e.nodes.map(e=>[e.id,e])),a=new Map;for(let t of e.edges){if(t.type!==`targets`)continue;let e=a.get(t.to)??new Set;e.add(t.from),a.set(t.to,e)}let o=e=>a.get(e)?.size??0,s=[];for(let e of t.cells){let a=t.positions[e.nodeId]??{x:0,y:0};if(e.kind===`group`){let n=t.groupMeta.get(e.rowKey);s.push({id:e.nodeId,type:`capGroup`,deletable:!1,draggable:!1,position:a,data:{label:n?.key??e.rowKey,count:n?.count??0,collapsed:n?.collapsed??!0}});continue}let c=i.get(e.baseId);if(!c)continue;if(e.kind===`capability`){s.push({id:e.nodeId,type:`capability`,deletable:!1,draggable:!0,position:a,data:{title:c.type===`capability`?c.title:e.baseId}});continue}if(e.kind===`story`){s.push({id:e.nodeId,type:`story`,deletable:!1,draggable:!1,position:a,data:{text:c.type===`user_story`?c.text:``}});continue}if(c.type!==`proposal`)continue;let l=r?.[c.id];s.push({id:e.nodeId,type:`proposal`,deletable:!1,draggable:!0,position:a,data:{title:c.title,...c.description?{description:c.description}:{},hasSpec:l?.hasSpec===!0,status:l?.status??`draft`,...l?.approved===!0?{approved:!0}:{},...l?.implemented===!0?{implemented:!0}:{},specCount:o(c.id),...l?.tasks?{tasks:l.tasks}:{},...l?.ledgerStatus===void 0?{}:{ledgerStatus:l.ledgerStatus},...n?{...n.generate?{generating:n.generatingId===c.id,onGenerate:()=>n.generate?.(c.id)}:{},onStatus:e=>n.setStatus(c.id,e),...n.setImplemented?{onImplemented:e=>n.setImplemented?.(c.id,e)}:{},...n.apply?{onApply:()=>n.apply?.(c.id)}:{}}:{}}})}return s}function fw(e,t){let n=e=>{let n=t.memberRowsByProp.get(e);return n&&n.length>0?HC(e,n[0]):t.positions[e]?e:null},r=new Set,i=[];for(let a of e.edges){let e=`${a.from}->${a.to}`,o,s,c=!0;if(a.type===`targets`){let n=t.rowContainerByCap.get(a.from);if(n===void 0)continue;let r=VC(n)!==null;o=n,s=t.positions[HC(a.to,n)]?HC(a.to,n):null,r&&(e=`${n}->${a.to}`,c=!1)}else a.type===`containment`?(o=n(a.from),s=t.positions[a.to]?a.to:null):(o=n(a.from),s=n(a.to));!o||!s||!t.positions[o]||!t.positions[s]||r.has(e)||(r.add(e),i.push({id:e,source:o,target:s,deletable:c,className:`edge-${a.type}`,...a.type===`stacked`?{markerEnd:{type:Xg.ArrowClosed}}:{style:{strokeDasharray:`6 4`}}}))}return i}function pw(e,t,n){if(!n)return null;let r=e.filter(e=>UC(e.id)===n);if(r.length===0)return null;let i=o_(r,t),a=new Set(i.map(e=>e.id)),o=new Set([n]);for(let e of i)o.add(UC(e.source)),o.add(UC(e.target));return{bases:o,edgeIds:a}}function mw(e){return(e??``).split(` `).filter(e=>e&&e!==`dimmed`&&e!==`highlighted`).join(` `)}function hw(e,t){return e.map(e=>{let n=mw(e.className),r=(t?t.bases.has(UC(e.id))?`${n} highlighted`.trim():`${n} dimmed`.trim():n)||void 0;return r===e.className?e:{...e,className:r}})}function gw(e,t){return e.map(e=>{let n=mw(e.className),r=(t?t.edgeIds.has(e.id)?`${n} highlighted`.trim():`${n} dimmed`.trim():n)||void 0;return r===e.className?e:{...e,className:r}})}function _w({items:e,resolve:t,onReveal:n}){let{setCenter:r}=Ub(),[i,a]=(0,G.useState)(!1),[o,s]=(0,G.useState)(``),[c,l]=(0,G.useState)(0),u=(0,G.useRef)(null);(0,G.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),a(e=>!e))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,G.useEffect)(()=>{i&&(s(``),l(0),requestAnimationFrame(()=>u.current?.focus()))},[i]);let d=(0,G.useMemo)(()=>{let t=o.trim().toLowerCase();return(t?e.filter(e=>e.label.toLowerCase().includes(t)||e.id.toLowerCase().includes(t)):e).slice(0,20)},[e,o]),f=e=>{let i=e=>void r(e.x+240/2,e.y+132/2,{zoom:1,duration:300}),a=t(e);if(a===`hidden`){n(e),requestAnimationFrame(()=>{let n=t(e);n&&n!==`hidden`&&i(n)});return}a&&i(a)},p=e=>{a(!1),f(e)};return i?(0,X.jsx)(`div`,{className:`search-overlay`,"data-testid":`search-overlay`,onClick:()=>a(!1),role:`presentation`,children:(0,X.jsxs)(`div`,{"aria-label":`Find a card`,className:`search-palette`,"data-testid":`search-palette`,onClick:e=>e.stopPropagation(),role:`dialog`,children:[(0,X.jsx)(`input`,{"aria-label":`Find a card`,className:`search-input`,"data-testid":`search-input`,onChange:e=>{s(e.target.value),l(0)},onKeyDown:e=>{if(e.key===`Escape`)a(!1);else if(e.key===`ArrowDown`)e.preventDefault(),l(e=>Math.min(e+1,d.length-1));else if(e.key===`ArrowUp`)e.preventDefault(),l(e=>Math.max(e-1,0));else if(e.key===`Enter`){e.preventDefault();let t=d[c];t&&p(t.id)}},placeholder:`Find a card by title…`,ref:u,value:o}),(0,X.jsx)(`ul`,{className:`search-results`,role:`listbox`,children:d.length===0?(0,X.jsx)(`li`,{className:`search-empty`,children:`No matching cards.`}):d.map((e,t)=>(0,X.jsxs)(`li`,{"aria-selected":t===c,className:`search-result${t===c?` active`:``} search-${e.kind}`,onClick:()=>p(e.id),onMouseEnter:()=>l(t),role:`option`,children:[(0,X.jsx)(`span`,{className:`search-kind`,children:e.kind===`capability`?`SPEC`:`PROPOSAL`}),(0,X.jsx)(`span`,{className:`search-label`,children:e.label})]},e.id))})]})}):null}function vw({preview:e}){let t=80+e.col*280,n=80+e.rowIndex*170;return(0,X.jsxs)(ZS,{children:[(0,X.jsx)(`div`,{className:`grid-overlay`,"data-testid":`grid-overlay`,style:{position:`absolute`,left:-200,top:-90,width:280*60,height:10200,backgroundSize:`280px 170px`,pointerEvents:`none`}}),(0,X.jsx)(`div`,{className:`snap-target`,"data-testid":`snap-target`,style:{position:`absolute`,left:t-8,top:n-8,width:256,height:148,pointerEvents:`none`}})]})}function yw({rfNodes:e,rfEdges:t,onConnect:n,onEdgesChange:r,onNodesChange:i,onNodeClick:a,onNodeMouseEnter:o,onNodeMouseLeave:s,onPaneClick:c,onNodeDrag:l,onNodeDragStop:u,onBacklogDrop:d,dragPreview:f,searchItems:p,resolveCard:m,revealCard:h,toast:g,children:_}){let{screenToFlowPosition:v}=Ub();return(0,X.jsxs)(`section`,{className:`canvas`,"aria-label":`Planning canvas`,onDragOver:e=>{e.dataTransfer.types.includes(`application/specplan-node`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`)},onDrop:e=>{let t=e.dataTransfer.getData(`application/specplan-node`);if(!t)return;e.preventDefault();let n=v({x:e.clientX,y:e.clientY});d(t,n.x,n.y)},children:[(0,X.jsxs)(YS,{autoPanOnNodeDrag:!1,deleteKeyCode:[`Backspace`,`Delete`],edges:t,fitView:!0,minZoom:.1,nodes:e,nodesDraggable:!0,nodeTypes:uw,onConnect:n,onEdgesChange:r,onNodeClick:(e,t)=>a(t.id),onNodeMouseEnter:(e,t)=>o(t.id),onNodeMouseLeave:()=>s(),onPaneClick:()=>c(),onNodeDrag:(e,t)=>l(t),onNodeDragStop:(e,t)=>u(t),onNodesChange:i,proOptions:{hideAttribution:!0},children:[(0,X.jsx)(iC,{}),(0,X.jsx)(pC,{}),(0,X.jsx)(AC,{className:`specplan-minimap`,nodeColor:bw,pannable:!0,position:`top-right`,style:{width:150,height:104},zoomable:!0}),f&&(0,X.jsx)(vw,{preview:f})]}),(0,X.jsx)(_w,{items:p,resolve:m,onReveal:h}),g&&(0,X.jsx)(`div`,{className:`toast`,"data-testid":`toast`,role:`alert`,children:g}),_]})}function bw(e){return e.type===`capability`?`#5ba3e8`:e.type===`capGroup`?`#8a8a8a`:e.type===`story`?`#3a3a3a`:`#e8925b`}function xw(e){return(0,X.jsx)(GS,{children:(0,X.jsx)(yw,{...e})})}function Sw(e,t){let n=e.slice(0,Math.max(0,Math.min(t,e.length))),r=n.lastIndexOf(`@`);if(r===-1)return null;let i=r===0?``:n[r-1];if(i!==``&&!/[\s([{'"`]/.test(i))return null;let a=n.slice(r+1);return/\s/.test(a)||a.includes(`@`)?null:{start:r,query:a}}function Cw(e,t,n,r){let i=e.slice(0,t.start),a=Math.max(t.start,Math.min(n,e.length));for(;a<e.length&&!/\s/.test(e[a]);)a++;let o=e.slice(a);if(r.endsWith(`/`)){let e=`@${r}`;return{text:i+e+o,caret:i.length+e.length}}let s=o.startsWith(` `),c=`@${r}${s?``:` `}`;return{text:i+c+o,caret:i.length+c.length+ +!!s}}function ww(e,t,n){let[r,i]=(0,G.useState)(null),[a,o]=(0,G.useState)([]),[s,c]=(0,G.useState)(0);function l(){let t=e.current;i(t?Sw(t.value,t.selectionStart??t.value.length):null)}let u=r?.query;(0,G.useEffect)(()=>{if(u===void 0||!n){o([]);return}let e=!1,t=setTimeout(()=>{n(u).then(t=>{e||(o(t),c(0))}).catch(()=>{})},120);return()=>{e=!0,clearTimeout(t)}},[u,n]);let d=r!==null&&a.length>0;function f(n){let a=e.current;if(!a||!r)return;let o=Cw(a.value,r,a.selectionStart??a.value.length,n);t(o.text),i(n.endsWith(`/`)?{start:r.start,query:n}:null),requestAnimationFrame(()=>{a.focus(),a.setSelectionRange(o.caret,o.caret)})}function p(e){if(!d)return!1;if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=e.key===`ArrowDown`?1:a.length-1;return c(e=>(e+t)%a.length),!0}if(e.key===`Enter`||e.key===`Tab`){e.preventDefault();let t=a[s];return t!==void 0&&f(t),!0}return e.key===`Escape`?(e.preventDefault(),i(null),!0):!1}return{open:d,results:a,highlight:s,sync:l,select:f,onKeyDown:p}}function Tw({search:e,placement:t}){return e.open?(0,X.jsx)(`ul`,{"aria-label":`File search results`,className:`at-search ${t}`,role:`listbox`,children:e.results.map((t,n)=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{"aria-selected":n===e.highlight,className:`at-item${n===e.highlight?` active`:``}${t.endsWith(`/`)?` dir`:``}`,onMouseDown:n=>{n.preventDefault(),e.select(t)},role:`option`,type:`button`,children:[`@`,t]})},t))}):null}function Ew(e){return e.map(({role:e,text:t,at:n})=>({role:e,text:t,at:n}))}function Dw({messages:e,pending:t,error:n,onSend:r,onClear:i,searchFiles:a}){let[o,s]=(0,G.useState)(``),c=(0,G.useRef)(null),l=(0,G.useRef)(null),u=ww(l,s,a);(0,G.useEffect)(()=>{c.current?.scrollTo({top:c.current.scrollHeight})},[e.length,t]);function d(){let e=o.trim();!e||t||(s(``),r(e))}return(0,X.jsxs)(`div`,{className:`chat`,children:[(0,X.jsxs)(`div`,{className:`chat-messages`,ref:c,children:[e.length===0&&!n&&(0,X.jsxs)(`div`,{className:`chat-empty`,children:[`Ask the assistant to add specs and stories, link dependencies, contain stories, or reorder items — it applies changes straight to the canvas and can never delete anything. Pull files into context with`,` `,(0,X.jsx)(`code`,{children:`@path/to/file`}),` or `,(0,X.jsx)(`code`,{children:`@filename`}),`.`]}),e.map((e,t)=>(0,X.jsxs)(`div`,{className:`chat-message chat-${e.role}`,children:[(0,X.jsx)(`div`,{className:`chat-role`,children:e.role}),(0,X.jsx)(`div`,{className:`chat-text`,children:e.text}),e.toolCalls&&e.toolCalls.length>0&&(0,X.jsxs)(`details`,{className:`chat-refs chat-tools`,"data-testid":`chat-tools`,open:!0,children:[(0,X.jsxs)(`summary`,{children:[e.toolCalls.length,` change`,e.toolCalls.length===1?``:`s`,` applied`]}),(0,X.jsx)(`ul`,{children:e.toolCalls.map((e,t)=>(0,X.jsxs)(`li`,{children:[e.tool,`: `,e.summary]},`${e.tool}-${t}`))})]}),e.refs&&(e.refs.resolved.length>0||e.refs.unresolved.length>0)&&(0,X.jsxs)(`details`,{className:`chat-refs`,children:[(0,X.jsxs)(`summary`,{children:[e.refs.resolved.length,` file`,e.refs.resolved.length===1?``:`s`,` in context`,e.refs.unresolved.length>0&&`, ${e.refs.unresolved.length} unresolved`]}),(0,X.jsxs)(`ul`,{children:[e.refs.resolved.map(e=>(0,X.jsxs)(`li`,{children:[`@`,e]},e)),e.refs.unresolved.map(e=>(0,X.jsxs)(`li`,{className:`chat-ref-missing`,children:[`@`,e.ref,` — `,e.reason]},e.ref))]})]})]},`${e.at}-${t}`)),t&&(0,X.jsx)(`div`,{"aria-busy":`true`,className:`chat-message chat-assistant chat-thinking`,"data-state":`thinking`,children:`thinking…`}),n&&(0,X.jsx)(`div`,{className:`chat-fault`,children:n})]}),(0,X.jsxs)(`div`,{className:`chat-composer`,children:[(0,X.jsxs)(`div`,{className:`at-anchor`,children:[(0,X.jsx)(Tw,{placement:`up`,search:u}),(0,X.jsx)(`textarea`,{"aria-label":`Chat message`,className:`chat-input`,onChange:e=>{s(e.target.value),u.sync()},onKeyDown:e=>{u.onKeyDown(e)||e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),d())},onSelect:u.sync,placeholder:`Ask to add, link, or reorder… (@ searches files)`,ref:l,rows:2,value:o})]}),(0,X.jsxs)(`div`,{className:`chat-composer-actions`,children:[(0,X.jsx)(`button`,{className:`chat-clear`,disabled:e.length===0&&!n,onClick:i,title:`Clear the conversation and start over`,type:`button`,children:`Clear`}),(0,X.jsx)(`button`,{className:`chat-send`,disabled:t||!o.trim(),onClick:d,type:`button`,children:t?`Sending…`:`Send`})]})]})]})}function Ow({info:e,failed:t,onSave:n,searchFiles:r}){let[i,a]=(0,G.useState)(),o=(0,G.useRef)(null),s=ww(o,a,r);if(t)return(0,X.jsx)(`div`,{className:`empty error`,children:`Could not load the system prompt.`});if(!e)return(0,X.jsx)(`div`,{className:`empty`,children:`Loading the system prompt…`});let c=i??e.system,l=c!==e.system,u=c===e.default&&!e.custom;return(0,X.jsxs)(`div`,{className:`prompt-pane`,children:[(0,X.jsxs)(`div`,{className:`artifact-head`,children:[(0,X.jsxs)(`code`,{className:`path`,children:[`generation system prompt`,e.custom?` — customized`:``,l?` (unsaved)`:``]}),(0,X.jsxs)(`div`,{className:`prompt-actions`,children:[(0,X.jsx)(`button`,{className:`copy`,disabled:u&&!l,onClick:()=>{a(void 0),n(null)},title:`Restore the built-in default prompt`,type:`button`,children:`Reset`}),(0,X.jsx)(`button`,{className:`copy prompt-save`,disabled:!l||!c.trim(),onClick:()=>{n(c),a(void 0)},type:`button`,children:`Save`})]})]}),(0,X.jsxs)(`div`,{className:`at-anchor prompt-anchor`,children:[(0,X.jsx)(Tw,{placement:`down`,search:s}),(0,X.jsx)(`textarea`,{"aria-label":`Generation system prompt`,className:`prompt-editor`,onChange:e=>{a(e.target.value),s.sync()},onKeyDown:e=>void s.onKeyDown(e),onSelect:s.sync,ref:o,spellCheck:!1,value:c})]}),(0,X.jsxs)(`p`,{className:`prompt-hint`,children:[`Drives every generation. `,(0,X.jsx)(`code`,{children:`@path`}),` / `,(0,X.jsx)(`code`,{children:`@filename`}),` references resolve to file contents. Saved edits persist with the plan root.`]})]})}function kw({plan:e,llm:t,onCreateSpec:n,onCreateStory:r,promptInfo:i,promptFailed:a,onSavePrompt:o,chat:s,chatPending:c,chatError:l,onSendChat:u,onClearChat:d,searchFiles:f}){let[p,m]=(0,G.useState)(`backlog`),[h,g]=(0,G.useState)(!1),_=[{key:`backlog`,label:`Backlog`},...t?[{key:`chat`,label:`Chat`},{key:`prompt`,label:`System Prompt`}]:[]];return h?(0,X.jsx)(`button`,{"aria-label":`Show planning pane`,className:`panel-reopen`,"data-testid":`panel-reopen`,onClick:()=>g(!1),title:`Show planning pane`,type:`button`,children:`«`}):(0,X.jsxs)(`aside`,{className:`panel`,"aria-label":`Planning pane`,children:[(0,X.jsxs)(`nav`,{className:`pane-nav`,"aria-label":`Side pane options`,children:[_.map(e=>(0,X.jsx)(`button`,{className:p===e.key?`pane-item active`:`pane-item`,onClick:()=>m(e.key),type:`button`,children:e.label},e.key)),(0,X.jsx)(`button`,{"aria-label":`Hide planning pane`,className:`pane-collapse`,"data-testid":`panel-collapse`,onClick:()=>g(!0),title:`Hide planning pane`,type:`button`,children:`»`})]}),p===`backlog`&&(0,X.jsx)(Aw,{plan:e,onCreateSpec:n,onCreateStory:r,searchFiles:f}),p===`chat`&&t&&(0,X.jsx)(Dw,{messages:s,pending:c,error:l,onSend:u,onClear:d,searchFiles:f}),p===`prompt`&&t&&(0,X.jsx)(Ow,{failed:a,info:i,onSave:o,searchFiles:f})]})}function Aw({plan:e,onCreateSpec:t,onCreateStory:n,searchFiles:r}){let[i,a]=(0,G.useState)(null),{specs:o,stories:s}=FC(e),c=(e,t,n,r)=>(0,X.jsxs)(`div`,{className:`backlog-section`,"data-testid":t,children:[(0,X.jsx)(`h2`,{children:e}),n.length===0?(0,X.jsx)(`p`,{className:`hint`,children:r}):(0,X.jsx)(`ul`,{className:`backlog-list`,children:n.map(e=>(0,X.jsxs)(`li`,{className:`backlog-item`,draggable:e.type===`proposal`,onDragStart:t=>{t.dataTransfer.setData(`application/specplan-node`,e.id),t.dataTransfer.effectAllowed=`copy`},children:[e.type===`user_story`?e.text:e.title,(0,X.jsx)(`span`,{className:`backlog-id`,children:e.id})]},e.id))})]});return(0,X.jsxs)(`div`,{className:`backlog-pane`,"aria-label":`Backlog`,children:[(0,X.jsxs)(`div`,{className:`backlog-actions`,children:[(0,X.jsx)(`button`,{className:`chat-send`,onClick:()=>a(`spec`),type:`button`,children:`New spec…`}),(0,X.jsx)(`button`,{className:`chat-send`,onClick:()=>a(`story`),type:`button`,children:`New story…`})]}),(0,X.jsx)(`p`,{className:`hint`,children:`Not yet linked into the plan — drag a link on the canvas (or ask the chat) and an item clears from this list.`}),c(`Specs`,`backlog-specs`,o,`Every spec is linked into the plan.`),c(`User stories`,`backlog-stories`,s,`Every story is covered by a spec.`),i&&(0,X.jsx)(jw,{kind:i,onCreateSpec:t,onCreateStory:n,onClose:()=>a(null),searchFiles:r})]})}function jw({kind:e,onCreateSpec:t,onCreateStory:n,onClose:r,searchFiles:i}){let[a,o]=(0,G.useState)(``),[s,c]=(0,G.useState)(``),[l,u]=(0,G.useState)(``),[d,f]=(0,G.useState)(!1),p=(0,G.useRef)(null),m=ww(p,c,i);(0,G.useEffect)(()=>{let e=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]);let h=e===`spec`?!!a.trim():!!l.trim();function g(){!h||d||(f(!0),(e===`spec`?t(a,s):n(l)).then(e=>{e&&r()}).finally(()=>f(!1)))}return(0,X.jsx)(`div`,{className:`dialog-overlay`,onClick:r,role:`presentation`,children:(0,X.jsxs)(`div`,{"aria-label":e===`spec`?`Create spec dialog`:`Create user story dialog`,className:`dialog dialog-create`,"data-testid":`create-dialog`,onClick:e=>e.stopPropagation(),role:`dialog`,children:[(0,X.jsxs)(`div`,{className:`dialog-head`,children:[(0,X.jsx)(`div`,{className:`dialog-title`,children:e===`spec`?`New spec`:`New user story`}),(0,X.jsx)(`div`,{className:`dialog-actions`,children:(0,X.jsx)(`button`,{className:`chat-clear`,onClick:r,type:`button`,children:`Cancel`})})]}),e===`spec`?(0,X.jsxs)(`div`,{className:`plan-form`,children:[(0,X.jsx)(`h2`,{children:`Name`}),(0,X.jsx)(`input`,{"aria-label":`New spec title`,autoFocus:!0,onChange:e=>o(e.target.value),placeholder:`Spec title…`,value:a}),(0,X.jsx)(`h2`,{children:`Description / generation prompt`}),(0,X.jsxs)(`div`,{className:`at-anchor`,children:[(0,X.jsx)(Tw,{placement:`down`,search:m}),(0,X.jsx)(`textarea`,{"aria-label":`Spec description`,onChange:e=>{c(e.target.value),m.sync()},onKeyDown:e=>void m.onKeyDown(e),onSelect:m.sync,placeholder:`What this spec covers — steers generation. @path / @filename pulls files into context…`,ref:p,rows:6,value:s})]})]}):(0,X.jsxs)(`div`,{className:`plan-form`,children:[(0,X.jsx)(`h2`,{children:`Story`}),(0,X.jsx)(`textarea`,{"aria-label":`New user story`,autoFocus:!0,onChange:e=>u(e.target.value),placeholder:`As a <user>, I want to <feature> so that <value>…`,rows:4,value:l})]}),(0,X.jsx)(`div`,{className:`dialog-actions dialog-submit`,children:(0,X.jsx)(`button`,{className:`chat-send`,disabled:!h||d,onClick:g,type:`button`,children:d?`Creating…`:e===`spec`?`Create spec`:`Create story`})})]})})}var Mw=`modulepreload`,Nw=function(e){return`/`+e},Pw={},Fw=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,new URL(`../../../src/node/plugins/importAnalysisBuild.ts`,import.meta.url)).href}r=o(t.map(t=>{if(t=Nw(t,n),t=s(t),t in Pw)return;Pw[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:Mw,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Iw=new Nu({html:!1,linkify:!0}),Lw=(0,G.lazy)(async()=>{let[e]=await Promise.all([Fw(()=>import(`./prod-Ba4uM3Ch.js`),__vite__mapDeps([0,1,2,3,4,5,6])),Fw(()=>Promise.resolve({}),__vite__mapDeps([7]))]);return{default:e.Excalidraw}}),Rw=`diagram.excalidraw`;function zw({source:e}){let t=null,n;try{let n=JSON.parse(e);t={elements:Array.isArray(n.elements)?n.elements:[],appState:{viewBackgroundColor:n.appState?.viewBackgroundColor??`#ffffff`},scrollToContent:!0}}catch(e){n=e instanceof Error?e.message:String(e)}return n===void 0?(0,X.jsx)(`div`,{className:`artifact-body dialog-body excalidraw-preview`,"data-testid":`diagram-preview`,children:(0,X.jsx)(G.Suspense,{fallback:(0,X.jsx)(`div`,{className:`empty`,children:`Loading the diagram…`}),children:(0,X.jsx)(Lw,{initialData:t,viewModeEnabled:!0})})}):(0,X.jsxs)(`div`,{className:`empty error`,"data-testid":`diagram-error`,children:[`Could not parse `,Rw,`: `,n]})}function Bw({specId:e,title:t,kind:n=`change`,generating:r,loadArtifacts:i,onRegenerate:a,onClose:o}){let[s,c]=(0,G.useState)(null),[l,u]=(0,G.useState)(),[d,f]=(0,G.useState)(0),p=(0,G.useCallback)(async()=>{try{c(await i(e)),u(void 0)}catch(e){u(e instanceof Error?e.message:String(e))}},[e,i]);(0,G.useEffect)(()=>{p()},[p]),(0,G.useEffect)(()=>{let e=e=>{e.key===`Escape`&&o()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[o]);let m=[...(s?.files??[]).map(e=>({path:e.path,content:e.content,diagram:!1})),...typeof s?.diagram==`string`?[{path:Rw,content:s.diagram,diagram:!0}]:[]],h=m[Math.min(d,Math.max(m.length-1,0))],g=n===`capability`?`openspec/specs/${e}/`:`openspec/changes/${e}/`;return(0,X.jsx)(`div`,{className:`dialog-overlay`,onClick:o,role:`presentation`,children:(0,X.jsxs)(`div`,{"aria-label":n===`capability`?`Capability spec for ${t} (read-only)`:`OpenSpec change for ${t}`,className:`dialog`,"data-testid":`spec-dialog`,onClick:e=>e.stopPropagation(),role:`dialog`,children:[(0,X.jsxs)(`div`,{className:`dialog-head`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`div`,{className:`dialog-title`,children:t}),(0,X.jsx)(`code`,{className:`dialog-path`,children:g})]}),(0,X.jsxs)(`div`,{className:`dialog-actions`,children:[a&&(0,X.jsx)(`button`,{className:`chat-send`,disabled:r,onClick:()=>{a().then(e=>{e&&p()})},title:s?.handEdited?`Body is hand-edited — regeneration updates metadata only`:`Re-run generation from the card’s current stories and dependencies`,type:`button`,children:r?`Regenerating…`:`Regenerate`}),(0,X.jsx)(`button`,{className:`chat-clear`,onClick:o,type:`button`,children:`Close`})]})]}),s?.handEdited&&(0,X.jsxs)(`p`,{className:`dialog-notice dialog-notice--warning`,"data-state":`hand-edited`,"data-testid":`hand-edited-notice`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,children:`⚠`}),` This change's body was edited outside specplan (or predates it) — Regenerate updates only the plan metadata and leaves every .md file untouched.`]}),l&&(0,X.jsx)(`div`,{className:`empty error`,children:l}),!l&&!s&&(0,X.jsx)(`div`,{className:`empty`,children:n===`capability`?`Loading the spec…`:`Loading the change…`}),!l&&s&&m.length===0&&(0,X.jsx)(`div`,{className:`empty`,children:`No body files on disk (metadata only so far).`}),h&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`tabs`,children:m.map((e,t)=>(0,X.jsx)(`button`,{className:t===d?`tab active`:`tab`,onClick:()=>f(t),type:`button`,children:e.path},e.path))}),(0,X.jsxs)(`div`,{className:`artifact-head`,children:[(0,X.jsxs)(`code`,{className:`path`,children:[g,h.path]}),!h.diagram&&(0,X.jsx)(`button`,{className:`copy`,onClick:()=>navigator.clipboard?.writeText(h.content),type:`button`,children:`Copy`})]}),h.diagram?(0,X.jsx)(zw,{source:h.content}):h.path.endsWith(`.md`)?(0,X.jsx)(`div`,{className:`artifact-body dialog-body artifact-rendered`,dangerouslySetInnerHTML:{__html:Iw.render(h.content)},"data-testid":`artifact-rendered`}):(0,X.jsx)(`pre`,{className:`artifact-body dialog-body`,children:h.content})]})]})})}function Vw({session:e,api:t}){let n=t.llm,[r,i]=(0,G.useState)(e.plan),[a,o]=(0,G.useState)(e.specStates),[s,c]=(0,G.useState)(()=>e.collapsedGroups??$C(IC(e.plan.nodes.filter(e=>e.type===`capability`)).map(e=>e.id))),l=(0,G.useRef)(s),[u,d]=(0,G.useState)(e.hideEmptySpecs??!1),f=(0,G.useRef)(u),p=(0,G.useRef)(KC(e.plan,s,{hideEmptyCaps:u})),[m,h]=(0,G.useState)(()=>dw(e.plan,p.current,void 0,e.specStates)),[g,_]=(0,G.useState)(()=>fw(e.plan,p.current)),[v,y]=(0,G.useState)(null),[b,x]=(0,G.useState)(null),[S,C]=(0,G.useState)(null),w=S??b,[T,E]=(0,G.useState)(0),D=(0,G.useCallback)(()=>E(e=>e+1),[]),[O,k]=(0,G.useState)(null),[A,j]=(0,G.useState)(null),[M,ee]=(0,G.useState)(null),te=(0,G.useRef)(e.model??`claude-opus-4-8`),[ne,N]=(0,G.useState)(te.current),P=(0,G.useRef)(void 0),[re,F]=(0,G.useState)();(0,G.useEffect)(()=>{if(!re)return;let e=setTimeout(()=>F(void 0),4e3);return()=>clearTimeout(e)},[re]);let I=(0,G.useCallback)(e=>{let t=r.nodes.find(t=>t.id===e);return t?t.type===`user_story`?t.text.slice(0,40):t.title:e},[r]),[ie,L]=(0,G.useState)(e.chat??[]),[R,ae]=(0,G.useState)(!1),[oe,se]=(0,G.useState)();async function ce(e){let t=e.trim();if(!t||R||!n)return;let r=Ew(ie);L(e=>[...e,{role:`user`,text:t,at:new Date().toISOString()}]),ae(!0),se(void 0);try{let e=await n.chat(t,r,te.current);i(e.plan),L(t=>[...t,{...e.reply,...e.toolCalls.length>0?{toolCalls:e.toolCalls}:{},...e.resolvedRefs.length>0||e.unresolvedRefs.length>0?{refs:{resolved:e.resolvedRefs,unresolved:e.unresolvedRefs}}:{}}])}catch(e){se(e instanceof Error?e.message:String(e))}finally{ae(!1)}}function le(){L([]),se(void 0),n?.clearChat().catch(()=>{})}let[ue,de]=(0,G.useState)(),[fe,pe]=(0,G.useState)(!1);(0,G.useEffect)(()=>{if(!n)return;let e=!1;return n.getPrompt().then(t=>{e||de(t)}).catch(()=>{e||pe(!0)}),()=>{e=!0}},[n]);function me(e){ue&&(de(e===null?{...ue,system:ue.default,custom:!1}:{...ue,system:e,custom:e!==ue.default}),n?.savePrompt(e).catch(()=>{}))}let he=(0,G.useCallback)(async e=>{if(!n)return null;k(e);try{let t=await n.generate(e,te.current);return F(t.mode===`metadata-only`?`Body is hand-edited — updated metadata only, .md files untouched.`:`Generated + validated: ${t.changedFiles.length} file${t.changedFiles.length===1?``:`s`} changed.`),o(n=>{let r=n[e]?.status??`draft`;return{...n,[e]:t.mode===`generated`?{...n[e],hasSpec:!0,handEdited:!1,status:r}:n[e]??{hasSpec:!0,handEdited:!0,status:r}}}),t.mode}catch(e){return F(e instanceof Error?e.message:String(e)),null}finally{k(null)}},[n]),ge=(0,G.useCallback)(async(e,n)=>{try{await t.setStatus(e,n),o(t=>({...t,[e]:{...t[e]??{hasSpec:!1,handEdited:!1,status:n},status:n}}))}catch(e){F(e instanceof Error?e.message:String(e))}},[t]),_e=(0,G.useCallback)(async(e,n)=>{try{await t.setImplemented(e,n),o(t=>({...t,[e]:{...t[e]??{hasSpec:!1,handEdited:!1,status:`draft`},implemented:n}}))}catch(e){F(e instanceof Error?e.message:String(e))}},[t]),ve=(0,G.useCallback)(async(e,n)=>{try{return{status:`ok`,result:await t.apply(e,n)}}catch(e){return e instanceof So&&e.handEdit?{status:`hand-edit`}:{status:`error`,message:e instanceof Error?e.message:String(e)}}},[t]),ye=(0,G.useCallback)(e=>{(async()=>{try{let n=await t.loadSession();i(n.plan),o(n.specStates);let r=e.newCapabilities.length;F(`Applied ${I(e.specId)} — folded into specs/ and archived.`+(r>0?` +${r} capability root${r===1?``:`s`}.`:``))}catch{F(`Applied — reload to see the folded state.`)}})()},[t,I]);(0,G.useEffect)(()=>{let e=KC(r,s,{hideEmptyCaps:u});p.current=e,h(dw(r,e,{...n?{generate:e=>void he(e)}:{},generatingId:O,setStatus:(e,t)=>void ge(e,t),setImplemented:(e,t)=>void _e(e,t),apply:e=>{let t=r.nodes.find(t=>t.id===e);ee({id:e,title:t?.type===`proposal`?t.title:e})}},a)),_(fw(r,e))},[r,O,he,ge,_e,a,s,u,n,T]);let be=(0,G.useMemo)(()=>pw(m,g,w),[m,g,w]),xe=(0,G.useMemo)(()=>hw(m,be),[m,be]),Se=(0,G.useMemo)(()=>gw(g,be),[g,be]),Ce=(0,G.useCallback)(()=>{clearTimeout(P.current),P.current=setTimeout(()=>{t.saveUiState({...t.llm?{model:te.current}:{},collapsedGroups:l.current,hideEmptySpecs:f.current}).catch(()=>{})},800)},[t]),we=(0,G.useCallback)(()=>{d(e=>{let t=!e;return f.current=t,t}),Ce()},[Ce]),Te=(0,G.useCallback)(e=>{let t=IC(r.nodes.filter(e=>e.type===`capability`)).map(e=>e.id);c(n=>{let r=new Set(n);if(r.has(e)){r.delete(e);let n=QC(ZC(t),e);for(let e of n?.children??[])r.add(e.key)}else{r.add(e);for(let t of[...r])t.startsWith(`${e}-`)&&r.delete(t)}let i=[...r];return l.current=i,i}),Ce()},[r,Ce]);function Ee(e){te.current=e,N(e),Ce()}let De=(0,G.useCallback)(e=>e.rowKeys.filter(e=>e!==`__unscheduled`&&e!==`__stories`),[]),Oe=(0,G.useCallback)(async e=>{try{await t.arrangeRow(e),i(t=>({...t,nodes:t.nodes.map(t=>{let n=e.indexOf(t.id);return n===-1?t:{...t,order:n}})}))}catch(e){F(e instanceof Error?e.message:String(e))}},[t]),ke=(0,G.useCallback)(e=>{let t=e.map(e=>e.type!==`position`||!e.position?e:r.nodes.find(t=>t.id===UC(e.id))?.type===`capability`?{...e,position:{...e.position,x:80}}:e);h(e=>Tb(t,e))},[r]),Ae=(0,G.useCallback)(e=>{let{rowIndex:t,col:n}=qC(e.position.x,e.position.y),r=p.current.rowKeys.length;y({rowIndex:Math.max(0,Math.min(t,r)),col:Math.max(0,n)})},[]),je=(0,G.useCallback)((e,t)=>{let n=IC(r.nodes.filter(e=>e.type===`capability`)).map(e=>e.id),{rowIndex:i}=qC(e.position.x,e.position.y),a=n.filter(e=>e!==t),o=Math.max(0,Math.min(i,a.length)),s=[...a.slice(0,o),t,...a.slice(o)];if(s.every((e,t)=>e===n[t])){D();return}Oe(s)},[r,Oe,D]),Me=(0,G.useCallback)(async(e,n,a,o)=>{try{if(!r.edges.some(t=>t.type===`targets`&&t.from===a&&t.to===e)){let n=await t.link(a,e);i(e=>({...e,edges:[...e.edges,n]}))}let s=YC(JC((p.current.occupantsByRow.get(n)??[]).filter(t=>t!==e),e,o),r);await Oe(s),F(`Scheduled ${I(e)}.`)}catch(e){F(e instanceof Error?e.message:String(e))}},[t,r,Oe,I]),Ne=(0,G.useCallback)(async(e,n)=>{let a=p.current.capsByRow.get(n)??(VC(n)===null?[n]:[]),o=r.edges.filter(t=>t.type===`targets`&&t.to===e&&a.includes(t.from));try{if(o.length>0){for(let e of o)await t.unlink(e.from,e.to);i(t=>({...t,edges:t.edges.filter(t=>!(t.type===`targets`&&t.to===e&&a.includes(t.from)))})),F(`Unscheduled ${I(e)}.`);return}let n=r.edges.filter(t=>t.type===`stacked`&&t.from===e).map(e=>e.to);if(n.length===0){D();return}let s=new Map(r.nodes.map(e=>[e.id,e.order])),c=n.sort((e,t)=>(s.get(e)??0)-(s.get(t)??0)||e.localeCompare(t))[0];await t.unlink(e,c),i(t=>({...t,edges:t.edges.filter(t=>!(t.type===`stacked`&&t.from===e&&t.to===c))})),F(`Removed dependency ${I(c)}.`)}catch(e){F(e instanceof Error?e.message:String(e))}},[t,r,I,D]),Pe=(0,G.useCallback)(e=>{y(null);let t=UC(e.id),n=r.nodes.find(e=>e.id===t);if(!n){D();return}if(n.type===`capability`){je(e,t);return}if(n.type!==`proposal`){D();return}let i=p.current,{rowIndex:a,col:o}=qC(e.position.x,e.position.y),s=De(i),c=WC(e.id),l=a>=0&&a<s.length?s[a]:void 0,u=Math.max(1,o);if(l===void 0||o<0){c?Ne(t,c):D();return}let d=i.capsByRow.get(l)??[];if(d.length===0){D();return}if(c===l){let e=YC(JC((i.occupantsByRow.get(l)??[]).filter(e=>e!==t),t,u),r);Oe(e);return}Me(t,l,d[0],u)},[r,De,Oe,Ne,je,Me,D]),Fe=(0,G.useCallback)((e,t,n)=>{let i=r.nodes.find(t=>t.id===e);if(!i)return;if(i.type===`user_story`){F(`Stories are scheduled by containing them in a proposal.`);return}let a=p.current,{rowIndex:o,col:s}=qC(t,n),c=De(a),l=o>=0&&o<c.length?c[o]:void 0;if(!l){F(`Drop onto a spec row to schedule the card.`);return}let u=a.capsByRow.get(l)??[];if(u.length===0){F(`That row can’t hold a card.`);return}Me(e,l,u[0],Math.max(1,s))},[r,De,Me]);async function Ie(e,n){try{let r=await t.createSpec(e,n);return i(e=>({...e,nodes:[...e.nodes,r]})),!0}catch(e){return F(e instanceof Error?e.message:String(e)),!1}}async function Le(e){try{let n=await t.createStory(e);return i(e=>({...e,nodes:[...e.nodes,n]})),!0}catch(e){return F(e instanceof Error?e.message:String(e)),!1}}let Re=(0,G.useCallback)(async(e,n)=>{try{let r=await t.link(e,n);return i(e=>({...e,edges:[...e.edges,r]})),!0}catch(e){return F(e instanceof Error?e.message:String(e)),!1}},[t]),ze=(0,G.useCallback)(async(e,t,n)=>{let r=KC(e,s,{hideEmptyCaps:u}),i=new Map(e.nodes.map(e=>[e.id,e.order])),a=(e,t)=>(i.get(e)??0)-(i.get(t)??0)||e.localeCompare(t),o=[],c=!1;for(let i of r.rowKeys){let s=r.occupantsByRow.get(i)??[];if(!s.includes(t)||!s.includes(n))continue;let l=[...s].sort(a),u=YC(l,e);u.some((e,t)=>e!==l[t])&&(c=!0);for(let e of u)o.includes(e)||o.push(e)}c&&o.length>0?(await Oe(o),F(`Arranged ${I(t)} after ${I(n)}.`)):D()},[s,u,Oe,I,D]),Be=(0,G.useCallback)(e=>{if(!e.source||!e.target)return;let n=r.nodes.find(t=>t.id===UC(e.source)),a=r.nodes.find(t=>t.id===UC(e.target));if(n?.type===`proposal`&&a?.type===`proposal`){(async()=>{try{let e=await t.link(a.id,n.id),o={...r,edges:[...r.edges,e]};i(o),await ze(o,e.from,e.to)}catch(e){F(e instanceof Error?e.message:String(e))}})();return}n&&a&&Re(n.id,a.id)},[t,Re,r,ze]),Ve=(0,G.useCallback)(async(e,n)=>{try{await t.unlink(e,n),i(t=>({...t,edges:t.edges.filter(t=>!(t.from===e&&t.to===n))})),F(`Unlinked ${I(e)} -> ${I(n)}.`)}catch(e){F(e instanceof Error?e.message:String(e))}},[t,I]),He=(0,G.useCallback)(e=>{let t=e.filter(e=>e.type!==`remove`);t.length>0&&_(e=>Eb(t,e));for(let t of e){if(t.type!==`remove`)continue;let[e,n]=t.id.split(`->`);e&&n&&Ve(e,n)}},[Ve]),Ue=(0,G.useMemo)(()=>r.nodes.filter(e=>e.type===`capability`||e.type===`proposal`).map(e=>({id:e.id,label:(e.type,e.title),kind:e.type===`capability`?`capability`:`proposal`})),[r]),We=(0,G.useCallback)(e=>{let t=p.current,n=r.nodes.find(t=>t.id===e);if(!n)return null;if(n.type===`capability`)return t.hidden.has(e)?`hidden`:t.positions[e]??null;let i=t.memberRowsByProp.get(e)??[],a=i.length>0?HC(e,i[0]):e;return t.positions[a]??null},[r]),Ge=(0,G.useCallback)(e=>{c(t=>{let n=t.filter(t=>!(e===t||e.startsWith(`${t}-`)));return n.length===t.length?t:(l.current=n,n)}),Ce()},[Ce]);return(0,G.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(C(null),x(null))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,X.jsxs)(`div`,{className:`app`,children:[(0,X.jsx)(tw,{rootName:e.rootName,hideEmptySpecs:u,onToggleHideEmpty:we,...n?{model:ne,onModelChange:Ee}:{}}),(0,X.jsxs)(`main`,{className:`workspace`,children:[(0,X.jsxs)(xw,{rfNodes:xe,rfEdges:Se,onConnect:Be,onEdgesChange:He,onNodesChange:ke,onNodeDrag:Ae,onNodeDragStop:Pe,onBacklogDrop:Fe,dragPreview:v,searchItems:Ue,resolveCard:We,revealCard:Ge,onNodeMouseEnter:e=>x(UC(e)),onNodeMouseLeave:()=>x(null),onPaneClick:()=>C(null),onNodeClick:e=>{let t=VC(e);if(t!==null){C(e),Te(t);return}let n=UC(e);C(n);let i=r.nodes.find(e=>e.id===n);i?.type===`capability`?j({id:i.id,title:i.title,kind:`capability`}):i?.type===`proposal`&&a[n]?.hasSpec&&j({id:i.id,title:i.title,kind:`proposal`})},toast:re,children:[A&&(0,X.jsx)(Bw,{specId:A.id,title:A.title,kind:A.kind===`capability`?`capability`:`change`,generating:O===A.id,loadArtifacts:A.kind===`capability`?async e=>{let{content:n}=await t.getCapabilitySpec(e);return{specId:e,handEdited:!1,files:[{path:`spec.md`,content:n}]}}:e=>t.getSpecArtifacts(e),...n&&A.kind===`proposal`?{onRegenerate:()=>he(A.id)}:{},onClose:()=>j(null)}),M&&(0,X.jsx)(nw,{specId:M.id,title:M.title,apply:e=>ve(M.id,e),onApplied:ye,onClose:()=>ee(null)})]}),(0,X.jsx)(kw,{plan:r,llm:!!n,onCreateSpec:Ie,onCreateStory:Le,promptInfo:ue,promptFailed:fe,onSavePrompt:me,chat:ie,chatPending:R,chatError:oe,onSendChat:ce,onClearChat:le,searchFiles:n?e=>n.searchFiles(e):void 0})]})]})}var Hw=Eo(`/api`,{llm:!0});function Uw(){let[e,t]=(0,G.useState)({mode:`loading`}),[n,r]=(0,G.useState)(()=>{let e=new URLSearchParams(window.location.search);if(e.get(`view`)===`canvas`)return{kind:`canvas`};let t=e.get(`change`);return t===null||t===``?{kind:`gallery`}:{kind:`preview`,id:t}}),[i,a]=(0,G.useState)(null),o=e=>{let t=new URL(window.location.href);t.searchParams.set(`change`,e),t.searchParams.delete(`view`),window.history.pushState({},``,t),a(null),r({kind:`preview`,id:e})},s=()=>{let e=new URL(window.location.href);e.searchParams.delete(`change`),window.history.pushState({},``,e),r({kind:`gallery`})},[c,l]=(0,G.useState)(null);return(0,G.useEffect)(()=>{Do(Hw).then(t)},[]),(0,G.useEffect)(()=>{if(n.kind!==`preview`)return;let e=n.id;fetch(`/api/gallery/${encodeURIComponent(e)}`).then(e=>e.ok?e.json():null).then(a).catch(()=>a(null))},[n]),(0,G.useEffect)(()=>{n.kind!==`gallery`||c!==null||fetch(`/api/gallery`).then(e=>e.ok?e.json():null).then(e=>l(e??{roadmap:[],backlog:[]})).catch(()=>l({roadmap:[],backlog:[]}))},[n.kind,c]),e.mode===`loading`?(0,X.jsx)(`div`,{className:`boot`,"data-state":`loading`,children:`Loading…`}):e.mode===`error`?(0,X.jsxs)(`div`,{className:`boot boot-error`,"data-state":`error`,role:`alert`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,children:`✕`}),` Could not reach the specplan server: `,e.detail,`. Launch it with`,` `,(0,X.jsx)(`code`,{children:`specplan [rootDir]`}),` and reload.`]}):n.kind===`gallery`?c===null?(0,X.jsx)(`div`,{className:`boot`,"data-state":`loading`,children:`Reading changes…`}):(0,X.jsx)(td,{backlog:c.backlog,onAddToRoadmap:e=>{fetch(`/api/gallery/roadmap`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({id:e})}).then(()=>l(null)).catch(()=>l(null))},archived:c.archived??[],missing:c.missing??[],onDelete:e=>{fetch(`/api/gallery/${encodeURIComponent(e)}`,{method:`DELETE`}).then(()=>l(null)).catch(()=>l(null))},onOpen:o,onReorder:(e,t)=>{fetch(`/api/gallery/reorder`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({id:e,before:t})}).then(()=>l(null)).catch(()=>l(null))},roadmap:c.roadmap}):n.kind===`preview`?i===null?(0,X.jsx)(`div`,{className:`boot`,"data-state":`loading`,children:`Reading the change…`}):(0,X.jsx)(zu,{onBack:s,preview:i}):(0,X.jsx)(Vw,{session:e.session,api:Hw})}var Ww=document.getElementById(`root`);if(!Ww)throw Error(`Missing #root element`);(0,K.createRoot)(Ww).render((0,X.jsx)(G.StrictMode,{children:(0,X.jsx)(Uw,{})}));export{ym as a,Tp as c,Cp as d,wp as f,i as g,c as h,Em as i,Jp as l,Fu as m,Ny as n,dm as o,sp as p,Ay as r,pm as s,Fw as t,Kp as u};
92
+ M${w.x},${w.y}h${w.width}v${w.height}h${-w.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}kC.displayName=`MiniMap`;var AC=(0,G.memo)(kC),jC=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,MC={[hy.Line]:`right`,[hy.Handle]:`bottom-right`};function NC({nodeId:e,position:t,variant:n=hy.Handle,className:r,style:i=void 0,children:a,color:o,minWidth:s=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:p=!0,shouldResize:m,onResizeStart:h,onResize:g,onResizeEnd:_}){let v=cx(),y=typeof e==`string`?e:v,b=Gy(),x=(0,G.useRef)(null),S=n===hy.Handle,C=$((0,G.useCallback)(jC(S&&p),[S,p]),By),w=(0,G.useRef)(null),T=t??MC[n];return(0,G.useEffect)(()=>{if(!(!x.current||!y))return w.current||=Ey({domNode:x.current,nodeId:y,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=b.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=b.getState(),o=[],s={x:e.x,y:e.y},c=r.get(y);if(c&&c.expandParent&&c.parentId){let t=c.origin??a,n=e.width??c.measured.width??0,l=e.height??c.measured.height??0,u=Nv([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...R_({x:e.x??c.position.x,y:e.y??c.position.y},{width:n,height:l},c.parentId,r,t)}}],r,i,a);o.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*l,e.y):void 0}if(s.x!==void 0&&s.y!==void 0){let e={id:y,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:y,type:`dimensions`,resizing:!0,setAttributes:f?f===`horizontal`?`width`:`height`:!0,dimensions:{width:e.width,height:e.height}};o.push(t)}for(let e of t){let t={...e,type:`position`};o.push(t)}n(o)},onEnd:({width:e,height:t})=>{let n={id:y,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};b.getState().triggerNodeChanges([n])}}),w.current.update({controlPosition:T,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:_,shouldResize:m}),()=>{w.current?.destroy()}},[T,s,c,l,u,d,h,g,_,m]),(0,X.jsx)(`div`,{className:nd([`react-flow__resize-control`,`nodrag`,...T.split(`-`),n,r]),ref:x,style:{...i,scale:C,...o&&{[S?`backgroundColor`:`borderColor`]:o}},children:a})}(0,G.memo)(NC);function PC(e,t){return e.edges.filter(e=>e.type===`stacked`&&e.from===t).map(e=>e.to)}function FC(e){let t=new Set(e.edges.flatMap(e=>[e.from,e.to])),n=e.nodes.filter(e=>!t.has(e.id));return{specs:IC(n.filter(e=>e.type===`proposal`)),stories:IC(n.filter(e=>e.type===`user_story`))}}function IC(e){return[...e].sort((e,t)=>e.order-t.order)}var LC=`__unscheduled`,RC=`__stories`,zC=`group:`;function BC(e){return`${zC}${e}`}function VC(e){return e.startsWith(`group:`)?e.slice(6):null}function HC(e,t){return`${e}@${t}`}function UC(e){let t=e.indexOf(`@`);return t===-1?e:e.slice(0,t)}function WC(e){let t=e.indexOf(`@`);return t===-1?null:e.slice(t+1)}function GC(e){let t=new Map;for(let n of e.edges){if(n.type!==`targets`)continue;let e=t.get(n.to)??[];e.push(n.from),t.set(n.to,e)}let n=new Map(e.nodes.map(e=>[e.id,e.order])),r=new Map,i=a=>{let o=r.get(a);if(o)return o;r.set(a,[]);let s=t.get(a),c=[];if(s&&s.length>0)c=[...s];else{let t=PC(e,a).slice().sort((e,t)=>(n.get(e)??0)-(n.get(t)??0)||e.localeCompare(t));for(let e of t){let t=i(e);if(t.length>0){c=t;break}}}return r.set(a,c),c},a=new Map;for(let t of e.nodes)t.type===`proposal`&&a.set(t.id,i(t.id));return a}function KC(e,t,n){let r={positions:{},cells:[],rowKeys:[],rowIndexByKey:new Map,rowContainerByCap:new Map,capsByRow:new Map,memberRowsByProp:new Map,occupantsByRow:new Map,hidden:new Set,groupMeta:new Map},i=GC(e),a=IC(e.nodes.filter(e=>e.type===`capability`)).map(e=>e.id);if(n?.hideEmptyCaps){let e=new Set;for(let t of i.values())for(let n of t)e.add(n);a=a.filter(t=>e.has(t))}ew(a,t).forEach((e,t)=>{if(e.kind===`node`)r.rowContainerByCap.set(e.id,e.id),r.capsByRow.set(e.id,[e.id]),r.rowKeys.push(e.id),r.rowIndexByKey.set(e.id,t);else{let n=BC(e.key);if(r.groupMeta.set(n,{key:e.key,count:e.memberIds.length,collapsed:e.collapsed}),e.collapsed){r.capsByRow.set(n,e.memberIds.slice());for(let t of e.memberIds)r.rowContainerByCap.set(t,n),r.hidden.add(t)}else r.capsByRow.set(n,[]);r.rowKeys.push(n),r.rowIndexByKey.set(n,t)}});let o=IC(e.nodes.filter(e=>e.type===`proposal`)),s=[];for(let e of o){let t=i.get(e.id)??[],n=[];for(let e of t){let t=r.rowContainerByCap.get(e);t!==void 0&&!n.includes(t)&&n.push(t)}if(r.memberRowsByProp.set(e.id,n),n.length===0){s.push(e.id);continue}for(let t of n){let n=r.occupantsByRow.get(t)??[];n.push(e.id),r.occupantsByRow.set(t,n)}}let c=new Map(e.nodes.map(e=>[e.id,e.order])),l=(e,t)=>(c.get(e)??0)-(c.get(t)??0)||e.localeCompare(t);for(let[t,n]of r.occupantsByRow)r.occupantsByRow.set(t,YC(n.sort(l),e));let u=(e,t,n,i,a,o)=>{r.positions[e]={x:80+a*280,y:80+o*170},r.cells.push({nodeId:e,baseId:t,kind:n,rowKey:i,col:a})};r.rowKeys.forEach((e,t)=>{let n=VC(e)===null?`capability`:`group`;u(e,e,n,e,0,t),(r.occupantsByRow.get(e)??[]).forEach((n,r)=>{u(HC(n,e),n,`proposal`,e,r+1,t)})});let d=r.rowKeys.length,f=(e,t,n)=>{e.length!==0&&(r.occupantsByRow.set(t,e),r.rowKeys.push(t),r.rowIndexByKey.set(t,d),e.forEach((e,r)=>{let i=Math.floor(r/6);u(e,e,n,t,r%6,d+i)}),d+=Math.ceil(e.length/6))};return f(YC(s.slice().sort(l),e),LC,`proposal`),f(IC(e.nodes.filter(e=>e.type===`user_story`)).map(e=>e.id),RC,`story`),r}function qC(e,t){return{rowIndex:Math.round((t-80)/170),col:Math.round((e-80)/280)}}function JC(e,t,n){let r=n-1;if(r>=0&&r<e.length)return[...e.slice(0,r+1),t,...e.slice(r+1)];let i=Math.max(0,Math.min(r,e.length));return[...e.slice(0,i),t,...e.slice(i)]}function YC(e,t){let n=new Set(e),r=new Map;for(let t of e)r.set(t,new Set);for(let e of t.edges)e.type===`stacked`&&n.has(e.from)&&n.has(e.to)&&r.get(e.from).add(e.to);let i=new Set,a=[];for(;a.length<e.length;){let t=e.find(e=>!i.has(e)&&[...r.get(e)].every(e=>i.has(e)));if(t===void 0){for(let t of e)i.has(t)||a.push(t);break}i.add(t),a.push(t)}return a}function XC(e,t){return e.split(`-`).slice(0,t).join(`-`)}function ZC(e,t=1){let n=[],r=new Map;for(let i of e){let e=XC(i,t),a=r.get(e);a?a.push(i):(r.set(e,[i]),n.push(e))}let i=[];for(let e of n){let n=r.get(e)??[];n.length<2||i.push({key:e,depth:t,memberIds:n,children:ZC(n.filter(t=>t!==e),t+1)})}return i}function QC(e,t){for(let n of e){if(n.key===t)return n;let e=QC(n.children,t);if(e)return e}return null}function $C(e){return ZC(e).map(e=>e.key)}function ew(e,t){let n=new Set(t),r=(e,t)=>{let i=[],a=new Map;for(let n of e){let e=XC(n,t),r=a.get(e);r?r.push(n):(a.set(e,[n]),i.push(e))}let o=[];for(let e of i){let i=a.get(e)??[],s=i[0];if(i.length<2){s!==void 0&&o.push({kind:`node`,id:s});continue}let c=n.has(e);if(o.push({kind:`group`,key:e,depth:t,memberIds:i,collapsed:c}),!c){for(let t of i)t===e&&o.push({kind:`node`,id:t});o.push(...r(i.filter(t=>t!==e),t+1))}}return o};return r(e,1)}function tw({rootName:e,model:t,onModelChange:n,hideEmptySpecs:r,onToggleHideEmpty:i}){return(0,X.jsxs)(`header`,{className:`topbar`,children:[(0,X.jsxs)(`div`,{className:`brand`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`logo`,children:`◇`}),(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`h1`,{children:[(0,X.jsx)(`span`,{className:`brand-coop`,children:`coop`}),` specplan`]}),(0,X.jsxs)(`p`,{children:[`Plan `,(0,X.jsx)(`code`,{className:`canvas-id`,children:e}),` — autosaves to specplan.yaml`]})]})]}),(0,X.jsxs)(`div`,{className:`actions`,children:[i&&(0,X.jsx)(`button`,{"aria-pressed":!!r,className:`hide-empty-toggle${r?` active`:``}`,"data-testid":`hide-empty-toggle`,onClick:i,title:`Hide capability rows with no scheduled items (view only)`,type:`button`,children:r?`Show empty specs`:`Hide empty specs`}),t!==void 0&&n&&(0,X.jsx)(`select`,{"aria-label":`Model`,className:`model-select`,onChange:e=>n(e.target.value),title:`Model used by chat and Generate OpenSpec`,value:t,children:so.map(e=>(0,X.jsx)(`option`,{value:e,children:e.replace(/^claude-/,``)},e))})]})]})}function nw({specId:e,title:t,apply:n,onApplied:r,onClose:i}){let[a,o]=(0,G.useState)(`confirm`),[s,c]=(0,G.useState)(!1),[l,u]=(0,G.useState)();(0,G.useEffect)(()=>{let e=e=>{e.key===`Escape`&&!s&&i()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[i,s]);let d=async e=>{c(!0),u(void 0);try{let t=await n(e);if(t.status===`ok`){r(t.result),i();return}if(t.status===`hand-edit`){o(`hand-edit`);return}u(t.message)}finally{c(!1)}};return(0,X.jsx)(`div`,{className:`dialog-overlay`,onClick:()=>!s&&i(),role:`presentation`,children:(0,X.jsxs)(`div`,{"aria-label":`Apply / Close proposal ${t}`,className:`dialog dialog-apply nodrag nopan`,"data-testid":`apply-dialog`,onClick:e=>e.stopPropagation(),role:`dialog`,children:[(0,X.jsx)(`div`,{className:`dialog-head`,children:(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`div`,{className:`dialog-title`,children:a===`confirm`?`Apply / Close proposal`:`Fold a hand-edited proposal?`}),(0,X.jsx)(`code`,{className:`dialog-path`,children:e})]})}),a===`confirm`?(0,X.jsxs)(`p`,{className:`dialog-notice`,"data-state":`confirm`,"data-testid":`apply-confirm-message`,children:[`Fold `,(0,X.jsx)(`strong`,{children:t}),`'s delta into `,(0,X.jsx)(`code`,{children:`specs/`}),` and archive the change. This is irreversible from the canvas.`]}):(0,X.jsxs)(`p`,{className:`dialog-notice dialog-notice--warning`,"data-state":`hand-edit`,"data-testid":`apply-hand-edit-message`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,children:`⚠`}),` `,(0,X.jsx)(`strong`,{children:t}),`'s body was hand-edited since it was last generated. Applying will fold the hand-edited body as-is — confirm to fold it anyway.`]}),l&&(0,X.jsx)(`div`,{className:`empty error`,"data-testid":`apply-error`,children:l}),(0,X.jsxs)(`div`,{className:`dialog-actions`,children:[(0,X.jsx)(`button`,{className:`chat-clear`,disabled:s,onClick:i,type:`button`,children:`Cancel`}),a===`confirm`?(0,X.jsx)(`button`,{className:`chat-send`,"data-testid":`apply-confirm`,disabled:s,onClick:()=>void d(!1),type:`button`,children:s?`Applying…`:`Apply / Close`}):(0,X.jsx)(`button`,{className:`chat-send`,"data-testid":`apply-confirm-hand-edit`,disabled:s,onClick:()=>void d(!0),type:`button`,children:s?`Applying…`:`Fold hand-edited body`})]})]})})}function rw(e){return e.approved?e.implemented?`implemented`:e.status===`in-progress`?`in-progress`:`approved`:`draft`}var iw=[`in-progress`,`implemented`];function aw(e){return typeof e.onApply==`function`&&e.approved!==!0}function ow({data:e}){let[t,n]=(0,G.useState)(!1),r=rw(e);(0,G.useEffect)(()=>{if(!t)return;let e=()=>n(!1);return window.addEventListener(`click`,e),()=>window.removeEventListener(`click`,e)},[t]);let i=t=>{if(t===`implemented`){e.implemented||e.onImplemented?.(!0);return}e.implemented&&e.onImplemented?.(!1),e.status!==`in-progress`&&e.onStatus?.(`in-progress`)};return(0,X.jsxs)(`div`,{className:`card card-spec${e.hasSpec?` card-has-spec`:``}`,title:e.hasSpec?`An OpenSpec change exists — click to view it`:void 0,children:[(0,X.jsx)(gx,{type:`target`,position:Q.Left}),(0,X.jsxs)(`div`,{className:`card-kind`,children:[`PROPOSAL`,e.hasSpec&&(0,X.jsx)(`span`,{className:`card-badge`,children:`openspec ✓`}),e.specCount!==void 0&&e.specCount>0&&(0,X.jsxs)(`span`,{className:`card-implicated`,children:[e.specCount,` spec`,e.specCount===1?``:`s`]}),e.onStatus&&(e.approved?(0,X.jsxs)(`span`,{className:`card-status-wrap nodrag nopan`,children:[(0,X.jsxs)(`button`,{"aria-label":`Status: ${r}`,className:`card-status status-${r}`,onClick:e=>{e.stopPropagation(),n(e=>!e)},title:`Working state — advance to in-progress / implemented (approved is set by the fold, never here)`,type:`button`,children:[r,` `,(0,X.jsx)(`span`,{"aria-hidden":`true`,children:`▾`})]}),t&&(0,X.jsx)(`span`,{className:`status-menu`,role:`menu`,children:iw.map(e=>(0,X.jsx)(`button`,{className:`status-option status-${e}${e===r?` current`:``}`,onClick:t=>{t.stopPropagation(),n(!1),e!==r&&i(e)},role:`menuitem`,type:`button`,children:e},e))})]}):(0,X.jsx)(`span`,{"aria-label":`Status: draft`,className:`card-status status-draft card-status-static`,children:`draft`}))]}),(0,X.jsx)(`div`,{className:`card-title`,children:e.title}),e.description&&(0,X.jsx)(`div`,{className:`card-text card-description`,children:e.description.length>110?`${e.description.slice(0,110)}…`:e.description}),(e.tasks||e.ledgerStatus)&&(0,X.jsxs)(`div`,{className:`card-completion`,"data-testid":`card-completion`,children:[e.tasks&&(0,X.jsxs)(`span`,{className:`completion-tasks`,children:[e.tasks.done,`/`,e.tasks.total,` tasks`]}),e.ledgerStatus&&(0,X.jsx)(`span`,{className:`completion-ledger`,children:e.ledgerStatus})]}),(!e.hasSpec&&e.onGenerate||aw(e))&&(0,X.jsxs)(`div`,{className:`card-actions`,children:[!e.hasSpec&&e.onGenerate&&(0,X.jsx)(`button`,{className:`card-generate`,disabled:e.generating,onClick:t=>{t.stopPropagation(),e.onGenerate?.()},title:`Generate the OpenSpec change for this spec from its contained stories and dependencies`,type:`button`,children:e.generating?`Generating…`:`Generate OpenSpec`}),aw(e)&&(0,X.jsx)(`button`,{className:`card-apply nodrag nopan`,"data-testid":`card-apply`,onClick:t=>{t.stopPropagation(),e.onApply?.()},title:`Apply / Close — fold this change's delta into specs/ and archive it (irreversible from the canvas)`,type:`button`,children:`Apply / Close`})]}),(0,X.jsx)(gx,{type:`source`,position:Q.Right})]})}function sw({data:e}){return(0,X.jsxs)(`div`,{className:`card card-capability`,title:`Current-truth capability (openspec/specs/) — click to view its spec`,children:[(0,X.jsx)(gx,{type:`target`,position:Q.Left}),(0,X.jsx)(`div`,{className:`card-kind`,children:`SPEC`}),(0,X.jsx)(`div`,{className:`card-title`,children:e.title}),(0,X.jsx)(gx,{type:`source`,position:Q.Right})]})}function cw({data:e}){return(0,X.jsxs)(`div`,{className:`card card-story`,children:[(0,X.jsx)(gx,{type:`target`,position:Q.Left}),(0,X.jsx)(`div`,{className:`card-kind`,children:`user story`}),(0,X.jsx)(`div`,{className:`card-text`,children:e.text})]})}function lw({data:e}){return(0,X.jsxs)(`div`,{className:`card card-group${e.collapsed?` card-group-collapsed`:` card-group-expanded`}`,title:e.collapsed?`Group ${e.label} — click to expand its ${e.count} capabilities`:`Group ${e.label} (expanded) — click to collapse`,children:[(0,X.jsx)(gx,{isConnectable:!1,position:Q.Left,type:`target`}),(0,X.jsxs)(`div`,{className:`card-kind`,children:[`GROUP`,(0,X.jsx)(`span`,{className:`group-count`,children:e.count})]}),(0,X.jsxs)(`div`,{className:`card-title`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`group-caret`,children:e.collapsed?`▸`:`▾`}),e.label]}),(0,X.jsx)(gx,{isConnectable:!1,position:Q.Right,type:`source`})]})}var uw={capability:sw,proposal:ow,story:cw,capGroup:lw};function dw(e,t,n,r){let i=new Map(e.nodes.map(e=>[e.id,e])),a=new Map;for(let t of e.edges){if(t.type!==`targets`)continue;let e=a.get(t.to)??new Set;e.add(t.from),a.set(t.to,e)}let o=e=>a.get(e)?.size??0,s=[];for(let e of t.cells){let a=t.positions[e.nodeId]??{x:0,y:0};if(e.kind===`group`){let n=t.groupMeta.get(e.rowKey);s.push({id:e.nodeId,type:`capGroup`,deletable:!1,draggable:!1,position:a,data:{label:n?.key??e.rowKey,count:n?.count??0,collapsed:n?.collapsed??!0}});continue}let c=i.get(e.baseId);if(!c)continue;if(e.kind===`capability`){s.push({id:e.nodeId,type:`capability`,deletable:!1,draggable:!0,position:a,data:{title:c.type===`capability`?c.title:e.baseId}});continue}if(e.kind===`story`){s.push({id:e.nodeId,type:`story`,deletable:!1,draggable:!1,position:a,data:{text:c.type===`user_story`?c.text:``}});continue}if(c.type!==`proposal`)continue;let l=r?.[c.id];s.push({id:e.nodeId,type:`proposal`,deletable:!1,draggable:!0,position:a,data:{title:c.title,...c.description?{description:c.description}:{},hasSpec:l?.hasSpec===!0,status:l?.status??`draft`,...l?.approved===!0?{approved:!0}:{},...l?.implemented===!0?{implemented:!0}:{},specCount:o(c.id),...l?.tasks?{tasks:l.tasks}:{},...l?.ledgerStatus===void 0?{}:{ledgerStatus:l.ledgerStatus},...n?{...n.generate?{generating:n.generatingId===c.id,onGenerate:()=>n.generate?.(c.id)}:{},onStatus:e=>n.setStatus(c.id,e),...n.setImplemented?{onImplemented:e=>n.setImplemented?.(c.id,e)}:{},...n.apply?{onApply:()=>n.apply?.(c.id)}:{}}:{}}})}return s}function fw(e,t){let n=e=>{let n=t.memberRowsByProp.get(e);return n&&n.length>0?HC(e,n[0]):t.positions[e]?e:null},r=new Set,i=[];for(let a of e.edges){let e=`${a.from}->${a.to}`,o,s,c=!0;if(a.type===`targets`){let n=t.rowContainerByCap.get(a.from);if(n===void 0)continue;let r=VC(n)!==null;o=n,s=t.positions[HC(a.to,n)]?HC(a.to,n):null,r&&(e=`${n}->${a.to}`,c=!1)}else a.type===`containment`?(o=n(a.from),s=t.positions[a.to]?a.to:null):(o=n(a.from),s=n(a.to));!o||!s||!t.positions[o]||!t.positions[s]||r.has(e)||(r.add(e),i.push({id:e,source:o,target:s,deletable:c,className:`edge-${a.type}`,...a.type===`stacked`?{markerEnd:{type:Xg.ArrowClosed}}:{style:{strokeDasharray:`6 4`}}}))}return i}function pw(e,t,n){if(!n)return null;let r=e.filter(e=>UC(e.id)===n);if(r.length===0)return null;let i=o_(r,t),a=new Set(i.map(e=>e.id)),o=new Set([n]);for(let e of i)o.add(UC(e.source)),o.add(UC(e.target));return{bases:o,edgeIds:a}}function mw(e){return(e??``).split(` `).filter(e=>e&&e!==`dimmed`&&e!==`highlighted`).join(` `)}function hw(e,t){return e.map(e=>{let n=mw(e.className),r=(t?t.bases.has(UC(e.id))?`${n} highlighted`.trim():`${n} dimmed`.trim():n)||void 0;return r===e.className?e:{...e,className:r}})}function gw(e,t){return e.map(e=>{let n=mw(e.className),r=(t?t.edgeIds.has(e.id)?`${n} highlighted`.trim():`${n} dimmed`.trim():n)||void 0;return r===e.className?e:{...e,className:r}})}function _w({items:e,resolve:t,onReveal:n}){let{setCenter:r}=Ub(),[i,a]=(0,G.useState)(!1),[o,s]=(0,G.useState)(``),[c,l]=(0,G.useState)(0),u=(0,G.useRef)(null);(0,G.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),a(e=>!e))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,G.useEffect)(()=>{i&&(s(``),l(0),requestAnimationFrame(()=>u.current?.focus()))},[i]);let d=(0,G.useMemo)(()=>{let t=o.trim().toLowerCase();return(t?e.filter(e=>e.label.toLowerCase().includes(t)||e.id.toLowerCase().includes(t)):e).slice(0,20)},[e,o]),f=e=>{let i=e=>void r(e.x+240/2,e.y+132/2,{zoom:1,duration:300}),a=t(e);if(a===`hidden`){n(e),requestAnimationFrame(()=>{let n=t(e);n&&n!==`hidden`&&i(n)});return}a&&i(a)},p=e=>{a(!1),f(e)};return i?(0,X.jsx)(`div`,{className:`search-overlay`,"data-testid":`search-overlay`,onClick:()=>a(!1),role:`presentation`,children:(0,X.jsxs)(`div`,{"aria-label":`Find a card`,className:`search-palette`,"data-testid":`search-palette`,onClick:e=>e.stopPropagation(),role:`dialog`,children:[(0,X.jsx)(`input`,{"aria-label":`Find a card`,className:`search-input`,"data-testid":`search-input`,onChange:e=>{s(e.target.value),l(0)},onKeyDown:e=>{if(e.key===`Escape`)a(!1);else if(e.key===`ArrowDown`)e.preventDefault(),l(e=>Math.min(e+1,d.length-1));else if(e.key===`ArrowUp`)e.preventDefault(),l(e=>Math.max(e-1,0));else if(e.key===`Enter`){e.preventDefault();let t=d[c];t&&p(t.id)}},placeholder:`Find a card by title…`,ref:u,value:o}),(0,X.jsx)(`ul`,{className:`search-results`,role:`listbox`,children:d.length===0?(0,X.jsx)(`li`,{className:`search-empty`,children:`No matching cards.`}):d.map((e,t)=>(0,X.jsxs)(`li`,{"aria-selected":t===c,className:`search-result${t===c?` active`:``} search-${e.kind}`,onClick:()=>p(e.id),onMouseEnter:()=>l(t),role:`option`,children:[(0,X.jsx)(`span`,{className:`search-kind`,children:e.kind===`capability`?`SPEC`:`PROPOSAL`}),(0,X.jsx)(`span`,{className:`search-label`,children:e.label})]},e.id))})]})}):null}function vw({preview:e}){let t=80+e.col*280,n=80+e.rowIndex*170;return(0,X.jsxs)(ZS,{children:[(0,X.jsx)(`div`,{className:`grid-overlay`,"data-testid":`grid-overlay`,style:{position:`absolute`,left:-200,top:-90,width:280*60,height:10200,backgroundSize:`280px 170px`,pointerEvents:`none`}}),(0,X.jsx)(`div`,{className:`snap-target`,"data-testid":`snap-target`,style:{position:`absolute`,left:t-8,top:n-8,width:256,height:148,pointerEvents:`none`}})]})}function yw({rfNodes:e,rfEdges:t,onConnect:n,onEdgesChange:r,onNodesChange:i,onNodeClick:a,onNodeMouseEnter:o,onNodeMouseLeave:s,onPaneClick:c,onNodeDrag:l,onNodeDragStop:u,onBacklogDrop:d,dragPreview:f,searchItems:p,resolveCard:m,revealCard:h,toast:g,children:_}){let{screenToFlowPosition:v}=Ub();return(0,X.jsxs)(`section`,{className:`canvas`,"aria-label":`Planning canvas`,onDragOver:e=>{e.dataTransfer.types.includes(`application/specplan-node`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`)},onDrop:e=>{let t=e.dataTransfer.getData(`application/specplan-node`);if(!t)return;e.preventDefault();let n=v({x:e.clientX,y:e.clientY});d(t,n.x,n.y)},children:[(0,X.jsxs)(YS,{autoPanOnNodeDrag:!1,deleteKeyCode:[`Backspace`,`Delete`],edges:t,fitView:!0,minZoom:.1,nodes:e,nodesDraggable:!0,nodeTypes:uw,onConnect:n,onEdgesChange:r,onNodeClick:(e,t)=>a(t.id),onNodeMouseEnter:(e,t)=>o(t.id),onNodeMouseLeave:()=>s(),onPaneClick:()=>c(),onNodeDrag:(e,t)=>l(t),onNodeDragStop:(e,t)=>u(t),onNodesChange:i,proOptions:{hideAttribution:!0},children:[(0,X.jsx)(iC,{}),(0,X.jsx)(pC,{}),(0,X.jsx)(AC,{className:`specplan-minimap`,nodeColor:bw,pannable:!0,position:`top-right`,style:{width:150,height:104},zoomable:!0}),f&&(0,X.jsx)(vw,{preview:f})]}),(0,X.jsx)(_w,{items:p,resolve:m,onReveal:h}),g&&(0,X.jsx)(`div`,{className:`toast`,"data-testid":`toast`,role:`alert`,children:g}),_]})}function bw(e){return e.type===`capability`?`#5ba3e8`:e.type===`capGroup`?`#8a8a8a`:e.type===`story`?`#3a3a3a`:`#e8925b`}function xw(e){return(0,X.jsx)(GS,{children:(0,X.jsx)(yw,{...e})})}function Sw(e,t){let n=e.slice(0,Math.max(0,Math.min(t,e.length))),r=n.lastIndexOf(`@`);if(r===-1)return null;let i=r===0?``:n[r-1];if(i!==``&&!/[\s([{'"`]/.test(i))return null;let a=n.slice(r+1);return/\s/.test(a)||a.includes(`@`)?null:{start:r,query:a}}function Cw(e,t,n,r){let i=e.slice(0,t.start),a=Math.max(t.start,Math.min(n,e.length));for(;a<e.length&&!/\s/.test(e[a]);)a++;let o=e.slice(a);if(r.endsWith(`/`)){let e=`@${r}`;return{text:i+e+o,caret:i.length+e.length}}let s=o.startsWith(` `),c=`@${r}${s?``:` `}`;return{text:i+c+o,caret:i.length+c.length+ +!!s}}function ww(e,t,n){let[r,i]=(0,G.useState)(null),[a,o]=(0,G.useState)([]),[s,c]=(0,G.useState)(0);function l(){let t=e.current;i(t?Sw(t.value,t.selectionStart??t.value.length):null)}let u=r?.query;(0,G.useEffect)(()=>{if(u===void 0||!n){o([]);return}let e=!1,t=setTimeout(()=>{n(u).then(t=>{e||(o(t),c(0))}).catch(()=>{})},120);return()=>{e=!0,clearTimeout(t)}},[u,n]);let d=r!==null&&a.length>0;function f(n){let a=e.current;if(!a||!r)return;let o=Cw(a.value,r,a.selectionStart??a.value.length,n);t(o.text),i(n.endsWith(`/`)?{start:r.start,query:n}:null),requestAnimationFrame(()=>{a.focus(),a.setSelectionRange(o.caret,o.caret)})}function p(e){if(!d)return!1;if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=e.key===`ArrowDown`?1:a.length-1;return c(e=>(e+t)%a.length),!0}if(e.key===`Enter`||e.key===`Tab`){e.preventDefault();let t=a[s];return t!==void 0&&f(t),!0}return e.key===`Escape`?(e.preventDefault(),i(null),!0):!1}return{open:d,results:a,highlight:s,sync:l,select:f,onKeyDown:p}}function Tw({search:e,placement:t}){return e.open?(0,X.jsx)(`ul`,{"aria-label":`File search results`,className:`at-search ${t}`,role:`listbox`,children:e.results.map((t,n)=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{"aria-selected":n===e.highlight,className:`at-item${n===e.highlight?` active`:``}${t.endsWith(`/`)?` dir`:``}`,onMouseDown:n=>{n.preventDefault(),e.select(t)},role:`option`,type:`button`,children:[`@`,t]})},t))}):null}function Ew(e){return e.map(({role:e,text:t,at:n})=>({role:e,text:t,at:n}))}function Dw({messages:e,pending:t,error:n,onSend:r,onClear:i,searchFiles:a}){let[o,s]=(0,G.useState)(``),c=(0,G.useRef)(null),l=(0,G.useRef)(null),u=ww(l,s,a);(0,G.useEffect)(()=>{c.current?.scrollTo({top:c.current.scrollHeight})},[e.length,t]);function d(){let e=o.trim();!e||t||(s(``),r(e))}return(0,X.jsxs)(`div`,{className:`chat`,children:[(0,X.jsxs)(`div`,{className:`chat-messages`,ref:c,children:[e.length===0&&!n&&(0,X.jsxs)(`div`,{className:`chat-empty`,children:[`Ask the assistant to add specs and stories, link dependencies, contain stories, or reorder items — it applies changes straight to the canvas and can never delete anything. Pull files into context with`,` `,(0,X.jsx)(`code`,{children:`@path/to/file`}),` or `,(0,X.jsx)(`code`,{children:`@filename`}),`.`]}),e.map((e,t)=>(0,X.jsxs)(`div`,{className:`chat-message chat-${e.role}`,children:[(0,X.jsx)(`div`,{className:`chat-role`,children:e.role}),(0,X.jsx)(`div`,{className:`chat-text`,children:e.text}),e.toolCalls&&e.toolCalls.length>0&&(0,X.jsxs)(`details`,{className:`chat-refs chat-tools`,"data-testid":`chat-tools`,open:!0,children:[(0,X.jsxs)(`summary`,{children:[e.toolCalls.length,` change`,e.toolCalls.length===1?``:`s`,` applied`]}),(0,X.jsx)(`ul`,{children:e.toolCalls.map((e,t)=>(0,X.jsxs)(`li`,{children:[e.tool,`: `,e.summary]},`${e.tool}-${t}`))})]}),e.refs&&(e.refs.resolved.length>0||e.refs.unresolved.length>0)&&(0,X.jsxs)(`details`,{className:`chat-refs`,children:[(0,X.jsxs)(`summary`,{children:[e.refs.resolved.length,` file`,e.refs.resolved.length===1?``:`s`,` in context`,e.refs.unresolved.length>0&&`, ${e.refs.unresolved.length} unresolved`]}),(0,X.jsxs)(`ul`,{children:[e.refs.resolved.map(e=>(0,X.jsxs)(`li`,{children:[`@`,e]},e)),e.refs.unresolved.map(e=>(0,X.jsxs)(`li`,{className:`chat-ref-missing`,children:[`@`,e.ref,` — `,e.reason]},e.ref))]})]})]},`${e.at}-${t}`)),t&&(0,X.jsx)(`div`,{"aria-busy":`true`,className:`chat-message chat-assistant chat-thinking`,"data-state":`thinking`,children:`thinking…`}),n&&(0,X.jsx)(`div`,{className:`chat-fault`,children:n})]}),(0,X.jsxs)(`div`,{className:`chat-composer`,children:[(0,X.jsxs)(`div`,{className:`at-anchor`,children:[(0,X.jsx)(Tw,{placement:`up`,search:u}),(0,X.jsx)(`textarea`,{"aria-label":`Chat message`,className:`chat-input`,onChange:e=>{s(e.target.value),u.sync()},onKeyDown:e=>{u.onKeyDown(e)||e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),d())},onSelect:u.sync,placeholder:`Ask to add, link, or reorder… (@ searches files)`,ref:l,rows:2,value:o})]}),(0,X.jsxs)(`div`,{className:`chat-composer-actions`,children:[(0,X.jsx)(`button`,{className:`chat-clear`,disabled:e.length===0&&!n,onClick:i,title:`Clear the conversation and start over`,type:`button`,children:`Clear`}),(0,X.jsx)(`button`,{className:`chat-send`,disabled:t||!o.trim(),onClick:d,type:`button`,children:t?`Sending…`:`Send`})]})]})]})}function Ow({info:e,failed:t,onSave:n,searchFiles:r}){let[i,a]=(0,G.useState)(),o=(0,G.useRef)(null),s=ww(o,a,r);if(t)return(0,X.jsx)(`div`,{className:`empty error`,children:`Could not load the system prompt.`});if(!e)return(0,X.jsx)(`div`,{className:`empty`,children:`Loading the system prompt…`});let c=i??e.system,l=c!==e.system,u=c===e.default&&!e.custom;return(0,X.jsxs)(`div`,{className:`prompt-pane`,children:[(0,X.jsxs)(`div`,{className:`artifact-head`,children:[(0,X.jsxs)(`code`,{className:`path`,children:[`generation system prompt`,e.custom?` — customized`:``,l?` (unsaved)`:``]}),(0,X.jsxs)(`div`,{className:`prompt-actions`,children:[(0,X.jsx)(`button`,{className:`copy`,disabled:u&&!l,onClick:()=>{a(void 0),n(null)},title:`Restore the built-in default prompt`,type:`button`,children:`Reset`}),(0,X.jsx)(`button`,{className:`copy prompt-save`,disabled:!l||!c.trim(),onClick:()=>{n(c),a(void 0)},type:`button`,children:`Save`})]})]}),(0,X.jsxs)(`div`,{className:`at-anchor prompt-anchor`,children:[(0,X.jsx)(Tw,{placement:`down`,search:s}),(0,X.jsx)(`textarea`,{"aria-label":`Generation system prompt`,className:`prompt-editor`,onChange:e=>{a(e.target.value),s.sync()},onKeyDown:e=>void s.onKeyDown(e),onSelect:s.sync,ref:o,spellCheck:!1,value:c})]}),(0,X.jsxs)(`p`,{className:`prompt-hint`,children:[`Drives every generation. `,(0,X.jsx)(`code`,{children:`@path`}),` / `,(0,X.jsx)(`code`,{children:`@filename`}),` references resolve to file contents. Saved edits persist with the plan root.`]})]})}function kw({plan:e,llm:t,onCreateSpec:n,onCreateStory:r,promptInfo:i,promptFailed:a,onSavePrompt:o,chat:s,chatPending:c,chatError:l,onSendChat:u,onClearChat:d,searchFiles:f}){let[p,m]=(0,G.useState)(`backlog`),[h,g]=(0,G.useState)(!1),_=[{key:`backlog`,label:`Backlog`},...t?[{key:`chat`,label:`Chat`},{key:`prompt`,label:`System Prompt`}]:[]];return h?(0,X.jsx)(`button`,{"aria-label":`Show planning pane`,className:`panel-reopen`,"data-testid":`panel-reopen`,onClick:()=>g(!1),title:`Show planning pane`,type:`button`,children:`«`}):(0,X.jsxs)(`aside`,{className:`panel`,"aria-label":`Planning pane`,children:[(0,X.jsxs)(`nav`,{className:`pane-nav`,"aria-label":`Side pane options`,children:[_.map(e=>(0,X.jsx)(`button`,{className:p===e.key?`pane-item active`:`pane-item`,onClick:()=>m(e.key),type:`button`,children:e.label},e.key)),(0,X.jsx)(`button`,{"aria-label":`Hide planning pane`,className:`pane-collapse`,"data-testid":`panel-collapse`,onClick:()=>g(!0),title:`Hide planning pane`,type:`button`,children:`»`})]}),p===`backlog`&&(0,X.jsx)(Aw,{plan:e,onCreateSpec:n,onCreateStory:r,searchFiles:f}),p===`chat`&&t&&(0,X.jsx)(Dw,{messages:s,pending:c,error:l,onSend:u,onClear:d,searchFiles:f}),p===`prompt`&&t&&(0,X.jsx)(Ow,{failed:a,info:i,onSave:o,searchFiles:f})]})}function Aw({plan:e,onCreateSpec:t,onCreateStory:n,searchFiles:r}){let[i,a]=(0,G.useState)(null),{specs:o,stories:s}=FC(e),c=(e,t,n,r)=>(0,X.jsxs)(`div`,{className:`backlog-section`,"data-testid":t,children:[(0,X.jsx)(`h2`,{children:e}),n.length===0?(0,X.jsx)(`p`,{className:`hint`,children:r}):(0,X.jsx)(`ul`,{className:`backlog-list`,children:n.map(e=>(0,X.jsxs)(`li`,{className:`backlog-item`,draggable:e.type===`proposal`,onDragStart:t=>{t.dataTransfer.setData(`application/specplan-node`,e.id),t.dataTransfer.effectAllowed=`copy`},children:[e.type===`user_story`?e.text:e.title,(0,X.jsx)(`span`,{className:`backlog-id`,children:e.id})]},e.id))})]});return(0,X.jsxs)(`div`,{className:`backlog-pane`,"aria-label":`Backlog`,children:[(0,X.jsxs)(`div`,{className:`backlog-actions`,children:[(0,X.jsx)(`button`,{className:`chat-send`,onClick:()=>a(`spec`),type:`button`,children:`New spec…`}),(0,X.jsx)(`button`,{className:`chat-send`,onClick:()=>a(`story`),type:`button`,children:`New story…`})]}),(0,X.jsx)(`p`,{className:`hint`,children:`Not yet linked into the plan — drag a link on the canvas (or ask the chat) and an item clears from this list.`}),c(`Specs`,`backlog-specs`,o,`Every spec is linked into the plan.`),c(`User stories`,`backlog-stories`,s,`Every story is covered by a spec.`),i&&(0,X.jsx)(jw,{kind:i,onCreateSpec:t,onCreateStory:n,onClose:()=>a(null),searchFiles:r})]})}function jw({kind:e,onCreateSpec:t,onCreateStory:n,onClose:r,searchFiles:i}){let[a,o]=(0,G.useState)(``),[s,c]=(0,G.useState)(``),[l,u]=(0,G.useState)(``),[d,f]=(0,G.useState)(!1),p=(0,G.useRef)(null),m=ww(p,c,i);(0,G.useEffect)(()=>{let e=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]);let h=e===`spec`?!!a.trim():!!l.trim();function g(){!h||d||(f(!0),(e===`spec`?t(a,s):n(l)).then(e=>{e&&r()}).finally(()=>f(!1)))}return(0,X.jsx)(`div`,{className:`dialog-overlay`,onClick:r,role:`presentation`,children:(0,X.jsxs)(`div`,{"aria-label":e===`spec`?`Create spec dialog`:`Create user story dialog`,className:`dialog dialog-create`,"data-testid":`create-dialog`,onClick:e=>e.stopPropagation(),role:`dialog`,children:[(0,X.jsxs)(`div`,{className:`dialog-head`,children:[(0,X.jsx)(`div`,{className:`dialog-title`,children:e===`spec`?`New spec`:`New user story`}),(0,X.jsx)(`div`,{className:`dialog-actions`,children:(0,X.jsx)(`button`,{className:`chat-clear`,onClick:r,type:`button`,children:`Cancel`})})]}),e===`spec`?(0,X.jsxs)(`div`,{className:`plan-form`,children:[(0,X.jsx)(`h2`,{children:`Name`}),(0,X.jsx)(`input`,{"aria-label":`New spec title`,autoFocus:!0,onChange:e=>o(e.target.value),placeholder:`Spec title…`,value:a}),(0,X.jsx)(`h2`,{children:`Description / generation prompt`}),(0,X.jsxs)(`div`,{className:`at-anchor`,children:[(0,X.jsx)(Tw,{placement:`down`,search:m}),(0,X.jsx)(`textarea`,{"aria-label":`Spec description`,onChange:e=>{c(e.target.value),m.sync()},onKeyDown:e=>void m.onKeyDown(e),onSelect:m.sync,placeholder:`What this spec covers — steers generation. @path / @filename pulls files into context…`,ref:p,rows:6,value:s})]})]}):(0,X.jsxs)(`div`,{className:`plan-form`,children:[(0,X.jsx)(`h2`,{children:`Story`}),(0,X.jsx)(`textarea`,{"aria-label":`New user story`,autoFocus:!0,onChange:e=>u(e.target.value),placeholder:`As a <user>, I want to <feature> so that <value>…`,rows:4,value:l})]}),(0,X.jsx)(`div`,{className:`dialog-actions dialog-submit`,children:(0,X.jsx)(`button`,{className:`chat-send`,disabled:!h||d,onClick:g,type:`button`,children:d?`Creating…`:e===`spec`?`Create spec`:`Create story`})})]})})}var Mw=`modulepreload`,Nw=function(e){return`/`+e},Pw={},Fw=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,new URL(`../../../src/node/plugins/importAnalysisBuild.ts`,import.meta.url)).href}r=o(t.map(t=>{if(t=Nw(t,n),t=s(t),t in Pw)return;Pw[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:Mw,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Iw=new Nu({html:!1,linkify:!0}),Lw=(0,G.lazy)(async()=>{let[e]=await Promise.all([Fw(()=>import(`./prod-ebIQ9pCZ.js`),__vite__mapDeps([0,1,2,3,4,5,6])),Fw(()=>Promise.resolve({}),__vite__mapDeps([7]))]);return{default:e.Excalidraw}}),Rw=`diagram.excalidraw`;function zw({source:e}){let t=null,n;try{let n=JSON.parse(e);t={elements:Array.isArray(n.elements)?n.elements:[],appState:{viewBackgroundColor:n.appState?.viewBackgroundColor??`#ffffff`},scrollToContent:!0}}catch(e){n=e instanceof Error?e.message:String(e)}return n===void 0?(0,X.jsx)(`div`,{className:`artifact-body dialog-body excalidraw-preview`,"data-testid":`diagram-preview`,children:(0,X.jsx)(G.Suspense,{fallback:(0,X.jsx)(`div`,{className:`empty`,children:`Loading the diagram…`}),children:(0,X.jsx)(Lw,{initialData:t,viewModeEnabled:!0})})}):(0,X.jsxs)(`div`,{className:`empty error`,"data-testid":`diagram-error`,children:[`Could not parse `,Rw,`: `,n]})}function Bw({specId:e,title:t,kind:n=`change`,generating:r,loadArtifacts:i,onRegenerate:a,onClose:o}){let[s,c]=(0,G.useState)(null),[l,u]=(0,G.useState)(),[d,f]=(0,G.useState)(0),p=(0,G.useCallback)(async()=>{try{c(await i(e)),u(void 0)}catch(e){u(e instanceof Error?e.message:String(e))}},[e,i]);(0,G.useEffect)(()=>{p()},[p]),(0,G.useEffect)(()=>{let e=e=>{e.key===`Escape`&&o()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[o]);let m=[...(s?.files??[]).map(e=>({path:e.path,content:e.content,diagram:!1})),...typeof s?.diagram==`string`?[{path:Rw,content:s.diagram,diagram:!0}]:[]],h=m[Math.min(d,Math.max(m.length-1,0))],g=n===`capability`?`openspec/specs/${e}/`:`openspec/changes/${e}/`;return(0,X.jsx)(`div`,{className:`dialog-overlay`,onClick:o,role:`presentation`,children:(0,X.jsxs)(`div`,{"aria-label":n===`capability`?`Capability spec for ${t} (read-only)`:`OpenSpec change for ${t}`,className:`dialog`,"data-testid":`spec-dialog`,onClick:e=>e.stopPropagation(),role:`dialog`,children:[(0,X.jsxs)(`div`,{className:`dialog-head`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`div`,{className:`dialog-title`,children:t}),(0,X.jsx)(`code`,{className:`dialog-path`,children:g})]}),(0,X.jsxs)(`div`,{className:`dialog-actions`,children:[a&&(0,X.jsx)(`button`,{className:`chat-send`,disabled:r,onClick:()=>{a().then(e=>{e&&p()})},title:s?.handEdited?`Body is hand-edited — regeneration updates metadata only`:`Re-run generation from the card’s current stories and dependencies`,type:`button`,children:r?`Regenerating…`:`Regenerate`}),(0,X.jsx)(`button`,{className:`chat-clear`,onClick:o,type:`button`,children:`Close`})]})]}),s?.handEdited&&(0,X.jsxs)(`p`,{className:`dialog-notice dialog-notice--warning`,"data-state":`hand-edited`,"data-testid":`hand-edited-notice`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,children:`⚠`}),` This change's body was edited outside specplan (or predates it) — Regenerate updates only the plan metadata and leaves every .md file untouched.`]}),l&&(0,X.jsx)(`div`,{className:`empty error`,children:l}),!l&&!s&&(0,X.jsx)(`div`,{className:`empty`,children:n===`capability`?`Loading the spec…`:`Loading the change…`}),!l&&s&&m.length===0&&(0,X.jsx)(`div`,{className:`empty`,children:`No body files on disk (metadata only so far).`}),h&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`tabs`,children:m.map((e,t)=>(0,X.jsx)(`button`,{className:t===d?`tab active`:`tab`,onClick:()=>f(t),type:`button`,children:e.path},e.path))}),(0,X.jsxs)(`div`,{className:`artifact-head`,children:[(0,X.jsxs)(`code`,{className:`path`,children:[g,h.path]}),!h.diagram&&(0,X.jsx)(`button`,{className:`copy`,onClick:()=>navigator.clipboard?.writeText(h.content),type:`button`,children:`Copy`})]}),h.diagram?(0,X.jsx)(zw,{source:h.content}):h.path.endsWith(`.md`)?(0,X.jsx)(`div`,{className:`artifact-body dialog-body artifact-rendered`,dangerouslySetInnerHTML:{__html:Iw.render(h.content)},"data-testid":`artifact-rendered`}):(0,X.jsx)(`pre`,{className:`artifact-body dialog-body`,children:h.content})]})]})})}function Vw({session:e,api:t}){let n=t.llm,[r,i]=(0,G.useState)(e.plan),[a,o]=(0,G.useState)(e.specStates),[s,c]=(0,G.useState)(()=>e.collapsedGroups??$C(IC(e.plan.nodes.filter(e=>e.type===`capability`)).map(e=>e.id))),l=(0,G.useRef)(s),[u,d]=(0,G.useState)(e.hideEmptySpecs??!1),f=(0,G.useRef)(u),p=(0,G.useRef)(KC(e.plan,s,{hideEmptyCaps:u})),[m,h]=(0,G.useState)(()=>dw(e.plan,p.current,void 0,e.specStates)),[g,_]=(0,G.useState)(()=>fw(e.plan,p.current)),[v,y]=(0,G.useState)(null),[b,x]=(0,G.useState)(null),[S,C]=(0,G.useState)(null),w=S??b,[T,E]=(0,G.useState)(0),D=(0,G.useCallback)(()=>E(e=>e+1),[]),[O,k]=(0,G.useState)(null),[A,j]=(0,G.useState)(null),[M,ee]=(0,G.useState)(null),te=(0,G.useRef)(e.model??`claude-opus-4-8`),[ne,N]=(0,G.useState)(te.current),P=(0,G.useRef)(void 0),[re,F]=(0,G.useState)();(0,G.useEffect)(()=>{if(!re)return;let e=setTimeout(()=>F(void 0),4e3);return()=>clearTimeout(e)},[re]);let I=(0,G.useCallback)(e=>{let t=r.nodes.find(t=>t.id===e);return t?t.type===`user_story`?t.text.slice(0,40):t.title:e},[r]),[ie,L]=(0,G.useState)(e.chat??[]),[R,ae]=(0,G.useState)(!1),[oe,se]=(0,G.useState)();async function ce(e){let t=e.trim();if(!t||R||!n)return;let r=Ew(ie);L(e=>[...e,{role:`user`,text:t,at:new Date().toISOString()}]),ae(!0),se(void 0);try{let e=await n.chat(t,r,te.current);i(e.plan),L(t=>[...t,{...e.reply,...e.toolCalls.length>0?{toolCalls:e.toolCalls}:{},...e.resolvedRefs.length>0||e.unresolvedRefs.length>0?{refs:{resolved:e.resolvedRefs,unresolved:e.unresolvedRefs}}:{}}])}catch(e){se(e instanceof Error?e.message:String(e))}finally{ae(!1)}}function le(){L([]),se(void 0),n?.clearChat().catch(()=>{})}let[ue,de]=(0,G.useState)(),[fe,pe]=(0,G.useState)(!1);(0,G.useEffect)(()=>{if(!n)return;let e=!1;return n.getPrompt().then(t=>{e||de(t)}).catch(()=>{e||pe(!0)}),()=>{e=!0}},[n]);function me(e){ue&&(de(e===null?{...ue,system:ue.default,custom:!1}:{...ue,system:e,custom:e!==ue.default}),n?.savePrompt(e).catch(()=>{}))}let he=(0,G.useCallback)(async e=>{if(!n)return null;k(e);try{let t=await n.generate(e,te.current);return F(t.mode===`metadata-only`?`Body is hand-edited — updated metadata only, .md files untouched.`:`Generated + validated: ${t.changedFiles.length} file${t.changedFiles.length===1?``:`s`} changed.`),o(n=>{let r=n[e]?.status??`draft`;return{...n,[e]:t.mode===`generated`?{...n[e],hasSpec:!0,handEdited:!1,status:r}:n[e]??{hasSpec:!0,handEdited:!0,status:r}}}),t.mode}catch(e){return F(e instanceof Error?e.message:String(e)),null}finally{k(null)}},[n]),ge=(0,G.useCallback)(async(e,n)=>{try{await t.setStatus(e,n),o(t=>({...t,[e]:{...t[e]??{hasSpec:!1,handEdited:!1,status:n},status:n}}))}catch(e){F(e instanceof Error?e.message:String(e))}},[t]),_e=(0,G.useCallback)(async(e,n)=>{try{await t.setImplemented(e,n),o(t=>({...t,[e]:{...t[e]??{hasSpec:!1,handEdited:!1,status:`draft`},implemented:n}}))}catch(e){F(e instanceof Error?e.message:String(e))}},[t]),ve=(0,G.useCallback)(async(e,n)=>{try{return{status:`ok`,result:await t.apply(e,n)}}catch(e){return e instanceof So&&e.handEdit?{status:`hand-edit`}:{status:`error`,message:e instanceof Error?e.message:String(e)}}},[t]),ye=(0,G.useCallback)(e=>{(async()=>{try{let n=await t.loadSession();i(n.plan),o(n.specStates);let r=e.newCapabilities.length;F(`Applied ${I(e.specId)} — folded into specs/ and archived.`+(r>0?` +${r} capability root${r===1?``:`s`}.`:``))}catch{F(`Applied — reload to see the folded state.`)}})()},[t,I]);(0,G.useEffect)(()=>{let e=KC(r,s,{hideEmptyCaps:u});p.current=e,h(dw(r,e,{...n?{generate:e=>void he(e)}:{},generatingId:O,setStatus:(e,t)=>void ge(e,t),setImplemented:(e,t)=>void _e(e,t),apply:e=>{let t=r.nodes.find(t=>t.id===e);ee({id:e,title:t?.type===`proposal`?t.title:e})}},a)),_(fw(r,e))},[r,O,he,ge,_e,a,s,u,n,T]);let be=(0,G.useMemo)(()=>pw(m,g,w),[m,g,w]),xe=(0,G.useMemo)(()=>hw(m,be),[m,be]),Se=(0,G.useMemo)(()=>gw(g,be),[g,be]),Ce=(0,G.useCallback)(()=>{clearTimeout(P.current),P.current=setTimeout(()=>{t.saveUiState({...t.llm?{model:te.current}:{},collapsedGroups:l.current,hideEmptySpecs:f.current}).catch(()=>{})},800)},[t]),we=(0,G.useCallback)(()=>{d(e=>{let t=!e;return f.current=t,t}),Ce()},[Ce]),Te=(0,G.useCallback)(e=>{let t=IC(r.nodes.filter(e=>e.type===`capability`)).map(e=>e.id);c(n=>{let r=new Set(n);if(r.has(e)){r.delete(e);let n=QC(ZC(t),e);for(let e of n?.children??[])r.add(e.key)}else{r.add(e);for(let t of[...r])t.startsWith(`${e}-`)&&r.delete(t)}let i=[...r];return l.current=i,i}),Ce()},[r,Ce]);function Ee(e){te.current=e,N(e),Ce()}let De=(0,G.useCallback)(e=>e.rowKeys.filter(e=>e!==`__unscheduled`&&e!==`__stories`),[]),Oe=(0,G.useCallback)(async e=>{try{await t.arrangeRow(e),i(t=>({...t,nodes:t.nodes.map(t=>{let n=e.indexOf(t.id);return n===-1?t:{...t,order:n}})}))}catch(e){F(e instanceof Error?e.message:String(e))}},[t]),ke=(0,G.useCallback)(e=>{let t=e.map(e=>e.type!==`position`||!e.position?e:r.nodes.find(t=>t.id===UC(e.id))?.type===`capability`?{...e,position:{...e.position,x:80}}:e);h(e=>Tb(t,e))},[r]),Ae=(0,G.useCallback)(e=>{let{rowIndex:t,col:n}=qC(e.position.x,e.position.y),r=p.current.rowKeys.length;y({rowIndex:Math.max(0,Math.min(t,r)),col:Math.max(0,n)})},[]),je=(0,G.useCallback)((e,t)=>{let n=IC(r.nodes.filter(e=>e.type===`capability`)).map(e=>e.id),{rowIndex:i}=qC(e.position.x,e.position.y),a=n.filter(e=>e!==t),o=Math.max(0,Math.min(i,a.length)),s=[...a.slice(0,o),t,...a.slice(o)];if(s.every((e,t)=>e===n[t])){D();return}Oe(s)},[r,Oe,D]),Me=(0,G.useCallback)(async(e,n,a,o)=>{try{if(!r.edges.some(t=>t.type===`targets`&&t.from===a&&t.to===e)){let n=await t.link(a,e);i(e=>({...e,edges:[...e.edges,n]}))}let s=YC(JC((p.current.occupantsByRow.get(n)??[]).filter(t=>t!==e),e,o),r);await Oe(s),F(`Scheduled ${I(e)}.`)}catch(e){F(e instanceof Error?e.message:String(e))}},[t,r,Oe,I]),Ne=(0,G.useCallback)(async(e,n)=>{let a=p.current.capsByRow.get(n)??(VC(n)===null?[n]:[]),o=r.edges.filter(t=>t.type===`targets`&&t.to===e&&a.includes(t.from));try{if(o.length>0){for(let e of o)await t.unlink(e.from,e.to);i(t=>({...t,edges:t.edges.filter(t=>!(t.type===`targets`&&t.to===e&&a.includes(t.from)))})),F(`Unscheduled ${I(e)}.`);return}let n=r.edges.filter(t=>t.type===`stacked`&&t.from===e).map(e=>e.to);if(n.length===0){D();return}let s=new Map(r.nodes.map(e=>[e.id,e.order])),c=n.sort((e,t)=>(s.get(e)??0)-(s.get(t)??0)||e.localeCompare(t))[0];await t.unlink(e,c),i(t=>({...t,edges:t.edges.filter(t=>!(t.type===`stacked`&&t.from===e&&t.to===c))})),F(`Removed dependency ${I(c)}.`)}catch(e){F(e instanceof Error?e.message:String(e))}},[t,r,I,D]),Pe=(0,G.useCallback)(e=>{y(null);let t=UC(e.id),n=r.nodes.find(e=>e.id===t);if(!n){D();return}if(n.type===`capability`){je(e,t);return}if(n.type!==`proposal`){D();return}let i=p.current,{rowIndex:a,col:o}=qC(e.position.x,e.position.y),s=De(i),c=WC(e.id),l=a>=0&&a<s.length?s[a]:void 0,u=Math.max(1,o);if(l===void 0||o<0){c?Ne(t,c):D();return}let d=i.capsByRow.get(l)??[];if(d.length===0){D();return}if(c===l){let e=YC(JC((i.occupantsByRow.get(l)??[]).filter(e=>e!==t),t,u),r);Oe(e);return}Me(t,l,d[0],u)},[r,De,Oe,Ne,je,Me,D]),Fe=(0,G.useCallback)((e,t,n)=>{let i=r.nodes.find(t=>t.id===e);if(!i)return;if(i.type===`user_story`){F(`Stories are scheduled by containing them in a proposal.`);return}let a=p.current,{rowIndex:o,col:s}=qC(t,n),c=De(a),l=o>=0&&o<c.length?c[o]:void 0;if(!l){F(`Drop onto a spec row to schedule the card.`);return}let u=a.capsByRow.get(l)??[];if(u.length===0){F(`That row can’t hold a card.`);return}Me(e,l,u[0],Math.max(1,s))},[r,De,Me]);async function Ie(e,n){try{let r=await t.createSpec(e,n);return i(e=>({...e,nodes:[...e.nodes,r]})),!0}catch(e){return F(e instanceof Error?e.message:String(e)),!1}}async function Le(e){try{let n=await t.createStory(e);return i(e=>({...e,nodes:[...e.nodes,n]})),!0}catch(e){return F(e instanceof Error?e.message:String(e)),!1}}let Re=(0,G.useCallback)(async(e,n)=>{try{let r=await t.link(e,n);return i(e=>({...e,edges:[...e.edges,r]})),!0}catch(e){return F(e instanceof Error?e.message:String(e)),!1}},[t]),ze=(0,G.useCallback)(async(e,t,n)=>{let r=KC(e,s,{hideEmptyCaps:u}),i=new Map(e.nodes.map(e=>[e.id,e.order])),a=(e,t)=>(i.get(e)??0)-(i.get(t)??0)||e.localeCompare(t),o=[],c=!1;for(let i of r.rowKeys){let s=r.occupantsByRow.get(i)??[];if(!s.includes(t)||!s.includes(n))continue;let l=[...s].sort(a),u=YC(l,e);u.some((e,t)=>e!==l[t])&&(c=!0);for(let e of u)o.includes(e)||o.push(e)}c&&o.length>0?(await Oe(o),F(`Arranged ${I(t)} after ${I(n)}.`)):D()},[s,u,Oe,I,D]),Be=(0,G.useCallback)(e=>{if(!e.source||!e.target)return;let n=r.nodes.find(t=>t.id===UC(e.source)),a=r.nodes.find(t=>t.id===UC(e.target));if(n?.type===`proposal`&&a?.type===`proposal`){(async()=>{try{let e=await t.link(a.id,n.id),o={...r,edges:[...r.edges,e]};i(o),await ze(o,e.from,e.to)}catch(e){F(e instanceof Error?e.message:String(e))}})();return}n&&a&&Re(n.id,a.id)},[t,Re,r,ze]),Ve=(0,G.useCallback)(async(e,n)=>{try{await t.unlink(e,n),i(t=>({...t,edges:t.edges.filter(t=>!(t.from===e&&t.to===n))})),F(`Unlinked ${I(e)} -> ${I(n)}.`)}catch(e){F(e instanceof Error?e.message:String(e))}},[t,I]),He=(0,G.useCallback)(e=>{let t=e.filter(e=>e.type!==`remove`);t.length>0&&_(e=>Eb(t,e));for(let t of e){if(t.type!==`remove`)continue;let[e,n]=t.id.split(`->`);e&&n&&Ve(e,n)}},[Ve]),Ue=(0,G.useMemo)(()=>r.nodes.filter(e=>e.type===`capability`||e.type===`proposal`).map(e=>({id:e.id,label:(e.type,e.title),kind:e.type===`capability`?`capability`:`proposal`})),[r]),We=(0,G.useCallback)(e=>{let t=p.current,n=r.nodes.find(t=>t.id===e);if(!n)return null;if(n.type===`capability`)return t.hidden.has(e)?`hidden`:t.positions[e]??null;let i=t.memberRowsByProp.get(e)??[],a=i.length>0?HC(e,i[0]):e;return t.positions[a]??null},[r]),Ge=(0,G.useCallback)(e=>{c(t=>{let n=t.filter(t=>!(e===t||e.startsWith(`${t}-`)));return n.length===t.length?t:(l.current=n,n)}),Ce()},[Ce]);return(0,G.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(C(null),x(null))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,X.jsxs)(`div`,{className:`app`,children:[(0,X.jsx)(tw,{rootName:e.rootName,hideEmptySpecs:u,onToggleHideEmpty:we,...n?{model:ne,onModelChange:Ee}:{}}),(0,X.jsxs)(`main`,{className:`workspace`,children:[(0,X.jsxs)(xw,{rfNodes:xe,rfEdges:Se,onConnect:Be,onEdgesChange:He,onNodesChange:ke,onNodeDrag:Ae,onNodeDragStop:Pe,onBacklogDrop:Fe,dragPreview:v,searchItems:Ue,resolveCard:We,revealCard:Ge,onNodeMouseEnter:e=>x(UC(e)),onNodeMouseLeave:()=>x(null),onPaneClick:()=>C(null),onNodeClick:e=>{let t=VC(e);if(t!==null){C(e),Te(t);return}let n=UC(e);C(n);let i=r.nodes.find(e=>e.id===n);i?.type===`capability`?j({id:i.id,title:i.title,kind:`capability`}):i?.type===`proposal`&&a[n]?.hasSpec&&j({id:i.id,title:i.title,kind:`proposal`})},toast:re,children:[A&&(0,X.jsx)(Bw,{specId:A.id,title:A.title,kind:A.kind===`capability`?`capability`:`change`,generating:O===A.id,loadArtifacts:A.kind===`capability`?async e=>{let{content:n}=await t.getCapabilitySpec(e);return{specId:e,handEdited:!1,files:[{path:`spec.md`,content:n}]}}:e=>t.getSpecArtifacts(e),...n&&A.kind===`proposal`?{onRegenerate:()=>he(A.id)}:{},onClose:()=>j(null)}),M&&(0,X.jsx)(nw,{specId:M.id,title:M.title,apply:e=>ve(M.id,e),onApplied:ye,onClose:()=>ee(null)})]}),(0,X.jsx)(kw,{plan:r,llm:!!n,onCreateSpec:Ie,onCreateStory:Le,promptInfo:ue,promptFailed:fe,onSavePrompt:me,chat:ie,chatPending:R,chatError:oe,onSendChat:ce,onClearChat:le,searchFiles:n?e=>n.searchFiles(e):void 0})]})]})}var Hw=Eo(`/api`,{llm:!0});function Uw(){let[e,t]=(0,G.useState)({mode:`loading`}),[n,r]=(0,G.useState)(()=>{let e=new URLSearchParams(window.location.search);if(e.get(`view`)===`canvas`)return{kind:`canvas`};let t=e.get(`change`);return t===null||t===``?{kind:`gallery`}:{kind:`preview`,id:t}}),[i,a]=(0,G.useState)(null),o=e=>{let t=new URL(window.location.href);t.searchParams.set(`change`,e),t.searchParams.delete(`view`),window.history.pushState({},``,t),a(null),r({kind:`preview`,id:e})},s=()=>{let e=new URL(window.location.href);e.searchParams.delete(`change`),window.history.pushState({},``,e),r({kind:`gallery`})},[c,l]=(0,G.useState)(null);return(0,G.useEffect)(()=>{Do(Hw).then(t)},[]),(0,G.useEffect)(()=>{if(n.kind!==`preview`)return;let e=n.id;fetch(`/api/gallery/${encodeURIComponent(e)}`).then(e=>e.ok?e.json():null).then(a).catch(()=>a(null))},[n]),(0,G.useEffect)(()=>{n.kind!==`gallery`||c!==null||fetch(`/api/gallery`).then(e=>e.ok?e.json():null).then(e=>l(e??{roadmap:[],backlog:[]})).catch(()=>l({roadmap:[],backlog:[]}))},[n.kind,c]),e.mode===`loading`?(0,X.jsx)(`div`,{className:`boot`,"data-state":`loading`,children:`Loading…`}):e.mode===`error`?(0,X.jsxs)(`div`,{className:`boot boot-error`,"data-state":`error`,role:`alert`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,children:`✕`}),` Could not reach the specplan server: `,e.detail,`. Launch it with`,` `,(0,X.jsx)(`code`,{children:`specplan [rootDir]`}),` and reload.`]}):n.kind===`gallery`?c===null?(0,X.jsx)(`div`,{className:`boot`,"data-state":`loading`,children:`Reading changes…`}):(0,X.jsx)(td,{backlog:c.backlog,onAddToRoadmap:e=>{fetch(`/api/gallery/roadmap`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({id:e})}).then(()=>l(null)).catch(()=>l(null))},archived:c.archived??[],missing:c.missing??[],onDelete:e=>{fetch(`/api/gallery/${encodeURIComponent(e)}`,{method:`DELETE`}).then(()=>l(null)).catch(()=>l(null))},onOpen:o,onReorder:(e,t)=>{fetch(`/api/gallery/reorder`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({id:e,before:t})}).then(()=>l(null)).catch(()=>l(null))},roadmap:c.roadmap}):n.kind===`preview`?i===null?(0,X.jsx)(`div`,{className:`boot`,"data-state":`loading`,children:`Reading the change…`}):(0,X.jsx)(zu,{onBack:s,preview:i}):(0,X.jsx)(Vw,{session:e.session,api:Hw})}var Ww=document.getElementById(`root`);if(!Ww)throw Error(`Missing #root element`);(0,K.createRoot)(Ww).render((0,X.jsx)(G.StrictMode,{children:(0,X.jsx)(Uw,{})}));export{ym as a,Tp as c,Cp as d,wp as f,i as g,c as h,Em as i,Jp as l,Fu as m,Ny as n,dm as o,sp as p,Ay as r,pm as s,Fw as t,Kp as u};
@@ -0,0 +1 @@
1
+ import"./chunk-FOHPRMQF-CyTuVbu3.js";import{w as e}from"./mermaid-parser.core-cJplg8ws.js";export{e as createInfoServices};
@@ -1,2 +1,2 @@
1
- import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{t}from"./src-BhL2Ylf6.js";import{c as n}from"./chunk-WYO6CB5R-2sVpzpwa.js";import{t as r}from"./chunk-VAUOI2AC-BTR1oUbp.js";import{n as i}from"./mermaid-parser.core-0GwuEqeW.js";var a={parse:e(async e=>{let n=await i(`info`,e);t.debug(n)},`parse`)},o={version:`11.16.0`},s={parser:a,db:{getVersion:e(()=>o.version,`getVersion`)},renderer:{draw:e((e,i,a)=>{t.debug(`rendering info diagram
1
+ import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{t}from"./src-vDqOmCca.js";import{c as n}from"./chunk-DU6HZSFF-B9PGrM0S.js";import{t as r}from"./chunk-CLGD4ZFX-C0R2i_19.js";import{n as i}from"./mermaid-parser.core-cJplg8ws.js";var a={parse:e(async e=>{let n=await i(`info`,e);t.debug(n)},`parse`)},o={version:`11.17.2`},s={parser:a,db:{getVersion:e(()=>o.version,`getVersion`)},renderer:{draw:e((e,i,a)=>{t.debug(`rendering info diagram
2
2
  `+e);let o=r(i);n(o,100,400,!0),o.append(`g`).append(`text`).attr(`x`,100).attr(`y`,40).attr(`class`,`version`).attr(`font-size`,32).style(`text-anchor`,`middle`).text(`v${a}`)},`draw`)}};export{s as diagram};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import"./src-BhL2Ylf6.js";import{H as t,K as n,U as r,a as i,c as a,s as o,v as s,w as c,x as l,y as u}from"./chunk-WYO6CB5R-2sVpzpwa.js";import{p as d}from"./chunk-ICXQ74PX-Cq2aKGhh.js";import{t as f}from"./chunk-VAUOI2AC-BTR1oUbp.js";import{t as p}from"./rough.esm-CSKSodPl.js";var m=(function(){var t=e(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[1,4],r=[1,14],i=[1,12],a=[1,13],o=[6,7,8],s=[1,20],c=[1,18],l=[1,19],u=[6,7,11],d=[1,6,13,14],f=[1,23],p=[1,24],m=[1,6,7,11,13,14],h={trace:e(function(){},`trace`),yy:{},symbols_:{error:2,start:3,ishikawa:4,spaceLines:5,SPACELINE:6,NL:7,ISHIKAWA:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,TEXT:14,$accept:0,$end:1},terminals_:{2:`error`,6:`SPACELINE`,7:`NL`,8:`ISHIKAWA`,11:`EOF`,13:`SPACELIST`,14:`TEXT`},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,1],[12,1],[12,1]],performAction:e(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 6:case 7:return r;case 15:r.addNode(a[s-1].length,a[s].trim());break;case 16:r.addNode(0,a[s].trim());break}},`anonymous`),table:[{3:1,4:2,5:3,6:[1,5],8:n},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:n},{6:r,7:[1,10],9:9,12:11,13:i,14:a},t(o,[2,3]),{1:[2,2]},t(o,[2,4]),t(o,[2,5]),{1:[2,6],6:r,12:15,13:i,14:a},{6:r,9:16,12:11,13:i,14:a},{6:s,7:c,10:17,11:l},t(u,[2,18],{14:[1,21]}),t(u,[2,16]),t(u,[2,17]),{6:s,7:c,10:22,11:l},{1:[2,7],6:r,12:15,13:i,14:a},t(d,[2,14],{7:f,11:p}),t(m,[2,8]),t(m,[2,9]),t(m,[2,10]),t(u,[2,15]),t(d,[2,13],{7:f,11:p}),t(m,[2,11]),t(m,[2,12])],defaultActions:{2:[2,1],6:[2,2]},parseError:e(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:e(function(t){var n=this,r=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(t,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;typeof g.yy.parseError==`function`?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function b(e){r.length-=2*e,a.length-=e,o.length-=e}e(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=n.symbols_[e]||e),e}e(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=r[r.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
1
+ import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import"./src-vDqOmCca.js";import{H as t,K as n,U as r,a as i,c as a,s as o,v as s,w as c,x as l,y as u}from"./chunk-DU6HZSFF-B9PGrM0S.js";import{p as d}from"./chunk-75Z2AOVW-BSJ7TCsD.js";import{t as f}from"./chunk-CLGD4ZFX-C0R2i_19.js";import{t as p}from"./rough.esm-CSKSodPl.js";var m=(function(){var t=e(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[1,4],r=[1,14],i=[1,12],a=[1,13],o=[6,7,8],s=[1,20],c=[1,18],l=[1,19],u=[6,7,11],d=[1,6,13,14],f=[1,23],p=[1,24],m=[1,6,7,11,13,14],h={trace:e(function(){},`trace`),yy:{},symbols_:{error:2,start:3,ishikawa:4,spaceLines:5,SPACELINE:6,NL:7,ISHIKAWA:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,TEXT:14,$accept:0,$end:1},terminals_:{2:`error`,6:`SPACELINE`,7:`NL`,8:`ISHIKAWA`,11:`EOF`,13:`SPACELIST`,14:`TEXT`},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,1],[12,1],[12,1]],performAction:e(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 6:case 7:return r;case 15:r.addNode(a[s-1].length,a[s].trim());break;case 16:r.addNode(0,a[s].trim());break}},`anonymous`),table:[{3:1,4:2,5:3,6:[1,5],8:n},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:n},{6:r,7:[1,10],9:9,12:11,13:i,14:a},t(o,[2,3]),{1:[2,2]},t(o,[2,4]),t(o,[2,5]),{1:[2,6],6:r,12:15,13:i,14:a},{6:r,9:16,12:11,13:i,14:a},{6:s,7:c,10:17,11:l},t(u,[2,18],{14:[1,21]}),t(u,[2,16]),t(u,[2,17]),{6:s,7:c,10:22,11:l},{1:[2,7],6:r,12:15,13:i,14:a},t(d,[2,14],{7:f,11:p}),t(m,[2,8]),t(m,[2,9]),t(m,[2,10]),t(u,[2,15]),t(d,[2,13],{7:f,11:p}),t(m,[2,11]),t(m,[2,12])],defaultActions:{2:[2,1],6:[2,2]},parseError:e(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:e(function(t){var n=this,r=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(t,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;typeof g.yy.parseError==`function`?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function b(e){r.length-=2*e,a.length-=e,o.length-=e}e(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=n.symbols_[e]||e),e}e(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=r[r.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
2
2
  `+h.showPosition()+`
3
3
  Expecting `+j.join(`, `)+`, got '`+(this.terminals_[S]||S)+`'`:`Parse error on line `+(l+1)+`: Unexpected `+(S==p?`end of input`:`'`+(this.terminals_[S]||S)+`'`),this.parseError(M,{text:h.match,token:this.terminals_[S]||S,line:h.yylineno,loc:v,expected:j})}if(T[0]instanceof Array&&T.length>1)throw Error(`Parse Error: multiple actions possible at state: `+w+`, token: `+S);switch(T[0]){case 1:r.push(S),a.push(h.yytext),o.push(h.yylloc),r.push(T[1]),S=null,C?(S=C,C=null):(u=h.yyleng,c=h.yytext,l=h.yylineno,v=h.yylloc,d>0&&d--);break;case 2:if(k=this.productions_[T[1]][1],D.$=a[a.length-k],D._$={first_line:o[o.length-(k||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(k||1)].first_column,last_column:o[o.length-1].last_column},y&&(D._$.range=[o[o.length-(k||1)].range[0],o[o.length-1].range[1]]),E=this.performAction.apply(D,[c,u,l,g.yy,T[1],a,o].concat(m)),E!==void 0)return E;k&&(r=r.slice(0,-1*k*2),a=a.slice(0,-1*k),o=o.slice(0,-1*k)),r.push(this.productions_[T[1]][0]),a.push(D.$),o.push(D._$),A=s[r[r.length-2]][r[r.length-1]],r.push(A);break;case 3:return!0}}return!0},`parse`)};h.lexer=(function(){return{EOF:1,parseError:e(function(e,t){if(this.yy.parser)this.yy.parser.parseError(e,t);else throw Error(e)},`parseError`),setInput:e(function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=``,this.conditionStack=[`INITIAL`],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},`setInput`),input:e(function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},`input`),unput:e(function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},`unput`),more:e(function(){return this._more=!0,this},`more`),reject:e(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError(`Lexical error on line `+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:``,token:null,line:this.yylineno});return this},`reject`),less:e(function(e){this.unput(this.match.slice(e))},`less`),pastInput:e(function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?`...`:``)+e.substr(-20).replace(/\n/g,``)},`pastInput`),upcomingInput:e(function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?`...`:``)).replace(/\n/g,``)},`upcomingInput`),showPosition:e(function(){var e=this.pastInput(),t=Array(e.length+1).join(`-`);return e+this.upcomingInput()+`
@@ -1,4 +1,4 @@
1
- import{p as e}from"./index-CJ_b6AjB.js";import{n as t}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import"./src-BhL2Ylf6.js";import{H as n,K as r,U as i,a,c as o,v as s,w as c,x as l,y as u}from"./chunk-WYO6CB5R-2sVpzpwa.js";import{t as d}from"./arc-DqK6O3qL.js";import{t as f}from"./chunk-5VM5RSS4-ZNzvKenW.js";import{a as p,n as m,o as h,s as g}from"./chunk-32BRIVSS-DnOQr5Hs.js";var _=(function(){var e=t(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[6,8,10,11,12,14,16,17,18],r=[1,9],i=[1,10],a=[1,11],o=[1,12],s=[1,13],c=[1,14],l={trace:t(function(){},`trace`),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:`error`,4:`journey`,6:`EOF`,8:`SPACE`,10:`NEWLINE`,11:`title`,12:`acc_title`,13:`acc_title_value`,14:`acc_descr`,15:`acc_descr_value`,16:`acc_descr_multiline_value`,17:`section`,18:`taskName`,19:`taskData`},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:t(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 1:return a[s-1];case 2:this.$=[];break;case 3:a[s-1].push(a[s]),this.$=a[s-1];break;case 4:case 5:this.$=a[s];break;case 6:case 7:this.$=[];break;case 8:r.setDiagramTitle(a[s].substr(6)),this.$=a[s].substr(6);break;case 9:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 10:case 11:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 12:r.addSection(a[s].substr(8)),this.$=a[s].substr(8);break;case 13:r.addTask(a[s-1],a[s]),this.$=`task`;break}},`anonymous`),table:[{3:1,4:[1,2]},{1:[3]},e(n,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:r,12:i,14:a,16:o,17:s,18:c},e(n,[2,7],{1:[2,1]}),e(n,[2,3]),{9:15,11:r,12:i,14:a,16:o,17:s,18:c},e(n,[2,5]),e(n,[2,6]),e(n,[2,8]),{13:[1,16]},{15:[1,17]},e(n,[2,11]),e(n,[2,12]),{19:[1,18]},e(n,[2,4]),e(n,[2,9]),e(n,[2,10]),e(n,[2,13])],defaultActions:{},parseError:t(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:t(function(e){var n=this,r=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(e,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;typeof g.yy.parseError==`function`?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function b(e){r.length-=2*e,a.length-=e,o.length-=e}t(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=n.symbols_[e]||e),e}t(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=r[r.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
1
+ import{p as e}from"./index-B11N7mVL.js";import{n as t}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import"./src-vDqOmCca.js";import{H as n,K as r,U as i,a,c as o,v as s,w as c,x as l,y as u}from"./chunk-DU6HZSFF-B9PGrM0S.js";import{t as d}from"./arc-DqK6O3qL.js";import{t as f}from"./chunk-5VM5RSS4-ZNzvKenW.js";import{a as p,n as m,o as h,s as g}from"./chunk-F27PBJKO-DDITEZtq.js";var _=(function(){var e=t(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[6,8,10,11,12,14,16,17,18],r=[1,9],i=[1,10],a=[1,11],o=[1,12],s=[1,13],c=[1,14],l={trace:t(function(){},`trace`),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:`error`,4:`journey`,6:`EOF`,8:`SPACE`,10:`NEWLINE`,11:`title`,12:`acc_title`,13:`acc_title_value`,14:`acc_descr`,15:`acc_descr_value`,16:`acc_descr_multiline_value`,17:`section`,18:`taskName`,19:`taskData`},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:t(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 1:return a[s-1];case 2:this.$=[];break;case 3:a[s-1].push(a[s]),this.$=a[s-1];break;case 4:case 5:this.$=a[s];break;case 6:case 7:this.$=[];break;case 8:r.setDiagramTitle(a[s].substr(6)),this.$=a[s].substr(6);break;case 9:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 10:case 11:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 12:r.addSection(a[s].substr(8)),this.$=a[s].substr(8);break;case 13:r.addTask(a[s-1],a[s]),this.$=`task`;break}},`anonymous`),table:[{3:1,4:[1,2]},{1:[3]},e(n,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:r,12:i,14:a,16:o,17:s,18:c},e(n,[2,7],{1:[2,1]}),e(n,[2,3]),{9:15,11:r,12:i,14:a,16:o,17:s,18:c},e(n,[2,5]),e(n,[2,6]),e(n,[2,8]),{13:[1,16]},{15:[1,17]},e(n,[2,11]),e(n,[2,12]),{19:[1,18]},e(n,[2,4]),e(n,[2,9]),e(n,[2,10]),e(n,[2,13])],defaultActions:{},parseError:t(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:t(function(e){var n=this,r=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(e,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;typeof g.yy.parseError==`function`?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function b(e){r.length-=2*e,a.length-=e,o.length-=e}t(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=n.symbols_[e]||e),e}t(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=r[r.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
2
2
  `+h.showPosition()+`
3
3
  Expecting `+j.join(`, `)+`, got '`+(this.terminals_[S]||S)+`'`:`Parse error on line `+(l+1)+`: Unexpected `+(S==p?`end of input`:`'`+(this.terminals_[S]||S)+`'`),this.parseError(M,{text:h.match,token:this.terminals_[S]||S,line:h.yylineno,loc:v,expected:j})}if(T[0]instanceof Array&&T.length>1)throw Error(`Parse Error: multiple actions possible at state: `+w+`, token: `+S);switch(T[0]){case 1:r.push(S),a.push(h.yytext),o.push(h.yylloc),r.push(T[1]),S=null,C?(S=C,C=null):(u=h.yyleng,c=h.yytext,l=h.yylineno,v=h.yylloc,d>0&&d--);break;case 2:if(k=this.productions_[T[1]][1],D.$=a[a.length-k],D._$={first_line:o[o.length-(k||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(k||1)].first_column,last_column:o[o.length-1].last_column},y&&(D._$.range=[o[o.length-(k||1)].range[0],o[o.length-1].range[1]]),E=this.performAction.apply(D,[c,u,l,g.yy,T[1],a,o].concat(m)),E!==void 0)return E;k&&(r=r.slice(0,-1*k*2),a=a.slice(0,-1*k),o=o.slice(0,-1*k)),r.push(this.productions_[T[1]][0]),a.push(D.$),o.push(D._$),A=s[r[r.length-2]][r[r.length-1]],r.push(A);break;case 3:return!0}}return!0},`parse`)};l.lexer=(function(){return{EOF:1,parseError:t(function(e,t){if(this.yy.parser)this.yy.parser.parseError(e,t);else throw Error(e)},`parseError`),setInput:t(function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=``,this.conditionStack=[`INITIAL`],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},`setInput`),input:t(function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},`input`),unput:t(function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},`unput`),more:t(function(){return this._more=!0,this},`more`),reject:t(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError(`Lexical error on line `+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:``,token:null,line:this.yylineno});return this},`reject`),less:t(function(e){this.unput(this.match.slice(e))},`less`),pastInput:t(function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?`...`:``)+e.substr(-20).replace(/\n/g,``)},`pastInput`),upcomingInput:t(function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?`...`:``)).replace(/\n/g,``)},`upcomingInput`),showPosition:t(function(){var e=this.pastInput(),t=Array(e.length+1).join(`-`);return e+this.upcomingInput()+`
@@ -53,7 +53,7 @@ Expecting `+j.join(`, `)+`, got '`+(this.terminals_[S]||S)+`'`:`Parse error on l
53
53
  fill: ${e.arrowheadColor};
54
54
  }
55
55
 
56
- .edgePath .path {
56
+ .edgePaths .path {
57
57
  stroke: ${e.lineColor};
58
58
  stroke-width: 1.5px;
59
59
  }