| 1 |
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{C as t,T as n,a as r,k as i,w as a}from"./client-DSw2TdH4.js";import{t as o}from"./useMutation-DLyYCmQ0.js";import{n as s}from"./info-3cB5_JmI.js";import{t as c}from"./circle-check-CjN7Vmv0.js";import{t as l}from"./circle-minus-CpiTIx_j.js";import{t as u}from"./loader-circle-Ck-s1kyS.js";import{t as d}from"./stethoscope-BNkaxpyE.js";import{t as f}from"./x-DIT5l0_1.js";var p=t(`minimize`,[[`path`,{d:`M8 3v3a2 2 0 0 1-2 2H3`,key:`hohbtr`}],[`path`,{d:`M21 8h-3a2 2 0 0 1-2-2V3`,key:`5jw1f3`}],[`path`,{d:`M3 16h3a2 2 0 0 1 2 2v3`,key:`198tvr`}],[`path`,{d:`M16 21v-3a2 2 0 0 1 2-2h3`,key:`ph8mxp`}]]),m=e(i(),1),h=a();function g({status:e}){return e===`ok`?(0,h.jsx)(c,{className:`w-5 h-5 text-bambu-green flex-shrink-0`}):e===`failed`?(0,h.jsx)(s,{className:`w-5 h-5 text-red-600 dark:text-red-400 flex-shrink-0`}):(0,h.jsx)(l,{className:`w-5 h-5 text-bambu-gray flex-shrink-0`})}function _({printerId:e,printerName:t,onClose:i}){let{t:a}=n(),s=o({mutationFn:()=>r.diagnoseCamera(e)});(0,m.useEffect)(()=>{s.mutate()},[]),(0,m.useEffect)(()=>{let e=e=>{e.key===`Escape`&&i()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[i]);let c=s.data;return(0,h.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,onClick:i,children:(0,h.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary w-full max-w-lg flex flex-col`,onClick:e=>e.stopPropagation(),children:[(0,h.jsxs)(`div`,{className:`flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,h.jsx)(d,{className:`w-5 h-5 text-bambu-green flex-shrink-0`}),(0,h.jsx)(`h2`,{className:`text-lg font-semibold text-white truncate`,children:a(`camera.diagnose.modalTitle`,{name:t||``})})]}),(0,h.jsx)(`button`,{onClick:i,className:`text-bambu-gray hover:text-white transition-colors`,title:a(`common.close`),children:(0,h.jsx)(f,{className:`w-5 h-5`})})]}),(0,h.jsxs)(`div`,{className:`p-6 space-y-4`,children:[s.isPending&&(0,h.jsxs)(`div`,{className:`flex items-center gap-2 text-bambu-gray`,children:[(0,h.jsx)(u,{className:`w-4 h-4 animate-spin`}),(0,h.jsx)(`span`,{children:a(`camera.diagnose.running`)})]}),s.isError&&(0,h.jsx)(`div`,{className:`rounded-lg bg-red-50 dark:bg-red-500/10 border border-red-300 dark:border-red-500/30 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:a(`camera.diagnose.runFailed`,{error:s.error.message})}),c&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`ol`,{className:`space-y-2`,children:c.stages.map(e=>(0,h.jsxs)(`li`,{className:`flex items-center gap-3 bg-bambu-dark rounded-lg px-4 py-2.5`,children:[(0,h.jsx)(g,{status:e.status}),(0,h.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,h.jsx)(`div`,{className:`text-sm text-white`,children:a(`camera.diagnose.stage.${e.name}`)}),e.code&&(0,h.jsx)(`div`,{className:`text-xs text-bambu-gray font-mono`,children:e.code})]}),(0,h.jsxs)(`div`,{className:`text-xs text-bambu-gray tabular-nums flex-shrink-0`,children:[e.duration_ms,` ms`]})]},e.name))}),(0,h.jsx)(`div`,{className:c.overall_status===`ok`?`rounded-lg bg-bambu-green/10 border border-bambu-green/30 px-4 py-3 text-sm text-bambu-green`:`rounded-lg bg-red-50 dark:bg-red-500/10 border border-red-300 dark:border-red-500/30 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:a(`camera.diagnose.summary.${c.summary_code}`,{defaultValue:a(`camera.diagnose.summary.unknown_failure`)})}),(0,h.jsx)(`div`,{className:`text-xs text-bambu-gray space-y-0.5`,children:(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(`span`,{className:`text-bambu-gray/60`,children:[a(`camera.diagnose.meta.protocol`),`: `]}),(0,h.jsx)(`span`,{className:`font-mono`,children:c.protocol}),` • `,(0,h.jsxs)(`span`,{className:`text-bambu-gray/60`,children:[a(`camera.diagnose.meta.port`),`: `]}),(0,h.jsx)(`span`,{className:`font-mono`,children:c.port}),` • `,(0,h.jsxs)(`span`,{className:`text-bambu-gray/60`,children:[a(`camera.diagnose.meta.profile`),`: `]}),(0,h.jsx)(`span`,{className:`font-mono`,children:c.profile})]})})]})]}),(0,h.jsxs)(`div`,{className:`px-6 py-4 border-t border-bambu-dark-tertiary flex justify-end gap-2`,children:[(0,h.jsx)(`button`,{onClick:()=>s.mutate(),disabled:s.isPending,className:`px-4 py-2 bg-bambu-dark hover:bg-bambu-dark-tertiary disabled:opacity-50 text-white text-sm rounded-lg transition-colors`,children:a(`camera.diagnose.retry`)}),(0,h.jsx)(`button`,{onClick:i,className:`px-4 py-2 bg-bambu-green hover:bg-bambu-green/90 text-white text-sm rounded-lg transition-colors`,children:a(`common.close`)})]})]})})}export{p as n,_ as t};
|