@thxgg/steward 0.1.17 → 0.1.19

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 (124) hide show
  1. package/.env.example +0 -6
  2. package/.output/nitro.json +1 -1
  3. package/.output/public/_nuxt/{BlTKcjLJ.js → BCiXS3ZV.js} +2 -2
  4. package/.output/public/_nuxt/BfUfZSFp.js +60 -0
  5. package/.output/public/_nuxt/{BMdjSp24.js → BfV4oCiT.js} +1 -1
  6. package/.output/public/_nuxt/{BSZqAKg4.js → Bs6UO7IT.js} +1 -1
  7. package/.output/public/_nuxt/C9AsKFSQ.js +1 -0
  8. package/.output/public/_nuxt/{BdjPva1I.js → C9jB6HQI.js} +1 -1
  9. package/.output/public/_nuxt/CCruYste.js +3 -0
  10. package/.output/public/_nuxt/CIIE0-WR.js +1 -0
  11. package/.output/public/_nuxt/{By7gAVcL.js → Cg4hnDua.js} +1 -1
  12. package/.output/public/_nuxt/CwdD8083.js +30 -0
  13. package/.output/public/_nuxt/{4r0X30JV.js → D2RLSKEu.js} +1 -1
  14. package/.output/public/_nuxt/{CbkpNvIu.js → D30YtxUg.js} +1 -1
  15. package/.output/public/_nuxt/{Beeir9iR.js → DEekox9p.js} +1 -1
  16. package/.output/public/_nuxt/{nX8Sf7cz.js → DddVAa3N.js} +1 -1
  17. package/.output/public/_nuxt/{Bh3vsUvl.js → MO41rxll.js} +1 -1
  18. package/.output/public/_nuxt/builds/latest.json +1 -1
  19. package/.output/public/_nuxt/builds/meta/627332c0-2e14-4849-8cac-e350f64ed513.json +1 -0
  20. package/.output/public/_nuxt/entry.Dp3jx0Yw.css +1 -0
  21. package/.output/public/_nuxt/f7vKgp5U.js +1 -0
  22. package/.output/public/_nuxt/xc3v2JZH.js +1 -0
  23. package/.output/server/chunks/_/git-api.mjs +1 -1
  24. package/.output/server/chunks/_/prd-service.mjs +177 -12
  25. package/.output/server/chunks/_/prd-service.mjs.map +1 -1
  26. package/.output/server/chunks/_/repos.mjs +272 -0
  27. package/.output/server/chunks/_/repos.mjs.map +1 -0
  28. package/.output/server/chunks/_/task-graph.mjs +19 -16
  29. package/.output/server/chunks/_/task-graph.mjs.map +1 -1
  30. package/.output/server/chunks/_/watcher.mjs +11 -35
  31. package/.output/server/chunks/_/watcher.mjs.map +1 -1
  32. package/.output/server/chunks/build/{Detail-MGwP_u2d.mjs → Detail-BcQGdJY5.mjs} +112 -46
  33. package/.output/server/chunks/build/Detail-BcQGdJY5.mjs.map +1 -0
  34. package/.output/server/chunks/build/{_prd_-C-Aj4fVa.mjs → _prd_-CD_Bds_B.mjs} +80 -7
  35. package/.output/server/chunks/build/_prd_-CD_Bds_B.mjs.map +1 -0
  36. package/.output/server/chunks/build/client.precomputed.mjs +1 -1
  37. package/.output/server/chunks/build/{default-Cao5eO80.mjs → default-BKKgG7HJ.mjs} +220 -24
  38. package/.output/server/chunks/build/default-BKKgG7HJ.mjs.map +1 -0
  39. package/.output/server/chunks/build/error-404-Bf6kdO80.mjs +1 -1
  40. package/.output/server/chunks/build/error-500-D_bcARXN.mjs +1 -1
  41. package/.output/server/chunks/build/{index-ljj9uTXI.mjs → index-DE1tjHAd.mjs} +3 -4
  42. package/.output/server/chunks/build/index-DE1tjHAd.mjs.map +1 -0
  43. package/.output/server/chunks/build/nuxt-link-SvT1nf8Z.mjs +1 -1
  44. package/.output/server/chunks/build/{repo-graph-EuhMeFt7.mjs → repo-graph-CBfhpnd5.mjs} +25 -12
  45. package/.output/server/chunks/build/repo-graph-CBfhpnd5.mjs.map +1 -0
  46. package/.output/server/chunks/build/server.mjs +14 -14
  47. package/.output/server/chunks/build/styles.mjs +2 -2
  48. package/.output/server/chunks/build/{usePrd-f7ylhIqs.mjs → usePrd-hXZOmvAv.mjs} +113 -9
  49. package/.output/server/chunks/build/usePrd-hXZOmvAv.mjs.map +1 -0
  50. package/.output/server/chunks/nitro/nitro.mjs +1051 -1365
  51. package/.output/server/chunks/nitro/nitro.mjs.map +1 -1
  52. package/.output/server/chunks/routes/api/browse.get.mjs +24 -6
  53. package/.output/server/chunks/routes/api/browse.get.mjs.map +1 -1
  54. package/.output/server/chunks/routes/api/index.get.mjs +3 -2
  55. package/.output/server/chunks/routes/api/index.get.mjs.map +1 -1
  56. package/.output/server/chunks/routes/api/index.post.mjs +22 -8
  57. package/.output/server/chunks/routes/api/index.post.mjs.map +1 -1
  58. package/.output/server/chunks/routes/api/repos/_repoId/git/commits.get.mjs +20 -11
  59. package/.output/server/chunks/routes/api/repos/_repoId/git/commits.get.mjs.map +1 -1
  60. package/.output/server/chunks/routes/api/repos/_repoId/git/diff.get.mjs +3 -2
  61. package/.output/server/chunks/routes/api/repos/_repoId/git/diff.get.mjs.map +1 -1
  62. package/.output/server/chunks/routes/api/repos/_repoId/git/file-content.get.mjs +3 -2
  63. package/.output/server/chunks/routes/api/repos/_repoId/git/file-content.get.mjs.map +1 -1
  64. package/.output/server/chunks/routes/api/repos/_repoId/git/file-diff.get.mjs +3 -2
  65. package/.output/server/chunks/routes/api/repos/_repoId/git/file-diff.get.mjs.map +1 -1
  66. package/.output/server/chunks/routes/api/repos/_repoId/graph.get.mjs +27 -3
  67. package/.output/server/chunks/routes/api/repos/_repoId/graph.get.mjs.map +1 -1
  68. package/.output/server/chunks/routes/api/repos/_repoId/prd/_prdSlug/archive.post.mjs +93 -0
  69. package/.output/server/chunks/routes/api/repos/_repoId/prd/_prdSlug/archive.post.mjs.map +1 -0
  70. package/.output/server/chunks/routes/api/repos/_repoId/prd/_prdSlug/graph.get.mjs +3 -2
  71. package/.output/server/chunks/routes/api/repos/_repoId/prd/_prdSlug/graph.get.mjs.map +1 -1
  72. package/.output/server/chunks/routes/api/repos/_repoId/prd/_prdSlug/progress.get.mjs +4 -3
  73. package/.output/server/chunks/routes/api/repos/_repoId/prd/_prdSlug/progress.get.mjs.map +1 -1
  74. package/.output/server/chunks/routes/api/repos/_repoId/prd/_prdSlug/tasks/_taskId/commits.get.mjs +4 -3
  75. package/.output/server/chunks/routes/api/repos/_repoId/prd/_prdSlug/tasks/_taskId/commits.get.mjs.map +1 -1
  76. package/.output/server/chunks/routes/api/repos/_repoId/prd/_prdSlug/tasks.get.mjs +4 -3
  77. package/.output/server/chunks/routes/api/repos/_repoId/prd/_prdSlug/tasks.get.mjs.map +1 -1
  78. package/.output/server/chunks/routes/api/repos/_repoId/prd/_prdSlug_.get.mjs +3 -2
  79. package/.output/server/chunks/routes/api/repos/_repoId/prd/_prdSlug_.get.mjs.map +1 -1
  80. package/.output/server/chunks/routes/api/repos/_repoId/prds.get.mjs +27 -3
  81. package/.output/server/chunks/routes/api/repos/_repoId/prds.get.mjs.map +1 -1
  82. package/.output/server/chunks/routes/api/repos/_repoId/refresh-git-repos.post.mjs +3 -2
  83. package/.output/server/chunks/routes/api/repos/_repoId/refresh-git-repos.post.mjs.map +1 -1
  84. package/.output/server/chunks/routes/api/repos/_repoId_.delete.mjs +3 -2
  85. package/.output/server/chunks/routes/api/repos/_repoId_.delete.mjs.map +1 -1
  86. package/.output/server/chunks/routes/api/runtime.get.mjs +2 -2
  87. package/.output/server/chunks/routes/api/state-migration/status.get.mjs +21 -0
  88. package/.output/server/chunks/routes/api/state-migration/status.get.mjs.map +1 -0
  89. package/.output/server/chunks/routes/api/watch.get.mjs +3 -2
  90. package/.output/server/chunks/routes/api/watch.get.mjs.map +1 -1
  91. package/.output/server/chunks/routes/renderer.mjs +1 -1
  92. package/.output/server/index.mjs +2 -2
  93. package/.output/server/package.json +1 -1
  94. package/README.md +5 -7
  95. package/dist/host/src/api/repos.js +0 -2
  96. package/dist/host/src/api/state.js +1 -7
  97. package/dist/host/src/index.js +2 -7
  98. package/dist/host/src/ui.js +2 -7
  99. package/dist/server/utils/db.js +15 -0
  100. package/dist/server/utils/prd-archive.js +53 -0
  101. package/dist/server/utils/prd-service.js +27 -11
  102. package/dist/server/utils/prd-state.js +11 -122
  103. package/dist/server/utils/repos.js +14 -4
  104. package/dist/server/utils/state-migration.js +225 -0
  105. package/dist/server/utils/state-schema.js +181 -4
  106. package/dist/server/utils/task-graph.js +21 -14
  107. package/package.json +1 -1
  108. package/.output/public/_nuxt/CbJfCtEa.js +0 -1
  109. package/.output/public/_nuxt/CmhLcqDu.js +0 -1
  110. package/.output/public/_nuxt/DC6iPLz1.js +0 -30
  111. package/.output/public/_nuxt/DD--ojY9.js +0 -3
  112. package/.output/public/_nuxt/DhKWRjCh.js +0 -60
  113. package/.output/public/_nuxt/builds/meta/f3f42dbd-d501-442b-871c-3d06157e7aa1.json +0 -1
  114. package/.output/public/_nuxt/c1sXju8w.js +0 -1
  115. package/.output/public/_nuxt/eGCjCghR.js +0 -1
  116. package/.output/public/_nuxt/entry.LcDOtJnR.css +0 -1
  117. package/.output/server/chunks/build/Detail-MGwP_u2d.mjs.map +0 -1
  118. package/.output/server/chunks/build/_prd_-C-Aj4fVa.mjs.map +0 -1
  119. package/.output/server/chunks/build/default-Cao5eO80.mjs.map +0 -1
  120. package/.output/server/chunks/build/index-ByZO4Bvq.mjs +0 -76
  121. package/.output/server/chunks/build/index-ByZO4Bvq.mjs.map +0 -1
  122. package/.output/server/chunks/build/index-ljj9uTXI.mjs.map +0 -1
  123. package/.output/server/chunks/build/repo-graph-EuhMeFt7.mjs.map +0 -1
  124. package/.output/server/chunks/build/usePrd-f7ylhIqs.mjs.map +0 -1
@@ -0,0 +1,30 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./D30YtxUg.js","./DddVAa3N.js","./BCiXS3ZV.js","./entry.Dp3jx0Yw.css"])))=>i.map(i=>d[i]);
2
+ import{c as Te,f as Ki,B as ct,b as Qi,F as Ji,r as es,e as ts}from"./xc3v2JZH.js";import{g as xe,N as ns,A as Or,o as Z,c as ee,b as oe,w as me,y as Ie,l as $,i as zt,O as Pr,k as ye,E as Re,H as ze,s as ie,P as os,z as rt,a as q,F as $e,r as Ve,B as nt,D as Dr,Q as rs,x as be,n as he,q as ve,C as ut,R as Ce,t as fe,S as At,T as zr,U as pn,V as $t,W as ke,X as _e,Y as is,m as _o,v as ss,Z as as,_ as Vt,$ as kt,a0 as ls,a1 as Ar,a2 as us,L as xo,I as He,d as Se,a3 as cs,a4 as ds,a5 as fs,a6 as hs}from"./BCiXS3ZV.js";import{T as Mt,L as ro,C as bn,G as gs,f as ps,R as Po,g as Do,h as zo,i as Ao,K as vs,j as Lo,S as ms,k as ys,B as vn,l as ws,m as _s,n as xs,o as bs,p as Es,q as ks,r as Ss,s as Ns,t as Cs}from"./CCruYste.js";import{A as Bo}from"./C9jB6HQI.js";import{_ as $s}from"./DlAUqK2U.js";import{_ as Ms}from"./DEekox9p.js";const Is=Te("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);const Ts=Te("calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);const En=Te("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const Gt=Te("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const Lr=Te("clock-3",[["path",{d:"M12 6v6h4",key:"135r8i"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const Os=Te("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const Ps=Te("diff",[["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 10h14",key:"elsbfy"}],["path",{d:"M5 21h14",key:"11awu3"}]]);const Ds=Te("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);const zs=Te("file-code",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]]);const As=Te("file-diff",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]]);const Ls=Te("file-exclamation-point",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const Bs=Te("file-pen",[["path",{d:"M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34",key:"o6klzx"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z",key:"zhnas1"}]]);const Vs=Te("file-plus",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]);const Rs=Te("file-x",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m14.5 12.5-5 5",key:"b62r18"}],["path",{d:"m9.5 12.5 5 5",key:"1rk7el"}]]);const Hs=Te("folder-git-2",[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]);const Fs=Te("git-commit-horizontal",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]]);const Gs=Te("link-2-off",[["path",{d:"M9 17H7A5 5 0 0 1 7 7",key:"10o201"}],["path",{d:"M15 7h2a5 5 0 0 1 4 8",key:"1d3206"}],["line",{x1:"8",x2:"12",y1:"12",y2:"12",key:"rvw6j4"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);const Ys=Te("link-2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);const js=Te("link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);const Xs=Te("list-ordered",[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]]);const Ws=Te("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);const Us=Te("square-check-big",[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);const Zs=Te("tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);var Ne=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ye=Ne((e,t)=>{var n=Object.defineProperty,o=(M,f,w)=>f in M?n(M,f,{enumerable:!0,configurable:!0,writable:!0,value:w}):M[f]=w,r=(M,f)=>()=>(f||M((f={exports:{}}).exports,f),f.exports),i=(M,f,w)=>o(M,typeof f!="symbol"?f+"":f,w),s=r((M,f)=>{var w="\0",v="\0",C="",z=class{constructor(T){i(this,"_isDirected",!0),i(this,"_isMultigraph",!1),i(this,"_isCompound",!1),i(this,"_label"),i(this,"_defaultNodeLabelFn",()=>{}),i(this,"_defaultEdgeLabelFn",()=>{}),i(this,"_nodes",{}),i(this,"_in",{}),i(this,"_preds",{}),i(this,"_out",{}),i(this,"_sucs",{}),i(this,"_edgeObjs",{}),i(this,"_edgeLabels",{}),i(this,"_nodeCount",0),i(this,"_edgeCount",0),i(this,"_parent"),i(this,"_children"),T&&(this._isDirected=Object.hasOwn(T,"directed")?T.directed:!0,this._isMultigraph=Object.hasOwn(T,"multigraph")?T.multigraph:!1,this._isCompound=Object.hasOwn(T,"compound")?T.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[v]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(T){return this._label=T,this}graph(){return this._label}setDefaultNodeLabel(T){return this._defaultNodeLabelFn=T,typeof T!="function"&&(this._defaultNodeLabelFn=()=>T),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var T=this;return this.nodes().filter(m=>Object.keys(T._in[m]).length===0)}sinks(){var T=this;return this.nodes().filter(m=>Object.keys(T._out[m]).length===0)}setNodes(T,m){var I=arguments,L=this;return T.forEach(function(X){I.length>1?L.setNode(X,m):L.setNode(X)}),this}setNode(T,m){return Object.hasOwn(this._nodes,T)?(arguments.length>1&&(this._nodes[T]=m),this):(this._nodes[T]=arguments.length>1?m:this._defaultNodeLabelFn(T),this._isCompound&&(this._parent[T]=v,this._children[T]={},this._children[v][T]=!0),this._in[T]={},this._preds[T]={},this._out[T]={},this._sucs[T]={},++this._nodeCount,this)}node(T){return this._nodes[T]}hasNode(T){return Object.hasOwn(this._nodes,T)}removeNode(T){var m=this;if(Object.hasOwn(this._nodes,T)){var I=L=>m.removeEdge(m._edgeObjs[L]);delete this._nodes[T],this._isCompound&&(this._removeFromParentsChildList(T),delete this._parent[T],this.children(T).forEach(function(L){m.setParent(L)}),delete this._children[T]),Object.keys(this._in[T]).forEach(I),delete this._in[T],delete this._preds[T],Object.keys(this._out[T]).forEach(I),delete this._out[T],delete this._sucs[T],--this._nodeCount}return this}setParent(T,m){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(m===void 0)m=v;else{m+="";for(var I=m;I!==void 0;I=this.parent(I))if(I===T)throw new Error("Setting "+m+" as parent of "+T+" would create a cycle");this.setNode(m)}return this.setNode(T),this._removeFromParentsChildList(T),this._parent[T]=m,this._children[m][T]=!0,this}_removeFromParentsChildList(T){delete this._children[this._parent[T]][T]}parent(T){if(this._isCompound){var m=this._parent[T];if(m!==v)return m}}children(T=v){if(this._isCompound){var m=this._children[T];if(m)return Object.keys(m)}else{if(T===v)return this.nodes();if(this.hasNode(T))return[]}}predecessors(T){var m=this._preds[T];if(m)return Object.keys(m)}successors(T){var m=this._sucs[T];if(m)return Object.keys(m)}neighbors(T){var m=this.predecessors(T);if(m){let L=new Set(m);for(var I of this.successors(T))L.add(I);return Array.from(L.values())}}isLeaf(T){var m;return this.isDirected()?m=this.successors(T):m=this.neighbors(T),m.length===0}filterNodes(T){var m=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});m.setGraph(this.graph());var I=this;Object.entries(this._nodes).forEach(function([J,te]){T(J)&&m.setNode(J,te)}),Object.values(this._edgeObjs).forEach(function(J){m.hasNode(J.v)&&m.hasNode(J.w)&&m.setEdge(J,I.edge(J))});var L={};function X(J){var te=I.parent(J);return te===void 0||m.hasNode(te)?(L[J]=te,te):te in L?L[te]:X(te)}return this._isCompound&&m.nodes().forEach(J=>m.setParent(J,X(J))),m}setDefaultEdgeLabel(T){return this._defaultEdgeLabelFn=T,typeof T!="function"&&(this._defaultEdgeLabelFn=()=>T),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(T,m){var I=this,L=arguments;return T.reduce(function(X,J){return L.length>1?I.setEdge(X,J,m):I.setEdge(X,J),J}),this}setEdge(){var T,m,I,L,X=!1,J=arguments[0];typeof J=="object"&&J!==null&&"v"in J?(T=J.v,m=J.w,I=J.name,arguments.length===2&&(L=arguments[1],X=!0)):(T=J,m=arguments[1],I=arguments[3],arguments.length>2&&(L=arguments[2],X=!0)),T=""+T,m=""+m,I!==void 0&&(I=""+I);var te=G(this._isDirected,T,m,I);if(Object.hasOwn(this._edgeLabels,te))return X&&(this._edgeLabels[te]=L),this;if(I!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(T),this.setNode(m),this._edgeLabels[te]=X?L:this._defaultEdgeLabelFn(T,m,I);var ne=U(this._isDirected,T,m,I);return T=ne.v,m=ne.w,Object.freeze(ne),this._edgeObjs[te]=ne,F(this._preds[m],T),F(this._sucs[T],m),this._in[m][te]=ne,this._out[T][te]=ne,this._edgeCount++,this}edge(T,m,I){var L=arguments.length===1?K(this._isDirected,arguments[0]):G(this._isDirected,T,m,I);return this._edgeLabels[L]}edgeAsObj(){let T=this.edge(...arguments);return typeof T!="object"?{label:T}:T}hasEdge(T,m,I){var L=arguments.length===1?K(this._isDirected,arguments[0]):G(this._isDirected,T,m,I);return Object.hasOwn(this._edgeLabels,L)}removeEdge(T,m,I){var L=arguments.length===1?K(this._isDirected,arguments[0]):G(this._isDirected,T,m,I),X=this._edgeObjs[L];return X&&(T=X.v,m=X.w,delete this._edgeLabels[L],delete this._edgeObjs[L],B(this._preds[m],T),B(this._sucs[T],m),delete this._in[m][L],delete this._out[T][L],this._edgeCount--),this}inEdges(T,m){return this.isDirected()?this.filterEdges(this._in[T],T,m):this.nodeEdges(T,m)}outEdges(T,m){return this.isDirected()?this.filterEdges(this._out[T],T,m):this.nodeEdges(T,m)}nodeEdges(T,m){if(T in this._nodes)return this.filterEdges({...this._in[T],...this._out[T]},T,m)}filterEdges(T,m,I){if(T){var L=Object.values(T);return I?L.filter(function(X){return X.v===m&&X.w===I||X.v===I&&X.w===m}):L}}};function F(T,m){T[m]?T[m]++:T[m]=1}function B(T,m){--T[m]||delete T[m]}function G(T,m,I,L){var X=""+m,J=""+I;if(!T&&X>J){var te=X;X=J,J=te}return X+C+J+C+(L===void 0?w:L)}function U(T,m,I,L){var X=""+m,J=""+I;if(!T&&X>J){var te=X;X=J,J=te}var ne={v:X,w:J};return L&&(ne.name=L),ne}function K(T,m){return G(T,m.v,m.w,m.name)}f.exports=z}),a=r((M,f)=>{f.exports="3.0.2"}),l=r((M,f)=>{f.exports={Graph:s(),version:a()}}),c=r((M,f)=>{var w=s();f.exports={write:v,read:F};function v(B){var G={options:{directed:B.isDirected(),multigraph:B.isMultigraph(),compound:B.isCompound()},nodes:C(B),edges:z(B)};return B.graph()!==void 0&&(G.value=structuredClone(B.graph())),G}function C(B){return B.nodes().map(function(G){var U=B.node(G),K=B.parent(G),T={v:G};return U!==void 0&&(T.value=U),K!==void 0&&(T.parent=K),T})}function z(B){return B.edges().map(function(G){var U=B.edge(G),K={v:G.v,w:G.w};return G.name!==void 0&&(K.name=G.name),U!==void 0&&(K.value=U),K})}function F(B){var G=new w(B.options).setGraph(B.value);return B.nodes.forEach(function(U){G.setNode(U.v,U.value),U.parent&&G.setParent(U.v,U.parent)}),B.edges.forEach(function(U){G.setEdge({v:U.v,w:U.w,name:U.name},U.value)}),G}}),u=r((M,f)=>{f.exports=v;var w=()=>1;function v(z,F,B,G){return C(z,String(F),B||w,G||function(U){return z.outEdges(U)})}function C(z,F,B,G){var U={},K=!0,T=0,m=z.nodes(),I=function(te){var ne=B(te);U[te.v].distance+ne<U[te.w].distance&&(U[te.w]={distance:U[te.v].distance+ne,predecessor:te.v},K=!0)},L=function(){m.forEach(function(te){G(te).forEach(function(ne){var ae=ne.v===te?ne.v:ne.w,ge=ae===ne.v?ne.w:ne.v;I({v:ae,w:ge})})})};m.forEach(function(te){var ne=te===F?0:Number.POSITIVE_INFINITY;U[te]={distance:ne}});for(var X=m.length,J=1;J<X&&(K=!1,T++,L(),!!K);J++);if(T===X-1&&(K=!1,L(),K))throw new Error("The graph contains a negative weight cycle");return U}}),d=r((M,f)=>{f.exports=w;function w(v){var C={},z=[],F;function B(G){Object.hasOwn(C,G)||(C[G]=!0,F.push(G),v.successors(G).forEach(B),v.predecessors(G).forEach(B))}return v.nodes().forEach(function(G){F=[],B(G),F.length&&z.push(F)}),z}}),h=r((M,f)=>{var w=class{constructor(){i(this,"_arr",[]),i(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(v){return v.key})}has(v){return Object.hasOwn(this._keyIndices,v)}priority(v){var C=this._keyIndices[v];if(C!==void 0)return this._arr[C].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(v,C){var z=this._keyIndices;if(v=String(v),!Object.hasOwn(z,v)){var F=this._arr,B=F.length;return z[v]=B,F.push({key:v,priority:C}),this._decrease(B),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var v=this._arr.pop();return delete this._keyIndices[v.key],this._heapify(0),v.key}decrease(v,C){var z=this._keyIndices[v];if(C>this._arr[z].priority)throw new Error("New priority is greater than current priority. Key: "+v+" Old: "+this._arr[z].priority+" New: "+C);this._arr[z].priority=C,this._decrease(z)}_heapify(v){var C=this._arr,z=2*v,F=z+1,B=v;z<C.length&&(B=C[z].priority<C[B].priority?z:B,F<C.length&&(B=C[F].priority<C[B].priority?F:B),B!==v&&(this._swap(v,B),this._heapify(B)))}_decrease(v){for(var C=this._arr,z=C[v].priority,F;v!==0&&(F=v>>1,!(C[F].priority<z));)this._swap(v,F),v=F}_swap(v,C){var z=this._arr,F=this._keyIndices,B=z[v],G=z[C];z[v]=G,z[C]=B,F[G.key]=v,F[B.key]=C}};f.exports=w}),g=r((M,f)=>{var w=h();f.exports=C;var v=()=>1;function C(F,B,G,U){var K=function(T){return F.outEdges(T)};return z(F,String(B),G||v,U||K)}function z(F,B,G,U){var K={},T=new w,m,I,L=function(X){var J=X.v!==m?X.v:X.w,te=K[J],ne=G(X),ae=I.distance+ne;if(ne<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+X+" Weight: "+ne);ae<te.distance&&(te.distance=ae,te.predecessor=m,T.decrease(J,ae))};for(F.nodes().forEach(function(X){var J=X===B?0:Number.POSITIVE_INFINITY;K[X]={distance:J},T.add(X,J)});T.size()>0&&(m=T.removeMin(),I=K[m],I.distance!==Number.POSITIVE_INFINITY);)U(m).forEach(L);return K}}),b=r((M,f)=>{var w=g();f.exports=v;function v(C,z,F){return C.nodes().reduce(function(B,G){return B[G]=w(C,G,z,F),B},{})}}),S=r((M,f)=>{f.exports=w;function w(C,z,F){if(C[z].predecessor!==void 0)throw new Error("Invalid source vertex");if(C[F].predecessor===void 0&&F!==z)throw new Error("Invalid destination vertex");return{weight:C[F].distance,path:v(C,z,F)}}function v(C,z,F){for(var B=[],G=F;G!==z;)B.push(G),G=C[G].predecessor;return B.push(z),B.reverse()}}),k=r((M,f)=>{f.exports=w;function w(v){var C=0,z=[],F={},B=[];function G(U){var K=F[U]={onStack:!0,lowlink:C,index:C++};if(z.push(U),v.successors(U).forEach(function(I){Object.hasOwn(F,I)?F[I].onStack&&(K.lowlink=Math.min(K.lowlink,F[I].index)):(G(I),K.lowlink=Math.min(K.lowlink,F[I].lowlink))}),K.lowlink===K.index){var T=[],m;do m=z.pop(),F[m].onStack=!1,T.push(m);while(U!==m);B.push(T)}}return v.nodes().forEach(function(U){Object.hasOwn(F,U)||G(U)}),B}}),x=r((M,f)=>{var w=k();f.exports=v;function v(C){return w(C).filter(function(z){return z.length>1||z.length===1&&C.hasEdge(z[0],z[0])})}}),_=r((M,f)=>{f.exports=v;var w=()=>1;function v(z,F,B){return C(z,F||w,B||function(G){return z.outEdges(G)})}function C(z,F,B){var G={},U=z.nodes();return U.forEach(function(K){G[K]={},G[K][K]={distance:0},U.forEach(function(T){K!==T&&(G[K][T]={distance:Number.POSITIVE_INFINITY})}),B(K).forEach(function(T){var m=T.v===K?T.w:T.v,I=F(T);G[K][m]={distance:I,predecessor:K}})}),U.forEach(function(K){var T=G[K];U.forEach(function(m){var I=G[m];U.forEach(function(L){var X=I[K],J=T[L],te=I[L],ne=X.distance+J.distance;ne<te.distance&&(te.distance=ne,te.predecessor=J.predecessor)})})}),G}}),p=r((M,f)=>{function w(C){var z={},F={},B=[];function G(U){if(Object.hasOwn(F,U))throw new v;Object.hasOwn(z,U)||(F[U]=!0,z[U]=!0,C.predecessors(U).forEach(G),delete F[U],B.push(U))}if(C.sinks().forEach(G),Object.keys(z).length!==C.nodeCount())throw new v;return B}var v=class extends Error{constructor(){super(...arguments)}};f.exports=w,w.CycleException=v}),y=r((M,f)=>{var w=p();f.exports=v;function v(C){try{w(C)}catch(z){if(z instanceof w.CycleException)return!1;throw z}return!0}}),D=r((M,f)=>{f.exports=w;function w(C,z,F,B,G){Array.isArray(z)||(z=[z]);var U=(C.isDirected()?C.successors:C.neighbors).bind(C),K={};return z.forEach(function(T){if(!C.hasNode(T))throw new Error("Graph does not have node: "+T);G=v(C,T,F==="post",K,U,B,G)}),G}function v(C,z,F,B,G,U,K){return Object.hasOwn(B,z)||(B[z]=!0,F||(K=U(K,z)),G(z).forEach(function(T){K=v(C,T,F,B,G,U,K)}),F&&(K=U(K,z))),K}}),R=r((M,f)=>{var w=D();f.exports=v;function v(C,z,F){return w(C,z,F,function(B,G){return B.push(G),B},[])}}),Y=r((M,f)=>{var w=R();f.exports=v;function v(C,z){return w(C,z,"post")}}),H=r((M,f)=>{var w=R();f.exports=v;function v(C,z){return w(C,z,"pre")}}),Q=r((M,f)=>{var w=s(),v=h();f.exports=C;function C(z,F){var B=new w,G={},U=new v,K;function T(I){var L=I.v===K?I.w:I.v,X=U.priority(L);if(X!==void 0){var J=F(I);J<X&&(G[L]=K,U.decrease(L,J))}}if(z.nodeCount()===0)return B;z.nodes().forEach(function(I){U.add(I,Number.POSITIVE_INFINITY),B.setNode(I)}),U.decrease(z.nodes()[0],0);for(var m=!1;U.size()>0;){if(K=U.removeMin(),Object.hasOwn(G,K))B.setEdge(K,G[K]);else{if(m)throw new Error("Input graph is not connected: "+z);m=!0}z.nodeEdges(K).forEach(T)}return B}}),O=r((M,f)=>{var w=g(),v=u();f.exports=C;function C(F,B,G,U){return z(F,B,G,U||function(K){return F.outEdges(K)})}function z(F,B,G,U){if(G===void 0)return w(F,B,G,U);for(var K=!1,T=F.nodes(),m=0;m<T.length;m++){for(var I=U(T[m]),L=0;L<I.length;L++){var X=I[L],J=X.v===T[m]?X.v:X.w,te=J===X.v?X.w:X.v;G({v:J,w:te})<0&&(K=!0)}if(K)return v(F,B,G,U)}return w(F,B,G,U)}}),A=r((M,f)=>{f.exports={bellmanFord:u(),components:d(),dijkstra:g(),dijkstraAll:b(),extractPath:S(),findCycles:x(),floydWarshall:_(),isAcyclic:y(),postorder:Y(),preorder:H(),prim:Q(),shortestPaths:O(),reduce:D(),tarjan:k(),topsort:p()}}),E=l();t.exports={Graph:E.Graph,json:c(),alg:A(),version:E.version}}),qs=Ne((e,t)=>{var n=class{constructor(){let i={};i._next=i._prev=i,this._sentinel=i}dequeue(){let i=this._sentinel,s=i._prev;if(s!==i)return o(s),s}enqueue(i){let s=this._sentinel;i._prev&&i._next&&o(i),i._next=s._next,s._next._prev=i,s._next=i,i._prev=s}toString(){let i=[],s=this._sentinel,a=s._prev;for(;a!==s;)i.push(JSON.stringify(a,r)),a=a._prev;return"["+i.join(", ")+"]"}};function o(i){i._prev._next=i._next,i._next._prev=i._prev,delete i._next,delete i._prev}function r(i,s){if(i!=="_next"&&i!=="_prev")return s}t.exports=n}),Ks=Ne((e,t)=>{var n=Ye().Graph,o=qs();t.exports=i;var r=()=>1;function i(d,h){if(d.nodeCount()<=1)return[];let g=l(d,h||r);return s(g.graph,g.buckets,g.zeroIdx).flatMap(b=>d.outEdges(b.v,b.w))}function s(d,h,g){let b=[],S=h[h.length-1],k=h[0],x;for(;d.nodeCount();){for(;x=k.dequeue();)a(d,h,g,x);for(;x=S.dequeue();)a(d,h,g,x);if(d.nodeCount()){for(let _=h.length-2;_>0;--_)if(x=h[_].dequeue(),x){b=b.concat(a(d,h,g,x,!0));break}}}return b}function a(d,h,g,b,S){let k=S?[]:void 0;return d.inEdges(b.v).forEach(x=>{let _=d.edge(x),p=d.node(x.v);S&&k.push({v:x.v,w:x.w}),p.out-=_,c(h,g,p)}),d.outEdges(b.v).forEach(x=>{let _=d.edge(x),p=x.w,y=d.node(p);y.in-=_,c(h,g,y)}),d.removeNode(b.v),k}function l(d,h){let g=new n,b=0,S=0;d.nodes().forEach(_=>{g.setNode(_,{v:_,in:0,out:0})}),d.edges().forEach(_=>{let p=g.edge(_.v,_.w)||0,y=h(_),D=p+y;g.setEdge(_.v,_.w,D),S=Math.max(S,g.node(_.v).out+=y),b=Math.max(b,g.node(_.w).in+=y)});let k=u(S+b+3).map(()=>new o),x=b+1;return g.nodes().forEach(_=>{c(k,x,g.node(_))}),{graph:g,buckets:k,zeroIdx:x}}function c(d,h,g){g.out?g.in?d[g.out-g.in+h].enqueue(g):d[d.length-1].enqueue(g):d[0].enqueue(g)}function u(d){let h=[];for(let g=0;g<d;g++)h.push(g);return h}}),De=Ne((e,t)=>{var n=Ye().Graph;t.exports={addBorderNode:h,addDummyNode:o,applyWithChunking:S,asNonCompoundGraph:i,buildLayerMatrix:c,intersectRect:l,mapValues:H,maxRank:k,normalizeRanks:u,notime:p,partition:x,pick:Y,predecessorWeights:a,range:R,removeEmptyRanks:d,simplify:r,successorWeights:s,time:_,uniqueId:D,zipObject:Q};function o(O,A,E,M){for(var f=M;O.hasNode(f);)f=D(M);return E.dummy=A,O.setNode(f,E),f}function r(O){let A=new n().setGraph(O.graph());return O.nodes().forEach(E=>A.setNode(E,O.node(E))),O.edges().forEach(E=>{let M=A.edge(E.v,E.w)||{weight:0,minlen:1},f=O.edge(E);A.setEdge(E.v,E.w,{weight:M.weight+f.weight,minlen:Math.max(M.minlen,f.minlen)})}),A}function i(O){let A=new n({multigraph:O.isMultigraph()}).setGraph(O.graph());return O.nodes().forEach(E=>{O.children(E).length||A.setNode(E,O.node(E))}),O.edges().forEach(E=>{A.setEdge(E,O.edge(E))}),A}function s(O){let A=O.nodes().map(E=>{let M={};return O.outEdges(E).forEach(f=>{M[f.w]=(M[f.w]||0)+O.edge(f).weight}),M});return Q(O.nodes(),A)}function a(O){let A=O.nodes().map(E=>{let M={};return O.inEdges(E).forEach(f=>{M[f.v]=(M[f.v]||0)+O.edge(f).weight}),M});return Q(O.nodes(),A)}function l(O,A){let E=O.x,M=O.y,f=A.x-E,w=A.y-M,v=O.width/2,C=O.height/2;if(!f&&!w)throw new Error("Not possible to find intersection inside of the rectangle");let z,F;return Math.abs(w)*v>Math.abs(f)*C?(w<0&&(C=-C),z=C*f/w,F=C):(f<0&&(v=-v),z=v,F=v*w/f),{x:E+z,y:M+F}}function c(O){let A=R(k(O)+1).map(()=>[]);return O.nodes().forEach(E=>{let M=O.node(E),f=M.rank;f!==void 0&&(A[f][M.order]=E)}),A}function u(O){let A=O.nodes().map(M=>{let f=O.node(M).rank;return f===void 0?Number.MAX_VALUE:f}),E=S(Math.min,A);O.nodes().forEach(M=>{let f=O.node(M);Object.hasOwn(f,"rank")&&(f.rank-=E)})}function d(O){let A=O.nodes().map(v=>O.node(v).rank).filter(v=>v!==void 0),E=S(Math.min,A),M=[];O.nodes().forEach(v=>{let C=O.node(v).rank-E;M[C]||(M[C]=[]),M[C].push(v)});let f=0,w=O.graph().nodeRankFactor;Array.from(M).forEach((v,C)=>{v===void 0&&C%w!==0?--f:v!==void 0&&f&&v.forEach(z=>O.node(z).rank+=f)})}function h(O,A,E,M){let f={width:0,height:0};return arguments.length>=4&&(f.rank=E,f.order=M),o(O,"border",f,A)}function g(O,A=b){let E=[];for(let M=0;M<O.length;M+=A){let f=O.slice(M,M+A);E.push(f)}return E}var b=65535;function S(O,A){if(A.length>b){let E=g(A);return O.apply(null,E.map(M=>O.apply(null,M)))}else return O.apply(null,A)}function k(O){let A=O.nodes().map(E=>{let M=O.node(E).rank;return M===void 0?Number.MIN_VALUE:M});return S(Math.max,A)}function x(O,A){let E={lhs:[],rhs:[]};return O.forEach(M=>{A(M)?E.lhs.push(M):E.rhs.push(M)}),E}function _(O,A){let E=Date.now();try{return A()}finally{console.log(O+" time: "+(Date.now()-E)+"ms")}}function p(O,A){return A()}var y=0;function D(O){var A=++y;return O+(""+A)}function R(O,A,E=1){A==null&&(A=O,O=0);let M=w=>w<A;E<0&&(M=w=>A<w);let f=[];for(let w=O;M(w);w+=E)f.push(w);return f}function Y(O,A){let E={};for(let M of A)O[M]!==void 0&&(E[M]=O[M]);return E}function H(O,A){let E=A;return typeof A=="string"&&(E=M=>M[A]),Object.entries(O).reduce((M,[f,w])=>(M[f]=E(w,f),M),{})}function Q(O,A){return O.reduce((E,M,f)=>(E[M]=A[f],E),{})}}),Qs=Ne((e,t)=>{var n=Ks(),o=De().uniqueId;t.exports={run:r,undo:s};function r(a){(a.graph().acyclicer==="greedy"?n(a,l(a)):i(a)).forEach(c=>{let u=a.edge(c);a.removeEdge(c),u.forwardName=c.name,u.reversed=!0,a.setEdge(c.w,c.v,u,o("rev"))});function l(c){return u=>c.edge(u).weight}}function i(a){let l=[],c={},u={};function d(h){Object.hasOwn(u,h)||(u[h]=!0,c[h]=!0,a.outEdges(h).forEach(g=>{Object.hasOwn(c,g.w)?l.push(g):d(g.w)}),delete c[h])}return a.nodes().forEach(d),l}function s(a){a.edges().forEach(l=>{let c=a.edge(l);if(c.reversed){a.removeEdge(l);let u=c.forwardName;delete c.reversed,delete c.forwardName,a.setEdge(l.w,l.v,c,u)}})}}),Js=Ne((e,t)=>{var n=De();t.exports={run:o,undo:i};function o(s){s.graph().dummyChains=[],s.edges().forEach(a=>r(s,a))}function r(s,a){let l=a.v,c=s.node(l).rank,u=a.w,d=s.node(u).rank,h=a.name,g=s.edge(a),b=g.labelRank;if(d===c+1)return;s.removeEdge(a);let S,k,x;for(x=0,++c;c<d;++x,++c)g.points=[],k={width:0,height:0,edgeLabel:g,edgeObj:a,rank:c},S=n.addDummyNode(s,"edge",k,"_d"),c===b&&(k.width=g.width,k.height=g.height,k.dummy="edge-label",k.labelpos=g.labelpos),s.setEdge(l,S,{weight:g.weight},h),x===0&&s.graph().dummyChains.push(S),l=S;s.setEdge(l,u,{weight:g.weight},h)}function i(s){s.graph().dummyChains.forEach(a=>{let l=s.node(a),c=l.edgeLabel,u;for(s.setEdge(l.edgeObj,c);l.dummy;)u=s.successors(a)[0],s.removeNode(a),c.points.push({x:l.x,y:l.y}),l.dummy==="edge-label"&&(c.x=l.x,c.y=l.y,c.width=l.width,c.height=l.height),a=u,l=s.node(a)})}}),kn=Ne((e,t)=>{var{applyWithChunking:n}=De();t.exports={longestPath:o,slack:r};function o(i){var s={};function a(l){var c=i.node(l);if(Object.hasOwn(s,l))return c.rank;s[l]=!0;let u=i.outEdges(l).map(h=>h==null?Number.POSITIVE_INFINITY:a(h.w)-i.edge(h).minlen);var d=n(Math.min,u);return d===Number.POSITIVE_INFINITY&&(d=0),c.rank=d}i.sources().forEach(a)}function r(i,s){return i.node(s.w).rank-i.node(s.v).rank-i.edge(s).minlen}}),Br=Ne((e,t)=>{var n=Ye().Graph,o=kn().slack;t.exports=r;function r(l){var c=new n({directed:!1}),u=l.nodes()[0],d=l.nodeCount();c.setNode(u,{});for(var h,g;i(c,l)<d;)h=s(c,l),g=c.hasNode(h.v)?o(l,h):-o(l,h),a(c,l,g);return c}function i(l,c){function u(d){c.nodeEdges(d).forEach(h=>{var g=h.v,b=d===g?h.w:g;!l.hasNode(b)&&!o(c,h)&&(l.setNode(b,{}),l.setEdge(d,b,{}),u(b))})}return l.nodes().forEach(u),l.nodeCount()}function s(l,c){return c.edges().reduce((u,d)=>{let h=Number.POSITIVE_INFINITY;return l.hasNode(d.v)!==l.hasNode(d.w)&&(h=o(c,d)),h<u[0]?[h,d]:u},[Number.POSITIVE_INFINITY,null])[1]}function a(l,c,u){l.nodes().forEach(d=>c.node(d).rank+=u)}}),ea=Ne((e,t)=>{var n=Br(),o=kn().slack,r=kn().longestPath,i=Ye().alg.preorder,s=Ye().alg.postorder,a=De().simplify;t.exports=l,l.initLowLimValues=h,l.initCutValues=c,l.calcCutValue=d,l.leaveEdge=b,l.enterEdge=S,l.exchangeEdges=k;function l(y){y=a(y),r(y);var D=n(y);h(D),c(D,y);for(var R,Y;R=b(D);)Y=S(D,y,R),k(D,y,R,Y)}function c(y,D){var R=s(y,y.nodes());R=R.slice(0,R.length-1),R.forEach(Y=>u(y,D,Y))}function u(y,D,R){var Y=y.node(R),H=Y.parent;y.edge(R,H).cutvalue=d(y,D,R)}function d(y,D,R){var Y=y.node(R),H=Y.parent,Q=!0,O=D.edge(R,H),A=0;return O||(Q=!1,O=D.edge(H,R)),A=O.weight,D.nodeEdges(R).forEach(E=>{var M=E.v===R,f=M?E.w:E.v;if(f!==H){var w=M===Q,v=D.edge(E).weight;if(A+=w?v:-v,_(y,R,f)){var C=y.edge(R,f).cutvalue;A+=w?-C:C}}}),A}function h(y,D){arguments.length<2&&(D=y.nodes()[0]),g(y,{},1,D)}function g(y,D,R,Y,H){var Q=R,O=y.node(Y);return D[Y]=!0,y.neighbors(Y).forEach(A=>{Object.hasOwn(D,A)||(R=g(y,D,R,A,Y))}),O.low=Q,O.lim=R++,H?O.parent=H:delete O.parent,R}function b(y){return y.edges().find(D=>y.edge(D).cutvalue<0)}function S(y,D,R){var Y=R.v,H=R.w;D.hasEdge(Y,H)||(Y=R.w,H=R.v);var Q=y.node(Y),O=y.node(H),A=Q,E=!1;Q.lim>O.lim&&(A=O,E=!0);var M=D.edges().filter(f=>E===p(y,y.node(f.v),A)&&E!==p(y,y.node(f.w),A));return M.reduce((f,w)=>o(D,w)<o(D,f)?w:f)}function k(y,D,R,Y){var H=R.v,Q=R.w;y.removeEdge(H,Q),y.setEdge(Y.v,Y.w,{}),h(y),c(y,D),x(y,D)}function x(y,D){var R=y.nodes().find(H=>!D.node(H).parent),Y=i(y,R);Y=Y.slice(1),Y.forEach(H=>{var Q=y.node(H).parent,O=D.edge(H,Q),A=!1;O||(O=D.edge(Q,H),A=!0),D.node(H).rank=D.node(Q).rank+(A?O.minlen:-O.minlen)})}function _(y,D,R){return y.hasEdge(D,R)}function p(y,D,R){return R.low<=D.lim&&D.lim<=R.lim}}),ta=Ne((e,t)=>{var n=kn(),o=n.longestPath,r=Br(),i=ea();t.exports=s;function s(u){var d=u.graph().ranker;if(d instanceof Function)return d(u);switch(u.graph().ranker){case"network-simplex":c(u);break;case"tight-tree":l(u);break;case"longest-path":a(u);break;case"none":break;default:c(u)}}var a=o;function l(u){o(u),r(u)}function c(u){i(u)}}),na=Ne((e,t)=>{t.exports=n;function n(i){let s=r(i);i.graph().dummyChains.forEach(a=>{let l=i.node(a),c=l.edgeObj,u=o(i,s,c.v,c.w),d=u.path,h=u.lca,g=0,b=d[g],S=!0;for(;a!==c.w;){if(l=i.node(a),S){for(;(b=d[g])!==h&&i.node(b).maxRank<l.rank;)g++;b===h&&(S=!1)}if(!S){for(;g<d.length-1&&i.node(b=d[g+1]).minRank<=l.rank;)g++;b=d[g]}i.setParent(a,b),a=i.successors(a)[0]}})}function o(i,s,a,l){let c=[],u=[],d=Math.min(s[a].low,s[l].low),h=Math.max(s[a].lim,s[l].lim),g,b;g=a;do g=i.parent(g),c.push(g);while(g&&(s[g].low>d||h>s[g].lim));for(b=g,g=l;(g=i.parent(g))!==b;)u.push(g);return{path:c.concat(u.reverse()),lca:b}}function r(i){let s={},a=0;function l(c){let u=a;i.children(c).forEach(l),s[c]={low:u,lim:a++}}return i.children().forEach(l),s}}),oa=Ne((e,t)=>{var n=De();t.exports={run:o,cleanup:a};function o(l){let c=n.addDummyNode(l,"root",{},"_root"),u=i(l),d=Object.values(u),h=n.applyWithChunking(Math.max,d)-1,g=2*h+1;l.graph().nestingRoot=c,l.edges().forEach(S=>l.edge(S).minlen*=g);let b=s(l)+1;l.children().forEach(S=>r(l,c,g,b,h,u,S)),l.graph().nodeRankFactor=g}function r(l,c,u,d,h,g,b){let S=l.children(b);if(!S.length){b!==c&&l.setEdge(c,b,{weight:0,minlen:u});return}let k=n.addBorderNode(l,"_bt"),x=n.addBorderNode(l,"_bb"),_=l.node(b);l.setParent(k,b),_.borderTop=k,l.setParent(x,b),_.borderBottom=x,S.forEach(p=>{r(l,c,u,d,h,g,p);let y=l.node(p),D=y.borderTop?y.borderTop:p,R=y.borderBottom?y.borderBottom:p,Y=y.borderTop?d:2*d,H=D!==R?1:h-g[b]+1;l.setEdge(k,D,{weight:Y,minlen:H,nestingEdge:!0}),l.setEdge(R,x,{weight:Y,minlen:H,nestingEdge:!0})}),l.parent(b)||l.setEdge(c,k,{weight:0,minlen:h+g[b]})}function i(l){var c={};function u(d,h){var g=l.children(d);g&&g.length&&g.forEach(b=>u(b,h+1)),c[d]=h}return l.children().forEach(d=>u(d,1)),c}function s(l){return l.edges().reduce((c,u)=>c+l.edge(u).weight,0)}function a(l){var c=l.graph();l.removeNode(c.nestingRoot),delete c.nestingRoot,l.edges().forEach(u=>{var d=l.edge(u);d.nestingEdge&&l.removeEdge(u)})}}),ra=Ne((e,t)=>{var n=De();t.exports=o;function o(i){function s(a){let l=i.children(a),c=i.node(a);if(l.length&&l.forEach(s),Object.hasOwn(c,"minRank")){c.borderLeft=[],c.borderRight=[];for(let u=c.minRank,d=c.maxRank+1;u<d;++u)r(i,"borderLeft","_bl",a,c,u),r(i,"borderRight","_br",a,c,u)}}i.children().forEach(s)}function r(i,s,a,l,c,u){let d={width:0,height:0,rank:u,borderType:s},h=c[s][u-1],g=n.addDummyNode(i,"border",d,a);c[s][u]=g,i.setParent(g,l),h&&i.setEdge(h,g,{weight:1})}}),ia=Ne((e,t)=>{t.exports={adjust:n,undo:o};function n(u){let d=u.graph().rankdir.toLowerCase();(d==="lr"||d==="rl")&&r(u)}function o(u){let d=u.graph().rankdir.toLowerCase();(d==="bt"||d==="rl")&&s(u),(d==="lr"||d==="rl")&&(l(u),r(u))}function r(u){u.nodes().forEach(d=>i(u.node(d))),u.edges().forEach(d=>i(u.edge(d)))}function i(u){let d=u.width;u.width=u.height,u.height=d}function s(u){u.nodes().forEach(d=>a(u.node(d))),u.edges().forEach(d=>{let h=u.edge(d);h.points.forEach(a),Object.hasOwn(h,"y")&&a(h)})}function a(u){u.y=-u.y}function l(u){u.nodes().forEach(d=>c(u.node(d))),u.edges().forEach(d=>{let h=u.edge(d);h.points.forEach(c),Object.hasOwn(h,"x")&&c(h)})}function c(u){let d=u.x;u.x=u.y,u.y=d}}),sa=Ne((e,t)=>{var n=De();t.exports=o;function o(r){let i={},s=r.nodes().filter(d=>!r.children(d).length),a=s.map(d=>r.node(d).rank),l=n.applyWithChunking(Math.max,a),c=n.range(l+1).map(()=>[]);function u(d){if(i[d])return;i[d]=!0;let h=r.node(d);c[h.rank].push(d),r.successors(d).forEach(u)}return s.sort((d,h)=>r.node(d).rank-r.node(h).rank).forEach(u),c}}),aa=Ne((e,t)=>{var n=De().zipObject;t.exports=o;function o(i,s){let a=0;for(let l=1;l<s.length;++l)a+=r(i,s[l-1],s[l]);return a}function r(i,s,a){let l=n(a,a.map((b,S)=>S)),c=s.flatMap(b=>i.outEdges(b).map(S=>({pos:l[S.w],weight:i.edge(S).weight})).sort((S,k)=>S.pos-k.pos)),u=1;for(;u<a.length;)u<<=1;let d=2*u-1;u-=1;let h=new Array(d).fill(0),g=0;return c.forEach(b=>{let S=b.pos+u;h[S]+=b.weight;let k=0;for(;S>0;)S%2&&(k+=h[S+1]),S=S-1>>1,h[S]+=b.weight;g+=b.weight*k}),g}}),la=Ne((e,t)=>{t.exports=n;function n(o,r=[]){return r.map(i=>{let s=o.inEdges(i);if(s.length){let a=s.reduce((l,c)=>{let u=o.edge(c),d=o.node(c.v);return{sum:l.sum+u.weight*d.order,weight:l.weight+u.weight}},{sum:0,weight:0});return{v:i,barycenter:a.sum/a.weight,weight:a.weight}}else return{v:i}})}}),ua=Ne((e,t)=>{var n=De();t.exports=o;function o(s,a){let l={};s.forEach((u,d)=>{let h=l[u.v]={indegree:0,in:[],out:[],vs:[u.v],i:d};u.barycenter!==void 0&&(h.barycenter=u.barycenter,h.weight=u.weight)}),a.edges().forEach(u=>{let d=l[u.v],h=l[u.w];d!==void 0&&h!==void 0&&(h.indegree++,d.out.push(l[u.w]))});let c=Object.values(l).filter(u=>!u.indegree);return r(c)}function r(s){let a=[];function l(u){return d=>{d.merged||(d.barycenter===void 0||u.barycenter===void 0||d.barycenter>=u.barycenter)&&i(u,d)}}function c(u){return d=>{d.in.push(u),--d.indegree===0&&s.push(d)}}for(;s.length;){let u=s.pop();a.push(u),u.in.reverse().forEach(l(u)),u.out.forEach(c(u))}return a.filter(u=>!u.merged).map(u=>n.pick(u,["vs","i","barycenter","weight"]))}function i(s,a){let l=0,c=0;s.weight&&(l+=s.barycenter*s.weight,c+=s.weight),a.weight&&(l+=a.barycenter*a.weight,c+=a.weight),s.vs=a.vs.concat(s.vs),s.barycenter=l/c,s.weight=c,s.i=Math.min(a.i,s.i),a.merged=!0}}),ca=Ne((e,t)=>{var n=De();t.exports=o;function o(s,a){let l=n.partition(s,k=>Object.hasOwn(k,"barycenter")),c=l.lhs,u=l.rhs.sort((k,x)=>x.i-k.i),d=[],h=0,g=0,b=0;c.sort(i(!!a)),b=r(d,u,b),c.forEach(k=>{b+=k.vs.length,d.push(k.vs),h+=k.barycenter*k.weight,g+=k.weight,b=r(d,u,b)});let S={vs:d.flat(!0)};return g&&(S.barycenter=h/g,S.weight=g),S}function r(s,a,l){let c;for(;a.length&&(c=a[a.length-1]).i<=l;)a.pop(),s.push(c.vs),l++;return l}function i(s){return(a,l)=>a.barycenter<l.barycenter?-1:a.barycenter>l.barycenter?1:s?l.i-a.i:a.i-l.i}}),da=Ne((e,t)=>{var n=la(),o=ua(),r=ca();t.exports=i;function i(l,c,u,d){let h=l.children(c),g=l.node(c),b=g?g.borderLeft:void 0,S=g?g.borderRight:void 0,k={};b&&(h=h.filter(y=>y!==b&&y!==S));let x=n(l,h);x.forEach(y=>{if(l.children(y.v).length){let D=i(l,y.v,u,d);k[y.v]=D,Object.hasOwn(D,"barycenter")&&a(y,D)}});let _=o(x,u);s(_,k);let p=r(_,d);if(b&&(p.vs=[b,p.vs,S].flat(!0),l.predecessors(b).length)){let y=l.node(l.predecessors(b)[0]),D=l.node(l.predecessors(S)[0]);Object.hasOwn(p,"barycenter")||(p.barycenter=0,p.weight=0),p.barycenter=(p.barycenter*p.weight+y.order+D.order)/(p.weight+2),p.weight+=2}return p}function s(l,c){l.forEach(u=>{u.vs=u.vs.flatMap(d=>c[d]?c[d].vs:d)})}function a(l,c){l.barycenter!==void 0?(l.barycenter=(l.barycenter*l.weight+c.barycenter*c.weight)/(l.weight+c.weight),l.weight+=c.weight):(l.barycenter=c.barycenter,l.weight=c.weight)}}),fa=Ne((e,t)=>{var n=Ye().Graph,o=De();t.exports=r;function r(s,a,l,c){c||(c=s.nodes());let u=i(s),d=new n({compound:!0}).setGraph({root:u}).setDefaultNodeLabel(h=>s.node(h));return c.forEach(h=>{let g=s.node(h),b=s.parent(h);(g.rank===a||g.minRank<=a&&a<=g.maxRank)&&(d.setNode(h),d.setParent(h,b||u),s[l](h).forEach(S=>{let k=S.v===h?S.w:S.v,x=d.edge(k,h),_=x!==void 0?x.weight:0;d.setEdge(k,h,{weight:s.edge(S).weight+_})}),Object.hasOwn(g,"minRank")&&d.setNode(h,{borderLeft:g.borderLeft[a],borderRight:g.borderRight[a]}))}),d}function i(s){for(var a;s.hasNode(a=o.uniqueId("_root")););return a}}),ha=Ne((e,t)=>{t.exports=n;function n(o,r,i){let s={},a;i.forEach(l=>{let c=o.parent(l),u,d;for(;c;){if(u=o.parent(c),u?(d=s[u],s[u]=c):(d=a,a=c),d&&d!==c){r.setEdge(d,c);return}c=u}})}}),ga=Ne((e,t)=>{var n=sa(),o=aa(),r=da(),i=fa(),s=ha(),a=Ye().Graph,l=De();t.exports=c;function c(g,b={}){if(typeof b.customOrder=="function"){b.customOrder(g,c);return}let S=l.maxRank(g),k=u(g,l.range(1,S+1),"inEdges"),x=u(g,l.range(S-1,-1,-1),"outEdges"),_=n(g);if(h(g,_),b.disableOptimalOrderHeuristic)return;let p=Number.POSITIVE_INFINITY,y,D=b.constraints||[];for(let R=0,Y=0;Y<4;++R,++Y){d(R%2?k:x,R%4>=2,D),_=l.buildLayerMatrix(g);let H=o(g,_);H<p?(Y=0,y=Object.assign({},_),p=H):H===p&&(y=structuredClone(_))}h(g,y)}function u(g,b,S){let k=new Map,x=(_,p)=>{k.has(_)||k.set(_,[]),k.get(_).push(p)};for(let _ of g.nodes()){let p=g.node(_);if(typeof p.rank=="number"&&x(p.rank,_),typeof p.minRank=="number"&&typeof p.maxRank=="number")for(let y=p.minRank;y<=p.maxRank;y++)y!==p.rank&&x(y,_)}return b.map(function(_){return i(g,_,S,k.get(_)||[])})}function d(g,b,S){let k=new a;g.forEach(function(x){S.forEach(y=>k.setEdge(y.left,y.right));let _=x.graph().root,p=r(x,_,k,b);p.vs.forEach((y,D)=>x.node(y).order=D),s(x,k,p.vs)})}function h(g,b){Object.values(b).forEach(S=>S.forEach((k,x)=>g.node(k).order=x))}}),pa=Ne((e,t)=>{var n=Ye().Graph,o=De();t.exports={positionX:S,findType1Conflicts:r,findType2Conflicts:i,addConflict:a,hasConflict:l,verticalAlignment:c,horizontalCompaction:u,alignCoordinates:g,findSmallestWidthAlignment:h,balance:b};function r(_,p){let y={};function D(R,Y){let H=0,Q=0,O=R.length,A=Y[Y.length-1];return Y.forEach((E,M)=>{let f=s(_,E),w=f?_.node(f).order:O;(f||E===A)&&(Y.slice(Q,M+1).forEach(v=>{_.predecessors(v).forEach(C=>{let z=_.node(C),F=z.order;(F<H||w<F)&&!(z.dummy&&_.node(v).dummy)&&a(y,C,v)})}),Q=M+1,H=w)}),Y}return p.length&&p.reduce(D),y}function i(_,p){let y={};function D(Y,H,Q,O,A){let E;o.range(H,Q).forEach(M=>{E=Y[M],_.node(E).dummy&&_.predecessors(E).forEach(f=>{let w=_.node(f);w.dummy&&(w.order<O||w.order>A)&&a(y,f,E)})})}function R(Y,H){let Q=-1,O,A=0;return H.forEach((E,M)=>{if(_.node(E).dummy==="border"){let f=_.predecessors(E);f.length&&(O=_.node(f[0]).order,D(H,A,M,Q,O),A=M,Q=O)}D(H,A,H.length,O,Y.length)}),H}return p.length&&p.reduce(R),y}function s(_,p){if(_.node(p).dummy)return _.predecessors(p).find(y=>_.node(y).dummy)}function a(_,p,y){if(p>y){let R=p;p=y,y=R}let D=_[p];D||(_[p]=D={}),D[y]=!0}function l(_,p,y){if(p>y){let D=p;p=y,y=D}return!!_[p]&&Object.hasOwn(_[p],y)}function c(_,p,y,D){let R={},Y={},H={};return p.forEach(Q=>{Q.forEach((O,A)=>{R[O]=O,Y[O]=O,H[O]=A})}),p.forEach(Q=>{let O=-1;Q.forEach(A=>{let E=D(A);if(E.length){E=E.sort((f,w)=>H[f]-H[w]);let M=(E.length-1)/2;for(let f=Math.floor(M),w=Math.ceil(M);f<=w;++f){let v=E[f];Y[A]===A&&O<H[v]&&!l(y,A,v)&&(Y[v]=A,Y[A]=R[A]=R[v],O=H[v])}}})}),{root:R,align:Y}}function u(_,p,y,D,R){let Y={},H=d(_,p,y,R),Q=R?"borderLeft":"borderRight";function O(M,f){let w=H.nodes().slice(),v={},C=w.pop();for(;C;){if(v[C])M(C);else{v[C]=!0,w.push(C);for(let z of f(C))w.push(z)}C=w.pop()}}function A(M){Y[M]=H.inEdges(M).reduce((f,w)=>Math.max(f,Y[w.v]+H.edge(w)),0)}function E(M){let f=H.outEdges(M).reduce((v,C)=>Math.min(v,Y[C.w]-H.edge(C)),Number.POSITIVE_INFINITY),w=_.node(M);f!==Number.POSITIVE_INFINITY&&w.borderType!==Q&&(Y[M]=Math.max(Y[M],f))}return O(A,H.predecessors.bind(H)),O(E,H.successors.bind(H)),Object.keys(D).forEach(M=>Y[M]=Y[y[M]]),Y}function d(_,p,y,D){let R=new n,Y=_.graph(),H=k(Y.nodesep,Y.edgesep,D);return p.forEach(Q=>{let O;Q.forEach(A=>{let E=y[A];if(R.setNode(E),O){var M=y[O],f=R.edge(M,E);R.setEdge(M,E,Math.max(H(_,A,O),f||0))}O=A})}),R}function h(_,p){return Object.values(p).reduce((y,D)=>{let R=Number.NEGATIVE_INFINITY,Y=Number.POSITIVE_INFINITY;Object.entries(D).forEach(([Q,O])=>{let A=x(_,Q)/2;R=Math.max(O+A,R),Y=Math.min(O-A,Y)});let H=R-Y;return H<y[0]&&(y=[H,D]),y},[Number.POSITIVE_INFINITY,null])[1]}function g(_,p){let y=Object.values(p),D=o.applyWithChunking(Math.min,y),R=o.applyWithChunking(Math.max,y);["u","d"].forEach(Y=>{["l","r"].forEach(H=>{let Q=Y+H,O=_[Q];if(O===p)return;let A=Object.values(O),E=D-o.applyWithChunking(Math.min,A);H!=="l"&&(E=R-o.applyWithChunking(Math.max,A)),E&&(_[Q]=o.mapValues(O,M=>M+E))})})}function b(_,p){return o.mapValues(_.ul,(y,D)=>{if(p)return _[p.toLowerCase()][D];{let R=Object.values(_).map(Y=>Y[D]).sort((Y,H)=>Y-H);return(R[1]+R[2])/2}})}function S(_){let p=o.buildLayerMatrix(_),y=Object.assign(r(_,p),i(_,p)),D={},R;["u","d"].forEach(H=>{R=H==="u"?p:Object.values(p).reverse(),["l","r"].forEach(Q=>{Q==="r"&&(R=R.map(M=>Object.values(M).reverse()));let O=(H==="u"?_.predecessors:_.successors).bind(_),A=c(_,R,y,O),E=u(_,R,A.root,A.align,Q==="r");Q==="r"&&(E=o.mapValues(E,M=>-M)),D[H+Q]=E})});let Y=h(_,D);return g(D,Y),b(D,_.graph().align)}function k(_,p,y){return(D,R,Y)=>{let H=D.node(R),Q=D.node(Y),O=0,A;if(O+=H.width/2,Object.hasOwn(H,"labelpos"))switch(H.labelpos.toLowerCase()){case"l":A=-H.width/2;break;case"r":A=H.width/2;break}if(A&&(O+=y?A:-A),A=0,O+=(H.dummy?p:_)/2,O+=(Q.dummy?p:_)/2,O+=Q.width/2,Object.hasOwn(Q,"labelpos"))switch(Q.labelpos.toLowerCase()){case"l":A=Q.width/2;break;case"r":A=-Q.width/2;break}return A&&(O+=y?A:-A),A=0,O}}function x(_,p){return _.node(p).width}}),va=Ne((e,t)=>{var n=De(),o=pa().positionX;t.exports=r;function r(s){s=n.asNonCompoundGraph(s),i(s),Object.entries(o(s)).forEach(([a,l])=>s.node(a).x=l)}function i(s){let a=n.buildLayerMatrix(s),l=s.graph().ranksep,c=s.graph().rankalign,u=0;a.forEach(d=>{let h=d.reduce((g,b)=>{let S=s.node(b).height;return g>S?g:S},0);d.forEach(g=>{let b=s.node(g);c==="top"?b.y=u+b.height/2:c==="bottom"?b.y=u+h-b.height/2:b.y=u+h/2}),u+=h+l})}}),ma=Ne((e,t)=>{var n=Qs(),o=Js(),r=ta(),i=De().normalizeRanks,s=na(),a=De().removeEmptyRanks,l=oa(),c=ra(),u=ia(),d=ga(),h=va(),g=De(),b=Ye().Graph;t.exports=S;function S(m,I={}){let L=I.debugTiming?g.time:g.notime;return L("layout",()=>{let X=L(" buildLayoutGraph",()=>O(m));return L(" runLayout",()=>k(X,L,I)),L(" updateInputGraph",()=>x(m,X)),X})}function k(m,I,L){I(" makeSpaceForEdgeLabels",()=>A(m)),I(" removeSelfEdges",()=>B(m)),I(" acyclic",()=>n.run(m)),I(" nestingGraph.run",()=>l.run(m)),I(" rank",()=>r(g.asNonCompoundGraph(m))),I(" injectEdgeLabelProxies",()=>E(m)),I(" removeEmptyRanks",()=>a(m)),I(" nestingGraph.cleanup",()=>l.cleanup(m)),I(" normalizeRanks",()=>i(m)),I(" assignRankMinMax",()=>M(m)),I(" removeEdgeLabelProxies",()=>f(m)),I(" normalize.run",()=>o.run(m)),I(" parentDummyChains",()=>s(m)),I(" addBorderSegments",()=>c(m)),I(" order",()=>d(m,L)),I(" insertSelfEdges",()=>G(m)),I(" adjustCoordinateSystem",()=>u.adjust(m)),I(" position",()=>h(m)),I(" positionSelfEdges",()=>U(m)),I(" removeBorderNodes",()=>F(m)),I(" normalize.undo",()=>o.undo(m)),I(" fixupEdgeLabelCoords",()=>C(m)),I(" undoCoordinateSystem",()=>u.undo(m)),I(" translateGraph",()=>w(m)),I(" assignNodeIntersects",()=>v(m)),I(" reversePoints",()=>z(m)),I(" acyclic.undo",()=>n.undo(m))}function x(m,I){m.nodes().forEach(L=>{let X=m.node(L),J=I.node(L);X&&(X.x=J.x,X.y=J.y,X.order=J.order,X.rank=J.rank,I.children(L).length&&(X.width=J.width,X.height=J.height))}),m.edges().forEach(L=>{let X=m.edge(L),J=I.edge(L);X.points=J.points,Object.hasOwn(J,"x")&&(X.x=J.x,X.y=J.y)}),m.graph().width=I.graph().width,m.graph().height=I.graph().height}var _=["nodesep","edgesep","ranksep","marginx","marginy"],p={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb",rankalign:"center"},y=["acyclicer","ranker","rankdir","align","rankalign"],D=["width","height","rank"],R={width:0,height:0},Y=["minlen","weight","width","height","labeloffset"],H={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Q=["labelpos"];function O(m){let I=new b({multigraph:!0,compound:!0}),L=T(m.graph());return I.setGraph(Object.assign({},p,K(L,_),g.pick(L,y))),m.nodes().forEach(X=>{let J=T(m.node(X)),te=K(J,D);Object.keys(R).forEach(ne=>{te[ne]===void 0&&(te[ne]=R[ne])}),I.setNode(X,te),I.setParent(X,m.parent(X))}),m.edges().forEach(X=>{let J=T(m.edge(X));I.setEdge(X,Object.assign({},H,K(J,Y),g.pick(J,Q)))}),I}function A(m){let I=m.graph();I.ranksep/=2,m.edges().forEach(L=>{let X=m.edge(L);X.minlen*=2,X.labelpos.toLowerCase()!=="c"&&(I.rankdir==="TB"||I.rankdir==="BT"?X.width+=X.labeloffset:X.height+=X.labeloffset)})}function E(m){m.edges().forEach(I=>{let L=m.edge(I);if(L.width&&L.height){let X=m.node(I.v),J={rank:(m.node(I.w).rank-X.rank)/2+X.rank,e:I};g.addDummyNode(m,"edge-proxy",J,"_ep")}})}function M(m){let I=0;m.nodes().forEach(L=>{let X=m.node(L);X.borderTop&&(X.minRank=m.node(X.borderTop).rank,X.maxRank=m.node(X.borderBottom).rank,I=Math.max(I,X.maxRank))}),m.graph().maxRank=I}function f(m){m.nodes().forEach(I=>{let L=m.node(I);L.dummy==="edge-proxy"&&(m.edge(L.e).labelRank=L.rank,m.removeNode(I))})}function w(m){let I=Number.POSITIVE_INFINITY,L=0,X=Number.POSITIVE_INFINITY,J=0,te=m.graph(),ne=te.marginx||0,ae=te.marginy||0;function ge(P){let N=P.x,V=P.y,W=P.width,j=P.height;I=Math.min(I,N-W/2),L=Math.max(L,N+W/2),X=Math.min(X,V-j/2),J=Math.max(J,V+j/2)}m.nodes().forEach(P=>ge(m.node(P))),m.edges().forEach(P=>{let N=m.edge(P);Object.hasOwn(N,"x")&&ge(N)}),I-=ne,X-=ae,m.nodes().forEach(P=>{let N=m.node(P);N.x-=I,N.y-=X}),m.edges().forEach(P=>{let N=m.edge(P);N.points.forEach(V=>{V.x-=I,V.y-=X}),Object.hasOwn(N,"x")&&(N.x-=I),Object.hasOwn(N,"y")&&(N.y-=X)}),te.width=L-I+ne,te.height=J-X+ae}function v(m){m.edges().forEach(I=>{let L=m.edge(I),X=m.node(I.v),J=m.node(I.w),te,ne;L.points?(te=L.points[0],ne=L.points[L.points.length-1]):(L.points=[],te=J,ne=X),L.points.unshift(g.intersectRect(X,te)),L.points.push(g.intersectRect(J,ne))})}function C(m){m.edges().forEach(I=>{let L=m.edge(I);if(Object.hasOwn(L,"x"))switch((L.labelpos==="l"||L.labelpos==="r")&&(L.width-=L.labeloffset),L.labelpos){case"l":L.x-=L.width/2+L.labeloffset;break;case"r":L.x+=L.width/2+L.labeloffset;break}})}function z(m){m.edges().forEach(I=>{let L=m.edge(I);L.reversed&&L.points.reverse()})}function F(m){m.nodes().forEach(I=>{if(m.children(I).length){let L=m.node(I),X=m.node(L.borderTop),J=m.node(L.borderBottom),te=m.node(L.borderLeft[L.borderLeft.length-1]),ne=m.node(L.borderRight[L.borderRight.length-1]);L.width=Math.abs(ne.x-te.x),L.height=Math.abs(J.y-X.y),L.x=te.x+L.width/2,L.y=X.y+L.height/2}}),m.nodes().forEach(I=>{m.node(I).dummy==="border"&&m.removeNode(I)})}function B(m){m.edges().forEach(I=>{if(I.v===I.w){var L=m.node(I.v);L.selfEdges||(L.selfEdges=[]),L.selfEdges.push({e:I,label:m.edge(I)}),m.removeEdge(I)}})}function G(m){var I=g.buildLayerMatrix(m);I.forEach(L=>{var X=0;L.forEach((J,te)=>{var ne=m.node(J);ne.order=te+X,(ne.selfEdges||[]).forEach(ae=>{g.addDummyNode(m,"selfedge",{width:ae.label.width,height:ae.label.height,rank:ne.rank,order:te+ ++X,e:ae.e,label:ae.label},"_se")}),delete ne.selfEdges})})}function U(m){m.nodes().forEach(I=>{var L=m.node(I);if(L.dummy==="selfedge"){var X=m.node(L.e.v),J=X.x+X.width/2,te=X.y,ne=L.x-J,ae=X.height/2;m.setEdge(L.e,L.label),m.removeNode(I),L.label.points=[{x:J+2*ne/3,y:te-ae},{x:J+5*ne/6,y:te-ae},{x:J+ne,y:te},{x:J+5*ne/6,y:te+ae},{x:J+2*ne/3,y:te+ae}],L.label.x=L.x,L.label.y=L.y}})}function K(m,I){return g.mapValues(g.pick(m,I),Number)}function T(m){var I={};return m&&Object.entries(m).forEach(([L,X])=>{typeof L=="string"&&(L=L.toLowerCase()),I[L]=X}),I}}),ya=Ne((e,t)=>{var n=De(),o=Ye().Graph;t.exports={debugOrdering:r};function r(i){let s=n.buildLayerMatrix(i),a=new o({compound:!0,multigraph:!0}).setGraph({});return i.nodes().forEach(l=>{a.setNode(l,{label:l}),a.setParent(l,"layer"+i.node(l).rank)}),i.edges().forEach(l=>a.setEdge(l.v,l.w,{},l.name)),s.forEach((l,c)=>{let u="layer"+c;a.setNode(u,{rank:"same"}),l.reduce((d,h)=>(a.setEdge(d,h,{style:"invis"}),h))}),a}}),wa=Ne((e,t)=>{t.exports="2.0.4"}),_a=Ne((e,t)=>{t.exports={graphlib:Ye(),layout:ma(),debug:ya(),util:{time:De().time,notime:De().notime},version:wa()}});const Vo=_a();function Wt(e){return zr()?(pn(e),!0):!1}function Je(e){return typeof e=="function"?e():$(e)}const xa=typeof window<"u"&&typeof document<"u",ba=e=>typeof e<"u",Ea=Object.prototype.toString,ka=e=>Ea.call(e)==="[object Object]",Sa=()=>{};function Na(e,t){function n(...o){return new Promise((r,i)=>{Promise.resolve(e(()=>t.apply(this,o),{fn:t,thisArg:this,args:o})).then(r).catch(i)})}return n}const Vr=e=>e();function Ca(e=Vr){const t=ve(!0);function n(){t.value=!1}function o(){t.value=!0}const r=(...i)=>{t.value&&e(...i)};return{isActive:Vt(t),pause:n,resume:o,eventFilter:r}}function Ro(e,t=!1,n="Timeout"){return new Promise((o,r)=>{setTimeout(t?()=>r(n):o,e)})}function $a(e,t,n={}){const{eventFilter:o=Vr,...r}=n;return ye(e,Na(o,t),r)}function xt(e,t,n={}){const{eventFilter:o,...r}=n,{eventFilter:i,pause:s,resume:a,isActive:l}=Ca(o);return{stop:$a(e,t,{...r,eventFilter:i}),pause:s,resume:a,isActive:l}}function Ma(e,t={}){if(!_o(e))return ss(e);const n=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const o in e.value)n[o]=as(()=>({get(){return e.value[o]},set(r){var i;if((i=Je(t.replaceRef))!=null?i:!0)if(Array.isArray(e.value)){const a=[...e.value];a[o]=r,e.value=a}else{const a={...e.value,[o]:r};Object.setPrototypeOf(a,Object.getPrototypeOf(e.value)),e.value=a}else e.value[o]=r}}));return n}function io(e,t=!1){function n(d,{flush:h="sync",deep:g=!1,timeout:b,throwOnTimeout:S}={}){let k=null;const _=[new Promise(p=>{k=ye(e,y=>{d(y)!==t&&(k?.(),p(y))},{flush:h,deep:g,immediate:!0})})];return b!=null&&_.push(Ro(b,S).then(()=>Je(e)).finally(()=>k?.())),Promise.race(_)}function o(d,h){if(!_o(d))return n(y=>y===d,h);const{flush:g="sync",deep:b=!1,timeout:S,throwOnTimeout:k}=h??{};let x=null;const p=[new Promise(y=>{x=ye([e,d],([D,R])=>{t!==(D===R)&&(x?.(),y(D))},{flush:g,deep:b,immediate:!0})})];return S!=null&&p.push(Ro(S,k).then(()=>Je(e)).finally(()=>(x?.(),Je(e)))),Promise.race(p)}function r(d){return n(h=>!!h,d)}function i(d){return o(null,d)}function s(d){return o(void 0,d)}function a(d){return n(Number.isNaN,d)}function l(d,h){return n(g=>{const b=Array.from(g);return b.includes(d)||b.includes(Je(d))},h)}function c(d){return u(1,d)}function u(d=1,h){let g=-1;return n(()=>(g+=1,g>=d),h)}return Array.isArray(Je(e))?{toMatch:n,toContains:l,changed:c,changedTimes:u,get not(){return io(e,!t)}}:{toMatch:n,toBe:o,toBeTruthy:r,toBeNull:i,toBeNaN:a,toBeUndefined:s,changed:c,changedTimes:u,get not(){return io(e,!t)}}}function so(e){return io(e)}function Ia(e){var t;const n=Je(e);return(t=n?.$el)!=null?t:n}const Rr=xa?window:void 0;function Hr(...e){let t,n,o,r;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,o,r]=e,t=Rr):[t,n,o,r]=e,!t)return Sa;Array.isArray(n)||(n=[n]),Array.isArray(o)||(o=[o]);const i=[],s=()=>{i.forEach(u=>u()),i.length=0},a=(u,d,h,g)=>(u.addEventListener(d,h,g),()=>u.removeEventListener(d,h,g)),l=ye(()=>[Ia(t),Je(r)],([u,d])=>{if(s(),!u)return;const h=ka(d)?{...d}:d;i.push(...n.flatMap(g=>o.map(b=>a(u,g,b,h))))},{immediate:!0,flush:"post"}),c=()=>{l(),s()};return Wt(c),c}function Ta(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function Ho(...e){let t,n,o={};e.length===3?(t=e[0],n=e[1],o=e[2]):e.length===2?typeof e[1]=="object"?(t=!0,n=e[0],o=e[1]):(t=e[0],n=e[1]):(t=!0,n=e[0]);const{target:r=Rr,eventName:i="keydown",passive:s=!1,dedupe:a=!1}=o,l=Ta(t);return Hr(r,i,u=>{u.repeat&&Je(a)||l(u)&&n(u)},s)}function Oa(e){return JSON.parse(JSON.stringify(e))}function Wn(e,t,n,o={}){var r,i,s;const{clone:a=!1,passive:l=!1,eventName:c,deep:u=!1,defaultValue:d,shouldEmit:h}=o,g=At(),b=n||g?.emit||((r=g?.$emit)==null?void 0:r.bind(g))||((s=(i=g?.proxy)==null?void 0:i.$emit)==null?void 0:s.bind(g?.proxy));let S=c;t||(t="modelValue"),S=S||`update:${t.toString()}`;const k=p=>a?typeof a=="function"?a(p):Oa(p):p,x=()=>ba(e[t])?k(e[t]):d,_=p=>{h?h(p)&&b(S,p):b(S,p)};if(l){const p=x(),y=ve(p);let D=!1;return ye(()=>e[t],R=>{D||(D=!0,y.value=k(R),nt(()=>D=!1))}),ye(y,R=>{!D&&(R!==e[t]||u)&&_(R)},{deep:u}),y}else return ie({get(){return x()},set(p){_(p)}})}var Pa={value:()=>{}};function An(){for(var e=0,t=arguments.length,n={},o;e<t;++e){if(!(o=arguments[e]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new mn(n)}function mn(e){this._=e}function Da(e,t){return e.trim().split(/^|\s+/).map(function(n){var o="",r=n.indexOf(".");if(r>=0&&(o=n.slice(r+1),n=n.slice(0,r)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}mn.prototype=An.prototype={constructor:mn,on:function(e,t){var n=this._,o=Da(e+"",n),r,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((r=(e=o[i]).type)&&(r=za(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(r=(e=o[i]).type)n[r]=Fo(n[r],e.name,t);else if(t==null)for(r in n)n[r]=Fo(n[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new mn(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,i;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],o=0,r=i.length;o<r;++o)i[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)}};function za(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function Fo(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=Pa,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var ao="http://www.w3.org/1999/xhtml";const Go={svg:"http://www.w3.org/2000/svg",xhtml:ao,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ln(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Go.hasOwnProperty(t)?{space:Go[t],local:e}:e}function Aa(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===ao&&t.documentElement.namespaceURI===ao?t.createElement(e):t.createElementNS(n,e)}}function La(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Fr(e){var t=Ln(e);return(t.local?La:Aa)(t)}function Ba(){}function bo(e){return e==null?Ba:function(){return this.querySelector(e)}}function Va(e){typeof e!="function"&&(e=bo(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=new Array(s),l,c,u=0;u<s;++u)(l=i[u])&&(c=e.call(l,l.__data__,u,i))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new Be(o,this._parents)}function Ra(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Ha(){return[]}function Gr(e){return e==null?Ha:function(){return this.querySelectorAll(e)}}function Fa(e){return function(){return Ra(e.apply(this,arguments))}}function Ga(e){typeof e=="function"?e=Fa(e):e=Gr(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s=t[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&(o.push(e.call(l,l.__data__,c,s)),r.push(l));return new Be(o,r)}function Yr(e){return function(){return this.matches(e)}}function jr(e){return function(t){return t.matches(e)}}var Ya=Array.prototype.find;function ja(e){return function(){return Ya.call(this.children,e)}}function Xa(){return this.firstElementChild}function Wa(e){return this.select(e==null?Xa:ja(typeof e=="function"?e:jr(e)))}var Ua=Array.prototype.filter;function Za(){return Array.from(this.children)}function qa(e){return function(){return Ua.call(this.children,e)}}function Ka(e){return this.selectAll(e==null?Za:qa(typeof e=="function"?e:jr(e)))}function Qa(e){typeof e!="function"&&(e=Yr(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new Be(o,this._parents)}function Xr(e){return new Array(e.length)}function Ja(){return new Be(this._enter||this._groups.map(Xr),this._parents)}function Sn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Sn.prototype={constructor:Sn,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function el(e){return function(){return e}}function tl(e,t,n,o,r,i){for(var s=0,a,l=t.length,c=i.length;s<c;++s)(a=t[s])?(a.__data__=i[s],o[s]=a):n[s]=new Sn(e,i[s]);for(;s<l;++s)(a=t[s])&&(r[s]=a)}function nl(e,t,n,o,r,i,s){var a,l,c=new Map,u=t.length,d=i.length,h=new Array(u),g;for(a=0;a<u;++a)(l=t[a])&&(h[a]=g=s.call(l,l.__data__,a,t)+"",c.has(g)?r[a]=l:c.set(g,l));for(a=0;a<d;++a)g=s.call(e,i[a],a,i)+"",(l=c.get(g))?(o[a]=l,l.__data__=i[a],c.delete(g)):n[a]=new Sn(e,i[a]);for(a=0;a<u;++a)(l=t[a])&&c.get(h[a])===l&&(r[a]=l)}function ol(e){return e.__data__}function rl(e,t){if(!arguments.length)return Array.from(this,ol);var n=t?nl:tl,o=this._parents,r=this._groups;typeof e!="function"&&(e=el(e));for(var i=r.length,s=new Array(i),a=new Array(i),l=new Array(i),c=0;c<i;++c){var u=o[c],d=r[c],h=d.length,g=il(e.call(u,u&&u.__data__,c,o)),b=g.length,S=a[c]=new Array(b),k=s[c]=new Array(b),x=l[c]=new Array(h);n(u,d,S,k,x,g,t);for(var _=0,p=0,y,D;_<b;++_)if(y=S[_]){for(_>=p&&(p=_+1);!(D=k[p])&&++p<b;);y._next=D||null}}return s=new Be(s,o),s._enter=a,s._exit=l,s}function il(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function sl(){return new Be(this._exit||this._groups.map(Xr),this._parents)}function al(e,t,n){var o=this.enter(),r=this,i=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?i.remove():n(i),o&&r?o.merge(r).order():r}function ll(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),l=0;l<s;++l)for(var c=n[l],u=o[l],d=c.length,h=a[l]=new Array(d),g,b=0;b<d;++b)(g=c[b]||u[b])&&(h[b]=g);for(;l<r;++l)a[l]=n[l];return new Be(a,this._parents)}function ul(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,i=o[r],s;--r>=0;)(s=o[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function cl(e){e||(e=dl);function t(d,h){return d&&h?e(d.__data__,h.__data__):!d-!h}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],a=s.length,l=r[i]=new Array(a),c,u=0;u<a;++u)(c=s[u])&&(l[u]=c);l.sort(t)}return new Be(r,this._parents).order()}function dl(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function fl(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function hl(){return Array.from(this)}function gl(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null}function pl(){let e=0;for(const t of this)++e;return e}function vl(){return!this.node()}function ml(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],i=0,s=r.length,a;i<s;++i)(a=r[i])&&e.call(a,a.__data__,i,r);return this}function yl(e){return function(){this.removeAttribute(e)}}function wl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function _l(e,t){return function(){this.setAttribute(e,t)}}function xl(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function bl(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function El(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function kl(e,t){var n=Ln(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?wl:yl:typeof t=="function"?n.local?El:bl:n.local?xl:_l)(n,t))}function Wr(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Sl(e){return function(){this.style.removeProperty(e)}}function Nl(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Cl(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function $l(e,t,n){return arguments.length>1?this.each((t==null?Sl:typeof t=="function"?Cl:Nl)(e,t,n??"")):It(this.node(),e)}function It(e,t){return e.style.getPropertyValue(t)||Wr(e).getComputedStyle(e,null).getPropertyValue(t)}function Ml(e){return function(){delete this[e]}}function Il(e,t){return function(){this[e]=t}}function Tl(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Ol(e,t){return arguments.length>1?this.each((t==null?Ml:typeof t=="function"?Tl:Il)(e,t)):this.node()[e]}function Ur(e){return e.trim().split(/^|\s+/)}function Eo(e){return e.classList||new Zr(e)}function Zr(e){this._node=e,this._names=Ur(e.getAttribute("class")||"")}Zr.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function qr(e,t){for(var n=Eo(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function Kr(e,t){for(var n=Eo(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function Pl(e){return function(){qr(this,e)}}function Dl(e){return function(){Kr(this,e)}}function zl(e,t){return function(){(t.apply(this,arguments)?qr:Kr)(this,e)}}function Al(e,t){var n=Ur(e+"");if(arguments.length<2){for(var o=Eo(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?zl:t?Pl:Dl)(n,t))}function Ll(){this.textContent=""}function Bl(e){return function(){this.textContent=e}}function Vl(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Rl(e){return arguments.length?this.each(e==null?Ll:(typeof e=="function"?Vl:Bl)(e)):this.node().textContent}function Hl(){this.innerHTML=""}function Fl(e){return function(){this.innerHTML=e}}function Gl(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Yl(e){return arguments.length?this.each(e==null?Hl:(typeof e=="function"?Gl:Fl)(e)):this.node().innerHTML}function jl(){this.nextSibling&&this.parentNode.appendChild(this)}function Xl(){return this.each(jl)}function Wl(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ul(){return this.each(Wl)}function Zl(e){var t=typeof e=="function"?e:Fr(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function ql(){return null}function Kl(e,t){var n=typeof e=="function"?e:Fr(e),o=t==null?ql:typeof t=="function"?t:bo(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function Ql(){var e=this.parentNode;e&&e.removeChild(this)}function Jl(){return this.each(Ql)}function eu(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function tu(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function nu(e){return this.select(e?tu:eu)}function ou(e){return arguments.length?this.property("__data__",e):this.node().__data__}function ru(e){return function(t){e.call(this,t,this.__data__)}}function iu(e){return e.trim().split(/^|\s+/).map(function(t){var n="",o=t.indexOf(".");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function su(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,i;n<r;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++o]=i;++o?t.length=o:delete this.__on}}}function au(e,t,n){return function(){var o=this.__on,r,i=ru(t);if(o){for(var s=0,a=o.length;s<a;++s)if((r=o[s]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),r.value=t;return}}this.addEventListener(e.type,i,n),r={type:e.type,name:e.name,value:t,listener:i,options:n},o?o.push(r):this.__on=[r]}}function lu(e,t,n){var o=iu(e+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++l)for(r=0,u=a[l];r<i;++r)if((s=o[r]).type===u.type&&s.name===u.name)return u.value}return}for(a=t?au:su,r=0;r<i;++r)this.each(a(o[r],t,n));return this}function Qr(e,t,n){var o=Wr(e),r=o.CustomEvent;typeof r=="function"?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function uu(e,t){return function(){return Qr(this,e,t)}}function cu(e,t){return function(){return Qr(this,e,t.apply(this,arguments))}}function du(e,t){return this.each((typeof t=="function"?cu:uu)(e,t))}function*fu(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length,s;r<i;++r)(s=o[r])&&(yield s)}var Jr=[null];function Be(e,t){this._groups=e,this._parents=t}function tn(){return new Be([[document.documentElement]],Jr)}function hu(){return this}Be.prototype=tn.prototype={constructor:Be,select:Va,selectAll:Ga,selectChild:Wa,selectChildren:Ka,filter:Qa,data:rl,enter:Ja,exit:sl,join:al,merge:ll,selection:hu,order:ul,sort:cl,call:fl,nodes:hl,node:gl,size:pl,empty:vl,each:ml,attr:kl,style:$l,property:Ol,classed:Al,text:Rl,html:Yl,raise:Xl,lower:Ul,append:Zl,insert:Kl,remove:Jl,clone:nu,datum:ou,on:lu,dispatch:du,[Symbol.iterator]:fu};function Fe(e){return typeof e=="string"?new Be([[document.querySelector(e)]],[document.documentElement]):new Be([[e]],Jr)}function gu(e){let t;for(;t=e.sourceEvent;)e=t;return e}function We(e,t){if(e=gu(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}const pu={passive:!1},Ut={capture:!0,passive:!1};function Un(e){e.stopImmediatePropagation()}function St(e){e.preventDefault(),e.stopImmediatePropagation()}function ei(e){var t=e.document.documentElement,n=Fe(e).on("dragstart.drag",St,Ut);"onselectstart"in t?n.on("selectstart.drag",St,Ut):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function ti(e,t){var n=e.document.documentElement,o=Fe(e).on("dragstart.drag",null);t&&(o.on("click.drag",St,Ut),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const rn=e=>()=>e;function lo(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}lo.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function vu(e){return!e.ctrlKey&&!e.button}function mu(){return this.parentNode}function yu(e,t){return t??{x:e.x,y:e.y}}function wu(){return navigator.maxTouchPoints||"ontouchstart"in this}function _u(){var e=vu,t=mu,n=yu,o=wu,r={},i=An("start","drag","end"),s=0,a,l,c,u,d=0;function h(y){y.on("mousedown.drag",g).filter(o).on("touchstart.drag",k).on("touchmove.drag",x,pu).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(y,D){if(!(u||!e.call(this,y,D))){var R=p(this,t.call(this,y,D),y,D,"mouse");R&&(Fe(y.view).on("mousemove.drag",b,Ut).on("mouseup.drag",S,Ut),ei(y.view),Un(y),c=!1,a=y.clientX,l=y.clientY,R("start",y))}}function b(y){if(St(y),!c){var D=y.clientX-a,R=y.clientY-l;c=D*D+R*R>d}r.mouse("drag",y)}function S(y){Fe(y.view).on("mousemove.drag mouseup.drag",null),ti(y.view,c),St(y),r.mouse("end",y)}function k(y,D){if(e.call(this,y,D)){var R=y.changedTouches,Y=t.call(this,y,D),H=R.length,Q,O;for(Q=0;Q<H;++Q)(O=p(this,Y,y,D,R[Q].identifier,R[Q]))&&(Un(y),O("start",y,R[Q]))}}function x(y){var D=y.changedTouches,R=D.length,Y,H;for(Y=0;Y<R;++Y)(H=r[D[Y].identifier])&&(St(y),H("drag",y,D[Y]))}function _(y){var D=y.changedTouches,R=D.length,Y,H;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),Y=0;Y<R;++Y)(H=r[D[Y].identifier])&&(Un(y),H("end",y,D[Y]))}function p(y,D,R,Y,H,Q){var O=i.copy(),A=We(Q||R,D),E,M,f;if((f=n.call(y,new lo("beforestart",{sourceEvent:R,target:h,identifier:H,active:s,x:A[0],y:A[1],dx:0,dy:0,dispatch:O}),Y))!=null)return E=f.x-A[0]||0,M=f.y-A[1]||0,function w(v,C,z){var F=A,B;switch(v){case"start":r[H]=w,B=s++;break;case"end":delete r[H],--s;case"drag":A=We(z||C,D),B=s;break}O.call(v,y,new lo(v,{sourceEvent:C,subject:f,target:h,identifier:H,active:B,x:A[0]+E,y:A[1]+M,dx:A[0]-F[0],dy:A[1]-F[1],dispatch:O}),Y)}}return h.filter=function(y){return arguments.length?(e=typeof y=="function"?y:rn(!!y),h):e},h.container=function(y){return arguments.length?(t=typeof y=="function"?y:rn(y),h):t},h.subject=function(y){return arguments.length?(n=typeof y=="function"?y:rn(y),h):n},h.touchable=function(y){return arguments.length?(o=typeof y=="function"?y:rn(!!y),h):o},h.on=function(){var y=i.on.apply(i,arguments);return y===i?h:y},h.clickDistance=function(y){return arguments.length?(d=(y=+y)*y,h):Math.sqrt(d)},h}function ko(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function ni(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function nn(){}var Zt=.7,Nn=1/Zt,Nt="\\s*([+-]?\\d+)\\s*",qt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",qe="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",xu=/^#([0-9a-f]{3,8})$/,bu=new RegExp(`^rgb\\(${Nt},${Nt},${Nt}\\)$`),Eu=new RegExp(`^rgb\\(${qe},${qe},${qe}\\)$`),ku=new RegExp(`^rgba\\(${Nt},${Nt},${Nt},${qt}\\)$`),Su=new RegExp(`^rgba\\(${qe},${qe},${qe},${qt}\\)$`),Nu=new RegExp(`^hsl\\(${qt},${qe},${qe}\\)$`),Cu=new RegExp(`^hsla\\(${qt},${qe},${qe},${qt}\\)$`),Yo={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};ko(nn,yt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:jo,formatHex:jo,formatHex8:$u,formatHsl:Mu,formatRgb:Xo,toString:Xo});function jo(){return this.rgb().formatHex()}function $u(){return this.rgb().formatHex8()}function Mu(){return oi(this).formatHsl()}function Xo(){return this.rgb().formatRgb()}function yt(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=xu.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Wo(t):n===3?new Le(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?sn(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?sn(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=bu.exec(e))?new Le(t[1],t[2],t[3],1):(t=Eu.exec(e))?new Le(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=ku.exec(e))?sn(t[1],t[2],t[3],t[4]):(t=Su.exec(e))?sn(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Nu.exec(e))?qo(t[1],t[2]/100,t[3]/100,1):(t=Cu.exec(e))?qo(t[1],t[2]/100,t[3]/100,t[4]):Yo.hasOwnProperty(e)?Wo(Yo[e]):e==="transparent"?new Le(NaN,NaN,NaN,0):null}function Wo(e){return new Le(e>>16&255,e>>8&255,e&255,1)}function sn(e,t,n,o){return o<=0&&(e=t=n=NaN),new Le(e,t,n,o)}function Iu(e){return e instanceof nn||(e=yt(e)),e?(e=e.rgb(),new Le(e.r,e.g,e.b,e.opacity)):new Le}function uo(e,t,n,o){return arguments.length===1?Iu(e):new Le(e,t,n,o??1)}function Le(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}ko(Le,uo,ni(nn,{brighter(e){return e=e==null?Nn:Math.pow(Nn,e),new Le(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Zt:Math.pow(Zt,e),new Le(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Le(vt(this.r),vt(this.g),vt(this.b),Cn(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Uo,formatHex:Uo,formatHex8:Tu,formatRgb:Zo,toString:Zo}));function Uo(){return`#${pt(this.r)}${pt(this.g)}${pt(this.b)}`}function Tu(){return`#${pt(this.r)}${pt(this.g)}${pt(this.b)}${pt((isNaN(this.opacity)?1:this.opacity)*255)}`}function Zo(){const e=Cn(this.opacity);return`${e===1?"rgb(":"rgba("}${vt(this.r)}, ${vt(this.g)}, ${vt(this.b)}${e===1?")":`, ${e})`}`}function Cn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function vt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function pt(e){return e=vt(e),(e<16?"0":"")+e.toString(16)}function qo(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ge(e,t,n,o)}function oi(e){if(e instanceof Ge)return new Ge(e.h,e.s,e.l,e.opacity);if(e instanceof nn||(e=yt(e)),!e)return new Ge;if(e instanceof Ge)return e;e=e.rgb();var t=e.r/255,n=e.g/255,o=e.b/255,r=Math.min(t,n,o),i=Math.max(t,n,o),s=NaN,a=i-r,l=(i+r)/2;return a?(t===i?s=(n-o)/a+(n<o)*6:n===i?s=(o-t)/a+2:s=(t-n)/a+4,a/=l<.5?i+r:2-i-r,s*=60):a=l>0&&l<1?0:s,new Ge(s,a,l,e.opacity)}function Ou(e,t,n,o){return arguments.length===1?oi(e):new Ge(e,t,n,o??1)}function Ge(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}ko(Ge,Ou,ni(nn,{brighter(e){return e=e==null?Nn:Math.pow(Nn,e),new Ge(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Zt:Math.pow(Zt,e),new Ge(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,r=2*n-o;return new Le(Zn(e>=240?e-240:e+120,r,o),Zn(e,r,o),Zn(e<120?e+240:e-120,r,o),this.opacity)},clamp(){return new Ge(Ko(this.h),an(this.s),an(this.l),Cn(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Cn(this.opacity);return`${e===1?"hsl(":"hsla("}${Ko(this.h)}, ${an(this.s)*100}%, ${an(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Ko(e){return e=(e||0)%360,e<0?e+360:e}function an(e){return Math.max(0,Math.min(1,e||0))}function Zn(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const So=e=>()=>e;function Pu(e,t){return function(n){return e+n*t}}function Du(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}function zu(e){return(e=+e)==1?ri:function(t,n){return n-t?Du(t,n,e):So(isNaN(t)?n:t)}}function ri(e,t){var n=t-e;return n?Pu(e,n):So(isNaN(e)?t:e)}const $n=(function e(t){var n=zu(t);function o(r,i){var s=n((r=uo(r)).r,(i=uo(i)).r),a=n(r.g,i.g),l=n(r.b,i.b),c=ri(r.opacity,i.opacity);return function(u){return r.r=s(u),r.g=a(u),r.b=l(u),r.opacity=c(u),r+""}}return o.gamma=e,o})(1);function Au(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,o=t.slice(),r;return function(i){for(r=0;r<n;++r)o[r]=e[r]*(1-i)+t[r]*i;return o}}function Lu(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Bu(e,t){var n=t?t.length:0,o=e?Math.min(n,e.length):0,r=new Array(o),i=new Array(n),s;for(s=0;s<o;++s)r[s]=Yt(e[s],t[s]);for(;s<n;++s)i[s]=t[s];return function(a){for(s=0;s<o;++s)i[s]=r[s](a);return i}}function Vu(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function Ue(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Ru(e,t){var n={},o={},r;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(r in t)r in e?n[r]=Yt(e[r],t[r]):o[r]=t[r];return function(i){for(r in n)o[r]=n[r](i);return o}}var co=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,qn=new RegExp(co.source,"g");function Hu(e){return function(){return e}}function Fu(e){return function(t){return e(t)+""}}function ii(e,t){var n=co.lastIndex=qn.lastIndex=0,o,r,i,s=-1,a=[],l=[];for(e=e+"",t=t+"";(o=co.exec(e))&&(r=qn.exec(t));)(i=r.index)>n&&(i=t.slice(n,i),a[s]?a[s]+=i:a[++s]=i),(o=o[0])===(r=r[0])?a[s]?a[s]+=r:a[++s]=r:(a[++s]=null,l.push({i:s,x:Ue(o,r)})),n=qn.lastIndex;return n<t.length&&(i=t.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?l[0]?Fu(l[0].x):Hu(t):(t=l.length,function(c){for(var u=0,d;u<t;++u)a[(d=l[u]).i]=d.x(c);return a.join("")})}function Yt(e,t){var n=typeof t,o;return t==null||n==="boolean"?So(t):(n==="number"?Ue:n==="string"?(o=yt(t))?(t=o,$n):ii:t instanceof yt?$n:t instanceof Date?Vu:Lu(t)?Au:Array.isArray(t)?Bu:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Ru:Ue)(e,t)}var Qo=180/Math.PI,fo={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function si(e,t,n,o,r,i){var s,a,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,l/=a),e*o<t*n&&(e=-e,t=-t,l=-l,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*Qo,skewX:Math.atan(l)*Qo,scaleX:s,scaleY:a}}var ln;function Gu(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?fo:si(t.a,t.b,t.c,t.d,t.e,t.f)}function Yu(e){return e==null||(ln||(ln=document.createElementNS("http://www.w3.org/2000/svg","g")),ln.setAttribute("transform",e),!(e=ln.transform.baseVal.consolidate()))?fo:(e=e.matrix,si(e.a,e.b,e.c,e.d,e.e,e.f))}function ai(e,t,n,o){function r(c){return c.length?c.pop()+" ":""}function i(c,u,d,h,g,b){if(c!==d||u!==h){var S=g.push("translate(",null,t,null,n);b.push({i:S-4,x:Ue(c,d)},{i:S-2,x:Ue(u,h)})}else(d||h)&&g.push("translate("+d+t+h+n)}function s(c,u,d,h){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),h.push({i:d.push(r(d)+"rotate(",null,o)-2,x:Ue(c,u)})):u&&d.push(r(d)+"rotate("+u+o)}function a(c,u,d,h){c!==u?h.push({i:d.push(r(d)+"skewX(",null,o)-2,x:Ue(c,u)}):u&&d.push(r(d)+"skewX("+u+o)}function l(c,u,d,h,g,b){if(c!==d||u!==h){var S=g.push(r(g)+"scale(",null,",",null,")");b.push({i:S-4,x:Ue(c,d)},{i:S-2,x:Ue(u,h)})}else(d!==1||h!==1)&&g.push(r(g)+"scale("+d+","+h+")")}return function(c,u){var d=[],h=[];return c=e(c),u=e(u),i(c.translateX,c.translateY,u.translateX,u.translateY,d,h),s(c.rotate,u.rotate,d,h),a(c.skewX,u.skewX,d,h),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,d,h),c=u=null,function(g){for(var b=-1,S=h.length,k;++b<S;)d[(k=h[b]).i]=k.x(g);return d.join("")}}}var ju=ai(Gu,"px, ","px)","deg)"),Xu=ai(Yu,", ",")",")"),Wu=1e-12;function Jo(e){return((e=Math.exp(e))+1/e)/2}function Uu(e){return((e=Math.exp(e))-1/e)/2}function Zu(e){return((e=Math.exp(2*e))-1)/(e+1)}const yn=(function e(t,n,o){function r(i,s){var a=i[0],l=i[1],c=i[2],u=s[0],d=s[1],h=s[2],g=u-a,b=d-l,S=g*g+b*b,k,x;if(S<Wu)x=Math.log(h/c)/t,k=function(Y){return[a+Y*g,l+Y*b,c*Math.exp(t*Y*x)]};else{var _=Math.sqrt(S),p=(h*h-c*c+o*S)/(2*c*n*_),y=(h*h-c*c-o*S)/(2*h*n*_),D=Math.log(Math.sqrt(p*p+1)-p),R=Math.log(Math.sqrt(y*y+1)-y);x=(R-D)/t,k=function(Y){var H=Y*x,Q=Jo(D),O=c/(n*_)*(Q*Zu(t*H+D)-Uu(D));return[a+O*g,l+O*b,c*Q/Jo(t*H+D)]}}return k.duration=x*1e3*t/Math.SQRT2,k}return r.rho=function(i){var s=Math.max(.001,+i),a=s*s,l=a*a;return e(s,a,l)},r})(Math.SQRT2,2,4);var Tt=0,Rt=0,Lt=0,li=1e3,Mn,Ht,In=0,wt=0,Bn=0,Kt=typeof performance=="object"&&performance.now?performance:Date,ui=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function No(){return wt||(ui(qu),wt=Kt.now()+Bn)}function qu(){wt=0}function Tn(){this._call=this._time=this._next=null}Tn.prototype=ci.prototype={constructor:Tn,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?No():+n)+(t==null?0:+t),!this._next&&Ht!==this&&(Ht?Ht._next=this:Mn=this,Ht=this),this._call=e,this._time=n,ho()},stop:function(){this._call&&(this._call=null,this._time=1/0,ho())}};function ci(e,t,n){var o=new Tn;return o.restart(e,t,n),o}function Ku(){No(),++Tt;for(var e=Mn,t;e;)(t=wt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Tt}function er(){wt=(In=Kt.now())+Bn,Tt=Rt=0;try{Ku()}finally{Tt=0,Ju(),wt=0}}function Qu(){var e=Kt.now(),t=e-In;t>li&&(Bn-=t,In=e)}function Ju(){for(var e,t=Mn,n,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Mn=n);Ht=e,ho(o)}function ho(e){if(!Tt){Rt&&(Rt=clearTimeout(Rt));var t=e-wt;t>24?(e<1/0&&(Rt=setTimeout(er,e-Kt.now()-Bn)),Lt&&(Lt=clearInterval(Lt))):(Lt||(In=Kt.now(),Lt=setInterval(Qu,li)),Tt=1,ui(er))}}function tr(e,t,n){var o=new Tn;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var ec=An("start","end","cancel","interrupt"),tc=[],di=0,nr=1,go=2,wn=3,or=4,po=5,_n=6;function Vn(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;nc(e,n,{name:t,index:o,group:r,on:ec,tween:tc,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:di})}function Co(e,t){var n=je(e,t);if(n.state>di)throw new Error("too late; already scheduled");return n}function Ke(e,t){var n=je(e,t);if(n.state>wn)throw new Error("too late; already running");return n}function je(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function nc(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=ci(i,0,n.time);function i(c){n.state=nr,n.timer.restart(s,n.delay,n.time),n.delay<=c&&s(c-n.delay)}function s(c){var u,d,h,g;if(n.state!==nr)return l();for(u in o)if(g=o[u],g.name===n.name){if(g.state===wn)return tr(s);g.state===or?(g.state=_n,g.timer.stop(),g.on.call("interrupt",e,e.__data__,g.index,g.group),delete o[u]):+u<t&&(g.state=_n,g.timer.stop(),g.on.call("cancel",e,e.__data__,g.index,g.group),delete o[u])}if(tr(function(){n.state===wn&&(n.state=or,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=go,n.on.call("start",e,e.__data__,n.index,n.group),n.state===go){for(n.state=wn,r=new Array(h=n.tween.length),u=0,d=-1;u<h;++u)(g=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++d]=g);r.length=d+1}}function a(c){for(var u=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=po,1),d=-1,h=r.length;++d<h;)r[d].call(e,u);n.state===po&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=_n,n.timer.stop(),delete o[t];for(var c in o)return;delete e.__transition}}function xn(e,t){var n=e.__transition,o,r,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((o=n[s]).name!==t){i=!1;continue}r=o.state>go&&o.state<po,o.state=_n,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function oc(e){return this.each(function(){xn(this,e)})}function rc(e,t){var n,o;return function(){var r=Ke(this,e),i=r.tween;if(i!==n){o=n=i;for(var s=0,a=o.length;s<a;++s)if(o[s].name===t){o=o.slice(),o.splice(s,1);break}}r.tween=o}}function ic(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=Ke(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:t,value:n},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=a;break}l===c&&r.push(a)}i.tween=r}}function sc(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=je(this.node(),n).tween,r=0,i=o.length,s;r<i;++r)if((s=o[r]).name===e)return s.value;return null}return this.each((t==null?rc:ic)(n,e,t))}function $o(e,t,n){var o=e._id;return e.each(function(){var r=Ke(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return je(r,o).value[t]}}function fi(e,t){var n;return(typeof t=="number"?Ue:t instanceof yt?$n:(n=yt(t))?(t=n,$n):ii)(e,t)}function ac(e){return function(){this.removeAttribute(e)}}function lc(e){return function(){this.removeAttributeNS(e.space,e.local)}}function uc(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttribute(e);return s===r?null:s===o?i:i=t(o=s,n)}}function cc(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===r?null:s===o?i:i=t(o=s,n)}}function dc(e,t,n){var o,r,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),l=a+"",s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a)))}}function fc(e,t,n){var o,r,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),l=a+"",s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a)))}}function hc(e,t){var n=Ln(e),o=n==="transform"?Xu:fi;return this.attrTween(e,typeof t=="function"?(n.local?fc:dc)(n,o,$o(this,"attr."+e,t)):t==null?(n.local?lc:ac)(n):(n.local?cc:uc)(n,o,t))}function gc(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function pc(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function vc(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&pc(e,i)),n}return r._value=t,r}function mc(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&gc(e,i)),n}return r._value=t,r}function yc(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var o=Ln(e);return this.tween(n,(o.local?vc:mc)(o,t))}function wc(e,t){return function(){Co(this,e).delay=+t.apply(this,arguments)}}function _c(e,t){return t=+t,function(){Co(this,e).delay=t}}function xc(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?wc:_c)(t,e)):je(this.node(),t).delay}function bc(e,t){return function(){Ke(this,e).duration=+t.apply(this,arguments)}}function Ec(e,t){return t=+t,function(){Ke(this,e).duration=t}}function kc(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?bc:Ec)(t,e)):je(this.node(),t).duration}function Sc(e,t){if(typeof t!="function")throw new Error;return function(){Ke(this,e).ease=t}}function Nc(e){var t=this._id;return arguments.length?this.each(Sc(t,e)):je(this.node(),t).ease}function Cc(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Ke(this,e).ease=n}}function $c(e){if(typeof e!="function")throw new Error;return this.each(Cc(this._id,e))}function Mc(e){typeof e!="function"&&(e=Yr(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new ot(o,this._parents,this._name,this._id)}function Ic(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var l=t[a],c=n[a],u=l.length,d=s[a]=new Array(u),h,g=0;g<u;++g)(h=l[g]||c[g])&&(d[g]=h);for(;a<o;++a)s[a]=t[a];return new ot(s,this._parents,this._name,this._id)}function Tc(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function Oc(e,t,n){var o,r,i=Tc(t)?Co:Ke;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}function Pc(e,t){var n=this._id;return arguments.length<2?je(this.node(),n).on.on(e):this.each(Oc(n,e,t))}function Dc(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function zc(){return this.on("end.remove",Dc(this._id))}function Ac(e){var t=this._name,n=this._id;typeof e!="function"&&(e=bo(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],l=a.length,c=i[s]=new Array(l),u,d,h=0;h<l;++h)(u=a[h])&&(d=e.call(u,u.__data__,h,a))&&("__data__"in u&&(d.__data__=u.__data__),c[h]=d,Vn(c[h],t,n,h,c,je(u,n)));return new ot(i,this._parents,t,n)}function Lc(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Gr(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var l=o[a],c=l.length,u,d=0;d<c;++d)if(u=l[d]){for(var h=e.call(u,u.__data__,d,l),g,b=je(u,n),S=0,k=h.length;S<k;++S)(g=h[S])&&Vn(g,t,n,S,h,b);i.push(h),s.push(u)}return new ot(i,s,t,n)}var Bc=tn.prototype.constructor;function Vc(){return new Bc(this._groups,this._parents)}function Rc(e,t){var n,o,r;return function(){var i=It(this,e),s=(this.style.removeProperty(e),It(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}function hi(e){return function(){this.style.removeProperty(e)}}function Hc(e,t,n){var o,r=n+"",i;return function(){var s=It(this,e);return s===r?null:s===o?i:i=t(o=s,n)}}function Fc(e,t,n){var o,r,i;return function(){var s=It(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),It(this,e))),s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a))}}function Gc(e,t){var n,o,r,i="style."+t,s="end."+i,a;return function(){var l=Ke(this,e),c=l.on,u=l.value[i]==null?a||(a=hi(t)):void 0;(c!==n||r!==u)&&(o=(n=c).copy()).on(s,r=u),l.on=o}}function Yc(e,t,n){var o=(e+="")=="transform"?ju:fi;return t==null?this.styleTween(e,Rc(e,o)).on("end.style."+e,hi(e)):typeof t=="function"?this.styleTween(e,Fc(e,o,$o(this,"style."+e,t))).each(Gc(this._id,e)):this.styleTween(e,Hc(e,o,t),n).on("end.style."+e,null)}function jc(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function Xc(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&jc(e,s,n)),o}return i._value=t,i}function Wc(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;return this.tween(o,Xc(e,t,n??""))}function Uc(e){return function(){this.textContent=e}}function Zc(e){return function(){var t=e(this);this.textContent=t??""}}function qc(e){return this.tween("text",typeof e=="function"?Zc($o(this,"text",e)):Uc(e==null?"":e+""))}function Kc(e){return function(t){this.textContent=e.call(this,t)}}function Qc(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Kc(r)),t}return o._value=e,o}function Jc(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,Qc(e))}function ed(){for(var e=this._name,t=this._id,n=gi(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,l,c=0;c<a;++c)if(l=s[c]){var u=je(l,t);Vn(l,e,n,c,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new ot(o,this._parents,e,n)}function td(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},l={value:function(){--r===0&&i()}};n.each(function(){var c=Ke(this,o),u=c.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),c.on=t}),r===0&&i()})}var nd=0;function ot(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function gi(){return++nd}var Qe=tn.prototype;ot.prototype={constructor:ot,select:Ac,selectAll:Lc,selectChild:Qe.selectChild,selectChildren:Qe.selectChildren,filter:Mc,merge:Ic,selection:Vc,transition:ed,call:Qe.call,nodes:Qe.nodes,node:Qe.node,size:Qe.size,empty:Qe.empty,each:Qe.each,on:Pc,attr:hc,attrTween:yc,style:Yc,styleTween:Wc,text:qc,textTween:Jc,remove:zc,tween:sc,delay:xc,duration:kc,ease:Nc,easeVarying:$c,end:td,[Symbol.iterator]:Qe[Symbol.iterator]};function od(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var rd={time:null,delay:0,duration:250,ease:od};function id(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function sd(e){var t,n;e instanceof ot?(t=e._id,e=e._name):(t=gi(),(n=rd).time=No(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&Vn(l,e,t,c,s,n||id(l,t));return new ot(o,this._parents,e,t)}tn.prototype.interrupt=oc;tn.prototype.transition=sd;const un=e=>()=>e;function ad(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function et(e,t,n){this.k=e,this.x=t,this.y=n}et.prototype={constructor:et,scale:function(e){return e===1?this:new et(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new et(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ot=new et(1,0,0);et.prototype;function Kn(e){e.stopImmediatePropagation()}function Bt(e){e.preventDefault(),e.stopImmediatePropagation()}function ld(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function ud(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function rr(){return this.__zoom||Ot}function cd(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function dd(){return navigator.maxTouchPoints||"ontouchstart"in this}function fd(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function hd(){var e=ld,t=ud,n=fd,o=cd,r=dd,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,l=yn,c=An("start","zoom","end"),u,d,h,g=500,b=150,S=0,k=10;function x(f){f.property("__zoom",rr).on("wheel.zoom",H,{passive:!1}).on("mousedown.zoom",Q).on("dblclick.zoom",O).filter(r).on("touchstart.zoom",A).on("touchmove.zoom",E).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}x.transform=function(f,w,v,C){var z=f.selection?f.selection():f;z.property("__zoom",rr),f!==z?D(f,w,v,C):z.interrupt().each(function(){R(this,arguments).event(C).start().zoom(null,typeof w=="function"?w.apply(this,arguments):w).end()})},x.scaleBy=function(f,w,v,C){x.scaleTo(f,function(){var z=this.__zoom.k,F=typeof w=="function"?w.apply(this,arguments):w;return z*F},v,C)},x.scaleTo=function(f,w,v,C){x.transform(f,function(){var z=t.apply(this,arguments),F=this.__zoom,B=v==null?y(z):typeof v=="function"?v.apply(this,arguments):v,G=F.invert(B),U=typeof w=="function"?w.apply(this,arguments):w;return n(p(_(F,U),B,G),z,s)},v,C)},x.translateBy=function(f,w,v,C){x.transform(f,function(){return n(this.__zoom.translate(typeof w=="function"?w.apply(this,arguments):w,typeof v=="function"?v.apply(this,arguments):v),t.apply(this,arguments),s)},null,C)},x.translateTo=function(f,w,v,C,z){x.transform(f,function(){var F=t.apply(this,arguments),B=this.__zoom,G=C==null?y(F):typeof C=="function"?C.apply(this,arguments):C;return n(Ot.translate(G[0],G[1]).scale(B.k).translate(typeof w=="function"?-w.apply(this,arguments):-w,typeof v=="function"?-v.apply(this,arguments):-v),F,s)},C,z)};function _(f,w){return w=Math.max(i[0],Math.min(i[1],w)),w===f.k?f:new et(w,f.x,f.y)}function p(f,w,v){var C=w[0]-v[0]*f.k,z=w[1]-v[1]*f.k;return C===f.x&&z===f.y?f:new et(f.k,C,z)}function y(f){return[(+f[0][0]+ +f[1][0])/2,(+f[0][1]+ +f[1][1])/2]}function D(f,w,v,C){f.on("start.zoom",function(){R(this,arguments).event(C).start()}).on("interrupt.zoom end.zoom",function(){R(this,arguments).event(C).end()}).tween("zoom",function(){var z=this,F=arguments,B=R(z,F).event(C),G=t.apply(z,F),U=v==null?y(G):typeof v=="function"?v.apply(z,F):v,K=Math.max(G[1][0]-G[0][0],G[1][1]-G[0][1]),T=z.__zoom,m=typeof w=="function"?w.apply(z,F):w,I=l(T.invert(U).concat(K/T.k),m.invert(U).concat(K/m.k));return function(L){if(L===1)L=m;else{var X=I(L),J=K/X[2];L=new et(J,U[0]-X[0]*J,U[1]-X[1]*J)}B.zoom(null,L)}})}function R(f,w,v){return!v&&f.__zooming||new Y(f,w)}function Y(f,w){this.that=f,this.args=w,this.active=0,this.sourceEvent=null,this.extent=t.apply(f,w),this.taps=0}Y.prototype={event:function(f){return f&&(this.sourceEvent=f),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(f,w){return this.mouse&&f!=="mouse"&&(this.mouse[1]=w.invert(this.mouse[0])),this.touch0&&f!=="touch"&&(this.touch0[1]=w.invert(this.touch0[0])),this.touch1&&f!=="touch"&&(this.touch1[1]=w.invert(this.touch1[0])),this.that.__zoom=w,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(f){var w=Fe(this.that).datum();c.call(f,this.that,new ad(f,{sourceEvent:this.sourceEvent,target:x,transform:this.that.__zoom,dispatch:c}),w)}};function H(f,...w){if(!e.apply(this,arguments))return;var v=R(this,w).event(f),C=this.__zoom,z=Math.max(i[0],Math.min(i[1],C.k*Math.pow(2,o.apply(this,arguments)))),F=We(f);if(v.wheel)(v.mouse[0][0]!==F[0]||v.mouse[0][1]!==F[1])&&(v.mouse[1]=C.invert(v.mouse[0]=F)),clearTimeout(v.wheel);else{if(C.k===z)return;v.mouse=[F,C.invert(F)],xn(this),v.start()}Bt(f),v.wheel=setTimeout(B,b),v.zoom("mouse",n(p(_(C,z),v.mouse[0],v.mouse[1]),v.extent,s));function B(){v.wheel=null,v.end()}}function Q(f,...w){if(h||!e.apply(this,arguments))return;var v=f.currentTarget,C=R(this,w,!0).event(f),z=Fe(f.view).on("mousemove.zoom",U,!0).on("mouseup.zoom",K,!0),F=We(f,v),B=f.clientX,G=f.clientY;ei(f.view),Kn(f),C.mouse=[F,this.__zoom.invert(F)],xn(this),C.start();function U(T){if(Bt(T),!C.moved){var m=T.clientX-B,I=T.clientY-G;C.moved=m*m+I*I>S}C.event(T).zoom("mouse",n(p(C.that.__zoom,C.mouse[0]=We(T,v),C.mouse[1]),C.extent,s))}function K(T){z.on("mousemove.zoom mouseup.zoom",null),ti(T.view,C.moved),Bt(T),C.event(T).end()}}function O(f,...w){if(e.apply(this,arguments)){var v=this.__zoom,C=We(f.changedTouches?f.changedTouches[0]:f,this),z=v.invert(C),F=v.k*(f.shiftKey?.5:2),B=n(p(_(v,F),C,z),t.apply(this,w),s);Bt(f),a>0?Fe(this).transition().duration(a).call(D,B,C,f):Fe(this).call(x.transform,B,C,f)}}function A(f,...w){if(e.apply(this,arguments)){var v=f.touches,C=v.length,z=R(this,w,f.changedTouches.length===C).event(f),F,B,G,U;for(Kn(f),B=0;B<C;++B)G=v[B],U=We(G,this),U=[U,this.__zoom.invert(U),G.identifier],z.touch0?!z.touch1&&z.touch0[2]!==U[2]&&(z.touch1=U,z.taps=0):(z.touch0=U,F=!0,z.taps=1+!!u);u&&(u=clearTimeout(u)),F&&(z.taps<2&&(d=U[0],u=setTimeout(function(){u=null},g)),xn(this),z.start())}}function E(f,...w){if(this.__zooming){var v=R(this,w).event(f),C=f.changedTouches,z=C.length,F,B,G,U;for(Bt(f),F=0;F<z;++F)B=C[F],G=We(B,this),v.touch0&&v.touch0[2]===B.identifier?v.touch0[0]=G:v.touch1&&v.touch1[2]===B.identifier&&(v.touch1[0]=G);if(B=v.that.__zoom,v.touch1){var K=v.touch0[0],T=v.touch0[1],m=v.touch1[0],I=v.touch1[1],L=(L=m[0]-K[0])*L+(L=m[1]-K[1])*L,X=(X=I[0]-T[0])*X+(X=I[1]-T[1])*X;B=_(B,Math.sqrt(L/X)),G=[(K[0]+m[0])/2,(K[1]+m[1])/2],U=[(T[0]+I[0])/2,(T[1]+I[1])/2]}else if(v.touch0)G=v.touch0[0],U=v.touch0[1];else return;v.zoom("touch",n(p(B,G,U),v.extent,s))}}function M(f,...w){if(this.__zooming){var v=R(this,w).event(f),C=f.changedTouches,z=C.length,F,B;for(Kn(f),h&&clearTimeout(h),h=setTimeout(function(){h=null},g),F=0;F<z;++F)B=C[F],v.touch0&&v.touch0[2]===B.identifier?delete v.touch0:v.touch1&&v.touch1[2]===B.identifier&&delete v.touch1;if(v.touch1&&!v.touch0&&(v.touch0=v.touch1,delete v.touch1),v.touch0)v.touch0[1]=this.__zoom.invert(v.touch0[0]);else if(v.end(),v.taps===2&&(B=We(B,this),Math.hypot(d[0]-B[0],d[1]-B[1])<k)){var G=Fe(this).on("dblclick.zoom");G&&G.apply(this,arguments)}}}return x.wheelDelta=function(f){return arguments.length?(o=typeof f=="function"?f:un(+f),x):o},x.filter=function(f){return arguments.length?(e=typeof f=="function"?f:un(!!f),x):e},x.touchable=function(f){return arguments.length?(r=typeof f=="function"?f:un(!!f),x):r},x.extent=function(f){return arguments.length?(t=typeof f=="function"?f:un([[+f[0][0],+f[0][1]],[+f[1][0],+f[1][1]]]),x):t},x.scaleExtent=function(f){return arguments.length?(i[0]=+f[0],i[1]=+f[1],x):[i[0],i[1]]},x.translateExtent=function(f){return arguments.length?(s[0][0]=+f[0][0],s[1][0]=+f[1][0],s[0][1]=+f[0][1],s[1][1]=+f[1][1],x):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},x.constrain=function(f){return arguments.length?(n=f,x):n},x.duration=function(f){return arguments.length?(a=+f,x):a},x.interpolate=function(f){return arguments.length?(l=f,x):l},x.on=function(){var f=c.on.apply(c,arguments);return f===c?x:f},x.clickDistance=function(f){return arguments.length?(S=(f=+f)*f,x):Math.sqrt(S)},x.tapDistance=function(f){return arguments.length?(k=+f,x):k},x}var ue=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(ue||{}),Mo=(e=>(e.Partial="partial",e.Full="full",e))(Mo||{}),ht=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(ht||{}),dt=(e=>(e.Strict="strict",e.Loose="loose",e))(dt||{}),On=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(On||{}),jt=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(jt||{}),pi=(e=>(e.TopLeft="top-left",e.TopCenter="top-center",e.TopRight="top-right",e.BottomLeft="bottom-left",e.BottomCenter="bottom-center",e.BottomRight="bottom-right",e))(pi||{});const gd=["INPUT","SELECT","TEXTAREA"],pd=typeof document<"u"?document:null;function vo(e){var t,n;const o=((n=(t=e.composedPath)==null?void 0:t.call(e))==null?void 0:n[0])||e.target,r=typeof o?.hasAttribute=="function"?o.hasAttribute("contenteditable"):!1,i=typeof o?.closest=="function"?o.closest(".nokey"):null;return gd.includes(o?.nodeName)||r||!!i}function vd(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function ir(e,t,n,o){const r=t.replace("+",`
3
+ `).replace(`
4
+
5
+ `,`
6
+ +`).split(`
7
+ `).map(s=>s.trim().toLowerCase());if(r.length===1)return e.toLowerCase()===t.toLowerCase();o||n.add(e.toLowerCase());const i=r.every((s,a)=>n.has(s)&&Array.from(n.values())[a]===r[a]);return o&&n.delete(e.toLowerCase()),i}function md(e,t){return n=>{if(!n.code&&!n.key)return!1;const o=yd(n.code,e);return Array.isArray(e)?e.some(r=>ir(n[o],r,t,n.type==="keyup")):ir(n[o],e,t,n.type==="keyup")}}function yd(e,t){return t.includes(e)?"code":"key"}function Xt(e,t){const n=ie(()=>_e(t?.target)??pd),o=ut(_e(e)===!0);let r=!1;const i=new Set;let s=l(_e(e));ye(()=>_e(e),(c,u)=>{typeof u=="boolean"&&typeof c!="boolean"&&a(),s=l(c)},{immediate:!0}),Hr(["blur","contextmenu"],a),Ho((...c)=>s(...c),c=>{var u,d;const h=_e(t?.actInsideInputWithModifier)??!0,g=_e(t?.preventDefault)??!1;if(r=vd(c),(!r||r&&!h)&&vo(c))return;const S=((d=(u=c.composedPath)==null?void 0:u.call(c))==null?void 0:d[0])||c.target,k=S?.nodeName==="BUTTON"||S?.nodeName==="A";!g&&(r||!k)&&c.preventDefault(),o.value=!0},{eventName:"keydown",target:n}),Ho((...c)=>s(...c),c=>{const u=_e(t?.actInsideInputWithModifier)??!0;if(o.value){if((!r||r&&!u)&&vo(c))return;r=!1,o.value=!1}},{eventName:"keyup",target:n});function a(){r=!1,i.clear(),o.value=_e(e)===!0}function l(c){return c===null?(a(),()=>!1):typeof c=="boolean"?(a(),o.value=c,()=>!1):Array.isArray(c)||typeof c=="string"?md(c,i):c}return o}const vi="vue-flow__node-desc",mi="vue-flow__edge-desc",wd="vue-flow__aria-live",yi=["Enter"," ","Escape"],Ct={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function Pn(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function Dn(e,t){const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)}function Rn(e){return{width:e.offsetWidth,height:e.offsetHeight}}function _t(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function wi(e,t){return{x:_t(e.x,t[0][0],t[1][0]),y:_t(e.y,t[0][1],t[1][1])}}function sr(e){const t=e.getRootNode();return"elementFromPoint"in t?t:window.document}function ft(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function mt(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!ft(e)}function Ft(e){return mt(e)&&"computedPosition"in e}function cn(e){return!Number.isNaN(e)&&Number.isFinite(e)}function _d(e){return cn(e.width)&&cn(e.height)&&cn(e.x)&&cn(e.y)}function xd(e,t,n){const o={id:e.id.toString(),type:e.type??"default",dimensions:kt({width:0,height:0}),computedPosition:kt({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:Oe(e.data)?e.data:{},events:kt(Oe(e.events)?e.events:{})};return Object.assign(t??o,e,{id:e.id.toString(),parentNode:n})}function _i(e,t,n){var o,r;const i={id:e.id.toString(),type:e.type??t?.type??"default",source:e.source.toString(),target:e.target.toString(),sourceHandle:(o=e.sourceHandle)==null?void 0:o.toString(),targetHandle:(r=e.targetHandle)==null?void 0:r.toString(),updatable:e.updatable??n?.updatable,selectable:e.selectable??n?.selectable,focusable:e.focusable??n?.focusable,data:Oe(e.data)?e.data:{},events:kt(Oe(e.events)?e.events:{}),label:e.label??"",interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??i,e,{id:e.id.toString()})}function xi(e,t,n,o){const r=typeof e=="string"?e:e.id,i=new Set,s=o==="source"?"target":"source";for(const a of n)a[s]===r&&i.add(a[o]);return t.filter(a=>i.has(a.id))}function bd(...e){if(e.length===3){const[i,s,a]=e;return xi(i,s,a,"target")}const[t,n]=e,o=typeof t=="string"?t:t.id;return n.filter(i=>ft(i)&&i.source===o).map(i=>n.find(s=>mt(s)&&s.id===i.target))}function Ed(...e){if(e.length===3){const[i,s,a]=e;return xi(i,s,a,"source")}const[t,n]=e,o=typeof t=="string"?t:t.id;return n.filter(i=>ft(i)&&i.target===o).map(i=>n.find(s=>mt(s)&&s.id===i.source))}function bi({source:e,sourceHandle:t,target:n,targetHandle:o}){return`vueflow__edge-${e}${t??""}-${n}${o??""}`}function kd(e,t){return t.some(n=>ft(n)&&n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle))}function Qt({x:e,y:t},{x:n,y:o,zoom:r}){return{x:e*r+n,y:t*r+o}}function Jt({x:e,y:t},{x:n,y:o,zoom:r},i=!1,s=[1,1]){const a={x:(e-n)/r,y:(t-o)/r};return i?Hn(a,s):a}function Sd(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}}function Ei({x:e,y:t,width:n,height:o}){return{x:e,y:t,x2:e+n,y2:t+o}}function Nd({x:e,y:t,x2:n,y2:o}){return{x:e,y:t,width:n-e,height:o-t}}function ki(e){let t={x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY,x2:Number.NEGATIVE_INFINITY,y2:Number.NEGATIVE_INFINITY};for(let n=0;n<e.length;n++){const o=e[n];t=Sd(t,Ei({...o.computedPosition,...o.dimensions}))}return Nd(t)}function Si(e,t,n={x:0,y:0,zoom:1},o=!1,r=!1){const i={...Jt(t,n),width:t.width/n.zoom,height:t.height/n.zoom},s=[];for(const a of e){const{dimensions:l,selectable:c=!0,hidden:u=!1}=a,d=l.width??a.width??null,h=l.height??a.height??null;if(r&&!c||u)continue;const g=Dn(i,Pn(a)),b=d===null||h===null,S=o&&g>0,k=(d??0)*(h??0);(b||S||g>=k||a.dragging)&&s.push(a)}return s}function Ni(e,t){const n=new Set;if(typeof e=="string")n.add(e);else if(e.length>=1)for(const o of e)n.add(o.id);return t.filter(o=>n.has(o.source)||n.has(o.target))}function bt(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=Number.parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=Number.parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return on(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Cd(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=bt(e,n),r=bt(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=bt(e.top??e.y??0,n),r=bt(e.bottom??e.y??0,n),i=bt(e.left??e.x??0,t),s=bt(e.right??e.x??0,t);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function $d(e,t,n,o,r,i){const{x:s,y:a}=Qt(e,{x:t,y:n,zoom:o}),{x:l,y:c}=Qt({x:e.x+e.width,y:e.y+e.height},{x:t,y:n,zoom:o}),u=r-l,d=i-c;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(d)}}function ar(e,t,n,o,r,i=.1){const s=Cd(i,t,n),a=(t-s.x)/e.width,l=(n-s.y)/e.height,c=Math.min(a,l),u=_t(c,o,r),d=e.x+e.width/2,h=e.y+e.height/2,g=t/2-d*u,b=n/2-h*u,S=$d(e,g,b,u,t,n),k={left:Math.min(S.left-s.left,0),top:Math.min(S.top-s.top,0),right:Math.min(S.right-s.right,0),bottom:Math.min(S.bottom-s.bottom,0)};return{x:g-k.left+k.right,y:b-k.top+k.bottom,zoom:u}}function Md(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function Ci(e,t){if(!e.parentNode)return!1;const n=t.get(e.parentNode);return n?n.selected?!0:Ci(n,t):!1}function en(e,t){return typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`}function lr(e){const t=e.ctrlKey&&zn()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t}function ur(e,t,n){return e<t?_t(Math.abs(e-t),1,t)/t:e>n?-_t(Math.abs(e-n),1,t)/t:0}function $i(e,t,n=15,o=40){const r=ur(e.x,o,t.width-o)*n,i=ur(e.y,o,t.height-o)*n;return[r,i]}function Qn(e,t){if(t){const n=e.position.x+e.dimensions.width-t.dimensions.width,o=e.position.y+e.dimensions.height-t.dimensions.height;if(n>0||o>0||e.position.x<0||e.position.y<0){let r={};if(typeof t.style=="function"?r={...t.style(t)}:t.style&&(r={...t.style}),r.width=r.width??`${t.dimensions.width}px`,r.height=r.height??`${t.dimensions.height}px`,n>0)if(typeof r.width=="string"){const i=Number(r.width.replace("px",""));r.width=`${i+n}px`}else r.width+=n;if(o>0)if(typeof r.height=="string"){const i=Number(r.height.replace("px",""));r.height=`${i+o}px`}else r.height+=o;if(e.position.x<0){const i=Math.abs(e.position.x);if(t.position.x=t.position.x-i,typeof r.width=="string"){const s=Number(r.width.replace("px",""));r.width=`${s+i}px`}else r.width+=i;e.position.x=0}if(e.position.y<0){const i=Math.abs(e.position.y);if(t.position.y=t.position.y-i,typeof r.height=="string"){const s=Number(r.height.replace("px",""));r.height=`${s+i}px`}else r.height+=i;e.position.y=0}t.dimensions.width=Number(r.width.toString().replace("px","")),t.dimensions.height=Number(r.height.toString().replace("px","")),typeof t.style=="function"?t.style=i=>{const s=t.style;return{...s(i),...r}}:t.style={...t.style,...r}}}}function cr(e,t){var n,o;const r=e.filter(s=>s.type==="add"||s.type==="remove");for(const s of r)if(s.type==="add")t.findIndex(l=>l.id===s.item.id)===-1&&t.push(s.item);else if(s.type==="remove"){const a=t.findIndex(l=>l.id===s.id);a!==-1&&t.splice(a,1)}const i=t.map(s=>s.id);for(const s of t)for(const a of e)if(a.id===s.id)switch(a.type){case"select":s.selected=a.selected;break;case"position":if(Ft(s)&&(typeof a.position<"u"&&(s.position=a.position),typeof a.dragging<"u"&&(s.dragging=a.dragging),s.expandParent&&s.parentNode)){const l=t[i.indexOf(s.parentNode)];l&&Ft(l)&&Qn(s,l)}break;case"dimensions":if(Ft(s)&&(typeof a.dimensions<"u"&&(s.dimensions=a.dimensions),typeof a.updateStyle<"u"&&a.updateStyle&&(s.style={...s.style||{},width:`${(n=a.dimensions)==null?void 0:n.width}px`,height:`${(o=a.dimensions)==null?void 0:o.height}px`}),typeof a.resizing<"u"&&(s.resizing=a.resizing),s.expandParent&&s.parentNode)){const l=t[i.indexOf(s.parentNode)];l&&Ft(l)&&(!!l.dimensions.width&&!!l.dimensions.height?Qn(s,l):nt(()=>{Qn(s,l)}))}break}return t}function at(e,t){return{id:e,type:"select",selected:t}}function dr(e){return{item:e,type:"add"}}function fr(e){return{id:e,type:"remove"}}function hr(e,t,n,o,r){return{id:e,source:t,target:n,sourceHandle:o||null,targetHandle:r||null,type:"remove"}}function lt(e,t=new Set,n=!1){const o=[];for(const[r,i]of e){const s=t.has(r);!(i.selected===void 0&&!s)&&i.selected!==s&&(n&&(i.selected=s),o.push(at(i.id,s)))}return o}const gr=()=>{};function re(e){const t=new Set;let n=gr,o=()=>!1;const r=()=>t.size>0||o(),i=h=>{n=h},s=()=>{n=gr},a=h=>{o=h},l=()=>{o=()=>!1},c=h=>{t.delete(h)};return{on:h=>{t.add(h);const g=()=>c(h);return Wt(g),{off:g}},off:c,trigger:h=>{const g=[n];return r()?g.push(...t):e&&g.push(e),Promise.allSettled(g.map(b=>b(h)))},hasListeners:r,listeners:t,setEmitter:i,removeEmitter:s,setHasEmitListeners:a,removeHasEmitListeners:l}}function pr(e,t,n){let o=e;do{if(o&&o.matches(t))return!0;if(o===n)return!1;o=o.parentElement}while(o);return!1}function Id(e,t,n,o){var r,i;const s=new Map;for(const[a,l]of e)(l.selected||l.id===o)&&(!l.parentNode||!Ci(l,e))&&(l.draggable||t&&typeof l.draggable>"u")&&e.get(a)&&s.set(a,{id:l.id,position:l.position||{x:0,y:0},distance:{x:n.x-((r=l.computedPosition)==null?void 0:r.x)||0,y:n.y-((i=l.computedPosition)==null?void 0:i.y)||0},from:{x:l.computedPosition.x,y:l.computedPosition.y},extent:l.extent,parentNode:l.parentNode,dimensions:{...l.dimensions},expandParent:l.expandParent});return Array.from(s.values())}function Jn({id:e,dragItems:t,findNode:n}){const o=[];for(const r of t){const i=n(r.id);i&&o.push(i)}return[e?o.find(r=>r.id===e):o[0],o]}function Mi(e){if(Array.isArray(e))switch(e.length){case 1:return[e[0],e[0],e[0],e[0]];case 2:return[e[0],e[1],e[0],e[1]];case 3:return[e[0],e[1],e[2],e[1]];case 4:return e;default:return[0,0,0,0]}return[e,e,e,e]}function Td(e,t,n){const[o,r,i,s]=typeof e!="string"?Mi(e.padding):[0,0,0,0];return n&&typeof n.computedPosition.x<"u"&&typeof n.computedPosition.y<"u"&&typeof n.dimensions.width<"u"&&typeof n.dimensions.height<"u"?[[n.computedPosition.x+s,n.computedPosition.y+o],[n.computedPosition.x+n.dimensions.width-r,n.computedPosition.y+n.dimensions.height-i]]:!1}function Od(e,t,n,o){let r=e.extent||n;if((r==="parent"||!Array.isArray(r)&&r?.range==="parent")&&!e.expandParent)if(e.parentNode&&o&&e.dimensions.width&&e.dimensions.height){const i=Td(r,e,o);i&&(r=i)}else t(new Ae(Pe.NODE_EXTENT_INVALID,e.id)),r=n;else if(Array.isArray(r)){const i=o?.computedPosition.x||0,s=o?.computedPosition.y||0;r=[[r[0][0]+i,r[0][1]+s],[r[1][0]+i,r[1][1]+s]]}else if(r!=="parent"&&r?.range&&Array.isArray(r.range)){const[i,s,a,l]=Mi(r.padding),c=o?.computedPosition.x||0,u=o?.computedPosition.y||0;r=[[r.range[0][0]+c+l,r.range[0][1]+u+i],[r.range[1][0]+c-s,r.range[1][1]+u-a]]}return r==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:r}function Pd({width:e,height:t},n){return[n[0],[n[1][0]-(e||0),n[1][1]-(t||0)]]}function Io(e,t,n,o,r){const i=Pd(e.dimensions,Od(e,n,o,r)),s=wi(t,i);return{position:{x:s.x-(r?.computedPosition.x||0),y:s.y-(r?.computedPosition.y||0)},computedPosition:s}}function Pt(e,t,n=ue.Left,o=!1){const r=(t?.x??0)+e.computedPosition.x,i=(t?.y??0)+e.computedPosition.y,{width:s,height:a}=t??Ld(e);if(o)return{x:r+s/2,y:i+a/2};switch(t?.position??n){case ue.Top:return{x:r+s/2,y:i};case ue.Right:return{x:r+s,y:i+a/2};case ue.Bottom:return{x:r+s/2,y:i+a};case ue.Left:return{x:r,y:i+a/2}}}function vr(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Dd({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:o,targetWidth:r,targetHeight:i,width:s,height:a,viewport:l}){const c={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+r),y2:Math.max(e.y+o,t.y+i)};c.x===c.x2&&(c.x2+=1),c.y===c.y2&&(c.y2+=1);const u=Ei({x:(0-l.x)/l.zoom,y:(0-l.y)/l.zoom,width:s/l.zoom,height:a/l.zoom}),d=Math.max(0,Math.min(u.x2,c.x2)-Math.max(u.x,c.x)),h=Math.max(0,Math.min(u.y2,c.y2)-Math.max(u.y,c.y));return Math.ceil(d*h)>0}function zd(e,t,n=!1){const o=typeof e.zIndex=="number";let r=o?e.zIndex:0;const i=t(e.source),s=t(e.target);return!i||!s?0:(n&&(r=o?e.zIndex:Math.max(i.computedPosition.z||0,s.computedPosition.z||0)),r)}var Pe=(e=>(e.MISSING_STYLES="MISSING_STYLES",e.MISSING_VIEWPORT_DIMENSIONS="MISSING_VIEWPORT_DIMENSIONS",e.NODE_INVALID="NODE_INVALID",e.NODE_NOT_FOUND="NODE_NOT_FOUND",e.NODE_MISSING_PARENT="NODE_MISSING_PARENT",e.NODE_TYPE_MISSING="NODE_TYPE_MISSING",e.NODE_EXTENT_INVALID="NODE_EXTENT_INVALID",e.EDGE_INVALID="EDGE_INVALID",e.EDGE_NOT_FOUND="EDGE_NOT_FOUND",e.EDGE_SOURCE_MISSING="EDGE_SOURCE_MISSING",e.EDGE_TARGET_MISSING="EDGE_TARGET_MISSING",e.EDGE_TYPE_MISSING="EDGE_TYPE_MISSING",e.EDGE_SOURCE_TARGET_SAME="EDGE_SOURCE_TARGET_SAME",e.EDGE_SOURCE_TARGET_MISSING="EDGE_SOURCE_TARGET_MISSING",e.EDGE_ORPHANED="EDGE_ORPHANED",e.USEVUEFLOW_OPTIONS="USEVUEFLOW_OPTIONS",e))(Pe||{});const mr={MISSING_STYLES:()=>"It seems that you haven't loaded the necessary styles. Please import '@vue-flow/core/dist/style.css' to ensure that the graph is rendered correctly",MISSING_VIEWPORT_DIMENSIONS:()=>"The Vue Flow parent container needs a width and a height to render the graph",NODE_INVALID:e=>`Node is invalid
8
+ Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found
9
+ Node: ${e}`,NODE_MISSING_PARENT:(e,t)=>`Node is missing a parent
10
+ Node: ${e}
11
+ Parent: ${t}`,NODE_TYPE_MISSING:e=>`Node type is missing
12
+ Type: ${e}`,NODE_EXTENT_INVALID:e=>`Only child nodes can use a parent extent
13
+ Node: ${e}`,EDGE_INVALID:e=>`An edge needs a source and a target
14
+ Edge: ${e}`,EDGE_SOURCE_MISSING:(e,t)=>`Edge source is missing
15
+ Edge: ${e}
16
+ Source: ${t}`,EDGE_TARGET_MISSING:(e,t)=>`Edge target is missing
17
+ Edge: ${e}
18
+ Target: ${t}`,EDGE_TYPE_MISSING:e=>`Edge type is missing
19
+ Type: ${e}`,EDGE_SOURCE_TARGET_SAME:(e,t,n)=>`Edge source and target are the same
20
+ Edge: ${e}
21
+ Source: ${t}
22
+ Target: ${n}`,EDGE_SOURCE_TARGET_MISSING:(e,t,n)=>`Edge source or target is missing
23
+ Edge: ${e}
24
+ Source: ${t}
25
+ Target: ${n}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed
26
+ Edge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found
27
+ Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead"};class Ae extends Error{constructor(t,...n){var o;super((o=mr[t])==null?void 0:o.call(mr,...n)),this.name="VueFlowError",this.code=t,this.args=n}}function To(e){return"clientX"in e}function Ad(e){return"sourceEvent"in e}function Ze(e,t){const n=To(e);let o,r;return n?(o=e.clientX,r=e.clientY):"touches"in e&&e.touches.length>0?(o=e.touches[0].clientX,r=e.touches[0].clientY):"changedTouches"in e&&e.changedTouches.length>0?(o=e.changedTouches[0].clientX,r=e.changedTouches[0].clientY):(o=0,r=0),{x:o-(t?.left??0),y:r-(t?.top??0)}}const zn=()=>{var e;return typeof navigator<"u"&&((e=navigator?.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Ld(e){var t,n;return{width:((t=e.dimensions)==null?void 0:t.width)??e.width??0,height:((n=e.dimensions)==null?void 0:n.height)??e.height??0}}function Hn(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}const Bd=()=>!0;function eo(e){e?.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function Vd(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())Dn(r,Pn(i))>0&&o.push(i);return o}const Rd=250;function Hd(e,t,n,o){var r,i;let s=[],a=Number.POSITIVE_INFINITY;const l=Vd(e,n,t+Rd);for(const c of l){const u=[...((r=c.handleBounds)==null?void 0:r.source)??[],...((i=c.handleBounds)==null?void 0:i.target)??[]];for(const d of u){if(o.nodeId===d.nodeId&&o.type===d.type&&o.id===d.id)continue;const{x:h,y:g}=Pt(c,d,d.position,!0),b=Math.sqrt((h-e.x)**2+(g-e.y)**2);b>t||(b<a?(s=[{...d,x:h,y:g}],a=b):b===a&&s.push({...d,x:h,y:g}))}}if(!s.length)return null;if(s.length>1){const c=o.type==="source"?"target":"source";return s.find(u=>u.type===c)??s[0]}return s[0]}function yr(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:l,isValidConnection:c=Bd},u,d,h,g){const b=i==="target",S=t?s.querySelector(`.${a}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:k,y:x}=Ze(e),_=s.elementFromPoint(k,x),p=_?.classList.contains(`${a}-flow__handle`)?_:S,y={handleDomNode:p,isValid:!1,connection:null,toHandle:null};if(p){const D=Ii(void 0,p),R=p.getAttribute("data-nodeid"),Y=p.getAttribute("data-handleid"),H=p.classList.contains("connectable"),Q=p.classList.contains("connectableend");if(!R||!D)return y;const O={source:b?R:o,sourceHandle:b?Y:r,target:b?o:R,targetHandle:b?r:Y};y.connection=O;const E=H&&Q&&(n===dt.Strict?b&&D==="source"||!b&&D==="target":R!==o||Y!==r);y.isValid=E&&c(O,{nodes:d,edges:u,sourceNode:h(O.source),targetNode:h(O.target)}),y.toHandle=Ti(R,D,Y,g,n,!0)}return y}function Ii(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function Fd(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function Gd(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function Ti(e,t,n,o,r,i=!1){var s,a,l;const c=o.get(e);if(!c)return null;const u=r===dt.Strict?(s=c.handleBounds)==null?void 0:s[t]:[...((a=c.handleBounds)==null?void 0:a.source)??[],...((l=c.handleBounds)==null?void 0:l.target)??[]],d=(n?u?.find(h=>h.id===n):u?.[0])??null;return d&&i?{...d,...Pt(c,d,d.position,!0)}:d}const mo={[ue.Left]:ue.Right,[ue.Right]:ue.Left,[ue.Top]:ue.Bottom,[ue.Bottom]:ue.Top},Yd=["production","prod"];function on(e,...t){Oi()&&console.warn(`[Vue Flow]: ${e}`,...t)}function Oi(){return!Yd.includes("production")}function wr(e,t,n,o,r){const i=t.querySelectorAll(`.vue-flow__handle.${e}`);return i?.length?Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:r,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...Rn(s)}}):null}function yo(e,t,n,o,r,i=!1,s){r.value=!1,e.selected?(i||e.selected&&t)&&(o([e]),nt(()=>{s.blur()})):n([e])}function Oe(e){return typeof $(e)<"u"}function jd(e,t,n,o){if(!e||!e.source||!e.target)return n(new Ae(Pe.EDGE_INVALID,e?.id??"[ID UNKNOWN]")),!1;let r;return ft(e)?r=e:r={...e,id:bi(e)},r=_i(r,void 0,o),kd(r,t)?!1:r}function Xd(e,t,n,o,r){if(!t.source||!t.target)return r(new Ae(Pe.EDGE_INVALID,e.id)),!1;if(!n)return r(new Ae(Pe.EDGE_NOT_FOUND,e.id)),!1;const{id:i,...s}=e;return{...s,id:o?bi(t):i,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function _r(e,t,n){const o={},r=[];for(let i=0;i<e.length;++i){const s=e[i];if(!mt(s)){n(new Ae(Pe.NODE_INVALID,s?.id)||`[ID UNKNOWN|INDEX ${i}]`);continue}const a=xd(s,t(s.id),s.parentNode);s.parentNode&&(o[s.parentNode]=!0),r[i]=a}for(const i of r){const s=t(i.parentNode)||r.find(a=>a.id===i.parentNode);i.parentNode&&!s&&n(new Ae(Pe.NODE_MISSING_PARENT,i.id,i.parentNode)),(i.parentNode||o[i.id])&&(o[i.id]&&(i.isParent=!0),s&&(s.isParent=!0))}return r}function xr(e,t,n,o,r,i){let s=r;const a=o.get(s)||new Map;o.set(s,a.set(n,t)),s=`${r}-${e}`;const l=o.get(s)||new Map;if(o.set(s,l.set(n,t)),i){s=`${r}-${e}-${i}`;const c=o.get(s)||new Map;o.set(s,c.set(n,t))}}function to(e,t,n){e.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,l={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},c=`${r}-${s}--${i}-${a}`,u=`${i}-${a}--${r}-${s}`;xr("source",l,u,e,r,s),xr("target",l,c,e,i,a)}}function br(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function no(e,t,n,o,r,i,s,a){const l=[];for(const c of e){const u=ft(c)?c:jd(c,a,r,i);if(!u)continue;const d=n(u.source),h=n(u.target);if(!d||!h){r(new Ae(Pe.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!d){r(new Ae(Pe.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!h){r(new Ae(Pe.EDGE_TARGET_MISSING,u.id,u.target));continue}if(t&&!t(u,{edges:a,nodes:s,sourceNode:d,targetNode:h})){r(new Ae(Pe.EDGE_INVALID,u.id));continue}const g=o(u.id);l.push({..._i(u,g,i),sourceNode:d,targetNode:h})}return l}const Er=Symbol("vueFlow"),Pi=Symbol("nodeId"),Di=Symbol("nodeRef"),Wd=Symbol("edgeId"),Ud=Symbol("edgeRef"),Fn=Symbol("slots");function zi(e){const{vueFlowRef:t,snapToGrid:n,snapGrid:o,noDragClassName:r,nodeLookup:i,nodeExtent:s,nodeDragThreshold:a,viewport:l,autoPanOnNodeDrag:c,autoPanSpeed:u,nodesDraggable:d,panBy:h,findNode:g,multiSelectionActive:b,nodesSelectionActive:S,selectNodesOnDrag:k,removeSelectedElements:x,addSelectedNodes:_,updateNodePositions:p,emits:y}=Me(),{onStart:D,onDrag:R,onStop:Y,onClick:H,el:Q,disabled:O,id:A,selectable:E,dragHandle:M}=e,f=ut(!1);let w=[],v,C=null,z={x:void 0,y:void 0},F={x:0,y:0},B=null,G=!1,U=!1,K=0,T=!1;const m=Kd(),I=({x:ae,y:ge})=>{z={x:ae,y:ge};let P=!1;if(w=w.map(N=>{const V={x:ae-N.distance.x,y:ge-N.distance.y},{computedPosition:W}=Io(N,n.value?Hn(V,o.value):V,y.error,s.value,N.parentNode?g(N.parentNode):void 0);return P=P||N.position.x!==W.x||N.position.y!==W.y,N.position=W,N}),U=U||P,!!P&&(p(w,!0,!0),f.value=!0,B)){const[N,V]=Jn({id:A,dragItems:w,findNode:g});R({event:B,node:N,nodes:V})}},L=()=>{if(!C)return;const[ae,ge]=$i(F,C,u.value);if(ae!==0||ge!==0){const P={x:(z.x??0)-ae/l.value.zoom,y:(z.y??0)-ge/l.value.zoom};h({x:ae,y:ge})&&I(P)}K=requestAnimationFrame(L)},X=(ae,ge)=>{G=!0;const P=g(A);!k.value&&!b.value&&P&&(P.selected||x()),P&&_e(E)&&k.value&&yo(P,b.value,_,x,S,!1,ge);const N=m(ae.sourceEvent);if(z=N,w=Id(i.value,d.value,N,A),w.length){const[V,W]=Jn({id:A,dragItems:w,findNode:g});D({event:ae.sourceEvent,node:V,nodes:W})}},J=(ae,ge)=>{var P;ae.sourceEvent.type==="touchmove"&&ae.sourceEvent.touches.length>1||(U=!1,a.value===0&&X(ae,ge),z=m(ae.sourceEvent),C=((P=t.value)==null?void 0:P.getBoundingClientRect())||null,F=Ze(ae.sourceEvent,C))},te=(ae,ge)=>{const P=m(ae.sourceEvent);if(!T&&G&&c.value&&(T=!0,L()),!G){const N=P.xSnapped-(z.x??0),V=P.ySnapped-(z.y??0);Math.sqrt(N*N+V*V)>a.value&&X(ae,ge)}(z.x!==P.xSnapped||z.y!==P.ySnapped)&&w.length&&G&&(B=ae.sourceEvent,F=Ze(ae.sourceEvent,C),I(P))},ne=ae=>{let ge=!1;if(!G&&!f.value&&!b.value){const P=ae.sourceEvent,N=m(P),V=N.xSnapped-(z.x??0),W=N.ySnapped-(z.y??0),j=Math.sqrt(V*V+W*W);j!==0&&j<=a.value&&(H?.(P),ge=!0)}if(w.length&&!ge){U&&(p(w,!1,!1),U=!1);const[P,N]=Jn({id:A,dragItems:w,findNode:g});Y({event:ae.sourceEvent,node:P,nodes:N})}w=[],f.value=!1,T=!1,G=!1,z={x:void 0,y:void 0},cancelAnimationFrame(K)};return ye([()=>_e(O),Q],([ae,ge],P,N)=>{if(ge){const V=Fe(ge);ae||(v=_u().on("start",W=>J(W,ge)).on("drag",W=>te(W,ge)).on("end",W=>ne(W)).filter(W=>{const j=W.target,se=_e(M);return!W.button&&(!r.value||!pr(j,`.${r.value}`,ge)&&(!se||pr(j,se,ge)))}),V.call(v)),N(()=>{V.on(".drag",null),v&&(v.on("start",null),v.on("drag",null),v.on("end",null))})}}),f}function Zd(){return{doubleClick:re(),click:re(),mouseEnter:re(),mouseMove:re(),mouseLeave:re(),contextMenu:re(),updateStart:re(),update:re(),updateEnd:re()}}function qd(e,t){const n=Zd();return n.doubleClick.on(o=>{var r,i;t.edgeDoubleClick(o),(i=(r=e.events)==null?void 0:r.doubleClick)==null||i.call(r,o)}),n.click.on(o=>{var r,i;t.edgeClick(o),(i=(r=e.events)==null?void 0:r.click)==null||i.call(r,o)}),n.mouseEnter.on(o=>{var r,i;t.edgeMouseEnter(o),(i=(r=e.events)==null?void 0:r.mouseEnter)==null||i.call(r,o)}),n.mouseMove.on(o=>{var r,i;t.edgeMouseMove(o),(i=(r=e.events)==null?void 0:r.mouseMove)==null||i.call(r,o)}),n.mouseLeave.on(o=>{var r,i;t.edgeMouseLeave(o),(i=(r=e.events)==null?void 0:r.mouseLeave)==null||i.call(r,o)}),n.contextMenu.on(o=>{var r,i;t.edgeContextMenu(o),(i=(r=e.events)==null?void 0:r.contextMenu)==null||i.call(r,o)}),n.updateStart.on(o=>{var r,i;t.edgeUpdateStart(o),(i=(r=e.events)==null?void 0:r.updateStart)==null||i.call(r,o)}),n.update.on(o=>{var r,i;t.edgeUpdate(o),(i=(r=e.events)==null?void 0:r.update)==null||i.call(r,o)}),n.updateEnd.on(o=>{var r,i;t.edgeUpdateEnd(o),(i=(r=e.events)==null?void 0:r.updateEnd)==null||i.call(r,o)}),Object.entries(n).reduce((o,[r,i])=>(o.emit[r]=i.trigger,o.on[r]=i.on,o),{emit:{},on:{}})}function Kd(){const{viewport:e,snapGrid:t,snapToGrid:n,vueFlowRef:o}=Me();return r=>{var i;const s=((i=o.value)==null?void 0:i.getBoundingClientRect())??{left:0,top:0},a=Ad(r)?r.sourceEvent:r,{x:l,y:c}=Ze(a,s),u=Jt({x:l,y:c},e.value),{x:d,y:h}=n.value?Hn(u,t.value):u;return{xSnapped:d,ySnapped:h,...u}}}function dn(){return!0}function Ai({handleId:e,nodeId:t,type:n,isValidConnection:o,edgeUpdaterType:r,onEdgeUpdate:i,onEdgeUpdateEnd:s}){const{id:a,vueFlowRef:l,connectionMode:c,connectionRadius:u,connectOnClick:d,connectionClickStartHandle:h,nodesConnectable:g,autoPanOnConnect:b,autoPanSpeed:S,findNode:k,panBy:x,startConnection:_,updateConnection:p,endConnection:y,emits:D,viewport:R,edges:Y,nodes:H,isValidConnection:Q,nodeLookup:O}=Me();let A=null,E=!1,M=null;function f(v){var C;const z=_e(n)==="target",F=To(v),B=sr(v.target),G=v.currentTarget;if(G&&(F&&v.button===0||!F)){let U=function(ce){P=Ze(ce,ne),I=Hd(Jt(P,R.value,!1,[1,1]),u.value,O.value,W),N||(V(),N=!0);const pe=yr(ce,{handle:I,connectionMode:c.value,fromNodeId:_e(t),fromHandleId:_e(e),fromType:z?"target":"source",isValidConnection:m,doc:B,lib:"vue",flowId:a,nodeLookup:O.value},Y.value,H.value,k,O.value);M=pe.handleDomNode,A=pe.connection,E=Gd(!!I,pe.isValid);const we={...de,isValid:E,to:pe.toHandle&&E?Qt({x:pe.toHandle.x,y:pe.toHandle.y},R.value):P,toHandle:pe.toHandle,toPosition:E&&pe.toHandle?pe.toHandle.position:mo[W.position],toNode:pe.toHandle?O.value.get(pe.toHandle.nodeId):null};if(E&&I&&de?.toHandle&&we.toHandle&&de.toHandle.type===we.toHandle.type&&de.toHandle.nodeId===we.toHandle.nodeId&&de.toHandle.id===we.toHandle.id&&de.to.x===we.to.x&&de.to.y===we.to.y)return;const Ee=I??pe.toHandle;if(p(Ee&&E?Qt({x:Ee.x,y:Ee.y},R.value):P,Ee,Fd(!!Ee,E)),de=we,!I&&!E&&!M)return eo(ge);A&&A.source!==A.target&&M&&(eo(ge),ge=M,M.classList.add("connecting","vue-flow__handle-connecting"),M.classList.toggle("valid",!!E),M.classList.toggle("vue-flow__handle-valid",!!E))},K=function(ce){"touches"in ce&&ce.touches.length>0||((I||M)&&A&&E&&(i?i(ce,A):D.connect(A)),D.connectEnd(ce),r&&s?.(ce),eo(ge),cancelAnimationFrame(L),y(ce),N=!1,E=!1,A=null,M=null,B.removeEventListener("mousemove",U),B.removeEventListener("mouseup",K),B.removeEventListener("touchmove",U),B.removeEventListener("touchend",K))};const T=k(_e(t));let m=_e(o)||Q.value||dn;!m&&T&&(m=(z?T.isValidSourcePos:T.isValidTargetPos)||dn);let I,L=0;const{x:X,y:J}=Ze(v),te=Ii(_e(r),G),ne=(C=l.value)==null?void 0:C.getBoundingClientRect();if(!ne||!te)return;const ae=Ti(_e(t),te,_e(e),O.value,c.value);if(!ae)return;let ge,P=Ze(v,ne),N=!1;const V=()=>{if(!b.value)return;const[ce,pe]=$i(P,ne,S.value);x({x:ce,y:pe}),L=requestAnimationFrame(V)},W={...ae,nodeId:_e(t),type:te,position:ae.position},j=O.value.get(_e(t)),le={inProgress:!0,isValid:null,from:Pt(j,W,ue.Left,!0),fromHandle:W,fromPosition:W.position,fromNode:j,to:P,toHandle:null,toPosition:mo[W.position],toNode:null};_({nodeId:_e(t),id:_e(e),type:te,position:G?.getAttribute("data-handlepos")||ue.Top,...P},{x:X-ne.left,y:J-ne.top}),D.connectStart({event:v,nodeId:_e(t),handleId:_e(e),handleType:te});let de=le;B.addEventListener("mousemove",U),B.addEventListener("mouseup",K),B.addEventListener("touchmove",U),B.addEventListener("touchend",K)}}function w(v){var C,z;if(!d.value)return;const F=_e(n)==="target";if(!h.value){D.clickConnectStart({event:v,nodeId:_e(t),handleId:_e(e)}),_({nodeId:_e(t),type:_e(n),id:_e(e),position:ue.Top,...Ze(v)},void 0,!0);return}let B=_e(o)||Q.value||dn;const G=k(_e(t));if(!B&&G&&(B=(F?G.isValidSourcePos:G.isValidTargetPos)||dn),G&&(typeof G.connectable>"u"?g.value:G.connectable)===!1)return;const U=sr(v.target),K=yr(v,{handle:{nodeId:_e(t),id:_e(e),type:_e(n),position:ue.Top,...Ze(v)},connectionMode:c.value,fromNodeId:h.value.nodeId,fromHandleId:h.value.id??null,fromType:h.value.type,isValidConnection:B,doc:U,lib:"vue",flowId:a,nodeLookup:O.value},Y.value,H.value,k,O.value),T=((C=K.connection)==null?void 0:C.source)===((z=K.connection)==null?void 0:z.target);K.isValid&&K.connection&&!T&&D.connect(K.connection),D.clickConnectEnd(v),y(v,!0)}return{handlePointerDown:f,handleClick:w}}function Qd(){return zt(Pi,"")}function Li(e){const t=e??Qd()??"",n=zt(Di,ve(null)),{findNode:o,edges:r,emits:i}=Me(),s=o(t);return s||i.error(new Ae(Pe.NODE_NOT_FOUND,t)),{id:t,nodeEl:n,node:s,parentNode:ie(()=>o(s.parentNode)),connectedEdges:ie(()=>Ni([s],r.value))}}function Jd(){return{doubleClick:re(),click:re(),mouseEnter:re(),mouseMove:re(),mouseLeave:re(),contextMenu:re(),dragStart:re(),drag:re(),dragStop:re()}}function ef(e,t){const n=Jd();return n.doubleClick.on(o=>{var r,i;t.nodeDoubleClick(o),(i=(r=e.events)==null?void 0:r.doubleClick)==null||i.call(r,o)}),n.click.on(o=>{var r,i;t.nodeClick(o),(i=(r=e.events)==null?void 0:r.click)==null||i.call(r,o)}),n.mouseEnter.on(o=>{var r,i;t.nodeMouseEnter(o),(i=(r=e.events)==null?void 0:r.mouseEnter)==null||i.call(r,o)}),n.mouseMove.on(o=>{var r,i;t.nodeMouseMove(o),(i=(r=e.events)==null?void 0:r.mouseMove)==null||i.call(r,o)}),n.mouseLeave.on(o=>{var r,i;t.nodeMouseLeave(o),(i=(r=e.events)==null?void 0:r.mouseLeave)==null||i.call(r,o)}),n.contextMenu.on(o=>{var r,i;t.nodeContextMenu(o),(i=(r=e.events)==null?void 0:r.contextMenu)==null||i.call(r,o)}),n.dragStart.on(o=>{var r,i;t.nodeDragStart(o),(i=(r=e.events)==null?void 0:r.dragStart)==null||i.call(r,o)}),n.drag.on(o=>{var r,i;t.nodeDrag(o),(i=(r=e.events)==null?void 0:r.drag)==null||i.call(r,o)}),n.dragStop.on(o=>{var r,i;t.nodeDragStop(o),(i=(r=e.events)==null?void 0:r.dragStop)==null||i.call(r,o)}),Object.entries(n).reduce((o,[r,i])=>(o.emit[r]=i.trigger,o.on[r]=i.on,o),{emit:{},on:{}})}function Bi(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:n,findNode:o,snapGrid:r,snapToGrid:i,nodesDraggable:s,emits:a}=Me();return(l,c=!1)=>{const u=i.value?r.value[0]:5,d=i.value?r.value[1]:5,h=c?4:1,g=l.x*u*h,b=l.y*d*h,S=[];for(const k of e.value)if(k.draggable||s&&typeof k.draggable>"u"){const x={x:k.computedPosition.x+g,y:k.computedPosition.y+b},{position:_}=Io(k,x,a.error,t.value,k.parentNode?o(k.parentNode):void 0);S.push({id:k.id,position:_,from:k.position,distance:{x:l.x,y:l.y},dimensions:k.dimensions})}n(S,!0,!1)}}const fn=.1,tf=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function st(){return on("Viewport not initialized yet."),Promise.resolve(!1)}const nf={zoomIn:st,zoomOut:st,zoomTo:st,fitView:st,setCenter:st,fitBounds:st,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:st,setTransform:st,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function of(e){function t(o,r){return new Promise(i=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate(r?.interpolate==="linear"?Yt:yn).scaleBy(oo(e.d3Selection,r?.duration,r?.ease,()=>{i(!0)}),o):i(!1)})}function n(o,r,i,s){return new Promise(a=>{var l;const{x:c,y:u}=wi({x:-o,y:-r},e.translateExtent),d=Ot.translate(-c,-u).scale(i);e.d3Selection&&e.d3Zoom?(l=e.d3Zoom)==null||l.interpolate(s?.interpolate==="linear"?Yt:yn).transform(oo(e.d3Selection,s?.duration,s?.ease,()=>{a(!0)}),d):a(!1)})}return ie(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:r=>t(1.2,r),zoomOut:r=>t(1/1.2,r),zoomTo:(r,i)=>new Promise(s=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate(i?.interpolate==="linear"?Yt:yn).scaleTo(oo(e.d3Selection,i?.duration,i?.ease,()=>{s(!0)}),r):s(!1)}),setViewport:(r,i)=>n(r.x,r.y,r.zoom,i),setTransform:(r,i)=>n(r.x,r.y,r.zoom,i),getViewport:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),getTransform:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),fitView:(r={padding:fn,includeHiddenNodes:!1,duration:0})=>{var i,s;const a=[];for(const h of e.nodes)h.dimensions.width&&h.dimensions.height&&(r?.includeHiddenNodes||!h.hidden)&&(!((i=r.nodes)!=null&&i.length)||(s=r.nodes)!=null&&s.length&&r.nodes.includes(h.id))&&a.push(h);if(!a.length)return Promise.resolve(!1);const l=ki(a),{x:c,y:u,zoom:d}=ar(l,e.dimensions.width,e.dimensions.height,r.minZoom??e.minZoom,r.maxZoom??e.maxZoom,r.padding??fn);return n(c,u,d,r)},setCenter:(r,i,s)=>{const a=typeof s?.zoom<"u"?s.zoom:e.maxZoom,l=e.dimensions.width/2-r*a,c=e.dimensions.height/2-i*a;return n(l,c,a,s)},fitBounds:(r,i={padding:fn})=>{const{x:s,y:a,zoom:l}=ar(r,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,i.padding??fn);return n(s,a,l,i)},project:r=>Jt(r,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:r=>{if(e.vueFlowRef){const{x:i,y:s}=e.vueFlowRef.getBoundingClientRect(),a={x:r.x-i,y:r.y-s};return Jt(a,e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:r=>{if(e.vueFlowRef){const{x:i,y:s}=e.vueFlowRef.getBoundingClientRect(),a={x:r.x+i,y:r.y+s};return Qt(a,e.viewport)}return{x:0,y:0}}}:nf)}function oo(e,t=0,n=tf,o=()=>{}){const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e}function rf(e,t,n){const o=Pr(!0);return o.run(()=>{const r=()=>{o.run(()=>{let S,k,x=!!(n.nodes.value.length||n.edges.value.length);S=xt([e.modelValue,()=>{var _,p;return(p=(_=e.modelValue)==null?void 0:_.value)==null?void 0:p.length}],([_])=>{_&&Array.isArray(_)&&(k?.pause(),n.setElements(_),!k&&!x&&_.length?x=!0:k?.resume())}),k=xt([n.nodes,n.edges,()=>n.edges.value.length,()=>n.nodes.value.length],([_,p])=>{var y;(y=e.modelValue)!=null&&y.value&&Array.isArray(e.modelValue.value)&&(S?.pause(),e.modelValue.value=[..._,...p],nt(()=>{S?.resume()}))},{immediate:x}),pn(()=>{S?.stop(),k?.stop()})})},i=()=>{o.run(()=>{let S,k,x=!!n.nodes.value.length;S=xt([e.nodes,()=>{var _,p;return(p=(_=e.nodes)==null?void 0:_.value)==null?void 0:p.length}],([_])=>{_&&Array.isArray(_)&&(k?.pause(),n.setNodes(_),!k&&!x&&_.length?x=!0:k?.resume())}),k=xt([n.nodes,()=>n.nodes.value.length],([_])=>{var p;(p=e.nodes)!=null&&p.value&&Array.isArray(e.nodes.value)&&(S?.pause(),e.nodes.value=[..._],nt(()=>{S?.resume()}))},{immediate:x}),pn(()=>{S?.stop(),k?.stop()})})},s=()=>{o.run(()=>{let S,k,x=!!n.edges.value.length;S=xt([e.edges,()=>{var _,p;return(p=(_=e.edges)==null?void 0:_.value)==null?void 0:p.length}],([_])=>{_&&Array.isArray(_)&&(k?.pause(),n.setEdges(_),!k&&!x&&_.length?x=!0:k?.resume())}),k=xt([n.edges,()=>n.edges.value.length],([_])=>{var p;(p=e.edges)!=null&&p.value&&Array.isArray(e.edges.value)&&(S?.pause(),e.edges.value=[..._],nt(()=>{S?.resume()}))},{immediate:x}),pn(()=>{S?.stop(),k?.stop()})})},a=()=>{o.run(()=>{ye(()=>t.maxZoom,()=>{t.maxZoom&&Oe(t.maxZoom)&&n.setMaxZoom(t.maxZoom)},{immediate:!0})})},l=()=>{o.run(()=>{ye(()=>t.minZoom,()=>{t.minZoom&&Oe(t.minZoom)&&n.setMinZoom(t.minZoom)},{immediate:!0})})},c=()=>{o.run(()=>{ye(()=>t.translateExtent,()=>{t.translateExtent&&Oe(t.translateExtent)&&n.setTranslateExtent(t.translateExtent)},{immediate:!0})})},u=()=>{o.run(()=>{ye(()=>t.nodeExtent,()=>{t.nodeExtent&&Oe(t.nodeExtent)&&n.setNodeExtent(t.nodeExtent)},{immediate:!0})})},d=()=>{o.run(()=>{ye(()=>t.applyDefault,()=>{Oe(t.applyDefault)&&(n.applyDefault.value=t.applyDefault)},{immediate:!0})})},h=()=>{o.run(()=>{const S=async k=>{let x=k;typeof t.autoConnect=="function"&&(x=await t.autoConnect(k)),x!==!1&&n.addEdges([x])};ye(()=>t.autoConnect,()=>{Oe(t.autoConnect)&&(n.autoConnect.value=t.autoConnect)},{immediate:!0}),ye(n.autoConnect,(k,x,_)=>{k?n.onConnect(S):n.hooks.value.connect.off(S),_(()=>{n.hooks.value.connect.off(S)})},{immediate:!0})})},g=()=>{const S=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const k of Object.keys(t)){const x=k;if(!S.includes(x)){const _=Ce(()=>t[x]),p=n[x];_o(p)&&o.run(()=>{ye(_,y=>{Oe(y)&&(p.value=y)},{immediate:!0})})}}};r(),i(),s(),l(),a(),c(),u(),d(),h(),g()}),()=>o.stop()}function sf(){return{edgesChange:re(),nodesChange:re(),nodeDoubleClick:re(),nodeClick:re(),nodeMouseEnter:re(),nodeMouseMove:re(),nodeMouseLeave:re(),nodeContextMenu:re(),nodeDragStart:re(),nodeDrag:re(),nodeDragStop:re(),nodesInitialized:re(),miniMapNodeClick:re(),miniMapNodeDoubleClick:re(),miniMapNodeMouseEnter:re(),miniMapNodeMouseMove:re(),miniMapNodeMouseLeave:re(),connect:re(),connectStart:re(),connectEnd:re(),clickConnectStart:re(),clickConnectEnd:re(),paneReady:re(),init:re(),move:re(),moveStart:re(),moveEnd:re(),selectionDragStart:re(),selectionDrag:re(),selectionDragStop:re(),selectionContextMenu:re(),selectionStart:re(),selectionEnd:re(),viewportChangeStart:re(),viewportChange:re(),viewportChangeEnd:re(),paneScroll:re(),paneClick:re(),paneContextMenu:re(),paneMouseEnter:re(),paneMouseMove:re(),paneMouseLeave:re(),edgeContextMenu:re(),edgeMouseEnter:re(),edgeMouseMove:re(),edgeMouseLeave:re(),edgeDoubleClick:re(),edgeClick:re(),edgeUpdateStart:re(),edgeUpdate:re(),edgeUpdateEnd:re(),updateNodeInternals:re(),error:re(e=>on(e.message))}}function af(e,t){const n=At();os(()=>{for(const[r,i]of Object.entries(t.value)){const s=a=>{e(r,a)};i.setEmitter(s),Wt(i.removeEmitter),i.setHasEmitListeners(()=>o(r)),Wt(i.removeHasEmitListeners)}});function o(r){var i;const s=lf(r);return!!((i=n?.vnode.props)==null?void 0:i[s])}}function lf(e){const[t,...n]=e.split(":");return`on${t.replace(/(?:^|-)(\w)/g,(r,i)=>i.toUpperCase())}${n.length?`:${n.join(":")}`:""}`}function Vi(){return{vueFlowRef:null,viewportRef:null,nodes:[],edges:[],connectionLookup:new Map,nodeTypes:{},edgeTypes:{},initialized:!1,dimensions:{width:0,height:0},viewport:{x:0,y:0,zoom:1},d3Zoom:null,d3Selection:null,d3ZoomHandler:null,minZoom:.5,maxZoom:2,translateExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],nodeExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],selectionMode:Mo.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:jt.Free,paneClickDistance:0,panOnDrag:!0,edgeUpdaterRadius:10,onlyRenderVisibleElements:!1,defaultViewport:{x:0,y:0,zoom:1},nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,defaultMarkerColor:"#b1b1b7",connectionLineStyle:{},connectionLineType:null,connectionLineOptions:{type:ht.Bezier,style:{}},connectionMode:dt.Loose,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectionPosition:{x:Number.NaN,y:Number.NaN},connectionRadius:20,connectOnClick:!0,connectionStatus:null,isValidConnection:null,snapGrid:[15,15],snapToGrid:!1,edgesUpdatable:!1,edgesFocusable:!0,nodesFocusable:!0,nodesConnectable:!0,nodesDraggable:!0,nodeDragThreshold:1,elementsSelectable:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,selectionKeyCode:"Shift",multiSelectionKeyCode:zn()?"Meta":"Control",zoomActivationKeyCode:zn()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:sf(),applyDefault:!0,autoConnect:!1,fitViewOnInit:!1,fitViewOnInitDone:!1,noDragClassName:"nodrag",noWheelClassName:"nowheel",noPanClassName:"nopan",defaultEdgeOptions:void 0,elevateEdgesOnSelect:!1,elevateNodesOnSelect:!0,autoPanOnNodeDrag:!0,autoPanOnConnect:!0,autoPanSpeed:15,disableKeyboardA11y:!1,ariaLiveMessage:""}}const uf=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function cf(e,t,n){const o=of(e),r=P=>{const N=P??[];e.hooks.updateNodeInternals.trigger(N)},i=P=>Ed(P,e.nodes,e.edges),s=P=>bd(P,e.nodes,e.edges),a=P=>Ni(P,e.edges),l=({id:P,type:N,nodeId:V})=>{var W;const j=P?`-${N}-${P}`:`-${N}`;return Array.from(((W=e.connectionLookup.get(`${V}${j}`))==null?void 0:W.values())??[])},c=P=>{if(P)return t.value.get(P)},u=P=>{if(P)return n.value.get(P)},d=(P,N,V)=>{var W,j;const se=[];for(const le of P){const de={id:le.id,type:"position",dragging:V,from:le.from};if(N&&(de.position=le.position,le.parentNode)){const ce=c(le.parentNode);de.position={x:de.position.x-(((W=ce?.computedPosition)==null?void 0:W.x)??0),y:de.position.y-(((j=ce?.computedPosition)==null?void 0:j.y)??0)}}se.push(de)}se?.length&&e.hooks.nodesChange.trigger(se)},h=P=>{if(!e.vueFlowRef)return;const N=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!N)return;const V=window.getComputedStyle(N),{m22:W}=new window.DOMMatrixReadOnly(V.transform),j=[];for(const se of P){const le=se,de=c(le.id);if(de){const ce=Rn(le.nodeElement);if(!!(ce.width&&ce.height&&(de.dimensions.width!==ce.width||de.dimensions.height!==ce.height||le.forceUpdate))){const we=le.nodeElement.getBoundingClientRect();de.dimensions=ce,de.handleBounds.source=wr("source",le.nodeElement,we,W,de.id),de.handleBounds.target=wr("target",le.nodeElement,we,W,de.id),j.push({id:de.id,type:"dimensions",dimensions:ce})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&o.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),j.length&&e.hooks.nodesChange.trigger(j)},g=(P,N)=>{const V=new Set,W=new Set;for(const le of P)mt(le)?V.add(le.id):ft(le)&&W.add(le.id);const j=lt(t.value,V,!0),se=lt(n.value,W);if(e.multiSelectionActive){for(const le of V)j.push(at(le,N));for(const le of W)se.push(at(le,N))}j.length&&e.hooks.nodesChange.trigger(j),se.length&&e.hooks.edgesChange.trigger(se)},b=P=>{if(e.multiSelectionActive){const N=P.map(V=>at(V.id,!0));e.hooks.nodesChange.trigger(N);return}e.hooks.nodesChange.trigger(lt(t.value,new Set(P.map(N=>N.id)),!0)),e.hooks.edgesChange.trigger(lt(n.value))},S=P=>{if(e.multiSelectionActive){const N=P.map(V=>at(V.id,!0));e.hooks.edgesChange.trigger(N);return}e.hooks.edgesChange.trigger(lt(n.value,new Set(P.map(N=>N.id)))),e.hooks.nodesChange.trigger(lt(t.value,new Set,!0))},k=P=>{g(P,!0)},x=P=>{const V=(P||e.nodes).map(W=>(W.selected=!1,at(W.id,!1)));e.hooks.nodesChange.trigger(V)},_=P=>{const V=(P||e.edges).map(W=>(W.selected=!1,at(W.id,!1)));e.hooks.edgesChange.trigger(V)},p=P=>{if(!P||!P.length)return g([],!1);const N=P.reduce((V,W)=>{const j=at(W.id,!1);return mt(W)?V.nodes.push(j):V.edges.push(j),V},{nodes:[],edges:[]});N.nodes.length&&e.hooks.nodesChange.trigger(N.nodes),N.edges.length&&e.hooks.edgesChange.trigger(N.edges)},y=P=>{var N;(N=e.d3Zoom)==null||N.scaleExtent([P,e.maxZoom]),e.minZoom=P},D=P=>{var N;(N=e.d3Zoom)==null||N.scaleExtent([e.minZoom,P]),e.maxZoom=P},R=P=>{var N;(N=e.d3Zoom)==null||N.translateExtent(P),e.translateExtent=P},Y=P=>{e.nodeExtent=P,r()},H=P=>{var N;(N=e.d3Zoom)==null||N.clickDistance(P)},Q=P=>{e.nodesDraggable=P,e.nodesConnectable=P,e.elementsSelectable=P},O=P=>{const N=P instanceof Function?P(e.nodes):P;!e.initialized&&!N.length||(e.nodes=_r(N,c,e.hooks.error.trigger))},A=P=>{const N=P instanceof Function?P(e.edges):P;if(!e.initialized&&!N.length)return;const V=no(N,e.isValidConnection,c,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);to(e.connectionLookup,n.value,V),e.edges=V},E=P=>{const N=P instanceof Function?P([...e.nodes,...e.edges]):P;!e.initialized&&!N.length||(O(N.filter(mt)),A(N.filter(ft)))},M=P=>{let N=P instanceof Function?P(e.nodes):P;N=Array.isArray(N)?N:[N];const V=_r(N,c,e.hooks.error.trigger),W=[];for(const j of V)W.push(dr(j));W.length&&e.hooks.nodesChange.trigger(W)},f=P=>{let N=P instanceof Function?P(e.edges):P;N=Array.isArray(N)?N:[N];const V=no(N,e.isValidConnection,c,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),W=[];for(const j of V)W.push(dr(j));W.length&&e.hooks.edgesChange.trigger(W)},w=(P,N=!0,V=!1)=>{const W=P instanceof Function?P(e.nodes):P,j=Array.isArray(W)?W:[W],se=[],le=[];function de(pe){const we=a(pe);for(const Ee of we)(!Oe(Ee.deletable)||Ee.deletable)&&le.push(hr(Ee.id,Ee.source,Ee.target,Ee.sourceHandle,Ee.targetHandle))}function ce(pe){const we=[];for(const Ee of e.nodes)Ee.parentNode===pe&&we.push(Ee);if(we.length){for(const Ee of we)se.push(fr(Ee.id));N&&de(we);for(const Ee of we)ce(Ee.id)}}for(const pe of j){const we=typeof pe=="string"?c(pe):pe;we&&(Oe(we.deletable)&&!we.deletable||(se.push(fr(we.id)),N&&de([we]),V&&ce(we.id)))}le.length&&e.hooks.edgesChange.trigger(le),se.length&&e.hooks.nodesChange.trigger(se)},v=P=>{const N=P instanceof Function?P(e.edges):P,V=Array.isArray(N)?N:[N],W=[];for(const j of V){const se=typeof j=="string"?u(j):j;se&&(Oe(se.deletable)&&!se.deletable||W.push(hr(typeof j=="string"?j:j.id,se.source,se.target,se.sourceHandle,se.targetHandle)))}e.hooks.edgesChange.trigger(W)},C=(P,N,V=!0)=>{const W=u(P.id);if(!W)return!1;const j=e.edges.indexOf(W),se=Xd(P,N,W,V,e.hooks.error.trigger);if(se){const[le]=no([se],e.isValidConnection,c,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((de,ce)=>ce===j?le:de),to(e.connectionLookup,n.value,[le]),le}return!1},z=(P,N,V={replace:!1})=>{const W=u(P);if(!W)return;const j=typeof N=="function"?N(W):N;W.data=V.replace?j:{...W.data,...j}},F=P=>cr(P,e.nodes),B=P=>{const N=cr(P,e.edges);return to(e.connectionLookup,n.value,N),N},G=(P,N,V={replace:!1})=>{const W=c(P);if(!W)return;const j=typeof N=="function"?N(W):N;V.replace?e.nodes.splice(e.nodes.indexOf(W),1,j):Object.assign(W,j)},U=(P,N,V={replace:!1})=>{const W=c(P);if(!W)return;const j=typeof N=="function"?N(W):N;W.data=V.replace?j:{...W.data,...j}},K=(P,N,V=!1)=>{V?e.connectionClickStartHandle=P:e.connectionStartHandle=P,e.connectionEndHandle=null,e.connectionStatus=null,N&&(e.connectionPosition=N)},T=(P,N=null,V=null)=>{e.connectionStartHandle&&(e.connectionPosition=P,e.connectionEndHandle=N,e.connectionStatus=V)},m=(P,N)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,N?e.connectionClickStartHandle=null:e.connectionStartHandle=null},I=P=>{const N=_d(P),V=N?null:Ft(P)?P:c(P.id);return!N&&!V?[null,null,N]:[N?P:Pn(V),V,N]},L=(P,N=!0,V=e.nodes)=>{const[W,j,se]=I(P);if(!W)return[];const le=[];for(const de of V||e.nodes){if(!se&&(de.id===j.id||!de.computedPosition))continue;const ce=Pn(de),pe=Dn(ce,W);(N&&pe>0||pe>=ce.width*ce.height||pe>=Number(W.width)*Number(W.height))&&le.push(de)}return le},X=(P,N,V=!0)=>{const[W]=I(P);if(!W)return!1;const j=Dn(W,N);return V&&j>0||j>=Number(W.width)*Number(W.height)},J=P=>{const{viewport:N,dimensions:V,d3Zoom:W,d3Selection:j,translateExtent:se}=e;if(!W||!j||!P.x&&!P.y)return!1;const le=Ot.translate(N.x+P.x,N.y+P.y).scale(N.zoom),de=[[0,0],[V.width,V.height]],ce=W.constrain()(le,de,se),pe=e.viewport.x!==ce.x||e.viewport.y!==ce.y||e.viewport.zoom!==ce.k;return W.transform(j,ce),pe},te=P=>{const N=P instanceof Function?P(e):P,V=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];Oe(N.defaultEdgeOptions)&&(e.defaultEdgeOptions=N.defaultEdgeOptions);const W=N.modelValue||N.nodes||N.edges?[]:void 0;W&&(N.modelValue&&W.push(...N.modelValue),N.nodes&&W.push(...N.nodes),N.edges&&W.push(...N.edges),E(W));const j=()=>{Oe(N.maxZoom)&&D(N.maxZoom),Oe(N.minZoom)&&y(N.minZoom),Oe(N.translateExtent)&&R(N.translateExtent)};for(const se of Object.keys(N)){const le=se,de=N[le];![...uf,...V].includes(le)&&Oe(de)&&(e[le]=de)}so(()=>e.d3Zoom).not.toBeNull().then(j),e.initialized||(e.initialized=!0)};return{updateNodePositions:d,updateNodeDimensions:h,setElements:E,setNodes:O,setEdges:A,addNodes:M,addEdges:f,removeNodes:w,removeEdges:v,findNode:c,findEdge:u,updateEdge:C,updateEdgeData:z,updateNode:G,updateNodeData:U,applyEdgeChanges:B,applyNodeChanges:F,addSelectedElements:k,addSelectedNodes:b,addSelectedEdges:S,setMinZoom:y,setMaxZoom:D,setTranslateExtent:R,setNodeExtent:Y,setPaneClickDistance:H,removeSelectedElements:p,removeSelectedNodes:x,removeSelectedEdges:_,startConnection:K,updateConnection:T,endConnection:m,setInteractive:Q,setState:te,getIntersectingNodes:L,getIncomers:i,getOutgoers:s,getConnectedEdges:a,getHandleConnections:l,isNodeIntersecting:X,panBy:J,fitView:P=>o.value.fitView(P),zoomIn:P=>o.value.zoomIn(P),zoomOut:P=>o.value.zoomOut(P),zoomTo:(P,N)=>o.value.zoomTo(P,N),setViewport:(P,N)=>o.value.setViewport(P,N),setTransform:(P,N)=>o.value.setTransform(P,N),getViewport:()=>o.value.getViewport(),getTransform:()=>o.value.getTransform(),setCenter:(P,N,V)=>o.value.setCenter(P,N,V),fitBounds:(P,N)=>o.value.fitBounds(P,N),project:P=>o.value.project(P),screenToFlowCoordinate:P=>o.value.screenToFlowCoordinate(P),flowToScreenCoordinate:P=>o.value.flowToScreenCoordinate(P),toObject:()=>{const P=[],N=[];for(const V of e.nodes){const{computedPosition:W,handleBounds:j,selected:se,dimensions:le,isParent:de,resizing:ce,dragging:pe,events:we,...Ee}=V;P.push(Ee)}for(const V of e.edges){const{selected:W,sourceNode:j,targetNode:se,events:le,...de}=V;N.push(de)}return JSON.parse(JSON.stringify({nodes:P,edges:N,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:P=>new Promise(N=>{const{nodes:V,edges:W,position:j,zoom:se,viewport:le}=P;V&&O(V),W&&A(W);const[de,ce]=le?.x&&le?.y?[le.x,le.y]:j??[null,null];if(de&&ce){const pe=le?.zoom||se||e.viewport.zoom;return so(()=>o.value.viewportInitialized).toBe(!0).then(()=>{o.value.setViewport({x:de,y:ce,zoom:pe}).then(()=>{N(!0)})})}else N(!0)}),updateNodeInternals:r,viewportHelper:o,$reset:()=>{const P=Vi();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const N=Ot.translate(P.defaultViewport.x??0,P.defaultViewport.y??0).scale(_t(P.defaultViewport.zoom??1,P.minZoom,P.maxZoom)),V=e.viewportRef.getBoundingClientRect(),W=[[0,0],[V.width,V.height]],j=e.d3Zoom.constrain()(N,W,P.translateExtent);e.d3Zoom.transform(e.d3Selection,j)}te(P)},$destroy:()=>{}}}const df=["data-id","data-handleid","data-nodeid","data-handlepos"],ff={name:"Handle",compatConfig:{MODE:3}},Dt=xe({...ff,props:{id:{default:null},type:{},position:{default:()=>ue.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(e,{expose:t}){const n=ls(e,["position","connectable","connectableStart","connectableEnd","id"]),o=Ce(()=>n.type??"source"),r=Ce(()=>n.isValidConnection??null),{id:i,connectionStartHandle:s,connectionClickStartHandle:a,connectionEndHandle:l,vueFlowRef:c,nodesConnectable:u,noDragClassName:d,noPanClassName:h}=Me(),{id:g,node:b,nodeEl:S,connectedEdges:k}=Li(),x=ve(),_=Ce(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),p=Ce(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),y=Ce(()=>{var A,E,M,f,w,v;return((A=s.value)==null?void 0:A.nodeId)===g&&((E=s.value)==null?void 0:E.id)===e.id&&((M=s.value)==null?void 0:M.type)===o.value||((f=l.value)==null?void 0:f.nodeId)===g&&((w=l.value)==null?void 0:w.id)===e.id&&((v=l.value)==null?void 0:v.type)===o.value}),D=Ce(()=>{var A,E,M;return((A=a.value)==null?void 0:A.nodeId)===g&&((E=a.value)==null?void 0:E.id)===e.id&&((M=a.value)==null?void 0:M.type)===o.value}),{handlePointerDown:R,handleClick:Y}=Ai({nodeId:g,handleId:e.id,isValidConnection:r,type:o}),H=ie(()=>typeof e.connectable=="string"&&e.connectable==="single"?!k.value.some(A=>{const E=A[`${o.value}Handle`];return A[o.value]!==g?!1:E?E===e.id:!0}):typeof e.connectable=="number"?k.value.filter(A=>{const E=A[`${o.value}Handle`];return A[o.value]!==g?!1:E?E===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(b,k.value):Oe(e.connectable)?e.connectable:u.value);rt(()=>{var A;if(!b.dimensions.width||!b.dimensions.height)return;const E=(A=b.handleBounds[o.value])==null?void 0:A.find(F=>F.id===e.id);if(!c.value||E)return;const M=c.value.querySelector(".vue-flow__transformationpane");if(!S.value||!x.value||!M||!e.id)return;const f=S.value.getBoundingClientRect(),w=x.value.getBoundingClientRect(),v=window.getComputedStyle(M),{m22:C}=new window.DOMMatrixReadOnly(v.transform),z={id:e.id,position:e.position,x:(w.left-f.left)/C,y:(w.top-f.top)/C,type:o.value,nodeId:g,...Rn(x.value)};b.handleBounds[o.value]=[...b.handleBounds[o.value]??[],z]});function Q(A){const E=To(A);H.value&&_.value&&(E&&A.button===0||!E)&&R(A)}function O(A){!g||!a.value&&!_.value||H.value&&Y(A)}return t({handleClick:Y,handlePointerDown:R,onClick:O,onPointerDown:Q}),(A,E)=>(Z(),ee("div",{ref_key:"handle",ref:x,"data-id":`${$(i)}-${$(g)}-${e.id}-${o.value}`,"data-handleid":e.id,"data-nodeid":$(g),"data-handlepos":A.position,class:ze(["vue-flow__handle",[`vue-flow__handle-${A.position}`,`vue-flow__handle-${e.id}`,$(d),$(h),o.value,{connectable:H.value,connecting:D.value,connectablestart:_.value,connectableend:p.value,connectionindicator:H.value&&(_.value&&!y.value||p.value&&y.value)}]]),onMousedown:Q,onTouchstartPassive:Q,onClick:O},[Ie(A.$slots,"default",{id:A.id})],42,df))}}),Gn=function({sourcePosition:e=ue.Bottom,targetPosition:t=ue.Top,label:n,connectable:o=!0,isValidTargetPos:r,isValidSourcePos:i,data:s}){const a=s.label??n;return[ke(Dt,{type:"target",position:t,connectable:o,isValidConnection:r}),typeof a!="string"&&a?ke(a):ke($e,[a]),ke(Dt,{type:"source",position:e,connectable:o,isValidConnection:i})]};Gn.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"];Gn.inheritAttrs=!1;Gn.compatConfig={MODE:3};const hf=Gn,Yn=function({targetPosition:e=ue.Top,label:t,connectable:n=!0,isValidTargetPos:o,data:r}){const i=r.label??t;return[ke(Dt,{type:"target",position:e,connectable:n,isValidConnection:o}),typeof i!="string"&&i?ke(i):ke($e,[i])]};Yn.props=["targetPosition","label","isValidTargetPos","connectable","data"];Yn.inheritAttrs=!1;Yn.compatConfig={MODE:3};const gf=Yn,jn=function({sourcePosition:e=ue.Bottom,label:t,connectable:n=!0,isValidSourcePos:o,data:r}){const i=r.label??t;return[typeof i!="string"&&i?ke(i):ke($e,[i]),ke(Dt,{type:"source",position:e,connectable:n,isValidConnection:o})]};jn.props=["sourcePosition","label","isValidSourcePos","connectable","data"];jn.inheritAttrs=!1;jn.compatConfig={MODE:3};const pf=jn,vf=["transform"],mf=["width","height","x","y","rx","ry"],yf=["y"],wf={name:"EdgeText",compatConfig:{MODE:3}},_f=xe({...wf,props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const t=ve({x:0,y:0,width:0,height:0}),n=ve(null),o=ie(()=>`translate(${e.x-t.value.width/2} ${e.y-t.value.height/2})`);rt(r),ye([()=>e.x,()=>e.y,n,()=>e.label],r);function r(){if(!n.value)return;const i=n.value.getBBox();(i.width!==t.value.width||i.height!==t.value.height)&&(t.value=i)}return(i,s)=>(Z(),ee("g",{transform:o.value,class:"vue-flow__edge-textwrapper"},[i.labelShowBg?(Z(),ee("rect",{key:0,class:"vue-flow__edge-textbg",width:`${t.value.width+2*i.labelBgPadding[0]}px`,height:`${t.value.height+2*i.labelBgPadding[1]}px`,x:-i.labelBgPadding[0],y:-i.labelBgPadding[1],style:Re(i.labelBgStyle),rx:i.labelBgBorderRadius,ry:i.labelBgBorderRadius},null,12,mf)):he("",!0),q("text",xo(i.$attrs,{ref_key:"el",ref:n,class:"vue-flow__edge-text",y:t.value.height/2,dy:"0.3em",style:i.labelStyle}),[Ie(i.$slots,"default",{},()=>[typeof i.label!="string"?(Z(),be(He(i.label),{key:0})):(Z(),ee($e,{key:1},[Se(fe(i.label),1)],64))])],16,yf)],8,vf))}}),xf=["id","d","marker-end","marker-start"],bf=["d","stroke-width"],Ef={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},Xn=xe({...Ef,props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:t}){const n=ve(null),o=ve(null),r=ve(null),i=us();return t({pathEl:n,interactionEl:o,labelEl:r}),(s,a)=>(Z(),ee($e,null,[q("path",xo($(i),{id:s.id,ref_key:"pathEl",ref:n,d:s.path,class:"vue-flow__edge-path","marker-end":s.markerEnd,"marker-start":s.markerStart}),null,16,xf),s.interactionWidth?(Z(),ee("path",{key:0,ref_key:"interactionEl",ref:o,fill:"none",d:s.path,"stroke-width":s.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,bf)):he("",!0),s.label&&s.labelX&&s.labelY?(Z(),be(_f,{key:1,ref_key:"labelEl",ref:r,x:s.labelX,y:s.labelY,label:s.label,"label-show-bg":s.labelShowBg,"label-bg-style":s.labelBgStyle,"label-bg-padding":s.labelBgPadding,"label-bg-border-radius":s.labelBgBorderRadius,"label-style":s.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):he("",!0)],64))}});function Ri({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,i=n<e?n+r:n-r,s=Math.abs(o-t)/2,a=o<t?o+s:o-s;return[i,a,r,s]}function Hi({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const l=e*.125+r*.375+s*.375+n*.125,c=t*.125+i*.375+a*.375+o*.125,u=Math.abs(l-e),d=Math.abs(c-t);return[l,c,u,d]}function hn(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function kr({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){let s,a;switch(e){case ue.Left:s=t-hn(t-o,i),a=n;break;case ue.Right:s=t+hn(o-t,i),a=n;break;case ue.Top:s=t,a=n-hn(n-r,i);break;case ue.Bottom:s=t,a=n+hn(r-n,i);break}return[s,a]}function Fi(e){const{sourceX:t,sourceY:n,sourcePosition:o=ue.Bottom,targetX:r,targetY:i,targetPosition:s=ue.Top,curvature:a=.25}=e,[l,c]=kr({pos:o,x1:t,y1:n,x2:r,y2:i,c:a}),[u,d]=kr({pos:s,x1:r,y1:i,x2:t,y2:n,c:a}),[h,g,b,S]=Hi({sourceX:t,sourceY:n,targetX:r,targetY:i,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:d});return[`M${t},${n} C${l},${c} ${u},${d} ${r},${i}`,h,g,b,S]}function Sr({pos:e,x1:t,y1:n,x2:o,y2:r}){let i,s;switch(e){case ue.Left:case ue.Right:i=.5*(t+o),s=n;break;case ue.Top:case ue.Bottom:i=t,s=.5*(n+r);break}return[i,s]}function Gi(e){const{sourceX:t,sourceY:n,sourcePosition:o=ue.Bottom,targetX:r,targetY:i,targetPosition:s=ue.Top}=e,[a,l]=Sr({pos:o,x1:t,y1:n,x2:r,y2:i}),[c,u]=Sr({pos:s,x1:r,y1:i,x2:t,y2:n}),[d,h,g,b]=Hi({sourceX:t,sourceY:n,targetX:r,targetY:i,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${t},${n} C${a},${l} ${c},${u} ${r},${i}`,d,h,g,b]}const Nr={[ue.Left]:{x:-1,y:0},[ue.Right]:{x:1,y:0},[ue.Top]:{x:0,y:-1},[ue.Bottom]:{x:0,y:1}};function kf({source:e,sourcePosition:t=ue.Bottom,target:n}){return t===ue.Left||t===ue.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1}}function Cr(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function Sf({source:e,sourcePosition:t=ue.Bottom,target:n,targetPosition:o=ue.Top,center:r,offset:i}){const s=Nr[t],a=Nr[o],l={x:e.x+s.x*i,y:e.y+s.y*i},c={x:n.x+a.x*i,y:n.y+a.y*i},u=kf({source:l,sourcePosition:t,target:c}),d=u.x!==0?"x":"y",h=u[d];let g,b,S;const k={x:0,y:0},x={x:0,y:0},[_,p,y,D]=Ri({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[d]*a[d]===-1){b=r.x??_,S=r.y??p;const Y=[{x:b,y:l.y},{x:b,y:c.y}],H=[{x:l.x,y:S},{x:c.x,y:S}];s[d]===h?g=d==="x"?Y:H:g=d==="x"?H:Y}else{const Y=[{x:l.x,y:c.y}],H=[{x:c.x,y:l.y}];if(d==="x"?g=s.x===h?H:Y:g=s.y===h?Y:H,t===o){const M=Math.abs(e[d]-n[d]);if(M<=i){const f=Math.min(i-1,i-M);s[d]===h?k[d]=(l[d]>e[d]?-1:1)*f:x[d]=(c[d]>n[d]?-1:1)*f}}if(t!==o){const M=d==="x"?"y":"x",f=s[d]===a[M],w=l[M]>c[M],v=l[M]<c[M];(s[d]===1&&(!f&&w||f&&v)||s[d]!==1&&(!f&&v||f&&w))&&(g=d==="x"?Y:H)}const Q={x:l.x+k.x,y:l.y+k.y},O={x:c.x+x.x,y:c.y+x.y},A=Math.max(Math.abs(Q.x-g[0].x),Math.abs(O.x-g[0].x)),E=Math.max(Math.abs(Q.y-g[0].y),Math.abs(O.y-g[0].y));A>=E?(b=(Q.x+O.x)/2,S=g[0].y):(b=g[0].x,S=(Q.y+O.y)/2)}return[[e,{x:l.x+k.x,y:l.y+k.y},...g,{x:c.x+x.x,y:c.y+x.y},n],b,S,y,D]}function Nf(e,t,n,o){const r=Math.min(Cr(e,t)/2,Cr(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const c=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${i+r*c},${s}Q ${i},${s} ${i},${s+r*u}`}const a=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${i},${s+r*l}Q ${i},${s} ${i+r*a},${s}`}function wo(e){const{sourceX:t,sourceY:n,sourcePosition:o=ue.Bottom,targetX:r,targetY:i,targetPosition:s=ue.Top,borderRadius:a=5,centerX:l,centerY:c,offset:u=20}=e,[d,h,g,b,S]=Sf({source:{x:t,y:n},sourcePosition:o,target:{x:r,y:i},targetPosition:s,center:{x:l,y:c},offset:u});return[d.reduce((x,_,p)=>{let y;return p>0&&p<d.length-1?y=Nf(d[p-1],_,d[p+1],a):y=`${p===0?"M":"L"}${_.x} ${_.y}`,x+=y,x},""),h,g,b,S]}function Cf(e){const{sourceX:t,sourceY:n,targetX:o,targetY:r}=e,[i,s,a,l]=Ri({sourceX:t,sourceY:n,targetX:o,targetY:r});return[`M ${t},${n}L ${o},${r}`,i,s,a,l]}const $f=xe({name:"StraightEdge",props:["label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,r]=Cf(e);return ke(Xn,{path:n,labelX:o,labelY:r,...t,...e})}}}),Mf=$f,If=xe({name:"SmoothStepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","borderRadius","markerEnd","markerStart","interactionWidth","offset"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,r]=wo({...e,sourcePosition:e.sourcePosition??ue.Bottom,targetPosition:e.targetPosition??ue.Top});return ke(Xn,{path:n,labelX:o,labelY:r,...t,...e})}}}),Yi=If,Tf=xe({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(e,{attrs:t}){return()=>ke(Yi,{...e,...t,borderRadius:0})}}),Of=Tf,Pf=xe({name:"BezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","curvature","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,r]=Fi({...e,sourcePosition:e.sourcePosition??ue.Bottom,targetPosition:e.targetPosition??ue.Top});return ke(Xn,{path:n,labelX:o,labelY:r,...t,...e})}}}),Df=Pf,zf=xe({name:"SimpleBezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,r]=Gi({...e,sourcePosition:e.sourcePosition??ue.Bottom,targetPosition:e.targetPosition??ue.Top});return ke(Xn,{path:n,labelX:o,labelY:r,...t,...e})}}}),Af=zf,Lf={input:pf,default:hf,output:gf},Bf={default:Df,straight:Mf,step:Of,smoothstep:Yi,simplebezier:Af};function Vf(e,t,n){const o=ie(()=>S=>t.value.get(S)),r=ie(()=>S=>n.value.get(S)),i=ie(()=>{const S={...Bf,...e.edgeTypes},k=Object.keys(S);for(const x of e.edges)x.type&&!k.includes(x.type)&&(S[x.type]=x.type);return S}),s=ie(()=>{const S={...Lf,...e.nodeTypes},k=Object.keys(S);for(const x of e.nodes)x.type&&!k.includes(x.type)&&(S[x.type]=x.type);return S}),a=ie(()=>e.onlyRenderVisibleElements?Si(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),l=ie(()=>{if(e.onlyRenderVisibleElements){const S=[];for(const k of e.edges){const x=t.value.get(k.source),_=t.value.get(k.target);Dd({sourcePos:x.computedPosition||{x:0,y:0},targetPos:_.computedPosition||{x:0,y:0},sourceWidth:x.dimensions.width,sourceHeight:x.dimensions.height,targetWidth:_.dimensions.width,targetHeight:_.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&S.push(k)}return S}return e.edges}),c=ie(()=>[...a.value,...l.value]),u=ie(()=>{const S=[];for(const k of e.nodes)k.selected&&S.push(k);return S}),d=ie(()=>{const S=[];for(const k of e.edges)k.selected&&S.push(k);return S}),h=ie(()=>[...u.value,...d.value]),g=ie(()=>{const S=[];for(const k of e.nodes)k.dimensions.width&&k.dimensions.height&&k.handleBounds!==void 0&&S.push(k);return S}),b=ie(()=>a.value.length>0&&g.value.length===a.value.length);return{getNode:o,getEdge:r,getElements:c,getEdgeTypes:i,getNodeTypes:s,getEdges:l,getNodes:a,getSelectedElements:h,getSelectedNodes:u,getSelectedEdges:d,getNodesInitialized:g,areNodesInitialized:b}}class gt{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var t;const n=(t=At())==null?void 0:t.appContext.app,o=n?.config.globalProperties.$vueFlowStorage??gt.instance;return gt.instance=o??new gt,n&&(n.config.globalProperties.$vueFlowStorage=gt.instance),gt.instance}set(t,n){return this.flows.set(t,n)}get(t){return this.flows.get(t)}remove(t){return this.flows.delete(t)}create(t,n){const o=Vi(),r=is(o),i={};for(const[h,g]of Object.entries(r.hooks)){const b=`on${h.charAt(0).toUpperCase()+h.slice(1)}`;i[b]=g.on}const s={};for(const[h,g]of Object.entries(r.hooks))s[h]=g.trigger;const a=ie(()=>{const h=new Map;for(const g of r.nodes)h.set(g.id,g);return h}),l=ie(()=>{const h=new Map;for(const g of r.edges)h.set(g.id,g);return h}),c=Vf(r,a,l),u=cf(r,a,l);u.setState({...r,...n});const d={...i,...c,...u,...Ma(r),nodeLookup:a,edgeLookup:l,emits:s,id:t,vueFlowVersion:"1.48.2",$destroy:()=>{this.remove(t)}};return this.set(t,d),d}getId(){return`vue-flow-${this.currentId++}`}}function Me(e){const t=gt.getInstance(),n=zr(),o=typeof e=="object",r=o?e:{id:e},i=r.id,s=i??n?.vueFlowId;let a;if(n){const l=zt(Er,null);typeof l<"u"&&l!==null&&(!s||l.id===s)&&(a=l)}if(a||s&&(a=t.get(s)),!a||s&&a.id!==s){const l=i??t.getId(),c=t.create(l,r);a=c,(n??Pr(!0)).run(()=>{ye(c.applyDefault,(d,h,g)=>{const b=k=>{c.applyNodeChanges(k)},S=k=>{c.applyEdgeChanges(k)};d?(c.onNodesChange(b),c.onEdgesChange(S)):(c.hooks.value.nodesChange.off(b),c.hooks.value.edgesChange.off(S)),g(()=>{c.hooks.value.nodesChange.off(b),c.hooks.value.edgesChange.off(S)})},{immediate:!0}),Wt(()=>{if(a){const d=t.get(a.id);d?d.$destroy():on(`No store instance found for id ${a.id} in storage.`)}})})}else o&&a.setState(r);if(n&&($t(Er,a),n.vueFlowId=a.id),o){const l=At();l?.type.name!=="VueFlow"&&a.emits.error(new Ae(Pe.USEVUEFLOW_OPTIONS))}return a}function Rf(e){const{emits:t,dimensions:n}=Me();let o;rt(()=>{const r=()=>{var i,s;if(!e.value||!(((s=(i=e.value).checkVisibility)==null?void 0:s.call(i))??!0))return;const a=Rn(e.value);(a.width===0||a.height===0)&&t.error(new Ae(Pe.MISSING_VIEWPORT_DIMENSIONS)),n.value={width:a.width||500,height:a.height||500}};r(),window.addEventListener("resize",r),e.value&&(o=new ResizeObserver(()=>r()),o.observe(e.value)),Dr(()=>{window.removeEventListener("resize",r),o&&e.value&&o.unobserve(e.value)})})}const Hf={name:"UserSelection",compatConfig:{MODE:3}},Ff=xe({...Hf,props:{userSelectionRect:{}},setup(e){return(t,n)=>(Z(),ee("div",{class:"vue-flow__selection vue-flow__container",style:Re({width:`${t.userSelectionRect.width}px`,height:`${t.userSelectionRect.height}px`,transform:`translate(${t.userSelectionRect.x}px, ${t.userSelectionRect.y}px)`})},null,4))}}),Gf=["tabIndex"],Yf={name:"NodesSelection",compatConfig:{MODE:3}},jf=xe({...Yf,setup(e){const{emits:t,viewport:n,getSelectedNodes:o,noPanClassName:r,disableKeyboardA11y:i,userSelectionActive:s}=Me(),a=Bi(),l=ve(null),c=zi({el:l,onStart(b){t.selectionDragStart(b),t.nodeDragStart(b)},onDrag(b){t.selectionDrag(b),t.nodeDrag(b)},onStop(b){t.selectionDragStop(b),t.nodeDragStop(b)}});rt(()=>{var b;i.value||(b=l.value)==null||b.focus({preventScroll:!0})});const u=ie(()=>ki(o.value)),d=ie(()=>({width:`${u.value.width}px`,height:`${u.value.height}px`,top:`${u.value.y}px`,left:`${u.value.x}px`}));function h(b){t.selectionContextMenu({event:b,nodes:o.value})}function g(b){i.value||Ct[b.key]&&(b.preventDefault(),a({x:Ct[b.key].x,y:Ct[b.key].y},b.shiftKey))}return(b,S)=>!$(s)&&u.value.width&&u.value.height?(Z(),ee("div",{key:0,class:ze(["vue-flow__nodesselection vue-flow__container",$(r)]),style:Re({transform:`translate(${$(n).x}px,${$(n).y}px) scale(${$(n).zoom})`})},[q("div",{ref_key:"el",ref:l,class:ze([{dragging:$(c)},"vue-flow__nodesselection-rect"]),style:Re(d.value),tabIndex:$(i)?void 0:-1,onContextmenu:h,onKeydown:g},null,46,Gf)],6)):he("",!0)}});function Xf(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const Wf={name:"Pane",compatConfig:{MODE:3}},Uf=xe({...Wf,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:t,nodes:n,viewport:o,emits:r,userSelectionActive:i,removeSelectedElements:s,userSelectionRect:a,elementsSelectable:l,nodesSelectionActive:c,getSelectedEdges:u,getSelectedNodes:d,removeNodes:h,removeEdges:g,selectionMode:b,deleteKeyCode:S,multiSelectionKeyCode:k,multiSelectionActive:x,edgeLookup:_,nodeLookup:p,connectionLookup:y,defaultEdgeOptions:D,connectionStartHandle:R,panOnDrag:Y}=Me(),H=ut(null),Q=ut(new Set),O=ut(new Set),A=ut(null),E=Ce(()=>l.value&&(e.isSelecting||i.value)),M=Ce(()=>R.value!==null);let f=!1,w=!1;const v=Xt(S,{actInsideInputWithModifier:!1}),C=Xt(k);ye(v,m=>{m&&(h(d.value),g(u.value),c.value=!1)}),ye(C,m=>{x.value=m});function z(m,I){return L=>{L.target===I&&m?.(L)}}function F(m){if(f||M.value){f=!1;return}r.paneClick(m),s(),c.value=!1}function B(m){var I;if(Array.isArray(Y.value)&&((I=Y.value)!=null&&I.includes(2))){m.preventDefault();return}r.paneContextMenu(m)}function G(m){r.paneScroll(m)}function U(m){var I,L,X;if(A.value=((I=t.value)==null?void 0:I.getBoundingClientRect())??null,!l.value||!e.isSelecting||m.button!==0||m.target!==H.value||!A.value)return;(X=(L=m.target)==null?void 0:L.setPointerCapture)==null||X.call(L,m.pointerId);const{x:J,y:te}=Xf(m,A.value);w=!0,f=!1,s(),a.value={width:0,height:0,startX:J,startY:te,x:J,y:te},r.selectionStart(m)}function K(m){var I;if(!A.value||!a.value)return;f=!0;const{x:L,y:X}=Ze(m,A.value),{startX:J=0,startY:te=0}=a.value,ne={startX:J,startY:te,x:L<J?L:J,y:X<te?X:te,width:Math.abs(L-J),height:Math.abs(X-te)},ae=Q.value,ge=O.value;Q.value=new Set(Si(n.value,ne,o.value,b.value===Mo.Partial,!0).map(N=>N.id)),O.value=new Set;const P=((I=D.value)==null?void 0:I.selectable)??!0;for(const N of Q.value){const V=y.value.get(N);if(V)for(const{edgeId:W}of V.values()){const j=_.value.get(W);j&&(j.selectable??P)&&O.value.add(W)}}if(!br(ae,Q.value)){const N=lt(p.value,Q.value,!0);r.nodesChange(N)}if(!br(ge,O.value)){const N=lt(_.value,O.value);r.edgesChange(N)}a.value=ne,i.value=!0,c.value=!1}function T(m){var I;m.button!==0||!w||((I=m.target)==null||I.releasePointerCapture(m.pointerId),!i.value&&a.value&&m.target===H.value&&F(m),i.value=!1,a.value=null,c.value=Q.value.size>0,r.selectionEnd(m),e.selectionKeyPressed&&(f=!1),w=!1)}return(m,I)=>(Z(),ee("div",{ref_key:"container",ref:H,class:ze(["vue-flow__pane vue-flow__container",{selection:m.isSelecting}]),onClick:I[0]||(I[0]=L=>E.value?void 0:z(F,H.value)(L)),onContextmenu:I[1]||(I[1]=L=>z(B,H.value)(L)),onWheelPassive:I[2]||(I[2]=L=>z(G,H.value)(L)),onPointerenter:I[3]||(I[3]=L=>E.value?void 0:$(r).paneMouseEnter(L)),onPointerdown:I[4]||(I[4]=L=>E.value?U(L):$(r).paneMouseMove(L)),onPointermove:I[5]||(I[5]=L=>E.value?K(L):$(r).paneMouseMove(L)),onPointerup:I[6]||(I[6]=L=>E.value?T(L):void 0),onPointerleave:I[7]||(I[7]=L=>$(r).paneMouseLeave(L))},[Ie(m.$slots,"default"),$(i)&&$(a)?(Z(),be(Ff,{key:0,"user-selection-rect":$(a)},null,8,["user-selection-rect"])):he("",!0),$(c)&&$(d).length?(Z(),be(jf,{key:1})):he("",!0)],34))}}),Zf={name:"Transform",compatConfig:{MODE:3}},qf=xe({...Zf,setup(e){const{viewport:t,fitViewOnInit:n,fitViewOnInitDone:o}=Me(),r=ie(()=>n.value?!o.value:!1),i=ie(()=>`translate(${t.value.x}px,${t.value.y}px) scale(${t.value.zoom})`);return(s,a)=>(Z(),ee("div",{class:"vue-flow__transformationpane vue-flow__container",style:Re({transform:i.value,opacity:r.value?0:void 0})},[Ie(s.$slots,"default")],4))}}),Kf={name:"Viewport",compatConfig:{MODE:3}},Qf=xe({...Kf,setup(e){const{minZoom:t,maxZoom:n,defaultViewport:o,translateExtent:r,zoomActivationKeyCode:i,selectionKeyCode:s,panActivationKeyCode:a,panOnScroll:l,panOnScrollMode:c,panOnScrollSpeed:u,panOnDrag:d,zoomOnDoubleClick:h,zoomOnPinch:g,zoomOnScroll:b,preventScrolling:S,noWheelClassName:k,noPanClassName:x,emits:_,connectionStartHandle:p,userSelectionActive:y,paneDragging:D,d3Zoom:R,d3Selection:Y,d3ZoomHandler:H,viewport:Q,viewportRef:O,paneClickDistance:A}=Me();Rf(O);const E=ut(!1),M=ut(!1);let f=null,w=!1,v=0,C={x:0,y:0,zoom:0};const z=Xt(a),F=Xt(s),B=Xt(i),G=Ce(()=>(!F.value||F.value&&s.value===!0)&&(z.value||d.value)),U=Ce(()=>z.value||l.value),K=Ce(()=>s.value===!0&&G.value!==!0),T=Ce(()=>F.value&&s.value!==!0||y.value||K.value),m=Ce(()=>p.value!==null);rt(()=>{if(!O.value){on("Viewport element is missing");return}const te=O.value,ne=te.getBoundingClientRect(),ae=hd().clickDistance(A.value).scaleExtent([t.value,n.value]).translateExtent(r.value),ge=Fe(te).call(ae),P=ge.on("wheel.zoom"),N=Ot.translate(o.value.x??0,o.value.y??0).scale(_t(o.value.zoom??1,t.value,n.value)),V=[[0,0],[ne.width,ne.height]],W=ae.constrain()(N,V,r.value);ae.transform(ge,W),ae.wheelDelta(lr),R.value=ae,Y.value=ge,H.value=P,Q.value={x:W.x,y:W.y,zoom:W.k},ae.on("start",j=>{var se;if(!j.sourceEvent)return null;v=j.sourceEvent.button,E.value=!0;const le=X(j.transform);((se=j.sourceEvent)==null?void 0:se.type)==="mousedown"&&(D.value=!0),C=le,_.viewportChangeStart(le),_.moveStart({event:j,flowTransform:le})}),ae.on("end",j=>{if(!j.sourceEvent)return null;if(E.value=!1,D.value=!1,I(G.value,v??0)&&!w&&_.paneContextMenu(j.sourceEvent),w=!1,L(C,j.transform)){const se=X(j.transform);C=se,_.viewportChangeEnd(se),_.moveEnd({event:j,flowTransform:se})}}),ae.filter(j=>{var se;const le=B.value||b.value,de=g.value&&j.ctrlKey,ce=j.button,pe=j.type==="wheel";if(ce===1&&j.type==="mousedown"&&(J(j,"vue-flow__node")||J(j,"vue-flow__edge")))return!0;if(!G.value&&!le&&!U.value&&!h.value&&!g.value||y.value||m.value&&!pe||!h.value&&j.type==="dblclick"||J(j,k.value)&&pe||J(j,x.value)&&(!pe||U.value&&pe&&!B.value)||!g.value&&j.ctrlKey&&pe||!le&&!U.value&&!de&&pe)return!1;if(!g&&j.type==="touchstart"&&((se=j.touches)==null?void 0:se.length)>1)return j.preventDefault(),!1;if(!G.value&&(j.type==="mousedown"||j.type==="touchstart")||K.value&&Array.isArray(d.value)&&d.value.includes(0)&&ce===0||Array.isArray(d.value)&&!d.value.includes(ce)&&(j.type==="mousedown"||j.type==="touchstart"))return!1;const we=Array.isArray(d.value)&&d.value.includes(ce)||s.value===!0&&Array.isArray(d.value)&&!d.value.includes(0)||!ce||ce<=1;return(!j.ctrlKey||z.value||pe)&&we}),ye([y,G],()=>{y.value&&!E.value?ae.on("zoom",null):y.value||ae.on("zoom",j=>{Q.value={x:j.transform.x,y:j.transform.y,zoom:j.transform.k};const se=X(j.transform);w=I(G.value,v??0),_.viewportChange(se),_.move({event:j,flowTransform:se})})},{immediate:!0}),ye([y,U,c,B,g,S,k],()=>{U.value&&!B.value&&!y.value?ge.on("wheel.zoom",j=>{if(J(j,k.value))return!1;const se=B.value||b.value,le=g.value&&j.ctrlKey;if(!(!S.value||U.value||se||le))return!1;j.preventDefault(),j.stopImmediatePropagation();const ce=ge.property("__zoom").k||1,pe=zn();if(!z.value&&j.ctrlKey&&g.value&&pe){const Ui=We(j),Zi=lr(j),qi=ce*2**Zi;ae.scaleTo(ge,qi,Ui,j);return}const we=j.deltaMode===1?20:1;let Ee=c.value===jt.Vertical?0:j.deltaX*we,it=c.value===jt.Horizontal?0:j.deltaY*we;!pe&&j.shiftKey&&c.value!==jt.Vertical&&!Ee&&it&&(Ee=it,it=0),ae.translateBy(ge,-(Ee/ce)*u.value,-(it/ce)*u.value);const Xe=X(ge.property("__zoom"));f&&clearTimeout(f),M.value?(_.move({event:j,flowTransform:Xe}),_.viewportChange(Xe),f=setTimeout(()=>{_.moveEnd({event:j,flowTransform:Xe}),_.viewportChangeEnd(Xe),M.value=!1},150)):(M.value=!0,_.moveStart({event:j,flowTransform:Xe}),_.viewportChangeStart(Xe))},{passive:!1}):typeof P<"u"&&ge.on("wheel.zoom",function(j,se){const le=!S.value&&j.type==="wheel"&&!j.ctrlKey,de=B.value||b.value,ce=g.value&&j.ctrlKey;if(!de&&!l.value&&!ce&&j.type==="wheel"||le||J(j,k.value))return null;j.preventDefault(),P.call(this,j,se)},{passive:!1})},{immediate:!0})});function I(te,ne){return ne===2&&Array.isArray(te)&&te.includes(2)}function L(te,ne){return te.x!==ne.x&&!Number.isNaN(ne.x)||te.y!==ne.y&&!Number.isNaN(ne.y)||te.zoom!==ne.k&&!Number.isNaN(ne.k)}function X(te){return{x:te.x,y:te.y,zoom:te.k}}function J(te,ne){return te.target.closest(`.${ne}`)}return(te,ne)=>(Z(),ee("div",{ref_key:"viewportRef",ref:O,class:"vue-flow__viewport vue-flow__container"},[oe(Uf,{"is-selecting":T.value,"selection-key-pressed":$(F),class:ze({connecting:m.value,dragging:$(D),draggable:$(d)===!0||Array.isArray($(d))&&$(d).includes(0)})},{default:me(()=>[oe(qf,null,{default:me(()=>[Ie(te.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),Jf=["id"],eh=["id"],th=["id"],nh={name:"A11yDescriptions",compatConfig:{MODE:3}},oh=xe({...nh,setup(e){const{id:t,disableKeyboardA11y:n,ariaLiveMessage:o}=Me();return(r,i)=>(Z(),ee($e,null,[q("div",{id:`${$(vi)}-${$(t)}`,style:{display:"none"}}," Press enter or space to select a node. "+fe($(n)?"":"You can then use the arrow keys to move the node around.")+" You can then use the arrow keys to move the node around, press delete to remove it and press escape to cancel. ",9,Jf),q("div",{id:`${$(mi)}-${$(t)}`,style:{display:"none"}}," Press enter or space to select an edge. You can then press delete to remove it or press escape to cancel. ",8,eh),$(n)?he("",!0):(Z(),ee("div",{key:0,id:`${$(wd)}-${$(t)}`,"aria-live":"assertive","aria-atomic":"true",style:{position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)","clip-path":"inset(100%)"}},fe($(o)),9,th))],64))}});function rh(){const e=Me();ye(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function ih(e,t,n){return n===ue.Left?e-t:n===ue.Right?e+t:e}function sh(e,t,n){return n===ue.Top?e-t:n===ue.Bottom?e+t:e}const Oo=function({radius:e=10,centerX:t=0,centerY:n=0,position:o=ue.Top,type:r}){return ke("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${r}`,cx:ih(t,e,o),cy:sh(n,e,o),r:e,stroke:"transparent",fill:"transparent"})};Oo.props=["radius","centerX","centerY","position","type"];Oo.compatConfig={MODE:3};const $r=Oo,ah=xe({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:t,addSelectedEdges:n,connectionMode:o,edgeUpdaterRadius:r,emits:i,nodesSelectionActive:s,noPanClassName:a,getEdgeTypes:l,removeSelectedEdges:c,findEdge:u,findNode:d,isValidConnection:h,multiSelectionActive:g,disableKeyboardA11y:b,elementsSelectable:S,edgesUpdatable:k,edgesFocusable:x,hooks:_}=Me(),p=ie(()=>u(e.id)),{emit:y,on:D}=qd(p.value,i),R=zt(Fn),Y=At(),H=ve(!1),Q=ve(!1),O=ve(""),A=ve(null),E=ve("source"),M=ve(null),f=Ce(()=>typeof p.value.selectable>"u"?S.value:p.value.selectable),w=Ce(()=>typeof p.value.updatable>"u"?k.value:p.value.updatable),v=Ce(()=>typeof p.value.focusable>"u"?x.value:p.value.focusable);$t(Wd,e.id),$t(Ud,M);const C=ie(()=>p.value.class instanceof Function?p.value.class(p.value):p.value.class),z=ie(()=>p.value.style instanceof Function?p.value.style(p.value):p.value.style),F=ie(()=>{const N=p.value.type||"default",V=R?.[`edge-${N}`];if(V)return V;let W=p.value.template??l.value[N];if(typeof W=="string"&&Y){const j=Object.keys(Y.appContext.components);j&&j.includes(N)&&(W=Ar(N,!1))}return W&&typeof W!="string"?W:(i.error(new Ae(Pe.EDGE_TYPE_MISSING,W)),!1)}),{handlePointerDown:B}=Ai({nodeId:O,handleId:A,type:E,isValidConnection:h,edgeUpdaterType:E,onEdgeUpdate:K,onEdgeUpdateEnd:T});return()=>{const N=d(p.value.source),V=d(p.value.target),W="pathOptions"in p.value?p.value.pathOptions:{};if(!N&&!V)return i.error(new Ae(Pe.EDGE_SOURCE_TARGET_MISSING,p.value.id,p.value.source,p.value.target)),null;if(!N)return i.error(new Ae(Pe.EDGE_SOURCE_MISSING,p.value.id,p.value.source)),null;if(!V)return i.error(new Ae(Pe.EDGE_TARGET_MISSING,p.value.id,p.value.target)),null;if(!p.value||p.value.hidden||N.hidden||V.hidden)return null;let j;o.value===dt.Strict?j=N.handleBounds.source:j=[...N.handleBounds.source||[],...N.handleBounds.target||[]];const se=vr(j,p.value.sourceHandle);let le;o.value===dt.Strict?le=V.handleBounds.target:le=[...V.handleBounds.target||[],...V.handleBounds.source||[]];const de=vr(le,p.value.targetHandle),ce=se?.position||ue.Bottom,pe=de?.position||ue.Top,{x:we,y:Ee}=Pt(N,se,ce),{x:it,y:Xe}=Pt(V,de,pe);return p.value.sourceX=we,p.value.sourceY=Ee,p.value.targetX=it,p.value.targetY=Xe,ke("g",{ref:M,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${F.value===!1?"default":p.value.type||"default"}`,a.value,C.value,{updating:H.value,selected:p.value.selected,animated:p.value.animated,inactive:!f.value&&!_.value.edgeClick.hasListeners()}],tabIndex:v.value?0:void 0,"aria-label":p.value.ariaLabel===null?void 0:p.value.ariaLabel??`Edge from ${p.value.source} to ${p.value.target}`,"aria-describedby":v.value?`${mi}-${t}`:void 0,"aria-roledescription":"edge",role:v.value?"group":"img",...p.value.domAttributes,onClick:I,onContextmenu:L,onDblclick:X,onMouseenter:J,onMousemove:te,onMouseleave:ne,onKeyDown:v.value?P:void 0},[Q.value?null:ke(F.value===!1?l.value.default:F.value,{id:e.id,sourceNode:N,targetNode:V,source:p.value.source,target:p.value.target,type:p.value.type,updatable:w.value,selected:p.value.selected,animated:p.value.animated,label:p.value.label,labelStyle:p.value.labelStyle,labelShowBg:p.value.labelShowBg,labelBgStyle:p.value.labelBgStyle,labelBgPadding:p.value.labelBgPadding,labelBgBorderRadius:p.value.labelBgBorderRadius,data:p.value.data,events:{...p.value.events,...D},style:z.value,markerStart:`url('#${en(p.value.markerStart,t)}')`,markerEnd:`url('#${en(p.value.markerEnd,t)}')`,sourcePosition:ce,targetPosition:pe,sourceX:we,sourceY:Ee,targetX:it,targetY:Xe,sourceHandleId:p.value.sourceHandle,targetHandleId:p.value.targetHandle,interactionWidth:p.value.interactionWidth,...W}),[w.value==="source"||w.value===!0?[ke("g",{onMousedown:ae,onMouseenter:G,onMouseout:U},ke($r,{position:ce,centerX:we,centerY:Ee,radius:r.value,type:"source","data-type":"source"}))]:null,w.value==="target"||w.value===!0?[ke("g",{onMousedown:ge,onMouseenter:G,onMouseout:U},ke($r,{position:pe,centerX:it,centerY:Xe,radius:r.value,type:"target","data-type":"target"}))]:null]])};function G(){H.value=!0}function U(){H.value=!1}function K(N,V){y.update({event:N,edge:p.value,connection:V})}function T(N){y.updateEnd({event:N,edge:p.value}),Q.value=!1}function m(N,V){N.button===0&&(Q.value=!0,O.value=V?p.value.target:p.value.source,A.value=(V?p.value.targetHandle:p.value.sourceHandle)??null,E.value=V?"target":"source",y.updateStart({event:N,edge:p.value}),B(N))}function I(N){var V;const W={event:N,edge:p.value};f.value&&(s.value=!1,p.value.selected&&g.value?(c([p.value]),(V=M.value)==null||V.blur()):n([p.value])),y.click(W)}function L(N){y.contextMenu({event:N,edge:p.value})}function X(N){y.doubleClick({event:N,edge:p.value})}function J(N){y.mouseEnter({event:N,edge:p.value})}function te(N){y.mouseMove({event:N,edge:p.value})}function ne(N){y.mouseLeave({event:N,edge:p.value})}function ae(N){m(N,!0)}function ge(N){m(N,!1)}function P(N){var V;!b.value&&yi.includes(N.key)&&f.value&&(N.key==="Escape"?((V=M.value)==null||V.blur(),c([u(e.id)])):n([u(e.id)]))}}}),lh=ah,uh=xe({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var e;const{id:t,connectionMode:n,connectionStartHandle:o,connectionEndHandle:r,connectionPosition:i,connectionLineType:s,connectionLineStyle:a,connectionLineOptions:l,connectionStatus:c,viewport:u,findNode:d}=Me(),h=(e=zt(Fn))==null?void 0:e["connection-line"],g=ie(()=>{var _;return d((_=o.value)==null?void 0:_.nodeId)}),b=ie(()=>{var _;return d((_=r.value)==null?void 0:_.nodeId)??null}),S=ie(()=>({x:(i.value.x-u.value.x)/u.value.zoom,y:(i.value.y-u.value.y)/u.value.zoom})),k=ie(()=>l.value.markerStart?`url(#${en(l.value.markerStart,t)})`:""),x=ie(()=>l.value.markerEnd?`url(#${en(l.value.markerEnd,t)})`:"");return()=>{var _,p,y;if(!g.value||!o.value)return null;const D=o.value.id,R=o.value.type,Y=g.value.handleBounds;let H=Y?.[R]??[];if(n.value===dt.Loose){const z=Y?.[R==="source"?"target":"source"]??[];H=[...H,...z]}if(!H)return null;const Q=(D?H.find(z=>z.id===D):H[0])??null,O=Q?.position??ue.Top,{x:A,y:E}=Pt(g.value,Q,O);let M=null;b.value&&(n.value===dt.Strict?M=((_=b.value.handleBounds[R==="source"?"target":"source"])==null?void 0:_.find(z=>{var F;return z.id===((F=r.value)==null?void 0:F.id)}))||null:M=((p=[...b.value.handleBounds.source??[],...b.value.handleBounds.target??[]])==null?void 0:p.find(z=>{var F;return z.id===((F=r.value)==null?void 0:F.id)}))||null);const f=((y=r.value)==null?void 0:y.position)??(O?mo[O]:null);if(!O||!f)return null;const w=s.value??l.value.type??ht.Bezier;let v="";const C={sourceX:A,sourceY:E,sourcePosition:O,targetX:S.value.x,targetY:S.value.y,targetPosition:f};return w===ht.Bezier?[v]=Fi(C):w===ht.Step?[v]=wo({...C,borderRadius:0}):w===ht.SmoothStep?[v]=wo(C):w===ht.SimpleBezier?[v]=Gi(C):v=`M${A},${E} ${S.value.x},${S.value.y}`,ke("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},ke("g",{class:"vue-flow__connection"},h?ke(h,{sourceX:A,sourceY:E,sourcePosition:O,targetX:S.value.x,targetY:S.value.y,targetPosition:f,sourceNode:g.value,sourceHandle:Q,targetNode:b.value,targetHandle:M,markerEnd:x.value,markerStart:k.value,connectionStatus:c.value}):ke("path",{d:v,class:[l.value.class,c.value,"vue-flow__connection-path"],style:{...a.value,...l.value.style},"marker-end":x.value,"marker-start":k.value})))}}}),ch=uh,dh=["id","markerWidth","markerHeight","markerUnits","orient"],fh={name:"MarkerType",compatConfig:{MODE:3}},hh=xe({...fh,props:{id:{},type:{},color:{default:"none"},width:{default:12.5},height:{default:12.5},markerUnits:{default:"strokeWidth"},orient:{default:"auto-start-reverse"},strokeWidth:{default:1}},setup(e){return(t,n)=>(Z(),ee("marker",{id:t.id,class:"vue-flow__arrowhead",viewBox:"-10 -10 20 20",refX:"0",refY:"0",markerWidth:`${t.width}`,markerHeight:`${t.height}`,markerUnits:t.markerUnits,orient:t.orient},[t.type===$(On).ArrowClosed?(Z(),ee("polyline",{key:0,style:Re({stroke:t.color,fill:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",points:"-5,-4 0,0 -5,4 -5,-4"},null,4)):he("",!0),t.type===$(On).Arrow?(Z(),ee("polyline",{key:1,style:Re({stroke:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):he("",!0)],8,dh))}}),gh={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},ph={name:"MarkerDefinitions",compatConfig:{MODE:3}},vh=xe({...ph,setup(e){const{id:t,edges:n,connectionLineOptions:o,defaultMarkerColor:r}=Me(),i=ie(()=>{const s=new Set,a=[],l=c=>{if(c){const u=en(c,t);s.has(u)||(typeof c=="object"?a.push({...c,id:u,color:c.color||r.value}):a.push({id:u,color:r.value,type:c}),s.add(u))}};for(const c of[o.value.markerEnd,o.value.markerStart])l(c);for(const c of n.value)for(const u of[c.markerStart,c.markerEnd])l(u);return a.sort((c,u)=>c.id.localeCompare(u.id))});return(s,a)=>(Z(),ee("svg",gh,[q("defs",null,[(Z(!0),ee($e,null,Ve(i.value,l=>(Z(),be(hh,{id:l.id,key:l.id,type:l.type,color:l.color,width:l.width,height:l.height,markerUnits:l.markerUnits,"stroke-width":l.strokeWidth,orient:l.orient},null,8,["id","type","color","width","height","markerUnits","stroke-width","orient"]))),128))])]))}}),mh={name:"Edges",compatConfig:{MODE:3}},yh=xe({...mh,setup(e){const{findNode:t,getEdges:n,elevateEdgesOnSelect:o}=Me();return(r,i)=>(Z(),ee($e,null,[oe(vh),(Z(!0),ee($e,null,Ve($(n),s=>(Z(),ee("svg",{key:s.id,class:"vue-flow__edges vue-flow__container",style:Re({zIndex:$(zd)(s,$(t),$(o))})},[oe($(lh),{id:s.id},null,8,["id"])],4))),128)),oe($(ch))],64))}}),wh=xe({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:t,noPanClassName:n,selectNodesOnDrag:o,nodesSelectionActive:r,multiSelectionActive:i,emits:s,removeSelectedNodes:a,addSelectedNodes:l,updateNodeDimensions:c,onUpdateNodeInternals:u,getNodeTypes:d,nodeExtent:h,elevateNodesOnSelect:g,disableKeyboardA11y:b,ariaLiveMessage:S,snapToGrid:k,snapGrid:x,nodeDragThreshold:_,nodesDraggable:p,elementsSelectable:y,nodesConnectable:D,nodesFocusable:R,hooks:Y}=Me(),H=ve(null);$t(Di,H),$t(Pi,e.id);const Q=zt(Fn),O=At(),A=Bi(),{node:E,parentNode:M}=Li(e.id),{emit:f,on:w}=ef(E,s),v=Ce(()=>typeof E.draggable>"u"?p.value:E.draggable),C=Ce(()=>typeof E.selectable>"u"?y.value:E.selectable),z=Ce(()=>typeof E.connectable>"u"?D.value:E.connectable),F=Ce(()=>typeof E.focusable>"u"?R.value:E.focusable),B=ie(()=>C.value||v.value||Y.value.nodeClick.hasListeners()||Y.value.nodeDoubleClick.hasListeners()||Y.value.nodeMouseEnter.hasListeners()||Y.value.nodeMouseMove.hasListeners()||Y.value.nodeMouseLeave.hasListeners()),G=Ce(()=>!!E.dimensions.width&&!!E.dimensions.height),U=ie(()=>{const V=E.type||"default",W=Q?.[`node-${V}`];if(W)return W;let j=E.template||d.value[V];if(typeof j=="string"&&O){const se=Object.keys(O.appContext.components);se&&se.includes(V)&&(j=Ar(V,!1))}return j&&typeof j!="string"?j:(s.error(new Ae(Pe.NODE_TYPE_MISSING,j)),!1)}),K=zi({id:e.id,el:H,disabled:()=>!v.value,selectable:C,dragHandle:()=>E.dragHandle,onStart(V){f.dragStart(V)},onDrag(V){f.drag(V)},onStop(V){f.dragStop(V)},onClick(V){P(V)}}),T=ie(()=>E.class instanceof Function?E.class(E):E.class),m=ie(()=>{const V=(E.style instanceof Function?E.style(E):E.style)||{},W=E.width instanceof Function?E.width(E):E.width,j=E.height instanceof Function?E.height(E):E.height;return!V.width&&W&&(V.width=typeof W=="string"?W:`${W}px`),!V.height&&j&&(V.height=typeof j=="string"?j:`${j}px`),V}),I=Ce(()=>Number(E.zIndex??m.value.zIndex??0));return u(V=>{(V.includes(e.id)||!V.length)&&X()}),rt(()=>{ye(()=>E.hidden,(V=!1,W,j)=>{!V&&H.value&&(e.resizeObserver.observe(H.value),j(()=>{H.value&&e.resizeObserver.unobserve(H.value)}))},{immediate:!0,flush:"post"})}),ye([()=>E.type,()=>E.sourcePosition,()=>E.targetPosition],()=>{nt(()=>{c([{id:e.id,nodeElement:H.value,forceUpdate:!0}])})}),ye([()=>E.position.x,()=>E.position.y,()=>{var V;return(V=M.value)==null?void 0:V.computedPosition.x},()=>{var V;return(V=M.value)==null?void 0:V.computedPosition.y},()=>{var V;return(V=M.value)==null?void 0:V.computedPosition.z},I,()=>E.selected,()=>E.dimensions.height,()=>E.dimensions.width,()=>{var V;return(V=M.value)==null?void 0:V.dimensions.height},()=>{var V;return(V=M.value)==null?void 0:V.dimensions.width}],([V,W,j,se,le,de])=>{const ce={x:V,y:W,z:de+(g.value&&E.selected?1e3:0)};typeof j<"u"&&typeof se<"u"?E.computedPosition=Md({x:j,y:se,z:le},ce):E.computedPosition=ce},{flush:"post",immediate:!0}),ye([()=>E.extent,h],([V,W],[j,se])=>{(V!==j||W!==se)&&L()}),E.extent==="parent"||typeof E.extent=="object"&&"range"in E.extent&&E.extent.range==="parent"?so(()=>G).toBe(!0).then(L):L(),()=>E.hidden?null:ke("div",{ref:H,"data-id":E.id,class:["vue-flow__node",`vue-flow__node-${U.value===!1?"default":E.type||"default"}`,{[n.value]:v.value,dragging:K?.value,draggable:v.value,selected:E.selected,selectable:C.value,parent:E.isParent},T.value],style:{visibility:G.value?"visible":"hidden",zIndex:E.computedPosition.z??I.value,transform:`translate(${E.computedPosition.x}px,${E.computedPosition.y}px)`,pointerEvents:B.value?"all":"none",...m.value},tabIndex:F.value?0:void 0,role:F.value?"group":void 0,"aria-describedby":b.value?void 0:`${vi}-${t}`,"aria-label":E.ariaLabel,"aria-roledescription":"node",...E.domAttributes,onMouseenter:J,onMousemove:te,onMouseleave:ne,onContextmenu:ae,onClick:P,onDblclick:ge,onKeydown:N},[ke(U.value===!1?d.value.default:U.value,{id:E.id,type:E.type,data:E.data,events:{...E.events,...w},selected:E.selected,resizing:E.resizing,dragging:K.value,connectable:z.value,position:E.computedPosition,dimensions:E.dimensions,isValidTargetPos:E.isValidTargetPos,isValidSourcePos:E.isValidSourcePos,parent:E.parentNode,parentNodeId:E.parentNode,zIndex:E.computedPosition.z??I.value,targetPosition:E.targetPosition,sourcePosition:E.sourcePosition,label:E.label,dragHandle:E.dragHandle,onUpdateNodeInternals:X})]);function L(){const V=E.computedPosition,{computedPosition:W,position:j}=Io(E,k.value?Hn(V,x.value):V,s.error,h.value,M.value);(E.computedPosition.x!==W.x||E.computedPosition.y!==W.y)&&(E.computedPosition={...E.computedPosition,...W}),(E.position.x!==j.x||E.position.y!==j.y)&&(E.position=j)}function X(){H.value&&c([{id:e.id,nodeElement:H.value,forceUpdate:!0}])}function J(V){K?.value||f.mouseEnter({event:V,node:E})}function te(V){K?.value||f.mouseMove({event:V,node:E})}function ne(V){K?.value||f.mouseLeave({event:V,node:E})}function ae(V){return f.contextMenu({event:V,node:E})}function ge(V){return f.doubleClick({event:V,node:E})}function P(V){C.value&&(!o.value||!v.value||_.value>0)&&yo(E,i.value,l,a,r,!1,H.value),f.click({event:V,node:E})}function N(V){if(!(vo(V)||b.value))if(yi.includes(V.key)&&C.value){const W=V.key==="Escape";yo(E,i.value,l,a,r,W,H.value)}else v.value&&E.selected&&Ct[V.key]&&(V.preventDefault(),S.value=`Moved selected node ${V.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~E.position.x}, y: ${~~E.position.y}`,A({x:Ct[V.key].x,y:Ct[V.key].y},V.shiftKey))}}}),_h=wh;function xh(e={includeHiddenNodes:!1}){const{nodes:t}=Me();return ie(()=>{if(t.value.length===0)return!1;for(const n of t.value)if((e.includeHiddenNodes||!n.hidden)&&(n?.handleBounds===void 0||n.dimensions.width===0||n.dimensions.height===0))return!1;return!0})}const bh={class:"vue-flow__nodes vue-flow__container"},Eh={name:"Nodes",compatConfig:{MODE:3}},kh=xe({...Eh,setup(e){const{getNodes:t,updateNodeDimensions:n,emits:o}=Me(),r=xh(),i=ve();return ye(r,s=>{s&&nt(()=>{o.nodesInitialized(t.value)})},{immediate:!0}),rt(()=>{i.value=new ResizeObserver(s=>{const a=s.map(l=>({id:l.target.getAttribute("data-id"),nodeElement:l.target,forceUpdate:!0}));nt(()=>n(a))})}),Dr(()=>{var s;return(s=i.value)==null?void 0:s.disconnect()}),(s,a)=>(Z(),ee("div",bh,[i.value?(Z(!0),ee($e,{key:0},Ve($(t),(l,c,u,d)=>{const h=[l.id];if(d&&d.key===l.id&&rs(d,h))return d;const g=(Z(),be($(_h),{id:l.id,key:l.id,"resize-observer":i.value},null,8,["id","resize-observer"]));return g.memo=h,g},a,0),128)):he("",!0)]))}});function Sh(){const{emits:e}=Me();rt(()=>{if(Oi()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new Ae(Pe.MISSING_STYLES))}})}const Nh=q("div",{class:"vue-flow__edge-labels"},null,-1),Ch={name:"VueFlow",compatConfig:{MODE:3}},$h=xe({...Ch,props:{id:{},modelValue:{},nodes:{},edges:{},edgeTypes:{},nodeTypes:{},connectionMode:{},connectionLineType:{},connectionLineStyle:{default:void 0},connectionLineOptions:{default:void 0},connectionRadius:{},isValidConnection:{type:[Function,null],default:void 0},deleteKeyCode:{default:void 0},selectionKeyCode:{type:[Boolean,null],default:void 0},multiSelectionKeyCode:{default:void 0},zoomActivationKeyCode:{default:void 0},panActivationKeyCode:{default:void 0},snapToGrid:{type:Boolean,default:void 0},snapGrid:{},onlyRenderVisibleElements:{type:Boolean,default:void 0},edgesUpdatable:{type:[Boolean,String],default:void 0},nodesDraggable:{type:Boolean,default:void 0},nodesConnectable:{type:Boolean,default:void 0},nodeDragThreshold:{},elementsSelectable:{type:Boolean,default:void 0},selectNodesOnDrag:{type:Boolean,default:void 0},panOnDrag:{type:[Boolean,Array],default:void 0},minZoom:{},maxZoom:{},defaultViewport:{},translateExtent:{},nodeExtent:{},defaultMarkerColor:{},zoomOnScroll:{type:Boolean,default:void 0},zoomOnPinch:{type:Boolean,default:void 0},panOnScroll:{type:Boolean,default:void 0},panOnScrollSpeed:{},panOnScrollMode:{},paneClickDistance:{},zoomOnDoubleClick:{type:Boolean,default:void 0},preventScrolling:{type:Boolean,default:void 0},selectionMode:{},edgeUpdaterRadius:{},fitViewOnInit:{type:Boolean,default:void 0},connectOnClick:{type:Boolean,default:void 0},applyDefault:{type:Boolean,default:void 0},autoConnect:{type:[Boolean,Function],default:void 0},noDragClassName:{},noWheelClassName:{},noPanClassName:{},defaultEdgeOptions:{},elevateEdgesOnSelect:{type:Boolean,default:void 0},elevateNodesOnSelect:{type:Boolean,default:void 0},disableKeyboardA11y:{type:Boolean,default:void 0},edgesFocusable:{type:Boolean,default:void 0},nodesFocusable:{type:Boolean,default:void 0},autoPanOnConnect:{type:Boolean,default:void 0},autoPanOnNodeDrag:{type:Boolean,default:void 0},autoPanSpeed:{}},emits:["nodesChange","edgesChange","nodesInitialized","paneReady","init","updateNodeInternals","error","connect","connectStart","connectEnd","clickConnectStart","clickConnectEnd","moveStart","move","moveEnd","selectionDragStart","selectionDrag","selectionDragStop","selectionContextMenu","selectionStart","selectionEnd","viewportChangeStart","viewportChange","viewportChangeEnd","paneScroll","paneClick","paneContextMenu","paneMouseEnter","paneMouseMove","paneMouseLeave","edgeUpdate","edgeContextMenu","edgeMouseEnter","edgeMouseMove","edgeMouseLeave","edgeDoubleClick","edgeClick","edgeUpdateStart","edgeUpdateEnd","nodeContextMenu","nodeMouseEnter","nodeMouseMove","nodeMouseLeave","nodeDoubleClick","nodeClick","nodeDragStart","nodeDrag","nodeDragStop","miniMapNodeClick","miniMapNodeDoubleClick","miniMapNodeMouseEnter","miniMapNodeMouseMove","miniMapNodeMouseLeave","update:modelValue","update:nodes","update:edges"],setup(e,{expose:t,emit:n}){const o=e,r=ns(),i=Wn(o,"modelValue",n),s=Wn(o,"nodes",n),a=Wn(o,"edges",n),l=Me(o),c=rf({modelValue:i,nodes:s,edges:a},o,l);return af(n,l.hooks),rh(),Sh(),$t(Fn,r),Or(c),t(l),(u,d)=>(Z(),ee("div",{ref:$(l).vueFlowRef,class:"vue-flow"},[oe(Qf,null,{default:me(()=>[oe(yh),Nh,oe(kh),Ie(u.$slots,"zoom-pane")]),_:3}),Ie(u.$slots,"default"),oe(oh)],512))}}),Mh={name:"Panel",compatConfig:{MODE:3}},Ih=xe({...Mh,props:{position:{}},setup(e){const t=e,{userSelectionActive:n}=Me(),o=ie(()=>`${t.position}`.split("-"));return(r,i)=>(Z(),ee("div",{class:ze(["vue-flow__panel",o.value]),style:Re({pointerEvents:$(n)?"none":"all"})},[Ie(r.$slots,"default")],6))}});var tt=(e=>(e.Lines="lines",e.Dots="dots",e))(tt||{});const ji=function({dimensions:e,size:t,color:n}){return ke("path",{stroke:n,"stroke-width":t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})},Xi=function({radius:e,color:t}){return ke("circle",{cx:e,cy:e,r:e,fill:t})};tt.Lines+"",tt.Dots+"";const Th={[tt.Dots]:"#81818a",[tt.Lines]:"#eee"},Oh=["id","x","y","width","height","patternTransform"],Ph={key:2,height:"100",width:"100"},Dh=["fill"],zh=["x","y","fill"],Ah={name:"Background",compatConfig:{MODE:3}},Lh=xe({...Ah,props:{id:{},variant:{default:()=>tt.Dots},gap:{default:20},size:{default:1},lineWidth:{default:1},patternColor:{},color:{},bgColor:{},height:{default:100},width:{default:100},x:{default:0},y:{default:0},offset:{default:0}},setup(e){const{id:t,viewport:n}=Me(),o=ie(()=>{const s=n.value.zoom,[a,l]=Array.isArray(e.gap)?e.gap:[e.gap,e.gap],c=[a*s||1,l*s||1],u=e.size*s,[d,h]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],g=[d*s||1+c[0]/2,h*s||1+c[1]/2];return{scaledGap:c,offset:g,size:u}}),r=Ce(()=>`pattern-${t}${e.id?`-${e.id}`:""}`),i=Ce(()=>e.color||e.patternColor||Th[e.variant||tt.Dots]);return(s,a)=>(Z(),ee("svg",{class:"vue-flow__background vue-flow__container",style:Re({height:`${s.height>100?100:s.height}%`,width:`${s.width>100?100:s.width}%`})},[Ie(s.$slots,"pattern-container",{id:r.value},()=>[q("pattern",{id:r.value,x:$(n).x%o.value.scaledGap[0],y:$(n).y%o.value.scaledGap[1],width:o.value.scaledGap[0],height:o.value.scaledGap[1],patternTransform:`translate(-${o.value.offset[0]},-${o.value.offset[1]})`,patternUnits:"userSpaceOnUse"},[Ie(s.$slots,"pattern",{},()=>[s.variant===$(tt).Lines?(Z(),be($(ji),{key:0,size:s.lineWidth,color:i.value,dimensions:o.value.scaledGap},null,8,["size","color","dimensions"])):s.variant===$(tt).Dots?(Z(),be($(Xi),{key:1,color:i.value,radius:o.value.size/2},null,8,["color","radius"])):he("",!0),s.bgColor?(Z(),ee("svg",Ph,[q("rect",{width:"100%",height:"100%",fill:s.bgColor},null,8,Dh)])):he("",!0)])],8,Oh)]),q("rect",{x:s.x,y:s.y,width:"100%",height:"100%",fill:`url(#${r.value})`},null,8,zh),Ie(s.$slots,"default",{id:r.value})],4))}}),Bh={name:"ControlButton",compatConfig:{MODE:3}},Vh=(e,t)=>{const n=e.__vccOpts||e;for(const[o,r]of t)n[o]=r;return n},Rh={type:"button",class:"vue-flow__controls-button"};function Hh(e,t,n,o,r,i){return Z(),ee("button",Rh,[Ie(e.$slots,"default")])}const gn=Vh(Bh,[["render",Hh]]),Fh={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},Gh=q("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1),Yh=[Gh];function jh(e,t){return Z(),ee("svg",Fh,Yh)}const Xh={render:jh},Wh={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},Uh=q("path",{d:"M0 0h32v4.2H0z"},null,-1),Zh=[Uh];function qh(e,t){return Z(),ee("svg",Wh,Zh)}const Kh={render:qh},Qh={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},Jh=q("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 0 0 27.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.94a.919.919 0 0 1-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"},null,-1),eg=[Jh];function tg(e,t){return Z(),ee("svg",Qh,eg)}const ng={render:tg},og={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},rg=q("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 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-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"},null,-1),ig=[rg];function sg(e,t){return Z(),ee("svg",og,ig)}const ag={render:sg},lg={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ug=q("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 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047z"},null,-1),cg=[ug];function dg(e,t){return Z(),ee("svg",lg,cg)}const fg={render:dg},hg={name:"Controls",compatConfig:{MODE:3}},gg=xe({...hg,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>pi.BottomLeft}},emits:["zoomIn","zoomOut","fitView","interactionChange"],setup(e,{emit:t}){const{nodesDraggable:n,nodesConnectable:o,elementsSelectable:r,setInteractive:i,zoomIn:s,zoomOut:a,fitView:l,viewport:c,minZoom:u,maxZoom:d}=Me(),h=Ce(()=>n.value||o.value||r.value),g=Ce(()=>c.value.zoom<=u.value),b=Ce(()=>c.value.zoom>=d.value);function S(){s(),t("zoomIn")}function k(){a(),t("zoomOut")}function x(){l(e.fitViewParams),t("fitView")}function _(){i(!h.value),t("interactionChange",!h.value)}return(p,y)=>(Z(),be($(Ih),{class:"vue-flow__controls",position:p.position},{default:me(()=>[Ie(p.$slots,"top"),p.showZoom?(Z(),ee($e,{key:0},[Ie(p.$slots,"control-zoom-in",{},()=>[oe(gn,{class:"vue-flow__controls-zoomin",disabled:b.value,onClick:S},{default:me(()=>[Ie(p.$slots,"icon-zoom-in",{},()=>[(Z(),be(He($(Xh))))])]),_:3},8,["disabled"])]),Ie(p.$slots,"control-zoom-out",{},()=>[oe(gn,{class:"vue-flow__controls-zoomout",disabled:g.value,onClick:k},{default:me(()=>[Ie(p.$slots,"icon-zoom-out",{},()=>[(Z(),be(He($(Kh))))])]),_:3},8,["disabled"])])],64)):he("",!0),p.showFitView?Ie(p.$slots,"control-fit-view",{key:1},()=>[oe(gn,{class:"vue-flow__controls-fitview",onClick:x},{default:me(()=>[Ie(p.$slots,"icon-fit-view",{},()=>[(Z(),be(He($(ng))))])]),_:3})]):he("",!0),p.showInteractive?Ie(p.$slots,"control-interactive",{key:2},()=>[p.showInteractive?(Z(),be(gn,{key:0,class:"vue-flow__controls-interactive",onClick:_},{default:me(()=>[h.value?Ie(p.$slots,"icon-unlock",{key:0},()=>[(Z(),be(He($(fg))))]):he("",!0),h.value?he("",!0):Ie(p.$slots,"icon-lock",{key:1},()=>[(Z(),be(He($(ag))))])]),_:3})):he("",!0)]):he("",!0),Ie(p.$slots,"default")]),_:3},8,["position"]))}}),pg={key:0,class:"space-y-2"},vg={class:"flex items-center justify-between gap-2 text-[11px] text-muted-foreground"},mg={class:"shrink-0 font-mono"},yg=["title"],wg={class:"line-clamp-2 text-sm font-medium leading-snug"},_g={class:"flex items-center justify-between gap-2 text-[11px] text-muted-foreground"},xg={class:"flex items-center gap-1.5 text-[10px] uppercase tracking-wide"},bg={class:"rounded bg-background/60 px-1.5 py-0.5"},Eg={class:"rounded bg-background/60 px-1.5 py-0.5"},kg={key:1,class:"space-y-1.5"},Sg={class:"flex items-center gap-2 text-sm font-medium"},Ng={class:"font-mono text-[11px] text-muted-foreground"},Cg=xe({__name:"Node",props:{id:{},type:{},selected:{type:Boolean},connectable:{type:[Boolean,Number,String,Function]},position:{},dimensions:{},label:{},isValidTargetPos:{type:Function},isValidSourcePos:{type:Function},parent:{},parentNodeId:{},dragging:{type:Boolean},resizing:{type:Boolean},zIndex:{},targetPosition:{},sourcePosition:{},dragHandle:{},data:{},events:{}},setup(e){const t=e,n=ie(()=>t.data),o=ie(()=>n.value.kind==="task"?n.value:null),r=ie(()=>n.value.kind==="external"?n.value:null),i=ie(()=>{if(n.value.kind!=="task")return{label:"Missing dependency",icon:Mt,class:"text-amber-600 dark:text-amber-400"};switch(n.value.status){case"completed":return{label:"Completed",icon:En,class:"text-emerald-600 dark:text-emerald-400"};case"in_progress":return{label:"In Progress",icon:Lr,class:"text-blue-600 dark:text-blue-400"};default:return{label:"Pending",icon:Gt,class:"text-muted-foreground"}}}),s=ie(()=>n.value.kind!=="task"?null:n.value.priority.replace("_"," ")),a=ie(()=>n.value.kind!=="task"?null:n.value.category),l=ie(()=>n.value.kind==="external"?["border-amber-500/60 bg-amber-50/70 text-amber-900 dark:border-amber-500/40 dark:bg-amber-500/10 dark:text-amber-100","border-dashed"]:n.value.status==="completed"?["border-emerald-500/40 bg-emerald-50/70 text-emerald-950 dark:border-emerald-500/40 dark:bg-emerald-500/10 dark:text-emerald-100","border-solid"]:n.value.status==="in_progress"?["border-blue-500/40 bg-blue-50/80 text-blue-950 dark:border-blue-500/40 dark:bg-blue-500/10 dark:text-blue-100","border-solid"]:["border-border bg-card text-card-foreground","border-solid"]),c=ie(()=>n.value.kind!=="task"||!n.value.showPrdLabel?null:n.value.prdName?.trim()||n.value.prdSlug);return(u,d)=>(Z(),ee("div",{class:ze(["w-[17rem] rounded-xl border px-3 py-2 shadow-sm transition-[transform,box-shadow,border-color] duration-150 ease-[var(--ease-out-cubic)] motion-reduce:transition-none",[$(l),e.selected?"ring-2 ring-primary/30 shadow-md":"hover:shadow-md hover:border-primary/40"]])},[oe($(Dt),{type:"target",position:$(ue).Top,class:"!h-2 !w-2 !border-0 !bg-transparent !opacity-0 !pointer-events-none"},null,8,["position"]),$(o)?(Z(),ee("div",pg,[q("div",vg,[q("span",mg,fe($(o).taskId),1),$(c)?(Z(),ee("span",{key:0,title:`${$(o).prdName} (${$(o).prdSlug})`,class:"max-w-[11rem] truncate rounded border border-border bg-background/60 px-1.5 py-0.5 text-[10px]"},fe($(c)),9,yg)):he("",!0)]),q("p",wg,fe($(o).title),1),q("div",_g,[q("div",{class:ze(["flex items-center gap-1.5",$(i).class])},[(Z(),be(He($(i).icon),{class:"size-3.5"})),q("span",null,fe($(i).label),1)],2),q("div",xg,[q("span",bg,fe($(a)),1),q("span",Eg,fe($(s)),1)])])])):$(r)?(Z(),ee("div",kg,[q("div",Sg,[oe($(Mt),{class:"size-4"}),q("span",null,fe($(r).title),1)]),q("p",Ng,fe($(r).dependencyRef),1)])):he("",!0),oe($(Dt),{type:"source",position:$(ue).Bottom,class:"!h-2 !w-2 !border-0 !bg-transparent !opacity-0 !pointer-events-none"},null,8,["position"])],2))}}),Mr=Object.assign(Cg,{__name:"GraphNode"}),$g={class:"relative h-full overflow-hidden rounded-lg border border-border bg-card"},Mg={key:0,class:"flex h-full items-center justify-center"},Ig={class:"flex flex-col items-center gap-2 text-sm text-muted-foreground"},Tg={key:1,class:"flex h-full items-center justify-center p-6"},Og={class:"max-w-sm text-center"},Pg={class:"mt-1 text-sm text-muted-foreground"},Dg={key:2,class:"flex h-full items-center justify-center p-6"},zg={class:"max-w-sm text-center"},Ag={class:"mt-1 text-sm text-muted-foreground"},Lg={key:4,class:"pointer-events-none absolute top-3 left-3 z-10 rounded-md border border-border bg-background/95 p-2.5 shadow-sm"},Bg={class:"space-y-1 text-xs"},Vg={class:"flex items-center gap-1.5 text-muted-foreground"},Rg={class:"flex items-center gap-1.5 text-blue-600 dark:text-blue-400"},Hg={class:"flex items-center gap-1.5 text-emerald-600 dark:text-emerald-400"},Fg={class:"flex items-center gap-1.5 text-amber-600 dark:text-amber-400"},Gg={key:5,class:"pointer-events-none absolute top-3 right-3 z-10 rounded-md border border-border bg-background/95 p-2.5 shadow-sm"},Yg={class:"flex flex-wrap items-center gap-1.5 text-[11px] text-muted-foreground"},jg={class:"rounded bg-muted px-1.5 py-0.5"},Xg={class:"rounded bg-blue-500/10 px-1.5 py-0.5 text-blue-700 dark:text-blue-300"},Wg={class:"rounded bg-emerald-500/10 px-1.5 py-0.5 text-emerald-700 dark:text-emerald-300"},Ug={class:"rounded bg-amber-500/10 px-1.5 py-0.5 text-amber-700 dark:text-amber-300"},Zg=xe({__name:"Explorer",props:{payload:{},scope:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["taskClick"],setup(e,{emit:t}){const n=e,o=t,r={task:kt(Mr),external:kt(Mr)},i=Ki("(prefers-reduced-motion: reduce)"),s=ve(0);ye(()=>[n.scope,n.payload?.scope,n.payload?.nodes.length,n.payload?.edges.length],()=>{s.value+=1},{deep:!1});const a=ie(()=>`${n.scope}-${s.value}`),l=ie(()=>n.payload?n.payload.nodes.some(k=>k.kind==="task"):!1),c=ie(()=>n.payload?.stats);function u(k,x){return k.kind==="external"?{width:272,height:80}:x==="repo"?{width:272,height:116}:{width:272,height:96}}function d(k){return k==="repo"?{ranksep:136,nodesep:88,edgesep:34,marginx:36,marginy:28}:{ranksep:102,nodesep:56,edgesep:20,marginx:24,marginy:22}}function h(k,x){const _=new Vo.graphlib.Graph,p=d(n.scope);_.setDefaultEdgeLabel(()=>({})),_.setGraph({rankdir:"TB",ranker:"network-simplex",...p});for(const y of k){const D=u(y.data,n.scope);_.setNode(y.id,D)}for(const y of x)_.setEdge(y.source,y.target);return Vo.layout(_),k.map(y=>{const D=u(y.data,n.scope),R=_.node(y.id);return R?{...y,targetPosition:ue.Top,sourcePosition:ue.Bottom,position:{x:R.x-D.width/2,y:R.y-D.height/2}}:y})}const g=ie(()=>n.payload?n.payload.edges.map(k=>({id:k.id,source:k.source,target:k.target,type:"step",animated:k.unresolved&&!i.value,markerEnd:{type:On.ArrowClosed,width:16,height:16},style:{strokeWidth:k.unresolved?1.4:1.7,stroke:k.unresolved?"var(--muted-foreground)":"var(--border)",strokeOpacity:k.unresolved?.62:.95,strokeDasharray:k.unresolved?"5 4":void 0}})):[]),b=ie(()=>{if(!n.payload)return[];const k=n.payload.nodes.map(x=>({id:x.id,type:x.kind,data:{...x,showPrdLabel:x.kind==="task"?n.scope==="repo":void 0},draggable:!1,selectable:x.kind==="task",connectable:!1,position:{x:0,y:0}}));return h(k,g.value)});function S(k){const _=k.node.data;!_||_.kind!=="task"||o("taskClick",{prdSlug:_.prdSlug,taskId:_.taskId})}return(k,x)=>(Z(),ee("div",$g,[e.loading?(Z(),ee("div",Mg,[q("div",Ig,[oe($(ro),{class:"size-5 animate-spin"}),x[0]||(x[0]=q("span",null,"Building graph...",-1))])])):e.error?(Z(),ee("div",Tg,[q("div",Og,[oe($(bn),{class:"mx-auto mb-3 size-8 text-destructive"}),x[1]||(x[1]=q("p",{class:"text-sm font-medium"},"Graph unavailable",-1)),q("p",Pg,fe(e.error),1)])])):!e.payload||!$(l)?(Z(),ee("div",Dg,[q("div",zg,[oe($(gs),{class:"mx-auto mb-3 size-8 text-muted-foreground/60"}),x[2]||(x[2]=q("p",{class:"text-sm font-medium"},"No graphable tasks yet",-1)),q("p",Ag,fe(e.scope==="repo"?"No PRDs with task state were found in this repository.":"This PRD does not have generated tasks yet."),1)])])):(Z(),be($($h),{key:$(a),nodes:$(b),edges:$(g),"node-types":r,"fit-view-on-init":!0,"fit-view-on-init-options":{padding:.2},"nodes-draggable":!1,"nodes-connectable":!1,"elements-selectable":!0,"zoom-on-scroll":!0,"pan-on-drag":!0,"min-zoom":.2,"max-zoom":1.8,class:"h-full",onNodeClick:S},{default:me(()=>[oe($(Lh),{gap:20,size:1.2,variant:"dots",color:"var(--border)"}),oe($(gg),{position:"bottom-left","show-interactive":!1})]),_:1},8,["nodes","edges"])),e.payload&&$(l)?(Z(),ee("div",Lg,[x[7]||(x[7]=q("p",{class:"mb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground"},"Legend",-1)),q("div",Bg,[q("div",Vg,[oe($(Gt),{class:"size-3.5"}),x[3]||(x[3]=Se(" Pending ",-1))]),q("div",Rg,[oe($(Lr),{class:"size-3.5"}),x[4]||(x[4]=Se(" In Progress ",-1))]),q("div",Hg,[oe($(En),{class:"size-3.5"}),x[5]||(x[5]=Se(" Completed ",-1))]),q("div",Fg,[oe($(Mt),{class:"size-3.5"}),x[6]||(x[6]=Se(" Missing dependency ",-1))])])])):he("",!0),$(c)&&$(l)?(Z(),ee("div",Gg,[q("div",Yg,[q("span",jg,"Total "+fe($(c).total),1),q("span",Xg,"WIP "+fe($(c).inProgress),1),q("span",Wg,"Done "+fe($(c).completed),1),q("span",Ug,"Missing "+fe($(c).unresolved),1)])])):he("",!0)]))}}),im=Object.assign(Zg,{__name:"GraphExplorer"}),qg={class:"space-y-0.5 p-2"},Kg=["onClick"],Qg={class:"min-w-0 flex-1"},Jg=["title"],ep={class:"text-muted-foreground"},tp={class:"mt-1 flex h-1.5 w-full overflow-hidden rounded-full bg-muted"},np={class:"flex shrink-0 items-center gap-1 text-xs"},op={key:0,class:"text-green-600 dark:text-green-400"},rp={key:1,class:"text-red-600 dark:text-red-400"},ip={key:0,class:"py-4 text-center text-sm text-muted-foreground"},sp=xe({__name:"ChangesMinimap",props:{files:{},selectedFile:{}},emits:["select"],setup(e,{emit:t}){const n=e,o=t,r=ie(()=>n.files.length===0?1:Math.max(...n.files.map(u=>u.additions+u.deletions),1));function i(u){switch(u){case"added":return{icon:Vs,class:"text-green-600 dark:text-green-400"};case"deleted":return{icon:Rs,class:"text-red-600 dark:text-red-400"};case"renamed":return{icon:Bo,class:"text-blue-600 dark:text-blue-400"};default:return{icon:Bs,class:"text-yellow-600 dark:text-yellow-400"}}}function s(u){const d=u.additions+u.deletions;if(d===0)return{additions:0,deletions:0,total:0};const h=d/r.value*100,g=u.additions/d*h,b=u.deletions/d*h;return{additions:g,deletions:b,total:h}}function a(u){return u.status==="renamed"&&u.oldPath?`${u.oldPath} → ${u.path}`:u.path}function l(u){return u.split("/").pop()||u}function c(u){o("select",u)}return(u,d)=>(Z(),ee("div",qg,[(Z(!0),ee($e,null,Ve(e.files,h=>(Z(),ee("button",{key:h.path,class:ze(["group flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-sm transition-colors hover:bg-muted/50",{"bg-muted":e.selectedFile===h.path}]),onClick:g=>c(h.path)},[(Z(),be(He(i(h.status).icon),{class:ze(["size-4 shrink-0",i(h.status).class])},null,8,["class"])),q("div",Qg,[q("div",{class:ze(["truncate text-xs",{"font-medium":e.selectedFile===h.path}]),title:a(h)},[h.status==="renamed"&&h.oldPath?(Z(),ee($e,{key:0},[q("span",ep,fe(l(h.oldPath)),1),oe($(Bo),{class:"mx-1 inline size-3 text-muted-foreground"}),q("span",null,fe(l(h.path)),1)],64)):(Z(),ee($e,{key:1},[Se(fe(h.path),1)],64))],10,Jg),q("div",tp,[s(h).additions>0?(Z(),ee("div",{key:0,class:"bg-green-500 dark:bg-green-400",style:Re({width:`${s(h).additions}%`})},null,4)):he("",!0),s(h).deletions>0?(Z(),ee("div",{key:1,class:"bg-red-500 dark:bg-red-400",style:Re({width:`${s(h).deletions}%`})},null,4)):he("",!0)])]),q("div",np,[h.additions>0?(Z(),ee("span",op," +"+fe(h.additions),1)):he("",!0),h.deletions>0?(Z(),ee("span",rp," -"+fe(h.deletions),1)):he("",!0)])],10,Kg))),128)),e.files.length===0?(Z(),ee("div",ip," No files changed ")):he("",!0)]))}}),ap=Object.assign(sp,{__name:"GitChangesMinimap"}),lp={class:"diff-viewer"},up={key:0,class:"flex items-center justify-center py-8"},cp={key:1,class:"flex flex-col items-center justify-center gap-3 py-12 text-muted-foreground"},dp={key:2,class:"flex flex-col items-center justify-center gap-3 py-12 text-muted-foreground"},fp={key:3,class:"diff-container"},hp={class:"flex flex-col items-center justify-center gap-3 border-b border-border bg-muted/30 py-6"},gp={class:"text-center"},pp={class:"text-sm text-muted-foreground"},vp={key:4,class:"diff-container"},mp={class:"full-file-view"},yp={class:"diff-gutter"},wp={class:"line-number"},_p={class:"diff-content"},xp=["innerHTML"],bp={key:5,class:"diff-container"},Ep={class:"diff-toolbar"},kp={class:"diff-split"},Sp={class:"diff-column-content"},Np={key:0,class:"diff-separator-half"},Cp={class:"diff-gutter"},$p={key:0,class:"line-number"},Mp={class:"diff-content"},Ip=["innerHTML"],Tp={class:"diff-column-content"},Op={key:0,class:"diff-separator-half"},Pp={class:"diff-gutter"},Dp={key:0,class:"line-number"},zp={class:"diff-content"},Ap=["innerHTML"],Ir=1e4,Tr=1500,Lp=4e3,Bp=xe({__name:"DiffViewer",props:{hunks:{},filePath:{},binary:{type:Boolean},oldPath:{},fileContent:{},showFullFile:{type:Boolean},isLoadingContent:{type:Boolean}},setup(e){const t=e,n=ve(!1),o=ve(!0),r=ve(null),i=ve(null),s=ve(!1);function a(M){if(!o.value||s.value)return;const f=M.target;i.value&&(s.value=!0,i.value.scrollLeft=f.scrollLeft,requestAnimationFrame(()=>{s.value=!1}))}function l(M){if(!o.value||s.value)return;const f=M.target;r.value&&(s.value=!0,r.value.scrollLeft=f.scrollLeft,requestAnimationFrame(()=>{s.value=!1}))}const c=ie(()=>{let M=0;for(const f of t.hunks)M+=f.lines.length;return M}),u=ie(()=>c.value>Ir),d=ie(()=>t.hunks.length===0&&!t.binary),h=ie(()=>{const M=new Set,f=new Set;for(const w of t.hunks)for(const v of w.lines)v.type==="add"&&v.newNumber!==void 0&&M.add(v.newNumber),v.type==="remove"&&v.oldNumber!==void 0&&f.add(v.oldNumber);return{added:M,removed:f}}),g=ie(()=>t.fileContent?t.fileContent.split(`
28
+ `):[]);function b(M){const f=M.split(".").pop()?.toLowerCase()||"";return{ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",vue:"vue",svelte:"svelte",py:"python",rb:"ruby",rs:"rust",go:"go",java:"java",kt:"kotlin",swift:"swift",dart:"dart",c:"c",cpp:"cpp",h:"c",hpp:"cpp",cs:"csharp",php:"php",html:"html",css:"css",scss:"scss",sass:"sass",less:"less",json:"json",yaml:"yaml",yml:"yaml",toml:"toml",xml:"xml",md:"markdown",mdx:"mdx",sh:"bash",bash:"bash",zsh:"bash",fish:"fish",ps1:"powershell",sql:"sql",graphql:"graphql",gql:"graphql",dockerfile:"dockerfile",makefile:"makefile"}[f]||"text"}const S=ie(()=>b(t.filePath)),k=ve(new Map),x=ve(!0),_=new Map;let p=null;async function y(){return p||(p=cs(()=>import("./D30YtxUg.js"),__vite__mapDeps([0,1,2,3]),import.meta.url).then(M=>M.codeToHtml)),p}const D=ie(()=>{const M=[];for(let f=0;f<t.hunks.length;f++){const w=t.hunks[f];f>0&&M.push({type:"separator",hunkIndex:f});const v=w.lines;let C=0;for(;C<v.length;){const z=v[C];if(z.type==="context")M.push({type:"line",pair:{id:`${f}-${C}`,left:{lineNum:z.oldNumber,content:z.content,type:"context"},right:{lineNum:z.newNumber,content:z.content,type:"context"}}}),C++;else if(z.type==="remove"){const F=[],B=[];for(;C<v.length&&v[C].type==="remove";)F.push(v[C]),C++;for(;C<v.length&&v[C].type==="add";)B.push(v[C]),C++;const G=Math.max(F.length,B.length);for(let U=0;U<G;U++){const K=F[U],T=B[U];M.push({type:"line",pair:{id:`${f}-${C-G+U}`,left:K?{lineNum:K.oldNumber,content:K.content,type:"remove"}:{content:"",type:"empty"},right:T?{lineNum:T.newNumber,content:T.content,type:"add"}:{content:"",type:"empty"}}})}}else z.type==="add"&&M.push({type:"line",pair:{id:`${f}-${C}`,left:{content:"",type:"empty"},right:{lineNum:z.newNumber,content:z.content,type:"add"}}}),C++}}return M});async function R(M,f){if(!M.trim())return"";const w=`${f}:${M}`,v=_.get(w);if(v!==void 0)return v;try{const F=(await(await y())(M,{lang:f,themes:{light:"catppuccin-latte",dark:"catppuccin-mocha"}})).match(/<code[^>]*>([\s\S]*?)<\/code>/),B=F?F[1]||"":H(M);return _.set(w,B),B}catch{const C=H(M);return _.set(w,C),C}}async function Y(M,f){if(!M)return[];const w=M.split(`
29
+ `);if(w.length>Lp)return w.map(H);try{const z=(await(await y())(M,{lang:f,themes:{light:"catppuccin-latte",dark:"catppuccin-mocha"}})).match(/<code[^>]*>([\s\S]*?)<\/code>/);return!z||!z[1]?w.map(H):z[1].split(`
30
+ `)}catch{return w.map(H)}}function H(M){return M.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}const Q=ve([]),O=ve(!1);ye(()=>[t.fileContent,t.filePath],async([M])=>{if(!M){Q.value=[];return}O.value=!0;const f=S.value;Q.value=await Y(M,f),O.value=!1},{immediate:!0}),ye(()=>[t.hunks,t.filePath,Q.value],async()=>{x.value=!0;const M=S.value,f=new Map,w=Q.value,v=[];for(const B of D.value)if(B.type==="line"&&B.pair){if(B.pair.left.content&&B.pair.left.type!=="empty"){const G=`${B.pair.id}-old`;if(B.pair.left.type==="context"&&B.pair.left.lineNum&&w.length>0){const U=B.pair.right.lineNum?B.pair.right.lineNum-1:-1;U>=0&&U<w.length?f.set(G,w[U]||""):v.push({key:G,content:B.pair.left.content})}else v.push({key:G,content:B.pair.left.content})}if(B.pair.right.content&&B.pair.right.type!=="empty"){const G=`${B.pair.id}-new`,U=B.pair.right.lineNum;U&&w.length>0&&U<=w.length?f.set(G,w[U-1]||""):v.push({key:G,content:B.pair.right.content})}}const C=v.slice(0,Tr),z=v.slice(Tr);for(const{key:B,content:G}of z)f.set(B,H(G));const F=50;for(let B=0;B<C.length;B+=F){const G=C.slice(B,B+F),U=await Promise.all(G.map(async({key:K,content:T})=>{const m=await R(T,M);return{key:K,result:m}}));for(const{key:K,result:T}of U)f.set(K,T)}k.value=f,x.value=!1},{immediate:!0});function A(M,f){return k.value.get(`${M}-${f}`)||""}function E(M){return h.value.added.has(M)?"add":"context"}return(M,f)=>(Z(),ee("div",lp,[($(x)||e.isLoadingContent||$(O))&&!e.binary?(Z(),ee("div",up,[...f[2]||(f[2]=[q("div",{class:"size-6 animate-spin rounded-full border-2 border-primary border-t-transparent"},null,-1)])])):e.binary?(Z(),ee("div",cp,[oe($(Ls),{class:"size-10 opacity-50"}),f[3]||(f[3]=q("div",{class:"text-center"},[q("p",{class:"font-medium"},"Binary file"),q("p",{class:"text-sm"},"This file cannot be displayed as a diff")],-1))])):$(d)&&!e.showFullFile?(Z(),ee("div",dp,[oe($(Mt),{class:"size-10 opacity-50"}),f[4]||(f[4]=q("div",{class:"text-center"},[q("p",{class:"font-medium"},"No changes"),q("p",{class:"text-sm"},"This file was touched but has no content changes")],-1))])):$(u)&&!$(n)&&!e.showFullFile?(Z(),ee("div",fp,[q("div",hp,[oe($(Mt),{class:"size-8 text-yellow-500"}),q("div",gp,[f[5]||(f[5]=q("p",{class:"font-medium"},"Large file",-1)),q("p",pp," This file has "+fe($(c).toLocaleString())+" lines (threshold: "+fe(Ir.toLocaleString())+") ",1)]),oe($(ct),{variant:"outline",size:"sm",onClick:f[0]||(f[0]=w=>n.value=!0)},{default:me(()=>[oe($(ps),{class:"mr-2 size-4"}),f[6]||(f[6]=Se(" Show full diff ",-1))]),_:1})])])):e.showFullFile&&e.fileContent?(Z(),ee("div",vp,[q("div",mp,[(Z(!0),ee($e,null,Ve($(g),(w,v)=>(Z(),ee("div",{key:v,class:ze(["full-file-line",{"diff-add":E(v+1)==="add"}])},[q("div",yp,[q("span",wp,fe(v+1),1)]),q("div",_p,[q("span",{class:"diff-code",innerHTML:$(Q)[v]||H(w)},null,8,xp)])],2))),128))])])):(Z(),ee("div",bp,[q("div",Ep,[oe($(ct),{variant:"ghost",size:"sm",class:ze(["h-7 gap-1.5 text-xs",{"text-primary":$(o)}]),onClick:f[1]||(f[1]=w=>o.value=!$(o))},{default:me(()=>[(Z(),be(He($(o)?$(js):$(Gs)),{class:"size-3.5"})),Se(" "+fe($(o)?"Sync scroll":"Scroll unlocked"),1)]),_:1},8,["class"])]),q("div",kp,[q("div",{ref_key:"leftScrollRef",ref:r,class:"diff-column diff-column-left",onScroll:a},[q("div",Sp,[(Z(!0),ee($e,null,Ve($(D),w=>(Z(),ee($e,{key:w.type==="line"?`left-${w.pair?.id}`:`left-sep-${w.hunkIndex}`},[w.type==="separator"?(Z(),ee("div",Np,[...f[7]||(f[7]=[q("div",{class:"separator-line"},null,-1),q("span",{class:"separator-text"},"···",-1)])])):w.pair?(Z(),ee("div",{key:1,class:ze(["diff-line",{"diff-remove":w.pair.left.type==="remove","diff-empty":w.pair.left.type==="empty","diff-context":w.pair.left.type==="context"}])},[q("div",Cp,[w.pair.left.lineNum?(Z(),ee("span",$p,fe(w.pair.left.lineNum),1)):he("",!0)]),q("div",Mp,[w.pair.left.type!=="empty"?(Z(),ee("span",{key:0,class:"diff-code",innerHTML:A(w.pair.id,"old")||H(w.pair.left.content)},null,8,Ip)):he("",!0)])],2)):he("",!0)],64))),128))])],544),q("div",{ref_key:"rightScrollRef",ref:i,class:"diff-column diff-column-right",onScroll:l},[q("div",Tp,[(Z(!0),ee($e,null,Ve($(D),w=>(Z(),ee($e,{key:w.type==="line"?`right-${w.pair?.id}`:`right-sep-${w.hunkIndex}`},[w.type==="separator"?(Z(),ee("div",Op,[...f[8]||(f[8]=[q("span",{class:"separator-text"},"···",-1),q("div",{class:"separator-line"},null,-1)])])):w.pair?(Z(),ee("div",{key:1,class:ze(["diff-line",{"diff-add":w.pair.right.type==="add","diff-empty":w.pair.right.type==="empty","diff-context":w.pair.right.type==="context"}])},[q("div",Pp,[w.pair.right.lineNum?(Z(),ee("span",Dp,fe(w.pair.right.lineNum),1)):he("",!0)]),q("div",zp,[w.pair.right.type!=="empty"?(Z(),ee("span",{key:0,class:"diff-code",innerHTML:A(w.pair.id,"new")||H(w.pair.right.content)},null,8,Ap)):he("",!0)])],2)):he("",!0)],64))),128))])],544)])]))]))}}),Vp=Object.assign($s(Bp,[["__scopeId","data-v-a5da7e6e"]]),{__name:"GitDiffViewer"});function Wi(){const{showError:e}=Qi();function t(u){if(u&&typeof u=="object"){const d=u;return d.data?.message||d.data?.statusMessage||d.message||"Unknown error"}return"Unknown error"}const n=ve(!1),o=ve(!1),r=ve(!1),i=ve(!1);async function s(u,d,h){if(!u||d.length===0)return{commits:[],failedShas:[]};n.value=!0;try{const g={shas:d.join(",")};h&&(g.repo=h);const b=await $fetch(`/api/repos/${u}/git/commits`,{query:g}),S=b.map(x=>x.shortSha),k=d.filter(x=>!S.some(_=>_.startsWith(x)||x.startsWith(_)));return{commits:b,failedShas:k}}catch(g){return e("Failed to fetch commits",t(g)),{commits:[],failedShas:d}}finally{n.value=!1}}async function a(u,d,h){if(!u||!d)return[];o.value=!0;try{const g={commit:d};return h&&(g.repo=h),await $fetch(`/api/repos/${u}/git/diff`,{query:g})}catch(g){throw e("Failed to fetch diff",t(g)),g}finally{o.value=!1}}async function l(u,d,h,g){if(!u||!d||!h)return[];r.value=!0;try{const b={commit:d,file:h};return g&&(b.repo=g),await $fetch(`/api/repos/${u}/git/file-diff`,{query:b})}catch(b){throw e("Failed to fetch file diff",t(b)),b}finally{r.value=!1}}async function c(u,d,h,g){if(!u||!d||!h)return null;i.value=!0;try{const b={commit:d,file:h};return g&&(b.repo=g),(await $fetch(`/api/repos/${u}/git/file-content`,{query:b})).content}catch(b){throw e("Failed to fetch file content",t(b)),b}finally{i.value=!1}}return{fetchCommits:s,fetchDiff:a,fetchFileDiff:l,fetchFileContent:c,isLoadingCommits:Vt(n),isLoadingDiff:Vt(o),isLoadingFileDiff:Vt(r),isLoadingFileContent:Vt(i)}}const Rp={key:0,class:"flex flex-1 flex-col items-center justify-center gap-4 p-8"},Hp={class:"text-center"},Fp={class:"text-sm text-muted-foreground"},Gp={key:1,class:"flex flex-1 items-center justify-center"},Yp={key:2,class:"flex flex-1 flex-col items-center justify-center gap-2 p-8 text-center text-muted-foreground"},jp={key:3,class:"flex min-h-0 flex-1 overflow-hidden"},Xp={class:"flex w-56 shrink-0 flex-col border-r border-border"},Wp={class:"flex items-center justify-between border-b border-border px-3 py-2"},Up={class:"text-xs font-medium text-muted-foreground"},Zp={class:"text-muted-foreground/50 transition-colors hover:text-muted-foreground"},qp={class:"min-h-0 flex-1 overflow-y-auto"},Kp={class:"flex min-h-0 flex-1 flex-col overflow-hidden"},Qp={key:0,class:"flex items-center gap-2 border-b border-border px-4 py-2"},Jp={key:0,class:"min-w-0 flex-1 truncate font-mono text-sm"},ev={class:"text-muted-foreground"},tv={key:1,class:"min-w-0 flex-1 truncate font-mono text-sm"},nv={key:2,class:"rounded bg-yellow-500/10 px-1.5 py-0.5 text-xs text-yellow-600 dark:text-yellow-400"},ov={key:1,class:"flex flex-1 items-center justify-center"},rv={key:2,class:"flex flex-1 flex-col items-center justify-center gap-4 p-8"},iv={class:"text-center"},sv={class:"text-xs text-muted-foreground"},av={key:4,class:"flex flex-1 items-center justify-center text-sm text-muted-foreground"},lv=xe({__name:"DiffPanel",props:{repoId:{},commitSha:{},repoPath:{}},emits:["close"],setup(e,{emit:t}){const n=e,o=t,{fetchDiff:r,fetchFileDiff:i,fetchFileContent:s,isLoadingDiff:a,isLoadingFileDiff:l,isLoadingFileContent:c}=Wi(),u=ve([]),d=ve(),h=ve([]),g=ve(null),b=ve(null),S=ve(null),k=ve("changes");function x(f,w){if(f&&typeof f=="object"){const v=f;return v.data?.message||v.data?.statusMessage||v.statusMessage||v.message||w}return w}const _=ie(()=>u.value.find(f=>f.path===d.value));async function p(){b.value=null,u.value=[],d.value=void 0,h.value=[],g.value=null;try{const f=await r(n.repoId,n.commitSha,n.repoPath);u.value=f,f.length>0&&(d.value=f[0].path)}catch(f){b.value=x(f,"Could not load commit diff.")}}async function y(){if(!d.value){h.value=[],g.value=null;return}S.value=null;try{const f=await i(n.repoId,n.commitSha,d.value,n.repoPath);if(h.value=f,k.value==="full"){const w=await s(n.repoId,n.commitSha,d.value,n.repoPath);g.value=w}else g.value=null}catch(f){S.value=x(f,"Could not load file diff.")}}function D(){k.value=k.value==="changes"?"full":"changes"}ye(k,async f=>{if(f==="full"&&d.value&&!g.value)try{const w=await s(n.repoId,n.commitSha,d.value,n.repoPath);g.value=w,S.value=null}catch(w){S.value=x(w,"Could not load file content.")}});function R(f){d.value=f}function Y(){p()}function H(){y()}ye(d,()=>{y()}),ye(()=>[n.repoId,n.commitSha,n.repoPath],()=>{p()},{immediate:!0});const Q=ve(null),O=ve(null);function A(f){if(u.value.length===0)return;const w=d.value?u.value.findIndex(z=>z.path===d.value):-1;let v;f==="next"?v=w<u.value.length-1?w+1:0:v=w>0?w-1:u.value.length-1;const C=u.value[v];C&&(d.value=C.path)}function E(f){if(!O.value)return;const w=O.value.querySelectorAll(".diff-separator");if(w.length===0)return;const v=O.value.closest(".overflow-y-auto, [data-radix-scroll-area-viewport]");if(!v)return;const C=v.scrollTop,z=v.getBoundingClientRect();let F=null;if(f==="next"){for(const B of w)if(B.getBoundingClientRect().top-z.top+C>C+50){F=B;break}!F&&w.length>0&&(F=w[0])}else{for(let B=w.length-1;B>=0;B--){const G=w[B];if(G.getBoundingClientRect().top-z.top+C<C-10){F=G;break}}!F&&w.length>0&&(F=w[w.length-1])}F&&F.scrollIntoView({behavior:"smooth",block:"start"})}function M(f){if(!(f.target instanceof HTMLInputElement||f.target instanceof HTMLTextAreaElement))switch(f.key){case"j":case"ArrowDown":!f.ctrlKey&&!f.metaKey&&(f.preventDefault(),A("next"));break;case"k":case"ArrowUp":!f.ctrlKey&&!f.metaKey&&(f.preventDefault(),A("prev"));break;case"[":f.preventDefault(),E("prev");break;case"]":f.preventDefault(),E("next");break;case"Escape":f.preventDefault(),o("close");break}}return rt(()=>{document.addEventListener("keydown",M)}),Or(()=>{document.removeEventListener("keydown",M)}),(f,w)=>{const v=ap,C=Vp;return Z(),ee("div",{ref_key:"panelRef",ref:Q,class:"flex h-full flex-col overflow-hidden",tabindex:"-1"},[$(b)?(Z(),ee("div",Rp,[oe($(bn),{class:"size-12 text-destructive"}),q("div",Hp,[w[0]||(w[0]=q("p",{class:"font-medium"},"Failed to load diff",-1)),q("p",Fp,fe($(b)),1)]),oe($(ct),{variant:"outline",size:"sm",onClick:Y},{default:me(()=>[oe($(Po),{class:"mr-2 size-4"}),w[1]||(w[1]=Se(" Retry ",-1))]),_:1})])):$(a)&&$(u).length===0?(Z(),ee("div",Gp,[oe($(ro),{class:"size-8 animate-spin text-muted-foreground"})])):$(u).length===0?(Z(),ee("div",Yp,[...w[2]||(w[2]=[q("p",null,"No files changed in this commit",-1)])])):(Z(),ee("div",jp,[q("div",Xp,[q("div",Wp,[q("span",Up,fe($(u).length)+" file"+fe($(u).length!==1?"s":"")+" changed ",1),oe($(Do),null,{default:me(()=>[oe($(zo),null,{default:me(()=>[oe($(Ao),{"as-child":""},{default:me(()=>[q("button",Zp,[oe($(vs),{class:"size-3.5"})])]),_:1}),oe($(Lo),{side:"bottom",align:"end",class:"max-w-xs"},{default:me(()=>[...w[3]||(w[3]=[q("div",{class:"space-y-1 text-xs"},[q("div",{class:"flex justify-between gap-4"},[q("span",{class:"text-muted-foreground"},"Navigate files"),q("span",{class:"font-mono"},"j/k or ↑/↓")]),q("div",{class:"flex justify-between gap-4"},[q("span",{class:"text-muted-foreground"},"Jump to hunk"),q("span",{class:"font-mono"},"[ / ]")]),q("div",{class:"flex justify-between gap-4"},[q("span",{class:"text-muted-foreground"},"Close"),q("span",{class:"font-mono"},"Esc")])],-1)])]),_:1})]),_:1})]),_:1})]),q("div",qp,[oe(v,{files:$(u),"selected-file":$(d),onSelect:R},null,8,["files","selected-file"])])]),q("div",Kp,[$(d)?(Z(),ee("div",Qp,[$(_)?.oldPath?(Z(),ee("span",Jp,[q("span",ev,fe($(_).oldPath),1),w[4]||(w[4]=q("span",{class:"mx-2 text-muted-foreground"},"→",-1)),q("span",null,fe($(d)),1)])):(Z(),ee("span",tv,fe($(d)),1)),$(_)?.binary?(Z(),ee("span",nv," binary ")):he("",!0),$(_)?.binary?he("",!0):(Z(),be($(Do),{key:3},{default:me(()=>[oe($(zo),null,{default:me(()=>[oe($(Ao),{"as-child":""},{default:me(()=>[oe($(ct),{variant:"ghost",size:"sm",class:"h-7 shrink-0 gap-1.5 text-xs",onClick:D},{default:me(()=>[(Z(),be(He($(k)==="changes"?$(As):$(zs)),{class:"size-3.5"})),Se(" "+fe($(k)==="changes"?"Changes":"Full file"),1)]),_:1})]),_:1}),oe($(Lo),null,{default:me(()=>[Se(fe($(k)==="changes"?"Show full file with changes":"Show changes only"),1)]),_:1})]),_:1})]),_:1}))])):he("",!0),$(l)?(Z(),ee("div",ov,[oe($(ro),{class:"size-6 animate-spin text-muted-foreground"})])):$(S)?(Z(),ee("div",rv,[oe($(bn),{class:"size-8 text-destructive"}),q("div",iv,[w[5]||(w[5]=q("p",{class:"text-sm font-medium"},"Failed to load file diff",-1)),q("p",sv,fe($(S)),1)]),oe($(ct),{variant:"outline",size:"sm",onClick:H},{default:me(()=>[oe($(Po),{class:"mr-2 size-4"}),w[6]||(w[6]=Se(" Retry ",-1))]),_:1})])):$(d)?(Z(),be($(ms),{key:3,class:"h-0 flex-1 overflow-hidden"},{default:me(()=>[q("div",{ref_key:"diffViewerRef",ref:O},[oe(C,{hunks:$(h),"file-path":$(d),binary:$(_)?.binary,"old-path":$(_)?.oldPath,"file-content":$(g),"show-full-file":$(k)==="full","is-loading-content":$(c)},null,8,["hunks","file-path","binary","old-path","file-content","show-full-file","is-loading-content"])],512)]),_:1})):(Z(),ee("div",av," Select a file to view changes "))])]))],512)}}}),uv=Object.assign(lv,{__name:"GitDiffPanel"}),cv={class:"space-y-2"},dv={key:1,class:"rounded-lg border border-dashed p-4 text-center text-sm text-muted-foreground"},fv=["onClick"],hv={class:"flex items-start gap-3"},gv={class:"min-w-0 flex-1"},pv={class:"flex flex-wrap items-center gap-2"},vv={class:"font-mono text-xs font-medium text-primary"},mv={class:"flex items-center gap-1 text-xs text-muted-foreground"},yv={class:"flex items-center gap-0.5 text-xs text-green-600 dark:text-green-400"},wv={class:"flex items-center gap-0.5 text-xs text-red-600 dark:text-red-400"},_v={class:"mt-1 truncate text-sm"},xv={key:1,class:"flex items-center gap-1 text-muted-foreground"},bv={key:2,class:"text-muted-foreground"},Ev={key:0,class:"mt-1 text-xs text-muted-foreground"},kv=xe({__name:"CommitList",props:{commits:{},repoId:{}},emits:["select"],setup(e,{emit:t}){const n=e,o=t,{fetchCommits:r,isLoadingCommits:i}=Wi(),s=ve(new Map),a=ve(new Set);function l(x){return x.trim().toLowerCase()}function c(x){return(x||"").trim()}function u(x,_){return`${c(_)}::${l(x)}`}function d(x,_){const p=l(x),y=l(_.sha),D=l(_.shortSha);return y===p||D===p||y.startsWith(p)||p.startsWith(y)||D.startsWith(p)||p.startsWith(D)}const h=ie(()=>new Set(n.commits.map(_=>_.repo).filter(Boolean)).size>1);ye(()=>({commits:n.commits,repoId:n.repoId}),async({commits:x,repoId:_})=>{if(x.length===0||!_){s.value=new Map,a.value=new Set;return}const p=new Map;for(const Y of x){const H=Y.repo||"";p.has(H)||p.set(H,[]),p.get(H).push(Y.sha)}const y=await Promise.all(Array.from(p.entries()).map(async([Y,H])=>{const Q=await r(_,H,Y||void 0);return{repoPath:Y,requestedShas:[...H],commits:Q.commits,failedShas:Q.failedShas}})),D=new Map,R=new Set;for(const{repoPath:Y,requestedShas:H,commits:Q,failedShas:O}of y){const A=[...Q];for(const E of H){const M=u(E,Y),f=A.findIndex(w=>d(E,w));if(f>=0){const[w]=A.splice(f,1);if(w){D.set(M,{...w,repoPath:Y});continue}}R.add(M)}for(const E of O)R.add(u(E,Y))}s.value=D,a.value=R},{immediate:!0});function g(x){const _=new Date(x),y=new Date().getTime()-_.getTime(),D=Math.floor(y/1e3),R=Math.floor(D/60),Y=Math.floor(R/60),H=Math.floor(Y/24);return D<60?"just now":R<60?`${R} minute${R===1?"":"s"} ago`:Y<24?`${Y} hour${Y===1?"":"s"} ago`:H<7?`${H} day${H===1?"":"s"} ago`:_.toLocaleDateString()}function b(x){o("select",x.sha,x.repo)}function S(x){const _=s.value.get(u(x.sha,x.repo));if(_)return _;const p=l(x.sha),y=`${c(x.repo)}::`;for(const[D,R]of s.value){if(!D.startsWith(y))continue;const Y=D.slice(y.length);if(Y.startsWith(p)||p.startsWith(Y))return R}}function k(x){const _=u(x.sha,x.repo);if(a.value.has(_))return!0;const p=l(x.sha),y=`${c(x.repo)}::`;for(const D of a.value){if(!D.startsWith(y))continue;const R=D.slice(y.length);if(R.startsWith(p)||p.startsWith(R))return!0}return!1}return(x,_)=>(Z(),ee("div",cv,[$(i)?(Z(!0),ee($e,{key:0},Ve(Math.min(e.commits.length,3),p=>(Z(),ee("div",{key:p,class:"animate-pulse rounded-lg border bg-muted/50 p-3"},[..._[0]||(_[0]=[ds('<div class="flex items-start gap-3"><div class="h-5 w-5 rounded bg-muted"></div><div class="flex-1 space-y-2"><div class="h-4 w-20 rounded bg-muted"></div><div class="h-4 w-3/4 rounded bg-muted"></div><div class="h-3 w-1/2 rounded bg-muted"></div></div></div>',1)])]))),128)):e.commits.length===0?(Z(),ee("div",dv," No commits recorded for this task ")):(Z(!0),ee($e,{key:2},Ve(e.commits,p=>(Z(),ee("button",{key:`${p.repo||""}:${p.sha}`,class:"w-full rounded-lg border bg-card p-3 text-left transition-colors hover:bg-muted/50 focus:outline-none focus:ring-2 focus:ring-ring",onClick:y=>b(p)},[q("div",hv,[oe($(Fs),{class:"mt-0.5 size-5 shrink-0 text-muted-foreground"}),q("div",gv,[q("div",pv,[q("code",vv,fe(S(p)?.shortSha||p.sha.substring(0,7)),1),S(p)?(Z(),ee($e,{key:0},[q("span",mv,[oe($(Ji),{class:"size-3"}),Se(" "+fe(S(p).filesChanged),1)]),q("span",yv,[oe($(ys),{class:"size-3"}),Se(fe(S(p).additions),1)]),q("span",wv,[oe($(Ws),{class:"size-3"}),Se(fe(S(p).deletions),1)])],64)):he("",!0),p.repo&&$(h)?(Z(),be($(vn),{key:1,variant:"secondary",class:"gap-1 text-xs"},{default:me(()=>[oe($(Hs),{class:"size-3"}),Se(" "+fe(p.repo),1)]),_:2},1024)):he("",!0)]),q("p",_v,[S(p)?(Z(),ee($e,{key:0},[Se(fe(S(p).message),1)],64)):k(p)?(Z(),ee("span",xv,[oe($(bn),{class:"size-3"}),_[1]||(_[1]=Se(" Commit unavailable ",-1))])):(Z(),ee("span",bv,"Loading..."))]),S(p)?(Z(),ee("p",Ev,fe(S(p).author)+" · "+fe(g(S(p).date)),1)):he("",!0)])])],8,fv))),128))]))}}),Sv=Object.assign(kv,{__name:"GitCommitList"}),Nv=xe({__name:"Separator",props:{orientation:{default:"horizontal"},decorative:{type:Boolean,default:!0},asChild:{type:Boolean},as:{},class:{}},setup(e){const t=e,n=es(t,"class");return(o,r)=>(Z(),be($(ws),xo({"data-slot":"separator"},$(n),{class:$(ts)("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",t.class)}),null,16,["class"]))}}),Et=Object.assign(Nv,{__name:"UiSeparator"}),Cv={class:"flex items-center gap-2"},$v={key:1,class:"min-h-0 flex-1 overflow-hidden"},Mv={key:2,class:"min-h-0 flex-1 space-y-4 overflow-y-auto px-6"},Iv={class:"flex flex-wrap items-center gap-2"},Tv={class:"space-y-2"},Ov={class:"text-sm text-muted-foreground leading-relaxed"},Pv={key:0,class:"space-y-2"},Dv={class:"flex items-center gap-2 text-sm font-medium"},zv={class:"ml-4 list-decimal space-y-1 text-sm text-muted-foreground"},Av={key:2,class:"space-y-2"},Lv={class:"flex items-center gap-2 text-sm font-medium"},Bv={class:"space-y-1.5 text-sm text-muted-foreground"},Vv={key:4,class:"space-y-2"},Rv={class:"flex items-center gap-2 text-sm font-medium"},Hv={class:"space-y-1 text-sm text-muted-foreground"},Fv={class:"font-mono text-xs"},Gv={class:"space-y-2"},Yv={class:"flex items-center gap-2 text-sm font-medium"},jv={key:6,class:"space-y-2"},Xv={class:"flex flex-col gap-1 text-xs text-muted-foreground"},Wv={key:0,class:"flex items-center gap-2"},Uv={key:1,class:"flex items-center gap-2"},Zv={key:7,class:"space-y-2"},qv={class:"flex items-center justify-between rounded-md border border-border bg-muted/30 px-3 py-2 text-sm"},Kv={class:"text-muted-foreground"},Qv=xe({__name:"Detail",props:hs({task:{},taskTitles:{},commits:{},repoId:{},taskPrdSlug:{},currentPrdSlug:{}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:["update:open"],setup(e){const t=e,n=fs(e,"open"),o=ie(()=>{if(!t.task)return{label:"",variant:"secondary"};switch(t.task.category){case"setup":return{label:"Setup",variant:"secondary"};case"feature":return{label:"Feature",variant:"default"};case"integration":return{label:"Integration",variant:"outline"};case"testing":return{label:"Testing",variant:"secondary"};case"documentation":return{label:"Docs",variant:"secondary"};default:return{label:t.task.category,variant:"secondary"}}}),r=ie(()=>{if(!t.task)return{label:"",class:""};switch(t.task.priority){case"critical":return{label:"Critical",class:"text-destructive"};case"high":return{label:"High",class:"text-orange-500"};case"medium":return{label:"Medium",class:"text-muted-foreground"};case"low":return{label:"Low",class:"text-muted-foreground"};default:return{label:t.task.priority,class:"text-muted-foreground"}}}),i=ie(()=>{if(!t.task)return{label:"",icon:Gt,class:""};switch(t.task.status){case"pending":return{label:"Pending",icon:Gt,class:"text-muted-foreground"};case"in_progress":return{label:"In Progress",icon:Os,class:"text-blue-500"};case"completed":return{label:"Completed",icon:En,class:"text-green-500"};default:return{label:t.task.status,icon:Gt,class:"text-muted-foreground"}}});function s(k){if(!k)return"";try{return new Date(k).toLocaleString()}catch{return k}}function a(k){return t.taskTitles?.get(k)??k}const l=ie(()=>t.commits&&t.commits.length>0&&t.repoId),c=ie(()=>!t.repoId||!t.taskPrdSlug?!1:t.currentPrdSlug?t.taskPrdSlug!==t.currentPrdSlug:!0),u=ie(()=>{if(!c.value||!t.repoId||!t.taskPrdSlug||!t.task)return"";const k=new URLSearchParams({task:t.task.id,taskPrd:t.taskPrdSlug});return`/${t.repoId}/${t.taskPrdSlug}?${k.toString()}`}),d=ve("details"),h=ve(null),g=ve(null);function b(k,x){h.value=k,g.value=x||null,d.value="diff"}function S(){d.value="details",h.value=null,g.value=null}return ye(()=>t.task,()=>{d.value="details",h.value=null,g.value=null}),ye(n,k=>{k||(d.value="details",h.value=null,g.value=null)}),(k,x)=>{const _=uv,p=Sv,y=Ms;return Z(),be($(Ns),{open:n.value,"onUpdate:open":x[0]||(x[0]=D=>n.value=D)},{default:me(()=>[oe($(Ss),{class:ze(["flex h-full w-full flex-col overflow-hidden sm:max-w-lg",$(d)==="diff"?"sm:!max-w-[94vw] xl:!max-w-[88vw]":""])},{default:me(()=>[e.task?(Z(),be($(_s),{key:0,class:"px-6 pr-12"},{default:me(()=>[q("div",Cv,[$(d)==="diff"?(Z(),be($(ct),{key:0,variant:"ghost",size:"icon",class:"size-8 shrink-0",onClick:S},{default:me(()=>[oe($(Is),{class:"size-4"})]),_:1})):he("",!0),oe($(xs),{class:"text-left text-lg"},{default:me(()=>[Se(fe($(d)==="diff"?"Commit Changes":e.task.title),1)]),_:1})]),oe($(bs),{class:"sr-only"},{default:me(()=>[...x[1]||(x[1]=[Se("Task details",-1)])]),_:1})]),_:1})):he("",!0),e.task&&$(d)==="diff"&&$(h)&&e.repoId?(Z(),ee("div",$v,[oe(_,{"repo-id":e.repoId,"commit-sha":$(h),"repo-path":$(g)||void 0,class:"h-full",onClose:S},null,8,["repo-id","commit-sha","repo-path"])])):e.task?(Z(),ee("div",Mv,[q("div",Iv,[oe($(vn),{variant:$(o).variant},{default:me(()=>[oe($(Zs),{class:"mr-1 size-3"}),Se(" "+fe($(o).label),1)]),_:1},8,["variant"]),oe($(vn),{variant:"outline",class:ze($(r).class)},{default:me(()=>[oe($(Mt),{class:"mr-1 size-3"}),Se(" "+fe($(r).label),1)]),_:1},8,["class"]),oe($(vn),{variant:"outline",class:ze($(i).class)},{default:me(()=>[(Z(),be(He($(i).icon),{class:"mr-1 size-3"})),Se(" "+fe($(i).label),1)]),_:1},8,["class"])]),q("div",Tv,[x[2]||(x[2]=q("h4",{class:"text-sm font-medium"},"Description",-1)),q("p",Ov,fe(e.task.description),1)]),oe($(Et)),e.task.steps.length>0?(Z(),ee("div",Pv,[q("h4",Dv,[oe($(Xs),{class:"size-4"}),x[3]||(x[3]=Se(" Steps ",-1))]),q("ol",zv,[(Z(!0),ee($e,null,Ve(e.task.steps,(D,R)=>(Z(),ee("li",{key:R,class:"pl-1"},fe(D),1))),128))])])):he("",!0),e.task.steps.length>0&&e.task.passes.length>0?(Z(),be($(Et),{key:1})):he("",!0),e.task.passes.length>0?(Z(),ee("div",Av,[q("h4",Lv,[oe($(Us),{class:"size-4"}),x[4]||(x[4]=Se(" Pass Criteria ",-1))]),q("ul",Bv,[(Z(!0),ee($e,null,Ve(e.task.passes,(D,R)=>(Z(),ee("li",{key:R,class:"flex items-start gap-2"},[q("div",{class:ze(["mt-0.5 flex size-4 shrink-0 items-center justify-center rounded border",e.task.status==="completed"?"border-primary bg-primary text-primary-foreground":"border-muted-foreground/50"])},[e.task.status==="completed"?(Z(),be($(Cs),{key:0,class:"size-3"})):he("",!0)],2),q("span",null,fe(D),1)]))),128))])])):he("",!0),e.task.dependencies.length>0?(Z(),be($(Et),{key:3})):he("",!0),e.task.dependencies.length>0?(Z(),ee("div",Vv,[q("h4",Rv,[oe($(Ys),{class:"size-4"}),x[5]||(x[5]=Se(" Dependencies ",-1))]),q("ul",Hv,[(Z(!0),ee($e,null,Ve(e.task.dependencies,D=>(Z(),ee("li",{key:D,class:"flex items-center gap-2"},[q("span",Fv,fe(D),1),q("span",null,fe(a(D)),1)]))),128))])])):he("",!0),$(l)?(Z(),ee($e,{key:5},[oe($(Et)),q("div",Gv,[q("h4",Yv,[oe($(Ps),{class:"size-4"}),x[6]||(x[6]=Se(" Changes ",-1))]),oe(p,{commits:e.commits,"repo-id":e.repoId,onSelect:b},null,8,["commits","repo-id"])])],64)):he("",!0),e.task.startedAt||e.task.completedAt?(Z(),ee("div",jv,[oe($(Et)),q("div",Xv,[e.task.startedAt?(Z(),ee("div",Wv,[oe($(Ts),{class:"size-3"}),q("span",null,"Started: "+fe(s(e.task.startedAt)),1)])):he("",!0),e.task.completedAt?(Z(),ee("div",Uv,[oe($(En),{class:"size-3"}),q("span",null,"Completed: "+fe(s(e.task.completedAt)),1)])):he("",!0)])])):he("",!0),$(c)?(Z(),ee("div",Zv,[oe($(Et)),q("div",qv,[q("span",Kv,"This task belongs to "+fe(e.taskPrdSlug)+".",1),oe(y,{to:$(u)},{default:me(()=>[oe($(ct),{variant:"outline",size:"sm",class:"h-8"},{default:me(()=>[oe($(Ds),{class:"mr-1.5 size-3.5"}),x[7]||(x[7]=Se(" Open PRD ",-1))]),_:1})]),_:1},8,["to"])])])):he("",!0)])):he("",!0),oe($(Es),{class:"px-6 pb-6"},{default:me(()=>[oe($(ks),{"as-child":""},{default:me(()=>[oe($(ct),{variant:"outline",class:"w-full"},{default:me(()=>[...x[8]||(x[8]=[Se("Close",-1)])]),_:1})]),_:1})]),_:1})]),_:1},8,["class"])]),_:1},8,["open"])}}}),sm=Object.assign(Qv,{__name:"TasksDetail"});export{Ts as C,Ds as E,Ws as M,sm as _,Gt as a,En as b,im as c};