@duckcodeailabs/dql-cli 1.12.11 → 1.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/dist/apps-api.d.ts +151 -3
  2. package/dist/apps-api.d.ts.map +1 -1
  3. package/dist/apps-api.js +675 -97
  4. package/dist/apps-api.js.map +1 -1
  5. package/dist/args.d.ts +2 -0
  6. package/dist/args.d.ts.map +1 -1
  7. package/dist/args.js +3 -0
  8. package/dist/args.js.map +1 -1
  9. package/dist/assets/dql-notebook/assets/AgentAnswerCard-c8QUo6NH.js +5 -0
  10. package/dist/assets/dql-notebook/assets/{AgentLogPage-hzHqpD3-.js → AgentLogPage-D6fgEAEy.js} +1 -1
  11. package/dist/assets/dql-notebook/assets/{AiBuildDialog-BQRWoxp9.js → AiBuildDialog-8miXFPse.js} +1 -1
  12. package/dist/assets/dql-notebook/assets/{AiBuildResult-D9t_4sQl.js → AiBuildResult-DPJ_SI0R.js} +3 -3
  13. package/dist/assets/dql-notebook/assets/AiSidePanel-NVA6lZnn.js +6 -0
  14. package/dist/assets/dql-notebook/assets/AnalyticsHome-DgwnRW71.js +6 -0
  15. package/dist/assets/dql-notebook/assets/AppsView-B6LYUpgm.js +4578 -0
  16. package/dist/assets/dql-notebook/assets/BlockStudio--jNw9XUI.js +60 -0
  17. package/dist/assets/dql-notebook/assets/{BusinessArtifactView-CnTbFVGT.js → BusinessArtifactView-DtRMiaF4.js} +1 -1
  18. package/dist/assets/dql-notebook/assets/DbtFirstModelingPage-DhBsLCYr.js +22 -0
  19. package/dist/assets/dql-notebook/assets/GitPage-CazC-eTR.js +7 -0
  20. package/dist/assets/dql-notebook/assets/GlobalAiRail-1Tgweuu2.js +1 -0
  21. package/dist/assets/dql-notebook/assets/GovernedContextPage-C7qGrH3d.js +16 -0
  22. package/dist/assets/dql-notebook/assets/{HelpDocsPage-CL0vbSER.js → HelpDocsPage-DMHPsVqP.js} +1 -1
  23. package/dist/assets/dql-notebook/assets/{HomePage-DzAucwBW.js → HomePage-DcSI4dnU.js} +1 -1
  24. package/dist/assets/dql-notebook/assets/LineageDAG-BJ6xz06u.js +1 -0
  25. package/dist/assets/dql-notebook/assets/{LineageDetailView-DdVH-nz6.js → LineageDetailView-8WrQm-MF.js} +1 -1
  26. package/dist/assets/dql-notebook/assets/{LineageDrawer-BvrVZNKY.js → LineageDrawer-hnqCW_t-.js} +1 -1
  27. package/dist/assets/dql-notebook/assets/{LineagePathBreadcrumb-CSut-zvm.js → LineagePathBreadcrumb-B4LZTUsl.js} +3 -3
  28. package/dist/assets/dql-notebook/assets/{MiniLineageGraph-zg_1wW3M.js → MiniLineageGraph-CotnRuxa.js} +1 -1
  29. package/dist/assets/dql-notebook/assets/{NewBlockModal-9cDletl-.js → NewBlockModal-DHn-CEEW.js} +1 -1
  30. package/dist/assets/dql-notebook/assets/{NewNotebookModal-V6de8L4d.js → NewNotebookModal-BPGp-8oq.js} +2 -2
  31. package/dist/assets/dql-notebook/assets/NotebookEditor-B0OTHM6W.js +195 -0
  32. package/dist/assets/dql-notebook/assets/ReadinessPage-CoOIpxWq.js +1 -0
  33. package/dist/assets/dql-notebook/assets/{SetupOnboarding-Bg-MjbC9.js → SetupOnboarding-DxK_mFzf.js} +2 -2
  34. package/dist/assets/dql-notebook/assets/{TrustBadge-DGuHB8kP.js → TrustBadge-ZuD5N5Ww.js} +1 -1
  35. package/dist/assets/dql-notebook/assets/UnifiedAgentRunPanel-duFXXNV_.js +88 -0
  36. package/dist/assets/dql-notebook/assets/{answer-to-notebook-BDzY4MuQ.js → answer-to-notebook-WAVAYjBv.js} +1 -1
  37. package/dist/assets/dql-notebook/assets/{arrow-left-IjlnAihE.js → arrow-left-L8odLbyN.js} +1 -1
  38. package/dist/assets/dql-notebook/assets/{arrow-right-BI4cXgOY.js → arrow-right-WIF1V9a9.js} +1 -1
  39. package/dist/assets/dql-notebook/assets/{book-open-text-i6xhxu_I.js → book-open-text-BpqWMa4m.js} +1 -1
  40. package/dist/assets/dql-notebook/assets/{bot-C6DE7Q6m.js → bot-CLR1V6dO.js} +1 -1
  41. package/dist/assets/dql-notebook/assets/{circle-x-BoAorVSm.js → circle-x-CQBOM0b0.js} +1 -1
  42. package/dist/assets/dql-notebook/assets/{dagre.esm-CycymVj6.js → dagre.esm-DlZi7NR3.js} +1 -1
  43. package/dist/assets/dql-notebook/assets/{external-link-ZwE5iHsX.js → external-link-DYqdQIGp.js} +1 -1
  44. package/dist/assets/dql-notebook/assets/{grip-vertical-Dnp2st8l.js → grip-vertical-HmUijbwN.js} +1 -1
  45. package/dist/assets/dql-notebook/assets/index-Cpx47jCH.js +634 -0
  46. package/dist/assets/dql-notebook/assets/{list-tree-Ced8e_S1.js → list-tree-DGKqCxmz.js} +1 -1
  47. package/dist/assets/dql-notebook/assets/{minimize-2-CBIAE0XH.js → minimize-2-C8dvqCxX.js} +1 -1
  48. package/dist/assets/dql-notebook/assets/{panel-right-open-po3bWSeL.js → panel-right-open-yuVkIo5n.js} +1 -1
  49. package/dist/assets/dql-notebook/assets/{rotate-ccw-B9v1LTJ0.js → rotate-ccw-Di0kRnrM.js} +1 -1
  50. package/dist/assets/dql-notebook/assets/{semantic-fields-B6ii0an0.js → semantic-fields-BMQV0li8.js} +1 -1
  51. package/dist/assets/dql-notebook/assets/sliders-horizontal-alebptlJ.js +6 -0
  52. package/dist/assets/dql-notebook/assets/{star-CO4tfaDq.js → star-CgCQbnXc.js} +1 -1
  53. package/dist/assets/dql-notebook/assets/{triangle-alert-BSdIu2El.js → triangle-alert-SyuSZ4ht.js} +1 -1
  54. package/dist/assets/dql-notebook/assets/upload-BPhfea_E.js +11 -0
  55. package/dist/assets/dql-notebook/assets/usePersistedAgentThreadId-Bnl9gWhj.js +28 -0
  56. package/dist/assets/dql-notebook/assets/{user-round-BfrV8U-W.js → user-round-J4PQHxo9.js} +1 -1
  57. package/dist/assets/dql-notebook/assets/{wand-sparkles-BgTxZNBc.js → wand-sparkles-c4WDXTCk.js} +1 -1
  58. package/dist/assets/dql-notebook/assets/{workflow--2ycp0yy.js → workflow-NtRLaq7n.js} +1 -1
  59. package/dist/assets/dql-notebook/assets/{wrench-LMCrpa9_.js → wrench-CS1f1Zv4.js} +1 -1
  60. package/dist/assets/dql-notebook/assets/{x-CeNgQwGm.js → x-CbKEfe5m.js} +1 -1
  61. package/dist/assets/dql-notebook/index.html +1 -1
  62. package/dist/commands/model.d.ts.map +1 -1
  63. package/dist/commands/model.js +62 -1
  64. package/dist/commands/model.js.map +1 -1
  65. package/dist/index.js +3 -0
  66. package/dist/index.js.map +1 -1
  67. package/dist/llm/providers/dql-agent-provider.d.ts +4 -3
  68. package/dist/llm/providers/dql-agent-provider.d.ts.map +1 -1
  69. package/dist/llm/providers/dql-agent-provider.js +13 -10
  70. package/dist/llm/providers/dql-agent-provider.js.map +1 -1
  71. package/dist/local-operation-coordinator.d.ts +59 -0
  72. package/dist/local-operation-coordinator.d.ts.map +1 -0
  73. package/dist/local-operation-coordinator.js +256 -0
  74. package/dist/local-operation-coordinator.js.map +1 -0
  75. package/dist/local-runtime.d.ts +59 -1
  76. package/dist/local-runtime.d.ts.map +1 -1
  77. package/dist/local-runtime.js +2653 -342
  78. package/dist/local-runtime.js.map +1 -1
  79. package/dist/package.json +12 -11
  80. package/dist/project-refresh-coordinator.d.ts +19 -0
  81. package/dist/project-refresh-coordinator.d.ts.map +1 -0
  82. package/dist/project-refresh-coordinator.js +134 -0
  83. package/dist/project-refresh-coordinator.js.map +1 -0
  84. package/dist/project-refresh-worker.d.ts +13 -0
  85. package/dist/project-refresh-worker.d.ts.map +1 -0
  86. package/dist/project-refresh-worker.js +58 -0
  87. package/dist/project-refresh-worker.js.map +1 -0
  88. package/package.json +13 -11
  89. package/dist/assets/dql-notebook/assets/AgentAnswerCard-CpL2kDCV.js +0 -5
  90. package/dist/assets/dql-notebook/assets/AiSidePanel-BCQB9rVF.js +0 -6
  91. package/dist/assets/dql-notebook/assets/AnalyticsHome-Ba4Ve_Gd.js +0 -6
  92. package/dist/assets/dql-notebook/assets/AppsView-CdAT9BOq.js +0 -4466
  93. package/dist/assets/dql-notebook/assets/BlockStudio-Brg4fwn5.js +0 -60
  94. package/dist/assets/dql-notebook/assets/DbtFirstModelingPage-CQe2FUZq.js +0 -22
  95. package/dist/assets/dql-notebook/assets/GitPage-DHyDBChc.js +0 -7
  96. package/dist/assets/dql-notebook/assets/GlobalAiRail-Cys4n_rq.js +0 -1
  97. package/dist/assets/dql-notebook/assets/GovernedContextPage-DyKoDSZ2.js +0 -7
  98. package/dist/assets/dql-notebook/assets/LineageDAG-QHqd_AM5.js +0 -1
  99. package/dist/assets/dql-notebook/assets/NotebookEditor-EZ0pfWVs.js +0 -200
  100. package/dist/assets/dql-notebook/assets/ReadinessPage-BaGvjyfd.js +0 -1
  101. package/dist/assets/dql-notebook/assets/UnifiedAgentRunPanel-BlWAVEwO.js +0 -83
  102. package/dist/assets/dql-notebook/assets/chevron-up-DSEILnDs.js +0 -6
  103. package/dist/assets/dql-notebook/assets/index-BTuliKhK.js +0 -634
  104. package/dist/assets/dql-notebook/assets/link-2-CTKe6Snr.js +0 -6
  105. package/dist/assets/dql-notebook/assets/maximize-2-Cojc6867.js +0 -6
  106. package/dist/assets/dql-notebook/assets/pencil-Cb45c6WU.js +0 -6
  107. package/dist/assets/dql-notebook/assets/usePersistedAgentThreadId-CkVFrrjk.js +0 -18
@@ -1,4 +1,4 @@
1
- import{R as wc,r as O,j as P}from"./index-BTuliKhK.js";import{r as ni,g as xc}from"./react-CRB3T2We.js";function ie(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=ie(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var vc={value:()=>{}};function cn(){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 Vt(n)}function Vt(e){this._=e}function bc(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",o=n.indexOf(".");if(o>=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Vt.prototype=cn.prototype={constructor:Vt,on:function(e,t){var n=this._,r=bc(e+"",n),o,i=-1,s=r.length;if(arguments.length<2){for(;++i<s;)if((o=(e=r[i]).type)&&(o=_c(n[o],e.name)))return o;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(o=(e=r[i]).type)n[o]=Dr(n[o],e.name,t);else if(t==null)for(o in n)n[o]=Dr(n[o],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Vt(e)},call:function(e,t){if((o=arguments.length-2)>0)for(var n=new Array(o),r=0,o,i;r<o;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,o=i.length;r<o;++r)i[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],o=0,i=r.length;o<i;++o)r[o].value.apply(t,n)}};function _c(e,t){for(var n=0,r=e.length,o;n<r;++n)if((o=e[n]).name===t)return o.value}function Dr(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=vc,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Yn="http://www.w3.org/1999/xhtml";const zr={svg:"http://www.w3.org/2000/svg",xhtml:Yn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function un(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),zr.hasOwnProperty(t)?{space:zr[t],local:e}:e}function Ec(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Yn&&t.documentElement.namespaceURI===Yn?t.createElement(e):t.createElementNS(n,e)}}function Nc(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ri(e){var t=un(e);return(t.local?Nc:Ec)(t)}function Sc(){}function ir(e){return e==null?Sc:function(){return this.querySelector(e)}}function Mc(e){typeof e!="function"&&(e=ir(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,a=r[o]=new Array(s),c,u,d=0;d<s;++d)(c=i[d])&&(u=e.call(c,c.__data__,d,i))&&("__data__"in c&&(u.__data__=c.__data__),a[d]=u);return new ue(r,this._parents)}function kc(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Cc(){return[]}function oi(e){return e==null?Cc:function(){return this.querySelectorAll(e)}}function Ic(e){return function(){return kc(e.apply(this,arguments))}}function Ac(e){typeof e=="function"?e=Ic(e):e=oi(e);for(var t=this._groups,n=t.length,r=[],o=[],i=0;i<n;++i)for(var s=t[i],a=s.length,c,u=0;u<a;++u)(c=s[u])&&(r.push(e.call(c,c.__data__,u,s)),o.push(c));return new ue(r,o)}function ii(e){return function(){return this.matches(e)}}function si(e){return function(t){return t.matches(e)}}var $c=Array.prototype.find;function Pc(e){return function(){return $c.call(this.children,e)}}function Tc(){return this.firstElementChild}function Lc(e){return this.select(e==null?Tc:Pc(typeof e=="function"?e:si(e)))}var Oc=Array.prototype.filter;function Dc(){return Array.from(this.children)}function zc(e){return function(){return Oc.call(this.children,e)}}function Rc(e){return this.selectAll(e==null?Dc:zc(typeof e=="function"?e:si(e)))}function Hc(e){typeof e!="function"&&(e=ii(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,a=r[o]=[],c,u=0;u<s;++u)(c=i[u])&&e.call(c,c.__data__,u,i)&&a.push(c);return new ue(r,this._parents)}function ai(e){return new Array(e.length)}function jc(){return new ue(this._enter||this._groups.map(ai),this._parents)}function Wt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Wt.prototype={constructor:Wt,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Vc(e){return function(){return e}}function Fc(e,t,n,r,o,i){for(var s=0,a,c=t.length,u=i.length;s<u;++s)(a=t[s])?(a.__data__=i[s],r[s]=a):n[s]=new Wt(e,i[s]);for(;s<c;++s)(a=t[s])&&(o[s]=a)}function Bc(e,t,n,r,o,i,s){var a,c,u=new Map,d=t.length,l=i.length,f=new Array(d),h;for(a=0;a<d;++a)(c=t[a])&&(f[a]=h=s.call(c,c.__data__,a,t)+"",u.has(h)?o[a]=c:u.set(h,c));for(a=0;a<l;++a)h=s.call(e,i[a],a,i)+"",(c=u.get(h))?(r[a]=c,c.__data__=i[a],u.delete(h)):n[a]=new Wt(e,i[a]);for(a=0;a<d;++a)(c=t[a])&&u.get(f[a])===c&&(o[a]=c)}function Yc(e){return e.__data__}function Xc(e,t){if(!arguments.length)return Array.from(this,Yc);var n=t?Bc:Fc,r=this._parents,o=this._groups;typeof e!="function"&&(e=Vc(e));for(var i=o.length,s=new Array(i),a=new Array(i),c=new Array(i),u=0;u<i;++u){var d=r[u],l=o[u],f=l.length,h=Wc(e.call(d,d&&d.__data__,u,r)),g=h.length,y=a[u]=new Array(g),w=s[u]=new Array(g),m=c[u]=new Array(f);n(d,l,y,w,m,h,t);for(var b=0,p=0,x,S;b<g;++b)if(x=y[b]){for(b>=p&&(p=b+1);!(S=w[p])&&++p<g;);x._next=S||null}}return s=new ue(s,r),s._enter=a,s._exit=c,s}function Wc(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Gc(){return new ue(this._exit||this._groups.map(ai),this._parents)}function qc(e,t,n){var r=this.enter(),o=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(o=t(o),o&&(o=o.selection())),n==null?i.remove():n(i),r&&o?r.merge(o).order():o}function Kc(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,o=n.length,i=r.length,s=Math.min(o,i),a=new Array(o),c=0;c<s;++c)for(var u=n[c],d=r[c],l=u.length,f=a[c]=new Array(l),h,g=0;g<l;++g)(h=u[g]||d[g])&&(f[g]=h);for(;c<o;++c)a[c]=n[c];return new ue(a,this._parents)}function Uc(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],o=r.length-1,i=r[o],s;--o>=0;)(s=r[o])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function Zc(e){e||(e=Qc);function t(l,f){return l&&f?e(l.__data__,f.__data__):!l-!f}for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i){for(var s=n[i],a=s.length,c=o[i]=new Array(a),u,d=0;d<a;++d)(u=s[d])&&(c[d]=u);c.sort(t)}return new ue(o,this._parents).order()}function Qc(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Jc(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function eu(){return Array.from(this)}function tu(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length;o<i;++o){var s=r[o];if(s)return s}return null}function nu(){let e=0;for(const t of this)++e;return e}function ru(){return!this.node()}function ou(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var o=t[n],i=0,s=o.length,a;i<s;++i)(a=o[i])&&e.call(a,a.__data__,i,o);return this}function iu(e){return function(){this.removeAttribute(e)}}function su(e){return function(){this.removeAttributeNS(e.space,e.local)}}function au(e,t){return function(){this.setAttribute(e,t)}}function cu(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function uu(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function lu(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function du(e,t){var n=un(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?su:iu:typeof t=="function"?n.local?lu:uu:n.local?cu:au)(n,t))}function ci(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function fu(e){return function(){this.style.removeProperty(e)}}function hu(e,t,n){return function(){this.style.setProperty(e,t,n)}}function gu(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function pu(e,t,n){return arguments.length>1?this.each((t==null?fu:typeof t=="function"?gu:hu)(e,t,n??"")):Ge(this.node(),e)}function Ge(e,t){return e.style.getPropertyValue(t)||ci(e).getComputedStyle(e,null).getPropertyValue(t)}function mu(e){return function(){delete this[e]}}function yu(e,t){return function(){this[e]=t}}function wu(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function xu(e,t){return arguments.length>1?this.each((t==null?mu:typeof t=="function"?wu:yu)(e,t)):this.node()[e]}function ui(e){return e.trim().split(/^|\s+/)}function sr(e){return e.classList||new li(e)}function li(e){this._node=e,this._names=ui(e.getAttribute("class")||"")}li.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function di(e,t){for(var n=sr(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function fi(e,t){for(var n=sr(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function vu(e){return function(){di(this,e)}}function bu(e){return function(){fi(this,e)}}function _u(e,t){return function(){(t.apply(this,arguments)?di:fi)(this,e)}}function Eu(e,t){var n=ui(e+"");if(arguments.length<2){for(var r=sr(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof t=="function"?_u:t?vu:bu)(n,t))}function Nu(){this.textContent=""}function Su(e){return function(){this.textContent=e}}function Mu(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function ku(e){return arguments.length?this.each(e==null?Nu:(typeof e=="function"?Mu:Su)(e)):this.node().textContent}function Cu(){this.innerHTML=""}function Iu(e){return function(){this.innerHTML=e}}function Au(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function $u(e){return arguments.length?this.each(e==null?Cu:(typeof e=="function"?Au:Iu)(e)):this.node().innerHTML}function Pu(){this.nextSibling&&this.parentNode.appendChild(this)}function Tu(){return this.each(Pu)}function Lu(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ou(){return this.each(Lu)}function Du(e){var t=typeof e=="function"?e:ri(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function zu(){return null}function Ru(e,t){var n=typeof e=="function"?e:ri(e),r=t==null?zu:typeof t=="function"?t:ir(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Hu(){var e=this.parentNode;e&&e.removeChild(this)}function ju(){return this.each(Hu)}function Vu(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Fu(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Bu(e){return this.select(e?Fu:Vu)}function Yu(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Xu(e){return function(t){e.call(this,t,this.__data__)}}function Wu(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}})}function Gu(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,o=t.length,i;n<o;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function qu(e,t,n){return function(){var r=this.__on,o,i=Xu(t);if(r){for(var s=0,a=r.length;s<a;++s)if((o=r[s]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),o.value=t;return}}this.addEventListener(e.type,i,n),o={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(o):this.__on=[o]}}function Ku(e,t,n){var r=Wu(e+""),o,i=r.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,u=a.length,d;c<u;++c)for(o=0,d=a[c];o<i;++o)if((s=r[o]).type===d.type&&s.name===d.name)return d.value}return}for(a=t?qu:Gu,o=0;o<i;++o)this.each(a(r[o],t,n));return this}function hi(e,t,n){var r=ci(e),o=r.CustomEvent;typeof o=="function"?o=new o(t,n):(o=r.document.createEvent("Event"),n?(o.initEvent(t,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(t,!1,!1)),e.dispatchEvent(o)}function Uu(e,t){return function(){return hi(this,e,t)}}function Zu(e,t){return function(){return hi(this,e,t.apply(this,arguments))}}function Qu(e,t){return this.each((typeof t=="function"?Zu:Uu)(e,t))}function*Ju(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length,s;o<i;++o)(s=r[o])&&(yield s)}var gi=[null];function ue(e,t){this._groups=e,this._parents=t}function Et(){return new ue([[document.documentElement]],gi)}function el(){return this}ue.prototype=Et.prototype={constructor:ue,select:Mc,selectAll:Ac,selectChild:Lc,selectChildren:Rc,filter:Hc,data:Xc,enter:jc,exit:Gc,join:qc,merge:Kc,selection:el,order:Uc,sort:Zc,call:Jc,nodes:eu,node:tu,size:nu,empty:ru,each:ou,attr:du,style:pu,property:xu,classed:Eu,text:ku,html:$u,raise:Tu,lower:Ou,append:Du,insert:Ru,remove:ju,clone:Bu,datum:Yu,on:Ku,dispatch:Qu,[Symbol.iterator]:Ju};function ce(e){return typeof e=="string"?new ue([[document.querySelector(e)]],[document.documentElement]):new ue([[e]],gi)}function tl(e){let t;for(;t=e.sourceEvent;)e=t;return e}function de(e,t){if(e=tl(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 o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}const nl={passive:!1},ht={capture:!0,passive:!1};function Sn(e){e.stopImmediatePropagation()}function Xe(e){e.preventDefault(),e.stopImmediatePropagation()}function pi(e){var t=e.document.documentElement,n=ce(e).on("dragstart.drag",Xe,ht);"onselectstart"in t?n.on("selectstart.drag",Xe,ht):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function mi(e,t){var n=e.document.documentElement,r=ce(e).on("dragstart.drag",null);t&&(r.on("click.drag",Xe,ht),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Pt=e=>()=>e;function Xn(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:i,x:s,y:a,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:o,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}Xn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function rl(e){return!e.ctrlKey&&!e.button}function ol(){return this.parentNode}function il(e,t){return t??{x:e.x,y:e.y}}function sl(){return navigator.maxTouchPoints||"ontouchstart"in this}function yi(){var e=rl,t=ol,n=il,r=sl,o={},i=cn("start","drag","end"),s=0,a,c,u,d,l=0;function f(x){x.on("mousedown.drag",h).filter(r).on("touchstart.drag",w).on("touchmove.drag",m,nl).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(x,S){if(!(d||!e.call(this,x,S))){var _=p(this,t.call(this,x,S),x,S,"mouse");_&&(ce(x.view).on("mousemove.drag",g,ht).on("mouseup.drag",y,ht),pi(x.view),Sn(x),u=!1,a=x.clientX,c=x.clientY,_("start",x))}}function g(x){if(Xe(x),!u){var S=x.clientX-a,_=x.clientY-c;u=S*S+_*_>l}o.mouse("drag",x)}function y(x){ce(x.view).on("mousemove.drag mouseup.drag",null),mi(x.view,u),Xe(x),o.mouse("end",x)}function w(x,S){if(e.call(this,x,S)){var _=x.changedTouches,M=t.call(this,x,S),T=_.length,L,j;for(L=0;L<T;++L)(j=p(this,M,x,S,_[L].identifier,_[L]))&&(Sn(x),j("start",x,_[L]))}}function m(x){var S=x.changedTouches,_=S.length,M,T;for(M=0;M<_;++M)(T=o[S[M].identifier])&&(Xe(x),T("drag",x,S[M]))}function b(x){var S=x.changedTouches,_=S.length,M,T;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),M=0;M<_;++M)(T=o[S[M].identifier])&&(Sn(x),T("end",x,S[M]))}function p(x,S,_,M,T,L){var j=i.copy(),C=de(L||_,S),$,H,v;if((v=n.call(x,new Xn("beforestart",{sourceEvent:_,target:f,identifier:T,active:s,x:C[0],y:C[1],dx:0,dy:0,dispatch:j}),M))!=null)return $=v.x-C[0]||0,H=v.y-C[1]||0,function I(E,A,k){var N=C,D;switch(E){case"start":o[T]=I,D=s++;break;case"end":delete o[T],--s;case"drag":C=de(k||A,S),D=s;break}j.call(E,x,new Xn(E,{sourceEvent:A,subject:v,target:f,identifier:T,active:D,x:C[0]+$,y:C[1]+H,dx:C[0]-N[0],dy:C[1]-N[1],dispatch:j}),M)}}return f.filter=function(x){return arguments.length?(e=typeof x=="function"?x:Pt(!!x),f):e},f.container=function(x){return arguments.length?(t=typeof x=="function"?x:Pt(x),f):t},f.subject=function(x){return arguments.length?(n=typeof x=="function"?x:Pt(x),f):n},f.touchable=function(x){return arguments.length?(r=typeof x=="function"?x:Pt(!!x),f):r},f.on=function(){var x=i.on.apply(i,arguments);return x===i?f:x},f.clickDistance=function(x){return arguments.length?(l=(x=+x)*x,f):Math.sqrt(l)},f}function ar(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function wi(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Nt(){}var gt=.7,Gt=1/gt,We="\\s*([+-]?\\d+)\\s*",pt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",we="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",al=/^#([0-9a-f]{3,8})$/,cl=new RegExp(`^rgb\\(${We},${We},${We}\\)$`),ul=new RegExp(`^rgb\\(${we},${we},${we}\\)$`),ll=new RegExp(`^rgba\\(${We},${We},${We},${pt}\\)$`),dl=new RegExp(`^rgba\\(${we},${we},${we},${pt}\\)$`),fl=new RegExp(`^hsl\\(${pt},${we},${we}\\)$`),hl=new RegExp(`^hsla\\(${pt},${we},${we},${pt}\\)$`),Rr={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};ar(Nt,De,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Hr,formatHex:Hr,formatHex8:gl,formatHsl:pl,formatRgb:jr,toString:jr});function Hr(){return this.rgb().formatHex()}function gl(){return this.rgb().formatHex8()}function pl(){return xi(this).formatHsl()}function jr(){return this.rgb().formatRgb()}function De(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=al.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Vr(t):n===3?new ae(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Tt(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Tt(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=cl.exec(e))?new ae(t[1],t[2],t[3],1):(t=ul.exec(e))?new ae(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=ll.exec(e))?Tt(t[1],t[2],t[3],t[4]):(t=dl.exec(e))?Tt(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=fl.exec(e))?Yr(t[1],t[2]/100,t[3]/100,1):(t=hl.exec(e))?Yr(t[1],t[2]/100,t[3]/100,t[4]):Rr.hasOwnProperty(e)?Vr(Rr[e]):e==="transparent"?new ae(NaN,NaN,NaN,0):null}function Vr(e){return new ae(e>>16&255,e>>8&255,e&255,1)}function Tt(e,t,n,r){return r<=0&&(e=t=n=NaN),new ae(e,t,n,r)}function ml(e){return e instanceof Nt||(e=De(e)),e?(e=e.rgb(),new ae(e.r,e.g,e.b,e.opacity)):new ae}function Wn(e,t,n,r){return arguments.length===1?ml(e):new ae(e,t,n,r??1)}function ae(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}ar(ae,Wn,wi(Nt,{brighter(e){return e=e==null?Gt:Math.pow(Gt,e),new ae(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?gt:Math.pow(gt,e),new ae(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ae(Le(this.r),Le(this.g),Le(this.b),qt(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Fr,formatHex:Fr,formatHex8:yl,formatRgb:Br,toString:Br}));function Fr(){return`#${Te(this.r)}${Te(this.g)}${Te(this.b)}`}function yl(){return`#${Te(this.r)}${Te(this.g)}${Te(this.b)}${Te((isNaN(this.opacity)?1:this.opacity)*255)}`}function Br(){const e=qt(this.opacity);return`${e===1?"rgb(":"rgba("}${Le(this.r)}, ${Le(this.g)}, ${Le(this.b)}${e===1?")":`, ${e})`}`}function qt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Le(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Te(e){return e=Le(e),(e<16?"0":"")+e.toString(16)}function Yr(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new fe(e,t,n,r)}function xi(e){if(e instanceof fe)return new fe(e.h,e.s,e.l,e.opacity);if(e instanceof Nt||(e=De(e)),!e)return new fe;if(e instanceof fe)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),i=Math.max(t,n,r),s=NaN,a=i-o,c=(i+o)/2;return a?(t===i?s=(n-r)/a+(n<r)*6:n===i?s=(r-t)/a+2:s=(t-n)/a+4,a/=c<.5?i+o:2-i-o,s*=60):a=c>0&&c<1?0:s,new fe(s,a,c,e.opacity)}function wl(e,t,n,r){return arguments.length===1?xi(e):new fe(e,t,n,r??1)}function fe(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}ar(fe,wl,wi(Nt,{brighter(e){return e=e==null?Gt:Math.pow(Gt,e),new fe(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?gt:Math.pow(gt,e),new fe(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,o=2*n-r;return new ae(Mn(e>=240?e-240:e+120,o,r),Mn(e,o,r),Mn(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new fe(Xr(this.h),Lt(this.s),Lt(this.l),qt(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=qt(this.opacity);return`${e===1?"hsl(":"hsla("}${Xr(this.h)}, ${Lt(this.s)*100}%, ${Lt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Xr(e){return e=(e||0)%360,e<0?e+360:e}function Lt(e){return Math.max(0,Math.min(1,e||0))}function Mn(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const cr=e=>()=>e;function xl(e,t){return function(n){return e+n*t}}function vl(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function bl(e){return(e=+e)==1?vi:function(t,n){return n-t?vl(t,n,e):cr(isNaN(t)?n:t)}}function vi(e,t){var n=t-e;return n?xl(e,n):cr(isNaN(e)?t:e)}const Kt=(function e(t){var n=bl(t);function r(o,i){var s=n((o=Wn(o)).r,(i=Wn(i)).r),a=n(o.g,i.g),c=n(o.b,i.b),u=vi(o.opacity,i.opacity);return function(d){return o.r=s(d),o.g=a(d),o.b=c(d),o.opacity=u(d),o+""}}return r.gamma=e,r})(1);function _l(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),o;return function(i){for(o=0;o<n;++o)r[o]=e[o]*(1-i)+t[o]*i;return r}}function El(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Nl(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,o=new Array(r),i=new Array(n),s;for(s=0;s<r;++s)o[s]=dt(e[s],t[s]);for(;s<n;++s)i[s]=t[s];return function(a){for(s=0;s<r;++s)i[s]=o[s](a);return i}}function Sl(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function me(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Ml(e,t){var n={},r={},o;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(o in t)o in e?n[o]=dt(e[o],t[o]):r[o]=t[o];return function(i){for(o in n)r[o]=n[o](i);return r}}var Gn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,kn=new RegExp(Gn.source,"g");function kl(e){return function(){return e}}function Cl(e){return function(t){return e(t)+""}}function bi(e,t){var n=Gn.lastIndex=kn.lastIndex=0,r,o,i,s=-1,a=[],c=[];for(e=e+"",t=t+"";(r=Gn.exec(e))&&(o=kn.exec(t));)(i=o.index)>n&&(i=t.slice(n,i),a[s]?a[s]+=i:a[++s]=i),(r=r[0])===(o=o[0])?a[s]?a[s]+=o:a[++s]=o:(a[++s]=null,c.push({i:s,x:me(r,o)})),n=kn.lastIndex;return n<t.length&&(i=t.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?c[0]?Cl(c[0].x):kl(t):(t=c.length,function(u){for(var d=0,l;d<t;++d)a[(l=c[d]).i]=l.x(u);return a.join("")})}function dt(e,t){var n=typeof t,r;return t==null||n==="boolean"?cr(t):(n==="number"?me:n==="string"?(r=De(t))?(t=r,Kt):bi:t instanceof De?Kt:t instanceof Date?Sl:El(t)?_l:Array.isArray(t)?Nl:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Ml:me)(e,t)}var Wr=180/Math.PI,qn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function _i(e,t,n,r,o,i){var s,a,c;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),e*r<t*n&&(e=-e,t=-t,c=-c,s=-s),{translateX:o,translateY:i,rotate:Math.atan2(t,e)*Wr,skewX:Math.atan(c)*Wr,scaleX:s,scaleY:a}}var Ot;function Il(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?qn:_i(t.a,t.b,t.c,t.d,t.e,t.f)}function Al(e){return e==null||(Ot||(Ot=document.createElementNS("http://www.w3.org/2000/svg","g")),Ot.setAttribute("transform",e),!(e=Ot.transform.baseVal.consolidate()))?qn:(e=e.matrix,_i(e.a,e.b,e.c,e.d,e.e,e.f))}function Ei(e,t,n,r){function o(u){return u.length?u.pop()+" ":""}function i(u,d,l,f,h,g){if(u!==l||d!==f){var y=h.push("translate(",null,t,null,n);g.push({i:y-4,x:me(u,l)},{i:y-2,x:me(d,f)})}else(l||f)&&h.push("translate("+l+t+f+n)}function s(u,d,l,f){u!==d?(u-d>180?d+=360:d-u>180&&(u+=360),f.push({i:l.push(o(l)+"rotate(",null,r)-2,x:me(u,d)})):d&&l.push(o(l)+"rotate("+d+r)}function a(u,d,l,f){u!==d?f.push({i:l.push(o(l)+"skewX(",null,r)-2,x:me(u,d)}):d&&l.push(o(l)+"skewX("+d+r)}function c(u,d,l,f,h,g){if(u!==l||d!==f){var y=h.push(o(h)+"scale(",null,",",null,")");g.push({i:y-4,x:me(u,l)},{i:y-2,x:me(d,f)})}else(l!==1||f!==1)&&h.push(o(h)+"scale("+l+","+f+")")}return function(u,d){var l=[],f=[];return u=e(u),d=e(d),i(u.translateX,u.translateY,d.translateX,d.translateY,l,f),s(u.rotate,d.rotate,l,f),a(u.skewX,d.skewX,l,f),c(u.scaleX,u.scaleY,d.scaleX,d.scaleY,l,f),u=d=null,function(h){for(var g=-1,y=f.length,w;++g<y;)l[(w=f[g]).i]=w.x(h);return l.join("")}}}var $l=Ei(Il,"px, ","px)","deg)"),Pl=Ei(Al,", ",")",")"),Tl=1e-12;function Gr(e){return((e=Math.exp(e))+1/e)/2}function Ll(e){return((e=Math.exp(e))-1/e)/2}function Ol(e){return((e=Math.exp(2*e))-1)/(e+1)}const Ft=(function e(t,n,r){function o(i,s){var a=i[0],c=i[1],u=i[2],d=s[0],l=s[1],f=s[2],h=d-a,g=l-c,y=h*h+g*g,w,m;if(y<Tl)m=Math.log(f/u)/t,w=function(M){return[a+M*h,c+M*g,u*Math.exp(t*M*m)]};else{var b=Math.sqrt(y),p=(f*f-u*u+r*y)/(2*u*n*b),x=(f*f-u*u-r*y)/(2*f*n*b),S=Math.log(Math.sqrt(p*p+1)-p),_=Math.log(Math.sqrt(x*x+1)-x);m=(_-S)/t,w=function(M){var T=M*m,L=Gr(S),j=u/(n*b)*(L*Ol(t*T+S)-Ll(S));return[a+j*h,c+j*g,u*L/Gr(t*T+S)]}}return w.duration=m*1e3*t/Math.SQRT2,w}return o.rho=function(i){var s=Math.max(.001,+i),a=s*s,c=a*a;return e(s,a,c)},o})(Math.SQRT2,2,4);var qe=0,ct=0,st=0,Ni=1e3,Ut,ut,Zt=0,ze=0,ln=0,mt=typeof performance=="object"&&performance.now?performance:Date,Si=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function ur(){return ze||(Si(Dl),ze=mt.now()+ln)}function Dl(){ze=0}function Qt(){this._call=this._time=this._next=null}Qt.prototype=Mi.prototype={constructor:Qt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?ur():+n)+(t==null?0:+t),!this._next&&ut!==this&&(ut?ut._next=this:Ut=this,ut=this),this._call=e,this._time=n,Kn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Kn())}};function Mi(e,t,n){var r=new Qt;return r.restart(e,t,n),r}function zl(){ur(),++qe;for(var e=Ut,t;e;)(t=ze-e._time)>=0&&e._call.call(void 0,t),e=e._next;--qe}function qr(){ze=(Zt=mt.now())+ln,qe=ct=0;try{zl()}finally{qe=0,Hl(),ze=0}}function Rl(){var e=mt.now(),t=e-Zt;t>Ni&&(ln-=t,Zt=e)}function Hl(){for(var e,t=Ut,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:Ut=n);ut=e,Kn(r)}function Kn(e){if(!qe){ct&&(ct=clearTimeout(ct));var t=e-ze;t>24?(e<1/0&&(ct=setTimeout(qr,e-mt.now()-ln)),st&&(st=clearInterval(st))):(st||(Zt=mt.now(),st=setInterval(Rl,Ni)),qe=1,Si(qr))}}function Kr(e,t,n){var r=new Qt;return t=t==null?0:+t,r.restart(o=>{r.stop(),e(o+t)},t,n),r}var jl=cn("start","end","cancel","interrupt"),Vl=[],ki=0,Ur=1,Un=2,Bt=3,Zr=4,Zn=5,Yt=6;function dn(e,t,n,r,o,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;Fl(e,n,{name:t,index:r,group:o,on:jl,tween:Vl,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:ki})}function lr(e,t){var n=pe(e,t);if(n.state>ki)throw new Error("too late; already scheduled");return n}function ve(e,t){var n=pe(e,t);if(n.state>Bt)throw new Error("too late; already running");return n}function pe(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Fl(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=Mi(i,0,n.time);function i(u){n.state=Ur,n.timer.restart(s,n.delay,n.time),n.delay<=u&&s(u-n.delay)}function s(u){var d,l,f,h;if(n.state!==Ur)return c();for(d in r)if(h=r[d],h.name===n.name){if(h.state===Bt)return Kr(s);h.state===Zr?(h.state=Yt,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[d]):+d<t&&(h.state=Yt,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[d])}if(Kr(function(){n.state===Bt&&(n.state=Zr,n.timer.restart(a,n.delay,n.time),a(u))}),n.state=Un,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Un){for(n.state=Bt,o=new Array(f=n.tween.length),d=0,l=-1;d<f;++d)(h=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(o[++l]=h);o.length=l+1}}function a(u){for(var d=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(c),n.state=Zn,1),l=-1,f=o.length;++l<f;)o[l].call(e,d);n.state===Zn&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Yt,n.timer.stop(),delete r[t];for(var u in r)return;delete e.__transition}}function Xt(e,t){var n=e.__transition,r,o,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((r=n[s]).name!==t){i=!1;continue}o=r.state>Un&&r.state<Zn,r.state=Yt,r.timer.stop(),r.on.call(o?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[s]}i&&delete e.__transition}}function Bl(e){return this.each(function(){Xt(this,e)})}function Yl(e,t){var n,r;return function(){var o=ve(this,e),i=o.tween;if(i!==n){r=n=i;for(var s=0,a=r.length;s<a;++s)if(r[s].name===t){r=r.slice(),r.splice(s,1);break}}o.tween=r}}function Xl(e,t,n){var r,o;if(typeof n!="function")throw new Error;return function(){var i=ve(this,e),s=i.tween;if(s!==r){o=(r=s).slice();for(var a={name:t,value:n},c=0,u=o.length;c<u;++c)if(o[c].name===t){o[c]=a;break}c===u&&o.push(a)}i.tween=o}}function Wl(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=pe(this.node(),n).tween,o=0,i=r.length,s;o<i;++o)if((s=r[o]).name===e)return s.value;return null}return this.each((t==null?Yl:Xl)(n,e,t))}function dr(e,t,n){var r=e._id;return e.each(function(){var o=ve(this,r);(o.value||(o.value={}))[t]=n.apply(this,arguments)}),function(o){return pe(o,r).value[t]}}function Ci(e,t){var n;return(typeof t=="number"?me:t instanceof De?Kt:(n=De(t))?(t=n,Kt):bi)(e,t)}function Gl(e){return function(){this.removeAttribute(e)}}function ql(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Kl(e,t,n){var r,o=n+"",i;return function(){var s=this.getAttribute(e);return s===o?null:s===r?i:i=t(r=s,n)}}function Ul(e,t,n){var r,o=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===o?null:s===r?i:i=t(r=s,n)}}function Zl(e,t,n){var r,o,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===r&&c===o?i:(o=c,i=t(r=s,a)))}}function Ql(e,t,n){var r,o,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===r&&c===o?i:(o=c,i=t(r=s,a)))}}function Jl(e,t){var n=un(e),r=n==="transform"?Pl:Ci;return this.attrTween(e,typeof t=="function"?(n.local?Ql:Zl)(n,r,dr(this,"attr."+e,t)):t==null?(n.local?ql:Gl)(n):(n.local?Ul:Kl)(n,r,t))}function ed(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function td(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function nd(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&td(e,i)),n}return o._value=t,o}function rd(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&ed(e,i)),n}return o._value=t,o}function od(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=un(e);return this.tween(n,(r.local?nd:rd)(r,t))}function id(e,t){return function(){lr(this,e).delay=+t.apply(this,arguments)}}function sd(e,t){return t=+t,function(){lr(this,e).delay=t}}function ad(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?id:sd)(t,e)):pe(this.node(),t).delay}function cd(e,t){return function(){ve(this,e).duration=+t.apply(this,arguments)}}function ud(e,t){return t=+t,function(){ve(this,e).duration=t}}function ld(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?cd:ud)(t,e)):pe(this.node(),t).duration}function dd(e,t){if(typeof t!="function")throw new Error;return function(){ve(this,e).ease=t}}function fd(e){var t=this._id;return arguments.length?this.each(dd(t,e)):pe(this.node(),t).ease}function hd(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;ve(this,e).ease=n}}function gd(e){if(typeof e!="function")throw new Error;return this.each(hd(this._id,e))}function pd(e){typeof e!="function"&&(e=ii(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,a=r[o]=[],c,u=0;u<s;++u)(c=i[u])&&e.call(c,c.__data__,u,i)&&a.push(c);return new Ne(r,this._parents,this._name,this._id)}function md(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,o=n.length,i=Math.min(r,o),s=new Array(r),a=0;a<i;++a)for(var c=t[a],u=n[a],d=c.length,l=s[a]=new Array(d),f,h=0;h<d;++h)(f=c[h]||u[h])&&(l[h]=f);for(;a<r;++a)s[a]=t[a];return new Ne(s,this._parents,this._name,this._id)}function yd(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function wd(e,t,n){var r,o,i=yd(t)?lr:ve;return function(){var s=i(this,e),a=s.on;a!==r&&(o=(r=a).copy()).on(t,n),s.on=o}}function xd(e,t){var n=this._id;return arguments.length<2?pe(this.node(),n).on.on(e):this.each(wd(n,e,t))}function vd(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function bd(){return this.on("end.remove",vd(this._id))}function _d(e){var t=this._name,n=this._id;typeof e!="function"&&(e=ir(e));for(var r=this._groups,o=r.length,i=new Array(o),s=0;s<o;++s)for(var a=r[s],c=a.length,u=i[s]=new Array(c),d,l,f=0;f<c;++f)(d=a[f])&&(l=e.call(d,d.__data__,f,a))&&("__data__"in d&&(l.__data__=d.__data__),u[f]=l,dn(u[f],t,n,f,u,pe(d,n)));return new Ne(i,this._parents,t,n)}function Ed(e){var t=this._name,n=this._id;typeof e!="function"&&(e=oi(e));for(var r=this._groups,o=r.length,i=[],s=[],a=0;a<o;++a)for(var c=r[a],u=c.length,d,l=0;l<u;++l)if(d=c[l]){for(var f=e.call(d,d.__data__,l,c),h,g=pe(d,n),y=0,w=f.length;y<w;++y)(h=f[y])&&dn(h,t,n,y,f,g);i.push(f),s.push(d)}return new Ne(i,s,t,n)}var Nd=Et.prototype.constructor;function Sd(){return new Nd(this._groups,this._parents)}function Md(e,t){var n,r,o;return function(){var i=Ge(this,e),s=(this.style.removeProperty(e),Ge(this,e));return i===s?null:i===n&&s===r?o:o=t(n=i,r=s)}}function Ii(e){return function(){this.style.removeProperty(e)}}function kd(e,t,n){var r,o=n+"",i;return function(){var s=Ge(this,e);return s===o?null:s===r?i:i=t(r=s,n)}}function Cd(e,t,n){var r,o,i;return function(){var s=Ge(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),Ge(this,e))),s===c?null:s===r&&c===o?i:(o=c,i=t(r=s,a))}}function Id(e,t){var n,r,o,i="style."+t,s="end."+i,a;return function(){var c=ve(this,e),u=c.on,d=c.value[i]==null?a||(a=Ii(t)):void 0;(u!==n||o!==d)&&(r=(n=u).copy()).on(s,o=d),c.on=r}}function Ad(e,t,n){var r=(e+="")=="transform"?$l:Ci;return t==null?this.styleTween(e,Md(e,r)).on("end.style."+e,Ii(e)):typeof t=="function"?this.styleTween(e,Cd(e,r,dr(this,"style."+e,t))).each(Id(this._id,e)):this.styleTween(e,kd(e,r,t),n).on("end.style."+e,null)}function $d(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Pd(e,t,n){var r,o;function i(){var s=t.apply(this,arguments);return s!==o&&(r=(o=s)&&$d(e,s,n)),r}return i._value=t,i}function Td(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,Pd(e,t,n??""))}function Ld(e){return function(){this.textContent=e}}function Od(e){return function(){var t=e(this);this.textContent=t??""}}function Dd(e){return this.tween("text",typeof e=="function"?Od(dr(this,"text",e)):Ld(e==null?"":e+""))}function zd(e){return function(t){this.textContent=e.call(this,t)}}function Rd(e){var t,n;function r(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&zd(o)),t}return r._value=e,r}function Hd(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,Rd(e))}function jd(){for(var e=this._name,t=this._id,n=Ai(),r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,c,u=0;u<a;++u)if(c=s[u]){var d=pe(c,t);dn(c,e,n,u,s,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new Ne(r,this._parents,e,n)}function Vd(){var e,t,n=this,r=n._id,o=n.size();return new Promise(function(i,s){var a={value:s},c={value:function(){--o===0&&i()}};n.each(function(){var u=ve(this,r),d=u.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),u.on=t}),o===0&&i()})}var Fd=0;function Ne(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function Ai(){return++Fd}var _e=Et.prototype;Ne.prototype={constructor:Ne,select:_d,selectAll:Ed,selectChild:_e.selectChild,selectChildren:_e.selectChildren,filter:pd,merge:md,selection:Sd,transition:jd,call:_e.call,nodes:_e.nodes,node:_e.node,size:_e.size,empty:_e.empty,each:_e.each,on:xd,attr:Jl,attrTween:od,style:Ad,styleTween:Td,text:Dd,textTween:Hd,remove:bd,tween:Wl,delay:ad,duration:ld,ease:fd,easeVarying:gd,end:Vd,[Symbol.iterator]:_e[Symbol.iterator]};function Bd(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Yd={time:null,delay:0,duration:250,ease:Bd};function Xd(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function Wd(e){var t,n;e instanceof Ne?(t=e._id,e=e._name):(t=Ai(),(n=Yd).time=ur(),e=e==null?null:e+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,c,u=0;u<a;++u)(c=s[u])&&dn(c,e,t,u,s,n||Xd(c,t));return new Ne(r,this._parents,e,t)}Et.prototype.interrupt=Bl;Et.prototype.transition=Wd;const Dt=e=>()=>e;function Gd(e,{sourceEvent:t,target:n,transform:r,dispatch:o}){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:o}})}function Ee(e,t,n){this.k=e,this.x=t,this.y=n}Ee.prototype={constructor:Ee,scale:function(e){return e===1?this:new Ee(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ee(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var fn=new Ee(1,0,0);$i.prototype=Ee.prototype;function $i(e){for(;!e.__zoom;)if(!(e=e.parentNode))return fn;return e.__zoom}function Cn(e){e.stopImmediatePropagation()}function at(e){e.preventDefault(),e.stopImmediatePropagation()}function qd(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}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]]}function Qr(){return this.__zoom||fn}function Ud(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Zd(){return navigator.maxTouchPoints||"ontouchstart"in this}function Qd(e,t,n){var r=e.invertX(t[0][0])-n[0][0],o=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function Pi(){var e=qd,t=Kd,n=Qd,r=Ud,o=Zd,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=Ft,u=cn("start","zoom","end"),d,l,f,h=500,g=150,y=0,w=10;function m(v){v.property("__zoom",Qr).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",L).on("dblclick.zoom",j).filter(o).on("touchstart.zoom",C).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",H).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(v,I,E,A){var k=v.selection?v.selection():v;k.property("__zoom",Qr),v!==k?S(v,I,E,A):k.interrupt().each(function(){_(this,arguments).event(A).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},m.scaleBy=function(v,I,E,A){m.scaleTo(v,function(){var k=this.__zoom.k,N=typeof I=="function"?I.apply(this,arguments):I;return k*N},E,A)},m.scaleTo=function(v,I,E,A){m.transform(v,function(){var k=t.apply(this,arguments),N=this.__zoom,D=E==null?x(k):typeof E=="function"?E.apply(this,arguments):E,R=N.invert(D),z=typeof I=="function"?I.apply(this,arguments):I;return n(p(b(N,z),D,R),k,s)},E,A)},m.translateBy=function(v,I,E,A){m.transform(v,function(){return n(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof E=="function"?E.apply(this,arguments):E),t.apply(this,arguments),s)},null,A)},m.translateTo=function(v,I,E,A,k){m.transform(v,function(){var N=t.apply(this,arguments),D=this.__zoom,R=A==null?x(N):typeof A=="function"?A.apply(this,arguments):A;return n(fn.translate(R[0],R[1]).scale(D.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof E=="function"?-E.apply(this,arguments):-E),N,s)},A,k)};function b(v,I){return I=Math.max(i[0],Math.min(i[1],I)),I===v.k?v:new Ee(I,v.x,v.y)}function p(v,I,E){var A=I[0]-E[0]*v.k,k=I[1]-E[1]*v.k;return A===v.x&&k===v.y?v:new Ee(v.k,A,k)}function x(v){return[(+v[0][0]+ +v[1][0])/2,(+v[0][1]+ +v[1][1])/2]}function S(v,I,E,A){v.on("start.zoom",function(){_(this,arguments).event(A).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(A).end()}).tween("zoom",function(){var k=this,N=arguments,D=_(k,N).event(A),R=t.apply(k,N),z=E==null?x(R):typeof E=="function"?E.apply(k,N):E,F=Math.max(R[1][0]-R[0][0],R[1][1]-R[0][1]),B=k.__zoom,X=typeof I=="function"?I.apply(k,N):I,K=c(B.invert(z).concat(F/B.k),X.invert(z).concat(F/X.k));return function(G){if(G===1)G=X;else{var V=K(G),W=F/V[2];G=new Ee(W,z[0]-V[0]*W,z[1]-V[1]*W)}D.zoom(null,G)}})}function _(v,I,E){return!E&&v.__zooming||new M(v,I)}function M(v,I){this.that=v,this.args=I,this.active=0,this.sourceEvent=null,this.extent=t.apply(v,I),this.taps=0}M.prototype={event:function(v){return v&&(this.sourceEvent=v),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(v,I){return this.mouse&&v!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&v!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&v!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(v){var I=ce(this.that).datum();u.call(v,this.that,new Gd(v,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:u}),I)}};function T(v,...I){if(!e.apply(this,arguments))return;var E=_(this,I).event(v),A=this.__zoom,k=Math.max(i[0],Math.min(i[1],A.k*Math.pow(2,r.apply(this,arguments)))),N=de(v);if(E.wheel)(E.mouse[0][0]!==N[0]||E.mouse[0][1]!==N[1])&&(E.mouse[1]=A.invert(E.mouse[0]=N)),clearTimeout(E.wheel);else{if(A.k===k)return;E.mouse=[N,A.invert(N)],Xt(this),E.start()}at(v),E.wheel=setTimeout(D,g),E.zoom("mouse",n(p(b(A,k),E.mouse[0],E.mouse[1]),E.extent,s));function D(){E.wheel=null,E.end()}}function L(v,...I){if(f||!e.apply(this,arguments))return;var E=v.currentTarget,A=_(this,I,!0).event(v),k=ce(v.view).on("mousemove.zoom",z,!0).on("mouseup.zoom",F,!0),N=de(v,E),D=v.clientX,R=v.clientY;pi(v.view),Cn(v),A.mouse=[N,this.__zoom.invert(N)],Xt(this),A.start();function z(B){if(at(B),!A.moved){var X=B.clientX-D,K=B.clientY-R;A.moved=X*X+K*K>y}A.event(B).zoom("mouse",n(p(A.that.__zoom,A.mouse[0]=de(B,E),A.mouse[1]),A.extent,s))}function F(B){k.on("mousemove.zoom mouseup.zoom",null),mi(B.view,A.moved),at(B),A.event(B).end()}}function j(v,...I){if(e.apply(this,arguments)){var E=this.__zoom,A=de(v.changedTouches?v.changedTouches[0]:v,this),k=E.invert(A),N=E.k*(v.shiftKey?.5:2),D=n(p(b(E,N),A,k),t.apply(this,I),s);at(v),a>0?ce(this).transition().duration(a).call(S,D,A,v):ce(this).call(m.transform,D,A,v)}}function C(v,...I){if(e.apply(this,arguments)){var E=v.touches,A=E.length,k=_(this,I,v.changedTouches.length===A).event(v),N,D,R,z;for(Cn(v),D=0;D<A;++D)R=E[D],z=de(R,this),z=[z,this.__zoom.invert(z),R.identifier],k.touch0?!k.touch1&&k.touch0[2]!==z[2]&&(k.touch1=z,k.taps=0):(k.touch0=z,N=!0,k.taps=1+!!d);d&&(d=clearTimeout(d)),N&&(k.taps<2&&(l=z[0],d=setTimeout(function(){d=null},h)),Xt(this),k.start())}}function $(v,...I){if(this.__zooming){var E=_(this,I).event(v),A=v.changedTouches,k=A.length,N,D,R,z;for(at(v),N=0;N<k;++N)D=A[N],R=de(D,this),E.touch0&&E.touch0[2]===D.identifier?E.touch0[0]=R:E.touch1&&E.touch1[2]===D.identifier&&(E.touch1[0]=R);if(D=E.that.__zoom,E.touch1){var F=E.touch0[0],B=E.touch0[1],X=E.touch1[0],K=E.touch1[1],G=(G=X[0]-F[0])*G+(G=X[1]-F[1])*G,V=(V=K[0]-B[0])*V+(V=K[1]-B[1])*V;D=b(D,Math.sqrt(G/V)),R=[(F[0]+X[0])/2,(F[1]+X[1])/2],z=[(B[0]+K[0])/2,(B[1]+K[1])/2]}else if(E.touch0)R=E.touch0[0],z=E.touch0[1];else return;E.zoom("touch",n(p(D,R,z),E.extent,s))}}function H(v,...I){if(this.__zooming){var E=_(this,I).event(v),A=v.changedTouches,k=A.length,N,D;for(Cn(v),f&&clearTimeout(f),f=setTimeout(function(){f=null},h),N=0;N<k;++N)D=A[N],E.touch0&&E.touch0[2]===D.identifier?delete E.touch0:E.touch1&&E.touch1[2]===D.identifier&&delete E.touch1;if(E.touch1&&!E.touch0&&(E.touch0=E.touch1,delete E.touch1),E.touch0)E.touch0[1]=this.__zoom.invert(E.touch0[0]);else if(E.end(),E.taps===2&&(D=de(D,this),Math.hypot(l[0]-D[0],l[1]-D[1])<w)){var R=ce(this).on("dblclick.zoom");R&&R.apply(this,arguments)}}}return m.wheelDelta=function(v){return arguments.length?(r=typeof v=="function"?v:Dt(+v),m):r},m.filter=function(v){return arguments.length?(e=typeof v=="function"?v:Dt(!!v),m):e},m.touchable=function(v){return arguments.length?(o=typeof v=="function"?v:Dt(!!v),m):o},m.extent=function(v){return arguments.length?(t=typeof v=="function"?v:Dt([[+v[0][0],+v[0][1]],[+v[1][0],+v[1][1]]]),m):t},m.scaleExtent=function(v){return arguments.length?(i[0]=+v[0],i[1]=+v[1],m):[i[0],i[1]]},m.translateExtent=function(v){return arguments.length?(s[0][0]=+v[0][0],s[1][0]=+v[1][0],s[0][1]=+v[0][1],s[1][1]=+v[1][1],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(v){return arguments.length?(n=v,m):n},m.duration=function(v){return arguments.length?(a=+v,m):a},m.interpolate=function(v){return arguments.length?(c=v,m):c},m.on=function(){var v=u.on.apply(u,arguments);return v===u?m:v},m.clickDistance=function(v){return arguments.length?(y=(v=+v)*v,m):Math.sqrt(y)},m.tapDistance=function(v){return arguments.length?(w=+v,m):w},m}const xe={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"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.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012: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.`,error013:(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.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},yt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Ti=["Enter"," ","Escape"],Li={"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":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"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"};var Ke;(function(e){e.Strict="strict",e.Loose="loose"})(Ke||(Ke={}));var Oe;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Oe||(Oe={}));var wt;(function(e){e.Partial="partial",e.Full="full"})(wt||(wt={}));const Oi={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ie;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ie||(Ie={}));var Jt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Jt||(Jt={}));var Y;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Y||(Y={}));const Jr={[Y.Left]:Y.Right,[Y.Right]:Y.Left,[Y.Top]:Y.Bottom,[Y.Bottom]:Y.Top};function Di(e){return e===null?null:e?"valid":"invalid"}const zi=e=>"id"in e&&"source"in e&&"target"in e,Jd=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),fr=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),St=(e,t=[0,0])=>{const{width:n,height:r}=Se(e),o=e.origin??t,i=n*o[0],s=r*o[1];return{x:e.position.x-i,y:e.position.y-s}},ef=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,o)=>{const i=typeof o=="string";let s=!t.nodeLookup&&!i?o:void 0;t.nodeLookup&&(s=i?t.nodeLookup.get(o):fr(o)?o:t.nodeLookup.get(o.id));const a=s?en(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return hn(r,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return gn(n)},Mt=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(o=>{(t.filter===void 0||t.filter(o))&&(n=hn(n,en(o)),r=!0)}),r?gn(n):{x:0,y:0,width:0,height:0}},hr=(e,t,[n,r,o]=[0,0,1],i=!1,s=!1)=>{const a={...Ct(t,[n,r,o]),width:t.width/o,height:t.height/o},c=[];for(const u of e.values()){const{measured:d,selectable:l=!0,hidden:f=!1}=u;if(s&&!l||f)continue;const h=d.width??u.width??u.initialWidth??null,g=d.height??u.height??u.initialHeight??null,y=xt(a,Ze(u)),w=(h??0)*(g??0),m=i&&y>0;(!u.internals.handleBounds||m||y>=w||u.dragging)&&c.push(u)}return c},tf=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function nf(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(o=>o.id)):null;return e.forEach(o=>{o.measured.width&&o.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!o.hidden)&&(!r||r.has(o.id))&&n.set(o.id,o)}),n}async function rf({nodes:e,width:t,height:n,panZoom:r,minZoom:o,maxZoom:i},s){if(e.size===0)return Promise.resolve(!0);const a=nf(e,s),c=Mt(a),u=gr(c,t,n,(s==null?void 0:s.minZoom)??o,(s==null?void 0:s.maxZoom)??i,(s==null?void 0:s.padding)??.1);return await r.setViewport(u,{duration:s==null?void 0:s.duration,ease:s==null?void 0:s.ease,interpolate:s==null?void 0:s.interpolate}),Promise.resolve(!0)}function Ri({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:o,onError:i}){const s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:c,y:u}=a?a.internals.positionAbsolute:{x:0,y:0},d=s.origin??r;let l=s.extent||o;if(s.extent==="parent"&&!s.expandParent)if(!a)i==null||i("005",xe.error005());else{const h=a.measured.width,g=a.measured.height;h&&g&&(l=[[c,u],[c+h,u+g]])}else a&&Qe(s.extent)&&(l=[[s.extent[0][0]+c,s.extent[0][1]+u],[s.extent[1][0]+c,s.extent[1][1]+u]]);const f=Qe(l)?Re(t,l,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&(i==null||i("015",xe.error015())),{position:{x:f.x-c+(s.measured.width??0)*d[0],y:f.y-u+(s.measured.height??0)*d[1]},positionAbsolute:f}}async function of({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:o}){const i=new Set(e.map(f=>f.id)),s=[];for(const f of n){if(f.deletable===!1)continue;const h=i.has(f.id),g=!h&&f.parentId&&s.find(y=>y.id===f.parentId);(h||g)&&s.push(f)}const a=new Set(t.map(f=>f.id)),c=r.filter(f=>f.deletable!==!1),d=tf(s,c);for(const f of c)a.has(f.id)&&!d.find(g=>g.id===f.id)&&d.push(f);if(!o)return{edges:d,nodes:s};const l=await o({nodes:s,edges:d});return typeof l=="boolean"?l?{edges:d,nodes:s}:{edges:[],nodes:[]}:l}const Ue=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Re=(e={x:0,y:0},t,n)=>({x:Ue(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Ue(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function Hi(e,t,n){const{width:r,height:o}=Se(n),{x:i,y:s}=n.internals.positionAbsolute;return Re(e,[[i,s],[i+r,s+o]],t)}const eo=(e,t,n)=>e<t?Ue(Math.abs(e-t),1,t)/t:e>n?-Ue(Math.abs(e-n),1,t)/t:0,ji=(e,t,n=15,r=40)=>{const o=eo(e.x,r,t.width-r)*n,i=eo(e.y,r,t.height-r)*n;return[o,i]},hn=(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)}),Qn=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),gn=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Ze=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=fr(e)?e.internals.positionAbsolute:St(e,t);return{x:n,y:r,width:((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}},en=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=fr(e)?e.internals.positionAbsolute:St(e,t);return{x:n,y:r,x2:n+(((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0),y2:r+(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0)}},Vi=(e,t)=>gn(hn(Qn(e),Qn(t))),xt=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},to=e=>he(e.width)&&he(e.height)&&he(e.x)&&he(e.y),he=e=>!isNaN(e)&&isFinite(e),sf=(e,t)=>{},kt=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Ct=({x:e,y:t},[n,r,o],i=!1,s=[1,1])=>{const a={x:(e-n)/o,y:(t-r)/o};return i?kt(a,s):a},tn=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r});function Fe(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function af(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Fe(e,n),o=Fe(e,t);return{top:r,right:o,bottom:r,left:o,x:o*2,y:r*2}}if(typeof e=="object"){const r=Fe(e.top??e.y??0,n),o=Fe(e.bottom??e.y??0,n),i=Fe(e.left??e.x??0,t),s=Fe(e.right??e.x??0,t);return{top:r,right:s,bottom:o,left:i,x:i+s,y:r+o}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function cf(e,t,n,r,o,i){const{x:s,y:a}=tn(e,[t,n,r]),{x:c,y:u}=tn({x:e.x+e.width,y:e.y+e.height},[t,n,r]),d=o-c,l=i-u;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(d),bottom:Math.floor(l)}}const gr=(e,t,n,r,o,i)=>{const s=af(i,t,n),a=(t-s.x)/e.width,c=(n-s.y)/e.height,u=Math.min(a,c),d=Ue(u,r,o),l=e.x+e.width/2,f=e.y+e.height/2,h=t/2-l*d,g=n/2-f*d,y=cf(e,h,g,d,t,n),w={left:Math.min(y.left-s.left,0),top:Math.min(y.top-s.top,0),right:Math.min(y.right-s.right,0),bottom:Math.min(y.bottom-s.bottom,0)};return{x:h-w.left+w.right,y:g-w.top+w.bottom,zoom:d}},vt=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Qe(e){return e!=null&&e!=="parent"}function Se(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function Fi(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function Bi(e,t={width:0,height:0},n,r,o){const i={...e},s=r.get(n);if(s){const a=s.origin||o;i.x+=s.internals.positionAbsolute.x-(t.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*a[1]}return i}function no(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function uf(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}function lf(e){return{...Li,...e||{}}}function ft(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:i,y:s}=ge(e),a=Ct({x:i-((o==null?void 0:o.left)??0),y:s-((o==null?void 0:o.top)??0)},r),{x:c,y:u}=n?kt(a,t):a;return{xSnapped:c,ySnapped:u,...a}}const pr=e=>({width:e.offsetWidth,height:e.offsetHeight}),Yi=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},df=["INPUT","SELECT","TEXTAREA"];function Xi(e){var r,o;const t=((o=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:o[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:df.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Wi=e=>"clientX"in e,ge=(e,t)=>{var i,s;const n=Wi(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,o=n?e.clientY:(s=e.touches)==null?void 0:s[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:o-((t==null?void 0:t.top)??0)}},ro=(e,t,n,r,o)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:o,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...pr(s)}})};function Gi({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:o,sourceControlY:i,targetControlX:s,targetControlY:a}){const c=e*.125+o*.375+s*.375+n*.125,u=t*.125+i*.375+a*.375+r*.125,d=Math.abs(c-e),l=Math.abs(u-t);return[c,u,d,l]}function zt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function oo({pos:e,x1:t,y1:n,x2:r,y2:o,c:i}){switch(e){case Y.Left:return[t-zt(t-r,i),n];case Y.Right:return[t+zt(r-t,i),n];case Y.Top:return[t,n-zt(n-o,i)];case Y.Bottom:return[t,n+zt(o-n,i)]}}function qi({sourceX:e,sourceY:t,sourcePosition:n=Y.Bottom,targetX:r,targetY:o,targetPosition:i=Y.Top,curvature:s=.25}){const[a,c]=oo({pos:n,x1:e,y1:t,x2:r,y2:o,c:s}),[u,d]=oo({pos:i,x1:r,y1:o,x2:e,y2:t,c:s}),[l,f,h,g]=Gi({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:a,sourceControlY:c,targetControlX:u,targetControlY:d});return[`M${e},${t} C${a},${c} ${u},${d} ${r},${o}`,l,f,h,g]}function Ki({sourceX:e,sourceY:t,targetX:n,targetY:r}){const o=Math.abs(n-e)/2,i=n<e?n+o:n-o,s=Math.abs(r-t)/2,a=r<t?r+s:r-s;return[i,a,o,s]}function ff({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:o=!1,zIndexMode:i="basic"}){if(i==="manual")return r;const s=o&&n?r+1e3:r,a=Math.max(e.parentId||o&&e.selected?e.internals.z:0,t.parentId||o&&t.selected?t.internals.z:0);return s+a}function hf({sourceNode:e,targetNode:t,width:n,height:r,transform:o}){const i=hn(en(e),en(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-o[0]/o[2],y:-o[1]/o[2],width:n/o[2],height:r/o[2]};return xt(s,gn(i))>0}const gf=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,pf=(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)),mf=(e,t,n={})=>{if(!e.source||!e.target)return t;const r=n.getEdgeId||gf;let o;return zi(e)?o={...e}:o={...e,id:r(e)},pf(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function Ui({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[o,i,s,a]=Ki({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,i,s,a]}const io={[Y.Left]:{x:-1,y:0},[Y.Right]:{x:1,y:0},[Y.Top]:{x:0,y:-1},[Y.Bottom]:{x:0,y:1}},yf=({source:e,sourcePosition:t=Y.Bottom,target:n})=>t===Y.Left||t===Y.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},so=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function wf({source:e,sourcePosition:t=Y.Bottom,target:n,targetPosition:r=Y.Top,center:o,offset:i,stepPosition:s}){const a=io[t],c=io[r],u={x:e.x+a.x*i,y:e.y+a.y*i},d={x:n.x+c.x*i,y:n.y+c.y*i},l=yf({source:u,sourcePosition:t,target:d}),f=l.x!==0?"x":"y",h=l[f];let g=[],y,w;const m={x:0,y:0},b={x:0,y:0},[,,p,x]=Ki({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*c[f]===-1){f==="x"?(y=o.x??u.x+(d.x-u.x)*s,w=o.y??(u.y+d.y)/2):(y=o.x??(u.x+d.x)/2,w=o.y??u.y+(d.y-u.y)*s);const _=[{x:y,y:u.y},{x:y,y:d.y}],M=[{x:u.x,y:w},{x:d.x,y:w}];a[f]===h?g=f==="x"?_:M:g=f==="x"?M:_}else{const _=[{x:u.x,y:d.y}],M=[{x:d.x,y:u.y}];if(f==="x"?g=a.x===h?M:_:g=a.y===h?_:M,t===r){const $=Math.abs(e[f]-n[f]);if($<=i){const H=Math.min(i-1,i-$);a[f]===h?m[f]=(u[f]>e[f]?-1:1)*H:b[f]=(d[f]>n[f]?-1:1)*H}}if(t!==r){const $=f==="x"?"y":"x",H=a[f]===c[$],v=u[$]>d[$],I=u[$]<d[$];(a[f]===1&&(!H&&v||H&&I)||a[f]!==1&&(!H&&I||H&&v))&&(g=f==="x"?_:M)}const T={x:u.x+m.x,y:u.y+m.y},L={x:d.x+b.x,y:d.y+b.y},j=Math.max(Math.abs(T.x-g[0].x),Math.abs(L.x-g[0].x)),C=Math.max(Math.abs(T.y-g[0].y),Math.abs(L.y-g[0].y));j>=C?(y=(T.x+L.x)/2,w=g[0].y):(y=g[0].x,w=(T.y+L.y)/2)}return[[e,{x:u.x+m.x,y:u.y+m.y},...g,{x:d.x+b.x,y:d.y+b.y},n],y,w,p,x]}function xf(e,t,n,r){const o=Math.min(so(e,t)/2,so(t,n)/2,r),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const u=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${i+o*u},${s}Q ${i},${s} ${i},${s+o*d}`}const a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${s+o*c}Q ${i},${s} ${i+o*a},${s}`}function Jn({sourceX:e,sourceY:t,sourcePosition:n=Y.Bottom,targetX:r,targetY:o,targetPosition:i=Y.Top,borderRadius:s=5,centerX:a,centerY:c,offset:u=20,stepPosition:d=.5}){const[l,f,h,g,y]=wf({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:o},targetPosition:i,center:{x:a,y:c},offset:u,stepPosition:d});return[l.reduce((m,b,p)=>{let x="";return p>0&&p<l.length-1?x=xf(l[p-1],b,l[p+1],s):x=`${p===0?"M":"L"}${b.x} ${b.y}`,m+=x,m},""),f,h,g,y]}function ao(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function vf(e){var l;const{sourceNode:t,targetNode:n}=e;if(!ao(t)||!ao(n))return null;const r=t.internals.handleBounds||co(t.handles),o=n.internals.handleBounds||co(n.handles),i=uo((r==null?void 0:r.source)??[],e.sourceHandle),s=uo(e.connectionMode===Ke.Strict?(o==null?void 0:o.target)??[]:((o==null?void 0:o.target)??[]).concat((o==null?void 0:o.source)??[]),e.targetHandle);if(!i||!s)return(l=e.onError)==null||l.call(e,"008",xe.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=(i==null?void 0:i.position)||Y.Bottom,c=(s==null?void 0:s.position)||Y.Top,u=He(t,i,a),d=He(n,s,c);return{sourceX:u.x,sourceY:u.y,targetX:d.x,targetY:d.y,sourcePosition:a,targetPosition:c}}function co(e){if(!e)return null;const t=[],n=[];for(const 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}}function He(e,t,n=Y.Left,r=!1){const o=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,i=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??Se(e);if(r)return{x:o+s/2,y:i+a/2};switch((t==null?void 0:t.position)??n){case Y.Top:return{x:o+s/2,y:i};case Y.Right:return{x:o+s,y:i+a/2};case Y.Bottom:return{x:o+s/2,y:i+a};case Y.Left:return{x:o,y:i+a/2}}}function uo(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function er(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function bf(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:o}){const i=new Set;return e.reduce((s,a)=>([a.markerStart||r,a.markerEnd||o].forEach(c=>{if(c&&typeof c=="object"){const u=er(c,t);i.has(u)||(s.push({id:u,color:c.color||n,...c}),i.add(u))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const Zi=1e3,_f=10,mr={nodeOrigin:[0,0],nodeExtent:yt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Ef={...mr,checkEquality:!0};function yr(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function Nf(e,t,n){const r=yr(mr,n);for(const o of e.values())if(o.parentId)xr(o,e,t,r);else{const i=St(o,r.nodeOrigin),s=Qe(o.extent)?o.extent:r.nodeExtent,a=Re(i,s,Se(o));o.internals.positionAbsolute=a}}function Sf(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const o of e.handles){const i={id:o.id,width:o.width??1,height:o.height??1,nodeId:e.id,x:o.x,y:o.y,position:o.position,type:o.type};o.type==="source"?n.push(i):o.type==="target"&&r.push(i)}return{source:n,target:r}}function wr(e){return e==="manual"}function tr(e,t,n,r={}){var u,d;const o=yr(Ef,r),i={i:0},s=new Map(t),a=o!=null&&o.elevateNodesOnSelect&&!wr(o.zIndexMode)?Zi:0;let c=e.length>0;t.clear(),n.clear();for(const l of e){let f=s.get(l.id);if(o.checkEquality&&l===(f==null?void 0:f.internals.userNode))t.set(l.id,f);else{const h=St(l,o.nodeOrigin),g=Qe(l.extent)?l.extent:o.nodeExtent,y=Re(h,g,Se(l));f={...o.defaults,...l,measured:{width:(u=l.measured)==null?void 0:u.width,height:(d=l.measured)==null?void 0:d.height},internals:{positionAbsolute:y,handleBounds:Sf(l,f),z:Qi(l,a,o.zIndexMode),userNode:l}},t.set(l.id,f)}(f.measured===void 0||f.measured.width===void 0||f.measured.height===void 0)&&!f.hidden&&(c=!1),l.parentId&&xr(f,t,n,r,i)}return c}function Mf(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function xr(e,t,n,r,o){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:c}=yr(mr,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}Mf(e,n),o&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++o.i,d.internals.z=d.internals.z+o.i*_f),o&&d.internals.rootParentIndex!==void 0&&(o.i=d.internals.rootParentIndex);const l=i&&!wr(c)?Zi:0,{x:f,y:h,z:g}=kf(e,d,s,a,l,c),{positionAbsolute:y}=e.internals,w=f!==y.x||h!==y.y;(w||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:w?{x:f,y:h}:y,z:g}})}function Qi(e,t,n){const r=he(e.zIndex)?e.zIndex:0;return wr(n)?r:r+(e.selected?t:0)}function kf(e,t,n,r,o,i){const{x:s,y:a}=t.internals.positionAbsolute,c=Se(e),u=St(e,n),d=Qe(e.extent)?Re(u,e.extent,c):u;let l=Re({x:s+d.x,y:a+d.y},r,c);e.extent==="parent"&&(l=Hi(l,c,t));const f=Qi(e,o,i),h=t.internals.z??0;return{x:l.x,y:l.y,z:h>=f?h+1:f}}function vr(e,t,n,r=[0,0]){var s;const o=[],i=new Map;for(const a of e){const c=t.get(a.parentId);if(!c)continue;const u=((s=i.get(a.parentId))==null?void 0:s.expandedRect)??Ze(c),d=Vi(u,a.rect);i.set(a.parentId,{expandedRect:d,parent:c})}return i.size>0&&i.forEach(({expandedRect:a,parent:c},u)=>{var p;const d=c.internals.positionAbsolute,l=Se(c),f=c.origin??r,h=a.x<d.x?Math.round(Math.abs(d.x-a.x)):0,g=a.y<d.y?Math.round(Math.abs(d.y-a.y)):0,y=Math.max(l.width,Math.round(a.width)),w=Math.max(l.height,Math.round(a.height)),m=(y-l.width)*f[0],b=(w-l.height)*f[1];(h>0||g>0||m||b)&&(o.push({id:u,type:"position",position:{x:c.position.x-h+m,y:c.position.y-g+b}}),(p=n.get(u))==null||p.forEach(x=>{e.some(S=>S.id===x.id)||o.push({id:x.id,type:"position",position:{x:x.position.x+h,y:x.position.y+g}})})),(l.width<a.width||l.height<a.height||h||g)&&o.push({id:u,type:"dimensions",setAttributes:!0,dimensions:{width:y+(h?f[0]*h-m:0),height:w+(g?f[1]*g-b:0)}})}),o}function Cf(e,t,n,r,o,i,s){const a=r==null?void 0:r.querySelector(".xyflow__viewport");let c=!1;if(!a)return{changes:[],updatedInternals:c};const u=[],d=window.getComputedStyle(a),{m22:l}=new window.DOMMatrixReadOnly(d.transform),f=[];for(const h of e.values()){const g=t.get(h.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const y=pr(h.nodeElement),w=g.measured.width!==y.width||g.measured.height!==y.height;if(!!(y.width&&y.height&&(w||!g.internals.handleBounds||h.force))){const b=h.nodeElement.getBoundingClientRect(),p=Qe(g.extent)?g.extent:i;let{positionAbsolute:x}=g.internals;g.parentId&&g.extent==="parent"?x=Hi(x,y,t.get(g.parentId)):p&&(x=Re(x,p,y));const S={...g,measured:y,internals:{...g.internals,positionAbsolute:x,handleBounds:{source:ro("source",h.nodeElement,b,l,g.id),target:ro("target",h.nodeElement,b,l,g.id)}}};t.set(g.id,S),g.parentId&&xr(S,t,n,{nodeOrigin:o,zIndexMode:s}),c=!0,w&&(u.push({id:g.id,type:"dimensions",dimensions:y}),g.expandParent&&g.parentId&&f.push({id:g.id,parentId:g.parentId,rect:Ze(S,o)}))}}if(f.length>0){const h=vr(f,t,n,o);u.push(...h)}return{changes:u,updatedInternals:c}}async function If({delta:e,panZoom:t,transform:n,translateExtent:r,width:o,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[o,i]],r),a=!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2]);return Promise.resolve(a)}function lo(e,t,n,r,o,i){let s=o;const a=r.get(s)||new Map;r.set(s,a.set(n,t)),s=`${o}-${e}`;const c=r.get(s)||new Map;if(r.set(s,c.set(n,t)),i){s=`${o}-${e}-${i}`;const u=r.get(s)||new Map;r.set(s,u.set(n,t))}}function Ji(e,t,n){e.clear(),t.clear();for(const r of n){const{source:o,target:i,sourceHandle:s=null,targetHandle:a=null}=r,c={edgeId:r.id,source:o,target:i,sourceHandle:s,targetHandle:a},u=`${o}-${s}--${i}-${a}`,d=`${i}-${a}--${o}-${s}`;lo("source",c,d,e,o,s),lo("target",c,u,e,i,a),t.set(r.id,r)}}function es(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:es(n,t):!1}function fo(e,t,n){var o;let r=e;do{if((o=r==null?void 0:r.matches)!=null&&o.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function Af(e,t,n,r){const o=new Map;for(const[i,s]of e)if((s.selected||s.id===r)&&(!s.parentId||!es(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const a=e.get(i);a&&o.set(i,{id:i,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return o}function In({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var s,a,c;const o=[];for(const[u,d]of t){const l=(s=n.get(u))==null?void 0:s.internals.userNode;l&&o.push({...l,position:d.position,dragging:r})}if(!e)return[o[0],o];const i=(a=n.get(e))==null?void 0:a.internals.userNode;return[i?{...i,position:((c=t.get(e))==null?void 0:c.position)||i.position,dragging:r}:o[0],o]}function $f({dragItems:e,snapGrid:t,x:n,y:r}){const o=e.values().next().value;if(!o)return null;const i={x:n-o.distance.x,y:r-o.distance.y},s=kt(i,t);return{x:s.x-i.x,y:s.y-i.y}}function Pf({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:o}){let i={x:null,y:null},s=0,a=new Map,c=!1,u={x:0,y:0},d=null,l=!1,f=null,h=!1,g=!1,y=null;function w({noDragClassName:b,handleSelector:p,domNode:x,isSelectable:S,nodeId:_,nodeClickDistance:M=0}){f=ce(x);function T({x:$,y:H}){const{nodeLookup:v,nodeExtent:I,snapGrid:E,snapToGrid:A,nodeOrigin:k,onNodeDrag:N,onSelectionDrag:D,onError:R,updateNodePositions:z}=t();i={x:$,y:H};let F=!1;const B=a.size>1,X=B&&I?Qn(Mt(a)):null,K=B&&A?$f({dragItems:a,snapGrid:E,x:$,y:H}):null;for(const[G,V]of a){if(!v.has(G))continue;let W={x:$-V.distance.x,y:H-V.distance.y};A&&(W=K?{x:Math.round(W.x+K.x),y:Math.round(W.y+K.y)}:kt(W,E));let Q=null;if(B&&I&&!V.extent&&X){const{positionAbsolute:q}=V.internals,te=q.x-X.x+I[0][0],ne=q.x+V.measured.width-X.x2+I[1][0],ee=q.y-X.y+I[0][1],se=q.y+V.measured.height-X.y2+I[1][1];Q=[[te,ee],[ne,se]]}const{position:Z,positionAbsolute:U}=Ri({nodeId:G,nextPosition:W,nodeLookup:v,nodeExtent:Q||I,nodeOrigin:k,onError:R});F=F||V.position.x!==Z.x||V.position.y!==Z.y,V.position=Z,V.internals.positionAbsolute=U}if(g=g||F,!!F&&(z(a,!0),y&&(r||N||!_&&D))){const[G,V]=In({nodeId:_,dragItems:a,nodeLookup:v});r==null||r(y,a,G,V),N==null||N(y,G,V),_||D==null||D(y,V)}}async function L(){if(!d)return;const{transform:$,panBy:H,autoPanSpeed:v,autoPanOnNodeDrag:I}=t();if(!I){c=!1,cancelAnimationFrame(s);return}const[E,A]=ji(u,d,v);(E!==0||A!==0)&&(i.x=(i.x??0)-E/$[2],i.y=(i.y??0)-A/$[2],await H({x:E,y:A})&&T(i)),s=requestAnimationFrame(L)}function j($){var B;const{nodeLookup:H,multiSelectionActive:v,nodesDraggable:I,transform:E,snapGrid:A,snapToGrid:k,selectNodesOnDrag:N,onNodeDragStart:D,onSelectionDragStart:R,unselectNodesAndEdges:z}=t();l=!0,(!N||!S)&&!v&&_&&((B=H.get(_))!=null&&B.selected||z()),S&&N&&_&&(e==null||e(_));const F=ft($.sourceEvent,{transform:E,snapGrid:A,snapToGrid:k,containerBounds:d});if(i=F,a=Af(H,I,F,_),a.size>0&&(n||D||!_&&R)){const[X,K]=In({nodeId:_,dragItems:a,nodeLookup:H});n==null||n($.sourceEvent,a,X,K),D==null||D($.sourceEvent,X,K),_||R==null||R($.sourceEvent,K)}}const C=yi().clickDistance(M).on("start",$=>{const{domNode:H,nodeDragThreshold:v,transform:I,snapGrid:E,snapToGrid:A}=t();d=(H==null?void 0:H.getBoundingClientRect())||null,h=!1,g=!1,y=$.sourceEvent,v===0&&j($),i=ft($.sourceEvent,{transform:I,snapGrid:E,snapToGrid:A,containerBounds:d}),u=ge($.sourceEvent,d)}).on("drag",$=>{const{autoPanOnNodeDrag:H,transform:v,snapGrid:I,snapToGrid:E,nodeDragThreshold:A,nodeLookup:k}=t(),N=ft($.sourceEvent,{transform:v,snapGrid:I,snapToGrid:E,containerBounds:d});if(y=$.sourceEvent,($.sourceEvent.type==="touchmove"&&$.sourceEvent.touches.length>1||_&&!k.has(_))&&(h=!0),!h){if(!c&&H&&l&&(c=!0,L()),!l){const D=ge($.sourceEvent,d),R=D.x-u.x,z=D.y-u.y;Math.sqrt(R*R+z*z)>A&&j($)}(i.x!==N.xSnapped||i.y!==N.ySnapped)&&a&&l&&(u=ge($.sourceEvent,d),T(N))}}).on("end",$=>{if(!(!l||h)&&(c=!1,l=!1,cancelAnimationFrame(s),a.size>0)){const{nodeLookup:H,updateNodePositions:v,onNodeDragStop:I,onSelectionDragStop:E}=t();if(g&&(v(a,!1),g=!1),o||I||!_&&E){const[A,k]=In({nodeId:_,dragItems:a,nodeLookup:H,dragging:!1});o==null||o($.sourceEvent,a,A,k),I==null||I($.sourceEvent,A,k),_||E==null||E($.sourceEvent,k)}}}).filter($=>{const H=$.target;return!$.button&&(!b||!fo(H,`.${b}`,x))&&(!p||fo(H,p,x))});f.call(C)}function m(){f==null||f.on(".drag",null)}return{update:w,destroy:m}}function Tf(e,t,n){const r=[],o={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())xt(o,Ze(i))>0&&r.push(i);return r}const Lf=250;function Of(e,t,n,r){var a,c;let o=[],i=1/0;const s=Tf(e,n,t+Lf);for(const u of s){const d=[...((a=u.internals.handleBounds)==null?void 0:a.source)??[],...((c=u.internals.handleBounds)==null?void 0:c.target)??[]];for(const l of d){if(r.nodeId===l.nodeId&&r.type===l.type&&r.id===l.id)continue;const{x:f,y:h}=He(u,l,l.position,!0),g=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(h-e.y,2));g>t||(g<i?(o=[{...l,x:f,y:h}],i=g):g===i&&o.push({...l,x:f,y:h}))}}if(!o.length)return null;if(o.length>1){const u=r.type==="source"?"target":"source";return o.find(d=>d.type===u)??o[0]}return o[0]}function ts(e,t,n,r,o,i=!1){var u,d,l;const s=r.get(e);if(!s)return null;const a=o==="strict"?(u=s.internals.handleBounds)==null?void 0:u[t]:[...((d=s.internals.handleBounds)==null?void 0:d.source)??[],...((l=s.internals.handleBounds)==null?void 0:l.target)??[]],c=(n?a==null?void 0:a.find(f=>f.id===n):a==null?void 0:a[0])??null;return c&&i?{...c,...He(s,c,c.position,!0)}:c}function ns(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Df(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const rs=()=>!0;function zf(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:c,lib:u,autoPanOnConnect:d,flowId:l,panBy:f,cancelConnection:h,onConnectStart:g,onConnect:y,onConnectEnd:w,isValidConnection:m=rs,onReconnectEnd:b,updateConnection:p,getTransform:x,getFromHandle:S,autoPanSpeed:_,dragThreshold:M=1,handleDomNode:T}){const L=Yi(e.target);let j=0,C;const{x:$,y:H}=ge(e),v=ns(i,T),I=a==null?void 0:a.getBoundingClientRect();let E=!1;if(!I||!v)return;const A=ts(o,v,r,c,t);if(!A)return;let k=ge(e,I),N=!1,D=null,R=!1,z=null;function F(){if(!d||!I)return;const[Z,U]=ji(k,I,_);f({x:Z,y:U}),j=requestAnimationFrame(F)}const B={...A,nodeId:o,type:v,position:A.position},X=c.get(o);let G={inProgress:!0,isValid:null,from:He(X,B,Y.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:X,to:k,toHandle:null,toPosition:Jr[B.position],toNode:null,pointer:k};function V(){E=!0,p(G),g==null||g(e,{nodeId:o,handleId:r,handleType:v})}M===0&&V();function W(Z){if(!E){const{x:se,y:Me}=ge(Z),be=se-$,$e=Me-H;if(!(be*be+$e*$e>M*M))return;V()}if(!S()||!B){Q(Z);return}const U=x();k=ge(Z,I),C=Of(Ct(k,U,!1,[1,1]),n,c,B),N||(F(),N=!0);const q=os(Z,{handle:C,connectionMode:t,fromNodeId:o,fromHandleId:r,fromType:s?"target":"source",isValidConnection:m,doc:L,lib:u,flowId:l,nodeLookup:c});z=q.handleDomNode,D=q.connection,R=Df(!!C,q.isValid);const te=c.get(o),ne=te?He(te,B,Y.Left,!0):G.from,ee={...G,from:ne,isValid:R,to:q.toHandle&&R?tn({x:q.toHandle.x,y:q.toHandle.y},U):k,toHandle:q.toHandle,toPosition:R&&q.toHandle?q.toHandle.position:Jr[B.position],toNode:q.toHandle?c.get(q.toHandle.nodeId):null,pointer:k};p(ee),G=ee}function Q(Z){if(!("touches"in Z&&Z.touches.length>0)){if(E){(C||z)&&D&&R&&(y==null||y(D));const{inProgress:U,...q}=G,te={...q,toPosition:G.toHandle?G.toPosition:null};w==null||w(Z,te),i&&(b==null||b(Z,te))}h(),cancelAnimationFrame(j),N=!1,R=!1,D=null,z=null,L.removeEventListener("mousemove",W),L.removeEventListener("mouseup",Q),L.removeEventListener("touchmove",W),L.removeEventListener("touchend",Q)}}L.addEventListener("mousemove",W),L.addEventListener("mouseup",Q),L.addEventListener("touchmove",W),L.addEventListener("touchend",Q)}function os(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:i,doc:s,lib:a,flowId:c,isValidConnection:u=rs,nodeLookup:d}){const l=i==="target",f=t?s.querySelector(`.${a}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:h,y:g}=ge(e),y=s.elementFromPoint(h,g),w=y!=null&&y.classList.contains(`${a}-flow__handle`)?y:f,m={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const b=ns(void 0,w),p=w.getAttribute("data-nodeid"),x=w.getAttribute("data-handleid"),S=w.classList.contains("connectable"),_=w.classList.contains("connectableend");if(!p||!b)return m;const M={source:l?p:r,sourceHandle:l?x:o,target:l?r:p,targetHandle:l?o:x};m.connection=M;const L=S&&_&&(n===Ke.Strict?l&&b==="source"||!l&&b==="target":p!==r||x!==o);m.isValid=L&&u(M),m.toHandle=ts(p,b,x,d,n,!0)}return m}const nr={onPointerDown:zf,isValid:os};function Rf({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const o=ce(e);function i({translateExtent:a,width:c,height:u,zoomStep:d=1,pannable:l=!0,zoomable:f=!0,inversePan:h=!1}){const g=p=>{if(p.sourceEvent.type!=="wheel"||!t)return;const x=n(),S=p.sourceEvent.ctrlKey&&vt()?10:1,_=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*d,M=x[2]*Math.pow(2,_*S);t.scaleTo(M)};let y=[0,0];const w=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(y=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},m=p=>{const x=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!t)return;const S=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],_=[S[0]-y[0],S[1]-y[1]];y=S;const M=r()*Math.max(x[2],Math.log(x[2]))*(h?-1:1),T={x:x[0]-_[0]*M,y:x[1]-_[1]*M},L=[[0,0],[c,u]];t.setViewportConstrained({x:T.x,y:T.y,zoom:x[2]},L,a)},b=Pi().on("start",w).on("zoom",l?m:null).on("zoom.wheel",f?g:null);o.call(b,{})}function s(){o.on("zoom",null)}return{update:i,destroy:s,pointer:de}}const pn=e=>({x:e.x,y:e.y,zoom:e.k}),An=({x:e,y:t,zoom:n})=>fn.translate(e,t).scale(n),Be=(e,t)=>e.target.closest(`.${t}`),is=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Hf=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,$n=(e,t=0,n=Hf,r=()=>{})=>{const o=typeof t=="number"&&t>0;return o||r(),o?e.transition().duration(t).ease(n).on("end",r):e},ss=e=>{const t=e.ctrlKey&&vt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function jf({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:u}){return d=>{if(Be(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const l=n.property("__zoom").k||1;if(d.ctrlKey&&s){const w=de(d),m=ss(d),b=l*Math.pow(2,m);r.scaleTo(n,b,w,d);return}const f=d.deltaMode===1?20:1;let h=o===Oe.Vertical?0:d.deltaX*f,g=o===Oe.Horizontal?0:d.deltaY*f;!vt()&&d.shiftKey&&o!==Oe.Vertical&&(h=d.deltaY*f,g=0),r.translateBy(n,-(h/l)*i,-(g/l)*i,{internal:!0});const y=pn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(d,y),e.panScrollTimeout=setTimeout(()=>{u==null||u(d,y),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a==null||a(d,y))}}function Vf({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,o){const i=r.type==="wheel",s=!t&&i&&!r.ctrlKey,a=Be(r,e);if(r.ctrlKey&&i&&a&&r.preventDefault(),s||a)return null;r.preventDefault(),n.call(this,r,o)}}function Ff({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,s,a;if((i=r.sourceEvent)!=null&&i.internal)return;const o=pn(r.transform);e.mouseButton=((s=r.sourceEvent)==null?void 0:s.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=o,((a=r.sourceEvent)==null?void 0:a.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,o))}}function Bf({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return i=>{var s,a;e.usedRightMouseButton=!!(n&&is(t,e.mouseButton??0)),(s=i.sourceEvent)!=null&&s.sync||r([i.transform.x,i.transform.y,i.transform.k]),o&&!((a=i.sourceEvent)!=null&&a.internal)&&(o==null||o(i.sourceEvent,pn(i.transform)))}}function Yf({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:o,onPaneContextMenu:i}){return s=>{var a;if(!((a=s.sourceEvent)!=null&&a.internal)&&(e.isZoomingOrPanning=!1,i&&is(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,r(!1),o)){const c=pn(s.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o==null||o(s.sourceEvent,c)},n?150:0)}}}function Xf({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:o,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:c,lib:u,connectionInProgress:d}){return l=>{var w;const f=e||t,h=n&&l.ctrlKey,g=l.type==="wheel";if(l.button===1&&l.type==="mousedown"&&(Be(l,`${u}-flow__node`)||Be(l,`${u}-flow__edge`)))return!0;if(!r&&!f&&!o&&!i&&!n||s||d&&!g||Be(l,a)&&g||Be(l,c)&&(!g||o&&g&&!e)||!n&&l.ctrlKey&&g)return!1;if(!n&&l.type==="touchstart"&&((w=l.touches)==null?void 0:w.length)>1)return l.preventDefault(),!1;if(!f&&!o&&!h&&g||!r&&(l.type==="mousedown"||l.type==="touchstart")||Array.isArray(r)&&!r.includes(l.button)&&l.type==="mousedown")return!1;const y=Array.isArray(r)&&r.includes(l.button)||!l.button||l.button<=1;return(!l.ctrlKey||g)&&y}}function Wf({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:o,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),l=Pi().scaleExtent([t,n]).translateExtent(r),f=ce(e).call(l);b({x:o.x,y:o.y,zoom:Ue(o.zoom,t,n)},[[0,0],[d.width,d.height]],r);const h=f.on("wheel.zoom"),g=f.on("dblclick.zoom");l.wheelDelta(ss);function y(C,$){return f?new Promise(H=>{l==null||l.interpolate(($==null?void 0:$.interpolate)==="linear"?dt:Ft).transform($n(f,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>H(!0)),C)}):Promise.resolve(!1)}function w({noWheelClassName:C,noPanClassName:$,onPaneContextMenu:H,userSelectionActive:v,panOnScroll:I,panOnDrag:E,panOnScrollMode:A,panOnScrollSpeed:k,preventScrolling:N,zoomOnPinch:D,zoomOnScroll:R,zoomOnDoubleClick:z,zoomActivationKeyPressed:F,lib:B,onTransformChange:X,connectionInProgress:K,paneClickDistance:G,selectionOnDrag:V}){v&&!u.isZoomingOrPanning&&m();const W=I&&!F&&!v;l.clickDistance(V?1/0:!he(G)||G<0?0:G);const Q=W?jf({zoomPanValues:u,noWheelClassName:C,d3Selection:f,d3Zoom:l,panOnScrollMode:A,panOnScrollSpeed:k,zoomOnPinch:D,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):Vf({noWheelClassName:C,preventScrolling:N,d3ZoomHandler:h});if(f.on("wheel.zoom",Q,{passive:!1}),!v){const U=Ff({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:s});l.on("start",U);const q=Bf({zoomPanValues:u,panOnDrag:E,onPaneContextMenu:!!H,onPanZoom:i,onTransformChange:X});l.on("zoom",q);const te=Yf({zoomPanValues:u,panOnDrag:E,panOnScroll:I,onPaneContextMenu:H,onPanZoomEnd:a,onDraggingChange:c});l.on("end",te)}const Z=Xf({zoomActivationKeyPressed:F,panOnDrag:E,zoomOnScroll:R,panOnScroll:I,zoomOnDoubleClick:z,zoomOnPinch:D,userSelectionActive:v,noPanClassName:$,noWheelClassName:C,lib:B,connectionInProgress:K});l.filter(Z),z?f.on("dblclick.zoom",g):f.on("dblclick.zoom",null)}function m(){l.on("zoom",null)}async function b(C,$,H){const v=An(C),I=l==null?void 0:l.constrain()(v,$,H);return I&&await y(I),new Promise(E=>E(I))}async function p(C,$){const H=An(C);return await y(H,$),new Promise(v=>v(H))}function x(C){if(f){const $=An(C),H=f.property("__zoom");(H.k!==C.zoom||H.x!==C.x||H.y!==C.y)&&(l==null||l.transform(f,$,null,{sync:!0}))}}function S(){const C=f?$i(f.node()):{x:0,y:0,k:1};return{x:C.x,y:C.y,zoom:C.k}}function _(C,$){return f?new Promise(H=>{l==null||l.interpolate(($==null?void 0:$.interpolate)==="linear"?dt:Ft).scaleTo($n(f,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>H(!0)),C)}):Promise.resolve(!1)}function M(C,$){return f?new Promise(H=>{l==null||l.interpolate(($==null?void 0:$.interpolate)==="linear"?dt:Ft).scaleBy($n(f,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>H(!0)),C)}):Promise.resolve(!1)}function T(C){l==null||l.scaleExtent(C)}function L(C){l==null||l.translateExtent(C)}function j(C){const $=!he(C)||C<0?0:C;l==null||l.clickDistance($)}return{update:w,destroy:m,setViewport:p,setViewportConstrained:b,getViewport:S,scaleTo:_,scaleBy:M,setScaleExtent:T,setTranslateExtent:L,syncViewport:x,setClickDistance:j}}var Je;(function(e){e.Line="line",e.Handle="handle"})(Je||(Je={}));function Gf({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:o,affectsY:i}){const s=e-t,a=n-r,c=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&o&&(c[0]=c[0]*-1),a&&i&&(c[1]=c[1]*-1),c}function ho(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),o=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:o}}function ke(e,t){return Math.max(0,t-e)}function Ce(e,t){return Math.max(0,e-t)}function Rt(e,t,n){return Math.max(0,t-e,e-n)}function go(e,t){return e?!t:t}function qf(e,t,n,r,o,i,s,a){let{affectsX:c,affectsY:u}=t;const{isHorizontal:d,isVertical:l}=t,f=d&&l,{xSnapped:h,ySnapped:g}=n,{minWidth:y,maxWidth:w,minHeight:m,maxHeight:b}=r,{x:p,y:x,width:S,height:_,aspectRatio:M}=e;let T=Math.floor(d?h-e.pointerX:0),L=Math.floor(l?g-e.pointerY:0);const j=S+(c?-T:T),C=_+(u?-L:L),$=-i[0]*S,H=-i[1]*_;let v=Rt(j,y,w),I=Rt(C,m,b);if(s){let k=0,N=0;c&&T<0?k=ke(p+T+$,s[0][0]):!c&&T>0&&(k=Ce(p+j+$,s[1][0])),u&&L<0?N=ke(x+L+H,s[0][1]):!u&&L>0&&(N=Ce(x+C+H,s[1][1])),v=Math.max(v,k),I=Math.max(I,N)}if(a){let k=0,N=0;c&&T>0?k=Ce(p+T,a[0][0]):!c&&T<0&&(k=ke(p+j,a[1][0])),u&&L>0?N=Ce(x+L,a[0][1]):!u&&L<0&&(N=ke(x+C,a[1][1])),v=Math.max(v,k),I=Math.max(I,N)}if(o){if(d){const k=Rt(j/M,m,b)*M;if(v=Math.max(v,k),s){let N=0;!c&&!u||c&&!u&&f?N=Ce(x+H+j/M,s[1][1])*M:N=ke(x+H+(c?T:-T)/M,s[0][1])*M,v=Math.max(v,N)}if(a){let N=0;!c&&!u||c&&!u&&f?N=ke(x+j/M,a[1][1])*M:N=Ce(x+(c?T:-T)/M,a[0][1])*M,v=Math.max(v,N)}}if(l){const k=Rt(C*M,y,w)/M;if(I=Math.max(I,k),s){let N=0;!c&&!u||u&&!c&&f?N=Ce(p+C*M+$,s[1][0])/M:N=ke(p+(u?L:-L)*M+$,s[0][0])/M,I=Math.max(I,N)}if(a){let N=0;!c&&!u||u&&!c&&f?N=ke(p+C*M,a[1][0])/M:N=Ce(p+(u?L:-L)*M,a[0][0])/M,I=Math.max(I,N)}}}L=L+(L<0?I:-I),T=T+(T<0?v:-v),o&&(f?j>C*M?L=(go(c,u)?-T:T)/M:T=(go(c,u)?-L:L)*M:d?(L=T/M,u=c):(T=L*M,c=u));const E=c?p+T:p,A=u?x+L:x;return{width:S+(c?-T:T),height:_+(u?-L:L),x:i[0]*T*(c?-1:1)+E,y:i[1]*L*(u?-1:1)+A}}const as={width:0,height:0,x:0,y:0},Kf={...as,pointerX:0,pointerY:0,aspectRatio:1};function Uf(e){return[[0,0],[e.measured.width,e.measured.height]]}function Zf(e,t,n){const r=t.position.x+e.position.x,o=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,c=n[1]*s;return[[r-a,o-c],[r+i-a,o+s-c]]}function Qf({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){const i=ce(e);let s={controlDirection:ho("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:u,boundaries:d,keepAspectRatio:l,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:y,shouldResize:w}){let m={...as},b={...Kf};s={boundaries:d,resizeDirection:f,keepAspectRatio:l,controlDirection:ho(u)};let p,x=null,S=[],_,M,T,L=!1;const j=yi().on("start",C=>{const{nodeLookup:$,transform:H,snapGrid:v,snapToGrid:I,nodeOrigin:E,paneDomNode:A}=n();if(p=$.get(t),!p)return;x=(A==null?void 0:A.getBoundingClientRect())??null;const{xSnapped:k,ySnapped:N}=ft(C.sourceEvent,{transform:H,snapGrid:v,snapToGrid:I,containerBounds:x});m={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},b={...m,pointerX:k,pointerY:N,aspectRatio:m.width/m.height},_=void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(_=$.get(p.parentId),M=_&&p.extent==="parent"?Uf(_):void 0),S=[],T=void 0;for(const[D,R]of $)if(R.parentId===t&&(S.push({id:D,position:{...R.position},extent:R.extent}),R.extent==="parent"||R.expandParent)){const z=Zf(R,p,R.origin??E);T?T=[[Math.min(z[0][0],T[0][0]),Math.min(z[0][1],T[0][1])],[Math.max(z[1][0],T[1][0]),Math.max(z[1][1],T[1][1])]]:T=z}h==null||h(C,{...m})}).on("drag",C=>{const{transform:$,snapGrid:H,snapToGrid:v,nodeOrigin:I}=n(),E=ft(C.sourceEvent,{transform:$,snapGrid:H,snapToGrid:v,containerBounds:x}),A=[];if(!p)return;const{x:k,y:N,width:D,height:R}=m,z={},F=p.origin??I,{width:B,height:X,x:K,y:G}=qf(b,s.controlDirection,E,s.boundaries,s.keepAspectRatio,F,M,T),V=B!==D,W=X!==R,Q=K!==k&&V,Z=G!==N&&W;if(!Q&&!Z&&!V&&!W)return;if((Q||Z||F[0]===1||F[1]===1)&&(z.x=Q?K:m.x,z.y=Z?G:m.y,m.x=z.x,m.y=z.y,S.length>0)){const ne=K-k,ee=G-N;for(const se of S)se.position={x:se.position.x-ne+F[0]*(B-D),y:se.position.y-ee+F[1]*(X-R)},A.push(se)}if((V||W)&&(z.width=V&&(!s.resizeDirection||s.resizeDirection==="horizontal")?B:m.width,z.height=W&&(!s.resizeDirection||s.resizeDirection==="vertical")?X:m.height,m.width=z.width,m.height=z.height),_&&p.expandParent){const ne=F[0]*(z.width??0);z.x&&z.x<ne&&(m.x=ne,b.x=b.x-(z.x-ne));const ee=F[1]*(z.height??0);z.y&&z.y<ee&&(m.y=ee,b.y=b.y-(z.y-ee))}const U=Gf({width:m.width,prevWidth:D,height:m.height,prevHeight:R,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),q={...m,direction:U};(w==null?void 0:w(C,q))!==!1&&(L=!0,g==null||g(C,q),r(z,A))}).on("end",C=>{L&&(y==null||y(C,{...m}),o==null||o({...m}),L=!1)});i.call(j)}function c(){i.on(".drag",null)}return{update:a,destroy:c}}var Pn={exports:{}},Tn={},Ln={exports:{}},On={};/**
1
+ import{R as wc,r as O,j as P}from"./index-Cpx47jCH.js";import{r as ni,g as xc}from"./react-CRB3T2We.js";function ie(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=ie(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var vc={value:()=>{}};function cn(){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 Vt(n)}function Vt(e){this._=e}function bc(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",o=n.indexOf(".");if(o>=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Vt.prototype=cn.prototype={constructor:Vt,on:function(e,t){var n=this._,r=bc(e+"",n),o,i=-1,s=r.length;if(arguments.length<2){for(;++i<s;)if((o=(e=r[i]).type)&&(o=_c(n[o],e.name)))return o;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(o=(e=r[i]).type)n[o]=Dr(n[o],e.name,t);else if(t==null)for(o in n)n[o]=Dr(n[o],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Vt(e)},call:function(e,t){if((o=arguments.length-2)>0)for(var n=new Array(o),r=0,o,i;r<o;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,o=i.length;r<o;++r)i[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],o=0,i=r.length;o<i;++o)r[o].value.apply(t,n)}};function _c(e,t){for(var n=0,r=e.length,o;n<r;++n)if((o=e[n]).name===t)return o.value}function Dr(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=vc,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Yn="http://www.w3.org/1999/xhtml";const zr={svg:"http://www.w3.org/2000/svg",xhtml:Yn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function un(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),zr.hasOwnProperty(t)?{space:zr[t],local:e}:e}function Ec(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Yn&&t.documentElement.namespaceURI===Yn?t.createElement(e):t.createElementNS(n,e)}}function Nc(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ri(e){var t=un(e);return(t.local?Nc:Ec)(t)}function Sc(){}function ir(e){return e==null?Sc:function(){return this.querySelector(e)}}function Mc(e){typeof e!="function"&&(e=ir(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,a=r[o]=new Array(s),c,u,d=0;d<s;++d)(c=i[d])&&(u=e.call(c,c.__data__,d,i))&&("__data__"in c&&(u.__data__=c.__data__),a[d]=u);return new ue(r,this._parents)}function kc(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Cc(){return[]}function oi(e){return e==null?Cc:function(){return this.querySelectorAll(e)}}function Ic(e){return function(){return kc(e.apply(this,arguments))}}function Ac(e){typeof e=="function"?e=Ic(e):e=oi(e);for(var t=this._groups,n=t.length,r=[],o=[],i=0;i<n;++i)for(var s=t[i],a=s.length,c,u=0;u<a;++u)(c=s[u])&&(r.push(e.call(c,c.__data__,u,s)),o.push(c));return new ue(r,o)}function ii(e){return function(){return this.matches(e)}}function si(e){return function(t){return t.matches(e)}}var $c=Array.prototype.find;function Pc(e){return function(){return $c.call(this.children,e)}}function Tc(){return this.firstElementChild}function Lc(e){return this.select(e==null?Tc:Pc(typeof e=="function"?e:si(e)))}var Oc=Array.prototype.filter;function Dc(){return Array.from(this.children)}function zc(e){return function(){return Oc.call(this.children,e)}}function Rc(e){return this.selectAll(e==null?Dc:zc(typeof e=="function"?e:si(e)))}function Hc(e){typeof e!="function"&&(e=ii(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,a=r[o]=[],c,u=0;u<s;++u)(c=i[u])&&e.call(c,c.__data__,u,i)&&a.push(c);return new ue(r,this._parents)}function ai(e){return new Array(e.length)}function jc(){return new ue(this._enter||this._groups.map(ai),this._parents)}function Wt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Wt.prototype={constructor:Wt,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Vc(e){return function(){return e}}function Fc(e,t,n,r,o,i){for(var s=0,a,c=t.length,u=i.length;s<u;++s)(a=t[s])?(a.__data__=i[s],r[s]=a):n[s]=new Wt(e,i[s]);for(;s<c;++s)(a=t[s])&&(o[s]=a)}function Bc(e,t,n,r,o,i,s){var a,c,u=new Map,d=t.length,l=i.length,f=new Array(d),h;for(a=0;a<d;++a)(c=t[a])&&(f[a]=h=s.call(c,c.__data__,a,t)+"",u.has(h)?o[a]=c:u.set(h,c));for(a=0;a<l;++a)h=s.call(e,i[a],a,i)+"",(c=u.get(h))?(r[a]=c,c.__data__=i[a],u.delete(h)):n[a]=new Wt(e,i[a]);for(a=0;a<d;++a)(c=t[a])&&u.get(f[a])===c&&(o[a]=c)}function Yc(e){return e.__data__}function Xc(e,t){if(!arguments.length)return Array.from(this,Yc);var n=t?Bc:Fc,r=this._parents,o=this._groups;typeof e!="function"&&(e=Vc(e));for(var i=o.length,s=new Array(i),a=new Array(i),c=new Array(i),u=0;u<i;++u){var d=r[u],l=o[u],f=l.length,h=Wc(e.call(d,d&&d.__data__,u,r)),g=h.length,y=a[u]=new Array(g),w=s[u]=new Array(g),m=c[u]=new Array(f);n(d,l,y,w,m,h,t);for(var b=0,p=0,x,S;b<g;++b)if(x=y[b]){for(b>=p&&(p=b+1);!(S=w[p])&&++p<g;);x._next=S||null}}return s=new ue(s,r),s._enter=a,s._exit=c,s}function Wc(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Gc(){return new ue(this._exit||this._groups.map(ai),this._parents)}function qc(e,t,n){var r=this.enter(),o=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(o=t(o),o&&(o=o.selection())),n==null?i.remove():n(i),r&&o?r.merge(o).order():o}function Kc(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,o=n.length,i=r.length,s=Math.min(o,i),a=new Array(o),c=0;c<s;++c)for(var u=n[c],d=r[c],l=u.length,f=a[c]=new Array(l),h,g=0;g<l;++g)(h=u[g]||d[g])&&(f[g]=h);for(;c<o;++c)a[c]=n[c];return new ue(a,this._parents)}function Uc(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],o=r.length-1,i=r[o],s;--o>=0;)(s=r[o])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function Zc(e){e||(e=Qc);function t(l,f){return l&&f?e(l.__data__,f.__data__):!l-!f}for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i){for(var s=n[i],a=s.length,c=o[i]=new Array(a),u,d=0;d<a;++d)(u=s[d])&&(c[d]=u);c.sort(t)}return new ue(o,this._parents).order()}function Qc(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Jc(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function eu(){return Array.from(this)}function tu(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length;o<i;++o){var s=r[o];if(s)return s}return null}function nu(){let e=0;for(const t of this)++e;return e}function ru(){return!this.node()}function ou(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var o=t[n],i=0,s=o.length,a;i<s;++i)(a=o[i])&&e.call(a,a.__data__,i,o);return this}function iu(e){return function(){this.removeAttribute(e)}}function su(e){return function(){this.removeAttributeNS(e.space,e.local)}}function au(e,t){return function(){this.setAttribute(e,t)}}function cu(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function uu(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function lu(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function du(e,t){var n=un(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?su:iu:typeof t=="function"?n.local?lu:uu:n.local?cu:au)(n,t))}function ci(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function fu(e){return function(){this.style.removeProperty(e)}}function hu(e,t,n){return function(){this.style.setProperty(e,t,n)}}function gu(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function pu(e,t,n){return arguments.length>1?this.each((t==null?fu:typeof t=="function"?gu:hu)(e,t,n??"")):Ge(this.node(),e)}function Ge(e,t){return e.style.getPropertyValue(t)||ci(e).getComputedStyle(e,null).getPropertyValue(t)}function mu(e){return function(){delete this[e]}}function yu(e,t){return function(){this[e]=t}}function wu(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function xu(e,t){return arguments.length>1?this.each((t==null?mu:typeof t=="function"?wu:yu)(e,t)):this.node()[e]}function ui(e){return e.trim().split(/^|\s+/)}function sr(e){return e.classList||new li(e)}function li(e){this._node=e,this._names=ui(e.getAttribute("class")||"")}li.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function di(e,t){for(var n=sr(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function fi(e,t){for(var n=sr(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function vu(e){return function(){di(this,e)}}function bu(e){return function(){fi(this,e)}}function _u(e,t){return function(){(t.apply(this,arguments)?di:fi)(this,e)}}function Eu(e,t){var n=ui(e+"");if(arguments.length<2){for(var r=sr(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof t=="function"?_u:t?vu:bu)(n,t))}function Nu(){this.textContent=""}function Su(e){return function(){this.textContent=e}}function Mu(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function ku(e){return arguments.length?this.each(e==null?Nu:(typeof e=="function"?Mu:Su)(e)):this.node().textContent}function Cu(){this.innerHTML=""}function Iu(e){return function(){this.innerHTML=e}}function Au(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function $u(e){return arguments.length?this.each(e==null?Cu:(typeof e=="function"?Au:Iu)(e)):this.node().innerHTML}function Pu(){this.nextSibling&&this.parentNode.appendChild(this)}function Tu(){return this.each(Pu)}function Lu(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ou(){return this.each(Lu)}function Du(e){var t=typeof e=="function"?e:ri(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function zu(){return null}function Ru(e,t){var n=typeof e=="function"?e:ri(e),r=t==null?zu:typeof t=="function"?t:ir(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Hu(){var e=this.parentNode;e&&e.removeChild(this)}function ju(){return this.each(Hu)}function Vu(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Fu(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Bu(e){return this.select(e?Fu:Vu)}function Yu(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Xu(e){return function(t){e.call(this,t,this.__data__)}}function Wu(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}})}function Gu(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,o=t.length,i;n<o;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function qu(e,t,n){return function(){var r=this.__on,o,i=Xu(t);if(r){for(var s=0,a=r.length;s<a;++s)if((o=r[s]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),o.value=t;return}}this.addEventListener(e.type,i,n),o={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(o):this.__on=[o]}}function Ku(e,t,n){var r=Wu(e+""),o,i=r.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,u=a.length,d;c<u;++c)for(o=0,d=a[c];o<i;++o)if((s=r[o]).type===d.type&&s.name===d.name)return d.value}return}for(a=t?qu:Gu,o=0;o<i;++o)this.each(a(r[o],t,n));return this}function hi(e,t,n){var r=ci(e),o=r.CustomEvent;typeof o=="function"?o=new o(t,n):(o=r.document.createEvent("Event"),n?(o.initEvent(t,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(t,!1,!1)),e.dispatchEvent(o)}function Uu(e,t){return function(){return hi(this,e,t)}}function Zu(e,t){return function(){return hi(this,e,t.apply(this,arguments))}}function Qu(e,t){return this.each((typeof t=="function"?Zu:Uu)(e,t))}function*Ju(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length,s;o<i;++o)(s=r[o])&&(yield s)}var gi=[null];function ue(e,t){this._groups=e,this._parents=t}function Et(){return new ue([[document.documentElement]],gi)}function el(){return this}ue.prototype=Et.prototype={constructor:ue,select:Mc,selectAll:Ac,selectChild:Lc,selectChildren:Rc,filter:Hc,data:Xc,enter:jc,exit:Gc,join:qc,merge:Kc,selection:el,order:Uc,sort:Zc,call:Jc,nodes:eu,node:tu,size:nu,empty:ru,each:ou,attr:du,style:pu,property:xu,classed:Eu,text:ku,html:$u,raise:Tu,lower:Ou,append:Du,insert:Ru,remove:ju,clone:Bu,datum:Yu,on:Ku,dispatch:Qu,[Symbol.iterator]:Ju};function ce(e){return typeof e=="string"?new ue([[document.querySelector(e)]],[document.documentElement]):new ue([[e]],gi)}function tl(e){let t;for(;t=e.sourceEvent;)e=t;return e}function de(e,t){if(e=tl(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 o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}const nl={passive:!1},ht={capture:!0,passive:!1};function Sn(e){e.stopImmediatePropagation()}function Xe(e){e.preventDefault(),e.stopImmediatePropagation()}function pi(e){var t=e.document.documentElement,n=ce(e).on("dragstart.drag",Xe,ht);"onselectstart"in t?n.on("selectstart.drag",Xe,ht):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function mi(e,t){var n=e.document.documentElement,r=ce(e).on("dragstart.drag",null);t&&(r.on("click.drag",Xe,ht),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Pt=e=>()=>e;function Xn(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:i,x:s,y:a,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:o,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}Xn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function rl(e){return!e.ctrlKey&&!e.button}function ol(){return this.parentNode}function il(e,t){return t??{x:e.x,y:e.y}}function sl(){return navigator.maxTouchPoints||"ontouchstart"in this}function yi(){var e=rl,t=ol,n=il,r=sl,o={},i=cn("start","drag","end"),s=0,a,c,u,d,l=0;function f(x){x.on("mousedown.drag",h).filter(r).on("touchstart.drag",w).on("touchmove.drag",m,nl).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(x,S){if(!(d||!e.call(this,x,S))){var _=p(this,t.call(this,x,S),x,S,"mouse");_&&(ce(x.view).on("mousemove.drag",g,ht).on("mouseup.drag",y,ht),pi(x.view),Sn(x),u=!1,a=x.clientX,c=x.clientY,_("start",x))}}function g(x){if(Xe(x),!u){var S=x.clientX-a,_=x.clientY-c;u=S*S+_*_>l}o.mouse("drag",x)}function y(x){ce(x.view).on("mousemove.drag mouseup.drag",null),mi(x.view,u),Xe(x),o.mouse("end",x)}function w(x,S){if(e.call(this,x,S)){var _=x.changedTouches,M=t.call(this,x,S),T=_.length,L,j;for(L=0;L<T;++L)(j=p(this,M,x,S,_[L].identifier,_[L]))&&(Sn(x),j("start",x,_[L]))}}function m(x){var S=x.changedTouches,_=S.length,M,T;for(M=0;M<_;++M)(T=o[S[M].identifier])&&(Xe(x),T("drag",x,S[M]))}function b(x){var S=x.changedTouches,_=S.length,M,T;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),M=0;M<_;++M)(T=o[S[M].identifier])&&(Sn(x),T("end",x,S[M]))}function p(x,S,_,M,T,L){var j=i.copy(),C=de(L||_,S),$,H,v;if((v=n.call(x,new Xn("beforestart",{sourceEvent:_,target:f,identifier:T,active:s,x:C[0],y:C[1],dx:0,dy:0,dispatch:j}),M))!=null)return $=v.x-C[0]||0,H=v.y-C[1]||0,function I(E,A,k){var N=C,D;switch(E){case"start":o[T]=I,D=s++;break;case"end":delete o[T],--s;case"drag":C=de(k||A,S),D=s;break}j.call(E,x,new Xn(E,{sourceEvent:A,subject:v,target:f,identifier:T,active:D,x:C[0]+$,y:C[1]+H,dx:C[0]-N[0],dy:C[1]-N[1],dispatch:j}),M)}}return f.filter=function(x){return arguments.length?(e=typeof x=="function"?x:Pt(!!x),f):e},f.container=function(x){return arguments.length?(t=typeof x=="function"?x:Pt(x),f):t},f.subject=function(x){return arguments.length?(n=typeof x=="function"?x:Pt(x),f):n},f.touchable=function(x){return arguments.length?(r=typeof x=="function"?x:Pt(!!x),f):r},f.on=function(){var x=i.on.apply(i,arguments);return x===i?f:x},f.clickDistance=function(x){return arguments.length?(l=(x=+x)*x,f):Math.sqrt(l)},f}function ar(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function wi(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Nt(){}var gt=.7,Gt=1/gt,We="\\s*([+-]?\\d+)\\s*",pt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",we="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",al=/^#([0-9a-f]{3,8})$/,cl=new RegExp(`^rgb\\(${We},${We},${We}\\)$`),ul=new RegExp(`^rgb\\(${we},${we},${we}\\)$`),ll=new RegExp(`^rgba\\(${We},${We},${We},${pt}\\)$`),dl=new RegExp(`^rgba\\(${we},${we},${we},${pt}\\)$`),fl=new RegExp(`^hsl\\(${pt},${we},${we}\\)$`),hl=new RegExp(`^hsla\\(${pt},${we},${we},${pt}\\)$`),Rr={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};ar(Nt,De,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Hr,formatHex:Hr,formatHex8:gl,formatHsl:pl,formatRgb:jr,toString:jr});function Hr(){return this.rgb().formatHex()}function gl(){return this.rgb().formatHex8()}function pl(){return xi(this).formatHsl()}function jr(){return this.rgb().formatRgb()}function De(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=al.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Vr(t):n===3?new ae(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Tt(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Tt(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=cl.exec(e))?new ae(t[1],t[2],t[3],1):(t=ul.exec(e))?new ae(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=ll.exec(e))?Tt(t[1],t[2],t[3],t[4]):(t=dl.exec(e))?Tt(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=fl.exec(e))?Yr(t[1],t[2]/100,t[3]/100,1):(t=hl.exec(e))?Yr(t[1],t[2]/100,t[3]/100,t[4]):Rr.hasOwnProperty(e)?Vr(Rr[e]):e==="transparent"?new ae(NaN,NaN,NaN,0):null}function Vr(e){return new ae(e>>16&255,e>>8&255,e&255,1)}function Tt(e,t,n,r){return r<=0&&(e=t=n=NaN),new ae(e,t,n,r)}function ml(e){return e instanceof Nt||(e=De(e)),e?(e=e.rgb(),new ae(e.r,e.g,e.b,e.opacity)):new ae}function Wn(e,t,n,r){return arguments.length===1?ml(e):new ae(e,t,n,r??1)}function ae(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}ar(ae,Wn,wi(Nt,{brighter(e){return e=e==null?Gt:Math.pow(Gt,e),new ae(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?gt:Math.pow(gt,e),new ae(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ae(Le(this.r),Le(this.g),Le(this.b),qt(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Fr,formatHex:Fr,formatHex8:yl,formatRgb:Br,toString:Br}));function Fr(){return`#${Te(this.r)}${Te(this.g)}${Te(this.b)}`}function yl(){return`#${Te(this.r)}${Te(this.g)}${Te(this.b)}${Te((isNaN(this.opacity)?1:this.opacity)*255)}`}function Br(){const e=qt(this.opacity);return`${e===1?"rgb(":"rgba("}${Le(this.r)}, ${Le(this.g)}, ${Le(this.b)}${e===1?")":`, ${e})`}`}function qt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Le(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Te(e){return e=Le(e),(e<16?"0":"")+e.toString(16)}function Yr(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new fe(e,t,n,r)}function xi(e){if(e instanceof fe)return new fe(e.h,e.s,e.l,e.opacity);if(e instanceof Nt||(e=De(e)),!e)return new fe;if(e instanceof fe)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),i=Math.max(t,n,r),s=NaN,a=i-o,c=(i+o)/2;return a?(t===i?s=(n-r)/a+(n<r)*6:n===i?s=(r-t)/a+2:s=(t-n)/a+4,a/=c<.5?i+o:2-i-o,s*=60):a=c>0&&c<1?0:s,new fe(s,a,c,e.opacity)}function wl(e,t,n,r){return arguments.length===1?xi(e):new fe(e,t,n,r??1)}function fe(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}ar(fe,wl,wi(Nt,{brighter(e){return e=e==null?Gt:Math.pow(Gt,e),new fe(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?gt:Math.pow(gt,e),new fe(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,o=2*n-r;return new ae(Mn(e>=240?e-240:e+120,o,r),Mn(e,o,r),Mn(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new fe(Xr(this.h),Lt(this.s),Lt(this.l),qt(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=qt(this.opacity);return`${e===1?"hsl(":"hsla("}${Xr(this.h)}, ${Lt(this.s)*100}%, ${Lt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Xr(e){return e=(e||0)%360,e<0?e+360:e}function Lt(e){return Math.max(0,Math.min(1,e||0))}function Mn(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const cr=e=>()=>e;function xl(e,t){return function(n){return e+n*t}}function vl(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function bl(e){return(e=+e)==1?vi:function(t,n){return n-t?vl(t,n,e):cr(isNaN(t)?n:t)}}function vi(e,t){var n=t-e;return n?xl(e,n):cr(isNaN(e)?t:e)}const Kt=(function e(t){var n=bl(t);function r(o,i){var s=n((o=Wn(o)).r,(i=Wn(i)).r),a=n(o.g,i.g),c=n(o.b,i.b),u=vi(o.opacity,i.opacity);return function(d){return o.r=s(d),o.g=a(d),o.b=c(d),o.opacity=u(d),o+""}}return r.gamma=e,r})(1);function _l(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),o;return function(i){for(o=0;o<n;++o)r[o]=e[o]*(1-i)+t[o]*i;return r}}function El(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Nl(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,o=new Array(r),i=new Array(n),s;for(s=0;s<r;++s)o[s]=dt(e[s],t[s]);for(;s<n;++s)i[s]=t[s];return function(a){for(s=0;s<r;++s)i[s]=o[s](a);return i}}function Sl(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function me(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Ml(e,t){var n={},r={},o;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(o in t)o in e?n[o]=dt(e[o],t[o]):r[o]=t[o];return function(i){for(o in n)r[o]=n[o](i);return r}}var Gn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,kn=new RegExp(Gn.source,"g");function kl(e){return function(){return e}}function Cl(e){return function(t){return e(t)+""}}function bi(e,t){var n=Gn.lastIndex=kn.lastIndex=0,r,o,i,s=-1,a=[],c=[];for(e=e+"",t=t+"";(r=Gn.exec(e))&&(o=kn.exec(t));)(i=o.index)>n&&(i=t.slice(n,i),a[s]?a[s]+=i:a[++s]=i),(r=r[0])===(o=o[0])?a[s]?a[s]+=o:a[++s]=o:(a[++s]=null,c.push({i:s,x:me(r,o)})),n=kn.lastIndex;return n<t.length&&(i=t.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?c[0]?Cl(c[0].x):kl(t):(t=c.length,function(u){for(var d=0,l;d<t;++d)a[(l=c[d]).i]=l.x(u);return a.join("")})}function dt(e,t){var n=typeof t,r;return t==null||n==="boolean"?cr(t):(n==="number"?me:n==="string"?(r=De(t))?(t=r,Kt):bi:t instanceof De?Kt:t instanceof Date?Sl:El(t)?_l:Array.isArray(t)?Nl:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Ml:me)(e,t)}var Wr=180/Math.PI,qn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function _i(e,t,n,r,o,i){var s,a,c;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),e*r<t*n&&(e=-e,t=-t,c=-c,s=-s),{translateX:o,translateY:i,rotate:Math.atan2(t,e)*Wr,skewX:Math.atan(c)*Wr,scaleX:s,scaleY:a}}var Ot;function Il(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?qn:_i(t.a,t.b,t.c,t.d,t.e,t.f)}function Al(e){return e==null||(Ot||(Ot=document.createElementNS("http://www.w3.org/2000/svg","g")),Ot.setAttribute("transform",e),!(e=Ot.transform.baseVal.consolidate()))?qn:(e=e.matrix,_i(e.a,e.b,e.c,e.d,e.e,e.f))}function Ei(e,t,n,r){function o(u){return u.length?u.pop()+" ":""}function i(u,d,l,f,h,g){if(u!==l||d!==f){var y=h.push("translate(",null,t,null,n);g.push({i:y-4,x:me(u,l)},{i:y-2,x:me(d,f)})}else(l||f)&&h.push("translate("+l+t+f+n)}function s(u,d,l,f){u!==d?(u-d>180?d+=360:d-u>180&&(u+=360),f.push({i:l.push(o(l)+"rotate(",null,r)-2,x:me(u,d)})):d&&l.push(o(l)+"rotate("+d+r)}function a(u,d,l,f){u!==d?f.push({i:l.push(o(l)+"skewX(",null,r)-2,x:me(u,d)}):d&&l.push(o(l)+"skewX("+d+r)}function c(u,d,l,f,h,g){if(u!==l||d!==f){var y=h.push(o(h)+"scale(",null,",",null,")");g.push({i:y-4,x:me(u,l)},{i:y-2,x:me(d,f)})}else(l!==1||f!==1)&&h.push(o(h)+"scale("+l+","+f+")")}return function(u,d){var l=[],f=[];return u=e(u),d=e(d),i(u.translateX,u.translateY,d.translateX,d.translateY,l,f),s(u.rotate,d.rotate,l,f),a(u.skewX,d.skewX,l,f),c(u.scaleX,u.scaleY,d.scaleX,d.scaleY,l,f),u=d=null,function(h){for(var g=-1,y=f.length,w;++g<y;)l[(w=f[g]).i]=w.x(h);return l.join("")}}}var $l=Ei(Il,"px, ","px)","deg)"),Pl=Ei(Al,", ",")",")"),Tl=1e-12;function Gr(e){return((e=Math.exp(e))+1/e)/2}function Ll(e){return((e=Math.exp(e))-1/e)/2}function Ol(e){return((e=Math.exp(2*e))-1)/(e+1)}const Ft=(function e(t,n,r){function o(i,s){var a=i[0],c=i[1],u=i[2],d=s[0],l=s[1],f=s[2],h=d-a,g=l-c,y=h*h+g*g,w,m;if(y<Tl)m=Math.log(f/u)/t,w=function(M){return[a+M*h,c+M*g,u*Math.exp(t*M*m)]};else{var b=Math.sqrt(y),p=(f*f-u*u+r*y)/(2*u*n*b),x=(f*f-u*u-r*y)/(2*f*n*b),S=Math.log(Math.sqrt(p*p+1)-p),_=Math.log(Math.sqrt(x*x+1)-x);m=(_-S)/t,w=function(M){var T=M*m,L=Gr(S),j=u/(n*b)*(L*Ol(t*T+S)-Ll(S));return[a+j*h,c+j*g,u*L/Gr(t*T+S)]}}return w.duration=m*1e3*t/Math.SQRT2,w}return o.rho=function(i){var s=Math.max(.001,+i),a=s*s,c=a*a;return e(s,a,c)},o})(Math.SQRT2,2,4);var qe=0,ct=0,st=0,Ni=1e3,Ut,ut,Zt=0,ze=0,ln=0,mt=typeof performance=="object"&&performance.now?performance:Date,Si=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function ur(){return ze||(Si(Dl),ze=mt.now()+ln)}function Dl(){ze=0}function Qt(){this._call=this._time=this._next=null}Qt.prototype=Mi.prototype={constructor:Qt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?ur():+n)+(t==null?0:+t),!this._next&&ut!==this&&(ut?ut._next=this:Ut=this,ut=this),this._call=e,this._time=n,Kn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Kn())}};function Mi(e,t,n){var r=new Qt;return r.restart(e,t,n),r}function zl(){ur(),++qe;for(var e=Ut,t;e;)(t=ze-e._time)>=0&&e._call.call(void 0,t),e=e._next;--qe}function qr(){ze=(Zt=mt.now())+ln,qe=ct=0;try{zl()}finally{qe=0,Hl(),ze=0}}function Rl(){var e=mt.now(),t=e-Zt;t>Ni&&(ln-=t,Zt=e)}function Hl(){for(var e,t=Ut,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:Ut=n);ut=e,Kn(r)}function Kn(e){if(!qe){ct&&(ct=clearTimeout(ct));var t=e-ze;t>24?(e<1/0&&(ct=setTimeout(qr,e-mt.now()-ln)),st&&(st=clearInterval(st))):(st||(Zt=mt.now(),st=setInterval(Rl,Ni)),qe=1,Si(qr))}}function Kr(e,t,n){var r=new Qt;return t=t==null?0:+t,r.restart(o=>{r.stop(),e(o+t)},t,n),r}var jl=cn("start","end","cancel","interrupt"),Vl=[],ki=0,Ur=1,Un=2,Bt=3,Zr=4,Zn=5,Yt=6;function dn(e,t,n,r,o,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;Fl(e,n,{name:t,index:r,group:o,on:jl,tween:Vl,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:ki})}function lr(e,t){var n=pe(e,t);if(n.state>ki)throw new Error("too late; already scheduled");return n}function ve(e,t){var n=pe(e,t);if(n.state>Bt)throw new Error("too late; already running");return n}function pe(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Fl(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=Mi(i,0,n.time);function i(u){n.state=Ur,n.timer.restart(s,n.delay,n.time),n.delay<=u&&s(u-n.delay)}function s(u){var d,l,f,h;if(n.state!==Ur)return c();for(d in r)if(h=r[d],h.name===n.name){if(h.state===Bt)return Kr(s);h.state===Zr?(h.state=Yt,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[d]):+d<t&&(h.state=Yt,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[d])}if(Kr(function(){n.state===Bt&&(n.state=Zr,n.timer.restart(a,n.delay,n.time),a(u))}),n.state=Un,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Un){for(n.state=Bt,o=new Array(f=n.tween.length),d=0,l=-1;d<f;++d)(h=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(o[++l]=h);o.length=l+1}}function a(u){for(var d=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(c),n.state=Zn,1),l=-1,f=o.length;++l<f;)o[l].call(e,d);n.state===Zn&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Yt,n.timer.stop(),delete r[t];for(var u in r)return;delete e.__transition}}function Xt(e,t){var n=e.__transition,r,o,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((r=n[s]).name!==t){i=!1;continue}o=r.state>Un&&r.state<Zn,r.state=Yt,r.timer.stop(),r.on.call(o?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[s]}i&&delete e.__transition}}function Bl(e){return this.each(function(){Xt(this,e)})}function Yl(e,t){var n,r;return function(){var o=ve(this,e),i=o.tween;if(i!==n){r=n=i;for(var s=0,a=r.length;s<a;++s)if(r[s].name===t){r=r.slice(),r.splice(s,1);break}}o.tween=r}}function Xl(e,t,n){var r,o;if(typeof n!="function")throw new Error;return function(){var i=ve(this,e),s=i.tween;if(s!==r){o=(r=s).slice();for(var a={name:t,value:n},c=0,u=o.length;c<u;++c)if(o[c].name===t){o[c]=a;break}c===u&&o.push(a)}i.tween=o}}function Wl(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=pe(this.node(),n).tween,o=0,i=r.length,s;o<i;++o)if((s=r[o]).name===e)return s.value;return null}return this.each((t==null?Yl:Xl)(n,e,t))}function dr(e,t,n){var r=e._id;return e.each(function(){var o=ve(this,r);(o.value||(o.value={}))[t]=n.apply(this,arguments)}),function(o){return pe(o,r).value[t]}}function Ci(e,t){var n;return(typeof t=="number"?me:t instanceof De?Kt:(n=De(t))?(t=n,Kt):bi)(e,t)}function Gl(e){return function(){this.removeAttribute(e)}}function ql(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Kl(e,t,n){var r,o=n+"",i;return function(){var s=this.getAttribute(e);return s===o?null:s===r?i:i=t(r=s,n)}}function Ul(e,t,n){var r,o=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===o?null:s===r?i:i=t(r=s,n)}}function Zl(e,t,n){var r,o,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===r&&c===o?i:(o=c,i=t(r=s,a)))}}function Ql(e,t,n){var r,o,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===r&&c===o?i:(o=c,i=t(r=s,a)))}}function Jl(e,t){var n=un(e),r=n==="transform"?Pl:Ci;return this.attrTween(e,typeof t=="function"?(n.local?Ql:Zl)(n,r,dr(this,"attr."+e,t)):t==null?(n.local?ql:Gl)(n):(n.local?Ul:Kl)(n,r,t))}function ed(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function td(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function nd(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&td(e,i)),n}return o._value=t,o}function rd(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&ed(e,i)),n}return o._value=t,o}function od(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=un(e);return this.tween(n,(r.local?nd:rd)(r,t))}function id(e,t){return function(){lr(this,e).delay=+t.apply(this,arguments)}}function sd(e,t){return t=+t,function(){lr(this,e).delay=t}}function ad(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?id:sd)(t,e)):pe(this.node(),t).delay}function cd(e,t){return function(){ve(this,e).duration=+t.apply(this,arguments)}}function ud(e,t){return t=+t,function(){ve(this,e).duration=t}}function ld(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?cd:ud)(t,e)):pe(this.node(),t).duration}function dd(e,t){if(typeof t!="function")throw new Error;return function(){ve(this,e).ease=t}}function fd(e){var t=this._id;return arguments.length?this.each(dd(t,e)):pe(this.node(),t).ease}function hd(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;ve(this,e).ease=n}}function gd(e){if(typeof e!="function")throw new Error;return this.each(hd(this._id,e))}function pd(e){typeof e!="function"&&(e=ii(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,a=r[o]=[],c,u=0;u<s;++u)(c=i[u])&&e.call(c,c.__data__,u,i)&&a.push(c);return new Ne(r,this._parents,this._name,this._id)}function md(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,o=n.length,i=Math.min(r,o),s=new Array(r),a=0;a<i;++a)for(var c=t[a],u=n[a],d=c.length,l=s[a]=new Array(d),f,h=0;h<d;++h)(f=c[h]||u[h])&&(l[h]=f);for(;a<r;++a)s[a]=t[a];return new Ne(s,this._parents,this._name,this._id)}function yd(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function wd(e,t,n){var r,o,i=yd(t)?lr:ve;return function(){var s=i(this,e),a=s.on;a!==r&&(o=(r=a).copy()).on(t,n),s.on=o}}function xd(e,t){var n=this._id;return arguments.length<2?pe(this.node(),n).on.on(e):this.each(wd(n,e,t))}function vd(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function bd(){return this.on("end.remove",vd(this._id))}function _d(e){var t=this._name,n=this._id;typeof e!="function"&&(e=ir(e));for(var r=this._groups,o=r.length,i=new Array(o),s=0;s<o;++s)for(var a=r[s],c=a.length,u=i[s]=new Array(c),d,l,f=0;f<c;++f)(d=a[f])&&(l=e.call(d,d.__data__,f,a))&&("__data__"in d&&(l.__data__=d.__data__),u[f]=l,dn(u[f],t,n,f,u,pe(d,n)));return new Ne(i,this._parents,t,n)}function Ed(e){var t=this._name,n=this._id;typeof e!="function"&&(e=oi(e));for(var r=this._groups,o=r.length,i=[],s=[],a=0;a<o;++a)for(var c=r[a],u=c.length,d,l=0;l<u;++l)if(d=c[l]){for(var f=e.call(d,d.__data__,l,c),h,g=pe(d,n),y=0,w=f.length;y<w;++y)(h=f[y])&&dn(h,t,n,y,f,g);i.push(f),s.push(d)}return new Ne(i,s,t,n)}var Nd=Et.prototype.constructor;function Sd(){return new Nd(this._groups,this._parents)}function Md(e,t){var n,r,o;return function(){var i=Ge(this,e),s=(this.style.removeProperty(e),Ge(this,e));return i===s?null:i===n&&s===r?o:o=t(n=i,r=s)}}function Ii(e){return function(){this.style.removeProperty(e)}}function kd(e,t,n){var r,o=n+"",i;return function(){var s=Ge(this,e);return s===o?null:s===r?i:i=t(r=s,n)}}function Cd(e,t,n){var r,o,i;return function(){var s=Ge(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),Ge(this,e))),s===c?null:s===r&&c===o?i:(o=c,i=t(r=s,a))}}function Id(e,t){var n,r,o,i="style."+t,s="end."+i,a;return function(){var c=ve(this,e),u=c.on,d=c.value[i]==null?a||(a=Ii(t)):void 0;(u!==n||o!==d)&&(r=(n=u).copy()).on(s,o=d),c.on=r}}function Ad(e,t,n){var r=(e+="")=="transform"?$l:Ci;return t==null?this.styleTween(e,Md(e,r)).on("end.style."+e,Ii(e)):typeof t=="function"?this.styleTween(e,Cd(e,r,dr(this,"style."+e,t))).each(Id(this._id,e)):this.styleTween(e,kd(e,r,t),n).on("end.style."+e,null)}function $d(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Pd(e,t,n){var r,o;function i(){var s=t.apply(this,arguments);return s!==o&&(r=(o=s)&&$d(e,s,n)),r}return i._value=t,i}function Td(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,Pd(e,t,n??""))}function Ld(e){return function(){this.textContent=e}}function Od(e){return function(){var t=e(this);this.textContent=t??""}}function Dd(e){return this.tween("text",typeof e=="function"?Od(dr(this,"text",e)):Ld(e==null?"":e+""))}function zd(e){return function(t){this.textContent=e.call(this,t)}}function Rd(e){var t,n;function r(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&zd(o)),t}return r._value=e,r}function Hd(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,Rd(e))}function jd(){for(var e=this._name,t=this._id,n=Ai(),r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,c,u=0;u<a;++u)if(c=s[u]){var d=pe(c,t);dn(c,e,n,u,s,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new Ne(r,this._parents,e,n)}function Vd(){var e,t,n=this,r=n._id,o=n.size();return new Promise(function(i,s){var a={value:s},c={value:function(){--o===0&&i()}};n.each(function(){var u=ve(this,r),d=u.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),u.on=t}),o===0&&i()})}var Fd=0;function Ne(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function Ai(){return++Fd}var _e=Et.prototype;Ne.prototype={constructor:Ne,select:_d,selectAll:Ed,selectChild:_e.selectChild,selectChildren:_e.selectChildren,filter:pd,merge:md,selection:Sd,transition:jd,call:_e.call,nodes:_e.nodes,node:_e.node,size:_e.size,empty:_e.empty,each:_e.each,on:xd,attr:Jl,attrTween:od,style:Ad,styleTween:Td,text:Dd,textTween:Hd,remove:bd,tween:Wl,delay:ad,duration:ld,ease:fd,easeVarying:gd,end:Vd,[Symbol.iterator]:_e[Symbol.iterator]};function Bd(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Yd={time:null,delay:0,duration:250,ease:Bd};function Xd(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function Wd(e){var t,n;e instanceof Ne?(t=e._id,e=e._name):(t=Ai(),(n=Yd).time=ur(),e=e==null?null:e+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,c,u=0;u<a;++u)(c=s[u])&&dn(c,e,t,u,s,n||Xd(c,t));return new Ne(r,this._parents,e,t)}Et.prototype.interrupt=Bl;Et.prototype.transition=Wd;const Dt=e=>()=>e;function Gd(e,{sourceEvent:t,target:n,transform:r,dispatch:o}){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:o}})}function Ee(e,t,n){this.k=e,this.x=t,this.y=n}Ee.prototype={constructor:Ee,scale:function(e){return e===1?this:new Ee(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ee(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var fn=new Ee(1,0,0);$i.prototype=Ee.prototype;function $i(e){for(;!e.__zoom;)if(!(e=e.parentNode))return fn;return e.__zoom}function Cn(e){e.stopImmediatePropagation()}function at(e){e.preventDefault(),e.stopImmediatePropagation()}function qd(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}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]]}function Qr(){return this.__zoom||fn}function Ud(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Zd(){return navigator.maxTouchPoints||"ontouchstart"in this}function Qd(e,t,n){var r=e.invertX(t[0][0])-n[0][0],o=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function Pi(){var e=qd,t=Kd,n=Qd,r=Ud,o=Zd,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=Ft,u=cn("start","zoom","end"),d,l,f,h=500,g=150,y=0,w=10;function m(v){v.property("__zoom",Qr).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",L).on("dblclick.zoom",j).filter(o).on("touchstart.zoom",C).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",H).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(v,I,E,A){var k=v.selection?v.selection():v;k.property("__zoom",Qr),v!==k?S(v,I,E,A):k.interrupt().each(function(){_(this,arguments).event(A).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},m.scaleBy=function(v,I,E,A){m.scaleTo(v,function(){var k=this.__zoom.k,N=typeof I=="function"?I.apply(this,arguments):I;return k*N},E,A)},m.scaleTo=function(v,I,E,A){m.transform(v,function(){var k=t.apply(this,arguments),N=this.__zoom,D=E==null?x(k):typeof E=="function"?E.apply(this,arguments):E,R=N.invert(D),z=typeof I=="function"?I.apply(this,arguments):I;return n(p(b(N,z),D,R),k,s)},E,A)},m.translateBy=function(v,I,E,A){m.transform(v,function(){return n(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof E=="function"?E.apply(this,arguments):E),t.apply(this,arguments),s)},null,A)},m.translateTo=function(v,I,E,A,k){m.transform(v,function(){var N=t.apply(this,arguments),D=this.__zoom,R=A==null?x(N):typeof A=="function"?A.apply(this,arguments):A;return n(fn.translate(R[0],R[1]).scale(D.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof E=="function"?-E.apply(this,arguments):-E),N,s)},A,k)};function b(v,I){return I=Math.max(i[0],Math.min(i[1],I)),I===v.k?v:new Ee(I,v.x,v.y)}function p(v,I,E){var A=I[0]-E[0]*v.k,k=I[1]-E[1]*v.k;return A===v.x&&k===v.y?v:new Ee(v.k,A,k)}function x(v){return[(+v[0][0]+ +v[1][0])/2,(+v[0][1]+ +v[1][1])/2]}function S(v,I,E,A){v.on("start.zoom",function(){_(this,arguments).event(A).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(A).end()}).tween("zoom",function(){var k=this,N=arguments,D=_(k,N).event(A),R=t.apply(k,N),z=E==null?x(R):typeof E=="function"?E.apply(k,N):E,F=Math.max(R[1][0]-R[0][0],R[1][1]-R[0][1]),B=k.__zoom,X=typeof I=="function"?I.apply(k,N):I,K=c(B.invert(z).concat(F/B.k),X.invert(z).concat(F/X.k));return function(G){if(G===1)G=X;else{var V=K(G),W=F/V[2];G=new Ee(W,z[0]-V[0]*W,z[1]-V[1]*W)}D.zoom(null,G)}})}function _(v,I,E){return!E&&v.__zooming||new M(v,I)}function M(v,I){this.that=v,this.args=I,this.active=0,this.sourceEvent=null,this.extent=t.apply(v,I),this.taps=0}M.prototype={event:function(v){return v&&(this.sourceEvent=v),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(v,I){return this.mouse&&v!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&v!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&v!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(v){var I=ce(this.that).datum();u.call(v,this.that,new Gd(v,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:u}),I)}};function T(v,...I){if(!e.apply(this,arguments))return;var E=_(this,I).event(v),A=this.__zoom,k=Math.max(i[0],Math.min(i[1],A.k*Math.pow(2,r.apply(this,arguments)))),N=de(v);if(E.wheel)(E.mouse[0][0]!==N[0]||E.mouse[0][1]!==N[1])&&(E.mouse[1]=A.invert(E.mouse[0]=N)),clearTimeout(E.wheel);else{if(A.k===k)return;E.mouse=[N,A.invert(N)],Xt(this),E.start()}at(v),E.wheel=setTimeout(D,g),E.zoom("mouse",n(p(b(A,k),E.mouse[0],E.mouse[1]),E.extent,s));function D(){E.wheel=null,E.end()}}function L(v,...I){if(f||!e.apply(this,arguments))return;var E=v.currentTarget,A=_(this,I,!0).event(v),k=ce(v.view).on("mousemove.zoom",z,!0).on("mouseup.zoom",F,!0),N=de(v,E),D=v.clientX,R=v.clientY;pi(v.view),Cn(v),A.mouse=[N,this.__zoom.invert(N)],Xt(this),A.start();function z(B){if(at(B),!A.moved){var X=B.clientX-D,K=B.clientY-R;A.moved=X*X+K*K>y}A.event(B).zoom("mouse",n(p(A.that.__zoom,A.mouse[0]=de(B,E),A.mouse[1]),A.extent,s))}function F(B){k.on("mousemove.zoom mouseup.zoom",null),mi(B.view,A.moved),at(B),A.event(B).end()}}function j(v,...I){if(e.apply(this,arguments)){var E=this.__zoom,A=de(v.changedTouches?v.changedTouches[0]:v,this),k=E.invert(A),N=E.k*(v.shiftKey?.5:2),D=n(p(b(E,N),A,k),t.apply(this,I),s);at(v),a>0?ce(this).transition().duration(a).call(S,D,A,v):ce(this).call(m.transform,D,A,v)}}function C(v,...I){if(e.apply(this,arguments)){var E=v.touches,A=E.length,k=_(this,I,v.changedTouches.length===A).event(v),N,D,R,z;for(Cn(v),D=0;D<A;++D)R=E[D],z=de(R,this),z=[z,this.__zoom.invert(z),R.identifier],k.touch0?!k.touch1&&k.touch0[2]!==z[2]&&(k.touch1=z,k.taps=0):(k.touch0=z,N=!0,k.taps=1+!!d);d&&(d=clearTimeout(d)),N&&(k.taps<2&&(l=z[0],d=setTimeout(function(){d=null},h)),Xt(this),k.start())}}function $(v,...I){if(this.__zooming){var E=_(this,I).event(v),A=v.changedTouches,k=A.length,N,D,R,z;for(at(v),N=0;N<k;++N)D=A[N],R=de(D,this),E.touch0&&E.touch0[2]===D.identifier?E.touch0[0]=R:E.touch1&&E.touch1[2]===D.identifier&&(E.touch1[0]=R);if(D=E.that.__zoom,E.touch1){var F=E.touch0[0],B=E.touch0[1],X=E.touch1[0],K=E.touch1[1],G=(G=X[0]-F[0])*G+(G=X[1]-F[1])*G,V=(V=K[0]-B[0])*V+(V=K[1]-B[1])*V;D=b(D,Math.sqrt(G/V)),R=[(F[0]+X[0])/2,(F[1]+X[1])/2],z=[(B[0]+K[0])/2,(B[1]+K[1])/2]}else if(E.touch0)R=E.touch0[0],z=E.touch0[1];else return;E.zoom("touch",n(p(D,R,z),E.extent,s))}}function H(v,...I){if(this.__zooming){var E=_(this,I).event(v),A=v.changedTouches,k=A.length,N,D;for(Cn(v),f&&clearTimeout(f),f=setTimeout(function(){f=null},h),N=0;N<k;++N)D=A[N],E.touch0&&E.touch0[2]===D.identifier?delete E.touch0:E.touch1&&E.touch1[2]===D.identifier&&delete E.touch1;if(E.touch1&&!E.touch0&&(E.touch0=E.touch1,delete E.touch1),E.touch0)E.touch0[1]=this.__zoom.invert(E.touch0[0]);else if(E.end(),E.taps===2&&(D=de(D,this),Math.hypot(l[0]-D[0],l[1]-D[1])<w)){var R=ce(this).on("dblclick.zoom");R&&R.apply(this,arguments)}}}return m.wheelDelta=function(v){return arguments.length?(r=typeof v=="function"?v:Dt(+v),m):r},m.filter=function(v){return arguments.length?(e=typeof v=="function"?v:Dt(!!v),m):e},m.touchable=function(v){return arguments.length?(o=typeof v=="function"?v:Dt(!!v),m):o},m.extent=function(v){return arguments.length?(t=typeof v=="function"?v:Dt([[+v[0][0],+v[0][1]],[+v[1][0],+v[1][1]]]),m):t},m.scaleExtent=function(v){return arguments.length?(i[0]=+v[0],i[1]=+v[1],m):[i[0],i[1]]},m.translateExtent=function(v){return arguments.length?(s[0][0]=+v[0][0],s[1][0]=+v[1][0],s[0][1]=+v[0][1],s[1][1]=+v[1][1],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(v){return arguments.length?(n=v,m):n},m.duration=function(v){return arguments.length?(a=+v,m):a},m.interpolate=function(v){return arguments.length?(c=v,m):c},m.on=function(){var v=u.on.apply(u,arguments);return v===u?m:v},m.clickDistance=function(v){return arguments.length?(y=(v=+v)*v,m):Math.sqrt(y)},m.tapDistance=function(v){return arguments.length?(w=+v,m):w},m}const xe={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"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.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012: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.`,error013:(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.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},yt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Ti=["Enter"," ","Escape"],Li={"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":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"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"};var Ke;(function(e){e.Strict="strict",e.Loose="loose"})(Ke||(Ke={}));var Oe;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Oe||(Oe={}));var wt;(function(e){e.Partial="partial",e.Full="full"})(wt||(wt={}));const Oi={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ie;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ie||(Ie={}));var Jt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Jt||(Jt={}));var Y;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Y||(Y={}));const Jr={[Y.Left]:Y.Right,[Y.Right]:Y.Left,[Y.Top]:Y.Bottom,[Y.Bottom]:Y.Top};function Di(e){return e===null?null:e?"valid":"invalid"}const zi=e=>"id"in e&&"source"in e&&"target"in e,Jd=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),fr=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),St=(e,t=[0,0])=>{const{width:n,height:r}=Se(e),o=e.origin??t,i=n*o[0],s=r*o[1];return{x:e.position.x-i,y:e.position.y-s}},ef=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,o)=>{const i=typeof o=="string";let s=!t.nodeLookup&&!i?o:void 0;t.nodeLookup&&(s=i?t.nodeLookup.get(o):fr(o)?o:t.nodeLookup.get(o.id));const a=s?en(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return hn(r,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return gn(n)},Mt=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(o=>{(t.filter===void 0||t.filter(o))&&(n=hn(n,en(o)),r=!0)}),r?gn(n):{x:0,y:0,width:0,height:0}},hr=(e,t,[n,r,o]=[0,0,1],i=!1,s=!1)=>{const a={...Ct(t,[n,r,o]),width:t.width/o,height:t.height/o},c=[];for(const u of e.values()){const{measured:d,selectable:l=!0,hidden:f=!1}=u;if(s&&!l||f)continue;const h=d.width??u.width??u.initialWidth??null,g=d.height??u.height??u.initialHeight??null,y=xt(a,Ze(u)),w=(h??0)*(g??0),m=i&&y>0;(!u.internals.handleBounds||m||y>=w||u.dragging)&&c.push(u)}return c},tf=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function nf(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(o=>o.id)):null;return e.forEach(o=>{o.measured.width&&o.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!o.hidden)&&(!r||r.has(o.id))&&n.set(o.id,o)}),n}async function rf({nodes:e,width:t,height:n,panZoom:r,minZoom:o,maxZoom:i},s){if(e.size===0)return Promise.resolve(!0);const a=nf(e,s),c=Mt(a),u=gr(c,t,n,(s==null?void 0:s.minZoom)??o,(s==null?void 0:s.maxZoom)??i,(s==null?void 0:s.padding)??.1);return await r.setViewport(u,{duration:s==null?void 0:s.duration,ease:s==null?void 0:s.ease,interpolate:s==null?void 0:s.interpolate}),Promise.resolve(!0)}function Ri({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:o,onError:i}){const s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:c,y:u}=a?a.internals.positionAbsolute:{x:0,y:0},d=s.origin??r;let l=s.extent||o;if(s.extent==="parent"&&!s.expandParent)if(!a)i==null||i("005",xe.error005());else{const h=a.measured.width,g=a.measured.height;h&&g&&(l=[[c,u],[c+h,u+g]])}else a&&Qe(s.extent)&&(l=[[s.extent[0][0]+c,s.extent[0][1]+u],[s.extent[1][0]+c,s.extent[1][1]+u]]);const f=Qe(l)?Re(t,l,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&(i==null||i("015",xe.error015())),{position:{x:f.x-c+(s.measured.width??0)*d[0],y:f.y-u+(s.measured.height??0)*d[1]},positionAbsolute:f}}async function of({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:o}){const i=new Set(e.map(f=>f.id)),s=[];for(const f of n){if(f.deletable===!1)continue;const h=i.has(f.id),g=!h&&f.parentId&&s.find(y=>y.id===f.parentId);(h||g)&&s.push(f)}const a=new Set(t.map(f=>f.id)),c=r.filter(f=>f.deletable!==!1),d=tf(s,c);for(const f of c)a.has(f.id)&&!d.find(g=>g.id===f.id)&&d.push(f);if(!o)return{edges:d,nodes:s};const l=await o({nodes:s,edges:d});return typeof l=="boolean"?l?{edges:d,nodes:s}:{edges:[],nodes:[]}:l}const Ue=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Re=(e={x:0,y:0},t,n)=>({x:Ue(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Ue(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function Hi(e,t,n){const{width:r,height:o}=Se(n),{x:i,y:s}=n.internals.positionAbsolute;return Re(e,[[i,s],[i+r,s+o]],t)}const eo=(e,t,n)=>e<t?Ue(Math.abs(e-t),1,t)/t:e>n?-Ue(Math.abs(e-n),1,t)/t:0,ji=(e,t,n=15,r=40)=>{const o=eo(e.x,r,t.width-r)*n,i=eo(e.y,r,t.height-r)*n;return[o,i]},hn=(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)}),Qn=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),gn=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Ze=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=fr(e)?e.internals.positionAbsolute:St(e,t);return{x:n,y:r,width:((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}},en=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=fr(e)?e.internals.positionAbsolute:St(e,t);return{x:n,y:r,x2:n+(((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0),y2:r+(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0)}},Vi=(e,t)=>gn(hn(Qn(e),Qn(t))),xt=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},to=e=>he(e.width)&&he(e.height)&&he(e.x)&&he(e.y),he=e=>!isNaN(e)&&isFinite(e),sf=(e,t)=>{},kt=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Ct=({x:e,y:t},[n,r,o],i=!1,s=[1,1])=>{const a={x:(e-n)/o,y:(t-r)/o};return i?kt(a,s):a},tn=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r});function Fe(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function af(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Fe(e,n),o=Fe(e,t);return{top:r,right:o,bottom:r,left:o,x:o*2,y:r*2}}if(typeof e=="object"){const r=Fe(e.top??e.y??0,n),o=Fe(e.bottom??e.y??0,n),i=Fe(e.left??e.x??0,t),s=Fe(e.right??e.x??0,t);return{top:r,right:s,bottom:o,left:i,x:i+s,y:r+o}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function cf(e,t,n,r,o,i){const{x:s,y:a}=tn(e,[t,n,r]),{x:c,y:u}=tn({x:e.x+e.width,y:e.y+e.height},[t,n,r]),d=o-c,l=i-u;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(d),bottom:Math.floor(l)}}const gr=(e,t,n,r,o,i)=>{const s=af(i,t,n),a=(t-s.x)/e.width,c=(n-s.y)/e.height,u=Math.min(a,c),d=Ue(u,r,o),l=e.x+e.width/2,f=e.y+e.height/2,h=t/2-l*d,g=n/2-f*d,y=cf(e,h,g,d,t,n),w={left:Math.min(y.left-s.left,0),top:Math.min(y.top-s.top,0),right:Math.min(y.right-s.right,0),bottom:Math.min(y.bottom-s.bottom,0)};return{x:h-w.left+w.right,y:g-w.top+w.bottom,zoom:d}},vt=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Qe(e){return e!=null&&e!=="parent"}function Se(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function Fi(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function Bi(e,t={width:0,height:0},n,r,o){const i={...e},s=r.get(n);if(s){const a=s.origin||o;i.x+=s.internals.positionAbsolute.x-(t.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*a[1]}return i}function no(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function uf(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}function lf(e){return{...Li,...e||{}}}function ft(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:i,y:s}=ge(e),a=Ct({x:i-((o==null?void 0:o.left)??0),y:s-((o==null?void 0:o.top)??0)},r),{x:c,y:u}=n?kt(a,t):a;return{xSnapped:c,ySnapped:u,...a}}const pr=e=>({width:e.offsetWidth,height:e.offsetHeight}),Yi=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},df=["INPUT","SELECT","TEXTAREA"];function Xi(e){var r,o;const t=((o=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:o[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:df.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Wi=e=>"clientX"in e,ge=(e,t)=>{var i,s;const n=Wi(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,o=n?e.clientY:(s=e.touches)==null?void 0:s[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:o-((t==null?void 0:t.top)??0)}},ro=(e,t,n,r,o)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:o,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...pr(s)}})};function Gi({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:o,sourceControlY:i,targetControlX:s,targetControlY:a}){const c=e*.125+o*.375+s*.375+n*.125,u=t*.125+i*.375+a*.375+r*.125,d=Math.abs(c-e),l=Math.abs(u-t);return[c,u,d,l]}function zt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function oo({pos:e,x1:t,y1:n,x2:r,y2:o,c:i}){switch(e){case Y.Left:return[t-zt(t-r,i),n];case Y.Right:return[t+zt(r-t,i),n];case Y.Top:return[t,n-zt(n-o,i)];case Y.Bottom:return[t,n+zt(o-n,i)]}}function qi({sourceX:e,sourceY:t,sourcePosition:n=Y.Bottom,targetX:r,targetY:o,targetPosition:i=Y.Top,curvature:s=.25}){const[a,c]=oo({pos:n,x1:e,y1:t,x2:r,y2:o,c:s}),[u,d]=oo({pos:i,x1:r,y1:o,x2:e,y2:t,c:s}),[l,f,h,g]=Gi({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:a,sourceControlY:c,targetControlX:u,targetControlY:d});return[`M${e},${t} C${a},${c} ${u},${d} ${r},${o}`,l,f,h,g]}function Ki({sourceX:e,sourceY:t,targetX:n,targetY:r}){const o=Math.abs(n-e)/2,i=n<e?n+o:n-o,s=Math.abs(r-t)/2,a=r<t?r+s:r-s;return[i,a,o,s]}function ff({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:o=!1,zIndexMode:i="basic"}){if(i==="manual")return r;const s=o&&n?r+1e3:r,a=Math.max(e.parentId||o&&e.selected?e.internals.z:0,t.parentId||o&&t.selected?t.internals.z:0);return s+a}function hf({sourceNode:e,targetNode:t,width:n,height:r,transform:o}){const i=hn(en(e),en(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-o[0]/o[2],y:-o[1]/o[2],width:n/o[2],height:r/o[2]};return xt(s,gn(i))>0}const gf=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,pf=(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)),mf=(e,t,n={})=>{if(!e.source||!e.target)return t;const r=n.getEdgeId||gf;let o;return zi(e)?o={...e}:o={...e,id:r(e)},pf(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function Ui({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[o,i,s,a]=Ki({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,i,s,a]}const io={[Y.Left]:{x:-1,y:0},[Y.Right]:{x:1,y:0},[Y.Top]:{x:0,y:-1},[Y.Bottom]:{x:0,y:1}},yf=({source:e,sourcePosition:t=Y.Bottom,target:n})=>t===Y.Left||t===Y.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},so=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function wf({source:e,sourcePosition:t=Y.Bottom,target:n,targetPosition:r=Y.Top,center:o,offset:i,stepPosition:s}){const a=io[t],c=io[r],u={x:e.x+a.x*i,y:e.y+a.y*i},d={x:n.x+c.x*i,y:n.y+c.y*i},l=yf({source:u,sourcePosition:t,target:d}),f=l.x!==0?"x":"y",h=l[f];let g=[],y,w;const m={x:0,y:0},b={x:0,y:0},[,,p,x]=Ki({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*c[f]===-1){f==="x"?(y=o.x??u.x+(d.x-u.x)*s,w=o.y??(u.y+d.y)/2):(y=o.x??(u.x+d.x)/2,w=o.y??u.y+(d.y-u.y)*s);const _=[{x:y,y:u.y},{x:y,y:d.y}],M=[{x:u.x,y:w},{x:d.x,y:w}];a[f]===h?g=f==="x"?_:M:g=f==="x"?M:_}else{const _=[{x:u.x,y:d.y}],M=[{x:d.x,y:u.y}];if(f==="x"?g=a.x===h?M:_:g=a.y===h?_:M,t===r){const $=Math.abs(e[f]-n[f]);if($<=i){const H=Math.min(i-1,i-$);a[f]===h?m[f]=(u[f]>e[f]?-1:1)*H:b[f]=(d[f]>n[f]?-1:1)*H}}if(t!==r){const $=f==="x"?"y":"x",H=a[f]===c[$],v=u[$]>d[$],I=u[$]<d[$];(a[f]===1&&(!H&&v||H&&I)||a[f]!==1&&(!H&&I||H&&v))&&(g=f==="x"?_:M)}const T={x:u.x+m.x,y:u.y+m.y},L={x:d.x+b.x,y:d.y+b.y},j=Math.max(Math.abs(T.x-g[0].x),Math.abs(L.x-g[0].x)),C=Math.max(Math.abs(T.y-g[0].y),Math.abs(L.y-g[0].y));j>=C?(y=(T.x+L.x)/2,w=g[0].y):(y=g[0].x,w=(T.y+L.y)/2)}return[[e,{x:u.x+m.x,y:u.y+m.y},...g,{x:d.x+b.x,y:d.y+b.y},n],y,w,p,x]}function xf(e,t,n,r){const o=Math.min(so(e,t)/2,so(t,n)/2,r),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const u=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${i+o*u},${s}Q ${i},${s} ${i},${s+o*d}`}const a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${s+o*c}Q ${i},${s} ${i+o*a},${s}`}function Jn({sourceX:e,sourceY:t,sourcePosition:n=Y.Bottom,targetX:r,targetY:o,targetPosition:i=Y.Top,borderRadius:s=5,centerX:a,centerY:c,offset:u=20,stepPosition:d=.5}){const[l,f,h,g,y]=wf({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:o},targetPosition:i,center:{x:a,y:c},offset:u,stepPosition:d});return[l.reduce((m,b,p)=>{let x="";return p>0&&p<l.length-1?x=xf(l[p-1],b,l[p+1],s):x=`${p===0?"M":"L"}${b.x} ${b.y}`,m+=x,m},""),f,h,g,y]}function ao(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function vf(e){var l;const{sourceNode:t,targetNode:n}=e;if(!ao(t)||!ao(n))return null;const r=t.internals.handleBounds||co(t.handles),o=n.internals.handleBounds||co(n.handles),i=uo((r==null?void 0:r.source)??[],e.sourceHandle),s=uo(e.connectionMode===Ke.Strict?(o==null?void 0:o.target)??[]:((o==null?void 0:o.target)??[]).concat((o==null?void 0:o.source)??[]),e.targetHandle);if(!i||!s)return(l=e.onError)==null||l.call(e,"008",xe.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=(i==null?void 0:i.position)||Y.Bottom,c=(s==null?void 0:s.position)||Y.Top,u=He(t,i,a),d=He(n,s,c);return{sourceX:u.x,sourceY:u.y,targetX:d.x,targetY:d.y,sourcePosition:a,targetPosition:c}}function co(e){if(!e)return null;const t=[],n=[];for(const 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}}function He(e,t,n=Y.Left,r=!1){const o=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,i=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??Se(e);if(r)return{x:o+s/2,y:i+a/2};switch((t==null?void 0:t.position)??n){case Y.Top:return{x:o+s/2,y:i};case Y.Right:return{x:o+s,y:i+a/2};case Y.Bottom:return{x:o+s/2,y:i+a};case Y.Left:return{x:o,y:i+a/2}}}function uo(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function er(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function bf(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:o}){const i=new Set;return e.reduce((s,a)=>([a.markerStart||r,a.markerEnd||o].forEach(c=>{if(c&&typeof c=="object"){const u=er(c,t);i.has(u)||(s.push({id:u,color:c.color||n,...c}),i.add(u))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const Zi=1e3,_f=10,mr={nodeOrigin:[0,0],nodeExtent:yt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Ef={...mr,checkEquality:!0};function yr(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function Nf(e,t,n){const r=yr(mr,n);for(const o of e.values())if(o.parentId)xr(o,e,t,r);else{const i=St(o,r.nodeOrigin),s=Qe(o.extent)?o.extent:r.nodeExtent,a=Re(i,s,Se(o));o.internals.positionAbsolute=a}}function Sf(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const o of e.handles){const i={id:o.id,width:o.width??1,height:o.height??1,nodeId:e.id,x:o.x,y:o.y,position:o.position,type:o.type};o.type==="source"?n.push(i):o.type==="target"&&r.push(i)}return{source:n,target:r}}function wr(e){return e==="manual"}function tr(e,t,n,r={}){var u,d;const o=yr(Ef,r),i={i:0},s=new Map(t),a=o!=null&&o.elevateNodesOnSelect&&!wr(o.zIndexMode)?Zi:0;let c=e.length>0;t.clear(),n.clear();for(const l of e){let f=s.get(l.id);if(o.checkEquality&&l===(f==null?void 0:f.internals.userNode))t.set(l.id,f);else{const h=St(l,o.nodeOrigin),g=Qe(l.extent)?l.extent:o.nodeExtent,y=Re(h,g,Se(l));f={...o.defaults,...l,measured:{width:(u=l.measured)==null?void 0:u.width,height:(d=l.measured)==null?void 0:d.height},internals:{positionAbsolute:y,handleBounds:Sf(l,f),z:Qi(l,a,o.zIndexMode),userNode:l}},t.set(l.id,f)}(f.measured===void 0||f.measured.width===void 0||f.measured.height===void 0)&&!f.hidden&&(c=!1),l.parentId&&xr(f,t,n,r,i)}return c}function Mf(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function xr(e,t,n,r,o){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:c}=yr(mr,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}Mf(e,n),o&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++o.i,d.internals.z=d.internals.z+o.i*_f),o&&d.internals.rootParentIndex!==void 0&&(o.i=d.internals.rootParentIndex);const l=i&&!wr(c)?Zi:0,{x:f,y:h,z:g}=kf(e,d,s,a,l,c),{positionAbsolute:y}=e.internals,w=f!==y.x||h!==y.y;(w||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:w?{x:f,y:h}:y,z:g}})}function Qi(e,t,n){const r=he(e.zIndex)?e.zIndex:0;return wr(n)?r:r+(e.selected?t:0)}function kf(e,t,n,r,o,i){const{x:s,y:a}=t.internals.positionAbsolute,c=Se(e),u=St(e,n),d=Qe(e.extent)?Re(u,e.extent,c):u;let l=Re({x:s+d.x,y:a+d.y},r,c);e.extent==="parent"&&(l=Hi(l,c,t));const f=Qi(e,o,i),h=t.internals.z??0;return{x:l.x,y:l.y,z:h>=f?h+1:f}}function vr(e,t,n,r=[0,0]){var s;const o=[],i=new Map;for(const a of e){const c=t.get(a.parentId);if(!c)continue;const u=((s=i.get(a.parentId))==null?void 0:s.expandedRect)??Ze(c),d=Vi(u,a.rect);i.set(a.parentId,{expandedRect:d,parent:c})}return i.size>0&&i.forEach(({expandedRect:a,parent:c},u)=>{var p;const d=c.internals.positionAbsolute,l=Se(c),f=c.origin??r,h=a.x<d.x?Math.round(Math.abs(d.x-a.x)):0,g=a.y<d.y?Math.round(Math.abs(d.y-a.y)):0,y=Math.max(l.width,Math.round(a.width)),w=Math.max(l.height,Math.round(a.height)),m=(y-l.width)*f[0],b=(w-l.height)*f[1];(h>0||g>0||m||b)&&(o.push({id:u,type:"position",position:{x:c.position.x-h+m,y:c.position.y-g+b}}),(p=n.get(u))==null||p.forEach(x=>{e.some(S=>S.id===x.id)||o.push({id:x.id,type:"position",position:{x:x.position.x+h,y:x.position.y+g}})})),(l.width<a.width||l.height<a.height||h||g)&&o.push({id:u,type:"dimensions",setAttributes:!0,dimensions:{width:y+(h?f[0]*h-m:0),height:w+(g?f[1]*g-b:0)}})}),o}function Cf(e,t,n,r,o,i,s){const a=r==null?void 0:r.querySelector(".xyflow__viewport");let c=!1;if(!a)return{changes:[],updatedInternals:c};const u=[],d=window.getComputedStyle(a),{m22:l}=new window.DOMMatrixReadOnly(d.transform),f=[];for(const h of e.values()){const g=t.get(h.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const y=pr(h.nodeElement),w=g.measured.width!==y.width||g.measured.height!==y.height;if(!!(y.width&&y.height&&(w||!g.internals.handleBounds||h.force))){const b=h.nodeElement.getBoundingClientRect(),p=Qe(g.extent)?g.extent:i;let{positionAbsolute:x}=g.internals;g.parentId&&g.extent==="parent"?x=Hi(x,y,t.get(g.parentId)):p&&(x=Re(x,p,y));const S={...g,measured:y,internals:{...g.internals,positionAbsolute:x,handleBounds:{source:ro("source",h.nodeElement,b,l,g.id),target:ro("target",h.nodeElement,b,l,g.id)}}};t.set(g.id,S),g.parentId&&xr(S,t,n,{nodeOrigin:o,zIndexMode:s}),c=!0,w&&(u.push({id:g.id,type:"dimensions",dimensions:y}),g.expandParent&&g.parentId&&f.push({id:g.id,parentId:g.parentId,rect:Ze(S,o)}))}}if(f.length>0){const h=vr(f,t,n,o);u.push(...h)}return{changes:u,updatedInternals:c}}async function If({delta:e,panZoom:t,transform:n,translateExtent:r,width:o,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[o,i]],r),a=!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2]);return Promise.resolve(a)}function lo(e,t,n,r,o,i){let s=o;const a=r.get(s)||new Map;r.set(s,a.set(n,t)),s=`${o}-${e}`;const c=r.get(s)||new Map;if(r.set(s,c.set(n,t)),i){s=`${o}-${e}-${i}`;const u=r.get(s)||new Map;r.set(s,u.set(n,t))}}function Ji(e,t,n){e.clear(),t.clear();for(const r of n){const{source:o,target:i,sourceHandle:s=null,targetHandle:a=null}=r,c={edgeId:r.id,source:o,target:i,sourceHandle:s,targetHandle:a},u=`${o}-${s}--${i}-${a}`,d=`${i}-${a}--${o}-${s}`;lo("source",c,d,e,o,s),lo("target",c,u,e,i,a),t.set(r.id,r)}}function es(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:es(n,t):!1}function fo(e,t,n){var o;let r=e;do{if((o=r==null?void 0:r.matches)!=null&&o.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function Af(e,t,n,r){const o=new Map;for(const[i,s]of e)if((s.selected||s.id===r)&&(!s.parentId||!es(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const a=e.get(i);a&&o.set(i,{id:i,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return o}function In({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var s,a,c;const o=[];for(const[u,d]of t){const l=(s=n.get(u))==null?void 0:s.internals.userNode;l&&o.push({...l,position:d.position,dragging:r})}if(!e)return[o[0],o];const i=(a=n.get(e))==null?void 0:a.internals.userNode;return[i?{...i,position:((c=t.get(e))==null?void 0:c.position)||i.position,dragging:r}:o[0],o]}function $f({dragItems:e,snapGrid:t,x:n,y:r}){const o=e.values().next().value;if(!o)return null;const i={x:n-o.distance.x,y:r-o.distance.y},s=kt(i,t);return{x:s.x-i.x,y:s.y-i.y}}function Pf({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:o}){let i={x:null,y:null},s=0,a=new Map,c=!1,u={x:0,y:0},d=null,l=!1,f=null,h=!1,g=!1,y=null;function w({noDragClassName:b,handleSelector:p,domNode:x,isSelectable:S,nodeId:_,nodeClickDistance:M=0}){f=ce(x);function T({x:$,y:H}){const{nodeLookup:v,nodeExtent:I,snapGrid:E,snapToGrid:A,nodeOrigin:k,onNodeDrag:N,onSelectionDrag:D,onError:R,updateNodePositions:z}=t();i={x:$,y:H};let F=!1;const B=a.size>1,X=B&&I?Qn(Mt(a)):null,K=B&&A?$f({dragItems:a,snapGrid:E,x:$,y:H}):null;for(const[G,V]of a){if(!v.has(G))continue;let W={x:$-V.distance.x,y:H-V.distance.y};A&&(W=K?{x:Math.round(W.x+K.x),y:Math.round(W.y+K.y)}:kt(W,E));let Q=null;if(B&&I&&!V.extent&&X){const{positionAbsolute:q}=V.internals,te=q.x-X.x+I[0][0],ne=q.x+V.measured.width-X.x2+I[1][0],ee=q.y-X.y+I[0][1],se=q.y+V.measured.height-X.y2+I[1][1];Q=[[te,ee],[ne,se]]}const{position:Z,positionAbsolute:U}=Ri({nodeId:G,nextPosition:W,nodeLookup:v,nodeExtent:Q||I,nodeOrigin:k,onError:R});F=F||V.position.x!==Z.x||V.position.y!==Z.y,V.position=Z,V.internals.positionAbsolute=U}if(g=g||F,!!F&&(z(a,!0),y&&(r||N||!_&&D))){const[G,V]=In({nodeId:_,dragItems:a,nodeLookup:v});r==null||r(y,a,G,V),N==null||N(y,G,V),_||D==null||D(y,V)}}async function L(){if(!d)return;const{transform:$,panBy:H,autoPanSpeed:v,autoPanOnNodeDrag:I}=t();if(!I){c=!1,cancelAnimationFrame(s);return}const[E,A]=ji(u,d,v);(E!==0||A!==0)&&(i.x=(i.x??0)-E/$[2],i.y=(i.y??0)-A/$[2],await H({x:E,y:A})&&T(i)),s=requestAnimationFrame(L)}function j($){var B;const{nodeLookup:H,multiSelectionActive:v,nodesDraggable:I,transform:E,snapGrid:A,snapToGrid:k,selectNodesOnDrag:N,onNodeDragStart:D,onSelectionDragStart:R,unselectNodesAndEdges:z}=t();l=!0,(!N||!S)&&!v&&_&&((B=H.get(_))!=null&&B.selected||z()),S&&N&&_&&(e==null||e(_));const F=ft($.sourceEvent,{transform:E,snapGrid:A,snapToGrid:k,containerBounds:d});if(i=F,a=Af(H,I,F,_),a.size>0&&(n||D||!_&&R)){const[X,K]=In({nodeId:_,dragItems:a,nodeLookup:H});n==null||n($.sourceEvent,a,X,K),D==null||D($.sourceEvent,X,K),_||R==null||R($.sourceEvent,K)}}const C=yi().clickDistance(M).on("start",$=>{const{domNode:H,nodeDragThreshold:v,transform:I,snapGrid:E,snapToGrid:A}=t();d=(H==null?void 0:H.getBoundingClientRect())||null,h=!1,g=!1,y=$.sourceEvent,v===0&&j($),i=ft($.sourceEvent,{transform:I,snapGrid:E,snapToGrid:A,containerBounds:d}),u=ge($.sourceEvent,d)}).on("drag",$=>{const{autoPanOnNodeDrag:H,transform:v,snapGrid:I,snapToGrid:E,nodeDragThreshold:A,nodeLookup:k}=t(),N=ft($.sourceEvent,{transform:v,snapGrid:I,snapToGrid:E,containerBounds:d});if(y=$.sourceEvent,($.sourceEvent.type==="touchmove"&&$.sourceEvent.touches.length>1||_&&!k.has(_))&&(h=!0),!h){if(!c&&H&&l&&(c=!0,L()),!l){const D=ge($.sourceEvent,d),R=D.x-u.x,z=D.y-u.y;Math.sqrt(R*R+z*z)>A&&j($)}(i.x!==N.xSnapped||i.y!==N.ySnapped)&&a&&l&&(u=ge($.sourceEvent,d),T(N))}}).on("end",$=>{if(!(!l||h)&&(c=!1,l=!1,cancelAnimationFrame(s),a.size>0)){const{nodeLookup:H,updateNodePositions:v,onNodeDragStop:I,onSelectionDragStop:E}=t();if(g&&(v(a,!1),g=!1),o||I||!_&&E){const[A,k]=In({nodeId:_,dragItems:a,nodeLookup:H,dragging:!1});o==null||o($.sourceEvent,a,A,k),I==null||I($.sourceEvent,A,k),_||E==null||E($.sourceEvent,k)}}}).filter($=>{const H=$.target;return!$.button&&(!b||!fo(H,`.${b}`,x))&&(!p||fo(H,p,x))});f.call(C)}function m(){f==null||f.on(".drag",null)}return{update:w,destroy:m}}function Tf(e,t,n){const r=[],o={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())xt(o,Ze(i))>0&&r.push(i);return r}const Lf=250;function Of(e,t,n,r){var a,c;let o=[],i=1/0;const s=Tf(e,n,t+Lf);for(const u of s){const d=[...((a=u.internals.handleBounds)==null?void 0:a.source)??[],...((c=u.internals.handleBounds)==null?void 0:c.target)??[]];for(const l of d){if(r.nodeId===l.nodeId&&r.type===l.type&&r.id===l.id)continue;const{x:f,y:h}=He(u,l,l.position,!0),g=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(h-e.y,2));g>t||(g<i?(o=[{...l,x:f,y:h}],i=g):g===i&&o.push({...l,x:f,y:h}))}}if(!o.length)return null;if(o.length>1){const u=r.type==="source"?"target":"source";return o.find(d=>d.type===u)??o[0]}return o[0]}function ts(e,t,n,r,o,i=!1){var u,d,l;const s=r.get(e);if(!s)return null;const a=o==="strict"?(u=s.internals.handleBounds)==null?void 0:u[t]:[...((d=s.internals.handleBounds)==null?void 0:d.source)??[],...((l=s.internals.handleBounds)==null?void 0:l.target)??[]],c=(n?a==null?void 0:a.find(f=>f.id===n):a==null?void 0:a[0])??null;return c&&i?{...c,...He(s,c,c.position,!0)}:c}function ns(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Df(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const rs=()=>!0;function zf(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:c,lib:u,autoPanOnConnect:d,flowId:l,panBy:f,cancelConnection:h,onConnectStart:g,onConnect:y,onConnectEnd:w,isValidConnection:m=rs,onReconnectEnd:b,updateConnection:p,getTransform:x,getFromHandle:S,autoPanSpeed:_,dragThreshold:M=1,handleDomNode:T}){const L=Yi(e.target);let j=0,C;const{x:$,y:H}=ge(e),v=ns(i,T),I=a==null?void 0:a.getBoundingClientRect();let E=!1;if(!I||!v)return;const A=ts(o,v,r,c,t);if(!A)return;let k=ge(e,I),N=!1,D=null,R=!1,z=null;function F(){if(!d||!I)return;const[Z,U]=ji(k,I,_);f({x:Z,y:U}),j=requestAnimationFrame(F)}const B={...A,nodeId:o,type:v,position:A.position},X=c.get(o);let G={inProgress:!0,isValid:null,from:He(X,B,Y.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:X,to:k,toHandle:null,toPosition:Jr[B.position],toNode:null,pointer:k};function V(){E=!0,p(G),g==null||g(e,{nodeId:o,handleId:r,handleType:v})}M===0&&V();function W(Z){if(!E){const{x:se,y:Me}=ge(Z),be=se-$,$e=Me-H;if(!(be*be+$e*$e>M*M))return;V()}if(!S()||!B){Q(Z);return}const U=x();k=ge(Z,I),C=Of(Ct(k,U,!1,[1,1]),n,c,B),N||(F(),N=!0);const q=os(Z,{handle:C,connectionMode:t,fromNodeId:o,fromHandleId:r,fromType:s?"target":"source",isValidConnection:m,doc:L,lib:u,flowId:l,nodeLookup:c});z=q.handleDomNode,D=q.connection,R=Df(!!C,q.isValid);const te=c.get(o),ne=te?He(te,B,Y.Left,!0):G.from,ee={...G,from:ne,isValid:R,to:q.toHandle&&R?tn({x:q.toHandle.x,y:q.toHandle.y},U):k,toHandle:q.toHandle,toPosition:R&&q.toHandle?q.toHandle.position:Jr[B.position],toNode:q.toHandle?c.get(q.toHandle.nodeId):null,pointer:k};p(ee),G=ee}function Q(Z){if(!("touches"in Z&&Z.touches.length>0)){if(E){(C||z)&&D&&R&&(y==null||y(D));const{inProgress:U,...q}=G,te={...q,toPosition:G.toHandle?G.toPosition:null};w==null||w(Z,te),i&&(b==null||b(Z,te))}h(),cancelAnimationFrame(j),N=!1,R=!1,D=null,z=null,L.removeEventListener("mousemove",W),L.removeEventListener("mouseup",Q),L.removeEventListener("touchmove",W),L.removeEventListener("touchend",Q)}}L.addEventListener("mousemove",W),L.addEventListener("mouseup",Q),L.addEventListener("touchmove",W),L.addEventListener("touchend",Q)}function os(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:i,doc:s,lib:a,flowId:c,isValidConnection:u=rs,nodeLookup:d}){const l=i==="target",f=t?s.querySelector(`.${a}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:h,y:g}=ge(e),y=s.elementFromPoint(h,g),w=y!=null&&y.classList.contains(`${a}-flow__handle`)?y:f,m={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const b=ns(void 0,w),p=w.getAttribute("data-nodeid"),x=w.getAttribute("data-handleid"),S=w.classList.contains("connectable"),_=w.classList.contains("connectableend");if(!p||!b)return m;const M={source:l?p:r,sourceHandle:l?x:o,target:l?r:p,targetHandle:l?o:x};m.connection=M;const L=S&&_&&(n===Ke.Strict?l&&b==="source"||!l&&b==="target":p!==r||x!==o);m.isValid=L&&u(M),m.toHandle=ts(p,b,x,d,n,!0)}return m}const nr={onPointerDown:zf,isValid:os};function Rf({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const o=ce(e);function i({translateExtent:a,width:c,height:u,zoomStep:d=1,pannable:l=!0,zoomable:f=!0,inversePan:h=!1}){const g=p=>{if(p.sourceEvent.type!=="wheel"||!t)return;const x=n(),S=p.sourceEvent.ctrlKey&&vt()?10:1,_=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*d,M=x[2]*Math.pow(2,_*S);t.scaleTo(M)};let y=[0,0];const w=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(y=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},m=p=>{const x=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!t)return;const S=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],_=[S[0]-y[0],S[1]-y[1]];y=S;const M=r()*Math.max(x[2],Math.log(x[2]))*(h?-1:1),T={x:x[0]-_[0]*M,y:x[1]-_[1]*M},L=[[0,0],[c,u]];t.setViewportConstrained({x:T.x,y:T.y,zoom:x[2]},L,a)},b=Pi().on("start",w).on("zoom",l?m:null).on("zoom.wheel",f?g:null);o.call(b,{})}function s(){o.on("zoom",null)}return{update:i,destroy:s,pointer:de}}const pn=e=>({x:e.x,y:e.y,zoom:e.k}),An=({x:e,y:t,zoom:n})=>fn.translate(e,t).scale(n),Be=(e,t)=>e.target.closest(`.${t}`),is=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Hf=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,$n=(e,t=0,n=Hf,r=()=>{})=>{const o=typeof t=="number"&&t>0;return o||r(),o?e.transition().duration(t).ease(n).on("end",r):e},ss=e=>{const t=e.ctrlKey&&vt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function jf({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:u}){return d=>{if(Be(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const l=n.property("__zoom").k||1;if(d.ctrlKey&&s){const w=de(d),m=ss(d),b=l*Math.pow(2,m);r.scaleTo(n,b,w,d);return}const f=d.deltaMode===1?20:1;let h=o===Oe.Vertical?0:d.deltaX*f,g=o===Oe.Horizontal?0:d.deltaY*f;!vt()&&d.shiftKey&&o!==Oe.Vertical&&(h=d.deltaY*f,g=0),r.translateBy(n,-(h/l)*i,-(g/l)*i,{internal:!0});const y=pn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(d,y),e.panScrollTimeout=setTimeout(()=>{u==null||u(d,y),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a==null||a(d,y))}}function Vf({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,o){const i=r.type==="wheel",s=!t&&i&&!r.ctrlKey,a=Be(r,e);if(r.ctrlKey&&i&&a&&r.preventDefault(),s||a)return null;r.preventDefault(),n.call(this,r,o)}}function Ff({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,s,a;if((i=r.sourceEvent)!=null&&i.internal)return;const o=pn(r.transform);e.mouseButton=((s=r.sourceEvent)==null?void 0:s.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=o,((a=r.sourceEvent)==null?void 0:a.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,o))}}function Bf({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return i=>{var s,a;e.usedRightMouseButton=!!(n&&is(t,e.mouseButton??0)),(s=i.sourceEvent)!=null&&s.sync||r([i.transform.x,i.transform.y,i.transform.k]),o&&!((a=i.sourceEvent)!=null&&a.internal)&&(o==null||o(i.sourceEvent,pn(i.transform)))}}function Yf({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:o,onPaneContextMenu:i}){return s=>{var a;if(!((a=s.sourceEvent)!=null&&a.internal)&&(e.isZoomingOrPanning=!1,i&&is(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,r(!1),o)){const c=pn(s.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o==null||o(s.sourceEvent,c)},n?150:0)}}}function Xf({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:o,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:c,lib:u,connectionInProgress:d}){return l=>{var w;const f=e||t,h=n&&l.ctrlKey,g=l.type==="wheel";if(l.button===1&&l.type==="mousedown"&&(Be(l,`${u}-flow__node`)||Be(l,`${u}-flow__edge`)))return!0;if(!r&&!f&&!o&&!i&&!n||s||d&&!g||Be(l,a)&&g||Be(l,c)&&(!g||o&&g&&!e)||!n&&l.ctrlKey&&g)return!1;if(!n&&l.type==="touchstart"&&((w=l.touches)==null?void 0:w.length)>1)return l.preventDefault(),!1;if(!f&&!o&&!h&&g||!r&&(l.type==="mousedown"||l.type==="touchstart")||Array.isArray(r)&&!r.includes(l.button)&&l.type==="mousedown")return!1;const y=Array.isArray(r)&&r.includes(l.button)||!l.button||l.button<=1;return(!l.ctrlKey||g)&&y}}function Wf({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:o,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),l=Pi().scaleExtent([t,n]).translateExtent(r),f=ce(e).call(l);b({x:o.x,y:o.y,zoom:Ue(o.zoom,t,n)},[[0,0],[d.width,d.height]],r);const h=f.on("wheel.zoom"),g=f.on("dblclick.zoom");l.wheelDelta(ss);function y(C,$){return f?new Promise(H=>{l==null||l.interpolate(($==null?void 0:$.interpolate)==="linear"?dt:Ft).transform($n(f,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>H(!0)),C)}):Promise.resolve(!1)}function w({noWheelClassName:C,noPanClassName:$,onPaneContextMenu:H,userSelectionActive:v,panOnScroll:I,panOnDrag:E,panOnScrollMode:A,panOnScrollSpeed:k,preventScrolling:N,zoomOnPinch:D,zoomOnScroll:R,zoomOnDoubleClick:z,zoomActivationKeyPressed:F,lib:B,onTransformChange:X,connectionInProgress:K,paneClickDistance:G,selectionOnDrag:V}){v&&!u.isZoomingOrPanning&&m();const W=I&&!F&&!v;l.clickDistance(V?1/0:!he(G)||G<0?0:G);const Q=W?jf({zoomPanValues:u,noWheelClassName:C,d3Selection:f,d3Zoom:l,panOnScrollMode:A,panOnScrollSpeed:k,zoomOnPinch:D,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):Vf({noWheelClassName:C,preventScrolling:N,d3ZoomHandler:h});if(f.on("wheel.zoom",Q,{passive:!1}),!v){const U=Ff({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:s});l.on("start",U);const q=Bf({zoomPanValues:u,panOnDrag:E,onPaneContextMenu:!!H,onPanZoom:i,onTransformChange:X});l.on("zoom",q);const te=Yf({zoomPanValues:u,panOnDrag:E,panOnScroll:I,onPaneContextMenu:H,onPanZoomEnd:a,onDraggingChange:c});l.on("end",te)}const Z=Xf({zoomActivationKeyPressed:F,panOnDrag:E,zoomOnScroll:R,panOnScroll:I,zoomOnDoubleClick:z,zoomOnPinch:D,userSelectionActive:v,noPanClassName:$,noWheelClassName:C,lib:B,connectionInProgress:K});l.filter(Z),z?f.on("dblclick.zoom",g):f.on("dblclick.zoom",null)}function m(){l.on("zoom",null)}async function b(C,$,H){const v=An(C),I=l==null?void 0:l.constrain()(v,$,H);return I&&await y(I),new Promise(E=>E(I))}async function p(C,$){const H=An(C);return await y(H,$),new Promise(v=>v(H))}function x(C){if(f){const $=An(C),H=f.property("__zoom");(H.k!==C.zoom||H.x!==C.x||H.y!==C.y)&&(l==null||l.transform(f,$,null,{sync:!0}))}}function S(){const C=f?$i(f.node()):{x:0,y:0,k:1};return{x:C.x,y:C.y,zoom:C.k}}function _(C,$){return f?new Promise(H=>{l==null||l.interpolate(($==null?void 0:$.interpolate)==="linear"?dt:Ft).scaleTo($n(f,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>H(!0)),C)}):Promise.resolve(!1)}function M(C,$){return f?new Promise(H=>{l==null||l.interpolate(($==null?void 0:$.interpolate)==="linear"?dt:Ft).scaleBy($n(f,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>H(!0)),C)}):Promise.resolve(!1)}function T(C){l==null||l.scaleExtent(C)}function L(C){l==null||l.translateExtent(C)}function j(C){const $=!he(C)||C<0?0:C;l==null||l.clickDistance($)}return{update:w,destroy:m,setViewport:p,setViewportConstrained:b,getViewport:S,scaleTo:_,scaleBy:M,setScaleExtent:T,setTranslateExtent:L,syncViewport:x,setClickDistance:j}}var Je;(function(e){e.Line="line",e.Handle="handle"})(Je||(Je={}));function Gf({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:o,affectsY:i}){const s=e-t,a=n-r,c=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&o&&(c[0]=c[0]*-1),a&&i&&(c[1]=c[1]*-1),c}function ho(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),o=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:o}}function ke(e,t){return Math.max(0,t-e)}function Ce(e,t){return Math.max(0,e-t)}function Rt(e,t,n){return Math.max(0,t-e,e-n)}function go(e,t){return e?!t:t}function qf(e,t,n,r,o,i,s,a){let{affectsX:c,affectsY:u}=t;const{isHorizontal:d,isVertical:l}=t,f=d&&l,{xSnapped:h,ySnapped:g}=n,{minWidth:y,maxWidth:w,minHeight:m,maxHeight:b}=r,{x:p,y:x,width:S,height:_,aspectRatio:M}=e;let T=Math.floor(d?h-e.pointerX:0),L=Math.floor(l?g-e.pointerY:0);const j=S+(c?-T:T),C=_+(u?-L:L),$=-i[0]*S,H=-i[1]*_;let v=Rt(j,y,w),I=Rt(C,m,b);if(s){let k=0,N=0;c&&T<0?k=ke(p+T+$,s[0][0]):!c&&T>0&&(k=Ce(p+j+$,s[1][0])),u&&L<0?N=ke(x+L+H,s[0][1]):!u&&L>0&&(N=Ce(x+C+H,s[1][1])),v=Math.max(v,k),I=Math.max(I,N)}if(a){let k=0,N=0;c&&T>0?k=Ce(p+T,a[0][0]):!c&&T<0&&(k=ke(p+j,a[1][0])),u&&L>0?N=Ce(x+L,a[0][1]):!u&&L<0&&(N=ke(x+C,a[1][1])),v=Math.max(v,k),I=Math.max(I,N)}if(o){if(d){const k=Rt(j/M,m,b)*M;if(v=Math.max(v,k),s){let N=0;!c&&!u||c&&!u&&f?N=Ce(x+H+j/M,s[1][1])*M:N=ke(x+H+(c?T:-T)/M,s[0][1])*M,v=Math.max(v,N)}if(a){let N=0;!c&&!u||c&&!u&&f?N=ke(x+j/M,a[1][1])*M:N=Ce(x+(c?T:-T)/M,a[0][1])*M,v=Math.max(v,N)}}if(l){const k=Rt(C*M,y,w)/M;if(I=Math.max(I,k),s){let N=0;!c&&!u||u&&!c&&f?N=Ce(p+C*M+$,s[1][0])/M:N=ke(p+(u?L:-L)*M+$,s[0][0])/M,I=Math.max(I,N)}if(a){let N=0;!c&&!u||u&&!c&&f?N=ke(p+C*M,a[1][0])/M:N=Ce(p+(u?L:-L)*M,a[0][0])/M,I=Math.max(I,N)}}}L=L+(L<0?I:-I),T=T+(T<0?v:-v),o&&(f?j>C*M?L=(go(c,u)?-T:T)/M:T=(go(c,u)?-L:L)*M:d?(L=T/M,u=c):(T=L*M,c=u));const E=c?p+T:p,A=u?x+L:x;return{width:S+(c?-T:T),height:_+(u?-L:L),x:i[0]*T*(c?-1:1)+E,y:i[1]*L*(u?-1:1)+A}}const as={width:0,height:0,x:0,y:0},Kf={...as,pointerX:0,pointerY:0,aspectRatio:1};function Uf(e){return[[0,0],[e.measured.width,e.measured.height]]}function Zf(e,t,n){const r=t.position.x+e.position.x,o=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,c=n[1]*s;return[[r-a,o-c],[r+i-a,o+s-c]]}function Qf({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){const i=ce(e);let s={controlDirection:ho("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:u,boundaries:d,keepAspectRatio:l,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:y,shouldResize:w}){let m={...as},b={...Kf};s={boundaries:d,resizeDirection:f,keepAspectRatio:l,controlDirection:ho(u)};let p,x=null,S=[],_,M,T,L=!1;const j=yi().on("start",C=>{const{nodeLookup:$,transform:H,snapGrid:v,snapToGrid:I,nodeOrigin:E,paneDomNode:A}=n();if(p=$.get(t),!p)return;x=(A==null?void 0:A.getBoundingClientRect())??null;const{xSnapped:k,ySnapped:N}=ft(C.sourceEvent,{transform:H,snapGrid:v,snapToGrid:I,containerBounds:x});m={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},b={...m,pointerX:k,pointerY:N,aspectRatio:m.width/m.height},_=void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(_=$.get(p.parentId),M=_&&p.extent==="parent"?Uf(_):void 0),S=[],T=void 0;for(const[D,R]of $)if(R.parentId===t&&(S.push({id:D,position:{...R.position},extent:R.extent}),R.extent==="parent"||R.expandParent)){const z=Zf(R,p,R.origin??E);T?T=[[Math.min(z[0][0],T[0][0]),Math.min(z[0][1],T[0][1])],[Math.max(z[1][0],T[1][0]),Math.max(z[1][1],T[1][1])]]:T=z}h==null||h(C,{...m})}).on("drag",C=>{const{transform:$,snapGrid:H,snapToGrid:v,nodeOrigin:I}=n(),E=ft(C.sourceEvent,{transform:$,snapGrid:H,snapToGrid:v,containerBounds:x}),A=[];if(!p)return;const{x:k,y:N,width:D,height:R}=m,z={},F=p.origin??I,{width:B,height:X,x:K,y:G}=qf(b,s.controlDirection,E,s.boundaries,s.keepAspectRatio,F,M,T),V=B!==D,W=X!==R,Q=K!==k&&V,Z=G!==N&&W;if(!Q&&!Z&&!V&&!W)return;if((Q||Z||F[0]===1||F[1]===1)&&(z.x=Q?K:m.x,z.y=Z?G:m.y,m.x=z.x,m.y=z.y,S.length>0)){const ne=K-k,ee=G-N;for(const se of S)se.position={x:se.position.x-ne+F[0]*(B-D),y:se.position.y-ee+F[1]*(X-R)},A.push(se)}if((V||W)&&(z.width=V&&(!s.resizeDirection||s.resizeDirection==="horizontal")?B:m.width,z.height=W&&(!s.resizeDirection||s.resizeDirection==="vertical")?X:m.height,m.width=z.width,m.height=z.height),_&&p.expandParent){const ne=F[0]*(z.width??0);z.x&&z.x<ne&&(m.x=ne,b.x=b.x-(z.x-ne));const ee=F[1]*(z.height??0);z.y&&z.y<ee&&(m.y=ee,b.y=b.y-(z.y-ee))}const U=Gf({width:m.width,prevWidth:D,height:m.height,prevHeight:R,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),q={...m,direction:U};(w==null?void 0:w(C,q))!==!1&&(L=!0,g==null||g(C,q),r(z,A))}).on("end",C=>{L&&(y==null||y(C,{...m}),o==null||o({...m}),L=!1)});i.call(j)}function c(){i.on(".drag",null)}return{update:a,destroy:c}}var Pn={exports:{}},Tn={},Ln={exports:{}},On={};/**
2
2
  * @license React
3
3
  * use-sync-external-store-shim.production.js
4
4
  *
@@ -1,4 +1,4 @@
1
- import{c as a}from"./index-BTuliKhK.js";/**
1
+ import{c as a}from"./index-Cpx47jCH.js";/**
2
2
  * @license lucide-react v0.563.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c}from"./index-BTuliKhK.js";/**
1
+ import{c}from"./index-Cpx47jCH.js";/**
2
2
  * @license lucide-react v0.563.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.