@shepai/cli 1.92.1 → 1.92.2
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 +2 -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 +16 -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 +20 -2
- package/dist/src/presentation/web/hooks/sidebar-features-context.d.ts +1 -1
- package/dist/src/presentation/web/hooks/sidebar-features-context.js +4 -4
- package/dist/src/presentation/web/lib/layout-with-dagre.d.ts.map +1 -1
- package/dist/src/presentation/web/lib/layout-with-dagre.js +78 -55
- 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 +18 -18
- 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 +21 -21
- 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 +21 -21
- 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 +14 -14
- 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 +18 -18
- 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 +21 -21
- 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 +21 -21
- 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 +14 -14
- 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 +14 -14
- 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 +5 -5
- 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/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_da7eef33.js +1 -1
- package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_@drawer_repository_[repositoryId]_page_actions_da7eef33.js.map +1 -1
- package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_repository_[repositoryId]_page_actions_0a9251aa.js +1 -1
- package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_repository_[repositoryId]_page_actions_0a9251aa.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__11033878._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__11033878._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__17143953._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__17143953._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__357d99f9._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__45aad79d._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__45aad79d._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__4be9a9bb._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__5cc4752a._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__5cc4752a._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__5d87af2e._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__845a9d2a._.js +3 -0
- package/web/.next/server/chunks/ssr/[root-of-the-server]__845a9d2a._.js.map +1 -0
- package/web/.next/server/chunks/ssr/[root-of-the-server]__89e8a5cc._.js +2 -2
- package/web/.next/server/chunks/ssr/[root-of-the-server]__9de266fa._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__9de266fa._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__aad040c0._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__aad040c0._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__fdc75809._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__fdc75809._.js.map +1 -1
- 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/{_f02f4210._.js → _16a7514c._.js} +2 -2
- package/web/.next/server/chunks/ssr/_16a7514c._.js.map +1 -0
- package/web/.next/server/chunks/ssr/_364346ad._.js +3 -0
- package/web/.next/server/chunks/ssr/_364346ad._.js.map +1 -0
- package/web/.next/server/chunks/ssr/_8dacd1e7._.js +1 -1
- package/web/.next/server/chunks/ssr/_8dacd1e7._.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/_df15bd24._.js +3 -0
- package/web/.next/server/chunks/ssr/_df15bd24._.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__next-internal_server_app_(dashboard)_page_actions_021a05f2.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_(dashboard)_page_actions_021a05f2.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_app_(dashboard)_get-graph-data_ts_b018483e._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_app_(dashboard)_get-graph-data_ts_b018483e._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_c4348b8a._.js +2 -2
- package/web/.next/server/chunks/ssr/src_presentation_web_c4348b8a._.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_bf50c527._.js.map +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_de814675._.js.map +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_e4510d10._.js +2 -2
- package/web/.next/server/chunks/ssr/src_presentation_web_e4510d10._.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 +28 -28
- package/web/.next/static/chunks/{e1adbd3c092ccc3c.js → 0a1511515cbdf02e.js} +2 -2
- package/web/.next/static/chunks/{5b3dd4146a57ce02.js → 166e31f7adad1949.js} +1 -1
- package/web/.next/static/chunks/{d7f984a3e8043cb0.js → 1da59e0c79357cf8.js} +1 -1
- package/web/.next/static/chunks/2536dce61f55daad.js +1 -0
- package/web/.next/static/chunks/2ae98439dac3693e.js +1 -0
- package/web/.next/static/chunks/39560c01879ac76a.css +2 -0
- package/web/.next/static/chunks/449251751b4908f7.js +11 -0
- package/web/.next/static/chunks/{bea7a5f44d99512f.js → 4a13c8befddbfae9.js} +1 -1
- package/web/.next/static/chunks/{2ddedc7a1d0d0a35.js → 62652f0d1304c333.js} +1 -1
- package/web/.next/static/chunks/{2d02a8deb3cfb404.js → 7bf51da075913f1c.js} +1 -1
- package/web/.next/static/chunks/85c0a8c9420d2064.js +1 -0
- package/web/.next/static/chunks/97b0a13714eb4d92.js +1 -0
- package/web/.next/static/chunks/{8a174308ba4bd69d.js → ceb79276cb6d8b88.js} +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__e630cc47._.js +0 -3
- package/web/.next/server/chunks/ssr/[root-of-the-server]__e630cc47._.js.map +0 -1
- package/web/.next/server/chunks/ssr/_21c75883._.js +0 -3
- package/web/.next/server/chunks/ssr/_21c75883._.js.map +0 -1
- package/web/.next/server/chunks/ssr/_a5c23e45._.js +0 -3
- package/web/.next/server/chunks/ssr/_a5c23e45._.js.map +0 -1
- package/web/.next/server/chunks/ssr/_f02f4210._.js.map +0 -1
- package/web/.next/static/chunks/1a2af08680037549.js +0 -1
- package/web/.next/static/chunks/30a344bb33a015e4.js +0 -1
- package/web/.next/static/chunks/4f94860011f9fb20.css +0 -2
- package/web/.next/static/chunks/dac26a484f476f36.js +0 -1
- package/web/.next/static/chunks/dd04e12ee5ccb0ad.js +0 -1
- package/web/.next/static/chunks/f54b972c149092b5.js +0 -11
- /package/web/.next/static/{UOxWj8CnreBdyLxAYAGYQ → KEWoM0Hk-MbG0_3S8cSrW}/_buildManifest.js +0 -0
- /package/web/.next/static/{UOxWj8CnreBdyLxAYAGYQ → KEWoM0Hk-MbG0_3S8cSrW}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/static/{UOxWj8CnreBdyLxAYAGYQ → KEWoM0Hk-MbG0_3S8cSrW}/_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 i=o;o=a,a=i}return o+"\x01"+a+"\x01"+(void 0===n?"\0":n)}function i(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,i=!1,s=arguments[0];"object"==typeof s&&null!==s&&"v"in s?(e=s.v,t=s.w,n=s.name,2==arguments.length&&(o=arguments[1],i=!0)):(e=s,t=arguments[1],n=arguments[3],arguments.length>2&&(o=arguments[2],i=!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 i&&(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]=i?o:this._defaultEdgeLabelFn(e,t,n);var l=function(e,t,r,n){var o=""+t,a=""+r;if(!e&&o>a){var i=o;o=a,a=i}var s={v:o,w:a};return n&&(s.name=n),s}(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?i(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?i(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?i(this._isDirected,arguments[0]):a(this._isDirected,e,t,r),s=this._edgeObjs[o];return s&&(e=s.v,t=s.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}}}}),i=n((e,t)=>{t.exports="3.0.2"}),s=n((e,t)=>{t.exports={Graph:a(),version:i()}}),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,i=0,s=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(){s.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})})})};s.forEach(function(e){o[e]={distance:e===t?0:1/0}});for(var c=s.length,u=1;u<c&&(a=!1,i++,l(),a);u++);if(i===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,i,s={},d=new r,l=function(e){var t=e.v!==a?e.v:e.w,r=s[t],o=n(e),l=i.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;s[e]={distance:r},d.add(e,r)});d.size()>0&&(i=s[a=d.removeMin()]).distance!==1/0;)o(a).forEach(l);return s}(e,String(t),o||n,a||function(t){return e.outEdges(t)})};var n=()=>1}),p=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},{})}}),f=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(i){var s=n[i]={onStack:!0,lowlink:t,index:t++};if(r.push(i),e.successors(i).forEach(function(e){Object.hasOwn(n,e)?n[e].onStack&&(s.lowlink=Math.min(s.lowlink,n[e].index)):(a(e),s.lowlink=Math.min(s.lowlink,n[e].lowlink))}),s.lowlink===s.index){var d,l=[];do n[d=r.pop()].onStack=!1,l.push(d);while(i!==d)o.push(l)}}(a)}),o}}),v=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])})}}),m=n((e,t)=>{t.exports=function(e,t,n){var o,a,i,s,d;return o=e,a=t||r,i=n||function(t){return e.outEdges(t)},s={},(d=o.nodes()).forEach(function(e){s[e]={},s[e][e]={distance:0},d.forEach(function(t){e!==t&&(s[e][t]={distance:1/0})}),i(e).forEach(function(t){var r=t.v===e?t.w:t.v,n=a(t);s[e][r]={distance:n,predecessor:e}})}),d.forEach(function(e){var t=s[e];d.forEach(function(r){var n=s[r];d.forEach(function(r){var o=n[e],a=t[r],i=n[r],s=o.distance+a.distance;s<i.distance&&(i.distance=s,i.predecessor=a.predecessor)})})}),s};var r=()=>1}),y=n((e,t)=>{function r(e){var t={},r={},o=[];if(e.sinks().forEach(function a(i){if(Object.hasOwn(r,i))throw new n;Object.hasOwn(t,i)||(r[i]=!0,t[i]=!0,e.predecessors(i).forEach(a),delete r[i],o.push(i))}),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}),w=n((e,t)=>{var r=y();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),i={};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,i,s){return Object.hasOwn(o,r)||(o[r]=!0,n||(s=i(s,r)),a(r).forEach(function(r){s=e(t,r,n,o,a,i,s)}),n&&(s=i(s,r))),s}(e,t,"post"===r,i,a,n,o)}),o}}),x=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=x();t.exports=function(e,t){return r(e,t,"post")}}),k=n((e,t)=>{var r=x();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,i={},s=new n;function d(e){var r=e.v===o?e.w:e.v,n=s.priority(r);if(void 0!==n){var a=t(e);a<n&&(i[r]=o,s.decrease(r,a))}}if(0===e.nodeCount())return a;e.nodes().forEach(function(e){s.add(e,1/0),a.setNode(e)}),s.decrease(e.nodes()[0],0);for(var l=!1;s.size()>0;){if(Object.hasOwn(i,o=s.removeMin()))a.setEdge(o,i[o]);else{if(l)throw Error("Input graph is not connected: "+e);l=!0}e.nodeEdges(o).forEach(d)}return a}}),_=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 i=!1,s=e.nodes(),d=0;d<s.length;d++){for(var l=a(s[d]),c=0;c<l.length;c++){var u=l[c],h=u.v===s[d]?u.v:u.w,p=h===u.v?u.w:u.v;0>o({v:h,w:p})&&(i=!0)}if(i)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:p(),extractPath:f(),findCycles:v(),floydWarshall:m(),isAcyclic:w(),postorder:E(),preorder:k(),prim:j(),shortestPaths:_(),reduce:b(),tarjan:g(),topsort:y()}}),N=s();t.exports={Graph:N.Graph,json:d(),alg:C(),version:N.version}}),i=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(", ")+"]"}}}),s=o((e,t)=>{var r=a().Graph,n=i();t.exports=function(e,t){var a,i;let l,c,u,h,p;if(1>=e.nodeCount())return[];let f=(a=e,i=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=i(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),p=c+1,l.nodes().forEach(e=>{d(h,p,l.node(e))}),{graph:l,buckets:h,zeroIdx:p});return(function(e,t,r){let n=[],o=t[t.length-1],a=t[0],i;for(;e.nodeCount();){for(;i=a.dequeue();)s(e,t,r,i);for(;i=o.dequeue();)s(e,t,r,i);if(e.nodeCount()){for(let o=t.length-2;o>0;--o)if(i=t[o].dequeue()){n=n.concat(s(e,t,r,i,!0));break}}}return n})(f.graph,f.buckets,f.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w))};var o=()=>1;function s(e,t,r,n,o){let a=o?[]:void 0;return e.inEdges(n.v).forEach(n=>{let i=e.edge(n),s=e.node(n.v);o&&a.push({v:n.v,w:n.w}),s.out-=i,d(t,r,s)}),e.outEdges(n.v).forEach(n=>{let o=e.edge(n),a=n.w,i=e.node(a);i.in-=o,d(t,r,i)}),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(i(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,i=t.x-o,s=t.y-a,d=e.width/2,l=e.height/2;if(!i&&!s)throw Error("Not possible to find intersection inside of the rectangle");return Math.abs(s)*d>Math.abs(i)*l?(s<0&&(l=-l),r=l*i/s,n=l):(i<0&&(d=-d),r=d,n=d*s/i),{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:i,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 i(e){return o(Math.max,e.nodes().map(t=>{let r=e.node(t).rank;return void 0===r?5e-324:r}))}var s=0;function d(e){return e+""+ ++s}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=s(),n=d().uniqueId;t.exports={run:function(e){var t,o;let a,i,s;("greedy"===e.graph().acyclicer?r(e,(t=e,e=>t.edge(e).weight)):(a=[],i={},s={},(o=e).nodes().forEach(function e(t){Object.hasOwn(s,t)||(s[t]=!0,i[t]=!0,o.outEdges(t).forEach(t=>{Object.hasOwn(i,t.w)?a.push(t):e(t.w)}),delete i[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,i=t.v,s=e.node(i).rank,d=t.w,l=e.node(d).rank,c=t.name,u=e.edge(t),h=u.labelRank;if(l!==s+1){for(e.removeEdge(t),a=0,++s;s<l;++a,++s)u.points=[],o={width:0,height:0,edgeLabel:u,edgeObj:t,rank:s},n=r.addDummyNode(e,"edge",o,"_d"),s===h&&(o.width=u.width,o.height=u.height,o.dummy="edge-label",o.labelpos=u.labelpos),e.setEdge(i,n,{weight:u.weight},c),0===a&&e.graph().dummyChains.push(n),i=n;e.setEdge(i,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 i=r(Math.min,e.outEdges(o).map(t=>null==t?1/0:n(t.w)-e.edge(t).minlen));return i===1/0&&(i=0),a.rank=i})},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,i,s=new r({directed:!1}),d=e.nodes()[0],l=e.nodeCount();for(s.setNode(d,{});t=s,o=e,t.nodes().forEach(function e(r){o.nodeEdges(r).forEach(a=>{var i=a.v,s=r===i?a.w:i;t.hasNode(s)||n(o,a)||(t.setNode(s,{}),t.setEdge(r,s,{}),e(s))})}),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]}(s,e),i=s.hasNode(a.v)?n(e,a):-n(e,a),function(e,t,r){e.nodes().forEach(e=>t.node(e).rank+=r)}(s,e,i);return s}}),p=o((e,t)=>{var r=h(),n=u().slack,o=u().longestPath,i=a().alg.preorder,s=a().alg.postorder,l=d().simplify;function c(e){o(e=l(e));var t,n,a=r(e);for(g(a),p(a,e);t=v(a);)n=m(a,e,t),y(a,e,t,n)}function p(e,t){var r=s(e,e.nodes());(r=r.slice(0,r.length-1)).forEach(r=>{var n,o,a,i;return n=e,o=t,a=r,i=n.node(a).parent,void(n.edge(a,i).cutvalue=f(n,o,a))})}function f(e,t,r){var n=e.node(r).parent,o=!0,a=t.edge(r,n),i=0;return a||(o=!1,a=t.edge(n,r)),i=a.weight,t.nodeEdges(r).forEach(a=>{var s=a.v===r,d=s?a.w:a.v;if(d!==n){var l,c,u,h=s===o,p=t.edge(a).weight;if(i+=h?p:-p,l=e,c=r,u=d,l.hasEdge(c,u)){var f=e.edge(r,d).cutvalue;i+=h?-f:f}}}),i}function g(e,t){arguments.length<2&&(t=e.nodes()[0]),function e(t,r,n,o,a){var i=n,s=t.node(o);return r[o]=!0,t.neighbors(o).forEach(a=>{Object.hasOwn(r,a)||(n=e(t,r,n,a,o))}),s.low=i,s.lim=n++,a?s.parent=a:delete s.parent,n}(e,{},1,t)}function v(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function m(e,t,r){var o=r.v,a=r.w;t.hasEdge(o,a)||(o=r.w,a=r.v);var i=e.node(o),s=e.node(a),d=i,l=!1;return i.lim>s.lim&&(d=s,l=!0),t.edges().filter(t=>l===w(e,e.node(t.v),d)&&l!==w(e,e.node(t.w),d)).reduce((e,r)=>n(t,r)<n(t,e)?r:e)}function y(e,t,r,n){var o,a,s,d,l=r.v,c=r.w;e.removeEdge(l,c),e.setEdge(n.v,n.w,{}),g(e),p(e,t),o=e,a=t,s=o.nodes().find(e=>!a.node(e).parent),(d=(d=i(o,s)).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 w(e,t,r){return r.low<=t.lim&&t.lim<=r.lim}t.exports=c,c.initLowLimValues=g,c.initCutValues=p,c.calcCutValue=f,c.leaveEdge=v,c.enterEdge=m,c.exchangeEdges=y}),f=o((e,t)=>{var r=u().longestPath,n=h(),o=p();t.exports=function(e){var t,i=e.graph().ranker;if(i instanceof Function)return i(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=[],i=Math.min(t[r].low,t[n].low),s=Math.max(t[r].lim,t[n].lim),d,l;d=r;do o.push(d=e.parent(d));while(d&&(t[d].low>i||s>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),i=a.path,s=a.lca,d=0,l=i[0],c=!0;for(;t!==n.w;){if(r=e.node(t),c){for(;(l=i[d])!==s&&e.node(l).maxRank<r.rank;)d++;l===s&&(c=!1)}if(!c){for(;d<i.length-1&&e.node(l=i[d+1]).minRank<=r.rank;)d++;l=i[d]}e.setParent(t,l),t=e.successors(t)[0]}})}}),v=o((e,t)=>{var r=d();t.exports={run:function(e){var t,n,o;let a=r.addDummyNode(e,"root",{},"_root"),i=(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),s=Object.values(i),d=r.applyWithChunking(Math.max,s)-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,i,s,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,i,s,r);let l=t.node(r),h=l.borderTop?l.borderTop:r,p=l.borderBottom?l.borderBottom:r,f=l.borderTop?a:2*a,g=h!==p?1:i-s[d]+1;t.setEdge(c,h,{weight:f,minlen:g,nestingEdge:!0}),t.setEdge(p,u,{weight:f,minlen:g,nestingEdge:!0})}),t.parent(d)||t.setEdge(n,c,{weight:0,minlen:i+s[d]})})(e,a,l,c,d,i,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)})}}}),m=o((e,t)=>{var r=d();function n(e,t,n,o,a,i){let s=a[t][i-1],d=r.addDummyNode(e,"border",{width:0,height:0,rank:i,borderType:t},n);a[t][i]=d,e.setParent(d,o),s&&e.setEdge(s,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)}})}}),y=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 i=e.graph().rankdir.toLowerCase();("bt"===i||"rl"===i)&&((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"===i||"rl"===i)&&((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))}}}),w=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),i=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,i[e.node(n).rank].push(n),e.successors(n).forEach(r))}),i}}),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)),i=1;for(;i<n.length;)i<<=1;let s=2*i-1;i-=1;let d=Array(s).fill(0),l=0;return a.forEach(e=>{let t=e.pos+i;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}}),x=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")),i=a.lhs,s=a.rhs.sort((e,t)=>t.i-e.i),d=[],l=0,c=0,u=0;i.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,s,u),i.forEach(e=>{u+=e.vs.length,d.push(e.vs),l+=e.barycenter*e.weight,c+=e.weight,u=n(d,s,u)});let h={vs:d.flat(!0)};return c&&(h.barycenter=l/c,h.weight=c),h}}),j=o((e,t)=>{var r=x(),n=E(),o=k();t.exports=function e(t,a,i,s){var d,l;let c=t.children(a),u=t.node(a),h=u?u.borderLeft:void 0,p=u?u.borderRight:void 0,f={};h&&(c=c.filter(e=>e!==h&&e!==p));let g=r(t,c);g.forEach(r=>{if(t.children(r.v).length){var n,o;let a=e(t,r.v,i,s);f[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 v=n(g,i);d=v,l=f,d.forEach(e=>{e.vs=e.vs.flatMap(e=>l[e]?l[e].vs:e)});let m=o(v,s);if(h&&(m.vs=[h,m.vs,p].flat(!0),t.predecessors(h).length)){let e=t.node(t.predecessors(h)[0]),r=t.node(t.predecessors(p)[0]);Object.hasOwn(m,"barycenter")||(m.barycenter=0,m.weight=0),m.barycenter=(m.barycenter*m.weight+e.order+r.order)/(m.weight+2),m.weight+=2}return m}}),_=o((e,t)=>{var r=a().Graph,n=d();t.exports=function(e,t,o,a){a||(a=e.nodes());let i=function(e){for(var t;e.hasNode(t=n.uniqueId("_root")););return t}(e),s=new r({compound:!0}).setGraph({root:i}).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)&&(s.setNode(r),s.setParent(r,a||i),e[o](r).forEach(t=>{let n=t.v===r?t.w:t.v,o=s.edge(n,r),a=void 0!==o?o.weight:0;s.setEdge(n,r,{weight:e.edge(t).weight+a})}),Object.hasOwn(n,"minRank")&&s.setNode(r,{borderLeft:n.borderLeft[t],borderRight:n.borderRight[t]}))}),s}}),C=o((e,t)=>{t.exports=function(e,t,r){let n={},o;r.forEach(r=>{let a=e.parent(r),i,s;for(;a;){if((i=e.parent(a))?(s=n[i],n[i]=a):(s=o,o=a),s&&s!==a)return void t.setEdge(s,a);a=i}})}}),N=o((e,t)=>{var r=w(),n=b(),o=j(),i=_(),s=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 i(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 i=c.maxRank(t),d=u(t,c.range(1,i+1),"inEdges"),p=u(t,c.range(i-1,-1,-1),"outEdges"),f=r(t);if(h(t,f),a.disableOptimalOrderHeuristic)return;let g=1/0,v,m=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,i=o(e,a,n,t);i.vs.forEach((t,r)=>e.node(t).order=r),s(e,n,i.vs)})})(e%2?d:p,e%4>=2,m),f=c.buildLayerMatrix(t);let a=n(t,f);a<g?(r=0,v=Object.assign({},f),g=a):a===g&&(v=structuredClone(f))}h(t,v)}}),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,i=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:i;(c||t===d)&&(n.slice(a,l+1).forEach(t=>{e.predecessors(t).forEach(n=>{let a=e.node(n),i=a.order;(i<o||u<i)&&!(a.dummy&&e.node(t).dummy)&&s(r,n,t)})}),a=l+1,o=u)}),n}),r}function i(e,t){let r={};function o(t,o,a,i,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<i||n.order>d)&&s(r,t,l)})})}return t.length&&t.reduce(function(t,r){let n=-1,a,i=0;return r.forEach((s,d)=>{if("border"===e.node(s).dummy){let t=e.predecessors(s);t.length&&(a=e.node(t[0]).order,o(r,i,d,n,a),i=d,n=a)}o(r,i,r.length,a,t.length)}),r}),r}function s(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={},i={};return t.forEach(e=>{e.forEach((e,t)=>{o[e]=e,a[e]=e,i[e]=t})}),t.forEach(e=>{let t=-1;e.forEach(e=>{let s=n(e);if(s.length){let n=((s=s.sort((e,t)=>i[e]-i[t])).length-1)/2;for(let d=Math.floor(n),c=Math.ceil(n);d<=c;++d){let n=s[d];a[e]===e&&t<i[n]&&!l(r,e,n)&&(a[n]=e,a[e]=o[e]=o[n],t=i[n])}}})}),{root:o,align:a}}function u(e,t,n,o,a){var i,s,d,l,c,u,h;let p,f,g,v={},m=(i=e,s=t,d=n,l=a,p=new r,g=(c=(f=i.graph()).nodesep,u=f.edgesep,h=l,(e,t,r)=>{let n=e.node(t),o=e.node(r),a,i;if(a=0+n.width/2,Object.hasOwn(n,"labelpos"))switch(n.labelpos.toLowerCase()){case"l":i=-n.width/2;break;case"r":i=n.width/2}if(i&&(a+=h?i:-i),i=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":i=o.width/2;break;case"r":i=-o.width/2}return i&&(a+=h?i:-i),i=0,a}),s.forEach(e=>{let t;e.forEach(e=>{let r=d[e];if(p.setNode(r),t){var n=d[t],o=p.edge(n,r);p.setEdge(n,r,Math.max(g(i,e,t),o||0))}t=e})}),p),y=a?"borderLeft":"borderRight";function w(e,t){let r=m.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 w(function(e){v[e]=m.inEdges(e).reduce((e,t)=>Math.max(e,v[t.v]+m.edge(t)),0)},m.predecessors.bind(m)),w(function(t){let r=m.outEdges(t).reduce((e,t)=>Math.min(e,v[t.w]-m.edge(t)),1/0),n=e.node(t);r!==1/0&&n.borderType!==y&&(v[t]=Math.max(v[t],r))},m.successors.bind(m)),Object.keys(o).forEach(e=>v[e]=v[n[e]]),v}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,i;let s=(a=e,i=t,a.node(i).width/2);n=Math.max(r+s,n),o=Math.min(r-s,o)});let a=n-o;return a<t[0]&&(t=[a,r]),t},[1/0,null])[1]}function p(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(i=>{let s=r+i,d=e[s];if(d===t)return;let l=Object.values(d),c=o-n.applyWithChunking(Math.min,l);"l"!==i&&(c=a-n.applyWithChunking(Math.max,l)),c&&(e[s]=n.mapValues(d,e=>e+c))})})}function f(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),i(e,t)),a={},s;["u","d"].forEach(o=>{s="u"===o?t:Object.values(t).reverse(),["l","r"].forEach(t=>{"r"===t&&(s=s.map(e=>Object.values(e).reverse()));let i=("u"===o?e.predecessors:e.successors).bind(e),d=c(e,s,r,i),l=u(e,s,d.root,d.align,"r"===t);"r"===t&&(l=n.mapValues(l,e=>-e)),a[o+t]=l})});let d=h(e,a);return p(a,d),f(a,e.graph().align)},findType1Conflicts:o,findType2Conflicts:i,addConflict:s,hasConflict:l,verticalAlignment:c,horizontalCompaction:u,alignCoordinates:p,findSmallestWidthAlignment:h,balance:f}}),M=o((e,t)=>{var r=d(),n=O().positionX;t.exports=function(e){var t;let o,a,i,s;t=e=r.asNonCompoundGraph(e),o=r.buildLayerMatrix(t),a=t.graph().ranksep,i=t.graph().rankalign,s=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"===i?n.y=s+n.height/2:"bottom"===i?n.y=s+r-n.height/2:n.y=s+r/2}),s+=r+a}),Object.entries(n(e)).forEach(([t,r])=>e.node(t).x=r)}}),R=o((e,t)=>{var r=l(),n=c(),o=f(),i=d().normalizeRanks,s=g(),u=d().removeEmptyRanks,h=v(),p=m(),w=y(),b=N(),x=M(),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=D(t.graph()),r.setGraph(Object.assign({},_,T(n,j),E.pick(n,C))),t.nodes().forEach(e=>{let n=T(D(t.node(e)),O);Object.keys(R).forEach(e=>{void 0===n[e]&&(n[e]=R[e])}),r.setNode(e,n),r.setParent(e,t.parent(e))}),t.edges().forEach(e=>{let n=D(t.edge(e));r.setEdge(e,Object.assign({},S,T(n,P),E.pick(n,L)))}),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",()=>i(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",()=>s(e)),l(" addBorderSegments",()=>p(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",()=>w.adjust(e)),l(" position",()=>x(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,i=r.x-o,s=n.height/2;t.setEdge(r.e,r.label),t.removeNode(e),r.label.points=[{x:o+2*i/3,y:a-s},{x:o+5*i/6,y:a-s},{x:o+i,y:a},{x:o+5*i/6,y:a+s},{x:o+2*i/3,y:a+s}],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]),i=t.node(r.borderRight[r.borderRight.length-1]);r.width=Math.abs(i.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",()=>w.undo(e)),l(" translateGraph",()=>(function(e){let t=1/0,r=0,n=1/0,o=0,a=e.graph(),i=a.marginx||0,s=a.marginy||0;function d(e){let a=e.x,i=e.y,s=e.width,d=e.height;t=Math.min(t,a-s/2),r=Math.max(r,a+s/2),n=Math.min(n,i-d/2),o=Math.max(o,i+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-=i,n-=s,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+i,a.height=o-n+s})(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,i;r.points?(a=r.points[0],i=r.points[r.points.length-1]):(r.points=[],a=o,i=n),r.points.unshift(E.intersectRect(n,a)),r.points.push(E.intersectRect(o,i))})}),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"],_={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb",rankalign:"center"},C=["acyclicer","ranker","rankdir","align","rankalign"],O=["width","height","rank"],R={width:0,height:0},P=["minlen","weight","width","height","labeloffset"],S={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},L=["labelpos"];function T(e,t){return E.mapValues(E.pick(e,t),Number)}function D(e){var t={};return e&&Object.entries(e).forEach(([e,r])=>{"string"==typeof e&&(e=e.toLowerCase()),t[e]=r}),t}}),P=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}}}),S=o((e,t)=>{t.exports="2.0.4"});let L=o((e,t)=>{t.exports={graphlib:a(),layout:R(),debug:P(),util:{time:d().time,notime:d().notime},version:S()}})(),T={direction:"LR",ranksep:200,nodesep:15},D={featureNode:{width:288,height:140},repositoryNode:{width:328,height:50}};function I(e,t){let r=e.data;return r&&"number"==typeof r.width&&"number"==typeof r.height?{width:r.width,height:r.height}:D[e.type??""]??t}function F(e,t,r={}){let{direction:n="TB",nodeSize:o={width:172,height:36},ranksep:a=80,nodesep:i=30}=r;if(0===e.length)return{nodes:[],edges:[]};let s=new L.graphlib.Graph({multigraph:!0});s.setDefaultEdgeLabel(()=>({})),s.setGraph({rankdir:n,ranksep:a,nodesep:i});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=I(e,o);s.setNode(e.id,{width:t.width,height:t.height})}for(let e of t)s.hasNode(e.source)&&s.hasNode(e.target)&&s.setEdge(e.source,e.target,{},e.id);L.layout(s);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),p="LR"===n||"RL"===n,f=new Map;for(let e of l){let t=s.node(e.id),r=I(e,o);f.set(e.id,{cx:t.x,cy:t.y,w:r.width,h:r.height})}let g=new Map;for(let e of t)f.has(e.source)&&f.has(e.target)&&(g.has(e.source)||g.set(e.source,[]),g.get(e.source).push(e.target));for(let[e,t]of g){if(t.length<=1)continue;let r=f.get(e),n=p?r.cy:r.cx,o=t.filter(e=>f.has(e)).sort((e,t)=>{let r=f.get(e),n=f.get(t);return p?r.cy-n.cy:r.cx-n.cx}),a=f.get(o[0]),i=f.get(o[o.length-1]),s=n-(p?(a.cy+i.cy)/2:(a.cx+i.cx)/2);if(Math.abs(s)>1)for(let e of o){let t=f.get(e);p?t.cy+=s:t.cx+=s}}let v=new Map;for(let e=0;e<l.length;e++)v.set(l[e].id,e);for(let[,e]of g){let t=e.filter(e=>f.has(e));if(t.length<=1)continue;let r=t.map(e=>p?f.get(e).cy:f.get(e).cx).sort((e,t)=>e-t),n=[...t].sort((e,t)=>(v.get(e)??0)-(v.get(t)??0));for(let e=0;e<n.length;e++){let t=f.get(n[e]);p?t.cy=r[e]:t.cx=r[e]}}let m=[];for(let e of l){let t=f.get(e.id);m.push({...e,targetPosition:u,sourcePosition:h,position:{x:t.cx-t.w/2,y:t.cy-t.h/2}})}if(c.length>0){let e=0,t=1/0;for(let r of m){let n=I(r,o);e=Math.max(e,r.position.y+n.height),t=Math.min(t,r.position.x)}t===1/0&&(t=0);for(let r=0;r<c.length;r++){let n=c[r],a=I(n,o);m.push({...n,targetPosition:u,sourcePosition:h,position:{x:t,y:e+30+r*(a.height+20)}})}}return{nodes:m,edges:[...t]}}var A=e.i(99549),$=e.i(21023);let z=(0,$.createServerReference)("40f212637cf54b75f8369a28f2ef02047afa0dd44f",$.callServer,void 0,$.findSourceMapURL,"addRepository"),G=(0,$.createServerReference)("404d7ef6741e7ba754958ecc114042f77e9bf820a2",$.callServer,void 0,$.findSourceMapURL,"deleteRepository"),B=(0,$.createServerReference)("4081653b3aa484365fe0f4290fbcdd040326bd7eb7",$.callServer,void 0,$.findSourceMapURL,"getFeatureMetadata"),q=(0,$.createServerReference)("0003b68c84f80e76685f11cf5cc265bfeb64a68543",$.callServer,void 0,$.findSourceMapURL,"fetchGraphData");var W=e.i(39443),V=e.i(8361),U=e.i(18354),H=e.i(99045);function X(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)}let Y=(0,U.createLogger)("[Polling]"),J=0,Q=0;function Z(e,o){let a=(0,r.useRouter)(),i=(0,V.useSoundAction)("delete"),s=(0,V.useSoundAction)("create"),{nodes:d,edges:l,reconcile:c,updateFeature:u,addPendingFeature:h,removeFeature:p,restoreFeature:f,addRepository:g,removeRepository:v,replaceRepository:m,getFeatureRepositoryPath:y,getRepositoryData:w,getRepoMapSize:b,setCallbacks:x}=function(e,r){let n=(0,t.useMemo)(()=>X(e,r),[]),[o,a]=(0,t.useState)(n.featureMap),[i,s]=(0,t.useState)(n.repoMap),[d,l]=(0,t.useState)(new Map),c=(0,t.useRef)(new Map),u=(0,t.useRef)({}),h=(0,t.useMemo)(()=>({onNodeAction:e=>u.current.onNodeAction?.(e),onNodeSettings:e=>u.current.onNodeSettings?.(e),onFeatureDelete:e=>u.current.onFeatureDelete?.(e),onRepositoryAdd:e=>u.current.onRepositoryAdd?.(e),onRepositoryClick:e=>u.current.onRepositoryClick?.(e),onRepositoryDelete:e=>u.current.onRepositoryDelete?.(e)}),[]),p=(0,t.useRef)(o);p.current=o;let f=(0,t.useRef)(i);f.current=i;let g=(0,t.useMemo)(()=>(function(e,t,r,n){let o=[],a=[],i=new Map;for(let[e,r]of t)r.data.repositoryPath&&i.set(r.data.repositoryPath,e);let s=new Map;for(let[e,r]of t){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,d,l]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"===d.data.state||l,r={...d.data,...!e&&n?.onNodeAction&&{onAction:()=>n.onNodeAction(t)},...!e&&n?.onNodeSettings&&{onSettings:()=>n.onNodeSettings(t)},...!e&&n?.onFeatureDelete&&{onDelete:n.onFeatureDelete}};if(o.push({id:t,type:"featureNode",position:{x:0,y:0},data:r}),d.parentNodeId)a.push({id:`dep-${d.parentNodeId}-${t}`,source:d.parentNodeId,target:t,type:"dependencyEdge"});else{let e=d.data.repositoryPath,r=i.get(e)??function(e){if(s.has(e))return s.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}}),s.set(e,t),t}(e);a.push({id:`edge-${r}-${t}`,source:r,target:t,style:{strokeDasharray:"5 5"}})}}let d=a.length>0;for(let e of o)e.data.showHandles=d;return{nodes:o,edges:a}})(o,i,d,h),[o,i,d,h]),v=(0,t.useRef)({key:"",positions:new Map}),{nodes:m,edges:y}=(0,t.useMemo)(()=>{let e=g.nodes.map(e=>e.id).sort().join(","),t=g.edges.map(e=>`${e.source}-${e.target}`).sort().join(","),r=`${e}|${t}`;if(r!==v.current.key){let e=F(g.nodes,g.edges,T),t=new Map;for(let r of e.nodes)t.set(r.id,{position:r.position,targetPosition:r.targetPosition,sourcePosition:r.sourcePosition});return v.current={key:r,positions:t},e}let{positions:n}=v.current;return{nodes:g.nodes.map(e=>{let t=n.get(e.id);return t?{...e,...t}:e}),edges:g.edges}},[g]),w=(0,t.useCallback)((e,t)=>{let{featureMap:r,repoMap:n}=X(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)}for(let[e,t]of c.current){let r=n.get(e);r&&(n.set(e,{...r,data:{...r.data,...t}}),c.current.delete(e))}return 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}),s(n)},[]),b=(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})},[]),x=(0,t.useCallback)((e,t,r)=>{l(n=>{let o=new Map(n);return o.set(e,{nodeId:e,data:t,parentNodeId:r}),o})},[]),E=(0,t.useCallback)(e=>{l(t=>{if(!t.has(e))return t;let r=new Map(t);return r.delete(e),r})},[]),k=(0,t.useCallback)(e=>{a(t=>{if(!t.has(e))return t;let r=new Map(t);return r.delete(e),r})},[]),j=(0,t.useCallback)((e,t)=>{a(r=>{let n=new Map(r);return n.set(e,t),n})},[]),_=(0,t.useCallback)((e,t)=>{s(r=>{let n=new Map(r);return n.set(e,{nodeId:e,data:t}),n})},[]),C=(0,t.useCallback)(e=>{s(t=>{if(!t.has(e))return t;let r=new Map(t);return r.delete(e),r})},[]),N=(0,t.useCallback)((e,t,r)=>{s(n=>{if(!n.has(e))return n;let o=new Map(n);return o.delete(e),o.set(t,{nodeId:t,data:r}),o})},[]),O=(0,t.useCallback)(e=>p.current.get(e)?.data.repositoryPath,[]),M=(0,t.useCallback)(e=>f.current.get(e)?.data,[]);return{nodes:m,edges:y,reconcile:w,updateFeature:b,addPendingFeature:x,removePendingFeature:E,removeFeature:k,restoreFeature:j,addRepository:_,removeRepository:C,replaceRepository:N,getFeatureRepositoryPath:O,getRepositoryData:M,getRepoMapSize:(0,t.useCallback)(()=>f.current.size,[]),setCallbacks:(0,t.useCallback)(e=>{u.current=e},[])}}(e,o),E=(0,t.useRef)(d),k=(0,t.useRef)(l);(0,t.useEffect)(()=>{E.current=d,k.current=l},[d,l]);let j=(0,t.useMemo)(()=>e.map(e=>e.id).sort().join(","),[e]),_=(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]),C=(0,t.useRef)("");(0,t.useEffect)(()=>{let t=`${j}|${_}`;t!==C.current&&(C.current=t,c(e,o))},[j,_,e,o,c]);let N=(0,t.useRef)(new Map),{events:O}=(0,W.useAgentEventsContext)();(0,t.useEffect)(()=>{let t=N.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&&(O.some(t=>t.featureId===e.featureId&&(0,H.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)}},[_,e,O,a]);let M=(0,t.useRef)(0);(0,t.useEffect)(()=>{if(M.current>O.length&&(M.current=0),O.length<=M.current)return;let e=O.slice(M.current);for(let{featureId:t,state:r,lifecycle:n}of(M.current=O.length,(0,H.resolveSseEventUpdates)(e)))(void 0!==r||void 0!==n)&&u(`feat-${t}`,{...void 0!==r&&{state:r},...void 0!==n&&{lifecycle:n}})},[O,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 R=(0,t.useRef)(new Set),P=(0,t.useRef)(0);(0,t.useEffect)(()=>{if(P.current>O.length&&(P.current=0),O.length<=P.current)return;let e=O.slice(P.current);for(let t of(P.current=O.length,e)){if("Feature metadata updated"!==t.message||R.current.has(t.featureId))continue;R.current.add(t.featureId);let e=`feat-${t.featureId}`;B(t.featureId).then(t=>{t&&u(e,{name:t.name,description:t.description})}).catch(()=>{})}},[O,u]),(0,t.useEffect)(()=>{Y.debug("polling enabled (3000ms interval)");let e=setInterval(async()=>{try{let{nodes:e,edges:t}=await q();c(e,t)}catch{Y.warn("poll fetch failed — will retry next interval")}},3e3);return()=>{Y.debug("polling disabled"),clearInterval(e)}},[c]);let S=(0,t.useCallback)(e=>{},[]),L=(0,t.useCallback)(e=>{},[]),D=(0,t.useCallback)((e,t,r)=>{let n=t?.featureId?`feat-${t.featureId}`:`feature-${Date.now()}-${J++}`,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]),I=(0,t.useCallback)((e,t)=>{let r=`feat-${e}`,o=E.current.filter(e=>e.id===r).map(e=>({nodeId:e.id,data:e.data}))[0];p(r),i.play(),n.toast.success("Feature deleted successfully"),a.push("/"),(0,A.deleteFeature)(e,t).then(e=>{e.error&&(o&&f(r,o),n.toast.error(e.error))}).catch(()=>{o&&f(r,o),n.toast.error("Failed to delete feature")})},[a,i,p,f]),$=(0,t.useCallback)(async e=>{let t=`repo-${e}`,r=new Set(k.current.filter(e=>e.source===t).map(e=>e.target)),o=w(t),a=new Map;for(let e of r){let t=E.current.find(t=>t.id===e);t&&a.set(e,{nodeId:e,data:t.data})}let s=()=>{for(let[e,r]of(o&&g(t,o),a))f(e,r)};for(let e of(v(t),r))p(e);try{let t=await G(e);if(!t.success){n.toast.error(t.error??"Failed to remove repository"),s();return}i.play(),n.toast.success("Repository removed")}catch{n.toast.error("Failed to remove repository"),s()}},[i,v,p,g,f,w]),U=(0,t.useCallback)(e=>{let t=F(E.current,k.current,{...T,direction:e});c(t.nodes,t.edges)},[c]);return{nodes:d,edges:l,onNodesChange:S,handleConnect:L,handleAddRepository:(0,t.useCallback)(e=>{let t=0===b(),r=`repo-temp-${++Q}`,o=e.replace(/[\\/]+$/,"").split(/[\\/]/).pop()??e;return g(r,{name:o,repositoryPath:e,id:r}),z({path:e,name:o}).then(e=>{if(e.error){v(r),n.toast.error(e.error);return}let t=e.repository;m(r,`repo-${t.id}`,{name:t.name,repositoryPath:t.path,id:t.id}),s.play()}).catch(()=>{v(r),n.toast.error("Failed to add repository")}),{wasEmpty:t,repoPath:e}},[g,v,m,s,b]),handleLayout:U,handleDeleteFeature:I,handleDeleteRepository:$,createFeatureNode:D,getFeatureRepositoryPath:y,getRepositoryData:w,setCallbacks:x}}e.s(["useControlCenterState",()=>Z],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),i=e.i(3645);let s=(0,i.default)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);var d=e.i(35364);e.i(54793);var l=e.i(7729);e.i(47506);var c=e.i(89313),u=e.i(92002);let h=(0,i.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),f=e.i(38573),g=e.i(19933),v=e.i(67669),m=e.i(24042),y=e.i(64970),w=e.i(31777);e.i(81803);var b=e.i(72714),x=e.i(2287),E=e.i(2828);e.i(99348);var k=e.i(17466),j=e.i(8537),_=e.i(75921),C=e.i(76852);function N({data:e}){let o=(0,_.useFeatureFlags)(),[i,s]=(0,n.useState)(!1),l=(0,C.useRepositoryActions)(e.repositoryPath?{repositoryPath:e.repositoryPath}:null),c=(0,j.useDeployAction)(e.repositoryPath?{targetId:e.repositoryPath,targetType:"repository",repositoryPath:e.repositoryPath}:null),N="Booting"===c.status||"Ready"===c.status;return(0,t.jsxs)("div",{className:(0,w.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(),s(!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)(x.Dialog,{open:i,onOpenChange:s,children:(0,t.jsxs)(x.DialogContent,{className:"max-w-xs",children:[(0,t.jsxs)(x.DialogHeader,{children:[(0,t.jsx)(x.DialogTitle,{children:"Remove repository?"}),(0,t.jsxs)(x.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)(x.DialogFooter,{className:"grid grid-cols-2 gap-2 sm:flex-none",children:[(0,t.jsx)(x.DialogClose,{asChild:!0,children:(0,t.jsx)(d.Button,{variant:"outline",children:"Cancel"})}),(0,t.jsx)(d.Button,{variant:"destructive",onClick:()=>{s(!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)(h,{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,w.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:l.openInIde,loading:l.ideLoading,error:!!l.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:l.openInShell,loading:l.shellLoading,error:!!l.shellError,icon:f.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:l.openFolder,loading:l.folderLoading,error:!!l.folderError,icon:g.FolderOpen,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(E.TooltipContent,{children:"Open Folder"})]})}),o.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:N?"Stop Dev Server":"Start Dev Server",onClick:N?c.stop:c.deploy,loading:c.deployLoading||c.stopLoading,error:!!c.deployError,icon:N?y.Square:m.Play,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(E.TooltipContent,{children:N?"Stop Dev Server":"Start Dev Server"})]})}),N?(0,t.jsx)(k.DeploymentStatusBadge,{status:c.status,url:c.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:"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",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 O(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 R({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,{style:{fill:"none"}})})}function P({nodes:e,edges:o,selectedFeatureId:i,defaultViewport:s,onNodesChange:u,onAddFeature:h,onConnect:p,onNodeClick:f,onPaneClick:g,onCanvasDrag:v,onMoveEnd:m,onResetViewport:y,toolbar:w,emptyState:b}){let x=(0,n.useMemo)(()=>({featureNode:c.FeatureNode,repositoryNode:N}),[]),E=(0,n.useMemo)(()=>({dependencyEdge:O}),[]),k=(0,n.useMemo)(()=>null==i?e:e.map(e=>"featureNode"===e.type&&e.data.featureId===i?{...e,selected:!0}:e),[e,i]);return 0===e.length?b?(0,t.jsx)("div",{"data-testid":"features-canvas-empty",className:"h-full w-full",children:b}):(0,t.jsx)("div",{"data-testid":"features-canvas-empty",children:(0,t.jsx)(l.EmptyState,{title:"No features yet",description:"Get started by creating your first feature.",action:(0,t.jsxs)(d.Button,{onClick:h,children:[(0,t.jsx)(a.Plus,{className:"mr-2 h-4 w-4"}),"New Feature"]})})}):(0,t.jsx)("div",{"data-testid":"features-canvas","data-no-drawer-close":!0,className:"pointer-events-auto h-full w-full",children:(0,t.jsxs)(r.ReactFlow,{nodes:k,edges:o,nodeTypes:x,edgeTypes:E,onConnect:p,onNodesChange:u,onNodeClick:f,onPaneClick:g,onMoveStart:v,onMoveEnd:m,defaultViewport:s??M,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,proOptions:{hideAttribution:!0},children:[(0,t.jsx)(r.Background,{}),(0,t.jsx)(r.Controls,{showInteractive:!1,children:y?(0,t.jsx)(R,{onResetViewport:y}):null}),w]})})}var S=e.i(5147),L=e.i(8361),T=e.i(30153);let D="shep-canvas-viewport",I={x:30,y:30,zoom:.85},F=(0,i.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 A=e.i(33548),$=e.i(23925),z=e.i(83428),G=e.i(78521);let B=["cd ~/my-repo",'shep feat new "create modern, sleek dashboards"'];function q({onRepositorySelect:e,className:r}){let[o,i]=(0,n.useState)(!1),[s,d]=(0,n.useState)(!1);async function l(){if(!s){d(!0);try{let t=await (0,G.pickFolder)();t&&e?.(t)}finally{d(!1)}}}let c=(0,n.useCallback)(async()=>{await navigator.clipboard.writeText(B.join("\n")),i(!0),setTimeout(()=>i(!1),2e3)},[]);return(0,t.jsxs)("div",{"data-testid":"control-center-empty-state",className:(0,w.cn)("relative h-full w-full",r),children:[(0,t.jsx)("div",{className:"absolute inset-0 [background-image:radial-gradient(circle,_var(--color-border)_1px,_transparent_1px)] [background-size:24px_24px]"}),(0,t.jsxs)("div",{className:"absolute top-8 left-8 z-10",children:[(0,t.jsx)("h1",{className:"text-4xl font-bold tracking-tight",children:"Features"}),(0,t.jsx)("p",{className:"text-muted-foreground text-3xl font-light",children:"Control Center"})]}),(0,t.jsx)("div",{className:"relative z-10 flex h-full items-center justify-center",children:(0,t.jsxs)("div",{className:"flex max-w-lg flex-col items-center gap-6",children:[(0,t.jsxs)("div",{className:"text-muted-foreground flex items-center gap-2",children:[(0,t.jsx)(h,{className:"h-4 w-4"}),(0,t.jsx)("span",{className:"text-xs font-semibold tracking-widest uppercase",children:"Repositories"})]}),(0,t.jsxs)("button",{type:"button","data-testid":"empty-state-add-repository",onClick:l,disabled:s,className:"border-muted-foreground/30 hover:border-primary hover:text-primary flex cursor-pointer items-center gap-3 rounded-lg border-2 border-dashed px-8 py-4 transition-colors disabled:cursor-wait disabled:opacity-60",children:[s?(0,t.jsx)(z.Loader2,{className:"h-5 w-5 animate-spin"}):(0,t.jsx)(a.Plus,{className:"h-5 w-5"}),(0,t.jsx)("span",{className:"text-sm font-medium",children:s?"Opening...":"Add Repository"})]}),(0,t.jsxs)("div",{className:"text-muted-foreground flex items-center gap-3",children:[(0,t.jsx)("div",{className:"bg-border h-px w-16"}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(F,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{className:"text-xs font-semibold tracking-widest uppercase",children:"Or start from the command line"})]}),(0,t.jsx)("div",{className:"bg-border h-px w-16"})]}),(0,t.jsxs)("div",{"data-testid":"cli-code-block",className:"relative w-full rounded-lg bg-zinc-900 px-5 py-4 font-mono text-sm text-zinc-100",children:[(0,t.jsx)("button",{type:"button","data-testid":"cli-code-block-copy",onClick:c,className:"absolute top-3 right-3 cursor-pointer rounded p-1.5 text-zinc-400 transition-colors hover:bg-zinc-800 hover:text-zinc-200","aria-label":"Copy commands",children:o?(0,t.jsx)($.Check,{className:"h-4 w-4"}):(0,t.jsx)(A.Copy,{className:"h-4 w-4"})}),(0,t.jsx)("div",{className:"space-y-1",children:B.map(e=>(0,t.jsxs)("div",{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-sm",children:"Feature will appear on canvas once created"})]})})]})}var W=e.i(17840);let V={maxZoom:1,padding:.5,duration:500};function U({initialNodes:e,initialEdges:a}){let i,s,d,l=(0,o.useRouter)(),c=(0,o.usePathname)(),u=(i=(0,o.usePathname)().match(/^\/feature\/([^/]+)/),i?.[1]??null),h=(0,L.useSoundAction)("click"),{guardedNavigate:p}=(0,T.useDrawerCloseGuard)(),{fitView:f}=(0,r.useReactFlow)(),g=(0,n.useRef)(null),{defaultViewport:v,onMoveEnd:m,resetViewport:y}=(s=(0,n.useRef)(function(){try{let e=localStorage.getItem(D);if(null==e)return I;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:I}catch{return I}}()).current,d=(0,n.useRef)(null),(0,n.useEffect)(()=>()=>{null!=d.current&&clearTimeout(d.current)},[]),{defaultViewport:s,onMoveEnd:(0,n.useCallback)(e=>{null!=d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{try{localStorage.setItem(D,JSON.stringify(e))}catch{}},500)},[]),resetViewport:(0,n.useCallback)(()=>{try{localStorage.removeItem(D)}catch{}return I},[])}),{nodes:w,edges:b,onNodesChange:x,handleConnect:E,handleAddRepository:k,handleDeleteFeature:j,handleDeleteRepository:_,createFeatureNode:C,setCallbacks:N}=(0,W.useControlCenterState)(e,a),{setFeatures:O}=(0,S.useSidebarFeaturesContext)(),M=(0,n.useMemo)(()=>w.filter(e=>"featureNode"===e.type),[w]),R=(0,n.useMemo)(()=>M.map(e=>{let t=e.data;return`${t.featureId}:${t.state}:${t.name}`}).sort().join(","),[M]);(0,n.useEffect)(()=>{O(M.map(e=>{let t=e.data,r=(0,S.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))},[R,M,O]);let F=(0,n.useCallback)((e,t)=>{if("featureNode"===t.type){let e=t.data;"creating"!==e.state&&p(()=>{h.play(),l.push(`/feature/${e.featureId}`)})}},[l,h,p]),A=(0,n.useCallback)(()=>{h.play(),l.push("/create")},[l,h]),$=(0,n.useCallback)(e=>{h.play();let t=w.find(t=>t.id===e),r=t?.data?.repositoryPath;r?l.push(`/create?repo=${encodeURIComponent(r)}`):l.push("/create")},[w,l,h]),z=(0,n.useCallback)(e=>{let t=e.startsWith("feat-")?e.slice(5):e,r=b.find(t=>t.target===e),n=r?w.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()}`)},[w,b,l,h]),G=(0,n.useCallback)(e=>{let t=w.find(t=>t.id===e);if(t?.type==="repositoryNode"){let e=t.data;e.id&&p(()=>l.push(`/repository/${e.id}`))}},[w,l,p]),B=(0,n.useCallback)(()=>{"/"!==c&&p(()=>l.push("/"))},[l,c,p]);(0,n.useEffect)(()=>{let e=e=>{let{wasEmpty:t,repoPath:r}=k(e.detail.path);t&&setTimeout(()=>{f(V),g.current=setTimeout(()=>{p(()=>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,f,p,l]),(0,n.useEffect)(()=>{let e=e=>{let t=e.detail;if(t.parentId)return void C(`feat-${t.parentId}`,{state:"creating",featureId:t.featureId,name:t.name,description:t.description,repositoryPath:t.repositoryPath},"dependencyEdge");let r=w.find(e=>"repositoryNode"===e.type&&e.data.repositoryPath===t.repositoryPath);C(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)},[w,C]),(0,n.useEffect)(()=>{N({onNodeAction:z,onFeatureDelete:j,onRepositoryAdd:$,onRepositoryClick:G,onRepositoryDelete:_})},[N,z,j,$,G,_]);let U=(0,n.useCallback)((e,t)=>{m(t)},[m]);return w.some(e=>"repositoryNode"===e.type)?(0,t.jsx)(P,{nodes:w,edges:b,selectedFeatureId:u,defaultViewport:v,onNodesChange:x,onConnect:E,onAddFeature:A,onNodeClick:F,onPaneClick:B,onMoveEnd:U,onResetViewport:y,emptyState:(0,t.jsx)(q,{onRepositorySelect:k})}):(0,t.jsx)(q,{onRepositorySelect:k})}function H({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)(U,{initialNodes:e,initialEdges:n})}),(0,t.jsx)("div",{children:o},"drawer")]})}e.s(["ControlCenter",()=>H],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 i=o;o=a,a=i}return o+"\x01"+a+"\x01"+(void 0===n?"\0":n)}function i(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,i=!1,s=arguments[0];"object"==typeof s&&null!==s&&"v"in s?(e=s.v,t=s.w,n=s.name,2==arguments.length&&(o=arguments[1],i=!0)):(e=s,t=arguments[1],n=arguments[3],arguments.length>2&&(o=arguments[2],i=!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 i&&(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]=i?o:this._defaultEdgeLabelFn(e,t,n);var l=function(e,t,r,n){var o=""+t,a=""+r;if(!e&&o>a){var i=o;o=a,a=i}var s={v:o,w:a};return n&&(s.name=n),s}(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?i(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?i(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?i(this._isDirected,arguments[0]):a(this._isDirected,e,t,r),s=this._edgeObjs[o];return s&&(e=s.v,t=s.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}}}}),i=n((e,t)=>{t.exports="3.0.2"}),s=n((e,t)=>{t.exports={Graph:a(),version:i()}}),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,i=0,s=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(){s.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})})})};s.forEach(function(e){o[e]={distance:e===t?0:1/0}});for(var c=s.length,u=1;u<c&&(a=!1,i++,l(),a);u++);if(i===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,i,s={},d=new r,l=function(e){var t=e.v!==a?e.v:e.w,r=s[t],o=n(e),l=i.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;s[e]={distance:r},d.add(e,r)});d.size()>0&&(i=s[a=d.removeMin()]).distance!==1/0;)o(a).forEach(l);return s}(e,String(t),o||n,a||function(t){return e.outEdges(t)})};var n=()=>1}),p=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},{})}}),f=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(i){var s=n[i]={onStack:!0,lowlink:t,index:t++};if(r.push(i),e.successors(i).forEach(function(e){Object.hasOwn(n,e)?n[e].onStack&&(s.lowlink=Math.min(s.lowlink,n[e].index)):(a(e),s.lowlink=Math.min(s.lowlink,n[e].lowlink))}),s.lowlink===s.index){var d,l=[];do n[d=r.pop()].onStack=!1,l.push(d);while(i!==d)o.push(l)}}(a)}),o}}),v=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])})}}),m=n((e,t)=>{t.exports=function(e,t,n){var o,a,i,s,d;return o=e,a=t||r,i=n||function(t){return e.outEdges(t)},s={},(d=o.nodes()).forEach(function(e){s[e]={},s[e][e]={distance:0},d.forEach(function(t){e!==t&&(s[e][t]={distance:1/0})}),i(e).forEach(function(t){var r=t.v===e?t.w:t.v,n=a(t);s[e][r]={distance:n,predecessor:e}})}),d.forEach(function(e){var t=s[e];d.forEach(function(r){var n=s[r];d.forEach(function(r){var o=n[e],a=t[r],i=n[r],s=o.distance+a.distance;s<i.distance&&(i.distance=s,i.predecessor=a.predecessor)})})}),s};var r=()=>1}),y=n((e,t)=>{function r(e){var t={},r={},o=[];if(e.sinks().forEach(function a(i){if(Object.hasOwn(r,i))throw new n;Object.hasOwn(t,i)||(r[i]=!0,t[i]=!0,e.predecessors(i).forEach(a),delete r[i],o.push(i))}),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}),w=n((e,t)=>{var r=y();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),i={};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,i,s){return Object.hasOwn(o,r)||(o[r]=!0,n||(s=i(s,r)),a(r).forEach(function(r){s=e(t,r,n,o,a,i,s)}),n&&(s=i(s,r))),s}(e,t,"post"===r,i,a,n,o)}),o}}),x=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=x();t.exports=function(e,t){return r(e,t,"post")}}),k=n((e,t)=>{var r=x();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,i={},s=new n;function d(e){var r=e.v===o?e.w:e.v,n=s.priority(r);if(void 0!==n){var a=t(e);a<n&&(i[r]=o,s.decrease(r,a))}}if(0===e.nodeCount())return a;e.nodes().forEach(function(e){s.add(e,1/0),a.setNode(e)}),s.decrease(e.nodes()[0],0);for(var l=!1;s.size()>0;){if(Object.hasOwn(i,o=s.removeMin()))a.setEdge(o,i[o]);else{if(l)throw Error("Input graph is not connected: "+e);l=!0}e.nodeEdges(o).forEach(d)}return a}}),_=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 i=!1,s=e.nodes(),d=0;d<s.length;d++){for(var l=a(s[d]),c=0;c<l.length;c++){var u=l[c],h=u.v===s[d]?u.v:u.w,p=h===u.v?u.w:u.v;0>o({v:h,w:p})&&(i=!0)}if(i)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:p(),extractPath:f(),findCycles:v(),floydWarshall:m(),isAcyclic:w(),postorder:E(),preorder:k(),prim:j(),shortestPaths:_(),reduce:b(),tarjan:g(),topsort:y()}}),N=s();t.exports={Graph:N.Graph,json:d(),alg:C(),version:N.version}}),i=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(", ")+"]"}}}),s=o((e,t)=>{var r=a().Graph,n=i();t.exports=function(e,t){var a,i;let l,c,u,h,p;if(1>=e.nodeCount())return[];let f=(a=e,i=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=i(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),p=c+1,l.nodes().forEach(e=>{d(h,p,l.node(e))}),{graph:l,buckets:h,zeroIdx:p});return(function(e,t,r){let n=[],o=t[t.length-1],a=t[0],i;for(;e.nodeCount();){for(;i=a.dequeue();)s(e,t,r,i);for(;i=o.dequeue();)s(e,t,r,i);if(e.nodeCount()){for(let o=t.length-2;o>0;--o)if(i=t[o].dequeue()){n=n.concat(s(e,t,r,i,!0));break}}}return n})(f.graph,f.buckets,f.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w))};var o=()=>1;function s(e,t,r,n,o){let a=o?[]:void 0;return e.inEdges(n.v).forEach(n=>{let i=e.edge(n),s=e.node(n.v);o&&a.push({v:n.v,w:n.w}),s.out-=i,d(t,r,s)}),e.outEdges(n.v).forEach(n=>{let o=e.edge(n),a=n.w,i=e.node(a);i.in-=o,d(t,r,i)}),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(i(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,i=t.x-o,s=t.y-a,d=e.width/2,l=e.height/2;if(!i&&!s)throw Error("Not possible to find intersection inside of the rectangle");return Math.abs(s)*d>Math.abs(i)*l?(s<0&&(l=-l),r=l*i/s,n=l):(i<0&&(d=-d),r=d,n=d*s/i),{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:i,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 i(e){return o(Math.max,e.nodes().map(t=>{let r=e.node(t).rank;return void 0===r?5e-324:r}))}var s=0;function d(e){return e+""+ ++s}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=s(),n=d().uniqueId;t.exports={run:function(e){var t,o;let a,i,s;("greedy"===e.graph().acyclicer?r(e,(t=e,e=>t.edge(e).weight)):(a=[],i={},s={},(o=e).nodes().forEach(function e(t){Object.hasOwn(s,t)||(s[t]=!0,i[t]=!0,o.outEdges(t).forEach(t=>{Object.hasOwn(i,t.w)?a.push(t):e(t.w)}),delete i[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,i=t.v,s=e.node(i).rank,d=t.w,l=e.node(d).rank,c=t.name,u=e.edge(t),h=u.labelRank;if(l!==s+1){for(e.removeEdge(t),a=0,++s;s<l;++a,++s)u.points=[],o={width:0,height:0,edgeLabel:u,edgeObj:t,rank:s},n=r.addDummyNode(e,"edge",o,"_d"),s===h&&(o.width=u.width,o.height=u.height,o.dummy="edge-label",o.labelpos=u.labelpos),e.setEdge(i,n,{weight:u.weight},c),0===a&&e.graph().dummyChains.push(n),i=n;e.setEdge(i,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 i=r(Math.min,e.outEdges(o).map(t=>null==t?1/0:n(t.w)-e.edge(t).minlen));return i===1/0&&(i=0),a.rank=i})},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,i,s=new r({directed:!1}),d=e.nodes()[0],l=e.nodeCount();for(s.setNode(d,{});t=s,o=e,t.nodes().forEach(function e(r){o.nodeEdges(r).forEach(a=>{var i=a.v,s=r===i?a.w:i;t.hasNode(s)||n(o,a)||(t.setNode(s,{}),t.setEdge(r,s,{}),e(s))})}),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]}(s,e),i=s.hasNode(a.v)?n(e,a):-n(e,a),function(e,t,r){e.nodes().forEach(e=>t.node(e).rank+=r)}(s,e,i);return s}}),p=o((e,t)=>{var r=h(),n=u().slack,o=u().longestPath,i=a().alg.preorder,s=a().alg.postorder,l=d().simplify;function c(e){o(e=l(e));var t,n,a=r(e);for(g(a),p(a,e);t=v(a);)n=m(a,e,t),y(a,e,t,n)}function p(e,t){var r=s(e,e.nodes());(r=r.slice(0,r.length-1)).forEach(r=>{var n,o,a,i;return n=e,o=t,a=r,i=n.node(a).parent,void(n.edge(a,i).cutvalue=f(n,o,a))})}function f(e,t,r){var n=e.node(r).parent,o=!0,a=t.edge(r,n),i=0;return a||(o=!1,a=t.edge(n,r)),i=a.weight,t.nodeEdges(r).forEach(a=>{var s=a.v===r,d=s?a.w:a.v;if(d!==n){var l,c,u,h=s===o,p=t.edge(a).weight;if(i+=h?p:-p,l=e,c=r,u=d,l.hasEdge(c,u)){var f=e.edge(r,d).cutvalue;i+=h?-f:f}}}),i}function g(e,t){arguments.length<2&&(t=e.nodes()[0]),function e(t,r,n,o,a){var i=n,s=t.node(o);return r[o]=!0,t.neighbors(o).forEach(a=>{Object.hasOwn(r,a)||(n=e(t,r,n,a,o))}),s.low=i,s.lim=n++,a?s.parent=a:delete s.parent,n}(e,{},1,t)}function v(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function m(e,t,r){var o=r.v,a=r.w;t.hasEdge(o,a)||(o=r.w,a=r.v);var i=e.node(o),s=e.node(a),d=i,l=!1;return i.lim>s.lim&&(d=s,l=!0),t.edges().filter(t=>l===w(e,e.node(t.v),d)&&l!==w(e,e.node(t.w),d)).reduce((e,r)=>n(t,r)<n(t,e)?r:e)}function y(e,t,r,n){var o,a,s,d,l=r.v,c=r.w;e.removeEdge(l,c),e.setEdge(n.v,n.w,{}),g(e),p(e,t),o=e,a=t,s=o.nodes().find(e=>!a.node(e).parent),(d=(d=i(o,s)).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 w(e,t,r){return r.low<=t.lim&&t.lim<=r.lim}t.exports=c,c.initLowLimValues=g,c.initCutValues=p,c.calcCutValue=f,c.leaveEdge=v,c.enterEdge=m,c.exchangeEdges=y}),f=o((e,t)=>{var r=u().longestPath,n=h(),o=p();t.exports=function(e){var t,i=e.graph().ranker;if(i instanceof Function)return i(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=[],i=Math.min(t[r].low,t[n].low),s=Math.max(t[r].lim,t[n].lim),d,l;d=r;do o.push(d=e.parent(d));while(d&&(t[d].low>i||s>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),i=a.path,s=a.lca,d=0,l=i[0],c=!0;for(;t!==n.w;){if(r=e.node(t),c){for(;(l=i[d])!==s&&e.node(l).maxRank<r.rank;)d++;l===s&&(c=!1)}if(!c){for(;d<i.length-1&&e.node(l=i[d+1]).minRank<=r.rank;)d++;l=i[d]}e.setParent(t,l),t=e.successors(t)[0]}})}}),v=o((e,t)=>{var r=d();t.exports={run:function(e){var t,n,o;let a=r.addDummyNode(e,"root",{},"_root"),i=(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),s=Object.values(i),d=r.applyWithChunking(Math.max,s)-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,i,s,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,i,s,r);let l=t.node(r),h=l.borderTop?l.borderTop:r,p=l.borderBottom?l.borderBottom:r,f=l.borderTop?a:2*a,g=h!==p?1:i-s[d]+1;t.setEdge(c,h,{weight:f,minlen:g,nestingEdge:!0}),t.setEdge(p,u,{weight:f,minlen:g,nestingEdge:!0})}),t.parent(d)||t.setEdge(n,c,{weight:0,minlen:i+s[d]})})(e,a,l,c,d,i,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)})}}}),m=o((e,t)=>{var r=d();function n(e,t,n,o,a,i){let s=a[t][i-1],d=r.addDummyNode(e,"border",{width:0,height:0,rank:i,borderType:t},n);a[t][i]=d,e.setParent(d,o),s&&e.setEdge(s,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)}})}}),y=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 i=e.graph().rankdir.toLowerCase();("bt"===i||"rl"===i)&&((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"===i||"rl"===i)&&((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))}}}),w=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),i=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,i[e.node(n).rank].push(n),e.successors(n).forEach(r))}),i}}),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)),i=1;for(;i<n.length;)i<<=1;let s=2*i-1;i-=1;let d=Array(s).fill(0),l=0;return a.forEach(e=>{let t=e.pos+i;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}}),x=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")),i=a.lhs,s=a.rhs.sort((e,t)=>t.i-e.i),d=[],l=0,c=0,u=0;i.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,s,u),i.forEach(e=>{u+=e.vs.length,d.push(e.vs),l+=e.barycenter*e.weight,c+=e.weight,u=n(d,s,u)});let h={vs:d.flat(!0)};return c&&(h.barycenter=l/c,h.weight=c),h}}),j=o((e,t)=>{var r=x(),n=E(),o=k();t.exports=function e(t,a,i,s){var d,l;let c=t.children(a),u=t.node(a),h=u?u.borderLeft:void 0,p=u?u.borderRight:void 0,f={};h&&(c=c.filter(e=>e!==h&&e!==p));let g=r(t,c);g.forEach(r=>{if(t.children(r.v).length){var n,o;let a=e(t,r.v,i,s);f[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 v=n(g,i);d=v,l=f,d.forEach(e=>{e.vs=e.vs.flatMap(e=>l[e]?l[e].vs:e)});let m=o(v,s);if(h&&(m.vs=[h,m.vs,p].flat(!0),t.predecessors(h).length)){let e=t.node(t.predecessors(h)[0]),r=t.node(t.predecessors(p)[0]);Object.hasOwn(m,"barycenter")||(m.barycenter=0,m.weight=0),m.barycenter=(m.barycenter*m.weight+e.order+r.order)/(m.weight+2),m.weight+=2}return m}}),_=o((e,t)=>{var r=a().Graph,n=d();t.exports=function(e,t,o,a){a||(a=e.nodes());let i=function(e){for(var t;e.hasNode(t=n.uniqueId("_root")););return t}(e),s=new r({compound:!0}).setGraph({root:i}).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)&&(s.setNode(r),s.setParent(r,a||i),e[o](r).forEach(t=>{let n=t.v===r?t.w:t.v,o=s.edge(n,r),a=void 0!==o?o.weight:0;s.setEdge(n,r,{weight:e.edge(t).weight+a})}),Object.hasOwn(n,"minRank")&&s.setNode(r,{borderLeft:n.borderLeft[t],borderRight:n.borderRight[t]}))}),s}}),C=o((e,t)=>{t.exports=function(e,t,r){let n={},o;r.forEach(r=>{let a=e.parent(r),i,s;for(;a;){if((i=e.parent(a))?(s=n[i],n[i]=a):(s=o,o=a),s&&s!==a)return void t.setEdge(s,a);a=i}})}}),N=o((e,t)=>{var r=w(),n=b(),o=j(),i=_(),s=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 i(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 i=c.maxRank(t),d=u(t,c.range(1,i+1),"inEdges"),p=u(t,c.range(i-1,-1,-1),"outEdges"),f=r(t);if(h(t,f),a.disableOptimalOrderHeuristic)return;let g=1/0,v,m=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,i=o(e,a,n,t);i.vs.forEach((t,r)=>e.node(t).order=r),s(e,n,i.vs)})})(e%2?d:p,e%4>=2,m),f=c.buildLayerMatrix(t);let a=n(t,f);a<g?(r=0,v=Object.assign({},f),g=a):a===g&&(v=structuredClone(f))}h(t,v)}}),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,i=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:i;(c||t===d)&&(n.slice(a,l+1).forEach(t=>{e.predecessors(t).forEach(n=>{let a=e.node(n),i=a.order;(i<o||u<i)&&!(a.dummy&&e.node(t).dummy)&&s(r,n,t)})}),a=l+1,o=u)}),n}),r}function i(e,t){let r={};function o(t,o,a,i,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<i||n.order>d)&&s(r,t,l)})})}return t.length&&t.reduce(function(t,r){let n=-1,a,i=0;return r.forEach((s,d)=>{if("border"===e.node(s).dummy){let t=e.predecessors(s);t.length&&(a=e.node(t[0]).order,o(r,i,d,n,a),i=d,n=a)}o(r,i,r.length,a,t.length)}),r}),r}function s(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={},i={};return t.forEach(e=>{e.forEach((e,t)=>{o[e]=e,a[e]=e,i[e]=t})}),t.forEach(e=>{let t=-1;e.forEach(e=>{let s=n(e);if(s.length){let n=((s=s.sort((e,t)=>i[e]-i[t])).length-1)/2;for(let d=Math.floor(n),c=Math.ceil(n);d<=c;++d){let n=s[d];a[e]===e&&t<i[n]&&!l(r,e,n)&&(a[n]=e,a[e]=o[e]=o[n],t=i[n])}}})}),{root:o,align:a}}function u(e,t,n,o,a){var i,s,d,l,c,u,h;let p,f,g,v={},m=(i=e,s=t,d=n,l=a,p=new r,g=(c=(f=i.graph()).nodesep,u=f.edgesep,h=l,(e,t,r)=>{let n=e.node(t),o=e.node(r),a,i;if(a=0+n.width/2,Object.hasOwn(n,"labelpos"))switch(n.labelpos.toLowerCase()){case"l":i=-n.width/2;break;case"r":i=n.width/2}if(i&&(a+=h?i:-i),i=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":i=o.width/2;break;case"r":i=-o.width/2}return i&&(a+=h?i:-i),i=0,a}),s.forEach(e=>{let t;e.forEach(e=>{let r=d[e];if(p.setNode(r),t){var n=d[t],o=p.edge(n,r);p.setEdge(n,r,Math.max(g(i,e,t),o||0))}t=e})}),p),y=a?"borderLeft":"borderRight";function w(e,t){let r=m.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 w(function(e){v[e]=m.inEdges(e).reduce((e,t)=>Math.max(e,v[t.v]+m.edge(t)),0)},m.predecessors.bind(m)),w(function(t){let r=m.outEdges(t).reduce((e,t)=>Math.min(e,v[t.w]-m.edge(t)),1/0),n=e.node(t);r!==1/0&&n.borderType!==y&&(v[t]=Math.max(v[t],r))},m.successors.bind(m)),Object.keys(o).forEach(e=>v[e]=v[n[e]]),v}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,i;let s=(a=e,i=t,a.node(i).width/2);n=Math.max(r+s,n),o=Math.min(r-s,o)});let a=n-o;return a<t[0]&&(t=[a,r]),t},[1/0,null])[1]}function p(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(i=>{let s=r+i,d=e[s];if(d===t)return;let l=Object.values(d),c=o-n.applyWithChunking(Math.min,l);"l"!==i&&(c=a-n.applyWithChunking(Math.max,l)),c&&(e[s]=n.mapValues(d,e=>e+c))})})}function f(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),i(e,t)),a={},s;["u","d"].forEach(o=>{s="u"===o?t:Object.values(t).reverse(),["l","r"].forEach(t=>{"r"===t&&(s=s.map(e=>Object.values(e).reverse()));let i=("u"===o?e.predecessors:e.successors).bind(e),d=c(e,s,r,i),l=u(e,s,d.root,d.align,"r"===t);"r"===t&&(l=n.mapValues(l,e=>-e)),a[o+t]=l})});let d=h(e,a);return p(a,d),f(a,e.graph().align)},findType1Conflicts:o,findType2Conflicts:i,addConflict:s,hasConflict:l,verticalAlignment:c,horizontalCompaction:u,alignCoordinates:p,findSmallestWidthAlignment:h,balance:f}}),M=o((e,t)=>{var r=d(),n=O().positionX;t.exports=function(e){var t;let o,a,i,s;t=e=r.asNonCompoundGraph(e),o=r.buildLayerMatrix(t),a=t.graph().ranksep,i=t.graph().rankalign,s=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"===i?n.y=s+n.height/2:"bottom"===i?n.y=s+r-n.height/2:n.y=s+r/2}),s+=r+a}),Object.entries(n(e)).forEach(([t,r])=>e.node(t).x=r)}}),R=o((e,t)=>{var r=l(),n=c(),o=f(),i=d().normalizeRanks,s=g(),u=d().removeEmptyRanks,h=v(),p=m(),w=y(),b=N(),x=M(),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=D(t.graph()),r.setGraph(Object.assign({},_,T(n,j),E.pick(n,C))),t.nodes().forEach(e=>{let n=T(D(t.node(e)),O);Object.keys(R).forEach(e=>{void 0===n[e]&&(n[e]=R[e])}),r.setNode(e,n),r.setParent(e,t.parent(e))}),t.edges().forEach(e=>{let n=D(t.edge(e));r.setEdge(e,Object.assign({},S,T(n,P),E.pick(n,L)))}),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",()=>i(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",()=>s(e)),l(" addBorderSegments",()=>p(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",()=>w.adjust(e)),l(" position",()=>x(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,i=r.x-o,s=n.height/2;t.setEdge(r.e,r.label),t.removeNode(e),r.label.points=[{x:o+2*i/3,y:a-s},{x:o+5*i/6,y:a-s},{x:o+i,y:a},{x:o+5*i/6,y:a+s},{x:o+2*i/3,y:a+s}],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]),i=t.node(r.borderRight[r.borderRight.length-1]);r.width=Math.abs(i.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",()=>w.undo(e)),l(" translateGraph",()=>(function(e){let t=1/0,r=0,n=1/0,o=0,a=e.graph(),i=a.marginx||0,s=a.marginy||0;function d(e){let a=e.x,i=e.y,s=e.width,d=e.height;t=Math.min(t,a-s/2),r=Math.max(r,a+s/2),n=Math.min(n,i-d/2),o=Math.max(o,i+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-=i,n-=s,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+i,a.height=o-n+s})(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,i;r.points?(a=r.points[0],i=r.points[r.points.length-1]):(r.points=[],a=o,i=n),r.points.unshift(E.intersectRect(n,a)),r.points.push(E.intersectRect(o,i))})}),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"],_={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb",rankalign:"center"},C=["acyclicer","ranker","rankdir","align","rankalign"],O=["width","height","rank"],R={width:0,height:0},P=["minlen","weight","width","height","labeloffset"],S={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},L=["labelpos"];function T(e,t){return E.mapValues(E.pick(e,t),Number)}function D(e){var t={};return e&&Object.entries(e).forEach(([e,r])=>{"string"==typeof e&&(e=e.toLowerCase()),t[e]=r}),t}}),P=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}}}),S=o((e,t)=>{t.exports="2.0.4"});let L=o((e,t)=>{t.exports={graphlib:a(),layout:R(),debug:P(),util:{time:d().time,notime:d().notime},version:S()}})(),T={direction:"LR",ranksep:200,nodesep:15},D={featureNode:{width:288,height:140},repositoryNode:{width:328,height:50}};function I(e,t){let r=e.data;return r&&"number"==typeof r.width&&"number"==typeof r.height?{width:r.width,height:r.height}:D[e.type??""]??t}function F(e,t,r={}){let{direction:n="TB",nodeSize:o={width:172,height:36},ranksep:a=80,nodesep:i=30}=r;if(0===e.length)return{nodes:[],edges:[]};let s=new L.graphlib.Graph({multigraph:!0});s.setDefaultEdgeLabel(()=>({})),s.setGraph({rankdir:n,ranksep:a,nodesep:i});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=I(e,o);s.setNode(e.id,{width:t.width,height:t.height})}for(let e of t)s.hasNode(e.source)&&s.hasNode(e.target)&&s.setEdge(e.source,e.target,{},e.id);L.layout(s);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),p="LR"===n||"RL"===n,f=new Map;for(let e of l){let t=s.node(e.id),r=I(e,o);f.set(e.id,{cx:t.x,cy:t.y,w:r.width,h:r.height})}let g=new Map;for(let e of t)f.has(e.source)&&f.has(e.target)&&(g.has(e.source)||g.set(e.source,[]),g.get(e.source).push(e.target));let v=new Map;for(let e=0;e<l.length;e++)v.set(l[e].id,e);for(let[,e]of g)e.sort((e,t)=>(v.get(e)??0)-(v.get(t)??0));let m=new Set;for(let e of g.values())for(let t of e)m.add(t);let y=[...new Set(f.keys())].filter(e=>!m.has(e)),w=new Map;for(let e of y)!function e(t){if(w.has(t))return w.get(t);let r=f.get(t),n=p?r.h:r.w,o=g.get(t);if(!o||0===o.length)return w.set(t,n),n;let a=0;for(let t of o)a+=e(t);let s=Math.max(n,a+=(o.length-1)*i);return w.set(t,s),s}(e);let b=0;for(let e of y){let t=w.get(e)??0;!function e(t,r){let n=f.get(t);p?n.cy=r:n.cx=r;let o=g.get(t);if(!o||0===o.length)return;let a=0;for(let e of o)a+=w.get(e)??0;let s=r-(a+=(o.length-1)*i)/2;for(let t of o){let r=w.get(t)??0;e(t,s+r/2),s+=r+i}}(e,b+t/2),b+=t+i}let x=[];for(let e of l){let t=f.get(e.id);x.push({...e,targetPosition:u,sourcePosition:h,position:{x:t.cx-t.w/2,y:t.cy-t.h/2}})}if(c.length>0){let e=0,t=1/0;for(let r of x){let n=I(r,o);e=Math.max(e,r.position.y+n.height),t=Math.min(t,r.position.x)}t===1/0&&(t=0);for(let r=0;r<c.length;r++){let n=c[r],a=I(n,o);x.push({...n,targetPosition:u,sourcePosition:h,position:{x:t,y:e+30+r*(a.height+20)}})}}return{nodes:x,edges:[...t]}}var A=e.i(40204),$=e.i(21023);let z=(0,$.createServerReference)("40255adebc2e1db4806f644bc86394b9684e562879",$.callServer,void 0,$.findSourceMapURL,"addRepository"),G=(0,$.createServerReference)("40873135ec09f8d43dc24cbe4af0ea0deb1515e75c",$.callServer,void 0,$.findSourceMapURL,"deleteRepository"),B=(0,$.createServerReference)("407814583d0971dabb8e9aec84c6300a591a9ac18c",$.callServer,void 0,$.findSourceMapURL,"getFeatureMetadata"),q=(0,$.createServerReference)("005b53e9609c26a223a61791736e84fefeeca5a681",$.callServer,void 0,$.findSourceMapURL,"fetchGraphData");var W=e.i(39443),V=e.i(8361),U=e.i(18354),H=e.i(99045);function X(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)}let Y=(0,U.createLogger)("[Polling]"),J=0,Q=0;function Z(e,o){let a=(0,r.useRouter)(),i=(0,V.useSoundAction)("delete"),s=(0,V.useSoundAction)("create"),{nodes:d,edges:l,reconcile:c,updateFeature:u,addPendingFeature:h,removeFeature:p,restoreFeature:f,addRepository:g,removeRepository:v,replaceRepository:m,getFeatureRepositoryPath:y,getRepositoryData:w,getRepoMapSize:b,setCallbacks:x}=function(e,r){let n=(0,t.useMemo)(()=>X(e,r),[]),[o,a]=(0,t.useState)(n.featureMap),[i,s]=(0,t.useState)(n.repoMap),[d,l]=(0,t.useState)(new Map),c=(0,t.useRef)(new Map),u=(0,t.useRef)({}),h=(0,t.useMemo)(()=>({onNodeAction:e=>u.current.onNodeAction?.(e),onNodeSettings:e=>u.current.onNodeSettings?.(e),onFeatureDelete:e=>u.current.onFeatureDelete?.(e),onRepositoryAdd:e=>u.current.onRepositoryAdd?.(e),onRepositoryClick:e=>u.current.onRepositoryClick?.(e),onRepositoryDelete:e=>u.current.onRepositoryDelete?.(e)}),[]),p=(0,t.useRef)(o);p.current=o;let f=(0,t.useRef)(i);f.current=i;let g=(0,t.useMemo)(()=>(function(e,t,r,n){let o=[],a=[],i=new Map;for(let[e,r]of t)r.data.repositoryPath&&i.set(r.data.repositoryPath,e);let s=new Map;for(let[e,r]of t){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,d,l]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"===d.data.state||l,r={...d.data,...!e&&n?.onNodeAction&&{onAction:()=>n.onNodeAction(t)},...!e&&n?.onNodeSettings&&{onSettings:()=>n.onNodeSettings(t)},...!e&&n?.onFeatureDelete&&{onDelete:n.onFeatureDelete}};if(o.push({id:t,type:"featureNode",position:{x:0,y:0},data:r}),d.parentNodeId)a.push({id:`dep-${d.parentNodeId}-${t}`,source:d.parentNodeId,target:t,type:"dependencyEdge"});else{let e=d.data.repositoryPath,r=i.get(e)??function(e){if(s.has(e))return s.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}}),s.set(e,t),t}(e);a.push({id:`edge-${r}-${t}`,source:r,target:t,style:{strokeDasharray:"5 5"}})}}let d=a.length>0;for(let e of o)e.data.showHandles=d;return{nodes:o,edges:a}})(o,i,d,h),[o,i,d,h]),v=(0,t.useRef)({key:"",positions:new Map}),{nodes:m,edges:y}=(0,t.useMemo)(()=>{let e=g.nodes.map(e=>e.id).sort().join(","),t=g.edges.map(e=>`${e.source}-${e.target}`).sort().join(","),r=`${e}|${t}`;if(r!==v.current.key){let e=F(g.nodes,g.edges,T),t=new Map;for(let r of e.nodes)t.set(r.id,{position:r.position,targetPosition:r.targetPosition,sourcePosition:r.sourcePosition});return v.current={key:r,positions:t},e}let{positions:n}=v.current;return{nodes:g.nodes.map(e=>{let t=n.get(e.id);return t?{...e,...t}:e}),edges:g.edges}},[g]),w=(0,t.useCallback)((e,t)=>{let{featureMap:r,repoMap:n}=X(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)}for(let[e,t]of c.current){let r=n.get(e);r&&(n.set(e,{...r,data:{...r.data,...t}}),c.current.delete(e))}return 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}),s(n)},[]),b=(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})},[]),x=(0,t.useCallback)((e,t,r)=>{l(n=>{let o=new Map(n);return o.set(e,{nodeId:e,data:t,parentNodeId:r}),o})},[]),E=(0,t.useCallback)(e=>{l(t=>{if(!t.has(e))return t;let r=new Map(t);return r.delete(e),r})},[]),k=(0,t.useCallback)(e=>{a(t=>{if(!t.has(e))return t;let r=new Map(t);return r.delete(e),r})},[]),j=(0,t.useCallback)((e,t)=>{a(r=>{let n=new Map(r);return n.set(e,t),n})},[]),_=(0,t.useCallback)((e,t)=>{s(r=>{let n=new Map(r);return n.set(e,{nodeId:e,data:t}),n})},[]),C=(0,t.useCallback)(e=>{s(t=>{if(!t.has(e))return t;let r=new Map(t);return r.delete(e),r})},[]),N=(0,t.useCallback)((e,t,r)=>{s(n=>{if(!n.has(e))return n;let o=new Map(n);return o.delete(e),o.set(t,{nodeId:t,data:r}),o})},[]),O=(0,t.useCallback)(e=>p.current.get(e)?.data.repositoryPath,[]),M=(0,t.useCallback)(e=>f.current.get(e)?.data,[]);return{nodes:m,edges:y,reconcile:w,updateFeature:b,addPendingFeature:x,removePendingFeature:E,removeFeature:k,restoreFeature:j,addRepository:_,removeRepository:C,replaceRepository:N,getFeatureRepositoryPath:O,getRepositoryData:M,getRepoMapSize:(0,t.useCallback)(()=>f.current.size,[]),setCallbacks:(0,t.useCallback)(e=>{u.current=e},[])}}(e,o),E=(0,t.useRef)(d),k=(0,t.useRef)(l);(0,t.useEffect)(()=>{E.current=d,k.current=l},[d,l]);let j=(0,t.useMemo)(()=>e.map(e=>e.id).sort().join(","),[e]),_=(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]),C=(0,t.useRef)("");(0,t.useEffect)(()=>{let t=`${j}|${_}`;t!==C.current&&(C.current=t,c(e,o))},[j,_,e,o,c]);let N=(0,t.useRef)(new Map),{events:O}=(0,W.useAgentEventsContext)();(0,t.useEffect)(()=>{let t=N.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&&(O.some(t=>t.featureId===e.featureId&&(0,H.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)}},[_,e,O,a]);let M=(0,t.useRef)(0);(0,t.useEffect)(()=>{if(M.current>O.length&&(M.current=0),O.length<=M.current)return;let e=O.slice(M.current);for(let{featureId:t,state:r,lifecycle:n}of(M.current=O.length,(0,H.resolveSseEventUpdates)(e)))(void 0!==r||void 0!==n)&&u(`feat-${t}`,{...void 0!==r&&{state:r},...void 0!==n&&{lifecycle:n}})},[O,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 R=(0,t.useRef)(new Set),P=(0,t.useRef)(0);(0,t.useEffect)(()=>{if(P.current>O.length&&(P.current=0),O.length<=P.current)return;let e=O.slice(P.current);for(let t of(P.current=O.length,e)){if("Feature metadata updated"!==t.message||R.current.has(t.featureId))continue;R.current.add(t.featureId);let e=`feat-${t.featureId}`;B(t.featureId).then(t=>{t&&u(e,{name:t.name,description:t.description})}).catch(()=>{})}},[O,u]),(0,t.useEffect)(()=>{Y.debug("polling enabled (3000ms interval)");let e=setInterval(async()=>{try{let{nodes:e,edges:t}=await q();c(e,t)}catch{Y.warn("poll fetch failed — will retry next interval")}},3e3);return()=>{Y.debug("polling disabled"),clearInterval(e)}},[c]);let S=(0,t.useCallback)(e=>{},[]),L=(0,t.useCallback)(e=>{},[]),D=(0,t.useCallback)((e,t,r)=>{let n=t?.featureId?`feat-${t.featureId}`:`feature-${Date.now()}-${J++}`,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]),I=(0,t.useCallback)((e,t)=>{let r=`feat-${e}`,o=E.current.filter(e=>e.id===r).map(e=>({nodeId:e.id,data:e.data}))[0];p(r),i.play(),n.toast.success("Feature deleted successfully"),a.push("/"),(0,A.deleteFeature)(e,t).then(e=>{e.error&&(o&&f(r,o),n.toast.error(e.error))}).catch(()=>{o&&f(r,o),n.toast.error("Failed to delete feature")})},[a,i,p,f]),$=(0,t.useCallback)(async e=>{let t=`repo-${e}`,r=new Set(k.current.filter(e=>e.source===t).map(e=>e.target)),o=w(t),a=new Map;for(let e of r){let t=E.current.find(t=>t.id===e);t&&a.set(e,{nodeId:e,data:t.data})}let s=()=>{for(let[e,r]of(o&&g(t,o),a))f(e,r)};for(let e of(v(t),r))p(e);try{let t=await G(e);if(!t.success){n.toast.error(t.error??"Failed to remove repository"),s();return}i.play(),n.toast.success("Repository removed")}catch{n.toast.error("Failed to remove repository"),s()}},[i,v,p,g,f,w]),U=(0,t.useCallback)(e=>{let t=F(E.current,k.current,{...T,direction:e});c(t.nodes,t.edges)},[c]);return{nodes:d,edges:l,onNodesChange:S,handleConnect:L,handleAddRepository:(0,t.useCallback)(e=>{let t=0===b(),r=`repo-temp-${++Q}`,o=e.replace(/[\\/]+$/,"").split(/[\\/]/).pop()??e;return g(r,{name:o,repositoryPath:e,id:r}),z({path:e,name:o}).then(e=>{if(e.error){v(r),n.toast.error(e.error);return}let t=e.repository;m(r,`repo-${t.id}`,{name:t.name,repositoryPath:t.path,id:t.id}),s.play()}).catch(()=>{v(r),n.toast.error("Failed to add repository")}),{wasEmpty:t,repoPath:e}},[g,v,m,s,b]),handleLayout:U,handleDeleteFeature:I,handleDeleteRepository:$,createFeatureNode:D,getFeatureRepositoryPath:y,getRepositoryData:w,setCallbacks:x}}e.s(["useControlCenterState",()=>Z],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),i=e.i(3645);let s=(0,i.default)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);var d=e.i(35364);e.i(54793);var l=e.i(7729);e.i(47506);var c=e.i(89313),u=e.i(92002);let h=(0,i.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),f=e.i(38573),g=e.i(19933),v=e.i(67669),m=e.i(24042),y=e.i(64970),w=e.i(31777);e.i(81803);var b=e.i(72714),x=e.i(2287),E=e.i(2828);e.i(99348);var k=e.i(17466),j=e.i(8537),_=e.i(75921),C=e.i(76852);function N({data:e}){let o=(0,_.useFeatureFlags)(),[i,s]=(0,n.useState)(!1),l=(0,C.useRepositoryActions)(e.repositoryPath?{repositoryPath:e.repositoryPath}:null),c=(0,j.useDeployAction)(e.repositoryPath?{targetId:e.repositoryPath,targetType:"repository",repositoryPath:e.repositoryPath}:null),N="Booting"===c.status||"Ready"===c.status;return(0,t.jsxs)("div",{className:(0,w.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(),s(!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)(x.Dialog,{open:i,onOpenChange:s,children:(0,t.jsxs)(x.DialogContent,{className:"max-w-xs",children:[(0,t.jsxs)(x.DialogHeader,{children:[(0,t.jsx)(x.DialogTitle,{children:"Remove repository?"}),(0,t.jsxs)(x.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)(x.DialogFooter,{className:"grid grid-cols-2 gap-2 sm:flex-none",children:[(0,t.jsx)(x.DialogClose,{asChild:!0,children:(0,t.jsx)(d.Button,{variant:"outline",children:"Cancel"})}),(0,t.jsx)(d.Button,{variant:"destructive",onClick:()=>{s(!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)(h,{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,w.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:l.openInIde,loading:l.ideLoading,error:!!l.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:l.openInShell,loading:l.shellLoading,error:!!l.shellError,icon:f.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:l.openFolder,loading:l.folderLoading,error:!!l.folderError,icon:g.FolderOpen,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(E.TooltipContent,{children:"Open Folder"})]})}),o.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:N?"Stop Dev Server":"Start Dev Server",onClick:N?c.stop:c.deploy,loading:c.deployLoading||c.stopLoading,error:!!c.deployError,icon:N?y.Square:m.Play,iconOnly:!0,variant:"ghost",size:"icon-xs"})})}),(0,t.jsx)(E.TooltipContent,{children:N?"Stop Dev Server":"Start Dev Server"})]})}),N?(0,t.jsx)(k.DeploymentStatusBadge,{status:c.status,url:c.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:"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",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 O(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 R({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,{style:{fill:"none"}})})}function P({nodes:e,edges:o,selectedFeatureId:i,defaultViewport:s,onNodesChange:u,onAddFeature:h,onConnect:p,onNodeClick:f,onPaneClick:g,onCanvasDrag:v,onMoveEnd:m,onResetViewport:y,toolbar:w,emptyState:b}){let x=(0,n.useMemo)(()=>({featureNode:c.FeatureNode,repositoryNode:N}),[]),E=(0,n.useMemo)(()=>({dependencyEdge:O}),[]),k=(0,n.useMemo)(()=>null==i?e:e.map(e=>"featureNode"===e.type&&e.data.featureId===i?{...e,selected:!0}:e),[e,i]);return 0===e.length?b?(0,t.jsx)("div",{"data-testid":"features-canvas-empty",className:"h-full w-full",children:b}):(0,t.jsx)("div",{"data-testid":"features-canvas-empty",children:(0,t.jsx)(l.EmptyState,{title:"No features yet",description:"Get started by creating your first feature.",action:(0,t.jsxs)(d.Button,{onClick:h,children:[(0,t.jsx)(a.Plus,{className:"mr-2 h-4 w-4"}),"New Feature"]})})}):(0,t.jsx)("div",{"data-testid":"features-canvas","data-no-drawer-close":!0,className:"pointer-events-auto h-full w-full",children:(0,t.jsxs)(r.ReactFlow,{nodes:k,edges:o,nodeTypes:x,edgeTypes:E,onConnect:p,onNodesChange:u,onNodeClick:f,onPaneClick:g,onMoveStart:v,onMoveEnd:m,defaultViewport:s??M,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,proOptions:{hideAttribution:!0},children:[(0,t.jsx)(r.Background,{}),(0,t.jsx)(r.Controls,{showInteractive:!1,children:y?(0,t.jsx)(R,{onResetViewport:y}):null}),w]})})}var S=e.i(5147),L=e.i(8361),T=e.i(30153);let D="shep-canvas-viewport",I={x:30,y:30,zoom:.85},F=(0,i.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 A=e.i(33548),$=e.i(23925),z=e.i(83428),G=e.i(78521);let B=["cd ~/my-repo",'shep feat new "create modern, sleek dashboards"'];function q({onRepositorySelect:e,className:r}){let[o,i]=(0,n.useState)(!1),[s,d]=(0,n.useState)(!1);async function l(){if(!s){d(!0);try{let t=await (0,G.pickFolder)();t&&e?.(t)}finally{d(!1)}}}let c=(0,n.useCallback)(async()=>{await navigator.clipboard.writeText(B.join("\n")),i(!0),setTimeout(()=>i(!1),2e3)},[]);return(0,t.jsxs)("div",{"data-testid":"control-center-empty-state",className:(0,w.cn)("relative h-full w-full",r),children:[(0,t.jsx)("div",{className:"absolute inset-0 [background-image:radial-gradient(circle,_var(--color-border)_1px,_transparent_1px)] [background-size:24px_24px]"}),(0,t.jsxs)("div",{className:"absolute top-8 left-8 z-10",children:[(0,t.jsx)("h1",{className:"text-4xl font-bold tracking-tight",children:"Features"}),(0,t.jsx)("p",{className:"text-muted-foreground text-3xl font-light",children:"Control Center"})]}),(0,t.jsx)("div",{className:"relative z-10 flex h-full items-center justify-center",children:(0,t.jsxs)("div",{className:"flex max-w-lg flex-col items-center gap-6",children:[(0,t.jsxs)("div",{className:"text-muted-foreground flex items-center gap-2",children:[(0,t.jsx)(h,{className:"h-4 w-4"}),(0,t.jsx)("span",{className:"text-xs font-semibold tracking-widest uppercase",children:"Repositories"})]}),(0,t.jsxs)("button",{type:"button","data-testid":"empty-state-add-repository",onClick:l,disabled:s,className:"border-muted-foreground/30 hover:border-primary hover:text-primary flex cursor-pointer items-center gap-3 rounded-lg border-2 border-dashed px-8 py-4 transition-colors disabled:cursor-wait disabled:opacity-60",children:[s?(0,t.jsx)(z.Loader2,{className:"h-5 w-5 animate-spin"}):(0,t.jsx)(a.Plus,{className:"h-5 w-5"}),(0,t.jsx)("span",{className:"text-sm font-medium",children:s?"Opening...":"Add Repository"})]}),(0,t.jsxs)("div",{className:"text-muted-foreground flex items-center gap-3",children:[(0,t.jsx)("div",{className:"bg-border h-px w-16"}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(F,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{className:"text-xs font-semibold tracking-widest uppercase",children:"Or start from the command line"})]}),(0,t.jsx)("div",{className:"bg-border h-px w-16"})]}),(0,t.jsxs)("div",{"data-testid":"cli-code-block",className:"relative w-full rounded-lg bg-zinc-900 px-5 py-4 font-mono text-sm text-zinc-100",children:[(0,t.jsx)("button",{type:"button","data-testid":"cli-code-block-copy",onClick:c,className:"absolute top-3 right-3 cursor-pointer rounded p-1.5 text-zinc-400 transition-colors hover:bg-zinc-800 hover:text-zinc-200","aria-label":"Copy commands",children:o?(0,t.jsx)($.Check,{className:"h-4 w-4"}):(0,t.jsx)(A.Copy,{className:"h-4 w-4"})}),(0,t.jsx)("div",{className:"space-y-1",children:B.map(e=>(0,t.jsxs)("div",{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-sm",children:"Feature will appear on canvas once created"})]})})]})}var W=e.i(17840);let V={maxZoom:1,padding:.5,duration:500};function U({initialNodes:e,initialEdges:a}){let i,s,d,l=(0,o.useRouter)(),c=(0,o.usePathname)(),u=(i=(0,o.usePathname)().match(/^\/feature\/([^/]+)/),i?.[1]??null),h=(0,L.useSoundAction)("click"),{guardedNavigate:p}=(0,T.useDrawerCloseGuard)(),{fitView:f}=(0,r.useReactFlow)(),g=(0,n.useRef)(null),{defaultViewport:v,onMoveEnd:m,resetViewport:y}=(s=(0,n.useRef)(function(){try{let e=localStorage.getItem(D);if(null==e)return I;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:I}catch{return I}}()).current,d=(0,n.useRef)(null),(0,n.useEffect)(()=>()=>{null!=d.current&&clearTimeout(d.current)},[]),{defaultViewport:s,onMoveEnd:(0,n.useCallback)(e=>{null!=d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{try{localStorage.setItem(D,JSON.stringify(e))}catch{}},500)},[]),resetViewport:(0,n.useCallback)(()=>{try{localStorage.removeItem(D)}catch{}return I},[])}),{nodes:w,edges:b,onNodesChange:x,handleConnect:E,handleAddRepository:k,handleDeleteFeature:j,handleDeleteRepository:_,createFeatureNode:C,setCallbacks:N}=(0,W.useControlCenterState)(e,a),{setFeatures:O}=(0,S.useSidebarFeaturesContext)(),M=(0,n.useMemo)(()=>w.filter(e=>"featureNode"===e.type),[w]),R=(0,n.useMemo)(()=>M.map(e=>{let t=e.data;return`${t.featureId}:${t.state}:${t.name}`}).sort().join(","),[M]);(0,n.useEffect)(()=>{O(M.map(e=>{let t=e.data,r=(0,S.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))},[R,M,O]);let F=(0,n.useCallback)((e,t)=>{if("featureNode"===t.type){let e=t.data;"creating"!==e.state&&p(()=>{h.play(),l.push(`/feature/${e.featureId}`)})}},[l,h,p]),A=(0,n.useCallback)(()=>{h.play(),l.push("/create")},[l,h]),$=(0,n.useCallback)(e=>{h.play();let t=w.find(t=>t.id===e),r=t?.data?.repositoryPath;r?l.push(`/create?repo=${encodeURIComponent(r)}`):l.push("/create")},[w,l,h]),z=(0,n.useCallback)(e=>{let t=e.startsWith("feat-")?e.slice(5):e,r=b.find(t=>t.target===e),n=r?w.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()}`)},[w,b,l,h]),G=(0,n.useCallback)(e=>{let t=w.find(t=>t.id===e);if(t?.type==="repositoryNode"){let e=t.data;e.id&&p(()=>l.push(`/repository/${e.id}`))}},[w,l,p]),B=(0,n.useCallback)(()=>{"/"!==c&&p(()=>l.push("/"))},[l,c,p]);(0,n.useEffect)(()=>{let e=e=>{let{wasEmpty:t,repoPath:r}=k(e.detail.path);t&&setTimeout(()=>{f(V),g.current=setTimeout(()=>{p(()=>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,f,p,l]),(0,n.useEffect)(()=>{let e=e=>{let t=e.detail;if(t.parentId)return void C(`feat-${t.parentId}`,{state:"creating",featureId:t.featureId,name:t.name,description:t.description,repositoryPath:t.repositoryPath},"dependencyEdge");let r=w.find(e=>"repositoryNode"===e.type&&e.data.repositoryPath===t.repositoryPath);C(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)},[w,C]),(0,n.useEffect)(()=>{N({onNodeAction:z,onFeatureDelete:j,onRepositoryAdd:$,onRepositoryClick:G,onRepositoryDelete:_})},[N,z,j,$,G,_]);let U=(0,n.useCallback)((e,t)=>{m(t)},[m]);return w.some(e=>"repositoryNode"===e.type)?(0,t.jsx)(P,{nodes:w,edges:b,selectedFeatureId:u,defaultViewport:v,onNodesChange:x,onConnect:E,onAddFeature:A,onNodeClick:F,onPaneClick:B,onMoveEnd:U,onResetViewport:y,emptyState:(0,t.jsx)(q,{onRepositorySelect:k})}):(0,t.jsx)(q,{onRepositorySelect:k})}function H({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)(U,{initialNodes:e,initialEdges:n})}),(0,t.jsx)("div",{children:o},"drawer")]})}e.s(["ControlCenter",()=>H],48246)}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,95812,35e3,e=>{"use strict";let t=(0,e.i(3645).default)("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);e.s(["Circle",()=>t],95812);var s=e.i(80986);e.s(["CheckCircle2",()=>s.default],35e3)},33548,e=>{"use strict";let t=(0,e.i(3645).default)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);e.s(["Copy",()=>t],33548)},38573,e=>{"use strict";let t=(0,e.i(3645).default)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);e.s(["Terminal",()=>t],38573)},30702,e=>{"use strict";let t=(0,e.i(3645).default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);e.s(["ExternalLink",()=>t],30702)},81846,e=>{"use strict";var t=e.i(20314),s=e.i(94237),r=e.i(31777);let a=(0,s.cva)("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-none",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function i({className:e,variant:s,...i}){return(0,t.jsx)("div",{className:(0,r.cn)(a({variant:s}),e),...i})}e.s(["Badge",()=>i])},23925,1012,e=>{"use strict";let t=(0,e.i(3645).default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);e.s(["default",()=>t],1012),e.s(["Check",()=>t],23925)},95230,e=>{"use strict";let t=(0,e.i(3645).default)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);e.s(["default",()=>t])},87342,e=>{"use strict";var t=e.i(79054),s=e.i(22528),r=e.i(5978),a=e.i(86874),i=e.i(20314);function l(e){let l=e+"CollectionProvider",[n,o]=(0,s.createContextScope)(l),[c,d]=n(l,{collectionRef:{current:null},itemMap:new Map}),u=e=>{let{scope:s,children:r}=e,a=t.default.useRef(null),l=t.default.useRef(new Map).current;return(0,i.jsx)(c,{scope:s,itemMap:l,collectionRef:a,children:r})};u.displayName=l;let m=e+"CollectionSlot",f=(0,a.createSlot)(m),h=t.default.forwardRef((e,t)=>{let{scope:s,children:a}=e,l=d(m,s),n=(0,r.useComposedRefs)(t,l.collectionRef);return(0,i.jsx)(f,{ref:n,children:a})});h.displayName=m;let x=e+"CollectionItemSlot",p="data-radix-collection-item",g=(0,a.createSlot)(x),v=t.default.forwardRef((e,s)=>{let{scope:a,children:l,...n}=e,o=t.default.useRef(null),c=(0,r.useComposedRefs)(s,o),u=d(x,a);return t.default.useEffect(()=>(u.itemMap.set(o,{ref:o,...n}),()=>void u.itemMap.delete(o))),(0,i.jsx)(g,{...{[p]:""},ref:c,children:l})});return v.displayName=x,[{Provider:u,Slot:h,ItemSlot:v},function(s){let r=d(e+"CollectionConsumer",s);return t.default.useCallback(()=>{let e=r.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${p}]`));return Array.from(r.itemMap.values()).sort((e,s)=>t.indexOf(e.ref.current)-t.indexOf(s.ref.current))},[r.collectionRef,r.itemMap])},o]}var n=new WeakMap;function o(e,t){var s,r;let a,i,l;if("at"in Array.prototype)return Array.prototype.at.call(e,t);let n=(s=e,r=t,a=s.length,(l=(i=c(r))>=0?i:a+i)<0||l>=a?-1:l);return -1===n?void 0:e[n]}function c(e){return e!=e||0===e?0:Math.trunc(e)}(class e extends Map{#e;constructor(e){super(e),this.#e=[...super.keys()],n.set(this,!0)}set(e,t){return n.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,s){let r,a=this.has(t),i=this.#e.length,l=c(e),n=l>=0?l:i+l,o=n<0||n>=i?-1:n;if(o===this.size||a&&o===this.size-1||-1===o)return this.set(t,s),this;let d=this.size+ +!a;l<0&&n++;let u=[...this.#e],m=!1;for(let e=n;e<d;e++)if(n===e){let i=u[e];u[e]===t&&(i=u[e+1]),a&&this.delete(t),r=this.get(i),this.set(t,s)}else{m||u[e-1]!==t||(m=!0);let s=u[m?e:e-1],a=r;r=this.get(s),this.delete(s),this.set(s,a)}return this}with(t,s,r){let a=new e(this);return a.insert(t,s,r),a}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,s){let r=this.#e.indexOf(e);return -1===r?this:this.insert(r,t,s)}after(e){let t=this.#e.indexOf(e);if(-1!==(t=-1===t||t===this.size-1?-1:t+1))return this.entryAt(t)}setAfter(e,t,s){let r=this.#e.indexOf(e);return -1===r?this:this.insert(r+1,t,s)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return void 0!==t&&this.delete(t)}at(e){let t=o(this.#e,e);if(void 0!==t)return this.get(t)}entryAt(e){let t=o(this.#e,e);if(void 0!==t)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return o(this.#e,e)}from(e,t){let s=this.indexOf(e);if(-1===s)return;let r=s+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(e,t){let s=this.indexOf(e);if(-1===s)return;let r=s+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(e,t){let s=0;for(let r of this){if(Reflect.apply(e,t,[r,s,this]))return r;s++}}findIndex(e,t){let s=0;for(let r of this){if(Reflect.apply(e,t,[r,s,this]))return s;s++}return -1}filter(t,s){let r=[],a=0;for(let e of this)Reflect.apply(t,s,[e,a,this])&&r.push(e),a++;return new e(r)}map(t,s){let r=[],a=0;for(let e of this)r.push([e[0],Reflect.apply(t,s,[e,a,this])]),a++;return new e(r)}reduce(...e){let[t,s]=e,r=0,a=s??this.at(0);for(let s of this)a=0===r&&1===e.length?s:Reflect.apply(t,this,[a,s,r,this]),r++;return a}reduceRight(...e){let[t,s]=e,r=s??this.at(-1);for(let s=this.size-1;s>=0;s--){let a=this.at(s);r=s===this.size-1&&1===e.length?a:Reflect.apply(t,this,[r,a,s,this])}return r}toSorted(t){return new e([...this.entries()].sort(t))}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let s=this.keyAt(e),r=this.get(s);t.set(s,r)}return t}toSpliced(...t){let s=[...this.entries()];return s.splice(...t),new e(s)}slice(t,s){let r=new e,a=this.size-1;if(void 0===t)return r;t<0&&(t+=this.size),void 0!==s&&s>0&&(a=s-1);for(let e=t;e<=a;e++){let t=this.keyAt(e),s=this.get(t);r.set(t,s)}return r}every(e,t){let s=0;for(let r of this){if(!Reflect.apply(e,t,[r,s,this]))return!1;s++}return!0}some(e,t){let s=0;for(let r of this){if(Reflect.apply(e,t,[r,s,this]))return!0;s++}return!1}}),e.s(["createCollection",()=>l])},49228,e=>{"use strict";let t=(0,e.i(3645).default)("git-branch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);e.s(["GitBranch",()=>t],49228)},68304,51080,e=>{"use strict";var t=e.i(20314),s=e.i(79054),r=e.i(91967),a=e.i(22528),i=e.i(87342),l=e.i(5978),n=e.i(13123),o=e.i(87620),c=e.i(29297),d=e.i(36589),u=e.i(66033),m="rovingFocusGroup.onEntryFocus",f={bubbles:!1,cancelable:!0},h="RovingFocusGroup",[x,p,g]=(0,i.createCollection)(h),[v,b]=(0,a.createContextScope)(h,[g]),[y,j]=v(h),k=s.forwardRef((e,s)=>(0,t.jsx)(x.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,t.jsx)(x.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,t.jsx)(w,{...e,ref:s})})}));k.displayName=h;var w=s.forwardRef((e,a)=>{let{__scopeRovingFocusGroup:i,orientation:n,loop:x=!1,dir:g,currentTabStopId:v,defaultCurrentTabStopId:b,onCurrentTabStopIdChange:j,onEntryFocus:k,preventScrollOnEntryFocus:w=!1,...N}=e,C=s.useRef(null),T=(0,l.useComposedRefs)(a,C),I=(0,u.useDirection)(g),[S,A]=(0,d.useControllableState)({prop:v,defaultProp:b??null,onChange:j,caller:h}),[z,E]=s.useState(!1),M=(0,c.useCallbackRef)(k),L=p(i),D=s.useRef(!1),[P,F]=s.useState(0);return s.useEffect(()=>{let e=C.current;if(e)return e.addEventListener(m,M),()=>e.removeEventListener(m,M)},[M]),(0,t.jsx)(y,{scope:i,orientation:n,dir:I,loop:x,currentTabStopId:S,onItemFocus:s.useCallback(e=>A(e),[A]),onItemShiftTab:s.useCallback(()=>E(!0),[]),onFocusableItemAdd:s.useCallback(()=>F(e=>e+1),[]),onFocusableItemRemove:s.useCallback(()=>F(e=>e-1),[]),children:(0,t.jsx)(o.Primitive.div,{tabIndex:z||0===P?-1:0,"data-orientation":n,...N,ref:T,style:{outline:"none",...e.style},onMouseDown:(0,r.composeEventHandlers)(e.onMouseDown,()=>{D.current=!0}),onFocus:(0,r.composeEventHandlers)(e.onFocus,e=>{let t=!D.current;if(e.target===e.currentTarget&&t&&!z){let t=new CustomEvent(m,f);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=L().filter(e=>e.focusable);R([e.find(e=>e.active),e.find(e=>e.id===S),...e].filter(Boolean).map(e=>e.ref.current),w)}}D.current=!1}),onBlur:(0,r.composeEventHandlers)(e.onBlur,()=>E(!1))})})}),N="RovingFocusGroupItem",C=s.forwardRef((e,a)=>{let{__scopeRovingFocusGroup:i,focusable:l=!0,active:c=!1,tabStopId:d,children:u,...m}=e,f=(0,n.useId)(),h=d||f,g=j(N,i),v=g.currentTabStopId===h,b=p(i),{onFocusableItemAdd:y,onFocusableItemRemove:k,currentTabStopId:w}=g;return s.useEffect(()=>{if(l)return y(),()=>k()},[l,y,k]),(0,t.jsx)(x.ItemSlot,{scope:i,id:h,focusable:l,active:c,children:(0,t.jsx)(o.Primitive.span,{tabIndex:v?0:-1,"data-orientation":g.orientation,...m,ref:a,onMouseDown:(0,r.composeEventHandlers)(e.onMouseDown,e=>{l?g.onItemFocus(h):e.preventDefault()}),onFocus:(0,r.composeEventHandlers)(e.onFocus,()=>g.onItemFocus(h)),onKeyDown:(0,r.composeEventHandlers)(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void g.onItemShiftTab();if(e.target!==e.currentTarget)return;let t=function(e,t,s){var r;let a=(r=e.key,"rtl"!==s?r:"ArrowLeft"===r?"ArrowRight":"ArrowRight"===r?"ArrowLeft":r);if(!("vertical"===t&&["ArrowLeft","ArrowRight"].includes(a))&&!("horizontal"===t&&["ArrowUp","ArrowDown"].includes(a)))return T[a]}(e,g.orientation,g.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let a=b().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)a.reverse();else if("prev"===t||"next"===t){var s,r;"prev"===t&&a.reverse();let i=a.indexOf(e.currentTarget);a=g.loop?(s=a,r=i+1,s.map((e,t)=>s[(r+t)%s.length])):a.slice(i+1)}setTimeout(()=>R(a))}}),children:"function"==typeof u?u({isCurrentTabStop:v,hasTabStop:null!=w}):u})})});C.displayName=N;var T={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function R(e,t=!1){let s=document.activeElement;for(let r of e)if(r===s||(r.focus({preventScroll:t}),document.activeElement!==s))return}e.s(["Item",()=>C,"Root",()=>k,"createRovingFocusGroupScope",()=>b],51080);var I=e.i(85995),S="Tabs",[A,z]=(0,a.createContextScope)(S,[b]),E=b(),[M,L]=A(S),D=s.forwardRef((e,s)=>{let{__scopeTabs:r,value:a,onValueChange:i,defaultValue:l,orientation:c="horizontal",dir:m,activationMode:f="automatic",...h}=e,x=(0,u.useDirection)(m),[p,g]=(0,d.useControllableState)({prop:a,onChange:i,defaultProp:l??"",caller:S});return(0,t.jsx)(M,{scope:r,baseId:(0,n.useId)(),value:p,onValueChange:g,orientation:c,dir:x,activationMode:f,children:(0,t.jsx)(o.Primitive.div,{dir:x,"data-orientation":c,...h,ref:s})})});D.displayName=S;var P="TabsList",F=s.forwardRef((e,s)=>{let{__scopeTabs:r,loop:a=!0,...i}=e,l=L(P,r),n=E(r);return(0,t.jsx)(k,{asChild:!0,...n,orientation:l.orientation,dir:l.dir,loop:a,children:(0,t.jsx)(o.Primitive.div,{role:"tablist","aria-orientation":l.orientation,...i,ref:s})})});F.displayName=P;var O="TabsTrigger",B=s.forwardRef((e,s)=>{let{__scopeTabs:a,value:i,disabled:l=!1,...n}=e,c=L(O,a),d=E(a),u=V(c.baseId,i),m=K(c.baseId,i),f=i===c.value;return(0,t.jsx)(C,{asChild:!0,...d,focusable:!l,active:f,children:(0,t.jsx)(o.Primitive.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":m,"data-state":f?"active":"inactive","data-disabled":l?"":void 0,disabled:l,id:u,...n,ref:s,onMouseDown:(0,r.composeEventHandlers)(e.onMouseDown,e=>{l||0!==e.button||!1!==e.ctrlKey?e.preventDefault():c.onValueChange(i)}),onKeyDown:(0,r.composeEventHandlers)(e.onKeyDown,e=>{[" ","Enter"].includes(e.key)&&c.onValueChange(i)}),onFocus:(0,r.composeEventHandlers)(e.onFocus,()=>{let e="manual"!==c.activationMode;f||l||!e||c.onValueChange(i)})})})});B.displayName=O;var H="TabsContent",q=s.forwardRef((e,r)=>{let{__scopeTabs:a,value:i,forceMount:l,children:n,...c}=e,d=L(H,a),u=V(d.baseId,i),m=K(d.baseId,i),f=i===d.value,h=s.useRef(f);return s.useEffect(()=>{let e=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,t.jsx)(I.Presence,{present:l||f,children:({present:s})=>(0,t.jsx)(o.Primitive.div,{"data-state":f?"active":"inactive","data-orientation":d.orientation,role:"tabpanel","aria-labelledby":u,hidden:!s,id:m,tabIndex:0,...c,ref:r,style:{...e.style,animationDuration:h.current?"0s":void 0},children:s&&n})})});function V(e,t){return`${e}-trigger-${t}`}function K(e,t){return`${e}-content-${t}`}q.displayName=H,e.s(["Content",()=>q,"List",()=>F,"Root",()=>D,"Tabs",()=>D,"TabsContent",()=>q,"TabsList",()=>F,"TabsTrigger",()=>B,"Trigger",()=>B,"createTabsScope",()=>z],43133);var $=e.i(43133),$=$,U=e.i(31777);let G=$.Root,_=s.forwardRef(({className:e,...s},r)=>(0,t.jsx)($.List,{ref:r,className:(0,U.cn)("bg-muted text-muted-foreground inline-flex h-9 items-center justify-center rounded-lg p-1",e),...s}));_.displayName=$.List.displayName;let W=s.forwardRef(({className:e,...s},r)=>(0,t.jsx)($.Trigger,{ref:r,className:(0,U.cn)("ring-offset-background focus-visible:ring-ring data-[state=active]:bg-background data-[state=active]:text-foreground inline-flex items-center justify-center rounded-md px-3 py-1 text-sm font-medium whitespace-nowrap transition-all focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow",e),...s}));W.displayName=$.Trigger.displayName;let J=s.forwardRef(({className:e,...s},r)=>(0,t.jsx)($.Content,{ref:r,className:(0,U.cn)("ring-offset-background focus-visible:ring-ring mt-2 focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",e),...s}));J.displayName=$.Content.displayName,e.s(["Tabs",()=>G,"TabsContent",()=>J,"TabsList",()=>_,"TabsTrigger",()=>W],68304)},83902,e=>{"use strict";let t=(0,e.i(3645).default)("rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]);e.s(["Rocket",()=>t],83902)},44412,e=>{"use strict";var t=e.i(20314),s=e.i(79054),r=e.i(81975),a=e.i(68304),i=e.i(31777),l=e.i(83428),n=e.i(83902),o=e.i(95230),o=o,c=e.i(3645);let d=(0,c.default)("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);var u=e.i(38573),m=e.i(49228),f=e.i(54277),h=e.i(95812),x=e.i(35e3);let p=(0,c.default)("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);var g=e.i(35364),v=e.i(2828),b=e.i(33548),y=e.i(23925),j=e.i(30702),o=o,k=e.i(11495);let w={linux:"Linux",darwin:"macOS",win32:"Windows"},N={ide:{label:"IDE",icon:d},"cli-agent":{label:"CLI Agent",icon:u.Terminal},vcs:{label:"VCS",icon:m.GitBranch},terminal:{label:"Terminal",icon:u.Terminal}};function C({status:e}){return"available"===e?(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-emerald-100 px-2 py-0.5 text-xs font-medium text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400",children:[(0,t.jsx)(y.Check,{className:"h-3 w-3"}),"Installed"]}):"error"===e?(0,t.jsx)("span",{className:"inline-flex items-center gap-1 rounded-full bg-red-100 px-2 py-0.5 text-xs font-medium text-red-700 dark:bg-red-900/30 dark:text-red-400",children:"Error"}):(0,t.jsx)("span",{className:"inline-flex items-center gap-1 rounded-full bg-amber-100 px-2 py-0.5 text-xs font-medium text-amber-700 dark:bg-amber-900/30 dark:text-amber-400",children:"Missing"})}function T({tool:e,open:r,onClose:a,onRefresh:i,autoStart:c}){let[u,m]=(0,s.useState)(!1),[f,h]=(0,s.useState)(!1),{logs:x,status:v,startInstall:T}=function(e){let[t,r]=(0,s.useState)([]),[a,i]=(0,s.useState)("idle"),[l,n]=(0,s.useState)(null),o=(0,s.useRef)(null),c=(0,s.useCallback)(()=>{o.current&&(o.current.close(),o.current=null)},[]);return(0,s.useEffect)(()=>c,[c]),{logs:t,status:a,result:l,startInstall:(0,s.useCallback)(()=>{c(),r([]),n(null),i("streaming");let t=new EventSource(`/api/tools/${e}/install/stream`);o.current=t,t.onmessage=e=>{r(t=>[...t,e.data])},t.addEventListener("done",e=>{let t=JSON.parse(e.data);n(t),i("error"===t.status?"error":"done"),c()}),t.onerror=()=>{i("error"),c()}},[e,c])}}(e.id),R=(0,s.useRef)(null),I=(0,s.useRef)(!0),S=(0,s.useRef)(!1),A="available"===e.status.status,z="error"===e.status.status,E=A&&!!e.openDirectory,M=!A&&!z&&e.autoInstall;async function L(){h(!0);try{await fetch(`/api/tools/${e.id}/launch`,{method:"POST"})}finally{h(!1)}}(0,s.useEffect)(()=>{r&&c&&M&&"idle"===v&&!S.current&&(S.current=!0,T()),r||(S.current=!1)},[r,c,M,v,T]);let D=(0,s.useCallback)(()=>{let e=R.current;e&&(I.current=e.scrollTop+e.clientHeight>=e.scrollHeight-50)},[]);(0,s.useEffect)(()=>{I.current&&R.current&&(R.current.scrollTop=R.current.scrollHeight)},[x,v]),(0,s.useEffect)(()=>{"done"===v&&i&&i()},[v,i]);let P=(0,t.jsxs)("div",{className:"flex flex-col gap-1.5 pr-6",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[e.iconUrl?(0,t.jsx)("img",{src:e.iconUrl,alt:"",width:24,height:24,className:"shrink-0 dark:invert"}):(0,t.jsx)(p,{className:"text-muted-foreground h-6 w-6 shrink-0"}),(0,t.jsx)("h2",{className:"text-base font-bold",children:e.name}),(0,t.jsx)(C,{status:e.status.status})]}),(0,t.jsx)("div",{className:"flex items-center gap-2",children:e.tags.map(e=>{let s=N[e]??{label:e,icon:d},r=s.icon;return(0,t.jsxs)("span",{className:"text-muted-foreground/70 inline-flex items-center gap-0.5 text-[10px]",children:[(0,t.jsx)(r,{className:"h-3 w-3"}),s.label]},e)})})]});return(0,t.jsx)(k.BaseDrawer,{open:r,onClose:a,size:"md",modal:!0,title:e.name,header:P,"data-testid":"tool-detail-drawer",children:(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-4 overflow-y-auto p-4",children:[(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:e.description}),e.author||e.platforms?(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs",children:[e.author?(0,t.jsxs)("span",{className:"text-muted-foreground",children:["by"," ",e.website?(0,t.jsx)("a",{href:e.website,target:"_blank",rel:"noopener noreferrer",className:"text-foreground hover:underline",children:e.author}):(0,t.jsx)("span",{className:"text-foreground",children:e.author})]}):null,e.platforms&&e.platforms.length>0?(0,t.jsx)("span",{className:"text-muted-foreground",children:e.platforms.map(e=>w[e]??e).join(" · ")}):null]}):null,e.installCommand?(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)("span",{className:"text-muted-foreground text-xs font-semibold tracking-wide uppercase",children:"Install command"}),(0,t.jsxs)("div",{className:"relative rounded-md bg-zinc-900 text-zinc-100",children:[(0,t.jsx)("pre",{className:"overflow-x-auto px-3 py-2.5 pr-16 font-mono text-xs leading-relaxed break-all whitespace-pre-wrap",children:(0,t.jsx)("code",{children:e.installCommand})}),(0,t.jsxs)(g.Button,{variant:"ghost",size:"sm",className:"absolute top-1.5 right-1.5 h-7 cursor-pointer px-2 text-zinc-400 hover:text-zinc-100",onClick:function(){e.installCommand&&navigator.clipboard.writeText(e.installCommand).then(()=>{m(!0),setTimeout(()=>m(!1),2e3)})},"aria-label":u?"Copied!":"Copy install command",children:[u?(0,t.jsx)(y.Check,{className:"h-3.5 w-3.5 text-emerald-500"}):(0,t.jsx)(b.Copy,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{className:"ml-1 text-[10px]",children:u?"Copied!":"Copy"})]})]})]}):null,(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[M?(0,t.jsxs)(g.Button,{size:"sm",onClick:T,disabled:"streaming"===v,"aria-label":`Install ${e.name}`,className:"cursor-pointer",children:["streaming"===v?(0,t.jsx)(l.Loader2,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(o.default,{className:"mr-1.5 h-3.5 w-3.5"}),"streaming"===v?"Installing...":"Install"]}):null,E?(0,t.jsxs)(g.Button,{size:"sm",variant:"outline",onClick:()=>void L(),disabled:f,"aria-label":`Launch ${e.name}`,className:"cursor-pointer",children:[f?(0,t.jsx)(l.Loader2,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(n.Rocket,{className:"mr-1.5 h-3.5 w-3.5"}),"Launch"]}):null,e.documentationUrl?(0,t.jsx)(g.Button,{variant:"outline",size:"sm",className:"cursor-pointer",asChild:!0,children:(0,t.jsxs)("a",{href:e.documentationUrl,target:"_blank",rel:"noopener noreferrer",children:["Docs",(0,t.jsx)(j.ExternalLink,{className:"ml-1 h-3 w-3"})]})}):null]}),("streaming"===v||"done"===v||"error"===v)&&x.length>0?(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)("span",{className:"text-muted-foreground text-xs font-semibold tracking-wide uppercase",children:"Install log"}),(0,t.jsxs)("div",{ref:R,onScroll:D,className:"max-h-60 overflow-auto rounded-md bg-zinc-900 p-3 font-mono text-xs leading-relaxed text-zinc-100","data-testid":"tool-install-log",children:[x.map((e,s)=>(0,t.jsx)("div",{className:"break-all whitespace-pre-wrap",children:e},s)),"done"===v?(0,t.jsx)("div",{className:"mt-2 border-t border-zinc-700 pt-2 text-emerald-400",children:"Installation complete"}):null,"error"===v?(0,t.jsx)("div",{className:"mt-2 border-t border-zinc-700 pt-2 text-red-400",children:"Installation failed"}):null]})]}):null]})})}let R={ide:{label:"IDE",icon:d},"cli-agent":{label:"CLI Agent",icon:u.Terminal},vcs:{label:"VCS",icon:m.GitBranch},terminal:{label:"Terminal",icon:u.Terminal}};function I({tool:e,onRefresh:r,className:a}){let[c,u]=(0,s.useState)(!1),[m,b]=(0,s.useState)(!1),[y,j]=(0,s.useTransition)(),k="available"===e.status.status,w="error"===e.status.status,N=k&&!!e.openDirectory;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{"data-testid":"tool-card",onClick:function(){b(!1),u(!0)},className:(0,i.cn)("bg-card group flex h-30 w-full cursor-pointer flex-col rounded-lg border p-3 transition-shadow hover:shadow-md",a),children:[(0,t.jsxs)("div",{className:"mb-2 flex items-start justify-between gap-2",children:[(0,t.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[e.iconUrl?(0,t.jsx)("img",{src:e.iconUrl,alt:"",width:20,height:20,className:"shrink-0 dark:invert"}):(0,t.jsx)(p,{className:"text-muted-foreground h-5 w-5 shrink-0"}),(0,t.jsx)("h3",{"data-testid":"tool-card-name",className:"truncate text-sm font-bold",children:e.name})]}),(0,t.jsx)("div",{"data-testid":"tool-card-tags",className:"flex shrink-0 items-center gap-1",children:e.tags.map(e=>{let s=R[e]??{label:e,icon:d},r=s.icon;return(0,t.jsxs)("span",{className:"text-muted-foreground/70 inline-flex items-center gap-0.5 text-[9px]",children:[(0,t.jsx)(r,{className:"h-2.5 w-2.5"}),s.label]},e)})})]}),(0,t.jsx)("p",{"data-testid":"tool-card-summary",className:"text-muted-foreground mt-1 truncate text-xs",children:e.summary}),(0,t.jsxs)("div",{className:"mt-auto flex items-center justify-between pt-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[w&&"error"===e.status.status?(0,t.jsxs)("span",{className:"flex items-center gap-1 truncate text-[10px] text-red-600 dark:text-red-400",title:e.status.errorMessage,children:[(0,t.jsx)(f.CircleX,{className:"h-3 w-3 shrink-0"}),e.status.errorMessage??"Error"]}):k?(0,t.jsxs)("span",{className:"flex items-center gap-1 text-[10px] text-emerald-600 dark:text-emerald-400",children:[(0,t.jsx)(x.CheckCircle2,{className:"h-3 w-3"}),"Installed"]}):(0,t.jsxs)("span",{className:"text-muted-foreground flex items-center gap-1 text-[10px]",children:[(0,t.jsx)(h.Circle,{className:"h-3 w-3"}),"Not installed"]}),e.required?(0,t.jsx)(v.TooltipProvider,{children:(0,t.jsxs)(v.Tooltip,{children:[(0,t.jsx)(v.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"rounded bg-amber-100 px-1.5 py-0.5 text-[9px] font-medium text-amber-700 dark:bg-amber-900/50 dark:text-amber-400",children:"Required"})}),(0,t.jsx)(v.TooltipContent,{side:"top",children:"This tool is required for Shep to function properly"})]})}):null]}),(0,t.jsx)("div",{className:"flex items-center gap-1",children:k&&N?(0,t.jsxs)(g.Button,{size:"sm",variant:"outline",onClick:function(t){t.stopPropagation(),j(async()=>{await fetch(`/api/tools/${e.id}/launch`,{method:"POST"})})},disabled:y,"aria-label":`Launch ${e.name}`,"data-testid":"tool-card-launch-button",className:"h-7 cursor-pointer rounded-md px-3 text-xs",children:[y?(0,t.jsx)(l.Loader2,{className:"mr-1 h-3 w-3 animate-spin"}):(0,t.jsx)(n.Rocket,{className:"mr-1 h-3 w-3"}),"Launch"]}):k||w?null:(0,t.jsxs)(g.Button,{size:"sm",variant:"default",onClick:function(t){t.stopPropagation(),b(e.autoInstall),u(!0)},"aria-label":`Install ${e.name}`,"data-testid":"tool-card-install-button",className:"h-7 cursor-pointer rounded-md px-3 text-xs",children:[(0,t.jsx)(o.default,{className:"mr-1 h-3 w-3"}),"Install"]})})]})]}),(0,t.jsx)(T,{tool:e,open:c,onClose:()=>u(!1),onRefresh:r,autoStart:m})]})}let S={all:()=>!0,ide:e=>e.tags.includes("ide"),"cli-agent":e=>e.tags.includes("cli-agent"),vcs:e=>e.tags.includes("vcs"),terminal:e=>e.tags.includes("terminal")};function A({tools:e,className:l}){let[n,o]=(0,s.useState)(e),[c,d]=(0,s.useState)("all"),u=(0,s.useCallback)(async()=>{try{let e=await fetch("/api/tools");if(e.ok){let t=await e.json();o(t)}}catch{}},[]),m=n.filter(S[c]);return(0,t.jsxs)("div",{"data-testid":"tools-page-client",className:(0,i.cn)("space-y-4",l),children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(r.Wrench,{className:"text-muted-foreground h-4 w-4"}),(0,t.jsx)("h1",{className:"text-sm font-bold tracking-tight",children:"Tools"}),(0,t.jsxs)("span",{className:"text-muted-foreground text-[10px]",children:[n.filter(e=>"available"===e.status.status).length,"/",n.length," installed"]})]}),(0,t.jsxs)(a.Tabs,{value:c,onValueChange:e=>d(e),"data-testid":"tools-page-tabs",children:[(0,t.jsxs)(a.TabsList,{className:"h-7",children:[(0,t.jsx)(a.TabsTrigger,{value:"all","data-testid":"tools-tab-all",className:"px-2.5 text-xs",children:"All"}),(0,t.jsx)(a.TabsTrigger,{value:"ide","data-testid":"tools-tab-ide",className:"px-2.5 text-xs",children:"IDEs"}),(0,t.jsx)(a.TabsTrigger,{value:"cli-agent","data-testid":"tools-tab-cli-agent",className:"px-2.5 text-xs",children:"CLI Agents"}),(0,t.jsx)(a.TabsTrigger,{value:"vcs","data-testid":"tools-tab-vcs",className:"px-2.5 text-xs",children:"Version Control"}),(0,t.jsx)(a.TabsTrigger,{value:"terminal","data-testid":"tools-tab-terminal",className:"px-2.5 text-xs",children:"Terminals"})]}),(0,t.jsx)(a.TabsContent,{value:c,className:"mt-3",children:0===m.length?(0,t.jsxs)("div",{"data-testid":"tools-page-empty",className:"text-muted-foreground flex flex-col items-center justify-center py-12 text-center",children:[(0,t.jsx)(r.Wrench,{className:"mb-2 h-6 w-6 opacity-20"}),(0,t.jsx)("p",{className:"text-xs",children:"No tools in this category."})]}):(0,t.jsx)("div",{"data-testid":"tools-page-grid",className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:m.map(e=>(0,t.jsx)(I,{tool:e,onRefresh:u},e.id))})})]})]})}e.s(["ToolsPageClient",()=>A],44412)}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,95230,e=>{"use strict";let t=(0,e.i(3645).default)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);e.s(["default",()=>t])},93752,e=>{"use strict";let t=(0,e.i(3645).default)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);e.s(["default",()=>t])},11345,e=>{"use strict";let t=(0,e.i(3645).default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);e.s(["ChevronLeft",()=>t],11345)},76016,e=>{"use strict";let t=(0,e.i(3645).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["ChevronRight",()=>t],76016)},16868,48306,80436,28267,86254,50032,42076,e=>{"use strict";var t=e.i(3645);let r=(0,t.default)("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]);e.s(["PaperclipIcon",()=>r],16868);var a=e.i(20314),o=e.i(31777);function s({className:e,...t}){return(0,a.jsx)("textarea",{"data-slot":"textarea",className:(0,o.cn)("placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input field-sizing-content min-h-[80px] w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...t})}e.s(["Textarea",()=>s],48306);var i=e.i(60253),n=e.i(15506),n=n,l=e.i(95230);e.s(["DownloadIcon",()=>l.default],80436);var l=l,d=e.i(2287),c=e.i(1693);e.s(["VisuallyHidden",0,c],28267);var c=c;let u=(0,t.default)("file",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]]);var p=e.i(16298),p=p;let h=(0,t.default)("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);var m=e.i(93752),m=m;e.i(35364);let f=new Set([".png",".jpg",".jpeg",".gif",".svg",".webp",".ico",".bmp"]),x=new Set([".ts",".tsx",".js",".jsx",".json",".yaml",".yml",".xml",".html",".css",".md"]);function g(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024));return`${(e/Math.pow(1024,t)).toFixed(+(0!==t))} ${["B","KB","MB","GB"][t]}`}let v=new Set([".png",".jpg",".jpeg",".gif",".svg",".webp",".ico",".bmp"]);function b(e,t){let r=new URLSearchParams({path:e,mimeType:t});return`/api/attachments/preview?${r.toString()}`}function j({name:e,size:t,mimeType:r,path:s,onRemove:j,loading:w=!1,disabled:y=!1}){let C,k,N=(C=e.lastIndexOf("."))>=0?e.slice(C).toLowerCase():"",P=f.has(N)?h:".pdf"===N?p.default:x.has(N)?m.default:u,T=".pdf"===N?"bg-red-50 text-red-600":f.has(N)?"bg-blue-50 text-blue-600":x.has(N)?"bg-emerald-50 text-emerald-600":"bg-gray-50 text-gray-600",S=(k=e.lastIndexOf("."))>=0&&v.has(e.slice(k).toLowerCase());return w?(0,a.jsx)("div",{className:"flex h-12 w-12 items-center justify-center rounded-md border",children:(0,a.jsx)(n.default,{className:"text-muted-foreground h-5 w-5 animate-spin"})}):S?(0,a.jsxs)(d.Dialog,{children:[(0,a.jsxs)("div",{className:"group relative",children:[(0,a.jsx)(d.DialogTrigger,{asChild:!0,children:(0,a.jsx)("img",{src:b(s,r),alt:e,title:e,className:"h-12 w-12 cursor-pointer rounded-md border object-cover transition-opacity hover:opacity-80"})}),!y&&(0,a.jsx)("button",{type:"button",onClick:j,className:"absolute -top-1.5 -right-1.5 hidden h-5 w-5 cursor-pointer items-center justify-center rounded-full bg-black/70 text-white group-hover:flex","aria-label":`Remove ${e}`,children:(0,a.jsx)(i.X,{className:"h-3 w-3"})})]}),(0,a.jsxs)(d.DialogContent,{className:"max-w-3xl gap-0 overflow-hidden border-0 p-0 [&>button:last-child]:!cursor-pointer [&>button:last-child]:!rounded-full [&>button:last-child]:!bg-black/70 [&>button:last-child]:!p-1.5 [&>button:last-child]:!text-white [&>button:last-child]:!opacity-100 [&>button:last-child]:!shadow-lg [&>button:last-child]:!backdrop-blur-md [&>button:last-child]:hover:!bg-black/90",children:[(0,a.jsx)(c.Root,{children:(0,a.jsxs)(d.DialogTitle,{children:["Preview: ",e]})}),(0,a.jsx)("div",{className:"relative bg-black/90",children:(0,a.jsx)("img",{src:b(s,r),alt:e,className:"h-auto max-h-[70vh] w-full object-contain"})}),(0,a.jsxs)("div",{className:"bg-background flex items-center gap-3 px-4 py-3",children:[(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,a.jsx)("span",{className:"truncate text-sm font-medium",children:e}),(0,a.jsx)("span",{className:"text-muted-foreground text-xs",children:g(t)})]}),(0,a.jsx)("a",{href:b(s,r),download:e,className:"text-muted-foreground hover:text-foreground shrink-0 cursor-pointer rounded p-1.5 transition-colors","aria-label":`Download ${e}`,children:(0,a.jsx)(l.default,{className:"h-4 w-4"})})]})]})]}):(0,a.jsxs)("div",{className:"group relative flex items-center gap-2 rounded-full border py-1 pr-3 pl-2",children:[(0,a.jsx)("div",{className:(0,o.cn)("flex h-6 w-6 shrink-0 items-center justify-center rounded-full",T),children:(0,a.jsx)(P,{className:"h-3 w-3"})}),(0,a.jsx)("span",{className:"max-w-[120px] truncate text-sm",children:e}),(0,a.jsx)("span",{className:"text-muted-foreground text-xs",children:g(t)}),!y&&(0,a.jsx)("button",{type:"button",onClick:j,className:"absolute -top-1.5 -right-1.5 hidden h-5 w-5 cursor-pointer items-center justify-center rounded-full bg-black/70 text-white group-hover:flex","aria-label":`Remove ${e}`,children:(0,a.jsx)(i.X,{className:"h-3 w-3"})})]})}async function w(){let e=await fetch("/api/dialog/pick-files",{method:"POST"});if(!e.ok)throw Error("Failed to open file dialog");let t=await e.json();return t.cancelled?null:t.files}e.s(["AttachmentChip",()=>j],86254),e.s([],50032),e.s(["pickFiles",()=>w],42076)},90382,e=>{"use strict";var t=e.i(20314),r=e.i(79054),a=e.i(91967),o=e.i(5978),s=e.i(22528),i=e.i(53532),n=e.i(41687),l=e.i(56720),d=e.i(13123),c=e.i(52740),u=e.i(39979),p=e.i(85995),h=e.i(87620),m=e.i(86874),f=e.i(36589),x=e.i(73772),g=e.i(13044),v="Popover",[b,j]=(0,s.createContextScope)(v,[c.createPopperScope]),w=(0,c.createPopperScope)(),[y,C]=b(v),k=e=>{let{__scopePopover:a,children:o,open:s,defaultOpen:i,onOpenChange:n,modal:l=!1}=e,u=w(a),p=r.useRef(null),[h,m]=r.useState(!1),[x,g]=(0,f.useControllableState)({prop:s,defaultProp:i??!1,onChange:n,caller:v});return(0,t.jsx)(c.Root,{...u,children:(0,t.jsx)(y,{scope:a,contentId:(0,d.useId)(),triggerRef:p,open:x,onOpenChange:g,onOpenToggle:r.useCallback(()=>g(e=>!e),[g]),hasCustomAnchor:h,onCustomAnchorAdd:r.useCallback(()=>m(!0),[]),onCustomAnchorRemove:r.useCallback(()=>m(!1),[]),modal:l,children:o})})};k.displayName=v;var N="PopoverAnchor",P=r.forwardRef((e,a)=>{let{__scopePopover:o,...s}=e,i=C(N,o),n=w(o),{onCustomAnchorAdd:l,onCustomAnchorRemove:d}=i;return r.useEffect(()=>(l(),()=>d()),[l,d]),(0,t.jsx)(c.Anchor,{...n,...s,ref:a})});P.displayName=N;var T="PopoverTrigger",S=r.forwardRef((e,r)=>{let{__scopePopover:s,...i}=e,n=C(T,s),l=w(s),d=(0,o.useComposedRefs)(r,n.triggerRef),u=(0,t.jsx)(h.Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":H(n.open),...i,ref:d,onClick:(0,a.composeEventHandlers)(e.onClick,n.onOpenToggle)});return n.hasCustomAnchor?u:(0,t.jsx)(c.Anchor,{asChild:!0,...l,children:u})});S.displayName=T;var R="PopoverPortal",[A,D]=b(R,{forceMount:void 0}),F=e=>{let{__scopePopover:r,forceMount:a,children:o,container:s}=e,i=C(R,r);return(0,t.jsx)(A,{scope:r,forceMount:a,children:(0,t.jsx)(p.Presence,{present:a||i.open,children:(0,t.jsx)(u.Portal,{asChild:!0,container:s,children:o})})})};F.displayName=R;var E="PopoverContent",M=r.forwardRef((e,r)=>{let a=D(E,e.__scopePopover),{forceMount:o=a.forceMount,...s}=e,i=C(E,e.__scopePopover);return(0,t.jsx)(p.Presence,{present:o||i.open,children:i.modal?(0,t.jsx)(z,{...s,ref:r}):(0,t.jsx)(I,{...s,ref:r})})});M.displayName=E;var O=(0,m.createSlot)("PopoverContent.RemoveScroll"),z=r.forwardRef((e,s)=>{let i=C(E,e.__scopePopover),n=r.useRef(null),l=(0,o.useComposedRefs)(s,n),d=r.useRef(!1);return r.useEffect(()=>{let e=n.current;if(e)return(0,x.hideOthers)(e)},[]),(0,t.jsx)(g.RemoveScroll,{as:O,allowPinchZoom:!0,children:(0,t.jsx)(L,{...e,ref:l,trapFocus:i.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:(0,a.composeEventHandlers)(e.onCloseAutoFocus,e=>{e.preventDefault(),d.current||i.triggerRef.current?.focus()}),onPointerDownOutside:(0,a.composeEventHandlers)(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;d.current=2===t.button||r},{checkForDefaultPrevented:!1}),onFocusOutside:(0,a.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),I=r.forwardRef((e,a)=>{let o=C(E,e.__scopePopover),s=r.useRef(!1),i=r.useRef(!1);return(0,t.jsx)(L,{...e,ref:a,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(s.current||o.triggerRef.current?.focus(),t.preventDefault()),s.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(s.current=!0,"pointerdown"===t.detail.originalEvent.type&&(i.current=!0));let r=t.target;o.triggerRef.current?.contains(r)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&i.current&&t.preventDefault()}})}),L=r.forwardRef((e,r)=>{let{__scopePopover:a,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:d,disableOutsidePointerEvents:u,onEscapeKeyDown:p,onPointerDownOutside:h,onFocusOutside:m,onInteractOutside:f,...x}=e,g=C(E,a),v=w(a);return(0,n.useFocusGuards)(),(0,t.jsx)(l.FocusScope,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:s,onUnmountAutoFocus:d,children:(0,t.jsx)(i.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:u,onInteractOutside:f,onEscapeKeyDown:p,onPointerDownOutside:h,onFocusOutside:m,onDismiss:()=>g.onOpenChange(!1),children:(0,t.jsx)(c.Content,{"data-state":H(g.open),role:"dialog",id:g.contentId,...v,...x,ref:r,style:{...x.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),U="PopoverClose",B=r.forwardRef((e,r)=>{let{__scopePopover:o,...s}=e,i=C(U,o);return(0,t.jsx)(h.Primitive.button,{type:"button",...s,ref:r,onClick:(0,a.composeEventHandlers)(e.onClick,()=>i.onOpenChange(!1))})});B.displayName=U;var $=r.forwardRef((e,r)=>{let{__scopePopover:a,...o}=e,s=w(a);return(0,t.jsx)(c.Arrow,{...s,...o,ref:r})});function H(e){return e?"open":"closed"}$.displayName="PopoverArrow",e.s(["Anchor",()=>P,"Arrow",()=>$,"Close",()=>B,"Content",()=>M,"Popover",()=>k,"PopoverAnchor",()=>P,"PopoverArrow",()=>$,"PopoverClose",()=>B,"PopoverContent",()=>M,"PopoverPortal",()=>F,"PopoverTrigger",()=>S,"Portal",()=>F,"Root",()=>k,"Trigger",()=>S,"createPopoverScope",()=>j],89920);var q=e.i(89920),q=q,G=e.i(31777);let _=q.Root,K=q.Trigger;q.Anchor;let V=r.forwardRef(({className:e,align:r="center",sideOffset:a=4,...o},s)=>(0,t.jsx)(q.Portal,{children:(0,t.jsx)(q.Content,{ref:s,align:r,sideOffset:a,className:(0,G.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 rounded-md border p-4 shadow-md outline-none",e),...o})}));V.displayName=q.Content.displayName,e.s(["Popover",()=>_,"PopoverContent",()=>V,"PopoverTrigger",()=>K],90382)},51911,20944,38432,e=>{"use strict";var t=e.i(20314),r=e.i(79054),a=e.i(91967),o=e.i(5978),s=e.i(22528),i=e.i(36589),n=e.i(23405),l=e.i(77624),d=e.i(87620),c="Switch",[u,p]=(0,s.createContextScope)(c),[h,m]=u(c),f=r.forwardRef((e,s)=>{let{__scopeSwitch:n,name:l,checked:u,defaultChecked:p,required:m,disabled:f,value:x="on",onCheckedChange:g,form:j,...w}=e,[y,C]=r.useState(null),k=(0,o.useComposedRefs)(s,e=>C(e)),N=r.useRef(!1),P=!y||j||!!y.closest("form"),[T,S]=(0,i.useControllableState)({prop:u,defaultProp:p??!1,onChange:g,caller:c});return(0,t.jsxs)(h,{scope:n,checked:T,disabled:f,children:[(0,t.jsx)(d.Primitive.button,{type:"button",role:"switch","aria-checked":T,"aria-required":m,"data-state":b(T),"data-disabled":f?"":void 0,disabled:f,value:x,...w,ref:k,onClick:(0,a.composeEventHandlers)(e.onClick,e=>{S(e=>!e),P&&(N.current=e.isPropagationStopped(),N.current||e.stopPropagation())})}),P&&(0,t.jsx)(v,{control:y,bubbles:!N.current,name:l,value:x,checked:T,required:m,disabled:f,form:j,style:{transform:"translateX(-100%)"}})]})});f.displayName=c;var x="SwitchThumb",g=r.forwardRef((e,r)=>{let{__scopeSwitch:a,...o}=e,s=m(x,a);return(0,t.jsx)(d.Primitive.span,{"data-state":b(s.checked),"data-disabled":s.disabled?"":void 0,...o,ref:r})});g.displayName=x;var v=r.forwardRef(({__scopeSwitch:e,control:a,checked:s,bubbles:i=!0,...d},c)=>{let u=r.useRef(null),p=(0,o.useComposedRefs)(u,c),h=(0,n.usePrevious)(s),m=(0,l.useSize)(a);return r.useEffect(()=>{let e=u.current;if(!e)return;let t=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(h!==s&&t){let r=new Event("click",{bubbles:i});t.call(e,s),e.dispatchEvent(r)}},[h,s,i]),(0,t.jsx)("input",{type:"checkbox","aria-hidden":!0,defaultChecked:s,...d,tabIndex:-1,ref:p,style:{...d.style,...m,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function b(e){return e?"checked":"unchecked"}v.displayName="SwitchBubbleInput",e.s(["Root",()=>f,"Switch",()=>f,"SwitchThumb",()=>g,"Thumb",()=>g,"createSwitchScope",()=>p],95291);var j=e.i(95291),j=j,w=e.i(31777);function y({className:e,size:r="default",...a}){return(0,t.jsx)(j.Root,{"data-slot":"switch","data-size":r,className:(0,w.cn)("peer group/switch focus-visible:border-ring focus-visible:ring-ring/50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80 inline-flex shrink-0 cursor-pointer items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6",e),...a,children:(0,t.jsx)(j.Thumb,{"data-slot":"switch-thumb",className:(0,w.cn)("bg-background dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground pointer-events-none block rounded-full ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}e.s(["Switch",()=>y],51911);var C=e.i(21023);let k=(0,C.createServerReference)("0061c9a9d0c384ec5b024fa784643cae590447c276",C.callServer,void 0,C.findSourceMapURL,"getAllAgentModels");e.s(["getAllAgentModels",()=>k],20944);let N=(0,C.createServerReference)("600be6661853ede37844a68d7d10d3032ff28726ab",C.callServer,void 0,C.findSourceMapURL,"updateAgentAndModel");e.s(["updateAgentAndModel",()=>N],38432)},41413,e=>{"use strict";var t=e.i(20314),r=e.i(79054),a=e.i(23925),o=e.i(11345),s=e.i(76016),i=e.i(20944),n=e.i(38432),l=e.i(86782),d=e.i(29847),c=e.i(35364),u=e.i(90382),p=e.i(31777);function h({initialAgentType:e,initialModel:h,onAgentModelChange:m,disabled:f,className:x,mode:g}){let[v,b]=r.useState(!1),[j,w]=r.useState([]),[y,C]=r.useState(!0),[k,N]=r.useState(e),[P,T]=r.useState(h),[S,R]=r.useState(null),[A,D]=r.useState(0),[F,E]=r.useState(null);r.useEffect(()=>{(0,i.getAllAgentModels)().then(w).finally(()=>C(!1))},[]),r.useEffect(()=>{if(!v){let e=setTimeout(()=>{D(0),E(null)},150);return()=>clearTimeout(e)}},[v]);let M=async(e,t)=>{if(b(!1),e!==k||t!==P){if("override"===g){N(e),T(t),m?.(e,t);return}N(e),T(t),m?.(e,t),R(null);try{let r=await (0,n.updateAgentAndModel)(e,t||null);r.ok||(N(k),T(P),m?.(k,P),R(r.error??"Failed to save"))}catch{N(k),T(P),m?.(k,P),R("Failed to save")}}},O=(0,l.getAgentTypeIcon)(k),z=j.find(e=>e.agentType===k)?.label??k,I=P?(0,d.getModelMeta)(P).displayName||P:null,L=F?j.find(e=>e.agentType===F):null;return(0,t.jsxs)("div",{className:(0,p.cn)("flex flex-col gap-1",x),children:[(0,t.jsxs)(u.Popover,{open:v,onOpenChange:b,children:[(0,t.jsx)(u.PopoverTrigger,{asChild:!0,children:(0,t.jsx)(c.Button,{variant:"outline",role:"combobox","aria-expanded":v,disabled:(f??!1)||y,className:"w-auto cursor-pointer justify-start font-normal hover:border-violet-300 hover:bg-violet-50/50 dark:hover:border-violet-700 dark:hover:bg-violet-950/30",children:(0,t.jsxs)("span",{className:"flex items-center gap-2 truncate",children:[(0,t.jsx)(O,{className:"h-4 w-4 shrink-0"}),y?"Loading…":(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:z}),I?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-muted-foreground/50 text-xs",children:"·"}),(0,t.jsx)("span",{className:"text-xs font-medium",children:I})]}):null]})]})})}),(0,t.jsx)(u.PopoverContent,{className:"w-(--radix-popover-trigger-width) overflow-hidden p-0",align:"start",children:(0,t.jsxs)("div",{className:"flex transition-transform duration-200 ease-in-out",style:{transform:`translateX(${1===A?"-50%":"0%"})`,width:"200%"},children:[(0,t.jsxs)("div",{className:"w-1/2 shrink-0",children:[(0,t.jsx)("div",{className:"text-muted-foreground border-b px-3 py-2 text-xs font-medium",children:"Select agent"}),j.map(e=>{let r=(0,l.getAgentTypeIcon)(e.agentType),o=k===e.agentType,i=e.models.length>0;return(0,t.jsxs)("button",{type:"button",className:(0,p.cn)("flex w-full cursor-pointer items-center gap-2.5 px-3 py-2 text-xs transition-colors","hover:bg-accent hover:text-accent-foreground",o&&"bg-accent/50"),onClick:()=>{i?(E(e.agentType),requestAnimationFrame(()=>{requestAnimationFrame(()=>D(1))})):M(e.agentType,"")},children:[(0,t.jsx)(r,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{className:"flex-1 text-left",children:e.label}),o&&!i?(0,t.jsx)(a.Check,{className:"text-primary h-3.5 w-3.5 shrink-0"}):null,i?(0,t.jsx)(s.ChevronRight,{className:"text-muted-foreground h-3.5 w-3.5 shrink-0"}):null]},e.agentType)})]}),(0,t.jsx)("div",{className:"w-1/2 shrink-0",children:L?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("button",{type:"button",className:"text-muted-foreground hover:text-foreground flex w-full cursor-pointer items-center gap-1.5 border-b px-3 py-2 text-xs font-medium transition-colors",onClick:()=>{D(0),setTimeout(()=>E(null),220)},children:[(0,t.jsx)(o.ChevronLeft,{className:"h-3.5 w-3.5"}),L.label]}),L.models.map(e=>{let r=k===L.agentType&&P===e.id;return(0,t.jsxs)("button",{type:"button",className:(0,p.cn)("flex w-full cursor-pointer items-center gap-3 px-3 py-2 text-left transition-colors","hover:bg-accent hover:text-accent-foreground",r&&"bg-accent/50"),onClick:()=>M(L.agentType,e.id),children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,t.jsx)("span",{className:"text-xs font-medium",children:e.displayName}),(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:e.description})]}),r?(0,t.jsx)(a.Check,{className:"text-primary h-3.5 w-3.5 shrink-0"}):null]},e.id)})]}):null})]})})]}),!!S&&(0,t.jsx)("p",{className:"text-destructive text-sm",children:S})]})}e.s(["AgentModelPicker",()=>h])},15203,e=>{"use strict";var t=e.i(20314),r=e.i(79054),a=e.i(31406),o=e.i(60112),s=e.i(21023);let i=(0,s.createServerReference)("40bc4e648c2ec84de4249ca0ca9579657a1a225d30",s.callServer,void 0,s.findSourceMapURL,"createFeature");var n=e.i(16868);let l=(0,e.i(3645).default)("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);var d=e.i(97667),c=e.i(53360),u=e.i(31777),p=e.i(8361);e.i(1650);var h=e.i(11495),m=e.i(45811),f=e.i(35364),x=e.i(98127),g=e.i(48306),v=e.i(41957),b=e.i(81846),j=e.i(90382),w=e.i(51911),y=e.i(2828),C=e.i(30153);e.i(50032);var k=e.i(86254),N=e.i(41413),P=e.i(42076);let T=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg",".bmp",".ico",".pdf",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".txt",".md",".csv",".json",".yaml",".yml",".xml",".ts",".tsx",".js",".jsx",".py",".rb",".go",".rs",".java",".c",".cpp",".h",".hpp",".cs",".swift",".kt",".html",".css",".scss",".less",".sh",".bash",".zsh",".fish",".toml",".ini",".cfg",".conf",".env",".zip",".tar",".gz",".log"]),S=[{id:"allowPrd",label:"PRD",description:"Auto-approve requirements move to planning."},{id:"allowPlan",label:"Plan",description:"Auto-approve planning move to implementation."},{id:"allowMerge",label:"Merge",description:"Auto-approve merge move to Done."}],R={allowPrd:!1,allowPlan:!1,allowMerge:!1};function A({open:e,onClose:a,onSubmit:o,repositoryPath:s,isSubmitting:i=!1,workflowDefaults:l,features:d,initialParentId:x,currentAgentType:j,currentModel:A}){let F=(0,p.useSoundAction)("create"),E=l?.approvalGates??R,M=l?.push??!1,O=l?.openPr??!1,[z,I]=(0,r.useState)(""),[L,U]=(0,r.useState)([]),[B,$]=(0,r.useState)({...E}),[H,q]=(0,r.useState)(M),[G,_]=(0,r.useState)(O),[K,V]=(0,r.useState)(void 0),[X,W]=(0,r.useState)(!1),[Z,J]=(0,r.useState)(void 0),[Y,Q]=(0,r.useState)(void 0),[ee,et]=(0,r.useState)(!1),[er,ea]=(0,r.useState)(null),[eo,es]=(0,r.useState)(!1),ei=(0,r.useRef)(crypto.randomUUID()),en=(0,r.useRef)(0),el=(0,r.useRef)(null);(0,r.useEffect)(()=>{l&&($({...l.approvalGates}),q(l.push),_(l.openPr))},[l]),(0,r.useEffect)(()=>{e&&x&&V(x)},[e,x]);let ed=(0,r.useCallback)(()=>{I(""),U([]),$({...E}),q(M),_(O),V(void 0),W(!1),J(void 0),Q(void 0),ea(null),en.current=0,et(!1)},[E,M,O]),ec=""!==z.trim()||L.length>0,{attemptClose:eu}=(0,C.useGuardedDrawerClose)({open:e,isDirty:ec,onClose:a,onReset:ed}),ep=(0,r.useCallback)(async e=>{for(let t of(ea(null),e)){if(t.size>0xa00000)return void ea(`"${t.name}" exceeds 10 MB limit`);let e=function(e){let t=e.lastIndexOf(".");return t>=0?e.slice(t).toLowerCase():""}(t.name);if(e&&!T.has(e))return void ea(`File type "${e}" is not allowed`)}for(let t of e){let e=crypto.randomUUID();U(r=>[...r,{id:e,name:t.name,size:t.size,mimeType:t.type||"application/octet-stream",path:"",loading:!0}]);try{let r=new FormData;r.append("file",t),r.append("sessionId",ei.current);let a=await fetch("/api/attachments/upload",{method:"POST",body:r});if(!a.ok){let t=await a.json().catch(()=>({error:"Upload failed"}));U(t=>t.filter(t=>t.id!==e)),ea(t.error??"Upload failed");return}let o=await a.json();U(t=>t.some(t=>t.id!==e&&t.path===o.path)?t.filter(t=>t.id!==e):t.map(t=>t.id===e?{...o,id:e,loading:!1}:t))}catch{U(t=>t.filter(t=>t.id!==e)),ea("Upload failed")}}},[]),eh=(0,r.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),en.current+=1,1===en.current&&et(!0)},[]),em=(0,r.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),en.current-=1,0===en.current&&et(!1)},[]),ef=(0,r.useCallback)(e=>{e.preventDefault(),e.stopPropagation()},[]),ex=(0,r.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),en.current=0,et(!1);let t=Array.from(e.dataTransfer.files);t.length>0&&ep(t)},[ep]),eg=(0,r.useCallback)(e=>{let t=e.clipboardData?.items;if(!t)return;let r=[];for(let e of Array.from(t))if("file"===e.kind){let t=e.getAsFile();t&&r.push(t)}r.length>0&&(e.preventDefault(),ep(r))},[ep]),ev=(0,r.useCallback)(e=>{e.preventDefault(),z.trim()&&(F.play(),o({description:z.trim(),attachments:L.filter(e=>!e.loading),repositoryPath:s,approvalGates:{allowPrd:B.allowPrd??!1,allowPlan:B.allowPlan??!1,allowMerge:B.allowMerge??!1},push:H||G,openPr:G,fast:X,...Z?{agentType:Z}:{},...Y?{model:Y}:{},...K?{parentId:K}:{},sessionId:ei.current}),ed())},[z,L,B,s,o,H,G,X,Z,Y,K,F,ed]),eb=(0,r.useCallback)(async()=>{try{let e=await (0,P.pickFiles)();if(!e)return;for(let t of e){let e=crypto.randomUUID();U(r=>[...r,{id:e,name:t.name,size:t.size,mimeType:"application/octet-stream",path:"",loading:!0}]);try{let r=await fetch("/api/attachments/upload-from-path",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t.path,sessionId:ei.current})});if(!r.ok){let t=await r.json().catch(()=>({error:"Upload failed"}));U(t=>t.filter(t=>t.id!==e)),ea(t.error??"Upload failed");return}let a=await r.json();U(t=>t.some(t=>t.id!==e&&t.path===a.path)?t.filter(t=>t.id!==e):t.map(t=>t.id===e?{...a,id:e,loading:!1}:t))}catch{U(t=>t.filter(t=>t.id!==e)),ea("Upload failed")}}}catch{}},[]),ej=(0,r.useCallback)(e=>{U(t=>t.filter(t=>t.id!==e))},[]),ew=(0,r.useRef)(null),ey=(0,r.useCallback)(e=>{(e.ctrlKey||e.metaKey)&&"Enter"===e.key&&(e.preventDefault(),ew.current?.requestSubmit())},[]),eC=(0,r.useCallback)(()=>{es(!0)},[]),ek=(0,r.useCallback)(()=>{setTimeout(()=>{let e=el.current?.contains(document.activeElement),t=el.current?.querySelector('[aria-expanded="true"]')!==null;e||t||es(!1)},0)},[]),eN=d&&d.length>0;return(0,t.jsx)(h.BaseDrawer,{open:e,onClose:eu,size:"md",modal:!1,dismissOnOutsideClick:!0,"data-testid":"feature-create-drawer",header:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"h-2.5 w-2.5 shrink-0 rounded-full bg-blue-500"}),(0,t.jsx)(m.DrawerTitle,{children:"NEW FEATURE"})]}),i?(0,t.jsx)(m.DrawerDescription,{asChild:!0,children:(0,t.jsx)("div",{children:(0,t.jsx)(b.Badge,{variant:"secondary",children:"Creating..."})})}):null]}),footer:(0,t.jsxs)("div",{className:"flex flex-row justify-end gap-2",children:[(0,t.jsx)(f.Button,{variant:"outline",onClick:eu,disabled:i,children:"Cancel"}),(0,t.jsx)(f.Button,{type:"submit",form:"create-feature-form",disabled:!z.trim()||i,children:i?"Creating...":"+ Create Feature"})]}),children:(0,t.jsx)("div",{className:"overflow-y-auto p-4",children:(0,t.jsx)(y.TooltipProvider,{delayDuration:400,children:(0,t.jsxs)("form",{ref:ew,id:"create-feature-form",onSubmit:ev,className:"flex flex-col gap-4",children:[(0,t.jsxs)("div",{role:"region","aria-label":"File drop zone","data-drag-over":ee?"true":"false",onDragEnter:eh,onDragLeave:em,onDragOver:ef,onDrop:ex,className:(0,u.cn)("flex flex-col gap-1.5 rounded-md border-2 border-transparent p-1 transition-colors",ee&&"border-primary/50 bg-primary/5"),children:[(0,t.jsx)(v.Label,{htmlFor:"feature-description",className:"text-muted-foreground text-xs font-semibold tracking-wider",children:"DESCRIBE YOUR FEATURE"}),(0,t.jsxs)("div",{ref:el,onFocus:eC,onBlur:ek,className:(0,u.cn)("border-input flex h-56 flex-col overflow-hidden rounded-md border shadow-xs transition-[color,box-shadow]",eo&&"ring-ring/50 border-ring ring-[3px]"),children:[(0,t.jsx)(g.Textarea,{id:"feature-description",placeholder:"e.g. Add GitHub OAuth login with callback handling and token refresh...",value:z,onChange:e=>I(e.target.value),onKeyDown:ey,onPaste:eg,required:!0,disabled:i,className:"min-h-0 flex-1 resize-none rounded-none border-0 shadow-none focus-visible:ring-0"}),L.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-1.5 px-3 py-2",children:L.map(e=>(0,t.jsx)(k.AttachmentChip,{name:e.name,size:e.size,mimeType:e.mimeType,path:e.path,onRemove:()=>ej(e.id),disabled:i,loading:e.loading},e.id))}),er?(0,t.jsx)("p",{className:"text-destructive px-3 pb-2 text-xs",children:er}):null,(0,t.jsxs)("div",{className:"border-input flex items-center gap-3 border-t px-3 py-1.5",children:[(0,t.jsx)(N.AgentModelPicker,{initialAgentType:Z??j??"claude-code",initialModel:Y??A??"claude-sonnet-4-6",mode:"override",onAgentModelChange:(e,t)=>{J(e),Q(t)},disabled:i,className:"w-55"}),(0,t.jsxs)(y.Tooltip,{children:[(0,t.jsx)(y.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"ml-auto flex cursor-pointer items-center gap-2",children:[(0,t.jsx)(w.Switch,{id:"fast-mode",checked:X,onCheckedChange:W,disabled:i}),(0,t.jsxs)(v.Label,{htmlFor:"fast-mode",className:"flex cursor-pointer items-center gap-1 text-sm font-medium",children:[(0,t.jsx)(c.Zap,{className:"h-3.5 w-3.5"}),"Fast Mode"]})]})}),(0,t.jsx)(y.TooltipContent,{side:"bottom",children:"Skip SDLC phases and implement directly from your prompt."})]}),(0,t.jsxs)(y.Tooltip,{children:[(0,t.jsx)(y.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",onClick:eb,disabled:i,"aria-label":"Attach files",className:"text-muted-foreground hover:text-foreground cursor-pointer rounded p-1 transition-colors",children:(0,t.jsx)(n.PaperclipIcon,{className:"h-4 w-4"})})}),(0,t.jsx)(y.TooltipContent,{side:"bottom",children:"Attach files"})]})]})]})]}),eN&&void 0!==x?(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)(v.Label,{htmlFor:"parent-feature",className:"text-muted-foreground text-xs font-semibold tracking-wider",children:"PARENT FEATURE"}),(0,t.jsx)(D,{features:d,value:K,onChange:V,disabled:i})]}):null,(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsxs)("div",{className:"border-input flex items-center gap-4 rounded-md border px-3 py-2.5",children:[(0,t.jsxs)(y.Tooltip,{children:[(0,t.jsx)(y.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"text-muted-foreground w-16 shrink-0 cursor-default text-xs font-semibold tracking-wider",children:"APPROVE"})}),(0,t.jsx)(y.TooltipContent,{side:"bottom",children:"Auto-approve phase transitions without manual review."})]}),(0,t.jsx)("div",{className:"flex flex-1 items-center gap-4",children:S.map(e=>(0,t.jsxs)(y.Tooltip,{children:[(0,t.jsx)(y.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"flex cursor-pointer items-center gap-1.5",children:[(0,t.jsx)(w.Switch,{id:`approve-${e.id}`,size:"sm",checked:B[e.id]??!1,onCheckedChange:t=>$(r=>({...r,[e.id]:t})),disabled:i||X&&("allowPrd"===e.id||"allowPlan"===e.id)}),(0,t.jsx)(v.Label,{htmlFor:`approve-${e.id}`,className:"cursor-pointer text-xs font-medium",children:e.label})]})}),(0,t.jsx)(y.TooltipContent,{side:"bottom",children:X&&("allowPrd"===e.id||"allowPlan"===e.id)?"Skipped in Fast Mode":e.description})]},e.id))}),(0,t.jsxs)(y.Tooltip,{children:[(0,t.jsx)(y.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",onClick:()=>{let e=S.every(e=>B[e.id]),t={};for(let r of S)t[r.id]=!e;$(t)},disabled:i,className:(0,u.cn)("text-muted-foreground hover:text-foreground cursor-pointer rounded px-1.5 py-0.5 text-[10px] font-semibold tracking-wider uppercase transition-colors",S.every(e=>B[e.id])&&"text-primary"),children:"All"})}),(0,t.jsx)(y.TooltipContent,{side:"bottom",children:"Toggle all approval gates"})]})]}),(0,t.jsxs)("div",{className:"border-input flex items-center gap-4 rounded-md border px-3 py-2.5",children:[(0,t.jsx)("span",{className:"text-muted-foreground w-16 shrink-0 text-xs font-semibold tracking-wider",children:"GIT"}),(0,t.jsxs)("div",{className:"flex flex-1 items-center gap-4",children:[(0,t.jsxs)(y.Tooltip,{children:[(0,t.jsx)(y.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"flex cursor-pointer items-center gap-1.5",children:[(0,t.jsx)(w.Switch,{id:"push",size:"sm",checked:H||G,onCheckedChange:e=>{q(e),!e&&G&&_(!1)},disabled:i}),(0,t.jsx)(v.Label,{htmlFor:"push",className:"cursor-pointer text-xs font-medium",children:"Push"})]})}),(0,t.jsx)(y.TooltipContent,{side:"bottom",children:"Push branch to remote after implementation."})]}),(0,t.jsxs)(y.Tooltip,{children:[(0,t.jsx)(y.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("div",{className:"flex cursor-pointer items-center gap-1.5",children:[(0,t.jsx)(w.Switch,{id:"open-pr",size:"sm",checked:G,onCheckedChange:_,disabled:i}),(0,t.jsx)(v.Label,{htmlFor:"open-pr",className:"cursor-pointer text-xs font-medium",children:"PR"})]})}),(0,t.jsx)(y.TooltipContent,{side:"bottom",children:"Open a pull request after pushing."})]})]})]})]})]})})})})}function D({features:e,value:a,onChange:o,disabled:s}){let[i,n]=(0,r.useState)(!1),[c,p]=(0,r.useState)(""),h=(0,r.useRef)(null),m=e.find(e=>e.id===a),f=c.trim()?e.filter(e=>e.name.toLowerCase().includes(c.toLowerCase())||e.id.toLowerCase().includes(c.toLowerCase())):e,g=(0,r.useCallback)(e=>{o(e),n(!1),p("")},[o]);return(0,r.useEffect)(()=>{i?setTimeout(()=>h.current?.focus(),0):p("")},[i]),(0,t.jsxs)(j.Popover,{open:i,onOpenChange:n,children:[(0,t.jsx)(j.PopoverTrigger,{asChild:!0,children:(0,t.jsxs)("button",{id:"parent-feature",type:"button",role:"combobox","aria-expanded":i,"aria-label":"Parent Feature",disabled:s,"data-testid":"parent-feature-combobox",className:(0,u.cn)("border-input bg-background ring-offset-background focus:ring-ring flex h-9 w-full items-center justify-between rounded-md border px-3 py-2 text-sm focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",!m&&"text-muted-foreground"),children:[(0,t.jsx)("span",{className:"truncate",children:m?`${m.name} (${m.id.slice(0,8)})`:"Select parent feature..."}),(0,t.jsx)(l,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),(0,t.jsx)(j.PopoverContent,{className:"w-80 p-0",align:"start","data-testid":"parent-feature-combobox-content",children:(0,t.jsxs)("div",{className:"flex flex-col",children:[(0,t.jsx)("div",{className:"border-b p-2",children:(0,t.jsx)(x.Input,{ref:h,placeholder:"Search features...",value:c,onChange:e=>p(e.target.value),className:"h-8 border-0 p-0 text-sm shadow-none focus-visible:ring-0","data-testid":"parent-feature-search"})}),(0,t.jsxs)("div",{className:"max-h-48 overflow-y-auto py-1",role:"listbox","aria-label":"Features",children:[(0,t.jsxs)("button",{type:"button",role:"option","aria-selected":void 0===a,onClick:()=>g(void 0),className:(0,u.cn)("hover:bg-accent hover:text-accent-foreground flex w-full items-center gap-2 px-3 py-2 text-sm",void 0===a&&"bg-accent/50"),"data-testid":"parent-feature-option-none",children:[(0,t.jsx)(d.CheckIcon,{className:(0,u.cn)("h-4 w-4 shrink-0",void 0!==a&&"invisible")}),(0,t.jsx)("span",{className:"text-muted-foreground italic",children:"No parent"})]}),0===f.length&&c?(0,t.jsx)("p",{className:"text-muted-foreground px-3 py-2 text-sm",children:"No features found."}):f.map(e=>(0,t.jsxs)("button",{type:"button",role:"option","aria-selected":a===e.id,onClick:()=>g(e.id),className:(0,u.cn)("hover:bg-accent hover:text-accent-foreground flex w-full items-center gap-2 px-3 py-2 text-sm",a===e.id&&"bg-accent/50"),"data-testid":`parent-feature-option-${e.id}`,children:[(0,t.jsx)(d.CheckIcon,{className:(0,u.cn)("h-4 w-4 shrink-0",a!==e.id&&"invisible")}),(0,t.jsxs)("span",{className:"truncate",children:[e.name," ",(0,t.jsxs)("span",{className:"text-muted-foreground font-mono text-xs",children:["(",e.id.slice(0,8),")"]})]})]},e.id))]})]})})]})}function F({repositoryPath:e,initialParentId:s,features:n,workflowDefaults:l,currentAgentType:d,currentModel:c}){let u=(0,a.useRouter)(),[p,h]=(0,r.useState)(!1),m=(0,a.usePathname)().startsWith("/create"),f=!p&&m;(0,r.useEffect)(()=>{!m&&p&&h(!1)},[m,p]);let x=(0,r.useCallback)(()=>{u.push("/")},[u]),g=(0,r.useCallback)(e=>{h(!0),u.push("/"),i(e).then(t=>{t.error?o.toast.error(t.error):window.dispatchEvent(new CustomEvent("shep:feature-created",{detail:{featureId:t.feature.id,name:t.feature.name,description:t.feature.description,repositoryPath:t.feature.repositoryPath,parentId:e.parentId}}))}).catch(()=>{o.toast.error("Failed to create feature"),h(!1)})},[u]);return(0,t.jsx)(A,{open:f,onClose:x,onSubmit:g,repositoryPath:e,features:n,workflowDefaults:l,initialParentId:s,isSubmitting:p,currentAgentType:d,currentModel:c})}e.s(["CreateDrawerClient",()=>F],15203)}]);
|