(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[315],{40479:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/jobs/[job]",function(){return s(88099)}])},6639:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});/**
 * @license lucide-react v0.407.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(60998).Z)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},16826:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});/**
 * @license lucide-react v0.407.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(60998).Z)("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]])},88507:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});/**
 * @license lucide-react v0.407.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(60998).Z)("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]])},13626:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});/**
 * @license lucide-react v0.407.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(60998).Z)("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]])},28586:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});/**
 * @license lucide-react v0.407.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,s(60998).Z)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]])},41825:function(e,t,s){"use strict";s.d(t,{l:function(){return h}});var r=s(85893),n=s(67294),a=s(45895),l=s(6639);/**
 * @license lucide-react v0.407.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let c=(0,s(60998).Z)("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);var o=s(470),i=s(17853);let d="skypilot-dcgm-gpu/skypilot-dcgm-gpu-metrics",u=[{label:"15m",value:"15m"},{label:"1h",value:"1h"},{label:"6h",value:"6h"},{label:"24h",value:"24h"},{label:"7d",value:"7d"}],m=[{id:"1",title:"GPU Utilization",keyPrefix:"gpu-util"},{id:"2",title:"GPU Memory Utilization",keyPrefix:"gpu-memory"},{id:"3",title:"GPU Temperature",keyPrefix:"gpu-temp"},{id:"4",title:"GPU Power Usage",keyPrefix:"gpu-power"}],x=(e,t,s)=>{let r=(0,i.ki)(),n=new URLSearchParams({orgId:"1",from:s.from,to:s.to,timezone:"browser","var-cluster":t,"var-node":"$__all","var-gpu":"$__all",theme:"light",panelId:e});return"".concat(r,"/d-solo/").concat(d,"?").concat(n.toString(),"&__feature.dashboardSceneSolo")};function h(e){let{clusterNameOnCloud:t,displayName:s,refreshTrigger:h=0,storageKey:g="skypilot-gpu-metrics-expanded",headerExtra:f=null,noMetricsMessage:j="No GPU metrics available."}=e,[p,N]=(0,n.useState)({from:"now-1h",to:"now"}),[b,v]=(0,n.useState)(()=>"true"===localStorage.getItem(g)),y=e=>{N({from:"now-".concat(e),to:"now"})};return(0,r.jsx)("div",{className:"mt-6",children:(0,r.jsxs)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 ".concat(b?"pt-4":"py-4"),children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsxs)("button",{onClick:()=>{let e=!b;v(e),localStorage.setItem(g,String(e))},className:"flex items-center text-left focus:outline-none hover:text-gray-700 transition-colors duration-200",children:[b?(0,r.jsx)(a.Z,{className:"w-5 h-5 mr-2"}):(0,r.jsx)(l.Z,{className:"w-5 h-5 mr-2"}),(0,r.jsx)("h3",{className:"text-lg font-semibold",children:"GPU Metrics"})]}),f]}),(0,r.jsx)(o.WH,{content:"Open in Grafana",children:(0,r.jsx)("button",{onClick:()=>{let e=new URLSearchParams({orgId:"1",from:p.from,to:p.to,timezone:"browser","var-cluster":t,"var-node":"$__all","var-gpu":"$__all"});window.open((0,i.JP)("/d/".concat(d,"?").concat(e.toString())),"_blank")},className:"p-1.5 rounded-md text-gray-500 hover:text-gray-700 hover:bg-gray-100 transition-colors","aria-label":"Open in Grafana",children:(0,r.jsx)(c,{className:"w-4 h-4"})})})]}),b&&(0,r.jsxs)("div",{className:"p-5",children:[(0,r.jsxs)("div",{className:"mb-4 p-4 bg-gray-50 rounded-md border border-gray-200",children:[(0,r.jsx)("div",{className:"flex flex-col sm:flex-row gap-4 items-start sm:items-center",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("label",{className:"text-sm font-medium text-gray-700 whitespace-nowrap",children:"Time Range:"}),(0,r.jsx)("div",{className:"flex gap-1",children:u.map(e=>(0,r.jsx)("button",{onClick:()=>y(e.value),className:"px-2 py-1 text-xs font-medium rounded border transition-colors ".concat(p.from==="now-".concat(e.value)&&"now"===p.to?"bg-sky-blue text-white border-sky-blue":"bg-white text-gray-600 border-gray-300 hover:bg-gray-50"),children:e.label},e.value))})]})}),(0,r.jsxs)("div",{className:"mt-2 text-xs text-gray-500",children:["Showing: ",s," • Time: ",p.from," to"," ",p.to]})]}),t?(0,r.jsx)("div",{className:"grid gap-4 [grid-template-columns:repeat(auto-fit,minmax(300px,1fr))]",children:m.map(e=>(0,r.jsx)("div",{className:"bg-white rounded-md border border-gray-200 shadow-sm",children:(0,r.jsx)("div",{className:"p-2",children:(0,r.jsx)("iframe",{src:x(e.id,t,p),width:"100%",height:"400",frameBorder:"0",title:e.title,className:"rounded"},"".concat(e.keyPrefix,"-").concat(t,"-").concat(p.from,"-").concat(p.to,"-").concat(h))})},e.id))}):(0,r.jsx)("div",{className:"p-4 text-center text-gray-500 bg-gray-50 rounded-md",children:j})]})]})})}},1125:function(e,t,s){"use strict";s.d(t,{C:function(){return o}});var r=s(85893),n=s(67294),a=s(34209),l=s(84283);let c=e=>{if(!e||"string"!=typeof e)return e;let t=e.split("\n"),s=[];for(let e=0;e<t.length;e++){let r=t[e];if(""===r.trim()){let n=!1,a=0;for(let s=e-1;s>=0;s--){let e=t[s],r=e.trim();if(r&&e.match(/:\s*[|>]\s*$/)){n=!0;for(let e=s+1;e<t.length;e++){let s=t[e];if(s.trim()){a=s.search(/\S/);break}}break}if(r&&0===e.search(/\S/))break}if(n)for(let n=e+1;n<t.length;n++){let e=t[n];if(e.trim()){e.search(/\S/)>=a?s.push("  #YAML_BLANK_LINE_MARKER#"):s.push(r);break}}else s.push(r)}else s.push(r)}return s.join("\n")};function o(e){let{children:t,className:s=""}=e,o=(0,n.useRef)(null),i=c(t);(0,n.useEffect)(()=>{if(o.current){let e=o.current;setTimeout(()=>{let t;let s=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null);for(;t=s.nextNode();)t.textContent&&t.textContent.includes("#YAML_BLANK_LINE_MARKER#")&&(t.textContent=t.textContent.replace(/#YAML_BLANK_LINE_MARKER#/g,""))},0)}},[i]);let d={...l.mQ,'code[class*="language-"]':{...l.mQ['code[class*="language-"]'],whiteSpace:"pre !important"},'pre[class*="language-"]':{...l.mQ['pre[class*="language-"]'],whiteSpace:"pre !important"}};return(0,r.jsx)("div",{ref:o,className:s,children:(0,r.jsx)(a.Z,{language:"yaml",style:d,customStyle:{margin:0,padding:0,background:"transparent",fontSize:"0.875rem",fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace'},wrapLines:!0,wrapLongLines:!0,showLineNumbers:!1,useInlineStyles:!0,children:i})})}},8686:function(e,t,s){"use strict";s.d(t,{N:function(){return a}});var r=s(85893);s(67294);var n=s(470);let a=e=>{let{showTooltip:t=!0,className:s=""}=e,a=(0,r.jsxs)("span",{className:"\n        inline-flex items-center gap-0.5\n        px-1.5 py-0.5\n        text-[10px] font-semibold uppercase tracking-wide\n        bg-gradient-to-r from-emerald-50 to-teal-50\n        text-emerald-700\n        border border-emerald-200\n        rounded\n        shadow-sm\n        cursor-help\n        select-none\n        ".concat(s,"\n      "),children:[(0,r.jsx)("svg",{className:"w-2.5 h-2.5 text-emerald-500",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M10.868 2.884c-.321-.772-1.415-.772-1.736 0l-1.83 4.401-4.753.381c-.833.067-1.171 1.107-.536 1.651l3.62 3.102-1.106 4.637c-.194.813.691 1.456 1.405 1.02L10 15.591l4.069 2.485c.713.436 1.598-.207 1.404-1.02l-1.106-4.637 3.62-3.102c.635-.544.297-1.584-.536-1.65l-4.752-.382-1.831-4.401z",clipRule:"evenodd"})}),(0,r.jsx)("span",{children:"Primary"})]});return t?(0,r.jsx)(n.Md,{content:"Primary task – other tasks will be terminated once all primary tasks finish",className:"text-muted-foreground",children:a}):a}},99307:function(e,t,s){"use strict";s.d(t,{Cl:function(){return c},OE:function(){return d}});var r=s(85893);s(67294);var n=s(55739),a=s(470),l=s(53850);let c=e=>{switch(e){case"LAUNCHING":return"bg-blue-100 text-sky-blue";case"RUNNING":case"IN_USE":case"READY":return"bg-green-50 text-green-700";case"STOPPED":return"bg-yellow-100 text-yellow-800";case"AUTOSTOPPING":return"bg-purple-100 text-purple-800";case"TERMINATED":case"PENDING":case"UNKNOWN":default:return"bg-gray-100 text-gray-800";case"SUCCEEDED":case"PROVISIONING":case"CONTROLLER_INIT":case"REPLICA_INIT":return"bg-blue-50 text-blue-700";case"FAILED":case"FAILED_PRECHECKS":case"FAILED_NO_RESOURCE":case"FAILED_CONTROLLER":case"FAILED_INITIAL_DELAY":case"FAILED_PROBING":case"FAILED_PROVISION":case"FAILED_CLEANUP":case"CONTROLLER_FAILED":return"bg-red-50 text-red-700";case"CANCELLED":case"CANCELLING":case"NOT_READY":return"bg-yellow-50 text-yellow-700";case"RECOVERING":case"SHUTTING_DOWN":return"bg-orange-50 text-orange-700";case"SUBMITTED":return"bg-indigo-50 text-indigo-700";case"STARTING":return"bg-cyan-50 text-cyan-700";case"FAILED_SETUP":return"bg-pink-50 text-pink-700";case"PREEMPTED":case"NO_REPLICA":return"bg-purple-50 text-purple-700"}},o=e=>{switch(e){case"LAUNCHING":case"STARTING":case"AUTOSTOPPING":case"PROVISIONING":case"SHUTTING_DOWN":return(0,r.jsx)(n.Z,{size:12,className:"w-3 h-3 mr-1"});case"RUNNING":case"IN_USE":default:return(0,r.jsx)(l.W2,{className:"w-3 h-3 mr-1"});case"STOPPED":case"PREEMPTED":return(0,r.jsx)(l.fp,{className:"w-3 h-3 mr-1"});case"TERMINATED":case"FAILED":case"CANCELLED":case"FAILED_INITIAL_DELAY":case"FAILED_PROBING":case"FAILED_PROVISION":case"FAILED_CLEANUP":case"CONTROLLER_FAILED":case"UNKNOWN":return(0,r.jsx)(l.Ps,{className:"w-3 h-3 mr-1"});case"SUCCEEDED":return(0,r.jsx)(l.Ye,{className:"w-3 h-3 mr-1"});case"PENDING":case"RECOVERING":case"SUBMITTED":case"CANCELLING":case"FAILED_SETUP":case"FAILED_PRECHECKS":case"FAILED_NO_RESOURCE":case"FAILED_CONTROLLER":case"READY":case"NOT_READY":case"CONTROLLER_INIT":case"REPLICA_INIT":case"NO_REPLICA":return(0,r.jsx)(l.J$,{className:"w-3 h-3 mr-1"})}},i=e=>{let t=c(e),s=o(e);return(0,r.jsxs)("span",{className:"".concat("inline-flex items-center px-2 py-1 rounded-full text-sm"," ").concat(t),children:[s,e]})},d=e=>{let{status:t,statusTooltip:s}=e,n=s||t;return(0,r.jsx)(a.Md,{content:n,children:(0,r.jsx)("span",{children:i(t)})})}},20546:function(e,t,s){"use strict";s.d(t,{H:function(){return d}});var r=s(85893);s(67294);var n=s(41664),a=s.n(n),l=s(45697),c=s.n(l);function o(e){return!!e&&"string"==typeof e&&e.toLowerCase().startsWith("sa-")}let i=()=>(0,r.jsx)("span",{className:"px-2 py-0.5 text-xs bg-blue-100 text-blue-700 rounded font-medium ml-1",children:"SA"}),d=e=>{let{username:t,userHash:s,className:n="flex items-center gap-1",linkClassName:l="text-gray-700 hover:text-blue-600 hover:underline",showBadge:c=!0}=e,d=o(s),u=o(s)?"/users?tab=service-accounts":"/users";return(0,r.jsxs)("div",{className:n,children:[(0,r.jsx)(a(),{href:u,className:l,children:t}),c&&d&&(0,r.jsx)(i,{})]})};d.propTypes={username:c().string.isRequired,userHash:c().string,className:c().string,linkClassName:c().string,showBadge:c().bool}},21494:function(e,t,s){"use strict";s.d(t,{V:function(){return a}});var r=s(67294),n=s(470);function a(e){let{streamFn:t,streamArgs:s,enabled:a=!0,refreshTrigger:l=0,maxLineChars:c=2e3,maxRenderLines:o=5e3,flushIntervalMs:i=100,onError:d=e=>{}}=e,[u,m]=(0,r.useState)([]),[x,h]=(0,r.useState)(!1),[g,f]=(0,r.useState)(!1),[j,p]=(0,r.useState)(0),N=(0,r.useRef)([]),b=(0,r.useRef)(""),v=(0,r.useRef)(new Map),y=(0,r.useRef)(null),w=(0,r.useRef)(null),_=(0,r.useRef)(!1),k=(0,r.useRef)(d);(0,r.useEffect)(()=>{k.current=d},[d]);let L=(0,r.useCallback)(()=>{N.current=[],b.current="",v.current=new Map,_.current=!1,m([]),f(!1)},[]),E=(0,r.useMemo)(()=>[...u,...Array.from(v.current.values())],[u,j]),I=(0,r.useCallback)(()=>{0!==N.current.length&&m(e=>{let t=[...e,...N.current];return N.current=[],t.length>o?t.slice(t.length-o):t})},[o]);return(0,r.useEffect)(()=>{let e=!0;if(L(),!a||!t)return h(!1),()=>{};let r=new AbortController;w.current=r;let l=()=>{y.current||(y.current=setTimeout(()=>{y.current=null,I()},i))},d=e=>{let t=e.match(/^\(([^)]+)\)/);if(t){v.current.set(t[1],e),p(e=>e+1);return}N.current.push(e),N.current.length>2*o&&(N.current=N.current.slice(N.current.length-o))},u=e=>{let t=e.split("\n");t[0]=b.current+t[0];let s=e.endsWith("\n");b.current=s?"":t.pop()||"";let r=t.filter(e=>e.trim());for(let e of(!_.current&&r.length>0&&(_.current=!0,f(!0)),r)){let t=(0,n.Zn)(e);!(0,n.Zt)(t)&&(t.length>c&&(t=t.slice(0,c)+" … [truncated]"),/\d+%\s*\|/.test(t)?d(t):(N.current.push(t),N.current.length>2*o&&(N.current=N.current.slice(N.current.length-o))))}l()};return h(!0),t({...s,onNewLog:t=>{e&&u(t)},signal:r.signal}).then(()=>{e&&(b.current&&(N.current.push(b.current),b.current=""),I(),h(!1))}).catch(t=>{if(!e||"AbortError"===t.name)return;let s=k.current;s&&s(t),m(e=>[...e,"Error fetching logs: ".concat(t.message)]),h(!1)}),()=>{e=!1,y.current&&(clearTimeout(y.current),y.current=null),w.current&&(w.current.abort(),w.current=null),N.current=[],b.current="",v.current.clear()}},[t,s,a,l,I,i,c,o,L]),{lines:E,isLoading:x,hasReceivedFirstChunk:g}}},23001:function(e,t,s){"use strict";s.d(t,{X:function(){return n}});var r=s(67294);function n(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:768,[t,s]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{let t=()=>{s(window.innerWidth<e)};return t(),window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}},[e]),t}},84303:function(e,t,s){"use strict";s.d(t,{_q:function(){return a},pJ:function(){return o}});var r=s(1272);let n={lineWidth:-1,quotingType:"'",forceQuotes:!1,noRefs:!0,sortKeys:!1,condenseFlow:!1,indent:2},a=e=>{if(!e)return"No YAML available";try{let t=r.ZP.load(e),s=r.ZP.dump(t,n).split("\n"),a=[],l=-1;for(let e=0;e<s.length;e++){let t=s[e],r=t.search(/\S/);0===r&&l>=0&&e>0&&a.push(""),a.push(t),l=r}return a.join("\n").trim()}catch(t){return console.error("YAML formatting error:",t),e}},l=e=>"string"==typeof e?e.substring(0,50)+"...":e&&e.name?e.name:e&&e.resources?"Task configuration":"YAML document",c=(e,t)=>{try{let s=r.ZP.load(e),a=r.ZP.dump(s,n).split("\n"),c=[],o=-1;for(let e=0;e<a.length;e++){let t=a[e],s=t.search(/\S/);0===s&&o>=0&&e>0&&c.push(""),c.push(t),o=s}return{index:t,content:c.join("\n").trim(),preview:l(s)}}catch(s){return console.error("YAML formatting error for document ".concat(t,":"),s),{index:t,content:e,preview:"Invalid YAML"}}},o=e=>{if(!e)return[];try{let t=[],s=e.split(/^---$/m);for(let e=0;e<s.length;e++){let r=s[e].trim();r&&""!==r&&t.push(r)}return(t.length>1?t.slice(1):t).map((e,t)=>c(e,t))}catch(t){return console.error("YAML formatting error:",t),[{index:0,content:e,preview:"Invalid YAML"}]}}},88099:function(e,t,s){"use strict";s.r(t);var r=s(85893),n=s(67294),a=s(55739),l=s(11163),c=s(37673),o=s(68764),i=s(62935),d=s(68969),u=s(41664),m=s.n(u),x=s(13626),h=s(16826),g=s(45895),f=s(6639),j=s(70282),p=s(27325),N=s(470),b=s(99307),v=s(8686),y=s(23001),w=s(9008),_=s.n(w),k=s(84303),L=s(20546),E=s(1125),I=s(6378),S=s(55988),C=s(17853),T=s(41825),R=s(21494),A=s(45697),D=s.n(A);function M(e){let{jobId:t,detailJobData:s,isLoadingControllerLogs:a,handleControllerLogsRefresh:l,setIsLoadingControllerLogs:o,setIsLoadingLogs:i,refreshControllerLogsFlag:u,poolsData:m}=e,j="skypilot-controller-logs-expanded",[p,b]=(0,n.useState)(()=>"true"===localStorage.getItem(j));return(0,r.jsx)("div",{id:"controller-logs-section",className:"mt-6",children:(0,r.jsxs)(c.Zb,{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 ".concat(p?"pt-4":"py-4"),children:[(0,r.jsxs)("button",{onClick:()=>{let e=!p;b(e),localStorage.setItem(j,String(e))},className:"flex items-center text-left focus:outline-none hover:text-gray-700 transition-colors duration-200",children:[p?(0,r.jsx)(g.Z,{className:"w-5 h-5 mr-2"}):(0,r.jsx)(f.Z,{className:"w-5 h-5 mr-2"}),(0,r.jsx)("h3",{className:"text-lg font-semibold",children:"Controller Logs"}),(0,r.jsx)("span",{className:"ml-2 text-xs text-gray-500",children:"(Logs are not streaming; click refresh to fetch the latest logs.)"})]}),p&&(0,r.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,r.jsx)(N.WH,{content:"Download full controller logs",className:"text-muted-foreground",children:(0,r.jsx)("button",{onClick:()=>(0,d.jh)({jobId:parseInt(Array.isArray(t)?t[0]:t),controller:!0}),className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:(0,r.jsx)(h.Z,{className:"w-4 h-4"})})}),(0,r.jsx)(N.WH,{content:"Refresh controller logs",className:"text-muted-foreground",children:(0,r.jsx)("button",{onClick:l,disabled:a,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:(0,r.jsx)(x.Z,{className:"w-4 h-4 ".concat(a?"animate-spin":"")})})})]})]}),p&&(0,r.jsx)("div",{className:"p-4",children:(0,r.jsx)(P,{jobData:s,activeTab:"controllerlogs",setIsLoadingLogs:i,setIsLoadingControllerLogs:o,isLoadingLogs:!1,isLoadingControllerLogs:a,refreshFlag:u,poolsData:m})})]})})}let O={"W&B Run":/^https:\/\/wandb\.ai\/[^\/]+\/[^\/]+\/runs\/[^\/]+$/};function P(e){let{jobData:t,allTasks:s=[],activeTab:l,setIsLoadingLogs:c,setIsLoadingControllerLogs:o,isLoadingLogs:i,isLoadingControllerLogs:u,refreshFlag:x,poolsData:h,links:v,logExtractedLinks:y,onLinksExtracted:w,selectedTaskIndex:_=null,onTaskChange:I=null,selectedNode:C="all",onNodesExtracted:T=null}=e,[A,D]=(0,n.useState)(!1),[M,P]=(0,n.useState)({}),[Z,U]=(0,n.useState)(!1),[F,G]=(0,n.useState)(!1),[H,W]=(0,n.useState)(!1),q=(0,n.useRef)(null),B=(0,n.useRef)(null),Y=(0,n.useCallback)(e=>{let t="logs"===e?q:B;if(t.current)for(let s of[()=>t.current.querySelector(".logs-container"),()=>t.current.querySelector('[class*="logs-container"]'),()=>t.current.querySelector('div[style*="overflow"]'),()=>t.current]){let t=s();if(t&&t.scrollHeight>t.clientHeight){t.scrollTop=t.scrollHeight,console.log("Auto-scrolled ".concat(e," to bottom"));break}}},[]),J=["PENDING","SUBMITTED","STARTING"].includes(t.status),z=["PENDING","SUBMITTED"].includes(t.status),V=["RECOVERING"].includes(t.status),K=(0,n.useMemo)(()=>s.length>1?(0,d._5)(s):t.status,[s,t.status]),$=e=>{P(t=>({...t,[e]:!t[e]}))},Q=async()=>{try{let e=(0,k.pJ)(t.dag_yaml),s=t.name||t.execution?[t.name?"name: ".concat(t.name):null,t.execution?"execution: ".concat(t.execution):null].filter(Boolean).join("\n")+"\n---\n":"",r="";r=1===e.length?s+e[0].content:e.length>1?s+e.map(e=>e.content).join("\n---\n"):s+t.dag_yaml,await navigator.clipboard.writeText(r),G(!0),setTimeout(()=>G(!1),2e3)}catch(e){console.error("Failed to copy YAML to clipboard:",e)}},X=async()=>{try{await navigator.clipboard.writeText(t.entrypoint),W(!0),setTimeout(()=>W(!1),2e3)}catch(e){console.error("Failed to copy command to clipboard:",e)}},ee=(0,n.useMemo)(()=>({jobId:t.id,controller:!1,task:_}),[t.id,_]),et=(0,n.useMemo)(()=>({jobId:t.id,controller:!0}),[t.id]),es=(0,n.useCallback)(e=>{console.error("Error streaming logs:",e)},[]),er=(0,n.useCallback)(e=>{console.error("Error streaming controller logs:",e)},[]),{lines:en,isLoading:ea,hasReceivedFirstChunk:el}=(0,R.V)({streamFn:d.NJ,streamArgs:ee,enabled:"logs"===l&&!J&&!V,refreshTrigger:"logs"===l?x:0,onError:es}),{lines:ec,isLoading:eo,hasReceivedFirstChunk:ei}=(0,R.V)({streamFn:d.NJ,streamArgs:et,enabled:"controllerlogs"===l&&!z,refreshTrigger:"controllerlogs"===l?x:0,onError:er});(0,n.useEffect)(()=>{c(ea)},[ea,c]),(0,n.useEffect)(()=>{o(eo)},[eo,o]),(0,n.useEffect)(()=>{if(T&&en.length>0){let e=en.join("\n");T((0,N.$N)(e))}},[en,T]);let ed=(0,n.useRef)({}),eu=(0,n.useMemo)(()=>{let e={...ed.current},t=new Set(Object.keys(e));for(let s of en){if(t.size===Object.keys(O).length)break;for(let r of s.split(/[\s"'<>()[\]{},;]+/)){let s=r.replace(/[.,:;!?]+$/,"");if(s){for(let[r,n]of Object.entries(O))if(!t.has(r)&&n.test(s)){e[r]=s,t.add(r);break}}}}return ed.current=e,e},[en]);(0,n.useEffect)(()=>{w&&Object.keys(eu).length>0&&w(eu)},[eu,w]);let em=(0,n.useMemo)(()=>{let e={...v||{}};for(let[t,s]of Object.entries(y||eu))e[t]||(e[t]=s);return e},[v,eu,y]);return((0,n.useEffect)(()=>{let e=()=>{("logs"===l&&en.length||"controllerlogs"===l&&ec.length)&&Y("logs"===l?"logs":"controllerlogs")};requestAnimationFrame(()=>{requestAnimationFrame(e)})},[l,en,ec,Y]),"logs"===l)?(0,r.jsx)("div",{className:"max-h-96 overflow-y-auto",ref:q,children:J?(0,r.jsx)("div",{className:"bg-[#f7f7f7] flex items-center justify-center py-4 text-gray-500",children:(0,r.jsx)("span",{children:"Waiting for the job to start; refresh in a few moments."})}):V?(0,r.jsx)("div",{className:"bg-[#f7f7f7] flex items-center justify-center py-4 text-gray-500",children:(0,r.jsx)("span",{children:"Waiting for the job to recover; refresh in a few moments."})}):(0,r.jsx)(N.$B,{logs:en,isLoading:i&&!el&&!en.length,selectedNode:C})}):"controllerlogs"===l?(0,r.jsx)("div",{className:"max-h-96 overflow-y-auto",ref:B,children:z?(0,r.jsx)("div",{className:"bg-[#f7f7f7] flex items-center justify-center py-4 text-gray-500",children:(0,r.jsx)("span",{children:"Waiting for the job controller process to start; refresh in a few moments."})}):ei||ec.length?(0,r.jsx)(N.$B,{logs:ec,controller:!0}):u?(0,r.jsxs)("div",{className:"flex items-center justify-center py-4",children:[(0,r.jsx)(a.Z,{size:20,className:"mr-2"}),(0,r.jsx)("span",{children:"Loading logs..."})]}):(0,r.jsx)(N.$B,{logs:ec,controller:!0})}):(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-6",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Job ID (Name)"}),(0,r.jsxs)("div",{className:"text-base mt-1 flex items-center gap-2",children:[(0,r.jsxs)("span",{children:[t.id," ",t.name?"(".concat(t.name,")"):""]}),t.is_job_group&&(0,r.jsx)("span",{className:"px-2 py-0.5 rounded text-xs font-medium bg-gray-200 text-gray-700",children:"JobGroup"})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Status"}),(0,r.jsx)("div",{className:"text-base mt-1",children:(0,r.jsx)(S.j,{name:"jobs.detail.status.badge",context:t,fallback:(0,r.jsx)(b.OE,{status:K})})})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"User"}),(0,r.jsx)("div",{className:"text-base mt-1",children:(0,r.jsx)(L.H,{username:t.user,userHash:t.user_hash})})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Workspace"}),(0,r.jsx)("div",{className:"text-base mt-1",children:(0,r.jsx)(m(),{href:"/workspaces",className:"text-gray-700 hover:text-blue-600 hover:underline",children:t.workspace||"default"})})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Submitted"}),(0,r.jsx)("div",{className:"text-base mt-1",children:t.submitted_at?(0,N.xn)(t.submitted_at):"N/A"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Requested Resources"}),(0,r.jsx)("div",{className:"text-base mt-1",children:s.length>1?(0,r.jsx)(N.Md,{content:"Aggregated from ".concat(s.length," tasks:\n").concat(s.map((e,t)=>"Task ".concat(t).concat(e.task?" (".concat(e.task,")"):"",": ").concat(e.requested_resources||e.resources_str||"N/A")).join("\n")),className:"text-sm text-muted-foreground",children:(0,r.jsx)("span",{className:"cursor-help border-b border-dotted border-gray-400",children:(()=>{let e=s.map(e=>e.requested_resources||e.resources_str).filter(Boolean),t=[...new Set(e)];return 1===t.length?"".concat(t[0]," (x").concat(s.length," tasks)"):"".concat(e[0]," (+").concat(s.length-1," more)")})()})}):t.requested_resources||"N/A"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Infra"}),(0,r.jsx)("div",{className:"text-base mt-1",children:t.infra?(0,r.jsx)(N.Md,{content:t.full_infra||t.infra,className:"text-sm text-muted-foreground",children:(0,r.jsxs)("span",{children:[(0,r.jsx)(m(),{href:"/infra",className:"text-blue-600 hover:underline",children:t.cloud||t.infra.split("(")[0].trim()}),t.infra.includes("(")&&(0,r.jsx)("span",{children:" "+t.infra.substring(t.infra.indexOf("("))})]})}):"-"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Resources"}),(0,r.jsx)("div",{className:"text-base mt-1",children:t.resources_str_full||t.resources_str||"-"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Git Commit"}),(0,r.jsx)("div",{className:"text-base mt-1 flex items-center",children:t.git_commit&&"-"!==t.git_commit?(0,r.jsxs)("span",{className:"flex items-center mr-2",children:[t.git_commit,(0,r.jsx)(N.WH,{content:F?"Copied!":"Copy commit",className:"text-muted-foreground",children:(0,r.jsx)("button",{onClick:async()=>{await navigator.clipboard.writeText(t.git_commit),G(!0),setTimeout(()=>G(!1),2e3)},className:"flex items-center text-gray-500 hover:text-gray-700 transition-colors duration-200 p-1 ml-2",children:F?(0,r.jsx)(j.Z,{className:"w-4 h-4 text-green-600"}):(0,r.jsx)(p.Z,{className:"w-4 h-4"})})})]}):(0,r.jsx)("span",{className:"text-gray-400",children:"-"})})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Pool"}),(0,r.jsx)("div",{className:"text-base mt-1",children:(0,N.os)(t.pool,t.pool_hash,h)})]}),(0,r.jsxs)("div",{className:"col-span-2",children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"External Links"}),(0,r.jsx)("div",{className:"text-base mt-1",children:em&&Object.keys(em).length>0?(0,r.jsx)("div",{className:"flex flex-wrap gap-4",children:Object.entries(em).map(e=>{let[t,s]=e,n=s.startsWith("http://")||s.startsWith("https://")?s:"https://".concat(s);return(0,r.jsx)("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 hover:underline",children:t},t)})}):(0,r.jsx)("span",{className:"text-gray-400",children:"-"})})]}),t.details&&(0,r.jsx)(S.j,{name:"jobs.detail.queue_details",context:{details:t.details,queueName:t.kueue_queue_name,infra:t.full_infra,jobData:t,title:"Queue Details"}}),(t.entrypoint||t.dag_yaml)&&(0,r.jsxs)("div",{className:"col-span-2",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Entrypoint"}),t.entrypoint&&(0,r.jsx)(N.WH,{content:H?"Copied!":"Copy command",className:"text-muted-foreground",children:(0,r.jsx)("button",{onClick:X,className:"flex items-center text-gray-500 hover:text-gray-700 transition-colors duration-200 p-1 ml-2",children:H?(0,r.jsx)(j.Z,{className:"w-4 h-4 text-green-600"}):(0,r.jsx)(p.Z,{className:"w-4 h-4"})})})]}),(0,r.jsxs)("div",{className:"space-y-4 mt-3",children:[t.entrypoint&&(0,r.jsx)("div",{children:(0,r.jsx)("div",{className:"bg-gray-50 border border-gray-200 rounded-md p-3",children:(0,r.jsx)("code",{className:"text-sm text-gray-800 font-mono break-all",children:t.entrypoint})})}),t.dag_yaml&&"{}"!==t.dag_yaml&&(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center mb-2",children:[(0,r.jsxs)("button",{onClick:()=>{D(!A)},className:"flex items-center text-left focus:outline-none text-gray-700 hover:text-gray-900 transition-colors duration-200",children:[A?(0,r.jsx)(g.Z,{className:"w-4 h-4 mr-1"}):(0,r.jsx)(f.Z,{className:"w-4 h-4 mr-1"}),(0,r.jsx)("span",{className:"text-base",children:"Show SkyPilot YAML"})]}),(0,r.jsx)(N.WH,{content:F?"Copied!":"Copy YAML",className:"text-muted-foreground",children:(0,r.jsx)("button",{onClick:Q,className:"flex items-center text-gray-500 hover:text-gray-700 transition-colors duration-200 p-1 ml-2",children:F?(0,r.jsx)(j.Z,{className:"w-4 h-4 text-green-600"}):(0,r.jsx)(p.Z,{className:"w-4 h-4"})})})]}),A&&(0,r.jsx)("div",{className:"bg-gray-50 border border-gray-200 rounded-md p-3 max-h-96 overflow-y-auto",children:(()=>{let e=(0,k.pJ)(t.dag_yaml),s=t.name||t.execution?[t.name?"name: ".concat(t.name):null,t.execution?"execution: ".concat(t.execution):null].filter(Boolean).join("\n")+"\n---\n":"";return 0===e.length?(0,r.jsx)("div",{className:"text-gray-500",children:"No YAML available"}):1===e.length?(0,r.jsx)(E.C,{className:"whitespace-pre-wrap",children:s+e[0].content}):(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{className:"flex items-center space-x-4 pb-2 border-b border-gray-200",children:[(0,r.jsx)("button",{onClick:()=>U(!1),className:"text-sm px-2 py-1 rounded ".concat(Z?"text-gray-600 hover:text-gray-800":"bg-blue-100 text-blue-700"),children:"By Job"}),(0,r.jsx)("button",{onClick:()=>U(!0),className:"text-sm px-2 py-1 rounded ".concat(Z?"bg-blue-100 text-blue-700":"text-gray-600 hover:text-gray-800"),children:"Full YAML"})]}),Z?(0,r.jsx)(E.C,{className:"whitespace-pre-wrap",children:s+e.map(e=>e.content).join("\n---\n")}):e.map((e,t)=>(0,r.jsxs)("div",{className:"border-b border-gray-200 pb-4 last:border-b-0",children:[(0,r.jsx)("button",{onClick:()=>$(t),className:"flex items-center justify-between w-full text-left focus:outline-none",children:(0,r.jsxs)("div",{className:"flex items-center",children:[M[t]?(0,r.jsx)(g.Z,{className:"w-4 h-4 mr-2"}):(0,r.jsx)(f.Z,{className:"w-4 h-4 mr-2"}),(0,r.jsxs)("span",{className:"text-sm font-medium text-gray-700",children:["Job ",t+1,": ",e.preview]})]})}),M[t]&&(0,r.jsx)("div",{className:"mt-3 ml-6",children:(0,r.jsx)(E.C,{className:"whitespace-pre-wrap",children:e.content})})]},t))]})})()})]})]})]})]})}P.propTypes={jobData:D().shape({id:D().oneOfType([D().string,D().number]),name:D().oneOfType([D().string,D().number]),status:D().string,user:D().string,user_hash:D().string,workspace:D().string,submitted_at:D().oneOfType([D().string,D().number,D().instanceOf(Date)]),requested_resources:D().string,infra:D().string,full_infra:D().string,cloud:D().string,resources_str_full:D().string,resources_str:D().string,git_commit:D().string,pool:D().string,pool_hash:D().string,entrypoint:D().string,dag_yaml:D().string}),allTasks:D().array,activeTab:D().string,setIsLoadingLogs:D().func,setIsLoadingControllerLogs:D().func,isLoadingLogs:D().bool,isLoadingControllerLogs:D().bool,refreshFlag:D().number,poolsData:D().array,links:D().object,logExtractedLinks:D().object,onLinksExtracted:D().func,selectedTaskIndex:D().number,onTaskChange:D().func},t.default=function(){var e,t,s,u,g,f,j;let p=(0,l.useRouter)(),{job:w,tab:k}=p.query,[L,E]=(0,n.useState)(0),{jobData:R,loading:A}=(0,d.UA)(w,L),[D,O]=(0,n.useState)([]),[Z,U]=(0,n.useState)(!1),[F,G]=(0,n.useState)(!0),[H,W]=(0,n.useState)(!1),[q,B]=(0,n.useState)(!1),[Y,J]=(0,n.useState)(!1),[z,V]=(0,n.useState)(!1),[K,$]=(0,n.useState)(!1),[Q,X]=(0,n.useState)(0),[ee,et]=(0,n.useState)(0),[es,er]=(0,n.useState)(0),[en,ea]=(0,n.useState)("all"),[el,ec]=(0,n.useState)([]),[eo,ei]=(0,n.useState)({}),ed=(0,y.X)(),[eu,em]=(0,n.useState)(!1),[ex,eh]=(0,n.useState)(0);n.useEffect(()=>{!A&&F&&G(!1)},[A,F]),(0,n.useEffect)(()=>{(async function(){try{let e=await I.ZP.get(d.vs,[{}]);O(e.pools||[])}catch(e){console.error("Error fetching pools data:",e),O([])}})()},[]),(0,n.useEffect)(()=>{(async()=>{em(await (0,C.TO)())})()},[]);let eg=e=>{let t=document.getElementById(e);t&&t.scrollIntoView({behavior:"smooth"})};(0,n.useEffect)(()=>{V(!0)},[]),(0,n.useEffect)(()=>{if(!K){let e=new MutationObserver(()=>{let t=document.getElementById("logs-section"),s=document.getElementById("controller-logs-section");("logs"===k&&t||"controllerlogs"===k&&s)&&($(!0),e.disconnect())});return e.observe(document.body,{childList:!0,subtree:!0}),()=>e.disconnect()}},[K,k]),(0,n.useEffect)(()=>{if(p.isReady&&z&&K&&!Y){let e=setTimeout(()=>{"logs"===k?(eg("logs-section"),J(!0)):"controllerlogs"===k&&(eg("controller-logs-section"),J(!0))},800);return()=>clearTimeout(e)}},[p.isReady,k,Y,z,K]),(0,n.useEffect)(()=>{J(!1),$(!1)},[k]);let ef=async()=>{U(!0);try{E(e=>e+1),X(e=>e+1),et(e=>e+1),setGpuMetricsRefreshTrigger(e=>e+1)}catch(e){console.error("Error refreshing data:",e)}finally{U(!1)}},ej=(0,n.useMemo)(()=>{var e;return(null==R?void 0:null===(e=R.jobs)||void 0===e?void 0:e.filter(e=>String(e.id)===String(w)))||[]},[R,w]),ep=(0,n.useMemo)(()=>ej.map((e,t)=>{var s;return{index:t,task:e,hasMetrics:(null===(s=e.full_infra)||void 0===s?void 0:s.includes("Kubernetes"))&&!e.pool&&e.cluster_name_on_cloud}}),[ej]),eN=ep.some(e=>e.hasMetrics),eb=ej[ex]||ej[0],ev=(null==eb?void 0:eb.cluster_name_on_cloud)||(null===(e=ej[0])||void 0===e?void 0:e.cluster_name_on_cloud);if(!p.isReady)return(0,r.jsx)("div",{children:"Loading..."});let ey=(null==R?void 0:null===(t=R.jobs)||void 0===t?void 0:t.filter(e=>String(e.id)===String(w)))||[],ew=ey.length>0?ey[0]:null,e_=ey.length>1,ek=(null===(s=ey.find(e=>e.dag_yaml))||void 0===s?void 0:s.dag_yaml)||(null==ew?void 0:ew.dag_yaml),eL=(null===(u=ey.find(e=>e.entrypoint))||void 0===u?void 0:u.entrypoint)||(null==ew?void 0:ew.entrypoint),eE=(null===(g=ey.find(e=>e.is_job_group))||void 0===g?void 0:g.is_job_group)||(null==ew?void 0:ew.is_job_group)||ey.length>1,eI=(null===(f=ey.find(e=>e.execution))||void 0===f?void 0:f.execution)||(null==ew?void 0:ew.execution)||(e_?"parallel":null),eS=ew?{...ew,dag_yaml:ek,entrypoint:eL,execution:eI,is_job_group:eE}:null,eC=w?"Job: ".concat(w," | SkyPilot Dashboard"):"Job Details | SkyPilot Dashboard";return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(_(),{children:(0,r.jsx)("title",{children:eC})}),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsxs)("div",{className:"text-base flex items-center",children:[(0,r.jsx)(m(),{href:"/jobs",className:"text-sky-blue hover:underline",children:"Managed Jobs"}),(0,r.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,r.jsxs)(m(),{href:"/jobs/".concat(w),className:"text-sky-blue hover:underline",children:[w," ",(null==ew?void 0:ew.name)?"(".concat(ew.name,")"):"",e_&&(0,r.jsxs)("span",{className:"ml-2 text-xs text-gray-500 bg-gray-200 px-1.5 py-0.5 rounded",children:[ey.length," tasks"]})]})]}),(0,r.jsxs)("div",{className:"text-sm flex items-center",children:[(A||Z||H||q)&&(0,r.jsxs)("div",{className:"flex items-center mr-4",children:[(0,r.jsx)(a.Z,{size:15,className:"mt-0"}),(0,r.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading..."})]}),(0,r.jsx)(N.WH,{content:"Refresh",className:"text-muted-foreground",children:(0,r.jsxs)("button",{onClick:ef,disabled:A||Z,className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center h-8",children:[(0,r.jsx)(x.Z,{className:"w-4 h-4 mr-1.5"}),!ed&&(0,r.jsx)("span",{children:"Refresh"})]})})]})]}),A&&F?(0,r.jsxs)("div",{className:"flex items-center justify-center py-32",children:[(0,r.jsx)(a.Z,{size:20,className:"mr-2"}),(0,r.jsx)("span",{children:"Loading..."})]}):ew?(0,r.jsxs)("div",{className:"space-y-8",children:[(0,r.jsx)("div",{id:"details-section",children:(0,r.jsxs)(c.Zb,{children:[(0,r.jsx)("div",{className:"flex items-center justify-between px-4 pt-4",children:(0,r.jsx)("h3",{className:"text-lg font-semibold",children:"Details"})}),(0,r.jsx)("div",{className:"p-4",children:(0,r.jsx)(P,{jobData:eS,allTasks:ey,activeTab:"info",setIsLoadingLogs:W,setIsLoadingControllerLogs:B,isLoadingLogs:H,isLoadingControllerLogs:q,refreshFlag:0,poolsData:D,links:null==eS?void 0:eS.links,logExtractedLinks:eo,onLinksExtracted:ei})})]})}),e_&&(0,r.jsx)("div",{id:"tasks-section",className:"mt-6",children:(0,r.jsxs)(c.Zb,{children:[(0,r.jsx)("div",{className:"flex items-center justify-between px-4 pt-4",children:(0,r.jsxs)("h3",{className:"text-lg font-semibold flex items-center",children:["Tasks",(0,r.jsxs)("span",{className:"ml-2 text-sm font-normal text-gray-500",children:["(",ey.length," tasks)"]})]})}),(0,r.jsx)("div",{className:"p-4",children:(0,r.jsx)("div",{className:"overflow-x-auto rounded-lg border",children:(0,r.jsxs)(o.iA,{className:"min-w-full",children:[(0,r.jsx)(o.xD,{children:(0,r.jsxs)(o.SC,{children:[(0,r.jsx)(o.ss,{className:"whitespace-nowrap",children:"ID"}),(0,r.jsx)(o.ss,{className:"whitespace-nowrap",children:"Name"}),(0,r.jsx)(o.ss,{className:"whitespace-nowrap",children:"Status"}),(0,r.jsx)(o.ss,{className:"whitespace-nowrap",children:"Duration"}),(0,r.jsx)(o.ss,{className:"whitespace-nowrap",children:"Infra"}),(0,r.jsx)(o.ss,{className:"whitespace-nowrap",children:"Resources"}),(0,r.jsx)(o.ss,{className:"whitespace-nowrap",children:"Recoveries"}),(0,r.jsx)(o.ss,{className:"whitespace-nowrap",children:"Logs"})]})}),(0,r.jsx)(o.RM,{children:ey.map((e,t)=>(0,r.jsxs)(o.SC,{className:"hover:bg-gray-50",children:[(0,r.jsx)(o.pj,{children:(0,r.jsx)(m(),{href:"/jobs/".concat(w,"/").concat(t),className:"text-blue-600 hover:underline",children:t})}),(0,r.jsx)(o.pj,{children:(0,r.jsxs)(m(),{href:"/jobs/".concat(w,"/").concat(t),className:"text-blue-600 hover:underline",children:[e.task||"Job ".concat(t),ey.some(e=>!1===e.is_primary_in_job_group)&&!0===e.is_primary_in_job_group&&(0,r.jsx)("span",{className:"ml-1.5",children:(0,r.jsx)(v.N,{})})]})}),(0,r.jsx)(o.pj,{children:(0,r.jsx)(b.OE,{status:e.status})}),(0,r.jsx)(o.pj,{children:(0,N.LU)(e.job_duration)}),(0,r.jsx)(o.pj,{children:e.infra&&"-"!==e.infra?(0,r.jsx)(N.Md,{content:e.full_infra||e.infra,className:"text-sm text-muted-foreground",children:(0,r.jsxs)("span",{children:[e.cloud||e.infra.split("(")[0].trim(),e.infra.includes("(")&&(0,r.jsx)("span",{className:"text-gray-500",children:" "+e.infra.substring(e.infra.indexOf("("))})]})}):(0,r.jsx)("span",{children:"-"})}),(0,r.jsx)(o.pj,{children:(0,r.jsx)(N.Md,{content:e.requested_resources||e.resources_str_full||e.resources_str||"-",className:"text-sm text-muted-foreground",children:(0,r.jsx)("span",{children:e.requested_resources||e.resources_str||"-"})})}),(0,r.jsx)(o.pj,{children:e.recoveries||0}),(0,r.jsx)(o.pj,{children:(0,r.jsx)(N.WH,{content:"Download job logs",className:"text-muted-foreground",children:(0,r.jsx)("button",{onClick:()=>(0,d.jh)({jobId:parseInt(w),controller:!1}),className:"text-sky-blue hover:text-sky-blue-bright",children:(0,r.jsx)(h.Z,{className:"w-4 h-4"})})})})]},e.task_job_id))})]})})})]})}),eu&&eN&&(0,r.jsx)(T.l,{clusterNameOnCloud:ev,displayName:e_?"".concat((null==eb?void 0:eb.task)||(null==eb?void 0:eb.name)||ew.name," (Task ").concat(ex,")"):(null==eb?void 0:eb.task)||(null==eb?void 0:eb.name)||ew.name,storageKey:"skypilot-jobs-gpu-metrics-expanded",noMetricsMessage:(null==eb?void 0:eb.pool)?"GPU metrics are not available for pool jobs.":(null==eb?void 0:null===(j=eb.full_infra)||void 0===j?void 0:j.includes("Kubernetes"))?"No GPU metrics available for this task.":"GPU metrics are only available for Kubernetes tasks.",headerExtra:e_&&(0,r.jsxs)(i.Ph,{onValueChange:e=>eh(parseInt(e,10)),value:String(ex),children:[(0,r.jsx)(i.i4,{onClick:e=>e.stopPropagation(),"aria-label":"Task",className:"focus:ring-0 focus:ring-offset-0 h-8 w-auto min-w-[160px] text-sm ml-4",children:(0,r.jsx)(i.ki,{placeholder:"Select Task"})}),(0,r.jsx)(i.Bw,{children:ep.map(e=>{let{index:t,task:s,hasMetrics:n}=e;return(0,r.jsxs)(i.Ql,{value:String(t),disabled:!n,children:["Task ",t,s.task?": ".concat(s.task):"",n?"":" (no metrics)"]},t)})})]})}),(0,r.jsx)(S.j,{name:"jobs.detail.nodes",context:{clusterName:ew.current_cluster_name,clusterNameOnCloud:ew.cluster_name_on_cloud,nodeNames:ew.node_names,infra:ew.full_infra,status:ew.status},wrapperClassName:"mt-6"}),(0,r.jsx)("div",{id:"logs-section",className:"mt-6",children:(0,r.jsxs)(c.Zb,{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 pt-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsx)("h3",{className:"text-lg font-semibold",children:"Logs"}),e_&&(0,r.jsxs)(i.Ph,{onValueChange:e=>er(parseInt(e,10)),value:String(es),children:[(0,r.jsx)(i.i4,{"aria-label":"Task",className:"focus:ring-0 focus:ring-offset-0 h-8 w-auto min-w-[160px] text-sm",children:(0,r.jsx)(i.ki,{placeholder:"Select Task"})}),(0,r.jsx)(i.Bw,{children:ey.map((e,t)=>(0,r.jsxs)(i.Ql,{value:String(t),children:["Task ",t,e.task?": ".concat(e.task):""]},e.task_job_id||t))})]}),(0,r.jsxs)(i.Ph,{onValueChange:e=>ea(e),value:en,children:[(0,r.jsx)(i.i4,{"aria-label":"Node",className:"focus:ring-0 focus:ring-offset-0 h-8 w-auto min-w-[120px] text-sm",children:(0,r.jsx)(i.ki,{placeholder:"All Nodes"})}),(0,r.jsxs)(i.Bw,{children:[(0,r.jsx)(i.Ql,{value:"all",children:"All Nodes"}),el.map(e=>(0,r.jsx)(i.Ql,{value:e,children:e},e))]})]}),(0,r.jsx)("span",{className:"text-xs text-gray-500",children:"(Logs are not streaming; click refresh to fetch the latest logs.)"})]}),(0,r.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,r.jsx)(N.WH,{content:"Download all job logs (zip)",className:"text-muted-foreground",children:(0,r.jsx)("button",{onClick:()=>(0,d.jh)({jobId:parseInt(Array.isArray(w)?w[0]:w),controller:!1}),className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:(0,r.jsx)(h.Z,{className:"w-4 h-4"})})}),(0,r.jsx)(N.WH,{content:"Refresh logs",className:"text-muted-foreground",children:(0,r.jsx)("button",{onClick:()=>{X(e=>e+1)},disabled:H,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:(0,r.jsx)(x.Z,{className:"w-4 h-4 ".concat(H?"animate-spin":"")})})})]})]}),(0,r.jsx)("div",{className:"p-4",children:(0,r.jsx)(P,{jobData:e_?ey[es]:ew,allTasks:ey,activeTab:"logs",setIsLoadingLogs:W,setIsLoadingControllerLogs:B,isLoadingLogs:H,isLoadingControllerLogs:q,refreshFlag:Q,poolsData:D,selectedTaskIndex:e_?es:null,selectedNode:en,onNodesExtracted:ec,onLinksExtracted:ei})})]})}),(0,r.jsx)(S.j,{name:"jobs.detail.events",context:{jobId:ew.id},wrapperClassName:"mt-6"}),(0,r.jsx)(M,{jobId:w,detailJobData:ew,isLoadingControllerLogs:q,handleControllerLogsRefresh:()=>{et(e=>e+1)},setIsLoadingControllerLogs:B,setIsLoadingLogs:W,refreshControllerLogsFlag:ee,poolsData:D})]}):(0,r.jsx)("div",{className:"flex items-center justify-center py-32",children:(0,r.jsx)("span",{children:"Job not found"})})]})]})}},55988:function(e,t,s){"use strict";s.d(t,{j:function(){return a}});var r=s(85893);s(67294);var n=s(23800);function a(e){let{name:t,context:s={},fallback:a=null,wrapperClassName:l=""}=e,c=(0,n.dL)(t);return 0===c.length?a:(0,r.jsx)("div",{className:l||void 0,children:c.map(e=>{let t=e.component;return(0,r.jsx)(t,{...s},e.id)})})}},9008:function(e,t,s){e.exports=s(37219)}},function(e){e.O(0,[739,798,417,850,888,774,179],function(){return e(e.s=40479)}),_N_E=e.O()}]);