"use strict";(self.webpackChunk_kb_labs_workflow_entry=self.webpackChunk_kb_labs_workflow_entry||[]).push([["125"],{8679(e,t,r){r.d(t,{Ay:()=>l});var n=r(9312),a=r.n(n),i=r(7088),o=r.n(i)()(a());o.push([e.id,`/* ── Markdown editor ── */
.eKkdFRPP08w0ipmt {
  width: 100%;
  min-height: 200px;
  font-family: monospace;
  font-size: 13px;
  padding: 12px;
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-primary);
  resize: vertical;
  box-sizing: border-box;
}

.xlFaIxn8H1U2vmZd {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* ── Issues ── */
.EflSZ182vBIy0S2M {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pie3p6utzf8rTfUu {
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 6px;
}

.Al1WXNwqfC0ju3OY {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.qUayT4ACFY4Pv93l {
  font-size: 12px;
  color: var(--text-secondary);
  font-family: monospace;
}

.K5oooXXvNFAN7bDb {
  font-size: 13px;
  color: var(--text-primary);
}

.tArqFztlCu4cPnh5 {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  font-style: italic;
}

/* ── Log ── */
.xRIfIRB1FQYzXPeI {
  margin: 0;
  padding: 12px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.6;
  overflow: auto;
  background: #0d1117;
  color: #c9d1d9;
  font-family: monospace;
  max-height: 400px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Link ── */
.Fdjb7OQrUoEC9TE7 {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  font-size: 13px;
  color: var(--link);
  text-decoration: none;
  font-weight: 500;
  transition: background 0.15s;
}

.Fdjb7OQrUoEC9TE7:hover {
  background: var(--bg-tertiary, var(--bg-secondary));
  border-color: var(--link);
}

.MPGw8m2NoAVGUlis {
  font-size: 11px;
  opacity: 0.6;
}

/* ── Empty state ── */
.CQMnm5XuOUksgiz3 {
  color: var(--text-tertiary);
  font-size: 13px;
  padding: 12px;
}
`,"",{version:3,sources:["webpack://./src/studio/components/artifacts/artifacts.module.css"],names:[],mappings:"AAAA,0BAA0B;AAC1B;EACE,WAAW;EACX,iBAAiB;EACjB,sBAAsB;EACtB,eAAe;EACf,aAAa;EACb,uCAAuC;EACvC,kBAAkB;EAClB,6BAA6B;EAC7B,0BAA0B;EAC1B,gBAAgB;EAChB,sBAAsB;AACxB;;AAEA;EACE,aAAa;EACb,QAAQ;EACR,eAAe;AACjB;;AAEA,iBAAiB;AACjB;EACE,aAAa;EACb,sBAAsB;EACtB,QAAQ;AACV;;AAEA;EACE,iBAAiB;EACjB,+BAA+B;EAC/B,uCAAuC;EACvC,kBAAkB;AACpB;;AAEA;EACE,aAAa;EACb,mBAAmB;EACnB,QAAQ;EACR,kBAAkB;AACpB;;AAEA;EACE,eAAe;EACf,4BAA4B;EAC5B,sBAAsB;AACxB;;AAEA;EACE,eAAe;EACf,0BAA0B;AAC5B;;AAEA;EACE,eAAe;EACf,4BAA4B;EAC5B,eAAe;EACf,kBAAkB;AACpB;;AAEA,cAAc;AACd;EACE,SAAS;EACT,aAAa;EACb,kBAAkB;EAClB,eAAe;EACf,gBAAgB;EAChB,cAAc;EACd,mBAAmB;EACnB,cAAc;EACd,sBAAsB;EACtB,iBAAiB;EACjB,qBAAqB;EACrB,sBAAsB;AACxB;;AAEA,eAAe;AACf;EACE,oBAAoB;EACpB,mBAAmB;EACnB,QAAQ;EACR,iBAAiB;EACjB,+BAA+B;EAC/B,uCAAuC;EACvC,kBAAkB;EAClB,eAAe;EACf,kBAAkB;EAClB,qBAAqB;EACrB,gBAAgB;EAChB,4BAA4B;AAC9B;;AAEA;EACE,mDAAmD;EACnD,yBAAyB;AAC3B;;AAEA;EACE,eAAe;EACf,YAAY;AACd;;AAEA,sBAAsB;AACtB;EACE,2BAA2B;EAC3B,eAAe;EACf,aAAa;AACf",sourcesContent:["/* ── Markdown editor ── */\n.textarea {\n  width: 100%;\n  min-height: 200px;\n  font-family: monospace;\n  font-size: 13px;\n  padding: 12px;\n  border: 1px solid var(--border-primary);\n  border-radius: 6px;\n  background: var(--bg-primary);\n  color: var(--text-primary);\n  resize: vertical;\n  box-sizing: border-box;\n}\n\n.editActions {\n  display: flex;\n  gap: 8px;\n  margin-top: 8px;\n}\n\n/* ── Issues ── */\n.issueList {\n  display: flex;\n  flex-direction: column;\n  gap: 8px;\n}\n\n.issueItem {\n  padding: 8px 12px;\n  background: var(--bg-secondary);\n  border: 1px solid var(--border-primary);\n  border-radius: 6px;\n}\n\n.issueHeader {\n  display: flex;\n  align-items: center;\n  gap: 8px;\n  margin-bottom: 4px;\n}\n\n.issueFile {\n  font-size: 12px;\n  color: var(--text-secondary);\n  font-family: monospace;\n}\n\n.issueMessage {\n  font-size: 13px;\n  color: var(--text-primary);\n}\n\n.issueFix {\n  font-size: 12px;\n  color: var(--text-secondary);\n  margin-top: 4px;\n  font-style: italic;\n}\n\n/* ── Log ── */\n.logPre {\n  margin: 0;\n  padding: 12px;\n  border-radius: 6px;\n  font-size: 13px;\n  line-height: 1.6;\n  overflow: auto;\n  background: #0d1117;\n  color: #c9d1d9;\n  font-family: monospace;\n  max-height: 400px;\n  white-space: pre-wrap;\n  word-break: break-word;\n}\n\n/* ── Link ── */\n.link {\n  display: inline-flex;\n  align-items: center;\n  gap: 6px;\n  padding: 5px 12px;\n  background: var(--bg-secondary);\n  border: 1px solid var(--border-primary);\n  border-radius: 6px;\n  font-size: 13px;\n  color: var(--link);\n  text-decoration: none;\n  font-weight: 500;\n  transition: background 0.15s;\n}\n\n.link:hover {\n  background: var(--bg-tertiary, var(--bg-secondary));\n  border-color: var(--link);\n}\n\n.linkArrow {\n  font-size: 11px;\n  opacity: 0.6;\n}\n\n/* ── Empty state ── */\n.empty {\n  color: var(--text-tertiary);\n  font-size: 13px;\n  padding: 12px;\n}\n"],sourceRoot:""}]);let l=o},7088(e){e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var r="",n=void 0!==t[5];return t[4]&&(r+="@supports (".concat(t[4],") {")),t[2]&&(r+="@media ".concat(t[2]," {")),n&&(r+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),r+=e(t),n&&(r+="}"),t[2]&&(r+="}"),t[4]&&(r+="}"),r}).join("")},t.i=function(e,r,n,a,i){"string"==typeof e&&(e=[[null,e,void 0]]);var o={};if(n)for(var l=0;l<this.length;l++){var s=this[l][0];null!=s&&(o[s]=!0)}for(var u=0;u<e.length;u++){var c=[].concat(e[u]);n&&o[c[0]]||(void 0!==i&&(void 0===c[5]||(c[1]="@layer".concat(c[5].length>0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=i),r&&(c[2]&&(c[1]="@media ".concat(c[2]," {").concat(c[1],"}")),c[2]=r),a&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=a):c[4]="".concat(a)),t.push(c))}},t}},9312(e){e.exports=function(e){var t=e[1],r=e[3];if(!r)return t;if("function"==typeof btoa){var n=btoa(unescape(encodeURIComponent(JSON.stringify(r))));return[t].concat(["/*# ".concat("sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(n)," */")]).join("\n")}return[t].join("\n")}},7091(e){var t=[];function r(e){for(var r=-1,n=0;n<t.length;n++)if(t[n].identifier===e){r=n;break}return r}function n(e,n){for(var a={},i=[],o=0;o<e.length;o++){var l=e[o],s=n.base?l[0]+n.base:l[0],u=a[s]||0,c="".concat(s," ").concat(u);a[s]=u+1;var d=r(c),p={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==d)t[d].references++,t[d].updater(p);else{var f=function(e,t){var r=t.domAPI(t);return r.update(e),function(t){t?(t.css!==e.css||t.media!==e.media||t.sourceMap!==e.sourceMap||t.supports!==e.supports||t.layer!==e.layer)&&r.update(e=t):r.remove()}}(p,n);n.byIndex=o,t.splice(o,0,{identifier:c,updater:f,references:1})}i.push(c)}return i}e.exports=function(e,a){var i=n(e=e||[],a=a||{});return function(e){e=e||[];for(var o=0;o<i.length;o++){var l=r(i[o]);t[l].references--}for(var s=n(e,a),u=0;u<i.length;u++){var c=r(i[u]);0===t[c].references&&(t[c].updater(),t.splice(c,1))}i=s}}},6340(e){var t={};e.exports=function(e,r){var n=function(e){if(void 0===t[e]){var r=document.querySelector(e);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(e){r=null}t[e]=r}return t[e]}(e);if(!n)throw Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(r)}},8023(e){e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},9667(e,t,r){e.exports=function(e){var t=r.nc;t&&e.setAttribute("nonce",t)}},7464(e){e.exports=function(e){if("u"<typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(r){var n,a,i;n="",r.supports&&(n+="@supports (".concat(r.supports,") {")),r.media&&(n+="@media ".concat(r.media," {")),(a=void 0!==r.layer)&&(n+="@layer".concat(r.layer.length>0?" ".concat(r.layer):""," {")),n+=r.css,a&&(n+="}"),r.media&&(n+="}"),r.supports&&(n+="}"),(i=r.sourceMap)&&"u">typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),e.styleTagTransform(n,t,e.options)},remove:function(){var e;null===(e=t).parentNode||e.parentNode.removeChild(e)}}}},6100(e){e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},1632(e,t,r){r.r(t),r.d(t,{default:()=>eJ});var n=r(4552),a=r(1349),i=r(2913),o=r(6831),l=r(2383),s=r(8292);function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function c(e,t,r,n,a,i,o){try{var l=e[i](o),s=l.value}catch(e){r(e);return}l.done?t(s):Promise.resolve(s).then(n,a)}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var i=[],o=!0,l=!1;try{for(a=a.call(e);!(o=(r=a.next()).done)&&(i.push(r.value),!t||i.length!==t);o=!0);}catch(e){l=!0,n=e}finally{try{o||null==a.return||a.return()}finally{if(l)throw n}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return u(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var p=a.UITypographyText,f=a.UITypographyParagraph,y=a.UITitle,g=a.UIInputTextArea;function v(e){var t,r,o,l,s=e.step,u=(e.runId,e.open),v=e.onClose,x=e.onResolve,m=e.isLoading,h=e.error,b=d((0,i.useState)(""),2),A=b[0],j=b[1],w=d((0,i.useState)(null),2),k=w[0],C=w[1],I=null!=(r=null==s||null==(l=s.spec)?void 0:l.with)?r:{},S="string"==typeof I.title?I.title:null!=(o=null==s?void 0:s.name)?o:"Approval Required",B="string"==typeof I.instructions?I.instructions:null,E="object"==((t=I.context)&&"u">typeof Symbol&&t.constructor===Symbol?"symbol":typeof t)&&null!==I.context?I.context:null,T=function(e){var t;return(t=function(){return function(e,t){var r,n,a,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(o,"next",{value:s(0)}),l(o,"throw",{value:s(1)}),l(o,"return",{value:s(2)}),"function"==typeof Symbol&&l(o,Symbol.iterator,{value:function(){return this}}),o;function s(l){return function(s){var u=[l,s];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(i=0)),i;)try{if(r=1,n&&(a=2&u[0]?n.return:u[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,u[1])).done)return a;switch(n=0,a&&(u=[2&u[0],a.value]),u[0]){case 0:case 1:a=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,n=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(a=(a=i.trys).length>0&&a[a.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!a||u[1]>a[0]&&u[1]<a[3])){i.label=u[1];break}if(6===u[0]&&i.label<a[1]){i.label=a[1],a=u;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(u);break}a[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],n=0}finally{r=a=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(t){switch(t.label){case 0:C(e),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,x(e,A.trim()||void 0)];case 2:return t.sent(),j(""),C(null),[3,4];case 3:return t.sent(),C(null),[3,4];case 4:return[2]}})},function(){var e=this,r=arguments;return new Promise(function(n,a){var i=t.apply(e,r);function o(e){c(i,n,a,o,l,"next",e)}function l(e){c(i,n,a,o,l,"throw",e)}o(void 0)})})()};return(0,n.jsxs)(a.UIModal,{open:u,title:S,width:"large",maskClosable:!1,onCancel:v,footer:null,children:[B&&(0,n.jsx)(f,{style:{marginBottom:16},children:(0,n.jsx)(p,{type:"secondary",children:B})}),E&&Object.keys(E).length>0&&(0,n.jsxs)("div",{style:{marginBottom:16},children:[(0,n.jsx)(y,{level:5,style:{marginBottom:8},children:"Context"}),(0,n.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:Object.entries(E).map(function(e){var t=d(e,2),r=t[0],a=t[1];return(0,n.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,n.jsxs)(p,{strong:!0,style:{minWidth:100,textTransform:"capitalize"},children:[r.replace(/([A-Z])/g," $1").trim(),":"]}),(0,n.jsx)(p,{children:String(null!=a?a:"—")})]},r)})})]}),h&&(0,n.jsx)(a.UIAlert,{variant:"error",message:h.message,style:{marginBottom:16},showIcon:!0}),(0,n.jsxs)("div",{style:{marginBottom:16},children:[(0,n.jsx)(y,{level:5,style:{marginBottom:8},children:"Comment (optional)"}),(0,n.jsx)(g,{rows:3,placeholder:"Add a comment for the record...",value:A,onChange:function(e){return j(e.target.value)},disabled:m})]}),(0,n.jsxs)("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[(0,n.jsx)(a.UIButton,{onClick:v,disabled:m,children:"Cancel"}),(0,n.jsx)(a.UIButton,{danger:!0,onClick:function(){T("reject")},loading:m&&"reject"===k,disabled:m&&"reject"!==k,children:"Reject"}),(0,n.jsx)(a.UIButton,{variant:"primary",onClick:function(){T("approve")},loading:m&&"approve"===k,disabled:m&&"approve"!==k,children:"Approve"})]})]})}var x=r(7205);function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var h=a.UITypographyText,b={queued:"Queued",running:"Running...",success:"Completed",failed:"Failed",cancelled:"Cancelled",skipped:"Skipped",waiting_approval:"Waiting for your decision"},A={queued:"var(--text-tertiary)",running:"var(--warning)",success:"var(--success)",failed:"var(--error)",cancelled:"var(--text-tertiary)",skipped:"var(--text-tertiary)",waiting_approval:"var(--info)"},j=/\x1b\[[0-9;]*[A-Za-z]|\x1b\].*?\x07/g;function w(e){return e.replace(j,"")}function k(e){var t=e.timestamp?new Date(e.timestamp).toLocaleTimeString("en-US",{hour12:!1}):"",r=e.payload;if(!r)return[];if("log.appended"===e.type){var n,a,i,o,l,s="string"==typeof r.message?w(r.message):"";return s?[{time:t,text:s,stream:null!=(l=r.stream)?l:"stdout"}]:[]}var u=null!=(n=null==(i=r.outputs)?void 0:i.stdout)?n:r.stdout;if("string"==typeof u&&u.trim())return w(u).trim().split("\n").map(function(e){return{time:t,text:e,stream:"stdout"}});var c=null!=(a=null==(o=r.outputs)?void 0:o.stderr)?a:r.stderr;return"string"==typeof c&&c.trim()?w(c).trim().split("\n").map(function(e){return{time:t,text:e,stream:"stderr"}}):"string"==typeof r.error?[{time:t,text:r.error,stream:"stderr"}]:"string"==typeof r.message?[{time:t,text:r.message}]:"string"==typeof r.line?[{time:t,text:r.line}]:"string"==typeof r.text?[{time:t,text:r.text}]:[]}var C=new Set(["stdout","stderr","exitCode","ok"]);function I(e){var t,r,o,l,s=e.step,u=e.events,c=e.open,d=e.onClose,p=e.onApprove,f=(0,i.useMemo)(function(){return u.flatMap(k)},[u]),y=(0,i.useRef)(null);(0,i.useEffect)(function(){var e=y.current;e&&e.scrollHeight-e.scrollTop-e.clientHeight<80&&(e.scrollTop=e.scrollHeight)},[f.length]);var g=(0,i.useMemo)(function(){if(!(null==s?void 0:s.outputs)||f.length>0)return[];var e=[],t=s.outputs,r=t.stdout,n=t.stderr;if("string"==typeof r&&r.trim()&&r.trim().split("\n").forEach(function(t){return e.push({time:"",text:t})}),"string"==typeof n&&n.trim()&&n.trim().split("\n").forEach(function(t){return e.push({time:"",text:t})}),0===e.length){var a=Object.keys(s.outputs).filter(function(e){return!C.has(e)});a.length>0&&e.push({time:"",text:"Output: { ".concat(a.join(", ")," }")})}return e},[null==s?void 0:s.outputs,f.length]),v=f.length>0?f:g,x=(0,i.useMemo)(function(){if(!(null==s?void 0:s.outputs))return null;var e={},t=!0,r=!1,n=void 0;try{for(var a,i=Object.entries(s.outputs)[Symbol.iterator]();!(t=(a=i.next()).done);t=!0){var o,l=(o=a.value,function(e){if(Array.isArray(e))return e}(o)||function(e){var t,r,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a=[],i=!0,o=!1;try{for(n=n.call(e);!(i=(t=n.next()).done)&&(a.push(t.value),2!==a.length);i=!0);}catch(e){o=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(o)throw r}}return a}}(o)||function(e){if(e){if("string"==typeof e)return m(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return m(e,2)}}(o)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=l[0],c=l[1];C.has(u)||(e[u]=c)}}catch(e){r=!0,n=e}finally{try{t||null==i.return||i.return()}finally{if(r)throw n}}return Object.keys(e).length>0?e:null},[null==s?void 0:s.outputs]),j=(null==s||null==(l=s.spec)?void 0:l.with)!=null&&Object.keys(s.spec.with).length>0,w=(null==s?void 0:s.error)!=null,I=null!==x,S=(0,n.jsx)("div",{style:{fontFamily:"monospace",fontSize:12},children:v.length>0?(0,n.jsx)("pre",{ref:y,style:{margin:0,padding:"8px 12px",background:"#0d1117",color:"#c9d1d9",borderRadius:4,overflow:"auto",maxHeight:500,whiteSpace:"pre-wrap",wordBreak:"break-word",lineHeight:1.6},children:v.map(function(e,t){return(0,n.jsxs)("span",{children:[e.time&&(0,n.jsx)("span",{style:{color:"var(--text-tertiary)",userSelect:"none",marginRight:12},children:e.time}),(0,n.jsx)("span",{style:"stderr"===e.stream?{color:"#f85149"}:void 0,children:e.text}),"\n"]},t)})}):(0,n.jsx)(h,{type:"secondary",style:{fontSize:12},children:(null==s?void 0:s.status)==="running"?"Waiting for output...":(null==s?void 0:s.status)==="queued"?"Not started yet":(null==s?void 0:s.status)==="waiting_approval"?"Waiting for approval":"No output"})}),B=[{key:"log",label:"Log",children:S}];I&&B.push({key:"data",label:"Data",children:(0,n.jsx)(a.UIJsonViewer,{data:x})}),j&&B.push({key:"inputs",label:"Inputs",children:(0,n.jsx)(a.UIJsonViewer,{data:s.spec.with})}),w&&B.push({key:"error",label:"Error",children:(0,n.jsx)(a.UIJsonViewer,{data:s.error})});var E=A[null!=(t=null==s?void 0:s.status)?t:"queued"],T=function(e){if(!e)return null;if(e<1e3)return"".concat(e,"ms");var t=e/1e3;return t<60?"".concat(t.toFixed(1),"s"):"".concat(Math.floor(t/60),"m ").concat(Math.floor(t%60),"s")}(null==s?void 0:s.durationMs);return(0,n.jsx)(a.UIDrawer,{open:c,onClose:d,title:(0,n.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[(0,n.jsx)("span",{style:{fontSize:14,fontWeight:600},children:null!=(r=null==s?void 0:s.name)?r:""}),(0,n.jsxs)("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[(0,n.jsx)("span",{style:{fontSize:12,color:E,fontWeight:600},children:b[null!=(o=null==s?void 0:s.status)?o:"queued"]}),T&&(0,n.jsx)("span",{style:{fontSize:12,color:"var(--text-tertiary)"},children:T})]})]}),placement:"right",width:520,footer:(null==s?void 0:s.status)==="waiting_approval"&&p?(0,n.jsx)("div",{style:{display:"flex",justifyContent:"flex-end"},children:(0,n.jsx)(a.UIButton,{variant:"primary",onClick:p,children:"Review & Decide"})}):null,children:s&&(B.length>1?(0,n.jsx)(a.UITabs,{items:B,size:"small",defaultActiveKey:"log"}):S)})}function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function B(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var i=[],o=!0,l=!1;try{for(a=a.call(e);!(o=(r=a.next()).done)&&(i.push(r.value),!t||i.length!==t);o=!0);}catch(e){l=!0,n=e}finally{try{o||null==a.return||a.return()}finally{if(l)throw n}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return S(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return S(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var E=!1,T={queued:"var(--text-tertiary)",running:"var(--warning)",success:"var(--success)",failed:"var(--error)",cancelled:"var(--text-tertiary)",skipped:"var(--text-tertiary)",waiting_approval:"var(--info)"},U={queued:"Queued",running:"Running",success:"Done",failed:"Failed",cancelled:"Cancelled",skipped:"Skipped",waiting_approval:"Review"};function R(e){var t,r=e.status;if(!E&&"u">typeof document){E=!0;var a=document.createElement("style");a.textContent="\n@keyframes kb-spin    { 0% { transform: rotate(0deg) } 100% { transform: rotate(360deg) } }\n@keyframes kb-shimmer { 0% { left: -60% } 100% { left: 120% } }\n",document.head.appendChild(a)}var i=null!=(t=T[r])?t:"var(--text-tertiary)";return"running"===r?(0,n.jsx)("span",{style:{display:"inline-block",width:8,height:8,flexShrink:0,border:"2px solid ".concat(i),borderTopColor:"transparent",borderRadius:"50%",animation:"kb-spin 0.8s linear infinite"}}):(0,n.jsx)("span",{style:{display:"inline-block",width:8,height:8,flexShrink:0,borderRadius:"50%",background:"success"===r||"failed"===r||"waiting_approval"===r?i:"transparent",border:"2px solid ".concat(i)}})}function z(e){if(!e)return null;if(e<1e3)return"".concat(e,"ms");var t=e/1e3;return t<60?"".concat(t.toFixed(1),"s"):"".concat(Math.floor(t/60),"m ").concat(Math.floor(t%60),"s")}var M={Planning:"var(--info)",Implementation:"var(--success)",Quality:"var(--warning)",Delivery:"var(--link)"};function O(e){var t,r,a,i=e.stepRun,o=e.targetStepName,l=i.outputs,s=i.error,u=null!=(t=null==l?void 0:l.action)?t:"failed"===i.status?"fail":void 0,c=null==l?void 0:l.decisionValue,d=null==l?void 0:l.iteration;if(!u||"continue"===u)return null;var p="restart"===u,f=p?"var(--warning)":"var(--error)",y="string"==typeof(null==s?void 0:s.message)?s.message:null,g=null!=(r=null==l?void 0:l.maxIterationsReached)?r:null!=(a=null==y?void 0:y.toLowerCase().includes("max iteration"))&&a;return(0,n.jsxs)("div",{style:{margin:"2px 0 4px 18px",padding:"8px 12px",background:p?"color-mix(in srgb, var(--warning) 6%, var(--bg-secondary))":"color-mix(in srgb, var(--error) 6%, var(--bg-secondary))",border:"1px solid color-mix(in srgb, ".concat(f," 25%, transparent)"),borderRadius:5,fontSize:12,lineHeight:1.6},children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:4},children:[(0,n.jsx)("span",{style:{color:f,fontWeight:600},children:p?"↩ Returned for rework":"✗ Gate failed"}),void 0!==d&&(0,n.jsxs)("span",{style:{color:"var(--text-tertiary)",background:"var(--bg-tertiary)",padding:"0 5px",borderRadius:4,fontSize:11},children:["iteration ",d+1]})]}),null!=c&&(0,n.jsxs)("div",{style:{color:"var(--text-secondary)"},children:[(0,n.jsx)("span",{style:{color:"var(--text-tertiary)"},children:"Decision: "}),(0,n.jsx)("code",{style:{fontSize:11,background:"var(--bg-tertiary)",padding:"0 4px",borderRadius:3,color:f,fontFamily:"monospace"},children:String(c)})]}),p&&o&&(0,n.jsxs)("div",{style:{color:"var(--text-secondary)",marginTop:2},children:[(0,n.jsx)("span",{style:{color:"var(--text-tertiary)"},children:"Restarting from: "}),(0,n.jsx)("span",{style:{fontWeight:500},children:o})]}),g&&(0,n.jsx)("div",{style:{color:"var(--error)",marginTop:2},children:"Max iterations reached — pipeline stopped"}),y&&!g&&(0,n.jsx)("div",{style:{color:"var(--text-secondary)",marginTop:2,fontStyle:"italic"},children:y})]})}function N(e){var t,r,a,i=e.step,o=e.isReworkGate,l=e.isReworkTarget,s=e.reworkActive,u=e.targetStepName,c=e.onClick,d=e.rowRef,p=i.stepRun,f=i.stepType,y=i.iteration,g=p.status,v="waiting_approval"===g,x="failed"===g,m="running"===g,h="queued"===g,b="approval"===f,A="gate"===f,j=A?p.outputs:void 0,w=null==j?void 0:j.action,k=v?{bg:"color-mix(in srgb, var(--info) 5%, var(--bg-secondary))",border:"var(--info)"}:x?{bg:"color-mix(in srgb, var(--error) 5%, var(--bg-secondary))",border:"var(--error)"}:l&&s?{bg:"color-mix(in srgb, var(--warning) 5%, var(--bg-secondary))",border:"var(--warning)"}:null;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{ref:d,onClick:c,style:{display:"flex",alignItems:"center",gap:10,padding:k?"10px 14px":"7px 14px",marginLeft:28*!!b,borderRadius:6,background:null!=(t=null==k?void 0:k.bg)?t:"transparent",border:k?"1px solid ".concat(k.border):"1px solid transparent",cursor:"pointer",position:"relative",overflow:"hidden",transition:"background 0.1s"},onMouseEnter:function(e){k||(e.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:function(e){k||(e.currentTarget.style.background="transparent")},children:[m&&(0,n.jsx)("div",{style:{position:"absolute",top:0,left:0,height:2,width:"45%",background:"linear-gradient(90deg, transparent, var(--warning), transparent)",animation:"kb-shimmer 1.4s ease-in-out infinite"}}),(0,n.jsx)(R,{status:g}),(0,n.jsxs)("span",{style:{flex:1,fontSize:14,color:h?"var(--text-tertiary)":"var(--text-primary)",fontWeight:v||x?500:400,fontStyle:A?"italic":"normal"},children:[b&&(0,n.jsx)("span",{style:{color:"var(--info)",marginRight:5,fontStyle:"normal",fontSize:12},children:"⏸"}),p.name]}),(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,flexShrink:0},children:[o&&y&&(0,n.jsxs)("span",{style:{fontSize:11,fontWeight:600,color:"var(--warning)",background:"color-mix(in srgb, var(--warning) 12%, transparent)",padding:"1px 7px",borderRadius:8},children:["↩ ",y.current,"/",y.max]}),z(p.durationMs)&&(0,n.jsx)("span",{style:{fontSize:12,color:"var(--text-tertiary)"},children:z(p.durationMs)}),v?(0,n.jsx)("span",{style:{fontSize:12,fontWeight:600,color:"var(--info)",background:"color-mix(in srgb, var(--info) 12%, transparent)",padding:"2px 9px",borderRadius:8},children:"Review"}):(0,n.jsx)("span",{style:{fontSize:12,color:null!=(r=T[g])?r:"var(--text-tertiary)",minWidth:44,textAlign:"right"},children:null!=(a=U[g])?a:g})]})]}),A&&("restart"===w||"fail"===w||x)&&(0,n.jsx)(O,{stepRun:p,targetStepName:u})]})}function _(e){var t=e.gateEl,r=e.targetEl,a=e.containerEl,o=e.isActive,l=B((0,i.useState)(null),2),s=l[0],u=l[1];if((0,i.useEffect)(function(){if(t&&r&&a){var e=function(){var e=a.getBoundingClientRect(),n=t.getBoundingClientRect(),i=r.getBoundingClientRect();u({top:i.top-e.top+i.height/2,height:Math.max(0,n.top-e.top+n.height/2-(i.top-e.top+i.height/2))})};e();var n=new ResizeObserver(e);return n.observe(a),n.observe(t),n.observe(r),function(){return n.disconnect()}}},[t,r,a]),!s||s.height<8)return null;var c=o?"var(--warning)":"var(--border-primary)";return(0,n.jsx)("div",{style:{position:"absolute",left:0,top:s.top,width:8,height:s.height,pointerEvents:"none"},children:(0,n.jsxs)("svg",{width:8,height:s.height,overflow:"visible",children:[(0,n.jsx)("line",{x1:5,y1:0,x2:5,y2:s.height,stroke:c,strokeWidth:o?2:1.5,strokeDasharray:o?void 0:"3 3"}),(0,n.jsx)("polygon",{points:"2,6 5,0 8,6",fill:c})]})})}function W(e){var t,r,a=e.run,o=e.events,l=e.onApprove,s=(0,x.F)(a),u=B((0,i.useState)(null),2),c=u[0],d=u[1],p=(0,i.useRef)(null),f=(0,i.useRef)(new Map);if(!s.steps.length)return(0,n.jsx)("div",{style:{padding:"24px 0",color:"var(--text-tertiary)",fontSize:14},children:"No execution data yet."});var y=s.reworkLoop,g=y?s.steps[y.gateIndex]:null,v=y?s.steps[y.targetIndex]:null,m=o.filter(function(e){return e.stepId===(null==c?void 0:c.id)});return(0,n.jsxs)("div",{ref:p,style:{position:"relative",paddingLeft:10},children:[y&&g&&v&&(0,n.jsx)(_,{gateEl:null!=(t=f.current.get(g.stepRun.id))?t:null,targetEl:null!=(r=f.current.get(v.stepRun.id))?r:null,containerEl:p.current,isActive:y.isActive}),s.phases.map(function(e,t){var r,a=null!=(r=M[e.label])?r:"var(--text-tertiary)",i=e.steps.filter(function(e){return"success"===e.stepRun.status}).length,o=t===s.phases.length-1;return(0,n.jsxs)("div",{style:{marginBottom:20*!o},children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"0 4px",marginBottom:4},children:[(0,n.jsx)("div",{style:{width:3,height:12,background:a,borderRadius:2,flexShrink:0}}),(0,n.jsx)("span",{style:{fontSize:11,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.09em",color:a},children:e.label}),(0,n.jsxs)("span",{style:{fontSize:11,color:"var(--text-tertiary)",marginLeft:4},children:[i,"/",e.steps.length]})]}),(0,n.jsx)("div",{style:{borderLeft:"2px solid color-mix(in srgb, ".concat(a," 25%, var(--border-primary))"),marginLeft:5,paddingLeft:12,paddingTop:2,paddingBottom:2},children:e.steps.map(function(e){var t,r,a=s.steps.indexOf(e),i=(null==y?void 0:y.gateIndex)===a;return(0,n.jsx)(N,{step:e,isReworkGate:null!=i&&i,isReworkTarget:(null==y?void 0:y.targetIndex)===a,reworkActive:null!=(r=null==y?void 0:y.isActive)&&r,targetStepName:i?null==v?void 0:v.stepRun.name:void 0,onClick:function(){return d(e.stepRun)},rowRef:(t=e.stepRun.id,function(e){e?f.current.set(t,e):f.current.delete(t)})},e.stepRun.id)})})]},e.label)}),(0,n.jsx)(I,{step:c,events:m,open:null!==c,onClose:function(){return d(null)},onApprove:(null==c?void 0:c.status)==="waiting_approval"&&l?function(){l(c),d(null)}:void 0})]})}var D=r(9747),L=r(5688);function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function F(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var i=[],o=!0,l=!1;try{for(a=a.call(e);!(o=(r=a.next()).done)&&(i.push(r.value),!t||i.length!==t);o=!0);}catch(e){l=!0,n=e}finally{try{o||null==a.return||a.return()}finally{if(l)throw n}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return P(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return P(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var q={pre:"background:#f6f8fa;border:1px solid #d0d7de;border-radius:6px;padding:12px;overflow:auto;font-size:12px;line-height:1.5;font-family:monospace;margin:8px 0",code:"background:#f0f0f0;border-radius:3px;padding:1px 4px;font-size:0.9em;font-family:monospace",link:"color:var(--link)",h1:"margin:0 0 12px;font-size:17px;font-weight:700;scroll-margin-top:64px",h2:"margin:16px 0 8px;font-size:15px;font-weight:700;scroll-margin-top:64px",h3:"margin:14px 0 6px;font-size:14px;font-weight:600;scroll-margin-top:64px",h4:"margin:12px 0 4px;font-size:13px;font-weight:600;scroll-margin-top:64px",ul:"margin:6px 0;padding-left:20px",ol:"margin:6px 0;padding-left:20px",li:"margin:2px 0",hr:"border:none;border-top:1px solid var(--border-primary);margin:12px 0",p:"margin:6px 0;line-height:1.6"};function H(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function J(e,t){var r=t.toLowerCase().replace(/[^\w\s-]/g,"").trim().replace(/\s+/g,"-"),n=q["h".concat(e)];return"<h".concat(e,' id="').concat(r,'" style="').concat(n,'">').concat(t,"</h").concat(e,">")}function Q(e,t){var r=t?/^[ \t]*\d+\. /:/^[ \t]*[-*+] /,n=e.trim().split("\n").map(function(e){return'<li style="'.concat(q.li,'">').concat(e.replace(r,""),"</li>")}).join(""),a=t?"ol":"ul";return"<".concat(a,' style="').concat(q[a],'">').concat(n,"</").concat(a,">")}function $(e){var t,r,o=e.data,l=e.editable,s=e.onEdit,u="string"==typeof o?o:null==o?"":JSON.stringify(o,null,2),c=F((0,i.useState)(!1),2),d=c[0],p=c[1],f=F((0,i.useState)(u),2),y=f[0],g=f[1];return d&&l?(0,n.jsxs)("div",{children:[(0,n.jsx)("textarea",{value:y,onChange:function(e){return g(e.target.value)},style:{width:"100%",minHeight:200,fontFamily:"monospace",fontSize:13,padding:12,border:"1px solid var(--border-primary)",borderRadius:6,background:"var(--bg-primary)",color:"var(--text-primary)",resize:"vertical",boxSizing:"border-box"}}),(0,n.jsxs)("div",{style:{display:"flex",gap:8,marginTop:8},children:[(0,n.jsx)(a.UIButton,{size:"small",variant:"primary",onClick:function(){null==s||s(y),p(!1)},children:"Save"}),(0,n.jsx)(a.UIButton,{size:"small",variant:"default",onClick:function(){g(u),p(!1)},children:"Cancel"})]})]}):(0,n.jsxs)("div",{style:{position:"relative"},children:[l&&(0,n.jsx)(a.UIButton,{size:"small",variant:"text",style:{float:"right"},onClick:function(){return p(!0)},children:"Edit"}),(0,n.jsx)("div",{style:{fontSize:13,lineHeight:1.6,color:"var(--text-primary)"},dangerouslySetInnerHTML:{__html:(t=[],r=u.replace(/```[\w]*\n?([\s\S]*?)```/g,function(e,r){var n=t.length;return t.push('<pre style="'.concat(q.pre,'">').concat(H(r.replace(/\n$/,"")),"</pre>")),"\0CODE".concat(n,"\0")}),r=(r=(r=(r=(r=(r=(r=(r=(r=(r=(r=(r=(r=(r=(r=(r=H(r)).replace(/`([^`]+)`/g,function(e,t){return'<code style="'.concat(q.code,'">').concat(t,"</code>")})).replace(/\[([^\]]+)\]\(([^)]+)\)/g,function(e,t,r){var n,a=r.replace(/&amp;/g,"&");return a.startsWith("#")?(n=a.slice(1),'<a href="#'.concat(n,'" onclick="event.preventDefault();document.getElementById(\'').concat(n,"')?.scrollIntoView({behavior:'smooth'})\" style=\"").concat(q.link,';cursor:pointer">').concat(t,"</a>")):'<a href="'.concat(a,'" target="_blank" rel="noopener noreferrer" style="').concat(q.link,'">').concat(t,"</a>")})).replace(/^#### (.+)$/gm,function(e,t){return J(4,t)})).replace(/^### (.+)$/gm,function(e,t){return J(3,t)})).replace(/^## (.+)$/gm,function(e,t){return J(2,t)})).replace(/^# (.+)$/gm,function(e,t){return J(1,t)})).replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>")).replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>")).replace(/\*(.+?)\*/g,"<em>$1</em>")).replace(/((?:^[ \t]*[-*+] .+\n?)+)/gm,function(e){return Q(e,!1)})).replace(/((?:^[ \t]*\d+\. .+\n?)+)/gm,function(e){return Q(e,!0)})).replace(/^---$/gm,'<hr style="'.concat(q.hr,'"/>'))).replace(/\n{2,}/g,"\n\n")).split("\n\n").map(function(e){var t=e.trim();return t?/^(\x00CODE\d+\x00|<(h[1-6]|ul|ol|pre|hr|blockquote))/.test(t)?t:'<p style="'.concat(q.p,'">').concat(t.replace(/\n/g,"<br/>"),"</p>"):""}).join("\n")).replace(/\x00CODE(\d+)\x00/g,function(e,r){var n;return null!=(n=t[Number(r)])?n:""}))}})]})}var V=r(7091),G=r.n(V),K=r(7464),X=r.n(K),Y=r(6340),Z=r.n(Y),ee=r(9667),et=r.n(ee),er=r(8023),en=r.n(er),ea=r(6100),ei=r.n(ea),eo=r(8679),el={};el.styleTagTransform=ei(),el.setAttributes=et(),el.insert=Z().bind(null,"head"),el.domAPI=X(),el.insertStyleElement=en(),G()(eo.Ay,el);let es=eo.Ay&&eo.Ay.locals?eo.Ay.locals:void 0;var eu={blocker:"error",high:"error",medium:"warning",low:"default",info:"processing"};function ec(e){var t=e.data,r=Array.isArray(t)?t:[];return r.length?(0,n.jsx)("div",{className:es.issueList,children:r.map(function(e,t){var r,i,o,l,s=null!=(r=e.severity)?r:"info",u=null!=(i=eu[s])?i:"default";return(0,n.jsxs)("div",{className:es.issueItem,children:[(0,n.jsxs)("div",{className:es.issueHeader,children:[(0,n.jsx)(a.UITag,{color:u,children:s}),e.file&&(0,n.jsxs)("span",{className:es.issueFile,children:[e.file,e.line?":".concat(e.line):""]})]}),(0,n.jsx)("div",{className:es.issueMessage,children:null!=(o=null!=(l=e.message)?l:e.problem)?o:JSON.stringify(e)}),e.fix&&(0,n.jsxs)("div",{className:es.issueFix,children:["Fix: ",e.fix]})]},t)})}):(0,n.jsx)("div",{className:es.empty,children:"No issues found."})}function ed(e){var t,r=e.data,i=Array.isArray(r)?r:[];if(!i.length)return(0,n.jsx)("div",{className:es.empty,children:"No data."});var o=Object.keys(null!=(t=i[0])?t:{}).map(function(e){return{key:e,dataIndex:e,title:e}});return(0,n.jsx)(a.UITable,{columns:o,dataSource:i,size:"small",pagination:!1})}function ep(e){var t,r=e.data,i="string"==typeof r?r:null==r?"":null!=(t=JSON.stringify(r,null,2))?t:"";return i?(0,n.jsx)(a.UIDiffViewer,{diff:i,maxHeight:500}):null}function ef(e){var t,r=e.data,a="string"==typeof r?r:null==r?"":null!=(t=JSON.stringify(r,null,2))?t:"";return a?(0,n.jsx)("pre",{className:es.logPre,children:a}):null}function ey(e){var t=e.data,r=e.label,a="string"==typeof t?t:null;return a?(0,n.jsxs)("a",{href:a,target:"_blank",rel:"noopener noreferrer",style:{display:"inline-flex",alignItems:"center",gap:6,padding:"5px 12px",background:"var(--bg-secondary)",border:"1px solid var(--border-primary)",borderRadius:6,fontSize:13,color:"var(--link)",textDecoration:"none",fontWeight:500},children:[null!=r?r:a,(0,n.jsx)("span",{style:{fontSize:11,opacity:.6},children:"↗"})]}):(0,n.jsx)("span",{style:{color:"var(--text-tertiary)",fontSize:13,padding:12},children:"—"})}function eg(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ev(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ex(e){return(ex=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function em(e,t){return(em=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function eh(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eh=function(){return!!e})()}var eb=function(e){var t,r;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function a(){var e,t,r;if(!(this instanceof a))throw TypeError("Cannot call a class as a function");return t=a,r=arguments,t=ex(t),ev(e=function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,eh()?Reflect.construct(t,r||[],ex(this).constructor):t.apply(this,r)),"state",{error:null}),e}return a.prototype=Object.create(e&&e.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),e&&em(a,e),t=[{key:"render",value:function(){if(this.state.error){var e;return(0,n.jsxs)("span",{style:{color:"var(--text-tertiary)",fontSize:12,fontStyle:"italic"},children:[null!=(e=this.props.label)?e:"Artifact",": render error"]})}return this.props.children}}],r=[{key:"getDerivedStateFromError",value:function(e){return{error:e}}}],t&&eg(a.prototype,t),r&&eg(a,r),a}(i.Component);function eA(e){var t=e.type,r=e.data,i=e.label,o=e.editable,l=e.onEdit;return null==r?null:"link"===t?(0,n.jsx)(ey,{data:r,label:i}):"markdown"===t?(0,n.jsx)($,{data:r,editable:o,onEdit:l}):"issues"===t?(0,n.jsx)(ec,{data:r}):"table"===t?(0,n.jsx)(ed,{data:r}):"diff"===t?(0,n.jsx)(ep,{data:r}):"log"===t?(0,n.jsx)(ef,{data:r}):"json"===t?(0,n.jsx)(a.UIJsonViewer,{data:r}):null}function ej(e){return(0,n.jsx)(eb,{label:e.label,children:(0,n.jsx)(eA,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){ev(e,t,r[t])})}return e}({},e))})}function ew(e){return e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function ek(e){if(e<1e3)return"".concat(e,"ms");var t=e/1e3;if(t<60)return"".concat(t.toFixed(1),"s");var r=Math.floor(t/60),n=Math.floor(t%60);return"".concat(r,"m ").concat(n,"s")}function eC(e){var t,r,i,o=e.step,l=e.onApprove,s="waiting_approval"===o.status,u="running"===o.status,c=null==(r=o.spec)?void 0:r.artifacts,d=c?Object.values(c):[];return(0,n.jsxs)("div",{style:{padding:"20px 24px",background:"var(--bg-secondary)",border:"1px solid var(--border-primary)",borderRadius:10,marginBottom:"var(--spacing-section)"},children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:10},children:[(0,n.jsx)(L.md,{status:o.status}),(0,n.jsx)(a.UITypographyText,{style:{fontSize:15,fontWeight:600,color:"var(--text-primary)"},children:null!=(t=null==(i=o.spec)?void 0:i.summary)?t:o.name}),o.durationMs&&(0,n.jsx)(a.UITypographyText,{className:"typo-caption text-tertiary",style:{marginLeft:"auto"},children:ek(o.durationMs)})]}),o.progressMessage&&(0,n.jsx)(a.UITypographyText,{className:"typo-description text-secondary",style:{marginBottom:10,display:"block"},children:o.progressMessage}),null!=o.progress&&(0,n.jsxs)("div",{style:{marginBottom:12},children:[(0,n.jsx)("div",{style:{height:6,background:"var(--border-primary)",borderRadius:3,overflow:"hidden"},children:(0,n.jsx)("div",{style:{height:"100%",width:"".concat(o.progress,"%"),background:s?"var(--warning)":"var(--link)",borderRadius:3,transition:"width 0.3s ease"}})}),(0,n.jsxs)(a.UITypographyText,{className:"typo-caption text-tertiary",style:{marginTop:4,display:"block"},children:[o.progress,"%"]})]}),d.length>0&&o.outputs&&(0,n.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:12},children:d.map(function(e,t){var r=e.source.split(".").reduce(function(e,t){return e&&(void 0===e?"undefined":ew(e))==="object"?e[t]:void 0},o);return(0,n.jsxs)("div",{children:[(0,n.jsx)(a.UITypographyText,{className:"typo-label text-secondary",style:{display:"block",marginBottom:6},children:e.label}),(0,n.jsx)(ej,{type:e.type,data:r,label:e.label})]},t)})}),s&&l&&(0,n.jsx)("div",{style:{marginTop:14},children:(0,n.jsx)("button",{onClick:l,style:{padding:"6px 16px",background:"var(--link)",color:"var(--text-inverse)",border:"none",borderRadius:6,fontWeight:600,cursor:"pointer",fontSize:13},children:"Review & Decide"})}),u&&!o.progressMessage&&(0,n.jsxs)(a.UISpace,{className:"gap-tight",style:{marginTop:6},children:[(0,n.jsx)(a.UIIcon,{name:"LoadingOutlined",spin:!0,style:{color:"var(--link)",fontSize:13}}),(0,n.jsx)(a.UITypographyText,{className:"typo-caption text-secondary",children:"Running..."})]})]})}var eI=["success","failed","cancelled","skipped"];function eS(e){var t=e.label,r=e.value,a=e.color;return(0,n.jsxs)("div",{style:{flex:1,padding:"16px 20px",background:"var(--bg-secondary)",border:"1px solid var(--border-primary)",borderRadius:8,minWidth:0},children:[(0,n.jsx)("div",{style:{fontSize:22,fontWeight:700,color:null!=a?a:"var(--text-primary)",lineHeight:1.2},children:r}),(0,n.jsx)("div",{style:{fontSize:12,color:"var(--text-tertiary)",marginTop:4},children:t})]})}function eB(e){var t,r,i=e.run,o=e.onApprove,l=(0,x.F)(i),s=l.phases.map(function(e){var t=e.steps.every(function(e){return"success"===e.stepRun.status}),r=e.steps.some(function(e){return"running"===e.stepRun.status||"waiting_approval"===e.stepRun.status});return{label:e.label,status:t?"done":r?"active":"pending"}}),u=i.jobs.flatMap(function(e){return e.steps}),c=eI.includes(i.status),d=c?null:u.find(function(e){return"running"===e.status||"waiting_approval"===e.status}),p=u.filter(function(e){return"success"===e.status}),f=u.filter(function(e){return"failed"===e.status}),y=u.filter(function(e){return"queued"===e.status||"pending"===e.status}),g=i.startedAt&&i.finishedAt?new Date(i.finishedAt).getTime()-new Date(i.startedAt).getTime():null,v=l.phases.map(function(e){return{label:e.label,steps:e.steps.map(function(e){return e.stepRun})}}),m=0===l.phases.length?u:[],h=[],b=!0,A=!1,j=void 0;try{for(var w,k=u[Symbol.iterator]();!(b=(w=k.next()).done);b=!0){var C=w.value;if("success"===C.status||"failed"===C.status){var I=null==(T=C.spec)?void 0:T.artifacts;if(I){var S=!0,B=!1,E=void 0;try{for(var T,U,R=Object.values(I)[Symbol.iterator]();!(S=(U=R.next()).done);S=!0){var z=U.value;if(z.showInSummary){var M=z.source.split(".").reduce(function(e,t){return e&&(void 0===e?"undefined":ew(e))==="object"?e[t]:void 0},C);h.push({step:C,artifact:z,data:M})}}}catch(e){B=!0,E=e}finally{try{S||null==R.return||R.return()}finally{if(B)throw E}}}}}}catch(e){A=!0,j=e}finally{try{b||null==k.return||k.return()}finally{if(A)throw j}}return(0,n.jsxs)("div",{children:[s.length>0&&(0,n.jsx)("div",{style:{padding:"12px 16px",background:"var(--bg-secondary)",border:"1px solid var(--border-primary)",borderRadius:8,marginBottom:16},children:(0,n.jsx)(D.g,{phases:s})}),d&&(0,n.jsx)(eC,{step:d,onApprove:o?function(){return o(d)}:void 0}),h.length>0&&(t=h.filter(function(e){return"link"===e.artifact.type}),r=h.filter(function(e){return"link"!==e.artifact.type}),(0,n.jsxs)("div",{style:{marginBottom:16,display:"flex",flexDirection:"column",gap:12},children:[t.length>0&&(0,n.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:t.map(function(e,t){var r=e.artifact,a=e.data;return(0,n.jsx)(ej,{type:"link",data:a,label:r.label},t)})}),r.length>0&&(0,n.jsx)("div",{style:{padding:"16px 20px",background:"var(--bg-secondary)",border:"1px solid var(--border-primary)",borderRadius:10,display:"flex",flexDirection:"column",gap:16},children:r.map(function(e,t){var r=e.artifact,i=e.data;return(0,n.jsxs)("div",{children:[(0,n.jsx)(a.UITypographyText,{className:"typo-label text-secondary",style:{display:"block",marginBottom:6},children:r.label}),(0,n.jsx)(ej,{type:r.type,data:i,label:r.label})]},t)})})]})),c&&(0,n.jsxs)("div",{style:{display:"flex",gap:12,marginBottom:20,flexWrap:"wrap"},children:[(0,n.jsx)(eS,{label:"Total steps",value:String(u.length)}),(0,n.jsx)(eS,{label:"Completed",value:String(p.length),color:"var(--success)"}),f.length>0&&(0,n.jsx)(eS,{label:"Failed",value:String(f.length),color:"var(--error)"}),null!=g&&(0,n.jsx)(eS,{label:"Duration",value:ek(g)})]}),c&&v.length>0&&(0,n.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:20},children:v.map(function(e){return(0,n.jsxs)("div",{children:[(0,n.jsx)(a.UITypographyText,{className:"typo-label text-secondary",style:{display:"block",marginBottom:8},children:e.label}),(0,n.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:4},children:e.steps.map(function(e){var t,r;return(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"7px 12px",background:"var(--bg-secondary)",border:"1px solid var(--border-primary)",borderRadius:6},children:[(0,n.jsx)(a.UIIcon,{name:"success"===e.status?"CheckCircleOutlined":"failed"===e.status?"CloseCircleOutlined":"MinusCircleOutlined",style:{fontSize:13,color:"success"===e.status?"var(--success)":"failed"===e.status?"var(--error)":"var(--text-tertiary)",flexShrink:0}}),(0,n.jsx)(a.UITypographyText,{className:"typo-body",style:{flex:1,minWidth:0},children:null!=(t=null==(r=e.spec)?void 0:r.summary)?t:e.name}),e.durationMs&&(0,n.jsx)(a.UITypographyText,{className:"typo-caption text-tertiary",style:{flexShrink:0},children:ek(e.durationMs)})]},e.id)})})]},e.label)})}),c&&m.length>0&&(0,n.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:4},children:m.map(function(e){var t,r;return(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"7px 12px",background:"var(--bg-secondary)",border:"1px solid var(--border-primary)",borderRadius:6},children:[(0,n.jsx)(a.UIIcon,{name:"success"===e.status?"CheckCircleOutlined":"failed"===e.status?"CloseCircleOutlined":"MinusCircleOutlined",style:{fontSize:13,color:"success"===e.status?"var(--success)":"failed"===e.status?"var(--error)":"var(--text-tertiary)",flexShrink:0}}),(0,n.jsx)(a.UITypographyText,{className:"typo-body",style:{flex:1},children:null!=(t=null==(r=e.spec)?void 0:r.summary)?t:e.name}),e.durationMs&&(0,n.jsx)(a.UITypographyText,{className:"typo-caption text-tertiary",children:ek(e.durationMs)})]},e.id)})}),!c&&p.length>0&&(0,n.jsxs)("div",{style:{marginBottom:16},children:[(0,n.jsxs)(a.UITypographyText,{className:"typo-label text-secondary",style:{display:"block",marginBottom:8},children:["Completed (",p.length,")"]}),(0,n.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:4},children:p.map(function(e){var t,r;return(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"7px 12px",background:"var(--bg-secondary)",border:"1px solid var(--border-primary)",borderRadius:6},children:[(0,n.jsx)(a.UIIcon,{name:"CheckCircleOutlined",style:{color:"var(--success)",fontSize:13}}),(0,n.jsx)(a.UITypographyText,{className:"typo-body",children:null!=(t=null==(r=e.spec)?void 0:r.summary)?t:e.name}),e.durationMs&&(0,n.jsx)(a.UITypographyText,{className:"typo-caption text-tertiary",style:{marginLeft:"auto"},children:ek(e.durationMs)})]},e.id)})})]}),!c&&y.length>0&&(0,n.jsxs)("div",{children:[(0,n.jsxs)(a.UITypographyText,{className:"typo-label text-secondary",style:{display:"block",marginBottom:8},children:["Upcoming (",y.length,")"]}),(0,n.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:4},children:y.map(function(e){var t,r,i;return(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"7px 12px",border:"1px dashed var(--border-primary)",borderRadius:6,opacity:.5},children:[(0,n.jsx)(a.UIIcon,{name:"ClockCircleOutlined",style:{color:"var(--text-tertiary)",fontSize:13}}),(0,n.jsx)(a.UITypographyText,{className:"typo-body text-secondary",children:null!=(t=null==(r=e.spec)?void 0:r.summary)?t:e.name}),(null==(i=e.spec)?void 0:i.phase)&&(0,n.jsx)(a.UITag,{style:{marginLeft:"auto",opacity:.7},children:e.spec.phase})]},e.id)})})]}),0===u.length&&(0,n.jsx)("div",{style:{textAlign:"center",padding:"40px 0"},children:(0,n.jsx)(a.UITypographyText,{className:"typo-description text-secondary",children:"No execution data"})})]})}var eE=r(4461);function eT(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function eU(e,t,r,n,a,i,o){try{var l=e[i](o),s=l.value}catch(e){r(e);return}l.done?t(s):Promise.resolve(s).then(n,a)}function eR(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var i=[],o=!0,l=!1;try{for(a=a.call(e);!(o=(r=a.next()).done)&&(i.push(r.value),!t||i.length!==t);o=!0);}catch(e){l=!0,n=e}finally{try{o||null==a.return||a.return()}finally{if(l)throw n}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return eT(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return eT(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var ez=a.UITypographyText,eM=a.UITitle,eO={queued:"○",running:"◉",success:"✓",failed:"✗",cancelled:"⊘",skipped:"—",waiting_approval:"⏸"},eN={queued:"#8b949e",running:"#d29922",success:"#3fb950",failed:"#f85149",cancelled:"#8b949e",skipped:"#8b949e",waiting_approval:"#d29922"};function e_(e){return e.endsWith(".started")?"running":e.endsWith(".succeeded")||e.endsWith(".finished")?"success":e.endsWith(".failed")?"failed":e.endsWith(".cancelled")?"cancelled":e.endsWith(".skipped")?"skipped":e.endsWith(".waitingApproval")?"waiting_approval":e.endsWith(".queued")?"queued":"running"}function eW(e){if(e<1e3)return"".concat(e,"ms");var t=e/1e3;if(t<60)return"".concat(t.toFixed(1),"s");var r=Math.floor(t/60),n=Math.floor(t%60);return"".concat(r,"m ").concat(n,"s")}var eD=/\x1b\[[0-9;]*[A-Za-z]|\x1b\].*?\x07/g;function eL(e){return e.replace(eD,"")}function eP(e){var t,r=function(e){if(!e)return"";try{return new Date(e).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch(e){return""}}(e.timestamp),n=e.payload;if(!n)return[];if("log.appended"===e.type){var a,i="string"==typeof n.message?eL(n.message):"";return i?[{time:r,text:i,stream:null!=(a=n.stream)?a:"stdout"}]:[]}if(n.outputs&&"object"==((t=n.outputs)&&"u">typeof Symbol&&t.constructor===Symbol?"symbol":typeof t)){var o=n.outputs;if("string"==typeof o.stdout&&o.stdout.trim())return eL(o.stdout).trim().split("\n").map(function(e){return{time:r,text:e,stream:"stdout"}})}return"string"==typeof n.stdout&&n.stdout.trim()?eL(n.stdout).trim().split("\n").map(function(e){return{time:r,text:e,stream:"stdout"}}):"string"==typeof n.error?[{time:r,text:n.error,stream:"stderr"}]:"string"==typeof n.message?[{time:r,text:n.message}]:"string"==typeof n.line?[{time:r,text:n.line}]:"string"==typeof n.text?[{time:r,text:n.text}]:0===Object.keys(n).filter(function(e){return!["status","jobName","durationMs","attempt"].includes(e)}).length?[]:[{time:r,text:JSON.stringify(n,null,2)}]}var eF=new Set(["stdout","stderr","exitCode","ok"]);function eq(e){var t,r=e.step,o=e.onApprove,l=r.events.flatMap(eP),s=(0,i.useRef)(null);(0,i.useEffect)(function(){var e=s.current;e&&e.scrollHeight-e.scrollTop-e.clientHeight<80&&(e.scrollTop=e.scrollHeight)},[l.length]);var u=(0,i.useMemo)(function(){if(l.length>0)return[];var e=[];if(r.outputs){var t=r.outputs.stdout,n=r.outputs.stderr;if("string"==typeof t&&t.trim()){var a=!0,i=!1,o=void 0;try{for(var s,u=t.trim().split("\n")[Symbol.iterator]();!(a=(s=u.next()).done);a=!0){var c=s.value;e.push({time:"",text:c})}}catch(e){i=!0,o=e}finally{try{a||null==u.return||u.return()}finally{if(i)throw o}}}if("string"==typeof n&&n.trim()){var d=!0,p=!1,f=void 0;try{for(var y,g=n.trim().split("\n")[Symbol.iterator]();!(d=(y=g.next()).done);d=!0){var v=y.value;e.push({time:"",text:v})}}catch(e){p=!0,f=e}finally{try{d||null==g.return||g.return()}finally{if(p)throw f}}}if(0===e.length){var x=Object.keys(r.outputs).filter(function(e){return!eF.has(e)});x.length>0&&e.push({time:"",text:"Completed with output: { ".concat(x.join(", ")," }")})}}if(r.error){var m=r.error.message;"string"==typeof m&&e.push({time:"",text:m})}return e},[r.outputs,r.error,l.length]),c=l.length>0?l:u,d="waiting_approval"===r.status,p=(0,i.useMemo)(function(){if(!r.outputs)return null;var e={},t=!0,n=!1,a=void 0;try{for(var i,o=Object.entries(r.outputs)[Symbol.iterator]();!(t=(i=o.next()).done);t=!0){var l=eR(i.value,2),s=l[0],u=l[1];eF.has(s)||(e[s]=u)}}catch(e){n=!0,a=e}finally{try{t||null==o.return||o.return()}finally{if(n)throw a}}return Object.keys(e).length>0?e:null},[r.outputs]),f=null!==p,y=(null==(t=r.spec)?void 0:t.with)!=null&&Object.keys(r.spec.with).length>0,g=null!=r.error,v=(0,n.jsxs)("div",{style:{fontFamily:"monospace",fontSize:13},children:[r.command&&(0,n.jsxs)("div",{style:{padding:"4px 12px",color:"#8b949e",fontSize:12},children:["$ ",r.command]}),c.length>0?(0,n.jsx)("pre",{ref:s,style:{margin:0,padding:"8px 12px",background:"#0d1117",color:"#c9d1d9",borderRadius:4,overflow:"auto",maxHeight:400,whiteSpace:"pre-wrap",wordBreak:"break-word",lineHeight:1.6},children:c.map(function(e,t){return(0,n.jsxs)("span",{children:[e.time&&(0,n.jsx)("span",{style:{color:"#484f58",userSelect:"none",marginRight:12},children:e.time}),(0,n.jsx)("span",{style:"stderr"===e.stream?{color:"#f85149"}:void 0,children:e.text}),"\n"]},t)})}):(0,n.jsx)(ez,{type:"secondary",style:{fontSize:12,padding:"4px 12px",display:"block"},children:"running"===r.status?"Waiting for output...":"queued"===r.status?"Queued":d?"Waiting for approval":"No output"}),d&&o&&(0,n.jsx)("div",{style:{padding:"8px 12px"},children:(0,n.jsx)(a.UIButton,{size:"small",variant:"primary",onClick:o,children:"Review & Decide"})})]});if(!(f||y||g))return v;var x=[{key:"log",label:"Log",children:v}];return f&&x.push({key:"data",label:"Data",children:(0,n.jsx)(a.UIJsonViewer,{data:p})}),y&&x.push({key:"inputs",label:"Inputs",children:(0,n.jsx)(a.UIJsonViewer,{data:r.spec.with})}),g&&x.push({key:"error",label:"Error",children:(0,n.jsx)(a.UIJsonViewer,{data:r.error})}),(0,n.jsx)(a.UITabs,{items:x,size:"small",defaultActiveKey:"log"})}function eH(e){var t=e.events,r=e.run,o=e.onApprove,l=(0,i.useMemo)(function(){return function(e,t){var r=new Map,n=!0,a=!1,i=void 0;try{for(var o,l=t.jobs[Symbol.iterator]();!(n=(o=l.next()).done);n=!0){var s=o.value,u=s.steps.map(function(e){var t;return{stepId:e.id,stepName:e.name,status:e.status,command:e.command,events:[],outputs:null!=(t=e.outputs)?t:void 0,error:e.error,spec:e.spec,startedAt:e.startedAt,finishedAt:e.finishedAt,durationMs:e.durationMs}});r.set(s.id,{jobId:s.id,jobName:s.jobName,status:s.status,steps:u,events:[],startedAt:s.startedAt,finishedAt:s.finishedAt,durationMs:s.durationMs,error:s.error})}}catch(e){a=!0,i=e}finally{try{n||null==l.return||l.return()}finally{if(a)throw i}}var c=!0,d=!1,p=void 0;try{for(var f,y=e[Symbol.iterator]();!(c=(f=y.next()).done);c=!0)!function(){var e,t,n=f.value;if(n.jobId){var a=r.get(n.jobId);if(a||(a={jobId:n.jobId,jobName:n.jobId,status:e_(n.type),steps:[],events:[]},r.set(n.jobId,a)),n.type.startsWith("job.")&&(a.status=e_(n.type),(null==(e=n.payload)?void 0:e.jobName)&&(a.jobName=String(n.payload.jobName)),(null==(t=n.payload)?void 0:t.durationMs)&&(a.durationMs=Number(n.payload.durationMs))),n.stepId){var i=a.steps.find(function(e){return e.stepId===n.stepId});i||(i={stepId:n.stepId,stepName:n.stepId,status:"queued",events:[]},a.steps.push(i)),i.events.push(n),n.type.startsWith("step.")&&(i.status=e_(n.type))}else a.events.push(n)}}()}catch(e){d=!0,p=e}finally{try{c||null==y.return||y.return()}finally{if(d)throw p}}return Array.from(r.values())}(t,r)},[t,r]),s=(0,i.useMemo)(function(){var e=new Map,t=!0,n=!1,a=void 0;try{for(var i,o=r.jobs[Symbol.iterator]();!(t=(i=o.next()).done);t=!0){var l=i.value,s=!0,u=!1,c=void 0;try{for(var d,p=l.steps[Symbol.iterator]();!(s=(d=p.next()).done);s=!0){var f=d.value;e.set(f.id,f)}}catch(e){u=!0,c=e}finally{try{s||null==p.return||p.return()}finally{if(u)throw c}}}}catch(e){n=!0,a=e}finally{try{t||null==o.return||o.return()}finally{if(n)throw a}}return e},[r]);if(0===l.length)return(0,n.jsx)(ez,{type:"secondary",children:"No execution data yet."});var u=l.filter(function(e){return"running"===e.status||"failed"===e.status||"waiting_approval"===e.status}).map(function(e){return e.jobId}),c=u.length>0?u:l.map(function(e){return e.jobId}),d=l.map(function(e){var t,r,i=null!=(t=eO[e.status])?t:"?",l=null!=(r=eN[e.status])?r:"#8b949e",u=e.durationMs?eW(e.durationMs):null,c=e.steps.filter(function(e){return"running"===e.status||"failed"===e.status||"waiting_approval"===e.status}).map(function(e){return e.stepId}),d=c.length>0?c:e.steps.filter(function(e){return"queued"!==e.status}).map(function(e){return e.stepId}),p=e.steps.map(function(e){var t,r,a=null!=(t=eO[e.status])?t:"?",i=null!=(r=eN[e.status])?r:"#8b949e",l=e.durationMs?eW(e.durationMs):null;return{key:e.stepId,label:e.stepName,extra:(0,n.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12},children:[l&&(0,n.jsx)("span",{style:{color:"#8b949e"},children:l}),(0,n.jsx)("span",{style:{color:i,fontWeight:600,fontSize:14},children:a})]}),children:(0,n.jsx)(eq,{step:e,onApprove:"waiting_approval"===e.status&&o?function(){var t=s.get(e.stepId);t&&o(t)}:void 0})}});return{key:e.jobId,label:e.jobName,extra:(0,n.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12},children:[u&&(0,n.jsx)("span",{style:{color:"#8b949e"},children:u}),(0,n.jsx)("span",{style:{color:l,fontWeight:600,fontSize:14},children:i})]}),children:(0,n.jsxs)(n.Fragment,{children:[e.error&&"failed"===e.status&&(0,n.jsx)(a.UIAlert,{variant:"error",message:"Job failed",description:"string"==typeof e.error.message?e.error.message:JSON.stringify(e.error,null,2),showIcon:!0,style:{marginBottom:8}}),p.length>0?(0,n.jsx)(a.UIAccordion,{items:p,defaultActiveKey:d,size:"small",ghost:!0,style:{background:"transparent"}}):(0,n.jsx)(ez,{type:"secondary",style:{fontSize:12},children:"No steps."})]})}});return(0,n.jsx)(a.UIAccordion,{items:d,defaultActiveKey:c,size:"small",style:{background:"var(--bg-secondary, #f6f8fa)"}})}function eJ(){var e,t,r,u,c,d,p,f=null!=(e=(0,o.useParams)().runId)?e:null,y=(0,l.useData)(f?"/exec/api/v1/runs/".concat(f):"/exec/api/v1/runs/__none__",{enabled:!!f,pollingMs:3e3}),g=y.data,x=y.isLoading,m=y.error,h=y.refetch,b=null!=(t=null==g?void 0:g.run)?t:g,A=(0,l.useMutateData)("/exec/api/v1/runs/".concat(null!=f?f:"__none__","/cancel")),j=(0,l.useMutateData)("/exec/api/v1/runs/".concat(null!=f?f:"__none__","/approvals/resolve")),w=null!=b&&!["success","failed","cancelled","skipped"].includes(b.status),k=(0,l.useSSE)(w&&f?"/exec/api/v1/runs/".concat(f,"/events"):null,{params:{follow:1},reconnect:!0}),C=k.events,I=k.error,S=k.isConnected,B=eR((0,i.useState)(null),2),E=B[0],T=B[1],U=eR((0,i.useState)("dashboard"),2),R=U[0],z=U[1];(0,i.useEffect)(function(){I&&w&&h()},[I,w,h]);var M=null!=b&&!w,O=null==b?void 0:b.jobs.some(function(e){return e.steps.some(function(e){return"waiting_approval"===e.status})}),N=f?"".concat(f.slice(0,12),"..."):"";return(0,n.jsxs)(a.UIPage,{children:[(0,n.jsx)(a.UIPageHeader,{title:null!=(r=null==b?void 0:b.name)?r:"Workflow Run ".concat(N),description:b?"Run ".concat(N):"Detailed status of the workflow execution",breadcrumbs:[{title:"Home",href:"/"},{title:"Workflows",href:"/workflows"},{title:"Runs",href:"/p/workflows/runs"},{title:N}],actions:(0,n.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,n.jsx)(a.UIButton,{onClick:function(){return h()},disabled:x,children:"Refresh"}),b&&!M&&(0,n.jsx)(a.UIButton,{danger:!0,loading:A.isLoading,onClick:function(){return f&&A.mutate()},children:"Cancel Run"})]})}),m&&(0,n.jsx)(a.UIAlert,{variant:"error",message:"Failed to load workflow run",description:String(m),closable:!0}),O&&(0,n.jsx)(a.UIAlert,{variant:"warning",message:"Waiting for your approval",description:"One or more steps require your decision. Expand the step below to review.",showIcon:!0,style:{marginBottom:16}}),x&&(0,n.jsx)(a.UIPageSection,{children:(0,n.jsx)(ez,{children:"Loading workflow run..."})}),!x&&!b&&!m&&(0,n.jsx)(a.UIPageSection,{children:(0,n.jsx)(ez,{children:"Workflow run not found."})}),b&&(0,n.jsx)(a.UIPageSection,{children:(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,padding:"12px 16px",background:"var(--bg-secondary)",border:"1px solid var(--border-primary)",borderRadius:8,flexWrap:"wrap"},children:[(0,n.jsx)(s.d,{status:b.status}),(0,n.jsx)(o.Link,{to:"/p/workflows/definitions/".concat(encodeURIComponent(b.name)),style:{color:"var(--link)",fontWeight:500,fontSize:14},children:b.name}),(0,n.jsxs)("span",{style:{color:"var(--text-tertiary)",fontSize:13},children:["v",b.version]}),(0,n.jsxs)("span",{style:{color:"var(--text-tertiary)",fontSize:13},children:["by ",null!=(u=b.trigger.actor)?u:"unknown"]}),b.startedAt&&(0,n.jsx)("span",{style:{color:"var(--text-tertiary)",fontSize:13,marginLeft:"auto"},children:new Date(b.startedAt).toLocaleString()}),(null==(c=b.result)?void 0:c.summary)&&(0,n.jsx)("span",{style:{fontSize:13,color:"var(--text-secondary)",borderTop:"1px solid var(--border-primary)",paddingTop:8,width:"100%"},children:b.result.summary})]})}),b&&(0,n.jsxs)(a.UIPageSection,{children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:16},children:[(0,n.jsx)(eM,{level:4,style:{margin:0},children:"Execution"}),(0,n.jsx)(eE.k,{views:{dashboard:{label:"Dashboard"},pipeline:{label:"Pipeline"},engineering:{label:"Engineering"}},current:R,onChange:z})]}),w&&!S&&!I&&(0,n.jsx)(a.UIAlert,{variant:"info",message:"Connecting to event stream...",showIcon:!0,style:{marginBottom:12}}),w&&I&&(0,n.jsx)(a.UIAlert,{variant:"error",message:"Event stream error",description:I.message,style:{marginBottom:12}}),"dashboard"===R&&(0,n.jsx)(eB,{run:b,onApprove:function(e){return T(e)}}),"pipeline"===R&&(0,n.jsx)(W,{run:b,events:C,onApprove:function(e){return T(e)}}),"engineering"===R&&(0,n.jsx)(eH,{events:C,run:b,onApprove:function(e){return T(e)}})]}),(null==b?void 0:b.result)&&(0,n.jsxs)(a.UIPageSection,{children:[(0,n.jsx)(eM,{level:4,children:"Result Metrics"}),b.result.metrics?(0,n.jsx)(a.UIList,{bordered:!0,size:"small",dataSource:Object.entries(b.result.metrics).map(function(e){var t=eR(e,2);return{key:t[0],value:t[1]}}),renderItem:function(e){var t=e.key,r=e.value;return(0,n.jsxs)(a.UIListItem,{children:[(0,n.jsx)(ez,{strong:!0,children:t}),(0,n.jsx)("span",{style:{marginLeft:8},children:String(null!=r?r:"-")})]})}}):(0,n.jsx)(ez,{type:"secondary",children:"No metrics recorded."}),b.result.error&&(0,n.jsx)(a.UIAlert,{style:{marginTop:16},variant:"error",message:b.result.error.message,description:b.result.error.details?JSON.stringify(b.result.error.details,null,2):void 0,showIcon:!0})]}),(0,n.jsx)(v,{open:null!==E,step:E,runId:null!=f?f:"",onClose:function(){return T(null)},onResolve:function(e,t){var r;return(r=function(){var r;return function(e,t){var r,n,a,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(o,"next",{value:s(0)}),l(o,"throw",{value:s(1)}),l(o,"return",{value:s(2)}),"function"==typeof Symbol&&l(o,Symbol.iterator,{value:function(){return this}}),o;function s(l){return function(s){var u=[l,s];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(i=0)),i;)try{if(r=1,n&&(a=2&u[0]?n.return:u[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,u[1])).done)return a;switch(n=0,a&&(u=[2&u[0],a.value]),u[0]){case 0:case 1:a=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,n=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(a=(a=i.trys).length>0&&a[a.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!a||u[1]>a[0]&&u[1]<a[3])){i.label=u[1];break}if(6===u[0]&&i.label<a[1]){i.label=a[1],a=u;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(u);break}a[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],n=0}finally{r=a=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(n){switch(n.label){case 0:if(!E||!f||!(r=null==b?void 0:b.jobs.find(function(e){return e.steps.some(function(e){return e.id===E.id})})))return[2];return[4,j.mutateAsync({runId:f,jobId:r.id,stepId:E.id,action:e,comment:t})];case 1:return n.sent(),T(null),h(),[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,a){var i=r.apply(e,t);function o(e){eU(i,n,a,o,l,"next",e)}function l(e){eU(i,n,a,o,l,"throw",e)}o(void 0)})})()},isLoading:j.isLoading,error:(d=j.error,null!=(p=Error)&&"u">typeof Symbol&&p[Symbol.hasInstance]?!!p[Symbol.hasInstance](d):d instanceof p)?j.error:null})]})}}}]);
//# sourceMappingURL=__federation_expose_RunDetail.js.map