@lunora/studio 1.0.0-alpha.46 → 1.0.0-alpha.48

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 (145) hide show
  1. package/dist/index.d.ts +5 -3
  2. package/dist/index.js +12 -12
  3. package/dist/mount.js +1 -1
  4. package/dist/packem_chunks/ApiTab.js +3 -3
  5. package/dist/packem_chunks/AuditPanel.js +4 -4
  6. package/dist/packem_chunks/ExportImportPanel.js +4 -4
  7. package/dist/packem_chunks/FileBrowser.js +43 -20
  8. package/dist/packem_chunks/FunctionRunner.js +8 -25
  9. package/dist/packem_chunks/FunctionStatsPanel.js +4 -4
  10. package/dist/packem_chunks/HealthPanel.js +3 -3
  11. package/dist/packem_chunks/InsightsPanel.js +5 -5
  12. package/dist/packem_chunks/LogsPanel.js +4 -4
  13. package/dist/packem_chunks/MailPanel.js +3 -3
  14. package/dist/packem_chunks/MetricsPanel.js +4 -4
  15. package/dist/packem_chunks/MigrationsPanel.js +5 -5
  16. package/dist/packem_chunks/PitrPanel.js +1 -1
  17. package/dist/packem_chunks/SchemaViewer.js +3 -3
  18. package/dist/packem_chunks/SecurityAdvisorPanel.js +2 -2
  19. package/dist/packem_chunks/SettingsPanel.js +2 -2
  20. package/dist/packem_chunks/SqlEditorPanel.js +7 -6
  21. package/dist/packem_chunks/TableEditor.js +6 -29
  22. package/dist/packem_chunks/analytics-panel.js +1 -1
  23. package/dist/packem_chunks/auth-config-panel.js +1 -1
  24. package/dist/packem_chunks/auth-sessions-panel.js +2 -2
  25. package/dist/packem_chunks/containers-panel.js +1 -1
  26. package/dist/packem_chunks/dashboards-panel.js +3 -2
  27. package/dist/packem_chunks/fanout-panel.js +3 -3
  28. package/dist/packem_chunks/flags-panel.js +2 -2
  29. package/dist/packem_chunks/kv-browser.js +2 -2
  30. package/dist/packem_chunks/log-drains-panel.js +1 -1
  31. package/dist/packem_chunks/organizations-panel.js +3 -3
  32. package/dist/packem_chunks/payments-panel.js +3 -3
  33. package/dist/packem_chunks/permissions-panel.js +4 -4
  34. package/dist/packem_chunks/queues-panel.js +3 -3
  35. package/dist/packem_chunks/rls-panel.js +2 -2
  36. package/dist/packem_chunks/schedule-panel.js +3 -3
  37. package/dist/packem_chunks/storage-rules-panel.js +2 -2
  38. package/dist/packem_chunks/subscriptions-panel.js +3 -3
  39. package/dist/packem_chunks/users-panel.js +3 -3
  40. package/dist/packem_chunks/vector-browser.js +1 -1
  41. package/dist/packem_chunks/workflows-panel.js +2 -2
  42. package/dist/packem_shared/{ApiDocsPanel-CBma-lnp.js → ApiDocsPanel-B2Rc7nOF.js} +1 -1
  43. package/dist/packem_shared/{ApiReferencePanel-CQM3pPN7.js → ApiReferencePanel-Dd8pcswz.js} +1 -1
  44. package/dist/packem_shared/{CommandPalette-X2tkbyHk.js → CommandPalette-BXV4eKf5.js} +1 -1
  45. package/dist/packem_shared/{DataBrowser-D2ywrdId.js → DataBrowser-Cc197zke.js} +8 -8
  46. package/dist/packem_shared/{DataFilters-FNquMaiu.js → DataFilters-B1Q7mrt7.js} +6 -2
  47. package/dist/packem_shared/{GlobalDataBrowser-BkTPLzAY.js → GlobalDataBrowser-CxJxRRf2.js} +3 -3
  48. package/dist/packem_shared/{HomePanel-D1Q9LZgK.js → HomePanel-CjDlJzzs.js} +3 -3
  49. package/dist/packem_shared/{OpenRpcReferencePanel-Dno-hfDb.js → OpenRpcReferencePanel-CWaf0ZtX.js} +1 -1
  50. package/dist/packem_shared/{ScheduledJobs-Ctw4jYtU.js → ScheduledJobs-dHMgnJbx.js} +2 -2
  51. package/dist/packem_shared/{ShardInput-gx_DZXXn.js → ShardInput-CZnpHILL.js} +1 -1
  52. package/dist/packem_shared/{Studio-lJhzDAze.js → Studio-sfBFghzO.js} +4 -4
  53. package/dist/packem_shared/{StudioApp-DiMkupvZ.js → StudioApp-Ism1gXfJ.js} +5 -11
  54. package/dist/packem_shared/{advisor-view-BX8OhG0w.js → advisor-view-Cx21PS_T.js} +1 -1
  55. package/dist/packem_shared/browser-storage-L4gOP5gJ.js +105 -0
  56. package/dist/packem_shared/{data-grid-CdXztApG.js → data-grid-C9I16KWr.js} +1 -1
  57. package/dist/packem_shared/{error-alert-CXjqyGw9.js → error-alert-vIPQoN3Y.js} +1 -1
  58. package/dist/packem_shared/{grid-features-BF-KBDFz.js → grid-features-B_fZH4iQ.js} +3 -2
  59. package/dist/packem_shared/{home-panel-TFcRf9Ui.js → home-panel-BohxdqDb.js} +2 -2
  60. package/dist/packem_shared/{internal-CYcbqMjX.js → internal-zwBoOv24.js} +14 -1
  61. package/dist/packem_shared/{reference-view-DUiJcILV.js → reference-view-DUULLuOi.js} +3 -17
  62. package/dist/packem_shared/{browser-storage-BTrX4y3B.js → result-chart-DZradBAS.js} +2 -98
  63. package/dist/packem_shared/shard-history-AxiJ1WPP.js +16 -0
  64. package/dist/packem_shared/{studio-Dh9UlaF_.js → studio-CFC_pv0f.js} +3 -3
  65. package/dist/packem_shared/{table-list-sidebar-UVIXQJdU.js → table-list-sidebar-huX4VmgI.js} +19 -9
  66. package/dist/packem_shared/{use-admin-query-CfHYWx5n.js → use-admin-query-BGJ010yZ.js} +1 -1
  67. package/dist/packem_shared/{use-async-submit-DJQiPc-_.js → use-async-submit-DGCtuDyz.js} +2 -2
  68. package/dist/standalone/{chunk-J75M4LTW.js → chunk-22C6COGE.js} +4 -4
  69. package/dist/standalone/{chunk-7XTR7BWT.js → chunk-2CQ2YNER.js} +1 -1
  70. package/dist/standalone/chunk-2MLA6WFH.js +1 -0
  71. package/dist/standalone/{chunk-2BBENYBY.js → chunk-37HPVOYP.js} +1 -1
  72. package/dist/standalone/{chunk-B4TTGYIX.js → chunk-3HS3ZXFB.js} +1 -1
  73. package/dist/standalone/{chunk-T4XWXBKR.js → chunk-3OZDR3RM.js} +1 -1
  74. package/dist/standalone/chunk-4KSX53SI.js +4 -0
  75. package/dist/standalone/chunk-4PC7IXNY.js +1 -0
  76. package/dist/standalone/{chunk-7KR346F4.js → chunk-5UKRVDFD.js} +1 -1
  77. package/dist/standalone/{chunk-4WGGEF73.js → chunk-ADP5UEHQ.js} +1 -1
  78. package/dist/standalone/{chunk-WKWKAU22.js → chunk-AITOCPML.js} +1 -1
  79. package/dist/standalone/{chunk-ZSNXQT4N.js → chunk-AYANIT5P.js} +1 -1
  80. package/dist/standalone/chunk-BIBCC7EE.js +6 -0
  81. package/dist/standalone/{chunk-XFPHUG7M.js → chunk-CGGZAYGG.js} +1 -1
  82. package/dist/standalone/chunk-CJTT4TBP.js +1 -0
  83. package/dist/standalone/{chunk-73BV73BI.js → chunk-CLMGPTAI.js} +1 -1
  84. package/dist/standalone/{chunk-MP5MTWY5.js → chunk-CTPCJNOP.js} +1 -1
  85. package/dist/standalone/chunk-DDE62TRL.js +1 -0
  86. package/dist/standalone/{chunk-ATG3655M.js → chunk-DH4K2OLM.js} +1 -1
  87. package/dist/standalone/{chunk-KMNEQEHM.js → chunk-EEWKIQUE.js} +1 -1
  88. package/dist/standalone/{chunk-3JO76DWI.js → chunk-EYSL7KEQ.js} +1 -1
  89. package/dist/standalone/{chunk-I4RSHYDW.js → chunk-F4HDP4XW.js} +1 -1
  90. package/dist/standalone/chunk-F5I22A4W.js +1 -0
  91. package/dist/standalone/chunk-FKVCHCYV.js +4 -0
  92. package/dist/standalone/{chunk-6HW2RKAX.js → chunk-FNQQ3B5G.js} +1 -1
  93. package/dist/standalone/{chunk-PXR5E7AX.js → chunk-GSCV2N3F.js} +5 -5
  94. package/dist/standalone/{chunk-ICIQ2GWQ.js → chunk-H27CRIP3.js} +1 -1
  95. package/dist/standalone/{chunk-YSF43KIJ.js → chunk-HROXYAZT.js} +1 -1
  96. package/dist/standalone/{chunk-EOSXQTSQ.js → chunk-HVRDZZHL.js} +1 -1
  97. package/dist/standalone/{chunk-245TEXSO.js → chunk-IRSIK3HT.js} +2 -2
  98. package/dist/standalone/{chunk-2GMEK2W3.js → chunk-ITQKVEP7.js} +9 -9
  99. package/dist/standalone/{chunk-34B5ECBI.js → chunk-IZN4TYMN.js} +1 -1
  100. package/dist/standalone/{chunk-7JOVXGO4.js → chunk-JM7XBQVK.js} +1 -1
  101. package/dist/standalone/{chunk-S6JKSFSO.js → chunk-JPILGFXT.js} +1 -1
  102. package/dist/standalone/{chunk-QQH2YTBW.js → chunk-JQ4WOPMF.js} +1 -1
  103. package/dist/standalone/chunk-K2CB2CHL.js +1 -0
  104. package/dist/standalone/{chunk-3IJLM4GF.js → chunk-KCMKEMUL.js} +1 -1
  105. package/dist/standalone/{chunk-WKUGR7ER.js → chunk-KKD46QVN.js} +1 -1
  106. package/dist/standalone/chunk-L7WR3C4Z.js +1 -0
  107. package/dist/standalone/chunk-LRYLU6EY.js +1 -0
  108. package/dist/standalone/{chunk-I34RPZ7P.js → chunk-MDTNVR3G.js} +1 -1
  109. package/dist/standalone/chunk-PL2KY6IG.js +1 -0
  110. package/dist/standalone/{chunk-KFNNMXUZ.js → chunk-S3Q6R7BA.js} +1 -1
  111. package/dist/standalone/chunk-SDQE2IUJ.js +1 -0
  112. package/dist/standalone/chunk-SEQ43UW2.js +1 -0
  113. package/dist/standalone/{chunk-5KUKYIU6.js → chunk-SHK6RAFG.js} +1 -1
  114. package/dist/standalone/chunk-TXTJPS5F.js +1 -0
  115. package/dist/standalone/chunk-V4ECZI2R.js +1 -0
  116. package/dist/standalone/{chunk-6CRKDJNL.js → chunk-WD2LBHJZ.js} +1 -1
  117. package/dist/standalone/{chunk-PBXQ5QS4.js → chunk-WMWDJLRO.js} +4 -4
  118. package/dist/standalone/{chunk-ZTOATVB7.js → chunk-WOXVMXSQ.js} +1 -1
  119. package/dist/standalone/{chunk-JEVKZIHN.js → chunk-WUFVFVHJ.js} +1 -1
  120. package/dist/standalone/{chunk-ERUIC6WI.js → chunk-X4QFAAZ5.js} +1 -1
  121. package/dist/standalone/{chunk-P7AMKXU2.js → chunk-XVR74IFC.js} +1 -1
  122. package/dist/standalone/chunk-Y2GJJVS5.js +1 -0
  123. package/dist/standalone/chunk-YFA7NUCL.js +1 -0
  124. package/dist/standalone/chunk-YSPZSTDI.js +1 -0
  125. package/dist/standalone/studio.js +43 -43
  126. package/package.json +6 -6
  127. package/dist/packem_shared/shard-history-DyebH1R5.js +0 -38
  128. package/dist/standalone/chunk-3SKIYIBN.js +0 -1
  129. package/dist/standalone/chunk-AFCBRDRQ.js +0 -1
  130. package/dist/standalone/chunk-AX7GYUQC.js +0 -1
  131. package/dist/standalone/chunk-BGHGKAOM.js +0 -1
  132. package/dist/standalone/chunk-BL45HXOJ.js +0 -1
  133. package/dist/standalone/chunk-ERXJPMCU.js +0 -1
  134. package/dist/standalone/chunk-GNMTLLGB.js +0 -1
  135. package/dist/standalone/chunk-M5OMEMQ3.js +0 -1
  136. package/dist/standalone/chunk-O4YNKFCZ.js +0 -1
  137. package/dist/standalone/chunk-OLUEBOHS.js +0 -1
  138. package/dist/standalone/chunk-OOETIPAO.js +0 -1
  139. package/dist/standalone/chunk-OQPT2BEZ.js +0 -6
  140. package/dist/standalone/chunk-PKIPNNRD.js +0 -4
  141. package/dist/standalone/chunk-QB3QUTSJ.js +0 -1
  142. package/dist/standalone/chunk-TBMYIZIO.js +0 -1
  143. package/dist/standalone/chunk-TU5ZNEZ4.js +0 -1
  144. package/dist/standalone/chunk-WATFBATD.js +0 -1
  145. package/dist/standalone/chunk-WSMZLZWM.js +0 -4
@@ -1,4 +1,4 @@
1
- "use client";import{a as Xe,b as fo}from"./chunk-2NGUNNGW.js";import{a as Es,b as Cs,c as _s,f as ho}from"./chunk-LNZIB2MD.js";import"./chunk-QBAT52GB.js";import"./chunk-QAFAJBAW.js";import"./chunk-IXDH4GL5.js";import"./chunk-KSKXW5PX.js";import"./chunk-5OIBXYZM.js";import"./chunk-L7SK4ZZD.js";import{a as lr,b as cr,c as gs,d as ys,e as uo,g as xs,h as ws,i as Ut}from"./chunk-BJGBHGK3.js";import{e as fs}from"./chunk-WI7GWFEG.js";import{a as Ss}from"./chunk-2K47A3P6.js";import{b as ru}from"./chunk-KEGAWN6Y.js";import{a as qe}from"./chunk-JSEXCW5Q.js";import{e as hs,k as ps}from"./chunk-4QHKBC77.js";import{a as vs}from"./chunk-ATG3655M.js";import{b as bs}from"./chunk-TBMYIZIO.js";import{R as Mt}from"./chunk-3CJW6NWG.js";import{c as Ie}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import{a as eu}from"./chunk-HV7G6DFP.js";import{a as Nn}from"./chunk-BOXSWNXZ.js";import{a as ms}from"./chunk-TAD43CG5.js";import{a as io,b as so,c as ao,d as lo,e as co}from"./chunk-SEU5V7I6.js";import{b as Ge}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as ds}from"./chunk-M5OMEMQ3.js";import"./chunk-ZHVTQ37P.js";import{a as nu}from"./chunk-3OA7PECS.js";import{d as It,e as En,f as Cn,g as _n,k as Oe}from"./chunk-2GMEK2W3.js";import{b as us}from"./chunk-J75M4LTW.js";import{a as o,e as mt,f as ar,g as tu,h as ou,j as Zt}from"./chunk-RRCPZMC2.js";var Be=mt(tu(),1);var re=mt(ar(),1);var O=mt(nu()),D=mt(ar());function ge(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=ge(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}o(ge,"cc");var iu={value:o(()=>{},"value")};function Is(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new po(n)}o(Is,"dispatch");function po(e){this._=e}o(po,"Dispatch");function su(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}o(su,"parseTypenames");po.prototype=Is.prototype={constructor:po,on:o(function(e,t){var n=this._,r=su(e+"",n),i,s=-1,a=r.length;if(arguments.length<2){for(;++s<a;)if((i=(e=r[s]).type)&&(i=au(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<a;)if(i=(e=r[s]).type)n[i]=Ns(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Ns(n[i],e.name,null);return this},"on"),copy:o(function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new po(e)},"copy"),call:o(function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,s;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],r=0,i=s.length;r<i;++r)s[r].value.apply(t,n)},"call"),apply:o(function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,s=r.length;i<s;++i)r[i].value.apply(t,n)},"apply")};function au(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}o(au,"get");function Ns(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=iu,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}o(Ns,"set");var Pt=Is;var mo="http://www.w3.org/1999/xhtml",ur={svg:"http://www.w3.org/2000/svg",xhtml:mo,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ze(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),ur.hasOwnProperty(t)?{space:ur[t],local:e}:e}o(Ze,"default");function lu(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===mo&&t.documentElement.namespaceURI===mo?t.createElement(e):t.createElementNS(n,e)}}o(lu,"creatorInherit");function cu(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}o(cu,"creatorFixed");function In(e){var t=Ze(e);return(t.local?cu:lu)(t)}o(In,"default");function uu(){}o(uu,"none");function gt(e){return e==null?uu:function(){return this.querySelector(e)}}o(gt,"default");function dr(e){typeof e!="function"&&(e=gt(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var s=t[i],a=s.length,l=r[i]=new Array(a),c,u,d=0;d<a;++d)(c=s[d])&&(u=e.call(c,c.__data__,d,s))&&("__data__"in c&&(u.__data__=c.__data__),l[d]=u);return new ye(r,this._parents)}o(dr,"default");function fr(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}o(fr,"array");function du(){return[]}o(du,"empty");function Gt(e){return e==null?du:function(){return this.querySelectorAll(e)}}o(Gt,"default");function fu(e){return function(){return fr(e.apply(this,arguments))}}o(fu,"arrayAll");function hr(e){typeof e=="function"?e=fu(e):e=Gt(e);for(var t=this._groups,n=t.length,r=[],i=[],s=0;s<n;++s)for(var a=t[s],l=a.length,c,u=0;u<l;++u)(c=a[u])&&(r.push(e.call(c,c.__data__,u,a)),i.push(c));return new ye(r,i)}o(hr,"default");function qt(e){return function(){return this.matches(e)}}o(qt,"default");function go(e){return function(t){return t.matches(e)}}o(go,"childMatcher");var hu=Array.prototype.find;function pu(e){return function(){return hu.call(this.children,e)}}o(pu,"childFind");function mu(){return this.firstElementChild}o(mu,"childFirst");function pr(e){return this.select(e==null?mu:pu(typeof e=="function"?e:go(e)))}o(pr,"default");var gu=Array.prototype.filter;function yu(){return Array.from(this.children)}o(yu,"children");function xu(e){return function(){return gu.call(this.children,e)}}o(xu,"childrenFilter");function mr(e){return this.selectAll(e==null?yu:xu(typeof e=="function"?e:go(e)))}o(mr,"default");function gr(e){typeof e!="function"&&(e=qt(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var s=t[i],a=s.length,l=r[i]=[],c,u=0;u<a;++u)(c=s[u])&&e.call(c,c.__data__,u,s)&&l.push(c);return new ye(r,this._parents)}o(gr,"default");function Mn(e){return new Array(e.length)}o(Mn,"default");function yr(){return new ye(this._enter||this._groups.map(Mn),this._parents)}o(yr,"default");function Pn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}o(Pn,"EnterNode");Pn.prototype={constructor:Pn,appendChild:o(function(e){return this._parent.insertBefore(e,this._next)},"appendChild"),insertBefore:o(function(e,t){return this._parent.insertBefore(e,t)},"insertBefore"),querySelector:o(function(e){return this._parent.querySelector(e)},"querySelector"),querySelectorAll:o(function(e){return this._parent.querySelectorAll(e)},"querySelectorAll")};function xr(e){return function(){return e}}o(xr,"default");function wu(e,t,n,r,i,s){for(var a=0,l,c=t.length,u=s.length;a<u;++a)(l=t[a])?(l.__data__=s[a],r[a]=l):n[a]=new Pn(e,s[a]);for(;a<c;++a)(l=t[a])&&(i[a]=l)}o(wu,"bindIndex");function bu(e,t,n,r,i,s,a){var l,c,u=new Map,d=t.length,f=s.length,h=new Array(d),p;for(l=0;l<d;++l)(c=t[l])&&(h[l]=p=a.call(c,c.__data__,l,t)+"",u.has(p)?i[l]=c:u.set(p,c));for(l=0;l<f;++l)p=a.call(e,s[l],l,s)+"",(c=u.get(p))?(r[l]=c,c.__data__=s[l],u.delete(p)):n[l]=new Pn(e,s[l]);for(l=0;l<d;++l)(c=t[l])&&u.get(h[l])===c&&(i[l]=c)}o(bu,"bindKey");function vu(e){return e.__data__}o(vu,"datum");function wr(e,t){if(!arguments.length)return Array.from(this,vu);var n=t?bu:wu,r=this._parents,i=this._groups;typeof e!="function"&&(e=xr(e));for(var s=i.length,a=new Array(s),l=new Array(s),c=new Array(s),u=0;u<s;++u){var d=r[u],f=i[u],h=f.length,p=Su(e.call(d,d&&d.__data__,u,r)),m=p.length,v=l[u]=new Array(m),b=a[u]=new Array(m),y=c[u]=new Array(h);n(d,f,v,b,y,p,t);for(var E=0,g=0,w,M;E<m;++E)if(w=v[E]){for(E>=g&&(g=E+1);!(M=b[g])&&++g<m;);w._next=M||null}}return a=new ye(a,r),a._enter=l,a._exit=c,a}o(wr,"default");function Su(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}o(Su,"arraylike");function br(){return new ye(this._exit||this._groups.map(Mn),this._parents)}o(br,"default");function vr(e,t,n){var r=this.enter(),i=this,s=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),n==null?s.remove():n(s),r&&i?r.merge(i).order():i}o(vr,"default");function Sr(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,s=r.length,a=Math.min(i,s),l=new Array(i),c=0;c<a;++c)for(var u=n[c],d=r[c],f=u.length,h=l[c]=new Array(f),p,m=0;m<f;++m)(p=u[m]||d[m])&&(h[m]=p);for(;c<i;++c)l[c]=n[c];return new ye(l,this._parents)}o(Sr,"default");function Er(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,s=r[i],a;--i>=0;)(a=r[i])&&(s&&a.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(a,s),s=a);return this}o(Er,"default");function Cr(e){e||(e=Eu);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}o(t,"compareNode");for(var n=this._groups,r=n.length,i=new Array(r),s=0;s<r;++s){for(var a=n[s],l=a.length,c=i[s]=new Array(l),u,d=0;d<l;++d)(u=a[d])&&(c[d]=u);c.sort(t)}return new ye(i,this._parents).order()}o(Cr,"default");function Eu(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}o(Eu,"ascending");function _r(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}o(_r,"default");function Nr(){return Array.from(this)}o(Nr,"default");function Ir(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,s=r.length;i<s;++i){var a=r[i];if(a)return a}return null}o(Ir,"default");function Mr(){let e=0;for(let t of this)++e;return e}o(Mr,"default");function Pr(){return!this.node()}o(Pr,"default");function Tr(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],s=0,a=i.length,l;s<a;++s)(l=i[s])&&e.call(l,l.__data__,s,i);return this}o(Tr,"default");function Cu(e){return function(){this.removeAttribute(e)}}o(Cu,"attrRemove");function _u(e){return function(){this.removeAttributeNS(e.space,e.local)}}o(_u,"attrRemoveNS");function Nu(e,t){return function(){this.setAttribute(e,t)}}o(Nu,"attrConstant");function Iu(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}o(Iu,"attrConstantNS");function Mu(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}o(Mu,"attrFunction");function Pu(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)}}o(Pu,"attrFunctionNS");function kr(e,t){var n=Ze(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?_u:Cu:typeof t=="function"?n.local?Pu:Mu:n.local?Iu:Nu)(n,t))}o(kr,"default");function Tn(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}o(Tn,"default");function Tu(e){return function(){this.style.removeProperty(e)}}o(Tu,"styleRemove");function ku(e,t,n){return function(){this.style.setProperty(e,t,n)}}o(ku,"styleConstant");function Au(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}o(Au,"styleFunction");function Ar(e,t,n){return arguments.length>1?this.each((t==null?Tu:typeof t=="function"?Au:ku)(e,t,n??"")):yt(this.node(),e)}o(Ar,"default");function yt(e,t){return e.style.getPropertyValue(t)||Tn(e).getComputedStyle(e,null).getPropertyValue(t)}o(yt,"styleValue");function Du(e){return function(){delete this[e]}}o(Du,"propertyRemove");function Ou(e,t){return function(){this[e]=t}}o(Ou,"propertyConstant");function $u(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}o($u,"propertyFunction");function Dr(e,t){return arguments.length>1?this.each((t==null?Du:typeof t=="function"?$u:Ou)(e,t)):this.node()[e]}o(Dr,"default");function Ms(e){return e.trim().split(/^|\s+/)}o(Ms,"classArray");function Or(e){return e.classList||new Ps(e)}o(Or,"classList");function Ps(e){this._node=e,this._names=Ms(e.getAttribute("class")||"")}o(Ps,"ClassList");Ps.prototype={add:o(function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},"add"),remove:o(function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},"remove"),contains:o(function(e){return this._names.indexOf(e)>=0},"contains")};function Ts(e,t){for(var n=Or(e),r=-1,i=t.length;++r<i;)n.add(t[r])}o(Ts,"classedAdd");function ks(e,t){for(var n=Or(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}o(ks,"classedRemove");function zu(e){return function(){Ts(this,e)}}o(zu,"classedTrue");function Ru(e){return function(){ks(this,e)}}o(Ru,"classedFalse");function Lu(e,t){return function(){(t.apply(this,arguments)?Ts:ks)(this,e)}}o(Lu,"classedFunction");function $r(e,t){var n=Ms(e+"");if(arguments.length<2){for(var r=Or(this.node()),i=-1,s=n.length;++i<s;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?Lu:t?zu:Ru)(n,t))}o($r,"default");function Hu(){this.textContent=""}o(Hu,"textRemove");function Bu(e){return function(){this.textContent=e}}o(Bu,"textConstant");function Vu(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}o(Vu,"textFunction");function zr(e){return arguments.length?this.each(e==null?Hu:(typeof e=="function"?Vu:Bu)(e)):this.node().textContent}o(zr,"default");function Fu(){this.innerHTML=""}o(Fu,"htmlRemove");function Yu(e){return function(){this.innerHTML=e}}o(Yu,"htmlConstant");function Wu(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}o(Wu,"htmlFunction");function Rr(e){return arguments.length?this.each(e==null?Fu:(typeof e=="function"?Wu:Yu)(e)):this.node().innerHTML}o(Rr,"default");function Xu(){this.nextSibling&&this.parentNode.appendChild(this)}o(Xu,"raise");function Lr(){return this.each(Xu)}o(Lr,"default");function Zu(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}o(Zu,"lower");function Hr(){return this.each(Zu)}o(Hr,"default");function Br(e){var t=typeof e=="function"?e:In(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}o(Br,"default");function Uu(){return null}o(Uu,"constantNull");function Vr(e,t){var n=typeof e=="function"?e:In(e),r=t==null?Uu:typeof t=="function"?t:gt(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}o(Vr,"default");function Gu(){var e=this.parentNode;e&&e.removeChild(this)}o(Gu,"remove");function Fr(){return this.each(Gu)}o(Fr,"default");function qu(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}o(qu,"selection_cloneShallow");function Ku(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}o(Ku,"selection_cloneDeep");function Yr(e){return this.select(e?Ku:qu)}o(Yr,"default");function Wr(e){return arguments.length?this.property("__data__",e):this.node().__data__}o(Wr,"default");function Qu(e){return function(t){e.call(this,t,this.__data__)}}o(Qu,"contextListener");function Ju(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}o(Ju,"parseTypenames");function ju(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,s;n<i;++n)s=t[n],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++r]=s;++r?t.length=r:delete this.__on}}}o(ju,"onRemove");function ed(e,t,n){return function(){var r=this.__on,i,s=Qu(t);if(r){for(var a=0,l=r.length;a<l;++a)if((i=r[a]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=s,i.options=n),i.value=t;return}}this.addEventListener(e.type,s,n),i={type:e.type,name:e.name,value:t,listener:s,options:n},r?r.push(i):this.__on=[i]}}o(ed,"onAdd");function Xr(e,t,n){var r=Ju(e+""),i,s=r.length,a;if(arguments.length<2){var l=this.node().__on;if(l){for(var c=0,u=l.length,d;c<u;++c)for(i=0,d=l[c];i<s;++i)if((a=r[i]).type===d.type&&a.name===d.name)return d.value}return}for(l=t?ed:ju,i=0;i<s;++i)this.each(l(r[i],t,n));return this}o(Xr,"default");function As(e,t,n){var r=Tn(e),i=r.CustomEvent;typeof i=="function"?i=new i(t,n):(i=r.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}o(As,"dispatchEvent");function td(e,t){return function(){return As(this,e,t)}}o(td,"dispatchConstant");function nd(e,t){return function(){return As(this,e,t.apply(this,arguments))}}o(nd,"dispatchFunction");function Zr(e,t){return this.each((typeof t=="function"?nd:td)(e,t))}o(Zr,"default");function*Ur(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,s=r.length,a;i<s;++i)(a=r[i])&&(yield a)}o(Ur,"default");var Gr=[null];function ye(e,t){this._groups=e,this._parents=t}o(ye,"Selection");function Ds(){return new ye([[document.documentElement]],Gr)}o(Ds,"selection");function od(){return this}o(od,"selection_selection");ye.prototype=Ds.prototype={constructor:ye,select:dr,selectAll:hr,selectChild:pr,selectChildren:mr,filter:gr,data:wr,enter:yr,exit:br,join:vr,merge:Sr,selection:od,order:Er,sort:Cr,call:_r,nodes:Nr,node:Ir,size:Mr,empty:Pr,each:Tr,attr:kr,style:Ar,property:Dr,classed:$r,text:zr,html:Rr,raise:Lr,lower:Hr,append:Br,insert:Vr,remove:Fr,clone:Yr,datum:Wr,on:Xr,dispatch:Zr,[Symbol.iterator]:Ur};var Ke=Ds;function Ee(e){return typeof e=="string"?new ye([[document.querySelector(e)]],[document.documentElement]):new ye([[e]],Gr)}o(Ee,"default");function qr(e){let t;for(;t=e.sourceEvent;)e=t;return e}o(qr,"default");function Me(e,t){if(e=qr(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}o(Me,"default");var Os={passive:!1},Tt={capture:!0,passive:!1};function yo(e){e.stopImmediatePropagation()}o(yo,"nopropagation");function Qe(e){e.preventDefault(),e.stopImmediatePropagation()}o(Qe,"default");function Kt(e){var t=e.document.documentElement,n=Ee(e).on("dragstart.drag",Qe,Tt);"onselectstart"in t?n.on("selectstart.drag",Qe,Tt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}o(Kt,"default");function kn(e,t){var n=e.document.documentElement,r=Ee(e).on("dragstart.drag",null);t&&(r.on("click.drag",Qe,Tt),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}o(kn,"yesdrag");var An=o(e=>()=>e,"default");function Dn(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:s,x:a,y:l,dx:c,dy:u,dispatch:d}){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:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}o(Dn,"DragEvent");Dn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function rd(e){return!e.ctrlKey&&!e.button}o(rd,"defaultFilter");function id(){return this.parentNode}o(id,"defaultContainer");function sd(e,t){return t??{x:e.x,y:e.y}}o(sd,"defaultSubject");function ad(){return navigator.maxTouchPoints||"ontouchstart"in this}o(ad,"defaultTouchable");function On(){var e=rd,t=id,n=sd,r=ad,i={},s=Pt("start","drag","end"),a=0,l,c,u,d,f=0;function h(w){w.on("mousedown.drag",p).filter(r).on("touchstart.drag",b).on("touchmove.drag",y,Os).on("touchend.drag touchcancel.drag",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}o(h,"drag");function p(w,M){if(!(d||!e.call(this,w,M))){var _=g(this,t.call(this,w,M),w,M,"mouse");_&&(Ee(w.view).on("mousemove.drag",m,Tt).on("mouseup.drag",v,Tt),Kt(w.view),yo(w),u=!1,l=w.clientX,c=w.clientY,_("start",w))}}o(p,"mousedowned");function m(w){if(Qe(w),!u){var M=w.clientX-l,_=w.clientY-c;u=M*M+_*_>f}i.mouse("drag",w)}o(m,"mousemoved");function v(w){Ee(w.view).on("mousemove.drag mouseup.drag",null),kn(w.view,u),Qe(w),i.mouse("end",w)}o(v,"mouseupped");function b(w,M){if(e.call(this,w,M)){var _=w.changedTouches,P=t.call(this,w,M),T=_.length,k,Y;for(k=0;k<T;++k)(Y=g(this,P,w,M,_[k].identifier,_[k]))&&(yo(w),Y("start",w,_[k]))}}o(b,"touchstarted");function y(w){var M=w.changedTouches,_=M.length,P,T;for(P=0;P<_;++P)(T=i[M[P].identifier])&&(Qe(w),T("drag",w,M[P]))}o(y,"touchmoved");function E(w){var M=w.changedTouches,_=M.length,P,T;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),P=0;P<_;++P)(T=i[M[P].identifier])&&(yo(w),T("end",w,M[P]))}o(E,"touchended");function g(w,M,_,P,T,k){var Y=s.copy(),z=Me(k||_,M),V,L,x;if((x=n.call(w,new Dn("beforestart",{sourceEvent:_,target:h,identifier:T,active:a,x:z[0],y:z[1],dx:0,dy:0,dispatch:Y}),P))!=null)return V=x.x-z[0]||0,L=x.y-z[1]||0,o(function S(C,I,$){var A=z,B;switch(C){case"start":i[T]=S,B=a++;break;case"end":delete i[T],--a;case"drag":z=Me($||I,M),B=a;break}Y.call(C,w,new Dn(C,{sourceEvent:I,subject:x,target:h,identifier:T,active:B,x:z[0]+V,y:z[1]+L,dx:z[0]-A[0],dy:z[1]-A[1],dispatch:Y}),P)},"gesture")}return o(g,"beforestart"),h.filter=function(w){return arguments.length?(e=typeof w=="function"?w:An(!!w),h):e},h.container=function(w){return arguments.length?(t=typeof w=="function"?w:An(w),h):t},h.subject=function(w){return arguments.length?(n=typeof w=="function"?w:An(w),h):n},h.touchable=function(w){return arguments.length?(r=typeof w=="function"?w:An(!!w),h):r},h.on=function(){var w=s.on.apply(s,arguments);return w===s?h:w},h.clickDistance=function(w){return arguments.length?(f=(w=+w)*w,h):Math.sqrt(f)},h}o(On,"default");var Qt=0,zn=0,$n=0,zs=1e3,xo,Rn,wo=0,kt=0,bo=0,Ln=typeof performance=="object"&&performance.now?performance:Date,Rs=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Bn(){return kt||(Rs(ld),kt=Ln.now()+bo)}o(Bn,"now");function ld(){kt=0}o(ld,"clearNow");function Hn(){this._call=this._time=this._next=null}o(Hn,"Timer");Hn.prototype=vo.prototype={constructor:Hn,restart:o(function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Bn():+n)+(t==null?0:+t),!this._next&&Rn!==this&&(Rn?Rn._next=this:xo=this,Rn=this),this._call=e,this._time=n,Kr()},"restart"),stop:o(function(){this._call&&(this._call=null,this._time=1/0,Kr())},"stop")};function vo(e,t,n){var r=new Hn;return r.restart(e,t,n),r}o(vo,"timer");function Ls(){Bn(),++Qt;for(var e=xo,t;e;)(t=kt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Qt}o(Ls,"timerFlush");function $s(){kt=(wo=Ln.now())+bo,Qt=zn=0;try{Ls()}finally{Qt=0,ud(),kt=0}}o($s,"wake");function cd(){var e=Ln.now(),t=e-wo;t>zs&&(bo-=t,wo=e)}o(cd,"poke");function ud(){for(var e,t=xo,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:xo=n);Rn=e,Kr(r)}o(ud,"nap");function Kr(e){if(!Qt){zn&&(zn=clearTimeout(zn));var t=e-kt;t>24?(e<1/0&&(zn=setTimeout($s,e-Ln.now()-bo)),$n&&($n=clearInterval($n))):($n||(wo=Ln.now(),$n=setInterval(cd,zs)),Qt=1,Rs($s))}}o(Kr,"sleep");function Vn(e,t,n){var r=new Hn;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}o(Vn,"default");var dd=Pt("start","end","cancel","interrupt"),fd=[],Vs=0,Hs=1,Eo=2,So=3,Bs=4,Co=5,Fn=6;function Je(e,t,n,r,i,s){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;hd(e,n,{name:t,index:r,group:i,on:dd,tween:fd,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Vs})}o(Je,"default");function Yn(e,t){var n=Ce(e,t);if(n.state>Vs)throw new Error("too late; already scheduled");return n}o(Yn,"init");function Ne(e,t){var n=Ce(e,t);if(n.state>So)throw new Error("too late; already running");return n}o(Ne,"set");function Ce(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}o(Ce,"get");function hd(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=vo(s,0,n.time);function s(u){n.state=Hs,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}o(s,"schedule");function a(u){var d,f,h,p;if(n.state!==Hs)return c();for(d in r)if(p=r[d],p.name===n.name){if(p.state===So)return Vn(a);p.state===Bs?(p.state=Fn,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete r[d]):+d<t&&(p.state=Fn,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete r[d])}if(Vn(function(){n.state===So&&(n.state=Bs,n.timer.restart(l,n.delay,n.time),l(u))}),n.state=Eo,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Eo){for(n.state=So,i=new Array(h=n.tween.length),d=0,f=-1;d<h;++d)(p=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(i[++f]=p);i.length=f+1}}o(a,"start");function l(u){for(var d=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(c),n.state=Co,1),f=-1,h=i.length;++f<h;)i[f].call(e,d);n.state===Co&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}o(l,"tick");function c(){n.state=Fn,n.timer.stop(),delete r[t];for(var u in r)return;delete e.__transition}o(c,"stop")}o(hd,"create");function xt(e,t){var n=e.__transition,r,i,s=!0,a;if(n){t=t==null?null:t+"";for(a in n){if((r=n[a]).name!==t){s=!1;continue}i=r.state>Eo&&r.state<Co,r.state=Fn,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[a]}s&&delete e.__transition}}o(xt,"default");function Qr(e){return this.each(function(){xt(this,e)})}o(Qr,"default");function pd(e,t){var n,r;return function(){var i=Ne(this,e),s=i.tween;if(s!==n){r=n=s;for(var a=0,l=r.length;a<l;++a)if(r[a].name===t){r=r.slice(),r.splice(a,1);break}}i.tween=r}}o(pd,"tweenRemove");function md(e,t,n){var r,i;if(typeof n!="function")throw new Error;return function(){var s=Ne(this,e),a=s.tween;if(a!==r){i=(r=a).slice();for(var l={name:t,value:n},c=0,u=i.length;c<u;++c)if(i[c].name===t){i[c]=l;break}c===u&&i.push(l)}s.tween=i}}o(md,"tweenFunction");function Jr(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Ce(this.node(),n).tween,i=0,s=r.length,a;i<s;++i)if((a=r[i]).name===e)return a.value;return null}return this.each((t==null?pd:md)(n,e,t))}o(Jr,"default");function Jt(e,t,n){var r=e._id;return e.each(function(){var i=Ne(this,r);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return Ce(i,r).value[t]}}o(Jt,"tweenValue");function Wn(e,t){var n;return(typeof t=="number"?gs:t instanceof lr?cr:(n=lr(t))?(t=n,cr):ys)(e,t)}o(Wn,"default");function gd(e){return function(){this.removeAttribute(e)}}o(gd,"attrRemove");function yd(e){return function(){this.removeAttributeNS(e.space,e.local)}}o(yd,"attrRemoveNS");function xd(e,t,n){var r,i=n+"",s;return function(){var a=this.getAttribute(e);return a===i?null:a===r?s:s=t(r=a,n)}}o(xd,"attrConstant");function wd(e,t,n){var r,i=n+"",s;return function(){var a=this.getAttributeNS(e.space,e.local);return a===i?null:a===r?s:s=t(r=a,n)}}o(wd,"attrConstantNS");function bd(e,t,n){var r,i,s;return function(){var a,l=n(this),c;return l==null?void this.removeAttribute(e):(a=this.getAttribute(e),c=l+"",a===c?null:a===r&&c===i?s:(i=c,s=t(r=a,l)))}}o(bd,"attrFunction");function vd(e,t,n){var r,i,s;return function(){var a,l=n(this),c;return l==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),c=l+"",a===c?null:a===r&&c===i?s:(i=c,s=t(r=a,l)))}}o(vd,"attrFunctionNS");function jr(e,t){var n=Ze(e),r=n==="transform"?ws:Wn;return this.attrTween(e,typeof t=="function"?(n.local?vd:bd)(n,r,Jt(this,"attr."+e,t)):t==null?(n.local?yd:gd)(n):(n.local?wd:xd)(n,r,t))}o(jr,"default");function Sd(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}o(Sd,"attrInterpolate");function Ed(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}o(Ed,"attrInterpolateNS");function Cd(e,t){var n,r;function i(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&Ed(e,s)),n}return o(i,"tween"),i._value=t,i}o(Cd,"attrTweenNS");function _d(e,t){var n,r;function i(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&Sd(e,s)),n}return o(i,"tween"),i._value=t,i}o(_d,"attrTween");function ei(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 r=Ze(e);return this.tween(n,(r.local?Cd:_d)(r,t))}o(ei,"default");function Nd(e,t){return function(){Yn(this,e).delay=+t.apply(this,arguments)}}o(Nd,"delayFunction");function Id(e,t){return t=+t,function(){Yn(this,e).delay=t}}o(Id,"delayConstant");function ti(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Nd:Id)(t,e)):Ce(this.node(),t).delay}o(ti,"default");function Md(e,t){return function(){Ne(this,e).duration=+t.apply(this,arguments)}}o(Md,"durationFunction");function Pd(e,t){return t=+t,function(){Ne(this,e).duration=t}}o(Pd,"durationConstant");function ni(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Md:Pd)(t,e)):Ce(this.node(),t).duration}o(ni,"default");function Td(e,t){if(typeof t!="function")throw new Error;return function(){Ne(this,e).ease=t}}o(Td,"easeConstant");function oi(e){var t=this._id;return arguments.length?this.each(Td(t,e)):Ce(this.node(),t).ease}o(oi,"default");function kd(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Ne(this,e).ease=n}}o(kd,"easeVarying");function ri(e){if(typeof e!="function")throw new Error;return this.each(kd(this._id,e))}o(ri,"default");function ii(e){typeof e!="function"&&(e=qt(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var s=t[i],a=s.length,l=r[i]=[],c,u=0;u<a;++u)(c=s[u])&&e.call(c,c.__data__,u,s)&&l.push(c);return new Ae(r,this._parents,this._name,this._id)}o(ii,"default");function si(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,i=n.length,s=Math.min(r,i),a=new Array(r),l=0;l<s;++l)for(var c=t[l],u=n[l],d=c.length,f=a[l]=new Array(d),h,p=0;p<d;++p)(h=c[p]||u[p])&&(f[p]=h);for(;l<r;++l)a[l]=t[l];return new Ae(a,this._parents,this._name,this._id)}o(si,"default");function Ad(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}o(Ad,"start");function Dd(e,t,n){var r,i,s=Ad(t)?Yn:Ne;return function(){var a=s(this,e),l=a.on;l!==r&&(i=(r=l).copy()).on(t,n),a.on=i}}o(Dd,"onFunction");function ai(e,t){var n=this._id;return arguments.length<2?Ce(this.node(),n).on.on(e):this.each(Dd(n,e,t))}o(ai,"default");function Od(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}o(Od,"removeFunction");function li(){return this.on("end.remove",Od(this._id))}o(li,"default");function ci(e){var t=this._name,n=this._id;typeof e!="function"&&(e=gt(e));for(var r=this._groups,i=r.length,s=new Array(i),a=0;a<i;++a)for(var l=r[a],c=l.length,u=s[a]=new Array(c),d,f,h=0;h<c;++h)(d=l[h])&&(f=e.call(d,d.__data__,h,l))&&("__data__"in d&&(f.__data__=d.__data__),u[h]=f,Je(u[h],t,n,h,u,Ce(d,n)));return new Ae(s,this._parents,t,n)}o(ci,"default");function ui(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Gt(e));for(var r=this._groups,i=r.length,s=[],a=[],l=0;l<i;++l)for(var c=r[l],u=c.length,d,f=0;f<u;++f)if(d=c[f]){for(var h=e.call(d,d.__data__,f,c),p,m=Ce(d,n),v=0,b=h.length;v<b;++v)(p=h[v])&&Je(p,t,n,v,h,m);s.push(h),a.push(d)}return new Ae(s,a,t,n)}o(ui,"default");var $d=Ke.prototype.constructor;function di(){return new $d(this._groups,this._parents)}o(di,"default");function zd(e,t){var n,r,i;return function(){var s=yt(this,e),a=(this.style.removeProperty(e),yt(this,e));return s===a?null:s===n&&a===r?i:i=t(n=s,r=a)}}o(zd,"styleNull");function Fs(e){return function(){this.style.removeProperty(e)}}o(Fs,"styleRemove");function Rd(e,t,n){var r,i=n+"",s;return function(){var a=yt(this,e);return a===i?null:a===r?s:s=t(r=a,n)}}o(Rd,"styleConstant");function Ld(e,t,n){var r,i,s;return function(){var a=yt(this,e),l=n(this),c=l+"";return l==null&&(c=l=(this.style.removeProperty(e),yt(this,e))),a===c?null:a===r&&c===i?s:(i=c,s=t(r=a,l))}}o(Ld,"styleFunction");function Hd(e,t){var n,r,i,s="style."+t,a="end."+s,l;return function(){var c=Ne(this,e),u=c.on,d=c.value[s]==null?l||(l=Fs(t)):void 0;(u!==n||i!==d)&&(r=(n=u).copy()).on(a,i=d),c.on=r}}o(Hd,"styleMaybeRemove");function fi(e,t,n){var r=(e+="")=="transform"?xs:Wn;return t==null?this.styleTween(e,zd(e,r)).on("end.style."+e,Fs(e)):typeof t=="function"?this.styleTween(e,Ld(e,r,Jt(this,"style."+e,t))).each(Hd(this._id,e)):this.styleTween(e,Rd(e,r,t),n).on("end.style."+e,null)}o(fi,"default");function Bd(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}o(Bd,"styleInterpolate");function Vd(e,t,n){var r,i;function s(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&Bd(e,a,n)),r}return o(s,"tween"),s._value=t,s}o(Vd,"styleTween");function hi(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,Vd(e,t,n??""))}o(hi,"default");function Fd(e){return function(){this.textContent=e}}o(Fd,"textConstant");function Yd(e){return function(){var t=e(this);this.textContent=t??""}}o(Yd,"textFunction");function pi(e){return this.tween("text",typeof e=="function"?Yd(Jt(this,"text",e)):Fd(e==null?"":e+""))}o(pi,"default");function Wd(e){return function(t){this.textContent=e.call(this,t)}}o(Wd,"textInterpolate");function Xd(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&Wd(i)),t}return o(r,"tween"),r._value=e,r}o(Xd,"textTween");function mi(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,Xd(e))}o(mi,"default");function gi(){for(var e=this._name,t=this._id,n=_o(),r=this._groups,i=r.length,s=0;s<i;++s)for(var a=r[s],l=a.length,c,u=0;u<l;++u)if(c=a[u]){var d=Ce(c,t);Je(c,e,n,u,a,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new Ae(r,this._parents,e,n)}o(gi,"default");function yi(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(s,a){var l={value:a},c={value:o(function(){--i===0&&s()},"value")};n.each(function(){var u=Ne(this,r),d=u.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(c)),u.on=t}),i===0&&s()})}o(yi,"default");var Zd=0;function Ae(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}o(Ae,"Transition");function Ys(e){return Ke().transition(e)}o(Ys,"transition");function _o(){return++Zd}o(_o,"newId");var je=Ke.prototype;Ae.prototype=Ys.prototype={constructor:Ae,select:ci,selectAll:ui,selectChild:je.selectChild,selectChildren:je.selectChildren,filter:ii,merge:si,selection:di,transition:gi,call:je.call,nodes:je.nodes,node:je.node,size:je.size,empty:je.empty,each:je.each,on:ai,attr:jr,attrTween:ei,style:fi,styleTween:hi,text:pi,textTween:mi,remove:li,tween:Jr,delay:ti,duration:ni,ease:oi,easeVarying:ri,end:yi,[Symbol.iterator]:je[Symbol.iterator]};function No(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}o(No,"cubicInOut");var Ud={time:null,delay:0,duration:250,ease:No};function Gd(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}o(Gd,"inherit");function xi(e){var t,n;e instanceof Ae?(t=e._id,e=e._name):(t=_o(),(n=Ud).time=Bn(),e=e==null?null:e+"");for(var r=this._groups,i=r.length,s=0;s<i;++s)for(var a=r[s],l=a.length,c,u=0;u<l;++u)(c=a[u])&&Je(c,e,t,u,a,n||Gd(c,t));return new Ae(r,this._parents,e,t)}o(xi,"default");Ke.prototype.interrupt=Qr;Ke.prototype.transition=xi;var Xn=o(e=>()=>e,"default");function wi(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){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:r,enumerable:!0,configurable:!0},_:{value:i}})}o(wi,"ZoomEvent");function Ve(e,t,n){this.k=e,this.x=t,this.y=n}o(Ve,"Transform");Ve.prototype={constructor:Ve,scale:o(function(e){return e===1?this:new Ve(this.k*e,this.x,this.y)},"scale"),translate:o(function(e,t){return e===0&t===0?this:new Ve(this.k,this.x+this.k*e,this.y+this.k*t)},"translate"),apply:o(function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},"apply"),applyX:o(function(e){return e*this.k+this.x},"applyX"),applyY:o(function(e){return e*this.k+this.y},"applyY"),invert:o(function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},"invert"),invertX:o(function(e){return(e-this.x)/this.k},"invertX"),invertY:o(function(e){return(e-this.y)/this.k},"invertY"),rescaleX:o(function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},"rescaleX"),rescaleY:o(function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},"rescaleY"),toString:o(function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"},"toString")};var At=new Ve(1,0,0);Zn.prototype=Ve.prototype;function Zn(e){for(;!e.__zoom;)if(!(e=e.parentNode))return At;return e.__zoom}o(Zn,"transform");function Io(e){e.stopImmediatePropagation()}o(Io,"nopropagation");function Dt(e){e.preventDefault(),e.stopImmediatePropagation()}o(Dt,"default");function qd(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}o(qd,"defaultFilter");function Kd(){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]]}o(Kd,"defaultExtent");function Ws(){return this.__zoom||At}o(Ws,"defaultTransform");function Qd(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}o(Qd,"defaultWheelDelta");function Jd(){return navigator.maxTouchPoints||"ontouchstart"in this}o(Jd,"defaultTouchable");function jd(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a))}o(jd,"defaultConstrain");function Un(){var e=qd,t=Kd,n=jd,r=Qd,i=Jd,s=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,c=Ut,u=Pt("start","zoom","end"),d,f,h,p=500,m=150,v=0,b=10;function y(x){x.property("__zoom",Ws).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",Y).filter(i).on("touchstart.zoom",z).on("touchmove.zoom",V).on("touchend.zoom touchcancel.zoom",L).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}o(y,"zoom"),y.transform=function(x,S,C,I){var $=x.selection?x.selection():x;$.property("__zoom",Ws),x!==$?M(x,S,C,I):$.interrupt().each(function(){_(this,arguments).event(I).start().zoom(null,typeof S=="function"?S.apply(this,arguments):S).end()})},y.scaleBy=function(x,S,C,I){y.scaleTo(x,function(){var $=this.__zoom.k,A=typeof S=="function"?S.apply(this,arguments):S;return $*A},C,I)},y.scaleTo=function(x,S,C,I){y.transform(x,function(){var $=t.apply(this,arguments),A=this.__zoom,B=C==null?w($):typeof C=="function"?C.apply(this,arguments):C,F=A.invert(B),H=typeof S=="function"?S.apply(this,arguments):S;return n(g(E(A,H),B,F),$,a)},C,I)},y.translateBy=function(x,S,C,I){y.transform(x,function(){return n(this.__zoom.translate(typeof S=="function"?S.apply(this,arguments):S,typeof C=="function"?C.apply(this,arguments):C),t.apply(this,arguments),a)},null,I)},y.translateTo=function(x,S,C,I,$){y.transform(x,function(){var A=t.apply(this,arguments),B=this.__zoom,F=I==null?w(A):typeof I=="function"?I.apply(this,arguments):I;return n(At.translate(F[0],F[1]).scale(B.k).translate(typeof S=="function"?-S.apply(this,arguments):-S,typeof C=="function"?-C.apply(this,arguments):-C),A,a)},I,$)};function E(x,S){return S=Math.max(s[0],Math.min(s[1],S)),S===x.k?x:new Ve(S,x.x,x.y)}o(E,"scale");function g(x,S,C){var I=S[0]-C[0]*x.k,$=S[1]-C[1]*x.k;return I===x.x&&$===x.y?x:new Ve(x.k,I,$)}o(g,"translate");function w(x){return[(+x[0][0]+ +x[1][0])/2,(+x[0][1]+ +x[1][1])/2]}o(w,"centroid");function M(x,S,C,I){x.on("start.zoom",function(){_(this,arguments).event(I).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(I).end()}).tween("zoom",function(){var $=this,A=arguments,B=_($,A).event(I),F=t.apply($,A),H=C==null?w(F):typeof C=="function"?C.apply($,A):C,U=Math.max(F[1][0]-F[0][0],F[1][1]-F[0][1]),Z=$.__zoom,W=typeof S=="function"?S.apply($,A):S,j=c(Z.invert(H).concat(U/Z.k),W.invert(H).concat(U/W.k));return function(K){if(K===1)K=W;else{var R=j(K),X=U/R[2];K=new Ve(X,H[0]-R[0]*X,H[1]-R[1]*X)}B.zoom(null,K)}})}o(M,"schedule");function _(x,S,C){return!C&&x.__zooming||new P(x,S)}o(_,"gesture");function P(x,S){this.that=x,this.args=S,this.active=0,this.sourceEvent=null,this.extent=t.apply(x,S),this.taps=0}o(P,"Gesture"),P.prototype={event:o(function(x){return x&&(this.sourceEvent=x),this},"event"),start:o(function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},"start"),zoom:o(function(x,S){return this.mouse&&x!=="mouse"&&(this.mouse[1]=S.invert(this.mouse[0])),this.touch0&&x!=="touch"&&(this.touch0[1]=S.invert(this.touch0[0])),this.touch1&&x!=="touch"&&(this.touch1[1]=S.invert(this.touch1[0])),this.that.__zoom=S,this.emit("zoom"),this},"zoom"),end:o(function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},"end"),emit:o(function(x){var S=Ee(this.that).datum();u.call(x,this.that,new wi(x,{sourceEvent:this.sourceEvent,target:y,type:x,transform:this.that.__zoom,dispatch:u}),S)},"emit")};function T(x,...S){if(!e.apply(this,arguments))return;var C=_(this,S).event(x),I=this.__zoom,$=Math.max(s[0],Math.min(s[1],I.k*Math.pow(2,r.apply(this,arguments)))),A=Me(x);if(C.wheel)(C.mouse[0][0]!==A[0]||C.mouse[0][1]!==A[1])&&(C.mouse[1]=I.invert(C.mouse[0]=A)),clearTimeout(C.wheel);else{if(I.k===$)return;C.mouse=[A,I.invert(A)],xt(this),C.start()}Dt(x),C.wheel=setTimeout(B,m),C.zoom("mouse",n(g(E(I,$),C.mouse[0],C.mouse[1]),C.extent,a));function B(){C.wheel=null,C.end()}o(B,"wheelidled")}o(T,"wheeled");function k(x,...S){if(h||!e.apply(this,arguments))return;var C=x.currentTarget,I=_(this,S,!0).event(x),$=Ee(x.view).on("mousemove.zoom",H,!0).on("mouseup.zoom",U,!0),A=Me(x,C),B=x.clientX,F=x.clientY;Kt(x.view),Io(x),I.mouse=[A,this.__zoom.invert(A)],xt(this),I.start();function H(Z){if(Dt(Z),!I.moved){var W=Z.clientX-B,j=Z.clientY-F;I.moved=W*W+j*j>v}I.event(Z).zoom("mouse",n(g(I.that.__zoom,I.mouse[0]=Me(Z,C),I.mouse[1]),I.extent,a))}o(H,"mousemoved");function U(Z){$.on("mousemove.zoom mouseup.zoom",null),kn(Z.view,I.moved),Dt(Z),I.event(Z).end()}o(U,"mouseupped")}o(k,"mousedowned");function Y(x,...S){if(e.apply(this,arguments)){var C=this.__zoom,I=Me(x.changedTouches?x.changedTouches[0]:x,this),$=C.invert(I),A=C.k*(x.shiftKey?.5:2),B=n(g(E(C,A),I,$),t.apply(this,S),a);Dt(x),l>0?Ee(this).transition().duration(l).call(M,B,I,x):Ee(this).call(y.transform,B,I,x)}}o(Y,"dblclicked");function z(x,...S){if(e.apply(this,arguments)){var C=x.touches,I=C.length,$=_(this,S,x.changedTouches.length===I).event(x),A,B,F,H;for(Io(x),B=0;B<I;++B)F=C[B],H=Me(F,this),H=[H,this.__zoom.invert(H),F.identifier],$.touch0?!$.touch1&&$.touch0[2]!==H[2]&&($.touch1=H,$.taps=0):($.touch0=H,A=!0,$.taps=1+!!d);d&&(d=clearTimeout(d)),A&&($.taps<2&&(f=H[0],d=setTimeout(function(){d=null},p)),xt(this),$.start())}}o(z,"touchstarted");function V(x,...S){if(this.__zooming){var C=_(this,S).event(x),I=x.changedTouches,$=I.length,A,B,F,H;for(Dt(x),A=0;A<$;++A)B=I[A],F=Me(B,this),C.touch0&&C.touch0[2]===B.identifier?C.touch0[0]=F:C.touch1&&C.touch1[2]===B.identifier&&(C.touch1[0]=F);if(B=C.that.__zoom,C.touch1){var U=C.touch0[0],Z=C.touch0[1],W=C.touch1[0],j=C.touch1[1],K=(K=W[0]-U[0])*K+(K=W[1]-U[1])*K,R=(R=j[0]-Z[0])*R+(R=j[1]-Z[1])*R;B=E(B,Math.sqrt(K/R)),F=[(U[0]+W[0])/2,(U[1]+W[1])/2],H=[(Z[0]+j[0])/2,(Z[1]+j[1])/2]}else if(C.touch0)F=C.touch0[0],H=C.touch0[1];else return;C.zoom("touch",n(g(B,F,H),C.extent,a))}}o(V,"touchmoved");function L(x,...S){if(this.__zooming){var C=_(this,S).event(x),I=x.changedTouches,$=I.length,A,B;for(Io(x),h&&clearTimeout(h),h=setTimeout(function(){h=null},p),A=0;A<$;++A)B=I[A],C.touch0&&C.touch0[2]===B.identifier?delete C.touch0:C.touch1&&C.touch1[2]===B.identifier&&delete C.touch1;if(C.touch1&&!C.touch0&&(C.touch0=C.touch1,delete C.touch1),C.touch0)C.touch0[1]=this.__zoom.invert(C.touch0[0]);else if(C.end(),C.taps===2&&(B=Me(B,this),Math.hypot(f[0]-B[0],f[1]-B[1])<b)){var F=Ee(this).on("dblclick.zoom");F&&F.apply(this,arguments)}}}return o(L,"touchended"),y.wheelDelta=function(x){return arguments.length?(r=typeof x=="function"?x:Xn(+x),y):r},y.filter=function(x){return arguments.length?(e=typeof x=="function"?x:Xn(!!x),y):e},y.touchable=function(x){return arguments.length?(i=typeof x=="function"?x:Xn(!!x),y):i},y.extent=function(x){return arguments.length?(t=typeof x=="function"?x:Xn([[+x[0][0],+x[0][1]],[+x[1][0],+x[1][1]]]),y):t},y.scaleExtent=function(x){return arguments.length?(s[0]=+x[0],s[1]=+x[1],y):[s[0],s[1]]},y.translateExtent=function(x){return arguments.length?(a[0][0]=+x[0][0],a[1][0]=+x[1][0],a[0][1]=+x[0][1],a[1][1]=+x[1][1],y):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},y.constrain=function(x){return arguments.length?(n=x,y):n},y.duration=function(x){return arguments.length?(l=+x,y):l},y.interpolate=function(x){return arguments.length?(c=x,y):c},y.on=function(){var x=u.on.apply(u,arguments);return x===u?y:x},y.clickDistance=function(x){return arguments.length?(v=(x=+x)*x,y):Math.sqrt(v)},y.tapDistance=function(x){return arguments.length?(b=+x,y):b},y}o(Un,"default");var De={error001:o((e="react")=>`Seems like you have not used ${e==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.dev/error#001`,"error001"),error002:o(()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.","error002"),error003:o(e=>`Node type "${e}" not found. Using fallback type "default".`,"error003"),error004:o(()=>"The parent container needs a width and a height to render the graph.","error004"),error005:o(()=>"Only child nodes can use a parent extent.","error005"),error006:o(()=>"Can't create edge. An edge needs a source and a target.","error006"),error007:o(e=>`The old edge with id=${e} does not exist.`,"error007"),error009:o(e=>`Marker type "${e}" doesn't exist.`,"error009"),error008:o((e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,"error008"),error010:o(()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.","error010"),error011:o(e=>`Edge type "${e}" not found. Using fallback type "default".`,"error011"),error012:o(e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,"error012"),error013:o((e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,"error013"),error014:o(()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.","error014"),error015:o(()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.","error015"),error016:o(e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`,"error016")},on=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Ci=["Enter"," ","Escape"],_i={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":o(({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"node.a11yDescription.ariaLiveMessage"),"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"},vt;(function(e){e.Strict="strict",e.Loose="loose"})(vt||(vt={}));var et;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(et||(et={}));var Ot;(function(e){e.Partial="partial",e.Full="full"})(Ot||(Ot={}));var Ni={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},Ue;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ue||(Ue={}));var tn;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(tn||(tn={}));var J;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(J||(J={}));var Xs={[J.Left]:J.Right,[J.Right]:J.Left,[J.Top]:J.Bottom,[J.Bottom]:J.Top};function Ii(e){return e===null?null:e?"valid":"invalid"}o(Ii,"getConnectionStatus");var Mi=o(e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,"isEdgeBase"),ra=o(e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),"isNodeBase"),Pi=o(e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),"isInternalNodeBase");var qn=o((e,t=[0,0])=>{let{width:n,height:r}=Fe(e),i=e.origin??t,s=n*i[0],a=r*i[1];return{x:e.position.x-s,y:e.position.y-a}},"getNodePositionWithOrigin"),Kn=o((e,t={nodeOrigin:[0,0]})=>{if(t.nodeLookup||console.warn("Please use `getNodesBounds` from `useReactFlow`/`useSvelteFlow` hook to ensure correct values for sub flows. If not possible, you have to provide a nodeLookup to support sub flows."),e.length===0)return{x:0,y:0,width:0,height:0};let n=e.reduce((r,i)=>{let s=typeof i=="string",a=!t.nodeLookup&&!s?i:void 0;t.nodeLookup&&(a=s?t.nodeLookup.get(i):Pi(i)?i:t.nodeLookup.get(i.id));let l=a?To(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Do(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Oo(n)},"getNodesBounds"),rn=o((e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(i=>{(t.filter===void 0||t.filter(i))&&(n=Do(n,To(i)),r=!0)}),r?Oo(n):{x:0,y:0,width:0,height:0}},"getInternalNodesBounds"),ko=o((e,t,[n,r,i]=[0,0,1],s=!1,a=!1)=>{let l=(t.x-n)/i,c=(t.y-r)/i,u=t.width/i,d=t.height/i,f=[];for(let h of e.values()){let{measured:p,selectable:m=!0,hidden:v=!1}=h;if(a&&!m||v)continue;let b=p.width??h.width??h.initialWidth??0,y=p.height??h.height??h.initialHeight??0,{x:E,y:g}=h.internals.positionAbsolute,w=ca(l,c,u,d,E,g,b,y),M=b*y,_=s&&w>0;(!h.internals.handleBounds||_||w>=M||h.dragging)&&f.push(h)}return f},"getNodesInside"),ia=o((e,t)=>{let n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))},"getConnectedEdges");function ef(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(i=>i.id)):null;return e.forEach(i=>{let s;if(t?.includeHiddenNodes){let{width:a,height:l}=Fe(i);s=a>0&&l>0}else s=!!(i.measured.width&&i.measured.height&&!i.hidden);s&&(!r||r.has(i.id))&&n.set(i.id,i)}),n}o(ef,"getFitViewNodes");async function sa({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:s},a){if(e.size===0)return!0;let l=ef(e,a),c=rn(l),u=Lt(c,t,n,a?.minZoom??i,a?.maxZoom??s,a?.padding??.1);return await r.setViewport(u,{duration:a?.duration,ease:a?.ease,interpolate:a?.interpolate}),!0}o(sa,"fitViewport");function Ti({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:s}){let a=n.get(e),l=a.parentId?n.get(a.parentId):void 0,{x:c,y:u}=l?l.internals.positionAbsolute:{x:0,y:0},d=a.origin??r,f=a.extent||i;if(a.extent==="parent"&&!a.expandParent)if(!l)s?.("005",De.error005());else{let p=l.measured.width,m=l.measured.height;p&&m&&(f=[[c,u],[c+p,u+m]])}else l&&Rt(a.extent)&&(f=[[a.extent[0][0]+c,a.extent[0][1]+u],[a.extent[1][0]+c,a.extent[1][1]+u]]);let h=Rt(f)?$t(t,f,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&s?.("015",De.error015()),{position:{x:h.x-c+(a.measured.width??0)*d[0],y:h.y-u+(a.measured.height??0)*d[1]},positionAbsolute:h}}o(Ti,"calculateNodePosition");async function aa({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let s=new Set(e.map(h=>h.id)),a=[];for(let h of n){if(h.deletable===!1)continue;let p=s.has(h.id),m=!p&&h.parentId&&a.find(v=>v.id===h.parentId);(p||m)&&a.push(h)}let l=new Set(t.map(h=>h.id)),c=r.filter(h=>h.deletable!==!1),d=ia(a,c);for(let h of c)l.has(h.id)&&!d.find(m=>m.id===h.id)&&d.push(h);if(!i)return{edges:d,nodes:a};let f=await i({nodes:a,edges:d});return typeof f=="boolean"?f?{edges:d,nodes:a}:{edges:[],nodes:[]}:f}o(aa,"getElementsToRemove");var nn=o((e,t=0,n=1)=>Math.min(Math.max(e,t),n),"clamp"),$t=o((e={x:0,y:0},t,n)=>({x:nn(e.x,t[0][0],t[1][0]-(n?.width??0)),y:nn(e.y,t[0][1],t[1][1]-(n?.height??0))}),"clampPosition");function la(e,t,n){let{width:r,height:i}=Fe(n),{x:s,y:a}=n.internals.positionAbsolute;return $t(e,[[s,a],[s+r,a+i]],t)}o(la,"clampPositionToParent");var Zs=o((e,t,n)=>e<t?nn(Math.abs(e-t),1,t)/t:e>n?-nn(Math.abs(e-n),1,t)/t:0,"calcAutoPanVelocity"),Ao=o((e,t,n=15,r=40)=>{let i=Zs(e.x,r,t.width-r)*n,s=Zs(e.y,r,t.height-r)*n;return[i,s]},"calcAutoPan"),Do=o((e,t)=>({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)}),"getBoundsOfBoxes"),Ei=o(({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),"rectToBox"),Oo=o(({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),"boxToRect"),sn=o((e,t=[0,0])=>{let{x:n,y:r}=Pi(e)?e.internals.positionAbsolute:qn(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},"nodeToRect"),To=o((e,t=[0,0])=>{let{x:n,y:r}=Pi(e)?e.internals.positionAbsolute:qn(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},"nodeToBox"),ki=o((e,t)=>Oo(Do(Ei(e),Ei(t))),"getBoundsOfRects"),ca=o((e,t,n,r,i,s,a,l)=>{let c=Math.max(0,Math.min(e+n,i+a)-Math.max(e,i)),u=Math.max(0,Math.min(t+r,s+l)-Math.max(t,s));return Math.ceil(c*u)},"getRectsOverlappingArea"),Qn=o((e,t)=>ca(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),"getOverlappingArea"),Ai=o(e=>Le(e.width)&&Le(e.height)&&Le(e.x)&&Le(e.y),"isRectObject"),Le=o(e=>!isNaN(e)&&isFinite(e),"isNumeric"),Di=o((e,t)=>(n,r)=>{console.warn(`[${e}]: ${r} Help: ${t}error#${n}`)},"createDevWarn"),an=o((e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),"snapPosition"),ln=o(({x:e,y:t},[n,r,i],s=!1,a=[1,1])=>{let l={x:(e-n)/i,y:(t-r)/i};return s?an(l,a):l},"pointToRendererPoint"),zt=o(({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r}),"rendererPointToPoint");function jt(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}o(jt,"parsePadding");function tf(e,t,n){if(typeof e=="string"||typeof e=="number"){let r=jt(e,n),i=jt(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e=="object"){let r=jt(e.top??e.y??0,n),i=jt(e.bottom??e.y??0,n),s=jt(e.left??e.x??0,t),a=jt(e.right??e.x??0,t);return{top:r,right:a,bottom:i,left:s,x:s+a,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}o(tf,"parsePaddings");function nf(e,t,n,r,i,s){let{x:a,y:l}=zt(e,[t,n,r]),{x:c,y:u}=zt({x:e.x+e.width,y:e.y+e.height},[t,n,r]),d=i-c,f=s-u;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(d),bottom:Math.floor(f)}}o(nf,"calculateAppliedPaddings");var Lt=o((e,t,n,r,i,s)=>{let a=tf(s,t,n),l=(t-a.x)/e.width,c=(n-a.y)/e.height,u=Math.min(l,c),d=nn(u,r,i),f=e.x+e.width/2,h=e.y+e.height/2,p=t/2-f*d,m=n/2-h*d,v=nf(e,p,m,d,t,n),b={left:Math.min(v.left-a.left,0),top:Math.min(v.top-a.top,0),right:Math.min(v.right-a.right,0),bottom:Math.min(v.bottom-a.bottom,0)};return{x:p-b.left+b.right,y:m-b.top+b.bottom,zoom:d}},"getViewportForBounds"),cn=o(()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0,"isMacOs");function Rt(e){return e!=null&&e!=="parent"}o(Rt,"isCoordinateExtent");function Fe(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}o(Fe,"getNodeDimensions");function Oi(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}o(Oi,"nodeHasDimensions");function $i(e,t={width:0,height:0},n,r,i){let s={...e},a=r.get(n);if(a){let l=a.origin||i;s.x+=a.internals.positionAbsolute.x-(t.width??0)*l[0],s.y+=a.internals.positionAbsolute.y-(t.height??0)*l[1]}return s}o($i,"evaluateAbsolutePosition");function zi(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}o(zi,"areSetsEqual");function ua(){let e,t;return{promise:new Promise((r,i)=>{e=r,t=i}),resolve:e,reject:t}}o(ua,"withResolvers");function da(e){return{..._i,...e||{}}}o(da,"mergeAriaLabelConfig");function Gn(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:s,y:a}=He(e),l=ln({x:s-(i?.left??0),y:a-(i?.top??0)},r),{x:c,y:u}=n?an(l,t):l;return{xSnapped:c,ySnapped:u,...l}}o(Gn,"getPointerPosition");var $o=o(e=>({width:e.offsetWidth,height:e.offsetHeight}),"getDimensions"),Ri=o(e=>e?.getRootNode?.()||window?.document,"getHostForElement"),of=["INPUT","SELECT","TEXTAREA"];function Li(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:of.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}o(Li,"isInputDOMNode");var Hi=o(e=>"clientX"in e,"isMouseEvent"),He=o((e,t)=>{let n=Hi(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},"getEventPosition"),Us=o((e,t,n,r,i)=>{let s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(a=>{let l=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:i,position:a.getAttribute("data-handlepos"),x:(l.left-n.left)/r,y:(l.top-n.top)/r,...$o(a)}})},"getHandleBounds");function zo({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:s,targetControlX:a,targetControlY:l}){let c=e*.125+i*.375+a*.375+n*.125,u=t*.125+s*.375+l*.375+r*.125,d=Math.abs(c-e),f=Math.abs(u-t);return[c,u,d,f]}o(zo,"getBezierEdgeCenter");function Mo(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}o(Mo,"calculateControlOffset");function Gs({pos:e,x1:t,y1:n,x2:r,y2:i,c:s}){switch(e){case J.Left:return[t-Mo(t-r,s),n];case J.Right:return[t+Mo(r-t,s),n];case J.Top:return[t,n-Mo(n-i,s)];case J.Bottom:return[t,n+Mo(i-n,s)]}}o(Gs,"getControlWithCurvature");function Ro({sourceX:e,sourceY:t,sourcePosition:n=J.Bottom,targetX:r,targetY:i,targetPosition:s=J.Top,curvature:a=.25}){let[l,c]=Gs({pos:n,x1:e,y1:t,x2:r,y2:i,c:a}),[u,d]=Gs({pos:s,x1:r,y1:i,x2:e,y2:t,c:a}),[f,h,p,m]=zo({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:d});return[`M${e},${t} C${l},${c} ${u},${d} ${r},${i}`,f,h,p,m]}o(Ro,"getBezierPath");function Bi({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,s=n<e?n+i:n-i,a=Math.abs(r-t)/2,l=r<t?r+a:r-a;return[s,l,i,a]}o(Bi,"getEdgeCenter");function fa({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:s="basic"}){if(s==="manual")return r;let a=i&&n?r+1e3:r,l=Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0);return a+l}o(fa,"getElevatedEdgeZIndex");function ha({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let s=Do(To(e),To(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);let a={x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]};return Qn(a,Oo(s))>0}o(ha,"isEdgeVisible");var rf=o(({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,"getEdgeId"),sf=o((e,t)=>t.some(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)),"connectionExists"),pa=o((e,t,n={})=>{if(!e.source||!e.target)return n.onError?.("006",De.error006()),t;let r=n.getEdgeId||rf,i;return Mi(e)?i={...e}:i={...e,id:r(e)},sf(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))},"addEdge");function Lo({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,s,a,l]=Bi({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,s,a,l]}o(Lo,"getStraightPath");var qs={[J.Left]:{x:-1,y:0},[J.Right]:{x:1,y:0},[J.Top]:{x:0,y:-1},[J.Bottom]:{x:0,y:1}},af=o(({source:e,sourcePosition:t=J.Bottom,target:n})=>t===J.Left||t===J.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},"getDirection"),Ks=o((e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)),"distance");function lf({source:e,sourcePosition:t=J.Bottom,target:n,targetPosition:r=J.Top,center:i,offset:s,stepPosition:a}){let l=qs[t],c=qs[r],u={x:e.x+l.x*s,y:e.y+l.y*s},d={x:n.x+c.x*s,y:n.y+c.y*s},f=af({source:u,sourcePosition:t,target:d}),h=f.x!==0?"x":"y",p=f[h],m=[],v,b,y={x:0,y:0},E={x:0,y:0},[,,g,w]=Bi({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[h]*c[h]===-1){h==="x"?(v=i.x??u.x+(d.x-u.x)*a,b=i.y??(u.y+d.y)/2):(v=i.x??(u.x+d.x)/2,b=i.y??u.y+(d.y-u.y)*a);let T=[{x:v,y:u.y},{x:v,y:d.y}],k=[{x:u.x,y:b},{x:d.x,y:b}];l[h]===p?m=h==="x"?T:k:m=h==="x"?k:T}else{let T=[{x:u.x,y:d.y}],k=[{x:d.x,y:u.y}];if(h==="x"?m=l.x===p?k:T:m=l.y===p?T:k,t===r){let x=Math.abs(e[h]-n[h]);if(x<=s){let S=Math.min(s-1,s-x);l[h]===p?y[h]=(u[h]>e[h]?-1:1)*S:E[h]=(d[h]>n[h]?-1:1)*S}}if(t!==r){let x=h==="x"?"y":"x",S=l[h]===c[x],C=u[x]>d[x],I=u[x]<d[x];(l[h]===1&&(!S&&C||S&&I)||l[h]!==1&&(!S&&I||S&&C))&&(m=h==="x"?T:k)}let Y={x:u.x+y.x,y:u.y+y.y},z={x:d.x+E.x,y:d.y+E.y},V=Math.max(Math.abs(Y.x-m[0].x),Math.abs(z.x-m[0].x)),L=Math.max(Math.abs(Y.y-m[0].y),Math.abs(z.y-m[0].y));V>=L?(v=(Y.x+z.x)/2,b=m[0].y):(v=m[0].x,b=(Y.y+z.y)/2)}let M={x:u.x+y.x,y:u.y+y.y},_={x:d.x+E.x,y:d.y+E.y};return[[e,...M.x!==m[0].x||M.y!==m[0].y?[M]:[],...m,..._.x!==m[m.length-1].x||_.y!==m[m.length-1].y?[_]:[],n],v,b,g,w]}o(lf,"getPoints");function cf(e,t,n,r){let i=Math.min(Ks(e,t)/2,Ks(t,n)/2,r),{x:s,y:a}=t;if(e.x===s&&s===n.x||e.y===a&&a===n.y)return`L${s} ${a}`;if(e.y===a){let u=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${s+i*u},${a}Q ${s},${a} ${s},${a+i*d}`}let l=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${s},${a+i*c}Q ${s},${a} ${s+i*l},${a}`}o(cf,"getBend");function Jn({sourceX:e,sourceY:t,sourcePosition:n=J.Bottom,targetX:r,targetY:i,targetPosition:s=J.Top,borderRadius:a=5,centerX:l,centerY:c,offset:u=20,stepPosition:d=.5}){let[f,h,p,m,v]=lf({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:s,center:{x:l,y:c},offset:u,stepPosition:d}),b=`M${f[0].x} ${f[0].y}`;for(let y=1;y<f.length-1;y++)b+=cf(f[y-1],f[y],f[y+1],a);return b+=`L${f[f.length-1].x} ${f[f.length-1].y}`,[b,h,p,m,v]}o(Jn,"getSmoothStepPath");function Qs(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}o(Qs,"isNodeInitialized");function ma(e){let{sourceNode:t,targetNode:n}=e;if(!Qs(t)||!Qs(n))return null;let r=t.internals.handleBounds||Js(t.handles),i=n.internals.handleBounds||Js(n.handles),s=js(r?.source??[],e.sourceHandle),a=js(e.connectionMode===vt.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!s||!a)return e.onError?.("008",De.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let l=s?.position||J.Bottom,c=a?.position||J.Top,u=St(t,s,l),d=St(n,a,c);return{sourceX:u.x,sourceY:u.y,targetX:d.x,targetY:d.y,sourcePosition:l,targetPosition:c}}o(ma,"getEdgePosition");function Js(e){if(!e)return null;let t=[],n=[];for(let r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}o(Js,"toHandleBounds");function St(e,t,n=J.Left,r=!1){let i=(t?.x??0)+e.internals.positionAbsolute.x,s=(t?.y??0)+e.internals.positionAbsolute.y,{width:a,height:l}=t??Fe(e);if(r)return{x:i+a/2,y:s+l/2};switch(t?.position??n){case J.Top:return{x:i+a/2,y:s};case J.Right:return{x:i+a,y:s+l/2};case J.Bottom:return{x:i+a/2,y:s+l};case J.Left:return{x:i,y:s+l/2}}}o(St,"getHandlePosition");function js(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}o(js,"getHandle$1");function Ho(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}o(Ho,"getMarkerId");function ga(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let s=new Set;return e.reduce((a,l)=>([l.markerStart||r,l.markerEnd||i].forEach(c=>{if(c&&typeof c=="object"){let u=Ho(c,t);s.has(u)||(a.push({id:u,color:c.color||n,...c}),s.add(u))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))}o(ga,"createMarkerIds");var ya=1e3,uf=10,Vi={nodeOrigin:[0,0],nodeExtent:on,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},df={...Vi,checkEquality:!0};function Fi(e,t){let n={...e};for(let r in t)t[r]!==void 0&&(n[r]=t[r]);return n}o(Fi,"mergeObjects");function xa(e,t,n){let r=Fi(Vi,n);for(let i of e.values())if(i.parentId)Wi(i,e,t,r);else{let s=qn(i,r.nodeOrigin),a=Rt(i.extent)?i.extent:r.nodeExtent,l=$t(s,a,Fe(i));i.internals.positionAbsolute=l}}o(xa,"updateAbsolutePositions");function ff(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let i of e.handles){let s={id:i.id,width:i.width??1,height:i.height??1,nodeId:e.id,x:i.x,y:i.y,position:i.position,type:i.type};i.type==="source"?n.push(s):i.type==="target"&&r.push(s)}return{source:n,target:r}}o(ff,"parseHandles");function Yi(e){return e==="manual"}o(Yi,"isManualZIndexMode");function Bo(e,t,n,r={}){let i=Fi(df,r),s={i:0},a=new Map(t),l=i?.elevateNodesOnSelect&&!Yi(i.zIndexMode)?ya:0,c=e.length>0,u=!1;t.clear(),n.clear();for(let d of e){let f=a.get(d.id);if(i.checkEquality&&d===f?.internals.userNode)t.set(d.id,f);else{let h=qn(d,i.nodeOrigin),p=Rt(d.extent)?d.extent:i.nodeExtent,m=$t(h,p,Fe(d));f={...i.defaults,...d,measured:{width:d.measured?.width,height:d.measured?.height},internals:{positionAbsolute:m,handleBounds:ff(d,f),z:wa(d,l,i.zIndexMode),userNode:d}},t.set(d.id,f)}(f.measured===void 0||f.measured.width===void 0||f.measured.height===void 0)&&!f.hidden&&(c=!1),d.parentId&&Wi(f,t,n,r,s),u||=d.selected??!1}return{nodesInitialized:c,hasSelectedNodes:u}}o(Bo,"adoptUserNodes");function hf(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}o(hf,"updateParentLookup");function Wi(e,t,n,r,i){let{elevateNodesOnSelect:s,nodeOrigin:a,nodeExtent:l,zIndexMode:c}=Fi(Vi,r),u=e.parentId,d=t.get(u);if(!d){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}hf(e,n),i&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++i.i,d.internals.z=d.internals.z+i.i*uf),i&&d.internals.rootParentIndex!==void 0&&(i.i=d.internals.rootParentIndex);let f=s&&!Yi(c)?ya:0,{x:h,y:p,z:m}=pf(e,d,a,l,f,c),{positionAbsolute:v}=e.internals,b=h!==v.x||p!==v.y;(b||m!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:b?{x:h,y:p}:v,z:m}})}o(Wi,"updateChildNode");function wa(e,t,n){let r=Le(e.zIndex)?e.zIndex:0;return Yi(n)?r:r+(e.selected?t:0)}o(wa,"calculateZ");function pf(e,t,n,r,i,s){let{x:a,y:l}=t.internals.positionAbsolute,c=Fe(e),u=qn(e,n),d=Rt(e.extent)?$t(u,e.extent,c):u,f=$t({x:a+d.x,y:l+d.y},r,c);e.extent==="parent"&&(f=la(f,c,t));let h=wa(e,i,s),p=t.internals.z??0;return{x:f.x,y:f.y,z:p>=h?p+1:h}}o(pf,"calculateChildXYZ");function Vo(e,t,n,r=[0,0]){let i=[],s=new Map;for(let a of e){let l=t.get(a.parentId);if(!l)continue;let c=s.get(a.parentId)?.expandedRect??sn(l),u=ki(c,a.rect);s.set(a.parentId,{expandedRect:u,parent:l})}return s.size>0&&s.forEach(({expandedRect:a,parent:l},c)=>{let u=l.internals.positionAbsolute,d=Fe(l),f=l.origin??r,h=a.x<u.x?Math.round(Math.abs(u.x-a.x)):0,p=a.y<u.y?Math.round(Math.abs(u.y-a.y)):0,m=Math.max(d.width,Math.round(a.width)),v=Math.max(d.height,Math.round(a.height)),b=(m-d.width)*f[0],y=(v-d.height)*f[1];(h>0||p>0||b||y)&&(i.push({id:c,type:"position",position:{x:l.position.x-h+b,y:l.position.y-p+y}}),n.get(c)?.forEach(E=>{e.some(g=>g.id===E.id)||i.push({id:E.id,type:"position",position:{x:E.position.x+h,y:E.position.y+p}})})),(d.width<a.width||d.height<a.height||h||p)&&i.push({id:c,type:"dimensions",setAttributes:!0,dimensions:{width:m+(h?f[0]*h-b:0),height:v+(p?f[1]*p-y:0)}})}),i}o(Vo,"handleExpandParent");function ba(e,t,n,r,i,s,a){let l=r?.querySelector(".xyflow__viewport"),c=!1;if(!l)return{changes:[],updatedInternals:c};let u=[],d=window.getComputedStyle(l),{m22:f}=new window.DOMMatrixReadOnly(d.transform),h=[];for(let p of e.values()){let m=t.get(p.id);if(!m)continue;if(m.hidden){t.set(m.id,{...m,internals:{...m.internals,handleBounds:void 0}}),c=!0;continue}let v=$o(p.nodeElement),b=m.measured.width!==v.width||m.measured.height!==v.height;if(!!(v.width&&v.height&&(b||!m.internals.handleBounds||p.force))){let E=p.nodeElement.getBoundingClientRect(),g=Rt(m.extent)?m.extent:s,{positionAbsolute:w}=m.internals;if(m.parentId&&m.extent==="parent"){let _=t.get(m.parentId);_&&(w=la(w,v,_))}else g&&(w=$t(w,g,v));let M={...m,measured:v,internals:{...m.internals,positionAbsolute:w,handleBounds:{source:Us("source",p.nodeElement,E,f,m.id),target:Us("target",p.nodeElement,E,f,m.id)}}};t.set(m.id,M),m.parentId&&Wi(M,t,n,{nodeOrigin:i,zIndexMode:a}),c=!0,b&&(u.push({id:m.id,type:"dimensions",dimensions:v}),m.expandParent&&m.parentId&&h.push({id:m.id,parentId:m.parentId,rect:sn(M,i)}))}}if(h.length>0){let p=Vo(h,t,n,i);u.push(...p)}return{changes:u,updatedInternals:c}}o(ba,"updateNodeInternals");async function va({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:s}){if(!t||!e.x&&!e.y)return!1;let a=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,s]],r);return!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2])}o(va,"panBy");function ea(e,t,n,r,i,s){let a=i,l=r.get(a)||new Map;r.set(a,l.set(n,t)),a=`${i}-${e}`;let c=r.get(a)||new Map;if(r.set(a,c.set(n,t)),s){a=`${i}-${e}-${s}`;let u=r.get(a)||new Map;r.set(a,u.set(n,t))}}o(ea,"addConnectionToLookup");function Xi(e,t,n){e.clear(),t.clear();for(let r of n){let{source:i,target:s,sourceHandle:a=null,targetHandle:l=null}=r,c={edgeId:r.id,source:i,target:s,sourceHandle:a,targetHandle:l},u=`${i}-${a}--${s}-${l}`,d=`${s}-${l}--${i}-${a}`;ea("source",c,d,e,i,a),ea("target",c,u,e,s,l),t.set(r.id,r)}}o(Xi,"updateConnectionLookup");function Sa(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:Sa(n,t):!1}o(Sa,"isParentSelected");function ta(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}o(ta,"hasSelector");function mf(e,t,n,r){let i=new Map;for(let[s,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!Sa(a,e))&&(a.draggable||t&&typeof a.draggable>"u")){let l=e.get(s);l&&i.set(s,{id:s,position:l.position||{x:0,y:0},distance:{x:n.x-l.internals.positionAbsolute.x,y:n.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return i}o(mf,"getDragItems");function bi({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[a,l]of t){let c=n.get(a)?.internals.userNode;c&&i.push({...c,position:l.position,dragging:r})}if(!e)return[i[0],i];let s=n.get(e)?.internals.userNode;return[s?{...s,position:t.get(e)?.position||s.position,dragging:r}:i[0],i]}o(bi,"getEventHandlerParams");function gf({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let s={x:n-i.distance.x,y:r-i.distance.y},a=an(s,t);return{x:a.x-s.x,y:a.y-s.y}}o(gf,"calculateSnapOffset");function Ea({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let s={x:null,y:null},a=0,l=new Map,c=!1,u={x:0,y:0},d=null,f=!1,h=null,p=!1,m=!1,v=null;function b({noDragClassName:E,handleSelector:g,domNode:w,isSelectable:M,nodeId:_,nodeClickDistance:P=0}){h=Ee(w);function T({x:V,y:L}){let{nodeLookup:x,nodeExtent:S,snapGrid:C,snapToGrid:I,nodeOrigin:$,onNodeDrag:A,onSelectionDrag:B,onError:F,updateNodePositions:H}=t();s={x:V,y:L};let U=!1,Z=l.size>1,W=Z&&S?Ei(rn(l)):null,j=Z&&I?gf({dragItems:l,snapGrid:C,x:V,y:L}):null;for(let[K,R]of l){if(!x.has(K))continue;let X={x:V-R.distance.x,y:L-R.distance.y};I&&(X=j?{x:Math.round(X.x+j.x),y:Math.round(X.y+j.y)}:an(X,C));let te=null;if(Z&&S&&!R.extent&&W){let{positionAbsolute:q}=R.internals,ne=q.x-W.x+S[0][0],oe=q.x+R.measured.width-W.x2+S[1][0],se=q.y-W.y+S[0][1],ce=q.y+R.measured.height-W.y2+S[1][1];te=[[ne,se],[oe,ce]]}let{position:ee,positionAbsolute:G}=Ti({nodeId:K,nextPosition:X,nodeLookup:x,nodeExtent:te||S,nodeOrigin:$,onError:F});U=U||R.position.x!==ee.x||R.position.y!==ee.y,R.position=ee,R.internals.positionAbsolute=G}if(m=m||U,!!U&&(H(l,!0),v&&(r||A||!_&&B))){let[K,R]=bi({nodeId:_,dragItems:l,nodeLookup:x});r?.(v,l,K,R),A?.(v,K,R),_||B?.(v,R)}}o(T,"updateNodes");async function k(){if(!d)return;let{transform:V,panBy:L,autoPanSpeed:x,autoPanOnNodeDrag:S}=t();if(!S){c=!1,cancelAnimationFrame(a);return}let[C,I]=Ao(u,d,x);(C!==0||I!==0)&&(s.x=(s.x??0)-C/V[2],s.y=(s.y??0)-I/V[2],await L({x:C,y:I})&&T(s)),a=requestAnimationFrame(k)}o(k,"autoPan");function Y(V){let{nodeLookup:L,multiSelectionActive:x,nodesDraggable:S,transform:C,snapGrid:I,snapToGrid:$,selectNodesOnDrag:A,onNodeDragStart:B,onSelectionDragStart:F,unselectNodesAndEdges:H}=t();f=!0,(!A||!M)&&!x&&_&&(L.get(_)?.selected||H()),M&&A&&_&&e?.(_);let U=Gn(V.sourceEvent,{transform:C,snapGrid:I,snapToGrid:$,containerBounds:d});if(s=U,l=mf(L,S,U,_),l.size>0&&(n||B||!_&&F)){let[Z,W]=bi({nodeId:_,dragItems:l,nodeLookup:L});n?.(V.sourceEvent,l,Z,W),B?.(V.sourceEvent,Z,W),_||F?.(V.sourceEvent,W)}}o(Y,"startDrag");let z=On().clickDistance(P).on("start",V=>{let{domNode:L,nodeDragThreshold:x,transform:S,snapGrid:C,snapToGrid:I}=t();d=L?.getBoundingClientRect()||null,p=!1,m=!1,v=V.sourceEvent,x===0&&Y(V),s=Gn(V.sourceEvent,{transform:S,snapGrid:C,snapToGrid:I,containerBounds:d}),u=He(V.sourceEvent,d)}).on("drag",V=>{let{autoPanOnNodeDrag:L,transform:x,snapGrid:S,snapToGrid:C,nodeDragThreshold:I,nodeLookup:$}=t(),A=Gn(V.sourceEvent,{transform:x,snapGrid:S,snapToGrid:C,containerBounds:d});if(v=V.sourceEvent,(V.sourceEvent.type==="touchmove"&&V.sourceEvent.touches.length>1||_&&!$.has(_))&&(p=!0),!p){if(!c&&L&&f&&(c=!0,k()),!f){let B=He(V.sourceEvent,d),F=B.x-u.x,H=B.y-u.y;Math.sqrt(F*F+H*H)>I&&Y(V)}(s.x!==A.xSnapped||s.y!==A.ySnapped)&&l&&f&&(u=He(V.sourceEvent,d),T(A))}}).on("end",V=>{if(!f||p){p&&l.size>0&&t().updateNodePositions(l,!1);return}if(c=!1,f=!1,cancelAnimationFrame(a),l.size>0){let{nodeLookup:L,updateNodePositions:x,onNodeDragStop:S,onSelectionDragStop:C}=t();if(m&&(x(l,!1),m=!1),i||S||!_&&C){let[I,$]=bi({nodeId:_,dragItems:l,nodeLookup:L,dragging:!1});i?.(V.sourceEvent,l,I,$),S?.(V.sourceEvent,I,$),_||C?.(V.sourceEvent,$)}}}).filter(V=>{let L=V.target;return!V.button&&(!E||!ta(L,`.${E}`,w))&&(!g||ta(L,g,w))});h.call(z)}o(b,"update");function y(){h?.on(".drag",null)}return o(y,"destroy"),{update:b,destroy:y}}o(Ea,"XYDrag");function yf(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let s of t.values())Qn(i,sn(s))>0&&r.push(s);return r}o(yf,"getNodesWithinDistance");var xf=250;function wf(e,t,n,r){let i=[],s=1/0,a=yf(e,n,t+xf);for(let l of a){let c=[...l.internals.handleBounds?.source??[],...l.internals.handleBounds?.target??[]];for(let u of c){if(r.nodeId===u.nodeId&&r.type===u.type&&r.id===u.id)continue;let{x:d,y:f}=St(l,u,u.position,!0),h=Math.sqrt(Math.pow(d-e.x,2)+Math.pow(f-e.y,2));h>t||(h<s?(i=[{...u,x:d,y:f}],s=h):h===s&&i.push({...u,x:d,y:f}))}}if(!i.length)return null;if(i.length>1){let l=r.type==="source"?"target":"source";return i.find(c=>c.type===l)??i[0]}return i[0]}o(wf,"getClosestHandle");function Ca(e,t,n,r,i,s=!1){let a=r.get(e);if(!a)return null;let l=i==="strict"?a.internals.handleBounds?.[t]:[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]],c=(n?l?.find(u=>u.id===n):l?.[0])??null;return c&&s?{...c,...St(a,c,c.position,!0)}:c}o(Ca,"getHandle");function _a(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}o(_a,"getHandleType");function bf(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}o(bf,"isConnectionValid");var Na=o(()=>!0,"alwaysValid");function vf(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:s,isTarget:a,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:d,flowId:f,panBy:h,cancelConnection:p,onConnectStart:m,onConnect:v,onConnectEnd:b,isValidConnection:y=Na,onReconnectEnd:E,updateConnection:g,getTransform:w,getFromHandle:M,autoPanSpeed:_,dragThreshold:P=1,handleDomNode:T}){let k=Ri(e.target),Y=0,z,{x:V,y:L}=He(e),x=_a(s,T),S=l?.getBoundingClientRect(),C=!1;if(!S||!x)return;let I=Ca(i,x,r,c,t);if(!I)return;let $=He(e,S),A=!1,B=null,F=!1,H=null;function U(){if(!d||!S)return;let[ee,G]=Ao($,S,_);h({x:ee,y:G}),Y=requestAnimationFrame(U)}o(U,"autoPan");let Z={...I,nodeId:i,type:x,position:I.position},W=c.get(i),K={inProgress:!0,isValid:null,from:St(W,Z,J.Left,!0),fromHandle:Z,fromPosition:Z.position,fromNode:W,to:$,toHandle:null,toPosition:Xs[Z.position],toNode:null,pointer:$};function R(){C=!0,g(K),m?.(e,{nodeId:i,handleId:r,handleType:x})}o(R,"startConnection"),P===0&&R();function X(ee){if(!C){let{x:ce,y:ve}=He(ee),he=ce-V,pe=ve-L;if(!(he*he+pe*pe>P*P))return;R()}if(!M()||!Z){te(ee);return}let G=w();$=He(ee,S),z=wf(ln($,G,!1,[1,1]),n,c,Z),A||(U(),A=!0);let q=Ia(ee,{handle:z,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:a?"target":"source",isValidConnection:y,doc:k,lib:u,flowId:f,nodeLookup:c});H=q.handleDomNode,B=q.connection,F=bf(!!z,q.isValid);let ne=c.get(i),oe=ne?St(ne,Z,J.Left,!0):K.from,se={...K,from:oe,isValid:F,to:q.toHandle&&F?zt({x:q.toHandle.x,y:q.toHandle.y},G):$,toHandle:q.toHandle,toPosition:F&&q.toHandle?q.toHandle.position:Xs[Z.position],toNode:q.toHandle?c.get(q.toHandle.nodeId):null,pointer:$};g(se),K=se}o(X,"onPointerMove");function te(ee){if(!("touches"in ee&&ee.touches.length>0)){if(C){(z||H)&&B&&F&&v?.(B);let{inProgress:G,...q}=K,ne={...q,toPosition:K.toHandle?K.toPosition:null};b?.(ee,ne),s&&E?.(ee,ne)}p(),cancelAnimationFrame(Y),A=!1,F=!1,B=null,H=null,k.removeEventListener("mousemove",X),k.removeEventListener("mouseup",te),k.removeEventListener("touchmove",X),k.removeEventListener("touchend",te)}}o(te,"onPointerUp"),k.addEventListener("mousemove",X),k.addEventListener("mouseup",te),k.addEventListener("touchmove",X),k.addEventListener("touchend",te)}o(vf,"onPointerDown");function Ia(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:s,doc:a,lib:l,flowId:c,isValidConnection:u=Na,nodeLookup:d}){let f=s==="target",h=t?a.querySelector(`.${l}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=He(e),v=a.elementFromPoint(p,m),b=v?.classList.contains(`${l}-flow__handle`)?v:h,y={handleDomNode:b,isValid:!1,connection:null,toHandle:null};if(b){let E=_a(void 0,b),g=b.getAttribute("data-nodeid"),w=b.getAttribute("data-handleid"),M=b.classList.contains("connectable"),_=b.classList.contains("connectableend");if(!g||!E)return y;let P={source:f?g:r,sourceHandle:f?w:i,target:f?r:g,targetHandle:f?i:w};y.connection=P;let k=M&&_&&(n===vt.Strict?f&&E==="source"||!f&&E==="target":g!==r||w!==i);y.isValid=k&&u(P),y.toHandle=Ca(g,E,w,d,n,!0)}return y}o(Ia,"isValidHandle");var Fo={onPointerDown:vf,isValid:Ia};function Ma({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=Ee(e);function s({translateExtent:l,width:c,height:u,zoomStep:d=1,pannable:f=!0,zoomable:h=!0,inversePan:p=!1}){let m=o(g=>{if(g.sourceEvent.type!=="wheel"||!t)return;let w=n(),M=g.sourceEvent.ctrlKey&&cn()?10:1,_=-g.sourceEvent.deltaY*(g.sourceEvent.deltaMode===1?.05:g.sourceEvent.deltaMode?1:.002)*d,P=w[2]*Math.pow(2,_*M);t.scaleTo(P)},"zoomHandler"),v=[0,0],b=o(g=>{(g.sourceEvent.type==="mousedown"||g.sourceEvent.type==="touchstart")&&(v=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY])},"panStartHandler"),y=o(g=>{let w=n();if(g.sourceEvent.type!=="mousemove"&&g.sourceEvent.type!=="touchmove"||!t)return;let M=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY],_=[M[0]-v[0],M[1]-v[1]];v=M;let P=r()*Math.max(w[2],Math.log(w[2]))*(p?-1:1),T={x:w[0]-_[0]*P,y:w[1]-_[1]*P},k=[[0,0],[c,u]];t.setViewportConstrained({x:T.x,y:T.y,zoom:w[2]},k,l)},"panHandler"),E=Un().on("start",b).on("zoom",f?y:null).on("zoom.wheel",h?m:null);i.call(E,{})}o(s,"update");function a(){i.on("zoom",null)}return o(a,"destroy"),{update:s,destroy:a,pointer:Me}}o(Ma,"XYMinimap");var Yo=o(e=>({x:e.x,y:e.y,zoom:e.k}),"transformToViewport"),vi=o(({x:e,y:t,zoom:n})=>At.translate(e,t).scale(n),"viewportToTransform"),en=o((e,t)=>e.target.closest(`.${t}`),"isWrappedWithClass"),Pa=o((e,t)=>t===2&&Array.isArray(e)&&e.includes(2),"isRightClickPan"),Sf=o(e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,"defaultEase"),Si=o((e,t=0,n=Sf,r=()=>{})=>{let i=typeof t=="number"&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on("end",r):e},"getD3Transition"),Ta=o(e=>{let t=e.ctrlKey&&cn()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},"wheelDelta");function Ef({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:s,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return d=>{if(en(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();let f=n.property("__zoom").k||1;if(d.ctrlKey&&a){let b=Me(d),y=Ta(d),E=f*Math.pow(2,y);r.scaleTo(n,E,b,d);return}let h=d.deltaMode===1?20:1,p=i===et.Vertical?0:d.deltaX*h,m=i===et.Horizontal?0:d.deltaY*h;!cn()&&d.shiftKey&&i!==et.Vertical&&(p=d.deltaY*h,m=0),r.translateBy(n,-(p/f)*s,-(m/f)*s,{internal:!0});let v=Yo(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c?.(d,v):(e.isPanScrolling=!0,l?.(d,v)),e.panScrollTimeout=setTimeout(()=>{u?.(d,v),e.isPanScrolling=!1},150)}}o(Ef,"createPanOnScrollHandler");function Cf({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let s=r.type==="wheel",a=!t&&s&&!r.ctrlKey,l=en(r,e);if(r.ctrlKey&&s&&l&&r.preventDefault(),a||l)return null;r.preventDefault(),n.call(this,r,i)}}o(Cf,"createZoomOnScrollHandler");function _f({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=Yo(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(r.sourceEvent,i)}}o(_f,"createPanZoomStartHandler");function Nf({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return s=>{e.usedRightMouseButton=!!(n&&Pa(t,e.mouseButton??0)),s.sourceEvent?.sync||r([s.transform.x,s.transform.y,s.transform.k]),i&&!s.sourceEvent?.internal&&i?.(s.sourceEvent,Yo(s.transform))}}o(Nf,"createPanZoomHandler");function If({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:s}){return a=>{if(!a.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,s&&Pa(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&s(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let l=Yo(a.transform);e.prevViewport=l,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(a.sourceEvent,l)},n?150:0)}}}o(If,"createPanZoomEndHandler");function Mf({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:s,userSelectionActive:a,noWheelClassName:l,noPanClassName:c,lib:u,connectionInProgress:d}){return f=>{let h=e||t,p=n&&f.ctrlKey,m=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(en(f,`${u}-flow__node`)||en(f,`${u}-flow__edge`)))return!0;if(!r&&!h&&!i&&!s&&!n||a||d&&!m||en(f,l)&&m||en(f,c)&&(!m||i&&m&&!e)||!n&&f.ctrlKey&&m)return!1;if(!n&&f.type==="touchstart"&&f.touches?.length>1)return f.preventDefault(),!1;if(!h&&!i&&!p&&m||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;let v=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||m)&&v}}o(Mf,"createFilter");function ka({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:s,onPanZoomStart:a,onPanZoomEnd:l,onDraggingChange:c}){let u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),f=[[0,0],[d.width,d.height]];(typeof ResizeObserver<"u"?new ResizeObserver(L=>{let x=L[0];x&&(f=[[0,0],[x.contentRect.width,x.contentRect.height]])}):null)?.observe(e);let p=Un().extent(()=>f).scaleExtent([t,n]).translateExtent(r),m=Ee(e).call(p);w({x:i.x,y:i.y,zoom:nn(i.zoom,t,n)},[[0,0],[d.width,d.height]],r);let v=m.on("wheel.zoom"),b=m.on("dblclick.zoom");p.wheelDelta(Ta);async function y(L,x){return m?new Promise(S=>{p?.interpolate(x?.interpolate==="linear"?uo:Ut).transform(Si(m,x?.duration,x?.ease,()=>S(!0)),L)}):!1}o(y,"setTransform");function E({noWheelClassName:L,noPanClassName:x,onPaneContextMenu:S,userSelectionActive:C,panOnScroll:I,panOnDrag:$,panOnScrollMode:A,panOnScrollSpeed:B,preventScrolling:F,zoomOnPinch:H,zoomOnScroll:U,zoomOnDoubleClick:Z,zoomActivationKeyPressed:W,lib:j,onTransformChange:K,connectionInProgress:R,paneClickDistance:X,selectionOnDrag:te}){C&&!u.isZoomingOrPanning&&g();let ee=I&&!W&&!C;p.clickDistance(te?1/0:!Le(X)||X<0?0:X);let G=ee?Ef({zoomPanValues:u,noWheelClassName:L,d3Selection:m,d3Zoom:p,panOnScrollMode:A,panOnScrollSpeed:B,zoomOnPinch:H,onPanZoomStart:a,onPanZoom:s,onPanZoomEnd:l}):Cf({noWheelClassName:L,preventScrolling:F,d3ZoomHandler:v});m.on("wheel.zoom",G,{passive:!1});let q=_f({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:a});p.on("start",q);let ne=Nf({zoomPanValues:u,panOnDrag:$,onPaneContextMenu:!!S,onPanZoom:s,onTransformChange:K});p.on("zoom",ne);let oe=If({zoomPanValues:u,panOnDrag:$,panOnScroll:I,onPaneContextMenu:S,onPanZoomEnd:l,onDraggingChange:c});p.on("end",oe);let se=Mf({zoomActivationKeyPressed:W,panOnDrag:$,zoomOnScroll:U,panOnScroll:I,zoomOnDoubleClick:Z,zoomOnPinch:H,userSelectionActive:C,noPanClassName:x,noWheelClassName:L,lib:j,connectionInProgress:R});p.filter(se),Z?m.on("dblclick.zoom",b):m.on("dblclick.zoom",null)}o(E,"update");function g(){p.on("zoom",null)}o(g,"destroy");async function w(L,x,S){let C=vi(L),I=p?.constrain()(C,x,S);return I&&await y(I),I}o(w,"setViewportConstrained");async function M(L,x){let S=vi(L);return await y(S,x),S}o(M,"setViewport");function _(L){if(m){let x=vi(L),S=m.property("__zoom");(S.k!==L.zoom||S.x!==L.x||S.y!==L.y)&&p?.transform(m,x,null,{sync:!0})}}o(_,"syncViewport");function P(){let L=m?Zn(m.node()):{x:0,y:0,k:1};return{x:L.x,y:L.y,zoom:L.k}}o(P,"getViewport");async function T(L,x){return m?new Promise(S=>{p?.interpolate(x?.interpolate==="linear"?uo:Ut).scaleTo(Si(m,x?.duration,x?.ease,()=>S(!0)),L)}):!1}o(T,"scaleTo");async function k(L,x){return m?new Promise(S=>{p?.interpolate(x?.interpolate==="linear"?uo:Ut).scaleBy(Si(m,x?.duration,x?.ease,()=>S(!0)),L)}):!1}o(k,"scaleBy");function Y(L){p?.scaleExtent(L)}o(Y,"setScaleExtent");function z(L){p?.translateExtent(L)}o(z,"setTranslateExtent");function V(L){let x=!Le(L)||L<0?0:L;p?.clickDistance(x)}return o(V,"setClickDistance"),{update:E,destroy:g,setViewport:M,setViewportConstrained:w,getViewport:P,scaleTo:T,scaleBy:k,setScaleExtent:Y,setTranslateExtent:z,syncViewport:_,setClickDistance:V}}o(ka,"XYPanZoom");var Et;(function(e){e.Line="line",e.Handle="handle"})(Et||(Et={}));function Pf({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:s}){let a=e-t,l=n-r,c=[a>0?1:a<0?-1:0,l>0?1:l<0?-1:0];return a&&i&&(c[0]=c[0]*-1),l&&s&&(c[1]=c[1]*-1),c}o(Pf,"getResizeDirection");function na(e){let t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),i=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:i}}o(na,"getControlDirection");function wt(e,t){return Math.max(0,t-e)}o(wt,"getLowerExtentClamp");function bt(e,t){return Math.max(0,e-t)}o(bt,"getUpperExtentClamp");function Po(e,t,n){return Math.max(0,t-e,e-n)}o(Po,"getSizeClamp");function oa(e,t){return e?!t:t}o(oa,"xor");function Tf(e,t,n,r,i,s,a,l){let{affectsX:c,affectsY:u}=t,{isHorizontal:d,isVertical:f}=t,h=d&&f,{xSnapped:p,ySnapped:m}=n,{minWidth:v,maxWidth:b,minHeight:y,maxHeight:E}=r,{x:g,y:w,width:M,height:_,aspectRatio:P}=e,T=Math.floor(d?p-e.pointerX:0),k=Math.floor(f?m-e.pointerY:0),Y=M+(c?-T:T),z=_+(u?-k:k),V=-s[0]*M,L=-s[1]*_,x=Po(Y,v,b),S=Po(z,y,E);if(a){let $=0,A=0;c&&T<0?$=wt(g+T+V,a[0][0]):!c&&T>0&&($=bt(g+Y+V,a[1][0])),u&&k<0?A=wt(w+k+L,a[0][1]):!u&&k>0&&(A=bt(w+z+L,a[1][1])),x=Math.max(x,$),S=Math.max(S,A)}if(l){let $=0,A=0;c&&T>0?$=bt(g+T,l[0][0]):!c&&T<0&&($=wt(g+Y,l[1][0])),u&&k>0?A=bt(w+k,l[0][1]):!u&&k<0&&(A=wt(w+z,l[1][1])),x=Math.max(x,$),S=Math.max(S,A)}if(i){if(d){let $=Po(Y/P,y,E)*P;if(x=Math.max(x,$),a){let A=0;!c&&!u||c&&!u&&h?A=bt(w+L+Y/P,a[1][1])*P:A=wt(w+L+(c?T:-T)/P,a[0][1])*P,x=Math.max(x,A)}if(l){let A=0;!c&&!u||c&&!u&&h?A=wt(w+Y/P,l[1][1])*P:A=bt(w+(c?T:-T)/P,l[0][1])*P,x=Math.max(x,A)}}if(f){let $=Po(z*P,v,b)/P;if(S=Math.max(S,$),a){let A=0;!c&&!u||u&&!c&&h?A=bt(g+z*P+V,a[1][0])/P:A=wt(g+(u?k:-k)*P+V,a[0][0])/P,S=Math.max(S,A)}if(l){let A=0;!c&&!u||u&&!c&&h?A=wt(g+z*P,l[1][0])/P:A=bt(g+(u?k:-k)*P,l[0][0])/P,S=Math.max(S,A)}}}k=k+(k<0?S:-S),T=T+(T<0?x:-x),i&&(h?Y>z*P?k=(oa(c,u)?-T:T)/P:T=(oa(c,u)?-k:k)*P:d?(k=T/P,u=c):(T=k*P,c=u));let C=c?g+T:g,I=u?w+k:w;return{width:M+(c?-T:T),height:_+(u?-k:k),x:s[0]*T*(c?-1:1)+C,y:s[1]*k*(u?-1:1)+I}}o(Tf,"getDimensionsAfterResize");var Aa={width:0,height:0,x:0,y:0},kf={...Aa,pointerX:0,pointerY:0,aspectRatio:1};function Af(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,s=e.measured.width??0,a=e.measured.height??0,l=n[0]*s,c=n[1]*a;return[[r-l,i-c],[r+s-l,i+a-c]]}o(Af,"nodeToChildExtent");function Da({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let s=Ee(e),a={controlDirection:na("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:u,boundaries:d,keepAspectRatio:f,resizeDirection:h,onResizeStart:p,onResize:m,onResizeEnd:v,shouldResize:b}){let y={...Aa},E={...kf};a={boundaries:d,resizeDirection:h,keepAspectRatio:f,controlDirection:na(u)};let g,w=null,M=[],_,P,T,k=!1,Y=On().on("start",z=>{let{nodeLookup:V,transform:L,snapGrid:x,snapToGrid:S,nodeOrigin:C,paneDomNode:I}=n();if(g=V.get(t),!g)return;w=I?.getBoundingClientRect()??null;let{xSnapped:$,ySnapped:A}=Gn(z.sourceEvent,{transform:L,snapGrid:x,snapToGrid:S,containerBounds:w});y={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},E={...y,pointerX:$,pointerY:A,aspectRatio:y.width/y.height},_=void 0,P=Rt(g.extent)?g.extent:void 0,g.parentId&&(g.extent==="parent"||g.expandParent)&&(_=V.get(g.parentId)),_&&g.extent==="parent"&&(P=[[0,0],[_.measured.width,_.measured.height]]),M=[],T=void 0;for(let[B,F]of V)if(F.parentId===t&&(M.push({id:B,position:{...F.position},extent:F.extent}),F.extent==="parent"||F.expandParent)){let H=Af(F,g,F.origin??C);T?T=[[Math.min(H[0][0],T[0][0]),Math.min(H[0][1],T[0][1])],[Math.max(H[1][0],T[1][0]),Math.max(H[1][1],T[1][1])]]:T=H}p?.(z,{...y})}).on("drag",z=>{let{transform:V,snapGrid:L,snapToGrid:x,nodeOrigin:S}=n(),C=Gn(z.sourceEvent,{transform:V,snapGrid:L,snapToGrid:x,containerBounds:w}),I=[];if(!g)return;let{x:$,y:A,width:B,height:F}=y,H={},U=g.origin??S,{width:Z,height:W,x:j,y:K}=Tf(E,a.controlDirection,C,a.boundaries,a.keepAspectRatio,U,P,T),R=Z!==B,X=W!==F,te=j!==$&&R,ee=K!==A&&X;if(!te&&!ee&&!R&&!X)return;if((te||ee||U[0]===1||U[1]===1)&&(H.x=te?j:y.x,H.y=ee?K:y.y,y.x=H.x,y.y=H.y,M.length>0)){let oe=j-$,se=K-A;for(let ce of M)ce.position={x:ce.position.x-oe+U[0]*(Z-B),y:ce.position.y-se+U[1]*(W-F)},I.push(ce)}if((R||X)&&(H.width=R&&(!a.resizeDirection||a.resizeDirection==="horizontal")?Z:y.width,H.height=X&&(!a.resizeDirection||a.resizeDirection==="vertical")?W:y.height,y.width=H.width,y.height=H.height),_&&g.expandParent){let oe=U[0]*(H.width??0);H.x&&H.x<oe&&(y.x=oe,E.x=E.x-(H.x-oe));let se=U[1]*(H.height??0);H.y&&H.y<se&&(y.y=se,E.y=E.y-(H.y-se))}let G=Pf({width:y.width,prevWidth:B,height:y.height,prevHeight:F,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),q={...y,direction:G};b?.(z,q)!==!1&&(k=!0,m?.(z,q),r(H,I))}).on("end",z=>{k&&(v?.(z,{...y}),i?.({...y}),k=!1)});s.call(Y)}o(l,"update");function c(){s.on(".drag",null)}return o(c,"destroy"),{update:l,destroy:c}}o(Da,"XYResizer");var Ra=mt(ar(),1),La=mt(ru(),1);var Oa=o(e=>{let t,n=new Set,r=o((d,f)=>{let h=typeof d=="function"?d(t):d;if(!Object.is(h,t)){let p=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(m=>m(t,p))}},"setState"),i=o(()=>t,"getState"),c={setState:r,getState:i,getInitialState:o(()=>u,"getInitialState"),subscribe:o(d=>(n.add(d),()=>n.delete(d)),"subscribe"),destroy:o(()=>{(import.meta.env?import.meta.env.MODE:void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()},"destroy")},u=t=e(r,i,c);return c},"createStoreImpl"),$a=o(e=>e?Oa(e):Oa,"createStore");var{useDebugValue:Df}=Ra.default,{useSyncExternalStoreWithSelector:Of}=La.default,$f=o(e=>e,"identity");function Zi(e,t=$f,n){let r=Of(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Df(r),r}o(Zi,"useStoreWithEqualityFn");var za=o((e,t)=>{let n=$a(e),r=o((i,s=t)=>Zi(n,i,s),"useBoundStoreWithEqualityFn");return Object.assign(r,n),r},"createWithEqualityFnImpl"),Ha=o((e,t)=>e?za(e,t):za,"createWithEqualityFn");function ue(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[r,i]of e)if(!Object.is(i,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let r of e)if(!t.has(r))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}o(ue,"shallow$1");var zf=mt(eu());var Uo=(0,D.createContext)(null),Rf=Uo.Provider,fl=De.error001("react");function ie(e,t){let n=(0,D.useContext)(Uo);if(n===null)throw new Error(fl);return Zi(n,e,t)}o(ie,"useStore");function de(){let e=(0,D.useContext)(Uo);if(e===null)throw new Error(fl);return(0,D.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}o(de,"useStoreApi");var Ba={display:"none"},Lf={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},hl="react-flow__node-desc",pl="react-flow__edge-desc",Hf="react-flow__aria-live",Bf=o(e=>e.ariaLiveMessage,"ariaLiveSelector"),Vf=o(e=>e.ariaLabelConfig,"ariaLabelConfigSelector");function Ff({rfId:e}){let t=ie(Bf);return(0,O.jsx)("div",{id:`${Hf}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Lf,children:t})}o(Ff,"AriaLiveMessage");function Yf({rfId:e,disableKeyboardA11y:t}){let n=ie(Vf);return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)("div",{id:`${hl}-${e}`,style:Ba,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),(0,O.jsx)("div",{id:`${pl}-${e}`,style:Ba,children:n["edge.a11yDescription.default"]}),!t&&(0,O.jsx)(Ff,{rfId:e})]})}o(Yf,"A11yDescriptions");var _t=(0,D.forwardRef)(({position:e="top-left",children:t,className:n,style:r,...i},s)=>{let a=`${e}`.split("-");return(0,O.jsx)("div",{className:ge(["react-flow__panel",n,...a]),style:r,ref:s,...i,children:t})});_t.displayName="Panel";var Va="https://reactflow.dev/attribution";function Wf({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:(0,O.jsx)(_t,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${Va}`,children:(0,O.jsx)("a",{href:Va,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}o(Wf,"Attribution");var Xf=o(e=>{let t=[],n=[];for(let[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(let[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},"selector$l"),Wo=o(e=>e.id,"selectId");function Zf(e,t){return ue(e.selectedNodes.map(Wo),t.selectedNodes.map(Wo))&&ue(e.selectedEdges.map(Wo),t.selectedEdges.map(Wo))}o(Zf,"areEqual$1");function Uf({onSelectionChange:e}){let t=de(),{selectedNodes:n,selectedEdges:r}=ie(Xf,Zf);return(0,D.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(s=>s(i))},[n,r,e]),null}o(Uf,"SelectionListenerInner");var Gf=o(e=>!!e.onSelectionChangeHandlers,"changeSelector");function qf({onSelectionChange:e}){let t=ie(Gf);return e||t?(0,O.jsx)(Uf,{onSelectionChange:e}):null}o(qf,"SelectionListener");var ml=[0,0],Kf={x:0,y:0,zoom:1},Qf=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],Fa=[...Qf,"rfId"],Jf=o(e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),"selector$k"),Ya={translateExtent:on,nodeOrigin:ml,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function jf(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:s,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:c}=ie(Jf,ue),u=de();(0,D.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=Ya,l()}),[]);let d=(0,D.useRef)(Ya);return(0,D.useEffect)(()=>{for(let f of Fa){let h=e[f],p=d.current[f];h!==p&&(typeof e[f]>"u"||(f==="nodes"?t(h):f==="edges"?n(h):f==="minZoom"?r(h):f==="maxZoom"?i(h):f==="translateExtent"?s(h):f==="nodeExtent"?a(h):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:da(h)}):f==="fitView"?u.setState({fitViewQueued:h}):f==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[f]:h})))}d.current=e},Fa.map(f=>e[f])),null}o(jf,"StoreUpdater");function Wa(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}o(Wa,"getMediaQuery");function eh(e){let[t,n]=(0,D.useState)(e==="system"?null:e);return(0,D.useEffect)(()=>{if(e!=="system"){n(e);return}let r=Wa(),i=o(()=>n(r?.matches?"dark":"light"),"updateColorModeClass");return i(),r?.addEventListener("change",i),()=>{r?.removeEventListener("change",i)}},[e]),t!==null?t:Wa()?.matches?"dark":"light"}o(eh,"useColorModeClass");var Xa=typeof document<"u"?document:null;function jn(e=null,t={target:Xa,actInsideInputWithModifier:!0}){let[n,r]=(0,D.useState)(!1),i=(0,D.useRef)(!1),s=(0,D.useRef)(new Set([])),[a,l]=(0,D.useMemo)(()=>{if(e!==null){let u=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",`
1
+ "use client";import{a as Xe,b as fo}from"./chunk-2NGUNNGW.js";import{a as Es,b as Cs,c as _s,f as ho}from"./chunk-LNZIB2MD.js";import"./chunk-QBAT52GB.js";import"./chunk-QAFAJBAW.js";import"./chunk-IXDH4GL5.js";import"./chunk-KSKXW5PX.js";import"./chunk-5OIBXYZM.js";import"./chunk-L7SK4ZZD.js";import{a as lr,b as cr,c as gs,d as ys,e as uo,g as xs,h as ws,i as Ut}from"./chunk-BJGBHGK3.js";import{e as fs}from"./chunk-WI7GWFEG.js";import{a as Ss}from"./chunk-2K47A3P6.js";import{b as ru}from"./chunk-KEGAWN6Y.js";import{a as qe}from"./chunk-JSEXCW5Q.js";import{e as hs,k as ps}from"./chunk-4QHKBC77.js";import{a as vs}from"./chunk-DH4K2OLM.js";import{b as bs}from"./chunk-4PC7IXNY.js";import"./chunk-2MLA6WFH.js";import{R as Mt}from"./chunk-3CJW6NWG.js";import{c as Ie}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import{a as eu}from"./chunk-HV7G6DFP.js";import{a as Nn}from"./chunk-BOXSWNXZ.js";import{a as ms}from"./chunk-TAD43CG5.js";import{a as io,b as so,c as ao,d as lo,e as co}from"./chunk-SEU5V7I6.js";import{b as Ge}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as ds}from"./chunk-LRYLU6EY.js";import"./chunk-ZHVTQ37P.js";import{a as nu}from"./chunk-3OA7PECS.js";import{d as It,f as En,g as Cn,h as _n,l as Oe}from"./chunk-ITQKVEP7.js";import{b as us}from"./chunk-22C6COGE.js";import{a as o,e as mt,f as ar,g as tu,h as ou,j as Zt}from"./chunk-RRCPZMC2.js";var Be=mt(tu(),1);var re=mt(ar(),1);var O=mt(nu()),D=mt(ar());function ge(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=ge(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}o(ge,"cc");var iu={value:o(()=>{},"value")};function Is(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new po(n)}o(Is,"dispatch");function po(e){this._=e}o(po,"Dispatch");function su(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}o(su,"parseTypenames");po.prototype=Is.prototype={constructor:po,on:o(function(e,t){var n=this._,r=su(e+"",n),i,s=-1,a=r.length;if(arguments.length<2){for(;++s<a;)if((i=(e=r[s]).type)&&(i=au(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<a;)if(i=(e=r[s]).type)n[i]=Ns(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Ns(n[i],e.name,null);return this},"on"),copy:o(function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new po(e)},"copy"),call:o(function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,s;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],r=0,i=s.length;r<i;++r)s[r].value.apply(t,n)},"call"),apply:o(function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,s=r.length;i<s;++i)r[i].value.apply(t,n)},"apply")};function au(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}o(au,"get");function Ns(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=iu,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}o(Ns,"set");var Pt=Is;var mo="http://www.w3.org/1999/xhtml",ur={svg:"http://www.w3.org/2000/svg",xhtml:mo,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ze(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),ur.hasOwnProperty(t)?{space:ur[t],local:e}:e}o(Ze,"default");function lu(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===mo&&t.documentElement.namespaceURI===mo?t.createElement(e):t.createElementNS(n,e)}}o(lu,"creatorInherit");function cu(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}o(cu,"creatorFixed");function In(e){var t=Ze(e);return(t.local?cu:lu)(t)}o(In,"default");function uu(){}o(uu,"none");function gt(e){return e==null?uu:function(){return this.querySelector(e)}}o(gt,"default");function dr(e){typeof e!="function"&&(e=gt(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var s=t[i],a=s.length,l=r[i]=new Array(a),c,u,d=0;d<a;++d)(c=s[d])&&(u=e.call(c,c.__data__,d,s))&&("__data__"in c&&(u.__data__=c.__data__),l[d]=u);return new ye(r,this._parents)}o(dr,"default");function fr(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}o(fr,"array");function du(){return[]}o(du,"empty");function Gt(e){return e==null?du:function(){return this.querySelectorAll(e)}}o(Gt,"default");function fu(e){return function(){return fr(e.apply(this,arguments))}}o(fu,"arrayAll");function hr(e){typeof e=="function"?e=fu(e):e=Gt(e);for(var t=this._groups,n=t.length,r=[],i=[],s=0;s<n;++s)for(var a=t[s],l=a.length,c,u=0;u<l;++u)(c=a[u])&&(r.push(e.call(c,c.__data__,u,a)),i.push(c));return new ye(r,i)}o(hr,"default");function qt(e){return function(){return this.matches(e)}}o(qt,"default");function go(e){return function(t){return t.matches(e)}}o(go,"childMatcher");var hu=Array.prototype.find;function pu(e){return function(){return hu.call(this.children,e)}}o(pu,"childFind");function mu(){return this.firstElementChild}o(mu,"childFirst");function pr(e){return this.select(e==null?mu:pu(typeof e=="function"?e:go(e)))}o(pr,"default");var gu=Array.prototype.filter;function yu(){return Array.from(this.children)}o(yu,"children");function xu(e){return function(){return gu.call(this.children,e)}}o(xu,"childrenFilter");function mr(e){return this.selectAll(e==null?yu:xu(typeof e=="function"?e:go(e)))}o(mr,"default");function gr(e){typeof e!="function"&&(e=qt(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var s=t[i],a=s.length,l=r[i]=[],c,u=0;u<a;++u)(c=s[u])&&e.call(c,c.__data__,u,s)&&l.push(c);return new ye(r,this._parents)}o(gr,"default");function Mn(e){return new Array(e.length)}o(Mn,"default");function yr(){return new ye(this._enter||this._groups.map(Mn),this._parents)}o(yr,"default");function Pn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}o(Pn,"EnterNode");Pn.prototype={constructor:Pn,appendChild:o(function(e){return this._parent.insertBefore(e,this._next)},"appendChild"),insertBefore:o(function(e,t){return this._parent.insertBefore(e,t)},"insertBefore"),querySelector:o(function(e){return this._parent.querySelector(e)},"querySelector"),querySelectorAll:o(function(e){return this._parent.querySelectorAll(e)},"querySelectorAll")};function xr(e){return function(){return e}}o(xr,"default");function wu(e,t,n,r,i,s){for(var a=0,l,c=t.length,u=s.length;a<u;++a)(l=t[a])?(l.__data__=s[a],r[a]=l):n[a]=new Pn(e,s[a]);for(;a<c;++a)(l=t[a])&&(i[a]=l)}o(wu,"bindIndex");function bu(e,t,n,r,i,s,a){var l,c,u=new Map,d=t.length,f=s.length,h=new Array(d),p;for(l=0;l<d;++l)(c=t[l])&&(h[l]=p=a.call(c,c.__data__,l,t)+"",u.has(p)?i[l]=c:u.set(p,c));for(l=0;l<f;++l)p=a.call(e,s[l],l,s)+"",(c=u.get(p))?(r[l]=c,c.__data__=s[l],u.delete(p)):n[l]=new Pn(e,s[l]);for(l=0;l<d;++l)(c=t[l])&&u.get(h[l])===c&&(i[l]=c)}o(bu,"bindKey");function vu(e){return e.__data__}o(vu,"datum");function wr(e,t){if(!arguments.length)return Array.from(this,vu);var n=t?bu:wu,r=this._parents,i=this._groups;typeof e!="function"&&(e=xr(e));for(var s=i.length,a=new Array(s),l=new Array(s),c=new Array(s),u=0;u<s;++u){var d=r[u],f=i[u],h=f.length,p=Su(e.call(d,d&&d.__data__,u,r)),m=p.length,v=l[u]=new Array(m),b=a[u]=new Array(m),y=c[u]=new Array(h);n(d,f,v,b,y,p,t);for(var E=0,g=0,w,M;E<m;++E)if(w=v[E]){for(E>=g&&(g=E+1);!(M=b[g])&&++g<m;);w._next=M||null}}return a=new ye(a,r),a._enter=l,a._exit=c,a}o(wr,"default");function Su(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}o(Su,"arraylike");function br(){return new ye(this._exit||this._groups.map(Mn),this._parents)}o(br,"default");function vr(e,t,n){var r=this.enter(),i=this,s=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),n==null?s.remove():n(s),r&&i?r.merge(i).order():i}o(vr,"default");function Sr(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,s=r.length,a=Math.min(i,s),l=new Array(i),c=0;c<a;++c)for(var u=n[c],d=r[c],f=u.length,h=l[c]=new Array(f),p,m=0;m<f;++m)(p=u[m]||d[m])&&(h[m]=p);for(;c<i;++c)l[c]=n[c];return new ye(l,this._parents)}o(Sr,"default");function Er(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,s=r[i],a;--i>=0;)(a=r[i])&&(s&&a.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(a,s),s=a);return this}o(Er,"default");function Cr(e){e||(e=Eu);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}o(t,"compareNode");for(var n=this._groups,r=n.length,i=new Array(r),s=0;s<r;++s){for(var a=n[s],l=a.length,c=i[s]=new Array(l),u,d=0;d<l;++d)(u=a[d])&&(c[d]=u);c.sort(t)}return new ye(i,this._parents).order()}o(Cr,"default");function Eu(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}o(Eu,"ascending");function _r(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}o(_r,"default");function Nr(){return Array.from(this)}o(Nr,"default");function Ir(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,s=r.length;i<s;++i){var a=r[i];if(a)return a}return null}o(Ir,"default");function Mr(){let e=0;for(let t of this)++e;return e}o(Mr,"default");function Pr(){return!this.node()}o(Pr,"default");function Tr(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],s=0,a=i.length,l;s<a;++s)(l=i[s])&&e.call(l,l.__data__,s,i);return this}o(Tr,"default");function Cu(e){return function(){this.removeAttribute(e)}}o(Cu,"attrRemove");function _u(e){return function(){this.removeAttributeNS(e.space,e.local)}}o(_u,"attrRemoveNS");function Nu(e,t){return function(){this.setAttribute(e,t)}}o(Nu,"attrConstant");function Iu(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}o(Iu,"attrConstantNS");function Mu(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}o(Mu,"attrFunction");function Pu(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)}}o(Pu,"attrFunctionNS");function kr(e,t){var n=Ze(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?_u:Cu:typeof t=="function"?n.local?Pu:Mu:n.local?Iu:Nu)(n,t))}o(kr,"default");function Tn(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}o(Tn,"default");function Tu(e){return function(){this.style.removeProperty(e)}}o(Tu,"styleRemove");function ku(e,t,n){return function(){this.style.setProperty(e,t,n)}}o(ku,"styleConstant");function Au(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}o(Au,"styleFunction");function Ar(e,t,n){return arguments.length>1?this.each((t==null?Tu:typeof t=="function"?Au:ku)(e,t,n??"")):yt(this.node(),e)}o(Ar,"default");function yt(e,t){return e.style.getPropertyValue(t)||Tn(e).getComputedStyle(e,null).getPropertyValue(t)}o(yt,"styleValue");function Du(e){return function(){delete this[e]}}o(Du,"propertyRemove");function Ou(e,t){return function(){this[e]=t}}o(Ou,"propertyConstant");function $u(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}o($u,"propertyFunction");function Dr(e,t){return arguments.length>1?this.each((t==null?Du:typeof t=="function"?$u:Ou)(e,t)):this.node()[e]}o(Dr,"default");function Ms(e){return e.trim().split(/^|\s+/)}o(Ms,"classArray");function Or(e){return e.classList||new Ps(e)}o(Or,"classList");function Ps(e){this._node=e,this._names=Ms(e.getAttribute("class")||"")}o(Ps,"ClassList");Ps.prototype={add:o(function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},"add"),remove:o(function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},"remove"),contains:o(function(e){return this._names.indexOf(e)>=0},"contains")};function Ts(e,t){for(var n=Or(e),r=-1,i=t.length;++r<i;)n.add(t[r])}o(Ts,"classedAdd");function ks(e,t){for(var n=Or(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}o(ks,"classedRemove");function zu(e){return function(){Ts(this,e)}}o(zu,"classedTrue");function Ru(e){return function(){ks(this,e)}}o(Ru,"classedFalse");function Lu(e,t){return function(){(t.apply(this,arguments)?Ts:ks)(this,e)}}o(Lu,"classedFunction");function $r(e,t){var n=Ms(e+"");if(arguments.length<2){for(var r=Or(this.node()),i=-1,s=n.length;++i<s;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?Lu:t?zu:Ru)(n,t))}o($r,"default");function Hu(){this.textContent=""}o(Hu,"textRemove");function Bu(e){return function(){this.textContent=e}}o(Bu,"textConstant");function Vu(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}o(Vu,"textFunction");function zr(e){return arguments.length?this.each(e==null?Hu:(typeof e=="function"?Vu:Bu)(e)):this.node().textContent}o(zr,"default");function Fu(){this.innerHTML=""}o(Fu,"htmlRemove");function Yu(e){return function(){this.innerHTML=e}}o(Yu,"htmlConstant");function Wu(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}o(Wu,"htmlFunction");function Rr(e){return arguments.length?this.each(e==null?Fu:(typeof e=="function"?Wu:Yu)(e)):this.node().innerHTML}o(Rr,"default");function Xu(){this.nextSibling&&this.parentNode.appendChild(this)}o(Xu,"raise");function Lr(){return this.each(Xu)}o(Lr,"default");function Zu(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}o(Zu,"lower");function Hr(){return this.each(Zu)}o(Hr,"default");function Br(e){var t=typeof e=="function"?e:In(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}o(Br,"default");function Uu(){return null}o(Uu,"constantNull");function Vr(e,t){var n=typeof e=="function"?e:In(e),r=t==null?Uu:typeof t=="function"?t:gt(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}o(Vr,"default");function Gu(){var e=this.parentNode;e&&e.removeChild(this)}o(Gu,"remove");function Fr(){return this.each(Gu)}o(Fr,"default");function qu(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}o(qu,"selection_cloneShallow");function Ku(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}o(Ku,"selection_cloneDeep");function Yr(e){return this.select(e?Ku:qu)}o(Yr,"default");function Wr(e){return arguments.length?this.property("__data__",e):this.node().__data__}o(Wr,"default");function Qu(e){return function(t){e.call(this,t,this.__data__)}}o(Qu,"contextListener");function Ju(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}o(Ju,"parseTypenames");function ju(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,s;n<i;++n)s=t[n],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++r]=s;++r?t.length=r:delete this.__on}}}o(ju,"onRemove");function ed(e,t,n){return function(){var r=this.__on,i,s=Qu(t);if(r){for(var a=0,l=r.length;a<l;++a)if((i=r[a]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=s,i.options=n),i.value=t;return}}this.addEventListener(e.type,s,n),i={type:e.type,name:e.name,value:t,listener:s,options:n},r?r.push(i):this.__on=[i]}}o(ed,"onAdd");function Xr(e,t,n){var r=Ju(e+""),i,s=r.length,a;if(arguments.length<2){var l=this.node().__on;if(l){for(var c=0,u=l.length,d;c<u;++c)for(i=0,d=l[c];i<s;++i)if((a=r[i]).type===d.type&&a.name===d.name)return d.value}return}for(l=t?ed:ju,i=0;i<s;++i)this.each(l(r[i],t,n));return this}o(Xr,"default");function As(e,t,n){var r=Tn(e),i=r.CustomEvent;typeof i=="function"?i=new i(t,n):(i=r.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}o(As,"dispatchEvent");function td(e,t){return function(){return As(this,e,t)}}o(td,"dispatchConstant");function nd(e,t){return function(){return As(this,e,t.apply(this,arguments))}}o(nd,"dispatchFunction");function Zr(e,t){return this.each((typeof t=="function"?nd:td)(e,t))}o(Zr,"default");function*Ur(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,s=r.length,a;i<s;++i)(a=r[i])&&(yield a)}o(Ur,"default");var Gr=[null];function ye(e,t){this._groups=e,this._parents=t}o(ye,"Selection");function Ds(){return new ye([[document.documentElement]],Gr)}o(Ds,"selection");function od(){return this}o(od,"selection_selection");ye.prototype=Ds.prototype={constructor:ye,select:dr,selectAll:hr,selectChild:pr,selectChildren:mr,filter:gr,data:wr,enter:yr,exit:br,join:vr,merge:Sr,selection:od,order:Er,sort:Cr,call:_r,nodes:Nr,node:Ir,size:Mr,empty:Pr,each:Tr,attr:kr,style:Ar,property:Dr,classed:$r,text:zr,html:Rr,raise:Lr,lower:Hr,append:Br,insert:Vr,remove:Fr,clone:Yr,datum:Wr,on:Xr,dispatch:Zr,[Symbol.iterator]:Ur};var Ke=Ds;function Ee(e){return typeof e=="string"?new ye([[document.querySelector(e)]],[document.documentElement]):new ye([[e]],Gr)}o(Ee,"default");function qr(e){let t;for(;t=e.sourceEvent;)e=t;return e}o(qr,"default");function Me(e,t){if(e=qr(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}o(Me,"default");var Os={passive:!1},Tt={capture:!0,passive:!1};function yo(e){e.stopImmediatePropagation()}o(yo,"nopropagation");function Qe(e){e.preventDefault(),e.stopImmediatePropagation()}o(Qe,"default");function Kt(e){var t=e.document.documentElement,n=Ee(e).on("dragstart.drag",Qe,Tt);"onselectstart"in t?n.on("selectstart.drag",Qe,Tt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}o(Kt,"default");function kn(e,t){var n=e.document.documentElement,r=Ee(e).on("dragstart.drag",null);t&&(r.on("click.drag",Qe,Tt),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}o(kn,"yesdrag");var An=o(e=>()=>e,"default");function Dn(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:s,x:a,y:l,dx:c,dy:u,dispatch:d}){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:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}o(Dn,"DragEvent");Dn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function rd(e){return!e.ctrlKey&&!e.button}o(rd,"defaultFilter");function id(){return this.parentNode}o(id,"defaultContainer");function sd(e,t){return t??{x:e.x,y:e.y}}o(sd,"defaultSubject");function ad(){return navigator.maxTouchPoints||"ontouchstart"in this}o(ad,"defaultTouchable");function On(){var e=rd,t=id,n=sd,r=ad,i={},s=Pt("start","drag","end"),a=0,l,c,u,d,f=0;function h(w){w.on("mousedown.drag",p).filter(r).on("touchstart.drag",b).on("touchmove.drag",y,Os).on("touchend.drag touchcancel.drag",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}o(h,"drag");function p(w,M){if(!(d||!e.call(this,w,M))){var _=g(this,t.call(this,w,M),w,M,"mouse");_&&(Ee(w.view).on("mousemove.drag",m,Tt).on("mouseup.drag",v,Tt),Kt(w.view),yo(w),u=!1,l=w.clientX,c=w.clientY,_("start",w))}}o(p,"mousedowned");function m(w){if(Qe(w),!u){var M=w.clientX-l,_=w.clientY-c;u=M*M+_*_>f}i.mouse("drag",w)}o(m,"mousemoved");function v(w){Ee(w.view).on("mousemove.drag mouseup.drag",null),kn(w.view,u),Qe(w),i.mouse("end",w)}o(v,"mouseupped");function b(w,M){if(e.call(this,w,M)){var _=w.changedTouches,P=t.call(this,w,M),T=_.length,k,Y;for(k=0;k<T;++k)(Y=g(this,P,w,M,_[k].identifier,_[k]))&&(yo(w),Y("start",w,_[k]))}}o(b,"touchstarted");function y(w){var M=w.changedTouches,_=M.length,P,T;for(P=0;P<_;++P)(T=i[M[P].identifier])&&(Qe(w),T("drag",w,M[P]))}o(y,"touchmoved");function E(w){var M=w.changedTouches,_=M.length,P,T;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),P=0;P<_;++P)(T=i[M[P].identifier])&&(yo(w),T("end",w,M[P]))}o(E,"touchended");function g(w,M,_,P,T,k){var Y=s.copy(),z=Me(k||_,M),V,L,x;if((x=n.call(w,new Dn("beforestart",{sourceEvent:_,target:h,identifier:T,active:a,x:z[0],y:z[1],dx:0,dy:0,dispatch:Y}),P))!=null)return V=x.x-z[0]||0,L=x.y-z[1]||0,o(function S(C,I,$){var A=z,B;switch(C){case"start":i[T]=S,B=a++;break;case"end":delete i[T],--a;case"drag":z=Me($||I,M),B=a;break}Y.call(C,w,new Dn(C,{sourceEvent:I,subject:x,target:h,identifier:T,active:B,x:z[0]+V,y:z[1]+L,dx:z[0]-A[0],dy:z[1]-A[1],dispatch:Y}),P)},"gesture")}return o(g,"beforestart"),h.filter=function(w){return arguments.length?(e=typeof w=="function"?w:An(!!w),h):e},h.container=function(w){return arguments.length?(t=typeof w=="function"?w:An(w),h):t},h.subject=function(w){return arguments.length?(n=typeof w=="function"?w:An(w),h):n},h.touchable=function(w){return arguments.length?(r=typeof w=="function"?w:An(!!w),h):r},h.on=function(){var w=s.on.apply(s,arguments);return w===s?h:w},h.clickDistance=function(w){return arguments.length?(f=(w=+w)*w,h):Math.sqrt(f)},h}o(On,"default");var Qt=0,zn=0,$n=0,zs=1e3,xo,Rn,wo=0,kt=0,bo=0,Ln=typeof performance=="object"&&performance.now?performance:Date,Rs=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Bn(){return kt||(Rs(ld),kt=Ln.now()+bo)}o(Bn,"now");function ld(){kt=0}o(ld,"clearNow");function Hn(){this._call=this._time=this._next=null}o(Hn,"Timer");Hn.prototype=vo.prototype={constructor:Hn,restart:o(function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Bn():+n)+(t==null?0:+t),!this._next&&Rn!==this&&(Rn?Rn._next=this:xo=this,Rn=this),this._call=e,this._time=n,Kr()},"restart"),stop:o(function(){this._call&&(this._call=null,this._time=1/0,Kr())},"stop")};function vo(e,t,n){var r=new Hn;return r.restart(e,t,n),r}o(vo,"timer");function Ls(){Bn(),++Qt;for(var e=xo,t;e;)(t=kt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Qt}o(Ls,"timerFlush");function $s(){kt=(wo=Ln.now())+bo,Qt=zn=0;try{Ls()}finally{Qt=0,ud(),kt=0}}o($s,"wake");function cd(){var e=Ln.now(),t=e-wo;t>zs&&(bo-=t,wo=e)}o(cd,"poke");function ud(){for(var e,t=xo,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:xo=n);Rn=e,Kr(r)}o(ud,"nap");function Kr(e){if(!Qt){zn&&(zn=clearTimeout(zn));var t=e-kt;t>24?(e<1/0&&(zn=setTimeout($s,e-Ln.now()-bo)),$n&&($n=clearInterval($n))):($n||(wo=Ln.now(),$n=setInterval(cd,zs)),Qt=1,Rs($s))}}o(Kr,"sleep");function Vn(e,t,n){var r=new Hn;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}o(Vn,"default");var dd=Pt("start","end","cancel","interrupt"),fd=[],Vs=0,Hs=1,Eo=2,So=3,Bs=4,Co=5,Fn=6;function Je(e,t,n,r,i,s){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;hd(e,n,{name:t,index:r,group:i,on:dd,tween:fd,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Vs})}o(Je,"default");function Yn(e,t){var n=Ce(e,t);if(n.state>Vs)throw new Error("too late; already scheduled");return n}o(Yn,"init");function Ne(e,t){var n=Ce(e,t);if(n.state>So)throw new Error("too late; already running");return n}o(Ne,"set");function Ce(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}o(Ce,"get");function hd(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=vo(s,0,n.time);function s(u){n.state=Hs,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}o(s,"schedule");function a(u){var d,f,h,p;if(n.state!==Hs)return c();for(d in r)if(p=r[d],p.name===n.name){if(p.state===So)return Vn(a);p.state===Bs?(p.state=Fn,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete r[d]):+d<t&&(p.state=Fn,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete r[d])}if(Vn(function(){n.state===So&&(n.state=Bs,n.timer.restart(l,n.delay,n.time),l(u))}),n.state=Eo,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Eo){for(n.state=So,i=new Array(h=n.tween.length),d=0,f=-1;d<h;++d)(p=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(i[++f]=p);i.length=f+1}}o(a,"start");function l(u){for(var d=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(c),n.state=Co,1),f=-1,h=i.length;++f<h;)i[f].call(e,d);n.state===Co&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}o(l,"tick");function c(){n.state=Fn,n.timer.stop(),delete r[t];for(var u in r)return;delete e.__transition}o(c,"stop")}o(hd,"create");function xt(e,t){var n=e.__transition,r,i,s=!0,a;if(n){t=t==null?null:t+"";for(a in n){if((r=n[a]).name!==t){s=!1;continue}i=r.state>Eo&&r.state<Co,r.state=Fn,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[a]}s&&delete e.__transition}}o(xt,"default");function Qr(e){return this.each(function(){xt(this,e)})}o(Qr,"default");function pd(e,t){var n,r;return function(){var i=Ne(this,e),s=i.tween;if(s!==n){r=n=s;for(var a=0,l=r.length;a<l;++a)if(r[a].name===t){r=r.slice(),r.splice(a,1);break}}i.tween=r}}o(pd,"tweenRemove");function md(e,t,n){var r,i;if(typeof n!="function")throw new Error;return function(){var s=Ne(this,e),a=s.tween;if(a!==r){i=(r=a).slice();for(var l={name:t,value:n},c=0,u=i.length;c<u;++c)if(i[c].name===t){i[c]=l;break}c===u&&i.push(l)}s.tween=i}}o(md,"tweenFunction");function Jr(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Ce(this.node(),n).tween,i=0,s=r.length,a;i<s;++i)if((a=r[i]).name===e)return a.value;return null}return this.each((t==null?pd:md)(n,e,t))}o(Jr,"default");function Jt(e,t,n){var r=e._id;return e.each(function(){var i=Ne(this,r);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return Ce(i,r).value[t]}}o(Jt,"tweenValue");function Wn(e,t){var n;return(typeof t=="number"?gs:t instanceof lr?cr:(n=lr(t))?(t=n,cr):ys)(e,t)}o(Wn,"default");function gd(e){return function(){this.removeAttribute(e)}}o(gd,"attrRemove");function yd(e){return function(){this.removeAttributeNS(e.space,e.local)}}o(yd,"attrRemoveNS");function xd(e,t,n){var r,i=n+"",s;return function(){var a=this.getAttribute(e);return a===i?null:a===r?s:s=t(r=a,n)}}o(xd,"attrConstant");function wd(e,t,n){var r,i=n+"",s;return function(){var a=this.getAttributeNS(e.space,e.local);return a===i?null:a===r?s:s=t(r=a,n)}}o(wd,"attrConstantNS");function bd(e,t,n){var r,i,s;return function(){var a,l=n(this),c;return l==null?void this.removeAttribute(e):(a=this.getAttribute(e),c=l+"",a===c?null:a===r&&c===i?s:(i=c,s=t(r=a,l)))}}o(bd,"attrFunction");function vd(e,t,n){var r,i,s;return function(){var a,l=n(this),c;return l==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),c=l+"",a===c?null:a===r&&c===i?s:(i=c,s=t(r=a,l)))}}o(vd,"attrFunctionNS");function jr(e,t){var n=Ze(e),r=n==="transform"?ws:Wn;return this.attrTween(e,typeof t=="function"?(n.local?vd:bd)(n,r,Jt(this,"attr."+e,t)):t==null?(n.local?yd:gd)(n):(n.local?wd:xd)(n,r,t))}o(jr,"default");function Sd(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}o(Sd,"attrInterpolate");function Ed(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}o(Ed,"attrInterpolateNS");function Cd(e,t){var n,r;function i(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&Ed(e,s)),n}return o(i,"tween"),i._value=t,i}o(Cd,"attrTweenNS");function _d(e,t){var n,r;function i(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&Sd(e,s)),n}return o(i,"tween"),i._value=t,i}o(_d,"attrTween");function ei(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 r=Ze(e);return this.tween(n,(r.local?Cd:_d)(r,t))}o(ei,"default");function Nd(e,t){return function(){Yn(this,e).delay=+t.apply(this,arguments)}}o(Nd,"delayFunction");function Id(e,t){return t=+t,function(){Yn(this,e).delay=t}}o(Id,"delayConstant");function ti(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Nd:Id)(t,e)):Ce(this.node(),t).delay}o(ti,"default");function Md(e,t){return function(){Ne(this,e).duration=+t.apply(this,arguments)}}o(Md,"durationFunction");function Pd(e,t){return t=+t,function(){Ne(this,e).duration=t}}o(Pd,"durationConstant");function ni(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Md:Pd)(t,e)):Ce(this.node(),t).duration}o(ni,"default");function Td(e,t){if(typeof t!="function")throw new Error;return function(){Ne(this,e).ease=t}}o(Td,"easeConstant");function oi(e){var t=this._id;return arguments.length?this.each(Td(t,e)):Ce(this.node(),t).ease}o(oi,"default");function kd(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Ne(this,e).ease=n}}o(kd,"easeVarying");function ri(e){if(typeof e!="function")throw new Error;return this.each(kd(this._id,e))}o(ri,"default");function ii(e){typeof e!="function"&&(e=qt(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var s=t[i],a=s.length,l=r[i]=[],c,u=0;u<a;++u)(c=s[u])&&e.call(c,c.__data__,u,s)&&l.push(c);return new Ae(r,this._parents,this._name,this._id)}o(ii,"default");function si(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,i=n.length,s=Math.min(r,i),a=new Array(r),l=0;l<s;++l)for(var c=t[l],u=n[l],d=c.length,f=a[l]=new Array(d),h,p=0;p<d;++p)(h=c[p]||u[p])&&(f[p]=h);for(;l<r;++l)a[l]=t[l];return new Ae(a,this._parents,this._name,this._id)}o(si,"default");function Ad(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}o(Ad,"start");function Dd(e,t,n){var r,i,s=Ad(t)?Yn:Ne;return function(){var a=s(this,e),l=a.on;l!==r&&(i=(r=l).copy()).on(t,n),a.on=i}}o(Dd,"onFunction");function ai(e,t){var n=this._id;return arguments.length<2?Ce(this.node(),n).on.on(e):this.each(Dd(n,e,t))}o(ai,"default");function Od(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}o(Od,"removeFunction");function li(){return this.on("end.remove",Od(this._id))}o(li,"default");function ci(e){var t=this._name,n=this._id;typeof e!="function"&&(e=gt(e));for(var r=this._groups,i=r.length,s=new Array(i),a=0;a<i;++a)for(var l=r[a],c=l.length,u=s[a]=new Array(c),d,f,h=0;h<c;++h)(d=l[h])&&(f=e.call(d,d.__data__,h,l))&&("__data__"in d&&(f.__data__=d.__data__),u[h]=f,Je(u[h],t,n,h,u,Ce(d,n)));return new Ae(s,this._parents,t,n)}o(ci,"default");function ui(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Gt(e));for(var r=this._groups,i=r.length,s=[],a=[],l=0;l<i;++l)for(var c=r[l],u=c.length,d,f=0;f<u;++f)if(d=c[f]){for(var h=e.call(d,d.__data__,f,c),p,m=Ce(d,n),v=0,b=h.length;v<b;++v)(p=h[v])&&Je(p,t,n,v,h,m);s.push(h),a.push(d)}return new Ae(s,a,t,n)}o(ui,"default");var $d=Ke.prototype.constructor;function di(){return new $d(this._groups,this._parents)}o(di,"default");function zd(e,t){var n,r,i;return function(){var s=yt(this,e),a=(this.style.removeProperty(e),yt(this,e));return s===a?null:s===n&&a===r?i:i=t(n=s,r=a)}}o(zd,"styleNull");function Fs(e){return function(){this.style.removeProperty(e)}}o(Fs,"styleRemove");function Rd(e,t,n){var r,i=n+"",s;return function(){var a=yt(this,e);return a===i?null:a===r?s:s=t(r=a,n)}}o(Rd,"styleConstant");function Ld(e,t,n){var r,i,s;return function(){var a=yt(this,e),l=n(this),c=l+"";return l==null&&(c=l=(this.style.removeProperty(e),yt(this,e))),a===c?null:a===r&&c===i?s:(i=c,s=t(r=a,l))}}o(Ld,"styleFunction");function Hd(e,t){var n,r,i,s="style."+t,a="end."+s,l;return function(){var c=Ne(this,e),u=c.on,d=c.value[s]==null?l||(l=Fs(t)):void 0;(u!==n||i!==d)&&(r=(n=u).copy()).on(a,i=d),c.on=r}}o(Hd,"styleMaybeRemove");function fi(e,t,n){var r=(e+="")=="transform"?xs:Wn;return t==null?this.styleTween(e,zd(e,r)).on("end.style."+e,Fs(e)):typeof t=="function"?this.styleTween(e,Ld(e,r,Jt(this,"style."+e,t))).each(Hd(this._id,e)):this.styleTween(e,Rd(e,r,t),n).on("end.style."+e,null)}o(fi,"default");function Bd(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}o(Bd,"styleInterpolate");function Vd(e,t,n){var r,i;function s(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&Bd(e,a,n)),r}return o(s,"tween"),s._value=t,s}o(Vd,"styleTween");function hi(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,Vd(e,t,n??""))}o(hi,"default");function Fd(e){return function(){this.textContent=e}}o(Fd,"textConstant");function Yd(e){return function(){var t=e(this);this.textContent=t??""}}o(Yd,"textFunction");function pi(e){return this.tween("text",typeof e=="function"?Yd(Jt(this,"text",e)):Fd(e==null?"":e+""))}o(pi,"default");function Wd(e){return function(t){this.textContent=e.call(this,t)}}o(Wd,"textInterpolate");function Xd(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&Wd(i)),t}return o(r,"tween"),r._value=e,r}o(Xd,"textTween");function mi(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,Xd(e))}o(mi,"default");function gi(){for(var e=this._name,t=this._id,n=_o(),r=this._groups,i=r.length,s=0;s<i;++s)for(var a=r[s],l=a.length,c,u=0;u<l;++u)if(c=a[u]){var d=Ce(c,t);Je(c,e,n,u,a,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new Ae(r,this._parents,e,n)}o(gi,"default");function yi(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(s,a){var l={value:a},c={value:o(function(){--i===0&&s()},"value")};n.each(function(){var u=Ne(this,r),d=u.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(c)),u.on=t}),i===0&&s()})}o(yi,"default");var Zd=0;function Ae(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}o(Ae,"Transition");function Ys(e){return Ke().transition(e)}o(Ys,"transition");function _o(){return++Zd}o(_o,"newId");var je=Ke.prototype;Ae.prototype=Ys.prototype={constructor:Ae,select:ci,selectAll:ui,selectChild:je.selectChild,selectChildren:je.selectChildren,filter:ii,merge:si,selection:di,transition:gi,call:je.call,nodes:je.nodes,node:je.node,size:je.size,empty:je.empty,each:je.each,on:ai,attr:jr,attrTween:ei,style:fi,styleTween:hi,text:pi,textTween:mi,remove:li,tween:Jr,delay:ti,duration:ni,ease:oi,easeVarying:ri,end:yi,[Symbol.iterator]:je[Symbol.iterator]};function No(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}o(No,"cubicInOut");var Ud={time:null,delay:0,duration:250,ease:No};function Gd(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}o(Gd,"inherit");function xi(e){var t,n;e instanceof Ae?(t=e._id,e=e._name):(t=_o(),(n=Ud).time=Bn(),e=e==null?null:e+"");for(var r=this._groups,i=r.length,s=0;s<i;++s)for(var a=r[s],l=a.length,c,u=0;u<l;++u)(c=a[u])&&Je(c,e,t,u,a,n||Gd(c,t));return new Ae(r,this._parents,e,t)}o(xi,"default");Ke.prototype.interrupt=Qr;Ke.prototype.transition=xi;var Xn=o(e=>()=>e,"default");function wi(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){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:r,enumerable:!0,configurable:!0},_:{value:i}})}o(wi,"ZoomEvent");function Ve(e,t,n){this.k=e,this.x=t,this.y=n}o(Ve,"Transform");Ve.prototype={constructor:Ve,scale:o(function(e){return e===1?this:new Ve(this.k*e,this.x,this.y)},"scale"),translate:o(function(e,t){return e===0&t===0?this:new Ve(this.k,this.x+this.k*e,this.y+this.k*t)},"translate"),apply:o(function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},"apply"),applyX:o(function(e){return e*this.k+this.x},"applyX"),applyY:o(function(e){return e*this.k+this.y},"applyY"),invert:o(function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},"invert"),invertX:o(function(e){return(e-this.x)/this.k},"invertX"),invertY:o(function(e){return(e-this.y)/this.k},"invertY"),rescaleX:o(function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},"rescaleX"),rescaleY:o(function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},"rescaleY"),toString:o(function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"},"toString")};var At=new Ve(1,0,0);Zn.prototype=Ve.prototype;function Zn(e){for(;!e.__zoom;)if(!(e=e.parentNode))return At;return e.__zoom}o(Zn,"transform");function Io(e){e.stopImmediatePropagation()}o(Io,"nopropagation");function Dt(e){e.preventDefault(),e.stopImmediatePropagation()}o(Dt,"default");function qd(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}o(qd,"defaultFilter");function Kd(){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]]}o(Kd,"defaultExtent");function Ws(){return this.__zoom||At}o(Ws,"defaultTransform");function Qd(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}o(Qd,"defaultWheelDelta");function Jd(){return navigator.maxTouchPoints||"ontouchstart"in this}o(Jd,"defaultTouchable");function jd(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a))}o(jd,"defaultConstrain");function Un(){var e=qd,t=Kd,n=jd,r=Qd,i=Jd,s=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,c=Ut,u=Pt("start","zoom","end"),d,f,h,p=500,m=150,v=0,b=10;function y(x){x.property("__zoom",Ws).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",Y).filter(i).on("touchstart.zoom",z).on("touchmove.zoom",V).on("touchend.zoom touchcancel.zoom",L).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}o(y,"zoom"),y.transform=function(x,S,C,I){var $=x.selection?x.selection():x;$.property("__zoom",Ws),x!==$?M(x,S,C,I):$.interrupt().each(function(){_(this,arguments).event(I).start().zoom(null,typeof S=="function"?S.apply(this,arguments):S).end()})},y.scaleBy=function(x,S,C,I){y.scaleTo(x,function(){var $=this.__zoom.k,A=typeof S=="function"?S.apply(this,arguments):S;return $*A},C,I)},y.scaleTo=function(x,S,C,I){y.transform(x,function(){var $=t.apply(this,arguments),A=this.__zoom,B=C==null?w($):typeof C=="function"?C.apply(this,arguments):C,F=A.invert(B),H=typeof S=="function"?S.apply(this,arguments):S;return n(g(E(A,H),B,F),$,a)},C,I)},y.translateBy=function(x,S,C,I){y.transform(x,function(){return n(this.__zoom.translate(typeof S=="function"?S.apply(this,arguments):S,typeof C=="function"?C.apply(this,arguments):C),t.apply(this,arguments),a)},null,I)},y.translateTo=function(x,S,C,I,$){y.transform(x,function(){var A=t.apply(this,arguments),B=this.__zoom,F=I==null?w(A):typeof I=="function"?I.apply(this,arguments):I;return n(At.translate(F[0],F[1]).scale(B.k).translate(typeof S=="function"?-S.apply(this,arguments):-S,typeof C=="function"?-C.apply(this,arguments):-C),A,a)},I,$)};function E(x,S){return S=Math.max(s[0],Math.min(s[1],S)),S===x.k?x:new Ve(S,x.x,x.y)}o(E,"scale");function g(x,S,C){var I=S[0]-C[0]*x.k,$=S[1]-C[1]*x.k;return I===x.x&&$===x.y?x:new Ve(x.k,I,$)}o(g,"translate");function w(x){return[(+x[0][0]+ +x[1][0])/2,(+x[0][1]+ +x[1][1])/2]}o(w,"centroid");function M(x,S,C,I){x.on("start.zoom",function(){_(this,arguments).event(I).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(I).end()}).tween("zoom",function(){var $=this,A=arguments,B=_($,A).event(I),F=t.apply($,A),H=C==null?w(F):typeof C=="function"?C.apply($,A):C,U=Math.max(F[1][0]-F[0][0],F[1][1]-F[0][1]),Z=$.__zoom,W=typeof S=="function"?S.apply($,A):S,j=c(Z.invert(H).concat(U/Z.k),W.invert(H).concat(U/W.k));return function(K){if(K===1)K=W;else{var R=j(K),X=U/R[2];K=new Ve(X,H[0]-R[0]*X,H[1]-R[1]*X)}B.zoom(null,K)}})}o(M,"schedule");function _(x,S,C){return!C&&x.__zooming||new P(x,S)}o(_,"gesture");function P(x,S){this.that=x,this.args=S,this.active=0,this.sourceEvent=null,this.extent=t.apply(x,S),this.taps=0}o(P,"Gesture"),P.prototype={event:o(function(x){return x&&(this.sourceEvent=x),this},"event"),start:o(function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},"start"),zoom:o(function(x,S){return this.mouse&&x!=="mouse"&&(this.mouse[1]=S.invert(this.mouse[0])),this.touch0&&x!=="touch"&&(this.touch0[1]=S.invert(this.touch0[0])),this.touch1&&x!=="touch"&&(this.touch1[1]=S.invert(this.touch1[0])),this.that.__zoom=S,this.emit("zoom"),this},"zoom"),end:o(function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},"end"),emit:o(function(x){var S=Ee(this.that).datum();u.call(x,this.that,new wi(x,{sourceEvent:this.sourceEvent,target:y,type:x,transform:this.that.__zoom,dispatch:u}),S)},"emit")};function T(x,...S){if(!e.apply(this,arguments))return;var C=_(this,S).event(x),I=this.__zoom,$=Math.max(s[0],Math.min(s[1],I.k*Math.pow(2,r.apply(this,arguments)))),A=Me(x);if(C.wheel)(C.mouse[0][0]!==A[0]||C.mouse[0][1]!==A[1])&&(C.mouse[1]=I.invert(C.mouse[0]=A)),clearTimeout(C.wheel);else{if(I.k===$)return;C.mouse=[A,I.invert(A)],xt(this),C.start()}Dt(x),C.wheel=setTimeout(B,m),C.zoom("mouse",n(g(E(I,$),C.mouse[0],C.mouse[1]),C.extent,a));function B(){C.wheel=null,C.end()}o(B,"wheelidled")}o(T,"wheeled");function k(x,...S){if(h||!e.apply(this,arguments))return;var C=x.currentTarget,I=_(this,S,!0).event(x),$=Ee(x.view).on("mousemove.zoom",H,!0).on("mouseup.zoom",U,!0),A=Me(x,C),B=x.clientX,F=x.clientY;Kt(x.view),Io(x),I.mouse=[A,this.__zoom.invert(A)],xt(this),I.start();function H(Z){if(Dt(Z),!I.moved){var W=Z.clientX-B,j=Z.clientY-F;I.moved=W*W+j*j>v}I.event(Z).zoom("mouse",n(g(I.that.__zoom,I.mouse[0]=Me(Z,C),I.mouse[1]),I.extent,a))}o(H,"mousemoved");function U(Z){$.on("mousemove.zoom mouseup.zoom",null),kn(Z.view,I.moved),Dt(Z),I.event(Z).end()}o(U,"mouseupped")}o(k,"mousedowned");function Y(x,...S){if(e.apply(this,arguments)){var C=this.__zoom,I=Me(x.changedTouches?x.changedTouches[0]:x,this),$=C.invert(I),A=C.k*(x.shiftKey?.5:2),B=n(g(E(C,A),I,$),t.apply(this,S),a);Dt(x),l>0?Ee(this).transition().duration(l).call(M,B,I,x):Ee(this).call(y.transform,B,I,x)}}o(Y,"dblclicked");function z(x,...S){if(e.apply(this,arguments)){var C=x.touches,I=C.length,$=_(this,S,x.changedTouches.length===I).event(x),A,B,F,H;for(Io(x),B=0;B<I;++B)F=C[B],H=Me(F,this),H=[H,this.__zoom.invert(H),F.identifier],$.touch0?!$.touch1&&$.touch0[2]!==H[2]&&($.touch1=H,$.taps=0):($.touch0=H,A=!0,$.taps=1+!!d);d&&(d=clearTimeout(d)),A&&($.taps<2&&(f=H[0],d=setTimeout(function(){d=null},p)),xt(this),$.start())}}o(z,"touchstarted");function V(x,...S){if(this.__zooming){var C=_(this,S).event(x),I=x.changedTouches,$=I.length,A,B,F,H;for(Dt(x),A=0;A<$;++A)B=I[A],F=Me(B,this),C.touch0&&C.touch0[2]===B.identifier?C.touch0[0]=F:C.touch1&&C.touch1[2]===B.identifier&&(C.touch1[0]=F);if(B=C.that.__zoom,C.touch1){var U=C.touch0[0],Z=C.touch0[1],W=C.touch1[0],j=C.touch1[1],K=(K=W[0]-U[0])*K+(K=W[1]-U[1])*K,R=(R=j[0]-Z[0])*R+(R=j[1]-Z[1])*R;B=E(B,Math.sqrt(K/R)),F=[(U[0]+W[0])/2,(U[1]+W[1])/2],H=[(Z[0]+j[0])/2,(Z[1]+j[1])/2]}else if(C.touch0)F=C.touch0[0],H=C.touch0[1];else return;C.zoom("touch",n(g(B,F,H),C.extent,a))}}o(V,"touchmoved");function L(x,...S){if(this.__zooming){var C=_(this,S).event(x),I=x.changedTouches,$=I.length,A,B;for(Io(x),h&&clearTimeout(h),h=setTimeout(function(){h=null},p),A=0;A<$;++A)B=I[A],C.touch0&&C.touch0[2]===B.identifier?delete C.touch0:C.touch1&&C.touch1[2]===B.identifier&&delete C.touch1;if(C.touch1&&!C.touch0&&(C.touch0=C.touch1,delete C.touch1),C.touch0)C.touch0[1]=this.__zoom.invert(C.touch0[0]);else if(C.end(),C.taps===2&&(B=Me(B,this),Math.hypot(f[0]-B[0],f[1]-B[1])<b)){var F=Ee(this).on("dblclick.zoom");F&&F.apply(this,arguments)}}}return o(L,"touchended"),y.wheelDelta=function(x){return arguments.length?(r=typeof x=="function"?x:Xn(+x),y):r},y.filter=function(x){return arguments.length?(e=typeof x=="function"?x:Xn(!!x),y):e},y.touchable=function(x){return arguments.length?(i=typeof x=="function"?x:Xn(!!x),y):i},y.extent=function(x){return arguments.length?(t=typeof x=="function"?x:Xn([[+x[0][0],+x[0][1]],[+x[1][0],+x[1][1]]]),y):t},y.scaleExtent=function(x){return arguments.length?(s[0]=+x[0],s[1]=+x[1],y):[s[0],s[1]]},y.translateExtent=function(x){return arguments.length?(a[0][0]=+x[0][0],a[1][0]=+x[1][0],a[0][1]=+x[0][1],a[1][1]=+x[1][1],y):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},y.constrain=function(x){return arguments.length?(n=x,y):n},y.duration=function(x){return arguments.length?(l=+x,y):l},y.interpolate=function(x){return arguments.length?(c=x,y):c},y.on=function(){var x=u.on.apply(u,arguments);return x===u?y:x},y.clickDistance=function(x){return arguments.length?(v=(x=+x)*x,y):Math.sqrt(v)},y.tapDistance=function(x){return arguments.length?(b=+x,y):b},y}o(Un,"default");var De={error001:o((e="react")=>`Seems like you have not used ${e==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.dev/error#001`,"error001"),error002:o(()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.","error002"),error003:o(e=>`Node type "${e}" not found. Using fallback type "default".`,"error003"),error004:o(()=>"The parent container needs a width and a height to render the graph.","error004"),error005:o(()=>"Only child nodes can use a parent extent.","error005"),error006:o(()=>"Can't create edge. An edge needs a source and a target.","error006"),error007:o(e=>`The old edge with id=${e} does not exist.`,"error007"),error009:o(e=>`Marker type "${e}" doesn't exist.`,"error009"),error008:o((e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,"error008"),error010:o(()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.","error010"),error011:o(e=>`Edge type "${e}" not found. Using fallback type "default".`,"error011"),error012:o(e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,"error012"),error013:o((e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,"error013"),error014:o(()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.","error014"),error015:o(()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.","error015"),error016:o(e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`,"error016")},on=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Ci=["Enter"," ","Escape"],_i={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":o(({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"node.a11yDescription.ariaLiveMessage"),"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"},vt;(function(e){e.Strict="strict",e.Loose="loose"})(vt||(vt={}));var et;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(et||(et={}));var Ot;(function(e){e.Partial="partial",e.Full="full"})(Ot||(Ot={}));var Ni={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},Ue;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ue||(Ue={}));var tn;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(tn||(tn={}));var J;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(J||(J={}));var Xs={[J.Left]:J.Right,[J.Right]:J.Left,[J.Top]:J.Bottom,[J.Bottom]:J.Top};function Ii(e){return e===null?null:e?"valid":"invalid"}o(Ii,"getConnectionStatus");var Mi=o(e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,"isEdgeBase"),ra=o(e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),"isNodeBase"),Pi=o(e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),"isInternalNodeBase");var qn=o((e,t=[0,0])=>{let{width:n,height:r}=Fe(e),i=e.origin??t,s=n*i[0],a=r*i[1];return{x:e.position.x-s,y:e.position.y-a}},"getNodePositionWithOrigin"),Kn=o((e,t={nodeOrigin:[0,0]})=>{if(t.nodeLookup||console.warn("Please use `getNodesBounds` from `useReactFlow`/`useSvelteFlow` hook to ensure correct values for sub flows. If not possible, you have to provide a nodeLookup to support sub flows."),e.length===0)return{x:0,y:0,width:0,height:0};let n=e.reduce((r,i)=>{let s=typeof i=="string",a=!t.nodeLookup&&!s?i:void 0;t.nodeLookup&&(a=s?t.nodeLookup.get(i):Pi(i)?i:t.nodeLookup.get(i.id));let l=a?To(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Do(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Oo(n)},"getNodesBounds"),rn=o((e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(i=>{(t.filter===void 0||t.filter(i))&&(n=Do(n,To(i)),r=!0)}),r?Oo(n):{x:0,y:0,width:0,height:0}},"getInternalNodesBounds"),ko=o((e,t,[n,r,i]=[0,0,1],s=!1,a=!1)=>{let l=(t.x-n)/i,c=(t.y-r)/i,u=t.width/i,d=t.height/i,f=[];for(let h of e.values()){let{measured:p,selectable:m=!0,hidden:v=!1}=h;if(a&&!m||v)continue;let b=p.width??h.width??h.initialWidth??0,y=p.height??h.height??h.initialHeight??0,{x:E,y:g}=h.internals.positionAbsolute,w=ca(l,c,u,d,E,g,b,y),M=b*y,_=s&&w>0;(!h.internals.handleBounds||_||w>=M||h.dragging)&&f.push(h)}return f},"getNodesInside"),ia=o((e,t)=>{let n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))},"getConnectedEdges");function ef(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(i=>i.id)):null;return e.forEach(i=>{let s;if(t?.includeHiddenNodes){let{width:a,height:l}=Fe(i);s=a>0&&l>0}else s=!!(i.measured.width&&i.measured.height&&!i.hidden);s&&(!r||r.has(i.id))&&n.set(i.id,i)}),n}o(ef,"getFitViewNodes");async function sa({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:s},a){if(e.size===0)return!0;let l=ef(e,a),c=rn(l),u=Lt(c,t,n,a?.minZoom??i,a?.maxZoom??s,a?.padding??.1);return await r.setViewport(u,{duration:a?.duration,ease:a?.ease,interpolate:a?.interpolate}),!0}o(sa,"fitViewport");function Ti({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:s}){let a=n.get(e),l=a.parentId?n.get(a.parentId):void 0,{x:c,y:u}=l?l.internals.positionAbsolute:{x:0,y:0},d=a.origin??r,f=a.extent||i;if(a.extent==="parent"&&!a.expandParent)if(!l)s?.("005",De.error005());else{let p=l.measured.width,m=l.measured.height;p&&m&&(f=[[c,u],[c+p,u+m]])}else l&&Rt(a.extent)&&(f=[[a.extent[0][0]+c,a.extent[0][1]+u],[a.extent[1][0]+c,a.extent[1][1]+u]]);let h=Rt(f)?$t(t,f,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&s?.("015",De.error015()),{position:{x:h.x-c+(a.measured.width??0)*d[0],y:h.y-u+(a.measured.height??0)*d[1]},positionAbsolute:h}}o(Ti,"calculateNodePosition");async function aa({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let s=new Set(e.map(h=>h.id)),a=[];for(let h of n){if(h.deletable===!1)continue;let p=s.has(h.id),m=!p&&h.parentId&&a.find(v=>v.id===h.parentId);(p||m)&&a.push(h)}let l=new Set(t.map(h=>h.id)),c=r.filter(h=>h.deletable!==!1),d=ia(a,c);for(let h of c)l.has(h.id)&&!d.find(m=>m.id===h.id)&&d.push(h);if(!i)return{edges:d,nodes:a};let f=await i({nodes:a,edges:d});return typeof f=="boolean"?f?{edges:d,nodes:a}:{edges:[],nodes:[]}:f}o(aa,"getElementsToRemove");var nn=o((e,t=0,n=1)=>Math.min(Math.max(e,t),n),"clamp"),$t=o((e={x:0,y:0},t,n)=>({x:nn(e.x,t[0][0],t[1][0]-(n?.width??0)),y:nn(e.y,t[0][1],t[1][1]-(n?.height??0))}),"clampPosition");function la(e,t,n){let{width:r,height:i}=Fe(n),{x:s,y:a}=n.internals.positionAbsolute;return $t(e,[[s,a],[s+r,a+i]],t)}o(la,"clampPositionToParent");var Zs=o((e,t,n)=>e<t?nn(Math.abs(e-t),1,t)/t:e>n?-nn(Math.abs(e-n),1,t)/t:0,"calcAutoPanVelocity"),Ao=o((e,t,n=15,r=40)=>{let i=Zs(e.x,r,t.width-r)*n,s=Zs(e.y,r,t.height-r)*n;return[i,s]},"calcAutoPan"),Do=o((e,t)=>({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)}),"getBoundsOfBoxes"),Ei=o(({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),"rectToBox"),Oo=o(({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),"boxToRect"),sn=o((e,t=[0,0])=>{let{x:n,y:r}=Pi(e)?e.internals.positionAbsolute:qn(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},"nodeToRect"),To=o((e,t=[0,0])=>{let{x:n,y:r}=Pi(e)?e.internals.positionAbsolute:qn(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},"nodeToBox"),ki=o((e,t)=>Oo(Do(Ei(e),Ei(t))),"getBoundsOfRects"),ca=o((e,t,n,r,i,s,a,l)=>{let c=Math.max(0,Math.min(e+n,i+a)-Math.max(e,i)),u=Math.max(0,Math.min(t+r,s+l)-Math.max(t,s));return Math.ceil(c*u)},"getRectsOverlappingArea"),Qn=o((e,t)=>ca(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),"getOverlappingArea"),Ai=o(e=>Le(e.width)&&Le(e.height)&&Le(e.x)&&Le(e.y),"isRectObject"),Le=o(e=>!isNaN(e)&&isFinite(e),"isNumeric"),Di=o((e,t)=>(n,r)=>{console.warn(`[${e}]: ${r} Help: ${t}error#${n}`)},"createDevWarn"),an=o((e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),"snapPosition"),ln=o(({x:e,y:t},[n,r,i],s=!1,a=[1,1])=>{let l={x:(e-n)/i,y:(t-r)/i};return s?an(l,a):l},"pointToRendererPoint"),zt=o(({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r}),"rendererPointToPoint");function jt(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}o(jt,"parsePadding");function tf(e,t,n){if(typeof e=="string"||typeof e=="number"){let r=jt(e,n),i=jt(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e=="object"){let r=jt(e.top??e.y??0,n),i=jt(e.bottom??e.y??0,n),s=jt(e.left??e.x??0,t),a=jt(e.right??e.x??0,t);return{top:r,right:a,bottom:i,left:s,x:s+a,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}o(tf,"parsePaddings");function nf(e,t,n,r,i,s){let{x:a,y:l}=zt(e,[t,n,r]),{x:c,y:u}=zt({x:e.x+e.width,y:e.y+e.height},[t,n,r]),d=i-c,f=s-u;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(d),bottom:Math.floor(f)}}o(nf,"calculateAppliedPaddings");var Lt=o((e,t,n,r,i,s)=>{let a=tf(s,t,n),l=(t-a.x)/e.width,c=(n-a.y)/e.height,u=Math.min(l,c),d=nn(u,r,i),f=e.x+e.width/2,h=e.y+e.height/2,p=t/2-f*d,m=n/2-h*d,v=nf(e,p,m,d,t,n),b={left:Math.min(v.left-a.left,0),top:Math.min(v.top-a.top,0),right:Math.min(v.right-a.right,0),bottom:Math.min(v.bottom-a.bottom,0)};return{x:p-b.left+b.right,y:m-b.top+b.bottom,zoom:d}},"getViewportForBounds"),cn=o(()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0,"isMacOs");function Rt(e){return e!=null&&e!=="parent"}o(Rt,"isCoordinateExtent");function Fe(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}o(Fe,"getNodeDimensions");function Oi(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}o(Oi,"nodeHasDimensions");function $i(e,t={width:0,height:0},n,r,i){let s={...e},a=r.get(n);if(a){let l=a.origin||i;s.x+=a.internals.positionAbsolute.x-(t.width??0)*l[0],s.y+=a.internals.positionAbsolute.y-(t.height??0)*l[1]}return s}o($i,"evaluateAbsolutePosition");function zi(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}o(zi,"areSetsEqual");function ua(){let e,t;return{promise:new Promise((r,i)=>{e=r,t=i}),resolve:e,reject:t}}o(ua,"withResolvers");function da(e){return{..._i,...e||{}}}o(da,"mergeAriaLabelConfig");function Gn(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:s,y:a}=He(e),l=ln({x:s-(i?.left??0),y:a-(i?.top??0)},r),{x:c,y:u}=n?an(l,t):l;return{xSnapped:c,ySnapped:u,...l}}o(Gn,"getPointerPosition");var $o=o(e=>({width:e.offsetWidth,height:e.offsetHeight}),"getDimensions"),Ri=o(e=>e?.getRootNode?.()||window?.document,"getHostForElement"),of=["INPUT","SELECT","TEXTAREA"];function Li(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:of.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}o(Li,"isInputDOMNode");var Hi=o(e=>"clientX"in e,"isMouseEvent"),He=o((e,t)=>{let n=Hi(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},"getEventPosition"),Us=o((e,t,n,r,i)=>{let s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(a=>{let l=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:i,position:a.getAttribute("data-handlepos"),x:(l.left-n.left)/r,y:(l.top-n.top)/r,...$o(a)}})},"getHandleBounds");function zo({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:s,targetControlX:a,targetControlY:l}){let c=e*.125+i*.375+a*.375+n*.125,u=t*.125+s*.375+l*.375+r*.125,d=Math.abs(c-e),f=Math.abs(u-t);return[c,u,d,f]}o(zo,"getBezierEdgeCenter");function Mo(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}o(Mo,"calculateControlOffset");function Gs({pos:e,x1:t,y1:n,x2:r,y2:i,c:s}){switch(e){case J.Left:return[t-Mo(t-r,s),n];case J.Right:return[t+Mo(r-t,s),n];case J.Top:return[t,n-Mo(n-i,s)];case J.Bottom:return[t,n+Mo(i-n,s)]}}o(Gs,"getControlWithCurvature");function Ro({sourceX:e,sourceY:t,sourcePosition:n=J.Bottom,targetX:r,targetY:i,targetPosition:s=J.Top,curvature:a=.25}){let[l,c]=Gs({pos:n,x1:e,y1:t,x2:r,y2:i,c:a}),[u,d]=Gs({pos:s,x1:r,y1:i,x2:e,y2:t,c:a}),[f,h,p,m]=zo({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:d});return[`M${e},${t} C${l},${c} ${u},${d} ${r},${i}`,f,h,p,m]}o(Ro,"getBezierPath");function Bi({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,s=n<e?n+i:n-i,a=Math.abs(r-t)/2,l=r<t?r+a:r-a;return[s,l,i,a]}o(Bi,"getEdgeCenter");function fa({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:s="basic"}){if(s==="manual")return r;let a=i&&n?r+1e3:r,l=Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0);return a+l}o(fa,"getElevatedEdgeZIndex");function ha({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let s=Do(To(e),To(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);let a={x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]};return Qn(a,Oo(s))>0}o(ha,"isEdgeVisible");var rf=o(({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,"getEdgeId"),sf=o((e,t)=>t.some(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)),"connectionExists"),pa=o((e,t,n={})=>{if(!e.source||!e.target)return n.onError?.("006",De.error006()),t;let r=n.getEdgeId||rf,i;return Mi(e)?i={...e}:i={...e,id:r(e)},sf(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))},"addEdge");function Lo({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,s,a,l]=Bi({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,s,a,l]}o(Lo,"getStraightPath");var qs={[J.Left]:{x:-1,y:0},[J.Right]:{x:1,y:0},[J.Top]:{x:0,y:-1},[J.Bottom]:{x:0,y:1}},af=o(({source:e,sourcePosition:t=J.Bottom,target:n})=>t===J.Left||t===J.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},"getDirection"),Ks=o((e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)),"distance");function lf({source:e,sourcePosition:t=J.Bottom,target:n,targetPosition:r=J.Top,center:i,offset:s,stepPosition:a}){let l=qs[t],c=qs[r],u={x:e.x+l.x*s,y:e.y+l.y*s},d={x:n.x+c.x*s,y:n.y+c.y*s},f=af({source:u,sourcePosition:t,target:d}),h=f.x!==0?"x":"y",p=f[h],m=[],v,b,y={x:0,y:0},E={x:0,y:0},[,,g,w]=Bi({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[h]*c[h]===-1){h==="x"?(v=i.x??u.x+(d.x-u.x)*a,b=i.y??(u.y+d.y)/2):(v=i.x??(u.x+d.x)/2,b=i.y??u.y+(d.y-u.y)*a);let T=[{x:v,y:u.y},{x:v,y:d.y}],k=[{x:u.x,y:b},{x:d.x,y:b}];l[h]===p?m=h==="x"?T:k:m=h==="x"?k:T}else{let T=[{x:u.x,y:d.y}],k=[{x:d.x,y:u.y}];if(h==="x"?m=l.x===p?k:T:m=l.y===p?T:k,t===r){let x=Math.abs(e[h]-n[h]);if(x<=s){let S=Math.min(s-1,s-x);l[h]===p?y[h]=(u[h]>e[h]?-1:1)*S:E[h]=(d[h]>n[h]?-1:1)*S}}if(t!==r){let x=h==="x"?"y":"x",S=l[h]===c[x],C=u[x]>d[x],I=u[x]<d[x];(l[h]===1&&(!S&&C||S&&I)||l[h]!==1&&(!S&&I||S&&C))&&(m=h==="x"?T:k)}let Y={x:u.x+y.x,y:u.y+y.y},z={x:d.x+E.x,y:d.y+E.y},V=Math.max(Math.abs(Y.x-m[0].x),Math.abs(z.x-m[0].x)),L=Math.max(Math.abs(Y.y-m[0].y),Math.abs(z.y-m[0].y));V>=L?(v=(Y.x+z.x)/2,b=m[0].y):(v=m[0].x,b=(Y.y+z.y)/2)}let M={x:u.x+y.x,y:u.y+y.y},_={x:d.x+E.x,y:d.y+E.y};return[[e,...M.x!==m[0].x||M.y!==m[0].y?[M]:[],...m,..._.x!==m[m.length-1].x||_.y!==m[m.length-1].y?[_]:[],n],v,b,g,w]}o(lf,"getPoints");function cf(e,t,n,r){let i=Math.min(Ks(e,t)/2,Ks(t,n)/2,r),{x:s,y:a}=t;if(e.x===s&&s===n.x||e.y===a&&a===n.y)return`L${s} ${a}`;if(e.y===a){let u=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${s+i*u},${a}Q ${s},${a} ${s},${a+i*d}`}let l=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${s},${a+i*c}Q ${s},${a} ${s+i*l},${a}`}o(cf,"getBend");function Jn({sourceX:e,sourceY:t,sourcePosition:n=J.Bottom,targetX:r,targetY:i,targetPosition:s=J.Top,borderRadius:a=5,centerX:l,centerY:c,offset:u=20,stepPosition:d=.5}){let[f,h,p,m,v]=lf({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:s,center:{x:l,y:c},offset:u,stepPosition:d}),b=`M${f[0].x} ${f[0].y}`;for(let y=1;y<f.length-1;y++)b+=cf(f[y-1],f[y],f[y+1],a);return b+=`L${f[f.length-1].x} ${f[f.length-1].y}`,[b,h,p,m,v]}o(Jn,"getSmoothStepPath");function Qs(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}o(Qs,"isNodeInitialized");function ma(e){let{sourceNode:t,targetNode:n}=e;if(!Qs(t)||!Qs(n))return null;let r=t.internals.handleBounds||Js(t.handles),i=n.internals.handleBounds||Js(n.handles),s=js(r?.source??[],e.sourceHandle),a=js(e.connectionMode===vt.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!s||!a)return e.onError?.("008",De.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let l=s?.position||J.Bottom,c=a?.position||J.Top,u=St(t,s,l),d=St(n,a,c);return{sourceX:u.x,sourceY:u.y,targetX:d.x,targetY:d.y,sourcePosition:l,targetPosition:c}}o(ma,"getEdgePosition");function Js(e){if(!e)return null;let t=[],n=[];for(let r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}o(Js,"toHandleBounds");function St(e,t,n=J.Left,r=!1){let i=(t?.x??0)+e.internals.positionAbsolute.x,s=(t?.y??0)+e.internals.positionAbsolute.y,{width:a,height:l}=t??Fe(e);if(r)return{x:i+a/2,y:s+l/2};switch(t?.position??n){case J.Top:return{x:i+a/2,y:s};case J.Right:return{x:i+a,y:s+l/2};case J.Bottom:return{x:i+a/2,y:s+l};case J.Left:return{x:i,y:s+l/2}}}o(St,"getHandlePosition");function js(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}o(js,"getHandle$1");function Ho(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}o(Ho,"getMarkerId");function ga(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let s=new Set;return e.reduce((a,l)=>([l.markerStart||r,l.markerEnd||i].forEach(c=>{if(c&&typeof c=="object"){let u=Ho(c,t);s.has(u)||(a.push({id:u,color:c.color||n,...c}),s.add(u))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))}o(ga,"createMarkerIds");var ya=1e3,uf=10,Vi={nodeOrigin:[0,0],nodeExtent:on,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},df={...Vi,checkEquality:!0};function Fi(e,t){let n={...e};for(let r in t)t[r]!==void 0&&(n[r]=t[r]);return n}o(Fi,"mergeObjects");function xa(e,t,n){let r=Fi(Vi,n);for(let i of e.values())if(i.parentId)Wi(i,e,t,r);else{let s=qn(i,r.nodeOrigin),a=Rt(i.extent)?i.extent:r.nodeExtent,l=$t(s,a,Fe(i));i.internals.positionAbsolute=l}}o(xa,"updateAbsolutePositions");function ff(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let i of e.handles){let s={id:i.id,width:i.width??1,height:i.height??1,nodeId:e.id,x:i.x,y:i.y,position:i.position,type:i.type};i.type==="source"?n.push(s):i.type==="target"&&r.push(s)}return{source:n,target:r}}o(ff,"parseHandles");function Yi(e){return e==="manual"}o(Yi,"isManualZIndexMode");function Bo(e,t,n,r={}){let i=Fi(df,r),s={i:0},a=new Map(t),l=i?.elevateNodesOnSelect&&!Yi(i.zIndexMode)?ya:0,c=e.length>0,u=!1;t.clear(),n.clear();for(let d of e){let f=a.get(d.id);if(i.checkEquality&&d===f?.internals.userNode)t.set(d.id,f);else{let h=qn(d,i.nodeOrigin),p=Rt(d.extent)?d.extent:i.nodeExtent,m=$t(h,p,Fe(d));f={...i.defaults,...d,measured:{width:d.measured?.width,height:d.measured?.height},internals:{positionAbsolute:m,handleBounds:ff(d,f),z:wa(d,l,i.zIndexMode),userNode:d}},t.set(d.id,f)}(f.measured===void 0||f.measured.width===void 0||f.measured.height===void 0)&&!f.hidden&&(c=!1),d.parentId&&Wi(f,t,n,r,s),u||=d.selected??!1}return{nodesInitialized:c,hasSelectedNodes:u}}o(Bo,"adoptUserNodes");function hf(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}o(hf,"updateParentLookup");function Wi(e,t,n,r,i){let{elevateNodesOnSelect:s,nodeOrigin:a,nodeExtent:l,zIndexMode:c}=Fi(Vi,r),u=e.parentId,d=t.get(u);if(!d){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}hf(e,n),i&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++i.i,d.internals.z=d.internals.z+i.i*uf),i&&d.internals.rootParentIndex!==void 0&&(i.i=d.internals.rootParentIndex);let f=s&&!Yi(c)?ya:0,{x:h,y:p,z:m}=pf(e,d,a,l,f,c),{positionAbsolute:v}=e.internals,b=h!==v.x||p!==v.y;(b||m!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:b?{x:h,y:p}:v,z:m}})}o(Wi,"updateChildNode");function wa(e,t,n){let r=Le(e.zIndex)?e.zIndex:0;return Yi(n)?r:r+(e.selected?t:0)}o(wa,"calculateZ");function pf(e,t,n,r,i,s){let{x:a,y:l}=t.internals.positionAbsolute,c=Fe(e),u=qn(e,n),d=Rt(e.extent)?$t(u,e.extent,c):u,f=$t({x:a+d.x,y:l+d.y},r,c);e.extent==="parent"&&(f=la(f,c,t));let h=wa(e,i,s),p=t.internals.z??0;return{x:f.x,y:f.y,z:p>=h?p+1:h}}o(pf,"calculateChildXYZ");function Vo(e,t,n,r=[0,0]){let i=[],s=new Map;for(let a of e){let l=t.get(a.parentId);if(!l)continue;let c=s.get(a.parentId)?.expandedRect??sn(l),u=ki(c,a.rect);s.set(a.parentId,{expandedRect:u,parent:l})}return s.size>0&&s.forEach(({expandedRect:a,parent:l},c)=>{let u=l.internals.positionAbsolute,d=Fe(l),f=l.origin??r,h=a.x<u.x?Math.round(Math.abs(u.x-a.x)):0,p=a.y<u.y?Math.round(Math.abs(u.y-a.y)):0,m=Math.max(d.width,Math.round(a.width)),v=Math.max(d.height,Math.round(a.height)),b=(m-d.width)*f[0],y=(v-d.height)*f[1];(h>0||p>0||b||y)&&(i.push({id:c,type:"position",position:{x:l.position.x-h+b,y:l.position.y-p+y}}),n.get(c)?.forEach(E=>{e.some(g=>g.id===E.id)||i.push({id:E.id,type:"position",position:{x:E.position.x+h,y:E.position.y+p}})})),(d.width<a.width||d.height<a.height||h||p)&&i.push({id:c,type:"dimensions",setAttributes:!0,dimensions:{width:m+(h?f[0]*h-b:0),height:v+(p?f[1]*p-y:0)}})}),i}o(Vo,"handleExpandParent");function ba(e,t,n,r,i,s,a){let l=r?.querySelector(".xyflow__viewport"),c=!1;if(!l)return{changes:[],updatedInternals:c};let u=[],d=window.getComputedStyle(l),{m22:f}=new window.DOMMatrixReadOnly(d.transform),h=[];for(let p of e.values()){let m=t.get(p.id);if(!m)continue;if(m.hidden){t.set(m.id,{...m,internals:{...m.internals,handleBounds:void 0}}),c=!0;continue}let v=$o(p.nodeElement),b=m.measured.width!==v.width||m.measured.height!==v.height;if(!!(v.width&&v.height&&(b||!m.internals.handleBounds||p.force))){let E=p.nodeElement.getBoundingClientRect(),g=Rt(m.extent)?m.extent:s,{positionAbsolute:w}=m.internals;if(m.parentId&&m.extent==="parent"){let _=t.get(m.parentId);_&&(w=la(w,v,_))}else g&&(w=$t(w,g,v));let M={...m,measured:v,internals:{...m.internals,positionAbsolute:w,handleBounds:{source:Us("source",p.nodeElement,E,f,m.id),target:Us("target",p.nodeElement,E,f,m.id)}}};t.set(m.id,M),m.parentId&&Wi(M,t,n,{nodeOrigin:i,zIndexMode:a}),c=!0,b&&(u.push({id:m.id,type:"dimensions",dimensions:v}),m.expandParent&&m.parentId&&h.push({id:m.id,parentId:m.parentId,rect:sn(M,i)}))}}if(h.length>0){let p=Vo(h,t,n,i);u.push(...p)}return{changes:u,updatedInternals:c}}o(ba,"updateNodeInternals");async function va({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:s}){if(!t||!e.x&&!e.y)return!1;let a=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,s]],r);return!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2])}o(va,"panBy");function ea(e,t,n,r,i,s){let a=i,l=r.get(a)||new Map;r.set(a,l.set(n,t)),a=`${i}-${e}`;let c=r.get(a)||new Map;if(r.set(a,c.set(n,t)),s){a=`${i}-${e}-${s}`;let u=r.get(a)||new Map;r.set(a,u.set(n,t))}}o(ea,"addConnectionToLookup");function Xi(e,t,n){e.clear(),t.clear();for(let r of n){let{source:i,target:s,sourceHandle:a=null,targetHandle:l=null}=r,c={edgeId:r.id,source:i,target:s,sourceHandle:a,targetHandle:l},u=`${i}-${a}--${s}-${l}`,d=`${s}-${l}--${i}-${a}`;ea("source",c,d,e,i,a),ea("target",c,u,e,s,l),t.set(r.id,r)}}o(Xi,"updateConnectionLookup");function Sa(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:Sa(n,t):!1}o(Sa,"isParentSelected");function ta(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}o(ta,"hasSelector");function mf(e,t,n,r){let i=new Map;for(let[s,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!Sa(a,e))&&(a.draggable||t&&typeof a.draggable>"u")){let l=e.get(s);l&&i.set(s,{id:s,position:l.position||{x:0,y:0},distance:{x:n.x-l.internals.positionAbsolute.x,y:n.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return i}o(mf,"getDragItems");function bi({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[a,l]of t){let c=n.get(a)?.internals.userNode;c&&i.push({...c,position:l.position,dragging:r})}if(!e)return[i[0],i];let s=n.get(e)?.internals.userNode;return[s?{...s,position:t.get(e)?.position||s.position,dragging:r}:i[0],i]}o(bi,"getEventHandlerParams");function gf({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let s={x:n-i.distance.x,y:r-i.distance.y},a=an(s,t);return{x:a.x-s.x,y:a.y-s.y}}o(gf,"calculateSnapOffset");function Ea({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let s={x:null,y:null},a=0,l=new Map,c=!1,u={x:0,y:0},d=null,f=!1,h=null,p=!1,m=!1,v=null;function b({noDragClassName:E,handleSelector:g,domNode:w,isSelectable:M,nodeId:_,nodeClickDistance:P=0}){h=Ee(w);function T({x:V,y:L}){let{nodeLookup:x,nodeExtent:S,snapGrid:C,snapToGrid:I,nodeOrigin:$,onNodeDrag:A,onSelectionDrag:B,onError:F,updateNodePositions:H}=t();s={x:V,y:L};let U=!1,Z=l.size>1,W=Z&&S?Ei(rn(l)):null,j=Z&&I?gf({dragItems:l,snapGrid:C,x:V,y:L}):null;for(let[K,R]of l){if(!x.has(K))continue;let X={x:V-R.distance.x,y:L-R.distance.y};I&&(X=j?{x:Math.round(X.x+j.x),y:Math.round(X.y+j.y)}:an(X,C));let te=null;if(Z&&S&&!R.extent&&W){let{positionAbsolute:q}=R.internals,ne=q.x-W.x+S[0][0],oe=q.x+R.measured.width-W.x2+S[1][0],se=q.y-W.y+S[0][1],ce=q.y+R.measured.height-W.y2+S[1][1];te=[[ne,se],[oe,ce]]}let{position:ee,positionAbsolute:G}=Ti({nodeId:K,nextPosition:X,nodeLookup:x,nodeExtent:te||S,nodeOrigin:$,onError:F});U=U||R.position.x!==ee.x||R.position.y!==ee.y,R.position=ee,R.internals.positionAbsolute=G}if(m=m||U,!!U&&(H(l,!0),v&&(r||A||!_&&B))){let[K,R]=bi({nodeId:_,dragItems:l,nodeLookup:x});r?.(v,l,K,R),A?.(v,K,R),_||B?.(v,R)}}o(T,"updateNodes");async function k(){if(!d)return;let{transform:V,panBy:L,autoPanSpeed:x,autoPanOnNodeDrag:S}=t();if(!S){c=!1,cancelAnimationFrame(a);return}let[C,I]=Ao(u,d,x);(C!==0||I!==0)&&(s.x=(s.x??0)-C/V[2],s.y=(s.y??0)-I/V[2],await L({x:C,y:I})&&T(s)),a=requestAnimationFrame(k)}o(k,"autoPan");function Y(V){let{nodeLookup:L,multiSelectionActive:x,nodesDraggable:S,transform:C,snapGrid:I,snapToGrid:$,selectNodesOnDrag:A,onNodeDragStart:B,onSelectionDragStart:F,unselectNodesAndEdges:H}=t();f=!0,(!A||!M)&&!x&&_&&(L.get(_)?.selected||H()),M&&A&&_&&e?.(_);let U=Gn(V.sourceEvent,{transform:C,snapGrid:I,snapToGrid:$,containerBounds:d});if(s=U,l=mf(L,S,U,_),l.size>0&&(n||B||!_&&F)){let[Z,W]=bi({nodeId:_,dragItems:l,nodeLookup:L});n?.(V.sourceEvent,l,Z,W),B?.(V.sourceEvent,Z,W),_||F?.(V.sourceEvent,W)}}o(Y,"startDrag");let z=On().clickDistance(P).on("start",V=>{let{domNode:L,nodeDragThreshold:x,transform:S,snapGrid:C,snapToGrid:I}=t();d=L?.getBoundingClientRect()||null,p=!1,m=!1,v=V.sourceEvent,x===0&&Y(V),s=Gn(V.sourceEvent,{transform:S,snapGrid:C,snapToGrid:I,containerBounds:d}),u=He(V.sourceEvent,d)}).on("drag",V=>{let{autoPanOnNodeDrag:L,transform:x,snapGrid:S,snapToGrid:C,nodeDragThreshold:I,nodeLookup:$}=t(),A=Gn(V.sourceEvent,{transform:x,snapGrid:S,snapToGrid:C,containerBounds:d});if(v=V.sourceEvent,(V.sourceEvent.type==="touchmove"&&V.sourceEvent.touches.length>1||_&&!$.has(_))&&(p=!0),!p){if(!c&&L&&f&&(c=!0,k()),!f){let B=He(V.sourceEvent,d),F=B.x-u.x,H=B.y-u.y;Math.sqrt(F*F+H*H)>I&&Y(V)}(s.x!==A.xSnapped||s.y!==A.ySnapped)&&l&&f&&(u=He(V.sourceEvent,d),T(A))}}).on("end",V=>{if(!f||p){p&&l.size>0&&t().updateNodePositions(l,!1);return}if(c=!1,f=!1,cancelAnimationFrame(a),l.size>0){let{nodeLookup:L,updateNodePositions:x,onNodeDragStop:S,onSelectionDragStop:C}=t();if(m&&(x(l,!1),m=!1),i||S||!_&&C){let[I,$]=bi({nodeId:_,dragItems:l,nodeLookup:L,dragging:!1});i?.(V.sourceEvent,l,I,$),S?.(V.sourceEvent,I,$),_||C?.(V.sourceEvent,$)}}}).filter(V=>{let L=V.target;return!V.button&&(!E||!ta(L,`.${E}`,w))&&(!g||ta(L,g,w))});h.call(z)}o(b,"update");function y(){h?.on(".drag",null)}return o(y,"destroy"),{update:b,destroy:y}}o(Ea,"XYDrag");function yf(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let s of t.values())Qn(i,sn(s))>0&&r.push(s);return r}o(yf,"getNodesWithinDistance");var xf=250;function wf(e,t,n,r){let i=[],s=1/0,a=yf(e,n,t+xf);for(let l of a){let c=[...l.internals.handleBounds?.source??[],...l.internals.handleBounds?.target??[]];for(let u of c){if(r.nodeId===u.nodeId&&r.type===u.type&&r.id===u.id)continue;let{x:d,y:f}=St(l,u,u.position,!0),h=Math.sqrt(Math.pow(d-e.x,2)+Math.pow(f-e.y,2));h>t||(h<s?(i=[{...u,x:d,y:f}],s=h):h===s&&i.push({...u,x:d,y:f}))}}if(!i.length)return null;if(i.length>1){let l=r.type==="source"?"target":"source";return i.find(c=>c.type===l)??i[0]}return i[0]}o(wf,"getClosestHandle");function Ca(e,t,n,r,i,s=!1){let a=r.get(e);if(!a)return null;let l=i==="strict"?a.internals.handleBounds?.[t]:[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]],c=(n?l?.find(u=>u.id===n):l?.[0])??null;return c&&s?{...c,...St(a,c,c.position,!0)}:c}o(Ca,"getHandle");function _a(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}o(_a,"getHandleType");function bf(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}o(bf,"isConnectionValid");var Na=o(()=>!0,"alwaysValid");function vf(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:s,isTarget:a,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:d,flowId:f,panBy:h,cancelConnection:p,onConnectStart:m,onConnect:v,onConnectEnd:b,isValidConnection:y=Na,onReconnectEnd:E,updateConnection:g,getTransform:w,getFromHandle:M,autoPanSpeed:_,dragThreshold:P=1,handleDomNode:T}){let k=Ri(e.target),Y=0,z,{x:V,y:L}=He(e),x=_a(s,T),S=l?.getBoundingClientRect(),C=!1;if(!S||!x)return;let I=Ca(i,x,r,c,t);if(!I)return;let $=He(e,S),A=!1,B=null,F=!1,H=null;function U(){if(!d||!S)return;let[ee,G]=Ao($,S,_);h({x:ee,y:G}),Y=requestAnimationFrame(U)}o(U,"autoPan");let Z={...I,nodeId:i,type:x,position:I.position},W=c.get(i),K={inProgress:!0,isValid:null,from:St(W,Z,J.Left,!0),fromHandle:Z,fromPosition:Z.position,fromNode:W,to:$,toHandle:null,toPosition:Xs[Z.position],toNode:null,pointer:$};function R(){C=!0,g(K),m?.(e,{nodeId:i,handleId:r,handleType:x})}o(R,"startConnection"),P===0&&R();function X(ee){if(!C){let{x:ce,y:ve}=He(ee),he=ce-V,pe=ve-L;if(!(he*he+pe*pe>P*P))return;R()}if(!M()||!Z){te(ee);return}let G=w();$=He(ee,S),z=wf(ln($,G,!1,[1,1]),n,c,Z),A||(U(),A=!0);let q=Ia(ee,{handle:z,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:a?"target":"source",isValidConnection:y,doc:k,lib:u,flowId:f,nodeLookup:c});H=q.handleDomNode,B=q.connection,F=bf(!!z,q.isValid);let ne=c.get(i),oe=ne?St(ne,Z,J.Left,!0):K.from,se={...K,from:oe,isValid:F,to:q.toHandle&&F?zt({x:q.toHandle.x,y:q.toHandle.y},G):$,toHandle:q.toHandle,toPosition:F&&q.toHandle?q.toHandle.position:Xs[Z.position],toNode:q.toHandle?c.get(q.toHandle.nodeId):null,pointer:$};g(se),K=se}o(X,"onPointerMove");function te(ee){if(!("touches"in ee&&ee.touches.length>0)){if(C){(z||H)&&B&&F&&v?.(B);let{inProgress:G,...q}=K,ne={...q,toPosition:K.toHandle?K.toPosition:null};b?.(ee,ne),s&&E?.(ee,ne)}p(),cancelAnimationFrame(Y),A=!1,F=!1,B=null,H=null,k.removeEventListener("mousemove",X),k.removeEventListener("mouseup",te),k.removeEventListener("touchmove",X),k.removeEventListener("touchend",te)}}o(te,"onPointerUp"),k.addEventListener("mousemove",X),k.addEventListener("mouseup",te),k.addEventListener("touchmove",X),k.addEventListener("touchend",te)}o(vf,"onPointerDown");function Ia(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:s,doc:a,lib:l,flowId:c,isValidConnection:u=Na,nodeLookup:d}){let f=s==="target",h=t?a.querySelector(`.${l}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=He(e),v=a.elementFromPoint(p,m),b=v?.classList.contains(`${l}-flow__handle`)?v:h,y={handleDomNode:b,isValid:!1,connection:null,toHandle:null};if(b){let E=_a(void 0,b),g=b.getAttribute("data-nodeid"),w=b.getAttribute("data-handleid"),M=b.classList.contains("connectable"),_=b.classList.contains("connectableend");if(!g||!E)return y;let P={source:f?g:r,sourceHandle:f?w:i,target:f?r:g,targetHandle:f?i:w};y.connection=P;let k=M&&_&&(n===vt.Strict?f&&E==="source"||!f&&E==="target":g!==r||w!==i);y.isValid=k&&u(P),y.toHandle=Ca(g,E,w,d,n,!0)}return y}o(Ia,"isValidHandle");var Fo={onPointerDown:vf,isValid:Ia};function Ma({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=Ee(e);function s({translateExtent:l,width:c,height:u,zoomStep:d=1,pannable:f=!0,zoomable:h=!0,inversePan:p=!1}){let m=o(g=>{if(g.sourceEvent.type!=="wheel"||!t)return;let w=n(),M=g.sourceEvent.ctrlKey&&cn()?10:1,_=-g.sourceEvent.deltaY*(g.sourceEvent.deltaMode===1?.05:g.sourceEvent.deltaMode?1:.002)*d,P=w[2]*Math.pow(2,_*M);t.scaleTo(P)},"zoomHandler"),v=[0,0],b=o(g=>{(g.sourceEvent.type==="mousedown"||g.sourceEvent.type==="touchstart")&&(v=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY])},"panStartHandler"),y=o(g=>{let w=n();if(g.sourceEvent.type!=="mousemove"&&g.sourceEvent.type!=="touchmove"||!t)return;let M=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY],_=[M[0]-v[0],M[1]-v[1]];v=M;let P=r()*Math.max(w[2],Math.log(w[2]))*(p?-1:1),T={x:w[0]-_[0]*P,y:w[1]-_[1]*P},k=[[0,0],[c,u]];t.setViewportConstrained({x:T.x,y:T.y,zoom:w[2]},k,l)},"panHandler"),E=Un().on("start",b).on("zoom",f?y:null).on("zoom.wheel",h?m:null);i.call(E,{})}o(s,"update");function a(){i.on("zoom",null)}return o(a,"destroy"),{update:s,destroy:a,pointer:Me}}o(Ma,"XYMinimap");var Yo=o(e=>({x:e.x,y:e.y,zoom:e.k}),"transformToViewport"),vi=o(({x:e,y:t,zoom:n})=>At.translate(e,t).scale(n),"viewportToTransform"),en=o((e,t)=>e.target.closest(`.${t}`),"isWrappedWithClass"),Pa=o((e,t)=>t===2&&Array.isArray(e)&&e.includes(2),"isRightClickPan"),Sf=o(e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,"defaultEase"),Si=o((e,t=0,n=Sf,r=()=>{})=>{let i=typeof t=="number"&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on("end",r):e},"getD3Transition"),Ta=o(e=>{let t=e.ctrlKey&&cn()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},"wheelDelta");function Ef({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:s,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return d=>{if(en(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();let f=n.property("__zoom").k||1;if(d.ctrlKey&&a){let b=Me(d),y=Ta(d),E=f*Math.pow(2,y);r.scaleTo(n,E,b,d);return}let h=d.deltaMode===1?20:1,p=i===et.Vertical?0:d.deltaX*h,m=i===et.Horizontal?0:d.deltaY*h;!cn()&&d.shiftKey&&i!==et.Vertical&&(p=d.deltaY*h,m=0),r.translateBy(n,-(p/f)*s,-(m/f)*s,{internal:!0});let v=Yo(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c?.(d,v):(e.isPanScrolling=!0,l?.(d,v)),e.panScrollTimeout=setTimeout(()=>{u?.(d,v),e.isPanScrolling=!1},150)}}o(Ef,"createPanOnScrollHandler");function Cf({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let s=r.type==="wheel",a=!t&&s&&!r.ctrlKey,l=en(r,e);if(r.ctrlKey&&s&&l&&r.preventDefault(),a||l)return null;r.preventDefault(),n.call(this,r,i)}}o(Cf,"createZoomOnScrollHandler");function _f({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=Yo(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(r.sourceEvent,i)}}o(_f,"createPanZoomStartHandler");function Nf({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return s=>{e.usedRightMouseButton=!!(n&&Pa(t,e.mouseButton??0)),s.sourceEvent?.sync||r([s.transform.x,s.transform.y,s.transform.k]),i&&!s.sourceEvent?.internal&&i?.(s.sourceEvent,Yo(s.transform))}}o(Nf,"createPanZoomHandler");function If({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:s}){return a=>{if(!a.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,s&&Pa(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&s(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let l=Yo(a.transform);e.prevViewport=l,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(a.sourceEvent,l)},n?150:0)}}}o(If,"createPanZoomEndHandler");function Mf({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:s,userSelectionActive:a,noWheelClassName:l,noPanClassName:c,lib:u,connectionInProgress:d}){return f=>{let h=e||t,p=n&&f.ctrlKey,m=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(en(f,`${u}-flow__node`)||en(f,`${u}-flow__edge`)))return!0;if(!r&&!h&&!i&&!s&&!n||a||d&&!m||en(f,l)&&m||en(f,c)&&(!m||i&&m&&!e)||!n&&f.ctrlKey&&m)return!1;if(!n&&f.type==="touchstart"&&f.touches?.length>1)return f.preventDefault(),!1;if(!h&&!i&&!p&&m||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;let v=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||m)&&v}}o(Mf,"createFilter");function ka({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:s,onPanZoomStart:a,onPanZoomEnd:l,onDraggingChange:c}){let u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),f=[[0,0],[d.width,d.height]];(typeof ResizeObserver<"u"?new ResizeObserver(L=>{let x=L[0];x&&(f=[[0,0],[x.contentRect.width,x.contentRect.height]])}):null)?.observe(e);let p=Un().extent(()=>f).scaleExtent([t,n]).translateExtent(r),m=Ee(e).call(p);w({x:i.x,y:i.y,zoom:nn(i.zoom,t,n)},[[0,0],[d.width,d.height]],r);let v=m.on("wheel.zoom"),b=m.on("dblclick.zoom");p.wheelDelta(Ta);async function y(L,x){return m?new Promise(S=>{p?.interpolate(x?.interpolate==="linear"?uo:Ut).transform(Si(m,x?.duration,x?.ease,()=>S(!0)),L)}):!1}o(y,"setTransform");function E({noWheelClassName:L,noPanClassName:x,onPaneContextMenu:S,userSelectionActive:C,panOnScroll:I,panOnDrag:$,panOnScrollMode:A,panOnScrollSpeed:B,preventScrolling:F,zoomOnPinch:H,zoomOnScroll:U,zoomOnDoubleClick:Z,zoomActivationKeyPressed:W,lib:j,onTransformChange:K,connectionInProgress:R,paneClickDistance:X,selectionOnDrag:te}){C&&!u.isZoomingOrPanning&&g();let ee=I&&!W&&!C;p.clickDistance(te?1/0:!Le(X)||X<0?0:X);let G=ee?Ef({zoomPanValues:u,noWheelClassName:L,d3Selection:m,d3Zoom:p,panOnScrollMode:A,panOnScrollSpeed:B,zoomOnPinch:H,onPanZoomStart:a,onPanZoom:s,onPanZoomEnd:l}):Cf({noWheelClassName:L,preventScrolling:F,d3ZoomHandler:v});m.on("wheel.zoom",G,{passive:!1});let q=_f({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:a});p.on("start",q);let ne=Nf({zoomPanValues:u,panOnDrag:$,onPaneContextMenu:!!S,onPanZoom:s,onTransformChange:K});p.on("zoom",ne);let oe=If({zoomPanValues:u,panOnDrag:$,panOnScroll:I,onPaneContextMenu:S,onPanZoomEnd:l,onDraggingChange:c});p.on("end",oe);let se=Mf({zoomActivationKeyPressed:W,panOnDrag:$,zoomOnScroll:U,panOnScroll:I,zoomOnDoubleClick:Z,zoomOnPinch:H,userSelectionActive:C,noPanClassName:x,noWheelClassName:L,lib:j,connectionInProgress:R});p.filter(se),Z?m.on("dblclick.zoom",b):m.on("dblclick.zoom",null)}o(E,"update");function g(){p.on("zoom",null)}o(g,"destroy");async function w(L,x,S){let C=vi(L),I=p?.constrain()(C,x,S);return I&&await y(I),I}o(w,"setViewportConstrained");async function M(L,x){let S=vi(L);return await y(S,x),S}o(M,"setViewport");function _(L){if(m){let x=vi(L),S=m.property("__zoom");(S.k!==L.zoom||S.x!==L.x||S.y!==L.y)&&p?.transform(m,x,null,{sync:!0})}}o(_,"syncViewport");function P(){let L=m?Zn(m.node()):{x:0,y:0,k:1};return{x:L.x,y:L.y,zoom:L.k}}o(P,"getViewport");async function T(L,x){return m?new Promise(S=>{p?.interpolate(x?.interpolate==="linear"?uo:Ut).scaleTo(Si(m,x?.duration,x?.ease,()=>S(!0)),L)}):!1}o(T,"scaleTo");async function k(L,x){return m?new Promise(S=>{p?.interpolate(x?.interpolate==="linear"?uo:Ut).scaleBy(Si(m,x?.duration,x?.ease,()=>S(!0)),L)}):!1}o(k,"scaleBy");function Y(L){p?.scaleExtent(L)}o(Y,"setScaleExtent");function z(L){p?.translateExtent(L)}o(z,"setTranslateExtent");function V(L){let x=!Le(L)||L<0?0:L;p?.clickDistance(x)}return o(V,"setClickDistance"),{update:E,destroy:g,setViewport:M,setViewportConstrained:w,getViewport:P,scaleTo:T,scaleBy:k,setScaleExtent:Y,setTranslateExtent:z,syncViewport:_,setClickDistance:V}}o(ka,"XYPanZoom");var Et;(function(e){e.Line="line",e.Handle="handle"})(Et||(Et={}));function Pf({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:s}){let a=e-t,l=n-r,c=[a>0?1:a<0?-1:0,l>0?1:l<0?-1:0];return a&&i&&(c[0]=c[0]*-1),l&&s&&(c[1]=c[1]*-1),c}o(Pf,"getResizeDirection");function na(e){let t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),i=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:i}}o(na,"getControlDirection");function wt(e,t){return Math.max(0,t-e)}o(wt,"getLowerExtentClamp");function bt(e,t){return Math.max(0,e-t)}o(bt,"getUpperExtentClamp");function Po(e,t,n){return Math.max(0,t-e,e-n)}o(Po,"getSizeClamp");function oa(e,t){return e?!t:t}o(oa,"xor");function Tf(e,t,n,r,i,s,a,l){let{affectsX:c,affectsY:u}=t,{isHorizontal:d,isVertical:f}=t,h=d&&f,{xSnapped:p,ySnapped:m}=n,{minWidth:v,maxWidth:b,minHeight:y,maxHeight:E}=r,{x:g,y:w,width:M,height:_,aspectRatio:P}=e,T=Math.floor(d?p-e.pointerX:0),k=Math.floor(f?m-e.pointerY:0),Y=M+(c?-T:T),z=_+(u?-k:k),V=-s[0]*M,L=-s[1]*_,x=Po(Y,v,b),S=Po(z,y,E);if(a){let $=0,A=0;c&&T<0?$=wt(g+T+V,a[0][0]):!c&&T>0&&($=bt(g+Y+V,a[1][0])),u&&k<0?A=wt(w+k+L,a[0][1]):!u&&k>0&&(A=bt(w+z+L,a[1][1])),x=Math.max(x,$),S=Math.max(S,A)}if(l){let $=0,A=0;c&&T>0?$=bt(g+T,l[0][0]):!c&&T<0&&($=wt(g+Y,l[1][0])),u&&k>0?A=bt(w+k,l[0][1]):!u&&k<0&&(A=wt(w+z,l[1][1])),x=Math.max(x,$),S=Math.max(S,A)}if(i){if(d){let $=Po(Y/P,y,E)*P;if(x=Math.max(x,$),a){let A=0;!c&&!u||c&&!u&&h?A=bt(w+L+Y/P,a[1][1])*P:A=wt(w+L+(c?T:-T)/P,a[0][1])*P,x=Math.max(x,A)}if(l){let A=0;!c&&!u||c&&!u&&h?A=wt(w+Y/P,l[1][1])*P:A=bt(w+(c?T:-T)/P,l[0][1])*P,x=Math.max(x,A)}}if(f){let $=Po(z*P,v,b)/P;if(S=Math.max(S,$),a){let A=0;!c&&!u||u&&!c&&h?A=bt(g+z*P+V,a[1][0])/P:A=wt(g+(u?k:-k)*P+V,a[0][0])/P,S=Math.max(S,A)}if(l){let A=0;!c&&!u||u&&!c&&h?A=wt(g+z*P,l[1][0])/P:A=bt(g+(u?k:-k)*P,l[0][0])/P,S=Math.max(S,A)}}}k=k+(k<0?S:-S),T=T+(T<0?x:-x),i&&(h?Y>z*P?k=(oa(c,u)?-T:T)/P:T=(oa(c,u)?-k:k)*P:d?(k=T/P,u=c):(T=k*P,c=u));let C=c?g+T:g,I=u?w+k:w;return{width:M+(c?-T:T),height:_+(u?-k:k),x:s[0]*T*(c?-1:1)+C,y:s[1]*k*(u?-1:1)+I}}o(Tf,"getDimensionsAfterResize");var Aa={width:0,height:0,x:0,y:0},kf={...Aa,pointerX:0,pointerY:0,aspectRatio:1};function Af(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,s=e.measured.width??0,a=e.measured.height??0,l=n[0]*s,c=n[1]*a;return[[r-l,i-c],[r+s-l,i+a-c]]}o(Af,"nodeToChildExtent");function Da({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let s=Ee(e),a={controlDirection:na("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:u,boundaries:d,keepAspectRatio:f,resizeDirection:h,onResizeStart:p,onResize:m,onResizeEnd:v,shouldResize:b}){let y={...Aa},E={...kf};a={boundaries:d,resizeDirection:h,keepAspectRatio:f,controlDirection:na(u)};let g,w=null,M=[],_,P,T,k=!1,Y=On().on("start",z=>{let{nodeLookup:V,transform:L,snapGrid:x,snapToGrid:S,nodeOrigin:C,paneDomNode:I}=n();if(g=V.get(t),!g)return;w=I?.getBoundingClientRect()??null;let{xSnapped:$,ySnapped:A}=Gn(z.sourceEvent,{transform:L,snapGrid:x,snapToGrid:S,containerBounds:w});y={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},E={...y,pointerX:$,pointerY:A,aspectRatio:y.width/y.height},_=void 0,P=Rt(g.extent)?g.extent:void 0,g.parentId&&(g.extent==="parent"||g.expandParent)&&(_=V.get(g.parentId)),_&&g.extent==="parent"&&(P=[[0,0],[_.measured.width,_.measured.height]]),M=[],T=void 0;for(let[B,F]of V)if(F.parentId===t&&(M.push({id:B,position:{...F.position},extent:F.extent}),F.extent==="parent"||F.expandParent)){let H=Af(F,g,F.origin??C);T?T=[[Math.min(H[0][0],T[0][0]),Math.min(H[0][1],T[0][1])],[Math.max(H[1][0],T[1][0]),Math.max(H[1][1],T[1][1])]]:T=H}p?.(z,{...y})}).on("drag",z=>{let{transform:V,snapGrid:L,snapToGrid:x,nodeOrigin:S}=n(),C=Gn(z.sourceEvent,{transform:V,snapGrid:L,snapToGrid:x,containerBounds:w}),I=[];if(!g)return;let{x:$,y:A,width:B,height:F}=y,H={},U=g.origin??S,{width:Z,height:W,x:j,y:K}=Tf(E,a.controlDirection,C,a.boundaries,a.keepAspectRatio,U,P,T),R=Z!==B,X=W!==F,te=j!==$&&R,ee=K!==A&&X;if(!te&&!ee&&!R&&!X)return;if((te||ee||U[0]===1||U[1]===1)&&(H.x=te?j:y.x,H.y=ee?K:y.y,y.x=H.x,y.y=H.y,M.length>0)){let oe=j-$,se=K-A;for(let ce of M)ce.position={x:ce.position.x-oe+U[0]*(Z-B),y:ce.position.y-se+U[1]*(W-F)},I.push(ce)}if((R||X)&&(H.width=R&&(!a.resizeDirection||a.resizeDirection==="horizontal")?Z:y.width,H.height=X&&(!a.resizeDirection||a.resizeDirection==="vertical")?W:y.height,y.width=H.width,y.height=H.height),_&&g.expandParent){let oe=U[0]*(H.width??0);H.x&&H.x<oe&&(y.x=oe,E.x=E.x-(H.x-oe));let se=U[1]*(H.height??0);H.y&&H.y<se&&(y.y=se,E.y=E.y-(H.y-se))}let G=Pf({width:y.width,prevWidth:B,height:y.height,prevHeight:F,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),q={...y,direction:G};b?.(z,q)!==!1&&(k=!0,m?.(z,q),r(H,I))}).on("end",z=>{k&&(v?.(z,{...y}),i?.({...y}),k=!1)});s.call(Y)}o(l,"update");function c(){s.on(".drag",null)}return o(c,"destroy"),{update:l,destroy:c}}o(Da,"XYResizer");var Ra=mt(ar(),1),La=mt(ru(),1);var Oa=o(e=>{let t,n=new Set,r=o((d,f)=>{let h=typeof d=="function"?d(t):d;if(!Object.is(h,t)){let p=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(m=>m(t,p))}},"setState"),i=o(()=>t,"getState"),c={setState:r,getState:i,getInitialState:o(()=>u,"getInitialState"),subscribe:o(d=>(n.add(d),()=>n.delete(d)),"subscribe"),destroy:o(()=>{(import.meta.env?import.meta.env.MODE:void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()},"destroy")},u=t=e(r,i,c);return c},"createStoreImpl"),$a=o(e=>e?Oa(e):Oa,"createStore");var{useDebugValue:Df}=Ra.default,{useSyncExternalStoreWithSelector:Of}=La.default,$f=o(e=>e,"identity");function Zi(e,t=$f,n){let r=Of(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Df(r),r}o(Zi,"useStoreWithEqualityFn");var za=o((e,t)=>{let n=$a(e),r=o((i,s=t)=>Zi(n,i,s),"useBoundStoreWithEqualityFn");return Object.assign(r,n),r},"createWithEqualityFnImpl"),Ha=o((e,t)=>e?za(e,t):za,"createWithEqualityFn");function ue(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[r,i]of e)if(!Object.is(i,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let r of e)if(!t.has(r))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}o(ue,"shallow$1");var zf=mt(eu());var Uo=(0,D.createContext)(null),Rf=Uo.Provider,fl=De.error001("react");function ie(e,t){let n=(0,D.useContext)(Uo);if(n===null)throw new Error(fl);return Zi(n,e,t)}o(ie,"useStore");function de(){let e=(0,D.useContext)(Uo);if(e===null)throw new Error(fl);return(0,D.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}o(de,"useStoreApi");var Ba={display:"none"},Lf={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},hl="react-flow__node-desc",pl="react-flow__edge-desc",Hf="react-flow__aria-live",Bf=o(e=>e.ariaLiveMessage,"ariaLiveSelector"),Vf=o(e=>e.ariaLabelConfig,"ariaLabelConfigSelector");function Ff({rfId:e}){let t=ie(Bf);return(0,O.jsx)("div",{id:`${Hf}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Lf,children:t})}o(Ff,"AriaLiveMessage");function Yf({rfId:e,disableKeyboardA11y:t}){let n=ie(Vf);return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)("div",{id:`${hl}-${e}`,style:Ba,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),(0,O.jsx)("div",{id:`${pl}-${e}`,style:Ba,children:n["edge.a11yDescription.default"]}),!t&&(0,O.jsx)(Ff,{rfId:e})]})}o(Yf,"A11yDescriptions");var _t=(0,D.forwardRef)(({position:e="top-left",children:t,className:n,style:r,...i},s)=>{let a=`${e}`.split("-");return(0,O.jsx)("div",{className:ge(["react-flow__panel",n,...a]),style:r,ref:s,...i,children:t})});_t.displayName="Panel";var Va="https://reactflow.dev/attribution";function Wf({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:(0,O.jsx)(_t,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${Va}`,children:(0,O.jsx)("a",{href:Va,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}o(Wf,"Attribution");var Xf=o(e=>{let t=[],n=[];for(let[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(let[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},"selector$l"),Wo=o(e=>e.id,"selectId");function Zf(e,t){return ue(e.selectedNodes.map(Wo),t.selectedNodes.map(Wo))&&ue(e.selectedEdges.map(Wo),t.selectedEdges.map(Wo))}o(Zf,"areEqual$1");function Uf({onSelectionChange:e}){let t=de(),{selectedNodes:n,selectedEdges:r}=ie(Xf,Zf);return(0,D.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(s=>s(i))},[n,r,e]),null}o(Uf,"SelectionListenerInner");var Gf=o(e=>!!e.onSelectionChangeHandlers,"changeSelector");function qf({onSelectionChange:e}){let t=ie(Gf);return e||t?(0,O.jsx)(Uf,{onSelectionChange:e}):null}o(qf,"SelectionListener");var ml=[0,0],Kf={x:0,y:0,zoom:1},Qf=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],Fa=[...Qf,"rfId"],Jf=o(e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),"selector$k"),Ya={translateExtent:on,nodeOrigin:ml,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function jf(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:s,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:c}=ie(Jf,ue),u=de();(0,D.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=Ya,l()}),[]);let d=(0,D.useRef)(Ya);return(0,D.useEffect)(()=>{for(let f of Fa){let h=e[f],p=d.current[f];h!==p&&(typeof e[f]>"u"||(f==="nodes"?t(h):f==="edges"?n(h):f==="minZoom"?r(h):f==="maxZoom"?i(h):f==="translateExtent"?s(h):f==="nodeExtent"?a(h):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:da(h)}):f==="fitView"?u.setState({fitViewQueued:h}):f==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[f]:h})))}d.current=e},Fa.map(f=>e[f])),null}o(jf,"StoreUpdater");function Wa(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}o(Wa,"getMediaQuery");function eh(e){let[t,n]=(0,D.useState)(e==="system"?null:e);return(0,D.useEffect)(()=>{if(e!=="system"){n(e);return}let r=Wa(),i=o(()=>n(r?.matches?"dark":"light"),"updateColorModeClass");return i(),r?.addEventListener("change",i),()=>{r?.removeEventListener("change",i)}},[e]),t!==null?t:Wa()?.matches?"dark":"light"}o(eh,"useColorModeClass");var Xa=typeof document<"u"?document:null;function jn(e=null,t={target:Xa,actInsideInputWithModifier:!0}){let[n,r]=(0,D.useState)(!1),i=(0,D.useRef)(!1),s=(0,D.useRef)(new Set([])),[a,l]=(0,D.useMemo)(()=>{if(e!==null){let u=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",`
2
2
  `).replace(`
3
3
 
4
4
  `,`
@@ -1 +1 @@
1
- import{d as n}from"./chunk-2GMEK2W3.js";import{a as l,e as a,g as u,h as d}from"./chunk-RRCPZMC2.js";var c=a(u(),1);var v=a(d(),1);var x=l(f=>{let e=(0,c.c)(6),{message:r,prefix:m}=f,o=n();if(r===void 0)return null;let i=`${m}-live-error`,t;e[0]!==r||e[1]!==o?(t=o("Live unavailable: {liveError}",{liveError:r}),e[0]=r,e[1]=o,e[2]=t):t=e[2];let s;return e[3]!==i||e[4]!==t?(s=(0,v.jsxDEV)("span",{className:"text-xs text-destructive","data-testid":i,role:"status",children:t},void 0,!1),e[3]=i,e[4]=t,e[5]=s):s=e[5],s},"LiveError");export{x as a};
1
+ import{d as n}from"./chunk-ITQKVEP7.js";import{a as l,e as a,g as u,h as d}from"./chunk-RRCPZMC2.js";var c=a(u(),1);var v=a(d(),1);var x=l(f=>{let e=(0,c.c)(6),{message:r,prefix:m}=f,o=n();if(r===void 0)return null;let i=`${m}-live-error`,t;e[0]!==r||e[1]!==o?(t=o("Live unavailable: {liveError}",{liveError:r}),e[0]=r,e[1]=o,e[2]=t):t=e[2];let s;return e[3]!==i||e[4]!==t?(s=(0,v.jsxDEV)("span",{className:"text-xs text-destructive","data-testid":i,role:"status",children:t},void 0,!1),e[3]=i,e[4]=t,e[5]=s):s=e[5],s},"LiveError");export{x as a};
@@ -1 +1 @@
1
- import{a as R}from"./chunk-WKWKAU22.js";import{a as w,b as O,c as D,d as C,e as v,f as h}from"./chunk-GTM65MVX.js";import{a as L}from"./chunk-BOXSWNXZ.js";import{a as S}from"./chunk-TAD43CG5.js";import{b as _}from"./chunk-EOSXQTSQ.js";import{a as A,e as I}from"./chunk-SEU5V7I6.js";import{b as E}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-M5OMEMQ3.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as b}from"./chunk-2GMEK2W3.js";import"./chunk-J75M4LTW.js";import{a as u,e as T,f as M,g as P,h as V}from"./chunk-RRCPZMC2.js";var B=T(P(),1),K=T(M(),1);var t=T(V(),1);var k="container:",F={error:"error",sleep:"sleeping",start:"running",stop:"stopped"},H=u(e=>{let r=e.indexOf(":");if(r===-1)return{event:e.trim()};let a=e.slice(r+1).trim(),s=e.slice(0,r).trim();return a===""?{event:s}:{detail:a,event:s}},"parseContainerMessage"),W=u(e=>{let r=new Map;for(let a of e){let s=a.functionPath??"";if(!s.startsWith(k))continue;let n=s.slice(k.length);if(n==="")continue;let i=r.get(n);if(i!==void 0&&i.timestamp>=a.timestamp)continue;let{detail:x,event:o}=H(a.message);r.set(n,{detail:x,event:o,level:a.level,name:n,state:F[o]??"unknown",timestamp:a.timestamp})}return[...r.values()].toSorted((a,s)=>a.name.localeCompare(s.name))},"foldContainerInstances"),$={error:"destructive",running:"success",sleeping:"info",stopped:"outline",unknown:"secondary"},j=u(e=>{let{entries:r}=e??{};return Array.isArray(r)?r:[]},"entriesOf"),ee=u(()=>{let e=(0,B.c)(23),r=b(),a,s;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},s={live:!0,shardKey:""},e[0]=a,e[1]=s):(a=e[0],s=e[1]);let{data:n,error:i,liveError:x}=_(L.getLogs,a,s),o=n!==void 0,N;e[2]!==n?(N=W(j(n)),e[2]=n,e[3]=N):N=e[3];let g=N,l;e[4]!==i?(l=i!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"containers-error",role:"alert",children:i},void 0,!1),e[4]=i,e[5]=l):l=e[5];let c;e[6]!==r?(c=r("Cloudflare Containers are observed from their lifecycle log stream. This shows the current state per container \u2014 ports and health checks aren't carried in that stream."),e[6]=r,e[7]=c):c=e[7];let d;e[8]!==c?(d=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:c},void 0,!1),e[8]=c,e[9]=d):d=e[9];let m;e[10]!==x?(m=(0,t.jsxDEV)(R,{message:x,prefix:"containers"},void 0,!1),e[10]=x,e[11]=m):m=e[11];let f;e[12]!==d||e[13]!==m?(f=(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[d,m]},void 0,!0),e[12]=d,e[13]=m,e[14]=f):f=e[14];let p;e[15]!==o||e[16]!==g||e[17]!==r?(p=o&&g.length===0?(0,t.jsxDEV)(S,{description:r("No container lifecycle activity yet. Instances declared with defineContainer show up here once they start, sleep, stop, or error."),testId:"containers-empty",title:r("No container activity")},void 0,!1):(0,t.jsxDEV)(A,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(I,{className:"px-0",children:(0,t.jsxDEV)(w,{"data-testid":"containers-table",children:[(0,t.jsxDEV)(O,{children:(0,t.jsxDEV)(C,{children:[(0,t.jsxDEV)(v,{children:r("Container")},void 0,!1),(0,t.jsxDEV)(v,{children:r("State")},void 0,!1),(0,t.jsxDEV)(v,{children:r("Last event")},void 0,!1),(0,t.jsxDEV)(v,{children:r("Detail")},void 0,!1),(0,t.jsxDEV)(v,{children:r("When")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(D,{children:g.map(G)},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[15]=o,e[16]=g,e[17]=r,e[18]=p):p=e[18];let y;return e[19]!==l||e[20]!==f||e[21]!==p?(y=(0,t.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-containers-panel",children:[l,f,p]},void 0,!0),e[19]=l,e[20]=f,e[21]=p,e[22]=y):y=e[22],y},"ContainersPanel");function G(e){return(0,t.jsxDEV)(C,{"data-testid":`containers-row-${e.name}`,children:[(0,t.jsxDEV)(h,{className:"font-mono text-xs",children:e.name},void 0,!1),(0,t.jsxDEV)(h,{children:(0,t.jsxDEV)(E,{variant:$[e.state],children:e.state},void 0,!1)},void 0,!1),(0,t.jsxDEV)(h,{className:"font-mono text-xs text-muted-foreground",children:e.event},void 0,!1),(0,t.jsxDEV)(h,{className:"max-w-64 truncate text-xs text-muted-foreground",title:e.detail,children:e.detail??"\u2014"},void 0,!1),(0,t.jsxDEV)(h,{className:"text-xs tabular-nums text-muted-foreground",children:new Date(e.timestamp).toLocaleString()},void 0,!1)]},e.name,!0)}u(G,"_temp");export{ee as ContainersPanel};
1
+ import{a as R}from"./chunk-AITOCPML.js";import{a as w,b as O,c as D,d as C,e as v,f as h}from"./chunk-GTM65MVX.js";import{a as L}from"./chunk-BOXSWNXZ.js";import{a as S}from"./chunk-TAD43CG5.js";import{b as _}from"./chunk-HVRDZZHL.js";import{a as A,e as I}from"./chunk-SEU5V7I6.js";import{b as E}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-LRYLU6EY.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as b}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as u,e as T,f as M,g as P,h as V}from"./chunk-RRCPZMC2.js";var B=T(P(),1),K=T(M(),1);var t=T(V(),1);var k="container:",F={error:"error",sleep:"sleeping",start:"running",stop:"stopped"},H=u(e=>{let r=e.indexOf(":");if(r===-1)return{event:e.trim()};let a=e.slice(r+1).trim(),s=e.slice(0,r).trim();return a===""?{event:s}:{detail:a,event:s}},"parseContainerMessage"),W=u(e=>{let r=new Map;for(let a of e){let s=a.functionPath??"";if(!s.startsWith(k))continue;let n=s.slice(k.length);if(n==="")continue;let i=r.get(n);if(i!==void 0&&i.timestamp>=a.timestamp)continue;let{detail:x,event:o}=H(a.message);r.set(n,{detail:x,event:o,level:a.level,name:n,state:F[o]??"unknown",timestamp:a.timestamp})}return[...r.values()].toSorted((a,s)=>a.name.localeCompare(s.name))},"foldContainerInstances"),$={error:"destructive",running:"success",sleeping:"info",stopped:"outline",unknown:"secondary"},j=u(e=>{let{entries:r}=e??{};return Array.isArray(r)?r:[]},"entriesOf"),ee=u(()=>{let e=(0,B.c)(23),r=b(),a,s;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},s={live:!0,shardKey:""},e[0]=a,e[1]=s):(a=e[0],s=e[1]);let{data:n,error:i,liveError:x}=_(L.getLogs,a,s),o=n!==void 0,N;e[2]!==n?(N=W(j(n)),e[2]=n,e[3]=N):N=e[3];let g=N,l;e[4]!==i?(l=i!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"containers-error",role:"alert",children:i},void 0,!1),e[4]=i,e[5]=l):l=e[5];let c;e[6]!==r?(c=r("Cloudflare Containers are observed from their lifecycle log stream. This shows the current state per container \u2014 ports and health checks aren't carried in that stream."),e[6]=r,e[7]=c):c=e[7];let d;e[8]!==c?(d=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:c},void 0,!1),e[8]=c,e[9]=d):d=e[9];let m;e[10]!==x?(m=(0,t.jsxDEV)(R,{message:x,prefix:"containers"},void 0,!1),e[10]=x,e[11]=m):m=e[11];let f;e[12]!==d||e[13]!==m?(f=(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[d,m]},void 0,!0),e[12]=d,e[13]=m,e[14]=f):f=e[14];let p;e[15]!==o||e[16]!==g||e[17]!==r?(p=o&&g.length===0?(0,t.jsxDEV)(S,{description:r("No container lifecycle activity yet. Instances declared with defineContainer show up here once they start, sleep, stop, or error."),testId:"containers-empty",title:r("No container activity")},void 0,!1):(0,t.jsxDEV)(A,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(I,{className:"px-0",children:(0,t.jsxDEV)(w,{"data-testid":"containers-table",children:[(0,t.jsxDEV)(O,{children:(0,t.jsxDEV)(C,{children:[(0,t.jsxDEV)(v,{children:r("Container")},void 0,!1),(0,t.jsxDEV)(v,{children:r("State")},void 0,!1),(0,t.jsxDEV)(v,{children:r("Last event")},void 0,!1),(0,t.jsxDEV)(v,{children:r("Detail")},void 0,!1),(0,t.jsxDEV)(v,{children:r("When")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(D,{children:g.map(G)},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[15]=o,e[16]=g,e[17]=r,e[18]=p):p=e[18];let y;return e[19]!==l||e[20]!==f||e[21]!==p?(y=(0,t.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-containers-panel",children:[l,f,p]},void 0,!0),e[19]=l,e[20]=f,e[21]=p,e[22]=y):y=e[22],y},"ContainersPanel");function G(e){return(0,t.jsxDEV)(C,{"data-testid":`containers-row-${e.name}`,children:[(0,t.jsxDEV)(h,{className:"font-mono text-xs",children:e.name},void 0,!1),(0,t.jsxDEV)(h,{children:(0,t.jsxDEV)(E,{variant:$[e.state],children:e.state},void 0,!1)},void 0,!1),(0,t.jsxDEV)(h,{className:"font-mono text-xs text-muted-foreground",children:e.event},void 0,!1),(0,t.jsxDEV)(h,{className:"max-w-64 truncate text-xs text-muted-foreground",title:e.detail,children:e.detail??"\u2014"},void 0,!1),(0,t.jsxDEV)(h,{className:"text-xs tabular-nums text-muted-foreground",children:new Date(e.timestamp).toLocaleString()},void 0,!1)]},e.name,!0)}u(G,"_temp");export{ee as ContainersPanel};