import"./rolldown-runtime-DIIn1E2Q.js";import{R as e,W as t,l as n,s as r}from"./vendor-primevue-_eYbXsHY.js";import{A as i,Bt as a,D as o,F as s,I as c,O as l,R as u,Rt as d,S as f,Ut as p,_t as m,c as h,et as g,j as _,k as v,nt as y}from"./vendor-vue-core-DO0afONr.js";import"./vendor-other-D7fTIduy.js";import{n as b,t as x}from"./types-DPJvCrdo.js";import"./api-BebQfoGK.js";import"./vendor-markdown-Da9QPS2x.js";import"./colorUtil-xHrUTSza.js";import"./i18n-dAUEhQVe.js";import"./vendor-reka-ui-D1HCh14_.js";import{t as S}from"./src-D_KFn0Xz.js";import{t as C}from"./Button-hTbieW3T.js";import{a as w,u as T}from"./formatUtil-Gr6H7233.js";import{n as E,r as D,t as O}from"./extensionStore-P-YqST__.js";import{t as k}from"./envUtil-BPtcYFTX.js";import{t as A}from"./useExternalLink-DY6FqhTr.js";var j={class:`grid grid-cols-2 gap-2`},M={class:`font-medium`},N=u({__name:`DeviceInfo`,props:{device:{}},setup(e){let t=e,n=[{field:`name`,header:`Name`},{field:`type`,header:`Type`},{field:`vram_total`,header:`VRAM Total`},{field:`vram_free`,header:`VRAM Free`},{field:`torch_vram_total`,header:`Torch VRAM Total`},{field:`torch_vram_free`,header:`Torch VRAM Free`}],formatValue=(e,t)=>{if([`vram_total`,`vram_free`,`torch_vram_total`,`torch_vram_free`].includes(t)){let t=Number(e);return Number.isFinite(t)?T(t):e}return e};return(e,r)=>(g(),_(`div`,j,[(g(),_(f,null,y(n,e=>(g(),_(f,{key:e.field},[l(`div`,M,p(e.header),1),l(`div`,null,p(formatValue(t.device[e.field],e.field)),1)],64))),64))]))}}),P={class:`system-stats`},F={class:`mb-6`},I={class:`mb-4 flex items-center gap-2`},L={class:`text-2xl font-semibold`},R={class:`grid grid-cols-2 gap-2`},z={class:`mb-4 text-2xl font-semibold`},B=u({__name:`SystemStatsPanel`,props:{stats:{}},setup(e){let u=e,{copyToClipboard:h}=E(),b=o(()=>({...u.stats.system,argv:u.stats.system.argv.join(` `)})),D=o(()=>u.stats.devices.length>0),O=[{field:`os`,header:`OS`},{field:`python_version`,header:`Python Version`},{field:`embedded_python`,header:`Embedded Python`},{field:`pytorch_version`,header:`Pytorch Version`},{field:`argv`,header:`Arguments`},{field:`ram_total`,header:`RAM Total`,formatNumber:T},{field:`ram_free`,header:`RAM Free`,formatNumber:T},{field:`installed_templates_version`,header:`Templates Version`}],k=[{field:`cloud_version`,header:`Cloud Version`},{field:`comfyui_version`,header:`ComfyUI Version`,format:w},{field:`comfyui_frontend_version`,header:`Frontend Version`,getValue:()=>`736f0fa4161571d621490e97aefac0103196ffb2`,format:w},{field:`workflow_templates_version`,header:`Templates Version`}],A=o(()=>x?k:O);function isOutdated(e){if(e.field!==`installed_templates_version`)return!1;let t=u.stats.system.installed_templates_version,n=u.stats.system.required_templates_version;return!!t&&!!n&&t!==n}function getDisplayValue(e){let t=e.getValue?e.getValue():b.value[e.field];return e.formatNumber&&typeof t==`number`?e.formatNumber(t):e.format&&typeof t==`string`?e.format(t):t}function formatSystemInfoText(){let e=[`## System Info`];for(let t of A.value){let n=getDisplayValue(t);n!==void 0&&n!==``&&e.push(`${t.header}: ${n}`)}if(D.value){e.push(``),e.push(`## Devices`);for(let t of u.stats.devices)e.push(`- ${t.name} (${t.type})`),e.push(`  VRAM Total: ${T(t.vram_total)}`),e.push(`  VRAM Free: ${T(t.vram_free)}`),e.push(`  Torch VRAM Total: ${T(t.torch_vram_total)}`),e.push(`  Torch VRAM Free: ${T(t.torch_vram_free)}`)}return e.join(`
`)}function copySystemInfo(){h(formatSystemInfoText())}return(e,o)=>(g(),_(`div`,P,[l(`div`,F,[l(`div`,I,[l(`h2`,L,p(e.$t(`g.systemInfo`)),1),c(C,{variant:`secondary`,onClick:copySystemInfo},{default:m(()=>[o[0]||=l(`i`,{class:`pi pi-copy`},null,-1),s(` `+p(e.$t(`g.copySystemInfo`)),1)]),_:1})]),l(`div`,R,[(g(!0),_(f,null,y(A.value,e=>(g(),_(f,{key:e.field},[l(`div`,{class:a(d(S)(`font-medium`,isOutdated(e)&&`text-danger-100`))},p(e.header),3),l(`div`,{class:a(d(S)(isOutdated(e)&&`text-danger-100`))},p(getDisplayValue(e)),3)],64))),128))])]),D.value?(g(),_(f,{key:0},[c(d(t)),l(`div`,null,[l(`h2`,z,p(e.$t(`g.devices`)),1),u.stats.devices.length>1?(g(),v(d(r),{key:0},{default:m(()=>[(g(!0),_(f,null,y(u.stats.devices,e=>(g(),v(d(n),{key:e.index,header:e.name,value:e.index},{default:m(()=>[c(N,{device:e},null,8,[`device`])]),_:2},1032,[`header`,`value`]))),128))]),_:1})):(g(),v(N,{key:1,device:u.stats.devices[0]},null,8,[`device`]))])],64)):i(``,!0)]))}}),V=h(`aboutPanel`,()=>{let e=O(),t=D(),{staticUrls:n}=A(),r=o(()=>t?.systemStats?.system?.comfyui_version??``),i=o(()=>t?.systemStats?.system?.installed_templates_version??``),a=o(()=>t?.systemStats?.system?.required_templates_version??``),s=o(()=>i.value!==``&&a.value!==``&&i.value!==a.value),c=o(()=>[{label:`ComfyUI ${b?`v`+k().getComfyUIVersion():w(r.value)}`,url:x?n.comfyOrg:n.github,icon:x?`pi pi-cloud`:`pi pi-github`},{label:`ComfyUI_frontend v1.42.6`,url:n.githubFrontend,icon:`pi pi-github`},...i.value?[{label:`Templates v${i.value}`,url:`https://pypi.org/project/comfyui-workflow-templates/`,icon:`pi pi-book`,...s.value?{severity:`danger`}:{}}]:[],{label:`Discord`,url:n.discord,icon:`pi pi-discord`},{label:`ComfyOrg`,url:n.comfyOrg,icon:`pi pi-globe`}]);return{badges:o(()=>[...c.value,...e.extensions.flatMap(e=>e.aboutPageBadges??[])])}}),H={class:`about-container flex flex-col gap-2`,"data-testid":`about-panel`},U={class:`mb-2 text-2xl font-bold`},W={class:`space-y-2`},G=[`href`,`title`],K=u({__name:`AboutPanel`,setup(n){let r=D(),o=V();return(n,u)=>(g(),_(`div`,H,[l(`h2`,U,p(n.$t(`g.about`)),1),l(`div`,W,[(g(!0),_(f,null,y(d(o).badges,t=>(g(),_(`a`,{key:t.url,href:t.url,target:`_blank`,rel:`noopener noreferrer`,class:`about-badge inline-flex items-center no-underline`,title:t.url},[c(d(e),{class:`mr-2`,severity:t.severity},{icon:m(()=>[l(`i`,{class:a([t.icon,`mr-2 text-xl`])},null,2)]),default:m(()=>[s(` `+p(t.label),1)]),_:2},1032,[`severity`])],8,G))),128))]),c(d(t)),d(r).systemStats?(g(),v(B,{key:0,stats:d(r).systemStats},null,8,[`stats`])):i(``,!0)]))}});export{K as default};
//# sourceMappingURL=AboutPanel-Bqj7jyaN.js.map