@manojkmfsi/monodog 1.0.25 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -64,7 +64,7 @@ Error generating stack: `+a.message+`
64
64
  * LICENSE.md file in the root directory of this source tree.
65
65
  *
66
66
  * @license MIT
67
- */function Sa(){return Sa=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Sa.apply(this,arguments)}function R0(e,t){if(e==null)return{};var n={},s=Object.keys(e),l,a;for(a=0;a<s.length;a++)l=s[a],!(t.indexOf(l)>=0)&&(n[l]=e[l]);return n}function T0(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function M0(e,t){return e.button===0&&(!t||t==="_self")&&!T0(e)}const _0=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],O0="6";try{window.__reactRouterVersion=O0}catch{}const $0="startTransition",Jo=km[$0];function I0(e){let{basename:t,children:n,future:s,window:l}=e,a=d.useRef();a.current==null&&(a.current=Ff({window:l,v5Compat:!0}));let i=a.current,[c,o]=d.useState({action:i.action,location:i.location}),{v7_startTransition:u}=s||{},p=d.useCallback(m=>{u&&Jo?Jo(()=>o(m)):o(m)},[o,u]);return d.useLayoutEffect(()=>i.listen(p),[i,p]),d.useEffect(()=>E0(s),[s]),d.createElement(P0,{basename:t,children:n,location:c.location,navigationType:c.action,navigator:i,future:s})}const F0=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",D0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,rt=d.forwardRef(function(t,n){let{onClick:s,relative:l,reloadDocument:a,replace:i,state:c,target:o,to:u,preventScrollReset:p,viewTransition:m}=t,g=R0(t,_0),{basename:v}=d.useContext(Xt),j,N=!1;if(typeof u=="string"&&D0.test(u)&&(j=u,F0))try{let f=new URL(window.location.href),w=u.startsWith("//")?new URL(f.protocol+u):new URL(u),S=bi(w.pathname,v);w.origin===f.origin&&S!=null?u=S+w.search+w.hash:N=!0}catch{}let b=u0(u,{relative:l}),x=A0(u,{replace:i,state:c,target:o,preventScrollReset:p,relative:l,viewTransition:m});function h(f){s&&s(f),f.defaultPrevented||x(f)}return d.createElement("a",Sa({},g,{href:j||b,onClick:N||a?s:h,ref:n,target:o}))});var qo;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(qo||(qo={}));var ec;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(ec||(ec={}));function A0(e,t){let{target:n,replace:s,state:l,preventScrollReset:a,relative:i,viewTransition:c}=t===void 0?{}:t,o=d0(),u=Cr(),p=Id(e,{relative:i});return d.useCallback(m=>{if(M0(m,n)){m.preventDefault();let g=s!==void 0?s:Rs(u)===Rs(p);o(e,{replace:g,state:l,preventScrollReset:a,relative:i,viewTransition:c})}},[u,o,p,s,l,n,e,a,i,c])}const Ad=[{path:"/",name:"dashboard",component:"Dashboard",title:"Dashboard",description:"Main dashboard overview",exact:!0},{path:"/packages",name:"packages",component:"PackagesOverview",title:"Packages",description:"Package management and overview",exact:!0},{path:"/packages/:name",name:"package-detail",component:"PackageDetail",title:"Package Details",description:"Detailed view of a specific package"},{path:"/dependencies",name:"dependencies",component:"DependencyGraph",title:"Dependencies",description:"Dependency graph visualization"},{path:"/health",name:"health",component:"HealthStatus",title:"Health Status",description:"Monorepo health monitoring"},{path:"/config",name:"config",component:"ConfigInspector",title:"Configuration",description:"Configuration file inspector"}];Ad.filter(e=>!e.path.includes(":")&&e.path!=="/");function z0({isOpen:e,onClose:t,children:n}){return e?r.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:r.jsx("div",{className:"bg-white rounded-lg shadow-xl w-full max-w-4xl max-h-[90vh] overflow-hidden",onClick:s=>s.stopPropagation(),children:n})}):null}function B0({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 13.5 12 21m0 0-7.5-7.5M12 21V3"}))}const U0=d.forwardRef(B0),zd=U0;function H0({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18"}))}const V0=d.forwardRef(H0),W0=V0;function Q0({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99"}))}const Y0=d.forwardRef(Q0),ot=Y0;function Z0({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 4.5 21 12m0 0-7.5 7.5M21 12H3"}))}const G0=d.forwardRef(Z0),tc=G0;function K0({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 10.5 12 3m0 0 7.5 7.5M12 3v18"}))}const X0=d.forwardRef(K0),Si=X0;function J0({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.75 3.104v5.714a2.25 2.25 0 0 1-.659 1.591L5 14.5M9.75 3.104c-.251.023-.501.05-.75.082m.75-.082a24.301 24.301 0 0 1 4.5 0m0 0v5.714c0 .597.237 1.17.659 1.591L19.8 15.3M14.25 3.104c.251.023.501.05.75.082M19.8 15.3l-1.57.393A9.065 9.065 0 0 1 12 15a9.065 9.065 0 0 0-6.23-.693L5 14.5m14.8.8 1.402 1.402c1.232 1.232.65 3.318-1.067 3.611A48.309 48.309 0 0 1 12 21c-2.773 0-5.491-.235-8.135-.687-1.718-.293-2.3-2.379-1.067-3.61L5 14.5"}))}const q0=d.forwardRef(J0),ex=q0;function tx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5"}))}const nx=d.forwardRef(tx),Bd=nx;function rx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 13.125C3 12.504 3.504 12 4.125 12h2.25c.621 0 1.125.504 1.125 1.125v6.75C7.5 20.496 6.996 21 6.375 21h-2.25A1.125 1.125 0 0 1 3 19.875v-6.75ZM9.75 8.625c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125v11.25c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 0 1-1.125-1.125V8.625ZM16.5 4.125c0-.621.504-1.125 1.125-1.125h2.25C20.496 3 21 3.504 21 4.125v15.75c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 0 1-1.125-1.125V4.125Z"}))}const sx=d.forwardRef(rx),Er=sx;function lx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}const ax=d.forwardRef(lx),Ke=ax;function ix({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 12.75 6 6 9-13.5"}))}const ox=d.forwardRef(ix),Ci=ox;function cx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.35 3.836c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75 2.25 2.25 0 0 0-.1-.664m-5.8 0A2.251 2.251 0 0 1 13.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m8.9-4.414c.376.023.75.05 1.124.08 1.131.094 1.976 1.057 1.976 2.192V16.5A2.25 2.25 0 0 1 18 18.75h-2.25m-7.5-10.5H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V18.75m-7.5-10.5h6.375c.621 0 1.125.504 1.125 1.125v9.375m-8.25-3 1.5 1.5 3-3.75"}))}const ux=d.forwardRef(cx),nc=ux;function dx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.666 3.888A2.25 2.25 0 0 0 13.5 2.25h-3c-1.03 0-1.9.693-2.166 1.638m7.332 0c.055.194.084.4.084.612v0a.75.75 0 0 1-.75.75H9a.75.75 0 0 1-.75-.75v0c0-.212.03-.418.084-.612m7.332 0c.646.049 1.288.11 1.927.184 1.1.128 1.907 1.077 1.907 2.185V19.5a2.25 2.25 0 0 1-2.25 2.25H6.75A2.25 2.25 0 0 1 4.5 19.5V6.257c0-1.108.806-2.057 1.907-2.185a48.208 48.208 0 0 1 1.927-.184"}))}const mx=d.forwardRef(dx),rc=mx;function hx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}const fx=d.forwardRef(hx),ct=fx;function xx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 16.5V9.75m0 0 3 3m-3-3-3 3M6.75 19.5a4.5 4.5 0 0 1-1.41-8.775 5.25 5.25 0 0 1 10.233-2.33 3 3 0 0 1 3.758 3.848A3.752 3.752 0 0 1 18 19.5H6.75Z"}))}const px=d.forwardRef(xx),gx=px;function yx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 0 1 1.37.49l1.296 2.247a1.125 1.125 0 0 1-.26 1.431l-1.003.827c-.293.241-.438.613-.43.992a7.723 7.723 0 0 1 0 .255c-.008.378.137.75.43.991l1.004.827c.424.35.534.955.26 1.43l-1.298 2.247a1.125 1.125 0 0 1-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.47 6.47 0 0 1-.22.128c-.331.183-.581.495-.644.869l-.213 1.281c-.09.543-.56.94-1.11.94h-2.594c-.55 0-1.019-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 0 1-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 0 1-1.369-.49l-1.297-2.247a1.125 1.125 0 0 1 .26-1.431l1.004-.827c.292-.24.437-.613.43-.991a6.932 6.932 0 0 1 0-.255c.007-.38-.138-.751-.43-.992l-1.004-.827a1.125 1.125 0 0 1-.26-1.43l1.297-2.247a1.125 1.125 0 0 1 1.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.086.22-.128.332-.183.582-.495.644-.869l.214-1.28Z"}),d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))}const vx=d.forwardRef(yx),Ms=vx;function jx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12a7.5 7.5 0 0 0 15 0m-15 0a7.5 7.5 0 1 1 15 0m-15 0H3m16.5 0H21m-1.5 0H12m-8.457 3.077 1.41-.513m14.095-5.13 1.41-.513M5.106 17.785l1.15-.964m11.49-9.642 1.149-.964M7.501 19.795l.75-1.3m7.5-12.99.75-1.3m-6.063 16.658.26-1.477m2.605-14.772.26-1.477m0 17.726-.26-1.477M10.698 4.614l-.26-1.477M16.5 19.794l-.75-1.299M7.5 4.205 12 12m6.894 5.785-1.149-.964M6.256 7.178l-1.15-.964m15.352 8.864-1.41-.513M4.954 9.435l-1.41-.514M12.002 12l-3.75 6.495"}))}const wx=d.forwardRef(jx),Ud=wx;function Nx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 3v1.5M4.5 8.25H3m18 0h-1.5M4.5 12H3m18 0h-1.5m-15 3.75H3m18 0h-1.5M8.25 19.5V21M12 3v1.5m0 15V21m3.75-18v1.5m0 15V21m-9-1.5h10.5a2.25 2.25 0 0 0 2.25-2.25V6.75a2.25 2.25 0 0 0-2.25-2.25H6.75A2.25 2.25 0 0 0 4.5 6.75v10.5a2.25 2.25 0 0 0 2.25 2.25Zm.75-12h9v9h-9v-9Z"}))}const bx=d.forwardRef(Nx),kx=bx;function Sx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 7.5-9-5.25L3 7.5m18 0-9 5.25m9-5.25v9l-9 5.25M3 7.5l9 5.25M3 7.5v9l9 5.25m0-9v9"}))}const Cx=d.forwardRef(Sx),qs=Cx;function Ex({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.125 2.25h-4.5c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125v-9M10.125 2.25h.375a9 9 0 0 1 9 9v.375M10.125 2.25A3.375 3.375 0 0 1 13.5 5.625v1.5c0 .621.504 1.125 1.125 1.125h1.5a3.375 3.375 0 0 1 3.375 3.375M9 15l2.25 2.25L15 12"}))}const Px=d.forwardRef(Ex),Lx=Px;function Rx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 0 1-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 0 1 1.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 0 0-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 0 1-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 0 0-3.375-3.375h-1.5a1.125 1.125 0 0 1-1.125-1.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H9.75"}))}const Tx=d.forwardRef(Rx),Mx=Tx;function _x({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z"}))}const Ox=d.forwardRef(_x),Ei=Ox;function $x({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"}))}const Ix=d.forwardRef($x),te=Ix;function Fx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.98 8.223A10.477 10.477 0 0 0 1.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.451 10.451 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.522 10.522 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88"}))}const Dx=d.forwardRef(Fx),Ax=Dx;function zx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z"}),d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))}const Bx=d.forwardRef(zx),Ux=Bx;function Hx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 0 1-.659 1.591l-5.432 5.432a2.25 2.25 0 0 0-.659 1.591v2.927a2.25 2.25 0 0 1-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 0 0-.659-1.591L3.659 7.409A2.25 2.25 0 0 1 3 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0 1 12 3Z"}))}const Vx=d.forwardRef(Hx),el=Vx;function Wx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 8.25c0-2.485-2.099-4.5-4.688-4.5-1.935 0-3.597 1.126-4.312 2.733-.715-1.607-2.377-2.733-4.313-2.733C5.1 3.75 3 5.765 3 8.25c0 7.22 9 12 9 12s9-4.78 9-12Z"}))}const Qx=d.forwardRef(Wx),Hd=Qx;function Yx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m2.25 12 8.954-8.955c.44-.439 1.152-.439 1.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25"}))}const Zx=d.forwardRef(Yx),Gx=Zx;function Kx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"}))}const Xx=d.forwardRef(Kx),vn=Xx;function Jx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 6.75h12M8.25 12h12m-12 5.25h12M3.75 6.75h.007v.008H3.75V6.75Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0ZM3.75 12h.007v.008H3.75V12Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm-.375 5.25h.007v.008H3.75v-.008Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z"}))}const qx=d.forwardRef(Jx),ep=qx;function tp({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607ZM13.5 10.5h-6"}))}const np=d.forwardRef(tp),rp=np;function sp({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607ZM10.5 7.5v6m3-3h-6"}))}const lp=d.forwardRef(sp),ap=lp;function ip({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"}))}const op=d.forwardRef(ip),Pi=op;function cp({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25v13.5m-7.5-13.5v13.5"}))}const up=d.forwardRef(cp),dp=up;function mp({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L6.832 19.82a4.5 4.5 0 0 1-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 0 1 1.13-1.897L16.863 4.487Zm0 0L19.5 7.125"}))}const hp=d.forwardRef(mp),fp=hp;function xp({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.347a1.125 1.125 0 0 1 0 1.972l-11.54 6.347a1.125 1.125 0 0 1-1.667-.986V5.653Z"}))}const pp=d.forwardRef(xp),Li=pp;function gp({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6A2.25 2.25 0 0 1 6 3.75h2.25A2.25 2.25 0 0 1 10.5 6v2.25a2.25 2.25 0 0 1-2.25 2.25H6a2.25 2.25 0 0 1-2.25-2.25V6ZM3.75 15.75A2.25 2.25 0 0 1 6 13.5h2.25a2.25 2.25 0 0 1 2.25 2.25V18a2.25 2.25 0 0 1-2.25 2.25H6A2.25 2.25 0 0 1 3.75 18v-2.25ZM13.5 6a2.25 2.25 0 0 1 2.25-2.25H18A2.25 2.25 0 0 1 20.25 6v2.25A2.25 2.25 0 0 1 18 10.5h-2.25a2.25 2.25 0 0 1-2.25-2.25V6ZM13.5 15.75a2.25 2.25 0 0 1 2.25-2.25H18a2.25 2.25 0 0 1 2.25 2.25V18A2.25 2.25 0 0 1 18 20.25h-2.25A2.25 2.25 0 0 1 13.5 18v-2.25Z"}))}const yp=d.forwardRef(gp),vp=yp;function jp({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 0 1 7.5 5.25h9a2.25 2.25 0 0 1 2.25 2.25v9a2.25 2.25 0 0 1-2.25 2.25h-9a2.25 2.25 0 0 1-2.25-2.25v-9Z"}))}const wp=d.forwardRef(jp),Ca=wp;function Np({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.568 3H5.25A2.25 2.25 0 0 0 3 5.25v4.318c0 .597.237 1.17.659 1.591l9.581 9.581c.699.699 1.78.872 2.607.33a18.095 18.095 0 0 0 5.223-5.223c.542-.827.369-1.908-.33-2.607L11.16 3.66A2.25 2.25 0 0 0 9.568 3Z"}),d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 6h.008v.008H6V6Z"}))}const bp=d.forwardRef(Np),Ri=bp;function kp({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 6a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0ZM4.501 20.118a7.5 7.5 0 0 1 14.998 0A17.933 17.933 0 0 1 12 21.75c-2.676 0-5.216-.584-7.499-1.632Z"}))}const Sp=d.forwardRef(kp),Cp=Sp;function Ep({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}const Pp=d.forwardRef(Ep),Xe=Pp;function Lp({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18 18 6M6 6l12 12"}))}const Rp=d.forwardRef(Lp),Pr=Rp;function Tp({onSave:e,onClose:t}){return r.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200",children:[r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx(Ud,{className:"w-6 h-6 text-gray-600"}),r.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:"Dashboard Configuration"})]}),r.jsxs("div",{className:"flex space-x-3",children:[r.jsxs("button",{onClick:e,className:"bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 flex items-center space-x-2",children:[r.jsx(Ci,{className:"w-5 h-5"}),r.jsx("span",{children:"Save"})]}),r.jsxs("button",{onClick:t,className:"bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 flex items-center space-x-2",children:[r.jsx(Pr,{className:"w-5 h-5"}),r.jsx("span",{children:"Cancel"})]})]})]})}const Mp=()=>[{id:"general",label:"General",icon:"⚙️"},{id:"features",label:"Features",icon:"🚀"},{id:"branding",label:"Branding",icon:"🎨"},{id:"monorepo",label:"Monorepo",icon:"📦"}],_p=()=>({title:"monodog Dashboard",description:"Visual management of our monorepo packages",packageTypes:["app","lib","tool","service"],customFields:["team","priority","environment"],features:{healthChecks:!0,ciIntegration:!0,dependencyGraph:!0,publishControl:!0,searchAndFilter:!0,configurationInspector:!0},branding:{logo:"",primaryColor:"#3B82F6",secondaryColor:"#1E40AF"},monorepo:{structure:"standard",packageManager:"pnpm",directories:["apps","packages","libs"],ignorePatterns:["node_modules","dist",".git"]}}),sc=e=>{const t=_p();return{...t,...e,features:{...t.features,...e.features},branding:{...t.branding,...e.branding},monorepo:{...t.monorepo,...e.monorepo}}},Op=e=>{var n,s,l;const t=[];return(!e.title||e.title.trim()==="")&&t.push("Dashboard title is required"),(n=e.monorepo)!=null&&n.directories&&e.monorepo.directories.length===0&&t.push("At least one package directory is required"),(s=e.branding)!=null&&s.primaryColor&&!lc(e.branding.primaryColor)&&t.push("Primary color must be a valid hex color"),(l=e.branding)!=null&&l.secondaryColor&&!lc(e.branding.secondaryColor)&&t.push("Secondary color must be a valid hex color"),{isValid:t.length===0,errors:t}},lc=e=>/^#[0-9A-F]{6}$/i.test(e),_s=e=>e.split(",").map(t=>t.trim()).filter(t=>t.length>0),Os=e=>e?e.join(", "):"",$p=e=>e.replace(/([A-Z])/g," $1").trim();function Ip({activeTab:e,onTabChange:t}){const n=Mp();return r.jsx("div",{className:"border-b border-gray-200",children:r.jsx("nav",{className:"flex space-x-8 px-6",children:n.map(s=>r.jsxs("button",{onClick:()=>t(s.id),className:`py-4 px-1 border-b-2 font-medium text-sm flex items-center space-x-2 ${e===s.id?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:[r.jsx("span",{children:s.icon}),r.jsx("span",{children:s.label})]},s.id))})})}function ac({config:e,onConfigChange:t}){return r.jsx("div",{className:"space-y-6",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:"General Settings"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Dashboard Title"}),r.jsx("input",{type:"text",value:e.title||"",onChange:n=>t({title:n.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"My Monorepo Dashboard"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Description"}),r.jsx("input",{type:"text",value:e.description||"",onChange:n=>t({description:n.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Visual management of our monorepo packages"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Package Types"}),r.jsx("input",{type:"text",value:Os(e.packageTypes),onChange:n=>t({packageTypes:_s(n.target.value)}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"app, lib, tool, service"}),r.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Comma-separated list of package types"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Custom Fields"}),r.jsx("input",{type:"text",value:Os(e.customFields),onChange:n=>t({customFields:_s(n.target.value)}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"team, priority, environment"}),r.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Additional fields to display for packages"})]})]})]})})}function Fp({config:e,onConfigChange:t}){const n=(s,l)=>{t({features:{...e.features,[s]:l}})};return r.jsx("div",{className:"space-y-6",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:"Feature Toggles"}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:Object.entries(e.features||{}).map(([s,l])=>r.jsxs("label",{className:"flex items-center space-x-3",children:[r.jsx("input",{type:"checkbox",checked:l,onChange:a=>n(s,a.target.checked),className:"h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded"}),r.jsx("span",{className:"text-sm font-medium text-gray-700 capitalize",children:$p(s)})]},s))}),r.jsxs("div",{className:"mt-6 p-4 bg-blue-50 border border-blue-200 rounded-lg",children:[r.jsx("h4",{className:"text-sm font-medium text-blue-900 mb-2",children:"Feature Descriptions"}),r.jsxs("div",{className:"text-xs text-blue-800 space-y-1",children:[r.jsxs("div",{children:[r.jsx("strong",{children:"Health Checks:"})," Monitor package health and status"]}),r.jsxs("div",{children:[r.jsx("strong",{children:"CI Integration:"})," Connect with CI/CD providers"]}),r.jsxs("div",{children:[r.jsx("strong",{children:"Dependency Graph:"})," Visualize package dependencies"]}),r.jsxs("div",{children:[r.jsx("strong",{children:"Publish Control:"})," Manage package publishing and versioning"]}),r.jsxs("div",{children:[r.jsx("strong",{children:"Search And Filter:"})," Advanced search and filtering capabilities"]}),r.jsxs("div",{children:[r.jsx("strong",{children:"Configuration Inspector:"})," View and edit configuration files"]})]})]})]})})}function Dp({config:e,onConfigChange:t}){var s,l,a,i,c,o,u,p;const n=(m,g)=>{t({branding:{...e.branding,[m]:g}})};return r.jsx("div",{className:"space-y-6",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:"Branding & Appearance"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Logo URL"}),r.jsx("input",{type:"text",value:((s=e.branding)==null?void 0:s.logo)||"",onChange:m=>n("logo",m.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"https://example.com/logo.png"}),r.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"URL to your company logo"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Primary Color"}),r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx("input",{type:"color",value:((l=e.branding)==null?void 0:l.primaryColor)||"#3B82F6",onChange:m=>n("primaryColor",m.target.value),className:"h-10 w-20 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"}),r.jsx("input",{type:"text",value:((a=e.branding)==null?void 0:a.primaryColor)||"#3B82F6",onChange:m=>n("primaryColor",m.target.value),className:"flex-1 px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"#3B82F6"})]}),r.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Primary brand color for buttons and accents"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Secondary Color"}),r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx("input",{type:"color",value:((i=e.branding)==null?void 0:i.secondaryColor)||"#1E40AF",onChange:m=>n("secondaryColor",m.target.value),className:"h-10 w-20 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"}),r.jsx("input",{type:"text",value:((c=e.branding)==null?void 0:c.secondaryColor)||"#1E40AF",onChange:m=>n("secondaryColor",m.target.value),className:"flex-1 px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"#1E40AF"})]}),r.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Secondary color for hover states and highlights"})]})]}),r.jsxs("div",{className:"mt-6 p-4 bg-gray-50 border border-gray-200 rounded-lg",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 mb-3",children:"Color Preview"}),r.jsxs("div",{className:"flex items-center space-x-4",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("div",{className:"w-8 h-8 rounded-lg border border-gray-300",style:{backgroundColor:((o=e.branding)==null?void 0:o.primaryColor)||"#3B82F6"}}),r.jsx("span",{className:"text-sm text-gray-600",children:"Primary"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("div",{className:"w-8 h-8 rounded-lg border border-gray-300",style:{backgroundColor:((u=e.branding)==null?void 0:u.secondaryColor)||"#1E40AF"}}),r.jsx("span",{className:"text-sm text-gray-600",children:"Secondary"})]}),r.jsx("button",{className:"px-4 py-2 rounded-lg text-white text-sm font-medium",style:{backgroundColor:((p=e.branding)==null?void 0:p.primaryColor)||"#3B82F6"},children:"Sample Button"})]})]})]})})}function Ap({config:e,onConfigChange:t}){var s,l,a,i,c,o,u,p,m,g,v;const n=(j,N)=>{t({monorepo:{...e.monorepo,[j]:N}})};return r.jsx("div",{className:"space-y-6",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:"Monorepo Configuration"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Structure Type"}),r.jsxs("select",{value:((s=e.monorepo)==null?void 0:s.structure)||"standard",onChange:j=>n("structure",j.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[r.jsx("option",{value:"standard",children:"Standard (apps/packages/libs)"}),r.jsx("option",{value:"custom",children:"Custom Structure"})]}),r.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Choose your monorepo directory structure"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Package Manager"}),r.jsxs("select",{value:((l=e.monorepo)==null?void 0:l.packageManager)||"pnpm",onChange:j=>n("packageManager",j.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[r.jsx("option",{value:"pnpm",children:"pnpm"}),r.jsx("option",{value:"npm",children:"npm"}),r.jsx("option",{value:"yarn",children:"Yarn"}),r.jsx("option",{value:"lerna",children:"Lerna"}),r.jsx("option",{value:"nx",children:"Nx"})]}),r.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Package manager used in your monorepo"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Package Directories"}),r.jsx("input",{type:"text",value:Os((a=e.monorepo)==null?void 0:a.directories),onChange:j=>n("directories",_s(j.target.value)),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"apps, packages, libs, services"}),r.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Directories containing packages"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Ignore Patterns"}),r.jsx("input",{type:"text",value:Os((i=e.monorepo)==null?void 0:i.ignorePatterns),onChange:j=>n("ignorePatterns",_s(j.target.value)),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"node_modules, dist, .git"}),r.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Patterns to ignore when scanning"})]})]}),r.jsxs("div",{className:"mt-6 p-4 bg-gray-50 border border-gray-200 rounded-lg",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 mb-3",children:"Configuration Preview"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 text-sm",children:[r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-gray-700",children:"Structure:"}),r.jsx("span",{className:"ml-2 text-gray-600 capitalize",children:((c=e.monorepo)==null?void 0:c.structure)||"standard"})]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-gray-700",children:"Package Manager:"}),r.jsx("span",{className:"ml-2 text-gray-600",children:((o=e.monorepo)==null?void 0:o.packageManager)||"pnpm"})]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-gray-700",children:"Directories:"}),r.jsxs("span",{className:"ml-2 text-gray-600",children:[((p=(u=e.monorepo)==null?void 0:u.directories)==null?void 0:p.length)||0," configured"]})]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-gray-700",children:"Ignore Patterns:"}),r.jsxs("span",{className:"ml-2 text-gray-600",children:[((g=(m=e.monorepo)==null?void 0:m.ignorePatterns)==null?void 0:g.length)||0," patterns"]})]})]})]}),((v=e.monorepo)==null?void 0:v.packageManager)&&r.jsxs("div",{className:"mt-4 p-4 bg-blue-50 border border-blue-200 rounded-lg",children:[r.jsxs("h4",{className:"text-sm font-medium text-blue-900 mb-2",children:[e.monorepo.packageManager.toUpperCase()," Configuration Tips"]}),r.jsxs("div",{className:"text-xs text-blue-800",children:[e.monorepo.packageManager==="pnpm"&&r.jsx("p",{children:"Make sure you have a pnpm-workspace.yaml file in your root directory."}),e.monorepo.packageManager==="npm"&&r.jsx("p",{children:'Configure workspaces in your package.json with the "workspaces" field.'}),e.monorepo.packageManager==="yarn"&&r.jsx("p",{children:"Ensure you have workspaces configured in your package.json."}),e.monorepo.packageManager==="lerna"&&r.jsx("p",{children:"Make sure you have a lerna.json configuration file in your root."}),e.monorepo.packageManager==="nx"&&r.jsx("p",{children:"Ensure you have an nx.json configuration file in your workspace root."})]})]})]})})}function zp({isOpen:e,onClose:t,onSave:n,currentConfig:s}){const[l,a]=d.useState(sc(s)),[i,c]=d.useState("general");d.useEffect(()=>{a(sc(s))},[s]);const o=()=>{const m=Op(l);m.isValid||console.warn("Configuration validation errors:",m.errors),n(l),t()},u=m=>{a(g=>({...g,...m}))},p=()=>{const m={config:l,onConfigChange:u};switch(i){case"general":return r.jsx(ac,{...m});case"features":return r.jsx(Fp,{...m});case"branding":return r.jsx(Dp,{...m});case"monorepo":return r.jsx(Ap,{...m});default:return r.jsx(ac,{...m})}};return r.jsxs(z0,{isOpen:e,onClose:t,children:[r.jsx(Tp,{onSave:o,onClose:t}),r.jsx(Ip,{activeTab:i,onTabChange:c}),r.jsx("div",{className:"p-6 overflow-y-auto max-h-[60vh]",children:p()})]})}function Bp({isOpen:e,onClose:t,children:n}){return e?r.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50",children:r.jsx("div",{className:"bg-white rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] overflow-hidden",onClick:s=>s.stopPropagation(),children:n})}):null}function Up({onClose:e}){return r.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:"Setup Guide"}),r.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"Configure your monorepo dashboard for optimal performance"})]}),r.jsx("button",{onClick:e,className:"text-gray-400 hover:text-gray-600 transition-colors",children:r.jsx(Pr,{className:"w-6 h-6"})})]})}function Hp({progress:e}){const{currentStep:t,totalSteps:n,completedSteps:s}=e,l=(t+1)/n*100;return r.jsxs("div",{className:"px-6 py-4 border-b border-gray-200",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("span",{className:"text-sm font-medium text-gray-700",children:["Step ",t+1," of ",n]}),r.jsxs("span",{className:"text-sm text-gray-500",children:[s," completed"]})]}),r.jsx("div",{className:"w-full bg-gray-200 rounded-full h-2",children:r.jsx("div",{className:"bg-blue-600 h-2 rounded-full transition-all duration-300",style:{width:`${l}%`}})})]})}function Vp({step:e,onStepComplete:t}){const n=()=>{switch(e.id){case"monorepo-structure":return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:[r.jsx("h4",{className:"font-medium text-blue-900 mb-2",children:"Quick Setup"}),r.jsx("p",{className:"text-blue-800 text-sm mb-3",children:"Choose your monorepo structure to get started quickly:"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[r.jsxs("button",{onClick:()=>t(e.id),className:"p-3 border border-blue-300 rounded-lg hover:bg-blue-100 text-left",children:[r.jsx("div",{className:"font-medium text-blue-900",children:"Standard Structure"}),r.jsx("div",{className:"text-sm text-blue-700",children:"apps/, packages/, libs/"})]}),r.jsxs("button",{onClick:()=>t(e.id),className:"p-3 border border-blue-300 rounded-lg hover:bg-blue-100 text-left",children:[r.jsx("div",{className:"font-medium text-blue-900",children:"Custom Structure"}),r.jsx("div",{className:"text-sm text-blue-700",children:"Define your own directories"})]})]})]}),r.jsxs("div",{className:"bg-gray-50 border border-gray-200 rounded-lg p-4",children:[r.jsx("h4",{className:"font-medium text-gray-900 mb-2",children:"Manual Configuration"}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Root Directory"}),r.jsx("input",{type:"text",defaultValue:"/path/to/monorepo",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Package Manager"}),r.jsxs("select",{className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm",children:[r.jsx("option",{value:"pnpm",children:"pnpm"}),r.jsx("option",{value:"npm",children:"npm"}),r.jsx("option",{value:"yarn",children:"yarn"})]})]})]})]})]});case"package-scanning":return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"bg-green-50 border border-green-200 rounded-lg p-4",children:[r.jsx("h4",{className:"font-medium text-green-900 mb-2",children:"Automatic Discovery"}),r.jsx("p",{className:"text-green-800 text-sm mb-3",children:"We'll scan your monorepo for packages automatically:"}),r.jsx("button",{onClick:()=>t(e.id),className:"bg-green-600 text-white px-4 py-2 rounded-lg hover:bg-green-700 text-sm",children:"Start Package Scan"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center text-sm text-gray-600",children:[r.jsx(vn,{className:"w-4 h-4 mr-2"}),"Scans for package.json files"]}),r.jsxs("div",{className:"flex items-center text-sm text-gray-600",children:[r.jsx(vn,{className:"w-4 h-4 mr-2"}),"Analyzes dependencies and relationships"]}),r.jsxs("div",{className:"flex items-center text-sm text-gray-600",children:[r.jsx(vn,{className:"w-4 h-4 mr-2"}),"Detects build configurations"]})]})]});case"ci-integration":return r.jsx("div",{className:"space-y-4",children:r.jsxs("div",{className:"bg-purple-50 border border-purple-200 rounded-lg p-4",children:[r.jsx("h4",{className:"font-medium text-purple-900 mb-2",children:"Connect CI/CD"}),r.jsx("p",{className:"text-purple-800 text-sm mb-3",children:"Choose your CI/CD provider to monitor builds and deployments:"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[r.jsxs("button",{onClick:()=>t(e.id),className:"p-3 border border-purple-300 rounded-lg hover:bg-purple-100 text-left",children:[r.jsx("div",{className:"font-medium text-purple-900",children:"GitHub Actions"}),r.jsx("div",{className:"text-sm text-purple-700",children:"Connect with GitHub"})]}),r.jsxs("button",{onClick:()=>t(e.id),className:"p-3 border border-purple-300 rounded-lg hover:bg-purple-100 text-left",children:[r.jsx("div",{className:"font-medium text-purple-900",children:"GitLab CI"}),r.jsx("div",{className:"text-sm text-purple-700",children:"Connect with GitLab"})]}),r.jsxs("button",{onClick:()=>t(e.id),className:"p-3 border border-purple-300 rounded-lg hover:bg-purple-100 text-left",children:[r.jsx("div",{className:"font-medium text-purple-900",children:"Jenkins"}),r.jsx("div",{className:"text-sm text-purple-700",children:"Connect with Jenkins"})]}),r.jsxs("button",{onClick:()=>t(e.id),className:"p-3 border border-purple-300 rounded-lg hover:bg-purple-100 text-left",children:[r.jsx("div",{className:"font-medium text-purple-900",children:"Skip for now"}),r.jsx("div",{className:"text-sm text-purple-700",children:"Configure later"})]})]})]})});case"health-checks":return r.jsx("div",{className:"space-y-4",children:r.jsxs("div",{className:"bg-orange-50 border border-orange-200 rounded-lg p-4",children:[r.jsx("h4",{className:"font-medium text-orange-900 mb-2",children:"Health Monitoring"}),r.jsx("p",{className:"text-orange-800 text-sm mb-3",children:"Configure how we monitor your package health:"}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("label",{className:"flex items-center",children:[r.jsx("input",{type:"checkbox",className:"mr-2",defaultChecked:!0}),r.jsx("span",{className:"text-sm text-orange-900",children:"Monitor build status"})]}),r.jsxs("label",{className:"flex items-center",children:[r.jsx("input",{type:"checkbox",className:"mr-2",defaultChecked:!0}),r.jsx("span",{className:"text-sm text-orange-900",children:"Track test coverage"})]}),r.jsxs("label",{className:"flex items-center",children:[r.jsx("input",{type:"checkbox",className:"mr-2"}),r.jsx("span",{className:"text-sm text-orange-900",children:"Dependency vulnerability scanning"})]}),r.jsxs("label",{className:"flex items-center",children:[r.jsx("input",{type:"checkbox",className:"mr-2"}),r.jsx("span",{className:"text-sm text-orange-900",children:"Performance monitoring"})]})]}),r.jsx("button",{onClick:()=>t(e.id),className:"mt-3 bg-orange-600 text-white px-4 py-2 rounded-lg hover:bg-orange-700 text-sm",children:"Save Settings"})]})});case"notifications":return r.jsx("div",{className:"space-y-4",children:r.jsxs("div",{className:"bg-indigo-50 border border-indigo-200 rounded-lg p-4",children:[r.jsx("h4",{className:"font-medium text-indigo-900 mb-2",children:"Notification Preferences"}),r.jsx("p",{className:"text-indigo-800 text-sm mb-3",children:"Choose how you want to be notified about important events:"}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("label",{className:"flex items-center",children:[r.jsx("input",{type:"checkbox",className:"mr-2",defaultChecked:!0}),r.jsx("span",{className:"text-sm text-indigo-900",children:"Build failures"})]}),r.jsxs("label",{className:"flex items-center",children:[r.jsx("input",{type:"checkbox",className:"mr-2"}),r.jsx("span",{className:"text-sm text-indigo-900",children:"Security vulnerabilities"})]}),r.jsxs("label",{className:"flex items-center",children:[r.jsx("input",{type:"checkbox",className:"mr-2"}),r.jsx("span",{className:"text-sm text-indigo-900",children:"Dependency updates"})]}),r.jsxs("label",{className:"flex items-center",children:[r.jsx("input",{type:"checkbox",className:"mr-2"}),r.jsx("span",{className:"text-sm text-indigo-900",children:"Performance degradation"})]})]}),r.jsx("button",{onClick:()=>t(e.id),className:"mt-3 bg-indigo-600 text-white px-4 py-2 rounded-lg hover:bg-indigo-700 text-sm",children:"Save Preferences"})]})});default:return r.jsx("div",{className:"text-center py-8",children:r.jsx("p",{className:"text-gray-500",children:"Step content not found"})})}};return r.jsxs("div",{className:"p-6 overflow-y-auto max-h-[50vh]",children:[r.jsxs("div",{className:"mb-6",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:e.title}),r.jsx("p",{className:"text-gray-600 mb-4",children:e.description})]}),n()]})}function Wp({currentStep:e,totalSteps:t,canGoNext:n,canGoPrevious:s,onNext:l,onPrevious:a,onComplete:i,isLastStep:c}){return r.jsxs("div",{className:"flex items-center justify-between p-6 border-t border-gray-200",children:[r.jsx("button",{onClick:a,disabled:!s,className:`px-4 py-2 text-sm rounded-lg border transition-colors ${s?"border-gray-300 text-gray-700 hover:bg-gray-50":"border-gray-200 text-gray-400 cursor-not-allowed"}`,children:"Previous"}),r.jsx("div",{className:"flex space-x-2",children:Array.from({length:t},(o,u)=>r.jsx("div",{className:`w-2 h-2 rounded-full transition-colors ${u<=e?"bg-blue-600":"bg-gray-300"}`},u))}),c?r.jsxs("button",{onClick:i,className:"bg-green-600 text-white px-4 py-2 rounded-lg hover:bg-green-700 flex items-center space-x-2 text-sm",children:[r.jsx(Ci,{className:"w-4 h-4"}),r.jsx("span",{children:"Complete Setup"})]}):r.jsx("button",{onClick:l,disabled:!n,className:`px-4 py-2 text-sm rounded-lg transition-colors ${n?"bg-blue-600 text-white hover:bg-blue-700":"bg-gray-300 text-gray-500 cursor-not-allowed"}`,children:"Next"})]})}const Qp=()=>[{id:"monorepo-structure",title:"Monorepo Structure",description:"Configure your monorepo directory structure and package manager",completed:!1,required:!0},{id:"package-scanning",title:"Package Scanning",description:"Set up automatic package discovery and dependency analysis",completed:!1,required:!0},{id:"ci-integration",title:"CI/CD Integration",description:"Connect with your CI/CD providers (GitHub Actions, GitLab CI, etc.)",completed:!1,required:!1},{id:"health-checks",title:"Health Monitoring",description:"Configure package health checks and status monitoring",completed:!1,required:!1},{id:"notifications",title:"Notifications",description:"Set up alerts and notifications for important events",completed:!1,required:!1}],Yp=(e,t)=>({currentStep:t,totalSteps:e.length,completedSteps:e.filter(n=>n.completed).length}),Zp=(e,t)=>{const n=e[t];return!n.required||n.completed},Gp=e=>e.filter(n=>n.required).every(n=>n.completed),Kp=(e,t)=>e.map(n=>n.id===t?{...n,completed:!0}:n);function Xp({isOpen:e,onClose:t,onComplete:n}){const[s,l]=d.useState(0),[a,i]=d.useState(Qp()),c=b=>{const x=Kp(a,b);i(x),x[s].completed&&s<a.length-1&&l(f=>f+1)},o=()=>{s<a.length-1&&l(b=>b+1)},u=()=>{s>0&&l(b=>b-1)},p=()=>{Gp(a)&&(n(),t())},m=Yp(a,s),g=Zp(a,s),v=s>0,j=s===a.length-1,N=a[s];return r.jsxs(Bp,{isOpen:e,onClose:t,children:[r.jsx(Up,{onClose:t}),r.jsx(Hp,{progress:m}),r.jsx(Vp,{step:N,onStepComplete:c}),r.jsx(Wp,{currentStep:s,totalSteps:a.length,canGoNext:g,canGoPrevious:v,onNext:o,onPrevious:u,onComplete:p,isLastStep:j})]})}function Jp({config:e,onShowSetupGuide:t,onShowConfig:n,onRefresh:s}){return r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-heading text-3xl",children:e.title}),r.jsx("p",{className:"text-body mt-2",children:e.description}),r.jsx("button",{onClick:t,className:"hidden text-primary-600 hover:text-primary-700 text-sm font-medium mt-2",children:"First time? Run the setup guide"})]}),r.jsxs("div",{className:"flex space-x-3",children:[r.jsxs("button",{onClick:s,className:"btn-primary flex items-center space-x-2",children:[r.jsx(ot,{className:"w-5 h-5"}),r.jsx("span",{children:"Refresh"})]}),r.jsxs("button",{onClick:n,className:"hidden btn-ghost flex items-center space-x-2",children:[r.jsx(Ud,{className:"w-5 h-5"}),r.jsx("span",{children:"Configure"})]})]})]})}function qp({stats:e}){return r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:[r.jsx("div",{className:"card p-6",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-2 bg-primary-100 rounded-lg",children:r.jsx(qs,{className:"w-6 h-6 text-primary-600"})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-caption font-medium",children:"Total Packages"}),r.jsx("p",{className:"text-heading text-2xl",children:e.total})]})]})}),r.jsx("div",{className:"card p-6",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-2 bg-secondary-100 rounded-lg",children:r.jsx("span",{className:"text-2xl",children:"🚀"})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-caption font-medium",children:"Applications"}),r.jsx("p",{className:"text-heading text-2xl",children:e.apps})]})]})}),r.jsx("div",{className:"card p-6",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-2 bg-accent-100 rounded-lg",children:r.jsx("span",{className:"text-2xl",children:"📚"})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-caption font-medium",children:"Libraries"}),r.jsx("p",{className:"text-heading text-2xl",children:e.libs})]})]})}),r.jsx("div",{className:"card p-6",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-2 bg-info-100 rounded-lg",children:r.jsx("span",{className:"text-2xl",children:"🔗"})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-caption font-medium",children:"Dependencies"}),r.jsx("p",{className:"text-heading text-2xl",children:e.totalDependencies})]})]})})]})}function eg({packages:e,packageTypes:t,getTypeIcon:n}){return r.jsxs("div",{className:"bg-white p-6 rounded-lg shadow border",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Package Distribution"}),r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:t.map(s=>r.jsxs("div",{className:"text-center p-4 bg-gray-50 rounded-lg",children:[r.jsx("div",{className:"text-3xl mb-2",children:n(s)}),r.jsx("div",{className:"text-sm font-medium text-gray-600 capitalize",children:s}),r.jsx("div",{className:"text-2xl font-bold text-gray-900",children:e.filter(l=>l.type===s).length})]},s))})]})}function tg(){return r.jsxs("div",{className:"bg-white p-6 rounded-lg shadow border",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Quick Actions"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsx(rt,{to:"/dependencies",className:"p-4 border border-gray-200 rounded-lg hover:border-blue-300 hover:bg-blue-50 transition-colors",children:r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx("div",{className:"p-2 bg-blue-100 rounded-lg",children:r.jsx(Er,{className:"w-6 h-6 text-blue-600"})}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium text-gray-900",children:"Dependency Graph"}),r.jsx("p",{className:"text-sm text-gray-600",children:"Visualize package relationships"})]})]})}),r.jsx(rt,{to:"/health",className:"p-4 border border-gray-200 rounded-lg hover:border-green-300 hover:bg-green-50 transition-colors",children:r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx("div",{className:"p-2 bg-green-100 rounded-lg",children:r.jsx("span",{className:"text-2xl",children:"🏥"})}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium text-gray-900",children:"Health Check"}),r.jsx("p",{className:"text-sm text-gray-600",children:"Monitor package health"})]})]})}),r.jsx(rt,{to:"/ci",className:"hidden p-4 border border-gray-200 rounded-lg hover:border-purple-300 hover:bg-purple-50 transition-colors",children:r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx("div",{className:"p-2 bg-purple-100 rounded-lg",children:r.jsx("span",{className:"text-2xl",children:"🧪"})}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium text-gray-900",children:"CI/CD Status"}),r.jsx("p",{className:"text-sm text-gray-600",children:"View build status"})]})]})})]})]})}function ng({searchTerm:e,selectedType:t,packageTypes:n,onSearchChange:s,onTypeChange:l}){return r.jsxs("div",{className:"flex flex-col md:flex-row gap-4 mb-6",children:[r.jsxs("div",{className:"flex-1 relative",children:[r.jsx(Pi,{className:"w-5 h-5 absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400"}),r.jsx("input",{type:"text",placeholder:"Search packages...",value:e,onChange:a=>s(a.target.value),className:"w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(el,{className:"w-5 h-5 text-gray-400"}),r.jsxs("select",{value:t,onChange:a=>l(a.target.value),className:"px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[r.jsx("option",{value:"all",children:"All Types"}),n.map(a=>r.jsx("option",{value:a,className:"capitalize",children:a},a))]})]})]})}function rg({packages:e,getTypeIcon:t,getStatusColor:n}){return r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"min-w-full divide-y divide-gray-200",children:[r.jsx("thead",{className:"bg-gray-50",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Package"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Type"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Version"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Dependencies"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Description"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Actions"})]})}),r.jsx("tbody",{className:"bg-white divide-y divide-gray-200",children:e.map(s=>r.jsxs("tr",{className:"hover:bg-gray-50",children:[r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"text-2xl mr-3",children:t(s.type)}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium text-gray-900",children:s.name}),r.jsx("div",{className:"text-sm text-gray-500",children:s.path})]})]})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${n(s.type)}`,children:s.type})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900",children:s.version}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900",children:Object.keys(s.dependencies).length+Object.keys(s.devDependencies).length+Object.keys(s.peerDependencies).length}),r.jsx("td",{className:"px-6 py-4 text-sm text-gray-900 max-w-xs truncate",children:s.description||"No description"}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:r.jsx(rt,{to:`/packages/${encodeURIComponent(s.name)}`,className:"text-blue-600 hover:text-blue-500",children:"View Details"})})]},s.name))})]})})}var pc;const sg=((pc=window.ENV)==null?void 0:pc.API_URL)??"http://localhost:8999",We=`${sg}/api`;class lg{constructor(){this.mockPackages=[]}async getPackages(){try{const t=await fetch(`${We}/packages`);if(t.ok)return await t.json();console.error(`getPackages: initial fetch failed with status ${t.status}. Attempting refresh...`);try{return await this.refreshPackages()}catch(n){return console.error("getPackages: refresh failed",n),[]}}catch(t){return console.error("getPackages: unexpected error",t),[]}}async getPackage(t){const n=await fetch(`${We}/packages/`+encodeURIComponent(t));if(!n.ok)throw new Error(`Failed to fetch package details for "${t}" (Status: ${n.status})`);return await n.json()}async getDependencies(){await new Promise(n=>setTimeout(n,200));const t=new Set;try{return(await this.getPackages()).forEach(l=>{var a;(a=l.dependencies)==null||a.forEach(i=>t.add(i))}),Array.from(t).map(l=>({name:l,version:"unknown",type:"dependency",status:"active"}))}catch(n){return console.error("Error fetching dependencies:",n),[]}}async refreshPackages(){try{const t=await fetch(`${We}/packages/refresh`);if(!t.ok)return console.error(`refreshPackages: fetch failed with status ${t.status}`),[];const n=await t.json();return console.log("data from refreshPackage:",n),n}catch(t){return console.error("refreshPackages: unexpected error",t),[]}}async getHealthStatus(){console.log("getHealthStatus");try{const t=await fetch(`${We}/health/packages`);if(console.log("Health data from getHealthStatus:",t),!t.ok){if(console.log("Health data not available, attempting refresh..."),!(await fetch(`${We}/health/refresh`,{method:"POST",headers:{"Content-Type":"application/json"}})).ok)throw new Error("Failed to refresh health data");await new Promise(i=>setTimeout(i,1e3));const l=await fetch(`${We}/health/packages`);if(!l.ok)throw new Error("Failed to fetch health data after refresh");const a=await l.json();return console.log("Health data after refresh:",a),a}const n=await t.json();return console.log("Health data from getHealthStatus:",n),n}catch(t){console.error("Error fetching health data:",t)}}async refreshHealthStatus(){try{const t=await fetch(`${We}/health/refresh`);if(!t.ok)throw new Error("Failed to fetch health data");const n=await t.json();return console.log("Health data from refreshHealthStatus:",n),n}catch(t){console.error("Error fetching health data:",t)}}async getFallbackHealthStatus(){await new Promise(l=>setTimeout(l,400));const t=[{name:"Package Count",value:this.mockPackages.length,status:"healthy",description:`${this.mockPackages.length} packages in monorepo`},{name:"Dependency Health",value:85,status:"healthy",description:"Dependencies are up to date"},{name:"Build Status",value:95,status:"healthy",description:"Most builds are successful"}],n=this.mockPackages.map(l=>({package:l.name,score:l.status==="healthy"?90:l.status==="warning"?70:50,issues:l.status==="healthy"?[]:["Needs attention"]}));return{overallScore:85,metrics:t,packageHealth:n}}async updatePackageConfiguration(t,n,s){try{console.log("📤 Updating package configuration via MonorepoService:",t);const l=await fetch(`${We}/packages/update-config`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({packageName:t,config:n,packagePath:s})});if(console.log("📥 Response status:",l.status),!l.ok){const i=await l.text();console.error("📥 Error response:",i);let c=`HTTP error ${l.status}`;if(i)try{const o=JSON.parse(i);c=o.error||o.message||c}catch{c=i||c}throw new Error(c)}const a=await l.json();return console.log("📥 Success response:",a),a}catch(l){throw console.error("Error updating package configuration:",l),l}}async getBuildStatus(){await new Promise(n=>setTimeout(n,500));const t=[];for(const n of this.mockPackages){const s=n.scripts&&n.scripts.build,l=n.scripts&&n.scripts.test;if(s||l){const a=new Date(Date.now()-Math.random()*864e5).toISOString(),i=Math.random()>.8?"failed":Math.random()>.6?"building":Math.random()>.4?"queued":"success";t.push({id:`build-${n.name}-${Date.now()}`,package:n.name,status:i,startTime:a,endTime:i!=="building"?new Date(Date.now()-Math.random()*36e5).toISOString():void 0,duration:i!=="building"?Math.floor(Math.random()*300)+60:void 0,stages:this.generateBuildStages(n,i)})}}return t}async getConfigurationFiles(){try{console.log("Fetching configuration files from backend...");const t=await fetch(`${We}/config/files`);if(!t.ok)throw new Error(`Failed to fetch config files: ${t.status} ${t.statusText}`);const n=await t.json();if(console.log("Response from config files API:",n),n.success&&n.files)return console.log(`Successfully fetched ${n.files.length} configuration files`),n.files;throw new Error("Invalid response format from config files API")}catch(t){return console.error("Error fetching configuration files from backend:",t),console.log("Returning empty config files list due to error..."),[]}}async saveConfigurationFile(t,n){try{console.log("Saving configuration file:",t);const s=await fetch(`${We}/config/files/${encodeURIComponent(t)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:n})});if(!s.ok){const a=await s.json();throw new Error(a.error||`Failed to save file: ${s.status} ${s.statusText}`)}const l=await s.json();if(l.success&&l.file)return console.log("File saved successfully:",t),l.file;throw new Error("Invalid response format from save file API")}catch(s){throw console.error("Error saving configuration file:",s),s}}generateBuildStages(t,n){const s=[{name:"Install",status:"success",duration:Math.floor(Math.random()*30)+10,logs:["Installing dependencies...","Dependencies installed successfully"]},{name:"Lint",status:n==="failed"&&Math.random()>.7?"failed":"success",duration:Math.floor(Math.random()*20)+5,logs:["Running ESLint...","Linting completed"]},{name:"Test",status:n==="failed"&&Math.random()>.5?"failed":"success",duration:Math.floor(Math.random()*60)+30,logs:["Running tests...","Test suite completed"]},{name:"Build",status:n==="failed"?"failed":"success",duration:Math.floor(Math.random()*120)+60,logs:["Building package...","Build completed successfully"]}];if(n==="building"){const l=Math.floor(Math.random()*s.length);s[l].status="running",s.slice(l+1).forEach(a=>a.status="pending")}return s}}const Oe=new lg,ag=e=>({total:e.length,apps:e.filter(t=>t.type==="app").length,libs:e.filter(t=>t.type==="lib").length,tools:e.filter(t=>t.type==="tool").length,custom:e.filter(t=>!["app","Plib","tool"].includes(t.type)).length,totalDependencies:e.reduce((t,n)=>t+Object.keys(n.dependencies).length+Object.keys(n.peerDependencies).length+Object.keys(n.devDependencies).length,0)}),ig=e=>[...new Set(e.map(t=>t.type))],og=(e,t,n)=>e.filter(s=>{var i;const l=s.name.toLowerCase().includes(t.toLowerCase())||((i=s.description)==null?void 0:i.toLowerCase().includes(t.toLowerCase())),a=n==="all"||s.type===n;return l&&a}),cg=e=>{switch(e){case"app":return"bg-blue-100 text-blue-800";case"lib":return"bg-green-100 text-green-800";case"tool":return"bg-purple-100 text-purple-800";default:return"bg-gray-100 text-gray-800"}},ic=e=>{switch(e){case"app":return"🚀";case"lib":return"📚";case"tool":return"🔧";default:return"📦"}};function Ti({message:e="Loading packages..."}){return r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600",children:e})]})})}function Vd({error:e,onRetry:t}){return r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsxs("div",{className:"text-center",children:[r.jsx(te,{className:"w-12 h-12 text-red-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-red-600",children:e}),t&&r.jsx("button",{onClick:t,className:"mt-4 bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 transition-colors",children:"Retry"})]})})}function ug({stats:e}){return r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-6",children:[r.jsx("div",{className:"bg-white p-6 rounded-lg shadow border",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-2 bg-blue-100 rounded-lg",children:r.jsx("div",{className:"text-2xl",children:"📦"})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Total Packages"}),r.jsx("p",{className:"text-2xl font-semibold text-gray-900",children:e.total})]})]})}),r.jsx("div",{className:"bg-white p-6 rounded-lg shadow border",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-2 bg-green-100 rounded-lg",children:r.jsx(Ke,{className:"w-6 h-6 text-green-600"})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Healthy"}),r.jsx("p",{className:"text-2xl font-semibold text-green-600",children:e.healthy})]})]})}),r.jsx("div",{className:"bg-white p-6 rounded-lg shadow border",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-2 bg-yellow-100 rounded-lg",children:r.jsx(te,{className:"w-6 h-6 text-yellow-600"})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Warnings"}),r.jsx("p",{className:"text-2xl font-semibold text-yellow-600",children:e.warnings})]})]})}),r.jsx("div",{className:"bg-white p-6 rounded-lg shadow border",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-2 bg-red-100 rounded-lg",children:r.jsx(Xe,{className:"w-6 h-6 text-red-600"})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Errors"}),r.jsx("p",{className:"text-2xl font-semibold text-red-600",children:e.errors})]})]})})]})}function dg({filters:e,onFiltersChange:t,availableTypes:n,availableStatuses:s}){return r.jsx("div",{className:"bg-white p-6 rounded-lg shadow border",children:r.jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between space-y-4 md:space-y-0 md:space-x-4",children:[r.jsxs("div",{className:"flex-1 relative",children:[r.jsx(Pi,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 h-5 w-5"}),r.jsx("input",{type:"text",placeholder:"Search packages by name, description, or tags...",value:e.search,onChange:l=>t({...e,search:l.target.value}),className:"w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),r.jsxs("div",{className:"flex items-center space-x-4",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(el,{className:"h-5 w-5 text-gray-400"}),r.jsxs("select",{value:e.type,onChange:l=>t({...e,type:l.target.value}),className:"border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[r.jsx("option",{value:"all",children:"All Types"}),n.map(l=>r.jsx("option",{value:l,children:l.charAt(0).toUpperCase()+l.slice(1)},l))]})]}),r.jsxs("select",{value:e.status,onChange:l=>t({...e,status:l.target.value}),className:"border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[r.jsx("option",{value:"all",children:"All Status"}),s.map(l=>r.jsx("option",{value:l,children:l.charAt(0).toUpperCase()+l.slice(1)},l))]})]})]})})}const mg=e=>({total:e.length,healthy:e.filter(t=>t.status==="healthy").length,warnings:e.filter(t=>t.status==="warning").length,errors:e.filter(t=>t.status==="error").length}),hg=e=>[...new Set(e.map(t=>t.type))],fg=e=>[...new Set(e.map(t=>t.status))],xg=(e,t)=>e.filter(n=>{const s=n.name.toLowerCase().includes(t.search.toLowerCase())||n.description.toLowerCase().includes(t.search.toLowerCase()),l=t.type==="all"||n.type===t.type,a=t.status==="all"||n.status===t.status;return s&&l&&a}),pg=(e,t)=>[...e].sort((n,s)=>{let l,a;switch(t.field){case"name":l=n.name.toLowerCase(),a=s.name.toLowerCase();break;case"version":l=n.version,a=s.version;break;case"lastUpdated":l=new Date(n.lastUpdated),a=new Date(s.lastUpdated);break;case"dependencies":l=Object.keys(n.dependencies).length,a=Object.keys(s.dependencies).length;break;default:return 0}return l<a?t.order==="asc"?-1:1:l>a?t.order==="asc"?1:-1:0}),Wd=e=>{switch(e){case"healthy":return"bg-green-100 text-green-800";case"warning":return"bg-yellow-100 text-yellow-800";case"error":return"bg-red-100 text-red-800";case"building":return"bg-blue-100 text-blue-800";default:return"bg-gray-100 text-gray-800"}},Qd=e=>{switch(e){case"app":return"bg-blue-100 text-blue-800";case"lib":return"bg-purple-100 text-purple-800";case"tool":return"bg-orange-100 text-orange-800";case"service":return"bg-green-100 text-green-800";default:return"bg-gray-100 text-gray-800"}},gg=e=>{switch(e){case"up-to-date":return"bg-green-100 text-green-800";case"outdated":return"bg-yellow-100 text-yellow-800";case"major-update":return"bg-red-100 text-red-800";default:return"bg-gray-100 text-gray-800"}},yg=e=>{switch(e){case"feature":return"bg-blue-100 text-blue-800";case"fix":return"bg-green-100 text-green-800";case"chore":return"bg-gray-100 text-gray-800";case"breaking":return"bg-red-100 text-red-800";default:return"bg-gray-100 text-gray-800"}},Mi=e=>new Date(e).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),Yd=e=>e.startsWith("v")?e:`v${e}`,Zd=e=>{switch(e){case"app":return"🚀";case"lib":return"📚";case"tool":return"🔧";case"service":return"🌐";default:return"📦"}};function vg({packages:e,sorting:t,onSortChange:n}){const s=a=>{const i=t.field===a&&t.order==="asc"?"desc":"asc";n({field:a,order:i})},l=a=>t.field!==a?null:t.order==="asc"?r.jsx(Si,{className:"w-4 h-4"}):r.jsx(zd,{className:"w-4 h-4"});return r.jsx("div",{className:"bg-white rounded-lg shadow border overflow-hidden",children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full",children:[r.jsx("thead",{className:"bg-gray-50",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider cursor-pointer hover:bg-gray-100",onClick:()=>s("name"),children:r.jsxs("div",{className:"flex items-center space-x-1",children:[r.jsx("span",{children:"Package"}),l("name")]})}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider cursor-pointer hover:bg-gray-100",onClick:()=>s("version"),children:r.jsxs("div",{className:"flex items-center space-x-1",children:[r.jsx("span",{children:"Version"}),l("version")]})}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Type"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Status"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider cursor-pointer hover:bg-gray-100",onClick:()=>s("dependencies"),children:r.jsxs("div",{className:"flex items-center space-x-1",children:[r.jsx("span",{children:"Dependencies"}),l("dependencies")]})}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider cursor-pointer hover:bg-gray-100",onClick:()=>s("lastUpdated"),children:r.jsxs("div",{className:"flex items-center space-x-1",children:[r.jsx("span",{children:"Last Updated"}),l("lastUpdated")]})}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Maintainers"})]})}),r.jsx("tbody",{className:"bg-white divide-y divide-gray-200",children:e.map(a=>r.jsxs("tr",{className:"hover:bg-gray-50",children:[r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"text-2xl mr-3",children:Zd(a.type)}),r.jsxs("div",{children:[r.jsx(rt,{to:`/packages/${encodeURIComponent(a.name)}`,className:"text-sm font-medium text-blue-600 hover:text-blue-500",children:a.name}),r.jsx("div",{className:"text-sm text-gray-500",children:a.description})]})]})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("span",{className:"text-sm font-mono text-gray-900",children:Yd(a.version)})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${Qd(a.type)}`,children:a.type})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${Wd(a.status)}`,children:a.status})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900",children:Object.keys(a.dependencies).length>0&&r.jsxs("div",{className:"text-xs text-gray-500 mt-1",children:[Object.keys(a.dependencies).slice(0,3).join(", "),Object.keys(a.dependencies).length>3&&` +${Object.keys(a.dependencies).length-3} more`]})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:Mi(a.lastUpdated)}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsxs("div",{className:"flex -space-x-1",children:[a.maintainers.slice(0,3).map((i,c)=>r.jsx("div",{className:"inline-flex items-center justify-center h-6 w-6 rounded-full bg-gray-500 text-xs font-medium text-white",title:i,children:i.charAt(0).toUpperCase()},i)),a.maintainers.length>3&&r.jsxs("div",{className:"inline-flex items-center justify-center h-6 w-6 rounded-full bg-gray-300 text-xs font-medium text-gray-600",children:["+",a.maintainers.length-3]})]})})]},a.name))})]})})})}function jg({packageData:e}){var n,s,l,a;const t=i=>{switch(i){case"healthy":return r.jsx(Ke,{className:"h-5 w-5 text-green-500"});case"warning":return r.jsx(te,{className:"h-5 w-5 text-yellow-500"});case"error":return r.jsx(te,{className:"h-5 w-5 text-red-500"});default:return r.jsx(ct,{className:"h-5 w-5 text-gray-500"})}};return r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"mb-6",children:r.jsxs(rt,{to:"/packages",className:"inline-flex items-center text-sm text-gray-500 hover:text-gray-700",children:[r.jsx(W0,{className:"mr-2 h-4 w-4"}),"Back to Packages"]})}),r.jsxs("div",{className:"bg-white rounded-lg shadow border p-6 mb-6",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex items-start space-x-4",children:[r.jsx("div",{className:"text-4xl",children:Zd(e.type)}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:e.name}),r.jsx("p",{className:"text-gray-600 mt-1",children:e.description}),r.jsxs("div",{className:"flex items-center space-x-4 mt-4",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("span",{className:"text-sm font-medium text-gray-500",children:"Version:"}),r.jsx("span",{className:"text-sm font-mono bg-gray-100 px-2 py-1 rounded",children:Yd(e.version)})]}),r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${Qd(e.type)}`,children:e.type}),r.jsxs("div",{className:"flex items-center space-x-1",children:[t(e.status),r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${Wd(e.status)}`,children:e.status})]})]})]})]}),r.jsxs("div",{className:"text-right",children:[r.jsx("div",{className:"text-sm text-gray-500 mb-2",children:"Health Score"}),r.jsxs("div",{className:"text-2xl font-bold text-blue-600",children:[((n=e.packageHealth)==null?void 0:n.packageOverallScore)??"","%"]})]})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4 mt-6 pt-6 border-t border-gray-200",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Bd,{className:"h-4 w-4 text-gray-400"}),r.jsxs("div",{children:[r.jsx("div",{className:"text-xs text-gray-500",children:"Last Updated"}),r.jsx("div",{className:"text-sm font-medium",children:Mi(e.lastUpdated)})]})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Cp,{className:"h-4 w-4 text-gray-400"}),r.jsxs("div",{children:[r.jsx("div",{className:"text-xs text-gray-500",children:"Maintainers"}),r.jsx("div",{className:"text-sm font-medium",children:e.maintainers.length})]})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Ri,{className:"h-4 w-4 text-gray-400"}),r.jsxs("div",{children:[r.jsx("div",{className:"text-xs text-gray-500",children:"License"}),r.jsx("div",{className:"text-sm font-medium",children:e.license})]})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("div",{className:"h-4 w-4 text-gray-400",children:"🔗"}),r.jsxs("div",{children:[r.jsx("div",{className:"text-xs text-gray-500",children:"Repository"}),r.jsx("div",{className:"text-sm font-medium truncate",children:r.jsx("a",{href:e.repository.url||"",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-500",children:(l=(s=e.repository)==null?void 0:s.url)==null?void 0:l.split("/").pop()})})]})]})]}),((a=e.tags)==null?void 0:a.length)>0&&r.jsxs("div",{className:"mt-4",children:[r.jsx("div",{className:"text-xs text-gray-500 mb-2",children:"Tags"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:e.tags.map(i=>r.jsx("span",{className:"inline-flex px-2 py-1 text-xs bg-gray-100 text-gray-700 rounded-full",children:i},i))})]})]})]})}function wg({activeTab:e,onTabChange:t}){const n=[{id:"overview",label:"Overview",icon:qs},{id:"dependencies",label:"Dependencies",icon:Ei},{id:"commits",label:"Recent Commits",icon:ct},{id:"health",label:"Health Metrics",icon:Hd},{id:"config",label:"Configuration",icon:Ms}];return r.jsx("div",{className:"border-b border-gray-200",children:r.jsx("nav",{className:"flex space-x-8",children:n.map(s=>{const l=s.icon;return r.jsxs("button",{onClick:()=>t(s.id),className:`py-4 px-1 border-b-2 font-medium text-sm flex items-center space-x-2 ${e===s.id?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:[r.jsx(l,{className:"w-4 h-4"}),r.jsx("span",{children:s.label})]},s.id)})})})}function Ng({packageData:e}){if(!e.dependenciesInfo.length)return r.jsx("p",{className:"py-6 text-gray-600",children:"No dependency found."});const t=(n,s)=>r.jsxs("div",{className:"mb-8",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:s}),r.jsx("div",{className:"bg-white border rounded-lg overflow-hidden",children:r.jsxs("table",{className:"w-full",children:[r.jsx("thead",{className:"bg-gray-50",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Package"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Current"}),r.jsx("th",{className:"hidden px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Latest"}),r.jsx("th",{className:"hidden px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Status"}),r.jsx("th",{className:"hidden px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Actions"})]})}),r.jsx("tbody",{className:"bg-white divide-y divide-gray-200",children:n.map(l=>r.jsxs("tr",{className:"hover:bg-gray-50",children:[r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("div",{className:"text-sm font-medium text-gray-900",children:l.name})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("span",{className:"text-sm font-mono text-gray-700",children:l.version})}),r.jsx("td",{className:"hidden px-6 py-4 whitespace-nowrap",children:r.jsx("span",{className:"text-sm font-mono text-gray-700",children:l.latest})}),r.jsx("td",{className:"hidden px-6 py-4 whitespace-nowrap",children:r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${gg(l.status)}`,children:l.status.replace("-"," ")})}),r.jsx("td",{className:"hidden px-6 py-4 whitespace-nowrap text-sm",children:l.status!=="up-to-date"&&r.jsxs("button",{className:"text-blue-600 hover:text-blue-500 flex items-center space-x-1",children:[r.jsx(Si,{className:"w-4 h-4"}),r.jsx("span",{children:"Update"})]})})]},l.name))})]})})]});return r.jsxs("div",{className:"py-6",children:[t(e.dependenciesInfo.filter(n=>n.type=="dependency"),"Dependencies"),t(e.dependenciesInfo.filter(n=>n.type=="devDependency"),"Dev Dependencies"),t(e.dependenciesInfo.filter(n=>n.type=="peerDependency"),"Peer Dependencies"),r.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:[r.jsx("h4",{className:"font-medium text-blue-900 mb-2",children:"Dependency Summary"}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-blue-800",children:"Total Dependencies:"}),r.jsx("span",{className:"ml-2 text-blue-700",children:e.dependenciesInfo.filter(n=>n.type=="dependency").length})]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-blue-800",children:"Dev Dependencies:"}),r.jsx("span",{className:"ml-2 text-blue-700",children:e.dependenciesInfo.filter(n=>n.type=="devDependency").length})]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-blue-800",children:"Peer Dependencies:"}),r.jsx("span",{className:"ml-2 text-blue-700",children:e.dependenciesInfo.filter(n=>n.type=="peerDependency").length})]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-blue-800",children:"Outdated:"}),r.jsx("span",{className:"ml-2 text-blue-700",children:e.dependenciesInfo.filter(n=>n.status==="outdated").length})]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-blue-800",children:"Major Updates:"}),r.jsx("span",{className:"ml-2 text-blue-700",children:e.dependenciesInfo.filter(n=>n.status==="major-update").length})]})]})]})]})}function bg({packageData:e}){return r.jsxs("div",{className:"py-6",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:"Recent Commits"}),r.jsx("div",{className:"space-y-4",children:e.commits.map(t=>r.jsx("div",{className:"bg-white border rounded-lg p-4 hover:shadow-md transition-shadow",children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center space-x-3 mb-2",children:[r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${yg(t.type)}`,children:t.type}),r.jsx("span",{className:"text-sm font-mono text-gray-500",children:t.hash})]}),r.jsx("p",{className:"text-sm font-medium text-gray-900 mb-2",children:t.message}),r.jsxs("div",{className:"flex items-center space-x-4 text-sm text-gray-500",children:[r.jsxs("span",{children:["by ",t.author]}),r.jsx("span",{children:Mi(t.date)})]})]}),r.jsx("div",{className:"hidden ml-4",children:r.jsx("button",{className:"text-blue-600 hover:text-blue-500 text-sm",children:"View Diff"})})]})},t.hash))}),e.commits.length===0&&r.jsxs("div",{className:"text-center py-8",children:[r.jsx("div",{className:"text-gray-400 text-4xl mb-2",children:"📝"}),r.jsx("p",{className:"text-gray-500",children:"No recent commits found"})]}),r.jsxs("div",{className:"mt-6 bg-gray-50 border border-gray-200 rounded-lg p-4",children:[r.jsx("h4",{className:"font-medium text-gray-900 mb-2",children:"Commit Summary"}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-gray-800",children:"Features:"}),r.jsx("span",{className:"ml-2 text-gray-600",children:e.commits.filter(t=>t.type==="feat").length})]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-gray-800",children:"Fixes:"}),r.jsx("span",{className:"ml-2 text-gray-600",children:e.commits.filter(t=>t.type==="fix").length})]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-gray-800",children:"Chores:"}),r.jsx("span",{className:"ml-2 text-gray-600",children:e.commits.filter(t=>t.type==="chore").length})]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-gray-800",children:"Breaking:"}),r.jsx("span",{className:"ml-2 text-gray-600",children:e.commits.filter(t=>t.type==="breaking").length})]})]})]})]})}function kg({packageData:e}){var a;const t=i=>i>=80?"text-green-600":i>=60?"text-yellow-600":"text-red-600",n=i=>{switch(i){case"success":return r.jsx(Ke,{className:"w-5 h-5 text-green-500"});case"failed":return r.jsx(Xe,{className:"w-5 h-5 text-red-500"});case"running":return r.jsx("div",{className:"w-5 h-5 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"});default:return r.jsx(te,{className:"w-5 h-5 text-gray-500"})}},s=i=>{switch(i){case"success":return"bg-green-100 text-green-800";case"failed":return"bg-red-100 text-red-800";case"running":return"bg-blue-100 text-blue-800";default:return"bg-gray-100 text-gray-800"}},l=i=>{switch(i){case"pass":return"bg-green-100 text-green-800";case"fail":return"bg-red-100 text-red-800";case"warning":return"bg-yellow-100 text-yellow-800";default:return"bg-gray-100 text-gray-800"}};return(a=e.packageHealth)!=null&&a.packageOverallScore?r.jsxs("div",{className:"py-6",children:[r.jsxs("div",{className:"bg-white border rounded-lg p-6 mb-6",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Health Score"}),r.jsxs("div",{className:`text-3xl font-bold ${t(e.packageHealth.packageOverallScore)}`,children:[e.packageHealth.packageOverallScore,"%"]})]}),r.jsx("div",{className:"w-full bg-gray-200 rounded-full h-3 mb-4",children:r.jsx("div",{className:`h-3 rounded-full transition-all duration-300 ${e.packageHealth.packageOverallScore>=80?"bg-green-500":e.packageHealth.packageOverallScore>=60?"bg-yellow-500":"bg-red-500"}`,style:{width:`${e.packageHealth.packageOverallScore}%`}})}),r.jsxs("p",{className:"text-sm text-gray-600",children:[e.packageHealth.packageOverallScore>=80&&"Excellent health - package is in great condition",e.packageHealth.packageOverallScore>=60&&e.packageHealth.packageOverallScore<80&&"Good health - minor issues detected",e.packageHealth.packageOverallScore<60&&"Needs attention - several issues require fixing"]})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 mb-6",children:[r.jsxs("div",{className:"bg-white border rounded-lg p-6",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900",children:"Build Status"}),n(e.packageHealth.packageBuildStatus)]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${s(e.packageHealth.packageBuildStatus)}`,children:e.packageHealth.packageBuildStatus}),r.jsx("button",{className:"hidden text-blue-600 hover:text-blue-500 text-sm",children:"View Logs"})]})]}),r.jsxs("div",{className:"hidden bg-white border rounded-lg p-6",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900",children:"Test Coverage"}),r.jsxs("div",{className:`text-lg font-semibold ${e.packageHealth.packageTestCoverage>=80?"text-green-600":e.packageHealth.packageTestCoverage>=60?"text-yellow-600":"text-red-600"}`,children:[e.packageHealth.packageTestCoverage,"%"]})]}),r.jsx("div",{className:"w-full bg-gray-200 rounded-full h-2",children:r.jsx("div",{className:`h-2 rounded-full ${e.packageHealth.packageTestCoverage>=80?"bg-green-500":e.packageHealth.packageTestCoverage>=60?"bg-yellow-500":"bg-red-500"}`,style:{width:`${e.packageHealth.packageTestCoverage}%`}})})]}),r.jsxs("div",{className:"bg-white border rounded-lg p-6",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900",children:"Lint Status"}),e.packageHealth.packageLintStatus==="pass"&&r.jsx(Ke,{className:"w-5 h-5 text-green-500"}),e.packageHealth.packageLintStatus==="fail"&&r.jsx(Xe,{className:"w-5 h-5 text-red-500"}),e.packageHealth.packageLintStatus==="warning"&&r.jsx(te,{className:"w-5 h-5 text-yellow-500"})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${l(e.packageHealth.packageLintStatus)}`,children:e.packageHealth.packageLintStatus}),r.jsx("button",{className:"hidden text-blue-600 hover:text-blue-500 text-sm",children:"View Issues"})]})]})]}),r.jsxs("div",{className:"bg-white border rounded-lg p-6",children:[r.jsx("h4",{className:"text-lg font-medium text-gray-900 mb-4",children:"Detailed Metrics"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[r.jsxs("div",{children:[r.jsx("h5",{className:"text-sm font-medium text-gray-700 mb-3",children:"Dependencies"}),r.jsxs("div",{className:"space-y-2 text-sm",children:[r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-600",children:"Total Dependencies:"}),r.jsx("span",{className:"font-medium",children:Object.keys(e.dependenciesInfo).length})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-600",children:"Outdated:"}),r.jsx("span",{className:"font-medium text-yellow-600",children:e.dependenciesInfo.filter(i=>i.status==="outdated").length})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-600",children:"Major Updates Available:"}),r.jsx("span",{className:"font-medium text-red-600",children:e.dependenciesInfo.filter(i=>i.status==="major-update").length})]})]})]}),r.jsxs("div",{children:[r.jsx("h5",{className:"text-sm font-medium text-gray-700 mb-3",children:"Code Quality"}),r.jsxs("div",{className:"space-y-2 text-sm",children:[r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-600",children:"Build Status:"}),r.jsx("span",{className:`font-medium ${e.packageHealth.packageBuildStatus==="success"?"text-green-600":e.packageHealth.packageBuildStatus==="failed"?"text-red-600":"text-yellow-600"}`,children:e.packageHealth.packageBuildStatus})]}),r.jsxs("div",{className:"hidden flex justify-between",children:[r.jsx("span",{className:"text-gray-600",children:"Test Coverage:"}),r.jsxs("span",{className:"font-medium",children:[e.packageHealth.packageTestCoverage,"%"]})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-600",children:"Lint Status:"}),r.jsx("span",{className:`font-medium ${e.packageHealth.packageLintStatus==="pass"?"text-green-600":e.packageHealth.packageLintStatus==="fail"?"text-red-600":"text-yellow-600"}`,children:e.packageHealth.packageLintStatus})]})]})]})]})]})]}):r.jsx("p",{className:"py-6 text-gray-600",children:"No health data available."})}function Sg({packageData:e}){const[t,n]=d.useState(!1),[s,l]=d.useState(""),[a,i]=d.useState(!1),[c,o]=d.useState(""),[u,p]=d.useState(null),[m,g]=d.useState(!1);console.log("Package Data:",e);const v=()=>{const f={name:e.name,version:e.version,description:e.description||"",license:e.license||"",repository:e.repository||{},scripts:e.scripts||{},dependencies:e.dependencies||{},devDependencies:e.devDependencies||{},peerDependencies:e.peerDependencies||{}};return JSON.stringify(f,null,2)};d.useState(()=>{l(v())});const j=()=>{n(!0),l(v()),o("")},N=()=>{n(!1),l(v()),o("")},b=async()=>{if(!s.trim()){o("Configuration cannot be empty");return}i(!0),o("");try{console.log("Saving package configuration...");const f=await Oe.updatePackageConfiguration(e.name,s,e.path);if(f.success)o("Configuration updated successfully!"),n(!1),console.log("Update successful:",f);else throw new Error(f.message||"Update failed")}catch(f){console.error("Error saving configuration:",f),o(f instanceof Error?f.message:"Failed to save configuration. Please try again.")}finally{i(!1)}},x=f=>{l(f.target.value),c&&o("")},h=async(f,w,S)=>{try{await navigator.clipboard.writeText(f),w==="config"?(g(!0),setTimeout(()=>g(!1),4e3)):w==="script"&&S&&(p(S),setTimeout(()=>p(null),4e3))}catch(E){console.error("Failed to copy to clipboard:",E);const y=document.createElement("textarea");y.value=f,document.body.appendChild(y),y.select();try{document.execCommand("copy"),w==="config"?(g(!0),setTimeout(()=>g(!1),2e3)):w==="script"&&S&&(p(S),setTimeout(()=>p(null),2e3))}catch(C){console.error("Fallback copy failed:",C),w==="config"&&o("Failed to copy to clipboard")}document.body.removeChild(y)}};return r.jsxs("div",{className:"py-6",children:[r.jsxs("div",{className:"bg-white border rounded-lg p-6 mb-6",children:[r.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[r.jsx(Ei,{className:"w-5 h-5 text-gray-600"}),r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Package Scripts"})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:Object.entries(e.scripts).map(([f,w])=>r.jsxs("div",{className:"border border-gray-200 rounded-lg p-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900",children:f}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("button",{onClick:()=>h(w,"script",f),className:`text-sm flex items-center space-x-1 ${u===f?"text-green-600":"text-gray-600 hover:text-gray-700"}`,title:"Copy command to clipboard",children:u===f?r.jsxs(r.Fragment,{children:[r.jsx(nc,{className:"w-4 h-4"}),r.jsx("span",{children:"Copied!"})]}):r.jsxs(r.Fragment,{children:[r.jsx(rc,{className:"w-4 h-4"}),r.jsx("span",{children:"Copy"})]})}),r.jsx("button",{className:"hidden text-blue-600 hover:text-blue-500 text-sm",children:"Run"})]})]}),r.jsx("code",{className:"text-xs text-gray-600 bg-gray-100 p-2 rounded block overflow-x-auto",children:w})]},f))}),Object.keys(e.scripts).length===0&&r.jsxs("div",{className:"text-center py-8",children:[r.jsx("div",{className:"text-gray-400 text-4xl mb-2",children:"📝"}),r.jsx("p",{className:"text-gray-500",children:"No scripts configured"})]})]}),r.jsxs("div",{className:"bg-white border rounded-lg p-6",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Package Configuration"}),!t&&r.jsx("div",{className:"text-sm text-gray-500",children:"Read-only preview"})]}),t?r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"bg-gray-900 text-gray-100 p-4 rounded-lg",children:r.jsx("textarea",{value:s,onChange:x,className:"w-full h-96 bg-gray-900 text-gray-100 text-sm font-mono resize-none focus:outline-none focus:ring-2 focus:ring-blue-500 rounded",spellCheck:"false"})}),c&&r.jsx("div",{className:`p-3 rounded-lg text-sm ${c.includes("successfully")?"bg-green-50 text-green-700 border border-green-200":"bg-red-50 text-red-700 border border-red-200"}`,children:c}),r.jsxs("div",{className:"flex space-x-3",children:[r.jsx("button",{onClick:b,disabled:a,className:"bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 disabled:bg-blue-300 disabled:cursor-not-allowed text-sm flex items-center space-x-2",children:a?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),r.jsx("span",{children:"Saving..."})]}):r.jsx("span",{children:"Save Changes"})}),r.jsx("button",{onClick:N,disabled:a,className:"border border-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed text-sm",children:"Cancel"})]})]}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"bg-gray-900 text-gray-100 p-4 rounded-lg overflow-x-auto",children:r.jsx("pre",{className:"text-sm",children:s})}),r.jsxs("div",{className:"mt-4 flex space-x-3",children:[r.jsx("button",{onClick:j,className:"bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 text-sm",children:"Edit Configuration"}),r.jsx("button",{onClick:()=>h(t?s:v(),"config"),className:"border border-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-50 text-sm flex items-center space-x-2",children:m?r.jsxs(r.Fragment,{children:[r.jsx(nc,{className:"w-4 h-4 text-green-600"}),r.jsx("span",{children:"Copied!"})]}):r.jsxs(r.Fragment,{children:[r.jsx(rc,{className:"w-4 h-4"}),r.jsx("span",{children:"Copy"})]})})]})]})]})]})}const oc={title:"Monorepo Dashboard",description:"Visual management and monitoring of your monorepo packages",packageTypes:["app","lib","tool"],features:{healthChecks:!0,ciIntegration:!0,dependencyGraph:!0,publishControl:!0,searchAndFilter:!0,configurationInspector:!0},branding:{primaryColor:"#3B82F6",secondaryColor:"#1E40AF"}};function Cg(){const[e,t]=d.useState(),[n,s]=d.useState(""),[l,a]=d.useState("all"),[i,c]=d.useState(oc),[o,u]=d.useState(!1),[p,m]=d.useState(!1),[g,v]=d.useState(!0),[j,N]=d.useState(null),[b,x]=d.useState(!1);d.useEffect(()=>{(async()=>{try{v(!0);const C=await Oe.getPackages();t(C),N(null)}catch(C){N("Failed to fetch packages"),console.error("Error fetching packages:",C)}finally{v(!1)}})()},[]),d.useEffect(()=>{const y=localStorage.getItem("monodog-config");y&&c({...oc,...JSON.parse(y)})},[]);const h=y=>{c(y),localStorage.setItem("monodog-config",JSON.stringify(y))},f=async()=>{try{x(!0),N(null),v(!0);try{const y=await Oe.refreshPackages();console.log("package data:",y),t(y),N(null)}catch(y){N("Failed to fetch package data"),console.error("Error fetching package data:",y)}finally{v(!1)}}catch(y){N("Failed to refresh package data"),console.error("Error refreshing package data:",y)}finally{x(!1)}};if(g&&!e)return r.jsx(Ti,{});if(j)return r.jsx(Vd,{error:j,onRetry:f});const w=og(e??[],n,l),S=ig(e??[]),E=ag(e??[]);return r.jsxs("div",{className:"p-6 space-y-6",children:[b&&e&&r.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-70 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-white p-6 rounded-lg shadow-lg text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-700",children:"Refreshing packages..."})]})}),r.jsx(Jp,{config:i,onShowSetupGuide:()=>m(!0),onShowConfig:()=>u(!0),onRefresh:f}),r.jsx(qp,{stats:E}),r.jsx(eg,{packages:e??[],packageTypes:S,getTypeIcon:ic}),r.jsx(tg,{}),r.jsxs("div",{className:"bg-white p-6 rounded-lg shadow border",children:[r.jsx(ng,{searchTerm:n,selectedType:l,packageTypes:S,onSearchChange:s,onTypeChange:a}),r.jsx(rg,{packages:w,getTypeIcon:ic,getStatusColor:cg})]}),r.jsx(zp,{isOpen:o,onClose:()=>u(!1),onSave:h,currentConfig:i}),r.jsx(Xp,{isOpen:p,onClose:()=>m(!1),onComplete:()=>m(!1)})]})}function Eg(){const[e,t]=d.useState([]),[n,s]=d.useState(!0),[l,a]=d.useState(null),[i,c]=d.useState({search:"",type:"all",status:"all"}),[o,u]=d.useState({field:"name",order:"asc"});d.useEffect(()=>{(async()=>{try{s(!0);const x=await Oe.getPackages();t(x),a(null)}catch(x){a("Failed to fetch packages"),console.error("Error fetching packages:",x)}finally{s(!1)}})()},[]);const p=()=>{window.location.reload()},m=xg(e,i),g=pg(m,o),v=mg(e),j=hg(e),N=fg(e);return n?r.jsx(Ti,{}):l?r.jsx(Vd,{error:l,onRetry:p}):r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsxs("div",{children:[r.jsx("h1",{className:"text-heading text-2xl",children:"Packages Overview"}),r.jsx("p",{className:"text-body mt-1",children:"Manage and monitor all packages in your monorepo"})]})}),r.jsx(ug,{stats:v}),r.jsx(dg,{filters:i,onFiltersChange:c,availableTypes:j,availableStatuses:N}),r.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-600",children:[r.jsxs("span",{children:["Showing ",g.length," of ",e.length," packages",i.search&&` matching "${i.search}"`]}),r.jsxs("span",{children:[i.type!=="all"&&`Filtered by type: ${i.type}`,i.status!=="all"&&` • status: ${i.status}`]})]}),r.jsx(vg,{packages:g,sorting:o,onSortChange:u}),g.length===0&&!n&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx("div",{className:"text-neutral-400 text-6xl mb-4",children:"📦"}),r.jsx("h3",{className:"text-heading text-lg mb-2",children:"No packages found"}),r.jsx("p",{className:"text-body mb-4",children:i.search||i.type!=="all"||i.status!=="all"?"Try adjusting your filters to see more results.":"Get started by adding your first package to the monorepo."}),(i.search||i.type!=="all"||i.status!=="all")&&r.jsx("button",{onClick:()=>c({search:"",type:"all",status:"all"}),className:"text-primary-600 hover:text-primary-500",children:"Clear Filters"})]})]})}function Pg(){const{name:e}=h0(),[t,n]=d.useState(null),[s,l]=d.useState("overview");if(d.useEffect(()=>{(async()=>{try{const c=await Oe.getPackage(e??"");n(c)}catch(c){console.error("Error fetching packages:",c)}})()},[e]),!t)return r.jsx(Ti,{message:"Loading package details..."});const a=()=>{var i;switch(s){case"overview":return r.jsx("div",{className:"py-6",children:r.jsxs("div",{className:"bg-white border rounded-lg p-6",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:"Package Overview"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-2",children:"Description"}),r.jsx("p",{className:"text-gray-600 mb-4",children:t.description}),r.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-2",children:"Maintainers"}),r.jsx("div",{className:"space-y-1",children:Object.keys(t.maintainers).map(c=>r.jsx("div",{className:"text-sm text-gray-600",children:c},c))})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-2",children:"Quick Stats"}),r.jsxs("div",{className:"space-y-2 text-sm",children:[r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-600",children:"Dependencies:"}),r.jsx("span",{className:"font-medium",children:t.dependenciesInfo.filter(c=>c.type=="dependency").length})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-600",children:"Dev Dependencies:"}),r.jsx("span",{className:"font-medium",children:t.dependenciesInfo.filter(c=>c.type=="devDependency").length})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-600",children:"Peer Dependencies:"}),r.jsx("span",{className:"font-medium",children:t.dependenciesInfo.filter(c=>c.type=="peerDependency").length})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-600",children:"Scripts:"}),r.jsx("span",{className:"font-medium",children:Object.keys(t.scripts).length})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-600",children:"Recent Commits:"}),r.jsx("span",{className:"font-medium",children:(i=t.commits)==null?void 0:i.length})]})]})]})]})]})});case"dependencies":return r.jsx(Ng,{packageData:t});case"commits":return r.jsx(bg,{packageData:t});case"health":return r.jsx(kg,{packageData:t});case"config":return r.jsx(Sg,{packageData:t});default:return null}};return r.jsxs("div",{className:"space-y-6",children:[r.jsx(jg,{packageData:t}),r.jsxs("div",{className:"bg-white rounded-lg shadow border",children:[r.jsx(wg,{activeTab:s,onTabChange:l}),r.jsx("div",{className:"px-6",children:a()})]})]})}function Lg({message:e="Loading dependency graph..."}){return r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600",children:e})]})})}function Rg({error:e,onRetry:t}){return r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsxs("div",{className:"text-center",children:[r.jsx(te,{className:"w-12 h-12 text-red-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-red-600",children:e}),t&&r.jsx("button",{onClick:t,className:"mt-4 bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 transition-colors",children:"Retry"})]})})}function Tg({onRefresh:e,loading:t=!1}){return r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Dependency Graph"}),r.jsx("p",{className:"text-gray-600 mt-1",children:"Visualize package dependencies and relationships"})]}),e&&r.jsxs("button",{onClick:e,disabled:t,className:"hidden bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-2 transition-colors",children:[r.jsx(ot,{className:`w-5 h-5 ${t?"animate-spin":""}`}),r.jsx("span",{children:"Refresh"})]})]})}function Mg({viewMode:e,onViewModeChange:t,layout:n,onLayoutChange:s,showLegend:l,onToggleLegend:a,zoomLevel:i,onZoomChange:c}){return r.jsxs("div",{className:"bg-white p-4 rounded-lg shadow border flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("span",{className:"text-sm font-medium text-gray-700",children:"View:"}),r.jsxs("div",{className:"flex rounded-lg border border-gray-300 overflow-hidden",children:[r.jsxs("button",{onClick:()=>t("graph"),className:`px-3 py-2 text-sm font-medium flex items-center space-x-1 ${e==="graph"?"bg-blue-600 text-white":"bg-white text-gray-700 hover:bg-gray-50"}`,children:[r.jsx(vp,{className:"w-4 h-4"}),r.jsx("span",{children:"Graph"})]}),r.jsxs("button",{onClick:()=>t("list"),className:`px-3 py-2 text-sm font-medium flex items-center space-x-1 ${e==="list"?"bg-blue-600 text-white":"bg-white text-gray-700 hover:bg-gray-50"}`,children:[r.jsx(ep,{className:"w-4 h-4"}),r.jsx("span",{children:"List"})]})]})]}),e==="graph"&&r.jsxs("div",{className:"flex items-center space-x-4",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Layout:"}),r.jsxs("select",{value:n,onChange:o=>s(o.target.value),className:"border border-gray-300 rounded-md px-3 py-1 text-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[r.jsx("option",{value:"hierarchical",children:"Hierarchical"}),r.jsx("option",{value:"circular",children:"Circular"}),r.jsx("option",{value:"force",children:"Force-Directed"})]})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Zoom:"}),r.jsxs("div",{className:"flex items-center space-x-1",children:[r.jsx("button",{onClick:()=>c(Math.max(.5,i-.1)),className:"p-1 text-gray-600 hover:text-gray-800 disabled:opacity-50",disabled:i<=.5,children:r.jsx(rp,{className:"w-4 h-4"})}),r.jsxs("span",{className:"text-sm text-gray-600 min-w-[3rem] text-center",children:[Math.round(i*100),"%"]}),r.jsx("button",{onClick:()=>c(Math.min(2,i+.1)),className:"p-1 text-gray-600 hover:text-gray-800 disabled:opacity-50",disabled:i>=2,children:r.jsx(ap,{className:"w-4 h-4"})})]})]})]}),r.jsxs("button",{onClick:a,className:`px-3 py-2 text-sm font-medium rounded-lg flex items-center space-x-1 transition-colors ${l?"bg-blue-100 text-blue-700":"bg-gray-100 text-gray-700 hover:bg-gray-200"}`,children:[r.jsx(vn,{className:"w-4 h-4"}),r.jsx("span",{children:"Legend"})]})]})}const Gd=e=>{switch(e){case"healthy":return"text-green-600 bg-green-100";case"warning":return"text-yellow-600 bg-yellow-100";case"error":return"text-red-600 bg-red-100";default:return"text-gray-600 bg-gray-100"}},Kd=e=>{switch(e){case"app":return"text-blue-600 bg-blue-100";case"lib":return"text-purple-600 bg-purple-100";case"tool":return"text-orange-600 bg-orange-100";default:return"text-gray-600 bg-gray-100"}},cc=(e,t)=>{const n=t.find(s=>s.name===e);if(!n)return"text-gray-400";switch(n.status){case"healthy":return"text-green-500";case"warning":return"text-yellow-500";case"error":return"text-red-500";default:return"text-gray-400"}},_g=e=>{const t=e.length,n=e.reduce((o,u)=>o+Object.keys(u.dependencies).length,0),s=e.filter(o=>Object.keys(o.dependencies).length===0).length,l=e.filter(o=>o.dependents.length===0).length,a=Og(e),i=t>0?n/t:0,c=Xd(e);return{totalPackages:t,totalDependencies:n,circularDependencies:c.length,leafPackages:s,rootPackages:l,maxDepth:a,avgDependencies:Math.round(i*10)/10}},Og=e=>{const t=new Set;let n=0;const s=(l,a)=>{if(t.has(l))return a;t.add(l);const i=e.find(o=>o.name===l);if(!i)return a;let c=a;for(const o of Object.keys(i.dependencies)){const u=s(o,a+1);c=Math.max(c,u)}return c};for(const l of e)if(!t.has(l.name)){const a=s(l.name,0);n=Math.max(n,a)}return n},Xd=e=>{const t=[],n=new Set,s=new Set,l=[],a=i=>{if(s.has(i)){const o=l.indexOf(i),u=l.slice(o).concat(i);return t.push({cycle:u,severity:u.length>5?"high":u.length>3?"medium":"low",impact:`Circular dependency involving ${u.length} packages`}),!0}if(n.has(i))return!1;n.add(i),s.add(i),l.push(i);const c=e.find(o=>o.name===i);if(c){for(const o of Object.keys(c.dependencies))if(a(o))return!0}return s.delete(i),l.pop(),!1};for(const i of e)n.has(i.name)||a(i.name);return t},$g=(e,t,n)=>[...e].sort((s,l)=>{let a,i;switch(t){case"name":a=s.name.toLowerCase(),i=l.name.toLowerCase();break;case"dependencies":a=Object.keys(s.dependencies).length,i=Object.keys(l.dependencies).length;break;case"dependents":a=s.dependents.length,i=l.dependents.length;break;case"status":{const c={error:0,warning:1,healthy:2};a=c[s.status]||3,i=c[l.status]||3;break}default:return 0}return a<i?n==="asc"?-1:1:a>i?n==="asc"?1:-1:0}),Ig=(e,t,n=800,s=600)=>{switch(t){case"hierarchical":return Fg(e,n,s);case"circular":return Dg(e,n,s);case"force":return Ag(e,n,s);default:return e}},Fg=(e,t,n)=>{const s=[],l=new Set,a=(i,c)=>{if(l.has(i))return;l.add(i),s[c]||(s[c]=[]),s[c].push(i);const o=e.find(u=>u.name===i);o&&o.dependents.forEach(u=>a(u,c+1))};return e.filter(i=>Object.keys(i.dependencies).length===0&&i.dependents.length>0).forEach(i=>{a(i.name,0)}),s.length===0&&e.filter(i=>Object.keys(i.dependencies).length>0&&i.dependents.length>0).forEach(i=>{a(i.name,0)}),e.map(i=>{var p,m;const c=s.findIndex(g=>g.includes(i.name)),o=((p=s[c])==null?void 0:p.indexOf(i.name))||0,u=((m=s[c])==null?void 0:m.length)||1;return{...i,x:t/(s.length+1)*(c+1)-50,y:n/(u+1)*(o+1)-25}})},Dg=(e,t,n)=>{const s=t/2,l=n/2,a=Math.min(t,n)/3;return e.map((i,c)=>{const o=2*Math.PI*c/e.length;return{...i,x:s+a*Math.cos(o)-50,y:l+a*Math.sin(o)-25}})},Ag=(e,t,n)=>{const s=e.map((l,a)=>({...l,x:Math.random()*(t-100),y:Math.random()*(n-50)}));for(let l=0;l<50;l++)s.forEach(a=>{let i=0,c=0;s.forEach(o=>{if(o.name!==a.name){const u=a.x-o.x,p=a.y-o.y,m=Math.sqrt(u*u+p*p)||1,g=1e3/(m*m);i+=u/m*g,c+=p/m*g}}),Object.keys(a.dependencies).forEach(o=>{const u=s.find(p=>p.name===o);if(u){const p=u.x-a.x,m=u.y-a.y,g=Math.sqrt(p*p+m*m)||1,v=g*.01;i+=p/g*v,c+=m/g*v}}),a.x+=i*.1,a.y+=c*.1,a.x=Math.max(50,Math.min(t-100,a.x)),a.y=Math.max(25,Math.min(n-50,a.y))});return s},zg=e=>{switch(e){case"app":return"🚀";case"lib":return"📚";case"tool":return"🔧";default:return"📦"}},Bg=e=>e.length>12?`${e.substring(0,12)}...`:e,Ug=e=>{const t={};return e.forEach(n=>{t[n.name]=[]}),e.forEach(n=>{const s=n.name;[...Object.keys(n.dependencies??{}),...Object.keys(n.devDependencies??{}),...Object.keys(n.peerDependencies??{})].forEach(a=>{t[a]||(t[a]=[]),t[a].includes(s)||t[a].push(s)})}),t};function Hg({packages:e,selectedPackage:t,hoveredPackage:n,onPackageSelect:s,onPackageHover:l,layout:a}){return r.jsxs("div",{className:"relative bg-white rounded-lg shadow-sm border border-gray-200 p-6 min-h-[600px]",children:[r.jsxs("svg",{className:"w-full h-full absolute inset-0",viewBox:"0 0 800 600",children:[e.map(i=>Object.keys(i.dependencies).map(c=>{const o=e.find(p=>p.name===c);if(!o)return null;console.log("Rendering edge from",i.name,"to",o.name);const u=n===i.name||n===c||t===i.name||t===c;return r.jsxs("g",{children:[r.jsx("defs",{children:r.jsx("marker",{id:`arrow-${i.name}-${c}`,markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:r.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:u?"#3B82F6":"#6B7280"})})}),r.jsx("line",{x1:o.x+50,y1:o.y+25,x2:i.x,y2:i.y+25,stroke:u?"#3B82F6":"#6B7280",strokeWidth:u?"3":"2",markerEnd:`url(#arrow-${i.name}-${c})`,className:"transition-all duration-200",style:{opacity:u?1:.6}})]},`${i.name}-${c}`)})),e.map(i=>{const c=t===i.name,o=n===i.name,u=t&&(Object.keys(i.dependencies).includes(t)||Object.keys(i.dependents).includes(t));return r.jsxs("g",{children:[r.jsx("rect",{x:i.x,y:i.y,width:"100",height:"50",rx:"8",fill:"white",stroke:c?"#3B82F6":u?"#10B981":o?"#6B7280":"#E5E7EB",strokeWidth:c?"3":"2",className:"cursor-pointer transition-all duration-200",style:{filter:o||c||u?"drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1))":"none"},onMouseEnter:()=>l(i.name),onMouseLeave:()=>l(null),onClick:()=>s(c?null:i.name)}),r.jsx("text",{x:i.x+50,y:i.y+20,textAnchor:"middle",className:"text-xs font-medium fill-gray-900 pointer-events-none",children:Bg(i.name)}),r.jsxs("text",{x:i.x+50,y:i.y+35,textAnchor:"middle",className:"text-xs fill-gray-500 pointer-events-none",children:["v",i.version]}),r.jsx("circle",{cx:i.x+85,cy:i.y+15,r:"6",fill:i.status==="healthy"?"#10B981":i.status==="warning"?"#F59E0B":"#EF4444",className:"pointer-events-none"}),r.jsx("rect",{x:i.x+5,y:i.y+5,width:"12",height:"8",rx:"2",fill:i.type==="app"?"#3B82F6":i.type==="lib"?"#8B5CF6":"#F97316",className:"pointer-events-none"})]},i.name)})]}),e.length===0&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-gray-400 text-6xl mb-4",children:"🔗"}),r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"No dependencies found"}),r.jsx("p",{className:"text-gray-600",children:"No package dependencies to display."})]})})]})}function Vg({packages:e,selectedPackage:t,onPackageSelect:n,sortBy:s,sortOrder:l,onSortChange:a}){const i=o=>{a(o,s===o&&l==="asc"?"desc":"asc")},c=o=>s!==o?null:l==="asc"?r.jsx(Si,{className:"w-4 h-4"}):r.jsx(zd,{className:"w-4 h-4"});return r.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200",children:[r.jsxs("div",{className:"p-6 border-b border-gray-200",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Package Dependencies"}),r.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"Click on a view details to explore its dependencies, commits, configuration and health"})]}),r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"min-w-full divide-y divide-gray-200",children:[r.jsx("thead",{className:"bg-gray-50",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider cursor-pointer hover:bg-gray-100",onClick:()=>i("name"),children:r.jsxs("div",{className:"flex items-center space-x-1",children:[r.jsx("span",{children:"Package"}),c("name")]})}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Type"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Status"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider cursor-pointer hover:bg-gray-100",onClick:()=>i("dependencies"),children:r.jsxs("div",{className:"flex items-center space-x-1",children:[r.jsx("span",{children:"Dependencies"}),c("dependencies")]})}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider cursor-pointer hover:bg-gray-100",onClick:()=>i("dependents"),children:r.jsxs("div",{className:"flex items-center space-x-1",children:[r.jsx("span",{children:"Dependents"}),c("dependents")]})}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Actions"})]})}),r.jsx("tbody",{className:"bg-white divide-y divide-gray-200",children:e.map(o=>r.jsxs("tr",{className:`hover:bg-gray-50 cursor-pointer transition-colors ${t===o.name?"bg-blue-50":""}`,onClick:()=>n(o.name),children:[r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"text-2xl mr-3",children:zg(o.type)}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium text-gray-900",children:o.name}),r.jsxs("div",{className:"text-sm text-gray-500",children:["v",o.version]})]})]})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${Kd(o.type)}`,children:o.type})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${Gd(o.status)}`,children:o.status})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsxs("div",{className:"text-sm text-gray-900",children:[Object.keys(o.dependencies).length,Object.keys(o.dependencies).length>0&&r.jsxs("div",{className:"text-xs text-gray-500 mt-1",children:[Object.keys(o.dependencies).slice(0,3).join(", "),Object.keys(o.dependencies).length>3&&` +${Object.keys(o.dependencies).length-3} more`]})]})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsxs("div",{className:"text-sm text-gray-900",children:[o.dependents.length,o.dependents.length>0&&r.jsxs("div",{className:"text-xs text-gray-500 mt-1",children:[o.dependents.slice(0,3).join(", "),o.dependents.length>3&&` +${o.dependents.length-3} more`]})]})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm",children:r.jsx(rt,{to:`/packages/${encodeURIComponent(o.name)}`,className:"text-blue-600 hover:text-blue-500",onClick:u=>u.stopPropagation(),children:"View Details"})})]},o.name))})]})}),e.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx("div",{className:"text-gray-400 text-4xl mb-2",children:"📦"}),r.jsx("p",{className:"text-gray-500",children:"No packages found"})]})]})}function Wg({package:e,packages:t,onClose:n}){return e?r.jsxs("div",{className:"absolute top-4 right-4 bg-white p-4 rounded-lg shadow-lg border border-gray-200 w-80 max-h-[80vh] overflow-y-auto",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:e.name}),r.jsx("button",{onClick:n,className:"text-gray-400 hover:text-gray-600 transition-colors",children:r.jsx(Pr,{className:"w-5 h-5"})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${Kd(e.type)}`,children:e.type}),r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${Gd(e.status)}`,children:e.status})]}),r.jsxs("div",{className:"text-sm text-gray-600",children:["Version: ",r.jsx("span",{className:"font-mono",children:e.version})]})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700",children:"Dependencies"}),r.jsxs("span",{className:"text-xs text-gray-500",children:["(",Object.keys(e.dependencies).length,")"]})]}),Object.keys(e.dependencies).length>0?r.jsx("div",{className:"space-y-1 max-h-32 overflow-y-auto",children:Object.keys(e.dependencies).map(s=>{const l=t.find(a=>a.name===s);return l?r.jsxs("div",{className:"flex items-center justify-between text-sm py-1",children:[r.jsx("span",{className:"text-gray-600 truncate",children:l.name}),r.jsxs("div",{className:"flex items-center space-x-1",children:[r.jsx("span",{className:"text-xs text-gray-400",children:l.version}),r.jsx("span",{className:`${cc(s,t)}`,children:l.status==="healthy"?"✓":l.status==="warning"?"⚠":"✗"})]})]},s):r.jsxs("div",{className:"text-sm text-gray-400 py-1",children:[s," (not found)"]},s)})}):r.jsx("div",{className:"text-sm text-gray-500 text-center py-2",children:"No dependencies"})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700",children:"Dependents"}),r.jsxs("span",{className:"text-xs text-gray-500",children:["(",e.dependents.length,")"]})]}),e.dependents.length>0?r.jsx("div",{className:"space-y-1 max-h-32 overflow-y-auto",children:e.dependents.map(s=>{const l=t.find(a=>a.name===s);return l?r.jsxs("div",{className:"flex items-center justify-between text-sm py-1",children:[r.jsx("span",{className:"text-gray-600 truncate",children:l.name}),r.jsxs("div",{className:"flex items-center space-x-1",children:[r.jsx("span",{className:"text-xs text-gray-400",children:l.version}),r.jsx("span",{className:`${cc(s,t)}`,children:l.status==="healthy"?"✓":l.status==="warning"?"⚠":"✗"})]})]},s):r.jsxs("div",{className:"text-sm text-gray-400 py-1",children:[s," (not found)"]},s)})}):r.jsx("div",{className:"text-sm text-gray-500 text-center py-2",children:"No dependents"})]}),r.jsxs("div",{className:"pt-2 border-t border-gray-200",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-2",children:"Impact Analysis"}),r.jsxs("div",{className:"space-y-1 text-xs text-gray-600",children:[r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{children:"Direct dependencies:"}),r.jsx("span",{className:"font-medium",children:Object.keys(e.dependencies).length})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{children:"Direct dependents:"}),r.jsx("span",{className:"font-medium",children:e.dependents.length})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{children:"Risk level:"}),r.jsx("span",{className:`font-medium ${e.dependents.length>5?"text-red-600":e.dependents.length>2?"text-yellow-600":"text-green-600"}`,children:e.dependents.length>5?"High":e.dependents.length>2?"Medium":"Low"})]})]})]}),r.jsx("div",{className:"pt-2 border-t border-gray-200",children:r.jsx(rt,{to:`/packages/${encodeURIComponent(e.name)}`,className:"block w-full text-center bg-blue-600 text-white px-3 py-2 rounded-lg hover:bg-blue-700 text-sm font-medium transition-colors",children:"View Package Details →"})})]})]}):null}function Qg({stats:e,packages:t}){return r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[r.jsx("div",{className:"bg-white p-4 rounded-lg shadow border",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-2 bg-blue-100 rounded-lg",children:r.jsx(qs,{className:"w-6 h-6 text-blue-600"})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Total Packages"}),r.jsx("p",{className:"text-2xl font-semibold text-gray-900",children:e.totalPackages})]})]})}),r.jsx("div",{className:"bg-white p-4 rounded-lg shadow border",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-2 bg-green-100 rounded-lg",children:r.jsx(ot,{className:"w-6 h-6 text-green-600"})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Dependencies"}),r.jsx("p",{className:"text-2xl font-semibold text-gray-900",children:e.totalDependencies})]})]})}),r.jsx("div",{className:"bg-white p-4 rounded-lg shadow border",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:`p-2 rounded-lg ${e.circularDependencies>0?"bg-red-100":"bg-green-100"}`,children:r.jsx(te,{className:`w-6 h-6 ${e.circularDependencies>0?"text-red-600":"text-green-600"}`})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Circular Deps"}),r.jsx("p",{className:`text-2xl font-semibold ${e.circularDependencies>0?"text-red-600":"text-green-600"}`,children:e.circularDependencies})]})]})}),r.jsx("div",{className:"bg-white p-4 rounded-lg shadow border",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-2 bg-purple-100 rounded-lg",children:r.jsx(Er,{className:"w-6 h-6 text-purple-600"})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Max Depth"}),r.jsx("p",{className:"text-2xl font-semibold text-gray-900",children:e.maxDepth})]})]})}),r.jsxs("div",{className:"md:col-span-4 bg-white p-4 rounded-lg shadow border",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:"Dependency Analysis"}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-2xl font-bold text-blue-600",children:e.leafPackages}),r.jsx("div",{className:"text-sm text-gray-600",children:"Leaf Packages"}),r.jsx("div",{className:"text-xs text-gray-500",children:"No dependencies"})]}),r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-2xl font-bold text-green-600",children:e.rootPackages}),r.jsx("div",{className:"text-sm text-gray-600",children:"Root Packages"}),r.jsx("div",{className:"text-xs text-gray-500",children:"No dependents"})]}),r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-2xl font-bold text-purple-600",children:e.avgDependencies}),r.jsx("div",{className:"text-sm text-gray-600",children:"Avg Dependencies"}),r.jsx("div",{className:"text-xs text-gray-500",children:"Per package"})]}),r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-2xl font-bold text-orange-600",children:t.filter(n=>n.status==="healthy").length}),r.jsx("div",{className:"text-sm text-gray-600",children:"Healthy Packages"}),r.jsxs("div",{className:"text-xs text-gray-500",children:[Math.round(t.filter(n=>n.status==="healthy").length/t.length*100),"% of total"]})]})]})]})]})}function Yg({cycles:e,packages:t,onPackageSelect:n}){const s=a=>{switch(a){case"high":return"bg-red-100 text-red-800 border-red-200";case"medium":return"bg-yellow-100 text-yellow-800 border-yellow-200";case"low":return"bg-blue-100 text-blue-800 border-blue-200";default:return"bg-gray-100 text-gray-800 border-gray-200"}},l=a=>{switch(a){case"high":return"🔴";case"medium":return"🟡";case"low":return"🔵";default:return"⚪"}};return e.length===0?r.jsxs("div",{className:"bg-white p-6 rounded-lg shadow border",children:[r.jsxs("div",{className:"flex items-center space-x-3 mb-4",children:[r.jsx("div",{className:"p-2 bg-green-100 rounded-lg",children:r.jsx(te,{className:"w-6 h-6 text-green-600"})}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Circular Dependencies"}),r.jsx("p",{className:"text-sm text-gray-600",children:"Dependency cycle analysis"})]})]}),r.jsxs("div",{className:"text-center py-8",children:[r.jsx("div",{className:"text-green-400 text-4xl mb-2"}),r.jsx("h4",{className:"text-green-800 font-medium mb-1",children:"No Circular Dependencies!"}),r.jsx("p",{className:"text-green-700 text-sm",children:"Your dependency graph is clean and free of circular references."})]})]}):r.jsxs("div",{className:"bg-white p-6 rounded-lg shadow border",children:[r.jsxs("div",{className:"flex items-center space-x-3 mb-4",children:[r.jsx("div",{className:"p-2 bg-red-100 rounded-lg",children:r.jsx(te,{className:"w-6 h-6 text-red-600"})}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Circular Dependencies"}),r.jsxs("p",{className:"text-sm text-gray-600",children:["Found ",e.length," circular dependency cycle",e.length>1?"s":""]})]})]}),r.jsx("div",{className:"space-y-4",children:e.map((a,i)=>r.jsxs("div",{className:`border rounded-lg p-4 ${s(a.severity)}`,children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("span",{className:"text-lg",children:l(a.severity)}),r.jsxs("span",{className:"text-sm font-medium capitalize",children:[a.severity," Severity"]})]}),r.jsxs("span",{className:"text-xs opacity-75",children:[a.cycle.length," packages affected"]})]}),r.jsx("div",{className:"mb-3",children:r.jsx("p",{className:"text-sm mb-2",children:a.impact})}),r.jsx("div",{className:"bg-white bg-opacity-50 rounded-lg p-3",children:r.jsxs("div",{className:"flex items-center flex-wrap gap-2",children:[a.cycle.map((c,o)=>r.jsxs(React.Fragment,{children:[r.jsx("button",{onClick:()=>n(c),className:"px-3 py-1 bg-white rounded-lg text-sm font-medium hover:bg-gray-50 transition-colors border shadow-sm",children:c}),o<a.cycle.length-1&&r.jsx(tc,{className:"w-4 h-4 text-gray-400"})]},`${c}-${o}`)),a.cycle.length>1&&r.jsxs(r.Fragment,{children:[r.jsx(tc,{className:"w-4 h-4 text-gray-400"}),r.jsxs("span",{className:"text-sm text-gray-500 italic",children:["(cycles back to ",a.cycle[0],")"]})]})]})}),r.jsxs("div",{className:"mt-3 pt-3 border-t border-current border-opacity-20",children:[r.jsx("h5",{className:"text-xs font-medium mb-1",children:"Recommendation:"}),r.jsxs("p",{className:"text-xs opacity-90",children:[a.severity==="high"&&"Critical: Refactor immediately to break this cycle. Consider dependency inversion or splitting packages.",a.severity==="medium"&&"Important: Plan to refactor this cycle. Review package boundaries and extract common dependencies.",a.severity==="low"&&"Minor: Monitor this cycle. Consider if these packages could be merged or dependencies restructured."]})]})]},i))}),r.jsx("div",{className:"mt-6 pt-4 border-t border-gray-200",children:r.jsxs("div",{className:"grid grid-cols-3 gap-4 text-center",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-lg font-bold text-red-600",children:e.filter(a=>a.severity==="high").length}),r.jsx("div",{className:"text-xs text-gray-600",children:"High Severity"})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-lg font-bold text-yellow-600",children:e.filter(a=>a.severity==="medium").length}),r.jsx("div",{className:"text-xs text-gray-600",children:"Medium Severity"})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-lg font-bold text-blue-600",children:e.filter(a=>a.severity==="low").length}),r.jsx("div",{className:"text-xs text-gray-600",children:"Low Severity"})]})]})})]})}function Zg({show:e}){return e?r.jsxs("div",{className:"bg-white p-4 rounded-lg shadow border",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 mb-3",children:"Legend"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("h5",{className:"text-xs font-medium text-gray-700 mb-2",children:"Package Types"}),r.jsxs("div",{className:"grid grid-cols-3 gap-2 text-xs",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("div",{className:"w-3 h-2 bg-blue-500 rounded"}),r.jsx("span",{children:"App"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("div",{className:"w-3 h-2 bg-purple-500 rounded"}),r.jsx("span",{children:"Library"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("div",{className:"w-3 h-2 bg-orange-500 rounded"}),r.jsx("span",{children:"Tool"})]})]})]}),r.jsxs("div",{children:[r.jsx("h5",{className:"text-xs font-medium text-gray-700 mb-2",children:"Health Status"}),r.jsxs("div",{className:"grid grid-cols-3 gap-2 text-xs",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("div",{className:"w-3 h-3 bg-green-500 rounded-full"}),r.jsx("span",{children:"Healthy"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("div",{className:"w-3 h-3 bg-yellow-500 rounded-full"}),r.jsx("span",{children:"Warning"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("div",{className:"w-3 h-3 bg-red-500 rounded-full"}),r.jsx("span",{children:"Error"})]})]})]}),r.jsxs("div",{children:[r.jsx("h5",{className:"text-xs font-medium text-gray-700 mb-2",children:"Visual Elements"}),r.jsxs("div",{className:"space-y-1 text-xs",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsxs("svg",{width:"16",height:"8",children:[r.jsx("line",{x1:"0",y1:"4",x2:"16",y2:"4",stroke:"#6B7280",strokeWidth:"2",markerEnd:"url(#arrow)"}),r.jsx("defs",{children:r.jsx("marker",{id:"arrow",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:r.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6B7280"})})})]}),r.jsx("span",{children:"Dependency"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("div",{className:"w-4 h-3 border-2 border-blue-500 rounded bg-white"}),r.jsx("span",{children:"Selected"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("div",{className:"w-4 h-3 border-2 border-green-500 rounded bg-white"}),r.jsx("span",{children:"Connected"})]})]})]}),r.jsxs("div",{children:[r.jsx("h5",{className:"text-xs font-medium text-gray-700 mb-2",children:"Interactions"}),r.jsxs("div",{className:"space-y-1 text-xs text-gray-600",children:[r.jsx("div",{children:"• Click a package to select and view details"}),r.jsx("div",{children:"• Hover to highlight connections"}),r.jsx("div",{children:"• Use toolbar to change layout and zoom"})]})]})]})]}):null}function Gg(){d.useEffect(()=>{(async()=>{try{t(!0);const He=await Oe.getPackages(),Tn=Ug(He),P=He.map(T=>({...T,dependencies:{...T.dependencies,...T.devDependencies,...T.peerDependencies},dependents:Tn[T.name]}));a(P),s(null)}catch(He){s("Failed to fetch packages"),console.error("Error fetching packages:",He)}finally{t(!1)}})()},[]);const[e,t]=d.useState(!1),[n,s]=d.useState(null),[l,a]=d.useState([]),[i,c]=d.useState("graph"),[o,u]=d.useState("hierarchical"),[p,m]=d.useState(null),[g,v]=d.useState(null),[j,N]=d.useState(!0),[b,x]=d.useState(1),[h,f]=d.useState("name"),[w,S]=d.useState("asc"),E=d.useMemo(()=>Ig(l??[],o,800,600),[l,o]),y=d.useMemo(()=>$g(l,h,w),[l,h,w]),C=d.useMemo(()=>_g(l),[l]),$=d.useMemo(()=>Xd(l),[l]),R=p&&l.find($e=>$e.name===p)||null,B=()=>{console.log("Refreshing dependency graph...")},ae=$e=>{m($e)},we=($e,He)=>{f($e),S(He)},ne=()=>{window.location.reload()};return e?r.jsx(Lg,{}):n?r.jsx(Rg,{error:n,onRetry:ne}):r.jsxs("div",{className:"space-y-6",children:[r.jsx(Tg,{onRefresh:B,loading:e}),r.jsx(Qg,{stats:C,packages:l??[]}),$.length>0&&r.jsx(Yg,{cycles:$,packages:l,onPackageSelect:ae}),r.jsx(Mg,{viewMode:i,onViewModeChange:c,layout:o,onLayoutChange:u,showLegend:j,onToggleLegend:()=>N(!j),zoomLevel:b,onZoomChange:x}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6",children:[r.jsx("div",{className:`${j?"lg:col-span-3":"lg:col-span-4"}`,children:i==="graph"?r.jsxs("div",{className:"relative",children:[r.jsx("div",{style:{transform:`scale(${b})`,transformOrigin:"top left"},children:r.jsx(Hg,{packages:E,selectedPackage:p,hoveredPackage:g,onPackageSelect:ae,onPackageHover:v,layout:o})}),r.jsx(Wg,{package:R,packages:l,onClose:()=>m(null)})]}):r.jsx(Vg,{packages:y,selectedPackage:p,onPackageSelect:ae,sortBy:h,sortOrder:w,onSortChange:we})}),j&&r.jsx("div",{className:"lg:col-span-1",children:r.jsx(Zg,{show:j})})]}),l.length===0&&!e&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx("div",{className:"text-gray-400 text-6xl mb-4",children:"🔗"}),r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"No dependencies found"}),r.jsx("p",{className:"text-gray-600 mb-4",children:"No package dependencies available to display."})]})]})}function Kg(){var h,f,w,S,E;const[e,t]=d.useState(0),[n,s]=d.useState(null),[l,a]=d.useState(!0),[i,c]=d.useState(null),[o,u]=d.useState(!1);d.useEffect(()=>{(async()=>{try{a(!0);const C=await Oe.getHealthStatus();console.log("Health data from inside useEffect:",C),s(C),c(null)}catch(C){c("Failed to fetch health data"),console.error("Error fetching health data:",C)}finally{a(!1)}})()},[e]),console.log("Health data from outside of useEffect:",n);const p=async()=>{try{u(!0),c(null),a(!0);try{const y=await Oe.refreshHealthStatus();console.log("Health data:",y),s(y),c(null)}catch(y){c("Failed to fetch health data"),console.error("Error fetching health data:",y)}finally{a(!1)}}catch(y){c("Failed to refresh health data"),console.error("Error refreshing health data:",y)}finally{u(!1)}},m=()=>{t(y=>y+1)},g=y=>{switch(y){case"healthy":case"success":case"pass":case"up-to-date":return"bg-green-100 text-green-800";case"warning":case"warn":case"outdated":return"bg-yellow-100 text-yellow-800";case"error":case"failed":case"fail":case"vulnerable":return"bg-red-100 text-red-800";default:return"bg-gray-100 text-gray-800"}};if(l&&!n)return r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600",children:"Loading health data..."})]})});if(i)return r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsxs("div",{className:"text-center",children:[r.jsx(te,{className:"w-12 h-12 text-red-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-red-600",children:i}),r.jsx("button",{onClick:m,className:"mt-4 bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 transition-colors",children:"Retry"})]})});const v=n?(h=n.summary)==null?void 0:h.averageScore:0,j=n?(f=n==null?void 0:n.packages)==null?void 0:f.filter(y=>y.health.overallScore>=80).length:0,N=n?(w=n==null?void 0:n.packages)==null?void 0:w.filter(y=>y.health.overallScore>=60&&y.health.overallScore<80).length:0,b=n?(S=n==null?void 0:n.packages)==null?void 0:S.filter(y=>y.health.overallScore<60).length:0,x=[{name:"Package Health",value:j||0,status:(()=>{const y=j||0,C=(n==null?void 0:n.packages.length)||0;if(C===0)return"healthy";const $=y/C;return $>=.8?"healthy":$>=.6?"warning":"error"})(),description:`${j||0} healthy packages out of ${(n==null?void 0:n.packages.length)||0}`},{name:"Overall Score",value:Math.round(v),status:Math.round(v)>=80?"healthy":Math.round(v)>=60?"warning":"error",description:`Average health score: ${Math.round(v)}/100`},{name:"Unhealthy Packages",value:N+b||0,status:(N+b||0)===0?"healthy":(N+b||0)<=2?"warning":"error",description:`${N+b||0} packages need attention`}];return r.jsxs("div",{className:"",children:[r.jsxs("div",{className:"flex items-center justify-between my-3",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Health Status"}),r.jsx("p",{className:"text-gray-600 mt-1",children:"Monitor the health and performance of your monorepo packages"})]}),r.jsxs("button",{onClick:p,disabled:o,className:"bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 disabled:bg-blue-400 disabled:cursor-not-allowed flex items-center space-x-2 transition-colors",children:[o?r.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}):r.jsx(ot,{className:"w-5 h-5"}),r.jsx("span",{children:o?"Refreshing...":"Refresh"})]})]}),o&&n&&r.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-70 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-white p-6 rounded-lg shadow-lg text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-700",children:"Refreshing health data..."})]})}),r.jsxs("div",{className:"my-3 bg-gradient-to-r from-blue-500 to-purple-600 rounded-lg p-6 text-white",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-xl font-semibold",children:"Overall Monorepo Health"}),r.jsx("p",{className:"text-blue-100 mt-1",children:"Based on all package metrics and recent activity"})]}),r.jsxs("div",{className:"text-right",children:[r.jsx("div",{className:"text-4xl font-bold",children:v==null?void 0:v.toFixed(2)}),r.jsx("div",{className:"text-blue-100",children:"out of 100"})]})]}),r.jsxs("div",{className:"mt-4 flex space-x-4",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Ke,{className:"w-5 h-5 text-green-300"}),r.jsxs("span",{children:[j," Healthy"]})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(te,{className:"w-5 h-5 text-yellow-300"}),r.jsxs("span",{children:[N," Warnings"]})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Xe,{className:"w-5 h-5 text-red-300"}),r.jsxs("span",{children:[b," Errors"]})]})]})]}),r.jsx("div",{className:"my-3 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:x.map(y=>r.jsxs("div",{className:"bg-white p-6 rounded-lg shadow border",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:y.name}),r.jsx("div",{className:`w-3 h-3 rounded-full ${y.status==="healthy"?"bg-green-500":y.status==="warning"?"bg-yellow-500":"bg-red-500"}`})]}),r.jsx("div",{className:"flex items-end space-x-2",children:r.jsx("span",{className:"text-3xl font-bold text-gray-900",children:y.value})}),r.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${g(y.status)}`,children:y.status}),r.jsx("span",{className:"text-sm text-gray-500",children:y.description})]})]},y.name))}),r.jsxs("div",{className:"my-3 bg-white rounded-lg shadow border overflow-hidden",children:[r.jsx("div",{className:"px-6 py-4 border-b border-gray-200",children:r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Package Health Details"})}),r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"min-w-full divide-y divide-gray-200",children:[r.jsx("thead",{className:"bg-gray-50",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Package"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Overall Score"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Build Status"}),r.jsx("th",{className:"hidden px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Test Coverage"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Lint Status"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Security"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Dependencies"}),r.jsx("th",{className:"hidden px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Actions"})]})}),r.jsx("tbody",{className:"bg-white divide-y divide-gray-200",children:(E=n==null?void 0:n.packages)==null?void 0:E.map(y=>r.jsxs("tr",{className:"hover:bg-gray-50",children:[r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"h-8 w-8 rounded-lg bg-gray-100 flex items-center justify-center",children:r.jsx("div",{className:"text-sm",children:"📦"})}),r.jsxs("div",{className:"ml-3",children:[r.jsx("div",{className:"text-sm font-medium text-gray-900",children:y.packageName}),r.jsxs("div",{className:"text-sm text-gray-500",children:["Score: ",y.health.overallScore,"/100"]})]})]})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"w-16 bg-gray-200 rounded-full h-2 mr-2",children:r.jsx("div",{className:`h-2 rounded-full ${y.health.overallScore>=80?"bg-green-500":y.health.overallScore>=60?"bg-yellow-500":"bg-red-500"}`,style:{width:`${y.health.overallScore}%`}})}),r.jsx("span",{className:"text-sm font-medium text-gray-900",children:y.health.overallScore})]})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:`w-3 h-3 rounded-full ${y.health.buildStatus==="success"?"bg-green-500":y.health.buildStatus==="unknown"?"bg-yellow-500":"bg-red-500"}`}),r.jsx("span",{className:`ml-2 inline-flex px-2 py-1 text-xs font-semibold rounded-full ${g(y.health.buildStatus==="success"?"healthy":y.health.buildStatus==="unknown"?"warning":"error")}`,children:y.health.buildStatus==="success"?"healthy":y.health.buildStatus==="unknown"?"warning":"error"})]})}),r.jsx("td",{className:"hidden px-6 py-4 whitespace-nowrap",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx(ex,{className:"w-4 h-4 text-gray-400 mr-1"}),r.jsx("span",{className:"text-sm text-gray-900",children:"-"})]})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${g(y.health.lintStatus==="pass"?"pass":y.health.lintStatus==="unknown"?"warn":"fail")}`,children:y.health.lintStatus==="pass"?"pass":y.health.lintStatus==="unknown"?"warn":"fail"})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("div",{className:"flex items-center",children:r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${g(y.health.securityAudit==="pass"?"pass":y.health.securityAudit==="unknown"?"warn":"fail")}`,children:y.health.securityAudit==="pass"?"pass":y.health.securityAudit==="unknown"?"warn":"fail"})})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${g(y.health.overallScore>=80?"up-to-date":y.health.overallScore>=60?"outdated":"vulnerable")}`,children:y.health.overallScore>=80?"up-to-date":y.health.overallScore>=60?"outdated":"vulnerable"})}),r.jsx("td",{className:"hidden px-6 py-4 whitespace-nowrap text-sm font-medium",children:r.jsx("div",{className:"flex space-x-2",children:r.jsx("button",{className:"text-blue-600 hover:text-blue-900",children:"Details"})})})]},y.packageName))})]})})]}),r.jsxs("div",{className:"hidden bg-white rounded-lg shadow border p-6",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:"Health Recommendations"}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-start space-x-3 p-3 bg-yellow-50 rounded-lg border border-yellow-200",children:[r.jsx(te,{className:"w-5 h-5 text-yellow-600 mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-yellow-800",children:"Test Coverage Below Target"}),r.jsx("p",{className:"text-sm text-yellow-700",children:"Consider adding more tests to improve coverage above 90%"})]})]}),r.jsxs("div",{className:"flex items-start space-x-3 p-3 bg-red-50 rounded-lg border border-red-200",children:[r.jsx(Xe,{className:"w-5 h-5 text-red-600 mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-red-800",children:"Build Failures Detected"}),r.jsx("p",{className:"text-sm text-red-700",children:"monorepo-scanner package has build failures that need immediate attention"})]})]}),r.jsxs("div",{className:"flex items-start space-x-3 p-3 bg-blue-50 rounded-lg border border-blue-200",children:[r.jsx(Er,{className:"w-5 h-5 text-blue-600 mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-blue-800",children:"Performance Improvements Available"}),r.jsx("p",{className:"text-sm text-blue-700",children:"Consider optimizing build times and dependency resolution"})]})]})]})]})]})}function Xg({packageCount:e,onNewRelease:t}){return r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Publish Control"}),r.jsxs("p",{className:"text-gray-600 mt-1",children:["Manage package releases and versioning across your monorepo (",e," packages)"]})]}),r.jsxs("button",{onClick:t,className:"bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 flex items-center space-x-2",children:[r.jsx(gx,{className:"w-5 h-5"}),r.jsx("span",{children:"New Release"})]})]})}function Jg({stats:e}){return r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[r.jsx("div",{className:"bg-white p-6 rounded-lg shadow border",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-2 bg-green-100 rounded-lg",children:r.jsx(Li,{className:"w-6 h-6 text-green-600"})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Ready to Publish"}),r.jsx("p",{className:"text-2xl font-semibold text-gray-900",children:e.readyToPublish})]})]})}),r.jsx("div",{className:"bg-white p-6 rounded-lg shadow border",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-2 bg-blue-100 rounded-lg",children:r.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-blue-500 border-t-transparent"})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-sm font-medium text-gray-600",children:"In Progress"}),r.jsx("p",{className:"text-2xl font-semibold text-gray-900",children:e.inProgress})]})]})}),r.jsx("div",{className:"bg-white p-6 rounded-lg shadow border",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-2 bg-purple-100 rounded-lg",children:r.jsx("span",{className:"text-2xl",children:"🚀"})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Published Today"}),r.jsx("p",{className:"text-2xl font-semibold text-gray-900",children:e.published})]})]})})]})}const qg=e=>({readyToPublish:e.filter(t=>t.status==="ready").length,inProgress:e.filter(t=>t.status==="building"||t.status==="testing").length,published:e.filter(t=>t.status==="published").length}),Jd=e=>{switch(e){case"ready":case"completed":return"bg-green-100 text-green-800";case"building":case"testing":case"in-progress":return"bg-blue-100 text-blue-800";case"published":return"bg-purple-100 text-purple-800";case"failed":return"bg-red-100 text-red-800";case"scheduled":return"bg-yellow-100 text-yellow-800";default:return"bg-gray-100 text-gray-800"}},ey=e=>{switch(e){case"patch":return"bg-green-100 text-green-800";case"minor":return"bg-blue-100 text-blue-800";case"major":return"bg-red-100 text-red-800";case"prerelease":return"bg-yellow-100 text-yellow-800";default:return"bg-gray-100 text-gray-800"}},ty=(e,t)=>t==="all"?e:e.filter(n=>n.name===t);function ny({packages:e,selectedPackage:t,onPackageChange:n}){return r.jsxs("div",{className:"bg-white rounded-lg shadow border overflow-hidden",children:[r.jsx("div",{className:"px-6 py-4 border-b border-gray-200",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Package Release Status"}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("span",{className:"text-sm text-gray-500",children:"Filter by package:"}),r.jsxs("select",{value:t,onChange:s=>n(s.target.value),className:"px-3 py-1 border border-gray-300 rounded text-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[r.jsx("option",{value:"all",children:"All Packages"}),[...new Set(e.map(s=>s.name))].map(s=>r.jsx("option",{value:s,children:s},s))]})]})]})}),r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"min-w-full divide-y divide-gray-200",children:[r.jsx("thead",{className:"bg-gray-50",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Package"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Current Version"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Next Version"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Type"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Status"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Commits"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Last Published"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Actions"})]})}),r.jsx("tbody",{className:"bg-white divide-y divide-gray-200",children:e.map(s=>r.jsxs("tr",{className:"hover:bg-gray-50",children:[r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"h-8 w-8 rounded-lg bg-gray-100 flex items-center justify-center",children:r.jsx(Ri,{className:"w-4 h-4 text-gray-600"})}),r.jsxs("div",{className:"ml-3",children:[r.jsx("div",{className:"text-sm font-medium text-gray-900",children:s.name}),r.jsxs("div",{className:"text-sm text-gray-500",children:[Object.keys(s.dependencies).length," dependencies"]})]})]})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900",children:s.currentVersion}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900",children:s.nextVersion}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${ey(s.publishType)}`,children:s.publishType})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${Jd(s.status)}`,children:s.status})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900",children:s.commits}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsxs("div",{className:"flex items-center text-sm text-gray-900",children:[r.jsx(ct,{className:"w-4 h-4 mr-1 text-gray-400"}),s.lastPublished]})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:r.jsxs("div",{className:"flex space-x-2",children:[s.status==="ready"&&r.jsx("button",{className:"text-green-600 hover:text-green-900",children:"Publish"}),r.jsx("button",{className:"text-blue-600 hover:text-blue-900",children:"Details"}),r.jsx("button",{className:"text-purple-600 hover:text-purple-900",children:"Changelog"})]})})]},s.name))})]})})]})}function ry({releases:e,selectedStatus:t,onStatusChange:n}){const s=[{id:"1",packageName:"dashboard",version:"1.0.1",status:"scheduled",scheduledFor:"2024-01-16 10:00 AM",changelog:"Bug fixes and performance improvements",author:"team-frontend"},{id:"2",packageName:"backend",version:"1.3.0",status:"in-progress",scheduledFor:"2024-01-16 11:00 AM",startedAt:"2024-01-16 11:05 AM",changelog:"New API endpoints and enhanced security",author:"team-backend"}];return r.jsxs("div",{className:"bg-white rounded-lg shadow border overflow-hidden",children:[r.jsx("div",{className:"px-6 py-4 border-b border-gray-200",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Release Schedule"}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("span",{className:"text-sm text-gray-500",children:"Filter by status:"}),r.jsxs("select",{value:t,onChange:l=>n(l.target.value),className:"px-3 py-1 border border-gray-300 rounded text-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[r.jsx("option",{value:"all",children:"All Status"}),r.jsx("option",{value:"scheduled",children:"Scheduled"}),r.jsx("option",{value:"in-progress",children:"In Progress"}),r.jsx("option",{value:"completed",children:"Completed"}),r.jsx("option",{value:"failed",children:"Failed"})]})]})]})}),r.jsx("div",{className:"p-6",children:r.jsx("div",{className:"space-y-4",children:s.map(l=>r.jsxs("div",{className:"border rounded-lg p-4 hover:bg-gray-50",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx("div",{className:"h-8 w-8 rounded-lg bg-purple-100 flex items-center justify-center",children:r.jsx(Bd,{className:"w-4 h-4 text-purple-600"})}),r.jsxs("div",{children:[r.jsxs("div",{className:"text-sm font-medium text-gray-900",children:[l.packageName," v",l.version]}),r.jsxs("div",{className:"text-sm text-gray-500",children:["by ",l.author]})]})]}),r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${Jd(l.status)}`,children:l.status}),r.jsxs("div",{className:"text-sm text-gray-500 flex items-center",children:[r.jsx(ct,{className:"w-4 h-4 mr-1"}),l.scheduledFor]})]})]}),r.jsx("div",{className:"mt-3 text-sm text-gray-700",children:l.changelog})]},l.id))})})]})}function sy(){const e=[{id:"1",packageName:"dashboard",version:"1.0.0",date:"2024-01-15",changes:["Added new dashboard layout","Improved search functionality","Fixed responsive design issues"],author:"team-frontend",type:"feature"},{id:"2",packageName:"backend",version:"1.2.0",date:"2024-01-14",changes:["Added authentication middleware","Implemented rate limiting","Fixed database connection pool"],author:"team-backend",type:"feature"}],t=n=>{switch(n){case"feature":return"bg-green-100 text-green-800";case"bugfix":return"bg-blue-100 text-blue-800";case"breaking":return"bg-red-100 text-red-800";case"docs":return"bg-gray-100 text-gray-800";default:return"bg-gray-100 text-gray-800"}};return r.jsxs("div",{className:"bg-white rounded-lg shadow border overflow-hidden",children:[r.jsx("div",{className:"px-6 py-4 border-b border-gray-200",children:r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Recent Changelogs"})}),r.jsx("div",{className:"p-6",children:r.jsx("div",{className:"space-y-6",children:e.map(n=>r.jsxs("div",{className:"border-l-4 border-blue-500 pl-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx("div",{className:"h-8 w-8 rounded-lg bg-blue-100 flex items-center justify-center",children:r.jsx(Ri,{className:"w-4 h-4 text-blue-600"})}),r.jsxs("div",{children:[r.jsxs("div",{className:"text-sm font-medium text-gray-900",children:[n.packageName," v",n.version]}),r.jsxs("div",{className:"text-sm text-gray-500",children:[n.date," • by ",n.author]})]})]}),r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${t(n.type)}`,children:n.type})]}),r.jsx("div",{className:"space-y-1",children:n.changes.map((s,l)=>r.jsxs("div",{className:"flex items-start space-x-2",children:[r.jsx(Ei,{className:"w-4 h-4 text-gray-400 mt-0.5 flex-shrink-0"}),r.jsx("span",{className:"text-sm text-gray-700",children:s})]},l))})]},n.id))})})]})}function ly(){return r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600",children:"Loading package data..."})]})})}function ay({error:e,onRetry:t}){return r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsxs("div",{className:"text-center",children:[r.jsx(te,{className:"w-12 h-12 text-red-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-red-600",children:e}),r.jsx("button",{onClick:t,className:"mt-4 bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 transition-colors",children:"Retry"})]})})}const uc=[{name:"dashboard",currentVersion:"1.0.0",nextVersion:"1.0.1",status:"ready",lastPublished:"2024-01-10",changelog:"Bug fixes and performance improvements",commits:15,dependencies:["react","tailwindcss"],publishType:"patch"},{name:"backend",currentVersion:"1.2.0",nextVersion:"1.3.0",status:"building",lastPublished:"2024-01-08",changelog:"New API endpoints and enhanced security",commits:28,dependencies:["express","prisma"],publishType:"minor"},{name:"utils",currentVersion:"0.5.2",nextVersion:"1.0.0",status:"ready",lastPublished:"2024-01-05",changelog:"Major refactor with breaking changes",commits:42,dependencies:["lodash"],publishType:"major"},{name:"ci-status",currentVersion:"0.3.1",nextVersion:"0.4.0",status:"testing",lastPublished:"2024-01-12",changelog:"Enhanced CI monitoring and reporting",commits:18,dependencies:["axios","ws"],publishType:"minor"}],iy=[{id:"1",packageName:"dashboard",version:"1.0.1",status:"scheduled",scheduledFor:"2024-01-16 10:00 AM",changelog:"Bug fixes and performance improvements",author:"team-frontend"},{id:"2",packageName:"backend",version:"1.3.0",status:"in-progress",scheduledFor:"2024-01-16 09:00 AM",startedAt:"2024-01-16 09:00 AM",changelog:"New API endpoints and enhanced security",author:"team-backend"},{id:"3",packageName:"utils",version:"1.0.0",status:"completed",scheduledFor:"2024-01-15 02:00 PM",startedAt:"2024-01-15 02:00 PM",completedAt:"2024-01-15 02:15 PM",changelog:"Major refactor with breaking changes",author:"team-shared"}];function oy(){const[e,t]=d.useState("all"),[n,s]=d.useState("all"),[l,a]=d.useState(uc),[i,c]=d.useState(!1),[o,u]=d.useState(null);d.useEffect(()=>{(async()=>{try{c(!0);const f=(await Oe.getPackages()).map(w=>({name:w.name,currentVersion:w.version,nextVersion:p(w.version),status:m(w.status),lastPublished:w.lastUpdated,changelog:w.description||"No changelog available",commits:Math.floor(Math.random()*20)+1,dependencies:w.dependencies||[],publishType:g()}));a(f),u(null)}catch(h){u("Failed to fetch package data"),console.error("Error fetching packages:",h),a(uc)}finally{c(!1)}})()},[]);const p=x=>{const h=x.split(".").map(Number);return h[2]+=1,h.join(".")},m=x=>{switch(x){case"healthy":return"ready";case"warning":return"testing";case"error":return"failed";case"building":return"building";default:return"ready"}},g=()=>{const x=["patch","minor","major","prerelease"];return x[Math.floor(Math.random()*x.length)]},v=()=>{console.log("Creating new release...")},j=()=>{window.location.reload()},N=ty(l,e),b=qg(l);return i?r.jsx(ly,{}):o?r.jsx(ay,{error:o,onRetry:j}):r.jsxs("div",{className:"space-y-6",children:[r.jsx(Xg,{packageCount:l.length,onNewRelease:v}),r.jsx(Jg,{stats:b}),r.jsx(ny,{packages:N,selectedPackage:e,onPackageChange:t}),r.jsx(ry,{releases:iy,selectedStatus:n,onStatusChange:s}),r.jsx(sy,{})]})}function cy({message:e="Loading CI/CD data..."}){return r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600",children:e})]})})}function uy({error:e,onRetry:t}){return r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsxs("div",{className:"text-center",children:[r.jsx(te,{className:"w-12 h-12 text-red-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-red-600",children:e}),t&&r.jsx("button",{onClick:t,className:"mt-4 bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 transition-colors",children:"Retry"})]})})}function dy({onTriggerBuild:e,onCreatePipeline:t}){return r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-heading text-2xl",children:"CI/CD Integration"}),r.jsx("p",{className:"text-body mt-1",children:"Monitor and manage continuous integration and deployment pipelines"})]}),r.jsxs("div",{className:"flex space-x-2",children:[r.jsxs("button",{onClick:e,className:"btn-secondary flex items-center space-x-2",children:[r.jsx(Li,{className:"w-5 h-5"}),r.jsx("span",{children:"Trigger Build"})]}),r.jsxs("button",{onClick:t,className:"btn-primary flex items-center space-x-2",children:[r.jsx(kx,{className:"w-5 h-5"}),r.jsx("span",{children:"New Pipeline"})]})]})]})}const $s=e=>{switch(e){case"success":case"active":return"bg-green-100 text-green-800";case"running":return"bg-blue-100 text-blue-800";case"pending":return"bg-yellow-100 text-yellow-800";case"failed":case"cancelled":return"bg-red-100 text-red-800";case"paused":return"bg-gray-100 text-gray-800";case"skipped":return"bg-gray-100 text-gray-600";default:return"bg-gray-100 text-gray-800"}},my=e=>{switch(e){case"success":return"bg-green-100 text-green-800";case"running":return"bg-blue-100 text-blue-800";case"pending":return"bg-gray-100 text-gray-800";case"failed":return"bg-red-100 text-red-800";case"skipped":return"bg-gray-100 text-gray-600";default:return"bg-gray-100 text-gray-800"}},hy=e=>{const t=e.length,n=e.filter(o=>o.status==="success").length,s=e.filter(o=>o.status==="failed").length,l=e.filter(o=>o.status==="running").length,a=t>0?Math.round(n/t*100):0,i=e.filter(o=>o.duration),c=i.length>0?Math.round(i.reduce((o,u)=>o+(u.duration||0),0)/i.length):0;return{total:t,successful:n,failed:s,running:l,successRate:a,avgDuration:c}},fy=(e,t)=>e.filter(n=>{const s=t.package==="all"||n.packageName===t.package,l=t.status==="all"||n.status===t.status;return s&&l&&!0}),xy=e=>[...new Set(e.map(t=>t.packageName))],py=e=>[...new Set(e.map(t=>t.status))],yr=e=>{if(e<60)return`${e}s`;if(e<3600){const t=Math.floor(e/60),n=e%60;return n>0?`${t}m ${n}s`:`${t}m`}else{const t=Math.floor(e/3600),n=Math.floor(e%3600/60);return n>0?`${t}h ${n}m`:`${t}h`}},dc=e=>new Date(e).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),qd=e=>{const t=new Date(e),s=new Date().getTime()-t.getTime(),l=Math.floor(s/(1e3*60)),a=Math.floor(l/60),i=Math.floor(a/24);return l<1?"Just now":l<60?`${l} min ago`:a<24?`${a} hour${a>1?"s":""} ago`:`${i} day${i>1?"s":""} ago`},gy=e=>{if(e.status==="success"||e.status==="failed"||e.status==="cancelled")return 100;if(e.status==="pending")return 0;const t=e.stages.length;if(t===0)return 0;const n=e.stages.filter(a=>a.status==="success"||a.status==="failed"||a.status==="skipped").length,s=e.stages.filter(a=>a.status==="running").length,l=(n+s*.5)/t;return Math.round(l*100)},yy=e=>{const t=e.toLowerCase();return t.includes("build")||t.includes("compile")?"🔨":t.includes("test")?"🧪":t.includes("lint")||t.includes("format")?"✨":t.includes("deploy")||t.includes("publish")?"🚀":t.includes("security")||t.includes("audit")?"🔒":t.includes("install")||t.includes("dependencies")?"📦":"⚙️"},vy=e=>e.status==="failed"?"critical":e.status==="paused"?"warning":e.successRate<70?"critical":e.successRate<85?"warning":"healthy",em=e=>e.substring(0,8);function jy({stats:e,onRefresh:t,loading:n=!1}){return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h2",{className:"text-heading text-lg",children:"Build Statistics"}),r.jsxs("button",{onClick:t,disabled:n,className:"btn-ghost",children:[r.jsx(ot,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),"Refresh"]})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-5 gap-4",children:[r.jsx("div",{className:"card p-4",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-2 bg-primary-100 rounded-lg",children:r.jsx(Er,{className:"w-6 h-6 text-primary-600"})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-caption font-medium",children:"Total Builds"}),r.jsx("p",{className:"text-heading text-2xl",children:e.total})]})]})}),r.jsx("div",{className:"card p-4",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-2 bg-success-100 rounded-lg",children:r.jsx(Ke,{className:"w-6 h-6 text-success-600"})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-caption font-medium",children:"Successful"}),r.jsx("p",{className:"text-heading text-2xl text-success-600",children:e.successful})]})]})}),r.jsx("div",{className:"card p-4",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-2 bg-error-100 rounded-lg",children:r.jsx(Xe,{className:"w-6 h-6 text-error-600"})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-caption font-medium",children:"Failed"}),r.jsx("p",{className:"text-heading text-2xl text-error-600",children:e.failed})]})]})}),r.jsx("div",{className:"card p-4",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-2 bg-info-100 rounded-lg",children:r.jsx(ct,{className:"w-6 h-6 text-info-600"})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-caption font-medium",children:"Running"}),r.jsx("p",{className:"text-heading text-2xl text-info-600",children:e.running})]})]})}),r.jsxs("div",{className:"card p-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("p",{className:"text-caption font-medium",children:"Success Rate"}),r.jsxs("span",{className:`text-lg font-bold ${e.successRate>=90?"text-success-600":e.successRate>=70?"text-warning-600":"text-error-600"}`,children:[e.successRate,"%"]})]}),r.jsx("div",{className:"w-full bg-neutral-200 rounded-full h-2",children:r.jsx("div",{className:`h-2 rounded-full transition-all duration-300 ${e.successRate>=90?"bg-success-500":e.successRate>=70?"bg-warning-500":"bg-error-500"}`,style:{width:`${e.successRate}%`}})})]})]}),r.jsxs("div",{className:"card p-6",children:[r.jsx("h3",{className:"text-heading text-lg mb-4",children:"Performance Metrics"}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-heading text-2xl text-primary-600",children:yr(e.avgDuration)}),r.jsx("div",{className:"text-caption",children:"Avg Duration"})]}),r.jsxs("div",{className:"text-center",children:[r.jsxs("div",{className:"text-heading text-2xl text-success-600",children:[e.total>0?Math.round(e.successful/e.total*100):0,"%"]}),r.jsx("div",{className:"text-caption",children:"Success Rate"})]}),r.jsxs("div",{className:"text-center",children:[r.jsxs("div",{className:"text-heading text-2xl text-error-600",children:[e.total>0?Math.round(e.failed/e.total*100):0,"%"]}),r.jsx("div",{className:"text-caption",children:"Failure Rate"})]}),r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-heading text-2xl text-accent-600",children:e.running}),r.jsx("div",{className:"text-caption",children:"Active Builds"})]})]})]})]})}function wy({builds:e,selectedBuild:t,onBuildSelect:n,filters:s,onFiltersChange:l}){const a=xy(e),i=py(e),c=o=>{switch(o){case"success":return r.jsx(Ke,{className:"h-5 w-5 text-green-500"});case"running":return r.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-blue-500 border-t-transparent"});case"pending":return r.jsx(ct,{className:"h-5 w-5 text-yellow-500"});case"failed":return r.jsx(Xe,{className:"h-5 w-5 text-red-500"});case"cancelled":return r.jsx(Ca,{className:"h-5 w-5 text-red-500"});default:return r.jsx(ct,{className:"h-5 w-5 text-gray-500"})}};return r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"bg-white p-4 rounded-lg shadow border",children:r.jsxs("div",{className:"flex items-center space-x-4",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(el,{className:"h-4 w-4 text-gray-400"}),r.jsxs("select",{value:s.package,onChange:o=>l({...s,package:o.target.value}),className:"border border-gray-300 rounded-md px-3 py-2 text-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[r.jsx("option",{value:"all",children:"All Packages"}),a.map(o=>r.jsx("option",{value:o,children:o},o))]})]}),r.jsxs("select",{value:s.status,onChange:o=>l({...s,status:o.target.value}),className:"border border-gray-300 rounded-md px-3 py-2 text-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[r.jsx("option",{value:"all",children:"All Statuses"}),i.map(o=>r.jsx("option",{value:o,children:o.charAt(0).toUpperCase()+o.slice(1)},o))]}),r.jsxs("select",{value:s.dateRange,onChange:o=>l({...s,dateRange:o.target.value}),className:"border border-gray-300 rounded-md px-3 py-2 text-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[r.jsx("option",{value:"all",children:"All Time"}),r.jsx("option",{value:"today",children:"Today"}),r.jsx("option",{value:"week",children:"This Week"}),r.jsx("option",{value:"month",children:"This Month"})]})]})}),r.jsxs("div",{className:"bg-white rounded-lg shadow border",children:[r.jsxs("div",{className:"p-4 border-b border-gray-200",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Recent Builds"}),r.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:[e.length," build",e.length!==1?"s":""," found"]})]}),e.length===0?r.jsxs("div",{className:"p-8 text-center",children:[r.jsx("div",{className:"text-gray-400 text-4xl mb-2",children:"🔨"}),r.jsx("p",{className:"text-gray-500",children:"No builds found matching your filters"})]}):r.jsx("div",{className:"divide-y divide-gray-200",children:e.map(o=>{const u=gy(o),p=t===o.id;return r.jsxs("div",{className:`p-4 cursor-pointer transition-colors ${p?"bg-blue-50 border-l-4 border-blue-500":"hover:bg-gray-50"}`,onClick:()=>n(p?null:o.id),children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center space-x-4",children:[c(o.status),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900",children:o.packageName}),r.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-800",children:o.branch}),r.jsx("span",{className:"text-xs text-gray-500 font-mono",children:em(o.commit)})]}),r.jsxs("div",{className:"flex items-center space-x-2 mt-1",children:[r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${$s(o.status)}`,children:o.status}),r.jsxs("span",{className:"text-xs text-gray-500",children:["by ",o.triggeredBy]}),r.jsx("span",{className:"text-xs text-gray-500",children:qd(o.startTime)})]})]})]}),r.jsxs("div",{className:"text-right",children:[o.duration&&r.jsx("div",{className:"text-sm font-medium text-gray-900",children:yr(o.duration)}),o.status==="running"&&r.jsx("div",{className:"mt-1",children:r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("div",{className:"w-20 bg-gray-200 rounded-full h-2",children:r.jsx("div",{className:"bg-blue-500 h-2 rounded-full transition-all duration-300",style:{width:`${u}%`}})}),r.jsxs("span",{className:"text-xs text-gray-500",children:[u,"%"]})]})})]})]}),p&&o.stages.length>0&&r.jsx("div",{className:"mt-4 pt-4 border-t border-gray-100",children:r.jsx("div",{className:"flex items-center space-x-2",children:o.stages.map((m,g)=>r.jsx("div",{className:`flex items-center px-2 py-1 text-xs rounded ${$s(m.status)}`,title:`${m.name}: ${m.status}`,children:m.name},m.name))})})]},o.id)})})]})]})}function Ny({pipelines:e,onPipelineSelect:t,onPipelineToggle:n}){const s=a=>{switch(a){case"healthy":return r.jsx(Ke,{className:"w-5 h-5 text-green-500"});case"warning":return r.jsx(te,{className:"w-5 h-5 text-yellow-500"});case"critical":return r.jsx(Xe,{className:"w-5 h-5 text-red-500"});default:return r.jsx(Ms,{className:"w-5 h-5 text-gray-500"})}},l=a=>{switch(a){case"healthy":return"bg-green-100 text-green-800";case"warning":return"bg-yellow-100 text-yellow-800";case"critical":return"bg-red-100 text-red-800";default:return"bg-gray-100 text-gray-800"}};return e.length===0?r.jsx("div",{className:"bg-white rounded-lg shadow border p-6",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Ms,{className:"w-12 h-12 text-gray-400 mx-auto mb-4"}),r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"No Pipelines Configured"}),r.jsx("p",{className:"text-gray-600 mb-4",children:"Get started by creating your first CI/CD pipeline to automate builds and deployments."}),r.jsx("button",{className:"bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 transition-colors",children:"Create Pipeline"})]})}):r.jsxs("div",{className:"bg-white rounded-lg shadow border",children:[r.jsxs("div",{className:"p-4 border-b border-gray-200",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Pipeline Status"}),r.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:[e.length," pipeline",e.length!==1?"s":""," ","configured"]})]}),r.jsx("div",{className:"divide-y divide-gray-200",children:e.map(a=>{const i=vy(a);return r.jsxs("div",{className:"p-4 hover:bg-gray-50 transition-colors cursor-pointer",onClick:()=>t(a.id),children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center space-x-4",children:[s(i),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900",children:a.name}),r.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-800",children:a.packageName})]}),r.jsxs("div",{className:"flex items-center space-x-4 mt-1",children:[r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${$s(a.status)}`,children:a.status}),r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${l(i)}`,children:i})]})]})]}),r.jsx("div",{className:"flex items-center space-x-4",children:r.jsx("button",{onClick:c=>{c.stopPropagation(),n(a.id,a.status!=="active")},className:`p-2 rounded-lg transition-colors ${a.status==="active"?"text-green-600 hover:bg-green-100":"text-gray-400 hover:bg-gray-100"}`,title:a.status==="active"?"Pause Pipeline":"Activate Pipeline",children:a.status==="active"?r.jsx(dp,{className:"w-5 h-5"}):r.jsx(Li,{className:"w-5 h-5"})})})]}),r.jsxs("div",{className:"mt-3 grid grid-cols-4 gap-4 text-xs",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-gray-500",children:"Success Rate:"}),r.jsxs("div",{className:`font-medium ${a.successRate>=90?"text-green-600":a.successRate>=70?"text-yellow-600":"text-red-600"}`,children:[a.successRate,"%"]})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-gray-500",children:"Avg Duration:"}),r.jsx("div",{className:"font-medium text-gray-900",children:yr(a.avgDuration)})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-gray-500",children:"Last Run:"}),r.jsx("div",{className:"font-medium text-gray-900",children:qd(a.lastRun)})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-gray-500",children:"Triggers:"}),r.jsx("div",{className:"font-medium text-gray-900",children:a.triggers.length})]})]}),r.jsxs("div",{className:"mt-3",children:[r.jsxs("div",{className:"flex items-center justify-between text-xs mb-1",children:[r.jsx("span",{className:"text-gray-500",children:"Pipeline Health"}),r.jsxs("span",{className:"font-medium text-gray-900",children:[a.successRate,"%"]})]}),r.jsx("div",{className:"w-full bg-gray-200 rounded-full h-2",children:r.jsx("div",{className:`h-2 rounded-full transition-all duration-300 ${a.successRate>=90?"bg-green-500":a.successRate>=70?"bg-yellow-500":"bg-red-500"}`,style:{width:`${a.successRate}%`}})})]}),r.jsx("div",{className:"mt-3",children:r.jsxs("div",{className:"flex items-center space-x-1",children:[r.jsx("span",{className:"text-xs text-gray-500",children:"Triggers:"}),a.triggers.map(c=>r.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-blue-100 text-blue-800",children:c},c))]})})]},a.id)})})]})}function by({build:e,onClose:t,onCancel:n,onRetry:s}){if(!e)return null;const l=a=>{switch(a){case"success":return r.jsx(Ke,{className:"h-5 w-5 text-green-500"});case"running":return r.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-blue-500 border-t-transparent"});case"pending":return r.jsx(ct,{className:"h-5 w-5 text-yellow-500"});case"failed":return r.jsx(Xe,{className:"h-5 w-5 text-red-500"});case"cancelled":return r.jsx(Ca,{className:"h-5 w-5 text-red-500"});default:return r.jsx(ct,{className:"h-5 w-5 text-gray-500"})}};return r.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-white rounded-lg shadow-xl max-w-4xl w-full max-h-[90vh] overflow-hidden",children:[r.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200",children:[r.jsxs("div",{className:"flex items-center space-x-3",children:[l(e.status),r.jsxs("div",{children:[r.jsxs("h2",{className:"text-xl font-semibold text-gray-900",children:[e.packageName," Build"]}),r.jsxs("p",{className:"text-sm text-gray-600",children:[e.branch," • ",em(e.commit)]})]})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[e.status==="running"&&n&&r.jsxs("button",{onClick:()=>n(e.id),className:"inline-flex items-center px-3 py-2 text-sm font-medium text-red-700 bg-red-100 rounded-lg hover:bg-red-200 transition-colors",children:[r.jsx(Ca,{className:"w-4 h-4 mr-1"}),"Cancel"]}),(e.status==="failed"||e.status==="cancelled")&&s&&r.jsxs("button",{onClick:()=>s(e.id),className:"inline-flex items-center px-3 py-2 text-sm font-medium text-green-700 bg-green-100 rounded-lg hover:bg-green-200 transition-colors",children:[r.jsx(ot,{className:"w-4 h-4 mr-1"}),"Retry"]}),r.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-600 transition-colors",children:r.jsx(Pr,{className:"w-6 h-6"})})]})]}),r.jsxs("div",{className:"p-6 overflow-y-auto max-h-[70vh]",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 mb-6",children:[r.jsx("div",{className:"space-y-4",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-medium text-gray-700 mb-2",children:"Build Information"}),r.jsxs("div",{className:"space-y-2 text-sm",children:[r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-600",children:"Status:"}),r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${$s(e.status)}`,children:e.status})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-600",children:"Started:"}),r.jsx("span",{className:"font-medium",children:dc(e.startTime)})]}),e.endTime&&r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-600",children:"Ended:"}),r.jsx("span",{className:"font-medium",children:dc(e.endTime)})]}),e.duration&&r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-600",children:"Duration:"}),r.jsx("span",{className:"font-medium",children:yr(e.duration)})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-600",children:"Triggered by:"}),r.jsx("span",{className:"font-medium",children:e.triggeredBy})]})]})]})}),r.jsx("div",{className:"space-y-4",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-medium text-gray-700 mb-2",children:"Artifacts"}),e.artifacts.length>0?r.jsx("div",{className:"space-y-1",children:e.artifacts.map((a,i)=>r.jsx("div",{className:"text-sm",children:r.jsx("a",{href:"#",className:"text-blue-600 hover:text-blue-500 font-medium",children:a})},i))}):r.jsx("p",{className:"text-sm text-gray-500",children:"No artifacts generated"})]})})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:"Build Stages"}),r.jsx("div",{className:"space-y-4",children:e.stages.map((a,i)=>r.jsxs("div",{className:"border border-gray-200 rounded-lg p-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx("span",{className:"text-2xl",children:yy(a.name)}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900",children:a.name}),r.jsxs("div",{className:"flex items-center space-x-2 mt-1",children:[r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${my(a.status)}`,children:a.status}),a.duration&&r.jsx("span",{className:"text-xs text-gray-500",children:yr(a.duration)})]})]})]}),r.jsxs("div",{className:"text-sm text-gray-500",children:["Step ",i+1," of ",e.stages.length]})]}),a.logs&&a.logs.length>0&&r.jsxs("div",{className:"mt-3",children:[r.jsx("h5",{className:"text-xs font-medium text-gray-700 mb-2",children:"Logs"}),r.jsx("div",{className:"bg-gray-900 text-gray-100 p-3 rounded-lg text-xs font-mono max-h-32 overflow-y-auto",children:a.logs.map((c,o)=>r.jsx("div",{className:"mb-1",children:c},o))})]})]},a.name))})]})]})]})})}const ky=[{id:"1",name:"Dashboard CI",packageName:"dashboard",status:"active",lastRun:"2024-01-16T09:00:00Z",nextRun:"2024-01-16T10:00:00Z",successRate:95,avgDuration:420,triggers:["push","pull_request"]},{id:"2",name:"Backend CI",packageName:"backend",status:"active",lastRun:"2024-01-16T08:30:00Z",nextRun:"2024-01-16T09:30:00Z",successRate:88,avgDuration:900,triggers:["push","pull_request","tag"]},{id:"3",name:"Utils CI",packageName:"utils",status:"paused",lastRun:"2024-01-16T08:00:00Z",successRate:75,avgDuration:600,triggers:["push","pull_request"]}];function Sy(){const[e,t]=d.useState(!0),[n,s]=d.useState(null),[l,a]=d.useState([]),[i]=d.useState(ky),[c,o]=d.useState(null),[u,p]=d.useState({package:"all",status:"all",pipeline:"all",dateRange:"all"});d.useEffect(()=>{(async()=>{try{t(!0);const $=(await Oe.getBuildStatus()).map(R=>({id:R.id||Math.random().toString(36).substr(2,9),packageName:R.package||R.packageName||"unknown",branch:R.branch||"main",commit:R.commit||"unknown",status:R.status||"pending",startTime:R.startTime||new Date().toISOString(),endTime:R.endTime,duration:R.duration,stages:R.stages||[],triggeredBy:R.triggeredBy||"system",artifacts:R.artifacts||[]}));a($),s(null)}catch(C){s("Failed to fetch build data"),console.error("Error fetching build data:",C)}finally{t(!1)}})()},[]);const m=fy(l,u),g=hy(l),v=c&&l.find(y=>y.id===c)||null,j=()=>{window.location.reload()},N=()=>{console.log("Triggering new build...")},b=()=>{console.log("Creating new pipeline...")},x=y=>{o(y)},h=y=>{console.log("Selected pipeline:",y)},f=(y,C)=>{console.log("Toggle pipeline:",y,"active:",C)},w=y=>{console.log("Cancelling build:",y),o(null)},S=y=>{console.log("Retrying build:",y),o(null)},E=()=>{window.location.reload()};return e?r.jsx(cy,{}):n?r.jsx(uy,{error:n,onRetry:E}):r.jsxs("div",{className:"space-y-6",children:[r.jsx(dy,{onTriggerBuild:N,onCreatePipeline:b}),r.jsx(jy,{stats:g,onRefresh:j,loading:e}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[r.jsx("div",{className:"lg:col-span-2",children:r.jsx(wy,{builds:m,selectedBuild:c,onBuildSelect:x,filters:u,onFiltersChange:p})}),r.jsx("div",{className:"lg:col-span-1",children:r.jsx(Ny,{pipelines:i,onPipelineSelect:h,onPipelineToggle:f})})]}),r.jsx(by,{build:v,onClose:()=>o(null),onCancel:w,onRetry:S}),m.length===0&&l.length>0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx("div",{className:"text-gray-400 text-6xl mb-4",children:"🔨"}),r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"No builds found"}),r.jsx("p",{className:"text-gray-600 mb-4",children:"No builds match your current filters. Try adjusting your search criteria."}),r.jsx("button",{onClick:()=>p({package:"all",status:"all",pipeline:"all",dateRange:"all"}),className:"text-blue-600 hover:text-blue-500",children:"Clear Filters"})]}),l.length===0&&!e&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx("div",{className:"text-gray-400 text-6xl mb-4",children:"🚀"}),r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"No CI/CD data available"}),r.jsx("p",{className:"text-gray-600 mb-4",children:"Get started by triggering your first build or setting up a pipeline."}),r.jsxs("div",{className:"flex justify-center space-x-4",children:[r.jsx("button",{onClick:N,className:"bg-green-600 text-white px-4 py-2 rounded-lg hover:bg-green-700 transition-colors",children:"Trigger Build"}),r.jsx("button",{onClick:b,className:"bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 transition-colors",children:"Create Pipeline"})]})]})]})}function Cy({message:e="Loading configuration files..."}){return r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600",children:e})]})})}function Ey({error:e,onRetry:t}){return r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsxs("div",{className:"text-center",children:[r.jsx(te,{className:"w-12 h-12 text-red-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-red-600",children:e}),t&&r.jsx("button",{onClick:t,className:"mt-4 bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 transition-colors",children:"Retry"})]})})}function Py({onRefresh:e,loading:t=!1}){return r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Configuration Inspector"}),r.jsx("p",{className:"text-gray-600 mt-1",children:"View and manage configuration files across your monorepo"})]}),e&&r.jsxs("button",{onClick:e,disabled:t,className:"bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-2 transition-colors",children:[r.jsx(ot,{className:`w-5 h-5 ${t?"animate-spin":""}`}),r.jsx("span",{children:"Refresh"})]})]})}/*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */function tm(e){return typeof e>"u"||e===null}function Ly(e){return typeof e=="object"&&e!==null}function Ry(e){return Array.isArray(e)?e:tm(e)?[]:[e]}function Ty(e,t){var n,s,l,a;if(t)for(a=Object.keys(t),n=0,s=a.length;n<s;n+=1)l=a[n],e[l]=t[l];return e}function My(e,t){var n="",s;for(s=0;s<t;s+=1)n+=e;return n}function _y(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var Oy=tm,$y=Ly,Iy=Ry,Fy=My,Dy=_y,Ay=Ty,_i={isNothing:Oy,isObject:$y,toArray:Iy,repeat:Fy,isNegativeZero:Dy,extend:Ay};function nm(e,t){var n="",s=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(n+='in "'+e.mark.name+'" '),n+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(n+=`
67
+ */function Sa(){return Sa=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Sa.apply(this,arguments)}function R0(e,t){if(e==null)return{};var n={},s=Object.keys(e),l,a;for(a=0;a<s.length;a++)l=s[a],!(t.indexOf(l)>=0)&&(n[l]=e[l]);return n}function T0(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function M0(e,t){return e.button===0&&(!t||t==="_self")&&!T0(e)}const _0=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],O0="6";try{window.__reactRouterVersion=O0}catch{}const $0="startTransition",Jo=km[$0];function I0(e){let{basename:t,children:n,future:s,window:l}=e,a=d.useRef();a.current==null&&(a.current=Ff({window:l,v5Compat:!0}));let i=a.current,[c,o]=d.useState({action:i.action,location:i.location}),{v7_startTransition:u}=s||{},p=d.useCallback(m=>{u&&Jo?Jo(()=>o(m)):o(m)},[o,u]);return d.useLayoutEffect(()=>i.listen(p),[i,p]),d.useEffect(()=>E0(s),[s]),d.createElement(P0,{basename:t,children:n,location:c.location,navigationType:c.action,navigator:i,future:s})}const F0=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",D0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,rt=d.forwardRef(function(t,n){let{onClick:s,relative:l,reloadDocument:a,replace:i,state:c,target:o,to:u,preventScrollReset:p,viewTransition:m}=t,g=R0(t,_0),{basename:v}=d.useContext(Xt),j,N=!1;if(typeof u=="string"&&D0.test(u)&&(j=u,F0))try{let f=new URL(window.location.href),w=u.startsWith("//")?new URL(f.protocol+u):new URL(u),S=bi(w.pathname,v);w.origin===f.origin&&S!=null?u=S+w.search+w.hash:N=!0}catch{}let b=u0(u,{relative:l}),x=A0(u,{replace:i,state:c,target:o,preventScrollReset:p,relative:l,viewTransition:m});function h(f){s&&s(f),f.defaultPrevented||x(f)}return d.createElement("a",Sa({},g,{href:j||b,onClick:N||a?s:h,ref:n,target:o}))});var qo;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(qo||(qo={}));var ec;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(ec||(ec={}));function A0(e,t){let{target:n,replace:s,state:l,preventScrollReset:a,relative:i,viewTransition:c}=t===void 0?{}:t,o=d0(),u=Cr(),p=Id(e,{relative:i});return d.useCallback(m=>{if(M0(m,n)){m.preventDefault();let g=s!==void 0?s:Rs(u)===Rs(p);o(e,{replace:g,state:l,preventScrollReset:a,relative:i,viewTransition:c})}},[u,o,p,s,l,n,e,a,i,c])}const Ad=[{path:"/",name:"dashboard",component:"Dashboard",title:"Dashboard",description:"Main dashboard overview",exact:!0},{path:"/packages",name:"packages",component:"PackagesOverview",title:"Packages",description:"Package management and overview",exact:!0},{path:"/packages/:name",name:"package-detail",component:"PackageDetail",title:"Package Details",description:"Detailed view of a specific package"},{path:"/dependencies",name:"dependencies",component:"DependencyGraph",title:"Dependencies",description:"Dependency graph visualization"},{path:"/health",name:"health",component:"HealthStatus",title:"Health Status",description:"Monorepo health monitoring"},{path:"/config",name:"config",component:"ConfigInspector",title:"Configuration",description:"Configuration file inspector"}];Ad.filter(e=>!e.path.includes(":")&&e.path!=="/");function z0({isOpen:e,onClose:t,children:n}){return e?r.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:r.jsx("div",{className:"bg-white rounded-lg shadow-xl w-full max-w-4xl max-h-[90vh] overflow-hidden",onClick:s=>s.stopPropagation(),children:n})}):null}function B0({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 13.5 12 21m0 0-7.5-7.5M12 21V3"}))}const U0=d.forwardRef(B0),zd=U0;function H0({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18"}))}const V0=d.forwardRef(H0),W0=V0;function Q0({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99"}))}const Y0=d.forwardRef(Q0),ot=Y0;function Z0({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 4.5 21 12m0 0-7.5 7.5M21 12H3"}))}const G0=d.forwardRef(Z0),tc=G0;function K0({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 10.5 12 3m0 0 7.5 7.5M12 3v18"}))}const X0=d.forwardRef(K0),Si=X0;function J0({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.75 3.104v5.714a2.25 2.25 0 0 1-.659 1.591L5 14.5M9.75 3.104c-.251.023-.501.05-.75.082m.75-.082a24.301 24.301 0 0 1 4.5 0m0 0v5.714c0 .597.237 1.17.659 1.591L19.8 15.3M14.25 3.104c.251.023.501.05.75.082M19.8 15.3l-1.57.393A9.065 9.065 0 0 1 12 15a9.065 9.065 0 0 0-6.23-.693L5 14.5m14.8.8 1.402 1.402c1.232 1.232.65 3.318-1.067 3.611A48.309 48.309 0 0 1 12 21c-2.773 0-5.491-.235-8.135-.687-1.718-.293-2.3-2.379-1.067-3.61L5 14.5"}))}const q0=d.forwardRef(J0),ex=q0;function tx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5"}))}const nx=d.forwardRef(tx),Bd=nx;function rx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 13.125C3 12.504 3.504 12 4.125 12h2.25c.621 0 1.125.504 1.125 1.125v6.75C7.5 20.496 6.996 21 6.375 21h-2.25A1.125 1.125 0 0 1 3 19.875v-6.75ZM9.75 8.625c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125v11.25c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 0 1-1.125-1.125V8.625ZM16.5 4.125c0-.621.504-1.125 1.125-1.125h2.25C20.496 3 21 3.504 21 4.125v15.75c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 0 1-1.125-1.125V4.125Z"}))}const sx=d.forwardRef(rx),Er=sx;function lx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}const ax=d.forwardRef(lx),Ke=ax;function ix({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 12.75 6 6 9-13.5"}))}const ox=d.forwardRef(ix),Ci=ox;function cx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.35 3.836c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75 2.25 2.25 0 0 0-.1-.664m-5.8 0A2.251 2.251 0 0 1 13.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m8.9-4.414c.376.023.75.05 1.124.08 1.131.094 1.976 1.057 1.976 2.192V16.5A2.25 2.25 0 0 1 18 18.75h-2.25m-7.5-10.5H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V18.75m-7.5-10.5h6.375c.621 0 1.125.504 1.125 1.125v9.375m-8.25-3 1.5 1.5 3-3.75"}))}const ux=d.forwardRef(cx),nc=ux;function dx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.666 3.888A2.25 2.25 0 0 0 13.5 2.25h-3c-1.03 0-1.9.693-2.166 1.638m7.332 0c.055.194.084.4.084.612v0a.75.75 0 0 1-.75.75H9a.75.75 0 0 1-.75-.75v0c0-.212.03-.418.084-.612m7.332 0c.646.049 1.288.11 1.927.184 1.1.128 1.907 1.077 1.907 2.185V19.5a2.25 2.25 0 0 1-2.25 2.25H6.75A2.25 2.25 0 0 1 4.5 19.5V6.257c0-1.108.806-2.057 1.907-2.185a48.208 48.208 0 0 1 1.927-.184"}))}const mx=d.forwardRef(dx),rc=mx;function hx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}const fx=d.forwardRef(hx),ct=fx;function xx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 16.5V9.75m0 0 3 3m-3-3-3 3M6.75 19.5a4.5 4.5 0 0 1-1.41-8.775 5.25 5.25 0 0 1 10.233-2.33 3 3 0 0 1 3.758 3.848A3.752 3.752 0 0 1 18 19.5H6.75Z"}))}const px=d.forwardRef(xx),gx=px;function yx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 0 1 1.37.49l1.296 2.247a1.125 1.125 0 0 1-.26 1.431l-1.003.827c-.293.241-.438.613-.43.992a7.723 7.723 0 0 1 0 .255c-.008.378.137.75.43.991l1.004.827c.424.35.534.955.26 1.43l-1.298 2.247a1.125 1.125 0 0 1-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.47 6.47 0 0 1-.22.128c-.331.183-.581.495-.644.869l-.213 1.281c-.09.543-.56.94-1.11.94h-2.594c-.55 0-1.019-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 0 1-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 0 1-1.369-.49l-1.297-2.247a1.125 1.125 0 0 1 .26-1.431l1.004-.827c.292-.24.437-.613.43-.991a6.932 6.932 0 0 1 0-.255c.007-.38-.138-.751-.43-.992l-1.004-.827a1.125 1.125 0 0 1-.26-1.43l1.297-2.247a1.125 1.125 0 0 1 1.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.086.22-.128.332-.183.582-.495.644-.869l.214-1.28Z"}),d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))}const vx=d.forwardRef(yx),Ms=vx;function jx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12a7.5 7.5 0 0 0 15 0m-15 0a7.5 7.5 0 1 1 15 0m-15 0H3m16.5 0H21m-1.5 0H12m-8.457 3.077 1.41-.513m14.095-5.13 1.41-.513M5.106 17.785l1.15-.964m11.49-9.642 1.149-.964M7.501 19.795l.75-1.3m7.5-12.99.75-1.3m-6.063 16.658.26-1.477m2.605-14.772.26-1.477m0 17.726-.26-1.477M10.698 4.614l-.26-1.477M16.5 19.794l-.75-1.299M7.5 4.205 12 12m6.894 5.785-1.149-.964M6.256 7.178l-1.15-.964m15.352 8.864-1.41-.513M4.954 9.435l-1.41-.514M12.002 12l-3.75 6.495"}))}const wx=d.forwardRef(jx),Ud=wx;function Nx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 3v1.5M4.5 8.25H3m18 0h-1.5M4.5 12H3m18 0h-1.5m-15 3.75H3m18 0h-1.5M8.25 19.5V21M12 3v1.5m0 15V21m3.75-18v1.5m0 15V21m-9-1.5h10.5a2.25 2.25 0 0 0 2.25-2.25V6.75a2.25 2.25 0 0 0-2.25-2.25H6.75A2.25 2.25 0 0 0 4.5 6.75v10.5a2.25 2.25 0 0 0 2.25 2.25Zm.75-12h9v9h-9v-9Z"}))}const bx=d.forwardRef(Nx),kx=bx;function Sx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 7.5-9-5.25L3 7.5m18 0-9 5.25m9-5.25v9l-9 5.25M3 7.5l9 5.25M3 7.5v9l9 5.25m0-9v9"}))}const Cx=d.forwardRef(Sx),qs=Cx;function Ex({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.125 2.25h-4.5c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125v-9M10.125 2.25h.375a9 9 0 0 1 9 9v.375M10.125 2.25A3.375 3.375 0 0 1 13.5 5.625v1.5c0 .621.504 1.125 1.125 1.125h1.5a3.375 3.375 0 0 1 3.375 3.375M9 15l2.25 2.25L15 12"}))}const Px=d.forwardRef(Ex),Lx=Px;function Rx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 0 1-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 0 1 1.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 0 0-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 0 1-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 0 0-3.375-3.375h-1.5a1.125 1.125 0 0 1-1.125-1.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H9.75"}))}const Tx=d.forwardRef(Rx),Mx=Tx;function _x({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z"}))}const Ox=d.forwardRef(_x),Ei=Ox;function $x({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"}))}const Ix=d.forwardRef($x),te=Ix;function Fx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.98 8.223A10.477 10.477 0 0 0 1.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.451 10.451 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.522 10.522 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88"}))}const Dx=d.forwardRef(Fx),Ax=Dx;function zx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z"}),d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))}const Bx=d.forwardRef(zx),Ux=Bx;function Hx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 0 1-.659 1.591l-5.432 5.432a2.25 2.25 0 0 0-.659 1.591v2.927a2.25 2.25 0 0 1-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 0 0-.659-1.591L3.659 7.409A2.25 2.25 0 0 1 3 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0 1 12 3Z"}))}const Vx=d.forwardRef(Hx),el=Vx;function Wx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 8.25c0-2.485-2.099-4.5-4.688-4.5-1.935 0-3.597 1.126-4.312 2.733-.715-1.607-2.377-2.733-4.313-2.733C5.1 3.75 3 5.765 3 8.25c0 7.22 9 12 9 12s9-4.78 9-12Z"}))}const Qx=d.forwardRef(Wx),Hd=Qx;function Yx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m2.25 12 8.954-8.955c.44-.439 1.152-.439 1.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25"}))}const Zx=d.forwardRef(Yx),Gx=Zx;function Kx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"}))}const Xx=d.forwardRef(Kx),vn=Xx;function Jx({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 6.75h12M8.25 12h12m-12 5.25h12M3.75 6.75h.007v.008H3.75V6.75Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0ZM3.75 12h.007v.008H3.75V12Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm-.375 5.25h.007v.008H3.75v-.008Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z"}))}const qx=d.forwardRef(Jx),ep=qx;function tp({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607ZM13.5 10.5h-6"}))}const np=d.forwardRef(tp),rp=np;function sp({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607ZM10.5 7.5v6m3-3h-6"}))}const lp=d.forwardRef(sp),ap=lp;function ip({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"}))}const op=d.forwardRef(ip),Pi=op;function cp({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25v13.5m-7.5-13.5v13.5"}))}const up=d.forwardRef(cp),dp=up;function mp({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L6.832 19.82a4.5 4.5 0 0 1-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 0 1 1.13-1.897L16.863 4.487Zm0 0L19.5 7.125"}))}const hp=d.forwardRef(mp),fp=hp;function xp({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.347a1.125 1.125 0 0 1 0 1.972l-11.54 6.347a1.125 1.125 0 0 1-1.667-.986V5.653Z"}))}const pp=d.forwardRef(xp),Li=pp;function gp({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6A2.25 2.25 0 0 1 6 3.75h2.25A2.25 2.25 0 0 1 10.5 6v2.25a2.25 2.25 0 0 1-2.25 2.25H6a2.25 2.25 0 0 1-2.25-2.25V6ZM3.75 15.75A2.25 2.25 0 0 1 6 13.5h2.25a2.25 2.25 0 0 1 2.25 2.25V18a2.25 2.25 0 0 1-2.25 2.25H6A2.25 2.25 0 0 1 3.75 18v-2.25ZM13.5 6a2.25 2.25 0 0 1 2.25-2.25H18A2.25 2.25 0 0 1 20.25 6v2.25A2.25 2.25 0 0 1 18 10.5h-2.25a2.25 2.25 0 0 1-2.25-2.25V6ZM13.5 15.75a2.25 2.25 0 0 1 2.25-2.25H18a2.25 2.25 0 0 1 2.25 2.25V18A2.25 2.25 0 0 1 18 20.25h-2.25A2.25 2.25 0 0 1 13.5 18v-2.25Z"}))}const yp=d.forwardRef(gp),vp=yp;function jp({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 0 1 7.5 5.25h9a2.25 2.25 0 0 1 2.25 2.25v9a2.25 2.25 0 0 1-2.25 2.25h-9a2.25 2.25 0 0 1-2.25-2.25v-9Z"}))}const wp=d.forwardRef(jp),Ca=wp;function Np({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.568 3H5.25A2.25 2.25 0 0 0 3 5.25v4.318c0 .597.237 1.17.659 1.591l9.581 9.581c.699.699 1.78.872 2.607.33a18.095 18.095 0 0 0 5.223-5.223c.542-.827.369-1.908-.33-2.607L11.16 3.66A2.25 2.25 0 0 0 9.568 3Z"}),d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 6h.008v.008H6V6Z"}))}const bp=d.forwardRef(Np),Ri=bp;function kp({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 6a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0ZM4.501 20.118a7.5 7.5 0 0 1 14.998 0A17.933 17.933 0 0 1 12 21.75c-2.676 0-5.216-.584-7.499-1.632Z"}))}const Sp=d.forwardRef(kp),Cp=Sp;function Ep({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}const Pp=d.forwardRef(Ep),Xe=Pp;function Lp({title:e,titleId:t,...n},s){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18 18 6M6 6l12 12"}))}const Rp=d.forwardRef(Lp),Pr=Rp;function Tp({onSave:e,onClose:t}){return r.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200",children:[r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx(Ud,{className:"w-6 h-6 text-gray-600"}),r.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:"Dashboard Configuration"})]}),r.jsxs("div",{className:"flex space-x-3",children:[r.jsxs("button",{onClick:e,className:"bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 flex items-center space-x-2",children:[r.jsx(Ci,{className:"w-5 h-5"}),r.jsx("span",{children:"Save"})]}),r.jsxs("button",{onClick:t,className:"bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 flex items-center space-x-2",children:[r.jsx(Pr,{className:"w-5 h-5"}),r.jsx("span",{children:"Cancel"})]})]})]})}const Mp=()=>[{id:"general",label:"General",icon:"⚙️"},{id:"features",label:"Features",icon:"🚀"},{id:"branding",label:"Branding",icon:"🎨"},{id:"monorepo",label:"Monorepo",icon:"📦"}],_p=()=>({title:"monodog Dashboard",description:"Visual management of our monorepo packages",packageTypes:["app","lib","tool","service"],customFields:["team","priority","environment"],features:{healthChecks:!0,ciIntegration:!0,dependencyGraph:!0,publishControl:!0,searchAndFilter:!0,configurationInspector:!0},branding:{logo:"",primaryColor:"#3B82F6",secondaryColor:"#1E40AF"},monorepo:{structure:"standard",packageManager:"pnpm",directories:["apps","packages","libs"],ignorePatterns:["node_modules","dist",".git"]}}),sc=e=>{const t=_p();return{...t,...e,features:{...t.features,...e.features},branding:{...t.branding,...e.branding},monorepo:{...t.monorepo,...e.monorepo}}},Op=e=>{var n,s,l;const t=[];return(!e.title||e.title.trim()==="")&&t.push("Dashboard title is required"),(n=e.monorepo)!=null&&n.directories&&e.monorepo.directories.length===0&&t.push("At least one package directory is required"),(s=e.branding)!=null&&s.primaryColor&&!lc(e.branding.primaryColor)&&t.push("Primary color must be a valid hex color"),(l=e.branding)!=null&&l.secondaryColor&&!lc(e.branding.secondaryColor)&&t.push("Secondary color must be a valid hex color"),{isValid:t.length===0,errors:t}},lc=e=>/^#[0-9A-F]{6}$/i.test(e),_s=e=>e.split(",").map(t=>t.trim()).filter(t=>t.length>0),Os=e=>e?e.join(", "):"",$p=e=>e.replace(/([A-Z])/g," $1").trim();function Ip({activeTab:e,onTabChange:t}){const n=Mp();return r.jsx("div",{className:"border-b border-gray-200",children:r.jsx("nav",{className:"flex space-x-8 px-6",children:n.map(s=>r.jsxs("button",{onClick:()=>t(s.id),className:`py-4 px-1 border-b-2 font-medium text-sm flex items-center space-x-2 ${e===s.id?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:[r.jsx("span",{children:s.icon}),r.jsx("span",{children:s.label})]},s.id))})})}function ac({config:e,onConfigChange:t}){return r.jsx("div",{className:"space-y-6",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:"General Settings"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Dashboard Title"}),r.jsx("input",{type:"text",value:e.title||"",onChange:n=>t({title:n.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"My Monorepo Dashboard"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Description"}),r.jsx("input",{type:"text",value:e.description||"",onChange:n=>t({description:n.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Visual management of our monorepo packages"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Package Types"}),r.jsx("input",{type:"text",value:Os(e.packageTypes),onChange:n=>t({packageTypes:_s(n.target.value)}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"app, lib, tool, service"}),r.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Comma-separated list of package types"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Custom Fields"}),r.jsx("input",{type:"text",value:Os(e.customFields),onChange:n=>t({customFields:_s(n.target.value)}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"team, priority, environment"}),r.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Additional fields to display for packages"})]})]})]})})}function Fp({config:e,onConfigChange:t}){const n=(s,l)=>{t({features:{...e.features,[s]:l}})};return r.jsx("div",{className:"space-y-6",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:"Feature Toggles"}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:Object.entries(e.features||{}).map(([s,l])=>r.jsxs("label",{className:"flex items-center space-x-3",children:[r.jsx("input",{type:"checkbox",checked:l,onChange:a=>n(s,a.target.checked),className:"h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded"}),r.jsx("span",{className:"text-sm font-medium text-gray-700 capitalize",children:$p(s)})]},s))}),r.jsxs("div",{className:"mt-6 p-4 bg-blue-50 border border-blue-200 rounded-lg",children:[r.jsx("h4",{className:"text-sm font-medium text-blue-900 mb-2",children:"Feature Descriptions"}),r.jsxs("div",{className:"text-xs text-blue-800 space-y-1",children:[r.jsxs("div",{children:[r.jsx("strong",{children:"Health Checks:"})," Monitor package health and status"]}),r.jsxs("div",{children:[r.jsx("strong",{children:"CI Integration:"})," Connect with CI/CD providers"]}),r.jsxs("div",{children:[r.jsx("strong",{children:"Dependency Graph:"})," Visualize package dependencies"]}),r.jsxs("div",{children:[r.jsx("strong",{children:"Publish Control:"})," Manage package publishing and versioning"]}),r.jsxs("div",{children:[r.jsx("strong",{children:"Search And Filter:"})," Advanced search and filtering capabilities"]}),r.jsxs("div",{children:[r.jsx("strong",{children:"Configuration Inspector:"})," View and edit configuration files"]})]})]})]})})}function Dp({config:e,onConfigChange:t}){var s,l,a,i,c,o,u,p;const n=(m,g)=>{t({branding:{...e.branding,[m]:g}})};return r.jsx("div",{className:"space-y-6",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:"Branding & Appearance"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Logo URL"}),r.jsx("input",{type:"text",value:((s=e.branding)==null?void 0:s.logo)||"",onChange:m=>n("logo",m.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"https://example.com/logo.png"}),r.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"URL to your company logo"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Primary Color"}),r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx("input",{type:"color",value:((l=e.branding)==null?void 0:l.primaryColor)||"#3B82F6",onChange:m=>n("primaryColor",m.target.value),className:"h-10 w-20 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"}),r.jsx("input",{type:"text",value:((a=e.branding)==null?void 0:a.primaryColor)||"#3B82F6",onChange:m=>n("primaryColor",m.target.value),className:"flex-1 px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"#3B82F6"})]}),r.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Primary brand color for buttons and accents"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Secondary Color"}),r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx("input",{type:"color",value:((i=e.branding)==null?void 0:i.secondaryColor)||"#1E40AF",onChange:m=>n("secondaryColor",m.target.value),className:"h-10 w-20 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"}),r.jsx("input",{type:"text",value:((c=e.branding)==null?void 0:c.secondaryColor)||"#1E40AF",onChange:m=>n("secondaryColor",m.target.value),className:"flex-1 px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"#1E40AF"})]}),r.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Secondary color for hover states and highlights"})]})]}),r.jsxs("div",{className:"mt-6 p-4 bg-gray-50 border border-gray-200 rounded-lg",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 mb-3",children:"Color Preview"}),r.jsxs("div",{className:"flex items-center space-x-4",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("div",{className:"w-8 h-8 rounded-lg border border-gray-300",style:{backgroundColor:((o=e.branding)==null?void 0:o.primaryColor)||"#3B82F6"}}),r.jsx("span",{className:"text-sm text-gray-600",children:"Primary"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("div",{className:"w-8 h-8 rounded-lg border border-gray-300",style:{backgroundColor:((u=e.branding)==null?void 0:u.secondaryColor)||"#1E40AF"}}),r.jsx("span",{className:"text-sm text-gray-600",children:"Secondary"})]}),r.jsx("button",{className:"px-4 py-2 rounded-lg text-white text-sm font-medium",style:{backgroundColor:((p=e.branding)==null?void 0:p.primaryColor)||"#3B82F6"},children:"Sample Button"})]})]})]})})}function Ap({config:e,onConfigChange:t}){var s,l,a,i,c,o,u,p,m,g,v;const n=(j,N)=>{t({monorepo:{...e.monorepo,[j]:N}})};return r.jsx("div",{className:"space-y-6",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:"Monorepo Configuration"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Structure Type"}),r.jsxs("select",{value:((s=e.monorepo)==null?void 0:s.structure)||"standard",onChange:j=>n("structure",j.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[r.jsx("option",{value:"standard",children:"Standard (apps/packages/libs)"}),r.jsx("option",{value:"custom",children:"Custom Structure"})]}),r.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Choose your monorepo directory structure"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Package Manager"}),r.jsxs("select",{value:((l=e.monorepo)==null?void 0:l.packageManager)||"pnpm",onChange:j=>n("packageManager",j.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[r.jsx("option",{value:"pnpm",children:"pnpm"}),r.jsx("option",{value:"npm",children:"npm"}),r.jsx("option",{value:"yarn",children:"Yarn"}),r.jsx("option",{value:"lerna",children:"Lerna"}),r.jsx("option",{value:"nx",children:"Nx"})]}),r.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Package manager used in your monorepo"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Package Directories"}),r.jsx("input",{type:"text",value:Os((a=e.monorepo)==null?void 0:a.directories),onChange:j=>n("directories",_s(j.target.value)),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"apps, packages, libs, services"}),r.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Directories containing packages"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Ignore Patterns"}),r.jsx("input",{type:"text",value:Os((i=e.monorepo)==null?void 0:i.ignorePatterns),onChange:j=>n("ignorePatterns",_s(j.target.value)),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"node_modules, dist, .git"}),r.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Patterns to ignore when scanning"})]})]}),r.jsxs("div",{className:"mt-6 p-4 bg-gray-50 border border-gray-200 rounded-lg",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 mb-3",children:"Configuration Preview"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 text-sm",children:[r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-gray-700",children:"Structure:"}),r.jsx("span",{className:"ml-2 text-gray-600 capitalize",children:((c=e.monorepo)==null?void 0:c.structure)||"standard"})]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-gray-700",children:"Package Manager:"}),r.jsx("span",{className:"ml-2 text-gray-600",children:((o=e.monorepo)==null?void 0:o.packageManager)||"pnpm"})]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-gray-700",children:"Directories:"}),r.jsxs("span",{className:"ml-2 text-gray-600",children:[((p=(u=e.monorepo)==null?void 0:u.directories)==null?void 0:p.length)||0," configured"]})]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-gray-700",children:"Ignore Patterns:"}),r.jsxs("span",{className:"ml-2 text-gray-600",children:[((g=(m=e.monorepo)==null?void 0:m.ignorePatterns)==null?void 0:g.length)||0," patterns"]})]})]})]}),((v=e.monorepo)==null?void 0:v.packageManager)&&r.jsxs("div",{className:"mt-4 p-4 bg-blue-50 border border-blue-200 rounded-lg",children:[r.jsxs("h4",{className:"text-sm font-medium text-blue-900 mb-2",children:[e.monorepo.packageManager.toUpperCase()," Configuration Tips"]}),r.jsxs("div",{className:"text-xs text-blue-800",children:[e.monorepo.packageManager==="pnpm"&&r.jsx("p",{children:"Make sure you have a pnpm-workspace.yaml file in your root directory."}),e.monorepo.packageManager==="npm"&&r.jsx("p",{children:'Configure workspaces in your package.json with the "workspaces" field.'}),e.monorepo.packageManager==="yarn"&&r.jsx("p",{children:"Ensure you have workspaces configured in your package.json."}),e.monorepo.packageManager==="lerna"&&r.jsx("p",{children:"Make sure you have a lerna.json configuration file in your root."}),e.monorepo.packageManager==="nx"&&r.jsx("p",{children:"Ensure you have an nx.json configuration file in your workspace root."})]})]})]})})}function zp({isOpen:e,onClose:t,onSave:n,currentConfig:s}){const[l,a]=d.useState(sc(s)),[i,c]=d.useState("general");d.useEffect(()=>{a(sc(s))},[s]);const o=()=>{const m=Op(l);m.isValid||console.warn("Configuration validation errors:",m.errors),n(l),t()},u=m=>{a(g=>({...g,...m}))},p=()=>{const m={config:l,onConfigChange:u};switch(i){case"general":return r.jsx(ac,{...m});case"features":return r.jsx(Fp,{...m});case"branding":return r.jsx(Dp,{...m});case"monorepo":return r.jsx(Ap,{...m});default:return r.jsx(ac,{...m})}};return r.jsxs(z0,{isOpen:e,onClose:t,children:[r.jsx(Tp,{onSave:o,onClose:t}),r.jsx(Ip,{activeTab:i,onTabChange:c}),r.jsx("div",{className:"p-6 overflow-y-auto max-h-[60vh]",children:p()})]})}function Bp({isOpen:e,onClose:t,children:n}){return e?r.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50",children:r.jsx("div",{className:"bg-white rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] overflow-hidden",onClick:s=>s.stopPropagation(),children:n})}):null}function Up({onClose:e}){return r.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:"Setup Guide"}),r.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"Configure your monorepo dashboard for optimal performance"})]}),r.jsx("button",{onClick:e,className:"text-gray-400 hover:text-gray-600 transition-colors",children:r.jsx(Pr,{className:"w-6 h-6"})})]})}function Hp({progress:e}){const{currentStep:t,totalSteps:n,completedSteps:s}=e,l=(t+1)/n*100;return r.jsxs("div",{className:"px-6 py-4 border-b border-gray-200",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("span",{className:"text-sm font-medium text-gray-700",children:["Step ",t+1," of ",n]}),r.jsxs("span",{className:"text-sm text-gray-500",children:[s," completed"]})]}),r.jsx("div",{className:"w-full bg-gray-200 rounded-full h-2",children:r.jsx("div",{className:"bg-blue-600 h-2 rounded-full transition-all duration-300",style:{width:`${l}%`}})})]})}function Vp({step:e,onStepComplete:t}){const n=()=>{switch(e.id){case"monorepo-structure":return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:[r.jsx("h4",{className:"font-medium text-blue-900 mb-2",children:"Quick Setup"}),r.jsx("p",{className:"text-blue-800 text-sm mb-3",children:"Choose your monorepo structure to get started quickly:"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[r.jsxs("button",{onClick:()=>t(e.id),className:"p-3 border border-blue-300 rounded-lg hover:bg-blue-100 text-left",children:[r.jsx("div",{className:"font-medium text-blue-900",children:"Standard Structure"}),r.jsx("div",{className:"text-sm text-blue-700",children:"apps/, packages/, libs/"})]}),r.jsxs("button",{onClick:()=>t(e.id),className:"p-3 border border-blue-300 rounded-lg hover:bg-blue-100 text-left",children:[r.jsx("div",{className:"font-medium text-blue-900",children:"Custom Structure"}),r.jsx("div",{className:"text-sm text-blue-700",children:"Define your own directories"})]})]})]}),r.jsxs("div",{className:"bg-gray-50 border border-gray-200 rounded-lg p-4",children:[r.jsx("h4",{className:"font-medium text-gray-900 mb-2",children:"Manual Configuration"}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Root Directory"}),r.jsx("input",{type:"text",defaultValue:"/path/to/monorepo",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Package Manager"}),r.jsxs("select",{className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm",children:[r.jsx("option",{value:"pnpm",children:"pnpm"}),r.jsx("option",{value:"npm",children:"npm"}),r.jsx("option",{value:"yarn",children:"yarn"})]})]})]})]})]});case"package-scanning":return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"bg-green-50 border border-green-200 rounded-lg p-4",children:[r.jsx("h4",{className:"font-medium text-green-900 mb-2",children:"Automatic Discovery"}),r.jsx("p",{className:"text-green-800 text-sm mb-3",children:"We'll scan your monorepo for packages automatically:"}),r.jsx("button",{onClick:()=>t(e.id),className:"bg-green-600 text-white px-4 py-2 rounded-lg hover:bg-green-700 text-sm",children:"Start Package Scan"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center text-sm text-gray-600",children:[r.jsx(vn,{className:"w-4 h-4 mr-2"}),"Scans for package.json files"]}),r.jsxs("div",{className:"flex items-center text-sm text-gray-600",children:[r.jsx(vn,{className:"w-4 h-4 mr-2"}),"Analyzes dependencies and relationships"]}),r.jsxs("div",{className:"flex items-center text-sm text-gray-600",children:[r.jsx(vn,{className:"w-4 h-4 mr-2"}),"Detects build configurations"]})]})]});case"ci-integration":return r.jsx("div",{className:"space-y-4",children:r.jsxs("div",{className:"bg-purple-50 border border-purple-200 rounded-lg p-4",children:[r.jsx("h4",{className:"font-medium text-purple-900 mb-2",children:"Connect CI/CD"}),r.jsx("p",{className:"text-purple-800 text-sm mb-3",children:"Choose your CI/CD provider to monitor builds and deployments:"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[r.jsxs("button",{onClick:()=>t(e.id),className:"p-3 border border-purple-300 rounded-lg hover:bg-purple-100 text-left",children:[r.jsx("div",{className:"font-medium text-purple-900",children:"GitHub Actions"}),r.jsx("div",{className:"text-sm text-purple-700",children:"Connect with GitHub"})]}),r.jsxs("button",{onClick:()=>t(e.id),className:"p-3 border border-purple-300 rounded-lg hover:bg-purple-100 text-left",children:[r.jsx("div",{className:"font-medium text-purple-900",children:"GitLab CI"}),r.jsx("div",{className:"text-sm text-purple-700",children:"Connect with GitLab"})]}),r.jsxs("button",{onClick:()=>t(e.id),className:"p-3 border border-purple-300 rounded-lg hover:bg-purple-100 text-left",children:[r.jsx("div",{className:"font-medium text-purple-900",children:"Jenkins"}),r.jsx("div",{className:"text-sm text-purple-700",children:"Connect with Jenkins"})]}),r.jsxs("button",{onClick:()=>t(e.id),className:"p-3 border border-purple-300 rounded-lg hover:bg-purple-100 text-left",children:[r.jsx("div",{className:"font-medium text-purple-900",children:"Skip for now"}),r.jsx("div",{className:"text-sm text-purple-700",children:"Configure later"})]})]})]})});case"health-checks":return r.jsx("div",{className:"space-y-4",children:r.jsxs("div",{className:"bg-orange-50 border border-orange-200 rounded-lg p-4",children:[r.jsx("h4",{className:"font-medium text-orange-900 mb-2",children:"Health Monitoring"}),r.jsx("p",{className:"text-orange-800 text-sm mb-3",children:"Configure how we monitor your package health:"}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("label",{className:"flex items-center",children:[r.jsx("input",{type:"checkbox",className:"mr-2",defaultChecked:!0}),r.jsx("span",{className:"text-sm text-orange-900",children:"Monitor build status"})]}),r.jsxs("label",{className:"flex items-center",children:[r.jsx("input",{type:"checkbox",className:"mr-2",defaultChecked:!0}),r.jsx("span",{className:"text-sm text-orange-900",children:"Track test coverage"})]}),r.jsxs("label",{className:"flex items-center",children:[r.jsx("input",{type:"checkbox",className:"mr-2"}),r.jsx("span",{className:"text-sm text-orange-900",children:"Dependency vulnerability scanning"})]}),r.jsxs("label",{className:"flex items-center",children:[r.jsx("input",{type:"checkbox",className:"mr-2"}),r.jsx("span",{className:"text-sm text-orange-900",children:"Performance monitoring"})]})]}),r.jsx("button",{onClick:()=>t(e.id),className:"mt-3 bg-orange-600 text-white px-4 py-2 rounded-lg hover:bg-orange-700 text-sm",children:"Save Settings"})]})});case"notifications":return r.jsx("div",{className:"space-y-4",children:r.jsxs("div",{className:"bg-indigo-50 border border-indigo-200 rounded-lg p-4",children:[r.jsx("h4",{className:"font-medium text-indigo-900 mb-2",children:"Notification Preferences"}),r.jsx("p",{className:"text-indigo-800 text-sm mb-3",children:"Choose how you want to be notified about important events:"}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("label",{className:"flex items-center",children:[r.jsx("input",{type:"checkbox",className:"mr-2",defaultChecked:!0}),r.jsx("span",{className:"text-sm text-indigo-900",children:"Build failures"})]}),r.jsxs("label",{className:"flex items-center",children:[r.jsx("input",{type:"checkbox",className:"mr-2"}),r.jsx("span",{className:"text-sm text-indigo-900",children:"Security vulnerabilities"})]}),r.jsxs("label",{className:"flex items-center",children:[r.jsx("input",{type:"checkbox",className:"mr-2"}),r.jsx("span",{className:"text-sm text-indigo-900",children:"Dependency updates"})]}),r.jsxs("label",{className:"flex items-center",children:[r.jsx("input",{type:"checkbox",className:"mr-2"}),r.jsx("span",{className:"text-sm text-indigo-900",children:"Performance degradation"})]})]}),r.jsx("button",{onClick:()=>t(e.id),className:"mt-3 bg-indigo-600 text-white px-4 py-2 rounded-lg hover:bg-indigo-700 text-sm",children:"Save Preferences"})]})});default:return r.jsx("div",{className:"text-center py-8",children:r.jsx("p",{className:"text-gray-500",children:"Step content not found"})})}};return r.jsxs("div",{className:"p-6 overflow-y-auto max-h-[50vh]",children:[r.jsxs("div",{className:"mb-6",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:e.title}),r.jsx("p",{className:"text-gray-600 mb-4",children:e.description})]}),n()]})}function Wp({currentStep:e,totalSteps:t,canGoNext:n,canGoPrevious:s,onNext:l,onPrevious:a,onComplete:i,isLastStep:c}){return r.jsxs("div",{className:"flex items-center justify-between p-6 border-t border-gray-200",children:[r.jsx("button",{onClick:a,disabled:!s,className:`px-4 py-2 text-sm rounded-lg border transition-colors ${s?"border-gray-300 text-gray-700 hover:bg-gray-50":"border-gray-200 text-gray-400 cursor-not-allowed"}`,children:"Previous"}),r.jsx("div",{className:"flex space-x-2",children:Array.from({length:t},(o,u)=>r.jsx("div",{className:`w-2 h-2 rounded-full transition-colors ${u<=e?"bg-blue-600":"bg-gray-300"}`},u))}),c?r.jsxs("button",{onClick:i,className:"bg-green-600 text-white px-4 py-2 rounded-lg hover:bg-green-700 flex items-center space-x-2 text-sm",children:[r.jsx(Ci,{className:"w-4 h-4"}),r.jsx("span",{children:"Complete Setup"})]}):r.jsx("button",{onClick:l,disabled:!n,className:`px-4 py-2 text-sm rounded-lg transition-colors ${n?"bg-blue-600 text-white hover:bg-blue-700":"bg-gray-300 text-gray-500 cursor-not-allowed"}`,children:"Next"})]})}const Qp=()=>[{id:"monorepo-structure",title:"Monorepo Structure",description:"Configure your monorepo directory structure and package manager",completed:!1,required:!0},{id:"package-scanning",title:"Package Scanning",description:"Set up automatic package discovery and dependency analysis",completed:!1,required:!0},{id:"ci-integration",title:"CI/CD Integration",description:"Connect with your CI/CD providers (GitHub Actions, GitLab CI, etc.)",completed:!1,required:!1},{id:"health-checks",title:"Health Monitoring",description:"Configure package health checks and status monitoring",completed:!1,required:!1},{id:"notifications",title:"Notifications",description:"Set up alerts and notifications for important events",completed:!1,required:!1}],Yp=(e,t)=>({currentStep:t,totalSteps:e.length,completedSteps:e.filter(n=>n.completed).length}),Zp=(e,t)=>{const n=e[t];return!n.required||n.completed},Gp=e=>e.filter(n=>n.required).every(n=>n.completed),Kp=(e,t)=>e.map(n=>n.id===t?{...n,completed:!0}:n);function Xp({isOpen:e,onClose:t,onComplete:n}){const[s,l]=d.useState(0),[a,i]=d.useState(Qp()),c=b=>{const x=Kp(a,b);i(x),x[s].completed&&s<a.length-1&&l(f=>f+1)},o=()=>{s<a.length-1&&l(b=>b+1)},u=()=>{s>0&&l(b=>b-1)},p=()=>{Gp(a)&&(n(),t())},m=Yp(a,s),g=Zp(a,s),v=s>0,j=s===a.length-1,N=a[s];return r.jsxs(Bp,{isOpen:e,onClose:t,children:[r.jsx(Up,{onClose:t}),r.jsx(Hp,{progress:m}),r.jsx(Vp,{step:N,onStepComplete:c}),r.jsx(Wp,{currentStep:s,totalSteps:a.length,canGoNext:g,canGoPrevious:v,onNext:o,onPrevious:u,onComplete:p,isLastStep:j})]})}function Jp({config:e,onShowSetupGuide:t,onShowConfig:n,onRefresh:s}){return r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-heading text-3xl",children:e.title}),r.jsx("p",{className:"text-body mt-2",children:e.description}),r.jsx("button",{onClick:t,className:"hidden text-primary-600 hover:text-primary-700 text-sm font-medium mt-2",children:"First time? Run the setup guide"})]}),r.jsxs("div",{className:"flex space-x-3",children:[r.jsxs("button",{onClick:s,className:"btn-primary flex items-center space-x-2",children:[r.jsx(ot,{className:"w-5 h-5"}),r.jsx("span",{children:"Refresh"})]}),r.jsxs("button",{onClick:n,className:"hidden btn-ghost flex items-center space-x-2",children:[r.jsx(Ud,{className:"w-5 h-5"}),r.jsx("span",{children:"Configure"})]})]})]})}function qp({stats:e}){return r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:[r.jsx("div",{className:"card p-6",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-2 bg-primary-100 rounded-lg",children:r.jsx(qs,{className:"w-6 h-6 text-primary-600"})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-caption font-medium",children:"Total Packages"}),r.jsx("p",{className:"text-heading text-2xl",children:e.total})]})]})}),r.jsx("div",{className:"card p-6",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-2 bg-secondary-100 rounded-lg",children:r.jsx("span",{className:"text-2xl",children:"🚀"})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-caption font-medium",children:"Applications"}),r.jsx("p",{className:"text-heading text-2xl",children:e.apps})]})]})}),r.jsx("div",{className:"card p-6",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-2 bg-accent-100 rounded-lg",children:r.jsx("span",{className:"text-2xl",children:"📚"})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-caption font-medium",children:"Libraries"}),r.jsx("p",{className:"text-heading text-2xl",children:e.libs})]})]})}),r.jsx("div",{className:"card p-6",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-2 bg-info-100 rounded-lg",children:r.jsx("span",{className:"text-2xl",children:"🔗"})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-caption font-medium",children:"Dependencies"}),r.jsx("p",{className:"text-heading text-2xl",children:e.totalDependencies})]})]})})]})}function eg({packages:e,packageTypes:t,getTypeIcon:n}){return r.jsxs("div",{className:"bg-white p-6 rounded-lg shadow border",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Package Distribution"}),r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:t.map(s=>r.jsxs("div",{className:"text-center p-4 bg-gray-50 rounded-lg",children:[r.jsx("div",{className:"text-3xl mb-2",children:n(s)}),r.jsx("div",{className:"text-sm font-medium text-gray-600 capitalize",children:s}),r.jsx("div",{className:"text-2xl font-bold text-gray-900",children:e.filter(l=>l.type===s).length})]},s))})]})}function tg(){return r.jsxs("div",{className:"bg-white p-6 rounded-lg shadow border",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Quick Actions"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsx(rt,{to:"/dependencies",className:"p-4 border border-gray-200 rounded-lg hover:border-blue-300 hover:bg-blue-50 transition-colors",children:r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx("div",{className:"p-2 bg-blue-100 rounded-lg",children:r.jsx(Er,{className:"w-6 h-6 text-blue-600"})}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium text-gray-900",children:"Dependency Graph"}),r.jsx("p",{className:"text-sm text-gray-600",children:"Visualize package relationships"})]})]})}),r.jsx(rt,{to:"/health",className:"p-4 border border-gray-200 rounded-lg hover:border-green-300 hover:bg-green-50 transition-colors",children:r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx("div",{className:"p-2 bg-green-100 rounded-lg",children:r.jsx("span",{className:"text-2xl",children:"🏥"})}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium text-gray-900",children:"Health Check"}),r.jsx("p",{className:"text-sm text-gray-600",children:"Monitor package health"})]})]})}),r.jsx(rt,{to:"/ci",className:"hidden p-4 border border-gray-200 rounded-lg hover:border-purple-300 hover:bg-purple-50 transition-colors",children:r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx("div",{className:"p-2 bg-purple-100 rounded-lg",children:r.jsx("span",{className:"text-2xl",children:"🧪"})}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium text-gray-900",children:"CI/CD Status"}),r.jsx("p",{className:"text-sm text-gray-600",children:"View build status"})]})]})})]})]})}function ng({searchTerm:e,selectedType:t,packageTypes:n,onSearchChange:s,onTypeChange:l}){return r.jsxs("div",{className:"flex flex-col md:flex-row gap-4 mb-6",children:[r.jsxs("div",{className:"flex-1 relative",children:[r.jsx(Pi,{className:"w-5 h-5 absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400"}),r.jsx("input",{type:"text",placeholder:"Search packages...",value:e,onChange:a=>s(a.target.value),className:"w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(el,{className:"w-5 h-5 text-gray-400"}),r.jsxs("select",{value:t,onChange:a=>l(a.target.value),className:"px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[r.jsx("option",{value:"all",children:"All Types"}),n.map(a=>r.jsx("option",{value:a,className:"capitalize",children:a},a))]})]})]})}function rg({packages:e,getTypeIcon:t,getStatusColor:n}){return r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"min-w-full divide-y divide-gray-200",children:[r.jsx("thead",{className:"bg-gray-50",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Package"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Type"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Version"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Dependencies"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Description"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Actions"})]})}),r.jsx("tbody",{className:"bg-white divide-y divide-gray-200",children:e.map(s=>r.jsxs("tr",{className:"hover:bg-gray-50",children:[r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"text-2xl mr-3",children:t(s.type)}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium text-gray-900",children:s.name}),r.jsx("div",{className:"text-sm text-gray-500",children:s.path})]})]})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${n(s.type)}`,children:s.type})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900",children:s.version}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900",children:Object.keys(s.dependencies).length+Object.keys(s.devDependencies).length+Object.keys(s.peerDependencies).length}),r.jsx("td",{className:"px-6 py-4 text-sm text-gray-900 max-w-xs truncate",children:s.description||"No description"}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:r.jsx(rt,{to:`/packages/${encodeURIComponent(s.name)}`,className:"text-blue-600 hover:text-blue-500",children:"View Details"})})]},s.name))})]})})}var pc;const sg=((pc=window.ENV)==null?void 0:pc.API_URL)??"http://localhost:8999",We=`${sg}/api`;class lg{constructor(){this.mockPackages=[]}async getPackages(){try{const t=await fetch(`${We}/packages`);if(t.ok)return await t.json();console.error(`getPackages: initial fetch failed with status ${t.status}. Attempting refresh...`);try{return await this.refreshPackages()}catch(n){return console.error("getPackages: refresh failed",n),[]}}catch(t){return console.error("getPackages: unexpected error",t),[]}}async getPackage(t){const n=await fetch(`${We}/packages/`+encodeURIComponent(t));if(!n.ok)throw new Error(`Failed to fetch package details for "${t}" (Status: ${n.status})`);return await n.json()}async getDependencies(){await new Promise(n=>setTimeout(n,200));const t=new Set;try{return(await this.getPackages()).forEach(l=>{var a;(a=l.dependencies)==null||a.forEach(i=>t.add(i))}),Array.from(t).map(l=>({name:l,version:"unknown",type:"dependency",status:"active"}))}catch(n){return console.error("Error fetching dependencies:",n),[]}}async refreshPackages(){try{const t=await fetch(`${We}/packages/refresh`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!t.ok)return console.error(`refreshPackages: fetch failed with status ${t.status}`),[];const n=await t.json();return console.log("data from refreshPackage:",n),n}catch(t){return console.error("refreshPackages: unexpected error",t),[]}}async getHealthStatus(){console.log("getHealthStatus");try{const t=await fetch(`${We}/health/packages`);if(console.log("Health data from getHealthStatus:",t),!t.ok){if(console.log("Health data not available, attempting refresh..."),!(await fetch(`${We}/health/refresh`,{method:"POST",headers:{"Content-Type":"application/json"}})).ok)throw new Error("Failed to refresh health data");await new Promise(i=>setTimeout(i,1e3));const l=await fetch(`${We}/health/packages`);if(!l.ok)throw new Error("Failed to fetch health data after refresh");const a=await l.json();return console.log("Health data after refresh:",a),a}const n=await t.json();return console.log("Health data from getHealthStatus:",n),n}catch(t){console.error("Error fetching health data:",t)}}async refreshHealthStatus(){try{const t=await fetch(`${We}/health/refresh`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!t.ok)throw new Error("Failed to fetch health data");const n=await t.json();return console.log("Health data from refreshHealthStatus:",n),n}catch(t){console.error("Error fetching health data:",t)}}async getFallbackHealthStatus(){await new Promise(l=>setTimeout(l,400));const t=[{name:"Package Count",value:this.mockPackages.length,status:"healthy",description:`${this.mockPackages.length} packages in monorepo`},{name:"Dependency Health",value:85,status:"healthy",description:"Dependencies are up to date"},{name:"Build Status",value:95,status:"healthy",description:"Most builds are successful"}],n=this.mockPackages.map(l=>({package:l.name,score:l.status==="healthy"?90:l.status==="warning"?70:50,issues:l.status==="healthy"?[]:["Needs attention"]}));return{overallScore:85,metrics:t,packageHealth:n}}async updatePackageConfiguration(t,n,s){try{console.log("📤 Updating package configuration via MonorepoService:",t);const l=await fetch(`${We}/packages/update-config`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({packageName:t,config:n,packagePath:s})});if(console.log("📥 Response status:",l.status),!l.ok){const i=await l.text();console.error("📥 Error response:",i);let c=`HTTP error ${l.status}`;if(i)try{const o=JSON.parse(i);c=o.error||o.message||c}catch{c=i||c}throw new Error(c)}const a=await l.json();return console.log("📥 Success response:",a),a}catch(l){throw console.error("Error updating package configuration:",l),l}}async getBuildStatus(){await new Promise(n=>setTimeout(n,500));const t=[];for(const n of this.mockPackages){const s=n.scripts&&n.scripts.build,l=n.scripts&&n.scripts.test;if(s||l){const a=new Date(Date.now()-Math.random()*864e5).toISOString(),i=Math.random()>.8?"failed":Math.random()>.6?"building":Math.random()>.4?"queued":"success";t.push({id:`build-${n.name}-${Date.now()}`,package:n.name,status:i,startTime:a,endTime:i!=="building"?new Date(Date.now()-Math.random()*36e5).toISOString():void 0,duration:i!=="building"?Math.floor(Math.random()*300)+60:void 0,stages:this.generateBuildStages(n,i)})}}return t}async getConfigurationFiles(){try{console.log("Fetching configuration files from backend...");const t=await fetch(`${We}/config/files`);if(!t.ok)throw new Error(`Failed to fetch config files: ${t.status} ${t.statusText}`);const n=await t.json();if(console.log("Response from config files API:",n),n.success&&n.files)return console.log(`Successfully fetched ${n.files.length} configuration files`),n.files;throw new Error("Invalid response format from config files API")}catch(t){return console.error("Error fetching configuration files from backend:",t),console.log("Returning empty config files list due to error..."),[]}}async saveConfigurationFile(t,n){try{console.log("Saving configuration file:",t);const s=await fetch(`${We}/config/files/${encodeURIComponent(t)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:n})});if(!s.ok){const a=await s.json();throw new Error(a.error||`Failed to save file: ${s.status} ${s.statusText}`)}const l=await s.json();if(l.success&&l.file)return console.log("File saved successfully:",t),l.file;throw new Error("Invalid response format from save file API")}catch(s){throw console.error("Error saving configuration file:",s),s}}generateBuildStages(t,n){const s=[{name:"Install",status:"success",duration:Math.floor(Math.random()*30)+10,logs:["Installing dependencies...","Dependencies installed successfully"]},{name:"Lint",status:n==="failed"&&Math.random()>.7?"failed":"success",duration:Math.floor(Math.random()*20)+5,logs:["Running ESLint...","Linting completed"]},{name:"Test",status:n==="failed"&&Math.random()>.5?"failed":"success",duration:Math.floor(Math.random()*60)+30,logs:["Running tests...","Test suite completed"]},{name:"Build",status:n==="failed"?"failed":"success",duration:Math.floor(Math.random()*120)+60,logs:["Building package...","Build completed successfully"]}];if(n==="building"){const l=Math.floor(Math.random()*s.length);s[l].status="running",s.slice(l+1).forEach(a=>a.status="pending")}return s}}const Oe=new lg,ag=e=>({total:e.length,apps:e.filter(t=>t.type==="app").length,libs:e.filter(t=>t.type==="lib").length,tools:e.filter(t=>t.type==="tool").length,custom:e.filter(t=>!["app","Plib","tool"].includes(t.type)).length,totalDependencies:e.reduce((t,n)=>t+Object.keys(n.dependencies).length+Object.keys(n.peerDependencies).length+Object.keys(n.devDependencies).length,0)}),ig=e=>[...new Set(e.map(t=>t.type))],og=(e,t,n)=>e.filter(s=>{var i;const l=s.name.toLowerCase().includes(t.toLowerCase())||((i=s.description)==null?void 0:i.toLowerCase().includes(t.toLowerCase())),a=n==="all"||s.type===n;return l&&a}),cg=e=>{switch(e){case"app":return"bg-blue-100 text-blue-800";case"lib":return"bg-green-100 text-green-800";case"tool":return"bg-purple-100 text-purple-800";default:return"bg-gray-100 text-gray-800"}},ic=e=>{switch(e){case"app":return"🚀";case"lib":return"📚";case"tool":return"🔧";default:return"📦"}};function Ti({message:e="Loading packages..."}){return r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600",children:e})]})})}function Vd({error:e,onRetry:t}){return r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsxs("div",{className:"text-center",children:[r.jsx(te,{className:"w-12 h-12 text-red-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-red-600",children:e}),t&&r.jsx("button",{onClick:t,className:"mt-4 bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 transition-colors",children:"Retry"})]})})}function ug({stats:e}){return r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-6",children:[r.jsx("div",{className:"bg-white p-6 rounded-lg shadow border",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-2 bg-blue-100 rounded-lg",children:r.jsx("div",{className:"text-2xl",children:"📦"})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Total Packages"}),r.jsx("p",{className:"text-2xl font-semibold text-gray-900",children:e.total})]})]})}),r.jsx("div",{className:"bg-white p-6 rounded-lg shadow border",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-2 bg-green-100 rounded-lg",children:r.jsx(Ke,{className:"w-6 h-6 text-green-600"})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Healthy"}),r.jsx("p",{className:"text-2xl font-semibold text-green-600",children:e.healthy})]})]})}),r.jsx("div",{className:"bg-white p-6 rounded-lg shadow border",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-2 bg-yellow-100 rounded-lg",children:r.jsx(te,{className:"w-6 h-6 text-yellow-600"})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Warnings"}),r.jsx("p",{className:"text-2xl font-semibold text-yellow-600",children:e.warnings})]})]})}),r.jsx("div",{className:"bg-white p-6 rounded-lg shadow border",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-2 bg-red-100 rounded-lg",children:r.jsx(Xe,{className:"w-6 h-6 text-red-600"})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Errors"}),r.jsx("p",{className:"text-2xl font-semibold text-red-600",children:e.errors})]})]})})]})}function dg({filters:e,onFiltersChange:t,availableTypes:n,availableStatuses:s}){return r.jsx("div",{className:"bg-white p-6 rounded-lg shadow border",children:r.jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between space-y-4 md:space-y-0 md:space-x-4",children:[r.jsxs("div",{className:"flex-1 relative",children:[r.jsx(Pi,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 h-5 w-5"}),r.jsx("input",{type:"text",placeholder:"Search packages by name, description, or tags...",value:e.search,onChange:l=>t({...e,search:l.target.value}),className:"w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),r.jsxs("div",{className:"flex items-center space-x-4",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(el,{className:"h-5 w-5 text-gray-400"}),r.jsxs("select",{value:e.type,onChange:l=>t({...e,type:l.target.value}),className:"border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[r.jsx("option",{value:"all",children:"All Types"}),n.map(l=>r.jsx("option",{value:l,children:l.charAt(0).toUpperCase()+l.slice(1)},l))]})]}),r.jsxs("select",{value:e.status,onChange:l=>t({...e,status:l.target.value}),className:"border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[r.jsx("option",{value:"all",children:"All Status"}),s.map(l=>r.jsx("option",{value:l,children:l.charAt(0).toUpperCase()+l.slice(1)},l))]})]})]})})}const mg=e=>({total:e.length,healthy:e.filter(t=>t.status==="healthy").length,warnings:e.filter(t=>t.status==="warning").length,errors:e.filter(t=>t.status==="error").length}),hg=e=>[...new Set(e.map(t=>t.type))],fg=e=>[...new Set(e.map(t=>t.status))],xg=(e,t)=>e.filter(n=>{const s=n.name.toLowerCase().includes(t.search.toLowerCase())||n.description.toLowerCase().includes(t.search.toLowerCase()),l=t.type==="all"||n.type===t.type,a=t.status==="all"||n.status===t.status;return s&&l&&a}),pg=(e,t)=>[...e].sort((n,s)=>{let l,a;switch(t.field){case"name":l=n.name.toLowerCase(),a=s.name.toLowerCase();break;case"version":l=n.version,a=s.version;break;case"lastUpdated":l=new Date(n.lastUpdated),a=new Date(s.lastUpdated);break;case"dependencies":l=Object.keys(n.dependencies).length,a=Object.keys(s.dependencies).length;break;default:return 0}return l<a?t.order==="asc"?-1:1:l>a?t.order==="asc"?1:-1:0}),Wd=e=>{switch(e){case"healthy":return"bg-green-100 text-green-800";case"warning":return"bg-yellow-100 text-yellow-800";case"error":return"bg-red-100 text-red-800";case"building":return"bg-blue-100 text-blue-800";default:return"bg-gray-100 text-gray-800"}},Qd=e=>{switch(e){case"app":return"bg-blue-100 text-blue-800";case"lib":return"bg-purple-100 text-purple-800";case"tool":return"bg-orange-100 text-orange-800";case"service":return"bg-green-100 text-green-800";default:return"bg-gray-100 text-gray-800"}},gg=e=>{switch(e){case"up-to-date":return"bg-green-100 text-green-800";case"outdated":return"bg-yellow-100 text-yellow-800";case"major-update":return"bg-red-100 text-red-800";default:return"bg-gray-100 text-gray-800"}},yg=e=>{switch(e){case"feature":return"bg-blue-100 text-blue-800";case"fix":return"bg-green-100 text-green-800";case"chore":return"bg-gray-100 text-gray-800";case"breaking":return"bg-red-100 text-red-800";default:return"bg-gray-100 text-gray-800"}},Mi=e=>new Date(e).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),Yd=e=>e.startsWith("v")?e:`v${e}`,Zd=e=>{switch(e){case"app":return"🚀";case"lib":return"📚";case"tool":return"🔧";case"service":return"🌐";default:return"📦"}};function vg({packages:e,sorting:t,onSortChange:n}){const s=a=>{const i=t.field===a&&t.order==="asc"?"desc":"asc";n({field:a,order:i})},l=a=>t.field!==a?null:t.order==="asc"?r.jsx(Si,{className:"w-4 h-4"}):r.jsx(zd,{className:"w-4 h-4"});return r.jsx("div",{className:"bg-white rounded-lg shadow border overflow-hidden",children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full",children:[r.jsx("thead",{className:"bg-gray-50",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider cursor-pointer hover:bg-gray-100",onClick:()=>s("name"),children:r.jsxs("div",{className:"flex items-center space-x-1",children:[r.jsx("span",{children:"Package"}),l("name")]})}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider cursor-pointer hover:bg-gray-100",onClick:()=>s("version"),children:r.jsxs("div",{className:"flex items-center space-x-1",children:[r.jsx("span",{children:"Version"}),l("version")]})}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Type"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Status"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider cursor-pointer hover:bg-gray-100",onClick:()=>s("dependencies"),children:r.jsxs("div",{className:"flex items-center space-x-1",children:[r.jsx("span",{children:"Dependencies"}),l("dependencies")]})}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider cursor-pointer hover:bg-gray-100",onClick:()=>s("lastUpdated"),children:r.jsxs("div",{className:"flex items-center space-x-1",children:[r.jsx("span",{children:"Last Updated"}),l("lastUpdated")]})}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Maintainers"})]})}),r.jsx("tbody",{className:"bg-white divide-y divide-gray-200",children:e.map(a=>r.jsxs("tr",{className:"hover:bg-gray-50",children:[r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"text-2xl mr-3",children:Zd(a.type)}),r.jsxs("div",{children:[r.jsx(rt,{to:`/packages/${encodeURIComponent(a.name)}`,className:"text-sm font-medium text-blue-600 hover:text-blue-500",children:a.name}),r.jsx("div",{className:"text-sm text-gray-500",children:a.description})]})]})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("span",{className:"text-sm font-mono text-gray-900",children:Yd(a.version)})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${Qd(a.type)}`,children:a.type})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${Wd(a.status)}`,children:a.status})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900",children:Object.keys(a.dependencies).length>0&&r.jsxs("div",{className:"text-xs text-gray-500 mt-1",children:[Object.keys(a.dependencies).slice(0,3).join(", "),Object.keys(a.dependencies).length>3&&` +${Object.keys(a.dependencies).length-3} more`]})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:Mi(a.lastUpdated)}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsxs("div",{className:"flex -space-x-1",children:[a.maintainers.slice(0,3).map((i,c)=>r.jsx("div",{className:"inline-flex items-center justify-center h-6 w-6 rounded-full bg-gray-500 text-xs font-medium text-white",title:i,children:i.charAt(0).toUpperCase()},i)),a.maintainers.length>3&&r.jsxs("div",{className:"inline-flex items-center justify-center h-6 w-6 rounded-full bg-gray-300 text-xs font-medium text-gray-600",children:["+",a.maintainers.length-3]})]})})]},a.name))})]})})})}function jg({packageData:e}){var n,s,l,a;const t=i=>{switch(i){case"healthy":return r.jsx(Ke,{className:"h-5 w-5 text-green-500"});case"warning":return r.jsx(te,{className:"h-5 w-5 text-yellow-500"});case"error":return r.jsx(te,{className:"h-5 w-5 text-red-500"});default:return r.jsx(ct,{className:"h-5 w-5 text-gray-500"})}};return r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"mb-6",children:r.jsxs(rt,{to:"/packages",className:"inline-flex items-center text-sm text-gray-500 hover:text-gray-700",children:[r.jsx(W0,{className:"mr-2 h-4 w-4"}),"Back to Packages"]})}),r.jsxs("div",{className:"bg-white rounded-lg shadow border p-6 mb-6",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex items-start space-x-4",children:[r.jsx("div",{className:"text-4xl",children:Zd(e.type)}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:e.name}),r.jsx("p",{className:"text-gray-600 mt-1",children:e.description}),r.jsxs("div",{className:"flex items-center space-x-4 mt-4",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("span",{className:"text-sm font-medium text-gray-500",children:"Version:"}),r.jsx("span",{className:"text-sm font-mono bg-gray-100 px-2 py-1 rounded",children:Yd(e.version)})]}),r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${Qd(e.type)}`,children:e.type}),r.jsxs("div",{className:"flex items-center space-x-1",children:[t(e.status),r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${Wd(e.status)}`,children:e.status})]})]})]})]}),r.jsxs("div",{className:"text-right",children:[r.jsx("div",{className:"text-sm text-gray-500 mb-2",children:"Health Score"}),r.jsxs("div",{className:"text-2xl font-bold text-blue-600",children:[((n=e.packageHealth)==null?void 0:n.packageOverallScore)??"","%"]})]})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4 mt-6 pt-6 border-t border-gray-200",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Bd,{className:"h-4 w-4 text-gray-400"}),r.jsxs("div",{children:[r.jsx("div",{className:"text-xs text-gray-500",children:"Last Updated"}),r.jsx("div",{className:"text-sm font-medium",children:Mi(e.lastUpdated)})]})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Cp,{className:"h-4 w-4 text-gray-400"}),r.jsxs("div",{children:[r.jsx("div",{className:"text-xs text-gray-500",children:"Maintainers"}),r.jsx("div",{className:"text-sm font-medium",children:e.maintainers.length})]})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Ri,{className:"h-4 w-4 text-gray-400"}),r.jsxs("div",{children:[r.jsx("div",{className:"text-xs text-gray-500",children:"License"}),r.jsx("div",{className:"text-sm font-medium",children:e.license})]})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("div",{className:"h-4 w-4 text-gray-400",children:"🔗"}),r.jsxs("div",{children:[r.jsx("div",{className:"text-xs text-gray-500",children:"Repository"}),r.jsx("div",{className:"text-sm font-medium truncate",children:r.jsx("a",{href:e.repository.url||"",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-500",children:(l=(s=e.repository)==null?void 0:s.url)==null?void 0:l.split("/").pop()})})]})]})]}),((a=e.tags)==null?void 0:a.length)>0&&r.jsxs("div",{className:"mt-4",children:[r.jsx("div",{className:"text-xs text-gray-500 mb-2",children:"Tags"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:e.tags.map(i=>r.jsx("span",{className:"inline-flex px-2 py-1 text-xs bg-gray-100 text-gray-700 rounded-full",children:i},i))})]})]})]})}function wg({activeTab:e,onTabChange:t}){const n=[{id:"overview",label:"Overview",icon:qs},{id:"dependencies",label:"Dependencies",icon:Ei},{id:"commits",label:"Recent Commits",icon:ct},{id:"health",label:"Health Metrics",icon:Hd},{id:"config",label:"Configuration",icon:Ms}];return r.jsx("div",{className:"border-b border-gray-200",children:r.jsx("nav",{className:"flex space-x-8",children:n.map(s=>{const l=s.icon;return r.jsxs("button",{onClick:()=>t(s.id),className:`py-4 px-1 border-b-2 font-medium text-sm flex items-center space-x-2 ${e===s.id?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:[r.jsx(l,{className:"w-4 h-4"}),r.jsx("span",{children:s.label})]},s.id)})})})}function Ng({packageData:e}){if(!e.dependenciesInfo.length)return r.jsx("p",{className:"py-6 text-gray-600",children:"No dependency found."});const t=(n,s)=>r.jsxs("div",{className:"mb-8",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:s}),r.jsx("div",{className:"bg-white border rounded-lg overflow-hidden",children:r.jsxs("table",{className:"w-full",children:[r.jsx("thead",{className:"bg-gray-50",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Package"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Current"}),r.jsx("th",{className:"hidden px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Latest"}),r.jsx("th",{className:"hidden px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Status"}),r.jsx("th",{className:"hidden px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Actions"})]})}),r.jsx("tbody",{className:"bg-white divide-y divide-gray-200",children:n.map(l=>r.jsxs("tr",{className:"hover:bg-gray-50",children:[r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("div",{className:"text-sm font-medium text-gray-900",children:l.name})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("span",{className:"text-sm font-mono text-gray-700",children:l.version})}),r.jsx("td",{className:"hidden px-6 py-4 whitespace-nowrap",children:r.jsx("span",{className:"text-sm font-mono text-gray-700",children:l.latest})}),r.jsx("td",{className:"hidden px-6 py-4 whitespace-nowrap",children:r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${gg(l.status)}`,children:l.status.replace("-"," ")})}),r.jsx("td",{className:"hidden px-6 py-4 whitespace-nowrap text-sm",children:l.status!=="up-to-date"&&r.jsxs("button",{className:"text-blue-600 hover:text-blue-500 flex items-center space-x-1",children:[r.jsx(Si,{className:"w-4 h-4"}),r.jsx("span",{children:"Update"})]})})]},l.name))})]})})]});return r.jsxs("div",{className:"py-6",children:[t(e.dependenciesInfo.filter(n=>n.type=="dependency"),"Dependencies"),t(e.dependenciesInfo.filter(n=>n.type=="devDependency"),"Dev Dependencies"),t(e.dependenciesInfo.filter(n=>n.type=="peerDependency"),"Peer Dependencies"),r.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:[r.jsx("h4",{className:"font-medium text-blue-900 mb-2",children:"Dependency Summary"}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-blue-800",children:"Total Dependencies:"}),r.jsx("span",{className:"ml-2 text-blue-700",children:e.dependenciesInfo.filter(n=>n.type=="dependency").length})]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-blue-800",children:"Dev Dependencies:"}),r.jsx("span",{className:"ml-2 text-blue-700",children:e.dependenciesInfo.filter(n=>n.type=="devDependency").length})]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-blue-800",children:"Peer Dependencies:"}),r.jsx("span",{className:"ml-2 text-blue-700",children:e.dependenciesInfo.filter(n=>n.type=="peerDependency").length})]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-blue-800",children:"Outdated:"}),r.jsx("span",{className:"ml-2 text-blue-700",children:e.dependenciesInfo.filter(n=>n.status==="outdated").length})]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-blue-800",children:"Major Updates:"}),r.jsx("span",{className:"ml-2 text-blue-700",children:e.dependenciesInfo.filter(n=>n.status==="major-update").length})]})]})]})]})}function bg({packageData:e}){return r.jsxs("div",{className:"py-6",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:"Recent Commits"}),r.jsx("div",{className:"space-y-4",children:e.commits.map(t=>r.jsx("div",{className:"bg-white border rounded-lg p-4 hover:shadow-md transition-shadow",children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center space-x-3 mb-2",children:[r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${yg(t.type)}`,children:t.type}),r.jsx("span",{className:"text-sm font-mono text-gray-500",children:t.hash})]}),r.jsx("p",{className:"text-sm font-medium text-gray-900 mb-2",children:t.message}),r.jsxs("div",{className:"flex items-center space-x-4 text-sm text-gray-500",children:[r.jsxs("span",{children:["by ",t.author]}),r.jsx("span",{children:Mi(t.date)})]})]}),r.jsx("div",{className:"hidden ml-4",children:r.jsx("button",{className:"text-blue-600 hover:text-blue-500 text-sm",children:"View Diff"})})]})},t.hash))}),e.commits.length===0&&r.jsxs("div",{className:"text-center py-8",children:[r.jsx("div",{className:"text-gray-400 text-4xl mb-2",children:"📝"}),r.jsx("p",{className:"text-gray-500",children:"No recent commits found"})]}),r.jsxs("div",{className:"mt-6 bg-gray-50 border border-gray-200 rounded-lg p-4",children:[r.jsx("h4",{className:"font-medium text-gray-900 mb-2",children:"Commit Summary"}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-gray-800",children:"Features:"}),r.jsx("span",{className:"ml-2 text-gray-600",children:e.commits.filter(t=>t.type==="feat").length})]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-gray-800",children:"Fixes:"}),r.jsx("span",{className:"ml-2 text-gray-600",children:e.commits.filter(t=>t.type==="fix").length})]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-gray-800",children:"Chores:"}),r.jsx("span",{className:"ml-2 text-gray-600",children:e.commits.filter(t=>t.type==="chore").length})]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-gray-800",children:"Breaking:"}),r.jsx("span",{className:"ml-2 text-gray-600",children:e.commits.filter(t=>t.type==="breaking").length})]})]})]})]})}function kg({packageData:e}){var a;const t=i=>i>=80?"text-green-600":i>=60?"text-yellow-600":"text-red-600",n=i=>{switch(i){case"success":return r.jsx(Ke,{className:"w-5 h-5 text-green-500"});case"failed":return r.jsx(Xe,{className:"w-5 h-5 text-red-500"});case"running":return r.jsx("div",{className:"w-5 h-5 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"});default:return r.jsx(te,{className:"w-5 h-5 text-gray-500"})}},s=i=>{switch(i){case"success":return"bg-green-100 text-green-800";case"failed":return"bg-red-100 text-red-800";case"running":return"bg-blue-100 text-blue-800";default:return"bg-gray-100 text-gray-800"}},l=i=>{switch(i){case"pass":return"bg-green-100 text-green-800";case"fail":return"bg-red-100 text-red-800";case"warning":return"bg-yellow-100 text-yellow-800";default:return"bg-gray-100 text-gray-800"}};return(a=e.packageHealth)!=null&&a.packageOverallScore?r.jsxs("div",{className:"py-6",children:[r.jsxs("div",{className:"bg-white border rounded-lg p-6 mb-6",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Health Score"}),r.jsxs("div",{className:`text-3xl font-bold ${t(e.packageHealth.packageOverallScore)}`,children:[e.packageHealth.packageOverallScore,"%"]})]}),r.jsx("div",{className:"w-full bg-gray-200 rounded-full h-3 mb-4",children:r.jsx("div",{className:`h-3 rounded-full transition-all duration-300 ${e.packageHealth.packageOverallScore>=80?"bg-green-500":e.packageHealth.packageOverallScore>=60?"bg-yellow-500":"bg-red-500"}`,style:{width:`${e.packageHealth.packageOverallScore}%`}})}),r.jsxs("p",{className:"text-sm text-gray-600",children:[e.packageHealth.packageOverallScore>=80&&"Excellent health - package is in great condition",e.packageHealth.packageOverallScore>=60&&e.packageHealth.packageOverallScore<80&&"Good health - minor issues detected",e.packageHealth.packageOverallScore<60&&"Needs attention - several issues require fixing"]})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 mb-6",children:[r.jsxs("div",{className:"bg-white border rounded-lg p-6",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900",children:"Build Status"}),n(e.packageHealth.packageBuildStatus)]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${s(e.packageHealth.packageBuildStatus)}`,children:e.packageHealth.packageBuildStatus}),r.jsx("button",{className:"hidden text-blue-600 hover:text-blue-500 text-sm",children:"View Logs"})]})]}),r.jsxs("div",{className:"hidden bg-white border rounded-lg p-6",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900",children:"Test Coverage"}),r.jsxs("div",{className:`text-lg font-semibold ${e.packageHealth.packageTestCoverage>=80?"text-green-600":e.packageHealth.packageTestCoverage>=60?"text-yellow-600":"text-red-600"}`,children:[e.packageHealth.packageTestCoverage,"%"]})]}),r.jsx("div",{className:"w-full bg-gray-200 rounded-full h-2",children:r.jsx("div",{className:`h-2 rounded-full ${e.packageHealth.packageTestCoverage>=80?"bg-green-500":e.packageHealth.packageTestCoverage>=60?"bg-yellow-500":"bg-red-500"}`,style:{width:`${e.packageHealth.packageTestCoverage}%`}})})]}),r.jsxs("div",{className:"bg-white border rounded-lg p-6",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900",children:"Lint Status"}),e.packageHealth.packageLintStatus==="pass"&&r.jsx(Ke,{className:"w-5 h-5 text-green-500"}),e.packageHealth.packageLintStatus==="fail"&&r.jsx(Xe,{className:"w-5 h-5 text-red-500"}),e.packageHealth.packageLintStatus==="warning"&&r.jsx(te,{className:"w-5 h-5 text-yellow-500"})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${l(e.packageHealth.packageLintStatus)}`,children:e.packageHealth.packageLintStatus}),r.jsx("button",{className:"hidden text-blue-600 hover:text-blue-500 text-sm",children:"View Issues"})]})]})]}),r.jsxs("div",{className:"bg-white border rounded-lg p-6",children:[r.jsx("h4",{className:"text-lg font-medium text-gray-900 mb-4",children:"Detailed Metrics"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[r.jsxs("div",{children:[r.jsx("h5",{className:"text-sm font-medium text-gray-700 mb-3",children:"Dependencies"}),r.jsxs("div",{className:"space-y-2 text-sm",children:[r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-600",children:"Total Dependencies:"}),r.jsx("span",{className:"font-medium",children:Object.keys(e.dependenciesInfo).length})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-600",children:"Outdated:"}),r.jsx("span",{className:"font-medium text-yellow-600",children:e.dependenciesInfo.filter(i=>i.status==="outdated").length})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-600",children:"Major Updates Available:"}),r.jsx("span",{className:"font-medium text-red-600",children:e.dependenciesInfo.filter(i=>i.status==="major-update").length})]})]})]}),r.jsxs("div",{children:[r.jsx("h5",{className:"text-sm font-medium text-gray-700 mb-3",children:"Code Quality"}),r.jsxs("div",{className:"space-y-2 text-sm",children:[r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-600",children:"Build Status:"}),r.jsx("span",{className:`font-medium ${e.packageHealth.packageBuildStatus==="success"?"text-green-600":e.packageHealth.packageBuildStatus==="failed"?"text-red-600":"text-yellow-600"}`,children:e.packageHealth.packageBuildStatus})]}),r.jsxs("div",{className:"hidden flex justify-between",children:[r.jsx("span",{className:"text-gray-600",children:"Test Coverage:"}),r.jsxs("span",{className:"font-medium",children:[e.packageHealth.packageTestCoverage,"%"]})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-600",children:"Lint Status:"}),r.jsx("span",{className:`font-medium ${e.packageHealth.packageLintStatus==="pass"?"text-green-600":e.packageHealth.packageLintStatus==="fail"?"text-red-600":"text-yellow-600"}`,children:e.packageHealth.packageLintStatus})]})]})]})]})]})]}):r.jsx("p",{className:"py-6 text-gray-600",children:"No health data available."})}function Sg({packageData:e}){const[t,n]=d.useState(!1),[s,l]=d.useState(""),[a,i]=d.useState(!1),[c,o]=d.useState(""),[u,p]=d.useState(null),[m,g]=d.useState(!1);console.log("Package Data:",e);const v=()=>{const f={name:e.name,version:e.version,description:e.description||"",license:e.license||"",repository:e.repository||{},scripts:e.scripts||{},dependencies:e.dependencies||{},devDependencies:e.devDependencies||{},peerDependencies:e.peerDependencies||{}};return JSON.stringify(f,null,2)};d.useState(()=>{l(v())});const j=()=>{n(!0),l(v()),o("")},N=()=>{n(!1),l(v()),o("")},b=async()=>{if(!s.trim()){o("Configuration cannot be empty");return}i(!0),o("");try{console.log("Saving package configuration...");const f=await Oe.updatePackageConfiguration(e.name,s,e.path);if(f.success)o("Configuration updated successfully!"),n(!1),console.log("Update successful:",f);else throw new Error(f.message||"Update failed")}catch(f){console.error("Error saving configuration:",f),o(f instanceof Error?f.message:"Failed to save configuration. Please try again.")}finally{i(!1)}},x=f=>{l(f.target.value),c&&o("")},h=async(f,w,S)=>{try{await navigator.clipboard.writeText(f),w==="config"?(g(!0),setTimeout(()=>g(!1),4e3)):w==="script"&&S&&(p(S),setTimeout(()=>p(null),4e3))}catch(E){console.error("Failed to copy to clipboard:",E);const y=document.createElement("textarea");y.value=f,document.body.appendChild(y),y.select();try{document.execCommand("copy"),w==="config"?(g(!0),setTimeout(()=>g(!1),2e3)):w==="script"&&S&&(p(S),setTimeout(()=>p(null),2e3))}catch(C){console.error("Fallback copy failed:",C),w==="config"&&o("Failed to copy to clipboard")}document.body.removeChild(y)}};return r.jsxs("div",{className:"py-6",children:[r.jsxs("div",{className:"bg-white border rounded-lg p-6 mb-6",children:[r.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[r.jsx(Ei,{className:"w-5 h-5 text-gray-600"}),r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Package Scripts"})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:Object.entries(e.scripts).map(([f,w])=>r.jsxs("div",{className:"border border-gray-200 rounded-lg p-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900",children:f}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("button",{onClick:()=>h(w,"script",f),className:`text-sm flex items-center space-x-1 ${u===f?"text-green-600":"text-gray-600 hover:text-gray-700"}`,title:"Copy command to clipboard",children:u===f?r.jsxs(r.Fragment,{children:[r.jsx(nc,{className:"w-4 h-4"}),r.jsx("span",{children:"Copied!"})]}):r.jsxs(r.Fragment,{children:[r.jsx(rc,{className:"w-4 h-4"}),r.jsx("span",{children:"Copy"})]})}),r.jsx("button",{className:"hidden text-blue-600 hover:text-blue-500 text-sm",children:"Run"})]})]}),r.jsx("code",{className:"text-xs text-gray-600 bg-gray-100 p-2 rounded block overflow-x-auto",children:w})]},f))}),Object.keys(e.scripts).length===0&&r.jsxs("div",{className:"text-center py-8",children:[r.jsx("div",{className:"text-gray-400 text-4xl mb-2",children:"📝"}),r.jsx("p",{className:"text-gray-500",children:"No scripts configured"})]})]}),r.jsxs("div",{className:"bg-white border rounded-lg p-6",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Package Configuration"}),!t&&r.jsx("div",{className:"text-sm text-gray-500",children:"Read-only preview"})]}),t?r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"bg-gray-900 text-gray-100 p-4 rounded-lg",children:r.jsx("textarea",{value:s,onChange:x,className:"w-full h-96 bg-gray-900 text-gray-100 text-sm font-mono resize-none focus:outline-none focus:ring-2 focus:ring-blue-500 rounded",spellCheck:"false"})}),c&&r.jsx("div",{className:`p-3 rounded-lg text-sm ${c.includes("successfully")?"bg-green-50 text-green-700 border border-green-200":"bg-red-50 text-red-700 border border-red-200"}`,children:c}),r.jsxs("div",{className:"flex space-x-3",children:[r.jsx("button",{onClick:b,disabled:a,className:"bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 disabled:bg-blue-300 disabled:cursor-not-allowed text-sm flex items-center space-x-2",children:a?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),r.jsx("span",{children:"Saving..."})]}):r.jsx("span",{children:"Save Changes"})}),r.jsx("button",{onClick:N,disabled:a,className:"border border-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed text-sm",children:"Cancel"})]})]}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"bg-gray-900 text-gray-100 p-4 rounded-lg overflow-x-auto",children:r.jsx("pre",{className:"text-sm",children:s})}),r.jsxs("div",{className:"mt-4 flex space-x-3",children:[r.jsx("button",{onClick:j,className:"bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 text-sm",children:"Edit Configuration"}),r.jsx("button",{onClick:()=>h(t?s:v(),"config"),className:"border border-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-50 text-sm flex items-center space-x-2",children:m?r.jsxs(r.Fragment,{children:[r.jsx(nc,{className:"w-4 h-4 text-green-600"}),r.jsx("span",{children:"Copied!"})]}):r.jsxs(r.Fragment,{children:[r.jsx(rc,{className:"w-4 h-4"}),r.jsx("span",{children:"Copy"})]})})]})]})]})]})}const oc={title:"Monorepo Dashboard",description:"Visual management and monitoring of your monorepo packages",packageTypes:["app","lib","tool"],features:{healthChecks:!0,ciIntegration:!0,dependencyGraph:!0,publishControl:!0,searchAndFilter:!0,configurationInspector:!0},branding:{primaryColor:"#3B82F6",secondaryColor:"#1E40AF"}};function Cg(){const[e,t]=d.useState(),[n,s]=d.useState(""),[l,a]=d.useState("all"),[i,c]=d.useState(oc),[o,u]=d.useState(!1),[p,m]=d.useState(!1),[g,v]=d.useState(!0),[j,N]=d.useState(null),[b,x]=d.useState(!1);d.useEffect(()=>{(async()=>{try{v(!0);const C=await Oe.getPackages();t(C),N(null)}catch(C){N("Failed to fetch packages"),console.error("Error fetching packages:",C)}finally{v(!1)}})()},[]),d.useEffect(()=>{const y=localStorage.getItem("monodog-config");y&&c({...oc,...JSON.parse(y)})},[]);const h=y=>{c(y),localStorage.setItem("monodog-config",JSON.stringify(y))},f=async()=>{try{x(!0),N(null),v(!0);try{const y=await Oe.refreshPackages();console.log("package data:",y),t(y),N(null)}catch(y){N("Failed to fetch package data"),console.error("Error fetching package data:",y)}finally{v(!1)}}catch(y){N("Failed to refresh package data"),console.error("Error refreshing package data:",y)}finally{x(!1)}};if(g&&!e)return r.jsx(Ti,{});if(j)return r.jsx(Vd,{error:j,onRetry:f});const w=og(e??[],n,l),S=ig(e??[]),E=ag(e??[]);return r.jsxs("div",{className:"p-6 space-y-6",children:[b&&e&&r.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-70 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-white p-6 rounded-lg shadow-lg text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-700",children:"Refreshing packages..."})]})}),r.jsx(Jp,{config:i,onShowSetupGuide:()=>m(!0),onShowConfig:()=>u(!0),onRefresh:f}),r.jsx(qp,{stats:E}),r.jsx(eg,{packages:e??[],packageTypes:S,getTypeIcon:ic}),r.jsx(tg,{}),r.jsxs("div",{className:"bg-white p-6 rounded-lg shadow border",children:[r.jsx(ng,{searchTerm:n,selectedType:l,packageTypes:S,onSearchChange:s,onTypeChange:a}),r.jsx(rg,{packages:w,getTypeIcon:ic,getStatusColor:cg})]}),r.jsx(zp,{isOpen:o,onClose:()=>u(!1),onSave:h,currentConfig:i}),r.jsx(Xp,{isOpen:p,onClose:()=>m(!1),onComplete:()=>m(!1)})]})}function Eg(){const[e,t]=d.useState([]),[n,s]=d.useState(!0),[l,a]=d.useState(null),[i,c]=d.useState({search:"",type:"all",status:"all"}),[o,u]=d.useState({field:"name",order:"asc"});d.useEffect(()=>{(async()=>{try{s(!0);const x=await Oe.getPackages();t(x),a(null)}catch(x){a("Failed to fetch packages"),console.error("Error fetching packages:",x)}finally{s(!1)}})()},[]);const p=()=>{window.location.reload()},m=xg(e,i),g=pg(m,o),v=mg(e),j=hg(e),N=fg(e);return n?r.jsx(Ti,{}):l?r.jsx(Vd,{error:l,onRetry:p}):r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsxs("div",{children:[r.jsx("h1",{className:"text-heading text-2xl",children:"Packages Overview"}),r.jsx("p",{className:"text-body mt-1",children:"Manage and monitor all packages in your monorepo"})]})}),r.jsx(ug,{stats:v}),r.jsx(dg,{filters:i,onFiltersChange:c,availableTypes:j,availableStatuses:N}),r.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-600",children:[r.jsxs("span",{children:["Showing ",g.length," of ",e.length," packages",i.search&&` matching "${i.search}"`]}),r.jsxs("span",{children:[i.type!=="all"&&`Filtered by type: ${i.type}`,i.status!=="all"&&` • status: ${i.status}`]})]}),r.jsx(vg,{packages:g,sorting:o,onSortChange:u}),g.length===0&&!n&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx("div",{className:"text-neutral-400 text-6xl mb-4",children:"📦"}),r.jsx("h3",{className:"text-heading text-lg mb-2",children:"No packages found"}),r.jsx("p",{className:"text-body mb-4",children:i.search||i.type!=="all"||i.status!=="all"?"Try adjusting your filters to see more results.":"Get started by adding your first package to the monorepo."}),(i.search||i.type!=="all"||i.status!=="all")&&r.jsx("button",{onClick:()=>c({search:"",type:"all",status:"all"}),className:"text-primary-600 hover:text-primary-500",children:"Clear Filters"})]})]})}function Pg(){const{name:e}=h0(),[t,n]=d.useState(null),[s,l]=d.useState("overview");if(d.useEffect(()=>{(async()=>{try{const c=await Oe.getPackage(e??"");n(c)}catch(c){console.error("Error fetching packages:",c)}})()},[e]),!t)return r.jsx(Ti,{message:"Loading package details..."});const a=()=>{var i;switch(s){case"overview":return r.jsx("div",{className:"py-6",children:r.jsxs("div",{className:"bg-white border rounded-lg p-6",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:"Package Overview"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-2",children:"Description"}),r.jsx("p",{className:"text-gray-600 mb-4",children:t.description}),r.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-2",children:"Maintainers"}),r.jsx("div",{className:"space-y-1",children:Object.keys(t.maintainers).map(c=>r.jsx("div",{className:"text-sm text-gray-600",children:c},c))})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-2",children:"Quick Stats"}),r.jsxs("div",{className:"space-y-2 text-sm",children:[r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-600",children:"Dependencies:"}),r.jsx("span",{className:"font-medium",children:t.dependenciesInfo.filter(c=>c.type=="dependency").length})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-600",children:"Dev Dependencies:"}),r.jsx("span",{className:"font-medium",children:t.dependenciesInfo.filter(c=>c.type=="devDependency").length})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-600",children:"Peer Dependencies:"}),r.jsx("span",{className:"font-medium",children:t.dependenciesInfo.filter(c=>c.type=="peerDependency").length})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-600",children:"Scripts:"}),r.jsx("span",{className:"font-medium",children:Object.keys(t.scripts).length})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-600",children:"Recent Commits:"}),r.jsx("span",{className:"font-medium",children:(i=t.commits)==null?void 0:i.length})]})]})]})]})]})});case"dependencies":return r.jsx(Ng,{packageData:t});case"commits":return r.jsx(bg,{packageData:t});case"health":return r.jsx(kg,{packageData:t});case"config":return r.jsx(Sg,{packageData:t});default:return null}};return r.jsxs("div",{className:"space-y-6",children:[r.jsx(jg,{packageData:t}),r.jsxs("div",{className:"bg-white rounded-lg shadow border",children:[r.jsx(wg,{activeTab:s,onTabChange:l}),r.jsx("div",{className:"px-6",children:a()})]})]})}function Lg({message:e="Loading dependency graph..."}){return r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600",children:e})]})})}function Rg({error:e,onRetry:t}){return r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsxs("div",{className:"text-center",children:[r.jsx(te,{className:"w-12 h-12 text-red-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-red-600",children:e}),t&&r.jsx("button",{onClick:t,className:"mt-4 bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 transition-colors",children:"Retry"})]})})}function Tg({onRefresh:e,loading:t=!1}){return r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Dependency Graph"}),r.jsx("p",{className:"text-gray-600 mt-1",children:"Visualize package dependencies and relationships"})]}),e&&r.jsxs("button",{onClick:e,disabled:t,className:"hidden bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-2 transition-colors",children:[r.jsx(ot,{className:`w-5 h-5 ${t?"animate-spin":""}`}),r.jsx("span",{children:"Refresh"})]})]})}function Mg({viewMode:e,onViewModeChange:t,layout:n,onLayoutChange:s,showLegend:l,onToggleLegend:a,zoomLevel:i,onZoomChange:c}){return r.jsxs("div",{className:"bg-white p-4 rounded-lg shadow border flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("span",{className:"text-sm font-medium text-gray-700",children:"View:"}),r.jsxs("div",{className:"flex rounded-lg border border-gray-300 overflow-hidden",children:[r.jsxs("button",{onClick:()=>t("graph"),className:`px-3 py-2 text-sm font-medium flex items-center space-x-1 ${e==="graph"?"bg-blue-600 text-white":"bg-white text-gray-700 hover:bg-gray-50"}`,children:[r.jsx(vp,{className:"w-4 h-4"}),r.jsx("span",{children:"Graph"})]}),r.jsxs("button",{onClick:()=>t("list"),className:`px-3 py-2 text-sm font-medium flex items-center space-x-1 ${e==="list"?"bg-blue-600 text-white":"bg-white text-gray-700 hover:bg-gray-50"}`,children:[r.jsx(ep,{className:"w-4 h-4"}),r.jsx("span",{children:"List"})]})]})]}),e==="graph"&&r.jsxs("div",{className:"flex items-center space-x-4",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Layout:"}),r.jsxs("select",{value:n,onChange:o=>s(o.target.value),className:"border border-gray-300 rounded-md px-3 py-1 text-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[r.jsx("option",{value:"hierarchical",children:"Hierarchical"}),r.jsx("option",{value:"circular",children:"Circular"}),r.jsx("option",{value:"force",children:"Force-Directed"})]})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Zoom:"}),r.jsxs("div",{className:"flex items-center space-x-1",children:[r.jsx("button",{onClick:()=>c(Math.max(.5,i-.1)),className:"p-1 text-gray-600 hover:text-gray-800 disabled:opacity-50",disabled:i<=.5,children:r.jsx(rp,{className:"w-4 h-4"})}),r.jsxs("span",{className:"text-sm text-gray-600 min-w-[3rem] text-center",children:[Math.round(i*100),"%"]}),r.jsx("button",{onClick:()=>c(Math.min(2,i+.1)),className:"p-1 text-gray-600 hover:text-gray-800 disabled:opacity-50",disabled:i>=2,children:r.jsx(ap,{className:"w-4 h-4"})})]})]})]}),r.jsxs("button",{onClick:a,className:`px-3 py-2 text-sm font-medium rounded-lg flex items-center space-x-1 transition-colors ${l?"bg-blue-100 text-blue-700":"bg-gray-100 text-gray-700 hover:bg-gray-200"}`,children:[r.jsx(vn,{className:"w-4 h-4"}),r.jsx("span",{children:"Legend"})]})]})}const Gd=e=>{switch(e){case"healthy":return"text-green-600 bg-green-100";case"warning":return"text-yellow-600 bg-yellow-100";case"error":return"text-red-600 bg-red-100";default:return"text-gray-600 bg-gray-100"}},Kd=e=>{switch(e){case"app":return"text-blue-600 bg-blue-100";case"lib":return"text-purple-600 bg-purple-100";case"tool":return"text-orange-600 bg-orange-100";default:return"text-gray-600 bg-gray-100"}},cc=(e,t)=>{const n=t.find(s=>s.name===e);if(!n)return"text-gray-400";switch(n.status){case"healthy":return"text-green-500";case"warning":return"text-yellow-500";case"error":return"text-red-500";default:return"text-gray-400"}},_g=e=>{const t=e.length,n=e.reduce((o,u)=>o+Object.keys(u.dependencies).length,0),s=e.filter(o=>Object.keys(o.dependencies).length===0).length,l=e.filter(o=>o.dependents.length===0).length,a=Og(e),i=t>0?n/t:0,c=Xd(e);return{totalPackages:t,totalDependencies:n,circularDependencies:c.length,leafPackages:s,rootPackages:l,maxDepth:a,avgDependencies:Math.round(i*10)/10}},Og=e=>{const t=new Set;let n=0;const s=(l,a)=>{if(t.has(l))return a;t.add(l);const i=e.find(o=>o.name===l);if(!i)return a;let c=a;for(const o of Object.keys(i.dependencies)){const u=s(o,a+1);c=Math.max(c,u)}return c};for(const l of e)if(!t.has(l.name)){const a=s(l.name,0);n=Math.max(n,a)}return n},Xd=e=>{const t=[],n=new Set,s=new Set,l=[],a=i=>{if(s.has(i)){const o=l.indexOf(i),u=l.slice(o).concat(i);return t.push({cycle:u,severity:u.length>5?"high":u.length>3?"medium":"low",impact:`Circular dependency involving ${u.length} packages`}),!0}if(n.has(i))return!1;n.add(i),s.add(i),l.push(i);const c=e.find(o=>o.name===i);if(c){for(const o of Object.keys(c.dependencies))if(a(o))return!0}return s.delete(i),l.pop(),!1};for(const i of e)n.has(i.name)||a(i.name);return t},$g=(e,t,n)=>[...e].sort((s,l)=>{let a,i;switch(t){case"name":a=s.name.toLowerCase(),i=l.name.toLowerCase();break;case"dependencies":a=Object.keys(s.dependencies).length,i=Object.keys(l.dependencies).length;break;case"dependents":a=s.dependents.length,i=l.dependents.length;break;case"status":{const c={error:0,warning:1,healthy:2};a=c[s.status]||3,i=c[l.status]||3;break}default:return 0}return a<i?n==="asc"?-1:1:a>i?n==="asc"?1:-1:0}),Ig=(e,t,n=800,s=600)=>{switch(t){case"hierarchical":return Fg(e,n,s);case"circular":return Dg(e,n,s);case"force":return Ag(e,n,s);default:return e}},Fg=(e,t,n)=>{const s=[],l=new Set,a=(i,c)=>{if(l.has(i))return;l.add(i),s[c]||(s[c]=[]),s[c].push(i);const o=e.find(u=>u.name===i);o&&o.dependents.forEach(u=>a(u,c+1))};return e.filter(i=>Object.keys(i.dependencies).length===0&&i.dependents.length>0).forEach(i=>{a(i.name,0)}),s.length===0&&e.filter(i=>Object.keys(i.dependencies).length>0&&i.dependents.length>0).forEach(i=>{a(i.name,0)}),e.map(i=>{var p,m;const c=s.findIndex(g=>g.includes(i.name)),o=((p=s[c])==null?void 0:p.indexOf(i.name))||0,u=((m=s[c])==null?void 0:m.length)||1;return{...i,x:t/(s.length+1)*(c+1)-50,y:n/(u+1)*(o+1)-25}})},Dg=(e,t,n)=>{const s=t/2,l=n/2,a=Math.min(t,n)/3;return e.map((i,c)=>{const o=2*Math.PI*c/e.length;return{...i,x:s+a*Math.cos(o)-50,y:l+a*Math.sin(o)-25}})},Ag=(e,t,n)=>{const s=e.map((l,a)=>({...l,x:Math.random()*(t-100),y:Math.random()*(n-50)}));for(let l=0;l<50;l++)s.forEach(a=>{let i=0,c=0;s.forEach(o=>{if(o.name!==a.name){const u=a.x-o.x,p=a.y-o.y,m=Math.sqrt(u*u+p*p)||1,g=1e3/(m*m);i+=u/m*g,c+=p/m*g}}),Object.keys(a.dependencies).forEach(o=>{const u=s.find(p=>p.name===o);if(u){const p=u.x-a.x,m=u.y-a.y,g=Math.sqrt(p*p+m*m)||1,v=g*.01;i+=p/g*v,c+=m/g*v}}),a.x+=i*.1,a.y+=c*.1,a.x=Math.max(50,Math.min(t-100,a.x)),a.y=Math.max(25,Math.min(n-50,a.y))});return s},zg=e=>{switch(e){case"app":return"🚀";case"lib":return"📚";case"tool":return"🔧";default:return"📦"}},Bg=e=>e.length>12?`${e.substring(0,12)}...`:e,Ug=e=>{const t={};return e.forEach(n=>{t[n.name]=[]}),e.forEach(n=>{const s=n.name;[...Object.keys(n.dependencies??{}),...Object.keys(n.devDependencies??{}),...Object.keys(n.peerDependencies??{})].forEach(a=>{t[a]||(t[a]=[]),t[a].includes(s)||t[a].push(s)})}),t};function Hg({packages:e,selectedPackage:t,hoveredPackage:n,onPackageSelect:s,onPackageHover:l,layout:a}){return r.jsxs("div",{className:"relative bg-white rounded-lg shadow-sm border border-gray-200 p-6 min-h-[600px]",children:[r.jsxs("svg",{className:"w-full h-full absolute inset-0",viewBox:"0 0 800 600",children:[e.map(i=>Object.keys(i.dependencies).map(c=>{const o=e.find(p=>p.name===c);if(!o)return null;console.log("Rendering edge from",i.name,"to",o.name);const u=n===i.name||n===c||t===i.name||t===c;return r.jsxs("g",{children:[r.jsx("defs",{children:r.jsx("marker",{id:`arrow-${i.name}-${c}`,markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:r.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:u?"#3B82F6":"#6B7280"})})}),r.jsx("line",{x1:o.x+50,y1:o.y+25,x2:i.x,y2:i.y+25,stroke:u?"#3B82F6":"#6B7280",strokeWidth:u?"3":"2",markerEnd:`url(#arrow-${i.name}-${c})`,className:"transition-all duration-200",style:{opacity:u?1:.6}})]},`${i.name}-${c}`)})),e.map(i=>{const c=t===i.name,o=n===i.name,u=t&&(Object.keys(i.dependencies).includes(t)||Object.keys(i.dependents).includes(t));return r.jsxs("g",{children:[r.jsx("rect",{x:i.x,y:i.y,width:"100",height:"50",rx:"8",fill:"white",stroke:c?"#3B82F6":u?"#10B981":o?"#6B7280":"#E5E7EB",strokeWidth:c?"3":"2",className:"cursor-pointer transition-all duration-200",style:{filter:o||c||u?"drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1))":"none"},onMouseEnter:()=>l(i.name),onMouseLeave:()=>l(null),onClick:()=>s(c?null:i.name)}),r.jsx("text",{x:i.x+50,y:i.y+20,textAnchor:"middle",className:"text-xs font-medium fill-gray-900 pointer-events-none",children:Bg(i.name)}),r.jsxs("text",{x:i.x+50,y:i.y+35,textAnchor:"middle",className:"text-xs fill-gray-500 pointer-events-none",children:["v",i.version]}),r.jsx("circle",{cx:i.x+85,cy:i.y+15,r:"6",fill:i.status==="healthy"?"#10B981":i.status==="warning"?"#F59E0B":"#EF4444",className:"pointer-events-none"}),r.jsx("rect",{x:i.x+5,y:i.y+5,width:"12",height:"8",rx:"2",fill:i.type==="app"?"#3B82F6":i.type==="lib"?"#8B5CF6":"#F97316",className:"pointer-events-none"})]},i.name)})]}),e.length===0&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-gray-400 text-6xl mb-4",children:"🔗"}),r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"No dependencies found"}),r.jsx("p",{className:"text-gray-600",children:"No package dependencies to display."})]})})]})}function Vg({packages:e,selectedPackage:t,onPackageSelect:n,sortBy:s,sortOrder:l,onSortChange:a}){const i=o=>{a(o,s===o&&l==="asc"?"desc":"asc")},c=o=>s!==o?null:l==="asc"?r.jsx(Si,{className:"w-4 h-4"}):r.jsx(zd,{className:"w-4 h-4"});return r.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200",children:[r.jsxs("div",{className:"p-6 border-b border-gray-200",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Package Dependencies"}),r.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"Click on a view details to explore its dependencies, commits, configuration and health"})]}),r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"min-w-full divide-y divide-gray-200",children:[r.jsx("thead",{className:"bg-gray-50",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider cursor-pointer hover:bg-gray-100",onClick:()=>i("name"),children:r.jsxs("div",{className:"flex items-center space-x-1",children:[r.jsx("span",{children:"Package"}),c("name")]})}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Type"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Status"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider cursor-pointer hover:bg-gray-100",onClick:()=>i("dependencies"),children:r.jsxs("div",{className:"flex items-center space-x-1",children:[r.jsx("span",{children:"Dependencies"}),c("dependencies")]})}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider cursor-pointer hover:bg-gray-100",onClick:()=>i("dependents"),children:r.jsxs("div",{className:"flex items-center space-x-1",children:[r.jsx("span",{children:"Dependents"}),c("dependents")]})}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Actions"})]})}),r.jsx("tbody",{className:"bg-white divide-y divide-gray-200",children:e.map(o=>r.jsxs("tr",{className:`hover:bg-gray-50 cursor-pointer transition-colors ${t===o.name?"bg-blue-50":""}`,onClick:()=>n(o.name),children:[r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"text-2xl mr-3",children:zg(o.type)}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium text-gray-900",children:o.name}),r.jsxs("div",{className:"text-sm text-gray-500",children:["v",o.version]})]})]})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${Kd(o.type)}`,children:o.type})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${Gd(o.status)}`,children:o.status})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsxs("div",{className:"text-sm text-gray-900",children:[Object.keys(o.dependencies).length,Object.keys(o.dependencies).length>0&&r.jsxs("div",{className:"text-xs text-gray-500 mt-1",children:[Object.keys(o.dependencies).slice(0,3).join(", "),Object.keys(o.dependencies).length>3&&` +${Object.keys(o.dependencies).length-3} more`]})]})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsxs("div",{className:"text-sm text-gray-900",children:[o.dependents.length,o.dependents.length>0&&r.jsxs("div",{className:"text-xs text-gray-500 mt-1",children:[o.dependents.slice(0,3).join(", "),o.dependents.length>3&&` +${o.dependents.length-3} more`]})]})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm",children:r.jsx(rt,{to:`/packages/${encodeURIComponent(o.name)}`,className:"text-blue-600 hover:text-blue-500",onClick:u=>u.stopPropagation(),children:"View Details"})})]},o.name))})]})}),e.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx("div",{className:"text-gray-400 text-4xl mb-2",children:"📦"}),r.jsx("p",{className:"text-gray-500",children:"No packages found"})]})]})}function Wg({package:e,packages:t,onClose:n}){return e?r.jsxs("div",{className:"absolute top-4 right-4 bg-white p-4 rounded-lg shadow-lg border border-gray-200 w-80 max-h-[80vh] overflow-y-auto",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:e.name}),r.jsx("button",{onClick:n,className:"text-gray-400 hover:text-gray-600 transition-colors",children:r.jsx(Pr,{className:"w-5 h-5"})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${Kd(e.type)}`,children:e.type}),r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${Gd(e.status)}`,children:e.status})]}),r.jsxs("div",{className:"text-sm text-gray-600",children:["Version: ",r.jsx("span",{className:"font-mono",children:e.version})]})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700",children:"Dependencies"}),r.jsxs("span",{className:"text-xs text-gray-500",children:["(",Object.keys(e.dependencies).length,")"]})]}),Object.keys(e.dependencies).length>0?r.jsx("div",{className:"space-y-1 max-h-32 overflow-y-auto",children:Object.keys(e.dependencies).map(s=>{const l=t.find(a=>a.name===s);return l?r.jsxs("div",{className:"flex items-center justify-between text-sm py-1",children:[r.jsx("span",{className:"text-gray-600 truncate",children:l.name}),r.jsxs("div",{className:"flex items-center space-x-1",children:[r.jsx("span",{className:"text-xs text-gray-400",children:l.version}),r.jsx("span",{className:`${cc(s,t)}`,children:l.status==="healthy"?"✓":l.status==="warning"?"⚠":"✗"})]})]},s):r.jsxs("div",{className:"text-sm text-gray-400 py-1",children:[s," (not found)"]},s)})}):r.jsx("div",{className:"text-sm text-gray-500 text-center py-2",children:"No dependencies"})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700",children:"Dependents"}),r.jsxs("span",{className:"text-xs text-gray-500",children:["(",e.dependents.length,")"]})]}),e.dependents.length>0?r.jsx("div",{className:"space-y-1 max-h-32 overflow-y-auto",children:e.dependents.map(s=>{const l=t.find(a=>a.name===s);return l?r.jsxs("div",{className:"flex items-center justify-between text-sm py-1",children:[r.jsx("span",{className:"text-gray-600 truncate",children:l.name}),r.jsxs("div",{className:"flex items-center space-x-1",children:[r.jsx("span",{className:"text-xs text-gray-400",children:l.version}),r.jsx("span",{className:`${cc(s,t)}`,children:l.status==="healthy"?"✓":l.status==="warning"?"⚠":"✗"})]})]},s):r.jsxs("div",{className:"text-sm text-gray-400 py-1",children:[s," (not found)"]},s)})}):r.jsx("div",{className:"text-sm text-gray-500 text-center py-2",children:"No dependents"})]}),r.jsxs("div",{className:"pt-2 border-t border-gray-200",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-2",children:"Impact Analysis"}),r.jsxs("div",{className:"space-y-1 text-xs text-gray-600",children:[r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{children:"Direct dependencies:"}),r.jsx("span",{className:"font-medium",children:Object.keys(e.dependencies).length})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{children:"Direct dependents:"}),r.jsx("span",{className:"font-medium",children:e.dependents.length})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{children:"Risk level:"}),r.jsx("span",{className:`font-medium ${e.dependents.length>5?"text-red-600":e.dependents.length>2?"text-yellow-600":"text-green-600"}`,children:e.dependents.length>5?"High":e.dependents.length>2?"Medium":"Low"})]})]})]}),r.jsx("div",{className:"pt-2 border-t border-gray-200",children:r.jsx(rt,{to:`/packages/${encodeURIComponent(e.name)}`,className:"block w-full text-center bg-blue-600 text-white px-3 py-2 rounded-lg hover:bg-blue-700 text-sm font-medium transition-colors",children:"View Package Details →"})})]})]}):null}function Qg({stats:e,packages:t}){return r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[r.jsx("div",{className:"bg-white p-4 rounded-lg shadow border",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-2 bg-blue-100 rounded-lg",children:r.jsx(qs,{className:"w-6 h-6 text-blue-600"})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Total Packages"}),r.jsx("p",{className:"text-2xl font-semibold text-gray-900",children:e.totalPackages})]})]})}),r.jsx("div",{className:"bg-white p-4 rounded-lg shadow border",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-2 bg-green-100 rounded-lg",children:r.jsx(ot,{className:"w-6 h-6 text-green-600"})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Dependencies"}),r.jsx("p",{className:"text-2xl font-semibold text-gray-900",children:e.totalDependencies})]})]})}),r.jsx("div",{className:"bg-white p-4 rounded-lg shadow border",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:`p-2 rounded-lg ${e.circularDependencies>0?"bg-red-100":"bg-green-100"}`,children:r.jsx(te,{className:`w-6 h-6 ${e.circularDependencies>0?"text-red-600":"text-green-600"}`})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Circular Deps"}),r.jsx("p",{className:`text-2xl font-semibold ${e.circularDependencies>0?"text-red-600":"text-green-600"}`,children:e.circularDependencies})]})]})}),r.jsx("div",{className:"bg-white p-4 rounded-lg shadow border",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-2 bg-purple-100 rounded-lg",children:r.jsx(Er,{className:"w-6 h-6 text-purple-600"})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Max Depth"}),r.jsx("p",{className:"text-2xl font-semibold text-gray-900",children:e.maxDepth})]})]})}),r.jsxs("div",{className:"md:col-span-4 bg-white p-4 rounded-lg shadow border",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:"Dependency Analysis"}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-2xl font-bold text-blue-600",children:e.leafPackages}),r.jsx("div",{className:"text-sm text-gray-600",children:"Leaf Packages"}),r.jsx("div",{className:"text-xs text-gray-500",children:"No dependencies"})]}),r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-2xl font-bold text-green-600",children:e.rootPackages}),r.jsx("div",{className:"text-sm text-gray-600",children:"Root Packages"}),r.jsx("div",{className:"text-xs text-gray-500",children:"No dependents"})]}),r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-2xl font-bold text-purple-600",children:e.avgDependencies}),r.jsx("div",{className:"text-sm text-gray-600",children:"Avg Dependencies"}),r.jsx("div",{className:"text-xs text-gray-500",children:"Per package"})]}),r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-2xl font-bold text-orange-600",children:t.filter(n=>n.status==="healthy").length}),r.jsx("div",{className:"text-sm text-gray-600",children:"Healthy Packages"}),r.jsxs("div",{className:"text-xs text-gray-500",children:[Math.round(t.filter(n=>n.status==="healthy").length/t.length*100),"% of total"]})]})]})]})]})}function Yg({cycles:e,packages:t,onPackageSelect:n}){const s=a=>{switch(a){case"high":return"bg-red-100 text-red-800 border-red-200";case"medium":return"bg-yellow-100 text-yellow-800 border-yellow-200";case"low":return"bg-blue-100 text-blue-800 border-blue-200";default:return"bg-gray-100 text-gray-800 border-gray-200"}},l=a=>{switch(a){case"high":return"🔴";case"medium":return"🟡";case"low":return"🔵";default:return"⚪"}};return e.length===0?r.jsxs("div",{className:"bg-white p-6 rounded-lg shadow border",children:[r.jsxs("div",{className:"flex items-center space-x-3 mb-4",children:[r.jsx("div",{className:"p-2 bg-green-100 rounded-lg",children:r.jsx(te,{className:"w-6 h-6 text-green-600"})}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Circular Dependencies"}),r.jsx("p",{className:"text-sm text-gray-600",children:"Dependency cycle analysis"})]})]}),r.jsxs("div",{className:"text-center py-8",children:[r.jsx("div",{className:"text-green-400 text-4xl mb-2"}),r.jsx("h4",{className:"text-green-800 font-medium mb-1",children:"No Circular Dependencies!"}),r.jsx("p",{className:"text-green-700 text-sm",children:"Your dependency graph is clean and free of circular references."})]})]}):r.jsxs("div",{className:"bg-white p-6 rounded-lg shadow border",children:[r.jsxs("div",{className:"flex items-center space-x-3 mb-4",children:[r.jsx("div",{className:"p-2 bg-red-100 rounded-lg",children:r.jsx(te,{className:"w-6 h-6 text-red-600"})}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Circular Dependencies"}),r.jsxs("p",{className:"text-sm text-gray-600",children:["Found ",e.length," circular dependency cycle",e.length>1?"s":""]})]})]}),r.jsx("div",{className:"space-y-4",children:e.map((a,i)=>r.jsxs("div",{className:`border rounded-lg p-4 ${s(a.severity)}`,children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("span",{className:"text-lg",children:l(a.severity)}),r.jsxs("span",{className:"text-sm font-medium capitalize",children:[a.severity," Severity"]})]}),r.jsxs("span",{className:"text-xs opacity-75",children:[a.cycle.length," packages affected"]})]}),r.jsx("div",{className:"mb-3",children:r.jsx("p",{className:"text-sm mb-2",children:a.impact})}),r.jsx("div",{className:"bg-white bg-opacity-50 rounded-lg p-3",children:r.jsxs("div",{className:"flex items-center flex-wrap gap-2",children:[a.cycle.map((c,o)=>r.jsxs(React.Fragment,{children:[r.jsx("button",{onClick:()=>n(c),className:"px-3 py-1 bg-white rounded-lg text-sm font-medium hover:bg-gray-50 transition-colors border shadow-sm",children:c}),o<a.cycle.length-1&&r.jsx(tc,{className:"w-4 h-4 text-gray-400"})]},`${c}-${o}`)),a.cycle.length>1&&r.jsxs(r.Fragment,{children:[r.jsx(tc,{className:"w-4 h-4 text-gray-400"}),r.jsxs("span",{className:"text-sm text-gray-500 italic",children:["(cycles back to ",a.cycle[0],")"]})]})]})}),r.jsxs("div",{className:"mt-3 pt-3 border-t border-current border-opacity-20",children:[r.jsx("h5",{className:"text-xs font-medium mb-1",children:"Recommendation:"}),r.jsxs("p",{className:"text-xs opacity-90",children:[a.severity==="high"&&"Critical: Refactor immediately to break this cycle. Consider dependency inversion or splitting packages.",a.severity==="medium"&&"Important: Plan to refactor this cycle. Review package boundaries and extract common dependencies.",a.severity==="low"&&"Minor: Monitor this cycle. Consider if these packages could be merged or dependencies restructured."]})]})]},i))}),r.jsx("div",{className:"mt-6 pt-4 border-t border-gray-200",children:r.jsxs("div",{className:"grid grid-cols-3 gap-4 text-center",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-lg font-bold text-red-600",children:e.filter(a=>a.severity==="high").length}),r.jsx("div",{className:"text-xs text-gray-600",children:"High Severity"})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-lg font-bold text-yellow-600",children:e.filter(a=>a.severity==="medium").length}),r.jsx("div",{className:"text-xs text-gray-600",children:"Medium Severity"})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-lg font-bold text-blue-600",children:e.filter(a=>a.severity==="low").length}),r.jsx("div",{className:"text-xs text-gray-600",children:"Low Severity"})]})]})})]})}function Zg({show:e}){return e?r.jsxs("div",{className:"bg-white p-4 rounded-lg shadow border",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 mb-3",children:"Legend"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("h5",{className:"text-xs font-medium text-gray-700 mb-2",children:"Package Types"}),r.jsxs("div",{className:"grid grid-cols-3 gap-2 text-xs",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("div",{className:"w-3 h-2 bg-blue-500 rounded"}),r.jsx("span",{children:"App"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("div",{className:"w-3 h-2 bg-purple-500 rounded"}),r.jsx("span",{children:"Library"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("div",{className:"w-3 h-2 bg-orange-500 rounded"}),r.jsx("span",{children:"Tool"})]})]})]}),r.jsxs("div",{children:[r.jsx("h5",{className:"text-xs font-medium text-gray-700 mb-2",children:"Health Status"}),r.jsxs("div",{className:"grid grid-cols-3 gap-2 text-xs",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("div",{className:"w-3 h-3 bg-green-500 rounded-full"}),r.jsx("span",{children:"Healthy"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("div",{className:"w-3 h-3 bg-yellow-500 rounded-full"}),r.jsx("span",{children:"Warning"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("div",{className:"w-3 h-3 bg-red-500 rounded-full"}),r.jsx("span",{children:"Error"})]})]})]}),r.jsxs("div",{children:[r.jsx("h5",{className:"text-xs font-medium text-gray-700 mb-2",children:"Visual Elements"}),r.jsxs("div",{className:"space-y-1 text-xs",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsxs("svg",{width:"16",height:"8",children:[r.jsx("line",{x1:"0",y1:"4",x2:"16",y2:"4",stroke:"#6B7280",strokeWidth:"2",markerEnd:"url(#arrow)"}),r.jsx("defs",{children:r.jsx("marker",{id:"arrow",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:r.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6B7280"})})})]}),r.jsx("span",{children:"Dependency"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("div",{className:"w-4 h-3 border-2 border-blue-500 rounded bg-white"}),r.jsx("span",{children:"Selected"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("div",{className:"w-4 h-3 border-2 border-green-500 rounded bg-white"}),r.jsx("span",{children:"Connected"})]})]})]}),r.jsxs("div",{children:[r.jsx("h5",{className:"text-xs font-medium text-gray-700 mb-2",children:"Interactions"}),r.jsxs("div",{className:"space-y-1 text-xs text-gray-600",children:[r.jsx("div",{children:"• Click a package to select and view details"}),r.jsx("div",{children:"• Hover to highlight connections"}),r.jsx("div",{children:"• Use toolbar to change layout and zoom"})]})]})]})]}):null}function Gg(){d.useEffect(()=>{(async()=>{try{t(!0);const He=await Oe.getPackages(),Tn=Ug(He),P=He.map(T=>({...T,dependencies:{...T.dependencies,...T.devDependencies,...T.peerDependencies},dependents:Tn[T.name]}));a(P),s(null)}catch(He){s("Failed to fetch packages"),console.error("Error fetching packages:",He)}finally{t(!1)}})()},[]);const[e,t]=d.useState(!1),[n,s]=d.useState(null),[l,a]=d.useState([]),[i,c]=d.useState("graph"),[o,u]=d.useState("hierarchical"),[p,m]=d.useState(null),[g,v]=d.useState(null),[j,N]=d.useState(!0),[b,x]=d.useState(1),[h,f]=d.useState("name"),[w,S]=d.useState("asc"),E=d.useMemo(()=>Ig(l??[],o,800,600),[l,o]),y=d.useMemo(()=>$g(l,h,w),[l,h,w]),C=d.useMemo(()=>_g(l),[l]),$=d.useMemo(()=>Xd(l),[l]),R=p&&l.find($e=>$e.name===p)||null,B=()=>{console.log("Refreshing dependency graph...")},ae=$e=>{m($e)},we=($e,He)=>{f($e),S(He)},ne=()=>{window.location.reload()};return e?r.jsx(Lg,{}):n?r.jsx(Rg,{error:n,onRetry:ne}):r.jsxs("div",{className:"space-y-6",children:[r.jsx(Tg,{onRefresh:B,loading:e}),r.jsx(Qg,{stats:C,packages:l??[]}),$.length>0&&r.jsx(Yg,{cycles:$,packages:l,onPackageSelect:ae}),r.jsx(Mg,{viewMode:i,onViewModeChange:c,layout:o,onLayoutChange:u,showLegend:j,onToggleLegend:()=>N(!j),zoomLevel:b,onZoomChange:x}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6",children:[r.jsx("div",{className:`${j?"lg:col-span-3":"lg:col-span-4"}`,children:i==="graph"?r.jsxs("div",{className:"relative",children:[r.jsx("div",{style:{transform:`scale(${b})`,transformOrigin:"top left"},children:r.jsx(Hg,{packages:E,selectedPackage:p,hoveredPackage:g,onPackageSelect:ae,onPackageHover:v,layout:o})}),r.jsx(Wg,{package:R,packages:l,onClose:()=>m(null)})]}):r.jsx(Vg,{packages:y,selectedPackage:p,onPackageSelect:ae,sortBy:h,sortOrder:w,onSortChange:we})}),j&&r.jsx("div",{className:"lg:col-span-1",children:r.jsx(Zg,{show:j})})]}),l.length===0&&!e&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx("div",{className:"text-gray-400 text-6xl mb-4",children:"🔗"}),r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"No dependencies found"}),r.jsx("p",{className:"text-gray-600 mb-4",children:"No package dependencies available to display."})]})]})}function Kg(){var h,f,w,S,E;const[e,t]=d.useState(0),[n,s]=d.useState(null),[l,a]=d.useState(!0),[i,c]=d.useState(null),[o,u]=d.useState(!1);d.useEffect(()=>{(async()=>{try{a(!0);const C=await Oe.getHealthStatus();console.log("Health data from inside useEffect:",C),s(C),c(null)}catch(C){c("Failed to fetch health data"),console.error("Error fetching health data:",C)}finally{a(!1)}})()},[e]),console.log("Health data from outside of useEffect:",n);const p=async()=>{try{u(!0),c(null),a(!0);try{const y=await Oe.refreshHealthStatus();console.log("Health data:",y),s(y),c(null)}catch(y){c("Failed to fetch health data"),console.error("Error fetching health data:",y)}finally{a(!1)}}catch(y){c("Failed to refresh health data"),console.error("Error refreshing health data:",y)}finally{u(!1)}},m=()=>{t(y=>y+1)},g=y=>{switch(y){case"healthy":case"success":case"pass":case"up-to-date":return"bg-green-100 text-green-800";case"warning":case"warn":case"outdated":return"bg-yellow-100 text-yellow-800";case"error":case"failed":case"fail":case"vulnerable":return"bg-red-100 text-red-800";default:return"bg-gray-100 text-gray-800"}};if(l&&!n)return r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600",children:"Loading health data..."})]})});if(i)return r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsxs("div",{className:"text-center",children:[r.jsx(te,{className:"w-12 h-12 text-red-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-red-600",children:i}),r.jsx("button",{onClick:m,className:"mt-4 bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 transition-colors",children:"Retry"})]})});const v=n?(h=n.summary)==null?void 0:h.averageScore:0,j=n?(f=n==null?void 0:n.packages)==null?void 0:f.filter(y=>y.health.overallScore>=80).length:0,N=n?(w=n==null?void 0:n.packages)==null?void 0:w.filter(y=>y.health.overallScore>=60&&y.health.overallScore<80).length:0,b=n?(S=n==null?void 0:n.packages)==null?void 0:S.filter(y=>y.health.overallScore<60).length:0,x=[{name:"Package Health",value:j||0,status:(()=>{const y=j||0,C=(n==null?void 0:n.packages.length)||0;if(C===0)return"healthy";const $=y/C;return $>=.8?"healthy":$>=.6?"warning":"error"})(),description:`${j||0} healthy packages out of ${(n==null?void 0:n.packages.length)||0}`},{name:"Overall Score",value:Math.round(v),status:Math.round(v)>=80?"healthy":Math.round(v)>=60?"warning":"error",description:`Average health score: ${Math.round(v)}/100`},{name:"Unhealthy Packages",value:N+b||0,status:(N+b||0)===0?"healthy":(N+b||0)<=2?"warning":"error",description:`${N+b||0} packages need attention`}];return r.jsxs("div",{className:"",children:[r.jsxs("div",{className:"flex items-center justify-between my-3",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Health Status"}),r.jsx("p",{className:"text-gray-600 mt-1",children:"Monitor the health and performance of your monorepo packages"})]}),r.jsxs("button",{onClick:p,disabled:o,className:"bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 disabled:bg-blue-400 disabled:cursor-not-allowed flex items-center space-x-2 transition-colors",children:[o?r.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}):r.jsx(ot,{className:"w-5 h-5"}),r.jsx("span",{children:o?"Refreshing...":"Refresh"})]})]}),o&&n&&r.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-70 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-white p-6 rounded-lg shadow-lg text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-700",children:"Refreshing health data..."})]})}),r.jsxs("div",{className:"my-3 bg-gradient-to-r from-blue-500 to-purple-600 rounded-lg p-6 text-white",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-xl font-semibold",children:"Overall Monorepo Health"}),r.jsx("p",{className:"text-blue-100 mt-1",children:"Based on all package metrics and recent activity"})]}),r.jsxs("div",{className:"text-right",children:[r.jsx("div",{className:"text-4xl font-bold",children:v==null?void 0:v.toFixed(2)}),r.jsx("div",{className:"text-blue-100",children:"out of 100"})]})]}),r.jsxs("div",{className:"mt-4 flex space-x-4",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Ke,{className:"w-5 h-5 text-green-300"}),r.jsxs("span",{children:[j," Healthy"]})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(te,{className:"w-5 h-5 text-yellow-300"}),r.jsxs("span",{children:[N," Warnings"]})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Xe,{className:"w-5 h-5 text-red-300"}),r.jsxs("span",{children:[b," Errors"]})]})]})]}),r.jsx("div",{className:"my-3 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:x.map(y=>r.jsxs("div",{className:"bg-white p-6 rounded-lg shadow border",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:y.name}),r.jsx("div",{className:`w-3 h-3 rounded-full ${y.status==="healthy"?"bg-green-500":y.status==="warning"?"bg-yellow-500":"bg-red-500"}`})]}),r.jsx("div",{className:"flex items-end space-x-2",children:r.jsx("span",{className:"text-3xl font-bold text-gray-900",children:y.value})}),r.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${g(y.status)}`,children:y.status}),r.jsx("span",{className:"text-sm text-gray-500",children:y.description})]})]},y.name))}),r.jsxs("div",{className:"my-3 bg-white rounded-lg shadow border overflow-hidden",children:[r.jsx("div",{className:"px-6 py-4 border-b border-gray-200",children:r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Package Health Details"})}),r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"min-w-full divide-y divide-gray-200",children:[r.jsx("thead",{className:"bg-gray-50",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Package"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Overall Score"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Build Status"}),r.jsx("th",{className:"hidden px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Test Coverage"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Lint Status"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Security"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Dependencies"}),r.jsx("th",{className:"hidden px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Actions"})]})}),r.jsx("tbody",{className:"bg-white divide-y divide-gray-200",children:(E=n==null?void 0:n.packages)==null?void 0:E.map(y=>r.jsxs("tr",{className:"hover:bg-gray-50",children:[r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"h-8 w-8 rounded-lg bg-gray-100 flex items-center justify-center",children:r.jsx("div",{className:"text-sm",children:"📦"})}),r.jsxs("div",{className:"ml-3",children:[r.jsx("div",{className:"text-sm font-medium text-gray-900",children:y.packageName}),r.jsxs("div",{className:"text-sm text-gray-500",children:["Score: ",y.health.overallScore,"/100"]})]})]})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"w-16 bg-gray-200 rounded-full h-2 mr-2",children:r.jsx("div",{className:`h-2 rounded-full ${y.health.overallScore>=80?"bg-green-500":y.health.overallScore>=60?"bg-yellow-500":"bg-red-500"}`,style:{width:`${y.health.overallScore}%`}})}),r.jsx("span",{className:"text-sm font-medium text-gray-900",children:y.health.overallScore})]})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:`w-3 h-3 rounded-full ${y.health.buildStatus==="success"?"bg-green-500":y.health.buildStatus==="unknown"?"bg-yellow-500":"bg-red-500"}`}),r.jsx("span",{className:`ml-2 inline-flex px-2 py-1 text-xs font-semibold rounded-full ${g(y.health.buildStatus==="success"?"healthy":y.health.buildStatus==="unknown"?"warning":"error")}`,children:y.health.buildStatus==="success"?"healthy":y.health.buildStatus==="unknown"?"warning":"error"})]})}),r.jsx("td",{className:"hidden px-6 py-4 whitespace-nowrap",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx(ex,{className:"w-4 h-4 text-gray-400 mr-1"}),r.jsx("span",{className:"text-sm text-gray-900",children:"-"})]})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${g(y.health.lintStatus==="pass"?"pass":y.health.lintStatus==="unknown"?"warn":"fail")}`,children:y.health.lintStatus==="pass"?"pass":y.health.lintStatus==="unknown"?"warn":"fail"})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("div",{className:"flex items-center",children:r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${g(y.health.securityAudit==="pass"?"pass":y.health.securityAudit==="unknown"?"warn":"fail")}`,children:y.health.securityAudit==="pass"?"pass":y.health.securityAudit==="unknown"?"warn":"fail"})})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${g(y.health.overallScore>=80?"up-to-date":y.health.overallScore>=60?"outdated":"vulnerable")}`,children:y.health.overallScore>=80?"up-to-date":y.health.overallScore>=60?"outdated":"vulnerable"})}),r.jsx("td",{className:"hidden px-6 py-4 whitespace-nowrap text-sm font-medium",children:r.jsx("div",{className:"flex space-x-2",children:r.jsx("button",{className:"text-blue-600 hover:text-blue-900",children:"Details"})})})]},y.packageName))})]})})]}),r.jsxs("div",{className:"hidden bg-white rounded-lg shadow border p-6",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:"Health Recommendations"}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-start space-x-3 p-3 bg-yellow-50 rounded-lg border border-yellow-200",children:[r.jsx(te,{className:"w-5 h-5 text-yellow-600 mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-yellow-800",children:"Test Coverage Below Target"}),r.jsx("p",{className:"text-sm text-yellow-700",children:"Consider adding more tests to improve coverage above 90%"})]})]}),r.jsxs("div",{className:"flex items-start space-x-3 p-3 bg-red-50 rounded-lg border border-red-200",children:[r.jsx(Xe,{className:"w-5 h-5 text-red-600 mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-red-800",children:"Build Failures Detected"}),r.jsx("p",{className:"text-sm text-red-700",children:"monorepo-scanner package has build failures that need immediate attention"})]})]}),r.jsxs("div",{className:"flex items-start space-x-3 p-3 bg-blue-50 rounded-lg border border-blue-200",children:[r.jsx(Er,{className:"w-5 h-5 text-blue-600 mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-blue-800",children:"Performance Improvements Available"}),r.jsx("p",{className:"text-sm text-blue-700",children:"Consider optimizing build times and dependency resolution"})]})]})]})]})]})}function Xg({packageCount:e,onNewRelease:t}){return r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Publish Control"}),r.jsxs("p",{className:"text-gray-600 mt-1",children:["Manage package releases and versioning across your monorepo (",e," packages)"]})]}),r.jsxs("button",{onClick:t,className:"bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 flex items-center space-x-2",children:[r.jsx(gx,{className:"w-5 h-5"}),r.jsx("span",{children:"New Release"})]})]})}function Jg({stats:e}){return r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[r.jsx("div",{className:"bg-white p-6 rounded-lg shadow border",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-2 bg-green-100 rounded-lg",children:r.jsx(Li,{className:"w-6 h-6 text-green-600"})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Ready to Publish"}),r.jsx("p",{className:"text-2xl font-semibold text-gray-900",children:e.readyToPublish})]})]})}),r.jsx("div",{className:"bg-white p-6 rounded-lg shadow border",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-2 bg-blue-100 rounded-lg",children:r.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-blue-500 border-t-transparent"})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-sm font-medium text-gray-600",children:"In Progress"}),r.jsx("p",{className:"text-2xl font-semibold text-gray-900",children:e.inProgress})]})]})}),r.jsx("div",{className:"bg-white p-6 rounded-lg shadow border",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-2 bg-purple-100 rounded-lg",children:r.jsx("span",{className:"text-2xl",children:"🚀"})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Published Today"}),r.jsx("p",{className:"text-2xl font-semibold text-gray-900",children:e.published})]})]})})]})}const qg=e=>({readyToPublish:e.filter(t=>t.status==="ready").length,inProgress:e.filter(t=>t.status==="building"||t.status==="testing").length,published:e.filter(t=>t.status==="published").length}),Jd=e=>{switch(e){case"ready":case"completed":return"bg-green-100 text-green-800";case"building":case"testing":case"in-progress":return"bg-blue-100 text-blue-800";case"published":return"bg-purple-100 text-purple-800";case"failed":return"bg-red-100 text-red-800";case"scheduled":return"bg-yellow-100 text-yellow-800";default:return"bg-gray-100 text-gray-800"}},ey=e=>{switch(e){case"patch":return"bg-green-100 text-green-800";case"minor":return"bg-blue-100 text-blue-800";case"major":return"bg-red-100 text-red-800";case"prerelease":return"bg-yellow-100 text-yellow-800";default:return"bg-gray-100 text-gray-800"}},ty=(e,t)=>t==="all"?e:e.filter(n=>n.name===t);function ny({packages:e,selectedPackage:t,onPackageChange:n}){return r.jsxs("div",{className:"bg-white rounded-lg shadow border overflow-hidden",children:[r.jsx("div",{className:"px-6 py-4 border-b border-gray-200",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Package Release Status"}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("span",{className:"text-sm text-gray-500",children:"Filter by package:"}),r.jsxs("select",{value:t,onChange:s=>n(s.target.value),className:"px-3 py-1 border border-gray-300 rounded text-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[r.jsx("option",{value:"all",children:"All Packages"}),[...new Set(e.map(s=>s.name))].map(s=>r.jsx("option",{value:s,children:s},s))]})]})]})}),r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"min-w-full divide-y divide-gray-200",children:[r.jsx("thead",{className:"bg-gray-50",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Package"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Current Version"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Next Version"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Type"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Status"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Commits"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Last Published"}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Actions"})]})}),r.jsx("tbody",{className:"bg-white divide-y divide-gray-200",children:e.map(s=>r.jsxs("tr",{className:"hover:bg-gray-50",children:[r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"h-8 w-8 rounded-lg bg-gray-100 flex items-center justify-center",children:r.jsx(Ri,{className:"w-4 h-4 text-gray-600"})}),r.jsxs("div",{className:"ml-3",children:[r.jsx("div",{className:"text-sm font-medium text-gray-900",children:s.name}),r.jsxs("div",{className:"text-sm text-gray-500",children:[Object.keys(s.dependencies).length," dependencies"]})]})]})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900",children:s.currentVersion}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900",children:s.nextVersion}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${ey(s.publishType)}`,children:s.publishType})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${Jd(s.status)}`,children:s.status})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900",children:s.commits}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsxs("div",{className:"flex items-center text-sm text-gray-900",children:[r.jsx(ct,{className:"w-4 h-4 mr-1 text-gray-400"}),s.lastPublished]})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:r.jsxs("div",{className:"flex space-x-2",children:[s.status==="ready"&&r.jsx("button",{className:"text-green-600 hover:text-green-900",children:"Publish"}),r.jsx("button",{className:"text-blue-600 hover:text-blue-900",children:"Details"}),r.jsx("button",{className:"text-purple-600 hover:text-purple-900",children:"Changelog"})]})})]},s.name))})]})})]})}function ry({releases:e,selectedStatus:t,onStatusChange:n}){const s=[{id:"1",packageName:"dashboard",version:"1.0.1",status:"scheduled",scheduledFor:"2024-01-16 10:00 AM",changelog:"Bug fixes and performance improvements",author:"team-frontend"},{id:"2",packageName:"backend",version:"1.3.0",status:"in-progress",scheduledFor:"2024-01-16 11:00 AM",startedAt:"2024-01-16 11:05 AM",changelog:"New API endpoints and enhanced security",author:"team-backend"}];return r.jsxs("div",{className:"bg-white rounded-lg shadow border overflow-hidden",children:[r.jsx("div",{className:"px-6 py-4 border-b border-gray-200",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Release Schedule"}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("span",{className:"text-sm text-gray-500",children:"Filter by status:"}),r.jsxs("select",{value:t,onChange:l=>n(l.target.value),className:"px-3 py-1 border border-gray-300 rounded text-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[r.jsx("option",{value:"all",children:"All Status"}),r.jsx("option",{value:"scheduled",children:"Scheduled"}),r.jsx("option",{value:"in-progress",children:"In Progress"}),r.jsx("option",{value:"completed",children:"Completed"}),r.jsx("option",{value:"failed",children:"Failed"})]})]})]})}),r.jsx("div",{className:"p-6",children:r.jsx("div",{className:"space-y-4",children:s.map(l=>r.jsxs("div",{className:"border rounded-lg p-4 hover:bg-gray-50",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx("div",{className:"h-8 w-8 rounded-lg bg-purple-100 flex items-center justify-center",children:r.jsx(Bd,{className:"w-4 h-4 text-purple-600"})}),r.jsxs("div",{children:[r.jsxs("div",{className:"text-sm font-medium text-gray-900",children:[l.packageName," v",l.version]}),r.jsxs("div",{className:"text-sm text-gray-500",children:["by ",l.author]})]})]}),r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${Jd(l.status)}`,children:l.status}),r.jsxs("div",{className:"text-sm text-gray-500 flex items-center",children:[r.jsx(ct,{className:"w-4 h-4 mr-1"}),l.scheduledFor]})]})]}),r.jsx("div",{className:"mt-3 text-sm text-gray-700",children:l.changelog})]},l.id))})})]})}function sy(){const e=[{id:"1",packageName:"dashboard",version:"1.0.0",date:"2024-01-15",changes:["Added new dashboard layout","Improved search functionality","Fixed responsive design issues"],author:"team-frontend",type:"feature"},{id:"2",packageName:"backend",version:"1.2.0",date:"2024-01-14",changes:["Added authentication middleware","Implemented rate limiting","Fixed database connection pool"],author:"team-backend",type:"feature"}],t=n=>{switch(n){case"feature":return"bg-green-100 text-green-800";case"bugfix":return"bg-blue-100 text-blue-800";case"breaking":return"bg-red-100 text-red-800";case"docs":return"bg-gray-100 text-gray-800";default:return"bg-gray-100 text-gray-800"}};return r.jsxs("div",{className:"bg-white rounded-lg shadow border overflow-hidden",children:[r.jsx("div",{className:"px-6 py-4 border-b border-gray-200",children:r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Recent Changelogs"})}),r.jsx("div",{className:"p-6",children:r.jsx("div",{className:"space-y-6",children:e.map(n=>r.jsxs("div",{className:"border-l-4 border-blue-500 pl-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx("div",{className:"h-8 w-8 rounded-lg bg-blue-100 flex items-center justify-center",children:r.jsx(Ri,{className:"w-4 h-4 text-blue-600"})}),r.jsxs("div",{children:[r.jsxs("div",{className:"text-sm font-medium text-gray-900",children:[n.packageName," v",n.version]}),r.jsxs("div",{className:"text-sm text-gray-500",children:[n.date," • by ",n.author]})]})]}),r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${t(n.type)}`,children:n.type})]}),r.jsx("div",{className:"space-y-1",children:n.changes.map((s,l)=>r.jsxs("div",{className:"flex items-start space-x-2",children:[r.jsx(Ei,{className:"w-4 h-4 text-gray-400 mt-0.5 flex-shrink-0"}),r.jsx("span",{className:"text-sm text-gray-700",children:s})]},l))})]},n.id))})})]})}function ly(){return r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600",children:"Loading package data..."})]})})}function ay({error:e,onRetry:t}){return r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsxs("div",{className:"text-center",children:[r.jsx(te,{className:"w-12 h-12 text-red-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-red-600",children:e}),r.jsx("button",{onClick:t,className:"mt-4 bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 transition-colors",children:"Retry"})]})})}const uc=[{name:"dashboard",currentVersion:"1.0.0",nextVersion:"1.0.1",status:"ready",lastPublished:"2024-01-10",changelog:"Bug fixes and performance improvements",commits:15,dependencies:["react","tailwindcss"],publishType:"patch"},{name:"backend",currentVersion:"1.2.0",nextVersion:"1.3.0",status:"building",lastPublished:"2024-01-08",changelog:"New API endpoints and enhanced security",commits:28,dependencies:["express","prisma"],publishType:"minor"},{name:"utils",currentVersion:"0.5.2",nextVersion:"1.0.0",status:"ready",lastPublished:"2024-01-05",changelog:"Major refactor with breaking changes",commits:42,dependencies:["lodash"],publishType:"major"},{name:"ci-status",currentVersion:"0.3.1",nextVersion:"0.4.0",status:"testing",lastPublished:"2024-01-12",changelog:"Enhanced CI monitoring and reporting",commits:18,dependencies:["axios","ws"],publishType:"minor"}],iy=[{id:"1",packageName:"dashboard",version:"1.0.1",status:"scheduled",scheduledFor:"2024-01-16 10:00 AM",changelog:"Bug fixes and performance improvements",author:"team-frontend"},{id:"2",packageName:"backend",version:"1.3.0",status:"in-progress",scheduledFor:"2024-01-16 09:00 AM",startedAt:"2024-01-16 09:00 AM",changelog:"New API endpoints and enhanced security",author:"team-backend"},{id:"3",packageName:"utils",version:"1.0.0",status:"completed",scheduledFor:"2024-01-15 02:00 PM",startedAt:"2024-01-15 02:00 PM",completedAt:"2024-01-15 02:15 PM",changelog:"Major refactor with breaking changes",author:"team-shared"}];function oy(){const[e,t]=d.useState("all"),[n,s]=d.useState("all"),[l,a]=d.useState(uc),[i,c]=d.useState(!1),[o,u]=d.useState(null);d.useEffect(()=>{(async()=>{try{c(!0);const f=(await Oe.getPackages()).map(w=>({name:w.name,currentVersion:w.version,nextVersion:p(w.version),status:m(w.status),lastPublished:w.lastUpdated,changelog:w.description||"No changelog available",commits:Math.floor(Math.random()*20)+1,dependencies:w.dependencies||[],publishType:g()}));a(f),u(null)}catch(h){u("Failed to fetch package data"),console.error("Error fetching packages:",h),a(uc)}finally{c(!1)}})()},[]);const p=x=>{const h=x.split(".").map(Number);return h[2]+=1,h.join(".")},m=x=>{switch(x){case"healthy":return"ready";case"warning":return"testing";case"error":return"failed";case"building":return"building";default:return"ready"}},g=()=>{const x=["patch","minor","major","prerelease"];return x[Math.floor(Math.random()*x.length)]},v=()=>{console.log("Creating new release...")},j=()=>{window.location.reload()},N=ty(l,e),b=qg(l);return i?r.jsx(ly,{}):o?r.jsx(ay,{error:o,onRetry:j}):r.jsxs("div",{className:"space-y-6",children:[r.jsx(Xg,{packageCount:l.length,onNewRelease:v}),r.jsx(Jg,{stats:b}),r.jsx(ny,{packages:N,selectedPackage:e,onPackageChange:t}),r.jsx(ry,{releases:iy,selectedStatus:n,onStatusChange:s}),r.jsx(sy,{})]})}function cy({message:e="Loading CI/CD data..."}){return r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600",children:e})]})})}function uy({error:e,onRetry:t}){return r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsxs("div",{className:"text-center",children:[r.jsx(te,{className:"w-12 h-12 text-red-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-red-600",children:e}),t&&r.jsx("button",{onClick:t,className:"mt-4 bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 transition-colors",children:"Retry"})]})})}function dy({onTriggerBuild:e,onCreatePipeline:t}){return r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-heading text-2xl",children:"CI/CD Integration"}),r.jsx("p",{className:"text-body mt-1",children:"Monitor and manage continuous integration and deployment pipelines"})]}),r.jsxs("div",{className:"flex space-x-2",children:[r.jsxs("button",{onClick:e,className:"btn-secondary flex items-center space-x-2",children:[r.jsx(Li,{className:"w-5 h-5"}),r.jsx("span",{children:"Trigger Build"})]}),r.jsxs("button",{onClick:t,className:"btn-primary flex items-center space-x-2",children:[r.jsx(kx,{className:"w-5 h-5"}),r.jsx("span",{children:"New Pipeline"})]})]})]})}const $s=e=>{switch(e){case"success":case"active":return"bg-green-100 text-green-800";case"running":return"bg-blue-100 text-blue-800";case"pending":return"bg-yellow-100 text-yellow-800";case"failed":case"cancelled":return"bg-red-100 text-red-800";case"paused":return"bg-gray-100 text-gray-800";case"skipped":return"bg-gray-100 text-gray-600";default:return"bg-gray-100 text-gray-800"}},my=e=>{switch(e){case"success":return"bg-green-100 text-green-800";case"running":return"bg-blue-100 text-blue-800";case"pending":return"bg-gray-100 text-gray-800";case"failed":return"bg-red-100 text-red-800";case"skipped":return"bg-gray-100 text-gray-600";default:return"bg-gray-100 text-gray-800"}},hy=e=>{const t=e.length,n=e.filter(o=>o.status==="success").length,s=e.filter(o=>o.status==="failed").length,l=e.filter(o=>o.status==="running").length,a=t>0?Math.round(n/t*100):0,i=e.filter(o=>o.duration),c=i.length>0?Math.round(i.reduce((o,u)=>o+(u.duration||0),0)/i.length):0;return{total:t,successful:n,failed:s,running:l,successRate:a,avgDuration:c}},fy=(e,t)=>e.filter(n=>{const s=t.package==="all"||n.packageName===t.package,l=t.status==="all"||n.status===t.status;return s&&l&&!0}),xy=e=>[...new Set(e.map(t=>t.packageName))],py=e=>[...new Set(e.map(t=>t.status))],yr=e=>{if(e<60)return`${e}s`;if(e<3600){const t=Math.floor(e/60),n=e%60;return n>0?`${t}m ${n}s`:`${t}m`}else{const t=Math.floor(e/3600),n=Math.floor(e%3600/60);return n>0?`${t}h ${n}m`:`${t}h`}},dc=e=>new Date(e).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),qd=e=>{const t=new Date(e),s=new Date().getTime()-t.getTime(),l=Math.floor(s/(1e3*60)),a=Math.floor(l/60),i=Math.floor(a/24);return l<1?"Just now":l<60?`${l} min ago`:a<24?`${a} hour${a>1?"s":""} ago`:`${i} day${i>1?"s":""} ago`},gy=e=>{if(e.status==="success"||e.status==="failed"||e.status==="cancelled")return 100;if(e.status==="pending")return 0;const t=e.stages.length;if(t===0)return 0;const n=e.stages.filter(a=>a.status==="success"||a.status==="failed"||a.status==="skipped").length,s=e.stages.filter(a=>a.status==="running").length,l=(n+s*.5)/t;return Math.round(l*100)},yy=e=>{const t=e.toLowerCase();return t.includes("build")||t.includes("compile")?"🔨":t.includes("test")?"🧪":t.includes("lint")||t.includes("format")?"✨":t.includes("deploy")||t.includes("publish")?"🚀":t.includes("security")||t.includes("audit")?"🔒":t.includes("install")||t.includes("dependencies")?"📦":"⚙️"},vy=e=>e.status==="failed"?"critical":e.status==="paused"?"warning":e.successRate<70?"critical":e.successRate<85?"warning":"healthy",em=e=>e.substring(0,8);function jy({stats:e,onRefresh:t,loading:n=!1}){return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h2",{className:"text-heading text-lg",children:"Build Statistics"}),r.jsxs("button",{onClick:t,disabled:n,className:"btn-ghost",children:[r.jsx(ot,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),"Refresh"]})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-5 gap-4",children:[r.jsx("div",{className:"card p-4",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-2 bg-primary-100 rounded-lg",children:r.jsx(Er,{className:"w-6 h-6 text-primary-600"})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-caption font-medium",children:"Total Builds"}),r.jsx("p",{className:"text-heading text-2xl",children:e.total})]})]})}),r.jsx("div",{className:"card p-4",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-2 bg-success-100 rounded-lg",children:r.jsx(Ke,{className:"w-6 h-6 text-success-600"})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-caption font-medium",children:"Successful"}),r.jsx("p",{className:"text-heading text-2xl text-success-600",children:e.successful})]})]})}),r.jsx("div",{className:"card p-4",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-2 bg-error-100 rounded-lg",children:r.jsx(Xe,{className:"w-6 h-6 text-error-600"})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-caption font-medium",children:"Failed"}),r.jsx("p",{className:"text-heading text-2xl text-error-600",children:e.failed})]})]})}),r.jsx("div",{className:"card p-4",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-2 bg-info-100 rounded-lg",children:r.jsx(ct,{className:"w-6 h-6 text-info-600"})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("p",{className:"text-caption font-medium",children:"Running"}),r.jsx("p",{className:"text-heading text-2xl text-info-600",children:e.running})]})]})}),r.jsxs("div",{className:"card p-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("p",{className:"text-caption font-medium",children:"Success Rate"}),r.jsxs("span",{className:`text-lg font-bold ${e.successRate>=90?"text-success-600":e.successRate>=70?"text-warning-600":"text-error-600"}`,children:[e.successRate,"%"]})]}),r.jsx("div",{className:"w-full bg-neutral-200 rounded-full h-2",children:r.jsx("div",{className:`h-2 rounded-full transition-all duration-300 ${e.successRate>=90?"bg-success-500":e.successRate>=70?"bg-warning-500":"bg-error-500"}`,style:{width:`${e.successRate}%`}})})]})]}),r.jsxs("div",{className:"card p-6",children:[r.jsx("h3",{className:"text-heading text-lg mb-4",children:"Performance Metrics"}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-heading text-2xl text-primary-600",children:yr(e.avgDuration)}),r.jsx("div",{className:"text-caption",children:"Avg Duration"})]}),r.jsxs("div",{className:"text-center",children:[r.jsxs("div",{className:"text-heading text-2xl text-success-600",children:[e.total>0?Math.round(e.successful/e.total*100):0,"%"]}),r.jsx("div",{className:"text-caption",children:"Success Rate"})]}),r.jsxs("div",{className:"text-center",children:[r.jsxs("div",{className:"text-heading text-2xl text-error-600",children:[e.total>0?Math.round(e.failed/e.total*100):0,"%"]}),r.jsx("div",{className:"text-caption",children:"Failure Rate"})]}),r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-heading text-2xl text-accent-600",children:e.running}),r.jsx("div",{className:"text-caption",children:"Active Builds"})]})]})]})]})}function wy({builds:e,selectedBuild:t,onBuildSelect:n,filters:s,onFiltersChange:l}){const a=xy(e),i=py(e),c=o=>{switch(o){case"success":return r.jsx(Ke,{className:"h-5 w-5 text-green-500"});case"running":return r.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-blue-500 border-t-transparent"});case"pending":return r.jsx(ct,{className:"h-5 w-5 text-yellow-500"});case"failed":return r.jsx(Xe,{className:"h-5 w-5 text-red-500"});case"cancelled":return r.jsx(Ca,{className:"h-5 w-5 text-red-500"});default:return r.jsx(ct,{className:"h-5 w-5 text-gray-500"})}};return r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"bg-white p-4 rounded-lg shadow border",children:r.jsxs("div",{className:"flex items-center space-x-4",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(el,{className:"h-4 w-4 text-gray-400"}),r.jsxs("select",{value:s.package,onChange:o=>l({...s,package:o.target.value}),className:"border border-gray-300 rounded-md px-3 py-2 text-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[r.jsx("option",{value:"all",children:"All Packages"}),a.map(o=>r.jsx("option",{value:o,children:o},o))]})]}),r.jsxs("select",{value:s.status,onChange:o=>l({...s,status:o.target.value}),className:"border border-gray-300 rounded-md px-3 py-2 text-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[r.jsx("option",{value:"all",children:"All Statuses"}),i.map(o=>r.jsx("option",{value:o,children:o.charAt(0).toUpperCase()+o.slice(1)},o))]}),r.jsxs("select",{value:s.dateRange,onChange:o=>l({...s,dateRange:o.target.value}),className:"border border-gray-300 rounded-md px-3 py-2 text-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[r.jsx("option",{value:"all",children:"All Time"}),r.jsx("option",{value:"today",children:"Today"}),r.jsx("option",{value:"week",children:"This Week"}),r.jsx("option",{value:"month",children:"This Month"})]})]})}),r.jsxs("div",{className:"bg-white rounded-lg shadow border",children:[r.jsxs("div",{className:"p-4 border-b border-gray-200",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Recent Builds"}),r.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:[e.length," build",e.length!==1?"s":""," found"]})]}),e.length===0?r.jsxs("div",{className:"p-8 text-center",children:[r.jsx("div",{className:"text-gray-400 text-4xl mb-2",children:"🔨"}),r.jsx("p",{className:"text-gray-500",children:"No builds found matching your filters"})]}):r.jsx("div",{className:"divide-y divide-gray-200",children:e.map(o=>{const u=gy(o),p=t===o.id;return r.jsxs("div",{className:`p-4 cursor-pointer transition-colors ${p?"bg-blue-50 border-l-4 border-blue-500":"hover:bg-gray-50"}`,onClick:()=>n(p?null:o.id),children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center space-x-4",children:[c(o.status),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900",children:o.packageName}),r.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-800",children:o.branch}),r.jsx("span",{className:"text-xs text-gray-500 font-mono",children:em(o.commit)})]}),r.jsxs("div",{className:"flex items-center space-x-2 mt-1",children:[r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${$s(o.status)}`,children:o.status}),r.jsxs("span",{className:"text-xs text-gray-500",children:["by ",o.triggeredBy]}),r.jsx("span",{className:"text-xs text-gray-500",children:qd(o.startTime)})]})]})]}),r.jsxs("div",{className:"text-right",children:[o.duration&&r.jsx("div",{className:"text-sm font-medium text-gray-900",children:yr(o.duration)}),o.status==="running"&&r.jsx("div",{className:"mt-1",children:r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("div",{className:"w-20 bg-gray-200 rounded-full h-2",children:r.jsx("div",{className:"bg-blue-500 h-2 rounded-full transition-all duration-300",style:{width:`${u}%`}})}),r.jsxs("span",{className:"text-xs text-gray-500",children:[u,"%"]})]})})]})]}),p&&o.stages.length>0&&r.jsx("div",{className:"mt-4 pt-4 border-t border-gray-100",children:r.jsx("div",{className:"flex items-center space-x-2",children:o.stages.map((m,g)=>r.jsx("div",{className:`flex items-center px-2 py-1 text-xs rounded ${$s(m.status)}`,title:`${m.name}: ${m.status}`,children:m.name},m.name))})})]},o.id)})})]})]})}function Ny({pipelines:e,onPipelineSelect:t,onPipelineToggle:n}){const s=a=>{switch(a){case"healthy":return r.jsx(Ke,{className:"w-5 h-5 text-green-500"});case"warning":return r.jsx(te,{className:"w-5 h-5 text-yellow-500"});case"critical":return r.jsx(Xe,{className:"w-5 h-5 text-red-500"});default:return r.jsx(Ms,{className:"w-5 h-5 text-gray-500"})}},l=a=>{switch(a){case"healthy":return"bg-green-100 text-green-800";case"warning":return"bg-yellow-100 text-yellow-800";case"critical":return"bg-red-100 text-red-800";default:return"bg-gray-100 text-gray-800"}};return e.length===0?r.jsx("div",{className:"bg-white rounded-lg shadow border p-6",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Ms,{className:"w-12 h-12 text-gray-400 mx-auto mb-4"}),r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"No Pipelines Configured"}),r.jsx("p",{className:"text-gray-600 mb-4",children:"Get started by creating your first CI/CD pipeline to automate builds and deployments."}),r.jsx("button",{className:"bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 transition-colors",children:"Create Pipeline"})]})}):r.jsxs("div",{className:"bg-white rounded-lg shadow border",children:[r.jsxs("div",{className:"p-4 border-b border-gray-200",children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Pipeline Status"}),r.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:[e.length," pipeline",e.length!==1?"s":""," ","configured"]})]}),r.jsx("div",{className:"divide-y divide-gray-200",children:e.map(a=>{const i=vy(a);return r.jsxs("div",{className:"p-4 hover:bg-gray-50 transition-colors cursor-pointer",onClick:()=>t(a.id),children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center space-x-4",children:[s(i),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900",children:a.name}),r.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-800",children:a.packageName})]}),r.jsxs("div",{className:"flex items-center space-x-4 mt-1",children:[r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${$s(a.status)}`,children:a.status}),r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${l(i)}`,children:i})]})]})]}),r.jsx("div",{className:"flex items-center space-x-4",children:r.jsx("button",{onClick:c=>{c.stopPropagation(),n(a.id,a.status!=="active")},className:`p-2 rounded-lg transition-colors ${a.status==="active"?"text-green-600 hover:bg-green-100":"text-gray-400 hover:bg-gray-100"}`,title:a.status==="active"?"Pause Pipeline":"Activate Pipeline",children:a.status==="active"?r.jsx(dp,{className:"w-5 h-5"}):r.jsx(Li,{className:"w-5 h-5"})})})]}),r.jsxs("div",{className:"mt-3 grid grid-cols-4 gap-4 text-xs",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-gray-500",children:"Success Rate:"}),r.jsxs("div",{className:`font-medium ${a.successRate>=90?"text-green-600":a.successRate>=70?"text-yellow-600":"text-red-600"}`,children:[a.successRate,"%"]})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-gray-500",children:"Avg Duration:"}),r.jsx("div",{className:"font-medium text-gray-900",children:yr(a.avgDuration)})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-gray-500",children:"Last Run:"}),r.jsx("div",{className:"font-medium text-gray-900",children:qd(a.lastRun)})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-gray-500",children:"Triggers:"}),r.jsx("div",{className:"font-medium text-gray-900",children:a.triggers.length})]})]}),r.jsxs("div",{className:"mt-3",children:[r.jsxs("div",{className:"flex items-center justify-between text-xs mb-1",children:[r.jsx("span",{className:"text-gray-500",children:"Pipeline Health"}),r.jsxs("span",{className:"font-medium text-gray-900",children:[a.successRate,"%"]})]}),r.jsx("div",{className:"w-full bg-gray-200 rounded-full h-2",children:r.jsx("div",{className:`h-2 rounded-full transition-all duration-300 ${a.successRate>=90?"bg-green-500":a.successRate>=70?"bg-yellow-500":"bg-red-500"}`,style:{width:`${a.successRate}%`}})})]}),r.jsx("div",{className:"mt-3",children:r.jsxs("div",{className:"flex items-center space-x-1",children:[r.jsx("span",{className:"text-xs text-gray-500",children:"Triggers:"}),a.triggers.map(c=>r.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-blue-100 text-blue-800",children:c},c))]})})]},a.id)})})]})}function by({build:e,onClose:t,onCancel:n,onRetry:s}){if(!e)return null;const l=a=>{switch(a){case"success":return r.jsx(Ke,{className:"h-5 w-5 text-green-500"});case"running":return r.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-blue-500 border-t-transparent"});case"pending":return r.jsx(ct,{className:"h-5 w-5 text-yellow-500"});case"failed":return r.jsx(Xe,{className:"h-5 w-5 text-red-500"});case"cancelled":return r.jsx(Ca,{className:"h-5 w-5 text-red-500"});default:return r.jsx(ct,{className:"h-5 w-5 text-gray-500"})}};return r.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:r.jsxs("div",{className:"bg-white rounded-lg shadow-xl max-w-4xl w-full max-h-[90vh] overflow-hidden",children:[r.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200",children:[r.jsxs("div",{className:"flex items-center space-x-3",children:[l(e.status),r.jsxs("div",{children:[r.jsxs("h2",{className:"text-xl font-semibold text-gray-900",children:[e.packageName," Build"]}),r.jsxs("p",{className:"text-sm text-gray-600",children:[e.branch," • ",em(e.commit)]})]})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[e.status==="running"&&n&&r.jsxs("button",{onClick:()=>n(e.id),className:"inline-flex items-center px-3 py-2 text-sm font-medium text-red-700 bg-red-100 rounded-lg hover:bg-red-200 transition-colors",children:[r.jsx(Ca,{className:"w-4 h-4 mr-1"}),"Cancel"]}),(e.status==="failed"||e.status==="cancelled")&&s&&r.jsxs("button",{onClick:()=>s(e.id),className:"inline-flex items-center px-3 py-2 text-sm font-medium text-green-700 bg-green-100 rounded-lg hover:bg-green-200 transition-colors",children:[r.jsx(ot,{className:"w-4 h-4 mr-1"}),"Retry"]}),r.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-600 transition-colors",children:r.jsx(Pr,{className:"w-6 h-6"})})]})]}),r.jsxs("div",{className:"p-6 overflow-y-auto max-h-[70vh]",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 mb-6",children:[r.jsx("div",{className:"space-y-4",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-medium text-gray-700 mb-2",children:"Build Information"}),r.jsxs("div",{className:"space-y-2 text-sm",children:[r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-600",children:"Status:"}),r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${$s(e.status)}`,children:e.status})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-600",children:"Started:"}),r.jsx("span",{className:"font-medium",children:dc(e.startTime)})]}),e.endTime&&r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-600",children:"Ended:"}),r.jsx("span",{className:"font-medium",children:dc(e.endTime)})]}),e.duration&&r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-600",children:"Duration:"}),r.jsx("span",{className:"font-medium",children:yr(e.duration)})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-gray-600",children:"Triggered by:"}),r.jsx("span",{className:"font-medium",children:e.triggeredBy})]})]})]})}),r.jsx("div",{className:"space-y-4",children:r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-medium text-gray-700 mb-2",children:"Artifacts"}),e.artifacts.length>0?r.jsx("div",{className:"space-y-1",children:e.artifacts.map((a,i)=>r.jsx("div",{className:"text-sm",children:r.jsx("a",{href:"#",className:"text-blue-600 hover:text-blue-500 font-medium",children:a})},i))}):r.jsx("p",{className:"text-sm text-gray-500",children:"No artifacts generated"})]})})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:"Build Stages"}),r.jsx("div",{className:"space-y-4",children:e.stages.map((a,i)=>r.jsxs("div",{className:"border border-gray-200 rounded-lg p-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx("span",{className:"text-2xl",children:yy(a.name)}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900",children:a.name}),r.jsxs("div",{className:"flex items-center space-x-2 mt-1",children:[r.jsx("span",{className:`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${my(a.status)}`,children:a.status}),a.duration&&r.jsx("span",{className:"text-xs text-gray-500",children:yr(a.duration)})]})]})]}),r.jsxs("div",{className:"text-sm text-gray-500",children:["Step ",i+1," of ",e.stages.length]})]}),a.logs&&a.logs.length>0&&r.jsxs("div",{className:"mt-3",children:[r.jsx("h5",{className:"text-xs font-medium text-gray-700 mb-2",children:"Logs"}),r.jsx("div",{className:"bg-gray-900 text-gray-100 p-3 rounded-lg text-xs font-mono max-h-32 overflow-y-auto",children:a.logs.map((c,o)=>r.jsx("div",{className:"mb-1",children:c},o))})]})]},a.name))})]})]})]})})}const ky=[{id:"1",name:"Dashboard CI",packageName:"dashboard",status:"active",lastRun:"2024-01-16T09:00:00Z",nextRun:"2024-01-16T10:00:00Z",successRate:95,avgDuration:420,triggers:["push","pull_request"]},{id:"2",name:"Backend CI",packageName:"backend",status:"active",lastRun:"2024-01-16T08:30:00Z",nextRun:"2024-01-16T09:30:00Z",successRate:88,avgDuration:900,triggers:["push","pull_request","tag"]},{id:"3",name:"Utils CI",packageName:"utils",status:"paused",lastRun:"2024-01-16T08:00:00Z",successRate:75,avgDuration:600,triggers:["push","pull_request"]}];function Sy(){const[e,t]=d.useState(!0),[n,s]=d.useState(null),[l,a]=d.useState([]),[i]=d.useState(ky),[c,o]=d.useState(null),[u,p]=d.useState({package:"all",status:"all",pipeline:"all",dateRange:"all"});d.useEffect(()=>{(async()=>{try{t(!0);const $=(await Oe.getBuildStatus()).map(R=>({id:R.id||Math.random().toString(36).substr(2,9),packageName:R.package||R.packageName||"unknown",branch:R.branch||"main",commit:R.commit||"unknown",status:R.status||"pending",startTime:R.startTime||new Date().toISOString(),endTime:R.endTime,duration:R.duration,stages:R.stages||[],triggeredBy:R.triggeredBy||"system",artifacts:R.artifacts||[]}));a($),s(null)}catch(C){s("Failed to fetch build data"),console.error("Error fetching build data:",C)}finally{t(!1)}})()},[]);const m=fy(l,u),g=hy(l),v=c&&l.find(y=>y.id===c)||null,j=()=>{window.location.reload()},N=()=>{console.log("Triggering new build...")},b=()=>{console.log("Creating new pipeline...")},x=y=>{o(y)},h=y=>{console.log("Selected pipeline:",y)},f=(y,C)=>{console.log("Toggle pipeline:",y,"active:",C)},w=y=>{console.log("Cancelling build:",y),o(null)},S=y=>{console.log("Retrying build:",y),o(null)},E=()=>{window.location.reload()};return e?r.jsx(cy,{}):n?r.jsx(uy,{error:n,onRetry:E}):r.jsxs("div",{className:"space-y-6",children:[r.jsx(dy,{onTriggerBuild:N,onCreatePipeline:b}),r.jsx(jy,{stats:g,onRefresh:j,loading:e}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[r.jsx("div",{className:"lg:col-span-2",children:r.jsx(wy,{builds:m,selectedBuild:c,onBuildSelect:x,filters:u,onFiltersChange:p})}),r.jsx("div",{className:"lg:col-span-1",children:r.jsx(Ny,{pipelines:i,onPipelineSelect:h,onPipelineToggle:f})})]}),r.jsx(by,{build:v,onClose:()=>o(null),onCancel:w,onRetry:S}),m.length===0&&l.length>0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx("div",{className:"text-gray-400 text-6xl mb-4",children:"🔨"}),r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"No builds found"}),r.jsx("p",{className:"text-gray-600 mb-4",children:"No builds match your current filters. Try adjusting your search criteria."}),r.jsx("button",{onClick:()=>p({package:"all",status:"all",pipeline:"all",dateRange:"all"}),className:"text-blue-600 hover:text-blue-500",children:"Clear Filters"})]}),l.length===0&&!e&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx("div",{className:"text-gray-400 text-6xl mb-4",children:"🚀"}),r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"No CI/CD data available"}),r.jsx("p",{className:"text-gray-600 mb-4",children:"Get started by triggering your first build or setting up a pipeline."}),r.jsxs("div",{className:"flex justify-center space-x-4",children:[r.jsx("button",{onClick:N,className:"bg-green-600 text-white px-4 py-2 rounded-lg hover:bg-green-700 transition-colors",children:"Trigger Build"}),r.jsx("button",{onClick:b,className:"bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 transition-colors",children:"Create Pipeline"})]})]})]})}function Cy({message:e="Loading configuration files..."}){return r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto"}),r.jsx("p",{className:"mt-4 text-gray-600",children:e})]})})}function Ey({error:e,onRetry:t}){return r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsxs("div",{className:"text-center",children:[r.jsx(te,{className:"w-12 h-12 text-red-500 mx-auto"}),r.jsx("p",{className:"mt-4 text-red-600",children:e}),t&&r.jsx("button",{onClick:t,className:"mt-4 bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 transition-colors",children:"Retry"})]})})}function Py({onRefresh:e,loading:t=!1}){return r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Configuration Inspector"}),r.jsx("p",{className:"text-gray-600 mt-1",children:"View and manage configuration files across your monorepo"})]}),e&&r.jsxs("button",{onClick:e,disabled:t,className:"bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-2 transition-colors",children:[r.jsx(ot,{className:`w-5 h-5 ${t?"animate-spin":""}`}),r.jsx("span",{children:"Refresh"})]})]})}/*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */function tm(e){return typeof e>"u"||e===null}function Ly(e){return typeof e=="object"&&e!==null}function Ry(e){return Array.isArray(e)?e:tm(e)?[]:[e]}function Ty(e,t){var n,s,l,a;if(t)for(a=Object.keys(t),n=0,s=a.length;n<s;n+=1)l=a[n],e[l]=t[l];return e}function My(e,t){var n="",s;for(s=0;s<t;s+=1)n+=e;return n}function _y(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var Oy=tm,$y=Ly,Iy=Ry,Fy=My,Dy=_y,Ay=Ty,_i={isNothing:Oy,isObject:$y,toArray:Iy,repeat:Fy,isNegativeZero:Dy,extend:Ay};function nm(e,t){var n="",s=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(n+='in "'+e.mark.name+'" '),n+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(n+=`
68
68
 
69
69
  `+e.mark.snippet),s+" "+n):s}function vr(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=nm(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}vr.prototype=Object.create(Error.prototype);vr.prototype.constructor=vr;vr.prototype.toString=function(t){return this.name+": "+nm(this,t)};var Dt=vr,zy=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],By=["scalar","sequence","mapping"];function Uy(e){var t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(s){t[String(s)]=n})}),t}function Hy(e,t){if(t=t||{},Object.keys(t).forEach(function(n){if(zy.indexOf(n)===-1)throw new Dt('Unknown option "'+n+'" is met in definition of "'+e+'" YAML type.')}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(n){return n},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=Uy(t.styleAliases||null),By.indexOf(this.kind)===-1)throw new Dt('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var ue=Hy;function mc(e,t){var n=[];return e[t].forEach(function(s){var l=n.length;n.forEach(function(a,i){a.tag===s.tag&&a.kind===s.kind&&a.multi===s.multi&&(l=i)}),n[l]=s}),n}function Vy(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},t,n;function s(l){l.multi?(e.multi[l.kind].push(l),e.multi.fallback.push(l)):e[l.kind][l.tag]=e.fallback[l.tag]=l}for(t=0,n=arguments.length;t<n;t+=1)arguments[t].forEach(s);return e}function Ea(e){return this.extend(e)}Ea.prototype.extend=function(t){var n=[],s=[];if(t instanceof ue)s.push(t);else if(Array.isArray(t))s=s.concat(t);else if(t&&(Array.isArray(t.implicit)||Array.isArray(t.explicit)))t.implicit&&(n=n.concat(t.implicit)),t.explicit&&(s=s.concat(t.explicit));else throw new Dt("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");n.forEach(function(a){if(!(a instanceof ue))throw new Dt("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(a.loadKind&&a.loadKind!=="scalar")throw new Dt("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(a.multi)throw new Dt("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),s.forEach(function(a){if(!(a instanceof ue))throw new Dt("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var l=Object.create(Ea.prototype);return l.implicit=(this.implicit||[]).concat(n),l.explicit=(this.explicit||[]).concat(s),l.compiledImplicit=mc(l,"implicit"),l.compiledExplicit=mc(l,"explicit"),l.compiledTypeMap=Vy(l.compiledImplicit,l.compiledExplicit),l};var Wy=Ea,Qy=new ue("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),Yy=new ue("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),Zy=new ue("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),Gy=new Wy({explicit:[Qy,Yy,Zy]});function Ky(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function Xy(){return null}function Jy(e){return e===null}var qy=new ue("tag:yaml.org,2002:null",{kind:"scalar",resolve:Ky,construct:Xy,predicate:Jy,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function ev(e){if(e===null)return!1;var t=e.length;return t===4&&(e==="true"||e==="True"||e==="TRUE")||t===5&&(e==="false"||e==="False"||e==="FALSE")}function tv(e){return e==="true"||e==="True"||e==="TRUE"}function nv(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var rv=new ue("tag:yaml.org,2002:bool",{kind:"scalar",resolve:ev,construct:tv,predicate:nv,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function sv(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function lv(e){return 48<=e&&e<=55}function av(e){return 48<=e&&e<=57}function iv(e){if(e===null)return!1;var t=e.length,n=0,s=!1,l;if(!t)return!1;if(l=e[n],(l==="-"||l==="+")&&(l=e[++n]),l==="0"){if(n+1===t)return!0;if(l=e[++n],l==="b"){for(n++;n<t;n++)if(l=e[n],l!=="_"){if(l!=="0"&&l!=="1")return!1;s=!0}return s&&l!=="_"}if(l==="x"){for(n++;n<t;n++)if(l=e[n],l!=="_"){if(!sv(e.charCodeAt(n)))return!1;s=!0}return s&&l!=="_"}if(l==="o"){for(n++;n<t;n++)if(l=e[n],l!=="_"){if(!lv(e.charCodeAt(n)))return!1;s=!0}return s&&l!=="_"}}if(l==="_")return!1;for(;n<t;n++)if(l=e[n],l!=="_"){if(!av(e.charCodeAt(n)))return!1;s=!0}return!(!s||l==="_")}function ov(e){var t=e,n=1,s;if(t.indexOf("_")!==-1&&(t=t.replace(/_/g,"")),s=t[0],(s==="-"||s==="+")&&(s==="-"&&(n=-1),t=t.slice(1),s=t[0]),t==="0")return 0;if(s==="0"){if(t[1]==="b")return n*parseInt(t.slice(2),2);if(t[1]==="x")return n*parseInt(t.slice(2),16);if(t[1]==="o")return n*parseInt(t.slice(2),8)}return n*parseInt(t,10)}function cv(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!_i.isNegativeZero(e)}var uv=new ue("tag:yaml.org,2002:int",{kind:"scalar",resolve:iv,construct:ov,predicate:cv,represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),dv=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function mv(e){return!(e===null||!dv.test(e)||e[e.length-1]==="_")}function hv(e){var t,n;return t=e.replace(/_/g,"").toLowerCase(),n=t[0]==="-"?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),t===".inf"?n===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:t===".nan"?NaN:n*parseFloat(t,10)}var fv=/^[-+]?[0-9]+e/;function xv(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(_i.isNegativeZero(e))return"-0.0";return n=e.toString(10),fv.test(n)?n.replace("e",".e"):n}function pv(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||_i.isNegativeZero(e))}var gv=new ue("tag:yaml.org,2002:float",{kind:"scalar",resolve:mv,construct:hv,predicate:pv,represent:xv,defaultStyle:"lowercase"}),yv=Gy.extend({implicit:[qy,rv,uv,gv]}),vv=yv,rm=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),sm=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function jv(e){return e===null?!1:rm.exec(e)!==null||sm.exec(e)!==null}function wv(e){var t,n,s,l,a,i,c,o=0,u=null,p,m,g;if(t=rm.exec(e),t===null&&(t=sm.exec(e)),t===null)throw new Error("Date resolve error");if(n=+t[1],s=+t[2]-1,l=+t[3],!t[4])return new Date(Date.UTC(n,s,l));if(a=+t[4],i=+t[5],c=+t[6],t[7]){for(o=t[7].slice(0,3);o.length<3;)o+="0";o=+o}return t[9]&&(p=+t[10],m=+(t[11]||0),u=(p*60+m)*6e4,t[9]==="-"&&(u=-u)),g=new Date(Date.UTC(n,s,l,a,i,c,o)),u&&g.setTime(g.getTime()-u),g}function Nv(e){return e.toISOString()}var bv=new ue("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:jv,construct:wv,instanceOf:Date,represent:Nv});function kv(e){return e==="<<"||e===null}var Sv=new ue("tag:yaml.org,2002:merge",{kind:"scalar",resolve:kv}),Oi=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
70
70
  \r`;function Cv(e){if(e===null)return!1;var t,n,s=0,l=e.length,a=Oi;for(n=0;n<l;n++)if(t=a.indexOf(e.charAt(n)),!(t>64)){if(t<0)return!1;s+=6}return s%8===0}function Ev(e){var t,n,s=e.replace(/[\r\n=]/g,""),l=s.length,a=Oi,i=0,c=[];for(t=0;t<l;t++)t%4===0&&t&&(c.push(i>>16&255),c.push(i>>8&255),c.push(i&255)),i=i<<6|a.indexOf(s.charAt(t));return n=l%4*6,n===0?(c.push(i>>16&255),c.push(i>>8&255),c.push(i&255)):n===18?(c.push(i>>10&255),c.push(i>>2&255)):n===12&&c.push(i>>4&255),new Uint8Array(c)}function Pv(e){var t="",n=0,s,l,a=e.length,i=Oi;for(s=0;s<a;s++)s%3===0&&s&&(t+=i[n>>18&63],t+=i[n>>12&63],t+=i[n>>6&63],t+=i[n&63]),n=(n<<8)+e[s];return l=a%3,l===0?(t+=i[n>>18&63],t+=i[n>>12&63],t+=i[n>>6&63],t+=i[n&63]):l===2?(t+=i[n>>10&63],t+=i[n>>4&63],t+=i[n<<2&63],t+=i[64]):l===1&&(t+=i[n>>2&63],t+=i[n<<4&63],t+=i[64],t+=i[64]),t}function Lv(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var Rv=new ue("tag:yaml.org,2002:binary",{kind:"scalar",resolve:Cv,construct:Ev,predicate:Lv,represent:Pv}),Tv=Object.prototype.hasOwnProperty,Mv=Object.prototype.toString;function _v(e){if(e===null)return!0;var t=[],n,s,l,a,i,c=e;for(n=0,s=c.length;n<s;n+=1){if(l=c[n],i=!1,Mv.call(l)!=="[object Object]")return!1;for(a in l)if(Tv.call(l,a))if(!i)i=!0;else return!1;if(!i)return!1;if(t.indexOf(a)===-1)t.push(a);else return!1}return!0}function Ov(e){return e!==null?e:[]}var $v=new ue("tag:yaml.org,2002:omap",{kind:"sequence",resolve:_v,construct:Ov}),Iv=Object.prototype.toString;function Fv(e){if(e===null)return!0;var t,n,s,l,a,i=e;for(a=new Array(i.length),t=0,n=i.length;t<n;t+=1){if(s=i[t],Iv.call(s)!=="[object Object]"||(l=Object.keys(s),l.length!==1))return!1;a[t]=[l[0],s[l[0]]]}return!0}function Dv(e){if(e===null)return[];var t,n,s,l,a,i=e;for(a=new Array(i.length),t=0,n=i.length;t<n;t+=1)s=i[t],l=Object.keys(s),a[t]=[l[0],s[l[0]]];return a}var Av=new ue("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:Fv,construct:Dv}),zv=Object.prototype.hasOwnProperty;function Bv(e){if(e===null)return!0;var t,n=e;for(t in n)if(zv.call(n,t)&&n[t]!==null)return!1;return!0}function Uv(e){return e!==null?e:{}}var Hv=new ue("tag:yaml.org,2002:set",{kind:"mapping",resolve:Bv,construct:Uv});vv.extend({implicit:[bv,Sv],explicit:[Rv,$v,Av,Hv]});function hc(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`