diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8772c50f1..9c396e62f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -42,6 +42,7 @@ All notable changes to Bambuddy will be documented in this file.
- **H2D Pro Prints Fail at ~75% With Extrusion Motor Overload** ([#245](https://github.com/maziggy/bambuddy/issues/245)) — H2D Pro firmware interprets `use_ams: 1` (integer) as a nozzle index, routing filament to the deputy nozzle instead of the main nozzle. Bambu Studio sends `use_ams: true` (boolean) while using integers for other fields. Fixed by keeping `use_ams` as boolean for all printers including H2D series.
- **GitHub Backup Description Misleading** — The "App Settings" backup card said "excludes sensitive data" but the complete database is pushed. Updated description to "complete database."
- **Support Bundle Shows 0 AMS Units** — The support info always reported `ams_unit_count: 0` because it expected `raw_data["ams"]` to be a nested dict (`{"ams": [...]}`) but the MQTT handler stores it as a flat list. Now handles both formats.
+- **Firmware Badge Shown for Models Without API Data** ([#311](https://github.com/maziggy/bambuddy/issues/311)) — Printers whose model has no firmware data in Bambu Lab's API (e.g. H2C on public beta firmware) showed a misleading green "up to date" badge. The badge is now hidden when the API returns no `latest_version`, since there is nothing to compare against.
### Documentation
- **Supported Printers Updated** — Updated README, website, and wiki to list all 12 supported Bambu Lab printer models: X1, X1C, X1E, P1P, P1S, P2S, A1, A1 Mini, H2D, H2D Pro, H2C, H2S. Removed outdated "Testers Needed" messaging and Tested/Needs Testing distinctions — all models are now uniformly listed as supported. Added H2C printer image to website. Added H2D Pro, H2C columns to wiki feature comparison tables and new P2 Series section.
diff --git a/frontend/src/__tests__/pages/PrintersPage.test.tsx b/frontend/src/__tests__/pages/PrintersPage.test.tsx
index 966ca9834..32020f280 100644
--- a/frontend/src/__tests__/pages/PrintersPage.test.tsx
+++ b/frontend/src/__tests__/pages/PrintersPage.test.tsx
@@ -274,5 +274,38 @@ describe('PrintersPage', () => {
expect(screen.queryByText('01.09.00.00')).not.toBeInTheDocument();
expect(screen.queryByText('01.08.00.00')).not.toBeInTheDocument();
});
+
+ it('hides badge when API has no firmware data for the model', async () => {
+ const firmwareNoData = {
+ printer_id: 1,
+ current_version: '01.01.03.00',
+ latest_version: null,
+ update_available: false,
+ download_url: null,
+ release_notes: null,
+ };
+
+ server.use(
+ http.get('/api/v1/firmware/updates/:id', () => {
+ return HttpResponse.json(firmwareNoData);
+ }),
+ http.get('/api/v1/settings/', () => {
+ return HttpResponse.json({
+ check_printer_firmware: true,
+ auto_archive: true,
+ save_thumbnails: true,
+ });
+ })
+ );
+
+ render( );
+
+ await waitFor(() => {
+ expect(screen.getByText('X1 Carbon')).toBeInTheDocument();
+ });
+
+ // Badge should not appear when API returns no latest_version
+ expect(screen.queryByText('01.01.03.00')).not.toBeInTheDocument();
+ });
});
});
diff --git a/frontend/src/pages/PrintersPage.tsx b/frontend/src/pages/PrintersPage.tsx
index ebc5c603d..e39f48321 100644
--- a/frontend/src/pages/PrintersPage.tsx
+++ b/frontend/src/pages/PrintersPage.tsx
@@ -1992,7 +1992,7 @@ function PrinterCard({
)}
{/* Firmware Version Badge */}
- {firmwareInfo?.current_version && (
+ {firmwareInfo?.current_version && firmwareInfo?.latest_version && (
setShowFirmwareModal(true)}
className={`flex items-center gap-1 px-2 py-1 rounded-full text-xs hover:opacity-80 transition-opacity ${
diff --git a/static/assets/index-DKpTCC1_.js b/static/assets/index-CbyBA630.js
similarity index 99%
rename from static/assets/index-DKpTCC1_.js
rename to static/assets/index-CbyBA630.js
index bf381fdb7..1cb4efa6d 100644
--- a/static/assets/index-DKpTCC1_.js
+++ b/static/assets/index-CbyBA630.js
@@ -8491,7 +8491,7 @@ void main() {
border-l-[6px] border-l-transparent
border-r-[6px] border-r-transparent
${o==="top"?"top-full border-t-[6px] border-t-bambu-dark-tertiary":"bottom-full border-b-[6px] border-b-bambu-dark-tertiary"}
- `})]})]})}function x8e({slots:t}){const{t:e}=hn(),n=t.filter(r=>r.nozzle_diameter||r.nozzle_type);return a.jsxs("div",{className:"text-center px-2.5 py-1.5 bg-bambu-dark rounded-lg flex-[2] flex flex-col justify-center",children:[a.jsx("p",{className:"text-[9px] text-bambu-gray mb-1",children:e("printers.nozzleRack")}),a.jsx("div",{className:"flex gap-[3px] justify-center",children:n.map((r,i)=>{const s=r.stat===1,o=Pee(r.filament_color);return a.jsx(b8e,{slot:r,index:i,children:a.jsx("div",{className:`w-7 h-7 rounded flex items-center justify-center cursor-default transition-colors border-b-2 ${s?"bg-green-950/35 border-green-400":"bg-bambu-dark-tertiary/40 border-bambu-dark-tertiary/40"}`,style:o?{backgroundColor:o}:void 0,children:a.jsx("span",{className:`text-[10px] font-semibold ${s?"text-green-400":"text-white"}`,style:o?{textShadow:"0 1px 3px rgba(0,0,0,0.9)"}:void 0,children:r.nozzle_diameter||"?"})})},r.id??i)})})]})}function F7({className:t}){return a.jsx("svg",{className:t,viewBox:"0 0 36 54",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M17.8131 0.00538C18.4463 -0.15091 20.3648 3.14642 20.8264 3.84781C25.4187 10.816 35.3089 26.9368 35.9383 34.8694C37.4182 53.5822 11.882 61.3357 2.53721 45.3789C-1.73471 38.0791 0.016 32.2049 3.178 25.0232C6.99221 16.3662 12.6411 7.90372 17.8131 0.00538ZM18.3738 7.24807L17.5881 7.48441C14.4452 12.9431 10.917 18.2341 8.19369 23.9368C4.6808 31.29 1.18317 38.5479 7.69403 45.5657C17.3058 55.9228 34.9847 46.8808 31.4604 32.8681C29.2558 24.0969 22.4207 15.2913 18.3776 7.24807H18.3738Z",fill:"#C3C2C1"})})}function y8e({className:t}){return a.jsxs("svg",{className:t,viewBox:"0 0 35 53",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M17.3165 0.0038C17.932 -0.14959 19.7971 3.08645 20.2458 3.77481C24.7103 10.6135 34.3251 26.4346 34.937 34.2198C36.3757 52.5848 11.5505 60.1942 2.46584 44.534C-1.68714 37.3735 0.0148 31.6085 3.08879 24.5603C6.79681 16.0605 12.2884 7.75907 17.3165 0.0038ZM17.8615 7.11561L17.0977 7.34755C14.0423 12.7048 10.6124 17.8974 7.96483 23.4941C4.54975 30.7107 1.14949 37.8337 7.47908 44.721C16.8233 54.8856 34.01 46.0117 30.5838 32.2595C28.4405 23.6512 21.7957 15.0093 17.8652 7.11561H17.8615Z",fill:"#C3C2C1"}),a.jsx("path",{d:"M5.03547 30.112C9.64453 30.4936 11.632 35.7985 16.4154 35.791C19.6339 35.7873 20.2161 33.2283 22.3853 31.6197C31.6776 24.7286 33.5835 37.4894 27.9881 44.4254C18.1878 56.5653 -1.16063 44.6013 5.03917 30.1158L5.03547 30.112Z",fill:"#1F8FEB"})]})}function v8e({className:t}){return a.jsxs("svg",{className:t,viewBox:"0 0 36 54",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M17.9625 4.48059L4.77216 26.3154L2.08228 40.2175L10.0224 50.8414H23.1594L33.3246 42.1693V30.2455L17.9625 4.48059Z",fill:"#1F8FEB"}),a.jsx("path",{d:"M17.7948 0.00538C18.4273 -0.15091 20.3438 3.14642 20.8048 3.84781C25.3921 10.816 35.2715 26.9368 35.9001 34.8694C37.3784 53.5822 11.8702 61.3357 2.53562 45.3789C-1.73163 38.0829 0.0134 32.2087 3.1757 25.027C6.98574 16.3662 12.6284 7.90372 17.7948 0.00538ZM18.3549 7.24807L17.57 7.48441C14.4306 12.9431 10.9063 18.2341 8.1859 23.9368C4.67686 31.29 1.18305 38.5479 7.68679 45.5657C17.2881 55.9228 34.9476 46.8808 31.4271 32.8681C29.2249 24.0969 22.3974 15.2913 18.3587 7.24807H18.3549Z",fill:"#C3C2C1"})]})}function w8e({className:t}){return a.jsxs("svg",{className:t,viewBox:"0 0 12 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M6 0.5C4.6 0.5 3.5 1.6 3.5 3V12.1C2.6 12.8 2 13.9 2 15C2 17.2 3.8 19 6 19C8.2 19 10 17.2 10 15C10 13.9 9.4 12.8 8.5 12.1V3C8.5 1.6 7.4 0.5 6 0.5Z",stroke:"#C3C2C1",strokeWidth:"1",fill:"none"}),a.jsx("circle",{cx:"6",cy:"15",r:"2.5",stroke:"#C3C2C1",strokeWidth:"1",fill:"none"})]})}function _8e({className:t}){return a.jsxs("svg",{className:t,viewBox:"0 0 12 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("rect",{x:"4.5",y:"8",width:"3",height:"4.5",fill:"#d4a017",rx:"0.5"}),a.jsx("circle",{cx:"6",cy:"15",r:"2",fill:"#d4a017"}),a.jsx("path",{d:"M6 0.5C4.6 0.5 3.5 1.6 3.5 3V12.1C2.6 12.8 2 13.9 2 15C2 17.2 3.8 19 6 19C8.2 19 10 17.2 10 15C10 13.9 9.4 12.8 8.5 12.1V3C8.5 1.6 7.4 0.5 6 0.5Z",stroke:"#C3C2C1",strokeWidth:"1",fill:"none"})]})}function S8e({className:t}){return a.jsxs("svg",{className:t,viewBox:"0 0 12 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("rect",{x:"4.5",y:"3",width:"3",height:"9.5",fill:"#c62828",rx:"0.5"}),a.jsx("circle",{cx:"6",cy:"15",r:"2",fill:"#c62828"}),a.jsx("path",{d:"M6 0.5C4.6 0.5 3.5 1.6 3.5 3V12.1C2.6 12.8 2 13.9 2 15C2 17.2 3.8 19 6 19C8.2 19 10 17.2 10 15C10 13.9 9.4 12.8 8.5 12.1V3C8.5 1.6 7.4 0.5 6 0.5Z",stroke:"#C3C2C1",strokeWidth:"1",fill:"none"})]})}function fP({className:t,color:e,isHeating:n}){const i={"text-orange-400":"#fb923c","text-blue-400":"#60a5fa","text-green-400":"#4ade80"}[e]||"#888",s=n?{filter:`drop-shadow(0 0 4px ${i}) drop-shadow(0 0 8px ${i})`}:{};return n?a.jsxs("svg",{className:t,style:s,viewBox:"0 0 12 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("rect",{x:"4.5",y:"3",width:"3",height:"9.5",fill:i,rx:"0.5"}),a.jsx("circle",{cx:"6",cy:"15",r:"2",fill:i}),a.jsx("path",{d:"M6 0.5C4.6 0.5 3.5 1.6 3.5 3V12.1C2.6 12.8 2 13.9 2 15C2 17.2 3.8 19 6 19C8.2 19 10 17.2 10 15C10 13.9 9.4 12.8 8.5 12.1V3C8.5 1.6 7.4 0.5 6 0.5Z",stroke:i,strokeWidth:"1",fill:"none"})]}):a.jsxs("svg",{className:t,viewBox:"0 0 12 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M6 0.5C4.6 0.5 3.5 1.6 3.5 3V12.1C2.6 12.8 2 13.9 2 15C2 17.2 3.8 19 6 19C8.2 19 10 17.2 10 15C10 13.9 9.4 12.8 8.5 12.1V3C8.5 1.6 7.4 0.5 6 0.5Z",stroke:i,strokeWidth:"1",fill:"none"}),a.jsx("circle",{cx:"6",cy:"15",r:"2.5",stroke:i,strokeWidth:"1",fill:"none"})]})}function I7({humidity:t,goodThreshold:e=40,fairThreshold:n=60,onClick:r,compact:i}){const s=typeof t=="string"?parseInt(t,10):t,o=typeof e=="number"?e:40,l=typeof n=="number"?n:60;let c,u;isNaN(s)?(c="#C3C2C1",u="Unknown"):s<=o?(c="#22a352",u="Good"):s<=l?(c="#d4a017",u="Fair"):(c="#c62828",u="Bad");let d;return isNaN(s)||s<=o?d=F7:s<=l?d=y8e:d=v8e,a.jsxs("button",{type:"button",onClick:r,className:`flex items-center gap-1 ${r?"cursor-pointer hover:opacity-80 transition-opacity":""}`,title:`Humidity: ${s}% - ${u}${r?" (click for history)":""}`,children:[a.jsx(d,{className:i?"w-2.5 h-3":"w-3 h-4"}),a.jsxs("span",{className:`font-medium tabular-nums ${i?"text-[10px]":"text-xs"}`,style:{color:c},children:[s,"%"]})]})}function z7({temp:t,goodThreshold:e=28,fairThreshold:n=35,onClick:r,compact:i}){const s=typeof e=="number"?e:28,o=typeof n=="number"?n:35;let l,c,u;return t<=s?(l="#22a352",c="Good",u=w8e):t<=o?(l="#d4a017",c="Fair",u=_8e):(l="#c62828",c="Bad",u=S8e),a.jsxs("button",{type:"button",onClick:r,className:`flex items-center gap-1 ${r?"cursor-pointer hover:opacity-80 transition-opacity":""}`,title:`Temperature: ${t}°C - ${c}${r?" (click for history)":""}`,children:[a.jsx(u,{className:i?"w-2.5 h-3":"w-3 h-4"}),a.jsxs("span",{className:`tabular-nums text-right ${i?"text-[10px] w-8":"w-12"}`,style:{color:l},children:[t,"°C"]})]})}function $d(t,e){const n=typeof t=="string"?parseInt(t,10):t,r=isNaN(n)?0:n,i=e===1,s=r>=128?r-128:r,o=String.fromCharCode(65+s);return i?`HT-${o}`:`AMS-${o}`}function mP(t){return t>50?"#00ae42":t>=15?"#f59e0b":"#ef4444"}function pP(t){return!t?.remaining_weight||!t?.filament_weight||t.filament_weight<=0?null:Math.min(100,Math.round(t.remaining_weight/t.filament_weight*100))}function N8e(t){const e=Math.floor(t/3600),n=Math.floor(t%3600/60);return e>0?`${e}h ${n}m`:`${n}m`}function M8e(t,e="system"){const n=new Date,r=new Date(n.getTime()+t*60*1e3),i=new Date;i.setHours(0,0,0,0);const s=new Date(r);s.setHours(0,0,0,0);const o={hour:"2-digit",minute:"2-digit"};e==="12h"?o.hour12=!0:e==="24h"&&(o.hour12=!1);const l=r.toLocaleTimeString([],o),c=Math.floor((s.getTime()-i.getTime())/(1e3*60*60*24));return c===0?l:c===1?`Tomorrow ${l}`:r.toLocaleDateString([],{weekday:"short"})+" "+l}function k8e(t){if(!t)return"/img/printers/default.png";const e=t.toLowerCase().replace(/\s+/g,"");return e.includes("x1e")?"/img/printers/x1e.png":e.includes("x1c")||e.includes("x1carbon")||e.includes("x1")?"/img/printers/x1c.png":e.includes("h2d")||e.includes("h2c")||e.includes("h2s")?"/img/printers/h2d.png":e.includes("p2s")||e.includes("p1s")?"/img/printers/p1s.png":e.includes("p1p")?"/img/printers/p1p.png":e.includes("a1mini")?"/img/printers/a1mini.png":e.includes("a1")?"/img/printers/a1.png":"/img/printers/default.png"}function E8e(t){return t>=-50?{labelKey:"printers.wifiSignal.excellent",color:"text-bambu-green",bars:4}:t>=-60?{labelKey:"printers.wifiSignal.good",color:"text-bambu-green",bars:3}:t>=-70?{labelKey:"printers.wifiSignal.fair",color:"text-yellow-400",bars:2}:t>=-80?{labelKey:"printers.wifiSignal.weak",color:"text-orange-400",bars:1}:{labelKey:"printers.wifiSignal.veryWeak",color:"text-red-400",bars:1}}function gP(t){return t?!!(t.tray_info_idx&&t.tray_info_idx.startsWith("GF")||t.tray_uuid&&t.tray_uuid!=="00000000000000000000000000000000"||t.tag_uid&&t.tag_uid!=="0000000000000000"):!1}function T8e({url:t,printName:e}){const{t:n}=hn(),[r,i]=_.useState(!1),[s,o]=_.useState(!1),[l,c]=_.useState(!1);return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:`w-20 h-20 flex-shrink-0 rounded-lg overflow-hidden bg-bambu-dark-tertiary flex items-center justify-center ${t&&r?"cursor-pointer":""}`,onClick:()=>t&&r&&c(!0),children:t&&!s?a.jsxs(a.Fragment,{children:[a.jsx("img",{src:t,alt:n("printers.printPreview"),className:`w-full h-full object-cover ${r?"block":"hidden"}`,onLoad:()=>i(!0),onError:()=>o(!0)}),!r&&a.jsx(zi,{className:"w-8 h-8 text-bambu-gray"})]}):a.jsx(zi,{className:"w-8 h-8 text-bambu-gray"})}),l&&t&&a.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-50 p-8",onClick:()=>c(!1),children:a.jsxs("div",{className:"relative max-w-2xl max-h-full",children:[a.jsx("img",{src:t,alt:n("printers.printPreview"),className:"max-w-full max-h-[80vh] rounded-lg shadow-2xl"}),e&&a.jsx("p",{className:"text-white text-center mt-4 text-lg",children:e})]})})]})}function C8e({printers:t}){const{t:e}=hn(),n=ln(),r=_.useMemo(()=>{let s=0,o=0,l=0,c=0;return t?.forEach(u=>{const d=n.getQueryData(["printerStatus",u.id]);d===void 0?c++:d.connected?d.state==="RUNNING"?s++:o++:l++}),{printing:s,idle:o,offline:l,loading:c,total:t?.length||0}},[t,n]),[,i]=_.useState(0);return _.useEffect(()=>{let s=!1;const o=n.getQueryCache().subscribe(()=>{s||(s=!0,requestAnimationFrame(()=>{i(l=>l+1),s=!1}))});return()=>o()},[n]),t?.length?a.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[r.printing>0&&a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-2 h-2 rounded-full bg-bambu-green animate-pulse"}),a.jsxs("span",{className:"text-bambu-gray",children:[a.jsx("span",{className:"text-white font-medium",children:r.printing})," ",e("printers.status.printing").toLowerCase()]})]}),r.idle>0&&a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-400"}),a.jsxs("span",{className:"text-bambu-gray",children:[a.jsx("span",{className:"text-white font-medium",children:r.idle})," ",e("printers.status.idle").toLowerCase()]})]}),r.offline>0&&a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-2 h-2 rounded-full bg-gray-400"}),a.jsxs("span",{className:"text-bambu-gray",children:[a.jsx("span",{className:"text-white font-medium",children:r.offline})," ",e("printers.status.offline").toLowerCase()]})]})]}):null}function U7(t,e){if(e)return e;switch(t){case"RUNNING":return"Printing";case"PAUSE":return"Paused";case"FINISH":return"Finished";case"FAILED":return"Failed";case"IDLE":return"Idle";default:return t?t.charAt(0)+t.slice(1).toLowerCase():"Idle"}}function B7({printer:t,hideIfDisconnected:e,maintenanceInfo:n,viewMode:r="expanded",cardSize:i=2,amsThresholds:s,spoolmanEnabled:o=!1,hasUnlinkedSpools:l=!1,linkedSpools:c,spoolmanUrl:u,timeFormat:d="system",cameraViewMode:h="window",onOpenEmbeddedCamera:p,checkPrinterFirmware:m=!0}){const{t:b}=hn(),x=ln(),y=Ac(),{showToast:v}=Tn(),{hasPermission:S}=Ir(),[N,T]=_.useState(!1),[M,C]=_.useState(!1),[E,R]=_.useState(!0),[A,P]=_.useState(!1),[U,F]=_.useState(!1),[H,D]=_.useState(!1),[$,G]=_.useState(!1),[I,K]=_.useState(!1),[Q,ae]=_.useState(!1),[B,W]=_.useState(!1),[J,ne]=_.useState(!1),[me,fe]=_.useState(!1),[he,De]=_.useState(!1),[se,Ne]=_.useState(null),[Fe,ce]=_.useState(null),[Ge,V]=_.useState(null),[Y,ue]=_.useState(!1),[q,re]=_.useState(null),[X,le]=_.useState(!1),[pe,ee]=_.useState(!1),[z,O]=_.useState(null),[Z,ge]=_.useState(!1),[Ae,_e]=_.useState(!1),{data:Te}=it({queryKey:["printerStatus",t.id],queryFn:()=>oe.getPrinterStatus(t.id),refetchInterval:3e4}),{data:Se}=it({queryKey:["firmwareUpdate",t.id],queryFn:()=>_1.checkPrinterUpdate(t.id),staleTime:300*1e3,refetchInterval:300*1e3,enabled:m&&S("firmware:read")}),$e=_.useMemo(()=>{const gt=new Set;if(Te?.ams)for(const jt of Te.ams)for(const pn of jt.tray||[])pn.tray_info_idx&>.add(pn.tray_info_idx);return Te?.vt_tray?.tray_info_idx&>.add(Te.vt_tray.tray_info_idx),Array.from(gt)},[Te?.ams,Te?.vt_tray]),{data:Qe}=it({queryKey:["filamentInfo",$e],queryFn:()=>oe.getFilamentInfo($e),enabled:$e.length>0,staleTime:300*1e3}),{data:Ue}=it({queryKey:["slotPresets",t.id],queryFn:()=>oe.getSlotPresets(t.id),staleTime:120*1e3}),[be,ke]=_.useState(null);_.useEffect(()=>{Te?.wifi_signal!=null&&ke(Te.wifi_signal)},[Te?.wifi_signal]);const Be=Te?.wifi_signal??be,Ee=_.useRef(void 0);_.useEffect(()=>{Te?.connected!==void 0&&(Ee.current=Te.connected)},[Te?.connected]);const Ve=Te?.connected??Ee.current,ve=_.useRef({});_.useEffect(()=>{Te?.ams_extruder_map&&Object.keys(Te.ams_extruder_map).length>0&&(ve.current=Te.ams_extruder_map)},[Te?.ams_extruder_map]);const nt=Te?.ams_extruder_map&&Object.keys(Te.ams_extruder_map).length>0?Te.ams_extruder_map:ve.current,Me=_.useRef([]);_.useEffect(()=>{Te?.ams&&Te.ams.length>0&&(Me.current=Te.ams)},[Te?.ams]);const Ke=Te?.ams&&Te.ams.length>0?Te.ams:Me.current,je=_.useRef(255),Pe=Te?.tray_now;Pe!==void 0&&Pe!==255&&(je.current=Pe);const ye=Pe===void 0||Pe===255?je.current:Pe,{data:Ye}=it({queryKey:["smartPlugByPrinter",t.id],queryFn:()=>oe.getSmartPlugByPrinter(t.id)}),{data:yt}=it({queryKey:["scriptPlugsByPrinter",t.id],queryFn:()=>oe.getScriptPlugsByPrinter(t.id)}),{data:ot}=it({queryKey:["smartPlugStatus",Ye?.id],queryFn:()=>Ye?oe.getSmartPlugStatus(Ye.id):null,enabled:!!Ye,refetchInterval:1e4}),{data:$t}=it({queryKey:["queue",t.id,"pending"],queryFn:()=>oe.getQueue(t.id,"pending")}),Ft=$t?.length||0,{data:ze}=it({queryKey:["queue",t.id,"printing"],queryFn:()=>oe.getQueue(t.id,"printing"),enabled:Te?.state==="RUNNING"}),{data:xt}=it({queryKey:["currentPrintUser",t.id],queryFn:()=>oe.getCurrentPrintUser(t.id),enabled:Te?.state==="RUNNING"}),Wt=ze?.[0]?.created_by_username||xt?.username,{data:Yt}=it({queryKey:["archives",t.id,"last"],queryFn:()=>oe.getArchives(t.id,1,0),enabled:Te?.connected&&Te?.state!=="RUNNING"}),Mn=Yt?.[0],bn=e&&Ve===!1,er=pt({mutationFn:gt=>oe.deletePrinter(t.id,gt.deleteArchives),onSuccess:()=>{x.invalidateQueries({queryKey:["printers"]}),x.invalidateQueries({queryKey:["archives"]}),x.invalidateQueries({queryKey:["maintenanceOverview"]})},onError:gt=>v(gt.message||b("printers.toast.failedToDelete"),"error")}),lr=pt({mutationFn:()=>oe.connectPrinter(t.id),onSuccess:()=>{x.invalidateQueries({queryKey:["printerStatus",t.id]})}}),Cn=pt({mutationFn:gt=>Ye?oe.controlSmartPlug(Ye.id,gt):Promise.reject("No plug"),onSuccess:()=>{x.invalidateQueries({queryKey:["smartPlugStatus",Ye?.id]})}}),An=pt({mutationFn:gt=>Ye?oe.updateSmartPlug(Ye.id,{auto_off:gt}):Promise.reject("No plug"),onSuccess:()=>{x.invalidateQueries({queryKey:["smartPlugByPrinter",t.id]}),x.invalidateQueries({queryKey:["smart-plugs"]})}}),di=pt({mutationFn:gt=>oe.controlSmartPlug(gt,"on"),onSuccess:()=>{v(b("printers.toast.scriptTriggered"))},onError:gt=>v(gt.message||b("printers.toast.failedToRunScript"),"error")}),ii=pt({mutationFn:()=>oe.stopPrint(t.id),onSuccess:()=>{v(b("printers.toast.printStopped")),x.invalidateQueries({queryKey:["printerStatus",t.id]})},onError:gt=>v(gt.message||b("printers.toast.failedToStopPrint"),"error")}),Re=pt({mutationFn:()=>oe.pausePrint(t.id),onSuccess:()=>{v(b("printers.toast.printPaused")),x.invalidateQueries({queryKey:["printerStatus",t.id]})},onError:gt=>v(gt.message||b("printers.toast.failedToPausePrint"),"error")}),tt=pt({mutationFn:()=>oe.resumePrint(t.id),onSuccess:()=>{v(b("printers.toast.printResumed")),x.invalidateQueries({queryKey:["printerStatus",t.id]})},onError:gt=>v(gt.message||b("printers.toast.failedToResumePrint"),"error")}),ut=pt({mutationFn:gt=>oe.setChamberLight(t.id,gt),onMutate:async gt=>{await x.cancelQueries({queryKey:["printerStatus",t.id]});const jt=x.getQueryData(["printerStatus",t.id]);return x.setQueryData(["printerStatus",t.id],pn=>({...pn,chamber_light:gt})),{previousStatus:jt}},onSuccess:(gt,jt)=>{v(`Chamber light ${jt?"on":"off"}`)},onError:(gt,jt,pn)=>{pn?.previousStatus&&x.setQueryData(["printerStatus",t.id],pn.previousStatus),v(gt.message||b("printers.toast.failedToControlChamberLight"),"error")}}),dt=pt({mutationFn:gt=>oe.updatePrinter(t.id,{plate_detection_enabled:gt}),onSuccess:()=>{x.invalidateQueries({queryKey:["printers"]}),v(dt.variables?b("printers.toast.plateCheckEnabled"):b("printers.toast.plateCheckDisabled"))},onError:gt=>v(gt.message||b("printers.toast.failedToUpdateSetting"),"error")}),ct=(Te?.state==="RUNNING"||Te?.state==="PAUSE"||Te?.state==="PAUSED")&&(Te?.printable_objects_count??0)>=2,{data:Dt}=it({queryKey:["printableObjects",t.id],queryFn:()=>oe.getPrintableObjects(t.id),enabled:he||ct,refetchInterval:he?5e3:ct?3e4:!1}),[de,Le]=_.useState(null),qe=_.useRef(!1),we=_.useRef(null),Ie=_.useRef(!1),rt=pt({mutationFn:({amsId:gt,slotId:jt})=>oe.refreshAmsSlot(t.id,gt,jt),onMutate:({amsId:gt,slotId:jt})=>{we.current&&clearTimeout(we.current),qe.current=!1,Ie.current=!1,Le({amsId:gt,slotId:jt}),setTimeout(()=>{Ie.current=!0},2e3),we.current=setTimeout(()=>{Le(null)},3e4)},onSuccess:gt=>{v(gt.message||b("printers.toast.rfidRereadInitiated"))},onError:gt=>{v(gt.message||b("printers.toast.failedToRereadRfid"),"error"),we.current&&clearTimeout(we.current),Le(null)}}),[Ze,Ct]=_.useState(null),[At,zt]=_.useState(null),Rt=async()=>{try{const gt=await oe.getPlateReferences(t.id);Ct(gt)}catch{}},Et=()=>{dt.mutate(!t.plate_detection_enabled)},dn=async()=>{le(!0),re(null);const gt=Te?.chamber_light===!1;_e(gt),gt&&(await oe.setChamberLight(t.id,!0),await new Promise(jt=>setTimeout(jt,2500)));try{const jt=await oe.checkPlateEmpty(t.id,{includeDebugImage:!0});re(jt),Rt()}catch(jt){v(jt instanceof Error?jt.message:b("printers.toast.failedToCheckPlate"),"error"),gt&&(await oe.setChamberLight(t.id,!1),_e(!1))}finally{le(!1)}},Ut=_.useCallback(async()=>{re(null),Ae&&(await oe.setChamberLight(t.id,!1),_e(!1))},[Ae,t.id]),mn=async gt=>{ee(!0);try{const jt=await oe.calibratePlateDetection(t.id,{label:gt});if(jt.success){v(jt.message||b("printers.toast.calibrationSaved"),"success"),Rt();const pn=await oe.checkPlateEmpty(t.id,{includeDebugImage:!0});re(pn)}else v(jt.message||b("printers.toast.calibrationFailed"),"error")}catch(jt){v(jt instanceof Error?jt.message:b("printers.toast.calibrationFailed"),"error")}finally{ee(!1)}},Nn=async(gt,jt)=>{try{await oe.updatePlateReferenceLabel(t.id,gt,jt),zt(null),Rt()}catch(pn){v(pn instanceof Error?pn.message:b("printers.toast.failedToUpdateLabel"),"error")}},jn=async gt=>{try{await oe.deletePlateReference(t.id,gt),v(b("printers.toast.referenceDeleted"),"success"),Rt();const jt=await oe.checkPlateEmpty(t.id,{includeDebugImage:!0});re(jt)}catch(jt){v(jt instanceof Error?jt.message:b("printers.toast.failedToDeleteReference"),"error")}},Kt=async()=>{if(z){ge(!0);try{await oe.updatePrinter(t.id,{plate_detection_roi:z}),v(b("printers.toast.detectionAreaSaved"),"success"),O(null);const gt=await oe.checkPlateEmpty(t.id,{includeDebugImage:!0});re(gt)}catch(gt){v(gt instanceof Error?gt.message:b("printers.toast.failedToSaveDetectionArea"),"error")}finally{ge(!1)}}};_.useEffect(()=>{const gt=jt=>{jt.key==="Escape"&&q&&Ut()};return window.addEventListener("keydown",gt),()=>window.removeEventListener("keydown",gt)},[q,Ut]);const Zt=_.useRef(null);_.useEffect(()=>{if(!de)return;const gt=Te?.ams_status_main??0;return gt!==0&&(qe.current=!0,Zt.current&&(clearTimeout(Zt.current),Zt.current=null)),qe.current&>===0&&(Ie.current?(we.current&&clearTimeout(we.current),Le(null)):Zt.current||(Zt.current=setTimeout(()=>{we.current&&clearTimeout(we.current),Le(null)},2e3))),()=>{Zt.current&&clearTimeout(Zt.current)}},[Te?.ams_status_main,de]);const[Jt,cn]=_.useState(null);if(bn)return null;const Hr=()=>{switch(i){case 1:return"w-10 h-10";case 2:return"w-14 h-14";case 3:return"w-16 h-16";case 4:return"w-20 h-20";default:return"w-14 h-14"}},Yn=()=>{switch(i){case 1:return"text-base truncate";case 2:return"text-lg";case 3:return"text-xl";case 4:return"text-2xl";default:return"text-lg"}},ai=()=>{switch(i){case 1:return"mb-2";case 2:return"mb-4";case 3:return"mb-5";case 4:return"mb-6";default:return"mb-4"}};return a.jsxs(Mt,{className:"relative",children:[a.jsxs(kt,{className:i>=3?"p-5":"",children:[a.jsxs("div",{className:ai(),children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[a.jsx("img",{src:k8e(t.model),alt:t.model||b("common.printer"),className:`object-contain rounded-lg bg-bambu-dark flex-shrink-0 ${Hr()}`}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("h3",{className:`font-semibold text-white ${Yn()}`,children:t.name}),r==="compact"&&a.jsx("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${Te?.connected?"bg-status-ok":"bg-status-error"}`,title:Te?.connected?b("printers.connection.connected"):b("printers.connection.offline")})]}),a.jsxs("p",{className:"text-sm text-bambu-gray",children:[t.model||"Unknown Model",r==="expanded"&&Te?.nozzles&&Te.nozzles[0]?.nozzle_diameter&&a.jsxs("span",{className:"ml-1.5 text-bambu-gray",title:Te.nozzles[0].nozzle_type||"Nozzle",children:["• ",Te.nozzles[0].nozzle_diameter,"mm"]}),r==="expanded"&&n&&n.total_print_hours>0&&a.jsxs("span",{className:"ml-2 text-bambu-gray",children:[a.jsx(nr,{className:"w-3 h-3 inline-block mr-1"}),Math.round(n.total_print_hours),"h"]})]})]})]}),a.jsxs("div",{className:"relative flex-shrink-0",children:[a.jsx(Ce,{variant:"ghost",size:"sm",onClick:()=>T(!N),children:a.jsx(hh,{className:"w-4 h-4"})}),N&&a.jsxs("div",{className:"absolute right-0 mt-2 w-48 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-lg z-20",children:[a.jsxs("button",{className:`w-full px-4 py-2 text-left text-sm flex items-center gap-2 ${S("printers:update")?"hover:bg-bambu-dark-tertiary":"opacity-50 cursor-not-allowed"}`,onClick:()=>{S("printers:update")&&(P(!0),T(!1))},title:S("printers:update")?void 0:b("printers.permission.noEdit"),children:[a.jsx(ea,{className:"w-4 h-4"}),b("common.edit")]}),a.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm hover:bg-bambu-dark-tertiary flex items-center gap-2",onClick:()=>{lr.mutate(),T(!1)},children:[a.jsx(Or,{className:"w-4 h-4"}),b("printers.reconnect")]}),a.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm hover:bg-bambu-dark-tertiary flex items-center gap-2",onClick:()=>{D(!0),T(!1)},children:[a.jsx(BW,{className:"w-4 h-4"}),b("printers.mqttDebug")]}),a.jsxs("button",{className:`w-full px-4 py-2 text-left text-sm flex items-center gap-2 ${S("printers:delete")?"text-red-400 hover:bg-bambu-dark-tertiary":"text-red-400/50 cursor-not-allowed"}`,onClick:()=>{S("printers:delete")&&(C(!0),T(!1))},title:S("printers:delete")?void 0:b("printers.permission.noDelete"),children:[a.jsx(on,{className:"w-4 h-4"}),b("common.delete")]})]})]})]}),r==="expanded"&&a.jsxs("div",{className:"flex flex-wrap items-center gap-2 mt-2",children:[a.jsxs("span",{className:`flex items-center gap-1.5 px-2 py-1 rounded-full text-xs ${Te?.connected?"bg-status-ok/20 text-status-ok":"bg-status-error/20 text-status-error"}`,children:[Te?.connected?a.jsx(Hy,{className:"w-3 h-3"}):a.jsx(VR,{className:"w-3 h-3"}),Te?.connected?b("printers.connection.connected"):b("printers.connection.offline")]}),Te?.connected&&Be!=null&&a.jsxs("span",{className:`flex items-center gap-1 px-2 py-1 rounded-full text-xs ${Be>=-50||Be>=-60?"bg-status-ok/20 text-status-ok":Be>=-70?"bg-status-warning/20 text-status-warning":Be>=-80?"bg-orange-500/20 text-orange-600":"bg-status-error/20 text-status-error"}`,title:`WiFi: ${Be} dBm - ${b(E8e(Be).labelKey)}`,children:[a.jsx(Ghe,{className:"w-3 h-3"}),Be,"dBm"]}),Te?.connected&&(()=>{const gt=Te.hms_errors?lke(Te.hms_errors):[];return a.jsxs("button",{onClick:()=>ae(!0),className:`flex items-center gap-1 px-2 py-1 rounded-full text-xs cursor-pointer hover:opacity-80 transition-opacity ${gt.length>0?gt.some(jt=>jt.severity<=2)?"bg-status-error/20 text-status-error":"bg-status-warning/20 text-status-warning":"bg-status-ok/20 text-status-ok"}`,title:b("printers.clickToViewHmsErrors"),children:[a.jsx(En,{className:"w-3 h-3"}),gt.length>0?gt.length:"OK"]})})(),n&&a.jsxs("button",{onClick:()=>y("/maintenance"),className:`flex items-center gap-1 px-2 py-1 rounded-full text-xs cursor-pointer hover:opacity-80 transition-opacity ${n.due_count>0?"bg-status-error/20 text-status-error":n.warning_count>0?"bg-status-warning/20 text-status-warning":"bg-status-ok/20 text-status-ok"}`,title:n.due_count>0||n.warning_count>0?`${n.due_count>0?`${n.due_count} maintenance due`:""}${n.due_count>0&&n.warning_count>0?", ":""}${n.warning_count>0?`${n.warning_count} due soon`:""} - Click to view`:b("printers.maintenanceUpToDate"),children:[a.jsx(um,{className:"w-3 h-3"}),n.due_count>0||n.warning_count>0?n.due_count+n.warning_count:"OK"]}),Ft>0&&a.jsxs("button",{onClick:()=>y("/queue"),className:"flex items-center gap-1 px-2 py-1 rounded-full text-xs bg-purple-500/20 text-purple-400 hover:opacity-80 transition-opacity",title:b("printers.queue.inQueue",{count:Ft}),children:[a.jsx(es,{className:"w-3 h-3"}),Ft]}),Se?.current_version&&a.jsxs("button",{onClick:()=>ue(!0),className:`flex items-center gap-1 px-2 py-1 rounded-full text-xs hover:opacity-80 transition-opacity ${Se.update_available?"bg-orange-500/20 text-orange-400":"bg-status-ok/20 text-status-ok"}`,title:Se.update_available?b("printers.firmwareUpdateAvailable",{current:Se.current_version,latest:Se.latest_version}):b("printers.firmwareUpToDate",{version:Se.current_version}),children:[Se.update_available?a.jsx(Si,{className:"w-3 h-3"}):a.jsx(fr,{className:"w-3 h-3"}),Se.current_version]})]})]}),M&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsx(Mt,{className:"w-full max-w-md mx-4",children:a.jsxs(kt,{children:[a.jsxs("div",{className:"flex items-start gap-3 mb-4",children:[a.jsx("div",{className:"p-2 rounded-full bg-red-500/20",children:a.jsx(En,{className:"w-5 h-5 text-red-400"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold text-white",children:b("printers.confirm.deleteTitle")}),a.jsx("p",{className:"text-sm text-bambu-gray mt-1",children:b("printers.confirm.deleteMessage",{name:t.name})})]})]}),a.jsx("div",{className:"bg-bambu-dark rounded-lg p-3 mb-4",children:a.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:E,onChange:gt=>R(gt.target.checked),className:"mt-0.5 w-4 h-4 rounded border-bambu-gray bg-bambu-dark-secondary text-bambu-green focus:ring-bambu-green focus:ring-offset-0"}),a.jsxs("div",{children:[a.jsx("span",{className:"text-sm text-white",children:b("printers.deleteArchives")}),a.jsx("p",{className:"text-xs text-bambu-gray mt-0.5",children:b(E?"printers.confirm.deleteArchivesNote":"printers.confirm.keepArchivesNote")})]})]})}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx(Ce,{variant:"secondary",onClick:()=>{C(!1),R(!0)},children:b("common.cancel")}),a.jsx(Ce,{variant:"danger",onClick:()=>{er.mutate({deleteArchives:E}),C(!1),R(!0)},children:"Delete"})]})]})})}),Te?.connected&&a.jsxs(a.Fragment,{children:[r==="compact"?a.jsx("div",{className:"mt-2",children:Te.state==="RUNNING"?a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"flex-1 bg-bambu-dark-tertiary rounded-full h-1.5",children:a.jsx("div",{className:"bg-bambu-green h-1.5 rounded-full transition-all",style:{width:`${Te.progress||0}%`}})}),a.jsxs("span",{className:"text-xs text-white",children:[Math.round(Te.progress||0),"%"]})]}):a.jsx("p",{className:"text-xs text-bambu-gray",children:U7(Te.state,Te.stg_cur_name)})}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"mb-4 p-3 bg-bambu-dark rounded-lg relative",children:[a.jsxs("button",{onClick:()=>De(!0),disabled:!(Te.state==="RUNNING"||Te.state==="PAUSE"||Te.state==="PAUSED")||(Te.printable_objects_count??0)<2||!S("printers:control"),className:`absolute top-2 right-2 p-1.5 rounded transition-colors z-10 ${(Te.state==="RUNNING"||Te.state==="PAUSE"||Te.state==="PAUSED")&&(Te.printable_objects_count??0)>=2&&S("printers:control")?"text-bambu-gray hover:text-white hover:bg-white/10":"text-bambu-gray/30 cursor-not-allowed"}`,title:S("printers:control")?Te.state==="RUNNING"||Te.state==="PAUSE"||Te.state==="PAUSED"?(Te.printable_objects_count??0)>=2?b("printers.skipObjects.tooltip"):b("printers.skipObjects.requiresMultiple"):b("printers.skipObjects.onlyWhilePrinting"):b("printers.permission.noControl"),children:[a.jsx(LM,{className:"w-4 h-4"}),Dt&&Dt.skipped_count>0&&a.jsx("span",{className:"absolute -top-1 -right-1 min-w-[16px] h-4 px-1 flex items-center justify-center text-[10px] font-bold bg-red-500 text-white rounded-full",children:Dt.skipped_count})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx(T8e,{url:Te.state==="RUNNING"?Te.cover_url:null,printName:Te.state==="RUNNING"&&(Te.subtask_name||Te.current_print)||void 0}),a.jsx("div",{className:"flex-1 min-w-0",children:Te.current_print&&Te.state==="RUNNING"?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-sm text-bambu-gray mb-1",children:Te.stg_cur_name||"Printing"}),a.jsx("p",{className:"text-white text-sm mb-2 truncate",children:Te.subtask_name||Te.current_print}),a.jsxs("div",{className:"flex items-center justify-between text-sm",children:[a.jsx("div",{className:"flex-1 bg-bambu-dark-tertiary rounded-full h-2 mr-3",children:a.jsx("div",{className:"bg-bambu-green h-2 rounded-full transition-all",style:{width:`${Te.progress||0}%`}})}),a.jsxs("span",{className:"text-white",children:[Math.round(Te.progress||0),"%"]})]}),a.jsxs("div",{className:"flex items-center gap-3 mt-2 text-xs text-bambu-gray",children:[Te.remaining_time!=null&&Te.remaining_time>0&&a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(nr,{className:"w-3 h-3"}),N8e(Te.remaining_time*60)]}),a.jsxs("span",{className:"text-bambu-green font-medium",title:b("printers.estimatedCompletion"),children:["ETA ",M8e(Te.remaining_time,d)]})]}),Te.layer_num!=null&&Te.total_layers!=null&&Te.total_layers>0&&a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(es,{className:"w-3 h-3"}),Te.layer_num,"/",Te.total_layers]}),Wt&&a.jsxs("span",{className:"flex items-center gap-1",title:`Started by ${Wt}`,children:[a.jsx($u,{className:"w-3 h-3"}),Wt]})]})]}):a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-sm text-bambu-gray mb-1",children:b("printers.sort.status")}),a.jsx("p",{className:"text-white text-sm mb-2",children:U7(Te.state,Te.stg_cur_name)}),a.jsxs("div",{className:"flex items-center justify-between text-sm",children:[a.jsx("div",{className:"flex-1 bg-bambu-dark-tertiary rounded-full h-2 mr-3",children:a.jsx("div",{className:"bg-bambu-dark-tertiary h-2 rounded-full"})}),a.jsx("span",{className:"text-bambu-gray",children:"—"})]}),Mn?a.jsxs("p",{className:"text-xs text-bambu-gray mt-2 truncate",title:Mn.print_name||Mn.filename,children:["Last: ",Mn.print_name||Mn.filename,Mn.completed_at&&a.jsxs("span",{className:"ml-1 text-bambu-gray/60",children:["• ",qg(Mn.completed_at,{month:"short",day:"numeric"})]})]}):a.jsx("p",{className:"text-xs text-bambu-gray mt-2",children:b("printers.readyToPrint")})]})})]})]}),Te.state!=="RUNNING"&&a.jsx(hke,{printerId:t.id})]}),Te.temperatures&&r==="expanded"&&(()=>{const gt=Te.temperatures.nozzle_heating||Te.temperatures.nozzle_2_heating||!1,jt=Te.temperatures.bed_heating||!1,pn=Te.temperatures.chamber_heating||!1,_t=t.nozzle_count===2||Te.temperatures.nozzle_2!==void 0,fn=Te.active_extruder===1?"L":"R";return a.jsxs("div",{className:"flex items-stretch gap-1.5",children:[a.jsxs("div",{className:"text-center px-2 py-1.5 bg-bambu-dark rounded-lg flex-1 flex flex-col justify-center items-center",children:[a.jsx(fP,{className:"w-3.5 h-3.5 mb-0.5",color:"text-orange-400",isHeating:gt}),Te.temperatures.nozzle_2!==void 0?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-[9px] text-bambu-gray",children:"L / R"}),a.jsxs("p",{className:"text-[11px] text-white",children:[Math.round(Te.temperatures.nozzle||0),"° / ",Math.round(Te.temperatures.nozzle_2||0),"°"]})]}):a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-[9px] text-bambu-gray",children:b("printers.temperatures.nozzle")}),a.jsxs("p",{className:"text-[11px] text-white",children:[Math.round(Te.temperatures.nozzle||0),"°C"]})]})]}),a.jsxs("div",{className:"text-center px-2 py-1.5 bg-bambu-dark rounded-lg flex-1 flex flex-col justify-center items-center",children:[a.jsx(fP,{className:"w-3.5 h-3.5 mb-0.5",color:"text-blue-400",isHeating:jt}),a.jsx("p",{className:"text-[9px] text-bambu-gray",children:b("printers.temperatures.bed")}),a.jsxs("p",{className:"text-[11px] text-white",children:[Math.round(Te.temperatures.bed||0),"°C"]})]}),Te.temperatures.chamber!==void 0&&a.jsxs("div",{className:"text-center px-2 py-1.5 bg-bambu-dark rounded-lg flex-1 flex flex-col justify-center items-center",children:[a.jsx(fP,{className:"w-3.5 h-3.5 mb-0.5",color:"text-green-400",isHeating:pn}),a.jsx("p",{className:"text-[9px] text-bambu-gray",children:b("printers.temperatures.chamber")}),a.jsxs("p",{className:"text-[11px] text-white",children:[Math.round(Te.temperatures.chamber||0),"°C"]})]}),_t&&a.jsxs("div",{className:"text-center px-2 py-1.5 bg-bambu-dark rounded-lg flex flex-col justify-center items-center",title:b("printers.activeNozzle",{nozzle:b(fn==="L"?"common.left":"common.right")}),children:[a.jsx("p",{className:`text-[11px] font-bold ${fn==="L"?"text-amber-400":"text-gray-500"}`,children:"L"}),a.jsx("p",{className:"text-[9px] text-bambu-gray",children:b("printers.temperatures.nozzle")}),a.jsx("p",{className:`text-[11px] font-bold ${fn==="R"?"text-amber-400":"text-gray-500"}`,children:"R"})]}),Te.nozzle_rack&&Te.nozzle_rack.length>0&&a.jsx(x8e,{slots:Te.nozzle_rack})]})})(),r==="expanded"&&(()=>{const gt=Te.state==="RUNNING",jt=Te.state==="PAUSED"||Te.state==="PAUSE",pn=gt||jt,_t=ii.isPending||Re.isPending||tt.isPending,fn=Te.cooling_fan_speed,Pr=Te.big_fan1_speed,jr=Te.big_fan2_speed;return a.jsxs("div",{className:"mt-3",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx("span",{className:"text-[10px] uppercase tracking-wider text-bambu-gray font-medium",children:b("printers.controls")}),a.jsx("div",{className:"flex-1 h-px bg-bambu-dark-tertiary/30"})]}),a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:`flex items-center gap-1 px-1.5 py-1 rounded ${fn&&fn>0?"bg-cyan-500/10":"bg-bambu-dark"}`,title:b("printers.fans.partCooling"),children:[a.jsx(PW,{className:`w-3.5 h-3.5 ${fn&&fn>0?"text-cyan-400":"text-bambu-gray/50"}`}),a.jsxs("span",{className:`text-[10px] ${fn&&fn>0?"text-cyan-400":"text-bambu-gray/50"}`,children:[fn??0,"%"]})]}),a.jsxs("div",{className:`flex items-center gap-1 px-1.5 py-1 rounded ${Pr&&Pr>0?"bg-blue-500/10":"bg-bambu-dark"}`,title:b("printers.fans.auxiliary"),children:[a.jsx($W,{className:`w-3.5 h-3.5 ${Pr&&Pr>0?"text-blue-400":"text-bambu-gray/50"}`}),a.jsxs("span",{className:`text-[10px] ${Pr&&Pr>0?"text-blue-400":"text-bambu-gray/50"}`,children:[Pr??0,"%"]})]}),a.jsxs("div",{className:`flex items-center gap-1 px-1.5 py-1 rounded ${jr&&jr>0?"bg-green-500/10":"bg-bambu-dark"}`,title:b("printers.fans.chamber"),children:[a.jsx(_ce,{className:`w-3.5 h-3.5 ${jr&&jr>0?"text-green-400":"text-bambu-gray/50"}`}),a.jsxs("span",{className:`text-[10px] ${jr&&jr>0?"text-green-400":"text-bambu-gray/50"}`,children:[jr??0,"%"]})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("button",{onClick:()=>W(!0),disabled:!pn||_t||!S("printers:control"),className:`
+ `})]})]})}function x8e({slots:t}){const{t:e}=hn(),n=t.filter(r=>r.nozzle_diameter||r.nozzle_type);return a.jsxs("div",{className:"text-center px-2.5 py-1.5 bg-bambu-dark rounded-lg flex-[2] flex flex-col justify-center",children:[a.jsx("p",{className:"text-[9px] text-bambu-gray mb-1",children:e("printers.nozzleRack")}),a.jsx("div",{className:"flex gap-[3px] justify-center",children:n.map((r,i)=>{const s=r.stat===1,o=Pee(r.filament_color);return a.jsx(b8e,{slot:r,index:i,children:a.jsx("div",{className:`w-7 h-7 rounded flex items-center justify-center cursor-default transition-colors border-b-2 ${s?"bg-green-950/35 border-green-400":"bg-bambu-dark-tertiary/40 border-bambu-dark-tertiary/40"}`,style:o?{backgroundColor:o}:void 0,children:a.jsx("span",{className:`text-[10px] font-semibold ${s?"text-green-400":"text-white"}`,style:o?{textShadow:"0 1px 3px rgba(0,0,0,0.9)"}:void 0,children:r.nozzle_diameter||"?"})})},r.id??i)})})]})}function F7({className:t}){return a.jsx("svg",{className:t,viewBox:"0 0 36 54",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M17.8131 0.00538C18.4463 -0.15091 20.3648 3.14642 20.8264 3.84781C25.4187 10.816 35.3089 26.9368 35.9383 34.8694C37.4182 53.5822 11.882 61.3357 2.53721 45.3789C-1.73471 38.0791 0.016 32.2049 3.178 25.0232C6.99221 16.3662 12.6411 7.90372 17.8131 0.00538ZM18.3738 7.24807L17.5881 7.48441C14.4452 12.9431 10.917 18.2341 8.19369 23.9368C4.6808 31.29 1.18317 38.5479 7.69403 45.5657C17.3058 55.9228 34.9847 46.8808 31.4604 32.8681C29.2558 24.0969 22.4207 15.2913 18.3776 7.24807H18.3738Z",fill:"#C3C2C1"})})}function y8e({className:t}){return a.jsxs("svg",{className:t,viewBox:"0 0 35 53",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M17.3165 0.0038C17.932 -0.14959 19.7971 3.08645 20.2458 3.77481C24.7103 10.6135 34.3251 26.4346 34.937 34.2198C36.3757 52.5848 11.5505 60.1942 2.46584 44.534C-1.68714 37.3735 0.0148 31.6085 3.08879 24.5603C6.79681 16.0605 12.2884 7.75907 17.3165 0.0038ZM17.8615 7.11561L17.0977 7.34755C14.0423 12.7048 10.6124 17.8974 7.96483 23.4941C4.54975 30.7107 1.14949 37.8337 7.47908 44.721C16.8233 54.8856 34.01 46.0117 30.5838 32.2595C28.4405 23.6512 21.7957 15.0093 17.8652 7.11561H17.8615Z",fill:"#C3C2C1"}),a.jsx("path",{d:"M5.03547 30.112C9.64453 30.4936 11.632 35.7985 16.4154 35.791C19.6339 35.7873 20.2161 33.2283 22.3853 31.6197C31.6776 24.7286 33.5835 37.4894 27.9881 44.4254C18.1878 56.5653 -1.16063 44.6013 5.03917 30.1158L5.03547 30.112Z",fill:"#1F8FEB"})]})}function v8e({className:t}){return a.jsxs("svg",{className:t,viewBox:"0 0 36 54",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M17.9625 4.48059L4.77216 26.3154L2.08228 40.2175L10.0224 50.8414H23.1594L33.3246 42.1693V30.2455L17.9625 4.48059Z",fill:"#1F8FEB"}),a.jsx("path",{d:"M17.7948 0.00538C18.4273 -0.15091 20.3438 3.14642 20.8048 3.84781C25.3921 10.816 35.2715 26.9368 35.9001 34.8694C37.3784 53.5822 11.8702 61.3357 2.53562 45.3789C-1.73163 38.0829 0.0134 32.2087 3.1757 25.027C6.98574 16.3662 12.6284 7.90372 17.7948 0.00538ZM18.3549 7.24807L17.57 7.48441C14.4306 12.9431 10.9063 18.2341 8.1859 23.9368C4.67686 31.29 1.18305 38.5479 7.68679 45.5657C17.2881 55.9228 34.9476 46.8808 31.4271 32.8681C29.2249 24.0969 22.3974 15.2913 18.3587 7.24807H18.3549Z",fill:"#C3C2C1"})]})}function w8e({className:t}){return a.jsxs("svg",{className:t,viewBox:"0 0 12 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M6 0.5C4.6 0.5 3.5 1.6 3.5 3V12.1C2.6 12.8 2 13.9 2 15C2 17.2 3.8 19 6 19C8.2 19 10 17.2 10 15C10 13.9 9.4 12.8 8.5 12.1V3C8.5 1.6 7.4 0.5 6 0.5Z",stroke:"#C3C2C1",strokeWidth:"1",fill:"none"}),a.jsx("circle",{cx:"6",cy:"15",r:"2.5",stroke:"#C3C2C1",strokeWidth:"1",fill:"none"})]})}function _8e({className:t}){return a.jsxs("svg",{className:t,viewBox:"0 0 12 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("rect",{x:"4.5",y:"8",width:"3",height:"4.5",fill:"#d4a017",rx:"0.5"}),a.jsx("circle",{cx:"6",cy:"15",r:"2",fill:"#d4a017"}),a.jsx("path",{d:"M6 0.5C4.6 0.5 3.5 1.6 3.5 3V12.1C2.6 12.8 2 13.9 2 15C2 17.2 3.8 19 6 19C8.2 19 10 17.2 10 15C10 13.9 9.4 12.8 8.5 12.1V3C8.5 1.6 7.4 0.5 6 0.5Z",stroke:"#C3C2C1",strokeWidth:"1",fill:"none"})]})}function S8e({className:t}){return a.jsxs("svg",{className:t,viewBox:"0 0 12 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("rect",{x:"4.5",y:"3",width:"3",height:"9.5",fill:"#c62828",rx:"0.5"}),a.jsx("circle",{cx:"6",cy:"15",r:"2",fill:"#c62828"}),a.jsx("path",{d:"M6 0.5C4.6 0.5 3.5 1.6 3.5 3V12.1C2.6 12.8 2 13.9 2 15C2 17.2 3.8 19 6 19C8.2 19 10 17.2 10 15C10 13.9 9.4 12.8 8.5 12.1V3C8.5 1.6 7.4 0.5 6 0.5Z",stroke:"#C3C2C1",strokeWidth:"1",fill:"none"})]})}function fP({className:t,color:e,isHeating:n}){const i={"text-orange-400":"#fb923c","text-blue-400":"#60a5fa","text-green-400":"#4ade80"}[e]||"#888",s=n?{filter:`drop-shadow(0 0 4px ${i}) drop-shadow(0 0 8px ${i})`}:{};return n?a.jsxs("svg",{className:t,style:s,viewBox:"0 0 12 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("rect",{x:"4.5",y:"3",width:"3",height:"9.5",fill:i,rx:"0.5"}),a.jsx("circle",{cx:"6",cy:"15",r:"2",fill:i}),a.jsx("path",{d:"M6 0.5C4.6 0.5 3.5 1.6 3.5 3V12.1C2.6 12.8 2 13.9 2 15C2 17.2 3.8 19 6 19C8.2 19 10 17.2 10 15C10 13.9 9.4 12.8 8.5 12.1V3C8.5 1.6 7.4 0.5 6 0.5Z",stroke:i,strokeWidth:"1",fill:"none"})]}):a.jsxs("svg",{className:t,viewBox:"0 0 12 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M6 0.5C4.6 0.5 3.5 1.6 3.5 3V12.1C2.6 12.8 2 13.9 2 15C2 17.2 3.8 19 6 19C8.2 19 10 17.2 10 15C10 13.9 9.4 12.8 8.5 12.1V3C8.5 1.6 7.4 0.5 6 0.5Z",stroke:i,strokeWidth:"1",fill:"none"}),a.jsx("circle",{cx:"6",cy:"15",r:"2.5",stroke:i,strokeWidth:"1",fill:"none"})]})}function I7({humidity:t,goodThreshold:e=40,fairThreshold:n=60,onClick:r,compact:i}){const s=typeof t=="string"?parseInt(t,10):t,o=typeof e=="number"?e:40,l=typeof n=="number"?n:60;let c,u;isNaN(s)?(c="#C3C2C1",u="Unknown"):s<=o?(c="#22a352",u="Good"):s<=l?(c="#d4a017",u="Fair"):(c="#c62828",u="Bad");let d;return isNaN(s)||s<=o?d=F7:s<=l?d=y8e:d=v8e,a.jsxs("button",{type:"button",onClick:r,className:`flex items-center gap-1 ${r?"cursor-pointer hover:opacity-80 transition-opacity":""}`,title:`Humidity: ${s}% - ${u}${r?" (click for history)":""}`,children:[a.jsx(d,{className:i?"w-2.5 h-3":"w-3 h-4"}),a.jsxs("span",{className:`font-medium tabular-nums ${i?"text-[10px]":"text-xs"}`,style:{color:c},children:[s,"%"]})]})}function z7({temp:t,goodThreshold:e=28,fairThreshold:n=35,onClick:r,compact:i}){const s=typeof e=="number"?e:28,o=typeof n=="number"?n:35;let l,c,u;return t<=s?(l="#22a352",c="Good",u=w8e):t<=o?(l="#d4a017",c="Fair",u=_8e):(l="#c62828",c="Bad",u=S8e),a.jsxs("button",{type:"button",onClick:r,className:`flex items-center gap-1 ${r?"cursor-pointer hover:opacity-80 transition-opacity":""}`,title:`Temperature: ${t}°C - ${c}${r?" (click for history)":""}`,children:[a.jsx(u,{className:i?"w-2.5 h-3":"w-3 h-4"}),a.jsxs("span",{className:`tabular-nums text-right ${i?"text-[10px] w-8":"w-12"}`,style:{color:l},children:[t,"°C"]})]})}function $d(t,e){const n=typeof t=="string"?parseInt(t,10):t,r=isNaN(n)?0:n,i=e===1,s=r>=128?r-128:r,o=String.fromCharCode(65+s);return i?`HT-${o}`:`AMS-${o}`}function mP(t){return t>50?"#00ae42":t>=15?"#f59e0b":"#ef4444"}function pP(t){return!t?.remaining_weight||!t?.filament_weight||t.filament_weight<=0?null:Math.min(100,Math.round(t.remaining_weight/t.filament_weight*100))}function N8e(t){const e=Math.floor(t/3600),n=Math.floor(t%3600/60);return e>0?`${e}h ${n}m`:`${n}m`}function M8e(t,e="system"){const n=new Date,r=new Date(n.getTime()+t*60*1e3),i=new Date;i.setHours(0,0,0,0);const s=new Date(r);s.setHours(0,0,0,0);const o={hour:"2-digit",minute:"2-digit"};e==="12h"?o.hour12=!0:e==="24h"&&(o.hour12=!1);const l=r.toLocaleTimeString([],o),c=Math.floor((s.getTime()-i.getTime())/(1e3*60*60*24));return c===0?l:c===1?`Tomorrow ${l}`:r.toLocaleDateString([],{weekday:"short"})+" "+l}function k8e(t){if(!t)return"/img/printers/default.png";const e=t.toLowerCase().replace(/\s+/g,"");return e.includes("x1e")?"/img/printers/x1e.png":e.includes("x1c")||e.includes("x1carbon")||e.includes("x1")?"/img/printers/x1c.png":e.includes("h2d")||e.includes("h2c")||e.includes("h2s")?"/img/printers/h2d.png":e.includes("p2s")||e.includes("p1s")?"/img/printers/p1s.png":e.includes("p1p")?"/img/printers/p1p.png":e.includes("a1mini")?"/img/printers/a1mini.png":e.includes("a1")?"/img/printers/a1.png":"/img/printers/default.png"}function E8e(t){return t>=-50?{labelKey:"printers.wifiSignal.excellent",color:"text-bambu-green",bars:4}:t>=-60?{labelKey:"printers.wifiSignal.good",color:"text-bambu-green",bars:3}:t>=-70?{labelKey:"printers.wifiSignal.fair",color:"text-yellow-400",bars:2}:t>=-80?{labelKey:"printers.wifiSignal.weak",color:"text-orange-400",bars:1}:{labelKey:"printers.wifiSignal.veryWeak",color:"text-red-400",bars:1}}function gP(t){return t?!!(t.tray_info_idx&&t.tray_info_idx.startsWith("GF")||t.tray_uuid&&t.tray_uuid!=="00000000000000000000000000000000"||t.tag_uid&&t.tag_uid!=="0000000000000000"):!1}function T8e({url:t,printName:e}){const{t:n}=hn(),[r,i]=_.useState(!1),[s,o]=_.useState(!1),[l,c]=_.useState(!1);return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:`w-20 h-20 flex-shrink-0 rounded-lg overflow-hidden bg-bambu-dark-tertiary flex items-center justify-center ${t&&r?"cursor-pointer":""}`,onClick:()=>t&&r&&c(!0),children:t&&!s?a.jsxs(a.Fragment,{children:[a.jsx("img",{src:t,alt:n("printers.printPreview"),className:`w-full h-full object-cover ${r?"block":"hidden"}`,onLoad:()=>i(!0),onError:()=>o(!0)}),!r&&a.jsx(zi,{className:"w-8 h-8 text-bambu-gray"})]}):a.jsx(zi,{className:"w-8 h-8 text-bambu-gray"})}),l&&t&&a.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-50 p-8",onClick:()=>c(!1),children:a.jsxs("div",{className:"relative max-w-2xl max-h-full",children:[a.jsx("img",{src:t,alt:n("printers.printPreview"),className:"max-w-full max-h-[80vh] rounded-lg shadow-2xl"}),e&&a.jsx("p",{className:"text-white text-center mt-4 text-lg",children:e})]})})]})}function C8e({printers:t}){const{t:e}=hn(),n=ln(),r=_.useMemo(()=>{let s=0,o=0,l=0,c=0;return t?.forEach(u=>{const d=n.getQueryData(["printerStatus",u.id]);d===void 0?c++:d.connected?d.state==="RUNNING"?s++:o++:l++}),{printing:s,idle:o,offline:l,loading:c,total:t?.length||0}},[t,n]),[,i]=_.useState(0);return _.useEffect(()=>{let s=!1;const o=n.getQueryCache().subscribe(()=>{s||(s=!0,requestAnimationFrame(()=>{i(l=>l+1),s=!1}))});return()=>o()},[n]),t?.length?a.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[r.printing>0&&a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-2 h-2 rounded-full bg-bambu-green animate-pulse"}),a.jsxs("span",{className:"text-bambu-gray",children:[a.jsx("span",{className:"text-white font-medium",children:r.printing})," ",e("printers.status.printing").toLowerCase()]})]}),r.idle>0&&a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-400"}),a.jsxs("span",{className:"text-bambu-gray",children:[a.jsx("span",{className:"text-white font-medium",children:r.idle})," ",e("printers.status.idle").toLowerCase()]})]}),r.offline>0&&a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-2 h-2 rounded-full bg-gray-400"}),a.jsxs("span",{className:"text-bambu-gray",children:[a.jsx("span",{className:"text-white font-medium",children:r.offline})," ",e("printers.status.offline").toLowerCase()]})]})]}):null}function U7(t,e){if(e)return e;switch(t){case"RUNNING":return"Printing";case"PAUSE":return"Paused";case"FINISH":return"Finished";case"FAILED":return"Failed";case"IDLE":return"Idle";default:return t?t.charAt(0)+t.slice(1).toLowerCase():"Idle"}}function B7({printer:t,hideIfDisconnected:e,maintenanceInfo:n,viewMode:r="expanded",cardSize:i=2,amsThresholds:s,spoolmanEnabled:o=!1,hasUnlinkedSpools:l=!1,linkedSpools:c,spoolmanUrl:u,timeFormat:d="system",cameraViewMode:h="window",onOpenEmbeddedCamera:p,checkPrinterFirmware:m=!0}){const{t:b}=hn(),x=ln(),y=Ac(),{showToast:v}=Tn(),{hasPermission:S}=Ir(),[N,T]=_.useState(!1),[M,C]=_.useState(!1),[E,R]=_.useState(!0),[A,P]=_.useState(!1),[U,F]=_.useState(!1),[H,D]=_.useState(!1),[$,G]=_.useState(!1),[I,K]=_.useState(!1),[Q,ae]=_.useState(!1),[B,W]=_.useState(!1),[J,ne]=_.useState(!1),[me,fe]=_.useState(!1),[he,De]=_.useState(!1),[se,Ne]=_.useState(null),[Fe,ce]=_.useState(null),[Ge,V]=_.useState(null),[Y,ue]=_.useState(!1),[q,re]=_.useState(null),[X,le]=_.useState(!1),[pe,ee]=_.useState(!1),[z,O]=_.useState(null),[Z,ge]=_.useState(!1),[Ae,_e]=_.useState(!1),{data:Te}=it({queryKey:["printerStatus",t.id],queryFn:()=>oe.getPrinterStatus(t.id),refetchInterval:3e4}),{data:Se}=it({queryKey:["firmwareUpdate",t.id],queryFn:()=>_1.checkPrinterUpdate(t.id),staleTime:300*1e3,refetchInterval:300*1e3,enabled:m&&S("firmware:read")}),$e=_.useMemo(()=>{const gt=new Set;if(Te?.ams)for(const jt of Te.ams)for(const pn of jt.tray||[])pn.tray_info_idx&>.add(pn.tray_info_idx);return Te?.vt_tray?.tray_info_idx&>.add(Te.vt_tray.tray_info_idx),Array.from(gt)},[Te?.ams,Te?.vt_tray]),{data:Qe}=it({queryKey:["filamentInfo",$e],queryFn:()=>oe.getFilamentInfo($e),enabled:$e.length>0,staleTime:300*1e3}),{data:Ue}=it({queryKey:["slotPresets",t.id],queryFn:()=>oe.getSlotPresets(t.id),staleTime:120*1e3}),[be,ke]=_.useState(null);_.useEffect(()=>{Te?.wifi_signal!=null&&ke(Te.wifi_signal)},[Te?.wifi_signal]);const Be=Te?.wifi_signal??be,Ee=_.useRef(void 0);_.useEffect(()=>{Te?.connected!==void 0&&(Ee.current=Te.connected)},[Te?.connected]);const Ve=Te?.connected??Ee.current,ve=_.useRef({});_.useEffect(()=>{Te?.ams_extruder_map&&Object.keys(Te.ams_extruder_map).length>0&&(ve.current=Te.ams_extruder_map)},[Te?.ams_extruder_map]);const nt=Te?.ams_extruder_map&&Object.keys(Te.ams_extruder_map).length>0?Te.ams_extruder_map:ve.current,Me=_.useRef([]);_.useEffect(()=>{Te?.ams&&Te.ams.length>0&&(Me.current=Te.ams)},[Te?.ams]);const Ke=Te?.ams&&Te.ams.length>0?Te.ams:Me.current,je=_.useRef(255),Pe=Te?.tray_now;Pe!==void 0&&Pe!==255&&(je.current=Pe);const ye=Pe===void 0||Pe===255?je.current:Pe,{data:Ye}=it({queryKey:["smartPlugByPrinter",t.id],queryFn:()=>oe.getSmartPlugByPrinter(t.id)}),{data:yt}=it({queryKey:["scriptPlugsByPrinter",t.id],queryFn:()=>oe.getScriptPlugsByPrinter(t.id)}),{data:ot}=it({queryKey:["smartPlugStatus",Ye?.id],queryFn:()=>Ye?oe.getSmartPlugStatus(Ye.id):null,enabled:!!Ye,refetchInterval:1e4}),{data:$t}=it({queryKey:["queue",t.id,"pending"],queryFn:()=>oe.getQueue(t.id,"pending")}),Ft=$t?.length||0,{data:ze}=it({queryKey:["queue",t.id,"printing"],queryFn:()=>oe.getQueue(t.id,"printing"),enabled:Te?.state==="RUNNING"}),{data:xt}=it({queryKey:["currentPrintUser",t.id],queryFn:()=>oe.getCurrentPrintUser(t.id),enabled:Te?.state==="RUNNING"}),Wt=ze?.[0]?.created_by_username||xt?.username,{data:Yt}=it({queryKey:["archives",t.id,"last"],queryFn:()=>oe.getArchives(t.id,1,0),enabled:Te?.connected&&Te?.state!=="RUNNING"}),Mn=Yt?.[0],bn=e&&Ve===!1,er=pt({mutationFn:gt=>oe.deletePrinter(t.id,gt.deleteArchives),onSuccess:()=>{x.invalidateQueries({queryKey:["printers"]}),x.invalidateQueries({queryKey:["archives"]}),x.invalidateQueries({queryKey:["maintenanceOverview"]})},onError:gt=>v(gt.message||b("printers.toast.failedToDelete"),"error")}),lr=pt({mutationFn:()=>oe.connectPrinter(t.id),onSuccess:()=>{x.invalidateQueries({queryKey:["printerStatus",t.id]})}}),Cn=pt({mutationFn:gt=>Ye?oe.controlSmartPlug(Ye.id,gt):Promise.reject("No plug"),onSuccess:()=>{x.invalidateQueries({queryKey:["smartPlugStatus",Ye?.id]})}}),An=pt({mutationFn:gt=>Ye?oe.updateSmartPlug(Ye.id,{auto_off:gt}):Promise.reject("No plug"),onSuccess:()=>{x.invalidateQueries({queryKey:["smartPlugByPrinter",t.id]}),x.invalidateQueries({queryKey:["smart-plugs"]})}}),di=pt({mutationFn:gt=>oe.controlSmartPlug(gt,"on"),onSuccess:()=>{v(b("printers.toast.scriptTriggered"))},onError:gt=>v(gt.message||b("printers.toast.failedToRunScript"),"error")}),ii=pt({mutationFn:()=>oe.stopPrint(t.id),onSuccess:()=>{v(b("printers.toast.printStopped")),x.invalidateQueries({queryKey:["printerStatus",t.id]})},onError:gt=>v(gt.message||b("printers.toast.failedToStopPrint"),"error")}),Re=pt({mutationFn:()=>oe.pausePrint(t.id),onSuccess:()=>{v(b("printers.toast.printPaused")),x.invalidateQueries({queryKey:["printerStatus",t.id]})},onError:gt=>v(gt.message||b("printers.toast.failedToPausePrint"),"error")}),tt=pt({mutationFn:()=>oe.resumePrint(t.id),onSuccess:()=>{v(b("printers.toast.printResumed")),x.invalidateQueries({queryKey:["printerStatus",t.id]})},onError:gt=>v(gt.message||b("printers.toast.failedToResumePrint"),"error")}),ut=pt({mutationFn:gt=>oe.setChamberLight(t.id,gt),onMutate:async gt=>{await x.cancelQueries({queryKey:["printerStatus",t.id]});const jt=x.getQueryData(["printerStatus",t.id]);return x.setQueryData(["printerStatus",t.id],pn=>({...pn,chamber_light:gt})),{previousStatus:jt}},onSuccess:(gt,jt)=>{v(`Chamber light ${jt?"on":"off"}`)},onError:(gt,jt,pn)=>{pn?.previousStatus&&x.setQueryData(["printerStatus",t.id],pn.previousStatus),v(gt.message||b("printers.toast.failedToControlChamberLight"),"error")}}),dt=pt({mutationFn:gt=>oe.updatePrinter(t.id,{plate_detection_enabled:gt}),onSuccess:()=>{x.invalidateQueries({queryKey:["printers"]}),v(dt.variables?b("printers.toast.plateCheckEnabled"):b("printers.toast.plateCheckDisabled"))},onError:gt=>v(gt.message||b("printers.toast.failedToUpdateSetting"),"error")}),ct=(Te?.state==="RUNNING"||Te?.state==="PAUSE"||Te?.state==="PAUSED")&&(Te?.printable_objects_count??0)>=2,{data:Dt}=it({queryKey:["printableObjects",t.id],queryFn:()=>oe.getPrintableObjects(t.id),enabled:he||ct,refetchInterval:he?5e3:ct?3e4:!1}),[de,Le]=_.useState(null),qe=_.useRef(!1),we=_.useRef(null),Ie=_.useRef(!1),rt=pt({mutationFn:({amsId:gt,slotId:jt})=>oe.refreshAmsSlot(t.id,gt,jt),onMutate:({amsId:gt,slotId:jt})=>{we.current&&clearTimeout(we.current),qe.current=!1,Ie.current=!1,Le({amsId:gt,slotId:jt}),setTimeout(()=>{Ie.current=!0},2e3),we.current=setTimeout(()=>{Le(null)},3e4)},onSuccess:gt=>{v(gt.message||b("printers.toast.rfidRereadInitiated"))},onError:gt=>{v(gt.message||b("printers.toast.failedToRereadRfid"),"error"),we.current&&clearTimeout(we.current),Le(null)}}),[Ze,Ct]=_.useState(null),[At,zt]=_.useState(null),Rt=async()=>{try{const gt=await oe.getPlateReferences(t.id);Ct(gt)}catch{}},Et=()=>{dt.mutate(!t.plate_detection_enabled)},dn=async()=>{le(!0),re(null);const gt=Te?.chamber_light===!1;_e(gt),gt&&(await oe.setChamberLight(t.id,!0),await new Promise(jt=>setTimeout(jt,2500)));try{const jt=await oe.checkPlateEmpty(t.id,{includeDebugImage:!0});re(jt),Rt()}catch(jt){v(jt instanceof Error?jt.message:b("printers.toast.failedToCheckPlate"),"error"),gt&&(await oe.setChamberLight(t.id,!1),_e(!1))}finally{le(!1)}},Ut=_.useCallback(async()=>{re(null),Ae&&(await oe.setChamberLight(t.id,!1),_e(!1))},[Ae,t.id]),mn=async gt=>{ee(!0);try{const jt=await oe.calibratePlateDetection(t.id,{label:gt});if(jt.success){v(jt.message||b("printers.toast.calibrationSaved"),"success"),Rt();const pn=await oe.checkPlateEmpty(t.id,{includeDebugImage:!0});re(pn)}else v(jt.message||b("printers.toast.calibrationFailed"),"error")}catch(jt){v(jt instanceof Error?jt.message:b("printers.toast.calibrationFailed"),"error")}finally{ee(!1)}},Nn=async(gt,jt)=>{try{await oe.updatePlateReferenceLabel(t.id,gt,jt),zt(null),Rt()}catch(pn){v(pn instanceof Error?pn.message:b("printers.toast.failedToUpdateLabel"),"error")}},jn=async gt=>{try{await oe.deletePlateReference(t.id,gt),v(b("printers.toast.referenceDeleted"),"success"),Rt();const jt=await oe.checkPlateEmpty(t.id,{includeDebugImage:!0});re(jt)}catch(jt){v(jt instanceof Error?jt.message:b("printers.toast.failedToDeleteReference"),"error")}},Kt=async()=>{if(z){ge(!0);try{await oe.updatePrinter(t.id,{plate_detection_roi:z}),v(b("printers.toast.detectionAreaSaved"),"success"),O(null);const gt=await oe.checkPlateEmpty(t.id,{includeDebugImage:!0});re(gt)}catch(gt){v(gt instanceof Error?gt.message:b("printers.toast.failedToSaveDetectionArea"),"error")}finally{ge(!1)}}};_.useEffect(()=>{const gt=jt=>{jt.key==="Escape"&&q&&Ut()};return window.addEventListener("keydown",gt),()=>window.removeEventListener("keydown",gt)},[q,Ut]);const Zt=_.useRef(null);_.useEffect(()=>{if(!de)return;const gt=Te?.ams_status_main??0;return gt!==0&&(qe.current=!0,Zt.current&&(clearTimeout(Zt.current),Zt.current=null)),qe.current&>===0&&(Ie.current?(we.current&&clearTimeout(we.current),Le(null)):Zt.current||(Zt.current=setTimeout(()=>{we.current&&clearTimeout(we.current),Le(null)},2e3))),()=>{Zt.current&&clearTimeout(Zt.current)}},[Te?.ams_status_main,de]);const[Jt,cn]=_.useState(null);if(bn)return null;const Hr=()=>{switch(i){case 1:return"w-10 h-10";case 2:return"w-14 h-14";case 3:return"w-16 h-16";case 4:return"w-20 h-20";default:return"w-14 h-14"}},Yn=()=>{switch(i){case 1:return"text-base truncate";case 2:return"text-lg";case 3:return"text-xl";case 4:return"text-2xl";default:return"text-lg"}},ai=()=>{switch(i){case 1:return"mb-2";case 2:return"mb-4";case 3:return"mb-5";case 4:return"mb-6";default:return"mb-4"}};return a.jsxs(Mt,{className:"relative",children:[a.jsxs(kt,{className:i>=3?"p-5":"",children:[a.jsxs("div",{className:ai(),children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[a.jsx("img",{src:k8e(t.model),alt:t.model||b("common.printer"),className:`object-contain rounded-lg bg-bambu-dark flex-shrink-0 ${Hr()}`}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("h3",{className:`font-semibold text-white ${Yn()}`,children:t.name}),r==="compact"&&a.jsx("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${Te?.connected?"bg-status-ok":"bg-status-error"}`,title:Te?.connected?b("printers.connection.connected"):b("printers.connection.offline")})]}),a.jsxs("p",{className:"text-sm text-bambu-gray",children:[t.model||"Unknown Model",r==="expanded"&&Te?.nozzles&&Te.nozzles[0]?.nozzle_diameter&&a.jsxs("span",{className:"ml-1.5 text-bambu-gray",title:Te.nozzles[0].nozzle_type||"Nozzle",children:["• ",Te.nozzles[0].nozzle_diameter,"mm"]}),r==="expanded"&&n&&n.total_print_hours>0&&a.jsxs("span",{className:"ml-2 text-bambu-gray",children:[a.jsx(nr,{className:"w-3 h-3 inline-block mr-1"}),Math.round(n.total_print_hours),"h"]})]})]})]}),a.jsxs("div",{className:"relative flex-shrink-0",children:[a.jsx(Ce,{variant:"ghost",size:"sm",onClick:()=>T(!N),children:a.jsx(hh,{className:"w-4 h-4"})}),N&&a.jsxs("div",{className:"absolute right-0 mt-2 w-48 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-lg z-20",children:[a.jsxs("button",{className:`w-full px-4 py-2 text-left text-sm flex items-center gap-2 ${S("printers:update")?"hover:bg-bambu-dark-tertiary":"opacity-50 cursor-not-allowed"}`,onClick:()=>{S("printers:update")&&(P(!0),T(!1))},title:S("printers:update")?void 0:b("printers.permission.noEdit"),children:[a.jsx(ea,{className:"w-4 h-4"}),b("common.edit")]}),a.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm hover:bg-bambu-dark-tertiary flex items-center gap-2",onClick:()=>{lr.mutate(),T(!1)},children:[a.jsx(Or,{className:"w-4 h-4"}),b("printers.reconnect")]}),a.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm hover:bg-bambu-dark-tertiary flex items-center gap-2",onClick:()=>{D(!0),T(!1)},children:[a.jsx(BW,{className:"w-4 h-4"}),b("printers.mqttDebug")]}),a.jsxs("button",{className:`w-full px-4 py-2 text-left text-sm flex items-center gap-2 ${S("printers:delete")?"text-red-400 hover:bg-bambu-dark-tertiary":"text-red-400/50 cursor-not-allowed"}`,onClick:()=>{S("printers:delete")&&(C(!0),T(!1))},title:S("printers:delete")?void 0:b("printers.permission.noDelete"),children:[a.jsx(on,{className:"w-4 h-4"}),b("common.delete")]})]})]})]}),r==="expanded"&&a.jsxs("div",{className:"flex flex-wrap items-center gap-2 mt-2",children:[a.jsxs("span",{className:`flex items-center gap-1.5 px-2 py-1 rounded-full text-xs ${Te?.connected?"bg-status-ok/20 text-status-ok":"bg-status-error/20 text-status-error"}`,children:[Te?.connected?a.jsx(Hy,{className:"w-3 h-3"}):a.jsx(VR,{className:"w-3 h-3"}),Te?.connected?b("printers.connection.connected"):b("printers.connection.offline")]}),Te?.connected&&Be!=null&&a.jsxs("span",{className:`flex items-center gap-1 px-2 py-1 rounded-full text-xs ${Be>=-50||Be>=-60?"bg-status-ok/20 text-status-ok":Be>=-70?"bg-status-warning/20 text-status-warning":Be>=-80?"bg-orange-500/20 text-orange-600":"bg-status-error/20 text-status-error"}`,title:`WiFi: ${Be} dBm - ${b(E8e(Be).labelKey)}`,children:[a.jsx(Ghe,{className:"w-3 h-3"}),Be,"dBm"]}),Te?.connected&&(()=>{const gt=Te.hms_errors?lke(Te.hms_errors):[];return a.jsxs("button",{onClick:()=>ae(!0),className:`flex items-center gap-1 px-2 py-1 rounded-full text-xs cursor-pointer hover:opacity-80 transition-opacity ${gt.length>0?gt.some(jt=>jt.severity<=2)?"bg-status-error/20 text-status-error":"bg-status-warning/20 text-status-warning":"bg-status-ok/20 text-status-ok"}`,title:b("printers.clickToViewHmsErrors"),children:[a.jsx(En,{className:"w-3 h-3"}),gt.length>0?gt.length:"OK"]})})(),n&&a.jsxs("button",{onClick:()=>y("/maintenance"),className:`flex items-center gap-1 px-2 py-1 rounded-full text-xs cursor-pointer hover:opacity-80 transition-opacity ${n.due_count>0?"bg-status-error/20 text-status-error":n.warning_count>0?"bg-status-warning/20 text-status-warning":"bg-status-ok/20 text-status-ok"}`,title:n.due_count>0||n.warning_count>0?`${n.due_count>0?`${n.due_count} maintenance due`:""}${n.due_count>0&&n.warning_count>0?", ":""}${n.warning_count>0?`${n.warning_count} due soon`:""} - Click to view`:b("printers.maintenanceUpToDate"),children:[a.jsx(um,{className:"w-3 h-3"}),n.due_count>0||n.warning_count>0?n.due_count+n.warning_count:"OK"]}),Ft>0&&a.jsxs("button",{onClick:()=>y("/queue"),className:"flex items-center gap-1 px-2 py-1 rounded-full text-xs bg-purple-500/20 text-purple-400 hover:opacity-80 transition-opacity",title:b("printers.queue.inQueue",{count:Ft}),children:[a.jsx(es,{className:"w-3 h-3"}),Ft]}),Se?.current_version&&Se?.latest_version&&a.jsxs("button",{onClick:()=>ue(!0),className:`flex items-center gap-1 px-2 py-1 rounded-full text-xs hover:opacity-80 transition-opacity ${Se.update_available?"bg-orange-500/20 text-orange-400":"bg-status-ok/20 text-status-ok"}`,title:Se.update_available?b("printers.firmwareUpdateAvailable",{current:Se.current_version,latest:Se.latest_version}):b("printers.firmwareUpToDate",{version:Se.current_version}),children:[Se.update_available?a.jsx(Si,{className:"w-3 h-3"}):a.jsx(fr,{className:"w-3 h-3"}),Se.current_version]})]})]}),M&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:a.jsx(Mt,{className:"w-full max-w-md mx-4",children:a.jsxs(kt,{children:[a.jsxs("div",{className:"flex items-start gap-3 mb-4",children:[a.jsx("div",{className:"p-2 rounded-full bg-red-500/20",children:a.jsx(En,{className:"w-5 h-5 text-red-400"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold text-white",children:b("printers.confirm.deleteTitle")}),a.jsx("p",{className:"text-sm text-bambu-gray mt-1",children:b("printers.confirm.deleteMessage",{name:t.name})})]})]}),a.jsx("div",{className:"bg-bambu-dark rounded-lg p-3 mb-4",children:a.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:E,onChange:gt=>R(gt.target.checked),className:"mt-0.5 w-4 h-4 rounded border-bambu-gray bg-bambu-dark-secondary text-bambu-green focus:ring-bambu-green focus:ring-offset-0"}),a.jsxs("div",{children:[a.jsx("span",{className:"text-sm text-white",children:b("printers.deleteArchives")}),a.jsx("p",{className:"text-xs text-bambu-gray mt-0.5",children:b(E?"printers.confirm.deleteArchivesNote":"printers.confirm.keepArchivesNote")})]})]})}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx(Ce,{variant:"secondary",onClick:()=>{C(!1),R(!0)},children:b("common.cancel")}),a.jsx(Ce,{variant:"danger",onClick:()=>{er.mutate({deleteArchives:E}),C(!1),R(!0)},children:"Delete"})]})]})})}),Te?.connected&&a.jsxs(a.Fragment,{children:[r==="compact"?a.jsx("div",{className:"mt-2",children:Te.state==="RUNNING"?a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"flex-1 bg-bambu-dark-tertiary rounded-full h-1.5",children:a.jsx("div",{className:"bg-bambu-green h-1.5 rounded-full transition-all",style:{width:`${Te.progress||0}%`}})}),a.jsxs("span",{className:"text-xs text-white",children:[Math.round(Te.progress||0),"%"]})]}):a.jsx("p",{className:"text-xs text-bambu-gray",children:U7(Te.state,Te.stg_cur_name)})}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"mb-4 p-3 bg-bambu-dark rounded-lg relative",children:[a.jsxs("button",{onClick:()=>De(!0),disabled:!(Te.state==="RUNNING"||Te.state==="PAUSE"||Te.state==="PAUSED")||(Te.printable_objects_count??0)<2||!S("printers:control"),className:`absolute top-2 right-2 p-1.5 rounded transition-colors z-10 ${(Te.state==="RUNNING"||Te.state==="PAUSE"||Te.state==="PAUSED")&&(Te.printable_objects_count??0)>=2&&S("printers:control")?"text-bambu-gray hover:text-white hover:bg-white/10":"text-bambu-gray/30 cursor-not-allowed"}`,title:S("printers:control")?Te.state==="RUNNING"||Te.state==="PAUSE"||Te.state==="PAUSED"?(Te.printable_objects_count??0)>=2?b("printers.skipObjects.tooltip"):b("printers.skipObjects.requiresMultiple"):b("printers.skipObjects.onlyWhilePrinting"):b("printers.permission.noControl"),children:[a.jsx(LM,{className:"w-4 h-4"}),Dt&&Dt.skipped_count>0&&a.jsx("span",{className:"absolute -top-1 -right-1 min-w-[16px] h-4 px-1 flex items-center justify-center text-[10px] font-bold bg-red-500 text-white rounded-full",children:Dt.skipped_count})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx(T8e,{url:Te.state==="RUNNING"?Te.cover_url:null,printName:Te.state==="RUNNING"&&(Te.subtask_name||Te.current_print)||void 0}),a.jsx("div",{className:"flex-1 min-w-0",children:Te.current_print&&Te.state==="RUNNING"?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-sm text-bambu-gray mb-1",children:Te.stg_cur_name||"Printing"}),a.jsx("p",{className:"text-white text-sm mb-2 truncate",children:Te.subtask_name||Te.current_print}),a.jsxs("div",{className:"flex items-center justify-between text-sm",children:[a.jsx("div",{className:"flex-1 bg-bambu-dark-tertiary rounded-full h-2 mr-3",children:a.jsx("div",{className:"bg-bambu-green h-2 rounded-full transition-all",style:{width:`${Te.progress||0}%`}})}),a.jsxs("span",{className:"text-white",children:[Math.round(Te.progress||0),"%"]})]}),a.jsxs("div",{className:"flex items-center gap-3 mt-2 text-xs text-bambu-gray",children:[Te.remaining_time!=null&&Te.remaining_time>0&&a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(nr,{className:"w-3 h-3"}),N8e(Te.remaining_time*60)]}),a.jsxs("span",{className:"text-bambu-green font-medium",title:b("printers.estimatedCompletion"),children:["ETA ",M8e(Te.remaining_time,d)]})]}),Te.layer_num!=null&&Te.total_layers!=null&&Te.total_layers>0&&a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(es,{className:"w-3 h-3"}),Te.layer_num,"/",Te.total_layers]}),Wt&&a.jsxs("span",{className:"flex items-center gap-1",title:`Started by ${Wt}`,children:[a.jsx($u,{className:"w-3 h-3"}),Wt]})]})]}):a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-sm text-bambu-gray mb-1",children:b("printers.sort.status")}),a.jsx("p",{className:"text-white text-sm mb-2",children:U7(Te.state,Te.stg_cur_name)}),a.jsxs("div",{className:"flex items-center justify-between text-sm",children:[a.jsx("div",{className:"flex-1 bg-bambu-dark-tertiary rounded-full h-2 mr-3",children:a.jsx("div",{className:"bg-bambu-dark-tertiary h-2 rounded-full"})}),a.jsx("span",{className:"text-bambu-gray",children:"—"})]}),Mn?a.jsxs("p",{className:"text-xs text-bambu-gray mt-2 truncate",title:Mn.print_name||Mn.filename,children:["Last: ",Mn.print_name||Mn.filename,Mn.completed_at&&a.jsxs("span",{className:"ml-1 text-bambu-gray/60",children:["• ",qg(Mn.completed_at,{month:"short",day:"numeric"})]})]}):a.jsx("p",{className:"text-xs text-bambu-gray mt-2",children:b("printers.readyToPrint")})]})})]})]}),Te.state!=="RUNNING"&&a.jsx(hke,{printerId:t.id})]}),Te.temperatures&&r==="expanded"&&(()=>{const gt=Te.temperatures.nozzle_heating||Te.temperatures.nozzle_2_heating||!1,jt=Te.temperatures.bed_heating||!1,pn=Te.temperatures.chamber_heating||!1,_t=t.nozzle_count===2||Te.temperatures.nozzle_2!==void 0,fn=Te.active_extruder===1?"L":"R";return a.jsxs("div",{className:"flex items-stretch gap-1.5",children:[a.jsxs("div",{className:"text-center px-2 py-1.5 bg-bambu-dark rounded-lg flex-1 flex flex-col justify-center items-center",children:[a.jsx(fP,{className:"w-3.5 h-3.5 mb-0.5",color:"text-orange-400",isHeating:gt}),Te.temperatures.nozzle_2!==void 0?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-[9px] text-bambu-gray",children:"L / R"}),a.jsxs("p",{className:"text-[11px] text-white",children:[Math.round(Te.temperatures.nozzle||0),"° / ",Math.round(Te.temperatures.nozzle_2||0),"°"]})]}):a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-[9px] text-bambu-gray",children:b("printers.temperatures.nozzle")}),a.jsxs("p",{className:"text-[11px] text-white",children:[Math.round(Te.temperatures.nozzle||0),"°C"]})]})]}),a.jsxs("div",{className:"text-center px-2 py-1.5 bg-bambu-dark rounded-lg flex-1 flex flex-col justify-center items-center",children:[a.jsx(fP,{className:"w-3.5 h-3.5 mb-0.5",color:"text-blue-400",isHeating:jt}),a.jsx("p",{className:"text-[9px] text-bambu-gray",children:b("printers.temperatures.bed")}),a.jsxs("p",{className:"text-[11px] text-white",children:[Math.round(Te.temperatures.bed||0),"°C"]})]}),Te.temperatures.chamber!==void 0&&a.jsxs("div",{className:"text-center px-2 py-1.5 bg-bambu-dark rounded-lg flex-1 flex flex-col justify-center items-center",children:[a.jsx(fP,{className:"w-3.5 h-3.5 mb-0.5",color:"text-green-400",isHeating:pn}),a.jsx("p",{className:"text-[9px] text-bambu-gray",children:b("printers.temperatures.chamber")}),a.jsxs("p",{className:"text-[11px] text-white",children:[Math.round(Te.temperatures.chamber||0),"°C"]})]}),_t&&a.jsxs("div",{className:"text-center px-2 py-1.5 bg-bambu-dark rounded-lg flex flex-col justify-center items-center",title:b("printers.activeNozzle",{nozzle:b(fn==="L"?"common.left":"common.right")}),children:[a.jsx("p",{className:`text-[11px] font-bold ${fn==="L"?"text-amber-400":"text-gray-500"}`,children:"L"}),a.jsx("p",{className:"text-[9px] text-bambu-gray",children:b("printers.temperatures.nozzle")}),a.jsx("p",{className:`text-[11px] font-bold ${fn==="R"?"text-amber-400":"text-gray-500"}`,children:"R"})]}),Te.nozzle_rack&&Te.nozzle_rack.length>0&&a.jsx(x8e,{slots:Te.nozzle_rack})]})})(),r==="expanded"&&(()=>{const gt=Te.state==="RUNNING",jt=Te.state==="PAUSED"||Te.state==="PAUSE",pn=gt||jt,_t=ii.isPending||Re.isPending||tt.isPending,fn=Te.cooling_fan_speed,Pr=Te.big_fan1_speed,jr=Te.big_fan2_speed;return a.jsxs("div",{className:"mt-3",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx("span",{className:"text-[10px] uppercase tracking-wider text-bambu-gray font-medium",children:b("printers.controls")}),a.jsx("div",{className:"flex-1 h-px bg-bambu-dark-tertiary/30"})]}),a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:`flex items-center gap-1 px-1.5 py-1 rounded ${fn&&fn>0?"bg-cyan-500/10":"bg-bambu-dark"}`,title:b("printers.fans.partCooling"),children:[a.jsx(PW,{className:`w-3.5 h-3.5 ${fn&&fn>0?"text-cyan-400":"text-bambu-gray/50"}`}),a.jsxs("span",{className:`text-[10px] ${fn&&fn>0?"text-cyan-400":"text-bambu-gray/50"}`,children:[fn??0,"%"]})]}),a.jsxs("div",{className:`flex items-center gap-1 px-1.5 py-1 rounded ${Pr&&Pr>0?"bg-blue-500/10":"bg-bambu-dark"}`,title:b("printers.fans.auxiliary"),children:[a.jsx($W,{className:`w-3.5 h-3.5 ${Pr&&Pr>0?"text-blue-400":"text-bambu-gray/50"}`}),a.jsxs("span",{className:`text-[10px] ${Pr&&Pr>0?"text-blue-400":"text-bambu-gray/50"}`,children:[Pr??0,"%"]})]}),a.jsxs("div",{className:`flex items-center gap-1 px-1.5 py-1 rounded ${jr&&jr>0?"bg-green-500/10":"bg-bambu-dark"}`,title:b("printers.fans.chamber"),children:[a.jsx(_ce,{className:`w-3.5 h-3.5 ${jr&&jr>0?"text-green-400":"text-bambu-gray/50"}`}),a.jsxs("span",{className:`text-[10px] ${jr&&jr>0?"text-green-400":"text-bambu-gray/50"}`,children:[jr??0,"%"]})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("button",{onClick:()=>W(!0),disabled:!pn||_t||!S("printers:control"),className:`
flex items-center justify-center gap-1 px-3 py-1.5 rounded-lg text-xs font-medium
transition-colors
${pn&&S("printers:control")?"bg-red-500/20 text-red-400 hover:bg-red-500/30":"bg-bambu-dark text-bambu-gray/50 cursor-not-allowed"}
diff --git a/static/index.html b/static/index.html
index 00363d507..8589c6f1d 100644
--- a/static/index.html
+++ b/static/index.html
@@ -23,7 +23,7 @@
-
+