@kb-labs/release-manager-cli 2.118.2 → 2.119.0-canary.85d060ea6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/cli/commands/changelog.js +13 -3
  2. package/dist/cli/commands/changelog.js.map +1 -1
  3. package/dist/cli/commands/run.js +6 -2
  4. package/dist/cli/commands/run.js.map +1 -1
  5. package/dist/rest/handlers/changelog-generate-handler.d.ts +1 -0
  6. package/dist/rest/handlers/changelog-generate-handler.js +15 -8
  7. package/dist/rest/handlers/changelog-generate-handler.js.map +1 -1
  8. package/dist/rest/handlers/generate-handler.d.ts +1 -0
  9. package/dist/rest/handlers/history-changelog-handler.js +4 -3
  10. package/dist/rest/handlers/history-changelog-handler.js.map +1 -1
  11. package/dist/rest/handlers/history-handler.d.ts +2 -0
  12. package/dist/rest/handlers/history-handler.js +3 -1
  13. package/dist/rest/handlers/history-handler.js.map +1 -1
  14. package/dist/rest/handlers/history-plan-handler.d.ts +1 -0
  15. package/dist/rest/handlers/history-plan-handler.js +12 -3
  16. package/dist/rest/handlers/history-plan-handler.js.map +1 -1
  17. package/dist/rest/handlers/history-report-handler.d.ts +1 -0
  18. package/dist/rest/handlers/plan-handler.d.ts +1 -0
  19. package/dist/rest/handlers/report-handler.d.ts +1 -0
  20. package/dist/rest/handlers/run-handler.d.ts +2 -1
  21. package/dist/rest/handlers/run-handler.js +6 -2
  22. package/dist/rest/handlers/run-handler.js.map +1 -1
  23. package/dist/widgets/117.js +10 -3
  24. package/dist/widgets/165.js +1 -1
  25. package/dist/widgets/370.js +1 -1
  26. package/dist/widgets/46.js +20 -20
  27. package/dist/widgets/50.js +1 -1
  28. package/dist/widgets/546.js +1 -1
  29. package/dist/widgets/648.js +1 -1
  30. package/dist/widgets/669.js +1 -1
  31. package/dist/widgets/775.js +1 -1
  32. package/dist/widgets/78.js +1 -1
  33. package/dist/widgets/832.js +96 -0
  34. package/dist/widgets/875.js +4 -4
  35. package/dist/widgets/__federation_expose_ReleasePage.js +1 -1
  36. package/dist/widgets/mf-manifest.json +2 -2
  37. package/dist/widgets/mf-stats.json +2 -2
  38. package/dist/widgets/remoteEntry.js +7 -7
  39. package/package.json +5 -5
  40. package/dist/widgets/62.js +0 -96
@@ -1 +1 @@
1
- "use strict";(self.rspackChunk_kb_labs_release_manager_cli=self.rspackChunk_kb_labs_release_manager_cli||[]).push([[135],{6026(e,n){var t=Symbol.for("react.transitional.element");function r(e,n,r){var a=null;if(void 0!==r&&(a=""+r),void 0!==n.key&&(a=""+n.key),"key"in n)for(var s in r={},n)"key"!==s&&(r[s]=n[s]);else r=n;return{$$typeof:t,type:e,key:a,ref:void 0!==(n=r.ref)?n:null,props:r}}n.Fragment=Symbol.for("react.fragment"),n.jsx=r,n.jsxs=r},4552(e,n,t){e.exports=t(6026)},5784(e,n,t){t.r(n),t.d(n,{default:()=>K});var r=t(4552),a=t(92),s=t(5963),o=t(4519),l=t(5155);function i(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=Array(n);t<n;t++)r[t]=e[t];return r}function c(e,n,t,r,a,s,o){try{var l=e[s](o),i=l.value}catch(e){t(e);return}l.done?n(i):Promise.resolve(i).then(r,a)}function u(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var s=[],o=!0,l=!1;try{for(a=a.call(e);!(o=(t=a.next()).done)&&(s.push(t.value),!n||s.length!==n);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==a.return||a.return()}finally{if(l)throw r}}return s}}(e,n)||function(e,n){if(e){if("string"==typeof e)return i(e,n);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 i(e,n)}}(e,n)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e){var n,t,s,i,d,p,h=e.selectedScope,y=e.selectedScopePath,f=e.onPlanReady,g=u(a.useState(!0),2),m=g[0],x=g[1],I=u(a.useState(!1),2),j=I[0],b=I[1],v=h?"/v1/plugins/release/status?scope=".concat(encodeURIComponent(h)):"",U=h?"/v1/plugins/release/plan?scope=".concat(encodeURIComponent(h)):"",S=h?"/v1/plugins/release/git-timeline?scope=".concat(encodeURIComponent(h)):"",k=(0,o.useData)(v),T=k.data,w=k.isLoading,C=k.refetch,O=(0,o.useData)(U),E=O.data,P=O.isLoading,A=O.refetch,z=(0,o.useData)(S).data,R=(0,o.useMutateData)("/v1/plugins/release/generate","POST"),M=R.mutateAsync,D=R.isLoading;a.useEffect(function(){f(!!((null==E?void 0:E.plan)&&E.plan.packages.length>0))},[E,f]);var B=function(){var e;return(e=function(){var e,n,t,r,a;return function(e,n){var t,r,a,s={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:i(0)}),l(o,"throw",{value:i(1)}),l(o,"return",{value:i(2)}),"function"==typeof Symbol&&l(o,Symbol.iterator,{value:function(){return this}}),o;function i(l){return function(i){var c=[l,i];if(t)throw TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(s=0)),s;)try{if(t=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return s.label++,{value:c[1],done:!1};case 5:s.label++,r=c[1],c=[0];continue;case 7:c=s.ops.pop(),s.trys.pop();continue;default:if(!(a=(a=s.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){s=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){s.label=c[1];break}if(6===c[0]&&s.label<a[1]){s.label=a[1],a=c;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(c);break}a[2]&&s.ops.pop(),s.trys.pop();continue}c=n.call(e,s)}catch(e){c=[6,e],r=0}finally{t=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,M({scope:h,scopePath:y,useLLM:m})];case 1:return e=s.sent(),C(),A(),n=e.confidence?Math.round(100*e.confidence):0,t=e.tokensUsed?", ".concat(e.tokensUsed," tokens"):"",r=m?"AI-powered":"Simple",l.UIMessage.success("".concat(r," plan generated (").concat(n,"% confidence").concat(t,")")),[3,3];case 2:var o;return a=s.sent(),l.UIMessage.error("Failed to generate plan: ".concat((null!=(o=Error)&&"u">typeof Symbol&&o[Symbol.hasInstance]?!!o[Symbol.hasInstance](a):a instanceof o)?a.message:"Unknown error")),[3,3];case 3:return[2]}})},function(){var n=this,t=arguments;return new Promise(function(r,a){var s=e.apply(n,t);function o(e){c(s,r,a,o,l,"next",e)}function l(e){c(s,r,a,o,l,"throw",e)}o(void 0)})})()};if(w)return(0,r.jsx)(l.UISpin,{size:"large",style:{display:"block",margin:"48px auto"}});if(!(null==T?void 0:T.hasPlan)&&!(null==E?void 0:E.plan))return void 0===z||z.hasUnreleasedChanges?(0,r.jsx)(l.UICard,{children:(0,r.jsx)(l.UIEmptyState,{description:"No release plan generated yet",image:l.UIEmptyState.PRESENTED_IMAGE_SIMPLE,children:(0,r.jsxs)(l.UISpace,{direction:"vertical",size:"middle",style:{display:"flex",alignItems:"center"},children:[(0,r.jsx)(l.UICheckbox,{checked:m,onChange:function(e){return x(e)},children:"Use AI-powered analysis (requires LLM)"}),(0,r.jsx)(l.UIButton,{variant:"primary",icon:(0,r.jsx)(l.UIIcon,{name:"ThunderboltOutlined"}),onClick:function(){B()},loading:D,size:"large",children:"Generate Release Plan"}),(0,r.jsx)(l.UITypographyText,{type:"secondary",style:{fontSize:12},children:m?"AI will analyze git history and provide intelligent reasoning for version bumps":"Generate plan using conventional commits analysis"})]})})}):(0,r.jsx)(l.UICard,{children:(0,r.jsx)(l.UIEmptyState,{description:"No unreleased changes since ".concat(null!=(p=null==z?void 0:z.lastTag)?p:"last release"),image:l.UIEmptyState.PRESENTED_IMAGE_SIMPLE})});if(P||!(null==E?void 0:E.plan))return(0,r.jsx)(l.UISpin,{size:"large",style:{display:"block",margin:"48px auto"}});var L=E.plan;if(0===L.packages.length)return(0,r.jsx)(l.UICard,{children:(0,r.jsx)(l.UIEmptyState,{description:"Plan exists but contains no packages",image:l.UIEmptyState.PRESENTED_IMAGE_SIMPLE,children:(0,r.jsxs)(l.UISpace,{direction:"vertical",size:"middle",style:{display:"flex",alignItems:"center"},children:[(0,r.jsx)(l.UITypographyText,{type:"secondary",style:{fontSize:12},children:"This may happen if there are no changes to release or the scope has no packages."}),(0,r.jsx)(l.UICheckbox,{checked:m,onChange:function(e){return x(e)},children:"Use AI-powered analysis"}),(0,r.jsx)(l.UIButton,{variant:"primary",icon:(0,r.jsx)(l.UIIcon,{name:"ThunderboltOutlined"}),onClick:function(){B()},loading:D,children:"Regenerate Plan"})]})})});var F=[{title:"Package",dataIndex:"name",key:"name",width:280,ellipsis:!0,render:function(e){return(0,r.jsx)(l.UITypographyText,{strong:!0,ellipsis:{tooltip:e},children:e})}},{title:"Current",dataIndex:"currentVersion",key:"currentVersion",width:90,render:function(e){return e?(0,r.jsx)(l.UITag,{color:"blue",children:e}):"-"}},{title:"Next",dataIndex:"nextVersion",key:"nextVersion",width:90,render:function(e){return e?(0,r.jsx)(l.UITag,{color:"green",children:e}):"-"}},{title:"Bump",dataIndex:"bump",key:"bump",width:80,render:function(e){return e?(0,r.jsx)(l.UITag,{color:{major:"red",minor:"orange",patch:"blue"}[e]||"default",children:e}):"-"}},{title:"Reason",dataIndex:"reason",key:"reason",ellipsis:!0,render:function(e){return(0,r.jsx)(l.UITypographyText,{type:"secondary",style:{fontSize:12},children:e||"-"})}}];return(0,r.jsxs)(l.UICard,{title:(0,r.jsxs)(l.UISpace,{children:[(0,r.jsx)(l.UIIcon,{name:"CheckCircleOutlined",style:{color:"#52c41a"}}),(0,r.jsx)("span",{children:"Release Plan Ready"}),(0,r.jsxs)(l.UITag,{color:"blue",children:[L.packages.length," package(s)"]})]}),extra:(0,r.jsxs)(l.UISpace,{children:[(0,r.jsx)(l.UICheckbox,{checked:m,onChange:function(e){return x(e)},children:"Use AI"}),(0,r.jsx)(l.UIButton,{icon:(0,r.jsx)(l.UIIcon,{name:"ThunderboltOutlined"}),onClick:function(){B()},loading:D,size:"small",children:"Regenerate"})]}),children:[(null==z?void 0:z.hasUnreleasedChanges)&&(0,r.jsx)(l.UIAccordion,{size:"small",style:{marginBottom:16},defaultActiveKey:["timeline"],items:[{key:"timeline",label:"Git Timeline",extra:(0,r.jsx)(l.UISpace,{children:(0,r.jsxs)(l.UITag,{children:[z.unreleased," commits"]})}),children:(0,r.jsxs)(r.Fragment,{children:[z.suggestedVersion&&(0,r.jsx)("div",{style:{marginBottom:16,padding:"8px 12px",background:"#f6ffed",borderRadius:4},children:(0,r.jsxs)(l.UISpace,{children:[(0,r.jsx)(l.UIIcon,{name:"ArrowUpOutlined"}),(0,r.jsxs)(l.UITypographyText,{strong:!0,children:[z.currentVersion||"0.0.0"," → ",z.suggestedVersion]}),(0,r.jsx)(l.UITag,{color:"major"===z.suggestedBump?"red":"minor"===z.suggestedBump?"orange":"blue",children:z.suggestedBump})]})}),(0,r.jsx)(l.UITimeline,{mode:"left",items:(null!=(n=z.commits)?n:[]).slice(0,j?void 0:5).map(function(e){return{color:"feat"===e.type?"green":"fix"===e.type?"red":"BREAKING"===e.type?"volcano":"gray",children:(0,r.jsxs)("div",{children:[(0,r.jsxs)(l.UISpace,{size:"small",children:[(0,r.jsx)(l.UITag,{color:"feat"===e.type?"green":"fix"===e.type?"red":"BREAKING"===e.type?"volcano":"default",style:{fontSize:10},children:e.type}),(0,r.jsx)(l.UITypographyText,{code:!0,style:{fontSize:10},children:e.shortSha})]}),(0,r.jsx)("div",{style:{marginTop:2},children:(0,r.jsx)(l.UITypographyText,{style:{fontSize:12},children:e.message})})]})}})}),(null!=(t=null==(i=z.commits)?void 0:i.length)?t:0)>5&&(0,r.jsx)(l.UIButton,{variant:"link",size:"small",icon:j?(0,r.jsx)(l.UIIcon,{name:"UpOutlined"}):(0,r.jsx)(l.UIIcon,{name:"DownOutlined"}),onClick:function(){return b(!j)},style:{padding:0},children:j?"Show less":"Show ".concat((null!=(s=null==(d=z.commits)?void 0:d.length)?s:0)-5," more")})]})}]}),(0,r.jsx)(l.UITable,{columns:F,dataSource:L.packages,rowKey:"name",pagination:!1,size:"small"})]})}function p(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=Array(n);t<n;t++)r[t]=e[t];return r}function h(e,n,t,r,a,s,o){try{var l=e[s](o),i=l.value}catch(e){t(e);return}l.done?n(i):Promise.resolve(i).then(r,a)}function y(e){return function(){var n=this,t=arguments;return new Promise(function(r,a){var s=e.apply(n,t);function o(e){h(s,r,a,o,l,"next",e)}function l(e){h(s,r,a,o,l,"throw",e)}o(void 0)})}}function f(e,n){return null!=n&&"u">typeof Symbol&&n[Symbol.hasInstance]?!!n[Symbol.hasInstance](e):e instanceof n}function g(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var s=[],o=!0,l=!1;try{for(a=a.call(e);!(o=(t=a.next()).done)&&(s.push(t.value),!n||s.length!==n);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==a.return||a.return()}finally{if(l)throw r}}return s}}(e,n)||function(e,n){if(e){if("string"==typeof e)return p(e,n);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 p(e,n)}}(e,n)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e,n){var t,r,a,s={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:i(0)}),l(o,"throw",{value:i(1)}),l(o,"return",{value:i(2)}),"function"==typeof Symbol&&l(o,Symbol.iterator,{value:function(){return this}}),o;function i(l){return function(i){var c=[l,i];if(t)throw TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(s=0)),s;)try{if(t=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return s.label++,{value:c[1],done:!1};case 5:s.label++,r=c[1],c=[0];continue;case 7:c=s.ops.pop(),s.trys.pop();continue;default:if(!(a=(a=s.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){s=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){s.label=c[1];break}if(6===c[0]&&s.label<a[1]){s.label=a[1],a=c;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(c);break}a[2]&&s.ops.pop(),s.trys.pop();continue}c=n.call(e,s)}catch(e){c=[6,e],r=0}finally{t=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function x(e){var n=e.selectedScope,t=e.onChangelogReady,s=g(a.useState(!0),2),i=s[0],c=s[1],u=g(a.useState(""),2),d=u[0],p=u[1],h=g(a.useState(!1),2),x=h[0],I=h[1],j=g(a.useState(!0),2),b=j[0],v=j[1],U=n?"/v1/plugins/release/changelog?scope=".concat(encodeURIComponent(n)):"",S=(0,o.useData)(U),k=S.data,T=S.isLoading,w=(0,o.useMutateData)("/v1/plugins/release/changelog/generate","POST"),C=w.mutateAsync,O=w.isLoading,E=(0,o.useMutateData)("/v1/plugins/release/changelog/save","POST"),P=E.mutateAsync,A=E.isLoading;a.useEffect(function(){(null==k?void 0:k.markdown)?p(k.markdown):p(""),I(!1)},[k]),a.useEffect(function(){t(!!(d&&!x))},[d,x,t]);var z=function(){return y(function(){var e,t,r,a,s;return m(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,C({scope:n,useLLM:b})];case 1:return p((e=o.sent()).markdown),I(!0),t=[],e.commitsCount&&t.push("".concat(e.commitsCount," commits")),e.tokensUsed&&t.push("".concat(e.tokensUsed," tokens")),r=e.usedLLM?"AI-enhanced":b?"Template":"Simple",a=t.length>0?" (".concat(t.join(", "),")"):"",l.UIMessage.success("".concat(r," changelog generated").concat(a)),[3,3];case 2:return s=o.sent(),l.UIMessage.error("Failed to generate changelog: ".concat(f(s,Error)?s.message:"Unknown error")),[3,3];case 3:return[2]}})})()};return T?(0,r.jsx)(l.UISpin,{size:"large",style:{display:"block",margin:"48px auto"}}):(null==k?void 0:k.markdown)||d?(0,r.jsxs)(l.UICard,{title:(0,r.jsxs)(l.UISpace,{children:[x?(0,r.jsx)(l.UITag,{color:"warning",children:"Unsaved"}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l.UIIcon,{name:"CheckCircleOutlined",style:{color:"#52c41a"}}),(0,r.jsx)(l.UITag,{color:"success",children:"Saved"})]}),(0,r.jsx)("span",{children:"Changelog"})]}),extra:(0,r.jsxs)(l.UISpace,{children:[(0,r.jsx)(l.UICheckbox,{checked:b,onChange:function(e){return v(e)},children:"Use AI"}),(0,r.jsx)(l.UIButton,{icon:(0,r.jsx)(l.UIIcon,{name:"ThunderboltOutlined"}),onClick:function(){z()},loading:O,size:"small",children:"Regenerate"}),(0,r.jsx)(l.UIButton,{icon:i?(0,r.jsx)(l.UIIcon,{name:"EyeOutlined"}):(0,r.jsx)(l.UIIcon,{name:"EditOutlined"}),onClick:function(){return c(!i)},size:"small",children:i?"Preview":"Edit"}),(0,r.jsx)(l.UIButton,{variant:"primary",icon:(0,r.jsx)(l.UIIcon,{name:"SaveOutlined"}),onClick:function(){y(function(){var e;return m(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,P({scope:n,markdown:d})];case 1:return t.sent(),I(!1),l.UIMessage.success("Changelog saved"),[3,3];case 2:return e=t.sent(),l.UIMessage.error("Failed to save: ".concat(f(e,Error)?e.message:"Unknown error")),[3,3];case 3:return[2]}})})()},loading:A,disabled:!x,size:"small",children:"Save"})]}),children:[(0,r.jsxs)(l.UIRow,{gutter:16,children:[(0,r.jsx)(l.UICol,{span:i?12:24,children:i?(0,r.jsx)(l.UIInputTextArea,{value:d,onChange:function(e){p(e.target.value),I(!0)},rows:20,style:{fontFamily:"monospace",fontSize:13,height:450},placeholder:"Write your changelog in Markdown..."}):(0,r.jsx)("div",{style:{maxHeight:500,overflow:"auto"},children:(0,r.jsx)(l.UIMarkdownViewer,{content:d})})}),i&&(0,r.jsx)(l.UICol,{span:12,children:(0,r.jsxs)("div",{style:{border:"1px solid #d9d9d9",borderRadius:4,height:450,overflow:"auto",padding:12,background:"#fafafa"},children:[(0,r.jsx)(l.UITypographyText,{type:"secondary",style:{fontSize:11,display:"block",marginBottom:8},children:"Preview"}),(0,r.jsx)(l.UIMarkdownViewer,{content:d})]})})]}),x&&(0,r.jsx)("div",{style:{marginTop:16,textAlign:"center"},children:(0,r.jsx)(l.UITypographyText,{type:"warning",style:{fontSize:12},children:"Save changelog to proceed to the next step"})})]}):(0,r.jsx)(l.UICard,{children:(0,r.jsx)(l.UIEmptyState,{description:"No changelog generated yet",image:l.UIEmptyState.PRESENTED_IMAGE_SIMPLE,children:(0,r.jsxs)(l.UISpace,{direction:"vertical",size:"middle",style:{display:"flex",alignItems:"center"},children:[(0,r.jsx)(l.UICheckbox,{checked:b,onChange:function(e){return v(e)},children:"Use AI-powered generation (requires LLM)"}),(0,r.jsx)(l.UIButton,{variant:"primary",icon:(0,r.jsx)(l.UIIcon,{name:"ThunderboltOutlined"}),onClick:function(){z()},loading:O,size:"large",children:"Generate Changelog"}),(0,r.jsx)(l.UITypographyText,{type:"secondary",style:{fontSize:12},children:b?"AI will analyze git commits and generate a detailed changelog":"Generate a simple changelog from package versions"})]})})})}function I(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=Array(n);t<n;t++)r[t]=e[t];return r}function j(e,n,t,r,a,s,o){try{var l=e[s](o),i=l.value}catch(e){t(e);return}l.done?n(i):Promise.resolve(i).then(r,a)}function b(e,n){return null!=n&&"u">typeof Symbol&&n[Symbol.hasInstance]?!!n[Symbol.hasInstance](e):e instanceof n}function v(e){if(0===e)return"0 B";var n=Math.floor(Math.log(e)/Math.log(1024));return"".concat(parseFloat((e/Math.pow(1024,n)).toFixed(1))," ").concat(["B","KB","MB","GB"][n])}function U(e){var n,t=e.split(".");return t.length>1&&null!=(n=t[t.length-1])?n:""}function S(e){switch(U(e)){case"js":case"mjs":case"cjs":return"#f5a623";case"ts":case"tsx":return"#3178c6";case"d.ts":return"#235a97";case"json":return"#5a9c5a";case"md":return"#083fa1";case"map":return"#8c8c8c";default:return"#595959"}}function k(e){var n,t,s=e.selectedScope,i=e.onPreviewReady,c=s?"/v1/plugins/release/preview?scope=".concat(encodeURIComponent(s)):"",u=(0,o.useData)(c),d=u.data,p=u.isLoading,h=u.error,y=u.refetch,f=(0,o.useMutateData)("/v1/plugins/release/build","POST"),g=f.mutateAsync,m=f.isLoading,x=null!=(n=null==d?void 0:d.packages.some(function(e){return"ready"!==e.buildStatus}))&&n,k=null!=(t=null==d?void 0:d.allBuilt)&&t;a.useEffect(function(){d&&d.packages.length>0&&k?i(!0):i(!1)},[d,k,i]);var T=function(){var e;return(e=function(){var e,n;return function(e,n){var t,r,a,s={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:i(0)}),l(o,"throw",{value:i(1)}),l(o,"return",{value:i(2)}),"function"==typeof Symbol&&l(o,Symbol.iterator,{value:function(){return this}}),o;function i(l){return function(i){var c=[l,i];if(t)throw TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(s=0)),s;)try{if(t=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return s.label++,{value:c[1],done:!1};case 5:s.label++,r=c[1],c=[0];continue;case 7:c=s.ops.pop(),s.trys.pop();continue;default:if(!(a=(a=s.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){s=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){s.label=c[1];break}if(6===c[0]&&s.label<a[1]){s.label=a[1],a=c;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(c);break}a[2]&&s.ops.pop(),s.trys.pop();continue}c=n.call(e,s)}catch(e){c=[6,e],r=0}finally{t=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,g({scope:s})];case 1:return(e=t.sent()).success?(l.UIMessage.success("Build completed: ".concat(e.builtCount,"/").concat(e.totalCount," packages")),y()):l.UIMessage.error("Build failed"),[3,3];case 2:return n=t.sent(),l.UIMessage.error("Build failed: ".concat(b(n,Error)?n.message:"Unknown error")),[3,3];case 3:return[2]}})},function(){var n=this,t=arguments;return new Promise(function(r,a){var s=e.apply(n,t);function o(e){j(s,r,a,o,l,"next",e)}function l(e){j(s,r,a,o,l,"throw",e)}o(void 0)})})()};if(p)return(0,r.jsx)(l.UICard,{children:(0,r.jsxs)("div",{style:{textAlign:"center",padding:48},children:[(0,r.jsx)(l.UISpin,{size:"large"}),(0,r.jsx)("div",{style:{marginTop:16},children:(0,r.jsx)(l.UITypographyText,{type:"secondary",children:"Analyzing package contents..."})})]})});if(h)return(0,r.jsx)(l.UICard,{children:(0,r.jsx)(l.UIEmptyState,{description:"Failed to load package preview: ".concat(b(h,Error)?h.message:"Unknown error")})});if(!d||0===d.packages.length)return(0,r.jsx)(l.UICard,{children:(0,r.jsx)(l.UIEmptyState,{description:"No packages found in release plan. Generate a plan first."})});var w=d.totalFiles,C=d.totalSize,O=new Map;d.packages.forEach(function(e){e.files.forEach(function(e){var n=U(e.path)||"other",t=O.get(n)||{count:0,size:0};O.set(n,{count:t.count+1,size:t.size+e.size})})});var E=Array.from(O.entries()).sort(function(e,n){return n[1].size-e[1].size}).slice(0,6),P=[{title:"File",dataIndex:"path",key:"path",render:function(e){return(0,r.jsxs)(l.UISpace,{size:4,children:[(0,r.jsx)(l.UIIcon,{name:"FileOutlined",style:{color:S(e)}}),(0,r.jsx)(l.UITypographyText,{code:!0,style:{fontSize:12},children:e})]})}},{title:"Size",dataIndex:"size",key:"size",width:100,align:"right",render:function(e){return(0,r.jsx)(l.UITypographyText,{type:"secondary",style:{fontSize:12},children:v(e)})}}];return(0,r.jsxs)("div",{children:[(0,r.jsxs)(l.UICard,{style:{marginBottom:16},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,r.jsxs)(l.UISpace,{size:"large",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)(l.UITypographyText,{type:"secondary",style:{display:"block",fontSize:12},children:"Total Files"}),(0,r.jsx)(l.UITitle,{level:3,style:{margin:0},children:w})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(l.UITypographyText,{type:"secondary",style:{display:"block",fontSize:12},children:"Total Size"}),(0,r.jsx)(l.UITitle,{level:3,style:{margin:0},children:v(C)})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(l.UITypographyText,{type:"secondary",style:{display:"block",fontSize:12},children:"Packages"}),(0,r.jsx)(l.UITitle,{level:3,style:{margin:0},children:d.packages.length})]})]}),(0,r.jsx)(l.UISpace,{children:k?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l.UIIcon,{name:"CheckCircleOutlined",style:{color:"#52c41a",fontSize:24}}),(0,r.jsx)(l.UITypographyText,{strong:!0,style:{color:"#52c41a"},children:"Ready to publish"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l.UIIcon,{name:"WarningOutlined",style:{color:"#faad14",fontSize:24}}),(0,r.jsx)(l.UITypographyText,{strong:!0,style:{color:"#faad14"},children:"Build required"})]})})]}),(0,r.jsxs)("div",{style:{marginTop:16},children:[(0,r.jsxs)(l.UISpace,{children:[(0,r.jsx)(l.UIButton,{variant:"primary",icon:(0,r.jsx)(l.UIIcon,{name:"BuildOutlined"}),onClick:function(){T()},loading:m,size:"small",children:m?"Building...":x?"Build":"Rebuild"}),(0,r.jsx)(l.UIButton,{icon:(0,r.jsx)(l.UIIcon,{name:"ReloadOutlined"}),onClick:function(){return y()},disabled:m,size:"small",children:"Refresh"})]}),x&&(0,r.jsx)(l.UIAlert,{variant:"warning",message:"Some packages need to be built before publishing",style:{marginTop:12},showIcon:!0})]}),(0,r.jsxs)("div",{style:{marginTop:24},children:[(0,r.jsx)(l.UITypographyText,{type:"secondary",style:{display:"block",marginBottom:8,fontSize:12},children:"File Types"}),(0,r.jsx)(l.UISpace,{wrap:!0,children:E.map(function(e){var n=function(e){if(Array.isArray(e))return e}(e)||function(e){var n,t,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var a=[],s=!0,o=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(a.push(n.value),2!==a.length);s=!0);}catch(e){o=!0,t=e}finally{try{s||null==r.return||r.return()}finally{if(o)throw t}}return a}}(e)||function(e){if(e){if("string"==typeof e)return I(e,2);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return I(e,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),t=n[0],a=n[1];return(0,r.jsxs)(l.UITag,{style:{margin:0},children:[(0,r.jsxs)("span",{style:{color:S(".".concat(t))},children:[".",t]})," ",a.count," (",v(a.size),")"]},t)})})]})]}),d.packages.map(function(e){return(0,r.jsxs)(l.UICard,{title:(0,r.jsxs)(l.UISpace,{children:[(0,r.jsx)(l.UIIcon,{name:"FolderOutlined"}),(0,r.jsx)(l.UITypographyText,{strong:!0,children:e.name}),(0,r.jsxs)(l.UITag,{color:"blue",children:["v",e.version]})]}),extra:(0,r.jsxs)(l.UISpace,{children:["ready"===e.buildStatus?(0,r.jsx)(l.UITag,{color:"success",children:"Built"}):"building"===e.buildStatus?(0,r.jsx)(l.UITag,{color:"processing",children:"Building..."}):(0,r.jsx)(l.UITag,{color:"warning",children:"Not built"}),(0,r.jsxs)(l.UITag,{children:[e.fileCount," files"]}),(0,r.jsx)(l.UITag,{color:"green",children:v(e.totalSize)})]}),style:{marginBottom:16},size:"small",children:[(0,r.jsx)("div",{style:{marginBottom:16},children:(0,r.jsx)(l.UIProgress,{percent:100,success:{percent:e.files.filter(function(e){return e.path.endsWith(".js")||e.path.endsWith(".mjs")}).reduce(function(e,n){return e+n.size},0)/e.totalSize*100},strokeColor:"#3178c6",trailColor:"#f0f0f0",showInfo:!1,size:"small"})}),(0,r.jsx)(l.UITable,{dataSource:e.files,columns:P,rowKey:"path",size:"small",pagination:e.files.length>10&&{pageSize:10}})]},e.name)})]})}function T(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=Array(n);t<n;t++)r[t]=e[t];return r}function w(e,n,t,r,a,s,o){try{var l=e[s](o),i=l.value}catch(e){t(e);return}l.done?n(i):Promise.resolve(i).then(r,a)}function C(e){return function(){var n=this,t=arguments;return new Promise(function(r,a){var s=e.apply(n,t);function o(e){w(s,r,a,o,l,"next",e)}function l(e){w(s,r,a,o,l,"throw",e)}o(void 0)})}}function O(e,n){return null!=n&&"u">typeof Symbol&&n[Symbol.hasInstance]?!!n[Symbol.hasInstance](e):e instanceof n}function E(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.forEach(function(n){var r;r=t[n],n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r})}return e}function P(e,n){return n=null!=n?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):(function(e){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n.push.apply(n,t)}return n})(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}),e}function A(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var s=[],o=!0,l=!1;try{for(a=a.call(e);!(o=(t=a.next()).done)&&(s.push(t.value),!n||s.length!==n);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==a.return||a.return()}finally{if(l)throw r}}return s}}(e,n)||function(e,n){if(e){if("string"==typeof e)return T(e,n);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 T(e,n)}}(e,n)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function z(e,n){var t,r,a,s={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:i(0)}),l(o,"throw",{value:i(1)}),l(o,"return",{value:i(2)}),"function"==typeof Symbol&&l(o,Symbol.iterator,{value:function(){return this}}),o;function i(l){return function(i){var c=[l,i];if(t)throw TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(s=0)),s;)try{if(t=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return s.label++,{value:c[1],done:!1};case 5:s.label++,r=c[1],c=[0];continue;case 7:c=s.ops.pop(),s.trys.pop();continue;default:if(!(a=(a=s.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){s=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){s.label=c[1];break}if(6===c[0]&&s.label<a[1]){s.label=a[1],a=c;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(c);break}a[2]&&s.ops.pop(),s.trys.pop();continue}c=n.call(e,s)}catch(e){c=[6,e],r=0}finally{t=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function R(e){var n,t,s=e.selectedScope,i=e.onReleaseComplete,c=A(a.useState(""),2),u=c[0],d=c[1],p=A(a.useState(""),2),h=p[0],y=p[1],f=A(a.useState([]),2),g=f[0],m=f[1],x=A(a.useState(!1),2),I=x[0],j=x[1],b=A(a.useState(!1),2),v=b[0],U=b[1],S=A(a.useState(!1),2),k=S[0],T=S[1],w=A(a.useState(!1),2),R=w[0],M=w[1],D=A(a.useState(null),2),B=D[0],L=D[1],F=s?"/v1/plugins/release/plan?scope=".concat(encodeURIComponent(s)):"",_=s?"/v1/plugins/release/checks?scope=".concat(encodeURIComponent(s)):"",N=(0,o.useData)(F).data,V=(0,o.useData)(_),G=V.data,$=V.isLoading,K=(0,o.useMutateData)("/v1/plugins/release/checks/run","POST").mutateAsync,H=(0,o.useMutateData)("/v1/plugins/release/run","POST"),W=H.mutateAsync,q=H.isLoading,Y=(0,o.useMutateData)("/v1/plugins/release/plan","DELETE"),J=Y.mutateAsync,Q=Y.isLoading;a.useEffect(function(){!G||I||v||0!==g.length||m(G.checks.map(function(e){return{id:e.id,name:e.name,status:"pending",optional:e.optional}}))},[G,I,v,g.length]);var X=g.length>0&&g.every(function(e){return"success"===e.status}),Z=g.some(function(e){return"error"===e.status}),ee=function(e){switch(e){case"running":return(0,r.jsx)(l.UIIcon,{name:"LoadingOutlined",style:{color:"#1890ff"}});case"success":return(0,r.jsx)(l.UIIcon,{name:"CheckCircleOutlined",style:{color:"#52c41a"}});case"error":return(0,r.jsx)(l.UIIcon,{name:"CloseCircleOutlined",style:{color:"#ff4d4f"}});default:return(0,r.jsx)(l.UIIcon,{name:"SafetyCertificateOutlined",style:{color:"#8c8c8c"}})}};return R?(0,r.jsx)(l.UICard,{children:(0,r.jsx)(l.UIResult,{status:"success",title:"Release Published!",subTitle:"".concat(null!=(n=null==N||null==(t=N.plan)?void 0:t.packages.length)?n:0," package(s) published to npm"),extra:[(0,r.jsx)(l.UIPopconfirm,{title:"Rollback Release",description:"This will unpublish the packages. Are you sure?",icon:(0,r.jsx)(l.UIIcon,{name:"ExclamationCircleOutlined",style:{color:"#ff4d4f"}}),onConfirm:function(){C(function(){var e;return z(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,J({scope:s})];case 1:return n.sent(),l.UIMessage.success("Rollback completed successfully"),M(!1),T(!1),L(null),j(!1),m(function(e){return e.map(function(e){return P(E({},e),{status:"pending",error:void 0,duration:void 0})})}),[3,3];case 2:return e=n.sent(),l.UIMessage.error("Rollback failed: ".concat(O(e,Error)?e.message:"Unknown error")),[3,3];case 3:return[2]}})})()},okText:"Yes, Rollback",okButtonProps:{danger:!0},cancelText:"Cancel",children:(0,r.jsx)(l.UIButton,{icon:(0,r.jsx)(l.UIIcon,{name:"RollbackOutlined"}),loading:Q,danger:!0,children:"Rollback"})},"rollback")]})}):(0,r.jsxs)("div",{children:[(0,r.jsx)(l.UICard,{title:(0,r.jsxs)(l.UISpace,{children:[(0,r.jsx)(l.UIIcon,{name:"BuildOutlined"}),(0,r.jsx)("span",{children:"Pre-release Checks"}),X&&(0,r.jsx)(l.UITag,{color:"success",children:"All Passed"}),Z&&(0,r.jsx)(l.UITag,{color:"error",children:"Failed"})]}),style:{marginBottom:16},children:(0,r.jsxs)(l.UISpace,{direction:"vertical",style:{width:"100%"},size:"middle",children:[$&&0===g.length&&(0,r.jsx)(l.UISkeleton,{active:!0,lines:4,title:!1}),!$&&0===g.length&&(0,r.jsx)(l.UITypographyText,{type:"secondary",children:"No checks configured in kb.config.json release.checks"}),g.map(function(e){return(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",background:"error"===e.status?"#fff2f0":"success"===e.status?"#f6ffed":"#fafafa",borderRadius:8,border:"1px solid ".concat("error"===e.status?"#ffccc7":"success"===e.status?"#b7eb8f":"#d9d9d9")},children:[(0,r.jsxs)(l.UISpace,{children:[ee(e.status),(0,r.jsxs)("div",{children:[(0,r.jsxs)(l.UISpace,{children:[(0,r.jsx)(l.UITypographyText,{strong:!0,children:e.name}),e.optional&&(0,r.jsx)(l.UITag,{children:"optional"})]}),e.error&&(0,r.jsx)("div",{style:{marginTop:4},children:(0,r.jsx)("pre",{style:{margin:0,padding:"8px 12px",fontSize:11,lineHeight:1.5,color:"#cf1322",background:"#fff1f0",borderRadius:4,maxHeight:200,overflow:"auto",whiteSpace:"pre-wrap",wordBreak:"break-all"},children:e.error})})]})]}),e.duration&&(0,r.jsxs)(l.UITag,{children:[(e.duration/1e3).toFixed(1),"s"]})]},e.id)}),(0,r.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,r.jsx)(l.UIButton,{variant:"primary",icon:(0,r.jsx)(l.UIIcon,{name:"BuildOutlined"}),onClick:function(){C(function(){var e,n;return z(this,function(t){switch(t.label){case 0:U(!0),j(!1),m(function(e){return e.map(function(e){return P(E({},e),{status:"running",error:void 0,duration:void 0})})}),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,K({scope:s})];case 2:return e=t.sent(),m(function(n){var t=new Map(e.checks.map(function(e){return[e.id,e]}));return n.map(function(e){var n=t.get(e.id);return n?P(E({},e),{status:n.success?"success":"error",error:n.error,duration:n.durationMs}):P(E({},e),{status:"pending"})})}),j(e.success),e.success||l.UIMessage.error("Some checks failed"),[3,5];case 3:return n=t.sent(),m(function(e){return e.map(function(e){return P(E({},e),{status:"pending"})})}),l.UIMessage.error("Checks failed: ".concat(O(n,Error)?n.message:"Unknown error")),[3,5];case 4:return U(!1),[7];case 5:return[2]}})})()},loading:v,disabled:I,children:v?"Running Checks...":"Run Checks"}),(I||Z)&&(0,r.jsx)(l.UIButton,{onClick:function(){m(function(e){return e.map(function(e){return P(E({},e),{status:"pending",error:void 0,duration:void 0})})}),j(!1)},children:"Reset"})]})]})}),(0,r.jsxs)(l.UICard,{title:(0,r.jsxs)(l.UISpace,{children:[(0,r.jsx)(l.UIIcon,{name:"LockOutlined"}),(0,r.jsx)("span",{children:"npm Publish"})]}),children:[!X&&(0,r.jsx)(l.UIAlert,{message:"Complete pre-release checks first",description:"All checks must pass before you can publish to npm.",variant:"info",showIcon:!0,style:{marginBottom:16}}),B&&(0,r.jsx)(l.UIAlert,{message:"Release Failed",description:B,variant:"error",showIcon:!0,closable:!0,onClose:function(){return L(null)},style:{marginBottom:16}}),(0,r.jsxs)(l.UISpace,{direction:"vertical",style:{width:"100%"},size:"middle",children:[(null==N?void 0:N.plan)&&(0,r.jsx)(l.UIAccordion,{size:"small",items:[{key:"summary",label:"Release Summary",extra:(0,r.jsxs)(l.UITag,{color:"blue",children:[N.plan.packages.length," package(s)"]}),children:(0,r.jsx)("div",{children:N.plan.packages.map(function(e){return(0,r.jsxs)("div",{style:{marginBottom:4},children:[(0,r.jsx)(l.UITypographyText,{code:!0,children:e.name}),(0,r.jsxs)(l.UITypographyText,{type:"secondary",children:[" ",e.currentVersion," → "]}),(0,r.jsx)(l.UITypographyText,{strong:!0,style:{color:"#52c41a"},children:e.nextVersion})]},e.name)})})}]}),(0,r.jsx)(l.UIDivider,{style:{margin:"8px 0"}}),(0,r.jsxs)("div",{children:[(0,r.jsxs)(l.UITypographyText,{strong:!0,style:{display:"block",marginBottom:8},children:["npm One-Time Password (OTP)"," ",(0,r.jsx)(l.UITypographyText,{type:"secondary",style:{fontWeight:"normal"},children:"— optional"})]}),(0,r.jsx)(l.UITypographyText,{type:"secondary",style:{display:"block",marginBottom:8,fontSize:12},children:"Required only if your npm account uses 2FA. Leave empty to publish via NPM_TOKEN."}),(0,r.jsx)(l.UIInput,{prefix:(0,r.jsx)(l.UIIcon,{name:"LockOutlined"}),placeholder:"123456",value:u,onChange:function(e){d(e.replace(/\D/g,"").slice(0,6)),y("")},maxLength:6,style:{width:200,fontSize:18,letterSpacing:8},status:h?"error":void 0,disabled:!X||k}),h&&(0,r.jsx)(l.UITypographyText,{type:"danger",style:{display:"block",marginTop:4,fontSize:12},children:h})]}),(0,r.jsx)(l.UIDivider,{style:{margin:"8px 0"}}),(0,r.jsx)(l.UIButton,{variant:"primary",size:"large",icon:(0,r.jsx)(l.UIIcon,{name:"RocketOutlined"}),onClick:function(){C(function(){var e,n,t,r,a;return z(this,function(o){switch(o.label){case 0:if(!(u&&!/^\d{6}$/.test(u)?(y("OTP must be 6 digits"),!1):(y(""),!0)))return[2];T(!0),L(null),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,W({scope:s,dryRun:!1,otp:u})];case 2:return(e=o.sent()).success?(M(!0),l.UIMessage.success("Release published successfully!"),i()):(L(t=(null==(n=e.errors)?void 0:n.join(", "))||"Unknown publish error"),T(!1),l.UIMessage.error("Release failed: ".concat(t))),[3,4];case 3:return L(a=O(r=o.sent(),Error)?r.message:"Unknown error"),T(!1),l.UIMessage.error("Release failed: ".concat(a)),[3,4];case 4:return[2]}})})()},loading:q,disabled:!X||k,block:!0,children:"Publish to npm"}),(0,r.jsx)(l.UITypographyText,{type:"secondary",style:{textAlign:"center",display:"block",fontSize:12},children:"This action will publish packages to the npm registry"})]})]})]})}function M(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=Array(n);t<n;t++)r[t]=e[t];return r}function D(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var s=[],o=!0,l=!1;try{for(a=a.call(e);!(o=(t=a.next()).done)&&(s.push(t.value),!n||s.length!==n);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==a.return||a.return()}finally{if(l)throw r}}return s}}(e,n)||function(e,n){if(e){if("string"==typeof e)return M(e,n);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,n)}}(e,n)||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 B=["plan","changelog","preview","release"],L={plan:0,changelog:1,preview:2,release:3};function F(e){var n,t=e.selectedScope,i=e.selectedScopePath,c=D((0,s.useSearchParams)(),2),u=c[0],p=c[1],h=(0,o.useMutateData)("/v1/plugins/release/plan","DELETE").mutateAsync,y=null!=(n=L[u.get("step")])?n:0,f=function(e){p(function(n){var t,r=new URLSearchParams(n);return r.set("step",null!=(t=B[e])?t:"plan"),r})},g=D(a.useState(!1),2),m=g[0],I=g[1],j=D(a.useState(!1),2),b=j[0],v=j[1],U=D(a.useState(!1),2),S=U[0],T=U[1],w=D(a.useState(!1),2),C=w[0],O=w[1],E=[{title:"Plan",icon:(0,r.jsx)(l.UIIcon,{name:"FileTextOutlined"})},{title:"Changelog",icon:(0,r.jsx)(l.UIIcon,{name:"EditOutlined"})},{title:"Preview",icon:(0,r.jsx)(l.UIIcon,{name:"FolderOutlined"})},{title:"Release",icon:(0,r.jsx)(l.UIIcon,{name:"RocketOutlined"})}];return t?m?(0,r.jsx)(l.UICard,{children:(0,r.jsx)(l.UIResult,{status:"success",title:"Release Complete!",subTitle:"Your packages have been published successfully.",extra:[(0,r.jsx)(l.UIButton,{variant:"primary",onClick:function(){h({scope:t}),f(0),I(!1),v(!1),T(!1),O(!1)},children:"Start New Release"},"new")]})}):(0,r.jsxs)("div",{children:[(0,r.jsx)(l.UICard,{size:"small",style:{marginBottom:16},children:(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,r.jsx)(l.UISteps,{current:y,items:E,type:"navigation",size:"small",onChange:function(e){e<y&&f(e)},style:{flex:1}}),(0,r.jsxs)("div",{style:{display:"flex",gap:8,marginLeft:32,flexShrink:0},children:[(0,r.jsx)(l.UIButton,{icon:(0,r.jsx)(l.UIIcon,{name:"ArrowLeftOutlined"}),onClick:function(){y>0&&f(y-1)},disabled:0===y,size:"small",children:"Back"}),y<E.length-1&&(0,r.jsxs)(l.UIButton,{variant:"primary",onClick:function(){y<E.length-1&&f(y+1)},disabled:!(0===y?b:1===y?S:2===y&&C),size:"small",children:["Next ",(0,r.jsx)(l.UIIcon,{name:"ArrowRightOutlined"})]})]})]})}),function(){switch(y){case 0:return(0,r.jsx)(d,{selectedScope:t,selectedScopePath:i,onPlanReady:v});case 1:return(0,r.jsx)(x,{selectedScope:t,onChangelogReady:T});case 2:return(0,r.jsx)(k,{selectedScope:t,onPreviewReady:O});case 3:return(0,r.jsx)(R,{selectedScope:t,onReleaseComplete:function(){return I(!0)}});default:return null}}()]}):(0,r.jsx)(l.UICard,{children:(0,r.jsx)(l.UIResult,{status:"info",title:"Select a scope",subTitle:"Please select a package or monorepo scope to start the release process."})})}function _(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=Array(n);t<n;t++)r[t]=e[t];return r}function N(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var s=[],o=!0,l=!1;try{for(a=a.call(e);!(o=(t=a.next()).done)&&(s.push(t.value),!n||s.length!==n);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==a.return||a.return()}finally{if(l)throw r}}return s}}(e,n)||function(e,n){if(e){if("string"==typeof e)return _(e,n);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 _(e,n)}}(e,n)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function V(e){var n,t,a,s,i=e.releaseId,c=e.releaseScope,u=(0,o.useData)("/v1/plugins/release/history/".concat(encodeURIComponent(c),"/").concat(encodeURIComponent(i),"/report")).data,d=(0,o.useData)("/v1/plugins/release/history/".concat(encodeURIComponent(c),"/").concat(encodeURIComponent(i),"/plan")).data,p=(0,o.useData)("/v1/plugins/release/history/".concat(encodeURIComponent(c),"/").concat(encodeURIComponent(i),"/changelog")).data,h=[{key:"report",label:"Report",children:(null==u?void 0:u.report)?(0,r.jsxs)(l.UIDescriptions,{bordered:!0,column:1,size:"small",children:[(0,r.jsx)(l.UIDescriptionsItem,{label:"Release ID",children:u.id}),(0,r.jsx)(l.UIDescriptionsItem,{label:"Scope",children:u.report.scope}),(0,r.jsx)(l.UIDescriptionsItem,{label:"Stage",children:u.report.stage}),(0,r.jsx)(l.UIDescriptionsItem,{label:"Timestamp",children:new Date(u.report.ts).toLocaleString()}),(0,r.jsx)(l.UIDescriptionsItem,{label:"Status",children:(0,r.jsx)(l.UITag,{color:(null==(n=u.report.result)?void 0:n.ok)?"success":"error",children:(null==(t=u.report.result)?void 0:t.ok)?"Success":"Failed"})}),(null==(a=u.report.result)?void 0:a.timingMs)&&(0,r.jsxs)(l.UIDescriptionsItem,{label:"Duration",children:[u.report.result.timingMs,"ms"]}),(null==(s=u.report.result)?void 0:s.published)&&(0,r.jsx)(l.UIDescriptionsItem,{label:"Packages Published",children:u.report.result.published.length})]}):(0,r.jsx)(l.UISpin,{})},{key:"plan",label:"Plan",children:(null==d?void 0:d.plan)?(0,r.jsxs)("div",{children:[(0,r.jsxs)(l.UIDescriptions,{bordered:!0,column:2,size:"small",style:{marginBottom:16},children:[(0,r.jsx)(l.UIDescriptionsItem,{label:"Scope",children:d.plan.scope}),(0,r.jsx)(l.UIDescriptionsItem,{label:"Strategy",children:d.plan.strategy}),(0,r.jsx)(l.UIDescriptionsItem,{label:"Packages",children:d.plan.packages.length}),(0,r.jsx)(l.UIDescriptionsItem,{label:"Rollback",children:d.plan.rollbackEnabled?"Enabled":"Disabled"})]}),d.plan.packages.map(function(e,n){return(0,r.jsx)(l.UICard,{size:"small",style:{marginBottom:8},children:(0,r.jsxs)(l.UISpace,{direction:"vertical",size:"small",children:[(0,r.jsx)(l.UITypographyText,{strong:!0,children:e.name}),(0,r.jsxs)(l.UISpace,{children:[(0,r.jsx)(l.UITag,{color:"blue",children:e.currentVersion}),"→",(0,r.jsx)(l.UITag,{color:"green",children:e.nextVersion}),(0,r.jsx)(l.UITag,{children:e.bump})]}),(0,r.jsx)(l.UITypographyText,{type:"secondary",children:e.reason})]})},n)})]}):(0,r.jsx)(l.UISpin,{})},{key:"changelog",label:"Changelog",children:(null==p?void 0:p.markdown)?(0,r.jsx)(l.UIMarkdownViewer,{content:p.markdown}):(0,r.jsx)(l.UISpin,{})}];return(0,r.jsx)(l.UITabs,{items:h})}function G(e){var n,t=e.selectedScope,s=N((0,a.useState)(null),2),i=s[0],c=s[1],u=N((0,a.useState)(""),2),d=u[0],p=u[1],h=N((0,a.useState)(!1),2),y=h[0],f=h[1],g=(0,o.useData)("/v1/plugins/release/history"),m=g.data,x=g.isLoading,I=g.error,j=function(e,n){c(e),p(n),f(!0)};if(x)return(0,r.jsx)(l.UISpin,{size:"large",style:{display:"block",margin:"48px auto"}});if(I)return(0,r.jsx)(l.UICard,{children:(0,r.jsx)(l.UIEmptyState,{description:"Failed to load history: ".concat((null!=(n=Error)&&"u">typeof Symbol&&n[Symbol.hasInstance]?!!n[Symbol.hasInstance](I):I instanceof n)?I.message:"Unknown error"),image:l.UIEmptyState.PRESENTED_IMAGE_SIMPLE})});var b=(null==m?void 0:m.releases)?t?m.releases.filter(function(e){return e.scope===t}):m.releases:[];if(0===b.length)return(0,r.jsx)(l.UICard,{children:(0,r.jsx)(l.UIEmptyState,{description:t?'No release history for scope "'.concat(t,'" yet'):"No release history yet",image:l.UIEmptyState.PRESENTED_IMAGE_SIMPLE})});var v=b.map(function(e){return{dot:e.success?(0,r.jsx)(l.UIIcon,{name:"CheckCircleOutlined",style:{color:"#52c41a"}}):(0,r.jsx)(l.UIIcon,{name:"CloseCircleOutlined",style:{color:"#ff4d4f"}}),children:(0,r.jsx)(l.UICard,{size:"small",style:{marginBottom:16},children:(0,r.jsxs)(l.UISpace,{direction:"vertical",style:{width:"100%"},children:[(0,r.jsxs)(l.UISpace,{children:[(0,r.jsx)(l.UITag,{color:"blue",children:e.scope}),(0,r.jsx)(l.UITag,{color:e.success?"success":"error",children:e.success?"Success":"Failed"}),(0,r.jsx)(l.UITypographyText,{type:"secondary",children:new Date(e.timestamp).toLocaleString()})]}),(0,r.jsxs)(l.UITypographyText,{children:["Released ",e.packages.length," package(s)"]}),(0,r.jsx)(l.UIButton,{icon:(0,r.jsx)(l.UIIcon,{name:"EyeOutlined"}),onClick:function(){return j(e.id,e.scope)},size:"small",children:"View Details"})]})})}});return(0,r.jsxs)(l.UICard,{title:(0,r.jsx)(l.UITitle,{level:4,style:{margin:0},children:"Release History"}),children:[(0,r.jsx)(l.UITimeline,{items:v}),(0,r.jsx)(l.UIModal,{title:"Release Details - ".concat(i),open:y,onCancel:function(){f(!1),c(null),p("")},footer:null,width:800,children:i&&d&&(0,r.jsx)(V,{releaseId:i,releaseScope:d})})]})}function $(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=Array(n);t<n;t++)r[t]=e[t];return r}let K=function(){var e,n,t,i,c,u=function(e){if(Array.isArray(e))return e}(e=(0,s.useSearchParams)())||function(e){var n,t,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var a=[],s=!0,o=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(a.push(n.value),2!==a.length);s=!0);}catch(e){o=!0,t=e}finally{try{s||null==r.return||r.return()}finally{if(o)throw t}}return a}}(e)||function(e){if(e){if("string"==typeof e)return $(e,2);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return $(e,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),d=u[0],p=u[1],h=null!=(n=d.get("scope"))?n:"",y=function(e){p(function(n){var t=new URLSearchParams(n);return t.set("scope",e),t.delete("step"),t})},f=(0,o.useData)("/v1/plugins/release/scopes"),g=f.data,m=f.isLoading;a.useEffect(function(){if((null==g?void 0:g.scopes)&&g.scopes.length>0&&!h){var e,n,t=g.scopes.find(function(e){return"root"===e.id}),r=g.scopes[0];y(null!=(e=null!=(n=null==t?void 0:t.id)?n:null==r?void 0:r.id)?e:"")}},[g]);var x=null==g||null==(i=g.scopes)?void 0:i.find(function(e){return e.id===h}),I=function(e){switch(e){case"monorepo":return"blue";case"package":return"green";case"root":return"purple";default:return"default"}},j=(0,r.jsx)(l.UITabs,{syncUrl:"search",items:[{key:"overview",label:"Release",children:(0,r.jsxs)(r.Fragment,{children:[x&&(0,r.jsx)(l.UIAccordion,{size:"small",style:{marginBottom:16},items:[{key:"scope-info",label:x.currentVersion?"".concat(x.name," v").concat(x.currentVersion):x.name,extra:(0,r.jsx)(l.UITag,{color:I(x.type),children:x.type}),children:(0,r.jsxs)(l.UIDescriptions,{size:"small",column:1,bordered:!0,children:[(0,r.jsx)(l.UIDescriptionsItem,{label:"Package Name",children:x.id}),x.currentVersion&&(0,r.jsx)(l.UIDescriptionsItem,{label:"Current Version",children:x.currentVersion}),x.description&&(0,r.jsx)(l.UIDescriptionsItem,{label:"Description",children:x.description}),(0,r.jsx)(l.UIDescriptionsItem,{label:"Path",children:(0,r.jsx)("code",{style:{fontSize:12},children:x.path})}),(0,r.jsx)(l.UIDescriptionsItem,{label:"Type",children:(0,r.jsx)(l.UITag,{color:I(x.type),children:x.type})})]})}]}),(0,r.jsx)(F,{selectedScope:h,selectedScopePath:null==x?void 0:x.path})]})},{key:"history",label:"History",children:(0,r.jsx)(G,{selectedScope:h})}]});return(0,r.jsx)(l.UIPage,{children:(0,r.jsx)(l.UIPageHeader,{title:"Release Manager",description:"Plan, execute, and audit releases across your workspace",actions:(0,r.jsx)(l.UISelect,{style:{width:400},placeholder:"Select scope (package or monorepo)",value:h||void 0,onChange:function(e){return y(e)},loading:m,showSearch:!0,optionFilterProp:"label",options:null!=(t=null==g||null==(c=g.scopes)?void 0:c.map(function(e){return{label:"".concat(e.name," (").concat(e.type,")"),value:e.id}}))?t:[]}),tabs:j})})}}}]);
1
+ "use strict";(self.rspackChunk_kb_labs_release_manager_cli=self.rspackChunk_kb_labs_release_manager_cli||[]).push([[135],{6026(e,t){var n=Symbol.for("react.transitional.element");function r(e,t,r){var a=null;if(void 0!==r&&(a=""+r),void 0!==t.key&&(a=""+t.key),"key"in t)for(var s in r={},t)"key"!==s&&(r[s]=t[s]);else r=t;return{$$typeof:n,type:e,key:a,ref:void 0!==(t=r.ref)?t:null,props:r}}t.Fragment=Symbol.for("react.fragment"),t.jsx=r,t.jsxs=r},4552(e,t,n){e.exports=n(6026)},7198(e,t,n){n.r(t),n.d(t,{default:()=>Q});var r=n(4552),a=n(1692),s=n(719),o=n(3377),l=n(4035);function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function c(e,t,n,r,a,s,o){try{var l=e[s](o),i=l.value}catch(e){n(e);return}l.done?t(i):Promise.resolve(i).then(r,a)}function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var s=[],o=!0,l=!1;try{for(a=a.call(e);!(o=(n=a.next()).done)&&(s.push(n.value),!t||s.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==a.return||a.return()}finally{if(l)throw r}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(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.")}()}function d(e){var t,n,s,i,d,p,h=e.selectedScope,y=e.selectedScopePath,f=e.onPlanReady,g=u(a.useState(!0),2),m=g[0],x=g[1],I=u(a.useState(!1),2),v=I[0],j=I[1],b=h?"/v1/plugins/release/status?scope=".concat(encodeURIComponent(h)):"",U=h?"/v1/plugins/release/plan?scope=".concat(encodeURIComponent(h)):"",S=h?"/v1/plugins/release/git-timeline?scope=".concat(encodeURIComponent(h)):"",k=(0,o.useData)(b),T=k.data,w=k.isLoading,C=k.refetch,E=(0,o.useData)(U),P=E.data,A=E.isLoading,R=E.refetch,O=(0,o.useData)(S).data,z=(0,o.useMutateData)("/v1/plugins/release/generate","POST"),M=z.mutateAsync,B=z.isLoading;a.useEffect(function(){f(!!((null==P?void 0:P.plan)&&P.plan.packages.length>0))},[P,f]);var D=function(){var e;return(e=function(){var e,t,n,r,a;return function(e,t){var n,r,a,s={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:i(0)}),l(o,"throw",{value:i(1)}),l(o,"return",{value:i(2)}),"function"==typeof Symbol&&l(o,Symbol.iterator,{value:function(){return this}}),o;function i(l){return function(i){var c=[l,i];if(n)throw TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(s=0)),s;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return s.label++,{value:c[1],done:!1};case 5:s.label++,r=c[1],c=[0];continue;case 7:c=s.ops.pop(),s.trys.pop();continue;default:if(!(a=(a=s.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){s=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){s.label=c[1];break}if(6===c[0]&&s.label<a[1]){s.label=a[1],a=c;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(c);break}a[2]&&s.ops.pop(),s.trys.pop();continue}c=t.call(e,s)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,M({scope:h,scopePath:y,useLLM:m})];case 1:return e=s.sent(),C(),R(),t=e.confidence?Math.round(100*e.confidence):0,n=e.tokensUsed?", ".concat(e.tokensUsed," tokens"):"",r=m?"AI-powered":"Simple",l.UIMessage.success("".concat(r," plan generated (").concat(t,"% confidence").concat(n,")")),[3,3];case 2:var o;return a=s.sent(),l.UIMessage.error("Failed to generate plan: ".concat((null!=(o=Error)&&"u">typeof Symbol&&o[Symbol.hasInstance]?!!o[Symbol.hasInstance](a):a instanceof o)?a.message:"Unknown error")),[3,3];case 3:return[2]}})},function(){var t=this,n=arguments;return new Promise(function(r,a){var s=e.apply(t,n);function o(e){c(s,r,a,o,l,"next",e)}function l(e){c(s,r,a,o,l,"throw",e)}o(void 0)})})()};if(w)return(0,r.jsx)(l.UISpin,{size:"large",style:{display:"block",margin:"48px auto"}});if(!(null==T?void 0:T.hasPlan)&&!(null==P?void 0:P.plan))return void 0===O||O.hasUnreleasedChanges?(0,r.jsx)(l.UICard,{children:(0,r.jsx)(l.UIEmptyState,{description:"No release plan generated yet",image:l.UIEmptyState.PRESENTED_IMAGE_SIMPLE,children:(0,r.jsxs)(l.UISpace,{direction:"vertical",size:"middle",style:{display:"flex",alignItems:"center"},children:[(0,r.jsx)(l.UICheckbox,{checked:m,onChange:function(e){return x(e)},children:"Use AI-powered analysis (requires LLM)"}),(0,r.jsx)(l.UIButton,{variant:"primary",icon:(0,r.jsx)(l.UIIcon,{name:"ThunderboltOutlined"}),onClick:function(){D()},loading:B,size:"large",children:"Generate Release Plan"}),(0,r.jsx)(l.UITypographyText,{type:"secondary",style:{fontSize:12},children:m?"AI will analyze git history and provide intelligent reasoning for version bumps":"Generate plan using conventional commits analysis"})]})})}):(0,r.jsx)(l.UICard,{children:(0,r.jsx)(l.UIEmptyState,{description:"No unreleased changes since ".concat(null!=(p=null==O?void 0:O.lastTag)?p:"last release"),image:l.UIEmptyState.PRESENTED_IMAGE_SIMPLE})});if(A||!(null==P?void 0:P.plan))return(0,r.jsx)(l.UISpin,{size:"large",style:{display:"block",margin:"48px auto"}});var L=P.plan;if(0===L.packages.length)return(0,r.jsx)(l.UICard,{children:(0,r.jsx)(l.UIEmptyState,{description:"Plan exists but contains no packages",image:l.UIEmptyState.PRESENTED_IMAGE_SIMPLE,children:(0,r.jsxs)(l.UISpace,{direction:"vertical",size:"middle",style:{display:"flex",alignItems:"center"},children:[(0,r.jsx)(l.UITypographyText,{type:"secondary",style:{fontSize:12},children:"This may happen if there are no changes to release or the scope has no packages."}),(0,r.jsx)(l.UICheckbox,{checked:m,onChange:function(e){return x(e)},children:"Use AI-powered analysis"}),(0,r.jsx)(l.UIButton,{variant:"primary",icon:(0,r.jsx)(l.UIIcon,{name:"ThunderboltOutlined"}),onClick:function(){D()},loading:B,children:"Regenerate Plan"})]})})});var N=[{title:"Package",dataIndex:"name",key:"name",width:280,ellipsis:!0,render:function(e){return(0,r.jsx)(l.UITypographyText,{strong:!0,ellipsis:{tooltip:e},children:e})}},{title:"Current",dataIndex:"currentVersion",key:"currentVersion",width:180,ellipsis:!0,render:function(e){return e?(0,r.jsx)(l.UITag,{color:"blue",title:e,style:{maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis"},children:e}):"-"}},{title:"Next",dataIndex:"nextVersion",key:"nextVersion",width:180,ellipsis:!0,render:function(e){return e?(0,r.jsx)(l.UITag,{color:"green",title:e,style:{maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis"},children:e}):"-"}},{title:"Bump",dataIndex:"bump",key:"bump",width:80,render:function(e){return e?(0,r.jsx)(l.UITag,{color:{major:"red",minor:"orange",patch:"blue"}[e]||"default",children:e}):"-"}},{title:"Reason",dataIndex:"reason",key:"reason",ellipsis:!0,render:function(e){return(0,r.jsx)(l.UITypographyText,{type:"secondary",style:{fontSize:12},children:e||"-"})}}];return(0,r.jsxs)(l.UICard,{title:(0,r.jsxs)(l.UISpace,{children:[(0,r.jsx)(l.UIIcon,{name:"CheckCircleOutlined",style:{color:"#52c41a"}}),(0,r.jsx)("span",{children:"Release Plan Ready"}),(0,r.jsxs)(l.UITag,{color:"blue",children:[L.packages.length," package(s)"]})]}),extra:(0,r.jsxs)(l.UISpace,{children:[(0,r.jsx)(l.UICheckbox,{checked:m,onChange:function(e){return x(e)},children:"Use AI"}),(0,r.jsx)(l.UIButton,{icon:(0,r.jsx)(l.UIIcon,{name:"ThunderboltOutlined"}),onClick:function(){D()},loading:B,size:"small",children:"Regenerate"})]}),children:[(null==O?void 0:O.hasUnreleasedChanges)&&(0,r.jsx)(l.UIAccordion,{size:"small",style:{marginBottom:16},defaultActiveKey:["timeline"],items:[{key:"timeline",label:"Git Timeline",extra:(0,r.jsx)(l.UISpace,{children:(0,r.jsxs)(l.UITag,{children:[O.unreleased," commits"]})}),children:(0,r.jsxs)(r.Fragment,{children:[O.suggestedVersion&&(0,r.jsx)(l.UIAlert,{variant:"success",style:{marginBottom:16},message:(0,r.jsxs)(l.UISpace,{children:[(0,r.jsxs)(l.UITypographyText,{strong:!0,children:[O.currentVersion||"0.0.0"," → ",O.suggestedVersion]}),(0,r.jsx)(l.UITag,{color:"major"===O.suggestedBump?"red":"minor"===O.suggestedBump?"orange":"blue",children:O.suggestedBump})]})}),(0,r.jsx)(l.UITimeline,{mode:"left",items:(null!=(t=O.commits)?t:[]).slice(0,v?void 0:5).map(function(e){return{color:"feat"===e.type?"green":"fix"===e.type?"red":"BREAKING"===e.type?"volcano":"gray",children:(0,r.jsxs)("div",{children:[(0,r.jsxs)(l.UISpace,{size:"small",children:[(0,r.jsx)(l.UITag,{color:"feat"===e.type?"green":"fix"===e.type?"red":"BREAKING"===e.type?"volcano":"default",style:{fontSize:10},children:e.type}),(0,r.jsx)(l.UITypographyText,{code:!0,style:{fontSize:10},children:e.shortSha})]}),(0,r.jsx)("div",{style:{marginTop:2},children:(0,r.jsx)(l.UITypographyText,{style:{fontSize:12},children:e.message})})]})}})}),(null!=(n=null==(i=O.commits)?void 0:i.length)?n:0)>5&&(0,r.jsx)(l.UIButton,{variant:"link",size:"small",icon:v?(0,r.jsx)(l.UIIcon,{name:"UpOutlined"}):(0,r.jsx)(l.UIIcon,{name:"DownOutlined"}),onClick:function(){return j(!v)},style:{padding:0},children:v?"Show less":"Show ".concat((null!=(s=null==(d=O.commits)?void 0:d.length)?s:0)-5," more")})]})}]}),(0,r.jsx)(l.UITable,{columns:N,dataSource:L.packages,rowKey:"name",pagination:!1,size:"small",scroll:{x:"max-content"}})]})}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function h(e,t,n,r,a,s,o){try{var l=e[s](o),i=l.value}catch(e){n(e);return}l.done?t(i):Promise.resolve(i).then(r,a)}function y(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var s=e.apply(t,n);function o(e){h(s,r,a,o,l,"next",e)}function l(e){h(s,r,a,o,l,"throw",e)}o(void 0)})}}function f(e,t){return null!=t&&"u">typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var s=[],o=!0,l=!1;try{for(a=a.call(e);!(o=(n=a.next()).done)&&(s.push(n.value),!t||s.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==a.return||a.return()}finally{if(l)throw r}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))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.")}()}function m(e,t){var n,r,a,s={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:i(0)}),l(o,"throw",{value:i(1)}),l(o,"return",{value:i(2)}),"function"==typeof Symbol&&l(o,Symbol.iterator,{value:function(){return this}}),o;function i(l){return function(i){var c=[l,i];if(n)throw TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(s=0)),s;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return s.label++,{value:c[1],done:!1};case 5:s.label++,r=c[1],c=[0];continue;case 7:c=s.ops.pop(),s.trys.pop();continue;default:if(!(a=(a=s.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){s=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){s.label=c[1];break}if(6===c[0]&&s.label<a[1]){s.label=a[1],a=c;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(c);break}a[2]&&s.ops.pop(),s.trys.pop();continue}c=t.call(e,s)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function x(e){var t=e.selectedScope,n=e.onChangelogReady,s=(0,o.useTheme)().antdToken,i=g(a.useState(!0),2),c=i[0],u=i[1],d=g(a.useState(""),2),p=d[0],h=d[1],x=g(a.useState(!1),2),I=x[0],v=x[1],j=g(a.useState(!0),2),b=j[0],U=j[1],S=t?"/v1/plugins/release/changelog?scope=".concat(encodeURIComponent(t)):"",k=(0,o.useData)(S),T=k.data,w=k.isLoading,C=(0,o.useMutateData)("/v1/plugins/release/changelog/generate","POST"),E=C.mutateAsync,P=C.isLoading,A=(0,o.useMutateData)("/v1/plugins/release/changelog/save","POST"),R=A.mutateAsync,O=A.isLoading;a.useEffect(function(){(null==T?void 0:T.markdown)?h(T.markdown):h(""),v(!1)},[T]),a.useEffect(function(){n(!!(p&&!I))},[p,I,n]);var z=function(){return y(function(){var e,n,r,a,s;return m(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,E({scope:t,useLLM:b})];case 1:return h((e=o.sent()).markdown),v(!0),n=[],e.commitsCount&&n.push("".concat(e.commitsCount," commits")),e.tokensUsed&&n.push("".concat(e.tokensUsed," tokens")),r=e.usedLLM?"AI-enhanced":b?"Template":"Simple",a=n.length>0?" (".concat(n.join(", "),")"):"",l.UIMessage.success("".concat(r," changelog generated").concat(a)),[3,3];case 2:return s=o.sent(),l.UIMessage.error("Failed to generate changelog: ".concat(f(s,Error)?s.message:"Unknown error")),[3,3];case 3:return[2]}})})()};return w?(0,r.jsx)(l.UISpin,{size:"large",style:{display:"block",margin:"48px auto"}}):(null==T?void 0:T.markdown)||p?(0,r.jsxs)(l.UICard,{title:(0,r.jsxs)(l.UISpace,{children:[I?(0,r.jsx)(l.UITag,{color:"warning",children:"Unsaved"}):(0,r.jsx)(l.UITag,{color:"success",children:"Saved"}),(0,r.jsx)("span",{children:"Changelog"})]}),extra:(0,r.jsxs)(l.UISpace,{children:[(0,r.jsx)(l.UICheckbox,{checked:b,onChange:function(e){return U(e)},children:"Use AI"}),(0,r.jsx)(l.UIButton,{icon:(0,r.jsx)(l.UIIcon,{name:"ThunderboltOutlined"}),onClick:function(){z()},loading:P,size:"small",children:"Regenerate"}),(0,r.jsx)(l.UIButton,{icon:c?(0,r.jsx)(l.UIIcon,{name:"EyeOutlined"}):(0,r.jsx)(l.UIIcon,{name:"EditOutlined"}),onClick:function(){return u(!c)},size:"small",children:c?"Preview":"Edit"}),(0,r.jsx)(l.UIButton,{variant:"primary",icon:(0,r.jsx)(l.UIIcon,{name:"SaveOutlined"}),onClick:function(){y(function(){var e;return m(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,R({scope:t,markdown:p})];case 1:return n.sent(),v(!1),l.UIMessage.success("Changelog saved"),[3,3];case 2:return e=n.sent(),l.UIMessage.error("Failed to save: ".concat(f(e,Error)?e.message:"Unknown error")),[3,3];case 3:return[2]}})})()},loading:O,disabled:!I,size:"small",children:"Save"})]}),children:[(0,r.jsxs)(l.UIRow,{gutter:16,children:[(0,r.jsx)(l.UICol,{span:c?12:24,children:c?(0,r.jsx)(l.UIInputTextArea,{value:p,onChange:function(e){h(e.target.value),v(!0)},rows:20,style:{fontFamily:"monospace",fontSize:13,height:450},placeholder:"Write your changelog in Markdown..."}):(0,r.jsx)("div",{style:{maxHeight:500,overflow:"auto"},children:(0,r.jsx)(l.UIMarkdownViewer,{content:p})})}),c&&(0,r.jsx)(l.UICol,{span:12,children:(0,r.jsxs)("div",{style:{border:"1px solid ".concat(s.colorBorder),borderRadius:s.borderRadius,height:450,overflow:"auto",padding:12,background:s.colorFillTertiary},children:[(0,r.jsx)(l.UITypographyText,{type:"secondary",style:{fontSize:11,display:"block",marginBottom:8},children:"Preview"}),(0,r.jsx)(l.UIMarkdownViewer,{content:p})]})})]}),I&&(0,r.jsx)("div",{style:{marginTop:16,textAlign:"center"},children:(0,r.jsx)(l.UITypographyText,{type:"warning",style:{fontSize:12},children:"Save changelog to proceed to the next step"})})]}):(0,r.jsx)(l.UICard,{children:(0,r.jsx)(l.UIEmptyState,{description:"No changelog generated yet",image:l.UIEmptyState.PRESENTED_IMAGE_SIMPLE,children:(0,r.jsxs)(l.UISpace,{direction:"vertical",size:"middle",style:{display:"flex",alignItems:"center"},children:[(0,r.jsx)(l.UICheckbox,{checked:b,onChange:function(e){return U(e)},children:"Use AI-powered generation (requires LLM)"}),(0,r.jsx)(l.UIButton,{variant:"primary",icon:(0,r.jsx)(l.UIIcon,{name:"ThunderboltOutlined"}),onClick:function(){z()},loading:P,size:"large",children:"Generate Changelog"}),(0,r.jsx)(l.UITypographyText,{type:"secondary",style:{fontSize:12},children:b?"AI will analyze git commits and generate a detailed changelog":"Generate a simple changelog from package versions"})]})})})}function I(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function v(e,t,n,r,a,s,o){try{var l=e[s](o),i=l.value}catch(e){n(e);return}l.done?t(i):Promise.resolve(i).then(r,a)}function j(e,t){return null!=t&&"u">typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function b(e){if(0===e)return"0 B";var t=Math.floor(Math.log(e)/Math.log(1024));return"".concat(parseFloat((e/Math.pow(1024,t)).toFixed(1))," ").concat(["B","KB","MB","GB"][t])}function U(e){var t,n=e.split(".");return n.length>1&&null!=(t=n[n.length-1])?t:""}function S(e){switch(U(e)){case"js":case"mjs":case"cjs":return"#f5a623";case"ts":case"tsx":return"#3178c6";case"d.ts":return"#235a97";case"json":return"#5a9c5a";case"md":return"#083fa1";case"map":return"#8c8c8c";default:return"#595959"}}function k(e){var t,n,s=e.selectedScope,i=e.onPreviewReady,c=(0,o.useTheme)().antdToken,u=s?"/v1/plugins/release/preview?scope=".concat(encodeURIComponent(s)):"",d=(0,o.useData)(u),p=d.data,h=d.isLoading,y=d.error,f=d.refetch,g=(0,o.useMutateData)("/v1/plugins/release/build","POST"),m=g.mutateAsync,x=g.isLoading,k=null!=(t=null==p?void 0:p.packages.some(function(e){return"ready"!==e.buildStatus}))&&t,T=null!=(n=null==p?void 0:p.allBuilt)&&n;a.useEffect(function(){p&&p.packages.length>0&&T?i(!0):i(!1)},[p,T,i]);var w=function(){var e;return(e=function(){var e,t;return function(e,t){var n,r,a,s={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:i(0)}),l(o,"throw",{value:i(1)}),l(o,"return",{value:i(2)}),"function"==typeof Symbol&&l(o,Symbol.iterator,{value:function(){return this}}),o;function i(l){return function(i){var c=[l,i];if(n)throw TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(s=0)),s;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return s.label++,{value:c[1],done:!1};case 5:s.label++,r=c[1],c=[0];continue;case 7:c=s.ops.pop(),s.trys.pop();continue;default:if(!(a=(a=s.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){s=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){s.label=c[1];break}if(6===c[0]&&s.label<a[1]){s.label=a[1],a=c;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(c);break}a[2]&&s.ops.pop(),s.trys.pop();continue}c=t.call(e,s)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,m({scope:s})];case 1:return(e=n.sent()).success?(l.UIMessage.success("Build completed: ".concat(e.builtCount,"/").concat(e.totalCount," packages")),f()):l.UIMessage.error("Build failed"),[3,3];case 2:return t=n.sent(),l.UIMessage.error("Build failed: ".concat(j(t,Error)?t.message:"Unknown error")),[3,3];case 3:return[2]}})},function(){var t=this,n=arguments;return new Promise(function(r,a){var s=e.apply(t,n);function o(e){v(s,r,a,o,l,"next",e)}function l(e){v(s,r,a,o,l,"throw",e)}o(void 0)})})()};if(h)return(0,r.jsx)(l.UICard,{children:(0,r.jsxs)("div",{style:{textAlign:"center",padding:48},children:[(0,r.jsx)(l.UISpin,{size:"large"}),(0,r.jsx)("div",{style:{marginTop:16},children:(0,r.jsx)(l.UITypographyText,{type:"secondary",children:"Analyzing package contents..."})})]})});if(y)return(0,r.jsx)(l.UICard,{children:(0,r.jsx)(l.UIEmptyState,{description:"Failed to load package preview: ".concat(j(y,Error)?y.message:"Unknown error")})});if(!p||0===p.packages.length)return(0,r.jsx)(l.UICard,{children:(0,r.jsx)(l.UIEmptyState,{description:"No packages found in release plan. Generate a plan first."})});var C=p.totalFiles,E=p.totalSize,P=new Map;p.packages.forEach(function(e){e.files.forEach(function(e){var t=U(e.path)||"other",n=P.get(t)||{count:0,size:0};P.set(t,{count:n.count+1,size:n.size+e.size})})});var A=Array.from(P.entries()).sort(function(e,t){return t[1].size-e[1].size}).slice(0,6),R=[{title:"File",dataIndex:"path",key:"path",render:function(e){return(0,r.jsxs)(l.UISpace,{size:4,children:[(0,r.jsx)(l.UIIcon,{name:"FileOutlined",style:{color:S(e)}}),(0,r.jsx)(l.UITypographyText,{code:!0,style:{fontSize:12},children:e})]})}},{title:"Size",dataIndex:"size",key:"size",width:100,align:"right",render:function(e){return(0,r.jsx)(l.UITypographyText,{type:"secondary",style:{fontSize:12},children:b(e)})}}];return(0,r.jsxs)("div",{children:[(0,r.jsxs)(l.UICard,{style:{marginBottom:16},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,r.jsxs)(l.UISpace,{size:"large",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)(l.UITypographyText,{type:"secondary",style:{display:"block",fontSize:12},children:"Total Files"}),(0,r.jsx)(l.UITitle,{level:3,style:{margin:0},children:C})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(l.UITypographyText,{type:"secondary",style:{display:"block",fontSize:12},children:"Total Size"}),(0,r.jsx)(l.UITitle,{level:3,style:{margin:0},children:b(E)})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(l.UITypographyText,{type:"secondary",style:{display:"block",fontSize:12},children:"Packages"}),(0,r.jsx)(l.UITitle,{level:3,style:{margin:0},children:p.packages.length})]})]}),(0,r.jsx)(l.UISpace,{children:T?(0,r.jsx)(l.UITypographyText,{strong:!0,style:{color:c.colorSuccess},children:"Ready to publish"}):(0,r.jsx)(l.UITypographyText,{strong:!0,style:{color:c.colorWarning},children:"Build required"})})]}),(0,r.jsxs)("div",{style:{marginTop:16},children:[(0,r.jsxs)(l.UISpace,{children:[(0,r.jsx)(l.UIButton,{variant:"primary",icon:(0,r.jsx)(l.UIIcon,{name:"BuildOutlined"}),onClick:function(){w()},loading:x,size:"small",children:x?"Building...":k?"Build":"Rebuild"}),(0,r.jsx)(l.UIButton,{icon:(0,r.jsx)(l.UIIcon,{name:"ReloadOutlined"}),onClick:function(){return f()},disabled:x,size:"small",children:"Refresh"})]}),k&&(0,r.jsx)(l.UIAlert,{variant:"warning",message:"Some packages need to be built before publishing",style:{marginTop:12},showIcon:!0})]}),(0,r.jsxs)("div",{style:{marginTop:24},children:[(0,r.jsx)(l.UITypographyText,{type:"secondary",style:{display:"block",marginBottom:8,fontSize:12},children:"File Types"}),(0,r.jsx)(l.UISpace,{wrap:!0,children:A.map(function(e){var t=function(e){if(Array.isArray(e))return e}(e)||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var a=[],s=!0,o=!1;try{for(r=r.call(e);!(s=(t=r.next()).done)&&(a.push(t.value),2!==a.length);s=!0);}catch(e){o=!0,n=e}finally{try{s||null==r.return||r.return()}finally{if(o)throw n}}return a}}(e)||function(e){if(e){if("string"==typeof e)return I(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 I(e,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),n=t[0],a=t[1];return(0,r.jsxs)(l.UITag,{style:{margin:0},children:[(0,r.jsxs)("span",{style:{color:S(".".concat(n))},children:[".",n]})," ",a.count," (",b(a.size),")"]},n)})})]})]}),p.packages.map(function(e){return(0,r.jsxs)(l.UICard,{title:(0,r.jsxs)(l.UISpace,{children:[(0,r.jsx)(l.UIIcon,{name:"FolderOutlined"}),(0,r.jsx)(l.UITypographyText,{strong:!0,children:e.name}),(0,r.jsxs)(l.UITag,{color:"blue",children:["v",e.version]})]}),extra:(0,r.jsxs)(l.UISpace,{children:["ready"===e.buildStatus?(0,r.jsx)(l.UITag,{color:"success",children:"Built"}):"building"===e.buildStatus?(0,r.jsx)(l.UITag,{color:"processing",children:"Building..."}):(0,r.jsx)(l.UITag,{color:"warning",children:"Not built"}),(0,r.jsxs)(l.UITag,{children:[e.fileCount," files"]}),(0,r.jsx)(l.UITag,{color:"green",children:b(e.totalSize)})]}),style:{marginBottom:16},size:"small",children:[(0,r.jsx)("div",{style:{marginBottom:16},children:(0,r.jsx)(l.UIProgress,{percent:100,success:{percent:e.files.filter(function(e){return e.path.endsWith(".js")||e.path.endsWith(".mjs")}).reduce(function(e,t){return e+t.size},0)/e.totalSize*100},strokeColor:c.colorPrimary,trailColor:c.colorFillTertiary,showInfo:!1,size:"small"})}),(0,r.jsx)(l.UITable,{dataSource:e.files,columns:R,rowKey:"path",size:"small",pagination:e.files.length>10&&{pageSize:10}})]},e.name)})]})}function T(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function w(e,t,n,r,a,s,o){try{var l=e[s](o),i=l.value}catch(e){n(e);return}l.done?t(i):Promise.resolve(i).then(r,a)}function C(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var s=e.apply(t,n);function o(e){w(s,r,a,o,l,"next",e)}function l(e){w(s,r,a,o,l,"throw",e)}o(void 0)})}}function E(e,t){return null!=t&&"u">typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function P(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function A(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function R(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var s=[],o=!0,l=!1;try{for(a=a.call(e);!(o=(n=a.next()).done)&&(s.push(n.value),!t||s.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==a.return||a.return()}finally{if(l)throw r}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return T(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return T(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.")}()}function O(e,t){var n,r,a,s={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:i(0)}),l(o,"throw",{value:i(1)}),l(o,"return",{value:i(2)}),"function"==typeof Symbol&&l(o,Symbol.iterator,{value:function(){return this}}),o;function i(l){return function(i){var c=[l,i];if(n)throw TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(s=0)),s;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return s.label++,{value:c[1],done:!1};case 5:s.label++,r=c[1],c=[0];continue;case 7:c=s.ops.pop(),s.trys.pop();continue;default:if(!(a=(a=s.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){s=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){s.label=c[1];break}if(6===c[0]&&s.label<a[1]){s.label=a[1],a=c;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(c);break}a[2]&&s.ops.pop(),s.trys.pop();continue}c=t.call(e,s)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function z(e){var t,n,s=e.selectedScope,i=e.onReleaseComplete,c=(0,o.useTheme)().antdToken,u=R(a.useState(""),2),d=u[0],p=u[1],h=R(a.useState(""),2),y=h[0],f=h[1],g=R(a.useState([]),2),m=g[0],x=g[1],I=R(a.useState(!1),2),v=I[0],j=I[1],b=R(a.useState(!1),2),U=b[0],S=b[1],k=R(a.useState(!1),2),T=k[0],w=k[1],z=R(a.useState(!1),2),M=z[0],B=z[1],D=R(a.useState(null),2),L=D[0],N=D[1],F=s?"/v1/plugins/release/plan?scope=".concat(encodeURIComponent(s)):"",_=s?"/v1/plugins/release/checks?scope=".concat(encodeURIComponent(s)):"",V=(0,o.useData)(F).data,G=(0,o.useData)(_),$=G.data,W=G.isLoading,H=(0,o.useMutateData)("/v1/plugins/release/checks/run","POST").mutateAsync,K=(0,o.useMutateData)("/v1/plugins/release/run","POST"),q=K.mutateAsync,Y=K.isLoading,J=(0,o.useMutateData)("/v1/plugins/release/plan","DELETE"),Q=J.mutateAsync,X=J.isLoading;a.useEffect(function(){!$||v||U||0!==m.length||x($.checks.map(function(e){return{id:e.id,name:e.name,status:"pending",optional:e.optional}}))},[$,v,U,m.length]);var Z=m.length>0&&m.every(function(e){return"success"===e.status}),ee=m.some(function(e){return"error"===e.status}),et=function(e){switch(e){case"running":return(0,r.jsx)(l.UIIcon,{name:"LoadingOutlined",style:{color:c.colorPrimary}});case"success":return(0,r.jsx)(l.UIIcon,{name:"CheckCircleOutlined",style:{color:c.colorSuccess}});case"error":return(0,r.jsx)(l.UIIcon,{name:"CloseCircleOutlined",style:{color:c.colorError}});default:return(0,r.jsx)(l.UIIcon,{name:"SafetyCertificateOutlined",style:{color:c.colorTextTertiary}})}};return M?(0,r.jsx)(l.UICard,{children:(0,r.jsx)(l.UIResult,{status:"success",title:"Release Published!",subTitle:"".concat(null!=(t=null==V||null==(n=V.plan)?void 0:n.packages.length)?t:0," package(s) published to npm"),extra:[(0,r.jsx)(l.UIPopconfirm,{title:"Rollback Release",description:"This will unpublish the packages. Are you sure?",icon:(0,r.jsx)(l.UIIcon,{name:"ExclamationCircleOutlined",style:{color:"#ff4d4f"}}),onConfirm:function(){C(function(){var e;return O(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,Q({scope:s})];case 1:return t.sent(),l.UIMessage.success("Rollback completed successfully"),B(!1),w(!1),N(null),j(!1),x(function(e){return e.map(function(e){return A(P({},e),{status:"pending",error:void 0,duration:void 0})})}),[3,3];case 2:return e=t.sent(),l.UIMessage.error("Rollback failed: ".concat(E(e,Error)?e.message:"Unknown error")),[3,3];case 3:return[2]}})})()},okText:"Yes, Rollback",okButtonProps:{danger:!0},cancelText:"Cancel",children:(0,r.jsx)(l.UIButton,{icon:(0,r.jsx)(l.UIIcon,{name:"RollbackOutlined"}),loading:X,danger:!0,children:"Rollback"})},"rollback")]})}):(0,r.jsxs)("div",{children:[(0,r.jsx)(l.UICard,{title:(0,r.jsxs)(l.UISpace,{children:[(0,r.jsx)("span",{children:"Pre-release Checks"}),Z&&(0,r.jsx)(l.UIBadge,{variant:"success",children:"All Passed"}),ee&&(0,r.jsx)(l.UIBadge,{variant:"error",children:"Failed"})]}),style:{marginBottom:16},children:(0,r.jsxs)(l.UISpace,{direction:"vertical",style:{width:"100%"},size:"middle",children:[W&&0===m.length&&(0,r.jsx)(l.UISkeleton,{active:!0,lines:4,title:!1}),!W&&0===m.length&&(0,r.jsx)(l.UITypographyText,{type:"secondary",children:"No checks configured in kb.config.json release.checks"}),m.map(function(e){var t;return(0,r.jsx)(l.UICard,{size:"small",status:"success"===(t=e.status)?"success":"error"===t?"error":"default",children:(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,r.jsxs)(l.UISpace,{children:[et(e.status),(0,r.jsxs)("div",{children:[(0,r.jsxs)(l.UISpace,{children:[(0,r.jsx)(l.UITypographyText,{strong:!0,children:e.name}),e.optional&&(0,r.jsx)(l.UITag,{children:"optional"})]}),e.error&&(0,r.jsx)("div",{style:{marginTop:4},children:(0,r.jsx)("pre",{style:{margin:0,padding:"8px 12px",fontSize:11,lineHeight:1.5,color:c.colorError,background:c.colorErrorBg,borderRadius:c.borderRadiusSM,maxHeight:200,overflow:"auto",whiteSpace:"pre-wrap",wordBreak:"break-all"},children:e.error})})]})]}),e.duration&&(0,r.jsxs)(l.UITag,{children:[(e.duration/1e3).toFixed(1),"s"]})]})},e.id)}),(0,r.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,r.jsx)(l.UIButton,{variant:"primary",icon:(0,r.jsx)(l.UIIcon,{name:"BuildOutlined"}),onClick:function(){C(function(){var e,t;return O(this,function(n){switch(n.label){case 0:S(!0),j(!1),x(function(e){return e.map(function(e){return A(P({},e),{status:"running",error:void 0,duration:void 0})})}),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,H({scope:s})];case 2:return e=n.sent(),x(function(t){var n=new Map(e.checks.map(function(e){return[e.id,e]}));return t.map(function(e){var t=n.get(e.id);return t?A(P({},e),{status:t.success?"success":"error",error:t.error,duration:t.durationMs}):A(P({},e),{status:"pending"})})}),j(e.success),e.success||l.UIMessage.error("Some checks failed"),[3,5];case 3:return t=n.sent(),x(function(e){return e.map(function(e){return A(P({},e),{status:"pending"})})}),l.UIMessage.error("Checks failed: ".concat(E(t,Error)?t.message:"Unknown error")),[3,5];case 4:return S(!1),[7];case 5:return[2]}})})()},loading:U,disabled:v,children:U?"Running Checks...":"Run Checks"}),(v||ee)&&(0,r.jsx)(l.UIButton,{onClick:function(){x(function(e){return e.map(function(e){return A(P({},e),{status:"pending",error:void 0,duration:void 0})})}),j(!1)},children:"Reset"})]})]})}),(0,r.jsxs)(l.UICard,{title:"npm Publish",children:[!Z&&(0,r.jsx)(l.UIAlert,{message:"Complete pre-release checks first",description:"All checks must pass before you can publish to npm.",variant:"info",showIcon:!0,style:{marginBottom:16}}),L&&(0,r.jsx)(l.UIAlert,{message:"Release Failed",description:L,variant:"error",showIcon:!0,closable:!0,onClose:function(){return N(null)},style:{marginBottom:16}}),(0,r.jsxs)(l.UISpace,{direction:"vertical",style:{width:"100%"},size:"middle",children:[(null==V?void 0:V.plan)&&(0,r.jsx)(l.UIAccordion,{size:"small",items:[{key:"summary",label:"Release Summary",extra:(0,r.jsxs)(l.UITag,{color:"blue",children:[V.plan.packages.length," package(s)"]}),children:(0,r.jsx)("div",{children:V.plan.packages.map(function(e){return(0,r.jsxs)("div",{style:{marginBottom:4},children:[(0,r.jsx)(l.UITypographyText,{code:!0,children:e.name}),(0,r.jsxs)(l.UITypographyText,{type:"secondary",children:[" ",e.currentVersion," → "]}),(0,r.jsx)(l.UITypographyText,{strong:!0,style:{color:"#52c41a"},children:e.nextVersion})]},e.name)})})}]}),(0,r.jsx)(l.UIDivider,{style:{margin:"8px 0"}}),(0,r.jsxs)("div",{children:[(0,r.jsxs)(l.UITypographyText,{strong:!0,style:{display:"block",marginBottom:8},children:["npm One-Time Password (OTP)"," ",(0,r.jsx)(l.UITypographyText,{type:"secondary",style:{fontWeight:"normal"},children:"— optional"})]}),(0,r.jsx)(l.UITypographyText,{type:"secondary",style:{display:"block",marginBottom:8,fontSize:12},children:"Required only if your npm account uses 2FA. Leave empty to publish via NPM_TOKEN."}),(0,r.jsx)(l.UIInput,{prefix:(0,r.jsx)(l.UIIcon,{name:"LockOutlined"}),placeholder:"123456",value:d,onChange:function(e){p(e.replace(/\D/g,"").slice(0,6)),f("")},maxLength:6,style:{width:200,fontSize:18,letterSpacing:8},status:y?"error":void 0,disabled:!Z||T}),y&&(0,r.jsx)(l.UITypographyText,{type:"danger",style:{display:"block",marginTop:4,fontSize:12},children:y})]}),(0,r.jsx)(l.UIDivider,{style:{margin:"8px 0"}}),(0,r.jsx)(l.UIButton,{variant:"primary",size:"large",icon:(0,r.jsx)(l.UIIcon,{name:"RocketOutlined"}),onClick:function(){C(function(){var e,t,n,r,a;return O(this,function(o){switch(o.label){case 0:if(!(d&&!/^\d{6}$/.test(d)?(f("OTP must be 6 digits"),!1):(f(""),!0)))return[2];w(!0),N(null),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,q({scope:s,dryRun:!1,otp:d})];case 2:return(e=o.sent()).success?(B(!0),l.UIMessage.success("Release published successfully!"),i()):(N(n=(null==(t=e.errors)?void 0:t.join(", "))||"Unknown publish error"),w(!1),l.UIMessage.error("Release failed: ".concat(n))),[3,4];case 3:return N(a=E(r=o.sent(),Error)?r.message:"Unknown error"),w(!1),l.UIMessage.error("Release failed: ".concat(a)),[3,4];case 4:return[2]}})})()},loading:Y,disabled:!Z||T,block:!0,children:"Publish to npm"}),(0,r.jsx)(l.UITypographyText,{type:"secondary",style:{textAlign:"center",display:"block",fontSize:12},children:"This action will publish packages to the npm registry"})]})]})]})}function M(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function B(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var s=[],o=!0,l=!1;try{for(a=a.call(e);!(o=(n=a.next()).done)&&(s.push(n.value),!t||s.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==a.return||a.return()}finally{if(l)throw r}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return M(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return M(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 D=[{key:"plan",title:"Plan"},{key:"changelog",title:"Changelog"},{key:"preview",title:"Preview"},{key:"release",title:"Release"}],L=D.map(function(e){return e.key}),N={plan:0,changelog:1,preview:2,release:3};function F(e){var t,n=e.selectedScope,i=e.selectedScopePath,c=B((0,s.useSearchParams)(),2),u=c[0],p=c[1],h=(0,o.useTheme)().antdToken,y=(0,o.useMutateData)("/v1/plugins/release/plan","DELETE").mutateAsync,f=null!=(t=N[u.get("step")])?t:0,g=function(e){p(function(t){var n,r=new URLSearchParams(t);return r.set("step",null!=(n=L[e])?n:"plan"),r})},m=B(a.useState(!1),2),I=m[0],v=m[1],j=B(a.useState(!1),2),b=j[0],U=j[1],S=B(a.useState(!1),2),T=S[0],w=S[1],C=B(a.useState(!1),2),E=C[0],P=C[1];return n?I?(0,r.jsx)(l.UICard,{children:(0,r.jsx)(l.UIResult,{status:"success",title:"Release Complete!",subTitle:"Your packages have been published successfully.",extra:[(0,r.jsx)(l.UIButton,{variant:"primary",onClick:function(){y({scope:n}),g(0),v(!1),U(!1),w(!1),P(!1)},children:"Start New Release"},"new")]})}):(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:16,paddingBottom:8,borderBottom:"1px solid ".concat(h.colorBorderSecondary)},children:[(0,r.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:13},children:D.map(function(e,t){var n=t===f,s=t<f;return(0,r.jsxs)(a.Fragment,{children:[t>0&&(0,r.jsx)("span",{style:{color:h.colorTextQuaternary},children:"›"}),(0,r.jsx)("span",{onClick:s?function(){return g(t)}:void 0,style:{color:n?h.colorPrimary:s?h.colorText:h.colorTextTertiary,fontWeight:n?600:400,cursor:s?"pointer":"default"},children:e.title})]},e.key)})}),(0,r.jsxs)("div",{style:{display:"flex",gap:4},children:[(0,r.jsx)(l.UIButton,{variant:"text",onClick:function(){f>0&&g(f-1)},disabled:0===f,size:"small",children:"Back"}),f<D.length-1&&(0,r.jsx)(l.UIButton,{variant:"link",onClick:function(){f<D.length-1&&g(f+1)},disabled:!(0===f?b:1===f?T:2===f&&E),size:"small",children:"Next"})]})]}),function(){switch(f){case 0:return(0,r.jsx)(d,{selectedScope:n,selectedScopePath:i,onPlanReady:U});case 1:return(0,r.jsx)(x,{selectedScope:n,onChangelogReady:w});case 2:return(0,r.jsx)(k,{selectedScope:n,onPreviewReady:P});case 3:return(0,r.jsx)(z,{selectedScope:n,onReleaseComplete:function(){return v(!0)}});default:return null}}()]}):(0,r.jsx)(l.UICard,{children:(0,r.jsx)(l.UIResult,{status:"info",title:"Select a scope",subTitle:"Please select a package or monorepo scope to start the release process."})})}function _(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function V(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var s=[],o=!0,l=!1;try{for(a=a.call(e);!(o=(n=a.next()).done)&&(s.push(n.value),!t||s.length!==t);o=!0);}catch(e){l=!0,r=e}finally{try{o||null==a.return||a.return()}finally{if(l)throw r}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return _(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _(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 G=[{title:"Package",dataIndex:"name",key:"name",ellipsis:!0},{title:"Current",dataIndex:"currentVersion",key:"currentVersion",width:180,ellipsis:!0,render:function(e){return e?(0,r.jsx)(l.UITag,{color:"blue",title:e,style:{maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis"},children:e}):"-"}},{title:"Next",dataIndex:"nextVersion",key:"nextVersion",width:180,ellipsis:!0,render:function(e){return e?(0,r.jsx)(l.UITag,{color:"green",title:e,style:{maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis"},children:e}):"-"}},{title:"Bump",dataIndex:"bump",key:"bump",width:90},{title:"Reason",dataIndex:"reason",key:"reason",ellipsis:!0,render:function(e){return(0,r.jsx)(l.UITypographyText,{type:"secondary",style:{fontSize:12},children:e||"-"})}}];function $(e){var t,n,a,s,i=e.releaseId,c=e.releaseScope,u=(0,o.useData)("/v1/plugins/release/history/".concat(encodeURIComponent(c),"/").concat(encodeURIComponent(i),"/report")).data,d=(0,o.useData)("/v1/plugins/release/history/".concat(encodeURIComponent(c),"/").concat(encodeURIComponent(i),"/plan")).data,p=(0,o.useData)("/v1/plugins/release/history/".concat(encodeURIComponent(c),"/").concat(encodeURIComponent(i),"/changelog")).data,h=[{key:"report",label:"Report",children:(null==u?void 0:u.report)?(0,r.jsxs)(l.UIDescriptions,{bordered:!0,column:1,size:"small",children:[(0,r.jsx)(l.UIDescriptionsItem,{label:"Release ID",children:u.id}),(0,r.jsx)(l.UIDescriptionsItem,{label:"Scope",children:u.report.scope}),(0,r.jsx)(l.UIDescriptionsItem,{label:"Stage",children:u.report.stage}),(0,r.jsx)(l.UIDescriptionsItem,{label:"Timestamp",children:new Date(u.report.ts).toLocaleString()}),(0,r.jsx)(l.UIDescriptionsItem,{label:"Status",children:(0,r.jsx)(l.UITag,{color:(null==(t=u.report.result)?void 0:t.ok)?"success":"error",children:(null==(n=u.report.result)?void 0:n.ok)?"Success":"Failed"})}),(null==(a=u.report.result)?void 0:a.timingMs)&&(0,r.jsxs)(l.UIDescriptionsItem,{label:"Duration",children:[u.report.result.timingMs,"ms"]}),(null==(s=u.report.result)?void 0:s.published)&&(0,r.jsx)(l.UIDescriptionsItem,{label:"Packages Published",children:u.report.result.published.length})]}):(0,r.jsx)(l.UISpin,{})},{key:"plan",label:"Plan",children:(null==d?void 0:d.plan)?(0,r.jsxs)("div",{children:[(0,r.jsxs)(l.UIDescriptions,{bordered:!0,column:2,size:"small",style:{marginBottom:16},children:[(0,r.jsx)(l.UIDescriptionsItem,{label:"Scope",children:d.plan.scope}),(0,r.jsx)(l.UIDescriptionsItem,{label:"Strategy",children:d.plan.strategy}),(0,r.jsx)(l.UIDescriptionsItem,{label:"Packages",children:d.plan.packages.length}),(0,r.jsx)(l.UIDescriptionsItem,{label:"Rollback",children:d.plan.rollbackEnabled?"Enabled":"Disabled"})]}),(0,r.jsx)(l.UITable,{columns:G,dataSource:d.plan.packages,rowKey:"name",size:"small",pagination:d.plan.packages.length>10&&{pageSize:10},scroll:{x:"max-content"}})]}):(0,r.jsx)(l.UISpin,{})},{key:"changelog",label:"Changelog",children:void 0===p?(0,r.jsx)(l.UISpin,{}):p.markdown?(0,r.jsx)(l.UIMarkdownViewer,{content:p.markdown}):(0,r.jsx)(l.UIEmptyState,{description:"No changelog for this release",image:l.UIEmptyState.PRESENTED_IMAGE_SIMPLE})}];return(0,r.jsx)(l.UITabs,{items:h})}function W(e){var t,n=e.selectedScope,s=(0,o.useTheme)().antdToken,i=V((0,a.useState)(null),2),c=i[0],u=i[1],d=V((0,a.useState)(""),2),p=d[0],h=d[1],y=V((0,a.useState)(!1),2),f=y[0],g=y[1],m=(0,o.useData)("/v1/plugins/release/history"),x=m.data,I=m.isLoading,v=m.error,j=function(e,t){u(e),h(t),g(!0)};if(I)return(0,r.jsx)(l.UISpin,{size:"large",style:{display:"block",margin:"48px auto"}});if(v)return(0,r.jsx)(l.UICard,{children:(0,r.jsx)(l.UIEmptyState,{description:"Failed to load history: ".concat((null!=(t=Error)&&"u">typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](v):v instanceof t)?v.message:"Unknown error"),image:l.UIEmptyState.PRESENTED_IMAGE_SIMPLE})});var b=(null==x?void 0:x.releases)?n?x.releases.filter(function(e){return e.scope===n}):x.releases:[];if(0===b.length)return(0,r.jsx)(l.UICard,{children:(0,r.jsx)(l.UIEmptyState,{description:n?'No release history for scope "'.concat(n,'" yet'):"No release history yet",image:l.UIEmptyState.PRESENTED_IMAGE_SIMPLE})});var U=b.map(function(e){return{dot:e.success?(0,r.jsx)(l.UIIcon,{name:"CheckCircleOutlined",style:{color:s.colorSuccess}}):(0,r.jsx)(l.UIIcon,{name:"CloseCircleOutlined",style:{color:s.colorError}}),children:(0,r.jsx)(l.UICard,{size:"small",style:{marginBottom:16},children:(0,r.jsxs)(l.UISpace,{direction:"vertical",style:{width:"100%"},children:[(0,r.jsxs)(l.UISpace,{children:[(0,r.jsx)(l.UITag,{color:"blue",children:e.scope}),(0,r.jsx)(l.UITag,{color:e.success?"success":"error",children:e.success?"Success":"Failed"}),(0,r.jsx)(l.UITypographyText,{type:"secondary",children:new Date(e.timestamp).toLocaleString()})]}),(0,r.jsxs)(l.UITypographyText,{children:["Released ",e.packages.length," package(s)"]}),(0,r.jsx)(l.UIButton,{icon:(0,r.jsx)(l.UIIcon,{name:"EyeOutlined"}),onClick:function(){return j(e.id,e.scope)},size:"small",children:"View Details"})]})})}});return(0,r.jsxs)(l.UICard,{title:(0,r.jsx)(l.UITitle,{level:4,style:{margin:0},children:"Release History"}),children:[(0,r.jsx)(l.UITimeline,{items:U}),(0,r.jsx)(l.UIModal,{title:"Release Details - ".concat(c),open:f,onCancel:function(){g(!1),u(null),h("")},footer:null,width:800,children:c&&p&&(0,r.jsx)($,{releaseId:c,releaseScope:p})})]})}function H(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function K(e){if(!e)return"Never";var t=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(t<1)return"Just now";if(t<60)return"".concat(t,"m ago");var n=Math.floor(t/60);if(n<24)return"".concat(n,"h ago");var r=Math.floor(n/24);return"".concat(r,"d ago")}function q(e){var t,n,a,s=e.scope,i=e.selectedScope,c=e.onStartRelease,u=e.onViewHistory,d=i?"/v1/plugins/release/status?scope=".concat(encodeURIComponent(i)):"",p=i?"/v1/plugins/release/git-timeline?scope=".concat(encodeURIComponent(i)):"",h=i?"/v1/plugins/release/history?scope=".concat(encodeURIComponent(i)):"",y=(0,o.useData)(d),f=y.data,g=y.isLoading,m=(0,o.useData)(p),x=m.data,I=m.isLoading,v=(0,o.useData)(h),j=v.data,b=v.isLoading;if(!i)return(0,r.jsx)(l.UICard,{children:(0,r.jsx)(l.UIEmptyState,{description:"Select a scope to see its release status",image:l.UIEmptyState.PRESENTED_IMAGE_SIMPLE})});if(g||I||b)return(0,r.jsx)(l.UISpin,{size:"large",style:{display:"block",margin:"48px auto"}});var U=null!=(t=null==j?void 0:j.releases)?t:[],S=U[0],k=!!(null==f?void 0:f.hasPlan)&&"ready"===f.planStatus,T=function(e){var t=new Map,n=!0,r=!1,a=void 0;try{for(var s,o=e[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){var l,i=s.value,c=null!=(l=i.channel)?l:"unspecified",u=t.get(c);(!u||new Date(i.timestamp)>new Date(u.timestamp))&&t.set(c,i)}}catch(e){r=!0,a=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw a}}return Array.from(t.entries())}(U),w=(null==x?void 0:x.suggestedBump)&&"none"!==x.suggestedBump?x.suggestedBump:void 0;return(0,r.jsxs)("div",{children:[k&&(0,r.jsx)(l.UIAlert,{variant:"info",message:"Release in progress for this scope",description:"A plan has already been generated but not yet published.",action:(0,r.jsx)(l.UIButton,{size:"small",onClick:c,children:"Continue"}),showIcon:!0,style:{marginBottom:16}}),(0,r.jsxs)(l.UIRow,{gutter:16,style:{marginBottom:16},children:[(0,r.jsx)(l.UICol,{span:6,children:(0,r.jsx)(l.UIMetricCard,{label:"Current Version",value:null!=(n=null==s?void 0:s.currentVersion)?n:"—"})}),(0,r.jsx)(l.UICol,{span:6,children:(0,r.jsx)(l.UIMetricCard,{label:"Unreleased Changes",value:null!=(a=null==x?void 0:x.unreleased)?a:0,status:(null==x?void 0:x.hasUnreleasedChanges)?"warning":"success"})}),(0,r.jsx)(l.UICol,{span:6,children:(0,r.jsx)(l.UIMetricCard,{label:"Last Release",value:K(null==S?void 0:S.timestamp),status:S?S.success?"success":"error":"default"})}),(0,r.jsx)(l.UICol,{span:6,children:(0,r.jsx)(l.UIMetricCard,{label:"Suggested Bump",value:null!=w?w:"—",status:"info"})})]}),(0,r.jsx)(l.UITypographyText,{type:"secondary",style:{display:"block",marginBottom:8,fontSize:12},children:"Channels"}),0===T.length?(0,r.jsx)(l.UICard,{size:"small",style:{marginBottom:16},children:(0,r.jsx)(l.UIEmptyState,{description:"No releases yet for this scope",image:l.UIEmptyState.PRESENTED_IMAGE_SIMPLE})}):(0,r.jsx)(l.UIRow,{gutter:16,style:{marginBottom:16},children:T.map(function(e){var t,n=function(e){if(Array.isArray(e))return e}(e)||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var a=[],s=!0,o=!1;try{for(r=r.call(e);!(s=(t=r.next()).done)&&(a.push(t.value),2!==a.length);s=!0);}catch(e){o=!0,n=e}finally{try{s||null==r.return||r.return()}finally{if(o)throw n}}return a}}(e)||function(e){if(e){if("string"==typeof e)return H(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 H(e,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),a=n[0],s=n[1];return(0,r.jsx)(l.UICol,{span:8,children:(0,r.jsxs)(l.UICard,{size:"small",status:s.success?"success":"error",children:[(0,r.jsx)(l.UITag,{children:a}),(0,r.jsx)("div",{style:{marginTop:8},children:(0,r.jsx)(l.UITypographyText,{strong:!0,children:null!=(t=s.version)?t:"—"})}),(0,r.jsxs)("div",{style:{marginTop:4},children:[(0,r.jsx)(l.UIBadge,{variant:s.success?"success":"error",children:s.success?"Success":"Failed"}),(0,r.jsx)(l.UITypographyText,{type:"secondary",style:{fontSize:12,marginLeft:8},children:K(s.timestamp)})]})]})},a)})}),(0,r.jsxs)(l.UISpace,{children:[(0,r.jsx)(l.UIButton,{variant:"primary",onClick:c,children:"Start New Release"}),(0,r.jsx)(l.UIButton,{onClick:u,children:"View History"})]})]})}function Y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var J="overview";let Q=function(){var e,t,n,i,c,u,d=function(e){if(Array.isArray(e))return e}(e=(0,s.useSearchParams)())||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var a=[],s=!0,o=!1;try{for(r=r.call(e);!(s=(t=r.next()).done)&&(a.push(t.value),2!==a.length);s=!0);}catch(e){o=!0,n=e}finally{try{s||null==r.return||r.return()}finally{if(o)throw n}}return a}}(e)||function(e){if(e){if("string"==typeof e)return Y(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 Y(e,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),p=d[0],h=d[1],y=null!=(t=p.get("scope"))?t:"",f=null!=(n=p.get("tab"))?n:J,g=function(e){h(function(t){var n=new URLSearchParams(t);return n.set("scope",e),n.delete("step"),n})},m=function(e){h(function(t){var n=new URLSearchParams(t);return e===J?n.delete("tab"):n.set("tab",e),n})},x=(0,o.useData)("/v1/plugins/release/scopes"),I=x.data,v=x.isLoading;a.useEffect(function(){if((null==I?void 0:I.scopes)&&I.scopes.length>0&&!y){var e,t,n=I.scopes.find(function(e){return"root"===e.id}),r=I.scopes[0];g(null!=(e=null!=(t=null==n?void 0:n.id)?t:null==r?void 0:r.id)?e:"")}},[I]);var j=null==I||null==(c=I.scopes)?void 0:c.find(function(e){return e.id===y}),b=function(e){switch(e){case"monorepo":return"blue";case"package":return"green";case"root":return"purple";default:return"default"}},U=(0,r.jsx)(l.UITabs,{activeKey:f,onChange:m,items:[{key:"overview",label:"Overview",children:(0,r.jsx)(q,{scope:j,selectedScope:y,onStartRelease:function(){h(function(e){var t=new URLSearchParams(e);return t.set("tab","flow"),t.delete("step"),t})},onViewHistory:function(){return m("history")}})},{key:"flow",label:"Release Flow",children:(0,r.jsxs)(r.Fragment,{children:[j&&(0,r.jsx)(l.UIAccordion,{size:"small",style:{marginBottom:16},items:[{key:"scope-info",label:j.currentVersion?"".concat(j.name," v").concat(j.currentVersion):j.name,extra:(0,r.jsx)(l.UITag,{color:b(j.type),children:j.type}),children:(0,r.jsxs)(l.UIDescriptions,{size:"small",column:1,bordered:!0,children:[(0,r.jsx)(l.UIDescriptionsItem,{label:"Package Name",children:j.id}),j.currentVersion&&(0,r.jsx)(l.UIDescriptionsItem,{label:"Current Version",children:j.currentVersion}),j.description&&(0,r.jsx)(l.UIDescriptionsItem,{label:"Description",children:j.description}),(0,r.jsx)(l.UIDescriptionsItem,{label:"Path",children:(0,r.jsx)("code",{style:{fontSize:12},children:j.path})}),(0,r.jsx)(l.UIDescriptionsItem,{label:"Type",children:(0,r.jsx)(l.UITag,{color:b(j.type),children:j.type})})]})}]}),(0,r.jsx)(F,{selectedScope:y,selectedScopePath:null==j?void 0:j.path})]})},{key:"history",label:"History",children:(0,r.jsx)(W,{selectedScope:y})}]});return(0,r.jsx)(l.UIPage,{children:(0,r.jsx)(l.UIPageHeader,{title:"Release Manager",description:"Plan, execute, and audit releases across your workspace",actions:(0,r.jsx)(l.UISelect,{style:{width:400},placeholder:"Select scope (package or monorepo)",value:y||void 0,onChange:function(e){return g(e)},loading:v,showSearch:!0,optionFilterProp:"label",options:null!=(i=null==I||null==(u=I.scopes)?void 0:u.map(function(e){return{label:"".concat(e.name," (").concat(e.type,")"),value:e.id}}))?i:[]}),tabs:U})})}}}]);
@@ -114,8 +114,8 @@
114
114
  "sync": [
115
115
  "117.js",
116
116
  "326.js",
117
- "62.js",
118
- "648.js"
117
+ "648.js",
118
+ "832.js"
119
119
  ],
120
120
  "async": []
121
121
  },
@@ -122,8 +122,8 @@
122
122
  "sync": [
123
123
  "117.js",
124
124
  "326.js",
125
- "62.js",
126
- "648.js"
125
+ "648.js",
126
+ "832.js"
127
127
  ],
128
128
  "async": []
129
129
  },