@shepai/cli 1.120.0 → 1.121.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.
- package/dist/src/presentation/web/components/common/feature-list-item/feature-list-item.stories.d.ts +1 -0
- package/dist/src/presentation/web/components/common/feature-list-item/feature-list-item.stories.d.ts.map +1 -1
- package/dist/src/presentation/web/components/common/feature-list-item/feature-list-item.stories.js +8 -0
- package/dist/src/presentation/web/components/common/feature-status-badges/feature-status-badges.stories.js +6 -6
- package/dist/src/presentation/web/components/common/feature-status-config.d.ts +1 -1
- package/dist/src/presentation/web/components/common/feature-status-config.d.ts.map +1 -1
- package/dist/src/presentation/web/components/common/feature-status-config.js +8 -1
- package/dist/src/presentation/web/components/common/feature-status-group/feature-status-group.stories.d.ts +1 -0
- package/dist/src/presentation/web/components/common/feature-status-group/feature-status-group.stories.d.ts.map +1 -1
- package/dist/src/presentation/web/components/common/feature-status-group/feature-status-group.stories.js +7 -0
- package/dist/src/presentation/web/hooks/sidebar-features-context.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/web/.next/BUILD_ID +1 -1
- package/web/.next/build-manifest.json +2 -2
- package/web/.next/fallback-build-manifest.json +2 -2
- package/web/.next/prerender-manifest.json +3 -3
- package/web/.next/required-server-files.js +2 -2
- package/web/.next/required-server-files.json +2 -2
- package/web/.next/server/app/(dashboard)/@drawer/create/page/server-reference-manifest.json +21 -21
- package/web/.next/server/app/(dashboard)/@drawer/create/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/create/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page/server-reference-manifest.json +27 -27
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page/server-reference-manifest.json +27 -27
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page/server-reference-manifest.json +19 -19
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/create/page/server-reference-manifest.json +21 -21
- package/web/.next/server/app/(dashboard)/create/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/create/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page/server-reference-manifest.json +27 -27
- package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/page/server-reference-manifest.json +27 -27
- package/web/.next/server/app/(dashboard)/feature/[featureId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/page/server-reference-manifest.json +19 -19
- package/web/.next/server/app/(dashboard)/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page/server-reference-manifest.json +19 -19
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/_global-error.html +2 -2
- package/web/.next/server/app/_global-error.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/web/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
- package/web/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/settings/page/server-reference-manifest.json +6 -6
- package/web/.next/server/app/settings/page.js.nft.json +1 -1
- package/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/skills/page/server-reference-manifest.json +6 -6
- package/web/.next/server/app/skills/page.js.nft.json +1 -1
- package/web/.next/server/app/skills/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/tools/page/server-reference-manifest.json +6 -6
- package/web/.next/server/app/tools/page.js.nft.json +1 -1
- package/web/.next/server/app/tools/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/version/page/server-reference-manifest.json +1 -1
- package/web/.next/server/app/version/page.js.nft.json +1 -1
- package/web/.next/server/app/version/page_client-reference-manifest.js +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__a402b567._.js +1 -1
- package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js +1 -1
- package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js.map +1 -1
- package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_@drawer_repository_[repositoryId]_page_actions_ed372306.js +1 -1
- package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_@drawer_repository_[repositoryId]_page_actions_ed372306.js.map +1 -1
- package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_repository_[repositoryId]_page_actions_32e26434.js +1 -1
- package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_repository_[repositoryId]_page_actions_32e26434.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__06fef644._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__3b14e5a0._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__3b14e5a0._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__545792ab._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__545792ab._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__6b17a22d._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__6b17a22d._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__6bb00d90._.js +2 -2
- package/web/.next/server/chunks/ssr/[root-of-the-server]__6bb00d90._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__804c006d._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__804c006d._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__8b59c03e._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__8b59c03e._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__8c553503._.js +2 -2
- package/web/.next/server/chunks/ssr/[root-of-the-server]__994ad9fe._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__994ad9fe._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__a022445f._.js +2 -2
- package/web/.next/server/chunks/ssr/[root-of-the-server]__a7de2711._.js +2 -2
- package/web/.next/server/chunks/ssr/[root-of-the-server]__c9c1cfee._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__c9c1cfee._.js.map +1 -1
- package/web/.next/server/chunks/ssr/{_16e2ff25._.js → _0314651a._.js} +2 -2
- package/web/.next/server/chunks/ssr/{_16e2ff25._.js.map → _0314651a._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/_0dc2cfd3._.js +3 -0
- package/web/.next/server/chunks/ssr/_0dc2cfd3._.js.map +1 -0
- package/web/.next/server/chunks/ssr/_135edb9c._.js +1 -1
- package/web/.next/server/chunks/ssr/_135edb9c._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_2f6f48b8._.js +1 -1
- package/web/.next/server/chunks/ssr/_2f6f48b8._.js.map +1 -1
- package/web/.next/server/chunks/ssr/{_c93f4352._.js → _68cc9b82._.js} +2 -2
- package/web/.next/server/chunks/ssr/{_c93f4352._.js.map → _68cc9b82._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/_73a34cb2._.js +3 -0
- package/web/.next/server/chunks/ssr/{_503b26e9._.js.map → _73a34cb2._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/_cc77a143._.js +1 -1
- package/web/.next/server/chunks/ssr/_cc77a143._.js.map +1 -1
- package/web/.next/server/chunks/ssr/{_f605354c._.js → _f1a649e3._.js} +3 -3
- package/web/.next/server/chunks/ssr/_f1a649e3._.js.map +1 -0
- package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js +1 -1
- package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_0835b28e._.js +2 -2
- package/web/.next/server/chunks/ssr/src_presentation_web_0835b28e._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_(dashboard)_page_actions_e99d78dd.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_(dashboard)_page_actions_e99d78dd.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_1fa8042e.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_1fa8042e.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_24684200.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_24684200.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_bf50c527._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_de814675._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_e599bb8c._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_e599bb8c._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_e8034a29._.js +2 -2
- package/web/.next/server/chunks/ssr/src_presentation_web_e8034a29._.js.map +1 -1
- package/web/.next/server/pages/500.html +2 -2
- package/web/.next/server/server-reference-manifest.js +1 -1
- package/web/.next/server/server-reference-manifest.json +33 -33
- package/web/.next/static/chunks/0cc5f5ca1696267a.js +1 -0
- package/web/.next/static/chunks/0d2af96e64960ef5.css +1 -0
- package/web/.next/static/chunks/{f518c011aaa1941e.js → 2132807f96110232.js} +1 -1
- package/web/.next/static/chunks/{abb2b485cb0da264.js → 4b58ac6e7721f9ea.js} +1 -1
- package/web/.next/static/chunks/{263497416e5198a3.js → 4c22a50608db401a.js} +1 -1
- package/web/.next/static/chunks/5186e2254580afd1.js +11 -0
- package/web/.next/static/chunks/{a5ff70a7709ec5af.js → 8ded2620c2272c27.js} +2 -2
- package/web/.next/static/chunks/{71161130b2462279.js → 96eeeb28e06de78c.js} +1 -1
- package/web/.next/static/chunks/{943a2b78e452a2fb.js → 9fdfff0a8c69ecd2.js} +2 -2
- package/web/.next/static/chunks/c6a68bd98c2c0446.js +1 -0
- package/web/.next/static/chunks/{51244236801cad96.js → f22c2cdecc7a523b.js} +1 -1
- package/web/.next/static/chunks/{57e0b981e00941e4.js → f27e3d3959bf91e6.js} +1 -1
- package/web/.next/server/chunks/ssr/_503b26e9._.js +0 -3
- package/web/.next/server/chunks/ssr/_ab069e13._.js +0 -3
- package/web/.next/server/chunks/ssr/_ab069e13._.js.map +0 -1
- package/web/.next/server/chunks/ssr/_f605354c._.js.map +0 -1
- package/web/.next/static/chunks/027d779d1dd1535e.js +0 -1
- package/web/.next/static/chunks/700fc491c912dd68.js +0 -1
- package/web/.next/static/chunks/844405e9e0f44c8b.js +0 -11
- package/web/.next/static/chunks/d2739454715e5ef2.css +0 -1
- /package/web/.next/static/{oxdz8EAvGqpg8JW3gRSSs → Fg0DqzWA5hDmVmj5X9iq-}/_buildManifest.js +0 -0
- /package/web/.next/static/{oxdz8EAvGqpg8JW3gRSSs → Fg0DqzWA5hDmVmj5X9iq-}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/static/{oxdz8EAvGqpg8JW3gRSSs → Fg0DqzWA5hDmVmj5X9iq-}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,17840,e=>{"use strict";var t=e.i(79054),r=e.i(31406),n=e.i(60112),o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),a=o((e,t)=>{var r=Object.defineProperty,n=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),o=(e,t,n)=>{let o;return(o="symbol"!=typeof t?t+"":t)in e?r(e,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[o]=n},a=n((e,t)=>{function r(e,t){e[t]?e[t]++:e[t]=1}function n(e,t){--e[t]||delete e[t]}function a(e,t,r,n){var o=""+t,a=""+r;if(!e&&o>a){var s=o;o=a,a=s}return o+"\x01"+a+"\x01"+(void 0===n?"\0":n)}function s(e,t){return a(e,t.v,t.w,t.name)}t.exports=class{constructor(e){o(this,"_isDirected",!0),o(this,"_isMultigraph",!1),o(this,"_isCompound",!1),o(this,"_label"),o(this,"_defaultNodeLabelFn",()=>{}),o(this,"_defaultEdgeLabelFn",()=>{}),o(this,"_nodes",{}),o(this,"_in",{}),o(this,"_preds",{}),o(this,"_out",{}),o(this,"_sucs",{}),o(this,"_edgeObjs",{}),o(this,"_edgeLabels",{}),o(this,"_nodeCount",0),o(this,"_edgeCount",0),o(this,"_parent"),o(this,"_children"),e&&(this._isDirected=!Object.hasOwn(e,"directed")||e.directed,this._isMultigraph=!!Object.hasOwn(e,"multigraph")&&e.multigraph,this._isCompound=!!Object.hasOwn(e,"compound")&&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 this._defaultNodeLabelFn=e,"function"!=typeof e&&(this._defaultNodeLabelFn=()=>e),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var e=this;return this.nodes().filter(t=>0===Object.keys(e._in[t]).length)}sinks(){var e=this;return this.nodes().filter(t=>0===Object.keys(e._out[t]).length)}setNodes(e,t){var r=arguments,n=this;return e.forEach(function(e){r.length>1?n.setNode(e,t):n.setNode(e)}),this}setNode(e,t){return Object.hasOwn(this._nodes,e)?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 Object.hasOwn(this._nodes,e)}removeNode(e){var t=this;if(Object.hasOwn(this._nodes,e)){var r=e=>t.removeEdge(t._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(function(e){t.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(r),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(r),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(var r=t;void 0!==r;r=this.parent(r))if(r===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}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var t=this._parent[e];if("\0"!==t)return t}}children(e="\0"){if(this._isCompound){var t=this._children[e];if(t)return Object.keys(t)}else{if("\0"===e)return this.nodes();if(this.hasNode(e))return[]}}predecessors(e){var t=this._preds[e];if(t)return Object.keys(t)}successors(e){var t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){var t=this.predecessors(e);if(t){let n=new Set(t);for(var r of this.successors(e))n.add(r);return Array.from(n.values())}}isLeaf(e){return 0===(this.isDirected()?this.successors(e):this.neighbors(e)).length}filterNodes(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var r=this;Object.entries(this._nodes).forEach(function([r,n]){e(r)&&t.setNode(r,n)}),Object.values(this._edgeObjs).forEach(function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,r.edge(e))});var n={};return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,function e(o){var a=r.parent(o);return void 0===a||t.hasNode(a)?(n[o]=a,a):a in n?n[a]:e(a)}(e))),t}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=e,"function"!=typeof e&&(this._defaultEdgeLabelFn=()=>e),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){var r=this,n=arguments;return e.reduce(function(e,o){return n.length>1?r.setEdge(e,o,t):r.setEdge(e,o),o}),this}setEdge(){var e,t,n,o,s=!1,i=arguments[0];"object"==typeof i&&null!==i&&"v"in i?(e=i.v,t=i.w,n=i.name,2==arguments.length&&(o=arguments[1],s=!0)):(e=i,t=arguments[1],n=arguments[3],arguments.length>2&&(o=arguments[2],s=!0)),e=""+e,t=""+t,void 0!==n&&(n=""+n);var d=a(this._isDirected,e,t,n);if(Object.hasOwn(this._edgeLabels,d))return s&&(this._edgeLabels[d]=o),this;if(void 0!==n&&!this._isMultigraph)throw Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(t),this._edgeLabels[d]=s?o:this._defaultEdgeLabelFn(e,t,n);var l=function(e,t,r,n){var o=""+t,a=""+r;if(!e&&o>a){var s=o;o=a,a=s}var i={v:o,w:a};return n&&(i.name=n),i}(this._isDirected,e,t,n);return e=l.v,t=l.w,Object.freeze(l),this._edgeObjs[d]=l,r(this._preds[t],e),r(this._sucs[e],t),this._in[t][d]=l,this._out[e][d]=l,this._edgeCount++,this}edge(e,t,r){var n=1==arguments.length?s(this._isDirected,arguments[0]):a(this._isDirected,e,t,r);return this._edgeLabels[n]}edgeAsObj(){let e=this.edge(...arguments);return"object"!=typeof e?{label:e}:e}hasEdge(e,t,r){var n=1==arguments.length?s(this._isDirected,arguments[0]):a(this._isDirected,e,t,r);return Object.hasOwn(this._edgeLabels,n)}removeEdge(e,t,r){var o=1==arguments.length?s(this._isDirected,arguments[0]):a(this._isDirected,e,t,r),i=this._edgeObjs[o];return i&&(e=i.v,t=i.w,delete this._edgeLabels[o],delete this._edgeObjs[o],n(this._preds[t],e),n(this._sucs[e],t),delete this._in[t][o],delete this._out[e][o],this._edgeCount--),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)}filterEdges(e,t,r){if(e){var n=Object.values(e);return r?n.filter(function(e){return e.v===t&&e.w===r||e.v===r&&e.w===t}):n}}}}),s=n((e,t)=>{t.exports="3.0.2"}),i=n((e,t)=>{t.exports={Graph:a(),version:s()}}),d=n((e,t)=>{var r=a();t.exports={write:function(e){var t,r,n={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:(t=e).nodes().map(function(e){var r=t.node(e),n=t.parent(e),o={v:e};return void 0!==r&&(o.value=r),void 0!==n&&(o.parent=n),o}),edges:(r=e).edges().map(function(e){var t=r.edge(e),n={v:e.v,w:e.w};return void 0!==e.name&&(n.name=e.name),void 0!==t&&(n.value=t),n})};return void 0!==e.graph()&&(n.value=structuredClone(e.graph())),n},read:function(e){var t=new r(e.options).setGraph(e.value);return e.nodes.forEach(function(e){t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(function(e){t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}}}),l=n((e,t)=>{t.exports=function(e,t,n,o){return function(e,t,r,n){var o={},a=!0,s=0,i=e.nodes(),d=function(e){var t=r(e);o[e.v].distance+t<o[e.w].distance&&(o[e.w]={distance:o[e.v].distance+t,predecessor:e.v},a=!0)},l=function(){i.forEach(function(e){n(e).forEach(function(t){var r=t.v===e?t.v:t.w,n=r===t.v?t.w:t.v;d({v:r,w:n})})})};i.forEach(function(e){o[e]={distance:e===t?0:1/0}});for(var c=i.length,u=1;u<c&&(a=!1,s++,l(),a);u++);if(s===c-1&&(a=!1,l(),a))throw Error("The graph contains a negative weight cycle");return o}(e,String(t),n||r,o||function(t){return e.outEdges(t)})};var r=()=>1}),c=n((e,t)=>{t.exports=function(e){var t,r={},n=[];return e.nodes().forEach(function(o){t=[],function n(o){Object.hasOwn(r,o)||(r[o]=!0,t.push(o),e.successors(o).forEach(n),e.predecessors(o).forEach(n))}(o),t.length&&n.push(t)}),n}}),u=n((e,t)=>{t.exports=class{constructor(){o(this,"_arr",[]),o(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(e){return e.key})}has(e){return Object.hasOwn(this._keyIndices,e)}priority(e){var 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){var r=this._keyIndices;if(!Object.hasOwn(r,e=String(e))){var n=this._arr,o=n.length;return r[e]=o,n.push({key:e,priority:t}),this._decrease(o),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){var r=this._keyIndices[e];if(t>this._arr[r].priority)throw Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[r].priority+" New: "+t);this._arr[r].priority=t,this._decrease(r)}_heapify(e){var t=this._arr,r=2*e,n=r+1,o=e;r<t.length&&(o=t[r].priority<t[o].priority?r:o,n<t.length&&(o=t[n].priority<t[o].priority?n:o),o!==e&&(this._swap(e,o),this._heapify(o)))}_decrease(e){for(var t,r=this._arr,n=r[e].priority;0!==e&&!(r[t=e>>1].priority<n);)this._swap(e,t),e=t}_swap(e,t){var r=this._arr,n=this._keyIndices,o=r[e],a=r[t];r[e]=a,r[t]=o,n[a.key]=e,n[o.key]=t}}}),h=n((e,t)=>{var r=u();t.exports=function(e,t,o,a){return function(e,t,n,o){var a,s,i={},d=new r,l=function(e){var t=e.v!==a?e.v:e.w,r=i[t],o=n(e),l=s.distance+o;if(o<0)throw Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+o);l<r.distance&&(r.distance=l,r.predecessor=a,d.decrease(t,l))};for(e.nodes().forEach(function(e){var r=e===t?0:1/0;i[e]={distance:r},d.add(e,r)});d.size()>0&&(s=i[a=d.removeMin()]).distance!==1/0;)o(a).forEach(l);return i}(e,String(t),o||n,a||function(t){return e.outEdges(t)})};var n=()=>1}),f=n((e,t)=>{var r=h();t.exports=function(e,t,n){return e.nodes().reduce(function(o,a){return o[a]=r(e,a,t,n),o},{})}}),p=n((e,t)=>{t.exports=function(e,t,r){if(void 0!==e[t].predecessor)throw Error("Invalid source vertex");if(void 0===e[r].predecessor&&r!==t)throw Error("Invalid destination vertex");return{weight:e[r].distance,path:function(e,t,r){for(var n=[],o=r;o!==t;)n.push(o),o=e[o].predecessor;return n.push(t),n.reverse()}(e,t,r)}}}),g=n((e,t)=>{t.exports=function(e){var t=0,r=[],n={},o=[];return e.nodes().forEach(function(a){Object.hasOwn(n,a)||function a(s){var i=n[s]={onStack:!0,lowlink:t,index:t++};if(r.push(s),e.successors(s).forEach(function(e){Object.hasOwn(n,e)?n[e].onStack&&(i.lowlink=Math.min(i.lowlink,n[e].index)):(a(e),i.lowlink=Math.min(i.lowlink,n[e].lowlink))}),i.lowlink===i.index){var d,l=[];do n[d=r.pop()].onStack=!1,l.push(d);while(s!==d)o.push(l)}}(a)}),o}}),m=n((e,t)=>{var r=g();t.exports=function(e){return r(e).filter(function(t){return t.length>1||1===t.length&&e.hasEdge(t[0],t[0])})}}),v=n((e,t)=>{t.exports=function(e,t,n){var o,a,s,i,d;return o=e,a=t||r,s=n||function(t){return e.outEdges(t)},i={},(d=o.nodes()).forEach(function(e){i[e]={},i[e][e]={distance:0},d.forEach(function(t){e!==t&&(i[e][t]={distance:1/0})}),s(e).forEach(function(t){var r=t.v===e?t.w:t.v,n=a(t);i[e][r]={distance:n,predecessor:e}})}),d.forEach(function(e){var t=i[e];d.forEach(function(r){var n=i[r];d.forEach(function(r){var o=n[e],a=t[r],s=n[r],i=o.distance+a.distance;i<s.distance&&(s.distance=i,s.predecessor=a.predecessor)})})}),i};var r=()=>1}),x=n((e,t)=>{function r(e){var t={},r={},o=[];if(e.sinks().forEach(function a(s){if(Object.hasOwn(r,s))throw new n;Object.hasOwn(t,s)||(r[s]=!0,t[s]=!0,e.predecessors(s).forEach(a),delete r[s],o.push(s))}),Object.keys(t).length!==e.nodeCount())throw new n;return o}var n=class extends Error{constructor(){super(...arguments)}};t.exports=r,r.CycleException=n}),y=n((e,t)=>{var r=x();t.exports=function(e){try{r(e)}catch(e){if(e instanceof r.CycleException)return!1;throw e}return!0}}),b=n((e,t)=>{t.exports=function(e,t,r,n,o){Array.isArray(t)||(t=[t]);var a=(e.isDirected()?e.successors:e.neighbors).bind(e),s={};return t.forEach(function(t){if(!e.hasNode(t))throw Error("Graph does not have node: "+t);o=function e(t,r,n,o,a,s,i){return Object.hasOwn(o,r)||(o[r]=!0,n||(i=s(i,r)),a(r).forEach(function(r){i=e(t,r,n,o,a,s,i)}),n&&(i=s(i,r))),i}(e,t,"post"===r,s,a,n,o)}),o}}),w=n((e,t)=>{var r=b();t.exports=function(e,t,n){return r(e,t,n,function(e,t){return e.push(t),e},[])}}),E=n((e,t)=>{var r=w();t.exports=function(e,t){return r(e,t,"post")}}),k=n((e,t)=>{var r=w();t.exports=function(e,t){return r(e,t,"pre")}}),j=n((e,t)=>{var r=a(),n=u();t.exports=function(e,t){var o,a=new r,s={},i=new n;function d(e){var r=e.v===o?e.w:e.v,n=i.priority(r);if(void 0!==n){var a=t(e);a<n&&(s[r]=o,i.decrease(r,a))}}if(0===e.nodeCount())return a;e.nodes().forEach(function(e){i.add(e,1/0),a.setNode(e)}),i.decrease(e.nodes()[0],0);for(var l=!1;i.size()>0;){if(Object.hasOwn(s,o=i.removeMin()))a.setEdge(o,s[o]);else{if(l)throw Error("Input graph is not connected: "+e);l=!0}e.nodeEdges(o).forEach(d)}return a}}),N=n((e,t)=>{var r=h(),n=l();t.exports=function(e,t,o,a){return function(e,t,o,a){if(void 0===o)return r(e,t,o,a);for(var s=!1,i=e.nodes(),d=0;d<i.length;d++){for(var l=a(i[d]),c=0;c<l.length;c++){var u=l[c],h=u.v===i[d]?u.v:u.w,f=h===u.v?u.w:u.v;0>o({v:h,w:f})&&(s=!0)}if(s)return n(e,t,o,a)}return r(e,t,o,a)}(e,t,o,a||function(t){return e.outEdges(t)})}}),C=n((e,t)=>{t.exports={bellmanFord:l(),components:c(),dijkstra:h(),dijkstraAll:f(),extractPath:p(),findCycles:m(),floydWarshall:v(),isAcyclic:y(),postorder:E(),preorder:k(),prim:j(),shortestPaths:N(),reduce:b(),tarjan:g(),topsort:x()}}),_=i();t.exports={Graph:_.Graph,json:d(),alg:C(),version:_.version}}),s=o((e,t)=>{function r(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function n(e,t){if("_next"!==e&&"_prev"!==e)return t}t.exports=class{constructor(){let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return r(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&r(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,r=t._prev;for(;r!==t;)e.push(JSON.stringify(r,n)),r=r._prev;return"["+e.join(", ")+"]"}}}),i=o((e,t)=>{var r=a().Graph,n=s();t.exports=function(e,t){var a,s;let l,c,u,h,f;if(1>=e.nodeCount())return[];let p=(a=e,s=t||o,l=new r,c=0,u=0,a.nodes().forEach(e=>{l.setNode(e,{v:e,in:0,out:0})}),a.edges().forEach(e=>{let t=l.edge(e.v,e.w)||0,r=s(e);l.setEdge(e.v,e.w,t+r),u=Math.max(u,l.node(e.v).out+=r),c=Math.max(c,l.node(e.w).in+=r)}),h=(function(e){let t=[];for(let r=0;r<e;r++)t.push(r);return t})(u+c+3).map(()=>new n),f=c+1,l.nodes().forEach(e=>{d(h,f,l.node(e))}),{graph:l,buckets:h,zeroIdx:f});return(function(e,t,r){let n=[],o=t[t.length-1],a=t[0],s;for(;e.nodeCount();){for(;s=a.dequeue();)i(e,t,r,s);for(;s=o.dequeue();)i(e,t,r,s);if(e.nodeCount()){for(let o=t.length-2;o>0;--o)if(s=t[o].dequeue()){n=n.concat(i(e,t,r,s,!0));break}}}return n})(p.graph,p.buckets,p.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w))};var o=()=>1;function i(e,t,r,n,o){let a=o?[]:void 0;return e.inEdges(n.v).forEach(n=>{let s=e.edge(n),i=e.node(n.v);o&&a.push({v:n.v,w:n.w}),i.out-=s,d(t,r,i)}),e.outEdges(n.v).forEach(n=>{let o=e.edge(n),a=n.w,s=e.node(a);s.in-=o,d(t,r,s)}),e.removeNode(n.v),a}function d(e,t,r){r.out?r.in?e[r.out-r.in+t].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}}),d=o((e,t)=>{var r=a().Graph;function n(e,t,r,n){for(var o=n;e.hasNode(o);)o=d(n);return r.dummy=t,e.setNode(o,r),o}t.exports={addBorderNode:function(e,t,r,o){let a={width:0,height:0};return arguments.length>=4&&(a.rank=r,a.order=o),n(e,"border",a,t)},addDummyNode:n,applyWithChunking:o,asNonCompoundGraph:function(e){let t=new r({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(r=>{e.children(r).length||t.setNode(r,e.node(r))}),e.edges().forEach(r=>{t.setEdge(r,e.edge(r))}),t},buildLayerMatrix:function(e){let t=l(s(e)+1).map(()=>[]);return e.nodes().forEach(r=>{let n=e.node(r),o=n.rank;void 0!==o&&(t[o][n.order]=r)}),t},intersectRect:function(e,t){let r,n,o=e.x,a=e.y,s=t.x-o,i=t.y-a,d=e.width/2,l=e.height/2;if(!s&&!i)throw Error("Not possible to find intersection inside of the rectangle");return Math.abs(i)*d>Math.abs(s)*l?(i<0&&(l=-l),r=l*s/i,n=l):(s<0&&(d=-d),r=d,n=d*i/s),{x:o+r,y:a+n}},mapValues:function(e,t){let r=t;return"string"==typeof t&&(r=e=>e[t]),Object.entries(e).reduce((e,[t,n])=>(e[t]=r(n,t),e),{})},maxRank:s,normalizeRanks:function(e){let t=o(Math.min,e.nodes().map(t=>{let r=e.node(t).rank;return void 0===r?Number.MAX_VALUE:r}));e.nodes().forEach(r=>{let n=e.node(r);Object.hasOwn(n,"rank")&&(n.rank-=t)})},notime:function(e,t){return t()},partition:function(e,t){let r={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?r.lhs.push(e):r.rhs.push(e)}),r},pick:function(e,t){let r={};for(let n of t)void 0!==e[n]&&(r[n]=e[n]);return r},predecessorWeights:function(e){let t=e.nodes().map(t=>{let r={};return e.inEdges(t).forEach(t=>{r[t.v]=(r[t.v]||0)+e.edge(t).weight}),r});return c(e.nodes(),t)},range:l,removeEmptyRanks:function(e){let t=o(Math.min,e.nodes().map(t=>e.node(t).rank).filter(e=>void 0!==e)),r=[];e.nodes().forEach(n=>{let o=e.node(n).rank-t;r[o]||(r[o]=[]),r[o].push(n)});let n=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((t,r)=>{void 0===t&&r%a!=0?--n:void 0!==t&&n&&t.forEach(t=>e.node(t).rank+=n)})},simplify:function(e){let t=new r().setGraph(e.graph());return e.nodes().forEach(r=>t.setNode(r,e.node(r))),e.edges().forEach(r=>{let n=t.edge(r.v,r.w)||{weight:0,minlen:1},o=e.edge(r);t.setEdge(r.v,r.w,{weight:n.weight+o.weight,minlen:Math.max(n.minlen,o.minlen)})}),t},successorWeights:function(e){let t=e.nodes().map(t=>{let r={};return e.outEdges(t).forEach(t=>{r[t.w]=(r[t.w]||0)+e.edge(t).weight}),r});return c(e.nodes(),t)},time:function(e,t){let r=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-r)+"ms")}},uniqueId:d,zipObject:c};function o(e,t){if(!(t.length>65535))return e.apply(null,t);{let r=function(e,t=65535){let r=[];for(let n=0;n<e.length;n+=t){let o=e.slice(n,n+t);r.push(o)}return r}(t);return e.apply(null,r.map(t=>e.apply(null,t)))}}function s(e){return o(Math.max,e.nodes().map(t=>{let r=e.node(t).rank;return void 0===r?5e-324:r}))}var i=0;function d(e){return e+""+ ++i}function l(e,t,r=1){null==t&&(t=e,e=0);let n=e=>e<t;r<0&&(n=e=>t<e);let o=[];for(let t=e;n(t);t+=r)o.push(t);return o}function c(e,t){return e.reduce((e,r,n)=>(e[r]=t[n],e),{})}}),l=o((e,t)=>{var r=i(),n=d().uniqueId;t.exports={run:function(e){var t,o;let a,s,i;("greedy"===e.graph().acyclicer?r(e,(t=e,e=>t.edge(e).weight)):(a=[],s={},i={},(o=e).nodes().forEach(function e(t){Object.hasOwn(i,t)||(i[t]=!0,s[t]=!0,o.outEdges(t).forEach(t=>{Object.hasOwn(s,t.w)?a.push(t):e(t.w)}),delete s[t])}),a)).forEach(t=>{let r=e.edge(t);e.removeEdge(t),r.forwardName=t.name,r.reversed=!0,e.setEdge(t.w,t.v,r,n("rev"))})},undo:function(e){e.edges().forEach(t=>{let r=e.edge(t);if(r.reversed){e.removeEdge(t);let n=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(t.w,t.v,r,n)}})}}}),c=o((e,t)=>{var r=d();t.exports={run:function(e){e.graph().dummyChains=[],e.edges().forEach(t=>(function(e,t){let n,o,a,s=t.v,i=e.node(s).rank,d=t.w,l=e.node(d).rank,c=t.name,u=e.edge(t),h=u.labelRank;if(l!==i+1){for(e.removeEdge(t),a=0,++i;i<l;++a,++i)u.points=[],o={width:0,height:0,edgeLabel:u,edgeObj:t,rank:i},n=r.addDummyNode(e,"edge",o,"_d"),i===h&&(o.width=u.width,o.height=u.height,o.dummy="edge-label",o.labelpos=u.labelpos),e.setEdge(s,n,{weight:u.weight},c),0===a&&e.graph().dummyChains.push(n),s=n;e.setEdge(s,d,{weight:u.weight},c)}})(e,t))},undo:function(e){e.graph().dummyChains.forEach(t=>{let r=e.node(t),n=r.edgeLabel,o;for(e.setEdge(r.edgeObj,n);r.dummy;)o=e.successors(t)[0],e.removeNode(t),n.points.push({x:r.x,y:r.y}),"edge-label"===r.dummy&&(n.x=r.x,n.y=r.y,n.width=r.width,n.height=r.height),t=o,r=e.node(t)})}}}),u=o((e,t)=>{var{applyWithChunking:r}=d();t.exports={longestPath:function(e){var t={};e.sources().forEach(function n(o){var a=e.node(o);if(Object.hasOwn(t,o))return a.rank;t[o]=!0;var s=r(Math.min,e.outEdges(o).map(t=>null==t?1/0:n(t.w)-e.edge(t).minlen));return s===1/0&&(s=0),a.rank=s})},slack:function(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}}}),h=o((e,t)=>{var r=a().Graph,n=u().slack;t.exports=function(e){var t,o,a,s,i=new r({directed:!1}),d=e.nodes()[0],l=e.nodeCount();for(i.setNode(d,{});t=i,o=e,t.nodes().forEach(function e(r){o.nodeEdges(r).forEach(a=>{var s=a.v,i=r===s?a.w:s;t.hasNode(i)||n(o,a)||(t.setNode(i,{}),t.setEdge(r,i,{}),e(i))})}),t.nodeCount()<l;)a=function(e,t){return t.edges().reduce((r,o)=>{let a=1/0;return e.hasNode(o.v)!==e.hasNode(o.w)&&(a=n(t,o)),a<r[0]?[a,o]:r},[1/0,null])[1]}(i,e),s=i.hasNode(a.v)?n(e,a):-n(e,a),function(e,t,r){e.nodes().forEach(e=>t.node(e).rank+=r)}(i,e,s);return i}}),f=o((e,t)=>{var r=h(),n=u().slack,o=u().longestPath,s=a().alg.preorder,i=a().alg.postorder,l=d().simplify;function c(e){o(e=l(e));var t,n,a=r(e);for(g(a),f(a,e);t=m(a);)n=v(a,e,t),x(a,e,t,n)}function f(e,t){var r=i(e,e.nodes());(r=r.slice(0,r.length-1)).forEach(r=>{var n,o,a,s;return n=e,o=t,a=r,s=n.node(a).parent,void(n.edge(a,s).cutvalue=p(n,o,a))})}function p(e,t,r){var n=e.node(r).parent,o=!0,a=t.edge(r,n),s=0;return a||(o=!1,a=t.edge(n,r)),s=a.weight,t.nodeEdges(r).forEach(a=>{var i=a.v===r,d=i?a.w:a.v;if(d!==n){var l,c,u,h=i===o,f=t.edge(a).weight;if(s+=h?f:-f,l=e,c=r,u=d,l.hasEdge(c,u)){var p=e.edge(r,d).cutvalue;s+=h?-p:p}}}),s}function g(e,t){arguments.length<2&&(t=e.nodes()[0]),function e(t,r,n,o,a){var s=n,i=t.node(o);return r[o]=!0,t.neighbors(o).forEach(a=>{Object.hasOwn(r,a)||(n=e(t,r,n,a,o))}),i.low=s,i.lim=n++,a?i.parent=a:delete i.parent,n}(e,{},1,t)}function m(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function v(e,t,r){var o=r.v,a=r.w;t.hasEdge(o,a)||(o=r.w,a=r.v);var s=e.node(o),i=e.node(a),d=s,l=!1;return s.lim>i.lim&&(d=i,l=!0),t.edges().filter(t=>l===y(e,e.node(t.v),d)&&l!==y(e,e.node(t.w),d)).reduce((e,r)=>n(t,r)<n(t,e)?r:e)}function x(e,t,r,n){var o,a,i,d,l=r.v,c=r.w;e.removeEdge(l,c),e.setEdge(n.v,n.w,{}),g(e),f(e,t),o=e,a=t,i=o.nodes().find(e=>!a.node(e).parent),(d=(d=s(o,i)).slice(1)).forEach(e=>{var t=o.node(e).parent,r=a.edge(e,t),n=!1;r||(r=a.edge(t,e),n=!0),a.node(e).rank=a.node(t).rank+(n?r.minlen:-r.minlen)})}function y(e,t,r){return r.low<=t.lim&&t.lim<=r.lim}t.exports=c,c.initLowLimValues=g,c.initCutValues=f,c.calcCutValue=p,c.leaveEdge=m,c.enterEdge=v,c.exchangeEdges=x}),p=o((e,t)=>{var r=u().longestPath,n=h(),o=f();t.exports=function(e){var t,s=e.graph().ranker;if(s instanceof Function)return s(e);switch(e.graph().ranker){case"network-simplex":default:o(e);break;case"tight-tree":r(t=e),n(t);break;case"longest-path":a(e);case"none":}};var a=r}),g=o((e,t)=>{t.exports=function(e){var t;let r,n,o=(r={},n=0,(t=e).children().forEach(function e(o){let a=n;t.children(o).forEach(e),r[o]={low:a,lim:n++}}),r);e.graph().dummyChains.forEach(t=>{let r=e.node(t),n=r.edgeObj,a=function(e,t,r,n){let o=[],a=[],s=Math.min(t[r].low,t[n].low),i=Math.max(t[r].lim,t[n].lim),d,l;d=r;do o.push(d=e.parent(d));while(d&&(t[d].low>s||i>t[d].lim))for(l=d,d=n;(d=e.parent(d))!==l;)a.push(d);return{path:o.concat(a.reverse()),lca:l}}(e,o,n.v,n.w),s=a.path,i=a.lca,d=0,l=s[0],c=!0;for(;t!==n.w;){if(r=e.node(t),c){for(;(l=s[d])!==i&&e.node(l).maxRank<r.rank;)d++;l===i&&(c=!1)}if(!c){for(;d<s.length-1&&e.node(l=s[d+1]).minRank<=r.rank;)d++;l=s[d]}e.setParent(t,l),t=e.successors(t)[0]}})}}),m=o((e,t)=>{var r=d();t.exports={run:function(e){var t,n,o;let a=r.addDummyNode(e,"root",{},"_root"),s=(n={},(t=e).children().forEach(e=>(function e(r,o){var a=t.children(r);a&&a.length&&a.forEach(t=>e(t,o+1)),n[r]=o})(e,1)),n),i=Object.values(s),d=r.applyWithChunking(Math.max,i)-1,l=2*d+1;e.graph().nestingRoot=a,e.edges().forEach(t=>e.edge(t).minlen*=l);let c=(o=e).edges().reduce((e,t)=>e+o.edge(t).weight,0)+1;e.children().forEach(t=>(function e(t,n,o,a,s,i,d){let l=t.children(d);if(!l.length){d!==n&&t.setEdge(n,d,{weight:0,minlen:o});return}let c=r.addBorderNode(t,"_bt"),u=r.addBorderNode(t,"_bb"),h=t.node(d);t.setParent(c,d),h.borderTop=c,t.setParent(u,d),h.borderBottom=u,l.forEach(r=>{e(t,n,o,a,s,i,r);let l=t.node(r),h=l.borderTop?l.borderTop:r,f=l.borderBottom?l.borderBottom:r,p=l.borderTop?a:2*a,g=h!==f?1:s-i[d]+1;t.setEdge(c,h,{weight:p,minlen:g,nestingEdge:!0}),t.setEdge(f,u,{weight:p,minlen:g,nestingEdge:!0})}),t.parent(d)||t.setEdge(n,c,{weight:0,minlen:s+i[d]})})(e,a,l,c,d,s,t)),e.graph().nodeRankFactor=l},cleanup:function(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}}}),v=o((e,t)=>{var r=d();function n(e,t,n,o,a,s){let i=a[t][s-1],d=r.addDummyNode(e,"border",{width:0,height:0,rank:s,borderType:t},n);a[t][s]=d,e.setParent(d,o),i&&e.setEdge(i,d,{weight:1})}t.exports=function(e){e.children().forEach(function t(r){let o=e.children(r),a=e.node(r);if(o.length&&o.forEach(t),Object.hasOwn(a,"minRank")){a.borderLeft=[],a.borderRight=[];for(let t=a.minRank,o=a.maxRank+1;t<o;++t)n(e,"borderLeft","_bl",r,a,t),n(e,"borderRight","_br",r,a,t)}})}}),x=o((e,t)=>{function r(e){e.nodes().forEach(t=>n(e.node(t))),e.edges().forEach(t=>n(e.edge(t)))}function n(e){let t=e.width;e.width=e.height,e.height=t}function o(e){e.y=-e.y}function a(e){let t=e.x;e.x=e.y,e.y=t}t.exports={adjust:function(e){let t=e.graph().rankdir.toLowerCase();("lr"===t||"rl"===t)&&r(e)},undo:function(e){var t,n;let s=e.graph().rankdir.toLowerCase();("bt"===s||"rl"===s)&&((t=e).nodes().forEach(e=>o(t.node(e))),t.edges().forEach(e=>{let r=t.edge(e);r.points.forEach(o),Object.hasOwn(r,"y")&&o(r)})),("lr"===s||"rl"===s)&&((n=e).nodes().forEach(e=>a(n.node(e))),n.edges().forEach(e=>{let t=n.edge(e);t.points.forEach(a),Object.hasOwn(t,"x")&&a(t)}),r(e))}}}),y=o((e,t)=>{var r=d();t.exports=function(e){let t={},n=e.nodes().filter(t=>!e.children(t).length),o=n.map(t=>e.node(t).rank),a=r.applyWithChunking(Math.max,o),s=r.range(a+1).map(()=>[]);return n.sort((t,r)=>e.node(t).rank-e.node(r).rank).forEach(function r(n){t[n]||(t[n]=!0,s[e.node(n).rank].push(n),e.successors(n).forEach(r))}),s}}),b=o((e,t)=>{var r=d().zipObject;t.exports=function(e,t){let n=0;for(let o=1;o<t.length;++o)n+=function(e,t,n){let o=r(n,n.map((e,t)=>t)),a=t.flatMap(t=>e.outEdges(t).map(t=>({pos:o[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos)),s=1;for(;s<n.length;)s<<=1;let i=2*s-1;s-=1;let d=Array(i).fill(0),l=0;return a.forEach(e=>{let t=e.pos+s;d[t]+=e.weight;let r=0;for(;t>0;)t%2&&(r+=d[t+1]),t=t-1>>1,d[t]+=e.weight;l+=e.weight*r}),l}(e,t[o-1],t[o]);return n}}),w=o((e,t)=>{t.exports=function(e,t=[]){return t.map(t=>{let r=e.inEdges(t);if(!r.length)return{v:t};{let n=r.reduce((t,r)=>{let n=e.edge(r),o=e.node(r.v);return{sum:t.sum+n.weight*o.order,weight:t.weight+n.weight}},{sum:0,weight:0});return{v:t,barycenter:n.sum/n.weight,weight:n.weight}}})}}),E=o((e,t)=>{var r=d();t.exports=function(e,t){let n={};return e.forEach((e,t)=>{let r=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};void 0!==e.barycenter&&(r.barycenter=e.barycenter,r.weight=e.weight)}),t.edges().forEach(e=>{let t=n[e.v],r=n[e.w];void 0!==t&&void 0!==r&&(r.indegree++,t.out.push(n[e.w]))}),function(e){let t=[];for(;e.length;){let r=e.pop();t.push(r),r.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 r=0,n=0;e.weight&&(r+=e.barycenter*e.weight,n+=e.weight),t.weight&&(r+=t.barycenter*t.weight,n+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=r/n,e.weight=n,e.i=Math.min(t.i,e.i),t.merged=!0}(e,t)}}(r)),r.out.forEach(function(t){return r=>{r.in.push(t),0==--r.indegree&&e.push(r)}}(r))}return t.filter(e=>!e.merged).map(e=>r.pick(e,["vs","i","barycenter","weight"]))}(Object.values(n).filter(e=>!e.indegree))}}),k=o((e,t)=>{var r=d();function n(e,t,r){let n;for(;t.length&&(n=t[t.length-1]).i<=r;)t.pop(),e.push(n.vs),r++;return r}t.exports=function(e,t){var o;let a=r.partition(e,e=>Object.hasOwn(e,"barycenter")),s=a.lhs,i=a.rhs.sort((e,t)=>t.i-e.i),d=[],l=0,c=0,u=0;s.sort((o=!!t,(e,t)=>e.barycenter<t.barycenter?-1:e.barycenter>t.barycenter?1:o?t.i-e.i:e.i-t.i)),u=n(d,i,u),s.forEach(e=>{u+=e.vs.length,d.push(e.vs),l+=e.barycenter*e.weight,c+=e.weight,u=n(d,i,u)});let h={vs:d.flat(!0)};return c&&(h.barycenter=l/c,h.weight=c),h}}),j=o((e,t)=>{var r=w(),n=E(),o=k();t.exports=function e(t,a,s,i){var d,l;let c=t.children(a),u=t.node(a),h=u?u.borderLeft:void 0,f=u?u.borderRight:void 0,p={};h&&(c=c.filter(e=>e!==h&&e!==f));let g=r(t,c);g.forEach(r=>{if(t.children(r.v).length){var n,o;let a=e(t,r.v,s,i);p[r.v]=a,Object.hasOwn(a,"barycenter")&&(n=r,o=a,void 0!==n.barycenter?(n.barycenter=(n.barycenter*n.weight+o.barycenter*o.weight)/(n.weight+o.weight),n.weight+=o.weight):(n.barycenter=o.barycenter,n.weight=o.weight))}});let m=n(g,s);d=m,l=p,d.forEach(e=>{e.vs=e.vs.flatMap(e=>l[e]?l[e].vs:e)});let v=o(m,i);if(h&&(v.vs=[h,v.vs,f].flat(!0),t.predecessors(h).length)){let e=t.node(t.predecessors(h)[0]),r=t.node(t.predecessors(f)[0]);Object.hasOwn(v,"barycenter")||(v.barycenter=0,v.weight=0),v.barycenter=(v.barycenter*v.weight+e.order+r.order)/(v.weight+2),v.weight+=2}return v}}),N=o((e,t)=>{var r=a().Graph,n=d();t.exports=function(e,t,o,a){a||(a=e.nodes());let s=function(e){for(var t;e.hasNode(t=n.uniqueId("_root")););return t}(e),i=new r({compound:!0}).setGraph({root:s}).setDefaultNodeLabel(t=>e.node(t));return a.forEach(r=>{let n=e.node(r),a=e.parent(r);(n.rank===t||n.minRank<=t&&t<=n.maxRank)&&(i.setNode(r),i.setParent(r,a||s),e[o](r).forEach(t=>{let n=t.v===r?t.w:t.v,o=i.edge(n,r),a=void 0!==o?o.weight:0;i.setEdge(n,r,{weight:e.edge(t).weight+a})}),Object.hasOwn(n,"minRank")&&i.setNode(r,{borderLeft:n.borderLeft[t],borderRight:n.borderRight[t]}))}),i}}),C=o((e,t)=>{t.exports=function(e,t,r){let n={},o;r.forEach(r=>{let a=e.parent(r),s,i;for(;a;){if((s=e.parent(a))?(i=n[s],n[s]=a):(i=o,o=a),i&&i!==a)return void t.setEdge(i,a);a=s}})}}),_=o((e,t)=>{var r=y(),n=b(),o=j(),s=N(),i=C(),l=a().Graph,c=d();function u(e,t,r){let n=new Map,o=(e,t)=>{n.has(e)||n.set(e,[]),n.get(e).push(t)};for(let t of e.nodes()){let r=e.node(t);if("number"==typeof r.rank&&o(r.rank,t),"number"==typeof r.minRank&&"number"==typeof r.maxRank)for(let e=r.minRank;e<=r.maxRank;e++)e!==r.rank&&o(e,t)}return t.map(function(t){return s(e,t,r,n.get(t)||[])})}function h(e,t){Object.values(t).forEach(t=>t.forEach((t,r)=>e.node(t).order=r))}t.exports=function e(t,a={}){if("function"==typeof a.customOrder)return void a.customOrder(t,e);let s=c.maxRank(t),d=u(t,c.range(1,s+1),"inEdges"),f=u(t,c.range(s-1,-1,-1),"outEdges"),p=r(t);if(h(t,p),a.disableOptimalOrderHeuristic)return;let g=1/0,m,v=a.constraints||[];for(let e=0,r=0;r<4;++e,++r){(function(e,t,r){let n=new l;e.forEach(function(e){r.forEach(e=>n.setEdge(e.left,e.right));let a=e.graph().root,s=o(e,a,n,t);s.vs.forEach((t,r)=>e.node(t).order=r),i(e,n,s.vs)})})(e%2?d:f,e%4>=2,v),p=c.buildLayerMatrix(t);let a=n(t,p);a<g?(r=0,m=Object.assign({},p),g=a):a===g&&(m=structuredClone(p))}h(t,m)}}),O=o((e,t)=>{var r=a().Graph,n=d();function o(e,t){let r={};return t.length&&t.reduce(function(t,n){let o=0,a=0,s=t.length,d=n[n.length-1];return n.forEach((t,l)=>{let c=function(e,t){if(e.node(t).dummy)return e.predecessors(t).find(t=>e.node(t).dummy)}(e,t),u=c?e.node(c).order:s;(c||t===d)&&(n.slice(a,l+1).forEach(t=>{e.predecessors(t).forEach(n=>{let a=e.node(n),s=a.order;(s<o||u<s)&&!(a.dummy&&e.node(t).dummy)&&i(r,n,t)})}),a=l+1,o=u)}),n}),r}function s(e,t){let r={};function o(t,o,a,s,d){let l;n.range(o,a).forEach(n=>{l=t[n],e.node(l).dummy&&e.predecessors(l).forEach(t=>{let n=e.node(t);n.dummy&&(n.order<s||n.order>d)&&i(r,t,l)})})}return t.length&&t.reduce(function(t,r){let n=-1,a,s=0;return r.forEach((i,d)=>{if("border"===e.node(i).dummy){let t=e.predecessors(i);t.length&&(a=e.node(t[0]).order,o(r,s,d,n,a),s=d,n=a)}o(r,s,r.length,a,t.length)}),r}),r}function i(e,t,r){if(t>r){let e=t;t=r,r=e}let n=e[t];n||(e[t]=n={}),n[r]=!0}function l(e,t,r){if(t>r){let e=t;t=r,r=e}return!!e[t]&&Object.hasOwn(e[t],r)}function c(e,t,r,n){let o={},a={},s={};return t.forEach(e=>{e.forEach((e,t)=>{o[e]=e,a[e]=e,s[e]=t})}),t.forEach(e=>{let t=-1;e.forEach(e=>{let i=n(e);if(i.length){let n=((i=i.sort((e,t)=>s[e]-s[t])).length-1)/2;for(let d=Math.floor(n),c=Math.ceil(n);d<=c;++d){let n=i[d];a[e]===e&&t<s[n]&&!l(r,e,n)&&(a[n]=e,a[e]=o[e]=o[n],t=s[n])}}})}),{root:o,align:a}}function u(e,t,n,o,a){var s,i,d,l,c,u,h;let f,p,g,m={},v=(s=e,i=t,d=n,l=a,f=new r,g=(c=(p=s.graph()).nodesep,u=p.edgesep,h=l,(e,t,r)=>{let n=e.node(t),o=e.node(r),a,s;if(a=0+n.width/2,Object.hasOwn(n,"labelpos"))switch(n.labelpos.toLowerCase()){case"l":s=-n.width/2;break;case"r":s=n.width/2}if(s&&(a+=h?s:-s),s=0,a+=(n.dummy?u:c)/2,a+=(o.dummy?u:c)/2,a+=o.width/2,Object.hasOwn(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":s=o.width/2;break;case"r":s=-o.width/2}return s&&(a+=h?s:-s),s=0,a}),i.forEach(e=>{let t;e.forEach(e=>{let r=d[e];if(f.setNode(r),t){var n=d[t],o=f.edge(n,r);f.setEdge(n,r,Math.max(g(s,e,t),o||0))}t=e})}),f),x=a?"borderLeft":"borderRight";function y(e,t){let r=v.nodes().slice(),n={},o=r.pop();for(;o;){if(n[o])e(o);else for(let e of(n[o]=!0,r.push(o),t(o)))r.push(e);o=r.pop()}}return y(function(e){m[e]=v.inEdges(e).reduce((e,t)=>Math.max(e,m[t.v]+v.edge(t)),0)},v.predecessors.bind(v)),y(function(t){let r=v.outEdges(t).reduce((e,t)=>Math.min(e,m[t.w]-v.edge(t)),1/0),n=e.node(t);r!==1/0&&n.borderType!==x&&(m[t]=Math.max(m[t],r))},v.successors.bind(v)),Object.keys(o).forEach(e=>m[e]=m[n[e]]),m}function h(e,t){return Object.values(t).reduce((t,r)=>{let n=-1/0,o=1/0;Object.entries(r).forEach(([t,r])=>{var a,s;let i=(a=e,s=t,a.node(s).width/2);n=Math.max(r+i,n),o=Math.min(r-i,o)});let a=n-o;return a<t[0]&&(t=[a,r]),t},[1/0,null])[1]}function f(e,t){let r=Object.values(t),o=n.applyWithChunking(Math.min,r),a=n.applyWithChunking(Math.max,r);["u","d"].forEach(r=>{["l","r"].forEach(s=>{let i=r+s,d=e[i];if(d===t)return;let l=Object.values(d),c=o-n.applyWithChunking(Math.min,l);"l"!==s&&(c=a-n.applyWithChunking(Math.max,l)),c&&(e[i]=n.mapValues(d,e=>e+c))})})}function p(e,t){return n.mapValues(e.ul,(r,n)=>{if(t)return e[t.toLowerCase()][n];{let t=Object.values(e).map(e=>e[n]).sort((e,t)=>e-t);return(t[1]+t[2])/2}})}t.exports={positionX:function(e){let t=n.buildLayerMatrix(e),r=Object.assign(o(e,t),s(e,t)),a={},i;["u","d"].forEach(o=>{i="u"===o?t:Object.values(t).reverse(),["l","r"].forEach(t=>{"r"===t&&(i=i.map(e=>Object.values(e).reverse()));let s=("u"===o?e.predecessors:e.successors).bind(e),d=c(e,i,r,s),l=u(e,i,d.root,d.align,"r"===t);"r"===t&&(l=n.mapValues(l,e=>-e)),a[o+t]=l})});let d=h(e,a);return f(a,d),p(a,e.graph().align)},findType1Conflicts:o,findType2Conflicts:s,addConflict:i,hasConflict:l,verticalAlignment:c,horizontalCompaction:u,alignCoordinates:f,findSmallestWidthAlignment:h,balance:p}}),R=o((e,t)=>{var r=d(),n=O().positionX;t.exports=function(e){var t;let o,a,s,i;t=e=r.asNonCompoundGraph(e),o=r.buildLayerMatrix(t),a=t.graph().ranksep,s=t.graph().rankalign,i=0,o.forEach(e=>{let r=e.reduce((e,r)=>{let n=t.node(r).height;return e>n?e:n},0);e.forEach(e=>{let n=t.node(e);"top"===s?n.y=i+n.height/2:"bottom"===s?n.y=i+r-n.height/2:n.y=i+r/2}),i+=r+a}),Object.entries(n(e)).forEach(([t,r])=>e.node(t).x=r)}}),M=o((e,t)=>{var r=l(),n=c(),o=p(),s=d().normalizeRanks,i=g(),u=d().removeEmptyRanks,h=m(),f=v(),y=x(),b=_(),w=R(),E=d(),k=a().Graph;t.exports=function(e,t={}){let a=t.debugTiming?E.time:E.notime;return a("layout",()=>{let d=a(" buildLayoutGraph",()=>{var t;let r,n;return t=e,r=new k({multigraph:!0,compound:!0}),n=F(t.graph()),r.setGraph(Object.assign({},N,L(n,j),E.pick(n,C))),t.nodes().forEach(e=>{let n=L(F(t.node(e)),O);Object.keys(M).forEach(e=>{void 0===n[e]&&(n[e]=M[e])}),r.setNode(e,n),r.setParent(e,t.parent(e))}),t.edges().forEach(e=>{let n=F(t.edge(e));r.setEdge(e,Object.assign({},P,L(n,S),E.pick(n,T)))}),r});return a(" runLayout",()=>{var e,l,c;return e=d,l=a,c=t,void(l(" makeSpaceForEdgeLabels",()=>{var t;let r;return r=(t=e).graph(),void(r.ranksep/=2,t.edges().forEach(e=>{let n=t.edge(e);n.minlen*=2,"c"!==n.labelpos.toLowerCase()&&("TB"===r.rankdir||"BT"===r.rankdir?n.width+=n.labeloffset:n.height+=n.labeloffset)}))}),l(" removeSelfEdges",()=>{var t;(t=e).edges().forEach(e=>{if(e.v===e.w){var r=t.node(e.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:e,label:t.edge(e)}),t.removeEdge(e)}})}),l(" acyclic",()=>r.run(e)),l(" nestingGraph.run",()=>h.run(e)),l(" rank",()=>o(E.asNonCompoundGraph(e))),l(" injectEdgeLabelProxies",()=>{var t;(t=e).edges().forEach(e=>{let r=t.edge(e);if(r.width&&r.height){let r=t.node(e.v),n={rank:(t.node(e.w).rank-r.rank)/2+r.rank,e:e};E.addDummyNode(t,"edge-proxy",n,"_ep")}})}),l(" removeEmptyRanks",()=>u(e)),l(" nestingGraph.cleanup",()=>h.cleanup(e)),l(" normalizeRanks",()=>s(e)),l(" assignRankMinMax",()=>{var t;let r;return r=0,void((t=e).nodes().forEach(e=>{let n=t.node(e);n.borderTop&&(n.minRank=t.node(n.borderTop).rank,n.maxRank=t.node(n.borderBottom).rank,r=Math.max(r,n.maxRank))}),t.graph().maxRank=r)}),l(" removeEdgeLabelProxies",()=>{var t;(t=e).nodes().forEach(e=>{let r=t.node(e);"edge-proxy"===r.dummy&&(t.edge(r.e).labelRank=r.rank,t.removeNode(e))})}),l(" normalize.run",()=>n.run(e)),l(" parentDummyChains",()=>i(e)),l(" addBorderSegments",()=>f(e)),l(" order",()=>b(e,c)),l(" insertSelfEdges",()=>{var t;return t=e,void E.buildLayerMatrix(t).forEach(e=>{var r=0;e.forEach((e,n)=>{var o=t.node(e);o.order=n+r,(o.selfEdges||[]).forEach(e=>{E.addDummyNode(t,"selfedge",{width:e.label.width,height:e.label.height,rank:o.rank,order:n+ ++r,e:e.e,label:e.label},"_se")}),delete o.selfEdges})})}),l(" adjustCoordinateSystem",()=>y.adjust(e)),l(" position",()=>w(e)),l(" positionSelfEdges",()=>{var t;(t=e).nodes().forEach(e=>{var r=t.node(e);if("selfedge"===r.dummy){var n=t.node(r.e.v),o=n.x+n.width/2,a=n.y,s=r.x-o,i=n.height/2;t.setEdge(r.e,r.label),t.removeNode(e),r.label.points=[{x:o+2*s/3,y:a-i},{x:o+5*s/6,y:a-i},{x:o+s,y:a},{x:o+5*s/6,y:a+i},{x:o+2*s/3,y:a+i}],r.label.x=r.x,r.label.y=r.y}})}),l(" removeBorderNodes",()=>{var t;(t=e).nodes().forEach(e=>{if(t.children(e).length){let r=t.node(e),n=t.node(r.borderTop),o=t.node(r.borderBottom),a=t.node(r.borderLeft[r.borderLeft.length-1]),s=t.node(r.borderRight[r.borderRight.length-1]);r.width=Math.abs(s.x-a.x),r.height=Math.abs(o.y-n.y),r.x=a.x+r.width/2,r.y=n.y+r.height/2}}),t.nodes().forEach(e=>{"border"===t.node(e).dummy&&t.removeNode(e)})}),l(" normalize.undo",()=>n.undo(e)),l(" fixupEdgeLabelCoords",()=>{var t;(t=e).edges().forEach(e=>{let r=t.edge(e);if(Object.hasOwn(r,"x"))switch(("l"===r.labelpos||"r"===r.labelpos)&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset}})}),l(" undoCoordinateSystem",()=>y.undo(e)),l(" translateGraph",()=>(function(e){let t=1/0,r=0,n=1/0,o=0,a=e.graph(),s=a.marginx||0,i=a.marginy||0;function d(e){let a=e.x,s=e.y,i=e.width,d=e.height;t=Math.min(t,a-i/2),r=Math.max(r,a+i/2),n=Math.min(n,s-d/2),o=Math.max(o,s+d/2)}e.nodes().forEach(t=>d(e.node(t))),e.edges().forEach(t=>{let r=e.edge(t);Object.hasOwn(r,"x")&&d(r)}),t-=s,n-=i,e.nodes().forEach(r=>{let o=e.node(r);o.x-=t,o.y-=n}),e.edges().forEach(r=>{let o=e.edge(r);o.points.forEach(e=>{e.x-=t,e.y-=n}),Object.hasOwn(o,"x")&&(o.x-=t),Object.hasOwn(o,"y")&&(o.y-=n)}),a.width=r-t+s,a.height=o-n+i})(e)),l(" assignNodeIntersects",()=>{var t;(t=e).edges().forEach(e=>{let r=t.edge(e),n=t.node(e.v),o=t.node(e.w),a,s;r.points?(a=r.points[0],s=r.points[r.points.length-1]):(r.points=[],a=o,s=n),r.points.unshift(E.intersectRect(n,a)),r.points.push(E.intersectRect(o,s))})}),l(" reversePoints",()=>{var t;(t=e).edges().forEach(e=>{let r=t.edge(e);r.reversed&&r.points.reverse()})}),l(" acyclic.undo",()=>r.undo(e)))}),a(" updateInputGraph",()=>{var t,r;return t=e,r=d,void(t.nodes().forEach(e=>{let n=t.node(e),o=r.node(e);n&&(n.x=o.x,n.y=o.y,n.order=o.order,n.rank=o.rank,r.children(e).length&&(n.width=o.width,n.height=o.height))}),t.edges().forEach(e=>{let n=t.edge(e),o=r.edge(e);n.points=o.points,Object.hasOwn(o,"x")&&(n.x=o.x,n.y=o.y)}),t.graph().width=r.graph().width,t.graph().height=r.graph().height)}),d})};var j=["nodesep","edgesep","ranksep","marginx","marginy"],N={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb",rankalign:"center"},C=["acyclicer","ranker","rankdir","align","rankalign"],O=["width","height","rank"],M={width:0,height:0},S=["minlen","weight","width","height","labeloffset"],P={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},T=["labelpos"];function L(e,t){return E.mapValues(E.pick(e,t),Number)}function F(e){var t={};return e&&Object.entries(e).forEach(([e,r])=>{"string"==typeof e&&(e=e.toLowerCase()),t[e]=r}),t}}),S=o((e,t)=>{var r=d(),n=a().Graph;t.exports={debugOrdering:function(e){let t=r.buildLayerMatrix(e),o=new n({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(t=>{o.setNode(t,{label:t}),o.setParent(t,"layer"+e.node(t).rank)}),e.edges().forEach(e=>o.setEdge(e.v,e.w,{},e.name)),t.forEach((e,t)=>{o.setNode("layer"+t,{rank:"same"}),e.reduce((e,t)=>(o.setEdge(e,t,{style:"invis"}),t))}),o}}}),P=o((e,t)=>{t.exports="2.0.4"});let T=o((e,t)=>{t.exports={graphlib:a(),layout:M(),debug:S(),util:{time:d().time,notime:d().notime},version:P()}})(),L={direction:"LR",ranksep:200,nodesep:15},F={featureNode:{width:288,height:140},repositoryNode:{width:328,height:50}};function A(e,t){let r=e.data;return r&&"number"==typeof r.width&&"number"==typeof r.height?{width:r.width,height:r.height}:F[e.type??""]??t}function D(e,t,r={}){let{direction:n="TB",nodeSize:o={width:172,height:36},ranksep:a=80,nodesep:s=30}=r;if(0===e.length)return{nodes:[],edges:[]};let i=new T.graphlib.Graph({multigraph:!0});i.setDefaultEdgeLabel(()=>({})),i.setGraph({rankdir:n,ranksep:a,nodesep:s});let d=new Set;for(let e of t)d.add(e.source),d.add(e.target);let l=e.filter(e=>d.has(e.id)),c=e.filter(e=>!d.has(e.id));for(let e of l){let t=A(e,o);i.setNode(e.id,{width:t.width,height:t.height})}for(let e of t)i.hasNode(e.source)&&i.hasNode(e.target)&&i.setEdge(e.source,e.target,{},e.id);T.layout(i);let{targetPosition:u,sourcePosition:h}=function(e){switch(e){case"LR":return{targetPosition:"left",sourcePosition:"right"};case"RL":return{targetPosition:"right",sourcePosition:"left"};case"BT":return{targetPosition:"bottom",sourcePosition:"top"};default:return{targetPosition:"top",sourcePosition:"bottom"}}}(n),f="LR"===n||"RL"===n,p=new Map;for(let e of l){let t=i.node(e.id),r=A(e,o);p.set(e.id,{cx:t.x,cy:t.y,w:r.width,h:r.height})}let g=0;for(let e of p.values()){g=f?e.cx:e.cy;break}for(let e of c){let t=A(e,o);p.set(e.id,{cx:f?g:0,cy:f?0:g,w:t.width,h:t.height})}let m=new Map;for(let e of t)p.has(e.source)&&p.has(e.target)&&(m.has(e.source)||m.set(e.source,[]),m.get(e.source).push(e.target));let v=new Map;for(let t=0;t<e.length;t++)v.set(e[t].id,t);for(let[,e]of m)e.sort((e,t)=>(v.get(e)??0)-(v.get(t)??0));let x=new Set;for(let e of m.values())for(let t of e)x.add(t);let y=[...[...d].filter(e=>p.has(e)&&!x.has(e)),...c.map(e=>e.id)];y.sort((e,t)=>(v.get(e)??0)-(v.get(t)??0));let b=new Map;for(let e of y)!function e(t){if(b.has(t))return b.get(t);let r=p.get(t),n=f?r.h:r.w,o=m.get(t);if(!o||0===o.length)return b.set(t,n),n;let a=0;for(let t of o)a+=e(t);let i=Math.max(n,a+=(o.length-1)*s);return b.set(t,i),i}(e);let w=0;for(let e of y){let t=b.get(e)??0;!function e(t,r){let n=p.get(t);f?n.cy=r:n.cx=r;let o=m.get(t);if(!o||0===o.length)return;let a=0;for(let e of o)a+=b.get(e)??0;let i=r-(a+=(o.length-1)*s)/2;for(let t of o){let r=b.get(t)??0;e(t,i+r/2),i+=r+s}}(e,w+t/2),w+=t+s}let E=[];for(let t of e){let e=p.get(t.id);e&&E.push({...t,targetPosition:u,sourcePosition:h,position:{x:e.cx-e.w/2,y:e.cy-e.h/2}})}return{nodes:E,edges:[...t]}}var I=e.i(21023);let $=(0,I.createServerReference)("70a7e014690ef99d4bda089ae4b72a76a02d5135f6",I.callServer,void 0,I.findSourceMapURL,"deleteFeature");var z=e.i(10991),B=e.i(6153),G=e.i(8269);let q=(0,I.createServerReference)("406894ffe3bf8e4a140bc21a53f7815aa332c0cb14",I.callServer,void 0,I.findSourceMapURL,"deleteRepository"),W=(0,I.createServerReference)("40d77887b58e7e7d5b2a08a988addf1a08a8058643",I.callServer,void 0,I.findSourceMapURL,"getFeatureMetadata");var V=e.i(39443),U=e.i(8361),H=e.i(18354),X=e.i(99045);function J(e,t){let r=new Map;for(let e of t)"dependencyEdge"===e.type&&r.set(e.target,e.source);let n=new Map,o=new Map;for(let t of e)"featureNode"===t.type?n.set(t.id,{nodeId:t.id,data:t.data,parentNodeId:r.get(t.id)}):"repositoryNode"===t.type&&o.set(t.id,{nodeId:t.id,data:t.data});return{featureMap:n,repoMap:o}}function K(e,t){return(void 0===t.state||t.state===e.state)&&(void 0===t.lifecycle||t.lifecycle===e.lifecycle)&&(void 0===t.name||t.name===e.name)&&(void 0===t.description||t.description===e.description)}function Y(e,t){if(e.size!==t.size)return!1;for(let[r,n]of e){let e=t.get(r);if(!e||n.parentNodeId!==e.parentNodeId||n.data!==e.data&&JSON.stringify(n.data)!==JSON.stringify(e.data))return!1}return!0}let Q=(0,H.createLogger)("[Polling]"),Z=0,ee=0;function et(e,o){let a=(0,r.useRouter)(),s=(0,U.useSoundAction)("delete"),i=(0,U.useSoundAction)("create"),{nodes:d,edges:l,reconcile:c,updateFeature:u,addPendingFeature:h,removeFeature:f,restoreFeature:p,addRepository:g,removeRepository:m,replaceRepository:v,getFeatureRepositoryPath:x,getRepositoryData:y,getRepoMapSize:b,setCallbacks:w,beginMutation:E,endMutation:k,isMutating:j}=function(e,r){let n=(0,t.useMemo)(()=>J(e,r),[]),[o,a]=(0,t.useState)(n.featureMap),[s,i]=(0,t.useState)(n.repoMap),[d,l]=(0,t.useState)(new Map),c=(0,t.useRef)(new Map),u=(0,t.useRef)(new Set),h=(0,t.useRef)(0),f=(0,t.useRef)(new Set),p=(0,t.useRef)(new Set),g=(0,t.useRef)({}),m=(0,t.useMemo)(()=>({onNodeAction:e=>g.current.onNodeAction?.(e),onNodeSettings:e=>g.current.onNodeSettings?.(e),onFeatureDelete:e=>g.current.onFeatureDelete?.(e),onRepositoryAdd:e=>g.current.onRepositoryAdd?.(e),onRepositoryClick:e=>g.current.onRepositoryClick?.(e),onRepositoryDelete:e=>g.current.onRepositoryDelete?.(e),onRetryFeature:e=>g.current.onRetryFeature?.(e),onStartFeature:e=>g.current.onStartFeature?.(e)}),[]),v=(0,t.useRef)(o);v.current=o;let x=(0,t.useRef)(s);x.current=s;let y=(0,t.useMemo)(()=>(function(e,t,r,n){let o=[],a=[],s=e=>e.replace(/\\/g,"/"),i=new Map;for(let[e,r]of t)r.data.repositoryPath&&i.set(s(r.data.repositoryPath),e);let d=new Map;for(let[e,r]of[...t.entries()].sort((e,t)=>(e[1].data.createdAt??0)-(t[1].data.createdAt??0))){let t={...r.data,...n?.onRepositoryAdd&&{onAdd:()=>n.onRepositoryAdd(e)},...n?.onRepositoryClick&&{onClick:()=>n.onRepositoryClick(e)},...n?.onRepositoryDelete&&{onDelete:n.onRepositoryDelete}};o.push({id:e,type:"repositoryNode",position:{x:0,y:0},data:t})}for(let[t,l,c]of[...[...e.entries()].map(([e,t])=>[e,t,!1]),...[...r.entries()].filter(([t])=>!e.has(t)).map(([e,t])=>[e,t,!0])]){let e="creating"===l.data.state||c,r={...l.data,...!e&&n?.onNodeAction&&{onAction:()=>n.onNodeAction(t)},...!e&&n?.onNodeSettings&&{onSettings:()=>n.onNodeSettings(t)},...!e&&n?.onFeatureDelete&&{onDelete:n.onFeatureDelete},...!e&&"error"===l.data.state&&n?.onRetryFeature&&{onRetry:n.onRetryFeature},...!e&&"pending"===l.data.state&&n?.onStartFeature&&{onStart:n.onStartFeature}};if(o.push({id:t,type:"featureNode",position:{x:0,y:0},data:r}),l.parentNodeId)a.push({id:`dep-${l.parentNodeId}-${t}`,source:l.parentNodeId,target:t,type:"dependencyEdge"});else{let e=s(l.data.repositoryPath),r=i.get(e)??function(e){if(d.has(e))return d.get(e);let t=`virtual-repo-${e}`,r=e.split("/").filter(Boolean).at(-1)??e;return o.push({id:t,type:"repositoryNode",position:{x:0,y:0},data:{name:r,repositoryPath:e}}),d.set(e,t),t}(e);a.push({id:`edge-${r}-${t}`,source:r,target:t,style:{strokeDasharray:"5 5"}})}}let l=new Set;for(let e of a)"dependencyEdge"===e.type&&l.add(e.source);let c=a.length>0;for(let e of o){let t=e.data;t.showHandles=c,"featureNode"===e.type&&(t.hasChildren=l.has(e.id))}return{nodes:o,edges:a}})(o,s,d,m),[o,s,d,m]),b=(0,t.useRef)({key:"",positions:new Map}),{nodes:w,edges:E}=(0,t.useMemo)(()=>{let e=y.nodes.map(e=>e.id).sort().join(","),t=y.edges.map(e=>`${e.source}-${e.target}`).sort().join(","),r=`${e}|${t}`;if(r!==b.current.key){let e=D(y.nodes,y.edges,L),t=new Map;for(let r of e.nodes)t.set(r.id,{position:r.position,targetPosition:r.targetPosition,sourcePosition:r.sourcePosition});let n=b.current.positions;if(n.size>0){let r=0,o=0;for(let[e,a]of t){let t=n.get(e);if(t){r=t.position.x-a.position.x,o=t.position.y-a.position.y;break}}if(0!==r||0!==o){for(let e of t.values())e.position={x:e.position.x+r,y:e.position.y+o};for(let t of e.nodes)t.position={x:t.position.x+r,y:t.position.y+o}}}return b.current={key:r,positions:t},e}let{positions:n}=b.current;return{nodes:y.nodes.map(e=>{let t=n.get(e.id);return t?{...e,...t}:e}),edges:y.edges}},[y]),k=(0,t.useCallback)((e,t)=>{if(h.current>0)return;let{featureMap:r,repoMap:n}=J(e,t),o=new Set([...r.values()].map(e=>`${e.data.name}\0${e.data.repositoryPath}`));a(e=>{let t=[...e.entries()].filter(([,e])=>"creating"===e.data.state),n=new Map(r);for(let[e,r]of t){let t=`${r.data.name}\0${r.data.repositoryPath}`;o.has(t)||n.set(e,r)}let a=new Set;for(let[t,r]of e)"deleting"===r.data.state&&(n.has(t)?n.set(t,{...n.get(t),data:{...n.get(t).data,state:"deleting"}}):p.current.has(t)||(n.set(t,r),a.add(t)));for(let[e,t]of(p.current=a,c.current)){let r=n.get(e);r&&(n.set(e,{...r,data:{...r.data,...t}}),c.current.delete(e))}return Y(e,n)?e:n}),l(e=>{if(0===e.size)return e;let t=!1,r=new Map(e);for(let[n,a]of e){let e=`${a.data.name}\0${a.data.repositoryPath}`;o.has(e)&&(r.delete(n),t=!0)}return t?r:e}),i(e=>{let t=new Map(n),r=new Set([...n.values()].map(e=>e.data.repositoryPath));for(let[n,o]of e){if(t.has(n)||r.has(o.data.repositoryPath)){u.current.delete(n);continue}(n.startsWith("repo-temp-")||u.current.has(n))&&t.set(n,o)}return Y(e,t)?e:t})},[]),j=(0,t.useCallback)((e,t)=>{a(r=>{let n=r.get(e);if(!n)return c.current.set(e,{...c.current.get(e),...t}),r;if(c.current.delete(e),K(n.data,t))return r;let o=new Map(r);return o.set(e,{...n,data:{...n.data,...t}}),o}),l(r=>{let n=r.get(e);if(!n||K(n.data,t))return r;let o=new Map(r);return o.set(e,{...n,data:{...n.data,...t}}),o})},[]),N=(0,t.useCallback)((e,t,r)=>{l(n=>{let o=new Map(n);return o.set(e,{nodeId:e,data:t,parentNodeId:r}),o})},[]),C=(0,t.useCallback)(e=>{l(t=>{if(!t.has(e))return t;let r=new Map(t);return r.delete(e),r})},[]),_=(0,t.useCallback)(e=>{a(t=>{if(!t.has(e))return t;let r=new Map(t);return r.delete(e),r})},[]),O=(0,t.useCallback)((e,t)=>{a(r=>{let n=new Map(r);return n.set(e,t),n})},[]),R=(0,t.useCallback)((e,t)=>{u.current.add(e),i(r=>{let n=new Map(r);return n.set(e,{nodeId:e,data:t}),n})},[]),M=(0,t.useCallback)(e=>{u.current.delete(e),i(t=>{if(!t.has(e))return t;let r=new Map(t);return r.delete(e),r})},[]),S=(0,t.useCallback)((e,t,r)=>{u.current.delete(e),u.current.add(t),i(n=>{if(!n.has(e))return n;let o=new Map(n);return o.delete(e),o.set(t,{nodeId:t,data:r}),o})},[]),P=(0,t.useCallback)(e=>v.current.get(e)?.data.repositoryPath,[]),T=(0,t.useCallback)(e=>x.current.get(e)?.data,[]),F=(0,t.useCallback)(()=>x.current.size,[]),A=(0,t.useCallback)(e=>{g.current=e},[]),I=(0,t.useCallback)(()=>{h.current++},[]),$=(0,t.useCallback)((e=3e3)=>{let t=setTimeout(()=>{h.current=Math.max(0,h.current-1),f.current.delete(t)},e);f.current.add(t)},[]),z=(0,t.useCallback)(()=>h.current>0,[]);return(0,t.useEffect)(()=>{let e=f.current;return()=>{for(let t of e)clearTimeout(t);e.clear()}},[]),{nodes:w,edges:E,reconcile:k,updateFeature:j,addPendingFeature:N,removePendingFeature:C,removeFeature:_,restoreFeature:O,addRepository:R,removeRepository:M,replaceRepository:S,getFeatureRepositoryPath:P,getRepositoryData:T,getRepoMapSize:F,setCallbacks:A,beginMutation:I,endMutation:$,isMutating:z}}(e,o),N=(0,t.useRef)(d),C=(0,t.useRef)(l);(0,t.useEffect)(()=>{N.current=d,C.current=l},[d,l]);let _=(0,t.useMemo)(()=>e.map(e=>e.id).sort().join(","),[e]),O=(0,t.useMemo)(()=>e.filter(e=>"featureNode"===e.type).map(e=>{let t=e.data;return`${e.id}:${t.state}:${t.lifecycle}`}).sort().join(","),[e]),R=(0,t.useRef)("");(0,t.useEffect)(()=>{let t=`${_}|${O}`;t!==R.current&&(R.current=t,c(e,o))},[_,O,e,o,c]);let M=(0,t.useRef)(new Map),{events:S}=(0,V.useAgentEventsContext)();(0,t.useEffect)(()=>{let t=M.current;for(let r of e){if("featureNode"!==r.type)continue;let e=r.data,o=t.get(r.id);void 0!==o&&o!==e.state&&(S.some(t=>t.featureId===e.featureId&&(0,X.mapEventTypeToState)(t.eventType)===e.state)||("done"===e.state?n.toast.success(e.name,{description:"Feature completed!"}):"action-required"===e.state?n.toast.warning(e.name,{description:"Waiting for your approval",action:{label:"Review",onClick:()=>a.push(`/feature/${e.featureId}`)}}):"error"===e.state&&n.toast.error(e.name,{description:e.errorMessage??"Agent failed"}))),t.set(r.id,e.state)}},[O,e,S,a]);let P=(0,t.useRef)(0);(0,t.useEffect)(()=>{if(P.current>S.length&&(P.current=0),S.length<=P.current)return;let e=S.slice(P.current);for(let{featureId:t,state:r,lifecycle:n}of(P.current=S.length,(0,X.resolveSseEventUpdates)(e)))if(void 0!==r||void 0!==n){let e=`feat-${t}`,o=N.current.find(t=>t.id===e);if(o&&"deleting"===o.data.state)continue;u(e,{...void 0!==r&&{state:r},...void 0!==n&&{lifecycle:n}})}},[S,u]),(0,t.useEffect)(()=>{let e=e=>{let{featureId:t}=e.detail;u(`feat-${t}`,{state:"running"})};return window.addEventListener("shep:feature-approved",e),()=>window.removeEventListener("shep:feature-approved",e)},[u]);let T=(0,t.useRef)(new Set),F=(0,t.useRef)(0);(0,t.useEffect)(()=>{if(F.current>S.length&&(F.current=0),S.length<=F.current)return;let e=S.slice(F.current);for(let t of(F.current=S.length,e)){if("Feature metadata updated"!==t.message||T.current.has(t.featureId))continue;T.current.add(t.featureId);let e=`feat-${t.featureId}`;W(t.featureId).then(t=>{t&&u(e,{name:t.name,description:t.description})}).catch(()=>{})}},[S,u]),(0,t.useEffect)(()=>{Q.debug("polling enabled (3000ms interval)");let e=setInterval(async()=>{if(!j())try{let e=await fetch("/api/graph-data");if(!e.ok)throw Error(`status ${e.status}`);let{nodes:t,edges:r}=await e.json();c(t,r)}catch{Q.warn("poll fetch failed — will retry next interval")}},3e3);return()=>{Q.debug("polling disabled"),clearInterval(e)}},[c,j]);let A=(0,t.useCallback)(e=>{},[]),I=(0,t.useCallback)(e=>{},[]),H=(0,t.useCallback)((e,t,r)=>{let n=t?.featureId?`feat-${t.featureId}`:`feature-${Date.now()}-${Z++}`,o={name:t?.name??"New Feature",description:t?.description??"Describe what this feature does",featureId:t?.featureId??`#${n.slice(-4)}`,lifecycle:"requirements",state:t?.state??"running",progress:0,repositoryPath:t?.repositoryPath??"",branch:t?.branch??""};return h(n,o,"dependencyEdge"===r&&e?e:void 0),n},[h]),et=(0,t.useCallback)(e=>{let t=`feat-${e}`;E(),u(t,{state:"running"}),(0,z.resumeFeature)(e).then(e=>{e.error?(u(t,{state:"error"}),n.toast.error(e.error)):n.toast.success("Feature resumed")}).catch(()=>{u(t,{state:"error"}),n.toast.error("Failed to resume feature")}).finally(()=>k())},[u,E,k]),er=(0,t.useCallback)(e=>{let t=`feat-${e}`;E(),u(t,{state:"running"}),(0,B.startFeature)(e).then(e=>{e.error?(u(t,{state:"pending"}),n.toast.error(e.error)):n.toast.success("Feature started")}).catch(()=>{u(t,{state:"pending"}),n.toast.error("Failed to start feature")}).finally(()=>k())},[u,E,k]),en=(0,t.useCallback)((e,t,r)=>{let o=`feat-${e}`,i=[];if(!0===r){let e=[o];for(;e.length>0;){let t=e.shift();for(let r of C.current)"dependencyEdge"===r.type&&r.source===t&&(i.push(r.target),e.push(r.target))}}let d=new Map;for(let e of[o,...i]){let t=N.current.find(t=>t.id===e);t&&d.set(e,t.data.state)}for(let e of(E(),u(o,{state:"deleting"}),i))u(e,{state:"deleting"});s.play(),a.push("/"),$(e,t,r).then(e=>{if(e.error){for(let[e,t]of d)t&&u(e,{state:t});n.toast.error(e.error)}else for(let e of(f(o),i))f(e)}).catch(()=>{for(let[e,t]of d)t&&u(e,{state:t});n.toast.error("Failed to delete feature")}).finally(()=>k())},[a,s,u,f,E,k]),eo=(0,t.useCallback)(async e=>{let t=`repo-${e}`,r=new Set(C.current.filter(e=>e.source===t).map(e=>e.target)),o=y(t),a=new Map;for(let e of r){let t=N.current.find(t=>t.id===e);t&&a.set(e,{nodeId:e,data:t.data})}let i=()=>{for(let[e,r]of(o&&g(t,o),a))p(e,r)};for(let e of(E(),m(t),r))f(e);try{let t=await q(e);if(!t.success){n.toast.error(t.error??"Failed to remove repository"),i();return}s.play()}catch{n.toast.error("Failed to remove repository"),i()}finally{k()}},[s,m,f,g,p,y,E,k]),ea=(0,t.useCallback)(e=>{let t=D(N.current,C.current,{...L,direction:e});c(t.nodes,t.edges)},[c]);return{nodes:d,edges:l,onNodesChange:A,handleConnect:I,handleAddRepository:(0,t.useCallback)(e=>{let t=0===b(),r=`repo-temp-${++ee}`,o=e.replace(/[\\/]+$/,"").split(/[\\/]/).pop()??e;return E(),g(r,{name:o,repositoryPath:e,id:r,createdAt:Date.now()}),(0,G.addRepository)({path:e,name:o}).then(e=>{if(e.error){m(r),n.toast.error(e.error);return}let t=e.repository;v(r,`repo-${t.id}`,{name:t.name,repositoryPath:t.path,id:t.id,createdAt:t.createdAt instanceof Date?t.createdAt.getTime():Number(t.createdAt)}),i.play()}).catch(()=>{m(r),n.toast.error("Failed to add repository")}).finally(()=>k()),{wasEmpty:t,repoPath:e}},[g,m,v,i,b,E,k]),handleLayout:ea,handleDeleteFeature:en,handleRetryFeature:et,handleStartFeature:er,handleDeleteRepository:eo,createFeatureNode:H,getFeatureRepositoryPath:x,getRepositoryData:y,setCallbacks:w}}e.s(["useControlCenterState",()=>et],17840)},48246,e=>{"use strict";var t=e.i(20314),r=e.i(53271),n=e.i(79054),o=e.i(31406),a=e.i(3214),s=e.i(38227),i=e.i(31777),d=e.i(35364);e.i(54793);var l=e.i(7729);e.i(47506);var c=e.i(89313),u=e.i(92002),h=e.i(3645);let f=(0,h.default)("github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);var p=e.i(8986),g=e.i(38573),m=e.i(19933),v=e.i(67669),x=e.i(24042),y=e.i(64970);e.i(81803);var b=e.i(72714),w=e.i(2287),E=e.i(2828);e.i(99348);var k=e.i(17466),j=e.i(8537),N=e.i(75921),C=e.i(76852),_=e.i(80519);function O({data:e}){let s=(0,o.useRouter)(),l=(0,N.useFeatureFlags)(),[c,h]=(0,n.useState)(!1),O=(0,C.useRepositoryActions)(e.repositoryPath?{repositoryPath:e.repositoryPath}:null),R=(0,j.useDeployAction)(e.repositoryPath?{targetId:e.repositoryPath,targetType:"repository",repositoryPath:e.repositoryPath}:null),M="Booting"===R.status||"Ready"===R.status,S=(0,n.useCallback)((t,r)=>{if(!e.repositoryPath)return;let n=t.preview?t.preview.slice(0,200):"Unknown conversation",o=["Continue work from a previous agent session.","","## Session Context",`- Session ID: ${t.id}`,`- Messages: ${t.messageCount}`,t.lastMessageAt?`- Last active: ${t.lastMessageAt}`:"",`- Conversation file: ${r}`,"","## Session Preview",`> ${n}`,"","## Instructions","1. Read the full conversation history from the file above",`2. Analyze the current state of the repository — what was done, what remains`,"3. Create or update spec files to accurately reflect the current state and remaining work","4. Continue implementing any unfinished work from the conversation"].filter(Boolean).join("\n"),a=new URLSearchParams({repo:e.repositoryPath,prompt:o});s.push(`/create?${a.toString()}`)},[e.repositoryPath,s]);return(0,t.jsxs)("div",{className:(0,i.cn)("group relative",e.onDelete&&e.id&&"pl-10"),children:[e.showHandles?(0,t.jsx)(r.Handle,{type:"target",position:u.Position.Left,isConnectable:!1,className:"opacity-0!"}):null,e.onDelete&&e.id?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"absolute top-1/2 left-0 -translate-y-1/2 opacity-0 transition-opacity group-hover:opacity-100",children:(0,t.jsx)(E.TooltipProvider,{children:(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{"aria-label":"Remove repository","data-testid":"repository-node-delete-button",onClick:e=>{e.stopPropagation(),h(!0)},className:"bg-card text-muted-foreground hover:border-destructive hover:text-destructive flex h-7 w-7 cursor-pointer items-center justify-center rounded-full border shadow-sm transition-colors",children:(0,t.jsx)(v.Trash2,{className:"h-3.5 w-3.5"})})}),(0,t.jsx)(E.TooltipContent,{children:"Remove repository"})]})})}),(0,t.jsx)(w.Dialog,{open:c,onOpenChange:h,children:(0,t.jsxs)(w.DialogContent,{className:"max-w-xs",children:[(0,t.jsxs)(w.DialogHeader,{children:[(0,t.jsx)(w.DialogTitle,{children:"Remove repository?"}),(0,t.jsxs)(w.DialogDescription,{children:["This will remove ",(0,t.jsx)("strong",{children:e.name})," and all its features from your workspace. The repository files on disk won't be affected."]})]}),(0,t.jsxs)(w.DialogFooter,{className:"grid grid-cols-2 gap-2 sm:flex-none",children:[(0,t.jsx)(w.DialogClose,{asChild:!0,children:(0,t.jsx)(d.Button,{variant:"outline",children:"Cancel"})}),(0,t.jsx)(d.Button,{variant:"destructive",onClick:()=>{h(!1),e.onDelete?.(e.id)},children:"Remove"})]})]})})]}):null,(0,t.jsxs)("div",{role:"button",tabIndex:0,"data-testid":"repository-node-card","data-repo-name":e.name,onClick:t=>{t.stopPropagation(),e.onClick?.()},onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),t.stopPropagation(),e.onClick?.())},className:"nodrag bg-card flex min-w-[18rem] cursor-pointer items-center gap-3 rounded-full border px-4 py-3 shadow-sm",children:[(0,t.jsx)(f,{className:"text-muted-foreground h-5 w-5 shrink-0"}),(0,t.jsx)("span",{"data-testid":"repository-node-name",className:"min-w-0 truncate text-sm font-medium",children:e.name}),(0,t.jsxs)("div",{className:(0,i.cn)("flex shrink-0 items-center gap-2",(e.repositoryPath??e.onAdd)&&"ml-auto"),onClick:e=>e.stopPropagation(),children:[e.repositoryPath?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(E.TooltipProvider,{children:(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"flex items-center",children:(0,t.jsx)(b.ActionButton,{label:"Open in IDE",onClick:O.openInIde,loading:O.ideLoading,error:!!O.ideError,icon:p.Code2,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(E.TooltipContent,{children:"Open in IDE"})]})}),(0,t.jsx)(E.TooltipProvider,{children:(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"flex items-center",children:(0,t.jsx)(b.ActionButton,{label:"Open in Shell",onClick:O.openInShell,loading:O.shellLoading,error:!!O.shellError,icon:g.Terminal,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(E.TooltipContent,{children:"Open in Shell"})]})}),(0,t.jsx)(E.TooltipProvider,{children:(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"flex items-center",children:(0,t.jsx)(b.ActionButton,{label:"Open Folder",onClick:O.openFolder,loading:O.folderLoading,error:!!O.folderError,icon:m.FolderOpen,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(E.TooltipContent,{children:"Open Folder"})]})}),(0,t.jsx)(_.FeatureSessionsDropdown,{repositoryPath:e.repositoryPath,onCreateFromSession:S}),l.envDeploy?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(E.TooltipProvider,{children:(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"flex items-center",children:(0,t.jsx)(b.ActionButton,{label:M?"Stop Dev Server":"Start Dev Server",onClick:M?R.stop:R.deploy,loading:R.deployLoading||R.stopLoading,error:!!R.deployError,icon:M?y.Square:x.Play,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(E.TooltipContent,{children:M?"Stop Dev Server":"Start Dev Server"})]})}),M?(0,t.jsx)(k.DeploymentStatusBadge,{status:R.status,url:R.url,targetId:e.repositoryPath}):null]}):null]}):null,e.onAdd?(0,t.jsx)(E.TooltipProvider,{children:(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{"aria-label":"Add feature","data-testid":"repository-node-add-button",onClick:t=>{t.stopPropagation(),e.onAdd?.()},className:(0,i.cn)("text-muted-foreground hover:bg-accent dark:hover:bg-accent/50 flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center rounded-full transition-colors hover:text-blue-500",e.pulseAdd&&"animate-pulse-cta bg-blue-100 text-blue-500 dark:bg-blue-900/40"),children:(0,t.jsx)(a.Plus,{className:"h-3.5 w-3.5"})})}),(0,t.jsx)(E.TooltipContent,{children:"Add feature"})]})}):null]})]}),e.onAdd||e.showHandles?(0,t.jsx)(r.Handle,{type:"source",position:u.Position.Right,isConnectable:!e.showHandles,className:"opacity-0!"}):null]})}function R(e){let[n]=(0,u.getBezierPath)({sourceX:e.sourceX,sourceY:e.sourceY,targetX:e.targetX,targetY:e.targetY,sourcePosition:e.sourcePosition,targetPosition:e.targetPosition});return(0,t.jsx)(r.BaseEdge,{id:e.id,path:n,style:{strokeDasharray:"5 5"}})}e.i(1650),e.i(45811),e.i(25235);let M={x:30,y:30,zoom:.85};function S({onResetViewport:e}){let{setViewport:o}=(0,r.useReactFlow)(),a=(0,n.useCallback)(()=>{o(e(),{duration:400})},[e,o]);return(0,t.jsx)(r.ControlButton,{onClick:a,title:"Reset view","aria-label":"Reset view",children:(0,t.jsx)(s.RotateCcw,{style:{fill:"none"}})})}function P({nodes:e,edges:o,selectedFeatureId:s,defaultViewport:u,onNodesChange:h,onAddFeature:f,onConnect:p,onNodeClick:g,onPaneClick:m,onCanvasDrag:v,onMoveEnd:x,onResetViewport:y,toolbar:b,emptyState:w}){let E=(0,n.useMemo)(()=>({featureNode:c.FeatureNode,repositoryNode:O}),[]),k=(0,n.useMemo)(()=>({dependencyEdge:R}),[]),j=(0,n.useMemo)(()=>null==s?e:e.map(e=>"featureNode"===e.type&&e.data.featureId===s?{...e,selected:!0}:e),[e,s]),N=0===e.length,[C,_]=(0,n.useState)(N),[P,T]=(0,n.useState)(!1),L=(0,n.useRef)(N);(0,n.useEffect)(()=>{if(L.current&&!N){T(!0);let e=setTimeout(()=>{_(!1),T(!1)},300);return L.current=N,()=>clearTimeout(e)}!L.current&&N&&_(!0),L.current=N},[N]);let F=N&&!w?(0,t.jsx)(l.EmptyState,{title:"No features yet",description:"Get started by creating your first feature.",action:(0,t.jsxs)(d.Button,{onClick:f,children:[(0,t.jsx)(a.Plus,{className:"mr-2 h-4 w-4"}),"New Feature"]})}):null,A=w??F;return(0,t.jsxs)("div",{"data-testid":N?"features-canvas-empty":"features-canvas","data-no-drawer-close":!0,className:"dark:bg-background pointer-events-auto relative h-full w-full bg-[#f6f7f8]",children:[(0,t.jsxs)(r.ReactFlow,{nodes:j,edges:o,nodeTypes:E,edgeTypes:k,onConnect:p,onNodesChange:h,onNodeClick:g,onPaneClick:m,onMoveStart:v,onMoveEnd:x,defaultViewport:u??M,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,proOptions:{hideAttribution:!0},children:[(0,t.jsx)(r.Background,{variant:r.BackgroundVariant.Dots,gap:24,size:1,color:"#b8bcc4",className:"dark:[&_circle]:!fill-white/[0.1]"}),!N&&(0,t.jsx)(r.Controls,{showInteractive:!1,children:y?(0,t.jsx)(S,{onResetViewport:y}):null}),b]}),C&&A?(0,t.jsx)("div",{className:(0,i.cn)("pointer-events-none absolute inset-0 z-10 flex items-center justify-center transition-opacity duration-300",P?"opacity-0":"animate-in fade-in opacity-100 duration-200"),children:(0,t.jsx)("div",{className:"pointer-events-auto",children:A})}):null]})}var T=e.i(5147),L=e.i(8361),F=e.i(30153);let A="shep-canvas-viewport",D={x:30,y:30,zoom:.85},I=(0,h.default)("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);var $=e.i(33548),z=e.i(23925),B=e.i(83428),G=e.i(35e3),q=e.i(79687),W=e.i(78521),V=e.i(21023);let U=(0,V.createServerReference)("0027d1800d51be25fc33068875d403e79554693f56",V.callServer,void 0,V.findSourceMapURL,"isAgentSetupComplete"),H=(0,V.createServerReference)("004ef0831498d8ec96aed67ec5c1fa1cc41961faac",V.callServer,void 0,V.findSourceMapURL,"checkAgentAuth");var X=e.i(76016),J=e.i(11345),K=e.i(26370),Y=e.i(60460),Q=e.i(18177),Z=e.i(86782),ee=e.i(29847);let et=["select-agent","select-model"];function er({onComplete:e,className:r}){let o,[a,s]=(0,n.useState)([]),[d,l]=(0,n.useState)(!0),[c,u]=(0,n.useState)("select-agent"),[h,f]=(0,n.useState)(null),[p,g]=(0,n.useState)(!1),[m,v]=(0,n.useState)(!1),[x,y]=(0,n.useState)(!0),b=(0,n.useRef)(void 0);(0,n.useEffect)(()=>{(0,Y.getAllAgentModels)().then(s).finally(()=>l(!1))},[]);let w=h?a.find(e=>e.agentType===h):null,E=(0,n.useCallback)((e,t)=>{v(!0),y(!1),b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{t?.(),u(e),requestAnimationFrame(()=>{y(!0),v(!1)})},150)},[]);(0,n.useEffect)(()=>()=>{b.current&&clearTimeout(b.current)},[]);let k=(0,n.useCallback)(async(t,r)=>{g(!0);try{await (0,Q.updateAgentAndModel)(t,r),e()}finally{g(!1)}},[e]),j=(0,n.useCallback)(e=>{let t=a.find(t=>t.agentType===e);t&&t.models.length>0?E("select-model",()=>{f(e)}):k(e,null)},[a,E,k]),N=(0,n.useCallback)(e=>{h&&k(h,e)},[h,k]),C=(0,n.useCallback)(()=>{"select-model"===c&&E("select-agent",()=>{f(null)})},[c,E]);if(d)return(0,t.jsxs)("div",{"data-testid":"welcome-agent-setup",className:(0,i.cn)("flex flex-col items-center justify-center gap-3",r),children:[(0,t.jsx)(B.Loader2,{className:"text-muted-foreground h-4 w-4 animate-spin"}),(0,t.jsx)("p",{className:"text-muted-foreground text-xs",children:"Loading agents…"})]});let _=et.indexOf(c);return(0,t.jsxs)("div",{"data-testid":"welcome-agent-setup",className:(0,i.cn)("flex flex-col items-center gap-4","w-72",r),children:[(0,t.jsx)("div",{className:"flex flex-col items-center gap-1",children:(0,t.jsxs)("div",{className:"text-muted-foreground flex items-center gap-2",children:["select-agent"===c&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(K.Bot,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{className:"text-[10px] font-semibold tracking-widest uppercase",children:"Choose your agent"})]}),"select-model"===c&&w?(o=(0,Z.getAgentTypeIcon)(w.agentType),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o,{className:"h-3.5 w-3.5"}),(0,t.jsxs)("span",{className:"text-[10px] font-semibold tracking-widest uppercase",children:[w.label," — Pick a model"]})]})):null]})}),(0,t.jsx)("div",{className:"flex w-full items-center gap-1",children:et.map((e,r)=>(0,t.jsx)("div",{className:(0,i.cn)("h-0.5 flex-1 rounded-full transition-colors duration-300",r<=_?"bg-foreground/60":"bg-muted")},e))}),(0,t.jsxs)("div",{className:(0,i.cn)("flex w-full flex-col items-center transition-opacity duration-150",x&&!m?"opacity-100":"opacity-0"),children:["select-agent"===c&&(0,t.jsx)("div",{"data-testid":"agent-list",className:"flex w-full flex-col gap-1.5",children:a.map(e=>{let r=(0,Z.getAgentTypeIcon)(e.agentType);return(0,t.jsxs)("button",{type:"button",disabled:p,"data-testid":`agent-option-${e.agentType}`,className:"border-border hover:border-foreground/40 flex w-full cursor-pointer items-center gap-2.5 rounded-md border border-dashed px-4 py-2.5 transition-colors disabled:opacity-50",onClick:()=>j(e.agentType),children:[(0,t.jsx)(r,{className:"text-muted-foreground h-4 w-4 shrink-0"}),(0,t.jsx)("span",{className:"flex-1 text-left text-xs font-medium",children:e.label}),(0,t.jsx)(X.ChevronRight,{className:"text-muted-foreground h-3 w-3"})]},e.agentType)})}),"select-model"===c&&w?(0,t.jsxs)("div",{"data-testid":"model-list",className:"flex w-full flex-col gap-1.5",children:[(0,t.jsxs)("button",{type:"button",disabled:p,className:"text-muted-foreground hover:text-foreground mb-0.5 flex cursor-pointer items-center gap-1 self-start text-[10px] font-medium transition-colors",onClick:C,children:[(0,t.jsx)(J.ChevronLeft,{className:"h-3 w-3"}),"Back"]}),(0,t.jsx)("div",{className:"flex max-h-48 w-full flex-col gap-1.5 overflow-y-auto",children:w.models.map(e=>{let r=(0,ee.getModelMeta)(e.id);return(0,t.jsxs)("button",{type:"button",disabled:p,"data-testid":`model-option-${e.id}`,className:"border-border hover:border-foreground/40 flex w-full cursor-pointer items-center gap-2.5 rounded-md border border-dashed px-4 py-2.5 text-left transition-colors disabled:opacity-50",onClick:()=>N(e.id),children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[(0,t.jsx)("span",{className:"text-xs font-medium",children:r.displayName||e.displayName}),(0,t.jsx)("span",{className:"text-muted-foreground text-[10px] leading-tight",children:r.description||e.description})]}),(0,t.jsx)(X.ChevronRight,{className:"text-muted-foreground h-3 w-3 shrink-0"})]},e.id)})})]}):null]})]})}let en=["cd ~/my-repo",'shep feat new "sleek dashboard"'];function eo({onRepositorySelect:e,className:r}){let[o,s]=(0,n.useState)(!1),[d,l]=(0,n.useState)(!1),[c,u]=(0,n.useState)(null),[h,p]=(0,n.useState)(null);async function g(){if(!d){l(!0);try{let t=await (0,W.pickFolder)();t&&e?.(t)}finally{l(!1)}}}(0,n.useEffect)(()=>{U().then(e=>{u(e)})},[]),(0,n.useEffect)(()=>{c&&H().then(p)},[c]);let m=(0,n.useCallback)(async()=>{await navigator.clipboard.writeText(en.join("\n")),s(!0),setTimeout(()=>s(!1),2e3)},[]),v=(0,n.useCallback)(()=>{u(!0)},[]),x=(0,n.useCallback)(()=>{p(null),H().then(p)},[]);return null===c?null:(0,t.jsx)("div",{"data-testid":"control-center-empty-state",className:(0,i.cn)("flex flex-col items-center justify-center",r),children:(0,t.jsx)("div",{className:"animate-in fade-in slide-in-from-bottom-2 w-96 rounded-2xl border border-white/30 bg-white/50 px-8 py-8 shadow-lg backdrop-blur-xl duration-300 dark:border-white/10 dark:bg-white/5",children:(0,t.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,t.jsxs)("div",{className:"mb-2 text-center",children:[(0,t.jsx)("h1",{className:"text-xl font-bold tracking-tight",children:"Features"}),(0,t.jsx)("p",{className:"text-muted-foreground text-sm font-light",children:"Control Center"})]}),c?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ea,{status:h,onRetry:x}),(0,t.jsxs)("div",{className:"text-muted-foreground flex items-center gap-2",children:[(0,t.jsx)(f,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{className:"text-[10px] font-semibold tracking-widest uppercase",children:"Repositories"})]}),(0,t.jsxs)("button",{type:"button","data-testid":"empty-state-add-repository",onClick:g,disabled:d,className:"border-border hover:border-foreground/40 flex w-full cursor-pointer items-center gap-2.5 rounded-md border border-dashed px-4 py-2.5 transition-colors disabled:cursor-wait disabled:opacity-50",children:[d?(0,t.jsx)(B.Loader2,{className:"text-muted-foreground h-4 w-4 animate-spin"}):(0,t.jsx)(a.Plus,{className:"text-muted-foreground h-4 w-4"}),(0,t.jsx)("span",{className:"text-xs font-medium",children:d?"Opening…":"Add Repository"})]}),(0,t.jsxs)("div",{className:"text-muted-foreground flex items-center gap-2",children:[(0,t.jsx)("div",{className:"bg-border h-px w-10"}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)(I,{className:"h-3 w-3"}),(0,t.jsx)("span",{className:"text-[10px] font-semibold tracking-widest uppercase",children:"Or via CLI"})]}),(0,t.jsx)("div",{className:"bg-border h-px w-10"})]}),(0,t.jsxs)("div",{"data-testid":"cli-code-block",className:"relative w-full rounded-md bg-zinc-900 px-3 py-2 font-mono text-[11px] text-zinc-300",children:[(0,t.jsx)("button",{type:"button","data-testid":"cli-code-block-copy",onClick:m,className:"absolute top-2 right-2 cursor-pointer rounded p-1 text-zinc-500 transition-colors hover:bg-zinc-800 hover:text-zinc-300","aria-label":"Copy commands",children:o?(0,t.jsx)(z.Check,{className:"h-3 w-3"}):(0,t.jsx)($.Copy,{className:"h-3 w-3"})}),(0,t.jsx)("div",{className:"space-y-0.5",children:en.map(e=>(0,t.jsxs)("div",{className:"whitespace-nowrap",children:[(0,t.jsx)("span",{className:"text-zinc-500 select-none",children:"$ "}),(0,t.jsx)("span",{children:e})]},e))})]}),(0,t.jsx)("p",{className:"text-muted-foreground text-[10px]",children:"Feature will appear on canvas once created"})]}):(0,t.jsx)(er,{onComplete:v,className:"w-full"})]})})})}function ea({status:e,onRetry:r}){return e?e.installed&&e.authenticated?(0,t.jsxs)("div",{className:"animate-in fade-in flex w-full items-center gap-2 rounded-md bg-emerald-500/10 px-3 py-1.5",children:[(0,t.jsx)(G.CheckCircle2,{className:"h-3 w-3 text-emerald-600 dark:text-emerald-400"}),(0,t.jsxs)("span",{className:"text-[10px] text-emerald-700 dark:text-emerald-300",children:[e.label," ready"]})]}):e.installed?(0,t.jsxs)("div",{className:"flex w-full flex-col gap-2 rounded-md bg-amber-500/10 px-3 py-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(q.AlertCircle,{className:"h-3 w-3 text-amber-600 dark:text-amber-400"}),(0,t.jsxs)("span",{className:"text-[10px] font-medium text-amber-700 dark:text-amber-300",children:[e.label," needs authentication"]})]}),e.authCommand?(0,t.jsxs)("div",{className:"rounded bg-zinc-900 px-2 py-1 font-mono text-[10px] text-zinc-300",children:[(0,t.jsx)("span",{className:"text-zinc-500 select-none",children:"$ "}),e.authCommand]}):null,(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[e.binaryName?(0,t.jsxs)("button",{type:"button","data-testid":"auth-banner-open-terminal",onClick:async()=>{try{let t="claude-code"===e.agentType?"claude-code":e.agentType;await fetch(`/api/tools/${t}/launch`,{method:"POST"})}catch{}},className:"flex items-center gap-1 rounded border border-amber-600/30 px-2 py-0.5 text-[10px] font-medium text-amber-700 transition-colors hover:bg-amber-500/10 dark:text-amber-300",children:[(0,t.jsx)(g.Terminal,{className:"h-2.5 w-2.5"}),"Open ",e.label]}):null,(0,t.jsx)("button",{type:"button",onClick:r,className:"text-[10px] font-medium text-amber-700 underline underline-offset-2 hover:text-amber-900 dark:text-amber-300 dark:hover:text-amber-100",children:"Re-check"})]})]}):(0,t.jsxs)("div",{className:"flex w-full flex-col gap-2 rounded-md bg-amber-500/10 px-3 py-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(q.AlertCircle,{className:"h-3 w-3 text-amber-600 dark:text-amber-400"}),(0,t.jsxs)("span",{className:"text-[10px] font-medium text-amber-700 dark:text-amber-300",children:[e.label," not installed"]})]}),e.binaryName?(0,t.jsxs)("div",{className:"rounded bg-zinc-900 px-2 py-1 font-mono text-[10px] text-zinc-300",children:[(0,t.jsx)("span",{className:"text-zinc-500 select-none",children:"$ "}),"npm install -g ",e.binaryName]}):null,(0,t.jsx)("button",{type:"button",onClick:r,className:"self-start text-[10px] font-medium text-amber-700 underline underline-offset-2 hover:text-amber-900 dark:text-amber-300 dark:hover:text-amber-100",children:"Re-check"})]}):(0,t.jsxs)("div",{className:"bg-muted/50 flex w-full items-center gap-2 rounded-md px-3 py-1.5",children:[(0,t.jsx)(B.Loader2,{className:"text-muted-foreground h-3 w-3 animate-spin"}),(0,t.jsx)("span",{className:"text-muted-foreground text-[10px]",children:"Checking agent setup…"})]})}var es=e.i(17840);let ei={maxZoom:1,padding:.5,duration:500};function ed({initialNodes:e,initialEdges:a}){let s,i,d,l=(0,o.useRouter)(),c=(0,o.usePathname)(),u=(s=(0,o.usePathname)().match(/^\/feature\/([^/]+)/),s?.[1]??null),h=(0,L.useSoundAction)("click"),{guardedNavigate:f}=(0,F.useDrawerCloseGuard)(),{fitView:p}=(0,r.useReactFlow)(),g=(0,n.useRef)(null),{defaultViewport:m,onMoveEnd:v,resetViewport:x}=(i=(0,n.useRef)(function(){try{let e=localStorage.getItem(A);if(null==e)return D;let t=JSON.parse(e);return!(null==t||"object"!=typeof t||Array.isArray(t))&&"number"==typeof t.x&&"number"==typeof t.y&&"number"==typeof t.zoom&&Number.isFinite(t.x)&&Number.isFinite(t.y)&&Number.isFinite(t.zoom)&&t.zoom>0?t:D}catch{return D}}()).current,d=(0,n.useRef)(null),(0,n.useEffect)(()=>()=>{null!=d.current&&clearTimeout(d.current)},[]),{defaultViewport:i,onMoveEnd:(0,n.useCallback)(e=>{null!=d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{try{localStorage.setItem(A,JSON.stringify(e))}catch{}},500)},[]),resetViewport:(0,n.useCallback)(()=>{try{localStorage.removeItem(A)}catch{}return D},[])}),{nodes:y,edges:b,onNodesChange:w,handleConnect:E,handleAddRepository:k,handleDeleteFeature:j,handleRetryFeature:N,handleStartFeature:C,handleDeleteRepository:_,createFeatureNode:O,setCallbacks:R}=(0,es.useControlCenterState)(e,a),{setFeatures:M}=(0,T.useSidebarFeaturesContext)(),S=(0,n.useMemo)(()=>y.filter(e=>"featureNode"===e.type),[y]),I=(0,n.useMemo)(()=>S.map(e=>{let t=e.data;return`${t.featureId}:${t.state}:${t.name}`}).sort().join(","),[S]);(0,n.useEffect)(()=>{M(S.map(e=>{let t=e.data,r=(0,T.mapNodeStateToSidebarStatus)(t.state);return r?{featureId:t.featureId,name:t.name,status:r,...null!=t.startedAt&&{startedAt:t.startedAt},...null!=t.runtime&&{duration:t.runtime},...t.agentType&&{agentType:t.agentType},...t.modelId&&{modelId:t.modelId}}:null}).filter(Boolean))},[I,S,M]);let $=(0,n.useCallback)((e,t)=>{if("featureNode"===t.type){let r=t.data;"creating"!==r.state&&"deleting"!==r.state&&e.target.closest('[data-testid="feature-node-card"]')&&f(()=>{h.play(),l.push(`/feature/${r.featureId}`)})}},[l,h,f]),z=(0,n.useCallback)(()=>{h.play(),l.push("/create")},[l,h]),B=(0,n.useCallback)(e=>{h.play();let t=y.find(t=>t.id===e),r=t?.data?.repositoryPath;r?l.push(`/create?repo=${encodeURIComponent(r)}`):l.push("/create")},[y,l,h]),G=(0,n.useCallback)(e=>{let t=e.startsWith("feat-")?e.slice(5):e,r=b.find(t=>t.target===e),n=r?y.find(e=>e.id===r.source):null,o=n?.data?.repositoryPath;h.play();let a=new URLSearchParams;o&&a.set("repo",o),a.set("parent",t),l.push(`/create?${a.toString()}`)},[y,b,l,h]),q=(0,n.useCallback)(e=>{let t=y.find(t=>t.id===e);if(t?.type==="repositoryNode"){let e=t.data;e.id&&f(()=>l.push(`/repository/${e.id}`))}},[y,l,f]),W=(0,n.useCallback)(()=>{"/"!==c&&f(()=>l.push("/"))},[l,c,f]);(0,n.useEffect)(()=>{let e=e=>{let{wasEmpty:t,repoPath:r}=k(e.detail.path);t&&setTimeout(()=>{p(ei),g.current=setTimeout(()=>{f(()=>l.push(`/create?repo=${encodeURIComponent(r)}`))},600)},0)};return window.addEventListener("shep:add-repository",e),()=>{window.removeEventListener("shep:add-repository",e),null!=g.current&&clearTimeout(g.current)}},[k,p,f,l]),(0,n.useEffect)(()=>{let e=e=>{let t=e.detail;if(t.parentId)return void O(`feat-${t.parentId}`,{state:"creating",featureId:t.featureId,name:t.name,description:t.description,repositoryPath:t.repositoryPath},"dependencyEdge");let r=y.find(e=>"repositoryNode"===e.type&&e.data.repositoryPath===t.repositoryPath);O(r?.id??null,{state:"running",featureId:t.featureId,name:t.name,description:t.description,repositoryPath:t.repositoryPath})};return window.addEventListener("shep:feature-created",e),()=>window.removeEventListener("shep:feature-created",e)},[y,O]),(0,n.useEffect)(()=>{let e=e=>{let{featureId:t,cleanup:r,cascadeDelete:n}=e.detail;j(t,r,n)};return window.addEventListener("shep:feature-delete-requested",e),()=>window.removeEventListener("shep:feature-delete-requested",e)},[j]),(0,n.useEffect)(()=>{R({onNodeAction:G,onFeatureDelete:j,onRetryFeature:N,onStartFeature:C,onRepositoryAdd:B,onRepositoryClick:q,onRepositoryDelete:_})},[R,G,j,N,C,B,q,_]);let V=(0,n.useCallback)((e,t)=>{v(t)},[v]),U=y.some(e=>"repositoryNode"===e.type),[H,X]=(0,n.useState)(U),J=(0,n.useRef)(null);(0,n.useEffect)(()=>(U?(J.current&&(clearTimeout(J.current),J.current=null),X(!0)):H&&(J.current=setTimeout(()=>{X(!1),J.current=null},500)),()=>{J.current&&clearTimeout(J.current)}),[U,H]);let K=c.startsWith("/create"),Y=(0,n.useMemo)(()=>{let e=y.filter(e=>"repositoryNode"===e.type),t=y.some(e=>"featureNode"===e.type);return 1!==e.length||t||K?y:y.map(e=>"repositoryNode"===e.type?{...e,data:{...e.data,pulseAdd:!0}}:e)},[y,K]);return(0,t.jsx)(P,{nodes:H?Y:[],edges:H?b:[],selectedFeatureId:u,defaultViewport:m,onNodesChange:w,onConnect:E,onAddFeature:z,onNodeClick:$,onPaneClick:W,onMoveEnd:V,onResetViewport:x,emptyState:(0,t.jsx)(eo,{onRepositorySelect:k})})}function el({initialNodes:e,initialEdges:n,drawer:o}){return(0,t.jsxs)("div",{"data-testid":"control-center",className:"h-full w-full",children:[(0,t.jsx)(r.ReactFlowProvider,{children:(0,t.jsx)(ed,{initialNodes:e,initialEdges:n})}),(0,t.jsx)("div",{children:o},"drawer")]})}e.s(["ControlCenter",()=>el],48246)}]);
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,17840,e=>{"use strict";var t=e.i(79054),r=e.i(31406),n=e.i(60112),o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),a=o((e,t)=>{var r=Object.defineProperty,n=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),o=(e,t,n)=>{let o;return(o="symbol"!=typeof t?t+"":t)in e?r(e,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[o]=n},a=n((e,t)=>{function r(e,t){e[t]?e[t]++:e[t]=1}function n(e,t){--e[t]||delete e[t]}function a(e,t,r,n){var o=""+t,a=""+r;if(!e&&o>a){var s=o;o=a,a=s}return o+"\x01"+a+"\x01"+(void 0===n?"\0":n)}function s(e,t){return a(e,t.v,t.w,t.name)}t.exports=class{constructor(e){o(this,"_isDirected",!0),o(this,"_isMultigraph",!1),o(this,"_isCompound",!1),o(this,"_label"),o(this,"_defaultNodeLabelFn",()=>{}),o(this,"_defaultEdgeLabelFn",()=>{}),o(this,"_nodes",{}),o(this,"_in",{}),o(this,"_preds",{}),o(this,"_out",{}),o(this,"_sucs",{}),o(this,"_edgeObjs",{}),o(this,"_edgeLabels",{}),o(this,"_nodeCount",0),o(this,"_edgeCount",0),o(this,"_parent"),o(this,"_children"),e&&(this._isDirected=!Object.hasOwn(e,"directed")||e.directed,this._isMultigraph=!!Object.hasOwn(e,"multigraph")&&e.multigraph,this._isCompound=!!Object.hasOwn(e,"compound")&&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 this._defaultNodeLabelFn=e,"function"!=typeof e&&(this._defaultNodeLabelFn=()=>e),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var e=this;return this.nodes().filter(t=>0===Object.keys(e._in[t]).length)}sinks(){var e=this;return this.nodes().filter(t=>0===Object.keys(e._out[t]).length)}setNodes(e,t){var r=arguments,n=this;return e.forEach(function(e){r.length>1?n.setNode(e,t):n.setNode(e)}),this}setNode(e,t){return Object.hasOwn(this._nodes,e)?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 Object.hasOwn(this._nodes,e)}removeNode(e){var t=this;if(Object.hasOwn(this._nodes,e)){var r=e=>t.removeEdge(t._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(function(e){t.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(r),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(r),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(var r=t;void 0!==r;r=this.parent(r))if(r===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}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var t=this._parent[e];if("\0"!==t)return t}}children(e="\0"){if(this._isCompound){var t=this._children[e];if(t)return Object.keys(t)}else{if("\0"===e)return this.nodes();if(this.hasNode(e))return[]}}predecessors(e){var t=this._preds[e];if(t)return Object.keys(t)}successors(e){var t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){var t=this.predecessors(e);if(t){let n=new Set(t);for(var r of this.successors(e))n.add(r);return Array.from(n.values())}}isLeaf(e){return 0===(this.isDirected()?this.successors(e):this.neighbors(e)).length}filterNodes(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var r=this;Object.entries(this._nodes).forEach(function([r,n]){e(r)&&t.setNode(r,n)}),Object.values(this._edgeObjs).forEach(function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,r.edge(e))});var n={};return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,function e(o){var a=r.parent(o);return void 0===a||t.hasNode(a)?(n[o]=a,a):a in n?n[a]:e(a)}(e))),t}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=e,"function"!=typeof e&&(this._defaultEdgeLabelFn=()=>e),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){var r=this,n=arguments;return e.reduce(function(e,o){return n.length>1?r.setEdge(e,o,t):r.setEdge(e,o),o}),this}setEdge(){var e,t,n,o,s=!1,i=arguments[0];"object"==typeof i&&null!==i&&"v"in i?(e=i.v,t=i.w,n=i.name,2==arguments.length&&(o=arguments[1],s=!0)):(e=i,t=arguments[1],n=arguments[3],arguments.length>2&&(o=arguments[2],s=!0)),e=""+e,t=""+t,void 0!==n&&(n=""+n);var d=a(this._isDirected,e,t,n);if(Object.hasOwn(this._edgeLabels,d))return s&&(this._edgeLabels[d]=o),this;if(void 0!==n&&!this._isMultigraph)throw Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(t),this._edgeLabels[d]=s?o:this._defaultEdgeLabelFn(e,t,n);var l=function(e,t,r,n){var o=""+t,a=""+r;if(!e&&o>a){var s=o;o=a,a=s}var i={v:o,w:a};return n&&(i.name=n),i}(this._isDirected,e,t,n);return e=l.v,t=l.w,Object.freeze(l),this._edgeObjs[d]=l,r(this._preds[t],e),r(this._sucs[e],t),this._in[t][d]=l,this._out[e][d]=l,this._edgeCount++,this}edge(e,t,r){var n=1==arguments.length?s(this._isDirected,arguments[0]):a(this._isDirected,e,t,r);return this._edgeLabels[n]}edgeAsObj(){let e=this.edge(...arguments);return"object"!=typeof e?{label:e}:e}hasEdge(e,t,r){var n=1==arguments.length?s(this._isDirected,arguments[0]):a(this._isDirected,e,t,r);return Object.hasOwn(this._edgeLabels,n)}removeEdge(e,t,r){var o=1==arguments.length?s(this._isDirected,arguments[0]):a(this._isDirected,e,t,r),i=this._edgeObjs[o];return i&&(e=i.v,t=i.w,delete this._edgeLabels[o],delete this._edgeObjs[o],n(this._preds[t],e),n(this._sucs[e],t),delete this._in[t][o],delete this._out[e][o],this._edgeCount--),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)}filterEdges(e,t,r){if(e){var n=Object.values(e);return r?n.filter(function(e){return e.v===t&&e.w===r||e.v===r&&e.w===t}):n}}}}),s=n((e,t)=>{t.exports="3.0.2"}),i=n((e,t)=>{t.exports={Graph:a(),version:s()}}),d=n((e,t)=>{var r=a();t.exports={write:function(e){var t,r,n={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:(t=e).nodes().map(function(e){var r=t.node(e),n=t.parent(e),o={v:e};return void 0!==r&&(o.value=r),void 0!==n&&(o.parent=n),o}),edges:(r=e).edges().map(function(e){var t=r.edge(e),n={v:e.v,w:e.w};return void 0!==e.name&&(n.name=e.name),void 0!==t&&(n.value=t),n})};return void 0!==e.graph()&&(n.value=structuredClone(e.graph())),n},read:function(e){var t=new r(e.options).setGraph(e.value);return e.nodes.forEach(function(e){t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(function(e){t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}}}),l=n((e,t)=>{t.exports=function(e,t,n,o){return function(e,t,r,n){var o={},a=!0,s=0,i=e.nodes(),d=function(e){var t=r(e);o[e.v].distance+t<o[e.w].distance&&(o[e.w]={distance:o[e.v].distance+t,predecessor:e.v},a=!0)},l=function(){i.forEach(function(e){n(e).forEach(function(t){var r=t.v===e?t.v:t.w,n=r===t.v?t.w:t.v;d({v:r,w:n})})})};i.forEach(function(e){o[e]={distance:e===t?0:1/0}});for(var c=i.length,u=1;u<c&&(a=!1,s++,l(),a);u++);if(s===c-1&&(a=!1,l(),a))throw Error("The graph contains a negative weight cycle");return o}(e,String(t),n||r,o||function(t){return e.outEdges(t)})};var r=()=>1}),c=n((e,t)=>{t.exports=function(e){var t,r={},n=[];return e.nodes().forEach(function(o){t=[],function n(o){Object.hasOwn(r,o)||(r[o]=!0,t.push(o),e.successors(o).forEach(n),e.predecessors(o).forEach(n))}(o),t.length&&n.push(t)}),n}}),u=n((e,t)=>{t.exports=class{constructor(){o(this,"_arr",[]),o(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(e){return e.key})}has(e){return Object.hasOwn(this._keyIndices,e)}priority(e){var 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){var r=this._keyIndices;if(!Object.hasOwn(r,e=String(e))){var n=this._arr,o=n.length;return r[e]=o,n.push({key:e,priority:t}),this._decrease(o),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){var r=this._keyIndices[e];if(t>this._arr[r].priority)throw Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[r].priority+" New: "+t);this._arr[r].priority=t,this._decrease(r)}_heapify(e){var t=this._arr,r=2*e,n=r+1,o=e;r<t.length&&(o=t[r].priority<t[o].priority?r:o,n<t.length&&(o=t[n].priority<t[o].priority?n:o),o!==e&&(this._swap(e,o),this._heapify(o)))}_decrease(e){for(var t,r=this._arr,n=r[e].priority;0!==e&&!(r[t=e>>1].priority<n);)this._swap(e,t),e=t}_swap(e,t){var r=this._arr,n=this._keyIndices,o=r[e],a=r[t];r[e]=a,r[t]=o,n[a.key]=e,n[o.key]=t}}}),h=n((e,t)=>{var r=u();t.exports=function(e,t,o,a){return function(e,t,n,o){var a,s,i={},d=new r,l=function(e){var t=e.v!==a?e.v:e.w,r=i[t],o=n(e),l=s.distance+o;if(o<0)throw Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+o);l<r.distance&&(r.distance=l,r.predecessor=a,d.decrease(t,l))};for(e.nodes().forEach(function(e){var r=e===t?0:1/0;i[e]={distance:r},d.add(e,r)});d.size()>0&&(s=i[a=d.removeMin()]).distance!==1/0;)o(a).forEach(l);return i}(e,String(t),o||n,a||function(t){return e.outEdges(t)})};var n=()=>1}),f=n((e,t)=>{var r=h();t.exports=function(e,t,n){return e.nodes().reduce(function(o,a){return o[a]=r(e,a,t,n),o},{})}}),p=n((e,t)=>{t.exports=function(e,t,r){if(void 0!==e[t].predecessor)throw Error("Invalid source vertex");if(void 0===e[r].predecessor&&r!==t)throw Error("Invalid destination vertex");return{weight:e[r].distance,path:function(e,t,r){for(var n=[],o=r;o!==t;)n.push(o),o=e[o].predecessor;return n.push(t),n.reverse()}(e,t,r)}}}),g=n((e,t)=>{t.exports=function(e){var t=0,r=[],n={},o=[];return e.nodes().forEach(function(a){Object.hasOwn(n,a)||function a(s){var i=n[s]={onStack:!0,lowlink:t,index:t++};if(r.push(s),e.successors(s).forEach(function(e){Object.hasOwn(n,e)?n[e].onStack&&(i.lowlink=Math.min(i.lowlink,n[e].index)):(a(e),i.lowlink=Math.min(i.lowlink,n[e].lowlink))}),i.lowlink===i.index){var d,l=[];do n[d=r.pop()].onStack=!1,l.push(d);while(s!==d)o.push(l)}}(a)}),o}}),m=n((e,t)=>{var r=g();t.exports=function(e){return r(e).filter(function(t){return t.length>1||1===t.length&&e.hasEdge(t[0],t[0])})}}),v=n((e,t)=>{t.exports=function(e,t,n){var o,a,s,i,d;return o=e,a=t||r,s=n||function(t){return e.outEdges(t)},i={},(d=o.nodes()).forEach(function(e){i[e]={},i[e][e]={distance:0},d.forEach(function(t){e!==t&&(i[e][t]={distance:1/0})}),s(e).forEach(function(t){var r=t.v===e?t.w:t.v,n=a(t);i[e][r]={distance:n,predecessor:e}})}),d.forEach(function(e){var t=i[e];d.forEach(function(r){var n=i[r];d.forEach(function(r){var o=n[e],a=t[r],s=n[r],i=o.distance+a.distance;i<s.distance&&(s.distance=i,s.predecessor=a.predecessor)})})}),i};var r=()=>1}),x=n((e,t)=>{function r(e){var t={},r={},o=[];if(e.sinks().forEach(function a(s){if(Object.hasOwn(r,s))throw new n;Object.hasOwn(t,s)||(r[s]=!0,t[s]=!0,e.predecessors(s).forEach(a),delete r[s],o.push(s))}),Object.keys(t).length!==e.nodeCount())throw new n;return o}var n=class extends Error{constructor(){super(...arguments)}};t.exports=r,r.CycleException=n}),y=n((e,t)=>{var r=x();t.exports=function(e){try{r(e)}catch(e){if(e instanceof r.CycleException)return!1;throw e}return!0}}),b=n((e,t)=>{t.exports=function(e,t,r,n,o){Array.isArray(t)||(t=[t]);var a=(e.isDirected()?e.successors:e.neighbors).bind(e),s={};return t.forEach(function(t){if(!e.hasNode(t))throw Error("Graph does not have node: "+t);o=function e(t,r,n,o,a,s,i){return Object.hasOwn(o,r)||(o[r]=!0,n||(i=s(i,r)),a(r).forEach(function(r){i=e(t,r,n,o,a,s,i)}),n&&(i=s(i,r))),i}(e,t,"post"===r,s,a,n,o)}),o}}),w=n((e,t)=>{var r=b();t.exports=function(e,t,n){return r(e,t,n,function(e,t){return e.push(t),e},[])}}),E=n((e,t)=>{var r=w();t.exports=function(e,t){return r(e,t,"post")}}),k=n((e,t)=>{var r=w();t.exports=function(e,t){return r(e,t,"pre")}}),j=n((e,t)=>{var r=a(),n=u();t.exports=function(e,t){var o,a=new r,s={},i=new n;function d(e){var r=e.v===o?e.w:e.v,n=i.priority(r);if(void 0!==n){var a=t(e);a<n&&(s[r]=o,i.decrease(r,a))}}if(0===e.nodeCount())return a;e.nodes().forEach(function(e){i.add(e,1/0),a.setNode(e)}),i.decrease(e.nodes()[0],0);for(var l=!1;i.size()>0;){if(Object.hasOwn(s,o=i.removeMin()))a.setEdge(o,s[o]);else{if(l)throw Error("Input graph is not connected: "+e);l=!0}e.nodeEdges(o).forEach(d)}return a}}),N=n((e,t)=>{var r=h(),n=l();t.exports=function(e,t,o,a){return function(e,t,o,a){if(void 0===o)return r(e,t,o,a);for(var s=!1,i=e.nodes(),d=0;d<i.length;d++){for(var l=a(i[d]),c=0;c<l.length;c++){var u=l[c],h=u.v===i[d]?u.v:u.w,f=h===u.v?u.w:u.v;0>o({v:h,w:f})&&(s=!0)}if(s)return n(e,t,o,a)}return r(e,t,o,a)}(e,t,o,a||function(t){return e.outEdges(t)})}}),C=n((e,t)=>{t.exports={bellmanFord:l(),components:c(),dijkstra:h(),dijkstraAll:f(),extractPath:p(),findCycles:m(),floydWarshall:v(),isAcyclic:y(),postorder:E(),preorder:k(),prim:j(),shortestPaths:N(),reduce:b(),tarjan:g(),topsort:x()}}),_=i();t.exports={Graph:_.Graph,json:d(),alg:C(),version:_.version}}),s=o((e,t)=>{function r(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function n(e,t){if("_next"!==e&&"_prev"!==e)return t}t.exports=class{constructor(){let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return r(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&r(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,r=t._prev;for(;r!==t;)e.push(JSON.stringify(r,n)),r=r._prev;return"["+e.join(", ")+"]"}}}),i=o((e,t)=>{var r=a().Graph,n=s();t.exports=function(e,t){var a,s;let l,c,u,h,f;if(1>=e.nodeCount())return[];let p=(a=e,s=t||o,l=new r,c=0,u=0,a.nodes().forEach(e=>{l.setNode(e,{v:e,in:0,out:0})}),a.edges().forEach(e=>{let t=l.edge(e.v,e.w)||0,r=s(e);l.setEdge(e.v,e.w,t+r),u=Math.max(u,l.node(e.v).out+=r),c=Math.max(c,l.node(e.w).in+=r)}),h=(function(e){let t=[];for(let r=0;r<e;r++)t.push(r);return t})(u+c+3).map(()=>new n),f=c+1,l.nodes().forEach(e=>{d(h,f,l.node(e))}),{graph:l,buckets:h,zeroIdx:f});return(function(e,t,r){let n=[],o=t[t.length-1],a=t[0],s;for(;e.nodeCount();){for(;s=a.dequeue();)i(e,t,r,s);for(;s=o.dequeue();)i(e,t,r,s);if(e.nodeCount()){for(let o=t.length-2;o>0;--o)if(s=t[o].dequeue()){n=n.concat(i(e,t,r,s,!0));break}}}return n})(p.graph,p.buckets,p.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w))};var o=()=>1;function i(e,t,r,n,o){let a=o?[]:void 0;return e.inEdges(n.v).forEach(n=>{let s=e.edge(n),i=e.node(n.v);o&&a.push({v:n.v,w:n.w}),i.out-=s,d(t,r,i)}),e.outEdges(n.v).forEach(n=>{let o=e.edge(n),a=n.w,s=e.node(a);s.in-=o,d(t,r,s)}),e.removeNode(n.v),a}function d(e,t,r){r.out?r.in?e[r.out-r.in+t].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}}),d=o((e,t)=>{var r=a().Graph;function n(e,t,r,n){for(var o=n;e.hasNode(o);)o=d(n);return r.dummy=t,e.setNode(o,r),o}t.exports={addBorderNode:function(e,t,r,o){let a={width:0,height:0};return arguments.length>=4&&(a.rank=r,a.order=o),n(e,"border",a,t)},addDummyNode:n,applyWithChunking:o,asNonCompoundGraph:function(e){let t=new r({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(r=>{e.children(r).length||t.setNode(r,e.node(r))}),e.edges().forEach(r=>{t.setEdge(r,e.edge(r))}),t},buildLayerMatrix:function(e){let t=l(s(e)+1).map(()=>[]);return e.nodes().forEach(r=>{let n=e.node(r),o=n.rank;void 0!==o&&(t[o][n.order]=r)}),t},intersectRect:function(e,t){let r,n,o=e.x,a=e.y,s=t.x-o,i=t.y-a,d=e.width/2,l=e.height/2;if(!s&&!i)throw Error("Not possible to find intersection inside of the rectangle");return Math.abs(i)*d>Math.abs(s)*l?(i<0&&(l=-l),r=l*s/i,n=l):(s<0&&(d=-d),r=d,n=d*i/s),{x:o+r,y:a+n}},mapValues:function(e,t){let r=t;return"string"==typeof t&&(r=e=>e[t]),Object.entries(e).reduce((e,[t,n])=>(e[t]=r(n,t),e),{})},maxRank:s,normalizeRanks:function(e){let t=o(Math.min,e.nodes().map(t=>{let r=e.node(t).rank;return void 0===r?Number.MAX_VALUE:r}));e.nodes().forEach(r=>{let n=e.node(r);Object.hasOwn(n,"rank")&&(n.rank-=t)})},notime:function(e,t){return t()},partition:function(e,t){let r={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?r.lhs.push(e):r.rhs.push(e)}),r},pick:function(e,t){let r={};for(let n of t)void 0!==e[n]&&(r[n]=e[n]);return r},predecessorWeights:function(e){let t=e.nodes().map(t=>{let r={};return e.inEdges(t).forEach(t=>{r[t.v]=(r[t.v]||0)+e.edge(t).weight}),r});return c(e.nodes(),t)},range:l,removeEmptyRanks:function(e){let t=o(Math.min,e.nodes().map(t=>e.node(t).rank).filter(e=>void 0!==e)),r=[];e.nodes().forEach(n=>{let o=e.node(n).rank-t;r[o]||(r[o]=[]),r[o].push(n)});let n=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((t,r)=>{void 0===t&&r%a!=0?--n:void 0!==t&&n&&t.forEach(t=>e.node(t).rank+=n)})},simplify:function(e){let t=new r().setGraph(e.graph());return e.nodes().forEach(r=>t.setNode(r,e.node(r))),e.edges().forEach(r=>{let n=t.edge(r.v,r.w)||{weight:0,minlen:1},o=e.edge(r);t.setEdge(r.v,r.w,{weight:n.weight+o.weight,minlen:Math.max(n.minlen,o.minlen)})}),t},successorWeights:function(e){let t=e.nodes().map(t=>{let r={};return e.outEdges(t).forEach(t=>{r[t.w]=(r[t.w]||0)+e.edge(t).weight}),r});return c(e.nodes(),t)},time:function(e,t){let r=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-r)+"ms")}},uniqueId:d,zipObject:c};function o(e,t){if(!(t.length>65535))return e.apply(null,t);{let r=function(e,t=65535){let r=[];for(let n=0;n<e.length;n+=t){let o=e.slice(n,n+t);r.push(o)}return r}(t);return e.apply(null,r.map(t=>e.apply(null,t)))}}function s(e){return o(Math.max,e.nodes().map(t=>{let r=e.node(t).rank;return void 0===r?5e-324:r}))}var i=0;function d(e){return e+""+ ++i}function l(e,t,r=1){null==t&&(t=e,e=0);let n=e=>e<t;r<0&&(n=e=>t<e);let o=[];for(let t=e;n(t);t+=r)o.push(t);return o}function c(e,t){return e.reduce((e,r,n)=>(e[r]=t[n],e),{})}}),l=o((e,t)=>{var r=i(),n=d().uniqueId;t.exports={run:function(e){var t,o;let a,s,i;("greedy"===e.graph().acyclicer?r(e,(t=e,e=>t.edge(e).weight)):(a=[],s={},i={},(o=e).nodes().forEach(function e(t){Object.hasOwn(i,t)||(i[t]=!0,s[t]=!0,o.outEdges(t).forEach(t=>{Object.hasOwn(s,t.w)?a.push(t):e(t.w)}),delete s[t])}),a)).forEach(t=>{let r=e.edge(t);e.removeEdge(t),r.forwardName=t.name,r.reversed=!0,e.setEdge(t.w,t.v,r,n("rev"))})},undo:function(e){e.edges().forEach(t=>{let r=e.edge(t);if(r.reversed){e.removeEdge(t);let n=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(t.w,t.v,r,n)}})}}}),c=o((e,t)=>{var r=d();t.exports={run:function(e){e.graph().dummyChains=[],e.edges().forEach(t=>(function(e,t){let n,o,a,s=t.v,i=e.node(s).rank,d=t.w,l=e.node(d).rank,c=t.name,u=e.edge(t),h=u.labelRank;if(l!==i+1){for(e.removeEdge(t),a=0,++i;i<l;++a,++i)u.points=[],o={width:0,height:0,edgeLabel:u,edgeObj:t,rank:i},n=r.addDummyNode(e,"edge",o,"_d"),i===h&&(o.width=u.width,o.height=u.height,o.dummy="edge-label",o.labelpos=u.labelpos),e.setEdge(s,n,{weight:u.weight},c),0===a&&e.graph().dummyChains.push(n),s=n;e.setEdge(s,d,{weight:u.weight},c)}})(e,t))},undo:function(e){e.graph().dummyChains.forEach(t=>{let r=e.node(t),n=r.edgeLabel,o;for(e.setEdge(r.edgeObj,n);r.dummy;)o=e.successors(t)[0],e.removeNode(t),n.points.push({x:r.x,y:r.y}),"edge-label"===r.dummy&&(n.x=r.x,n.y=r.y,n.width=r.width,n.height=r.height),t=o,r=e.node(t)})}}}),u=o((e,t)=>{var{applyWithChunking:r}=d();t.exports={longestPath:function(e){var t={};e.sources().forEach(function n(o){var a=e.node(o);if(Object.hasOwn(t,o))return a.rank;t[o]=!0;var s=r(Math.min,e.outEdges(o).map(t=>null==t?1/0:n(t.w)-e.edge(t).minlen));return s===1/0&&(s=0),a.rank=s})},slack:function(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}}}),h=o((e,t)=>{var r=a().Graph,n=u().slack;t.exports=function(e){var t,o,a,s,i=new r({directed:!1}),d=e.nodes()[0],l=e.nodeCount();for(i.setNode(d,{});t=i,o=e,t.nodes().forEach(function e(r){o.nodeEdges(r).forEach(a=>{var s=a.v,i=r===s?a.w:s;t.hasNode(i)||n(o,a)||(t.setNode(i,{}),t.setEdge(r,i,{}),e(i))})}),t.nodeCount()<l;)a=function(e,t){return t.edges().reduce((r,o)=>{let a=1/0;return e.hasNode(o.v)!==e.hasNode(o.w)&&(a=n(t,o)),a<r[0]?[a,o]:r},[1/0,null])[1]}(i,e),s=i.hasNode(a.v)?n(e,a):-n(e,a),function(e,t,r){e.nodes().forEach(e=>t.node(e).rank+=r)}(i,e,s);return i}}),f=o((e,t)=>{var r=h(),n=u().slack,o=u().longestPath,s=a().alg.preorder,i=a().alg.postorder,l=d().simplify;function c(e){o(e=l(e));var t,n,a=r(e);for(g(a),f(a,e);t=m(a);)n=v(a,e,t),x(a,e,t,n)}function f(e,t){var r=i(e,e.nodes());(r=r.slice(0,r.length-1)).forEach(r=>{var n,o,a,s;return n=e,o=t,a=r,s=n.node(a).parent,void(n.edge(a,s).cutvalue=p(n,o,a))})}function p(e,t,r){var n=e.node(r).parent,o=!0,a=t.edge(r,n),s=0;return a||(o=!1,a=t.edge(n,r)),s=a.weight,t.nodeEdges(r).forEach(a=>{var i=a.v===r,d=i?a.w:a.v;if(d!==n){var l,c,u,h=i===o,f=t.edge(a).weight;if(s+=h?f:-f,l=e,c=r,u=d,l.hasEdge(c,u)){var p=e.edge(r,d).cutvalue;s+=h?-p:p}}}),s}function g(e,t){arguments.length<2&&(t=e.nodes()[0]),function e(t,r,n,o,a){var s=n,i=t.node(o);return r[o]=!0,t.neighbors(o).forEach(a=>{Object.hasOwn(r,a)||(n=e(t,r,n,a,o))}),i.low=s,i.lim=n++,a?i.parent=a:delete i.parent,n}(e,{},1,t)}function m(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function v(e,t,r){var o=r.v,a=r.w;t.hasEdge(o,a)||(o=r.w,a=r.v);var s=e.node(o),i=e.node(a),d=s,l=!1;return s.lim>i.lim&&(d=i,l=!0),t.edges().filter(t=>l===y(e,e.node(t.v),d)&&l!==y(e,e.node(t.w),d)).reduce((e,r)=>n(t,r)<n(t,e)?r:e)}function x(e,t,r,n){var o,a,i,d,l=r.v,c=r.w;e.removeEdge(l,c),e.setEdge(n.v,n.w,{}),g(e),f(e,t),o=e,a=t,i=o.nodes().find(e=>!a.node(e).parent),(d=(d=s(o,i)).slice(1)).forEach(e=>{var t=o.node(e).parent,r=a.edge(e,t),n=!1;r||(r=a.edge(t,e),n=!0),a.node(e).rank=a.node(t).rank+(n?r.minlen:-r.minlen)})}function y(e,t,r){return r.low<=t.lim&&t.lim<=r.lim}t.exports=c,c.initLowLimValues=g,c.initCutValues=f,c.calcCutValue=p,c.leaveEdge=m,c.enterEdge=v,c.exchangeEdges=x}),p=o((e,t)=>{var r=u().longestPath,n=h(),o=f();t.exports=function(e){var t,s=e.graph().ranker;if(s instanceof Function)return s(e);switch(e.graph().ranker){case"network-simplex":default:o(e);break;case"tight-tree":r(t=e),n(t);break;case"longest-path":a(e);case"none":}};var a=r}),g=o((e,t)=>{t.exports=function(e){var t;let r,n,o=(r={},n=0,(t=e).children().forEach(function e(o){let a=n;t.children(o).forEach(e),r[o]={low:a,lim:n++}}),r);e.graph().dummyChains.forEach(t=>{let r=e.node(t),n=r.edgeObj,a=function(e,t,r,n){let o=[],a=[],s=Math.min(t[r].low,t[n].low),i=Math.max(t[r].lim,t[n].lim),d,l;d=r;do o.push(d=e.parent(d));while(d&&(t[d].low>s||i>t[d].lim))for(l=d,d=n;(d=e.parent(d))!==l;)a.push(d);return{path:o.concat(a.reverse()),lca:l}}(e,o,n.v,n.w),s=a.path,i=a.lca,d=0,l=s[0],c=!0;for(;t!==n.w;){if(r=e.node(t),c){for(;(l=s[d])!==i&&e.node(l).maxRank<r.rank;)d++;l===i&&(c=!1)}if(!c){for(;d<s.length-1&&e.node(l=s[d+1]).minRank<=r.rank;)d++;l=s[d]}e.setParent(t,l),t=e.successors(t)[0]}})}}),m=o((e,t)=>{var r=d();t.exports={run:function(e){var t,n,o;let a=r.addDummyNode(e,"root",{},"_root"),s=(n={},(t=e).children().forEach(e=>(function e(r,o){var a=t.children(r);a&&a.length&&a.forEach(t=>e(t,o+1)),n[r]=o})(e,1)),n),i=Object.values(s),d=r.applyWithChunking(Math.max,i)-1,l=2*d+1;e.graph().nestingRoot=a,e.edges().forEach(t=>e.edge(t).minlen*=l);let c=(o=e).edges().reduce((e,t)=>e+o.edge(t).weight,0)+1;e.children().forEach(t=>(function e(t,n,o,a,s,i,d){let l=t.children(d);if(!l.length){d!==n&&t.setEdge(n,d,{weight:0,minlen:o});return}let c=r.addBorderNode(t,"_bt"),u=r.addBorderNode(t,"_bb"),h=t.node(d);t.setParent(c,d),h.borderTop=c,t.setParent(u,d),h.borderBottom=u,l.forEach(r=>{e(t,n,o,a,s,i,r);let l=t.node(r),h=l.borderTop?l.borderTop:r,f=l.borderBottom?l.borderBottom:r,p=l.borderTop?a:2*a,g=h!==f?1:s-i[d]+1;t.setEdge(c,h,{weight:p,minlen:g,nestingEdge:!0}),t.setEdge(f,u,{weight:p,minlen:g,nestingEdge:!0})}),t.parent(d)||t.setEdge(n,c,{weight:0,minlen:s+i[d]})})(e,a,l,c,d,s,t)),e.graph().nodeRankFactor=l},cleanup:function(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}}}),v=o((e,t)=>{var r=d();function n(e,t,n,o,a,s){let i=a[t][s-1],d=r.addDummyNode(e,"border",{width:0,height:0,rank:s,borderType:t},n);a[t][s]=d,e.setParent(d,o),i&&e.setEdge(i,d,{weight:1})}t.exports=function(e){e.children().forEach(function t(r){let o=e.children(r),a=e.node(r);if(o.length&&o.forEach(t),Object.hasOwn(a,"minRank")){a.borderLeft=[],a.borderRight=[];for(let t=a.minRank,o=a.maxRank+1;t<o;++t)n(e,"borderLeft","_bl",r,a,t),n(e,"borderRight","_br",r,a,t)}})}}),x=o((e,t)=>{function r(e){e.nodes().forEach(t=>n(e.node(t))),e.edges().forEach(t=>n(e.edge(t)))}function n(e){let t=e.width;e.width=e.height,e.height=t}function o(e){e.y=-e.y}function a(e){let t=e.x;e.x=e.y,e.y=t}t.exports={adjust:function(e){let t=e.graph().rankdir.toLowerCase();("lr"===t||"rl"===t)&&r(e)},undo:function(e){var t,n;let s=e.graph().rankdir.toLowerCase();("bt"===s||"rl"===s)&&((t=e).nodes().forEach(e=>o(t.node(e))),t.edges().forEach(e=>{let r=t.edge(e);r.points.forEach(o),Object.hasOwn(r,"y")&&o(r)})),("lr"===s||"rl"===s)&&((n=e).nodes().forEach(e=>a(n.node(e))),n.edges().forEach(e=>{let t=n.edge(e);t.points.forEach(a),Object.hasOwn(t,"x")&&a(t)}),r(e))}}}),y=o((e,t)=>{var r=d();t.exports=function(e){let t={},n=e.nodes().filter(t=>!e.children(t).length),o=n.map(t=>e.node(t).rank),a=r.applyWithChunking(Math.max,o),s=r.range(a+1).map(()=>[]);return n.sort((t,r)=>e.node(t).rank-e.node(r).rank).forEach(function r(n){t[n]||(t[n]=!0,s[e.node(n).rank].push(n),e.successors(n).forEach(r))}),s}}),b=o((e,t)=>{var r=d().zipObject;t.exports=function(e,t){let n=0;for(let o=1;o<t.length;++o)n+=function(e,t,n){let o=r(n,n.map((e,t)=>t)),a=t.flatMap(t=>e.outEdges(t).map(t=>({pos:o[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos)),s=1;for(;s<n.length;)s<<=1;let i=2*s-1;s-=1;let d=Array(i).fill(0),l=0;return a.forEach(e=>{let t=e.pos+s;d[t]+=e.weight;let r=0;for(;t>0;)t%2&&(r+=d[t+1]),t=t-1>>1,d[t]+=e.weight;l+=e.weight*r}),l}(e,t[o-1],t[o]);return n}}),w=o((e,t)=>{t.exports=function(e,t=[]){return t.map(t=>{let r=e.inEdges(t);if(!r.length)return{v:t};{let n=r.reduce((t,r)=>{let n=e.edge(r),o=e.node(r.v);return{sum:t.sum+n.weight*o.order,weight:t.weight+n.weight}},{sum:0,weight:0});return{v:t,barycenter:n.sum/n.weight,weight:n.weight}}})}}),E=o((e,t)=>{var r=d();t.exports=function(e,t){let n={};return e.forEach((e,t)=>{let r=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};void 0!==e.barycenter&&(r.barycenter=e.barycenter,r.weight=e.weight)}),t.edges().forEach(e=>{let t=n[e.v],r=n[e.w];void 0!==t&&void 0!==r&&(r.indegree++,t.out.push(n[e.w]))}),function(e){let t=[];for(;e.length;){let r=e.pop();t.push(r),r.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 r=0,n=0;e.weight&&(r+=e.barycenter*e.weight,n+=e.weight),t.weight&&(r+=t.barycenter*t.weight,n+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=r/n,e.weight=n,e.i=Math.min(t.i,e.i),t.merged=!0}(e,t)}}(r)),r.out.forEach(function(t){return r=>{r.in.push(t),0==--r.indegree&&e.push(r)}}(r))}return t.filter(e=>!e.merged).map(e=>r.pick(e,["vs","i","barycenter","weight"]))}(Object.values(n).filter(e=>!e.indegree))}}),k=o((e,t)=>{var r=d();function n(e,t,r){let n;for(;t.length&&(n=t[t.length-1]).i<=r;)t.pop(),e.push(n.vs),r++;return r}t.exports=function(e,t){var o;let a=r.partition(e,e=>Object.hasOwn(e,"barycenter")),s=a.lhs,i=a.rhs.sort((e,t)=>t.i-e.i),d=[],l=0,c=0,u=0;s.sort((o=!!t,(e,t)=>e.barycenter<t.barycenter?-1:e.barycenter>t.barycenter?1:o?t.i-e.i:e.i-t.i)),u=n(d,i,u),s.forEach(e=>{u+=e.vs.length,d.push(e.vs),l+=e.barycenter*e.weight,c+=e.weight,u=n(d,i,u)});let h={vs:d.flat(!0)};return c&&(h.barycenter=l/c,h.weight=c),h}}),j=o((e,t)=>{var r=w(),n=E(),o=k();t.exports=function e(t,a,s,i){var d,l;let c=t.children(a),u=t.node(a),h=u?u.borderLeft:void 0,f=u?u.borderRight:void 0,p={};h&&(c=c.filter(e=>e!==h&&e!==f));let g=r(t,c);g.forEach(r=>{if(t.children(r.v).length){var n,o;let a=e(t,r.v,s,i);p[r.v]=a,Object.hasOwn(a,"barycenter")&&(n=r,o=a,void 0!==n.barycenter?(n.barycenter=(n.barycenter*n.weight+o.barycenter*o.weight)/(n.weight+o.weight),n.weight+=o.weight):(n.barycenter=o.barycenter,n.weight=o.weight))}});let m=n(g,s);d=m,l=p,d.forEach(e=>{e.vs=e.vs.flatMap(e=>l[e]?l[e].vs:e)});let v=o(m,i);if(h&&(v.vs=[h,v.vs,f].flat(!0),t.predecessors(h).length)){let e=t.node(t.predecessors(h)[0]),r=t.node(t.predecessors(f)[0]);Object.hasOwn(v,"barycenter")||(v.barycenter=0,v.weight=0),v.barycenter=(v.barycenter*v.weight+e.order+r.order)/(v.weight+2),v.weight+=2}return v}}),N=o((e,t)=>{var r=a().Graph,n=d();t.exports=function(e,t,o,a){a||(a=e.nodes());let s=function(e){for(var t;e.hasNode(t=n.uniqueId("_root")););return t}(e),i=new r({compound:!0}).setGraph({root:s}).setDefaultNodeLabel(t=>e.node(t));return a.forEach(r=>{let n=e.node(r),a=e.parent(r);(n.rank===t||n.minRank<=t&&t<=n.maxRank)&&(i.setNode(r),i.setParent(r,a||s),e[o](r).forEach(t=>{let n=t.v===r?t.w:t.v,o=i.edge(n,r),a=void 0!==o?o.weight:0;i.setEdge(n,r,{weight:e.edge(t).weight+a})}),Object.hasOwn(n,"minRank")&&i.setNode(r,{borderLeft:n.borderLeft[t],borderRight:n.borderRight[t]}))}),i}}),C=o((e,t)=>{t.exports=function(e,t,r){let n={},o;r.forEach(r=>{let a=e.parent(r),s,i;for(;a;){if((s=e.parent(a))?(i=n[s],n[s]=a):(i=o,o=a),i&&i!==a)return void t.setEdge(i,a);a=s}})}}),_=o((e,t)=>{var r=y(),n=b(),o=j(),s=N(),i=C(),l=a().Graph,c=d();function u(e,t,r){let n=new Map,o=(e,t)=>{n.has(e)||n.set(e,[]),n.get(e).push(t)};for(let t of e.nodes()){let r=e.node(t);if("number"==typeof r.rank&&o(r.rank,t),"number"==typeof r.minRank&&"number"==typeof r.maxRank)for(let e=r.minRank;e<=r.maxRank;e++)e!==r.rank&&o(e,t)}return t.map(function(t){return s(e,t,r,n.get(t)||[])})}function h(e,t){Object.values(t).forEach(t=>t.forEach((t,r)=>e.node(t).order=r))}t.exports=function e(t,a={}){if("function"==typeof a.customOrder)return void a.customOrder(t,e);let s=c.maxRank(t),d=u(t,c.range(1,s+1),"inEdges"),f=u(t,c.range(s-1,-1,-1),"outEdges"),p=r(t);if(h(t,p),a.disableOptimalOrderHeuristic)return;let g=1/0,m,v=a.constraints||[];for(let e=0,r=0;r<4;++e,++r){(function(e,t,r){let n=new l;e.forEach(function(e){r.forEach(e=>n.setEdge(e.left,e.right));let a=e.graph().root,s=o(e,a,n,t);s.vs.forEach((t,r)=>e.node(t).order=r),i(e,n,s.vs)})})(e%2?d:f,e%4>=2,v),p=c.buildLayerMatrix(t);let a=n(t,p);a<g?(r=0,m=Object.assign({},p),g=a):a===g&&(m=structuredClone(p))}h(t,m)}}),O=o((e,t)=>{var r=a().Graph,n=d();function o(e,t){let r={};return t.length&&t.reduce(function(t,n){let o=0,a=0,s=t.length,d=n[n.length-1];return n.forEach((t,l)=>{let c=function(e,t){if(e.node(t).dummy)return e.predecessors(t).find(t=>e.node(t).dummy)}(e,t),u=c?e.node(c).order:s;(c||t===d)&&(n.slice(a,l+1).forEach(t=>{e.predecessors(t).forEach(n=>{let a=e.node(n),s=a.order;(s<o||u<s)&&!(a.dummy&&e.node(t).dummy)&&i(r,n,t)})}),a=l+1,o=u)}),n}),r}function s(e,t){let r={};function o(t,o,a,s,d){let l;n.range(o,a).forEach(n=>{l=t[n],e.node(l).dummy&&e.predecessors(l).forEach(t=>{let n=e.node(t);n.dummy&&(n.order<s||n.order>d)&&i(r,t,l)})})}return t.length&&t.reduce(function(t,r){let n=-1,a,s=0;return r.forEach((i,d)=>{if("border"===e.node(i).dummy){let t=e.predecessors(i);t.length&&(a=e.node(t[0]).order,o(r,s,d,n,a),s=d,n=a)}o(r,s,r.length,a,t.length)}),r}),r}function i(e,t,r){if(t>r){let e=t;t=r,r=e}let n=e[t];n||(e[t]=n={}),n[r]=!0}function l(e,t,r){if(t>r){let e=t;t=r,r=e}return!!e[t]&&Object.hasOwn(e[t],r)}function c(e,t,r,n){let o={},a={},s={};return t.forEach(e=>{e.forEach((e,t)=>{o[e]=e,a[e]=e,s[e]=t})}),t.forEach(e=>{let t=-1;e.forEach(e=>{let i=n(e);if(i.length){let n=((i=i.sort((e,t)=>s[e]-s[t])).length-1)/2;for(let d=Math.floor(n),c=Math.ceil(n);d<=c;++d){let n=i[d];a[e]===e&&t<s[n]&&!l(r,e,n)&&(a[n]=e,a[e]=o[e]=o[n],t=s[n])}}})}),{root:o,align:a}}function u(e,t,n,o,a){var s,i,d,l,c,u,h;let f,p,g,m={},v=(s=e,i=t,d=n,l=a,f=new r,g=(c=(p=s.graph()).nodesep,u=p.edgesep,h=l,(e,t,r)=>{let n=e.node(t),o=e.node(r),a,s;if(a=0+n.width/2,Object.hasOwn(n,"labelpos"))switch(n.labelpos.toLowerCase()){case"l":s=-n.width/2;break;case"r":s=n.width/2}if(s&&(a+=h?s:-s),s=0,a+=(n.dummy?u:c)/2,a+=(o.dummy?u:c)/2,a+=o.width/2,Object.hasOwn(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":s=o.width/2;break;case"r":s=-o.width/2}return s&&(a+=h?s:-s),s=0,a}),i.forEach(e=>{let t;e.forEach(e=>{let r=d[e];if(f.setNode(r),t){var n=d[t],o=f.edge(n,r);f.setEdge(n,r,Math.max(g(s,e,t),o||0))}t=e})}),f),x=a?"borderLeft":"borderRight";function y(e,t){let r=v.nodes().slice(),n={},o=r.pop();for(;o;){if(n[o])e(o);else for(let e of(n[o]=!0,r.push(o),t(o)))r.push(e);o=r.pop()}}return y(function(e){m[e]=v.inEdges(e).reduce((e,t)=>Math.max(e,m[t.v]+v.edge(t)),0)},v.predecessors.bind(v)),y(function(t){let r=v.outEdges(t).reduce((e,t)=>Math.min(e,m[t.w]-v.edge(t)),1/0),n=e.node(t);r!==1/0&&n.borderType!==x&&(m[t]=Math.max(m[t],r))},v.successors.bind(v)),Object.keys(o).forEach(e=>m[e]=m[n[e]]),m}function h(e,t){return Object.values(t).reduce((t,r)=>{let n=-1/0,o=1/0;Object.entries(r).forEach(([t,r])=>{var a,s;let i=(a=e,s=t,a.node(s).width/2);n=Math.max(r+i,n),o=Math.min(r-i,o)});let a=n-o;return a<t[0]&&(t=[a,r]),t},[1/0,null])[1]}function f(e,t){let r=Object.values(t),o=n.applyWithChunking(Math.min,r),a=n.applyWithChunking(Math.max,r);["u","d"].forEach(r=>{["l","r"].forEach(s=>{let i=r+s,d=e[i];if(d===t)return;let l=Object.values(d),c=o-n.applyWithChunking(Math.min,l);"l"!==s&&(c=a-n.applyWithChunking(Math.max,l)),c&&(e[i]=n.mapValues(d,e=>e+c))})})}function p(e,t){return n.mapValues(e.ul,(r,n)=>{if(t)return e[t.toLowerCase()][n];{let t=Object.values(e).map(e=>e[n]).sort((e,t)=>e-t);return(t[1]+t[2])/2}})}t.exports={positionX:function(e){let t=n.buildLayerMatrix(e),r=Object.assign(o(e,t),s(e,t)),a={},i;["u","d"].forEach(o=>{i="u"===o?t:Object.values(t).reverse(),["l","r"].forEach(t=>{"r"===t&&(i=i.map(e=>Object.values(e).reverse()));let s=("u"===o?e.predecessors:e.successors).bind(e),d=c(e,i,r,s),l=u(e,i,d.root,d.align,"r"===t);"r"===t&&(l=n.mapValues(l,e=>-e)),a[o+t]=l})});let d=h(e,a);return f(a,d),p(a,e.graph().align)},findType1Conflicts:o,findType2Conflicts:s,addConflict:i,hasConflict:l,verticalAlignment:c,horizontalCompaction:u,alignCoordinates:f,findSmallestWidthAlignment:h,balance:p}}),R=o((e,t)=>{var r=d(),n=O().positionX;t.exports=function(e){var t;let o,a,s,i;t=e=r.asNonCompoundGraph(e),o=r.buildLayerMatrix(t),a=t.graph().ranksep,s=t.graph().rankalign,i=0,o.forEach(e=>{let r=e.reduce((e,r)=>{let n=t.node(r).height;return e>n?e:n},0);e.forEach(e=>{let n=t.node(e);"top"===s?n.y=i+n.height/2:"bottom"===s?n.y=i+r-n.height/2:n.y=i+r/2}),i+=r+a}),Object.entries(n(e)).forEach(([t,r])=>e.node(t).x=r)}}),M=o((e,t)=>{var r=l(),n=c(),o=p(),s=d().normalizeRanks,i=g(),u=d().removeEmptyRanks,h=m(),f=v(),y=x(),b=_(),w=R(),E=d(),k=a().Graph;t.exports=function(e,t={}){let a=t.debugTiming?E.time:E.notime;return a("layout",()=>{let d=a(" buildLayoutGraph",()=>{var t;let r,n;return t=e,r=new k({multigraph:!0,compound:!0}),n=F(t.graph()),r.setGraph(Object.assign({},N,L(n,j),E.pick(n,C))),t.nodes().forEach(e=>{let n=L(F(t.node(e)),O);Object.keys(M).forEach(e=>{void 0===n[e]&&(n[e]=M[e])}),r.setNode(e,n),r.setParent(e,t.parent(e))}),t.edges().forEach(e=>{let n=F(t.edge(e));r.setEdge(e,Object.assign({},P,L(n,S),E.pick(n,T)))}),r});return a(" runLayout",()=>{var e,l,c;return e=d,l=a,c=t,void(l(" makeSpaceForEdgeLabels",()=>{var t;let r;return r=(t=e).graph(),void(r.ranksep/=2,t.edges().forEach(e=>{let n=t.edge(e);n.minlen*=2,"c"!==n.labelpos.toLowerCase()&&("TB"===r.rankdir||"BT"===r.rankdir?n.width+=n.labeloffset:n.height+=n.labeloffset)}))}),l(" removeSelfEdges",()=>{var t;(t=e).edges().forEach(e=>{if(e.v===e.w){var r=t.node(e.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:e,label:t.edge(e)}),t.removeEdge(e)}})}),l(" acyclic",()=>r.run(e)),l(" nestingGraph.run",()=>h.run(e)),l(" rank",()=>o(E.asNonCompoundGraph(e))),l(" injectEdgeLabelProxies",()=>{var t;(t=e).edges().forEach(e=>{let r=t.edge(e);if(r.width&&r.height){let r=t.node(e.v),n={rank:(t.node(e.w).rank-r.rank)/2+r.rank,e:e};E.addDummyNode(t,"edge-proxy",n,"_ep")}})}),l(" removeEmptyRanks",()=>u(e)),l(" nestingGraph.cleanup",()=>h.cleanup(e)),l(" normalizeRanks",()=>s(e)),l(" assignRankMinMax",()=>{var t;let r;return r=0,void((t=e).nodes().forEach(e=>{let n=t.node(e);n.borderTop&&(n.minRank=t.node(n.borderTop).rank,n.maxRank=t.node(n.borderBottom).rank,r=Math.max(r,n.maxRank))}),t.graph().maxRank=r)}),l(" removeEdgeLabelProxies",()=>{var t;(t=e).nodes().forEach(e=>{let r=t.node(e);"edge-proxy"===r.dummy&&(t.edge(r.e).labelRank=r.rank,t.removeNode(e))})}),l(" normalize.run",()=>n.run(e)),l(" parentDummyChains",()=>i(e)),l(" addBorderSegments",()=>f(e)),l(" order",()=>b(e,c)),l(" insertSelfEdges",()=>{var t;return t=e,void E.buildLayerMatrix(t).forEach(e=>{var r=0;e.forEach((e,n)=>{var o=t.node(e);o.order=n+r,(o.selfEdges||[]).forEach(e=>{E.addDummyNode(t,"selfedge",{width:e.label.width,height:e.label.height,rank:o.rank,order:n+ ++r,e:e.e,label:e.label},"_se")}),delete o.selfEdges})})}),l(" adjustCoordinateSystem",()=>y.adjust(e)),l(" position",()=>w(e)),l(" positionSelfEdges",()=>{var t;(t=e).nodes().forEach(e=>{var r=t.node(e);if("selfedge"===r.dummy){var n=t.node(r.e.v),o=n.x+n.width/2,a=n.y,s=r.x-o,i=n.height/2;t.setEdge(r.e,r.label),t.removeNode(e),r.label.points=[{x:o+2*s/3,y:a-i},{x:o+5*s/6,y:a-i},{x:o+s,y:a},{x:o+5*s/6,y:a+i},{x:o+2*s/3,y:a+i}],r.label.x=r.x,r.label.y=r.y}})}),l(" removeBorderNodes",()=>{var t;(t=e).nodes().forEach(e=>{if(t.children(e).length){let r=t.node(e),n=t.node(r.borderTop),o=t.node(r.borderBottom),a=t.node(r.borderLeft[r.borderLeft.length-1]),s=t.node(r.borderRight[r.borderRight.length-1]);r.width=Math.abs(s.x-a.x),r.height=Math.abs(o.y-n.y),r.x=a.x+r.width/2,r.y=n.y+r.height/2}}),t.nodes().forEach(e=>{"border"===t.node(e).dummy&&t.removeNode(e)})}),l(" normalize.undo",()=>n.undo(e)),l(" fixupEdgeLabelCoords",()=>{var t;(t=e).edges().forEach(e=>{let r=t.edge(e);if(Object.hasOwn(r,"x"))switch(("l"===r.labelpos||"r"===r.labelpos)&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset}})}),l(" undoCoordinateSystem",()=>y.undo(e)),l(" translateGraph",()=>(function(e){let t=1/0,r=0,n=1/0,o=0,a=e.graph(),s=a.marginx||0,i=a.marginy||0;function d(e){let a=e.x,s=e.y,i=e.width,d=e.height;t=Math.min(t,a-i/2),r=Math.max(r,a+i/2),n=Math.min(n,s-d/2),o=Math.max(o,s+d/2)}e.nodes().forEach(t=>d(e.node(t))),e.edges().forEach(t=>{let r=e.edge(t);Object.hasOwn(r,"x")&&d(r)}),t-=s,n-=i,e.nodes().forEach(r=>{let o=e.node(r);o.x-=t,o.y-=n}),e.edges().forEach(r=>{let o=e.edge(r);o.points.forEach(e=>{e.x-=t,e.y-=n}),Object.hasOwn(o,"x")&&(o.x-=t),Object.hasOwn(o,"y")&&(o.y-=n)}),a.width=r-t+s,a.height=o-n+i})(e)),l(" assignNodeIntersects",()=>{var t;(t=e).edges().forEach(e=>{let r=t.edge(e),n=t.node(e.v),o=t.node(e.w),a,s;r.points?(a=r.points[0],s=r.points[r.points.length-1]):(r.points=[],a=o,s=n),r.points.unshift(E.intersectRect(n,a)),r.points.push(E.intersectRect(o,s))})}),l(" reversePoints",()=>{var t;(t=e).edges().forEach(e=>{let r=t.edge(e);r.reversed&&r.points.reverse()})}),l(" acyclic.undo",()=>r.undo(e)))}),a(" updateInputGraph",()=>{var t,r;return t=e,r=d,void(t.nodes().forEach(e=>{let n=t.node(e),o=r.node(e);n&&(n.x=o.x,n.y=o.y,n.order=o.order,n.rank=o.rank,r.children(e).length&&(n.width=o.width,n.height=o.height))}),t.edges().forEach(e=>{let n=t.edge(e),o=r.edge(e);n.points=o.points,Object.hasOwn(o,"x")&&(n.x=o.x,n.y=o.y)}),t.graph().width=r.graph().width,t.graph().height=r.graph().height)}),d})};var j=["nodesep","edgesep","ranksep","marginx","marginy"],N={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb",rankalign:"center"},C=["acyclicer","ranker","rankdir","align","rankalign"],O=["width","height","rank"],M={width:0,height:0},S=["minlen","weight","width","height","labeloffset"],P={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},T=["labelpos"];function L(e,t){return E.mapValues(E.pick(e,t),Number)}function F(e){var t={};return e&&Object.entries(e).forEach(([e,r])=>{"string"==typeof e&&(e=e.toLowerCase()),t[e]=r}),t}}),S=o((e,t)=>{var r=d(),n=a().Graph;t.exports={debugOrdering:function(e){let t=r.buildLayerMatrix(e),o=new n({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(t=>{o.setNode(t,{label:t}),o.setParent(t,"layer"+e.node(t).rank)}),e.edges().forEach(e=>o.setEdge(e.v,e.w,{},e.name)),t.forEach((e,t)=>{o.setNode("layer"+t,{rank:"same"}),e.reduce((e,t)=>(o.setEdge(e,t,{style:"invis"}),t))}),o}}}),P=o((e,t)=>{t.exports="2.0.4"});let T=o((e,t)=>{t.exports={graphlib:a(),layout:M(),debug:S(),util:{time:d().time,notime:d().notime},version:P()}})(),L={direction:"LR",ranksep:200,nodesep:15},F={featureNode:{width:288,height:140},repositoryNode:{width:328,height:50}};function A(e,t){let r=e.data;return r&&"number"==typeof r.width&&"number"==typeof r.height?{width:r.width,height:r.height}:F[e.type??""]??t}function D(e,t,r={}){let{direction:n="TB",nodeSize:o={width:172,height:36},ranksep:a=80,nodesep:s=30}=r;if(0===e.length)return{nodes:[],edges:[]};let i=new T.graphlib.Graph({multigraph:!0});i.setDefaultEdgeLabel(()=>({})),i.setGraph({rankdir:n,ranksep:a,nodesep:s});let d=new Set;for(let e of t)d.add(e.source),d.add(e.target);let l=e.filter(e=>d.has(e.id)),c=e.filter(e=>!d.has(e.id));for(let e of l){let t=A(e,o);i.setNode(e.id,{width:t.width,height:t.height})}for(let e of t)i.hasNode(e.source)&&i.hasNode(e.target)&&i.setEdge(e.source,e.target,{},e.id);T.layout(i);let{targetPosition:u,sourcePosition:h}=function(e){switch(e){case"LR":return{targetPosition:"left",sourcePosition:"right"};case"RL":return{targetPosition:"right",sourcePosition:"left"};case"BT":return{targetPosition:"bottom",sourcePosition:"top"};default:return{targetPosition:"top",sourcePosition:"bottom"}}}(n),f="LR"===n||"RL"===n,p=new Map;for(let e of l){let t=i.node(e.id),r=A(e,o);p.set(e.id,{cx:t.x,cy:t.y,w:r.width,h:r.height})}let g=0;for(let e of p.values()){g=f?e.cx:e.cy;break}for(let e of c){let t=A(e,o);p.set(e.id,{cx:f?g:0,cy:f?0:g,w:t.width,h:t.height})}let m=new Map;for(let e of t)p.has(e.source)&&p.has(e.target)&&(m.has(e.source)||m.set(e.source,[]),m.get(e.source).push(e.target));let v=new Map;for(let t=0;t<e.length;t++)v.set(e[t].id,t);for(let[,e]of m)e.sort((e,t)=>(v.get(e)??0)-(v.get(t)??0));let x=new Set;for(let e of m.values())for(let t of e)x.add(t);let y=[...[...d].filter(e=>p.has(e)&&!x.has(e)),...c.map(e=>e.id)];y.sort((e,t)=>(v.get(e)??0)-(v.get(t)??0));let b=new Map;for(let e of y)!function e(t){if(b.has(t))return b.get(t);let r=p.get(t),n=f?r.h:r.w,o=m.get(t);if(!o||0===o.length)return b.set(t,n),n;let a=0;for(let t of o)a+=e(t);let i=Math.max(n,a+=(o.length-1)*s);return b.set(t,i),i}(e);let w=0;for(let e of y){let t=b.get(e)??0;!function e(t,r){let n=p.get(t);f?n.cy=r:n.cx=r;let o=m.get(t);if(!o||0===o.length)return;let a=0;for(let e of o)a+=b.get(e)??0;let i=r-(a+=(o.length-1)*s)/2;for(let t of o){let r=b.get(t)??0;e(t,i+r/2),i+=r+s}}(e,w+t/2),w+=t+s}let E=[];for(let t of e){let e=p.get(t.id);e&&E.push({...t,targetPosition:u,sourcePosition:h,position:{x:e.cx-e.w/2,y:e.cy-e.h/2}})}return{nodes:E,edges:[...t]}}var I=e.i(21023);let $=(0,I.createServerReference)("70b0a8d6f61b02782dca23a6ab7079f719fe9c69c7",I.callServer,void 0,I.findSourceMapURL,"deleteFeature");var z=e.i(59007),B=e.i(9468),G=e.i(20067);let q=(0,I.createServerReference)("40250c284688351c1b62b8c7db49845ae164f1076d",I.callServer,void 0,I.findSourceMapURL,"deleteRepository"),W=(0,I.createServerReference)("40b0b73cdd791c25d66fa2c469d8dac4c84ac90e1e",I.callServer,void 0,I.findSourceMapURL,"getFeatureMetadata");var V=e.i(39443),U=e.i(8361),H=e.i(18354),X=e.i(99045);function J(e,t){let r=new Map;for(let e of t)"dependencyEdge"===e.type&&r.set(e.target,e.source);let n=new Map,o=new Map;for(let t of e)"featureNode"===t.type?n.set(t.id,{nodeId:t.id,data:t.data,parentNodeId:r.get(t.id)}):"repositoryNode"===t.type&&o.set(t.id,{nodeId:t.id,data:t.data});return{featureMap:n,repoMap:o}}function K(e,t){return(void 0===t.state||t.state===e.state)&&(void 0===t.lifecycle||t.lifecycle===e.lifecycle)&&(void 0===t.name||t.name===e.name)&&(void 0===t.description||t.description===e.description)}function Y(e,t){if(e.size!==t.size)return!1;for(let[r,n]of e){let e=t.get(r);if(!e||n.parentNodeId!==e.parentNodeId||n.data!==e.data&&JSON.stringify(n.data)!==JSON.stringify(e.data))return!1}return!0}let Q=(0,H.createLogger)("[Polling]"),Z=0,ee=0;function et(e,o){let a=(0,r.useRouter)(),s=(0,U.useSoundAction)("delete"),i=(0,U.useSoundAction)("create"),{nodes:d,edges:l,reconcile:c,updateFeature:u,addPendingFeature:h,removeFeature:f,restoreFeature:p,addRepository:g,removeRepository:m,replaceRepository:v,getFeatureRepositoryPath:x,getRepositoryData:y,getRepoMapSize:b,setCallbacks:w,beginMutation:E,endMutation:k,isMutating:j}=function(e,r){let n=(0,t.useMemo)(()=>J(e,r),[]),[o,a]=(0,t.useState)(n.featureMap),[s,i]=(0,t.useState)(n.repoMap),[d,l]=(0,t.useState)(new Map),c=(0,t.useRef)(new Map),u=(0,t.useRef)(new Set),h=(0,t.useRef)(0),f=(0,t.useRef)(new Set),p=(0,t.useRef)(new Set),g=(0,t.useRef)({}),m=(0,t.useMemo)(()=>({onNodeAction:e=>g.current.onNodeAction?.(e),onNodeSettings:e=>g.current.onNodeSettings?.(e),onFeatureDelete:e=>g.current.onFeatureDelete?.(e),onRepositoryAdd:e=>g.current.onRepositoryAdd?.(e),onRepositoryClick:e=>g.current.onRepositoryClick?.(e),onRepositoryDelete:e=>g.current.onRepositoryDelete?.(e),onRetryFeature:e=>g.current.onRetryFeature?.(e),onStartFeature:e=>g.current.onStartFeature?.(e)}),[]),v=(0,t.useRef)(o);v.current=o;let x=(0,t.useRef)(s);x.current=s;let y=(0,t.useMemo)(()=>(function(e,t,r,n){let o=[],a=[],s=e=>e.replace(/\\/g,"/"),i=new Map;for(let[e,r]of t)r.data.repositoryPath&&i.set(s(r.data.repositoryPath),e);let d=new Map;for(let[e,r]of[...t.entries()].sort((e,t)=>(e[1].data.createdAt??0)-(t[1].data.createdAt??0))){let t={...r.data,...n?.onRepositoryAdd&&{onAdd:()=>n.onRepositoryAdd(e)},...n?.onRepositoryClick&&{onClick:()=>n.onRepositoryClick(e)},...n?.onRepositoryDelete&&{onDelete:n.onRepositoryDelete}};o.push({id:e,type:"repositoryNode",position:{x:0,y:0},data:t})}for(let[t,l,c]of[...[...e.entries()].map(([e,t])=>[e,t,!1]),...[...r.entries()].filter(([t])=>!e.has(t)).map(([e,t])=>[e,t,!0])]){let e="creating"===l.data.state||c,r={...l.data,...!e&&n?.onNodeAction&&{onAction:()=>n.onNodeAction(t)},...!e&&n?.onNodeSettings&&{onSettings:()=>n.onNodeSettings(t)},...!e&&n?.onFeatureDelete&&{onDelete:n.onFeatureDelete},...!e&&"error"===l.data.state&&n?.onRetryFeature&&{onRetry:n.onRetryFeature},...!e&&"pending"===l.data.state&&n?.onStartFeature&&{onStart:n.onStartFeature}};if(o.push({id:t,type:"featureNode",position:{x:0,y:0},data:r}),l.parentNodeId)a.push({id:`dep-${l.parentNodeId}-${t}`,source:l.parentNodeId,target:t,type:"dependencyEdge"});else{let e=s(l.data.repositoryPath),r=i.get(e)??function(e){if(d.has(e))return d.get(e);let t=`virtual-repo-${e}`,r=e.split("/").filter(Boolean).at(-1)??e;return o.push({id:t,type:"repositoryNode",position:{x:0,y:0},data:{name:r,repositoryPath:e}}),d.set(e,t),t}(e);a.push({id:`edge-${r}-${t}`,source:r,target:t,style:{strokeDasharray:"5 5"}})}}let l=new Set;for(let e of a)"dependencyEdge"===e.type&&l.add(e.source);let c=a.length>0;for(let e of o){let t=e.data;t.showHandles=c,"featureNode"===e.type&&(t.hasChildren=l.has(e.id))}return{nodes:o,edges:a}})(o,s,d,m),[o,s,d,m]),b=(0,t.useRef)({key:"",positions:new Map}),{nodes:w,edges:E}=(0,t.useMemo)(()=>{let e=y.nodes.map(e=>e.id).sort().join(","),t=y.edges.map(e=>`${e.source}-${e.target}`).sort().join(","),r=`${e}|${t}`;if(r!==b.current.key){let e=D(y.nodes,y.edges,L),t=new Map;for(let r of e.nodes)t.set(r.id,{position:r.position,targetPosition:r.targetPosition,sourcePosition:r.sourcePosition});let n=b.current.positions;if(n.size>0){let r=0,o=0;for(let[e,a]of t){let t=n.get(e);if(t){r=t.position.x-a.position.x,o=t.position.y-a.position.y;break}}if(0!==r||0!==o){for(let e of t.values())e.position={x:e.position.x+r,y:e.position.y+o};for(let t of e.nodes)t.position={x:t.position.x+r,y:t.position.y+o}}}return b.current={key:r,positions:t},e}let{positions:n}=b.current;return{nodes:y.nodes.map(e=>{let t=n.get(e.id);return t?{...e,...t}:e}),edges:y.edges}},[y]),k=(0,t.useCallback)((e,t)=>{if(h.current>0)return;let{featureMap:r,repoMap:n}=J(e,t),o=new Set([...r.values()].map(e=>`${e.data.name}\0${e.data.repositoryPath}`));a(e=>{let t=[...e.entries()].filter(([,e])=>"creating"===e.data.state),n=new Map(r);for(let[e,r]of t){let t=`${r.data.name}\0${r.data.repositoryPath}`;o.has(t)||n.set(e,r)}let a=new Set;for(let[t,r]of e)"deleting"===r.data.state&&(n.has(t)?n.set(t,{...n.get(t),data:{...n.get(t).data,state:"deleting"}}):p.current.has(t)||(n.set(t,r),a.add(t)));for(let[e,t]of(p.current=a,c.current)){let r=n.get(e);r&&(n.set(e,{...r,data:{...r.data,...t}}),c.current.delete(e))}return Y(e,n)?e:n}),l(e=>{if(0===e.size)return e;let t=!1,r=new Map(e);for(let[n,a]of e){let e=`${a.data.name}\0${a.data.repositoryPath}`;o.has(e)&&(r.delete(n),t=!0)}return t?r:e}),i(e=>{let t=new Map(n),r=new Set([...n.values()].map(e=>e.data.repositoryPath));for(let[n,o]of e){if(t.has(n)||r.has(o.data.repositoryPath)){u.current.delete(n);continue}(n.startsWith("repo-temp-")||u.current.has(n))&&t.set(n,o)}return Y(e,t)?e:t})},[]),j=(0,t.useCallback)((e,t)=>{a(r=>{let n=r.get(e);if(!n)return c.current.set(e,{...c.current.get(e),...t}),r;if(c.current.delete(e),K(n.data,t))return r;let o=new Map(r);return o.set(e,{...n,data:{...n.data,...t}}),o}),l(r=>{let n=r.get(e);if(!n||K(n.data,t))return r;let o=new Map(r);return o.set(e,{...n,data:{...n.data,...t}}),o})},[]),N=(0,t.useCallback)((e,t,r)=>{l(n=>{let o=new Map(n);return o.set(e,{nodeId:e,data:t,parentNodeId:r}),o})},[]),C=(0,t.useCallback)(e=>{l(t=>{if(!t.has(e))return t;let r=new Map(t);return r.delete(e),r})},[]),_=(0,t.useCallback)(e=>{a(t=>{if(!t.has(e))return t;let r=new Map(t);return r.delete(e),r})},[]),O=(0,t.useCallback)((e,t)=>{a(r=>{let n=new Map(r);return n.set(e,t),n})},[]),R=(0,t.useCallback)((e,t)=>{u.current.add(e),i(r=>{let n=new Map(r);return n.set(e,{nodeId:e,data:t}),n})},[]),M=(0,t.useCallback)(e=>{u.current.delete(e),i(t=>{if(!t.has(e))return t;let r=new Map(t);return r.delete(e),r})},[]),S=(0,t.useCallback)((e,t,r)=>{u.current.delete(e),u.current.add(t),i(n=>{if(!n.has(e))return n;let o=new Map(n);return o.delete(e),o.set(t,{nodeId:t,data:r}),o})},[]),P=(0,t.useCallback)(e=>v.current.get(e)?.data.repositoryPath,[]),T=(0,t.useCallback)(e=>x.current.get(e)?.data,[]),F=(0,t.useCallback)(()=>x.current.size,[]),A=(0,t.useCallback)(e=>{g.current=e},[]),I=(0,t.useCallback)(()=>{h.current++},[]),$=(0,t.useCallback)((e=3e3)=>{let t=setTimeout(()=>{h.current=Math.max(0,h.current-1),f.current.delete(t)},e);f.current.add(t)},[]),z=(0,t.useCallback)(()=>h.current>0,[]);return(0,t.useEffect)(()=>{let e=f.current;return()=>{for(let t of e)clearTimeout(t);e.clear()}},[]),{nodes:w,edges:E,reconcile:k,updateFeature:j,addPendingFeature:N,removePendingFeature:C,removeFeature:_,restoreFeature:O,addRepository:R,removeRepository:M,replaceRepository:S,getFeatureRepositoryPath:P,getRepositoryData:T,getRepoMapSize:F,setCallbacks:A,beginMutation:I,endMutation:$,isMutating:z}}(e,o),N=(0,t.useRef)(d),C=(0,t.useRef)(l);(0,t.useEffect)(()=>{N.current=d,C.current=l},[d,l]);let _=(0,t.useMemo)(()=>e.map(e=>e.id).sort().join(","),[e]),O=(0,t.useMemo)(()=>e.filter(e=>"featureNode"===e.type).map(e=>{let t=e.data;return`${e.id}:${t.state}:${t.lifecycle}`}).sort().join(","),[e]),R=(0,t.useRef)("");(0,t.useEffect)(()=>{let t=`${_}|${O}`;t!==R.current&&(R.current=t,c(e,o))},[_,O,e,o,c]);let M=(0,t.useRef)(new Map),{events:S}=(0,V.useAgentEventsContext)();(0,t.useEffect)(()=>{let t=M.current;for(let r of e){if("featureNode"!==r.type)continue;let e=r.data,o=t.get(r.id);void 0!==o&&o!==e.state&&(S.some(t=>t.featureId===e.featureId&&(0,X.mapEventTypeToState)(t.eventType)===e.state)||("done"===e.state?n.toast.success(e.name,{description:"Feature completed!"}):"action-required"===e.state?n.toast.warning(e.name,{description:"Waiting for your approval",action:{label:"Review",onClick:()=>a.push(`/feature/${e.featureId}`)}}):"error"===e.state&&n.toast.error(e.name,{description:e.errorMessage??"Agent failed"}))),t.set(r.id,e.state)}},[O,e,S,a]);let P=(0,t.useRef)(0);(0,t.useEffect)(()=>{if(P.current>S.length&&(P.current=0),S.length<=P.current)return;let e=S.slice(P.current);for(let{featureId:t,state:r,lifecycle:n}of(P.current=S.length,(0,X.resolveSseEventUpdates)(e)))if(void 0!==r||void 0!==n){let e=`feat-${t}`,o=N.current.find(t=>t.id===e);if(o&&"deleting"===o.data.state)continue;u(e,{...void 0!==r&&{state:r},...void 0!==n&&{lifecycle:n}})}},[S,u]),(0,t.useEffect)(()=>{let e=e=>{let{featureId:t}=e.detail;u(`feat-${t}`,{state:"running"})};return window.addEventListener("shep:feature-approved",e),()=>window.removeEventListener("shep:feature-approved",e)},[u]);let T=(0,t.useRef)(new Set),F=(0,t.useRef)(0);(0,t.useEffect)(()=>{if(F.current>S.length&&(F.current=0),S.length<=F.current)return;let e=S.slice(F.current);for(let t of(F.current=S.length,e)){if("Feature metadata updated"!==t.message||T.current.has(t.featureId))continue;T.current.add(t.featureId);let e=`feat-${t.featureId}`;W(t.featureId).then(t=>{t&&u(e,{name:t.name,description:t.description})}).catch(()=>{})}},[S,u]),(0,t.useEffect)(()=>{Q.debug("polling enabled (3000ms interval)");let e=setInterval(async()=>{if(!j())try{let e=await fetch("/api/graph-data");if(!e.ok)throw Error(`status ${e.status}`);let{nodes:t,edges:r}=await e.json();c(t,r)}catch{Q.warn("poll fetch failed — will retry next interval")}},3e3);return()=>{Q.debug("polling disabled"),clearInterval(e)}},[c,j]);let A=(0,t.useCallback)(e=>{},[]),I=(0,t.useCallback)(e=>{},[]),H=(0,t.useCallback)((e,t,r)=>{let n=t?.featureId?`feat-${t.featureId}`:`feature-${Date.now()}-${Z++}`,o={name:t?.name??"New Feature",description:t?.description??"Describe what this feature does",featureId:t?.featureId??`#${n.slice(-4)}`,lifecycle:"requirements",state:t?.state??"running",progress:0,repositoryPath:t?.repositoryPath??"",branch:t?.branch??""};return h(n,o,"dependencyEdge"===r&&e?e:void 0),n},[h]),et=(0,t.useCallback)(e=>{let t=`feat-${e}`;E(),u(t,{state:"running"}),(0,z.resumeFeature)(e).then(e=>{e.error?(u(t,{state:"error"}),n.toast.error(e.error)):n.toast.success("Feature resumed")}).catch(()=>{u(t,{state:"error"}),n.toast.error("Failed to resume feature")}).finally(()=>k())},[u,E,k]),er=(0,t.useCallback)(e=>{let t=`feat-${e}`;E(),u(t,{state:"running"}),(0,B.startFeature)(e).then(e=>{e.error?(u(t,{state:"pending"}),n.toast.error(e.error)):n.toast.success("Feature started")}).catch(()=>{u(t,{state:"pending"}),n.toast.error("Failed to start feature")}).finally(()=>k())},[u,E,k]),en=(0,t.useCallback)((e,t,r)=>{let o=`feat-${e}`,i=[];if(!0===r){let e=[o];for(;e.length>0;){let t=e.shift();for(let r of C.current)"dependencyEdge"===r.type&&r.source===t&&(i.push(r.target),e.push(r.target))}}let d=new Map;for(let e of[o,...i]){let t=N.current.find(t=>t.id===e);t&&d.set(e,t.data.state)}for(let e of(E(),u(o,{state:"deleting"}),i))u(e,{state:"deleting"});s.play(),a.push("/"),$(e,t,r).then(e=>{if(e.error){for(let[e,t]of d)t&&u(e,{state:t});n.toast.error(e.error)}else for(let e of(f(o),i))f(e)}).catch(()=>{for(let[e,t]of d)t&&u(e,{state:t});n.toast.error("Failed to delete feature")}).finally(()=>k())},[a,s,u,f,E,k]),eo=(0,t.useCallback)(async e=>{let t=`repo-${e}`,r=new Set(C.current.filter(e=>e.source===t).map(e=>e.target)),o=y(t),a=new Map;for(let e of r){let t=N.current.find(t=>t.id===e);t&&a.set(e,{nodeId:e,data:t.data})}let i=()=>{for(let[e,r]of(o&&g(t,o),a))p(e,r)};for(let e of(E(),m(t),r))f(e);try{let t=await q(e);if(!t.success){n.toast.error(t.error??"Failed to remove repository"),i();return}s.play()}catch{n.toast.error("Failed to remove repository"),i()}finally{k()}},[s,m,f,g,p,y,E,k]),ea=(0,t.useCallback)(e=>{let t=D(N.current,C.current,{...L,direction:e});c(t.nodes,t.edges)},[c]);return{nodes:d,edges:l,onNodesChange:A,handleConnect:I,handleAddRepository:(0,t.useCallback)(e=>{let t=0===b(),r=`repo-temp-${++ee}`,o=e.replace(/[\\/]+$/,"").split(/[\\/]/).pop()??e;return E(),g(r,{name:o,repositoryPath:e,id:r,createdAt:Date.now()}),(0,G.addRepository)({path:e,name:o}).then(e=>{if(e.error){m(r),n.toast.error(e.error);return}let t=e.repository;v(r,`repo-${t.id}`,{name:t.name,repositoryPath:t.path,id:t.id,createdAt:t.createdAt instanceof Date?t.createdAt.getTime():Number(t.createdAt)}),i.play()}).catch(()=>{m(r),n.toast.error("Failed to add repository")}).finally(()=>k()),{wasEmpty:t,repoPath:e}},[g,m,v,i,b,E,k]),handleLayout:ea,handleDeleteFeature:en,handleRetryFeature:et,handleStartFeature:er,handleDeleteRepository:eo,createFeatureNode:H,getFeatureRepositoryPath:x,getRepositoryData:y,setCallbacks:w}}e.s(["useControlCenterState",()=>et],17840)},48246,e=>{"use strict";var t=e.i(20314),r=e.i(53271),n=e.i(79054),o=e.i(31406),a=e.i(3214),s=e.i(38227),i=e.i(31777),d=e.i(35364);e.i(54793);var l=e.i(7729);e.i(47506);var c=e.i(89313),u=e.i(92002),h=e.i(3645);let f=(0,h.default)("github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);var p=e.i(8986),g=e.i(38573),m=e.i(19933),v=e.i(67669),x=e.i(24042),y=e.i(64970);e.i(81803);var b=e.i(72714),w=e.i(2287),E=e.i(2828);e.i(99348);var k=e.i(17466),j=e.i(8537),N=e.i(75921),C=e.i(76852),_=e.i(80519);function O({data:e}){let s=(0,o.useRouter)(),l=(0,N.useFeatureFlags)(),[c,h]=(0,n.useState)(!1),O=(0,C.useRepositoryActions)(e.repositoryPath?{repositoryPath:e.repositoryPath}:null),R=(0,j.useDeployAction)(e.repositoryPath?{targetId:e.repositoryPath,targetType:"repository",repositoryPath:e.repositoryPath}:null),M="Booting"===R.status||"Ready"===R.status,S=(0,n.useCallback)((t,r)=>{if(!e.repositoryPath)return;let n=t.preview?t.preview.slice(0,200):"Unknown conversation",o=["Continue work from a previous agent session.","","## Session Context",`- Session ID: ${t.id}`,`- Messages: ${t.messageCount}`,t.lastMessageAt?`- Last active: ${t.lastMessageAt}`:"",`- Conversation file: ${r}`,"","## Session Preview",`> ${n}`,"","## Instructions","1. Read the full conversation history from the file above",`2. Analyze the current state of the repository — what was done, what remains`,"3. Create or update spec files to accurately reflect the current state and remaining work","4. Continue implementing any unfinished work from the conversation"].filter(Boolean).join("\n"),a=new URLSearchParams({repo:e.repositoryPath,prompt:o});s.push(`/create?${a.toString()}`)},[e.repositoryPath,s]);return(0,t.jsxs)("div",{className:(0,i.cn)("group relative",e.onDelete&&e.id&&"pl-10"),children:[e.showHandles?(0,t.jsx)(r.Handle,{type:"target",position:u.Position.Left,isConnectable:!1,className:"opacity-0!"}):null,e.onDelete&&e.id?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"absolute top-1/2 left-0 -translate-y-1/2 opacity-0 transition-opacity group-hover:opacity-100",children:(0,t.jsx)(E.TooltipProvider,{children:(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{"aria-label":"Remove repository","data-testid":"repository-node-delete-button",onClick:e=>{e.stopPropagation(),h(!0)},className:"bg-card text-muted-foreground hover:border-destructive hover:text-destructive flex h-7 w-7 cursor-pointer items-center justify-center rounded-full border shadow-sm transition-colors",children:(0,t.jsx)(v.Trash2,{className:"h-3.5 w-3.5"})})}),(0,t.jsx)(E.TooltipContent,{children:"Remove repository"})]})})}),(0,t.jsx)(w.Dialog,{open:c,onOpenChange:h,children:(0,t.jsxs)(w.DialogContent,{className:"max-w-xs",children:[(0,t.jsxs)(w.DialogHeader,{children:[(0,t.jsx)(w.DialogTitle,{children:"Remove repository?"}),(0,t.jsxs)(w.DialogDescription,{children:["This will remove ",(0,t.jsx)("strong",{children:e.name})," and all its features from your workspace. The repository files on disk won't be affected."]})]}),(0,t.jsxs)(w.DialogFooter,{className:"grid grid-cols-2 gap-2 sm:flex-none",children:[(0,t.jsx)(w.DialogClose,{asChild:!0,children:(0,t.jsx)(d.Button,{variant:"outline",children:"Cancel"})}),(0,t.jsx)(d.Button,{variant:"destructive",onClick:()=>{h(!1),e.onDelete?.(e.id)},children:"Remove"})]})]})})]}):null,(0,t.jsxs)("div",{role:"button",tabIndex:0,"data-testid":"repository-node-card","data-repo-name":e.name,onClick:t=>{t.stopPropagation(),e.onClick?.()},onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),t.stopPropagation(),e.onClick?.())},className:"nodrag bg-card flex min-w-[18rem] cursor-pointer items-center gap-3 rounded-full border px-4 py-3 shadow-sm",children:[(0,t.jsx)(f,{className:"text-muted-foreground h-5 w-5 shrink-0"}),(0,t.jsx)("span",{"data-testid":"repository-node-name",className:"min-w-0 truncate text-sm font-medium",children:e.name}),(0,t.jsxs)("div",{className:(0,i.cn)("flex shrink-0 items-center gap-2",(e.repositoryPath??e.onAdd)&&"ml-auto"),onClick:e=>e.stopPropagation(),children:[e.repositoryPath?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(E.TooltipProvider,{children:(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"flex items-center",children:(0,t.jsx)(b.ActionButton,{label:"Open in IDE",onClick:O.openInIde,loading:O.ideLoading,error:!!O.ideError,icon:p.Code2,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(E.TooltipContent,{children:"Open in IDE"})]})}),(0,t.jsx)(E.TooltipProvider,{children:(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"flex items-center",children:(0,t.jsx)(b.ActionButton,{label:"Open in Shell",onClick:O.openInShell,loading:O.shellLoading,error:!!O.shellError,icon:g.Terminal,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(E.TooltipContent,{children:"Open in Shell"})]})}),(0,t.jsx)(E.TooltipProvider,{children:(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"flex items-center",children:(0,t.jsx)(b.ActionButton,{label:"Open Folder",onClick:O.openFolder,loading:O.folderLoading,error:!!O.folderError,icon:m.FolderOpen,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(E.TooltipContent,{children:"Open Folder"})]})}),(0,t.jsx)(_.FeatureSessionsDropdown,{repositoryPath:e.repositoryPath,onCreateFromSession:S}),l.envDeploy?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(E.TooltipProvider,{children:(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"flex items-center",children:(0,t.jsx)(b.ActionButton,{label:M?"Stop Dev Server":"Start Dev Server",onClick:M?R.stop:R.deploy,loading:R.deployLoading||R.stopLoading,error:!!R.deployError,icon:M?y.Square:x.Play,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(E.TooltipContent,{children:M?"Stop Dev Server":"Start Dev Server"})]})}),M?(0,t.jsx)(k.DeploymentStatusBadge,{status:R.status,url:R.url,targetId:e.repositoryPath}):null]}):null]}):null,e.onAdd?(0,t.jsx)(E.TooltipProvider,{children:(0,t.jsxs)(E.Tooltip,{children:[(0,t.jsx)(E.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{"aria-label":"Add feature","data-testid":"repository-node-add-button",onClick:t=>{t.stopPropagation(),e.onAdd?.()},className:(0,i.cn)("text-muted-foreground hover:bg-accent dark:hover:bg-accent/50 flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center rounded-full transition-colors hover:text-blue-500",e.pulseAdd&&"animate-pulse-cta bg-blue-100 text-blue-500 dark:bg-blue-900/40"),children:(0,t.jsx)(a.Plus,{className:"h-3.5 w-3.5"})})}),(0,t.jsx)(E.TooltipContent,{children:"Add feature"})]})}):null]})]}),e.onAdd||e.showHandles?(0,t.jsx)(r.Handle,{type:"source",position:u.Position.Right,isConnectable:!e.showHandles,className:"opacity-0!"}):null]})}function R(e){let[n]=(0,u.getBezierPath)({sourceX:e.sourceX,sourceY:e.sourceY,targetX:e.targetX,targetY:e.targetY,sourcePosition:e.sourcePosition,targetPosition:e.targetPosition});return(0,t.jsx)(r.BaseEdge,{id:e.id,path:n,style:{strokeDasharray:"5 5"}})}e.i(1650),e.i(45811),e.i(25235);let M={x:30,y:30,zoom:.85};function S({onResetViewport:e}){let{setViewport:o}=(0,r.useReactFlow)(),a=(0,n.useCallback)(()=>{o(e(),{duration:400})},[e,o]);return(0,t.jsx)(r.ControlButton,{onClick:a,title:"Reset view","aria-label":"Reset view",children:(0,t.jsx)(s.RotateCcw,{style:{fill:"none"}})})}function P({nodes:e,edges:o,selectedFeatureId:s,defaultViewport:u,onNodesChange:h,onAddFeature:f,onConnect:p,onNodeClick:g,onPaneClick:m,onCanvasDrag:v,onMoveEnd:x,onResetViewport:y,toolbar:b,emptyState:w}){let E=(0,n.useMemo)(()=>({featureNode:c.FeatureNode,repositoryNode:O}),[]),k=(0,n.useMemo)(()=>({dependencyEdge:R}),[]),j=(0,n.useMemo)(()=>null==s?e:e.map(e=>"featureNode"===e.type&&e.data.featureId===s?{...e,selected:!0}:e),[e,s]),N=0===e.length,[C,_]=(0,n.useState)(N),[P,T]=(0,n.useState)(!1),L=(0,n.useRef)(N);(0,n.useEffect)(()=>{if(L.current&&!N){T(!0);let e=setTimeout(()=>{_(!1),T(!1)},300);return L.current=N,()=>clearTimeout(e)}!L.current&&N&&_(!0),L.current=N},[N]);let F=N&&!w?(0,t.jsx)(l.EmptyState,{title:"No features yet",description:"Get started by creating your first feature.",action:(0,t.jsxs)(d.Button,{onClick:f,children:[(0,t.jsx)(a.Plus,{className:"mr-2 h-4 w-4"}),"New Feature"]})}):null,A=w??F;return(0,t.jsxs)("div",{"data-testid":N?"features-canvas-empty":"features-canvas","data-no-drawer-close":!0,className:"dark:bg-background pointer-events-auto relative h-full w-full bg-[#f6f7f8]",children:[(0,t.jsxs)(r.ReactFlow,{nodes:j,edges:o,nodeTypes:E,edgeTypes:k,onConnect:p,onNodesChange:h,onNodeClick:g,onPaneClick:m,onMoveStart:v,onMoveEnd:x,defaultViewport:u??M,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,proOptions:{hideAttribution:!0},children:[(0,t.jsx)(r.Background,{variant:r.BackgroundVariant.Dots,gap:24,size:1,color:"#b8bcc4",className:"dark:[&_circle]:!fill-white/[0.1]"}),!N&&(0,t.jsx)(r.Controls,{showInteractive:!1,children:y?(0,t.jsx)(S,{onResetViewport:y}):null}),b]}),C&&A?(0,t.jsx)("div",{className:(0,i.cn)("pointer-events-none absolute inset-0 z-10 flex items-center justify-center transition-opacity duration-300",P?"opacity-0":"animate-in fade-in opacity-100 duration-200"),children:(0,t.jsx)("div",{className:"pointer-events-auto",children:A})}):null]})}var T=e.i(5147),L=e.i(8361),F=e.i(30153);let A="shep-canvas-viewport",D={x:30,y:30,zoom:.85},I=(0,h.default)("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);var $=e.i(33548),z=e.i(23925),B=e.i(83428),G=e.i(35e3),q=e.i(79687),W=e.i(78521),V=e.i(21023);let U=(0,V.createServerReference)("004be45d392e890648b9bb2e56cf692901170845ff",V.callServer,void 0,V.findSourceMapURL,"isAgentSetupComplete"),H=(0,V.createServerReference)("000e58c5b71a03e449f1bf10d6b0ff5e0577145760",V.callServer,void 0,V.findSourceMapURL,"checkAgentAuth");var X=e.i(76016),J=e.i(11345),K=e.i(26370),Y=e.i(64231),Q=e.i(3468),Z=e.i(86782),ee=e.i(29847);let et=["select-agent","select-model"];function er({onComplete:e,className:r}){let o,[a,s]=(0,n.useState)([]),[d,l]=(0,n.useState)(!0),[c,u]=(0,n.useState)("select-agent"),[h,f]=(0,n.useState)(null),[p,g]=(0,n.useState)(!1),[m,v]=(0,n.useState)(!1),[x,y]=(0,n.useState)(!0),b=(0,n.useRef)(void 0);(0,n.useEffect)(()=>{(0,Y.getAllAgentModels)().then(s).finally(()=>l(!1))},[]);let w=h?a.find(e=>e.agentType===h):null,E=(0,n.useCallback)((e,t)=>{v(!0),y(!1),b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{t?.(),u(e),requestAnimationFrame(()=>{y(!0),v(!1)})},150)},[]);(0,n.useEffect)(()=>()=>{b.current&&clearTimeout(b.current)},[]);let k=(0,n.useCallback)(async(t,r)=>{g(!0);try{await (0,Q.updateAgentAndModel)(t,r),e()}finally{g(!1)}},[e]),j=(0,n.useCallback)(e=>{let t=a.find(t=>t.agentType===e);t&&t.models.length>0?E("select-model",()=>{f(e)}):k(e,null)},[a,E,k]),N=(0,n.useCallback)(e=>{h&&k(h,e)},[h,k]),C=(0,n.useCallback)(()=>{"select-model"===c&&E("select-agent",()=>{f(null)})},[c,E]);if(d)return(0,t.jsxs)("div",{"data-testid":"welcome-agent-setup",className:(0,i.cn)("flex flex-col items-center justify-center gap-3",r),children:[(0,t.jsx)(B.Loader2,{className:"text-muted-foreground h-4 w-4 animate-spin"}),(0,t.jsx)("p",{className:"text-muted-foreground text-xs",children:"Loading agents…"})]});let _=et.indexOf(c);return(0,t.jsxs)("div",{"data-testid":"welcome-agent-setup",className:(0,i.cn)("flex flex-col items-center gap-4","w-72",r),children:[(0,t.jsx)("div",{className:"flex flex-col items-center gap-1",children:(0,t.jsxs)("div",{className:"text-muted-foreground flex items-center gap-2",children:["select-agent"===c&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(K.Bot,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{className:"text-[10px] font-semibold tracking-widest uppercase",children:"Choose your agent"})]}),"select-model"===c&&w?(o=(0,Z.getAgentTypeIcon)(w.agentType),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o,{className:"h-3.5 w-3.5"}),(0,t.jsxs)("span",{className:"text-[10px] font-semibold tracking-widest uppercase",children:[w.label," — Pick a model"]})]})):null]})}),(0,t.jsx)("div",{className:"flex w-full items-center gap-1",children:et.map((e,r)=>(0,t.jsx)("div",{className:(0,i.cn)("h-0.5 flex-1 rounded-full transition-colors duration-300",r<=_?"bg-foreground/60":"bg-muted")},e))}),(0,t.jsxs)("div",{className:(0,i.cn)("flex w-full flex-col items-center transition-opacity duration-150",x&&!m?"opacity-100":"opacity-0"),children:["select-agent"===c&&(0,t.jsx)("div",{"data-testid":"agent-list",className:"flex w-full flex-col gap-1.5",children:a.map(e=>{let r=(0,Z.getAgentTypeIcon)(e.agentType);return(0,t.jsxs)("button",{type:"button",disabled:p,"data-testid":`agent-option-${e.agentType}`,className:"border-border hover:border-foreground/40 flex w-full cursor-pointer items-center gap-2.5 rounded-md border border-dashed px-4 py-2.5 transition-colors disabled:opacity-50",onClick:()=>j(e.agentType),children:[(0,t.jsx)(r,{className:"text-muted-foreground h-4 w-4 shrink-0"}),(0,t.jsx)("span",{className:"flex-1 text-left text-xs font-medium",children:e.label}),(0,t.jsx)(X.ChevronRight,{className:"text-muted-foreground h-3 w-3"})]},e.agentType)})}),"select-model"===c&&w?(0,t.jsxs)("div",{"data-testid":"model-list",className:"flex w-full flex-col gap-1.5",children:[(0,t.jsxs)("button",{type:"button",disabled:p,className:"text-muted-foreground hover:text-foreground mb-0.5 flex cursor-pointer items-center gap-1 self-start text-[10px] font-medium transition-colors",onClick:C,children:[(0,t.jsx)(J.ChevronLeft,{className:"h-3 w-3"}),"Back"]}),(0,t.jsx)("div",{className:"flex max-h-48 w-full flex-col gap-1.5 overflow-y-auto",children:w.models.map(e=>{let r=(0,ee.getModelMeta)(e.id);return(0,t.jsxs)("button",{type:"button",disabled:p,"data-testid":`model-option-${e.id}`,className:"border-border hover:border-foreground/40 flex w-full cursor-pointer items-center gap-2.5 rounded-md border border-dashed px-4 py-2.5 text-left transition-colors disabled:opacity-50",onClick:()=>N(e.id),children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[(0,t.jsx)("span",{className:"text-xs font-medium",children:r.displayName||e.displayName}),(0,t.jsx)("span",{className:"text-muted-foreground text-[10px] leading-tight",children:r.description||e.description})]}),(0,t.jsx)(X.ChevronRight,{className:"text-muted-foreground h-3 w-3 shrink-0"})]},e.id)})})]}):null]})]})}let en=["cd ~/my-repo",'shep feat new "sleek dashboard"'];function eo({onRepositorySelect:e,className:r}){let[o,s]=(0,n.useState)(!1),[d,l]=(0,n.useState)(!1),[c,u]=(0,n.useState)(null),[h,p]=(0,n.useState)(null);async function g(){if(!d){l(!0);try{let t=await (0,W.pickFolder)();t&&e?.(t)}finally{l(!1)}}}(0,n.useEffect)(()=>{U().then(e=>{u(e)})},[]),(0,n.useEffect)(()=>{c&&H().then(p)},[c]);let m=(0,n.useCallback)(async()=>{await navigator.clipboard.writeText(en.join("\n")),s(!0),setTimeout(()=>s(!1),2e3)},[]),v=(0,n.useCallback)(()=>{u(!0)},[]),x=(0,n.useCallback)(()=>{p(null),H().then(p)},[]);return null===c?null:(0,t.jsx)("div",{"data-testid":"control-center-empty-state",className:(0,i.cn)("flex flex-col items-center justify-center",r),children:(0,t.jsx)("div",{className:"animate-in fade-in slide-in-from-bottom-2 w-96 rounded-2xl border border-white/30 bg-white/50 px-8 py-8 shadow-lg backdrop-blur-xl duration-300 dark:border-white/10 dark:bg-white/5",children:(0,t.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,t.jsxs)("div",{className:"mb-2 text-center",children:[(0,t.jsx)("h1",{className:"text-xl font-bold tracking-tight",children:"Features"}),(0,t.jsx)("p",{className:"text-muted-foreground text-sm font-light",children:"Control Center"})]}),c?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ea,{status:h,onRetry:x}),(0,t.jsxs)("div",{className:"text-muted-foreground flex items-center gap-2",children:[(0,t.jsx)(f,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{className:"text-[10px] font-semibold tracking-widest uppercase",children:"Repositories"})]}),(0,t.jsxs)("button",{type:"button","data-testid":"empty-state-add-repository",onClick:g,disabled:d,className:"border-border hover:border-foreground/40 flex w-full cursor-pointer items-center gap-2.5 rounded-md border border-dashed px-4 py-2.5 transition-colors disabled:cursor-wait disabled:opacity-50",children:[d?(0,t.jsx)(B.Loader2,{className:"text-muted-foreground h-4 w-4 animate-spin"}):(0,t.jsx)(a.Plus,{className:"text-muted-foreground h-4 w-4"}),(0,t.jsx)("span",{className:"text-xs font-medium",children:d?"Opening…":"Add Repository"})]}),(0,t.jsxs)("div",{className:"text-muted-foreground flex items-center gap-2",children:[(0,t.jsx)("div",{className:"bg-border h-px w-10"}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)(I,{className:"h-3 w-3"}),(0,t.jsx)("span",{className:"text-[10px] font-semibold tracking-widest uppercase",children:"Or via CLI"})]}),(0,t.jsx)("div",{className:"bg-border h-px w-10"})]}),(0,t.jsxs)("div",{"data-testid":"cli-code-block",className:"relative w-full rounded-md bg-zinc-900 px-3 py-2 font-mono text-[11px] text-zinc-300",children:[(0,t.jsx)("button",{type:"button","data-testid":"cli-code-block-copy",onClick:m,className:"absolute top-2 right-2 cursor-pointer rounded p-1 text-zinc-500 transition-colors hover:bg-zinc-800 hover:text-zinc-300","aria-label":"Copy commands",children:o?(0,t.jsx)(z.Check,{className:"h-3 w-3"}):(0,t.jsx)($.Copy,{className:"h-3 w-3"})}),(0,t.jsx)("div",{className:"space-y-0.5",children:en.map(e=>(0,t.jsxs)("div",{className:"whitespace-nowrap",children:[(0,t.jsx)("span",{className:"text-zinc-500 select-none",children:"$ "}),(0,t.jsx)("span",{children:e})]},e))})]}),(0,t.jsx)("p",{className:"text-muted-foreground text-[10px]",children:"Feature will appear on canvas once created"})]}):(0,t.jsx)(er,{onComplete:v,className:"w-full"})]})})})}function ea({status:e,onRetry:r}){return e?e.installed&&e.authenticated?(0,t.jsxs)("div",{className:"animate-in fade-in flex w-full items-center gap-2 rounded-md bg-emerald-500/10 px-3 py-1.5",children:[(0,t.jsx)(G.CheckCircle2,{className:"h-3 w-3 text-emerald-600 dark:text-emerald-400"}),(0,t.jsxs)("span",{className:"text-[10px] text-emerald-700 dark:text-emerald-300",children:[e.label," ready"]})]}):e.installed?(0,t.jsxs)("div",{className:"flex w-full flex-col gap-2 rounded-md bg-amber-500/10 px-3 py-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(q.AlertCircle,{className:"h-3 w-3 text-amber-600 dark:text-amber-400"}),(0,t.jsxs)("span",{className:"text-[10px] font-medium text-amber-700 dark:text-amber-300",children:[e.label," needs authentication"]})]}),e.authCommand?(0,t.jsxs)("div",{className:"rounded bg-zinc-900 px-2 py-1 font-mono text-[10px] text-zinc-300",children:[(0,t.jsx)("span",{className:"text-zinc-500 select-none",children:"$ "}),e.authCommand]}):null,(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[e.binaryName?(0,t.jsxs)("button",{type:"button","data-testid":"auth-banner-open-terminal",onClick:async()=>{try{let t="claude-code"===e.agentType?"claude-code":e.agentType;await fetch(`/api/tools/${t}/launch`,{method:"POST"})}catch{}},className:"flex items-center gap-1 rounded border border-amber-600/30 px-2 py-0.5 text-[10px] font-medium text-amber-700 transition-colors hover:bg-amber-500/10 dark:text-amber-300",children:[(0,t.jsx)(g.Terminal,{className:"h-2.5 w-2.5"}),"Open ",e.label]}):null,(0,t.jsx)("button",{type:"button",onClick:r,className:"text-[10px] font-medium text-amber-700 underline underline-offset-2 hover:text-amber-900 dark:text-amber-300 dark:hover:text-amber-100",children:"Re-check"})]})]}):(0,t.jsxs)("div",{className:"flex w-full flex-col gap-2 rounded-md bg-amber-500/10 px-3 py-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(q.AlertCircle,{className:"h-3 w-3 text-amber-600 dark:text-amber-400"}),(0,t.jsxs)("span",{className:"text-[10px] font-medium text-amber-700 dark:text-amber-300",children:[e.label," not installed"]})]}),e.binaryName?(0,t.jsxs)("div",{className:"rounded bg-zinc-900 px-2 py-1 font-mono text-[10px] text-zinc-300",children:[(0,t.jsx)("span",{className:"text-zinc-500 select-none",children:"$ "}),"npm install -g ",e.binaryName]}):null,(0,t.jsx)("button",{type:"button",onClick:r,className:"self-start text-[10px] font-medium text-amber-700 underline underline-offset-2 hover:text-amber-900 dark:text-amber-300 dark:hover:text-amber-100",children:"Re-check"})]}):(0,t.jsxs)("div",{className:"bg-muted/50 flex w-full items-center gap-2 rounded-md px-3 py-1.5",children:[(0,t.jsx)(B.Loader2,{className:"text-muted-foreground h-3 w-3 animate-spin"}),(0,t.jsx)("span",{className:"text-muted-foreground text-[10px]",children:"Checking agent setup…"})]})}var es=e.i(17840);let ei={maxZoom:1,padding:.5,duration:500};function ed({initialNodes:e,initialEdges:a}){let s,i,d,l=(0,o.useRouter)(),c=(0,o.usePathname)(),u=(s=(0,o.usePathname)().match(/^\/feature\/([^/]+)/),s?.[1]??null),h=(0,L.useSoundAction)("click"),{guardedNavigate:f}=(0,F.useDrawerCloseGuard)(),{fitView:p}=(0,r.useReactFlow)(),g=(0,n.useRef)(null),{defaultViewport:m,onMoveEnd:v,resetViewport:x}=(i=(0,n.useRef)(function(){try{let e=localStorage.getItem(A);if(null==e)return D;let t=JSON.parse(e);return!(null==t||"object"!=typeof t||Array.isArray(t))&&"number"==typeof t.x&&"number"==typeof t.y&&"number"==typeof t.zoom&&Number.isFinite(t.x)&&Number.isFinite(t.y)&&Number.isFinite(t.zoom)&&t.zoom>0?t:D}catch{return D}}()).current,d=(0,n.useRef)(null),(0,n.useEffect)(()=>()=>{null!=d.current&&clearTimeout(d.current)},[]),{defaultViewport:i,onMoveEnd:(0,n.useCallback)(e=>{null!=d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{try{localStorage.setItem(A,JSON.stringify(e))}catch{}},500)},[]),resetViewport:(0,n.useCallback)(()=>{try{localStorage.removeItem(A)}catch{}return D},[])}),{nodes:y,edges:b,onNodesChange:w,handleConnect:E,handleAddRepository:k,handleDeleteFeature:j,handleRetryFeature:N,handleStartFeature:C,handleDeleteRepository:_,createFeatureNode:O,setCallbacks:R}=(0,es.useControlCenterState)(e,a),{setFeatures:M}=(0,T.useSidebarFeaturesContext)(),S=(0,n.useMemo)(()=>y.filter(e=>"featureNode"===e.type),[y]),I=(0,n.useMemo)(()=>S.map(e=>{let t=e.data;return`${t.featureId}:${t.state}:${t.name}`}).sort().join(","),[S]);(0,n.useEffect)(()=>{M(S.map(e=>{let t=e.data,r=(0,T.mapNodeStateToSidebarStatus)(t.state);return r?{featureId:t.featureId,name:t.name,status:r,...null!=t.startedAt&&{startedAt:t.startedAt},...null!=t.runtime&&{duration:t.runtime},...t.agentType&&{agentType:t.agentType},...t.modelId&&{modelId:t.modelId}}:null}).filter(Boolean))},[I,S,M]);let $=(0,n.useCallback)((e,t)=>{if("featureNode"===t.type){let r=t.data;"creating"!==r.state&&"deleting"!==r.state&&e.target.closest('[data-testid="feature-node-card"]')&&f(()=>{h.play(),l.push(`/feature/${r.featureId}`)})}},[l,h,f]),z=(0,n.useCallback)(()=>{h.play(),l.push("/create")},[l,h]),B=(0,n.useCallback)(e=>{h.play();let t=y.find(t=>t.id===e),r=t?.data?.repositoryPath;r?l.push(`/create?repo=${encodeURIComponent(r)}`):l.push("/create")},[y,l,h]),G=(0,n.useCallback)(e=>{let t=e.startsWith("feat-")?e.slice(5):e,r=b.find(t=>t.target===e),n=r?y.find(e=>e.id===r.source):null,o=n?.data?.repositoryPath;h.play();let a=new URLSearchParams;o&&a.set("repo",o),a.set("parent",t),l.push(`/create?${a.toString()}`)},[y,b,l,h]),q=(0,n.useCallback)(e=>{let t=y.find(t=>t.id===e);if(t?.type==="repositoryNode"){let e=t.data;e.id&&f(()=>l.push(`/repository/${e.id}`))}},[y,l,f]),W=(0,n.useCallback)(()=>{"/"!==c&&f(()=>l.push("/"))},[l,c,f]);(0,n.useEffect)(()=>{let e=e=>{let{wasEmpty:t,repoPath:r}=k(e.detail.path);t&&setTimeout(()=>{p(ei),g.current=setTimeout(()=>{f(()=>l.push(`/create?repo=${encodeURIComponent(r)}`))},600)},0)};return window.addEventListener("shep:add-repository",e),()=>{window.removeEventListener("shep:add-repository",e),null!=g.current&&clearTimeout(g.current)}},[k,p,f,l]),(0,n.useEffect)(()=>{let e=e=>{let t=e.detail;if(t.parentId)return void O(`feat-${t.parentId}`,{state:"creating",featureId:t.featureId,name:t.name,description:t.description,repositoryPath:t.repositoryPath},"dependencyEdge");let r=y.find(e=>"repositoryNode"===e.type&&e.data.repositoryPath===t.repositoryPath);O(r?.id??null,{state:"running",featureId:t.featureId,name:t.name,description:t.description,repositoryPath:t.repositoryPath})};return window.addEventListener("shep:feature-created",e),()=>window.removeEventListener("shep:feature-created",e)},[y,O]),(0,n.useEffect)(()=>{let e=e=>{let{featureId:t,cleanup:r,cascadeDelete:n}=e.detail;j(t,r,n)};return window.addEventListener("shep:feature-delete-requested",e),()=>window.removeEventListener("shep:feature-delete-requested",e)},[j]),(0,n.useEffect)(()=>{R({onNodeAction:G,onFeatureDelete:j,onRetryFeature:N,onStartFeature:C,onRepositoryAdd:B,onRepositoryClick:q,onRepositoryDelete:_})},[R,G,j,N,C,B,q,_]);let V=(0,n.useCallback)((e,t)=>{v(t)},[v]),U=y.some(e=>"repositoryNode"===e.type),[H,X]=(0,n.useState)(U),J=(0,n.useRef)(null);(0,n.useEffect)(()=>(U?(J.current&&(clearTimeout(J.current),J.current=null),X(!0)):H&&(J.current=setTimeout(()=>{X(!1),J.current=null},500)),()=>{J.current&&clearTimeout(J.current)}),[U,H]);let K=c.startsWith("/create"),Y=(0,n.useMemo)(()=>{let e=y.filter(e=>"repositoryNode"===e.type),t=y.some(e=>"featureNode"===e.type);return 1!==e.length||t||K?y:y.map(e=>"repositoryNode"===e.type?{...e,data:{...e.data,pulseAdd:!0}}:e)},[y,K]);return(0,t.jsx)(P,{nodes:H?Y:[],edges:H?b:[],selectedFeatureId:u,defaultViewport:m,onNodesChange:w,onConnect:E,onAddFeature:z,onNodeClick:$,onPaneClick:W,onMoveEnd:V,onResetViewport:x,emptyState:(0,t.jsx)(eo,{onRepositorySelect:k})})}function el({initialNodes:e,initialEdges:n,drawer:o}){return(0,t.jsxs)("div",{"data-testid":"control-center",className:"h-full w-full",children:[(0,t.jsx)(r.ReactFlowProvider,{children:(0,t.jsx)(ed,{initialNodes:e,initialEdges:n})}),(0,t.jsx)("div",{children:o},"drawer")]})}e.s(["ControlCenter",()=>el],48246)}]);
|