nebulosity 1.0.0 → 1.1.0

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 (180) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +11 -11
  3. package/.next/diagnostics/route-bundle-stats.json +10 -10
  4. package/.next/fallback-build-manifest.json +3 -3
  5. package/.next/prerender-manifest.json +5 -5
  6. package/.next/server/app/_global-error/page/build-manifest.json +3 -3
  7. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  8. package/.next/server/app/_global-error.html +1 -1
  9. package/.next/server/app/_global-error.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  13. package/.next/server/app/_not-found/page/build-manifest.json +3 -3
  14. package/.next/server/app/_not-found/page/next-font-manifest.json +2 -3
  15. package/.next/server/app/_not-found/page.js +3 -2
  16. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  17. package/.next/server/app/_not-found.html +1 -1
  18. package/.next/server/app/_not-found.rsc +27 -20
  19. package/.next/server/app/_not-found.segments/_full.segment.rsc +27 -20
  20. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +34 -26
  21. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  22. package/.next/server/app/index.html +1 -1
  23. package/.next/server/app/index.rsc +29 -23
  24. package/.next/server/app/index.segments/__PAGE__.segment.rsc +33 -24
  25. package/.next/server/app/index.segments/_full.segment.rsc +29 -23
  26. package/.next/server/app/index.segments/_tree.segment.rsc +4 -5
  27. package/.next/server/app/page/build-manifest.json +3 -3
  28. package/.next/server/app/page/next-font-manifest.json +2 -3
  29. package/.next/server/app/page.js +4 -4
  30. package/.next/server/app/page_client-reference-manifest.js +1 -1
  31. package/.next/server/chunks/[root-of-the-server]__06blyow8irfw3._.js +3 -3
  32. package/.next/server/chunks/[root-of-the-server]__0bmqko-d8fd5k._.js +3 -3
  33. package/.next/server/chunks/[root-of-the-server]__0cmmlmvta4i0g._.js +3 -3
  34. package/.next/server/chunks/[root-of-the-server]__0jgr1dt1j95ku._.js +3 -3
  35. package/.next/server/chunks/[root-of-the-server]__0m0n163465-zb._.js +3 -3
  36. package/.next/server/chunks/[root-of-the-server]__0p7epsgp2b5m3._.js +3 -3
  37. package/.next/server/chunks/[root-of-the-server]__1i5e5sqg45ens._.js +3 -3
  38. package/.next/server/chunks/[root-of-the-server]__1vjt0neva-819._.js +3 -3
  39. package/.next/server/chunks/_0uqus0ehnijt-._.js +1 -1
  40. package/.next/server/chunks/lib_background_start_ts_11u_1uu8b9yuy._.js +1 -1
  41. package/.next/server/chunks/ssr/[root-of-the-server]__0_3l5tdzqy-td._.js +3 -0
  42. package/.next/server/chunks/ssr/[root-of-the-server]__10ockmlli-lun._.js +3 -0
  43. package/.next/server/chunks/ssr/{[root-of-the-server]__0dyligeswbb47._.js → [root-of-the-server]__16-gclvix9mjd._.js} +1 -1
  44. package/.next/server/chunks/ssr/[root-of-the-server]__1auodc3c0rppy._.js +3 -0
  45. package/.next/server/chunks/ssr/[root-of-the-server]__1cf6qt9agg_9-._.js +3 -3
  46. package/.next/server/chunks/ssr/[root-of-the-server]__1i9r59yk4i69p._.js +3 -0
  47. package/.next/server/chunks/ssr/[root-of-the-server]__1l3qp8u9yc_ig._.js +3 -0
  48. package/.next/server/chunks/ssr/_1p-0wsx9qfm68._.js +13 -0
  49. package/.next/server/chunks/ssr/app_map_18iu6j19jsqmu._.js +3 -0
  50. package/.next/server/chunks/ssr/node_modules_next_dist_1r3iqtbm45lqp._.js +3 -0
  51. package/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_global-error_0q-w892nagajq.js +3 -0
  52. package/.next/server/middleware-build-manifest.js +11 -11
  53. package/.next/server/next-font-manifest.js +1 -1
  54. package/.next/server/next-font-manifest.json +4 -6
  55. package/.next/server/pages/404.html +1 -1
  56. package/.next/server/pages/500.html +1 -1
  57. package/.next/server/preview-props.json +3 -3
  58. package/.next/server/server-reference-manifest.js +1 -1
  59. package/.next/server/server-reference-manifest.json +1 -1
  60. package/.next/static/chunks/{1rljem7o1jtdo.js → 18kfexnrqek07.js} +1 -1
  61. package/.next/static/chunks/1hwbgd4nvvhg8.js +1 -0
  62. package/.next/static/chunks/25r4lkkf1shfo.css +3 -0
  63. package/.next/static/chunks/35ubvk2ivdjgs.js +1 -0
  64. package/.next/static/chunks/3ieqvmcg3hofj.js +31 -0
  65. package/.next/static/chunks/3w00e1w2125pp.js +11 -0
  66. package/.next/static/media/733da6bd8dac84c8-s.3hlisc-pwq13z.woff2 +0 -0
  67. package/.next/static/media/784318cea1dfcfa4-s.0-oo9_1x_xmvg.woff2 +0 -0
  68. package/.next/static/media/7e114457660b62ed-s.36fqqi66-3tjb.woff2 +0 -0
  69. package/.next/static/media/85e86a88f68a624a-s.357dd_6abeqge.woff2 +0 -0
  70. package/.next/static/media/9a321a2c78eff0b5-s.p.1bkzbscqrt8rl.woff2 +0 -0
  71. package/.next/static/media/9fecbd3e5ea9bccb-s.3_z45zcoc-xoz.woff2 +0 -0
  72. package/.next/static/media/c64053b510252f55-s.1kd-r_s9smv5m.woff2 +0 -0
  73. package/.next/static/media/c6a5c2fdc12da45c-s.p.17-aodiw50953.woff2 +0 -0
  74. package/.next/static/media/f263782c6a4bddee-s.1gyfqm5yhhzs7.woff2 +0 -0
  75. package/.next/trace +1 -1
  76. package/.next/trace-build +1 -1
  77. package/README.md +13 -4
  78. package/app/globals.css +91 -54
  79. package/app/layout.tsx +20 -11
  80. package/app/map/BackButton.tsx +5 -5
  81. package/app/map/BoxActions.tsx +20 -12
  82. package/app/map/Breadcrumb.tsx +132 -46
  83. package/app/map/DetailPanel.tsx +408 -297
  84. package/app/map/Explorer.tsx +268 -0
  85. package/app/map/Header.tsx +105 -0
  86. package/app/map/HelpDialog.tsx +37 -34
  87. package/app/map/Legend.tsx +19 -75
  88. package/app/map/LineCard.tsx +187 -0
  89. package/app/map/MapBox.tsx +73 -38
  90. package/app/map/MapCanvas.tsx +344 -115
  91. package/app/map/MapToolbar.tsx +377 -0
  92. package/app/map/MapView.tsx +217 -213
  93. package/app/map/RepoMenu.tsx +13 -12
  94. package/app/map/RoutedEdge.tsx +48 -16
  95. package/app/map/SearchPalette.tsx +6 -6
  96. package/app/map/SourceViewer.tsx +19 -17
  97. package/app/map/StatusBar.tsx +166 -0
  98. package/app/map/embed.ts +22 -2
  99. package/app/map/emphasis.ts +94 -8
  100. package/app/map/explorerRows.ts +85 -0
  101. package/app/map/flowNodes.ts +12 -7
  102. package/app/map/format.ts +2 -2
  103. package/app/map/history.ts +4 -3
  104. package/app/map/inspector.ts +113 -0
  105. package/app/map/labels.ts +66 -7
  106. package/app/map/narrow.ts +165 -85
  107. package/app/map/opening.ts +16 -0
  108. package/app/map/portals.ts +2 -2
  109. package/app/map/routes.ts +1060 -55
  110. package/app/map/runs.ts +108 -0
  111. package/app/map/shell.ts +91 -0
  112. package/app/map/shortcuts.ts +2 -1
  113. package/app/map/summaries.ts +41 -5
  114. package/app/map/text.ts +9 -1
  115. package/app/map/theme.ts +197 -0
  116. package/app/map/useDismiss.ts +20 -6
  117. package/app/map/useEditorBridge.ts +12 -1
  118. package/app/map/useThemeKind.ts +28 -0
  119. package/app/map/useWindowSize.ts +37 -0
  120. package/app/map/viewport.ts +134 -16
  121. package/app/map/weights.ts +80 -0
  122. package/app/page.tsx +3 -5
  123. package/lib/background/child.ts +2 -0
  124. package/lib/background/service.ts +26 -10
  125. package/lib/contracts.ts +25 -2
  126. package/lib/db/migrations/0011_plain_summaries_prompt_version.sql +1 -0
  127. package/lib/db/migrations/meta/0011_snapshot.json +1498 -0
  128. package/lib/db/migrations/meta/_journal.json +7 -0
  129. package/lib/db/schema.ts +2 -1
  130. package/lib/db/store/map.ts +6 -0
  131. package/lib/db/store/summaries.ts +14 -8
  132. package/lib/engine/describe.ts +2 -0
  133. package/lib/index/summarize/budget.ts +5 -2
  134. package/lib/index/summarize/claude.ts +19 -4
  135. package/lib/index/summarize/compare.ts +2 -2
  136. package/lib/index/summarize/plan.ts +73 -13
  137. package/lib/index/summarize/preview.ts +12 -9
  138. package/lib/index/summarize/prompts.ts +122 -25
  139. package/lib/index/summarize/run.ts +48 -18
  140. package/lib/index/summarize/snapshot.ts +7 -2
  141. package/lib/index/summarize/status.ts +3 -2
  142. package/lib/tools/text.ts +3 -2
  143. package/mcp/server.ts +1 -1
  144. package/package.json +4 -2
  145. package/scripts/commands/summarize-command.ts +27 -9
  146. package/.next/server/chunks/ssr/[root-of-the-server]__0ekw8p2ramybv._.js +0 -3
  147. package/.next/server/chunks/ssr/[root-of-the-server]__0fwbsqt9e2tr-._.js +0 -3
  148. package/.next/server/chunks/ssr/[root-of-the-server]__17_rqmx62cz59._.js +0 -3
  149. package/.next/server/chunks/ssr/[root-of-the-server]__1zfp6sltse4hf._.js +0 -3
  150. package/.next/server/chunks/ssr/_1d2woi6toj_0_._.js +0 -3
  151. package/.next/server/chunks/ssr/_1wfc1zz26g5ji._.js +0 -9
  152. package/.next/server/chunks/ssr/app_0gw6epmxyea3q._.js +0 -3
  153. package/.next/server/chunks/ssr/node_modules_@swc_helpers_cjs__interop_require_default_cjs_1ztp13a5szri_._.js +0 -3
  154. package/.next/server/chunks/ssr/node_modules_next_dist_1c5t_vsn6u8fr._.js +0 -3
  155. package/.next/static/chunks/02x9pxyl2d8om.css +0 -3
  156. package/.next/static/chunks/0p-0bv2dzer18.js +0 -7
  157. package/.next/static/chunks/10u7p2gj02qay.js +0 -1
  158. package/.next/static/chunks/31qp8jfkw0x2h.js +0 -31
  159. package/.next/static/media/123d516c9baeb953-s.1qc6dx89jd2qv.woff2 +0 -0
  160. package/.next/static/media/41ba59f553543ecf-s.3cb5lpr2l6xud.woff2 +0 -0
  161. package/.next/static/media/44ed10da57ebfb0e-s.2y65deuc30pmy.woff2 +0 -0
  162. package/.next/static/media/48eea41d8317494f-s.p.0wiir8udbzjvx.woff2 +0 -0
  163. package/.next/static/media/49b1d53681a91a99-s.1yd4_i3e35931.woff2 +0 -0
  164. package/.next/static/media/67bba87670b402d1-s.1u30mmyq6lnsd.woff2 +0 -0
  165. package/.next/static/media/6fca7e74603dd412-s.02z5rrbg5nt92.woff2 +0 -0
  166. package/.next/static/media/73263b2957b73100-s.2qt3tdwt-y9x_.woff2 +0 -0
  167. package/.next/static/media/7ac0b1cd3e695dd0-s.1i-sca43-qwng.woff2 +0 -0
  168. package/.next/static/media/916cd8a3bde3edf8-s.p.0oace-s_gkfks.woff2 +0 -0
  169. package/.next/static/media/a45aa1001bf9176f-s.2vemzm0itqzfy.woff2 +0 -0
  170. package/.next/static/media/a74d2542cc4c775f-s.29yke99gs9qpn.woff2 +0 -0
  171. package/.next/static/media/ab664c0e419cc841-s.3cvcemwuzoywn.woff2 +0 -0
  172. package/.next/static/media/c1b11b726b36a5e5-s.2rixgazldzomk.woff2 +0 -0
  173. package/.next/static/media/d6c1ff7e86974212-s.p.40sczeszzbjw1.woff2 +0 -0
  174. package/.next/static/media/faab88e4be272d29-s.0rgnxg2b64rzs.woff2 +0 -0
  175. package/app/map/ActivityBar.tsx +0 -81
  176. package/app/map/StatusPill.tsx +0 -93
  177. package/app/map/TopBar.tsx +0 -84
  178. /package/.next/static/{prDi039MhjlFqDOOwZ4aR → of6twfEZ3j95xtfQB_NSL}/_buildManifest.js +0 -0
  179. /package/.next/static/{prDi039MhjlFqDOOwZ4aR → of6twfEZ3j95xtfQB_NSL}/_clientMiddlewareManifest.js +0 -0
  180. /package/.next/static/{prDi039MhjlFqDOOwZ4aR → of6twfEZ3j95xtfQB_NSL}/_ssgManifest.js +0 -0
@@ -1,7 +0,0 @@
1
- (()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,75772,e=>{var t,n,r,o,i,a,l,s,u,d,c,h,f,p,g,m,x,y=e.i(43476),v=e.i(71645);function b(e){if("string"==typeof e||"number"==typeof e)return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)""!==(r=b(e[n]))&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var w={value:()=>{}};function E(){for(var e,t=0,n=arguments.length,r={};t<n;++t){if(!(e=arguments[t]+"")||e in r||/[\s.]/.test(e))throw Error("illegal type: "+e);r[e]=[]}return new k(r)}function k(e){this._=e}function _(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=w,e=e.slice(0,r).concat(e.slice(r+1));break}return null!=n&&e.push({name:t,value:n}),e}function j(){}function S(e){return null==e?j:function(){return this.querySelector(e)}}function M(){return[]}function N(e){return null==e?M:function(){return this.querySelectorAll(e)}}function C(e){return function(){return this.matches(e)}}function $(e){return function(t){return t.matches(e)}}k.prototype=E.prototype={constructor:k,on:function(e,t){var n,r=this._,o=(e+"").trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");if(n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),e&&!r.hasOwnProperty(e))throw Error("unknown type: "+e);return{type:e,name:t}}),i=-1,a=o.length;if(arguments.length<2){for(;++i<a;)if((n=(e=o[i]).type)&&(n=function(e,t){for(var n,r=0,o=e.length;r<o;++r)if((n=e[r]).name===t)return n.value}(r[n],e.name)))return n;return}if(null!=t&&"function"!=typeof t)throw Error("invalid callback: "+t);for(;++i<a;)if(n=(e=o[i]).type)r[n]=_(r[n],e.name,t);else if(null==t)for(n in r)r[n]=_(r[n],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new k(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var n,r,o=Array(n),i=0;i<n;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw Error("unknown type: "+e);for(r=this._[e],i=0,n=r.length;i<n;++i)r[i].value.apply(t,o)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error("unknown type: "+e);for(var r=this._[e],o=0,i=r.length;o<i;++o)r[o].value.apply(t,n)}};var O=Array.prototype.find;function P(){return this.firstElementChild}var A=Array.prototype.filter;function R(){return Array.from(this.children)}function z(e){return Array(e.length)}function L(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function I(e,t,n,r,o,i){for(var a,l=0,s=t.length,u=i.length;l<u;++l)(a=t[l])?(a.__data__=i[l],r[l]=a):n[l]=new L(e,i[l]);for(;l<s;++l)(a=t[l])&&(o[l]=a)}function D(e,t,n,r,o,i,a){var l,s,u,d=new Map,c=t.length,h=i.length,f=Array(c);for(l=0;l<c;++l)(s=t[l])&&(f[l]=u=a.call(s,s.__data__,l,t)+"",d.has(u)?o[l]=s:d.set(u,s));for(l=0;l<h;++l)u=a.call(e,i[l],l,i)+"",(s=d.get(u))?(r[l]=s,s.__data__=i[l],d.delete(u)):n[l]=new L(e,i[l]);for(l=0;l<c;++l)(s=t[l])&&d.get(f[l])===s&&(o[l]=s)}function B(e){return e.__data__}function T(e,t){return e<t?-1:e>t?1:e>=t?0:0/0}L.prototype={constructor:L,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)}};var H="http://www.w3.org/1999/xhtml";let V={svg:"http://www.w3.org/2000/svg",xhtml:H,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function F(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),V.hasOwnProperty(t)?{space:V[t],local:e}:e}function q(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function X(e,t){return e.style.getPropertyValue(t)||q(e).getComputedStyle(e,null).getPropertyValue(t)}function W(e){return e.trim().split(/^|\s+/)}function Y(e){return e.classList||new K(e)}function K(e){this._node=e,this._names=W(e.getAttribute("class")||"")}function U(e,t){for(var n=Y(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function Z(e,t){for(var n=Y(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function G(){this.textContent=""}function Q(){this.innerHTML=""}function J(){this.nextSibling&&this.parentNode.appendChild(this)}function ee(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function et(e){var t=F(e);return(t.local?function(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}:function(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===H&&t.documentElement.namespaceURI===H?t.createElement(e):t.createElementNS(n,e)}})(t)}function en(){return null}function er(){var e=this.parentNode;e&&e.removeChild(this)}function eo(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ei(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ea(e){return function(){var t=this.__on;if(t){for(var n,r=0,o=-1,i=t.length;r<i;++r)(n=t[r],e.type&&n.type!==e.type||n.name!==e.name)?t[++o]=n:this.removeEventListener(n.type,n.listener,n.options);++o?t.length=o:delete this.__on}}}function el(e,t,n){return function(){var r,o=this.__on,i=function(e){t.call(this,e,this.__data__)};if(o){for(var a=0,l=o.length;a<l;++a)if((r=o[a]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),r.value=t;return}}this.addEventListener(e.type,i,n),r={type:e.type,name:e.name,value:t,listener:i,options:n},o?o.push(r):this.__on=[r]}}function es(e,t,n){var r=q(e),o=r.CustomEvent;"function"==typeof o?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)}K.prototype={add:function(e){0>this._names.indexOf(e)&&(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}};var eu=[null];function ed(e,t){this._groups=e,this._parents=t}function ec(){return new ed([[document.documentElement]],eu)}function eh(e){return"string"==typeof e?new ed([[document.querySelector(e)]],[document.documentElement]):new ed([[e]],eu)}function ef(e,t){if(e=function(e){let t;for(;t=e.sourceEvent;)e=t;return e}(e),void 0===t&&(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())).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]}ed.prototype=ec.prototype={constructor:ed,select:function(e){"function"!=typeof e&&(e=S(e));for(var t=this._groups,n=t.length,r=Array(n),o=0;o<n;++o)for(var i,a,l=t[o],s=l.length,u=r[o]=Array(s),d=0;d<s;++d)(i=l[d])&&(a=e.call(i,i.__data__,d,l))&&("__data__"in i&&(a.__data__=i.__data__),u[d]=a);return new ed(r,this._parents)},selectAll:function(e){if("function"==typeof e){var t;t=e,e=function(){var e;return e=t.apply(this,arguments),null==e?[]:Array.isArray(e)?e:Array.from(e)}}else e=N(e);for(var n=this._groups,r=n.length,o=[],i=[],a=0;a<r;++a)for(var l,s=n[a],u=s.length,d=0;d<u;++d)(l=s[d])&&(o.push(e.call(l,l.__data__,d,s)),i.push(l));return new ed(o,i)},selectChild:function(e){var t;return this.select(null==e?P:(t="function"==typeof e?e:$(e),function(){return O.call(this.children,t)}))},selectChildren:function(e){var t;return this.selectAll(null==e?R:(t="function"==typeof e?e:$(e),function(){return A.call(this.children,t)}))},filter:function(e){"function"!=typeof e&&(e=C(e));for(var t=this._groups,n=t.length,r=Array(n),o=0;o<n;++o)for(var i,a=t[o],l=a.length,s=r[o]=[],u=0;u<l;++u)(i=a[u])&&e.call(i,i.__data__,u,a)&&s.push(i);return new ed(r,this._parents)},data:function(e,t){if(!arguments.length)return Array.from(this,B);var n=t?D:I,r=this._parents,o=this._groups;"function"!=typeof e&&(y=e,e=function(){return y});for(var i=o.length,a=Array(i),l=Array(i),s=Array(i),u=0;u<i;++u){var d=r[u],c=o[u],h=c.length,f="object"==typeof(x=e.call(d,d&&d.__data__,u,r))&&"length"in x?x:Array.from(x),p=f.length,g=l[u]=Array(p),m=a[u]=Array(p);n(d,c,g,m,s[u]=Array(h),f,t);for(var x,y,v,b,w=0,E=0;w<p;++w)if(v=g[w]){for(w>=E&&(E=w+1);!(b=m[E])&&++E<p;);v._next=b||null}}return(a=new ed(a,r))._enter=l,a._exit=s,a},enter:function(){return new ed(this._enter||this._groups.map(z),this._parents)},exit:function(){return new ed(this._exit||this._groups.map(z),this._parents)},join:function(e,t,n){var r=this.enter(),o=this,i=this.exit();return"function"==typeof e?(r=e(r))&&(r=r.selection()):r=r.append(e+""),null!=t&&(o=t(o))&&(o=o.selection()),null==n?i.remove():n(i),r&&o?r.merge(o).order():o},merge:function(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,o=n.length,i=r.length,a=Math.min(o,i),l=Array(o),s=0;s<a;++s)for(var u,d=n[s],c=r[s],h=d.length,f=l[s]=Array(h),p=0;p<h;++p)(u=d[p]||c[p])&&(f[p]=u);for(;s<o;++s)l[s]=n[s];return new ed(l,this._parents)},selection:function(){return this},order:function(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r,o=e[t],i=o.length-1,a=o[i];--i>=0;)(r=o[i])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=T);for(var n=this._groups,r=n.length,o=Array(r),i=0;i<r;++i){for(var a,l=n[i],s=l.length,u=o[i]=Array(s),d=0;d<s;++d)(a=l[d])&&(u[d]=a);u.sort(t)}return new ed(o,this._parents).order()},call:function(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){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 a=r[o];if(a)return a}return null},size:function(){let e=0;for(let t of this)++e;return e},empty:function(){return!this.node()},each:function(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var o,i=t[n],a=0,l=i.length;a<l;++a)(o=i[a])&&e.call(o,o.__data__,a,i);return this},attr:function(e,t){var n=F(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((null==t?n.local?function(e){return function(){this.removeAttributeNS(e.space,e.local)}}:function(e){return function(){this.removeAttribute(e)}}:"function"==typeof t?n.local?function(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}:function(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}:n.local?function(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}:function(e,t){return function(){this.setAttribute(e,t)}})(n,t))},style:function(e,t,n){return arguments.length>1?this.each((null==t?function(e){return function(){this.style.removeProperty(e)}}:"function"==typeof t?function(e,t,n){return function(){var r=t.apply(this,arguments);null==r?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}:function(e,t,n){return function(){this.style.setProperty(e,t,n)}})(e,t,null==n?"":n)):X(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?function(e){return function(){delete this[e]}}:"function"==typeof t?function(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}:function(e,t){return function(){this[e]=t}})(e,t)):this.node()[e]},classed:function(e,t){var n=W(e+"");if(arguments.length<2){for(var r=Y(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each(("function"==typeof t?function(e,t){return function(){(t.apply(this,arguments)?U:Z)(this,e)}}:t?function(e){return function(){U(this,e)}}:function(e){return function(){Z(this,e)}})(n,t))},text:function(e){return arguments.length?this.each(null==e?G:("function"==typeof e?function(e){return function(){var t=e.apply(this,arguments);this.textContent=null==t?"":t}}:function(e){return function(){this.textContent=e}})(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?Q:("function"==typeof e?function(e){return function(){var t=e.apply(this,arguments);this.innerHTML=null==t?"":t}}:function(e){return function(){this.innerHTML=e}})(e)):this.node().innerHTML},raise:function(){return this.each(J)},lower:function(){return this.each(ee)},append:function(e){var t="function"==typeof e?e:et(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})},insert:function(e,t){var n="function"==typeof e?e:et(e),r=null==t?en:"function"==typeof t?t:S(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(er)},clone:function(e){return this.select(e?ei:eo)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,t,n){var r,o,i=(e+"").trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}}),a=i.length;if(arguments.length<2){var l=this.node().__on;if(l){for(var s,u=0,d=l.length;u<d;++u)for(r=0,s=l[u];r<a;++r)if((o=i[r]).type===s.type&&o.name===s.name)return s.value}return}for(l=t?el:ea,r=0;r<a;++r)this.each(l(i[r],t,n));return this},dispatch:function(e,t){return this.each(("function"==typeof t?function(e,t){return function(){return es(this,e,t.apply(this,arguments))}}:function(e,t){return function(){return es(this,e,t)}})(e,t))},[Symbol.iterator]:function*(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r,o=e[t],i=0,a=o.length;i<a;++i)(r=o[i])&&(yield r)}};let ep={passive:!1},eg={capture:!0,passive:!1};function em(e){e.stopImmediatePropagation()}function ex(e){e.preventDefault(),e.stopImmediatePropagation()}function ey(e){var t=e.document.documentElement,n=eh(e).on("dragstart.drag",ex,eg);"onselectstart"in t?n.on("selectstart.drag",ex,eg):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function ev(e,t){var n=e.document.documentElement,r=eh(e).on("dragstart.drag",null);t&&(r.on("click.drag",ex,eg),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}let eb=e=>()=>e;function ew(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:i,x:a,y:l,dx:s,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:a,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:s,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}function eE(e){return!e.ctrlKey&&!e.button}function ek(){return this.parentNode}function e_(e,t){return null==t?{x:e.x,y:e.y}:t}function ej(){return navigator.maxTouchPoints||"ontouchstart"in this}function eS(){var e,t,n,r,o=eE,i=ek,a=e_,l=ej,s={},u=E("start","drag","end"),d=0,c=0;function h(e){e.on("mousedown.drag",f).filter(l).on("touchstart.drag",m).on("touchmove.drag",x,ep).on("touchend.drag touchcancel.drag",y).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(a,l){if(!r&&o.call(this,a,l)){var s=v(this,i.call(this,a,l),a,l,"mouse");s&&(eh(a.view).on("mousemove.drag",p,eg).on("mouseup.drag",g,eg),ey(a.view),em(a),n=!1,e=a.clientX,t=a.clientY,s("start",a))}}function p(r){if(ex(r),!n){var o=r.clientX-e,i=r.clientY-t;n=o*o+i*i>c}s.mouse("drag",r)}function g(e){eh(e.view).on("mousemove.drag mouseup.drag",null),ev(e.view,n),ex(e),s.mouse("end",e)}function m(e,t){if(o.call(this,e,t)){var n,r,a=e.changedTouches,l=i.call(this,e,t),s=a.length;for(n=0;n<s;++n)(r=v(this,l,e,t,a[n].identifier,a[n]))&&(em(e),r("start",e,a[n]))}}function x(e){var t,n,r=e.changedTouches,o=r.length;for(t=0;t<o;++t)(n=s[r[t].identifier])&&(ex(e),n("drag",e,r[t]))}function y(e){var t,n,o=e.changedTouches,i=o.length;for(r&&clearTimeout(r),r=setTimeout(function(){r=null},500),t=0;t<i;++t)(n=s[o[t].identifier])&&(em(e),n("end",e,o[t]))}function v(e,t,n,r,o,i){var l,c,f,p=u.copy(),g=ef(i||n,t);if(null!=(f=a.call(e,new ew("beforestart",{sourceEvent:n,target:h,identifier:o,active:d,x:g[0],y:g[1],dx:0,dy:0,dispatch:p}),r)))return l=f.x-g[0]||0,c=f.y-g[1]||0,function n(i,a,u){var m,x=g;switch(i){case"start":s[o]=n,m=d++;break;case"end":delete s[o],--d;case"drag":g=ef(u||a,t),m=d}p.call(i,e,new ew(i,{sourceEvent:a,subject:f,target:h,identifier:o,active:m,x:g[0]+l,y:g[1]+c,dx:g[0]-x[0],dy:g[1]-x[1],dispatch:p}),r)}}return h.filter=function(e){return arguments.length?(o="function"==typeof e?e:eb(!!e),h):o},h.container=function(e){return arguments.length?(i="function"==typeof e?e:eb(e),h):i},h.subject=function(e){return arguments.length?(a="function"==typeof e?e:eb(e),h):a},h.touchable=function(e){return arguments.length?(l="function"==typeof e?e:eb(!!e),h):l},h.on=function(){var e=u.on.apply(u,arguments);return e===u?h:e},h.clickDistance=function(e){return arguments.length?(c=(e*=1)*e,h):Math.sqrt(c)},h}function eM(e){return((e=Math.exp(e))+1/e)/2}ew.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};let eN=function e(t,n,r){function o(e,o){var i,a,l=e[0],s=e[1],u=e[2],d=o[0],c=o[1],h=o[2],f=d-l,p=c-s,g=f*f+p*p;if(g<1e-12)a=Math.log(h/u)/t,i=function(e){return[l+e*f,s+e*p,u*Math.exp(t*e*a)]};else{var m=Math.sqrt(g),x=(h*h-u*u+r*g)/(2*u*n*m),y=(h*h-u*u-r*g)/(2*h*n*m),v=Math.log(Math.sqrt(x*x+1)-x);a=(Math.log(Math.sqrt(y*y+1)-y)-v)/t,i=function(e){var r,o,i=e*a,d=eM(v),c=u/(n*m)*(d*(((r=Math.exp(2*(r=t*i+v)))-1)/(r+1))-((o=Math.exp(o=v))-1/o)/2);return[l+c*f,s+c*p,u*d/eM(t*i+v)]}}return i.duration=1e3*a*t/Math.SQRT2,i}return o.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},o}(Math.SQRT2,2,4);var eC,e$,eO=0,eP=0,eA=0,eR=0,ez=0,eL=0,eI="object"==typeof performance&&performance.now?performance:Date,eD="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function eB(){return ez||(eD(eT),ez=eI.now()+eL)}function eT(){ez=0}function eH(){this._call=this._time=this._next=null}function eV(e,t,n){var r=new eH;return r.restart(e,t,n),r}function eF(){ez=(eR=eI.now())+eL,eO=eP=0;try{eB(),++eO;for(var e,t=eC;t;)(e=ez-t._time)>=0&&t._call.call(void 0,e),t=t._next;--eO}finally{eO=0,function(){for(var e,t,n=eC,r=1/0;n;)n._call?(r>n._time&&(r=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:eC=t);e$=e,eX(r)}(),ez=0}}function eq(){var e=eI.now(),t=e-eR;t>1e3&&(eL-=t,eR=e)}function eX(e){!eO&&(eP&&(eP=clearTimeout(eP)),e-ez>24?(e<1/0&&(eP=setTimeout(eF,e-eI.now()-eL)),eA&&(eA=clearInterval(eA))):(eA||(eR=eI.now(),eA=setInterval(eq,1e3)),eO=1,eD(eF)))}function eW(e,t,n){var r=new eH;return t=null==t?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}eH.prototype=eV.prototype={constructor:eH,restart:function(e,t,n){if("function"!=typeof e)throw TypeError("callback is not a function");n=(null==n?eB():+n)+(null==t?0:+t),this._next||e$===this||(e$?e$._next=this:eC=this,e$=this),this._call=e,this._time=n,eX()},stop:function(){this._call&&(this._call=null,this._time=1/0,eX())}};var eY=E("start","end","cancel","interrupt"),eK=[];function eU(e,t,n,r,o,i){var a=e.__transition;if(a){if(n in a)return}else e.__transition={};!function(e,t,n){var r,o=e.__transition;function i(s){var u,d,c,h;if(1!==n.state)return l();for(u in o)if((h=o[u]).name===n.name){if(3===h.state)return eW(i);4===h.state?(h.state=6,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[u]):+u<t&&(h.state=6,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete o[u])}if(eW(function(){3===n.state&&(n.state=4,n.timer.restart(a,n.delay,n.time),a(s))}),n.state=2,n.on.call("start",e,e.__data__,n.index,n.group),2===n.state){for(n.state=3,r=Array(c=n.tween.length),u=0,d=-1;u<c;++u)(h=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++d]=h);r.length=d+1}}function a(t){for(var o=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(l),n.state=5,1),i=-1,a=r.length;++i<a;)r[i].call(e,o);5===n.state&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){for(var r in n.state=6,n.timer.stop(),delete o[t],o)return;delete e.__transition}o[t]=n,n.timer=eV(function(e){n.state=1,n.timer.restart(i,n.delay,n.time),n.delay<=e&&i(e-n.delay)},0,n.time)}(e,n,{name:t,index:r,group:o,on:eY,tween:eK,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:0})}function eZ(e,t){var n=eQ(e,t);if(n.state>0)throw Error("too late; already scheduled");return n}function eG(e,t){var n=eQ(e,t);if(n.state>3)throw Error("too late; already running");return n}function eQ(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error("transition not found");return n}function eJ(e,t){var n,r,o,i=e.__transition,a=!0;if(i){for(o in t=null==t?null:t+"",i){if((n=i[o]).name!==t){a=!1;continue}r=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete i[o]}a&&delete e.__transition}}function e0(e,t){return e*=1,t*=1,function(n){return e*(1-n)+t*n}}var e1=180/Math.PI,e2={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function e3(e,t,n,r,o,i){var a,l,s;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(s=e*n+t*r)&&(n-=e*s,r-=t*s),(l=Math.sqrt(n*n+r*r))&&(n/=l,r/=l,s/=l),e*r<t*n&&(e=-e,t=-t,s=-s,a=-a),{translateX:o,translateY:i,rotate:Math.atan2(t,e)*e1,skewX:Math.atan(s)*e1,scaleX:a,scaleY:l}}function e5(e,t,n,r){function o(e){return e.length?e.pop()+" ":""}return function(i,a){var l,s,u,d,c=[],h=[];return i=e(i),a=e(a),!function(e,r,o,i,a,l){if(e!==o||r!==i){var s=a.push("translate(",null,t,null,n);l.push({i:s-4,x:e0(e,o)},{i:s-2,x:e0(r,i)})}else(o||i)&&a.push("translate("+o+t+i+n)}(i.translateX,i.translateY,a.translateX,a.translateY,c,h),l=i.rotate,s=a.rotate,l!==s?(l-s>180?s+=360:s-l>180&&(l+=360),h.push({i:c.push(o(c)+"rotate(",null,r)-2,x:e0(l,s)})):s&&c.push(o(c)+"rotate("+s+r),u=i.skewX,d=a.skewX,u!==d?h.push({i:c.push(o(c)+"skewX(",null,r)-2,x:e0(u,d)}):d&&c.push(o(c)+"skewX("+d+r),!function(e,t,n,r,i,a){if(e!==n||t!==r){var l=i.push(o(i)+"scale(",null,",",null,")");a.push({i:l-4,x:e0(e,n)},{i:l-2,x:e0(t,r)})}else(1!==n||1!==r)&&i.push(o(i)+"scale("+n+","+r+")")}(i.scaleX,i.scaleY,a.scaleX,a.scaleY,c,h),i=a=null,function(e){for(var t,n=-1,r=h.length;++n<r;)c[(t=h[n]).i]=t.x(e);return c.join("")}}}var e4=e5(function(e){let t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?e2:e3(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),e6=e5(function(e){return null==e?e2:(u||(u=document.createElementNS("http://www.w3.org/2000/svg","g")),u.setAttribute("transform",e),e=u.transform.baseVal.consolidate())?e3((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):e2},", ",")",")");function e8(e,t,n){var r=e._id;return e.each(function(){var e=eG(this,r);(e.value||(e.value={}))[t]=n.apply(this,arguments)}),function(e){return eQ(e,r).value[t]}}function e7(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function e9(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function te(){}var tt=1/.7,tn="\\s*([+-]?\\d+)\\s*",tr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",to="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ti=/^#([0-9a-f]{3,8})$/,ta=RegExp(`^rgb\\(${tn},${tn},${tn}\\)$`),tl=RegExp(`^rgb\\(${to},${to},${to}\\)$`),ts=RegExp(`^rgba\\(${tn},${tn},${tn},${tr}\\)$`),tu=RegExp(`^rgba\\(${to},${to},${to},${tr}\\)$`),td=RegExp(`^hsl\\(${tr},${to},${to}\\)$`),tc=RegExp(`^hsla\\(${tr},${to},${to},${tr}\\)$`),th={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32};function tf(){return this.rgb().formatHex()}function tp(){return this.rgb().formatRgb()}function tg(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=ti.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?tm(t):3===n?new tv(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?tx(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?tx(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=ta.exec(e))?new tv(t[1],t[2],t[3],1):(t=tl.exec(e))?new tv(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=ts.exec(e))?tx(t[1],t[2],t[3],t[4]):(t=tu.exec(e))?tx(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=td.exec(e))?tj(t[1],t[2]/100,t[3]/100,1):(t=tc.exec(e))?tj(t[1],t[2]/100,t[3]/100,t[4]):th.hasOwnProperty(e)?tm(th[e]):"transparent"===e?new tv(0/0,0/0,0/0,0):null}function tm(e){return new tv(e>>16&255,e>>8&255,255&e,1)}function tx(e,t,n,r){return r<=0&&(e=t=n=0/0),new tv(e,t,n,r)}function ty(e,t,n,r){var o;return 1==arguments.length?((o=e)instanceof te||(o=tg(o)),o)?new tv((o=o.rgb()).r,o.g,o.b,o.opacity):new tv:new tv(e,t,n,null==r?1:r)}function tv(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function tb(){return`#${t_(this.r)}${t_(this.g)}${t_(this.b)}`}function tw(){let e=tE(this.opacity);return`${1===e?"rgb(":"rgba("}${tk(this.r)}, ${tk(this.g)}, ${tk(this.b)}${1===e?")":`, ${e})`}`}function tE(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function tk(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function t_(e){return((e=tk(e))<16?"0":"")+e.toString(16)}function tj(e,t,n,r){return r<=0?e=t=n=0/0:n<=0||n>=1?e=t=0/0:t<=0&&(e=0/0),new tM(e,t,n,r)}function tS(e){if(e instanceof tM)return new tM(e.h,e.s,e.l,e.opacity);if(e instanceof te||(e=tg(e)),!e)return new tM;if(e instanceof tM)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),i=Math.max(t,n,r),a=0/0,l=i-o,s=(i+o)/2;return l?(a=t===i?(n-r)/l+(n<r)*6:n===i?(r-t)/l+2:(t-n)/l+4,l/=s<.5?i+o:2-i-o,a*=60):l=s>0&&s<1?0:a,new tM(a,l,s,e.opacity)}function tM(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function tN(e){return(e=(e||0)%360)<0?e+360:e}function tC(e){return Math.max(0,Math.min(1,e||0))}function t$(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}function tO(e,t,n,r,o){var i=e*e,a=i*e;return((1-3*e+3*i-a)*t+(4-6*i+3*a)*n+(1+3*e+3*i-3*a)*r+a*o)/6}e7(te,tg,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:tf,formatHex:tf,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return tS(this).formatHsl()},formatRgb:tp,toString:tp}),e7(tv,ty,e9(te,{brighter(e){return e=null==e?tt:Math.pow(tt,e),new tv(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?.7:Math.pow(.7,e),new tv(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new tv(tk(this.r),tk(this.g),tk(this.b),tE(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:tb,formatHex:tb,formatHex8:function(){return`#${t_(this.r)}${t_(this.g)}${t_(this.b)}${t_((isNaN(this.opacity)?1:this.opacity)*255)}`},formatRgb:tw,toString:tw})),e7(tM,function(e,t,n,r){return 1==arguments.length?tS(e):new tM(e,t,n,null==r?1:r)},e9(te,{brighter(e){return e=null==e?tt:Math.pow(tt,e),new tM(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?.7:Math.pow(.7,e),new tM(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 tv(t$(e>=240?e-240:e+120,o,r),t$(e,o,r),t$(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new tM(tN(this.h),tC(this.s),tC(this.l),tE(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(){let e=tE(this.opacity);return`${1===e?"hsl(":"hsla("}${tN(this.h)}, ${100*tC(this.s)}%, ${100*tC(this.l)}%${1===e?")":`, ${e})`}`}}));let tP=e=>()=>e;function tA(e,t){var n=t-e;return n?function(t){return e+t*n}:tP(isNaN(e)?t:e)}let tR=function e(t){var n,r=1==(n=+t)?tA:function(e,t){var r,o,i;return t-e?(r=e,o=t,r=Math.pow(r,i=n),o=Math.pow(o,i)-r,i=1/i,function(e){return Math.pow(r+e*o,i)}):tP(isNaN(e)?t:e)};function o(e,t){var n=r((e=ty(e)).r,(t=ty(t)).r),o=r(e.g,t.g),i=r(e.b,t.b),a=tA(e.opacity,t.opacity);return function(t){return e.r=n(t),e.g=o(t),e.b=i(t),e.opacity=a(t),e+""}}return o.gamma=e,o}(1);function tz(e){return function(t){var n,r,o=t.length,i=Array(o),a=Array(o),l=Array(o);for(n=0;n<o;++n)r=ty(t[n]),i[n]=r.r||0,a[n]=r.g||0,l[n]=r.b||0;return i=e(i),a=e(a),l=e(l),r.opacity=1,function(e){return r.r=i(e),r.g=a(e),r.b=l(e),r+""}}}tz(function(e){var t=e.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),o=e[r],i=e[r+1],a=r>0?e[r-1]:2*o-i,l=r<t-1?e[r+2]:2*i-o;return tO((n-r/t)*t,a,o,i,l)}}),tz(function(e){var t=e.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*t),o=e[(r+t-1)%t],i=e[r%t],a=e[(r+1)%t],l=e[(r+2)%t];return tO((n-r/t)*t,o,i,a,l)}});var tL=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,tI=RegExp(tL.source,"g");function tD(e,t){var n,r,o,i,a,l=tL.lastIndex=tI.lastIndex=0,s=-1,u=[],d=[];for(e+="",t+="";(o=tL.exec(e))&&(i=tI.exec(t));)(a=i.index)>l&&(a=t.slice(l,a),u[s]?u[s]+=a:u[++s]=a),(o=o[0])===(i=i[0])?u[s]?u[s]+=i:u[++s]=i:(u[++s]=null,d.push({i:s,x:e0(o,i)})),l=tI.lastIndex;return l<t.length&&(a=t.slice(l),u[s]?u[s]+=a:u[++s]=a),u.length<2?d[0]?(n=d[0].x,function(e){return n(e)+""}):(r=t,function(){return r}):(t=d.length,function(e){for(var n,r=0;r<t;++r)u[(n=d[r]).i]=n.x(e);return u.join("")})}function tB(e,t){var n;return("number"==typeof t?e0:t instanceof tg?tR:(n=tg(t))?(t=n,tR):tD)(e,t)}var tT=ec.prototype.constructor;function tH(e){return function(){this.style.removeProperty(e)}}var tV=0;function tF(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}var tq=ec.prototype;tF.prototype=(function(e){return ec().transition(e)}).prototype={constructor:tF,select:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=S(e));for(var r=this._groups,o=r.length,i=Array(o),a=0;a<o;++a)for(var l,s,u=r[a],d=u.length,c=i[a]=Array(d),h=0;h<d;++h)(l=u[h])&&(s=e.call(l,l.__data__,h,u))&&("__data__"in l&&(s.__data__=l.__data__),c[h]=s,eU(c[h],t,n,h,c,eQ(l,n)));return new tF(i,this._parents,t,n)},selectAll:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=N(e));for(var r=this._groups,o=r.length,i=[],a=[],l=0;l<o;++l)for(var s,u=r[l],d=u.length,c=0;c<d;++c)if(s=u[c]){for(var h,f=e.call(s,s.__data__,c,u),p=eQ(s,n),g=0,m=f.length;g<m;++g)(h=f[g])&&eU(h,t,n,g,f,p);i.push(f),a.push(s)}return new tF(i,a,t,n)},selectChild:tq.selectChild,selectChildren:tq.selectChildren,filter:function(e){"function"!=typeof e&&(e=C(e));for(var t=this._groups,n=t.length,r=Array(n),o=0;o<n;++o)for(var i,a=t[o],l=a.length,s=r[o]=[],u=0;u<l;++u)(i=a[u])&&e.call(i,i.__data__,u,a)&&s.push(i);return new tF(r,this._parents,this._name,this._id)},merge:function(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,o=n.length,i=Math.min(r,o),a=Array(r),l=0;l<i;++l)for(var s,u=t[l],d=n[l],c=u.length,h=a[l]=Array(c),f=0;f<c;++f)(s=u[f]||d[f])&&(h[f]=s);for(;l<r;++l)a[l]=t[l];return new tF(a,this._parents,this._name,this._id)},selection:function(){return new tT(this._groups,this._parents)},transition:function(){for(var e=this._name,t=this._id,n=++tV,r=this._groups,o=r.length,i=0;i<o;++i)for(var a,l=r[i],s=l.length,u=0;u<s;++u)if(a=l[u]){var d=eQ(a,t);eU(a,e,n,u,l,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new tF(r,this._parents,e,n)},call:tq.call,nodes:tq.nodes,node:tq.node,size:tq.size,empty:tq.empty,each:tq.each,on:function(e,t){var n,r,o,i,a,l,s=this._id;return arguments.length<2?eQ(this.node(),s).on.on(e):this.each((n=s,r=e,o=t,l=(r+"").trim().split(/^|\s+/).every(function(e){var t=e.indexOf(".");return t>=0&&(e=e.slice(0,t)),!e||"start"===e})?eZ:eG,function(){var e=l(this,n),t=e.on;t!==i&&(a=(i=t).copy()).on(r,o),e.on=a}))},attr:function(e,t){var n=F(e),r="transform"===n?e6:tB;return this.attrTween(e,"function"==typeof t?(n.local?function(e,t,n){var r,o,i;return function(){var a,l,s=n(this);return null==s?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local))===(l=s+"")?null:a===r&&l===o?i:(o=l,i=t(r=a,s))}}:function(e,t,n){var r,o,i;return function(){var a,l,s=n(this);return null==s?void this.removeAttribute(e):(a=this.getAttribute(e))===(l=s+"")?null:a===r&&l===o?i:(o=l,i=t(r=a,s))}})(n,r,e8(this,"attr."+e,t)):null==t?(n.local?function(e){return function(){this.removeAttributeNS(e.space,e.local)}}:function(e){return function(){this.removeAttribute(e)}})(n):(n.local?function(e,t,n){var r,o,i=n+"";return function(){var a=this.getAttributeNS(e.space,e.local);return a===i?null:a===r?o:o=t(r=a,n)}}:function(e,t,n){var r,o,i=n+"";return function(){var a=this.getAttribute(e);return a===i?null:a===r?o:o=t(r=a,n)}})(n,r,t))},attrTween:function(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw Error();var r=F(e);return this.tween(n,(r.local?function(e,t){var n,r;function o(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&function(t){this.setAttributeNS(e.space,e.local,o.call(this,t))}),n}return o._value=t,o}:function(e,t){var n,r;function o(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&function(t){this.setAttribute(e,o.call(this,t))}),n}return o._value=t,o})(r,t))},style:function(e,t,n){var r,o,i,a,l,s,u,d,c,h,f,p,g,m,x,y,v,b,w,E,k,_="transform"==(e+="")?e4:tB;return null==t?this.styleTween(e,(r=e,function(){var e=X(this,r),t=(this.style.removeProperty(r),X(this,r));return e===t?null:e===o&&t===i?a:a=_(o=e,i=t)})).on("end.style."+e,tH(e)):"function"==typeof t?this.styleTween(e,(l=e,s=e8(this,"style."+e,t),function(){var e=X(this,l),t=s(this),n=t+"";return null==t&&(this.style.removeProperty(l),n=t=X(this,l)),e===n?null:e===u&&n===d?c:(d=n,c=_(u=e,t))})).each((h=this._id,v="end."+(y="style."+(f=e)),function(){var e=eG(this,h),t=e.on,n=null==e.value[y]?x||(x=tH(f)):void 0;(t!==p||m!==n)&&(g=(p=t).copy()).on(v,m=n),e.on=g})):this.styleTween(e,(b=e,k=t+"",function(){var e=X(this,b);return e===k?null:e===w?E:E=_(w=e,t)}),n).on("end.style."+e,null)},styleTween:function(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==t)return this.tween(r,null);if("function"!=typeof t)throw Error();return this.tween(r,function(e,t,n){var r,o;function i(){var i=t.apply(this,arguments);return i!==o&&(r=(o=i)&&function(t){this.style.setProperty(e,i.call(this,t),n)}),r}return i._value=t,i}(e,t,null==n?"":n))},text:function(e){var t,n;return this.tween("text","function"==typeof e?(t=e8(this,"text",e),function(){var e=t(this);this.textContent=null==e?"":e}):(n=null==e?"":e+"",function(){this.textContent=n}))},textTween:function(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw Error();return this.tween(t,function(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&function(e){this.textContent=r.call(this,e)}),t}return r._value=e,r}(e))},remove:function(){var e;return this.on("end.remove",(e=this._id,function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}))},tween:function(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r,o=eQ(this.node(),n).tween,i=0,a=o.length;i<a;++i)if((r=o[i]).name===e)return r.value;return null}return this.each((null==t?function(e,t){var n,r;return function(){var o=eG(this,e),i=o.tween;if(i!==n){r=n=i;for(var a=0,l=r.length;a<l;++a)if(r[a].name===t){(r=r.slice()).splice(a,1);break}}o.tween=r}}:function(e,t,n){var r,o;if("function"!=typeof n)throw Error();return function(){var i=eG(this,e),a=i.tween;if(a!==r){o=(r=a).slice();for(var l={name:t,value:n},s=0,u=o.length;s<u;++s)if(o[s].name===t){o[s]=l;break}s===u&&o.push(l)}i.tween=o}})(n,e,t))},delay:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?function(e,t){return function(){eZ(this,e).delay=+t.apply(this,arguments)}}:function(e,t){return t*=1,function(){eZ(this,e).delay=t}})(t,e)):eQ(this.node(),t).delay},duration:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?function(e,t){return function(){eG(this,e).duration=+t.apply(this,arguments)}}:function(e,t){return t*=1,function(){eG(this,e).duration=t}})(t,e)):eQ(this.node(),t).duration},ease:function(e){var t=this._id;return arguments.length?this.each(function(e,t){if("function"!=typeof t)throw Error();return function(){eG(this,e).ease=t}}(t,e)):eQ(this.node(),t).ease},easeVarying:function(e){var t;if("function"!=typeof e)throw Error();return this.each((t=this._id,function(){var n=e.apply(this,arguments);if("function"!=typeof n)throw Error();eG(this,t).ease=n}))},end:function(){var e,t,n=this,r=n._id,o=n.size();return new Promise(function(i,a){var l={value:a},s={value:function(){0==--o&&i()}};n.each(function(){var n=eG(this,r),o=n.on;o!==e&&((t=(e=o).copy())._.cancel.push(l),t._.interrupt.push(l),t._.end.push(s)),n.on=t}),0===o&&i()})},[Symbol.iterator]:tq[Symbol.iterator]};var tX={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};ec.prototype.interrupt=function(e){return this.each(function(){eJ(this,e)})},ec.prototype.transition=function(e){var t,n;e instanceof tF?(t=e._id,e=e._name):(t=++tV,(n=tX).time=eB(),e=null==e?null:e+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var a,l=r[i],s=l.length,u=0;u<s;++u)(a=l[u])&&eU(a,e,t,u,l,n||function(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}(a,t));return new tF(r,this._parents,e,t)};let tW=e=>()=>e;function tY(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 tK(e,t,n){this.k=e,this.x=t,this.y=n}tK.prototype={constructor:tK,scale:function(e){return 1===e?this:new tK(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new tK(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 tU=new tK(1,0,0);function tZ(e){for(;!e.__zoom;)if(!(e=e.parentNode))return tU;return e.__zoom}function tG(e){e.stopImmediatePropagation()}function tQ(e){e.preventDefault(),e.stopImmediatePropagation()}function tJ(e){return(!e.ctrlKey||"wheel"===e.type)&&!e.button}function t0(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).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 t1(){return this.__zoom||tU}function t2(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function t3(){return navigator.maxTouchPoints||"ontouchstart"in this}function t5(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],a=e.invertY(t[1][1])-n[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}function t4(){var e,t,n,r=tJ,o=t0,i=t5,a=t2,l=t3,s=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],d=250,c=eN,h=E("start","zoom","end"),f=0,p=10;function g(e){e.property("__zoom",t1).on("wheel.zoom",k,{passive:!1}).on("mousedown.zoom",_).on("dblclick.zoom",j).filter(l).on("touchstart.zoom",S).on("touchmove.zoom",M).on("touchend.zoom touchcancel.zoom",N).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(e,t){return(t=Math.max(s[0],Math.min(s[1],t)))===e.k?e:new tK(t,e.x,e.y)}function x(e,t,n){var r=t[0]-n[0]*e.k,o=t[1]-n[1]*e.k;return r===e.x&&o===e.y?e:new tK(e.k,r,o)}function y(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function v(e,t,n,r){e.on("start.zoom",function(){b(this,arguments).event(r).start()}).on("interrupt.zoom end.zoom",function(){b(this,arguments).event(r).end()}).tween("zoom",function(){var e=arguments,i=b(this,e).event(r),a=o.apply(this,e),l=null==n?y(a):"function"==typeof n?n.apply(this,e):n,s=Math.max(a[1][0]-a[0][0],a[1][1]-a[0][1]),u=this.__zoom,d="function"==typeof t?t.apply(this,e):t,h=c(u.invert(l).concat(s/u.k),d.invert(l).concat(s/d.k));return function(e){if(1===e)e=d;else{var t=h(e),n=s/t[2];e=new tK(n,l[0]-t[0]*n,l[1]-t[1]*n)}i.zoom(null,e)}})}function b(e,t,n){return!n&&e.__zooming||new w(e,t)}function w(e,t){this.that=e,this.args=t,this.active=0,this.sourceEvent=null,this.extent=o.apply(e,t),this.taps=0}function k(e,...t){if(r.apply(this,arguments)){var n=b(this,t).event(e),o=this.__zoom,l=Math.max(s[0],Math.min(s[1],o.k*Math.pow(2,a.apply(this,arguments)))),d=ef(e);if(n.wheel)(n.mouse[0][0]!==d[0]||n.mouse[0][1]!==d[1])&&(n.mouse[1]=o.invert(n.mouse[0]=d)),clearTimeout(n.wheel);else{if(o.k===l)return;n.mouse=[d,o.invert(d)],eJ(this),n.start()}tQ(e),n.wheel=setTimeout(function(){n.wheel=null,n.end()},150),n.zoom("mouse",i(x(m(o,l),n.mouse[0],n.mouse[1]),n.extent,u))}}function _(e,...t){if(!n&&r.apply(this,arguments)){var o=e.currentTarget,a=b(this,t,!0).event(e),l=eh(e.view).on("mousemove.zoom",function(e){if(tQ(e),!a.moved){var t=e.clientX-d,n=e.clientY-c;a.moved=t*t+n*n>f}a.event(e).zoom("mouse",i(x(a.that.__zoom,a.mouse[0]=ef(e,o),a.mouse[1]),a.extent,u))},!0).on("mouseup.zoom",function(e){l.on("mousemove.zoom mouseup.zoom",null),ev(e.view,a.moved),tQ(e),a.event(e).end()},!0),s=ef(e,o),d=e.clientX,c=e.clientY;ey(e.view),tG(e),a.mouse=[s,this.__zoom.invert(s)],eJ(this),a.start()}}function j(e,...t){if(r.apply(this,arguments)){var n=this.__zoom,a=ef(e.changedTouches?e.changedTouches[0]:e,this),l=n.invert(a),s=n.k*(e.shiftKey?.5:2),c=i(x(m(n,s),a,l),o.apply(this,t),u);tQ(e),d>0?eh(this).transition().duration(d).call(v,c,a,e):eh(this).call(g.transform,c,a,e)}}function S(n,...o){if(r.apply(this,arguments)){var i,a,l,s,u=n.touches,d=u.length,c=b(this,o,n.changedTouches.length===d).event(n);for(tG(n),a=0;a<d;++a)s=[s=ef(l=u[a],this),this.__zoom.invert(s),l.identifier],c.touch0?c.touch1||c.touch0[2]===s[2]||(c.touch1=s,c.taps=0):(c.touch0=s,i=!0,c.taps=1+!!e);e&&(e=clearTimeout(e)),i&&(c.taps<2&&(t=s[0],e=setTimeout(function(){e=null},500)),eJ(this),c.start())}}function M(e,...t){if(this.__zooming){var n,r,o,a,l=b(this,t).event(e),s=e.changedTouches,d=s.length;for(tQ(e),n=0;n<d;++n)o=ef(r=s[n],this),l.touch0&&l.touch0[2]===r.identifier?l.touch0[0]=o:l.touch1&&l.touch1[2]===r.identifier&&(l.touch1[0]=o);if(r=l.that.__zoom,l.touch1){var c=l.touch0[0],h=l.touch0[1],f=l.touch1[0],p=l.touch1[1],g=(g=f[0]-c[0])*g+(g=f[1]-c[1])*g,y=(y=p[0]-h[0])*y+(y=p[1]-h[1])*y;r=m(r,Math.sqrt(g/y)),o=[(c[0]+f[0])/2,(c[1]+f[1])/2],a=[(h[0]+p[0])/2,(h[1]+p[1])/2]}else{if(!l.touch0)return;o=l.touch0[0],a=l.touch0[1]}l.zoom("touch",i(x(r,o,a),l.extent,u))}}function N(e,...r){if(this.__zooming){var o,i,a=b(this,r).event(e),l=e.changedTouches,s=l.length;for(tG(e),n&&clearTimeout(n),n=setTimeout(function(){n=null},500),o=0;o<s;++o)i=l[o],a.touch0&&a.touch0[2]===i.identifier?delete a.touch0:a.touch1&&a.touch1[2]===i.identifier&&delete a.touch1;if(a.touch1&&!a.touch0&&(a.touch0=a.touch1,delete a.touch1),a.touch0)a.touch0[1]=this.__zoom.invert(a.touch0[0]);else if(a.end(),2===a.taps&&(i=ef(i,this),Math.hypot(t[0]-i[0],t[1]-i[1])<p)){var u=eh(this).on("dblclick.zoom");u&&u.apply(this,arguments)}}}return g.transform=function(e,t,n,r){var o=e.selection?e.selection():e;o.property("__zoom",t1),e!==o?v(e,t,n,r):o.interrupt().each(function(){b(this,arguments).event(r).start().zoom(null,"function"==typeof t?t.apply(this,arguments):t).end()})},g.scaleBy=function(e,t,n,r){g.scaleTo(e,function(){var e=this.__zoom.k,n="function"==typeof t?t.apply(this,arguments):t;return e*n},n,r)},g.scaleTo=function(e,t,n,r){g.transform(e,function(){var e=o.apply(this,arguments),r=this.__zoom,a=null==n?y(e):"function"==typeof n?n.apply(this,arguments):n,l=r.invert(a),s="function"==typeof t?t.apply(this,arguments):t;return i(x(m(r,s),a,l),e,u)},n,r)},g.translateBy=function(e,t,n,r){g.transform(e,function(){return i(this.__zoom.translate("function"==typeof t?t.apply(this,arguments):t,"function"==typeof n?n.apply(this,arguments):n),o.apply(this,arguments),u)},null,r)},g.translateTo=function(e,t,n,r,a){g.transform(e,function(){var e=o.apply(this,arguments),a=this.__zoom,l=null==r?y(e):"function"==typeof r?r.apply(this,arguments):r;return i(tU.translate(l[0],l[1]).scale(a.k).translate("function"==typeof t?-t.apply(this,arguments):-t,"function"==typeof n?-n.apply(this,arguments):-n),e,u)},r,a)},w.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return 1==++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(e,t){return this.mouse&&"mouse"!==e&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&"touch"!==e&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&"touch"!==e&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(e){var t=eh(this.that).datum();h.call(e,this.that,new tY(e,{sourceEvent:this.sourceEvent,target:g,type:e,transform:this.that.__zoom,dispatch:h}),t)}},g.wheelDelta=function(e){return arguments.length?(a="function"==typeof e?e:tW(+e),g):a},g.filter=function(e){return arguments.length?(r="function"==typeof e?e:tW(!!e),g):r},g.touchable=function(e){return arguments.length?(l="function"==typeof e?e:tW(!!e),g):l},g.extent=function(e){return arguments.length?(o="function"==typeof e?e:tW([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),g):o},g.scaleExtent=function(e){return arguments.length?(s[0]=+e[0],s[1]=+e[1],g):[s[0],s[1]]},g.translateExtent=function(e){return arguments.length?(u[0][0]=+e[0][0],u[1][0]=+e[1][0],u[0][1]=+e[0][1],u[1][1]=+e[1][1],g):[[u[0][0],u[0][1]],[u[1][0],u[1][1]]]},g.constrain=function(e){return arguments.length?(i=e,g):i},g.duration=function(e){return arguments.length?(d=+e,g):d},g.interpolate=function(e){return arguments.length?(c=e,g):c},g.on=function(){var e=h.on.apply(h,arguments);return e===h?g:e},g.clickDistance=function(e){return arguments.length?(f=(e*=1)*e,g):Math.sqrt(f)},g.tapDistance=function(e){return arguments.length?(p=+e,g):p},g}function t6(e,t){var n,r,o=typeof t;return null==t||"boolean"===o?tP(t):("number"===o?e0:"string"===o?(r=tg(t))?(t=r,tR):tD:t instanceof tg?tR:t instanceof Date?function(e,t){var n=new Date;return e*=1,t*=1,function(r){return n.setTime(e*(1-r)+t*r),n}}:!ArrayBuffer.isView(n=t)||n instanceof DataView?Array.isArray(t)?function(e,t){var n,r=t?t.length:0,o=e?Math.min(r,e.length):0,i=Array(o),a=Array(r);for(n=0;n<o;++n)i[n]=t6(e[n],t[n]);for(;n<r;++n)a[n]=t[n];return function(e){for(n=0;n<o;++n)a[n]=i[n](e);return a}}:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?function(e,t){var n,r={},o={};for(n in(null===e||"object"!=typeof e)&&(e={}),(null===t||"object"!=typeof t)&&(t={}),t)n in e?r[n]=t6(e[n],t[n]):o[n]=t[n];return function(e){for(n in r)o[n]=r[n](e);return o}}:e0:function(e,t){t||(t=[]);var n,r=e?Math.min(t.length,e.length):0,o=t.slice();return function(i){for(n=0;n<r;++n)o[n]=e[n]*(1-i)+t[n]*i;return o}})(e,t)}tZ.prototype=tK.prototype;let t8=[[-1/0,-1/0],[1/0,1/0]],t7=["Enter"," ","Escape"],t9={"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"};(t=d||(d={})).Strict="strict",t.Loose="loose",(n=c||(c={})).Free="free",n.Vertical="vertical",n.Horizontal="horizontal",(r=h||(h={})).Partial="partial",r.Full="full";let ne={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};(o=f||(f={})).Bezier="default",o.Straight="straight",o.Step="step",o.SmoothStep="smoothstep",o.SimpleBezier="simplebezier",(i=p||(p={})).Arrow="arrow",i.ArrowClosed="arrowclosed",(a=g||(g={})).Left="left",a.Top="top",a.Right="right",a.Bottom="bottom";let nt={[g.Left]:g.Right,[g.Right]:g.Left,[g.Top]:g.Bottom,[g.Bottom]:g.Top};function nn(e){return null===e?null:e?"valid":"invalid"}let nr=e=>!!e&&"object"==typeof e&&"id"in e&&"source"in e&&"target"in e,no=e=>!!e&&"object"==typeof e&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),ni=(e,t=[0,0])=>{let{width:n,height:r}=nR(e),o=e.origin??t,i=n*o[0],a=r*o[1];return{x:e.position.x-i,y:e.position.y-a}},na=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(void 0===t.filter||t.filter(e))&&(n=nm(n,nb(e)),r=!0)}),r?ny(n):{x:0,y:0,width:0,height:0}},nl=(e,t,[n,r,o]=[0,0,1],i=!1,a=!1)=>{let l=(t.x-n)/o,s=(t.y-r)/o,u=t.width/o,d=t.height/o,c=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(a&&!n||r)continue;let o=e.width??t.width??t.initialWidth??0,h=e.height??t.height??t.initialHeight??0,{x:f,y:p}=t.internals.positionAbsolute,g=nE(l,s,u,d,f,p,o,h),m=o*h,x=i&&g>0;(!t.internals.handleBounds||x||g>=m||t.dragging)&&c.push(t)}return c};async function ns({nodes:e,width:t,height:n,panZoom:r,minZoom:o,maxZoom:i},a){let l,s;if(0===e.size)return!0;let u=nO(na((l=new Map,s=a?.nodes?new Set(a.nodes.map(e=>e.id)):null,e.forEach(e=>{let t;if(a?.includeHiddenNodes){let{width:n,height:r}=nR(e);t=n>0&&r>0}else t=!!(e.measured.width&&e.measured.height&&!e.hidden);t&&(!s||s.has(e.id))&&l.set(e.id,e)}),l)),t,n,a?.minZoom??o,a?.maxZoom??i,a?.padding??.1);return await r.setViewport(u,{duration:a?.duration,ease:a?.ease,interpolate:a?.interpolate}),!0}function nu({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:o,onError:i}){let a=n.get(e),l=a.parentId?n.get(a.parentId):void 0,{x:s,y:u}=l?l.internals.positionAbsolute:{x:0,y:0},d=a.origin??r,c=a.extent||o;if("parent"!==a.extent||a.expandParent)l&&nA(a.extent)&&(c=[[a.extent[0][0]+s,a.extent[0][1]+u],[a.extent[1][0]+s,a.extent[1][1]+u]]);else if(l){let e=l.measured.width,t=l.measured.height;e&&t&&(c=[[s,u],[s+e,u+t]])}else i?.("005","Only child nodes can use a parent extent.");let h=nA(c)?nh(t,c,a.measured):t;return(void 0===a.measured.width||void 0===a.measured.height)&&i?.("015","It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."),{position:{x:h.x-s+(a.measured.width??0)*d[0],y:h.y-u+(a.measured.height??0)*d[1]},positionAbsolute:h}}async function nd({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:o}){let i,a=new Set(e.map(e=>e.id)),l=[];for(let e of n){if(!1===e.deletable)continue;let t=a.has(e.id),n=!t&&e.parentId&&l.find(t=>t.id===e.parentId);(t||n)&&l.push(e)}let s=new Set(t.map(e=>e.id)),u=r.filter(e=>!1!==e.deletable),d=(i=new Set,l.forEach(e=>{i.add(e.id)}),u.filter(e=>i.has(e.source)||i.has(e.target)));for(let e of u)s.has(e.id)&&!d.find(t=>t.id===e.id)&&d.push(e);if(!o)return{edges:d,nodes:l};let c=await o({nodes:l,edges:d});return"boolean"==typeof c?c?{edges:d,nodes:l}:{edges:[],nodes:[]}:c}let nc=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),nh=(e={x:0,y:0},t,n)=>({x:nc(e.x,t[0][0],t[1][0]-(n?.width??0)),y:nc(e.y,t[0][1],t[1][1]-(n?.height??0))});function nf(e,t,n){let{width:r,height:o}=nR(n),{x:i,y:a}=n.internals.positionAbsolute;return nh(e,[[i,a],[i+r,a+o]],t)}let np=(e,t,n)=>e<t?nc(Math.abs(e-t),1,t)/t:e>n?-nc(Math.abs(e-n),1,t)/t:0,ng=(e,t,n=15,r=40)=>[np(e.x,r,t.width-r)*n,np(e.y,r,t.height-r)*n],nm=(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)}),nx=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),ny=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),nv=(e,t=[0,0])=>{let{x:n,y:r}=no(e)?e.internals.positionAbsolute:ni(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},nb=(e,t=[0,0])=>{let{x:n,y:r}=no(e)?e.internals.positionAbsolute:ni(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},nw=(e,t)=>ny(nm(nx(e),nx(t))),nE=(e,t,n,r,o,i,a,l)=>Math.ceil(Math.max(0,Math.min(e+n,o+a)-Math.max(e,o))*Math.max(0,Math.min(t+r,i+l)-Math.max(t,i))),nk=(e,t)=>nE(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),n_=e=>nj(e.width)&&nj(e.height)&&nj(e.x)&&nj(e.y),nj=e=>!isNaN(e)&&isFinite(e),nS=(e,t)=>(e,t)=>{},nM=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),nN=({x:e,y:t},[n,r,o],i=!1,a=[1,1])=>{let l={x:(e-n)/o,y:(t-r)/o};return i?nM(l,a):l},nC=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r});function n$(e,t){if("number"==typeof e)return Math.floor((t-t/(1+e))*.5);if("string"==typeof e&&e.endsWith("px")){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if("string"==typeof e&&e.endsWith("%")){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}let nO=(e,t,n,r,o,i)=>{let a=function(e,t,n){if("string"==typeof e||"number"==typeof e){let r=n$(e,n),o=n$(e,t);return{top:r,right:o,bottom:r,left:o,x:2*o,y:2*r}}if("object"==typeof e){let r=n$(e.top??e.y??0,n),o=n$(e.bottom??e.y??0,n),i=n$(e.left??e.x??0,t),a=n$(e.right??e.x??0,t);return{top:r,right:a,bottom:o,left:i,x:i+a,y:r+o}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}(i,t,n),l=nc(Math.min((t-a.x)/e.width,(n-a.y)/e.height),r,o),s=e.x+e.width/2,u=e.y+e.height/2,d=t/2-s*l,c=n/2-u*l,h=function(e,t,n,r,o,i){let{x:a,y:l}=nC(e,[t,n,r]),{x:s,y:u}=nC({x:e.x+e.width,y:e.y+e.height},[t,n,r]);return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(o-s),bottom:Math.floor(i-u)}}(e,d,c,l,t,n),f={left:Math.min(h.left-a.left,0),top:Math.min(h.top-a.top,0),right:Math.min(h.right-a.right,0),bottom:Math.min(h.bottom-a.bottom,0)};return{x:d-f.left+f.right,y:c-f.top+f.bottom,zoom:l}},nP=()=>"u">typeof navigator&&navigator?.userAgent?.indexOf("Mac")>=0;function nA(e){return null!=e&&"parent"!==e}function nR(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function nz(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function nL(e,t={width:0,height:0},n,r,o){let i={...e},a=r.get(n);if(a){let e=a.origin||o;i.x+=a.internals.positionAbsolute.x-(t.width??0)*e[0],i.y+=a.internals.positionAbsolute.y-(t.height??0)*e[1]}return i}function nI(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function nD(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){let{x:i,y:a}=nF(e),l=nN({x:i-(o?.left??0),y:a-(o?.top??0)},r),{x:s,y:u}=n?nM(l,t):l;return{xSnapped:s,ySnapped:u,...l}}let nB=e=>({width:e.offsetWidth,height:e.offsetHeight}),nT=e=>e?.getRootNode?.()||window?.document,nH=["INPUT","SELECT","TEXTAREA"];function nV(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1&&(nH.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey"))}let nF=(e,t)=>{let n="clientX"in e,r=n?e.clientX:e.touches?.[0].clientX,o=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:o-(t?.top??0)}},nq=(e,t,n,r,o)=>{let i=t.querySelectorAll(`.${e}`);return i&&i.length?Array.from(i).map(t=>{let i=t.getBoundingClientRect();return{id:t.getAttribute("data-handleid"),type:e,nodeId:o,position:t.getAttribute("data-handlepos"),x:(i.left-n.left)/r,y:(i.top-n.top)/r,...nB(t)}}):null};function nX({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:o,sourceControlY:i,targetControlX:a,targetControlY:l}){let s=.125*e+.375*o+.375*a+.125*n,u=.125*t+.375*i+.375*l+.125*r,d=Math.abs(s-e),c=Math.abs(u-t);return[s,u,d,c]}function nW(e,t){return e>=0?.5*e:25*t*Math.sqrt(-e)}function nY({pos:e,x1:t,y1:n,x2:r,y2:o,c:i}){switch(e){case g.Left:return[t-nW(t-r,i),n];case g.Right:return[t+nW(r-t,i),n];case g.Top:return[t,n-nW(n-o,i)];case g.Bottom:return[t,n+nW(o-n,i)]}}function nK({sourceX:e,sourceY:t,sourcePosition:n=g.Bottom,targetX:r,targetY:o,targetPosition:i=g.Top,curvature:a=.25}){let[l,s]=nY({pos:n,x1:e,y1:t,x2:r,y2:o,c:a}),[u,d]=nY({pos:i,x1:r,y1:o,x2:e,y2:t,c:a}),[c,h,f,p]=nX({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:l,sourceControlY:s,targetControlX:u,targetControlY:d});return[`M${e},${t} C${l},${s} ${u},${d} ${r},${o}`,c,h,f,p]}function nU({sourceX:e,sourceY:t,targetX:n,targetY:r}){let o=Math.abs(n-e)/2,i=Math.abs(r-t)/2;return[n<e?n+o:n-o,r<t?r+i:r-i,o,i]}let nZ=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`;function nG({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[o,i,a,l]=nU({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,i,a,l]}let nQ={[g.Left]:{x:-1,y:0},[g.Right]:{x:1,y:0},[g.Top]:{x:0,y:-1},[g.Bottom]:{x:0,y:1}},nJ=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function n0({sourceX:e,sourceY:t,sourcePosition:n=g.Bottom,targetX:r,targetY:o,targetPosition:i=g.Top,borderRadius:a=5,centerX:l,centerY:s,offset:u=20,stepPosition:d=.5}){let[c,h,f,p,m]=function({source:e,sourcePosition:t=g.Bottom,target:n,targetPosition:r=g.Top,center:o,offset:i,stepPosition:a}){let l,s,u=nQ[t],d=nQ[r],c={x:e.x+u.x*i,y:e.y+u.y*i},h={x:n.x+d.x*i,y:n.y+d.y*i},f=(({source:e,sourcePosition:t=g.Bottom,target:n})=>t===g.Left||t===g.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})({source:c,sourcePosition:t,target:h}),p=0!==f.x?"x":"y",m=f[p],x=[],y={x:0,y:0},v={x:0,y:0},[,,b,w]=nU({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(u[p]*d[p]==-1){"x"===p?(l=o.x??c.x+(h.x-c.x)*a,s=o.y??(c.y+h.y)/2):(l=o.x??(c.x+h.x)/2,s=o.y??c.y+(h.y-c.y)*a);let e=[{x:l,y:c.y},{x:l,y:h.y}],t=[{x:c.x,y:s},{x:h.x,y:s}];x=u[p]===m?"x"===p?e:t:"x"===p?t:e}else{let o=[{x:c.x,y:h.y}],a=[{x:h.x,y:c.y}];if(x="x"===p?u.x===m?a:o:u.y===m?o:a,t===r){let t=Math.abs(e[p]-n[p]);if(t<=i){let r=Math.min(i-1,i-t);u[p]===m?y[p]=(c[p]>e[p]?-1:1)*r:v[p]=(h[p]>n[p]?-1:1)*r}}if(t!==r){let e="x"===p?"y":"x",t=u[p]===d[e],n=c[e]>h[e],r=c[e]<h[e];(1===u[p]&&(!t&&n||t&&r)||1!==u[p]&&(!t&&r||t&&n))&&(x="x"===p?o:a)}let f={x:c.x+y.x,y:c.y+y.y},g={x:h.x+v.x,y:h.y+v.y};Math.max(Math.abs(f.x-x[0].x),Math.abs(g.x-x[0].x))>=Math.max(Math.abs(f.y-x[0].y),Math.abs(g.y-x[0].y))?(l=(f.x+g.x)/2,s=x[0].y):(l=x[0].x,s=(f.y+g.y)/2)}let E={x:c.x+y.x,y:c.y+y.y},k={x:h.x+v.x,y:h.y+v.y};return[[e,...E.x!==x[0].x||E.y!==x[0].y?[E]:[],...x,...k.x!==x[x.length-1].x||k.y!==x[x.length-1].y?[k]:[],n],l,s,b,w]}({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:o},targetPosition:i,center:{x:l,y:s},offset:u,stepPosition:d}),x=`M${c[0].x} ${c[0].y}`;for(let e=1;e<c.length-1;e++)x+=function(e,t,n,r){let o=Math.min(nJ(e,t)/2,nJ(t,n)/2,r),{x:i,y:a}=t;if(e.x===i&&i===n.x||e.y===a&&a===n.y)return`L${i} ${a}`;if(e.y===a){let t=e.x<n.x?-1:1,r=e.y<n.y?1:-1;return`L ${i+o*t},${a}Q ${i},${a} ${i},${a+o*r}`}let l=e.x<n.x?1:-1,s=e.y<n.y?-1:1;return`L ${i},${a+o*s}Q ${i},${a} ${i+o*l},${a}`}(c[e-1],c[e],c[e+1],a);return[x+=`L${c[c.length-1].x} ${c[c.length-1].y}`,h,f,p,m]}function n1(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function n2(e){if(!e)return null;let t=[],n=[];for(let r of e)r.width=r.width??1,r.height=r.height??1,"source"===r.type?t.push(r):"target"===r.type&&n.push(r);return{source:t,target:n}}function n3(e,t,n=g.Left,r=!1){let o=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:a,height:l}=t??nR(e);if(r)return{x:o+a/2,y:i+l/2};switch(t?.position??n){case g.Top:return{x:o+a/2,y:i};case g.Right:return{x:o+a,y:i+l/2};case g.Bottom:return{x:o+a/2,y:i+l};case g.Left:return{x:o,y:i+l/2}}}function n5(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function n4(e,t){if(!e)return"";if("string"==typeof e)return e;let n=t?`${t}__`:"";return`${n}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join("&")}`}let n6={nodeOrigin:[0,0],nodeExtent:t8,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},n8={...n6,checkEquality:!0};function n7(e,t){let n={...e};for(let e in t)void 0!==t[e]&&(n[e]=t[e]);return n}function n9(e){return"manual"===e}function re(e,t,n,r={}){let o=n7(n8,r),i={i:0},a=new Map(t),l=o?.elevateNodesOnSelect&&!n9(o.zIndexMode)?1e3:0,s=e.length>0,u=!1;for(let d of(t.clear(),n.clear(),e)){let e=a.get(d.id);if(o.checkEquality&&d===e?.internals.userNode)t.set(d.id,e);else{let n=nh(ni(d,o.nodeOrigin),nA(d.extent)?d.extent:o.nodeExtent,nR(d));e={...o.defaults,...d,measured:{width:d.measured?.width,height:d.measured?.height},internals:{positionAbsolute:n,handleBounds:function(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let o={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};"source"===t.type?n.push(o):"target"===t.type&&r.push(o)}return{source:n,target:r}}(d,e),z:rn(d,l,o.zIndexMode),userNode:d}},t.set(d.id,e)}void 0!==e.measured&&void 0!==e.measured.width&&void 0!==e.measured.height||e.hidden||(s=!1),d.parentId&&rt(e,t,n,r,i),u||=d.selected??!1}return{nodesInitialized:s,hasSelectedNodes:u}}function rt(e,t,n,r,o){let{elevateNodesOnSelect:i,nodeOrigin:a,nodeExtent:l,zIndexMode:s}=n7(n6,r),u=e.parentId,d=t.get(u);if(!d)return void console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);!function(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}(e,n),o&&!d.parentId&&void 0===d.internals.rootParentIndex&&"auto"===s&&(d.internals.rootParentIndex=++o.i,d.internals.z=d.internals.z+10*o.i),o&&void 0!==d.internals.rootParentIndex&&(o.i=d.internals.rootParentIndex);let{x:c,y:h,z:f}=function(e,t,n,r,o,i){let{x:a,y:l}=t.internals.positionAbsolute,s=nR(e),u=ni(e,n),d=nA(e.extent)?nh(u,e.extent,s):u,c=nh({x:a+d.x,y:l+d.y},r,s);"parent"===e.extent&&(c=nf(c,s,t));let h=rn(e,o,i),f=t.internals.z??0;return{x:c.x,y:c.y,z:f>=h?f+1:h}}(e,d,a,l,i&&!n9(s)?1e3:0,s),{positionAbsolute:p}=e.internals,g=c!==p.x||h!==p.y;(g||f!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:g?{x:c,y:h}:p,z:f}})}function rn(e,t,n){let r=nj(e.zIndex)?e.zIndex:0;return n9(n)?r:r+(e.selected?t:0)}function rr(e,t,n,r=[0,0]){let o=[],i=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=nw(i.get(n.parentId)?.expandedRect??nv(e),n.rect);i.set(n.parentId,{expandedRect:r,parent:e})}return i.size>0&&i.forEach(({expandedRect:t,parent:i},a)=>{let l=i.internals.positionAbsolute,s=nR(i),u=i.origin??r,d=t.x<l.x?Math.round(Math.abs(l.x-t.x)):0,c=t.y<l.y?Math.round(Math.abs(l.y-t.y)):0,h=Math.max(s.width,Math.round(t.width)),f=Math.max(s.height,Math.round(t.height)),p=(h-s.width)*u[0],g=(f-s.height)*u[1];(d>0||c>0||p||g)&&(o.push({id:a,type:"position",position:{x:i.position.x-d+p,y:i.position.y-c+g}}),n.get(a)?.forEach(t=>{e.some(e=>e.id===t.id)||o.push({id:t.id,type:"position",position:{x:t.position.x+d,y:t.position.y+c}})})),(s.width<t.width||s.height<t.height||d||c)&&o.push({id:a,type:"dimensions",setAttributes:!0,dimensions:{width:h+(d?u[0]*d-p:0),height:f+(c?u[1]*c-g:0)}})}),o}async function ro({delta:e,panZoom:t,transform:n,translateExtent:r,width:o,height:i}){if(!t||!e.x&&!e.y)return!1;let a=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[o,i]],r);return!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2])}function ri(e,t,n,r,o,i){let a=o,l=r.get(a)||new Map;r.set(a,l.set(n,t)),a=`${o}-${e}`;let s=r.get(a)||new Map;if(r.set(a,s.set(n,t)),i){a=`${o}-${e}-${i}`;let l=r.get(a)||new Map;r.set(a,l.set(n,t))}}function ra(e,t,n){for(let r of(e.clear(),t.clear(),n)){let{source:n,target:o,sourceHandle:i=null,targetHandle:a=null}=r,l={edgeId:r.id,source:n,target:o,sourceHandle:i,targetHandle:a},s=`${n}-${i}--${o}-${a}`;ri("source",l,`${o}-${a}--${n}-${i}`,e,n,i),ri("target",l,s,e,o,a),t.set(r.id,r)}}function rl(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)break;r=r?.parentElement}while(r)return!1}function rs({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let o=[];for(let[e,i]of t){let t=n.get(e)?.internals.userNode;t&&o.push({...t,position:i.position,dragging:r})}if(!e)return[o[0],o];let i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:r}:o[0],o]}function ru(e,t,n,r,o,i=!1){let a=r.get(e);if(!a)return null;let l="strict"===o?a.internals.handleBounds?.[t]:[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]],s=(n?l?.find(e=>e.id===n):l?.[0])??null;return s&&i?{...s,...n3(a,s,s.position,!0)}:s}function rd(e,t){return e?e:t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null}let rc=()=>!0;function rh(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:i,doc:a,lib:l,flowId:s,isValidConnection:u=rc,nodeLookup:c}){let h="target"===i,f=t?a.querySelector(`.${l}-flow__handle[data-id="${s}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:g}=nF(e),m=a.elementFromPoint(p,g),x=m?.classList.contains(`${l}-flow__handle`)?m:f,y={handleDomNode:x,isValid:!1,connection:null,toHandle:null};if(x){let e=rd(void 0,x),t=x.getAttribute("data-nodeid"),i=x.getAttribute("data-handleid"),a=x.classList.contains("connectable"),l=x.classList.contains("connectableend");if(!t||!e)return y;let s={source:h?t:r,sourceHandle:h?i:o,target:h?r:t,targetHandle:h?o:i};y.connection=s,y.isValid=a&&l&&(n===d.Strict?h&&"source"===e||!h&&"target"===e:t!==r||i!==o)&&u(s),y.toHandle=ru(t,e,i,c,n,!0)}return y}let rf=function(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:i,isTarget:a,domNode:l,nodeLookup:s,lib:u,autoPanOnConnect:d,flowId:c,panBy:h,cancelConnection:f,onConnectStart:p,onConnect:m,onConnectEnd:x,isValidConnection:y=rc,onReconnectEnd:v,updateConnection:b,getTransform:w,getFromHandle:E,autoPanSpeed:k,dragThreshold:_=1,handleDomNode:j}){let S,M=nT(e.target),N=0,{x:C,y:$}=nF(e),O=rd(i,j),P=l?.getBoundingClientRect(),A=!1;if(!P||!O)return;let R=ru(o,O,r,s,t);if(!R)return;let z=nF(e,P),L=!1,I=null,D=!1,B=null,T={...R,nodeId:o,type:O,position:R.position},H=s.get(o),V={inProgress:!0,isValid:null,from:n3(H,T,g.Left,!0),fromHandle:T,fromPosition:T.position,fromNode:H,to:z,toHandle:null,toPosition:nt[T.position],toNode:null,pointer:z};function F(){A=!0,b(V),p?.(e,{nodeId:o,handleId:r,handleType:O})}function q(e){var i,l;let f;if(!A){let{x:t,y:n}=nF(e),r=t-C,o=n-$;if(!(r*r+o*o>_*_))return;F()}if(!E()||!T)return void X(e);let p=w();S=function(e,t,n,r){let o=[],i=1/0;for(let a of function(e,t,n){let r=[],o={x:e.x-n,y:e.y-n,width:2*n,height:2*n};for(let e of t.values())nk(o,nv(e))>0&&r.push(e);return r}(e,n,t+250))for(let n of[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]]){if(r.nodeId===n.nodeId&&r.type===n.type&&r.id===n.id)continue;let{x:l,y:s}=n3(a,n,n.position,!0),u=Math.sqrt(Math.pow(l-e.x,2)+Math.pow(s-e.y,2));u>t||(u<i?(o=[{...n,x:l,y:s}],i=u):u===i&&o.push({...n,x:l,y:s}))}if(!o.length)return null;if(o.length>1){let e="source"===r.type?"target":"source";return o.find(t=>t.type===e)??o[0]}return o[0]}(nN(z=nF(e,P),p,!1,[1,1]),n,s,T),L||(!function e(){if(!d||!P)return;let[t,n]=ng(z,P,k);h({x:t,y:n}),N=requestAnimationFrame(e)}(),L=!0);let m=rh(e,{handle:S,connectionMode:t,fromNodeId:o,fromHandleId:r,fromType:a?"target":"source",isValidConnection:y,doc:M,lib:u,flowId:c,nodeLookup:s});B=m.handleDomNode,I=m.connection,i=!!S,l=m.isValid,f=null,l?f=!0:i&&!l&&(f=!1),D=f;let x=s.get(o),v=x?n3(x,T,g.Left,!0):V.from,j={...V,from:v,isValid:D,to:m.toHandle&&D?nC({x:m.toHandle.x,y:m.toHandle.y},p):z,toHandle:m.toHandle,toPosition:D&&m.toHandle?m.toHandle.position:nt[T.position],toNode:m.toHandle?s.get(m.toHandle.nodeId):null,pointer:z};b(j),V=j}function X(e){if(!("touches"in e)||!(e.touches.length>0)){if(A){(S||B)&&I&&D&&m?.(I);let{inProgress:t,...n}=V,r={...n,toPosition:V.toHandle?V.toPosition:null};x?.(e,r),i&&v?.(e,r)}f(),cancelAnimationFrame(N),L=!1,D=!1,I=null,B=null,M.removeEventListener("mousemove",q),M.removeEventListener("mouseup",X),M.removeEventListener("touchmove",q),M.removeEventListener("touchend",X)}}0===_&&F(),M.addEventListener("mousemove",q),M.addEventListener("mouseup",X),M.addEventListener("touchmove",q),M.addEventListener("touchend",X)},rp=e=>({x:e.x,y:e.y,zoom:e.k}),rg=({x:e,y:t,zoom:n})=>tU.translate(e,t).scale(n),rm=(e,t)=>e.target.closest(`.${t}`),rx=(e,t)=>2===t&&Array.isArray(e)&&e.includes(2),ry=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,rv=(e,t=0,n=ry,r=()=>{})=>{let o="number"==typeof t&&t>0;return o||r(),o?e.transition().duration(t).ease(n).on("end",r):e},rb=e=>{let t=e.ctrlKey&&nP()?10:1;return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*t};function rw(e){let t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:e.includes("left"),affectsY:e.includes("top")}}function rE(e,t){return Math.max(0,t-e)}function rk(e,t){return Math.max(0,e-t)}function r_(e,t,n){return Math.max(0,t-e,e-n)}(l=m||(m={})).Line="line",l.Handle="handle";let rj={width:0,height:0,x:0,y:0},rS={...rj,pointerX:0,pointerY:0,aspectRatio:1};var rM=e.i(30224);let rN=e=>{let t,n=new Set,r=(e,r)=>{let o="function"==typeof e?e(t):e;if(!Object.is(o,t)){let e=t;t=(null!=r?r:"object"!=typeof o||null===o)?o:Object.assign({},t,o),n.forEach(n=>n(t,e))}},o=()=>t,i={setState:r,getState:o,getInitialState:()=>a,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},a=t=e(r,o,i);return i},{useDebugValue:rC}=v.default,{useSyncExternalStoreWithSelector:r$}=rM.default,rO=e=>e;function rP(e,t=rO,n){let r=r$(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return rC(r),r}let rA=(e,t)=>{let n=e?rN(e):rN,r=(e,r=t)=>rP(n,e,r);return Object.assign(r,n),r};function rR(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var rz=e.i(74080);let rL=(0,v.createContext)(null),rI=rL.Provider,rD=((e="react")=>`Seems like you have not used ${"svelte"===e?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.dev/error#001`)("react");function rB(e,t){let n=(0,v.useContext)(rL);if(null===n)throw Error(rD);return rP(n,e,t)}function rT(){let e=(0,v.useContext)(rL);if(null===e)throw Error(rD);return(0,v.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}let rH={display:"none"},rV={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},rF="react-flow__node-desc",rq="react-flow__edge-desc",rX=e=>e.ariaLiveMessage,rW=e=>e.ariaLabelConfig;function rY({rfId:e}){let t=rB(rX);return(0,y.jsx)("div",{id:`react-flow__aria-live-${e}`,"aria-live":"assertive","aria-atomic":"true",style:rV,children:t})}function rK({rfId:e,disableKeyboardA11y:t}){let n=rB(rW);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{id:`${rF}-${e}`,style:rH,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),(0,y.jsx)("div",{id:`${rq}-${e}`,style:rH,children:n["edge.a11yDescription.default"]}),!t&&(0,y.jsx)(rY,{rfId:e})]})}let rU=(0,v.forwardRef)(({position:e="top-left",children:t,className:n,style:r,...o},i)=>{let a=`${e}`.split("-");return(0,y.jsx)("div",{className:b(["react-flow__panel",n,...a]),style:r,ref:i,...o,children:t})});rU.displayName="Panel";let rZ="https://reactflow.dev?utm_source=attribution";function rG({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:(0,y.jsx)(rU,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${rZ}`,children:(0,y.jsx)("a",{href:rZ,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}let rQ=e=>{let t=[],n=[];for(let[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(let[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},rJ=e=>e.id;function r0(e,t){return rR(e.selectedNodes.map(rJ),t.selectedNodes.map(rJ))&&rR(e.selectedEdges.map(rJ),t.selectedEdges.map(rJ))}function r1({onSelectionChange:e}){let t=rT(),{selectedNodes:n,selectedEdges:r}=rB(rQ,r0);return(0,v.useEffect)(()=>{let o={nodes:n,edges:r};e?.(o),t.getState().onSelectionChangeHandlers.forEach(e=>e(o))},[n,r,e]),null}let r2=e=>!!e.onSelectionChangeHandlers;function r3({onSelectionChange:e}){let t=rB(r2);return e||t?(0,y.jsx)(r1,{onSelectionChange:e}):null}let r5=[0,0],r4={x:0,y:0,zoom:1},r6=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode","rfId"],r8=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),r7={translateExtent:t8,nodeOrigin:r5,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function r9(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:o,setTranslateExtent:i,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:s}=rB(r8,rR),u=rT();(0,v.useEffect)(()=>(s(e.defaultNodes,e.defaultEdges),()=>{d.current=r7,l()}),[]);let d=(0,v.useRef)(r7);return(0,v.useEffect)(()=>{for(let l of r6){let s=e[l];if(s!==d.current[l]&&void 0!==e[l])if("nodes"===l)t(s);else if("edges"===l)n(s);else if("minZoom"===l)r(s);else if("maxZoom"===l)o(s);else if("translateExtent"===l)i(s);else if("nodeExtent"===l)a(s);else if("ariaLabelConfig"===l)u.setState({ariaLabelConfig:{...t9,...s||{}}});else"fitView"===l?u.setState({fitViewQueued:s}):"fitViewOptions"===l?u.setState({fitViewOptions:s}):u.setState({[l]:s})}d.current=e},r6.map(t=>e[t])),null}function oe(){return"u"<typeof window||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}let ot="u">typeof document?document:null;function on(e=null,t={target:ot,actInsideInputWithModifier:!0}){let[n,r]=(0,v.useState)(!1),o=(0,v.useRef)(!1),i=(0,v.useRef)(new Set([])),[a,l]=(0,v.useMemo)(()=>{if(null!==e){let t=(Array.isArray(e)?e:[e]).filter(e=>"string"==typeof e).map(e=>e.replace("+","\n").replace("\n\n","\n+").split("\n")),n=t.reduce((e,t)=>e.concat(...t),[]);return[t,n]}return[[],[]]},[e]);return(0,v.useEffect)(()=>{let n=t?.target??ot,s=t?.actInsideInputWithModifier??!0;if(null!==e){let e=e=>{if(o.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!o.current||o.current&&!s)&&nV(e))return!1;let n=oo(e.code,l);if(i.current.add(e[n]),or(a,i.current,!1)){let n=e.composedPath?.()?.[0]||e.target,i=n?.nodeName==="BUTTON"||n?.nodeName==="A";!1!==t.preventDefault&&(o.current||!i)&&e.preventDefault(),r(!0)}},u=e=>{let t=oo(e.code,l);or(a,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(e[t]),"Meta"===e.key&&i.current.clear(),o.current=!1},d=()=>{i.current.clear(),r(!1)};return n?.addEventListener("keydown",e),n?.addEventListener("keyup",u),window.addEventListener("blur",d),window.addEventListener("contextmenu",d),()=>{n?.removeEventListener("keydown",e),n?.removeEventListener("keyup",u),window.removeEventListener("blur",d),window.removeEventListener("contextmenu",d)}}},[e,r]),n}function or(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function oo(e,t){return t.includes(e)?"code":"key"}function oi(e,t){let n=[],r=new Map,o=[];for(let t of e)if("add"===t.type){o.push(t);continue}else if("remove"===t.type||"replace"===t.type)r.set(t.id,[t]);else{let e=r.get(t.id);e?e.push(t):r.set(t.id,[t])}for(let e of t){let t=r.get(e.id);if(!t){n.push(e);continue}if("remove"===t[0].type)continue;if("replace"===t[0].type){n.push({...t[0].item});continue}let o={...e};for(let e of t){var i=e,a=o;switch(i.type){case"select":a.selected=i.selected;break;case"position":void 0!==i.position&&(a.position=i.position),void 0!==i.dragging&&(a.dragging=i.dragging);break;case"dimensions":void 0!==i.dimensions&&(a.measured={...i.dimensions},i.setAttributes&&((!0===i.setAttributes||"width"===i.setAttributes)&&(a.width=i.dimensions.width),(!0===i.setAttributes||"height"===i.setAttributes)&&(a.height=i.dimensions.height))),"boolean"==typeof i.resizing&&(a.resizing=i.resizing)}}n.push(o)}return o.length&&o.forEach(e=>{void 0!==e.index?n.splice(e.index,0,{...e.item}):n.push({...e.item})}),n}function oa(e,t){return{id:e,type:"select",selected:t}}function ol(e,t=new Set,n=!1){let r=[];for(let[o,i]of e){let e=t.has(o);(void 0!==i.selected||e)&&i.selected!==e&&(n&&(i.selected=e),r.push(oa(i.id,e)))}return r}function os({items:e=[],lookup:t}){let n=[],r=new Map(e.map(e=>[e.id,e]));for(let[r,o]of e.entries()){let e=t.get(o.id),i=e?.internals?.userNode??e;void 0!==i&&i!==o&&n.push({id:o.id,item:o,type:"replace"}),void 0===i&&n.push({item:o,type:"add",index:r})}for(let[e]of t)void 0===r.get(e)&&n.push({id:e,type:"remove"});return n}function ou(e){return{id:e.id,type:"remove"}}let od=nS("React Flow","https://reactflow.dev/"),oc=e=>!!e&&"object"==typeof e&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e);function oh(e){return(0,v.forwardRef)(e)}let of="u">typeof window?v.useLayoutEffect:v.useEffect;function op(e){let[t,n]=(0,v.useState)(BigInt(0)),[r]=(0,v.useState)(()=>{var e;let t;return e=()=>n(e=>e+BigInt(1)),t=[],{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}});return of(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}let og=(0,v.createContext)(null);function om({children:e}){let t=rT(),n=op((0,v.useCallback)(e=>{let{nodes:n=[],setNodes:r,hasDefaultNodes:o,onNodesChange:i,nodeLookup:a,fitViewQueued:l,onNodesChangeMiddlewareMap:s}=t.getState(),u=n;for(let t of e)u="function"==typeof t?t(u):t;let d=os({items:u,lookup:a});for(let e of s.values())d=e(d);o&&r(u),d.length>0?i?.(d):l&&window.requestAnimationFrame(()=>{let{fitViewQueued:e,nodes:n,setNodes:r}=t.getState();e&&r(n)})},[])),r=op((0,v.useCallback)(e=>{let{edges:n=[],setEdges:r,hasDefaultEdges:o,onEdgesChange:i,edgeLookup:a}=t.getState(),l=n;for(let t of e)l="function"==typeof t?t(l):t;o?r(l):i&&i(os({items:l,lookup:a}))},[])),o=(0,v.useMemo)(()=>({nodeQueue:n,edgeQueue:r}),[]);return(0,y.jsx)(og.Provider,{value:o,children:e})}let ox=e=>!!e.panZoom;function oy(){let e,t=(e=rT(),(0,v.useMemo)(()=>({zoomIn:async t=>{let{panZoom:n}=e.getState();return!!n&&n.scaleBy(1.2,t)},zoomOut:async t=>{let{panZoom:n}=e.getState();return!!n&&n.scaleBy(1/1.2,t)},zoomTo:async(t,n)=>{let{panZoom:r}=e.getState();return!!r&&r.scaleTo(t,n)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{let{transform:[r,o,i],panZoom:a}=e.getState();return!!a&&(await a.setViewport({x:t.x??r,y:t.y??o,zoom:t.zoom??i},n),!0)},getViewport:()=>{let[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{let{width:r,height:o,minZoom:i,maxZoom:a,panZoom:l}=e.getState(),s=nO(t,r,o,i,a,n?.padding??.1);return!!l&&(await l.setViewport(s,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0)},screenToFlowPosition:(t,n={})=>{let{transform:r,snapGrid:o,snapToGrid:i,domNode:a}=e.getState();if(!a)return t;let{x:l,y:s}=a.getBoundingClientRect(),u={x:t.x-l,y:t.y-s},d=n.snapGrid??o;return nN(u,r,n.snapToGrid??i,d)},flowToScreenPosition:t=>{let{transform:n,domNode:r}=e.getState();if(!r)return t;let{x:o,y:i}=r.getBoundingClientRect(),a=nC(t,n);return{x:a.x+o,y:a.y+i}}}),[])),n=rT(),r=function(){let e=(0,v.useContext)(og);if(!e)throw Error("useBatchContext must be used within a BatchProvider");return e}(),o=rB(ox),i=(0,v.useMemo)(()=>{let e=e=>n.getState().nodeLookup.get(e),t=e=>{r.nodeQueue.push(e)},o=e=>{r.edgeQueue.push(e)},i=e=>{let{nodeLookup:t,nodeOrigin:r}=n.getState(),o=oc(e)?e:t.get(e.id),i=o.parentId?nL(o.position,o.measured,o.parentId,t,r):o.position;return nv({...o,position:i,width:o.measured?.width??o.width,height:o.measured?.height??o.height})},a=(e,n,r={replace:!1})=>{t(t=>t.map(t=>{if(t.id===e){let e="function"==typeof n?n(t):n;return r.replace&&oc(e)?e:{...t,...e}}return t}))},l=(e,t,n={replace:!1})=>{o(r=>r.map(r=>{if(r.id===e){let e="function"==typeof t?t(r):t;return n.replace&&nr(e)?e:{...r,...e}}return r}))};return{getNodes:()=>n.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{let{edges:e=[]}=n.getState();return e.map(e=>({...e}))},getEdge:e=>n.getState().edgeLookup.get(e),setNodes:t,setEdges:o,addNodes:e=>{let t=Array.isArray(e)?e:[e];r.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{let t=Array.isArray(e)?e:[e];r.edgeQueue.push(e=>[...e,...t])},toObject:()=>{let{nodes:e=[],edges:t=[],transform:r}=n.getState(),[o,i,a]=r;return{nodes:e.map(e=>({...e})),edges:t.map(e=>({...e})),viewport:{x:o,y:i,zoom:a}}},deleteElements:async({nodes:e=[],edges:t=[]})=>{let{nodes:r,edges:o,onNodesDelete:i,onEdgesDelete:a,triggerNodeChanges:l,triggerEdgeChanges:s,onDelete:u,onBeforeDelete:d}=n.getState(),{nodes:c,edges:h}=await nd({nodesToRemove:e,edgesToRemove:t,nodes:r,edges:o,onBeforeDelete:d}),f=h.length>0,p=c.length>0;if(f){let e=h.map(ou);a?.(h),s(e)}if(p){let e=c.map(ou);i?.(c),l(e)}return(p||f)&&u?.({nodes:c,edges:h}),{deletedNodes:c,deletedEdges:h}},getIntersectingNodes:(e,t=!0,r)=>{let o=n_(e),a=o?e:i(e),l=void 0!==r;return a?(r||n.getState().nodes).filter(r=>{let i=n.getState().nodeLookup.get(r.id);if(i&&!o&&(r.id===e.id||!i.internals.positionAbsolute))return!1;let s=nv(l?r:i),u=nk(s,a);return t&&u>0||u>=s.width*s.height||u>=a.width*a.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=n_(e)?e:i(e);if(!r)return!1;let o=nk(r,t);return n&&o>0||o>=t.width*t.height||o>=r.width*r.height},updateNode:a,updateNodeData:(e,t,n={replace:!1})=>{a(e,e=>{let r="function"==typeof t?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},updateEdge:l,updateEdgeData:(e,t,n={replace:!1})=>{l(e,e=>{let r="function"==typeof t?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},getNodesBounds:e=>{let{nodeLookup:t,nodeOrigin:r}=n.getState();return((e,t={nodeOrigin:[0,0]})=>0===e.length?{x:0,y:0,width:0,height:0}:ny(e.reduce((e,n)=>{let r="string"==typeof n,o=t.nodeLookup||r?void 0:n;return t.nodeLookup&&(o=r?t.nodeLookup.get(n):no(n)?n:t.nodeLookup.get(n.id)),nm(e,o?nb(o,t.nodeOrigin):{x:0,y:0,x2:0,y2:0})},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})))(e,{nodeLookup:t,nodeOrigin:r})},getHandleConnections:({type:e,id:t,nodeId:r})=>Array.from(n.getState().connectionLookup.get(`${r}-${e}${t?`-${t}`:""}`)?.values()??[]),getNodeConnections:({type:e,handleId:t,nodeId:r})=>Array.from(n.getState().connectionLookup.get(`${r}${e?t?`-${e}-${t}`:`-${e}`:""}`)?.values()??[]),fitView:async e=>{let t,o,i=n.getState().fitViewResolver??{promise:new Promise((e,n)=>{t=e,o=n}),resolve:t,reject:o};return n.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:i}),r.nodeQueue.push(e=>[...e]),i.promise}}},[]);return(0,v.useMemo)(()=>({...i,...t,viewportInitialized:o}),[o])}let ov=e=>e.selected,ob="u">typeof window?window:void 0,ow={position:"absolute",width:"100%",height:"100%",top:0,left:0},oE=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function ok({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:o=.5,panOnScrollMode:i=c.Free,zoomOnDoubleClick:a=!0,panOnDrag:l=!0,defaultViewport:s,translateExtent:u,minZoom:d,maxZoom:h,zoomActivationKeyCode:f,preventScrolling:p=!0,children:g,noWheelClassName:m,noPanClassName:x,onViewportChange:b,isControlledViewport:w,paneClickDistance:E,selectionOnDrag:k}){let _,j=rT(),S=(0,v.useRef)(null),{userSelectionActive:M,lib:N,connectionInProgress:C}=rB(oE,rR),$=on(f),O=(0,v.useRef)();_=rT(),(0,v.useEffect)(()=>{let e=()=>{if(!S.current||!(S.current.checkVisibility?.()??!0))return!1;let e=nB(S.current);(0===e.height||0===e.width)&&_.getState().onError?.("004","The parent container needs a width and a height to render the graph."),_.setState({width:e.width||500,height:e.height||500})};if(S.current){e(),window.addEventListener("resize",e);let t=new ResizeObserver(()=>e());return t.observe(S.current),()=>{window.removeEventListener("resize",e),t&&S.current&&t.unobserve(S.current)}}},[]);let P=(0,v.useCallback)(e=>{b?.({x:e[0],y:e[1],zoom:e[2]}),w||j.setState({transform:e})},[b,w]);return(0,v.useEffect)(()=>{if(S.current){O.current=function({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:o,onPanZoom:i,onPanZoomStart:a,onPanZoomEnd:l,onDraggingChange:s}){let u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),h=[[0,0],[d.width,d.height]],f="u">typeof ResizeObserver?new ResizeObserver(e=>{let t=e[0];t&&(h=[[0,0],[t.contentRect.width,t.contentRect.height]])}):null;f?.observe(e);let p=t4().extent(()=>h).scaleExtent([t,n]).translateExtent(r),g=eh(e).call(p);b({x:o.x,y:o.y,zoom:nc(o.zoom,t,n)},[[0,0],[d.width,d.height]],r);let m=g.on("wheel.zoom"),x=g.on("dblclick.zoom");async function y(e,t){return!!g&&new Promise(n=>{p?.interpolate(t?.interpolate==="linear"?t6:eN).transform(rv(g,t?.duration,t?.ease,()=>n(!0)),e)})}function v(){p.on("zoom",null)}async function b(e,t,n){let r=rg(e),o=p?.constrain()(r,t,n);return o&&await y(o),o}return p.wheelDelta(rb),{update:function({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:o,panOnDrag:d,panOnScrollMode:h,panOnScrollSpeed:f,preventScrolling:y,zoomOnPinch:b,zoomOnScroll:w,zoomOnDoubleClick:E,zoomActivationKeyPressed:k,lib:_,onTransformChange:j,connectionInProgress:S,paneClickDistance:M,selectionOnDrag:N}){r&&!u.isZoomingOrPanning&&v();let C=o&&!k&&!r;p.clickDistance(N?1/0:!nj(M)||M<0?0:M);let $=C?function({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:i,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:s,onPanZoomEnd:u}){return d=>{if(rm(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();let h=n.property("__zoom").k||1;if(d.ctrlKey&&a){let e=ef(d),t=h*Math.pow(2,rb(d));r.scaleTo(n,t,e,d);return}let f=1===d.deltaMode?20:1,p=o===c.Vertical?0:d.deltaX*f,g=o===c.Horizontal?0:d.deltaY*f;!nP()&&d.shiftKey&&o!==c.Vertical&&(p=d.deltaY*f,g=0),r.translateBy(n,-(p/h)*i,-(g/h)*i,{internal:!0});let m=rp(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?s?.(d,m):(e.isPanScrolling=!0,l?.(d,m)),e.panScrollTimeout=setTimeout(()=>{u?.(d,m),e.isPanScrolling=!1},150)}}({zoomPanValues:u,noWheelClassName:e,d3Selection:g,d3Zoom:p,panOnScrollMode:h,panOnScrollSpeed:f,zoomOnPinch:b,onPanZoomStart:a,onPanZoom:i,onPanZoomEnd:l}):function({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,o){let i="wheel"===r.type,a=!t&&i&&!r.ctrlKey,l=rm(r,e);if(r.ctrlKey&&i&&l&&r.preventDefault(),a||l)return null;r.preventDefault(),n.call(this,r,o)}}({noWheelClassName:e,preventScrolling:y,d3ZoomHandler:m});g.on("wheel.zoom",$,{passive:!1});let O=function({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let o=rp(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=o,r.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(r.sourceEvent,o)}}({zoomPanValues:u,onDraggingChange:s,onPanZoomStart:a});p.on("start",O);let P=function({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return i=>{e.usedRightMouseButton=!!(n&&rx(t,e.mouseButton??0)),i.sourceEvent?.sync||r([i.transform.x,i.transform.y,i.transform.k]),o&&!i.sourceEvent?.internal&&o?.(i.sourceEvent,rp(i.transform))}}({zoomPanValues:u,panOnDrag:d,onPaneContextMenu:!!n,onPanZoom:i,onTransformChange:j});p.on("zoom",P);let A=function({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:o,onPaneContextMenu:i}){return a=>{if(!a.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&rx(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&i(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),o)){let t=rp(a.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o?.(a.sourceEvent,t)},150*!!n)}}}({zoomPanValues:u,panOnDrag:d,panOnScroll:o,onPaneContextMenu:n,onPanZoomEnd:l,onDraggingChange:s});p.on("end",A);let R=function({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:o,zoomOnDoubleClick:i,userSelectionActive:a,noWheelClassName:l,noPanClassName:s,lib:u,connectionInProgress:d}){return c=>{let h=e||t,f=n&&c.ctrlKey,p="wheel"===c.type;if(1===c.button&&"mousedown"===c.type&&(rm(c,`${u}-flow__node`)||rm(c,`${u}-flow__edge`)))return!0;if(!r&&!h&&!o&&!i&&!n||a||d&&!p||rm(c,l)&&p||rm(c,s)&&(!p||o&&p&&!e)||!n&&c.ctrlKey&&p)return!1;if(!n&&"touchstart"===c.type&&c.touches?.length>1)return c.preventDefault(),!1;if(!h&&!o&&!f&&p||!r&&("mousedown"===c.type||"touchstart"===c.type)||Array.isArray(r)&&!r.includes(c.button)&&"mousedown"===c.type)return!1;let g=Array.isArray(r)&&r.includes(c.button)||!c.button||c.button<=1;return(!c.ctrlKey||p)&&g}}({zoomActivationKeyPressed:k,panOnDrag:d,zoomOnScroll:w,panOnScroll:o,zoomOnDoubleClick:E,zoomOnPinch:b,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:_,connectionInProgress:S});p.filter(R),E?g.on("dblclick.zoom",x):g.on("dblclick.zoom",null)},destroy:v,setViewport:async function e(e,t){let n=rg(e);return await y(n,t),n},setViewportConstrained:b,getViewport:function(){let e=g?tZ(g.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}},scaleTo:async function e(e,t){return!!g&&new Promise(n=>{p?.interpolate(t?.interpolate==="linear"?t6:eN).scaleTo(rv(g,t?.duration,t?.ease,()=>n(!0)),e)})},scaleBy:async function e(e,t){return!!g&&new Promise(n=>{p?.interpolate(t?.interpolate==="linear"?t6:eN).scaleBy(rv(g,t?.duration,t?.ease,()=>n(!0)),e)})},setScaleExtent:function(e){p?.scaleExtent(e)},setTranslateExtent:function(e){p?.translateExtent(e)},syncViewport:function(e){if(g){let t=rg(e),n=g.property("__zoom");(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&p?.transform(g,t,null,{sync:!0})}},setClickDistance:function(e){let t=!nj(e)||e<0?0:e;p?.clickDistance(t)}}}({domNode:S.current,minZoom:d,maxZoom:h,translateExtent:u,viewport:s,onDraggingChange:e=>j.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{let{onViewportChangeStart:n,onMoveStart:r}=j.getState();r?.(e,t),n?.(t)},onPanZoom:(e,t)=>{let{onViewportChange:n,onMove:r}=j.getState();r?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{let{onViewportChangeEnd:n,onMoveEnd:r}=j.getState();r?.(e,t),n?.(t)}});let{x:e,y:t,zoom:n}=O.current.getViewport();return j.setState({panZoom:O.current,transform:[e,t,n],domNode:S.current.closest(".react-flow")}),()=>{O.current?.destroy()}}},[]),(0,v.useEffect)(()=>{O.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:o,panOnScrollMode:i,zoomOnDoubleClick:a,panOnDrag:l,zoomActivationKeyPressed:$,preventScrolling:p,noPanClassName:x,userSelectionActive:M,noWheelClassName:m,lib:N,onTransformChange:P,connectionInProgress:C,selectionOnDrag:k,paneClickDistance:E})},[e,t,n,r,o,i,a,l,$,p,x,M,m,N,P,C,k,E]),(0,y.jsx)("div",{className:"react-flow__renderer",ref:S,style:ow,children:g})}let o_=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function oj(){let{userSelectionActive:e,userSelectionRect:t}=rB(o_,rR);return e&&t?(0,y.jsx)("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}let oS=(e,t)=>n=>{n.target===t.current&&e?.(n)},oM=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function oN({isSelecting:e,selectionKeyPressed:t,selectionMode:n=h.Full,panOnDrag:r,autoPanOnSelection:o,paneClickDistance:i,selectionOnDrag:a,onSelectionStart:l,onSelectionEnd:s,onPaneClick:u,onPaneContextMenu:d,onPaneScroll:c,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:g,children:m}){let x=(0,v.useRef)(0),w=rT(),{userSelectionActive:E,elementsSelectable:k,dragging:_,panBy:j,autoPanSpeed:S}=rB(oM,rR),M=k&&(e||E),N=(0,v.useRef)(null),C=(0,v.useRef)(),$=(0,v.useRef)(new Set),O=(0,v.useRef)(new Set),P=(0,v.useRef)(!1),A=(0,v.useRef)(!1),R=(0,v.useRef)({x:0,y:0}),z=(0,v.useRef)(!1),L=e=>{if(A.current||P.current||w.getState().connection.inProgress){A.current=!1,P.current=!1;return}u?.(e),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})};function I(e,t){let{userSelectionRect:r}=w.getState();if(!r)return;let{transform:o,nodeLookup:i,edgeLookup:a,connectionLookup:l,triggerNodeChanges:s,triggerEdgeChanges:u,defaultEdgeOptions:d}=w.getState(),c={x:r.startX,y:r.startY},{x:f,y:p}=nC(c,o),g={startX:c.x,startY:c.y,x:e<f?e:f,y:t<p?t:p,width:Math.abs(e-f),height:Math.abs(t-p)},m=$.current,x=O.current;$.current=new Set(nl(i,g,o,n===h.Partial,!0).map(e=>e.id)),O.current=new Set;let y=d?.selectable??!0;for(let e of $.current){let t=l.get(e);if(t)for(let{edgeId:e}of t.values()){let t=a.get(e);t&&(t.selectable??y)&&O.current.add(e)}}nI(m,$.current)||s(ol(i,$.current,!0)),nI(x,O.current)||u(ol(a,O.current)),w.setState({userSelectionRect:g,userSelectionActive:!0,nodesSelectionActive:!1})}let D=()=>{cancelAnimationFrame(x.current),x.current=0,z.current=!1};(0,v.useEffect)(()=>()=>D(),[]);let B=!0===r||Array.isArray(r)&&r.includes(0);return(0,y.jsxs)("div",{className:b(["react-flow__pane",{draggable:B,dragging:_,selection:e}]),onClick:M?void 0:oS(L,N),onContextMenu:oS(e=>{Array.isArray(r)&&r?.includes(2)?e.preventDefault():d?.(e)},N),onWheel:oS(c?e=>c(e):void 0,N),onPointerEnter:M?void 0:f,onPointerMove:M?e=>{let{userSelectionRect:n,transform:r,resetSelectedElements:a}=w.getState();if(!C.current||!n)return;let{x:s,y:u}=nF(e.nativeEvent,C.current);R.current={x:s,y:u};let d=nC({x:n.startX,y:n.startY},r);if(!A.current){if(Math.hypot(s-d.x,u-d.y)<=(t?0:i))return;a(),l?.(e)}A.current=!0,z.current||(!function e(){if(!o||!C.current)return;let[t,n]=ng(R.current,C.current,S);j({x:t,y:n}).then(t=>{if(!A.current||!t){x.current=requestAnimationFrame(e);return}let{x:n,y:r}=R.current;I(n,r),x.current=requestAnimationFrame(e)})}(),z.current=!0),I(s,u)}:p,onPointerUp:e=>{if(!M){e.target===N.current&&w.getState().connection.inProgress&&(P.current=!0);return}0===e.button&&(e.target?.releasePointerCapture?.(e.pointerId),!E&&e.target===N.current&&w.getState().userSelectionRect&&L?.(e),w.setState({userSelectionActive:!1,userSelectionRect:null}),A.current&&(s?.(e),w.setState({nodesSelectionActive:$.current.size>0})),D())},onPointerCancel:M?e=>{e.target?.releasePointerCapture?.(e.pointerId),D()}:void 0,onPointerDownCapture:M?n=>{let{domNode:r,transform:o}=w.getState();if(C.current=r?.getBoundingClientRect(),!C.current)return;let i=n.target===N.current;if(!i&&n.target.closest(".nokey")||!e||!(a&&i||t)||0!==n.button||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),A.current=!1;let{x:l,y:s}=nF(n.nativeEvent,C.current),u=nN({x:l,y:s},o);w.setState({userSelectionRect:{width:0,height:0,startX:u.x,startY:u.y,x:l,y:s}}),i||(n.stopPropagation(),n.preventDefault())}:void 0,onClickCapture:M?e=>{A.current&&(e.stopPropagation(),A.current=!1)}:void 0,onPointerLeave:g,ref:N,style:ow,children:[m,(0,y.jsx)(oj,{})]})}function oC({id:e,store:t,unselect:n=!1,nodeRef:r}){let o,{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:l,nodeLookup:s,onError:u}=t.getState(),d=s.get(e);d?(t.setState({nodesSelectionActive:!1}),d.selected?(n||d.selected&&l)&&(a({nodes:[d],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])):u?.("012",(o=e,`Node with id "${o}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`))}function o$({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:o,isSelectable:i,nodeClickDistance:a}){let l=rT(),[s,u]=(0,v.useState)(!1),d=(0,v.useRef)();return(0,v.useEffect)(()=>{if(!t)return d.current=function({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:o}){let i={x:null,y:null},a=0,l=new Map,s=!1,u={x:0,y:0},d=null,c=!1,h=null,f=!1,p=!1,g=null;return{update:function({noDragClassName:m,handleSelector:x,domNode:y,isSelectable:v,nodeId:b,nodeClickDistance:w=0}){function E({x:e,y:n}){let{nodeLookup:o,nodeExtent:a,snapGrid:s,snapToGrid:u,nodeOrigin:d,onNodeDrag:c,onSelectionDrag:h,onError:f,updateNodePositions:m}=t();i={x:e,y:n};let x=!1,y=l.size>1,v=y&&a?nx(na(l)):null,w=y&&u?function({dragItems:e,snapGrid:t,x:n,y:r}){let o=e.values().next().value;if(!o)return null;let i={x:n-o.distance.x,y:r-o.distance.y},a=nM(i,t);return{x:a.x-i.x,y:a.y-i.y}}({dragItems:l,snapGrid:s,x:e,y:n}):null;for(let[t,r]of l){if(!o.has(t))continue;let i={x:e-r.distance.x,y:n-r.distance.y};u&&(i=w?{x:Math.round(i.x+w.x),y:Math.round(i.y+w.y)}:nM(i,s));let l=null;if(y&&a&&!r.extent&&v){let{positionAbsolute:e}=r.internals,t=e.x-v.x+a[0][0],n=e.x+r.measured.width-v.x2+a[1][0];l=[[t,e.y-v.y+a[0][1]],[n,e.y+r.measured.height-v.y2+a[1][1]]]}let{position:c,positionAbsolute:h}=nu({nodeId:t,nextPosition:i,nodeLookup:o,nodeExtent:l||a,nodeOrigin:d,onError:f});x=x||r.position.x!==c.x||r.position.y!==c.y,r.position=c,r.internals.positionAbsolute=h}if(p=p||x,x&&(m(l,!0),g&&(r||c||!b&&h))){let[e,t]=rs({nodeId:b,dragItems:l,nodeLookup:o});r?.(g,l,e,t),c?.(g,e,t),b||h?.(g,t)}}async function k(){if(!d)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:o}=t();if(!o){s=!1,cancelAnimationFrame(a);return}let[l,c]=ng(u,d,r);(0!==l||0!==c)&&(i.x=(i.x??0)-l/e[2],i.y=(i.y??0)-c/e[2],await n({x:l,y:c})&&E(i)),a=requestAnimationFrame(k)}function _(r){let{nodeLookup:o,multiSelectionActive:a,nodesDraggable:s,transform:u,snapGrid:h,snapToGrid:f,selectNodesOnDrag:p,onNodeDragStart:g,onSelectionDragStart:m,unselectNodesAndEdges:x}=t();c=!0,p&&v||a||!b||o.get(b)?.selected||x(),v&&p&&b&&e?.(b);let y=nD(r.sourceEvent,{transform:u,snapGrid:h,snapToGrid:f,containerBounds:d});if(i=y,(l=function(e,t,n,r){let o=new Map;for(let[i,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!function e(t,n){if(!t.parentId)return!1;let r=n.get(t.parentId);return!!r&&(!!r.selected||e(r,n))}(a,e))&&(a.draggable||t&&void 0===a.draggable)){let t=e.get(i);t&&o.set(i,{id:i,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return o}(o,s,y,b)).size>0&&(n||g||!b&&m)){let[e,t]=rs({nodeId:b,dragItems:l,nodeLookup:o});n?.(r.sourceEvent,l,e,t),g?.(r.sourceEvent,e,t),b||m?.(r.sourceEvent,t)}}h=eh(y);let j=eS().clickDistance(w).on("start",e=>{let{domNode:n,nodeDragThreshold:r,transform:o,snapGrid:a,snapToGrid:l}=t();d=n?.getBoundingClientRect()||null,f=!1,p=!1,g=e.sourceEvent,0===r&&_(e),i=nD(e.sourceEvent,{transform:o,snapGrid:a,snapToGrid:l,containerBounds:d}),u=nF(e.sourceEvent,d)}).on("drag",e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:o,snapToGrid:a,nodeDragThreshold:h,nodeLookup:p}=t(),m=nD(e.sourceEvent,{transform:r,snapGrid:o,snapToGrid:a,containerBounds:d});if(g=e.sourceEvent,("touchmove"===e.sourceEvent.type&&e.sourceEvent.touches.length>1||b&&!p.has(b))&&(f=!0),!f){if(!s&&n&&c&&(s=!0,k()),!c){let t=nF(e.sourceEvent,d),n=t.x-u.x,r=t.y-u.y;Math.sqrt(n*n+r*r)>h&&_(e)}(i.x!==m.xSnapped||i.y!==m.ySnapped)&&l&&c&&(u=nF(e.sourceEvent,d),E(m))}}).on("end",e=>{if(!c||f){f&&l.size>0&&t().updateNodePositions(l,!1);return}if(s=!1,c=!1,cancelAnimationFrame(a),l.size>0){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:i,onSelectionDragStop:a}=t();if(p&&(r(l,!1),p=!1),o||i||!b&&a){let[t,r]=rs({nodeId:b,dragItems:l,nodeLookup:n,dragging:!1});o?.(e.sourceEvent,l,t,r),i?.(e.sourceEvent,t,r),b||a?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!m||!rl(t,`.${m}`,y))&&(!x||rl(t,x,y))});h.call(j)},destroy:function(){h?.on(".drag",null)}}}({getStoreItems:()=>l.getState(),onNodeMouseDown:t=>{oC({id:t,store:l,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}}),()=>{d.current?.destroy(),d.current=void 0}},[t,l,e]),(0,v.useEffect)(()=>{!t&&e.current&&d.current&&d.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:o,nodeClickDistance:a})},[n,r,t,i,e,o,a]),s}function oO(){let e=rT();return(0,v.useCallback)(t=>{let{nodeExtent:n,snapToGrid:r,snapGrid:o,nodesDraggable:i,onError:a,updateNodePositions:l,nodeLookup:s,nodeOrigin:u}=e.getState(),d=new Map,c=e=>e.selected&&(e.draggable||i&&void 0===e.draggable),h=r?o[0]:5,f=r?o[1]:5,p=t.direction.x*h*t.factor,g=t.direction.y*f*t.factor;for(let[,e]of s){if(!c(e))continue;let t={x:e.internals.positionAbsolute.x+p,y:e.internals.positionAbsolute.y+g};r&&(t=nM(t,o));let{position:i,positionAbsolute:l}=nu({nodeId:e.id,nextPosition:t,nodeLookup:s,nodeExtent:n,nodeOrigin:u,onError:a});e.position=i,e.internals.positionAbsolute=l,d.set(e.id,e)}l(d)},[])}let oP=(0,v.createContext)(null),oA=oP.Provider;oP.Consumer;let oR=()=>(0,v.useContext)(oP),oz=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),oL=(0,v.createContext)(null);function oI({children:e}){let t=rB(oz,rR);return(0,y.jsx)(oL.Provider,{value:t,children:e})}let oD={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},oB=(0,v.memo)(oh(function({type:e="source",position:t=g.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:o=!0,isConnectableEnd:i=!0,id:a,onConnect:l,children:s,className:u,onMouseDown:c,onTouchStart:h,...f},p){let m=a||null,x="target"===e,w=rT(),E=oR(),{connectOnClick:k,noPanClassName:_,rfId:j}=function(){let e=(0,v.useContext)(oL);if(!e)throw Error("useHandleConfig must be used within a HandleConfigProvider");return e}(),{connectingFrom:S,connectingTo:M,clickConnecting:N,isPossibleEndHandle:C,connectionInProcess:$,clickConnectionInProcess:O,valid:P}=rB(t=>{let{connectionClickStartHandle:n,connectionMode:r,connection:o}=t,{fromHandle:i,toHandle:a,isValid:l}=o;if(!i&&!n)return oD;let s=a?.nodeId===E&&a?.id===m&&a?.type===e;return{connectingFrom:i?.nodeId===E&&i?.id===m&&i?.type===e,connectingTo:s,clickConnecting:n?.nodeId===E&&n?.id===m&&n?.type===e,isPossibleEndHandle:r===d.Strict?i?.type!==e:E!==i?.nodeId||m!==i?.id,connectionInProcess:!!i,clickConnectionInProcess:!!n,valid:s&&l}},rR);E||w.getState().onError?.("010","Handle: No node id found. Make sure to only use a Handle inside a custom Node.");let A=e=>{let{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=w.getState(),o={...t,...e};if(r){let{edges:e,setEdges:t,onError:n}=w.getState();t(function(e,t,n={}){return((e,t,n={})=>{let r,o;if(!e.source||!e.target)return n.onError?.("006","Can't create edge. An edge needs a source and a target."),t;let i=n.getEdgeId||nZ;return(o=r=nr(e)?{...e}:{...e,id:i(e)},t.some(e=>e.source===o.source&&e.target===o.target&&(e.sourceHandle===o.sourceHandle||!e.sourceHandle&&!o.sourceHandle)&&(e.targetHandle===o.targetHandle||!e.targetHandle&&!o.targetHandle)))?t:(null===r.sourceHandle&&delete r.sourceHandle,null===r.targetHandle&&delete r.targetHandle,t.concat(r))})(e,t,{...n,onError:n.onError??od})}(o,e,{onError:n}))}n?.(o),l?.(o)},R=e=>{if(!E)return;let t="clientX"in e.nativeEvent;if(o&&(t&&0===e.button||!t)){let t=w.getState();rf(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:x,handleId:m,nodeId:E,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:(...e)=>w.getState().onConnectEnd?.(...e),updateConnection:t.updateConnection,onConnect:A,isValidConnection:n||((...e)=>w.getState().isValidConnection?.(...e)??!0),getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?c?.(e):h?.(e)};return(0,y.jsx)("div",{"data-handleid":m,"data-nodeid":E,"data-handlepos":t,"data-id":`${j}-${E}-${m}-${e}`,className:b(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",_,u,{source:!x,target:x,connectable:r,connectablestart:o,connectableend:i,clickconnecting:N,connectingfrom:S,connectingto:M,valid:P,connectionindicator:r&&(!$||C)&&($||O?i:o)}]),onMouseDown:R,onTouchStart:R,onClick:k?t=>{let{onClickConnectStart:r,onClickConnectEnd:i,connectionClickStartHandle:a,connectionMode:l,isValidConnection:s,lib:u,rfId:d,nodeLookup:c,connection:h}=w.getState();if(!E||!a&&!o)return;if(!a){r?.(t.nativeEvent,{nodeId:E,handleId:m,handleType:e}),w.setState({connectionClickStartHandle:{nodeId:E,type:e,id:m}});return}let f=nT(t.target),p=n||s,{connection:g,isValid:x}=rh(t.nativeEvent,{handle:{nodeId:E,id:m,type:e},connectionMode:l,fromNodeId:a.nodeId,fromHandleId:a.id||null,fromType:a.type,isValidConnection:p,flowId:d,doc:f,lib:u,nodeLookup:c});x&&g&&A(g);let y=structuredClone(h);delete y.inProgress,y.toPosition=y.toHandle?y.toHandle.position:null,i?.(t,y),w.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f,children:s})})),oT={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},oH={input:function({data:e,isConnectable:t,sourcePosition:n=g.Bottom}){return(0,y.jsxs)(y.Fragment,{children:[e?.label,(0,y.jsx)(oB,{type:"source",position:n,isConnectable:t})]})},default:function({data:e,isConnectable:t,targetPosition:n=g.Top,sourcePosition:r=g.Bottom}){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(oB,{type:"target",position:n,isConnectable:t}),e?.label,(0,y.jsx)(oB,{type:"source",position:r,isConnectable:t})]})},output:function({data:e,isConnectable:t,targetPosition:n=g.Top}){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(oB,{type:"target",position:n,isConnectable:t}),e?.label]})},group:function(){return null}},oV=e=>{let{width:t,height:n,x:r,y:o}=na(e.nodeLookup,{filter:e=>!!e.selected});return{width:nj(t)?t:null,height:nj(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${o}px)`}};function oF({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=rT(),{width:o,height:i,transformString:a,userSelectionActive:l}=rB(oV,rR),s=oO(),u=(0,v.useRef)(null);(0,v.useEffect)(()=>{n||u.current?.focus({preventScroll:!0})},[n]);let d=!l&&null!==o&&null!==i;if(o$({nodeRef:u,disabled:!d}),!d)return null;let c=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return(0,y.jsx)("div",{className:b(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a},children:(0,y.jsx)("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:c,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(oT,e.key)&&(e.preventDefault(),s({direction:oT[e.key],factor:e.shiftKey?4:1}))},style:{width:o,height:i}})})}let oq="u">typeof window?window:void 0,oX=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function oW({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:a,paneClickDistance:l,deleteKeyCode:s,selectionKeyCode:u,selectionOnDrag:d,selectionMode:c,onSelectionStart:h,onSelectionEnd:f,multiSelectionKeyCode:p,panActivationKeyCode:g,zoomActivationKeyCode:m,elementsSelectable:x,zoomOnScroll:b,zoomOnPinch:w,panOnScroll:E,panOnScrollSpeed:k,panOnScrollMode:_,zoomOnDoubleClick:j,panOnDrag:S,autoPanOnSelection:M,defaultViewport:N,translateExtent:C,minZoom:$,maxZoom:O,preventScrolling:P,onSelectionContextMenu:A,noWheelClassName:R,noPanClassName:z,disableKeyboardA11y:L,onViewportChange:I,isControlledViewport:D}){let{nodesSelectionActive:B,userSelectionActive:T}=rB(oX,rR),H=on(u,{target:oq}),V=on(g,{target:oq}),F=V||S,q=V||E,X=d&&!0!==F,W=H||T||X;return!function({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=rT(),{deleteElements:r}=oy(),o=on(e,{actInsideInputWithModifier:!1}),i=on(t,{target:ob});(0,v.useEffect)(()=>{if(o){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(ov),edges:e.filter(ov)}),n.setState({nodesSelectionActive:!1})}},[o]),(0,v.useEffect)(()=>{n.setState({multiSelectionActive:i})},[i])}({deleteKeyCode:s,multiSelectionKeyCode:p}),(0,y.jsx)(ok,{onPaneContextMenu:i,elementsSelectable:x,zoomOnScroll:b,zoomOnPinch:w,panOnScroll:q,panOnScrollSpeed:k,panOnScrollMode:_,zoomOnDoubleClick:j,panOnDrag:!H&&F,defaultViewport:N,translateExtent:C,minZoom:$,maxZoom:O,zoomActivationKeyCode:m,preventScrolling:P,noWheelClassName:R,noPanClassName:z,onViewportChange:I,isControlledViewport:D,paneClickDistance:l,selectionOnDrag:X,children:(0,y.jsxs)(oN,{onSelectionStart:h,onSelectionEnd:f,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:a,panOnDrag:F,autoPanOnSelection:M,isSelecting:!!W,selectionMode:c,selectionKeyPressed:H,paneClickDistance:l,selectionOnDrag:X,children:[e,B&&(0,y.jsx)(oF,{onSelectionContextMenu:A,noPanClassName:z,disableKeyboardA11y:L})]})})}oW.displayName="FlowRenderer";let oY=(0,v.memo)(oW),oK=e=>e.updateNodeInternals;var oU=(0,v.memo)(function({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onContextMenu:i,onDoubleClick:a,nodesDraggable:l,elementsSelectable:s,nodesConnectable:u,nodesFocusable:d,resizeObserver:c,noDragClassName:h,noPanClassName:f,disableKeyboardA11y:p,rfId:g,nodeTypes:m,nodeClickDistance:x,onError:w}){let E,{node:k,internals:_,isParent:j}=rB(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},rR),S=k.type||"default",M=m?.[S]||oH[S];void 0===M&&(w?.("003",(E=S,`Node type "${E}" not found. Using fallback type "default".`)),S="default",M=m?.default||oH.default);let N=!!(k.draggable||l&&void 0===k.draggable),C=!!(k.selectable||s&&void 0===k.selectable),$=!!(k.connectable||u&&void 0===k.connectable),O=!!(k.focusable||d&&void 0===k.focusable),P=rT(),A=nz(k),R=function({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let o=rT(),i=(0,v.useRef)(null),a=(0,v.useRef)(null),l=(0,v.useRef)(e.sourcePosition),s=(0,v.useRef)(e.targetPosition),u=(0,v.useRef)(t),d=n&&!!e.internals.handleBounds;return(0,v.useEffect)(()=>{!i.current||e.hidden||d&&a.current===i.current||(a.current&&r?.unobserve(a.current),r?.observe(i.current),a.current=i.current)},[d,e.hidden]),(0,v.useEffect)(()=>()=>{a.current&&(r?.unobserve(a.current),a.current=null)},[]),(0,v.useEffect)(()=>{if(i.current){let n=u.current!==t,r=l.current!==e.sourcePosition,a=s.current!==e.targetPosition;(n||r||a)&&(u.current=t,l.current=e.sourcePosition,s.current=e.targetPosition,o.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}({node:k,nodeType:S,hasDimensions:A,resizeObserver:c}),z=o$({nodeRef:R,disabled:k.hidden||!N,noDragClassName:h,handleSelector:k.dragHandle,nodeId:e,isSelectable:C,nodeClickDistance:x}),L=oO();if(k.hidden)return null;let I=nR(k),D=void 0===k.internals.handleBounds?{width:k.width??k.initialWidth??k.style?.width,height:k.height??k.initialHeight??k.style?.height}:{width:k.width??k.style?.width,height:k.height??k.style?.height},B=C||N||t||n||r||o,T=n?e=>n(e,{..._.userNode}):void 0,H=r?e=>r(e,{..._.userNode}):void 0,V=o?e=>o(e,{..._.userNode}):void 0,F=i?e=>i(e,{..._.userNode}):void 0,q=a?e=>a(e,{..._.userNode}):void 0;return(0,y.jsx)("div",{className:b(["react-flow__node",`react-flow__node-${S}`,{[f]:N},k.className,{selected:k.selected,selectable:C,parent:j,draggable:N,dragging:z}]),ref:R,style:{zIndex:_.z,transform:`translate(${_.positionAbsolute.x}px,${_.positionAbsolute.y}px)`,pointerEvents:B?"all":"none",visibility:A?"visible":"hidden",...k.style,...D},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:T,onMouseMove:H,onMouseLeave:V,onContextMenu:F,onClick:n=>{let{selectNodesOnDrag:r,nodeDragThreshold:o}=P.getState();C&&(!r||!N||o>0)&&oC({id:e,store:P,nodeRef:R}),t&&t(n,{..._.userNode})},onDoubleClick:q,onKeyDown:O?t=>{if(!nV(t.nativeEvent)&&!p){if(t7.includes(t.key)&&C)oC({id:e,store:P,unselect:"Escape"===t.key,nodeRef:R});else if(N&&k.selected&&Object.prototype.hasOwnProperty.call(oT,t.key)){t.preventDefault();let{ariaLabelConfig:e}=P.getState();P.setState({ariaLiveMessage:e["node.a11yDescription.ariaLiveMessage"]({direction:t.key.replace("Arrow","").toLowerCase(),x:~~_.positionAbsolute.x,y:~~_.positionAbsolute.y})}),L({direction:oT[t.key],factor:t.shiftKey?4:1})}}}:void 0,tabIndex:O?0:void 0,onFocus:O?()=>{if(p||!R.current?.matches(":focus-visible"))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:o,setCenter:i}=P.getState();!o||nl(new Map([[e,k]]),{x:0,y:0,width:n,height:r},t,!0).length>0||i(k.position.x+I.width/2,k.position.y+I.height/2,{zoom:t[2]})}:void 0,role:k.ariaRole??(O?"group":void 0),"aria-roledescription":"node","aria-describedby":p?void 0:`${rF}-${g}`,"aria-label":k.ariaLabel,...k.domAttributes,children:(0,y.jsx)(oA,{value:e,children:(0,y.jsx)(M,{id:e,data:k.data,type:S,positionAbsoluteX:_.positionAbsolute.x,positionAbsoluteY:_.positionAbsolute.y,selected:k.selected??!1,selectable:C,draggable:N,deletable:k.deletable??!0,isConnectable:$,sourcePosition:k.sourcePosition,targetPosition:k.targetPosition,dragging:z,dragHandle:k.dragHandle,zIndex:_.z,parentId:k.parentId,...I})})})});let oZ=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function oG(e){var t;let{nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,onError:i}=rB(oZ,rR),a=(t=e.onlyRenderVisibleElements,rB((0,v.useCallback)(e=>t?nl(e.nodeLookup,{x:0,y:0,width:e.width,height:e.height},e.transform,!0).map(e=>e.id):Array.from(e.nodeLookup.keys()),[t]),rR)),l=function(){let e=rB(oK),[t]=(0,v.useState)(()=>"u"<typeof ResizeObserver?null:new ResizeObserver(t=>{let n=new Map;t.forEach(e=>{let t=e.target.getAttribute("data-id");n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return(0,v.useEffect)(()=>()=>{t?.disconnect()},[t]),t}();return(0,y.jsx)("div",{className:"react-flow__nodes",style:ow,children:a.map(t=>(0,y.jsx)(oU,{id:t,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:l,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,nodeClickDistance:e.nodeClickDistance,onError:i},t))})}oG.displayName="NodeRenderer";let oQ=(0,v.memo)(oG),oJ={[p.Arrow]:({color:e="none",strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e}};return(0,y.jsx)("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},[p.ArrowClosed]:({color:e="none",strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e,fill:e}};return(0,y.jsx)("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})}},o0=({id:e,type:t,color:n,width:r=12.5,height:o=12.5,markerUnits:i="strokeWidth",strokeWidth:a,orient:l="auto-start-reverse"})=>{let s,u=(s=rT(),(0,v.useMemo)(()=>{let e;return Object.prototype.hasOwnProperty.call(oJ,t)?oJ[t]:(s.getState().onError?.("009",(e=t,`Marker type "${e}" doesn't exist.`)),null)},[t]));return u?(0,y.jsx)("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:l,refX:"0",refY:"0",children:(0,y.jsx)(u,{color:n,strokeWidth:a})}):null},o1=({defaultColor:e,rfId:t})=>{let n=rB(e=>e.edges),r=rB(e=>e.defaultEdgeOptions),o=(0,v.useMemo)(()=>(function(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:o}){let i=new Set;return e.reduce((e,a)=>([a.markerStart||r,a.markerEnd||o].forEach(r=>{if(r&&"object"==typeof r){let o=n4(r,t);i.has(o)||(e.push({id:o,color:r.color||n,...r}),i.add(o))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))})(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return o.length?(0,y.jsx)("svg",{className:"react-flow__marker","aria-hidden":"true",children:(0,y.jsx)("defs",{children:o.map(e=>(0,y.jsx)(o0,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};o1.displayName="MarkerDefinitions";var o2=(0,v.memo)(o1);function o3({x:e,y:t,label:n,labelStyle:r,labelShowBg:o=!0,labelBgStyle:i,labelBgPadding:a=[2,4],labelBgBorderRadius:l=2,children:s,className:u,...d}){let[c,h]=(0,v.useState)({x:1,y:0,width:0,height:0}),f=b(["react-flow__edge-textwrapper",u]),p=(0,v.useRef)(null);return((0,v.useEffect)(()=>{if(p.current){let e=p.current.getBBox();h({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n)?(0,y.jsxs)("g",{transform:`translate(${e-c.width/2} ${t-c.height/2})`,className:f,visibility:c.width?"visible":"hidden",...d,children:[o&&(0,y.jsx)("rect",{width:c.width+2*a[0],x:-a[0],y:-a[1],height:c.height+2*a[1],className:"react-flow__edge-textbg",style:i,rx:l,ry:l}),(0,y.jsx)("text",{className:"react-flow__edge-text",y:c.height/2,dy:"0.3em",ref:p,style:r,children:n}),s]}):null}o3.displayName="EdgeText";let o5=(0,v.memo)(o3);function o4({path:e,labelX:t,labelY:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:s,interactionWidth:u=20,...d}){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("path",{...d,d:e,fill:"none",className:b(["react-flow__edge-path",d.className])}),u?(0,y.jsx)("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,r&&nj(t)&&nj(n)?(0,y.jsx)(o5,{x:t,y:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:s}):null]})}function o6({pos:e,x1:t,y1:n,x2:r,y2:o}){return e===g.Left||e===g.Right?[.5*(t+r),n]:[t,.5*(n+o)]}function o8({sourceX:e,sourceY:t,sourcePosition:n=g.Bottom,targetX:r,targetY:o,targetPosition:i=g.Top}){let[a,l]=o6({pos:n,x1:e,y1:t,x2:r,y2:o}),[s,u]=o6({pos:i,x1:r,y1:o,x2:e,y2:t}),[d,c,h,f]=nX({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:a,sourceControlY:l,targetControlX:s,targetControlY:u});return[`M${e},${t} C${a},${l} ${s},${u} ${r},${o}`,d,c,h,f]}function o7(e){return(0,v.memo)(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:a,targetPosition:l,label:s,labelStyle:u,labelShowBg:d,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:f,style:p,markerEnd:g,markerStart:m,interactionWidth:x})=>{let[v,b,w]=o8({sourceX:n,sourceY:r,sourcePosition:a,targetX:o,targetY:i,targetPosition:l}),E=e.isInternal?void 0:t;return(0,y.jsx)(o4,{id:E,path:v,labelX:b,labelY:w,label:s,labelStyle:u,labelShowBg:d,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:f,style:p,markerEnd:g,markerStart:m,interactionWidth:x})})}let o9=o7({isInternal:!1}),ie=o7({isInternal:!0});function it(e){return(0,v.memo)(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:a,labelStyle:l,labelShowBg:s,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:c,style:h,sourcePosition:f=g.Bottom,targetPosition:p=g.Top,markerEnd:m,markerStart:x,pathOptions:v,interactionWidth:b})=>{let[w,E,k]=n0({sourceX:n,sourceY:r,sourcePosition:f,targetX:o,targetY:i,targetPosition:p,borderRadius:v?.borderRadius,offset:v?.offset,stepPosition:v?.stepPosition}),_=e.isInternal?void 0:t;return(0,y.jsx)(o4,{id:_,path:w,labelX:E,labelY:k,label:a,labelStyle:l,labelShowBg:s,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:c,style:h,markerEnd:m,markerStart:x,interactionWidth:b})})}o9.displayName="SimpleBezierEdge",ie.displayName="SimpleBezierEdgeInternal";let ir=it({isInternal:!1}),io=it({isInternal:!0});function ii(e){return(0,v.memo)(({id:t,...n})=>{let r=e.isInternal?void 0:t;return(0,y.jsx)(ir,{...n,id:r,pathOptions:(0,v.useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}ir.displayName="SmoothStepEdge",io.displayName="SmoothStepEdgeInternal";let ia=ii({isInternal:!1}),il=ii({isInternal:!0});function is(e){return(0,v.memo)(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:a,labelStyle:l,labelShowBg:s,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:c,style:h,markerEnd:f,markerStart:p,interactionWidth:g})=>{let[m,x,v]=nG({sourceX:n,sourceY:r,targetX:o,targetY:i}),b=e.isInternal?void 0:t;return(0,y.jsx)(o4,{id:b,path:m,labelX:x,labelY:v,label:a,labelStyle:l,labelShowBg:s,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:c,style:h,markerEnd:f,markerStart:p,interactionWidth:g})})}ia.displayName="StepEdge",il.displayName="StepEdgeInternal";let iu=is({isInternal:!1}),id=is({isInternal:!0});function ic(e){return(0,v.memo)(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:a=g.Bottom,targetPosition:l=g.Top,label:s,labelStyle:u,labelShowBg:d,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:f,style:p,markerEnd:m,markerStart:x,pathOptions:v,interactionWidth:b})=>{let[w,E,k]=nK({sourceX:n,sourceY:r,sourcePosition:a,targetX:o,targetY:i,targetPosition:l,curvature:v?.curvature}),_=e.isInternal?void 0:t;return(0,y.jsx)(o4,{id:_,path:w,labelX:E,labelY:k,label:s,labelStyle:u,labelShowBg:d,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:f,style:p,markerEnd:m,markerStart:x,interactionWidth:b})})}iu.displayName="StraightEdge",id.displayName="StraightEdgeInternal";let ih=ic({isInternal:!1}),ip=ic({isInternal:!0});ih.displayName="BezierEdge",ip.displayName="BezierEdgeInternal";let ig={default:ip,straight:id,step:il,smoothstep:io,simplebezier:ie},im={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},ix="react-flow__edgeupdater";function iy({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:o,onMouseEnter:i,onMouseOut:a,type:l}){return(0,y.jsx)("circle",{onMouseDown:o,onMouseEnter:i,onMouseOut:a,className:b([ix,`${ix}-${l}`]),cx:e===g.Left?t-r:e===g.Right?t+r:t,cy:e===g.Top?n-r:e===g.Bottom?n+r:n,r:r,stroke:"transparent",fill:"transparent"})}function iv({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:o,targetX:i,targetY:a,sourcePosition:l,targetPosition:s,onReconnect:u,onReconnectStart:d,onReconnectEnd:c,setReconnecting:h,setUpdateHover:f}){let p=rT(),g=(e,t)=>{if(0!==e.button)return;let{autoPanOnConnect:r,domNode:o,connectionMode:i,connectionRadius:a,lib:l,onConnectStart:s,cancelConnection:f,nodeLookup:g,rfId:m,panBy:x,updateConnection:y}=p.getState(),v="target"===t.type;rf(e.nativeEvent,{autoPanOnConnect:r,connectionMode:i,connectionRadius:a,domNode:o,handleId:t.id,nodeId:t.nodeId,nodeLookup:g,isTarget:v,edgeUpdaterType:t.type,lib:l,flowId:m,cancelConnection:f,panBy:x,isValidConnection:(...e)=>p.getState().isValidConnection?.(...e)??!0,onConnect:e=>u?.(n,e),onConnectStart:(r,o)=>{h(!0),d?.(e,n,t.type),s?.(r,o)},onConnectEnd:(...e)=>p.getState().onConnectEnd?.(...e),onReconnectEnd:(e,r)=>{h(!1),c?.(e,n,t.type,r)},updateConnection:y,getTransform:()=>p.getState().transform,getFromHandle:()=>p.getState().connection.fromHandle,dragThreshold:p.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},m=()=>f(!0),x=()=>f(!1);return(0,y.jsxs)(y.Fragment,{children:[(!0===e||"source"===e)&&(0,y.jsx)(iy,{position:l,centerX:r,centerY:o,radius:t,onMouseDown:e=>g(e,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),onMouseEnter:m,onMouseOut:x,type:"source"}),(!0===e||"target"===e)&&(0,y.jsx)(iy,{position:s,centerX:i,centerY:a,radius:t,onMouseDown:e=>g(e,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),onMouseEnter:m,onMouseOut:x,type:"target"})]})}var ib=(0,v.memo)(function({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:o,onDoubleClick:i,onContextMenu:a,onMouseEnter:l,onMouseMove:s,onMouseLeave:u,reconnectRadius:c,onReconnect:h,onReconnectStart:f,onReconnectEnd:p,rfId:m,edgeTypes:x,noPanClassName:w,onError:E,disableKeyboardA11y:k}){let _,j=rB(t=>t.edgeLookup.get(e)),S=rB(e=>e.defaultEdgeOptions),M=(j=S?{...S,...j}:j).type||"default",N=x?.[M]||ig[M];void 0===N&&(E?.("011",(_=M,`Edge type "${_}" not found. Using fallback type "default".`)),M="default",N=x?.default||ig.default);let C=!!(j.focusable||t&&void 0===j.focusable),$=void 0!==h&&(j.reconnectable||n&&void 0===j.reconnectable),O=!!(j.selectable||r&&void 0===j.selectable),P=(0,v.useRef)(null),[A,R]=(0,v.useState)(!1),[z,L]=(0,v.useState)(!1),I=rT(),{zIndex:D=j.zIndex,sourceX:B,sourceY:T,targetX:H,targetY:V,sourcePosition:F,targetPosition:q}=rB((0,v.useCallback)(t=>{let n=t.nodeLookup.get(j.source),r=t.nodeLookup.get(j.target);if(!n||!r)return im;let o=function(e){let{sourceNode:t,targetNode:n}=e;if(!n1(t)||!n1(n))return null;let r=t.internals.handleBounds||n2(t.handles),o=n.internals.handleBounds||n2(n.handles),i=n5(r?.source??[],e.sourceHandle),a=n5(e.connectionMode===d.Strict?o?.target??[]:(o?.target??[]).concat(o?.source??[]),e.targetHandle);if(!i||!a)return e.onError?.("008",((e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${"source"===e?n:r}", edge id: ${t}.`)(!i?"source":"target",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let l=i?.position||g.Bottom,s=a?.position||g.Top,u=n3(t,i,l),c=n3(n,a,s);return{sourceX:u.x,sourceY:u.y,targetX:c.x,targetY:c.y,sourcePosition:l,targetPosition:s}}({id:e,sourceNode:n,targetNode:r,sourceHandle:j.sourceHandle||null,targetHandle:j.targetHandle||null,connectionMode:t.connectionMode,onError:E}),i=function({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:o=!1,zIndexMode:i="basic"}){if("manual"===i)return r;let a=Math.max(e.parentId||o&&e.selected?e.internals.z:0,t.parentId||o&&t.selected?t.internals.z:0);return(o&&n?r+1e3:r)+a}({selected:j.selected,zIndex:j.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...o||im,zIndex:i}},[j.source,j.target,j.sourceHandle,j.targetHandle,j.selected,j.zIndex]),rR),X=(0,v.useMemo)(()=>j.markerStart?`url('#${n4(j.markerStart,m)}')`:void 0,[j.markerStart,m]),W=(0,v.useMemo)(()=>j.markerEnd?`url('#${n4(j.markerEnd,m)}')`:void 0,[j.markerEnd,m]);if(j.hidden||null===B||null===T||null===H||null===V)return null;let Y=i?e=>{i(e,{...j})}:void 0,K=a?e=>{a(e,{...j})}:void 0,U=l?e=>{l(e,{...j})}:void 0,Z=s?e=>{s(e,{...j})}:void 0,G=u?e=>{u(e,{...j})}:void 0;return(0,y.jsx)("svg",{style:{zIndex:D},children:(0,y.jsxs)("g",{className:b(["react-flow__edge",`react-flow__edge-${M}`,j.className,w,{selected:j.selected,animated:j.animated,inactive:!O&&!o,updating:A,selectable:O}]),onClick:t=>{let{addSelectedEdges:n,unselectNodesAndEdges:r,multiSelectionActive:i}=I.getState();O&&(I.setState({nodesSelectionActive:!1}),j.selected&&i?(r({nodes:[],edges:[j]}),P.current?.blur()):n([e])),o&&o(t,j)},onDoubleClick:Y,onContextMenu:K,onMouseEnter:U,onMouseMove:Z,onMouseLeave:G,onKeyDown:C?t=>{if(!k&&t7.includes(t.key)&&O){let{unselectNodesAndEdges:n,addSelectedEdges:r}=I.getState();"Escape"===t.key?(P.current?.blur(),n({edges:[j]})):r([e])}}:void 0,tabIndex:C?0:void 0,role:j.ariaRole??(C?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":null===j.ariaLabel?void 0:j.ariaLabel||`Edge from ${j.source} to ${j.target}`,"aria-describedby":C?`${rq}-${m}`:void 0,ref:P,...j.domAttributes,children:[!z&&(0,y.jsx)(N,{id:e,source:j.source,target:j.target,type:j.type,selected:j.selected,animated:j.animated,selectable:O,deletable:j.deletable??!0,label:j.label,labelStyle:j.labelStyle,labelShowBg:j.labelShowBg,labelBgStyle:j.labelBgStyle,labelBgPadding:j.labelBgPadding,labelBgBorderRadius:j.labelBgBorderRadius,sourceX:B,sourceY:T,targetX:H,targetY:V,sourcePosition:F,targetPosition:q,data:j.data,style:j.style,sourceHandleId:j.sourceHandle,targetHandleId:j.targetHandle,markerStart:X,markerEnd:W,pathOptions:"pathOptions"in j?j.pathOptions:void 0,interactionWidth:j.interactionWidth}),$&&(0,y.jsx)(iv,{edge:j,isReconnectable:$,reconnectRadius:c,onReconnect:h,onReconnectStart:f,onReconnectEnd:p,sourceX:B,sourceY:T,targetX:H,targetY:V,sourcePosition:F,targetPosition:q,setUpdateHover:R,setReconnecting:L})]})})});let iw=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function iE({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:o,onReconnect:i,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:s,onEdgeMouseLeave:u,onEdgeClick:d,reconnectRadius:c,onEdgeDoubleClick:h,onReconnectStart:f,onReconnectEnd:p,disableKeyboardA11y:g}){let{edgesFocusable:m,edgesReconnectable:x,elementsSelectable:b,onError:w}=rB(iw,rR),E=rB((0,v.useCallback)(e=>{if(!t)return e.edges.map(e=>e.id);let n=[];if(e.width&&e.height)for(let t of e.edges){let r=e.nodeLookup.get(t.source),o=e.nodeLookup.get(t.target);r&&o&&function({sourceNode:e,targetNode:t,width:n,height:r,transform:o}){let i=nm(nb(e),nb(t));return i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1),nk({x:-o[0]/o[2],y:-o[1]/o[2],width:n/o[2],height:r/o[2]},ny(i))>0}({sourceNode:r,targetNode:o,width:e.width,height:e.height,transform:e.transform})&&n.push(t.id)}return n},[t]),rR);return(0,y.jsxs)("div",{className:"react-flow__edges",children:[(0,y.jsx)(o2,{defaultColor:e,rfId:n}),E.map(e=>(0,y.jsx)(ib,{id:e,edgesFocusable:m,edgesReconnectable:x,elementsSelectable:b,noPanClassName:o,onReconnect:i,onContextMenu:a,onMouseEnter:l,onMouseMove:s,onMouseLeave:u,onClick:d,reconnectRadius:c,onDoubleClick:h,onReconnectStart:f,onReconnectEnd:p,rfId:n,onError:w,edgeTypes:r,disableKeyboardA11y:g},e))]})}iE.displayName="EdgeRenderer";let ik=(0,v.memo)(iE),i_=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function ij({children:e}){let t=rT(),n=(0,v.useRef)(null),[r]=(0,v.useState)(()=>t.getState().transform);return of(()=>{let e=null,r=()=>{let r=t.getState().transform;(!e||r[0]!==e[0]||r[1]!==e[1]||r[2]!==e[2])&&(e=r,n.current&&(n.current.style.transform=i_(r)))};return r(),t.subscribe(r)},[t]),(0,y.jsx)("div",{ref:n,className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:i_(r)},children:e})}let iS=e=>e.panZoom?.syncViewport;function iM(e){return e.connection.inProgress?{...e.connection,to:nN(e.connection.to,e.transform)}:{...e.connection}}let iN=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function iC({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:o,width:i,height:a,isValid:l,inProgress:s}=rB(iN,rR);return i&&o&&s?(0,y.jsx)("svg",{style:e,width:i,height:a,className:"react-flow__connectionline react-flow__container",children:(0,y.jsx)("g",{className:b(["react-flow__connection",nn(l)]),children:(0,y.jsx)(i$,{style:t,type:n,CustomComponent:r,isValid:l})})}):null}let i$=({style:e,type:t=f.Bezier,CustomComponent:n,isValid:r})=>{let{inProgress:o,from:i,fromNode:a,fromHandle:l,fromPosition:s,to:u,toNode:d,toHandle:c,toPosition:h,pointer:p}=rB(iM,rR);if(!o)return;if(n)return(0,y.jsx)(n,{connectionLineType:t,connectionLineStyle:e,fromNode:a,fromHandle:l,fromX:i.x,fromY:i.y,toX:u.x,toY:u.y,fromPosition:s,toPosition:h,connectionStatus:nn(r),toNode:d,toHandle:c,pointer:p});let g="",m={sourceX:i.x,sourceY:i.y,sourcePosition:s,targetX:u.x,targetY:u.y,targetPosition:h};switch(t){case f.Bezier:[g]=nK(m);break;case f.SimpleBezier:[g]=o8(m);break;case f.Step:[g]=n0({...m,borderRadius:0});break;case f.SmoothStep:[g]=n0(m);break;default:[g]=nG(m)}return(0,y.jsx)("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};i$.displayName="ConnectionLine";let iO={};function iP(e=iO){(0,v.useRef)(e),rT(),(0,v.useEffect)(()=>{},[e])}function iA({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:o,onNodeDoubleClick:i,onEdgeDoubleClick:a,onNodeMouseEnter:l,onNodeMouseMove:s,onNodeMouseLeave:u,onNodeContextMenu:d,onSelectionContextMenu:c,onSelectionStart:h,onSelectionEnd:f,connectionLineType:p,connectionLineStyle:g,connectionLineComponent:m,connectionLineContainerStyle:x,selectionKeyCode:b,selectionOnDrag:w,selectionMode:E,multiSelectionKeyCode:k,panActivationKeyCode:_,zoomActivationKeyCode:j,deleteKeyCode:S,onlyRenderVisibleElements:M,elementsSelectable:N,defaultViewport:C,translateExtent:$,minZoom:O,maxZoom:P,preventScrolling:A,defaultMarkerColor:R,zoomOnScroll:z,zoomOnPinch:L,panOnScroll:I,panOnScrollSpeed:D,panOnScrollMode:B,zoomOnDoubleClick:T,panOnDrag:H,autoPanOnSelection:V,onPaneClick:F,onPaneMouseEnter:q,onPaneMouseMove:X,onPaneMouseLeave:W,onPaneScroll:Y,onPaneContextMenu:K,paneClickDistance:U,nodeClickDistance:Z,onEdgeContextMenu:G,onEdgeMouseEnter:Q,onEdgeMouseMove:J,onEdgeMouseLeave:ee,reconnectRadius:et,onReconnect:en,onReconnectStart:er,onReconnectEnd:eo,noDragClassName:ei,noWheelClassName:ea,noPanClassName:el,disableKeyboardA11y:es,nodeExtent:eu,rfId:ed,viewport:ec,onViewportChange:eh,nodesDraggable:ef}){let ep,eg,em,ex;return iP(e),iP(t),rT(),(0,v.useRef)(!1),(0,v.useEffect)(()=>{},[]),ep=oy(),eg=(0,v.useRef)(!1),(0,v.useEffect)(()=>{!eg.current&&ep.viewportInitialized&&n&&(setTimeout(()=>n(ep),1),eg.current=!0)},[n,ep.viewportInitialized]),em=rB(iS),ex=rT(),(0,v.useEffect)(()=>{ec&&(em?.(ec),ex.setState({transform:[ec.x,ec.y,ec.zoom]}))},[ec,em]),(0,y.jsx)(oY,{onPaneClick:F,onPaneMouseEnter:q,onPaneMouseMove:X,onPaneMouseLeave:W,onPaneContextMenu:K,onPaneScroll:Y,paneClickDistance:U,deleteKeyCode:S,selectionKeyCode:b,selectionOnDrag:w,selectionMode:E,onSelectionStart:h,onSelectionEnd:f,multiSelectionKeyCode:k,panActivationKeyCode:_,zoomActivationKeyCode:j,elementsSelectable:N,zoomOnScroll:z,zoomOnPinch:L,zoomOnDoubleClick:T,panOnScroll:I,panOnScrollSpeed:D,panOnScrollMode:B,panOnDrag:H,autoPanOnSelection:V,defaultViewport:C,translateExtent:$,minZoom:O,maxZoom:P,onSelectionContextMenu:c,preventScrolling:A,noDragClassName:ei,noWheelClassName:ea,noPanClassName:el,disableKeyboardA11y:es,onViewportChange:eh,isControlledViewport:!!ec,children:(0,y.jsxs)(ij,{children:[(0,y.jsx)(ik,{edgeTypes:t,onEdgeClick:o,onEdgeDoubleClick:a,onReconnect:en,onReconnectStart:er,onReconnectEnd:eo,onlyRenderVisibleElements:M,onEdgeContextMenu:G,onEdgeMouseEnter:Q,onEdgeMouseMove:J,onEdgeMouseLeave:ee,reconnectRadius:et,defaultMarkerColor:R,noPanClassName:el,disableKeyboardA11y:es,rfId:ed}),(0,y.jsx)(iC,{style:g,type:p,component:m,containerStyle:x}),(0,y.jsx)("div",{className:"react-flow__edgelabel-renderer"}),(0,y.jsx)(oQ,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:l,onNodeMouseMove:s,onNodeMouseLeave:u,onNodeContextMenu:d,nodeClickDistance:Z,onlyRenderVisibleElements:M,noPanClassName:el,noDragClassName:ei,disableKeyboardA11y:es,nodeExtent:eu,rfId:ed,nodesDraggable:ef}),(0,y.jsx)("div",{className:"react-flow__viewport-portal"})]})})}iA.displayName="GraphView";let iR=(0,v.memo)(iA),iz=nS("React Flow","https://reactflow.dev/"),iL=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:a,fitViewOptions:l,minZoom:s=.5,maxZoom:u=2,nodeOrigin:c,nodeExtent:h,zIndexMode:f="basic"}={})=>{let p=new Map,g=new Map,m=new Map,x=new Map,y=r??t??[],v=n??e??[],b=c??[0,0],w=h??t8;ra(m,x,y);let{nodesInitialized:E}=re(v,p,g,{nodeOrigin:b,nodeExtent:w,zIndexMode:f}),k=[0,0,1];if(a&&o&&i){let{x:e,y:t,zoom:n}=nO(na(p,{filter:e=>!!((e.width||e.initialWidth)&&(e.height||e.initialHeight))}),o,i,s,u,l?.padding??.1);k=[e,t,n]}return{rfId:"1",width:o??0,height:i??0,transform:k,nodes:v,nodesInitialized:E,nodeLookup:p,parentLookup:g,edges:y,edgeLookup:x,connectionLookup:m,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:void 0!==n,hasDefaultEdges:void 0!==r,panZoom:null,minZoom:s,maxZoom:u,translateExtent:t8,nodeExtent:w,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:d.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:b,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:a??!1,fitViewOptions:l,fitViewResolver:null,connection:{...ne},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:iz,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:t9,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}};function iI({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:o,initialHeight:i,initialMinZoom:a,initialMaxZoom:l,initialFitViewOptions:s,fitView:u,nodeOrigin:d,nodeExtent:c,zIndexMode:h,children:f}){let[p]=(0,v.useState)(()=>(({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:a,fitViewOptions:l,minZoom:s,maxZoom:u,nodeOrigin:d,nodeExtent:c,zIndexMode:h})=>{let f,p;return f=(f,p)=>{async function m(){let{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:r,width:o,height:i,minZoom:a,maxZoom:l}=p();t&&(await ns({nodes:e,width:o,height:i,panZoom:t,minZoom:a,maxZoom:l},n),r?.resolve(!0),f({fitViewResolver:null}))}return{...iL({nodes:e,edges:t,width:o,height:i,fitView:a,fitViewOptions:l,minZoom:s,maxZoom:u,nodeOrigin:d,nodeExtent:c,defaultNodes:n,defaultEdges:r,zIndexMode:h}),setNodes:e=>{let{nodeLookup:t,parentLookup:n,nodeOrigin:r,elevateNodesOnSelect:o,fitViewQueued:i,zIndexMode:a,nodesSelectionActive:l}=p(),{nodesInitialized:s,hasSelectedNodes:u}=re(e,t,n,{nodeOrigin:r,nodeExtent:c,elevateNodesOnSelect:o,checkEquality:!0,zIndexMode:a}),d=l&&u;i&&s?(m(),f({nodes:e,nodesInitialized:s,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:d})):f({nodes:e,nodesInitialized:s,nodesSelectionActive:d})},setEdges:e=>{let{connectionLookup:t,edgeLookup:n}=p();ra(t,n,e),f({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){let{setNodes:t}=p();t(e),f({hasDefaultNodes:!0})}if(t){let{setEdges:e}=p();e(t),f({hasDefaultEdges:!0})}},updateNodeInternals:e=>{let{triggerNodeChanges:t,nodeLookup:n,parentLookup:r,domNode:o,nodeOrigin:i,nodeExtent:a,debug:l,fitViewQueued:s,zIndexMode:u}=p(),{changes:d,updatedInternals:c}=function(e,t,n,r,o,i,a){let l=r?.querySelector(".xyflow__viewport"),s=!1;if(!l)return{changes:[],updatedInternals:s};let u=[],d=window.getComputedStyle(l),{m22:c}=new window.DOMMatrixReadOnly(d.transform),h=[];for(let r of e.values()){let e=t.get(r.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),s=!0;continue}let l=nB(r.nodeElement),d=e.measured.width!==l.width||e.measured.height!==l.height;if(l.width&&l.height&&(d||!e.internals.handleBounds||r.force)){let f=r.nodeElement.getBoundingClientRect(),p=nA(e.extent)?e.extent:i,{positionAbsolute:g}=e.internals;if(e.parentId&&"parent"===e.extent){let n=t.get(e.parentId);n&&(g=nf(g,l,n))}else p&&(g=nh(g,p,l));let m={...e,measured:l,internals:{...e.internals,positionAbsolute:g,handleBounds:{source:nq("source",r.nodeElement,f,c,e.id),target:nq("target",r.nodeElement,f,c,e.id)}}};t.set(e.id,m),e.parentId&&rt(m,t,n,{nodeOrigin:o,zIndexMode:a}),s=!0,d&&(u.push({id:e.id,type:"dimensions",dimensions:l}),e.expandParent&&e.parentId&&h.push({id:e.id,parentId:e.parentId,rect:nv(m,o)}))}}if(h.length>0){let e=rr(h,t,n,o);u.push(...e)}return{changes:u,updatedInternals:s}}(e,n,r,o,i,a,u);c&&(!function(e,t,n){let r=n7(n6,n);for(let n of e.values())if(n.parentId)rt(n,e,t,r);else{let e=nh(ni(n,r.nodeOrigin),nA(n.extent)?n.extent:r.nodeExtent,nR(n));n.internals.positionAbsolute=e}}(n,r,{nodeOrigin:i,nodeExtent:a,zIndexMode:u}),s?(m(),f({fitViewQueued:!1,fitViewOptions:void 0})):f({}),d?.length>0&&(l&&console.log("React Flow: trigger node changes",d),t?.(d)))},updateNodePositions:(e,t=!1)=>{let n=[],r=[],{nodeLookup:o,triggerNodeChanges:i,connection:a,updateConnection:l,onNodesChangeMiddlewareMap:s}=p();for(let[i,s]of e){let e=o.get(i),u=!!(e?.expandParent&&e?.parentId&&s?.position),d={id:i,type:"position",position:u?{x:Math.max(0,s.position.x),y:Math.max(0,s.position.y)}:s.position,dragging:t};if(e&&a.inProgress&&a.fromNode.id===e.id){let t=n3(e,a.fromHandle,g.Left,!0);l({...a,from:t})}u&&e.parentId&&n.push({id:i,parentId:e.parentId,rect:{...s.internals.positionAbsolute,width:s.measured.width??0,height:s.measured.height??0}}),r.push(d)}if(n.length>0){let{parentLookup:e,nodeOrigin:t}=p(),i=rr(n,o,e,t);r.push(...i)}for(let e of s.values())r=e(r);i(r)},triggerNodeChanges:e=>{let{onNodesChange:t,setNodes:n,nodes:r,hasDefaultNodes:o,debug:i}=p();e?.length&&(o&&n(oi(e,r)),i&&console.log("React Flow: trigger node changes",e),t?.(e))},triggerEdgeChanges:e=>{let{onEdgesChange:t,setEdges:n,edges:r,hasDefaultEdges:o,debug:i}=p();e?.length&&(o&&n(oi(e,r)),i&&console.log("React Flow: trigger edge changes",e),t?.(e))},addSelectedNodes:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:o,triggerEdgeChanges:i}=p();t?o(e.map(e=>oa(e,!0))):(o(ol(r,new Set([...e]),!0)),i(ol(n)))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:o,triggerEdgeChanges:i}=p();t?i(e.map(e=>oa(e,!0))):(i(ol(n,new Set([...e]))),o(ol(r,new Set,!0)))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{let{edges:n,nodes:r,nodeLookup:o,triggerNodeChanges:i,triggerEdgeChanges:a}=p(),l=[];for(let t of e||r){if(!t.selected)continue;let e=o.get(t.id);e&&(e.selected=!1),l.push(oa(t.id,!1))}let s=[];for(let e of t||n)e.selected&&s.push(oa(e.id,!1));i(l),a(s)},setMinZoom:e=>{let{panZoom:t,maxZoom:n}=p();t?.setScaleExtent([e,n]),f({minZoom:e})},setMaxZoom:e=>{let{panZoom:t,minZoom:n}=p();t?.setScaleExtent([n,e]),f({maxZoom:e})},setTranslateExtent:e=>{p().panZoom?.setTranslateExtent(e),f({translateExtent:e})},resetSelectedElements:()=>{let{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:r,elementsSelectable:o}=p();if(!o)return;let i=t.reduce((e,t)=>t.selected?[...e,oa(t.id,!1)]:e,[]),a=e.reduce((e,t)=>t.selected?[...e,oa(t.id,!1)]:e,[]);n(i),r(a)},setNodeExtent:e=>{let{nodes:t,nodeLookup:n,parentLookup:r,nodeOrigin:o,elevateNodesOnSelect:i,nodeExtent:a,zIndexMode:l}=p();(e[0][0]!==a[0][0]||e[0][1]!==a[0][1]||e[1][0]!==a[1][0]||e[1][1]!==a[1][1])&&(re(t,n,r,{nodeOrigin:o,nodeExtent:e,elevateNodesOnSelect:i,checkEquality:!1,zIndexMode:l}),f({nodeExtent:e}))},panBy:e=>{let{transform:t,width:n,height:r,panZoom:o,translateExtent:i}=p();return ro({delta:e,panZoom:o,transform:t,translateExtent:i,width:n,height:r})},setCenter:async(e,t,n)=>{let{width:r,height:o,maxZoom:i,panZoom:a}=p();if(!a)return!1;let l=void 0!==n?.zoom?n.zoom:i;return await a.setViewport({x:r/2-e*l,y:o/2-t*l,zoom:l},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0},cancelConnection:()=>{f({connection:{...ne}})},updateConnection:e=>{f({connection:e})},reset:()=>f({...iL()})}},p=Object.is,f?rA(f,p):rA})({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:u,minZoom:a,maxZoom:l,fitViewOptions:s,nodeOrigin:d,nodeExtent:c,zIndexMode:h}));return(0,y.jsx)(rI,{value:p,children:(0,y.jsx)(om,{children:(0,y.jsx)(oI,{children:f})})})}function iD({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:o,width:i,height:a,fitView:l,fitViewOptions:s,minZoom:u,maxZoom:d,nodeOrigin:c,nodeExtent:h,zIndexMode:f}){return(0,v.useContext)(rL)?(0,y.jsx)(y.Fragment,{children:e}):(0,y.jsx)(iI,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:o,initialWidth:i,initialHeight:a,fitView:l,initialFitViewOptions:s,initialMinZoom:u,initialMaxZoom:d,nodeOrigin:c,nodeExtent:h,zIndexMode:f,children:e})}let iB={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};var iT=oh(function({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:o,nodeTypes:i,edgeTypes:a,onNodeClick:l,onEdgeClick:s,onInit:u,onMove:d,onMoveStart:p,onMoveEnd:g,onConnect:m,onConnectStart:x,onConnectEnd:w,onClickConnectStart:E,onClickConnectEnd:k,onNodeMouseEnter:_,onNodeMouseMove:j,onNodeMouseLeave:S,onNodeContextMenu:M,onNodeDoubleClick:N,onNodeDragStart:C,onNodeDrag:$,onNodeDragStop:O,onNodesDelete:P,onEdgesDelete:A,onDelete:R,onSelectionChange:z,onSelectionDragStart:L,onSelectionDrag:I,onSelectionDragStop:D,onSelectionContextMenu:B,onSelectionStart:T,onSelectionEnd:H,onBeforeDelete:V,connectionMode:F,connectionLineType:q=f.Bezier,connectionLineStyle:X,connectionLineComponent:W,connectionLineContainerStyle:Y,deleteKeyCode:K="Backspace",selectionKeyCode:U="Shift",selectionOnDrag:Z=!1,selectionMode:G=h.Full,panActivationKeyCode:Q="Space",multiSelectionKeyCode:J=nP()?"Meta":"Control",zoomActivationKeyCode:ee=nP()?"Meta":"Control",snapToGrid:et,snapGrid:en,onlyRenderVisibleElements:er=!1,selectNodesOnDrag:eo,nodesDraggable:ei,autoPanOnNodeFocus:ea,nodesConnectable:el,nodesFocusable:es,nodeOrigin:eu=r5,edgesFocusable:ed,edgesReconnectable:ec,elementsSelectable:eh=!0,defaultViewport:ef=r4,minZoom:ep=.5,maxZoom:eg=2,translateExtent:em=t8,preventScrolling:ex=!0,nodeExtent:ey,defaultMarkerColor:ev="#b1b1b7",zoomOnScroll:eb=!0,zoomOnPinch:ew=!0,panOnScroll:eE=!1,panOnScrollSpeed:ek=.5,panOnScrollMode:e_=c.Free,zoomOnDoubleClick:ej=!0,panOnDrag:eS=!0,onPaneClick:eM,onPaneMouseEnter:eN,onPaneMouseMove:eC,onPaneMouseLeave:e$,onPaneScroll:eO,onPaneContextMenu:eP,paneClickDistance:eA=1,nodeClickDistance:eR=0,children:ez,onReconnect:eL,onReconnectStart:eI,onReconnectEnd:eD,onEdgeContextMenu:eB,onEdgeDoubleClick:eT,onEdgeMouseEnter:eH,onEdgeMouseMove:eV,onEdgeMouseLeave:eF,reconnectRadius:eq=10,onNodesChange:eX,onEdgesChange:eW,noDragClassName:eY="nodrag",noWheelClassName:eK="nowheel",noPanClassName:eU="nopan",fitView:eZ,fitViewOptions:eG,connectOnClick:eQ,attributionPosition:eJ,proOptions:e0,defaultEdgeOptions:e1,elevateNodesOnSelect:e2=!0,elevateEdgesOnSelect:e3=!1,disableKeyboardA11y:e5=!1,autoPanOnConnect:e4,autoPanOnNodeDrag:e6,autoPanOnSelection:e8=!0,autoPanSpeed:e7,connectionRadius:e9,isValidConnection:te,onError:tt,style:tn,id:tr,nodeDragThreshold:to,connectionDragThreshold:ti,viewport:ta,onViewportChange:tl,width:ts,height:tu,colorMode:td="light",debug:tc,onScroll:th,ariaLabelConfig:tf,zIndexMode:tp="basic",...tg},tm){let tx=tr||"1",ty=function(e){let[t,n]=(0,v.useState)("system"===e?null:e);return(0,v.useEffect)(()=>{if("system"!==e)return void n(e);let t=oe(),r=()=>n(t?.matches?"dark":"light");return r(),t?.addEventListener("change",r),()=>{t?.removeEventListener("change",r)}},[e]),null!==t?t:oe()?.matches?"dark":"light"}(td),tv=(0,v.useCallback)(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),th?.(e)},[th]);return(0,y.jsx)("div",{"data-testid":"rf__wrapper",...tg,onScroll:tv,style:{...tn,...iB},ref:tm,className:b(["react-flow",o,ty]),id:tr,role:"application",children:(0,y.jsxs)(iD,{nodes:e,edges:t,width:ts,height:tu,fitView:eZ,fitViewOptions:eG,minZoom:ep,maxZoom:eg,nodeOrigin:eu,nodeExtent:ey,zIndexMode:tp,children:[(0,y.jsx)(r9,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:m,onConnectStart:x,onConnectEnd:w,onClickConnectStart:E,onClickConnectEnd:k,nodesDraggable:ei,autoPanOnNodeFocus:ea,nodesConnectable:el,nodesFocusable:es,edgesFocusable:ed,edgesReconnectable:ec,elementsSelectable:eh,elevateNodesOnSelect:e2,elevateEdgesOnSelect:e3,minZoom:ep,maxZoom:eg,nodeExtent:ey,onNodesChange:eX,onEdgesChange:eW,snapToGrid:et,snapGrid:en,connectionMode:F,translateExtent:em,connectOnClick:eQ,defaultEdgeOptions:e1,fitView:eZ,fitViewOptions:eG,onNodesDelete:P,onEdgesDelete:A,onDelete:R,onNodeDragStart:C,onNodeDrag:$,onNodeDragStop:O,onSelectionDrag:I,onSelectionDragStart:L,onSelectionDragStop:D,onMove:d,onMoveStart:p,onMoveEnd:g,noPanClassName:eU,nodeOrigin:eu,rfId:tx,autoPanOnConnect:e4,autoPanOnNodeDrag:e6,autoPanSpeed:e7,onError:tt,connectionRadius:e9,isValidConnection:te,selectNodesOnDrag:eo,nodeDragThreshold:to,connectionDragThreshold:ti,onBeforeDelete:V,debug:tc,ariaLabelConfig:tf,zIndexMode:tp}),(0,y.jsx)(iR,{onInit:u,onNodeClick:l,onEdgeClick:s,onNodeMouseEnter:_,onNodeMouseMove:j,onNodeMouseLeave:S,onNodeContextMenu:M,onNodeDoubleClick:N,nodeTypes:i,edgeTypes:a,connectionLineType:q,connectionLineStyle:X,connectionLineComponent:W,connectionLineContainerStyle:Y,selectionKeyCode:U,selectionOnDrag:Z,selectionMode:G,deleteKeyCode:K,multiSelectionKeyCode:J,panActivationKeyCode:Q,zoomActivationKeyCode:ee,onlyRenderVisibleElements:er,defaultViewport:ef,translateExtent:em,minZoom:ep,maxZoom:eg,preventScrolling:ex,zoomOnScroll:eb,zoomOnPinch:ew,zoomOnDoubleClick:ej,panOnScroll:eE,panOnScrollSpeed:ek,panOnScrollMode:e_,panOnDrag:eS,autoPanOnSelection:e8,onPaneClick:eM,onPaneMouseEnter:eN,onPaneMouseMove:eC,onPaneMouseLeave:e$,onPaneScroll:eO,onPaneContextMenu:eP,paneClickDistance:eA,nodeClickDistance:eR,onSelectionContextMenu:B,onSelectionStart:T,onSelectionEnd:H,onReconnect:eL,onReconnectStart:eI,onReconnectEnd:eD,onEdgeContextMenu:eB,onEdgeDoubleClick:eT,onEdgeMouseEnter:eH,onEdgeMouseMove:eV,onEdgeMouseLeave:eF,reconnectRadius:eq,defaultMarkerColor:ev,noDragClassName:eY,noWheelClassName:eK,noPanClassName:eU,rfId:tx,disableKeyboardA11y:e5,nodeExtent:ey,viewport:ta,onViewportChange:tl,nodesDraggable:ei}),(0,y.jsx)(r3,{onSelectionChange:z}),ez,(0,y.jsx)(rG,{proOptions:e0,position:eJ}),(0,y.jsx)(rK,{rfId:tx,disableKeyboardA11y:e5})]})})});let iH=e=>e.domNode?.querySelector(".react-flow__edgelabel-renderer");function iV({children:e}){let t=rB(iH);return t?(0,rz.createPortal)(e,t):null}let iF=e=>e.domNode?.querySelector(".react-flow__viewport-portal");function iq({children:e}){let t=rB(iF);return t?(0,rz.createPortal)(e,t):null}function iX({dimensions:e,lineWidth:t,variant:n,className:r}){return(0,y.jsx)("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:b(["react-flow__background-pattern",n,r])})}function iW({radius:e,className:t}){return(0,y.jsx)("circle",{cx:e,cy:e,r:e,className:b(["react-flow__background-pattern","dots",t])})}(s=x||(x={})).Lines="lines",s.Dots="dots",s.Cross="cross";let iY={[x.Dots]:1,[x.Lines]:1,[x.Cross]:6},iK=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function iU({id:e,variant:t=x.Dots,gap:n=20,size:r,lineWidth:o=1,offset:i=0,color:a,bgColor:l,style:s,className:u,patternClassName:d}){let c=(0,v.useRef)(null),{transform:h,patternId:f}=rB(iK,rR),p=r||iY[t],g=t===x.Dots,m=t===x.Cross,w=Array.isArray(n)?n:[n,n],E=[w[0]*h[2]||1,w[1]*h[2]||1],k=p*h[2],_=Array.isArray(i)?i:[i,i],j=m?[k,k]:E,S=[_[0]*h[2]||1+j[0]/2,_[1]*h[2]||1+j[1]/2],M=`${f}${e||""}`;return(0,y.jsxs)("svg",{className:b(["react-flow__background",u]),style:{...s,...ow,"--xy-background-color-props":l,"--xy-background-pattern-color-props":a},ref:c,"data-testid":"rf__background",children:[(0,y.jsx)("pattern",{id:M,x:h[0]%E[0],y:h[1]%E[1],width:E[0],height:E[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${S[0]},-${S[1]})`,children:g?(0,y.jsx)(iW,{radius:k/2,className:d}):(0,y.jsx)(iX,{dimensions:j,lineWidth:o,variant:t,className:d})}),(0,y.jsx)("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${M})`})]})}iU.displayName="Background";let iZ=(0,v.memo)(iU);function iG(){return(0,y.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:(0,y.jsx)("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function iQ(){return(0,y.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:(0,y.jsx)("path",{d:"M0 0h32v4.2H0z"})})}function iJ(){return(0,y.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:(0,y.jsx)("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function i0(){return(0,y.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:(0,y.jsx)("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function i1(){return(0,y.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:(0,y.jsx)("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function i2({children:e,className:t,...n}){return(0,y.jsx)("button",{type:"button",className:b(["react-flow__controls-button",t]),...n,children:e})}let i3=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function i5({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:o,onZoomIn:i,onZoomOut:a,onFitView:l,onInteractiveChange:s,className:u,children:d,position:c="bottom-left",orientation:h="vertical","aria-label":f}){let p=rT(),{isInteractive:g,minZoomReached:m,maxZoomReached:x,ariaLabelConfig:v}=rB(i3,rR),{zoomIn:w,zoomOut:E,fitView:k}=oy();return(0,y.jsxs)(rU,{className:b(["react-flow__controls","horizontal"===h?"horizontal":"vertical",u]),position:c,style:e,"data-testid":"rf__controls","aria-label":f??v["controls.ariaLabel"],children:[t&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(i2,{onClick:()=>{w(),i?.()},className:"react-flow__controls-zoomin",title:v["controls.zoomIn.ariaLabel"],"aria-label":v["controls.zoomIn.ariaLabel"],disabled:x,children:(0,y.jsx)(iG,{})}),(0,y.jsx)(i2,{onClick:()=>{E(),a?.()},className:"react-flow__controls-zoomout",title:v["controls.zoomOut.ariaLabel"],"aria-label":v["controls.zoomOut.ariaLabel"],disabled:m,children:(0,y.jsx)(iQ,{})})]}),n&&(0,y.jsx)(i2,{className:"react-flow__controls-fitview",onClick:()=>{k(o),l?.()},title:v["controls.fitView.ariaLabel"],"aria-label":v["controls.fitView.ariaLabel"],children:(0,y.jsx)(iJ,{})}),r&&(0,y.jsx)(i2,{className:"react-flow__controls-interactive",onClick:()=>{p.setState({nodesDraggable:!g,nodesConnectable:!g,elementsSelectable:!g}),s?.(!g)},title:v["controls.interactive.ariaLabel"],"aria-label":v["controls.interactive.ariaLabel"],children:g?(0,y.jsx)(i1,{}):(0,y.jsx)(i0,{})}),d]})}i5.displayName="Controls";let i4=(0,v.memo)(i5),i6=(0,v.memo)(function({id:e,x:t,y:n,width:r,height:o,style:i,color:a,strokeColor:l,strokeWidth:s,className:u,borderRadius:d,shapeRendering:c,selected:h,onClick:f}){let{background:p,backgroundColor:g}=i||{};return(0,y.jsx)("rect",{className:b(["react-flow__minimap-node",{selected:h},u]),x:t,y:n,rx:d,ry:d,width:r,height:o,style:{fill:a||p||g,stroke:l,strokeWidth:s},shapeRendering:c,onClick:f?t=>f(t,e):void 0})}),i8=e=>e.nodes.map(e=>e.id),i7=e=>e instanceof Function?e:()=>e,i9=(0,v.memo)(function({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:o,nodeStrokeWidth:i,shapeRendering:a,NodeComponent:l,onClick:s}){let{node:u,x:d,y:c,width:h,height:f}=rB(t=>{let n=t.nodeLookup.get(e);if(!n)return{node:void 0,x:0,y:0,width:0,height:0};let r=n.internals.userNode,{x:o,y:i}=n.internals.positionAbsolute,{width:a,height:l}=nR(r);return{node:r,x:o,y:i,width:a,height:l}},rR);return u&&!u.hidden&&nz(u)?(0,y.jsx)(l,{x:d,y:c,width:h,height:f,style:u.style,selected:!!u.selected,className:r(u),color:t(u),borderRadius:o,strokeColor:n(u),strokeWidth:i,shapeRendering:a,onClick:s,id:u.id}):null});var ae=(0,v.memo)(function({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o,nodeComponent:i=i6,onClick:a}){let l=rB(i8,rR),s=i7(t),u=i7(e),d=i7(n),c="u"<typeof window||window.chrome?"crispEdges":"geometricPrecision";return(0,y.jsx)(y.Fragment,{children:l.map(e=>(0,y.jsx)(i9,{id:e,nodeColorFunc:s,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:o,NodeComponent:i,onClick:a,shapeRendering:c},e))})});let at=e=>!e.hidden,an=e=>{let t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?nw(na(e.nodeLookup,{filter:at}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},ar=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,ao=(e,t)=>ar(e.viewBB,t.viewBB)&&ar(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig;function ai({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:o="",nodeBorderRadius:i=5,nodeStrokeWidth:a,nodeComponent:l,bgColor:s,maskColor:u,maskStrokeColor:d,maskStrokeWidth:c,position:h="bottom-right",onClick:f,onNodeClick:p,pannable:g=!1,zoomable:m=!1,ariaLabel:x,inversePan:w,zoomStep:E=1,offsetScale:k=5}){let _=rT(),j=(0,v.useRef)(null),{boundingRect:S,viewBB:M,rfId:N,panZoom:C,translateExtent:$,flowWidth:O,flowHeight:P,ariaLabelConfig:A}=rB(an,ao),R=e?.width??200,z=e?.height??150,L=Math.max(S.width/R,S.height/z),I=L*R,D=L*z,B=k*L,T=S.x-(I-S.width)/2-B,H=S.y-(D-S.height)/2-B,V=I+2*B,F=D+2*B,q=`react-flow__minimap-desc-${N}`,X=(0,v.useRef)(0),W=(0,v.useRef)();X.current=L,(0,v.useEffect)(()=>{if(j.current&&C)return W.current=function({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let o=eh(e);return{update:function({translateExtent:e,width:i,height:a,zoomStep:l=1,pannable:s=!0,zoomable:u=!0,inversePan:d=!1}){let c=[0,0],h=t4().on("start",e=>{("mousedown"===e.sourceEvent.type||"touchstart"===e.sourceEvent.type)&&(c=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on("zoom",s?o=>{let l=n();if("mousemove"!==o.sourceEvent.type&&"touchmove"!==o.sourceEvent.type||!t)return;let s=[o.sourceEvent.clientX??o.sourceEvent.touches[0].clientX,o.sourceEvent.clientY??o.sourceEvent.touches[0].clientY],u=[s[0]-c[0],s[1]-c[1]];c=s;let h=r()*Math.max(l[2],Math.log(l[2]))*(d?-1:1),f={x:l[0]-u[0]*h,y:l[1]-u[1]*h};t.setViewportConstrained({x:f.x,y:f.y,zoom:l[2]},[[0,0],[i,a]],e)}:null).on("zoom.wheel",u?e=>{if("wheel"!==e.sourceEvent.type||!t)return;let r=n(),o=e.sourceEvent.ctrlKey&&nP()?10:1,i=-e.sourceEvent.deltaY*(1===e.sourceEvent.deltaMode?.05:e.sourceEvent.deltaMode?1:.002)*l,a=r[2]*Math.pow(2,i*o);t.scaleTo(a)}:null);o.call(h,{})},destroy:function(){o.on("zoom",null)},pointer:ef}}({domNode:j.current,panZoom:C,getTransform:()=>_.getState().transform,getViewScale:()=>X.current}),()=>{W.current?.destroy()}},[C]),(0,v.useEffect)(()=>{W.current?.update({translateExtent:$,width:O,height:P,inversePan:w,pannable:g,zoomStep:E,zoomable:m})},[g,m,w,E,$,O,P]);let Y=f?e=>{let[t,n]=W.current?.pointer(e)||[0,0];f(e,{x:t,y:n})}:void 0,K=p?(0,v.useCallback)((e,t)=>{p(e,_.getState().nodeLookup.get(t).internals.userNode)},[]):void 0,U=x??A["minimap.ariaLabel"];return(0,y.jsx)(rU,{position:h,style:{...e,"--xy-minimap-background-color-props":"string"==typeof s?s:void 0,"--xy-minimap-mask-background-color-props":"string"==typeof u?u:void 0,"--xy-minimap-mask-stroke-color-props":"string"==typeof d?d:void 0,"--xy-minimap-mask-stroke-width-props":"number"==typeof c?c*L:void 0,"--xy-minimap-node-background-color-props":"string"==typeof r?r:void 0,"--xy-minimap-node-stroke-color-props":"string"==typeof n?n:void 0,"--xy-minimap-node-stroke-width-props":"number"==typeof a?a:void 0},className:b(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:(0,y.jsxs)("svg",{width:R,height:z,viewBox:`${T} ${H} ${V} ${F}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":q,ref:j,onClick:Y,children:[U&&(0,y.jsx)("title",{id:q,children:U}),(0,y.jsx)(ae,{onClick:K,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:o,nodeStrokeWidth:a,nodeComponent:l}),(0,y.jsx)("path",{className:"react-flow__minimap-mask",d:`M${T-B},${H-B}h${V+2*B}v${F+2*B}h${-V-2*B}z
2
- M${M.x},${M.y}h${M.width}v${M.height}h${-M.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}ai.displayName="MiniMap",(0,v.memo)(ai);let aa={[m.Line]:"right",[m.Handle]:"bottom-right"};(0,v.memo)(function({nodeId:e,position:t,variant:n=m.Handle,className:r,style:o,children:i,color:a,minWidth:l=10,minHeight:s=10,maxWidth:u=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:c=!1,resizeDirection:h,autoScale:f=!0,shouldResize:p,onResizeStart:g,onResize:x,onResizeEnd:w}){let E,k=oR(),_="string"==typeof e?e:k,j=rT(),S=(0,v.useRef)(null),M=n===m.Handle,N=rB((0,v.useCallback)((E=M&&f,e=>E?`${Math.max(1/e.transform[2],1)}`:void 0),[M,f]),rR),C=(0,v.useRef)(null),$=t??aa[n];(0,v.useEffect)(()=>{if(S.current&&_)return C.current||(C.current=function({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){let i=eh(e),a={controlDirection:rw("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};return{update:function({controlPosition:e,boundaries:l,keepAspectRatio:s,resizeDirection:u,onResizeStart:d,onResize:c,onResizeEnd:h,shouldResize:f}){let p,g,m,x,y={...rj},v={...rS};a={boundaries:l,resizeDirection:u,keepAspectRatio:s,controlDirection:rw(e)};let b=null,w=[],E=!1,k=eS().on("start",e=>{let{nodeLookup:r,transform:o,snapGrid:i,snapToGrid:a,nodeOrigin:l,paneDomNode:s}=n();if(!(p=r.get(t)))return;b=s?.getBoundingClientRect()??null;let{xSnapped:u,ySnapped:c}=nD(e.sourceEvent,{transform:o,snapGrid:i,snapToGrid:a,containerBounds:b});for(let[e,n]of(v={...y={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},pointerX:u,pointerY:c,aspectRatio:y.width/y.height},g=void 0,m=nA(p.extent)?p.extent:void 0,p.parentId&&("parent"===p.extent||p.expandParent)&&(g=r.get(p.parentId)),g&&"parent"===p.extent&&(m=[[0,0],[g.measured.width,g.measured.height]]),w=[],x=void 0,r))if(n.parentId===t&&(w.push({id:e,position:{...n.position},extent:n.extent}),"parent"===n.extent||n.expandParent)){let e=function(e,t,n){let r=t.position.x+e.position.x,o=t.position.y+e.position.y,i=e.measured.width??0,a=e.measured.height??0,l=n[0]*i,s=n[1]*a;return[[r-l,o-s],[r+i-l,o+a-s]]}(n,p,n.origin??l);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}d?.(e,{...y})}).on("drag",e=>{let{transform:t,snapGrid:o,snapToGrid:i,nodeOrigin:l}=n(),s=nD(e.sourceEvent,{transform:t,snapGrid:o,snapToGrid:i,containerBounds:b}),u=[];if(!p)return;let{x:d,y:h,width:k,height:_}=y,j={},S=p.origin??l,{width:M,height:N,x:C,y:$}=function(e,t,n,r,o,i,a,l){var s,u,d,c;let{affectsX:h,affectsY:f}=t,{isHorizontal:p,isVertical:g}=t,m=p&&g,{xSnapped:x,ySnapped:y}=n,{minWidth:v,maxWidth:b,minHeight:w,maxHeight:E}=r,{x:k,y:_,width:j,height:S,aspectRatio:M}=e,N=Math.floor(p?x-e.pointerX:0),C=Math.floor(g?y-e.pointerY:0),$=j+(h?-N:N),O=S+(f?-C:C),P=-i[0]*j,A=-i[1]*S,R=r_($,v,b),z=r_(O,w,E);if(a){let e=0,t=0;h&&N<0?e=rE(k+N+P,a[0][0]):!h&&N>0&&(e=rk(k+$+P,a[1][0])),f&&C<0?t=rE(_+C+A,a[0][1]):!f&&C>0&&(t=rk(_+O+A,a[1][1])),R=Math.max(R,e),z=Math.max(z,t)}if(l){let e=0,t=0;h&&N>0?e=rk(k+N,l[0][0]):!h&&N<0&&(e=rE(k+$,l[1][0])),f&&C>0?t=rk(_+C,l[0][1]):!f&&C<0&&(t=rE(_+O,l[1][1])),R=Math.max(R,e),z=Math.max(z,t)}if(o){if(p){(R=Math.max(R,r_($/M,w,E)*M),a)&&(R=Math.max(R,(h||f)&&(!h||f||!m)?rE(_+A+(h?N:-N)/M,a[0][1])*M:rk(_+A+$/M,a[1][1])*M));l&&(R=Math.max(R,(h||f)&&(!h||f||!m)?rk(_+(h?N:-N)/M,l[0][1])*M:rE(_+$/M,l[1][1])*M))}if(g){(z=Math.max(z,r_(O*M,v,b)/M),a)&&(z=Math.max(z,(h||f)&&(!f||h||!m)?rE(k+(f?C:-C)*M+P,a[0][0])/M:rk(k+O*M+P,a[1][0])/M));l&&(z=Math.max(z,(h||f)&&(!f||h||!m)?rk(k+(f?C:-C)*M,l[0][0])/M:rE(k+O*M,l[1][0])/M))}}C+=C<0?z:-z,N+=N<0?R:-R,o&&(m?$>O*M?C=((s=h,u=f,s?!u:u)?-N:N)/M:N=((d=h,c=f,d?!c:c)?-C:C)*M:p?(C=N/M,f=h):(N=C*M,h=f));let L=h?k+N:k,I=f?_+C:_;return{width:j+(h?-N:N),height:S+(f?-C:C),x:i[0]*N*(h?-1:1)+L,y:i[1]*C*(f?-1:1)+I}}(v,a.controlDirection,s,a.boundaries,a.keepAspectRatio,S,m,x),O=M!==k,P=N!==_,A=C!==d&&O,R=$!==h&&P;if(!A&&!R&&!O&&!P)return;if((A||R||1===S[0]||1===S[1])&&(j.x=A?C:y.x,j.y=R?$:y.y,y.x=j.x,y.y=j.y,w.length>0)){let e=C-d,t=$-h;for(let n of w)n.position={x:n.position.x-e+S[0]*(M-k),y:n.position.y-t+S[1]*(N-_)},u.push(n)}if((O||P)&&(j.width=O&&(!a.resizeDirection||"horizontal"===a.resizeDirection)?M:y.width,j.height=P&&(!a.resizeDirection||"vertical"===a.resizeDirection)?N:y.height,y.width=j.width,y.height=j.height),g&&p.expandParent){let e=S[0]*(j.width??0);j.x&&j.x<e&&(y.x=e,v.x=v.x-(j.x-e));let t=S[1]*(j.height??0);j.y&&j.y<t&&(y.y=t,v.y=v.y-(j.y-t))}let z=function({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:o,affectsY:i}){let a=e-t,l=n-r,s=[a>0?1:a<0?-1:0,l>0?1:l<0?-1:0];return a&&o&&(s[0]=-1*s[0]),l&&i&&(s[1]=-1*s[1]),s}({width:y.width,prevWidth:k,height:y.height,prevHeight:_,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),L={...y,direction:z};!1!==f?.(e,L)&&(E=!0,c?.(e,L),r(j,u))}).on("end",e=>{E&&(h?.(e,{...y}),o?.({...y}),E=!1)});i.call(k)},destroy:function(){i.on(".drag",null)}}}({domNode:S.current,nodeId:_,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:o,domNode:i}=j.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:o,paneDomNode:i}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:o,nodeOrigin:i}=j.getState(),a=[],l={x:e.x,y:e.y},s=r.get(_);if(s&&s.expandParent&&s.parentId){let t=s.origin??i,n=e.width??s.measured.width??0,u=e.height??s.measured.height??0,d=rr([{id:s.id,parentId:s.parentId,rect:{width:n,height:u,...nL({x:e.x??s.position.x,y:e.y??s.position.y},{width:n,height:u},s.parentId,r,t)}}],r,o,i);a.push(...d),l.x=e.x?Math.max(t[0]*n,e.x):void 0,l.y=e.y?Math.max(t[1]*u,e.y):void 0}if(void 0!==l.x&&void 0!==l.y){let e={id:_,type:"position",position:{...l}};a.push(e)}if(void 0!==e.width&&void 0!==e.height){let t={id:_,type:"dimensions",resizing:!0,setAttributes:!h||("horizontal"===h?"width":"height"),dimensions:{width:e.width,height:e.height}};a.push(t)}for(let e of t){let t={...e,type:"position"};a.push(t)}n(a)},onEnd:({width:e,height:t})=>{j.getState().triggerNodeChanges([{id:_,type:"dimensions",resizing:!1,dimensions:{width:e,height:t}}])}})),C.current.update({controlPosition:$,boundaries:{minWidth:l,minHeight:s,maxWidth:u,maxHeight:d},keepAspectRatio:c,resizeDirection:h,onResizeStart:g,onResize:x,onResizeEnd:w,shouldResize:p}),()=>{C.current?.destroy()}},[$,l,s,u,d,c,g,x,w,p]);let O=$.split("-");return(0,y.jsx)("div",{className:b(["react-flow__resize-control","nodrag",...O,n,r]),ref:S,style:{...o,scale:N,...a&&{[M?"backgroundColor":"borderColor"]:a}},children:i})});var al={outline:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},filled:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",stroke:"none"}};let as=(e,t,n,r)=>{let o=(0,v.forwardRef)(({color:n="currentColor",size:o=24,stroke:i=2,title:a,className:l,children:s,...u},d)=>(0,v.createElement)("svg",{ref:d,...al[e],width:o,height:o,className:["tabler-icon",`tabler-icon-${t}`,l].filter(Boolean).join(" "),..."filled"===e?{fill:n}:{strokeWidth:i,stroke:n},...u},[a&&(0,v.createElement)("title",{key:"svg-title"},a),...r.map(([e,t])=>(0,v.createElement)(e,t)),...Array.isArray(s)?s:[s]]));return o.displayName=`${n}`,o},au=as("outline","chevron-left","ChevronLeft",[["path",{d:"M15 6l-6 6l6 6",key:"svg-0"}]]),ad=as("outline","chevron-right","ChevronRight",[["path",{d:"M9 6l6 6l-6 6",key:"svg-0"}]]);class ac extends Error{status;code;constructor(e,t,n){super(n),this.status=e,this.code=t,this.name="ApiError"}}async function ah(e){let t=await e.json().catch(()=>null);return new ac(e.status,t?.error.code??"INTERNAL",t?.error.message??`HTTP ${e.status}`)}async function af(e,t){try{return await fetch(e,t)}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)throw e;throw new ac(0,"NETWORK","The Nebulosity server didn't answer. Is nebulosity map (or npm run dev) still running?")}}async function ap(e,t){let n=await af(e,t);if(!n.ok)throw await ah(n);return await n.json()}async function ag(e,t){let n=e.getReader(),r=new TextDecoder,o="";for(;;){let{value:e,done:i}=await n.read();if(i)return;let a=function(e){let t=e.replace(/\r\n/g,"\n").split("\n\n"),n=t.pop()??"",r=[];for(let e of t){let t="message",n=[];for(let r of e.split("\n"))!r.startsWith(":")&&(r.startsWith("event:")?t=r.slice(6).trim():r.startsWith("data:")&&n.push(r.slice(5).replace(/^ /,"")));n.length>0&&r.push({event:t,data:n.join("\n")})}return{frames:r,rest:n}}(o+=r.decode(e,{stream:!0}));for(let e of(o=a.rest,a.frames))t(e)}}let am={level:(e,t=0,n,r)=>ap(((e,t=0,n)=>`/api/level?path=${encodeURIComponent(e)}${t>0?`&page=${t}`:""}${void 0!==n?`&focus=${encodeURIComponent(n)}`:""}`)(e,t,r),{signal:n}),describe:(e,t)=>ap(`/api/describe?path=${encodeURIComponent(e)}`,{signal:t}),search:(e,t,n)=>ap(`/api/search?q=${encodeURIComponent(e)}&limit=${t}`,{signal:n}),status:e=>ap("/api/status",{signal:e}),source:(e,t)=>ap(`/api/source?path=${encodeURIComponent(e)}`,{signal:t}),summarize:e=>ap(`/api/summarize?path=${encodeURIComponent(e)}`,{method:"POST"}),repos:()=>ap("/api/repos"),setActiveRepo:e=>ap("/api/repos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({root:e})}),async reindex(e){let t=await af("/api/index",{method:"POST"});if(!t.ok||!t.body)throw await ah(t);let n={done:null,error:null};if(await ag(t.body,t=>{"progress"===t.event?e(JSON.parse(t.data)):"done"===t.event?n.done=JSON.parse(t.data):"error"===t.event&&(n.error=JSON.parse(t.data))}),n.error)throw new ac(500,n.error.code,n.error.message);if(!n.done)throw new ac(500,"INTERNAL","The re-index ended without a result.");return n.done}},ax=as("outline","arrow-left","ArrowLeft",[["path",{d:"M5 12l14 0",key:"svg-0"}],["path",{d:"M5 12l6 6",key:"svg-1"}],["path",{d:"M5 12l6 -6",key:"svg-2"}]]);function ay({enabled:e}){return(0,y.jsx)("button",{type:"button","data-testid":"back",disabled:!e,onClick:()=>window.history.back(),"aria-label":"Back",title:e?"Back to where you were":"Back (nothing to go back to yet)",className:"grid h-7 w-7 shrink-0 place-items-center rounded-md text-control hover:bg-surface disabled:opacity-35 disabled:hover:bg-transparent",children:(0,y.jsx)(ax,{"aria-hidden":!0,size:18,stroke:2})})}var av=Object.defineProperty,ab={},aw={Graph:()=>aQ,alg:()=>aP};for(var aE in aw)av(ab,aE,{get:aw[aE],enumerable:!0});var ak=Object.defineProperty,a_=(e,t)=>{for(var n in t)ak(e,n,{get:t[n],enumerable:!0})},aj=class{constructor(e){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},e&&(this._isDirected=!("directed"in e)||e.directed,this._isMultigraph="multigraph"in e&&e.multigraph,this._isCompound="compound"in e&&e.compound),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return"function"!=typeof e?this._defaultNodeLabelFn=()=>e:this._defaultNodeLabelFn=e,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(e=>0===Object.keys(this._in[e]).length)}sinks(){return this.nodes().filter(e=>0===Object.keys(this._out[e]).length)}setNodes(e,t){return e.forEach(e=>{void 0!==t?this.setNode(e,t):this.setNode(e)}),this}setNode(e,t){return e in this._nodes?arguments.length>1&&(this._nodes[e]=t):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]="\0",this._children[e]={},this._children["\0"][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount),this}node(e){return this._nodes[e]}hasNode(e){return e in this._nodes}removeNode(e){if(e in this._nodes){let t=e=>this.removeEdge(this._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(e=>{this.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(t),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error("Cannot set parent in a non-compound graph");if(void 0===t)t="\0";else{t+="";for(let n=t;void 0!==n;n=this.parent(n))if(n===e)throw Error("Setting "+t+" as parent of "+e+" would create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}parent(e){if(this._isCompound){let t=this._parent[e];if("\0"!==t)return t}}children(e="\0"){if(this._isCompound){let t=this._children[e];if(t)return Object.keys(t)}else{if("\0"===e)return this.nodes();this.hasNode(e)}return[]}predecessors(e){let t=this._preds[e];if(t)return Object.keys(t)}successors(e){let t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){let t=this.predecessors(e);if(t){let n=new Set(t),r=this.successors(e);if(r)for(let e of r)n.add(e);return Array.from(n.values())}}isLeaf(e){var t;let n;return(null!=(t=null==(n=this.isDirected()?this.successors(e):this.neighbors(e))?void 0:n.length)?t:0)===0}filterNodes(e){let t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph()),Object.entries(this._nodes).forEach(([n,r])=>{e(n)&&t.setNode(n,r)}),Object.values(this._edgeObjs).forEach(e=>{t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,this.edge(e))});let n={},r=e=>{let o=this.parent(e);return!o||t.hasNode(o)?(n[e]=o,o):o in n?n[o]:r(o)};return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,r(e))),t}setDefaultEdgeLabel(e){return"function"!=typeof e?this._defaultEdgeLabelFn=()=>e:this._defaultEdgeLabelFn=e,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){return e.reduce((e,n)=>(void 0!==t?this.setEdge(e,n,t):this.setEdge(e,n),n)),this}setEdge(e,t,n,r){let o,i,a,l,s=!1;"object"==typeof e&&null!==e&&"v"in e?(o=e.v,i=e.w,a=e.name,2==arguments.length&&(l=t,s=!0)):(o=e,i=t,a=r,arguments.length>2&&(l=n,s=!0)),o=""+o,i=""+i,void 0!==a&&(a=""+a);let u=aN(this._isDirected,o,i,a);if(u in this._edgeLabels)return s&&(this._edgeLabels[u]=l),this;if(void 0!==a&&!this._isMultigraph)throw Error("Cannot set a named edge when isMultigraph = false");this.setNode(o),this.setNode(i),this._edgeLabels[u]=s?l:this._defaultEdgeLabelFn(o,i,a);let d=function(e,t,n,r){let o=""+t,i=""+n;if(!e&&o>i){let e=o;o=i,i=e}let a={v:o,w:i};return r&&(a.name=r),a}(this._isDirected,o,i,a);return o=d.v,i=d.w,Object.freeze(d),this._edgeObjs[u]=d,aS(this._preds[i],o),aS(this._sucs[o],i),this._in[i][u]=d,this._out[o][u]=d,this._edgeCount++,this}edge(e,t,n){let r=1==arguments.length?aC(this._isDirected,e):aN(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(e,t,n){let r=1==arguments.length?this.edge(e):this.edge(e,t,n);return"object"!=typeof r||null===r?{label:r}:r}hasEdge(e,t,n){return(1==arguments.length?aC(this._isDirected,e):aN(this._isDirected,e,t,n))in this._edgeLabels}removeEdge(e,t,n){let r=1==arguments.length?aC(this._isDirected,e):aN(this._isDirected,e,t,n),o=this._edgeObjs[r];if(o){let e=o.v,t=o.w;delete this._edgeLabels[r],delete this._edgeObjs[r],aM(this._preds[t],e),aM(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--}return this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}filterEdges(e,t,n){if(!e)return;let r=Object.values(e);return n?r.filter(e=>e.v===t&&e.w===n||e.v===n&&e.w===t):r}};function aS(e,t){e[t]?e[t]++:e[t]=1}function aM(e,t){void 0===e[t]||--e[t]||delete e[t]}function aN(e,t,n,r){let o=""+t,i=""+n;if(!e&&o>i){let e=o;o=i,i=e}return o+"\x01"+i+"\x01"+(void 0===r?"\0":r)}function aC(e,t){return aN(e,t.v,t.w,t.name)}function a$(e){var t,n;let r={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:(t=e).nodes().map(e=>{let n=t.node(e),r=t.parent(e),o={v:e};return void 0!==n&&(o.value=n),void 0!==r&&(o.parent=r),o}),edges:(n=e).edges().map(e=>{let t=n.edge(e),r={v:e.v,w:e.w};return void 0!==e.name&&(r.name=e.name),void 0!==t&&(r.value=t),r})},o=e.graph();return void 0!==o&&(r.value=structuredClone(o)),r}function aO(e){let t=new aj(e.options);return void 0!==e.value&&t.setGraph(e.value),e.nodes.forEach(e=>{t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(e=>{t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}a_({},{read:()=>aO,write:()=>a$});var aP={};a_(aP,{CycleException:()=>aq,bellmanFord:()=>aR,components:()=>az,dijkstra:()=>aD,dijkstraAll:()=>aB,findCycles:()=>aH,floydWarshall:()=>aF,isAcyclic:()=>aW,postorder:()=>aK,preorder:()=>aU,prim:()=>aZ,shortestPaths:()=>aG,tarjan:()=>aT,topsort:()=>aX});var aA=()=>1;function aR(e,t,n,r){return function(e,t,n,r){let o={},i,a=0,l=e.nodes(),s=function(e){let t=o[e.v],r=o[e.w];if(!t||!r)return;let a=n(e);t.distance+a<r.distance&&(o[e.w]={distance:t.distance+a,predecessor:e.v},i=!0)},u=function(){l.forEach(function(e){r(e).forEach(function(t){let n=t.v===e?t.v:t.w,r=n===t.v?t.w:t.v;s({v:n,w:r})})})};l.forEach(function(e){o[e]={distance:e===t?0:1/0,predecessor:""}});let d=l.length;for(let e=1;e<d&&(i=!1,a++,u(),i);e++);if(a===d-1&&(i=!1,u(),i))throw Error("The graph contains a negative weight cycle");return o}(e,String(t),n||aA,r||function(t){var n;return null!=(n=e.outEdges(t))?n:[]})}function az(e){let t={},n=[],r;return e.nodes().forEach(function(o){r=[],function n(o){var i,a;o in t||(t[o]=!0,r.push(o),null==(i=e.successors(o))||i.forEach(n),null==(a=e.predecessors(o))||a.forEach(n))}(o),r.length&&n.push(r)}),n}var aL=class{constructor(){this._arr=[],this._keyIndices={}}size(){return this._arr.length}keys(){return this._arr.map(e=>e.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(void 0!==t)return this._arr[t].priority}min(){if(0===this.size())throw Error("Queue underflow");return this._arr[0].key}add(e,t){let n=this._keyIndices,r=String(e);if(!(r in n)){let e=this._arr,o=e.length;return n[r]=o,e.push({key:r,priority:t}),this._decrease(o),!0}return!1}removeMin(){if(0===this.size())throw Error("Queue underflow");this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(void 0===n)throw Error(`Key not found: ${e}`);let r=this._arr[n].priority;if(t>r)throw Error(`New priority is greater than current priority. Key: ${e} Old: ${r} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,r=n+1,o=e;n<t.length&&(o=t[n].priority<t[o].priority?n:o,r<t.length&&(o=t[r].priority<t[o].priority?r:o),o!==e&&(this._swap(e,o),this._heapify(o)))}_decrease(e){let t=this._arr,n=t[e].priority,r;for(;0!==e&&!(t[r=e>>1].priority<n);)this._swap(e,r),e=r}_swap(e,t){let n=this._arr,r=this._keyIndices,o=n[e],i=n[t];n[e]=i,n[t]=o,r[i.key]=e,r[o.key]=t}},aI=()=>1;function aD(e,t,n,r){return function(e,t,n,r){let o={},i=new aL,a,l,s=function(e){let t=e.v!==a?e.v:e.w,r=o[t];if(!r)return;let s=n(e),u=l.distance+s;if(s<0)throw Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+s);u<r.distance&&(r.distance=u,r.predecessor=a,i.decrease(t,u))};for(e.nodes().forEach(function(e){let n=e===t?0:1/0;o[e]={distance:n,predecessor:""},i.add(e,n)});i.size()>0;){let e=o[a=i.removeMin()];if(!e||1/0===e.distance)break;l=e,r(a).forEach(s)}return o}(e,String(t),n||aI,r||function(t){var n;return null!=(n=e.outEdges(t))?n:[]})}function aB(e,t,n){return e.nodes().reduce(function(r,o){return r[o]=aD(e,o,t,n),r},{})}function aT(e){let t=0,n=[],r={},o=[];return e.nodes().forEach(function(i){i in r||function i(a){var l;let s=r[a]={onStack:!0,lowlink:t,index:t++};if(n.push(a),null==(l=e.successors(a))||l.forEach(function(e){if(e in r){let t=r[e];null!=t&&t.onStack&&(s.lowlink=Math.min(s.lowlink,t.index))}else{i(e);let t=r[e];t&&(s.lowlink=Math.min(s.lowlink,t.lowlink))}}),s.lowlink===s.index){let e=[],t;do{let o=r[t=n.pop()];o&&(o.onStack=!1),e.push(t)}while(a!==t)o.push(e)}}(i)}),o}function aH(e){return aT(e).filter(function(t){var n;let r=t[0];return!!r&&(t.length>1||1===t.length&&(null!=(n=e.outEdges(r,r))?n:[]).length>0)})}var aV=()=>1;function aF(e,t,n){var r,o,i;let a,l;return r=e,o=t||aV,i=n||function(t){var n;return null!=(n=e.outEdges(t))?n:[]},a={},(l=r.nodes()).forEach(function(e){let t={};a[e]=t,t[e]={distance:0,predecessor:""},l.forEach(function(n){e!==n&&(t[n]={distance:1/0,predecessor:""})}),i(e).forEach(function(n){let r=n.v===e?n.w:n.v,i=o(n);t[r]={distance:i,predecessor:e}})}),l.forEach(function(e){let t=a[e];t&&l.forEach(function(n){let r=a[n];r&&l.forEach(function(n){let o=r[e],i=t[n],a=r[n];if(o&&i&&a){let e=o.distance+i.distance;e<a.distance&&(a.distance=e,a.predecessor=i.predecessor)}})})}),a}var aq=class extends Error{constructor(e){super(e),this.name="CycleException"}};function aX(e){let t={},n={},r=[];if(e.sinks().forEach(function o(i){var a;if(i in n)throw new aq;i in t||(n[i]=!0,t[i]=!0,null==(a=e.predecessors(i))||a.forEach(o),delete n[i],r.push(i))}),Object.keys(t).length!==e.nodeCount())throw new aq;return r}function aW(e){try{aX(e)}catch(e){if(e instanceof aq)return!1;throw e}return!0}function aY(e,t,n){var r,o,i;let a,l;return r=t,o=function(e,t){return e.push(t),e},i=[],Array.isArray(r)||(r=[r]),a=t=>{var n;return null!=(n=e.isDirected()?e.successors(t):e.neighbors(t))?n:[]},l={},r.forEach(function(t){if(!e.hasNode(t))throw Error("Graph does not have node: "+t);i=function e(t,n,r,o,i,a,l){return n in o||(o[n]=!0,r||(l=a(l,n)),i(n).forEach(function(n){l=e(t,n,r,o,i,a,l)}),r&&(l=a(l,n))),l}(e,t,"post"===n,l,a,o,i)}),i}function aK(e,t){return aY(e,t,"post")}function aU(e,t){return aY(e,t,"pre")}function aZ(e,t){var n;let r=new aj,o={},i=new aL,a;function l(e){let n=e.v===a?e.w:e.v,r=i.priority(n);if(void 0!==r){let l=t(e);l<r&&(o[n]=a,i.decrease(n,l))}}if(0===e.nodeCount())return r;e.nodes().forEach(function(e){i.add(e,1/0),r.setNode(e)});let s=e.nodes()[0];void 0!==s&&i.decrease(s,0);let u=!1;for(;i.size()>0;){if((a=i.removeMin())in o)r.setEdge(a,o[a]);else{if(u)throw Error("Input graph is not connected: "+e);u=!0}null==(n=e.nodeEdges(a))||n.forEach(l)}return r}function aG(e,t,n,r){return function(e,t,n,r){if(void 0===n)return aD(e,t,n,r);let o=!1,i=e.nodes();for(let a=0;a<i.length;a++){let l=i[a];if(void 0===l)continue;let s=r(l);for(let e=0;e<s.length;e++){let t=s[e];if(!t)continue;let r=t.v===l?t.v:t.w,i=r===t.v?t.w:t.v;0>n({v:r,w:i})&&(o=!0)}if(o)return aR(e,t,n,r)}return aD(e,t,n,r)}(e,t,n,null!=r?r:t=>{var n;return null!=(n=e.outEdges(t))?n:[]})}var aQ=aj;function aJ(e,t,n,r){let o=r;for(;e.hasNode(o);)o=r+""+ ++a8;return n.dummy=t,e.setNode(o,n),o}function a0(e){let t=new aQ({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function a1(e,t){let n,r,o=e.x,i=e.y,a=t.x-o,l=t.y-i,s=e.width/2,u=e.height/2;if(!a&&!l)throw Error("Not possible to find intersection inside of the rectangle");return Math.abs(l)*s>Math.abs(a)*u?(l<0&&(u=-u),n=u*a/l,r=u):(a<0&&(s=-s),n=s,r=s*l/a),{x:o+n,y:i+r}}function a2(e){let t=a7(a4(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),o=r.rank;void 0!==o&&(t[o]||(t[o]=[]),t[o][r.order]=n)}),t}function a3(e,t,n,r){let o={width:0,height:0};return arguments.length>=4&&(o.rank=n,o.order=r),aJ(e,"border",o,t)}function a5(e,t){return t.length>65535?e(...(function(e,t=65535){let n=[];for(let r=0;r<e.length;r+=t){let o=e.slice(r,r+t);n.push(o)}return n})(t).map(t=>e(...t))):e(...t)}function a4(e){return a5(Math.max,e.nodes().map(t=>{let n=e.node(t).rank;return void 0===n?5e-324:n}))}function a6(e,t){return t()}var a8=0;function a7(e,t,n=1){null==t&&(t=e,e=0);let r=e=>e<t;n<0&&(r=e=>t<e);let o=[];for(let t=e;r(t);t+=n)o.push(t);return o}function a9(e,t){let n={};for(let r of t)void 0!==e[r]&&(n[r]=e[r]);return n}function le(e,t){let n;return n="string"==typeof t?e=>e[t]:t,Object.entries(e).reduce((e,[t,r])=>(e[t]=n(r,t),e),{})}function lt(e,t,n){var r,o,i,a,l,s;if(!(e&&t&&n&&"edge"===t.dummy&&"edge"===n.dummy&&t.edgeObj&&n.edgeObj&&e[t.edgeObj.v]&&e[n.edgeObj.v]&&e[t.edgeObj.w]&&e[n.edgeObj.w]))return 0;let u=!0;t.edgeObj.w===n.edgeObj.w&&(u=!1);let d=u?null!=(o=null==(r=e[t.edgeObj.v])?void 0:r.rank)?o:0/0:null!=(a=null==(i=e[t.edgeObj.w])?void 0:i.rank)?a:0/0,c=Object.entries(e).find(e=>{var n,r;return(null==(n=e[1].edgeObj)?void 0:n.v)===t.edgeObj.v&&(null==(r=e[1].edgeObj)?void 0:r.w)===t.edgeObj.w&&e[1].rank===d}),h=Object.entries(e).find(e=>{var t,r;return(null==(t=e[1].edgeObj)?void 0:t.v)===n.edgeObj.v&&(null==(r=e[1].edgeObj)?void 0:r.w)===n.edgeObj.w&&e[1].rank===d});if(!c||!h)return 0;let f=null!=(l=c[1].order)?l:0/0,p=null!=(s=h[1].order)?s:0/0;return isNaN(f-p)?0:f-p}var ln=class{constructor(){var e;let t,n;n=void 0,(t="symbol"!=typeof(e="_sentinel")?e+"":e)in this?av(this,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):this[t]=n;let r={};r._next=r._prev=r,this._sentinel=r}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return lr(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&lr(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,lo)),n=n._prev;return"["+e.join(", ")+"]"}};function lr(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function lo(e,t){if("_next"!==e&&"_prev"!==e)return t}var li=()=>1;function la(e,t,n,r,o){let i=[],a=o?i:void 0;return(e.inEdges(r.v)||[]).forEach(r=>{let a=e.edge(r),l=e.node(r.v);o&&i.push({v:r.v,w:r.w}),l.out-=a,ll(t,n,l)}),(e.outEdges(r.v)||[]).forEach(r=>{let o=e.edge(r),i=r.w,a=e.node(i);a.in-=o,ll(t,n,a)}),e.removeNode(r.v),a}function ll(e,t,n){var r,o,i;n.out?n.in?null==(i=e[n.out-n.in+t])||i.enqueue(n):null==(o=e[e.length-1])||o.enqueue(n):null==(r=e[0])||r.enqueue(n)}function ls(e){let t={};e.sources().forEach(function n(r){let o=e.node(r);if(Object.hasOwn(t,r))return o.rank;t[r]=!0;let i=e.outEdges(r),a=a5(Math.min,i?i.map(t=>null==t?1/0:n(t.w)-e.edge(t).minlen):[]);return 1/0===a&&(a=0),o.rank=a})}function lu(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var ld=function(e){let t,n,r=new aQ({directed:!1}),o=e.nodes();if(0===o.length)throw Error("Graph must have at least one node");let i=o[0],a=e.nodeCount();for(r.setNode(i,{});function(e,t){return e.nodes().forEach(function n(r){let o=t.nodeEdges(r);o&&o.forEach(o=>{let i=o.v,a=r===i?o.w:i;e.hasNode(a)||lu(t,o)||(e.setNode(a,{}),e.setEdge(r,a,{}),n(a))})}),e.nodeCount()}(r,e)<a&&(t=function(e,t){return t.edges().reduce((n,r)=>{let o=1/0;return e.hasNode(r.v)!==e.hasNode(r.w)&&(o=lu(t,r)),o<n[0]?[o,r]:n},[1/0,null])[1]}(r,e));)n=r.hasNode(t.v)?lu(e,t):-lu(e,t),function(e,t,n){e.nodes().forEach(e=>t.node(e).rank+=n)}(r,e,n);return r},{preorder:lc,postorder:lh}=aP;function lf(e){var t;let n,r,o;t=e,o=new aQ().setGraph(t.graph()),t.nodes().forEach(e=>o.setNode(e,t.node(e))),t.edges().forEach(e=>{let n=o.edge(e.v,e.w)||{weight:0,minlen:1},r=t.edge(e);o.setEdge(e.v,e.w,{weight:n.weight+r.weight,minlen:Math.max(n.minlen,r.minlen)})}),ls(e=o);let i=ld(e);for(lm(i),lp(i,e);n=lx(i);)r=ly(i,e,n),lv(i,e,n,r)}function lp(e,t){let n=lh(e,e.nodes());(n=n.slice(0,n.length-1)).forEach(n=>{var r,o,i;let a;return r=e,o=t,i=n,a=r.node(i).parent,void(r.edge(i,a).cutvalue=lg(r,o,i))})}function lg(e,t,n){let r=e.node(n).parent,o=!0,i=t.edge(n,r),a=0;i||(o=!1,i=t.edge(r,n)),a=i.weight;let l=t.nodeEdges(n);return l&&l.forEach(i=>{let l=i.v===n,s=l?i.w:i.v;if(s!==r){var u,d,c;let r=l===o,h=t.edge(i).weight;if(a+=r?h:-h,u=e,d=n,c=s,u.hasEdge(d,c)){let t=e.edge(n,s).cutvalue;a+=r?-t:t}}}),a}function lm(e,t){arguments.length<2&&(t=e.nodes()[0]),function e(t,n,r,o,i){let a=r,l=t.node(o);n[o]=!0;let s=t.neighbors(o);return s&&s.forEach(i=>{Object.hasOwn(n,i)||(r=e(t,n,r,i,o))}),l.low=a,l.lim=r++,i?l.parent=i:delete l.parent,r}(e,{},1,t)}function lx(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function ly(e,t,n){let r=n.v,o=n.w;t.hasEdge(r,o)||(r=n.w,o=n.v);let i=e.node(r),a=e.node(o),l=i,s=!1;return i.lim>a.lim&&(l=a,s=!0),t.edges().filter(t=>s===lb(e,e.node(t.v),l)&&s!==lb(e,e.node(t.w),l)).reduce((e,n)=>lu(t,n)<lu(t,e)?n:e)}function lv(e,t,n,r){let o=n.v,i=n.w;e.removeEdge(o,i),e.setEdge(r.v,r.w,{}),lm(e),lp(e,t),function(e,t){let n=e.nodes().find(t=>!e.node(t).parent);if(!n)return;let r=lc(e,[n]);(r=r.slice(1)).forEach(n=>{let r=e.node(n).parent,o=t.edge(n,r),i=!1;o||(o=t.edge(r,n),i=!0),t.node(n).rank=t.node(r).rank+(i?o.minlen:-o.minlen)})}(e,t)}function lb(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}lf.initLowLimValues=lm,lf.initCutValues=lp,lf.calcCutValue=lg,lf.leaveEdge=lx,lf.enterEdge=ly,lf.exchangeEdges=lv;function lw(e,t,n,r,o,i){let a=o[t][i-1],l=aJ(e,"border",{width:0,height:0,rank:i,borderType:t},n);o[t][i]=l,e.setParent(l,r),a&&e.setEdge(a,l,{weight:1})}function lE(e){e.nodes().forEach(t=>lk(e.node(t))),e.edges().forEach(t=>lk(e.edge(t)))}function lk(e){let t=e.width;e.width=e.height,e.height=t}function l_(e){e.y=-e.y}function lj(e){let t=e.x;e.x=e.y,e.y=t}function lS(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function lM(e,t,n){let r=new Map,o=(e,t)=>{r.has(e)||r.set(e,[]),r.get(e).push(t)};for(let t of e.nodes()){let n=e.node(t);if("number"==typeof n.rank&&o(n.rank,t),"number"==typeof n.minRank&&"number"==typeof n.maxRank)for(let e=n.minRank;e<=n.maxRank;e++)e!==n.rank&&o(e,t)}return t.map(function(t){var o;let i,a;return o=r.get(t)||[],i=function(e){let t;for(;e.hasNode(t="_root"+ ++a8););return t}(e),a=new aQ({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(t=>e.node(t)),o.forEach(r=>{let o=e.node(r),l=e.parent(r);if(o.rank===t||o.minRank<=t&&t<=o.maxRank){a.setNode(r),a.setParent(r,l||i);let s=e[n](r);s&&s.forEach(t=>{let n=t.v===r?t.w:t.v,o=a.edge(n,r),i=void 0!==o?o.weight:0;a.setEdge(n,r,{weight:e.edge(t).weight+i})}),Object.hasOwn(o,"minRank")&&a.setNode(r,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]})}}),a})}function lN(e,t){Object.values(t).forEach(t=>t.forEach((t,n)=>e.node(t).order=n))}function lC(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];r||(e[t]=r={}),r[n]=!0}function l$(e,t,n){var r;if(!n)return!1;let o=null==(r=t.node(e))?void 0:r.edgeObj;if(!o||t.node(e).edgeLabel.reversed)return!1;let i=n.indexOf(null==o?void 0:o.v),a=n.indexOf(null==o?void 0:o.w);return -1!==i&&-1!==a&&i===(a+1)%n.length||i===(a-1)%n.length}var lO=new WeakMap;function lP(e,t,n){let r=t;for(;void 0!==r;){let t=e.parent(r);if(t===n)return r;r=t}}function lA(e,t,n,r=null){var o,i;let a=(null==n?void 0:n.useDynamic)!==!1,l=a&&null!=(o=null==r?void 0:r.graph)?o:null,s=a&&null!=(i=null==r?void 0:r.rawNodes)?i:null;t(" makeSpaceForEdgeLabels",()=>{var t;let n;return n=(t=e).graph(),void(n.ranksep/=2,t.edges().forEach(e=>{var r;let o=t.edge(e);o.minlen*=2,"c"!==(null!=(r=o.labelpos)?r:"r").toLowerCase()&&("TB"===n.rankdir||"BT"===n.rankdir?o.width+=o.labeloffset:o.height+=o.labeloffset)}))}),t(" removeSelfEdges",()=>{var t;(t=e).edges().forEach(e=>{if(e.v===e.w){let n=t.node(e.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:e,label:t.edge(e)}),t.removeEdge(e)}})}),t(" acyclic",()=>{var t,n,r;let o,i,a,s;("greedy"===e.graph().acyclicer?function(e,t){var n,r;let o,i,a,l,s;if(1>=e.nodeCount())return[];let u=(n=e,r=t||li,o=new aQ,i=0,a=0,n.nodes().forEach(e=>{o.setNode(e,{v:e,in:0,out:0})}),n.edges().forEach(e=>{let t=o.edge(e.v,e.w)||0,n=r(e);o.setEdge(e.v,e.w,t+n);let l=o.node(e.v),s=o.node(e.w);a=Math.max(a,l.out+=n),i=Math.max(i,s.in+=n)}),l=(function(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t})(a+i+3).map(()=>new ln),s=i+1,o.nodes().forEach(e=>{ll(l,s,o.node(e))}),{graph:o,buckets:l,zeroIdx:s});return(function(e,t,n){var r;let o=[],i=t[t.length-1],a=t[0],l;for(;e.nodeCount();){for(;l=a.dequeue();)la(e,t,n,l);for(;l=i.dequeue();)la(e,t,n,l);if(e.nodeCount()){for(let i=t.length-2;i>0;--i)if(l=null==(r=t[i])?void 0:r.dequeue()){o=o.concat(la(e,t,n,l,!0)||[]);break}}}return o})(u.graph,u.buckets,u.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w)||[])}(e,(t=e,e=>t.edge(e).weight)):(n=e,r=null!=l?l:null,o=[],i={},a={},s=function e(t){Object.hasOwn(a,t)||(a[t]=!0,i[t]=!0,n.outEdges(t).forEach(t=>{Object.hasOwn(i,t.w)?o.push(t):e(t.w)}),delete i[t])},r&&"function"==typeof r.node&&(s=function e(t){var l;Object.hasOwn(a,t)||(a[t]=!0,i[t]=!0,null==(l=n.outEdges(t))||l.forEach(a=>{var l,s,u,d,c;let h;Object.hasOwn(i,a.w)||(null==(l=r.node(t))?void 0:l.rank)>(null==(s=r.node(a.w))?void 0:s.rank)&&(u=n,d=a.w,c=a,h=new Set,function e(t){var n;if(u.sources().includes(t))return!0;for(let r of(h.add(t),null!=(n=u.inEdges(t))?n:[]))if((r.v!==c.v||r.w!==c.w)&&!h.has(r.v)&&e(r.v))return!0;return!1}(d))?o.push(a):e(a.w)}),delete i[t])}),n.sources().forEach(s),n.nodes().forEach(s),o)).forEach(t=>{let n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,"rev"+ ++a8)})}),t(" nestingGraph.run",()=>{var t,n;let r,o,i,a,l,s;return r=aJ(e,"root",{},"_root"),a=2*(i=a5(Math.max,Object.values((s={},(t=e).children("\0").forEach(e=>(function e(n,r){let o=t.children(n);o&&o.length&&o.forEach(t=>e(t,r+1)),s[n]=r})(e,1)),o=s)))-1)+1,e.graph().nestingRoot=r,e.edges().forEach(t=>e.edge(t).minlen*=a),l=(n=e).edges().reduce((e,t)=>e+n.edge(t).weight,0)+1,void(e.children("\0").forEach(t=>{!function e(t,n,r,o,i,a,l){var s;let u=t.children(l);if(!u.length){l!==n&&t.setEdge(n,l,{weight:0,minlen:r});return}let d=a3(t,"_bt"),c=a3(t,"_bb"),h=t.node(l);t.setParent(d,l),h.borderTop=d,t.setParent(c,l),h.borderBottom=c,u.forEach(s=>{var u;e(t,n,r,o,i,a,s);let h=t.node(s),f=h.borderTop?h.borderTop:s,p=h.borderBottom?h.borderBottom:s,g=h.borderTop?o:2*o,m=f!==p?1:i-(null!=(u=a[l])?u:0)+1;t.setEdge(d,f,{weight:g,minlen:m,nestingEdge:!0}),t.setEdge(p,c,{weight:g,minlen:m,nestingEdge:!0})}),t.parent(l)||t.setEdge(n,d,{weight:0,minlen:i+(null!=(s=a[l])?s:0)})}(e,r,a,l,i,o,t)}),e.graph().nodeRankFactor=a)}),t(" rank",()=>(function(e){let t=e.graph().ranker;if("function"==typeof t)return t(e);switch(t){case"network-simplex":default:lf(e);break;case"tight-tree":var n;ls(n=e),ld(n);break;case"longest-path":ls(e);case"none":}})(a0(e))),t(" injectEdgeLabelProxies",()=>{var t;(t=e).edges().forEach(e=>{let n=t.edge(e);if(n.width&&n.height){let n=t.node(e.v),r={rank:(t.node(e.w).rank-n.rank)/2+n.rank,e:e};aJ(t,"edge-proxy",r,"_ep")}})}),t(" removeEmptyRanks",()=>{let t,n,r,o;return t=a5(Math.min,e.nodes().map(t=>e.node(t).rank).filter(e=>void 0!==e)),n=[],e.nodes().forEach(r=>{let o=e.node(r).rank-t;n[o]||(n[o]=[]),n[o].push(r)}),r=0,o=e.graph().nodeRankFactor,void Array.from(n).forEach((t,n)=>{void 0===t&&n%o!=0?--r:void 0!==t&&r&&t.forEach(t=>e.node(t).rank+=r)})}),t(" nestingGraph.cleanup",()=>{let t;return t=e.graph(),void(e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)}))}),t(" normalizeRanks",()=>{let t;return t=a5(Math.min,e.nodes().map(t=>{let n=e.node(t).rank;return void 0===n?Number.MAX_VALUE:n})),void e.nodes().forEach(n=>{let r=e.node(n);Object.hasOwn(r,"rank")&&(r.rank-=t)})}),t(" assignRankMinMax",()=>{var t;let n;return n=0,void((t=e).nodes().forEach(e=>{let r=t.node(e);r.borderTop&&(r.minRank=t.node(r.borderTop).rank,r.maxRank=t.node(r.borderBottom).rank,n=Math.max(n,r.maxRank))}),t.graph().maxRank=n)}),t(" removeEdgeLabelProxies",()=>{var t;(t=e).nodes().forEach(e=>{let n=t.node(e);"edge-proxy"===n.dummy&&(t.edge(n.e).labelRank=n.rank,t.removeNode(e))})}),t(" normalize.run",()=>{e.graph().dummyChains=[],e.edges().forEach(t=>(function(e,t){let n,r,o,i=t.v,a=e.node(i).rank,l=t.w,s=e.node(l).rank,u=t.name,d=e.edge(t),c=d.labelRank;if(s!==a+1){for(e.removeEdge(t),o=0,++a;a<s;++o,++a)d.points=[],n=aJ(e,"edge",r={width:0,height:0,edgeLabel:d,edgeObj:t,rank:a},"_d"),a===c&&(r.width=d.width,r.height=d.height,r.dummy="edge-label",r.labelpos=d.labelpos),e.setEdge(i,n,{weight:d.weight},u),0===o&&e.graph().dummyChains.push(n),i=n;e.setEdge(i,l,{weight:d.weight},u)}})(e,t))}),t(" parentDummyChains",()=>{var t,n;let r,o,i,a;return i=(r={},o=0,(n=t=e).children("\0").forEach(function e(t){let i=o;n.children(t).forEach(e),r[t]={low:i,lim:o++}}),r),void(Array.isArray((a=t.graph()).dummyChains)&&a.dummyChains.forEach(e=>{let n=t.node(e),r=n.edgeObj,o=function(e,t,n,r){let o=[],i=[],a=Math.min(t[n].low,t[r].low),l=Math.max(t[n].lim,t[r].lim),s;s=n;do o.push(s=e.parent(s));while(s&&(t[s].low>a||l>t[s].lim))let u=s,d=r;for(;(d=e.parent(d))!==u;)i.push(d);return{path:o.concat(i.reverse()),lca:u}}(t,i,r.v,r.w),a=o.path,l=o.lca,s=0,u=a[0],d=!0;for(;e!==r.w;){if(n=t.node(e),d){for(;(u=a[s])!==l&&t.node(u).maxRank<n.rank;)s++;u===l&&(d=!1)}if(!d){for(;s<a.length-1&&t.node(a[s+1]).minRank<=n.rank;)s++;u=a[s]}void 0!==u&&t.setParent(e,u),e=t.successors(e)[0]}}))}),t(" addBorderSegments",()=>{var t;(t=e).children("\0").forEach(function e(n){let r=t.children(n),o=t.node(n);if(r.length&&r.forEach(e),o&&Object.hasOwn(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(let e=o.minRank,r=o.maxRank+1;e<r;++e)lw(t,"borderLeft","_bl",n,o,e),lw(t,"borderRight","_br",n,o,e)}})}),t(" order",()=>(function e(t,n={},r=null){if("function"==typeof n.customOrder)return void n.customOrder(t,e);let o=a4(t),i=lM(t,a7(1,o+1),"inEdges"),a=lM(t,a7(o-1,-1,-1),"outEdges"),l=function(e,t=null){let n={},r=e.nodes().filter(t=>!e.children(t).length),o=a7(a5(Math.max,r.map(t=>e.node(t).rank))+1).map(()=>[]);return r.sort((t,n)=>e.node(t).rank-e.node(n).rank).forEach(function r(i){if(n[i])return;n[i]=!0,o[e.node(i).rank].push(i);let a=e.successors(i);a&&[...a].sort((n,r)=>{var o,i;return o=n,i=r,lt(t,e.node(o),e.node(i))}).forEach(r)}),o}(t,r);if(lN(t,l),n.disableOptimalOrderHeuristic)return;let s=1/0,u,d=n.constraints||[];for(let e=0,n=0;n<4;++e,++n){(function(e,t,n,r){let o=!0,i=new aQ;e.forEach(function(e){var a;let l,s;n.forEach(e=>i.setEdge(e.left,e.right));let u=e.graph().root,{result:d,usedBias:c}=function e(t,n,r,o,i){var a,l,s,u,d,c,h,f,p,g,m;let x,y=null,v=i;"boolean"==typeof o?(v=o,y=null):void 0!==o&&(y=o);let b=t.children(n),w=t.node(n),E=w?w.borderLeft:void 0,k=w?w.borderRight:void 0,_={};E&&(b=b.filter(e=>e!==E&&e!==k));let j=function(e,t=[]){return t.map(t=>{let n=e.inEdges(t);if(!n||!n.length)return{v:t};{let r=n.reduce((t,n)=>{let r=e.edge(n),o=e.node(n.v);return{sum:t.sum+r.weight*o.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}})}(t,b);j.forEach(n=>{if(t.children(n.v).length){var o,i;let{result:a}=e(t,n.v,r,y,v);_[n.v]=a,Object.hasOwn(a,"barycenter")&&(o=n,i=a,void 0!==o.barycenter?(o.barycenter=(o.barycenter*o.weight+i.barycenter*i.weight)/(o.weight+i.weight),o.weight+=i.weight):(o.barycenter=i.barycenter,o.weight=i.weight))}});let S=(x={},j.forEach((e,t)=>{let n={indegree:0,in:[],out:[],vs:[e.v],i:t};void 0!==e.barycenter&&(n.barycenter=e.barycenter,n.weight=e.weight),x[e.v]=n}),r.edges().forEach(e=>{let t=x[e.v],n=x[e.w];void 0!==t&&void 0!==n&&(n.indegree++,t.out.push(n))}),function(e){let t=[];for(;e.length;){let n=e.pop();t.push(n),n.in.reverse().forEach(function(e){return t=>{t.merged||(void 0===t.barycenter||void 0===e.barycenter||t.barycenter>=e.barycenter)&&function(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}(e,t)}}(n)),n.out.forEach(function(t){return n=>{n.in.push(t),0==--n.indegree&&e.push(n)}}(n))}return t.filter(e=>!e.merged).map(e=>a9(e,["vs","i","barycenter","weight"]))}(Object.values(x).filter(e=>!e.indegree)));!function(e,t){e.forEach(e=>{e.vs=e.vs.flatMap(e=>t[e]?t[e].vs:e)})}(S,_);let M={},N=!1;for(let e=0;e<S.length;e++)for(let n=e+1;n<S.length;n++)if(!(!S[e]||!S[n]||!(null!=(a=S[e])&&a.barycenter)||!(null!=(l=S[n])&&l.barycenter))&&(null==(s=S[e])?void 0:s.barycenter)===S[n].barycenter){let r=null!=(d=null==(u=S[e])?void 0:u.vs[0])?d:"",o=null!=(h=null==(c=S[n])?void 0:c.vs[0])?h:"",i=t.node(r),a=t.node(o);if("edge"===i.dummy&&"edge"===a.dummy&&(null==(f=i.edgeObj)?void 0:f.v)===(null==(p=a.edgeObj)?void 0:p.v)&&(null==(g=i.edgeObj)?void 0:g.w)===(null==(m=a.edgeObj)?void 0:m.w))if(i.edgeLabel.reversed){M[o]=S[e],S.splice(e,1),e--;break}else M[r]=S[n],S.splice(n,1),n--;else N=!0}let C=function(e,t,n,r,o){var i;let a,l={},s=null,u=null,d=o;"boolean"==typeof t?(d=t,l={}):t&&(l=t,s=null!=n?n:null,u=null!=r?r:null);let c=(i=e=>Object.hasOwn(e,"barycenter"),a={lhs:[],rhs:[]},e.forEach(e=>{i(e)?a.lhs.push(e):a.rhs.push(e)}),a),h=c.lhs,f=c.rhs.sort((e,t)=>t.i-e.i),p=[],g=0,m=0,x=0;for(let[e,t]of(h.sort(function(e,t,n){return(r,o)=>{if(r.barycenter<o.barycenter)return -1;if(r.barycenter>o.barycenter)return 1;if(e&&("string"==typeof r.vs[0]||"string"==typeof o.vs[0])){let n=lt(t,e.node(r.vs[0]),e.node(o.vs[0]));if(0!==n)return n}return n?o.i-r.i:r.i-o.i}}(u,s,!!d)),Object.entries(l))){let n=h.findIndex(t=>t.vs[0]===e);h.splice(n+1,0,t)}x=lS(p,f,x),h.forEach(e=>{x+=e.vs.length,p.push(e.vs),g+=e.barycenter*e.weight,m+=e.weight,x=lS(p,f,x)});let y={vs:p.flat(1)};return m&&(y.barycenter=g/m,y.weight=m),y}(S,M,y,t,v);if(E&&k){C.vs=[E,C.vs,k].flat(1);let e=t.predecessors(E);if(e&&e.length){let n=t.node(e[0]),r=t.predecessors(k),o=t.node(r[0]);Object.hasOwn(C,"barycenter")||(C.barycenter=0,C.weight=0),C.barycenter=(C.barycenter*C.weight+n.order+o.order)/(C.weight+2),C.weight+=2}}return Object.defineProperty(C,"result",{value:C,enumerable:!1,configurable:!0,writable:!0}),Object.defineProperty(C,"usedBias",{value:N,enumerable:!1,configurable:!0,writable:!0}),C}(e,u,i,r,o);t&&c&&(o=!o),d.vs.forEach((t,n)=>e.node(t).order=n),a=d.vs,l={},a.forEach(t=>{let n=e.parent(t),r,o;for(;n;){if((r=e.parent(n))?(o=l[r],l[r]=n):(o=s,s=n),o&&o!==n)return void i.setEdge(o,n);n=r}})})})(e%2?i:a,e%4>=2,d,r),l=a2(t);let o=function(e,t){let n=0;for(let r=1;r<t.length;++r)n+=function(e,t,n){var r;let o=(r=n.map((e,t)=>t),n.reduce((e,t,n)=>(e[t]=r[n],e),{})),i=t.flatMap(t=>{let n=e.outEdges(t);return n?n.map(t=>({pos:o[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos):[]}),a=1;for(;a<n.length;)a<<=1;let l=2*a-1;a-=1;let s=Array(l).fill(0),u=0;return i.forEach(e=>{let t=e.pos+a;s[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=s[t+1]),t=t-1>>1,s[t]+=e.weight;u+=e.weight*n}),u}(e,t[r-1],t[r]);return n}(t,l);o<s?(n=0,u=Object.assign({},l),s=o):o===s&&(u=structuredClone(l))}lN(t,u)})(e,n,s)),t(" insertSelfEdges",()=>{var t;a2(t=e).forEach(e=>{let n=0;e.forEach((e,r)=>{let o=t.node(e);"number"!=typeof o.rank&&(o.rank=0),o.order=r+n,(o.selfEdges||[]).forEach(e=>{aJ(t,"selfedge",{width:e.label.width,height:e.label.height,rank:o.rank,order:r+ ++n,e:e.e,edgeLabel:e.label},"_se"),Array.isArray(e.label.points)&&7===e.label.points.length||(e.label.points=[{x:0,y:-10},{x:0,y:-10},{x:0,y:0},{x:0,y:10},{x:0,y:10},{x:0,y:0},{x:0,y:0}])}),delete o.selfEdges})})}),t(" adjustCoordinateSystem",()=>{var t;let n;("lr"===(n=null==(t=e.graph().rankdir)?void 0:t.toLowerCase())||"rl"===n)&&lE(e)}),t(" position",()=>{var t,r,o,i,a;let l,s,u,d,c,h,f,p,g,m,x,y,v,b,w;return t=e,r=n.corePath,void(x=a2(a=t=a0(t)),v=(y=a.graph()).ranksep,b=y.rankalign,w=0,x.forEach(e=>{let t=e.reduce((e,t)=>{var n;let r=null!=(n=a.node(t).height)?n:0;return e>r?e:r},0);e.forEach(e=>{let n=a.node(e);"top"===b?n.y=w+n.height/2:"bottom"===b?n.y=w+t-n.height/2:n.y=w+t/2}),w+=t+v}),Object.entries((s=a2(o=t),u=Object.assign((l={},s.length&&s.reduce(function(e,t){let n=0,r=0,i=e.length,a=t[t.length-1];return t.forEach((e,s)=>{let u=function(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(t=>e.node(t).dummy)}}(o,e),d=u?o.node(u).order:i;(u||e===a)&&(t.slice(r,s+1).forEach(e=>{let t=o.predecessors(e);t&&t.forEach(t=>{let r=o.node(t),i=r.order;(i<n||d<i)&&!(r.dummy&&o.node(e).dummy)&&lC(l,t,e)})}),r=s+1,n=d)}),t}),l),function(e,t){let n={};function r(t,r,o,i,a){a7(r,o).forEach(r=>{let o=t[r];if(void 0!==o&&e.node(o).dummy){let t=e.predecessors(o);t&&t.forEach(t=>{if(void 0===t)return;let r=e.node(t);r.dummy&&(r.order<i||r.order>a)&&lC(n,t,o)})}})}return t.length&&t.reduce(function(t,n){let o=-1,i=-1,a=0;return n.forEach((l,s)=>{if("border"===e.node(l).dummy){let t=e.predecessors(l);if(t&&t.length){let l=t[0];if(void 0===l)return;i=e.node(l).order,r(n,a,s,o,i),a=s,o=i}}r(n,a,n.length,i,t.length)}),n}),n}(o,s)),d={},["u","d"].forEach(e=>{c="u"===e?s:Object.values(s).reverse(),["l","r"].forEach(t=>{var n,i;let a,l,s;"r"===t&&(c=c.map(e=>Object.values(e).reverse()));let h=(n=c,i=t=>("u"===e?o.predecessors(t):o.successors(t))||[],a={},l={},s={},n.forEach(e=>{e.forEach((e,t)=>{a[e]=e,l[e]=e,s[e]=t})}),n.forEach(e=>{let t=-1,n=-1,d=!1,c=e,h=e.findIndex(e=>(null==r?void 0:r.includes(e))||l$(e,o,r));h>0&&(c=[e[h],...e.slice(0,h),...e.slice(h+1)],d=!0),c.forEach(e=>{var c;let h=i(e);if(h&&h.length){null!=r&&r.includes(e)&&(h=h.filter(e=>l$(e,o,r)));let i=h.sort((e,t)=>{let n=s[e],r=s[t];return(void 0!==n?n:0)-(void 0!==r?r:0)}),f=(i.length-1)/2;for(let r=Math.floor(f),o=Math.ceil(f);r<=o;++r){let o=i[r];if(void 0===o)continue;let h=s[o];if(void 0!==h&&l[e]===e&&t<h&&s[o]!==n&&!function(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];return void 0!==r&&Object.hasOwn(r,n)}(u,e,o)){let r=a[o];void 0!==r&&(l[o]=e,l[e]=a[e]=r,t=h,d&&(t=-1,n=null!=(c=s[o])?c:-1,d=!1))}}}})}),{root:a,align:l}),f=function(e,t,n,r,o=!1){var i,a,l,s,u,d,c;let h,f,p,g={},m=(i=e,a=t,l=n,s=o,h=new aQ,p=(u=(f=i.graph()).nodesep,d=f.edgesep,c=s,(e,t,n)=>{let r=e.node(t),o=e.node(n),i,a;if(i=0+r.width/2,Object.hasOwn(r,"labelpos"))switch(r.labelpos.toLowerCase()){case"l":a=-r.width/2;break;case"r":a=r.width/2}if(a&&(i+=c?a:-a),a=void 0,i+=(r.dummy?d:u)/2,i+=(o.dummy?d:u)/2,i+=o.width/2,Object.hasOwn(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":a=o.width/2;break;case"r":a=-o.width/2}return a&&(i+=c?a:-a),i}),a.forEach(e=>{let t;e.forEach(e=>{let n=l[e];if(void 0!==n){if(h.setNode(n),void 0!==t){let r=l[t];if(void 0!==r){let o=h.edge(r,n);h.setEdge(r,n,Math.max(p(i,e,t),o||0))}}t=e}})}),h),x=o?"borderLeft":"borderRight";function y(e,t){let n=m.nodes().slice(),r={},o=n.pop();for(;o;){if(r[o])e(o);else for(let e of(r[o]=!0,n.push(o),t(o)))n.push(e);o=n.pop()}}return y(function(e){let t=m.inEdges(e);t?g[e]=t.reduce((e,t)=>{var n;let r=null!=(n=g[t.v])?n:0,o=m.edge(t);return Math.max(e,r+(void 0!==o?o:0))},0):g[e]=0},function(e){return m.predecessors(e)||[]}),y(function(t){let n=m.outEdges(t),r=1/0;n&&(r=n.reduce((e,t)=>{let n=g[t.w],r=m.edge(t);return Math.min(e,(void 0!==n?n:0)-(void 0!==r?r:0))},1/0));let o=e.node(t);1/0!==r&&o.borderType!==x&&(g[t]=Math.max(void 0!==g[t]?g[t]:0,r))},function(e){return m.successors(e)||[]}),Object.keys(r).forEach(e=>{var t;let r=n[e];void 0!==r&&(g[e]=null!=(t=g[r])?t:0)}),g}(o,c,h.root,h.align,"r"===t);"r"===t&&(f=le(f,e=>-e)),d[e+t]=f})}),h=Object.values(d).reduce((e,t)=>{let n=-1/0,r=1/0;Object.entries(t).forEach(([e,t])=>{var i,a;let l=(i=o,a=e,i.node(a).width/2);n=Math.max(t+l,n),r=Math.min(t-l,r)});let i=n-r;return i<e[0]&&(e=[i,t]),e},[1/0,null])[1],p=a5(Math.min,f=Object.values(h)),g=a5(Math.max,f),["u","d"].forEach(e=>{["l","r"].forEach(t=>{let n=e+t,r=d[n];if(!r||r===h)return;let o=Object.values(r),i=p-a5(Math.min,o);"l"!==t&&(i=g-a5(Math.max,o)),i&&(d[n]=le(r,e=>e+i))})}),i=o.graph().align,(m=d.ul)?le(m,(e,t)=>{var n,r;if(i){let e=d[i.toLowerCase()];if(e&&void 0!==e[t])return e[t]}let o=Object.values(d).map(e=>{let n=e[t];return void 0!==n?n:0}).sort((e,t)=>e-t);return((null!=(n=o[1])?n:0)+(null!=(r=o[2])?r:0))/2}):{})).forEach(([e,n])=>t.node(e).x=n))}),t(" positionSelfEdges",()=>{var t;(t=e).nodes().forEach(e=>{let n=t.node(e),r=e=>"number"==typeof e&&isFinite(e);if("selfedge"===n.dummy){let o=t.node(n.e.v),i=r(null==o?void 0:o.x)?o.x:0,a=r(null==o?void 0:o.y)?o.y:0,l=r(null==o?void 0:o.width)?o.width:0,s=r(null==o?void 0:o.height)?o.height:0,u=r(n.x)?n.x:i,d=r(n.y)?n.y:a,c=l/2,h=s/2;n.edgeLabel.points=[{x:u+c,y:d-h},{x:u+c,y:d-h},{x:u,y:d},{x:u-c,y:d+h},{x:u-c,y:d+h},{x:u,y:d},{x:u,y:d}],n.edgeLabel.x=u,n.edgeLabel.y=d,t.setEdge(n.e,n.edgeLabel),t.removeNode(e)}else n&&Array.isArray(n.selfEdges)&&n.selfEdges.forEach(e=>{if(!Array.isArray(e.label.points)||7!==e.label.points.length){let t=r(n.x)?n.x:0,o=r(n.y)?n.y:0,i=r(n.width)?n.width:0,a=r(n.height)?n.height:0,l=i/2,s=a/2;e.label.points=[{x:t+l,y:o-s},{x:t+l,y:o-s},{x:t,y:o},{x:t-l,y:o+s},{x:t-l,y:o+s},{x:t,y:o},{x:t,y:o}]}})})});let u=JSON.parse(JSON.stringify(e._nodes));return t(" removeBorderNodes",()=>{var t;(t=e).nodes().forEach(e=>{if(t.children(e).length){let n=t.node(e),r=t.node(n.borderTop),o=t.node(n.borderBottom),i=t.node(n.borderLeft[n.borderLeft.length-1]),a=t.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(a.x-i.x),n.height=Math.abs(o.y-r.y),n.x=i.x+n.width/2,n.y=r.y+n.height/2}}),t.nodes().forEach(e=>{"border"===t.node(e).dummy&&t.removeNode(e)})}),t(" normalize.undo",()=>{e.graph().dummyChains.forEach(t=>{let n=e.node(t),r=n.edgeLabel,o;for(e.setEdge(n.edgeObj,r);n.dummy;)o=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),"edge-label"===n.dummy&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=o,n=e.node(t)})}),t(" fixupEdgeLabelCoords",()=>{var t;(t=e).edges().forEach(e=>{let n=t.edge(e);if(Object.hasOwn(n,"x"))switch(("l"===n.labelpos||"r"===n.labelpos)&&(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset}})}),t(" undoCoordinateSystem",()=>{var t,n,r;let o;("bt"===(o=null==(t=e.graph().rankdir)?void 0:t.toLowerCase())||"rl"===o)&&((n=e).nodes().forEach(e=>l_(n.node(e))),n.edges().forEach(e=>{var t;let r=n.edge(e);null==(t=r.points)||t.forEach(l_),Object.hasOwn(r,"y")&&l_(r)})),("lr"===o||"rl"===o)&&((r=e).nodes().forEach(e=>lj(r.node(e))),r.edges().forEach(e=>{var t;let n=r.edge(e);null==(t=n.points)||t.forEach(lj),Object.hasOwn(n,"x")&&lj(n)}),lE(e))}),t(" translateGraph",()=>(function(e){let t=1/0,n=0,r=1/0,o=0,i=e.graph(),a=i.marginx||0,l=i.marginy||0;function s(e){let i=e.x,a=e.y,l=e.width,s=e.height;t=Math.min(t,i-l/2),n=Math.max(n,i+l/2),r=Math.min(r,a-s/2),o=Math.max(o,a+s/2)}e.nodes().forEach(t=>s(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);Object.hasOwn(n,"x")&&s(n)}),t-=a,r-=l,e.nodes().forEach(n=>{let o=e.node(n);o.x-=t,o.y-=r}),e.edges().forEach(n=>{let o=e.edge(n);o.points.forEach(e=>{e.x-=t,e.y-=r}),Object.hasOwn(o,"x")&&(o.x-=t),Object.hasOwn(o,"y")&&(o.y-=r)}),i.width=n-t+a,i.height=o-r+l})(e)),t(" assignNodeIntersects",()=>{var t;(t=e).edges().forEach(e=>{if(e.v===e.w)return;let n=t.edge(e),r=t.node(e.v),o=t.node(e.w),i,a;n.points?(i=n.points[0],a=n.points[n.points.length-1]):(n.points=[],i=o,a=r),n.points.unshift(a1(r,i)),n.points.push(a1(o,a))})}),t(" reversePoints",()=>{var t;(t=e).edges().forEach(e=>{let n=t.edge(e);n.reversed&&n.points.reverse()})}),t(" acyclic.undo",()=>{e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}),{graph:e,rawNodes:u}}function lR(e,t){e.nodes().forEach(n=>{let r=e.node(n),o=t.node(n);r&&(r.x=o.x,r.y=o.y,r.order=o.order,r.rank=o.rank,t.children(n).length&&(r.width=o.width,r.height=o.height))}),e.edges().forEach(n=>{let r=e.edge(n),o=t.edge(n);r.points=o.points,Object.hasOwn(o,"x")&&(r.x=o.x,r.y=o.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var lz=["nodesep","edgesep","ranksep","marginx","marginy"],lL={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},lI=["acyclicer","ranker","rankdir","align","rankalign"],lD=["width","height","rank"],lB={width:0,height:0},lT=["minlen","weight","width","height","labeloffset"],lH={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},lV=["labelpos"];function lF(e){let t=new aQ({multigraph:!0,compound:!0}),n=lX(e.graph());return t.setGraph(Object.assign({},lL,lq(n,lz),a9(n,lI))),e.nodes().forEach(n=>{let r=lq(lX(e.node(n)),lD);Object.keys(lB).forEach(e=>{void 0===r[e]&&(r[e]=lB[e])}),t.setNode(n,r);let o=e.parent(n);void 0!==o&&t.setParent(n,o)}),e.edges().forEach(n=>{let r=lX(e.edge(n));t.setEdge(n,Object.assign({},lH,lq(r,lT),a9(r,lV)))}),t}function lq(e,t){return le(a9(e,t),Number)}function lX(e){let t={};return e&&Object.entries(e).forEach(([e,n])=>{"string"==typeof e&&(e=e.toLowerCase()),t[e]=n}),t}function lW(e,t){return Math.min(1,1440/(1.15*e),780/(1.15*t))}function lY(e,t,n,r){return Array.from({length:e},(e,o)=>({x:n+o%t*272,y:r+96*Math.floor(o/t)}))}let lK=(e,t)=>e*(t+40)-40;function lU(e){return new Set(e.filter(e=>e.source!==e.target).flatMap(e=>[e.source,e.target]))}var lZ=e.i(11676);function lG({repo:e,trail:t,onOpen:n}){let r=(0,v.useRef)(null),o=(0,v.useRef)(null),[i,a]=(0,v.useState)({trail:t,count:0}),l=i.trail===t?i.count:0;return(0,v.useLayoutEffect)(()=>{let e=r.current,n=o.current;if(!e||!n)return;let i=()=>{let r=[...n.children].map(e=>e.getBoundingClientRect().width),o=r.pop()??0,i=function(e,t,n){let r=e.length-1;if(r<=0)return 0;let o=e.reduce((e,t)=>e+t,0)+4*r;if(o<=t)return 0;o+=n+4;for(let n=1;n<r;n++)if((o-=e[n-1]+4)<=t)return n;return r}(r,e.getBoundingClientRect().width,o);a(e=>e.trail===t&&e.count===i?e:{trail:t,count:i})};i();let l=new ResizeObserver(i);for(let t of(l.observe(e),n.children))l.observe(t);return()=>l.disconnect()},[t]),(0,y.jsxs)("nav",{ref:r,"aria-label":"Where you are",className:"relative flex min-w-0 flex-1 items-center gap-1 text-[14px] text-text-2",children:[l>0&&(0,y.jsx)("button",{type:"button","data-testid":"breadcrumb-folded",onClick:()=>n(t[l-1]),title:`Up to ${(0,lZ.d)(t[l-1],e)}: ${t.slice(0,l).map(t=>(0,lZ.d)(t,e)).join(" / ")}`,"aria-label":`Up to ${(0,lZ.d)(t[l-1],e)}`,className:"shrink-0 rounded-md px-1 hover:bg-surface hover:text-text",children:"…"}),t.map((r,o)=>o<l?null:(0,y.jsxs)("span",{className:`flex items-center gap-1 ${o===t.length-1?"min-w-0":"shrink-0"}`,children:[o>0&&(0,y.jsx)("span",{"aria-hidden":!0,children:"/"}),o===t.length-1?(0,y.jsx)("span",{"aria-current":"page",title:r||(0,lZ.d)(r,e),className:"truncate px-1 font-medium text-text",children:(0,lZ.d)(r,e)}):(0,y.jsx)("button",{type:"button",onClick:()=>n(r),title:r||(0,lZ.d)(r,e),className:"truncate rounded-md px-1 hover:bg-surface hover:text-text",children:(0,lZ.d)(r,e)})]},r||"(root)")),(0,y.jsxs)("div",{ref:o,"aria-hidden":!0,className:"pointer-events-none invisible absolute inset-x-0 top-0 flex h-0 gap-1 overflow-hidden whitespace-nowrap",children:[t.map((n,r)=>(0,y.jsxs)("span",{className:"flex shrink-0 items-center gap-1",children:[r>0&&(0,y.jsx)("span",{children:"/"}),(0,y.jsx)("span",{className:`px-1 ${r===t.length-1?"font-medium":""}`,children:(0,lZ.d)(n,e)})]},n||"(root)")),(0,y.jsx)("span",{className:"shrink-0 px-1",children:"…"})]})]})}let lQ=as("outline","arrow-right","ArrowRight",[["path",{d:"M5 12l14 0",key:"svg-0"}],["path",{d:"M13 18l6 -6",key:"svg-1"}],["path",{d:"M13 6l6 6",key:"svg-2"}]]),lJ=as("outline","code","Code",[["path",{d:"M7 8l-4 4l4 4",key:"svg-0"}],["path",{d:"M17 8l4 4l-4 4",key:"svg-1"}],["path",{d:"M14 4l-4 16",key:"svg-2"}]]),l0=as("outline","file","File",[["path",{d:"M14 3v4a1 1 0 0 0 1 1h4",key:"svg-0"}],["path",{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2",key:"svg-1"}]]),l1=as("outline","folder","Folder",[["path",{d:"M5 4h4l3 3h7a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2",key:"svg-0"}]]),l2=as("outline","x","X",[["path",{d:"M18 6l-12 12",key:"svg-0"}],["path",{d:"M6 6l12 12",key:"svg-1"}]]);function l3(e){return e.toLocaleString("en-US")}let l5=[["K",1e3],["M",1e6],["B",1e9]];function l4(e){return e<5e3?"just now":e<6e4?`${Math.floor(e/1e3)} s ago`:e<36e5?`${Math.floor(e/6e4)} min ago`:`${Math.floor(e/36e5)} h ago`}let l6={structure:"Structure",summaries:"Summaries",embeddings:"Search vectors"},l8={structure:"Indexing",summaries:"Summarizing",embeddings:"Embedding"},l7=["structure","summaries","embeddings"],l9=e=>e.total>0?` ${l3(e.done)} / ${l3(e.total)}`:"";function se(e){return"portal"!==e.kind?e.name:e.pages?`boxes on ${e.pages.length} other pages`:`boxes on ${e.name}`}function st(e,t){return`vscode://file/${e.repo}/${e.path}${t?`:${t}`:""}`}function sn(e){performance.clearMarks(`${e}:start`),performance.mark(`${e}:start`)}function sr(e){performance.clearMarks(`${e}:start`)}function so(e){requestAnimationFrame(()=>requestAnimationFrame(()=>{if(0===performance.getEntriesByName(`${e}:start`,"mark").length)return;let t=performance.measure(e,`${e}:start`);performance.clearMarks(`${e}:start`);let n=window;(n.__nebulosityPerf??=[]).push({name:e,ms:Math.round(10*t.duration)/10})}))}function si(e,t){return e.reduce((e,n)=>e+(n.source===t||n.target===t?n.count:0),0)}let sa=(e,t,n)=>`${l3(e)} ${1===e?t:n}`;function sl(e,t){return`${sa(e.hiddenCount??0,"folder or file","folders and files")} \xb7 ${sa(t,"import","imports")}`}let ss=new Set(["NOT_READY","SUMMARIES_OFF"]),su=as("outline","external-link","ExternalLink",[["path",{d:"M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6",key:"svg-0"}],["path",{d:"M11 13l9 -9",key:"svg-1"}],["path",{d:"M15 4h5v5",key:"svg-2"}]]);var sd=e.i(16675);let sc=0,sh="";function sf(){(0,v.useEffect)(()=>{let e=document.documentElement;return 0===sc&&(sh=e.style.overflow,e.style.overflow="hidden"),sc++,()=>{0==--sc&&(e.style.overflow=sh)}},[])}function sp({path:t,lines:n,onClose:r,onOpenInEditor:o}){sf();let[i,a]=(0,v.useState)(null),[l,s]=(0,v.useState)(null),u=(0,v.useRef)(null);(0,v.useEffect)(()=>{let e=new AbortController;return am.source(t,e.signal).then(a,e=>{e instanceof ac&&s(e)}),()=>e.abort()},[t]),(0,v.useEffect)(()=>{i&&n&&u.current&&(u.current.scrollTop=Math.max(0,(n.start-4)*20))},[i,n]),(0,v.useEffect)(()=>{let e=e=>{"Escape"===e.key&&(e.stopImmediatePropagation(),r())};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[r]);let d=i?.content.replace(/\r\n/g,"\n").replace(/\n$/,"")??"",[c,h]=(0,v.useState)(null);(0,v.useEffect)(()=>{if(!i)return;let t=!0;return e.A(74429).then(({highlightCode:e})=>{t&&h({text:d,html:e(d,i.language)})}),()=>{t=!1}},[i,d]);let f=i?.lineCount??0,p=i?st(i,n?.start):void 0;return(0,rz.createPortal)((0,y.jsx)("div",{"data-source-viewer":t,className:"fixed inset-0 z-40 bg-canvas/60",onClick:r,children:(0,y.jsxs)("div",{role:"dialog","aria-label":`Source of ${t}`,onClick:e=>e.stopPropagation(),className:"absolute inset-y-0 right-0 flex w-[min(960px,80vw)] flex-col border-l border-hairline bg-panel max-[600px]:w-full",children:[(0,y.jsxs)("header",{className:"flex items-start justify-between gap-3 border-b border-hairline px-4 py-3",children:[(0,y.jsxs)("div",{className:"min-w-0",children:[(0,y.jsxs)("div",{className:"flex items-center gap-2",children:[(0,y.jsx)(l0,{"aria-hidden":!0,size:16,stroke:1.75,className:"shrink-0 text-text-2"}),(0,y.jsx)("h2",{title:t,className:"truncate text-[15px] font-medium text-text",children:(0,lZ.d)(t,"")})]}),(0,y.jsx)("div",{className:"truncate font-mono text-[12px] text-text-2",title:t,children:t}),(0,y.jsxs)("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 text-[12px] text-text-2",children:[i&&(0,y.jsxs)("span",{children:[l3(f)," ",1===f?"line":"lines"]}),i?.truncated&&(0,y.jsx)("span",{children:"Only the first 1 MB is shown."}),i&&(0,sd.M)(d)&&(0,y.jsx)("span",{"data-testid":"source-plain",children:"Shown without colors: too large to color quickly."}),n&&(0,y.jsxs)("span",{children:["Lines ",n.start,"–",n.end," highlighted"]}),p&&(o?(0,y.jsxs)("button",{type:"button",onClick:()=>o(n?.start),className:"inline-flex items-center gap-1 text-control underline underline-offset-2 hover:text-text",children:["Open in VS Code ",(0,y.jsx)(su,{"aria-hidden":!0,size:14,stroke:1.75})]}):(0,y.jsxs)("a",{href:p,className:"inline-flex items-center gap-1 text-control underline underline-offset-2 hover:text-text",children:["Open in VS Code ",(0,y.jsx)(su,{"aria-hidden":!0,size:14,stroke:1.75})]}))]})]}),(0,y.jsx)("button",{type:"button",onClick:r,"aria-label":"Close the source",className:"shrink-0 rounded-md p-1 text-text-2 hover:bg-surface hover:text-text",children:(0,y.jsx)(l2,{"aria-hidden":!0,size:16,stroke:1.75})})]}),(0,y.jsxs)("div",{ref:u,"data-scroll-x":!0,className:"flex-1 overflow-auto",children:[l&&(0,y.jsx)("p",{className:"px-4 py-3 text-[13px] text-danger",children:l.message}),!i&&!l&&(0,y.jsx)("p",{className:"px-4 py-3 text-[13px] text-text-2",children:"Loading…"}),i&&(0,y.jsxs)("div",{className:"relative flex min-w-max font-mono text-[13px]",style:{lineHeight:"20px"},children:[n&&(0,y.jsx)("div",{"aria-hidden":!0,className:"absolute inset-x-0 bg-surface",style:{top:(n.start-1)*20+12,height:(n.end-n.start+1)*20}}),(0,y.jsx)("pre",{"aria-hidden":!0,className:"sticky left-0 select-none bg-panel py-3 pl-4 pr-3 text-right text-text-2",children:Array.from({length:f},(e,t)=>t+1).join("\n")}),c?.text===d?(0,y.jsx)("pre",{className:"syntax relative py-3 pr-6",dangerouslySetInnerHTML:{__html:c.html}}):(0,y.jsx)("pre",{className:"syntax relative py-3 pr-6",children:d})]})]})]})}),document.body)}let sg="[@media(height<480px)]:flex-none [@media(height<480px)]:overflow-visible",sm={repo:"Repository",folder:"Folder",file:"File"},sx=(0,v.memo)(function(e){let t=e.level.nodes.find(t=>t.path===e.path&&"portal"===t.kind);return t?(0,y.jsx)(sb,{portal:t,...e}):(0,y.jsx)(sv,{...e})});function sy({path:e,covers:t,alert:n,kindLabel:r,name:o,title:i,subtitle:a,header:l,onClose:s,children:u}){return(0,y.jsxs)("aside",{"data-panel":e,style:{width:t?"100%":400},className:"pointer-events-auto absolute inset-y-0 right-0 z-10 flex flex-col border-l border-hairline bg-panel [@media(height<480px)]:overflow-y-auto",children:[(0,y.jsxs)("header",{className:"border-b border-hairline px-4 py-4",children:[(0,y.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,y.jsxs)("div",{className:"min-w-0",children:[(0,y.jsx)("div",{className:"text-[12px] leading-4 text-text-2",children:r}),(0,y.jsx)("h2",{className:"mt-1 truncate text-[18px] font-medium leading-6 text-text",title:i,children:o}),(0,y.jsx)("div",{className:"truncate font-mono text-[12px] leading-4 text-text-2",title:a,children:a})]}),(0,y.jsx)("button",{type:"button",onClick:s,"aria-label":"Close the panel",className:"shrink-0 rounded-md p-1 text-text-2 hover:bg-surface hover:text-text",children:(0,y.jsx)(l2,{"aria-hidden":!0,size:16,stroke:1.75})})]}),l]}),u,n&&(0,y.jsx)("p",{role:"alert","data-covers":!0,className:"pointer-events-none sticky bottom-0 shrink-0 border-t border-hairline bg-panel px-4 py-2 text-center text-[13px] text-danger [overflow-wrap:anywhere]",children:n})]})}function sv({path:e,level:t,indexVersion:n,onFocus:r,onOpen:o,onClose:i,onOpenInEditor:a,covers:l,alert:s}){let[u,d]=(0,v.useState)(null),[c,h]=(0,v.useState)(null),[f,p]=(0,v.useState)(null),[g,m]=(0,v.useState)(null),[x,b]=(0,v.useState)(!1),w=(0,v.useRef)(new Set),[E,k]=(0,v.useState)(null);(0,v.useEffect)(()=>{},[]),(0,v.useEffect)(()=>{let t=new AbortController;return am.describe(e,t.signal).then(e=>{d(e),h(null)},e=>{e instanceof ac&&h(e)}),()=>t.abort()},[e,n]),(0,v.useEffect)(()=>{u&&so("map:select")},[u]);let _=(e,t)=>{b(!0),am.summarize(e).then(e=>{p(e),b(!1)},e=>{b(!1),e instanceof ac&&("NOT_READY"===e.code&&t?.(),m(e))})};(0,v.useEffect)(()=>{var e;if(null===u||"pending"!==(e=u.summaryStatus)&&"stale"!==e)return;let t=`${u.path}@${u.indexVersion}`;w.current.has(u.path)||w.current.has(t)||(w.current.add(t),_(u.path,()=>w.current.add(u.path)))},[u]);let j=(0,lZ.d)(e,t.repo),S=u?sm[u.kind]:"",[M,N]=(0,v.useState)(null),C=(0,v.useCallback)(()=>N(null),[]);return(0,y.jsxs)(sy,{path:e,alert:s,covers:l,kindLabel:S,name:j,title:e||j,subtitle:e||"(repo root)",header:u&&(0,y.jsx)(sE,{data:u,github:E,onOpen:o,onViewSource:()=>N({}),onOpenInEditor:a&&(()=>a(u.path))}),onClose:i,children:[(0,y.jsxs)("div",{className:`flex-1 space-y-6 overflow-y-auto px-4 py-4 text-[14px] leading-normal text-text ${sg}`,children:[c&&(0,y.jsx)("p",{className:"text-danger",children:c.message}),!u&&!c&&(0,y.jsx)("p",{className:"text-text-2",children:"Loading…"}),u&&(0,y.jsx)(sk,{data:u,fresh:f,refreshing:x,summaryError:g,onRetry:()=>{null!==u&&(m(null),_(u.path))},onFocus:r,onOpen:o,onViewLines:a?e=>a(u.path,e):(e,t)=>N({lines:{start:e,end:t}})})]}),M&&u?.kind==="file"&&(0,y.jsx)(sp,{path:u.path,lines:M.lines,onClose:C,onOpenInEditor:a&&(e=>a(u.path,e))})]})}function sb({portal:e,path:t,level:n,onFocus:r,onTurnPage:o,onClose:i,covers:a,alert:l}){let s=si(n.edges,e.path),u=function(e,t){let n=new Map;for(let r of e.edges){let e=r.source===t?r.target:r.target===t?r.source:null;null!==e&&n.set(e,(n.get(e)??0)+r.count)}let r=new Map(e.nodes.map((e,t)=>[e.path,t]));return[...n.entries()].map(([e,t])=>({path:e,count:t})).sort((e,t)=>t.count-e.count||(r.get(e.path)??0)-(r.get(t.path)??0))}(n,e.path),d=void 0!==e.page?[e.page]:e.pages??[],c=new Map(n.nodes.map(e=>[e.path,e]));return(0,v.useEffect)(()=>{so("map:select")},[]),(0,y.jsx)(sy,{path:t,alert:l,covers:a,kindLabel:1===d.length?"Page":"Pages",name:e.name,title:e.name,subtitle:`${n.path||"(repo root)"} \xb7 page ${n.page+1} of ${n.pageCount}`,header:(0,y.jsxs)("p",{className:"mt-3 text-[13px] text-text-2",children:[sl(e,s)," with this page"]}),onClose:i,children:(0,y.jsxs)("div",{className:`flex-1 space-y-6 overflow-y-auto px-4 py-4 text-[14px] leading-normal text-text ${sg}`,children:[(0,y.jsxs)("section",{"aria-label":"Go to",children:[d.length>1&&(0,y.jsx)(sS,{title:"Pages behind this doorway",count:d.length}),(0,y.jsx)("ul",{className:"flex flex-wrap gap-2",children:d.map(e=>(0,y.jsx)("li",{children:(0,y.jsxs)("button",{type:"button","data-go-page":e,onClick:()=>o(e),className:"inline-flex items-center gap-1.5 rounded-md border border-control/60 px-3 py-1.5 text-[13px] text-control hover:border-control",children:[e<n.page&&(0,y.jsx)(ax,{"aria-hidden":!0,size:14,stroke:1.75}),1===d.length?`Go to page ${e+1}`:`Page ${e+1}`,e>n.page&&(0,y.jsx)(lQ,{"aria-hidden":!0,size:14,stroke:1.75})]})},e))})]}),(0,y.jsx)(sC,{title:"Linked from this page",items:u,empty:"No lines from this page.",render:({path:t,count:n})=>(0,y.jsx)("li",{children:(0,y.jsxs)("button",{type:"button","data-linked":t,title:`${t}: ${l3(n)} import${1===n?"":"s"} with ${e.name}`,onClick:()=>r(t),className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-left hover:bg-surface",children:[(0,y.jsx)(sw,{box:c.get(t)}),(0,y.jsx)("span",{className:"min-w-0 flex-1 truncate",children:c.get(t)?.name??t}),(0,y.jsx)("span",{className:"shrink-0 text-[12px] text-text-2",children:l3(n)})]})},t)})]})})}function sw({box:e}){let t=e?.kind==="folder";return(0,y.jsx)(t?l1:l0,{"aria-hidden":!0,size:16,stroke:1.75,className:`shrink-0 ${t?"text-folder":"text-text-2"}`})}function sE({data:e,github:t,onOpen:n,onViewSource:r,onOpenInEditor:o}){let i=`${function(e){if(e<1e3)return String(e);let t=0;for(;t<l5.length-1&&e>=l5[t+1][1];)t++;let n=Math.round(e/l5[t][1]*10)/10;return n>=1e3&&t<l5.length-1&&(n=Math.round(e/l5[++t][1]*10)/10),`${n}${l5[t][0]}`}(e.stats.lineCount)} ${1===e.stats.lineCount?"line":"lines"}`,a="file"===e.kind?i:`${l3(e.stats.fileCount)} ${1===e.stats.fileCount?"file":"files"} \xb7 ${i}`;return(0,y.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-x-3 gap-y-1 text-[13px] text-text-2",children:[(0,y.jsx)("span",{children:a}),e.stalePaths>0&&(0,y.jsxs)("span",{children:[l3(e.stalePaths)," changed since summarized"]}),"folder"===e.kind&&(0,y.jsx)("button",{type:"button",onClick:()=>n(e.path),className:"text-control underline underline-offset-2 hover:text-text",children:"Open folder"}),"file"===e.kind&&!1,"file"===e.kind&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("button",{type:"button",onClick:r,className:"inline-flex items-center gap-1 text-control underline underline-offset-2 hover:text-text",children:[(0,y.jsx)(lJ,{"aria-hidden":!0,size:14,stroke:1.75}),"View source"]}),o?(0,y.jsx)("button",{type:"button",onClick:o,className:"text-control underline underline-offset-2 hover:text-text",children:"Open in VS Code"}):(0,y.jsx)("a",{href:st(e),className:"text-control underline underline-offset-2 hover:text-text",children:"Open in VS Code"})]})]})}function sk({data:e,fresh:t,refreshing:n,summaryError:r,onRetry:o,onFocus:i,onOpen:a,onViewLines:l}){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(s_,{data:e,fresh:t,refreshing:n,summaryError:r,onRetry:o}),(0,y.jsxs)("section",{"aria-label":"Relationships",className:"space-y-4",children:[(0,y.jsx)(sM,{title:"Depends on",note:"What this box uses: its arrows point to these · by number of imports",items:e.uses,empty:"Imports nothing outside itself.",onFocus:i}),(0,y.jsx)(sM,{title:"Used by",note:"What uses this box: their arrows point here · by number of imports, test files included",items:e.usedBy,empty:"Nothing outside it imports it.",onFocus:i})]}),e.children&&(0,y.jsx)(sC,{title:"Contents",items:e.children,render:e=>(0,y.jsx)(sN,{child:e,onFocus:i,onOpen:a},e.path)}),e.symbols&&(0,y.jsx)(sC,{title:"Declarations",items:e.symbols,empty:e.importsOnly?"Not read (over the 1 MB size cap; imports only).":"None found.",render:e=>(0,y.jsx)("li",{children:(0,y.jsxs)("button",{type:"button",title:`Show ${e.name} in the source`,onClick:()=>l(e.startLine,e.endLine),className:"flex w-full items-baseline justify-between gap-3 rounded-md px-2 py-1 text-left hover:bg-surface",children:[(0,y.jsx)("span",{className:`truncate font-mono text-[13px] ${e.exported?"text-text":"text-text-2"}`,children:e.name}),(0,y.jsxs)("span",{className:"shrink-0 text-[12px] text-text-2",children:[e.kind," · line ",e.startLine]})]})},`${e.name}:${e.startLine}`)})]})}function s_({data:e,fresh:t,refreshing:n,summaryError:r,onRetry:o}){var i;let[a,l]=(0,v.useState)(!1),s=t??e,{lead:u,rest:d}=(0,sd.z)(s.summary??""),c=(i=s.summaryError,i??(r&&!ss.has(r.code)?r.message:null));return(0,y.jsxs)("section",{"aria-label":"Summary",className:"[overflow-wrap:anywhere]",children:[s.tagline?(0,y.jsx)("p",{className:"text-[15px] font-medium leading-snug text-title",children:(0,y.jsx)(sj,{text:s.tagline})}):(0,y.jsx)("p",{className:"text-text-2",children:function(e,t){if(t?.code==="NOT_READY")return"Waiting for what's inside to be summarized first.";if(t?.code==="SUMMARIES_OFF")return t.message;switch(e){case"off":return"Summaries are off: ANTHROPIC_API_KEY isn't set. With a key, each file and folder gets a short plain-language summary here, and search can match by meaning.";case"failed":return"The last attempt to summarize this failed.";case"pending":return"Summarizing…";default:return""}}(s.summaryStatus,r)}),u&&(0,y.jsx)("p",{className:"mt-2 text-text-body",children:(0,y.jsx)(sj,{text:u})}),d&&a&&d.split(/\n\s*\n/).map((e,t)=>(0,y.jsx)("p",{className:"mt-2 text-text-body",children:(0,y.jsx)(sj,{text:e})},t)),d&&(0,y.jsx)("button",{type:"button","aria-expanded":a,onClick:()=>l(e=>!e),className:"mt-2 text-[13px] text-control underline underline-offset-2 hover:text-text",children:a?"Show less":"Read full summary"}),(0,y.jsxs)("div",{className:"mt-2 space-y-1 text-[13px] text-text-2",children:[n&&s.tagline&&(0,y.jsx)("p",{children:"Refreshing…"}),"stale"===s.summaryStatus&&!n&&(0,y.jsx)("p",{children:"Out of date: this changed since it was summarized."}),s.summary&&"file"===e.kind&&(0,y.jsx)("p",{className:"text-[12px]",children:"Import counts in this summary leave out test files."}),c&&(0,y.jsxs)("p",{className:"text-danger",children:[c," ",(0,y.jsx)("button",{type:"button",onClick:o,className:"text-control underline underline-offset-2 hover:text-text",children:"Try again"})]})]})]})}function sj({text:e}){return(0,y.jsx)(y.Fragment,{children:(0,sd.X)(e).map((e,t)=>e.code?(0,y.jsx)("code",{className:"rounded-md bg-code-bg box-decoration-clone px-1 font-mono text-[13px] text-code",children:e.text},t):(0,y.jsx)("span",{children:e.text},t))})}function sS({title:e,count:t,note:n,large:r=!1}){return(0,y.jsxs)("div",{className:"mb-2",children:[(0,y.jsxs)("h3",{className:`${r?"text-[15px]":"text-[13px]"} font-medium text-text`,children:[e," ",(0,y.jsx)("span",{className:"font-normal text-text-2",children:l3(t)})]}),n&&(0,y.jsx)("p",{className:"text-[12px] text-text-2",children:n})]})}function sM({title:e,note:t,items:n,empty:r,onFocus:o}){let[i,a]=(0,v.useState)(!1),l=i?n:n.slice(0,8);return(0,y.jsxs)("div",{children:[(0,y.jsx)(sS,{title:e,count:n.length,note:t,large:!0}),0===n.length?(0,y.jsx)("p",{className:"text-[13px] text-text-2",children:r}):(0,y.jsxs)("ul",{className:"flex flex-wrap gap-2",children:[l.map(e=>(0,y.jsx)("li",{className:"min-w-0",children:(0,y.jsxs)("button",{type:"button","data-chip":e.path,title:`${e.path}: ${l3(e.count)} import${1===e.count?"":"s"}`,onClick:()=>o(e.path),className:"flex max-w-[min(360px,100%)] items-center gap-2 rounded-md border border-border bg-surface px-2 py-1 text-[13px] text-text hover:border-text-2",children:[(0,y.jsx)("span",{className:"truncate",children:(0,lZ.k)(e.path)}),(0,y.jsx)("span",{className:"shrink-0 text-text-2",children:l3(e.count)})]})},e.path)),n.length>8&&(0,y.jsx)("li",{children:(0,y.jsx)("button",{type:"button","aria-expanded":i,onClick:()=>a(e=>!e),className:"rounded-md border border-dashed border-border px-2 py-1 text-[13px] text-text-2 hover:text-text",children:i?"Show fewer":`+${l3(n.length-8)} more`})})]})]})}function sN({child:e,onFocus:t,onOpen:n}){let r="folder"===e.kind;return(0,y.jsx)("li",{children:(0,y.jsxs)("button",{type:"button","data-child":e.path,title:e.tagline?`${e.path}: ${e.tagline}`:e.path,onClick:()=>r?n(e.path):t(e.path),className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-left hover:bg-surface",children:[(0,y.jsx)(r?l1:l0,{"aria-hidden":!0,size:16,stroke:1.75,className:`shrink-0 ${r?"text-folder":"text-text-2"}`}),(0,y.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.name}),r&&(0,y.jsxs)("span",{className:"shrink-0 text-[12px] text-text-2",children:[l3(e.fileCount)," ",1===e.fileCount?"file":"files"]})]})})}function sC({title:e,items:t,render:n,empty:r}){let[o,i]=(0,v.useState)(!1);return 0===t.length&&void 0===r?null:(0,y.jsxs)("section",{"aria-label":e,children:[(0,y.jsx)(sS,{title:e,count:t.length}),0===t.length?(0,y.jsx)("p",{className:"text-[13px] text-text-2",children:r}):(0,y.jsx)("ul",{className:"-mx-2",children:(o?t:t.slice(0,8)).map(n)}),t.length>8&&(0,y.jsx)("button",{type:"button","aria-expanded":o,onClick:()=>i(e=>!e),className:"mt-2 text-[13px] text-control underline underline-offset-2 hover:text-text",children:o?"Show fewer":`View all ${l3(t.length)}`})]})}function s$({onClose:e}){return sf(),(0,v.useEffect)(()=>{let t=t=>{"Escape"===t.key&&(t.stopImmediatePropagation(),e())};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e]),(0,rz.createPortal)((0,y.jsx)("div",{"data-testid":"help",className:"fixed inset-0 z-50 flex items-center justify-center bg-canvas/70 p-4 max-[360px]:p-2",onClick:e,children:(0,y.jsxs)("div",{role:"dialog","aria-label":"How to use the Map",onClick:e=>e.stopPropagation(),className:"max-h-[85vh] w-[760px] max-w-full overflow-y-auto rounded-lg border border-border bg-panel p-6 max-[360px]:p-4",children:[(0,y.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,y.jsxs)("div",{children:[(0,y.jsx)("h2",{className:"text-[18px] font-medium text-text",children:"How to use the Map"}),!1,(0,y.jsx)("p",{className:"mt-1 text-[14px] text-text-2",children:"A map of the repo's folders and files, and of which code imports which. Open this again with the ? button at the top right, or the ? key."})]}),(0,y.jsx)("button",{type:"button",onClick:e,"aria-label":"Close help",className:"shrink-0 rounded-md p-1 text-text-2 hover:bg-surface hover:text-text",children:(0,y.jsx)(l2,{"aria-hidden":!0,size:16,stroke:1.75})})]}),(0,y.jsxs)("div",{className:"mt-6 grid gap-x-8 gap-y-6 text-[14px] leading-normal text-text sm:grid-cols-2",children:[(0,y.jsxs)(sO,{title:"Getting around",children:[(0,y.jsxs)("li",{children:[(0,y.jsx)("b",{children:"Click"})," a box to see what it is, in the panel on the right."]}),(0,y.jsxs)("li",{children:[(0,y.jsx)("b",{children:"Double-click"})," a folder to go inside it."]}),(0,y.jsxs)("li",{children:["Go back up with the path at the top left, ",(0,y.jsx)(sP,{children:"Backspace"}),", or your browser's Back button. The repo's name at the very top goes back to the start."]}),(0,y.jsxs)("li",{children:["Big folders are split into pages of related boxes: turn the page with the arrows at the top right, or ",(0,y.jsx)(sP,{children:"←"})," ",(0,y.jsx)(sP,{children:"→"}),"."]}),(0,y.jsx)("li",{children:"A busy folder opens at a readable size, from its top: drag to see the rest, or press the fit button at the bottom right to see it all."}),(0,y.jsxs)("li",{children:["Search files and concepts with ",(0,y.jsx)(sP,{children:"Ctrl K"})," (",(0,y.jsx)(sP,{children:"⌘K"})," on a Mac)."]})]}),(0,y.jsxs)(sO,{title:"Reading the Map",children:[(0,y.jsx)("li",{children:"A box is a folder (with how many files it holds) or a file."}),(0,y.jsxs)("li",{children:["A line from A to B means A uses code from B: the arrow points at what's being used. A box's panel lists both sides: ",(0,y.jsx)("b",{children:"Depends on"})," (what it uses) and ",(0,y.jsx)("b",{children:"Used by"})," (what uses it)."]}),(0,y.jsx)("li",{children:'Hover a box to see its summary and preview its lines. Hover a line to read it as a sentence, like "editor uses base · 12 imports".'}),(0,y.jsxs)("li",{children:["Busy folders (more than 60 lines) draw only the lines of the box you hover or select. ",(0,y.jsx)("b",{children:"Show all lines"}),", at the top right, brings back the rest."]}),(0,y.jsx)("li",{children:'Boxes with no lines on the page sit under a line that says "Not linked to anything on this page".'}),(0,y.jsx)("li",{children:'Lines to other pages end at a doorway, a dashed box like "Lines to page 2"; double-click it to go there.'})]}),(0,y.jsxs)(sO,{title:"Colors",children:[(0,y.jsxs)("li",{children:[(0,y.jsx)(sA,{className:"border-2 border-select bg-select-fill"})," Purple: the box you selected and its lines. Everything else fades."]}),(0,y.jsxs)("li",{children:[(0,y.jsx)(sA,{className:"outline-2 outline-offset-1 outline-agent"})," Orange: what Claude Code is touching right now."]}),(0,y.jsxs)("li",{children:[(0,y.jsx)(sA,{className:"rounded-full bg-control"})," Cyan: something you can click, like a link or the Map's buttons."]}),(0,y.jsxs)("li",{children:[(0,y.jsx)(sA,{className:"rounded-full bg-ok"})," Green: the index is up to date."]}),(0,y.jsxs)("li",{children:[(0,y.jsx)(sA,{className:"rounded-full bg-danger"})," Red: something failed."]})]}),(0,y.jsxs)(sO,{title:"The details panel",children:[(0,y.jsxs)("li",{children:["A short summary; ",(0,y.jsx)("b",{children:"Read full summary"})," shows the rest."]}),(0,y.jsxs)("li",{children:[(0,y.jsx)("b",{children:"Depends on"})," and ",(0,y.jsx)("b",{children:"Used by"}),": click one to jump to it on the Map."]}),(0,y.jsxs)("li",{children:[(0,y.jsx)("b",{children:"Contents"}),": click a folder to go in, or a file to select it."]}),(0,y.jsxs)("li",{children:["For a file, ",(0,y.jsx)("b",{children:"View source"})," shows its code; click a declaration to jump to it there."]})]}),(0,y.jsx)(sO,{title:"Claude Code",children:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("li",{children:"The bar along the bottom shows Claude Code's last 3 tool calls, newest first."}),(0,y.jsx)("li",{children:"Boxes holding what it touched get an orange ring for 30 seconds."})]})}),(0,y.jsx)(sO,{title:"The index",children:(0,y.jsxs)("li",{children:["The status at the top right says whether the index is up to date. Click it for each stage",", and to re-index."]})})]}),(0,y.jsx)("h3",{className:"mt-6 text-[13px] font-medium text-title",children:"Keyboard"}),(0,y.jsxs)("dl",{className:"mt-2 grid grid-cols-[max-content_1fr] gap-x-4 gap-y-1 text-[13px] text-text-2 max-[360px]:grid-cols-1 max-[360px]:[&_dd]:mb-1.5",children:[(0,y.jsx)("dt",{children:(0,y.jsx)(sP,{children:"Ctrl K"})}),(0,y.jsx)("dd",{children:"Search files and concepts"}),(0,y.jsx)("dt",{children:(0,y.jsx)(sP,{children:"Esc"})}),(0,y.jsx)("dd",{children:"Close what's open, let go of the selection, then clear Claude Code's highlights"}),(0,y.jsx)("dt",{children:(0,y.jsx)(sP,{children:"Backspace"})}),(0,y.jsx)("dd",{children:"Up one folder"}),(0,y.jsxs)("dt",{children:[(0,y.jsx)(sP,{children:"←"})," ",(0,y.jsx)(sP,{children:"→"})]}),(0,y.jsx)("dd",{children:"Previous or next page of a big folder"}),(0,y.jsx)("dt",{children:(0,y.jsx)(sP,{children:"?"})}),(0,y.jsx)("dd",{children:"This help"})]})]})}),document.body)}function sO({title:e,children:t}){return(0,y.jsxs)("section",{children:[(0,y.jsx)("h3",{className:"text-[13px] font-medium text-title",children:e}),(0,y.jsx)("ul",{className:"mt-2 space-y-1.5 text-text-body [&_b]:font-medium [&_b]:text-text",children:t})]})}function sP({children:e}){return(0,y.jsx)("kbd",{className:"rounded-md border border-border bg-surface px-1.5 py-px font-sans text-[12px] text-text",children:e})}function sA({className:e}){return(0,y.jsx)("span",{"aria-hidden":!0,className:`mr-1 inline-block h-3 w-3 rounded-sm align-[-1px] ${e}`})}let sR="mcp__nebulosity__";function sz(e){let t=""===e[0]?"the repo":e[0];return e.length>1?`${t} +${e.length-1}`:t}function sL(e){let t=e.tool.startsWith(sR)?e.tool.slice(sR.length):e.tool,{paths:n}=e,r=n.length>0;switch(t){case"describe":return r?`Reading ${sz(n)}`:"Reading";case"overview":return"Reading the repo overview";case"search":return r?`Searching \xb7 ${sz(n)}`:"Searching";case"imports":return n.length>=2?`Tracing ${n[0]} → ${n[1]}`:r?`Following the imports of ${sz(n)}`:"Following imports";case"architecture":return r?`Reading how ${sz(n)} is organized`:"Reading how the code is organized";case"calls":return r?`Following the calls into ${sz(n)}`:"Following calls";case"show_on_map":return r?`Showing ${sz(n)} on the map`:"Showing on the map";default:return r?`${t} \xb7 ${sz(n)}`:t}}let sI=["","max-[640px]:hidden","max-[900px]:hidden"],sD="@max-[64px]:hidden";function sB({recent:e,connected:t,highlightCount:n,onClear:r}){let[o,i]=(0,v.useState)(0);(0,v.useEffect)(()=>{let e=setInterval(()=>i(Date.now()),1e3);return()=>clearInterval(e)},[]);let a=0===n?null:`${n.toLocaleString("en-US")} highlighted`,l=t?"No tool calls yet":"Not connected";return(0,y.jsxs)("footer",{"data-testid":"activity-bar",className:"relative z-20 flex h-8 shrink-0 items-center gap-4 border-t border-hairline bg-panel px-4 text-[13px]",children:[(0,y.jsxs)("span",{className:"flex shrink-0 items-center gap-2 text-text-2",title:t?"Claude Code: connected to the live channel":"Claude Code: not connected to the live channel",children:[(0,y.jsx)("span",{"aria-hidden":!0,className:`h-2 w-2 rounded-full ${t?"bg-text-2":"border border-text-2"}`}),(0,y.jsx)("span",{className:e.length>0?"max-[520px]:hidden":void 0,children:"Claude Code"})]}),0===e.length?(0,y.jsx)("span",{className:"min-w-0 truncate text-text-2",title:l,children:l}):(0,y.jsx)("ol",{"aria-label":"Claude Code's last actions",className:"flex min-w-0 flex-1 items-center gap-6",children:e.map((t,n)=>{let r;return(0,y.jsxs)("li",{className:`flex min-w-0 items-center gap-2 ${sI[n]??""} ${n>0?"max-[900px]:@container max-[900px]:basis-0 max-[900px]:grow":""}`,children:[(0,y.jsx)("span",{"aria-hidden":!0,className:`h-2 w-2 shrink-0 rounded-full bg-agent ${n>0?sD:""}`}),(0,y.jsx)("span",{className:`truncate ${0===n?"text-text":`text-text-2 ${sD}`}`,title:0===n?function(e,t){let n=e=>t>0?` \xb7 ${l4(Math.max(0,t-Date.parse(e.at)))}`:"",[r,...o]=e;return void 0===r?"":[`${sL(r)}${n(r)}`,...r.paths.length>1?r.paths:[],...o.map(e=>`Earlier: ${sL(e)}${n(e)}`)].join("\n")}(e,o):(r=sL(t),t.paths.length>1?[r,...t.paths].join("\n"):r),children:sL(t)}),o>0&&(0,y.jsx)("span",{className:`shrink-0 text-[12px] text-text-2 max-[520px]:hidden ${n>0?"@max-[136px]:hidden":""}`,children:l4(Math.max(0,o-Date.parse(t.at)))})]},`${t.at}\0${n}`)})}),null!==a&&(0,y.jsxs)("span",{className:"ml-auto flex shrink-0 items-center gap-3 text-text-2",children:[a,(0,y.jsx)("button",{type:"button",onClick:r,className:"text-control hover:underline",title:"Clear Claude Code's highlights (Esc)",children:"Clear"})]})]})}let sT=e=>`${e.source}->${e.target}`;function sH(e,t){let n=new Set;if(null===t)return n;for(let r of e)r.source===t?n.add(r.target):r.target===t&&n.add(r.source);return n}let sV=as("outline","focus-centered","FocusCentered",[["path",{d:"M11 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M4 8v-2a2 2 0 0 1 2 -2h2",key:"svg-1"}],["path",{d:"M4 16v2a2 2 0 0 0 2 2h2",key:"svg-2"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v2",key:"svg-3"}],["path",{d:"M16 20h2a2 2 0 0 0 2 -2v-2",key:"svg-4"}]]);function sF(e,t){let{width:n,height:r}=e.getBoundingClientRect();return null!==t&&t.width===n&&t.height===r?t:{width:n,height:r}}function sq(){let e=(0,v.useRef)(null),[t,n]=(0,v.useState)(null),[r,o]=(0,v.useState)(null),i=(0,v.useCallback)(t=>{e.current=t,n(t)},[]);return(0,v.useLayoutEffect)(()=>{let t=e.current;if(null===t)return;let n=sF(t,r);n!==r&&o(n)}),(0,v.useEffect)(()=>{if(null===t)return;let e=new ResizeObserver(()=>o(e=>sF(t,e)));return e.observe(t),()=>e.disconnect()},[t]),[i,r]}let sX="rounded-md px-2.5 py-1 text-[14px] text-control hover:bg-overlay-line";function sW({box:e,position:t,onOpen:n,onTurnPage:r,onDetails:o}){var i,a,l;let s,[u,d]=sq(),[c,h,f]=rB(e=>e.transform),p=rB(e=>e.width),g=rB(e=>e.height),m=(i={left:t.x*f+c,top:t.y*f+h,width:232*f,height:56*f},a=d??{width:0,height:0},s="bottom"==(l=i.top,l+i.height/2<g/2?"bottom":"top")?i.top+i.height+8:i.top-8-a.height,{left:Math.min(Math.max(i.left+i.width/2-a.width/2,8),p-8-a.width),top:s}),x="portal"===e.kind?e.page:void 0;return(0,y.jsxs)("div",{ref:u,"data-box-actions":e.path,style:{left:m.left,top:m.top,visibility:null===d?"hidden":void 0},className:"absolute z-[6] flex items-center gap-1 rounded-lg bg-overlay p-1",children:["folder"===e.kind&&(0,y.jsx)("button",{type:"button",onClick:()=>n(e.path),title:"Open this folder (or double-click it)",className:sX,children:"Open"}),void 0!==x&&(0,y.jsxs)("button",{type:"button",onClick:()=>r(x),title:`Go to page ${x+1} (or double-click the doorway)`,className:sX,children:["Go to page ",x+1]}),(0,y.jsx)("button",{type:"button",onClick:()=>o(e.path),title:"Show its details over the Map",className:sX,children:"Details"})]})}let sY=[{type:"target",position:g.Top,x:115.5,y:0,width:1,height:1},{type:"source",position:g.Bottom,x:115.5,y:55,width:1,height:1}];function sK(e,t,n){let r=new Map(e.map(e=>[e.id,e])),o=e.length===t.length,i=t.map((t,i)=>{let a=r.get(t.id);return void 0!==a&&n(a,t)?(e[i]!==a&&(o=!1),a):(o=!1,t)});return o?e:i}function sU(e,t){return e.position.x===t.position.x&&e.position.y===t.position.y&&e.data.box===t.data.box&&e.data.tone===t.data.tone&&e.data.agent===t.data.agent&&e.data.pulseKey===t.data.pulseKey&&e.data.portal===t.data.portal}function sZ(e,t){return e.source===t.source&&e.target===t.target&&e.data?.points===t.data?.points&&e.label===t.label&&e.style?.stroke===t.style?.stroke&&e.style?.strokeWidth===t.style?.strokeWidth&&e.style?.opacity===t.style?.opacity&&e.markerEnd?.color===t.markerEnd?.color}let sG=as("outline","chevron-down","ChevronDown",[["path",{d:"M6 9l6 6l6 -6",key:"svg-0"}]]),sQ=as("outline","chevron-up","ChevronUp",[["path",{d:"M6 15l6 -6l6 6",key:"svg-0"}]]),sJ="nebulosity.legendOpen";function s0(){try{return"1"===window.localStorage.getItem(sJ)}catch{return!1}}function s1({quietLines:e,doorways:t,maxHeight:n}){let[r,o]=(0,v.useState)(s0),i=r?sG:sQ;return(0,y.jsxs)("div",{"aria-label":"Legend",style:{maxHeight:n},className:`nopan nodrag nowheel absolute bottom-4 left-4 z-[5] flex flex-col ${r?"w-[252px]":""} rounded-lg bg-overlay text-[12px] text-overlay-text-2`,children:[r&&(0,y.jsxs)("div",{className:"min-h-0 space-y-1.5 overflow-y-auto border-b border-overlay-line px-3 py-2",children:[(0,y.jsx)(s2,{glyph:(0,y.jsx)(s3,{color:"var(--text-2)"}),children:"A → B: A uses B. The arrow points at what's being used."}),(0,y.jsx)(s2,{glyph:(0,y.jsx)(s3,{color:"var(--select)"}),children:"Selected box and its lines"}),(0,y.jsx)(s2,{glyph:(0,y.jsx)("span",{className:"block h-3 w-3 rounded-sm outline-2 outline-agent"}),children:"What Claude Code is touching"}),t&&(0,y.jsx)(s2,{glyph:(0,y.jsx)("span",{className:"block h-3 w-5 rounded-sm border border-dashed border-text-2"}),children:"Dashed box: a doorway to another page"}),e&&(0,y.jsx)(s2,{glyph:(0,y.jsx)("span",{"aria-hidden":!0,className:"text-[14px] leading-none",children:"⋯"}),children:"Busy folder: hover a box to see its lines"})]}),(0,y.jsxs)("button",{type:"button","data-testid":"legend-toggle",onClick:()=>{let e=!r;o(e);try{window.localStorage.setItem(sJ,e?"1":"0")}catch{}},"aria-expanded":r,className:"flex w-full shrink-0 items-center justify-between gap-3 rounded-lg px-3 py-1.5 text-[12px] font-medium text-control hover:bg-overlay-line",children:["Legend",(0,y.jsx)(i,{"aria-hidden":!0,size:16,stroke:1.75})]})]})}function s2({glyph:e,children:t}){return(0,y.jsxs)("div",{className:"flex items-start gap-2",children:[(0,y.jsx)("span",{"aria-hidden":!0,className:"flex h-4 w-6 shrink-0 items-center justify-center",children:e}),(0,y.jsx)("span",{className:"leading-4",children:t})]})}function s3({color:e}){return(0,y.jsxs)("svg",{width:"24",height:"8",viewBox:"0 0 24 8",style:{color:e},children:[(0,y.jsx)("line",{x1:"0",y1:"4",x2:"18",y2:"4",stroke:"currentColor",strokeWidth:"1.5"}),(0,y.jsx)("path",{d:"M17 0.5 L24 4 L17 7.5 Z",fill:"currentColor"})]})}let s5=as("outline","stack-2","Stack2",[["path",{d:"M12 4l-8 4l8 4l8 -4l-8 -4",key:"svg-0"}],["path",{d:"M4 12l8 4l8 -4",key:"svg-1"}],["path",{d:"M4 16l8 4l8 -4",key:"svg-2"}]]),s4={normal:"border border-border bg-surface px-3",linked:"border border-border bg-surface px-3",preview:"border border-text-2 bg-surface px-3",selected:"border-2 border-select bg-select-fill px-[11px]",faded:"border border-border bg-surface px-3 opacity-60"},s6={normal:"border border-dashed border-text-2 bg-transparent px-3",linked:"border border-dashed border-text-2 bg-transparent px-3",preview:"border border-dashed border-text bg-transparent px-3",selected:"border-2 border-dashed border-select bg-select-fill px-[11px]",faded:"border border-dashed border-text-2 bg-transparent px-3 opacity-60"},s8={previous:ax,next:lQ,many:s5},s7=(0,v.memo)(function({data:e}){let t,{box:n,tone:r,agent:o,pulseKey:i,portal:a}=e,l=a?s8[a.direction]:"folder"===n.kind?l1:l0,s=a?`${a.title}: ${a.caption}. ${"many"===a.direction?"Select it to pick a page.":"Double-click to go there."}`:(t=n.path||n.name,n.tagline?`${t}: ${n.tagline}`:t);return(0,y.jsxs)("div",{"data-box":n.path,"data-tone":r,title:s,className:`relative flex h-[56px] w-[232px] items-center gap-2 rounded-lg ${a?s6[r]:s4[r]} ${o?"outline-2 outline-offset-2 outline-agent":""}`,children:[i>0&&(0,y.jsx)("span",{"aria-hidden":!0,className:"neb-pulse pointer-events-none absolute inset-0 rounded-lg"},i),(0,y.jsx)(l,{"aria-hidden":!0,size:16,stroke:1.75,className:`shrink-0 ${"folder"===n.kind?"text-folder":"text-text-2"}`}),(0,y.jsxs)("div",{className:"min-w-0",children:[(0,y.jsx)("div",{className:"truncate text-[15px] font-medium leading-5 text-text",children:a?a.title:n.name}),a&&(0,y.jsx)("div",{className:"truncate text-[12px] leading-4 text-text-2",children:a.caption}),"folder"===n.kind&&(0,y.jsxs)("div",{className:"text-[12px] leading-4 text-text-2",children:[l3(n.fileCount)," ",1===n.fileCount?"file":"files"]})]}),(0,y.jsx)(oB,{type:"target",position:g.Top,className:"!opacity-0"}),(0,y.jsx)(oB,{type:"source",position:g.Bottom,className:"!opacity-0"})]})});function s9(e,t,n){let r=Math.hypot(t.x-e.x,t.y-e.y);return{x:e.x+(t.x-e.x)*n/r,y:e.y+(t.y-e.y)*n/r}}let ue=(0,v.memo)(function({id:e,sourceX:t,sourceY:n,targetX:r,targetY:o,data:i,style:a,markerEnd:l,label:s,interactionWidth:u}){let d=i&&i.points.length>=2?i.points:[{x:t,y:n},{x:r,y:o}],c=function(e){let t=e.slice(1).map((t,n)=>Math.hypot(t.x-e[n].x,t.y-e[n].y)),n=t.reduce((e,t)=>e+t,0)/2;for(let r=0;r<t.length;r++){if(n<=t[r])return s9(e[r],e[r+1],n);n-=t[r]}return e[e.length-1]}(d);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(o4,{id:e,path:function(e,t=8){if(e.length<2)return"";let n=`M ${e[0].x} ${e[0].y}`;for(let r=1;r<e.length-1;r++){let[o,i,a]=[e[r-1],e[r],e[r+1]],l=Math.min(t,Math.hypot(i.x-o.x,i.y-o.y)/2,Math.hypot(a.x-i.x,a.y-i.y)/2),s=s9(i,o,l),u=s9(i,a,l);n+=` L ${s.x} ${s.y} Q ${i.x} ${i.y} ${u.x} ${u.y}`}let r=e[e.length-1];return`${n} L ${r.x} ${r.y}`}(d),style:a,markerEnd:l,interactionWidth:u}),s&&(0,y.jsx)(iV,{children:(0,y.jsx)("div",{"data-edge-label":e,style:{transform:`translate(-50%, -50%) translate(${c.x}px, ${c.y}px)`,zIndex:1001},className:"pointer-events-none absolute rounded-md border border-border bg-surface px-1.5 py-0.5 text-[12px] text-text",children:s})})]})}),ut={box:s7},un={routed:ue},ur={padding:.15,maxZoom:1},uo={normal:{stroke:"var(--neutral-edge)",arrow:"var(--text-2)",width:1,opacity:1,layer:0},faded:{stroke:"var(--neutral-edge)",arrow:"var(--neutral-edge)",width:1,opacity:.35,layer:0},preview:{stroke:"var(--text-2)",arrow:"var(--text)",width:1.5,opacity:1,layer:1},selected:{stroke:"var(--select)",arrow:"var(--select)",width:1.5,opacity:1,layer:2}};function ui({divider:e}){return(0,y.jsxs)("div",{"data-testid":"loose-divider","aria-hidden":!0,style:{position:"absolute",left:e.x,top:e.y-11,width:e.width,height:22},className:"pointer-events-none flex items-center gap-3.5",children:[(0,y.jsx)("span",{className:"h-px flex-1 bg-border"}),(0,y.jsx)("span",{className:"whitespace-nowrap text-[15px] text-text-2",children:"Not linked to anything on this page"}),(0,y.jsx)("span",{className:"h-px flex-1 bg-border"})]})}let ua=(0,v.memo)(function({level:e,selected:t,agent:n,pulses:r,onSelect:o,onOpen:i,onTurnPage:a,onDrawn:l,quietLines:s,panelWidth:u,covered:d,bannerBottom:c,actionsFor:h,onDetails:f}){let g=rB(e=>e.width>=1700?8:6),m=(0,v.useMemo)(()=>(function(e,t,n=100,r=6){let o=new Map,i=t.filter(e=>e.source!==e.target),a=lU(t),l=e.filter(e=>a.has(e.path)),s=e.filter(e=>!a.has(e.path)),u=[...i].sort((e,t)=>t.count-e.count||(e.source<t.source?-1:+(e.source>t.source))||(e.target<t.target?-1:+(e.target>t.target))).slice(0,n),d=Math.max(1,Math.ceil(Math.sqrt(s.length)));if(0===l.length)return lY(s.length,d,0,0).forEach((e,t)=>o.set(s[t].path,e)),o;let c=new ab.Graph;for(let e of(c.setGraph({rankdir:"TB",nodesep:40,ranksep:64,marginx:0,marginy:0}),c.setDefaultEdgeLabel(()=>({})),l))c.setNode(e.path,{width:232,height:56});for(let e of u)c.setEdge(e.source,e.target,{weight:Math.max(1,Math.round(Math.sqrt(e.count)))});!function(e,t={}){(function e(t,n,r){var o;let i=t.nodes().filter(e=>t.children(e).length),a={};i.forEach(o=>{let i=t.node(o);if(i&&i.rankdir){let l=new aQ({multigraph:!0,compound:!0});l.setGraph({rankdir:i.rankdir});let s=t.children(o);s.forEach(e=>{let n={...t.node(e)};l.setNode(e,n);let r=t.parent(e);r&&r!==o&&s.includes(r)&&l.setParent(e,r)});let u=new Set;t.edges().forEach(e=>{let n=lP(t,e.v,o),r=lP(t,e.w,o);if(n&&r&&n!==r){let o=`${n}\0${r}`;u.has(o)||(u.add(o),l.setEdge(n,r,{...t.edge(e)}))}}),e(l,n,r);let d=lF(l);lA(d,n,r,null),lR(l,d);let c=1/0,h=1/0,f=-1/0,p=-1/0;l.nodes().forEach(e=>{if(e===o)return;let t=l.node(e);t&&"number"==typeof t.x&&"number"==typeof t.y&&"number"==typeof t.width&&"number"==typeof t.height&&(c=Math.min(c,t.x-t.width/2),f=Math.max(f,t.x+t.width/2),h=Math.min(h,t.y-t.height/2),p=Math.max(p,t.y+t.height/2))}),isFinite(c)&&isFinite(h)&&isFinite(f)&&isFinite(p)||(c=h=0,f=p=0);let g=f-c,m=p-h;a[o]={minX:c,minY:h,maxX:f,maxY:p,width:g,height:m,offsetX:c,offsetY:h},i._dagreClusterSubgraph=l}});let l=[],s=new Map;i.forEach(e=>{let n=t.node(e);n&&n.rankdir&&a[e]&&s.set(e,(t.children(e)||[]).filter(t=>t!==e))});let u=new Set([...s.values()].flat()),d=new Map;s.forEach((e,n)=>{u.has(n)||d.set(n,(e=>{let n=[],r=(t.children(e)||[]).filter(t=>t!==e);for(;r.length>0;){let e=r.shift();n.push(e),(t.children(e)||[]).filter(t=>t!==e).forEach(e=>r.push(e))}return n})(n))});let c=new Set([...d.values()].flat()),h=e=>{for(let[t,n]of d)if(n.includes(e))return t;return e},f=[];t.edges().forEach(e=>{(c.has(e.v)||c.has(e.w))&&f.push({edge:e,label:t.edge(e)})});let p=new Map;c.forEach(e=>{let n=t.parent(e);p.set(e,"string"==typeof n?n:void 0)}),d.forEach((e,n)=>{let r=t.node(n),o=[];e.forEach(e=>{let n=t.node(e);n&&(o.push({id:e,node:n,parent:p.get(e)}),t.removeNode(e))});let i=f.filter(({edge:t})=>e.includes(t.v)||e.includes(t.w)),s=a[n];r&&(l.push({clusterId:n,subgraph:r._dagreClusterSubgraph,bounds:s,children:e,removedNodes:o,removedEdges:i}),r.width=s.width,r.height=s.height)});let g=new Set;f.forEach(({edge:e,label:n})=>{let r=h(e.v),o=h(e.w);if(r!==o&&t.hasNode(r)&&t.hasNode(o)){let e=`${r}\0${o}`;g.has(e)||(g.add(e),t.setEdge(r,o,{...n,width:0,height:0}))}});let m=lF(t),x=lA(m,n,r,null!=(o=lO.get(t))?o:null);lO.set(t,x),lR(t,m),g.forEach(e=>{let n=e.indexOf("\0"),r=e.slice(0,n),o=e.slice(n+1);t.hasEdge(r,o)&&t.removeEdge(r,o)}),l.forEach(({clusterId:e,subgraph:n,bounds:r,removedNodes:o,removedEdges:i})=>{var a,l;let s=t.node(e),u=null!=(a=null==s?void 0:s.x)?a:0,d=null!=(l=null==s?void 0:s.y)?l:0,c=(r.minX+r.maxX)/2,h=(r.minY+r.maxY)/2;o.forEach(({id:e,node:n,parent:r})=>{t.setNode(e,n),void 0!==r&&t.setParent(e,r)}),i.forEach(({edge:e,label:n})=>{t.setEdge(e,n)}),n.nodes().forEach(r=>{if(r===e)return;let o=n.node(r),i=t.node(r);i&&o&&"number"==typeof o.x&&"number"==typeof o.y&&(i.x=u+(o.x-c),i.y=d+(o.y-h))}),delete s._dagreClusterSubgraph}),i.forEach(e=>{var n,r;let o=t.node(e),i=a[e];if(o&&o.rankdir&&o._dagreClusterSubgraph&&i){let a=o._dagreClusterSubgraph,l=null!=(n=o.x)?n:0,s=null!=(r=o.y)?r:0,u=(i.minX+i.maxX)/2,d=(i.minY+i.maxY)/2;a.nodes().forEach(n=>{if(n===e)return;let r=a.node(n),o=t.node(n);if(o&&r&&"number"==typeof r.x&&"number"==typeof r.y){let e=r.x-u,t=r.y-d;o.x=l+e,o.y=s+t}}),delete o._dagreClusterSubgraph}})})(e,a6,t)}(c);let h=0,f=0;for(let[e,t]of function(e,t){let n=new Map;for(let{path:t,x:r,y:o}of e)n.set(o,[...n.get(o)??[],{path:t,x:r}]);let r=new Map,o=0;for(let e of[...n.keys()].sort((e,t)=>e-t)){let i=n.get(e).sort((e,t)=>e.x-t.x||(e.path<t.path?-1:1)),a=Math.ceil(i.length/t),l=Math.ceil(i.length/a);for(let e=0;e<a;e++){let t=i.slice(e*l,(e+1)*l),n=-(232*t.length+(t.length-1)*40)/2;t.forEach((t,i)=>r.set(t.path,{x:n+272*i,y:o+96*e}))}o+=96*a-40+64}return r}(l.map(e=>({path:e.path,...c.node(e.path)})),r))o.set(e,t),h=Math.max(h,t.y+56),f=Math.max(f,t.x+232);if(0===s.length)return o;let p=Math.max(1,Math.floor((h+40)/96)),g=Math.ceil(s.length/p),m=f+80+lK(g,232)+f,x=Math.max(h,64+lK(Math.ceil(s.length/g),56)),y=Math.min(d,s.length);return(lW(Math.max(2*f,lK(y,232)),h+120+lK(Math.ceil(s.length/y),56))>lW(m,x)?lY(s.length,y,-lK(y,232)/2,h+120):lY(s.length,g,f+80,64)).forEach((e,t)=>o.set(s[t].path,e)),o})(e.nodes,e.edges,void 0,g),[e,g]),b=(0,v.useMemo)(()=>(function(e,t,n){let r=lU(t),o=e=>{let t=e.map(e=>n.get(e)).filter(e=>void 0!==e);return{left:Math.min(...t.map(e=>e.x)),right:Math.max(...t.map(e=>e.x+232)),top:Math.min(...t.map(e=>e.y)),bottom:Math.max(...t.map(e=>e.y+56))}},i=e.filter(e=>r.has(e.path)).map(e=>e.path),a=e.filter(e=>!r.has(e.path)).map(e=>e.path);if(0===i.length||0===a.length)return null;let l=o(i),s=o(a);if(s.left>=l.right)return{x:s.left,y:s.top-32,width:s.right-s.left};let u=Math.min(l.left,s.left);return{x:u,y:(l.bottom+s.top)/2,width:Math.max(l.right,s.right)-u}})(e.nodes,e.edges,m),[e,m]),w=(0,v.useMemo)(()=>new Map(e.nodes.map(e=>[e.path,e])),[e]),E=(0,v.useMemo)(()=>new Map(e.nodes.filter(e=>"portal"===e.kind).map(t=>{var n;return[t.path,{direction:(n=e.page,void 0===t.page?"many":t.page<n?"previous":"next"),title:void 0!==t.page?`Lines to page ${t.page+1}`:`Lines to ${sa(t.pages?.length??0,"more page","more pages")}`,caption:sl(t,si(e.edges,t.path))}]})),[e]),k=(0,v.useMemo)(()=>(function(e,t){let n=[...new Set(t.flatMap(e=>[e.source,e.target]))].filter(t=>e.has(t)),r=[...new Set(n.map(t=>e.get(t).y))].sort((e,t)=>e-t),o=new Map(r.map(t=>[t,n.filter(n=>e.get(n).y===t).map(t=>e.get(t).x)])),i=e=>e+1<r.length?(r[e]+56+r[e+1])/2:r[e]+56+32,a=e=>e>0?i(e-1):r[0]-32,l=new Map;for(let n of t){let t=e.get(n.source),s=e.get(n.target);if(!t||!s)continue;let u={x:t.x+116,y:t.y+56},d={x:s.x+116,y:s.y},c=i(r.indexOf(t.y)),h=a(r.indexOf(s.y)),[f,p]=[Math.min(c,h),Math.max(c,h)],g=function(e,t){let n=e.map(e=>[e-20,e+232+20]);return[t,...n.flat()].filter(e=>n.every(([t,n])=>e<=t||e>=n)).reduce((e,n)=>{let r=Math.abs(n-t),o=Math.abs(e-t);return r<o||r===o&&n<e?n:e})}(r.filter(e=>e>f&&e<p).flatMap(e=>o.get(e)),(u.x+d.x)/2);l.set(`${n.source}->${n.target}`,function(e){let t=e.filter((t,n)=>0===n||t.x!==e[n-1].x||t.y!==e[n-1].y);return t.filter((e,n)=>{if(0===n||n===t.length-1)return!0;let[r,o]=[t[n-1],t[n+1]];return(r.x!==e.x||e.x!==o.x)&&(r.y!==e.y||e.y!==o.y)})}([u,{x:u.x,y:c},{x:g,y:c},{x:g,y:h},{x:d.x,y:h},d]))}return l})(m,e.edges),[m,e]),[_,j]=(0,v.useState)(null),[S,M]=(0,v.useState)(null),[N,C]=(0,v.useState)(e);N!==e&&(C(e),M(null),j(null));let $=(0,v.useMemo)(()=>(function(e,t,n,r,o={}){let i=new Set(e),a=null!==n&&i.has(n)?n:null,l=null!==r&&i.has(r)&&r!==a?r:null,s=sH(t,a),u=sH(t,l),d=new Map;for(let t of e)t===a?d.set(t,"selected"):s.has(t)?d.set(t,"linked"):t===l||u.has(t)?d.set(t,"preview"):d.set(t,null===a?"normal":"faded");let c=new Map;for(let e of t){let t=t=>null!==t&&(e.source===t||e.target===t);t(a)?c.set(sT(e),"selected"):t(l)?c.set(sT(e),"preview"):o.quietLines?c.set(sT(e),"hidden"):c.set(sT(e),null===a?"normal":"faded")}return{boxes:d,edges:c}})(e.nodes.map(e=>e.path),e.edges,t,S,{quietLines:s}),[e,t,S,s]),[O,P,A]=function(e){let[t,n]=(0,v.useState)(e),r=(0,v.useCallback)(e=>n(t=>oi(e,t)),[]);return[t,n,r]}([]),[R,z,L]=function(e){let[t,n]=(0,v.useState)(e),r=(0,v.useCallback)(e=>n(t=>oi(e,t)),[]);return[t,n,r]}([]),{setViewport:I}=oy(),D=rB(e=>e.width),B=rB(e=>e.height),T=64*(e.pageCount>1),H=(0,v.useRef)({setViewport:I,onDrawn:l,positions:m,canvas:{width:D,height:B},pillBand:T});(0,v.useEffect)(()=>{H.current={setViewport:I,onDrawn:l,positions:m,canvas:{width:D,height:B},pillBand:T}},[I,l,m,D,B,T]),(0,v.useEffect)(()=>{let t=e.nodes.map(e=>{var t,o;return t=m.get(e.path)??{x:0,y:0},o={box:e,tone:$.boxes.get(e.path)??"normal",agent:n.has(e.path),pulseKey:r.get(e.path)?.key??0,portal:E.get(e.path)},{id:e.path,type:"box",position:t,width:232,height:56,measured:{width:232,height:56},handles:sY,draggable:!1,connectable:!1,data:o}});P(e=>sK(e,t,sU))},[e,m,E,$,n,r,P]),(0,v.useEffect)(()=>{let t=e.edges.flatMap(e=>{var t,n,r;let o,i,a,l,s=sT(e),u=$.edges.get(s)??"normal";if("hidden"===u)return[];let d=uo[u],c={id:s,type:"routed",data:{points:k.get(s)??[]},source:e.source,target:e.target,focusable:!1,label:_===s?(t=w.get(e.source),n=w.get(e.target),r=e.count,o=`${l3(r)} import${1===r?"":"s"}`,i="portal"===t.kind?"use":"uses",l="portal"===t.kind?(a=se(t)).charAt(0).toUpperCase()+a.slice(1):se(t),`${l} ${i} ${se(n)} \xb7 ${o}`):void 0,style:{stroke:d.stroke,strokeWidth:d.width,opacity:d.opacity},markerEnd:{type:p.ArrowClosed,width:26,height:26,color:d.arrow,markerUnits:"userSpaceOnUse"}};return[{layer:d.layer,edge:c}]}).sort((e,t)=>e.layer-t.layer).map(e=>e.edge);z(e=>sK(e,t,sZ))},[e,w,k,$,_,z]);let V=`${e.repo}
3
- ${e.path}
4
- ${e.page}
5
- ${g}`,F=(0,v.useRef)(null);return(0,v.useEffect)(()=>{if(F.current===V||!(O.length===e.nodes.length&&O.every((t,n)=>t.id===e.nodes[n].path)))return;let t=requestAnimationFrame(()=>{F.current=V;let e=H.current;e.setViewport(function(e,t,n=0){let r=t.height-n,o=o=>({x:t.width/2-(e.x+e.width/2)*o,y:n+r/2-(e.y+e.height/2)*o,zoom:o});if(0===e.width||0===e.height||0===t.width||0===t.height)return o(1);let i=Math.min(1,t.width/(1.15*e.width),r/(1.15*e.height));if(i>=.75)return o(i);let a=Math.min(1,Math.max(.75,(t.width-144)/e.width));return{x:t.width/2-(e.x+e.width/2)*a,y:64-e.y*a,zoom:a}}(function(e){if(0===e.size)return{x:0,y:0,width:0,height:0};let t=1/0,n=1/0,r=-1/0,o=-1/0;for(let{x:i,y:a}of e.values())t=Math.min(t,i),n=Math.min(n,a),r=Math.max(r,i+232),o=Math.max(o,a+56);return{x:t,y:n,width:r-t,height:o-n}}(e.positions),e.canvas,e.pillBand),{duration:0}),e.onDrawn()});return()=>cancelAnimationFrame(t)},[V,O,e.nodes]),(0,y.jsxs)(iT,{nodes:O,edges:R,onNodesChange:A,onEdgesChange:L,nodeTypes:ut,edgeTypes:un,onNodeClick:(e,t)=>o(t.id),onNodeDoubleClick:(e,t)=>{let{box:n}=t.data;"folder"===n.kind?i(t.id):"portal"===n.kind&&void 0!==n.page&&a(n.page)},onNodeMouseEnter:(e,t)=>M(t.id),onNodeMouseLeave:()=>M(null),onPaneClick:()=>o(null),onEdgeMouseEnter:(e,t)=>j(t.id),onEdgeMouseLeave:()=>j(null),nodesDraggable:!1,nodesConnectable:!1,zoomOnDoubleClick:!1,minZoom:.1,maxZoom:2,colorMode:"dark",proOptions:{hideAttribution:!0},inert:d,children:[(0,y.jsx)(iZ,{variant:x.Dots,gap:22,size:1.2,color:"var(--grid)"}),b&&(0,y.jsx)(iq,{children:(0,y.jsx)(ui,{divider:b})}),null!==h&&w.has(h)&&m.has(h)&&(0,y.jsx)(sW,{box:w.get(h),position:m.get(h),onOpen:i,onTurnPage:a,onDetails:f}),!d&&(0,y.jsx)(s1,{quietLines:s,doorways:e.nodes.some(e=>"portal"===e.kind),maxHeight:function(e,t,n){if(!(e<=0))return e-16-Math.max(16,t,n>0?n+8:0)}(B,T,c)}),!d&&(0,y.jsx)(i4,{position:"bottom-right",showInteractive:!1,fitViewOptions:ur,style:u>0?{right:u}:void 0,className:"overflow-hidden rounded-lg",children:(0,y.jsx)(i2,{onClick:()=>{M(null),o(null)},title:"Reset focus","aria-label":"Reset focus",children:(0,y.jsx)(sV,{"aria-hidden":!0,size:16,stroke:1.75})})})]})});function ul(e,t,n=!1){let r=[...""===e?[]:[`path=${encodeURIComponent(e).replaceAll("%2F","/")}`],...t>0?[`page=${t+1}`]:[],...n?["embed=vscode"]:[]];return 0===r.length?"/":`/?${r.join("&")}`}function us(e){let t=new URLSearchParams(e),n=t.get("page")??"";return{path:t.get("path")??"",page:/^\d+$/.test(n)&&Number(n)>=1?Number(n)-1:0}}function uu(e){let t="object"==typeof e&&null!==e?e.mapDepth:void 0;return"number"==typeof t&&Number.isInteger(t)&&t>0?t:0}function ud(e,t,n){let r,o,i=e.closest("header")?.parentElement??document.documentElement,a=i.getBoundingClientRect(),l=i.querySelector(":scope > footer")?.getBoundingClientRect().top??a.bottom,s=e.getBoundingClientRect(),u=(r=Math.min(t,a.right-a.left-32),{shift:Math.min(Math.max(o="start"===n?s.left:s.right-r,a.left+16),a.right-16-r)-o,width:r}),d=l-s.top-36-8;return"start"===n?{left:u.shift,width:u.width,maxHeight:d}:{right:-u.shift,width:u.width,maxHeight:d}}function uc(e,t){(0,v.useEffect)(()=>{if(e)return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[e,t])}function uh(e,t){let n=(0,v.useRef)(null),r=(0,v.useRef)(t);return(0,v.useEffect)(()=>{r.current=t},[t]),(0,v.useEffect)(()=>{if(!e)return;let t=e=>{n.current&&e.target instanceof Node&&!n.current.contains(e.target)&&r.current()},o=e=>{"Escape"===e.key&&r.current()};return document.addEventListener("pointerdown",t),document.addEventListener("keydown",o),()=>{document.removeEventListener("pointerdown",t),document.removeEventListener("keydown",o)}},[e]),n}function uf({entry:e,fallback:t}){return e?.remote?(0,y.jsxs)("span",{title:`${e.remote.owner} / ${e.remote.name}`,className:"flex min-w-0 items-baseline text-[15px]",children:[(0,y.jsx)("span",{className:"truncate pr-1 text-text-2 after:pl-1 after:content-['/']",children:e.remote.owner}),(0,y.jsx)("span",{className:"max-w-full shrink-0 truncate font-medium text-text",children:e.remote.name})]}):(0,y.jsx)("span",{title:t,className:"truncate text-[15px] font-medium text-text",children:t})}function up({repo:e,onSwitched:t,onHome:n}){let[r,o]=(0,v.useState)(null),[i,a]=(0,v.useState)(!1),[l,s]=(0,v.useState)(null),[u,d]=(0,v.useState)({left:0,width:320}),c=uh(i,()=>a(!1)),h=(0,v.useCallback)(()=>{c.current&&d(ud(c.current,320,"start"))},[c]);uc(i,h),(0,v.useEffect)(()=>{am.repos().then(o,()=>{})},[e]);let f=e.slice(e.lastIndexOf("/")+1),p=(0,y.jsx)(uf,{entry:r?.repos.find(t=>t.root===e),fallback:f}),g=(0,y.jsx)("button",{type:"button","data-testid":"repo-name",onClick:n,title:"Go to the top level",className:"flex min-w-0 rounded-md px-1 hover:bg-surface",children:p});return null===r||r.repos.length<2?g:(0,y.jsxs)("div",{ref:c,className:"relative min-w-0",children:[(0,y.jsxs)("div",{className:"flex min-w-0 items-center",children:[g,(0,y.jsx)("button",{type:"button","data-testid":"repo-menu",onClick:()=>{i||h(),a(e=>!e)},"aria-label":"Switch repository",title:"Switch repository",className:"grid h-7 w-6 shrink-0 place-items-center rounded-md text-text-2 hover:bg-surface hover:text-text",children:(0,y.jsx)(sG,{"aria-hidden":!0,size:14,stroke:1.75})})]}),i&&(0,y.jsx)("ul",{"data-testid":"repo-list","data-covers":!0,style:u,className:"absolute top-9 z-30 overflow-y-auto rounded-lg border border-border bg-surface py-1 text-[13px]",children:r.repos.map(n=>(0,y.jsx)("li",{children:(0,y.jsxs)("button",{type:"button",onClick:()=>{var r;return r=n.root,void(a(!1),r!==e&&am.setActiveRepo(r).then(t,e=>s(e instanceof ac?e.message:"Couldn't switch repos.")))},className:"block w-full px-3 py-2 text-left hover:bg-border",children:[(0,y.jsx)("span",{className:n.root===e?"font-medium text-text":"text-text",children:n.remote?`${n.remote.owner} / ${n.remote.name}`:n.name}),(0,y.jsx)("span",{title:n.root,className:"block truncate font-mono text-[12px] text-text-2",children:n.root})]})},n.root))}),l&&(0,y.jsx)("span",{title:l,className:"ml-2 block truncate text-[12px] text-danger",children:l})]})}let ug=as("outline","search","Search",[["path",{d:"M3 10a7 7 0 1 0 14 0a7 7 0 1 0 -14 0",key:"svg-0"}],["path",{d:"M21 21l-6 -6",key:"svg-1"}]]);function um(e){return"(file)"===e.symbol?"imports and exports":`${e.symbol} \xb7 ${e.startLine===e.endLine?`line ${e.startLine}`:`lines ${e.startLine}–${e.endLine}`}`}function ux({onPick:t,onClose:n}){var r;let o,i,a;sf();let[l,s]=sq(),[u,d]=(0,v.useState)(""),[c,h]=(0,v.useState)(null),[f,p]=(0,v.useState)(null),[g,m]=(0,v.useState)(0),x=(0,v.useRef)(null),b=(0,v.useRef)(null),[w,E]=(0,v.useState)(null);(0,v.useEffect)(()=>{x.current?.focus();let t=!0;return e.A(74429).then(e=>{t&&E(()=>(t,n)=>e.highlightCode(t,n))}),()=>{t=!1}},[]),(0,v.useEffect)(()=>{let e=u.trim();if(""===e)return;let t=new AbortController,n=setTimeout(()=>{am.search(e,40,t.signal).then(e=>{h(e),p(null),m(0)},e=>{e instanceof ac&&p(e)})},150);return()=>{clearTimeout(n),t.abort()}},[u]);let k=(o=(r=null!==c&&c.query===u.trim()?c.hits:[]).filter(e=>"folder"===e.kind),{folders:o,files:i=r.filter(e=>"file"===e.kind),ordered:[...o,...i]}),_=k.ordered,j=Math.min(g,_.length-1);return(0,v.useEffect)(()=>{b.current?.querySelector('[aria-selected="true"]')?.scrollIntoView({block:"nearest"})},[j]),(0,y.jsx)("div",{className:"pointer-events-auto fixed inset-0 z-30 bg-canvas/70",onClick:n,children:(0,y.jsxs)("div",{role:"dialog","aria-label":"Search",onClick:e=>e.stopPropagation(),className:"mx-auto mt-[12vh] w-[640px] max-w-[92vw] overflow-hidden rounded-lg border border-border bg-panel",children:[(0,y.jsxs)("div",{ref:l,children:[(0,y.jsxs)("div",{className:"flex items-center gap-3 border-b border-hairline px-4",children:[(0,y.jsx)(ug,{"aria-hidden":!0,size:16,stroke:1.75,className:"shrink-0 text-text-2"}),(0,y.jsx)("input",{ref:x,value:u,onChange:e=>d(e.target.value),onKeyDown:e=>{"Escape"===e.key?n():"ArrowDown"===e.key?(e.preventDefault(),m(Math.min(j+1,_.length-1))):"ArrowUp"===e.key?(e.preventDefault(),m(Math.max(j-1,0))):"Enter"===e.key&&_[j]&&t(_[j])},placeholder:"Search files and concepts",spellCheck:!1,"aria-label":"Search",className:"w-full bg-transparent py-3 text-[15px] text-text placeholder:text-text-2 focus:outline-none"})]}),f&&(0,y.jsx)("p",{className:"px-4 py-3 text-[13px] text-danger",children:f.message}),c?.note&&_.length>0&&(0,y.jsx)("p",{className:"px-4 pt-2 text-[12px] text-text-2",children:c.note})]}),(0,y.jsxs)("ul",{ref:b,role:"listbox",style:{maxHeight:null===(a=s?.height??null)?void 0:`min(52vh, calc(88vh - 10px - ${a}px))`},className:"max-h-[52vh] overflow-y-auto py-1",children:[_.map((e,n)=>(0,y.jsxs)(v.Fragment,{children:[(0===n||n===k.folders.length)&&(0,y.jsxs)("li",{role:"presentation",className:"px-4 pb-1 pt-2 text-[12px] font-medium text-text-2",children:["folder"===e.kind?"Folders":"Files"," ",(0,y.jsx)("span",{className:"font-normal",children:l3("folder"===e.kind?k.folders.length:k.files.length)})]}),(0,y.jsx)("li",{role:"option","aria-selected":n===j,children:(0,y.jsxs)("button",{type:"button","data-hit":e.path,onMouseEnter:()=>m(n),onClick:()=>t(e),className:`flex w-full gap-3 px-4 py-2 text-left ${n===j?"bg-surface":""}`,children:["folder"===e.kind?(0,y.jsx)(l1,{"aria-hidden":!0,size:16,stroke:1.75,className:"mt-0.5 shrink-0 text-folder"}):(0,y.jsx)(l0,{"aria-hidden":!0,size:16,stroke:1.75,className:"mt-0.5 shrink-0 text-text-2"}),(0,y.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,y.jsx)("span",{title:e.path,className:"block truncate font-mono text-[13px] text-text",children:e.path}),e.tagline&&(0,y.jsx)("span",{title:e.tagline,className:"block truncate text-[13px] text-text-2",children:e.tagline}),e.code&&(0,y.jsxs)("span",{title:`${um(e.code)}: ${e.code.snippet}`,className:"block truncate font-mono text-[12px] text-text-2",children:[um(e.code),":"," ",w?(0,y.jsx)("span",{className:"syntax",dangerouslySetInnerHTML:{__html:w(e.code.snippet,(0,lZ.b)(e.path))}}):(0,y.jsx)("span",{className:"syntax",children:e.code.snippet})]})]})]})})]},e.path)),""!==u.trim()&&null!==c&&c.query===u.trim()&&0===_.length&&(0,y.jsx)("li",{className:"px-4 py-3 text-[13px] text-text-2",children:c.note??"Nothing matched."})]})]})})}let uy={ok:"bg-ok",busy:"bg-text-2",warn:"bg-danger",off:"bg-text-2"},uv=["structure","summaries","embeddings"];function ub({status:e}){let[t,n]=(0,v.useState)(!1),[r,o]=(0,v.useState)(null),[i,a]=(0,v.useState)({right:0,width:340}),l=uh(t,()=>n(!1)),s=(0,v.useCallback)(()=>{l.current&&a(ud(l.current,340,"end"))},[l]);if(uc(t,s),null===e)return null;let u=function(e){for(let t of l7)if("running"===e.stages[t].state)return{tone:"busy",text:`${l8[t]}${l9(e.stages[t])}`};for(let t of l7)if("failed"===e.stages[t].state)return{tone:"warn",text:`${l6[t]} failed`};if("ready"!==e.stages.structure.state)return{tone:"warn",text:"Not indexed yet"};if("off"===e.stages.summaries.state)return{tone:"off",text:"Summaries off (no API key)"};for(let t of l7){let n=e.stages[t];if("idle"===n.state&&n.total>n.done)return{tone:"busy",text:`${l6[t]}${l9(n)}`}}return{tone:"ok",text:"Up to date"}}(e);return(0,y.jsxs)("div",{ref:l,className:"relative min-w-0",children:[(0,y.jsxs)("button",{type:"button","data-testid":"status-pill",onClick:()=>{t||s(),n(e=>!e)},"aria-expanded":t,title:`${u.text} \xb7 Index status: what's indexed, and re-index`,className:"flex max-w-full items-center gap-2 rounded-md border border-border px-2.5 py-1 text-[12px] text-text-2 hover:border-text-2 hover:text-text",children:[(0,y.jsx)("span",{"aria-hidden":!0,className:`h-2 w-2 shrink-0 rounded-full ${uy[u.tone]}`}),(0,y.jsx)("span",{className:"truncate max-[520px]:hidden",children:u.text}),(0,y.jsx)(sG,{"aria-hidden":!0,size:14,stroke:1.75,className:`shrink-0 ${t?"rotate-180":""}`})]}),t&&(0,y.jsxs)("div",{"data-testid":"status-menu","data-covers":!0,style:i,className:"absolute top-9 z-30 space-y-3 overflow-y-auto rounded-lg border border-border bg-surface p-3 text-[12px] text-text-2",children:[uv.map(t=>{var n;return(0,y.jsxs)("div",{children:[(0,y.jsx)("div",{className:"text-[13px] text-text",children:(n=e.stages[t],`${l6[t]}${l9(n)} \xb7 ${n.state}`)}),e.stages[t].note&&(0,y.jsx)("div",{children:e.stages[t].note})]},t)}),(0,y.jsx)("div",{className:"flex items-center justify-between gap-3 border-t border-hairline pt-3",children:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("span",{className:"truncate",title:r??`index version ${e.indexVersion}`,children:r??`index version ${e.indexVersion}`}),(0,y.jsx)("button",{type:"button",onClick:()=>{o("starting…"),am.reindex(e=>o(`${e.stage} ${l3(e.done)} / ${l3(e.total)}`)).then(e=>o(`re-indexed ${l3(e.files)} files in ${(e.totalMs/1e3).toFixed(1)} s`),e=>o(e instanceof ac?e.message:"the re-index failed"))},className:"shrink-0 text-[13px] text-control underline underline-offset-2 hover:text-text",children:"Re-index"})]})})]})]})}var uw=e.i(5500),uw=uw;let uE=as("outline","help","Help",[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0",key:"svg-0"}],["path",{d:"M12 17l0 .01",key:"svg-1"}],["path",{d:"M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4",key:"svg-2"}]]),uk=()=>()=>{};function u_({repo:e,onSearch:t,status:n,onHelp:r}){let o=(0,v.useSyncExternalStore)(uk,()=>/Mac|iPhone|iPad/.test(navigator.platform),()=>!1);return(0,y.jsxs)("header",{className:"pointer-events-auto relative z-20 flex h-12 shrink-0 items-center gap-4 border-b border-hairline bg-canvas px-4 max-[440px]:gap-3",children:[(0,y.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[(0,y.jsx)(uw.Image,{src:"/icon.svg",alt:"",width:18,height:18,unoptimized:!0}),(0,y.jsx)("span",{className:"text-[14px] font-medium text-text max-[440px]:hidden",children:"Nebulosity"})]}),(0,y.jsx)("span",{"aria-hidden":!0,className:"h-4 w-px shrink-0 bg-hairline"}),(0,y.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[e,(0,y.jsx)("span",{className:"shrink-0 text-[13px] text-text-2 max-[1100px]:hidden",children:"Dependency map"})]}),(0,y.jsx)("div",{className:"@container flex min-w-[42px] flex-1 justify-center max-[640px]:justify-end",children:t&&(0,y.jsxs)("button",{type:"button",onClick:t,"data-testid":"search-button","aria-label":"Search files and concepts",title:`Search files and concepts (${o?"⌘K":"Ctrl K"})`,className:"flex w-full max-w-xl cursor-text items-center gap-2 rounded-lg border border-border bg-surface px-3 py-1.5 text-[13px] text-text-2 hover:border-text-2 max-[640px]:w-auto max-[640px]:cursor-pointer max-[640px]:px-2",children:[(0,y.jsx)(ug,{"aria-hidden":!0,size:16,stroke:1.75,className:"shrink-0"}),(0,y.jsx)("span",{className:"w-0 flex-1 truncate text-left max-[640px]:hidden @max-[90px]:hidden",children:"Search files and concepts"}),(0,y.jsx)("kbd",{className:"shrink-0 rounded-md border border-border px-1.5 font-sans text-[12px] text-text-2 max-[768px]:hidden @max-[256px]:hidden",children:o?"⌘K":"Ctrl K"})]})}),(0,y.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[r&&(0,y.jsx)("button",{type:"button",onClick:r,"data-testid":"help-button","aria-label":"How to use the Map",title:"How to use the Map (?)",className:"grid h-7 w-7 shrink-0 place-items-center rounded-md border border-border text-text-2 hover:border-text-2 hover:text-text",children:(0,y.jsx)(uE,{"aria-hidden":!0,size:16,stroke:1.75})}),n]})]})}let uj=e=>"string"==typeof e&&e.length<=1024,uS=e=>uj(e)&&""!==e,uM="vscode"===new URLSearchParams(window.location.search).get("embed"),uN=null,uC={post:e=>uN?.post(e)},u$="nebulosity.helpSeen",uO=e=>`${e.path}\0${e.page}`,uP=e=>`${e.repo}\0${e.path}\0${e.page}`;function uA(e){let t=requestAnimationFrame(()=>{t=requestAnimationFrame(e)});return()=>cancelAnimationFrame(t)}let uR=(e,t,n)=>({repo:n.repo,version:n.indexVersion,levels:new Map(null!==e&&e.repo===n.repo&&e.version===n.indexVersion?e.levels:[]).set(uO(t),n)});function uz(){var e,t;let n,r,{status:o,error:i,refresh:a}=function(){let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(null),[o,i]=(0,v.useState)(0);return(0,v.useEffect)(()=>{let e=new AbortController;am.status(e.signal).then(e=>{t(e),r(null)},e=>{e instanceof ac&&r(e)});let n=setTimeout(()=>i(e=>e+1),2e3);return()=>{e.abort(),null!==n&&clearTimeout(n)}},[o]),(0,v.useEffect)(()=>{let e=()=>i(e=>e+1);return window.addEventListener("focus",e),()=>window.removeEventListener("focus",e)},[]),{status:e,error:n,refresh:(0,v.useCallback)(()=>i(e=>e+1),[])}}(),[l,s]=(0,v.useState)(()=>us(window.location.search)),u=l.path,[d,c]=(0,v.useState)(null),[h,f]=(0,v.useState)(null),[p,g]=(0,v.useState)(null),[m,x]=(0,v.useState)(null),[b,w]=(0,v.useState)(null),[E,k]=(0,v.useState)(m);E!==m&&(k(m),w(null));let[_,j]=(0,v.useState)(()=>uu(window.history.state)>0),[S,M]=(0,v.useState)(null),[N,C]=(0,v.useState)(!1),[$,O]=(0,v.useState)(!1),[P,A]=(0,v.useState)([]),[R,z]=(0,v.useState)([]),[L,I]=(0,v.useState)(-1/0),D=(0,v.useCallback)(()=>{A([]),I(Date.now())},[]),[B,T]=(0,v.useState)(!1),[H,V]=(0,v.useState)(new Map),[F,q]=sq(),X=q?.width??null,[W,Y]=sq(),[K,U]=sq(),[Z,G]=sq(),Q=(0,v.useRef)(l),J=(0,v.useRef)(m);(0,v.useEffect)(()=>{Q.current=l,J.current=m},[l,m]);let ee=(0,v.useRef)("push"),et=o?.repo??null,en=o?.indexVersion??null,er=null!==d&&d.repo===et?d.levels.get(uO(l))??null:null,eo=null!==d&&d.repo===et&&d.version===en&&d.levels.has(uO(l)),ei=(0,v.useRef)(er);(0,v.useEffect)(()=>{ei.current=er},[er]);let ea=(0,v.useRef)(null);(0,v.useEffect)(()=>{if(null===et||null===en||eo)return;let e=new AbortController;return am.level(l.path,l.page,e.signal).then(e=>{let t={path:l.path,page:e.page};c(n=>uR(n,t,e)),e.page!==l.page&&(window.history.replaceState({mapDepth:uu(window.history.state)},"",ul(t.path,t.page,uM)),s(t)),f(null)},e=>{e instanceof ac&&f(e)}),()=>e.abort()},[et,en,l,eo]),(0,v.useEffect)(()=>{if(null===S||null===et)return;let e=new AbortController;return am.level((0,lZ.B)(S.target),0,e.signal,S.target).then(e=>{if(S.quiet&&!e.nodes.some(e=>e.path===S.target)){sr("map:level"),M(null);return}let t={path:e.path,page:e.page};c(n=>uR(n,t,e)),ee.current=S.history,s(t),x(S.target),M(null),f(null)},e=>{e instanceof ac&&(sr("map:level"),S.quiet||g({error:e,place:uO(Q.current),selected:J.current}),M(null))}),()=>e.abort()},[S,et]),(0,v.useEffect)(()=>{if(null===p)return;let e=setTimeout(()=>g(null),6e3);return()=>clearTimeout(e)},[p]),(0,v.useEffect)(()=>{var e,t;let n=(e=function(e,t,n=!1){if(e===ul(t.path,t.page,n))return"none";let r=us(e.includes("?")?e.slice(e.indexOf("?")):"");return r.path===t.path&&r.page===t.page?"replace":"push"}(window.location.pathname+window.location.search,l,uM),t=ee.current,"push"===e&&"replace"===t?"replace":e);ee.current="push";let r=uu(window.history.state);"push"===n?(window.history.pushState({mapDepth:r+1},"",ul(l.path,l.page,uM)),j(!0)):"replace"===n&&window.history.replaceState({mapDepth:r},"",ul(l.path,l.page,uM))},[l]),(0,v.useEffect)(()=>{let e=()=>{sn("map:level"),s(us(window.location.search)),x(null),M(null),j(uu(window.history.state)>0)};return window.addEventListener("popstate",e),()=>window.removeEventListener("popstate",e)},[]);let el=(0,v.useCallback)(e=>{e!==u&&sn("map:level"),s({path:e,page:0}),x(null),M(null)},[u]),es=(0,v.useCallback)(e=>{sn("map:level"),s({path:u,page:e}),x(null),M(null)},[u]),eu=(0,v.useCallback)((e,t={})=>{if(""===e)return void el("");if((0,lZ.B)(e)===u&&er?.nodes.some(t=>t.path===e)){sn("map:select"),x(e),M(null);return}sn("map:level"),M({target:e,history:t.history??"push",quiet:t.quiet??!1})},[el,u,er]),ed=(0,v.useCallback)(e=>{"nebulosity.follow"===e.type?eu(e.path,{history:"replace",quiet:!0}):"nebulosity.show"===e.type?eu(e.path,{quiet:!0}):"nebulosity.highlight"===e.type?z(e.paths):"nebulosity.clear"===e.type&&z([])},[eu]),ec=(0,v.useCallback)(()=>{let e=ei.current;return null===e||uP(e)!==ea.current?null:{type:"nebulosity.drawn",path:Q.current.path,page:Q.current.page,selected:J.current}},[]),eh=(n=(0,v.useRef)(ed),r=(0,v.useRef)(ec),(0,v.useEffect)(()=>{n.current=ed,r.current=ec},[ed,ec]),(0,v.useEffect)(()=>{if(uM){var e,t,o;let i,a,l,s,u;return(uN??=(e=window,i=null,t=e=>i?.onMessage(e),o=()=>i?.onReady()??null,a=null,l=t=>{null!==a&&e.parent.postMessage(t,a)},s=n=>{if(n.source!==e.parent||!n.origin.startsWith("vscode-webview://"))return;let r=function(e){if("object"!=typeof e||null===e)return null;switch(e.type){case"nebulosity.hello":return 1===e.version?{type:"nebulosity.hello",version:1}:null;case"nebulosity.follow":return uS(e.path)?{type:"nebulosity.follow",path:e.path}:null;case"nebulosity.show":return uS(e.path)?{type:"nebulosity.show",path:e.path}:null;case"nebulosity.highlight":{if(!Array.isArray(e.paths))return null;let t=e.paths,n=[];for(let e=0;e<Math.min(t.length,1e3)&&n.length<50;e++){let r=t[e];uj(r)&&n.push(r)}return{type:"nebulosity.highlight",paths:n}}case"nebulosity.clear":return{type:"nebulosity.clear"};default:return null}}(n.data);if(null!==r){if("nebulosity.hello"===r.type){a=n.origin,l({type:"nebulosity.ready",version:1});let e=o?.()??null;null!==e&&l(e);return}null!==a&&n.origin===a&&t(r)}},e.addEventListener("message",s),u={post:l,connected:()=>null!==a,dispose(){e.removeEventListener("message",s),a=null}},{attach:e=>(i=e,()=>{i===e&&(i=null)}),post:e=>u.post(e)})).attach({onMessage:e=>n.current(e),onReady:()=>r.current()})}},[]),uM?uC:null),ef=(0,v.useCallback)(e=>{null!==e&&sn("map:select"),x(e),null!==eh&&null!==e&&er?.nodes.some(t=>t.path===e&&"file"===t.kind)&&eh.post({type:"nebulosity.open",path:e})},[eh,er]),ep=(0,v.useCallback)((e,t)=>{eh?.post({type:"nebulosity.open",path:e,...void 0===t?{}:{line:t}})},[eh]),eg=function(e){let[t,n]=(0,v.useState)([]),[r,o]=(0,v.useState)(!1),i=(0,v.useRef)(e);return(0,v.useEffect)(()=>{i.current=e},[e]),(0,v.useEffect)(()=>{var e,t;let r,a,l;return e=()=>{let e=new EventSource("/api/live/stream");return e.addEventListener("ready",()=>o(!0)),e.addEventListener("error",()=>o(!1)),e.addEventListener("tool",e=>{let t=JSON.parse(e.data);n(e=>(function(e,t,n=3){return[t,...e].slice(0,n)})(e,t)),i.current(t)}),e},t=window,r=e(),a=()=>{r?.close(),r=null},l=t=>{t.persisted&&null===r&&(r=e())},t.addEventListener("pagehide",a),t.addEventListener("pageshow",l),()=>{t.removeEventListener("pagehide",a),t.removeEventListener("pageshow",l),a()}},[]),{recent:t,connected:r}}((0,v.useCallback)(e=>{if(null!==er){let t=e.paths.flatMap(e=>(0,lZ.K)(er,e)??[]);V(e=>(function(e,t,n){let r=new Map(e);for(let e of new Set(t)){let t=r.get(e);t&&n-t.at<800||r.set(e,{key:(t?.key??0)+1,at:n})}return r})(e,t,Date.now()))}let t=e.action;t?.type==="highlight_nodes"?A(t.nodeIds):t?.type==="clear_highlights"?A([]):t?.type==="focus_node"&&eu(t.nodeId)},[er,eu])),[em,ex]=(0,v.useState)(0),ey=eg.recent[0]?.at??null;(0,v.useEffect)(()=>{if(null===ey)return;let e=setInterval(()=>{let t=Date.now();ex(t),t-Date.parse(ey)>=3e4&&clearInterval(e)},1e3);return()=>clearInterval(e)},[ey]);let ev=null===er?"":[...function(e,t,n,r,o=-1/0,i=[]){return new Set([...t.filter(e=>{let t=Date.parse(e.at);return r-t<3e4&&t>o}).flatMap(e=>e.paths),...n,...i].flatMap(t=>(0,lZ.K)(e,t)??[]))}(er,eg.recent,P,em,L,R)].sort().join("\0"),eb=(0,v.useMemo)(()=>new Set(""===ev?[]:ev.split("\0")),[ev]),ew=(0,v.useCallback)(()=>{s({path:"",page:0}),x(null),M(null),A([]),z([]),a()},[a]),eE=(0,v.useCallback)(()=>{so("map:level"),null!==eh&&(ea.current=null===ei.current?null:uP(ei.current),uA(()=>{let e=ec();null!==e&&eh.post(e)}))},[eh,ec]);(0,v.useEffect)(()=>{if(null!==eh&&null!==ec())return uA(()=>{let e=ec();null!==e&&eh.post(e)})},[m,eh,ec]);let ek=(0,v.useCallback)(()=>el(""),[el]),e_=(0,v.useCallback)(()=>O(!1),[]);(0,v.useEffect)(()=>{let e=setTimeout(()=>{try{if(null!==window.localStorage.getItem(u$))return;window.localStorage.setItem(u$,"1"),O(!0)}catch{}},0);return()=>clearTimeout(e)},[]);let ej=(0,v.useCallback)(()=>x(null),[]),eS=(0,v.useCallback)(()=>w(null),[]),eM=(0,v.useCallback)(e=>w(e),[]),eN=er?.page??0,eC=er?.pageCount??1,e$=null!==m&&null!==er&&m.includes("//")?er.nodes.some(e=>e.path===m)?m:null:m,eO=null!==e$,eP=P.length>0,eA={covers:null!==X&&X-400<360};eA.covers||null===e$||b===e$||w(e$);let eR=eA.covers&&null!==e$&&b===e$;(0,v.useEffect)(()=>{let e=e=>{let t=function(e,t){if((e.metaKey||e.ctrlKey)&&"k"===e.key.toLowerCase())return{type:"search"};if(t.typing||t.dialogOpen)return null;switch(e.key){case"?":return{type:"help"};case"Escape":return t.selected?{type:"deselect"}:t.highlighted?{type:"clear-highlights"}:null;case"Backspace":return""!==t.levelPath?{type:"up"}:null;case"ArrowLeft":return t.page>0?{type:"page",page:t.page-1}:null;case"ArrowRight":return t.page<t.pageCount-1?{type:"page",page:t.page+1}:null;default:return null}}(e,{typing:e.target instanceof HTMLElement&&["INPUT","TEXTAREA"].includes(e.target.tagName),dialogOpen:null!==document.querySelector('[role="dialog"]'),levelPath:u,page:eN,pageCount:eC,selected:eO,highlighted:eP});null!==t&&("search"===t.type?(e.preventDefault(),C(!0)):"help"===t.type?O(!0):"deselect"===t.type?eR?w(null):x(null):"clear-highlights"===t.type?D():"up"===t.type?el((0,lZ.B)(u)):es(t.page))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[u,el,eN,eC,es,eO,eP,D,eR]);let ez=null!==p&&p.place===uO(l)&&p.selected===m?p.error:null,eL=h??ez,eI=null!==e$&&null!==er&&(!eA.covers||eR),eD=eI&&eA.covers,eB=eA.covers&&!eI?e$:null,eT=eI&&!eD?400:0,eH=null!==er&&eC>1&&!eD,eV=eH?Y?.width??null:null,eF=null!==eL&&!eD,eq=null===(e=U?.height??null)||24+e<=64?"band":"card",eX=eF?"band"===eq?24+(U?.height??0):16+(G?.height??0):0;return i?.code==="INDEX_EMPTY"?(0,y.jsx)(uD,{}):(0,y.jsxs)("div",{className:"absolute inset-0 flex flex-col",children:[(0,y.jsx)(u_,{repo:et?(0,y.jsx)(up,{repo:et,onSwitched:ew,onHome:ek}):null,onSearch:()=>C(!0),status:(0,y.jsx)(ub,{status:o}),onHelp:()=>O(!0)}),(0,y.jsxs)("div",{className:"pointer-events-auto relative z-10 flex h-10 items-center justify-between gap-4 border-b border-hairline bg-canvas px-4",children:[er&&et?uM?(0,y.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[(0,y.jsx)(ay,{enabled:_}),(0,y.jsx)(lG,{repo:et,trail:er.breadcrumb,onOpen:el})]}):(0,y.jsx)(lG,{repo:et,trail:er.breadcrumb,onOpen:el}):(0,y.jsx)("span",{}),(0,y.jsx)("div",{className:"flex shrink-0 items-center gap-4 text-[12px] text-text-2",children:er&&er.edges.length>60&&(0,y.jsxs)("span",{"data-testid":"lines-note",children:[(0,y.jsxs)("span",{className:"max-[768px]:hidden",children:[B?`All ${l3(er.edges.length)} lines shown`:"Busy folder: lines show on hover"," · "]}),(0,y.jsx)("button",{type:"button","data-testid":"lines-toggle",onClick:()=>T(e=>!e),title:B?`All ${l3(er.edges.length)} lines are shown`:"A busy folder: a box's lines show when you hover or select it",className:"text-control underline underline-offset-2 hover:text-text",children:B?"Show on hover only":"Show all lines"})]})})]}),(0,y.jsxs)("main",{ref:F,className:"relative flex-1",children:[er&&(0,y.jsx)(ua,{level:er,selected:e$,agent:eb,pulses:H,onSelect:ef,onOpen:el,onTurnPage:es,onDrawn:eE,quietLines:!B&&er.edges.length>60,panelWidth:eT,covered:eD,bannerBottom:eX,actionsFor:eB,onDetails:eM}),er&&eH&&(0,y.jsx)(uL,{sizeRef:W,level:er,onTurn:es,panelWidth:eT,form:null===(t=null===X?null:X-eT)||t>=440?"full":t>=240?"page":"numbers"}),!er&&!h&&(0,y.jsx)("p",{className:"absolute inset-0 grid place-items-center px-4 text-center text-[13px] text-text-2",children:"Loading the map…"}),eL&&eF&&(0,y.jsx)(uI,{message:eL.message,form:eq,panelWidth:eT,pillWidth:eV,bandRef:K,cardRef:Z}),eI&&null!==e$&&er&&(0,y.jsx)(sx,{path:e$,level:er,indexVersion:en??0,onFocus:eu,onOpen:el,onTurnPage:es,onClose:eA.covers?eS:ej,onOpenInEditor:null===eh?void 0:ep,covers:eA.covers,alert:eD?eL?.message:void 0},e$)]}),(0,y.jsx)(sB,{recent:eg.recent,connected:eg.connected,highlightCount:P.length,onClear:D}),$&&(0,y.jsx)(s$,{onClose:e_}),N&&(0,y.jsx)(ux,{onPick:e=>{C(!1),eu(e.path)},onClose:()=>C(!1)})]})}function uL({sizeRef:e,level:t,onTurn:n,panelWidth:r,form:o}){let i,a=e=>{let r="left"===e?t.page-1:t.page+1,o=r<0||r>=t.pageCount;return(0,y.jsx)("button",{type:"button","data-testid":`page-${"left"===e?"previous":"next"}`,disabled:o,onClick:()=>n(r),"aria-label":`${"left"===e?"Previous":"Next"} page`,title:`${"left"===e?"Previous":"Next"} page (${"left"===e?"←":"→"})`,className:"grid h-9 w-9 place-items-center rounded-md text-control hover:bg-overlay-line disabled:opacity-35 disabled:hover:bg-transparent",children:(0,y.jsx)("left"===e?au:ad,{"aria-hidden":!0,size:22,stroke:2})})},l=(i=t.nodes.filter(e=>"portal"!==e.kind).length,`Page ${t.page+1} of ${t.pageCount} \xb7 ${l3(i)} of ${l3(i+t.hiddenCount)} folders and files`),[s,...u]=l.split(" · ");return(0,y.jsxs)("div",{ref:e,style:{right:r+16},className:"absolute top-4 z-[7] flex items-center gap-1.5 rounded-lg bg-overlay p-1",children:[a("left"),(0,y.jsxs)("span",{"data-testid":"page-note",title:"full"===o?void 0:l,className:"whitespace-nowrap px-1 text-[14px] text-text",children:["numbers"===o?`${t.page+1} / ${t.pageCount}`:s,"full"===o&&u.length>0&&(0,y.jsxs)("span",{className:"text-overlay-text-2",children:[" · ",u.join(" · ")]})]}),a("right")]})}function uI({message:e,form:t,panelWidth:n,pillWidth:r,bandRef:o,cardRef:i}){let a=null===r?0:r+8;return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("div",{ref:o,role:"band"===t?"alert":void 0,"aria-hidden":"band"!==t||void 0,style:{right:n},className:`pointer-events-none absolute left-0 top-6 flex justify-center px-4 text-[13px] text-danger ${"band"===t?"":"invisible"}`,children:[(0,y.jsx)("span",{"aria-hidden":!0,style:{flex:`0 1 ${a}px`}}),(0,y.jsx)("p",{style:{maxWidth:`calc(100% - ${a}px)`},className:"shrink-0 text-center [overflow-wrap:anywhere]",children:e}),(0,y.jsx)("span",{"aria-hidden":!0,style:{width:a},className:"shrink-0"})]}),"card"===t&&(0,y.jsx)("div",{ref:i,role:"alert",style:{maxWidth:`calc(100% - ${16+n+Math.max(49,null===r?0:16+r+8)}px)`},className:"pointer-events-none absolute left-4 top-4 z-[7] rounded-lg border border-hairline bg-panel px-3 py-2 text-[13px] text-danger [overflow-wrap:anywhere]",children:e})]})}function uD(){return(0,y.jsx)("div",{className:"absolute inset-0 grid place-items-center px-4",children:(0,y.jsxs)("div",{className:"max-w-md space-y-2 text-center text-[14px] text-text-2",children:[(0,y.jsx)("p",{className:"text-[15px] font-medium text-text",children:"No repository indexed yet."}),(0,y.jsxs)("p",{children:["Index one from a terminal, then reload: ",(0,y.jsx)("code",{className:"rounded-md bg-code-bg px-1 font-mono text-[13px] text-code",children:"nebulosity index <path-to-repo>"})]}),(0,y.jsxs)("p",{children:["In a checkout of Nebulosity: ",(0,y.jsx)("code",{className:"rounded-md bg-code-bg px-1 font-mono text-[13px] text-code",children:"npm run index -- <path-to-repo>"})]})]})})}e.s(["default",0,function(){return(0,y.jsx)(iI,{children:(0,y.jsx)(uz,{})})}],75772)},5500,(e,t,n)=>{e.i(47167),Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"Image",{enumerable:!0,get:function(){return v}});let r=e.r(55682),o=e.r(90809),i=e.r(43476),a=o._(e.r(71645)),l=r._(e.r(74080)),s=r._(e.r(25633)),u=e.r(8927),d=e.r(65856),c=e.r(49381),h=r._(e.r(1948)),f=e.r(18581);function p(e,t,n,r,o,i,a){let l=e?.src;e&&e["data-loaded-src"]!==l&&(e["data-loaded-src"]=l,("decode"in e?e.decode():Promise.resolve()).catch(()=>{}).then(()=>{if(e.parentElement&&e.isConnected){if("empty"!==t&&o(!0),n?.current){let t=new Event("load");Object.defineProperty(t,"target",{writable:!1,value:e});let r=!1,o=!1;n.current({...t,nativeEvent:t,currentTarget:e,target:e,isDefaultPrevented:()=>r,isPropagationStopped:()=>o,persist:()=>{},preventDefault:()=>{r=!0,t.preventDefault()},stopPropagation:()=>{o=!0,t.stopPropagation()}})}r?.current&&r.current(e)}}))}function g(e){return a.use?{fetchPriority:e}:{fetchpriority:e}}"u"<typeof window&&(globalThis.__NEXT_IMAGE_IMPORTED=!0);let m="u"<typeof window?a.useEffect:a.useLayoutEffect,x=(0,a.forwardRef)(({src:e,srcSet:t,sizes:n,height:r,width:o,decoding:l,className:s,style:u,fetchPriority:d,placeholder:c,loading:h,unoptimized:x,fill:y,onLoadRef:v,onLoadingCompleteRef:b,setBlurComplete:w,setShowAltText:E,sizesInput:k,onLoad:_,onError:j,...S},M)=>{let N=(0,a.useRef)(!1),C=(0,a.useRef)(null);m(()=>{let{current:e}=N,{current:t}=C;e||null===t||(j&&(t.src=t.src),t.complete&&p(t,c,v,b,w,x,k),N.current=!0)},[e,c,v,b,j,x,k]);let $=(0,f.useMergedRef)(M,C);return(0,i.jsx)("img",{...S,...g(d),loading:h,width:o,height:r,decoding:l,"data-nimg":y?"fill":"1",className:s,style:u,sizes:n,srcSet:t,src:e,ref:$,onLoad:e=>{p(e.currentTarget,c,v,b,w,x,k)},onError:e=>{E(!0),"empty"!==c&&w(!0),j&&j(e)}})});function y({isAppRouter:e,imgAttributes:t}){let n={as:"image",imageSrcSet:t.srcSet,imageSizes:t.sizes,crossOrigin:t.crossOrigin,referrerPolicy:t.referrerPolicy,...g(t.fetchPriority)};return e&&l.default.preload?(l.default.preload(t.src,n),null):(0,i.jsx)(s.default,{children:(0,i.jsx)("link",{rel:"preload",href:t.srcSet?void 0:t.src,...n},"__nimg-"+t.src+t.srcSet+t.sizes)})}let v=(0,a.forwardRef)((e,t)=>{let n=(0,a.useContext)(d.RouterContext),r=(0,c.useImageConfig)(),{onLoad:o,onLoadingComplete:l}=e,s=(0,a.useRef)(o);(0,a.useEffect)(()=>{s.current=o},[o]);let f=(0,a.useRef)(l);(0,a.useEffect)(()=>{f.current=l},[l]);let[p,g]=(0,a.useState)(!1),[m,v]=(0,a.useState)(!1),{props:b,meta:w}=(0,u.getImgProps)(e,{defaultLoader:h.default,imgConf:r,blurComplete:p,showAltText:m});return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(x,{...b,unoptimized:w.unoptimized,placeholder:w.placeholder,fill:w.fill,onLoadRef:s,onLoadingCompleteRef:f,setBlurComplete:g,setShowAltText:v,sizesInput:e.sizes,ref:t}),w.preload?(0,i.jsx)(y,{isAppRouter:!n,imgAttributes:b}):null]})});("function"==typeof n.default||"object"==typeof n.default&&null!==n.default)&&void 0===n.default.__esModule&&(Object.defineProperty(n.default,"__esModule",{value:!0}),Object.assign(n.default,n),t.exports=n.default)},49381,(e,t,n)=>{e.i(47167),Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"useImageConfig",{enumerable:!0,get:function(){return l}});let r=e.r(71645),o=e.r(87690),i=e.r(18556),a={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],qualities:[75],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1};function l(){let e=(0,r.useContext)(i.ImageConfigContext);return(0,o.prepareImageConfig)(a,e)}("function"==typeof n.default||"object"==typeof n.default&&null!==n.default)&&void 0===n.default.__esModule&&(Object.defineProperty(n.default,"__esModule",{value:!0}),Object.assign(n.default,n),t.exports=n.default)},18581,(e,t,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"useMergedRef",{enumerable:!0,get:function(){return o}});let r=e.r(71645);function o(e,t){let n=(0,r.useRef)(null),o=(0,r.useRef)(null);return(0,r.useCallback)(r=>{if(null===r){let e=n.current;e&&(n.current=null,e());let t=o.current;t&&(o.current=null,t())}else e&&(n.current=i(e,r)),t&&(o.current=i(t,r))},[e,t])}function i(e,t){if("function"!=typeof e)return e.current=t,()=>{e.current=null};{let n=e(t);return"function"==typeof n?n:()=>e(null)}}("function"==typeof n.default||"object"==typeof n.default&&null!==n.default)&&void 0===n.default.__esModule&&(Object.defineProperty(n.default,"__esModule",{value:!0}),Object.assign(n.default,n),t.exports=n.default)},70965,(e,t,n)=>{function r(e,t){let n=e||75;return t?.qualities?.length?t.qualities.reduce((e,t)=>Math.abs(t-n)<Math.abs(e-n)?t:e,t.qualities[0]):n}Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"findClosestQuality",{enumerable:!0,get:function(){return r}})},8927,(e,t,n)=>{e.i(47167),Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"getImgProps",{enumerable:!0,get:function(){return s}});let r=e.r(43369),o=e.r(88143),i=["-moz-initial","fill","none","scale-down",void 0];function a(e){return void 0!==e.default}function l(e){return void 0===e?e:"number"==typeof e?Number.isFinite(e)?e:0/0:"string"==typeof e&&/^[0-9]+$/.test(e)?parseInt(e,10):0/0}function s({src:e,sizes:t,unoptimized:n=!1,priority:u=!1,preload:d=!1,loading:c,className:h,quality:f,width:p,height:g,fill:m=!1,style:x,overrideSrc:y,onLoad:v,onLoadingComplete:b,placeholder:w="empty",blurDataURL:E,fetchPriority:k,decoding:_="async",layout:j,objectFit:S,objectPosition:M,lazyBoundary:N,lazyRoot:C,...$},O){var P;let A,R,{imgConf:z,showAltText:L,blurComplete:I,defaultLoader:D}=O;if(void 0===D)throw Error("images.loaderFile detected but the file is missing default export.\nRead more: https://nextjs.org/docs/messages/invalid-images-config");let B=$.loader||D;delete $.loader,delete $.srcSet;let T="__next_img_default"in B;if(T){if("custom"===z.loader)throw Error(`Image with src "${e}" is missing "loader" prop.
6
- Read more: https://nextjs.org/docs/messages/next-image-missing-loader`)}else{let e=B;B=t=>{let{config:n,...r}=t;return e(r)}}if(j){"fill"===j&&(m=!0);let e={intrinsic:{maxWidth:"100%",height:"auto"},responsive:{width:"100%",height:"auto"}}[j];e&&(x={...x,...e});let n={responsive:"100vw",fill:"100vw"}[j];n&&!t&&(t=n)}let H="",V=l(p),F=l(g);if((P=e)&&"object"==typeof P&&(a(P)||void 0!==P.src)){let t=a(e)?e.default:e;if(!t.src)throw Error(`An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received ${JSON.stringify(t)}`);if(!t.height||!t.width)throw Error(`An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received ${JSON.stringify(t)}`);if(A=t.blurWidth,R=t.blurHeight,E=E||t.blurDataURL,H=t.src,!m)if(V||F){if(V&&!F){let e=V/t.width;F=Math.round(t.height*e)}else if(!V&&F){let e=F/t.height;V=Math.round(t.width*e)}}else V=t.width,F=t.height}let q=!u&&!d&&("lazy"===c||void 0===c);(!(e="string"==typeof e?e:H)||e.startsWith("data:")||e.startsWith("blob:"))&&(n=!0,q=!1),z.unoptimized&&(n=!0),T&&!z.dangerouslyAllowSVG&&e.split("?",1)[0].endsWith(".svg")&&(n=!0);let X=l(f),W=Object.assign(m?{position:"absolute",height:"100%",width:"100%",left:0,top:0,right:0,bottom:0,objectFit:S,objectPosition:M}:{},L?{}:{color:"transparent"},x),Y=I||"empty"===w?null:"blur"===w?`url("data:image/svg+xml;charset=utf-8,${(0,o.getImageBlurSvg)({widthInt:V,heightInt:F,blurWidth:A,blurHeight:R,blurDataURL:E||"",objectFit:W.objectFit})}")`:`url("${w}")`,K=i.includes(W.objectFit)?"fill"===W.objectFit?"100% 100%":"cover":W.objectFit,U=Y?{backgroundSize:K,backgroundPosition:W.objectPosition||"50% 50%",backgroundRepeat:"no-repeat",backgroundImage:Y}:{},Z=function({config:e,src:t,unoptimized:n,width:o,quality:i,sizes:a,loader:l}){if(n){if(t.startsWith("/")&&!t.startsWith("//")){let e=(0,r.getDeploymentId)();if(t.includes("/_next/static/immutable")&&!(0,r.getAssetToken)())e=void 0;else if(e){let n=t.indexOf("?");if(-1!==n){let r=new URLSearchParams(t.slice(n+1));r.get("dpl")||(r.append("dpl",e),t=t.slice(0,n)+"?"+r.toString())}else t+=`?dpl=${e}`}}return{src:t,srcSet:void 0,sizes:void 0}}let{widths:s,kind:u}=function({deviceSizes:e,allSizes:t},n,r){if(r){let n=/(^|\s)(1?\d?\d)vw/g,o=[];for(let e;e=n.exec(r);)o.push(parseInt(e[2]));if(o.length){let n=.01*Math.min(...o);return{widths:t.filter(t=>t>=e[0]*n),kind:"w"}}return{widths:t,kind:"w"}}return"number"!=typeof n?{widths:e,kind:"w"}:{widths:[...new Set([n,2*n].map(e=>t.find(t=>t>=e)||t[t.length-1]))],kind:"x"}}(e,o,a),d=s.length-1;return{sizes:a||"w"!==u?a:"100vw",srcSet:s.map((n,r)=>`${l({config:e,src:t,quality:i,width:n})} ${"w"===u?n:r+1}${u}`).join(", "),src:l({config:e,src:t,quality:i,width:s[d]})}}({config:z,src:e,unoptimized:n,width:V,quality:X,sizes:t,loader:B}),G=q?"lazy":c;return{props:{...$,loading:G,fetchPriority:k,width:V,height:F,decoding:_,className:h,style:{...W,...U},sizes:Z.sizes,srcSet:Z.srcSet,src:y||Z.src},meta:{unoptimized:n,preload:d||u,placeholder:w,fill:m}}}},25633,(e,t,n)=>{e.i(47167),Object.defineProperty(n,"__esModule",{value:!0});var r={default:function(){return g},defaultHead:function(){return c}};for(var o in r)Object.defineProperty(n,o,{enumerable:!0,get:r[o]});let i=e.r(55682),a=e.r(90809),l=e.r(43476),s=a._(e.r(71645)),u=i._(e.r(98879)),d=e.r(42732);function c(){return[(0,l.jsx)("meta",{charSet:"utf-8"},"charset"),(0,l.jsx)("meta",{name:"viewport",content:"width=device-width"},"viewport")]}function h(e,t){return"string"==typeof t||"number"==typeof t?e:t.type===s.default.Fragment?e.concat(s.default.Children.toArray(t.props.children).reduce((e,t)=>"string"==typeof t||"number"==typeof t?e:e.concat(t),[])):e.concat(t)}let f=["name","httpEquiv","charSet","itemProp"];function p(e){let t,n,r,o;return e.reduce(h,[]).reverse().concat(c().reverse()).filter((t=new Set,n=new Set,r=new Set,o={},e=>{let i=!0,a=!1;if(e.key&&"number"!=typeof e.key&&e.key.indexOf("$")>0){a=!0;let n=e.key.slice(e.key.indexOf("$")+1);t.has(n)?i=!1:t.add(n)}switch(e.type){case"title":case"base":n.has(e.type)?i=!1:n.add(e.type);break;case"meta":for(let t=0,n=f.length;t<n;t++){let n=f[t];if(e.props.hasOwnProperty(n))if("charSet"===n)r.has(n)?i=!1:r.add(n);else{let t=e.props[n],r=o[n]||new Set;("name"!==n||!a)&&r.has(t)?i=!1:(r.add(t),o[n]=r)}}}return i})).reverse().map((e,t)=>{let n=e.key||t;return s.default.cloneElement(e,{key:n})})}let g=function({children:e}){let t=(0,s.useContext)(d.HeadManagerContext);return(0,l.jsx)(u.default,{reduceComponentsToState:p,headManager:t,children:e})};("function"==typeof n.default||"object"==typeof n.default&&null!==n.default)&&void 0===n.default.__esModule&&(Object.defineProperty(n.default,"__esModule",{value:!0}),Object.assign(n.default,n),t.exports=n.default)},88143,(e,t,n)=>{function r({widthInt:e,heightInt:t,blurWidth:n,blurHeight:o,blurDataURL:i,objectFit:a}){let l=n?40*n:e,s=o?40*o:t,u=l&&s?`viewBox='0 0 ${l} ${s}'`:"";return`%3Csvg xmlns='http://www.w3.org/2000/svg' ${u}%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3CfeColorMatrix values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1' result='s'/%3E%3CfeFlood x='0' y='0' width='100%25' height='100%25'/%3E%3CfeComposite operator='out' in='s'/%3E%3CfeComposite in2='SourceGraphic'/%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3C/filter%3E%3Cimage width='100%25' height='100%25' x='0' y='0' preserveAspectRatio='${u?"none":"contain"===a?"xMidYMid":"cover"===a?"xMidYMid slice":"none"}' style='filter: url(%23b);' href='${i}'/%3E%3C/svg%3E`}Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"getImageBlurSvg",{enumerable:!0,get:function(){return r}})},18556,(e,t,n)=>{e.i(47167),Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"ImageConfigContext",{enumerable:!0,get:function(){return i}});let r=e.r(55682)._(e.r(71645)),o=e.r(87690),i=r.default.createContext(o.imageConfigDefault)},87690,(e,t,n)=>{Object.defineProperty(n,"__esModule",{value:!0});var r={VALID_LOADERS:function(){return i},imageConfigDefault:function(){return u},prepareImageConfig:function(){return s}};for(var o in r)Object.defineProperty(n,o,{enumerable:!0,get:r[o]});let i=["default","imgix","cloudinary","akamai","custom"],a={},l=new WeakMap;function s(e,t){let n=e??a,r=t??a,o=l.get(n);if(o){let e=o.get(r);if(e)return e}let i=e||t||u,s=[...i.deviceSizes].sort((e,t)=>e-t),d=[...i.imageSizes],c={deviceSizes:s,imageSizes:d,allSizes:[...s,...d].sort((e,t)=>e-t),qualities:void 0===i.qualities?void 0:[...i.qualities].sort((e,t)=>e-t),path:i.path,loader:i.loader,dangerouslyAllowSVG:i.dangerouslyAllowSVG,unoptimized:i.unoptimized,domains:i.domains,remotePatterns:i.remotePatterns,localPatterns:"u"<typeof window&&void 0!==t?t.localPatterns:i.localPatterns,output:i.output};return o||(o=new WeakMap,l.set(n,o)),o.set(r,c),c}let u={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],path:"/_next/image",loader:"default",loaderFile:"",domains:[],disableStaticImages:!1,minimumCacheTTL:14400,formats:["image/webp"],maximumDiskCacheSize:void 0,maximumRedirects:3,maximumResponseBody:5e7,dangerouslyAllowLocalIP:!1,dangerouslyAllowSVG:!1,contentSecurityPolicy:"script-src 'none'; frame-src 'none'; sandbox;",contentDispositionType:"attachment",localPatterns:void 0,remotePatterns:[],qualities:[75],unoptimized:!1,customCacheHandler:!1}},1948,(e,t,n)=>{e.i(47167),Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"default",{enumerable:!0,get:function(){return a}});let r=e.r(70965),o=e.r(43369);function i({config:e,src:t,width:n,quality:a}){let l=(0,o.getDeploymentId)();if(t.startsWith("/")&&!t.startsWith("//"))if(t.includes("/_next/static/immutable")&&!(0,o.getAssetToken)())l=void 0;else{let e=t.indexOf("?");if(-1!==e){let n=new URLSearchParams(t.slice(e+1)),r=n.get("dpl");if(r){l=r,n.delete("dpl");let o=n.toString();t=t.slice(0,e)+(o?"?"+o:"")}}}if(t.startsWith("/")&&t.includes("?")&&e.localPatterns?.length===1&&"**"===e.localPatterns[0].pathname&&""===e.localPatterns[0].search)throw Error(`Image with src "${t}" is using a query string which is not configured in images.localPatterns.
7
- Read more: https://nextjs.org/docs/messages/next-image-unconfigured-localpatterns`);let s=(0,r.findClosestQuality)(a,e);return`${e.path}?url=${encodeURIComponent(t)}&w=${n}&q=${s}${t.startsWith("/")&&l?`&dpl=${l}`:""}`}i.__next_img_default=!0;let a=i},65856,(e,t,n)=>{e.i(47167),Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"RouterContext",{enumerable:!0,get:function(){return r}});let r=(e.r(55682)._(e.r(71645))).default.createContext(null)},98879,(e,t,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"default",{enumerable:!0,get:function(){return l}});let r=e.r(71645),o="u"<typeof window,i=o?()=>{}:r.useLayoutEffect,a=o?()=>{}:r.useEffect;function l(e){let{headManager:t,reduceComponentsToState:n}=e;function l(){if(t&&t.mountedInstances){let e=r.Children.toArray(Array.from(t.mountedInstances).filter(Boolean));t.updateHead(n(e))}}return o&&(t?.mountedInstances?.add(e.children),l()),i(()=>(t?.mountedInstances?.add(e.children),()=>{t?.mountedInstances?.delete(e.children)})),i(()=>(t&&(t._pendingUpdate=l),()=>{t&&(t._pendingUpdate=l)})),a(()=>(t&&t._pendingUpdate&&(t._pendingUpdate(),t._pendingUpdate=null),()=>{t&&t._pendingUpdate&&(t._pendingUpdate(),t._pendingUpdate=null)})),null}},55838,(e,t,n)=>{var r=e.r(71645),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=r.useState,a=r.useEffect,l=r.useLayoutEffect,s=r.useDebugValue;function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!o(e,n)}catch(e){return!0}}var d="u"<typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),o=r[0].inst,d=r[1];return l(function(){o.value=n,o.getSnapshot=t,u(o)&&d({inst:o})},[e,n,t]),a(function(){return u(o)&&d({inst:o}),e(function(){u(o)&&d({inst:o})})},[e]),s(n),n};n.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:d},52822,(e,t,n)=>{var r=e.r(71645),o=e.r(2239),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=o.useSyncExternalStore,l=r.useRef,s=r.useEffect,u=r.useMemo,d=r.useDebugValue;n.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var c=l(null);if(null===c.current){var h={hasValue:!1,value:null};c.current=h}else h=c.current;var f=a(e,(c=u(function(){function e(e){if(!s){if(s=!0,a=e,e=r(e),void 0!==o&&h.hasValue){var t=h.value;if(o(t,e))return l=t}return l=e}if(t=l,i(a,e))return t;var n=r(e);return void 0!==o&&o(t,n)?(a=e,t):(a=e,l=n)}var a,l,s=!1,u=void 0===n?null:n;return[function(){return e(t())},null===u?void 0:function(){return e(u())}]},[t,n,r,o]))[0],c[1]);return s(function(){h.hasValue=!0,h.value=f},[f]),d(f),f}},2239,(e,t,n)=>{e.i(47167),t.exports=e.r(55838)},30224,(e,t,n)=>{e.i(47167),t.exports=e.r(52822)}])})();