fleet-commander-ai 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{index-CHukC8Hq.js → index-6gyTp6Il.js} +2 -2
- package/dist/client/assets/index-6gyTp6Il.js.map +1 -0
- package/dist/client/index.html +1 -1
- package/dist/server/index.js +0 -4
- package/dist/server/index.js.map +1 -1
- package/dist/server/routes/system.d.ts.map +1 -1
- package/dist/server/routes/system.js +20 -0
- package/dist/server/routes/system.js.map +1 -1
- package/dist/server/utils/hook-installer.d.ts.map +1 -1
- package/dist/server/utils/hook-installer.js +4 -2
- package/dist/server/utils/hook-installer.js.map +1 -1
- package/package.json +1 -1
- package/scripts/install.sh +4 -0
- package/scripts/uninstall.sh +4 -0
- package/dist/client/assets/index-CHukC8Hq.js.map +0 -1
|
@@ -57,7 +57,7 @@ Error generating stack: `+v.message+`
|
|
|
57
57
|
* @license MIT
|
|
58
58
|
*/var iT="popstate";function oT(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function VH(e={}){function r(a,i){var d;let o=(d=i.state)==null?void 0:d.masked,{pathname:u,search:c,hash:f}=o||a.location;return o2("",{pathname:u,search:c,hash:f},i.state&&i.state.usr||null,i.state&&i.state.key||"default",o?{pathname:a.location.pathname,search:a.location.search,hash:a.location.hash}:void 0)}function n(a,i){return typeof i=="string"?i:ec(i)}return XH(r,n,null,e)}function mt(e,r){if(e===!1||e===null||typeof e>"u")throw new Error(r)}function na(e,r){if(!e){typeof console<"u"&&console.warn(r);try{throw new Error(r)}catch{}}}function YH(){return Math.random().toString(36).substring(2,10)}function lT(e,r){return{usr:e.state,key:e.key,idx:r,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function o2(e,r,n=null,a,i){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof r=="string"?ou(r):r,state:n,key:r&&r.key||a||YH(),unstable_mask:i}}function ec({pathname:e="/",search:r="",hash:n=""}){return r&&r!=="?"&&(e+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function ou(e){let r={};if(e){let n=e.indexOf("#");n>=0&&(r.hash=e.substring(n),e=e.substring(0,n));let a=e.indexOf("?");a>=0&&(r.search=e.substring(a),e=e.substring(0,a)),e&&(r.pathname=e)}return r}function XH(e,r,n,a={}){let{window:i=document.defaultView,v5Compat:o=!1}=a,u=i.history,c="POP",f=null,d=h();d==null&&(d=0,u.replaceState({...u.state,idx:d},""));function h(){return(u.state||{idx:null}).idx}function m(){c="POP";let w=h(),_=w==null?null:w-d;d=w,f&&f({action:c,location:E.location,delta:_})}function g(w,_){c="PUSH";let A=oT(w)?w:o2(E.location,w,_);d=h()+1;let O=lT(A,d),T=E.createHref(A.unstable_mask||A);try{u.pushState(O,"",T)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;i.location.assign(T)}o&&f&&f({action:c,location:E.location,delta:1})}function y(w,_){c="REPLACE";let A=oT(w)?w:o2(E.location,w,_);d=h();let O=lT(A,d),T=E.createHref(A.unstable_mask||A);u.replaceState(O,"",T),o&&f&&f({action:c,location:E.location,delta:0})}function x(w){return WH(w)}let E={get action(){return c},get location(){return e(i,u)},listen(w){if(f)throw new Error("A history only accepts one active listener");return i.addEventListener(iT,m),f=w,()=>{i.removeEventListener(iT,m),f=null}},createHref(w){return r(i,w)},createURL:x,encodeLocation(w){let _=x(w);return{pathname:_.pathname,search:_.search,hash:_.hash}},push:g,replace:y,go(w){return u.go(w)}};return E}function WH(e,r=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),mt(n,"No window.location.(origin|href) available to create URL");let a=typeof e=="string"?e:ec(e);return a=a.replace(/ $/,"%20"),!r&&a.startsWith("//")&&(a=n+a),new URL(a,n)}function A6(e,r,n="/"){return ZH(e,r,n,!1)}function ZH(e,r,n,a){let i=typeof r=="string"?ou(r):r,o=Ga(i.pathname||"/",n);if(o==null)return null;let u=O6(e);QH(u);let c=null;for(let f=0;c==null&&f<u.length;++f){let d=sG(o);c=lG(u[f],d,a)}return c}function O6(e,r=[],n=[],a="",i=!1){let o=(u,c,f=i,d)=>{let h={relativePath:d===void 0?u.path||"":d,caseSensitive:u.caseSensitive===!0,childrenIndex:c,route:u};if(h.relativePath.startsWith("/")){if(!h.relativePath.startsWith(a)&&f)return;mt(h.relativePath.startsWith(a),`Absolute route path "${h.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),h.relativePath=h.relativePath.slice(a.length)}let m=ea([a,h.relativePath]),g=n.concat(h);u.children&&u.children.length>0&&(mt(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),O6(u.children,r,g,m,f)),!(u.path==null&&!u.index)&&r.push({path:m,score:iG(m,u.index),routesMeta:g})};return e.forEach((u,c)=>{var f;if(u.path===""||!((f=u.path)!=null&&f.includes("?")))o(u,c);else for(let d of C6(u.path))o(u,c,!0,d)}),r}function C6(e){let r=e.split("/");if(r.length===0)return[];let[n,...a]=r,i=n.endsWith("?"),o=n.replace(/\?$/,"");if(a.length===0)return i?[o,""]:[o];let u=C6(a.join("/")),c=[];return c.push(...u.map(f=>f===""?o:[o,f].join("/"))),i&&c.push(...u),c.map(f=>e.startsWith("/")&&f===""?"/":f)}function QH(e){e.sort((r,n)=>r.score!==n.score?n.score-r.score:oG(r.routesMeta.map(a=>a.childrenIndex),n.routesMeta.map(a=>a.childrenIndex)))}var JH=/^:[\w-]+$/,eG=3,tG=2,rG=1,nG=10,aG=-2,uT=e=>e==="*";function iG(e,r){let n=e.split("/"),a=n.length;return n.some(uT)&&(a+=aG),r&&(a+=tG),n.filter(i=>!uT(i)).reduce((i,o)=>i+(JH.test(o)?eG:o===""?rG:nG),a)}function oG(e,r){return e.length===r.length&&e.slice(0,-1).every((a,i)=>a===r[i])?e[e.length-1]-r[r.length-1]:0}function lG(e,r,n=!1){let{routesMeta:a}=e,i={},o="/",u=[];for(let c=0;c<a.length;++c){let f=a[c],d=c===a.length-1,h=o==="/"?r:r.slice(o.length)||"/",m=nh({path:f.relativePath,caseSensitive:f.caseSensitive,end:d},h),g=f.route;if(!m&&d&&n&&!a[a.length-1].route.index&&(m=nh({path:f.relativePath,caseSensitive:f.caseSensitive,end:!1},h)),!m)return null;Object.assign(i,m.params),u.push({params:i,pathname:ea([o,m.pathname]),pathnameBase:hG(ea([o,m.pathnameBase])),route:g}),m.pathnameBase!=="/"&&(o=ea([o,m.pathnameBase]))}return u}function nh(e,r){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,a]=uG(e.path,e.caseSensitive,e.end),i=r.match(n);if(!i)return null;let o=i[0],u=o.replace(/(.)\/+$/,"$1"),c=i.slice(1);return{params:a.reduce((d,{paramName:h,isOptional:m},g)=>{if(h==="*"){let x=c[g]||"";u=o.slice(0,o.length-x.length).replace(/(.)\/+$/,"$1")}const y=c[g];return m&&!y?d[h]=void 0:d[h]=(y||"").replace(/%2F/g,"/"),d},{}),pathname:o,pathnameBase:u,pattern:e}}function uG(e,r=!1,n=!0){na(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let a=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,c,f,d,h)=>{if(a.push({paramName:c,isOptional:f!=null}),f){let m=h.charAt(d+u.length);return m&&m!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(a.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,r?void 0:"i"),a]}function sG(e){try{return e.split("/").map(r=>decodeURIComponent(r).replace(/\//g,"%2F")).join("/")}catch(r){return na(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${r}).`),e}}function Ga(e,r){if(r==="/")return e;if(!e.toLowerCase().startsWith(r.toLowerCase()))return null;let n=r.endsWith("/")?r.length-1:r.length,a=e.charAt(n);return a&&a!=="/"?null:e.slice(n)||"/"}var cG=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function fG(e,r="/"){let{pathname:n,search:a="",hash:i=""}=typeof e=="string"?ou(e):e,o;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?o=sT(n.substring(1),"/"):o=sT(n,r)):o=r,{pathname:o,search:pG(a),hash:mG(i)}}function sT(e,r){let n=r.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function Xg(e,r,n,a){return`Cannot include a '${e}' character in a manually specified \`to.${r}\` field [${JSON.stringify(a)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function dG(e){return e.filter((r,n)=>n===0||r.route.path&&r.route.path.length>0)}function T6(e){let r=dG(e);return r.map((n,a)=>a===r.length-1?n.pathname:n.pathnameBase)}function jS(e,r,n,a=!1){let i;typeof e=="string"?i=ou(e):(i={...e},mt(!i.pathname||!i.pathname.includes("?"),Xg("?","pathname","search",i)),mt(!i.pathname||!i.pathname.includes("#"),Xg("#","pathname","hash",i)),mt(!i.search||!i.search.includes("#"),Xg("#","search","hash",i)));let o=e===""||i.pathname==="",u=o?"/":i.pathname,c;if(u==null)c=n;else{let m=r.length-1;if(!a&&u.startsWith("..")){let g=u.split("/");for(;g[0]==="..";)g.shift(),m-=1;i.pathname=g.join("/")}c=m>=0?r[m]:"/"}let f=fG(i,c),d=u&&u!=="/"&&u.endsWith("/"),h=(o||u===".")&&n.endsWith("/");return!f.pathname.endsWith("/")&&(d||h)&&(f.pathname+="/"),f}var ea=e=>e.join("/").replace(/\/\/+/g,"/"),hG=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),pG=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,mG=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,vG=class{constructor(e,r,n,a=!1){this.status=e,this.statusText=r||"",this.internal=a,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function gG(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function yG(e){return e.map(r=>r.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var N6=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function M6(e,r){let n=e;if(typeof n!="string"||!cG.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let a=n,i=!1;if(N6)try{let o=new URL(window.location.href),u=n.startsWith("//")?new URL(o.protocol+n):new URL(n),c=Ga(u.pathname,r);u.origin===o.origin&&c!=null?n=c+u.search+u.hash:i=!0}catch{na(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:a,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var P6=["POST","PUT","PATCH","DELETE"];new Set(P6);var bG=["GET",...P6];new Set(bG);var lu=k.createContext(null);lu.displayName="DataRouter";var gp=k.createContext(null);gp.displayName="DataRouterState";var xG=k.createContext(!1),R6=k.createContext({isTransitioning:!1});R6.displayName="ViewTransition";var _G=k.createContext(new Map);_G.displayName="Fetchers";var wG=k.createContext(null);wG.displayName="Await";var bn=k.createContext(null);bn.displayName="Navigation";var xc=k.createContext(null);xc.displayName="Location";var Ja=k.createContext({outlet:null,matches:[],isDataRoute:!1});Ja.displayName="Route";var AS=k.createContext(null);AS.displayName="RouteError";var D6="REACT_ROUTER_ERROR",SG="REDIRECT",EG="ROUTE_ERROR_RESPONSE";function kG(e){if(e.startsWith(`${D6}:${SG}:{`))try{let r=JSON.parse(e.slice(28));if(typeof r=="object"&&r&&typeof r.status=="number"&&typeof r.statusText=="string"&&typeof r.location=="string"&&typeof r.reloadDocument=="boolean"&&typeof r.replace=="boolean")return r}catch{}}function jG(e){if(e.startsWith(`${D6}:${EG}:{`))try{let r=JSON.parse(e.slice(40));if(typeof r=="object"&&r&&typeof r.status=="number"&&typeof r.statusText=="string")return new vG(r.status,r.statusText,r.data)}catch{}}function AG(e,{relative:r}={}){mt(_c(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:a}=k.useContext(bn),{hash:i,pathname:o,search:u}=wc(e,{relative:r}),c=o;return n!=="/"&&(c=o==="/"?n:ea([n,o])),a.createHref({pathname:c,search:u,hash:i})}function _c(){return k.useContext(xc)!=null}function Hi(){return mt(_c(),"useLocation() may be used only in the context of a <Router> component."),k.useContext(xc).location}var L6="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function I6(e){k.useContext(bn).static||k.useLayoutEffect(e)}function OG(){let{isDataRoute:e}=k.useContext(Ja);return e?$G():CG()}function CG(){mt(_c(),"useNavigate() may be used only in the context of a <Router> component.");let e=k.useContext(lu),{basename:r,navigator:n}=k.useContext(bn),{matches:a}=k.useContext(Ja),{pathname:i}=Hi(),o=JSON.stringify(T6(a)),u=k.useRef(!1);return I6(()=>{u.current=!0}),k.useCallback((f,d={})=>{if(na(u.current,L6),!u.current)return;if(typeof f=="number"){n.go(f);return}let h=jS(f,JSON.parse(o),i,d.relative==="path");e==null&&r!=="/"&&(h.pathname=h.pathname==="/"?r:ea([r,h.pathname])),(d.replace?n.replace:n.push)(h,d.state,d)},[r,n,o,i,e])}k.createContext(null);function wc(e,{relative:r}={}){let{matches:n}=k.useContext(Ja),{pathname:a}=Hi(),i=JSON.stringify(T6(n));return k.useMemo(()=>jS(e,JSON.parse(i),a,r==="path"),[e,i,a,r])}function TG(e,r){return z6(e,r)}function z6(e,r,n){var w;mt(_c(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=k.useContext(bn),{matches:i}=k.useContext(Ja),o=i[i.length-1],u=o?o.params:{},c=o?o.pathname:"/",f=o?o.pathnameBase:"/",d=o&&o.route;{let _=d&&d.path||"";B6(c,!d||_.endsWith("*")||_.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${_}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
59
59
|
|
|
60
|
-
Please change the parent <Route path="${_}"> to <Route path="${_==="/"?"*":`${_}/*`}">.`)}let h=Hi(),m;if(r){let _=typeof r=="string"?ou(r):r;mt(f==="/"||((w=_.pathname)==null?void 0:w.startsWith(f)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${f}" but pathname "${_.pathname}" was given in the \`location\` prop.`),m=_}else m=h;let g=m.pathname||"/",y=g;if(f!=="/"){let _=f.replace(/^\//,"").split("/");y="/"+g.replace(/^\//,"").split("/").slice(_.length).join("/")}let x=A6(e,{pathname:y});na(d||x!=null,`No routes matched location "${m.pathname}${m.search}${m.hash}" `),na(x==null||x[x.length-1].route.element!==void 0||x[x.length-1].route.Component!==void 0||x[x.length-1].route.lazy!==void 0,`Matched leaf route at location "${m.pathname}${m.search}${m.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let E=DG(x&&x.map(_=>Object.assign({},_,{params:Object.assign({},u,_.params),pathname:ea([f,a.encodeLocation?a.encodeLocation(_.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:_.pathname]),pathnameBase:_.pathnameBase==="/"?f:ea([f,a.encodeLocation?a.encodeLocation(_.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:_.pathnameBase])})),i,n);return r&&E?k.createElement(xc.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...m},navigationType:"POP"}},E):E}function NG(){let e=BG(),r=gG(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:a},o={padding:"2px 4px",backgroundColor:a},u=null;return console.error("Error handled by React Router default ErrorBoundary:",e),u=k.createElement(k.Fragment,null,k.createElement("p",null,"💿 Hey developer 👋"),k.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",k.createElement("code",{style:o},"ErrorBoundary")," or"," ",k.createElement("code",{style:o},"errorElement")," prop on your route.")),k.createElement(k.Fragment,null,k.createElement("h2",null,"Unexpected Application Error!"),k.createElement("h3",{style:{fontStyle:"italic"}},r),n?k.createElement("pre",{style:i},n):null,u)}var MG=k.createElement(NG,null),q6=class extends k.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,r){return r.location!==e.location||r.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:r.error,location:r.location,revalidation:e.revalidation||r.revalidation}}componentDidCatch(e,r){this.props.onError?this.props.onError(e,r):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=jG(e.digest);n&&(e=n)}let r=e!==void 0?k.createElement(Ja.Provider,{value:this.props.routeContext},k.createElement(AS.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?k.createElement(PG,{error:e},r):r}};q6.contextType=xG;var Wg=new WeakMap;function PG({children:e,error:r}){let{basename:n}=k.useContext(bn);if(typeof r=="object"&&r&&"digest"in r&&typeof r.digest=="string"){let a=kG(r.digest);if(a){let i=Wg.get(r);if(i)throw i;let o=M6(a.location,n);if(N6&&!Wg.get(r))if(o.isExternal||a.reloadDocument)window.location.href=o.absoluteURL||o.to;else{const u=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:a.replace}));throw Wg.set(r,u),u}return k.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function RG({routeContext:e,match:r,children:n}){let a=k.useContext(lu);return a&&a.static&&a.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=r.route.id),k.createElement(Ja.Provider,{value:e},n)}function DG(e,r=[],n){let a=n==null?void 0:n.state;if(e==null){if(!a)return null;if(a.errors)e=a.matches;else if(r.length===0&&!a.initialized&&a.matches.length>0)e=a.matches;else return null}let i=e,o=a==null?void 0:a.errors;if(o!=null){let h=i.findIndex(m=>m.route.id&&(o==null?void 0:o[m.route.id])!==void 0);mt(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),i=i.slice(0,Math.min(i.length,h+1))}let u=!1,c=-1;if(n&&a){u=a.renderFallback;for(let h=0;h<i.length;h++){let m=i[h];if((m.route.HydrateFallback||m.route.hydrateFallbackElement)&&(c=h),m.route.id){let{loaderData:g,errors:y}=a,x=m.route.loader&&!g.hasOwnProperty(m.route.id)&&(!y||y[m.route.id]===void 0);if(m.route.lazy||x){n.isStatic&&(u=!0),c>=0?i=i.slice(0,c+1):i=[i[0]];break}}}}let f=n==null?void 0:n.onError,d=a&&f?(h,m)=>{var g,y;f(h,{location:a.location,params:((y=(g=a.matches)==null?void 0:g[0])==null?void 0:y.params)??{},unstable_pattern:yG(a.matches),errorInfo:m})}:void 0;return i.reduceRight((h,m,g)=>{let y,x=!1,E=null,w=null;a&&(y=o&&m.route.id?o[m.route.id]:void 0,E=m.route.errorElement||MG,u&&(c<0&&g===0?(B6("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),x=!0,w=null):c===g&&(x=!0,w=m.route.hydrateFallbackElement||null)));let _=r.concat(i.slice(0,g+1)),A=()=>{let O;return y?O=E:x?O=w:m.route.Component?O=k.createElement(m.route.Component,null):m.route.element?O=m.route.element:O=h,k.createElement(RG,{match:m,routeContext:{outlet:h,matches:_,isDataRoute:a!=null},children:O})};return a&&(m.route.ErrorBoundary||m.route.errorElement||g===0)?k.createElement(q6,{location:a.location,revalidation:a.revalidation,component:E,error:y,children:A(),routeContext:{outlet:null,matches:_,isDataRoute:!0},onError:d}):A()},null)}function OS(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function LG(e){let r=k.useContext(lu);return mt(r,OS(e)),r}function IG(e){let r=k.useContext(gp);return mt(r,OS(e)),r}function zG(e){let r=k.useContext(Ja);return mt(r,OS(e)),r}function CS(e){let r=zG(e),n=r.matches[r.matches.length-1];return mt(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function qG(){return CS("useRouteId")}function BG(){var a;let e=k.useContext(AS),r=IG("useRouteError"),n=CS("useRouteError");return e!==void 0?e:(a=r.errors)==null?void 0:a[n]}function $G(){let{router:e}=LG("useNavigate"),r=CS("useNavigate"),n=k.useRef(!1);return I6(()=>{n.current=!0}),k.useCallback(async(i,o={})=>{na(n.current,L6),n.current&&(typeof i=="number"?await e.navigate(i):await e.navigate(i,{fromRouteId:r,...o}))},[e,r])}var cT={};function B6(e,r,n){!r&&!cT[e]&&(cT[e]=!0,na(!1,n))}k.memo(UG);function UG({routes:e,future:r,state:n,isStatic:a,onError:i}){return z6(e,void 0,{state:n,isStatic:a,onError:i})}function bo(e){mt(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function FG({basename:e="/",children:r=null,location:n,navigationType:a="POP",navigator:i,static:o=!1,unstable_useTransitions:u}){mt(!_c(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let c=e.replace(/^\/*/,"/"),f=k.useMemo(()=>({basename:c,navigator:i,static:o,unstable_useTransitions:u,future:{}}),[c,i,o,u]);typeof n=="string"&&(n=ou(n));let{pathname:d="/",search:h="",hash:m="",state:g=null,key:y="default",unstable_mask:x}=n,E=k.useMemo(()=>{let w=Ga(d,c);return w==null?null:{location:{pathname:w,search:h,hash:m,state:g,key:y,unstable_mask:x},navigationType:a}},[c,d,h,m,g,y,a,x]);return na(E!=null,`<Router basename="${c}"> is not able to match the URL "${d}${h}${m}" because it does not start with the basename, so the <Router> won't render anything.`),E==null?null:k.createElement(bn.Provider,{value:f},k.createElement(xc.Provider,{children:r,value:E}))}function HG({children:e,location:r}){return TG(l2(e),r)}function l2(e,r=[]){let n=[];return k.Children.forEach(e,(a,i)=>{if(!k.isValidElement(a))return;let o=[...r,i];if(a.type===k.Fragment){n.push.apply(n,l2(a.props.children,o));return}mt(a.type===bo,`[${typeof a.type=="string"?a.type:a.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),mt(!a.props.index||!a.props.children,"An index route cannot have child routes.");let u={id:a.props.id||o.join("-"),caseSensitive:a.props.caseSensitive,element:a.props.element,Component:a.props.Component,index:a.props.index,path:a.props.path,middleware:a.props.middleware,loader:a.props.loader,action:a.props.action,hydrateFallbackElement:a.props.hydrateFallbackElement,HydrateFallback:a.props.HydrateFallback,errorElement:a.props.errorElement,ErrorBoundary:a.props.ErrorBoundary,hasErrorBoundary:a.props.hasErrorBoundary===!0||a.props.ErrorBoundary!=null||a.props.errorElement!=null,shouldRevalidate:a.props.shouldRevalidate,handle:a.props.handle,lazy:a.props.lazy};a.props.children&&(u.children=l2(a.props.children,o)),n.push(u)}),n}var Gd="get",Kd="application/x-www-form-urlencoded";function yp(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function GG(e){return yp(e)&&e.tagName.toLowerCase()==="button"}function KG(e){return yp(e)&&e.tagName.toLowerCase()==="form"}function VG(e){return yp(e)&&e.tagName.toLowerCase()==="input"}function YG(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function XG(e,r){return e.button===0&&(!r||r==="_self")&&!YG(e)}var bd=null;function WG(){if(bd===null)try{new FormData(document.createElement("form"),0),bd=!1}catch{bd=!0}return bd}var ZG=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Zg(e){return e!=null&&!ZG.has(e)?(na(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Kd}"`),null):e}function QG(e,r){let n,a,i,o,u;if(KG(e)){let c=e.getAttribute("action");a=c?Ga(c,r):null,n=e.getAttribute("method")||Gd,i=Zg(e.getAttribute("enctype"))||Kd,o=new FormData(e)}else if(GG(e)||VG(e)&&(e.type==="submit"||e.type==="image")){let c=e.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let f=e.getAttribute("formaction")||c.getAttribute("action");if(a=f?Ga(f,r):null,n=e.getAttribute("formmethod")||c.getAttribute("method")||Gd,i=Zg(e.getAttribute("formenctype"))||Zg(c.getAttribute("enctype"))||Kd,o=new FormData(c,e),!WG()){let{name:d,type:h,value:m}=e;if(h==="image"){let g=d?`${d}.`:"";o.append(`${g}x`,"0"),o.append(`${g}y`,"0")}else d&&o.append(d,m)}}else{if(yp(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Gd,a=null,i=Kd,u=e}return o&&i==="text/plain"&&(u=o,o=void 0),{action:a,method:n.toLowerCase(),encType:i,formData:o,body:u}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function TS(e,r){if(e===!1||e===null||typeof e>"u")throw new Error(r)}function JG(e,r,n,a){let i=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?i.pathname.endsWith("/")?i.pathname=`${i.pathname}_.${a}`:i.pathname=`${i.pathname}.${a}`:i.pathname==="/"?i.pathname=`_root.${a}`:r&&Ga(i.pathname,r)==="/"?i.pathname=`${r.replace(/\/$/,"")}/_root.${a}`:i.pathname=`${i.pathname.replace(/\/$/,"")}.${a}`,i}async function eK(e,r){if(e.id in r)return r[e.id];try{let n=await import(e.module);return r[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function tK(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function rK(e,r,n){let a=await Promise.all(e.map(async i=>{let o=r.routes[i.route.id];if(o){let u=await eK(o,n);return u.links?u.links():[]}return[]}));return oK(a.flat(1).filter(tK).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function fT(e,r,n,a,i,o){let u=(f,d)=>n[d]?f.route.id!==n[d].route.id:!0,c=(f,d)=>{var h;return n[d].pathname!==f.pathname||((h=n[d].route.path)==null?void 0:h.endsWith("*"))&&n[d].params["*"]!==f.params["*"]};return o==="assets"?r.filter((f,d)=>u(f,d)||c(f,d)):o==="data"?r.filter((f,d)=>{var m;let h=a.routes[f.route.id];if(!h||!h.hasLoader)return!1;if(u(f,d)||c(f,d))return!0;if(f.route.shouldRevalidate){let g=f.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:((m=n[0])==null?void 0:m.params)||{},nextUrl:new URL(e,window.origin),nextParams:f.params,defaultShouldRevalidate:!0});if(typeof g=="boolean")return g}return!0}):[]}function nK(e,r,{includeHydrateFallback:n}={}){return aK(e.map(a=>{let i=r.routes[a.route.id];if(!i)return[];let o=[i.module];return i.clientActionModule&&(o=o.concat(i.clientActionModule)),i.clientLoaderModule&&(o=o.concat(i.clientLoaderModule)),n&&i.hydrateFallbackModule&&(o=o.concat(i.hydrateFallbackModule)),i.imports&&(o=o.concat(i.imports)),o}).flat(1))}function aK(e){return[...new Set(e)]}function iK(e){let r={},n=Object.keys(e).sort();for(let a of n)r[a]=e[a];return r}function oK(e,r){let n=new Set;return new Set(r),e.reduce((a,i)=>{let o=JSON.stringify(iK(i));return n.has(o)||(n.add(o),a.push({key:o,link:i})),a},[])}function $6(){let e=k.useContext(lu);return TS(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function lK(){let e=k.useContext(gp);return TS(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var NS=k.createContext(void 0);NS.displayName="FrameworkContext";function U6(){let e=k.useContext(NS);return TS(e,"You must render this element inside a <HydratedRouter> element"),e}function uK(e,r){let n=k.useContext(NS),[a,i]=k.useState(!1),[o,u]=k.useState(!1),{onFocus:c,onBlur:f,onMouseEnter:d,onMouseLeave:h,onTouchStart:m}=r,g=k.useRef(null);k.useEffect(()=>{if(e==="render"&&u(!0),e==="viewport"){let E=_=>{_.forEach(A=>{u(A.isIntersecting)})},w=new IntersectionObserver(E,{threshold:.5});return g.current&&w.observe(g.current),()=>{w.disconnect()}}},[e]),k.useEffect(()=>{if(a){let E=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(E)}}},[a]);let y=()=>{i(!0)},x=()=>{i(!1),u(!1)};return n?e!=="intent"?[o,g,{}]:[o,g,{onFocus:bs(c,y),onBlur:bs(f,x),onMouseEnter:bs(d,y),onMouseLeave:bs(h,x),onTouchStart:bs(m,y)}]:[!1,g,{}]}function bs(e,r){return n=>{e&&e(n),n.defaultPrevented||r(n)}}function sK({page:e,...r}){let{router:n}=$6(),a=k.useMemo(()=>A6(n.routes,e,n.basename),[n.routes,e,n.basename]);return a?k.createElement(fK,{page:e,matches:a,...r}):null}function cK(e){let{manifest:r,routeModules:n}=U6(),[a,i]=k.useState([]);return k.useEffect(()=>{let o=!1;return rK(e,r,n).then(u=>{o||i(u)}),()=>{o=!0}},[e,r,n]),a}function fK({page:e,matches:r,...n}){let a=Hi(),{future:i,manifest:o,routeModules:u}=U6(),{basename:c}=$6(),{loaderData:f,matches:d}=lK(),h=k.useMemo(()=>fT(e,r,d,o,a,"data"),[e,r,d,o,a]),m=k.useMemo(()=>fT(e,r,d,o,a,"assets"),[e,r,d,o,a]),g=k.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let E=new Set,w=!1;if(r.forEach(A=>{var T;let O=o.routes[A.route.id];!O||!O.hasLoader||(!h.some(C=>C.route.id===A.route.id)&&A.route.id in f&&((T=u[A.route.id])!=null&&T.shouldRevalidate)||O.hasClientLoader?w=!0:E.add(A.route.id))}),E.size===0)return[];let _=JG(e,c,i.unstable_trailingSlashAwareDataRequests,"data");return w&&E.size>0&&_.searchParams.set("_routes",r.filter(A=>E.has(A.route.id)).map(A=>A.route.id).join(",")),[_.pathname+_.search]},[c,i.unstable_trailingSlashAwareDataRequests,f,a,o,h,r,e,u]),y=k.useMemo(()=>nK(m,o),[m,o]),x=cK(m);return k.createElement(k.Fragment,null,g.map(E=>k.createElement("link",{key:E,rel:"prefetch",as:"fetch",href:E,...n})),y.map(E=>k.createElement("link",{key:E,rel:"modulepreload",href:E,...n})),x.map(({key:E,link:w})=>k.createElement("link",{key:E,nonce:n.nonce,...w,crossOrigin:w.crossOrigin??n.crossOrigin})))}function dK(...e){return r=>{e.forEach(n=>{typeof n=="function"?n(r):n!=null&&(n.current=r)})}}var hK=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{hK&&(window.__reactRouterVersion="7.13.1")}catch{}function pK({basename:e,children:r,unstable_useTransitions:n,window:a}){let i=k.useRef();i.current==null&&(i.current=VH({window:a,v5Compat:!0}));let o=i.current,[u,c]=k.useState({action:o.action,location:o.location}),f=k.useCallback(d=>{n===!1?c(d):k.startTransition(()=>c(d))},[n]);return k.useLayoutEffect(()=>o.listen(f),[o,f]),k.createElement(FG,{basename:e,children:r,location:u.location,navigationType:u.action,navigator:o,unstable_useTransitions:n})}var F6=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,H6=k.forwardRef(function({onClick:r,discover:n="render",prefetch:a="none",relative:i,reloadDocument:o,replace:u,unstable_mask:c,state:f,target:d,to:h,preventScrollReset:m,viewTransition:g,unstable_defaultShouldRevalidate:y,...x},E){let{basename:w,navigator:_,unstable_useTransitions:A}=k.useContext(bn),O=typeof h=="string"&&F6.test(h),T=M6(h,w);h=T.to;let C=AG(h,{relative:i}),N=Hi(),M=null;if(c){let Y=jS(c,[],N.unstable_mask?N.unstable_mask.pathname:"/",!0);w!=="/"&&(Y.pathname=Y.pathname==="/"?w:ea([w,Y.pathname])),M=_.createHref(Y)}let[R,L,D]=uK(a,x),z=gK(h,{replace:u,unstable_mask:c,state:f,target:d,preventScrollReset:m,relative:i,viewTransition:g,unstable_defaultShouldRevalidate:y,unstable_useTransitions:A});function q(Y){r&&r(Y),Y.defaultPrevented||z(Y)}let G=!(T.isExternal||o),U=k.createElement("a",{...x,...D,href:(G?M:void 0)||T.absoluteURL||C,onClick:G?q:r,ref:dK(E,L),target:d,"data-discover":!O&&n==="render"?"true":void 0});return R&&!O?k.createElement(k.Fragment,null,U,k.createElement(sK,{page:C})):U});H6.displayName="Link";var G6=k.forwardRef(function({"aria-current":r="page",caseSensitive:n=!1,className:a="",end:i=!1,style:o,to:u,viewTransition:c,children:f,...d},h){let m=wc(u,{relative:d.relative}),g=Hi(),y=k.useContext(gp),{navigator:x,basename:E}=k.useContext(bn),w=y!=null&&wK(m)&&c===!0,_=x.encodeLocation?x.encodeLocation(m).pathname:m.pathname,A=g.pathname,O=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;n||(A=A.toLowerCase(),O=O?O.toLowerCase():null,_=_.toLowerCase()),O&&E&&(O=Ga(O,E)||O);const T=_!=="/"&&_.endsWith("/")?_.length-1:_.length;let C=A===_||!i&&A.startsWith(_)&&A.charAt(T)==="/",N=O!=null&&(O===_||!i&&O.startsWith(_)&&O.charAt(_.length)==="/"),M={isActive:C,isPending:N,isTransitioning:w},R=C?r:void 0,L;typeof a=="function"?L=a(M):L=[a,C?"active":null,N?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let D=typeof o=="function"?o(M):o;return k.createElement(H6,{...d,"aria-current":R,className:L,ref:h,style:D,to:u,viewTransition:c},typeof f=="function"?f(M):f)});G6.displayName="NavLink";var mK=k.forwardRef(({discover:e="render",fetcherKey:r,navigate:n,reloadDocument:a,replace:i,state:o,method:u=Gd,action:c,onSubmit:f,relative:d,preventScrollReset:h,viewTransition:m,unstable_defaultShouldRevalidate:g,...y},x)=>{let{unstable_useTransitions:E}=k.useContext(bn),w=xK(),_=_K(c,{relative:d}),A=u.toLowerCase()==="get"?"get":"post",O=typeof c=="string"&&F6.test(c),T=C=>{if(f&&f(C),C.defaultPrevented)return;C.preventDefault();let N=C.nativeEvent.submitter,M=(N==null?void 0:N.getAttribute("formmethod"))||u,R=()=>w(N||C.currentTarget,{fetcherKey:r,method:M,navigate:n,replace:i,state:o,relative:d,preventScrollReset:h,viewTransition:m,unstable_defaultShouldRevalidate:g});E&&n!==!1?k.startTransition(()=>R()):R()};return k.createElement("form",{ref:x,method:A,action:_,onSubmit:a?f:T,...y,"data-discover":!O&&e==="render"?"true":void 0})});mK.displayName="Form";function vK(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function K6(e){let r=k.useContext(lu);return mt(r,vK(e)),r}function gK(e,{target:r,replace:n,unstable_mask:a,state:i,preventScrollReset:o,relative:u,viewTransition:c,unstable_defaultShouldRevalidate:f,unstable_useTransitions:d}={}){let h=OG(),m=Hi(),g=wc(e,{relative:u});return k.useCallback(y=>{if(XG(y,r)){y.preventDefault();let x=n!==void 0?n:ec(m)===ec(g),E=()=>h(e,{replace:x,unstable_mask:a,state:i,preventScrollReset:o,relative:u,viewTransition:c,unstable_defaultShouldRevalidate:f});d?k.startTransition(()=>E()):E()}},[m,h,g,n,a,i,r,e,o,u,c,f,d])}var yK=0,bK=()=>`__${String(++yK)}__`;function xK(){let{router:e}=K6("useSubmit"),{basename:r}=k.useContext(bn),n=qG(),a=e.fetch,i=e.navigate;return k.useCallback(async(o,u={})=>{let{action:c,method:f,encType:d,formData:h,body:m}=QG(o,r);if(u.navigate===!1){let g=u.fetcherKey||bK();await a(g,n,u.action||c,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:h,body:m,formMethod:u.method||f,formEncType:u.encType||d,flushSync:u.flushSync})}else await i(u.action||c,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:h,body:m,formMethod:u.method||f,formEncType:u.encType||d,replace:u.replace,state:u.state,fromRouteId:n,flushSync:u.flushSync,viewTransition:u.viewTransition})},[a,i,r,n])}function _K(e,{relative:r}={}){let{basename:n}=k.useContext(bn),a=k.useContext(Ja);mt(a,"useFormAction must be used inside a RouteContext");let[i]=a.matches.slice(-1),o={...wc(e||".",{relative:r})},u=Hi();if(e==null){o.search=u.search;let c=new URLSearchParams(o.search),f=c.getAll("index");if(f.some(h=>h==="")){c.delete("index"),f.filter(m=>m).forEach(m=>c.append("index",m));let h=c.toString();o.search=h?`?${h}`:""}}return(!e||e===".")&&i.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(o.pathname=o.pathname==="/"?n:ea([n,o.pathname])),ec(o)}function wK(e,{relative:r}={}){let n=k.useContext(R6);mt(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=K6("useViewTransitionState"),i=wc(e,{relative:r});if(!n.isTransitioning)return!1;let o=Ga(n.currentLocation.pathname,a)||n.currentLocation.pathname,u=Ga(n.nextLocation.pathname,a)||n.nextLocation.pathname;return nh(i.pathname,u)!=null||nh(i.pathname,o)!=null}var MS=j6();function PS(e={}){const[r,n]=k.useState(!1),[a,i]=k.useState(null),[o,u]=k.useState(null),c=k.useRef(e.onEvent),f=k.useRef(1e3),d=k.useRef(null),h=k.useRef(null),m=k.useRef(!0),g=k.useRef(0);c.current=e.onEvent;const y=k.useCallback(()=>{if(!m.current)return;const x=new EventSource("/api/stream");h.current=x,x.onopen=()=>{m.current&&(n(!0),f.current=1e3)};const E=["snapshot","team_status_changed","team_event","team_output","pr_updated","team_launched","team_stopped","usage_updated","project_added","project_updated","project_removed","project_cleanup","dependency_resolved","heartbeat","team_thinking_start","team_thinking_stop"],w=_=>{var T,C;if(!m.current)return;let A="message",O=null;try{const N=JSON.parse(_.data);A=N.type??_.type??"message",typeof N.team_id=="number"&&(O=N.team_id),(T=c.current)==null||T.call(c,A,N)}catch{(C=c.current)==null||C.call(c,"message",_.data)}if(A!=="team_output"&&A!=="heartbeat"&&A!=="team_thinking_start"&&A!=="team_thinking_stop"){const N=Date.now();N-g.current>1e3&&(g.current=N,i(new Date(N)),u(O))}};for(const _ of E)x.addEventListener(_,w);x.onmessage=w,x.onerror=()=>{if(!m.current)return;n(!1),x.close(),h.current=null;const _=f.current;d.current=setTimeout(()=>{m.current&&y()},_),f.current=Math.min(_*2,3e4)}},[]);return k.useEffect(()=>(m.current=!0,y(),()=>{m.current=!1,h.current&&(h.current.close(),h.current=null),d.current&&(clearTimeout(d.current),d.current=null)}),[y]),{connected:r,lastEvent:a,lastEventTeamId:o}}const V6=k.createContext(null),SK=45e3;function EK({children:e}){const[r,n]=k.useState([]),[a,i]=k.useState(null),o=k.useRef(null),u=k.useRef(new Set),[c,f]=k.useState(0),d=k.useCallback(async()=>{try{const _=await fetch("/api/teams");if(_.ok){const A=await _.json();n(A)}}catch{}},[]),h=k.useCallback(()=>{o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{o.current=null,d()},500)},[d]),m=k.useCallback((_,A)=>{if(_==="snapshot"){const O=A;Array.isArray(O.teams)&&n(O.teams)}else if(_==="team_status_changed"||_==="team_launched"||_==="team_stopped"){if(h(),_==="team_stopped"){const O=A;typeof O.team_id=="number"&&u.current.has(O.team_id)&&(u.current.delete(O.team_id),f(T=>T+1))}}else if(_==="usage_updated"||_==="pr_updated")h();else if(_==="team_thinking_start"){const O=A;typeof O.team_id=="number"&&(u.current.add(O.team_id),f(T=>T+1))}else if(_==="team_thinking_stop"){const O=A;typeof O.team_id=="number"&&(u.current.delete(O.team_id),f(T=>T+1))}},[h]),{connected:g,lastEvent:y,lastEventTeamId:x}=PS({onEvent:m});k.useEffect(()=>{d()},[d]),k.useEffect(()=>{const _=setInterval(d,SK);return()=>clearInterval(_)},[d]),k.useEffect(()=>()=>{o.current&&clearTimeout(o.current)},[]);const E=k.useCallback(_=>u.current.has(_),[]),w=k.useMemo(()=>({teams:r,selectedTeamId:a,setSelectedTeamId:i,connected:g,lastEvent:y,lastEventTeamId:x,isThinking:E}),[r,a,g,y,x,E,c]);return b.jsx(V6.Provider,{value:w,children:e})}function Sc(){const e=k.useContext(V6);if(!e)throw new Error("useFleet must be used within a FleetProvider");return e}class Y6 extends Error{constructor(r,n,a){super(a??`API error: ${r} ${n}`),this.status=r,this.statusText=n,this.name="ApiError"}}async function xd(e,r,n){const a=`/api/${r.replace(/^\//,"")}`,i={method:e};n!==void 0?(i.headers={"Content-Type":"application/json"},i.body=JSON.stringify(n)):(e==="POST"||e==="PUT")&&(i.headers={"Content-Type":"application/json"},i.body="{}");const o=await fetch(a,i);if(!o.ok){let u;try{const c=await o.json();u=c.message??c.error??void 0}catch{}throw new Y6(o.status,o.statusText,u)}return o.json()}function Ut(){const e=k.useCallback(i=>xd("GET",i),[]),r=k.useCallback((i,o)=>xd("POST",i,o),[]),n=k.useCallback((i,o)=>xd("PUT",i,o),[]),a=k.useCallback(i=>xd("DELETE",i),[]);return k.useMemo(()=>({get:e,post:r,put:n,del:a}),[e,r,n,a])}function kK(e){const r=[],n=a=>{for(const i of a)r.push({number:i.number,title:i.title,state:i.state,labels:i.labels,activeTeam:i.activeTeam}),i.children.length>0&&n(i.children)};return n(e),r}function jK({message:e,onDone:r}){return k.useEffect(()=>{const n=setTimeout(r,2500);return()=>clearTimeout(n)},[r]),b.jsx("div",{className:"fixed bottom-6 left-1/2 -translate-x-1/2 z-[60] px-4 py-2 rounded bg-[#3FB950]/20 border border-[#3FB950]/40 text-[#3FB950] text-sm font-medium shadow-lg animate-fade-in",children:e})}function AK(e){switch(e){case"queued":return"Creating worktree...";case"launching":return"Starting Claude Code...";case"running":return"Team running";case"idle":return"Team idle";case"done":return"Completed";case"failed":return"Failed";case"stuck":return"Stuck";default:return e}}function OK(e){switch(e){case"assistant":return"text-[#58A6FF]";case"tool_use":return"text-[#D29922]";case"tool_result":return"text-[#A371F7]";case"result":return"text-[#3FB950]";default:return"text-[#8B949E]"}}function CK(e){var r,n,a;switch(e.type){case"assistant":{const i=(r=e.message)==null?void 0:r.content;if(Array.isArray(i)){const o=((n=i.find(u=>u.type==="text"))==null?void 0:n.text)??"";return o.substring(0,100)+(o.length>100?"...":"")}return""}case"tool_use":return((a=e.tool)==null?void 0:a.name)??"unknown";case"tool_result":return"completed";case"result":return"session complete";default:return""}}function TK({teamId:e,issueNumber:r,onClose:n}){const a=Ut(),[i,o]=k.useState("queued"),[u,c]=k.useState([]),[f,d]=k.useState([]),[h,m]=k.useState(null),g=k.useRef(null),y=k.useRef(null);k.useEffect(()=>{let _=!1;async function A(){if(!_)try{const T=await a.get(`teams/${e}`);if(_)return;o(T.status),T.status==="failed"&&m(`Team failed${T.stoppedAt?` at ${new Date(T.stoppedAt).toLocaleTimeString()}`:""}`);const C=await a.get(`teams/${e}/output?lines=50`);if(_)return;c(C.lines);const N=await a.get(`teams/${e}/stream-events`);if(_)return;d(N)}catch{}}A();const O=setInterval(A,2e3);return()=>{_=!0,clearInterval(O)}},[a,e]),k.useEffect(()=>{var _;(_=g.current)==null||_.scrollIntoView({behavior:"smooth"})},[u]),k.useEffect(()=>{var _;(_=g.current)==null||_.scrollIntoView({behavior:"smooth"})},[f]);const x=k.useRef(n);k.useEffect(()=>{x.current=n},[n]),k.useEffect(()=>{i==="running"&&!y.current&&(y.current=setTimeout(()=>x.current(),3e3))},[i]),k.useEffect(()=>()=>{y.current&&(clearTimeout(y.current),y.current=null)},[]);const E=(()=>{switch(i){case"queued":case"launching":return"text-[#D29922]";case"running":return"text-[#3FB950]";case"failed":return"text-[#F85149]";default:return"text-dark-muted"}})(),w=i==="queued"||i==="launching";return b.jsxs("div",{className:"px-5 py-4 space-y-3",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[w&&b.jsxs("svg",{className:"animate-spin h-4 w-4 text-[#D29922]",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[b.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),b.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),i==="running"&&b.jsx("svg",{className:"h-4 w-4 text-[#3FB950]",viewBox:"0 0 20 20",fill:"currentColor",children:b.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),i==="failed"&&b.jsx("svg",{className:"h-4 w-4 text-[#F85149]",viewBox:"0 0 20 20",fill:"currentColor",children:b.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})}),b.jsx("span",{className:`text-sm font-medium ${E}`,children:AK(i)}),b.jsxs("span",{className:"text-xs text-dark-muted ml-auto",children:["Issue #",r," · Team #",e]})]}),b.jsxs("div",{className:"space-y-1",children:[b.jsx(_d,{label:"Team queued",done:!0}),b.jsx(_d,{label:"Creating worktree...",done:i!=="queued",active:i==="queued"}),b.jsx(_d,{label:"Starting Claude Code...",done:i==="running"||i==="done"||i==="idle",active:i==="launching"}),b.jsx(_d,{label:"Team running",done:i==="running"||i==="done"||i==="idle",active:!1})]}),h&&b.jsx("div",{className:"px-3 py-2 rounded border border-[#F85149]/30 bg-[#F85149]/10 text-[#F85149] text-sm",children:h}),f.length>0&&b.jsxs("div",{className:"bg-[#0D1117] border border-dark-border rounded p-2 max-h-[200px] overflow-y-auto font-mono text-xs",children:[f.slice(-30).map((_,A)=>{var O;return b.jsxs("div",{className:"py-0.5 leading-relaxed",children:[b.jsx("span",{className:"text-dark-muted",children:((O=_.timestamp)==null?void 0:O.substring(11,19))??"--:--:--"})," ",b.jsx("span",{className:OK(_.type),children:_.type})," ",b.jsx("span",{className:"text-dark-text",children:CK(_)})]},A)}),b.jsx("div",{ref:g})]}),f.length===0&&u.length>0&&b.jsxs("div",{className:"bg-dark-base border border-dark-border rounded p-2 max-h-[200px] overflow-y-auto font-mono text-xs text-dark-muted",children:[u.map((_,A)=>b.jsx("div",{className:"whitespace-pre-wrap break-all leading-relaxed",children:_},A)),b.jsx("div",{ref:g})]}),i==="running"&&b.jsx("p",{className:"text-xs text-[#3FB950]/70",children:"Auto-closing in 3 seconds..."})]})}function _d({label:e,done:r,active:n}){return b.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[r?b.jsx("svg",{className:"h-3 w-3 text-[#3FB950]",viewBox:"0 0 20 20",fill:"currentColor",children:b.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}):n?b.jsxs("svg",{className:"animate-spin h-3 w-3 text-[#D29922]",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[b.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),b.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):b.jsx("div",{className:"h-3 w-3 rounded-full border border-dark-border"}),b.jsx("span",{className:r?"text-dark-text":n?"text-[#D29922]":"text-dark-muted",children:e})]})}function NK({open:e,onClose:r}){const n=Ut(),[a,i]=k.useState(!1),[o,u]=k.useState(!0),[c,f]=k.useState(""),[d,h]=k.useState(""),[m,g]=k.useState(""),[y,x]=k.useState("15000"),[E,w]=k.useState(!1),[_,A]=k.useState(null),[O,T]=k.useState(null),[C,N]=k.useState([]),[M,R]=k.useState(""),[L,D]=k.useState([]),[z,q]=k.useState(!1),[G,U]=k.useState(null),[Y,$]=k.useState(""),[J,re]=k.useState("green"),[oe,fe]=k.useState(null),[F,Z]=k.useState(null),ce=k.useRef(null),B=k.useRef(null);k.useEffect(()=>{if(e&&!oe){const K=setTimeout(()=>{var be;return(be=ce.current)==null?void 0:be.focus()},50);return()=>clearTimeout(K)}},[e,a,oe]),k.useEffect(()=>{e&&(n.get("projects").then(K=>{N(K),K.length===1&&R(String(K[0].id))}).catch(()=>{N([])}),n.get("usage").then(K=>{const be=Math.max(K.dailyPercent,K.weeklyPercent,K.sonnetPercent,K.extraPercent);be>80?re("red"):be>=50?re("yellow"):re("green")}).catch(()=>{re("green")}))},[e,n]),k.useEffect(()=>{if(!M){D([]),U(null);return}let K=!1;return q(!0),U(null),n.get(`projects/${M}/issues`).then(be=>{if(K)return;const ve=kK(be.tree);D(ve)}).catch(be=>{if(K)return;const ve=be instanceof Error?be.message:String(be);U(ve||"Failed to fetch issues"),D([])}).finally(()=>{K||q(!1)}),()=>{K=!0}},[M,n]),k.useEffect(()=>{e&&(f(""),h(""),g(""),x("15000"),A(null),i(!1),u(!0),R(""),fe(null),Z(null),re("green"),D([]),U(null),$(""))},[e]),k.useEffect(()=>{if(!e)return;function K(be){be.key==="Escape"&&r()}return document.addEventListener("keydown",K),()=>document.removeEventListener("keydown",K)},[e,r]);const H=k.useCallback(K=>{B.current&&!B.current.contains(K.target)&&r()},[r]),te=k.useMemo(()=>{if(!Y.trim())return L;const K=Y.toLowerCase().trim(),be=K.startsWith("#")?parseInt(K.slice(1),10):/^\d+$/.test(K)?parseInt(K,10):NaN;return L.filter(ve=>!isNaN(be)&&ve.number===be||ve.title.toLowerCase().includes(K)||String(ve.number).includes(K))},[L,Y]),he=k.useCallback(K=>{f(String(K.number)),$("")},[]),ge=k.useCallback(async K=>{if(A(null),C.length>0&&!M){A("Please select a project");return}const be=parseInt(c.trim(),10);if(isNaN(be)||be<1){A("Issue number must be a positive integer");return}const ve=m.trim()||void 0,_e=M?parseInt(M,10):void 0;w(!0);try{const $e=await n.post("teams/launch",{issueNumber:be,prompt:ve,projectId:_e,headless:o,...K?{force:!0}:{}});fe($e.id),Z(be)}catch($e){const Te=$e instanceof Error?$e.message:String($e);A(Te||"Failed to launch team")}finally{w(!1)}},[c,m,n,C,M,o]),W=k.useCallback(async()=>{A(null);const K=d.trim();if(!K){A("Enter at least one issue number");return}const be=K.split(/[,\s]+/).map(at=>at.trim()).filter(Boolean).map(at=>parseInt(at,10));if(be.some(at=>isNaN(at)||at<1)){A("All issue numbers must be positive integers");return}if(be.length===0){A("Enter at least one issue number");return}const ve=parseInt(y.trim(),10);if(isNaN(ve)||ve<0){A("Stagger delay must be a non-negative number (ms)");return}if(C.length>0&&!M){A("Please select a project");return}const _e=be.map(at=>({number:at})),$e=m.trim()||void 0,Te=M?parseInt(M,10):void 0;w(!0);try{await n.post("teams/launch-batch",{issues:_e,prompt:$e,delayMs:ve,projectId:Te,headless:o}),T(`Launched ${be.length} team${be.length>1?"s":""}`),r()}catch(at){const Yr=at instanceof Error?at.message:String(at);A(Yr||"Failed to launch batch")}finally{w(!1)}},[d,y,m,n,r,C,M,o]),le=k.useCallback(K=>{K.key==="Enter"&&!E&&(a?W():ge())},[a,E,ge,W]);if(!e&&!O)return null;const ye=oe!==null&&F!==null;return b.jsxs(b.Fragment,{children:[O&&b.jsx(jK,{message:O,onDone:()=>T(null)}),e&&b.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:H,children:b.jsxs("div",{ref:B,className:"w-[480px] max-w-[95vw] max-h-[90vh] flex flex-col bg-dark-surface border border-dark-border rounded-lg shadow-2xl",role:"dialog","aria-modal":"true","aria-label":ye?"Launch Progress":"Launch Team",children:[b.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-dark-border",children:[b.jsx("h2",{className:"text-base font-semibold text-dark-text",children:ye?"Launch Progress":"Launch Team"}),b.jsx("button",{onClick:r,className:"text-dark-muted hover:text-dark-text transition-colors p-1 rounded hover:bg-dark-border/30",title:"Close (Esc)",children:b.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:b.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]}),ye?b.jsx(TK,{teamId:oe,issueNumber:F,onClose:r}):b.jsxs("div",{className:"px-5 py-4 space-y-4 overflow-y-auto",children:[C.length>0?b.jsxs("div",{children:[b.jsxs("label",{className:"block text-sm text-dark-muted mb-1",children:["Project ",b.jsx("span",{className:"text-[#F85149]",children:"*"})]}),b.jsxs("select",{value:M,onChange:K=>R(K.target.value),className:"w-full px-3 py-2 text-sm rounded border border-dark-border bg-dark-base text-dark-text focus:outline-none focus:border-dark-accent focus:ring-1 focus:ring-dark-accent/30",disabled:E,children:[b.jsx("option",{value:"",children:"Select a project..."}),C.map(K=>b.jsx("option",{value:K.id,children:K.name},K.id))]})]}):b.jsx("div",{className:"px-3 py-2 rounded border border-[#D29922]/30 bg-[#D29922]/10 text-[#D29922] text-sm",children:"Add a project first"}),b.jsxs("div",{className:"flex flex-col gap-2",children:[b.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[b.jsx("input",{type:"checkbox",checked:a,onChange:K=>i(K.target.checked),className:"w-4 h-4 rounded border-dark-border bg-dark-base text-dark-accent focus:ring-dark-accent/50 focus:ring-offset-0 accent-[#58A6FF]"}),b.jsx("span",{className:"text-sm text-dark-muted",children:"Batch mode"})]}),b.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",title:o?"Runs Claude Code in the background with no visible window":"Opens Claude Code in a visible terminal window",children:[b.jsx("input",{type:"checkbox",checked:o,onChange:K=>u(K.target.checked),className:"w-4 h-4 rounded border-dark-border bg-dark-base text-dark-accent focus:ring-dark-accent/50 focus:ring-offset-0 accent-[#58A6FF]"}),b.jsx("span",{className:"text-sm text-dark-muted",children:"Run headless (background)"}),!o&&b.jsx("span",{className:"text-xs text-dark-muted/60",children:"— opens in a visible terminal window"})]})]}),a?b.jsxs(b.Fragment,{children:[b.jsxs("div",{children:[b.jsxs("label",{className:"block text-sm text-dark-muted mb-1",children:["Issue numbers ",b.jsx("span",{className:"text-[#F85149]",children:"*"})]}),b.jsx("input",{ref:ce,type:"text",value:d,onChange:K=>h(K.target.value),onKeyDown:le,placeholder:"e.g. 763, 812, 756",className:"w-full px-3 py-2 text-sm rounded border border-dark-border bg-dark-base text-dark-text placeholder:text-dark-muted/50 focus:outline-none focus:border-dark-accent focus:ring-1 focus:ring-dark-accent/30",disabled:E}),b.jsx("p",{className:"text-xs text-dark-muted mt-1",children:"Comma or space separated"})]}),b.jsxs("div",{children:[b.jsx("label",{className:"block text-sm text-dark-muted mb-1",children:"Stagger delay (ms)"}),b.jsx("input",{type:"text",inputMode:"numeric",pattern:"[0-9]*",value:y,onChange:K=>x(K.target.value),placeholder:"15000",className:"w-full px-3 py-2 text-sm rounded border border-dark-border bg-dark-base text-dark-text placeholder:text-dark-muted/50 focus:outline-none focus:border-dark-accent focus:ring-1 focus:ring-dark-accent/30",disabled:E})]})]}):b.jsxs("div",{className:"space-y-2",children:[M&&b.jsxs("div",{children:[b.jsx("label",{className:"block text-sm text-dark-muted mb-1",children:"Select issue"}),z&&b.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 text-xs text-dark-muted",children:[b.jsxs("svg",{className:"animate-spin h-3 w-3",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[b.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),b.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Loading issues..."]}),G&&b.jsx("div",{className:"px-3 py-2 rounded border border-[#F85149]/30 bg-[#F85149]/10 text-[#F85149] text-xs",children:G}),!z&&!G&&L.length>0&&b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"relative mb-1",children:[b.jsx("input",{type:"text",value:Y,onChange:K=>$(K.target.value),placeholder:"Filter issues... (#number or title)",className:"w-full px-3 py-1.5 text-xs rounded border border-dark-border bg-[#0D1117] text-dark-text placeholder:text-dark-muted/50 focus:outline-none focus:border-dark-accent focus:ring-1 focus:ring-dark-accent/30",disabled:E}),Y&&b.jsx("button",{onClick:()=>$(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-dark-muted hover:text-dark-text transition-colors","aria-label":"Clear search",children:b.jsx("svg",{className:"w-3 h-3",viewBox:"0 0 16 16",fill:"currentColor",children:b.jsx("path",{d:"M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"})})})]}),b.jsx("div",{className:"max-h-[200px] overflow-y-auto border border-dark-border rounded bg-[#0D1117]",children:te.length===0?b.jsxs("div",{className:"px-3 py-2 text-xs text-dark-muted",children:["No issues match “",Y,"”"]}):te.map(K=>{const be=c===String(K.number),ve=!!K.activeTeam;return b.jsxs("button",{onClick:()=>he(K),disabled:E,className:`w-full text-left px-3 py-1.5 text-xs flex items-center gap-2 transition-colors border-b border-dark-border/30 last:border-b-0 ${be?"bg-dark-accent/15 text-dark-accent":"hover:bg-dark-surface text-dark-text"}`,children:[K.state==="open"?b.jsxs("svg",{className:"w-3.5 h-3.5 text-[#3FB950] shrink-0",viewBox:"0 0 16 16",fill:"currentColor",children:[b.jsx("path",{d:"M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"}),b.jsx("path",{d:"M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Z"})]}):b.jsxs("svg",{className:"w-3.5 h-3.5 text-[#A371F7] shrink-0",viewBox:"0 0 16 16",fill:"currentColor",children:[b.jsx("path",{d:"M11.28 6.78a.75.75 0 0 0-1.06-1.06L7.25 8.69 5.78 7.22a.75.75 0 0 0-1.06 1.06l2 2a.75.75 0 0 0 1.06 0l3.5-3.5Z"}),b.jsx("path",{d:"M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0Zm-1.5 0a6.5 6.5 0 1 0-13 0 6.5 6.5 0 0 0 13 0Z"})]}),b.jsxs("span",{className:"text-dark-muted shrink-0",children:["#",K.number]}),b.jsx("span",{className:"truncate",children:K.title}),ve&&b.jsx("span",{className:"ml-auto shrink-0 px-1.5 py-0.5 rounded text-[10px] font-medium bg-[#D29922]/15 text-[#D29922] border border-[#D29922]/30",children:K.activeTeam.status}),be&&b.jsx("svg",{className:"w-3.5 h-3.5 text-dark-accent ml-auto shrink-0",viewBox:"0 0 20 20",fill:"currentColor",children:b.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})]},K.number)})}),b.jsxs("p",{className:"text-xs text-dark-muted mt-1",children:[L.length," issue",L.length!==1?"s":""," found",Y&&te.length!==L.length&&` (${te.length} matching)`]})]}),!z&&!G&&L.length===0&&b.jsx("div",{className:"px-3 py-2 text-xs text-dark-muted",children:"No issues found for this project"})]}),b.jsxs("div",{children:[b.jsxs("label",{className:"block text-sm text-dark-muted mb-1",children:["Issue number ",b.jsx("span",{className:"text-[#F85149]",children:"*"}),M&&L.length>0&&b.jsx("span",{className:"text-dark-muted/50 text-xs ml-1",children:"(or type manually)"})]}),b.jsx("input",{ref:ce,type:"text",inputMode:"numeric",pattern:"[0-9]*",value:c,onChange:K=>f(K.target.value),onKeyDown:le,placeholder:"e.g. 763",className:"w-full px-3 py-2 text-sm rounded border border-dark-border bg-dark-base text-dark-text placeholder:text-dark-muted/50 focus:outline-none focus:border-dark-accent focus:ring-1 focus:ring-dark-accent/30",disabled:E})]})]}),b.jsxs("div",{children:[b.jsxs("label",{className:"block text-sm text-dark-muted mb-1",children:["Prompt ",b.jsx("span",{className:"text-dark-muted/50",children:"(optional)"})]}),b.jsx("input",{type:"text",value:m,onChange:K=>g(K.target.value),onKeyDown:le,placeholder:"Custom prompt (default: project prompt file)",className:"w-full px-3 py-2 text-sm rounded border border-dark-border bg-dark-base text-dark-text placeholder:text-dark-muted/50 focus:outline-none focus:border-dark-accent focus:ring-1 focus:ring-dark-accent/30",disabled:E}),b.jsxs("p",{className:"text-xs text-dark-muted mt-1",children:["Leave empty to use the project's prompt file (with ",b.jsx("code",{className:"text-dark-accent/70",children:"{{ISSUE_NUMBER}}"})," replaced automatically)."]})]}),J==="red"&&b.jsx("div",{className:"px-3 py-2 rounded border border-[#F85149]/30 bg-[#F85149]/10 text-[#F85149] text-sm",children:'Usage is in the red zone (>80%). New launches will be queued instead of started immediately. Use "Force Launch" to override.'}),_&&b.jsx("div",{className:"px-3 py-2 rounded border border-[#F85149]/30 bg-[#F85149]/10 text-[#F85149] text-sm",children:_})]}),b.jsxs("div",{className:"flex items-center justify-end gap-3 px-5 py-4 border-t border-dark-border",children:[b.jsx("button",{onClick:r,className:"px-3 py-1.5 text-sm rounded border border-dark-border text-dark-muted hover:text-dark-text hover:border-dark-muted transition-colors",children:ye?"Close":"Cancel"}),!ye&&b.jsxs(b.Fragment,{children:[b.jsx("button",{onClick:()=>a?W():void ge(),disabled:E||C.length===0,className:"px-4 py-1.5 text-sm font-medium rounded border border-dark-accent/40 text-dark-accent bg-dark-accent/10 hover:bg-dark-accent/20 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:E?"Launching...":J==="red"?a?"Queue All":"Queue":a?"Launch All":"Launch"}),J==="red"&&!a&&b.jsx("button",{onClick:()=>void ge(!0),disabled:E||C.length===0,className:"px-4 py-1.5 text-sm font-medium rounded border border-[#F85149]/40 text-[#F85149] bg-[#F85149]/10 hover:bg-[#F85149]/20 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:"Force launch ignoring red zone usage limits",children:"Force Launch"})]})]})]})})]})}function MK({size:e=20,className:r}){return b.jsxs("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("rect",{width:"7",height:"7",x:"3",y:"3",rx:"1"}),b.jsx("rect",{width:"7",height:"7",x:"14",y:"3",rx:"1"}),b.jsx("rect",{width:"7",height:"7",x:"14",y:"14",rx:"1"}),b.jsx("rect",{width:"7",height:"7",x:"3",y:"14",rx:"1"})]})}function PK({size:e=20,className:r}){return b.jsxs("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("line",{x1:"6",x2:"6",y1:"3",y2:"15"}),b.jsx("circle",{cx:"18",cy:"6",r:"3"}),b.jsx("circle",{cx:"6",cy:"18",r:"3"}),b.jsx("path",{d:"M18 9a9 9 0 0 1-9 9"})]})}function RK({size:e=20,className:r}){return b.jsxs("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("path",{d:"M3 3v18h18"}),b.jsx("path",{d:"M18 17V9"}),b.jsx("path",{d:"M13 17V5"}),b.jsx("path",{d:"M8 17v-3"})]})}function DK({size:e=20,className:r}){return b.jsxs("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5"}),b.jsx("circle",{cx:"13",cy:"12",r:"2"}),b.jsx("path",{d:"M18 19c-2.8 0-5-2.2-5-5v8"}),b.jsx("circle",{cx:"20",cy:"19",r:"2"})]})}function LK({size:e=14,className:r}){return b.jsxs("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z"}),b.jsx("path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z"}),b.jsx("path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0"}),b.jsx("path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5"})]})}function IK({size:e=14,className:r}){return b.jsx("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:b.jsx("polygon",{points:"6 3 20 12 6 21 6 3"})})}function RS({size:e=14,className:r}){return b.jsxs("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),b.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function zK({size:e=14,className:r}){return b.jsxs("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}),b.jsx("path",{d:"M21 3v5h-5"}),b.jsx("path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}),b.jsx("path",{d:"M8 16H3v5"})]})}function qK({size:e=20,className:r}){return b.jsx("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:b.jsx("path",{d:"M22 12h-4l-3 9L9 3l-3 9H2"})})}function BK({size:e=14,className:r}){return b.jsx("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:b.jsx("path",{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z"})})}function $K({size:e=14,className:r}){return b.jsxs("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),b.jsx("circle",{cx:"12",cy:"7",r:"4"})]})}function UK({size:e=14,className:r}){return b.jsxs("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("circle",{cx:"12",cy:"12",r:"10"}),b.jsx("polyline",{points:"12 6 12 12 16 14"})]})}function dT({size:e=14,className:r}){return b.jsx("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:b.jsx("path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"})})}function FK({size:e=14,className:r}){return b.jsxs("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("circle",{cx:"12",cy:"12",r:"1"}),b.jsx("circle",{cx:"19",cy:"12",r:"1"}),b.jsx("circle",{cx:"5",cy:"12",r:"1"})]})}function HK({size:e=14,className:r}){return b.jsxs("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),b.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})}function GK({size:e=14,className:r}){return b.jsx("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:b.jsx("path",{d:"m9 18 6-6-6-6"})})}const Wn={queued:"#8B949E",launching:"#D29922",running:"#3FB950",idle:"#D29922",stuck:"#F85149",done:"#A371F7",failed:"#F85149"};function X6(e,r){const n=Math.max(0,r-10);return e>=r?"#F85149":e>=n?"#D29922":"#3FB950"}const hT={"team-lead":"#58A6FF",coordinator:"#58A6FF",tl:"#58A6FF",analyst:"#D29922",dev:"#3FB950",developer:"#3FB950",reviewer:"#A371F7"},pT=["#58A6FF","#3FB950","#D29922","#A371F7","#F778BA","#79C0FF","#7EE787","#E3B341","#D2A8FF","#FF7B72"];function Ec(e,r){if(r){const i=hT[r.toLowerCase()];if(i)return i}const n=hT[e.toLowerCase()];if(n)return n;let a=0;for(let i=0;i<e.length;i++)a=(a<<5)-a+e.charCodeAt(i)|0;return pT[Math.abs(a)%pT.length]}function u2(e){if(!e)return null;const r=new Date(e).getTime()-Date.now();if(r<=0)return null;const n=Math.floor(r/36e5),a=Math.floor(r%36e5/6e4);return n>0?`Resets in ${n}h ${a}m`:`Resets in ${a}m`}const KK={daily:85,weekly:95,sonnet:95,extra:95};function VK(){const{teams:e}=Sc(),r=Ut(),[n,a]=k.useState(!1),[i,o]=k.useState(null),u=k.useCallback(async()=>{try{const g=await r.get("usage");o(g)}catch{}},[r]);k.useEffect(()=>{u();const g=setInterval(u,3e4);return()=>clearInterval(g)},[u]);const c=e.reduce((g,y)=>(g[y.status]=(g[y.status]||0)+1,g),{}),f=(i==null?void 0:i.redThresholds)??KK,d=i?[{key:"daily",label:"Daily",percent:i.dailyPercent,redThreshold:f.daily,resetLabel:u2(i.dailyResetsAt)},{key:"weekly",label:"Weekly",percent:i.weeklyPercent,redThreshold:f.weekly,resetLabel:u2(i.weeklyResetsAt)},{key:"sonnet",label:"Sonnet",percent:i.sonnetPercent,redThreshold:f.sonnet,resetLabel:null},{key:"extra",label:"Extra",percent:i.extraPercent,redThreshold:f.extra,resetLabel:null}]:[],h=[{label:"running",count:c.running||0,color:Wn.running},{label:"queued",count:c.queued||0,color:Wn.queued},{label:"launching",count:c.launching||0,color:Wn.launching},{label:"idle",count:c.idle||0,color:Wn.idle},{label:"stuck",count:c.stuck||0,color:Wn.stuck}].filter(g=>g.count>0),m=(i==null?void 0:i.zone)==="red";return b.jsxs(b.Fragment,{children:[b.jsxs("header",{className:"h-12 min-h-[48px] bg-dark-surface border-b border-dark-border flex items-center px-4 justify-between shrink-0",children:[b.jsx("div",{className:"flex items-center gap-3",children:b.jsx("h1",{className:"text-sm font-semibold text-dark-text tracking-wide",children:"Fleet Commander"})}),b.jsxs("div",{className:"flex items-center gap-3",children:[h.map((g,y)=>b.jsxs("span",{className:"text-xs font-medium",children:[b.jsx("span",{style:{color:g.color},children:g.count}),b.jsx("span",{className:"text-dark-muted ml-1",children:g.label}),y<h.length-1&&b.jsx("span",{className:"text-dark-muted ml-3",children:"·"})]},g.label)),d.length>0&&h.length>0&&b.jsx("span",{className:"text-dark-muted mx-1",children:"|"}),d.map(g=>b.jsxs("span",{className:"text-xs font-medium",title:g.resetLabel??void 0,children:[b.jsx("span",{className:"text-dark-muted",children:g.label})," ",b.jsxs("span",{style:{color:X6(g.percent,g.redThreshold)},children:[g.percent.toFixed(0),"%"]})]},g.key)),m&&b.jsx("span",{className:"text-xs font-bold animate-pulse",style:{color:"#F85149"},children:"PAUSED"}),b.jsxs("button",{type:"button",onClick:g=>{g.stopPropagation(),g.preventDefault(),a(!0)},className:"ml-2 px-3 py-1 text-xs font-medium rounded border border-dark-accent/40 text-dark-accent hover:bg-dark-accent/10 transition-colors inline-flex items-center gap-1.5",title:"Launch a new team",children:[b.jsx(LK,{size:14}),"Launch Team"]})]})]}),MS.createPortal(b.jsx(NK,{open:n,onClose:()=>a(!1)}),document.body)]})}const YK=[{to:"/",label:"Fleet Grid",icon:b.jsx(MK,{})},{to:"/issues",label:"Issue Tree",icon:b.jsx(PK,{})},{to:"/usage",label:"Usage View",icon:b.jsx(RK,{})},{to:"/projects",label:"Projects",icon:b.jsx(DK,{})},{to:"/lifecycle",label:"Lifecycle",icon:b.jsx(qK,{size:20})},{to:"/settings",label:"Settings",icon:b.jsx(RS,{size:20})}];function XK(){return b.jsx("nav",{className:"w-14 min-w-[56px] bg-dark-surface border-r border-dark-border flex flex-col items-center pt-2 gap-1",children:YK.map(e=>b.jsx(G6,{to:e.to,end:e.to==="/",title:e.label,className:({isActive:r})=>`w-10 h-10 flex items-center justify-center rounded-md text-lg transition-colors ${r?"text-dark-accent bg-dark-accent/10":"text-dark-muted hover:text-dark-text hover:bg-dark-border/50"}`,children:e.icon},e.to))})}function WK(){const{connected:e,lastEvent:r}=Sc(),[n,a]=k.useState(null);return k.useEffect(()=>{if(!r){a(null);return}const i=()=>{a(Math.floor((Date.now()-r.getTime())/1e3))};i();const o=setInterval(i,1e3);return()=>clearInterval(o)},[r]),b.jsxs("footer",{className:"h-6 min-h-[24px] bg-dark-base border-t border-dark-border flex items-center px-3 text-xs text-dark-muted select-none",children:[b.jsx("span",{className:`inline-block w-2 h-2 rounded-full mr-2 ${e?"bg-green-500":"bg-red-500"}`}),b.jsx("span",{children:e?"Connected":"Disconnected"}),n!==null&&b.jsxs("span",{className:"ml-4",children:["Last update: ",n,"s ago"]})]})}const ZK={queued:"Queued",running:"Running",stuck:"Stuck",idle:"Idle",done:"Done",failed:"Failed",launching:"Launching"};function DS({status:e}){const r=Wn[e]??"#8B949E",n=ZK[e]??e;let a="";return e==="stuck"?a="animate-pulse-stuck":e==="launching"&&(a="animate-blink"),b.jsxs("span",{className:"inline-flex items-center gap-2",children:[b.jsx("span",{className:`inline-block w-2.5 h-2.5 rounded-full shrink-0 ${a}`,style:{backgroundColor:r}}),b.jsx("span",{className:"text-sm font-medium",style:{color:r},children:n})]})}function QK(e,r){return e==="success"?{icon:"✓",color:"#3FB950"}:e==="failure"?{icon:"✕",color:"#F85149"}:e==="cancelled"?{icon:"―",color:"#8B949E"}:r==="in_progress"||r==="queued"||r==="pending"?{icon:"○",color:"#D29922"}:{icon:"○",color:"#8B949E"}}function W6({checks:e}){return e.length===0?b.jsx("p",{className:"text-dark-muted text-sm",children:"No CI checks available"}):b.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.map((r,n)=>{const{icon:a,color:i}=QK(r.conclusion,r.status),o=r.conclusion==="success"?"rgba(63, 185, 80, 0.15)":r.conclusion==="failure"?"rgba(248, 81, 73, 0.15)":r.conclusion==="cancelled"?"rgba(139, 148, 158, 0.15)":"rgba(210, 153, 34, 0.15)";return b.jsxs("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full max-w-[10rem]",style:{backgroundColor:o},title:r.name,children:[b.jsx("span",{className:"font-bold leading-none shrink-0",style:{color:i},children:a}),b.jsx("span",{className:"truncate",style:{color:i},children:r.name})]},`${r.name}-${n}`)})})}const LS="__pm__",IS="__fc__";function JK(e){return e===LS?"You":e===IS?"FC":e==="team-lead"||e==="tl"?"TL":e.charAt(0).toUpperCase()+e.slice(1)}const eV={[LS]:"#3FB950",[IS]:"#D29922"};function tV({roster:e,activeFilters:r,onFiltersChange:n,hasUserEntries:a,hasFcEntries:i}){const o=k.useMemo(()=>{const d=new Set;d.add("team-lead");for(const m of e)d.add(m.name.toLowerCase());const h=Array.from(d).sort((m,g)=>m==="team-lead"?-1:g==="team-lead"?1:m.localeCompare(g));return a&&h.push(LS),i&&h.push(IS),h},[e,a,i]);if(o.length<=1)return null;const u=r.size===0||r.size===o.length,c=()=>{n(new Set)},f=d=>{const h=new Set(r);if(u){n(new Set([d]));return}if(h.has(d)){if(h.delete(d),h.size===0){n(new Set);return}}else if(h.add(d),h.size===o.length){n(new Set);return}n(h)};return b.jsxs("div",{className:"flex items-center gap-1 mb-2 flex-wrap",children:[b.jsx("button",{onClick:c,className:"px-2 py-0.5 text-[10px] font-medium rounded-full border transition-all duration-150",style:u?{color:"#C9D1D9",borderColor:"#C9D1D960",backgroundColor:"#C9D1D918"}:{color:"#484F58",borderColor:"#484F5840",opacity:.7},children:"All"}),o.map(d=>{const h=eV[d]??Ec(d,d),m=!u&&r.has(d);return b.jsxs("button",{onClick:()=>f(d),className:"px-2 py-0.5 text-[10px] font-medium rounded-full border transition-all duration-150 flex items-center gap-1",style:m?{color:h,borderColor:h+"60",backgroundColor:h+"18"}:{color:"#484F58",borderColor:"#484F5840",opacity:.5},children:[b.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full shrink-0",style:{backgroundColor:m?h:"#484F58"}}),JK(d)]},d)})]})}function So(e){return!e||e==="team-lead"||e==="tl"?"TL":e.charAt(0).toUpperCase()+e.slice(1)}const rV={assistant:{color:"#58A6FF",label:"TL"},user:{color:"#3FB950",label:"You"},fc:{color:"#D29922",label:"FC"},system:{color:"#8B949E",label:"system"},tool_use:{color:"#D29922",label:"tool"},tool_result:{color:"#A371F7",label:"result"},result:{color:"#3FB950",label:"done"},rate_limit_event:{color:"#D29922",label:"rate-limit"}};function ah(e){return rV[e]??{color:"#8B949E",label:e}}const nV={initial_prompt:"prompt",origin_sync:"sync",idle_nudge:"idle",stuck_nudge:"nudge",ci_green:"CI pass",ci_red:"CI fail",ci_blocked:"CI blocked",pr_merged_shutdown:"shutdown",subagent_crash:"crash"};function Z6(e){return e?nV[e]??e:null}const Q6=new Set(["assistant","user","fc"]);function J6(e){var n;if(!Q6.has(e.streamType))return"";const r=(n=e.message)==null?void 0:n.content;return Array.isArray(r)?r.filter(a=>a.type==="text"&&a.text).map(a=>a.text).join(`
|
|
60
|
+
Please change the parent <Route path="${_}"> to <Route path="${_==="/"?"*":`${_}/*`}">.`)}let h=Hi(),m;if(r){let _=typeof r=="string"?ou(r):r;mt(f==="/"||((w=_.pathname)==null?void 0:w.startsWith(f)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${f}" but pathname "${_.pathname}" was given in the \`location\` prop.`),m=_}else m=h;let g=m.pathname||"/",y=g;if(f!=="/"){let _=f.replace(/^\//,"").split("/");y="/"+g.replace(/^\//,"").split("/").slice(_.length).join("/")}let x=A6(e,{pathname:y});na(d||x!=null,`No routes matched location "${m.pathname}${m.search}${m.hash}" `),na(x==null||x[x.length-1].route.element!==void 0||x[x.length-1].route.Component!==void 0||x[x.length-1].route.lazy!==void 0,`Matched leaf route at location "${m.pathname}${m.search}${m.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let E=DG(x&&x.map(_=>Object.assign({},_,{params:Object.assign({},u,_.params),pathname:ea([f,a.encodeLocation?a.encodeLocation(_.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:_.pathname]),pathnameBase:_.pathnameBase==="/"?f:ea([f,a.encodeLocation?a.encodeLocation(_.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:_.pathnameBase])})),i,n);return r&&E?k.createElement(xc.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...m},navigationType:"POP"}},E):E}function NG(){let e=BG(),r=gG(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:a},o={padding:"2px 4px",backgroundColor:a},u=null;return console.error("Error handled by React Router default ErrorBoundary:",e),u=k.createElement(k.Fragment,null,k.createElement("p",null,"💿 Hey developer 👋"),k.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",k.createElement("code",{style:o},"ErrorBoundary")," or"," ",k.createElement("code",{style:o},"errorElement")," prop on your route.")),k.createElement(k.Fragment,null,k.createElement("h2",null,"Unexpected Application Error!"),k.createElement("h3",{style:{fontStyle:"italic"}},r),n?k.createElement("pre",{style:i},n):null,u)}var MG=k.createElement(NG,null),q6=class extends k.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,r){return r.location!==e.location||r.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:r.error,location:r.location,revalidation:e.revalidation||r.revalidation}}componentDidCatch(e,r){this.props.onError?this.props.onError(e,r):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=jG(e.digest);n&&(e=n)}let r=e!==void 0?k.createElement(Ja.Provider,{value:this.props.routeContext},k.createElement(AS.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?k.createElement(PG,{error:e},r):r}};q6.contextType=xG;var Wg=new WeakMap;function PG({children:e,error:r}){let{basename:n}=k.useContext(bn);if(typeof r=="object"&&r&&"digest"in r&&typeof r.digest=="string"){let a=kG(r.digest);if(a){let i=Wg.get(r);if(i)throw i;let o=M6(a.location,n);if(N6&&!Wg.get(r))if(o.isExternal||a.reloadDocument)window.location.href=o.absoluteURL||o.to;else{const u=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:a.replace}));throw Wg.set(r,u),u}return k.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function RG({routeContext:e,match:r,children:n}){let a=k.useContext(lu);return a&&a.static&&a.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=r.route.id),k.createElement(Ja.Provider,{value:e},n)}function DG(e,r=[],n){let a=n==null?void 0:n.state;if(e==null){if(!a)return null;if(a.errors)e=a.matches;else if(r.length===0&&!a.initialized&&a.matches.length>0)e=a.matches;else return null}let i=e,o=a==null?void 0:a.errors;if(o!=null){let h=i.findIndex(m=>m.route.id&&(o==null?void 0:o[m.route.id])!==void 0);mt(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),i=i.slice(0,Math.min(i.length,h+1))}let u=!1,c=-1;if(n&&a){u=a.renderFallback;for(let h=0;h<i.length;h++){let m=i[h];if((m.route.HydrateFallback||m.route.hydrateFallbackElement)&&(c=h),m.route.id){let{loaderData:g,errors:y}=a,x=m.route.loader&&!g.hasOwnProperty(m.route.id)&&(!y||y[m.route.id]===void 0);if(m.route.lazy||x){n.isStatic&&(u=!0),c>=0?i=i.slice(0,c+1):i=[i[0]];break}}}}let f=n==null?void 0:n.onError,d=a&&f?(h,m)=>{var g,y;f(h,{location:a.location,params:((y=(g=a.matches)==null?void 0:g[0])==null?void 0:y.params)??{},unstable_pattern:yG(a.matches),errorInfo:m})}:void 0;return i.reduceRight((h,m,g)=>{let y,x=!1,E=null,w=null;a&&(y=o&&m.route.id?o[m.route.id]:void 0,E=m.route.errorElement||MG,u&&(c<0&&g===0?(B6("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),x=!0,w=null):c===g&&(x=!0,w=m.route.hydrateFallbackElement||null)));let _=r.concat(i.slice(0,g+1)),A=()=>{let O;return y?O=E:x?O=w:m.route.Component?O=k.createElement(m.route.Component,null):m.route.element?O=m.route.element:O=h,k.createElement(RG,{match:m,routeContext:{outlet:h,matches:_,isDataRoute:a!=null},children:O})};return a&&(m.route.ErrorBoundary||m.route.errorElement||g===0)?k.createElement(q6,{location:a.location,revalidation:a.revalidation,component:E,error:y,children:A(),routeContext:{outlet:null,matches:_,isDataRoute:!0},onError:d}):A()},null)}function OS(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function LG(e){let r=k.useContext(lu);return mt(r,OS(e)),r}function IG(e){let r=k.useContext(gp);return mt(r,OS(e)),r}function zG(e){let r=k.useContext(Ja);return mt(r,OS(e)),r}function CS(e){let r=zG(e),n=r.matches[r.matches.length-1];return mt(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function qG(){return CS("useRouteId")}function BG(){var a;let e=k.useContext(AS),r=IG("useRouteError"),n=CS("useRouteError");return e!==void 0?e:(a=r.errors)==null?void 0:a[n]}function $G(){let{router:e}=LG("useNavigate"),r=CS("useNavigate"),n=k.useRef(!1);return I6(()=>{n.current=!0}),k.useCallback(async(i,o={})=>{na(n.current,L6),n.current&&(typeof i=="number"?await e.navigate(i):await e.navigate(i,{fromRouteId:r,...o}))},[e,r])}var cT={};function B6(e,r,n){!r&&!cT[e]&&(cT[e]=!0,na(!1,n))}k.memo(UG);function UG({routes:e,future:r,state:n,isStatic:a,onError:i}){return z6(e,void 0,{state:n,isStatic:a,onError:i})}function bo(e){mt(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function FG({basename:e="/",children:r=null,location:n,navigationType:a="POP",navigator:i,static:o=!1,unstable_useTransitions:u}){mt(!_c(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let c=e.replace(/^\/*/,"/"),f=k.useMemo(()=>({basename:c,navigator:i,static:o,unstable_useTransitions:u,future:{}}),[c,i,o,u]);typeof n=="string"&&(n=ou(n));let{pathname:d="/",search:h="",hash:m="",state:g=null,key:y="default",unstable_mask:x}=n,E=k.useMemo(()=>{let w=Ga(d,c);return w==null?null:{location:{pathname:w,search:h,hash:m,state:g,key:y,unstable_mask:x},navigationType:a}},[c,d,h,m,g,y,a,x]);return na(E!=null,`<Router basename="${c}"> is not able to match the URL "${d}${h}${m}" because it does not start with the basename, so the <Router> won't render anything.`),E==null?null:k.createElement(bn.Provider,{value:f},k.createElement(xc.Provider,{children:r,value:E}))}function HG({children:e,location:r}){return TG(l2(e),r)}function l2(e,r=[]){let n=[];return k.Children.forEach(e,(a,i)=>{if(!k.isValidElement(a))return;let o=[...r,i];if(a.type===k.Fragment){n.push.apply(n,l2(a.props.children,o));return}mt(a.type===bo,`[${typeof a.type=="string"?a.type:a.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),mt(!a.props.index||!a.props.children,"An index route cannot have child routes.");let u={id:a.props.id||o.join("-"),caseSensitive:a.props.caseSensitive,element:a.props.element,Component:a.props.Component,index:a.props.index,path:a.props.path,middleware:a.props.middleware,loader:a.props.loader,action:a.props.action,hydrateFallbackElement:a.props.hydrateFallbackElement,HydrateFallback:a.props.HydrateFallback,errorElement:a.props.errorElement,ErrorBoundary:a.props.ErrorBoundary,hasErrorBoundary:a.props.hasErrorBoundary===!0||a.props.ErrorBoundary!=null||a.props.errorElement!=null,shouldRevalidate:a.props.shouldRevalidate,handle:a.props.handle,lazy:a.props.lazy};a.props.children&&(u.children=l2(a.props.children,o)),n.push(u)}),n}var Gd="get",Kd="application/x-www-form-urlencoded";function yp(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function GG(e){return yp(e)&&e.tagName.toLowerCase()==="button"}function KG(e){return yp(e)&&e.tagName.toLowerCase()==="form"}function VG(e){return yp(e)&&e.tagName.toLowerCase()==="input"}function YG(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function XG(e,r){return e.button===0&&(!r||r==="_self")&&!YG(e)}var bd=null;function WG(){if(bd===null)try{new FormData(document.createElement("form"),0),bd=!1}catch{bd=!0}return bd}var ZG=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Zg(e){return e!=null&&!ZG.has(e)?(na(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Kd}"`),null):e}function QG(e,r){let n,a,i,o,u;if(KG(e)){let c=e.getAttribute("action");a=c?Ga(c,r):null,n=e.getAttribute("method")||Gd,i=Zg(e.getAttribute("enctype"))||Kd,o=new FormData(e)}else if(GG(e)||VG(e)&&(e.type==="submit"||e.type==="image")){let c=e.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let f=e.getAttribute("formaction")||c.getAttribute("action");if(a=f?Ga(f,r):null,n=e.getAttribute("formmethod")||c.getAttribute("method")||Gd,i=Zg(e.getAttribute("formenctype"))||Zg(c.getAttribute("enctype"))||Kd,o=new FormData(c,e),!WG()){let{name:d,type:h,value:m}=e;if(h==="image"){let g=d?`${d}.`:"";o.append(`${g}x`,"0"),o.append(`${g}y`,"0")}else d&&o.append(d,m)}}else{if(yp(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Gd,a=null,i=Kd,u=e}return o&&i==="text/plain"&&(u=o,o=void 0),{action:a,method:n.toLowerCase(),encType:i,formData:o,body:u}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function TS(e,r){if(e===!1||e===null||typeof e>"u")throw new Error(r)}function JG(e,r,n,a){let i=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?i.pathname.endsWith("/")?i.pathname=`${i.pathname}_.${a}`:i.pathname=`${i.pathname}.${a}`:i.pathname==="/"?i.pathname=`_root.${a}`:r&&Ga(i.pathname,r)==="/"?i.pathname=`${r.replace(/\/$/,"")}/_root.${a}`:i.pathname=`${i.pathname.replace(/\/$/,"")}.${a}`,i}async function eK(e,r){if(e.id in r)return r[e.id];try{let n=await import(e.module);return r[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function tK(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function rK(e,r,n){let a=await Promise.all(e.map(async i=>{let o=r.routes[i.route.id];if(o){let u=await eK(o,n);return u.links?u.links():[]}return[]}));return oK(a.flat(1).filter(tK).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function fT(e,r,n,a,i,o){let u=(f,d)=>n[d]?f.route.id!==n[d].route.id:!0,c=(f,d)=>{var h;return n[d].pathname!==f.pathname||((h=n[d].route.path)==null?void 0:h.endsWith("*"))&&n[d].params["*"]!==f.params["*"]};return o==="assets"?r.filter((f,d)=>u(f,d)||c(f,d)):o==="data"?r.filter((f,d)=>{var m;let h=a.routes[f.route.id];if(!h||!h.hasLoader)return!1;if(u(f,d)||c(f,d))return!0;if(f.route.shouldRevalidate){let g=f.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:((m=n[0])==null?void 0:m.params)||{},nextUrl:new URL(e,window.origin),nextParams:f.params,defaultShouldRevalidate:!0});if(typeof g=="boolean")return g}return!0}):[]}function nK(e,r,{includeHydrateFallback:n}={}){return aK(e.map(a=>{let i=r.routes[a.route.id];if(!i)return[];let o=[i.module];return i.clientActionModule&&(o=o.concat(i.clientActionModule)),i.clientLoaderModule&&(o=o.concat(i.clientLoaderModule)),n&&i.hydrateFallbackModule&&(o=o.concat(i.hydrateFallbackModule)),i.imports&&(o=o.concat(i.imports)),o}).flat(1))}function aK(e){return[...new Set(e)]}function iK(e){let r={},n=Object.keys(e).sort();for(let a of n)r[a]=e[a];return r}function oK(e,r){let n=new Set;return new Set(r),e.reduce((a,i)=>{let o=JSON.stringify(iK(i));return n.has(o)||(n.add(o),a.push({key:o,link:i})),a},[])}function $6(){let e=k.useContext(lu);return TS(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function lK(){let e=k.useContext(gp);return TS(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var NS=k.createContext(void 0);NS.displayName="FrameworkContext";function U6(){let e=k.useContext(NS);return TS(e,"You must render this element inside a <HydratedRouter> element"),e}function uK(e,r){let n=k.useContext(NS),[a,i]=k.useState(!1),[o,u]=k.useState(!1),{onFocus:c,onBlur:f,onMouseEnter:d,onMouseLeave:h,onTouchStart:m}=r,g=k.useRef(null);k.useEffect(()=>{if(e==="render"&&u(!0),e==="viewport"){let E=_=>{_.forEach(A=>{u(A.isIntersecting)})},w=new IntersectionObserver(E,{threshold:.5});return g.current&&w.observe(g.current),()=>{w.disconnect()}}},[e]),k.useEffect(()=>{if(a){let E=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(E)}}},[a]);let y=()=>{i(!0)},x=()=>{i(!1),u(!1)};return n?e!=="intent"?[o,g,{}]:[o,g,{onFocus:bs(c,y),onBlur:bs(f,x),onMouseEnter:bs(d,y),onMouseLeave:bs(h,x),onTouchStart:bs(m,y)}]:[!1,g,{}]}function bs(e,r){return n=>{e&&e(n),n.defaultPrevented||r(n)}}function sK({page:e,...r}){let{router:n}=$6(),a=k.useMemo(()=>A6(n.routes,e,n.basename),[n.routes,e,n.basename]);return a?k.createElement(fK,{page:e,matches:a,...r}):null}function cK(e){let{manifest:r,routeModules:n}=U6(),[a,i]=k.useState([]);return k.useEffect(()=>{let o=!1;return rK(e,r,n).then(u=>{o||i(u)}),()=>{o=!0}},[e,r,n]),a}function fK({page:e,matches:r,...n}){let a=Hi(),{future:i,manifest:o,routeModules:u}=U6(),{basename:c}=$6(),{loaderData:f,matches:d}=lK(),h=k.useMemo(()=>fT(e,r,d,o,a,"data"),[e,r,d,o,a]),m=k.useMemo(()=>fT(e,r,d,o,a,"assets"),[e,r,d,o,a]),g=k.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let E=new Set,w=!1;if(r.forEach(A=>{var T;let O=o.routes[A.route.id];!O||!O.hasLoader||(!h.some(C=>C.route.id===A.route.id)&&A.route.id in f&&((T=u[A.route.id])!=null&&T.shouldRevalidate)||O.hasClientLoader?w=!0:E.add(A.route.id))}),E.size===0)return[];let _=JG(e,c,i.unstable_trailingSlashAwareDataRequests,"data");return w&&E.size>0&&_.searchParams.set("_routes",r.filter(A=>E.has(A.route.id)).map(A=>A.route.id).join(",")),[_.pathname+_.search]},[c,i.unstable_trailingSlashAwareDataRequests,f,a,o,h,r,e,u]),y=k.useMemo(()=>nK(m,o),[m,o]),x=cK(m);return k.createElement(k.Fragment,null,g.map(E=>k.createElement("link",{key:E,rel:"prefetch",as:"fetch",href:E,...n})),y.map(E=>k.createElement("link",{key:E,rel:"modulepreload",href:E,...n})),x.map(({key:E,link:w})=>k.createElement("link",{key:E,nonce:n.nonce,...w,crossOrigin:w.crossOrigin??n.crossOrigin})))}function dK(...e){return r=>{e.forEach(n=>{typeof n=="function"?n(r):n!=null&&(n.current=r)})}}var hK=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{hK&&(window.__reactRouterVersion="7.13.1")}catch{}function pK({basename:e,children:r,unstable_useTransitions:n,window:a}){let i=k.useRef();i.current==null&&(i.current=VH({window:a,v5Compat:!0}));let o=i.current,[u,c]=k.useState({action:o.action,location:o.location}),f=k.useCallback(d=>{n===!1?c(d):k.startTransition(()=>c(d))},[n]);return k.useLayoutEffect(()=>o.listen(f),[o,f]),k.createElement(FG,{basename:e,children:r,location:u.location,navigationType:u.action,navigator:o,unstable_useTransitions:n})}var F6=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,H6=k.forwardRef(function({onClick:r,discover:n="render",prefetch:a="none",relative:i,reloadDocument:o,replace:u,unstable_mask:c,state:f,target:d,to:h,preventScrollReset:m,viewTransition:g,unstable_defaultShouldRevalidate:y,...x},E){let{basename:w,navigator:_,unstable_useTransitions:A}=k.useContext(bn),O=typeof h=="string"&&F6.test(h),T=M6(h,w);h=T.to;let C=AG(h,{relative:i}),N=Hi(),M=null;if(c){let Y=jS(c,[],N.unstable_mask?N.unstable_mask.pathname:"/",!0);w!=="/"&&(Y.pathname=Y.pathname==="/"?w:ea([w,Y.pathname])),M=_.createHref(Y)}let[R,L,D]=uK(a,x),z=gK(h,{replace:u,unstable_mask:c,state:f,target:d,preventScrollReset:m,relative:i,viewTransition:g,unstable_defaultShouldRevalidate:y,unstable_useTransitions:A});function q(Y){r&&r(Y),Y.defaultPrevented||z(Y)}let G=!(T.isExternal||o),U=k.createElement("a",{...x,...D,href:(G?M:void 0)||T.absoluteURL||C,onClick:G?q:r,ref:dK(E,L),target:d,"data-discover":!O&&n==="render"?"true":void 0});return R&&!O?k.createElement(k.Fragment,null,U,k.createElement(sK,{page:C})):U});H6.displayName="Link";var G6=k.forwardRef(function({"aria-current":r="page",caseSensitive:n=!1,className:a="",end:i=!1,style:o,to:u,viewTransition:c,children:f,...d},h){let m=wc(u,{relative:d.relative}),g=Hi(),y=k.useContext(gp),{navigator:x,basename:E}=k.useContext(bn),w=y!=null&&wK(m)&&c===!0,_=x.encodeLocation?x.encodeLocation(m).pathname:m.pathname,A=g.pathname,O=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;n||(A=A.toLowerCase(),O=O?O.toLowerCase():null,_=_.toLowerCase()),O&&E&&(O=Ga(O,E)||O);const T=_!=="/"&&_.endsWith("/")?_.length-1:_.length;let C=A===_||!i&&A.startsWith(_)&&A.charAt(T)==="/",N=O!=null&&(O===_||!i&&O.startsWith(_)&&O.charAt(_.length)==="/"),M={isActive:C,isPending:N,isTransitioning:w},R=C?r:void 0,L;typeof a=="function"?L=a(M):L=[a,C?"active":null,N?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let D=typeof o=="function"?o(M):o;return k.createElement(H6,{...d,"aria-current":R,className:L,ref:h,style:D,to:u,viewTransition:c},typeof f=="function"?f(M):f)});G6.displayName="NavLink";var mK=k.forwardRef(({discover:e="render",fetcherKey:r,navigate:n,reloadDocument:a,replace:i,state:o,method:u=Gd,action:c,onSubmit:f,relative:d,preventScrollReset:h,viewTransition:m,unstable_defaultShouldRevalidate:g,...y},x)=>{let{unstable_useTransitions:E}=k.useContext(bn),w=xK(),_=_K(c,{relative:d}),A=u.toLowerCase()==="get"?"get":"post",O=typeof c=="string"&&F6.test(c),T=C=>{if(f&&f(C),C.defaultPrevented)return;C.preventDefault();let N=C.nativeEvent.submitter,M=(N==null?void 0:N.getAttribute("formmethod"))||u,R=()=>w(N||C.currentTarget,{fetcherKey:r,method:M,navigate:n,replace:i,state:o,relative:d,preventScrollReset:h,viewTransition:m,unstable_defaultShouldRevalidate:g});E&&n!==!1?k.startTransition(()=>R()):R()};return k.createElement("form",{ref:x,method:A,action:_,onSubmit:a?f:T,...y,"data-discover":!O&&e==="render"?"true":void 0})});mK.displayName="Form";function vK(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function K6(e){let r=k.useContext(lu);return mt(r,vK(e)),r}function gK(e,{target:r,replace:n,unstable_mask:a,state:i,preventScrollReset:o,relative:u,viewTransition:c,unstable_defaultShouldRevalidate:f,unstable_useTransitions:d}={}){let h=OG(),m=Hi(),g=wc(e,{relative:u});return k.useCallback(y=>{if(XG(y,r)){y.preventDefault();let x=n!==void 0?n:ec(m)===ec(g),E=()=>h(e,{replace:x,unstable_mask:a,state:i,preventScrollReset:o,relative:u,viewTransition:c,unstable_defaultShouldRevalidate:f});d?k.startTransition(()=>E()):E()}},[m,h,g,n,a,i,r,e,o,u,c,f,d])}var yK=0,bK=()=>`__${String(++yK)}__`;function xK(){let{router:e}=K6("useSubmit"),{basename:r}=k.useContext(bn),n=qG(),a=e.fetch,i=e.navigate;return k.useCallback(async(o,u={})=>{let{action:c,method:f,encType:d,formData:h,body:m}=QG(o,r);if(u.navigate===!1){let g=u.fetcherKey||bK();await a(g,n,u.action||c,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:h,body:m,formMethod:u.method||f,formEncType:u.encType||d,flushSync:u.flushSync})}else await i(u.action||c,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:h,body:m,formMethod:u.method||f,formEncType:u.encType||d,replace:u.replace,state:u.state,fromRouteId:n,flushSync:u.flushSync,viewTransition:u.viewTransition})},[a,i,r,n])}function _K(e,{relative:r}={}){let{basename:n}=k.useContext(bn),a=k.useContext(Ja);mt(a,"useFormAction must be used inside a RouteContext");let[i]=a.matches.slice(-1),o={...wc(e||".",{relative:r})},u=Hi();if(e==null){o.search=u.search;let c=new URLSearchParams(o.search),f=c.getAll("index");if(f.some(h=>h==="")){c.delete("index"),f.filter(m=>m).forEach(m=>c.append("index",m));let h=c.toString();o.search=h?`?${h}`:""}}return(!e||e===".")&&i.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(o.pathname=o.pathname==="/"?n:ea([n,o.pathname])),ec(o)}function wK(e,{relative:r}={}){let n=k.useContext(R6);mt(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=K6("useViewTransitionState"),i=wc(e,{relative:r});if(!n.isTransitioning)return!1;let o=Ga(n.currentLocation.pathname,a)||n.currentLocation.pathname,u=Ga(n.nextLocation.pathname,a)||n.nextLocation.pathname;return nh(i.pathname,u)!=null||nh(i.pathname,o)!=null}var MS=j6();function PS(e={}){const[r,n]=k.useState(!1),[a,i]=k.useState(null),[o,u]=k.useState(null),c=k.useRef(e.onEvent),f=k.useRef(1e3),d=k.useRef(null),h=k.useRef(null),m=k.useRef(!0),g=k.useRef(0);c.current=e.onEvent;const y=k.useCallback(()=>{if(!m.current)return;const x=new EventSource("/api/stream");h.current=x,x.onopen=()=>{m.current&&(n(!0),f.current=1e3)};const E=["snapshot","team_status_changed","team_event","team_output","pr_updated","team_launched","team_stopped","usage_updated","project_added","project_updated","project_removed","project_cleanup","dependency_resolved","heartbeat","team_thinking_start","team_thinking_stop"],w=_=>{var T,C;if(!m.current)return;let A="message",O=null;try{const N=JSON.parse(_.data);A=N.type??_.type??"message",typeof N.team_id=="number"&&(O=N.team_id),(T=c.current)==null||T.call(c,A,N)}catch{(C=c.current)==null||C.call(c,"message",_.data)}if(A!=="team_output"&&A!=="heartbeat"&&A!=="team_thinking_start"&&A!=="team_thinking_stop"){const N=Date.now();N-g.current>1e3&&(g.current=N,i(new Date(N)),u(O))}};for(const _ of E)x.addEventListener(_,w);x.onmessage=w,x.onerror=()=>{if(!m.current)return;n(!1),x.close(),h.current=null;const _=f.current;d.current=setTimeout(()=>{m.current&&y()},_),f.current=Math.min(_*2,3e4)}},[]);return k.useEffect(()=>(m.current=!0,y(),()=>{m.current=!1,h.current&&(h.current.close(),h.current=null),d.current&&(clearTimeout(d.current),d.current=null)}),[y]),{connected:r,lastEvent:a,lastEventTeamId:o}}const V6=k.createContext(null),SK=45e3;function EK({children:e}){const[r,n]=k.useState([]),[a,i]=k.useState(null),o=k.useRef(null),u=k.useRef(new Set),[c,f]=k.useState(0),d=k.useCallback(async()=>{try{const _=await fetch("/api/teams");if(_.ok){const A=await _.json();n(A)}}catch{}},[]),h=k.useCallback(()=>{o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{o.current=null,d()},500)},[d]),m=k.useCallback((_,A)=>{if(_==="snapshot"){const O=A;Array.isArray(O.teams)&&n(O.teams)}else if(_==="team_status_changed"||_==="team_launched"||_==="team_stopped"){if(h(),_==="team_stopped"){const O=A;typeof O.team_id=="number"&&u.current.has(O.team_id)&&(u.current.delete(O.team_id),f(T=>T+1))}}else if(_==="usage_updated"||_==="pr_updated")h();else if(_==="team_thinking_start"){const O=A;typeof O.team_id=="number"&&(u.current.add(O.team_id),f(T=>T+1))}else if(_==="team_thinking_stop"){const O=A;typeof O.team_id=="number"&&(u.current.delete(O.team_id),f(T=>T+1))}},[h]),{connected:g,lastEvent:y,lastEventTeamId:x}=PS({onEvent:m});k.useEffect(()=>{d()},[d]),k.useEffect(()=>{const _=setInterval(d,SK);return()=>clearInterval(_)},[d]),k.useEffect(()=>()=>{o.current&&clearTimeout(o.current)},[]);const E=k.useCallback(_=>u.current.has(_),[]),w=k.useMemo(()=>({teams:r,selectedTeamId:a,setSelectedTeamId:i,connected:g,lastEvent:y,lastEventTeamId:x,isThinking:E}),[r,a,g,y,x,E,c]);return b.jsx(V6.Provider,{value:w,children:e})}function Sc(){const e=k.useContext(V6);if(!e)throw new Error("useFleet must be used within a FleetProvider");return e}class Y6 extends Error{constructor(r,n,a){super(a??`API error: ${r} ${n}`),this.status=r,this.statusText=n,this.name="ApiError"}}async function xd(e,r,n){const a=`/api/${r.replace(/^\//,"")}`,i={method:e};n!==void 0?(i.headers={"Content-Type":"application/json"},i.body=JSON.stringify(n)):(e==="POST"||e==="PUT")&&(i.headers={"Content-Type":"application/json"},i.body="{}");const o=await fetch(a,i);if(!o.ok){let u;try{const c=await o.json();u=c.message??c.error??void 0}catch{}throw new Y6(o.status,o.statusText,u)}return o.json()}function Ut(){const e=k.useCallback(i=>xd("GET",i),[]),r=k.useCallback((i,o)=>xd("POST",i,o),[]),n=k.useCallback((i,o)=>xd("PUT",i,o),[]),a=k.useCallback(i=>xd("DELETE",i),[]);return k.useMemo(()=>({get:e,post:r,put:n,del:a}),[e,r,n,a])}function kK(e){const r=[],n=a=>{for(const i of a)r.push({number:i.number,title:i.title,state:i.state,labels:i.labels,activeTeam:i.activeTeam}),i.children.length>0&&n(i.children)};return n(e),r}function jK({message:e,onDone:r}){return k.useEffect(()=>{const n=setTimeout(r,2500);return()=>clearTimeout(n)},[r]),b.jsx("div",{className:"fixed bottom-6 left-1/2 -translate-x-1/2 z-[60] px-4 py-2 rounded bg-[#3FB950]/20 border border-[#3FB950]/40 text-[#3FB950] text-sm font-medium shadow-lg animate-fade-in",children:e})}function AK(e){switch(e){case"queued":return"Creating worktree...";case"launching":return"Starting Claude Code...";case"running":return"Team running";case"idle":return"Team idle";case"done":return"Completed";case"failed":return"Failed";case"stuck":return"Stuck";default:return e}}function OK(e){switch(e){case"assistant":return"text-[#58A6FF]";case"tool_use":return"text-[#D29922]";case"tool_result":return"text-[#A371F7]";case"result":return"text-[#3FB950]";default:return"text-[#8B949E]"}}function CK(e){var r,n,a;switch(e.type){case"assistant":{const i=(r=e.message)==null?void 0:r.content;if(Array.isArray(i)){const o=((n=i.find(u=>u.type==="text"))==null?void 0:n.text)??"";return o.substring(0,100)+(o.length>100?"...":"")}return""}case"tool_use":return((a=e.tool)==null?void 0:a.name)??"unknown";case"tool_result":return"completed";case"result":return"session complete";default:return""}}function TK({teamId:e,issueNumber:r,onClose:n}){const a=Ut(),[i,o]=k.useState("queued"),[u,c]=k.useState([]),[f,d]=k.useState([]),[h,m]=k.useState(null),g=k.useRef(null),y=k.useRef(null);k.useEffect(()=>{let _=!1;async function A(){if(!_)try{const T=await a.get(`teams/${e}`);if(_)return;o(T.status),T.status==="failed"&&m(`Team failed${T.stoppedAt?` at ${new Date(T.stoppedAt).toLocaleTimeString()}`:""}`);const C=await a.get(`teams/${e}/output?lines=50`);if(_)return;c(C.lines);const N=await a.get(`teams/${e}/stream-events`);if(_)return;d(N)}catch{}}A();const O=setInterval(A,2e3);return()=>{_=!0,clearInterval(O)}},[a,e]),k.useEffect(()=>{var _;(_=g.current)==null||_.scrollIntoView({behavior:"smooth"})},[u]),k.useEffect(()=>{var _;(_=g.current)==null||_.scrollIntoView({behavior:"smooth"})},[f]);const x=k.useRef(n);k.useEffect(()=>{x.current=n},[n]),k.useEffect(()=>{i==="running"&&!y.current&&(y.current=setTimeout(()=>x.current(),3e3))},[i]),k.useEffect(()=>()=>{y.current&&(clearTimeout(y.current),y.current=null)},[]);const E=(()=>{switch(i){case"queued":case"launching":return"text-[#D29922]";case"running":return"text-[#3FB950]";case"failed":return"text-[#F85149]";default:return"text-dark-muted"}})(),w=i==="queued"||i==="launching";return b.jsxs("div",{className:"px-5 py-4 space-y-3",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[w&&b.jsxs("svg",{className:"animate-spin h-4 w-4 text-[#D29922]",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[b.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),b.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),i==="running"&&b.jsx("svg",{className:"h-4 w-4 text-[#3FB950]",viewBox:"0 0 20 20",fill:"currentColor",children:b.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),i==="failed"&&b.jsx("svg",{className:"h-4 w-4 text-[#F85149]",viewBox:"0 0 20 20",fill:"currentColor",children:b.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})}),b.jsx("span",{className:`text-sm font-medium ${E}`,children:AK(i)}),b.jsxs("span",{className:"text-xs text-dark-muted ml-auto",children:["Issue #",r," · Team #",e]})]}),b.jsxs("div",{className:"space-y-1",children:[b.jsx(_d,{label:"Team queued",done:!0}),b.jsx(_d,{label:"Creating worktree...",done:i!=="queued",active:i==="queued"}),b.jsx(_d,{label:"Starting Claude Code...",done:i==="running"||i==="done"||i==="idle",active:i==="launching"}),b.jsx(_d,{label:"Team running",done:i==="running"||i==="done"||i==="idle",active:!1})]}),h&&b.jsx("div",{className:"px-3 py-2 rounded border border-[#F85149]/30 bg-[#F85149]/10 text-[#F85149] text-sm",children:h}),f.length>0&&b.jsxs("div",{className:"bg-[#0D1117] border border-dark-border rounded p-2 max-h-[200px] overflow-y-auto font-mono text-xs",children:[f.slice(-30).map((_,A)=>{var O;return b.jsxs("div",{className:"py-0.5 leading-relaxed",children:[b.jsx("span",{className:"text-dark-muted",children:((O=_.timestamp)==null?void 0:O.substring(11,19))??"--:--:--"})," ",b.jsx("span",{className:OK(_.type),children:_.type})," ",b.jsx("span",{className:"text-dark-text",children:CK(_)})]},A)}),b.jsx("div",{ref:g})]}),f.length===0&&u.length>0&&b.jsxs("div",{className:"bg-dark-base border border-dark-border rounded p-2 max-h-[200px] overflow-y-auto font-mono text-xs text-dark-muted",children:[u.map((_,A)=>b.jsx("div",{className:"whitespace-pre-wrap break-all leading-relaxed",children:_},A)),b.jsx("div",{ref:g})]}),i==="running"&&b.jsx("p",{className:"text-xs text-[#3FB950]/70",children:"Auto-closing in 3 seconds..."})]})}function _d({label:e,done:r,active:n}){return b.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[r?b.jsx("svg",{className:"h-3 w-3 text-[#3FB950]",viewBox:"0 0 20 20",fill:"currentColor",children:b.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}):n?b.jsxs("svg",{className:"animate-spin h-3 w-3 text-[#D29922]",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[b.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),b.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):b.jsx("div",{className:"h-3 w-3 rounded-full border border-dark-border"}),b.jsx("span",{className:r?"text-dark-text":n?"text-[#D29922]":"text-dark-muted",children:e})]})}function NK({open:e,onClose:r}){const n=Ut(),[a,i]=k.useState(!1),[o,u]=k.useState(!0),[c,f]=k.useState(""),[d,h]=k.useState(""),[m,g]=k.useState(""),[y,x]=k.useState("15000"),[E,w]=k.useState(!1),[_,A]=k.useState(null),[O,T]=k.useState(null),[C,N]=k.useState([]),[M,R]=k.useState(""),[L,D]=k.useState([]),[z,q]=k.useState(!1),[G,U]=k.useState(null),[Y,$]=k.useState(""),[J,re]=k.useState("green"),[oe,fe]=k.useState(null),[F,Z]=k.useState(null),ce=k.useRef(null),B=k.useRef(null);k.useEffect(()=>{if(e&&!oe){const K=setTimeout(()=>{var be;return(be=ce.current)==null?void 0:be.focus()},50);return()=>clearTimeout(K)}},[e,a,oe]),k.useEffect(()=>{e&&(n.get("projects").then(K=>{N(K),K.length===1&&R(String(K[0].id))}).catch(()=>{N([])}),n.get("usage").then(K=>{const be=Math.max(K.dailyPercent,K.weeklyPercent,K.sonnetPercent,K.extraPercent);be>80?re("red"):be>=50?re("yellow"):re("green")}).catch(()=>{re("green")}))},[e,n]),k.useEffect(()=>{if(!M){D([]),U(null);return}let K=!1;return q(!0),U(null),n.get(`projects/${M}/issues`).then(be=>{if(K)return;const ve=kK(be.tree);D(ve)}).catch(be=>{if(K)return;const ve=be instanceof Error?be.message:String(be);U(ve||"Failed to fetch issues"),D([])}).finally(()=>{K||q(!1)}),()=>{K=!0}},[M,n]),k.useEffect(()=>{e&&(f(""),h(""),g(""),x("15000"),A(null),i(!1),u(!0),R(""),fe(null),Z(null),re("green"),D([]),U(null),$(""))},[e]),k.useEffect(()=>{if(!e)return;function K(be){be.key==="Escape"&&r()}return document.addEventListener("keydown",K),()=>document.removeEventListener("keydown",K)},[e,r]);const H=k.useCallback(K=>{B.current&&!B.current.contains(K.target)&&r()},[r]),te=k.useMemo(()=>{if(!Y.trim())return L;const K=Y.toLowerCase().trim(),be=K.startsWith("#")?parseInt(K.slice(1),10):/^\d+$/.test(K)?parseInt(K,10):NaN;return L.filter(ve=>!isNaN(be)&&ve.number===be||ve.title.toLowerCase().includes(K)||String(ve.number).includes(K))},[L,Y]),he=k.useCallback(K=>{f(String(K.number)),$("")},[]),ge=k.useCallback(async K=>{if(A(null),C.length>0&&!M){A("Please select a project");return}const be=parseInt(c.trim(),10);if(isNaN(be)||be<1){A("Issue number must be a positive integer");return}const ve=m.trim()||void 0,_e=M?parseInt(M,10):void 0;w(!0);try{const $e=await n.post("teams/launch",{issueNumber:be,prompt:ve,projectId:_e,headless:o,...K?{force:!0}:{}});fe($e.id),Z(be)}catch($e){const Te=$e instanceof Error?$e.message:String($e);A(Te||"Failed to launch team")}finally{w(!1)}},[c,m,n,C,M,o]),W=k.useCallback(async()=>{A(null);const K=d.trim();if(!K){A("Enter at least one issue number");return}const be=K.split(/[,\s]+/).map(at=>at.trim()).filter(Boolean).map(at=>parseInt(at,10));if(be.some(at=>isNaN(at)||at<1)){A("All issue numbers must be positive integers");return}if(be.length===0){A("Enter at least one issue number");return}const ve=parseInt(y.trim(),10);if(isNaN(ve)||ve<0){A("Stagger delay must be a non-negative number (ms)");return}if(C.length>0&&!M){A("Please select a project");return}const _e=be.map(at=>({number:at})),$e=m.trim()||void 0,Te=M?parseInt(M,10):void 0;w(!0);try{await n.post("teams/launch-batch",{issues:_e,prompt:$e,delayMs:ve,projectId:Te,headless:o}),T(`Launched ${be.length} team${be.length>1?"s":""}`),r()}catch(at){const Yr=at instanceof Error?at.message:String(at);A(Yr||"Failed to launch batch")}finally{w(!1)}},[d,y,m,n,r,C,M,o]),le=k.useCallback(K=>{K.key==="Enter"&&!E&&(a?W():ge())},[a,E,ge,W]);if(!e&&!O)return null;const ye=oe!==null&&F!==null;return b.jsxs(b.Fragment,{children:[O&&b.jsx(jK,{message:O,onDone:()=>T(null)}),e&&b.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:H,children:b.jsxs("div",{ref:B,className:"w-[480px] max-w-[95vw] max-h-[90vh] flex flex-col bg-dark-surface border border-dark-border rounded-lg shadow-2xl",role:"dialog","aria-modal":"true","aria-label":ye?"Launch Progress":"Launch Team",children:[b.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-dark-border",children:[b.jsx("h2",{className:"text-base font-semibold text-dark-text",children:ye?"Launch Progress":"Launch Team"}),b.jsx("button",{onClick:r,className:"text-dark-muted hover:text-dark-text transition-colors p-1 rounded hover:bg-dark-border/30",title:"Close (Esc)",children:b.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:b.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]}),ye?b.jsx(TK,{teamId:oe,issueNumber:F,onClose:r}):b.jsxs("div",{className:"px-5 py-4 space-y-4 overflow-y-auto",children:[C.length>0?b.jsxs("div",{children:[b.jsxs("label",{className:"block text-sm text-dark-muted mb-1",children:["Project ",b.jsx("span",{className:"text-[#F85149]",children:"*"})]}),b.jsxs("select",{value:M,onChange:K=>R(K.target.value),className:"w-full px-3 py-2 text-sm rounded border border-dark-border bg-dark-base text-dark-text focus:outline-none focus:border-dark-accent focus:ring-1 focus:ring-dark-accent/30",disabled:E,children:[b.jsx("option",{value:"",children:"Select a project..."}),C.map(K=>b.jsx("option",{value:K.id,children:K.name},K.id))]})]}):b.jsx("div",{className:"px-3 py-2 rounded border border-[#D29922]/30 bg-[#D29922]/10 text-[#D29922] text-sm",children:"Add a project first"}),b.jsxs("div",{className:"flex flex-col gap-2",children:[b.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[b.jsx("input",{type:"checkbox",checked:a,onChange:K=>i(K.target.checked),className:"w-4 h-4 rounded border-dark-border bg-dark-base text-dark-accent focus:ring-dark-accent/50 focus:ring-offset-0 accent-[#58A6FF]"}),b.jsx("span",{className:"text-sm text-dark-muted",children:"Batch mode"})]}),b.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",title:o?"Runs Claude Code in the background with no visible window":"Opens Claude Code in a visible terminal window",children:[b.jsx("input",{type:"checkbox",checked:o,onChange:K=>u(K.target.checked),className:"w-4 h-4 rounded border-dark-border bg-dark-base text-dark-accent focus:ring-dark-accent/50 focus:ring-offset-0 accent-[#58A6FF]"}),b.jsx("span",{className:"text-sm text-dark-muted",children:"Run headless (background)"}),!o&&b.jsx("span",{className:"text-xs text-dark-muted/60",children:"— opens in a visible terminal window"})]})]}),a?b.jsxs(b.Fragment,{children:[b.jsxs("div",{children:[b.jsxs("label",{className:"block text-sm text-dark-muted mb-1",children:["Issue numbers ",b.jsx("span",{className:"text-[#F85149]",children:"*"})]}),b.jsx("input",{ref:ce,type:"text",value:d,onChange:K=>h(K.target.value),onKeyDown:le,placeholder:"e.g. 763, 812, 756",className:"w-full px-3 py-2 text-sm rounded border border-dark-border bg-dark-base text-dark-text placeholder:text-dark-muted/50 focus:outline-none focus:border-dark-accent focus:ring-1 focus:ring-dark-accent/30",disabled:E}),b.jsx("p",{className:"text-xs text-dark-muted mt-1",children:"Comma or space separated"})]}),b.jsxs("div",{children:[b.jsx("label",{className:"block text-sm text-dark-muted mb-1",children:"Stagger delay (ms)"}),b.jsx("input",{type:"text",inputMode:"numeric",pattern:"[0-9]*",value:y,onChange:K=>x(K.target.value),placeholder:"15000",className:"w-full px-3 py-2 text-sm rounded border border-dark-border bg-dark-base text-dark-text placeholder:text-dark-muted/50 focus:outline-none focus:border-dark-accent focus:ring-1 focus:ring-dark-accent/30",disabled:E})]})]}):b.jsxs("div",{className:"space-y-2",children:[M&&b.jsxs("div",{children:[b.jsx("label",{className:"block text-sm text-dark-muted mb-1",children:"Select issue"}),z&&b.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 text-xs text-dark-muted",children:[b.jsxs("svg",{className:"animate-spin h-3 w-3",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[b.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),b.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Loading issues..."]}),G&&b.jsx("div",{className:"px-3 py-2 rounded border border-[#F85149]/30 bg-[#F85149]/10 text-[#F85149] text-xs",children:G}),!z&&!G&&L.length>0&&b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"relative mb-1",children:[b.jsx("input",{type:"text",value:Y,onChange:K=>$(K.target.value),placeholder:"Filter issues... (#number or title)",className:"w-full px-3 py-1.5 text-xs rounded border border-dark-border bg-[#0D1117] text-dark-text placeholder:text-dark-muted/50 focus:outline-none focus:border-dark-accent focus:ring-1 focus:ring-dark-accent/30",disabled:E}),Y&&b.jsx("button",{onClick:()=>$(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-dark-muted hover:text-dark-text transition-colors","aria-label":"Clear search",children:b.jsx("svg",{className:"w-3 h-3",viewBox:"0 0 16 16",fill:"currentColor",children:b.jsx("path",{d:"M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"})})})]}),b.jsx("div",{className:"max-h-[200px] overflow-y-auto border border-dark-border rounded bg-[#0D1117]",children:te.length===0?b.jsxs("div",{className:"px-3 py-2 text-xs text-dark-muted",children:["No issues match “",Y,"”"]}):te.map(K=>{const be=c===String(K.number),ve=!!K.activeTeam;return b.jsxs("button",{onClick:()=>he(K),disabled:E,className:`w-full text-left px-3 py-1.5 text-xs flex items-center gap-2 transition-colors border-b border-dark-border/30 last:border-b-0 ${be?"bg-dark-accent/15 text-dark-accent":"hover:bg-dark-surface text-dark-text"}`,children:[K.state==="open"?b.jsxs("svg",{className:"w-3.5 h-3.5 text-[#3FB950] shrink-0",viewBox:"0 0 16 16",fill:"currentColor",children:[b.jsx("path",{d:"M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"}),b.jsx("path",{d:"M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Z"})]}):b.jsxs("svg",{className:"w-3.5 h-3.5 text-[#A371F7] shrink-0",viewBox:"0 0 16 16",fill:"currentColor",children:[b.jsx("path",{d:"M11.28 6.78a.75.75 0 0 0-1.06-1.06L7.25 8.69 5.78 7.22a.75.75 0 0 0-1.06 1.06l2 2a.75.75 0 0 0 1.06 0l3.5-3.5Z"}),b.jsx("path",{d:"M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0Zm-1.5 0a6.5 6.5 0 1 0-13 0 6.5 6.5 0 0 0 13 0Z"})]}),b.jsxs("span",{className:"text-dark-muted shrink-0",children:["#",K.number]}),b.jsx("span",{className:"truncate",children:K.title}),ve&&b.jsx("span",{className:"ml-auto shrink-0 px-1.5 py-0.5 rounded text-[10px] font-medium bg-[#D29922]/15 text-[#D29922] border border-[#D29922]/30",children:K.activeTeam.status}),be&&b.jsx("svg",{className:"w-3.5 h-3.5 text-dark-accent ml-auto shrink-0",viewBox:"0 0 20 20",fill:"currentColor",children:b.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})]},K.number)})}),b.jsxs("p",{className:"text-xs text-dark-muted mt-1",children:[L.length," issue",L.length!==1?"s":""," found",Y&&te.length!==L.length&&` (${te.length} matching)`]})]}),!z&&!G&&L.length===0&&b.jsx("div",{className:"px-3 py-2 text-xs text-dark-muted",children:"No issues found for this project"})]}),b.jsxs("div",{children:[b.jsxs("label",{className:"block text-sm text-dark-muted mb-1",children:["Issue number ",b.jsx("span",{className:"text-[#F85149]",children:"*"}),M&&L.length>0&&b.jsx("span",{className:"text-dark-muted/50 text-xs ml-1",children:"(or type manually)"})]}),b.jsx("input",{ref:ce,type:"text",inputMode:"numeric",pattern:"[0-9]*",value:c,onChange:K=>f(K.target.value),onKeyDown:le,placeholder:"e.g. 763",className:"w-full px-3 py-2 text-sm rounded border border-dark-border bg-dark-base text-dark-text placeholder:text-dark-muted/50 focus:outline-none focus:border-dark-accent focus:ring-1 focus:ring-dark-accent/30",disabled:E})]})]}),b.jsxs("div",{children:[b.jsxs("label",{className:"block text-sm text-dark-muted mb-1",children:["Prompt ",b.jsx("span",{className:"text-dark-muted/50",children:"(optional)"})]}),b.jsx("input",{type:"text",value:m,onChange:K=>g(K.target.value),onKeyDown:le,placeholder:"Custom prompt (default: project prompt file)",className:"w-full px-3 py-2 text-sm rounded border border-dark-border bg-dark-base text-dark-text placeholder:text-dark-muted/50 focus:outline-none focus:border-dark-accent focus:ring-1 focus:ring-dark-accent/30",disabled:E}),b.jsxs("p",{className:"text-xs text-dark-muted mt-1",children:["Leave empty to use the project's prompt file (with ",b.jsx("code",{className:"text-dark-accent/70",children:"{{ISSUE_NUMBER}}"})," replaced automatically)."]})]}),J==="red"&&b.jsx("div",{className:"px-3 py-2 rounded border border-[#F85149]/30 bg-[#F85149]/10 text-[#F85149] text-sm",children:'Usage is in the red zone (>80%). New launches will be queued instead of started immediately. Use "Force Launch" to override.'}),_&&b.jsx("div",{className:"px-3 py-2 rounded border border-[#F85149]/30 bg-[#F85149]/10 text-[#F85149] text-sm",children:_})]}),b.jsxs("div",{className:"flex items-center justify-end gap-3 px-5 py-4 border-t border-dark-border",children:[b.jsx("button",{onClick:r,className:"px-3 py-1.5 text-sm rounded border border-dark-border text-dark-muted hover:text-dark-text hover:border-dark-muted transition-colors",children:ye?"Close":"Cancel"}),!ye&&b.jsxs(b.Fragment,{children:[b.jsx("button",{onClick:()=>a?W():void ge(),disabled:E||C.length===0,className:"px-4 py-1.5 text-sm font-medium rounded border border-dark-accent/40 text-dark-accent bg-dark-accent/10 hover:bg-dark-accent/20 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:E?"Launching...":J==="red"?a?"Queue All":"Queue":a?"Launch All":"Launch"}),J==="red"&&!a&&b.jsx("button",{onClick:()=>void ge(!0),disabled:E||C.length===0,className:"px-4 py-1.5 text-sm font-medium rounded border border-[#F85149]/40 text-[#F85149] bg-[#F85149]/10 hover:bg-[#F85149]/20 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:"Force launch ignoring red zone usage limits",children:"Force Launch"})]})]})]})})]})}function MK({size:e=20,className:r}){return b.jsxs("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("rect",{width:"7",height:"7",x:"3",y:"3",rx:"1"}),b.jsx("rect",{width:"7",height:"7",x:"14",y:"3",rx:"1"}),b.jsx("rect",{width:"7",height:"7",x:"14",y:"14",rx:"1"}),b.jsx("rect",{width:"7",height:"7",x:"3",y:"14",rx:"1"})]})}function PK({size:e=20,className:r}){return b.jsxs("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("line",{x1:"6",x2:"6",y1:"3",y2:"15"}),b.jsx("circle",{cx:"18",cy:"6",r:"3"}),b.jsx("circle",{cx:"6",cy:"18",r:"3"}),b.jsx("path",{d:"M18 9a9 9 0 0 1-9 9"})]})}function RK({size:e=20,className:r}){return b.jsxs("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("path",{d:"M3 3v18h18"}),b.jsx("path",{d:"M18 17V9"}),b.jsx("path",{d:"M13 17V5"}),b.jsx("path",{d:"M8 17v-3"})]})}function DK({size:e=20,className:r}){return b.jsxs("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5"}),b.jsx("circle",{cx:"13",cy:"12",r:"2"}),b.jsx("path",{d:"M18 19c-2.8 0-5-2.2-5-5v8"}),b.jsx("circle",{cx:"20",cy:"19",r:"2"})]})}function LK({size:e=14,className:r}){return b.jsxs("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z"}),b.jsx("path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z"}),b.jsx("path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0"}),b.jsx("path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5"})]})}function IK({size:e=14,className:r}){return b.jsx("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:b.jsx("polygon",{points:"6 3 20 12 6 21 6 3"})})}function RS({size:e=14,className:r}){return b.jsxs("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),b.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function zK({size:e=14,className:r}){return b.jsxs("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}),b.jsx("path",{d:"M21 3v5h-5"}),b.jsx("path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}),b.jsx("path",{d:"M8 16H3v5"})]})}function qK({size:e=20,className:r}){return b.jsx("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:b.jsx("path",{d:"M22 12h-4l-3 9L9 3l-3 9H2"})})}function BK({size:e=14,className:r}){return b.jsx("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:b.jsx("path",{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z"})})}function $K({size:e=14,className:r}){return b.jsxs("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),b.jsx("circle",{cx:"12",cy:"7",r:"4"})]})}function UK({size:e=14,className:r}){return b.jsxs("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("circle",{cx:"12",cy:"12",r:"10"}),b.jsx("polyline",{points:"12 6 12 12 16 14"})]})}function dT({size:e=14,className:r}){return b.jsx("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:b.jsx("path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"})})}function FK({size:e=14,className:r}){return b.jsxs("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("circle",{cx:"12",cy:"12",r:"1"}),b.jsx("circle",{cx:"19",cy:"12",r:"1"}),b.jsx("circle",{cx:"5",cy:"12",r:"1"})]})}function HK({size:e=14,className:r}){return b.jsxs("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),b.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})}function GK({size:e=14,className:r}){return b.jsx("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:b.jsx("path",{d:"m9 18 6-6-6-6"})})}const Wn={queued:"#8B949E",launching:"#D29922",running:"#3FB950",idle:"#D29922",stuck:"#F85149",done:"#A371F7",failed:"#F85149"};function X6(e,r){const n=Math.max(0,r-10);return e>=r?"#F85149":e>=n?"#D29922":"#3FB950"}const hT={"team-lead":"#58A6FF",coordinator:"#58A6FF",tl:"#58A6FF",analyst:"#D29922",dev:"#3FB950",developer:"#3FB950",reviewer:"#A371F7"},pT=["#58A6FF","#3FB950","#D29922","#A371F7","#F778BA","#79C0FF","#7EE787","#E3B341","#D2A8FF","#FF7B72"];function Ec(e,r){if(r){const i=hT[r.toLowerCase()];if(i)return i}const n=hT[e.toLowerCase()];if(n)return n;let a=0;for(let i=0;i<e.length;i++)a=(a<<5)-a+e.charCodeAt(i)|0;return pT[Math.abs(a)%pT.length]}function u2(e){if(!e)return null;const r=new Date(e).getTime()-Date.now();if(r<=0)return null;const n=Math.floor(r/36e5),a=Math.floor(r%36e5/6e4);return n>0?`Resets in ${n}h ${a}m`:`Resets in ${a}m`}const KK={daily:85,weekly:95,sonnet:95,extra:95};function VK(){const{teams:e}=Sc(),r=Ut(),[n,a]=k.useState(!1),[i,o]=k.useState(null),u=k.useCallback(async()=>{try{const g=await r.get("usage");o(g)}catch{}},[r]);k.useEffect(()=>{u();const g=setInterval(u,3e4);return()=>clearInterval(g)},[u]);const c=e.reduce((g,y)=>(g[y.status]=(g[y.status]||0)+1,g),{}),f=(i==null?void 0:i.redThresholds)??KK,d=i?[{key:"daily",label:"Daily",percent:i.dailyPercent,redThreshold:f.daily,resetLabel:u2(i.dailyResetsAt)},{key:"weekly",label:"Weekly",percent:i.weeklyPercent,redThreshold:f.weekly,resetLabel:u2(i.weeklyResetsAt)},{key:"sonnet",label:"Sonnet",percent:i.sonnetPercent,redThreshold:f.sonnet,resetLabel:null},{key:"extra",label:"Extra",percent:i.extraPercent,redThreshold:f.extra,resetLabel:null}]:[],h=[{label:"running",count:c.running||0,color:Wn.running},{label:"queued",count:c.queued||0,color:Wn.queued},{label:"launching",count:c.launching||0,color:Wn.launching},{label:"idle",count:c.idle||0,color:Wn.idle},{label:"stuck",count:c.stuck||0,color:Wn.stuck}].filter(g=>g.count>0),m=(i==null?void 0:i.zone)==="red";return b.jsxs(b.Fragment,{children:[b.jsxs("header",{className:"h-12 min-h-[48px] bg-dark-surface border-b border-dark-border flex items-center px-4 justify-between shrink-0",children:[b.jsx("div",{className:"flex items-center gap-3",children:b.jsx("h1",{className:"text-sm font-semibold text-dark-text tracking-wide",children:"Fleet Commander"})}),b.jsxs("div",{className:"flex items-center gap-3",children:[h.map((g,y)=>b.jsxs("span",{className:"text-xs font-medium",children:[b.jsx("span",{style:{color:g.color},children:g.count}),b.jsx("span",{className:"text-dark-muted ml-1",children:g.label}),y<h.length-1&&b.jsx("span",{className:"text-dark-muted ml-3",children:"·"})]},g.label)),d.length>0&&h.length>0&&b.jsx("span",{className:"text-dark-muted mx-1",children:"|"}),d.map(g=>b.jsxs("span",{className:"text-xs font-medium",title:g.resetLabel??void 0,children:[b.jsx("span",{className:"text-dark-muted",children:g.label})," ",b.jsxs("span",{style:{color:X6(g.percent,g.redThreshold)},children:[g.percent.toFixed(0),"%"]})]},g.key)),m&&b.jsx("span",{className:"text-xs font-bold animate-pulse",style:{color:"#F85149"},children:"PAUSED"}),b.jsxs("button",{type:"button",onClick:g=>{g.stopPropagation(),g.preventDefault(),a(!0)},className:"ml-2 px-3 py-1 text-xs font-medium rounded border border-dark-accent/40 text-dark-accent hover:bg-dark-accent/10 transition-colors inline-flex items-center gap-1.5",title:"Launch a new team",children:[b.jsx(LK,{size:14}),"Launch Team"]})]})]}),MS.createPortal(b.jsx(NK,{open:n,onClose:()=>a(!1)}),document.body)]})}const YK=[{to:"/",label:"Fleet Grid",icon:b.jsx(MK,{})},{to:"/issues",label:"Issue Tree",icon:b.jsx(PK,{})},{to:"/usage",label:"Usage View",icon:b.jsx(RK,{})},{to:"/projects",label:"Projects",icon:b.jsx(DK,{})},{to:"/lifecycle",label:"Lifecycle",icon:b.jsx(qK,{size:20})},{to:"/settings",label:"Settings",icon:b.jsx(RS,{size:20})}];function XK(){return b.jsx("nav",{className:"w-14 min-w-[56px] bg-dark-surface border-r border-dark-border flex flex-col items-center pt-2 gap-1",children:YK.map(e=>b.jsx(G6,{to:e.to,end:e.to==="/",title:e.label,className:({isActive:r})=>`w-10 h-10 flex items-center justify-center rounded-md text-lg transition-colors ${r?"text-dark-accent bg-dark-accent/10":"text-dark-muted hover:text-dark-text hover:bg-dark-border/50"}`,children:e.icon},e.to))})}function WK(){const{connected:e,lastEvent:r}=Sc(),[n,a]=k.useState(null),[i,o]=k.useState(null);return k.useEffect(()=>{fetch("/api/health").then(u=>u.json()).then(u=>{u.version&&o(u.version)}).catch(()=>{})},[]),k.useEffect(()=>{if(!r){a(null);return}const u=()=>{a(Math.floor((Date.now()-r.getTime())/1e3))};u();const c=setInterval(u,1e3);return()=>clearInterval(c)},[r]),b.jsxs("footer",{className:"h-6 min-h-[24px] bg-dark-base border-t border-dark-border flex items-center px-3 text-xs text-dark-muted select-none",children:[b.jsx("span",{className:`inline-block w-2 h-2 rounded-full mr-2 ${e?"bg-green-500":"bg-red-500"}`}),b.jsx("span",{children:e?"Connected":"Disconnected"}),n!==null&&b.jsxs("span",{className:"ml-4",children:["Last update: ",n,"s ago"]}),i&&b.jsxs("span",{className:"ml-auto",children:["v",i]})]})}const ZK={queued:"Queued",running:"Running",stuck:"Stuck",idle:"Idle",done:"Done",failed:"Failed",launching:"Launching"};function DS({status:e}){const r=Wn[e]??"#8B949E",n=ZK[e]??e;let a="";return e==="stuck"?a="animate-pulse-stuck":e==="launching"&&(a="animate-blink"),b.jsxs("span",{className:"inline-flex items-center gap-2",children:[b.jsx("span",{className:`inline-block w-2.5 h-2.5 rounded-full shrink-0 ${a}`,style:{backgroundColor:r}}),b.jsx("span",{className:"text-sm font-medium",style:{color:r},children:n})]})}function QK(e,r){return e==="success"?{icon:"✓",color:"#3FB950"}:e==="failure"?{icon:"✕",color:"#F85149"}:e==="cancelled"?{icon:"―",color:"#8B949E"}:r==="in_progress"||r==="queued"||r==="pending"?{icon:"○",color:"#D29922"}:{icon:"○",color:"#8B949E"}}function W6({checks:e}){return e.length===0?b.jsx("p",{className:"text-dark-muted text-sm",children:"No CI checks available"}):b.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.map((r,n)=>{const{icon:a,color:i}=QK(r.conclusion,r.status),o=r.conclusion==="success"?"rgba(63, 185, 80, 0.15)":r.conclusion==="failure"?"rgba(248, 81, 73, 0.15)":r.conclusion==="cancelled"?"rgba(139, 148, 158, 0.15)":"rgba(210, 153, 34, 0.15)";return b.jsxs("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full max-w-[10rem]",style:{backgroundColor:o},title:r.name,children:[b.jsx("span",{className:"font-bold leading-none shrink-0",style:{color:i},children:a}),b.jsx("span",{className:"truncate",style:{color:i},children:r.name})]},`${r.name}-${n}`)})})}const LS="__pm__",IS="__fc__";function JK(e){return e===LS?"You":e===IS?"FC":e==="team-lead"||e==="tl"?"TL":e.charAt(0).toUpperCase()+e.slice(1)}const eV={[LS]:"#3FB950",[IS]:"#D29922"};function tV({roster:e,activeFilters:r,onFiltersChange:n,hasUserEntries:a,hasFcEntries:i}){const o=k.useMemo(()=>{const d=new Set;d.add("team-lead");for(const m of e)d.add(m.name.toLowerCase());const h=Array.from(d).sort((m,g)=>m==="team-lead"?-1:g==="team-lead"?1:m.localeCompare(g));return a&&h.push(LS),i&&h.push(IS),h},[e,a,i]);if(o.length<=1)return null;const u=r.size===0||r.size===o.length,c=()=>{n(new Set)},f=d=>{const h=new Set(r);if(u){n(new Set([d]));return}if(h.has(d)){if(h.delete(d),h.size===0){n(new Set);return}}else if(h.add(d),h.size===o.length){n(new Set);return}n(h)};return b.jsxs("div",{className:"flex items-center gap-1 mb-2 flex-wrap",children:[b.jsx("button",{onClick:c,className:"px-2 py-0.5 text-[10px] font-medium rounded-full border transition-all duration-150",style:u?{color:"#C9D1D9",borderColor:"#C9D1D960",backgroundColor:"#C9D1D918"}:{color:"#484F58",borderColor:"#484F5840",opacity:.7},children:"All"}),o.map(d=>{const h=eV[d]??Ec(d,d),m=!u&&r.has(d);return b.jsxs("button",{onClick:()=>f(d),className:"px-2 py-0.5 text-[10px] font-medium rounded-full border transition-all duration-150 flex items-center gap-1",style:m?{color:h,borderColor:h+"60",backgroundColor:h+"18"}:{color:"#484F58",borderColor:"#484F5840",opacity:.5},children:[b.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full shrink-0",style:{backgroundColor:m?h:"#484F58"}}),JK(d)]},d)})]})}function So(e){return!e||e==="team-lead"||e==="tl"?"TL":e.charAt(0).toUpperCase()+e.slice(1)}const rV={assistant:{color:"#58A6FF",label:"TL"},user:{color:"#3FB950",label:"You"},fc:{color:"#D29922",label:"FC"},system:{color:"#8B949E",label:"system"},tool_use:{color:"#D29922",label:"tool"},tool_result:{color:"#A371F7",label:"result"},result:{color:"#3FB950",label:"done"},rate_limit_event:{color:"#D29922",label:"rate-limit"}};function ah(e){return rV[e]??{color:"#8B949E",label:e}}const nV={initial_prompt:"prompt",origin_sync:"sync",idle_nudge:"idle",stuck_nudge:"nudge",ci_green:"CI pass",ci_red:"CI fail",ci_blocked:"CI blocked",pr_merged_shutdown:"shutdown",subagent_crash:"crash"};function Z6(e){return e?nV[e]??e:null}const Q6=new Set(["assistant","user","fc"]);function J6(e){var n;if(!Q6.has(e.streamType))return"";const r=(n=e.message)==null?void 0:n.content;return Array.isArray(r)?r.filter(a=>a.type==="text"&&a.text).map(a=>a.text).join(`
|
|
61
61
|
`):""}const aV=new Set(["SessionStart","SessionEnd","Stop","SubagentStart","SubagentStop"]),iV=new Set(["ToolError","StopFailure"]);function oV(e){if(!e)return null;try{const r=JSON.parse(e);if(typeof r=="object"&&r!==null&&"error"in r&&typeof r.error=="string")return r.error}catch{}return null}function Ia(e){try{return new Date(e).toLocaleTimeString([],{hour12:!1,hour:"2-digit",minute:"2-digit"})}catch{return"--:--"}}function mT(e){if(e.streamType==="user")return{label:"You",color:"#3FB950"};if(e.streamType==="fc")return{label:"FC",color:"#D29922"};if(e.agentName&&(e.streamType==="assistant"||e.streamType==="tool_use")){const r=So(e.agentName),n=Ec(e.agentName,e.agentName);return{label:r,color:n}}return ah(e.streamType)}function lV(e){if(e.agentName){const r=So(e.agentName),n=Ec(e.agentName,e.agentName);return{label:r,color:n}}return{label:"System",color:"#8B949E"}}const uV=120;function Pl(e,r=uV){return e.length<=r?e:e.slice(0,r)+"..."}function eL(e){var a;if(e.streamType!=="tool_use"||!((a=e.tool)!=null&&a.name)||!e.tool.input)return null;const r=e.tool.input;switch(e.tool.name){case"Bash":{const i=r.command;return typeof i=="string"?Pl(i):null}case"Read":{const i=r.file_path;return typeof i=="string"?i:null}case"Write":{const i=r.file_path;return typeof i=="string"?i:null}case"Edit":{const i=r.file_path,o=r.old_string,u=r.new_string,c=[];return typeof i=="string"&&c.push(i),typeof o=="string"&&typeof u=="string"&&c.push(Pl(o,50)+" -> "+Pl(u,50)),c.length>0?c.join(" "):null}case"Grep":{const i=r.pattern,o=r.path,u=[];return typeof i=="string"&&u.push(`/${i}/`),typeof o=="string"&&u.push(o),u.length>0?u.join(" in "):null}case"Glob":{const i=r.pattern;return typeof i=="string"?i:null}case"SendMessage":{const i=r.to,o=r.message,u=[];return typeof i=="string"&&u.push(`to ${i}`),typeof o=="string"&&u.push(Pl(o,80)),u.length>0?u.join(": "):null}case"Agent":{const i=r.name,o=r.message,u=[];return typeof i=="string"&&u.push(i),typeof o=="string"&&u.push(Pl(o,80)),u.length>0?u.join(": "):null}default:{try{const i=JSON.stringify(r);if(i.length>2)return Pl(i)}catch{}return null}}}function sV({entry:e}){var u,c;const[r,n]=k.useState(!1),a=J6(e),i=a.includes(`
|
|
62
62
|
`),o=eL(e);if(e.streamType==="system"&&(e.subtype==="task_progress"||e.subtype==="task_notification")){const f=So(e.agentName),d=e.agentName?Ec(e.agentName,e.agentName):"#8B949E",h=e.lastToolName??((u=e.tool)==null?void 0:u.name),m=e.description;return b.jsxs("div",{className:"py-0 leading-snug flex items-center gap-1.5 text-dark-muted",children:[b.jsx("span",{children:Ia(e.timestamp)}),b.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full shrink-0",style:{backgroundColor:d}}),b.jsx("span",{style:{color:d},className:"font-medium",children:f}),h&&b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"text-dark-muted",children:b.jsx(RS,{size:10})}),b.jsx("span",{className:"text-dark-muted",children:h})]}),m&&b.jsx("span",{className:"text-dark-muted truncate",children:m})]})}if(Q6.has(e.streamType)&&a){const{label:f,color:d}=mT(e);return b.jsxs("div",{className:"py-0.5 leading-relaxed",children:[b.jsx("span",{className:"text-dark-muted",children:Ia(e.timestamp)})," ",b.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full mr-0.5 align-middle",style:{backgroundColor:d}}),b.jsx("span",{style:{color:d},className:"font-semibold",children:f}),e.streamType==="fc"&&e.subtype&&b.jsxs("span",{className:"text-dark-muted text-[10px] ml-1",children:["[",Z6(e.subtype),"]"]})," ",i?b.jsx("span",{className:"text-dark-text whitespace-pre-wrap",children:a}):b.jsx("span",{className:"text-dark-text",children:a})]})}if(e.streamType==="tool_use"&&((c=e.tool)!=null&&c.name)){const{label:f,color:d}=mT(e),h=o!==null;return b.jsxs("div",{children:[b.jsxs("div",{className:"py-0 leading-snug flex items-center gap-1.5",children:[b.jsx("span",{className:"text-dark-muted",children:Ia(e.timestamp)}),b.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full shrink-0",style:{backgroundColor:d}}),b.jsx("span",{style:{color:d},className:"font-semibold",children:f}),b.jsx("span",{className:`text-dark-muted bg-dark-border/30 px-1.5 py-0.5 rounded${h?" cursor-pointer border-b border-dotted border-dark-border hover:bg-dark-border/50":""}`,onClick:h?()=>n(m=>!m):void 0,onKeyDown:h?m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),n(g=>!g))}:void 0,role:h?"button":void 0,tabIndex:h?0:void 0,"aria-expanded":h?r:void 0,children:e.tool.name})]}),r&&o&&b.jsx("div",{className:"text-dark-muted pl-6 pb-0.5 font-mono truncate",title:o,children:o})]})}if(e.streamType==="result"||e.streamType==="tool_result"){const{color:f,label:d}=ah(e.streamType);return b.jsxs("div",{className:"py-0 leading-snug text-dark-muted",children:[b.jsx("span",{className:"text-dark-muted",children:Ia(e.timestamp)})," ",b.jsx("span",{style:{color:f},className:"font-semibold",children:d})]})}if(a){const{color:f,label:d}=ah(e.streamType);return b.jsxs("div",{className:"py-0 leading-snug text-dark-muted",children:[b.jsx("span",{className:"text-dark-muted",children:Ia(e.timestamp)})," ",b.jsx("span",{style:{color:f},className:"font-semibold",children:d})," ",b.jsx("span",{className:"text-dark-text",children:a})]})}return null}function cV({entry:e}){const r=aV.has(e.eventType),n=iV.has(e.eventType),a=n?oV(e.payload):null,{label:i,color:o}=lV(e),[u,c]=k.useState(!1);if(r){const f=e.eventType==="SessionStart"||e.eventType==="SubagentStart"?"#3FB950":"#8B949E";return b.jsxs("div",{className:"py-0 leading-snug flex items-center gap-1.5 text-dark-muted",children:[b.jsx("span",{children:Ia(e.timestamp)}),b.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full shrink-0",style:{backgroundColor:o}}),b.jsx("span",{style:{color:o},className:"font-medium",children:i}),b.jsx("span",{className:"font-normal px-1.5 rounded",style:{color:f,backgroundColor:f+"18"},children:e.eventType})]})}if(n){const f=a!==null;return b.jsxs("div",{className:"py-0 leading-snug text-dark-muted",children:[b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx("span",{children:Ia(e.timestamp)}),b.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full shrink-0",style:{backgroundColor:o}}),b.jsx("span",{style:{color:o},className:"font-medium",children:i}),b.jsx("span",{className:`font-normal bg-red-500/20 text-red-400 px-1.5 py-0.5 rounded${f?" cursor-pointer border-b border-dotted border-red-400/40 hover:bg-red-500/30":""}`,onClick:f?()=>c(d=>!d):void 0,onKeyDown:f?d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),c(h=>!h))}:void 0,role:f?"button":void 0,tabIndex:f?0:void 0,"aria-expanded":f?u:void 0,children:e.eventType}),e.toolName&&b.jsx("span",{className:"text-dark-muted bg-dark-border/30 px-1.5 rounded",children:e.toolName})]}),u&&a&&b.jsx("div",{className:"ml-[52px] text-[#F85149] mt-0.5 line-clamp-2",children:a})]})}return b.jsxs("div",{className:"py-0 leading-snug flex items-center gap-1.5 text-dark-muted",children:[b.jsx("span",{children:Ia(e.timestamp)}),b.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full shrink-0",style:{backgroundColor:o}}),b.jsx("span",{style:{color:o},className:"font-medium",children:i}),b.jsx("span",{className:"text-dark-text font-normal",children:e.eventType}),e.toolName&&b.jsx("span",{className:"text-dark-muted bg-dark-border/30 px-1.5 rounded",children:e.toolName})]})}function fV(e){return e.source==="stream"?e.streamType==="user"?"__pm__":e.streamType==="fc"?"__fc__":e.agentName:e.agentName}function dV({teamId:e,teamStatus:r,isThinking:n,roster:a,agentFilters:i,onAgentFiltersChange:o}){const u=Ut(),[c,f]=k.useState([]),[d,h]=k.useState(!1),[m,g]=k.useState(!1),y=k.useRef(null),x=k.useRef(null),E=k.useRef(!0),w=k.useCallback(()=>{const C=y.current;if(!C)return;const N=C.scrollHeight-C.scrollTop-C.clientHeight<40;E.current=N},[]);k.useEffect(()=>{let C=!1;async function N(){if(!C)try{const R=await u.get(`teams/${e}/timeline?limit=500`);C||f(R)}catch{}}if(N(),r==="done"||r==="failed")return()=>{C=!0};const M=setInterval(N,2e3);return()=>{C=!0,clearInterval(M)}},[u,e,r]);const _=k.useMemo(()=>!i||i.size===0?c:c.filter(C=>{const N=fV(C);return N?i.has(N):!0}),[c,i]);k.useEffect(()=>{var C;E.current&&((C=x.current)==null||C.scrollIntoView({behavior:"smooth"}))},[_.length]);const A=k.useCallback(()=>{var N;const C=[];for(const M of _){const R=Ia(M.timestamp);if(M.source==="stream"){const L=J6(M);if(L){const D=M.agentName?So(M.agentName):ah(M.streamType).label,z=M.streamType==="fc"&&M.subtype?` [${Z6(M.subtype)}]`:"";C.push(`[${R}] ${D}${z}: ${L}`)}else if(M.streamType==="tool_use"&&((N=M.tool)!=null&&N.name)){const D=M.agentName?So(M.agentName):"tool",z=eL(M),q=z?` — ${z}`:"";C.push(`[${R}] ${D}: ${M.tool.name}${q}`)}else if(M.streamType==="system"&&M.description){const D=M.agentName?So(M.agentName):"system";C.push(`[${R}] ${D}: ${M.lastToolName??""} ${M.description}`)}}else{const L=M,D=L.agentName?So(L.agentName):"System";let z=L.eventType;L.toolName&&(z+=` (${L.toolName})`),C.push(`[${R}] ${D}: ${z}`)}}navigator.clipboard.writeText(C.join(`
|
|
63
63
|
`)).then(()=>{h(!0),setTimeout(()=>h(!1),2e3)}).catch(()=>{g(!0),setTimeout(()=>g(!1),2e3)})},[_]),O=k.useMemo(()=>c.some(C=>C.source==="stream"&&C.streamType==="user"),[c]),T=k.useMemo(()=>c.some(C=>C.source==="stream"&&C.streamType==="fc"),[c]);if(c.length===0){const C=r==="done"||r==="failed";return b.jsx("div",{className:"text-[11px] text-dark-muted italic py-2",children:C?"No session log captured.":"No events yet. Events appear when Claude Code is running."})}return b.jsxs("div",{className:"relative flex-1 min-h-0 flex flex-col",children:[a&&o&&b.jsx(tV,{roster:a,activeFilters:i??new Set,onFiltersChange:o,hasUserEntries:O,hasFcEntries:T}),b.jsx("button",{onClick:A,className:"absolute top-1.5 right-1.5 z-10 px-2 py-0.5 text-[10px] rounded border border-dark-border text-dark-muted hover:text-dark-text hover:border-dark-muted bg-[#0D1117] transition-colors",title:"Copy full log to clipboard",children:d?"Copied!":m?"Failed":"Copy"}),b.jsxs("div",{ref:y,onScroll:w,className:`flex-1 min-h-0 font-mono text-[11px] overflow-y-auto bg-[#0D1117] p-2 rounded border border-dark-border custom-scrollbar${n?" thinking-glow":""}`,children:[_.map(C=>C.source==="stream"?b.jsx(sV,{entry:C},C.id):b.jsx(cV,{entry:C},C.id)),n&&b.jsxs("div",{className:"py-1 flex items-center gap-1.5",children:[b.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-[#E8976C] animate-thinking-dot"}),b.jsx("span",{className:"text-[#E8976C] text-[10px] italic",children:"thinking..."})]}),b.jsx("div",{ref:x})]})]})}function hV({teamId:e,disabled:r=!1}){const n=Ut(),[a,i]=k.useState(""),[o,u]=k.useState(!1),[c,f]=k.useState(null),d=k.useRef(null),h=k.useRef(null);k.useEffect(()=>()=>{h.current&&clearTimeout(h.current)},[]);const m=y=>{f(y),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{f(null),h.current=null},3e3)},g=async y=>{var E;y.preventDefault();const x=a.trim();if(!(!x||o)){u(!0),f(null);try{await n.post(`teams/${e}/send-message`,{message:x}),i(""),m({type:"success",message:"Message sent"}),(E=d.current)==null||E.focus()}catch(w){if(w instanceof Y6&&w.status===422)m({type:"warning",message:"Team is not running — message not delivered"});else{const _=w instanceof Error?w.message:"Failed to send message";m({type:"error",message:_})}}finally{u(!1)}}};return b.jsxs("div",{children:[b.jsxs("form",{onSubmit:g,className:"flex items-center gap-2",children:[b.jsx("input",{ref:d,type:"text",value:a,onChange:y=>i(y.target.value),disabled:r||o,placeholder:r?"Team is not running":"Send message to team...",className:"flex-1 bg-dark-base border border-dark-border rounded px-3 py-2 text-sm text-dark-text placeholder-dark-muted focus:outline-none focus:border-dark-accent transition-colors disabled:opacity-50"}),b.jsx("button",{type:"submit",disabled:r||o||!a.trim(),className:"px-4 py-2 text-sm font-medium rounded bg-dark-accent text-white hover:bg-dark-accent/80 transition-colors disabled:opacity-40 disabled:cursor-not-allowed shrink-0",children:o?"Sending...":"Send"})]}),c&&b.jsx("div",{className:`mt-2 text-xs px-2 py-1 rounded ${c.type==="success"?"text-[#3FB950] bg-[#3FB950]/10":c.type==="warning"?"text-[#D29922] bg-[#D29922]/10":"text-[#F85149] bg-[#F85149]/10"}`,children:c.message})]})}function pV(e,r){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var a,i,o,u,c=[],f=!0,d=!1;try{if(o=(n=n.call(e)).next,r===0){if(Object(n)!==n)return;f=!1}else for(;!(f=(a=o.call(n)).done)&&(c.push(a.value),c.length!==r);f=!0);}catch(h){d=!0,i=h}finally{try{if(!f&&n.return!=null&&(u=n.return(),Object(u)!==u))return}finally{if(d)throw i}}return c}}function mV(e,r,n){return r=SV(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function vT(e,r){return yV(e)||pV(e,r)||tL(e,r)||_V()}function vV(e){return gV(e)||bV(e)||tL(e)||xV()}function gV(e){if(Array.isArray(e))return s2(e)}function yV(e){if(Array.isArray(e))return e}function bV(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function tL(e,r){if(e){if(typeof e=="string")return s2(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s2(e,r)}}function s2(e,r){(r==null||r>e.length)&&(r=e.length);for(var n=0,a=new Array(r);n<r;n++)a[n]=e[n];return a}function xV(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
@@ -185,4 +185,4 @@ This will:
|
|
|
185
185
|
- Delete ALL data (projects, teams, events)
|
|
186
186
|
|
|
187
187
|
This cannot be undone. Continue?`)||!window.confirm("Are you absolutely sure? All data will be permanently deleted."))){f(!0);try{await e.post("system/factory-reset"),window.location.href="/"}catch(y){alert("Factory reset failed: "+(y instanceof Error?y.message:String(y)))}finally{f(!1)}}};return a?b.jsx("div",{className:"flex items-center justify-center h-full",children:b.jsx("p",{className:"text-dark-muted text-sm",children:"Loading settings..."})}):o?b.jsx("div",{className:"flex items-center justify-center h-full",children:b.jsxs("div",{className:"text-center",children:[b.jsx("p",{className:"text-[#F85149] text-sm mb-2",children:"Failed to load settings"}),b.jsx("p",{className:"text-dark-muted text-xs",children:o})]})}):r?b.jsxs("div",{className:"p-6 max-w-4xl mx-auto",children:[b.jsxs("div",{className:"mb-6",children:[b.jsx("h1",{className:"text-xl font-semibold text-dark-text",children:"Settings"}),b.jsx("p",{className:"text-dark-muted text-sm mt-1",children:"Current runtime configuration. Set via environment variables — changes require a server restart."})]}),b.jsx("div",{className:"space-y-6",children:G0e.map(m=>b.jsxs("div",{children:[b.jsx("h2",{className:"text-sm font-semibold text-dark-muted uppercase tracking-wider mb-2",children:m.title}),b.jsx("div",{className:"bg-dark-surface border border-dark-border rounded-lg overflow-hidden",children:b.jsxs("table",{className:"w-full text-sm",children:[b.jsx("thead",{children:b.jsxs("tr",{className:"border-b border-dark-border",children:[b.jsx("th",{className:"text-left px-4 py-2 text-xs font-medium text-dark-muted uppercase tracking-wider w-[180px]",children:"Setting"}),b.jsx("th",{className:"text-left px-4 py-2 text-xs font-medium text-dark-muted uppercase tracking-wider w-[200px]",children:"Value"}),b.jsx("th",{className:"text-left px-4 py-2 text-xs font-medium text-dark-muted uppercase tracking-wider w-[200px]",children:"Env Variable"}),b.jsx("th",{className:"text-left px-4 py-2 text-xs font-medium text-dark-muted uppercase tracking-wider",children:"Description"})]})}),b.jsx("tbody",{children:m.rows.map((g,y)=>{const x=r[g.key],E=g.format?g.format(x):String(x);return b.jsxs("tr",{className:`border-b border-dark-border/50 last:border-b-0 ${y%2===1?"bg-dark-base/30":""}`,children:[b.jsx("td",{className:"px-4 py-2.5 text-dark-text font-medium",children:g.label}),b.jsx("td",{className:"px-4 py-2.5",children:b.jsx("code",{className:"text-dark-accent font-mono text-xs bg-dark-base/50 px-1.5 py-0.5 rounded",children:E})}),b.jsx("td",{className:"px-4 py-2.5",children:b.jsx("code",{className:"text-dark-muted font-mono text-xs",children:g.envVar})}),b.jsx("td",{className:"px-4 py-2.5 text-dark-muted",children:g.description})]},g.key)})})]})})]},m.title))}),b.jsxs("div",{className:"mt-6 bg-dark-surface border border-dark-border rounded-lg px-4 py-3",children:[b.jsx("h2",{className:"text-sm font-semibold text-dark-muted uppercase tracking-wider mb-1",children:"Launch Prompt"}),b.jsxs("p",{className:"text-dark-muted text-sm",children:["Configured per-project via prompt files:"," ",b.jsx("code",{className:"text-dark-accent font-mono text-xs bg-dark-base/50 px-1.5 py-0.5 rounded",children:"prompts/{slug}-prompt.md"})]})]}),b.jsxs("div",{className:"mt-8 border border-[#F85149]/30 rounded p-4",children:[b.jsx("h3",{className:"text-[#F85149] font-semibold mb-2",children:"Danger Zone"}),b.jsx("p",{className:"text-[#8B949E] text-sm mb-3",children:"Factory reset will stop all running teams, uninstall hooks from all projects, and delete all data. The database will be recreated fresh with default settings."}),b.jsx("button",{onClick:h,disabled:c,className:"px-4 py-2 text-sm bg-[#F85149]/10 text-[#F85149] border border-[#F85149]/40 rounded hover:bg-[#F85149]/20 disabled:opacity-50",children:c?"Resetting...":"Factory Reset"})]})]}):null}function Dk(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var F0,iP;function V0e(){if(iP)return F0;iP=1;function e(){this.__data__=[],this.size=0}return F0=e,F0}var H0,oP;function yu(){if(oP)return H0;oP=1;function e(r,n){return r===n||r!==r&&n!==n}return H0=e,H0}var G0,lP;function dm(){if(lP)return G0;lP=1;var e=yu();function r(n,a){for(var i=n.length;i--;)if(e(n[i][0],a))return i;return-1}return G0=r,G0}var K0,uP;function Y0e(){if(uP)return K0;uP=1;var e=dm(),r=Array.prototype,n=r.splice;function a(i){var o=this.__data__,u=e(o,i);if(u<0)return!1;var c=o.length-1;return u==c?o.pop():n.call(o,u,1),--this.size,!0}return K0=a,K0}var V0,sP;function X0e(){if(sP)return V0;sP=1;var e=dm();function r(n){var a=this.__data__,i=e(a,n);return i<0?void 0:a[i][1]}return V0=r,V0}var Y0,cP;function W0e(){if(cP)return Y0;cP=1;var e=dm();function r(n){return e(this.__data__,n)>-1}return Y0=r,Y0}var X0,fP;function Z0e(){if(fP)return X0;fP=1;var e=dm();function r(n,a){var i=this.__data__,o=e(i,n);return o<0?(++this.size,i.push([n,a])):i[o][1]=a,this}return X0=r,X0}var W0,dP;function hm(){if(dP)return W0;dP=1;var e=V0e(),r=Y0e(),n=X0e(),a=W0e(),i=Z0e();function o(u){var c=-1,f=u==null?0:u.length;for(this.clear();++c<f;){var d=u[c];this.set(d[0],d[1])}}return o.prototype.clear=e,o.prototype.delete=r,o.prototype.get=n,o.prototype.has=a,o.prototype.set=i,W0=o,W0}var Z0,hP;function Q0e(){if(hP)return Z0;hP=1;var e=hm();function r(){this.__data__=new e,this.size=0}return Z0=r,Z0}var Q0,pP;function J0e(){if(pP)return Q0;pP=1;function e(r){var n=this.__data__,a=n.delete(r);return this.size=n.size,a}return Q0=e,Q0}var J0,mP;function ebe(){if(mP)return J0;mP=1;function e(r){return this.__data__.get(r)}return J0=e,J0}var eb,vP;function tbe(){if(vP)return eb;vP=1;function e(r){return this.__data__.has(r)}return eb=e,eb}var tb,gP;function g$(){if(gP)return tb;gP=1;var e=typeof yd=="object"&&yd&&yd.Object===Object&&yd;return tb=e,tb}var rb,yP;function zn(){if(yP)return rb;yP=1;var e=g$(),r=typeof self=="object"&&self&&self.Object===Object&&self,n=e||r||Function("return this")();return rb=n,rb}var nb,bP;function bu(){if(bP)return nb;bP=1;var e=zn(),r=e.Symbol;return nb=r,nb}var ab,xP;function rbe(){if(xP)return ab;xP=1;var e=bu(),r=Object.prototype,n=r.hasOwnProperty,a=r.toString,i=e?e.toStringTag:void 0;function o(u){var c=n.call(u,i),f=u[i];try{u[i]=void 0;var d=!0}catch{}var h=a.call(u);return d&&(c?u[i]=f:delete u[i]),h}return ab=o,ab}var ib,_P;function nbe(){if(_P)return ib;_P=1;var e=Object.prototype,r=e.toString;function n(a){return r.call(a)}return ib=n,ib}var ob,wP;function Ho(){if(wP)return ob;wP=1;var e=bu(),r=rbe(),n=nbe(),a="[object Null]",i="[object Undefined]",o=e?e.toStringTag:void 0;function u(c){return c==null?c===void 0?i:a:o&&o in Object(c)?r(c):n(c)}return ob=u,ob}var lb,SP;function _n(){if(SP)return lb;SP=1;function e(r){var n=typeof r;return r!=null&&(n=="object"||n=="function")}return lb=e,lb}var ub,EP;function Vc(){if(EP)return ub;EP=1;var e=Ho(),r=_n(),n="[object AsyncFunction]",a="[object Function]",i="[object GeneratorFunction]",o="[object Proxy]";function u(c){if(!r(c))return!1;var f=e(c);return f==a||f==i||f==n||f==o}return ub=u,ub}var sb,kP;function abe(){if(kP)return sb;kP=1;var e=zn(),r=e["__core-js_shared__"];return sb=r,sb}var cb,jP;function ibe(){if(jP)return cb;jP=1;var e=abe(),r=(function(){var a=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return a?"Symbol(src)_1."+a:""})();function n(a){return!!r&&r in a}return cb=n,cb}var fb,AP;function y$(){if(AP)return fb;AP=1;var e=Function.prototype,r=e.toString;function n(a){if(a!=null){try{return r.call(a)}catch{}try{return a+""}catch{}}return""}return fb=n,fb}var db,OP;function obe(){if(OP)return db;OP=1;var e=Vc(),r=ibe(),n=_n(),a=y$(),i=/[\\^$.*+?()[\]{}|]/g,o=/^\[object .+?Constructor\]$/,u=Function.prototype,c=Object.prototype,f=u.toString,d=c.hasOwnProperty,h=RegExp("^"+f.call(d).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function m(g){if(!n(g)||r(g))return!1;var y=e(g)?h:o;return y.test(a(g))}return db=m,db}var hb,CP;function lbe(){if(CP)return hb;CP=1;function e(r,n){return r==null?void 0:r[n]}return hb=e,hb}var pb,TP;function Go(){if(TP)return pb;TP=1;var e=obe(),r=lbe();function n(a,i){var o=r(a,i);return e(o)?o:void 0}return pb=n,pb}var mb,NP;function Lk(){if(NP)return mb;NP=1;var e=Go(),r=zn(),n=e(r,"Map");return mb=n,mb}var vb,MP;function pm(){if(MP)return vb;MP=1;var e=Go(),r=e(Object,"create");return vb=r,vb}var gb,PP;function ube(){if(PP)return gb;PP=1;var e=pm();function r(){this.__data__=e?e(null):{},this.size=0}return gb=r,gb}var yb,RP;function sbe(){if(RP)return yb;RP=1;function e(r){var n=this.has(r)&&delete this.__data__[r];return this.size-=n?1:0,n}return yb=e,yb}var bb,DP;function cbe(){if(DP)return bb;DP=1;var e=pm(),r="__lodash_hash_undefined__",n=Object.prototype,a=n.hasOwnProperty;function i(o){var u=this.__data__;if(e){var c=u[o];return c===r?void 0:c}return a.call(u,o)?u[o]:void 0}return bb=i,bb}var xb,LP;function fbe(){if(LP)return xb;LP=1;var e=pm(),r=Object.prototype,n=r.hasOwnProperty;function a(i){var o=this.__data__;return e?o[i]!==void 0:n.call(o,i)}return xb=a,xb}var _b,IP;function dbe(){if(IP)return _b;IP=1;var e=pm(),r="__lodash_hash_undefined__";function n(a,i){var o=this.__data__;return this.size+=this.has(a)?0:1,o[a]=e&&i===void 0?r:i,this}return _b=n,_b}var wb,zP;function hbe(){if(zP)return wb;zP=1;var e=ube(),r=sbe(),n=cbe(),a=fbe(),i=dbe();function o(u){var c=-1,f=u==null?0:u.length;for(this.clear();++c<f;){var d=u[c];this.set(d[0],d[1])}}return o.prototype.clear=e,o.prototype.delete=r,o.prototype.get=n,o.prototype.has=a,o.prototype.set=i,wb=o,wb}var Sb,qP;function pbe(){if(qP)return Sb;qP=1;var e=hbe(),r=hm(),n=Lk();function a(){this.size=0,this.__data__={hash:new e,map:new(n||r),string:new e}}return Sb=a,Sb}var Eb,BP;function mbe(){if(BP)return Eb;BP=1;function e(r){var n=typeof r;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?r!=="__proto__":r===null}return Eb=e,Eb}var kb,$P;function mm(){if($P)return kb;$P=1;var e=mbe();function r(n,a){var i=n.__data__;return e(a)?i[typeof a=="string"?"string":"hash"]:i.map}return kb=r,kb}var jb,UP;function vbe(){if(UP)return jb;UP=1;var e=mm();function r(n){var a=e(this,n).delete(n);return this.size-=a?1:0,a}return jb=r,jb}var Ab,FP;function gbe(){if(FP)return Ab;FP=1;var e=mm();function r(n){return e(this,n).get(n)}return Ab=r,Ab}var Ob,HP;function ybe(){if(HP)return Ob;HP=1;var e=mm();function r(n){return e(this,n).has(n)}return Ob=r,Ob}var Cb,GP;function bbe(){if(GP)return Cb;GP=1;var e=mm();function r(n,a){var i=e(this,n),o=i.size;return i.set(n,a),this.size+=i.size==o?0:1,this}return Cb=r,Cb}var Tb,KP;function Ik(){if(KP)return Tb;KP=1;var e=pbe(),r=vbe(),n=gbe(),a=ybe(),i=bbe();function o(u){var c=-1,f=u==null?0:u.length;for(this.clear();++c<f;){var d=u[c];this.set(d[0],d[1])}}return o.prototype.clear=e,o.prototype.delete=r,o.prototype.get=n,o.prototype.has=a,o.prototype.set=i,Tb=o,Tb}var Nb,VP;function xbe(){if(VP)return Nb;VP=1;var e=hm(),r=Lk(),n=Ik(),a=200;function i(o,u){var c=this.__data__;if(c instanceof e){var f=c.__data__;if(!r||f.length<a-1)return f.push([o,u]),this.size=++c.size,this;c=this.__data__=new n(f)}return c.set(o,u),this.size=c.size,this}return Nb=i,Nb}var Mb,YP;function vm(){if(YP)return Mb;YP=1;var e=hm(),r=Q0e(),n=J0e(),a=ebe(),i=tbe(),o=xbe();function u(c){var f=this.__data__=new e(c);this.size=f.size}return u.prototype.clear=r,u.prototype.delete=n,u.prototype.get=a,u.prototype.has=i,u.prototype.set=o,Mb=u,Mb}var Pb,XP;function zk(){if(XP)return Pb;XP=1;function e(r,n){for(var a=-1,i=r==null?0:r.length;++a<i&&n(r[a],a,r)!==!1;);return r}return Pb=e,Pb}var Rb,WP;function b$(){if(WP)return Rb;WP=1;var e=Go(),r=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return Rb=r,Rb}var Db,ZP;function gm(){if(ZP)return Db;ZP=1;var e=b$();function r(n,a,i){a=="__proto__"&&e?e(n,a,{configurable:!0,enumerable:!0,value:i,writable:!0}):n[a]=i}return Db=r,Db}var Lb,QP;function ym(){if(QP)return Lb;QP=1;var e=gm(),r=yu(),n=Object.prototype,a=n.hasOwnProperty;function i(o,u,c){var f=o[u];(!(a.call(o,u)&&r(f,c))||c===void 0&&!(u in o))&&e(o,u,c)}return Lb=i,Lb}var Ib,JP;function Yc(){if(JP)return Ib;JP=1;var e=ym(),r=gm();function n(a,i,o,u){var c=!o;o||(o={});for(var f=-1,d=i.length;++f<d;){var h=i[f],m=u?u(o[h],a[h],h,o,a):void 0;m===void 0&&(m=a[h]),c?r(o,h,m):e(o,h,m)}return o}return Ib=n,Ib}var zb,eR;function _be(){if(eR)return zb;eR=1;function e(r,n){for(var a=-1,i=Array(r);++a<r;)i[a]=n(a);return i}return zb=e,zb}var qb,tR;function ha(){if(tR)return qb;tR=1;function e(r){return r!=null&&typeof r=="object"}return qb=e,qb}var Bb,rR;function wbe(){if(rR)return Bb;rR=1;var e=Ho(),r=ha(),n="[object Arguments]";function a(i){return r(i)&&e(i)==n}return Bb=a,Bb}var $b,nR;function Xc(){if(nR)return $b;nR=1;var e=wbe(),r=ha(),n=Object.prototype,a=n.hasOwnProperty,i=n.propertyIsEnumerable,o=e((function(){return arguments})())?e:function(u){return r(u)&&a.call(u,"callee")&&!i.call(u,"callee")};return $b=o,$b}var Ub,aR;function Tt(){if(aR)return Ub;aR=1;var e=Array.isArray;return Ub=e,Ub}var Vs={exports:{}},Fb,iR;function Sbe(){if(iR)return Fb;iR=1;function e(){return!1}return Fb=e,Fb}Vs.exports;var oR;function xu(){return oR||(oR=1,(function(e,r){var n=zn(),a=Sbe(),i=r&&!r.nodeType&&r,o=i&&!0&&e&&!e.nodeType&&e,u=o&&o.exports===i,c=u?n.Buffer:void 0,f=c?c.isBuffer:void 0,d=f||a;e.exports=d})(Vs,Vs.exports)),Vs.exports}var Hb,lR;function bm(){if(lR)return Hb;lR=1;var e=9007199254740991,r=/^(?:0|[1-9]\d*)$/;function n(a,i){var o=typeof a;return i=i??e,!!i&&(o=="number"||o!="symbol"&&r.test(a))&&a>-1&&a%1==0&&a<i}return Hb=n,Hb}var Gb,uR;function qk(){if(uR)return Gb;uR=1;var e=9007199254740991;function r(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return Gb=r,Gb}var Kb,sR;function Ebe(){if(sR)return Kb;sR=1;var e=Ho(),r=qk(),n=ha(),a="[object Arguments]",i="[object Array]",o="[object Boolean]",u="[object Date]",c="[object Error]",f="[object Function]",d="[object Map]",h="[object Number]",m="[object Object]",g="[object RegExp]",y="[object Set]",x="[object String]",E="[object WeakMap]",w="[object ArrayBuffer]",_="[object DataView]",A="[object Float32Array]",O="[object Float64Array]",T="[object Int8Array]",C="[object Int16Array]",N="[object Int32Array]",M="[object Uint8Array]",R="[object Uint8ClampedArray]",L="[object Uint16Array]",D="[object Uint32Array]",z={};z[A]=z[O]=z[T]=z[C]=z[N]=z[M]=z[R]=z[L]=z[D]=!0,z[a]=z[i]=z[w]=z[o]=z[_]=z[u]=z[c]=z[f]=z[d]=z[h]=z[m]=z[g]=z[y]=z[x]=z[E]=!1;function q(G){return n(G)&&r(G.length)&&!!z[e(G)]}return Kb=q,Kb}var Vb,cR;function xm(){if(cR)return Vb;cR=1;function e(r){return function(n){return r(n)}}return Vb=e,Vb}var Ys={exports:{}};Ys.exports;var fR;function Bk(){return fR||(fR=1,(function(e,r){var n=g$(),a=r&&!r.nodeType&&r,i=a&&!0&&e&&!e.nodeType&&e,o=i&&i.exports===a,u=o&&n.process,c=(function(){try{var f=i&&i.require&&i.require("util").types;return f||u&&u.binding&&u.binding("util")}catch{}})();e.exports=c})(Ys,Ys.exports)),Ys.exports}var Yb,dR;function Wc(){if(dR)return Yb;dR=1;var e=Ebe(),r=xm(),n=Bk(),a=n&&n.isTypedArray,i=a?r(a):e;return Yb=i,Yb}var Xb,hR;function x$(){if(hR)return Xb;hR=1;var e=_be(),r=Xc(),n=Tt(),a=xu(),i=bm(),o=Wc(),u=Object.prototype,c=u.hasOwnProperty;function f(d,h){var m=n(d),g=!m&&r(d),y=!m&&!g&&a(d),x=!m&&!g&&!y&&o(d),E=m||g||y||x,w=E?e(d.length,String):[],_=w.length;for(var A in d)(h||c.call(d,A))&&!(E&&(A=="length"||y&&(A=="offset"||A=="parent")||x&&(A=="buffer"||A=="byteLength"||A=="byteOffset")||i(A,_)))&&w.push(A);return w}return Xb=f,Xb}var Wb,pR;function _m(){if(pR)return Wb;pR=1;var e=Object.prototype;function r(n){var a=n&&n.constructor,i=typeof a=="function"&&a.prototype||e;return n===i}return Wb=r,Wb}var Zb,mR;function _$(){if(mR)return Zb;mR=1;function e(r,n){return function(a){return r(n(a))}}return Zb=e,Zb}var Qb,vR;function kbe(){if(vR)return Qb;vR=1;var e=_$(),r=e(Object.keys,Object);return Qb=r,Qb}var Jb,gR;function $k(){if(gR)return Jb;gR=1;var e=_m(),r=kbe(),n=Object.prototype,a=n.hasOwnProperty;function i(o){if(!e(o))return r(o);var u=[];for(var c in Object(o))a.call(o,c)&&c!="constructor"&&u.push(c);return u}return Jb=i,Jb}var e1,yR;function ii(){if(yR)return e1;yR=1;var e=Vc(),r=qk();function n(a){return a!=null&&r(a.length)&&!e(a)}return e1=n,e1}var t1,bR;function Yi(){if(bR)return t1;bR=1;var e=x$(),r=$k(),n=ii();function a(i){return n(i)?e(i):r(i)}return t1=a,t1}var r1,xR;function jbe(){if(xR)return r1;xR=1;var e=Yc(),r=Yi();function n(a,i){return a&&e(i,r(i),a)}return r1=n,r1}var n1,_R;function Abe(){if(_R)return n1;_R=1;function e(r){var n=[];if(r!=null)for(var a in Object(r))n.push(a);return n}return n1=e,n1}var a1,wR;function Obe(){if(wR)return a1;wR=1;var e=_n(),r=_m(),n=Abe(),a=Object.prototype,i=a.hasOwnProperty;function o(u){if(!e(u))return n(u);var c=r(u),f=[];for(var d in u)d=="constructor"&&(c||!i.call(u,d))||f.push(d);return f}return a1=o,a1}var i1,SR;function Ko(){if(SR)return i1;SR=1;var e=x$(),r=Obe(),n=ii();function a(i){return n(i)?e(i,!0):r(i)}return i1=a,i1}var o1,ER;function Cbe(){if(ER)return o1;ER=1;var e=Yc(),r=Ko();function n(a,i){return a&&e(i,r(i),a)}return o1=n,o1}var Xs={exports:{}};Xs.exports;var kR;function w$(){return kR||(kR=1,(function(e,r){var n=zn(),a=r&&!r.nodeType&&r,i=a&&!0&&e&&!e.nodeType&&e,o=i&&i.exports===a,u=o?n.Buffer:void 0,c=u?u.allocUnsafe:void 0;function f(d,h){if(h)return d.slice();var m=d.length,g=c?c(m):new d.constructor(m);return d.copy(g),g}e.exports=f})(Xs,Xs.exports)),Xs.exports}var l1,jR;function S$(){if(jR)return l1;jR=1;function e(r,n){var a=-1,i=r.length;for(n||(n=Array(i));++a<i;)n[a]=r[a];return n}return l1=e,l1}var u1,AR;function E$(){if(AR)return u1;AR=1;function e(r,n){for(var a=-1,i=r==null?0:r.length,o=0,u=[];++a<i;){var c=r[a];n(c,a,r)&&(u[o++]=c)}return u}return u1=e,u1}var s1,OR;function k$(){if(OR)return s1;OR=1;function e(){return[]}return s1=e,s1}var c1,CR;function Uk(){if(CR)return c1;CR=1;var e=E$(),r=k$(),n=Object.prototype,a=n.propertyIsEnumerable,i=Object.getOwnPropertySymbols,o=i?function(u){return u==null?[]:(u=Object(u),e(i(u),function(c){return a.call(u,c)}))}:r;return c1=o,c1}var f1,TR;function Tbe(){if(TR)return f1;TR=1;var e=Yc(),r=Uk();function n(a,i){return e(a,r(a),i)}return f1=n,f1}var d1,NR;function Fk(){if(NR)return d1;NR=1;function e(r,n){for(var a=-1,i=n.length,o=r.length;++a<i;)r[o+a]=n[a];return r}return d1=e,d1}var h1,MR;function wm(){if(MR)return h1;MR=1;var e=_$(),r=e(Object.getPrototypeOf,Object);return h1=r,h1}var p1,PR;function j$(){if(PR)return p1;PR=1;var e=Fk(),r=wm(),n=Uk(),a=k$(),i=Object.getOwnPropertySymbols,o=i?function(u){for(var c=[];u;)e(c,n(u)),u=r(u);return c}:a;return p1=o,p1}var m1,RR;function Nbe(){if(RR)return m1;RR=1;var e=Yc(),r=j$();function n(a,i){return e(a,r(a),i)}return m1=n,m1}var v1,DR;function A$(){if(DR)return v1;DR=1;var e=Fk(),r=Tt();function n(a,i,o){var u=i(a);return r(a)?u:e(u,o(a))}return v1=n,v1}var g1,LR;function O$(){if(LR)return g1;LR=1;var e=A$(),r=Uk(),n=Yi();function a(i){return e(i,n,r)}return g1=a,g1}var y1,IR;function Mbe(){if(IR)return y1;IR=1;var e=A$(),r=j$(),n=Ko();function a(i){return e(i,n,r)}return y1=a,y1}var b1,zR;function Pbe(){if(zR)return b1;zR=1;var e=Go(),r=zn(),n=e(r,"DataView");return b1=n,b1}var x1,qR;function Rbe(){if(qR)return x1;qR=1;var e=Go(),r=zn(),n=e(r,"Promise");return x1=n,x1}var _1,BR;function C$(){if(BR)return _1;BR=1;var e=Go(),r=zn(),n=e(r,"Set");return _1=n,_1}var w1,$R;function Dbe(){if($R)return w1;$R=1;var e=Go(),r=zn(),n=e(r,"WeakMap");return w1=n,w1}var S1,UR;function _u(){if(UR)return S1;UR=1;var e=Pbe(),r=Lk(),n=Rbe(),a=C$(),i=Dbe(),o=Ho(),u=y$(),c="[object Map]",f="[object Object]",d="[object Promise]",h="[object Set]",m="[object WeakMap]",g="[object DataView]",y=u(e),x=u(r),E=u(n),w=u(a),_=u(i),A=o;return(e&&A(new e(new ArrayBuffer(1)))!=g||r&&A(new r)!=c||n&&A(n.resolve())!=d||a&&A(new a)!=h||i&&A(new i)!=m)&&(A=function(O){var T=o(O),C=T==f?O.constructor:void 0,N=C?u(C):"";if(N)switch(N){case y:return g;case x:return c;case E:return d;case w:return h;case _:return m}return T}),S1=A,S1}var E1,FR;function Lbe(){if(FR)return E1;FR=1;var e=Object.prototype,r=e.hasOwnProperty;function n(a){var i=a.length,o=new a.constructor(i);return i&&typeof a[0]=="string"&&r.call(a,"index")&&(o.index=a.index,o.input=a.input),o}return E1=n,E1}var k1,HR;function T$(){if(HR)return k1;HR=1;var e=zn(),r=e.Uint8Array;return k1=r,k1}var j1,GR;function Hk(){if(GR)return j1;GR=1;var e=T$();function r(n){var a=new n.constructor(n.byteLength);return new e(a).set(new e(n)),a}return j1=r,j1}var A1,KR;function Ibe(){if(KR)return A1;KR=1;var e=Hk();function r(n,a){var i=a?e(n.buffer):n.buffer;return new n.constructor(i,n.byteOffset,n.byteLength)}return A1=r,A1}var O1,VR;function zbe(){if(VR)return O1;VR=1;var e=/\w*$/;function r(n){var a=new n.constructor(n.source,e.exec(n));return a.lastIndex=n.lastIndex,a}return O1=r,O1}var C1,YR;function qbe(){if(YR)return C1;YR=1;var e=bu(),r=e?e.prototype:void 0,n=r?r.valueOf:void 0;function a(i){return n?Object(n.call(i)):{}}return C1=a,C1}var T1,XR;function N$(){if(XR)return T1;XR=1;var e=Hk();function r(n,a){var i=a?e(n.buffer):n.buffer;return new n.constructor(i,n.byteOffset,n.length)}return T1=r,T1}var N1,WR;function Bbe(){if(WR)return N1;WR=1;var e=Hk(),r=Ibe(),n=zbe(),a=qbe(),i=N$(),o="[object Boolean]",u="[object Date]",c="[object Map]",f="[object Number]",d="[object RegExp]",h="[object Set]",m="[object String]",g="[object Symbol]",y="[object ArrayBuffer]",x="[object DataView]",E="[object Float32Array]",w="[object Float64Array]",_="[object Int8Array]",A="[object Int16Array]",O="[object Int32Array]",T="[object Uint8Array]",C="[object Uint8ClampedArray]",N="[object Uint16Array]",M="[object Uint32Array]";function R(L,D,z){var q=L.constructor;switch(D){case y:return e(L);case o:case u:return new q(+L);case x:return r(L,z);case E:case w:case _:case A:case O:case T:case C:case N:case M:return i(L,z);case c:return new q;case f:case m:return new q(L);case d:return n(L);case h:return new q;case g:return a(L)}}return N1=R,N1}var M1,ZR;function M$(){if(ZR)return M1;ZR=1;var e=_n(),r=Object.create,n=(function(){function a(){}return function(i){if(!e(i))return{};if(r)return r(i);a.prototype=i;var o=new a;return a.prototype=void 0,o}})();return M1=n,M1}var P1,QR;function P$(){if(QR)return P1;QR=1;var e=M$(),r=wm(),n=_m();function a(i){return typeof i.constructor=="function"&&!n(i)?e(r(i)):{}}return P1=a,P1}var R1,JR;function $be(){if(JR)return R1;JR=1;var e=_u(),r=ha(),n="[object Map]";function a(i){return r(i)&&e(i)==n}return R1=a,R1}var D1,eD;function Ube(){if(eD)return D1;eD=1;var e=$be(),r=xm(),n=Bk(),a=n&&n.isMap,i=a?r(a):e;return D1=i,D1}var L1,tD;function Fbe(){if(tD)return L1;tD=1;var e=_u(),r=ha(),n="[object Set]";function a(i){return r(i)&&e(i)==n}return L1=a,L1}var I1,rD;function Hbe(){if(rD)return I1;rD=1;var e=Fbe(),r=xm(),n=Bk(),a=n&&n.isSet,i=a?r(a):e;return I1=i,I1}var z1,nD;function R$(){if(nD)return z1;nD=1;var e=vm(),r=zk(),n=ym(),a=jbe(),i=Cbe(),o=w$(),u=S$(),c=Tbe(),f=Nbe(),d=O$(),h=Mbe(),m=_u(),g=Lbe(),y=Bbe(),x=P$(),E=Tt(),w=xu(),_=Ube(),A=_n(),O=Hbe(),T=Yi(),C=Ko(),N=1,M=2,R=4,L="[object Arguments]",D="[object Array]",z="[object Boolean]",q="[object Date]",G="[object Error]",U="[object Function]",Y="[object GeneratorFunction]",$="[object Map]",J="[object Number]",re="[object Object]",oe="[object RegExp]",fe="[object Set]",F="[object String]",Z="[object Symbol]",ce="[object WeakMap]",B="[object ArrayBuffer]",H="[object DataView]",te="[object Float32Array]",he="[object Float64Array]",ge="[object Int8Array]",W="[object Int16Array]",le="[object Int32Array]",ye="[object Uint8Array]",K="[object Uint8ClampedArray]",be="[object Uint16Array]",ve="[object Uint32Array]",_e={};_e[L]=_e[D]=_e[B]=_e[H]=_e[z]=_e[q]=_e[te]=_e[he]=_e[ge]=_e[W]=_e[le]=_e[$]=_e[J]=_e[re]=_e[oe]=_e[fe]=_e[F]=_e[Z]=_e[ye]=_e[K]=_e[be]=_e[ve]=!0,_e[G]=_e[U]=_e[ce]=!1;function $e(Te,at,Yr,Su,li,qn){var nr,It=at&N,Yo=at&M,Qc=at&R;if(Yr&&(nr=li?Yr(Te,Su,li,qn):Yr(Te)),nr!==void 0)return nr;if(!A(Te))return Te;var Eu=E(Te);if(Eu){if(nr=g(Te),!It)return u(Te,nr)}else{var Sn=m(Te),Jc=Sn==U||Sn==Y;if(w(Te))return o(Te,It);if(Sn==re||Sn==L||Jc&&!li){if(nr=Yo||Jc?{}:x(Te),!It)return Yo?f(Te,i(nr,Te)):c(Te,a(nr,Te))}else{if(!_e[Sn])return li?Te:{};nr=y(Te,Sn,It)}}qn||(qn=new e);var ku=qn.get(Te);if(ku)return ku;qn.set(Te,nr),O(Te)?Te.forEach(function(xr){nr.add($e(xr,at,Yr,xr,Te,qn))}):_(Te)&&Te.forEach(function(xr,_t){nr.set(_t,$e(xr,at,Yr,_t,Te,qn))});var Cm=Qc?Yo?h:d:Yo?C:T,ef=Eu?void 0:Cm(Te);return r(ef||Te,function(xr,_t){ef&&(_t=xr,xr=Te[_t]),n(nr,_t,$e(xr,at,Yr,_t,Te,qn))}),nr}return z1=$e,z1}var q1,aD;function Gbe(){if(aD)return q1;aD=1;var e=R$(),r=4;function n(a){return e(a,r)}return q1=n,q1}var B1,iD;function Gk(){if(iD)return B1;iD=1;function e(r){return function(){return r}}return B1=e,B1}var $1,oD;function Kbe(){if(oD)return $1;oD=1;function e(r){return function(n,a,i){for(var o=-1,u=Object(n),c=i(n),f=c.length;f--;){var d=c[r?f:++o];if(a(u[d],d,u)===!1)break}return n}}return $1=e,$1}var U1,lD;function Kk(){if(lD)return U1;lD=1;var e=Kbe(),r=e();return U1=r,U1}var F1,uD;function Vk(){if(uD)return F1;uD=1;var e=Kk(),r=Yi();function n(a,i){return a&&e(a,i,r)}return F1=n,F1}var H1,sD;function Vbe(){if(sD)return H1;sD=1;var e=ii();function r(n,a){return function(i,o){if(i==null)return i;if(!e(i))return n(i,o);for(var u=i.length,c=a?u:-1,f=Object(i);(a?c--:++c<u)&&o(f[c],c,f)!==!1;);return i}}return H1=r,H1}var G1,cD;function Sm(){if(cD)return G1;cD=1;var e=Vk(),r=Vbe(),n=r(e);return G1=n,G1}var K1,fD;function Vo(){if(fD)return K1;fD=1;function e(r){return r}return K1=e,K1}var V1,dD;function D$(){if(dD)return V1;dD=1;var e=Vo();function r(n){return typeof n=="function"?n:e}return V1=r,V1}var Y1,hD;function L$(){if(hD)return Y1;hD=1;var e=zk(),r=Sm(),n=D$(),a=Tt();function i(o,u){var c=a(o)?e:r;return c(o,n(u))}return Y1=i,Y1}var X1,pD;function I$(){return pD||(pD=1,X1=L$()),X1}var W1,mD;function Ybe(){if(mD)return W1;mD=1;var e=Sm();function r(n,a){var i=[];return e(n,function(o,u,c){a(o,u,c)&&i.push(o)}),i}return W1=r,W1}var Z1,vD;function Xbe(){if(vD)return Z1;vD=1;var e="__lodash_hash_undefined__";function r(n){return this.__data__.set(n,e),this}return Z1=r,Z1}var Q1,gD;function Wbe(){if(gD)return Q1;gD=1;function e(r){return this.__data__.has(r)}return Q1=e,Q1}var J1,yD;function z$(){if(yD)return J1;yD=1;var e=Ik(),r=Xbe(),n=Wbe();function a(i){var o=-1,u=i==null?0:i.length;for(this.__data__=new e;++o<u;)this.add(i[o])}return a.prototype.add=a.prototype.push=r,a.prototype.has=n,J1=a,J1}var ex,bD;function Zbe(){if(bD)return ex;bD=1;function e(r,n){for(var a=-1,i=r==null?0:r.length;++a<i;)if(n(r[a],a,r))return!0;return!1}return ex=e,ex}var tx,xD;function q$(){if(xD)return tx;xD=1;function e(r,n){return r.has(n)}return tx=e,tx}var rx,_D;function B$(){if(_D)return rx;_D=1;var e=z$(),r=Zbe(),n=q$(),a=1,i=2;function o(u,c,f,d,h,m){var g=f&a,y=u.length,x=c.length;if(y!=x&&!(g&&x>y))return!1;var E=m.get(u),w=m.get(c);if(E&&w)return E==c&&w==u;var _=-1,A=!0,O=f&i?new e:void 0;for(m.set(u,c),m.set(c,u);++_<y;){var T=u[_],C=c[_];if(d)var N=g?d(C,T,_,c,u,m):d(T,C,_,u,c,m);if(N!==void 0){if(N)continue;A=!1;break}if(O){if(!r(c,function(M,R){if(!n(O,R)&&(T===M||h(T,M,f,d,m)))return O.push(R)})){A=!1;break}}else if(!(T===C||h(T,C,f,d,m))){A=!1;break}}return m.delete(u),m.delete(c),A}return rx=o,rx}var nx,wD;function Qbe(){if(wD)return nx;wD=1;function e(r){var n=-1,a=Array(r.size);return r.forEach(function(i,o){a[++n]=[o,i]}),a}return nx=e,nx}var ax,SD;function Yk(){if(SD)return ax;SD=1;function e(r){var n=-1,a=Array(r.size);return r.forEach(function(i){a[++n]=i}),a}return ax=e,ax}var ix,ED;function Jbe(){if(ED)return ix;ED=1;var e=bu(),r=T$(),n=yu(),a=B$(),i=Qbe(),o=Yk(),u=1,c=2,f="[object Boolean]",d="[object Date]",h="[object Error]",m="[object Map]",g="[object Number]",y="[object RegExp]",x="[object Set]",E="[object String]",w="[object Symbol]",_="[object ArrayBuffer]",A="[object DataView]",O=e?e.prototype:void 0,T=O?O.valueOf:void 0;function C(N,M,R,L,D,z,q){switch(R){case A:if(N.byteLength!=M.byteLength||N.byteOffset!=M.byteOffset)return!1;N=N.buffer,M=M.buffer;case _:return!(N.byteLength!=M.byteLength||!z(new r(N),new r(M)));case f:case d:case g:return n(+N,+M);case h:return N.name==M.name&&N.message==M.message;case y:case E:return N==M+"";case m:var G=i;case x:var U=L&u;if(G||(G=o),N.size!=M.size&&!U)return!1;var Y=q.get(N);if(Y)return Y==M;L|=c,q.set(N,M);var $=a(G(N),G(M),L,D,z,q);return q.delete(N),$;case w:if(T)return T.call(N)==T.call(M)}return!1}return ix=C,ix}var ox,kD;function e1e(){if(kD)return ox;kD=1;var e=O$(),r=1,n=Object.prototype,a=n.hasOwnProperty;function i(o,u,c,f,d,h){var m=c&r,g=e(o),y=g.length,x=e(u),E=x.length;if(y!=E&&!m)return!1;for(var w=y;w--;){var _=g[w];if(!(m?_ in u:a.call(u,_)))return!1}var A=h.get(o),O=h.get(u);if(A&&O)return A==u&&O==o;var T=!0;h.set(o,u),h.set(u,o);for(var C=m;++w<y;){_=g[w];var N=o[_],M=u[_];if(f)var R=m?f(M,N,_,u,o,h):f(N,M,_,o,u,h);if(!(R===void 0?N===M||d(N,M,c,f,h):R)){T=!1;break}C||(C=_=="constructor")}if(T&&!C){var L=o.constructor,D=u.constructor;L!=D&&"constructor"in o&&"constructor"in u&&!(typeof L=="function"&&L instanceof L&&typeof D=="function"&&D instanceof D)&&(T=!1)}return h.delete(o),h.delete(u),T}return ox=i,ox}var lx,jD;function t1e(){if(jD)return lx;jD=1;var e=vm(),r=B$(),n=Jbe(),a=e1e(),i=_u(),o=Tt(),u=xu(),c=Wc(),f=1,d="[object Arguments]",h="[object Array]",m="[object Object]",g=Object.prototype,y=g.hasOwnProperty;function x(E,w,_,A,O,T){var C=o(E),N=o(w),M=C?h:i(E),R=N?h:i(w);M=M==d?m:M,R=R==d?m:R;var L=M==m,D=R==m,z=M==R;if(z&&u(E)){if(!u(w))return!1;C=!0,L=!1}if(z&&!L)return T||(T=new e),C||c(E)?r(E,w,_,A,O,T):n(E,w,M,_,A,O,T);if(!(_&f)){var q=L&&y.call(E,"__wrapped__"),G=D&&y.call(w,"__wrapped__");if(q||G){var U=q?E.value():E,Y=G?w.value():w;return T||(T=new e),O(U,Y,_,A,T)}}return z?(T||(T=new e),a(E,w,_,A,O,T)):!1}return lx=x,lx}var ux,AD;function $$(){if(AD)return ux;AD=1;var e=t1e(),r=ha();function n(a,i,o,u,c){return a===i?!0:a==null||i==null||!r(a)&&!r(i)?a!==a&&i!==i:e(a,i,o,u,n,c)}return ux=n,ux}var sx,OD;function r1e(){if(OD)return sx;OD=1;var e=vm(),r=$$(),n=1,a=2;function i(o,u,c,f){var d=c.length,h=d,m=!f;if(o==null)return!h;for(o=Object(o);d--;){var g=c[d];if(m&&g[2]?g[1]!==o[g[0]]:!(g[0]in o))return!1}for(;++d<h;){g=c[d];var y=g[0],x=o[y],E=g[1];if(m&&g[2]){if(x===void 0&&!(y in o))return!1}else{var w=new e;if(f)var _=f(x,E,y,o,u,w);if(!(_===void 0?r(E,x,n|a,f,w):_))return!1}}return!0}return sx=i,sx}var cx,CD;function U$(){if(CD)return cx;CD=1;var e=_n();function r(n){return n===n&&!e(n)}return cx=r,cx}var fx,TD;function n1e(){if(TD)return fx;TD=1;var e=U$(),r=Yi();function n(a){for(var i=r(a),o=i.length;o--;){var u=i[o],c=a[u];i[o]=[u,c,e(c)]}return i}return fx=n,fx}var dx,ND;function F$(){if(ND)return dx;ND=1;function e(r,n){return function(a){return a==null?!1:a[r]===n&&(n!==void 0||r in Object(a))}}return dx=e,dx}var hx,MD;function a1e(){if(MD)return hx;MD=1;var e=r1e(),r=n1e(),n=F$();function a(i){var o=r(i);return o.length==1&&o[0][2]?n(o[0][0],o[0][1]):function(u){return u===i||e(u,i,o)}}return hx=a,hx}var px,PD;function wu(){if(PD)return px;PD=1;var e=Ho(),r=ha(),n="[object Symbol]";function a(i){return typeof i=="symbol"||r(i)&&e(i)==n}return px=a,px}var mx,RD;function Xk(){if(RD)return mx;RD=1;var e=Tt(),r=wu(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;function i(o,u){if(e(o))return!1;var c=typeof o;return c=="number"||c=="symbol"||c=="boolean"||o==null||r(o)?!0:a.test(o)||!n.test(o)||u!=null&&o in Object(u)}return mx=i,mx}var vx,DD;function i1e(){if(DD)return vx;DD=1;var e=Ik(),r="Expected a function";function n(a,i){if(typeof a!="function"||i!=null&&typeof i!="function")throw new TypeError(r);var o=function(){var u=arguments,c=i?i.apply(this,u):u[0],f=o.cache;if(f.has(c))return f.get(c);var d=a.apply(this,u);return o.cache=f.set(c,d)||f,d};return o.cache=new(n.Cache||e),o}return n.Cache=e,vx=n,vx}var gx,LD;function o1e(){if(LD)return gx;LD=1;var e=i1e(),r=500;function n(a){var i=e(a,function(u){return o.size===r&&o.clear(),u}),o=i.cache;return i}return gx=n,gx}var yx,ID;function l1e(){if(ID)return yx;ID=1;var e=o1e(),r=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,a=e(function(i){var o=[];return i.charCodeAt(0)===46&&o.push(""),i.replace(r,function(u,c,f,d){o.push(f?d.replace(n,"$1"):c||u)}),o});return yx=a,yx}var bx,zD;function Em(){if(zD)return bx;zD=1;function e(r,n){for(var a=-1,i=r==null?0:r.length,o=Array(i);++a<i;)o[a]=n(r[a],a,r);return o}return bx=e,bx}var xx,qD;function u1e(){if(qD)return xx;qD=1;var e=bu(),r=Em(),n=Tt(),a=wu(),i=e?e.prototype:void 0,o=i?i.toString:void 0;function u(c){if(typeof c=="string")return c;if(n(c))return r(c,u)+"";if(a(c))return o?o.call(c):"";var f=c+"";return f=="0"&&1/c==-1/0?"-0":f}return xx=u,xx}var _x,BD;function H$(){if(BD)return _x;BD=1;var e=u1e();function r(n){return n==null?"":e(n)}return _x=r,_x}var wx,$D;function km(){if($D)return wx;$D=1;var e=Tt(),r=Xk(),n=l1e(),a=H$();function i(o,u){return e(o)?o:r(o,u)?[o]:n(a(o))}return wx=i,wx}var Sx,UD;function Zc(){if(UD)return Sx;UD=1;var e=wu();function r(n){if(typeof n=="string"||e(n))return n;var a=n+"";return a=="0"&&1/n==-1/0?"-0":a}return Sx=r,Sx}var Ex,FD;function jm(){if(FD)return Ex;FD=1;var e=km(),r=Zc();function n(a,i){i=e(i,a);for(var o=0,u=i.length;a!=null&&o<u;)a=a[r(i[o++])];return o&&o==u?a:void 0}return Ex=n,Ex}var kx,HD;function s1e(){if(HD)return kx;HD=1;var e=jm();function r(n,a,i){var o=n==null?void 0:e(n,a);return o===void 0?i:o}return kx=r,kx}var jx,GD;function c1e(){if(GD)return jx;GD=1;function e(r,n){return r!=null&&n in Object(r)}return jx=e,jx}var Ax,KD;function G$(){if(KD)return Ax;KD=1;var e=km(),r=Xc(),n=Tt(),a=bm(),i=qk(),o=Zc();function u(c,f,d){f=e(f,c);for(var h=-1,m=f.length,g=!1;++h<m;){var y=o(f[h]);if(!(g=c!=null&&d(c,y)))break;c=c[y]}return g||++h!=m?g:(m=c==null?0:c.length,!!m&&i(m)&&a(y,m)&&(n(c)||r(c)))}return Ax=u,Ax}var Ox,VD;function K$(){if(VD)return Ox;VD=1;var e=c1e(),r=G$();function n(a,i){return a!=null&&r(a,i,e)}return Ox=n,Ox}var Cx,YD;function f1e(){if(YD)return Cx;YD=1;var e=$$(),r=s1e(),n=K$(),a=Xk(),i=U$(),o=F$(),u=Zc(),c=1,f=2;function d(h,m){return a(h)&&i(m)?o(u(h),m):function(g){var y=r(g,h);return y===void 0&&y===m?n(g,h):e(m,y,c|f)}}return Cx=d,Cx}var Tx,XD;function V$(){if(XD)return Tx;XD=1;function e(r){return function(n){return n==null?void 0:n[r]}}return Tx=e,Tx}var Nx,WD;function d1e(){if(WD)return Nx;WD=1;var e=jm();function r(n){return function(a){return e(a,n)}}return Nx=r,Nx}var Mx,ZD;function h1e(){if(ZD)return Mx;ZD=1;var e=V$(),r=d1e(),n=Xk(),a=Zc();function i(o){return n(o)?e(a(o)):r(o)}return Mx=i,Mx}var Px,QD;function oi(){if(QD)return Px;QD=1;var e=a1e(),r=f1e(),n=Vo(),a=Tt(),i=h1e();function o(u){return typeof u=="function"?u:u==null?n:typeof u=="object"?a(u)?r(u[0],u[1]):e(u):i(u)}return Px=o,Px}var Rx,JD;function Y$(){if(JD)return Rx;JD=1;var e=E$(),r=Ybe(),n=oi(),a=Tt();function i(o,u){var c=a(o)?e:r;return c(o,n(u,3))}return Rx=i,Rx}var Dx,e8;function p1e(){if(e8)return Dx;e8=1;var e=Object.prototype,r=e.hasOwnProperty;function n(a,i){return a!=null&&r.call(a,i)}return Dx=n,Dx}var Lx,t8;function X$(){if(t8)return Lx;t8=1;var e=p1e(),r=G$();function n(a,i){return a!=null&&r(a,i,e)}return Lx=n,Lx}var Ix,r8;function m1e(){if(r8)return Ix;r8=1;var e=$k(),r=_u(),n=Xc(),a=Tt(),i=ii(),o=xu(),u=_m(),c=Wc(),f="[object Map]",d="[object Set]",h=Object.prototype,m=h.hasOwnProperty;function g(y){if(y==null)return!0;if(i(y)&&(a(y)||typeof y=="string"||typeof y.splice=="function"||o(y)||c(y)||n(y)))return!y.length;var x=r(y);if(x==f||x==d)return!y.size;if(u(y))return!e(y).length;for(var E in y)if(m.call(y,E))return!1;return!0}return Ix=g,Ix}var zx,n8;function W$(){if(n8)return zx;n8=1;function e(r){return r===void 0}return zx=e,zx}var qx,a8;function Z$(){if(a8)return qx;a8=1;var e=Sm(),r=ii();function n(a,i){var o=-1,u=r(a)?Array(a.length):[];return e(a,function(c,f,d){u[++o]=i(c,f,d)}),u}return qx=n,qx}var Bx,i8;function Q$(){if(i8)return Bx;i8=1;var e=Em(),r=oi(),n=Z$(),a=Tt();function i(o,u){var c=a(o)?e:n;return c(o,r(u,3))}return Bx=i,Bx}var $x,o8;function v1e(){if(o8)return $x;o8=1;function e(r,n,a,i){var o=-1,u=r==null?0:r.length;for(i&&u&&(a=r[++o]);++o<u;)a=n(a,r[o],o,r);return a}return $x=e,$x}var Ux,l8;function g1e(){if(l8)return Ux;l8=1;function e(r,n,a,i,o){return o(r,function(u,c,f){a=i?(i=!1,u):n(a,u,c,f)}),a}return Ux=e,Ux}var Fx,u8;function J$(){if(u8)return Fx;u8=1;var e=v1e(),r=Sm(),n=oi(),a=g1e(),i=Tt();function o(u,c,f){var d=i(u)?e:a,h=arguments.length<3;return d(u,n(c,4),f,h,r)}return Fx=o,Fx}var Hx,s8;function y1e(){if(s8)return Hx;s8=1;var e=Ho(),r=Tt(),n=ha(),a="[object String]";function i(o){return typeof o=="string"||!r(o)&&n(o)&&e(o)==a}return Hx=i,Hx}var Gx,c8;function b1e(){if(c8)return Gx;c8=1;var e=V$(),r=e("length");return Gx=r,Gx}var Kx,f8;function x1e(){if(f8)return Kx;f8=1;var e="\\ud800-\\udfff",r="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",a="\\u20d0-\\u20ff",i=r+n+a,o="\\ufe0e\\ufe0f",u="\\u200d",c=RegExp("["+u+e+i+o+"]");function f(d){return c.test(d)}return Kx=f,Kx}var Vx,d8;function _1e(){if(d8)return Vx;d8=1;var e="\\ud800-\\udfff",r="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",a="\\u20d0-\\u20ff",i=r+n+a,o="\\ufe0e\\ufe0f",u="["+e+"]",c="["+i+"]",f="\\ud83c[\\udffb-\\udfff]",d="(?:"+c+"|"+f+")",h="[^"+e+"]",m="(?:\\ud83c[\\udde6-\\uddff]){2}",g="[\\ud800-\\udbff][\\udc00-\\udfff]",y="\\u200d",x=d+"?",E="["+o+"]?",w="(?:"+y+"(?:"+[h,m,g].join("|")+")"+E+x+")*",_=E+x+w,A="(?:"+[h+c+"?",c,m,g,u].join("|")+")",O=RegExp(f+"(?="+f+")|"+A+_,"g");function T(C){for(var N=O.lastIndex=0;O.test(C);)++N;return N}return Vx=T,Vx}var Yx,h8;function w1e(){if(h8)return Yx;h8=1;var e=b1e(),r=x1e(),n=_1e();function a(i){return r(i)?n(i):e(i)}return Yx=a,Yx}var Xx,p8;function S1e(){if(p8)return Xx;p8=1;var e=$k(),r=_u(),n=ii(),a=y1e(),i=w1e(),o="[object Map]",u="[object Set]";function c(f){if(f==null)return 0;if(n(f))return a(f)?i(f):f.length;var d=r(f);return d==o||d==u?f.size:e(f).length}return Xx=c,Xx}var Wx,m8;function E1e(){if(m8)return Wx;m8=1;var e=zk(),r=M$(),n=Vk(),a=oi(),i=wm(),o=Tt(),u=xu(),c=Vc(),f=_n(),d=Wc();function h(m,g,y){var x=o(m),E=x||u(m)||d(m);if(g=a(g,4),y==null){var w=m&&m.constructor;E?y=x?new w:[]:f(m)?y=c(w)?r(i(m)):{}:y={}}return(E?e:n)(m,function(_,A,O){return g(y,_,A,O)}),y}return Wx=h,Wx}var Zx,v8;function k1e(){if(v8)return Zx;v8=1;var e=bu(),r=Xc(),n=Tt(),a=e?e.isConcatSpreadable:void 0;function i(o){return n(o)||r(o)||!!(a&&o&&o[a])}return Zx=i,Zx}var Qx,g8;function Wk(){if(g8)return Qx;g8=1;var e=Fk(),r=k1e();function n(a,i,o,u,c){var f=-1,d=a.length;for(o||(o=r),c||(c=[]);++f<d;){var h=a[f];i>0&&o(h)?i>1?n(h,i-1,o,u,c):e(c,h):u||(c[c.length]=h)}return c}return Qx=n,Qx}var Jx,y8;function j1e(){if(y8)return Jx;y8=1;function e(r,n,a){switch(a.length){case 0:return r.call(n);case 1:return r.call(n,a[0]);case 2:return r.call(n,a[0],a[1]);case 3:return r.call(n,a[0],a[1],a[2])}return r.apply(n,a)}return Jx=e,Jx}var e_,b8;function eU(){if(b8)return e_;b8=1;var e=j1e(),r=Math.max;function n(a,i,o){return i=r(i===void 0?a.length-1:i,0),function(){for(var u=arguments,c=-1,f=r(u.length-i,0),d=Array(f);++c<f;)d[c]=u[i+c];c=-1;for(var h=Array(i+1);++c<i;)h[c]=u[c];return h[i]=o(d),e(a,this,h)}}return e_=n,e_}var t_,x8;function A1e(){if(x8)return t_;x8=1;var e=Gk(),r=b$(),n=Vo(),a=r?function(i,o){return r(i,"toString",{configurable:!0,enumerable:!1,value:e(o),writable:!0})}:n;return t_=a,t_}var r_,_8;function O1e(){if(_8)return r_;_8=1;var e=800,r=16,n=Date.now;function a(i){var o=0,u=0;return function(){var c=n(),f=r-(c-u);if(u=c,f>0){if(++o>=e)return arguments[0]}else o=0;return i.apply(void 0,arguments)}}return r_=a,r_}var n_,w8;function tU(){if(w8)return n_;w8=1;var e=A1e(),r=O1e(),n=r(e);return n_=n,n_}var a_,S8;function Am(){if(S8)return a_;S8=1;var e=Vo(),r=eU(),n=tU();function a(i,o){return n(r(i,o,e),i+"")}return a_=a,a_}var i_,E8;function rU(){if(E8)return i_;E8=1;function e(r,n,a,i){for(var o=r.length,u=a+(i?1:-1);i?u--:++u<o;)if(n(r[u],u,r))return u;return-1}return i_=e,i_}var o_,k8;function C1e(){if(k8)return o_;k8=1;function e(r){return r!==r}return o_=e,o_}var l_,j8;function T1e(){if(j8)return l_;j8=1;function e(r,n,a){for(var i=a-1,o=r.length;++i<o;)if(r[i]===n)return i;return-1}return l_=e,l_}var u_,A8;function N1e(){if(A8)return u_;A8=1;var e=rU(),r=C1e(),n=T1e();function a(i,o,u){return o===o?n(i,o,u):e(i,r,u)}return u_=a,u_}var s_,O8;function M1e(){if(O8)return s_;O8=1;var e=N1e();function r(n,a){var i=n==null?0:n.length;return!!i&&e(n,a,0)>-1}return s_=r,s_}var c_,C8;function P1e(){if(C8)return c_;C8=1;function e(r,n,a){for(var i=-1,o=r==null?0:r.length;++i<o;)if(a(n,r[i]))return!0;return!1}return c_=e,c_}var f_,T8;function R1e(){if(T8)return f_;T8=1;function e(){}return f_=e,f_}var d_,N8;function D1e(){if(N8)return d_;N8=1;var e=C$(),r=R1e(),n=Yk(),a=1/0,i=e&&1/n(new e([,-0]))[1]==a?function(o){return new e(o)}:r;return d_=i,d_}var h_,M8;function L1e(){if(M8)return h_;M8=1;var e=z$(),r=M1e(),n=P1e(),a=q$(),i=D1e(),o=Yk(),u=200;function c(f,d,h){var m=-1,g=r,y=f.length,x=!0,E=[],w=E;if(h)x=!1,g=n;else if(y>=u){var _=d?null:i(f);if(_)return o(_);x=!1,g=a,w=new e}else w=d?[]:E;e:for(;++m<y;){var A=f[m],O=d?d(A):A;if(A=h||A!==0?A:0,x&&O===O){for(var T=w.length;T--;)if(w[T]===O)continue e;d&&w.push(O),E.push(A)}else g(w,O,h)||(w!==E&&w.push(O),E.push(A))}return E}return h_=c,h_}var p_,P8;function nU(){if(P8)return p_;P8=1;var e=ii(),r=ha();function n(a){return r(a)&&e(a)}return p_=n,p_}var m_,R8;function I1e(){if(R8)return m_;R8=1;var e=Wk(),r=Am(),n=L1e(),a=nU(),i=r(function(o){return n(e(o,1,a,!0))});return m_=i,m_}var v_,D8;function z1e(){if(D8)return v_;D8=1;var e=Em();function r(n,a){return e(a,function(i){return n[i]})}return v_=r,v_}var g_,L8;function aU(){if(L8)return g_;L8=1;var e=z1e(),r=Yi();function n(a){return a==null?[]:e(a,r(a))}return g_=n,g_}var y_,I8;function wn(){if(I8)return y_;I8=1;var e;if(typeof Dk=="function")try{e={clone:Gbe(),constant:Gk(),each:I$(),filter:Y$(),has:X$(),isArray:Tt(),isEmpty:m1e(),isFunction:Vc(),isUndefined:W$(),keys:Yi(),map:Q$(),reduce:J$(),size:S1e(),transform:E1e(),union:I1e(),values:aU()}}catch{}return e||(e=window._),y_=e,y_}var b_,z8;function Zk(){if(z8)return b_;z8=1;var e=wn();b_=i;var r="\0",n="\0",a="";function i(h){this._isDirected=e.has(h,"directed")?h.directed:!0,this._isMultigraph=e.has(h,"multigraph")?h.multigraph:!1,this._isCompound=e.has(h,"compound")?h.compound:!1,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[n]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}i.prototype._nodeCount=0,i.prototype._edgeCount=0,i.prototype.isDirected=function(){return this._isDirected},i.prototype.isMultigraph=function(){return this._isMultigraph},i.prototype.isCompound=function(){return this._isCompound},i.prototype.setGraph=function(h){return this._label=h,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(h){return e.isFunction(h)||(h=e.constant(h)),this._defaultNodeLabelFn=h,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return e.keys(this._nodes)},i.prototype.sources=function(){var h=this;return e.filter(this.nodes(),function(m){return e.isEmpty(h._in[m])})},i.prototype.sinks=function(){var h=this;return e.filter(this.nodes(),function(m){return e.isEmpty(h._out[m])})},i.prototype.setNodes=function(h,m){var g=arguments,y=this;return e.each(h,function(x){g.length>1?y.setNode(x,m):y.setNode(x)}),this},i.prototype.setNode=function(h,m){return e.has(this._nodes,h)?(arguments.length>1&&(this._nodes[h]=m),this):(this._nodes[h]=arguments.length>1?m:this._defaultNodeLabelFn(h),this._isCompound&&(this._parent[h]=n,this._children[h]={},this._children[n][h]=!0),this._in[h]={},this._preds[h]={},this._out[h]={},this._sucs[h]={},++this._nodeCount,this)},i.prototype.node=function(h){return this._nodes[h]},i.prototype.hasNode=function(h){return e.has(this._nodes,h)},i.prototype.removeNode=function(h){var m=this;if(e.has(this._nodes,h)){var g=function(y){m.removeEdge(m._edgeObjs[y])};delete this._nodes[h],this._isCompound&&(this._removeFromParentsChildList(h),delete this._parent[h],e.each(this.children(h),function(y){m.setParent(y)}),delete this._children[h]),e.each(e.keys(this._in[h]),g),delete this._in[h],delete this._preds[h],e.each(e.keys(this._out[h]),g),delete this._out[h],delete this._sucs[h],--this._nodeCount}return this},i.prototype.setParent=function(h,m){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(m))m=n;else{m+="";for(var g=m;!e.isUndefined(g);g=this.parent(g))if(g===h)throw new Error("Setting "+m+" as parent of "+h+" would create a cycle");this.setNode(m)}return this.setNode(h),this._removeFromParentsChildList(h),this._parent[h]=m,this._children[m][h]=!0,this},i.prototype._removeFromParentsChildList=function(h){delete this._children[this._parent[h]][h]},i.prototype.parent=function(h){if(this._isCompound){var m=this._parent[h];if(m!==n)return m}},i.prototype.children=function(h){if(e.isUndefined(h)&&(h=n),this._isCompound){var m=this._children[h];if(m)return e.keys(m)}else{if(h===n)return this.nodes();if(this.hasNode(h))return[]}},i.prototype.predecessors=function(h){var m=this._preds[h];if(m)return e.keys(m)},i.prototype.successors=function(h){var m=this._sucs[h];if(m)return e.keys(m)},i.prototype.neighbors=function(h){var m=this.predecessors(h);if(m)return e.union(m,this.successors(h))},i.prototype.isLeaf=function(h){var m;return this.isDirected()?m=this.successors(h):m=this.neighbors(h),m.length===0},i.prototype.filterNodes=function(h){var m=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});m.setGraph(this.graph());var g=this;e.each(this._nodes,function(E,w){h(w)&&m.setNode(w,E)}),e.each(this._edgeObjs,function(E){m.hasNode(E.v)&&m.hasNode(E.w)&&m.setEdge(E,g.edge(E))});var y={};function x(E){var w=g.parent(E);return w===void 0||m.hasNode(w)?(y[E]=w,w):w in y?y[w]:x(w)}return this._isCompound&&e.each(m.nodes(),function(E){m.setParent(E,x(E))}),m},i.prototype.setDefaultEdgeLabel=function(h){return e.isFunction(h)||(h=e.constant(h)),this._defaultEdgeLabelFn=h,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return e.values(this._edgeObjs)},i.prototype.setPath=function(h,m){var g=this,y=arguments;return e.reduce(h,function(x,E){return y.length>1?g.setEdge(x,E,m):g.setEdge(x,E),E}),this},i.prototype.setEdge=function(){var h,m,g,y,x=!1,E=arguments[0];typeof E=="object"&&E!==null&&"v"in E?(h=E.v,m=E.w,g=E.name,arguments.length===2&&(y=arguments[1],x=!0)):(h=E,m=arguments[1],g=arguments[3],arguments.length>2&&(y=arguments[2],x=!0)),h=""+h,m=""+m,e.isUndefined(g)||(g=""+g);var w=c(this._isDirected,h,m,g);if(e.has(this._edgeLabels,w))return x&&(this._edgeLabels[w]=y),this;if(!e.isUndefined(g)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(h),this.setNode(m),this._edgeLabels[w]=x?y:this._defaultEdgeLabelFn(h,m,g);var _=f(this._isDirected,h,m,g);return h=_.v,m=_.w,Object.freeze(_),this._edgeObjs[w]=_,o(this._preds[m],h),o(this._sucs[h],m),this._in[m][w]=_,this._out[h][w]=_,this._edgeCount++,this},i.prototype.edge=function(h,m,g){var y=arguments.length===1?d(this._isDirected,arguments[0]):c(this._isDirected,h,m,g);return this._edgeLabels[y]},i.prototype.hasEdge=function(h,m,g){var y=arguments.length===1?d(this._isDirected,arguments[0]):c(this._isDirected,h,m,g);return e.has(this._edgeLabels,y)},i.prototype.removeEdge=function(h,m,g){var y=arguments.length===1?d(this._isDirected,arguments[0]):c(this._isDirected,h,m,g),x=this._edgeObjs[y];return x&&(h=x.v,m=x.w,delete this._edgeLabels[y],delete this._edgeObjs[y],u(this._preds[m],h),u(this._sucs[h],m),delete this._in[m][y],delete this._out[h][y],this._edgeCount--),this},i.prototype.inEdges=function(h,m){var g=this._in[h];if(g){var y=e.values(g);return m?e.filter(y,function(x){return x.v===m}):y}},i.prototype.outEdges=function(h,m){var g=this._out[h];if(g){var y=e.values(g);return m?e.filter(y,function(x){return x.w===m}):y}},i.prototype.nodeEdges=function(h,m){var g=this.inEdges(h,m);if(g)return g.concat(this.outEdges(h,m))};function o(h,m){h[m]?h[m]++:h[m]=1}function u(h,m){--h[m]||delete h[m]}function c(h,m,g,y){var x=""+m,E=""+g;if(!h&&x>E){var w=x;x=E,E=w}return x+a+E+a+(e.isUndefined(y)?r:y)}function f(h,m,g,y){var x=""+m,E=""+g;if(!h&&x>E){var w=x;x=E,E=w}var _={v:x,w:E};return y&&(_.name=y),_}function d(h,m){return c(h,m.v,m.w,m.name)}return b_}var x_,q8;function q1e(){return q8||(q8=1,x_="2.1.8"),x_}var __,B8;function B1e(){return B8||(B8=1,__={Graph:Zk(),version:q1e()}),__}var w_,$8;function $1e(){if($8)return w_;$8=1;var e=wn(),r=Zk();w_={write:n,read:o};function n(u){var c={options:{directed:u.isDirected(),multigraph:u.isMultigraph(),compound:u.isCompound()},nodes:a(u),edges:i(u)};return e.isUndefined(u.graph())||(c.value=e.clone(u.graph())),c}function a(u){return e.map(u.nodes(),function(c){var f=u.node(c),d=u.parent(c),h={v:c};return e.isUndefined(f)||(h.value=f),e.isUndefined(d)||(h.parent=d),h})}function i(u){return e.map(u.edges(),function(c){var f=u.edge(c),d={v:c.v,w:c.w};return e.isUndefined(c.name)||(d.name=c.name),e.isUndefined(f)||(d.value=f),d})}function o(u){var c=new r(u.options).setGraph(u.value);return e.each(u.nodes,function(f){c.setNode(f.v,f.value),f.parent&&c.setParent(f.v,f.parent)}),e.each(u.edges,function(f){c.setEdge({v:f.v,w:f.w,name:f.name},f.value)}),c}return w_}var S_,U8;function U1e(){if(U8)return S_;U8=1;var e=wn();S_=r;function r(n){var a={},i=[],o;function u(c){e.has(a,c)||(a[c]=!0,o.push(c),e.each(n.successors(c),u),e.each(n.predecessors(c),u))}return e.each(n.nodes(),function(c){o=[],u(c),o.length&&i.push(o)}),i}return S_}var E_,F8;function iU(){if(F8)return E_;F8=1;var e=wn();E_=r;function r(){this._arr=[],this._keyIndices={}}return r.prototype.size=function(){return this._arr.length},r.prototype.keys=function(){return this._arr.map(function(n){return n.key})},r.prototype.has=function(n){return e.has(this._keyIndices,n)},r.prototype.priority=function(n){var a=this._keyIndices[n];if(a!==void 0)return this._arr[a].priority},r.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},r.prototype.add=function(n,a){var i=this._keyIndices;if(n=String(n),!e.has(i,n)){var o=this._arr,u=o.length;return i[n]=u,o.push({key:n,priority:a}),this._decrease(u),!0}return!1},r.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key},r.prototype.decrease=function(n,a){var i=this._keyIndices[n];if(a>this._arr[i].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[i].priority+" New: "+a);this._arr[i].priority=a,this._decrease(i)},r.prototype._heapify=function(n){var a=this._arr,i=2*n,o=i+1,u=n;i<a.length&&(u=a[i].priority<a[u].priority?i:u,o<a.length&&(u=a[o].priority<a[u].priority?o:u),u!==n&&(this._swap(n,u),this._heapify(u)))},r.prototype._decrease=function(n){for(var a=this._arr,i=a[n].priority,o;n!==0&&(o=n>>1,!(a[o].priority<i));)this._swap(n,o),n=o},r.prototype._swap=function(n,a){var i=this._arr,o=this._keyIndices,u=i[n],c=i[a];i[n]=c,i[a]=u,o[c.key]=n,o[u.key]=a},E_}var k_,H8;function oU(){if(H8)return k_;H8=1;var e=wn(),r=iU();k_=a;var n=e.constant(1);function a(o,u,c,f){return i(o,String(u),c||n,f||function(d){return o.outEdges(d)})}function i(o,u,c,f){var d={},h=new r,m,g,y=function(x){var E=x.v!==m?x.v:x.w,w=d[E],_=c(x),A=g.distance+_;if(_<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+x+" Weight: "+_);A<w.distance&&(w.distance=A,w.predecessor=m,h.decrease(E,A))};for(o.nodes().forEach(function(x){var E=x===u?0:Number.POSITIVE_INFINITY;d[x]={distance:E},h.add(x,E)});h.size()>0&&(m=h.removeMin(),g=d[m],g.distance!==Number.POSITIVE_INFINITY);)f(m).forEach(y);return d}return k_}var j_,G8;function F1e(){if(G8)return j_;G8=1;var e=oU(),r=wn();j_=n;function n(a,i,o){return r.transform(a.nodes(),function(u,c){u[c]=e(a,c,i,o)},{})}return j_}var A_,K8;function lU(){if(K8)return A_;K8=1;var e=wn();A_=r;function r(n){var a=0,i=[],o={},u=[];function c(f){var d=o[f]={onStack:!0,lowlink:a,index:a++};if(i.push(f),n.successors(f).forEach(function(g){e.has(o,g)?o[g].onStack&&(d.lowlink=Math.min(d.lowlink,o[g].index)):(c(g),d.lowlink=Math.min(d.lowlink,o[g].lowlink))}),d.lowlink===d.index){var h=[],m;do m=i.pop(),o[m].onStack=!1,h.push(m);while(f!==m);u.push(h)}}return n.nodes().forEach(function(f){e.has(o,f)||c(f)}),u}return A_}var O_,V8;function H1e(){if(V8)return O_;V8=1;var e=wn(),r=lU();O_=n;function n(a){return e.filter(r(a),function(i){return i.length>1||i.length===1&&a.hasEdge(i[0],i[0])})}return O_}var C_,Y8;function G1e(){if(Y8)return C_;Y8=1;var e=wn();C_=n;var r=e.constant(1);function n(i,o,u){return a(i,o||r,u||function(c){return i.outEdges(c)})}function a(i,o,u){var c={},f=i.nodes();return f.forEach(function(d){c[d]={},c[d][d]={distance:0},f.forEach(function(h){d!==h&&(c[d][h]={distance:Number.POSITIVE_INFINITY})}),u(d).forEach(function(h){var m=h.v===d?h.w:h.v,g=o(h);c[d][m]={distance:g,predecessor:d}})}),f.forEach(function(d){var h=c[d];f.forEach(function(m){var g=c[m];f.forEach(function(y){var x=g[d],E=h[y],w=g[y],_=x.distance+E.distance;_<w.distance&&(w.distance=_,w.predecessor=E.predecessor)})})}),c}return C_}var T_,X8;function uU(){if(X8)return T_;X8=1;var e=wn();T_=r,r.CycleException=n;function r(a){var i={},o={},u=[];function c(f){if(e.has(o,f))throw new n;e.has(i,f)||(o[f]=!0,i[f]=!0,e.each(a.predecessors(f),c),delete o[f],u.push(f))}if(e.each(a.sinks(),c),e.size(i)!==a.nodeCount())throw new n;return u}function n(){}return n.prototype=new Error,T_}var N_,W8;function K1e(){if(W8)return N_;W8=1;var e=uU();N_=r;function r(n){try{e(n)}catch(a){if(a instanceof e.CycleException)return!1;throw a}return!0}return N_}var M_,Z8;function sU(){if(Z8)return M_;Z8=1;var e=wn();M_=r;function r(a,i,o){e.isArray(i)||(i=[i]);var u=(a.isDirected()?a.successors:a.neighbors).bind(a),c=[],f={};return e.each(i,function(d){if(!a.hasNode(d))throw new Error("Graph does not have node: "+d);n(a,d,o==="post",f,u,c)}),c}function n(a,i,o,u,c,f){e.has(u,i)||(u[i]=!0,o||f.push(i),e.each(c(i),function(d){n(a,d,o,u,c,f)}),o&&f.push(i))}return M_}var P_,Q8;function V1e(){if(Q8)return P_;Q8=1;var e=sU();P_=r;function r(n,a){return e(n,a,"post")}return P_}var R_,J8;function Y1e(){if(J8)return R_;J8=1;var e=sU();R_=r;function r(n,a){return e(n,a,"pre")}return R_}var D_,e9;function X1e(){if(e9)return D_;e9=1;var e=wn(),r=Zk(),n=iU();D_=a;function a(i,o){var u=new r,c={},f=new n,d;function h(g){var y=g.v===d?g.w:g.v,x=f.priority(y);if(x!==void 0){var E=o(g);E<x&&(c[y]=d,f.decrease(y,E))}}if(i.nodeCount()===0)return u;e.each(i.nodes(),function(g){f.add(g,Number.POSITIVE_INFINITY),u.setNode(g)}),f.decrease(i.nodes()[0],0);for(var m=!1;f.size()>0;){if(d=f.removeMin(),e.has(c,d))u.setEdge(d,c[d]);else{if(m)throw new Error("Input graph is not connected: "+i);m=!0}i.nodeEdges(d).forEach(h)}return u}return D_}var L_,t9;function W1e(){return t9||(t9=1,L_={components:U1e(),dijkstra:oU(),dijkstraAll:F1e(),findCycles:H1e(),floydWarshall:G1e(),isAcyclic:K1e(),postorder:V1e(),preorder:Y1e(),prim:X1e(),tarjan:lU(),topsort:uU()}),L_}var I_,r9;function Z1e(){if(r9)return I_;r9=1;var e=B1e();return I_={Graph:e.Graph,json:$1e(),alg:W1e(),version:e.version},I_}var z_,n9;function Rn(){if(n9)return z_;n9=1;var e;if(typeof Dk=="function")try{e=Z1e()}catch{}return e||(e=window.graphlib),z_=e,z_}var q_,a9;function Q1e(){if(a9)return q_;a9=1;var e=R$(),r=1,n=4;function a(i){return e(i,r|n)}return q_=a,q_}var B_,i9;function Om(){if(i9)return B_;i9=1;var e=yu(),r=ii(),n=bm(),a=_n();function i(o,u,c){if(!a(c))return!1;var f=typeof u;return(f=="number"?r(c)&&n(u,c.length):f=="string"&&u in c)?e(c[u],o):!1}return B_=i,B_}var $_,o9;function J1e(){if(o9)return $_;o9=1;var e=Am(),r=yu(),n=Om(),a=Ko(),i=Object.prototype,o=i.hasOwnProperty,u=e(function(c,f){c=Object(c);var d=-1,h=f.length,m=h>2?f[2]:void 0;for(m&&n(f[0],f[1],m)&&(h=1);++d<h;)for(var g=f[d],y=a(g),x=-1,E=y.length;++x<E;){var w=y[x],_=c[w];(_===void 0||r(_,i[w])&&!o.call(c,w))&&(c[w]=g[w])}return c});return $_=u,$_}var U_,l9;function exe(){if(l9)return U_;l9=1;var e=oi(),r=ii(),n=Yi();function a(i){return function(o,u,c){var f=Object(o);if(!r(o)){var d=e(u,3);o=n(o),u=function(m){return d(f[m],m,f)}}var h=i(o,u,c);return h>-1?f[d?o[h]:h]:void 0}}return U_=a,U_}var F_,u9;function txe(){if(u9)return F_;u9=1;var e=/\s/;function r(n){for(var a=n.length;a--&&e.test(n.charAt(a)););return a}return F_=r,F_}var H_,s9;function rxe(){if(s9)return H_;s9=1;var e=txe(),r=/^\s+/;function n(a){return a&&a.slice(0,e(a)+1).replace(r,"")}return H_=n,H_}var G_,c9;function nxe(){if(c9)return G_;c9=1;var e=rxe(),r=_n(),n=wu(),a=NaN,i=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,u=/^0o[0-7]+$/i,c=parseInt;function f(d){if(typeof d=="number")return d;if(n(d))return a;if(r(d)){var h=typeof d.valueOf=="function"?d.valueOf():d;d=r(h)?h+"":h}if(typeof d!="string")return d===0?d:+d;d=e(d);var m=o.test(d);return m||u.test(d)?c(d.slice(2),m?2:8):i.test(d)?a:+d}return G_=f,G_}var K_,f9;function cU(){if(f9)return K_;f9=1;var e=nxe(),r=1/0,n=17976931348623157e292;function a(i){if(!i)return i===0?i:0;if(i=e(i),i===r||i===-r){var o=i<0?-1:1;return o*n}return i===i?i:0}return K_=a,K_}var V_,d9;function axe(){if(d9)return V_;d9=1;var e=cU();function r(n){var a=e(n),i=a%1;return a===a?i?a-i:a:0}return V_=r,V_}var Y_,h9;function ixe(){if(h9)return Y_;h9=1;var e=rU(),r=oi(),n=axe(),a=Math.max;function i(o,u,c){var f=o==null?0:o.length;if(!f)return-1;var d=c==null?0:n(c);return d<0&&(d=a(f+d,0)),e(o,r(u,3),d)}return Y_=i,Y_}var X_,p9;function oxe(){if(p9)return X_;p9=1;var e=exe(),r=ixe(),n=e(r);return X_=n,X_}var W_,m9;function fU(){if(m9)return W_;m9=1;var e=Wk();function r(n){var a=n==null?0:n.length;return a?e(n,1):[]}return W_=r,W_}var Z_,v9;function lxe(){if(v9)return Z_;v9=1;var e=Kk(),r=D$(),n=Ko();function a(i,o){return i==null?i:e(i,r(o),n)}return Z_=a,Z_}var Q_,g9;function uxe(){if(g9)return Q_;g9=1;function e(r){var n=r==null?0:r.length;return n?r[n-1]:void 0}return Q_=e,Q_}var J_,y9;function sxe(){if(y9)return J_;y9=1;var e=gm(),r=Vk(),n=oi();function a(i,o){var u={};return o=n(o,3),r(i,function(c,f,d){e(u,f,o(c,f,d))}),u}return J_=a,J_}var ew,b9;function Qk(){if(b9)return ew;b9=1;var e=wu();function r(n,a,i){for(var o=-1,u=n.length;++o<u;){var c=n[o],f=a(c);if(f!=null&&(d===void 0?f===f&&!e(f):i(f,d)))var d=f,h=c}return h}return ew=r,ew}var tw,x9;function cxe(){if(x9)return tw;x9=1;function e(r,n){return r>n}return tw=e,tw}var rw,_9;function fxe(){if(_9)return rw;_9=1;var e=Qk(),r=cxe(),n=Vo();function a(i){return i&&i.length?e(i,n,r):void 0}return rw=a,rw}var nw,w9;function dU(){if(w9)return nw;w9=1;var e=gm(),r=yu();function n(a,i,o){(o!==void 0&&!r(a[i],o)||o===void 0&&!(i in a))&&e(a,i,o)}return nw=n,nw}var aw,S9;function dxe(){if(S9)return aw;S9=1;var e=Ho(),r=wm(),n=ha(),a="[object Object]",i=Function.prototype,o=Object.prototype,u=i.toString,c=o.hasOwnProperty,f=u.call(Object);function d(h){if(!n(h)||e(h)!=a)return!1;var m=r(h);if(m===null)return!0;var g=c.call(m,"constructor")&&m.constructor;return typeof g=="function"&&g instanceof g&&u.call(g)==f}return aw=d,aw}var iw,E9;function hU(){if(E9)return iw;E9=1;function e(r,n){if(!(n==="constructor"&&typeof r[n]=="function")&&n!="__proto__")return r[n]}return iw=e,iw}var ow,k9;function hxe(){if(k9)return ow;k9=1;var e=Yc(),r=Ko();function n(a){return e(a,r(a))}return ow=n,ow}var lw,j9;function pxe(){if(j9)return lw;j9=1;var e=dU(),r=w$(),n=N$(),a=S$(),i=P$(),o=Xc(),u=Tt(),c=nU(),f=xu(),d=Vc(),h=_n(),m=dxe(),g=Wc(),y=hU(),x=hxe();function E(w,_,A,O,T,C,N){var M=y(w,A),R=y(_,A),L=N.get(R);if(L){e(w,A,L);return}var D=C?C(M,R,A+"",w,_,N):void 0,z=D===void 0;if(z){var q=u(R),G=!q&&f(R),U=!q&&!G&&g(R);D=R,q||G||U?u(M)?D=M:c(M)?D=a(M):G?(z=!1,D=r(R,!0)):U?(z=!1,D=n(R,!0)):D=[]:m(R)||o(R)?(D=M,o(M)?D=x(M):(!h(M)||d(M))&&(D=i(R))):z=!1}z&&(N.set(R,D),T(D,R,O,C,N),N.delete(R)),e(w,A,D)}return lw=E,lw}var uw,A9;function mxe(){if(A9)return uw;A9=1;var e=vm(),r=dU(),n=Kk(),a=pxe(),i=_n(),o=Ko(),u=hU();function c(f,d,h,m,g){f!==d&&n(d,function(y,x){if(g||(g=new e),i(y))a(f,d,x,h,c,m,g);else{var E=m?m(u(f,x),y,x+"",f,d,g):void 0;E===void 0&&(E=y),r(f,x,E)}},o)}return uw=c,uw}var sw,O9;function vxe(){if(O9)return sw;O9=1;var e=Am(),r=Om();function n(a){return e(function(i,o){var u=-1,c=o.length,f=c>1?o[c-1]:void 0,d=c>2?o[2]:void 0;for(f=a.length>3&&typeof f=="function"?(c--,f):void 0,d&&r(o[0],o[1],d)&&(f=c<3?void 0:f,c=1),i=Object(i);++u<c;){var h=o[u];h&&a(i,h,u,f)}return i})}return sw=n,sw}var cw,C9;function gxe(){if(C9)return cw;C9=1;var e=mxe(),r=vxe(),n=r(function(a,i,o){e(a,i,o)});return cw=n,cw}var fw,T9;function pU(){if(T9)return fw;T9=1;function e(r,n){return r<n}return fw=e,fw}var dw,N9;function yxe(){if(N9)return dw;N9=1;var e=Qk(),r=pU(),n=Vo();function a(i){return i&&i.length?e(i,n,r):void 0}return dw=a,dw}var hw,M9;function bxe(){if(M9)return hw;M9=1;var e=Qk(),r=oi(),n=pU();function a(i,o){return i&&i.length?e(i,r(o,2),n):void 0}return hw=a,hw}var pw,P9;function xxe(){if(P9)return pw;P9=1;var e=zn(),r=function(){return e.Date.now()};return pw=r,pw}var mw,R9;function _xe(){if(R9)return mw;R9=1;var e=ym(),r=km(),n=bm(),a=_n(),i=Zc();function o(u,c,f,d){if(!a(u))return u;c=r(c,u);for(var h=-1,m=c.length,g=m-1,y=u;y!=null&&++h<m;){var x=i(c[h]),E=f;if(x==="__proto__"||x==="constructor"||x==="prototype")return u;if(h!=g){var w=y[x];E=d?d(w,x,y):void 0,E===void 0&&(E=a(w)?w:n(c[h+1])?[]:{})}e(y,x,E),y=y[x]}return u}return mw=o,mw}var vw,D9;function wxe(){if(D9)return vw;D9=1;var e=jm(),r=_xe(),n=km();function a(i,o,u){for(var c=-1,f=o.length,d={};++c<f;){var h=o[c],m=e(i,h);u(m,h)&&r(d,n(h,i),m)}return d}return vw=a,vw}var gw,L9;function Sxe(){if(L9)return gw;L9=1;var e=wxe(),r=K$();function n(a,i){return e(a,i,function(o,u){return r(a,u)})}return gw=n,gw}var yw,I9;function Exe(){if(I9)return yw;I9=1;var e=fU(),r=eU(),n=tU();function a(i){return n(r(i,void 0,e),i+"")}return yw=a,yw}var bw,z9;function kxe(){if(z9)return bw;z9=1;var e=Sxe(),r=Exe(),n=r(function(a,i){return a==null?{}:e(a,i)});return bw=n,bw}var xw,q9;function jxe(){if(q9)return xw;q9=1;var e=Math.ceil,r=Math.max;function n(a,i,o,u){for(var c=-1,f=r(e((i-a)/(o||1)),0),d=Array(f);f--;)d[u?f:++c]=a,a+=o;return d}return xw=n,xw}var _w,B9;function Axe(){if(B9)return _w;B9=1;var e=jxe(),r=Om(),n=cU();function a(i){return function(o,u,c){return c&&typeof c!="number"&&r(o,u,c)&&(u=c=void 0),o=n(o),u===void 0?(u=o,o=0):u=n(u),c=c===void 0?o<u?1:-1:n(c),e(o,u,c,i)}}return _w=a,_w}var ww,$9;function Oxe(){if($9)return ww;$9=1;var e=Axe(),r=e();return ww=r,ww}var Sw,U9;function Cxe(){if(U9)return Sw;U9=1;function e(r,n){var a=r.length;for(r.sort(n);a--;)r[a]=r[a].value;return r}return Sw=e,Sw}var Ew,F9;function Txe(){if(F9)return Ew;F9=1;var e=wu();function r(n,a){if(n!==a){var i=n!==void 0,o=n===null,u=n===n,c=e(n),f=a!==void 0,d=a===null,h=a===a,m=e(a);if(!d&&!m&&!c&&n>a||c&&f&&h&&!d&&!m||o&&f&&h||!i&&h||!u)return 1;if(!o&&!c&&!m&&n<a||m&&i&&u&&!o&&!c||d&&i&&u||!f&&u||!h)return-1}return 0}return Ew=r,Ew}var kw,H9;function Nxe(){if(H9)return kw;H9=1;var e=Txe();function r(n,a,i){for(var o=-1,u=n.criteria,c=a.criteria,f=u.length,d=i.length;++o<f;){var h=e(u[o],c[o]);if(h){if(o>=d)return h;var m=i[o];return h*(m=="desc"?-1:1)}}return n.index-a.index}return kw=r,kw}var jw,G9;function Mxe(){if(G9)return jw;G9=1;var e=Em(),r=jm(),n=oi(),a=Z$(),i=Cxe(),o=xm(),u=Nxe(),c=Vo(),f=Tt();function d(h,m,g){m.length?m=e(m,function(E){return f(E)?function(w){return r(w,E.length===1?E[0]:E)}:E}):m=[c];var y=-1;m=e(m,o(n));var x=a(h,function(E,w,_){var A=e(m,function(O){return O(E)});return{criteria:A,index:++y,value:E}});return i(x,function(E,w){return u(E,w,g)})}return jw=d,jw}var Aw,K9;function Pxe(){if(K9)return Aw;K9=1;var e=Wk(),r=Mxe(),n=Am(),a=Om(),i=n(function(o,u){if(o==null)return[];var c=u.length;return c>1&&a(o,u[0],u[1])?u=[]:c>2&&a(u[0],u[1],u[2])&&(u=[u[0]]),r(o,e(u,1),[])});return Aw=i,Aw}var Ow,V9;function Rxe(){if(V9)return Ow;V9=1;var e=H$(),r=0;function n(a){var i=++r;return e(a)+i}return Ow=n,Ow}var Cw,Y9;function Dxe(){if(Y9)return Cw;Y9=1;function e(r,n,a){for(var i=-1,o=r.length,u=n.length,c={};++i<o;){var f=i<u?n[i]:void 0;a(c,r[i],f)}return c}return Cw=e,Cw}var Tw,X9;function Lxe(){if(X9)return Tw;X9=1;var e=ym(),r=Dxe();function n(a,i){return r(a||[],i||[],e)}return Tw=n,Tw}var Nw,W9;function pt(){if(W9)return Nw;W9=1;var e;if(typeof Dk=="function")try{e={cloneDeep:Q1e(),constant:Gk(),defaults:J1e(),each:I$(),filter:Y$(),find:oxe(),flatten:fU(),forEach:L$(),forIn:lxe(),has:X$(),isUndefined:W$(),last:uxe(),map:Q$(),mapValues:sxe(),max:fxe(),merge:gxe(),min:yxe(),minBy:bxe(),now:xxe(),pick:kxe(),range:Oxe(),reduce:J$(),sortBy:Pxe(),uniqueId:Rxe(),values:aU(),zipObject:Lxe()}}catch{}return e||(e=window._),Nw=e,Nw}var Mw,Z9;function Ixe(){if(Z9)return Mw;Z9=1,Mw=e;function e(){var a={};a._next=a._prev=a,this._sentinel=a}e.prototype.dequeue=function(){var a=this._sentinel,i=a._prev;if(i!==a)return r(i),i},e.prototype.enqueue=function(a){var i=this._sentinel;a._prev&&a._next&&r(a),a._next=i._next,i._next._prev=a,i._next=a,a._prev=i},e.prototype.toString=function(){for(var a=[],i=this._sentinel,o=i._prev;o!==i;)a.push(JSON.stringify(o,n)),o=o._prev;return"["+a.join(", ")+"]"};function r(a){a._prev._next=a._next,a._next._prev=a._prev,delete a._next,delete a._prev}function n(a,i){if(a!=="_next"&&a!=="_prev")return i}return Mw}var Pw,Q9;function zxe(){if(Q9)return Pw;Q9=1;var e=pt(),r=Rn().Graph,n=Ixe();Pw=i;var a=e.constant(1);function i(d,h){if(d.nodeCount()<=1)return[];var m=c(d,h||a),g=o(m.graph,m.buckets,m.zeroIdx);return e.flatten(e.map(g,function(y){return d.outEdges(y.v,y.w)}),!0)}function o(d,h,m){for(var g=[],y=h[h.length-1],x=h[0],E;d.nodeCount();){for(;E=x.dequeue();)u(d,h,m,E);for(;E=y.dequeue();)u(d,h,m,E);if(d.nodeCount()){for(var w=h.length-2;w>0;--w)if(E=h[w].dequeue(),E){g=g.concat(u(d,h,m,E,!0));break}}}return g}function u(d,h,m,g,y){var x=y?[]:void 0;return e.forEach(d.inEdges(g.v),function(E){var w=d.edge(E),_=d.node(E.v);y&&x.push({v:E.v,w:E.w}),_.out-=w,f(h,m,_)}),e.forEach(d.outEdges(g.v),function(E){var w=d.edge(E),_=E.w,A=d.node(_);A.in-=w,f(h,m,A)}),d.removeNode(g.v),x}function c(d,h){var m=new r,g=0,y=0;e.forEach(d.nodes(),function(w){m.setNode(w,{v:w,in:0,out:0})}),e.forEach(d.edges(),function(w){var _=m.edge(w.v,w.w)||0,A=h(w),O=_+A;m.setEdge(w.v,w.w,O),y=Math.max(y,m.node(w.v).out+=A),g=Math.max(g,m.node(w.w).in+=A)});var x=e.range(y+g+3).map(function(){return new n}),E=g+1;return e.forEach(m.nodes(),function(w){f(x,E,m.node(w))}),{graph:m,buckets:x,zeroIdx:E}}function f(d,h,m){m.out?m.in?d[m.out-m.in+h].enqueue(m):d[d.length-1].enqueue(m):d[0].enqueue(m)}return Pw}var Rw,J9;function qxe(){if(J9)return Rw;J9=1;var e=pt(),r=zxe();Rw={run:n,undo:i};function n(o){var u=o.graph().acyclicer==="greedy"?r(o,c(o)):a(o);e.forEach(u,function(f){var d=o.edge(f);o.removeEdge(f),d.forwardName=f.name,d.reversed=!0,o.setEdge(f.w,f.v,d,e.uniqueId("rev"))});function c(f){return function(d){return f.edge(d).weight}}}function a(o){var u=[],c={},f={};function d(h){e.has(f,h)||(f[h]=!0,c[h]=!0,e.forEach(o.outEdges(h),function(m){e.has(c,m.w)?u.push(m):d(m.w)}),delete c[h])}return e.forEach(o.nodes(),d),u}function i(o){e.forEach(o.edges(),function(u){var c=o.edge(u);if(c.reversed){o.removeEdge(u);var f=c.forwardName;delete c.reversed,delete c.forwardName,o.setEdge(u.w,u.v,c,f)}})}return Rw}var Dw,e6;function Nr(){if(e6)return Dw;e6=1;var e=pt(),r=Rn().Graph;Dw={addDummyNode:n,simplify:a,asNonCompoundGraph:i,successorWeights:o,predecessorWeights:u,intersectRect:c,buildLayerMatrix:f,normalizeRanks:d,removeEmptyRanks:h,addBorderNode:m,maxRank:g,partition:y,time:x,notime:E};function n(w,_,A,O){var T;do T=e.uniqueId(O);while(w.hasNode(T));return A.dummy=_,w.setNode(T,A),T}function a(w){var _=new r().setGraph(w.graph());return e.forEach(w.nodes(),function(A){_.setNode(A,w.node(A))}),e.forEach(w.edges(),function(A){var O=_.edge(A.v,A.w)||{weight:0,minlen:1},T=w.edge(A);_.setEdge(A.v,A.w,{weight:O.weight+T.weight,minlen:Math.max(O.minlen,T.minlen)})}),_}function i(w){var _=new r({multigraph:w.isMultigraph()}).setGraph(w.graph());return e.forEach(w.nodes(),function(A){w.children(A).length||_.setNode(A,w.node(A))}),e.forEach(w.edges(),function(A){_.setEdge(A,w.edge(A))}),_}function o(w){var _=e.map(w.nodes(),function(A){var O={};return e.forEach(w.outEdges(A),function(T){O[T.w]=(O[T.w]||0)+w.edge(T).weight}),O});return e.zipObject(w.nodes(),_)}function u(w){var _=e.map(w.nodes(),function(A){var O={};return e.forEach(w.inEdges(A),function(T){O[T.v]=(O[T.v]||0)+w.edge(T).weight}),O});return e.zipObject(w.nodes(),_)}function c(w,_){var A=w.x,O=w.y,T=_.x-A,C=_.y-O,N=w.width/2,M=w.height/2;if(!T&&!C)throw new Error("Not possible to find intersection inside of the rectangle");var R,L;return Math.abs(C)*N>Math.abs(T)*M?(C<0&&(M=-M),R=M*T/C,L=M):(T<0&&(N=-N),R=N,L=N*C/T),{x:A+R,y:O+L}}function f(w){var _=e.map(e.range(g(w)+1),function(){return[]});return e.forEach(w.nodes(),function(A){var O=w.node(A),T=O.rank;e.isUndefined(T)||(_[T][O.order]=A)}),_}function d(w){var _=e.min(e.map(w.nodes(),function(A){return w.node(A).rank}));e.forEach(w.nodes(),function(A){var O=w.node(A);e.has(O,"rank")&&(O.rank-=_)})}function h(w){var _=e.min(e.map(w.nodes(),function(C){return w.node(C).rank})),A=[];e.forEach(w.nodes(),function(C){var N=w.node(C).rank-_;A[N]||(A[N]=[]),A[N].push(C)});var O=0,T=w.graph().nodeRankFactor;e.forEach(A,function(C,N){e.isUndefined(C)&&N%T!==0?--O:O&&e.forEach(C,function(M){w.node(M).rank+=O})})}function m(w,_,A,O){var T={width:0,height:0};return arguments.length>=4&&(T.rank=A,T.order=O),n(w,"border",T,_)}function g(w){return e.max(e.map(w.nodes(),function(_){var A=w.node(_).rank;if(!e.isUndefined(A))return A}))}function y(w,_){var A={lhs:[],rhs:[]};return e.forEach(w,function(O){_(O)?A.lhs.push(O):A.rhs.push(O)}),A}function x(w,_){var A=e.now();try{return _()}finally{console.log(w+" time: "+(e.now()-A)+"ms")}}function E(w,_){return _()}return Dw}var Lw,t6;function Bxe(){if(t6)return Lw;t6=1;var e=pt(),r=Nr();Lw={run:n,undo:i};function n(o){o.graph().dummyChains=[],e.forEach(o.edges(),function(u){a(o,u)})}function a(o,u){var c=u.v,f=o.node(c).rank,d=u.w,h=o.node(d).rank,m=u.name,g=o.edge(u),y=g.labelRank;if(h!==f+1){o.removeEdge(u);var x,E,w;for(w=0,++f;f<h;++w,++f)g.points=[],E={width:0,height:0,edgeLabel:g,edgeObj:u,rank:f},x=r.addDummyNode(o,"edge",E,"_d"),f===y&&(E.width=g.width,E.height=g.height,E.dummy="edge-label",E.labelpos=g.labelpos),o.setEdge(c,x,{weight:g.weight},m),w===0&&o.graph().dummyChains.push(x),c=x;o.setEdge(c,d,{weight:g.weight},m)}}function i(o){e.forEach(o.graph().dummyChains,function(u){var c=o.node(u),f=c.edgeLabel,d;for(o.setEdge(c.edgeObj,f);c.dummy;)d=o.successors(u)[0],o.removeNode(u),f.points.push({x:c.x,y:c.y}),c.dummy==="edge-label"&&(f.x=c.x,f.y=c.y,f.width=c.width,f.height=c.height),u=d,c=o.node(u)})}return Lw}var Iw,r6;function mp(){if(r6)return Iw;r6=1;var e=pt();Iw={longestPath:r,slack:n};function r(a){var i={};function o(u){var c=a.node(u);if(e.has(i,u))return c.rank;i[u]=!0;var f=e.min(e.map(a.outEdges(u),function(d){return o(d.w)-a.edge(d).minlen}));return(f===Number.POSITIVE_INFINITY||f===void 0||f===null)&&(f=0),c.rank=f}e.forEach(a.sources(),o)}function n(a,i){return a.node(i.w).rank-a.node(i.v).rank-a.edge(i).minlen}return Iw}var zw,n6;function mU(){if(n6)return zw;n6=1;var e=pt(),r=Rn().Graph,n=mp().slack;zw=a;function a(c){var f=new r({directed:!1}),d=c.nodes()[0],h=c.nodeCount();f.setNode(d,{});for(var m,g;i(f,c)<h;)m=o(f,c),g=f.hasNode(m.v)?n(c,m):-n(c,m),u(f,c,g);return f}function i(c,f){function d(h){e.forEach(f.nodeEdges(h),function(m){var g=m.v,y=h===g?m.w:g;!c.hasNode(y)&&!n(f,m)&&(c.setNode(y,{}),c.setEdge(h,y,{}),d(y))})}return e.forEach(c.nodes(),d),c.nodeCount()}function o(c,f){return e.minBy(f.edges(),function(d){if(c.hasNode(d.v)!==c.hasNode(d.w))return n(f,d)})}function u(c,f,d){e.forEach(c.nodes(),function(h){f.node(h).rank+=d})}return zw}var qw,a6;function $xe(){if(a6)return qw;a6=1;var e=pt(),r=mU(),n=mp().slack,a=mp().longestPath,i=Rn().alg.preorder,o=Rn().alg.postorder,u=Nr().simplify;qw=c,c.initLowLimValues=m,c.initCutValues=f,c.calcCutValue=h,c.leaveEdge=y,c.enterEdge=x,c.exchangeEdges=E;function c(O){O=u(O),a(O);var T=r(O);m(T),f(T,O);for(var C,N;C=y(T);)N=x(T,O,C),E(T,O,C,N)}function f(O,T){var C=o(O,O.nodes());C=C.slice(0,C.length-1),e.forEach(C,function(N){d(O,T,N)})}function d(O,T,C){var N=O.node(C),M=N.parent;O.edge(C,M).cutvalue=h(O,T,C)}function h(O,T,C){var N=O.node(C),M=N.parent,R=!0,L=T.edge(C,M),D=0;return L||(R=!1,L=T.edge(M,C)),D=L.weight,e.forEach(T.nodeEdges(C),function(z){var q=z.v===C,G=q?z.w:z.v;if(G!==M){var U=q===R,Y=T.edge(z).weight;if(D+=U?Y:-Y,_(O,C,G)){var $=O.edge(C,G).cutvalue;D+=U?-$:$}}}),D}function m(O,T){arguments.length<2&&(T=O.nodes()[0]),g(O,{},1,T)}function g(O,T,C,N,M){var R=C,L=O.node(N);return T[N]=!0,e.forEach(O.neighbors(N),function(D){e.has(T,D)||(C=g(O,T,C,D,N))}),L.low=R,L.lim=C++,M?L.parent=M:delete L.parent,C}function y(O){return e.find(O.edges(),function(T){return O.edge(T).cutvalue<0})}function x(O,T,C){var N=C.v,M=C.w;T.hasEdge(N,M)||(N=C.w,M=C.v);var R=O.node(N),L=O.node(M),D=R,z=!1;R.lim>L.lim&&(D=L,z=!0);var q=e.filter(T.edges(),function(G){return z===A(O,O.node(G.v),D)&&z!==A(O,O.node(G.w),D)});return e.minBy(q,function(G){return n(T,G)})}function E(O,T,C,N){var M=C.v,R=C.w;O.removeEdge(M,R),O.setEdge(N.v,N.w,{}),m(O),f(O,T),w(O,T)}function w(O,T){var C=e.find(O.nodes(),function(M){return!T.node(M).parent}),N=i(O,C);N=N.slice(1),e.forEach(N,function(M){var R=O.node(M).parent,L=T.edge(M,R),D=!1;L||(L=T.edge(R,M),D=!0),T.node(M).rank=T.node(R).rank+(D?L.minlen:-L.minlen)})}function _(O,T,C){return O.hasEdge(T,C)}function A(O,T,C){return C.low<=T.lim&&T.lim<=C.lim}return qw}var Bw,i6;function Uxe(){if(i6)return Bw;i6=1;var e=mp(),r=e.longestPath,n=mU(),a=$xe();Bw=i;function i(f){switch(f.graph().ranker){case"network-simplex":c(f);break;case"tight-tree":u(f);break;case"longest-path":o(f);break;default:c(f)}}var o=r;function u(f){r(f),n(f)}function c(f){a(f)}return Bw}var $w,o6;function Fxe(){if(o6)return $w;o6=1;var e=pt();$w=r;function r(i){var o=a(i);e.forEach(i.graph().dummyChains,function(u){for(var c=i.node(u),f=c.edgeObj,d=n(i,o,f.v,f.w),h=d.path,m=d.lca,g=0,y=h[g],x=!0;u!==f.w;){if(c=i.node(u),x){for(;(y=h[g])!==m&&i.node(y).maxRank<c.rank;)g++;y===m&&(x=!1)}if(!x){for(;g<h.length-1&&i.node(y=h[g+1]).minRank<=c.rank;)g++;y=h[g]}i.setParent(u,y),u=i.successors(u)[0]}})}function n(i,o,u,c){var f=[],d=[],h=Math.min(o[u].low,o[c].low),m=Math.max(o[u].lim,o[c].lim),g,y;g=u;do g=i.parent(g),f.push(g);while(g&&(o[g].low>h||m>o[g].lim));for(y=g,g=c;(g=i.parent(g))!==y;)d.push(g);return{path:f.concat(d.reverse()),lca:y}}function a(i){var o={},u=0;function c(f){var d=u;e.forEach(i.children(f),c),o[f]={low:d,lim:u++}}return e.forEach(i.children(),c),o}return $w}var Uw,l6;function Hxe(){if(l6)return Uw;l6=1;var e=pt(),r=Nr();Uw={run:n,cleanup:u};function n(c){var f=r.addDummyNode(c,"root",{},"_root"),d=i(c),h=e.max(e.values(d))-1,m=2*h+1;c.graph().nestingRoot=f,e.forEach(c.edges(),function(y){c.edge(y).minlen*=m});var g=o(c)+1;e.forEach(c.children(),function(y){a(c,f,m,g,h,d,y)}),c.graph().nodeRankFactor=m}function a(c,f,d,h,m,g,y){var x=c.children(y);if(!x.length){y!==f&&c.setEdge(f,y,{weight:0,minlen:d});return}var E=r.addBorderNode(c,"_bt"),w=r.addBorderNode(c,"_bb"),_=c.node(y);c.setParent(E,y),_.borderTop=E,c.setParent(w,y),_.borderBottom=w,e.forEach(x,function(A){a(c,f,d,h,m,g,A);var O=c.node(A),T=O.borderTop?O.borderTop:A,C=O.borderBottom?O.borderBottom:A,N=O.borderTop?h:2*h,M=T!==C?1:m-g[y]+1;c.setEdge(E,T,{weight:N,minlen:M,nestingEdge:!0}),c.setEdge(C,w,{weight:N,minlen:M,nestingEdge:!0})}),c.parent(y)||c.setEdge(f,E,{weight:0,minlen:m+g[y]})}function i(c){var f={};function d(h,m){var g=c.children(h);g&&g.length&&e.forEach(g,function(y){d(y,m+1)}),f[h]=m}return e.forEach(c.children(),function(h){d(h,1)}),f}function o(c){return e.reduce(c.edges(),function(f,d){return f+c.edge(d).weight},0)}function u(c){var f=c.graph();c.removeNode(f.nestingRoot),delete f.nestingRoot,e.forEach(c.edges(),function(d){var h=c.edge(d);h.nestingEdge&&c.removeEdge(d)})}return Uw}var Fw,u6;function Gxe(){if(u6)return Fw;u6=1;var e=pt(),r=Nr();Fw=n;function n(i){function o(u){var c=i.children(u),f=i.node(u);if(c.length&&e.forEach(c,o),e.has(f,"minRank")){f.borderLeft=[],f.borderRight=[];for(var d=f.minRank,h=f.maxRank+1;d<h;++d)a(i,"borderLeft","_bl",u,f,d),a(i,"borderRight","_br",u,f,d)}}e.forEach(i.children(),o)}function a(i,o,u,c,f,d){var h={width:0,height:0,rank:d,borderType:o},m=f[o][d-1],g=r.addDummyNode(i,"border",h,u);f[o][d]=g,i.setParent(g,c),m&&i.setEdge(m,g,{weight:1})}return Fw}var Hw,s6;function Kxe(){if(s6)return Hw;s6=1;var e=pt();Hw={adjust:r,undo:n};function r(d){var h=d.graph().rankdir.toLowerCase();(h==="lr"||h==="rl")&&a(d)}function n(d){var h=d.graph().rankdir.toLowerCase();(h==="bt"||h==="rl")&&o(d),(h==="lr"||h==="rl")&&(c(d),a(d))}function a(d){e.forEach(d.nodes(),function(h){i(d.node(h))}),e.forEach(d.edges(),function(h){i(d.edge(h))})}function i(d){var h=d.width;d.width=d.height,d.height=h}function o(d){e.forEach(d.nodes(),function(h){u(d.node(h))}),e.forEach(d.edges(),function(h){var m=d.edge(h);e.forEach(m.points,u),e.has(m,"y")&&u(m)})}function u(d){d.y=-d.y}function c(d){e.forEach(d.nodes(),function(h){f(d.node(h))}),e.forEach(d.edges(),function(h){var m=d.edge(h);e.forEach(m.points,f),e.has(m,"x")&&f(m)})}function f(d){var h=d.x;d.x=d.y,d.y=h}return Hw}var Gw,c6;function Vxe(){if(c6)return Gw;c6=1;var e=pt();Gw=r;function r(n){var a={},i=e.filter(n.nodes(),function(d){return!n.children(d).length}),o=e.max(e.map(i,function(d){return n.node(d).rank})),u=e.map(e.range(o+1),function(){return[]});function c(d){if(!e.has(a,d)){a[d]=!0;var h=n.node(d);u[h.rank].push(d),e.forEach(n.successors(d),c)}}var f=e.sortBy(i,function(d){return n.node(d).rank});return e.forEach(f,c),u}return Gw}var Kw,f6;function Yxe(){if(f6)return Kw;f6=1;var e=pt();Kw=r;function r(a,i){for(var o=0,u=1;u<i.length;++u)o+=n(a,i[u-1],i[u]);return o}function n(a,i,o){for(var u=e.zipObject(o,e.map(o,function(g,y){return y})),c=e.flatten(e.map(i,function(g){return e.sortBy(e.map(a.outEdges(g),function(y){return{pos:u[y.w],weight:a.edge(y).weight}}),"pos")}),!0),f=1;f<o.length;)f<<=1;var d=2*f-1;f-=1;var h=e.map(new Array(d),function(){return 0}),m=0;return e.forEach(c.forEach(function(g){var y=g.pos+f;h[y]+=g.weight;for(var x=0;y>0;)y%2&&(x+=h[y+1]),y=y-1>>1,h[y]+=g.weight;m+=g.weight*x})),m}return Kw}var Vw,d6;function Xxe(){if(d6)return Vw;d6=1;var e=pt();Vw=r;function r(n,a){return e.map(a,function(i){var o=n.inEdges(i);if(o.length){var u=e.reduce(o,function(c,f){var d=n.edge(f),h=n.node(f.v);return{sum:c.sum+d.weight*h.order,weight:c.weight+d.weight}},{sum:0,weight:0});return{v:i,barycenter:u.sum/u.weight,weight:u.weight}}else return{v:i}})}return Vw}var Yw,h6;function Wxe(){if(h6)return Yw;h6=1;var e=pt();Yw=r;function r(i,o){var u={};e.forEach(i,function(f,d){var h=u[f.v]={indegree:0,in:[],out:[],vs:[f.v],i:d};e.isUndefined(f.barycenter)||(h.barycenter=f.barycenter,h.weight=f.weight)}),e.forEach(o.edges(),function(f){var d=u[f.v],h=u[f.w];!e.isUndefined(d)&&!e.isUndefined(h)&&(h.indegree++,d.out.push(u[f.w]))});var c=e.filter(u,function(f){return!f.indegree});return n(c)}function n(i){var o=[];function u(d){return function(h){h.merged||(e.isUndefined(h.barycenter)||e.isUndefined(d.barycenter)||h.barycenter>=d.barycenter)&&a(d,h)}}function c(d){return function(h){h.in.push(d),--h.indegree===0&&i.push(h)}}for(;i.length;){var f=i.pop();o.push(f),e.forEach(f.in.reverse(),u(f)),e.forEach(f.out,c(f))}return e.map(e.filter(o,function(d){return!d.merged}),function(d){return e.pick(d,["vs","i","barycenter","weight"])})}function a(i,o){var u=0,c=0;i.weight&&(u+=i.barycenter*i.weight,c+=i.weight),o.weight&&(u+=o.barycenter*o.weight,c+=o.weight),i.vs=o.vs.concat(i.vs),i.barycenter=u/c,i.weight=c,i.i=Math.min(o.i,i.i),o.merged=!0}return Yw}var Xw,p6;function Zxe(){if(p6)return Xw;p6=1;var e=pt(),r=Nr();Xw=n;function n(o,u){var c=r.partition(o,function(E){return e.has(E,"barycenter")}),f=c.lhs,d=e.sortBy(c.rhs,function(E){return-E.i}),h=[],m=0,g=0,y=0;f.sort(i(!!u)),y=a(h,d,y),e.forEach(f,function(E){y+=E.vs.length,h.push(E.vs),m+=E.barycenter*E.weight,g+=E.weight,y=a(h,d,y)});var x={vs:e.flatten(h,!0)};return g&&(x.barycenter=m/g,x.weight=g),x}function a(o,u,c){for(var f;u.length&&(f=e.last(u)).i<=c;)u.pop(),o.push(f.vs),c++;return c}function i(o){return function(u,c){return u.barycenter<c.barycenter?-1:u.barycenter>c.barycenter?1:o?c.i-u.i:u.i-c.i}}return Xw}var Ww,m6;function Qxe(){if(m6)return Ww;m6=1;var e=pt(),r=Xxe(),n=Wxe(),a=Zxe();Ww=i;function i(c,f,d,h){var m=c.children(f),g=c.node(f),y=g?g.borderLeft:void 0,x=g?g.borderRight:void 0,E={};y&&(m=e.filter(m,function(C){return C!==y&&C!==x}));var w=r(c,m);e.forEach(w,function(C){if(c.children(C.v).length){var N=i(c,C.v,d,h);E[C.v]=N,e.has(N,"barycenter")&&u(C,N)}});var _=n(w,d);o(_,E);var A=a(_,h);if(y&&(A.vs=e.flatten([y,A.vs,x],!0),c.predecessors(y).length)){var O=c.node(c.predecessors(y)[0]),T=c.node(c.predecessors(x)[0]);e.has(A,"barycenter")||(A.barycenter=0,A.weight=0),A.barycenter=(A.barycenter*A.weight+O.order+T.order)/(A.weight+2),A.weight+=2}return A}function o(c,f){e.forEach(c,function(d){d.vs=e.flatten(d.vs.map(function(h){return f[h]?f[h].vs:h}),!0)})}function u(c,f){e.isUndefined(c.barycenter)?(c.barycenter=f.barycenter,c.weight=f.weight):(c.barycenter=(c.barycenter*c.weight+f.barycenter*f.weight)/(c.weight+f.weight),c.weight+=f.weight)}return Ww}var Zw,v6;function Jxe(){if(v6)return Zw;v6=1;var e=pt(),r=Rn().Graph;Zw=n;function n(i,o,u){var c=a(i),f=new r({compound:!0}).setGraph({root:c}).setDefaultNodeLabel(function(d){return i.node(d)});return e.forEach(i.nodes(),function(d){var h=i.node(d),m=i.parent(d);(h.rank===o||h.minRank<=o&&o<=h.maxRank)&&(f.setNode(d),f.setParent(d,m||c),e.forEach(i[u](d),function(g){var y=g.v===d?g.w:g.v,x=f.edge(y,d),E=e.isUndefined(x)?0:x.weight;f.setEdge(y,d,{weight:i.edge(g).weight+E})}),e.has(h,"minRank")&&f.setNode(d,{borderLeft:h.borderLeft[o],borderRight:h.borderRight[o]}))}),f}function a(i){for(var o;i.hasNode(o=e.uniqueId("_root")););return o}return Zw}var Qw,g6;function e_e(){if(g6)return Qw;g6=1;var e=pt();Qw=r;function r(n,a,i){var o={},u;e.forEach(i,function(c){for(var f=n.parent(c),d,h;f;){if(d=n.parent(f),d?(h=o[d],o[d]=f):(h=u,u=f),h&&h!==f){a.setEdge(h,f);return}f=d}})}return Qw}var Jw,y6;function t_e(){if(y6)return Jw;y6=1;var e=pt(),r=Vxe(),n=Yxe(),a=Qxe(),i=Jxe(),o=e_e(),u=Rn().Graph,c=Nr();Jw=f;function f(g){var y=c.maxRank(g),x=d(g,e.range(1,y+1),"inEdges"),E=d(g,e.range(y-1,-1,-1),"outEdges"),w=r(g);m(g,w);for(var _=Number.POSITIVE_INFINITY,A,O=0,T=0;T<4;++O,++T){h(O%2?x:E,O%4>=2),w=c.buildLayerMatrix(g);var C=n(g,w);C<_&&(T=0,A=e.cloneDeep(w),_=C)}m(g,A)}function d(g,y,x){return e.map(y,function(E){return i(g,E,x)})}function h(g,y){var x=new u;e.forEach(g,function(E){var w=E.graph().root,_=a(E,w,x,y);e.forEach(_.vs,function(A,O){E.node(A).order=O}),o(E,x,_.vs)})}function m(g,y){e.forEach(y,function(x){e.forEach(x,function(E,w){g.node(E).order=w})})}return Jw}var e2,b6;function r_e(){if(b6)return e2;b6=1;var e=pt(),r=Rn().Graph,n=Nr();e2={positionX:x,findType1Conflicts:a,findType2Conflicts:i,addConflict:u,hasConflict:c,verticalAlignment:f,horizontalCompaction:d,alignCoordinates:g,findSmallestWidthAlignment:m,balance:y};function a(_,A){var O={};function T(C,N){var M=0,R=0,L=C.length,D=e.last(N);return e.forEach(N,function(z,q){var G=o(_,z),U=G?_.node(G).order:L;(G||z===D)&&(e.forEach(N.slice(R,q+1),function(Y){e.forEach(_.predecessors(Y),function($){var J=_.node($),re=J.order;(re<M||U<re)&&!(J.dummy&&_.node(Y).dummy)&&u(O,$,Y)})}),R=q+1,M=U)}),N}return e.reduce(A,T),O}function i(_,A){var O={};function T(N,M,R,L,D){var z;e.forEach(e.range(M,R),function(q){z=N[q],_.node(z).dummy&&e.forEach(_.predecessors(z),function(G){var U=_.node(G);U.dummy&&(U.order<L||U.order>D)&&u(O,G,z)})})}function C(N,M){var R=-1,L,D=0;return e.forEach(M,function(z,q){if(_.node(z).dummy==="border"){var G=_.predecessors(z);G.length&&(L=_.node(G[0]).order,T(M,D,q,R,L),D=q,R=L)}T(M,D,M.length,L,N.length)}),M}return e.reduce(A,C),O}function o(_,A){if(_.node(A).dummy)return e.find(_.predecessors(A),function(O){return _.node(O).dummy})}function u(_,A,O){if(A>O){var T=A;A=O,O=T}var C=_[A];C||(_[A]=C={}),C[O]=!0}function c(_,A,O){if(A>O){var T=A;A=O,O=T}return e.has(_[A],O)}function f(_,A,O,T){var C={},N={},M={};return e.forEach(A,function(R){e.forEach(R,function(L,D){C[L]=L,N[L]=L,M[L]=D})}),e.forEach(A,function(R){var L=-1;e.forEach(R,function(D){var z=T(D);if(z.length){z=e.sortBy(z,function($){return M[$]});for(var q=(z.length-1)/2,G=Math.floor(q),U=Math.ceil(q);G<=U;++G){var Y=z[G];N[D]===D&&L<M[Y]&&!c(O,D,Y)&&(N[Y]=D,N[D]=C[D]=C[Y],L=M[Y])}}})}),{root:C,align:N}}function d(_,A,O,T,C){var N={},M=h(_,A,O,C),R=C?"borderLeft":"borderRight";function L(q,G){for(var U=M.nodes(),Y=U.pop(),$={};Y;)$[Y]?q(Y):($[Y]=!0,U.push(Y),U=U.concat(G(Y))),Y=U.pop()}function D(q){N[q]=M.inEdges(q).reduce(function(G,U){return Math.max(G,N[U.v]+M.edge(U))},0)}function z(q){var G=M.outEdges(q).reduce(function(Y,$){return Math.min(Y,N[$.w]-M.edge($))},Number.POSITIVE_INFINITY),U=_.node(q);G!==Number.POSITIVE_INFINITY&&U.borderType!==R&&(N[q]=Math.max(N[q],G))}return L(D,M.predecessors.bind(M)),L(z,M.successors.bind(M)),e.forEach(T,function(q){N[q]=N[O[q]]}),N}function h(_,A,O,T){var C=new r,N=_.graph(),M=E(N.nodesep,N.edgesep,T);return e.forEach(A,function(R){var L;e.forEach(R,function(D){var z=O[D];if(C.setNode(z),L){var q=O[L],G=C.edge(q,z);C.setEdge(q,z,Math.max(M(_,D,L),G||0))}L=D})}),C}function m(_,A){return e.minBy(e.values(A),function(O){var T=Number.NEGATIVE_INFINITY,C=Number.POSITIVE_INFINITY;return e.forIn(O,function(N,M){var R=w(_,M)/2;T=Math.max(N+R,T),C=Math.min(N-R,C)}),T-C})}function g(_,A){var O=e.values(A),T=e.min(O),C=e.max(O);e.forEach(["u","d"],function(N){e.forEach(["l","r"],function(M){var R=N+M,L=_[R],D;if(L!==A){var z=e.values(L);D=M==="l"?T-e.min(z):C-e.max(z),D&&(_[R]=e.mapValues(L,function(q){return q+D}))}})})}function y(_,A){return e.mapValues(_.ul,function(O,T){if(A)return _[A.toLowerCase()][T];var C=e.sortBy(e.map(_,T));return(C[1]+C[2])/2})}function x(_){var A=n.buildLayerMatrix(_),O=e.merge(a(_,A),i(_,A)),T={},C;e.forEach(["u","d"],function(M){C=M==="u"?A:e.values(A).reverse(),e.forEach(["l","r"],function(R){R==="r"&&(C=e.map(C,function(q){return e.values(q).reverse()}));var L=(M==="u"?_.predecessors:_.successors).bind(_),D=f(_,C,O,L),z=d(_,C,D.root,D.align,R==="r");R==="r"&&(z=e.mapValues(z,function(q){return-q})),T[M+R]=z})});var N=m(_,T);return g(T,N),y(T,_.graph().align)}function E(_,A,O){return function(T,C,N){var M=T.node(C),R=T.node(N),L=0,D;if(L+=M.width/2,e.has(M,"labelpos"))switch(M.labelpos.toLowerCase()){case"l":D=-M.width/2;break;case"r":D=M.width/2;break}if(D&&(L+=O?D:-D),D=0,L+=(M.dummy?A:_)/2,L+=(R.dummy?A:_)/2,L+=R.width/2,e.has(R,"labelpos"))switch(R.labelpos.toLowerCase()){case"l":D=R.width/2;break;case"r":D=-R.width/2;break}return D&&(L+=O?D:-D),D=0,L}}function w(_,A){return _.node(A).width}return e2}var t2,x6;function n_e(){if(x6)return t2;x6=1;var e=pt(),r=Nr(),n=r_e().positionX;t2=a;function a(o){o=r.asNonCompoundGraph(o),i(o),e.forEach(n(o),function(u,c){o.node(c).x=u})}function i(o){var u=r.buildLayerMatrix(o),c=o.graph().ranksep,f=0;e.forEach(u,function(d){var h=e.max(e.map(d,function(m){return o.node(m).height}));e.forEach(d,function(m){o.node(m).y=f+h/2}),f+=h+c})}return t2}var r2,_6;function a_e(){if(_6)return r2;_6=1;var e=pt(),r=qxe(),n=Bxe(),a=Uxe(),i=Nr().normalizeRanks,o=Fxe(),u=Nr().removeEmptyRanks,c=Hxe(),f=Gxe(),d=Kxe(),h=t_e(),m=n_e(),g=Nr(),y=Rn().Graph;r2=x;function x(B,H){var te=H&&H.debugTiming?g.time:g.notime;te("layout",function(){var he=te(" buildLayoutGraph",function(){return L(B)});te(" runLayout",function(){E(he,te)}),te(" updateInputGraph",function(){w(B,he)})})}function E(B,H){H(" makeSpaceForEdgeLabels",function(){D(B)}),H(" removeSelfEdges",function(){oe(B)}),H(" acyclic",function(){r.run(B)}),H(" nestingGraph.run",function(){c.run(B)}),H(" rank",function(){a(g.asNonCompoundGraph(B))}),H(" injectEdgeLabelProxies",function(){z(B)}),H(" removeEmptyRanks",function(){u(B)}),H(" nestingGraph.cleanup",function(){c.cleanup(B)}),H(" normalizeRanks",function(){i(B)}),H(" assignRankMinMax",function(){q(B)}),H(" removeEdgeLabelProxies",function(){G(B)}),H(" normalize.run",function(){n.run(B)}),H(" parentDummyChains",function(){o(B)}),H(" addBorderSegments",function(){f(B)}),H(" order",function(){h(B)}),H(" insertSelfEdges",function(){fe(B)}),H(" adjustCoordinateSystem",function(){d.adjust(B)}),H(" position",function(){m(B)}),H(" positionSelfEdges",function(){F(B)}),H(" removeBorderNodes",function(){re(B)}),H(" normalize.undo",function(){n.undo(B)}),H(" fixupEdgeLabelCoords",function(){$(B)}),H(" undoCoordinateSystem",function(){d.undo(B)}),H(" translateGraph",function(){U(B)}),H(" assignNodeIntersects",function(){Y(B)}),H(" reversePoints",function(){J(B)}),H(" acyclic.undo",function(){r.undo(B)})}function w(B,H){e.forEach(B.nodes(),function(te){var he=B.node(te),ge=H.node(te);he&&(he.x=ge.x,he.y=ge.y,H.children(te).length&&(he.width=ge.width,he.height=ge.height))}),e.forEach(B.edges(),function(te){var he=B.edge(te),ge=H.edge(te);he.points=ge.points,e.has(ge,"x")&&(he.x=ge.x,he.y=ge.y)}),B.graph().width=H.graph().width,B.graph().height=H.graph().height}var _=["nodesep","edgesep","ranksep","marginx","marginy"],A={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},O=["acyclicer","ranker","rankdir","align"],T=["width","height"],C={width:0,height:0},N=["minlen","weight","width","height","labeloffset"],M={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},R=["labelpos"];function L(B){var H=new y({multigraph:!0,compound:!0}),te=ce(B.graph());return H.setGraph(e.merge({},A,Z(te,_),e.pick(te,O))),e.forEach(B.nodes(),function(he){var ge=ce(B.node(he));H.setNode(he,e.defaults(Z(ge,T),C)),H.setParent(he,B.parent(he))}),e.forEach(B.edges(),function(he){var ge=ce(B.edge(he));H.setEdge(he,e.merge({},M,Z(ge,N),e.pick(ge,R)))}),H}function D(B){var H=B.graph();H.ranksep/=2,e.forEach(B.edges(),function(te){var he=B.edge(te);he.minlen*=2,he.labelpos.toLowerCase()!=="c"&&(H.rankdir==="TB"||H.rankdir==="BT"?he.width+=he.labeloffset:he.height+=he.labeloffset)})}function z(B){e.forEach(B.edges(),function(H){var te=B.edge(H);if(te.width&&te.height){var he=B.node(H.v),ge=B.node(H.w),W={rank:(ge.rank-he.rank)/2+he.rank,e:H};g.addDummyNode(B,"edge-proxy",W,"_ep")}})}function q(B){var H=0;e.forEach(B.nodes(),function(te){var he=B.node(te);he.borderTop&&(he.minRank=B.node(he.borderTop).rank,he.maxRank=B.node(he.borderBottom).rank,H=e.max(H,he.maxRank))}),B.graph().maxRank=H}function G(B){e.forEach(B.nodes(),function(H){var te=B.node(H);te.dummy==="edge-proxy"&&(B.edge(te.e).labelRank=te.rank,B.removeNode(H))})}function U(B){var H=Number.POSITIVE_INFINITY,te=0,he=Number.POSITIVE_INFINITY,ge=0,W=B.graph(),le=W.marginx||0,ye=W.marginy||0;function K(be){var ve=be.x,_e=be.y,$e=be.width,Te=be.height;H=Math.min(H,ve-$e/2),te=Math.max(te,ve+$e/2),he=Math.min(he,_e-Te/2),ge=Math.max(ge,_e+Te/2)}e.forEach(B.nodes(),function(be){K(B.node(be))}),e.forEach(B.edges(),function(be){var ve=B.edge(be);e.has(ve,"x")&&K(ve)}),H-=le,he-=ye,e.forEach(B.nodes(),function(be){var ve=B.node(be);ve.x-=H,ve.y-=he}),e.forEach(B.edges(),function(be){var ve=B.edge(be);e.forEach(ve.points,function(_e){_e.x-=H,_e.y-=he}),e.has(ve,"x")&&(ve.x-=H),e.has(ve,"y")&&(ve.y-=he)}),W.width=te-H+le,W.height=ge-he+ye}function Y(B){e.forEach(B.edges(),function(H){var te=B.edge(H),he=B.node(H.v),ge=B.node(H.w),W,le;te.points?(W=te.points[0],le=te.points[te.points.length-1]):(te.points=[],W=ge,le=he),te.points.unshift(g.intersectRect(he,W)),te.points.push(g.intersectRect(ge,le))})}function $(B){e.forEach(B.edges(),function(H){var te=B.edge(H);if(e.has(te,"x"))switch((te.labelpos==="l"||te.labelpos==="r")&&(te.width-=te.labeloffset),te.labelpos){case"l":te.x-=te.width/2+te.labeloffset;break;case"r":te.x+=te.width/2+te.labeloffset;break}})}function J(B){e.forEach(B.edges(),function(H){var te=B.edge(H);te.reversed&&te.points.reverse()})}function re(B){e.forEach(B.nodes(),function(H){if(B.children(H).length){var te=B.node(H),he=B.node(te.borderTop),ge=B.node(te.borderBottom),W=B.node(e.last(te.borderLeft)),le=B.node(e.last(te.borderRight));te.width=Math.abs(le.x-W.x),te.height=Math.abs(ge.y-he.y),te.x=W.x+te.width/2,te.y=he.y+te.height/2}}),e.forEach(B.nodes(),function(H){B.node(H).dummy==="border"&&B.removeNode(H)})}function oe(B){e.forEach(B.edges(),function(H){if(H.v===H.w){var te=B.node(H.v);te.selfEdges||(te.selfEdges=[]),te.selfEdges.push({e:H,label:B.edge(H)}),B.removeEdge(H)}})}function fe(B){var H=g.buildLayerMatrix(B);e.forEach(H,function(te){var he=0;e.forEach(te,function(ge,W){var le=B.node(ge);le.order=W+he,e.forEach(le.selfEdges,function(ye){g.addDummyNode(B,"selfedge",{width:ye.label.width,height:ye.label.height,rank:le.rank,order:W+ ++he,e:ye.e,label:ye.label},"_se")}),delete le.selfEdges})})}function F(B){e.forEach(B.nodes(),function(H){var te=B.node(H);if(te.dummy==="selfedge"){var he=B.node(te.e.v),ge=he.x+he.width/2,W=he.y,le=te.x-ge,ye=he.height/2;B.setEdge(te.e,te.label),B.removeNode(H),te.label.points=[{x:ge+2*le/3,y:W-ye},{x:ge+5*le/6,y:W-ye},{x:ge+le,y:W},{x:ge+5*le/6,y:W+ye},{x:ge+2*le/3,y:W+ye}],te.label.x=te.x,te.label.y=te.y}})}function Z(B,H){return e.mapValues(e.pick(B,H),Number)}function ce(B){var H={};return e.forEach(B,function(te,he){H[he.toLowerCase()]=te}),H}return r2}var n2,w6;function i_e(){if(w6)return n2;w6=1;var e=pt(),r=Nr(),n=Rn().Graph;n2={debugOrdering:a};function a(i){var o=r.buildLayerMatrix(i),u=new n({compound:!0,multigraph:!0}).setGraph({});return e.forEach(i.nodes(),function(c){u.setNode(c,{label:c}),u.setParent(c,"layer"+i.node(c).rank)}),e.forEach(i.edges(),function(c){u.setEdge(c.v,c.w,{},c.name)}),e.forEach(o,function(c,f){var d="layer"+f;u.setNode(d,{rank:"same"}),e.reduce(c,function(h,m){return u.setEdge(h,m,{style:"invis"}),m})}),u}return n2}var a2,S6;function o_e(){return S6||(S6=1,a2="0.8.5"),a2}var i2,E6;function l_e(){return E6||(E6=1,i2={graphlib:Rn(),layout:a_e(),debug:i_e(),util:{time:Nr().time,notime:Nr().notime},version:o_e()}),i2}var u_e=l_e();const k6=Dn(u_e),s_e=[{id:"ci_green",eventName:"CI Passed",description:"When CI checks pass on a PR"},{id:"ci_red",eventName:"CI Failed",description:"When CI checks fail on a PR"},{id:"pr_merged",eventName:"PR Merged",description:"When a PR is merged"},{id:"ci_blocked",eventName:"CI Blocked",description:"When CI failure count exceeds threshold"},{id:"stuck_nudge",eventName:"Stuck Nudge",description:"When a team has been idle too long"},{id:"nudge_progress",eventName:"Nudge Progress",description:"Ask TL for a status update"},{id:"ask_for_pr",eventName:"Ask for PR",description:"Request TL to open a pull request"},{id:"check_ci",eventName:"Check CI",description:"Tell TL to fix failing CI"},{id:"wrap_up",eventName:"Wrap Up",description:"Tell TL to finish and push"}],c_e=130,f_e=50;function kS({trigger:e,size:r=14,className:n}){switch(e){case"hook":return b.jsx(BK,{size:r,className:n});case"timer":return b.jsx(UK,{size:r,className:n});case"poller":return b.jsx(zK,{size:r,className:n});case"pm_action":return b.jsx($K,{size:r,className:n});case"system":return b.jsx(RS,{size:r,className:n});default:return null}}function d_e(e,r,n,a,i,o){const u=a/24,c=r-a/2,f=n-a/2,d={fill:"none",stroke:i,strokeWidth:2/u,strokeLinecap:"round",strokeLinejoin:"round",opacity:o};switch(e){case"hook":return b.jsx("g",{transform:`translate(${c},${f}) scale(${u})`,...d,children:b.jsx("path",{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z"})});case"timer":return b.jsxs("g",{transform:`translate(${c},${f}) scale(${u})`,...d,children:[b.jsx("circle",{cx:"12",cy:"12",r:"10"}),b.jsx("polyline",{points:"12 6 12 12 16 14"})]});case"poller":return b.jsxs("g",{transform:`translate(${c},${f}) scale(${u})`,...d,children:[b.jsx("path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}),b.jsx("path",{d:"M21 3v5h-5"}),b.jsx("path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}),b.jsx("path",{d:"M8 16H3v5"})]});case"pm_action":return b.jsxs("g",{transform:`translate(${c},${f}) scale(${u})`,...d,children:[b.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),b.jsx("circle",{cx:"12",cy:"7",r:"4"})]});case"system":return b.jsxs("g",{transform:`translate(${c},${f}) scale(${u})`,...d,children:[b.jsx("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),b.jsx("circle",{cx:"12",cy:"12",r:"3"})]});default:return null}}const h_e={hook:"Hook event",timer:"Timer (stuck detector)",poller:"Poller (GitHub)",pm_action:"PM action (API call)",system:"System (queue, recovery)"};function p_e(e,r){const n=e.map(h=>h.id),a=r.flatMap(h=>h.from==="*"?n.map(m=>({...h,from:m,id:`${h.id}-${m}`})):[h]),i=new Map;for(const h of a){const m=`${h.from}|${h.trigger}|${h.to}`,g=i.get(m);if(!g)i.set(m,h);else{const y=g.id.includes(`-${g.from}`),x=h.id.includes(`-${h.from}`);y&&!x&&i.set(m,h)}}const o=[...i.values()],u=h=>`${h.trigger}|${h.to}`,c=new Map;for(const h of o){const m=u(h);c.has(m)||c.set(m,[]),c.get(m).push(h)}const f=[];for(const[,h]of c){const m=new Set(h.map(y=>y.from));if(n.every(y=>m.has(y))&&h.length>=n.length){const y=h[0],x=y.id.replace(/-[^-]+$/,"");f.push({...y,from:"*",id:x})}else f.push(...h)}const d=[...f].sort((h,m)=>h.from==="*"&&m.from!=="*"?-1:h.from!=="*"&&m.from==="*"?1:h.from<m.from?-1:h.from>m.from?1:h.to<m.to?-1:h.to>m.to?1:0);return{transitions:f,tableTransitions:d}}function m_e(e,r){const n=[],a=e.map(d=>d.id),i=new Map;for(const d of r){if(d.from==="*")continue;const h=`${d.id}|${d.from}|${d.to}|${d.trigger}`;i.has(h)||i.set(h,[]),i.get(h).push(d)}for(const[,d]of i)if(d.length>1){const h=d.map(m=>m.id).join(", ");n.push({type:"duplicate",message:`Duplicate transition: ${d[0].from} -> ${d[0].to} (${d[0].trigger}) defined ${d.length} times [${h}]`})}const o=new Set,u=new Set;for(const d of r)d.from==="*"?a.forEach(h=>o.add(h)):o.add(d.from),u.add(d.to);const c=new Set(["done","failed"]);for(const d of a)!o.has(d)&&!c.has(d)&&n.push({type:"orphan",message:`Orphan state: "${d}" has no outgoing transitions`});const f=new Set(["queued"]);for(const d of a)!u.has(d)&&!f.has(d)&&n.push({type:"unreachable",message:`Unreachable state: "${d}" has no incoming transitions`});return n}const v_e=70,g_e=30;function y_e(e,r){const n=new k6.graphlib.Graph({multigraph:!0});n.setGraph({rankdir:"LR",nodesep:60,ranksep:120,marginx:40,marginy:40}),n.setDefaultEdgeLabel(()=>({}));const a=new Set(e.map(m=>m.id));for(const m of e)n.setNode(m.id,{label:m.id,width:c_e,height:f_e});r.some(m=>m.from==="*")&&n.setNode("*",{label:"All",width:v_e,height:g_e});const o=new Map;for(const m of r){const g=m.from==="*"?"*":m.from;if(g!=="*"&&!a.has(g)||!a.has(m.to))continue;const y=`${g}->${m.to}|${m.trigger}`;o.has(y)||o.set(y,[]),o.get(y).push(m)}o.forEach((m,g)=>{const[y,x]=g.split("|"),[E,w]=y.split("->");n.setEdge(E,w,{},x)}),k6.layout(n);const u=n.nodes().map(m=>{const g=n.node(m);return{id:m,x:g.x,y:g.y,width:g.width,height:g.height}}),c=n.edges().map(m=>{const g=n.edge(m),y=`${m.v}->${m.w}|${m.name}`;return{from:m.v,to:m.w,trigger:m.name||"",points:g.points||[],transitions:o.get(y)||[]}}),f=n.graph(),d=(f.width||800)+80,h=(f.height||400)+80;return{nodes:u,edges:c,width:d,height:h}}function b_e({info:e,stateColorMap:r,onClose:n}){const a=k.useRef(null);return k.useEffect(()=>{const o=setTimeout(n,5e3);return()=>clearTimeout(o)},[n]),k.useEffect(()=>{function o(u){a.current&&!a.current.contains(u.target)&&n()}return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[n]),e.transitions[0]?b.jsx("div",{ref:a,className:"absolute z-50 bg-[#161B22] border border-[#30363D] rounded-lg shadow-xl p-3 min-w-[240px] max-w-[340px]",style:{left:e.x,top:e.y,transform:"translate(-50%, -100%) translateY(-8px)"},children:e.transitions.map((o,u)=>b.jsxs("div",{className:u>0?"mt-3 pt-3 border-t border-[#30363D]":"",children:[b.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[b.jsx("span",{className:"px-2 py-0.5 rounded-full text-xs font-semibold",style:{backgroundColor:`${r[o.from]||"#8B949E"}20`,color:r[o.from]||"#8B949E",border:`1px solid ${r[o.from]||"#8B949E"}40`},children:o.from==="*"?"All":o.from}),b.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#8B949E",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("path",{d:"M5 12h14"}),b.jsx("path",{d:"m12 5 7 7-7 7"})]}),b.jsx("span",{className:"px-2 py-0.5 rounded-full text-xs font-semibold",style:{backgroundColor:`${r[o.to]||"#8B949E"}20`,color:r[o.to]||"#8B949E",border:`1px solid ${r[o.to]||"#8B949E"}40`},children:o.to})]}),b.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-dark-text mb-1",children:[b.jsx(kS,{trigger:o.trigger,size:12,className:"text-[#8B949E]"}),b.jsx("span",{className:"font-medium",children:o.triggerLabel})]}),b.jsx("p",{className:"text-xs text-dark-muted mb-1",children:o.description}),b.jsx("p",{className:"text-xs font-mono text-dark-muted bg-[#0D1117] px-1.5 py-0.5 rounded",children:o.condition})]},o.id))}):null}function x_e({cardDef:e,templateData:r,onSave:n}){const[a,i]=k.useState((r==null?void 0:r.template)??""),[o,u]=k.useState((r==null?void 0:r.enabled)??!0),[c,f]=k.useState(!1),[d,h]=k.useState(null);k.useEffect(()=>{r&&(i(r.template),u(r.enabled))},[r]);const m=k.useCallback(async()=>{f(!0),h(null);try{await n(e.id,a,o),h("Saved successfully")}catch(y){h(y instanceof Error?y.message:"Failed to save")}finally{f(!1)}},[e.id,a,o,n]),g=(r==null?void 0:r.placeholders)??[];return b.jsxs("div",{className:"bg-[#161B22] border border-[#30363D] rounded-lg p-4",children:[b.jsxs("div",{className:"flex items-start justify-between mb-2",children:[b.jsxs("div",{children:[b.jsx("h3",{className:"text-sm font-semibold text-dark-text",children:e.eventName}),b.jsx("p",{className:"text-xs text-dark-muted mt-0.5",children:e.description}),b.jsxs("p",{className:"text-[10px] text-dark-muted font-mono mt-0.5",children:["(",e.id,")"]})]}),b.jsx("button",{type:"button",role:"switch","aria-checked":o,"aria-label":`Toggle ${e.eventName} message`,onClick:()=>u(!o),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors shrink-0 mt-0.5 ${o?"bg-[#3FB950]":"bg-[#30363D]"}`,children:b.jsx("span",{className:`inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform ${o?"translate-x-[18px]":"translate-x-[3px]"}`})})]}),b.jsx("textarea",{value:a,onChange:y=>{i(y.target.value),h(null)},rows:3,className:`w-full text-sm font-mono rounded px-3 py-2 resize-y bg-[#0D1117] border ${o?"border-[#30363D] text-dark-text":"border-[#30363D] text-dark-muted opacity-60"} focus:outline-none focus:ring-1 focus:ring-[#58A6FF]/50`}),g.length>0&&b.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:g.map(y=>b.jsx("code",{className:"text-[11px] font-mono px-1.5 py-0.5 rounded bg-[#30363D] text-[#58A6FF]",children:`{{${y}}}`},y))}),b.jsxs("div",{className:"flex items-center gap-3 mt-3",children:[b.jsx("button",{type:"button",onClick:m,disabled:c,className:"px-3 py-1 text-xs font-medium rounded border border-[#58A6FF]/50 text-[#58A6FF] hover:bg-[#58A6FF]/10 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:c?"Saving...":"Save"}),d&&b.jsx("span",{className:`text-xs ${d.includes("success")?"text-[#3FB950]":"text-[#F85149]"}`,children:d})]})]})}function __e(){const e=Ut(),[r,n]=k.useState("diagram"),[a,i]=k.useState(null),[o,u]=k.useState(!0),[c,f]=k.useState(null),[d,h]=k.useState([]),[m,g]=k.useState(null),[y,x]=k.useState(null),E=k.useRef(null),w=k.useCallback(async()=>{try{const D=await e.get("state-machine");i(D),f(null)}catch(D){f(D instanceof Error?D.message:String(D))}finally{u(!1)}},[e]),_=k.useCallback(async()=>{try{const D=await e.get("message-templates");h(D)}catch{}},[e]);k.useEffect(()=>{w(),_()},[w,_]);const A=k.useMemo(()=>a?p_e(a.states,a.transitions):null,[a]),O=k.useMemo(()=>a?m_e(a.states,a.transitions):[],[a]),T=k.useMemo(()=>!a||!A?null:y_e(a.states,A.transitions),[a,A]),C=k.useMemo(()=>{if(!a)return{};const D={"*":"#8B949E"};for(const z of a.states)D[z.id]=z.color;return D},[a]),N=k.useMemo(()=>{const D=new Map;for(const z of d)D.set(z.id,z);return D},[d]),M=k.useCallback((D,z)=>{if(!E.current)return;const q=E.current.getBoundingClientRect();x({transitions:z,x:D.clientX-q.left,y:D.clientY-q.top})},[]),R=k.useCallback(()=>x(null),[]),L=k.useCallback(async(D,z,q)=>{await e.put(`message-templates/${D}`,{template:z,enabled:q}),await _()},[e,_]);return o?b.jsx("div",{className:"flex items-center justify-center h-full",children:b.jsx("p",{className:"text-dark-muted text-sm",children:"Loading state machine..."})}):c?b.jsx("div",{className:"flex items-center justify-center h-full",children:b.jsxs("div",{className:"text-center",children:[b.jsx("p",{className:"text-[#F85149] text-sm mb-2",children:"Failed to load state machine"}),b.jsx("p",{className:"text-dark-muted text-xs",children:c})]})}):!a||!T?null:b.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[b.jsxs("div",{className:"px-6 py-4 border-b border-dark-border shrink-0",children:[b.jsx("h1",{className:"text-xl font-semibold text-dark-text",children:"Lifecycle"}),b.jsx("p",{className:"text-dark-muted text-sm mt-1",children:"Team lifecycle transitions and PM message templates"})]}),b.jsxs("div",{className:"flex items-center gap-1 px-4 py-2 border-b border-[#30363D] shrink-0",children:[b.jsx("button",{onClick:()=>n("diagram"),className:`px-3 py-1.5 text-xs font-medium rounded ${r==="diagram"?"bg-[#58A6FF20] text-[#58A6FF] border border-[#58A6FF40]":"text-[#8B949E] hover:text-[#E6EDF3]"}`,children:"State Machine"}),b.jsx("button",{onClick:()=>n("table"),className:`px-3 py-1.5 text-xs font-medium rounded ${r==="table"?"bg-[#58A6FF20] text-[#58A6FF] border border-[#58A6FF40]":"text-[#8B949E] hover:text-[#E6EDF3]"}`,children:"Transition Table"}),b.jsx("button",{onClick:()=>n("messages"),className:`px-3 py-1.5 text-xs font-medium rounded ${r==="messages"?"bg-[#58A6FF20] text-[#58A6FF] border border-[#58A6FF40]":"text-[#8B949E] hover:text-[#E6EDF3]"}`,children:"PM Messages"})]}),b.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:r==="diagram"?b.jsxs("div",{className:"flex flex-col h-full",children:[b.jsx("div",{className:"flex items-center gap-4 text-xs text-dark-muted px-6 py-3 border-b border-dark-border shrink-0",children:Object.entries(h_e).map(([D,z])=>b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx(kS,{trigger:D,size:14,className:"text-[#8B949E]"}),b.jsx("span",{children:z})]},D))}),b.jsxs("div",{ref:E,className:"relative flex-1 min-h-0 p-4 overflow-auto",children:[b.jsxs("svg",{viewBox:`0 0 ${T.width} ${T.height}`,className:"w-full h-auto",style:{minHeight:300},children:[b.jsxs("defs",{children:[b.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"7",refX:"10",refY:"3.5",orient:"auto",children:b.jsx("polygon",{points:"0 0, 10 3.5, 0 7",fill:"#8B949E"})}),b.jsx("marker",{id:"arrowhead-hover",markerWidth:"10",markerHeight:"7",refX:"10",refY:"3.5",orient:"auto",children:b.jsx("polygon",{points:"0 0, 10 3.5, 0 7",fill:"#C9D1D9"})})]}),T.edges.map(D=>{const z=`${D.from}->${D.to}|${D.trigger}`,q=z===m,G=D.points;if(G.length===0)return null;const U=G.map((F,Z)=>`${Z===0?"M":"L"} ${F.x} ${F.y}`).join(" "),Y=Math.floor(G.length/2),$=G[Y];let J="#30363D",re=1.5,oe="url(#arrowhead)";q&&(J="#C9D1D9",re=2,oe="url(#arrowhead-hover)");const fe=D.transitions.length;return b.jsxs("g",{className:"cursor-pointer",onClick:F=>M(F,D.transitions),onMouseEnter:()=>g(z),onMouseLeave:()=>g(null),children:[b.jsx("path",{d:U,fill:"none",stroke:"transparent",strokeWidth:"16"}),b.jsx("path",{d:U,fill:"none",stroke:J,strokeWidth:re,markerEnd:oe,strokeLinejoin:"round",strokeLinecap:"round"}),$&&D.transitions.length>0&&d_e(D.transitions[0].trigger,$.x,$.y-12,14,q?"#C9D1D9":"#8B949E",1),fe>1&&$&&b.jsxs("g",{children:[b.jsx("rect",{x:$.x+6,y:$.y-22,width:fe>=10?30:18,height:16,rx:8,fill:"#30363D"}),b.jsx("text",{x:$.x+6+(fe>=10?15:9),y:$.y-22+12,textAnchor:"middle",fontSize:10,fontWeight:600,fill:"#8B949E",children:fe})]})]},z)}),T.nodes.map(D=>{const z=D.x-D.width/2,q=D.y-D.height/2;if(D.id==="*")return b.jsxs("g",{children:[b.jsx("rect",{x:z,y:q,width:D.width,height:D.height,rx:15,ry:15,fill:"none",stroke:"#8B949E",strokeWidth:1.5,strokeDasharray:"4 2"}),b.jsx("text",{x:D.x,y:D.y,textAnchor:"middle",dominantBaseline:"central",fill:"#8B949E",fontSize:11,fontWeight:600,className:"select-none",children:"All"})]},"all-node");const G=C[D.id]||"#8B949E",U=`${G}18`;return b.jsxs("g",{children:[b.jsx("rect",{x:z,y:q,width:D.width,height:D.height,rx:8,ry:8,fill:"#0D1117"}),b.jsx("rect",{x:z,y:q,width:D.width,height:D.height,rx:8,ry:8,fill:U}),b.jsx("rect",{x:z,y:q,width:D.width,height:D.height,rx:8,ry:8,fill:"none",stroke:G,strokeWidth:2}),b.jsx("text",{x:D.x,y:D.y,textAnchor:"middle",dominantBaseline:"central",fontSize:14,fontWeight:700,fill:G,className:"select-none",children:D.id})]},D.id)})]}),y&&b.jsx(b_e,{info:y,stateColorMap:C,onClose:R})]}),O.length>0&&b.jsxs("div",{className:"px-6 py-3 border-t border-dark-border shrink-0",children:[b.jsx("h3",{className:"text-sm font-medium text-[#D29922] mb-2",children:"Validation Warnings"}),b.jsx("ul",{className:"space-y-1",children:O.map((D,z)=>b.jsxs("li",{className:"flex items-start gap-2 text-xs",children:[b.jsx("span",{className:`shrink-0 mt-0.5 px-1.5 py-0.5 rounded font-mono text-[10px] ${D.type==="duplicate"?"bg-[#F8514920] text-[#F85149]":D.type==="orphan"?"bg-[#D2992220] text-[#D29922]":"bg-[#58A6FF20] text-[#58A6FF]"}`,children:D.type}),b.jsx("span",{className:"text-dark-muted",children:D.message})]},z))})]})]}):r==="table"?b.jsxs("div",{className:"flex flex-col h-full",children:[A&&b.jsxs("div",{className:"px-6 py-4 flex-1 min-h-0 overflow-auto",children:[b.jsxs("h2",{className:"text-sm font-medium text-dark-text mb-3",children:["Transition Table (",A.tableTransitions.length," transitions)"]}),b.jsx("div",{className:"overflow-x-auto",children:b.jsxs("table",{className:"w-full text-xs border-collapse",children:[b.jsx("thead",{children:b.jsxs("tr",{className:"text-left text-dark-muted border-b border-[#30363D]",children:[b.jsx("th",{className:"py-2 pr-4 font-medium",children:"From"}),b.jsx("th",{className:"py-2 pr-4 font-medium",children:"To"}),b.jsx("th",{className:"py-2 pr-4 font-medium",children:"Trigger"}),b.jsx("th",{className:"py-2 font-medium",children:"Description"})]})}),b.jsx("tbody",{children:A.tableTransitions.map(D=>b.jsxs("tr",{className:"border-b border-[#30363D]/50 hover:bg-[#161B22]",children:[b.jsx("td",{className:"py-1.5 pr-4",children:b.jsx("span",{className:"px-2 py-0.5 rounded-full text-xs font-semibold",style:{backgroundColor:`${C[D.from]||"#8B949E"}20`,color:C[D.from]||"#8B949E",border:`1px solid ${C[D.from]||"#8B949E"}40`},children:D.from==="*"?"ALL":D.from})}),b.jsx("td",{className:"py-1.5 pr-4",children:b.jsx("span",{className:"px-2 py-0.5 rounded-full text-xs font-semibold",style:{backgroundColor:`${C[D.to]||"#8B949E"}20`,color:C[D.to]||"#8B949E",border:`1px solid ${C[D.to]||"#8B949E"}40`},children:D.to})}),b.jsx("td",{className:"py-1.5 pr-4",children:b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx(kS,{trigger:D.trigger,size:12,className:"text-[#8B949E]"}),b.jsx("span",{className:"text-dark-text",children:D.triggerLabel})]})}),b.jsx("td",{className:"py-1.5 text-dark-muted",children:D.description})]},D.id))})]})})]}),O.length>0&&b.jsxs("div",{className:"px-6 py-3 border-t border-dark-border shrink-0",children:[b.jsx("h3",{className:"text-sm font-medium text-[#D29922] mb-2",children:"Validation Warnings"}),b.jsx("ul",{className:"space-y-1",children:O.map((D,z)=>b.jsxs("li",{className:"flex items-start gap-2 text-xs",children:[b.jsx("span",{className:`shrink-0 mt-0.5 px-1.5 py-0.5 rounded font-mono text-[10px] ${D.type==="duplicate"?"bg-[#F8514920] text-[#F85149]":D.type==="orphan"?"bg-[#D2992220] text-[#D29922]":"bg-[#58A6FF20] text-[#58A6FF]"}`,children:D.type}),b.jsx("span",{className:"text-dark-muted",children:D.message})]},z))})]})]}):b.jsxs("div",{className:"px-6 py-4",children:[b.jsxs("div",{className:"mb-4",children:[b.jsx("h2",{className:"text-lg font-semibold text-dark-text",children:"PM → Team Leader Messages"}),b.jsx("p",{className:"text-dark-muted text-sm mt-0.5",children:"Messages automatically sent to your team leads when events occur"})]}),b.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-4",children:s_e.map(D=>b.jsx(x_e,{cardDef:D,templateData:N.get(D.id),onSave:L},D.id))})]})})]})}function w_e(){return b.jsx(pK,{children:b.jsxs(EK,{children:[b.jsxs("div",{className:"h-screen w-screen flex flex-col bg-dark-base text-dark-text overflow-hidden",children:[b.jsx(VK,{}),b.jsxs("div",{className:"flex flex-1 min-h-0",children:[b.jsx(XK,{}),b.jsx("main",{className:"flex-1 min-w-0 overflow-auto",children:b.jsxs(HG,{children:[b.jsx(bo,{path:"/",element:b.jsx(Pne,{})}),b.jsx(bo,{path:"/issues",element:b.jsx($ne,{})}),b.jsx(bo,{path:"/usage",element:b.jsx(P0e,{})}),b.jsx(bo,{path:"/projects",element:b.jsx(H0e,{})}),b.jsx(bo,{path:"/lifecycle",element:b.jsx(__e,{})}),b.jsx(bo,{path:"/settings",element:b.jsx(K0e,{})})]})})]}),b.jsx(WK,{})]}),b.jsx(bne,{})]})})}const vU=document.getElementById("root");if(!vU)throw new Error("Root element not found");KH.createRoot(vU).render(b.jsx(vp.StrictMode,{children:b.jsx(w_e,{})}));
|
|
188
|
-
//# sourceMappingURL=index-
|
|
188
|
+
//# sourceMappingURL=index-6gyTp6Il.js.map
|