From c4462637748133b8cd39a788b973299948c03232 Mon Sep 17 00:00:00 2001 From: maziggy Date: Wed, 30 Sep 2026 13:08:14 +0200 Subject: [PATCH] Post work PR #3192 --- CHANGELOG.md | 1 + ...eviewModal-DWRBCqB-.js => ImagePreviewModal-yOK-BUmg.js} | 2 +- ...PreviewModal-CTzoG93b.js => PdfPreviewModal-B_LYIkkC.js} | 4 ++-- ...odal-BcNF67Td.js => SpreadsheetPreviewModal-BEobv_FV.js} | 2 +- static/assets/{index-DC8Fhl-1.js => index-Bh3F0vXZ.js} | 6 +++--- static/assets/{index-V2lrrDnm.css => index-CT9srI0L.css} | 2 +- static/assets/{pdf-C9LrqMbI.js => pdf-Dh_3UNyL.js} | 2 +- static/index.html | 4 ++-- 8 files changed, 12 insertions(+), 11 deletions(-) rename static/assets/{ImagePreviewModal-DWRBCqB-.js => ImagePreviewModal-yOK-BUmg.js} (98%) rename static/assets/{PdfPreviewModal-CTzoG93b.js => PdfPreviewModal-B_LYIkkC.js} (96%) rename static/assets/{SpreadsheetPreviewModal-BcNF67Td.js => SpreadsheetPreviewModal-BEobv_FV.js} (97%) rename static/assets/{index-DC8Fhl-1.js => index-Bh3F0vXZ.js} (97%) rename static/assets/{index-V2lrrDnm.css => index-CT9srI0L.css} (99%) rename static/assets/{pdf-C9LrqMbI.js => pdf-Dh_3UNyL.js} (99%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 650902e1a..4e02fdb65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,6 +56,7 @@ All notable changes to Bambuddy will be documented in this file. - **The frontend build no longer warns about `path` and `crypto` being externalized for the STEP previewer (#2976)** — `occt-import-js`, the Emscripten build behind STEP previews, requires both modules, but only inside its `ENVIRONMENT_IS_NODE` branches; in the browser it loads its `.wasm` from the URL the preview worker passes and draws randomness from `crypto.getRandomValues`. Vite still externalized both and printed two warnings on every build. `vite.config.ts` now drops exactly those two warnings for that one package through `build.rolldownOptions.onLog`, so an externalization anywhere else, or of any other module, still shows. ### Fixed +- **Settings tabs keep their icons when a label is long (#3191, reported and contributed by @Thomansky in #3192)** — In German the Notifications tab lost its bell: "Benachrichtigungen" plus the provider count didn't fit the tab list on wide screens, and the icon was squeezed to nothing instead of the word. The tab list is a little wider now, and tab icons, counts and status dots always keep their size, so a long label can only wrap. "Virtueller Drucker" also fits on one line again. - **"Print labels…" starts from the spools you ticked (#2980, reported by @apizz)** — With spools ticked in the inventory list, the header's **Print labels…** button still opened the label picker with every visible spool selected, so you had to find your spools again. It now starts from the ticked spools, and from every visible spool only when none is ticked. - **In Spoolman mode, a new Bambu Lab roll links to a filament of its own product line (#2907, reported and contributed by @ojimpo in #2944)** — Bambuddy matched a new roll to a Spoolman filament by material and colour alone. Several product lines share a colour, so a PLA Matte Charcoal roll was linked to the PLA Basic "Black" filament, took its name and density, and showed up as Black. The same happened to other lines: PLA Tough took PLA Basic's library entry, PLA Silk White took "Aero White", and PETG HF took plain PETG's. The match now also checks the product line the AMS reports, both among your existing filaments and in the Spoolman filament library, and each roll takes its own library entry and density. New filaments are named for the line ("PLA Matte"), including ones taken from the library, and the colour name ("Charcoal") is stored on the spool. Spoolman mode now shows the same subtype and colour name as the built-in inventory. When no filament or library entry fits the line, Bambuddy creates one from what the AMS reports instead of taking the first one with the same colour. Filaments that earlier versions named after a colour ("Black") are still reused, so existing installs don't get duplicates. A filament you renamed yourself in Spoolman is no longer reused for new rolls. - **LDAP group mapping finds groups on lldap and OpenLDAP (#3197, reported by @TOFM)** — Every login from an lldap directory got the Default Group, even for a user who was a member of a mapped group. Bambuddy read membership from the user's `memberOf` attribute but asked the server for "all attributes". lldap, and OpenLDAP's memberof overlay, leave `memberOf` out of "all attributes" and only return it when it is asked for by name. Bambuddy now asks for it by name wherever the directory's schema has it. It also asks the groups themselves which `groupOfNames` and `groupOfUniqueNames` entries list the user, searching from the directory root, because groups usually sit beside the users (`ou=groups` next to `ou=people`) rather than under the search base. That covers OpenLDAP without the memberof overlay, where there is no `memberOf` at all, and OpenLDAP with an overlay that tracks only one group class. Active Directory keeps `memberOf` complete and is not searched the second way. Checked against lldap 0.6.3, OpenLDAP 2.6 with and without the overlay, and Samba AD. Smaller things from the same report: **StartTLS now works with Active Directory and Samba AD**, which it never did: straight after StartTLS, and before logging in, the LDAP library read the server's schema, which those directories only allow once logged in, so every StartTLS connection failed with "operationsError" (LDAPS was unaffected); **Test Connection** against a server that doesn't offer StartTLS (lldap only does LDAPS) now says so and suggests LDAPS, instead of "Unsupported extended operation" and a number; support bundles no longer mask part of a longer dotted number such as that one as an IP address, which had made the message unreadable; and a user's first LDAP login logs the "no mapped groups" warning once instead of twice. diff --git a/static/assets/ImagePreviewModal-DWRBCqB-.js b/static/assets/ImagePreviewModal-yOK-BUmg.js similarity index 98% rename from static/assets/ImagePreviewModal-DWRBCqB-.js rename to static/assets/ImagePreviewModal-yOK-BUmg.js index 0cf710941..d8a0a832e 100644 --- a/static/assets/ImagePreviewModal-DWRBCqB-.js +++ b/static/assets/ImagePreviewModal-yOK-BUmg.js @@ -1 +1 @@ -import{i as e}from"./chunk-aKtaBQYM.js";import{a as t,c as n,d as r,g as i,i as a,l as o,n as s,o as c,r as l,s as u,t as d,u as f,v as p,y as m}from"./index-DC8Fhl-1.js";var h=e(m(),1),g=i(),_=.4,v=8,y=1.25,b=30,x=Math.log(y)/b,S=e=>Math.min(v,Math.max(_,e)),C={x:0,y:0};function w(e){return e.deltaMode===1?e.deltaY*16:e.deltaMode===2?e.deltaY*100:e.deltaY}function T({libraryFileId:e,filename:i,fileSize:m,onClose:_}){let{t:v}=p(),T=d(),{isFullscreen:E,toggleFullscreen:D}=T,O=(0,h.useRef)(null),k=(0,h.useRef)(null),[A,j]=(0,h.useState)(null),[M,N]=(0,h.useState)(!1),[P,F]=(0,h.useState)(null),[I,L]=(0,h.useState)(1),[R,z]=(0,h.useState)(C),[B,V]=(0,h.useState)(!1),H=(0,h.useRef)(1),U=(0,h.useRef)(C),W=(0,h.useRef)(new Map),G=(0,h.useRef)(null),K=(0,h.useCallback)((e,t)=>{let n=O.current,r=k.current;if(!n||!r)return e;let i=Math.max(0,(r.offsetWidth*t-n.clientWidth)/2),a=Math.max(0,(r.offsetHeight*t-n.clientHeight)/2);return{x:Math.min(i,Math.max(-i,e.x)),y:Math.min(a,Math.max(-a,e.y))}},[]),q=(0,h.useCallback)((e,t)=>{H.current=e,U.current=t,L(e),z(t)},[]),J=(0,h.useCallback)((e,t,n)=>{let r=H.current,i=S(r*e);if(i===r)return;let a=O.current,o=U.current,s={x:o.x*(i/r),y:o.y*(i/r)};if(a){let e=a.getBoundingClientRect(),c=(t??e.left+e.width/2)-(e.left+e.width/2),l=(n??e.top+e.height/2)-(e.top+e.height/2),u=i/r;s={x:c-(c-o.x)*u,y:l-(l-o.y)*u}}q(i,K(s,i))},[K,q]),Y=(0,h.useCallback)(()=>q(1,C),[q]);(0,h.useEffect)(()=>{let n=!1,r=null;if(j(null),N(!1),F(null),q(1,C),m>52428800){F(v(`fileManager.preview.tooLarge`,{size:a(m)}));return}let i={},o=c();return o&&(i.Authorization=`Bearer ${o}`),(async()=>{let a=await fetch(t.getLibraryFileDownloadUrl(e),{headers:i});if(!a.ok)throw Error(`HTTP ${a.status}`);let o=await a.blob();n||(r=URL.createObjectURL(o),j(r))})().catch(e=>{console.error(`[image-preview] load failed`,e),n||F(v(`fileManager.preview.error`))}),()=>{n=!0,r&&URL.revokeObjectURL(r)}},[e,m,v,q]),(0,h.useEffect)(()=>{let e=e=>{e.ctrlKey||e.metaKey||e.altKey||(e.key===`+`||e.key===`=`?(e.preventDefault(),J(y)):e.key===`-`?(e.preventDefault(),J(1/y)):e.key===`0`&&(e.preventDefault(),Y()))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Y,J]),(0,h.useEffect)(()=>{let e=O.current;if(!e)return;let t=e=>{e.preventDefault();let t=Math.max(-30,Math.min(b,w(e)));J(Math.exp(-t*x),e.clientX,e.clientY)};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[J,A]);let X=e=>{W.current.set(e.pointerId,{x:e.clientX,y:e.clientY}),G.current=null,W.current.size===1&&H.current>1&&(e.currentTarget.setPointerCapture(e.pointerId),V(!0))},Z=e=>{W.current.delete(e.pointerId),G.current=null,W.current.size===0&&V(!1)},Q=e=>{let t=W.current,n=t.get(e.pointerId);if(!n)return;if(e.pointerType===`mouse`&&e.buttons===0){Z(e);return}if(t.set(e.pointerId,{x:e.clientX,y:e.clientY}),t.size===1){if(H.current<=1)return;let t={x:U.current.x+(e.clientX-n.x),y:U.current.y+(e.clientY-n.y)};q(H.current,K(t,H.current));return}if(t.size!==2)return;let[r,i]=Array.from(t.values()),a=Math.hypot(r.x-i.x,r.y-i.y),o=G.current;G.current=a,o!=null&&o>0&&a>0&&J(a/o,(r.x+i.x)/2,(r.y+i.y)/2)},$=I>1;return(0,g.jsx)(s,{title:i,fullscreen:T,onClose:_,icon:(0,g.jsx)(r,{className:`w-5 h-5 text-bambu-green flex-shrink-0`}),actions:A?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`button`,{onClick:()=>J(1/y),className:l,"aria-label":v(`fileManager.preview.zoomOut`),children:(0,g.jsx)(u,{className:`w-4 h-4`})}),(0,g.jsx)(`button`,{onClick:()=>J(y),className:l,"aria-label":v(`fileManager.preview.zoomIn`),children:(0,g.jsx)(n,{className:`w-4 h-4`})}),(0,g.jsx)(`button`,{onClick:Y,className:l,"aria-label":v(`fileManager.preview.resetZoom`),children:(0,g.jsx)(o,{className:`w-4 h-4`})})]}):void 0,children:(0,g.jsx)(`div`,{ref:O,"data-testid":`image-preview-content`,className:`relative flex-1 min-h-0 overflow-hidden bg-bambu-dark flex items-center justify-center touch-none ${E?``:`rounded-b-lg`} ${$?B?`cursor-grabbing`:`cursor-grab`:``}`,onDoubleClick:D,onPointerDown:X,onPointerMove:Q,onPointerUp:Z,onPointerCancel:Z,onPointerLeave:Z,children:P?(0,g.jsx)(`p`,{className:`text-bambu-gray text-center p-6`,children:P}):(0,g.jsxs)(g.Fragment,{children:[A&&(0,g.jsx)(`img`,{ref:k,src:A,alt:i,draggable:!1,onLoad:()=>N(!0),onError:()=>F(v(`fileManager.preview.error`)),style:{transform:`translate(${R.x}px, ${R.y}px) scale(${I})`},className:`max-w-full max-h-full object-contain select-none`}),!M&&(0,g.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center pointer-events-none`,children:(0,g.jsx)(f,{className:`w-8 h-8 text-bambu-green animate-spin`})})]})})})}export{T as ImagePreviewModal}; \ No newline at end of file +import{i as e}from"./chunk-aKtaBQYM.js";import{a as t,c as n,d as r,g as i,i as a,l as o,n as s,o as c,r as l,s as u,t as d,u as f,v as p,y as m}from"./index-Bh3F0vXZ.js";var h=e(m(),1),g=i(),_=.4,v=8,y=1.25,b=30,x=Math.log(y)/b,S=e=>Math.min(v,Math.max(_,e)),C={x:0,y:0};function w(e){return e.deltaMode===1?e.deltaY*16:e.deltaMode===2?e.deltaY*100:e.deltaY}function T({libraryFileId:e,filename:i,fileSize:m,onClose:_}){let{t:v}=p(),T=d(),{isFullscreen:E,toggleFullscreen:D}=T,O=(0,h.useRef)(null),k=(0,h.useRef)(null),[A,j]=(0,h.useState)(null),[M,N]=(0,h.useState)(!1),[P,F]=(0,h.useState)(null),[I,L]=(0,h.useState)(1),[R,z]=(0,h.useState)(C),[B,V]=(0,h.useState)(!1),H=(0,h.useRef)(1),U=(0,h.useRef)(C),W=(0,h.useRef)(new Map),G=(0,h.useRef)(null),K=(0,h.useCallback)((e,t)=>{let n=O.current,r=k.current;if(!n||!r)return e;let i=Math.max(0,(r.offsetWidth*t-n.clientWidth)/2),a=Math.max(0,(r.offsetHeight*t-n.clientHeight)/2);return{x:Math.min(i,Math.max(-i,e.x)),y:Math.min(a,Math.max(-a,e.y))}},[]),q=(0,h.useCallback)((e,t)=>{H.current=e,U.current=t,L(e),z(t)},[]),J=(0,h.useCallback)((e,t,n)=>{let r=H.current,i=S(r*e);if(i===r)return;let a=O.current,o=U.current,s={x:o.x*(i/r),y:o.y*(i/r)};if(a){let e=a.getBoundingClientRect(),c=(t??e.left+e.width/2)-(e.left+e.width/2),l=(n??e.top+e.height/2)-(e.top+e.height/2),u=i/r;s={x:c-(c-o.x)*u,y:l-(l-o.y)*u}}q(i,K(s,i))},[K,q]),Y=(0,h.useCallback)(()=>q(1,C),[q]);(0,h.useEffect)(()=>{let n=!1,r=null;if(j(null),N(!1),F(null),q(1,C),m>52428800){F(v(`fileManager.preview.tooLarge`,{size:a(m)}));return}let i={},o=c();return o&&(i.Authorization=`Bearer ${o}`),(async()=>{let a=await fetch(t.getLibraryFileDownloadUrl(e),{headers:i});if(!a.ok)throw Error(`HTTP ${a.status}`);let o=await a.blob();n||(r=URL.createObjectURL(o),j(r))})().catch(e=>{console.error(`[image-preview] load failed`,e),n||F(v(`fileManager.preview.error`))}),()=>{n=!0,r&&URL.revokeObjectURL(r)}},[e,m,v,q]),(0,h.useEffect)(()=>{let e=e=>{e.ctrlKey||e.metaKey||e.altKey||(e.key===`+`||e.key===`=`?(e.preventDefault(),J(y)):e.key===`-`?(e.preventDefault(),J(1/y)):e.key===`0`&&(e.preventDefault(),Y()))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Y,J]),(0,h.useEffect)(()=>{let e=O.current;if(!e)return;let t=e=>{e.preventDefault();let t=Math.max(-30,Math.min(b,w(e)));J(Math.exp(-t*x),e.clientX,e.clientY)};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[J,A]);let X=e=>{W.current.set(e.pointerId,{x:e.clientX,y:e.clientY}),G.current=null,W.current.size===1&&H.current>1&&(e.currentTarget.setPointerCapture(e.pointerId),V(!0))},Z=e=>{W.current.delete(e.pointerId),G.current=null,W.current.size===0&&V(!1)},Q=e=>{let t=W.current,n=t.get(e.pointerId);if(!n)return;if(e.pointerType===`mouse`&&e.buttons===0){Z(e);return}if(t.set(e.pointerId,{x:e.clientX,y:e.clientY}),t.size===1){if(H.current<=1)return;let t={x:U.current.x+(e.clientX-n.x),y:U.current.y+(e.clientY-n.y)};q(H.current,K(t,H.current));return}if(t.size!==2)return;let[r,i]=Array.from(t.values()),a=Math.hypot(r.x-i.x,r.y-i.y),o=G.current;G.current=a,o!=null&&o>0&&a>0&&J(a/o,(r.x+i.x)/2,(r.y+i.y)/2)},$=I>1;return(0,g.jsx)(s,{title:i,fullscreen:T,onClose:_,icon:(0,g.jsx)(r,{className:`w-5 h-5 text-bambu-green flex-shrink-0`}),actions:A?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`button`,{onClick:()=>J(1/y),className:l,"aria-label":v(`fileManager.preview.zoomOut`),children:(0,g.jsx)(u,{className:`w-4 h-4`})}),(0,g.jsx)(`button`,{onClick:()=>J(y),className:l,"aria-label":v(`fileManager.preview.zoomIn`),children:(0,g.jsx)(n,{className:`w-4 h-4`})}),(0,g.jsx)(`button`,{onClick:Y,className:l,"aria-label":v(`fileManager.preview.resetZoom`),children:(0,g.jsx)(o,{className:`w-4 h-4`})})]}):void 0,children:(0,g.jsx)(`div`,{ref:O,"data-testid":`image-preview-content`,className:`relative flex-1 min-h-0 overflow-hidden bg-bambu-dark flex items-center justify-center touch-none ${E?``:`rounded-b-lg`} ${$?B?`cursor-grabbing`:`cursor-grab`:``}`,onDoubleClick:D,onPointerDown:X,onPointerMove:Q,onPointerUp:Z,onPointerCancel:Z,onPointerLeave:Z,children:P?(0,g.jsx)(`p`,{className:`text-bambu-gray text-center p-6`,children:P}):(0,g.jsxs)(g.Fragment,{children:[A&&(0,g.jsx)(`img`,{ref:k,src:A,alt:i,draggable:!1,onLoad:()=>N(!0),onError:()=>F(v(`fileManager.preview.error`)),style:{transform:`translate(${R.x}px, ${R.y}px) scale(${I})`},className:`max-w-full max-h-full object-contain select-none`}),!M&&(0,g.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center pointer-events-none`,children:(0,g.jsx)(f,{className:`w-8 h-8 text-bambu-green animate-spin`})})]})})})}export{T as ImagePreviewModal}; \ No newline at end of file diff --git a/static/assets/PdfPreviewModal-CTzoG93b.js b/static/assets/PdfPreviewModal-B_LYIkkC.js similarity index 96% rename from static/assets/PdfPreviewModal-CTzoG93b.js rename to static/assets/PdfPreviewModal-B_LYIkkC.js index 10ff063fa..2f09b4efa 100644 --- a/static/assets/PdfPreviewModal-CTzoG93b.js +++ b/static/assets/PdfPreviewModal-B_LYIkkC.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/pdf-C9LrqMbI.js","assets/index-DC8Fhl-1.js","assets/chunk-aKtaBQYM.js","assets/index-V2lrrDnm.css"])))=>i.map(i=>d[i]); -import{i as e}from"./chunk-aKtaBQYM.js";import{_ as t,a as n,c as r,f as i,g as a,h as o,i as s,m as c,n as l,o as u,r as d,s as ee,t as te,u as ne,v as re,y as f}from"./index-DC8Fhl-1.js";var p=e(f(),1),m=a(),h=.4,g=4,_=1.25,v=30,ie=Math.log(_)/v,ae=150,y=16*1024*1024,b=`/assets/pdfjs/`,oe=e=>Math.min(g,Math.max(h,e));function x(e){let t=document.createElement(`canvas`);t.width=256,t.height=256;let n=t.getContext(`2d`);if(!n)return Promise.resolve(null);n.fillStyle=`#ffffff`,n.fillRect(0,0,256,256);let r=256/Math.max(e.width,e.height),i=e.width*r,a=e.height*r;return n.drawImage(e,(256-i)/2,(256-a)/2,i,a),new Promise(e=>t.toBlob(e,`image/png`))}function S(e){return e.deltaMode===1?e.deltaY*16:e.deltaMode===2?e.deltaY*100:e.deltaY}function C({libraryFileId:e,filename:a,fileSize:f,onClose:h,onSnapshot:g}){let{t:C}=re(),w=te(),{panelRef:T,isFullscreen:E,toggleFullscreen:D}=w,O=(0,p.useRef)(null),k=(0,p.useRef)(null),A=(0,p.useRef)(null),j=(0,p.useRef)(!1),M=(0,p.useRef)(g);(0,p.useEffect)(()=>{M.current=g});let[N,P]=(0,p.useState)(null),[F,I]=(0,p.useState)(1),[L,R]=(0,p.useState)(1),[z,se]=(0,p.useState)(1),[B,ce]=(0,p.useState)(0),[V,H]=(0,p.useState)(null),[U,W]=(0,p.useState)(!0),G=(0,p.useRef)(L),K=(0,p.useRef)(null),q=(0,p.useRef)(null),J=(0,p.useRef)(new Map),Y=(0,p.useRef)(null),X=(0,p.useCallback)((e,t,n)=>{let r=O.current,i=k.current;if(r&&i){let e=r.getBoundingClientRect(),a=i.getBoundingClientRect(),o=t==null?e.width/2:t-e.left,s=n==null?e.height/2:n-e.top;q.current=a.width>0&&a.height>0?{fx:(o+e.left-a.left)/a.width,fy:(s+e.top-a.top)/a.height,px:o,py:s}:null}R(t=>oe(t*e))},[]);(0,p.useEffect)(()=>{let e=e=>{e.ctrlKey||e.metaKey||e.altKey||(e.key===`+`||e.key===`=`?(e.preventDefault(),X(_)):e.key===`-`?(e.preventDefault(),X(1/_)):e.key===`0`&&(e.preventDefault(),q.current=null,R(1)))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[X]),(0,p.useEffect)(()=>{let e=O.current;if(!e)return;let t=t=>{if(!k.current||!K.current||!(t.ctrlKey||t.metaKey)&&!(e.scrollHeight<=e.clientHeight&&e.scrollWidth<=e.clientWidth))return;t.preventDefault();let n=Math.max(-30,Math.min(v,S(t)));X(Math.exp(-n*ie),t.clientX,t.clientY)};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[X]);let le=e=>{e.pointerType===`touch`&&(J.current.set(e.pointerId,{x:e.clientX,y:e.clientY}),Y.current=null)},ue=e=>{if(e.pointerType!==`touch`)return;let t=J.current,n=t.get(e.pointerId);if(!n)return;if(t.set(e.pointerId,{x:e.clientX,y:e.clientY}),t.size===1){let t=O.current;t&&(t.scrollLeft-=e.clientX-n.x,t.scrollTop-=e.clientY-n.y);return}if(t.size!==2)return;let[r,i]=Array.from(t.values()),a=Math.hypot(r.x-i.x,r.y-i.y),o=Y.current;Y.current=a,o!=null&&o>0&&a>0&&X(a/o,(r.x+i.x)/2,(r.y+i.y)/2)},Z=e=>{e.pointerType===`touch`&&(J.current.delete(e.pointerId),Y.current=null)};(0,p.useLayoutEffect)(()=>{G.current=L;let e=k.current,t=O.current,n=K.current;if(!e||!t||!n)return;e.style.width=`${n.width*L}px`,e.style.height=`${n.height*L}px`;let r=q.current;q.current=null,r&&(t.scrollLeft=e.offsetLeft+r.fx*e.offsetWidth-r.px,t.scrollTop=e.offsetTop+r.fy*e.offsetHeight-r.py)},[L]),(0,p.useEffect)(()=>{if(L===z)return;let e=window.setTimeout(()=>se(L),ae);return()=>window.clearTimeout(e)},[L,z]),(0,p.useEffect)(()=>{let e=T.current;if(!e)return;let t=new ResizeObserver(()=>ce(e=>e+1));return t.observe(e),()=>t.disconnect()},[T]),(0,p.useEffect)(()=>{let r=!1,i=null;if(P(null),H(null),I(1),W(!0),f>52428800){H(C(`fileManager.preview.tooLarge`,{size:s(f)})),W(!1);return}let a={},o=u();return o&&(a.Authorization=`Bearer ${o}`),(async()=>{let o=await fetch(n.getLibraryFileDownloadUrl(e),{headers:a});if(!o.ok)throw Error(`HTTP ${o.status}`);let s=await o.arrayBuffer(),c=await t(()=>import(`./pdf-C9LrqMbI.js`),__vite__mapDeps([0,1,2,3]));if(c.GlobalWorkerOptions.workerSrc||(c.GlobalWorkerOptions.workerSrc=(await t(async()=>{let{default:e}=await import(`./pdf.worker.min-DpOxPwGP.js`);return{default:e}},[])).default),i=c.getDocument({data:new Uint8Array(s),cMapUrl:`${b}cmaps/`,iccUrl:`${b}iccs/`,standardFontDataUrl:`${b}standard_fonts/`,wasmUrl:`${b}wasm/`}),r){i.destroy();return}let l=await i.promise;r||P(l)})().catch(e=>{console.error(`[pdf-preview] load failed`,e),r||(H(C(`fileManager.preview.error`)),W(!1))}),()=>{r=!0,A.current?.cancel(),A.current=null,i?.destroy()}},[e,f,C]),(0,p.useEffect)(()=>{if(!N)return;let e=!1;return W(!0),(async()=>{let t=await N.getPage(F),n=k.current,r=O.current;if(!n||!r||e)return;let i=t.getViewport({scale:1}),a=Math.max((r.clientWidth-32)/i.width,.1),o=Math.min(window.devicePixelRatio||1,2),s=a*z*o,c=i.width*s*(i.height*s),l=c>y?s*Math.sqrt(y/c):s,u=t.getViewport({scale:l});n.width=u.width,n.height=u.height,K.current={width:i.width*a,height:i.height*a},n.style.width=`${K.current.width*G.current}px`,n.style.height=`${K.current.height*G.current}px`,A.current?.cancel();let d=t.render({canvas:n,viewport:u});if(A.current=d,await d.promise,!e&&(W(!1),F===1&&M.current&&!j.current)){j.current=!0;let t=await x(n);t&&!e&&M.current?.(t)}})().catch(t=>{!e&&t?.name!==`RenderingCancelledException`&&(console.error(`[pdf-preview] render failed`,t),H(C(`fileManager.preview.error`)),W(!1))}),()=>{e=!0}},[N,F,z,B,C]);let Q=N?.numPages??0,$=d;return(0,m.jsx)(l,{title:a,fullscreen:w,onClose:h,icon:(0,m.jsx)(i,{className:`w-5 h-5 text-bambu-green flex-shrink-0`}),actions:(0,m.jsxs)(m.Fragment,{children:[N&&Q>1&&(0,m.jsxs)(`div`,{className:`flex items-center gap-1 mr-2`,children:[(0,m.jsx)(`button`,{onClick:()=>I(e=>Math.max(1,e-1)),disabled:F<=1,className:`${$} disabled:opacity-40 disabled:cursor-not-allowed`,"aria-label":C(`fileManager.preview.prevPage`),children:(0,m.jsx)(c,{className:`w-4 h-4`})}),(0,m.jsx)(`span`,{className:`text-sm text-bambu-gray whitespace-nowrap`,children:C(`fileManager.preview.page`,{current:F,total:Q})}),(0,m.jsx)(`button`,{onClick:()=>I(e=>Math.min(Q,e+1)),disabled:F>=Q,className:`${$} disabled:opacity-40 disabled:cursor-not-allowed`,"aria-label":C(`fileManager.preview.nextPage`),children:(0,m.jsx)(o,{className:`w-4 h-4`})})]}),N&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`button`,{onClick:()=>X(1/_),className:$,"aria-label":C(`fileManager.preview.zoomOut`),children:(0,m.jsx)(ee,{className:`w-4 h-4`})}),(0,m.jsx)(`button`,{onClick:()=>X(_),className:$,"aria-label":C(`fileManager.preview.zoomIn`),children:(0,m.jsx)(r,{className:`w-4 h-4`})})]})]}),children:(0,m.jsxs)(`div`,{ref:O,"data-testid":`pdf-preview-page`,className:`relative flex-1 min-h-0 overflow-auto bg-bambu-dark p-4 touch-none ${E?``:`rounded-b-lg`}`,onDoubleClick:D,onPointerDown:le,onPointerMove:ue,onPointerUp:Z,onPointerCancel:Z,onPointerLeave:Z,children:[V?(0,m.jsx)(`div`,{className:`h-full flex items-center justify-center`,children:(0,m.jsx)(`p`,{className:`text-bambu-gray text-center`,children:V})}):(0,m.jsx)(`div`,{className:`flex justify-center min-w-fit`,children:(0,m.jsx)(`canvas`,{ref:k,className:`shadow-lg`})}),!V&&U&&(0,m.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center pointer-events-none`,children:(0,m.jsx)(ne,{className:`w-8 h-8 text-bambu-green animate-spin`})})]})})}export{C as PdfPreviewModal}; \ No newline at end of file +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/pdf-Dh_3UNyL.js","assets/index-Bh3F0vXZ.js","assets/chunk-aKtaBQYM.js","assets/index-CT9srI0L.css"])))=>i.map(i=>d[i]); +import{i as e}from"./chunk-aKtaBQYM.js";import{_ as t,a as n,c as r,f as i,g as a,h as o,i as s,m as c,n as l,o as u,r as d,s as ee,t as te,u as ne,v as re,y as f}from"./index-Bh3F0vXZ.js";var p=e(f(),1),m=a(),h=.4,g=4,_=1.25,v=30,ie=Math.log(_)/v,ae=150,y=16*1024*1024,b=`/assets/pdfjs/`,oe=e=>Math.min(g,Math.max(h,e));function x(e){let t=document.createElement(`canvas`);t.width=256,t.height=256;let n=t.getContext(`2d`);if(!n)return Promise.resolve(null);n.fillStyle=`#ffffff`,n.fillRect(0,0,256,256);let r=256/Math.max(e.width,e.height),i=e.width*r,a=e.height*r;return n.drawImage(e,(256-i)/2,(256-a)/2,i,a),new Promise(e=>t.toBlob(e,`image/png`))}function S(e){return e.deltaMode===1?e.deltaY*16:e.deltaMode===2?e.deltaY*100:e.deltaY}function C({libraryFileId:e,filename:a,fileSize:f,onClose:h,onSnapshot:g}){let{t:C}=re(),w=te(),{panelRef:T,isFullscreen:E,toggleFullscreen:D}=w,O=(0,p.useRef)(null),k=(0,p.useRef)(null),A=(0,p.useRef)(null),j=(0,p.useRef)(!1),M=(0,p.useRef)(g);(0,p.useEffect)(()=>{M.current=g});let[N,P]=(0,p.useState)(null),[F,I]=(0,p.useState)(1),[L,R]=(0,p.useState)(1),[z,se]=(0,p.useState)(1),[B,ce]=(0,p.useState)(0),[V,H]=(0,p.useState)(null),[U,W]=(0,p.useState)(!0),G=(0,p.useRef)(L),K=(0,p.useRef)(null),q=(0,p.useRef)(null),J=(0,p.useRef)(new Map),Y=(0,p.useRef)(null),X=(0,p.useCallback)((e,t,n)=>{let r=O.current,i=k.current;if(r&&i){let e=r.getBoundingClientRect(),a=i.getBoundingClientRect(),o=t==null?e.width/2:t-e.left,s=n==null?e.height/2:n-e.top;q.current=a.width>0&&a.height>0?{fx:(o+e.left-a.left)/a.width,fy:(s+e.top-a.top)/a.height,px:o,py:s}:null}R(t=>oe(t*e))},[]);(0,p.useEffect)(()=>{let e=e=>{e.ctrlKey||e.metaKey||e.altKey||(e.key===`+`||e.key===`=`?(e.preventDefault(),X(_)):e.key===`-`?(e.preventDefault(),X(1/_)):e.key===`0`&&(e.preventDefault(),q.current=null,R(1)))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[X]),(0,p.useEffect)(()=>{let e=O.current;if(!e)return;let t=t=>{if(!k.current||!K.current||!(t.ctrlKey||t.metaKey)&&!(e.scrollHeight<=e.clientHeight&&e.scrollWidth<=e.clientWidth))return;t.preventDefault();let n=Math.max(-30,Math.min(v,S(t)));X(Math.exp(-n*ie),t.clientX,t.clientY)};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[X]);let le=e=>{e.pointerType===`touch`&&(J.current.set(e.pointerId,{x:e.clientX,y:e.clientY}),Y.current=null)},ue=e=>{if(e.pointerType!==`touch`)return;let t=J.current,n=t.get(e.pointerId);if(!n)return;if(t.set(e.pointerId,{x:e.clientX,y:e.clientY}),t.size===1){let t=O.current;t&&(t.scrollLeft-=e.clientX-n.x,t.scrollTop-=e.clientY-n.y);return}if(t.size!==2)return;let[r,i]=Array.from(t.values()),a=Math.hypot(r.x-i.x,r.y-i.y),o=Y.current;Y.current=a,o!=null&&o>0&&a>0&&X(a/o,(r.x+i.x)/2,(r.y+i.y)/2)},Z=e=>{e.pointerType===`touch`&&(J.current.delete(e.pointerId),Y.current=null)};(0,p.useLayoutEffect)(()=>{G.current=L;let e=k.current,t=O.current,n=K.current;if(!e||!t||!n)return;e.style.width=`${n.width*L}px`,e.style.height=`${n.height*L}px`;let r=q.current;q.current=null,r&&(t.scrollLeft=e.offsetLeft+r.fx*e.offsetWidth-r.px,t.scrollTop=e.offsetTop+r.fy*e.offsetHeight-r.py)},[L]),(0,p.useEffect)(()=>{if(L===z)return;let e=window.setTimeout(()=>se(L),ae);return()=>window.clearTimeout(e)},[L,z]),(0,p.useEffect)(()=>{let e=T.current;if(!e)return;let t=new ResizeObserver(()=>ce(e=>e+1));return t.observe(e),()=>t.disconnect()},[T]),(0,p.useEffect)(()=>{let r=!1,i=null;if(P(null),H(null),I(1),W(!0),f>52428800){H(C(`fileManager.preview.tooLarge`,{size:s(f)})),W(!1);return}let a={},o=u();return o&&(a.Authorization=`Bearer ${o}`),(async()=>{let o=await fetch(n.getLibraryFileDownloadUrl(e),{headers:a});if(!o.ok)throw Error(`HTTP ${o.status}`);let s=await o.arrayBuffer(),c=await t(()=>import(`./pdf-Dh_3UNyL.js`),__vite__mapDeps([0,1,2,3]));if(c.GlobalWorkerOptions.workerSrc||(c.GlobalWorkerOptions.workerSrc=(await t(async()=>{let{default:e}=await import(`./pdf.worker.min-DpOxPwGP.js`);return{default:e}},[])).default),i=c.getDocument({data:new Uint8Array(s),cMapUrl:`${b}cmaps/`,iccUrl:`${b}iccs/`,standardFontDataUrl:`${b}standard_fonts/`,wasmUrl:`${b}wasm/`}),r){i.destroy();return}let l=await i.promise;r||P(l)})().catch(e=>{console.error(`[pdf-preview] load failed`,e),r||(H(C(`fileManager.preview.error`)),W(!1))}),()=>{r=!0,A.current?.cancel(),A.current=null,i?.destroy()}},[e,f,C]),(0,p.useEffect)(()=>{if(!N)return;let e=!1;return W(!0),(async()=>{let t=await N.getPage(F),n=k.current,r=O.current;if(!n||!r||e)return;let i=t.getViewport({scale:1}),a=Math.max((r.clientWidth-32)/i.width,.1),o=Math.min(window.devicePixelRatio||1,2),s=a*z*o,c=i.width*s*(i.height*s),l=c>y?s*Math.sqrt(y/c):s,u=t.getViewport({scale:l});n.width=u.width,n.height=u.height,K.current={width:i.width*a,height:i.height*a},n.style.width=`${K.current.width*G.current}px`,n.style.height=`${K.current.height*G.current}px`,A.current?.cancel();let d=t.render({canvas:n,viewport:u});if(A.current=d,await d.promise,!e&&(W(!1),F===1&&M.current&&!j.current)){j.current=!0;let t=await x(n);t&&!e&&M.current?.(t)}})().catch(t=>{!e&&t?.name!==`RenderingCancelledException`&&(console.error(`[pdf-preview] render failed`,t),H(C(`fileManager.preview.error`)),W(!1))}),()=>{e=!0}},[N,F,z,B,C]);let Q=N?.numPages??0,$=d;return(0,m.jsx)(l,{title:a,fullscreen:w,onClose:h,icon:(0,m.jsx)(i,{className:`w-5 h-5 text-bambu-green flex-shrink-0`}),actions:(0,m.jsxs)(m.Fragment,{children:[N&&Q>1&&(0,m.jsxs)(`div`,{className:`flex items-center gap-1 mr-2`,children:[(0,m.jsx)(`button`,{onClick:()=>I(e=>Math.max(1,e-1)),disabled:F<=1,className:`${$} disabled:opacity-40 disabled:cursor-not-allowed`,"aria-label":C(`fileManager.preview.prevPage`),children:(0,m.jsx)(c,{className:`w-4 h-4`})}),(0,m.jsx)(`span`,{className:`text-sm text-bambu-gray whitespace-nowrap`,children:C(`fileManager.preview.page`,{current:F,total:Q})}),(0,m.jsx)(`button`,{onClick:()=>I(e=>Math.min(Q,e+1)),disabled:F>=Q,className:`${$} disabled:opacity-40 disabled:cursor-not-allowed`,"aria-label":C(`fileManager.preview.nextPage`),children:(0,m.jsx)(o,{className:`w-4 h-4`})})]}),N&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`button`,{onClick:()=>X(1/_),className:$,"aria-label":C(`fileManager.preview.zoomOut`),children:(0,m.jsx)(ee,{className:`w-4 h-4`})}),(0,m.jsx)(`button`,{onClick:()=>X(_),className:$,"aria-label":C(`fileManager.preview.zoomIn`),children:(0,m.jsx)(r,{className:`w-4 h-4`})})]})]}),children:(0,m.jsxs)(`div`,{ref:O,"data-testid":`pdf-preview-page`,className:`relative flex-1 min-h-0 overflow-auto bg-bambu-dark p-4 touch-none ${E?``:`rounded-b-lg`}`,onDoubleClick:D,onPointerDown:le,onPointerMove:ue,onPointerUp:Z,onPointerCancel:Z,onPointerLeave:Z,children:[V?(0,m.jsx)(`div`,{className:`h-full flex items-center justify-center`,children:(0,m.jsx)(`p`,{className:`text-bambu-gray text-center`,children:V})}):(0,m.jsx)(`div`,{className:`flex justify-center min-w-fit`,children:(0,m.jsx)(`canvas`,{ref:k,className:`shadow-lg`})}),!V&&U&&(0,m.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center pointer-events-none`,children:(0,m.jsx)(ne,{className:`w-8 h-8 text-bambu-green animate-spin`})})]})})}export{C as PdfPreviewModal}; \ No newline at end of file diff --git a/static/assets/SpreadsheetPreviewModal-BcNF67Td.js b/static/assets/SpreadsheetPreviewModal-BEobv_FV.js similarity index 97% rename from static/assets/SpreadsheetPreviewModal-BcNF67Td.js rename to static/assets/SpreadsheetPreviewModal-BEobv_FV.js index 379ea0536..1b4d0a25e 100644 --- a/static/assets/SpreadsheetPreviewModal-BcNF67Td.js +++ b/static/assets/SpreadsheetPreviewModal-BEobv_FV.js @@ -1,2 +1,2 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/papaparse.min-CR43Mv99.js","assets/chunk-aKtaBQYM.js"])))=>i.map(i=>d[i]); -import{i as e}from"./chunk-aKtaBQYM.js";import{_ as t,a as n,g as r,i,n as a,o,p as s,t as c,u as l,v as u,y as d}from"./index-DC8Fhl-1.js";var f=e(d(),1),p=r(),m=500,h=40;function g(e){let t=``,n=e;for(;n>=0;)t=String.fromCharCode(65+n%26)+t,n=Math.floor(n/26)-1;return t}function _(e){let t=document.createElement(`canvas`);t.width=256,t.height=256;let n=t.getContext(`2d`);if(!n)return Promise.resolve(null);let r=256/5,i=256/9;n.fillStyle=`#1a1a1a`,n.fillRect(0,0,256,256),n.fillStyle=`rgba(0, 174, 66, 0.25)`,n.fillRect(0,0,256,i),n.strokeStyle=`#333333`,n.lineWidth=1;for(let e=1;e<5;e++)n.beginPath(),n.moveTo(e*r+.5,0),n.lineTo(e*r+.5,256),n.stroke();for(let e=1;e<9;e++)n.beginPath(),n.moveTo(0,e*i+.5),n.lineTo(256,e*i+.5),n.stroke();n.fillStyle=`#d4d4d4`,n.font=`11px sans-serif`,n.textBaseline=`middle`;for(let t=0;t<9;t++)for(let a=0;a<5;a++){let o=e[t]?.[a];o&&n.fillText(String(o),a*r+4,t*i+i/2,r-8)}return new Promise(e=>t.toBlob(e,`image/png`))}function v({libraryFileId:r,filename:d,fileType:v,fileSize:y,onClose:b,onSnapshot:x}){let{t:S}=u(),[C,w]=(0,f.useState)(null),[T,E]=(0,f.useState)(0),[D,O]=(0,f.useState)(null),k=(0,f.useRef)(!1),A=(0,f.useRef)(x);(0,f.useEffect)(()=>{A.current=x});let j=c(),{isFullscreen:M,toggleFullscreen:N}=j;(0,f.useEffect)(()=>{let a=!1;if(w(null),O(null),E(0),y>20971520){O(S(`fileManager.preview.tooLarge`,{size:i(y)}));return}let s={},c=o();return c&&(s.Authorization=`Bearer ${c}`),(async()=>{let i=await fetch(n.getLibraryFileDownloadUrl(r),{headers:s});if(!i.ok)throw Error(`HTTP ${i.status}`);let o=await i.arrayBuffer(),c;if(v===`csv`){let n=(await t(async()=>{let{default:t}=await import(`./papaparse.min-CR43Mv99.js`).then(t=>e(t.default,1));return{default:t}},__vite__mapDeps([0,1]))).default,r=new TextDecoder().decode(o),i=[],a=0,s=0,l=[],u=e=>{a+=1,s=Math.max(s,e.length),i.lengthe??``))};n.parse(r,{skipEmptyLines:!1,step:({data:e})=>{if(Array.isArray(e)){if(e.every(e=>!e)){l.push(e);return}l.forEach(u),l=[],u(e)}}}),c=[{name:d,rows:i,totalRows:a,totalCols:s}]}else{let e=await t(()=>import(`./xlsx-CKkngM-o.js`),[]),n=e.read(o,{dense:!0});c=n.SheetNames.map(t=>{let r=n.Sheets[t],i=r?.[`!ref`];if(!r||!i)return{name:t,rows:[],totalRows:0,totalCols:0};let a=e.utils.decode_range(i),o=a.e.r-a.s.r+1,s=a.e.c-a.s.c+1,c={s:a.s,e:{r:Math.min(a.e.r,a.s.r+m-1),c:Math.min(a.e.c,a.s.c+h-1)}};return{name:t,rows:e.utils.sheet_to_json(r,{header:1,raw:!1,defval:``,range:e.utils.encode_range(c)}),totalRows:o,totalCols:s}})}if(!a&&(w(c),A.current&&!k.current)){let e=c.find(e=>e.rows.length>0);if(e){k.current=!0;let t=await _(e.rows);t&&!a&&A.current?.(t)}}})().catch(e=>{console.error(`[sheet-preview] load failed`,e),a||O(S(`fileManager.preview.error`))}),()=>{a=!0}},[r,v,y,d,S]);let P=C?.[T]??null,F=P!=null&&P.totalRows>P.rows.length,I=P!=null&&P.totalCols>h,L=P==null?0:Math.min(P.totalCols,h);return(0,p.jsxs)(a,{title:d,fullscreen:j,onClose:b,icon:(0,p.jsx)(s,{className:`w-5 h-5 text-bambu-green flex-shrink-0`}),children:[C&&C.length>1&&(0,p.jsx)(`div`,{className:`flex gap-1 px-4 pt-2 overflow-x-auto flex-shrink-0`,children:C.map((e,t)=>(0,p.jsx)(`button`,{onClick:()=>E(t),className:`px-3 py-1.5 text-sm rounded-t whitespace-nowrap transition-colors ${t===T?`bg-bambu-dark text-white border border-b-0 border-bambu-dark-tertiary`:`text-bambu-gray hover:text-white hover:bg-bambu-dark/50`}`,children:e.name},`${e.name}-${t}`))}),(0,p.jsx)(`div`,{"data-testid":`spreadsheet-preview-content`,className:`flex-1 min-h-0 overflow-auto bg-bambu-dark ${M?``:`rounded-b-lg`}`,onDoubleClick:N,children:D?(0,p.jsx)(`div`,{className:`h-full flex items-center justify-center p-6`,children:(0,p.jsx)(`p`,{className:`text-bambu-gray text-center`,children:D})}):C?!P||P.rows.length===0?(0,p.jsx)(`div`,{className:`h-full flex items-center justify-center p-6`,children:(0,p.jsx)(`p`,{className:`text-bambu-gray`,children:S(`fileManager.preview.emptySheet`)})}):(0,p.jsxs)(`table`,{className:`border-collapse text-xs min-w-full`,children:[(0,p.jsx)(`thead`,{children:(0,p.jsxs)(`tr`,{children:[(0,p.jsx)(`th`,{className:`sticky top-0 bg-bambu-dark-secondary border border-bambu-dark-tertiary px-2 py-1 text-bambu-gray font-medium w-10`}),Array.from({length:L},(e,t)=>(0,p.jsx)(`th`,{className:`sticky top-0 bg-bambu-dark-secondary border border-bambu-dark-tertiary px-2 py-1 text-bambu-gray font-medium text-left min-w-[80px]`,children:g(t)},t))]})}),(0,p.jsx)(`tbody`,{children:P.rows.map((e,t)=>(0,p.jsxs)(`tr`,{children:[(0,p.jsx)(`td`,{className:`border border-bambu-dark-tertiary px-2 py-1 text-bambu-gray text-right bg-bambu-dark-secondary/50`,children:t+1}),Array.from({length:L},(t,n)=>(0,p.jsx)(`td`,{className:`border border-bambu-dark-tertiary px-2 py-1 text-bambu-gray-light whitespace-nowrap max-w-[280px] overflow-hidden text-ellipsis`,title:e[n]||void 0,children:e[n]??``},n))]},t))})]}):(0,p.jsx)(`div`,{className:`h-full flex items-center justify-center`,children:(0,p.jsx)(l,{className:`w-8 h-8 text-bambu-green animate-spin`})})}),(F||I)&&P&&(0,p.jsxs)(`div`,{className:`px-4 py-2 border-t border-bambu-dark-tertiary text-xs text-bambu-gray flex gap-4 flex-shrink-0`,children:[F&&(0,p.jsx)(`span`,{children:S(`fileManager.preview.truncatedRows`,{shown:P.rows.length,total:P.totalRows})}),I&&(0,p.jsx)(`span`,{children:S(`fileManager.preview.truncatedCols`,{shown:L,total:P.totalCols})})]})]})}export{v as SpreadsheetPreviewModal}; \ No newline at end of file +import{i as e}from"./chunk-aKtaBQYM.js";import{_ as t,a as n,g as r,i,n as a,o,p as s,t as c,u as l,v as u,y as d}from"./index-Bh3F0vXZ.js";var f=e(d(),1),p=r(),m=500,h=40;function g(e){let t=``,n=e;for(;n>=0;)t=String.fromCharCode(65+n%26)+t,n=Math.floor(n/26)-1;return t}function _(e){let t=document.createElement(`canvas`);t.width=256,t.height=256;let n=t.getContext(`2d`);if(!n)return Promise.resolve(null);let r=256/5,i=256/9;n.fillStyle=`#1a1a1a`,n.fillRect(0,0,256,256),n.fillStyle=`rgba(0, 174, 66, 0.25)`,n.fillRect(0,0,256,i),n.strokeStyle=`#333333`,n.lineWidth=1;for(let e=1;e<5;e++)n.beginPath(),n.moveTo(e*r+.5,0),n.lineTo(e*r+.5,256),n.stroke();for(let e=1;e<9;e++)n.beginPath(),n.moveTo(0,e*i+.5),n.lineTo(256,e*i+.5),n.stroke();n.fillStyle=`#d4d4d4`,n.font=`11px sans-serif`,n.textBaseline=`middle`;for(let t=0;t<9;t++)for(let a=0;a<5;a++){let o=e[t]?.[a];o&&n.fillText(String(o),a*r+4,t*i+i/2,r-8)}return new Promise(e=>t.toBlob(e,`image/png`))}function v({libraryFileId:r,filename:d,fileType:v,fileSize:y,onClose:b,onSnapshot:x}){let{t:S}=u(),[C,w]=(0,f.useState)(null),[T,E]=(0,f.useState)(0),[D,O]=(0,f.useState)(null),k=(0,f.useRef)(!1),A=(0,f.useRef)(x);(0,f.useEffect)(()=>{A.current=x});let j=c(),{isFullscreen:M,toggleFullscreen:N}=j;(0,f.useEffect)(()=>{let a=!1;if(w(null),O(null),E(0),y>20971520){O(S(`fileManager.preview.tooLarge`,{size:i(y)}));return}let s={},c=o();return c&&(s.Authorization=`Bearer ${c}`),(async()=>{let i=await fetch(n.getLibraryFileDownloadUrl(r),{headers:s});if(!i.ok)throw Error(`HTTP ${i.status}`);let o=await i.arrayBuffer(),c;if(v===`csv`){let n=(await t(async()=>{let{default:t}=await import(`./papaparse.min-CR43Mv99.js`).then(t=>e(t.default,1));return{default:t}},__vite__mapDeps([0,1]))).default,r=new TextDecoder().decode(o),i=[],a=0,s=0,l=[],u=e=>{a+=1,s=Math.max(s,e.length),i.lengthe??``))};n.parse(r,{skipEmptyLines:!1,step:({data:e})=>{if(Array.isArray(e)){if(e.every(e=>!e)){l.push(e);return}l.forEach(u),l=[],u(e)}}}),c=[{name:d,rows:i,totalRows:a,totalCols:s}]}else{let e=await t(()=>import(`./xlsx-CKkngM-o.js`),[]),n=e.read(o,{dense:!0});c=n.SheetNames.map(t=>{let r=n.Sheets[t],i=r?.[`!ref`];if(!r||!i)return{name:t,rows:[],totalRows:0,totalCols:0};let a=e.utils.decode_range(i),o=a.e.r-a.s.r+1,s=a.e.c-a.s.c+1,c={s:a.s,e:{r:Math.min(a.e.r,a.s.r+m-1),c:Math.min(a.e.c,a.s.c+h-1)}};return{name:t,rows:e.utils.sheet_to_json(r,{header:1,raw:!1,defval:``,range:e.utils.encode_range(c)}),totalRows:o,totalCols:s}})}if(!a&&(w(c),A.current&&!k.current)){let e=c.find(e=>e.rows.length>0);if(e){k.current=!0;let t=await _(e.rows);t&&!a&&A.current?.(t)}}})().catch(e=>{console.error(`[sheet-preview] load failed`,e),a||O(S(`fileManager.preview.error`))}),()=>{a=!0}},[r,v,y,d,S]);let P=C?.[T]??null,F=P!=null&&P.totalRows>P.rows.length,I=P!=null&&P.totalCols>h,L=P==null?0:Math.min(P.totalCols,h);return(0,p.jsxs)(a,{title:d,fullscreen:j,onClose:b,icon:(0,p.jsx)(s,{className:`w-5 h-5 text-bambu-green flex-shrink-0`}),children:[C&&C.length>1&&(0,p.jsx)(`div`,{className:`flex gap-1 px-4 pt-2 overflow-x-auto flex-shrink-0`,children:C.map((e,t)=>(0,p.jsx)(`button`,{onClick:()=>E(t),className:`px-3 py-1.5 text-sm rounded-t whitespace-nowrap transition-colors ${t===T?`bg-bambu-dark text-white border border-b-0 border-bambu-dark-tertiary`:`text-bambu-gray hover:text-white hover:bg-bambu-dark/50`}`,children:e.name},`${e.name}-${t}`))}),(0,p.jsx)(`div`,{"data-testid":`spreadsheet-preview-content`,className:`flex-1 min-h-0 overflow-auto bg-bambu-dark ${M?``:`rounded-b-lg`}`,onDoubleClick:N,children:D?(0,p.jsx)(`div`,{className:`h-full flex items-center justify-center p-6`,children:(0,p.jsx)(`p`,{className:`text-bambu-gray text-center`,children:D})}):C?!P||P.rows.length===0?(0,p.jsx)(`div`,{className:`h-full flex items-center justify-center p-6`,children:(0,p.jsx)(`p`,{className:`text-bambu-gray`,children:S(`fileManager.preview.emptySheet`)})}):(0,p.jsxs)(`table`,{className:`border-collapse text-xs min-w-full`,children:[(0,p.jsx)(`thead`,{children:(0,p.jsxs)(`tr`,{children:[(0,p.jsx)(`th`,{className:`sticky top-0 bg-bambu-dark-secondary border border-bambu-dark-tertiary px-2 py-1 text-bambu-gray font-medium w-10`}),Array.from({length:L},(e,t)=>(0,p.jsx)(`th`,{className:`sticky top-0 bg-bambu-dark-secondary border border-bambu-dark-tertiary px-2 py-1 text-bambu-gray font-medium text-left min-w-[80px]`,children:g(t)},t))]})}),(0,p.jsx)(`tbody`,{children:P.rows.map((e,t)=>(0,p.jsxs)(`tr`,{children:[(0,p.jsx)(`td`,{className:`border border-bambu-dark-tertiary px-2 py-1 text-bambu-gray text-right bg-bambu-dark-secondary/50`,children:t+1}),Array.from({length:L},(t,n)=>(0,p.jsx)(`td`,{className:`border border-bambu-dark-tertiary px-2 py-1 text-bambu-gray-light whitespace-nowrap max-w-[280px] overflow-hidden text-ellipsis`,title:e[n]||void 0,children:e[n]??``},n))]},t))})]}):(0,p.jsx)(`div`,{className:`h-full flex items-center justify-center`,children:(0,p.jsx)(l,{className:`w-8 h-8 text-bambu-green animate-spin`})})}),(F||I)&&P&&(0,p.jsxs)(`div`,{className:`px-4 py-2 border-t border-bambu-dark-tertiary text-xs text-bambu-gray flex gap-4 flex-shrink-0`,children:[F&&(0,p.jsx)(`span`,{children:S(`fileManager.preview.truncatedRows`,{shown:P.rows.length,total:P.totalRows})}),I&&(0,p.jsx)(`span`,{children:S(`fileManager.preview.truncatedCols`,{shown:L,total:P.totalCols})})]})]})}export{v as SpreadsheetPreviewModal}; \ No newline at end of file diff --git a/static/assets/index-DC8Fhl-1.js b/static/assets/index-Bh3F0vXZ.js similarity index 97% rename from static/assets/index-DC8Fhl-1.js rename to static/assets/index-Bh3F0vXZ.js index 612108d2b..ab2215456 100644 --- a/static/assets/index-DC8Fhl-1.js +++ b/static/assets/index-Bh3F0vXZ.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PdfPreviewModal-CTzoG93b.js","assets/chunk-aKtaBQYM.js","assets/SpreadsheetPreviewModal-BcNF67Td.js","assets/ImagePreviewModal-DWRBCqB-.js"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PdfPreviewModal-B_LYIkkC.js","assets/chunk-aKtaBQYM.js","assets/SpreadsheetPreviewModal-BEobv_FV.js","assets/ImagePreviewModal-yOK-BUmg.js"])))=>i.map(i=>d[i]); import{i as e,n as t,r as n,t as r}from"./chunk-aKtaBQYM.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var i=r((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u{t.exports=i()})),o=r((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-Tt&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),s=r(((e,t)=>{t.exports=o()})),c=r((e=>{var t=a();function n(e){var t=`https://react.dev/errors/`+e;if(1{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=c()})),u=r((e=>{var t=s(),n=a(),r=l();function i(e){var t=`https://react.dev/errors/`+e;if(1B||(e.current=z[B],z[B]=null,B--)}function te(e,t){B++,z[B]=e.current,e.current=t}var ne=V(null),re=V(null),ie=V(null),ae=V(null);function oe(e,t){switch(te(ie,t),te(re,e),te(ne,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Ud(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Ud(t),e=Wd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}ee(ne),te(ne,e)}function se(){ee(ne),ee(re),ee(ie)}function H(e){e.memoizedState!==null&&te(ae,e);var t=ne.current,n=Wd(t,e.type);t!==n&&(te(re,e),te(ne,n))}function ce(e){re.current===e&&(ee(ne),ee(re)),ae.current===e&&(ee(ae),Yf._currentValue=R)}var le,ue;function de(e){if(le===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);le=t&&t[1]||``,ue=-1)`:-1a({...i,ldap_group_mapping:e.target.value})}),(0,G.jsxs)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:[e(`settings.ldap.groupMappingHint`)||`Map LDAP group DNs to BamBuddy groups. Available groups: `,l.map(e=>e.name).join(`, `)]})]})]})}),(0,G.jsxs)(`div`,{className:`flex gap-3 pt-2`,children:[(0,G.jsxs)(Q,{onClick:m,disabled:u.isPending,children:[u.isPending?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(ms,{className:`w-4 h-4`}),e(`common.save`)||`Save`]}),(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>p.mutate(),disabled:p.isPending,children:[p.isPending?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(ql,{className:`w-4 h-4`}),e(`settings.ldap.testConnection`)||`Test Connection`]})]})]})})]})]})}function I8({value:e,onChange:t,placeholder:n,maxLength:r=6}){return(0,G.jsx)(`input`,{type:`text`,value:e,onChange:e=>t(e.target.value.toUpperCase().replace(/\s/g,``)),maxLength:r,className:`w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors font-mono tracking-widest text-center`,placeholder:n,autoComplete:`one-time-code`})}function L8({codes:e,onDone:t}){let{t:n}=U(),[r,i]=(0,f.useState)(!1);return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`div`,{className:`bg-amber-50 dark:bg-amber-500/10 border border-amber-300 dark:border-amber-500/30 rounded-lg p-4`,children:(0,G.jsx)(`p`,{className:`text-amber-700 dark:text-amber-400 text-sm font-medium`,children:n(`settings.twoFa.backupCodesWarning`)})}),(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:e.map((e,t)=>(0,G.jsx)(`code`,{className:`bg-bambu-dark-secondary rounded px-3 py-2 text-center font-mono text-sm text-white tracking-widest`,children:e},t))}),(0,G.jsxs)(`div`,{className:`flex gap-3`,children:[(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:()=>{navigator.clipboard.writeText(e.join(` -`)),i(!0),setTimeout(()=>i(!1),2e3)},className:`flex items-center gap-2`,children:[(0,G.jsx)(Ps,{className:`w-4 h-4`}),n(r?`common.copied`:`common.copy`)]}),(0,G.jsx)(Q,{variant:`primary`,size:`sm`,onClick:t,className:`flex-1`,children:n(`settings.twoFa.savedCodes`)})]})]})}function TKe({onDone:e}){let{t}=U(),n=no(),{showToast:r}=qd(),[i,a]=(0,f.useState)(`qr`),[o,s]=(0,f.useState)(``),[c,l]=(0,f.useState)([]),[u,d]=(0,f.useState)(!1),{data:p,isLoading:m}=K({queryKey:[`totp-setup`],queryFn:()=>Z.setupTOTP(),staleTime:1/0}),h=q({mutationFn:e=>Z.enableTOTP(e),onSuccess:e=>{l(e.backup_codes),a(`backup`),n.invalidateQueries({queryKey:[`2fa-status`]})},onError:()=>r(t(`settings.twoFa.invalidCode`),`error`)});return m||!p?(0,G.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,G.jsx)(Il,{className:`w-6 h-6 animate-spin text-bambu-green`})}):i===`qr`?(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`p`,{className:`text-bambu-gray-light text-sm`,children:t(`settings.twoFa.setupInstructions`)}),(0,G.jsx)(`div`,{className:`flex justify-center`,children:(0,G.jsx)(`img`,{src:`data:image/png;base64,${p.qr_code_b64}`,alt:`TOTP QR Code`,className:`w-48 h-48 rounded-lg`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mb-1`,children:t(`settings.twoFa.manualEntry`)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 bg-bambu-dark-secondary rounded-lg px-3 py-2`,children:[(0,G.jsx)(`code`,{className:`text-white text-xs font-mono flex-1 break-all`,children:u?p.secret:`••••••••••••••••`}),(0,G.jsx)(`button`,{onClick:()=>d(!u),className:`text-bambu-gray hover:text-white`,children:u?(0,G.jsx)(Zs,{className:`w-4 h-4`}):(0,G.jsx)(Qs,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{onClick:()=>{navigator.clipboard.writeText(p.secret)},className:`text-bambu-gray hover:text-white`,children:(0,G.jsx)(Ps,{className:`w-4 h-4`})})]})]}),(0,G.jsx)(Q,{variant:`primary`,className:`w-full`,onClick:()=>a(`confirm`),children:t(`settings.twoFa.scannedContinue`)})]}):i===`confirm`?(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`p`,{className:`text-bambu-gray-light text-sm`,children:t(`settings.twoFa.enterCodeToConfirm`)}),(0,G.jsx)(I8,{value:o,onChange:s,placeholder:`000000`}),(0,G.jsxs)(`div`,{className:`flex gap-3`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>a(`qr`),className:`flex-1`,children:t(`common.back`)}),(0,G.jsx)(Q,{variant:`primary`,className:`flex-1`,disabled:o.length!==6||h.isPending,onClick:()=>h.mutate(o),children:h.isPending?t(`common.saving`):t(`settings.twoFa.activate`)})]})]}):(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`h3`,{className:`text-white font-medium`,children:t(`settings.twoFa.backupCodesTitle`)}),(0,G.jsx)(L8,{codes:c,onDone:e})]})}function EKe(){let{t:e}=U(),t=no(),{showToast:n}=qd(),{user:r}=Nd(),[i,a]=(0,f.useState)(!1),[o,s]=(0,f.useState)(!1),[c,l]=(0,f.useState)(!1),[u,d]=(0,f.useState)(``),[p,m]=(0,f.useState)(``),[h,g]=(0,f.useState)(null),[_,v]=(0,f.useState)(null),[y,b]=(0,f.useState)(``),[x,S]=(0,f.useState)(!1),[C,w]=(0,f.useState)(``),[T,E]=(0,f.useState)(!1),{data:D,isLoading:O}=K({queryKey:[`2fa-status`],queryFn:()=>Z.get2FAStatus()}),{data:k}=K({queryKey:[`oidc-links`],queryFn:()=>Z.getOIDCLinks()}),A=q({mutationFn:()=>Z.enableEmailOTP(),onSuccess:e=>{v(e.setup_token),n(e.message,`success`)},onError:t=>{let r=t.message??``;r.toLowerCase().includes(`smtp`)?n(e(`settings.twoFa.smtpRequired`),`error`):n(r,`error`)}}),j=q({mutationFn:()=>Z.confirmEnableEmailOTP(_,y),onSuccess:()=>{t.invalidateQueries({queryKey:[`2fa-status`]}),v(null),b(``),n(e(`settings.twoFa.emailOtpEnabled`),`success`)},onError:e=>n(e.message,`error`)}),M=q({mutationFn:e=>Z.disableEmailOTP(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`2fa-status`]}),S(!1),w(``),n(e(`settings.twoFa.emailOtpDisabled`),`success`)},onError:e=>n(e.message,`error`)}),N=q({mutationFn:e=>Z.disableTOTP(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`2fa-status`]}),s(!1),d(``),n(e(`settings.twoFa.totpDisabled`),`success`)},onError:()=>n(e(`settings.twoFa.invalidCode`),`error`)}),P=q({mutationFn:e=>Z.regenerateBackupCodes(e),onSuccess:e=>{t.invalidateQueries({queryKey:[`2fa-status`]}),l(!1),m(``),g(e.backup_codes)},onError:()=>n(e(`settings.twoFa.invalidCode`),`error`)}),F=q({mutationFn:e=>Z.deleteOIDCLink(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`oidc-links`]}),n(e(`settings.twoFa.oidcUnlinked`),`success`)},onError:e=>n(e.message,`error`)});if(O)return(0,G.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,G.jsx)(Il,{className:`w-6 h-6 animate-spin text-bambu-green`})});let I=!!r?.email;return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(zd,{id:`card-2fa-totp`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-10 h-10 rounded-full flex items-center justify-center ${D?.totp_enabled?`bg-green-100 dark:bg-green-500/20`:`bg-gray-500/20`}`,children:(0,G.jsx)(cu,{className:`w-5 h-5 ${D?.totp_enabled?`text-green-600 dark:text-green-400`:`text-gray-400`}`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-white font-semibold`,children:e(`settings.twoFa.totpTitle`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-sm`,children:e(`settings.twoFa.totpDesc`)})]}),(0,G.jsx)(`div`,{className:`ml-auto`,children:D?.totp_enabled?(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-green-700 dark:text-green-400 text-sm font-medium`,children:[(0,G.jsx)($l,{className:`w-4 h-4`}),` `,e(`common.enabled`)]}):(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-bambu-gray text-sm`,children:[(0,G.jsx)(eu,{className:`w-4 h-4`}),` `,e(`common.disabled`)]})})]})}),(0,G.jsx)(Vd,{children:i?(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,G.jsx)(`h4`,{className:`text-white font-medium`,children:e(`settings.twoFa.setupAuthApp`)}),(0,G.jsx)(`button`,{onClick:()=>{a(!1),t.removeQueries({queryKey:[`totp-setup`]})},className:`text-bambu-gray hover:text-white`,children:(0,G.jsx)($u,{className:`w-5 h-5`})})]}),(0,G.jsx)(TKe,{onDone:()=>{a(!1),t.removeQueries({queryKey:[`totp-setup`]})}})]}):o?(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`p`,{className:`text-bambu-gray-light text-sm`,children:e(`settings.twoFa.disableConfirmHint`)}),(0,G.jsx)(I8,{value:u,onChange:d,placeholder:`000000 or XXXXXXXX`,maxLength:8}),(0,G.jsxs)(`div`,{className:`flex gap-3`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>{s(!1),d(``)},className:`flex-1`,children:e(`common.cancel`)}),(0,G.jsx)(Q,{variant:`danger`,className:`flex-1`,disabled:u.length<6||N.isPending,onClick:()=>N.mutate(u),children:N.isPending?e(`common.saving`):e(`settings.twoFa.disableTotp`)})]})]}):c?(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`p`,{className:`text-bambu-gray-light text-sm`,children:e(`settings.twoFa.regenBackupHint`)}),(0,G.jsx)(I8,{value:p,onChange:m,placeholder:`000000 or XXXXXXXX`,maxLength:8}),(0,G.jsxs)(`div`,{className:`flex gap-3`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>{l(!1),m(``)},className:`flex-1`,children:e(`common.cancel`)}),(0,G.jsx)(Q,{variant:`primary`,className:`flex-1`,disabled:p.length<6||P.isPending,onClick:()=>P.mutate(p),children:P.isPending?e(`common.saving`):e(`settings.twoFa.regenBackup`)})]})]}):h?(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`h4`,{className:`text-white font-medium`,children:e(`settings.twoFa.newBackupCodes`)}),(0,G.jsx)(L8,{codes:h,onDone:()=>g(null)})]}):(0,G.jsx)(`div`,{className:`space-y-3`,children:D?.totp_enabled?(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-bambu-gray-light`,children:[(0,G.jsx)(Bc,{className:`w-4 h-4`}),e(`settings.twoFa.backupCodesRemaining`,{count:D.backup_codes_remaining})]}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:()=>l(!0),className:`flex items-center gap-2`,children:[(0,G.jsx)(Il,{className:`w-4 h-4`}),e(`settings.twoFa.regenBackup`)]}),(0,G.jsxs)(Q,{variant:`danger`,size:`sm`,onClick:()=>s(!0),className:`flex items-center gap-2`,children:[(0,G.jsx)(ju,{className:`w-4 h-4`}),e(`settings.twoFa.disableTotp`)]})]}):(0,G.jsxs)(Q,{variant:`primary`,onClick:()=>a(!0),className:`flex items-center gap-2`,children:[(0,G.jsx)(cu,{className:`w-4 h-4`}),e(`settings.twoFa.setupTotp`)]})})})]}),(0,G.jsxs)(zd,{id:`card-2fa-emailotp`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-10 h-10 rounded-full flex items-center justify-center ${D?.email_otp_enabled?`bg-green-100 dark:bg-green-500/20`:`bg-gray-500/20`}`,children:(0,G.jsx)($c,{className:`w-5 h-5 ${D?.email_otp_enabled?`text-green-600 dark:text-green-400`:`text-gray-400`}`})}),(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`h3`,{className:`text-white font-semibold`,children:e(`settings.twoFa.emailOtpTitle`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-sm`,children:I?e(`settings.twoFa.emailOtpDesc`,{email:r?.email}):e(`settings.twoFa.emailOtpNoEmail`)})]}),(0,G.jsx)(`div`,{className:`ml-auto`,children:D?.email_otp_enabled?(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-green-700 dark:text-green-400 text-sm font-medium`,children:[(0,G.jsx)($l,{className:`w-4 h-4`}),` `,e(`common.enabled`)]}):(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-bambu-gray text-sm`,children:[(0,G.jsx)(eu,{className:`w-4 h-4`}),` `,e(`common.disabled`)]})})]})}),(0,G.jsx)(Vd,{children:I?_?(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`p`,{className:`text-bambu-gray-light text-sm`,children:e(`settings.twoFa.emailSetupEnterCode`)}),(0,G.jsx)(I8,{value:y,onChange:b,placeholder:`000000`}),(0,G.jsxs)(`div`,{className:`flex gap-3`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>{v(null),b(``)},className:`flex-1`,children:e(`common.cancel`)}),(0,G.jsx)(Q,{variant:`primary`,className:`flex-1`,disabled:y.length!==6||j.isPending,onClick:()=>j.mutate(),children:j.isPending?e(`common.saving`):e(`settings.twoFa.verifyAndEnable`)})]})]}):x?(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`p`,{className:`text-bambu-gray-light text-sm`,children:e(`settings.twoFa.emailDisablePasswordHint`)}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(`input`,{type:T?`text`:`password`,value:C,onChange:e=>w(e.target.value),placeholder:e(`settings.twoFa.passwordPlaceholder`),className:`w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>E(!T),className:`absolute right-3 top-1/2 -translate-y-1/2 text-bambu-gray hover:text-white`,children:T?(0,G.jsx)(Zs,{className:`w-5 h-5`}):(0,G.jsx)(Qs,{className:`w-5 h-5`})})]}),(0,G.jsxs)(`div`,{className:`flex gap-3`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>{S(!1),w(``)},className:`flex-1`,children:e(`common.cancel`)}),(0,G.jsx)(Q,{variant:`danger`,className:`flex-1`,disabled:!C||M.isPending,onClick:()=>M.mutate(C),children:M.isPending?e(`common.saving`):e(`settings.twoFa.disableEmailOtp`)})]})]}):(0,G.jsx)(`div`,{className:`flex gap-3`,children:D?.email_otp_enabled?(0,G.jsxs)(Q,{variant:`danger`,size:`sm`,onClick:()=>S(!0),className:`flex items-center gap-2`,children:[(0,G.jsx)(ju,{className:`w-4 h-4`}),e(`settings.twoFa.disableEmailOtp`)]}):(0,G.jsxs)(Q,{variant:`primary`,disabled:!I||A.isPending,onClick:()=>A.mutate(),className:`flex items-center gap-2`,children:[(0,G.jsx)($c,{className:`w-4 h-4`}),A.isPending?e(`common.saving`):e(`settings.twoFa.enableEmailOtp`)]})}):(0,G.jsx)(`p`,{className:`text-amber-700 dark:text-amber-400 text-sm`,children:e(`settings.twoFa.addEmailFirst`)})})]}),k&&k.length>0&&(0,G.jsxs)(zd,{id:`card-2fa-linked`,children:[(0,G.jsxs)(Bd,{children:[(0,G.jsx)(`h3`,{className:`text-white font-semibold`,children:e(`settings.twoFa.linkedAccounts`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-sm`,children:e(`settings.twoFa.linkedAccountsDesc`)})]}),(0,G.jsx)(Vd,{children:(0,G.jsx)(`div`,{className:`space-y-3`,children:k.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center justify-between py-2 border-b border-bambu-dark-tertiary last:border-0`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white text-sm font-medium`,children:e.provider_name}),e.provider_email&&(0,G.jsx)(`p`,{className:`text-bambu-gray text-xs`,children:e.provider_email})]}),(0,G.jsx)(Q,{variant:`danger`,size:`sm`,onClick:()=>F.mutate(e.provider_id),disabled:F.isPending,children:(0,G.jsx)(ju,{className:`w-4 h-4`})})]},e.id))})})]})]})}var DKe={name:``,issuer_url:``,client_id:``,client_secret:``,scopes:`openid email profile`,is_enabled:!0,auto_create_users:!1,auto_link_existing_accounts:!1,email_claim:`email`,require_email_verified:!0,group_claim:`groups`,group_mapping:{},icon_url:void 0,default_group_id:null,is_autologin:!1};function R8({initial:e,isEdit:t=!1,groups:n=[],onSave:r,onCancel:i,isPending:a}){let{t:o}=U(),[s,c]=(0,f.useState)(e),[l,u]=(0,f.useState)(!1),[d,p]=(0,f.useState)(()=>Object.entries(e.group_mapping??{}).map(([e,t])=>({idpGroup:e,bambuddyGroup:t}))),m=()=>p(e=>[...e,{idpGroup:``,bambuddyGroup:``}]),h=e=>p(t=>t.filter((t,n)=>n!==e)),g=(e,t)=>p(n=>n.map((n,r)=>r===e?{...n,...t}:n)),_=(e,t)=>c(n=>({...n,[e]:t})),v=`w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors text-sm`,y=`block text-sm font-medium text-white mb-1`,b=()=>{let e={...s};t&&!l&&delete e.client_secret,(!e.group_claim||!e.group_claim.trim())&&(e.group_claim=`groups`);let n={};for(let e of d){let t=e.idpGroup.trim();t&&e.bambuddyGroup&&(n[t]=e.bambuddyGroup)}e.group_mapping=n,r(e)},x=new Set(n.map(e=>e.name)),S=d.map((e,t)=>{let n=e.idpGroup.trim();if(!n&&!e.bambuddyGroup)return null;if(!n||!e.bambuddyGroup)return`incomplete`;let r=n.toLowerCase();return d.slice(0,t).some(e=>e.idpGroup.trim().toLowerCase()===r)?`duplicate`:null}),C=S.some(e=>e!==null),w=s.auto_link_existing_accounts===!0,T=s.require_email_verified??!0,E;return E=w?o(`settings.oidc.form.requireEmailVerifiedAutoLink`):T?o(`settings.oidc.form.requireEmailVerifiedDesc`):(0,G.jsx)(`span`,{className:`text-red-700 dark:text-red-400`,children:o(`settings.oidc.form.requireEmailVerifiedWarning`)}),(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{className:y,children:[o(`settings.oidc.form.name`),` `,(0,G.jsx)(`span`,{className:`text-red-700 dark:text-red-400`,children:`*`})]}),(0,G.jsx)(`input`,{className:v,value:s.name,onChange:e=>_(`name`,e.target.value),placeholder:`Google`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{className:y,children:[o(`settings.oidc.form.issuerUrl`),` `,(0,G.jsx)(`span`,{className:`text-red-700 dark:text-red-400`,children:`*`})]}),(0,G.jsx)(`input`,{className:v,value:s.issuer_url,onChange:e=>_(`issuer_url`,e.target.value),placeholder:`https://accounts.google.com`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{className:y,children:[o(`settings.oidc.form.clientId`),` `,(0,G.jsx)(`span`,{className:`text-red-700 dark:text-red-400`,children:`*`})]}),(0,G.jsx)(`input`,{className:v,value:s.client_id,onChange:e=>_(`client_id`,e.target.value),placeholder:`your-client-id`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{className:y,children:[o(`settings.oidc.form.clientSecret`),!t&&(0,G.jsx)(`span`,{className:`text-red-700 dark:text-red-400`,children:` *`}),t&&(0,G.jsxs)(`span`,{className:`text-bambu-gray text-xs ml-1`,children:[`(`,o(`settings.oidc.form.secretHint`),`)`]})]}),(0,G.jsx)(`input`,{className:v,type:`password`,value:l?s.client_secret:``,placeholder:t&&!l?`••••••••`:o(`settings.oidc.form.secretPlaceholder`),onChange:e=>{u(!0),_(`client_secret`,e.target.value)}})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:y,children:o(`settings.oidc.form.scopes`)}),(0,G.jsx)(`input`,{className:v,value:s.scopes,onChange:e=>_(`scopes`,e.target.value),placeholder:`openid email profile`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:y,children:o(`settings.oidc.form.iconUrl`)}),(0,G.jsx)(`input`,{className:v,value:s.icon_url??``,onChange:e=>_(`icon_url`,e.target.value===``?null:e.target.value),placeholder:`https://...`})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-6 pt-2`,children:[(0,G.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,G.jsx)(HH,{checked:s.is_enabled??!0,onChange:e=>_(`is_enabled`,e)}),(0,G.jsx)(`span`,{className:`text-white text-sm`,children:o(`settings.oidc.form.enabled`)})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,G.jsx)(HH,{checked:s.auto_create_users??!1,onChange:e=>_(`auto_create_users`,e)}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white text-sm`,children:o(`settings.oidc.form.autoCreate`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-xs`,children:o(`settings.oidc.form.autoCreateDesc`)})]})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer w-full`,children:[(0,G.jsx)(HH,{checked:s.auto_link_existing_accounts??!1,onChange:e=>_(`auto_link_existing_accounts`,e)}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white text-sm`,children:o(`settings.oidc.form.autoLink`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-xs`,children:o(`settings.oidc.form.autoLinkDesc`)})]})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer w-full`,children:[(0,G.jsx)(HH,{checked:T,onChange:e=>_(`require_email_verified`,e),disabled:w}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white text-sm`,children:o(`settings.oidc.form.requireEmailVerified`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-xs`,children:E})]})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer w-full`,children:[(0,G.jsx)(HH,{checked:s.is_autologin??!1,onChange:e=>_(`is_autologin`,e)}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white text-sm`,children:o(`settings.oidc.form.autologin`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-xs`,children:o(`settings.oidc.form.autologinDesc`)})]})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:y,children:o(`settings.oidc.form.emailClaim`)}),(0,G.jsx)(`input`,{className:v,value:s.email_claim,onChange:e=>_(`email_claim`,e.target.value||`email`),placeholder:o(`settings.oidc.form.emailClaimPlaceholder`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-xs mt-1`,children:o(`settings.oidc.form.emailClaimDesc`)}),w&&s.email_claim!==`email`&&(0,G.jsx)(`p`,{className:`text-yellow-700 dark:text-yellow-400 text-xs mt-1`,children:o(`settings.oidc.form.emailClaimCustomClaimAutoLinkWarning`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:y,children:o(`settings.oidc.form.defaultGroup`)}),(0,G.jsxs)(`select`,{className:v,value:s.default_group_id??``,onChange:e=>_(`default_group_id`,e.target.value?Number(e.target.value):null),children:[(0,G.jsx)(`option`,{value:``,children:o(`settings.oidc.form.defaultGroupViewersFallback`)}),n.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-xs mt-1`,children:o(`settings.oidc.form.defaultGroupDesc`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:y,children:o(`settings.oidc.form.groupClaim`)}),(0,G.jsx)(`input`,{className:v,value:s.group_claim??`groups`,onChange:e=>_(`group_claim`,e.target.value),placeholder:`groups`}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-xs mt-1`,children:o(`settings.oidc.form.groupClaimDesc`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:y,children:o(`settings.oidc.form.groupMapping`)}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[d.map((e,t)=>{let r=e.bambuddyGroup!==``&&!x.has(e.bambuddyGroup);return(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{className:v,value:e.idpGroup,onChange:e=>g(t,{idpGroup:e.target.value}),placeholder:o(`settings.oidc.form.groupMappingIdpGroupPlaceholder`)}),(0,G.jsx)(`span`,{className:`text-bambu-gray text-sm shrink-0`,children:`→`}),(0,G.jsxs)(`select`,{className:`${v} ${r?`border-red-700 dark:border-red-400 text-red-700 dark:text-red-400`:``}`,value:e.bambuddyGroup,onChange:e=>g(t,{bambuddyGroup:e.target.value}),children:[(0,G.jsx)(`option`,{value:``,children:o(`settings.oidc.form.groupMappingSelectGroup`)}),r&&(0,G.jsx)(`option`,{value:e.bambuddyGroup,children:o(`settings.oidc.form.groupMappingDeletedGroupOption`,{group:e.bambuddyGroup})}),n.map(e=>(0,G.jsx)(`option`,{value:e.name,children:e.name},e.id))]}),(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:()=>h(t),title:o(`common.remove`),children:(0,G.jsx)(ju,{className:`w-4 h-4`})})]}),r&&(0,G.jsx)(`p`,{className:`text-red-700 dark:text-red-400 text-xs mt-1`,children:o(`settings.oidc.form.groupMappingDeletedGroupWarning`)}),S[t]&&(0,G.jsx)(`p`,{className:`text-red-700 dark:text-red-400 text-xs mt-1`,children:S[t]===`incomplete`?o(`settings.oidc.form.groupMappingIncompleteRow`):o(`settings.oidc.form.groupMappingDuplicateRow`)})]},t)}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:m,className:`inline-flex items-center gap-2`,children:[(0,G.jsx)(kl,{className:`w-4 h-4`}),o(`settings.oidc.form.groupMappingAddRow`)]})]}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-xs mt-1`,children:o(`settings.oidc.form.groupMappingDesc`)})]}),(0,G.jsxs)(`div`,{className:`flex gap-3 pt-2`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:i,className:`flex-1`,children:o(`common.cancel`)}),(0,G.jsx)(Q,{variant:`primary`,className:`flex-1`,disabled:!s.name||!s.issuer_url||!s.client_id||!t&&!s.client_secret||t&&l&&!s.client_secret||C||a,onClick:b,children:o(a?`common.saving`:`common.save`)})]})]})}function OKe({provider:e}){let[t,n]=(0,f.useState)(!1);return e.has_icon&&!t?(0,G.jsx)(`img`,{src:Z.oidcProviderIconUrl(e.id),alt:e.name,className:`w-8 h-8 rounded object-contain`,onError:()=>n(!0)}):(0,G.jsx)(`div`,{className:`w-8 h-8 rounded-full bg-bambu-dark-tertiary flex items-center justify-center`,children:(0,G.jsx)(Cc,{className:`w-4 h-4 text-bambu-gray`})})}function kKe(){let{t:e}=U(),t=no(),{showToast:n}=qd(),[r,i]=(0,f.useState)(!1),[a,o]=(0,f.useState)(null),[s,c]=(0,f.useState)(null),{data:l,isLoading:u}=K({queryKey:[`oidc-providers-all`],queryFn:()=>Z.getOIDCProvidersAll()}),{data:d=[]}=K({queryKey:[`groups`],queryFn:()=>Z.getGroups()}),p=q({mutationFn:e=>Z.createOIDCProvider(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`oidc-providers-all`]}),i(!1),n(e(`settings.oidc.created`),`success`)},onError:e=>n(e.message,`error`)}),m=q({mutationFn:({id:e,data:t})=>Z.updateOIDCProvider(e,t),onSuccess:()=>{t.invalidateQueries({queryKey:[`oidc-providers-all`]}),o(null),n(e(`settings.oidc.updated`),`success`)},onError:e=>n(e.message,`error`)}),h=q({mutationFn:e=>Z.deleteOIDCProvider(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`oidc-providers-all`]}),c(null),n(e(`settings.oidc.deleted`),`success`)},onError:e=>n(e.message,`error`)}),g=q({mutationFn:e=>Z.refreshOIDCProviderIcon(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`oidc-providers-all`]}),t.invalidateQueries({queryKey:[`oidc-providers`]}),n(e(`settings.oidc.iconRefreshed`),`success`)},onError:t=>n(t.message||e(`settings.oidc.iconFetchFailed`),`error`)}),_=q({mutationFn:e=>Z.deleteOIDCProviderIcon(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`oidc-providers-all`]}),t.invalidateQueries({queryKey:[`oidc-providers`]}),n(e(`settings.oidc.iconRemoved`),`success`)},onError:e=>n(e.message,`error`)}),v=e=>m.mutate({id:e.id,data:{is_enabled:!e.is_enabled}});return u?(0,G.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,G.jsx)(Il,{className:`w-6 h-6 animate-spin text-bambu-green`})}):(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(zd,{id:`card-oidc`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-white font-semibold`,children:e(`settings.oidc.title`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-sm`,children:e(`settings.oidc.desc`)})]}),!r&&(0,G.jsxs)(Q,{variant:`primary`,size:`sm`,onClick:()=>i(!0),className:`flex items-center gap-2`,children:[(0,G.jsx)(kl,{className:`w-4 h-4`}),e(`settings.oidc.addProvider`)]})]})}),r&&(0,G.jsx)(Vd,{children:(0,G.jsxs)(`div`,{className:`border-t border-bambu-dark-tertiary pt-4`,children:[(0,G.jsx)(`h4`,{className:`text-white font-medium mb-4`,children:e(`settings.oidc.newProvider`)}),(0,G.jsx)(R8,{initial:DKe,groups:d,onSave:e=>p.mutate(e),onCancel:()=>i(!1),isPending:p.isPending})]})})]}),l&&l.length===0&&!r&&(0,G.jsx)(zd,{id:`card-oidc-empty`,children:(0,G.jsx)(Vd,{children:(0,G.jsxs)(`div`,{className:`text-center py-8 space-y-3`,children:[(0,G.jsx)(Cc,{className:`w-12 h-12 text-bambu-gray mx-auto`}),(0,G.jsx)(`p`,{className:`text-bambu-gray`,children:e(`settings.oidc.empty`)}),(0,G.jsxs)(Q,{variant:`primary`,size:`sm`,onClick:()=>i(!0),className:`inline-flex items-center gap-2`,children:[(0,G.jsx)(kl,{className:`w-4 h-4`}),e(`settings.oidc.addProvider`)]})]})})}),l?.map(t=>(0,G.jsxs)(zd,{children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(OKe,{provider:t}),(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`h4`,{className:`text-white font-medium`,children:t.name}),t.is_enabled?(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-green-700 dark:text-green-400 bg-green-50 dark:bg-green-400/10 px-2 py-0.5 rounded-full`,children:[(0,G.jsx)(is,{className:`w-3 h-3`}),` `,e(`common.enabled`)]}):(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-bambu-gray bg-bambu-dark-tertiary px-2 py-0.5 rounded-full`,children:[(0,G.jsx)($u,{className:`w-3 h-3`}),` `,e(`common.disabled`)]}),t.is_env_managed&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-bambu-green`,children:[(0,G.jsx)(Xc,{className:`w-3 h-3`}),` `,e(`settings.environmentManagedLabel`)]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1 text-bambu-gray text-xs mt-0.5`,children:[(0,G.jsx)(Xs,{className:`w-3 h-3`}),(0,G.jsx)(`span`,{children:t.issuer_url})]})]}),(0,G.jsx)(`div`,{className:`flex items-center gap-2`,children:!t.is_env_managed&&(0,G.jsxs)(G.Fragment,{children:[t.icon_url&&(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:()=>g.mutate(t.id),disabled:g.isPending,title:e(`settings.oidc.refreshIcon`),"data-testid":`refresh-icon-${t.id}`,children:(0,G.jsx)(Il,{className:`w-4 h-4 ${g.isPending?`animate-spin`:``}`})}),t.has_icon&&(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:()=>_.mutate(t.id),disabled:_.isPending,title:e(`settings.oidc.removeIcon`),"data-testid":`remove-icon-${t.id}`,children:(0,G.jsx)(Fc,{className:`w-4 h-4`})}),(0,G.jsx)(HH,{checked:t.is_enabled,onChange:()=>v(t),disabled:m.isPending}),(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:()=>o(a===t.id?null:t.id),"data-testid":`edit-provider-${t.id}`,children:(0,G.jsx)(Cl,{className:`w-4 h-4`})}),(0,G.jsx)(Q,{variant:`danger`,size:`sm`,onClick:()=>c(t),"data-testid":`delete-provider-${t.id}`,children:(0,G.jsx)(ju,{className:`w-4 h-4`})})]})})]})}),a===t.id&&(0,G.jsx)(Vd,{children:(0,G.jsx)(`div`,{className:`border-t border-bambu-dark-tertiary pt-4`,children:(0,G.jsx)(R8,{isEdit:!0,groups:d,initial:{name:t.name,issuer_url:t.issuer_url,client_id:t.client_id,client_secret:``,scopes:t.scopes,is_enabled:t.is_enabled,auto_create_users:t.auto_create_users,auto_link_existing_accounts:t.auto_link_existing_accounts,email_claim:t.email_claim,require_email_verified:t.require_email_verified,group_claim:t.group_claim??`groups`,group_mapping:t.group_mapping??{},icon_url:t.icon_url??void 0,default_group_id:t.default_group_id??null,is_autologin:t.is_autologin},onSave:e=>m.mutate({id:t.id,data:e}),onCancel:()=>o(null),isPending:m.isPending})})}),a!==t.id&&(0,G.jsx)(Vd,{children:(0,G.jsxs)(`dl`,{className:`grid grid-cols-2 sm:grid-cols-3 gap-x-6 gap-y-2 text-sm`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-bambu-gray`,children:e(`settings.oidc.form.clientId`)}),(0,G.jsx)(`dd`,{className:`text-white font-mono truncate`,children:t.client_id})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-bambu-gray`,children:e(`settings.oidc.form.scopes`)}),(0,G.jsx)(`dd`,{className:`text-white`,children:t.scopes})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-bambu-gray`,children:e(`settings.oidc.form.autoCreate`)}),(0,G.jsx)(`dd`,{className:t.auto_create_users?`text-green-700 dark:text-green-400`:`text-bambu-gray`,children:t.auto_create_users?e(`common.yes`):e(`common.no`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-bambu-gray`,children:e(`settings.oidc.form.autoLink`)}),(0,G.jsx)(`dd`,{className:t.auto_link_existing_accounts?`text-green-700 dark:text-green-400`:`text-bambu-gray`,children:t.auto_link_existing_accounts?e(`common.yes`):e(`common.no`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-bambu-gray`,children:e(`settings.oidc.form.emailClaim`)}),(0,G.jsx)(`dd`,{className:`text-white font-mono`,children:t.email_claim})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-bambu-gray`,children:e(`settings.oidc.form.groupClaim`)}),(0,G.jsx)(`dd`,{className:`text-white font-mono`,children:t.group_claim??`groups`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-bambu-gray`,children:e(`settings.oidc.form.requireEmailVerified`)}),(0,G.jsx)(`dd`,{className:t.require_email_verified?`text-green-700 dark:text-green-400`:`text-red-700 dark:text-red-400`,children:t.require_email_verified?e(`common.yes`):e(`common.no`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-bambu-gray`,children:e(`settings.oidc.form.defaultGroup`)}),(0,G.jsx)(`dd`,{className:`text-white`,children:t.default_group_id?d.find(e=>e.id===t.default_group_id)?.name??e(`settings.oidc.form.defaultGroupViewersFallback`):e(`settings.oidc.form.defaultGroupViewersFallback`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-bambu-gray`,children:e(`settings.oidc.form.groupSync`)}),(0,G.jsx)(`dd`,{className:t.group_mapping&&Object.keys(t.group_mapping).length>0?`text-green-700 dark:text-green-400`:`text-bambu-gray`,children:t.group_mapping&&Object.keys(t.group_mapping).length>0?e(`settings.oidc.form.groupSyncOn`):e(`common.off`)})]})]})})]},t.id)),s&&(0,G.jsx)(af,{title:e(`settings.oidc.deleteTitle`),message:e(`settings.oidc.deleteMessage`,{name:s.name}),confirmText:e(`common.delete`),variant:`danger`,onConfirm:()=>h.mutate(s.id),onCancel:()=>c(null)})]})}var z8=new Map;function B8(e){z8.set(e.anchor,e)}function AKe(){return Array.from(z8.values())}B8({labelKey:`settings.encryption.title`,labelFallback:`MFA Encryption Status`,tab:`users`,subTab:`security`,keywords:`mfa encryption status security backup totp oidc fernet`,anchor:`card-mfa-encryption`});function jKe(){let{t:e}=U(),{data:t,isLoading:n,isError:r,refetch:i}=K({queryKey:[`encryptionStatus`],queryFn:()=>Z.getEncryptionStatus(),refetchInterval:e=>{if(!e.state.error)return 3e4;let t=e.state.fetchFailureCount??0;return t<=3?Math.min(5e3*Math.max(1,t),3e4):!1}});if(n)return(0,G.jsxs)(zd,{id:`card-mfa-encryption`,"data-testid":`encryption-status-card`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(tu,{className:`text-bambu-gray`,size:20}),(0,G.jsx)(`h2`,{className:`text-lg font-semibold`,children:e(`settings.encryption.title`)})]})}),(0,G.jsx)(Vd,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-bambu-gray`,"data-testid":`encryption-loading`,children:[(0,G.jsx)(Y,{className:`animate-spin`,size:16}),(0,G.jsx)(`span`,{children:e(`common.loading`)})]})})]});if(r||!t)return(0,G.jsxs)(zd,{id:`card-mfa-encryption`,"data-testid":`encryption-status-card`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(tu,{className:`text-bambu-gray`,size:20}),(0,G.jsx)(`h2`,{className:`text-lg font-semibold`,children:e(`settings.encryption.title`)})]})}),(0,G.jsxs)(Vd,{children:[(0,G.jsx)(`div`,{className:`text-red-700 dark:text-red-400`,"data-testid":`encryption-error`,children:e(`common.errorLoading`)}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>i(),className:`mt-2 text-sm text-blue-700 dark:text-blue-400 underline hover:text-blue-800 dark:hover:text-blue-300`,"data-testid":`encryption-retry-button`,children:e(`common.retry`)})]})]});let a=t.legacy_plaintext_rows.oidc_providers+t.legacy_plaintext_rows.user_totp,o=t.encrypted_rows.oidc_providers+t.encrypted_rows.user_totp,s,c,l,u;t.decryption_broken?(s=`bg-red-100 dark:bg-red-500/20 border-red-400 dark:border-red-500/50 text-red-700 dark:text-red-400`,c=(0,G.jsx)(bs,{className:`text-red-600 dark:text-red-400`,size:20}),l=e(`settings.encryption.decryptionBrokenTitle`),u=e(`settings.encryption.decryptionBrokenError`,{count:o})):t.key_source===`generated`?(s=`bg-amber-50 dark:bg-amber-500/10 border-amber-300 dark:border-amber-500/30 text-amber-700 dark:text-amber-400`,c=(0,G.jsx)($l,{className:`text-amber-600 dark:text-amber-400`,size:20}),l=e(`settings.encryption.enabledGenerated`),u=e(`settings.encryption.backupHint`)):a>0?(s=`bg-amber-50 dark:bg-amber-500/10 border-amber-300 dark:border-amber-500/30 text-amber-700 dark:text-amber-400`,c=(0,G.jsx)(Pu,{className:`text-amber-600 dark:text-amber-400`,size:20}),l=t.key_source===`env`?e(`settings.encryption.enabledFromEnv`):e(`settings.encryption.enabledFromFile`),u=e(`settings.encryption.legacyRowsWarning`,{count:a})):t.key_configured?(s=`bg-green-100 dark:bg-green-500/20 border-green-300 dark:border-green-500/30 text-green-700 dark:text-green-400`,c=(0,G.jsx)($l,{className:`text-green-600 dark:text-green-400`,size:20}),l=t.key_source===`env`?e(`settings.encryption.enabledFromEnv`):e(`settings.encryption.enabledFromFile`),u=e(`settings.encryption.allEncrypted`)):(s=`bg-gray-500/20 border-gray-500/30 text-gray-400`,c=(0,G.jsx)(eu,{className:`text-gray-400`,size:20}),l=e(`settings.encryption.notConfigured`),u=e(`settings.encryption.notConfiguredDesc`));let d=t.key_source===`generated`&&a>0;return(0,G.jsxs)(zd,{id:`card-mfa-encryption`,"data-testid":`encryption-status-card`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[c,(0,G.jsx)(`h2`,{className:`text-lg font-semibold`,children:e(`settings.encryption.title`)})]})}),(0,G.jsxs)(Vd,{children:[(0,G.jsxs)(`div`,{className:`p-3 border rounded-lg ${s}`,"data-testid":`encryption-status`,children:[(0,G.jsx)(`p`,{className:`font-medium mb-1`,children:l}),(0,G.jsx)(`p`,{className:`text-sm`,children:u})]}),d&&(0,G.jsx)(`div`,{className:`mt-2 p-3 border rounded-lg bg-amber-50 dark:bg-amber-500/10 border-amber-300 dark:border-amber-500/30 text-amber-700 dark:text-amber-400`,"data-testid":`encryption-legacy-warning`,children:(0,G.jsx)(`p`,{className:`text-sm`,children:e(`settings.encryption.legacyRowsWarning`,{count:a})})}),t.migration_error_count>0&&(0,G.jsx)(`div`,{className:`mt-2 p-3 border rounded-lg bg-amber-50 dark:bg-amber-500/10 border-amber-300 dark:border-amber-500/30 text-amber-700 dark:text-amber-400`,"data-testid":`encryption-migration-warning`,children:(0,G.jsx)(`p`,{className:`text-sm`,children:e(`settings.encryption.migrationErrorWarning`,{count:t.migration_error_count})})}),(0,G.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-4 text-sm`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-bambu-gray`,children:e(`settings.encryption.encryptedRowsLabel`)}),(0,G.jsxs)(`p`,{className:`font-medium`,children:[`OIDC: `,t.encrypted_rows.oidc_providers,` · TOTP: `,t.encrypted_rows.user_totp]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-bambu-gray`,children:e(`settings.encryption.legacyRowsLabel`)}),(0,G.jsxs)(`p`,{className:`font-medium`,children:[`OIDC: `,t.legacy_plaintext_rows.oidc_providers,` · TOTP: `,t.legacy_plaintext_rows.user_totp]})]})]})]})]})}var MKe={get:`bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400 border-blue-300 dark:border-blue-500/30`,post:`bg-green-100 dark:bg-green-500/20 text-green-700 dark:text-green-400 border-green-300 dark:border-green-500/30`,put:`bg-yellow-100 dark:bg-yellow-500/20 text-yellow-700 dark:text-yellow-400 border-yellow-300 dark:border-yellow-500/30`,patch:`bg-orange-100 dark:bg-orange-500/20 text-orange-700 dark:text-orange-400 border-orange-300 dark:border-orange-500/30`,delete:`bg-red-100 dark:bg-red-500/20 text-red-700 dark:text-red-400 border-red-300 dark:border-red-500/30`};function NKe(e,t){let n=t.replace(`#/`,``).split(`/`),r=e;for(let e of n)r=r[e];return r}function V8(e,t,n=0){if(n>5)return`...`;if(t.$ref)return V8(e,NKe(e,t.$ref),n+1);if(t.allOf){let r={};for(let i of t.allOf){let t=V8(e,i,n+1);typeof t==`object`&&t&&Object.assign(r,t)}return r}if(t.example!==void 0)return t.example;if(t.default!==void 0)return t.default;switch(t.type){case`string`:return t.enum?t.enum[0]:`string`;case`integer`:case`number`:return 0;case`boolean`:return!1;case`array`:return t.items?[V8(e,t.items,n+1)]:[];case`object`:if(t.properties){let r={};for(let[i,a]of Object.entries(t.properties))r[i]=V8(e,a,n+1);return r}return{};default:return null}}function PKe({path:e,method:t,spec:n,schema:r,apiKey:i}){let[a,o]=(0,f.useState)(!1),[s,c]=(0,f.useState)({}),[l,u]=(0,f.useState)(``),[d,p]=(0,f.useState)(null),[m,h]=(0,f.useState)(!1),[g,_]=(0,f.useState)(!1);(0,f.useEffect)(()=>{if(a&&n.parameters){let e={};for(let t of n.parameters)t.schema?.default!==void 0&&(e[t.name]=String(t.schema.default));c(t=>({...e,...t}))}},[a,n.parameters]),(0,f.useEffect)(()=>{if(a&&n.requestBody?.content?.[`application/json`]?.schema&&!l){let e=n.requestBody.content[`application/json`].schema,t=V8(r,e);u(JSON.stringify(t,null,2))}},[a,n.requestBody,r,l]);let v=(()=>{let e=[];for(let t of n.parameters||[])if(t.in===`path`||t.required){let n=s[t.name];(n===void 0||n===``)&&e.push(t.name)}return e})(),y=async()=>{if(v.length>0){p({status:0,statusText:`Validation Error`,headers:{},body:`Missing required parameters: ${v.join(`, `)}`,duration:0});return}h(!0),p(null);try{let r=e,a=new URLSearchParams;for(let e of n.parameters||[]){let t=s[e.name];t!==void 0&&t!==``&&(e.in===`path`?r=r.replace(`{${e.name}}`,encodeURIComponent(t)):e.in===`query`&&a.append(e.name,t))}let o=a.toString(),c=`${r}${o?`?${o}`:``}`,u={"Content-Type":`application/json`};i&&(u[`X-API-Key`]=i);let d={method:t.toUpperCase(),headers:u};[`post`,`put`,`patch`].includes(t)&&l&&(d.body=l);let f=performance.now(),m=await fetch(c,d),h=Math.round(performance.now()-f),g={};m.headers.forEach((e,t)=>{g[t]=e});let _;_=m.headers.get(`content-type`)?.includes(`application/json`)?await m.json():await m.text(),p({status:m.status,statusText:m.statusText,headers:g,body:_,duration:h})}catch(e){p({status:0,statusText:`Network Error`,headers:{},body:e instanceof Error?e.message:`Unknown error`,duration:0})}finally{h(!1)}},b=async()=>{if(d){let e=typeof d.body==`string`?d.body:JSON.stringify(d.body,null,2);try{await navigator.clipboard.writeText(e),_(!0),setTimeout(()=>_(!1),2e3)}catch{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.left=`-999999px`,document.body.appendChild(t),t.select(),document.execCommand(`copy`),document.body.removeChild(t),_(!0),setTimeout(()=>_(!1),2e3)}}},x=(n.parameters||[]).filter(e=>e.in===`path`),S=(n.parameters||[]).filter(e=>e.in===`query`),C=[`post`,`put`,`patch`].includes(t)&&n.requestBody;return(0,G.jsxs)(`div`,{className:`border border-bambu-dark-tertiary rounded-lg overflow-hidden`,children:[(0,G.jsxs)(`button`,{onClick:()=>o(!a),className:`w-full flex items-center gap-3 p-3 hover:bg-bambu-dark-tertiary/50 transition-colors text-left`,children:[a?(0,G.jsx)(as,{className:`w-4 h-4 text-bambu-gray flex-shrink-0`}):(0,G.jsx)(ss,{className:`w-4 h-4 text-bambu-gray flex-shrink-0`}),(0,G.jsx)(`span`,{className:`px-2 py-0.5 text-xs font-mono font-semibold uppercase rounded border ${MKe[t]||`bg-gray-500/20 text-gray-400`}`,children:t}),(0,G.jsx)(`code`,{className:`text-sm text-white font-mono flex-1 truncate`,children:e}),n.summary&&(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray truncate max-w-[40%]`,children:n.summary})]}),a&&(0,G.jsxs)(`div`,{className:`border-t border-bambu-dark-tertiary p-4 space-y-4 bg-bambu-dark/50`,children:[n.description&&(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:n.description}),x.length>0&&(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`h4`,{className:`text-sm font-medium text-white`,children:`Path Parameters`}),(0,G.jsx)(`div`,{className:`space-y-2`,children:x.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`label`,{className:`text-sm text-bambu-gray w-32 flex-shrink-0`,children:[e.name,e.required&&(0,G.jsx)(`span`,{className:`text-red-700 dark:text-red-400 ml-1`,children:`*`})]}),(0,G.jsx)(`input`,{type:`text`,value:s[e.name]||``,onChange:t=>c(n=>({...n,[e.name]:t.target.value})),placeholder:e.description||e.schema?.type||`value`,className:`flex-1 px-2 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm font-mono focus:border-bambu-green focus:outline-none`})]},e.name))})]}),S.length>0&&(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`h4`,{className:`text-sm font-medium text-white`,children:`Query Parameters`}),(0,G.jsx)(`div`,{className:`space-y-2`,children:S.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`label`,{className:`text-sm text-bambu-gray w-32 flex-shrink-0`,children:[e.name,e.required&&(0,G.jsx)(`span`,{className:`text-red-700 dark:text-red-400 ml-1`,children:`*`})]}),e.schema?.enum?(0,G.jsxs)(`select`,{value:s[e.name]||``,onChange:t=>c(n=>({...n,[e.name]:t.target.value})),className:`flex-1 px-2 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none`,children:[(0,G.jsx)(`option`,{value:``,children:`-- Select --`}),e.schema.enum.map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))]}):(0,G.jsx)(`input`,{type:`text`,value:s[e.name]||``,onChange:t=>c(n=>({...n,[e.name]:t.target.value})),placeholder:e.description||e.schema?.type||`value`,className:`flex-1 px-2 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm font-mono focus:border-bambu-green focus:outline-none`})]},e.name))})]}),C&&(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`h4`,{className:`text-sm font-medium text-white`,children:`Request Body`}),(0,G.jsx)(`textarea`,{value:l,onChange:e=>u(e.target.value),rows:8,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm font-mono focus:border-bambu-green focus:outline-none resize-y`,placeholder:`JSON request body...`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(Q,{onClick:y,disabled:m,children:[m?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(Dl,{className:`w-4 h-4`}),`Execute`]}),v.length>0&&(0,G.jsxs)(`span`,{className:`text-xs text-yellow-700 dark:text-yellow-400 flex items-center gap-1`,children:[(0,G.jsx)(fs,{className:`w-3 h-3`}),`Fill in: `,v.join(`, `)]})]}),d&&(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`h4`,{className:`text-sm font-medium text-white flex items-center gap-2`,children:[`Response`,(0,G.jsxs)(`span`,{className:`px-2 py-0.5 text-xs rounded ${d.status>=200&&d.status<300?`bg-green-100 dark:bg-green-500/20 text-green-700 dark:text-green-400`:d.status>=400?`bg-red-100 dark:bg-red-500/20 text-red-700 dark:text-red-400`:`bg-yellow-100 dark:bg-yellow-500/20 text-yellow-700 dark:text-yellow-400`}`,children:[d.status,` `,d.statusText]}),(0,G.jsxs)(`span`,{className:`text-xs text-bambu-gray`,children:[d.duration,`ms`]})]}),(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:b,children:g?(0,G.jsx)(ms,{className:`w-3 h-3 text-green-600 dark:text-green-400`}):(0,G.jsx)(Ps,{className:`w-3 h-3`})})]}),(0,G.jsx)(`pre`,{className:`p-3 bg-bambu-dark rounded-lg text-sm font-mono text-white overflow-auto max-h-96 border border-bambu-dark-tertiary`,children:typeof d.body==`string`?d.body:JSON.stringify(d.body,null,2)})]})]})]})}function FKe({apiKey:e=``}){let[t,n]=(0,f.useState)(null),[r,i]=(0,f.useState)(!0),[a,o]=(0,f.useState)(null),[s,c]=(0,f.useState)(new Set),[l,u]=(0,f.useState)(``);if((0,f.useEffect)(()=>{async function e(){try{let e=await fetch(`/openapi.json`);if(!e.ok)throw Error(`Failed to fetch OpenAPI schema`);n(await e.json())}catch(e){o(e instanceof Error?e.message:`Unknown error`)}finally{i(!1)}}e()},[]),r)return(0,G.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,G.jsx)(Y,{className:`w-8 h-8 text-bambu-green animate-spin`})});if(a||!t)return(0,G.jsx)(zd,{children:(0,G.jsx)(Vd,{className:`py-8`,children:(0,G.jsxs)(`div`,{className:`text-center text-red-700 dark:text-red-400`,children:[(0,G.jsx)(fs,{className:`w-12 h-12 mx-auto mb-3 opacity-50`}),(0,G.jsx)(`p`,{children:`Failed to load API schema`}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:a})]})})});let d={};for(let[e,n]of Object.entries(t.paths))for(let[t,r]of Object.entries(n)){if(t===`parameters`)continue;let n=r.tags||[`Other`];for(let i of n)d[i]||(d[i]=[]),d[i].push({path:e,method:t,spec:r})}let p=Object.entries(d).map(([e,t])=>l?{tag:e,endpoints:t.filter(({path:e,method:t,spec:n})=>{let r=l.toLowerCase();return e.toLowerCase().includes(r)||t.toLowerCase().includes(r)||(n.summary?.toLowerCase()||``).includes(r)||(n.description?.toLowerCase()||``).includes(r)})}:{tag:e,endpoints:t}).filter(({endpoints:e})=>e.length>0).sort((e,t)=>e.tag.localeCompare(t.tag)),m=e=>{c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,G.jsx)(`div`,{className:`flex-1`,children:(0,G.jsx)(`input`,{type:`text`,value:l,onChange:e=>u(e.target.value),placeholder:`Search endpoints...`,className:`w-full max-w-md px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:()=>{c(new Set(p.map(e=>e.tag)))},children:`Expand All`}),(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:()=>{c(new Set)},children:`Collapse All`}),(0,G.jsxs)(`a`,{href:`/docs`,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-1 text-sm text-bambu-green hover:underline`,children:[(0,G.jsx)(Xs,{className:`w-4 h-4`}),`Swagger UI`]})]})]}),(0,G.jsxs)(`p`,{className:`text-sm text-bambu-gray`,children:[p.reduce((e,t)=>e+t.endpoints.length,0),` endpoints in `,p.length,` categories`]}),(0,G.jsx)(`div`,{className:`space-y-3`,children:p.map(({tag:n,endpoints:r})=>(0,G.jsxs)(zd,{children:[(0,G.jsx)(`button`,{onClick:()=>m(n),className:`w-full flex items-center justify-between p-4 hover:bg-bambu-dark-tertiary/30 transition-colors text-left`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s.has(n)?(0,G.jsx)(as,{className:`w-5 h-5 text-bambu-gray`}):(0,G.jsx)(ss,{className:`w-5 h-5 text-bambu-gray`}),(0,G.jsx)(`h3`,{className:`text-base font-semibold text-white capitalize`,children:n.replace(/-/g,` `)}),(0,G.jsx)(`span`,{className:`text-xs bg-bambu-dark-tertiary px-2 py-0.5 rounded-full text-bambu-gray`,children:r.length})]})}),s.has(n)&&(0,G.jsx)(Vd,{className:`pt-0 space-y-2`,children:r.map(({path:n,method:r,spec:i})=>(0,G.jsx)(PKe,{path:n,method:r,spec:i,schema:t,apiKey:e},`${r}-${n}`))})]},n))})]})}var IKe=[{id:`sidecar`,labelKey:`settings.sliceEngineSidecar`,descriptionKey:`settings.sliceEngineSidecarHint`,available:!0},{id:`browser`,labelKey:`settings.sliceEngineBrowser`,descriptionKey:`settings.sliceEngineBrowserHint`,available:!1}];function H8(){return IKe.filter(e=>e.available)}function LKe(){return H8().length>1}function U8(e){return H8().find(t=>t.id===e)?.id??`sidecar`}var RKe=[`general`,`plugs`,`sensors`,`notifications`,`queue`,`filament`,`network`,`apikeys`,`virtual-printer`,`spoolbuddy`,`failure-detection`,`users`,`backup`];B8({labelKey:`settings.general`,tab:`general`,keywords:`language date time format printer model printers cards`,anchor:`card-general`}),B8({labelKey:`settings.appearance`,tab:`general`,keywords:`theme dark light mode colors`,anchor:`card-appearance`}),B8({labelKey:`settings.archiveSettings`,tab:`general`,keywords:`archive auto save thumbnails captures`,anchor:`card-archive`}),B8({labelKey:`settings.camera`,tab:`general`,keywords:`camera external video stream`,anchor:`card-camera`}),B8({labelKey:`settings.costTracking`,tab:`general`,keywords:`currency filament cost energy kwh price`,anchor:`card-cost`}),B8({labelKey:`settings.fileManager`,tab:`general`,keywords:`file manager archive mode disk warning storage`,anchor:`card-filemanager`}),B8({labelKey:`settings.updates`,tab:`general`,keywords:`updates version firmware beta check`,anchor:`card-updates`}),B8({labelKey:`settings.dataManagement`,tab:`general`,keywords:`data reset clear logs notifications preferences`,anchor:`card-data`}),B8({labelKey:`settings.smartPlugs`,tab:`plugs`,keywords:`smart plug energy power automation tapo kasa tplink shelly`,anchor:`card-plugs`}),B8({labelKey:`haSensors.sectionTitle`,tab:`sensors`,keywords:`home assistant sensor printer temperature humidity alert notify block print`,anchor:`card-ha-sensors`}),B8({labelKey:`locationHaSensors.sectionTitle`,tab:`sensors`,keywords:`home assistant sensor location storage box temperature humidity battery alert notify`,anchor:`card-location-sensors`}),B8({labelKey:`settings.providers`,tab:`notifications`,keywords:`telegram discord email notification providers webhook`,anchor:`card-providers`}),B8({labelKey:`settings.messageTemplates`,tab:`notifications`,keywords:`message templates notification text edit`,anchor:`card-templates`}),B8({labelKey:`settings.defaultPrintOptions`,labelFallback:`Default Print Options`,tab:`queue`,keywords:`print bed leveling flow calibration vibration first layer timelapse`,anchor:`card-print-options`}),B8({labelKey:`settings.tempFanPresetsTitle`,labelFallback:`Temperature & Fan Presets`,tab:`queue`,keywords:`temperature fan presets nozzle bed chamber quick buttons popover`,anchor:`card-temp-fan-presets`}),B8({labelKey:`settings.staggeredStart`,labelFallback:`Staggered Start`,tab:`queue`,keywords:`staggered batch delay start queue group`,anchor:`card-staggered`}),B8({labelKey:`settings.plateClear`,labelFallback:`Plate-Clear Confirmation`,tab:`queue`,keywords:`plate clear confirm auto queue`,anchor:`card-plate`}),B8({labelKey:`settings.concurrentUploadsTitle`,labelFallback:`Concurrent Uploads`,tab:`queue`,keywords:`concurrent parallel upload transfer ftp queue slow farm simultaneous`,anchor:`card-concurrent-uploads`}),B8({labelKey:`settings.gcodeInjection`,labelFallback:`G-code Injection`,tab:`queue`,keywords:`gcode injection start end autoprint farmloop swapmod autoclear printflow`,anchor:`card-gcode`}),B8({labelKey:`settings.slicerCard`,labelFallback:`Slicer`,tab:`queue`,keywords:`slicer orcaslicer bambustudio orca bambu api sidecar url docker preferred`,anchor:`card-slicer`}),B8({labelKey:`settings.queueDrying`,tab:`queue`,keywords:`drying presets temperature time humidity ams`,anchor:`card-drying`}),B8({labelKey:`settings.filamentChecks`,tab:`filament`,keywords:`filament check warning runout remaining`,anchor:`card-filamentchecks`}),B8({labelKey:`settings.printModal`,tab:`filament`,keywords:`print modal custom mapping`,anchor:`card-printmodal`}),B8({labelKey:`settings.amsDisplayThresholds`,tab:`filament`,keywords:`ams humidity temperature threshold history retention`,anchor:`card-amsthresholds`}),B8({labelKey:`settings.externalUrl`,tab:`network`,keywords:`external url reverse proxy public notification link`,anchor:`card-externalurl`}),B8({labelKey:`settings.ftpRetry`,tab:`network`,keywords:`ftp retry upload retries backoff`,anchor:`card-ftpretry`}),B8({labelKey:`settings.homeAssistant`,tab:`network`,keywords:`home assistant ha hass mqtt integration`,anchor:`card-ha`}),B8({labelKey:`settings.mqttPublishing`,tab:`network`,keywords:`mqtt publish broker topic`,anchor:`card-mqtt`}),B8({labelKey:`settings.prometheusMetrics`,tab:`network`,keywords:`prometheus metrics grafana monitoring bearer token`,anchor:`card-prometheus`}),B8({labelKey:`settings.createNewApiKey`,tab:`apikeys`,keywords:`api key create permission scope`,anchor:`card-createapi`}),B8({labelKey:`settings.webhookEndpoints`,tab:`apikeys`,keywords:`webhook endpoint post http`,anchor:`card-webhooks`}),B8({labelKey:`settings.apiBrowser`,tab:`apikeys`,keywords:`api browser endpoint documentation test`,anchor:`card-apibrowser`}),B8({labelKey:`connectedApps.title`,tab:`apikeys`,keywords:`connected app sign in single sign-on sso oauth login orders`,anchor:`card-connected-apps`}),B8({labelKey:`cameraTokens.title`,tab:`apikeys`,keywords:`camera token long-lived home assistant frigate kiosk stream`,anchor:`card-camera-tokens`}),B8({labelKey:`settings.tabs.virtualPrinter`,tab:`virtual-printer`,keywords:`virtual printer proxy archive slicer bambustudio orcaslicer ip bind`,anchor:`card-vp`}),B8({labelKey:`settings.tabs.spoolbuddy`,tab:`spoolbuddy`,keywords:`spoolbuddy device scale nfc rfid kiosk unregister`,anchor:`card-spoolbuddy`}),B8({labelKey:`settings.currentUser`,tab:`users`,subTab:`users`,keywords:`current user profile password change`,anchor:`card-currentuser`}),B8({labelKey:`settings.users`,tab:`users`,subTab:`users`,keywords:`users accounts list`,anchor:`card-users`}),B8({labelKey:`settings.groups`,tab:`users`,subTab:`users`,keywords:`groups roles permissions administrators operators viewers`,anchor:`card-groups`}),B8({labelKey:`settings.sessionPolicy.title`,labelFallback:`Session Policy`,tab:`users`,subTab:`users`,keywords:`session timeout expiry logout remember me jwt token lifetime`,anchor:`card-session-policy`}),B8({labelKey:`settings.email.smtpSettings`,labelFallback:`SMTP Configuration`,tab:`users`,subTab:`email`,keywords:`smtp email send server port password auth starttls ssl`,anchor:`card-smtp`}),B8({labelKey:`settings.ldap.title`,labelFallback:`LDAP Authentication`,tab:`users`,subTab:`ldap`,keywords:`ldap active directory ad authentication bind dn search base group mapping`,anchor:`card-ldap`}),B8({labelKey:`settings.tabs.backup`,tab:`backup`,keywords:`backup github restore download cloud sync profiles archives`,anchor:`card-backup`}),B8({labelKey:`externalLinks.sidebarLayout`,labelFallback:`Sidebar`,tab:`general`,keywords:`sidebar layout links pages hide show external custom navigation url add`,anchor:`card-sidebar-links`}),B8({labelKey:`settings.filamentTracking`,tab:`filament`,keywords:`spoolman filament tracking inventory sync remote integration`,anchor:`card-spoolman`}),B8({labelKey:`settings.catalog.spoolCatalog`,labelFallback:`Spool Catalog`,tab:`filament`,keywords:`spool catalog entries brand material reset import export`,anchor:`card-spool-catalog`}),B8({labelKey:`settings.colorCatalog.title`,labelFallback:`Color Catalog`,tab:`filament`,keywords:`color catalog hex swatch palette sync reset`,anchor:`card-color-catalog`}),B8({labelKey:`settings.tabs.failureDetection`,labelFallback:`Failure Detection`,tab:`failure-detection`,keywords:`failure detection ai ml obico spaghetti detect monitoring`,anchor:`card-fd-ml`}),B8({labelKey:`failureDetection.perPrinterTitle`,labelFallback:`Per-Printer Settings`,tab:`failure-detection`,keywords:`failure detection per printer enable per-printer sensitivity`,anchor:`card-fd-perprinter`}),B8({labelKey:`failureDetection.statusTitle`,labelFallback:`Detection Status`,tab:`failure-detection`,keywords:`failure detection status running connection`,anchor:`card-fd-status`}),B8({labelKey:`failureDetection.historyTitle`,labelFallback:`Detection History`,tab:`failure-detection`,keywords:`failure detection history log events`,anchor:`card-fd-history`}),B8({labelKey:`settings.email.advancedAuth`,labelFallback:`Advanced Email Authentication`,tab:`users`,subTab:`email`,keywords:`email authentication advanced password reset self-service forgot`,anchor:`card-email-advanced-auth`}),B8({labelKey:`settings.email.testConnection`,labelFallback:`Test SMTP Connection`,tab:`users`,subTab:`email`,keywords:`email smtp test connection send check`,anchor:`card-email-test`}),B8({labelKey:`settings.twoFa.totpTitle`,labelFallback:`Authenticator App (TOTP)`,tab:`users`,subTab:`twofa`,keywords:`two factor 2fa totp authenticator app google authy otp`,anchor:`card-2fa-totp`}),B8({labelKey:`settings.twoFa.emailOtpTitle`,labelFallback:`Email One-Time Codes`,tab:`users`,subTab:`twofa`,keywords:`two factor 2fa email otp one time code`,anchor:`card-2fa-emailotp`}),B8({labelKey:`settings.twoFa.linkedAccounts`,labelFallback:`Linked Accounts`,tab:`users`,subTab:`twofa`,keywords:`two factor 2fa linked accounts sso oidc provider google github`,anchor:`card-2fa-linked`}),B8({labelKey:`settings.oidc.title`,labelFallback:`Single Sign-On (OIDC)`,tab:`users`,subTab:`oidc`,keywords:`sso oidc openid single sign-on pocketid authentik keycloak google okta azure provider`,anchor:`card-oidc`}),B8({labelKey:`settings.ldap.serverConfig`,labelFallback:`LDAP Server Configuration`,tab:`users`,subTab:`ldap`,keywords:`ldap server url bind dn user search base group filter tls`,anchor:`card-ldap-server`}),B8({labelKey:`backup.githubBackup`,labelFallback:`GitHub Backup`,tab:`backup`,keywords:`github backup cloud remote sync profiles token`,anchor:`card-backup-github`}),B8({labelKey:`backup.history`,labelFallback:`Backup History`,tab:`backup`,keywords:`backup history log runs github commits`,anchor:`card-backup-history`}),B8({labelKey:`backup.localBackup`,labelFallback:`Local Backup`,tab:`backup`,keywords:`local backup download zip manual export`,anchor:`card-backup-local`}),B8({labelKey:`backup.scheduledBackup`,labelFallback:`Scheduled Backups`,tab:`backup`,keywords:`scheduled backup automatic hourly daily weekly retention local path`,anchor:`card-backup-scheduled`});var W8=20,zKe={database:`bg-blue-600`,library_files:`bg-green-500`,library_thumbnails:`bg-teal-500`,library_other:`bg-emerald-700`,archive_timelapses:`bg-red-500`,archive_thumbnails:`bg-amber-500`,archive_files:`bg-sky-500`,virtual_printer_uploads:`bg-purple-500`,virtual_printer_upload_cache:`bg-fuchsia-500`,virtual_printer_certs:`bg-violet-500`,virtual_printer_other:`bg-purple-700`,downloads:`bg-cyan-500`,plate_calibration:`bg-lime-500`,logs:`bg-orange-500`,other_data:`bg-yellow-500`},G8=[`bg-blue-500`,`bg-green-500`,`bg-yellow-500`,`bg-red-500`,`bg-orange-500`,`bg-teal-500`,`bg-cyan-500`,`bg-purple-500`],K8=(e,t)=>zKe[e]||G8[t%G8.length],q8={temperature:0,humidity:1,battery:2};function BKe(e,t){return e?vE(e,t,{decimals:2}):null}function VKe(){let e=no(),t=$n(),[n,r]=ji(),{t:i,i18n:a}=U(),{showToast:o}=qd(),{authEnabled:s,user:c,isAdmin:l,refreshAuth:u,hasPermission:d}=Nd(),{mode:p,resolvedMode:m,darkStyle:h,darkBackground:g,darkAccent:_,lightStyle:v,lightBackground:y,lightAccent:b,setMode:x,setDarkStyle:S,setDarkBackground:C,setDarkAccent:w,setLightStyle:T,setLightBackground:E,setLightAccent:D,progressInTitle:O,setProgressInTitle:k}=Id(),[A,j]=(0,f.useState)(null),[M,N]=(0,f.useState)({}),[P,F]=(0,f.useState)(null),[I,L]=(0,f.useState)(!1),[R,z]=(0,f.useState)(null),[B,V]=(0,f.useState)(!1),[ee,te]=(0,f.useState)(null),[ne,re]=(0,f.useState)(!1),[ie,ae]=(0,f.useState)(null),[oe,se]=(0,f.useState)(!1),{colorize:H,aboveColor:ce,belowColor:le,optimalColor:ue}=F6(),[de,fe]=(0,f.useState)(null),[pe,me]=(0,f.useState)(!1),[he,ge]=(0,f.useState)(null),[_e,ve]=(0,f.useState)(null),[ye,be]=(0,f.useState)(``),[xe,Se]=(0,f.useState)(``),[Ce,we]=(0,f.useState)(!1),[Te,Ee]=(0,f.useState)(!1),[De,Oe]=(0,f.useState)(!1),[ke,Ae]=(0,f.useState)(nte()),je=n.get(`tab`),Me=je===`email`,[Ne,Pe]=(0,f.useState)(Me?`users`:je&&RKe.includes(je)?je:`general`),[Fe,Ie]=(0,f.useState)(Me?`email`:`users`),[Le,Re]=(0,f.useState)(je===`queue`&&n.get(`sub`)===`pipelines`?`pipelines`:`dispatch`),ze=e=>{Pe(e),e===`users`&&Ie(`users`),e===`queue`&&(Re(`dispatch`),n.delete(`sub`)),e===`general`?n.delete(`tab`):n.set(`tab`,e),r(n,{replace:!0})},Be=e=>{Re(e),e===`pipelines`?n.set(`sub`,`pipelines`):n.delete(`sub`),r(n,{replace:!0})},[Ve,He]=(0,f.useState)(!1),[Ue,We]=(0,f.useState)(``),[Ge,Ke]=(0,f.useState)({can_queue:!0,can_control_printer:!1,can_read_status:!0,can_manage_library:!0,can_manage_inventory:!0,can_manage_maintenance:!0,can_manage_archives:!0,can_manage_projects:!0,can_access_cloud:!1,can_update_energy_cost:!1,can_send_notifications:!1}),[qe,Je]=(0,f.useState)(null),[Ye,Xe]=(0,f.useState)(!1),[Ze,Qe]=(0,f.useState)(null),[$e,et]=(0,f.useState)(``),[tt,nt]=(0,f.useState)(!1),[rt,it]=(0,f.useState)(!1),[at,ot]=(0,f.useState)(null),[st,ct]=(0,f.useState)(!1),[lt,ut]=(0,f.useState)(!1),[dt,ft]=(0,f.useState)(!1),[pt,mt]=(0,f.useState)({currentPassword:``,newPassword:``,confirmPassword:``}),[ht,gt]=(0,f.useState)(!1),[_t,vt]=(0,f.useState)(!1),[yt,bt]=(0,f.useState)(!1),[xt,Ct]=(0,f.useState)(`local`),[wt,Tt]=(0,f.useState)(!1),[Et,Dt]=(0,f.useState)(null),[Ot,kt]=(0,f.useState)(null),[At,jt]=(0,f.useState)(null),[Mt,Nt]=(0,f.useState)(!1),[Pt,Ft]=(0,f.useState)({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]}),[It,Lt]=(0,f.useState)(null),[Rt,zt]=(0,f.useState)(null),[Bt,Vt]=(0,f.useState)(!1),[Ht,Ut]=(0,f.useState)({}),[Wt,Gt]=(0,f.useState)({}),Kt=e=>{Ae(e),rte(e),o(i(`settings.toast.settingsSaved`),`success`)},{data:qt,isLoading:Jt}=K({queryKey:[`settings`],queryFn:Z.getSettings}),{data:Yt,isLoading:Xt,isFetching:Zt}=K({queryKey:[`storage-usage`],queryFn:()=>Z.getStorageUsage(),enabled:Ne===`general`,staleTime:1/0,refetchInterval:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1}),Qt=async()=>{vt(!0);try{let t=await Z.getStorageUsage({refresh:!0});e.setQueryData([`storage-usage`],t)}catch(e){o(e instanceof Error?e.message:`Failed to refresh storage usage`,`error`)}finally{vt(!1)}},{data:$t,isLoading:en}=K({queryKey:[`smart-plugs`],queryFn:Z.getSmartPlugs}),{data:tn,isLoading:nn}=K({queryKey:[`smart-plugs-energy`,$t?.map(e=>e.id)],queryFn:async()=>{if(!$t||$t.length===0)return null;let e=await Promise.all($t.filter(e=>e.enabled).map(async e=>{try{return{plug:e,status:await Z.getSmartPlugStatus(e.id)}}catch{return{plug:e,status:null}}})),t=0,n=0,r=0,i=0,a=0;for(let{plug:o,status:s}of e){let e=o.plug_type===`mqtt`&&s?.energy?.power!=null;(s?.reachable||e)&&(a++,s?.energy?.power!=null&&(t+=s.energy.power),s?.energy?.today!=null&&(n+=s.energy.today),s?.energy?.yesterday!=null&&(r+=s.energy.yesterday),s?.energy?.total!=null&&(i+=s.energy.total))}return{totalPower:t,totalToday:n,totalYesterday:r,totalLifetime:i,reachableCount:a,totalPlugs:$t.filter(e=>e.enabled).length}},enabled:Ne===`plugs`&&!!$t&&$t.length>0,refetchInterval:Ne===`plugs`?1e4:!1}),{data:W,isLoading:rn}=K({queryKey:[`notification-providers`],queryFn:Z.getNotificationProviders}),{data:an,isLoading:on}=K({queryKey:[`api-keys`],queryFn:Z.getAPIKeys}),sn=q({mutationFn:e=>Z.createAPIKey(e),onSuccess:t=>{Je(t.key||null),He(!1),We(``),e.invalidateQueries({queryKey:[`api-keys`]}),o(i(`settings.toast.apiKeyCreated`))},onError:e=>{o(`Failed to create API key: ${e.message}`,`error`)}}),cn=q({mutationFn:e=>Z.deleteAPIKey(e),onSuccess:(t,n)=>{e.setQueryData([`api-keys`],e=>(e??[]).filter(e=>e.id!==n)),o(i(`settings.toast.apiKeyDeleted`))},onError:e=>{o(`Failed to delete API key: ${e.message}`,`error`)}}),{data:ln}=K({queryKey:[`printers`],queryFn:Z.getPrinters}),{data:un}=K({queryKey:[`haSensors`],queryFn:()=>Z.getHASensors()}),{data:dn}=K({queryKey:[`locationHaSensors`],queryFn:()=>Z.getLocationHASensors()}),{data:fn}=K({queryKey:p6,queryFn:Z.getLocations,enabled:Ne===`sensors`}),pn=_o({queries:(0,f.useMemo)(()=>Array.from(new Set((dn??[]).map(e=>e.location_id))),[dn]).map(e=>({queryKey:[`locationHaSensorReadings`,e],queryFn:()=>Z.getLocationHASensorReadings(e,!1),enabled:Ne===`sensors`,refetchInterval:Ne===`sensors`?(qt?.location_sensor_poll_interval||120)*1e3:!1}))}),mn=(0,f.useMemo)(()=>{let e=new Map;for(let t of pn)for(let n of t.data??[])e.set(n.id,n);return e},[pn]),hn=q({mutationFn:async e=>{for(let t of e)await Z.deleteLocationHASensor(t)},onSuccess:()=>{o(i(`locationHaSensors.toast.deleted`),`success`)},onError:e=>{o(e.message,`error`)},onSettled:()=>{e.invalidateQueries({queryKey:[`locationHaSensors`]}),e.invalidateQueries({queryKey:[`locationHaSensorReadings`]}),fe(null)}}),gn=Rf(ln?.length??0),{data:_n,isLoading:vn}=K({queryKey:[`notification-templates`],queryFn:Z.getNotificationTemplates}),{data:yn}=K({queryKey:[`virtual-printer-settings`],queryFn:Cd.getSettings,refetchInterval:1e4}),bn=yn?.status?.running??!1,{data:xn}=K({queryKey:[`spoolbuddy-devices`],queryFn:()=>Od.getDevices(),refetchInterval:15e3}),Sn=xn?.length??0,Cn=xn?.some(e=>e.online)??!1,{data:wn}=K({queryKey:[`obico-status`],queryFn:Z.getObicoStatus,refetchInterval:15e3}),Tn=!!(wn?.is_running&&wn?.enabled),{data:En}=K({queryKey:[`ffmpeg-status`],queryFn:Z.checkFfmpeg}),{data:Dn}=K({queryKey:[`version`],queryFn:Z.getVersion}),On=!s||d(`library:purge`),{data:kn}=K({queryKey:[`library-trash-settings`],queryFn:()=>Z.getLibraryTrashSettings(),enabled:On}),An=q({mutationFn:e=>Z.updateLibraryTrashSettings(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`library-trash-settings`]}),o(i(`settings.toast.settingsSaved`),`success`)},onError:e=>o(e.message||i(`libraryAutoPurge.saveFailed`),`error`)}),jn=e=>{kn&&An.mutate({retention_days:kn.retention_days,auto_purge_enabled:kn.auto_purge_enabled,auto_purge_days:kn.auto_purge_days,auto_purge_include_never_printed:kn.auto_purge_include_never_printed,...e})},Mn=!s||d(`archives:purge`),{data:Nn}=K({queryKey:[`archive-purge-settings`],queryFn:()=>Z.getArchivePurgeSettings(),enabled:Mn}),Pn=q({mutationFn:e=>Z.updateArchivePurgeSettings(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`archive-purge-settings`]}),o(i(`settings.toast.settingsSaved`),`success`)},onError:e=>o(e.message||i(`archiveAutoPurge.saveFailed`),`error`)}),Fn=e=>{Nn&&Pn.mutate({enabled:Nn.enabled,days:Nn.days,purge_stats:Nn.purge_stats,...e})},{data:In,refetch:Ln,isRefetching:Rn}=K({queryKey:[`updateCheck`],queryFn:Z.checkForUpdates,enabled:qt?.check_updates!==!1,staleTime:300*1e3}),{data:zn,refetch:Bn}=K({queryKey:[`updateStatus`],queryFn:Z.getUpdateStatus,refetchInterval:e=>{let t=e.state.data;return t?.status===`downloading`||t?.status===`installing`?1e3:!1}}),{data:Vn}=K({queryKey:[`mqtt-status`],queryFn:Z.getMQTTStatus,refetchInterval:Ne===`network`?5e3:!1}),{data:Hn}=K({queryKey:[`github-backup-status`],queryFn:Z.getGitHubBackupStatus}),{data:Un}=K({queryKey:[`cloud-status`],queryFn:Z.getCloudStatus}),{data:Wn={advanced_auth_enabled:!1,smtp_configured:!1,local_login_enabled:!0,autologin_provider_id:null}}=K({queryKey:[`advancedAuthStatus`],queryFn:()=>Z.getAdvancedAuthStatus()}),{data:Gn}=K({queryKey:[`ldapStatus`],queryFn:()=>Z.getLDAPStatus()}),{data:Kn}=K({queryKey:[`twoFAStatus`],queryFn:()=>Z.get2FAStatus()}),{data:qn=[]}=K({queryKey:[`oidcProvidersAll`],queryFn:()=>Z.getOIDCProvidersAll(),enabled:l}),{data:Jn=[],isLoading:Yn}=K({queryKey:[`users`],queryFn:()=>Z.getUsers(),enabled:s&&d(`users:read`)}),{data:Xn=[],isLoading:Zn}=K({queryKey:[`groups`],queryFn:()=>Z.getGroups(),enabled:s&&d(`groups:read`)}),Qn=q({mutationFn:e=>Z.createUser(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`users`]}),e.invalidateQueries({queryKey:[`groups`]}),bt(!1),Ft({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]}),o(i(`settings.toast.userCreated`))},onError:e=>{o(e.message,`error`)}}),er=q({mutationFn:({id:e,data:t})=>Z.updateUser(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:[`users`]}),e.invalidateQueries({queryKey:[`groups`]}),Tt(!1),Dt(null),Ft({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]}),o(i(`settings.toast.userUpdated`))},onError:e=>{o(e.message,`error`)}}),tr=q({mutationFn:({id:e,deleteItems:t})=>Z.deleteUser(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:[`users`]}),o(i(`settings.toast.userDeleted`)),kt(null),jt(null)},onError:e=>{o(e.message,`error`)}}),nr=q({mutationFn:e=>Z.resetUserPassword({user_id:e}),onSuccess:e=>{o(e.message,`success`)},onError:e=>{o(e.message,`error`)}}),rr=async e=>{kt(e),Nt(!0);try{jt(await Z.getUserItemsCount(e))}catch{jt({archives:0,queue_items:0,library_files:0})}finally{Nt(!1)}},ir=q({mutationFn:e=>Z.deleteGroup(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`groups`]}),o(i(`settings.toast.groupDeleted`))},onError:e=>{o(e.message,`error`)}}),ar=()=>{let e=Wn?.advanced_auth_enabled||!1;if(!Pt.username){o(i(`settings.toast.fillRequiredFields`),`error`);return}if(e&&!Pt.email){o(`Email is required when advanced authentication is enabled`,`error`);return}if(!e){if(!Pt.password){o(i(`settings.toast.fillRequiredFields`),`error`);return}if(Pt.password!==Pt.confirmPassword){o(i(`settings.toast.passwordsDoNotMatch`),`error`);return}let e=f6(Pt.password);if(e){o(i({tooShort:`settings.toast.passwordTooShort`,needsUppercase:`settings.toast.passwordNeedsUppercase`,needsLowercase:`settings.toast.passwordNeedsLowercase`,needsDigit:`settings.toast.passwordNeedsDigit`,needsSpecial:`settings.toast.passwordNeedsSpecial`}[e]),`error`);return}}Qn.mutate({username:Pt.username,password:e?void 0:Pt.password,email:Pt.email||void 0,role:Pt.role,group_ids:Pt.group_ids.length>0?Pt.group_ids:void 0})},or=e=>{if(Pt.password){if(Pt.password!==Pt.confirmPassword){o(i(`settings.toast.passwordsDoNotMatch`),`error`);return}let e=f6(Pt.password);if(e){o(i({tooShort:`settings.toast.passwordTooShort`,needsUppercase:`settings.toast.passwordNeedsUppercase`,needsLowercase:`settings.toast.passwordNeedsLowercase`,needsDigit:`settings.toast.passwordNeedsDigit`,needsSpecial:`settings.toast.passwordNeedsSpecial`}[e]),`error`);return}}let t={username:Pt.username||void 0,password:Pt.password||void 0,email:Pt.email||void 0,role:Pt.role,group_ids:Pt.group_ids};t.password||delete t.password,er.mutate({id:e,data:t})},sr=e=>{Dt(e.id),Ft({username:e.username,password:``,email:e.email||``,confirmPassword:``,role:e.role,group_ids:e.groups?.map(e=>e.id)||[]}),Tt(!0)},cr=e=>{Ft(t=>({...t,group_ids:t.group_ids.includes(e)?t.group_ids.filter(t=>t!==e):[...t.group_ids,e]}))},lr=q({mutationFn:Z.applyUpdate,onSuccess:e=>{e.is_ha_addon||e.is_docker||e.is_windows_installer?o(e.message,`error`):Bn()}}),[ur,dr]=(0,f.useState)(null),fr=q({mutationFn:Z.testAllNotificationProviders,onSuccess:t=>{dr(t),e.invalidateQueries({queryKey:[`notification-providers`]}),t.failed===0?o(`All ${t.tested} providers tested successfully!`,`success`):o(`${t.success}/${t.tested} providers succeeded`,t.failed>0?`error`:`success`)},onError:e=>{o(`Failed to test providers: ${e.message}`,`error`)}}),pr=q({mutationFn:async e=>{if(!$t)return{success:0,failed:0};let t=$t.filter(e=>e.enabled),n=await Promise.all(t.map(async t=>{try{return await Z.controlSmartPlug(t.id,e),{success:!0}}catch{return{success:!1}}}));return{success:n.filter(e=>e.success).length,failed:n.filter(e=>!e.success).length}},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:[`smart-plugs`]}),e.invalidateQueries({queryKey:[`smart-plugs-energy`]}),t.failed===0?o(`All ${t.success} plugs turned ${n}`,`success`):o(`${t.success} plugs turned ${n}, ${t.failed} failed`,`error`)},onError:e=>{o(`Failed: ${e.message}`,`error`)}}),mr=(0,f.useRef)(null),hr=(0,f.useRef)(null),gr=(0,f.useRef)(!1),_r=(0,f.useRef)(!0),vr=(0,f.useRef)(null);(0,f.useEffect)(()=>{if(qt&&!A){let e={...qt,external_url:qt.external_url||window.location.origin};vr.current=qt,j(e),setTimeout(()=>{_r.current=!1},100)}},[qt,A]),(0,f.useEffect)(()=>{let e=vr.current;if(!qt||!A||!e||qt===e)return;let t={};for(let n of Object.keys(qt))qt[n]!==e[n]&&A[n]===e[n]&&(t[n]=qt[n]);vr.current=qt,Object.keys(t).length>0&&j(e=>e&&{...e,...t})},[qt,A]);let yr=q({mutationFn:Z.updateSettings,onSuccess:t=>{vr.current=t,e.setQueryData([`settings`],t),e.invalidateQueries({queryKey:[`archiveStats`]}),e.invalidateQueries({queryKey:[`ui-flags`]}),o(i(`settings.toast.settingsSaved`),`success`)},onError:e=>{o(`Failed to save: ${e.message}`,`error`)},onSettled:()=>{gr.current=!1}}),br=q({mutationFn:({id:e,data:t})=>Z.updatePrinter(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:[`printers`]}),o(i(`settings.toast.cameraSettingsSaved`),`success`)},onError:e=>{o(`Failed to update printer: ${e.message}`,`error`)}});(0,f.useEffect)(()=>{let e=vr.current;if(!(_r.current||!A||!qt||!e)&&!(s&&!d(`settings:update`))&&(e.auto_archive!==A.auto_archive||e.save_thumbnails!==A.save_thumbnails||e.capture_finish_photo!==A.capture_finish_photo||(e.finish_photo_restore_plate??!0)!==(A.finish_photo_restore_plate??!0)||e.default_filament_cost!==A.default_filament_cost||e.currency!==A.currency||e.energy_cost_per_kwh!==A.energy_cost_per_kwh||e.energy_tracking_mode!==A.energy_tracking_mode||e.check_updates!==A.check_updates||(e.check_printer_firmware??!0)!==(A.check_printer_firmware??!0)||(e.include_beta_updates??!1)!==(A.include_beta_updates??!1)||(e.local_login_enabled??!0)!==(A.local_login_enabled??!0)||e.notification_language!==A.notification_language||(e.bed_cooled_threshold??35)!==(A.bed_cooled_threshold??35)||e.ams_humidity_good!==A.ams_humidity_good||e.ams_humidity_fair!==A.ams_humidity_fair||e.ams_temp_good!==A.ams_temp_good||e.ams_temp_fair!==A.ams_temp_fair||(e.ams_temp_alarm??null)!==(A.ams_temp_alarm??null)||e.ams_history_retention_days!==A.ams_history_retention_days||e.disable_filament_warnings!==A.disable_filament_warnings||e.prefer_lowest_filament!==A.prefer_lowest_filament||(e.queue_drying_enabled??!1)!==(A.queue_drying_enabled??!1)||(e.queue_drying_block??!1)!==(A.queue_drying_block??!1)||(e.ambient_drying_enabled??!1)!==(A.ambient_drying_enabled??!1)||(e.ambient_drying_sustained_minutes??0)!==(A.ambient_drying_sustained_minutes??0)||(e.print_drying_enabled??!1)!==(A.print_drying_enabled??!1)||(e.drying_presets??``)!==(A.drying_presets??``)||(e.ams_humidity_thresholds??``)!==(A.ams_humidity_thresholds??``)||e.per_printer_mapping_expanded!==A.per_printer_mapping_expanded||e.date_format!==A.date_format||e.time_format!==A.time_format||e.default_printer_id!==A.default_printer_id||e.ftp_retry_enabled!==A.ftp_retry_enabled||e.ftp_retry_count!==A.ftp_retry_count||e.ftp_retry_delay!==A.ftp_retry_delay||e.ftp_timeout!==A.ftp_timeout||e.mqtt_enabled!==A.mqtt_enabled||e.mqtt_broker!==A.mqtt_broker||e.mqtt_port!==A.mqtt_port||e.mqtt_username!==A.mqtt_username||e.mqtt_password!==A.mqtt_password||e.mqtt_topic_prefix!==A.mqtt_topic_prefix||e.mqtt_use_tls!==A.mqtt_use_tls||e.external_url!==A.external_url||e.ha_enabled!==A.ha_enabled||e.ha_url!==A.ha_url||e.ha_token!==A.ha_token||(e.library_archive_mode??`ask`)!==(A.library_archive_mode??`ask`)||Number(e.library_disk_warning_gb??5)!==Number(A.library_disk_warning_gb??5)||(e.preferred_slicer??`bambu_studio`)!==(A.preferred_slicer??`bambu_studio`)||U8(e.slice_engine)!==U8(A.slice_engine)||(e.open_in_slicer??null)!==(A.open_in_slicer??null)||(e.use_slicer_api??!1)!==(A.use_slicer_api??!1)||(e.orcaslicer_api_url??``)!==(A.orcaslicer_api_url??``)||(e.slicer_stall_timeout_minutes??15)!==(A.slicer_stall_timeout_minutes??15)||(e.bambu_studio_api_url??``)!==(A.bambu_studio_api_url??``)||e.prometheus_enabled!==A.prometheus_enabled||e.prometheus_token!==A.prometheus_token||(e.user_notifications_enabled??!0)!==(A.user_notifications_enabled??!0)||(e.default_bed_levelling??`auto`)!==(A.default_bed_levelling??`auto`)||(e.default_flow_cali??`auto`)!==(A.default_flow_cali??`auto`)||(e.default_vibration_cali??!0)!==(A.default_vibration_cali??!0)||(e.default_layer_inspect??!1)!==(A.default_layer_inspect??!1)||(e.default_timelapse??!1)!==(A.default_timelapse??!1)||(e.default_nozzle_offset_cali??`auto`)!==(A.default_nozzle_offset_cali??`auto`)||(e.default_confirm_outcome??!1)!==(A.default_confirm_outcome??!1)||(e.confirm_outcome_external_prints??!1)!==(A.confirm_outcome_external_prints??!1)||(e.confirm_default_good_on_plate_clear??!1)!==(A.confirm_default_good_on_plate_clear??!1)||(e.stagger_group_size??2)!==(A.stagger_group_size??2)||(e.stagger_interval_minutes??5)!==(A.stagger_interval_minutes??5)||(e.require_plate_clear??!1)!==(A.require_plate_clear??!1)||(e.queue_max_concurrent_uploads??4)!==(A.queue_max_concurrent_uploads??4)||(e.preheat_enabled??!1)!==(A.preheat_enabled??!1)||(e.preheat_filament_targets??``)!==(A.preheat_filament_targets??``)||(e.preheat_max_wait_seconds??900)!==(A.preheat_max_wait_seconds??900)||(e.preheat_soak_seconds??300)!==(A.preheat_soak_seconds??300)||(e.queue_keep_bed_warm??!1)!==(A.queue_keep_bed_warm??!1)||(e.queue_keep_warm_bed_temp??90)!==(A.queue_keep_warm_bed_temp??90)||(e.queue_keep_warm_max_minutes??120)!==(A.queue_keep_warm_max_minutes??120)||(e.nozzle_temp_presets??``)!==(A.nozzle_temp_presets??``)||(e.bed_temp_presets??``)!==(A.bed_temp_presets??``)||(e.chamber_temp_presets??``)!==(A.chamber_temp_presets??``)||(e.fan_speed_presets??``)!==(A.fan_speed_presets??``)||(e.session_max_hours??24)!==(A.session_max_hours??24)||(e.billing_enabled??!1)!==(A.billing_enabled??!1)||(e.printer_kill_switch_enabled??!1)!==(A.printer_kill_switch_enabled??!1)||(e.finance_budget_reset_day??1)!==(A.finance_budget_reset_day??1)||(e.finance_budget_reset_timezone??`UTC`)!==(A.finance_budget_reset_timezone??`UTC`))&&!gr.current)return mr.current&&clearTimeout(mr.current),mr.current=setTimeout(()=>{if(gr.current)return;gr.current=!0;let e={auto_archive:A.auto_archive,save_thumbnails:A.save_thumbnails,capture_finish_photo:A.capture_finish_photo,finish_photo_restore_plate:A.finish_photo_restore_plate??!0,default_filament_cost:A.default_filament_cost,currency:A.currency,energy_cost_per_kwh:A.energy_cost_per_kwh,energy_tracking_mode:A.energy_tracking_mode,check_updates:A.check_updates,check_printer_firmware:A.check_printer_firmware,include_beta_updates:A.include_beta_updates,local_login_enabled:A.local_login_enabled,notification_language:A.notification_language,bed_cooled_threshold:A.bed_cooled_threshold,ams_humidity_good:A.ams_humidity_good,ams_humidity_fair:A.ams_humidity_fair,ams_temp_good:A.ams_temp_good,ams_temp_fair:A.ams_temp_fair,ams_temp_alarm:A.ams_temp_alarm??null,ams_history_retention_days:A.ams_history_retention_days,disable_filament_warnings:A.disable_filament_warnings,prefer_lowest_filament:A.prefer_lowest_filament,queue_drying_enabled:A.queue_drying_enabled,queue_drying_block:A.queue_drying_block,ambient_drying_enabled:A.ambient_drying_enabled,ambient_drying_sustained_minutes:A.ambient_drying_sustained_minutes,print_drying_enabled:A.print_drying_enabled,drying_presets:A.drying_presets,ams_humidity_thresholds:A.ams_humidity_thresholds,per_printer_mapping_expanded:A.per_printer_mapping_expanded,date_format:A.date_format,time_format:A.time_format,default_printer_id:A.default_printer_id,ftp_retry_enabled:A.ftp_retry_enabled,ftp_retry_count:A.ftp_retry_count,ftp_retry_delay:A.ftp_retry_delay,ftp_timeout:A.ftp_timeout,mqtt_enabled:A.mqtt_enabled,mqtt_broker:A.mqtt_broker,mqtt_port:A.mqtt_port,mqtt_username:A.mqtt_username,mqtt_password:A.mqtt_password,mqtt_topic_prefix:A.mqtt_topic_prefix,mqtt_use_tls:A.mqtt_use_tls,external_url:A.external_url,ha_enabled:A.ha_enabled,ha_url:A.ha_url,ha_token:A.ha_token,library_archive_mode:A.library_archive_mode,library_disk_warning_gb:A.library_disk_warning_gb,preferred_slicer:A.preferred_slicer,slice_engine:A.slice_engine,open_in_slicer:A.open_in_slicer,use_slicer_api:A.use_slicer_api,orcaslicer_api_url:A.orcaslicer_api_url,slicer_stall_timeout_minutes:A.slicer_stall_timeout_minutes,bambu_studio_api_url:A.bambu_studio_api_url,prometheus_enabled:A.prometheus_enabled,prometheus_token:A.prometheus_token,user_notifications_enabled:A.user_notifications_enabled,default_bed_levelling:A.default_bed_levelling,default_flow_cali:A.default_flow_cali,default_vibration_cali:A.default_vibration_cali,default_layer_inspect:A.default_layer_inspect,default_timelapse:A.default_timelapse,default_nozzle_offset_cali:A.default_nozzle_offset_cali,default_confirm_outcome:A.default_confirm_outcome,confirm_outcome_external_prints:A.confirm_outcome_external_prints,confirm_default_good_on_plate_clear:A.confirm_default_good_on_plate_clear,stagger_group_size:A.stagger_group_size,stagger_interval_minutes:A.stagger_interval_minutes,require_plate_clear:A.require_plate_clear,queue_max_concurrent_uploads:A.queue_max_concurrent_uploads,preheat_enabled:A.preheat_enabled,preheat_filament_targets:A.preheat_filament_targets,preheat_max_wait_seconds:A.preheat_max_wait_seconds,preheat_soak_seconds:A.preheat_soak_seconds,queue_keep_bed_warm:A.queue_keep_bed_warm,queue_keep_warm_bed_temp:A.queue_keep_warm_bed_temp,queue_keep_warm_max_minutes:A.queue_keep_warm_max_minutes,nozzle_temp_presets:A.nozzle_temp_presets,bed_temp_presets:A.bed_temp_presets,chamber_temp_presets:A.chamber_temp_presets,fan_speed_presets:A.fan_speed_presets,session_max_hours:A.session_max_hours,billing_enabled:A.billing_enabled,printer_kill_switch_enabled:A.printer_kill_switch_enabled,finance_budget_reset_day:A.finance_budget_reset_day,finance_budget_reset_timezone:A.finance_budget_reset_timezone};yr.mutate(e)},500),()=>{mr.current&&clearTimeout(mr.current)}},[A,qt,yr,s,d,o,i]);let xr=(0,f.useCallback)((e,t)=>{if(s&&!d(`settings:update`)){o(i(`settings.toast.noPermissionUpdate`),`error`);return}j(n=>n?{...n,[e]:t}:null)},[s,d,o,i]),Sr=async(e,t,n)=>{if(!t){o(i(`settings.toast.enterCameraUrl`),`error`);return}Gt(t=>({...t,[e]:!0})),Ut(t=>({...t,[e]:null}));try{let r=await Z.testExternalCamera(e,t,n);Ut(t=>({...t,[e]:r})),r.success?o(r.coalesced?i(`settings.toast.cameraConnectedCoalesced`,{resolution:r.resolution||``}):i(`settings.toast.cameraConnected`,{resolution:r.resolution||``}),`success`):o(r.error||i(`settings.toast.connectionFailed`),`error`)}catch(t){let n=t instanceof Error?t.message:i(`settings.toast.testFailed`);Ut(t=>({...t,[e]:{success:!1,error:n}})),o(n,`error`)}finally{Gt(t=>({...t,[e]:!1}))}},[Cr,wr]=(0,f.useState)({}),Tr=(0,f.useRef)({}),Er=(0,f.useRef)(new Set),[Dr,Or]=(0,f.useState)({}),kr=(0,f.useRef)({}),Ar=(0,f.useRef)(new Set);(0,f.useEffect)(()=>{if(ln){let e={},t={};ln.forEach(n=>{n.external_camera_url&&!Er.current.has(n.id)&&(e[n.id]=n.external_camera_url,Er.current.add(n.id)),n.external_camera_snapshot_url&&!Ar.current.has(n.id)&&(t[n.id]=n.external_camera_snapshot_url,Ar.current.add(n.id))}),Object.keys(e).length>0&&wr(t=>({...t,...e})),Object.keys(t).length>0&&Or(e=>({...e,...t}))}},[ln]);let jr=(e,t)=>{wr(n=>({...n,[e]:t})),Tr.current[e]&&clearTimeout(Tr.current[e]),Tr.current[e]=setTimeout(()=>{br.mutate({id:e,data:{external_camera_url:t||null}})},800)},Mr=(e,t)=>{Or(n=>({...n,[e]:t})),kr.current[e]&&clearTimeout(kr.current[e]),kr.current[e]=setTimeout(()=>{br.mutate({id:e,data:{external_camera_snapshot_url:t||null}})},800)},Nr=(e,t)=>{let n={};t.type!==void 0&&(n.external_camera_type=t.type||null),t.enabled!==void 0&&(n.external_camera_enabled=t.enabled),t.rotation!==void 0&&(n.camera_rotation=t.rotation),br.mutate({id:e,data:n})};if(Jt||!A)return(0,G.jsx)(`div`,{className:`p-4 md:p-8 flex justify-center`,children:(0,G.jsx)(Y,{className:`w-8 h-8 text-bambu-green animate-spin`})});let Pr=AKe().map(e=>({...e,label:i(e.labelKey,e.labelFallback??e.labelKey)})),Fr=xe.trim().toLowerCase(),Ir=Fr?Pr.filter(e=>e.label.toLowerCase().includes(Fr)||e.keywords.toLowerCase().includes(Fr)).slice(0,8):[],Lr=e=>{ze(e.tab),e.subTab&&Ie(e.subTab),Se(``),setTimeout(()=>{let t=document.getElementById(e.anchor);t&&(t.scrollIntoView({behavior:`smooth`,block:`start`}),t.classList.add(`ring-2`,`ring-bambu-green`),setTimeout(()=>t.classList.remove(`ring-2`,`ring-bambu-green`),1500))},50)},Rr=(A?.docker_compose_dir??``).trim()||(In?.compose_dir_detected??``),zr=Rr?`cd ${/\s/.test(Rr)?`"${Rr}"`:Rr} && docker compose pull && docker compose up -d`:`docker compose pull && docker compose up -d`;return(0,G.jsx)(Rd,{density:`dense`,children:(0,G.jsxs)(`div`,{className:`p-4 md:p-8`,children:[(0,G.jsxs)(`div`,{className:`mb-4 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`h1`,{className:`text-2xl font-bold text-white flex items-center gap-3`,children:[(0,G.jsx)(Zl,{className:`w-7 h-7 text-bambu-green`}),i(`settings.title`)]}),(0,G.jsx)(`p`,{className:`text-bambu-gray mt-1`,children:i(`settings.configureBambuddy`)})]}),(0,G.jsxs)(`div`,{className:`relative sm:w-72`,children:[(0,G.jsx)(Kl,{className:`w-4 h-4 text-bambu-gray absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none`}),(0,G.jsx)(`input`,{type:`text`,value:xe,onChange:e=>Se(e.target.value),placeholder:i(`settings.searchPlaceholder`,`Search settings…`),className:`w-full pl-9 pr-8 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`}),xe&&(0,G.jsx)(`button`,{onClick:()=>Se(``),className:`absolute right-2 top-1/2 -translate-y-1/2 p-1 text-bambu-gray hover:text-white`,"aria-label":`Clear`,children:(0,G.jsx)($u,{className:`w-3.5 h-3.5`})}),Ir.length>0&&(0,G.jsx)(`div`,{className:`absolute top-full left-0 right-0 mt-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl z-30 overflow-hidden`,children:Ir.map(e=>(0,G.jsxs)(`button`,{onClick:()=>Lr(e),className:`w-full px-3 py-2 text-left hover:bg-bambu-dark-tertiary transition-colors border-b border-bambu-dark-tertiary last:border-b-0`,children:[(0,G.jsx)(`p`,{className:`text-sm text-white`,children:e.label}),(0,G.jsxs)(`p`,{className:`text-xs text-bambu-gray`,children:[i(`settings.tabs.${e.tab===`virtual-printer`?`virtualPrinter`:e.tab===`failure-detection`?`failureDetection`:e.tab}`),e.subTab?` › ${i(`settings.tabs.${e.subTab}`,e.subTab)}`:``]})]},e.anchor))}),Fr&&Ir.length===0&&(0,G.jsx)(`div`,{className:`absolute top-full left-0 right-0 mt-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl z-30 p-3`,children:(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray italic`,children:i(`settings.noSearchResults`,`No matching settings.`)})})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-col lg:flex-row gap-4 lg:gap-6`,children:[(0,G.jsxs)(`nav`,{className:`flex flex-wrap gap-1 border-b border-bambu-dark-tertiary lg:flex-col lg:flex-nowrap lg:gap-0 lg:border-b-0 lg:border-r lg:w-48 lg:flex-shrink-0 lg:self-start lg:sticky lg:top-4`,children:[(0,G.jsxs)(`button`,{onClick:()=>ze(`general`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px lg:border-b-0 lg:border-l-2 lg:-ml-px lg:mb-0 lg:justify-start flex items-center gap-2 ${Ne===`general`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(Zl,{className:`w-4 h-4`}),i(`settings.tabs.general`)]}),(0,G.jsxs)(`button`,{onClick:()=>ze(`plugs`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px lg:border-b-0 lg:border-l-2 lg:-ml-px lg:mb-0 lg:justify-start flex items-center gap-2 ${Ne===`plugs`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(Ol,{className:`w-4 h-4`}),i(`settings.tabs.smartPlugs`),$t&&$t.length>0&&(0,G.jsx)(`span`,{className:`text-xs bg-bambu-dark-tertiary px-1.5 py-0.5 rounded-full`,children:$t.length})]}),(0,G.jsxs)(`button`,{onClick:()=>ze(`sensors`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px lg:border-b-0 lg:border-l-2 lg:-ml-px lg:mb-0 lg:justify-start flex items-center gap-2 ${Ne===`sensors`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(vc,{className:`w-4 h-4`}),i(`settings.tabs.sensors`),(un?.length??0)+(dn?.length??0)>0&&(0,G.jsx)(`span`,{className:`text-xs bg-bambu-dark-tertiary px-1.5 py-0.5 rounded-full`,children:(un?.length??0)+(dn?.length??0)})]}),(0,G.jsxs)(`button`,{onClick:()=>ze(`notifications`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px lg:border-b-0 lg:border-l-2 lg:-ml-px lg:mb-0 lg:justify-start flex items-center gap-2 ${Ne===`notifications`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(Vo,{className:`w-4 h-4`}),i(`settings.tabs.notifications`),W&&W.length>0&&(0,G.jsx)(`span`,{className:`text-xs bg-bambu-dark-tertiary px-1.5 py-0.5 rounded-full`,children:W.length})]}),(0,G.jsxs)(`button`,{onClick:()=>ze(`queue`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px lg:border-b-0 lg:border-l-2 lg:-ml-px lg:mb-0 lg:justify-start flex items-center gap-2 ${Ne===`queue`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(Kc,{className:`w-4 h-4`}),i(`settings.tabs.queue`,`Workflow`)]}),(0,G.jsxs)(`button`,{onClick:()=>ze(`filament`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px lg:border-b-0 lg:border-l-2 lg:-ml-px lg:mb-0 lg:justify-start flex items-center gap-2 ${Ne===`filament`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(Ls,{className:`w-4 h-4`}),i(`settings.tabs.filament`)]}),(0,G.jsxs)(`button`,{onClick:()=>ze(`network`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px lg:border-b-0 lg:border-l-2 lg:-ml-px lg:mb-0 lg:justify-start flex items-center gap-2 ${Ne===`network`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(Yu,{className:`w-4 h-4`}),i(`settings.tabs.network`),(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full ${Vn?.enabled?`bg-green-400`:`bg-gray-500`}`})]}),(0,G.jsxs)(`button`,{onClick:()=>ze(`apikeys`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px lg:border-b-0 lg:border-l-2 lg:-ml-px lg:mb-0 lg:justify-start flex items-center gap-2 ${Ne===`apikeys`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(Bc,{className:`w-4 h-4`}),i(`settings.tabs.apiKeys`),an&&an.length>0&&(0,G.jsx)(`span`,{className:`text-xs bg-bambu-dark-tertiary px-1.5 py-0.5 rounded-full`,children:an.length})]}),(0,G.jsxs)(`button`,{onClick:()=>ze(`virtual-printer`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px lg:border-b-0 lg:border-l-2 lg:-ml-px lg:mb-0 lg:justify-start flex items-center gap-2 ${Ne===`virtual-printer`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(Ml,{className:`w-4 h-4`}),i(`settings.tabs.virtualPrinter`),(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full ${bn?`bg-green-400`:`bg-gray-500`}`})]}),(0,G.jsxs)(`button`,{onClick:()=>ze(`spoolbuddy`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px lg:border-b-0 lg:border-l-2 lg:-ml-px lg:mb-0 lg:justify-start flex items-center gap-2 ${Ne===`spoolbuddy`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(Hl,{className:`w-4 h-4`}),i(`settings.tabs.spoolbuddy`),Sn>0&&(0,G.jsx)(`span`,{className:`text-xs bg-bambu-dark-tertiary px-1.5 py-0.5 rounded-full`,children:Sn}),(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full ${Cn?`bg-green-400`:`bg-gray-500`}`})]}),(0,G.jsxs)(`button`,{onClick:()=>ze(`failure-detection`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px lg:border-b-0 lg:border-l-2 lg:-ml-px lg:mb-0 lg:justify-start flex items-center gap-2 ${Ne===`failure-detection`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(Ul,{className:`w-4 h-4`}),i(`settings.tabs.failureDetection`),(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full ${Tn?`bg-green-400`:`bg-gray-500`}`})]}),(0,G.jsxs)(`button`,{onClick:()=>ze(`users`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px lg:border-b-0 lg:border-l-2 lg:-ml-px lg:mb-0 lg:justify-start flex items-center gap-2 ${Ne===`users`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(Bu,{className:`w-4 h-4`}),i(`settings.tabs.users`),s&&(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-green-400`})]}),(0,G.jsxs)(`button`,{onClick:()=>ze(`backup`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px lg:border-b-0 lg:border-l-2 lg:-ml-px lg:mb-0 lg:justify-start flex items-center gap-2 ${Ne===`backup`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(Rs,{className:`w-4 h-4`}),i(`settings.tabs.backup`),(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full ${Un?.is_authenticated&&Hn?.configured&&Hn?.enabled||qt?.local_backup_enabled?`bg-green-400`:`bg-gray-500`}`})]})]}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[Ne===`general`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`a`,{href:zf(gn,`app-settings`),target:`_blank`,rel:`noopener noreferrer`,className:`group block mb-4 lg:mb-6 rounded-xl border border-bambu-green/30 bg-gradient-to-br from-bambu-green/15 via-bambu-green/5 to-transparent hover:border-bambu-green/50 hover:from-bambu-green/20 transition-colors`,children:(0,G.jsxs)(`div`,{className:`flex flex-col md:flex-row items-start md:items-center gap-4 p-4 md:p-5`,children:[(0,G.jsx)(`div`,{className:`p-3 rounded-lg bg-bambu-green/20 text-bambu-green flex-shrink-0`,children:gn===`business`?(0,G.jsx)(Ko,{className:`w-6 h-6`}):(0,G.jsx)(jc,{className:`w-6 h-6`})}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`p`,{className:`text-base font-semibold text-white`,children:gn===`business`?i(`sponsors.businessTitle`,`Bambuddy for business`):i(`sponsors.sectionTitle`,`Independent & community-funded`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mt-0.5`,children:gn===`business`?i(`sponsors.businessTagline`,`You're running {{count}} printers. Priority support, commercial licensing and invoicing are available for teams and print farms.`,{count:ln?.length??0}):i(`sponsors.tagline`,`Bambuddy is free and stays that way because people choose to support it. No VC, no cloud lock-in.`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-2 rounded-lg bg-bambu-green/20 text-bambu-green group-hover:bg-bambu-green/30 text-sm font-medium whitespace-nowrap self-start md:self-auto`,children:[gn===`business`?i(`sponsors.businessCta`,`Bambuddy for business`):i(`sponsors.viewSupporters`,`View supporters`),(0,G.jsx)(Xs,{className:`w-4 h-4`})]})]})}),(0,G.jsxs)(`div`,{className:`flex flex-col lg:flex-row gap-4 lg:gap-6`,children:[(0,G.jsxs)(`div`,{className:`space-y-3 flex-1 lg:max-w-xl`,children:[(0,G.jsxs)(zd,{id:`card-general`,children:[(0,G.jsx)(Bd,{children:(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:i(`settings.general`)})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:[(0,G.jsx)(Cc,{className:`w-4 h-4 inline mr-1`}),i(`settings.language`)]}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(`select`,{value:a.language,onChange:e=>{let t=e.target.value;if(s&&!d(`settings:update`)){o(i(`settings.toast.noPermissionUpdate`),`error`);return}a.changeLanguage(t),yr.mutate({language:t})},className:`w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer`,children:St.map(e=>(0,G.jsxs)(`option`,{value:e.code,children:[e.nativeName,` (`,e.name,`)`]},e.code))}),(0,G.jsx)(as,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.languageDescription`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.defaultView`)}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(`select`,{value:ke,onChange:e=>Kt(e.target.value),className:`w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer`,children:ah.map(e=>(0,G.jsx)(`option`,{value:e.to,children:i(e.labelKey)},e.id))}),(0,G.jsx)(as,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.defaultViewDescription`)})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.dateFormat`)}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsxs)(`select`,{value:A.date_format||`system`,onChange:e=>xr(`date_format`,e.target.value),className:`w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer`,children:[(0,G.jsx)(`option`,{value:`system`,children:i(`settings.systemDefault`)}),(0,G.jsx)(`option`,{value:`us`,children:i(`settings.dateFormatUs`)}),(0,G.jsx)(`option`,{value:`eu`,children:i(`settings.dateFormatEu`)}),(0,G.jsx)(`option`,{value:`iso`,children:i(`settings.dateFormatIso`)})]}),(0,G.jsx)(as,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.timeFormat`)}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsxs)(`select`,{value:A.time_format||`system`,onChange:e=>xr(`time_format`,e.target.value),className:`w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer`,children:[(0,G.jsx)(`option`,{value:`system`,children:i(`settings.systemDefault`)}),(0,G.jsx)(`option`,{value:`12h`,children:i(`settings.timeFormat12`)}),(0,G.jsx)(`option`,{value:`24h`,children:i(`settings.timeFormat24`)})]}),(0,G.jsx)(as,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.defaultPrinter`)}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsxs)(`select`,{value:A.default_printer_id??``,onChange:e=>xr(`default_printer_id`,e.target.value?Number(e.target.value):null),className:`w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer`,children:[(0,G.jsx)(`option`,{value:``,children:i(`settings.noDefaultPrinter`)}),ln?.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,G.jsx)(as,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.defaultPrinterDescription`)})]})]})]}),(0,G.jsxs)(zd,{id:`card-appearance`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(vl,{className:`w-5 h-5`}),i(`settings.appearance`)]})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,G.jsxs)(`label`,{className:`text-sm text-bambu-gray`,children:[i(`settings.theme`),`:`]}),(0,G.jsx)(`div`,{className:`flex gap-1`,children:[{id:`dark`,label:i(`settings.themeDark`)},{id:`light`,label:i(`settings.themeLight`)},{id:`system`,label:i(`settings.themeSystem`)}].map(({id:e,label:t})=>(0,G.jsx)(`button`,{onClick:()=>{x(e),o(i(`settings.toast.settingsSaved`),`success`)},className:`px-3 py-1 text-xs rounded-lg border transition-colors ${p===e?`border-bambu-green bg-bambu-green/10 text-bambu-green`:`border-gray-300 dark:border-bambu-dark-tertiary text-gray-500 dark:text-bambu-gray hover:text-gray-900 dark:hover:text-white cursor-pointer`}`,children:t},e))})]}),(0,G.jsxs)(`div`,{className:`space-y-3 p-4 rounded-lg border ${m===`dark`?`border-bambu-green bg-bambu-green/5`:`border-bambu-dark-tertiary`}`,children:[(0,G.jsxs)(`h3`,{className:`text-sm font-medium text-white flex items-center gap-2`,children:[i(`settings.darkMode`),m===`dark`&&(0,G.jsx)(`span`,{className:`text-xs text-bambu-green`,children:i(`settings.active`)})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:i(`settings.background`)}),(0,G.jsxs)(`select`,{value:g,onChange:e=>{C(e.target.value),o(i(`settings.toast.settingsSaved`),`success`)},className:`w-full px-2 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,G.jsx)(`option`,{value:`neutral`,children:i(`settings.bgNeutral`)}),(0,G.jsx)(`option`,{value:`warm`,children:i(`settings.bgWarm`)}),(0,G.jsx)(`option`,{value:`cool`,children:i(`settings.bgCool`)}),(0,G.jsx)(`option`,{value:`oled`,children:i(`settings.bgOled`)}),(0,G.jsx)(`option`,{value:`slate`,children:i(`settings.bgSlate`)}),(0,G.jsx)(`option`,{value:`forest`,children:i(`settings.bgForest`)})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:i(`settings.accent`)}),(0,G.jsxs)(`select`,{value:_,onChange:e=>{w(e.target.value),o(i(`settings.toast.settingsSaved`),`success`)},className:`w-full px-2 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,G.jsx)(`option`,{value:`green`,children:i(`settings.accentGreen`)}),(0,G.jsx)(`option`,{value:`teal`,children:i(`settings.accentTeal`)}),(0,G.jsx)(`option`,{value:`blue`,children:i(`settings.accentBlue`)}),(0,G.jsx)(`option`,{value:`orange`,children:i(`settings.accentOrange`)}),(0,G.jsx)(`option`,{value:`purple`,children:i(`settings.accentPurple`)}),(0,G.jsx)(`option`,{value:`red`,children:i(`settings.accentRed`)})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:i(`settings.style`)}),(0,G.jsxs)(`select`,{value:h,onChange:e=>{S(e.target.value),o(i(`settings.toast.settingsSaved`),`success`)},className:`w-full px-2 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,G.jsx)(`option`,{value:`classic`,children:i(`settings.styleClassic`)}),(0,G.jsx)(`option`,{value:`glow`,children:i(`settings.styleGlow`)}),(0,G.jsx)(`option`,{value:`vibrant`,children:i(`settings.styleVibrant`)})]})]})]})]}),(0,G.jsxs)(`div`,{className:`space-y-3 p-4 rounded-lg border ${m===`light`?`border-bambu-green bg-bambu-green/5`:`border-bambu-dark-tertiary`}`,children:[(0,G.jsxs)(`h3`,{className:`text-sm font-medium text-white flex items-center gap-2`,children:[i(`settings.lightMode`),m===`light`&&(0,G.jsx)(`span`,{className:`text-xs text-bambu-green`,children:i(`settings.active`)})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:i(`settings.background`)}),(0,G.jsxs)(`select`,{value:y,onChange:e=>{E(e.target.value),o(i(`settings.toast.settingsSaved`),`success`)},className:`w-full px-2 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,G.jsx)(`option`,{value:`neutral`,children:i(`settings.bgNeutral`)}),(0,G.jsx)(`option`,{value:`warm`,children:i(`settings.bgWarm`)}),(0,G.jsx)(`option`,{value:`cool`,children:i(`settings.bgCool`)})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:i(`settings.accent`)}),(0,G.jsxs)(`select`,{value:b,onChange:e=>{D(e.target.value),o(i(`settings.toast.settingsSaved`),`success`)},className:`w-full px-2 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,G.jsx)(`option`,{value:`green`,children:i(`settings.accentGreen`)}),(0,G.jsx)(`option`,{value:`teal`,children:i(`settings.accentTeal`)}),(0,G.jsx)(`option`,{value:`blue`,children:i(`settings.accentBlue`)}),(0,G.jsx)(`option`,{value:`orange`,children:i(`settings.accentOrange`)}),(0,G.jsx)(`option`,{value:`purple`,children:i(`settings.accentPurple`)}),(0,G.jsx)(`option`,{value:`red`,children:i(`settings.accentRed`)})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:i(`settings.style`)}),(0,G.jsxs)(`select`,{value:v,onChange:e=>{T(e.target.value),o(i(`settings.toast.settingsSaved`),`success`)},className:`w-full px-2 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,G.jsx)(`option`,{value:`classic`,children:i(`settings.styleClassic`)}),(0,G.jsx)(`option`,{value:`glow`,children:i(`settings.styleGlow`)}),(0,G.jsx)(`option`,{value:`vibrant`,children:i(`settings.styleVibrant`)})]})]})]})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.themeToggleHint`)}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between pt-2 border-t border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.progressInTitle`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.progressInTitleDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:O,onChange:e=>{k(e.target.checked),o(i(`settings.toast.settingsSaved`),`success`)},className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]})]})]}),(0,G.jsxs)(zd,{id:`card-archive`,children:[(0,G.jsx)(Bd,{children:(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:i(`settings.archiveSettings`)})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.autoArchivePrints`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.autoArchiveDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.auto_archive,onChange:e=>xr(`auto_archive`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.saveThumbnails`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.saveThumbnailsDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.save_thumbnails,onChange:e=>xr(`save_thumbnails`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.captureFinishPhoto`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.captureFinishPhotoDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.capture_finish_photo,onChange:e=>xr(`capture_finish_photo`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),A.capture_finish_photo&&(0,G.jsxs)(`div`,{className:`flex items-center justify-between pl-4 border-l-2 border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.finishPhotoRestorePlate`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.finishPhotoRestorePlateDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.finish_photo_restore_plate??!0,onChange:e=>xr(`finish_photo_restore_plate`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),A.capture_finish_photo&&En&&!En.installed&&(0,G.jsxs)(`div`,{className:`flex items-start gap-2 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg`,children:[(0,G.jsx)(Pu,{className:`w-5 h-5 text-yellow-500 flex-shrink-0 mt-0.5`}),(0,G.jsxs)(`div`,{className:`text-sm`,children:[(0,G.jsx)(`p`,{className:`text-yellow-500 font-medium`,children:i(`settings.ffmpegNotInstalled`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray mt-1`,children:i(`settings.ffmpegRequired`)})]})]}),Mn&&Nn&&(0,G.jsxs)(`div`,{className:`border-t border-bambu-dark-tertiary pt-3 mt-3 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`archiveAutoPurge.enableLabel`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`archiveAutoPurge.enableDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:Nn.enabled,onChange:e=>Fn({enabled:e.target.checked}),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`archiveAutoPurge.ageLabel`)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{type:`number`,min:7,max:3650,disabled:!Nn.enabled,value:Nn.days,onChange:e=>Fn({days:Math.max(7,Math.min(3650,parseInt(e.target.value||`0`,10)||0))}),className:`w-24 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none disabled:opacity-50`}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:i(`archiveAutoPurge.days`)})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`archiveAutoPurge.ageDescription`)})]}),(0,G.jsxs)(`label`,{className:`flex items-start gap-2 cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,disabled:!Nn.enabled,checked:Nn.purge_stats,onChange:e=>Fn({purge_stats:e.target.checked}),className:`mt-0.5 shrink-0 disabled:opacity-50`}),(0,G.jsxs)(`span`,{className:`text-sm`,children:[(0,G.jsx)(`span`,{className:`text-white block`,children:i(`archiveAutoPurge.purgeStatsLabel`)}),(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray block mt-0.5`,children:i(`archiveAutoPurge.purgeStatsDescription`)})]})]})]})]})]})]}),(0,G.jsxs)(`div`,{className:`space-y-3 flex-1 lg:max-w-md`,children:[(0,G.jsxs)(zd,{id:`card-camera`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(Hu,{className:`w-5 h-5 text-bambu-green`}),i(`settings.camera`)]})}),(0,G.jsx)(Vd,{className:`space-y-3`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-sm font-medium text-white mb-2`,children:i(`settings.externalCameras`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mb-3`,children:i(`settings.externalCamerasDescription`)}),ln&&ln.length>0?(0,G.jsx)(`div`,{className:`space-y-3`,children:ln.map(e=>(0,G.jsxs)(`div`,{className:`p-3 bg-bambu-dark rounded-lg`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,G.jsx)(`span`,{className:`text-white font-medium text-sm`,children:e.name}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:e.external_camera_enabled,onChange:t=>Nr(e.id,{enabled:t.target.checked}),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-9 h-5 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-bambu-green`})]})]}),e.external_camera_enabled&&(0,G.jsxs)(`div`,{className:`space-y-2 mt-2`,children:[(0,G.jsx)(`input`,{type:`text`,placeholder:e.external_camera_type===`usb`?i(`settings.cameraPlaceholderUsb`):i(`settings.cameraPlaceholderUrl`),value:Cr[e.id]??e.external_camera_url??``,onChange:t=>jr(e.id,t.target.value),className:`w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none`}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsxs)(`select`,{value:e.external_camera_type||`mjpeg`,onChange:t=>Nr(e.id,{type:t.target.value}),className:`flex-1 px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none`,children:[(0,G.jsx)(`option`,{value:`mjpeg`,children:i(`settings.cameraTypeMjpeg`)}),(0,G.jsx)(`option`,{value:`rtsp`,children:i(`settings.cameraTypeRtsp`)}),(0,G.jsx)(`option`,{value:`snapshot`,children:i(`settings.cameraTypeSnapshot`)}),(0,G.jsx)(`option`,{value:`usb`,children:i(`settings.cameraTypeUsb`)})]}),(0,G.jsx)(Q,{size:`sm`,variant:`secondary`,onClick:()=>Sr(e.id,Cr[e.id]??e.external_camera_url??``,e.external_camera_type||`mjpeg`),disabled:Wt[e.id]||!(Cr[e.id]??e.external_camera_url),children:Wt[e.id]?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):i(`settings.test`)})]}),Ht[e.id]&&(0,G.jsx)(`div`,{className:`text-xs flex items-center gap-1 ${Ht[e.id]?.success?`text-green-500`:`text-red-500`}`,children:Ht[e.id]?.success?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ms,{className:`w-3 h-3`}),i(`settings.connected`),Ht[e.id]?.resolution&&` (${Ht[e.id]?.resolution})`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(bs,{className:`w-3 h-3`}),Ht[e.id]?.error||i(`settings.toast.connectionFailed`)]})}),(e.external_camera_type===`mjpeg`||e.external_camera_type===`rtsp`||e.external_camera_type===`usb`)&&(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`text-xs text-bambu-gray`,children:i(`settings.cameraSnapshotUrl`,`Snapshot URL (optional)`)}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(`input`,{type:`text`,placeholder:i(`settings.cameraSnapshotUrlPlaceholder`,`http://192.168.1.61:1984/api/frame.jpeg?src=printer`),value:Dr[e.id]??e.external_camera_snapshot_url??``,onChange:t=>Mr(e.id,t.target.value),className:`flex-1 px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none`}),(0,G.jsx)(Q,{size:`sm`,variant:`secondary`,onClick:()=>Sr(e.id,Dr[e.id]??e.external_camera_snapshot_url??``,`snapshot`),disabled:Wt[e.id]||!(Dr[e.id]??e.external_camera_snapshot_url),children:Wt[e.id]?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):i(`settings.test`)})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray opacity-75`,children:i(`settings.cameraSnapshotUrlHelp`,`Single-frame URL used for notification thumbnails, finish photos, timelapse and plate detection. Leave blank to capture from the live stream above. Useful for go2rtc (/api/frame.jpeg) and IP cameras with a dedicated snapshot endpoint.`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`label`,{className:`text-xs text-bambu-gray`,children:i(`settings.cameraRotation`)}),(0,G.jsxs)(`select`,{value:e.camera_rotation||0,onChange:t=>Nr(e.id,{rotation:parseInt(t.target.value)}),className:`px-2 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-xs focus:border-bambu-green focus:outline-none`,children:[(0,G.jsx)(`option`,{value:0,children:`0°`}),(0,G.jsx)(`option`,{value:90,children:`90°`}),(0,G.jsx)(`option`,{value:180,children:`180°`}),(0,G.jsx)(`option`,{value:270,children:`270°`})]})]})]})]},e.id))}):(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray italic`,children:i(`settings.noPrintersConfigured`)})]})})]}),(0,G.jsxs)(zd,{id:`card-cost`,children:[(0,G.jsx)(Bd,{children:(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:i(`settings.costTracking`)})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.currency`)}),(0,G.jsx)(`select`,{value:A.currency,onChange:e=>xr(`currency`,e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:Lf.map(e=>(0,G.jsx)(`option`,{value:e.code,children:e.label},e.code))})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.defaultFilamentCost`)}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(`span`,{className:`absolute left-3 top-1/2 -translate-y-1/2 text-bambu-gray text-sm pointer-events-none`,children:If(A.currency)}),(0,G.jsx)(Xp,{step:`0.01`,min:0,value:A.default_filament_cost,onChange:e=>xr(`default_filament_cost`,e),integer:!1,fallback:0,style:{paddingLeft:`${Math.max(2,If(A.currency).length*.6+1)}rem`},className:`w-full pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.electricityCost`)}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(`span`,{className:`absolute left-3 top-1/2 -translate-y-1/2 text-bambu-gray text-sm pointer-events-none`,children:If(A.currency)}),(0,G.jsx)(Xp,{step:`0.001`,min:0,value:A.energy_cost_per_kwh,onChange:e=>xr(`energy_cost_per_kwh`,e),integer:!1,fallback:0,style:{paddingLeft:`${Math.max(2,If(A.currency).length*.6+1)}rem`},className:`w-full pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.energyDisplayMode`)}),(0,G.jsxs)(`select`,{value:A.energy_tracking_mode||`total`,onChange:e=>xr(`energy_tracking_mode`,e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,G.jsx)(`option`,{value:`print`,children:i(`settings.printsOnly`)}),(0,G.jsx)(`option`,{value:`total`,children:i(`settings.totalConsumption`)})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:A.energy_tracking_mode===`print`?i(`settings.energyModePrintDescription`):i(`settings.energyModeTotalDescription`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.billingEnabled`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.billingEnabledDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.billing_enabled??!1,onChange:e=>xr(`billing_enabled`,e.target.checked),className:`peer sr-only`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary rounded-full peer-checked:bg-bambu-green peer-checked:after:translate-x-5 after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border after:rounded-full after:h-5 after:w-5 after:transition-all`})]})]}),A.billing_enabled&&(0,G.jsxs)(`div`,{className:`mt-4 flex items-center justify-between gap-4 rounded-lg border border-bambu-dark-tertiary bg-bambu-dark px-4 py-3`,children:[(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.printerKillSwitch`,`Unauthorized print kill switch`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.printerKillSwitchDescription`,`Immediately stop prints that start without authorization.`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.printer_kill_switch_enabled??!1,onChange:e=>xr(`printer_kill_switch_enabled`,e.target.checked),className:`peer sr-only`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary rounded-full peer-checked:bg-bambu-green peer-checked:after:translate-x-5 after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border after:rounded-full after:h-5 after:w-5 after:transition-all`})]})]}),A.billing_enabled&&(0,G.jsxs)(`div`,{className:`mt-4 rounded-lg border border-bambu-dark-tertiary bg-bambu-dark p-4`,children:[(0,G.jsx)(`div`,{className:`mb-3`,children:(0,G.jsxs)(`h4`,{className:`text-base font-medium text-white flex items-center gap-2`,children:[(0,G.jsx)(Qo,{className:`w-4 h-4 text-bambu-green`}),i(`settings.financeBudgetReset`,`Finance Monthly Budget Reset`)]})}),(0,G.jsxs)(`div`,{className:`flex gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:i(`settings.financeBudgetResetDay`,`Reset Day`)}),(0,G.jsx)(`input`,{type:`number`,min:1,max:31,value:A.finance_budget_reset_day??1,onChange:e=>xr(`finance_budget_reset_day`,Math.max(1,Math.min(31,parseInt(e.target.value,10)||1))),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.financeBudgetResetDayHelp`,`For short months, reset uses the last day of the month.`)})]}),(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:i(`settings.financeBudgetResetTimezone`,`Reset timezone`)}),(0,G.jsxs)(`select`,{value:A.finance_budget_reset_timezone??`UTC`,onChange:e=>xr(`finance_budget_reset_timezone`,e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`,children:[(0,G.jsx)(`option`,{value:`UTC`,children:`UTC`}),(0,G.jsx)(`option`,{value:`Europe/Berlin`,children:`Europe/Berlin`}),(0,G.jsx)(`option`,{value:`Europe/Vienna`,children:`Europe/Vienna`}),(0,G.jsx)(`option`,{value:`Europe/Zurich`,children:`Europe/Zurich`}),(0,G.jsx)(`option`,{value:`America/New_York`,children:`America/New_York`}),(0,G.jsx)(`option`,{value:`America/Chicago`,children:`America/Chicago`}),(0,G.jsx)(`option`,{value:`America/Denver`,children:`America/Denver`}),(0,G.jsx)(`option`,{value:`America/Los_Angeles`,children:`America/Los_Angeles`}),(0,G.jsx)(`option`,{value:`Asia/Tokyo`,children:`Asia/Tokyo`}),(0,G.jsx)(`option`,{value:`Asia/Singapore`,children:`Asia/Singapore`}),(0,G.jsx)(`option`,{value:`Australia/Sydney`,children:`Australia/Sydney`})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.financeBudgetResetTimezoneHelp`,`Budget window start is calculated in this timezone.`)})]})]})]}),A.billing_enabled&&l&&(0,G.jsxs)(`div`,{className:`mt-3`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>Ee(!0),disabled:De,children:De?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{className:`w-4 h-4 mr-2 animate-spin`}),i(`settings.rebuildLedgerInProgress`,`Starting...`)]}):i(`settings.rebuildLedger`,`Rebuild wallet ledger`)}),Te&&(0,G.jsx)(af,{title:i(`settings.rebuildLedgerConfirmTitle`,`Rebuild wallet ledger?`),message:i(`settings.rebuildLedgerConfirmMessage`,`This will rebuild the wallet ledger to repair historical balance values. Run this only if you know what you are doing.`),confirmText:i(`common.run`,`Run`),cancelText:i(`common.cancel`,`Cancel`),isLoading:De,loadingText:i(`common.running`,`Running`),variant:`warning`,onCancel:()=>Ee(!1),onConfirm:async()=>{Oe(!0);try{await Z.rebuildBalanceLedger(),o(i(`settings.rebuildLedgerStarted`,`Ledger rebuild started`),`success`),Ee(!1)}catch(e){o(e.message||`Failed to start ledger rebuild`,`error`)}finally{Oe(!1)}}})]})]})]})]}),(0,G.jsxs)(zd,{id:`card-filemanager`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(ac,{className:`w-5 h-5 text-bambu-green`}),i(`settings.fileManager`)]})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.createArchiveEntry`)}),(0,G.jsxs)(`select`,{value:A.library_archive_mode??`ask`,onChange:e=>xr(`library_archive_mode`,e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,G.jsx)(`option`,{value:`always`,children:i(`settings.archiveMode.always`)}),(0,G.jsx)(`option`,{value:`never`,children:i(`settings.archiveMode.never`)}),(0,G.jsx)(`option`,{value:`ask`,children:i(`settings.archiveMode.ask`)})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.createArchiveEntryDescription`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.lowDiskSpaceWarning`)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Xp,{min:.5,max:100,step:`0.5`,value:A.library_disk_warning_gb??5,onChange:e=>xr(`library_disk_warning_gb`,e),integer:!1,fallback:5,className:`w-24 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:`GB`})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.lowDiskSpaceDescription`)})]}),On&&kn&&(0,G.jsxs)(`div`,{className:`border-t border-bambu-dark-tertiary pt-3 mt-3 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`libraryAutoPurge.enableLabel`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`libraryAutoPurge.enableDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:kn.auto_purge_enabled,onChange:e=>jn({auto_purge_enabled:e.target.checked}),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`libraryAutoPurge.ageLabel`)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{type:`number`,min:7,max:3650,disabled:!kn.auto_purge_enabled,value:kn.auto_purge_days,onChange:e=>jn({auto_purge_days:Math.max(7,Math.min(3650,parseInt(e.target.value||`0`,10)||0))}),className:`w-24 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none disabled:opacity-50`}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:i(`libraryAutoPurge.days`)})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`libraryAutoPurge.ageDescription`)})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-white cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,disabled:!kn.auto_purge_enabled,checked:kn.auto_purge_include_never_printed,onChange:e=>jn({auto_purge_include_never_printed:e.target.checked}),className:`rounded border-gray-300 disabled:opacity-50`}),i(`libraryAutoPurge.includeNeverPrinted`)]})]})]})]}),(0,G.jsxs)(zd,{id:`card-data`,children:[(0,G.jsx)(Bd,{children:(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:i(`settings.dataManagement`)})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.clearNotificationLogs`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.clearNotificationLogsDescription`)})]}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:()=>nt(!0),children:[(0,G.jsx)(ju,{className:`w-4 h-4`}),i(`common.clear`)]})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.resetUiPreferences`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.resetUiPreferencesDescription`)})]}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:()=>it(!0),children:[(0,G.jsx)(ju,{className:`w-4 h-4`}),i(`settings.reset`)]})]}),(0,G.jsxs)(`div`,{className:`pt-4 border-t border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.storageUsage`,`Storage Usage`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.storageUsageDescription`,`Breakdown of data usage by category`)})]}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:Qt,disabled:Zt||_t,children:[(0,G.jsx)(Il,{className:`w-4 h-4 ${Zt||_t?`animate-spin`:``}`}),i(`common.refresh`,`Refresh`)]})]}),(0,G.jsx)(`div`,{className:`mt-3`,children:Xt?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-bambu-gray`,children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),i(`common.loading`,`Loading`)]}):Yt?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`w-full h-3 bg-bambu-dark rounded-full overflow-hidden flex`,children:Yt.categories.filter(e=>e.bytes>0).map((e,t)=>(0,G.jsx)(`div`,{className:`${K8(e.key,t)} h-full`,style:{width:`${e.percent_of_total}%`},title:`${e.label}: ${e.formatted}`},e.key))}),(0,G.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-3`,children:Yt.categories.filter(e=>e.bytes>0).map((e,t)=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,G.jsx)(`span`,{className:`w-3 h-3 rounded-full ${K8(e.key,t)}`}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:e.label}),(0,G.jsx)(`span`,{className:`text-white`,children:e.formatted}),(0,G.jsxs)(`span`,{className:`text-bambu-gray`,children:[`(`,e.percent_of_total.toFixed(1),`%)`]})]},e.key))}),(0,G.jsxs)(`div`,{className:`mt-2 text-xs text-bambu-gray`,children:[i(`settings.storageUsageTotal`,`Total`),`: `,(0,G.jsx)(`span`,{className:`text-white`,children:Yt.total_formatted}),Yt.scan_errors>0&&(0,G.jsxs)(`span`,{className:`ml-2 text-amber-700 dark:text-amber-400`,children:[i(`settings.storageUsageErrors`,`Scan errors`),`: `,Yt.scan_errors]})]}),Yt.other_breakdown?.length>0&&(0,G.jsxs)(`div`,{className:`mt-4`,children:[(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mb-2`,children:i(`settings.storageUsageOtherBreakdown`,`Other breakdown`)}),(0,G.jsx)(`div`,{className:`space-y-2`,children:Yt.other_breakdown.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-white`,children:e.label}),(0,G.jsx)(`span`,{className:`px-2 py-0.5 rounded-full border ${e.kind===`system`?`border-slate-500 text-slate-300`:`border-bambu-green text-bambu-green`}`,children:e.kind===`system`?i(`settings.storageUsageSystem`,`System`):i(`settings.storageUsageData`,`Data`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-bambu-gray`,children:[(0,G.jsx)(`span`,{className:`text-white`,children:e.formatted}),(0,G.jsxs)(`span`,{children:[`(`,e.percent_of_total.toFixed(1),`%)`]})]})]},`${e.bucket}-${e.kind}`))})]})]}):(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.storageUsageUnavailable`,`Storage usage data is unavailable`)})})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between pt-4 border-t border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.backupRestore`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.backupRestoreDescription`)})]}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:()=>ze(`backup`),children:[(0,G.jsx)(Rs,{className:`w-4 h-4`}),i(`settings.goToBackup`)]})]})]})]})]}),(0,G.jsxs)(`div`,{className:`space-y-3 flex-1 lg:max-w-sm`,children:[(0,G.jsxs)(zd,{id:`card-updates`,children:[(0,G.jsx)(Bd,{children:(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:i(`settings.updates`)})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsx)(`p`,{className:`text-xs font-medium text-bambu-gray uppercase tracking-wider`,children:i(`settings.printerFirmware`)}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.checkPrinterFirmware`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.checkFirmwareDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.check_printer_firmware??!0,onChange:e=>xr(`check_printer_firmware`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),(0,G.jsx)(`div`,{className:`border-t border-bambu-dark-tertiary pt-4`,children:(0,G.jsx)(`p`,{className:`text-xs font-medium text-bambu-gray uppercase tracking-wider mb-4`,children:i(`settings.bambuddySoftware`)})}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.checkForUpdatesLabel`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.autoCheckDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.check_updates,onChange:e=>xr(`check_updates`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between ${A.check_updates?``:`opacity-50`}`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.includeBetaUpdates`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.includeBetaUpdatesDesc`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.include_beta_updates??!1,onChange:e=>xr(`include_beta_updates`,e.target.checked),disabled:!A.check_updates,className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.currentVersion`)}),(0,G.jsxs)(`p`,{className:`text-sm text-bambu-gray`,children:[`v`,Dn?.version||`...`]})]}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:()=>Ln(),disabled:Rn,children:[Rn?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(Il,{className:`w-4 h-4`}),i(`settings.checkNow`)]})]}),In?.update_available?(0,G.jsxs)(`div`,{className:`mt-4 p-3 bg-bambu-green/10 border border-bambu-green/30 rounded-lg`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`p`,{className:`text-bambu-green font-medium`,children:[`Update available: v`,In.latest_version]}),In.release_name&&In.release_name!==In.latest_version&&(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:In.release_name})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[In.release_notes&&(0,G.jsx)(`button`,{onClick:()=>ct(!0),className:`text-bambu-gray hover:text-white transition-colors text-sm underline`,children:i(`settings.releaseNotes`)}),In.release_url&&(0,G.jsx)(`a`,{href:In.release_url,target:`_blank`,rel:`noopener noreferrer`,className:`text-bambu-gray hover:text-white transition-colors`,title:i(`settings.viewReleaseOnGitHub`),children:(0,G.jsx)(Xs,{className:`w-4 h-4`})})]})]}),zn?.status===`downloading`||zn?.status===`installing`?(0,G.jsxs)(`div`,{className:`mt-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-bambu-gray`,children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),(0,G.jsx)(`span`,{children:zn.message})]}),(0,G.jsx)(`div`,{className:`mt-2 w-full bg-bambu-dark-tertiary rounded-full h-2`,children:(0,G.jsx)(`div`,{className:`bg-bambu-green h-2 rounded-full transition-all duration-300`,style:{width:`${zn.progress}%`}})})]}):zn?.status===`complete`?(0,G.jsx)(`div`,{className:`mt-3 p-2 bg-bambu-green/20 rounded text-sm text-bambu-green`,children:zn.message}):zn?.status===`error`?(0,G.jsx)(`div`,{className:`mt-3 p-2 bg-red-100 dark:bg-red-500/20 rounded text-sm text-red-700 dark:text-red-400`,children:zn.error||zn.message}):In?.is_ha_addon?(0,G.jsx)(`div`,{className:`mt-3 p-3 bg-bambu-dark-tertiary rounded-lg`,children:(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.updateViaHomeAssistant`)})}):In?.is_docker?(0,G.jsxs)(`div`,{className:`mt-3 p-3 bg-bambu-dark-tertiary rounded-lg`,children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mb-2`,children:i(`settings.updateViaDocker`)}),(0,G.jsxs)(`div`,{className:`flex items-start gap-1`,children:[(0,G.jsx)(`code`,{className:`flex-1 block text-xs bg-bambu-dark p-2 rounded text-bambu-green font-mono break-all select-all`,children:zr}),(0,G.jsx)(VU,{value:zr,titleKey:`settings.copyUpdateCommand`,copiedTitleKey:`printers.copied`,className:`ml-0 p-2 rounded hover:bg-bambu-dark text-bambu-gray hover:text-white transition-colors flex-shrink-0`,iconClassName:`w-4 h-4`})]}),(0,G.jsxs)(`label`,{className:`block mt-3`,children:[(0,G.jsx)(`span`,{className:`block text-xs text-bambu-gray mb-1`,children:i(`settings.composeDirectory`)}),(0,G.jsx)(`input`,{type:`text`,value:A?.docker_compose_dir??``,onChange:e=>xr(`docker_compose_dir`,e.target.value),placeholder:In?.compose_dir_detected||`/opt/bambuddy`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded text-sm text-white font-mono placeholder:text-bambu-gray/60 focus:outline-none focus:border-bambu-green`}),(0,G.jsx)(`span`,{className:`block text-xs text-bambu-gray mt-1`,children:i(`settings.composeDirectoryHint`)})]})]}):In?.update_method===`windows_installer`?(0,G.jsxs)(`div`,{className:`mt-3 p-3 bg-bambu-dark-tertiary rounded-lg`,children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mb-3`,children:i(`settings.updateViaWindowsInstaller`)}),(0,G.jsxs)(`a`,{href:In.installer_download_url||In.release_url||`https://github.com/maziggy/bambuddy/releases/tag/v${In.latest_version}`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center justify-center font-medium rounded-lg transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-bambu-dark disabled:opacity-50 bg-bambu-green hover:bg-bambu-green-light text-white focus:ring-bambu-green px-4 py-2 text-sm gap-2 min-h-[44px] md:min-h-0`,children:[(0,G.jsx)(Us,{className:`w-4 h-4`}),i(`settings.downloadWindowsInstaller`,{version:In.latest_version})]})]}):(0,G.jsxs)(Q,{className:`mt-3`,onClick:()=>lr.mutate(),disabled:lr.isPending,children:[lr.isPending?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(Us,{className:`w-4 h-4`}),i(`settings.installUpdate`)]})]}):In?.error?(0,G.jsx)(`div`,{className:`mt-2 p-2 bg-red-50 dark:bg-red-500/10 border border-red-300 dark:border-red-500/30 rounded text-sm text-red-700 dark:text-red-400`,children:i(`settings.failedToCheckUpdates`,{error:In.error})}):In&&!In.update_available?(0,G.jsx)(`p`,{className:`mt-2 text-sm text-bambu-gray`,children:i(`settings.latestVersionRunning`)}):null]})]})]}),(0,G.jsx)(iKe,{})]})]})]}),Ne===`network`&&A&&(0,G.jsxs)(`div`,{className:`flex flex-col lg:flex-row gap-6`,children:[(0,G.jsxs)(`div`,{className:`flex-1 lg:max-w-xl space-y-3`,children:[(0,G.jsxs)(zd,{id:`card-externalurl`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(Cc,{className:`w-5 h-5 text-blue-600 dark:text-blue-400`}),i(`settings.externalUrl`)]})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.externalUrlDescription`)}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.bambuddyUrl`)}),(0,G.jsx)(`input`,{type:`text`,value:A.external_url??``,onChange:e=>xr(`external_url`,e.target.value),placeholder:`http://192.168.1.100:8000`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.externalUrlHint`)})]})]})]}),(0,G.jsxs)(zd,{id:`card-ftpretry`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(Il,{className:`w-5 h-5 text-blue-600 dark:text-blue-400`}),i(`settings.ftpRetry`)]})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.ftpRetryDescription`)}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.enableRetry`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.autoRetryDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.ftp_retry_enabled??!0,onChange:e=>xr(`ftp_retry_enabled`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),A.ftp_retry_enabled&&(0,G.jsxs)(`div`,{className:`space-y-3 pt-2 border-t border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.retryAttempts`)}),(0,G.jsxs)(`div`,{className:`relative w-44`,children:[(0,G.jsx)(`select`,{value:A.ftp_retry_count??3,onChange:e=>xr(`ftp_retry_count`,parseInt(e.target.value)),className:`w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer`,children:[1,2,3,4,5,6,7,8,9,10].map(e=>(0,G.jsx)(`option`,{value:e,children:i(`settings.time`,{count:e})},e))}),(0,G.jsx)(as,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.retryDelay`)}),(0,G.jsxs)(`div`,{className:`relative w-44`,children:[(0,G.jsx)(`select`,{value:A.ftp_retry_delay??2,onChange:e=>xr(`ftp_retry_delay`,parseInt(e.target.value)),className:`w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer`,children:[1,2,3,5,10,15,20,30].map(e=>(0,G.jsx)(`option`,{value:e,children:i(`settings.second`,{count:e})},e))}),(0,G.jsx)(as,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.connectionTimeout`)}),(0,G.jsxs)(`div`,{className:`relative w-44`,children:[(0,G.jsx)(`select`,{value:A.ftp_timeout??30,onChange:e=>xr(`ftp_timeout`,parseInt(e.target.value)),className:`w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer`,children:[10,15,20,30,45,60,90,120,180,300].map(e=>(0,G.jsx)(`option`,{value:e,children:i(`settings.nSeconds`,{count:e})},e))}),(0,G.jsx)(as,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.increaseForWeakWifi`)})]})]})]})]})]}),(0,G.jsxs)(`div`,{className:`flex-1 lg:max-w-xl space-y-3`,children:[(0,G.jsxs)(zd,{id:`card-ha`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(Pc,{className:`w-5 h-5 text-bambu-green`}),i(`settings.homeAssistant`)]}),A.ha_enabled&&Rt&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`w-2.5 h-2.5 rounded-full ${Rt.success?`bg-green-400`:`bg-red-400`}`}),(0,G.jsx)(`span`,{className:`text-sm ${Rt.success?`text-green-700 dark:text-green-400`:`text-red-700 dark:text-red-400`}`,children:Rt.success?i(`settings.connected`):i(`settings.disconnected`)})]})]})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.homeAssistantFullDescription`)}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.enableHomeAssistant`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.homeAssistantDescription`)}),A.ha_env_managed&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1 mt-1`,children:[(0,G.jsx)(Xc,{className:`w-3 h-3 text-bambu-green`}),(0,G.jsx)(`span`,{className:`text-xs text-bambu-green`,children:i(`settings.autoEnabledViaEnv`)})]})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.ha_enabled??!1,onChange:e=>xr(`ha_enabled`,e.target.checked),disabled:A.ha_env_managed,className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green ${A.ha_env_managed?`opacity-60 cursor-not-allowed`:``}`})]})]}),A.ha_enabled&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:[i(`settings.homeAssistantUrl`),A.ha_url_from_env&&(0,G.jsx)(`span`,{className:`ml-2 text-xs text-bambu-green`,children:i(`settings.environmentManagedLabel`)})]}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(`input`,{type:`text`,value:A.ha_url??``,onChange:e=>xr(`ha_url`,e.target.value),placeholder:`http://192.168.1.100:8123`,disabled:A.ha_url_from_env,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none ${A.ha_url_from_env?`opacity-60 cursor-not-allowed`:``}`}),A.ha_url_from_env&&(0,G.jsx)(Xc,{className:`absolute right-3 top-2.5 w-4 h-4 text-bambu-gray`})]}),A.ha_url_from_env&&(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.urlFromEnvReadOnly`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:[i(`settings.longLivedAccessToken`),A.ha_token_from_env&&(0,G.jsx)(`span`,{className:`ml-2 text-xs text-bambu-green`,children:i(`settings.environmentManagedLabel`)})]}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(`input`,{type:`password`,value:A.ha_token??``,onChange:e=>xr(`ha_token`,e.target.value),placeholder:`eyJ0eXAiOiJKV1QiLC...`,disabled:A.ha_token_from_env,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none ${A.ha_token_from_env?`opacity-60 cursor-not-allowed`:``}`}),A.ha_token_from_env&&(0,G.jsx)(Xc,{className:`absolute right-3 top-2.5 w-4 h-4 text-bambu-gray`})]}),A.ha_token_from_env?(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.tokenFromEnvReadOnly`)}):(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.haTokenHint`)})]}),A.ha_url&&A.ha_token&&(0,G.jsx)(`div`,{className:`pt-2 border-t border-bambu-dark-tertiary`,children:(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,disabled:Bt,onClick:async()=>{Vt(!0),zt(null);try{zt(await Z.testHAConnection(A.ha_url,A.ha_token))}catch(e){zt({success:!1,message:null,error:e instanceof Error?e.message:i(`common.unknownError`)})}finally{Vt(!1)}},children:[Bt?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(Yu,{className:`w-4 h-4`}),i(`settings.testConnection`)]})})]})]})]}),(0,G.jsxs)(zd,{id:`card-mqtt`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(Yu,{className:`w-5 h-5 text-blue-600 dark:text-blue-400`}),i(`settings.mqttPublishing`)]}),Vn?.enabled&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`w-2.5 h-2.5 rounded-full ${Vn.connected?`bg-green-400`:`bg-red-400`}`}),(0,G.jsx)(`span`,{className:`text-sm ${Vn.connected?`text-green-700 dark:text-green-400`:`text-red-700 dark:text-red-400`}`,children:Vn.connected?i(`settings.connected`):i(`settings.disconnected`)})]})]})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.mqttDescription`)}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.enableMqtt`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.mqttEnableDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.mqtt_enabled??!1,onChange:e=>xr(`mqtt_enabled`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),A.mqtt_enabled&&(0,G.jsxs)(`div`,{className:`space-y-3 pt-2 border-t border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.brokerHostname`)}),(0,G.jsx)(`input`,{type:`text`,value:A.mqtt_broker??``,onChange:e=>xr(`mqtt_broker`,e.target.value),placeholder:`mqtt.example.com or 192.168.1.100`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})]}),(0,G.jsxs)(`div`,{className:`flex items-end gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.port`)}),(0,G.jsx)(Xp,{min:1,max:65535,value:A.mqtt_port??1883,onChange:e=>xr(`mqtt_port`,e),fallback:1883,className:`w-24 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 pb-2`,children:[(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.mqtt_use_tls??!1,onChange:e=>{let t=e.target.checked;xr(`mqtt_use_tls`,t);let n=A.mqtt_port??1883;t&&n===1883?xr(`mqtt_port`,8883):!t&&n===8883&&xr(`mqtt_port`,1883)},className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]}),(0,G.jsx)(`span`,{className:`text-white text-sm`,children:i(`settings.useTls`)})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.usernameOptional`)}),(0,G.jsx)(`input`,{type:`text`,value:A.mqtt_username??``,onChange:e=>xr(`mqtt_username`,e.target.value),placeholder:i(`settings.leaveEmptyForAnonymous`),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.passwordOptional`)}),(0,G.jsx)(`input`,{type:`password`,value:A.mqtt_password??``,onChange:e=>xr(`mqtt_password`,e.target.value),placeholder:i(`settings.leaveEmptyForAnonymous`),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.topicPrefix`)}),(0,G.jsx)(`input`,{type:`text`,value:A.mqtt_topic_prefix??`bambuddy`,onChange:e=>xr(`mqtt_topic_prefix`,e.target.value),placeholder:`bambuddy`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.topicPrefixHint`,{prefix:A.mqtt_topic_prefix||`bambuddy`})})]}),Vn&&(0,G.jsx)(`div`,{className:`pt-3 mt-3 border-t border-bambu-dark-tertiary`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full ${Vn.connected?`bg-green-400`:`bg-red-400`}`}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:Vn.connected?(0,G.jsxs)(G.Fragment,{children:[i(`settings.mqttConnectedTo`),` `,(0,G.jsxs)(`span`,{className:`text-white`,children:[Vn.broker,`:`,Vn.port]})]}):i(`settings.spoolmanDisconnected`)})]})})]})]})]})]}),(0,G.jsx)(`div`,{className:`flex-1 lg:max-w-md space-y-3`,children:(0,G.jsxs)(zd,{id:`card-prometheus`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(Nu,{className:`w-5 h-5 text-orange-600 dark:text-orange-400`}),i(`settings.prometheusMetrics`)]})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.prometheusEndpointDescription`)}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.enableMetricsEndpoint`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.prometheusDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.prometheus_enabled??!1,onChange:e=>xr(`prometheus_enabled`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),A.prometheus_enabled&&(0,G.jsxs)(`div`,{className:`space-y-3 pt-2 border-t border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.bearerTokenOptional`)}),(0,G.jsx)(`input`,{type:`password`,value:A.prometheus_token??``,onChange:e=>xr(`prometheus_token`,e.target.value),placeholder:i(`settings.leaveEmptyForNoAuth`),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.bearerTokenHint`)})]}),(0,G.jsxs)(`div`,{className:`pt-2 border-t border-bambu-dark-tertiary`,children:[(0,G.jsx)(`p`,{className:`text-sm text-white mb-2`,children:i(`settings.availableMetrics`)}),(0,G.jsxs)(`div`,{className:`text-xs text-bambu-gray space-y-1`,children:[(0,G.jsxs)(`p`,{children:[(0,G.jsx)(`code`,{className:`text-orange-700 dark:text-orange-400`,children:`bambuddy_printer_connected`}),` - `,i(`settings.metricsConnectionStatus`)]}),(0,G.jsxs)(`p`,{children:[(0,G.jsx)(`code`,{className:`text-orange-700 dark:text-orange-400`,children:`bambuddy_printer_state`}),` - `,i(`settings.metricsPrinterState`)]}),(0,G.jsxs)(`p`,{children:[(0,G.jsx)(`code`,{className:`text-orange-700 dark:text-orange-400`,children:`bambuddy_print_progress`}),` - `,i(`settings.metricsPrintProgress`)]}),(0,G.jsxs)(`p`,{children:[(0,G.jsx)(`code`,{className:`text-orange-700 dark:text-orange-400`,children:`bambuddy_bed_temp_celsius`}),` - `,i(`settings.metricsBedTemp`)]}),(0,G.jsxs)(`p`,{children:[(0,G.jsx)(`code`,{className:`text-orange-700 dark:text-orange-400`,children:`bambuddy_nozzle_temp_celsius`}),` - `,i(`settings.metricsNozzleTemp`)]}),(0,G.jsxs)(`p`,{children:[(0,G.jsx)(`code`,{className:`text-orange-700 dark:text-orange-400`,children:`bambuddy_prints_total`}),` - `,i(`settings.metricsPrintsTotal`)]}),(0,G.jsx)(`p`,{className:`text-bambu-gray/70 italic`,children:i(`settings.metricsMore`)})]})]})]})]})]})})]}),Rt&&(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50`,children:(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg p-6 max-w-md w-full mx-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 mb-4`,children:[Rt.success?(0,G.jsx)(ms,{className:`w-8 h-8 text-green-600 dark:text-green-400`}):(0,G.jsx)(bs,{className:`w-8 h-8 text-red-600 dark:text-red-400`}),(0,G.jsx)(`h3`,{className:`text-lg font-medium text-white`,children:Rt.success?i(`settings.connectionSuccessful`):i(`settings.connectionFailed`)})]}),(0,G.jsx)(`p`,{className:`text-bambu-gray mb-6`,children:Rt.success?Rt.message||i(`settings.haConnectionSuccess`):Rt.error||i(`settings.haConnectionFailed`)}),(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsx)(Q,{variant:`primary`,onClick:()=>zt(null),children:i(`settings.ok`)})})]})}),Ne===`plugs`&&(0,G.jsxs)(`div`,{id:`card-plugs`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between mb-6`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(Ol,{className:`w-5 h-5 text-bambu-green`}),i(`settings.smartPlugs`)]}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:i(`settings.smartPlugsDescription`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 pt-1 shrink-0`,children:[$t&&$t.filter(e=>e.enabled).length>1&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,className:`whitespace-nowrap`,onClick:()=>ot(`on`),disabled:pr.isPending,title:i(`settings.turnAllPlugsOn`),children:[pr.isPending?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(jl,{className:`w-4 h-4 text-bambu-green`}),i(`settings.allOn`)]}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,className:`whitespace-nowrap`,onClick:()=>ot(`off`),disabled:pr.isPending,title:i(`settings.turnAllPlugsOff`),children:[pr.isPending?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(Al,{className:`w-4 h-4 text-red-600 dark:text-red-400`}),i(`settings.allOff`)]})]}),(0,G.jsxs)(Q,{className:`whitespace-nowrap`,onClick:()=>{z(null),L(!0)},children:[(0,G.jsx)(kl,{className:`w-4 h-4`}),i(`settings.addSmartPlug`)]})]})]}),$t&&$t.length>0&&(0,G.jsxs)(zd,{className:`mb-6`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(td,{className:`w-4 h-4 text-yellow-600 dark:text-yellow-400`}),i(`settings.energySummary`),nn&&(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin text-bambu-gray ml-2`})]})}),(0,G.jsx)(Vd,{children:tn?(0,G.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-4`,children:[(0,G.jsxs)(`div`,{className:`bg-bambu-dark rounded-lg p-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-bambu-gray text-xs mb-1`,children:[(0,G.jsx)(td,{className:`w-3 h-3`}),i(`settings.currentPower`)]}),(0,G.jsxs)(`div`,{className:`text-xl font-bold text-white`,children:[tn.totalPower.toFixed(1),(0,G.jsx)(`span`,{className:`text-sm font-normal text-bambu-gray ml-1`,children:`W`})]}),(0,G.jsx)(`div`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.plugsOnline`,{reachable:tn.reachableCount,total:tn.totalPlugs})})]}),(0,G.jsxs)(`div`,{className:`bg-bambu-dark rounded-lg p-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-bambu-gray text-xs mb-1`,children:[(0,G.jsx)(Qo,{className:`w-3 h-3`}),i(`settings.today`)]}),(0,G.jsxs)(`div`,{className:`text-xl font-bold text-white`,children:[tn.totalToday.toFixed(3),(0,G.jsx)(`span`,{className:`text-sm font-normal text-bambu-gray ml-1`,children:`kWh`})]}),(A?.energy_cost_per_kwh??0)>0&&(0,G.jsxs)(`div`,{className:`text-xs text-bambu-gray mt-1`,children:[`~`,(tn.totalToday*(A?.energy_cost_per_kwh??0)).toFixed(2),` `,If(A?.currency||`USD`)]})]}),(0,G.jsxs)(`div`,{className:`bg-bambu-dark rounded-lg p-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-bambu-gray text-xs mb-1`,children:[(0,G.jsx)(Nu,{className:`w-3 h-3`}),i(`settings.yesterday`)]}),(0,G.jsxs)(`div`,{className:`text-xl font-bold text-white`,children:[tn.totalYesterday.toFixed(3),(0,G.jsx)(`span`,{className:`text-sm font-normal text-bambu-gray ml-1`,children:`kWh`})]}),(A?.energy_cost_per_kwh??0)>0&&(0,G.jsxs)(`div`,{className:`text-xs text-bambu-gray mt-1`,children:[`~`,(tn.totalYesterday*(A?.energy_cost_per_kwh??0)).toFixed(2),` `,If(A?.currency||`USD`)]})]}),(0,G.jsxs)(`div`,{className:`bg-bambu-dark rounded-lg p-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-bambu-gray text-xs mb-1`,children:[(0,G.jsx)(Bs,{className:`w-3 h-3`}),i(`settings.total`)]}),(0,G.jsxs)(`div`,{className:`text-xl font-bold text-white`,children:[tn.totalLifetime.toFixed(1),(0,G.jsx)(`span`,{className:`text-sm font-normal text-bambu-gray ml-1`,children:`kWh`})]}),(A?.energy_cost_per_kwh??0)>0&&(0,G.jsxs)(`div`,{className:`text-xs text-bambu-gray mt-1`,children:[`~`,(tn.totalLifetime*(A?.energy_cost_per_kwh??0)).toFixed(2),` `,If(A?.currency||`USD`)]})]})]}):nn?null:(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.enablePlugsForSummary`)})})]}),en?(0,G.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,G.jsx)(Y,{className:`w-8 h-8 text-bambu-green animate-spin`})}):$t&&$t.length>0?(0,G.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4`,children:$t.map(e=>(0,G.jsx)(TGe,{plug:e,onEdit:e=>{z(e),L(!0)}},e.id))}):(0,G.jsx)(zd,{children:(0,G.jsx)(Vd,{className:`py-12`,children:(0,G.jsxs)(`div`,{className:`text-center text-bambu-gray`,children:[(0,G.jsx)(Ol,{className:`w-16 h-16 mx-auto mb-4 opacity-30`}),(0,G.jsx)(`p`,{className:`text-lg font-medium text-white mb-2`,children:i(`settings.noSmartPlugsTitle`)}),(0,G.jsx)(`p`,{className:`text-sm mb-4`,children:i(`settings.noSmartPlugsDescription`)}),(0,G.jsxs)(Q,{onClick:()=>{z(null),L(!0)},children:[(0,G.jsx)(kl,{className:`w-4 h-4`}),i(`settings.addFirstSmartPlug`)]})]})})})]}),Ne===`sensors`&&(0,G.jsxs)(`div`,{id:`card-sensors`,children:[(0,G.jsxs)(`div`,{id:`card-ha-sensors`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(vc,{className:`w-5 h-5 text-bambu-green`}),i(`haSensors.sectionTitle`)]}),(0,G.jsxs)(Q,{className:`whitespace-nowrap`,disabled:!ln?.length,onClick:()=>{te(null),V(!0)},children:[(0,G.jsx)(kl,{className:`w-4 h-4`}),i(`haSensors.add`)]})]}),un&&un.length>0?(0,G.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:un.map(e=>{let t=ln?.find(t=>t.id===e.printer_id);return(0,G.jsx)(zd,{children:(0,G.jsxs)(Vd,{className:`py-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-white font-medium truncate`,children:e.name}),(0,G.jsx)(`div`,{className:`text-xs text-bambu-gray truncate`,children:e.entity_id}),(0,G.jsx)(`div`,{className:`text-xs text-bambu-gray mt-1`,children:t?.name??i(`haSensors.unknownPrinter`)})]}),(0,G.jsx)(Q,{size:`sm`,variant:`secondary`,onClick:()=>{te(e),V(!0)},children:i(`common.edit`)})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-1 mt-3`,children:[e.block_print&&(0,G.jsx)(`span`,{className:`px-2 py-0.5 text-xs rounded bg-amber-100 dark:bg-amber-500/20 text-amber-700 dark:text-amber-400`,children:i(`haSensors.badgeBlocks`)}),e.notify_on_alert&&(0,G.jsx)(`span`,{className:`px-2 py-0.5 text-xs rounded bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400`,children:i(`haSensors.badgeNotifies`)}),!e.show_on_printer_card&&(0,G.jsx)(`span`,{className:`px-2 py-0.5 text-xs rounded bg-bambu-dark-tertiary text-bambu-gray`,children:i(`haSensors.badgeHidden`)})]})]})},e.id)})}):(0,G.jsx)(zd,{children:(0,G.jsx)(Vd,{className:`py-8`,children:(0,G.jsxs)(`div`,{className:`text-center text-bambu-gray`,children:[(0,G.jsx)(vc,{className:`w-12 h-12 mx-auto mb-3 opacity-30`}),(0,G.jsx)(`p`,{className:`text-sm`,children:i(`haSensors.empty`)})]})})})]}),(0,G.jsxs)(`div`,{id:`card-location-sensors`,className:`mt-8`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-[20px] mb-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(vc,{className:`w-5 h-5 text-bambu-green`}),i(`locationHaSensors.sectionTitle`)]}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:i(`locationHaSensors.sectionDescription`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 pt-1 shrink-0`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>se(!0),className:`p-2 rounded-lg bg-bambu-dark-tertiary hover:bg-bambu-gray-dark text-white transition-colors`,title:i(`locationHaSensors.options.buttonLabel`),"aria-label":i(`locationHaSensors.options.buttonLabel`),children:(0,G.jsx)(js,{className:`w-4 h-4`})}),(0,G.jsxs)(Q,{className:`whitespace-nowrap`,disabled:!fn?.length,onClick:()=>{ae(null),re(!0)},children:[(0,G.jsx)(kl,{className:`w-4 h-4`}),i(`locationHaSensors.add`)]})]})]}),dn&&dn.length>0?(0,G.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:(()=>{let e=new Map((fn??[]).map((e,t)=>[e.id,t])),t=dn.reduce((e,t)=>{let n=e.get(t.location_id)??[];return n.push(t),e.set(t.location_id,n),e},new Map);return Array.from(t.entries()).sort(([t],[n])=>(e.get(t)??2**53-1)-(e.get(n)??2**53-1))})().map(([e,t])=>{let n=fn?.find(t=>t.id===e),r=e=>yE({device_class:e.device_class,state:e.last_state,kind:e.kind}),a=[...t].sort((e,t)=>(q8[e.device_class??``]??99)-(q8[t.device_class??``]??99));return(0,G.jsx)(zd,{children:(0,G.jsxs)(Vd,{className:`py-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,G.jsx)(`div`,{className:`text-white font-medium truncate`,children:n?.name??i(`locationHaSensors.unknownLocation`)}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>fe({locationName:n?.name??i(`locationHaSensors.unknownLocation`),sensorIds:a.map(e=>e.id)}),className:`p-1 text-bambu-gray hover:text-red-500 rounded transition-colors shrink-0`,title:i(`common.delete`),"aria-label":i(`common.delete`),children:(0,G.jsx)(ju,{className:`w-3.5 h-3.5`})})]}),(0,G.jsx)(`div`,{className:`mt-2 space-y-1.5`,children:a.map(e=>{let t=r(e),n=mn.get(e.id),a=BKe(n,i),o=L6(H&&n?I6(n):null,ce,le,ue)||`text-white`;return(0,G.jsxs)(`div`,{className:`flex items-center min-w-0 text-xs text-bambu-gray`,children:[(0,G.jsx)(t,{className:`w-3.5 h-3.5 shrink-0 mr-1.5`}),a&&(0,G.jsx)(`span`,{className:`${o} shrink-0 w-[52px] text-center`,children:a}),a&&(0,G.jsx)(`span`,{className:`shrink-0 mr-1.5`,children:`-`}),(0,G.jsx)(`span`,{className:`truncate mr-1.5`,title:e.name,children:e.entity_id}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>{ae(e),re(!0)},className:`p-1 text-bambu-gray hover:text-white rounded transition-colors shrink-0`,title:i(`common.edit`),"aria-label":i(`common.edit`),children:(0,G.jsx)(wl,{className:`w-3.5 h-3.5`})})]},e.id)})}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-1 mt-3`,children:[(()=>{let e=a.filter(e=>e.notify_on_alert);return e.length?(0,G.jsxs)(`span`,{className:`flex items-center gap-1 px-2 py-0.5 text-xs rounded bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400`,children:[i(`haSensors.badgeNotifies`),e.map(e=>(0,G.jsx)(r(e),{className:`w-3 h-3`},e.id))]}):null})(),(()=>{let e=a.filter(e=>!e.show_on_card);return e.length?(0,G.jsxs)(`span`,{className:`flex items-center gap-1 px-2 py-0.5 text-xs rounded bg-bambu-dark-tertiary text-bambu-gray`,children:[i(`haSensors.badgeHidden`),e.map(e=>(0,G.jsx)(r(e),{className:`w-3 h-3`},e.id))]}):null})()]})]})},e)})}):(0,G.jsx)(zd,{children:(0,G.jsx)(Vd,{className:`py-8`,children:(0,G.jsxs)(`div`,{className:`text-center text-bambu-gray`,children:[(0,G.jsx)(vc,{className:`w-12 h-12 mx-auto mb-3 opacity-30`}),(0,G.jsx)(`p`,{className:`text-sm`,children:i(`locationHaSensors.empty`)})]})})})]})]}),Ne===`notifications`&&(0,G.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,id:`card-providers`,children:[(0,G.jsx)(Vo,{className:`w-5 h-5 text-bambu-green`}),i(`settings.providers`)]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(Q,{size:`sm`,variant:`secondary`,onClick:()=>we(!0),children:[(0,G.jsx)(Mc,{className:`w-4 h-4`}),i(`settings.log`)]}),W&&W.length>0&&(0,G.jsxs)(Q,{size:`sm`,variant:`secondary`,onClick:()=>{dr(null),fr.mutate()},disabled:fr.isPending,children:[fr.isPending?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(ql,{className:`w-4 h-4`}),i(`settings.testAll`)]}),(0,G.jsxs)(Q,{size:`sm`,onClick:()=>{ge(null),me(!0)},children:[(0,G.jsx)(kl,{className:`w-4 h-4`}),i(`settings.addNotificationProvider`)]})]})]}),(0,G.jsx)(zd,{className:`mb-4`,children:(0,G.jsx)(Vd,{className:`py-3`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white text-sm font-medium`,children:i(`settings.notificationLanguage`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.notificationLanguageDescription`)})]}),(0,G.jsx)(`select`,{value:A.notification_language||`en`,onChange:e=>xr(`notification_language`,e.target.value),className:`px-2 py-1.5 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm focus:outline-none focus:ring-1 focus:ring-bambu-green`,children:St.map(e=>(0,G.jsx)(`option`,{value:e.code,children:e.nativeName},e.code))})]})})}),(0,G.jsx)(zd,{className:`mb-4`,children:(0,G.jsx)(Vd,{className:`py-3`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white text-sm font-medium`,children:i(`settings.bedCooledThreshold`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.bedCooledThresholdDescription`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(`input`,{type:`number`,min:20,max:80,step:1,value:A.bed_cooled_threshold??35,onChange:e=>xr(`bed_cooled_threshold`,Number(e.target.value)),className:`w-16 px-2 py-1.5 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm text-center focus:outline-none focus:ring-1 focus:ring-bambu-green`}),(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:`°C`})]})]})})}),(0,G.jsx)(zd,{className:`mb-4`,children:(0,G.jsx)(Vd,{className:`py-3`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between ${Wn?.advanced_auth_enabled?``:`opacity-50`}`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white text-sm font-medium`,children:i(`settings.userNotificationsEnabled`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:Wn?.advanced_auth_enabled?i(`settings.userNotificationsEnabledDescription`):i(`settings.userNotificationsDisabledHint`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,className:`sr-only peer`,checked:A.user_notifications_enabled??!0,disabled:!Wn?.advanced_auth_enabled,onChange:e=>xr(`user_notifications_enabled`,e.target.checked)}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green peer-disabled:cursor-not-allowed`})]})]})})}),ur&&(0,G.jsx)(zd,{className:`mb-4`,children:(0,G.jsxs)(Vd,{className:`py-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium text-white`,children:i(`settings.testResults`)}),(0,G.jsx)(`button`,{onClick:()=>dr(null),className:`text-bambu-gray hover:text-white text-xs`,children:i(`common.dismiss`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-4 text-sm mb-2`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-bambu-green`,children:[(0,G.jsx)(ms,{className:`w-4 h-4`}),i(`settings.testPassedCount`,{count:ur.success})]}),ur.failed>0&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-red-700 dark:text-red-400`,children:[(0,G.jsx)(bs,{className:`w-4 h-4`}),i(`settings.testFailedCount`,{count:ur.failed})]})]}),ur.results.filter(e=>!e.success).length>0&&(0,G.jsx)(`div`,{className:`space-y-1 mt-2 pt-2 border-t border-bambu-dark-tertiary`,children:ur.results.filter(e=>!e.success).map(e=>(0,G.jsxs)(`div`,{className:`text-xs text-red-700 dark:text-red-400`,children:[(0,G.jsxs)(`span`,{className:`font-medium`,children:[e.provider_name,`:`]}),` `,e.message]},e.provider_id))})]})}),rn?(0,G.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,G.jsx)(Y,{className:`w-6 h-6 text-bambu-green animate-spin`})}):W&&W.length>0?(0,G.jsx)(`div`,{className:`space-y-3`,children:W.map(e=>(0,G.jsx)(NGe,{provider:e,onEdit:e=>{ge(e),me(!0)}},e.id))}):(0,G.jsx)(zd,{children:(0,G.jsx)(Vd,{className:`py-8`,children:(0,G.jsxs)(`div`,{className:`text-center text-bambu-gray`,children:[(0,G.jsx)(Vo,{className:`w-12 h-12 mx-auto mb-3 opacity-30`}),(0,G.jsx)(`p`,{className:`text-sm font-medium text-white mb-2`,children:i(`settings.noProvidersTitle`)}),(0,G.jsx)(`p`,{className:`text-xs mb-3`,children:i(`settings.noProvidersDescription`)}),(0,G.jsxs)(Q,{size:`sm`,onClick:()=>{ge(null),me(!0)},children:[(0,G.jsx)(kl,{className:`w-4 h-4`}),i(`settings.addProvider`)]})]})})})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2 mb-2`,id:`card-templates`,children:[(0,G.jsx)(ac,{className:`w-5 h-5 text-bambu-green`}),i(`settings.messageTemplates`)]}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mb-3`,children:i(`settings.messageTemplatesDescription`)}),(0,G.jsxs)(`div`,{className:`relative mb-3`,children:[(0,G.jsx)(Kl,{className:`w-4 h-4 text-bambu-gray absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none`}),(0,G.jsx)(`input`,{type:`text`,value:ye,onChange:e=>be(e.target.value),placeholder:i(`settings.filterTemplates`,`Filter templates…`),className:`w-full pl-9 pr-8 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`}),ye&&(0,G.jsx)(`button`,{onClick:()=>be(``),className:`absolute right-2 top-1/2 -translate-y-1/2 p-1 text-bambu-gray hover:text-white`,"aria-label":`Clear filter`,children:(0,G.jsx)($u,{className:`w-3.5 h-3.5`})})]}),vn?(0,G.jsx)(`div`,{className:`flex justify-center py-8`,children:(0,G.jsx)(Y,{className:`w-6 h-6 text-bambu-green animate-spin`})}):_n&&_n.length>0?(()=>{let e=ye.trim().toLowerCase(),t=[..._n].sort((e,t)=>e.name.localeCompare(t.name)).filter(t=>!e||t.name.toLowerCase().includes(e)||(t.title_template||``).toLowerCase().includes(e));return t.length===0?(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray italic text-center py-6`,children:i(`settings.noTemplatesMatch`,`No templates match your filter.`)}):(0,G.jsx)(`div`,{className:`space-y-2`,children:t.map(e=>(0,G.jsx)(zd,{className:`cursor-pointer hover:border-bambu-green/50 transition-colors`,onClick:()=>ve(e),children:(0,G.jsx)(Vd,{className:`py-2.5 px-3`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`p`,{className:`text-white font-medium text-sm truncate`,children:e.name}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-xs truncate mt-0.5`,children:e.title_template})]}),(0,G.jsx)(`button`,{className:`p-1.5 hover:bg-bambu-dark-tertiary rounded transition-colors shrink-0 ml-2`,onClick:t=>{t.stopPropagation(),ve(e)},children:(0,G.jsx)(Cl,{className:`w-4 h-4 text-bambu-gray`})})]})})},e.id))})})():(0,G.jsx)(zd,{children:(0,G.jsx)(Vd,{className:`py-8`,children:(0,G.jsxs)(`div`,{className:`text-center text-bambu-gray`,children:[(0,G.jsx)(ac,{className:`w-12 h-12 mx-auto mb-3 opacity-30`}),(0,G.jsx)(`p`,{className:`text-sm`,children:i(`settings.noTemplatesAvailable`)})]})})})]})]}),Ne===`apikeys`&&(0,G.jsxs)(`div`,{className:d(`api_keys:read`)?`grid grid-cols-1 xl:grid-cols-2 gap-4`:`grid grid-cols-1 gap-4`,children:[(0,G.jsxs)(`div`,{children:[d(`api_keys:read`)&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4 mb-6`,children:[(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,id:`card-createapi`,children:[(0,G.jsx)(Bc,{className:`w-5 h-5 text-bambu-green`}),i(`settings.apiKeys`)]}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:i(`settings.apiKeysDescription`)})]}),(0,G.jsxs)(Q,{size:`sm`,onClick:()=>He(!0),className:`flex-shrink-0`,children:[(0,G.jsx)(kl,{className:`w-4 h-4`}),i(`settings.createKey`)]})]}),qe&&(0,G.jsx)(zd,{className:`mb-6 border-bambu-green`,children:(0,G.jsx)(Vd,{className:`py-4`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(ms,{className:`w-5 h-5 text-bambu-green flex-shrink-0 mt-0.5`}),(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`p`,{className:`text-white font-medium mb-1`,children:i(`settings.apiKeyCreated`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mb-2`,children:i(`settings.apiKeyCopyWarning`)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 bg-bambu-dark rounded-lg p-2`,children:[(0,G.jsx)(`code`,{className:`flex-1 text-sm text-bambu-green font-mono break-all`,children:qe}),(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:async()=>{try{if(navigator.clipboard&&navigator.clipboard.writeText)await navigator.clipboard.writeText(qe);else{let e=document.createElement(`textarea`);e.value=qe,e.style.position=`fixed`,e.style.left=`-999999px`,document.body.appendChild(e),e.select(),document.execCommand(`copy`),document.body.removeChild(e)}o(i(`settings.toast.keyCopied`))}catch{o(i(`settings.toast.copyFailed`),`error`)}},children:(0,G.jsx)(Ps,{className:`w-4 h-4`})})]}),(0,G.jsxs)(`div`,{className:`flex gap-2 mt-3`,children:[(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:()=>{et(qe),o(i(`settings.toast.keyAddedToBrowser`))},children:i(`settings.useInApiBrowser`)}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:()=>Xe(!0),children:[(0,G.jsx)(Nl,{className:`w-4 h-4`}),i(`settings.apiKeyQrButton`)]}),(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:()=>{Xe(!1),Je(null)},children:i(`common.dismiss`)})]})]})]})})}),Ye&&qe&&(0,G.jsx)(XGe,{apiKey:qe,baseUrl:A?.external_url||void 0,onClose:()=>Xe(!1)}),Ve&&(0,G.jsxs)(zd,{className:`mb-6`,children:[(0,G.jsx)(Bd,{children:(0,G.jsx)(`h3`,{className:`text-base font-semibold text-white`,children:i(`settings.createNewApiKey`)})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.keyName`)}),(0,G.jsx)(`input`,{type:`text`,value:Ue,onChange:e=>We(e.target.value),placeholder:i(`settings.keyNamePlaceholder`),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-2`,children:i(`common.permissions`)}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:Ge.can_read_status,onChange:e=>Ke(t=>({...t,can_read_status:e.target.checked})),className:`w-4 h-4 text-bambu-green rounded border-bambu-dark-tertiary bg-bambu-dark focus:ring-bambu-green`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`text-white`,children:i(`settings.readStatus`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.readStatusDescription`)})]})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:Ge.can_queue,onChange:e=>Ke(t=>({...t,can_queue:e.target.checked})),className:`w-4 h-4 text-bambu-green rounded border-bambu-dark-tertiary bg-bambu-dark focus:ring-bambu-green`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`text-white`,children:i(`settings.manageQueue`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.manageQueueDescription`)})]})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:Ge.can_control_printer,onChange:e=>Ke(t=>({...t,can_control_printer:e.target.checked})),className:`w-4 h-4 text-bambu-green rounded border-bambu-dark-tertiary bg-bambu-dark focus:ring-bambu-green`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`text-white`,children:i(`settings.controlPrinter`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.controlPrinterDescription`)})]})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:Ge.can_manage_library,onChange:e=>Ke(t=>({...t,can_manage_library:e.target.checked})),className:`w-4 h-4 text-bambu-green rounded border-bambu-dark-tertiary bg-bambu-dark focus:ring-bambu-green`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`text-white`,children:i(`settings.manageLibrary`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.manageLibraryDescription`)})]})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:Ge.can_manage_inventory,onChange:e=>Ke(t=>({...t,can_manage_inventory:e.target.checked})),className:`w-4 h-4 text-bambu-green rounded border-bambu-dark-tertiary bg-bambu-dark focus:ring-bambu-green`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`text-white`,children:i(`settings.manageInventory`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.manageInventoryDescription`)})]})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:Ge.can_manage_maintenance,onChange:e=>Ke(t=>({...t,can_manage_maintenance:e.target.checked})),className:`w-4 h-4 text-bambu-green rounded border-bambu-dark-tertiary bg-bambu-dark focus:ring-bambu-green`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`text-white`,children:i(`settings.manageMaintenance`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.manageMaintenanceDescription`)})]})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:Ge.can_manage_archives,onChange:e=>Ke(t=>({...t,can_manage_archives:e.target.checked})),className:`w-4 h-4 text-bambu-green rounded border-bambu-dark-tertiary bg-bambu-dark focus:ring-bambu-green`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`text-white`,children:i(`settings.manageArchives`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.manageArchivesDescription`)})]})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:Ge.can_manage_projects,onChange:e=>Ke(t=>({...t,can_manage_projects:e.target.checked})),className:`w-4 h-4 text-bambu-green rounded border-bambu-dark-tertiary bg-bambu-dark focus:ring-bambu-green`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`text-white`,children:i(`settings.manageProjects`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.manageProjectsDescription`)})]})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:Ge.can_access_cloud,onChange:e=>Ke(t=>({...t,can_access_cloud:e.target.checked})),className:`w-4 h-4 text-bambu-green rounded border-bambu-dark-tertiary bg-bambu-dark focus:ring-bambu-green`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`text-white`,children:i(`settings.cloudAccess`,`Allow cloud access`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.cloudAccessDescription`,`Read Bambu Cloud presets and filaments on your behalf. Requires you to be signed into Bambu Cloud.`)})]})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:Ge.can_update_energy_cost,onChange:e=>Ke(t=>({...t,can_update_energy_cost:e.target.checked})),className:`w-4 h-4 text-bambu-green rounded border-bambu-dark-tertiary bg-bambu-dark focus:ring-bambu-green`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`text-white`,children:i(`settings.updateEnergyCost`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.updateEnergyCostDescription`)})]})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:Ge.can_send_notifications,onChange:e=>Ke(t=>({...t,can_send_notifications:e.target.checked})),className:`w-4 h-4 text-bambu-green rounded border-bambu-dark-tertiary bg-bambu-dark focus:ring-bambu-green`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`text-white`,children:i(`settings.sendNotifications`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.sendNotificationsDescription`)})]})]})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 pt-2`,children:[(0,G.jsxs)(Q,{onClick:()=>sn.mutate({name:Ue||i(`settings.unnamedKey`),...Ge}),disabled:sn.isPending,children:[sn.isPending?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(kl,{className:`w-4 h-4`}),i(`settings.createKey`)]}),(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>He(!1),children:i(`common.cancel`)})]})]})]}),on?(0,G.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,G.jsx)(Y,{className:`w-8 h-8 text-bambu-green animate-spin`})}):an&&an.length>0?(0,G.jsx)(`div`,{className:`space-y-3`,children:an.map(e=>(0,G.jsx)(zd,{children:(0,G.jsx)(Vd,{className:`py-3`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(Bc,{className:`w-5 h-5 ${e.enabled?`text-bambu-green`:`text-bambu-gray`}`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white font-medium`,children:e.name}),(0,G.jsxs)(`p`,{className:`text-xs text-bambu-gray`,children:[e.key_prefix,`••••••••`,e.last_used&&` · ${i(`settings.lastUsed`)}: ${tp(e.last_used)}`]})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex gap-1 text-xs flex-wrap justify-end`,children:[e.can_read_status&&(0,G.jsx)(`span`,{className:`px-1.5 py-0.5 bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400 rounded`,children:i(`settings.read`)}),e.can_queue&&(0,G.jsx)(`span`,{className:`px-1.5 py-0.5 bg-green-100 dark:bg-green-500/20 text-green-700 dark:text-green-400 rounded`,children:i(`queue.title`)}),e.can_control_printer&&(0,G.jsx)(`span`,{className:`px-1.5 py-0.5 bg-orange-100 dark:bg-orange-500/20 text-orange-700 dark:text-orange-400 rounded`,children:i(`settings.control`)}),e.can_manage_library&&(0,G.jsx)(`span`,{className:`px-1.5 py-0.5 bg-cyan-100 dark:bg-cyan-500/20 text-cyan-700 dark:text-cyan-400 rounded`,children:i(`settings.libraryBadge`)}),e.can_manage_inventory&&(0,G.jsx)(`span`,{className:`px-1.5 py-0.5 bg-pink-100 dark:bg-pink-500/20 text-pink-700 dark:text-pink-400 rounded`,children:i(`settings.inventoryBadge`)}),e.can_manage_maintenance&&(0,G.jsx)(`span`,{className:`px-1.5 py-0.5 bg-teal-100 dark:bg-teal-500/20 text-teal-700 dark:text-teal-400 rounded`,children:i(`settings.maintenanceBadge`)}),e.can_manage_archives&&(0,G.jsx)(`span`,{className:`px-1.5 py-0.5 bg-indigo-100 dark:bg-indigo-500/20 text-indigo-700 dark:text-indigo-400 rounded`,children:i(`settings.archivesBadge`)}),e.can_manage_projects&&(0,G.jsx)(`span`,{className:`px-1.5 py-0.5 bg-lime-100 dark:bg-lime-500/20 text-lime-700 dark:text-lime-400 rounded`,children:i(`settings.projectsBadge`)}),e.can_access_cloud&&(0,G.jsx)(`span`,{className:`px-1.5 py-0.5 bg-purple-100 dark:bg-purple-500/20 text-purple-700 dark:text-purple-400 rounded`,children:i(`settings.cloudBadge`,`Cloud`)}),e.can_update_energy_cost&&(0,G.jsx)(`span`,{className:`px-1.5 py-0.5 bg-amber-100 dark:bg-amber-500/20 text-amber-700 dark:text-amber-400 rounded`,children:i(`settings.energyCostBadge`)}),e.can_send_notifications&&(0,G.jsx)(`span`,{className:`px-1.5 py-0.5 bg-sky-100 dark:bg-sky-500/20 text-sky-700 dark:text-sky-400 rounded`,children:i(`settings.sendNotificationsBadge`)}),e.user_id===null&&(0,G.jsx)(`span`,{className:`px-1.5 py-0.5 bg-yellow-100 dark:bg-yellow-500/20 text-yellow-700 dark:text-yellow-400 rounded`,title:i(`settings.legacyKeyTooltip`,`Created before per-user ownership; recreate to use cloud access`),children:i(`settings.legacyKey`,`Legacy`)})]}),(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:()=>Qe(e.id),children:(0,G.jsx)(ju,{className:`w-4 h-4 text-red-600 dark:text-red-400`})})]})]})})},e.id))}):(0,G.jsx)(zd,{children:(0,G.jsx)(Vd,{className:`py-12`,children:(0,G.jsxs)(`div`,{className:`text-center text-bambu-gray`,children:[(0,G.jsx)(Bc,{className:`w-16 h-16 mx-auto mb-4 opacity-30`}),(0,G.jsx)(`p`,{className:`text-lg font-medium text-white mb-2`,children:i(`settings.apiKeysEmptyTitle`)}),(0,G.jsx)(`p`,{className:`text-sm mb-4`,children:i(`settings.apiKeysEmptyDescription`)}),(0,G.jsxs)(Q,{onClick:()=>He(!0),children:[(0,G.jsx)(kl,{className:`w-4 h-4`}),i(`settings.createFirstKey`)]})]})})}),(0,G.jsxs)(zd,{className:`mt-6`,children:[(0,G.jsx)(Bd,{children:(0,G.jsx)(`h3`,{className:`text-base font-semibold text-white`,id:`card-webhooks`,children:i(`settings.webhookEndpoints`)})}),(0,G.jsxs)(Vd,{className:`space-y-3 text-sm`,children:[(0,G.jsx)(`p`,{className:`text-bambu-gray`,children:i(`settings.webhookApiKeyHint`)}),(0,G.jsxs)(`div`,{className:`space-y-2 font-mono text-xs`,children:[(0,G.jsxs)(`div`,{className:`p-2 bg-bambu-dark rounded`,children:[(0,G.jsx)(`span`,{className:`text-blue-700 dark:text-blue-400`,children:`GET`}),` `,(0,G.jsx)(`span`,{className:`text-white`,children:`/api/v1/webhook/status`}),(0,G.jsxs)(`span`,{className:`text-bambu-gray`,children:[` - `,i(`settings.webhook.getAllStatus`)]})]}),(0,G.jsxs)(`div`,{className:`p-2 bg-bambu-dark rounded`,children:[(0,G.jsx)(`span`,{className:`text-blue-700 dark:text-blue-400`,children:`GET`}),` `,(0,G.jsx)(`span`,{className:`text-white`,children:`/api/v1/webhook/status/:id`}),(0,G.jsxs)(`span`,{className:`text-bambu-gray`,children:[` - `,i(`settings.webhook.getSpecificStatus`)]})]}),(0,G.jsxs)(`div`,{className:`p-2 bg-bambu-dark rounded`,children:[(0,G.jsx)(`span`,{className:`text-green-700 dark:text-green-400`,children:`POST`}),` `,(0,G.jsx)(`span`,{className:`text-white`,children:`/api/v1/webhook/queue`}),(0,G.jsxs)(`span`,{className:`text-bambu-gray`,children:[` - `,i(`settings.webhook.addToQueue`)]})]}),(0,G.jsxs)(`div`,{className:`p-2 bg-bambu-dark rounded`,children:[(0,G.jsx)(`span`,{className:`text-orange-700 dark:text-orange-400`,children:`POST`}),` `,(0,G.jsx)(`span`,{className:`text-white`,children:`/api/v1/webhook/printer/:id/pause`}),(0,G.jsxs)(`span`,{className:`text-bambu-gray`,children:[` - `,i(`settings.webhook.pausePrint`)]})]}),(0,G.jsxs)(`div`,{className:`p-2 bg-bambu-dark rounded`,children:[(0,G.jsx)(`span`,{className:`text-orange-700 dark:text-orange-400`,children:`POST`}),` `,(0,G.jsx)(`span`,{className:`text-white`,children:`/api/v1/webhook/printer/:id/resume`}),(0,G.jsxs)(`span`,{className:`text-bambu-gray`,children:[` - `,i(`settings.webhook.resumePrint`)]})]}),(0,G.jsxs)(`div`,{className:`p-2 bg-bambu-dark rounded`,children:[(0,G.jsx)(`span`,{className:`text-red-700 dark:text-red-400`,children:`POST`}),` `,(0,G.jsx)(`span`,{className:`text-white`,children:`/api/v1/webhook/printer/:id/stop`}),(0,G.jsxs)(`span`,{className:`text-bambu-gray`,children:[` - `,i(`settings.webhook.stopPrint`)]})]})]})]})]})]}),d(`settings:update`)&&(0,G.jsxs)(zd,{className:`mt-6`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,id:`card-connected-apps`,children:[(0,G.jsx)(Wc,{className:`w-4 h-4 text-bambu-green`}),i(`connectedApps.title`)]})}),(0,G.jsx)(Vd,{children:(0,G.jsx)(SGe,{})})]}),(0,G.jsxs)(zd,{className:`mt-6`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,id:`card-camera-tokens`,children:[(0,G.jsx)(Hu,{className:`w-4 h-4 text-bambu-green`}),i(`cameraTokens.title`,`Camera API Tokens`)]})}),(0,G.jsx)(Vd,{children:(0,G.jsx)(_Ge,{})})]}),(0,G.jsxs)(zd,{className:`mt-6`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,id:`card-stream-overlay`,children:[(0,G.jsx)(ll,{className:`w-4 h-4 text-bambu-green`}),i(`streamOverlay.builder.title`,`Streaming Overlay`)]})}),(0,G.jsx)(Vd,{children:(0,G.jsx)(wGe,{})})]})]}),d(`api_keys:read`)&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`mb-6`,children:[(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,id:`card-apibrowser`,children:[(0,G.jsx)(Cc,{className:`w-5 h-5 text-bambu-green`}),i(`settings.apiBrowser`)]}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:i(`settings.apiBrowserDescription`)})]}),(0,G.jsx)(zd,{className:`mb-4`,children:(0,G.jsxs)(Vd,{className:`py-3`,children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-2`,children:i(`settings.apiKeyForTesting`)}),(0,G.jsx)(`input`,{type:`text`,value:$e,onChange:e=>et(e.target.value),placeholder:i(`settings.apiKeyPlaceholder`),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white font-mono text-sm focus:border-bambu-green focus:outline-none`}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-2`,children:i(`settings.apiKeyHint`)})]})}),(0,G.jsx)(FKe,{apiKey:$e})]})]}),Ne===`virtual-printer`&&(0,G.jsx)(`div`,{id:`card-vp`,children:(0,G.jsx)(uKe,{})}),Ne===`spoolbuddy`&&(0,G.jsx)(`div`,{id:`card-spoolbuddy`,children:(0,G.jsx)(fKe,{})}),Ne===`queue`&&(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex gap-1 border-b border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`button`,{onClick:()=>Be(`dispatch`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px flex items-center gap-2 ${Le===`dispatch`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(Kc,{className:`w-4 h-4`}),i(`settings.tabs.queueDispatch`,`Queue & Dispatch`)]}),(0,G.jsxs)(`button`,{onClick:()=>Be(`pipelines`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px flex items-center gap-2 ${Le===`pipelines`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(Zu,{className:`w-4 h-4`}),i(`settings.tabs.queuePipelines`,`Pipelines`)]})]}),Le===`pipelines`&&(0,G.jsx)(lGe,{}),Le===`dispatch`&&A&&(0,G.jsxs)(`div`,{className:`flex flex-col lg:flex-row gap-4 lg:gap-6`,children:[(0,G.jsxs)(`div`,{className:`lg:w-1/2 space-y-3`,children:[(0,G.jsxs)(zd,{id:`card-print-options`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(Kc,{className:`w-4 h-4 text-bambu-green`}),i(`settings.defaultPrintOptions`,`Default Print Options`)]})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.defaultPrintOptionsDescription`,`Set default values for print options when starting new prints. These can be overridden per print in the print dialog.`)}),[{key:`default_bed_levelling`,label:i(`settings.defaultBedLevelling`,`Bed Levelling`),desc:i(`settings.defaultBedLevellingDesc`,`Auto-level bed before print`),fallback:!0,dualNozzleOnly:!1,tristate:!0},{key:`default_flow_cali`,label:i(`settings.defaultFlowCali`,`Flow Calibration`),desc:i(`settings.defaultFlowCaliDesc`,`Calibrate extrusion flow`),fallback:!1,dualNozzleOnly:!1,tristate:!0},{key:`default_vibration_cali`,label:i(`settings.defaultVibrationCali`,`Vibration Calibration`),desc:i(`settings.defaultVibrationCaliDesc`,`Reduce ringing artifacts`),fallback:!0,dualNozzleOnly:!1,tristate:!1},{key:`default_layer_inspect`,label:i(`settings.defaultLayerInspect`,`First Layer Inspection`),desc:i(`settings.defaultLayerInspectDesc`,`AI inspection of first layer`),fallback:!1,dualNozzleOnly:!1,tristate:!1},{key:`default_timelapse`,label:i(`settings.defaultTimelapse`,`Timelapse`),desc:i(`settings.defaultTimelapseDesc`,`Record timelapse video`),fallback:!1,dualNozzleOnly:!1,tristate:!1},{key:`default_nozzle_offset_cali`,label:i(`settings.defaultNozzleOffsetCali`,`Nozzle Offset Calibration`),desc:i(`settings.defaultNozzleOffsetCaliDesc`,`Calibrate nozzle offsets between extruders`),fallback:!0,dualNozzleOnly:!0,tristate:!0},{key:`default_confirm_outcome`,label:i(`settings.defaultConfirmOutcome`,`Ask for Outcome`),desc:i(`settings.defaultConfirmOutcomeDesc`,`Ask whether the print came out well after it completes`),fallback:!1,dualNozzleOnly:!1,tristate:!1}].filter(({dualNozzleOnly:e})=>!e||(ln||[]).some(e=>e.nozzle_count===2)).map(({key:e,label:t,desc:n,fallback:r,tristate:a})=>(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex-1 mr-4`,children:[(0,G.jsx)(`p`,{className:`text-sm text-white`,children:t}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:n})]}),a?(0,G.jsx)(`div`,{className:`flex gap-1 shrink-0`,children:jm.map(t=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>xr(e,t),className:`px-2.5 py-1 text-xs rounded transition-colors ${(A[e]??`auto`)===t?Mm[t]:`bg-bambu-dark-tertiary text-bambu-gray hover:text-white`}`,children:i(`settings.calibrationMode_${t}`)},t))}):(0,G.jsx)(`div`,{className:`flex gap-1 shrink-0`,children:[`off`,`on`].map(t=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>xr(e,t===`on`),className:`px-2.5 py-1 text-xs rounded transition-colors ${(A[e]??r?`on`:`off`)===t?Mm[t]:`bg-bambu-dark-tertiary text-bambu-gray hover:text-white`}`,children:i(`settings.calibrationMode_${t}`)},t))})]},e)),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex-1 mr-4`,children:[(0,G.jsx)(`p`,{className:`text-sm text-white`,children:i(`settings.confirmOutcomeExternalPrints`,`Also ask for prints started outside Bambuddy`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:i(`settings.confirmOutcomeExternalPrintsDesc`,`Prints started at the printer, in Bambu Studio or in the Handy app are archived by Bambuddy too. With this on, they get the same outcome prompt as queued prints.`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer shrink-0`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.confirm_outcome_external_prints??!1,onChange:e=>xr(`confirm_outcome_external_prints`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]})]})]}),(0,G.jsxs)(zd,{id:`card-plate`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(tu,{className:`w-4 h-4 text-bambu-green`}),i(`settings.plateClear`,`Plate-Clear Confirmation`)]})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex-1 mr-4`,children:[(0,G.jsx)(`p`,{className:`text-sm text-white`,children:i(`settings.requirePlateClear`,`Require plate-clear confirmation`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.requirePlateClearDescription`,`When enabled, the scheduler waits for per-printer plate-clear confirmation before starting queued prints on printers with finished jobs. Disabling this also hides the plate status badge and the "Mark plate as cleared" button on printer cards.`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.require_plate_clear??!1,onChange:e=>xr(`require_plate_clear`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex-1 mr-4`,children:[(0,G.jsx)(`p`,{className:`text-sm text-white`,children:i(`settings.confirmDefaultGoodOnPlateClear`,`Count unanswered outcomes as good on plate release`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.confirmDefaultGoodOnPlateClearDescription`,`When the plate is released (manually or by the next queued print) and the print's outcome prompt is still unanswered, record it as a good part automatically. The print then counts as good as soon as the plate is released; a Telegram or link answer after that only shows the recorded result.`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.confirm_default_good_on_plate_clear??!1,onChange:e=>xr(`confirm_default_good_on_plate_clear`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]})]})]}),(0,G.jsxs)(zd,{id:`card-temp-fan-presets`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(Du,{className:`w-4 h-4 text-bambu-green`}),i(`settings.tempFanPresetsTitle`,`Temperature & Fan Presets`)]})}),(0,G.jsxs)(Vd,{className:`space-y-4`,children:[(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.tempFanPresetsDescription`,`Customize the quick-select values shown in printer-card temperature and fan-speed popovers. The Off button is always shown.`)}),Cte.map(e=>{let t=dh(A?.[e.key]??``,e.defaults,e.lo,e.hi),n=e.unit===`C`?`°C`:`%`;return(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,G.jsxs)(`label`,{className:`text-sm text-white`,children:[i(`settings.${{nozzle_temp_presets:`tempFanPresetsNozzle`,bed_temp_presets:`tempFanPresetsBed`,chamber_temp_presets:`tempFanPresetsChamber`,fan_speed_presets:`tempFanPresetsFan`}[e.key]}`,{nozzle_temp_presets:`Nozzle temperature`,bed_temp_presets:`Bed temperature`,chamber_temp_presets:`Chamber temperature`,fan_speed_presets:`Fan speed`}[e.key]),` `,(0,G.jsxs)(`span`,{className:`text-bambu-gray text-xs`,children:[`(`,n,` · `,e.lo,`–`,e.hi,`)`]})]}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>xr(e.key,``),title:i(`settings.tempFanPresetsReset`,`Reset to defaults`),className:`text-bambu-gray hover:text-white transition-colors p-1 rounded hover:bg-bambu-dark-tertiary`,children:(0,G.jsx)(Rl,{className:`w-3.5 h-3.5`})})]}),(0,G.jsx)(`div`,{className:`flex gap-2`,children:[0,1,2].map(n=>(0,G.jsx)(`input`,{type:`number`,min:e.lo,max:e.hi,value:t[n],onChange:r=>{let i=[t[0],t[1],t[2]],a=parseInt(r.target.value,10);i[n]=Math.max(e.lo,Math.min(e.hi,Number.isFinite(a)?a:e.lo)),xr(e.key,JSON.stringify(i))},className:`flex-1 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`},n))})]},e.key)})]})]}),(0,G.jsxs)(zd,{id:`card-staggered`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(Hc,{className:`w-4 h-4 text-bambu-green`}),i(`settings.staggeredStart`,`Staggered Start`)]})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.staggeredStartDescription`,`Default group size and interval when staggering multi-printer batch starts. Can be overridden per batch in the print modal.`)}),(0,G.jsxs)(`div`,{className:`flex gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:i(`settings.staggerGroupSize`,`Group size`)}),(0,G.jsx)(Xp,{min:1,max:50,value:A.stagger_group_size??2,onChange:e=>xr(`stagger_group_size`,e),fallback:1,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.staggerGroupSizeHelp`,`Printers to start simultaneously per group`)})]}),(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:i(`settings.staggerInterval`,`Interval (minutes)`)}),(0,G.jsx)(Xp,{min:1,max:60,value:A.stagger_interval_minutes??5,onChange:e=>xr(`stagger_interval_minutes`,e),fallback:1,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.staggerIntervalHelp`,`Delay between each group starting`)})]})]})]})]}),(0,G.jsxs)(zd,{id:`card-concurrent-uploads`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(Es,{className:`w-4 h-4 text-bambu-green`}),i(`settings.concurrentUploadsTitle`,`Concurrent Uploads`)]})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.concurrentUploadsDescription`,`How many printers the queue may send files to at the same time. Printers receive files slowly (a large print can take several minutes), and each one waits its turn — so on a bigger fleet, raising this is what stops the last printer in a batch from waiting out every transfer before it. Lower it if your network or Bambuddy host struggles with parallel transfers.`)}),(0,G.jsxs)(`div`,{className:`w-full sm:w-1/2`,children:[(0,G.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:i(`settings.concurrentUploadsLabel`,`Printers uploaded to at once`)}),(0,G.jsx)(Xp,{min:1,max:16,value:A.queue_max_concurrent_uploads??4,onChange:e=>xr(`queue_max_concurrent_uploads`,e),fallback:1,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.concurrentUploadsHelp`,`1 sends to one printer at a time (the old behaviour). Default is 4.`)})]})]})]}),(0,G.jsxs)(zd,{id:`card-preheat`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(cc,{className:`w-4 h-4 text-amber-600 dark:text-amber-400`}),i(`settings.preheatTitle`,`Preheat & Heat Soak`)]})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.preheatDescription`,`Heat the bed (and chamber, if supported) and hold at temperature before each queued print starts. Helpful for engineering filaments (PA, ABS) on printers without an active chamber heater — the bed warms the chamber by radiation while the soak timer runs. The bed target is read from the print file; chamber behaviour depends on printer model.`)}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex-1 mr-4`,children:[(0,G.jsx)(`p`,{className:`text-sm text-white`,children:i(`settings.preheatEnabled`,`Enable preheat & soak`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:i(`settings.preheatEnabledDesc`,`When off, queued prints dispatch immediately.`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.preheat_enabled??!1,onChange:e=>xr(`preheat_enabled`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3 pt-1`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:i(`settings.preheatMaxWait`,`Max wait (seconds)`)}),(0,G.jsx)(Xp,{min:60,max:3600,value:A.preheat_max_wait_seconds??900,onChange:e=>xr(`preheat_max_wait_seconds`,e),fallback:900,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green disabled:opacity-50`,disabled:!(A.preheat_enabled??!1)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.preheatMaxWaitHelp`,`Cap on the chamber warm-up phase before falling through.`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:i(`settings.preheatSoak`,`Soak (seconds)`)}),(0,G.jsx)(Xp,{min:0,max:1800,value:A.preheat_soak_seconds??300,onChange:e=>xr(`preheat_soak_seconds`,e),fallback:0,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green disabled:opacity-50`,disabled:!(A.preheat_enabled??!1)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.preheatSoakHelp`,`Hold time after target reached or max-wait elapsed.`)})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between pt-2 border-t border-bambu-dark-tertiary/50`,children:[(0,G.jsxs)(`div`,{className:`flex-1 mr-4`,children:[(0,G.jsx)(`p`,{className:`text-sm text-white`,children:i(`settings.keepBedWarm`,`Keep bed warm between prints`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:i(`settings.keepBedWarmDesc`,`While awaiting plate-clear, hold the bed at the keep-warm temperature below so the chamber stays hot — or at the next print's own bed temperature when that is higher. Only applies when the next print needs chamber heating (ASA, ABS, PA, PC etc.). Requires plate-clear confirmation to be enabled.`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.queue_keep_bed_warm??!1,onChange:e=>xr(`queue_keep_bed_warm`,e.target.checked),className:`sr-only peer`,disabled:!(A.preheat_enabled??!1)||!(A.require_plate_clear??!1)}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green peer-disabled:opacity-50 peer-disabled:cursor-not-allowed`})]})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 mt-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:i(`settings.keepWarmBedTemp`,`Keep-warm bed temperature (°C)`)}),(0,G.jsx)(Xp,{min:40,max:110,value:A.queue_keep_warm_bed_temp??90,onChange:e=>xr(`queue_keep_warm_bed_temp`,e),fallback:90,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green disabled:opacity-50`,disabled:!(A.preheat_enabled??!1)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.keepWarmBedTempHelp`,`Used whenever the bed's job is to heat the chamber — the keep-warm hold, and preheat when the print file carries no bed temperature. A higher bed temperature from the print file always wins.`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:i(`settings.keepWarmMaxMinutes`,`Stop keeping warm after (minutes)`)}),(0,G.jsx)(Xp,{min:5,max:480,value:A.queue_keep_warm_max_minutes??120,onChange:e=>xr(`queue_keep_warm_max_minutes`,e),fallback:120,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green disabled:opacity-50`,disabled:!(A.queue_keep_bed_warm??!1)||!(A.preheat_enabled??!1)||!(A.require_plate_clear??!1)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.keepWarmMaxMinutesHelp`,`If the plate is not cleared within this time, the heaters are switched off rather than held indefinitely.`)})]})]}),(0,G.jsxs)(`div`,{className:`pt-2 border-t border-bambu-dark-tertiary/50`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,G.jsx)(`label`,{className:`text-sm text-white`,children:i(`settings.preheatFilamentTargetsLabel`,`Per-filament chamber target (°C)`)}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>xr(`preheat_filament_targets`,``),title:i(`settings.preheatFilamentTargetsReset`,`Reset to defaults`),className:`text-bambu-gray hover:text-white transition-colors p-1 rounded hover:bg-bambu-dark-tertiary`,children:(0,G.jsx)(Rl,{className:`w-3.5 h-3.5`})})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mb-2`,children:i(`settings.preheatFilamentTargetsHint`,`Bambuddy picks the highest target across the loaded AMS slots; PLA-only prints derive 0 and skip the chamber phase automatically.`)}),(0,G.jsx)(sGe,{value:A.preheat_filament_targets??``,onChange:e=>xr(`preheat_filament_targets`,e),disabled:!(A.preheat_enabled??!1)})]}),(0,G.jsxs)(`p`,{className:`text-xs text-bambu-gray pt-1 border-t border-bambu-dark-tertiary/50`,children:[(0,G.jsx)(`span`,{className:`font-medium text-bambu-gray/90`,children:i(`settings.preheatHardwareTitle`,`Per-printer behaviour:`)}),` `,i(`settings.preheatHardwareDetail`,`H2C/H2D/H2D Pro/H2S/X2D/X1E actively heat the chamber via M141. X1C/P2S read chamber temp but rely on bed-radiation heating. P1S/P1P/A1/A1 Mini have no chamber sensor — only the soak timer applies.`)]})]})]})]}),(0,G.jsxs)(`div`,{className:`lg:w-1/2 space-y-3`,children:[(0,G.jsxs)(zd,{id:`card-pipelines`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(Zu,{className:`w-4 h-4 text-bambu-green`}),i(`settings.pipelineLimits.title`,`Slicer Pipeline limits`)]})}),(0,G.jsx)(Vd,{className:`space-y-2`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`p`,{className:`text-sm text-white`,children:i(`settings.pipelineLimits.maxCopiesLabel`,`Max copies per run`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:i(`settings.pipelineLimits.maxCopiesDesc`,`Upper bound on the copies operators can request when running a pipeline. Server-side hard cap is 1000.`)})]}),(0,G.jsx)(`input`,{type:`number`,min:1,max:1e3,value:A.pipeline_max_copies??50,onChange:e=>{let t=parseInt(e.target.value,10);Number.isNaN(t)||xr(`pipeline_max_copies`,Math.max(1,Math.min(1e3,t)))},"aria-label":i(`settings.pipelineLimits.maxCopiesLabel`,`Max copies per run`),className:`w-24 px-2 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm`})]})})]}),(0,G.jsxs)(zd,{id:`card-slicer`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(js,{className:`w-4 h-4 text-bambu-green`}),i(`settings.slicerCard`,`Slicer`)]})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[LKe()&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.sliceEngine`)}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(`select`,{value:U8(A.slice_engine),onChange:e=>xr(`slice_engine`,e.target.value),className:`w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer`,children:H8().map(e=>(0,G.jsx)(`option`,{value:e.id,children:i(e.labelKey)},e.id))}),(0,G.jsx)(as,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(H8().find(e=>e.id===U8(A.slice_engine))?.descriptionKey??`settings.sliceEngineSidecarHint`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.preferredSlicer`)}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsxs)(`select`,{value:A.preferred_slicer??`bambu_studio`,onChange:e=>xr(`preferred_slicer`,e.target.value),className:`w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer`,children:[(0,G.jsx)(`option`,{value:`bambu_studio`,children:i(`settings.slicerBambuStudio`)}),(0,G.jsx)(`option`,{value:`orcaslicer`,children:i(`settings.slicerOrcaSlicer`)})]}),(0,G.jsx)(as,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.preferredSlicerDescription`)}),(A.preferred_slicer??`bambu_studio`)===`orcaslicer`&&(0,G.jsx)(`div`,{role:`alert`,className:`text-xs text-amber-800 dark:text-amber-200 bg-amber-50 dark:bg-amber-900/20 border border-amber-300 dark:border-amber-700/40 rounded p-2 mt-2`,children:i(`settings.orcaslicerKnownIssuesWarning`,`OrcaSlicer 2.3.2 / 2.4.0-dev have known CLI bugs that block slicing many Bambu-authored 3MFs — see upstream issues #12426 (segfault on painted multi-extruder files) and #13386 (parameter-range strict-validation reject). Bambu Studio is recommended until the upstream fixes land.`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.openInSlicerLabel`,`Open in Slicer`)}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsxs)(`select`,{value:A.open_in_slicer??``,onChange:e=>xr(`open_in_slicer`,e.target.value===``?null:e.target.value),className:`w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer`,children:[(0,G.jsx)(`option`,{value:``,children:i(`settings.openInSlicerInherit`,`Same as API slicer`)}),(0,G.jsx)(`option`,{value:`bambu_studio`,children:i(`settings.slicerBambuStudio`)}),(0,G.jsx)(`option`,{value:`orcaslicer`,children:i(`settings.slicerOrcaSlicer`)})]}),(0,G.jsx)(as,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.openInSlicerDescription`,`Desktop slicer used by the 'Open in Slicer' button. Leave on 'Same as API slicer' to inherit, or pick a different slicer to use locally.`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.useSlicerApi`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.useSlicerApiDescription`)})]}),(0,G.jsxs)(`label`,{className:`flex items-center cursor-pointer shrink-0`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.use_slicer_api??!1,onChange:e=>xr(`use_slicer_api`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`relative w-11 h-6 bg-bambu-dark-tertiary rounded-full peer peer-checked:bg-bambu-green peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-bambu-green/50 transition-colors after:content-[''] after:absolute after:top-0.5 after:left-0.5 after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-transform peer-checked:after:translate-x-5`})]})]}),(A.use_slicer_api??!1)&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:(A.preferred_slicer??`bambu_studio`)===`orcaslicer`?i(`settings.orcaslicerApiUrl`,`OrcaSlicer sidecar URL`):i(`settings.bambuStudioApiUrl`,`Bambu Studio sidecar URL`)}),(0,G.jsx)(`input`,{type:`text`,value:((A.preferred_slicer??`bambu_studio`)===`orcaslicer`?A.orcaslicer_api_url:A.bambu_studio_api_url)??``,onChange:e=>xr((A.preferred_slicer??`bambu_studio`)===`orcaslicer`?`orcaslicer_api_url`:`bambu_studio_api_url`,e.target.value),placeholder:(A.preferred_slicer??`bambu_studio`)===`orcaslicer`?`http://localhost:3003`:`http://localhost:3001`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none placeholder:text-bambu-gray/40`}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.slicerApiUrlDescription`,`URL of the slicer-API sidecar container. Leave blank to use the SLICER_API_URL / BAMBU_STUDIO_API_URL env var defaults.`)})]}),(A.use_slicer_api??!1)&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.slicerStallTimeout`)}),(0,G.jsx)(`input`,{type:`number`,min:1,max:240,value:A.slicer_stall_timeout_minutes??15,onChange:e=>xr(`slicer_stall_timeout_minutes`,Number(e.target.value)),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.slicerStallTimeoutDescription`)})]})]})]}),(0,G.jsxs)(zd,{children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,id:`card-drying`,children:[(0,G.jsx)(cc,{className:`w-4 h-4 text-amber-600 dark:text-amber-400`}),i(`settings.queueDrying`)]})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.queueDryingDescription`)}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-white`,children:i(`settings.queueDryingEnabled`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:i(`settings.queueDryingEnabledDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.queue_drying_enabled??!1,onChange:e=>xr(`queue_drying_enabled`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),A.queue_drying_enabled&&(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-white`,children:i(`settings.queueDryingBlock`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:i(`settings.queueDryingBlockDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.queue_drying_block??!1,onChange:e=>xr(`queue_drying_block`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-amber-500`})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-white`,children:i(`settings.ambientDryingEnabled`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:i(`settings.ambientDryingEnabledDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.ambient_drying_enabled??!1,onChange:e=>{F(null),xr(`ambient_drying_enabled`,e.target.checked)},className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),A.ambient_drying_enabled&&(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-white`,children:i(`settings.ambientDryingSustainedEnabled`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:i(`settings.ambientDryingSustainedDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:(A.ambient_drying_sustained_minutes??0)>0,onChange:e=>{F(null),xr(`ambient_drying_sustained_minutes`,e.target.checked?15:0)},className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),A.ambient_drying_enabled&&(A.ambient_drying_sustained_minutes??0)>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.ambientDryingSustainedMinutes`)}),(0,G.jsx)(`input`,{type:`number`,min:`5`,max:`240`,value:P??String(A.ambient_drying_sustained_minutes??15),onChange:e=>F(e.target.value),onBlur:e=>{let t=parseInt(e.target.value,10);Number.isNaN(t)||xr(`ambient_drying_sustained_minutes`,Math.max(5,Math.min(240,t))),F(null)},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()},className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-white`,children:i(`settings.printDryingEnabled`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:i(`settings.printDryingEnabledDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.print_drying_enabled??!1,onChange:e=>xr(`print_drying_enabled`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`p`,{className:`text-sm text-white font-medium`,children:i(`settings.dryingPresets`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.dryingPresetsDescription`)}),(0,G.jsx)(`div`,{className:`overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`text-bambu-gray border-b border-bambu-dark-tertiary`,children:[(0,G.jsx)(`th`,{className:`text-left py-1.5`,children:i(`settings.dryingFilament`)}),(0,G.jsx)(`th`,{className:`text-center py-1.5`,colSpan:2,children:`AMS 2 Pro`}),(0,G.jsx)(`th`,{className:`text-center py-1.5`,colSpan:2,children:`AMS-HT`})]})}),(0,G.jsx)(`tbody`,{children:(()=>{let e={PLA:{n3f:45,n3s:45,n3f_hours:12,n3s_hours:12},PETG:{n3f:65,n3s:65,n3f_hours:12,n3s_hours:12},TPU:{n3f:65,n3s:75,n3f_hours:12,n3s_hours:18},ABS:{n3f:65,n3s:80,n3f_hours:12,n3s_hours:8},ASA:{n3f:65,n3s:80,n3f_hours:12,n3s_hours:8},PA:{n3f:65,n3s:85,n3f_hours:12,n3s_hours:12},PC:{n3f:65,n3s:80,n3f_hours:12,n3s_hours:8},PVA:{n3f:65,n3s:85,n3f_hours:12,n3s_hours:18}},t={...e};try{if(A.drying_presets){let n=JSON.parse(A.drying_presets);typeof n==`object`&&n&&(t={...e,...n})}}catch{}let n=(e,n,r)=>{let i={...t,[e]:{...t[e],[n]:r}};xr(`drying_presets`,JSON.stringify(i))};return Object.entries(t).map(([e,t])=>(0,G.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary/50`,children:[(0,G.jsx)(`td`,{className:`py-1.5 pr-2 text-white font-medium`,children:e}),(0,G.jsx)(`td`,{className:`py-1 px-1`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[(0,G.jsx)(Xp,{min:30,max:65,value:t.n3f,onChange:t=>n(e,`n3f`,t),className:`w-14 px-1.5 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-center text-xs focus:border-amber-500/50 focus:outline-none [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:`°C`})]})}),(0,G.jsx)(`td`,{className:`py-1 px-1`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(Xp,{min:1,max:24,value:t.n3f_hours,onChange:t=>n(e,`n3f_hours`,t),className:`w-14 px-1.5 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-center text-xs focus:border-amber-500/50 focus:outline-none [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:`h`})]})}),(0,G.jsx)(`td`,{className:`py-1 px-1`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[(0,G.jsx)(Xp,{min:30,max:85,value:t.n3s,onChange:t=>n(e,`n3s`,t),className:`w-14 px-1.5 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-center text-xs focus:border-amber-500/50 focus:outline-none [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:`°C`})]})}),(0,G.jsx)(`td`,{className:`py-1 px-1`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(Xp,{min:1,max:24,value:t.n3s_hours,onChange:t=>n(e,`n3s_hours`,t),className:`w-14 px-1.5 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-center text-xs focus:border-amber-500/50 focus:outline-none [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:`h`})]})})]},e))})()})]})})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`p`,{className:`text-sm text-white font-medium`,children:i(`settings.humidityThresholds`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.humidityThresholdsDescription`)}),(0,G.jsx)(`div`,{className:`overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`text-bambu-gray border-b border-bambu-dark-tertiary`,children:[(0,G.jsx)(`th`,{className:`text-left py-1.5`,children:i(`settings.dryingFilament`)}),(0,G.jsx)(`th`,{className:`text-right py-1.5 pr-2`,children:i(`settings.humidityThresholdCol`)})]})}),(0,G.jsx)(`tbody`,{children:(()=>{let e=A.ams_humidity_fair??60,t=[`PLA`,`PETG`,`TPU`,`ABS`,`ASA`,`PA`,`PC`,`PVA`],n={};try{if(A.ams_humidity_thresholds){let e=JSON.parse(A.ams_humidity_thresholds);typeof e==`object`&&e&&(n=e)}}catch{}let r=[{key:`default`,label:i(`settings.humidityThresholdDefault`),value:Number(n.default??e),isDefault:!0},...t.map(t=>({key:t,label:t,value:Number(n[t]??n.default??e),isDefault:!1}))],a=(e,t)=>{if(t.trim()===``){let t={...n};delete t[e],xr(`ams_humidity_thresholds`,JSON.stringify(t));return}let r=parseInt(t,10);if(Number.isNaN(r))return;let i=Math.max(5,Math.min(95,r)),a={...n,[e]:i};xr(`ams_humidity_thresholds`,JSON.stringify(a))};return r.map(e=>{let t=M[e.key],n=t===void 0?String(e.value):t;return(0,G.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary/50`,children:[(0,G.jsx)(`td`,{className:`py-1.5 pr-2 font-medium ${e.isDefault?`text-bambu-gray italic`:`text-white`}`,children:e.label}),(0,G.jsx)(`td`,{className:`py-1 pr-2`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[(0,G.jsx)(`input`,{type:`number`,min:5,max:95,value:n,onChange:t=>N(n=>({...n,[e.key]:t.target.value})),onBlur:t=>{a(e.key,t.target.value),N(t=>{let n={...t};return delete n[e.key],n})},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()},className:`w-14 px-1.5 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-center text-xs focus:border-amber-500/50 focus:outline-none [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:`%`})]})})]},e.key)})})()})]})})]})]})]}),(0,G.jsxs)(zd,{id:`card-gcode`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(Os,{className:`w-4 h-4 text-bambu-green`}),i(`settings.gcodeInjection`,`G-code Injection`)]})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.gcodeInjectionDescription`,`Configure custom G-code to inject at the start and/or end of prints for auto-print systems like Farmloop, SwapMod, AutoClear, and Printflow 3D. Snippets are configured per printer model and applied when "Inject G-code" is enabled on a queue item.`)}),(()=>{let e=(()=>{try{return A.gcode_snippets?JSON.parse(A.gcode_snippets):{}}catch{return{}}})(),t=[...new Set((ln||[]).filter(e=>e.model).map(e=>e.model))].sort(),n=(t,n,r)=>{let i={...e};i[t]||(i[t]={start_gcode:``,end_gcode:``}),i[t][n]=r,!i[t].start_gcode&&!i[t].end_gcode&&delete i[t];let a=Object.keys(i).length>0?JSON.stringify(i):``;j(e=>e?{...e,gcode_snippets:a}:null),hr.current=a},r=()=>{hr.current!==null&&(yr.mutate({gcode_snippets:hr.current}),hr.current=null)};return t.length===0?(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray italic`,children:i(`settings.gcodeInjectionNoPrinters`,`No printers found. Add printers to configure G-code snippets.`)}):t.map(t=>{let a=e[t]||{start_gcode:``,end_gcode:``},o=!!(a.start_gcode||a.end_gcode);return(0,G.jsx)(Wm,{defaultOpen:o,className:`border border-bambu-dark-tertiary rounded-lg px-3 py-2`,summary:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`h4`,{className:`text-sm font-medium text-white`,children:t}),o&&(0,G.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded bg-bambu-green/20 text-bambu-green`,children:i(`settings.gcodeConfigured`,`Configured`)})]}),children:(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:i(`settings.gcodeStartLabel`,`Start G-code`)}),(0,G.jsx)(`textarea`,{value:a.start_gcode,onChange:e=>n(t,`start_gcode`,e.target.value),onBlur:r,placeholder:i(`settings.gcodeStartPlaceholder`,`G-code prepended before the print starts...`),rows:3,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-xs font-mono focus:outline-none focus:border-bambu-green resize-y`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:i(`settings.gcodeEndLabel`,`End G-code`)}),(0,G.jsx)(`textarea`,{value:a.end_gcode,onChange:e=>n(t,`end_gcode`,e.target.value),onBlur:r,placeholder:i(`settings.gcodeEndPlaceholder`,`G-code appended after the print ends...`),rows:3,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-xs font-mono focus:outline-none focus:border-bambu-green resize-y`})]})]})},t)})})()]})]})]})]})]}),Ne===`filament`&&A&&(0,G.jsx)(G.Fragment,{children:(0,G.jsxs)(`div`,{className:`flex flex-col lg:flex-row gap-4 lg:gap-6`,children:[(0,G.jsxs)(`div`,{className:`lg:w-1/3 space-y-3`,children:[(0,G.jsx)(eKe,{}),(0,G.jsxs)(zd,{id:`card-filamentchecks`,children:[(0,G.jsx)(Bd,{children:(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:i(`settings.filamentChecks`)})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.disableFilamentWarnings`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.disableFilamentWarningsDesc`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.disable_filament_warnings,onChange:e=>xr(`disable_filament_warnings`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.preferLowestFilament`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.preferLowestFilamentDesc`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray/70 mt-1`,children:i(`settings.preferLowestFilamentBackupNote`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.prefer_lowest_filament,onChange:e=>xr(`prefer_lowest_filament`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]})]})]}),(0,G.jsxs)(zd,{id:`card-printmodal`,children:[(0,G.jsx)(Bd,{children:(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:i(`settings.printModal`)})}),(0,G.jsx)(Vd,{className:`space-y-3`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.expandCustomMapping`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.expandCustomMappingDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.per_printer_mapping_expanded??!1,onChange:e=>xr(`per_printer_mapping_expanded`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]})})]}),(0,G.jsxs)(zd,{id:`card-amsthresholds`,children:[(0,G.jsx)(Bd,{children:(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:i(`settings.amsDisplayThresholds`)})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.amsThresholdsDescription`)}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-white`,children:[(0,G.jsx)(Gs,{className:`w-4 h-4 text-blue-600 dark:text-blue-400`}),(0,G.jsx)(`span`,{className:`font-medium`,children:i(`settings.humidity`)})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:[i(`settings.goodGreen`),` ≤`]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Xp,{min:0,max:100,value:A.ams_humidity_good??40,onChange:e=>xr(`ams_humidity_good`,e),fallback:40,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:`%`})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:[i(`settings.fairOrange`),` ≤`]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Xp,{min:0,max:100,value:A.ams_humidity_fair??60,onChange:e=>xr(`ams_humidity_fair`,e),fallback:60,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:`%`})]})]})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.aboveFairBad`)}),(0,G.jsx)(`p`,{className:`text-xs text-amber-700/80 dark:text-amber-400/70`,children:i(`settings.fairAlsoDryingThreshold`)}),(A.ams_humidity_fair??60)xr(`ams_temp_good`,e),integer:!1,fallback:28,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:`°C`})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:[i(`settings.fairOrange`),` ≤`]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Xp,{step:`0.5`,min:0,max:60,value:A.ams_temp_fair??35,onChange:e=>xr(`ams_temp_fair`,e),integer:!1,fallback:35,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:`°C`})]})]})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.aboveFairHot`)}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.tempAlarmThreshold`)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{type:`number`,step:`0.5`,min:`0.5`,max:`120`,value:A.ams_temp_alarm??``,placeholder:String(A.ams_temp_fair??35),onChange:e=>{let t=e.target.value.trim(),n=parseFloat(t);xr(`ams_temp_alarm`,t===``||Number.isNaN(n)?null:n)},className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:`°C`})]})]}),(A.ams_temp_alarm??1)<=0&&(0,G.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-400`,children:i(`settings.tempAlarmMustBePositive`)}),(0,G.jsx)(`p`,{className:`text-xs text-amber-700/80 dark:text-amber-400/70`,children:i(`settings.tempAlarmSeparateFromBand`)})]}),(0,G.jsxs)(`div`,{className:`space-y-3 pt-4 border-t border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-white`,children:[(0,G.jsx)(Rs,{className:`w-4 h-4 text-purple-600 dark:text-purple-400`}),(0,G.jsx)(`span`,{className:`font-medium`,children:i(`settings.historyRetention`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.keepSensorHistory`)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Xp,{min:1,max:365,value:A.ams_history_retention_days??30,onChange:e=>xr(`ams_history_retention_days`,e),fallback:30,className:`w-24 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:i(`common.days`)})]})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.historyRetentionDescription`)})]})]})]})]}),(0,G.jsxs)(`div`,{className:`lg:w-2/3 space-y-3`,children:[(0,G.jsx)(tKe,{}),(0,G.jsx)(nKe,{})]})]})}),Ze!==null&&(0,G.jsx)(af,{title:i(`settings.deleteApiKeyTitle`),message:i(`settings.deleteApiKeyMessage`),confirmText:i(`settings.deleteKey`),variant:`danger`,onConfirm:()=>{cn.mutate(Ze),Qe(null)},onCancel:()=>Qe(null)}),I&&(0,G.jsx)(EGe,{plug:R,onClose:()=>{L(!1),z(null)}}),B&&(0,G.jsx)(DGe,{sensor:ee,printers:ln??[],onClose:()=>{V(!1),te(null)}}),ne&&(0,G.jsx)(kGe,{sensor:ie,locations:fn??[],onClose:()=>{re(!1),ae(null)}}),oe&&(0,G.jsx)(MGe,{onClose:()=>se(!1)}),de&&(0,G.jsx)(af,{title:i(`locationHaSensors.deleteAllConfirm.title`),message:i(`locationHaSensors.deleteAllConfirm.message`,{location:de.locationName,count:de.sensorIds.length}),variant:`danger`,isLoading:hn.isPending,onConfirm:()=>hn.mutate(de.sensorIds),onCancel:()=>fe(null)}),pe&&(0,G.jsx)(FGe,{provider:he,onClose:()=>{me(!1),ge(null)}}),_e&&(0,G.jsx)(IGe,{template:_e,onClose:()=>ve(null)}),Ce&&(0,G.jsx)(RGe,{onClose:()=>we(!1)}),tt&&(0,G.jsx)(af,{title:i(`settings.clearNotificationLogs`),message:i(`settings.clearLogsMessage`),confirmText:i(`settings.clearLogs`),variant:`warning`,onConfirm:async()=>{nt(!1);try{o((await Z.clearNotificationLogs(30)).message,`success`)}catch{o(i(`settings.toast.clearLogsFailed`),`error`)}},onCancel:()=>nt(!1)}),rt&&(0,G.jsx)(af,{title:i(`settings.resetUiPreferences`),message:i(`settings.resetUiPreferencesMessage`),confirmText:i(`settings.resetPreferences`),variant:`default`,onConfirm:()=>{it(!1),localStorage.clear(),o(i(`settings.toast.uiPreferencesReset`),`success`),setTimeout(()=>window.location.reload(),1e3)},onCancel:()=>it(!1)}),at&&(0,G.jsx)(af,{title:`Turn All Plugs ${at===`on`?`On`:`Off`}`,message:`This will turn ${at===`on`?`ON`:`OFF`} all ${$t?.filter(e=>e.enabled).length||0} enabled smart plugs. ${at===`off`?`Any running printers may be affected!`:``}`,confirmText:`Turn All ${at===`on`?`On`:`Off`}`,variant:at===`off`?`danger`:`warning`,onConfirm:()=>{let e=at;ot(null),pr.mutate(e)},onCancel:()=>ot(null)}),st&&In?.release_notes&&(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,onClick:()=>ct(!1),children:(0,G.jsxs)(zd,{className:`w-full max-w-2xl max-h-[80vh] flex flex-col`,onClick:e=>e.stopPropagation(),children:[(0,G.jsxs)(Bd,{className:`flex flex-row items-center justify-between shrink-0`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white`,children:[`Release Notes - v`,In.latest_version]}),In.release_name&&In.release_name!==In.latest_version&&(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:In.release_name})]}),(0,G.jsx)(`button`,{onClick:()=>ct(!1),className:`p-1 rounded hover:bg-bambu-dark-tertiary text-bambu-gray hover:text-white`,children:(0,G.jsx)($u,{className:`w-5 h-5`})})]}),(0,G.jsx)(Vd,{className:`overflow-y-auto flex-1`,children:(0,G.jsx)(`pre`,{className:`text-sm text-bambu-gray whitespace-pre-wrap font-sans`,children:In.release_notes})}),(0,G.jsxs)(`div`,{className:`p-4 border-t border-bambu-dark-tertiary shrink-0 flex gap-2`,children:[In.release_url&&(0,G.jsx)(`a`,{href:In.release_url,target:`_blank`,rel:`noopener noreferrer`,className:`flex-1`,children:(0,G.jsxs)(Q,{variant:`secondary`,className:`w-full`,children:[(0,G.jsx)(Xs,{className:`w-4 h-4`}),`View on GitHub`]})}),(0,G.jsx)(Q,{onClick:()=>ct(!1),className:`flex-1`,children:`Close`})]})]})}),Ne===`users`&&(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex gap-1 border-b border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`button`,{onClick:()=>Ie(`users`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px lg:border-b-0 lg:border-l-2 lg:-ml-px lg:mb-0 lg:justify-start flex items-center gap-2 ${Fe===`users`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(Bu,{className:`w-4 h-4`}),i(`settings.tabs.users`)]}),(0,G.jsxs)(`button`,{onClick:()=>Ie(`email`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px lg:border-b-0 lg:border-l-2 lg:-ml-px lg:mb-0 lg:justify-start flex items-center gap-2 ${Fe===`email`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)($c,{className:`w-4 h-4`}),i(`settings.tabs.emailAuth`)||`Email Authentication`,Wn?.advanced_auth_enabled&&(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-green-400`})]}),(0,G.jsxs)(`button`,{onClick:()=>Ie(`ldap`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px lg:border-b-0 lg:border-l-2 lg:-ml-px lg:mb-0 lg:justify-start flex items-center gap-2 ${Fe===`ldap`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(tu,{className:`w-4 h-4`}),i(`settings.tabs.ldap`)||`LDAP`,Gn?.ldap_enabled&&(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-green-400`})]}),(0,G.jsxs)(`button`,{onClick:()=>Ie(`twofa`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px flex items-center gap-2 ${Fe===`twofa`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(tu,{className:`w-4 h-4`}),i(`settings.tabs.twoFa`),(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full ${Kn?.totp_enabled||Kn?.email_otp_enabled?`bg-green-400`:`bg-bambu-gray/40`}`})]}),l&&(0,G.jsxs)(`button`,{onClick:()=>Ie(`oidc`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px flex items-center gap-2 ${Fe===`oidc`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(Cc,{className:`w-4 h-4`}),i(`settings.tabs.oidc`),(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full ${qn.some(e=>e.is_enabled)?`bg-green-400`:`bg-bambu-gray/40`}`})]}),l&&(0,G.jsxs)(`button`,{onClick:()=>Ie(`security`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px flex items-center gap-2 ${Fe===`security`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(tu,{className:`w-4 h-4`}),i(`settings.tabs.security`)]})]}),Fe===`users`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(zd,{children:(0,G.jsx)(Vd,{className:`py-4`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-10 h-10 rounded-full flex items-center justify-center ${s?`bg-green-500/20`:`bg-gray-500/20`}`,children:s?(0,G.jsx)(Xc,{className:`w-5 h-5 text-green-600 dark:text-green-400`}):(0,G.jsx)(Yc,{className:`w-5 h-5 text-gray-400`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-white font-medium`,children:i(`settings.authentication`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(s?`settings.authEnabledDescription`:`settings.authDisabledDescription`)})]})]}),s?c?.is_admin&&(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>ut(!0),children:[(0,G.jsx)(Yc,{className:`w-4 h-4`}),i(`common.disable`)]}):(0,G.jsxs)(Q,{onClick:()=>t(`/setup`),children:[(0,G.jsx)(Xc,{className:`w-4 h-4`}),i(`common.enable`)]})]})})}),Wn?.advanced_auth_enabled&&(0,G.jsx)(zd,{className:`border-blue-500/30 bg-blue-500/5`,children:(0,G.jsx)(Vd,{className:`py-4`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`w-10 h-10 rounded-full flex items-center justify-center bg-blue-500/20 flex-shrink-0`,children:(0,G.jsx)($c,{className:`w-5 h-5 text-blue-600 dark:text-blue-400`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-white font-medium`,children:i(`settings.email.advancedAuthEnabled`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:i(`settings.email.advancedAuthEnabledDesc`)})]})]})})}),s&&(0,G.jsxs)(`div`,{className:`grid grid-cols-1 xl:grid-cols-2 gap-6`,children:[(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(zd,{id:`card-session-policy`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h3`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(Xc,{className:`w-5 h-5 text-bambu-green`}),i(`settings.sessionPolicy.title`)]})}),(0,G.jsxs)(Vd,{children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mb-4`,children:i(`settings.sessionPolicy.description`)}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-2 mb-4`,children:[[{hours:24,labelKey:`settings.sessionPolicy.preset24h`},{hours:168,labelKey:`settings.sessionPolicy.preset7d`},{hours:720,labelKey:`settings.sessionPolicy.preset30d`}].map(e=>{let t=(A?.session_max_hours??24)===e.hours;return(0,G.jsx)(`button`,{type:`button`,onClick:()=>xr(`session_max_hours`,e.hours),disabled:s&&!d(`settings:update`),className:`px-3 py-2 rounded-lg text-sm font-medium transition-colors ${t?`bg-bambu-green text-white`:`bg-bambu-dark-tertiary text-bambu-gray hover:text-white hover:bg-bambu-dark`} disabled:opacity-50 disabled:cursor-not-allowed`,children:i(e.labelKey)},e.hours)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(`input`,{type:`number`,min:1,max:720,value:A?.session_max_hours??24,onChange:e=>{let t=parseInt(e.target.value,10);Number.isNaN(t)||xr(`session_max_hours`,Math.max(1,Math.min(720,t)))},disabled:s&&!d(`settings:update`),"aria-label":i(`settings.sessionPolicy.customHoursLabel`),className:`w-20 px-2 py-2 bg-bambu-dark-tertiary text-white text-sm rounded-lg border border-bambu-dark-tertiary focus:border-bambu-green focus:outline-none disabled:opacity-50`}),(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:i(`settings.sessionPolicy.hoursSuffix`)})]})]}),(A?.session_max_hours??24)>24&&(0,G.jsxs)(`div`,{className:`flex items-start gap-2 p-3 rounded-lg bg-yellow-50 dark:bg-yellow-500/10 border border-yellow-300 dark:border-yellow-500/30`,children:[(0,G.jsx)(Pu,{className:`w-4 h-4 text-yellow-600 dark:text-yellow-400 flex-shrink-0 mt-0.5`}),(0,G.jsx)(`p`,{className:`text-xs text-yellow-800 dark:text-yellow-200`,children:i(`settings.sessionPolicy.warning`)})]})]})]}),c&&(0,G.jsxs)(zd,{children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`h3`,{className:`text-lg font-semibold text-white flex items-center gap-2`,id:`card-currentuser`,children:[(0,G.jsx)(Bu,{className:`w-5 h-5 text-bambu-green`}),i(`settings.currentUser`)]}),c.auth_source!==`ldap`&&(0,G.jsxs)(Q,{size:`sm`,variant:`ghost`,onClick:()=>ft(!0),children:[(0,G.jsx)(Bc,{className:`w-4 h-4`}),i(`settings.changePassword`)]})]})}),(0,G.jsx)(Vd,{children:(0,G.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white font-medium text-lg`,children:c.username}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-1 mt-2`,children:[c.is_admin&&(0,G.jsx)(`span`,{className:`px-2 py-0.5 rounded-full text-xs font-medium bg-purple-100 dark:bg-purple-500/20 text-purple-700 dark:text-purple-300`,children:i(`settings.admin`)}),c.groups?.map(e=>(0,G.jsx)(`span`,{className:`px-2 py-0.5 rounded-full text-xs font-medium ${e.name===`Administrators`?`bg-purple-100 dark:bg-purple-500/20 text-purple-700 dark:text-purple-300`:e.name===`Operators`?`bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-300`:e.name===`Viewers`?`bg-green-100 dark:bg-green-500/20 text-green-700 dark:text-green-300`:`bg-gray-500/20 text-gray-300`}`,children:e.name},e.id))]})]})})})]}),(0,G.jsxs)(zd,{children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`h3`,{className:`text-lg font-semibold text-white flex items-center gap-2`,id:`card-users`,children:[(0,G.jsx)(Bu,{className:`w-5 h-5 text-bambu-green`}),i(`settings.users`)]}),d(`users:create`)&&(0,G.jsxs)(Q,{size:`sm`,onClick:()=>{bt(!0),Ft({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]})},children:[(0,G.jsx)(kl,{className:`w-4 h-4`}),i(`settings.addUser`)]})]})}),(0,G.jsx)(Vd,{children:Yn?(0,G.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,G.jsx)(Y,{className:`w-6 h-6 text-bambu-green animate-spin`})}):Jn.length===0?(0,G.jsx)(`p`,{className:`text-center text-bambu-gray py-8`,children:i(`settings.noUsersFound`)}):(0,G.jsx)(`div`,{className:`divide-y divide-bambu-dark-tertiary`,children:Jn.map(e=>(0,G.jsxs)(`div`,{className:`py-3 flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`p`,{className:`text-white font-medium truncate`,children:e.username}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-1 mt-1`,children:[e.auth_source===`ldap`&&(0,G.jsx)(`span`,{className:`px-2 py-0.5 rounded-full text-xs font-medium bg-cyan-100 dark:bg-cyan-500/20 text-cyan-700 dark:text-cyan-300`,children:`LDAP`}),e.is_admin&&(0,G.jsx)(`span`,{className:`px-2 py-0.5 rounded-full text-xs font-medium bg-purple-100 dark:bg-purple-500/20 text-purple-700 dark:text-purple-300`,children:i(`settings.admin`)}),e.groups?.map(e=>(0,G.jsx)(`span`,{className:`px-2 py-0.5 rounded-full text-xs font-medium ${e.name===`Administrators`?`bg-purple-100 dark:bg-purple-500/20 text-purple-700 dark:text-purple-300`:e.name===`Operators`?`bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-300`:e.name===`Viewers`?`bg-green-100 dark:bg-green-500/20 text-green-700 dark:text-green-300`:`bg-gray-500/20 text-gray-300`}`,children:e.name},e.id))]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1 ml-4`,children:[d(`users:update`)&&(0,G.jsx)(Q,{size:`sm`,variant:`ghost`,onClick:()=>sr(e),children:(0,G.jsx)(Cl,{className:`w-4 h-4`})}),d(`users:delete`)&&e.id!==c?.id&&(0,G.jsx)(Q,{size:`sm`,variant:`ghost`,onClick:()=>rr(e.id),children:(0,G.jsx)(ju,{className:`w-4 h-4`})})]})]},e.id))})})]})]}),(0,G.jsx)(`div`,{children:(0,G.jsxs)(zd,{children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`h3`,{className:`text-lg font-semibold text-white flex items-center gap-2`,id:`card-groups`,children:[(0,G.jsx)(tu,{className:`w-5 h-5 text-bambu-green`}),i(`settings.groups`)]}),d(`groups:create`)&&(0,G.jsxs)(Q,{size:`sm`,onClick:()=>t(`/groups/new`),children:[(0,G.jsx)(kl,{className:`w-4 h-4`}),i(`settings.addGroup`)]})]})}),(0,G.jsx)(Vd,{children:Zn?(0,G.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,G.jsx)(Y,{className:`w-6 h-6 text-bambu-green animate-spin`})}):Xn.length===0?(0,G.jsx)(`p`,{className:`text-center text-bambu-gray py-8`,children:i(`settings.noGroupsFound`)}):(0,G.jsx)(`div`,{className:`divide-y divide-bambu-dark-tertiary`,children:Xn.map(e=>(0,G.jsxs)(`div`,{className:`py-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(tu,{className:`w-4 h-4 ${e.name===`Administrators`?`text-purple-600 dark:text-purple-400`:e.name===`Operators`?`text-blue-600 dark:text-blue-400`:e.name===`Viewers`?`text-green-600 dark:text-green-400`:`text-bambu-gray`}`}),(0,G.jsx)(`span`,{className:`text-white font-medium`,children:e.name}),e.is_system&&(0,G.jsx)(`span`,{className:`px-2 py-0.5 rounded text-xs bg-yellow-100 dark:bg-yellow-500/20 text-yellow-700 dark:text-yellow-400`,children:i(`settings.system`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[d(`groups:update`)&&(0,G.jsx)(Q,{size:`sm`,variant:`ghost`,onClick:()=>t(`/groups/${e.id}/edit`),children:(0,G.jsx)(Cl,{className:`w-4 h-4`})}),d(`groups:delete`)&&!e.is_system&&(0,G.jsx)(Q,{size:`sm`,variant:`ghost`,onClick:()=>Lt(e.id),children:(0,G.jsx)(ju,{className:`w-4 h-4`})})]})]}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1 ml-6`,children:e.description||i(`settings.noDescription`)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-4 mt-2 ml-6 text-xs text-bambu-gray`,children:[(0,G.jsx)(`span`,{children:i(`settings.userCount`,{count:e.user_count})}),(0,G.jsx)(`span`,{children:i(`settings.permissionCount`,{count:e.permissions.length})})]})]},e.id))})})]})})]}),!s&&(0,G.jsx)(zd,{children:(0,G.jsx)(Vd,{className:`py-6`,children:(0,G.jsxs)(`div`,{className:`text-center`,children:[(0,G.jsx)(Yc,{className:`w-12 h-12 text-bambu-gray mx-auto mb-4`}),(0,G.jsx)(`h3`,{className:`text-lg font-medium text-white mb-2`,children:i(`settings.authDisabledTitle`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mb-4 max-w-md mx-auto`,children:i(`settings.authDisabledMessage`)}),(0,G.jsxs)(`ul`,{className:`space-y-2 text-sm text-bambu-gray mb-6 text-left max-w-xs mx-auto`,children:[(0,G.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(ms,{className:`w-4 h-4 text-bambu-green mt-0.5 flex-shrink-0`}),(0,G.jsx)(`span`,{children:i(`settings.authDisabledFeature1`)})]}),(0,G.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(ms,{className:`w-4 h-4 text-bambu-green mt-0.5 flex-shrink-0`}),(0,G.jsx)(`span`,{children:i(`settings.authDisabledFeature2`)})]}),(0,G.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(ms,{className:`w-4 h-4 text-bambu-green mt-0.5 flex-shrink-0`}),(0,G.jsx)(`span`,{children:i(`settings.authDisabledFeature3`)})]})]}),(0,G.jsxs)(Q,{onClick:()=>t(`/setup`),children:[(0,G.jsx)(Xc,{className:`w-4 h-4`}),i(`settings.enableAuthentication`)]})]})})})]}),Fe===`email`&&(0,G.jsx)(`div`,{className:`max-w-5xl`,id:`card-smtp`,children:(0,G.jsx)(SKe,{})}),Fe===`ldap`&&(0,G.jsx)(`div`,{className:`max-w-5xl`,id:`card-ldap`,children:(0,G.jsx)(wKe,{})}),Fe===`twofa`&&(0,G.jsx)(`div`,{className:`max-w-2xl`,children:(0,G.jsx)(EKe,{})}),Fe===`oidc`&&l&&(0,G.jsxs)(`div`,{className:`max-w-3xl space-y-4`,children:[(0,G.jsx)(zd,{children:(0,G.jsx)(Vd,{className:`space-y-3 p-4`,children:(0,G.jsxs)(`label`,{className:`flex items-start gap-3 cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.local_login_enabled===!1,onChange:e=>xr(`local_login_enabled`,!e.target.checked),className:`mt-1 h-4 w-4 rounded border-bambu-dark-tertiary bg-bambu-dark-secondary text-bambu-green focus:ring-bambu-green/50 cursor-pointer`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-sm font-medium text-white`,children:i(`settings.localLogin.disable`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:i(`settings.localLogin.disableHint`)})]})]})})}),(0,G.jsx)(kKe,{})]}),Fe===`security`&&l&&(0,G.jsx)(`div`,{className:`max-w-3xl`,children:(0,G.jsx)(jKe,{})})]}),yt&&!Wn?.advanced_auth_enabled&&(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black flex items-center justify-center z-50 p-4`,onClick:()=>{bt(!1),Ft({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]})},children:(0,G.jsxs)(zd,{className:`w-full max-w-md`,onClick:e=>e.stopPropagation(),children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Bu,{className:`w-5 h-5 text-bambu-green`}),(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:i(`settings.createUser`)})]}),(0,G.jsx)(Q,{variant:`ghost`,size:`sm`,onClick:()=>{bt(!1),Ft({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]})},children:(0,G.jsx)($u,{className:`w-5 h-5`})})]})}),(0,G.jsxs)(Vd,{children:[Gn?.ldap_enabled&&(0,G.jsxs)(`div`,{className:`mb-4 flex items-center gap-1 p-1 bg-bambu-dark-secondary rounded-lg`,role:`tablist`,"aria-label":i(`users.modal.tabsAriaLabel`),children:[(0,G.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":xt===`local`,onClick:()=>Ct(`local`),className:`flex-1 px-3 py-2 text-sm rounded-md transition-colors ${xt===`local`?`bg-bambu-green/15 text-bambu-green`:`text-bambu-gray hover:text-white`}`,children:i(`users.modal.localTab`)}),(0,G.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":xt===`ldap`,onClick:()=>Ct(`ldap`),className:`flex-1 px-3 py-2 text-sm rounded-md transition-colors ${xt===`ldap`?`bg-bambu-green/15 text-bambu-green`:`text-bambu-gray hover:text-white`}`,children:i(`users.modal.ldapTab`)})]}),xt===`ldap`&&Gn?.ldap_enabled?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(S8,{onSuccess:e=>{bt(!1),Ct(`local`),Ft({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]}),o(i(`users.toast.ldapProvisioned`,{username:e.username}))}}),(0,G.jsx)(`div`,{className:`mt-6 flex justify-end`,children:(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>{bt(!1),Ct(`local`),Ft({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]})},children:i(`common.cancel`)})})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:i(`settings.username`)}),(0,G.jsx)(`input`,{type:`text`,value:Pt.username,onChange:e=>Ft({...Pt,username:e.target.value}),className:`w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:i(`settings.enterUsername`),autoComplete:`username`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:i(`settings.password`)}),(0,G.jsx)(`input`,{type:`password`,value:Pt.password,onChange:e=>Ft({...Pt,password:e.target.value}),className:`w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:i(`settings.enterPassword`),autoComplete:`new-password`,minLength:8}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-xs mt-1`,children:i(`settings.passwordRequirements`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:i(`settings.confirmPassword`)}),(0,G.jsx)(`input`,{type:`password`,value:Pt.confirmPassword,onChange:e=>Ft({...Pt,confirmPassword:e.target.value}),className:`w-full px-4 py-3 bg-bambu-dark-secondary border rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors ${Pt.confirmPassword&&Pt.password!==Pt.confirmPassword?`border-red-500`:`border-bambu-dark-tertiary`}`,placeholder:i(`settings.confirmPasswordPlaceholder`),autoComplete:`new-password`,minLength:6}),Pt.confirmPassword&&Pt.password!==Pt.confirmPassword&&(0,G.jsx)(`p`,{className:`text-red-700 dark:text-red-400 text-xs mt-1`,children:i(`settings.passwordsDoNotMatch`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:i(`settings.groups`)}),(0,G.jsxs)(`div`,{className:`space-y-2 max-h-40 overflow-y-auto p-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg`,children:[Xn.map(e=>(0,G.jsxs)(`label`,{className:`flex items-center gap-3 px-2 py-1.5 rounded hover:bg-bambu-dark-tertiary cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:Pt.group_ids.includes(e.id),onChange:()=>cr(e.id),className:`w-4 h-4 rounded border-bambu-gray text-bambu-green focus:ring-bambu-green focus:ring-offset-0 bg-bambu-dark`}),(0,G.jsx)(`span`,{className:`text-sm text-white`,children:e.name}),e.is_system&&(0,G.jsx)(`span`,{className:`text-xs text-yellow-700 dark:text-yellow-400`,children:i(`settings.systemBadge`)})]},e.id)),Xn.length===0&&(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.noGroupsAvailable`)})]})]})]}),(0,G.jsxs)(`div`,{className:`mt-6 flex justify-end gap-3`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>{bt(!1),Ft({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]})},children:i(`common.cancel`)}),(0,G.jsx)(Q,{onClick:ar,disabled:Qn.isPending||!Pt.username||!Pt.password||Pt.password!==Pt.confirmPassword||f6(Pt.password)!==null,children:Qn.isPending?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),i(`settings.creating`)]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(kl,{className:`w-4 h-4`}),i(`settings.createUser`)]})})]})]})]})]})}),yt&&Wn?.advanced_auth_enabled&&(0,G.jsx)($Ge,{formData:Pt,setFormData:Ft,groups:Xn,onClose:()=>{bt(!1),Ft({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]})},onCreate:ar,isCreating:Qn.isPending,isCreateButtonDisabled:Qn.isPending||!Pt.username||!Pt.email,ldapEnabled:Gn?.ldap_enabled,onLdapProvisioned:e=>{bt(!1),Ft({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]}),o(i(`users.toast.ldapProvisioned`,{username:e.username}))}}),wt&&Et!==null&&(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black flex items-center justify-center z-50 p-4`,onClick:()=>{Tt(!1),Dt(null),Ft({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]})},children:(0,G.jsxs)(zd,{className:`w-full max-w-md`,onClick:e=>e.stopPropagation(),children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Cl,{className:`w-5 h-5 text-bambu-green`}),(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:i(`settings.editUser`)})]}),(0,G.jsx)(Q,{variant:`ghost`,size:`sm`,onClick:()=>{Tt(!1),Dt(null),Ft({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]})},children:(0,G.jsx)($u,{className:`w-5 h-5`})})]})}),(0,G.jsxs)(Vd,{children:[(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:[i(`settings.username`),` `,Wn?.advanced_auth_enabled&&(0,G.jsx)(`span`,{className:`text-red-700 dark:text-red-400`,children:`*`})]}),(0,G.jsx)(`input`,{type:`text`,value:Pt.username,onChange:e=>Ft({...Pt,username:e.target.value}),className:`w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:i(`settings.enterUsername`),autoComplete:`username`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:[i(`users.form.email`)||`Email`,` `,Wn?.advanced_auth_enabled?(0,G.jsx)(`span`,{className:`text-red-700 dark:text-red-400`,children:`*`}):(0,G.jsxs)(`span`,{className:`text-bambu-gray font-normal`,children:[`(`,i(`users.form.optional`)||`optional`,`)`]})]}),(0,G.jsx)(`input`,{type:`email`,value:Pt.email,onChange:e=>Ft({...Pt,email:e.target.value}),className:`w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:i(`users.form.emailPlaceholder`)||`user@example.com`,required:Wn?.advanced_auth_enabled})]}),!Wn?.advanced_auth_enabled&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:[i(`users.form.password`)||`Password`,` `,(0,G.jsxs)(`span`,{className:`text-bambu-gray font-normal`,children:[`(`,i(`users.form.leaveBlankToKeep`)||`leave blank to keep current`,`)`]})]}),(0,G.jsx)(`input`,{type:`password`,value:Pt.password,onChange:e=>Ft({...Pt,password:e.target.value,confirmPassword:``}),className:`w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:i(`settings.enterNewPassword`),autoComplete:`new-password`,minLength:8}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-xs mt-1`,children:i(`settings.passwordRequirements`)})]}),Pt.password&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:i(`settings.confirmPassword`)}),(0,G.jsx)(`input`,{type:`password`,value:Pt.confirmPassword,onChange:e=>Ft({...Pt,confirmPassword:e.target.value}),className:`w-full px-4 py-3 bg-bambu-dark-secondary border rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors ${Pt.confirmPassword&&Pt.password!==Pt.confirmPassword?`border-red-500`:`border-bambu-dark-tertiary`}`,placeholder:i(`settings.confirmNewPassword`),autoComplete:`new-password`,minLength:6}),Pt.confirmPassword&&Pt.password!==Pt.confirmPassword&&(0,G.jsx)(`p`,{className:`text-red-700 dark:text-red-400 text-xs mt-1`,children:i(`settings.passwordsDoNotMatch`)})]})]}),Wn?.advanced_auth_enabled&&(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary/50 border border-bambu-green/20 rounded-lg p-3 space-y-3`,children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`users.form.passwordManagedByAdvancedAuth`)||`Password is managed by Advanced Authentication. Use "Reset Password" to send a new password to the user via email.`}),(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:()=>Et&&nr.mutate(Et),disabled:nr.isPending||!Pt.email,className:`w-full`,children:nr.isPending?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),i(`users.form.resettingPassword`)||`Resetting Password...`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Rl,{className:`w-4 h-4`}),i(`users.form.resetPassword`)||`Reset Password`]})})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:i(`users.form.groups`)||`Groups`}),(0,G.jsx)(`div`,{className:`space-y-2 max-h-40 overflow-y-auto p-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg`,children:Xn.map(e=>(0,G.jsxs)(`label`,{className:`flex items-center gap-3 px-2 py-1.5 rounded hover:bg-bambu-dark-tertiary cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:Pt.group_ids.includes(e.id),onChange:()=>cr(e.id),className:`w-4 h-4 rounded border-bambu-gray text-bambu-green focus:ring-bambu-green focus:ring-offset-0 bg-bambu-dark`}),(0,G.jsx)(`span`,{className:`text-sm text-white`,children:e.name}),e.is_system&&(0,G.jsxs)(`span`,{className:`text-xs text-yellow-700 dark:text-yellow-400`,children:[`(`,i(`users.system`)||`System`,`)`]})]},e.id))})]})]}),(0,G.jsxs)(`div`,{className:`mt-6 flex justify-end gap-3`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>{Tt(!1),Dt(null),Ft({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]})},children:i(`users.modal.cancel`)||`Cancel`}),(0,G.jsx)(Q,{onClick:()=>or(Et),disabled:er.isPending||!Pt.username||Wn?.advanced_auth_enabled&&!Pt.email||!!(!Wn?.advanced_auth_enabled&&Pt.password&&(Pt.password!==Pt.confirmPassword||f6(Pt.password)!==null)),children:er.isPending?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),i(`users.modal.saving`)||`Saving...`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Vl,{className:`w-4 h-4`}),i(`users.modal.saveChanges`)||`Save Changes`]})})]})]})]})}),Ot!==null&&(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/80 flex items-center justify-center z-50 p-4`,onClick:()=>{kt(null),jt(null)},children:(0,G.jsxs)(zd,{className:`w-full max-w-md`,onClick:e=>e.stopPropagation(),children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-red-700 dark:text-red-400`,children:[(0,G.jsx)(ju,{className:`w-5 h-5`}),(0,G.jsx)(`h3`,{className:`text-lg font-semibold`,children:i(`settings.deleteUserTitle`)})]})}),(0,G.jsx)(Vd,{className:`space-y-3`,children:Mt?(0,G.jsx)(`div`,{className:`flex items-center justify-center py-4`,children:(0,G.jsx)(`div`,{className:`animate-spin rounded-full h-6 w-6 border-2 border-bambu-green border-t-transparent`})}):At&&At.archives+At.queue_items+At.library_files>0?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.userHasCreated`)}),(0,G.jsxs)(`ul`,{className:`list-disc list-inside text-bambu-gray space-y-1`,children:[At.archives>0&&(0,G.jsxs)(`li`,{children:[At.archives,` archive`,At.archives===1?``:`s`]}),At.queue_items>0&&(0,G.jsxs)(`li`,{children:[At.queue_items,` queue item`,At.queue_items===1?``:`s`]}),At.library_files>0&&(0,G.jsxs)(`li`,{children:[At.library_files,` library file`,At.library_files===1?``:`s`]})]}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-sm`,children:i(`settings.userItemsQuestion`)}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(Q,{variant:`danger`,onClick:()=>tr.mutate({id:Ot,deleteItems:!0}),disabled:tr.isPending,className:`justify-center`,children:i(`settings.deleteUserAndItems`)}),(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>tr.mutate({id:Ot,deleteItems:!1}),disabled:tr.isPending,className:`justify-center`,children:i(`settings.deleteUserKeepItems`)}),(0,G.jsx)(Q,{variant:`ghost`,onClick:()=>{kt(null),jt(null)},disabled:tr.isPending,className:`justify-center`,children:i(`common.cancel`)})]})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.deleteUserConfirm`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-sm`,children:i(`settings.actionCannotBeUndone`)}),(0,G.jsxs)(`div`,{className:`flex gap-2 justify-end`,children:[(0,G.jsx)(Q,{variant:`ghost`,onClick:()=>{kt(null),jt(null)},disabled:tr.isPending,children:i(`common.cancel`)}),(0,G.jsx)(Q,{variant:`danger`,onClick:()=>tr.mutate({id:Ot,deleteItems:!1}),disabled:tr.isPending,children:i(`settings.deleteUserTitle`)})]})]})})]})}),It!==null&&(0,G.jsx)(af,{title:i(`settings.deleteGroupTitle`),message:i(`settings.deleteGroupMessage`),confirmText:i(`settings.deleteGroup`),variant:`danger`,onConfirm:()=>{ir.mutate(It),Lt(null)},onCancel:()=>Lt(null)}),Ne===`failure-detection`&&(0,G.jsx)(`div`,{id:`card-failure-detection`,children:(0,G.jsx)(yKe,{})}),Ne===`backup`&&(0,G.jsxs)(`div`,{id:`card-backup`,children:[(0,G.jsxs)(`div`,{className:`mb-4 p-3 bg-amber-50 dark:bg-amber-500/10 border border-amber-300 dark:border-amber-500/30 rounded-lg flex items-start gap-2`,children:[(0,G.jsx)(tu,{className:`text-amber-600 dark:text-amber-400 flex-shrink-0 mt-0.5`,size:16}),(0,G.jsx)(`p`,{className:`text-sm text-amber-700 dark:text-amber-400`,children:i(`backup.includesEncryptionKey`)})]}),(0,G.jsx)(vKe,{})]}),lt&&(0,G.jsx)(af,{title:i(`settings.disableAuthenticationTitle`),message:i(`settings.disableAuthenticationMessage`),confirmText:i(`settings.disableAuthentication`),variant:`danger`,onConfirm:async()=>{try{await Z.disableAuth(),o(i(`settings.toast.authDisabled`),`success`),await u(),ut(!1),window.location.href=`/`}catch(e){o(e instanceof Error?e.message:i(`settings.toast.authDisableFailed`),`error`)}},onCancel:()=>ut(!1)}),dt&&(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,onClick:()=>{ft(!1),mt({currentPassword:``,newPassword:``,confirmPassword:``})},children:(0,G.jsxs)(zd,{className:`w-full max-w-md`,onClick:e=>e.stopPropagation(),children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Bc,{className:`w-5 h-5 text-bambu-green`}),(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:i(`settings.changePassword`)})]}),(0,G.jsx)(Q,{variant:`ghost`,size:`sm`,onClick:()=>{ft(!1),mt({currentPassword:``,newPassword:``,confirmPassword:``})},children:(0,G.jsx)($u,{className:`w-5 h-5`})})]})}),(0,G.jsxs)(Vd,{children:[(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:`Current Password`}),(0,G.jsx)(`input`,{type:`password`,value:pt.currentPassword,onChange:e=>mt({...pt,currentPassword:e.target.value}),className:`w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:i(`settings.enterCurrentPassword`),autoComplete:`current-password`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:`New Password`}),(0,G.jsx)(`input`,{type:`password`,value:pt.newPassword,onChange:e=>mt({...pt,newPassword:e.target.value}),className:`w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:i(`settings.enterNewPasswordMin6`),autoComplete:`new-password`,minLength:6})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:`Confirm New Password`}),(0,G.jsx)(`input`,{type:`password`,value:pt.confirmPassword,onChange:e=>mt({...pt,confirmPassword:e.target.value}),className:`w-full px-4 py-3 bg-bambu-dark-secondary border rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors ${pt.confirmPassword&&pt.newPassword!==pt.confirmPassword?`border-red-500`:`border-bambu-dark-tertiary`}`,placeholder:i(`settings.confirmNewPassword`),autoComplete:`new-password`,minLength:6}),pt.confirmPassword&&pt.newPassword!==pt.confirmPassword&&(0,G.jsx)(`p`,{className:`text-red-700 dark:text-red-400 text-xs mt-1`,children:i(`settings.passwordsDoNotMatch`)})]})]}),(0,G.jsxs)(`div`,{className:`mt-6 flex justify-end gap-3`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>{ft(!1),mt({currentPassword:``,newPassword:``,confirmPassword:``})},children:i(`common.cancel`)}),(0,G.jsx)(Q,{onClick:async()=>{if(pt.newPassword!==pt.confirmPassword){o(i(`settings.toast.passwordsDoNotMatch`),`error`);return}if(pt.newPassword.length<6){o(i(`settings.toast.passwordTooShort`),`error`);return}gt(!0);try{await Z.changePassword(pt.currentPassword,pt.newPassword),o(i(`settings.toast.passwordChanged`),`success`),ft(!1),mt({currentPassword:``,newPassword:``,confirmPassword:``})}catch(e){o(e instanceof Error?e.message:`Failed to change password`,`error`)}finally{gt(!1)}},disabled:ht||!pt.currentPassword||!pt.newPassword||pt.newPassword!==pt.confirmPassword||pt.newPassword.length<6,children:ht?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),i(`settings.changing`)]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Bc,{className:`w-4 h-4`}),i(`settings.changePassword`)]})})]})]})]})})]})]})]})})}var HKe=/\[(aborted|failed|cancelled):\s*([^\]]*)\]/i;function UKe(e){if(!e)return{isPartial:!1,partialType:null,cleanedDescription:null};let t=e.match(HKe);if(!t)return{isPartial:!1,partialType:null,cleanedDescription:e};let n=e.replace(t[0],``).trim();return{isPartial:!0,partialType:t[1].toLowerCase(),cleanedDescription:n||null}}function WKe(e,t){if(!e)return`-`;let n=$f(e);return n?n.toLocaleString(t):e}function J8(e){let t=e.trim();if(!t)return null;let n=Number.parseFloat(t);return Number.isFinite(n)?n:null}function Y8(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}T${String(e.getHours()).padStart(2,`0`)}:${String(e.getMinutes()).padStart(2,`0`)}`}var X8=`w-full px-3 py-2 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded text-white placeholder-bambu-gray focus:outline-none focus:ring-1 focus:ring-bambu-green`,Z8=`block text-sm font-medium text-white mb-1`,Q8=`px-4 py-3 text-left text-bambu-gray font-medium`,$8=`px-4 py-3 align-top text-white`;function e5({title:e,onClose:t,children:n,size:r=`md`}){let{t:i}=U();return(0,G.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4`,children:(0,G.jsxs)(`div`,{className:`w-full ${r===`sm`?`max-w-xl`:r===`lg`?`max-w-6xl`:`max-w-4xl`} overflow-hidden rounded-lg border border-bambu-dark-tertiary bg-bambu-dark-secondary`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between border-b border-bambu-dark-tertiary px-4 py-3`,children:[(0,G.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:e}),(0,G.jsx)(Q,{size:`sm`,variant:`secondary`,onClick:t,children:i(`common.close`,`Close`)})]}),(0,G.jsx)(`div`,{className:`max-h-[75vh] overflow-auto p-4`,children:n})]})})}function GKe(){let{t:e,i18n:t}=U(),{hasPermission:n,user:r}=Nd(),{showToast:i}=qd(),a=no(),o=n(`cost_centers:read_own`),s=n(`cost_centers:read_all`),c=n(`cost_centers:create`),l=n(`cost_centers:modify`),u=n(`cost_centers:modify`),d=n(`cost_centers:modify`),p=n(`cost_centers:modify`),m=n(`users:read_slim`)||n(`users:read`),h=s||c||l||u||d||p,g=o||h,_=g,[v,y]=(0,f.useState)(``),[b,x]=(0,f.useState)(`monthly`),[S,C]=(0,f.useState)(``),[w,T]=(0,f.useState)(null),[E,D]=(0,f.useState)(`deposit`),[O,k]=(0,f.useState)(``),[A,j]=(0,f.useState)(``),[M,N]=(0,f.useState)(null),[P,F]=(0,f.useState)(null),[I,L]=(0,f.useState)(null),[R,z]=(0,f.useState)(!0),[B,V]=(0,f.useState)(0),[ee,te]=(0,f.useState)(`all`),[ne,re]=(0,f.useState)(`all`),[ie,ae]=(0,f.useState)(!1),[oe,se]=(0,f.useState)(!1),[H,ce]=(0,f.useState)(!1),[le,ue]=(0,f.useState)(!1),[de,fe]=(0,f.useState)(`personal`),[pe,me]=(0,f.useState)(null),[he,ge]=(0,f.useState)(``),[_e,ve]=(0,f.useState)(`monthly`),[ye,be]=(0,f.useState)(``),[xe,Se]=(0,f.useState)(!1),[Ce,we]=(0,f.useState)(null),[Te,Ee]=(0,f.useState)(null),[De,Oe]=(0,f.useState)(null),[ke,Ae]=(0,f.useState)(``),[je,Me]=(0,f.useState)(``),[Ne,Pe]=(0,f.useState)(!1),[Fe,Ie]=(0,f.useState)(null),[Le,Re]=(0,f.useState)(null),[ze,Be]=(0,f.useState)(``),[Ve,He]=(0,f.useState)(``),[Ue,We]=(0,f.useState)(Y8(new Date)),[Ge,Ke]=(0,f.useState)(null),[qe,Je]=(0,f.useState)(null),Ye=s||c||l||u||p&&m||d&&m;(0,f.useEffect)(()=>{Ye||fe(`personal`)},[Ye]);let{data:Xe,isLoading:Ze}=K({queryKey:[`finance`,`me`,`balance`],queryFn:Z.getMyBalance,enabled:o}),{data:Qe}=K({queryKey:[`ui-flags`],queryFn:Z.getUiFlags}),{data:$e,isLoading:et}=K({queryKey:[`finance`,`me`,`transactions`,50,B],queryFn:()=>Z.getMyTransactions(50,B),enabled:o}),{data:tt,isLoading:nt}=K({queryKey:[`finance`,`transactions`,50,B],queryFn:()=>Z.getAllTransactions(50,B),enabled:de===`admin`&&s}),{data:rt,isLoading:it}=K({queryKey:[`finance`,`cost-centers`,de],queryFn:()=>de===`admin`&&h?Z.listCostCenters(!0):Z.getMyCostCenters(),enabled:_}),{data:at}=K({queryKey:[`users`,`slim`],queryFn:Z.getUsersSlim,enabled:m&&(_||p||d)}),{data:ot}=K({queryKey:[`finance`,`cost-center`,P],queryFn:()=>Z.getCostCenter(P),enabled:d&&P!=null});(0,f.useEffect)(()=>{!at||at.length===0||w!=null&&at.some(e=>e.id===w)||T(at[0].id)},[at,w]),(0,f.useEffect)(()=>{if(!d)return;let e=(rt||[]).filter(e=>!e.is_private);if(e.length===0){F(null);return}P!=null&&e.some(e=>e.id===P)||F(e[0].id)},[d,rt,P]),(0,f.useEffect)(()=>{if(!d||!at||at.length===0)return;let e=new Set((ot?.members||[]).map(e=>e.user_id)),t=at.find(t=>!e.has(t.id));L(t?t.id:null)},[d,at,ot]),(0,f.useEffect)(()=>{if(!le)return;let e=rt||[];if(e.length===0){me(null);return}pe!=null&&e.some(e=>e.id===pe)||me(e[0].id)},[le,pe,rt]),(0,f.useEffect)(()=>{if(!le||pe==null)return;let e=(rt||[]).find(e=>e.id===pe);if(e){if(ge(e.name),e.budget_mode===`total`){ve(`total`),be(e.total_budget==null?``:String(e.total_budget));return}ve(`monthly`),be(e.monthly_budget==null?``:String(e.monthly_budget))}},[le,pe,rt]);let st=q({mutationFn:()=>Z.createCostCenter({name:v.trim(),total_budget:b===`total`?J8(S):null,monthly_budget:b===`monthly`?J8(S):null,is_active:!0}),onSuccess:()=>{a.invalidateQueries({queryKey:[`finance`]}),y(``),C(``),i(e(`finance.createdCostCenter`,`Cost center created`))},onError:t=>{i(t.message||e(`finance.createCostCenterFailed`,`Failed to create cost center`),`error`)}}),ct=q({mutationFn:({costCenterId:e,value:t,mode:n})=>Z.updateCostCenterBudgets(e,{total_budget:n===`total`?J8(t):null,monthly_budget:n===`monthly`?J8(t):null})}),lt=q({mutationFn:({costCenterId:e,name:t})=>Z.updateCostCenter(e,{name:t})}),ut=q({mutationFn:e=>Z.deleteCostCenter(e)}),dt=q({mutationFn:e=>Z.deleteTransaction(e),onSuccess:()=>{a.invalidateQueries({queryKey:[`finance`]}),i(e(`finance.transactionDeleted`,`Transaction deleted`))},onError:t=>{i(t.message||e(`finance.deleteTransactionFailed`,`Failed to delete transaction`),`error`)}}),ft=q({mutationFn:e=>Z.editTransaction(e.transactionId,e.data),onSuccess:()=>{a.invalidateQueries({queryKey:[`finance`]}),i(e(`finance.transactionEdited`,`Transaction updated and ledger recalculated`)),Se(!1)},onError:t=>{i(t.message||e(`finance.editTransactionFailed`,`Failed to edit transaction`),`error`)}}),pt=q({mutationFn:e=>Z.createManualPrint(e),onSuccess:()=>{a.invalidateQueries({queryKey:[`finance`]}),i(e(`finance.manualPrintCreated`,`Manual print charge added and ledger recalculated`)),Pe(!1),Ie(null),Re(null),Be(``),He(``),We(Y8(new Date))},onError:t=>{i(t.message||e(`finance.manualPrintFailed`,`Failed to create manual print`),`error`)}}),mt=q({mutationFn:e=>Z.depositUserBalance(e.userId,{amount:e.amount,description:e.description,cost_center_id:e.costCenterId??null})}),ht=q({mutationFn:e=>Z.withdrawUserBalance(e.userId,{amount:e.amount,description:e.description,cost_center_id:e.costCenterId??null})}),gt=q({mutationFn:e=>Z.upsertCostCenterMember(e.costCenterId,{user_id:e.userId,can_print:e.canPrint}),onSuccess:()=>{a.invalidateQueries({queryKey:[`finance`]}),i(e(`finance.memberSaved`,`Member saved`))},onError:t=>{i(t.message||e(`finance.memberSaveFailed`,`Failed to save member`),`error`)}}),_t=q({mutationFn:e=>Z.removeCostCenterMember(e.costCenterId,e.userId),onSuccess:()=>{a.invalidateQueries({queryKey:[`finance`]}),i(e(`finance.memberRemoved`,`Member removed`))},onError:t=>{i(t.message||e(`finance.memberRemoveFailed`,`Failed to remove member`),`error`)}}),vt=mt.isPending||ht.isPending,yt=()=>{if(!v.trim()){i(e(`finance.costCenterNameRequired`,`Cost center name is required`),`error`);return}st.mutate()},bt=async()=>{if(pe==null){i(e(`finance.selectCostCenter`,`Please select a cost center`),`error`);return}let t=he.trim();if(!t){i(e(`finance.costCenterNameRequired`,`Cost center name is required`),`error`);return}try{l&&await lt.mutateAsync({costCenterId:pe,name:t}),u&&await ct.mutateAsync({costCenterId:pe,mode:_e,value:ye}),a.invalidateQueries({queryKey:[`finance`]}),i(e(`finance.costCenterUpdated`,`Cost center updated`)),ue(!1)}catch(t){i(t.message||e(`finance.costCenterUpdateFailed`,`Failed to update cost center`),`error`)}},xt=e=>{let t=(rt||[]).find(t=>t.id===e);t&&(me(t.id),ge(t.name),t.budget_mode===`total`?(ve(`total`),be(t.total_budget==null?``:String(t.total_budget))):(ve(`monthly`),be(t.monthly_budget==null?``:String(t.monthly_budget))),ue(!0))},St=async()=>{if(Ge)try{await ut.mutateAsync(Ge.id),a.invalidateQueries({queryKey:[`finance`]}),P===Ge.id&&F(null),i(e(`finance.costCenterDeleted`,`Cost center deleted`))}catch(t){i(t.message||e(`finance.costCenterDeleteFailed`,`Failed to delete cost center`),`error`)}finally{Ke(null)}},Ct=()=>{qe!=null&&dt.mutate(qe,{onSettled:()=>Je(null)})},wt=e=>{we(e.id),Ee(e.user_id),Oe(e.cost_center_id),Ae(String(e.amount)),Me(e.description||``),Se(!0)},Tt=async()=>{if(Ce==null)return;let t=ke?Number.parseFloat(ke):null;if(t!==null&&!Number.isFinite(t)){i(e(`finance.amountInvalid`,`Amount must be a valid number`),`error`);return}ft.mutate({transactionId:Ce,data:{user_id:Te||void 0,cost_center_id:De||void 0,amount:t??void 0,description:je||void 0}})},Et=async()=>{if(Fe==null){i(e(`finance.userRequired`,`Please select a user`),`error`);return}if(Le==null){i(e(`finance.costCenterRequired`,`Please select a cost center`),`error`);return}let t=ze?Number.parseFloat(ze):null;if(t===null||!Number.isFinite(t)){i(e(`finance.amountInvalid`,`Amount must be a valid number`),`error`);return}t=Math.abs(t),pt.mutate({user_id:Fe,cost_center_id:Le,amount:t,description:Ve||void 0,created_at:Ue?new Date(Ue).toISOString():void 0})},Dt=async()=>{if(w==null){i(e(`finance.userRequired`,`Please select a user`),`error`);return}let t=Number.parseFloat(O);if(!Number.isFinite(t)||t<=0){i(e(`finance.amountMustBePositive`,`Amount must be greater than zero`),`error`);return}let n={userId:w,amount:t,description:A.trim()||void 0,costCenterId:M};try{E===`deposit`?await mt.mutateAsync(n):await ht.mutateAsync(n),a.invalidateQueries({queryKey:[`finance`]}),k(``),j(``),i(E===`deposit`?e(`finance.depositSuccess`,`Deposit successful`):e(`finance.withdrawSuccess`,`Withdrawal successful`))}catch(t){i(t.message||e(`finance.adjustmentFailed`,`Wallet adjustment failed`),`error`)}},Ot=()=>{if(P==null){i(e(`finance.selectCostCenter`,`Please select a cost center`),`error`);return}if(I==null){i(e(`finance.noEligibleUsers`,`No eligible users available`),`error`);return}gt.mutate({costCenterId:P,userId:I,canPrint:R})},kt=e=>{P!=null&&_t.mutate({costCenterId:P,userId:e})},At=If(Qe?.currency||`USD`),jt=(0,f.useMemo)(()=>[...at||[]].sort((e,t)=>e.username.localeCompare(t.username)),[at]),Mt=(0,f.useMemo)(()=>{let e=new Map;for(let t of jt)e.set(t.id,t.username);return e},[jt]),Nt=(0,f.useMemo)(()=>{let e=new Set((ot?.members||[]).map(e=>e.user_id));return jt.filter(t=>!e.has(t.id))},[jt,ot]),Pt=de===`admin`&&s?tt:$e,Ft=de===`admin`&&s?nt:et,It=(0,f.useMemo)(()=>Pt?.items??[],[Pt?.items]),Lt=Pt?.total??0,Rt=Math.max(1,Math.ceil(Lt/50)),zt=(0,f.useMemo)(()=>It.filter(e=>!(ee!==`all`&&e.transaction_type!==ee||ne!==`all`&&e.cost_center_id!==ne)),[It,ee,ne]),Bt=Math.floor(B/50)+1,Vt=de===`admin`,Ht=t=>t===`deposit`?e(`finance.deposit`):t===`withdraw`?e(`finance.withdraw`):t===`print_charge`?e(`finance.printCharge`):t,Ut=t=>t==null?e(`finance.personal`,`Personal`):Mt.get(t)||(r?.id===t&&r.username?r.username:e(`finance.userWithId`,`User #{{id}}`,{id:t})),Wt=t=>t.budget_limit==null||t.budget_available==null?e(`finance.unlimited`,`Unlimited`):`${At}${t.budget_available.toFixed(2)}/${At}${t.budget_limit.toFixed(2)}`;return g?(0,G.jsxs)(`div`,{className:`p-4 md:p-8 space-y-8`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Gu,{className:`h-6 w-6 text-bambu-green`}),(0,G.jsx)(`h1`,{className:`text-2xl font-bold text-white`,children:e(`finance.title`,`Finance`)})]}),(0,G.jsx)(`p`,{className:`text-bambu-gray mt-2 max-w-2xl`,children:e(`finance.subtitle`,`Wallet, personal transactions, and cost centers`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1 max-w-2xl`,children:e(`finance.budgetPolicyHint`,`Account balances track costs. Printing is limited only by the selected cost center budget; without a budget, printing is unlimited.`)})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 lg:items-end`,children:[Ye&&(0,G.jsxs)(`div`,{className:`inline-flex overflow-hidden rounded border border-bambu-dark-tertiary`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>fe(`personal`),className:`px-3 py-1.5 text-sm ${de===`personal`?`bg-bambu-green text-black font-medium`:`bg-bambu-dark text-bambu-gray`}`,children:e(`finance.personalView`,`Personal view`)}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>fe(`admin`),className:`px-3 py-1.5 text-sm ${de===`admin`?`bg-bambu-green text-black font-medium`:`bg-bambu-dark text-bambu-gray`}`,children:e(`finance.adminView`,`Admin view`)})]}),de===`admin`&&Ye&&(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2 lg:justify-end`,children:[c&&(0,G.jsx)(Q,{size:`sm`,variant:`secondary`,onClick:()=>ae(!0),children:e(`finance.createCostCenter`,`Create cost center`)}),p&&m&&(0,G.jsx)(Q,{size:`sm`,variant:`secondary`,onClick:()=>se(!0),children:e(`finance.adjustWallet`,`Adjust wallet`)}),p&&m&&(0,G.jsx)(Q,{size:`sm`,variant:`secondary`,onClick:()=>Pe(!0),children:e(`finance.addManualPrint`,`Add manual print`)}),d&&m&&(0,G.jsx)(Q,{size:`sm`,variant:`secondary`,onClick:()=>ce(!0),children:e(`finance.manageMembers`,`Manage cost center members`)})]})]})]}),(0,G.jsxs)(`div`,{className:`grid gap-5 md:grid-cols-2 xl:grid-cols-3`,children:[(0,G.jsxs)(zd,{children:[(0,G.jsxs)(Bd,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e(`finance.currentBalance`,`Personal account balance`)}),(0,G.jsx)(Gu,{className:`w-4 h-4 text-bambu-green/90`})]}),(0,G.jsx)(Vd,{className:`pt-1`,children:(0,G.jsx)(`p`,{className:`text-3xl font-semibold text-white leading-tight`,children:Ze?e(`common.loading`,`Loading...`):`${At}${(Xe?.balance??0).toFixed(2)}`})})]}),(0,G.jsxs)(zd,{children:[(0,G.jsxs)(Bd,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:de===`admin`?e(`finance.transactions`,`Transactions`):e(`finance.personalTransactions`,`Personal transactions`)}),(0,G.jsx)(Cs,{className:`w-4 h-4 text-blue-400`})]}),(0,G.jsx)(Vd,{className:`pt-1`,children:(0,G.jsx)(`p`,{className:`text-3xl font-semibold text-white leading-tight`,children:Ft?`-`:Lt})})]}),(0,G.jsxs)(zd,{children:[(0,G.jsxs)(Bd,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e(`finance.costCenters`,`Cost centers`)}),(0,G.jsx)(Jo,{className:`w-4 h-4 text-orange-400`})]}),(0,G.jsx)(Vd,{className:`pt-1`,children:(0,G.jsx)(`p`,{className:`text-3xl font-semibold text-white leading-tight`,children:it?`-`:rt?.length??0})})]})]}),ie&&c&&(0,G.jsx)(e5,{title:e(`finance.createCostCenter`,`Create cost center`),size:`md`,onClose:()=>ae(!1),children:(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`finance.costCenterName`,`Name`)}),(0,G.jsx)(`input`,{type:`text`,value:v,onChange:e=>y(e.target.value),placeholder:e(`finance.costCenterName`,`Name`),className:X8})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`finance.budgetType`,`Budget type`)}),(0,G.jsxs)(`select`,{value:b,onChange:e=>x(e.target.value),className:X8,children:[(0,G.jsx)(`option`,{value:`monthly`,children:e(`finance.monthlyBudget`,`Monthly budget`)}),(0,G.jsx)(`option`,{value:`total`,children:e(`finance.totalBudget`,`Total budget`)})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:b===`monthly`?e(`finance.monthlyBudget`,`Monthly budget`):e(`finance.totalBudget`,`Total budget`)}),(0,G.jsx)(`input`,{type:`number`,step:`0.01`,value:S,onChange:e=>C(e.target.value),placeholder:`0.00`,className:X8})]})]}),(0,G.jsx)(Q,{className:`min-w-[180px]`,onClick:yt,disabled:st.isPending,children:st.isPending?e(`common.saving`,`Saving...`):e(`finance.create`,`Create`)})]})}),oe&&p&&m&&(0,G.jsx)(e5,{title:e(`finance.adjustWallet`,`Adjust wallet`),size:`md`,onClose:()=>se(!1),children:(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`finance.selectUser`,`Select user`)}),(0,G.jsx)(`select`,{value:w??``,onChange:e=>T(e.target.value?Number(e.target.value):null),className:X8,children:(jt||[]).map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.username},e.id))})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`finance.transactionType`,`Type`)}),(0,G.jsxs)(`select`,{value:E,onChange:e=>D(e.target.value),className:X8,children:[(0,G.jsx)(`option`,{value:`deposit`,children:e(`finance.deposit`,`Deposit`)}),(0,G.jsx)(`option`,{value:`withdraw`,children:e(`finance.withdraw`,`Withdraw`)})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`finance.amount`,`Amount`)}),(0,G.jsx)(`input`,{type:`number`,step:`0.01`,min:`0`,value:O,onChange:e=>k(e.target.value),placeholder:`0.00`,className:X8})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`finance.costCenters`,`Cost centers`)}),(0,G.jsxs)(`select`,{value:M??``,onChange:e=>N(e.target.value?Number(e.target.value):null),className:X8,children:[(0,G.jsx)(`option`,{value:``,children:e(`finance.noCostCenter`,`No cost center`)}),(rt||[]).map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`common.description`,`Description`)}),(0,G.jsx)(`input`,{type:`text`,value:A,onChange:e=>j(e.target.value),placeholder:e(`finance.descriptionOptional`,`Description (optional)`),className:X8})]}),(0,G.jsx)(Q,{className:`min-w-[180px]`,onClick:Dt,disabled:vt,children:vt?e(`common.saving`,`Saving...`):e(`finance.applyAdjustment`,`Apply adjustment`)})]})}),H&&d&&m&&(0,G.jsx)(e5,{title:e(`finance.manageMembers`,`Manage cost center members`),size:`lg`,onClose:()=>ce(!1),children:(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(`div`,{className:`grid gap-5 md:grid-cols-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`finance.costCenters`,`Cost centers`)}),(0,G.jsx)(`select`,{value:P??``,onChange:e=>F(e.target.value?Number(e.target.value):null),className:X8,children:(rt||[]).filter(e=>!e.is_private).map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`finance.selectUser`,`Select user`)}),(0,G.jsxs)(`select`,{value:I??``,onChange:e=>L(e.target.value?Number(e.target.value):null),className:X8,children:[(0,G.jsx)(`option`,{value:``,children:e(`finance.selectUser`,`Select user`)}),Nt.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.username},e.id))]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 rounded border border-bambu-dark-tertiary bg-bambu-dark-secondary px-3 py-2`,children:[(0,G.jsx)(`input`,{id:`memberCanPrint`,type:`checkbox`,checked:R,onChange:e=>z(e.target.checked),className:`rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green`}),(0,G.jsx)(`label`,{htmlFor:`memberCanPrint`,className:`text-sm text-bambu-gray`,children:e(`finance.memberCanPrint`,`Member can print`)})]}),(0,G.jsx)(`div`,{className:`flex items-end`,children:(0,G.jsx)(Q,{className:`min-w-[180px]`,onClick:Ot,disabled:gt.isPending||I==null,children:gt.isPending?e(`common.saving`,`Saving...`):e(`finance.addMember`,`Add member`)})})]}),(0,G.jsx)(`div`,{className:`overflow-auto rounded-lg border border-bambu-dark-tertiary`,children:(0,G.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary bg-bambu-dark text-bambu-gray`,children:[(0,G.jsx)(`th`,{className:Q8,children:e(`common.name`,`Name`)}),(0,G.jsx)(`th`,{className:Q8,children:e(`finance.canPrint`,`Can print`)}),(0,G.jsx)(`th`,{className:Q8,children:e(`common.actions`,`Actions`)})]})}),(0,G.jsxs)(`tbody`,{children:[(ot?.members||[]).map(t=>(0,G.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary/60 text-white`,children:[(0,G.jsx)(`td`,{className:$8,children:jt.find(e=>e.id===t.user_id)?.username||`User ${t.user_id}`}),(0,G.jsx)(`td`,{className:$8,children:t.can_print?e(`common.yes`,`Yes`):e(`common.no`,`No`)}),(0,G.jsx)(`td`,{className:$8,children:(0,G.jsx)(Q,{size:`sm`,variant:`danger`,onClick:()=>kt(t.user_id),disabled:_t.isPending,children:e(`common.remove`,`Remove`)})})]},t.id)),(ot?.members||[]).length===0&&(0,G.jsx)(`tr`,{children:(0,G.jsx)(`td`,{colSpan:3,className:`py-3 text-bambu-gray`,children:e(`finance.noMembers`,`No members assigned.`)})})]})]})})]})}),le&&(l||u)&&(0,G.jsx)(e5,{title:e(`finance.editCostCenter`,`Edit cost center`),size:`md`,onClose:()=>ue(!1),children:(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`finance.costCenterName`,`Name`)}),(0,G.jsx)(`input`,{type:`text`,value:he,onChange:e=>ge(e.target.value),placeholder:e(`finance.costCenterName`,`Name`),className:X8,disabled:!l})]}),(0,G.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`finance.budgetType`,`Budget type`)}),(0,G.jsxs)(`select`,{value:_e,onChange:e=>ve(e.target.value),className:X8,disabled:!u,children:[(0,G.jsx)(`option`,{value:`monthly`,children:e(`finance.monthlyBudget`,`Monthly budget`)}),(0,G.jsx)(`option`,{value:`total`,children:e(`finance.totalBudget`,`Total budget`)})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:_e===`monthly`?e(`finance.monthlyBudget`,`Monthly budget`):e(`finance.totalBudget`,`Total budget`)}),(0,G.jsx)(`input`,{type:`number`,step:`0.01`,value:ye,onChange:e=>be(e.target.value),placeholder:`0.00`,className:X8,disabled:!u})]})]}),(0,G.jsx)(Q,{className:`min-w-[180px]`,onClick:bt,disabled:lt.isPending||ct.isPending||pe==null,children:lt.isPending||ct.isPending?e(`common.saving`,`Saving...`):e(`common.save`,`Save`)})]})}),(0,G.jsxs)(`div`,{className:`grid gap-6 ${_&&o?`xl:grid-cols-2`:``}`,children:[_&&(0,G.jsxs)(zd,{children:[(0,G.jsxs)(Bd,{children:[(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:e(`finance.myCostCenters`,`My cost centers`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:e(`finance.costCentersHint`,`Review budget limits and keep costs under control`)})]}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[it&&(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`common.loading`,`Loading...`)}),!it&&(!rt||rt.length===0)&&(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`finance.noCostCenters`,`No cost centers found.`)}),!it&&rt&&rt.length>0&&(0,G.jsx)(`div`,{className:`overflow-auto rounded-lg border border-bambu-dark-tertiary`,children:(0,G.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary bg-bambu-dark text-bambu-gray`,children:[(0,G.jsx)(`th`,{className:Q8,children:e(`common.name`,`Name`)}),Vt&&(0,G.jsx)(`th`,{className:Q8,children:e(`finance.owner`,`Owner`)}),(0,G.jsx)(`th`,{className:Q8,children:e(`finance.balance`,`Account balance`)}),(0,G.jsx)(`th`,{className:Q8,children:e(`finance.budget`,`Budget`)}),Vt&&(0,G.jsx)(`th`,{className:Q8,children:e(`common.actions`,`Actions`)})]})}),(0,G.jsx)(`tbody`,{children:rt.map(t=>{let n=l||u,r=!t.is_private&&l;return(0,G.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary/60 text-white`,children:[(0,G.jsx)(`td`,{className:$8,children:t.name}),Vt&&(0,G.jsx)(`td`,{className:$8,children:t.is_private?Ut(t.owner_user_id):e(`finance.shared`,`Shared`)}),(0,G.jsxs)(`td`,{className:$8,children:[At,t.total_balance.toFixed(2)]}),(0,G.jsx)(`td`,{className:$8,children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,G.jsx)(`span`,{children:Wt(t)}),(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:t.budget_mode===`monthly`?e(`finance.monthlyBudget`,`Monthly budget`):t.budget_mode===`total`?e(`finance.totalBudget`,`Total budget`):e(`finance.noBudget`,`No budget`)})]})}),Vt&&(0,G.jsx)(`td`,{className:$8,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Q,{size:`sm`,variant:`ghost`,onClick:()=>xt(t.id),disabled:!n,title:n?e(`common.edit`,`Edit`):e(`finance.cannotEditPrivateCostCenter`,`Private cost centers cannot be edited here`),className:`p-1.5 sm:p-2`,children:(0,G.jsx)(wl,{className:`w-4 h-4`})}),r&&(0,G.jsx)(Q,{size:`sm`,variant:`ghost`,onClick:()=>Ke({id:t.id,name:t.name}),disabled:ut.isPending,title:e(`common.delete`,`Delete`),className:`text-red-400 hover:text-red-300 hover:bg-red-500/10 p-1.5 sm:p-2`,children:(0,G.jsx)(ju,{className:`w-4 h-4`})})]})})]},t.id)})})]})})]})]}),o&&(0,G.jsxs)(zd,{children:[(0,G.jsxs)(Bd,{children:[(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:e(`finance.recentTransactions`,`Recent transactions`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:e(`finance.transactionsHint`,`Filter by type and cost center, then navigate pages`)})]}),(0,G.jsxs)(Vd,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto] xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_auto] items-end`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`finance.transactionType`,`Type`)}),(0,G.jsxs)(`select`,{value:ee,onChange:e=>te(e.target.value),className:X8,children:[(0,G.jsx)(`option`,{value:`all`,children:e(`finance.allTypes`)}),(0,G.jsx)(`option`,{value:`deposit`,children:e(`finance.deposit`)}),(0,G.jsx)(`option`,{value:`withdraw`,children:e(`finance.withdraw`)}),(0,G.jsx)(`option`,{value:`print_charge`,children:e(`finance.printCharge`)})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`finance.costCenters`,`Cost centers`)}),(0,G.jsxs)(`select`,{value:ne,onChange:e=>re(e.target.value===`all`?`all`:Number(e.target.value)),className:X8,children:[(0,G.jsx)(`option`,{value:`all`,children:e(`finance.allCostCenters`)}),(rt||[]).map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]})]}),Ft&&(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`common.loading`,`Loading...`)}),!Ft&&(!It||It.length===0)&&(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`finance.noTransactions`,`No transactions available.`)}),!Ft&&It.length>0&&zt.length===0&&(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`finance.noTransactionsForFilter`,`No transactions match the selected filters.`)}),!Ft&&zt.length>0&&(0,G.jsx)(`div`,{className:`overflow-auto rounded-lg border border-bambu-dark-tertiary`,children:(0,G.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary bg-bambu-dark text-bambu-gray`,children:[(0,G.jsx)(`th`,{className:Q8,children:e(`common.date`,`Date`)}),Vt&&(0,G.jsx)(`th`,{className:Q8,children:e(`common.user`,`User`)}),(0,G.jsx)(`th`,{className:Q8,children:e(`finance.costCenter`,`Cost center`)}),(0,G.jsx)(`th`,{className:Q8,children:e(`finance.transactionType`,`Type`)}),(0,G.jsx)(`th`,{className:Q8,children:e(`common.description`,`Description`)}),(0,G.jsx)(`th`,{className:Q8,children:e(`finance.amount`,`Amount`)}),(0,G.jsx)(`th`,{className:Q8,children:e(`finance.balanceAfter`,`Balance after`)}),Vt&&(0,G.jsx)(`th`,{className:Q8,children:e(`common.actions`,`Actions`)})]})}),(0,G.jsx)(`tbody`,{children:zt.map(n=>{let r=n.amount>=0,i=n.cost_center_id==null?null:(rt||[]).find(e=>e.id===n.cost_center_id),a=Mt.get(n.user_id),o=n.transaction_type===`print_charge`?UKe(n.description??null):null,s=o?.isPartial??!1;return(0,G.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary/60 text-white`,children:[(0,G.jsx)(`td`,{className:$8,children:WKe(n.created_at,t.language)}),Vt&&(0,G.jsx)(`td`,{className:$8,children:a||e(`finance.userWithId`,`User #{{id}}`,{id:n.user_id})}),(0,G.jsx)(`td`,{className:$8,children:i?.name||`-`}),(0,G.jsx)(`td`,{className:$8,children:(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,G.jsx)(`span`,{children:Ht(n.transaction_type)}),s&&(0,G.jsx)(`span`,{className:`rounded border border-yellow-500/40 bg-yellow-500/10 px-2 py-0.5 text-[11px] text-yellow-300`,children:o&&o.partialType?e(`finance.partialStatus.${o.partialType}`,o.partialType):e(`finance.partial`,`Partial`)})]})}),(0,G.jsx)(`td`,{className:$8,children:(o?.cleanedDescription??n.description)||`-`}),(0,G.jsxs)(`td`,{className:`${$8} ${r?`text-green-400`:`text-red-400`}`,children:[r?`+`:`-`,At,Math.abs(n.amount).toFixed(2)]}),(0,G.jsx)(`td`,{className:$8,children:n.balance_after==null?`-`:`${n.balance_after<0?`-`:``}${At}${Math.abs(n.balance_after).toFixed(2)}`}),Vt&&(0,G.jsx)(`td`,{className:$8,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Q,{size:`sm`,variant:`secondary`,onClick:()=>wt(n),disabled:ft.isPending,children:(0,G.jsx)(wl,{className:`w-4 h-4`})}),(0,G.jsx)(Q,{size:`sm`,variant:`danger`,onClick:()=>Je(n.id),disabled:dt.isPending,children:(0,G.jsx)(ju,{className:`w-4 h-4`})})]})})]},n.id)})})]})}),!Ft&&zt.length>0&&(0,G.jsx)(`div`,{className:`flex justify-end pt-2 lg:pt-0`,children:(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>V(0),disabled:B===0||Ft,className:`p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,"aria-label":e(`finance.first`,`First`),children:(0,G.jsx)(us,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>V(e=>Math.max(0,e-50)),disabled:B===0||Ft,className:`p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,"aria-label":e(`finance.prev`,`Previous`),children:(0,G.jsx)(cs,{className:`w-4 h-4`})}),(0,G.jsx)(`span`,{className:`text-bambu-gray px-1 whitespace-nowrap`,children:e(`finance.pageNumberOf`,`Page {{page}} of {{total}}`,{page:Bt,total:Rt})}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>V(e=>e+50),disabled:Ft||Bt>=Rt,className:`p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,"aria-label":e(`finance.next`,`Next`),children:(0,G.jsx)(ss,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>V(Math.max(0,(Rt-1)*50)),disabled:Ft||Bt>=Rt,className:`p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,"aria-label":e(`finance.last`,`Last`),children:(0,G.jsx)(ds,{className:`w-4 h-4`})})]})})]})]}),xe&&Ce!==null&&(0,G.jsx)(e5,{title:e(`finance.editTransaction`,`Edit Transaction`),onClose:()=>Se(!1),size:`md`,children:(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`common.user`,`User`)}),(0,G.jsxs)(`select`,{className:X8,value:Te||``,onChange:e=>Ee(e.target.value?Number(e.target.value):null),children:[(0,G.jsx)(`option`,{value:``,children:e(`finance.selectUser`,`Select user...`)}),jt.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.username},e.id))]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`finance.costCenter`,`Cost center (optional)`)}),(0,G.jsxs)(`select`,{className:X8,value:De||``,onChange:e=>Oe(e.target.value?Number(e.target.value):null),children:[(0,G.jsx)(`option`,{value:``,children:e(`finance.noCostCenter`,`Personal (no cost center)`)}),(rt||[]).map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`finance.amount`,`Amount`)}),(0,G.jsx)(`input`,{type:`number`,step:`0.01`,className:X8,value:ke,onChange:e=>Ae(e.target.value),placeholder:e(`finance.amountExample`,`e.g., 10.50`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`common.description`,`Description`)}),(0,G.jsx)(`textarea`,{className:`${X8} resize-none`,rows:3,value:je,onChange:e=>Me(e.target.value),placeholder:e(`finance.manualAdjustmentExample`,`e.g., Manual adjustment`)})]}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-2 pt-4`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>Se(!1),children:e(`common.cancel`,`Cancel`)}),(0,G.jsx)(Q,{onClick:Tt,disabled:ft.isPending,children:e(`common.save`,`Save`)})]})]})}),Ne&&(0,G.jsx)(e5,{title:e(`finance.addManualPrint`,`Add manual print`),onClose:()=>Pe(!1),size:`md`,children:(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`common.user`,`User`)}),(0,G.jsxs)(`select`,{className:X8,value:Fe||``,onChange:e=>Ie(e.target.value?Number(e.target.value):null),children:[(0,G.jsx)(`option`,{value:``,children:e(`finance.selectUser`,`Select user...`)}),jt.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.username},e.id))]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`finance.costCenter`,`Cost center`)}),(0,G.jsxs)(`select`,{className:X8,value:Le||``,onChange:e=>Re(e.target.value?Number(e.target.value):null),children:[(0,G.jsx)(`option`,{value:``,children:e(`finance.selectCostCenter`,`Select cost center...`)}),(rt||[]).map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`finance.amount`,`Amount`)}),(0,G.jsx)(`input`,{type:`number`,step:`0.01`,className:X8,value:ze,onChange:e=>Be(e.target.value),placeholder:e(`finance.amountExample`,`e.g., 4.00`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`common.description`,`Description`)}),(0,G.jsx)(`input`,{type:`text`,value:Ve,onChange:e=>He(e.target.value),placeholder:e(`finance.descriptionOptional`,`Description (optional)`),className:X8})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`common.date`,`Date`)}),(0,G.jsx)(`input`,{type:`datetime-local`,value:Ue,onChange:e=>We(e.target.value),className:X8})]}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-2 pt-4`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>Pe(!1),children:e(`common.cancel`,`Cancel`)}),(0,G.jsx)(Q,{onClick:Et,disabled:pt.isPending,children:pt.isPending?e(`common.saving`,`Saving...`):e(`finance.addManualPrint`,`Add manual print`)})]})]})}),Ge&&(0,G.jsx)(af,{title:e(`common.delete`,`Delete`),message:e(`finance.confirmDeleteCostCenter`,`Delete cost center "{{name}}"?`,{name:Ge.name}),confirmText:e(`common.delete`,`Delete`),variant:`danger`,isLoading:ut.isPending,onConfirm:St,onCancel:()=>Ke(null)}),qe!=null&&(0,G.jsx)(af,{title:e(`finance.deleteTransaction`,`Delete transaction`),message:e(`finance.deleteTransactionConfirm`,`Delete this transaction? Balances will be recalculated automatically.`),confirmText:e(`common.delete`,`Delete`),variant:`danger`,isLoading:dt.isPending,onConfirm:Ct,onCancel:()=>Je(null)})]})]}):(0,G.jsxs)(`div`,{className:`p-4 md:p-8 space-y-6`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Gu,{className:`h-6 w-6 text-bambu-green`}),(0,G.jsx)(`h1`,{className:`text-2xl font-bold text-white`,children:e(`finance.title`,`Finance`)})]}),(0,G.jsx)(`div`,{children:(0,G.jsx)(`p`,{className:`text-bambu-gray mt-2 max-w-2xl`,children:e(`finance.subtitle`,`Wallet, personal transactions, and cost centers`)})}),(0,G.jsx)(zd,{children:(0,G.jsx)(Vd,{className:`py-8 text-center text-bambu-gray`,children:e(`finance.noAccess`,`You do not have permission to view finance data.`)})})]})}var t5={PLA:`GFL99`,"PLA-CF":`GFL98`,"PLA SILK":`GFL96`,"PLA HIGH SPEED":`GFL95`,PETG:`GFG99`,"PETG HF":`GFG96`,"PETG-CF":`GFG98`,PCTG:`GFG97`,ABS:`GFB99`,ASA:`GFB98`,PC:`GFC99`,PA:`GFN99`,"PA-CF":`GFN98`,NYLON:`GFN99`,TPU:`GFU99`,PVA:`GFS99`,HIPS:`GFS98`,PE:`GFP99`,PP:`GFP97`};function n5(e){let t=(e||``).toUpperCase().trim();return t&&(t5[t]||t5[t.replace(/[-\s]?CF$/,``)]||t5[t.replace(/\+$/,``)]||t5[t.split(/[-\s]/)[0]])||``}function r5(e){let t=e.replace(/@.+$/,``).trim();return t.startsWith(`# `)?t.slice(2).trim():t}var i5={local:0,orca_cloud:1,cloud:2,builtin:3};function KKe(e){let{localPresets:t,orcaProfiles:n,cloudSettings:r,builtinFilaments:i}=e,a=[],o=e=>e.trim().toLowerCase(),s=new Set,c=new Set,l=new Set,u=(e,t,...n)=>{let r=n.filter(e=>!!e);if(r.some(e=>s.has(e)))return!1;let i=`${e}|${o(t)}`;return c.has(i)?!1:(r.forEach(e=>s.add(e)),c.add(i),l.add(o(t)),!0)};for(let e of t??[]){let t=r5(e.name),n=e.filament_type||mU(t).material;u(`local`,t)&&a.push({id:`local_${e.id}`,name:t,source:`local`,filamentId:n5(n),filamentType:n||``})}for(let e of n??[]){let t=r5(e.name),n=mU(t).material;u(`orca_cloud`,t,e.setting_id)&&a.push({id:`orca_${e.setting_id}`,name:t,source:`orca_cloud`,filamentId:n5(n),filamentType:n})}for(let e of r??[]){let t=r5(e.name),n=e.setting_id.startsWith(`GFS`)?SU(e.setting_id):``;u(`cloud`,t,e.setting_id,n||void 0)&&a.push({id:e.setting_id,name:t,source:`cloud`,filamentId:n,filamentType:mU(t).material})}for(let e of i??[]){let t=e.filament_id.startsWith(`GF`)?`GFS${e.filament_id.slice(2)}`:e.filament_id;l.has(o(e.name))||u(`builtin`,e.name,e.filament_id,t)&&a.push({id:`builtin_${e.filament_id}`,name:e.name,source:`builtin`,filamentId:e.filament_id,filamentType:mU(e.name).material})}return a.sort((e,t)=>e.source===t.source?e.name.localeCompare(t.name):i5[e.source]-i5[t.source])}async function qKe(e,t){if(e.filamentId)return e.filamentId;if(e.source!==`cloud`||!t)return``;try{return(await t(e.id)).filament_id||``}catch{return``}}var a5=e=>(Math.trunc(parseFloat(e)*1e3)/1e3).toFixed(3),o5=`HS00`,s5=`HH00`,c5=e=>{let t=e.match(/^([A-Z]{2}\d{2})/);return t?t[1]:o5},JKe=e=>c5(e)===s5?`HF`:`S`,l5=e=>{for(let t of[`High Flow_`,`High Flow `,`Standard_`,`Standard `,`HF_`,`HF `,`S_`,`S `])if(e.startsWith(t))return e.slice(t.length);let t=e.indexOf(`_`);return t>0?e.slice(t+1):e};function u5({profile:e,onEdit:t,onCopy:n,selectionMode:r,isSelected:i,onToggleSelect:a,note:o}){let s=JKe(e.nozzle_id),c=e.nozzle_diameter;return(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[r&&(0,G.jsx)(`button`,{onClick:a,className:`text-bambu-gray hover:text-white transition-colors p-1`,children:i?(0,G.jsx)(fu,{className:`w-4 h-4 text-bambu-green`}):(0,G.jsx)(mu,{className:`w-4 h-4`})}),(0,G.jsxs)(`button`,{onClick:()=>{r&&a?a():t()},className:`flex-1 text-left px-3 py-2 bg-bambu-dark rounded hover:bg-bambu-dark-tertiary transition-colors ${i?`ring-1 ring-bambu-green`:``}`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-bambu-green font-mono text-sm font-bold whitespace-nowrap`,children:a5(e.k_value)}),(0,G.jsx)(`span`,{className:`text-white text-sm truncate flex-1`,title:e.name,children:e.name||`Unnamed`}),o&&(0,G.jsx)(`span`,{title:`Has note`,children:(0,G.jsx)(_u,{className:`w-3 h-3 text-yellow-500`})}),(0,G.jsxs)(`span`,{className:`text-xs text-bambu-gray whitespace-nowrap`,children:[s,` `,c]})]}),o&&(0,G.jsxs)(`div`,{className:`text-xs mt-0.5 truncate text-yellow-500/70`,title:o,children:[`Note: `,o.length>50?o.substring(0,50)+`...`:o]})]}),!r&&n&&(0,G.jsx)(`button`,{onClick:e=>{e.stopPropagation(),n()},className:`text-bambu-gray hover:text-white transition-colors p-1`,title:`Copy profile`,children:(0,G.jsx)(Ps,{className:`w-4 h-4`})})]})}function d5({profile:e,printerId:t,nozzleDiameter:n,existingProfiles:r=[],builtinFilaments:i=[],filamentPresets:a=[],isDualNozzle:o=!1,supportsFlowType:s=!0,initialNote:c=``,initialNoteKey:l=null,onClose:u,onSave:d,onSaveNote:p,hasPermission:m}){let{t:h}=U(),{showToast:g}=qd(),[_,v]=(0,f.useState)(e?.name||``),[y,b]=(0,f.useState)(e?.k_value?a5(e.k_value):`0.020`),[x,S]=(0,f.useState)(e?.filament_id||``),[C,w]=(0,f.useState)(e?c5(e.nozzle_id):o5),[T,E]=(0,f.useState)(e?.nozzle_diameter||n),[D,O]=(0,f.useState)(e?[e.extruder_id]:o?[0,1]:[0]),[k,A]=(0,f.useState)(!1),[j,M]=(0,f.useState)({current:0,total:0}),[N,P]=(0,f.useState)(c),[F,I]=(0,f.useState)(``),{schedule:L}=DU(),R=f.useMemo(()=>e?.filament_id?i.find(t=>t.filament_id===e.filament_id)?.name||l5(r.find(t=>t.filament_id===e.filament_id)?.name||e.name||``)||e.filament_id:``,[e,r,i]),z=f.useMemo(()=>{let e=[[`local`,h(`kProfiles.modal.source.local`)],[`orca_cloud`,h(`kProfiles.modal.source.orcaCloud`)],[`cloud`,h(`kProfiles.modal.source.bambuCloud`)],[`builtin`,h(`kProfiles.modal.source.builtin`)]],t=F.trim().toLowerCase(),n=t?a.filter(e=>e.name.toLowerCase().includes(t)):a;return e.map(([e,t])=>({source:e,label:t,items:n.filter(t=>t.source===e)})).filter(e=>e.items.length>0)},[a,F,h]),B=q({mutationFn:e=>(console.log(`[KProfile] Calling API...`),Z.setKProfile(t,e)),onSuccess:(t,n)=>{if(console.log(`[KProfile] Save success:`,t),g(h(`kProfiles.toast.profileSaved`)),p&&N!==c){let t;t=N===``&&l?l:e&&e.slot_id>0?e.setting_id||`slot_${e.slot_id}_${e.filament_id}_${e.extruder_id}`:`name_${_}_${n.filament_id}`,p(t,N)}A(!0),L(()=>{A(!1),d()},2500)},onError:e=>{console.error(`[KProfile] Save error:`,e),g(e.message,`error`),A(!1)}}),V=q({mutationFn:e=>(console.log(`[KProfile] Deleting profile...`),Z.deleteKProfile(t,e)),onSuccess:e=>{console.log(`[KProfile] Delete success:`,e),g(h(`kProfiles.toast.profileDeleted`)),A(!0),L(()=>{A(!1),u()},4e3)},onError:e=>{console.error(`[KProfile] Delete error:`,e),g(e.message,`error`),A(!1)}}),[ee,te]=(0,f.useState)(!1),ne=()=>{e&&V.mutate({slot_id:e.slot_id,extruder_id:e.extruder_id,nozzle_id:e.nozzle_id,nozzle_diameter:e.nozzle_diameter,filament_id:e.filament_id,setting_id:e.setting_id})};return(0,G.jsxs)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,children:[(0,G.jsxs)(zd,{className:`w-full max-w-md relative`,children:[k&&(0,G.jsxs)(`div`,{className:`absolute inset-0 bg-bambu-dark-secondary/90 flex flex-col items-center justify-center z-10 rounded-lg`,children:[(0,G.jsx)(Y,{className:`w-8 h-8 text-bambu-green animate-spin mb-3`}),(0,G.jsx)(`p`,{className:`text-white font-medium`,children:j.total>1?h(`kProfiles.modal.savingExtruder`,{current:j.current,total:j.total}):h(`kProfiles.modal.syncing`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-sm mt-1`,children:h(`kProfiles.modal.pleaseWait`)})]}),(0,G.jsxs)(Vd,{className:`p-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-bambu-dark-tertiary`,children:[(0,G.jsx)(`h2`,{className:`text-xl font-semibold text-white`,children:h(e?`kProfiles.modal.editTitle`:`kProfiles.modal.addTitle`)}),(0,G.jsx)(`button`,{onClick:u,className:`text-bambu-gray hover:text-white transition-colors`,disabled:k,children:(0,G.jsx)($u,{className:`w-5 h-5`})})]}),(0,G.jsxs)(`form`,{onSubmit:async n=>{if(n.preventDefault(),o&&!e&&D.length===0){g(h(`kProfiles.toast.selectAtLeastOneExtruder`),`error`);return}let r=parseFloat(y).toFixed(6),i=`${C}-${T}`,s=e&&e.nozzle_id||i,c=e?e.nozzle_diameter:T,l=e?.filament_id||``;if(!e){let e=a.find(e=>e.id===x);if(!e){g(h(`kProfiles.toast.selectFilament`),`error`);return}if(l=await qKe(e,Z.getCloudSettingDetail),!l){g(h(`kProfiles.toast.filamentNotResolvable`,{name:e.name}),`error`);return}}if(e||D.length===1){let t={name:_,k_value:r,filament_id:l,nozzle_id:s,nozzle_diameter:c,extruder_id:e?e.extruder_id:D[0],setting_id:e?.setting_id,slot_id:e?.slot_id??0};console.log(`[KProfile] Saving profile:`,t),B.mutate(t);return}A(!0),M({current:1,total:D.length});let u=D.map(e=>({name:_,k_value:r,filament_id:l,nozzle_id:i,nozzle_diameter:T,extruder_id:e,setting_id:void 0,slot_id:0}));console.log(`[KProfile] Saving ${u.length} profiles in batch:`,u);try{await Z.setKProfilesBatch(t,u),g(h(`kProfiles.toast.profilesSaved`,{count:D.length})),p&&N&&p(`name_${_}_${l}`,N)}catch(e){console.error(`[KProfile] Failed to save batch:`,e),g(h(`kProfiles.toast.failedToSaveBatch`),`error`),A(!1),M({current:0,total:0});return}M({current:D.length,total:D.length}),L(()=>{A(!1),M({current:0,total:0}),d()},3e3)},className:`p-4 space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:h(`kProfiles.modal.profileName`)}),(0,G.jsx)(`input`,{type:`text`,value:_,onChange:e=>v(e.target.value),disabled:!!e,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none ${e?`opacity-60 cursor-not-allowed`:``}`,placeholder:h(`kProfiles.modal.profileNamePlaceholder`),required:!e})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:h(`kProfiles.modal.kValue`)}),(0,G.jsx)(`input`,{type:`text`,inputMode:`decimal`,value:y,onChange:e=>{let t=e.target.value;(t===``||/^\d*\.?\d*$/.test(t))&&b(t)},onBlur:e=>{let t=parseFloat(e.target.value);isNaN(t)||b((Math.trunc(t*1e3)/1e3).toFixed(3))},className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none font-mono`,placeholder:h(`kProfiles.modal.kValuePlaceholder`),required:!0}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:h(`kProfiles.modal.kValueHelp`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:h(`kProfiles.modal.filament`)}),e?(0,G.jsx)(`div`,{className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white opacity-60`,children:R||e.filament_id}):(0,G.jsxs)(`div`,{className:`border border-bambu-dark-tertiary rounded-lg overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`relative border-b border-bambu-dark-tertiary`,children:[(0,G.jsx)(Kl,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray`}),(0,G.jsx)(`input`,{type:`text`,value:F,onChange:e=>I(e.target.value),placeholder:h(`kProfiles.modal.searchFilaments`),className:`w-full pl-10 pr-3 py-2 bg-bambu-dark text-white placeholder-bambu-gray focus:outline-none`})]}),(0,G.jsx)(`div`,{className:`max-h-56 overflow-y-auto bg-bambu-dark`,children:z.length===0?(0,G.jsx)(`p`,{className:`px-3 py-3 text-xs text-bambu-gray`,children:a.length===0?h(`kProfiles.modal.noFilamentsHelp`):h(`kProfiles.modal.noFilamentMatches`)}):z.map(e=>(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`sticky top-0 z-10 flex items-center gap-2 px-3 py-1.5 bg-bambu-dark-secondary border-y border-bambu-dark-tertiary`,children:[(0,G.jsx)(`span`,{className:`text-xs font-bold uppercase tracking-wider text-bambu-green`,children:e.label}),(0,G.jsx)(`span`,{className:`text-[10px] text-bambu-gray`,children:e.items.length})]}),e.items.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>{S(e.id),_||v(`${C===s5?`HF`:`S`} ${e.name}`)},className:`w-full text-left px-3 py-1.5 text-sm transition-colors ${x===e.id?`bg-bambu-green/20 text-white`:`text-white hover:bg-bambu-dark-tertiary`}`,children:e.name},e.id))]},e.source))})]})]}),(0,G.jsxs)(`div`,{className:s?`grid grid-cols-2 gap-4`:``,children:[(0,G.jsxs)(`div`,{className:s?``:`hidden`,children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:h(`kProfiles.modal.flowType`)}),(0,G.jsxs)(`select`,{value:C,onChange:t=>{let n=t.target.value;if(w(n),!e&&x&&!_){let e=a.find(e=>e.id===x);e&&v(`${n===s5?`HF`:`S`} ${e.name}`)}},disabled:!!e,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none ${e?`opacity-60 cursor-not-allowed`:``}`,children:[(0,G.jsx)(`option`,{value:s5,children:h(`kProfiles.modal.highFlow`)}),(0,G.jsx)(`option`,{value:o5,children:h(`kProfiles.modal.standard`)})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:h(`kProfiles.modal.nozzleSize`)}),(0,G.jsxs)(`select`,{value:T,onChange:e=>E(e.target.value),disabled:!!e,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none ${e?`opacity-60 cursor-not-allowed`:``}`,children:[(0,G.jsx)(`option`,{value:`0.2`,children:`0.2mm`}),(0,G.jsx)(`option`,{value:`0.4`,children:`0.4mm`}),(0,G.jsx)(`option`,{value:`0.6`,children:`0.6mm`}),(0,G.jsx)(`option`,{value:`0.8`,children:`0.8mm`})]})]})]}),o&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:h(e?`kProfiles.modal.extruder`:`kProfiles.modal.extruders`)}),e?(0,G.jsx)(`div`,{className:`px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white opacity-60`,children:e.extruder_id===1?h(`kProfiles.modal.left`):h(`kProfiles.modal.right`)}):(0,G.jsxs)(`div`,{className:`flex gap-4`,children:[(0,G.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:D.includes(1),onChange:e=>{e.target.checked?O([...D,1]):O(D.filter(e=>e!==1))},className:`w-4 h-4 rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green focus:ring-offset-0 accent-bambu-green`}),(0,G.jsx)(`span`,{className:`text-white`,children:h(`kProfiles.modal.left`)})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:D.includes(0),onChange:e=>{e.target.checked?O([...D,0]):O(D.filter(e=>e!==0))},className:`w-4 h-4 rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green focus:ring-offset-0 accent-bambu-green`}),(0,G.jsx)(`span`,{className:`text-white`,children:h(`kProfiles.modal.right`)})]})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:h(`kProfiles.modal.notes`)}),(0,G.jsx)(`textarea`,{value:N,onChange:e=>P(e.target.value),placeholder:h(`kProfiles.modal.notesPlaceholder`),rows:2,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none resize-none`}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:h(`kProfiles.modal.notesHelp`)})]}),(0,G.jsxs)(`div`,{className:`flex gap-2 pt-4`,children:[e&&(0,G.jsx)(Q,{type:`button`,variant:`secondary`,onClick:()=>te(!0),disabled:V.isPending||k||!m(`kprofiles:delete`),title:m(`kprofiles:delete`)?void 0:h(`kProfiles.permission.noDelete`),className:`text-red-500 hover:bg-red-500/10`,children:V.isPending?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(ju,{className:`w-4 h-4`})}),(0,G.jsx)(Q,{type:`button`,variant:`secondary`,onClick:u,disabled:k,className:`flex-1`,children:h(`common.cancel`)}),(0,G.jsxs)(Q,{type:`submit`,disabled:B.isPending||k||!m(e?`kprofiles:update`:`kprofiles:create`),title:m(e?`kprofiles:update`:`kprofiles:create`)?void 0:h(e?`kProfiles.permission.noUpdate`:`kProfiles.permission.noCreate`),className:`flex-1`,children:[B.isPending?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(vc,{className:`w-4 h-4`}),h(`common.save`)]})]})]})]})]}),ee&&(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-[60]`,children:(0,G.jsx)(zd,{className:`w-full max-w-sm`,children:(0,G.jsxs)(Vd,{className:`p-6`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 mb-4`,children:[(0,G.jsx)(`div`,{className:`w-10 h-10 rounded-full bg-red-500/20 flex items-center justify-center`,children:(0,G.jsx)(ju,{className:`w-5 h-5 text-red-500`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:h(`kProfiles.deleteConfirm.title`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:h(`kProfiles.deleteConfirm.cannotUndo`)})]})]}),(0,G.jsx)(`p`,{className:`text-bambu-gray mb-6`,children:h(`kProfiles.deleteConfirm.message`,{name:e?.name})}),(0,G.jsxs)(`div`,{className:`flex gap-3`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>te(!1),className:`flex-1`,children:h(`common.cancel`)}),(0,G.jsxs)(Q,{onClick:()=>{te(!1),ne()},disabled:V.isPending,className:`flex-1 bg-red-500 hover:bg-red-600 text-white`,children:[V.isPending?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(ju,{className:`w-4 h-4`}),h(`common.delete`)]})]})]})})})]})}var f5={NOZZLE_DIAMETER:`bambusy_kprofiles_nozzle`,SORT_OPTION:`bambusy_kprofiles_sort`};function YKe(){let{t:e}=U(),{showToast:t}=qd(),{hasPermission:n}=Nd(),[r,i]=(0,f.useState)(null),[a,o]=(0,f.useState)(()=>localStorage.getItem(f5.NOZZLE_DIAMETER)||`0.4`),[s,c]=(0,f.useState)(null),[l,u]=(0,f.useState)(!1),[d,p]=(0,f.useState)(null),[m,h]=(0,f.useState)(``),[g,_]=(0,f.useState)(`all`),[v,y]=(0,f.useState)(`all`),[b,x]=(0,f.useState)(()=>localStorage.getItem(f5.SORT_OPTION)||`name`),[S,C]=(0,f.useState)(!1),[w,T]=(0,f.useState)(new Set),[E,D]=(0,f.useState)(!1),[O,k]=(0,f.useState)(!1),A=(0,f.useCallback)(e=>`${e.slot_id}_${e.extruder_id}`,[]);(0,f.useEffect)(()=>{localStorage.setItem(f5.NOZZLE_DIAMETER,a)},[a]),(0,f.useEffect)(()=>{localStorage.setItem(f5.SORT_OPTION,b)},[b]);let{data:j,isLoading:M}=K({queryKey:[`printers`],queryFn:Z.getPrinters}),{data:N,isLoading:P,isFetching:F,error:I,refetch:L}=K({queryKey:[`kprofiles`,r,a],queryFn:async()=>{console.log(`[KProfiles] Fetching profiles for printer`,r,`nozzle`,a);let e=await Z.getKProfiles(r,a);return console.log(`[KProfiles] Received profiles:`,e?.profiles?.length||0,`profiles`),e},enabled:!!r,retry:!1,staleTime:0,gcTime:0,refetchOnMount:`always`}),{data:R}=K({queryKey:[`builtinFilaments`],queryFn:()=>Z.getBuiltinFilaments(),staleTime:3e5}),{data:z}=K({queryKey:[`filamentIdMap`],queryFn:()=>Z.getFilamentIdMap(),staleTime:3e5}),{data:B}=K({queryKey:[`localPresets`],queryFn:()=>Z.getLocalPresets(),retry:!1}),{data:V}=K({queryKey:[`orcaCloudProfilesForKProfiles`],queryFn:()=>Z.orcaCloudListProfiles(),retry:!1}),{data:ee}=K({queryKey:[`cloudSettings`],queryFn:()=>Z.getCloudSettings(),retry:!1}),{data:te,refetch:ne}=K({queryKey:[`kprofile-notes`,r],queryFn:()=>Z.getKProfileNotes(r),enabled:!!r,staleTime:3e4}),re=I?.message?.includes(`not connected`);(0,f.useEffect)(()=>{if(!r&&j&&j.length>0){let e=j.find(e=>e.is_active);e&&i(e.id)}},[r,j]),(0,f.useEffect)(()=>{if(r){let e=setTimeout(()=>{L()},150);return()=>clearTimeout(e)}},[r,a]);let ie=j?.filter(e=>e.is_active)||[],ae=f.useMemo(()=>{let e=new Map;if(R)for(let t of R)e.set(t.filament_id,t.name);if(z)for(let[t,n]of Object.entries(z))e.has(t)||e.set(t,n);return e},[R,z]),oe=f.useMemo(()=>Array.from(ae.entries()).map(([e,t])=>({filament_id:e,name:t})),[ae]),se=f.useMemo(()=>KKe({localPresets:B?.filament,orcaProfiles:V?.filament,cloudSettings:ee?.filament,builtinFilaments:R}),[B?.filament,V?.filament,ee?.filament,R]),H=f.useCallback(e=>ae.get(e.filament_id)||l5(e.name),[ae]),ce=f.useMemo(()=>N?.profiles?N.profiles.filter(e=>{let t=m.toLowerCase(),n=!t||e.name.toLowerCase().includes(t)||e.filament_id.toLowerCase().includes(t),r=g===`all`||g===`left`&&e.extruder_id===1||g===`right`&&e.extruder_id===0,i=v===`all`||v===`hf`&&e.nozzle_id.startsWith(`HH`)||v===`s`&&e.nozzle_id.startsWith(`HS`);return n&&r&&i}).sort((e,t)=>{switch(b){case`k_value`:return parseFloat(e.k_value)-parseFloat(t.k_value);case`filament`:return H(e).localeCompare(H(t));default:return e.name.localeCompare(t.name)}}):[],[N?.profiles,m,g,v,b,H]),le=j?.find(e=>e.id===r),ue=le?.nozzle_count===2,de=le?.supports_nozzle_flow_type??!0;(0,f.useEffect)(()=>{de||y(`all`)},[de]),(0,f.useEffect)(()=>{let e=e=>{e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement||e.target instanceof HTMLSelectElement||s||l||d||(e.key===`r`||e.key===`R`?(e.preventDefault(),L()):e.key===`n`||e.key===`N`?(e.preventDefault(),u(!0)):e.key===`Escape`&&S&&(e.preventDefault(),C(!1),T(new Set)))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[s,l,d,S,L]);let fe=(0,f.useCallback)(()=>{if(!N?.profiles||N.profiles.length===0){t(e(`kProfiles.toast.noProfilesToExport`),`error`);return}let n={version:1,exported_at:new Date().toISOString(),printer:le?.name||`Unknown`,nozzle_diameter:a,profiles:N.profiles.map(e=>({name:e.name,k_value:e.k_value,filament_id:e.filament_id,nozzle_id:e.nozzle_id,nozzle_diameter:e.nozzle_diameter,extruder_id:e.extruder_id}))},r=new Blob([JSON.stringify(n,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),o=document.createElement(`a`);o.href=i,o.download=`kprofiles_${le?.name||`printer`}_${a}mm_${new Date().toISOString().split(`T`)[0]}.json`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(i),t(e(`kProfiles.toast.exportedProfiles`,{count:N.profiles.length}))},[N?.profiles,le,a,t,e]),pe=(0,f.useCallback)(()=>{let n=document.createElement(`input`);n.type=`file`,n.accept=`.json`,n.onchange=async n=>{let i=n.target.files?.[0];if(i)try{let n=await i.text(),o=JSON.parse(n);if(!o.profiles||!Array.isArray(o.profiles)){t(e(`kProfiles.toast.invalidFileFormat`),`error`);return}let s=0;for(let e of o.profiles)if(!(!e.name||!e.k_value||!e.filament_id))try{await Z.setKProfile(r,{name:e.name,k_value:parseFloat(e.k_value).toFixed(6),filament_id:e.filament_id,nozzle_id:e.nozzle_id||`${o5}-${a}`,nozzle_diameter:e.nozzle_diameter||a,extruder_id:e.extruder_id??0,slot_id:0}),s++,await new Promise(e=>setTimeout(e,500))}catch(t){console.error(`Failed to import profile:`,e.name,t)}t(e(`kProfiles.toast.importedProfiles`,{count:s,total:o.profiles.length})),L()}catch(n){console.error(`Import error:`,n),t(e(`kProfiles.toast.failedToParseImport`),`error`)}},n.click()},[r,a,t,L,e]),me=(0,f.useCallback)(e=>{T(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),he=(0,f.useCallback)(()=>{T(new Set(ce.map(e=>A(e))))},[ce,A]),ge=(0,f.useCallback)(()=>{w.size!==0&&D(!0)},[w.size]),_e=(0,f.useCallback)(async()=>{let n=ce.filter(e=>w.has(A(e)));k(!0);let i=0;for(let e of n)try{await Z.deleteKProfile(r,{slot_id:e.slot_id,extruder_id:e.extruder_id,nozzle_id:e.nozzle_id,nozzle_diameter:e.nozzle_diameter,filament_id:e.filament_id,setting_id:e.setting_id}),i++,await new Promise(e=>setTimeout(e,300))}catch(t){console.error(`Failed to delete profile:`,e.name,t)}t(e(`kProfiles.toast.profilesDeleted`,{count:i})),k(!1),D(!1),C(!1),T(new Set),L()},[r,w,ce,t,L,A,e]),ve=(0,f.useCallback)(e=>{let t=[];return e.setting_id&&t.push(e.setting_id),t.push(`slot_${e.slot_id}_${e.filament_id}_${e.extruder_id}`),t.push(`name_${e.name}_${e.filament_id}`),t},[]),ye=(0,f.useCallback)(async(n,i)=>{if(r)try{await Z.setKProfileNote(r,n,i),ne()}catch(n){console.error(`Failed to save note:`,n),t(e(`kProfiles.toast.failedToSaveNote`),`error`)}},[r,ne,t,e]),be=(0,f.useCallback)(e=>{if(!te?.notes)return{note:``,key:null};let t=ve(e);for(let e of t)if(te.notes[e])return{note:te.notes[e],key:e};return{note:``,key:null}},[te,ve]),xe=(0,f.useCallback)(e=>be(e).note,[be]);return M?(0,G.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,G.jsx)(Y,{className:`w-8 h-8 text-bambu-green animate-spin`})}):!j||j.length===0?(0,G.jsx)(zd,{children:(0,G.jsxs)(Vd,{className:`py-12 text-center`,children:[(0,G.jsx)(fs,{className:`w-12 h-12 text-bambu-gray mx-auto mb-4`}),(0,G.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-2`,children:e(`kProfiles.noPrintersConfigured`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray`,children:e(`kProfiles.addPrinterInSettings`)})]})}):ie.length===0?(0,G.jsx)(zd,{children:(0,G.jsxs)(Vd,{className:`py-12 text-center`,children:[(0,G.jsx)(Ml,{className:`w-12 h-12 text-bambu-gray mx-auto mb-4`}),(0,G.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-2`,children:e(`kProfiles.noActivePrinters`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray`,children:e(`kProfiles.enablePrinterConnection`)})]})}):(0,G.jsxs)(G.Fragment,{children:[F&&!P&&(0,G.jsxs)(`div`,{className:`fixed inset-0 bg-black/50 flex flex-col items-center justify-center z-40`,children:[(0,G.jsx)(Y,{className:`w-10 h-10 text-bambu-green animate-spin mb-3`}),(0,G.jsx)(`p`,{className:`text-white font-medium`,children:e(`kProfiles.loadingProfiles`)})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-4 mb-6`,children:[(0,G.jsxs)(`div`,{className:`flex-1 min-w-48`,children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:e(`kProfiles.printer`)}),(0,G.jsx)(`select`,{value:r||``,onChange:e=>i(parseInt(e.target.value)),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:ie.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),(0,G.jsxs)(`div`,{className:`w-32`,children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:e(`kProfiles.nozzle`)}),(0,G.jsxs)(`select`,{value:a,onChange:e=>o(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,G.jsx)(`option`,{value:`0.2`,children:`0.2mm`}),(0,G.jsx)(`option`,{value:`0.4`,children:`0.4mm`}),(0,G.jsx)(`option`,{value:`0.6`,children:`0.6mm`}),(0,G.jsx)(`option`,{value:`0.8`,children:`0.8mm`})]})]}),(0,G.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>L(),disabled:F||!n(`kprofiles:read`),title:n(`kprofiles:read`)?void 0:e(`kProfiles.permission.noRead`),children:[(0,G.jsx)(Il,{className:`w-4 h-4 ${F?`animate-spin`:``}`}),e(`kProfiles.refresh`)]}),(0,G.jsxs)(Q,{onClick:()=>u(!0),disabled:!n(`kprofiles:create`),title:n(`kprofiles:create`)?void 0:e(`kProfiles.permission.noCreate`),children:[(0,G.jsx)(kl,{className:`w-4 h-4`}),e(`kProfiles.addProfile`)]})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-4 mb-4`,children:[(0,G.jsxs)(`div`,{className:`flex-1 min-w-48 relative`,children:[(0,G.jsx)(Kl,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray`}),(0,G.jsx)(`input`,{type:`text`,value:m,onChange:e=>h(e.target.value),placeholder:e(`kProfiles.searchPlaceholder`),className:`w-full pl-10 pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`})]}),ue&&(0,G.jsx)(`div`,{className:`w-36`,children:(0,G.jsxs)(`select`,{value:g,onChange:e=>_(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,G.jsx)(`option`,{value:`all`,children:e(`kProfiles.allExtruders`)}),(0,G.jsx)(`option`,{value:`left`,children:e(`kProfiles.leftOnly`)}),(0,G.jsx)(`option`,{value:`right`,children:e(`kProfiles.rightOnly`)})]})}),de&&(0,G.jsx)(`div`,{className:`w-32`,children:(0,G.jsxs)(`select`,{value:v,onChange:e=>y(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,G.jsx)(`option`,{value:`all`,children:e(`kProfiles.allFlow`)}),(0,G.jsx)(`option`,{value:`hf`,children:e(`kProfiles.hfOnly`)}),(0,G.jsx)(`option`,{value:`s`,children:e(`kProfiles.sOnly`)})]})}),(0,G.jsx)(`div`,{className:`w-32`,children:(0,G.jsxs)(`select`,{value:b,onChange:e=>x(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,G.jsx)(`option`,{value:`name`,children:e(`kProfiles.sortName`)}),(0,G.jsx)(`option`,{value:`k_value`,children:e(`kProfiles.sortKValue`)}),(0,G.jsx)(`option`,{value:`filament`,children:e(`kProfiles.sortFilament`)})]})})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2 mb-6`,children:[(0,G.jsxs)(Q,{variant:`secondary`,onClick:fe,disabled:!N?.profiles?.length||!n(`kprofiles:read`),title:n(`kprofiles:read`)?void 0:e(`kProfiles.permission.noExport`),children:[(0,G.jsx)(Us,{className:`w-4 h-4`}),e(`kProfiles.export`)]}),(0,G.jsxs)(Q,{variant:`secondary`,onClick:pe,disabled:!n(`kprofiles:create`),title:n(`kprofiles:create`)?void 0:e(`kProfiles.permission.noImport`),children:[(0,G.jsx)(Ru,{className:`w-4 h-4`}),e(`kProfiles.import`)]}),(0,G.jsx)(`div`,{className:`flex-1`}),S?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Q,{variant:`secondary`,onClick:he,children:[(0,G.jsx)(fu,{className:`w-4 h-4`}),e(`kProfiles.selectAll`)]}),(0,G.jsxs)(Q,{variant:`secondary`,onClick:ge,disabled:w.size===0||!n(`kprofiles:delete`),className:`text-red-500 hover:bg-red-500/10`,title:n(`kprofiles:delete`)?void 0:e(`kProfiles.permission.noDelete`),children:[(0,G.jsx)(ju,{className:`w-4 h-4`}),e(`kProfiles.delete`),` (`,w.size,`)`]}),(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>{C(!1),T(new Set)},children:[(0,G.jsx)($u,{className:`w-4 h-4`}),e(`common.cancel`)]})]}):(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>C(!0),disabled:!ce.length||!n(`kprofiles:delete`),title:n(`kprofiles:delete`)?void 0:e(`kProfiles.permission.noDelete`),children:[(0,G.jsx)(fu,{className:`w-4 h-4`}),e(`kProfiles.select`)]})]}),P?(0,G.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,G.jsx)(Y,{className:`w-8 h-8 text-bambu-green animate-spin`})}):re?(0,G.jsx)(zd,{children:(0,G.jsxs)(Vd,{className:`py-12 text-center`,children:[(0,G.jsx)(Ju,{className:`w-12 h-12 text-bambu-gray mx-auto mb-4`}),(0,G.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-2`,children:e(`kProfiles.printerOffline`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray mb-4`,children:e(`kProfiles.printerOfflineDesc`)}),(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>L(),children:[(0,G.jsx)(Il,{className:`w-4 h-4`}),e(`common.refresh`)]})]})}):ce.length>0?ue?(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-sm font-medium text-bambu-gray mb-2 px-1`,children:e(`kProfiles.leftExtruder`)}),(0,G.jsx)(`div`,{className:`space-y-1`,children:ce.filter(e=>e.extruder_id===1).map(e=>(0,G.jsx)(u5,{profile:e,onEdit:()=>c(e),onCopy:()=>p(e),selectionMode:S,isSelected:w.has(A(e)),onToggleSelect:()=>me(A(e)),note:xe(e)},A(e)))})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-sm font-medium text-bambu-gray mb-2 px-1`,children:e(`kProfiles.rightExtruder`)}),(0,G.jsx)(`div`,{className:`space-y-1`,children:ce.filter(e=>e.extruder_id===0).map(e=>(0,G.jsx)(u5,{profile:e,onEdit:()=>c(e),onCopy:()=>p(e),selectionMode:S,isSelected:w.has(A(e)),onToggleSelect:()=>me(A(e)),note:xe(e)},A(e)))})]})]}):(0,G.jsx)(`div`,{className:`space-y-1`,children:ce.map(e=>(0,G.jsx)(u5,{profile:e,onEdit:()=>c(e),onCopy:()=>p(e),selectionMode:S,isSelected:w.has(A(e)),onToggleSelect:()=>me(A(e)),note:xe(e)},A(e)))}):m||g!==`all`||v!==`all`?(0,G.jsx)(zd,{children:(0,G.jsxs)(Vd,{className:`py-12 text-center`,children:[(0,G.jsx)(Kl,{className:`w-12 h-12 text-bambu-gray mx-auto mb-4`}),(0,G.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-2`,children:e(`kProfiles.noMatchingProfiles`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray`,children:e(`kProfiles.noMatchingProfilesDesc`)})]})}):(0,G.jsx)(zd,{children:(0,G.jsxs)(Vd,{className:`py-12 text-center`,children:[(0,G.jsx)(vc,{className:`w-12 h-12 text-bambu-gray mx-auto mb-4`}),(0,G.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-2`,children:e(`kProfiles.noKProfiles`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray mb-4`,children:e(`kProfiles.noKProfilesDesc`,{diameter:a})}),(0,G.jsxs)(Q,{onClick:()=>u(!0),children:[(0,G.jsx)(kl,{className:`w-4 h-4`}),e(`kProfiles.createFirstProfile`)]})]})}),s&&r&&(()=>{let{note:e,key:t}=be(s);return(0,G.jsx)(d5,{profile:s,printerId:r,nozzleDiameter:a,existingProfiles:N?.profiles,builtinFilaments:oe,filamentPresets:se,isDualNozzle:ue,supportsFlowType:de,initialNote:e,initialNoteKey:t,onSaveNote:ye,hasPermission:n,onClose:()=>{console.log(`[KProfiles] Edit modal onClose - refetching profiles...`),c(null),L()},onSave:()=>{c(null),L()}})})(),l&&r&&(0,G.jsx)(d5,{printerId:r,nozzleDiameter:a,existingProfiles:N?.profiles,builtinFilaments:oe,filamentPresets:se,isDualNozzle:ue,supportsFlowType:de,onSaveNote:ye,hasPermission:n,onClose:()=>{u(!1),L()},onSave:()=>{u(!1),L()}}),d&&r&&(0,G.jsx)(d5,{printerId:r,nozzleDiameter:a,existingProfiles:N?.profiles,builtinFilaments:oe,filamentPresets:se,isDualNozzle:ue,supportsFlowType:de,onSaveNote:ye,hasPermission:n,profile:{...d,slot_id:0,name:`${d.name} (Copy)`},onClose:()=>{p(null),L()},onSave:()=>{p(null),L()}}),E&&(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,children:(0,G.jsx)(zd,{className:`w-full max-w-sm`,children:(0,G.jsxs)(Vd,{className:`p-6`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 mb-4`,children:[(0,G.jsx)(`div`,{className:`w-10 h-10 rounded-full bg-red-500/20 flex items-center justify-center`,children:(0,G.jsx)(ju,{className:`w-5 h-5 text-red-500`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:e(`kProfiles.bulkDelete.title`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`kProfiles.bulkDelete.cannotUndo`)})]})]}),(0,G.jsx)(`p`,{className:`text-bambu-gray mb-6`,children:e(`kProfiles.bulkDelete.message`,{count:w.size})}),(0,G.jsxs)(`div`,{className:`flex gap-3`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>D(!1),disabled:O,className:`flex-1`,children:e(`common.cancel`)}),(0,G.jsxs)(Q,{onClick:_e,disabled:O,className:`flex-1 bg-red-500 hover:bg-red-600 text-white`,children:[O?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(ju,{className:`w-4 h-4`}),e(`common.delete`)]})]})]})})})]})}var p5=[`PLA`,`PETG`,`PCTG`,`ABS`,`ASA`,`TPU`,`PC`,`PA`,`PVA`,`HIPS`,`PP`,`PET`,`NYLON`],XKe={PLA:`E8E8E8`,PETG:`4A90D9`,ABS:`E67E22`,ASA:`D35400`,TPU:`9B59B6`,PC:`BDC3C7`,PA:`2ECC71`,NYLON:`2ECC71`,PVA:`F1C40F`,HIPS:`95A5A6`,PP:`ECF0F1`,PET:`3498DB`};function ZKe(e){let t=e.toUpperCase();for(let e of p5)if(RegExp(`\\b${e}\\b`).test(t))return e;return null}function QKe(e){let t=e.replace(/@.+$/,``).trim(),n=t.toUpperCase();for(let e of p5){let r=n.indexOf(e);if(r>0){let e=t.slice(0,r).trim();if(e&&e.length>1)return e}}return null}function m5({preset:e,onDelete:t,onExpand:n,isExpanded:r}){let{t:i}=U(),{hasPermission:a}=Nd(),o=e.filament_type||ZKe(e.name),s=e.filament_vendor||QKe(e.name),c=null,l=!1;if(e.default_filament_colour)try{let t=JSON.parse(e.default_filament_colour),n=Array.isArray(t)?t[0]:t;typeof n==`string`&&/^#?[0-9a-fA-F]{6,8}$/.test(n.replace(`#`,``))&&(c=n.replace(`#`,``).slice(0,6),l=!0)}catch{let t=e.default_filament_colour;/^#?[0-9a-fA-F]{6,8}$/.test(t.replace(`#`,``))&&(c=t.replace(`#`,``).slice(0,6),l=!0)}return!c&&o&&(c=XKe[o.toUpperCase()]||null),(0,G.jsx)(zd,{className:`bg-bambu-dark border-bambu-dark-tertiary hover:border-bambu-dark-tertiary/80 transition-colors`,children:(0,G.jsxs)(Vd,{className:`p-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[e.preset_type===`filament`&&(0,G.jsx)(`div`,{className:`w-4 h-4 rounded-full border border-black/20 flex-shrink-0 ${!l&&!c?`opacity-25`:l?``:`opacity-50`}`,style:{backgroundColor:c?`#${c}`:`#666`}}),(0,G.jsx)(`span`,{className:`text-sm font-medium text-white truncate`,children:e.name})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[o&&(0,G.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded bg-bambu-green/20 text-bambu-green`,children:o}),s&&(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:s}),(0,G.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400`,children:i(`profiles.localProfiles.badge`)})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1 flex-shrink-0`,children:[a(`settings:update`)&&(0,G.jsx)(`button`,{onClick:()=>t(e.id),className:`p-1 text-bambu-gray hover:text-red-600 dark:hover:text-red-400 transition-colors`,title:i(`profiles.localProfiles.delete`),children:(0,G.jsx)(ju,{className:`w-3.5 h-3.5`})}),(0,G.jsx)(`button`,{onClick:()=>n(r?null:e.id),className:`p-1 text-bambu-gray hover:text-white transition-colors`,children:r?(0,G.jsx)(ls,{className:`w-3.5 h-3.5`}):(0,G.jsx)(as,{className:`w-3.5 h-3.5`})})]})]}),r&&(0,G.jsxs)(`div`,{className:`mt-3 pt-3 border-t border-bambu-dark-tertiary text-xs space-y-1.5`,children:[o&&(0,G.jsxs)(`div`,{className:`flex justify-between`,children:[(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:i(`profiles.localProfiles.filamentType`)}),(0,G.jsx)(`span`,{className:`text-white`,children:o})]}),s&&(0,G.jsxs)(`div`,{className:`flex justify-between`,children:[(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:i(`profiles.localProfiles.vendor`)}),(0,G.jsx)(`span`,{className:`text-white`,children:s})]}),e.nozzle_temp_min!=null&&e.nozzle_temp_max!=null&&(0,G.jsxs)(`div`,{className:`flex justify-between`,children:[(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:i(`profiles.localProfiles.nozzleTemp`)}),(0,G.jsxs)(`span`,{className:`text-white`,children:[e.nozzle_temp_min,`–`,e.nozzle_temp_max,`°C`]})]}),e.filament_cost&&(0,G.jsxs)(`div`,{className:`flex justify-between`,children:[(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:i(`profiles.localProfiles.cost`)}),(0,G.jsx)(`span`,{className:`text-white`,children:e.filament_cost})]}),e.filament_density&&(0,G.jsxs)(`div`,{className:`flex justify-between`,children:[(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:i(`profiles.localProfiles.density`)}),(0,G.jsxs)(`span`,{className:`text-white`,children:[e.filament_density,` g/cm³`]})]}),e.pressure_advance&&(0,G.jsxs)(`div`,{className:`flex justify-between`,children:[(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:i(`profiles.localProfiles.pressureAdvance`)}),(0,G.jsx)(`span`,{className:`text-white`,children:e.pressure_advance})]}),e.compatible_printers&&(0,G.jsxs)(`div`,{className:`flex justify-between`,children:[(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:i(`profiles.localProfiles.compatiblePrinters`)}),(0,G.jsx)(`span`,{className:`text-white truncate ml-2`,children:(()=>{try{return JSON.parse(e.compatible_printers).join(`, `)}catch{return e.compatible_printers}})()})]}),e.inherits&&e.inherits!==e.name&&(0,G.jsxs)(`div`,{className:`flex justify-between`,children:[(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:i(`profiles.localProfiles.inheritsFrom`)}),(0,G.jsx)(`span`,{className:`text-white truncate ml-2`,children:e.inherits})]}),(0,G.jsxs)(`div`,{className:`flex justify-between`,children:[(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:i(`profiles.localProfiles.source`)}),(0,G.jsx)(`span`,{className:`text-white capitalize`,children:e.source})]})]})]})})}function $Ke(){let{t:e}=U(),{hasPermission:t}=Nd(),n=no(),{showToast:r}=qd(),[i,a]=(0,f.useState)(``),[o,s]=(0,f.useState)(null),[c,l]=(0,f.useState)(!1),[u,d]=(0,f.useState)(null),{data:p,isLoading:m}=K({queryKey:[`localPresets`],queryFn:()=>Z.getLocalPresets()}),h=q({mutationFn:async e=>{let t=[];for(let n of Array.from(e)){let e=new FormData;e.append(`file`,n),t.push(await Z.importLocalPresets(e))}return t},onSuccess:t=>{n.invalidateQueries({queryKey:[`localPresets`]}),n.invalidateQueries({queryKey:[`slicerPresets`]});let i=0,a=0,o=0;for(let e of t)i+=e.imported,a+=e.skipped,o+=e.errors.length;i>0&&r(e(`profiles.localProfiles.toast.importSuccess`,{count:i})),a>0&&r(e(`profiles.localProfiles.toast.importSkipped`,{count:a}),`warning`),o>0&&r(e(`profiles.localProfiles.toast.importError`,{count:o}),`error`)},onError:e=>{r(e.message,`error`)}}),g=q({mutationFn:e=>Z.deleteLocalPreset(e),onSuccess:(t,i)=>{n.setQueryData([`localPresets`],e=>e&&{filament:e.filament.filter(e=>e.id!==i),printer:e.printer.filter(e=>e.id!==i),process:e.process.filter(e=>e.id!==i)}),n.invalidateQueries({queryKey:[`localPresets`]}),n.invalidateQueries({queryKey:[`slicerPresets`]}),d(null),r(e(`profiles.localProfiles.toast.deleted`))}}),_=(0,f.useCallback)(e=>{!e||e.length===0||h.mutate(e)},[h]),v=(0,f.useCallback)(e=>{e.preventDefault(),l(!1),_(e.dataTransfer.files)},[_]),y=(0,f.useCallback)(e=>{if(!i)return e;let t=i.toLowerCase();return e.filter(e=>e.name.toLowerCase().includes(t)||e.filament_type?.toLowerCase().includes(t)||e.filament_vendor?.toLowerCase().includes(t))},[i]),b=(0,f.useMemo)(()=>y(p?.filament||[]),[p?.filament,y]),x=(0,f.useMemo)(()=>y(p?.printer||[]),[p?.printer,y]),S=(0,f.useMemo)(()=>y(p?.process||[]),[p?.process,y]),C=b.length+x.length+S.length,w=(p?.filament?.length??0)+(p?.printer?.length??0)+(p?.process?.length??0)>0;return m?(0,G.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,G.jsx)(Y,{className:`w-8 h-8 text-bambu-green animate-spin`})}):(0,G.jsxs)(`div`,{className:`space-y-6`,children:[t(`settings:update`)&&(0,G.jsxs)(`div`,{onDragOver:e=>{e.preventDefault(),l(!0)},onDragLeave:()=>l(!1),onDrop:v,className:`relative border-2 border-dashed rounded-lg p-6 text-center transition-colors ${c?`border-bambu-green bg-bambu-green/10`:`border-bambu-dark-tertiary hover:border-bambu-gray`}`,children:[(0,G.jsx)(`input`,{type:`file`,accept:`.json,.zip,.orca_filament,.bbscfg,.bbsflmt`,multiple:!0,className:`absolute inset-0 w-full h-full opacity-0 cursor-pointer`,onChange:e=>_(e.target.files)}),h.isPending?(0,G.jsxs)(`div`,{className:`flex items-center justify-center gap-2`,children:[(0,G.jsx)(Y,{className:`w-5 h-5 text-bambu-green animate-spin`}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:e(`profiles.localProfiles.importing`)})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Ru,{className:`w-8 h-8 text-bambu-gray mx-auto mb-2`}),(0,G.jsx)(`p`,{className:`text-sm text-white font-medium`,children:e(`profiles.localProfiles.import`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:e(`profiles.localProfiles.importDesc`)})]})]}),w&&(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(Kl,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray`}),(0,G.jsx)(`input`,{type:`text`,value:i,onChange:e=>a(e.target.value),placeholder:e(`profiles.localProfiles.search`),className:`w-full pl-9 pr-4 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-sm text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green`})]}),!w&&!m&&(0,G.jsxs)(`div`,{className:`text-center py-12`,children:[(0,G.jsx)(Dc,{className:`w-12 h-12 text-bambu-gray mx-auto mb-3 opacity-50`}),(0,G.jsx)(`p`,{className:`text-bambu-gray`,children:e(`profiles.localProfiles.noPresets`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray/60 mt-1`,children:e(`profiles.localProfiles.importDesc`)})]}),w&&C===0&&!m&&(0,G.jsxs)(`div`,{className:`text-center py-12`,children:[(0,G.jsx)(Kl,{className:`w-12 h-12 text-bambu-gray mx-auto mb-3 opacity-50`}),(0,G.jsx)(`p`,{className:`text-bambu-gray`,children:e(`profiles.localProfiles.noSearchResults`)})]}),C>0&&(0,G.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6`,children:[b.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,G.jsx)(Ws,{className:`w-4 h-4 text-bambu-green`}),(0,G.jsx)(`h3`,{className:`text-sm font-medium text-white`,children:e(`profiles.localProfiles.filament`)}),(0,G.jsxs)(`span`,{className:`text-xs text-bambu-gray`,children:[`(`,b.length,`)`]})]}),(0,G.jsx)(`div`,{className:`space-y-2`,children:b.map(e=>(0,G.jsx)(m5,{preset:e,onDelete:e=>d(e),onExpand:s,isExpanded:o===e.id},e.id))})]}),S.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,G.jsx)(Hc,{className:`w-4 h-4 text-blue-600 dark:text-blue-400`}),(0,G.jsx)(`h3`,{className:`text-sm font-medium text-white`,children:e(`profiles.localProfiles.process`)}),(0,G.jsxs)(`span`,{className:`text-xs text-bambu-gray`,children:[`(`,S.length,`)`]})]}),(0,G.jsx)(`div`,{className:`space-y-2`,children:S.map(e=>(0,G.jsx)(m5,{preset:e,onDelete:e=>d(e),onExpand:s,isExpanded:o===e.id},e.id))})]}),x.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,G.jsx)(Xl,{className:`w-4 h-4 text-orange-600 dark:text-orange-400`}),(0,G.jsx)(`h3`,{className:`text-sm font-medium text-white`,children:e(`profiles.localProfiles.printer`)}),(0,G.jsxs)(`span`,{className:`text-xs text-bambu-gray`,children:[`(`,x.length,`)`]})]}),(0,G.jsx)(`div`,{className:`space-y-2`,children:x.map(e=>(0,G.jsx)(m5,{preset:e,onDelete:e=>d(e),onExpand:s,isExpanded:o===e.id},e.id))})]})]}),u!==null&&(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50`,children:(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg p-6 max-w-sm mx-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,G.jsx)(fs,{className:`w-5 h-5 text-red-600 dark:text-red-400`}),(0,G.jsx)(`h3`,{className:`text-white font-medium`,children:e(`profiles.localProfiles.deleteConfirmTitle`)})]}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mb-4`,children:e(`profiles.localProfiles.deleteConfirm`)}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:()=>d(null),children:e(`profiles.localProfiles.cancel`)}),(0,G.jsxs)(Q,{variant:`danger`,size:`sm`,onClick:()=>g.mutate(u),disabled:g.isPending,children:[g.isPending?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(ju,{className:`w-4 h-4`}),e(`profiles.localProfiles.delete`)]})]})]})})]})}function eqe(e){let t=e.match(/@?\s*(?:BBL\s+)?(?:Bambu\s+Lab\s+)?([XPAH][1-9][A-Z]?(?:\s*(?:Carbon|mini))?|H2D)/i),n=e.match(/(\d+\.?\d*)\s*(?:mm\s*)?nozzle|nozzle\s*(\d+\.?\d*)/i),r=e.match(/(\d+\.?\d*)mm\s*(?:Standard|Fine|Extra Fine|Draft|Quality)?/i),i=e.match(/\b(PLA|PETG|ABS|ASA|TPU|PC|PA|PVA|HIPS|PP|PET(?:-?CF)?|PA(?:-?CF)?|PLA(?:-?CF)?)\b/i);return{printer:t?t[1].trim():null,nozzle:n?(n[1]||n[2])+`mm`:null,layerHeight:r?r[1]+`mm`:null,filamentType:i?i[1].toUpperCase():null}}function tqe({settings:e,lastSyncTime:t,onRefresh:n,isRefreshing:r,printers:i,t:a}){let[o,s]=(0,f.useState)(``),[c,l]=(0,f.useState)(`all`),[u,d]=(0,f.useState)(`all`),[p,m]=(0,f.useState)(`all`),[h,g]=(0,f.useState)(`all`),[_,v]=(0,f.useState)(`all`),[y,b]=(0,f.useState)(null),x=(0,f.useMemo)(()=>[...e.filament.map(e=>({...e,type:`filament`})),...e.printer.map(e=>({...e,type:`printer`})),...e.process.map(e=>({...e,type:`process`}))].map(e=>({...e,meta:eqe(e.name)})),[e]),S=(0,f.useMemo)(()=>{let e=new Set,t=new Set,n=new Set;return x.forEach(r=>{r.meta.nozzle&&e.add(r.meta.nozzle),r.meta.filamentType&&t.add(r.meta.filamentType),r.meta.layerHeight&&n.add(r.meta.layerHeight)}),{printers:i.map(e=>({id:e.id.toString(),name:e.name})),nozzles:Array.from(e).sort((e,t)=>parseFloat(e)-parseFloat(t)),filaments:Array.from(t).sort(),layerHeights:Array.from(n).sort((e,t)=>parseFloat(e)-parseFloat(t))}},[x,i]),C=(0,f.useMemo)(()=>u===`all`?null:i.find(e=>e.id.toString()===u)?.model||null,[u,i]),w=(0,f.useMemo)(()=>x.filter(e=>c===`all`||e.type===c).filter(e=>{if(u===`all`||!C)return!0;let t=e.meta.printer?.toLowerCase()||``,n=C.toLowerCase();return t.includes(n)||n.includes(t)}).filter(e=>p===`all`||e.meta.nozzle===p).filter(e=>h===`all`||e.meta.filamentType===h).filter(e=>_===`all`||e.meta.layerHeight===_).filter(e=>o===``||e.name.toLowerCase().includes(o.toLowerCase())).sort((e,t)=>e.name.localeCompare(t.name)),[x,c,u,C,p,h,_,o]),T=()=>{l(`all`),d(`all`),m(`all`),g(`all`),v(`all`),s(``)},E=c!==`all`||u!==`all`||p!==`all`||h!==`all`||_!==`all`||o!==``,D=e.filament.length+e.printer.length+e.process.length,O=e=>w.filter(t=>t.type===e);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`space-y-4 mb-6`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-3`,children:[(0,G.jsxs)(`div`,{className:`relative flex-1`,children:[(0,G.jsx)(Kl,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray`}),(0,G.jsx)(`input`,{type:`text`,value:o,onChange:e=>s(e.target.value),placeholder:a(`profiles.cloudView.searchPlaceholder`),className:`w-full pl-10 pr-4 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray-dark focus:border-bambu-green focus:outline-none`})]}),(0,G.jsx)(`div`,{className:`flex gap-2`,children:(0,G.jsxs)(Q,{variant:`secondary`,onClick:n,disabled:r,children:[(0,G.jsx)(Il,{className:`w-4 h-4 ${r?`animate-spin`:``}`}),a(`profiles.cloudView.refresh`)]})})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(_c,{className:`w-4 h-4 text-bambu-gray`}),(0,G.jsx)(v5,{label:a(`profiles.cloudView.filters.type`),value:c,options:[{value:`all`,label:a(`profiles.cloudView.filters.all`),count:D},{value:`filament`,label:a(`profiles.cloudView.filters.filament`),count:e.filament.length},{value:`printer`,label:a(`profiles.cloudView.filters.printer`),count:e.printer.length},{value:`process`,label:a(`profiles.cloudView.filters.process`),count:e.process.length}],onChange:e=>l(e)}),S.printers.length>0&&(0,G.jsx)(v5,{label:a(`profiles.cloudView.filters.printer`),value:u,options:[{value:`all`,label:a(`profiles.cloudView.filters.all`)},...S.printers.map(e=>({value:e.id,label:e.name}))],onChange:d}),S.nozzles.length>0&&(0,G.jsx)(v5,{label:a(`profiles.cloudView.filters.nozzle`),value:p,options:[{value:`all`,label:a(`profiles.cloudView.filters.all`)},...S.nozzles.map(e=>({value:e,label:e}))],onChange:m}),S.filaments.length>0&&(c===`all`||c===`filament`)&&(0,G.jsx)(v5,{label:a(`profiles.cloudView.filters.filament`),value:h,options:[{value:`all`,label:a(`profiles.cloudView.filters.all`)},...S.filaments.map(e=>({value:e,label:e}))],onChange:g}),S.layerHeights.length>0&&(c===`all`||c===`process`)&&(0,G.jsx)(v5,{label:a(`profiles.cloudView.filters.layer`),value:_,options:[{value:`all`,label:a(`profiles.cloudView.filters.all`)},...S.layerHeights.map(e=>({value:e,label:e}))],onChange:v}),E&&(0,G.jsx)(`button`,{onClick:T,className:`px-3 py-2 text-sm text-bambu-gray hover:text-white transition-colors`,children:a(`profiles.cloudView.clearFilters`)})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 mb-4 text-sm text-bambu-gray`,children:[t&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(ws,{className:`w-3 h-3`}),a(`profiles.cloudView.lastSynced`),` `,op(t.toISOString(),`system`,a)]}),(0,G.jsx)(`span`,{children:a(`profiles.cloudView.showingCount`,{showing:w.length,total:D})})]}),w.length===0?(0,G.jsxs)(`div`,{className:`text-center py-16`,children:[(0,G.jsx)(Hc,{className:`w-12 h-12 text-bambu-gray-dark mx-auto mb-4`}),(0,G.jsx)(`p`,{className:`text-bambu-gray`,children:a(`profiles.cloudView.noPresetsFound`)}),E&&(0,G.jsx)(`button`,{onClick:T,className:`mt-2 text-sm text-bambu-green hover:text-bambu-green-light`,children:a(`profiles.cloudView.clearFilters`)})]}):(0,G.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-6`,children:[(0,G.jsx)(h5,{icon:(0,G.jsx)(Ws,{className:`w-4 h-4 text-amber-600 dark:text-amber-400`}),title:a(`profiles.cloudView.columns.filament`),presets:O(`filament`),emptyText:a(`profiles.cloudView.noFilamentPresets`),onSelect:b}),(0,G.jsx)(h5,{icon:(0,G.jsx)(Xl,{className:`w-4 h-4 text-blue-600 dark:text-blue-400`}),title:a(`profiles.cloudView.columns.process`),presets:O(`process`),emptyText:a(`profiles.cloudView.noProcessPresets`),onSelect:b}),(0,G.jsx)(h5,{icon:(0,G.jsx)(Ml,{className:`w-4 h-4 text-purple-600 dark:text-purple-400`}),title:a(`profiles.cloudView.columns.printer`),presets:O(`printer`),emptyText:a(`profiles.cloudView.noPrinterPresets`),onSelect:b})]}),y&&(0,G.jsx)(rqe,{setting:y,onClose:()=>b(null),t:a})]})}function h5({icon:e,title:t,presets:n,emptyText:r,onSelect:i}){return(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-3 px-1`,children:[e,(0,G.jsx)(`h3`,{className:`text-sm font-medium text-bambu-gray`,children:t}),(0,G.jsxs)(`span`,{className:`text-xs text-bambu-gray-dark`,children:[`(`,n.length,`)`]})]}),(0,G.jsx)(`div`,{className:`space-y-1 max-h-[calc(100vh-320px)] overflow-y-auto pr-1`,children:n.length===0?(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray-dark px-3 py-2`,children:r}):n.map(e=>(0,G.jsx)(nqe,{preset:e,onClick:()=>i(e)},e.setting_id))})]})}function nqe({preset:e,onClick:t}){return(0,G.jsx)(`button`,{onClick:t,className:`w-full text-left px-3 py-2 rounded bg-bambu-dark hover:bg-bambu-dark-tertiary transition-colors`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-white text-sm truncate flex-1`,title:e.name,children:e.name}),e.meta.filamentType&&e.type===`filament`&&(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray whitespace-nowrap`,children:e.meta.filamentType}),e.meta.layerHeight&&e.type===`process`&&(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray whitespace-nowrap`,children:e.meta.layerHeight}),e.meta.printer&&(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray whitespace-nowrap`,children:e.meta.printer})]})})}function rqe({setting:e,onClose:t,t:n}){let{data:r,isLoading:i,error:a}=K({queryKey:[`orcaCloudProfileDetail`,e.setting_id],queryFn:()=>Z.orcaCloudGetProfile(e.setting_id),retry:!1});return(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/60 z-50 flex items-center justify-center p-4`,onClick:t,children:(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-2xl max-w-4xl w-full max-h-[90vh] flex flex-col`,onClick:e=>e.stopPropagation(),children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{className:`text-lg font-bold text-white`,children:e.name}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:e.type})]}),(0,G.jsx)(`button`,{onClick:t,className:`text-bambu-gray hover:text-white p-1`,children:(0,G.jsx)($u,{className:`w-5 h-5`})})]}),(0,G.jsx)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:i?(0,G.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,G.jsx)(Y,{className:`w-8 h-8 text-bambu-green animate-spin`})}):a?(0,G.jsx)(`p`,{className:`text-center text-bambu-gray py-16`,children:a.message}):r?(0,G.jsx)(`pre`,{className:`text-xs font-mono text-bambu-gray bg-bambu-dark p-3 rounded overflow-x-auto whitespace-pre`,children:JSON.stringify(r.setting,null,2)}):(0,G.jsx)(`p`,{className:`text-center text-bambu-gray py-16`,children:n(`profiles.cloudView.noPresetsFound`)})})]})})}function iqe(){let{t:e}=U(),t=no(),{showToast:n}=qd(),{hasPermission:r}=Nd(),i=r(`orca_cloud:auth`),[a,o]=(0,f.useState)(null),[s,c]=(0,f.useState)(5e3),[l,u]=(0,f.useState)(null),{data:d,isLoading:p}=K({queryKey:[`orcaCloudStatus`],queryFn:Z.orcaCloudStatus}),m=!!d?.connected,{data:h,isLoading:g,refetch:_,isRefetching:v,error:y,dataUpdatedAt:b}=K({queryKey:[`orcaCloudProfiles`],queryFn:Z.orcaCloudListProfiles,enabled:m,retry:!1,staleTime:1e3*60*5}),{data:x=[]}=K({queryKey:[`printers`],queryFn:Z.getPrinters,enabled:m}),[S,C]=(0,f.useState)();(0,f.useEffect)(()=>{b&&C(new Date(b))},[b]);let w=()=>{o(null),c(5e3)},T=t=>{t===`access_denied`?u(e(`profiles.orcaCloud.errors.denied`)):t===`expired_token`&&u(e(`profiles.orcaCloud.errors.expired`)),w()},E=q({mutationFn:Z.orcaCloudDeviceStart,onSuccess:e=>{u(null),c(Math.max(1,e.interval)*1e3),o(e)},onError:t=>{u(t.message||e(`profiles.orcaCloud.errors.startFailed`))}}),D=q({mutationFn:Z.orcaCloudLogout,onSuccess:()=>{t.invalidateQueries({queryKey:[`orcaCloudStatus`]}),t.removeQueries({queryKey:[`orcaCloudProfiles`]}),n(e(`profiles.orcaCloud.toast.disconnected`))}}),{data:O,error:k}=K({queryKey:[`orcaCloudDevicePoll`,a?.user_code??`none`],queryFn:Z.orcaCloudDevicePoll,enabled:a!==null,gcTime:0,retry:!1,refetchOnWindowFocus:!1,refetchInterval:a===null?!1:s}),A=(0,f.useRef)(null);return(0,f.useEffect)(()=>{if(!a||!O)return;let r=O.status;if(r===`slow_down`){c(e=>e+5e3);return}r!==`authorization_pending`&&A.current!==r&&(A.current=r,r===`complete`?(w(),t.invalidateQueries({queryKey:[`orcaCloudStatus`]}),t.invalidateQueries({queryKey:[`orcaCloudProfiles`]}),n(e(`profiles.orcaCloud.connectedShort`))):T(r))},[O,a]),(0,f.useEffect)(()=>{a&&k&&(u(e(`profiles.orcaCloud.errors.pollFailed`)),w())},[k,a]),(0,f.useEffect)(()=>{a&&(A.current=null)},[a]),p?(0,G.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,G.jsx)(Y,{className:`w-8 h-8 text-bambu-green animate-spin`})}):(0,G.jsxs)(`div`,{children:[m&&(0,G.jsxs)(`div`,{className:`flex items-center justify-between p-3 mb-6 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-2 h-2 rounded-full bg-bambu-green animate-pulse`}),(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:d?.email?(0,G.jsxs)(G.Fragment,{children:[e(`profiles.orcaCloud.connectedAs`),` `,(0,G.jsx)(`span`,{className:`text-white`,children:d.email})]}):(0,G.jsx)(`span`,{className:`text-white`,children:e(`profiles.orcaCloud.connectedShort`)})})]}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:()=>D.mutate(),disabled:D.isPending||!i,title:i?void 0:e(`profiles.orcaCloud.noLogoutPermission`),children:[(0,G.jsx)(Qc,{className:`w-4 h-4`}),e(`profiles.orcaCloud.logout`)]})]}),m?g?(0,G.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,G.jsx)(Y,{className:`w-8 h-8 text-bambu-green animate-spin`})}):y?(0,G.jsxs)(`div`,{className:`text-center py-16`,children:[(0,G.jsx)(`p`,{className:`text-bambu-gray mb-4`,children:y.message}),(0,G.jsx)(Q,{onClick:()=>_(),children:e(`profiles.orcaCloud.retry`)})]}):h?(0,G.jsx)(tqe,{settings:h,lastSyncTime:S,onRefresh:()=>_(),isRefreshing:v,printers:x,t:e}):null:(0,G.jsx)(aqe,{pairing:a,connectError:l,onConnect:()=>E.mutate(),onCancel:w,isStarting:E.isPending,canManage:i,t:e})]})}function aqe({pairing:e,connectError:t,onConnect:n,onCancel:r,isStarting:i,canManage:a,t:o}){return e?(0,G.jsx)(zd,{children:(0,G.jsxs)(Vd,{className:`p-8 text-center max-w-md mx-auto`,children:[(0,G.jsx)(Ds,{className:`w-12 h-12 text-bambu-green mx-auto mb-4`}),(0,G.jsx)(`h2`,{className:`text-xl font-bold text-white mb-2`,children:o(`profiles.orcaCloud.device.title`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray mb-6`,children:o(`profiles.orcaCloud.device.instruction`)}),(0,G.jsx)(`p`,{className:`text-xs uppercase tracking-wide text-bambu-gray mb-2`,children:o(`profiles.orcaCloud.device.codeLabel`)}),(0,G.jsx)(`div`,{className:`mb-6 py-3 px-4 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg`,children:(0,G.jsx)(`span`,{className:`text-2xl font-mono font-bold tracking-[0.3em] text-white select-all`,children:e.user_code})}),(0,G.jsx)(`a`,{href:e.verification_uri_complete,target:`_blank`,rel:`noopener noreferrer`,children:(0,G.jsxs)(Q,{className:`w-full mb-3`,children:[(0,G.jsx)(Xs,{className:`w-4 h-4`}),o(`profiles.orcaCloud.device.openButton`)]})}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray break-all mb-6`,children:o(`profiles.orcaCloud.device.manualHint`,{url:e.verification_uri})}),(0,G.jsxs)(`div`,{className:`flex items-center justify-center gap-2 text-sm text-bambu-gray mb-4`,children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin text-bambu-green`}),o(`profiles.orcaCloud.device.waiting`)]}),(0,G.jsx)(`button`,{type:`button`,onClick:r,className:`text-bambu-gray hover:text-white text-sm`,children:o(`profiles.orcaCloud.device.cancel`)})]})}):(0,G.jsx)(zd,{children:(0,G.jsxs)(Vd,{className:`p-8 text-center`,children:[(0,G.jsx)(Ds,{className:`w-12 h-12 text-bambu-green mx-auto mb-4`}),(0,G.jsx)(`h2`,{className:`text-xl font-bold text-white mb-2`,children:o(`profiles.orcaCloud.connect.title`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray mb-6 max-w-xl mx-auto`,children:o(`profiles.orcaCloud.connect.description`)}),(0,G.jsxs)(`div`,{className:`max-w-sm mx-auto`,children:[(0,G.jsxs)(Q,{onClick:n,disabled:i||!a,title:a?void 0:o(`profiles.orcaCloud.noConnectPermission`),className:`w-full`,children:[i?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(is,{className:`w-4 h-4`}),o(`profiles.orcaCloud.connectButton`)]}),t&&(0,G.jsxs)(`p`,{className:`mt-3 text-sm text-red-700 dark:text-red-400 flex items-center justify-center gap-2`,children:[(0,G.jsx)(fs,{className:`w-4 h-4 flex-shrink-0`}),t]})]})]})})}function g5(e,t){let n=`${e} ${t||``}`,r=n.match(/@?\s*(?:BBL\s+)?(?:Bambu\s+Lab\s+)?([XPAH][1-9][A-Z]?(?:\s*(?:Carbon|mini))?|H2D)/i),i=r?r[1].trim():null,a=n.match(/(\d+\.?\d*)\s*(?:mm\s*)?nozzle|nozzle\s*(\d+\.?\d*)/i),o=a?(a[1]||a[2])+`mm`:null,s=n.match(/(\d+\.?\d*)mm\s*(?:Standard|Fine|Extra Fine|Draft|Quality)?/i),c=s?s[1]+`mm`:null,l=n.match(/\b(PLA|PETG|ABS|ASA|TPU|PC|PA|PVA|HIPS|PP|PET(?:-?CF)?|PA(?:-?CF)?|PLA(?:-?CF)?)\b/i);return{printer:i,nozzle:o,layerHeight:c,filamentType:l?l[1].toUpperCase():null}}function _5(e){return/^(P[FPM]US|PF\d|PP\d)/.test(e)}function oqe({onSuccess:e,t}){let{showToast:n}=qd(),[r,i]=(0,f.useState)(`email`),[a,o]=(0,f.useState)(``),[s,c]=(0,f.useState)(``),[l,u]=(0,f.useState)(``),[d,p]=(0,f.useState)(``),[m,h]=(0,f.useState)(`global`),[g,_]=(0,f.useState)(null),[v,y]=(0,f.useState)(null),[b,x]=(0,f.useState)(!1),S=q({mutationFn:()=>Z.cloudLogin(a,s,m),onSuccess:r=>{if(x(r.reason===`captcha`),r.success)n(t(`profiles.login.toast.loggedIn`)),e();else if(r.reason===`captcha`)return;else r.needs_verification?(_(r.verification_type||`email`),y(r.tfa_key||null),r.verification_type===`totp`?n(t(`profiles.login.toast.enterTotp`)):n(t(`profiles.login.toast.codeSent`)),i(`code`)):n(r.message,`error`)},onError:e=>{x(!1),n(e.message,`error`)}}),C=q({mutationFn:()=>Z.cloudVerify(a,l,v||void 0,m),onSuccess:r=>{x(r.reason===`captcha`),r.success?(n(t(`profiles.login.toast.loggedIn`)),e()):r.reason!==`captcha`&&n(r.message,`error`)},onError:e=>{x(!1),n(e.message,`error`)}}),w=q({mutationFn:()=>Z.cloudSetToken(d,m),onSuccess:()=>{n(t(`profiles.login.toast.tokenSet`)),e()},onError:e=>n(e.message,`error`)}),T=e=>{e.preventDefault(),r===`email`?S.mutate():r===`code`?C.mutate():r===`token`&&w.mutate()},E=S.isPending||C.isPending||w.isPending;return(0,G.jsx)(zd,{className:`max-w-md mx-auto`,children:(0,G.jsxs)(Vd,{children:[(0,G.jsxs)(`div`,{className:`text-center mb-6`,children:[(0,G.jsx)(`div`,{className:`inline-flex items-center justify-center w-12 h-12 rounded-xl bg-bambu-green/20 mb-3`,children:(0,G.jsx)(Ds,{className:`w-6 h-6 text-bambu-green`})}),(0,G.jsx)(`h2`,{className:`text-xl font-semibold text-white`,children:t(`profiles.login.title`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:t(`profiles.login.subtitle`)})]}),b&&r!==`token`&&(0,G.jsx)(`div`,{role:`alert`,className:`mb-4 p-3 rounded-lg border border-amber-500/40 bg-amber-500/10`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(Ql,{className:`w-4 h-4 text-amber-400 shrink-0 mt-0.5`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-sm font-medium text-amber-300`,children:t(`profiles.login.captchaTitle`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:t(`profiles.login.captchaBody`)}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>{x(!1),i(`token`)},className:`mt-2 text-xs text-bambu-green hover:underline flex items-center gap-1`,children:[(0,G.jsx)(Bc,{className:`w-3 h-3`}),t(`profiles.login.useToken`)]})]})]})}),(0,G.jsxs)(`form`,{onSubmit:T,className:`space-y-4`,children:[r===`email`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:t(`profiles.login.email`)}),(0,G.jsx)(`input`,{type:`email`,value:a,onChange:e=>o(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray-dark focus:border-bambu-green focus:outline-none`,placeholder:`your@email.com`,required:!0})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:t(`profiles.login.password`)}),(0,G.jsx)(`input`,{type:`password`,value:s,onChange:e=>c(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray-dark focus:border-bambu-green focus:outline-none`,placeholder:`••••••••`,required:!0})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:t(`profiles.login.region`)}),(0,G.jsxs)(`select`,{value:m,onChange:e=>h(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,G.jsx)(`option`,{value:`global`,children:t(`profiles.login.regionGlobal`)}),(0,G.jsx)(`option`,{value:`china`,children:t(`profiles.login.regionChina`)})]})]})]}),r===`code`&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:t(g===`totp`?`profiles.login.totpCode`:`profiles.login.verificationCode`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mb-2`,children:g===`totp`?t(`profiles.login.enterTotpHint`):t(`profiles.login.checkEmail`,{email:a})}),(0,G.jsx)(`input`,{type:`text`,value:l,onChange:e=>u(e.target.value.replace(/\D/g,``).slice(0,6)),className:`w-full px-3 py-3 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-center text-2xl tracking-widest font-mono focus:border-bambu-green focus:outline-none`,placeholder:`000000`,maxLength:6,required:!0})]}),r===`token`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:t(`profiles.login.accessToken`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mb-2`,children:t(`profiles.login.accessTokenHint`)}),(0,G.jsx)(`textarea`,{value:d,onChange:e=>p(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-xs font-mono placeholder-bambu-gray-dark focus:border-bambu-green focus:outline-none resize-none`,placeholder:`eyJ...`,rows:4,required:!0})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:t(`profiles.login.region`)}),(0,G.jsxs)(`select`,{value:m,onChange:e=>h(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,G.jsx)(`option`,{value:`global`,children:t(`profiles.login.regionGlobal`)}),(0,G.jsx)(`option`,{value:`china`,children:t(`profiles.login.regionChina`)})]})]})]}),(0,G.jsxs)(`div`,{className:`flex gap-2 max-[550px]:flex-wrap max-[550px]:items-center`,children:[r===`code`&&(0,G.jsx)(Q,{type:`button`,variant:`secondary`,onClick:()=>i(`email`),className:`flex-1`,children:t(`profiles.login.back`)}),(0,G.jsxs)(Q,{type:`submit`,disabled:E,className:`flex-1`,children:[E?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(Zc,{className:`w-4 h-4`}),t(r===`email`?`profiles.login.loginButton`:r===`code`?`profiles.login.verifyButton`:`profiles.login.setTokenButton`)]})]}),r===`email`&&(0,G.jsx)(`div`,{className:`pt-4 border-t border-bambu-dark-tertiary`,children:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>i(`token`),className:`text-sm text-bambu-gray hover:text-white flex items-center gap-2 transition-colors`,children:[(0,G.jsx)(Bc,{className:`w-4 h-4`}),t(`profiles.login.useToken`)]})}),r===`token`&&(0,G.jsx)(`div`,{className:`pt-4 border-t border-bambu-dark-tertiary`,children:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>i(`email`),className:`text-sm text-bambu-gray hover:text-white flex items-center gap-2 transition-colors`,children:[(0,G.jsx)(Zc,{className:`w-4 h-4`}),t(`profiles.login.useEmail`)]})})]})]})})}function v5({label:e,value:t,options:n,onChange:r}){let[i,a]=(0,f.useState)(!1),o=n.find(e=>e.value===t);return(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsxs)(`button`,{onClick:()=>a(!i),className:`flex items-center gap-2 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-sm text-white hover:border-bambu-gray-dark transition-colors`,children:[(0,G.jsxs)(`span`,{className:`text-bambu-gray`,children:[e,`:`]}),(0,G.jsx)(`span`,{children:o?.label||`All`}),(0,G.jsx)(as,{className:`w-4 h-4 text-bambu-gray transition-transform ${i?`rotate-180`:``}`})]}),i&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`fixed inset-0 z-10`,onClick:()=>a(!1)}),(0,G.jsx)(`div`,{className:`absolute top-full left-0 mt-1 min-w-[160px] bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl z-20 py-1 max-h-60 overflow-y-auto`,children:n.map(e=>(0,G.jsxs)(`button`,{onClick:()=>{r(e.value),a(!1)},className:`w-full px-3 py-2 text-left text-sm flex items-center justify-between hover:bg-bambu-dark-tertiary transition-colors ${t===e.value?`text-bambu-green`:`text-white`}`,children:[(0,G.jsx)(`span`,{children:e.label}),e.count!==void 0&&(0,G.jsx)(`span`,{className:`text-bambu-gray text-xs`,children:e.count})]},e.value))})]})]})}function sqe(){let[e,t]=(0,f.useState)(!1);return(0,f.useEffect)(()=>{let e=()=>{t(window.scrollY>300)};return window.addEventListener(`scroll`,e),()=>window.removeEventListener(`scroll`,e)},[]),e?(0,G.jsx)(`button`,{onClick:()=>{window.scrollTo({top:0,behavior:`smooth`})},className:`fixed bottom-24 right-6 p-3 bg-bambu-green hover:bg-bambu-green-light text-white rounded-full shadow-lg shadow-bambu-green/25 transition-all z-40`,"aria-label":`Scroll to top`,children:(0,G.jsx)(Io,{className:`w-5 h-5`})}):null}function y5({setting:e,onClick:t,onDuplicate:n,compareMode:r,isCompareSelected:i,compareIndex:a,compareDisabled:o,t:s}){let c=g5(e.name),l=_5(e.setting_id);return(0,G.jsxs)(`div`,{className:`flex items-center gap-2 group`,children:[(0,G.jsx)(`button`,{onClick:t,disabled:o,className:`flex-1 text-left px-3 py-2 rounded transition-colors ${i?`bg-blue-500/20 border border-blue-500/50`:o?`bg-bambu-dark/50 opacity-40 cursor-not-allowed`:`bg-bambu-dark hover:bg-bambu-dark-tertiary`} ${r&&!o?`cursor-pointer`:``}`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i&&a!==void 0&&(0,G.jsx)(`span`,{className:`flex-shrink-0 w-5 h-5 rounded-full bg-blue-500 text-white text-xs flex items-center justify-center font-medium`,children:a+1}),!i&&l&&(0,G.jsx)(`span`,{className:`flex-shrink-0 w-1.5 h-1.5 rounded-full bg-bambu-green`,title:s(`profiles.presets.myPreset`)}),(0,G.jsx)(`span`,{className:`text-white text-sm truncate flex-1`,title:e.name,children:e.name}),c.filamentType&&e.type===`filament`&&(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray whitespace-nowrap`,children:c.filamentType}),c.layerHeight&&e.type===`process`&&(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray whitespace-nowrap`,children:c.layerHeight}),c.printer&&(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray whitespace-nowrap`,children:c.printer})]})}),(0,G.jsx)(`button`,{onClick:e=>{e.stopPropagation(),n()},className:`can-hover:opacity-0 group-hover:opacity-100 focus-visible:opacity-100 text-bambu-gray hover:text-white transition-all p-1`,title:s(`profiles.presets.duplicate`),children:(0,G.jsx)(Ps,{className:`w-4 h-4`})})]})}function b5(e,t=0){let n=` `.repeat(t);if(e===null)return`null`;if(e===void 0)return`undefined`;if(typeof e==`string`){if(e.includes(`\\n`)||e.includes(` +`)),i(!0),setTimeout(()=>i(!1),2e3)},className:`flex items-center gap-2`,children:[(0,G.jsx)(Ps,{className:`w-4 h-4`}),n(r?`common.copied`:`common.copy`)]}),(0,G.jsx)(Q,{variant:`primary`,size:`sm`,onClick:t,className:`flex-1`,children:n(`settings.twoFa.savedCodes`)})]})]})}function TKe({onDone:e}){let{t}=U(),n=no(),{showToast:r}=qd(),[i,a]=(0,f.useState)(`qr`),[o,s]=(0,f.useState)(``),[c,l]=(0,f.useState)([]),[u,d]=(0,f.useState)(!1),{data:p,isLoading:m}=K({queryKey:[`totp-setup`],queryFn:()=>Z.setupTOTP(),staleTime:1/0}),h=q({mutationFn:e=>Z.enableTOTP(e),onSuccess:e=>{l(e.backup_codes),a(`backup`),n.invalidateQueries({queryKey:[`2fa-status`]})},onError:()=>r(t(`settings.twoFa.invalidCode`),`error`)});return m||!p?(0,G.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,G.jsx)(Il,{className:`w-6 h-6 animate-spin text-bambu-green`})}):i===`qr`?(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`p`,{className:`text-bambu-gray-light text-sm`,children:t(`settings.twoFa.setupInstructions`)}),(0,G.jsx)(`div`,{className:`flex justify-center`,children:(0,G.jsx)(`img`,{src:`data:image/png;base64,${p.qr_code_b64}`,alt:`TOTP QR Code`,className:`w-48 h-48 rounded-lg`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mb-1`,children:t(`settings.twoFa.manualEntry`)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 bg-bambu-dark-secondary rounded-lg px-3 py-2`,children:[(0,G.jsx)(`code`,{className:`text-white text-xs font-mono flex-1 break-all`,children:u?p.secret:`••••••••••••••••`}),(0,G.jsx)(`button`,{onClick:()=>d(!u),className:`text-bambu-gray hover:text-white`,children:u?(0,G.jsx)(Zs,{className:`w-4 h-4`}):(0,G.jsx)(Qs,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{onClick:()=>{navigator.clipboard.writeText(p.secret)},className:`text-bambu-gray hover:text-white`,children:(0,G.jsx)(Ps,{className:`w-4 h-4`})})]})]}),(0,G.jsx)(Q,{variant:`primary`,className:`w-full`,onClick:()=>a(`confirm`),children:t(`settings.twoFa.scannedContinue`)})]}):i===`confirm`?(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`p`,{className:`text-bambu-gray-light text-sm`,children:t(`settings.twoFa.enterCodeToConfirm`)}),(0,G.jsx)(I8,{value:o,onChange:s,placeholder:`000000`}),(0,G.jsxs)(`div`,{className:`flex gap-3`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>a(`qr`),className:`flex-1`,children:t(`common.back`)}),(0,G.jsx)(Q,{variant:`primary`,className:`flex-1`,disabled:o.length!==6||h.isPending,onClick:()=>h.mutate(o),children:h.isPending?t(`common.saving`):t(`settings.twoFa.activate`)})]})]}):(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`h3`,{className:`text-white font-medium`,children:t(`settings.twoFa.backupCodesTitle`)}),(0,G.jsx)(L8,{codes:c,onDone:e})]})}function EKe(){let{t:e}=U(),t=no(),{showToast:n}=qd(),{user:r}=Nd(),[i,a]=(0,f.useState)(!1),[o,s]=(0,f.useState)(!1),[c,l]=(0,f.useState)(!1),[u,d]=(0,f.useState)(``),[p,m]=(0,f.useState)(``),[h,g]=(0,f.useState)(null),[_,v]=(0,f.useState)(null),[y,b]=(0,f.useState)(``),[x,S]=(0,f.useState)(!1),[C,w]=(0,f.useState)(``),[T,E]=(0,f.useState)(!1),{data:D,isLoading:O}=K({queryKey:[`2fa-status`],queryFn:()=>Z.get2FAStatus()}),{data:k}=K({queryKey:[`oidc-links`],queryFn:()=>Z.getOIDCLinks()}),A=q({mutationFn:()=>Z.enableEmailOTP(),onSuccess:e=>{v(e.setup_token),n(e.message,`success`)},onError:t=>{let r=t.message??``;r.toLowerCase().includes(`smtp`)?n(e(`settings.twoFa.smtpRequired`),`error`):n(r,`error`)}}),j=q({mutationFn:()=>Z.confirmEnableEmailOTP(_,y),onSuccess:()=>{t.invalidateQueries({queryKey:[`2fa-status`]}),v(null),b(``),n(e(`settings.twoFa.emailOtpEnabled`),`success`)},onError:e=>n(e.message,`error`)}),M=q({mutationFn:e=>Z.disableEmailOTP(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`2fa-status`]}),S(!1),w(``),n(e(`settings.twoFa.emailOtpDisabled`),`success`)},onError:e=>n(e.message,`error`)}),N=q({mutationFn:e=>Z.disableTOTP(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`2fa-status`]}),s(!1),d(``),n(e(`settings.twoFa.totpDisabled`),`success`)},onError:()=>n(e(`settings.twoFa.invalidCode`),`error`)}),P=q({mutationFn:e=>Z.regenerateBackupCodes(e),onSuccess:e=>{t.invalidateQueries({queryKey:[`2fa-status`]}),l(!1),m(``),g(e.backup_codes)},onError:()=>n(e(`settings.twoFa.invalidCode`),`error`)}),F=q({mutationFn:e=>Z.deleteOIDCLink(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`oidc-links`]}),n(e(`settings.twoFa.oidcUnlinked`),`success`)},onError:e=>n(e.message,`error`)});if(O)return(0,G.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,G.jsx)(Il,{className:`w-6 h-6 animate-spin text-bambu-green`})});let I=!!r?.email;return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(zd,{id:`card-2fa-totp`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-10 h-10 rounded-full flex items-center justify-center ${D?.totp_enabled?`bg-green-100 dark:bg-green-500/20`:`bg-gray-500/20`}`,children:(0,G.jsx)(cu,{className:`w-5 h-5 ${D?.totp_enabled?`text-green-600 dark:text-green-400`:`text-gray-400`}`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-white font-semibold`,children:e(`settings.twoFa.totpTitle`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-sm`,children:e(`settings.twoFa.totpDesc`)})]}),(0,G.jsx)(`div`,{className:`ml-auto`,children:D?.totp_enabled?(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-green-700 dark:text-green-400 text-sm font-medium`,children:[(0,G.jsx)($l,{className:`w-4 h-4`}),` `,e(`common.enabled`)]}):(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-bambu-gray text-sm`,children:[(0,G.jsx)(eu,{className:`w-4 h-4`}),` `,e(`common.disabled`)]})})]})}),(0,G.jsx)(Vd,{children:i?(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,G.jsx)(`h4`,{className:`text-white font-medium`,children:e(`settings.twoFa.setupAuthApp`)}),(0,G.jsx)(`button`,{onClick:()=>{a(!1),t.removeQueries({queryKey:[`totp-setup`]})},className:`text-bambu-gray hover:text-white`,children:(0,G.jsx)($u,{className:`w-5 h-5`})})]}),(0,G.jsx)(TKe,{onDone:()=>{a(!1),t.removeQueries({queryKey:[`totp-setup`]})}})]}):o?(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`p`,{className:`text-bambu-gray-light text-sm`,children:e(`settings.twoFa.disableConfirmHint`)}),(0,G.jsx)(I8,{value:u,onChange:d,placeholder:`000000 or XXXXXXXX`,maxLength:8}),(0,G.jsxs)(`div`,{className:`flex gap-3`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>{s(!1),d(``)},className:`flex-1`,children:e(`common.cancel`)}),(0,G.jsx)(Q,{variant:`danger`,className:`flex-1`,disabled:u.length<6||N.isPending,onClick:()=>N.mutate(u),children:N.isPending?e(`common.saving`):e(`settings.twoFa.disableTotp`)})]})]}):c?(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`p`,{className:`text-bambu-gray-light text-sm`,children:e(`settings.twoFa.regenBackupHint`)}),(0,G.jsx)(I8,{value:p,onChange:m,placeholder:`000000 or XXXXXXXX`,maxLength:8}),(0,G.jsxs)(`div`,{className:`flex gap-3`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>{l(!1),m(``)},className:`flex-1`,children:e(`common.cancel`)}),(0,G.jsx)(Q,{variant:`primary`,className:`flex-1`,disabled:p.length<6||P.isPending,onClick:()=>P.mutate(p),children:P.isPending?e(`common.saving`):e(`settings.twoFa.regenBackup`)})]})]}):h?(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`h4`,{className:`text-white font-medium`,children:e(`settings.twoFa.newBackupCodes`)}),(0,G.jsx)(L8,{codes:h,onDone:()=>g(null)})]}):(0,G.jsx)(`div`,{className:`space-y-3`,children:D?.totp_enabled?(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-bambu-gray-light`,children:[(0,G.jsx)(Bc,{className:`w-4 h-4`}),e(`settings.twoFa.backupCodesRemaining`,{count:D.backup_codes_remaining})]}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:()=>l(!0),className:`flex items-center gap-2`,children:[(0,G.jsx)(Il,{className:`w-4 h-4`}),e(`settings.twoFa.regenBackup`)]}),(0,G.jsxs)(Q,{variant:`danger`,size:`sm`,onClick:()=>s(!0),className:`flex items-center gap-2`,children:[(0,G.jsx)(ju,{className:`w-4 h-4`}),e(`settings.twoFa.disableTotp`)]})]}):(0,G.jsxs)(Q,{variant:`primary`,onClick:()=>a(!0),className:`flex items-center gap-2`,children:[(0,G.jsx)(cu,{className:`w-4 h-4`}),e(`settings.twoFa.setupTotp`)]})})})]}),(0,G.jsxs)(zd,{id:`card-2fa-emailotp`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-10 h-10 rounded-full flex items-center justify-center ${D?.email_otp_enabled?`bg-green-100 dark:bg-green-500/20`:`bg-gray-500/20`}`,children:(0,G.jsx)($c,{className:`w-5 h-5 ${D?.email_otp_enabled?`text-green-600 dark:text-green-400`:`text-gray-400`}`})}),(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`h3`,{className:`text-white font-semibold`,children:e(`settings.twoFa.emailOtpTitle`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-sm`,children:I?e(`settings.twoFa.emailOtpDesc`,{email:r?.email}):e(`settings.twoFa.emailOtpNoEmail`)})]}),(0,G.jsx)(`div`,{className:`ml-auto`,children:D?.email_otp_enabled?(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-green-700 dark:text-green-400 text-sm font-medium`,children:[(0,G.jsx)($l,{className:`w-4 h-4`}),` `,e(`common.enabled`)]}):(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-bambu-gray text-sm`,children:[(0,G.jsx)(eu,{className:`w-4 h-4`}),` `,e(`common.disabled`)]})})]})}),(0,G.jsx)(Vd,{children:I?_?(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`p`,{className:`text-bambu-gray-light text-sm`,children:e(`settings.twoFa.emailSetupEnterCode`)}),(0,G.jsx)(I8,{value:y,onChange:b,placeholder:`000000`}),(0,G.jsxs)(`div`,{className:`flex gap-3`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>{v(null),b(``)},className:`flex-1`,children:e(`common.cancel`)}),(0,G.jsx)(Q,{variant:`primary`,className:`flex-1`,disabled:y.length!==6||j.isPending,onClick:()=>j.mutate(),children:j.isPending?e(`common.saving`):e(`settings.twoFa.verifyAndEnable`)})]})]}):x?(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`p`,{className:`text-bambu-gray-light text-sm`,children:e(`settings.twoFa.emailDisablePasswordHint`)}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(`input`,{type:T?`text`:`password`,value:C,onChange:e=>w(e.target.value),placeholder:e(`settings.twoFa.passwordPlaceholder`),className:`w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>E(!T),className:`absolute right-3 top-1/2 -translate-y-1/2 text-bambu-gray hover:text-white`,children:T?(0,G.jsx)(Zs,{className:`w-5 h-5`}):(0,G.jsx)(Qs,{className:`w-5 h-5`})})]}),(0,G.jsxs)(`div`,{className:`flex gap-3`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>{S(!1),w(``)},className:`flex-1`,children:e(`common.cancel`)}),(0,G.jsx)(Q,{variant:`danger`,className:`flex-1`,disabled:!C||M.isPending,onClick:()=>M.mutate(C),children:M.isPending?e(`common.saving`):e(`settings.twoFa.disableEmailOtp`)})]})]}):(0,G.jsx)(`div`,{className:`flex gap-3`,children:D?.email_otp_enabled?(0,G.jsxs)(Q,{variant:`danger`,size:`sm`,onClick:()=>S(!0),className:`flex items-center gap-2`,children:[(0,G.jsx)(ju,{className:`w-4 h-4`}),e(`settings.twoFa.disableEmailOtp`)]}):(0,G.jsxs)(Q,{variant:`primary`,disabled:!I||A.isPending,onClick:()=>A.mutate(),className:`flex items-center gap-2`,children:[(0,G.jsx)($c,{className:`w-4 h-4`}),A.isPending?e(`common.saving`):e(`settings.twoFa.enableEmailOtp`)]})}):(0,G.jsx)(`p`,{className:`text-amber-700 dark:text-amber-400 text-sm`,children:e(`settings.twoFa.addEmailFirst`)})})]}),k&&k.length>0&&(0,G.jsxs)(zd,{id:`card-2fa-linked`,children:[(0,G.jsxs)(Bd,{children:[(0,G.jsx)(`h3`,{className:`text-white font-semibold`,children:e(`settings.twoFa.linkedAccounts`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-sm`,children:e(`settings.twoFa.linkedAccountsDesc`)})]}),(0,G.jsx)(Vd,{children:(0,G.jsx)(`div`,{className:`space-y-3`,children:k.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center justify-between py-2 border-b border-bambu-dark-tertiary last:border-0`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white text-sm font-medium`,children:e.provider_name}),e.provider_email&&(0,G.jsx)(`p`,{className:`text-bambu-gray text-xs`,children:e.provider_email})]}),(0,G.jsx)(Q,{variant:`danger`,size:`sm`,onClick:()=>F.mutate(e.provider_id),disabled:F.isPending,children:(0,G.jsx)(ju,{className:`w-4 h-4`})})]},e.id))})})]})]})}var DKe={name:``,issuer_url:``,client_id:``,client_secret:``,scopes:`openid email profile`,is_enabled:!0,auto_create_users:!1,auto_link_existing_accounts:!1,email_claim:`email`,require_email_verified:!0,group_claim:`groups`,group_mapping:{},icon_url:void 0,default_group_id:null,is_autologin:!1};function R8({initial:e,isEdit:t=!1,groups:n=[],onSave:r,onCancel:i,isPending:a}){let{t:o}=U(),[s,c]=(0,f.useState)(e),[l,u]=(0,f.useState)(!1),[d,p]=(0,f.useState)(()=>Object.entries(e.group_mapping??{}).map(([e,t])=>({idpGroup:e,bambuddyGroup:t}))),m=()=>p(e=>[...e,{idpGroup:``,bambuddyGroup:``}]),h=e=>p(t=>t.filter((t,n)=>n!==e)),g=(e,t)=>p(n=>n.map((n,r)=>r===e?{...n,...t}:n)),_=(e,t)=>c(n=>({...n,[e]:t})),v=`w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors text-sm`,y=`block text-sm font-medium text-white mb-1`,b=()=>{let e={...s};t&&!l&&delete e.client_secret,(!e.group_claim||!e.group_claim.trim())&&(e.group_claim=`groups`);let n={};for(let e of d){let t=e.idpGroup.trim();t&&e.bambuddyGroup&&(n[t]=e.bambuddyGroup)}e.group_mapping=n,r(e)},x=new Set(n.map(e=>e.name)),S=d.map((e,t)=>{let n=e.idpGroup.trim();if(!n&&!e.bambuddyGroup)return null;if(!n||!e.bambuddyGroup)return`incomplete`;let r=n.toLowerCase();return d.slice(0,t).some(e=>e.idpGroup.trim().toLowerCase()===r)?`duplicate`:null}),C=S.some(e=>e!==null),w=s.auto_link_existing_accounts===!0,T=s.require_email_verified??!0,E;return E=w?o(`settings.oidc.form.requireEmailVerifiedAutoLink`):T?o(`settings.oidc.form.requireEmailVerifiedDesc`):(0,G.jsx)(`span`,{className:`text-red-700 dark:text-red-400`,children:o(`settings.oidc.form.requireEmailVerifiedWarning`)}),(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{className:y,children:[o(`settings.oidc.form.name`),` `,(0,G.jsx)(`span`,{className:`text-red-700 dark:text-red-400`,children:`*`})]}),(0,G.jsx)(`input`,{className:v,value:s.name,onChange:e=>_(`name`,e.target.value),placeholder:`Google`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{className:y,children:[o(`settings.oidc.form.issuerUrl`),` `,(0,G.jsx)(`span`,{className:`text-red-700 dark:text-red-400`,children:`*`})]}),(0,G.jsx)(`input`,{className:v,value:s.issuer_url,onChange:e=>_(`issuer_url`,e.target.value),placeholder:`https://accounts.google.com`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{className:y,children:[o(`settings.oidc.form.clientId`),` `,(0,G.jsx)(`span`,{className:`text-red-700 dark:text-red-400`,children:`*`})]}),(0,G.jsx)(`input`,{className:v,value:s.client_id,onChange:e=>_(`client_id`,e.target.value),placeholder:`your-client-id`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{className:y,children:[o(`settings.oidc.form.clientSecret`),!t&&(0,G.jsx)(`span`,{className:`text-red-700 dark:text-red-400`,children:` *`}),t&&(0,G.jsxs)(`span`,{className:`text-bambu-gray text-xs ml-1`,children:[`(`,o(`settings.oidc.form.secretHint`),`)`]})]}),(0,G.jsx)(`input`,{className:v,type:`password`,value:l?s.client_secret:``,placeholder:t&&!l?`••••••••`:o(`settings.oidc.form.secretPlaceholder`),onChange:e=>{u(!0),_(`client_secret`,e.target.value)}})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:y,children:o(`settings.oidc.form.scopes`)}),(0,G.jsx)(`input`,{className:v,value:s.scopes,onChange:e=>_(`scopes`,e.target.value),placeholder:`openid email profile`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:y,children:o(`settings.oidc.form.iconUrl`)}),(0,G.jsx)(`input`,{className:v,value:s.icon_url??``,onChange:e=>_(`icon_url`,e.target.value===``?null:e.target.value),placeholder:`https://...`})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-6 pt-2`,children:[(0,G.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,G.jsx)(HH,{checked:s.is_enabled??!0,onChange:e=>_(`is_enabled`,e)}),(0,G.jsx)(`span`,{className:`text-white text-sm`,children:o(`settings.oidc.form.enabled`)})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,G.jsx)(HH,{checked:s.auto_create_users??!1,onChange:e=>_(`auto_create_users`,e)}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white text-sm`,children:o(`settings.oidc.form.autoCreate`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-xs`,children:o(`settings.oidc.form.autoCreateDesc`)})]})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer w-full`,children:[(0,G.jsx)(HH,{checked:s.auto_link_existing_accounts??!1,onChange:e=>_(`auto_link_existing_accounts`,e)}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white text-sm`,children:o(`settings.oidc.form.autoLink`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-xs`,children:o(`settings.oidc.form.autoLinkDesc`)})]})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer w-full`,children:[(0,G.jsx)(HH,{checked:T,onChange:e=>_(`require_email_verified`,e),disabled:w}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white text-sm`,children:o(`settings.oidc.form.requireEmailVerified`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-xs`,children:E})]})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer w-full`,children:[(0,G.jsx)(HH,{checked:s.is_autologin??!1,onChange:e=>_(`is_autologin`,e)}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white text-sm`,children:o(`settings.oidc.form.autologin`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-xs`,children:o(`settings.oidc.form.autologinDesc`)})]})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:y,children:o(`settings.oidc.form.emailClaim`)}),(0,G.jsx)(`input`,{className:v,value:s.email_claim,onChange:e=>_(`email_claim`,e.target.value||`email`),placeholder:o(`settings.oidc.form.emailClaimPlaceholder`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-xs mt-1`,children:o(`settings.oidc.form.emailClaimDesc`)}),w&&s.email_claim!==`email`&&(0,G.jsx)(`p`,{className:`text-yellow-700 dark:text-yellow-400 text-xs mt-1`,children:o(`settings.oidc.form.emailClaimCustomClaimAutoLinkWarning`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:y,children:o(`settings.oidc.form.defaultGroup`)}),(0,G.jsxs)(`select`,{className:v,value:s.default_group_id??``,onChange:e=>_(`default_group_id`,e.target.value?Number(e.target.value):null),children:[(0,G.jsx)(`option`,{value:``,children:o(`settings.oidc.form.defaultGroupViewersFallback`)}),n.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-xs mt-1`,children:o(`settings.oidc.form.defaultGroupDesc`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:y,children:o(`settings.oidc.form.groupClaim`)}),(0,G.jsx)(`input`,{className:v,value:s.group_claim??`groups`,onChange:e=>_(`group_claim`,e.target.value),placeholder:`groups`}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-xs mt-1`,children:o(`settings.oidc.form.groupClaimDesc`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:y,children:o(`settings.oidc.form.groupMapping`)}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[d.map((e,t)=>{let r=e.bambuddyGroup!==``&&!x.has(e.bambuddyGroup);return(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{className:v,value:e.idpGroup,onChange:e=>g(t,{idpGroup:e.target.value}),placeholder:o(`settings.oidc.form.groupMappingIdpGroupPlaceholder`)}),(0,G.jsx)(`span`,{className:`text-bambu-gray text-sm shrink-0`,children:`→`}),(0,G.jsxs)(`select`,{className:`${v} ${r?`border-red-700 dark:border-red-400 text-red-700 dark:text-red-400`:``}`,value:e.bambuddyGroup,onChange:e=>g(t,{bambuddyGroup:e.target.value}),children:[(0,G.jsx)(`option`,{value:``,children:o(`settings.oidc.form.groupMappingSelectGroup`)}),r&&(0,G.jsx)(`option`,{value:e.bambuddyGroup,children:o(`settings.oidc.form.groupMappingDeletedGroupOption`,{group:e.bambuddyGroup})}),n.map(e=>(0,G.jsx)(`option`,{value:e.name,children:e.name},e.id))]}),(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:()=>h(t),title:o(`common.remove`),children:(0,G.jsx)(ju,{className:`w-4 h-4`})})]}),r&&(0,G.jsx)(`p`,{className:`text-red-700 dark:text-red-400 text-xs mt-1`,children:o(`settings.oidc.form.groupMappingDeletedGroupWarning`)}),S[t]&&(0,G.jsx)(`p`,{className:`text-red-700 dark:text-red-400 text-xs mt-1`,children:S[t]===`incomplete`?o(`settings.oidc.form.groupMappingIncompleteRow`):o(`settings.oidc.form.groupMappingDuplicateRow`)})]},t)}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:m,className:`inline-flex items-center gap-2`,children:[(0,G.jsx)(kl,{className:`w-4 h-4`}),o(`settings.oidc.form.groupMappingAddRow`)]})]}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-xs mt-1`,children:o(`settings.oidc.form.groupMappingDesc`)})]}),(0,G.jsxs)(`div`,{className:`flex gap-3 pt-2`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:i,className:`flex-1`,children:o(`common.cancel`)}),(0,G.jsx)(Q,{variant:`primary`,className:`flex-1`,disabled:!s.name||!s.issuer_url||!s.client_id||!t&&!s.client_secret||t&&l&&!s.client_secret||C||a,onClick:b,children:o(a?`common.saving`:`common.save`)})]})]})}function OKe({provider:e}){let[t,n]=(0,f.useState)(!1);return e.has_icon&&!t?(0,G.jsx)(`img`,{src:Z.oidcProviderIconUrl(e.id),alt:e.name,className:`w-8 h-8 rounded object-contain`,onError:()=>n(!0)}):(0,G.jsx)(`div`,{className:`w-8 h-8 rounded-full bg-bambu-dark-tertiary flex items-center justify-center`,children:(0,G.jsx)(Cc,{className:`w-4 h-4 text-bambu-gray`})})}function kKe(){let{t:e}=U(),t=no(),{showToast:n}=qd(),[r,i]=(0,f.useState)(!1),[a,o]=(0,f.useState)(null),[s,c]=(0,f.useState)(null),{data:l,isLoading:u}=K({queryKey:[`oidc-providers-all`],queryFn:()=>Z.getOIDCProvidersAll()}),{data:d=[]}=K({queryKey:[`groups`],queryFn:()=>Z.getGroups()}),p=q({mutationFn:e=>Z.createOIDCProvider(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`oidc-providers-all`]}),i(!1),n(e(`settings.oidc.created`),`success`)},onError:e=>n(e.message,`error`)}),m=q({mutationFn:({id:e,data:t})=>Z.updateOIDCProvider(e,t),onSuccess:()=>{t.invalidateQueries({queryKey:[`oidc-providers-all`]}),o(null),n(e(`settings.oidc.updated`),`success`)},onError:e=>n(e.message,`error`)}),h=q({mutationFn:e=>Z.deleteOIDCProvider(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`oidc-providers-all`]}),c(null),n(e(`settings.oidc.deleted`),`success`)},onError:e=>n(e.message,`error`)}),g=q({mutationFn:e=>Z.refreshOIDCProviderIcon(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`oidc-providers-all`]}),t.invalidateQueries({queryKey:[`oidc-providers`]}),n(e(`settings.oidc.iconRefreshed`),`success`)},onError:t=>n(t.message||e(`settings.oidc.iconFetchFailed`),`error`)}),_=q({mutationFn:e=>Z.deleteOIDCProviderIcon(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`oidc-providers-all`]}),t.invalidateQueries({queryKey:[`oidc-providers`]}),n(e(`settings.oidc.iconRemoved`),`success`)},onError:e=>n(e.message,`error`)}),v=e=>m.mutate({id:e.id,data:{is_enabled:!e.is_enabled}});return u?(0,G.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,G.jsx)(Il,{className:`w-6 h-6 animate-spin text-bambu-green`})}):(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(zd,{id:`card-oidc`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-white font-semibold`,children:e(`settings.oidc.title`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-sm`,children:e(`settings.oidc.desc`)})]}),!r&&(0,G.jsxs)(Q,{variant:`primary`,size:`sm`,onClick:()=>i(!0),className:`flex items-center gap-2`,children:[(0,G.jsx)(kl,{className:`w-4 h-4`}),e(`settings.oidc.addProvider`)]})]})}),r&&(0,G.jsx)(Vd,{children:(0,G.jsxs)(`div`,{className:`border-t border-bambu-dark-tertiary pt-4`,children:[(0,G.jsx)(`h4`,{className:`text-white font-medium mb-4`,children:e(`settings.oidc.newProvider`)}),(0,G.jsx)(R8,{initial:DKe,groups:d,onSave:e=>p.mutate(e),onCancel:()=>i(!1),isPending:p.isPending})]})})]}),l&&l.length===0&&!r&&(0,G.jsx)(zd,{id:`card-oidc-empty`,children:(0,G.jsx)(Vd,{children:(0,G.jsxs)(`div`,{className:`text-center py-8 space-y-3`,children:[(0,G.jsx)(Cc,{className:`w-12 h-12 text-bambu-gray mx-auto`}),(0,G.jsx)(`p`,{className:`text-bambu-gray`,children:e(`settings.oidc.empty`)}),(0,G.jsxs)(Q,{variant:`primary`,size:`sm`,onClick:()=>i(!0),className:`inline-flex items-center gap-2`,children:[(0,G.jsx)(kl,{className:`w-4 h-4`}),e(`settings.oidc.addProvider`)]})]})})}),l?.map(t=>(0,G.jsxs)(zd,{children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(OKe,{provider:t}),(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`h4`,{className:`text-white font-medium`,children:t.name}),t.is_enabled?(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-green-700 dark:text-green-400 bg-green-50 dark:bg-green-400/10 px-2 py-0.5 rounded-full`,children:[(0,G.jsx)(is,{className:`w-3 h-3`}),` `,e(`common.enabled`)]}):(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-bambu-gray bg-bambu-dark-tertiary px-2 py-0.5 rounded-full`,children:[(0,G.jsx)($u,{className:`w-3 h-3`}),` `,e(`common.disabled`)]}),t.is_env_managed&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-bambu-green`,children:[(0,G.jsx)(Xc,{className:`w-3 h-3`}),` `,e(`settings.environmentManagedLabel`)]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1 text-bambu-gray text-xs mt-0.5`,children:[(0,G.jsx)(Xs,{className:`w-3 h-3`}),(0,G.jsx)(`span`,{children:t.issuer_url})]})]}),(0,G.jsx)(`div`,{className:`flex items-center gap-2`,children:!t.is_env_managed&&(0,G.jsxs)(G.Fragment,{children:[t.icon_url&&(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:()=>g.mutate(t.id),disabled:g.isPending,title:e(`settings.oidc.refreshIcon`),"data-testid":`refresh-icon-${t.id}`,children:(0,G.jsx)(Il,{className:`w-4 h-4 ${g.isPending?`animate-spin`:``}`})}),t.has_icon&&(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:()=>_.mutate(t.id),disabled:_.isPending,title:e(`settings.oidc.removeIcon`),"data-testid":`remove-icon-${t.id}`,children:(0,G.jsx)(Fc,{className:`w-4 h-4`})}),(0,G.jsx)(HH,{checked:t.is_enabled,onChange:()=>v(t),disabled:m.isPending}),(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:()=>o(a===t.id?null:t.id),"data-testid":`edit-provider-${t.id}`,children:(0,G.jsx)(Cl,{className:`w-4 h-4`})}),(0,G.jsx)(Q,{variant:`danger`,size:`sm`,onClick:()=>c(t),"data-testid":`delete-provider-${t.id}`,children:(0,G.jsx)(ju,{className:`w-4 h-4`})})]})})]})}),a===t.id&&(0,G.jsx)(Vd,{children:(0,G.jsx)(`div`,{className:`border-t border-bambu-dark-tertiary pt-4`,children:(0,G.jsx)(R8,{isEdit:!0,groups:d,initial:{name:t.name,issuer_url:t.issuer_url,client_id:t.client_id,client_secret:``,scopes:t.scopes,is_enabled:t.is_enabled,auto_create_users:t.auto_create_users,auto_link_existing_accounts:t.auto_link_existing_accounts,email_claim:t.email_claim,require_email_verified:t.require_email_verified,group_claim:t.group_claim??`groups`,group_mapping:t.group_mapping??{},icon_url:t.icon_url??void 0,default_group_id:t.default_group_id??null,is_autologin:t.is_autologin},onSave:e=>m.mutate({id:t.id,data:e}),onCancel:()=>o(null),isPending:m.isPending})})}),a!==t.id&&(0,G.jsx)(Vd,{children:(0,G.jsxs)(`dl`,{className:`grid grid-cols-2 sm:grid-cols-3 gap-x-6 gap-y-2 text-sm`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-bambu-gray`,children:e(`settings.oidc.form.clientId`)}),(0,G.jsx)(`dd`,{className:`text-white font-mono truncate`,children:t.client_id})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-bambu-gray`,children:e(`settings.oidc.form.scopes`)}),(0,G.jsx)(`dd`,{className:`text-white`,children:t.scopes})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-bambu-gray`,children:e(`settings.oidc.form.autoCreate`)}),(0,G.jsx)(`dd`,{className:t.auto_create_users?`text-green-700 dark:text-green-400`:`text-bambu-gray`,children:t.auto_create_users?e(`common.yes`):e(`common.no`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-bambu-gray`,children:e(`settings.oidc.form.autoLink`)}),(0,G.jsx)(`dd`,{className:t.auto_link_existing_accounts?`text-green-700 dark:text-green-400`:`text-bambu-gray`,children:t.auto_link_existing_accounts?e(`common.yes`):e(`common.no`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-bambu-gray`,children:e(`settings.oidc.form.emailClaim`)}),(0,G.jsx)(`dd`,{className:`text-white font-mono`,children:t.email_claim})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-bambu-gray`,children:e(`settings.oidc.form.groupClaim`)}),(0,G.jsx)(`dd`,{className:`text-white font-mono`,children:t.group_claim??`groups`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-bambu-gray`,children:e(`settings.oidc.form.requireEmailVerified`)}),(0,G.jsx)(`dd`,{className:t.require_email_verified?`text-green-700 dark:text-green-400`:`text-red-700 dark:text-red-400`,children:t.require_email_verified?e(`common.yes`):e(`common.no`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-bambu-gray`,children:e(`settings.oidc.form.defaultGroup`)}),(0,G.jsx)(`dd`,{className:`text-white`,children:t.default_group_id?d.find(e=>e.id===t.default_group_id)?.name??e(`settings.oidc.form.defaultGroupViewersFallback`):e(`settings.oidc.form.defaultGroupViewersFallback`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-bambu-gray`,children:e(`settings.oidc.form.groupSync`)}),(0,G.jsx)(`dd`,{className:t.group_mapping&&Object.keys(t.group_mapping).length>0?`text-green-700 dark:text-green-400`:`text-bambu-gray`,children:t.group_mapping&&Object.keys(t.group_mapping).length>0?e(`settings.oidc.form.groupSyncOn`):e(`common.off`)})]})]})})]},t.id)),s&&(0,G.jsx)(af,{title:e(`settings.oidc.deleteTitle`),message:e(`settings.oidc.deleteMessage`,{name:s.name}),confirmText:e(`common.delete`),variant:`danger`,onConfirm:()=>h.mutate(s.id),onCancel:()=>c(null)})]})}var z8=new Map;function B8(e){z8.set(e.anchor,e)}function AKe(){return Array.from(z8.values())}B8({labelKey:`settings.encryption.title`,labelFallback:`MFA Encryption Status`,tab:`users`,subTab:`security`,keywords:`mfa encryption status security backup totp oidc fernet`,anchor:`card-mfa-encryption`});function jKe(){let{t:e}=U(),{data:t,isLoading:n,isError:r,refetch:i}=K({queryKey:[`encryptionStatus`],queryFn:()=>Z.getEncryptionStatus(),refetchInterval:e=>{if(!e.state.error)return 3e4;let t=e.state.fetchFailureCount??0;return t<=3?Math.min(5e3*Math.max(1,t),3e4):!1}});if(n)return(0,G.jsxs)(zd,{id:`card-mfa-encryption`,"data-testid":`encryption-status-card`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(tu,{className:`text-bambu-gray`,size:20}),(0,G.jsx)(`h2`,{className:`text-lg font-semibold`,children:e(`settings.encryption.title`)})]})}),(0,G.jsx)(Vd,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-bambu-gray`,"data-testid":`encryption-loading`,children:[(0,G.jsx)(Y,{className:`animate-spin`,size:16}),(0,G.jsx)(`span`,{children:e(`common.loading`)})]})})]});if(r||!t)return(0,G.jsxs)(zd,{id:`card-mfa-encryption`,"data-testid":`encryption-status-card`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(tu,{className:`text-bambu-gray`,size:20}),(0,G.jsx)(`h2`,{className:`text-lg font-semibold`,children:e(`settings.encryption.title`)})]})}),(0,G.jsxs)(Vd,{children:[(0,G.jsx)(`div`,{className:`text-red-700 dark:text-red-400`,"data-testid":`encryption-error`,children:e(`common.errorLoading`)}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>i(),className:`mt-2 text-sm text-blue-700 dark:text-blue-400 underline hover:text-blue-800 dark:hover:text-blue-300`,"data-testid":`encryption-retry-button`,children:e(`common.retry`)})]})]});let a=t.legacy_plaintext_rows.oidc_providers+t.legacy_plaintext_rows.user_totp,o=t.encrypted_rows.oidc_providers+t.encrypted_rows.user_totp,s,c,l,u;t.decryption_broken?(s=`bg-red-100 dark:bg-red-500/20 border-red-400 dark:border-red-500/50 text-red-700 dark:text-red-400`,c=(0,G.jsx)(bs,{className:`text-red-600 dark:text-red-400`,size:20}),l=e(`settings.encryption.decryptionBrokenTitle`),u=e(`settings.encryption.decryptionBrokenError`,{count:o})):t.key_source===`generated`?(s=`bg-amber-50 dark:bg-amber-500/10 border-amber-300 dark:border-amber-500/30 text-amber-700 dark:text-amber-400`,c=(0,G.jsx)($l,{className:`text-amber-600 dark:text-amber-400`,size:20}),l=e(`settings.encryption.enabledGenerated`),u=e(`settings.encryption.backupHint`)):a>0?(s=`bg-amber-50 dark:bg-amber-500/10 border-amber-300 dark:border-amber-500/30 text-amber-700 dark:text-amber-400`,c=(0,G.jsx)(Pu,{className:`text-amber-600 dark:text-amber-400`,size:20}),l=t.key_source===`env`?e(`settings.encryption.enabledFromEnv`):e(`settings.encryption.enabledFromFile`),u=e(`settings.encryption.legacyRowsWarning`,{count:a})):t.key_configured?(s=`bg-green-100 dark:bg-green-500/20 border-green-300 dark:border-green-500/30 text-green-700 dark:text-green-400`,c=(0,G.jsx)($l,{className:`text-green-600 dark:text-green-400`,size:20}),l=t.key_source===`env`?e(`settings.encryption.enabledFromEnv`):e(`settings.encryption.enabledFromFile`),u=e(`settings.encryption.allEncrypted`)):(s=`bg-gray-500/20 border-gray-500/30 text-gray-400`,c=(0,G.jsx)(eu,{className:`text-gray-400`,size:20}),l=e(`settings.encryption.notConfigured`),u=e(`settings.encryption.notConfiguredDesc`));let d=t.key_source===`generated`&&a>0;return(0,G.jsxs)(zd,{id:`card-mfa-encryption`,"data-testid":`encryption-status-card`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[c,(0,G.jsx)(`h2`,{className:`text-lg font-semibold`,children:e(`settings.encryption.title`)})]})}),(0,G.jsxs)(Vd,{children:[(0,G.jsxs)(`div`,{className:`p-3 border rounded-lg ${s}`,"data-testid":`encryption-status`,children:[(0,G.jsx)(`p`,{className:`font-medium mb-1`,children:l}),(0,G.jsx)(`p`,{className:`text-sm`,children:u})]}),d&&(0,G.jsx)(`div`,{className:`mt-2 p-3 border rounded-lg bg-amber-50 dark:bg-amber-500/10 border-amber-300 dark:border-amber-500/30 text-amber-700 dark:text-amber-400`,"data-testid":`encryption-legacy-warning`,children:(0,G.jsx)(`p`,{className:`text-sm`,children:e(`settings.encryption.legacyRowsWarning`,{count:a})})}),t.migration_error_count>0&&(0,G.jsx)(`div`,{className:`mt-2 p-3 border rounded-lg bg-amber-50 dark:bg-amber-500/10 border-amber-300 dark:border-amber-500/30 text-amber-700 dark:text-amber-400`,"data-testid":`encryption-migration-warning`,children:(0,G.jsx)(`p`,{className:`text-sm`,children:e(`settings.encryption.migrationErrorWarning`,{count:t.migration_error_count})})}),(0,G.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-4 text-sm`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-bambu-gray`,children:e(`settings.encryption.encryptedRowsLabel`)}),(0,G.jsxs)(`p`,{className:`font-medium`,children:[`OIDC: `,t.encrypted_rows.oidc_providers,` · TOTP: `,t.encrypted_rows.user_totp]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-bambu-gray`,children:e(`settings.encryption.legacyRowsLabel`)}),(0,G.jsxs)(`p`,{className:`font-medium`,children:[`OIDC: `,t.legacy_plaintext_rows.oidc_providers,` · TOTP: `,t.legacy_plaintext_rows.user_totp]})]})]})]})]})}var MKe={get:`bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400 border-blue-300 dark:border-blue-500/30`,post:`bg-green-100 dark:bg-green-500/20 text-green-700 dark:text-green-400 border-green-300 dark:border-green-500/30`,put:`bg-yellow-100 dark:bg-yellow-500/20 text-yellow-700 dark:text-yellow-400 border-yellow-300 dark:border-yellow-500/30`,patch:`bg-orange-100 dark:bg-orange-500/20 text-orange-700 dark:text-orange-400 border-orange-300 dark:border-orange-500/30`,delete:`bg-red-100 dark:bg-red-500/20 text-red-700 dark:text-red-400 border-red-300 dark:border-red-500/30`};function NKe(e,t){let n=t.replace(`#/`,``).split(`/`),r=e;for(let e of n)r=r[e];return r}function V8(e,t,n=0){if(n>5)return`...`;if(t.$ref)return V8(e,NKe(e,t.$ref),n+1);if(t.allOf){let r={};for(let i of t.allOf){let t=V8(e,i,n+1);typeof t==`object`&&t&&Object.assign(r,t)}return r}if(t.example!==void 0)return t.example;if(t.default!==void 0)return t.default;switch(t.type){case`string`:return t.enum?t.enum[0]:`string`;case`integer`:case`number`:return 0;case`boolean`:return!1;case`array`:return t.items?[V8(e,t.items,n+1)]:[];case`object`:if(t.properties){let r={};for(let[i,a]of Object.entries(t.properties))r[i]=V8(e,a,n+1);return r}return{};default:return null}}function PKe({path:e,method:t,spec:n,schema:r,apiKey:i}){let[a,o]=(0,f.useState)(!1),[s,c]=(0,f.useState)({}),[l,u]=(0,f.useState)(``),[d,p]=(0,f.useState)(null),[m,h]=(0,f.useState)(!1),[g,_]=(0,f.useState)(!1);(0,f.useEffect)(()=>{if(a&&n.parameters){let e={};for(let t of n.parameters)t.schema?.default!==void 0&&(e[t.name]=String(t.schema.default));c(t=>({...e,...t}))}},[a,n.parameters]),(0,f.useEffect)(()=>{if(a&&n.requestBody?.content?.[`application/json`]?.schema&&!l){let e=n.requestBody.content[`application/json`].schema,t=V8(r,e);u(JSON.stringify(t,null,2))}},[a,n.requestBody,r,l]);let v=(()=>{let e=[];for(let t of n.parameters||[])if(t.in===`path`||t.required){let n=s[t.name];(n===void 0||n===``)&&e.push(t.name)}return e})(),y=async()=>{if(v.length>0){p({status:0,statusText:`Validation Error`,headers:{},body:`Missing required parameters: ${v.join(`, `)}`,duration:0});return}h(!0),p(null);try{let r=e,a=new URLSearchParams;for(let e of n.parameters||[]){let t=s[e.name];t!==void 0&&t!==``&&(e.in===`path`?r=r.replace(`{${e.name}}`,encodeURIComponent(t)):e.in===`query`&&a.append(e.name,t))}let o=a.toString(),c=`${r}${o?`?${o}`:``}`,u={"Content-Type":`application/json`};i&&(u[`X-API-Key`]=i);let d={method:t.toUpperCase(),headers:u};[`post`,`put`,`patch`].includes(t)&&l&&(d.body=l);let f=performance.now(),m=await fetch(c,d),h=Math.round(performance.now()-f),g={};m.headers.forEach((e,t)=>{g[t]=e});let _;_=m.headers.get(`content-type`)?.includes(`application/json`)?await m.json():await m.text(),p({status:m.status,statusText:m.statusText,headers:g,body:_,duration:h})}catch(e){p({status:0,statusText:`Network Error`,headers:{},body:e instanceof Error?e.message:`Unknown error`,duration:0})}finally{h(!1)}},b=async()=>{if(d){let e=typeof d.body==`string`?d.body:JSON.stringify(d.body,null,2);try{await navigator.clipboard.writeText(e),_(!0),setTimeout(()=>_(!1),2e3)}catch{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.left=`-999999px`,document.body.appendChild(t),t.select(),document.execCommand(`copy`),document.body.removeChild(t),_(!0),setTimeout(()=>_(!1),2e3)}}},x=(n.parameters||[]).filter(e=>e.in===`path`),S=(n.parameters||[]).filter(e=>e.in===`query`),C=[`post`,`put`,`patch`].includes(t)&&n.requestBody;return(0,G.jsxs)(`div`,{className:`border border-bambu-dark-tertiary rounded-lg overflow-hidden`,children:[(0,G.jsxs)(`button`,{onClick:()=>o(!a),className:`w-full flex items-center gap-3 p-3 hover:bg-bambu-dark-tertiary/50 transition-colors text-left`,children:[a?(0,G.jsx)(as,{className:`w-4 h-4 text-bambu-gray flex-shrink-0`}):(0,G.jsx)(ss,{className:`w-4 h-4 text-bambu-gray flex-shrink-0`}),(0,G.jsx)(`span`,{className:`px-2 py-0.5 text-xs font-mono font-semibold uppercase rounded border ${MKe[t]||`bg-gray-500/20 text-gray-400`}`,children:t}),(0,G.jsx)(`code`,{className:`text-sm text-white font-mono flex-1 truncate`,children:e}),n.summary&&(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray truncate max-w-[40%]`,children:n.summary})]}),a&&(0,G.jsxs)(`div`,{className:`border-t border-bambu-dark-tertiary p-4 space-y-4 bg-bambu-dark/50`,children:[n.description&&(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:n.description}),x.length>0&&(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`h4`,{className:`text-sm font-medium text-white`,children:`Path Parameters`}),(0,G.jsx)(`div`,{className:`space-y-2`,children:x.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`label`,{className:`text-sm text-bambu-gray w-32 flex-shrink-0`,children:[e.name,e.required&&(0,G.jsx)(`span`,{className:`text-red-700 dark:text-red-400 ml-1`,children:`*`})]}),(0,G.jsx)(`input`,{type:`text`,value:s[e.name]||``,onChange:t=>c(n=>({...n,[e.name]:t.target.value})),placeholder:e.description||e.schema?.type||`value`,className:`flex-1 px-2 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm font-mono focus:border-bambu-green focus:outline-none`})]},e.name))})]}),S.length>0&&(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`h4`,{className:`text-sm font-medium text-white`,children:`Query Parameters`}),(0,G.jsx)(`div`,{className:`space-y-2`,children:S.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`label`,{className:`text-sm text-bambu-gray w-32 flex-shrink-0`,children:[e.name,e.required&&(0,G.jsx)(`span`,{className:`text-red-700 dark:text-red-400 ml-1`,children:`*`})]}),e.schema?.enum?(0,G.jsxs)(`select`,{value:s[e.name]||``,onChange:t=>c(n=>({...n,[e.name]:t.target.value})),className:`flex-1 px-2 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none`,children:[(0,G.jsx)(`option`,{value:``,children:`-- Select --`}),e.schema.enum.map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))]}):(0,G.jsx)(`input`,{type:`text`,value:s[e.name]||``,onChange:t=>c(n=>({...n,[e.name]:t.target.value})),placeholder:e.description||e.schema?.type||`value`,className:`flex-1 px-2 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm font-mono focus:border-bambu-green focus:outline-none`})]},e.name))})]}),C&&(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`h4`,{className:`text-sm font-medium text-white`,children:`Request Body`}),(0,G.jsx)(`textarea`,{value:l,onChange:e=>u(e.target.value),rows:8,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm font-mono focus:border-bambu-green focus:outline-none resize-y`,placeholder:`JSON request body...`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(Q,{onClick:y,disabled:m,children:[m?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(Dl,{className:`w-4 h-4`}),`Execute`]}),v.length>0&&(0,G.jsxs)(`span`,{className:`text-xs text-yellow-700 dark:text-yellow-400 flex items-center gap-1`,children:[(0,G.jsx)(fs,{className:`w-3 h-3`}),`Fill in: `,v.join(`, `)]})]}),d&&(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`h4`,{className:`text-sm font-medium text-white flex items-center gap-2`,children:[`Response`,(0,G.jsxs)(`span`,{className:`px-2 py-0.5 text-xs rounded ${d.status>=200&&d.status<300?`bg-green-100 dark:bg-green-500/20 text-green-700 dark:text-green-400`:d.status>=400?`bg-red-100 dark:bg-red-500/20 text-red-700 dark:text-red-400`:`bg-yellow-100 dark:bg-yellow-500/20 text-yellow-700 dark:text-yellow-400`}`,children:[d.status,` `,d.statusText]}),(0,G.jsxs)(`span`,{className:`text-xs text-bambu-gray`,children:[d.duration,`ms`]})]}),(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:b,children:g?(0,G.jsx)(ms,{className:`w-3 h-3 text-green-600 dark:text-green-400`}):(0,G.jsx)(Ps,{className:`w-3 h-3`})})]}),(0,G.jsx)(`pre`,{className:`p-3 bg-bambu-dark rounded-lg text-sm font-mono text-white overflow-auto max-h-96 border border-bambu-dark-tertiary`,children:typeof d.body==`string`?d.body:JSON.stringify(d.body,null,2)})]})]})]})}function FKe({apiKey:e=``}){let[t,n]=(0,f.useState)(null),[r,i]=(0,f.useState)(!0),[a,o]=(0,f.useState)(null),[s,c]=(0,f.useState)(new Set),[l,u]=(0,f.useState)(``);if((0,f.useEffect)(()=>{async function e(){try{let e=await fetch(`/openapi.json`);if(!e.ok)throw Error(`Failed to fetch OpenAPI schema`);n(await e.json())}catch(e){o(e instanceof Error?e.message:`Unknown error`)}finally{i(!1)}}e()},[]),r)return(0,G.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,G.jsx)(Y,{className:`w-8 h-8 text-bambu-green animate-spin`})});if(a||!t)return(0,G.jsx)(zd,{children:(0,G.jsx)(Vd,{className:`py-8`,children:(0,G.jsxs)(`div`,{className:`text-center text-red-700 dark:text-red-400`,children:[(0,G.jsx)(fs,{className:`w-12 h-12 mx-auto mb-3 opacity-50`}),(0,G.jsx)(`p`,{children:`Failed to load API schema`}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:a})]})})});let d={};for(let[e,n]of Object.entries(t.paths))for(let[t,r]of Object.entries(n)){if(t===`parameters`)continue;let n=r.tags||[`Other`];for(let i of n)d[i]||(d[i]=[]),d[i].push({path:e,method:t,spec:r})}let p=Object.entries(d).map(([e,t])=>l?{tag:e,endpoints:t.filter(({path:e,method:t,spec:n})=>{let r=l.toLowerCase();return e.toLowerCase().includes(r)||t.toLowerCase().includes(r)||(n.summary?.toLowerCase()||``).includes(r)||(n.description?.toLowerCase()||``).includes(r)})}:{tag:e,endpoints:t}).filter(({endpoints:e})=>e.length>0).sort((e,t)=>e.tag.localeCompare(t.tag)),m=e=>{c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,G.jsx)(`div`,{className:`flex-1`,children:(0,G.jsx)(`input`,{type:`text`,value:l,onChange:e=>u(e.target.value),placeholder:`Search endpoints...`,className:`w-full max-w-md px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:()=>{c(new Set(p.map(e=>e.tag)))},children:`Expand All`}),(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:()=>{c(new Set)},children:`Collapse All`}),(0,G.jsxs)(`a`,{href:`/docs`,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-1 text-sm text-bambu-green hover:underline`,children:[(0,G.jsx)(Xs,{className:`w-4 h-4`}),`Swagger UI`]})]})]}),(0,G.jsxs)(`p`,{className:`text-sm text-bambu-gray`,children:[p.reduce((e,t)=>e+t.endpoints.length,0),` endpoints in `,p.length,` categories`]}),(0,G.jsx)(`div`,{className:`space-y-3`,children:p.map(({tag:n,endpoints:r})=>(0,G.jsxs)(zd,{children:[(0,G.jsx)(`button`,{onClick:()=>m(n),className:`w-full flex items-center justify-between p-4 hover:bg-bambu-dark-tertiary/30 transition-colors text-left`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s.has(n)?(0,G.jsx)(as,{className:`w-5 h-5 text-bambu-gray`}):(0,G.jsx)(ss,{className:`w-5 h-5 text-bambu-gray`}),(0,G.jsx)(`h3`,{className:`text-base font-semibold text-white capitalize`,children:n.replace(/-/g,` `)}),(0,G.jsx)(`span`,{className:`text-xs bg-bambu-dark-tertiary px-2 py-0.5 rounded-full text-bambu-gray`,children:r.length})]})}),s.has(n)&&(0,G.jsx)(Vd,{className:`pt-0 space-y-2`,children:r.map(({path:n,method:r,spec:i})=>(0,G.jsx)(PKe,{path:n,method:r,spec:i,schema:t,apiKey:e},`${r}-${n}`))})]},n))})]})}var IKe=[{id:`sidecar`,labelKey:`settings.sliceEngineSidecar`,descriptionKey:`settings.sliceEngineSidecarHint`,available:!0},{id:`browser`,labelKey:`settings.sliceEngineBrowser`,descriptionKey:`settings.sliceEngineBrowserHint`,available:!1}];function H8(){return IKe.filter(e=>e.available)}function LKe(){return H8().length>1}function U8(e){return H8().find(t=>t.id===e)?.id??`sidecar`}var RKe=[`general`,`plugs`,`sensors`,`notifications`,`queue`,`filament`,`network`,`apikeys`,`virtual-printer`,`spoolbuddy`,`failure-detection`,`users`,`backup`];B8({labelKey:`settings.general`,tab:`general`,keywords:`language date time format printer model printers cards`,anchor:`card-general`}),B8({labelKey:`settings.appearance`,tab:`general`,keywords:`theme dark light mode colors`,anchor:`card-appearance`}),B8({labelKey:`settings.archiveSettings`,tab:`general`,keywords:`archive auto save thumbnails captures`,anchor:`card-archive`}),B8({labelKey:`settings.camera`,tab:`general`,keywords:`camera external video stream`,anchor:`card-camera`}),B8({labelKey:`settings.costTracking`,tab:`general`,keywords:`currency filament cost energy kwh price`,anchor:`card-cost`}),B8({labelKey:`settings.fileManager`,tab:`general`,keywords:`file manager archive mode disk warning storage`,anchor:`card-filemanager`}),B8({labelKey:`settings.updates`,tab:`general`,keywords:`updates version firmware beta check`,anchor:`card-updates`}),B8({labelKey:`settings.dataManagement`,tab:`general`,keywords:`data reset clear logs notifications preferences`,anchor:`card-data`}),B8({labelKey:`settings.smartPlugs`,tab:`plugs`,keywords:`smart plug energy power automation tapo kasa tplink shelly`,anchor:`card-plugs`}),B8({labelKey:`haSensors.sectionTitle`,tab:`sensors`,keywords:`home assistant sensor printer temperature humidity alert notify block print`,anchor:`card-ha-sensors`}),B8({labelKey:`locationHaSensors.sectionTitle`,tab:`sensors`,keywords:`home assistant sensor location storage box temperature humidity battery alert notify`,anchor:`card-location-sensors`}),B8({labelKey:`settings.providers`,tab:`notifications`,keywords:`telegram discord email notification providers webhook`,anchor:`card-providers`}),B8({labelKey:`settings.messageTemplates`,tab:`notifications`,keywords:`message templates notification text edit`,anchor:`card-templates`}),B8({labelKey:`settings.defaultPrintOptions`,labelFallback:`Default Print Options`,tab:`queue`,keywords:`print bed leveling flow calibration vibration first layer timelapse`,anchor:`card-print-options`}),B8({labelKey:`settings.tempFanPresetsTitle`,labelFallback:`Temperature & Fan Presets`,tab:`queue`,keywords:`temperature fan presets nozzle bed chamber quick buttons popover`,anchor:`card-temp-fan-presets`}),B8({labelKey:`settings.staggeredStart`,labelFallback:`Staggered Start`,tab:`queue`,keywords:`staggered batch delay start queue group`,anchor:`card-staggered`}),B8({labelKey:`settings.plateClear`,labelFallback:`Plate-Clear Confirmation`,tab:`queue`,keywords:`plate clear confirm auto queue`,anchor:`card-plate`}),B8({labelKey:`settings.concurrentUploadsTitle`,labelFallback:`Concurrent Uploads`,tab:`queue`,keywords:`concurrent parallel upload transfer ftp queue slow farm simultaneous`,anchor:`card-concurrent-uploads`}),B8({labelKey:`settings.gcodeInjection`,labelFallback:`G-code Injection`,tab:`queue`,keywords:`gcode injection start end autoprint farmloop swapmod autoclear printflow`,anchor:`card-gcode`}),B8({labelKey:`settings.slicerCard`,labelFallback:`Slicer`,tab:`queue`,keywords:`slicer orcaslicer bambustudio orca bambu api sidecar url docker preferred`,anchor:`card-slicer`}),B8({labelKey:`settings.queueDrying`,tab:`queue`,keywords:`drying presets temperature time humidity ams`,anchor:`card-drying`}),B8({labelKey:`settings.filamentChecks`,tab:`filament`,keywords:`filament check warning runout remaining`,anchor:`card-filamentchecks`}),B8({labelKey:`settings.printModal`,tab:`filament`,keywords:`print modal custom mapping`,anchor:`card-printmodal`}),B8({labelKey:`settings.amsDisplayThresholds`,tab:`filament`,keywords:`ams humidity temperature threshold history retention`,anchor:`card-amsthresholds`}),B8({labelKey:`settings.externalUrl`,tab:`network`,keywords:`external url reverse proxy public notification link`,anchor:`card-externalurl`}),B8({labelKey:`settings.ftpRetry`,tab:`network`,keywords:`ftp retry upload retries backoff`,anchor:`card-ftpretry`}),B8({labelKey:`settings.homeAssistant`,tab:`network`,keywords:`home assistant ha hass mqtt integration`,anchor:`card-ha`}),B8({labelKey:`settings.mqttPublishing`,tab:`network`,keywords:`mqtt publish broker topic`,anchor:`card-mqtt`}),B8({labelKey:`settings.prometheusMetrics`,tab:`network`,keywords:`prometheus metrics grafana monitoring bearer token`,anchor:`card-prometheus`}),B8({labelKey:`settings.createNewApiKey`,tab:`apikeys`,keywords:`api key create permission scope`,anchor:`card-createapi`}),B8({labelKey:`settings.webhookEndpoints`,tab:`apikeys`,keywords:`webhook endpoint post http`,anchor:`card-webhooks`}),B8({labelKey:`settings.apiBrowser`,tab:`apikeys`,keywords:`api browser endpoint documentation test`,anchor:`card-apibrowser`}),B8({labelKey:`connectedApps.title`,tab:`apikeys`,keywords:`connected app sign in single sign-on sso oauth login orders`,anchor:`card-connected-apps`}),B8({labelKey:`cameraTokens.title`,tab:`apikeys`,keywords:`camera token long-lived home assistant frigate kiosk stream`,anchor:`card-camera-tokens`}),B8({labelKey:`settings.tabs.virtualPrinter`,tab:`virtual-printer`,keywords:`virtual printer proxy archive slicer bambustudio orcaslicer ip bind`,anchor:`card-vp`}),B8({labelKey:`settings.tabs.spoolbuddy`,tab:`spoolbuddy`,keywords:`spoolbuddy device scale nfc rfid kiosk unregister`,anchor:`card-spoolbuddy`}),B8({labelKey:`settings.currentUser`,tab:`users`,subTab:`users`,keywords:`current user profile password change`,anchor:`card-currentuser`}),B8({labelKey:`settings.users`,tab:`users`,subTab:`users`,keywords:`users accounts list`,anchor:`card-users`}),B8({labelKey:`settings.groups`,tab:`users`,subTab:`users`,keywords:`groups roles permissions administrators operators viewers`,anchor:`card-groups`}),B8({labelKey:`settings.sessionPolicy.title`,labelFallback:`Session Policy`,tab:`users`,subTab:`users`,keywords:`session timeout expiry logout remember me jwt token lifetime`,anchor:`card-session-policy`}),B8({labelKey:`settings.email.smtpSettings`,labelFallback:`SMTP Configuration`,tab:`users`,subTab:`email`,keywords:`smtp email send server port password auth starttls ssl`,anchor:`card-smtp`}),B8({labelKey:`settings.ldap.title`,labelFallback:`LDAP Authentication`,tab:`users`,subTab:`ldap`,keywords:`ldap active directory ad authentication bind dn search base group mapping`,anchor:`card-ldap`}),B8({labelKey:`settings.tabs.backup`,tab:`backup`,keywords:`backup github restore download cloud sync profiles archives`,anchor:`card-backup`}),B8({labelKey:`externalLinks.sidebarLayout`,labelFallback:`Sidebar`,tab:`general`,keywords:`sidebar layout links pages hide show external custom navigation url add`,anchor:`card-sidebar-links`}),B8({labelKey:`settings.filamentTracking`,tab:`filament`,keywords:`spoolman filament tracking inventory sync remote integration`,anchor:`card-spoolman`}),B8({labelKey:`settings.catalog.spoolCatalog`,labelFallback:`Spool Catalog`,tab:`filament`,keywords:`spool catalog entries brand material reset import export`,anchor:`card-spool-catalog`}),B8({labelKey:`settings.colorCatalog.title`,labelFallback:`Color Catalog`,tab:`filament`,keywords:`color catalog hex swatch palette sync reset`,anchor:`card-color-catalog`}),B8({labelKey:`settings.tabs.failureDetection`,labelFallback:`Failure Detection`,tab:`failure-detection`,keywords:`failure detection ai ml obico spaghetti detect monitoring`,anchor:`card-fd-ml`}),B8({labelKey:`failureDetection.perPrinterTitle`,labelFallback:`Per-Printer Settings`,tab:`failure-detection`,keywords:`failure detection per printer enable per-printer sensitivity`,anchor:`card-fd-perprinter`}),B8({labelKey:`failureDetection.statusTitle`,labelFallback:`Detection Status`,tab:`failure-detection`,keywords:`failure detection status running connection`,anchor:`card-fd-status`}),B8({labelKey:`failureDetection.historyTitle`,labelFallback:`Detection History`,tab:`failure-detection`,keywords:`failure detection history log events`,anchor:`card-fd-history`}),B8({labelKey:`settings.email.advancedAuth`,labelFallback:`Advanced Email Authentication`,tab:`users`,subTab:`email`,keywords:`email authentication advanced password reset self-service forgot`,anchor:`card-email-advanced-auth`}),B8({labelKey:`settings.email.testConnection`,labelFallback:`Test SMTP Connection`,tab:`users`,subTab:`email`,keywords:`email smtp test connection send check`,anchor:`card-email-test`}),B8({labelKey:`settings.twoFa.totpTitle`,labelFallback:`Authenticator App (TOTP)`,tab:`users`,subTab:`twofa`,keywords:`two factor 2fa totp authenticator app google authy otp`,anchor:`card-2fa-totp`}),B8({labelKey:`settings.twoFa.emailOtpTitle`,labelFallback:`Email One-Time Codes`,tab:`users`,subTab:`twofa`,keywords:`two factor 2fa email otp one time code`,anchor:`card-2fa-emailotp`}),B8({labelKey:`settings.twoFa.linkedAccounts`,labelFallback:`Linked Accounts`,tab:`users`,subTab:`twofa`,keywords:`two factor 2fa linked accounts sso oidc provider google github`,anchor:`card-2fa-linked`}),B8({labelKey:`settings.oidc.title`,labelFallback:`Single Sign-On (OIDC)`,tab:`users`,subTab:`oidc`,keywords:`sso oidc openid single sign-on pocketid authentik keycloak google okta azure provider`,anchor:`card-oidc`}),B8({labelKey:`settings.ldap.serverConfig`,labelFallback:`LDAP Server Configuration`,tab:`users`,subTab:`ldap`,keywords:`ldap server url bind dn user search base group filter tls`,anchor:`card-ldap-server`}),B8({labelKey:`backup.githubBackup`,labelFallback:`GitHub Backup`,tab:`backup`,keywords:`github backup cloud remote sync profiles token`,anchor:`card-backup-github`}),B8({labelKey:`backup.history`,labelFallback:`Backup History`,tab:`backup`,keywords:`backup history log runs github commits`,anchor:`card-backup-history`}),B8({labelKey:`backup.localBackup`,labelFallback:`Local Backup`,tab:`backup`,keywords:`local backup download zip manual export`,anchor:`card-backup-local`}),B8({labelKey:`backup.scheduledBackup`,labelFallback:`Scheduled Backups`,tab:`backup`,keywords:`scheduled backup automatic hourly daily weekly retention local path`,anchor:`card-backup-scheduled`});var W8=20,zKe={database:`bg-blue-600`,library_files:`bg-green-500`,library_thumbnails:`bg-teal-500`,library_other:`bg-emerald-700`,archive_timelapses:`bg-red-500`,archive_thumbnails:`bg-amber-500`,archive_files:`bg-sky-500`,virtual_printer_uploads:`bg-purple-500`,virtual_printer_upload_cache:`bg-fuchsia-500`,virtual_printer_certs:`bg-violet-500`,virtual_printer_other:`bg-purple-700`,downloads:`bg-cyan-500`,plate_calibration:`bg-lime-500`,logs:`bg-orange-500`,other_data:`bg-yellow-500`},G8=[`bg-blue-500`,`bg-green-500`,`bg-yellow-500`,`bg-red-500`,`bg-orange-500`,`bg-teal-500`,`bg-cyan-500`,`bg-purple-500`],K8=(e,t)=>zKe[e]||G8[t%G8.length],q8={temperature:0,humidity:1,battery:2};function BKe(e,t){return e?vE(e,t,{decimals:2}):null}function VKe(){let e=no(),t=$n(),[n,r]=ji(),{t:i,i18n:a}=U(),{showToast:o}=qd(),{authEnabled:s,user:c,isAdmin:l,refreshAuth:u,hasPermission:d}=Nd(),{mode:p,resolvedMode:m,darkStyle:h,darkBackground:g,darkAccent:_,lightStyle:v,lightBackground:y,lightAccent:b,setMode:x,setDarkStyle:S,setDarkBackground:C,setDarkAccent:w,setLightStyle:T,setLightBackground:E,setLightAccent:D,progressInTitle:O,setProgressInTitle:k}=Id(),[A,j]=(0,f.useState)(null),[M,N]=(0,f.useState)({}),[P,F]=(0,f.useState)(null),[I,L]=(0,f.useState)(!1),[R,z]=(0,f.useState)(null),[B,V]=(0,f.useState)(!1),[ee,te]=(0,f.useState)(null),[ne,re]=(0,f.useState)(!1),[ie,ae]=(0,f.useState)(null),[oe,se]=(0,f.useState)(!1),{colorize:H,aboveColor:ce,belowColor:le,optimalColor:ue}=F6(),[de,fe]=(0,f.useState)(null),[pe,me]=(0,f.useState)(!1),[he,ge]=(0,f.useState)(null),[_e,ve]=(0,f.useState)(null),[ye,be]=(0,f.useState)(``),[xe,Se]=(0,f.useState)(``),[Ce,we]=(0,f.useState)(!1),[Te,Ee]=(0,f.useState)(!1),[De,Oe]=(0,f.useState)(!1),[ke,Ae]=(0,f.useState)(nte()),je=n.get(`tab`),Me=je===`email`,[Ne,Pe]=(0,f.useState)(Me?`users`:je&&RKe.includes(je)?je:`general`),[Fe,Ie]=(0,f.useState)(Me?`email`:`users`),[Le,Re]=(0,f.useState)(je===`queue`&&n.get(`sub`)===`pipelines`?`pipelines`:`dispatch`),ze=e=>{Pe(e),e===`users`&&Ie(`users`),e===`queue`&&(Re(`dispatch`),n.delete(`sub`)),e===`general`?n.delete(`tab`):n.set(`tab`,e),r(n,{replace:!0})},Be=e=>{Re(e),e===`pipelines`?n.set(`sub`,`pipelines`):n.delete(`sub`),r(n,{replace:!0})},[Ve,He]=(0,f.useState)(!1),[Ue,We]=(0,f.useState)(``),[Ge,Ke]=(0,f.useState)({can_queue:!0,can_control_printer:!1,can_read_status:!0,can_manage_library:!0,can_manage_inventory:!0,can_manage_maintenance:!0,can_manage_archives:!0,can_manage_projects:!0,can_access_cloud:!1,can_update_energy_cost:!1,can_send_notifications:!1}),[qe,Je]=(0,f.useState)(null),[Ye,Xe]=(0,f.useState)(!1),[Ze,Qe]=(0,f.useState)(null),[$e,et]=(0,f.useState)(``),[tt,nt]=(0,f.useState)(!1),[rt,it]=(0,f.useState)(!1),[at,ot]=(0,f.useState)(null),[st,ct]=(0,f.useState)(!1),[lt,ut]=(0,f.useState)(!1),[dt,ft]=(0,f.useState)(!1),[pt,mt]=(0,f.useState)({currentPassword:``,newPassword:``,confirmPassword:``}),[ht,gt]=(0,f.useState)(!1),[_t,vt]=(0,f.useState)(!1),[yt,bt]=(0,f.useState)(!1),[xt,Ct]=(0,f.useState)(`local`),[wt,Tt]=(0,f.useState)(!1),[Et,Dt]=(0,f.useState)(null),[Ot,kt]=(0,f.useState)(null),[At,jt]=(0,f.useState)(null),[Mt,Nt]=(0,f.useState)(!1),[Pt,Ft]=(0,f.useState)({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]}),[It,Lt]=(0,f.useState)(null),[Rt,zt]=(0,f.useState)(null),[Bt,Vt]=(0,f.useState)(!1),[Ht,Ut]=(0,f.useState)({}),[Wt,Gt]=(0,f.useState)({}),Kt=e=>{Ae(e),rte(e),o(i(`settings.toast.settingsSaved`),`success`)},{data:qt,isLoading:Jt}=K({queryKey:[`settings`],queryFn:Z.getSettings}),{data:Yt,isLoading:Xt,isFetching:Zt}=K({queryKey:[`storage-usage`],queryFn:()=>Z.getStorageUsage(),enabled:Ne===`general`,staleTime:1/0,refetchInterval:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1}),Qt=async()=>{vt(!0);try{let t=await Z.getStorageUsage({refresh:!0});e.setQueryData([`storage-usage`],t)}catch(e){o(e instanceof Error?e.message:`Failed to refresh storage usage`,`error`)}finally{vt(!1)}},{data:$t,isLoading:en}=K({queryKey:[`smart-plugs`],queryFn:Z.getSmartPlugs}),{data:tn,isLoading:nn}=K({queryKey:[`smart-plugs-energy`,$t?.map(e=>e.id)],queryFn:async()=>{if(!$t||$t.length===0)return null;let e=await Promise.all($t.filter(e=>e.enabled).map(async e=>{try{return{plug:e,status:await Z.getSmartPlugStatus(e.id)}}catch{return{plug:e,status:null}}})),t=0,n=0,r=0,i=0,a=0;for(let{plug:o,status:s}of e){let e=o.plug_type===`mqtt`&&s?.energy?.power!=null;(s?.reachable||e)&&(a++,s?.energy?.power!=null&&(t+=s.energy.power),s?.energy?.today!=null&&(n+=s.energy.today),s?.energy?.yesterday!=null&&(r+=s.energy.yesterday),s?.energy?.total!=null&&(i+=s.energy.total))}return{totalPower:t,totalToday:n,totalYesterday:r,totalLifetime:i,reachableCount:a,totalPlugs:$t.filter(e=>e.enabled).length}},enabled:Ne===`plugs`&&!!$t&&$t.length>0,refetchInterval:Ne===`plugs`?1e4:!1}),{data:W,isLoading:rn}=K({queryKey:[`notification-providers`],queryFn:Z.getNotificationProviders}),{data:an,isLoading:on}=K({queryKey:[`api-keys`],queryFn:Z.getAPIKeys}),sn=q({mutationFn:e=>Z.createAPIKey(e),onSuccess:t=>{Je(t.key||null),He(!1),We(``),e.invalidateQueries({queryKey:[`api-keys`]}),o(i(`settings.toast.apiKeyCreated`))},onError:e=>{o(`Failed to create API key: ${e.message}`,`error`)}}),cn=q({mutationFn:e=>Z.deleteAPIKey(e),onSuccess:(t,n)=>{e.setQueryData([`api-keys`],e=>(e??[]).filter(e=>e.id!==n)),o(i(`settings.toast.apiKeyDeleted`))},onError:e=>{o(`Failed to delete API key: ${e.message}`,`error`)}}),{data:ln}=K({queryKey:[`printers`],queryFn:Z.getPrinters}),{data:un}=K({queryKey:[`haSensors`],queryFn:()=>Z.getHASensors()}),{data:dn}=K({queryKey:[`locationHaSensors`],queryFn:()=>Z.getLocationHASensors()}),{data:fn}=K({queryKey:p6,queryFn:Z.getLocations,enabled:Ne===`sensors`}),pn=_o({queries:(0,f.useMemo)(()=>Array.from(new Set((dn??[]).map(e=>e.location_id))),[dn]).map(e=>({queryKey:[`locationHaSensorReadings`,e],queryFn:()=>Z.getLocationHASensorReadings(e,!1),enabled:Ne===`sensors`,refetchInterval:Ne===`sensors`?(qt?.location_sensor_poll_interval||120)*1e3:!1}))}),mn=(0,f.useMemo)(()=>{let e=new Map;for(let t of pn)for(let n of t.data??[])e.set(n.id,n);return e},[pn]),hn=q({mutationFn:async e=>{for(let t of e)await Z.deleteLocationHASensor(t)},onSuccess:()=>{o(i(`locationHaSensors.toast.deleted`),`success`)},onError:e=>{o(e.message,`error`)},onSettled:()=>{e.invalidateQueries({queryKey:[`locationHaSensors`]}),e.invalidateQueries({queryKey:[`locationHaSensorReadings`]}),fe(null)}}),gn=Rf(ln?.length??0),{data:_n,isLoading:vn}=K({queryKey:[`notification-templates`],queryFn:Z.getNotificationTemplates}),{data:yn}=K({queryKey:[`virtual-printer-settings`],queryFn:Cd.getSettings,refetchInterval:1e4}),bn=yn?.status?.running??!1,{data:xn}=K({queryKey:[`spoolbuddy-devices`],queryFn:()=>Od.getDevices(),refetchInterval:15e3}),Sn=xn?.length??0,Cn=xn?.some(e=>e.online)??!1,{data:wn}=K({queryKey:[`obico-status`],queryFn:Z.getObicoStatus,refetchInterval:15e3}),Tn=!!(wn?.is_running&&wn?.enabled),{data:En}=K({queryKey:[`ffmpeg-status`],queryFn:Z.checkFfmpeg}),{data:Dn}=K({queryKey:[`version`],queryFn:Z.getVersion}),On=!s||d(`library:purge`),{data:kn}=K({queryKey:[`library-trash-settings`],queryFn:()=>Z.getLibraryTrashSettings(),enabled:On}),An=q({mutationFn:e=>Z.updateLibraryTrashSettings(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`library-trash-settings`]}),o(i(`settings.toast.settingsSaved`),`success`)},onError:e=>o(e.message||i(`libraryAutoPurge.saveFailed`),`error`)}),jn=e=>{kn&&An.mutate({retention_days:kn.retention_days,auto_purge_enabled:kn.auto_purge_enabled,auto_purge_days:kn.auto_purge_days,auto_purge_include_never_printed:kn.auto_purge_include_never_printed,...e})},Mn=!s||d(`archives:purge`),{data:Nn}=K({queryKey:[`archive-purge-settings`],queryFn:()=>Z.getArchivePurgeSettings(),enabled:Mn}),Pn=q({mutationFn:e=>Z.updateArchivePurgeSettings(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`archive-purge-settings`]}),o(i(`settings.toast.settingsSaved`),`success`)},onError:e=>o(e.message||i(`archiveAutoPurge.saveFailed`),`error`)}),Fn=e=>{Nn&&Pn.mutate({enabled:Nn.enabled,days:Nn.days,purge_stats:Nn.purge_stats,...e})},{data:In,refetch:Ln,isRefetching:Rn}=K({queryKey:[`updateCheck`],queryFn:Z.checkForUpdates,enabled:qt?.check_updates!==!1,staleTime:300*1e3}),{data:zn,refetch:Bn}=K({queryKey:[`updateStatus`],queryFn:Z.getUpdateStatus,refetchInterval:e=>{let t=e.state.data;return t?.status===`downloading`||t?.status===`installing`?1e3:!1}}),{data:Vn}=K({queryKey:[`mqtt-status`],queryFn:Z.getMQTTStatus,refetchInterval:Ne===`network`?5e3:!1}),{data:Hn}=K({queryKey:[`github-backup-status`],queryFn:Z.getGitHubBackupStatus}),{data:Un}=K({queryKey:[`cloud-status`],queryFn:Z.getCloudStatus}),{data:Wn={advanced_auth_enabled:!1,smtp_configured:!1,local_login_enabled:!0,autologin_provider_id:null}}=K({queryKey:[`advancedAuthStatus`],queryFn:()=>Z.getAdvancedAuthStatus()}),{data:Gn}=K({queryKey:[`ldapStatus`],queryFn:()=>Z.getLDAPStatus()}),{data:Kn}=K({queryKey:[`twoFAStatus`],queryFn:()=>Z.get2FAStatus()}),{data:qn=[]}=K({queryKey:[`oidcProvidersAll`],queryFn:()=>Z.getOIDCProvidersAll(),enabled:l}),{data:Jn=[],isLoading:Yn}=K({queryKey:[`users`],queryFn:()=>Z.getUsers(),enabled:s&&d(`users:read`)}),{data:Xn=[],isLoading:Zn}=K({queryKey:[`groups`],queryFn:()=>Z.getGroups(),enabled:s&&d(`groups:read`)}),Qn=q({mutationFn:e=>Z.createUser(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`users`]}),e.invalidateQueries({queryKey:[`groups`]}),bt(!1),Ft({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]}),o(i(`settings.toast.userCreated`))},onError:e=>{o(e.message,`error`)}}),er=q({mutationFn:({id:e,data:t})=>Z.updateUser(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:[`users`]}),e.invalidateQueries({queryKey:[`groups`]}),Tt(!1),Dt(null),Ft({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]}),o(i(`settings.toast.userUpdated`))},onError:e=>{o(e.message,`error`)}}),tr=q({mutationFn:({id:e,deleteItems:t})=>Z.deleteUser(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:[`users`]}),o(i(`settings.toast.userDeleted`)),kt(null),jt(null)},onError:e=>{o(e.message,`error`)}}),nr=q({mutationFn:e=>Z.resetUserPassword({user_id:e}),onSuccess:e=>{o(e.message,`success`)},onError:e=>{o(e.message,`error`)}}),rr=async e=>{kt(e),Nt(!0);try{jt(await Z.getUserItemsCount(e))}catch{jt({archives:0,queue_items:0,library_files:0})}finally{Nt(!1)}},ir=q({mutationFn:e=>Z.deleteGroup(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`groups`]}),o(i(`settings.toast.groupDeleted`))},onError:e=>{o(e.message,`error`)}}),ar=()=>{let e=Wn?.advanced_auth_enabled||!1;if(!Pt.username){o(i(`settings.toast.fillRequiredFields`),`error`);return}if(e&&!Pt.email){o(`Email is required when advanced authentication is enabled`,`error`);return}if(!e){if(!Pt.password){o(i(`settings.toast.fillRequiredFields`),`error`);return}if(Pt.password!==Pt.confirmPassword){o(i(`settings.toast.passwordsDoNotMatch`),`error`);return}let e=f6(Pt.password);if(e){o(i({tooShort:`settings.toast.passwordTooShort`,needsUppercase:`settings.toast.passwordNeedsUppercase`,needsLowercase:`settings.toast.passwordNeedsLowercase`,needsDigit:`settings.toast.passwordNeedsDigit`,needsSpecial:`settings.toast.passwordNeedsSpecial`}[e]),`error`);return}}Qn.mutate({username:Pt.username,password:e?void 0:Pt.password,email:Pt.email||void 0,role:Pt.role,group_ids:Pt.group_ids.length>0?Pt.group_ids:void 0})},or=e=>{if(Pt.password){if(Pt.password!==Pt.confirmPassword){o(i(`settings.toast.passwordsDoNotMatch`),`error`);return}let e=f6(Pt.password);if(e){o(i({tooShort:`settings.toast.passwordTooShort`,needsUppercase:`settings.toast.passwordNeedsUppercase`,needsLowercase:`settings.toast.passwordNeedsLowercase`,needsDigit:`settings.toast.passwordNeedsDigit`,needsSpecial:`settings.toast.passwordNeedsSpecial`}[e]),`error`);return}}let t={username:Pt.username||void 0,password:Pt.password||void 0,email:Pt.email||void 0,role:Pt.role,group_ids:Pt.group_ids};t.password||delete t.password,er.mutate({id:e,data:t})},sr=e=>{Dt(e.id),Ft({username:e.username,password:``,email:e.email||``,confirmPassword:``,role:e.role,group_ids:e.groups?.map(e=>e.id)||[]}),Tt(!0)},cr=e=>{Ft(t=>({...t,group_ids:t.group_ids.includes(e)?t.group_ids.filter(t=>t!==e):[...t.group_ids,e]}))},lr=q({mutationFn:Z.applyUpdate,onSuccess:e=>{e.is_ha_addon||e.is_docker||e.is_windows_installer?o(e.message,`error`):Bn()}}),[ur,dr]=(0,f.useState)(null),fr=q({mutationFn:Z.testAllNotificationProviders,onSuccess:t=>{dr(t),e.invalidateQueries({queryKey:[`notification-providers`]}),t.failed===0?o(`All ${t.tested} providers tested successfully!`,`success`):o(`${t.success}/${t.tested} providers succeeded`,t.failed>0?`error`:`success`)},onError:e=>{o(`Failed to test providers: ${e.message}`,`error`)}}),pr=q({mutationFn:async e=>{if(!$t)return{success:0,failed:0};let t=$t.filter(e=>e.enabled),n=await Promise.all(t.map(async t=>{try{return await Z.controlSmartPlug(t.id,e),{success:!0}}catch{return{success:!1}}}));return{success:n.filter(e=>e.success).length,failed:n.filter(e=>!e.success).length}},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:[`smart-plugs`]}),e.invalidateQueries({queryKey:[`smart-plugs-energy`]}),t.failed===0?o(`All ${t.success} plugs turned ${n}`,`success`):o(`${t.success} plugs turned ${n}, ${t.failed} failed`,`error`)},onError:e=>{o(`Failed: ${e.message}`,`error`)}}),mr=(0,f.useRef)(null),hr=(0,f.useRef)(null),gr=(0,f.useRef)(!1),_r=(0,f.useRef)(!0),vr=(0,f.useRef)(null);(0,f.useEffect)(()=>{if(qt&&!A){let e={...qt,external_url:qt.external_url||window.location.origin};vr.current=qt,j(e),setTimeout(()=>{_r.current=!1},100)}},[qt,A]),(0,f.useEffect)(()=>{let e=vr.current;if(!qt||!A||!e||qt===e)return;let t={};for(let n of Object.keys(qt))qt[n]!==e[n]&&A[n]===e[n]&&(t[n]=qt[n]);vr.current=qt,Object.keys(t).length>0&&j(e=>e&&{...e,...t})},[qt,A]);let yr=q({mutationFn:Z.updateSettings,onSuccess:t=>{vr.current=t,e.setQueryData([`settings`],t),e.invalidateQueries({queryKey:[`archiveStats`]}),e.invalidateQueries({queryKey:[`ui-flags`]}),o(i(`settings.toast.settingsSaved`),`success`)},onError:e=>{o(`Failed to save: ${e.message}`,`error`)},onSettled:()=>{gr.current=!1}}),br=q({mutationFn:({id:e,data:t})=>Z.updatePrinter(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:[`printers`]}),o(i(`settings.toast.cameraSettingsSaved`),`success`)},onError:e=>{o(`Failed to update printer: ${e.message}`,`error`)}});(0,f.useEffect)(()=>{let e=vr.current;if(!(_r.current||!A||!qt||!e)&&!(s&&!d(`settings:update`))&&(e.auto_archive!==A.auto_archive||e.save_thumbnails!==A.save_thumbnails||e.capture_finish_photo!==A.capture_finish_photo||(e.finish_photo_restore_plate??!0)!==(A.finish_photo_restore_plate??!0)||e.default_filament_cost!==A.default_filament_cost||e.currency!==A.currency||e.energy_cost_per_kwh!==A.energy_cost_per_kwh||e.energy_tracking_mode!==A.energy_tracking_mode||e.check_updates!==A.check_updates||(e.check_printer_firmware??!0)!==(A.check_printer_firmware??!0)||(e.include_beta_updates??!1)!==(A.include_beta_updates??!1)||(e.local_login_enabled??!0)!==(A.local_login_enabled??!0)||e.notification_language!==A.notification_language||(e.bed_cooled_threshold??35)!==(A.bed_cooled_threshold??35)||e.ams_humidity_good!==A.ams_humidity_good||e.ams_humidity_fair!==A.ams_humidity_fair||e.ams_temp_good!==A.ams_temp_good||e.ams_temp_fair!==A.ams_temp_fair||(e.ams_temp_alarm??null)!==(A.ams_temp_alarm??null)||e.ams_history_retention_days!==A.ams_history_retention_days||e.disable_filament_warnings!==A.disable_filament_warnings||e.prefer_lowest_filament!==A.prefer_lowest_filament||(e.queue_drying_enabled??!1)!==(A.queue_drying_enabled??!1)||(e.queue_drying_block??!1)!==(A.queue_drying_block??!1)||(e.ambient_drying_enabled??!1)!==(A.ambient_drying_enabled??!1)||(e.ambient_drying_sustained_minutes??0)!==(A.ambient_drying_sustained_minutes??0)||(e.print_drying_enabled??!1)!==(A.print_drying_enabled??!1)||(e.drying_presets??``)!==(A.drying_presets??``)||(e.ams_humidity_thresholds??``)!==(A.ams_humidity_thresholds??``)||e.per_printer_mapping_expanded!==A.per_printer_mapping_expanded||e.date_format!==A.date_format||e.time_format!==A.time_format||e.default_printer_id!==A.default_printer_id||e.ftp_retry_enabled!==A.ftp_retry_enabled||e.ftp_retry_count!==A.ftp_retry_count||e.ftp_retry_delay!==A.ftp_retry_delay||e.ftp_timeout!==A.ftp_timeout||e.mqtt_enabled!==A.mqtt_enabled||e.mqtt_broker!==A.mqtt_broker||e.mqtt_port!==A.mqtt_port||e.mqtt_username!==A.mqtt_username||e.mqtt_password!==A.mqtt_password||e.mqtt_topic_prefix!==A.mqtt_topic_prefix||e.mqtt_use_tls!==A.mqtt_use_tls||e.external_url!==A.external_url||e.ha_enabled!==A.ha_enabled||e.ha_url!==A.ha_url||e.ha_token!==A.ha_token||(e.library_archive_mode??`ask`)!==(A.library_archive_mode??`ask`)||Number(e.library_disk_warning_gb??5)!==Number(A.library_disk_warning_gb??5)||(e.preferred_slicer??`bambu_studio`)!==(A.preferred_slicer??`bambu_studio`)||U8(e.slice_engine)!==U8(A.slice_engine)||(e.open_in_slicer??null)!==(A.open_in_slicer??null)||(e.use_slicer_api??!1)!==(A.use_slicer_api??!1)||(e.orcaslicer_api_url??``)!==(A.orcaslicer_api_url??``)||(e.slicer_stall_timeout_minutes??15)!==(A.slicer_stall_timeout_minutes??15)||(e.bambu_studio_api_url??``)!==(A.bambu_studio_api_url??``)||e.prometheus_enabled!==A.prometheus_enabled||e.prometheus_token!==A.prometheus_token||(e.user_notifications_enabled??!0)!==(A.user_notifications_enabled??!0)||(e.default_bed_levelling??`auto`)!==(A.default_bed_levelling??`auto`)||(e.default_flow_cali??`auto`)!==(A.default_flow_cali??`auto`)||(e.default_vibration_cali??!0)!==(A.default_vibration_cali??!0)||(e.default_layer_inspect??!1)!==(A.default_layer_inspect??!1)||(e.default_timelapse??!1)!==(A.default_timelapse??!1)||(e.default_nozzle_offset_cali??`auto`)!==(A.default_nozzle_offset_cali??`auto`)||(e.default_confirm_outcome??!1)!==(A.default_confirm_outcome??!1)||(e.confirm_outcome_external_prints??!1)!==(A.confirm_outcome_external_prints??!1)||(e.confirm_default_good_on_plate_clear??!1)!==(A.confirm_default_good_on_plate_clear??!1)||(e.stagger_group_size??2)!==(A.stagger_group_size??2)||(e.stagger_interval_minutes??5)!==(A.stagger_interval_minutes??5)||(e.require_plate_clear??!1)!==(A.require_plate_clear??!1)||(e.queue_max_concurrent_uploads??4)!==(A.queue_max_concurrent_uploads??4)||(e.preheat_enabled??!1)!==(A.preheat_enabled??!1)||(e.preheat_filament_targets??``)!==(A.preheat_filament_targets??``)||(e.preheat_max_wait_seconds??900)!==(A.preheat_max_wait_seconds??900)||(e.preheat_soak_seconds??300)!==(A.preheat_soak_seconds??300)||(e.queue_keep_bed_warm??!1)!==(A.queue_keep_bed_warm??!1)||(e.queue_keep_warm_bed_temp??90)!==(A.queue_keep_warm_bed_temp??90)||(e.queue_keep_warm_max_minutes??120)!==(A.queue_keep_warm_max_minutes??120)||(e.nozzle_temp_presets??``)!==(A.nozzle_temp_presets??``)||(e.bed_temp_presets??``)!==(A.bed_temp_presets??``)||(e.chamber_temp_presets??``)!==(A.chamber_temp_presets??``)||(e.fan_speed_presets??``)!==(A.fan_speed_presets??``)||(e.session_max_hours??24)!==(A.session_max_hours??24)||(e.billing_enabled??!1)!==(A.billing_enabled??!1)||(e.printer_kill_switch_enabled??!1)!==(A.printer_kill_switch_enabled??!1)||(e.finance_budget_reset_day??1)!==(A.finance_budget_reset_day??1)||(e.finance_budget_reset_timezone??`UTC`)!==(A.finance_budget_reset_timezone??`UTC`))&&!gr.current)return mr.current&&clearTimeout(mr.current),mr.current=setTimeout(()=>{if(gr.current)return;gr.current=!0;let e={auto_archive:A.auto_archive,save_thumbnails:A.save_thumbnails,capture_finish_photo:A.capture_finish_photo,finish_photo_restore_plate:A.finish_photo_restore_plate??!0,default_filament_cost:A.default_filament_cost,currency:A.currency,energy_cost_per_kwh:A.energy_cost_per_kwh,energy_tracking_mode:A.energy_tracking_mode,check_updates:A.check_updates,check_printer_firmware:A.check_printer_firmware,include_beta_updates:A.include_beta_updates,local_login_enabled:A.local_login_enabled,notification_language:A.notification_language,bed_cooled_threshold:A.bed_cooled_threshold,ams_humidity_good:A.ams_humidity_good,ams_humidity_fair:A.ams_humidity_fair,ams_temp_good:A.ams_temp_good,ams_temp_fair:A.ams_temp_fair,ams_temp_alarm:A.ams_temp_alarm??null,ams_history_retention_days:A.ams_history_retention_days,disable_filament_warnings:A.disable_filament_warnings,prefer_lowest_filament:A.prefer_lowest_filament,queue_drying_enabled:A.queue_drying_enabled,queue_drying_block:A.queue_drying_block,ambient_drying_enabled:A.ambient_drying_enabled,ambient_drying_sustained_minutes:A.ambient_drying_sustained_minutes,print_drying_enabled:A.print_drying_enabled,drying_presets:A.drying_presets,ams_humidity_thresholds:A.ams_humidity_thresholds,per_printer_mapping_expanded:A.per_printer_mapping_expanded,date_format:A.date_format,time_format:A.time_format,default_printer_id:A.default_printer_id,ftp_retry_enabled:A.ftp_retry_enabled,ftp_retry_count:A.ftp_retry_count,ftp_retry_delay:A.ftp_retry_delay,ftp_timeout:A.ftp_timeout,mqtt_enabled:A.mqtt_enabled,mqtt_broker:A.mqtt_broker,mqtt_port:A.mqtt_port,mqtt_username:A.mqtt_username,mqtt_password:A.mqtt_password,mqtt_topic_prefix:A.mqtt_topic_prefix,mqtt_use_tls:A.mqtt_use_tls,external_url:A.external_url,ha_enabled:A.ha_enabled,ha_url:A.ha_url,ha_token:A.ha_token,library_archive_mode:A.library_archive_mode,library_disk_warning_gb:A.library_disk_warning_gb,preferred_slicer:A.preferred_slicer,slice_engine:A.slice_engine,open_in_slicer:A.open_in_slicer,use_slicer_api:A.use_slicer_api,orcaslicer_api_url:A.orcaslicer_api_url,slicer_stall_timeout_minutes:A.slicer_stall_timeout_minutes,bambu_studio_api_url:A.bambu_studio_api_url,prometheus_enabled:A.prometheus_enabled,prometheus_token:A.prometheus_token,user_notifications_enabled:A.user_notifications_enabled,default_bed_levelling:A.default_bed_levelling,default_flow_cali:A.default_flow_cali,default_vibration_cali:A.default_vibration_cali,default_layer_inspect:A.default_layer_inspect,default_timelapse:A.default_timelapse,default_nozzle_offset_cali:A.default_nozzle_offset_cali,default_confirm_outcome:A.default_confirm_outcome,confirm_outcome_external_prints:A.confirm_outcome_external_prints,confirm_default_good_on_plate_clear:A.confirm_default_good_on_plate_clear,stagger_group_size:A.stagger_group_size,stagger_interval_minutes:A.stagger_interval_minutes,require_plate_clear:A.require_plate_clear,queue_max_concurrent_uploads:A.queue_max_concurrent_uploads,preheat_enabled:A.preheat_enabled,preheat_filament_targets:A.preheat_filament_targets,preheat_max_wait_seconds:A.preheat_max_wait_seconds,preheat_soak_seconds:A.preheat_soak_seconds,queue_keep_bed_warm:A.queue_keep_bed_warm,queue_keep_warm_bed_temp:A.queue_keep_warm_bed_temp,queue_keep_warm_max_minutes:A.queue_keep_warm_max_minutes,nozzle_temp_presets:A.nozzle_temp_presets,bed_temp_presets:A.bed_temp_presets,chamber_temp_presets:A.chamber_temp_presets,fan_speed_presets:A.fan_speed_presets,session_max_hours:A.session_max_hours,billing_enabled:A.billing_enabled,printer_kill_switch_enabled:A.printer_kill_switch_enabled,finance_budget_reset_day:A.finance_budget_reset_day,finance_budget_reset_timezone:A.finance_budget_reset_timezone};yr.mutate(e)},500),()=>{mr.current&&clearTimeout(mr.current)}},[A,qt,yr,s,d,o,i]);let xr=(0,f.useCallback)((e,t)=>{if(s&&!d(`settings:update`)){o(i(`settings.toast.noPermissionUpdate`),`error`);return}j(n=>n?{...n,[e]:t}:null)},[s,d,o,i]),Sr=async(e,t,n)=>{if(!t){o(i(`settings.toast.enterCameraUrl`),`error`);return}Gt(t=>({...t,[e]:!0})),Ut(t=>({...t,[e]:null}));try{let r=await Z.testExternalCamera(e,t,n);Ut(t=>({...t,[e]:r})),r.success?o(r.coalesced?i(`settings.toast.cameraConnectedCoalesced`,{resolution:r.resolution||``}):i(`settings.toast.cameraConnected`,{resolution:r.resolution||``}),`success`):o(r.error||i(`settings.toast.connectionFailed`),`error`)}catch(t){let n=t instanceof Error?t.message:i(`settings.toast.testFailed`);Ut(t=>({...t,[e]:{success:!1,error:n}})),o(n,`error`)}finally{Gt(t=>({...t,[e]:!1}))}},[Cr,wr]=(0,f.useState)({}),Tr=(0,f.useRef)({}),Er=(0,f.useRef)(new Set),[Dr,Or]=(0,f.useState)({}),kr=(0,f.useRef)({}),Ar=(0,f.useRef)(new Set);(0,f.useEffect)(()=>{if(ln){let e={},t={};ln.forEach(n=>{n.external_camera_url&&!Er.current.has(n.id)&&(e[n.id]=n.external_camera_url,Er.current.add(n.id)),n.external_camera_snapshot_url&&!Ar.current.has(n.id)&&(t[n.id]=n.external_camera_snapshot_url,Ar.current.add(n.id))}),Object.keys(e).length>0&&wr(t=>({...t,...e})),Object.keys(t).length>0&&Or(e=>({...e,...t}))}},[ln]);let jr=(e,t)=>{wr(n=>({...n,[e]:t})),Tr.current[e]&&clearTimeout(Tr.current[e]),Tr.current[e]=setTimeout(()=>{br.mutate({id:e,data:{external_camera_url:t||null}})},800)},Mr=(e,t)=>{Or(n=>({...n,[e]:t})),kr.current[e]&&clearTimeout(kr.current[e]),kr.current[e]=setTimeout(()=>{br.mutate({id:e,data:{external_camera_snapshot_url:t||null}})},800)},Nr=(e,t)=>{let n={};t.type!==void 0&&(n.external_camera_type=t.type||null),t.enabled!==void 0&&(n.external_camera_enabled=t.enabled),t.rotation!==void 0&&(n.camera_rotation=t.rotation),br.mutate({id:e,data:n})};if(Jt||!A)return(0,G.jsx)(`div`,{className:`p-4 md:p-8 flex justify-center`,children:(0,G.jsx)(Y,{className:`w-8 h-8 text-bambu-green animate-spin`})});let Pr=AKe().map(e=>({...e,label:i(e.labelKey,e.labelFallback??e.labelKey)})),Fr=xe.trim().toLowerCase(),Ir=Fr?Pr.filter(e=>e.label.toLowerCase().includes(Fr)||e.keywords.toLowerCase().includes(Fr)).slice(0,8):[],Lr=e=>{ze(e.tab),e.subTab&&Ie(e.subTab),Se(``),setTimeout(()=>{let t=document.getElementById(e.anchor);t&&(t.scrollIntoView({behavior:`smooth`,block:`start`}),t.classList.add(`ring-2`,`ring-bambu-green`),setTimeout(()=>t.classList.remove(`ring-2`,`ring-bambu-green`),1500))},50)},Rr=(A?.docker_compose_dir??``).trim()||(In?.compose_dir_detected??``),zr=Rr?`cd ${/\s/.test(Rr)?`"${Rr}"`:Rr} && docker compose pull && docker compose up -d`:`docker compose pull && docker compose up -d`;return(0,G.jsx)(Rd,{density:`dense`,children:(0,G.jsxs)(`div`,{className:`p-4 md:p-8`,children:[(0,G.jsxs)(`div`,{className:`mb-4 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`h1`,{className:`text-2xl font-bold text-white flex items-center gap-3`,children:[(0,G.jsx)(Zl,{className:`w-7 h-7 text-bambu-green`}),i(`settings.title`)]}),(0,G.jsx)(`p`,{className:`text-bambu-gray mt-1`,children:i(`settings.configureBambuddy`)})]}),(0,G.jsxs)(`div`,{className:`relative sm:w-72`,children:[(0,G.jsx)(Kl,{className:`w-4 h-4 text-bambu-gray absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none`}),(0,G.jsx)(`input`,{type:`text`,value:xe,onChange:e=>Se(e.target.value),placeholder:i(`settings.searchPlaceholder`,`Search settings…`),className:`w-full pl-9 pr-8 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`}),xe&&(0,G.jsx)(`button`,{onClick:()=>Se(``),className:`absolute right-2 top-1/2 -translate-y-1/2 p-1 text-bambu-gray hover:text-white`,"aria-label":`Clear`,children:(0,G.jsx)($u,{className:`w-3.5 h-3.5`})}),Ir.length>0&&(0,G.jsx)(`div`,{className:`absolute top-full left-0 right-0 mt-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl z-30 overflow-hidden`,children:Ir.map(e=>(0,G.jsxs)(`button`,{onClick:()=>Lr(e),className:`w-full px-3 py-2 text-left hover:bg-bambu-dark-tertiary transition-colors border-b border-bambu-dark-tertiary last:border-b-0`,children:[(0,G.jsx)(`p`,{className:`text-sm text-white`,children:e.label}),(0,G.jsxs)(`p`,{className:`text-xs text-bambu-gray`,children:[i(`settings.tabs.${e.tab===`virtual-printer`?`virtualPrinter`:e.tab===`failure-detection`?`failureDetection`:e.tab}`),e.subTab?` › ${i(`settings.tabs.${e.subTab}`,e.subTab)}`:``]})]},e.anchor))}),Fr&&Ir.length===0&&(0,G.jsx)(`div`,{className:`absolute top-full left-0 right-0 mt-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl z-30 p-3`,children:(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray italic`,children:i(`settings.noSearchResults`,`No matching settings.`)})})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-col lg:flex-row gap-4 lg:gap-6`,children:[(0,G.jsxs)(`nav`,{className:`flex flex-wrap gap-1 border-b border-bambu-dark-tertiary lg:flex-col lg:flex-nowrap lg:gap-0 lg:border-b-0 lg:border-r lg:w-60 lg:flex-shrink-0 lg:self-start lg:sticky lg:top-4`,children:[(0,G.jsxs)(`button`,{onClick:()=>ze(`general`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px lg:border-b-0 lg:border-l-2 lg:-ml-px lg:mb-0 lg:justify-start flex items-center gap-2 ${Ne===`general`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(Zl,{className:`w-4 h-4 shrink-0`}),i(`settings.tabs.general`)]}),(0,G.jsxs)(`button`,{onClick:()=>ze(`plugs`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px lg:border-b-0 lg:border-l-2 lg:-ml-px lg:mb-0 lg:justify-start flex items-center gap-2 ${Ne===`plugs`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(Ol,{className:`w-4 h-4 shrink-0`}),i(`settings.tabs.smartPlugs`),$t&&$t.length>0&&(0,G.jsx)(`span`,{className:`text-xs bg-bambu-dark-tertiary px-1.5 py-0.5 rounded-full shrink-0`,children:$t.length})]}),(0,G.jsxs)(`button`,{onClick:()=>ze(`sensors`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px lg:border-b-0 lg:border-l-2 lg:-ml-px lg:mb-0 lg:justify-start flex items-center gap-2 ${Ne===`sensors`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(vc,{className:`w-4 h-4 shrink-0`}),i(`settings.tabs.sensors`),(un?.length??0)+(dn?.length??0)>0&&(0,G.jsx)(`span`,{className:`text-xs bg-bambu-dark-tertiary px-1.5 py-0.5 rounded-full shrink-0`,children:(un?.length??0)+(dn?.length??0)})]}),(0,G.jsxs)(`button`,{onClick:()=>ze(`notifications`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px lg:border-b-0 lg:border-l-2 lg:-ml-px lg:mb-0 lg:justify-start flex items-center gap-2 ${Ne===`notifications`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(Vo,{className:`w-4 h-4 shrink-0`}),i(`settings.tabs.notifications`),W&&W.length>0&&(0,G.jsx)(`span`,{className:`text-xs bg-bambu-dark-tertiary px-1.5 py-0.5 rounded-full shrink-0`,children:W.length})]}),(0,G.jsxs)(`button`,{onClick:()=>ze(`queue`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px lg:border-b-0 lg:border-l-2 lg:-ml-px lg:mb-0 lg:justify-start flex items-center gap-2 ${Ne===`queue`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(Kc,{className:`w-4 h-4 shrink-0`}),i(`settings.tabs.queue`,`Workflow`)]}),(0,G.jsxs)(`button`,{onClick:()=>ze(`filament`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px lg:border-b-0 lg:border-l-2 lg:-ml-px lg:mb-0 lg:justify-start flex items-center gap-2 ${Ne===`filament`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(Ls,{className:`w-4 h-4 shrink-0`}),i(`settings.tabs.filament`)]}),(0,G.jsxs)(`button`,{onClick:()=>ze(`network`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px lg:border-b-0 lg:border-l-2 lg:-ml-px lg:mb-0 lg:justify-start flex items-center gap-2 ${Ne===`network`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(Yu,{className:`w-4 h-4 shrink-0`}),i(`settings.tabs.network`),(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full shrink-0 ${Vn?.enabled?`bg-green-400`:`bg-gray-500`}`})]}),(0,G.jsxs)(`button`,{onClick:()=>ze(`apikeys`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px lg:border-b-0 lg:border-l-2 lg:-ml-px lg:mb-0 lg:justify-start flex items-center gap-2 ${Ne===`apikeys`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(Bc,{className:`w-4 h-4 shrink-0`}),i(`settings.tabs.apiKeys`),an&&an.length>0&&(0,G.jsx)(`span`,{className:`text-xs bg-bambu-dark-tertiary px-1.5 py-0.5 rounded-full shrink-0`,children:an.length})]}),(0,G.jsxs)(`button`,{onClick:()=>ze(`virtual-printer`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px lg:border-b-0 lg:border-l-2 lg:-ml-px lg:mb-0 lg:justify-start flex items-center gap-2 ${Ne===`virtual-printer`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(Ml,{className:`w-4 h-4 shrink-0`}),i(`settings.tabs.virtualPrinter`),(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full shrink-0 ${bn?`bg-green-400`:`bg-gray-500`}`})]}),(0,G.jsxs)(`button`,{onClick:()=>ze(`spoolbuddy`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px lg:border-b-0 lg:border-l-2 lg:-ml-px lg:mb-0 lg:justify-start flex items-center gap-2 ${Ne===`spoolbuddy`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(Hl,{className:`w-4 h-4 shrink-0`}),i(`settings.tabs.spoolbuddy`),Sn>0&&(0,G.jsx)(`span`,{className:`text-xs bg-bambu-dark-tertiary px-1.5 py-0.5 rounded-full shrink-0`,children:Sn}),(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full shrink-0 ${Cn?`bg-green-400`:`bg-gray-500`}`})]}),(0,G.jsxs)(`button`,{onClick:()=>ze(`failure-detection`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px lg:border-b-0 lg:border-l-2 lg:-ml-px lg:mb-0 lg:justify-start flex items-center gap-2 ${Ne===`failure-detection`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(Ul,{className:`w-4 h-4 shrink-0`}),i(`settings.tabs.failureDetection`),(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full shrink-0 ${Tn?`bg-green-400`:`bg-gray-500`}`})]}),(0,G.jsxs)(`button`,{onClick:()=>ze(`users`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px lg:border-b-0 lg:border-l-2 lg:-ml-px lg:mb-0 lg:justify-start flex items-center gap-2 ${Ne===`users`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(Bu,{className:`w-4 h-4 shrink-0`}),i(`settings.tabs.users`),s&&(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full shrink-0 bg-green-400`})]}),(0,G.jsxs)(`button`,{onClick:()=>ze(`backup`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px lg:border-b-0 lg:border-l-2 lg:-ml-px lg:mb-0 lg:justify-start flex items-center gap-2 ${Ne===`backup`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(Rs,{className:`w-4 h-4 shrink-0`}),i(`settings.tabs.backup`),(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full shrink-0 ${Un?.is_authenticated&&Hn?.configured&&Hn?.enabled||qt?.local_backup_enabled?`bg-green-400`:`bg-gray-500`}`})]})]}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[Ne===`general`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`a`,{href:zf(gn,`app-settings`),target:`_blank`,rel:`noopener noreferrer`,className:`group block mb-4 lg:mb-6 rounded-xl border border-bambu-green/30 bg-gradient-to-br from-bambu-green/15 via-bambu-green/5 to-transparent hover:border-bambu-green/50 hover:from-bambu-green/20 transition-colors`,children:(0,G.jsxs)(`div`,{className:`flex flex-col md:flex-row items-start md:items-center gap-4 p-4 md:p-5`,children:[(0,G.jsx)(`div`,{className:`p-3 rounded-lg bg-bambu-green/20 text-bambu-green flex-shrink-0`,children:gn===`business`?(0,G.jsx)(Ko,{className:`w-6 h-6`}):(0,G.jsx)(jc,{className:`w-6 h-6`})}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`p`,{className:`text-base font-semibold text-white`,children:gn===`business`?i(`sponsors.businessTitle`,`Bambuddy for business`):i(`sponsors.sectionTitle`,`Independent & community-funded`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mt-0.5`,children:gn===`business`?i(`sponsors.businessTagline`,`You're running {{count}} printers. Priority support, commercial licensing and invoicing are available for teams and print farms.`,{count:ln?.length??0}):i(`sponsors.tagline`,`Bambuddy is free and stays that way because people choose to support it. No VC, no cloud lock-in.`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-2 rounded-lg bg-bambu-green/20 text-bambu-green group-hover:bg-bambu-green/30 text-sm font-medium whitespace-nowrap self-start md:self-auto`,children:[gn===`business`?i(`sponsors.businessCta`,`Bambuddy for business`):i(`sponsors.viewSupporters`,`View supporters`),(0,G.jsx)(Xs,{className:`w-4 h-4`})]})]})}),(0,G.jsxs)(`div`,{className:`flex flex-col lg:flex-row gap-4 lg:gap-6`,children:[(0,G.jsxs)(`div`,{className:`space-y-3 flex-1 lg:max-w-xl`,children:[(0,G.jsxs)(zd,{id:`card-general`,children:[(0,G.jsx)(Bd,{children:(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:i(`settings.general`)})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:[(0,G.jsx)(Cc,{className:`w-4 h-4 inline mr-1`}),i(`settings.language`)]}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(`select`,{value:a.language,onChange:e=>{let t=e.target.value;if(s&&!d(`settings:update`)){o(i(`settings.toast.noPermissionUpdate`),`error`);return}a.changeLanguage(t),yr.mutate({language:t})},className:`w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer`,children:St.map(e=>(0,G.jsxs)(`option`,{value:e.code,children:[e.nativeName,` (`,e.name,`)`]},e.code))}),(0,G.jsx)(as,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.languageDescription`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.defaultView`)}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(`select`,{value:ke,onChange:e=>Kt(e.target.value),className:`w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer`,children:ah.map(e=>(0,G.jsx)(`option`,{value:e.to,children:i(e.labelKey)},e.id))}),(0,G.jsx)(as,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.defaultViewDescription`)})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.dateFormat`)}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsxs)(`select`,{value:A.date_format||`system`,onChange:e=>xr(`date_format`,e.target.value),className:`w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer`,children:[(0,G.jsx)(`option`,{value:`system`,children:i(`settings.systemDefault`)}),(0,G.jsx)(`option`,{value:`us`,children:i(`settings.dateFormatUs`)}),(0,G.jsx)(`option`,{value:`eu`,children:i(`settings.dateFormatEu`)}),(0,G.jsx)(`option`,{value:`iso`,children:i(`settings.dateFormatIso`)})]}),(0,G.jsx)(as,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.timeFormat`)}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsxs)(`select`,{value:A.time_format||`system`,onChange:e=>xr(`time_format`,e.target.value),className:`w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer`,children:[(0,G.jsx)(`option`,{value:`system`,children:i(`settings.systemDefault`)}),(0,G.jsx)(`option`,{value:`12h`,children:i(`settings.timeFormat12`)}),(0,G.jsx)(`option`,{value:`24h`,children:i(`settings.timeFormat24`)})]}),(0,G.jsx)(as,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.defaultPrinter`)}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsxs)(`select`,{value:A.default_printer_id??``,onChange:e=>xr(`default_printer_id`,e.target.value?Number(e.target.value):null),className:`w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer`,children:[(0,G.jsx)(`option`,{value:``,children:i(`settings.noDefaultPrinter`)}),ln?.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,G.jsx)(as,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.defaultPrinterDescription`)})]})]})]}),(0,G.jsxs)(zd,{id:`card-appearance`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(vl,{className:`w-5 h-5`}),i(`settings.appearance`)]})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,G.jsxs)(`label`,{className:`text-sm text-bambu-gray`,children:[i(`settings.theme`),`:`]}),(0,G.jsx)(`div`,{className:`flex gap-1`,children:[{id:`dark`,label:i(`settings.themeDark`)},{id:`light`,label:i(`settings.themeLight`)},{id:`system`,label:i(`settings.themeSystem`)}].map(({id:e,label:t})=>(0,G.jsx)(`button`,{onClick:()=>{x(e),o(i(`settings.toast.settingsSaved`),`success`)},className:`px-3 py-1 text-xs rounded-lg border transition-colors ${p===e?`border-bambu-green bg-bambu-green/10 text-bambu-green`:`border-gray-300 dark:border-bambu-dark-tertiary text-gray-500 dark:text-bambu-gray hover:text-gray-900 dark:hover:text-white cursor-pointer`}`,children:t},e))})]}),(0,G.jsxs)(`div`,{className:`space-y-3 p-4 rounded-lg border ${m===`dark`?`border-bambu-green bg-bambu-green/5`:`border-bambu-dark-tertiary`}`,children:[(0,G.jsxs)(`h3`,{className:`text-sm font-medium text-white flex items-center gap-2`,children:[i(`settings.darkMode`),m===`dark`&&(0,G.jsx)(`span`,{className:`text-xs text-bambu-green`,children:i(`settings.active`)})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:i(`settings.background`)}),(0,G.jsxs)(`select`,{value:g,onChange:e=>{C(e.target.value),o(i(`settings.toast.settingsSaved`),`success`)},className:`w-full px-2 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,G.jsx)(`option`,{value:`neutral`,children:i(`settings.bgNeutral`)}),(0,G.jsx)(`option`,{value:`warm`,children:i(`settings.bgWarm`)}),(0,G.jsx)(`option`,{value:`cool`,children:i(`settings.bgCool`)}),(0,G.jsx)(`option`,{value:`oled`,children:i(`settings.bgOled`)}),(0,G.jsx)(`option`,{value:`slate`,children:i(`settings.bgSlate`)}),(0,G.jsx)(`option`,{value:`forest`,children:i(`settings.bgForest`)})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:i(`settings.accent`)}),(0,G.jsxs)(`select`,{value:_,onChange:e=>{w(e.target.value),o(i(`settings.toast.settingsSaved`),`success`)},className:`w-full px-2 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,G.jsx)(`option`,{value:`green`,children:i(`settings.accentGreen`)}),(0,G.jsx)(`option`,{value:`teal`,children:i(`settings.accentTeal`)}),(0,G.jsx)(`option`,{value:`blue`,children:i(`settings.accentBlue`)}),(0,G.jsx)(`option`,{value:`orange`,children:i(`settings.accentOrange`)}),(0,G.jsx)(`option`,{value:`purple`,children:i(`settings.accentPurple`)}),(0,G.jsx)(`option`,{value:`red`,children:i(`settings.accentRed`)})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:i(`settings.style`)}),(0,G.jsxs)(`select`,{value:h,onChange:e=>{S(e.target.value),o(i(`settings.toast.settingsSaved`),`success`)},className:`w-full px-2 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,G.jsx)(`option`,{value:`classic`,children:i(`settings.styleClassic`)}),(0,G.jsx)(`option`,{value:`glow`,children:i(`settings.styleGlow`)}),(0,G.jsx)(`option`,{value:`vibrant`,children:i(`settings.styleVibrant`)})]})]})]})]}),(0,G.jsxs)(`div`,{className:`space-y-3 p-4 rounded-lg border ${m===`light`?`border-bambu-green bg-bambu-green/5`:`border-bambu-dark-tertiary`}`,children:[(0,G.jsxs)(`h3`,{className:`text-sm font-medium text-white flex items-center gap-2`,children:[i(`settings.lightMode`),m===`light`&&(0,G.jsx)(`span`,{className:`text-xs text-bambu-green`,children:i(`settings.active`)})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:i(`settings.background`)}),(0,G.jsxs)(`select`,{value:y,onChange:e=>{E(e.target.value),o(i(`settings.toast.settingsSaved`),`success`)},className:`w-full px-2 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,G.jsx)(`option`,{value:`neutral`,children:i(`settings.bgNeutral`)}),(0,G.jsx)(`option`,{value:`warm`,children:i(`settings.bgWarm`)}),(0,G.jsx)(`option`,{value:`cool`,children:i(`settings.bgCool`)})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:i(`settings.accent`)}),(0,G.jsxs)(`select`,{value:b,onChange:e=>{D(e.target.value),o(i(`settings.toast.settingsSaved`),`success`)},className:`w-full px-2 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,G.jsx)(`option`,{value:`green`,children:i(`settings.accentGreen`)}),(0,G.jsx)(`option`,{value:`teal`,children:i(`settings.accentTeal`)}),(0,G.jsx)(`option`,{value:`blue`,children:i(`settings.accentBlue`)}),(0,G.jsx)(`option`,{value:`orange`,children:i(`settings.accentOrange`)}),(0,G.jsx)(`option`,{value:`purple`,children:i(`settings.accentPurple`)}),(0,G.jsx)(`option`,{value:`red`,children:i(`settings.accentRed`)})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:i(`settings.style`)}),(0,G.jsxs)(`select`,{value:v,onChange:e=>{T(e.target.value),o(i(`settings.toast.settingsSaved`),`success`)},className:`w-full px-2 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,G.jsx)(`option`,{value:`classic`,children:i(`settings.styleClassic`)}),(0,G.jsx)(`option`,{value:`glow`,children:i(`settings.styleGlow`)}),(0,G.jsx)(`option`,{value:`vibrant`,children:i(`settings.styleVibrant`)})]})]})]})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.themeToggleHint`)}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between pt-2 border-t border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.progressInTitle`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.progressInTitleDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:O,onChange:e=>{k(e.target.checked),o(i(`settings.toast.settingsSaved`),`success`)},className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]})]})]}),(0,G.jsxs)(zd,{id:`card-archive`,children:[(0,G.jsx)(Bd,{children:(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:i(`settings.archiveSettings`)})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.autoArchivePrints`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.autoArchiveDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.auto_archive,onChange:e=>xr(`auto_archive`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.saveThumbnails`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.saveThumbnailsDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.save_thumbnails,onChange:e=>xr(`save_thumbnails`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.captureFinishPhoto`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.captureFinishPhotoDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.capture_finish_photo,onChange:e=>xr(`capture_finish_photo`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),A.capture_finish_photo&&(0,G.jsxs)(`div`,{className:`flex items-center justify-between pl-4 border-l-2 border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.finishPhotoRestorePlate`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.finishPhotoRestorePlateDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.finish_photo_restore_plate??!0,onChange:e=>xr(`finish_photo_restore_plate`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),A.capture_finish_photo&&En&&!En.installed&&(0,G.jsxs)(`div`,{className:`flex items-start gap-2 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg`,children:[(0,G.jsx)(Pu,{className:`w-5 h-5 text-yellow-500 flex-shrink-0 mt-0.5`}),(0,G.jsxs)(`div`,{className:`text-sm`,children:[(0,G.jsx)(`p`,{className:`text-yellow-500 font-medium`,children:i(`settings.ffmpegNotInstalled`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray mt-1`,children:i(`settings.ffmpegRequired`)})]})]}),Mn&&Nn&&(0,G.jsxs)(`div`,{className:`border-t border-bambu-dark-tertiary pt-3 mt-3 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`archiveAutoPurge.enableLabel`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`archiveAutoPurge.enableDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:Nn.enabled,onChange:e=>Fn({enabled:e.target.checked}),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`archiveAutoPurge.ageLabel`)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{type:`number`,min:7,max:3650,disabled:!Nn.enabled,value:Nn.days,onChange:e=>Fn({days:Math.max(7,Math.min(3650,parseInt(e.target.value||`0`,10)||0))}),className:`w-24 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none disabled:opacity-50`}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:i(`archiveAutoPurge.days`)})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`archiveAutoPurge.ageDescription`)})]}),(0,G.jsxs)(`label`,{className:`flex items-start gap-2 cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,disabled:!Nn.enabled,checked:Nn.purge_stats,onChange:e=>Fn({purge_stats:e.target.checked}),className:`mt-0.5 shrink-0 disabled:opacity-50`}),(0,G.jsxs)(`span`,{className:`text-sm`,children:[(0,G.jsx)(`span`,{className:`text-white block`,children:i(`archiveAutoPurge.purgeStatsLabel`)}),(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray block mt-0.5`,children:i(`archiveAutoPurge.purgeStatsDescription`)})]})]})]})]})]})]}),(0,G.jsxs)(`div`,{className:`space-y-3 flex-1 lg:max-w-md`,children:[(0,G.jsxs)(zd,{id:`card-camera`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(Hu,{className:`w-5 h-5 text-bambu-green`}),i(`settings.camera`)]})}),(0,G.jsx)(Vd,{className:`space-y-3`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-sm font-medium text-white mb-2`,children:i(`settings.externalCameras`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mb-3`,children:i(`settings.externalCamerasDescription`)}),ln&&ln.length>0?(0,G.jsx)(`div`,{className:`space-y-3`,children:ln.map(e=>(0,G.jsxs)(`div`,{className:`p-3 bg-bambu-dark rounded-lg`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,G.jsx)(`span`,{className:`text-white font-medium text-sm`,children:e.name}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:e.external_camera_enabled,onChange:t=>Nr(e.id,{enabled:t.target.checked}),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-9 h-5 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-bambu-green`})]})]}),e.external_camera_enabled&&(0,G.jsxs)(`div`,{className:`space-y-2 mt-2`,children:[(0,G.jsx)(`input`,{type:`text`,placeholder:e.external_camera_type===`usb`?i(`settings.cameraPlaceholderUsb`):i(`settings.cameraPlaceholderUrl`),value:Cr[e.id]??e.external_camera_url??``,onChange:t=>jr(e.id,t.target.value),className:`w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none`}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsxs)(`select`,{value:e.external_camera_type||`mjpeg`,onChange:t=>Nr(e.id,{type:t.target.value}),className:`flex-1 px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none`,children:[(0,G.jsx)(`option`,{value:`mjpeg`,children:i(`settings.cameraTypeMjpeg`)}),(0,G.jsx)(`option`,{value:`rtsp`,children:i(`settings.cameraTypeRtsp`)}),(0,G.jsx)(`option`,{value:`snapshot`,children:i(`settings.cameraTypeSnapshot`)}),(0,G.jsx)(`option`,{value:`usb`,children:i(`settings.cameraTypeUsb`)})]}),(0,G.jsx)(Q,{size:`sm`,variant:`secondary`,onClick:()=>Sr(e.id,Cr[e.id]??e.external_camera_url??``,e.external_camera_type||`mjpeg`),disabled:Wt[e.id]||!(Cr[e.id]??e.external_camera_url),children:Wt[e.id]?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):i(`settings.test`)})]}),Ht[e.id]&&(0,G.jsx)(`div`,{className:`text-xs flex items-center gap-1 ${Ht[e.id]?.success?`text-green-500`:`text-red-500`}`,children:Ht[e.id]?.success?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ms,{className:`w-3 h-3`}),i(`settings.connected`),Ht[e.id]?.resolution&&` (${Ht[e.id]?.resolution})`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(bs,{className:`w-3 h-3`}),Ht[e.id]?.error||i(`settings.toast.connectionFailed`)]})}),(e.external_camera_type===`mjpeg`||e.external_camera_type===`rtsp`||e.external_camera_type===`usb`)&&(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`text-xs text-bambu-gray`,children:i(`settings.cameraSnapshotUrl`,`Snapshot URL (optional)`)}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(`input`,{type:`text`,placeholder:i(`settings.cameraSnapshotUrlPlaceholder`,`http://192.168.1.61:1984/api/frame.jpeg?src=printer`),value:Dr[e.id]??e.external_camera_snapshot_url??``,onChange:t=>Mr(e.id,t.target.value),className:`flex-1 px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none`}),(0,G.jsx)(Q,{size:`sm`,variant:`secondary`,onClick:()=>Sr(e.id,Dr[e.id]??e.external_camera_snapshot_url??``,`snapshot`),disabled:Wt[e.id]||!(Dr[e.id]??e.external_camera_snapshot_url),children:Wt[e.id]?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):i(`settings.test`)})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray opacity-75`,children:i(`settings.cameraSnapshotUrlHelp`,`Single-frame URL used for notification thumbnails, finish photos, timelapse and plate detection. Leave blank to capture from the live stream above. Useful for go2rtc (/api/frame.jpeg) and IP cameras with a dedicated snapshot endpoint.`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`label`,{className:`text-xs text-bambu-gray`,children:i(`settings.cameraRotation`)}),(0,G.jsxs)(`select`,{value:e.camera_rotation||0,onChange:t=>Nr(e.id,{rotation:parseInt(t.target.value)}),className:`px-2 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-xs focus:border-bambu-green focus:outline-none`,children:[(0,G.jsx)(`option`,{value:0,children:`0°`}),(0,G.jsx)(`option`,{value:90,children:`90°`}),(0,G.jsx)(`option`,{value:180,children:`180°`}),(0,G.jsx)(`option`,{value:270,children:`270°`})]})]})]})]},e.id))}):(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray italic`,children:i(`settings.noPrintersConfigured`)})]})})]}),(0,G.jsxs)(zd,{id:`card-cost`,children:[(0,G.jsx)(Bd,{children:(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:i(`settings.costTracking`)})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.currency`)}),(0,G.jsx)(`select`,{value:A.currency,onChange:e=>xr(`currency`,e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:Lf.map(e=>(0,G.jsx)(`option`,{value:e.code,children:e.label},e.code))})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.defaultFilamentCost`)}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(`span`,{className:`absolute left-3 top-1/2 -translate-y-1/2 text-bambu-gray text-sm pointer-events-none`,children:If(A.currency)}),(0,G.jsx)(Xp,{step:`0.01`,min:0,value:A.default_filament_cost,onChange:e=>xr(`default_filament_cost`,e),integer:!1,fallback:0,style:{paddingLeft:`${Math.max(2,If(A.currency).length*.6+1)}rem`},className:`w-full pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.electricityCost`)}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(`span`,{className:`absolute left-3 top-1/2 -translate-y-1/2 text-bambu-gray text-sm pointer-events-none`,children:If(A.currency)}),(0,G.jsx)(Xp,{step:`0.001`,min:0,value:A.energy_cost_per_kwh,onChange:e=>xr(`energy_cost_per_kwh`,e),integer:!1,fallback:0,style:{paddingLeft:`${Math.max(2,If(A.currency).length*.6+1)}rem`},className:`w-full pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.energyDisplayMode`)}),(0,G.jsxs)(`select`,{value:A.energy_tracking_mode||`total`,onChange:e=>xr(`energy_tracking_mode`,e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,G.jsx)(`option`,{value:`print`,children:i(`settings.printsOnly`)}),(0,G.jsx)(`option`,{value:`total`,children:i(`settings.totalConsumption`)})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:A.energy_tracking_mode===`print`?i(`settings.energyModePrintDescription`):i(`settings.energyModeTotalDescription`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.billingEnabled`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.billingEnabledDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.billing_enabled??!1,onChange:e=>xr(`billing_enabled`,e.target.checked),className:`peer sr-only`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary rounded-full peer-checked:bg-bambu-green peer-checked:after:translate-x-5 after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border after:rounded-full after:h-5 after:w-5 after:transition-all`})]})]}),A.billing_enabled&&(0,G.jsxs)(`div`,{className:`mt-4 flex items-center justify-between gap-4 rounded-lg border border-bambu-dark-tertiary bg-bambu-dark px-4 py-3`,children:[(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.printerKillSwitch`,`Unauthorized print kill switch`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.printerKillSwitchDescription`,`Immediately stop prints that start without authorization.`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.printer_kill_switch_enabled??!1,onChange:e=>xr(`printer_kill_switch_enabled`,e.target.checked),className:`peer sr-only`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary rounded-full peer-checked:bg-bambu-green peer-checked:after:translate-x-5 after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border after:rounded-full after:h-5 after:w-5 after:transition-all`})]})]}),A.billing_enabled&&(0,G.jsxs)(`div`,{className:`mt-4 rounded-lg border border-bambu-dark-tertiary bg-bambu-dark p-4`,children:[(0,G.jsx)(`div`,{className:`mb-3`,children:(0,G.jsxs)(`h4`,{className:`text-base font-medium text-white flex items-center gap-2`,children:[(0,G.jsx)(Qo,{className:`w-4 h-4 text-bambu-green`}),i(`settings.financeBudgetReset`,`Finance Monthly Budget Reset`)]})}),(0,G.jsxs)(`div`,{className:`flex gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:i(`settings.financeBudgetResetDay`,`Reset Day`)}),(0,G.jsx)(`input`,{type:`number`,min:1,max:31,value:A.finance_budget_reset_day??1,onChange:e=>xr(`finance_budget_reset_day`,Math.max(1,Math.min(31,parseInt(e.target.value,10)||1))),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.financeBudgetResetDayHelp`,`For short months, reset uses the last day of the month.`)})]}),(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:i(`settings.financeBudgetResetTimezone`,`Reset timezone`)}),(0,G.jsxs)(`select`,{value:A.finance_budget_reset_timezone??`UTC`,onChange:e=>xr(`finance_budget_reset_timezone`,e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`,children:[(0,G.jsx)(`option`,{value:`UTC`,children:`UTC`}),(0,G.jsx)(`option`,{value:`Europe/Berlin`,children:`Europe/Berlin`}),(0,G.jsx)(`option`,{value:`Europe/Vienna`,children:`Europe/Vienna`}),(0,G.jsx)(`option`,{value:`Europe/Zurich`,children:`Europe/Zurich`}),(0,G.jsx)(`option`,{value:`America/New_York`,children:`America/New_York`}),(0,G.jsx)(`option`,{value:`America/Chicago`,children:`America/Chicago`}),(0,G.jsx)(`option`,{value:`America/Denver`,children:`America/Denver`}),(0,G.jsx)(`option`,{value:`America/Los_Angeles`,children:`America/Los_Angeles`}),(0,G.jsx)(`option`,{value:`Asia/Tokyo`,children:`Asia/Tokyo`}),(0,G.jsx)(`option`,{value:`Asia/Singapore`,children:`Asia/Singapore`}),(0,G.jsx)(`option`,{value:`Australia/Sydney`,children:`Australia/Sydney`})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.financeBudgetResetTimezoneHelp`,`Budget window start is calculated in this timezone.`)})]})]})]}),A.billing_enabled&&l&&(0,G.jsxs)(`div`,{className:`mt-3`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>Ee(!0),disabled:De,children:De?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{className:`w-4 h-4 mr-2 animate-spin`}),i(`settings.rebuildLedgerInProgress`,`Starting...`)]}):i(`settings.rebuildLedger`,`Rebuild wallet ledger`)}),Te&&(0,G.jsx)(af,{title:i(`settings.rebuildLedgerConfirmTitle`,`Rebuild wallet ledger?`),message:i(`settings.rebuildLedgerConfirmMessage`,`This will rebuild the wallet ledger to repair historical balance values. Run this only if you know what you are doing.`),confirmText:i(`common.run`,`Run`),cancelText:i(`common.cancel`,`Cancel`),isLoading:De,loadingText:i(`common.running`,`Running`),variant:`warning`,onCancel:()=>Ee(!1),onConfirm:async()=>{Oe(!0);try{await Z.rebuildBalanceLedger(),o(i(`settings.rebuildLedgerStarted`,`Ledger rebuild started`),`success`),Ee(!1)}catch(e){o(e.message||`Failed to start ledger rebuild`,`error`)}finally{Oe(!1)}}})]})]})]})]}),(0,G.jsxs)(zd,{id:`card-filemanager`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(ac,{className:`w-5 h-5 text-bambu-green`}),i(`settings.fileManager`)]})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.createArchiveEntry`)}),(0,G.jsxs)(`select`,{value:A.library_archive_mode??`ask`,onChange:e=>xr(`library_archive_mode`,e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,G.jsx)(`option`,{value:`always`,children:i(`settings.archiveMode.always`)}),(0,G.jsx)(`option`,{value:`never`,children:i(`settings.archiveMode.never`)}),(0,G.jsx)(`option`,{value:`ask`,children:i(`settings.archiveMode.ask`)})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.createArchiveEntryDescription`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.lowDiskSpaceWarning`)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Xp,{min:.5,max:100,step:`0.5`,value:A.library_disk_warning_gb??5,onChange:e=>xr(`library_disk_warning_gb`,e),integer:!1,fallback:5,className:`w-24 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:`GB`})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.lowDiskSpaceDescription`)})]}),On&&kn&&(0,G.jsxs)(`div`,{className:`border-t border-bambu-dark-tertiary pt-3 mt-3 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`libraryAutoPurge.enableLabel`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`libraryAutoPurge.enableDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:kn.auto_purge_enabled,onChange:e=>jn({auto_purge_enabled:e.target.checked}),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`libraryAutoPurge.ageLabel`)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{type:`number`,min:7,max:3650,disabled:!kn.auto_purge_enabled,value:kn.auto_purge_days,onChange:e=>jn({auto_purge_days:Math.max(7,Math.min(3650,parseInt(e.target.value||`0`,10)||0))}),className:`w-24 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none disabled:opacity-50`}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:i(`libraryAutoPurge.days`)})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`libraryAutoPurge.ageDescription`)})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-white cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,disabled:!kn.auto_purge_enabled,checked:kn.auto_purge_include_never_printed,onChange:e=>jn({auto_purge_include_never_printed:e.target.checked}),className:`rounded border-gray-300 disabled:opacity-50`}),i(`libraryAutoPurge.includeNeverPrinted`)]})]})]})]}),(0,G.jsxs)(zd,{id:`card-data`,children:[(0,G.jsx)(Bd,{children:(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:i(`settings.dataManagement`)})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.clearNotificationLogs`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.clearNotificationLogsDescription`)})]}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:()=>nt(!0),children:[(0,G.jsx)(ju,{className:`w-4 h-4`}),i(`common.clear`)]})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.resetUiPreferences`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.resetUiPreferencesDescription`)})]}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:()=>it(!0),children:[(0,G.jsx)(ju,{className:`w-4 h-4`}),i(`settings.reset`)]})]}),(0,G.jsxs)(`div`,{className:`pt-4 border-t border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.storageUsage`,`Storage Usage`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.storageUsageDescription`,`Breakdown of data usage by category`)})]}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:Qt,disabled:Zt||_t,children:[(0,G.jsx)(Il,{className:`w-4 h-4 ${Zt||_t?`animate-spin`:``}`}),i(`common.refresh`,`Refresh`)]})]}),(0,G.jsx)(`div`,{className:`mt-3`,children:Xt?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-bambu-gray`,children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),i(`common.loading`,`Loading`)]}):Yt?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`w-full h-3 bg-bambu-dark rounded-full overflow-hidden flex`,children:Yt.categories.filter(e=>e.bytes>0).map((e,t)=>(0,G.jsx)(`div`,{className:`${K8(e.key,t)} h-full`,style:{width:`${e.percent_of_total}%`},title:`${e.label}: ${e.formatted}`},e.key))}),(0,G.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-3`,children:Yt.categories.filter(e=>e.bytes>0).map((e,t)=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,G.jsx)(`span`,{className:`w-3 h-3 rounded-full ${K8(e.key,t)}`}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:e.label}),(0,G.jsx)(`span`,{className:`text-white`,children:e.formatted}),(0,G.jsxs)(`span`,{className:`text-bambu-gray`,children:[`(`,e.percent_of_total.toFixed(1),`%)`]})]},e.key))}),(0,G.jsxs)(`div`,{className:`mt-2 text-xs text-bambu-gray`,children:[i(`settings.storageUsageTotal`,`Total`),`: `,(0,G.jsx)(`span`,{className:`text-white`,children:Yt.total_formatted}),Yt.scan_errors>0&&(0,G.jsxs)(`span`,{className:`ml-2 text-amber-700 dark:text-amber-400`,children:[i(`settings.storageUsageErrors`,`Scan errors`),`: `,Yt.scan_errors]})]}),Yt.other_breakdown?.length>0&&(0,G.jsxs)(`div`,{className:`mt-4`,children:[(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mb-2`,children:i(`settings.storageUsageOtherBreakdown`,`Other breakdown`)}),(0,G.jsx)(`div`,{className:`space-y-2`,children:Yt.other_breakdown.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-white`,children:e.label}),(0,G.jsx)(`span`,{className:`px-2 py-0.5 rounded-full border ${e.kind===`system`?`border-slate-500 text-slate-300`:`border-bambu-green text-bambu-green`}`,children:e.kind===`system`?i(`settings.storageUsageSystem`,`System`):i(`settings.storageUsageData`,`Data`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-bambu-gray`,children:[(0,G.jsx)(`span`,{className:`text-white`,children:e.formatted}),(0,G.jsxs)(`span`,{children:[`(`,e.percent_of_total.toFixed(1),`%)`]})]})]},`${e.bucket}-${e.kind}`))})]})]}):(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.storageUsageUnavailable`,`Storage usage data is unavailable`)})})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between pt-4 border-t border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.backupRestore`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.backupRestoreDescription`)})]}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:()=>ze(`backup`),children:[(0,G.jsx)(Rs,{className:`w-4 h-4`}),i(`settings.goToBackup`)]})]})]})]})]}),(0,G.jsxs)(`div`,{className:`space-y-3 flex-1 lg:max-w-sm`,children:[(0,G.jsxs)(zd,{id:`card-updates`,children:[(0,G.jsx)(Bd,{children:(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:i(`settings.updates`)})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsx)(`p`,{className:`text-xs font-medium text-bambu-gray uppercase tracking-wider`,children:i(`settings.printerFirmware`)}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.checkPrinterFirmware`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.checkFirmwareDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.check_printer_firmware??!0,onChange:e=>xr(`check_printer_firmware`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),(0,G.jsx)(`div`,{className:`border-t border-bambu-dark-tertiary pt-4`,children:(0,G.jsx)(`p`,{className:`text-xs font-medium text-bambu-gray uppercase tracking-wider mb-4`,children:i(`settings.bambuddySoftware`)})}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.checkForUpdatesLabel`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.autoCheckDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.check_updates,onChange:e=>xr(`check_updates`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between ${A.check_updates?``:`opacity-50`}`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.includeBetaUpdates`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.includeBetaUpdatesDesc`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.include_beta_updates??!1,onChange:e=>xr(`include_beta_updates`,e.target.checked),disabled:!A.check_updates,className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.currentVersion`)}),(0,G.jsxs)(`p`,{className:`text-sm text-bambu-gray`,children:[`v`,Dn?.version||`...`]})]}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:()=>Ln(),disabled:Rn,children:[Rn?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(Il,{className:`w-4 h-4`}),i(`settings.checkNow`)]})]}),In?.update_available?(0,G.jsxs)(`div`,{className:`mt-4 p-3 bg-bambu-green/10 border border-bambu-green/30 rounded-lg`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`p`,{className:`text-bambu-green font-medium`,children:[`Update available: v`,In.latest_version]}),In.release_name&&In.release_name!==In.latest_version&&(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:In.release_name})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[In.release_notes&&(0,G.jsx)(`button`,{onClick:()=>ct(!0),className:`text-bambu-gray hover:text-white transition-colors text-sm underline`,children:i(`settings.releaseNotes`)}),In.release_url&&(0,G.jsx)(`a`,{href:In.release_url,target:`_blank`,rel:`noopener noreferrer`,className:`text-bambu-gray hover:text-white transition-colors`,title:i(`settings.viewReleaseOnGitHub`),children:(0,G.jsx)(Xs,{className:`w-4 h-4`})})]})]}),zn?.status===`downloading`||zn?.status===`installing`?(0,G.jsxs)(`div`,{className:`mt-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-bambu-gray`,children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),(0,G.jsx)(`span`,{children:zn.message})]}),(0,G.jsx)(`div`,{className:`mt-2 w-full bg-bambu-dark-tertiary rounded-full h-2`,children:(0,G.jsx)(`div`,{className:`bg-bambu-green h-2 rounded-full transition-all duration-300`,style:{width:`${zn.progress}%`}})})]}):zn?.status===`complete`?(0,G.jsx)(`div`,{className:`mt-3 p-2 bg-bambu-green/20 rounded text-sm text-bambu-green`,children:zn.message}):zn?.status===`error`?(0,G.jsx)(`div`,{className:`mt-3 p-2 bg-red-100 dark:bg-red-500/20 rounded text-sm text-red-700 dark:text-red-400`,children:zn.error||zn.message}):In?.is_ha_addon?(0,G.jsx)(`div`,{className:`mt-3 p-3 bg-bambu-dark-tertiary rounded-lg`,children:(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.updateViaHomeAssistant`)})}):In?.is_docker?(0,G.jsxs)(`div`,{className:`mt-3 p-3 bg-bambu-dark-tertiary rounded-lg`,children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mb-2`,children:i(`settings.updateViaDocker`)}),(0,G.jsxs)(`div`,{className:`flex items-start gap-1`,children:[(0,G.jsx)(`code`,{className:`flex-1 block text-xs bg-bambu-dark p-2 rounded text-bambu-green font-mono break-all select-all`,children:zr}),(0,G.jsx)(VU,{value:zr,titleKey:`settings.copyUpdateCommand`,copiedTitleKey:`printers.copied`,className:`ml-0 p-2 rounded hover:bg-bambu-dark text-bambu-gray hover:text-white transition-colors flex-shrink-0`,iconClassName:`w-4 h-4`})]}),(0,G.jsxs)(`label`,{className:`block mt-3`,children:[(0,G.jsx)(`span`,{className:`block text-xs text-bambu-gray mb-1`,children:i(`settings.composeDirectory`)}),(0,G.jsx)(`input`,{type:`text`,value:A?.docker_compose_dir??``,onChange:e=>xr(`docker_compose_dir`,e.target.value),placeholder:In?.compose_dir_detected||`/opt/bambuddy`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded text-sm text-white font-mono placeholder:text-bambu-gray/60 focus:outline-none focus:border-bambu-green`}),(0,G.jsx)(`span`,{className:`block text-xs text-bambu-gray mt-1`,children:i(`settings.composeDirectoryHint`)})]})]}):In?.update_method===`windows_installer`?(0,G.jsxs)(`div`,{className:`mt-3 p-3 bg-bambu-dark-tertiary rounded-lg`,children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mb-3`,children:i(`settings.updateViaWindowsInstaller`)}),(0,G.jsxs)(`a`,{href:In.installer_download_url||In.release_url||`https://github.com/maziggy/bambuddy/releases/tag/v${In.latest_version}`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center justify-center font-medium rounded-lg transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-bambu-dark disabled:opacity-50 bg-bambu-green hover:bg-bambu-green-light text-white focus:ring-bambu-green px-4 py-2 text-sm gap-2 min-h-[44px] md:min-h-0`,children:[(0,G.jsx)(Us,{className:`w-4 h-4`}),i(`settings.downloadWindowsInstaller`,{version:In.latest_version})]})]}):(0,G.jsxs)(Q,{className:`mt-3`,onClick:()=>lr.mutate(),disabled:lr.isPending,children:[lr.isPending?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(Us,{className:`w-4 h-4`}),i(`settings.installUpdate`)]})]}):In?.error?(0,G.jsx)(`div`,{className:`mt-2 p-2 bg-red-50 dark:bg-red-500/10 border border-red-300 dark:border-red-500/30 rounded text-sm text-red-700 dark:text-red-400`,children:i(`settings.failedToCheckUpdates`,{error:In.error})}):In&&!In.update_available?(0,G.jsx)(`p`,{className:`mt-2 text-sm text-bambu-gray`,children:i(`settings.latestVersionRunning`)}):null]})]})]}),(0,G.jsx)(iKe,{})]})]})]}),Ne===`network`&&A&&(0,G.jsxs)(`div`,{className:`flex flex-col lg:flex-row gap-6`,children:[(0,G.jsxs)(`div`,{className:`flex-1 lg:max-w-xl space-y-3`,children:[(0,G.jsxs)(zd,{id:`card-externalurl`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(Cc,{className:`w-5 h-5 text-blue-600 dark:text-blue-400`}),i(`settings.externalUrl`)]})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.externalUrlDescription`)}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.bambuddyUrl`)}),(0,G.jsx)(`input`,{type:`text`,value:A.external_url??``,onChange:e=>xr(`external_url`,e.target.value),placeholder:`http://192.168.1.100:8000`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.externalUrlHint`)})]})]})]}),(0,G.jsxs)(zd,{id:`card-ftpretry`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(Il,{className:`w-5 h-5 text-blue-600 dark:text-blue-400`}),i(`settings.ftpRetry`)]})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.ftpRetryDescription`)}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.enableRetry`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.autoRetryDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.ftp_retry_enabled??!0,onChange:e=>xr(`ftp_retry_enabled`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),A.ftp_retry_enabled&&(0,G.jsxs)(`div`,{className:`space-y-3 pt-2 border-t border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.retryAttempts`)}),(0,G.jsxs)(`div`,{className:`relative w-44`,children:[(0,G.jsx)(`select`,{value:A.ftp_retry_count??3,onChange:e=>xr(`ftp_retry_count`,parseInt(e.target.value)),className:`w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer`,children:[1,2,3,4,5,6,7,8,9,10].map(e=>(0,G.jsx)(`option`,{value:e,children:i(`settings.time`,{count:e})},e))}),(0,G.jsx)(as,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.retryDelay`)}),(0,G.jsxs)(`div`,{className:`relative w-44`,children:[(0,G.jsx)(`select`,{value:A.ftp_retry_delay??2,onChange:e=>xr(`ftp_retry_delay`,parseInt(e.target.value)),className:`w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer`,children:[1,2,3,5,10,15,20,30].map(e=>(0,G.jsx)(`option`,{value:e,children:i(`settings.second`,{count:e})},e))}),(0,G.jsx)(as,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.connectionTimeout`)}),(0,G.jsxs)(`div`,{className:`relative w-44`,children:[(0,G.jsx)(`select`,{value:A.ftp_timeout??30,onChange:e=>xr(`ftp_timeout`,parseInt(e.target.value)),className:`w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer`,children:[10,15,20,30,45,60,90,120,180,300].map(e=>(0,G.jsx)(`option`,{value:e,children:i(`settings.nSeconds`,{count:e})},e))}),(0,G.jsx)(as,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.increaseForWeakWifi`)})]})]})]})]})]}),(0,G.jsxs)(`div`,{className:`flex-1 lg:max-w-xl space-y-3`,children:[(0,G.jsxs)(zd,{id:`card-ha`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(Pc,{className:`w-5 h-5 text-bambu-green`}),i(`settings.homeAssistant`)]}),A.ha_enabled&&Rt&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`w-2.5 h-2.5 rounded-full ${Rt.success?`bg-green-400`:`bg-red-400`}`}),(0,G.jsx)(`span`,{className:`text-sm ${Rt.success?`text-green-700 dark:text-green-400`:`text-red-700 dark:text-red-400`}`,children:Rt.success?i(`settings.connected`):i(`settings.disconnected`)})]})]})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.homeAssistantFullDescription`)}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.enableHomeAssistant`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.homeAssistantDescription`)}),A.ha_env_managed&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1 mt-1`,children:[(0,G.jsx)(Xc,{className:`w-3 h-3 text-bambu-green`}),(0,G.jsx)(`span`,{className:`text-xs text-bambu-green`,children:i(`settings.autoEnabledViaEnv`)})]})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.ha_enabled??!1,onChange:e=>xr(`ha_enabled`,e.target.checked),disabled:A.ha_env_managed,className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green ${A.ha_env_managed?`opacity-60 cursor-not-allowed`:``}`})]})]}),A.ha_enabled&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:[i(`settings.homeAssistantUrl`),A.ha_url_from_env&&(0,G.jsx)(`span`,{className:`ml-2 text-xs text-bambu-green`,children:i(`settings.environmentManagedLabel`)})]}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(`input`,{type:`text`,value:A.ha_url??``,onChange:e=>xr(`ha_url`,e.target.value),placeholder:`http://192.168.1.100:8123`,disabled:A.ha_url_from_env,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none ${A.ha_url_from_env?`opacity-60 cursor-not-allowed`:``}`}),A.ha_url_from_env&&(0,G.jsx)(Xc,{className:`absolute right-3 top-2.5 w-4 h-4 text-bambu-gray`})]}),A.ha_url_from_env&&(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.urlFromEnvReadOnly`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:[i(`settings.longLivedAccessToken`),A.ha_token_from_env&&(0,G.jsx)(`span`,{className:`ml-2 text-xs text-bambu-green`,children:i(`settings.environmentManagedLabel`)})]}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(`input`,{type:`password`,value:A.ha_token??``,onChange:e=>xr(`ha_token`,e.target.value),placeholder:`eyJ0eXAiOiJKV1QiLC...`,disabled:A.ha_token_from_env,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none ${A.ha_token_from_env?`opacity-60 cursor-not-allowed`:``}`}),A.ha_token_from_env&&(0,G.jsx)(Xc,{className:`absolute right-3 top-2.5 w-4 h-4 text-bambu-gray`})]}),A.ha_token_from_env?(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.tokenFromEnvReadOnly`)}):(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.haTokenHint`)})]}),A.ha_url&&A.ha_token&&(0,G.jsx)(`div`,{className:`pt-2 border-t border-bambu-dark-tertiary`,children:(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,disabled:Bt,onClick:async()=>{Vt(!0),zt(null);try{zt(await Z.testHAConnection(A.ha_url,A.ha_token))}catch(e){zt({success:!1,message:null,error:e instanceof Error?e.message:i(`common.unknownError`)})}finally{Vt(!1)}},children:[Bt?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(Yu,{className:`w-4 h-4`}),i(`settings.testConnection`)]})})]})]})]}),(0,G.jsxs)(zd,{id:`card-mqtt`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(Yu,{className:`w-5 h-5 text-blue-600 dark:text-blue-400`}),i(`settings.mqttPublishing`)]}),Vn?.enabled&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`w-2.5 h-2.5 rounded-full ${Vn.connected?`bg-green-400`:`bg-red-400`}`}),(0,G.jsx)(`span`,{className:`text-sm ${Vn.connected?`text-green-700 dark:text-green-400`:`text-red-700 dark:text-red-400`}`,children:Vn.connected?i(`settings.connected`):i(`settings.disconnected`)})]})]})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.mqttDescription`)}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.enableMqtt`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.mqttEnableDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.mqtt_enabled??!1,onChange:e=>xr(`mqtt_enabled`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),A.mqtt_enabled&&(0,G.jsxs)(`div`,{className:`space-y-3 pt-2 border-t border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.brokerHostname`)}),(0,G.jsx)(`input`,{type:`text`,value:A.mqtt_broker??``,onChange:e=>xr(`mqtt_broker`,e.target.value),placeholder:`mqtt.example.com or 192.168.1.100`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})]}),(0,G.jsxs)(`div`,{className:`flex items-end gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.port`)}),(0,G.jsx)(Xp,{min:1,max:65535,value:A.mqtt_port??1883,onChange:e=>xr(`mqtt_port`,e),fallback:1883,className:`w-24 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 pb-2`,children:[(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.mqtt_use_tls??!1,onChange:e=>{let t=e.target.checked;xr(`mqtt_use_tls`,t);let n=A.mqtt_port??1883;t&&n===1883?xr(`mqtt_port`,8883):!t&&n===8883&&xr(`mqtt_port`,1883)},className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]}),(0,G.jsx)(`span`,{className:`text-white text-sm`,children:i(`settings.useTls`)})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.usernameOptional`)}),(0,G.jsx)(`input`,{type:`text`,value:A.mqtt_username??``,onChange:e=>xr(`mqtt_username`,e.target.value),placeholder:i(`settings.leaveEmptyForAnonymous`),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.passwordOptional`)}),(0,G.jsx)(`input`,{type:`password`,value:A.mqtt_password??``,onChange:e=>xr(`mqtt_password`,e.target.value),placeholder:i(`settings.leaveEmptyForAnonymous`),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.topicPrefix`)}),(0,G.jsx)(`input`,{type:`text`,value:A.mqtt_topic_prefix??`bambuddy`,onChange:e=>xr(`mqtt_topic_prefix`,e.target.value),placeholder:`bambuddy`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.topicPrefixHint`,{prefix:A.mqtt_topic_prefix||`bambuddy`})})]}),Vn&&(0,G.jsx)(`div`,{className:`pt-3 mt-3 border-t border-bambu-dark-tertiary`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full ${Vn.connected?`bg-green-400`:`bg-red-400`}`}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:Vn.connected?(0,G.jsxs)(G.Fragment,{children:[i(`settings.mqttConnectedTo`),` `,(0,G.jsxs)(`span`,{className:`text-white`,children:[Vn.broker,`:`,Vn.port]})]}):i(`settings.spoolmanDisconnected`)})]})})]})]})]})]}),(0,G.jsx)(`div`,{className:`flex-1 lg:max-w-md space-y-3`,children:(0,G.jsxs)(zd,{id:`card-prometheus`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(Nu,{className:`w-5 h-5 text-orange-600 dark:text-orange-400`}),i(`settings.prometheusMetrics`)]})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.prometheusEndpointDescription`)}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.enableMetricsEndpoint`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.prometheusDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.prometheus_enabled??!1,onChange:e=>xr(`prometheus_enabled`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),A.prometheus_enabled&&(0,G.jsxs)(`div`,{className:`space-y-3 pt-2 border-t border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.bearerTokenOptional`)}),(0,G.jsx)(`input`,{type:`password`,value:A.prometheus_token??``,onChange:e=>xr(`prometheus_token`,e.target.value),placeholder:i(`settings.leaveEmptyForNoAuth`),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.bearerTokenHint`)})]}),(0,G.jsxs)(`div`,{className:`pt-2 border-t border-bambu-dark-tertiary`,children:[(0,G.jsx)(`p`,{className:`text-sm text-white mb-2`,children:i(`settings.availableMetrics`)}),(0,G.jsxs)(`div`,{className:`text-xs text-bambu-gray space-y-1`,children:[(0,G.jsxs)(`p`,{children:[(0,G.jsx)(`code`,{className:`text-orange-700 dark:text-orange-400`,children:`bambuddy_printer_connected`}),` - `,i(`settings.metricsConnectionStatus`)]}),(0,G.jsxs)(`p`,{children:[(0,G.jsx)(`code`,{className:`text-orange-700 dark:text-orange-400`,children:`bambuddy_printer_state`}),` - `,i(`settings.metricsPrinterState`)]}),(0,G.jsxs)(`p`,{children:[(0,G.jsx)(`code`,{className:`text-orange-700 dark:text-orange-400`,children:`bambuddy_print_progress`}),` - `,i(`settings.metricsPrintProgress`)]}),(0,G.jsxs)(`p`,{children:[(0,G.jsx)(`code`,{className:`text-orange-700 dark:text-orange-400`,children:`bambuddy_bed_temp_celsius`}),` - `,i(`settings.metricsBedTemp`)]}),(0,G.jsxs)(`p`,{children:[(0,G.jsx)(`code`,{className:`text-orange-700 dark:text-orange-400`,children:`bambuddy_nozzle_temp_celsius`}),` - `,i(`settings.metricsNozzleTemp`)]}),(0,G.jsxs)(`p`,{children:[(0,G.jsx)(`code`,{className:`text-orange-700 dark:text-orange-400`,children:`bambuddy_prints_total`}),` - `,i(`settings.metricsPrintsTotal`)]}),(0,G.jsx)(`p`,{className:`text-bambu-gray/70 italic`,children:i(`settings.metricsMore`)})]})]})]})]})]})})]}),Rt&&(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50`,children:(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg p-6 max-w-md w-full mx-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 mb-4`,children:[Rt.success?(0,G.jsx)(ms,{className:`w-8 h-8 text-green-600 dark:text-green-400`}):(0,G.jsx)(bs,{className:`w-8 h-8 text-red-600 dark:text-red-400`}),(0,G.jsx)(`h3`,{className:`text-lg font-medium text-white`,children:Rt.success?i(`settings.connectionSuccessful`):i(`settings.connectionFailed`)})]}),(0,G.jsx)(`p`,{className:`text-bambu-gray mb-6`,children:Rt.success?Rt.message||i(`settings.haConnectionSuccess`):Rt.error||i(`settings.haConnectionFailed`)}),(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsx)(Q,{variant:`primary`,onClick:()=>zt(null),children:i(`settings.ok`)})})]})}),Ne===`plugs`&&(0,G.jsxs)(`div`,{id:`card-plugs`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between mb-6`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(Ol,{className:`w-5 h-5 text-bambu-green`}),i(`settings.smartPlugs`)]}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:i(`settings.smartPlugsDescription`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 pt-1 shrink-0`,children:[$t&&$t.filter(e=>e.enabled).length>1&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,className:`whitespace-nowrap`,onClick:()=>ot(`on`),disabled:pr.isPending,title:i(`settings.turnAllPlugsOn`),children:[pr.isPending?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(jl,{className:`w-4 h-4 text-bambu-green`}),i(`settings.allOn`)]}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,className:`whitespace-nowrap`,onClick:()=>ot(`off`),disabled:pr.isPending,title:i(`settings.turnAllPlugsOff`),children:[pr.isPending?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(Al,{className:`w-4 h-4 text-red-600 dark:text-red-400`}),i(`settings.allOff`)]})]}),(0,G.jsxs)(Q,{className:`whitespace-nowrap`,onClick:()=>{z(null),L(!0)},children:[(0,G.jsx)(kl,{className:`w-4 h-4`}),i(`settings.addSmartPlug`)]})]})]}),$t&&$t.length>0&&(0,G.jsxs)(zd,{className:`mb-6`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(td,{className:`w-4 h-4 text-yellow-600 dark:text-yellow-400`}),i(`settings.energySummary`),nn&&(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin text-bambu-gray ml-2`})]})}),(0,G.jsx)(Vd,{children:tn?(0,G.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-4`,children:[(0,G.jsxs)(`div`,{className:`bg-bambu-dark rounded-lg p-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-bambu-gray text-xs mb-1`,children:[(0,G.jsx)(td,{className:`w-3 h-3`}),i(`settings.currentPower`)]}),(0,G.jsxs)(`div`,{className:`text-xl font-bold text-white`,children:[tn.totalPower.toFixed(1),(0,G.jsx)(`span`,{className:`text-sm font-normal text-bambu-gray ml-1`,children:`W`})]}),(0,G.jsx)(`div`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.plugsOnline`,{reachable:tn.reachableCount,total:tn.totalPlugs})})]}),(0,G.jsxs)(`div`,{className:`bg-bambu-dark rounded-lg p-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-bambu-gray text-xs mb-1`,children:[(0,G.jsx)(Qo,{className:`w-3 h-3`}),i(`settings.today`)]}),(0,G.jsxs)(`div`,{className:`text-xl font-bold text-white`,children:[tn.totalToday.toFixed(3),(0,G.jsx)(`span`,{className:`text-sm font-normal text-bambu-gray ml-1`,children:`kWh`})]}),(A?.energy_cost_per_kwh??0)>0&&(0,G.jsxs)(`div`,{className:`text-xs text-bambu-gray mt-1`,children:[`~`,(tn.totalToday*(A?.energy_cost_per_kwh??0)).toFixed(2),` `,If(A?.currency||`USD`)]})]}),(0,G.jsxs)(`div`,{className:`bg-bambu-dark rounded-lg p-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-bambu-gray text-xs mb-1`,children:[(0,G.jsx)(Nu,{className:`w-3 h-3`}),i(`settings.yesterday`)]}),(0,G.jsxs)(`div`,{className:`text-xl font-bold text-white`,children:[tn.totalYesterday.toFixed(3),(0,G.jsx)(`span`,{className:`text-sm font-normal text-bambu-gray ml-1`,children:`kWh`})]}),(A?.energy_cost_per_kwh??0)>0&&(0,G.jsxs)(`div`,{className:`text-xs text-bambu-gray mt-1`,children:[`~`,(tn.totalYesterday*(A?.energy_cost_per_kwh??0)).toFixed(2),` `,If(A?.currency||`USD`)]})]}),(0,G.jsxs)(`div`,{className:`bg-bambu-dark rounded-lg p-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-bambu-gray text-xs mb-1`,children:[(0,G.jsx)(Bs,{className:`w-3 h-3`}),i(`settings.total`)]}),(0,G.jsxs)(`div`,{className:`text-xl font-bold text-white`,children:[tn.totalLifetime.toFixed(1),(0,G.jsx)(`span`,{className:`text-sm font-normal text-bambu-gray ml-1`,children:`kWh`})]}),(A?.energy_cost_per_kwh??0)>0&&(0,G.jsxs)(`div`,{className:`text-xs text-bambu-gray mt-1`,children:[`~`,(tn.totalLifetime*(A?.energy_cost_per_kwh??0)).toFixed(2),` `,If(A?.currency||`USD`)]})]})]}):nn?null:(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.enablePlugsForSummary`)})})]}),en?(0,G.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,G.jsx)(Y,{className:`w-8 h-8 text-bambu-green animate-spin`})}):$t&&$t.length>0?(0,G.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4`,children:$t.map(e=>(0,G.jsx)(TGe,{plug:e,onEdit:e=>{z(e),L(!0)}},e.id))}):(0,G.jsx)(zd,{children:(0,G.jsx)(Vd,{className:`py-12`,children:(0,G.jsxs)(`div`,{className:`text-center text-bambu-gray`,children:[(0,G.jsx)(Ol,{className:`w-16 h-16 mx-auto mb-4 opacity-30`}),(0,G.jsx)(`p`,{className:`text-lg font-medium text-white mb-2`,children:i(`settings.noSmartPlugsTitle`)}),(0,G.jsx)(`p`,{className:`text-sm mb-4`,children:i(`settings.noSmartPlugsDescription`)}),(0,G.jsxs)(Q,{onClick:()=>{z(null),L(!0)},children:[(0,G.jsx)(kl,{className:`w-4 h-4`}),i(`settings.addFirstSmartPlug`)]})]})})})]}),Ne===`sensors`&&(0,G.jsxs)(`div`,{id:`card-sensors`,children:[(0,G.jsxs)(`div`,{id:`card-ha-sensors`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(vc,{className:`w-5 h-5 text-bambu-green`}),i(`haSensors.sectionTitle`)]}),(0,G.jsxs)(Q,{className:`whitespace-nowrap`,disabled:!ln?.length,onClick:()=>{te(null),V(!0)},children:[(0,G.jsx)(kl,{className:`w-4 h-4`}),i(`haSensors.add`)]})]}),un&&un.length>0?(0,G.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:un.map(e=>{let t=ln?.find(t=>t.id===e.printer_id);return(0,G.jsx)(zd,{children:(0,G.jsxs)(Vd,{className:`py-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-white font-medium truncate`,children:e.name}),(0,G.jsx)(`div`,{className:`text-xs text-bambu-gray truncate`,children:e.entity_id}),(0,G.jsx)(`div`,{className:`text-xs text-bambu-gray mt-1`,children:t?.name??i(`haSensors.unknownPrinter`)})]}),(0,G.jsx)(Q,{size:`sm`,variant:`secondary`,onClick:()=>{te(e),V(!0)},children:i(`common.edit`)})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-1 mt-3`,children:[e.block_print&&(0,G.jsx)(`span`,{className:`px-2 py-0.5 text-xs rounded bg-amber-100 dark:bg-amber-500/20 text-amber-700 dark:text-amber-400`,children:i(`haSensors.badgeBlocks`)}),e.notify_on_alert&&(0,G.jsx)(`span`,{className:`px-2 py-0.5 text-xs rounded bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400`,children:i(`haSensors.badgeNotifies`)}),!e.show_on_printer_card&&(0,G.jsx)(`span`,{className:`px-2 py-0.5 text-xs rounded bg-bambu-dark-tertiary text-bambu-gray`,children:i(`haSensors.badgeHidden`)})]})]})},e.id)})}):(0,G.jsx)(zd,{children:(0,G.jsx)(Vd,{className:`py-8`,children:(0,G.jsxs)(`div`,{className:`text-center text-bambu-gray`,children:[(0,G.jsx)(vc,{className:`w-12 h-12 mx-auto mb-3 opacity-30`}),(0,G.jsx)(`p`,{className:`text-sm`,children:i(`haSensors.empty`)})]})})})]}),(0,G.jsxs)(`div`,{id:`card-location-sensors`,className:`mt-8`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-[20px] mb-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(vc,{className:`w-5 h-5 text-bambu-green`}),i(`locationHaSensors.sectionTitle`)]}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:i(`locationHaSensors.sectionDescription`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 pt-1 shrink-0`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>se(!0),className:`p-2 rounded-lg bg-bambu-dark-tertiary hover:bg-bambu-gray-dark text-white transition-colors`,title:i(`locationHaSensors.options.buttonLabel`),"aria-label":i(`locationHaSensors.options.buttonLabel`),children:(0,G.jsx)(js,{className:`w-4 h-4`})}),(0,G.jsxs)(Q,{className:`whitespace-nowrap`,disabled:!fn?.length,onClick:()=>{ae(null),re(!0)},children:[(0,G.jsx)(kl,{className:`w-4 h-4`}),i(`locationHaSensors.add`)]})]})]}),dn&&dn.length>0?(0,G.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:(()=>{let e=new Map((fn??[]).map((e,t)=>[e.id,t])),t=dn.reduce((e,t)=>{let n=e.get(t.location_id)??[];return n.push(t),e.set(t.location_id,n),e},new Map);return Array.from(t.entries()).sort(([t],[n])=>(e.get(t)??2**53-1)-(e.get(n)??2**53-1))})().map(([e,t])=>{let n=fn?.find(t=>t.id===e),r=e=>yE({device_class:e.device_class,state:e.last_state,kind:e.kind}),a=[...t].sort((e,t)=>(q8[e.device_class??``]??99)-(q8[t.device_class??``]??99));return(0,G.jsx)(zd,{children:(0,G.jsxs)(Vd,{className:`py-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,G.jsx)(`div`,{className:`text-white font-medium truncate`,children:n?.name??i(`locationHaSensors.unknownLocation`)}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>fe({locationName:n?.name??i(`locationHaSensors.unknownLocation`),sensorIds:a.map(e=>e.id)}),className:`p-1 text-bambu-gray hover:text-red-500 rounded transition-colors shrink-0`,title:i(`common.delete`),"aria-label":i(`common.delete`),children:(0,G.jsx)(ju,{className:`w-3.5 h-3.5`})})]}),(0,G.jsx)(`div`,{className:`mt-2 space-y-1.5`,children:a.map(e=>{let t=r(e),n=mn.get(e.id),a=BKe(n,i),o=L6(H&&n?I6(n):null,ce,le,ue)||`text-white`;return(0,G.jsxs)(`div`,{className:`flex items-center min-w-0 text-xs text-bambu-gray`,children:[(0,G.jsx)(t,{className:`w-3.5 h-3.5 shrink-0 mr-1.5`}),a&&(0,G.jsx)(`span`,{className:`${o} shrink-0 w-[52px] text-center`,children:a}),a&&(0,G.jsx)(`span`,{className:`shrink-0 mr-1.5`,children:`-`}),(0,G.jsx)(`span`,{className:`truncate mr-1.5`,title:e.name,children:e.entity_id}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>{ae(e),re(!0)},className:`p-1 text-bambu-gray hover:text-white rounded transition-colors shrink-0`,title:i(`common.edit`),"aria-label":i(`common.edit`),children:(0,G.jsx)(wl,{className:`w-3.5 h-3.5`})})]},e.id)})}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-1 mt-3`,children:[(()=>{let e=a.filter(e=>e.notify_on_alert);return e.length?(0,G.jsxs)(`span`,{className:`flex items-center gap-1 px-2 py-0.5 text-xs rounded bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400`,children:[i(`haSensors.badgeNotifies`),e.map(e=>(0,G.jsx)(r(e),{className:`w-3 h-3`},e.id))]}):null})(),(()=>{let e=a.filter(e=>!e.show_on_card);return e.length?(0,G.jsxs)(`span`,{className:`flex items-center gap-1 px-2 py-0.5 text-xs rounded bg-bambu-dark-tertiary text-bambu-gray`,children:[i(`haSensors.badgeHidden`),e.map(e=>(0,G.jsx)(r(e),{className:`w-3 h-3`},e.id))]}):null})()]})]})},e)})}):(0,G.jsx)(zd,{children:(0,G.jsx)(Vd,{className:`py-8`,children:(0,G.jsxs)(`div`,{className:`text-center text-bambu-gray`,children:[(0,G.jsx)(vc,{className:`w-12 h-12 mx-auto mb-3 opacity-30`}),(0,G.jsx)(`p`,{className:`text-sm`,children:i(`locationHaSensors.empty`)})]})})})]})]}),Ne===`notifications`&&(0,G.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,id:`card-providers`,children:[(0,G.jsx)(Vo,{className:`w-5 h-5 text-bambu-green`}),i(`settings.providers`)]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(Q,{size:`sm`,variant:`secondary`,onClick:()=>we(!0),children:[(0,G.jsx)(Mc,{className:`w-4 h-4`}),i(`settings.log`)]}),W&&W.length>0&&(0,G.jsxs)(Q,{size:`sm`,variant:`secondary`,onClick:()=>{dr(null),fr.mutate()},disabled:fr.isPending,children:[fr.isPending?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(ql,{className:`w-4 h-4`}),i(`settings.testAll`)]}),(0,G.jsxs)(Q,{size:`sm`,onClick:()=>{ge(null),me(!0)},children:[(0,G.jsx)(kl,{className:`w-4 h-4`}),i(`settings.addNotificationProvider`)]})]})]}),(0,G.jsx)(zd,{className:`mb-4`,children:(0,G.jsx)(Vd,{className:`py-3`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white text-sm font-medium`,children:i(`settings.notificationLanguage`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.notificationLanguageDescription`)})]}),(0,G.jsx)(`select`,{value:A.notification_language||`en`,onChange:e=>xr(`notification_language`,e.target.value),className:`px-2 py-1.5 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm focus:outline-none focus:ring-1 focus:ring-bambu-green`,children:St.map(e=>(0,G.jsx)(`option`,{value:e.code,children:e.nativeName},e.code))})]})})}),(0,G.jsx)(zd,{className:`mb-4`,children:(0,G.jsx)(Vd,{className:`py-3`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white text-sm font-medium`,children:i(`settings.bedCooledThreshold`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.bedCooledThresholdDescription`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(`input`,{type:`number`,min:20,max:80,step:1,value:A.bed_cooled_threshold??35,onChange:e=>xr(`bed_cooled_threshold`,Number(e.target.value)),className:`w-16 px-2 py-1.5 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm text-center focus:outline-none focus:ring-1 focus:ring-bambu-green`}),(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:`°C`})]})]})})}),(0,G.jsx)(zd,{className:`mb-4`,children:(0,G.jsx)(Vd,{className:`py-3`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between ${Wn?.advanced_auth_enabled?``:`opacity-50`}`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white text-sm font-medium`,children:i(`settings.userNotificationsEnabled`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:Wn?.advanced_auth_enabled?i(`settings.userNotificationsEnabledDescription`):i(`settings.userNotificationsDisabledHint`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,className:`sr-only peer`,checked:A.user_notifications_enabled??!0,disabled:!Wn?.advanced_auth_enabled,onChange:e=>xr(`user_notifications_enabled`,e.target.checked)}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green peer-disabled:cursor-not-allowed`})]})]})})}),ur&&(0,G.jsx)(zd,{className:`mb-4`,children:(0,G.jsxs)(Vd,{className:`py-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium text-white`,children:i(`settings.testResults`)}),(0,G.jsx)(`button`,{onClick:()=>dr(null),className:`text-bambu-gray hover:text-white text-xs`,children:i(`common.dismiss`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-4 text-sm mb-2`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-bambu-green`,children:[(0,G.jsx)(ms,{className:`w-4 h-4`}),i(`settings.testPassedCount`,{count:ur.success})]}),ur.failed>0&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-red-700 dark:text-red-400`,children:[(0,G.jsx)(bs,{className:`w-4 h-4`}),i(`settings.testFailedCount`,{count:ur.failed})]})]}),ur.results.filter(e=>!e.success).length>0&&(0,G.jsx)(`div`,{className:`space-y-1 mt-2 pt-2 border-t border-bambu-dark-tertiary`,children:ur.results.filter(e=>!e.success).map(e=>(0,G.jsxs)(`div`,{className:`text-xs text-red-700 dark:text-red-400`,children:[(0,G.jsxs)(`span`,{className:`font-medium`,children:[e.provider_name,`:`]}),` `,e.message]},e.provider_id))})]})}),rn?(0,G.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,G.jsx)(Y,{className:`w-6 h-6 text-bambu-green animate-spin`})}):W&&W.length>0?(0,G.jsx)(`div`,{className:`space-y-3`,children:W.map(e=>(0,G.jsx)(NGe,{provider:e,onEdit:e=>{ge(e),me(!0)}},e.id))}):(0,G.jsx)(zd,{children:(0,G.jsx)(Vd,{className:`py-8`,children:(0,G.jsxs)(`div`,{className:`text-center text-bambu-gray`,children:[(0,G.jsx)(Vo,{className:`w-12 h-12 mx-auto mb-3 opacity-30`}),(0,G.jsx)(`p`,{className:`text-sm font-medium text-white mb-2`,children:i(`settings.noProvidersTitle`)}),(0,G.jsx)(`p`,{className:`text-xs mb-3`,children:i(`settings.noProvidersDescription`)}),(0,G.jsxs)(Q,{size:`sm`,onClick:()=>{ge(null),me(!0)},children:[(0,G.jsx)(kl,{className:`w-4 h-4`}),i(`settings.addProvider`)]})]})})})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2 mb-2`,id:`card-templates`,children:[(0,G.jsx)(ac,{className:`w-5 h-5 text-bambu-green`}),i(`settings.messageTemplates`)]}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mb-3`,children:i(`settings.messageTemplatesDescription`)}),(0,G.jsxs)(`div`,{className:`relative mb-3`,children:[(0,G.jsx)(Kl,{className:`w-4 h-4 text-bambu-gray absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none`}),(0,G.jsx)(`input`,{type:`text`,value:ye,onChange:e=>be(e.target.value),placeholder:i(`settings.filterTemplates`,`Filter templates…`),className:`w-full pl-9 pr-8 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`}),ye&&(0,G.jsx)(`button`,{onClick:()=>be(``),className:`absolute right-2 top-1/2 -translate-y-1/2 p-1 text-bambu-gray hover:text-white`,"aria-label":`Clear filter`,children:(0,G.jsx)($u,{className:`w-3.5 h-3.5`})})]}),vn?(0,G.jsx)(`div`,{className:`flex justify-center py-8`,children:(0,G.jsx)(Y,{className:`w-6 h-6 text-bambu-green animate-spin`})}):_n&&_n.length>0?(()=>{let e=ye.trim().toLowerCase(),t=[..._n].sort((e,t)=>e.name.localeCompare(t.name)).filter(t=>!e||t.name.toLowerCase().includes(e)||(t.title_template||``).toLowerCase().includes(e));return t.length===0?(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray italic text-center py-6`,children:i(`settings.noTemplatesMatch`,`No templates match your filter.`)}):(0,G.jsx)(`div`,{className:`space-y-2`,children:t.map(e=>(0,G.jsx)(zd,{className:`cursor-pointer hover:border-bambu-green/50 transition-colors`,onClick:()=>ve(e),children:(0,G.jsx)(Vd,{className:`py-2.5 px-3`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`p`,{className:`text-white font-medium text-sm truncate`,children:e.name}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-xs truncate mt-0.5`,children:e.title_template})]}),(0,G.jsx)(`button`,{className:`p-1.5 hover:bg-bambu-dark-tertiary rounded transition-colors shrink-0 ml-2`,onClick:t=>{t.stopPropagation(),ve(e)},children:(0,G.jsx)(Cl,{className:`w-4 h-4 text-bambu-gray`})})]})})},e.id))})})():(0,G.jsx)(zd,{children:(0,G.jsx)(Vd,{className:`py-8`,children:(0,G.jsxs)(`div`,{className:`text-center text-bambu-gray`,children:[(0,G.jsx)(ac,{className:`w-12 h-12 mx-auto mb-3 opacity-30`}),(0,G.jsx)(`p`,{className:`text-sm`,children:i(`settings.noTemplatesAvailable`)})]})})})]})]}),Ne===`apikeys`&&(0,G.jsxs)(`div`,{className:d(`api_keys:read`)?`grid grid-cols-1 xl:grid-cols-2 gap-4`:`grid grid-cols-1 gap-4`,children:[(0,G.jsxs)(`div`,{children:[d(`api_keys:read`)&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4 mb-6`,children:[(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,id:`card-createapi`,children:[(0,G.jsx)(Bc,{className:`w-5 h-5 text-bambu-green`}),i(`settings.apiKeys`)]}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:i(`settings.apiKeysDescription`)})]}),(0,G.jsxs)(Q,{size:`sm`,onClick:()=>He(!0),className:`flex-shrink-0`,children:[(0,G.jsx)(kl,{className:`w-4 h-4`}),i(`settings.createKey`)]})]}),qe&&(0,G.jsx)(zd,{className:`mb-6 border-bambu-green`,children:(0,G.jsx)(Vd,{className:`py-4`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(ms,{className:`w-5 h-5 text-bambu-green flex-shrink-0 mt-0.5`}),(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`p`,{className:`text-white font-medium mb-1`,children:i(`settings.apiKeyCreated`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mb-2`,children:i(`settings.apiKeyCopyWarning`)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 bg-bambu-dark rounded-lg p-2`,children:[(0,G.jsx)(`code`,{className:`flex-1 text-sm text-bambu-green font-mono break-all`,children:qe}),(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:async()=>{try{if(navigator.clipboard&&navigator.clipboard.writeText)await navigator.clipboard.writeText(qe);else{let e=document.createElement(`textarea`);e.value=qe,e.style.position=`fixed`,e.style.left=`-999999px`,document.body.appendChild(e),e.select(),document.execCommand(`copy`),document.body.removeChild(e)}o(i(`settings.toast.keyCopied`))}catch{o(i(`settings.toast.copyFailed`),`error`)}},children:(0,G.jsx)(Ps,{className:`w-4 h-4`})})]}),(0,G.jsxs)(`div`,{className:`flex gap-2 mt-3`,children:[(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:()=>{et(qe),o(i(`settings.toast.keyAddedToBrowser`))},children:i(`settings.useInApiBrowser`)}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:()=>Xe(!0),children:[(0,G.jsx)(Nl,{className:`w-4 h-4`}),i(`settings.apiKeyQrButton`)]}),(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:()=>{Xe(!1),Je(null)},children:i(`common.dismiss`)})]})]})]})})}),Ye&&qe&&(0,G.jsx)(XGe,{apiKey:qe,baseUrl:A?.external_url||void 0,onClose:()=>Xe(!1)}),Ve&&(0,G.jsxs)(zd,{className:`mb-6`,children:[(0,G.jsx)(Bd,{children:(0,G.jsx)(`h3`,{className:`text-base font-semibold text-white`,children:i(`settings.createNewApiKey`)})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.keyName`)}),(0,G.jsx)(`input`,{type:`text`,value:Ue,onChange:e=>We(e.target.value),placeholder:i(`settings.keyNamePlaceholder`),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-2`,children:i(`common.permissions`)}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:Ge.can_read_status,onChange:e=>Ke(t=>({...t,can_read_status:e.target.checked})),className:`w-4 h-4 text-bambu-green rounded border-bambu-dark-tertiary bg-bambu-dark focus:ring-bambu-green`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`text-white`,children:i(`settings.readStatus`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.readStatusDescription`)})]})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:Ge.can_queue,onChange:e=>Ke(t=>({...t,can_queue:e.target.checked})),className:`w-4 h-4 text-bambu-green rounded border-bambu-dark-tertiary bg-bambu-dark focus:ring-bambu-green`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`text-white`,children:i(`settings.manageQueue`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.manageQueueDescription`)})]})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:Ge.can_control_printer,onChange:e=>Ke(t=>({...t,can_control_printer:e.target.checked})),className:`w-4 h-4 text-bambu-green rounded border-bambu-dark-tertiary bg-bambu-dark focus:ring-bambu-green`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`text-white`,children:i(`settings.controlPrinter`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.controlPrinterDescription`)})]})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:Ge.can_manage_library,onChange:e=>Ke(t=>({...t,can_manage_library:e.target.checked})),className:`w-4 h-4 text-bambu-green rounded border-bambu-dark-tertiary bg-bambu-dark focus:ring-bambu-green`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`text-white`,children:i(`settings.manageLibrary`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.manageLibraryDescription`)})]})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:Ge.can_manage_inventory,onChange:e=>Ke(t=>({...t,can_manage_inventory:e.target.checked})),className:`w-4 h-4 text-bambu-green rounded border-bambu-dark-tertiary bg-bambu-dark focus:ring-bambu-green`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`text-white`,children:i(`settings.manageInventory`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.manageInventoryDescription`)})]})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:Ge.can_manage_maintenance,onChange:e=>Ke(t=>({...t,can_manage_maintenance:e.target.checked})),className:`w-4 h-4 text-bambu-green rounded border-bambu-dark-tertiary bg-bambu-dark focus:ring-bambu-green`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`text-white`,children:i(`settings.manageMaintenance`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.manageMaintenanceDescription`)})]})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:Ge.can_manage_archives,onChange:e=>Ke(t=>({...t,can_manage_archives:e.target.checked})),className:`w-4 h-4 text-bambu-green rounded border-bambu-dark-tertiary bg-bambu-dark focus:ring-bambu-green`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`text-white`,children:i(`settings.manageArchives`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.manageArchivesDescription`)})]})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:Ge.can_manage_projects,onChange:e=>Ke(t=>({...t,can_manage_projects:e.target.checked})),className:`w-4 h-4 text-bambu-green rounded border-bambu-dark-tertiary bg-bambu-dark focus:ring-bambu-green`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`text-white`,children:i(`settings.manageProjects`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.manageProjectsDescription`)})]})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:Ge.can_access_cloud,onChange:e=>Ke(t=>({...t,can_access_cloud:e.target.checked})),className:`w-4 h-4 text-bambu-green rounded border-bambu-dark-tertiary bg-bambu-dark focus:ring-bambu-green`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`text-white`,children:i(`settings.cloudAccess`,`Allow cloud access`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.cloudAccessDescription`,`Read Bambu Cloud presets and filaments on your behalf. Requires you to be signed into Bambu Cloud.`)})]})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:Ge.can_update_energy_cost,onChange:e=>Ke(t=>({...t,can_update_energy_cost:e.target.checked})),className:`w-4 h-4 text-bambu-green rounded border-bambu-dark-tertiary bg-bambu-dark focus:ring-bambu-green`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`text-white`,children:i(`settings.updateEnergyCost`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.updateEnergyCostDescription`)})]})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:Ge.can_send_notifications,onChange:e=>Ke(t=>({...t,can_send_notifications:e.target.checked})),className:`w-4 h-4 text-bambu-green rounded border-bambu-dark-tertiary bg-bambu-dark focus:ring-bambu-green`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`text-white`,children:i(`settings.sendNotifications`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.sendNotificationsDescription`)})]})]})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 pt-2`,children:[(0,G.jsxs)(Q,{onClick:()=>sn.mutate({name:Ue||i(`settings.unnamedKey`),...Ge}),disabled:sn.isPending,children:[sn.isPending?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(kl,{className:`w-4 h-4`}),i(`settings.createKey`)]}),(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>He(!1),children:i(`common.cancel`)})]})]})]}),on?(0,G.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,G.jsx)(Y,{className:`w-8 h-8 text-bambu-green animate-spin`})}):an&&an.length>0?(0,G.jsx)(`div`,{className:`space-y-3`,children:an.map(e=>(0,G.jsx)(zd,{children:(0,G.jsx)(Vd,{className:`py-3`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(Bc,{className:`w-5 h-5 ${e.enabled?`text-bambu-green`:`text-bambu-gray`}`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white font-medium`,children:e.name}),(0,G.jsxs)(`p`,{className:`text-xs text-bambu-gray`,children:[e.key_prefix,`••••••••`,e.last_used&&` · ${i(`settings.lastUsed`)}: ${tp(e.last_used)}`]})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex gap-1 text-xs flex-wrap justify-end`,children:[e.can_read_status&&(0,G.jsx)(`span`,{className:`px-1.5 py-0.5 bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400 rounded`,children:i(`settings.read`)}),e.can_queue&&(0,G.jsx)(`span`,{className:`px-1.5 py-0.5 bg-green-100 dark:bg-green-500/20 text-green-700 dark:text-green-400 rounded`,children:i(`queue.title`)}),e.can_control_printer&&(0,G.jsx)(`span`,{className:`px-1.5 py-0.5 bg-orange-100 dark:bg-orange-500/20 text-orange-700 dark:text-orange-400 rounded`,children:i(`settings.control`)}),e.can_manage_library&&(0,G.jsx)(`span`,{className:`px-1.5 py-0.5 bg-cyan-100 dark:bg-cyan-500/20 text-cyan-700 dark:text-cyan-400 rounded`,children:i(`settings.libraryBadge`)}),e.can_manage_inventory&&(0,G.jsx)(`span`,{className:`px-1.5 py-0.5 bg-pink-100 dark:bg-pink-500/20 text-pink-700 dark:text-pink-400 rounded`,children:i(`settings.inventoryBadge`)}),e.can_manage_maintenance&&(0,G.jsx)(`span`,{className:`px-1.5 py-0.5 bg-teal-100 dark:bg-teal-500/20 text-teal-700 dark:text-teal-400 rounded`,children:i(`settings.maintenanceBadge`)}),e.can_manage_archives&&(0,G.jsx)(`span`,{className:`px-1.5 py-0.5 bg-indigo-100 dark:bg-indigo-500/20 text-indigo-700 dark:text-indigo-400 rounded`,children:i(`settings.archivesBadge`)}),e.can_manage_projects&&(0,G.jsx)(`span`,{className:`px-1.5 py-0.5 bg-lime-100 dark:bg-lime-500/20 text-lime-700 dark:text-lime-400 rounded`,children:i(`settings.projectsBadge`)}),e.can_access_cloud&&(0,G.jsx)(`span`,{className:`px-1.5 py-0.5 bg-purple-100 dark:bg-purple-500/20 text-purple-700 dark:text-purple-400 rounded`,children:i(`settings.cloudBadge`,`Cloud`)}),e.can_update_energy_cost&&(0,G.jsx)(`span`,{className:`px-1.5 py-0.5 bg-amber-100 dark:bg-amber-500/20 text-amber-700 dark:text-amber-400 rounded`,children:i(`settings.energyCostBadge`)}),e.can_send_notifications&&(0,G.jsx)(`span`,{className:`px-1.5 py-0.5 bg-sky-100 dark:bg-sky-500/20 text-sky-700 dark:text-sky-400 rounded`,children:i(`settings.sendNotificationsBadge`)}),e.user_id===null&&(0,G.jsx)(`span`,{className:`px-1.5 py-0.5 bg-yellow-100 dark:bg-yellow-500/20 text-yellow-700 dark:text-yellow-400 rounded`,title:i(`settings.legacyKeyTooltip`,`Created before per-user ownership; recreate to use cloud access`),children:i(`settings.legacyKey`,`Legacy`)})]}),(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:()=>Qe(e.id),children:(0,G.jsx)(ju,{className:`w-4 h-4 text-red-600 dark:text-red-400`})})]})]})})},e.id))}):(0,G.jsx)(zd,{children:(0,G.jsx)(Vd,{className:`py-12`,children:(0,G.jsxs)(`div`,{className:`text-center text-bambu-gray`,children:[(0,G.jsx)(Bc,{className:`w-16 h-16 mx-auto mb-4 opacity-30`}),(0,G.jsx)(`p`,{className:`text-lg font-medium text-white mb-2`,children:i(`settings.apiKeysEmptyTitle`)}),(0,G.jsx)(`p`,{className:`text-sm mb-4`,children:i(`settings.apiKeysEmptyDescription`)}),(0,G.jsxs)(Q,{onClick:()=>He(!0),children:[(0,G.jsx)(kl,{className:`w-4 h-4`}),i(`settings.createFirstKey`)]})]})})}),(0,G.jsxs)(zd,{className:`mt-6`,children:[(0,G.jsx)(Bd,{children:(0,G.jsx)(`h3`,{className:`text-base font-semibold text-white`,id:`card-webhooks`,children:i(`settings.webhookEndpoints`)})}),(0,G.jsxs)(Vd,{className:`space-y-3 text-sm`,children:[(0,G.jsx)(`p`,{className:`text-bambu-gray`,children:i(`settings.webhookApiKeyHint`)}),(0,G.jsxs)(`div`,{className:`space-y-2 font-mono text-xs`,children:[(0,G.jsxs)(`div`,{className:`p-2 bg-bambu-dark rounded`,children:[(0,G.jsx)(`span`,{className:`text-blue-700 dark:text-blue-400`,children:`GET`}),` `,(0,G.jsx)(`span`,{className:`text-white`,children:`/api/v1/webhook/status`}),(0,G.jsxs)(`span`,{className:`text-bambu-gray`,children:[` - `,i(`settings.webhook.getAllStatus`)]})]}),(0,G.jsxs)(`div`,{className:`p-2 bg-bambu-dark rounded`,children:[(0,G.jsx)(`span`,{className:`text-blue-700 dark:text-blue-400`,children:`GET`}),` `,(0,G.jsx)(`span`,{className:`text-white`,children:`/api/v1/webhook/status/:id`}),(0,G.jsxs)(`span`,{className:`text-bambu-gray`,children:[` - `,i(`settings.webhook.getSpecificStatus`)]})]}),(0,G.jsxs)(`div`,{className:`p-2 bg-bambu-dark rounded`,children:[(0,G.jsx)(`span`,{className:`text-green-700 dark:text-green-400`,children:`POST`}),` `,(0,G.jsx)(`span`,{className:`text-white`,children:`/api/v1/webhook/queue`}),(0,G.jsxs)(`span`,{className:`text-bambu-gray`,children:[` - `,i(`settings.webhook.addToQueue`)]})]}),(0,G.jsxs)(`div`,{className:`p-2 bg-bambu-dark rounded`,children:[(0,G.jsx)(`span`,{className:`text-orange-700 dark:text-orange-400`,children:`POST`}),` `,(0,G.jsx)(`span`,{className:`text-white`,children:`/api/v1/webhook/printer/:id/pause`}),(0,G.jsxs)(`span`,{className:`text-bambu-gray`,children:[` - `,i(`settings.webhook.pausePrint`)]})]}),(0,G.jsxs)(`div`,{className:`p-2 bg-bambu-dark rounded`,children:[(0,G.jsx)(`span`,{className:`text-orange-700 dark:text-orange-400`,children:`POST`}),` `,(0,G.jsx)(`span`,{className:`text-white`,children:`/api/v1/webhook/printer/:id/resume`}),(0,G.jsxs)(`span`,{className:`text-bambu-gray`,children:[` - `,i(`settings.webhook.resumePrint`)]})]}),(0,G.jsxs)(`div`,{className:`p-2 bg-bambu-dark rounded`,children:[(0,G.jsx)(`span`,{className:`text-red-700 dark:text-red-400`,children:`POST`}),` `,(0,G.jsx)(`span`,{className:`text-white`,children:`/api/v1/webhook/printer/:id/stop`}),(0,G.jsxs)(`span`,{className:`text-bambu-gray`,children:[` - `,i(`settings.webhook.stopPrint`)]})]})]})]})]})]}),d(`settings:update`)&&(0,G.jsxs)(zd,{className:`mt-6`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,id:`card-connected-apps`,children:[(0,G.jsx)(Wc,{className:`w-4 h-4 text-bambu-green`}),i(`connectedApps.title`)]})}),(0,G.jsx)(Vd,{children:(0,G.jsx)(SGe,{})})]}),(0,G.jsxs)(zd,{className:`mt-6`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,id:`card-camera-tokens`,children:[(0,G.jsx)(Hu,{className:`w-4 h-4 text-bambu-green`}),i(`cameraTokens.title`,`Camera API Tokens`)]})}),(0,G.jsx)(Vd,{children:(0,G.jsx)(_Ge,{})})]}),(0,G.jsxs)(zd,{className:`mt-6`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,id:`card-stream-overlay`,children:[(0,G.jsx)(ll,{className:`w-4 h-4 text-bambu-green`}),i(`streamOverlay.builder.title`,`Streaming Overlay`)]})}),(0,G.jsx)(Vd,{children:(0,G.jsx)(wGe,{})})]})]}),d(`api_keys:read`)&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`mb-6`,children:[(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,id:`card-apibrowser`,children:[(0,G.jsx)(Cc,{className:`w-5 h-5 text-bambu-green`}),i(`settings.apiBrowser`)]}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:i(`settings.apiBrowserDescription`)})]}),(0,G.jsx)(zd,{className:`mb-4`,children:(0,G.jsxs)(Vd,{className:`py-3`,children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-2`,children:i(`settings.apiKeyForTesting`)}),(0,G.jsx)(`input`,{type:`text`,value:$e,onChange:e=>et(e.target.value),placeholder:i(`settings.apiKeyPlaceholder`),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white font-mono text-sm focus:border-bambu-green focus:outline-none`}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-2`,children:i(`settings.apiKeyHint`)})]})}),(0,G.jsx)(FKe,{apiKey:$e})]})]}),Ne===`virtual-printer`&&(0,G.jsx)(`div`,{id:`card-vp`,children:(0,G.jsx)(uKe,{})}),Ne===`spoolbuddy`&&(0,G.jsx)(`div`,{id:`card-spoolbuddy`,children:(0,G.jsx)(fKe,{})}),Ne===`queue`&&(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex gap-1 border-b border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`button`,{onClick:()=>Be(`dispatch`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px flex items-center gap-2 ${Le===`dispatch`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(Kc,{className:`w-4 h-4`}),i(`settings.tabs.queueDispatch`,`Queue & Dispatch`)]}),(0,G.jsxs)(`button`,{onClick:()=>Be(`pipelines`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px flex items-center gap-2 ${Le===`pipelines`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(Zu,{className:`w-4 h-4`}),i(`settings.tabs.queuePipelines`,`Pipelines`)]})]}),Le===`pipelines`&&(0,G.jsx)(lGe,{}),Le===`dispatch`&&A&&(0,G.jsxs)(`div`,{className:`flex flex-col lg:flex-row gap-4 lg:gap-6`,children:[(0,G.jsxs)(`div`,{className:`lg:w-1/2 space-y-3`,children:[(0,G.jsxs)(zd,{id:`card-print-options`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(Kc,{className:`w-4 h-4 text-bambu-green`}),i(`settings.defaultPrintOptions`,`Default Print Options`)]})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.defaultPrintOptionsDescription`,`Set default values for print options when starting new prints. These can be overridden per print in the print dialog.`)}),[{key:`default_bed_levelling`,label:i(`settings.defaultBedLevelling`,`Bed Levelling`),desc:i(`settings.defaultBedLevellingDesc`,`Auto-level bed before print`),fallback:!0,dualNozzleOnly:!1,tristate:!0},{key:`default_flow_cali`,label:i(`settings.defaultFlowCali`,`Flow Calibration`),desc:i(`settings.defaultFlowCaliDesc`,`Calibrate extrusion flow`),fallback:!1,dualNozzleOnly:!1,tristate:!0},{key:`default_vibration_cali`,label:i(`settings.defaultVibrationCali`,`Vibration Calibration`),desc:i(`settings.defaultVibrationCaliDesc`,`Reduce ringing artifacts`),fallback:!0,dualNozzleOnly:!1,tristate:!1},{key:`default_layer_inspect`,label:i(`settings.defaultLayerInspect`,`First Layer Inspection`),desc:i(`settings.defaultLayerInspectDesc`,`AI inspection of first layer`),fallback:!1,dualNozzleOnly:!1,tristate:!1},{key:`default_timelapse`,label:i(`settings.defaultTimelapse`,`Timelapse`),desc:i(`settings.defaultTimelapseDesc`,`Record timelapse video`),fallback:!1,dualNozzleOnly:!1,tristate:!1},{key:`default_nozzle_offset_cali`,label:i(`settings.defaultNozzleOffsetCali`,`Nozzle Offset Calibration`),desc:i(`settings.defaultNozzleOffsetCaliDesc`,`Calibrate nozzle offsets between extruders`),fallback:!0,dualNozzleOnly:!0,tristate:!0},{key:`default_confirm_outcome`,label:i(`settings.defaultConfirmOutcome`,`Ask for Outcome`),desc:i(`settings.defaultConfirmOutcomeDesc`,`Ask whether the print came out well after it completes`),fallback:!1,dualNozzleOnly:!1,tristate:!1}].filter(({dualNozzleOnly:e})=>!e||(ln||[]).some(e=>e.nozzle_count===2)).map(({key:e,label:t,desc:n,fallback:r,tristate:a})=>(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex-1 mr-4`,children:[(0,G.jsx)(`p`,{className:`text-sm text-white`,children:t}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:n})]}),a?(0,G.jsx)(`div`,{className:`flex gap-1 shrink-0`,children:jm.map(t=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>xr(e,t),className:`px-2.5 py-1 text-xs rounded transition-colors ${(A[e]??`auto`)===t?Mm[t]:`bg-bambu-dark-tertiary text-bambu-gray hover:text-white`}`,children:i(`settings.calibrationMode_${t}`)},t))}):(0,G.jsx)(`div`,{className:`flex gap-1 shrink-0`,children:[`off`,`on`].map(t=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>xr(e,t===`on`),className:`px-2.5 py-1 text-xs rounded transition-colors ${(A[e]??r?`on`:`off`)===t?Mm[t]:`bg-bambu-dark-tertiary text-bambu-gray hover:text-white`}`,children:i(`settings.calibrationMode_${t}`)},t))})]},e)),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex-1 mr-4`,children:[(0,G.jsx)(`p`,{className:`text-sm text-white`,children:i(`settings.confirmOutcomeExternalPrints`,`Also ask for prints started outside Bambuddy`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:i(`settings.confirmOutcomeExternalPrintsDesc`,`Prints started at the printer, in Bambu Studio or in the Handy app are archived by Bambuddy too. With this on, they get the same outcome prompt as queued prints.`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer shrink-0`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.confirm_outcome_external_prints??!1,onChange:e=>xr(`confirm_outcome_external_prints`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]})]})]}),(0,G.jsxs)(zd,{id:`card-plate`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(tu,{className:`w-4 h-4 text-bambu-green`}),i(`settings.plateClear`,`Plate-Clear Confirmation`)]})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex-1 mr-4`,children:[(0,G.jsx)(`p`,{className:`text-sm text-white`,children:i(`settings.requirePlateClear`,`Require plate-clear confirmation`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.requirePlateClearDescription`,`When enabled, the scheduler waits for per-printer plate-clear confirmation before starting queued prints on printers with finished jobs. Disabling this also hides the plate status badge and the "Mark plate as cleared" button on printer cards.`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.require_plate_clear??!1,onChange:e=>xr(`require_plate_clear`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex-1 mr-4`,children:[(0,G.jsx)(`p`,{className:`text-sm text-white`,children:i(`settings.confirmDefaultGoodOnPlateClear`,`Count unanswered outcomes as good on plate release`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.confirmDefaultGoodOnPlateClearDescription`,`When the plate is released (manually or by the next queued print) and the print's outcome prompt is still unanswered, record it as a good part automatically. The print then counts as good as soon as the plate is released; a Telegram or link answer after that only shows the recorded result.`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.confirm_default_good_on_plate_clear??!1,onChange:e=>xr(`confirm_default_good_on_plate_clear`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]})]})]}),(0,G.jsxs)(zd,{id:`card-temp-fan-presets`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(Du,{className:`w-4 h-4 text-bambu-green`}),i(`settings.tempFanPresetsTitle`,`Temperature & Fan Presets`)]})}),(0,G.jsxs)(Vd,{className:`space-y-4`,children:[(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.tempFanPresetsDescription`,`Customize the quick-select values shown in printer-card temperature and fan-speed popovers. The Off button is always shown.`)}),Cte.map(e=>{let t=dh(A?.[e.key]??``,e.defaults,e.lo,e.hi),n=e.unit===`C`?`°C`:`%`;return(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,G.jsxs)(`label`,{className:`text-sm text-white`,children:[i(`settings.${{nozzle_temp_presets:`tempFanPresetsNozzle`,bed_temp_presets:`tempFanPresetsBed`,chamber_temp_presets:`tempFanPresetsChamber`,fan_speed_presets:`tempFanPresetsFan`}[e.key]}`,{nozzle_temp_presets:`Nozzle temperature`,bed_temp_presets:`Bed temperature`,chamber_temp_presets:`Chamber temperature`,fan_speed_presets:`Fan speed`}[e.key]),` `,(0,G.jsxs)(`span`,{className:`text-bambu-gray text-xs`,children:[`(`,n,` · `,e.lo,`–`,e.hi,`)`]})]}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>xr(e.key,``),title:i(`settings.tempFanPresetsReset`,`Reset to defaults`),className:`text-bambu-gray hover:text-white transition-colors p-1 rounded hover:bg-bambu-dark-tertiary`,children:(0,G.jsx)(Rl,{className:`w-3.5 h-3.5`})})]}),(0,G.jsx)(`div`,{className:`flex gap-2`,children:[0,1,2].map(n=>(0,G.jsx)(`input`,{type:`number`,min:e.lo,max:e.hi,value:t[n],onChange:r=>{let i=[t[0],t[1],t[2]],a=parseInt(r.target.value,10);i[n]=Math.max(e.lo,Math.min(e.hi,Number.isFinite(a)?a:e.lo)),xr(e.key,JSON.stringify(i))},className:`flex-1 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`},n))})]},e.key)})]})]}),(0,G.jsxs)(zd,{id:`card-staggered`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(Hc,{className:`w-4 h-4 text-bambu-green`}),i(`settings.staggeredStart`,`Staggered Start`)]})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.staggeredStartDescription`,`Default group size and interval when staggering multi-printer batch starts. Can be overridden per batch in the print modal.`)}),(0,G.jsxs)(`div`,{className:`flex gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:i(`settings.staggerGroupSize`,`Group size`)}),(0,G.jsx)(Xp,{min:1,max:50,value:A.stagger_group_size??2,onChange:e=>xr(`stagger_group_size`,e),fallback:1,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.staggerGroupSizeHelp`,`Printers to start simultaneously per group`)})]}),(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:i(`settings.staggerInterval`,`Interval (minutes)`)}),(0,G.jsx)(Xp,{min:1,max:60,value:A.stagger_interval_minutes??5,onChange:e=>xr(`stagger_interval_minutes`,e),fallback:1,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.staggerIntervalHelp`,`Delay between each group starting`)})]})]})]})]}),(0,G.jsxs)(zd,{id:`card-concurrent-uploads`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(Es,{className:`w-4 h-4 text-bambu-green`}),i(`settings.concurrentUploadsTitle`,`Concurrent Uploads`)]})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.concurrentUploadsDescription`,`How many printers the queue may send files to at the same time. Printers receive files slowly (a large print can take several minutes), and each one waits its turn — so on a bigger fleet, raising this is what stops the last printer in a batch from waiting out every transfer before it. Lower it if your network or Bambuddy host struggles with parallel transfers.`)}),(0,G.jsxs)(`div`,{className:`w-full sm:w-1/2`,children:[(0,G.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:i(`settings.concurrentUploadsLabel`,`Printers uploaded to at once`)}),(0,G.jsx)(Xp,{min:1,max:16,value:A.queue_max_concurrent_uploads??4,onChange:e=>xr(`queue_max_concurrent_uploads`,e),fallback:1,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.concurrentUploadsHelp`,`1 sends to one printer at a time (the old behaviour). Default is 4.`)})]})]})]}),(0,G.jsxs)(zd,{id:`card-preheat`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(cc,{className:`w-4 h-4 text-amber-600 dark:text-amber-400`}),i(`settings.preheatTitle`,`Preheat & Heat Soak`)]})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.preheatDescription`,`Heat the bed (and chamber, if supported) and hold at temperature before each queued print starts. Helpful for engineering filaments (PA, ABS) on printers without an active chamber heater — the bed warms the chamber by radiation while the soak timer runs. The bed target is read from the print file; chamber behaviour depends on printer model.`)}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex-1 mr-4`,children:[(0,G.jsx)(`p`,{className:`text-sm text-white`,children:i(`settings.preheatEnabled`,`Enable preheat & soak`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:i(`settings.preheatEnabledDesc`,`When off, queued prints dispatch immediately.`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.preheat_enabled??!1,onChange:e=>xr(`preheat_enabled`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3 pt-1`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:i(`settings.preheatMaxWait`,`Max wait (seconds)`)}),(0,G.jsx)(Xp,{min:60,max:3600,value:A.preheat_max_wait_seconds??900,onChange:e=>xr(`preheat_max_wait_seconds`,e),fallback:900,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green disabled:opacity-50`,disabled:!(A.preheat_enabled??!1)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.preheatMaxWaitHelp`,`Cap on the chamber warm-up phase before falling through.`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:i(`settings.preheatSoak`,`Soak (seconds)`)}),(0,G.jsx)(Xp,{min:0,max:1800,value:A.preheat_soak_seconds??300,onChange:e=>xr(`preheat_soak_seconds`,e),fallback:0,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green disabled:opacity-50`,disabled:!(A.preheat_enabled??!1)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.preheatSoakHelp`,`Hold time after target reached or max-wait elapsed.`)})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between pt-2 border-t border-bambu-dark-tertiary/50`,children:[(0,G.jsxs)(`div`,{className:`flex-1 mr-4`,children:[(0,G.jsx)(`p`,{className:`text-sm text-white`,children:i(`settings.keepBedWarm`,`Keep bed warm between prints`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:i(`settings.keepBedWarmDesc`,`While awaiting plate-clear, hold the bed at the keep-warm temperature below so the chamber stays hot — or at the next print's own bed temperature when that is higher. Only applies when the next print needs chamber heating (ASA, ABS, PA, PC etc.). Requires plate-clear confirmation to be enabled.`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.queue_keep_bed_warm??!1,onChange:e=>xr(`queue_keep_bed_warm`,e.target.checked),className:`sr-only peer`,disabled:!(A.preheat_enabled??!1)||!(A.require_plate_clear??!1)}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green peer-disabled:opacity-50 peer-disabled:cursor-not-allowed`})]})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 mt-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:i(`settings.keepWarmBedTemp`,`Keep-warm bed temperature (°C)`)}),(0,G.jsx)(Xp,{min:40,max:110,value:A.queue_keep_warm_bed_temp??90,onChange:e=>xr(`queue_keep_warm_bed_temp`,e),fallback:90,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green disabled:opacity-50`,disabled:!(A.preheat_enabled??!1)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.keepWarmBedTempHelp`,`Used whenever the bed's job is to heat the chamber — the keep-warm hold, and preheat when the print file carries no bed temperature. A higher bed temperature from the print file always wins.`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:i(`settings.keepWarmMaxMinutes`,`Stop keeping warm after (minutes)`)}),(0,G.jsx)(Xp,{min:5,max:480,value:A.queue_keep_warm_max_minutes??120,onChange:e=>xr(`queue_keep_warm_max_minutes`,e),fallback:120,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green disabled:opacity-50`,disabled:!(A.queue_keep_bed_warm??!1)||!(A.preheat_enabled??!1)||!(A.require_plate_clear??!1)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.keepWarmMaxMinutesHelp`,`If the plate is not cleared within this time, the heaters are switched off rather than held indefinitely.`)})]})]}),(0,G.jsxs)(`div`,{className:`pt-2 border-t border-bambu-dark-tertiary/50`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,G.jsx)(`label`,{className:`text-sm text-white`,children:i(`settings.preheatFilamentTargetsLabel`,`Per-filament chamber target (°C)`)}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>xr(`preheat_filament_targets`,``),title:i(`settings.preheatFilamentTargetsReset`,`Reset to defaults`),className:`text-bambu-gray hover:text-white transition-colors p-1 rounded hover:bg-bambu-dark-tertiary`,children:(0,G.jsx)(Rl,{className:`w-3.5 h-3.5`})})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mb-2`,children:i(`settings.preheatFilamentTargetsHint`,`Bambuddy picks the highest target across the loaded AMS slots; PLA-only prints derive 0 and skip the chamber phase automatically.`)}),(0,G.jsx)(sGe,{value:A.preheat_filament_targets??``,onChange:e=>xr(`preheat_filament_targets`,e),disabled:!(A.preheat_enabled??!1)})]}),(0,G.jsxs)(`p`,{className:`text-xs text-bambu-gray pt-1 border-t border-bambu-dark-tertiary/50`,children:[(0,G.jsx)(`span`,{className:`font-medium text-bambu-gray/90`,children:i(`settings.preheatHardwareTitle`,`Per-printer behaviour:`)}),` `,i(`settings.preheatHardwareDetail`,`H2C/H2D/H2D Pro/H2S/X2D/X1E actively heat the chamber via M141. X1C/P2S read chamber temp but rely on bed-radiation heating. P1S/P1P/A1/A1 Mini have no chamber sensor — only the soak timer applies.`)]})]})]})]}),(0,G.jsxs)(`div`,{className:`lg:w-1/2 space-y-3`,children:[(0,G.jsxs)(zd,{id:`card-pipelines`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(Zu,{className:`w-4 h-4 text-bambu-green`}),i(`settings.pipelineLimits.title`,`Slicer Pipeline limits`)]})}),(0,G.jsx)(Vd,{className:`space-y-2`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`p`,{className:`text-sm text-white`,children:i(`settings.pipelineLimits.maxCopiesLabel`,`Max copies per run`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:i(`settings.pipelineLimits.maxCopiesDesc`,`Upper bound on the copies operators can request when running a pipeline. Server-side hard cap is 1000.`)})]}),(0,G.jsx)(`input`,{type:`number`,min:1,max:1e3,value:A.pipeline_max_copies??50,onChange:e=>{let t=parseInt(e.target.value,10);Number.isNaN(t)||xr(`pipeline_max_copies`,Math.max(1,Math.min(1e3,t)))},"aria-label":i(`settings.pipelineLimits.maxCopiesLabel`,`Max copies per run`),className:`w-24 px-2 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm`})]})})]}),(0,G.jsxs)(zd,{id:`card-slicer`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(js,{className:`w-4 h-4 text-bambu-green`}),i(`settings.slicerCard`,`Slicer`)]})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[LKe()&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.sliceEngine`)}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(`select`,{value:U8(A.slice_engine),onChange:e=>xr(`slice_engine`,e.target.value),className:`w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer`,children:H8().map(e=>(0,G.jsx)(`option`,{value:e.id,children:i(e.labelKey)},e.id))}),(0,G.jsx)(as,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(H8().find(e=>e.id===U8(A.slice_engine))?.descriptionKey??`settings.sliceEngineSidecarHint`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.preferredSlicer`)}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsxs)(`select`,{value:A.preferred_slicer??`bambu_studio`,onChange:e=>xr(`preferred_slicer`,e.target.value),className:`w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer`,children:[(0,G.jsx)(`option`,{value:`bambu_studio`,children:i(`settings.slicerBambuStudio`)}),(0,G.jsx)(`option`,{value:`orcaslicer`,children:i(`settings.slicerOrcaSlicer`)})]}),(0,G.jsx)(as,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.preferredSlicerDescription`)}),(A.preferred_slicer??`bambu_studio`)===`orcaslicer`&&(0,G.jsx)(`div`,{role:`alert`,className:`text-xs text-amber-800 dark:text-amber-200 bg-amber-50 dark:bg-amber-900/20 border border-amber-300 dark:border-amber-700/40 rounded p-2 mt-2`,children:i(`settings.orcaslicerKnownIssuesWarning`,`OrcaSlicer 2.3.2 / 2.4.0-dev have known CLI bugs that block slicing many Bambu-authored 3MFs — see upstream issues #12426 (segfault on painted multi-extruder files) and #13386 (parameter-range strict-validation reject). Bambu Studio is recommended until the upstream fixes land.`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.openInSlicerLabel`,`Open in Slicer`)}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsxs)(`select`,{value:A.open_in_slicer??``,onChange:e=>xr(`open_in_slicer`,e.target.value===``?null:e.target.value),className:`w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer`,children:[(0,G.jsx)(`option`,{value:``,children:i(`settings.openInSlicerInherit`,`Same as API slicer`)}),(0,G.jsx)(`option`,{value:`bambu_studio`,children:i(`settings.slicerBambuStudio`)}),(0,G.jsx)(`option`,{value:`orcaslicer`,children:i(`settings.slicerOrcaSlicer`)})]}),(0,G.jsx)(as,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.openInSlicerDescription`,`Desktop slicer used by the 'Open in Slicer' button. Leave on 'Same as API slicer' to inherit, or pick a different slicer to use locally.`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.useSlicerApi`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.useSlicerApiDescription`)})]}),(0,G.jsxs)(`label`,{className:`flex items-center cursor-pointer shrink-0`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.use_slicer_api??!1,onChange:e=>xr(`use_slicer_api`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`relative w-11 h-6 bg-bambu-dark-tertiary rounded-full peer peer-checked:bg-bambu-green peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-bambu-green/50 transition-colors after:content-[''] after:absolute after:top-0.5 after:left-0.5 after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-transform peer-checked:after:translate-x-5`})]})]}),(A.use_slicer_api??!1)&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:(A.preferred_slicer??`bambu_studio`)===`orcaslicer`?i(`settings.orcaslicerApiUrl`,`OrcaSlicer sidecar URL`):i(`settings.bambuStudioApiUrl`,`Bambu Studio sidecar URL`)}),(0,G.jsx)(`input`,{type:`text`,value:((A.preferred_slicer??`bambu_studio`)===`orcaslicer`?A.orcaslicer_api_url:A.bambu_studio_api_url)??``,onChange:e=>xr((A.preferred_slicer??`bambu_studio`)===`orcaslicer`?`orcaslicer_api_url`:`bambu_studio_api_url`,e.target.value),placeholder:(A.preferred_slicer??`bambu_studio`)===`orcaslicer`?`http://localhost:3003`:`http://localhost:3001`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none placeholder:text-bambu-gray/40`}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.slicerApiUrlDescription`,`URL of the slicer-API sidecar container. Leave blank to use the SLICER_API_URL / BAMBU_STUDIO_API_URL env var defaults.`)})]}),(A.use_slicer_api??!1)&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.slicerStallTimeout`)}),(0,G.jsx)(`input`,{type:`number`,min:1,max:240,value:A.slicer_stall_timeout_minutes??15,onChange:e=>xr(`slicer_stall_timeout_minutes`,Number(e.target.value)),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:i(`settings.slicerStallTimeoutDescription`)})]})]})]}),(0,G.jsxs)(zd,{children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,id:`card-drying`,children:[(0,G.jsx)(cc,{className:`w-4 h-4 text-amber-600 dark:text-amber-400`}),i(`settings.queueDrying`)]})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.queueDryingDescription`)}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-white`,children:i(`settings.queueDryingEnabled`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:i(`settings.queueDryingEnabledDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.queue_drying_enabled??!1,onChange:e=>xr(`queue_drying_enabled`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),A.queue_drying_enabled&&(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-white`,children:i(`settings.queueDryingBlock`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:i(`settings.queueDryingBlockDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.queue_drying_block??!1,onChange:e=>xr(`queue_drying_block`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-amber-500`})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-white`,children:i(`settings.ambientDryingEnabled`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:i(`settings.ambientDryingEnabledDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.ambient_drying_enabled??!1,onChange:e=>{F(null),xr(`ambient_drying_enabled`,e.target.checked)},className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),A.ambient_drying_enabled&&(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-white`,children:i(`settings.ambientDryingSustainedEnabled`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:i(`settings.ambientDryingSustainedDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:(A.ambient_drying_sustained_minutes??0)>0,onChange:e=>{F(null),xr(`ambient_drying_sustained_minutes`,e.target.checked?15:0)},className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),A.ambient_drying_enabled&&(A.ambient_drying_sustained_minutes??0)>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.ambientDryingSustainedMinutes`)}),(0,G.jsx)(`input`,{type:`number`,min:`5`,max:`240`,value:P??String(A.ambient_drying_sustained_minutes??15),onChange:e=>F(e.target.value),onBlur:e=>{let t=parseInt(e.target.value,10);Number.isNaN(t)||xr(`ambient_drying_sustained_minutes`,Math.max(5,Math.min(240,t))),F(null)},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()},className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-white`,children:i(`settings.printDryingEnabled`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:i(`settings.printDryingEnabledDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.print_drying_enabled??!1,onChange:e=>xr(`print_drying_enabled`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`p`,{className:`text-sm text-white font-medium`,children:i(`settings.dryingPresets`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.dryingPresetsDescription`)}),(0,G.jsx)(`div`,{className:`overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`text-bambu-gray border-b border-bambu-dark-tertiary`,children:[(0,G.jsx)(`th`,{className:`text-left py-1.5`,children:i(`settings.dryingFilament`)}),(0,G.jsx)(`th`,{className:`text-center py-1.5`,colSpan:2,children:`AMS 2 Pro`}),(0,G.jsx)(`th`,{className:`text-center py-1.5`,colSpan:2,children:`AMS-HT`})]})}),(0,G.jsx)(`tbody`,{children:(()=>{let e={PLA:{n3f:45,n3s:45,n3f_hours:12,n3s_hours:12},PETG:{n3f:65,n3s:65,n3f_hours:12,n3s_hours:12},TPU:{n3f:65,n3s:75,n3f_hours:12,n3s_hours:18},ABS:{n3f:65,n3s:80,n3f_hours:12,n3s_hours:8},ASA:{n3f:65,n3s:80,n3f_hours:12,n3s_hours:8},PA:{n3f:65,n3s:85,n3f_hours:12,n3s_hours:12},PC:{n3f:65,n3s:80,n3f_hours:12,n3s_hours:8},PVA:{n3f:65,n3s:85,n3f_hours:12,n3s_hours:18}},t={...e};try{if(A.drying_presets){let n=JSON.parse(A.drying_presets);typeof n==`object`&&n&&(t={...e,...n})}}catch{}let n=(e,n,r)=>{let i={...t,[e]:{...t[e],[n]:r}};xr(`drying_presets`,JSON.stringify(i))};return Object.entries(t).map(([e,t])=>(0,G.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary/50`,children:[(0,G.jsx)(`td`,{className:`py-1.5 pr-2 text-white font-medium`,children:e}),(0,G.jsx)(`td`,{className:`py-1 px-1`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[(0,G.jsx)(Xp,{min:30,max:65,value:t.n3f,onChange:t=>n(e,`n3f`,t),className:`w-14 px-1.5 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-center text-xs focus:border-amber-500/50 focus:outline-none [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:`°C`})]})}),(0,G.jsx)(`td`,{className:`py-1 px-1`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(Xp,{min:1,max:24,value:t.n3f_hours,onChange:t=>n(e,`n3f_hours`,t),className:`w-14 px-1.5 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-center text-xs focus:border-amber-500/50 focus:outline-none [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:`h`})]})}),(0,G.jsx)(`td`,{className:`py-1 px-1`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[(0,G.jsx)(Xp,{min:30,max:85,value:t.n3s,onChange:t=>n(e,`n3s`,t),className:`w-14 px-1.5 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-center text-xs focus:border-amber-500/50 focus:outline-none [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:`°C`})]})}),(0,G.jsx)(`td`,{className:`py-1 px-1`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(Xp,{min:1,max:24,value:t.n3s_hours,onChange:t=>n(e,`n3s_hours`,t),className:`w-14 px-1.5 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-center text-xs focus:border-amber-500/50 focus:outline-none [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:`h`})]})})]},e))})()})]})})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`p`,{className:`text-sm text-white font-medium`,children:i(`settings.humidityThresholds`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.humidityThresholdsDescription`)}),(0,G.jsx)(`div`,{className:`overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`text-bambu-gray border-b border-bambu-dark-tertiary`,children:[(0,G.jsx)(`th`,{className:`text-left py-1.5`,children:i(`settings.dryingFilament`)}),(0,G.jsx)(`th`,{className:`text-right py-1.5 pr-2`,children:i(`settings.humidityThresholdCol`)})]})}),(0,G.jsx)(`tbody`,{children:(()=>{let e=A.ams_humidity_fair??60,t=[`PLA`,`PETG`,`TPU`,`ABS`,`ASA`,`PA`,`PC`,`PVA`],n={};try{if(A.ams_humidity_thresholds){let e=JSON.parse(A.ams_humidity_thresholds);typeof e==`object`&&e&&(n=e)}}catch{}let r=[{key:`default`,label:i(`settings.humidityThresholdDefault`),value:Number(n.default??e),isDefault:!0},...t.map(t=>({key:t,label:t,value:Number(n[t]??n.default??e),isDefault:!1}))],a=(e,t)=>{if(t.trim()===``){let t={...n};delete t[e],xr(`ams_humidity_thresholds`,JSON.stringify(t));return}let r=parseInt(t,10);if(Number.isNaN(r))return;let i=Math.max(5,Math.min(95,r)),a={...n,[e]:i};xr(`ams_humidity_thresholds`,JSON.stringify(a))};return r.map(e=>{let t=M[e.key],n=t===void 0?String(e.value):t;return(0,G.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary/50`,children:[(0,G.jsx)(`td`,{className:`py-1.5 pr-2 font-medium ${e.isDefault?`text-bambu-gray italic`:`text-white`}`,children:e.label}),(0,G.jsx)(`td`,{className:`py-1 pr-2`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[(0,G.jsx)(`input`,{type:`number`,min:5,max:95,value:n,onChange:t=>N(n=>({...n,[e.key]:t.target.value})),onBlur:t=>{a(e.key,t.target.value),N(t=>{let n={...t};return delete n[e.key],n})},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()},className:`w-14 px-1.5 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-center text-xs focus:border-amber-500/50 focus:outline-none [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:`%`})]})})]},e.key)})})()})]})})]})]})]}),(0,G.jsxs)(zd,{id:`card-gcode`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h3`,{className:`text-base font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(Os,{className:`w-4 h-4 text-bambu-green`}),i(`settings.gcodeInjection`,`G-code Injection`)]})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.gcodeInjectionDescription`,`Configure custom G-code to inject at the start and/or end of prints for auto-print systems like Farmloop, SwapMod, AutoClear, and Printflow 3D. Snippets are configured per printer model and applied when "Inject G-code" is enabled on a queue item.`)}),(()=>{let e=(()=>{try{return A.gcode_snippets?JSON.parse(A.gcode_snippets):{}}catch{return{}}})(),t=[...new Set((ln||[]).filter(e=>e.model).map(e=>e.model))].sort(),n=(t,n,r)=>{let i={...e};i[t]||(i[t]={start_gcode:``,end_gcode:``}),i[t][n]=r,!i[t].start_gcode&&!i[t].end_gcode&&delete i[t];let a=Object.keys(i).length>0?JSON.stringify(i):``;j(e=>e?{...e,gcode_snippets:a}:null),hr.current=a},r=()=>{hr.current!==null&&(yr.mutate({gcode_snippets:hr.current}),hr.current=null)};return t.length===0?(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray italic`,children:i(`settings.gcodeInjectionNoPrinters`,`No printers found. Add printers to configure G-code snippets.`)}):t.map(t=>{let a=e[t]||{start_gcode:``,end_gcode:``},o=!!(a.start_gcode||a.end_gcode);return(0,G.jsx)(Wm,{defaultOpen:o,className:`border border-bambu-dark-tertiary rounded-lg px-3 py-2`,summary:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`h4`,{className:`text-sm font-medium text-white`,children:t}),o&&(0,G.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded bg-bambu-green/20 text-bambu-green`,children:i(`settings.gcodeConfigured`,`Configured`)})]}),children:(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:i(`settings.gcodeStartLabel`,`Start G-code`)}),(0,G.jsx)(`textarea`,{value:a.start_gcode,onChange:e=>n(t,`start_gcode`,e.target.value),onBlur:r,placeholder:i(`settings.gcodeStartPlaceholder`,`G-code prepended before the print starts...`),rows:3,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-xs font-mono focus:outline-none focus:border-bambu-green resize-y`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-xs text-bambu-gray mb-1`,children:i(`settings.gcodeEndLabel`,`End G-code`)}),(0,G.jsx)(`textarea`,{value:a.end_gcode,onChange:e=>n(t,`end_gcode`,e.target.value),onBlur:r,placeholder:i(`settings.gcodeEndPlaceholder`,`G-code appended after the print ends...`),rows:3,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-xs font-mono focus:outline-none focus:border-bambu-green resize-y`})]})]})},t)})})()]})]})]})]})]}),Ne===`filament`&&A&&(0,G.jsx)(G.Fragment,{children:(0,G.jsxs)(`div`,{className:`flex flex-col lg:flex-row gap-4 lg:gap-6`,children:[(0,G.jsxs)(`div`,{className:`lg:w-1/3 space-y-3`,children:[(0,G.jsx)(eKe,{}),(0,G.jsxs)(zd,{id:`card-filamentchecks`,children:[(0,G.jsx)(Bd,{children:(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:i(`settings.filamentChecks`)})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.disableFilamentWarnings`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.disableFilamentWarningsDesc`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.disable_filament_warnings,onChange:e=>xr(`disable_filament_warnings`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.preferLowestFilament`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.preferLowestFilamentDesc`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray/70 mt-1`,children:i(`settings.preferLowestFilamentBackupNote`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.prefer_lowest_filament,onChange:e=>xr(`prefer_lowest_filament`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]})]})]}),(0,G.jsxs)(zd,{id:`card-printmodal`,children:[(0,G.jsx)(Bd,{children:(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:i(`settings.printModal`)})}),(0,G.jsx)(Vd,{className:`space-y-3`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.expandCustomMapping`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.expandCustomMappingDescription`)})]}),(0,G.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.per_printer_mapping_expanded??!1,onChange:e=>xr(`per_printer_mapping_expanded`,e.target.checked),className:`sr-only peer`}),(0,G.jsx)(`div`,{className:`w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green`})]})]})})]}),(0,G.jsxs)(zd,{id:`card-amsthresholds`,children:[(0,G.jsx)(Bd,{children:(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:i(`settings.amsDisplayThresholds`)})}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.amsThresholdsDescription`)}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-white`,children:[(0,G.jsx)(Gs,{className:`w-4 h-4 text-blue-600 dark:text-blue-400`}),(0,G.jsx)(`span`,{className:`font-medium`,children:i(`settings.humidity`)})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:[i(`settings.goodGreen`),` ≤`]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Xp,{min:0,max:100,value:A.ams_humidity_good??40,onChange:e=>xr(`ams_humidity_good`,e),fallback:40,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:`%`})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:[i(`settings.fairOrange`),` ≤`]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Xp,{min:0,max:100,value:A.ams_humidity_fair??60,onChange:e=>xr(`ams_humidity_fair`,e),fallback:60,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:`%`})]})]})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.aboveFairBad`)}),(0,G.jsx)(`p`,{className:`text-xs text-amber-700/80 dark:text-amber-400/70`,children:i(`settings.fairAlsoDryingThreshold`)}),(A.ams_humidity_fair??60)xr(`ams_temp_good`,e),integer:!1,fallback:28,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:`°C`})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:[i(`settings.fairOrange`),` ≤`]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Xp,{step:`0.5`,min:0,max:60,value:A.ams_temp_fair??35,onChange:e=>xr(`ams_temp_fair`,e),integer:!1,fallback:35,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:`°C`})]})]})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.aboveFairHot`)}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.tempAlarmThreshold`)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{type:`number`,step:`0.5`,min:`0.5`,max:`120`,value:A.ams_temp_alarm??``,placeholder:String(A.ams_temp_fair??35),onChange:e=>{let t=e.target.value.trim(),n=parseFloat(t);xr(`ams_temp_alarm`,t===``||Number.isNaN(n)?null:n)},className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:`°C`})]})]}),(A.ams_temp_alarm??1)<=0&&(0,G.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-400`,children:i(`settings.tempAlarmMustBePositive`)}),(0,G.jsx)(`p`,{className:`text-xs text-amber-700/80 dark:text-amber-400/70`,children:i(`settings.tempAlarmSeparateFromBand`)})]}),(0,G.jsxs)(`div`,{className:`space-y-3 pt-4 border-t border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-white`,children:[(0,G.jsx)(Rs,{className:`w-4 h-4 text-purple-600 dark:text-purple-400`}),(0,G.jsx)(`span`,{className:`font-medium`,children:i(`settings.historyRetention`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:i(`settings.keepSensorHistory`)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Xp,{min:1,max:365,value:A.ams_history_retention_days??30,onChange:e=>xr(`ams_history_retention_days`,e),fallback:30,className:`w-24 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:i(`common.days`)})]})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:i(`settings.historyRetentionDescription`)})]})]})]})]}),(0,G.jsxs)(`div`,{className:`lg:w-2/3 space-y-3`,children:[(0,G.jsx)(tKe,{}),(0,G.jsx)(nKe,{})]})]})}),Ze!==null&&(0,G.jsx)(af,{title:i(`settings.deleteApiKeyTitle`),message:i(`settings.deleteApiKeyMessage`),confirmText:i(`settings.deleteKey`),variant:`danger`,onConfirm:()=>{cn.mutate(Ze),Qe(null)},onCancel:()=>Qe(null)}),I&&(0,G.jsx)(EGe,{plug:R,onClose:()=>{L(!1),z(null)}}),B&&(0,G.jsx)(DGe,{sensor:ee,printers:ln??[],onClose:()=>{V(!1),te(null)}}),ne&&(0,G.jsx)(kGe,{sensor:ie,locations:fn??[],onClose:()=>{re(!1),ae(null)}}),oe&&(0,G.jsx)(MGe,{onClose:()=>se(!1)}),de&&(0,G.jsx)(af,{title:i(`locationHaSensors.deleteAllConfirm.title`),message:i(`locationHaSensors.deleteAllConfirm.message`,{location:de.locationName,count:de.sensorIds.length}),variant:`danger`,isLoading:hn.isPending,onConfirm:()=>hn.mutate(de.sensorIds),onCancel:()=>fe(null)}),pe&&(0,G.jsx)(FGe,{provider:he,onClose:()=>{me(!1),ge(null)}}),_e&&(0,G.jsx)(IGe,{template:_e,onClose:()=>ve(null)}),Ce&&(0,G.jsx)(RGe,{onClose:()=>we(!1)}),tt&&(0,G.jsx)(af,{title:i(`settings.clearNotificationLogs`),message:i(`settings.clearLogsMessage`),confirmText:i(`settings.clearLogs`),variant:`warning`,onConfirm:async()=>{nt(!1);try{o((await Z.clearNotificationLogs(30)).message,`success`)}catch{o(i(`settings.toast.clearLogsFailed`),`error`)}},onCancel:()=>nt(!1)}),rt&&(0,G.jsx)(af,{title:i(`settings.resetUiPreferences`),message:i(`settings.resetUiPreferencesMessage`),confirmText:i(`settings.resetPreferences`),variant:`default`,onConfirm:()=>{it(!1),localStorage.clear(),o(i(`settings.toast.uiPreferencesReset`),`success`),setTimeout(()=>window.location.reload(),1e3)},onCancel:()=>it(!1)}),at&&(0,G.jsx)(af,{title:`Turn All Plugs ${at===`on`?`On`:`Off`}`,message:`This will turn ${at===`on`?`ON`:`OFF`} all ${$t?.filter(e=>e.enabled).length||0} enabled smart plugs. ${at===`off`?`Any running printers may be affected!`:``}`,confirmText:`Turn All ${at===`on`?`On`:`Off`}`,variant:at===`off`?`danger`:`warning`,onConfirm:()=>{let e=at;ot(null),pr.mutate(e)},onCancel:()=>ot(null)}),st&&In?.release_notes&&(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,onClick:()=>ct(!1),children:(0,G.jsxs)(zd,{className:`w-full max-w-2xl max-h-[80vh] flex flex-col`,onClick:e=>e.stopPropagation(),children:[(0,G.jsxs)(Bd,{className:`flex flex-row items-center justify-between shrink-0`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white`,children:[`Release Notes - v`,In.latest_version]}),In.release_name&&In.release_name!==In.latest_version&&(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:In.release_name})]}),(0,G.jsx)(`button`,{onClick:()=>ct(!1),className:`p-1 rounded hover:bg-bambu-dark-tertiary text-bambu-gray hover:text-white`,children:(0,G.jsx)($u,{className:`w-5 h-5`})})]}),(0,G.jsx)(Vd,{className:`overflow-y-auto flex-1`,children:(0,G.jsx)(`pre`,{className:`text-sm text-bambu-gray whitespace-pre-wrap font-sans`,children:In.release_notes})}),(0,G.jsxs)(`div`,{className:`p-4 border-t border-bambu-dark-tertiary shrink-0 flex gap-2`,children:[In.release_url&&(0,G.jsx)(`a`,{href:In.release_url,target:`_blank`,rel:`noopener noreferrer`,className:`flex-1`,children:(0,G.jsxs)(Q,{variant:`secondary`,className:`w-full`,children:[(0,G.jsx)(Xs,{className:`w-4 h-4`}),`View on GitHub`]})}),(0,G.jsx)(Q,{onClick:()=>ct(!1),className:`flex-1`,children:`Close`})]})]})}),Ne===`users`&&(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex gap-1 border-b border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`button`,{onClick:()=>Ie(`users`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px lg:border-b-0 lg:border-l-2 lg:-ml-px lg:mb-0 lg:justify-start flex items-center gap-2 ${Fe===`users`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(Bu,{className:`w-4 h-4`}),i(`settings.tabs.users`)]}),(0,G.jsxs)(`button`,{onClick:()=>Ie(`email`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px lg:border-b-0 lg:border-l-2 lg:-ml-px lg:mb-0 lg:justify-start flex items-center gap-2 ${Fe===`email`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)($c,{className:`w-4 h-4`}),i(`settings.tabs.emailAuth`)||`Email Authentication`,Wn?.advanced_auth_enabled&&(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-green-400`})]}),(0,G.jsxs)(`button`,{onClick:()=>Ie(`ldap`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px lg:border-b-0 lg:border-l-2 lg:-ml-px lg:mb-0 lg:justify-start flex items-center gap-2 ${Fe===`ldap`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(tu,{className:`w-4 h-4`}),i(`settings.tabs.ldap`)||`LDAP`,Gn?.ldap_enabled&&(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-green-400`})]}),(0,G.jsxs)(`button`,{onClick:()=>Ie(`twofa`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px flex items-center gap-2 ${Fe===`twofa`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(tu,{className:`w-4 h-4`}),i(`settings.tabs.twoFa`),(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full ${Kn?.totp_enabled||Kn?.email_otp_enabled?`bg-green-400`:`bg-bambu-gray/40`}`})]}),l&&(0,G.jsxs)(`button`,{onClick:()=>Ie(`oidc`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px flex items-center gap-2 ${Fe===`oidc`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(Cc,{className:`w-4 h-4`}),i(`settings.tabs.oidc`),(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full ${qn.some(e=>e.is_enabled)?`bg-green-400`:`bg-bambu-gray/40`}`})]}),l&&(0,G.jsxs)(`button`,{onClick:()=>Ie(`security`),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px flex items-center gap-2 ${Fe===`security`?`text-bambu-green border-bambu-green`:`text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent`}`,children:[(0,G.jsx)(tu,{className:`w-4 h-4`}),i(`settings.tabs.security`)]})]}),Fe===`users`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(zd,{children:(0,G.jsx)(Vd,{className:`py-4`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-10 h-10 rounded-full flex items-center justify-center ${s?`bg-green-500/20`:`bg-gray-500/20`}`,children:s?(0,G.jsx)(Xc,{className:`w-5 h-5 text-green-600 dark:text-green-400`}):(0,G.jsx)(Yc,{className:`w-5 h-5 text-gray-400`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-white font-medium`,children:i(`settings.authentication`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(s?`settings.authEnabledDescription`:`settings.authDisabledDescription`)})]})]}),s?c?.is_admin&&(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>ut(!0),children:[(0,G.jsx)(Yc,{className:`w-4 h-4`}),i(`common.disable`)]}):(0,G.jsxs)(Q,{onClick:()=>t(`/setup`),children:[(0,G.jsx)(Xc,{className:`w-4 h-4`}),i(`common.enable`)]})]})})}),Wn?.advanced_auth_enabled&&(0,G.jsx)(zd,{className:`border-blue-500/30 bg-blue-500/5`,children:(0,G.jsx)(Vd,{className:`py-4`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`w-10 h-10 rounded-full flex items-center justify-center bg-blue-500/20 flex-shrink-0`,children:(0,G.jsx)($c,{className:`w-5 h-5 text-blue-600 dark:text-blue-400`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-white font-medium`,children:i(`settings.email.advancedAuthEnabled`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:i(`settings.email.advancedAuthEnabledDesc`)})]})]})})}),s&&(0,G.jsxs)(`div`,{className:`grid grid-cols-1 xl:grid-cols-2 gap-6`,children:[(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(zd,{id:`card-session-policy`,children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`h3`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(Xc,{className:`w-5 h-5 text-bambu-green`}),i(`settings.sessionPolicy.title`)]})}),(0,G.jsxs)(Vd,{children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mb-4`,children:i(`settings.sessionPolicy.description`)}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-2 mb-4`,children:[[{hours:24,labelKey:`settings.sessionPolicy.preset24h`},{hours:168,labelKey:`settings.sessionPolicy.preset7d`},{hours:720,labelKey:`settings.sessionPolicy.preset30d`}].map(e=>{let t=(A?.session_max_hours??24)===e.hours;return(0,G.jsx)(`button`,{type:`button`,onClick:()=>xr(`session_max_hours`,e.hours),disabled:s&&!d(`settings:update`),className:`px-3 py-2 rounded-lg text-sm font-medium transition-colors ${t?`bg-bambu-green text-white`:`bg-bambu-dark-tertiary text-bambu-gray hover:text-white hover:bg-bambu-dark`} disabled:opacity-50 disabled:cursor-not-allowed`,children:i(e.labelKey)},e.hours)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(`input`,{type:`number`,min:1,max:720,value:A?.session_max_hours??24,onChange:e=>{let t=parseInt(e.target.value,10);Number.isNaN(t)||xr(`session_max_hours`,Math.max(1,Math.min(720,t)))},disabled:s&&!d(`settings:update`),"aria-label":i(`settings.sessionPolicy.customHoursLabel`),className:`w-20 px-2 py-2 bg-bambu-dark-tertiary text-white text-sm rounded-lg border border-bambu-dark-tertiary focus:border-bambu-green focus:outline-none disabled:opacity-50`}),(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:i(`settings.sessionPolicy.hoursSuffix`)})]})]}),(A?.session_max_hours??24)>24&&(0,G.jsxs)(`div`,{className:`flex items-start gap-2 p-3 rounded-lg bg-yellow-50 dark:bg-yellow-500/10 border border-yellow-300 dark:border-yellow-500/30`,children:[(0,G.jsx)(Pu,{className:`w-4 h-4 text-yellow-600 dark:text-yellow-400 flex-shrink-0 mt-0.5`}),(0,G.jsx)(`p`,{className:`text-xs text-yellow-800 dark:text-yellow-200`,children:i(`settings.sessionPolicy.warning`)})]})]})]}),c&&(0,G.jsxs)(zd,{children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`h3`,{className:`text-lg font-semibold text-white flex items-center gap-2`,id:`card-currentuser`,children:[(0,G.jsx)(Bu,{className:`w-5 h-5 text-bambu-green`}),i(`settings.currentUser`)]}),c.auth_source!==`ldap`&&(0,G.jsxs)(Q,{size:`sm`,variant:`ghost`,onClick:()=>ft(!0),children:[(0,G.jsx)(Bc,{className:`w-4 h-4`}),i(`settings.changePassword`)]})]})}),(0,G.jsx)(Vd,{children:(0,G.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white font-medium text-lg`,children:c.username}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-1 mt-2`,children:[c.is_admin&&(0,G.jsx)(`span`,{className:`px-2 py-0.5 rounded-full text-xs font-medium bg-purple-100 dark:bg-purple-500/20 text-purple-700 dark:text-purple-300`,children:i(`settings.admin`)}),c.groups?.map(e=>(0,G.jsx)(`span`,{className:`px-2 py-0.5 rounded-full text-xs font-medium ${e.name===`Administrators`?`bg-purple-100 dark:bg-purple-500/20 text-purple-700 dark:text-purple-300`:e.name===`Operators`?`bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-300`:e.name===`Viewers`?`bg-green-100 dark:bg-green-500/20 text-green-700 dark:text-green-300`:`bg-gray-500/20 text-gray-300`}`,children:e.name},e.id))]})]})})})]}),(0,G.jsxs)(zd,{children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`h3`,{className:`text-lg font-semibold text-white flex items-center gap-2`,id:`card-users`,children:[(0,G.jsx)(Bu,{className:`w-5 h-5 text-bambu-green`}),i(`settings.users`)]}),d(`users:create`)&&(0,G.jsxs)(Q,{size:`sm`,onClick:()=>{bt(!0),Ft({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]})},children:[(0,G.jsx)(kl,{className:`w-4 h-4`}),i(`settings.addUser`)]})]})}),(0,G.jsx)(Vd,{children:Yn?(0,G.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,G.jsx)(Y,{className:`w-6 h-6 text-bambu-green animate-spin`})}):Jn.length===0?(0,G.jsx)(`p`,{className:`text-center text-bambu-gray py-8`,children:i(`settings.noUsersFound`)}):(0,G.jsx)(`div`,{className:`divide-y divide-bambu-dark-tertiary`,children:Jn.map(e=>(0,G.jsxs)(`div`,{className:`py-3 flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`p`,{className:`text-white font-medium truncate`,children:e.username}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-1 mt-1`,children:[e.auth_source===`ldap`&&(0,G.jsx)(`span`,{className:`px-2 py-0.5 rounded-full text-xs font-medium bg-cyan-100 dark:bg-cyan-500/20 text-cyan-700 dark:text-cyan-300`,children:`LDAP`}),e.is_admin&&(0,G.jsx)(`span`,{className:`px-2 py-0.5 rounded-full text-xs font-medium bg-purple-100 dark:bg-purple-500/20 text-purple-700 dark:text-purple-300`,children:i(`settings.admin`)}),e.groups?.map(e=>(0,G.jsx)(`span`,{className:`px-2 py-0.5 rounded-full text-xs font-medium ${e.name===`Administrators`?`bg-purple-100 dark:bg-purple-500/20 text-purple-700 dark:text-purple-300`:e.name===`Operators`?`bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-300`:e.name===`Viewers`?`bg-green-100 dark:bg-green-500/20 text-green-700 dark:text-green-300`:`bg-gray-500/20 text-gray-300`}`,children:e.name},e.id))]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1 ml-4`,children:[d(`users:update`)&&(0,G.jsx)(Q,{size:`sm`,variant:`ghost`,onClick:()=>sr(e),children:(0,G.jsx)(Cl,{className:`w-4 h-4`})}),d(`users:delete`)&&e.id!==c?.id&&(0,G.jsx)(Q,{size:`sm`,variant:`ghost`,onClick:()=>rr(e.id),children:(0,G.jsx)(ju,{className:`w-4 h-4`})})]})]},e.id))})})]})]}),(0,G.jsx)(`div`,{children:(0,G.jsxs)(zd,{children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`h3`,{className:`text-lg font-semibold text-white flex items-center gap-2`,id:`card-groups`,children:[(0,G.jsx)(tu,{className:`w-5 h-5 text-bambu-green`}),i(`settings.groups`)]}),d(`groups:create`)&&(0,G.jsxs)(Q,{size:`sm`,onClick:()=>t(`/groups/new`),children:[(0,G.jsx)(kl,{className:`w-4 h-4`}),i(`settings.addGroup`)]})]})}),(0,G.jsx)(Vd,{children:Zn?(0,G.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,G.jsx)(Y,{className:`w-6 h-6 text-bambu-green animate-spin`})}):Xn.length===0?(0,G.jsx)(`p`,{className:`text-center text-bambu-gray py-8`,children:i(`settings.noGroupsFound`)}):(0,G.jsx)(`div`,{className:`divide-y divide-bambu-dark-tertiary`,children:Xn.map(e=>(0,G.jsxs)(`div`,{className:`py-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(tu,{className:`w-4 h-4 ${e.name===`Administrators`?`text-purple-600 dark:text-purple-400`:e.name===`Operators`?`text-blue-600 dark:text-blue-400`:e.name===`Viewers`?`text-green-600 dark:text-green-400`:`text-bambu-gray`}`}),(0,G.jsx)(`span`,{className:`text-white font-medium`,children:e.name}),e.is_system&&(0,G.jsx)(`span`,{className:`px-2 py-0.5 rounded text-xs bg-yellow-100 dark:bg-yellow-500/20 text-yellow-700 dark:text-yellow-400`,children:i(`settings.system`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[d(`groups:update`)&&(0,G.jsx)(Q,{size:`sm`,variant:`ghost`,onClick:()=>t(`/groups/${e.id}/edit`),children:(0,G.jsx)(Cl,{className:`w-4 h-4`})}),d(`groups:delete`)&&!e.is_system&&(0,G.jsx)(Q,{size:`sm`,variant:`ghost`,onClick:()=>Lt(e.id),children:(0,G.jsx)(ju,{className:`w-4 h-4`})})]})]}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1 ml-6`,children:e.description||i(`settings.noDescription`)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-4 mt-2 ml-6 text-xs text-bambu-gray`,children:[(0,G.jsx)(`span`,{children:i(`settings.userCount`,{count:e.user_count})}),(0,G.jsx)(`span`,{children:i(`settings.permissionCount`,{count:e.permissions.length})})]})]},e.id))})})]})})]}),!s&&(0,G.jsx)(zd,{children:(0,G.jsx)(Vd,{className:`py-6`,children:(0,G.jsxs)(`div`,{className:`text-center`,children:[(0,G.jsx)(Yc,{className:`w-12 h-12 text-bambu-gray mx-auto mb-4`}),(0,G.jsx)(`h3`,{className:`text-lg font-medium text-white mb-2`,children:i(`settings.authDisabledTitle`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mb-4 max-w-md mx-auto`,children:i(`settings.authDisabledMessage`)}),(0,G.jsxs)(`ul`,{className:`space-y-2 text-sm text-bambu-gray mb-6 text-left max-w-xs mx-auto`,children:[(0,G.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(ms,{className:`w-4 h-4 text-bambu-green mt-0.5 flex-shrink-0`}),(0,G.jsx)(`span`,{children:i(`settings.authDisabledFeature1`)})]}),(0,G.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(ms,{className:`w-4 h-4 text-bambu-green mt-0.5 flex-shrink-0`}),(0,G.jsx)(`span`,{children:i(`settings.authDisabledFeature2`)})]}),(0,G.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(ms,{className:`w-4 h-4 text-bambu-green mt-0.5 flex-shrink-0`}),(0,G.jsx)(`span`,{children:i(`settings.authDisabledFeature3`)})]})]}),(0,G.jsxs)(Q,{onClick:()=>t(`/setup`),children:[(0,G.jsx)(Xc,{className:`w-4 h-4`}),i(`settings.enableAuthentication`)]})]})})})]}),Fe===`email`&&(0,G.jsx)(`div`,{className:`max-w-5xl`,id:`card-smtp`,children:(0,G.jsx)(SKe,{})}),Fe===`ldap`&&(0,G.jsx)(`div`,{className:`max-w-5xl`,id:`card-ldap`,children:(0,G.jsx)(wKe,{})}),Fe===`twofa`&&(0,G.jsx)(`div`,{className:`max-w-2xl`,children:(0,G.jsx)(EKe,{})}),Fe===`oidc`&&l&&(0,G.jsxs)(`div`,{className:`max-w-3xl space-y-4`,children:[(0,G.jsx)(zd,{children:(0,G.jsx)(Vd,{className:`space-y-3 p-4`,children:(0,G.jsxs)(`label`,{className:`flex items-start gap-3 cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:A.local_login_enabled===!1,onChange:e=>xr(`local_login_enabled`,!e.target.checked),className:`mt-1 h-4 w-4 rounded border-bambu-dark-tertiary bg-bambu-dark-secondary text-bambu-green focus:ring-bambu-green/50 cursor-pointer`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-sm font-medium text-white`,children:i(`settings.localLogin.disable`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:i(`settings.localLogin.disableHint`)})]})]})})}),(0,G.jsx)(kKe,{})]}),Fe===`security`&&l&&(0,G.jsx)(`div`,{className:`max-w-3xl`,children:(0,G.jsx)(jKe,{})})]}),yt&&!Wn?.advanced_auth_enabled&&(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black flex items-center justify-center z-50 p-4`,onClick:()=>{bt(!1),Ft({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]})},children:(0,G.jsxs)(zd,{className:`w-full max-w-md`,onClick:e=>e.stopPropagation(),children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Bu,{className:`w-5 h-5 text-bambu-green`}),(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:i(`settings.createUser`)})]}),(0,G.jsx)(Q,{variant:`ghost`,size:`sm`,onClick:()=>{bt(!1),Ft({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]})},children:(0,G.jsx)($u,{className:`w-5 h-5`})})]})}),(0,G.jsxs)(Vd,{children:[Gn?.ldap_enabled&&(0,G.jsxs)(`div`,{className:`mb-4 flex items-center gap-1 p-1 bg-bambu-dark-secondary rounded-lg`,role:`tablist`,"aria-label":i(`users.modal.tabsAriaLabel`),children:[(0,G.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":xt===`local`,onClick:()=>Ct(`local`),className:`flex-1 px-3 py-2 text-sm rounded-md transition-colors ${xt===`local`?`bg-bambu-green/15 text-bambu-green`:`text-bambu-gray hover:text-white`}`,children:i(`users.modal.localTab`)}),(0,G.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":xt===`ldap`,onClick:()=>Ct(`ldap`),className:`flex-1 px-3 py-2 text-sm rounded-md transition-colors ${xt===`ldap`?`bg-bambu-green/15 text-bambu-green`:`text-bambu-gray hover:text-white`}`,children:i(`users.modal.ldapTab`)})]}),xt===`ldap`&&Gn?.ldap_enabled?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(S8,{onSuccess:e=>{bt(!1),Ct(`local`),Ft({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]}),o(i(`users.toast.ldapProvisioned`,{username:e.username}))}}),(0,G.jsx)(`div`,{className:`mt-6 flex justify-end`,children:(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>{bt(!1),Ct(`local`),Ft({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]})},children:i(`common.cancel`)})})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:i(`settings.username`)}),(0,G.jsx)(`input`,{type:`text`,value:Pt.username,onChange:e=>Ft({...Pt,username:e.target.value}),className:`w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:i(`settings.enterUsername`),autoComplete:`username`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:i(`settings.password`)}),(0,G.jsx)(`input`,{type:`password`,value:Pt.password,onChange:e=>Ft({...Pt,password:e.target.value}),className:`w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:i(`settings.enterPassword`),autoComplete:`new-password`,minLength:8}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-xs mt-1`,children:i(`settings.passwordRequirements`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:i(`settings.confirmPassword`)}),(0,G.jsx)(`input`,{type:`password`,value:Pt.confirmPassword,onChange:e=>Ft({...Pt,confirmPassword:e.target.value}),className:`w-full px-4 py-3 bg-bambu-dark-secondary border rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors ${Pt.confirmPassword&&Pt.password!==Pt.confirmPassword?`border-red-500`:`border-bambu-dark-tertiary`}`,placeholder:i(`settings.confirmPasswordPlaceholder`),autoComplete:`new-password`,minLength:6}),Pt.confirmPassword&&Pt.password!==Pt.confirmPassword&&(0,G.jsx)(`p`,{className:`text-red-700 dark:text-red-400 text-xs mt-1`,children:i(`settings.passwordsDoNotMatch`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:i(`settings.groups`)}),(0,G.jsxs)(`div`,{className:`space-y-2 max-h-40 overflow-y-auto p-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg`,children:[Xn.map(e=>(0,G.jsxs)(`label`,{className:`flex items-center gap-3 px-2 py-1.5 rounded hover:bg-bambu-dark-tertiary cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:Pt.group_ids.includes(e.id),onChange:()=>cr(e.id),className:`w-4 h-4 rounded border-bambu-gray text-bambu-green focus:ring-bambu-green focus:ring-offset-0 bg-bambu-dark`}),(0,G.jsx)(`span`,{className:`text-sm text-white`,children:e.name}),e.is_system&&(0,G.jsx)(`span`,{className:`text-xs text-yellow-700 dark:text-yellow-400`,children:i(`settings.systemBadge`)})]},e.id)),Xn.length===0&&(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`settings.noGroupsAvailable`)})]})]})]}),(0,G.jsxs)(`div`,{className:`mt-6 flex justify-end gap-3`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>{bt(!1),Ft({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]})},children:i(`common.cancel`)}),(0,G.jsx)(Q,{onClick:ar,disabled:Qn.isPending||!Pt.username||!Pt.password||Pt.password!==Pt.confirmPassword||f6(Pt.password)!==null,children:Qn.isPending?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),i(`settings.creating`)]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(kl,{className:`w-4 h-4`}),i(`settings.createUser`)]})})]})]})]})]})}),yt&&Wn?.advanced_auth_enabled&&(0,G.jsx)($Ge,{formData:Pt,setFormData:Ft,groups:Xn,onClose:()=>{bt(!1),Ft({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]})},onCreate:ar,isCreating:Qn.isPending,isCreateButtonDisabled:Qn.isPending||!Pt.username||!Pt.email,ldapEnabled:Gn?.ldap_enabled,onLdapProvisioned:e=>{bt(!1),Ft({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]}),o(i(`users.toast.ldapProvisioned`,{username:e.username}))}}),wt&&Et!==null&&(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black flex items-center justify-center z-50 p-4`,onClick:()=>{Tt(!1),Dt(null),Ft({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]})},children:(0,G.jsxs)(zd,{className:`w-full max-w-md`,onClick:e=>e.stopPropagation(),children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Cl,{className:`w-5 h-5 text-bambu-green`}),(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:i(`settings.editUser`)})]}),(0,G.jsx)(Q,{variant:`ghost`,size:`sm`,onClick:()=>{Tt(!1),Dt(null),Ft({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]})},children:(0,G.jsx)($u,{className:`w-5 h-5`})})]})}),(0,G.jsxs)(Vd,{children:[(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:[i(`settings.username`),` `,Wn?.advanced_auth_enabled&&(0,G.jsx)(`span`,{className:`text-red-700 dark:text-red-400`,children:`*`})]}),(0,G.jsx)(`input`,{type:`text`,value:Pt.username,onChange:e=>Ft({...Pt,username:e.target.value}),className:`w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:i(`settings.enterUsername`),autoComplete:`username`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:[i(`users.form.email`)||`Email`,` `,Wn?.advanced_auth_enabled?(0,G.jsx)(`span`,{className:`text-red-700 dark:text-red-400`,children:`*`}):(0,G.jsxs)(`span`,{className:`text-bambu-gray font-normal`,children:[`(`,i(`users.form.optional`)||`optional`,`)`]})]}),(0,G.jsx)(`input`,{type:`email`,value:Pt.email,onChange:e=>Ft({...Pt,email:e.target.value}),className:`w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:i(`users.form.emailPlaceholder`)||`user@example.com`,required:Wn?.advanced_auth_enabled})]}),!Wn?.advanced_auth_enabled&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:[i(`users.form.password`)||`Password`,` `,(0,G.jsxs)(`span`,{className:`text-bambu-gray font-normal`,children:[`(`,i(`users.form.leaveBlankToKeep`)||`leave blank to keep current`,`)`]})]}),(0,G.jsx)(`input`,{type:`password`,value:Pt.password,onChange:e=>Ft({...Pt,password:e.target.value,confirmPassword:``}),className:`w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:i(`settings.enterNewPassword`),autoComplete:`new-password`,minLength:8}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-xs mt-1`,children:i(`settings.passwordRequirements`)})]}),Pt.password&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:i(`settings.confirmPassword`)}),(0,G.jsx)(`input`,{type:`password`,value:Pt.confirmPassword,onChange:e=>Ft({...Pt,confirmPassword:e.target.value}),className:`w-full px-4 py-3 bg-bambu-dark-secondary border rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors ${Pt.confirmPassword&&Pt.password!==Pt.confirmPassword?`border-red-500`:`border-bambu-dark-tertiary`}`,placeholder:i(`settings.confirmNewPassword`),autoComplete:`new-password`,minLength:6}),Pt.confirmPassword&&Pt.password!==Pt.confirmPassword&&(0,G.jsx)(`p`,{className:`text-red-700 dark:text-red-400 text-xs mt-1`,children:i(`settings.passwordsDoNotMatch`)})]})]}),Wn?.advanced_auth_enabled&&(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary/50 border border-bambu-green/20 rounded-lg p-3 space-y-3`,children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`users.form.passwordManagedByAdvancedAuth`)||`Password is managed by Advanced Authentication. Use "Reset Password" to send a new password to the user via email.`}),(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:()=>Et&&nr.mutate(Et),disabled:nr.isPending||!Pt.email,className:`w-full`,children:nr.isPending?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),i(`users.form.resettingPassword`)||`Resetting Password...`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Rl,{className:`w-4 h-4`}),i(`users.form.resetPassword`)||`Reset Password`]})})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:i(`users.form.groups`)||`Groups`}),(0,G.jsx)(`div`,{className:`space-y-2 max-h-40 overflow-y-auto p-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg`,children:Xn.map(e=>(0,G.jsxs)(`label`,{className:`flex items-center gap-3 px-2 py-1.5 rounded hover:bg-bambu-dark-tertiary cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:Pt.group_ids.includes(e.id),onChange:()=>cr(e.id),className:`w-4 h-4 rounded border-bambu-gray text-bambu-green focus:ring-bambu-green focus:ring-offset-0 bg-bambu-dark`}),(0,G.jsx)(`span`,{className:`text-sm text-white`,children:e.name}),e.is_system&&(0,G.jsxs)(`span`,{className:`text-xs text-yellow-700 dark:text-yellow-400`,children:[`(`,i(`users.system`)||`System`,`)`]})]},e.id))})]})]}),(0,G.jsxs)(`div`,{className:`mt-6 flex justify-end gap-3`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>{Tt(!1),Dt(null),Ft({username:``,password:``,email:``,confirmPassword:``,role:`user`,group_ids:[]})},children:i(`users.modal.cancel`)||`Cancel`}),(0,G.jsx)(Q,{onClick:()=>or(Et),disabled:er.isPending||!Pt.username||Wn?.advanced_auth_enabled&&!Pt.email||!!(!Wn?.advanced_auth_enabled&&Pt.password&&(Pt.password!==Pt.confirmPassword||f6(Pt.password)!==null)),children:er.isPending?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),i(`users.modal.saving`)||`Saving...`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Vl,{className:`w-4 h-4`}),i(`users.modal.saveChanges`)||`Save Changes`]})})]})]})]})}),Ot!==null&&(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/80 flex items-center justify-center z-50 p-4`,onClick:()=>{kt(null),jt(null)},children:(0,G.jsxs)(zd,{className:`w-full max-w-md`,onClick:e=>e.stopPropagation(),children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-red-700 dark:text-red-400`,children:[(0,G.jsx)(ju,{className:`w-5 h-5`}),(0,G.jsx)(`h3`,{className:`text-lg font-semibold`,children:i(`settings.deleteUserTitle`)})]})}),(0,G.jsx)(Vd,{className:`space-y-3`,children:Mt?(0,G.jsx)(`div`,{className:`flex items-center justify-center py-4`,children:(0,G.jsx)(`div`,{className:`animate-spin rounded-full h-6 w-6 border-2 border-bambu-green border-t-transparent`})}):At&&At.archives+At.queue_items+At.library_files>0?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.userHasCreated`)}),(0,G.jsxs)(`ul`,{className:`list-disc list-inside text-bambu-gray space-y-1`,children:[At.archives>0&&(0,G.jsxs)(`li`,{children:[At.archives,` archive`,At.archives===1?``:`s`]}),At.queue_items>0&&(0,G.jsxs)(`li`,{children:[At.queue_items,` queue item`,At.queue_items===1?``:`s`]}),At.library_files>0&&(0,G.jsxs)(`li`,{children:[At.library_files,` library file`,At.library_files===1?``:`s`]})]}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-sm`,children:i(`settings.userItemsQuestion`)}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(Q,{variant:`danger`,onClick:()=>tr.mutate({id:Ot,deleteItems:!0}),disabled:tr.isPending,className:`justify-center`,children:i(`settings.deleteUserAndItems`)}),(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>tr.mutate({id:Ot,deleteItems:!1}),disabled:tr.isPending,className:`justify-center`,children:i(`settings.deleteUserKeepItems`)}),(0,G.jsx)(Q,{variant:`ghost`,onClick:()=>{kt(null),jt(null)},disabled:tr.isPending,className:`justify-center`,children:i(`common.cancel`)})]})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`text-white`,children:i(`settings.deleteUserConfirm`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-sm`,children:i(`settings.actionCannotBeUndone`)}),(0,G.jsxs)(`div`,{className:`flex gap-2 justify-end`,children:[(0,G.jsx)(Q,{variant:`ghost`,onClick:()=>{kt(null),jt(null)},disabled:tr.isPending,children:i(`common.cancel`)}),(0,G.jsx)(Q,{variant:`danger`,onClick:()=>tr.mutate({id:Ot,deleteItems:!1}),disabled:tr.isPending,children:i(`settings.deleteUserTitle`)})]})]})})]})}),It!==null&&(0,G.jsx)(af,{title:i(`settings.deleteGroupTitle`),message:i(`settings.deleteGroupMessage`),confirmText:i(`settings.deleteGroup`),variant:`danger`,onConfirm:()=>{ir.mutate(It),Lt(null)},onCancel:()=>Lt(null)}),Ne===`failure-detection`&&(0,G.jsx)(`div`,{id:`card-failure-detection`,children:(0,G.jsx)(yKe,{})}),Ne===`backup`&&(0,G.jsxs)(`div`,{id:`card-backup`,children:[(0,G.jsxs)(`div`,{className:`mb-4 p-3 bg-amber-50 dark:bg-amber-500/10 border border-amber-300 dark:border-amber-500/30 rounded-lg flex items-start gap-2`,children:[(0,G.jsx)(tu,{className:`text-amber-600 dark:text-amber-400 flex-shrink-0 mt-0.5`,size:16}),(0,G.jsx)(`p`,{className:`text-sm text-amber-700 dark:text-amber-400`,children:i(`backup.includesEncryptionKey`)})]}),(0,G.jsx)(vKe,{})]}),lt&&(0,G.jsx)(af,{title:i(`settings.disableAuthenticationTitle`),message:i(`settings.disableAuthenticationMessage`),confirmText:i(`settings.disableAuthentication`),variant:`danger`,onConfirm:async()=>{try{await Z.disableAuth(),o(i(`settings.toast.authDisabled`),`success`),await u(),ut(!1),window.location.href=`/`}catch(e){o(e instanceof Error?e.message:i(`settings.toast.authDisableFailed`),`error`)}},onCancel:()=>ut(!1)}),dt&&(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,onClick:()=>{ft(!1),mt({currentPassword:``,newPassword:``,confirmPassword:``})},children:(0,G.jsxs)(zd,{className:`w-full max-w-md`,onClick:e=>e.stopPropagation(),children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Bc,{className:`w-5 h-5 text-bambu-green`}),(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:i(`settings.changePassword`)})]}),(0,G.jsx)(Q,{variant:`ghost`,size:`sm`,onClick:()=>{ft(!1),mt({currentPassword:``,newPassword:``,confirmPassword:``})},children:(0,G.jsx)($u,{className:`w-5 h-5`})})]})}),(0,G.jsxs)(Vd,{children:[(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:`Current Password`}),(0,G.jsx)(`input`,{type:`password`,value:pt.currentPassword,onChange:e=>mt({...pt,currentPassword:e.target.value}),className:`w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:i(`settings.enterCurrentPassword`),autoComplete:`current-password`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:`New Password`}),(0,G.jsx)(`input`,{type:`password`,value:pt.newPassword,onChange:e=>mt({...pt,newPassword:e.target.value}),className:`w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:i(`settings.enterNewPasswordMin6`),autoComplete:`new-password`,minLength:6})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:`Confirm New Password`}),(0,G.jsx)(`input`,{type:`password`,value:pt.confirmPassword,onChange:e=>mt({...pt,confirmPassword:e.target.value}),className:`w-full px-4 py-3 bg-bambu-dark-secondary border rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors ${pt.confirmPassword&&pt.newPassword!==pt.confirmPassword?`border-red-500`:`border-bambu-dark-tertiary`}`,placeholder:i(`settings.confirmNewPassword`),autoComplete:`new-password`,minLength:6}),pt.confirmPassword&&pt.newPassword!==pt.confirmPassword&&(0,G.jsx)(`p`,{className:`text-red-700 dark:text-red-400 text-xs mt-1`,children:i(`settings.passwordsDoNotMatch`)})]})]}),(0,G.jsxs)(`div`,{className:`mt-6 flex justify-end gap-3`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>{ft(!1),mt({currentPassword:``,newPassword:``,confirmPassword:``})},children:i(`common.cancel`)}),(0,G.jsx)(Q,{onClick:async()=>{if(pt.newPassword!==pt.confirmPassword){o(i(`settings.toast.passwordsDoNotMatch`),`error`);return}if(pt.newPassword.length<6){o(i(`settings.toast.passwordTooShort`),`error`);return}gt(!0);try{await Z.changePassword(pt.currentPassword,pt.newPassword),o(i(`settings.toast.passwordChanged`),`success`),ft(!1),mt({currentPassword:``,newPassword:``,confirmPassword:``})}catch(e){o(e instanceof Error?e.message:`Failed to change password`,`error`)}finally{gt(!1)}},disabled:ht||!pt.currentPassword||!pt.newPassword||pt.newPassword!==pt.confirmPassword||pt.newPassword.length<6,children:ht?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),i(`settings.changing`)]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Bc,{className:`w-4 h-4`}),i(`settings.changePassword`)]})})]})]})]})})]})]})]})})}var HKe=/\[(aborted|failed|cancelled):\s*([^\]]*)\]/i;function UKe(e){if(!e)return{isPartial:!1,partialType:null,cleanedDescription:null};let t=e.match(HKe);if(!t)return{isPartial:!1,partialType:null,cleanedDescription:e};let n=e.replace(t[0],``).trim();return{isPartial:!0,partialType:t[1].toLowerCase(),cleanedDescription:n||null}}function WKe(e,t){if(!e)return`-`;let n=$f(e);return n?n.toLocaleString(t):e}function J8(e){let t=e.trim();if(!t)return null;let n=Number.parseFloat(t);return Number.isFinite(n)?n:null}function Y8(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}T${String(e.getHours()).padStart(2,`0`)}:${String(e.getMinutes()).padStart(2,`0`)}`}var X8=`w-full px-3 py-2 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded text-white placeholder-bambu-gray focus:outline-none focus:ring-1 focus:ring-bambu-green`,Z8=`block text-sm font-medium text-white mb-1`,Q8=`px-4 py-3 text-left text-bambu-gray font-medium`,$8=`px-4 py-3 align-top text-white`;function e5({title:e,onClose:t,children:n,size:r=`md`}){let{t:i}=U();return(0,G.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4`,children:(0,G.jsxs)(`div`,{className:`w-full ${r===`sm`?`max-w-xl`:r===`lg`?`max-w-6xl`:`max-w-4xl`} overflow-hidden rounded-lg border border-bambu-dark-tertiary bg-bambu-dark-secondary`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between border-b border-bambu-dark-tertiary px-4 py-3`,children:[(0,G.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:e}),(0,G.jsx)(Q,{size:`sm`,variant:`secondary`,onClick:t,children:i(`common.close`,`Close`)})]}),(0,G.jsx)(`div`,{className:`max-h-[75vh] overflow-auto p-4`,children:n})]})})}function GKe(){let{t:e,i18n:t}=U(),{hasPermission:n,user:r}=Nd(),{showToast:i}=qd(),a=no(),o=n(`cost_centers:read_own`),s=n(`cost_centers:read_all`),c=n(`cost_centers:create`),l=n(`cost_centers:modify`),u=n(`cost_centers:modify`),d=n(`cost_centers:modify`),p=n(`cost_centers:modify`),m=n(`users:read_slim`)||n(`users:read`),h=s||c||l||u||d||p,g=o||h,_=g,[v,y]=(0,f.useState)(``),[b,x]=(0,f.useState)(`monthly`),[S,C]=(0,f.useState)(``),[w,T]=(0,f.useState)(null),[E,D]=(0,f.useState)(`deposit`),[O,k]=(0,f.useState)(``),[A,j]=(0,f.useState)(``),[M,N]=(0,f.useState)(null),[P,F]=(0,f.useState)(null),[I,L]=(0,f.useState)(null),[R,z]=(0,f.useState)(!0),[B,V]=(0,f.useState)(0),[ee,te]=(0,f.useState)(`all`),[ne,re]=(0,f.useState)(`all`),[ie,ae]=(0,f.useState)(!1),[oe,se]=(0,f.useState)(!1),[H,ce]=(0,f.useState)(!1),[le,ue]=(0,f.useState)(!1),[de,fe]=(0,f.useState)(`personal`),[pe,me]=(0,f.useState)(null),[he,ge]=(0,f.useState)(``),[_e,ve]=(0,f.useState)(`monthly`),[ye,be]=(0,f.useState)(``),[xe,Se]=(0,f.useState)(!1),[Ce,we]=(0,f.useState)(null),[Te,Ee]=(0,f.useState)(null),[De,Oe]=(0,f.useState)(null),[ke,Ae]=(0,f.useState)(``),[je,Me]=(0,f.useState)(``),[Ne,Pe]=(0,f.useState)(!1),[Fe,Ie]=(0,f.useState)(null),[Le,Re]=(0,f.useState)(null),[ze,Be]=(0,f.useState)(``),[Ve,He]=(0,f.useState)(``),[Ue,We]=(0,f.useState)(Y8(new Date)),[Ge,Ke]=(0,f.useState)(null),[qe,Je]=(0,f.useState)(null),Ye=s||c||l||u||p&&m||d&&m;(0,f.useEffect)(()=>{Ye||fe(`personal`)},[Ye]);let{data:Xe,isLoading:Ze}=K({queryKey:[`finance`,`me`,`balance`],queryFn:Z.getMyBalance,enabled:o}),{data:Qe}=K({queryKey:[`ui-flags`],queryFn:Z.getUiFlags}),{data:$e,isLoading:et}=K({queryKey:[`finance`,`me`,`transactions`,50,B],queryFn:()=>Z.getMyTransactions(50,B),enabled:o}),{data:tt,isLoading:nt}=K({queryKey:[`finance`,`transactions`,50,B],queryFn:()=>Z.getAllTransactions(50,B),enabled:de===`admin`&&s}),{data:rt,isLoading:it}=K({queryKey:[`finance`,`cost-centers`,de],queryFn:()=>de===`admin`&&h?Z.listCostCenters(!0):Z.getMyCostCenters(),enabled:_}),{data:at}=K({queryKey:[`users`,`slim`],queryFn:Z.getUsersSlim,enabled:m&&(_||p||d)}),{data:ot}=K({queryKey:[`finance`,`cost-center`,P],queryFn:()=>Z.getCostCenter(P),enabled:d&&P!=null});(0,f.useEffect)(()=>{!at||at.length===0||w!=null&&at.some(e=>e.id===w)||T(at[0].id)},[at,w]),(0,f.useEffect)(()=>{if(!d)return;let e=(rt||[]).filter(e=>!e.is_private);if(e.length===0){F(null);return}P!=null&&e.some(e=>e.id===P)||F(e[0].id)},[d,rt,P]),(0,f.useEffect)(()=>{if(!d||!at||at.length===0)return;let e=new Set((ot?.members||[]).map(e=>e.user_id)),t=at.find(t=>!e.has(t.id));L(t?t.id:null)},[d,at,ot]),(0,f.useEffect)(()=>{if(!le)return;let e=rt||[];if(e.length===0){me(null);return}pe!=null&&e.some(e=>e.id===pe)||me(e[0].id)},[le,pe,rt]),(0,f.useEffect)(()=>{if(!le||pe==null)return;let e=(rt||[]).find(e=>e.id===pe);if(e){if(ge(e.name),e.budget_mode===`total`){ve(`total`),be(e.total_budget==null?``:String(e.total_budget));return}ve(`monthly`),be(e.monthly_budget==null?``:String(e.monthly_budget))}},[le,pe,rt]);let st=q({mutationFn:()=>Z.createCostCenter({name:v.trim(),total_budget:b===`total`?J8(S):null,monthly_budget:b===`monthly`?J8(S):null,is_active:!0}),onSuccess:()=>{a.invalidateQueries({queryKey:[`finance`]}),y(``),C(``),i(e(`finance.createdCostCenter`,`Cost center created`))},onError:t=>{i(t.message||e(`finance.createCostCenterFailed`,`Failed to create cost center`),`error`)}}),ct=q({mutationFn:({costCenterId:e,value:t,mode:n})=>Z.updateCostCenterBudgets(e,{total_budget:n===`total`?J8(t):null,monthly_budget:n===`monthly`?J8(t):null})}),lt=q({mutationFn:({costCenterId:e,name:t})=>Z.updateCostCenter(e,{name:t})}),ut=q({mutationFn:e=>Z.deleteCostCenter(e)}),dt=q({mutationFn:e=>Z.deleteTransaction(e),onSuccess:()=>{a.invalidateQueries({queryKey:[`finance`]}),i(e(`finance.transactionDeleted`,`Transaction deleted`))},onError:t=>{i(t.message||e(`finance.deleteTransactionFailed`,`Failed to delete transaction`),`error`)}}),ft=q({mutationFn:e=>Z.editTransaction(e.transactionId,e.data),onSuccess:()=>{a.invalidateQueries({queryKey:[`finance`]}),i(e(`finance.transactionEdited`,`Transaction updated and ledger recalculated`)),Se(!1)},onError:t=>{i(t.message||e(`finance.editTransactionFailed`,`Failed to edit transaction`),`error`)}}),pt=q({mutationFn:e=>Z.createManualPrint(e),onSuccess:()=>{a.invalidateQueries({queryKey:[`finance`]}),i(e(`finance.manualPrintCreated`,`Manual print charge added and ledger recalculated`)),Pe(!1),Ie(null),Re(null),Be(``),He(``),We(Y8(new Date))},onError:t=>{i(t.message||e(`finance.manualPrintFailed`,`Failed to create manual print`),`error`)}}),mt=q({mutationFn:e=>Z.depositUserBalance(e.userId,{amount:e.amount,description:e.description,cost_center_id:e.costCenterId??null})}),ht=q({mutationFn:e=>Z.withdrawUserBalance(e.userId,{amount:e.amount,description:e.description,cost_center_id:e.costCenterId??null})}),gt=q({mutationFn:e=>Z.upsertCostCenterMember(e.costCenterId,{user_id:e.userId,can_print:e.canPrint}),onSuccess:()=>{a.invalidateQueries({queryKey:[`finance`]}),i(e(`finance.memberSaved`,`Member saved`))},onError:t=>{i(t.message||e(`finance.memberSaveFailed`,`Failed to save member`),`error`)}}),_t=q({mutationFn:e=>Z.removeCostCenterMember(e.costCenterId,e.userId),onSuccess:()=>{a.invalidateQueries({queryKey:[`finance`]}),i(e(`finance.memberRemoved`,`Member removed`))},onError:t=>{i(t.message||e(`finance.memberRemoveFailed`,`Failed to remove member`),`error`)}}),vt=mt.isPending||ht.isPending,yt=()=>{if(!v.trim()){i(e(`finance.costCenterNameRequired`,`Cost center name is required`),`error`);return}st.mutate()},bt=async()=>{if(pe==null){i(e(`finance.selectCostCenter`,`Please select a cost center`),`error`);return}let t=he.trim();if(!t){i(e(`finance.costCenterNameRequired`,`Cost center name is required`),`error`);return}try{l&&await lt.mutateAsync({costCenterId:pe,name:t}),u&&await ct.mutateAsync({costCenterId:pe,mode:_e,value:ye}),a.invalidateQueries({queryKey:[`finance`]}),i(e(`finance.costCenterUpdated`,`Cost center updated`)),ue(!1)}catch(t){i(t.message||e(`finance.costCenterUpdateFailed`,`Failed to update cost center`),`error`)}},xt=e=>{let t=(rt||[]).find(t=>t.id===e);t&&(me(t.id),ge(t.name),t.budget_mode===`total`?(ve(`total`),be(t.total_budget==null?``:String(t.total_budget))):(ve(`monthly`),be(t.monthly_budget==null?``:String(t.monthly_budget))),ue(!0))},St=async()=>{if(Ge)try{await ut.mutateAsync(Ge.id),a.invalidateQueries({queryKey:[`finance`]}),P===Ge.id&&F(null),i(e(`finance.costCenterDeleted`,`Cost center deleted`))}catch(t){i(t.message||e(`finance.costCenterDeleteFailed`,`Failed to delete cost center`),`error`)}finally{Ke(null)}},Ct=()=>{qe!=null&&dt.mutate(qe,{onSettled:()=>Je(null)})},wt=e=>{we(e.id),Ee(e.user_id),Oe(e.cost_center_id),Ae(String(e.amount)),Me(e.description||``),Se(!0)},Tt=async()=>{if(Ce==null)return;let t=ke?Number.parseFloat(ke):null;if(t!==null&&!Number.isFinite(t)){i(e(`finance.amountInvalid`,`Amount must be a valid number`),`error`);return}ft.mutate({transactionId:Ce,data:{user_id:Te||void 0,cost_center_id:De||void 0,amount:t??void 0,description:je||void 0}})},Et=async()=>{if(Fe==null){i(e(`finance.userRequired`,`Please select a user`),`error`);return}if(Le==null){i(e(`finance.costCenterRequired`,`Please select a cost center`),`error`);return}let t=ze?Number.parseFloat(ze):null;if(t===null||!Number.isFinite(t)){i(e(`finance.amountInvalid`,`Amount must be a valid number`),`error`);return}t=Math.abs(t),pt.mutate({user_id:Fe,cost_center_id:Le,amount:t,description:Ve||void 0,created_at:Ue?new Date(Ue).toISOString():void 0})},Dt=async()=>{if(w==null){i(e(`finance.userRequired`,`Please select a user`),`error`);return}let t=Number.parseFloat(O);if(!Number.isFinite(t)||t<=0){i(e(`finance.amountMustBePositive`,`Amount must be greater than zero`),`error`);return}let n={userId:w,amount:t,description:A.trim()||void 0,costCenterId:M};try{E===`deposit`?await mt.mutateAsync(n):await ht.mutateAsync(n),a.invalidateQueries({queryKey:[`finance`]}),k(``),j(``),i(E===`deposit`?e(`finance.depositSuccess`,`Deposit successful`):e(`finance.withdrawSuccess`,`Withdrawal successful`))}catch(t){i(t.message||e(`finance.adjustmentFailed`,`Wallet adjustment failed`),`error`)}},Ot=()=>{if(P==null){i(e(`finance.selectCostCenter`,`Please select a cost center`),`error`);return}if(I==null){i(e(`finance.noEligibleUsers`,`No eligible users available`),`error`);return}gt.mutate({costCenterId:P,userId:I,canPrint:R})},kt=e=>{P!=null&&_t.mutate({costCenterId:P,userId:e})},At=If(Qe?.currency||`USD`),jt=(0,f.useMemo)(()=>[...at||[]].sort((e,t)=>e.username.localeCompare(t.username)),[at]),Mt=(0,f.useMemo)(()=>{let e=new Map;for(let t of jt)e.set(t.id,t.username);return e},[jt]),Nt=(0,f.useMemo)(()=>{let e=new Set((ot?.members||[]).map(e=>e.user_id));return jt.filter(t=>!e.has(t.id))},[jt,ot]),Pt=de===`admin`&&s?tt:$e,Ft=de===`admin`&&s?nt:et,It=(0,f.useMemo)(()=>Pt?.items??[],[Pt?.items]),Lt=Pt?.total??0,Rt=Math.max(1,Math.ceil(Lt/50)),zt=(0,f.useMemo)(()=>It.filter(e=>!(ee!==`all`&&e.transaction_type!==ee||ne!==`all`&&e.cost_center_id!==ne)),[It,ee,ne]),Bt=Math.floor(B/50)+1,Vt=de===`admin`,Ht=t=>t===`deposit`?e(`finance.deposit`):t===`withdraw`?e(`finance.withdraw`):t===`print_charge`?e(`finance.printCharge`):t,Ut=t=>t==null?e(`finance.personal`,`Personal`):Mt.get(t)||(r?.id===t&&r.username?r.username:e(`finance.userWithId`,`User #{{id}}`,{id:t})),Wt=t=>t.budget_limit==null||t.budget_available==null?e(`finance.unlimited`,`Unlimited`):`${At}${t.budget_available.toFixed(2)}/${At}${t.budget_limit.toFixed(2)}`;return g?(0,G.jsxs)(`div`,{className:`p-4 md:p-8 space-y-8`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Gu,{className:`h-6 w-6 text-bambu-green`}),(0,G.jsx)(`h1`,{className:`text-2xl font-bold text-white`,children:e(`finance.title`,`Finance`)})]}),(0,G.jsx)(`p`,{className:`text-bambu-gray mt-2 max-w-2xl`,children:e(`finance.subtitle`,`Wallet, personal transactions, and cost centers`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1 max-w-2xl`,children:e(`finance.budgetPolicyHint`,`Account balances track costs. Printing is limited only by the selected cost center budget; without a budget, printing is unlimited.`)})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 lg:items-end`,children:[Ye&&(0,G.jsxs)(`div`,{className:`inline-flex overflow-hidden rounded border border-bambu-dark-tertiary`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>fe(`personal`),className:`px-3 py-1.5 text-sm ${de===`personal`?`bg-bambu-green text-black font-medium`:`bg-bambu-dark text-bambu-gray`}`,children:e(`finance.personalView`,`Personal view`)}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>fe(`admin`),className:`px-3 py-1.5 text-sm ${de===`admin`?`bg-bambu-green text-black font-medium`:`bg-bambu-dark text-bambu-gray`}`,children:e(`finance.adminView`,`Admin view`)})]}),de===`admin`&&Ye&&(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2 lg:justify-end`,children:[c&&(0,G.jsx)(Q,{size:`sm`,variant:`secondary`,onClick:()=>ae(!0),children:e(`finance.createCostCenter`,`Create cost center`)}),p&&m&&(0,G.jsx)(Q,{size:`sm`,variant:`secondary`,onClick:()=>se(!0),children:e(`finance.adjustWallet`,`Adjust wallet`)}),p&&m&&(0,G.jsx)(Q,{size:`sm`,variant:`secondary`,onClick:()=>Pe(!0),children:e(`finance.addManualPrint`,`Add manual print`)}),d&&m&&(0,G.jsx)(Q,{size:`sm`,variant:`secondary`,onClick:()=>ce(!0),children:e(`finance.manageMembers`,`Manage cost center members`)})]})]})]}),(0,G.jsxs)(`div`,{className:`grid gap-5 md:grid-cols-2 xl:grid-cols-3`,children:[(0,G.jsxs)(zd,{children:[(0,G.jsxs)(Bd,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e(`finance.currentBalance`,`Personal account balance`)}),(0,G.jsx)(Gu,{className:`w-4 h-4 text-bambu-green/90`})]}),(0,G.jsx)(Vd,{className:`pt-1`,children:(0,G.jsx)(`p`,{className:`text-3xl font-semibold text-white leading-tight`,children:Ze?e(`common.loading`,`Loading...`):`${At}${(Xe?.balance??0).toFixed(2)}`})})]}),(0,G.jsxs)(zd,{children:[(0,G.jsxs)(Bd,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:de===`admin`?e(`finance.transactions`,`Transactions`):e(`finance.personalTransactions`,`Personal transactions`)}),(0,G.jsx)(Cs,{className:`w-4 h-4 text-blue-400`})]}),(0,G.jsx)(Vd,{className:`pt-1`,children:(0,G.jsx)(`p`,{className:`text-3xl font-semibold text-white leading-tight`,children:Ft?`-`:Lt})})]}),(0,G.jsxs)(zd,{children:[(0,G.jsxs)(Bd,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e(`finance.costCenters`,`Cost centers`)}),(0,G.jsx)(Jo,{className:`w-4 h-4 text-orange-400`})]}),(0,G.jsx)(Vd,{className:`pt-1`,children:(0,G.jsx)(`p`,{className:`text-3xl font-semibold text-white leading-tight`,children:it?`-`:rt?.length??0})})]})]}),ie&&c&&(0,G.jsx)(e5,{title:e(`finance.createCostCenter`,`Create cost center`),size:`md`,onClose:()=>ae(!1),children:(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`finance.costCenterName`,`Name`)}),(0,G.jsx)(`input`,{type:`text`,value:v,onChange:e=>y(e.target.value),placeholder:e(`finance.costCenterName`,`Name`),className:X8})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`finance.budgetType`,`Budget type`)}),(0,G.jsxs)(`select`,{value:b,onChange:e=>x(e.target.value),className:X8,children:[(0,G.jsx)(`option`,{value:`monthly`,children:e(`finance.monthlyBudget`,`Monthly budget`)}),(0,G.jsx)(`option`,{value:`total`,children:e(`finance.totalBudget`,`Total budget`)})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:b===`monthly`?e(`finance.monthlyBudget`,`Monthly budget`):e(`finance.totalBudget`,`Total budget`)}),(0,G.jsx)(`input`,{type:`number`,step:`0.01`,value:S,onChange:e=>C(e.target.value),placeholder:`0.00`,className:X8})]})]}),(0,G.jsx)(Q,{className:`min-w-[180px]`,onClick:yt,disabled:st.isPending,children:st.isPending?e(`common.saving`,`Saving...`):e(`finance.create`,`Create`)})]})}),oe&&p&&m&&(0,G.jsx)(e5,{title:e(`finance.adjustWallet`,`Adjust wallet`),size:`md`,onClose:()=>se(!1),children:(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`finance.selectUser`,`Select user`)}),(0,G.jsx)(`select`,{value:w??``,onChange:e=>T(e.target.value?Number(e.target.value):null),className:X8,children:(jt||[]).map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.username},e.id))})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`finance.transactionType`,`Type`)}),(0,G.jsxs)(`select`,{value:E,onChange:e=>D(e.target.value),className:X8,children:[(0,G.jsx)(`option`,{value:`deposit`,children:e(`finance.deposit`,`Deposit`)}),(0,G.jsx)(`option`,{value:`withdraw`,children:e(`finance.withdraw`,`Withdraw`)})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`finance.amount`,`Amount`)}),(0,G.jsx)(`input`,{type:`number`,step:`0.01`,min:`0`,value:O,onChange:e=>k(e.target.value),placeholder:`0.00`,className:X8})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`finance.costCenters`,`Cost centers`)}),(0,G.jsxs)(`select`,{value:M??``,onChange:e=>N(e.target.value?Number(e.target.value):null),className:X8,children:[(0,G.jsx)(`option`,{value:``,children:e(`finance.noCostCenter`,`No cost center`)}),(rt||[]).map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`common.description`,`Description`)}),(0,G.jsx)(`input`,{type:`text`,value:A,onChange:e=>j(e.target.value),placeholder:e(`finance.descriptionOptional`,`Description (optional)`),className:X8})]}),(0,G.jsx)(Q,{className:`min-w-[180px]`,onClick:Dt,disabled:vt,children:vt?e(`common.saving`,`Saving...`):e(`finance.applyAdjustment`,`Apply adjustment`)})]})}),H&&d&&m&&(0,G.jsx)(e5,{title:e(`finance.manageMembers`,`Manage cost center members`),size:`lg`,onClose:()=>ce(!1),children:(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(`div`,{className:`grid gap-5 md:grid-cols-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`finance.costCenters`,`Cost centers`)}),(0,G.jsx)(`select`,{value:P??``,onChange:e=>F(e.target.value?Number(e.target.value):null),className:X8,children:(rt||[]).filter(e=>!e.is_private).map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`finance.selectUser`,`Select user`)}),(0,G.jsxs)(`select`,{value:I??``,onChange:e=>L(e.target.value?Number(e.target.value):null),className:X8,children:[(0,G.jsx)(`option`,{value:``,children:e(`finance.selectUser`,`Select user`)}),Nt.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.username},e.id))]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 rounded border border-bambu-dark-tertiary bg-bambu-dark-secondary px-3 py-2`,children:[(0,G.jsx)(`input`,{id:`memberCanPrint`,type:`checkbox`,checked:R,onChange:e=>z(e.target.checked),className:`rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green`}),(0,G.jsx)(`label`,{htmlFor:`memberCanPrint`,className:`text-sm text-bambu-gray`,children:e(`finance.memberCanPrint`,`Member can print`)})]}),(0,G.jsx)(`div`,{className:`flex items-end`,children:(0,G.jsx)(Q,{className:`min-w-[180px]`,onClick:Ot,disabled:gt.isPending||I==null,children:gt.isPending?e(`common.saving`,`Saving...`):e(`finance.addMember`,`Add member`)})})]}),(0,G.jsx)(`div`,{className:`overflow-auto rounded-lg border border-bambu-dark-tertiary`,children:(0,G.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary bg-bambu-dark text-bambu-gray`,children:[(0,G.jsx)(`th`,{className:Q8,children:e(`common.name`,`Name`)}),(0,G.jsx)(`th`,{className:Q8,children:e(`finance.canPrint`,`Can print`)}),(0,G.jsx)(`th`,{className:Q8,children:e(`common.actions`,`Actions`)})]})}),(0,G.jsxs)(`tbody`,{children:[(ot?.members||[]).map(t=>(0,G.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary/60 text-white`,children:[(0,G.jsx)(`td`,{className:$8,children:jt.find(e=>e.id===t.user_id)?.username||`User ${t.user_id}`}),(0,G.jsx)(`td`,{className:$8,children:t.can_print?e(`common.yes`,`Yes`):e(`common.no`,`No`)}),(0,G.jsx)(`td`,{className:$8,children:(0,G.jsx)(Q,{size:`sm`,variant:`danger`,onClick:()=>kt(t.user_id),disabled:_t.isPending,children:e(`common.remove`,`Remove`)})})]},t.id)),(ot?.members||[]).length===0&&(0,G.jsx)(`tr`,{children:(0,G.jsx)(`td`,{colSpan:3,className:`py-3 text-bambu-gray`,children:e(`finance.noMembers`,`No members assigned.`)})})]})]})})]})}),le&&(l||u)&&(0,G.jsx)(e5,{title:e(`finance.editCostCenter`,`Edit cost center`),size:`md`,onClose:()=>ue(!1),children:(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`finance.costCenterName`,`Name`)}),(0,G.jsx)(`input`,{type:`text`,value:he,onChange:e=>ge(e.target.value),placeholder:e(`finance.costCenterName`,`Name`),className:X8,disabled:!l})]}),(0,G.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`finance.budgetType`,`Budget type`)}),(0,G.jsxs)(`select`,{value:_e,onChange:e=>ve(e.target.value),className:X8,disabled:!u,children:[(0,G.jsx)(`option`,{value:`monthly`,children:e(`finance.monthlyBudget`,`Monthly budget`)}),(0,G.jsx)(`option`,{value:`total`,children:e(`finance.totalBudget`,`Total budget`)})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:_e===`monthly`?e(`finance.monthlyBudget`,`Monthly budget`):e(`finance.totalBudget`,`Total budget`)}),(0,G.jsx)(`input`,{type:`number`,step:`0.01`,value:ye,onChange:e=>be(e.target.value),placeholder:`0.00`,className:X8,disabled:!u})]})]}),(0,G.jsx)(Q,{className:`min-w-[180px]`,onClick:bt,disabled:lt.isPending||ct.isPending||pe==null,children:lt.isPending||ct.isPending?e(`common.saving`,`Saving...`):e(`common.save`,`Save`)})]})}),(0,G.jsxs)(`div`,{className:`grid gap-6 ${_&&o?`xl:grid-cols-2`:``}`,children:[_&&(0,G.jsxs)(zd,{children:[(0,G.jsxs)(Bd,{children:[(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:e(`finance.myCostCenters`,`My cost centers`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:e(`finance.costCentersHint`,`Review budget limits and keep costs under control`)})]}),(0,G.jsxs)(Vd,{className:`space-y-3`,children:[it&&(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`common.loading`,`Loading...`)}),!it&&(!rt||rt.length===0)&&(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`finance.noCostCenters`,`No cost centers found.`)}),!it&&rt&&rt.length>0&&(0,G.jsx)(`div`,{className:`overflow-auto rounded-lg border border-bambu-dark-tertiary`,children:(0,G.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary bg-bambu-dark text-bambu-gray`,children:[(0,G.jsx)(`th`,{className:Q8,children:e(`common.name`,`Name`)}),Vt&&(0,G.jsx)(`th`,{className:Q8,children:e(`finance.owner`,`Owner`)}),(0,G.jsx)(`th`,{className:Q8,children:e(`finance.balance`,`Account balance`)}),(0,G.jsx)(`th`,{className:Q8,children:e(`finance.budget`,`Budget`)}),Vt&&(0,G.jsx)(`th`,{className:Q8,children:e(`common.actions`,`Actions`)})]})}),(0,G.jsx)(`tbody`,{children:rt.map(t=>{let n=l||u,r=!t.is_private&&l;return(0,G.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary/60 text-white`,children:[(0,G.jsx)(`td`,{className:$8,children:t.name}),Vt&&(0,G.jsx)(`td`,{className:$8,children:t.is_private?Ut(t.owner_user_id):e(`finance.shared`,`Shared`)}),(0,G.jsxs)(`td`,{className:$8,children:[At,t.total_balance.toFixed(2)]}),(0,G.jsx)(`td`,{className:$8,children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,G.jsx)(`span`,{children:Wt(t)}),(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:t.budget_mode===`monthly`?e(`finance.monthlyBudget`,`Monthly budget`):t.budget_mode===`total`?e(`finance.totalBudget`,`Total budget`):e(`finance.noBudget`,`No budget`)})]})}),Vt&&(0,G.jsx)(`td`,{className:$8,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Q,{size:`sm`,variant:`ghost`,onClick:()=>xt(t.id),disabled:!n,title:n?e(`common.edit`,`Edit`):e(`finance.cannotEditPrivateCostCenter`,`Private cost centers cannot be edited here`),className:`p-1.5 sm:p-2`,children:(0,G.jsx)(wl,{className:`w-4 h-4`})}),r&&(0,G.jsx)(Q,{size:`sm`,variant:`ghost`,onClick:()=>Ke({id:t.id,name:t.name}),disabled:ut.isPending,title:e(`common.delete`,`Delete`),className:`text-red-400 hover:text-red-300 hover:bg-red-500/10 p-1.5 sm:p-2`,children:(0,G.jsx)(ju,{className:`w-4 h-4`})})]})})]},t.id)})})]})})]})]}),o&&(0,G.jsxs)(zd,{children:[(0,G.jsxs)(Bd,{children:[(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:e(`finance.recentTransactions`,`Recent transactions`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:e(`finance.transactionsHint`,`Filter by type and cost center, then navigate pages`)})]}),(0,G.jsxs)(Vd,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto] xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_auto] items-end`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`finance.transactionType`,`Type`)}),(0,G.jsxs)(`select`,{value:ee,onChange:e=>te(e.target.value),className:X8,children:[(0,G.jsx)(`option`,{value:`all`,children:e(`finance.allTypes`)}),(0,G.jsx)(`option`,{value:`deposit`,children:e(`finance.deposit`)}),(0,G.jsx)(`option`,{value:`withdraw`,children:e(`finance.withdraw`)}),(0,G.jsx)(`option`,{value:`print_charge`,children:e(`finance.printCharge`)})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`finance.costCenters`,`Cost centers`)}),(0,G.jsxs)(`select`,{value:ne,onChange:e=>re(e.target.value===`all`?`all`:Number(e.target.value)),className:X8,children:[(0,G.jsx)(`option`,{value:`all`,children:e(`finance.allCostCenters`)}),(rt||[]).map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]})]}),Ft&&(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`common.loading`,`Loading...`)}),!Ft&&(!It||It.length===0)&&(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`finance.noTransactions`,`No transactions available.`)}),!Ft&&It.length>0&&zt.length===0&&(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`finance.noTransactionsForFilter`,`No transactions match the selected filters.`)}),!Ft&&zt.length>0&&(0,G.jsx)(`div`,{className:`overflow-auto rounded-lg border border-bambu-dark-tertiary`,children:(0,G.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary bg-bambu-dark text-bambu-gray`,children:[(0,G.jsx)(`th`,{className:Q8,children:e(`common.date`,`Date`)}),Vt&&(0,G.jsx)(`th`,{className:Q8,children:e(`common.user`,`User`)}),(0,G.jsx)(`th`,{className:Q8,children:e(`finance.costCenter`,`Cost center`)}),(0,G.jsx)(`th`,{className:Q8,children:e(`finance.transactionType`,`Type`)}),(0,G.jsx)(`th`,{className:Q8,children:e(`common.description`,`Description`)}),(0,G.jsx)(`th`,{className:Q8,children:e(`finance.amount`,`Amount`)}),(0,G.jsx)(`th`,{className:Q8,children:e(`finance.balanceAfter`,`Balance after`)}),Vt&&(0,G.jsx)(`th`,{className:Q8,children:e(`common.actions`,`Actions`)})]})}),(0,G.jsx)(`tbody`,{children:zt.map(n=>{let r=n.amount>=0,i=n.cost_center_id==null?null:(rt||[]).find(e=>e.id===n.cost_center_id),a=Mt.get(n.user_id),o=n.transaction_type===`print_charge`?UKe(n.description??null):null,s=o?.isPartial??!1;return(0,G.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary/60 text-white`,children:[(0,G.jsx)(`td`,{className:$8,children:WKe(n.created_at,t.language)}),Vt&&(0,G.jsx)(`td`,{className:$8,children:a||e(`finance.userWithId`,`User #{{id}}`,{id:n.user_id})}),(0,G.jsx)(`td`,{className:$8,children:i?.name||`-`}),(0,G.jsx)(`td`,{className:$8,children:(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,G.jsx)(`span`,{children:Ht(n.transaction_type)}),s&&(0,G.jsx)(`span`,{className:`rounded border border-yellow-500/40 bg-yellow-500/10 px-2 py-0.5 text-[11px] text-yellow-300`,children:o&&o.partialType?e(`finance.partialStatus.${o.partialType}`,o.partialType):e(`finance.partial`,`Partial`)})]})}),(0,G.jsx)(`td`,{className:$8,children:(o?.cleanedDescription??n.description)||`-`}),(0,G.jsxs)(`td`,{className:`${$8} ${r?`text-green-400`:`text-red-400`}`,children:[r?`+`:`-`,At,Math.abs(n.amount).toFixed(2)]}),(0,G.jsx)(`td`,{className:$8,children:n.balance_after==null?`-`:`${n.balance_after<0?`-`:``}${At}${Math.abs(n.balance_after).toFixed(2)}`}),Vt&&(0,G.jsx)(`td`,{className:$8,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Q,{size:`sm`,variant:`secondary`,onClick:()=>wt(n),disabled:ft.isPending,children:(0,G.jsx)(wl,{className:`w-4 h-4`})}),(0,G.jsx)(Q,{size:`sm`,variant:`danger`,onClick:()=>Je(n.id),disabled:dt.isPending,children:(0,G.jsx)(ju,{className:`w-4 h-4`})})]})})]},n.id)})})]})}),!Ft&&zt.length>0&&(0,G.jsx)(`div`,{className:`flex justify-end pt-2 lg:pt-0`,children:(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>V(0),disabled:B===0||Ft,className:`p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,"aria-label":e(`finance.first`,`First`),children:(0,G.jsx)(us,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>V(e=>Math.max(0,e-50)),disabled:B===0||Ft,className:`p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,"aria-label":e(`finance.prev`,`Previous`),children:(0,G.jsx)(cs,{className:`w-4 h-4`})}),(0,G.jsx)(`span`,{className:`text-bambu-gray px-1 whitespace-nowrap`,children:e(`finance.pageNumberOf`,`Page {{page}} of {{total}}`,{page:Bt,total:Rt})}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>V(e=>e+50),disabled:Ft||Bt>=Rt,className:`p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,"aria-label":e(`finance.next`,`Next`),children:(0,G.jsx)(ss,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>V(Math.max(0,(Rt-1)*50)),disabled:Ft||Bt>=Rt,className:`p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,"aria-label":e(`finance.last`,`Last`),children:(0,G.jsx)(ds,{className:`w-4 h-4`})})]})})]})]}),xe&&Ce!==null&&(0,G.jsx)(e5,{title:e(`finance.editTransaction`,`Edit Transaction`),onClose:()=>Se(!1),size:`md`,children:(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`common.user`,`User`)}),(0,G.jsxs)(`select`,{className:X8,value:Te||``,onChange:e=>Ee(e.target.value?Number(e.target.value):null),children:[(0,G.jsx)(`option`,{value:``,children:e(`finance.selectUser`,`Select user...`)}),jt.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.username},e.id))]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`finance.costCenter`,`Cost center (optional)`)}),(0,G.jsxs)(`select`,{className:X8,value:De||``,onChange:e=>Oe(e.target.value?Number(e.target.value):null),children:[(0,G.jsx)(`option`,{value:``,children:e(`finance.noCostCenter`,`Personal (no cost center)`)}),(rt||[]).map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`finance.amount`,`Amount`)}),(0,G.jsx)(`input`,{type:`number`,step:`0.01`,className:X8,value:ke,onChange:e=>Ae(e.target.value),placeholder:e(`finance.amountExample`,`e.g., 10.50`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`common.description`,`Description`)}),(0,G.jsx)(`textarea`,{className:`${X8} resize-none`,rows:3,value:je,onChange:e=>Me(e.target.value),placeholder:e(`finance.manualAdjustmentExample`,`e.g., Manual adjustment`)})]}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-2 pt-4`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>Se(!1),children:e(`common.cancel`,`Cancel`)}),(0,G.jsx)(Q,{onClick:Tt,disabled:ft.isPending,children:e(`common.save`,`Save`)})]})]})}),Ne&&(0,G.jsx)(e5,{title:e(`finance.addManualPrint`,`Add manual print`),onClose:()=>Pe(!1),size:`md`,children:(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`common.user`,`User`)}),(0,G.jsxs)(`select`,{className:X8,value:Fe||``,onChange:e=>Ie(e.target.value?Number(e.target.value):null),children:[(0,G.jsx)(`option`,{value:``,children:e(`finance.selectUser`,`Select user...`)}),jt.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.username},e.id))]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`finance.costCenter`,`Cost center`)}),(0,G.jsxs)(`select`,{className:X8,value:Le||``,onChange:e=>Re(e.target.value?Number(e.target.value):null),children:[(0,G.jsx)(`option`,{value:``,children:e(`finance.selectCostCenter`,`Select cost center...`)}),(rt||[]).map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`finance.amount`,`Amount`)}),(0,G.jsx)(`input`,{type:`number`,step:`0.01`,className:X8,value:ze,onChange:e=>Be(e.target.value),placeholder:e(`finance.amountExample`,`e.g., 4.00`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`common.description`,`Description`)}),(0,G.jsx)(`input`,{type:`text`,value:Ve,onChange:e=>He(e.target.value),placeholder:e(`finance.descriptionOptional`,`Description (optional)`),className:X8})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:Z8,children:e(`common.date`,`Date`)}),(0,G.jsx)(`input`,{type:`datetime-local`,value:Ue,onChange:e=>We(e.target.value),className:X8})]}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-2 pt-4`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>Pe(!1),children:e(`common.cancel`,`Cancel`)}),(0,G.jsx)(Q,{onClick:Et,disabled:pt.isPending,children:pt.isPending?e(`common.saving`,`Saving...`):e(`finance.addManualPrint`,`Add manual print`)})]})]})}),Ge&&(0,G.jsx)(af,{title:e(`common.delete`,`Delete`),message:e(`finance.confirmDeleteCostCenter`,`Delete cost center "{{name}}"?`,{name:Ge.name}),confirmText:e(`common.delete`,`Delete`),variant:`danger`,isLoading:ut.isPending,onConfirm:St,onCancel:()=>Ke(null)}),qe!=null&&(0,G.jsx)(af,{title:e(`finance.deleteTransaction`,`Delete transaction`),message:e(`finance.deleteTransactionConfirm`,`Delete this transaction? Balances will be recalculated automatically.`),confirmText:e(`common.delete`,`Delete`),variant:`danger`,isLoading:dt.isPending,onConfirm:Ct,onCancel:()=>Je(null)})]})]}):(0,G.jsxs)(`div`,{className:`p-4 md:p-8 space-y-6`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Gu,{className:`h-6 w-6 text-bambu-green`}),(0,G.jsx)(`h1`,{className:`text-2xl font-bold text-white`,children:e(`finance.title`,`Finance`)})]}),(0,G.jsx)(`div`,{children:(0,G.jsx)(`p`,{className:`text-bambu-gray mt-2 max-w-2xl`,children:e(`finance.subtitle`,`Wallet, personal transactions, and cost centers`)})}),(0,G.jsx)(zd,{children:(0,G.jsx)(Vd,{className:`py-8 text-center text-bambu-gray`,children:e(`finance.noAccess`,`You do not have permission to view finance data.`)})})]})}var t5={PLA:`GFL99`,"PLA-CF":`GFL98`,"PLA SILK":`GFL96`,"PLA HIGH SPEED":`GFL95`,PETG:`GFG99`,"PETG HF":`GFG96`,"PETG-CF":`GFG98`,PCTG:`GFG97`,ABS:`GFB99`,ASA:`GFB98`,PC:`GFC99`,PA:`GFN99`,"PA-CF":`GFN98`,NYLON:`GFN99`,TPU:`GFU99`,PVA:`GFS99`,HIPS:`GFS98`,PE:`GFP99`,PP:`GFP97`};function n5(e){let t=(e||``).toUpperCase().trim();return t&&(t5[t]||t5[t.replace(/[-\s]?CF$/,``)]||t5[t.replace(/\+$/,``)]||t5[t.split(/[-\s]/)[0]])||``}function r5(e){let t=e.replace(/@.+$/,``).trim();return t.startsWith(`# `)?t.slice(2).trim():t}var i5={local:0,orca_cloud:1,cloud:2,builtin:3};function KKe(e){let{localPresets:t,orcaProfiles:n,cloudSettings:r,builtinFilaments:i}=e,a=[],o=e=>e.trim().toLowerCase(),s=new Set,c=new Set,l=new Set,u=(e,t,...n)=>{let r=n.filter(e=>!!e);if(r.some(e=>s.has(e)))return!1;let i=`${e}|${o(t)}`;return c.has(i)?!1:(r.forEach(e=>s.add(e)),c.add(i),l.add(o(t)),!0)};for(let e of t??[]){let t=r5(e.name),n=e.filament_type||mU(t).material;u(`local`,t)&&a.push({id:`local_${e.id}`,name:t,source:`local`,filamentId:n5(n),filamentType:n||``})}for(let e of n??[]){let t=r5(e.name),n=mU(t).material;u(`orca_cloud`,t,e.setting_id)&&a.push({id:`orca_${e.setting_id}`,name:t,source:`orca_cloud`,filamentId:n5(n),filamentType:n})}for(let e of r??[]){let t=r5(e.name),n=e.setting_id.startsWith(`GFS`)?SU(e.setting_id):``;u(`cloud`,t,e.setting_id,n||void 0)&&a.push({id:e.setting_id,name:t,source:`cloud`,filamentId:n,filamentType:mU(t).material})}for(let e of i??[]){let t=e.filament_id.startsWith(`GF`)?`GFS${e.filament_id.slice(2)}`:e.filament_id;l.has(o(e.name))||u(`builtin`,e.name,e.filament_id,t)&&a.push({id:`builtin_${e.filament_id}`,name:e.name,source:`builtin`,filamentId:e.filament_id,filamentType:mU(e.name).material})}return a.sort((e,t)=>e.source===t.source?e.name.localeCompare(t.name):i5[e.source]-i5[t.source])}async function qKe(e,t){if(e.filamentId)return e.filamentId;if(e.source!==`cloud`||!t)return``;try{return(await t(e.id)).filament_id||``}catch{return``}}var a5=e=>(Math.trunc(parseFloat(e)*1e3)/1e3).toFixed(3),o5=`HS00`,s5=`HH00`,c5=e=>{let t=e.match(/^([A-Z]{2}\d{2})/);return t?t[1]:o5},JKe=e=>c5(e)===s5?`HF`:`S`,l5=e=>{for(let t of[`High Flow_`,`High Flow `,`Standard_`,`Standard `,`HF_`,`HF `,`S_`,`S `])if(e.startsWith(t))return e.slice(t.length);let t=e.indexOf(`_`);return t>0?e.slice(t+1):e};function u5({profile:e,onEdit:t,onCopy:n,selectionMode:r,isSelected:i,onToggleSelect:a,note:o}){let s=JKe(e.nozzle_id),c=e.nozzle_diameter;return(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[r&&(0,G.jsx)(`button`,{onClick:a,className:`text-bambu-gray hover:text-white transition-colors p-1`,children:i?(0,G.jsx)(fu,{className:`w-4 h-4 text-bambu-green`}):(0,G.jsx)(mu,{className:`w-4 h-4`})}),(0,G.jsxs)(`button`,{onClick:()=>{r&&a?a():t()},className:`flex-1 text-left px-3 py-2 bg-bambu-dark rounded hover:bg-bambu-dark-tertiary transition-colors ${i?`ring-1 ring-bambu-green`:``}`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-bambu-green font-mono text-sm font-bold whitespace-nowrap`,children:a5(e.k_value)}),(0,G.jsx)(`span`,{className:`text-white text-sm truncate flex-1`,title:e.name,children:e.name||`Unnamed`}),o&&(0,G.jsx)(`span`,{title:`Has note`,children:(0,G.jsx)(_u,{className:`w-3 h-3 text-yellow-500`})}),(0,G.jsxs)(`span`,{className:`text-xs text-bambu-gray whitespace-nowrap`,children:[s,` `,c]})]}),o&&(0,G.jsxs)(`div`,{className:`text-xs mt-0.5 truncate text-yellow-500/70`,title:o,children:[`Note: `,o.length>50?o.substring(0,50)+`...`:o]})]}),!r&&n&&(0,G.jsx)(`button`,{onClick:e=>{e.stopPropagation(),n()},className:`text-bambu-gray hover:text-white transition-colors p-1`,title:`Copy profile`,children:(0,G.jsx)(Ps,{className:`w-4 h-4`})})]})}function d5({profile:e,printerId:t,nozzleDiameter:n,existingProfiles:r=[],builtinFilaments:i=[],filamentPresets:a=[],isDualNozzle:o=!1,supportsFlowType:s=!0,initialNote:c=``,initialNoteKey:l=null,onClose:u,onSave:d,onSaveNote:p,hasPermission:m}){let{t:h}=U(),{showToast:g}=qd(),[_,v]=(0,f.useState)(e?.name||``),[y,b]=(0,f.useState)(e?.k_value?a5(e.k_value):`0.020`),[x,S]=(0,f.useState)(e?.filament_id||``),[C,w]=(0,f.useState)(e?c5(e.nozzle_id):o5),[T,E]=(0,f.useState)(e?.nozzle_diameter||n),[D,O]=(0,f.useState)(e?[e.extruder_id]:o?[0,1]:[0]),[k,A]=(0,f.useState)(!1),[j,M]=(0,f.useState)({current:0,total:0}),[N,P]=(0,f.useState)(c),[F,I]=(0,f.useState)(``),{schedule:L}=DU(),R=f.useMemo(()=>e?.filament_id?i.find(t=>t.filament_id===e.filament_id)?.name||l5(r.find(t=>t.filament_id===e.filament_id)?.name||e.name||``)||e.filament_id:``,[e,r,i]),z=f.useMemo(()=>{let e=[[`local`,h(`kProfiles.modal.source.local`)],[`orca_cloud`,h(`kProfiles.modal.source.orcaCloud`)],[`cloud`,h(`kProfiles.modal.source.bambuCloud`)],[`builtin`,h(`kProfiles.modal.source.builtin`)]],t=F.trim().toLowerCase(),n=t?a.filter(e=>e.name.toLowerCase().includes(t)):a;return e.map(([e,t])=>({source:e,label:t,items:n.filter(t=>t.source===e)})).filter(e=>e.items.length>0)},[a,F,h]),B=q({mutationFn:e=>(console.log(`[KProfile] Calling API...`),Z.setKProfile(t,e)),onSuccess:(t,n)=>{if(console.log(`[KProfile] Save success:`,t),g(h(`kProfiles.toast.profileSaved`)),p&&N!==c){let t;t=N===``&&l?l:e&&e.slot_id>0?e.setting_id||`slot_${e.slot_id}_${e.filament_id}_${e.extruder_id}`:`name_${_}_${n.filament_id}`,p(t,N)}A(!0),L(()=>{A(!1),d()},2500)},onError:e=>{console.error(`[KProfile] Save error:`,e),g(e.message,`error`),A(!1)}}),V=q({mutationFn:e=>(console.log(`[KProfile] Deleting profile...`),Z.deleteKProfile(t,e)),onSuccess:e=>{console.log(`[KProfile] Delete success:`,e),g(h(`kProfiles.toast.profileDeleted`)),A(!0),L(()=>{A(!1),u()},4e3)},onError:e=>{console.error(`[KProfile] Delete error:`,e),g(e.message,`error`),A(!1)}}),[ee,te]=(0,f.useState)(!1),ne=()=>{e&&V.mutate({slot_id:e.slot_id,extruder_id:e.extruder_id,nozzle_id:e.nozzle_id,nozzle_diameter:e.nozzle_diameter,filament_id:e.filament_id,setting_id:e.setting_id})};return(0,G.jsxs)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,children:[(0,G.jsxs)(zd,{className:`w-full max-w-md relative`,children:[k&&(0,G.jsxs)(`div`,{className:`absolute inset-0 bg-bambu-dark-secondary/90 flex flex-col items-center justify-center z-10 rounded-lg`,children:[(0,G.jsx)(Y,{className:`w-8 h-8 text-bambu-green animate-spin mb-3`}),(0,G.jsx)(`p`,{className:`text-white font-medium`,children:j.total>1?h(`kProfiles.modal.savingExtruder`,{current:j.current,total:j.total}):h(`kProfiles.modal.syncing`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-sm mt-1`,children:h(`kProfiles.modal.pleaseWait`)})]}),(0,G.jsxs)(Vd,{className:`p-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-bambu-dark-tertiary`,children:[(0,G.jsx)(`h2`,{className:`text-xl font-semibold text-white`,children:h(e?`kProfiles.modal.editTitle`:`kProfiles.modal.addTitle`)}),(0,G.jsx)(`button`,{onClick:u,className:`text-bambu-gray hover:text-white transition-colors`,disabled:k,children:(0,G.jsx)($u,{className:`w-5 h-5`})})]}),(0,G.jsxs)(`form`,{onSubmit:async n=>{if(n.preventDefault(),o&&!e&&D.length===0){g(h(`kProfiles.toast.selectAtLeastOneExtruder`),`error`);return}let r=parseFloat(y).toFixed(6),i=`${C}-${T}`,s=e&&e.nozzle_id||i,c=e?e.nozzle_diameter:T,l=e?.filament_id||``;if(!e){let e=a.find(e=>e.id===x);if(!e){g(h(`kProfiles.toast.selectFilament`),`error`);return}if(l=await qKe(e,Z.getCloudSettingDetail),!l){g(h(`kProfiles.toast.filamentNotResolvable`,{name:e.name}),`error`);return}}if(e||D.length===1){let t={name:_,k_value:r,filament_id:l,nozzle_id:s,nozzle_diameter:c,extruder_id:e?e.extruder_id:D[0],setting_id:e?.setting_id,slot_id:e?.slot_id??0};console.log(`[KProfile] Saving profile:`,t),B.mutate(t);return}A(!0),M({current:1,total:D.length});let u=D.map(e=>({name:_,k_value:r,filament_id:l,nozzle_id:i,nozzle_diameter:T,extruder_id:e,setting_id:void 0,slot_id:0}));console.log(`[KProfile] Saving ${u.length} profiles in batch:`,u);try{await Z.setKProfilesBatch(t,u),g(h(`kProfiles.toast.profilesSaved`,{count:D.length})),p&&N&&p(`name_${_}_${l}`,N)}catch(e){console.error(`[KProfile] Failed to save batch:`,e),g(h(`kProfiles.toast.failedToSaveBatch`),`error`),A(!1),M({current:0,total:0});return}M({current:D.length,total:D.length}),L(()=>{A(!1),M({current:0,total:0}),d()},3e3)},className:`p-4 space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:h(`kProfiles.modal.profileName`)}),(0,G.jsx)(`input`,{type:`text`,value:_,onChange:e=>v(e.target.value),disabled:!!e,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none ${e?`opacity-60 cursor-not-allowed`:``}`,placeholder:h(`kProfiles.modal.profileNamePlaceholder`),required:!e})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:h(`kProfiles.modal.kValue`)}),(0,G.jsx)(`input`,{type:`text`,inputMode:`decimal`,value:y,onChange:e=>{let t=e.target.value;(t===``||/^\d*\.?\d*$/.test(t))&&b(t)},onBlur:e=>{let t=parseFloat(e.target.value);isNaN(t)||b((Math.trunc(t*1e3)/1e3).toFixed(3))},className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none font-mono`,placeholder:h(`kProfiles.modal.kValuePlaceholder`),required:!0}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:h(`kProfiles.modal.kValueHelp`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:h(`kProfiles.modal.filament`)}),e?(0,G.jsx)(`div`,{className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white opacity-60`,children:R||e.filament_id}):(0,G.jsxs)(`div`,{className:`border border-bambu-dark-tertiary rounded-lg overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`relative border-b border-bambu-dark-tertiary`,children:[(0,G.jsx)(Kl,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray`}),(0,G.jsx)(`input`,{type:`text`,value:F,onChange:e=>I(e.target.value),placeholder:h(`kProfiles.modal.searchFilaments`),className:`w-full pl-10 pr-3 py-2 bg-bambu-dark text-white placeholder-bambu-gray focus:outline-none`})]}),(0,G.jsx)(`div`,{className:`max-h-56 overflow-y-auto bg-bambu-dark`,children:z.length===0?(0,G.jsx)(`p`,{className:`px-3 py-3 text-xs text-bambu-gray`,children:a.length===0?h(`kProfiles.modal.noFilamentsHelp`):h(`kProfiles.modal.noFilamentMatches`)}):z.map(e=>(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`sticky top-0 z-10 flex items-center gap-2 px-3 py-1.5 bg-bambu-dark-secondary border-y border-bambu-dark-tertiary`,children:[(0,G.jsx)(`span`,{className:`text-xs font-bold uppercase tracking-wider text-bambu-green`,children:e.label}),(0,G.jsx)(`span`,{className:`text-[10px] text-bambu-gray`,children:e.items.length})]}),e.items.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>{S(e.id),_||v(`${C===s5?`HF`:`S`} ${e.name}`)},className:`w-full text-left px-3 py-1.5 text-sm transition-colors ${x===e.id?`bg-bambu-green/20 text-white`:`text-white hover:bg-bambu-dark-tertiary`}`,children:e.name},e.id))]},e.source))})]})]}),(0,G.jsxs)(`div`,{className:s?`grid grid-cols-2 gap-4`:``,children:[(0,G.jsxs)(`div`,{className:s?``:`hidden`,children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:h(`kProfiles.modal.flowType`)}),(0,G.jsxs)(`select`,{value:C,onChange:t=>{let n=t.target.value;if(w(n),!e&&x&&!_){let e=a.find(e=>e.id===x);e&&v(`${n===s5?`HF`:`S`} ${e.name}`)}},disabled:!!e,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none ${e?`opacity-60 cursor-not-allowed`:``}`,children:[(0,G.jsx)(`option`,{value:s5,children:h(`kProfiles.modal.highFlow`)}),(0,G.jsx)(`option`,{value:o5,children:h(`kProfiles.modal.standard`)})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:h(`kProfiles.modal.nozzleSize`)}),(0,G.jsxs)(`select`,{value:T,onChange:e=>E(e.target.value),disabled:!!e,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none ${e?`opacity-60 cursor-not-allowed`:``}`,children:[(0,G.jsx)(`option`,{value:`0.2`,children:`0.2mm`}),(0,G.jsx)(`option`,{value:`0.4`,children:`0.4mm`}),(0,G.jsx)(`option`,{value:`0.6`,children:`0.6mm`}),(0,G.jsx)(`option`,{value:`0.8`,children:`0.8mm`})]})]})]}),o&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:h(e?`kProfiles.modal.extruder`:`kProfiles.modal.extruders`)}),e?(0,G.jsx)(`div`,{className:`px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white opacity-60`,children:e.extruder_id===1?h(`kProfiles.modal.left`):h(`kProfiles.modal.right`)}):(0,G.jsxs)(`div`,{className:`flex gap-4`,children:[(0,G.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:D.includes(1),onChange:e=>{e.target.checked?O([...D,1]):O(D.filter(e=>e!==1))},className:`w-4 h-4 rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green focus:ring-offset-0 accent-bambu-green`}),(0,G.jsx)(`span`,{className:`text-white`,children:h(`kProfiles.modal.left`)})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:D.includes(0),onChange:e=>{e.target.checked?O([...D,0]):O(D.filter(e=>e!==0))},className:`w-4 h-4 rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green focus:ring-offset-0 accent-bambu-green`}),(0,G.jsx)(`span`,{className:`text-white`,children:h(`kProfiles.modal.right`)})]})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:h(`kProfiles.modal.notes`)}),(0,G.jsx)(`textarea`,{value:N,onChange:e=>P(e.target.value),placeholder:h(`kProfiles.modal.notesPlaceholder`),rows:2,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none resize-none`}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:h(`kProfiles.modal.notesHelp`)})]}),(0,G.jsxs)(`div`,{className:`flex gap-2 pt-4`,children:[e&&(0,G.jsx)(Q,{type:`button`,variant:`secondary`,onClick:()=>te(!0),disabled:V.isPending||k||!m(`kprofiles:delete`),title:m(`kprofiles:delete`)?void 0:h(`kProfiles.permission.noDelete`),className:`text-red-500 hover:bg-red-500/10`,children:V.isPending?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(ju,{className:`w-4 h-4`})}),(0,G.jsx)(Q,{type:`button`,variant:`secondary`,onClick:u,disabled:k,className:`flex-1`,children:h(`common.cancel`)}),(0,G.jsxs)(Q,{type:`submit`,disabled:B.isPending||k||!m(e?`kprofiles:update`:`kprofiles:create`),title:m(e?`kprofiles:update`:`kprofiles:create`)?void 0:h(e?`kProfiles.permission.noUpdate`:`kProfiles.permission.noCreate`),className:`flex-1`,children:[B.isPending?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(vc,{className:`w-4 h-4`}),h(`common.save`)]})]})]})]})]}),ee&&(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-[60]`,children:(0,G.jsx)(zd,{className:`w-full max-w-sm`,children:(0,G.jsxs)(Vd,{className:`p-6`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 mb-4`,children:[(0,G.jsx)(`div`,{className:`w-10 h-10 rounded-full bg-red-500/20 flex items-center justify-center`,children:(0,G.jsx)(ju,{className:`w-5 h-5 text-red-500`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:h(`kProfiles.deleteConfirm.title`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:h(`kProfiles.deleteConfirm.cannotUndo`)})]})]}),(0,G.jsx)(`p`,{className:`text-bambu-gray mb-6`,children:h(`kProfiles.deleteConfirm.message`,{name:e?.name})}),(0,G.jsxs)(`div`,{className:`flex gap-3`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>te(!1),className:`flex-1`,children:h(`common.cancel`)}),(0,G.jsxs)(Q,{onClick:()=>{te(!1),ne()},disabled:V.isPending,className:`flex-1 bg-red-500 hover:bg-red-600 text-white`,children:[V.isPending?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(ju,{className:`w-4 h-4`}),h(`common.delete`)]})]})]})})})]})}var f5={NOZZLE_DIAMETER:`bambusy_kprofiles_nozzle`,SORT_OPTION:`bambusy_kprofiles_sort`};function YKe(){let{t:e}=U(),{showToast:t}=qd(),{hasPermission:n}=Nd(),[r,i]=(0,f.useState)(null),[a,o]=(0,f.useState)(()=>localStorage.getItem(f5.NOZZLE_DIAMETER)||`0.4`),[s,c]=(0,f.useState)(null),[l,u]=(0,f.useState)(!1),[d,p]=(0,f.useState)(null),[m,h]=(0,f.useState)(``),[g,_]=(0,f.useState)(`all`),[v,y]=(0,f.useState)(`all`),[b,x]=(0,f.useState)(()=>localStorage.getItem(f5.SORT_OPTION)||`name`),[S,C]=(0,f.useState)(!1),[w,T]=(0,f.useState)(new Set),[E,D]=(0,f.useState)(!1),[O,k]=(0,f.useState)(!1),A=(0,f.useCallback)(e=>`${e.slot_id}_${e.extruder_id}`,[]);(0,f.useEffect)(()=>{localStorage.setItem(f5.NOZZLE_DIAMETER,a)},[a]),(0,f.useEffect)(()=>{localStorage.setItem(f5.SORT_OPTION,b)},[b]);let{data:j,isLoading:M}=K({queryKey:[`printers`],queryFn:Z.getPrinters}),{data:N,isLoading:P,isFetching:F,error:I,refetch:L}=K({queryKey:[`kprofiles`,r,a],queryFn:async()=>{console.log(`[KProfiles] Fetching profiles for printer`,r,`nozzle`,a);let e=await Z.getKProfiles(r,a);return console.log(`[KProfiles] Received profiles:`,e?.profiles?.length||0,`profiles`),e},enabled:!!r,retry:!1,staleTime:0,gcTime:0,refetchOnMount:`always`}),{data:R}=K({queryKey:[`builtinFilaments`],queryFn:()=>Z.getBuiltinFilaments(),staleTime:3e5}),{data:z}=K({queryKey:[`filamentIdMap`],queryFn:()=>Z.getFilamentIdMap(),staleTime:3e5}),{data:B}=K({queryKey:[`localPresets`],queryFn:()=>Z.getLocalPresets(),retry:!1}),{data:V}=K({queryKey:[`orcaCloudProfilesForKProfiles`],queryFn:()=>Z.orcaCloudListProfiles(),retry:!1}),{data:ee}=K({queryKey:[`cloudSettings`],queryFn:()=>Z.getCloudSettings(),retry:!1}),{data:te,refetch:ne}=K({queryKey:[`kprofile-notes`,r],queryFn:()=>Z.getKProfileNotes(r),enabled:!!r,staleTime:3e4}),re=I?.message?.includes(`not connected`);(0,f.useEffect)(()=>{if(!r&&j&&j.length>0){let e=j.find(e=>e.is_active);e&&i(e.id)}},[r,j]),(0,f.useEffect)(()=>{if(r){let e=setTimeout(()=>{L()},150);return()=>clearTimeout(e)}},[r,a]);let ie=j?.filter(e=>e.is_active)||[],ae=f.useMemo(()=>{let e=new Map;if(R)for(let t of R)e.set(t.filament_id,t.name);if(z)for(let[t,n]of Object.entries(z))e.has(t)||e.set(t,n);return e},[R,z]),oe=f.useMemo(()=>Array.from(ae.entries()).map(([e,t])=>({filament_id:e,name:t})),[ae]),se=f.useMemo(()=>KKe({localPresets:B?.filament,orcaProfiles:V?.filament,cloudSettings:ee?.filament,builtinFilaments:R}),[B?.filament,V?.filament,ee?.filament,R]),H=f.useCallback(e=>ae.get(e.filament_id)||l5(e.name),[ae]),ce=f.useMemo(()=>N?.profiles?N.profiles.filter(e=>{let t=m.toLowerCase(),n=!t||e.name.toLowerCase().includes(t)||e.filament_id.toLowerCase().includes(t),r=g===`all`||g===`left`&&e.extruder_id===1||g===`right`&&e.extruder_id===0,i=v===`all`||v===`hf`&&e.nozzle_id.startsWith(`HH`)||v===`s`&&e.nozzle_id.startsWith(`HS`);return n&&r&&i}).sort((e,t)=>{switch(b){case`k_value`:return parseFloat(e.k_value)-parseFloat(t.k_value);case`filament`:return H(e).localeCompare(H(t));default:return e.name.localeCompare(t.name)}}):[],[N?.profiles,m,g,v,b,H]),le=j?.find(e=>e.id===r),ue=le?.nozzle_count===2,de=le?.supports_nozzle_flow_type??!0;(0,f.useEffect)(()=>{de||y(`all`)},[de]),(0,f.useEffect)(()=>{let e=e=>{e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement||e.target instanceof HTMLSelectElement||s||l||d||(e.key===`r`||e.key===`R`?(e.preventDefault(),L()):e.key===`n`||e.key===`N`?(e.preventDefault(),u(!0)):e.key===`Escape`&&S&&(e.preventDefault(),C(!1),T(new Set)))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[s,l,d,S,L]);let fe=(0,f.useCallback)(()=>{if(!N?.profiles||N.profiles.length===0){t(e(`kProfiles.toast.noProfilesToExport`),`error`);return}let n={version:1,exported_at:new Date().toISOString(),printer:le?.name||`Unknown`,nozzle_diameter:a,profiles:N.profiles.map(e=>({name:e.name,k_value:e.k_value,filament_id:e.filament_id,nozzle_id:e.nozzle_id,nozzle_diameter:e.nozzle_diameter,extruder_id:e.extruder_id}))},r=new Blob([JSON.stringify(n,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),o=document.createElement(`a`);o.href=i,o.download=`kprofiles_${le?.name||`printer`}_${a}mm_${new Date().toISOString().split(`T`)[0]}.json`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(i),t(e(`kProfiles.toast.exportedProfiles`,{count:N.profiles.length}))},[N?.profiles,le,a,t,e]),pe=(0,f.useCallback)(()=>{let n=document.createElement(`input`);n.type=`file`,n.accept=`.json`,n.onchange=async n=>{let i=n.target.files?.[0];if(i)try{let n=await i.text(),o=JSON.parse(n);if(!o.profiles||!Array.isArray(o.profiles)){t(e(`kProfiles.toast.invalidFileFormat`),`error`);return}let s=0;for(let e of o.profiles)if(!(!e.name||!e.k_value||!e.filament_id))try{await Z.setKProfile(r,{name:e.name,k_value:parseFloat(e.k_value).toFixed(6),filament_id:e.filament_id,nozzle_id:e.nozzle_id||`${o5}-${a}`,nozzle_diameter:e.nozzle_diameter||a,extruder_id:e.extruder_id??0,slot_id:0}),s++,await new Promise(e=>setTimeout(e,500))}catch(t){console.error(`Failed to import profile:`,e.name,t)}t(e(`kProfiles.toast.importedProfiles`,{count:s,total:o.profiles.length})),L()}catch(n){console.error(`Import error:`,n),t(e(`kProfiles.toast.failedToParseImport`),`error`)}},n.click()},[r,a,t,L,e]),me=(0,f.useCallback)(e=>{T(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),he=(0,f.useCallback)(()=>{T(new Set(ce.map(e=>A(e))))},[ce,A]),ge=(0,f.useCallback)(()=>{w.size!==0&&D(!0)},[w.size]),_e=(0,f.useCallback)(async()=>{let n=ce.filter(e=>w.has(A(e)));k(!0);let i=0;for(let e of n)try{await Z.deleteKProfile(r,{slot_id:e.slot_id,extruder_id:e.extruder_id,nozzle_id:e.nozzle_id,nozzle_diameter:e.nozzle_diameter,filament_id:e.filament_id,setting_id:e.setting_id}),i++,await new Promise(e=>setTimeout(e,300))}catch(t){console.error(`Failed to delete profile:`,e.name,t)}t(e(`kProfiles.toast.profilesDeleted`,{count:i})),k(!1),D(!1),C(!1),T(new Set),L()},[r,w,ce,t,L,A,e]),ve=(0,f.useCallback)(e=>{let t=[];return e.setting_id&&t.push(e.setting_id),t.push(`slot_${e.slot_id}_${e.filament_id}_${e.extruder_id}`),t.push(`name_${e.name}_${e.filament_id}`),t},[]),ye=(0,f.useCallback)(async(n,i)=>{if(r)try{await Z.setKProfileNote(r,n,i),ne()}catch(n){console.error(`Failed to save note:`,n),t(e(`kProfiles.toast.failedToSaveNote`),`error`)}},[r,ne,t,e]),be=(0,f.useCallback)(e=>{if(!te?.notes)return{note:``,key:null};let t=ve(e);for(let e of t)if(te.notes[e])return{note:te.notes[e],key:e};return{note:``,key:null}},[te,ve]),xe=(0,f.useCallback)(e=>be(e).note,[be]);return M?(0,G.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,G.jsx)(Y,{className:`w-8 h-8 text-bambu-green animate-spin`})}):!j||j.length===0?(0,G.jsx)(zd,{children:(0,G.jsxs)(Vd,{className:`py-12 text-center`,children:[(0,G.jsx)(fs,{className:`w-12 h-12 text-bambu-gray mx-auto mb-4`}),(0,G.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-2`,children:e(`kProfiles.noPrintersConfigured`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray`,children:e(`kProfiles.addPrinterInSettings`)})]})}):ie.length===0?(0,G.jsx)(zd,{children:(0,G.jsxs)(Vd,{className:`py-12 text-center`,children:[(0,G.jsx)(Ml,{className:`w-12 h-12 text-bambu-gray mx-auto mb-4`}),(0,G.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-2`,children:e(`kProfiles.noActivePrinters`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray`,children:e(`kProfiles.enablePrinterConnection`)})]})}):(0,G.jsxs)(G.Fragment,{children:[F&&!P&&(0,G.jsxs)(`div`,{className:`fixed inset-0 bg-black/50 flex flex-col items-center justify-center z-40`,children:[(0,G.jsx)(Y,{className:`w-10 h-10 text-bambu-green animate-spin mb-3`}),(0,G.jsx)(`p`,{className:`text-white font-medium`,children:e(`kProfiles.loadingProfiles`)})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-4 mb-6`,children:[(0,G.jsxs)(`div`,{className:`flex-1 min-w-48`,children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:e(`kProfiles.printer`)}),(0,G.jsx)(`select`,{value:r||``,onChange:e=>i(parseInt(e.target.value)),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:ie.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),(0,G.jsxs)(`div`,{className:`w-32`,children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:e(`kProfiles.nozzle`)}),(0,G.jsxs)(`select`,{value:a,onChange:e=>o(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,G.jsx)(`option`,{value:`0.2`,children:`0.2mm`}),(0,G.jsx)(`option`,{value:`0.4`,children:`0.4mm`}),(0,G.jsx)(`option`,{value:`0.6`,children:`0.6mm`}),(0,G.jsx)(`option`,{value:`0.8`,children:`0.8mm`})]})]}),(0,G.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>L(),disabled:F||!n(`kprofiles:read`),title:n(`kprofiles:read`)?void 0:e(`kProfiles.permission.noRead`),children:[(0,G.jsx)(Il,{className:`w-4 h-4 ${F?`animate-spin`:``}`}),e(`kProfiles.refresh`)]}),(0,G.jsxs)(Q,{onClick:()=>u(!0),disabled:!n(`kprofiles:create`),title:n(`kprofiles:create`)?void 0:e(`kProfiles.permission.noCreate`),children:[(0,G.jsx)(kl,{className:`w-4 h-4`}),e(`kProfiles.addProfile`)]})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-4 mb-4`,children:[(0,G.jsxs)(`div`,{className:`flex-1 min-w-48 relative`,children:[(0,G.jsx)(Kl,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray`}),(0,G.jsx)(`input`,{type:`text`,value:m,onChange:e=>h(e.target.value),placeholder:e(`kProfiles.searchPlaceholder`),className:`w-full pl-10 pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`})]}),ue&&(0,G.jsx)(`div`,{className:`w-36`,children:(0,G.jsxs)(`select`,{value:g,onChange:e=>_(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,G.jsx)(`option`,{value:`all`,children:e(`kProfiles.allExtruders`)}),(0,G.jsx)(`option`,{value:`left`,children:e(`kProfiles.leftOnly`)}),(0,G.jsx)(`option`,{value:`right`,children:e(`kProfiles.rightOnly`)})]})}),de&&(0,G.jsx)(`div`,{className:`w-32`,children:(0,G.jsxs)(`select`,{value:v,onChange:e=>y(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,G.jsx)(`option`,{value:`all`,children:e(`kProfiles.allFlow`)}),(0,G.jsx)(`option`,{value:`hf`,children:e(`kProfiles.hfOnly`)}),(0,G.jsx)(`option`,{value:`s`,children:e(`kProfiles.sOnly`)})]})}),(0,G.jsx)(`div`,{className:`w-32`,children:(0,G.jsxs)(`select`,{value:b,onChange:e=>x(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,G.jsx)(`option`,{value:`name`,children:e(`kProfiles.sortName`)}),(0,G.jsx)(`option`,{value:`k_value`,children:e(`kProfiles.sortKValue`)}),(0,G.jsx)(`option`,{value:`filament`,children:e(`kProfiles.sortFilament`)})]})})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2 mb-6`,children:[(0,G.jsxs)(Q,{variant:`secondary`,onClick:fe,disabled:!N?.profiles?.length||!n(`kprofiles:read`),title:n(`kprofiles:read`)?void 0:e(`kProfiles.permission.noExport`),children:[(0,G.jsx)(Us,{className:`w-4 h-4`}),e(`kProfiles.export`)]}),(0,G.jsxs)(Q,{variant:`secondary`,onClick:pe,disabled:!n(`kprofiles:create`),title:n(`kprofiles:create`)?void 0:e(`kProfiles.permission.noImport`),children:[(0,G.jsx)(Ru,{className:`w-4 h-4`}),e(`kProfiles.import`)]}),(0,G.jsx)(`div`,{className:`flex-1`}),S?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Q,{variant:`secondary`,onClick:he,children:[(0,G.jsx)(fu,{className:`w-4 h-4`}),e(`kProfiles.selectAll`)]}),(0,G.jsxs)(Q,{variant:`secondary`,onClick:ge,disabled:w.size===0||!n(`kprofiles:delete`),className:`text-red-500 hover:bg-red-500/10`,title:n(`kprofiles:delete`)?void 0:e(`kProfiles.permission.noDelete`),children:[(0,G.jsx)(ju,{className:`w-4 h-4`}),e(`kProfiles.delete`),` (`,w.size,`)`]}),(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>{C(!1),T(new Set)},children:[(0,G.jsx)($u,{className:`w-4 h-4`}),e(`common.cancel`)]})]}):(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>C(!0),disabled:!ce.length||!n(`kprofiles:delete`),title:n(`kprofiles:delete`)?void 0:e(`kProfiles.permission.noDelete`),children:[(0,G.jsx)(fu,{className:`w-4 h-4`}),e(`kProfiles.select`)]})]}),P?(0,G.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,G.jsx)(Y,{className:`w-8 h-8 text-bambu-green animate-spin`})}):re?(0,G.jsx)(zd,{children:(0,G.jsxs)(Vd,{className:`py-12 text-center`,children:[(0,G.jsx)(Ju,{className:`w-12 h-12 text-bambu-gray mx-auto mb-4`}),(0,G.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-2`,children:e(`kProfiles.printerOffline`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray mb-4`,children:e(`kProfiles.printerOfflineDesc`)}),(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>L(),children:[(0,G.jsx)(Il,{className:`w-4 h-4`}),e(`common.refresh`)]})]})}):ce.length>0?ue?(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-sm font-medium text-bambu-gray mb-2 px-1`,children:e(`kProfiles.leftExtruder`)}),(0,G.jsx)(`div`,{className:`space-y-1`,children:ce.filter(e=>e.extruder_id===1).map(e=>(0,G.jsx)(u5,{profile:e,onEdit:()=>c(e),onCopy:()=>p(e),selectionMode:S,isSelected:w.has(A(e)),onToggleSelect:()=>me(A(e)),note:xe(e)},A(e)))})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-sm font-medium text-bambu-gray mb-2 px-1`,children:e(`kProfiles.rightExtruder`)}),(0,G.jsx)(`div`,{className:`space-y-1`,children:ce.filter(e=>e.extruder_id===0).map(e=>(0,G.jsx)(u5,{profile:e,onEdit:()=>c(e),onCopy:()=>p(e),selectionMode:S,isSelected:w.has(A(e)),onToggleSelect:()=>me(A(e)),note:xe(e)},A(e)))})]})]}):(0,G.jsx)(`div`,{className:`space-y-1`,children:ce.map(e=>(0,G.jsx)(u5,{profile:e,onEdit:()=>c(e),onCopy:()=>p(e),selectionMode:S,isSelected:w.has(A(e)),onToggleSelect:()=>me(A(e)),note:xe(e)},A(e)))}):m||g!==`all`||v!==`all`?(0,G.jsx)(zd,{children:(0,G.jsxs)(Vd,{className:`py-12 text-center`,children:[(0,G.jsx)(Kl,{className:`w-12 h-12 text-bambu-gray mx-auto mb-4`}),(0,G.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-2`,children:e(`kProfiles.noMatchingProfiles`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray`,children:e(`kProfiles.noMatchingProfilesDesc`)})]})}):(0,G.jsx)(zd,{children:(0,G.jsxs)(Vd,{className:`py-12 text-center`,children:[(0,G.jsx)(vc,{className:`w-12 h-12 text-bambu-gray mx-auto mb-4`}),(0,G.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-2`,children:e(`kProfiles.noKProfiles`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray mb-4`,children:e(`kProfiles.noKProfilesDesc`,{diameter:a})}),(0,G.jsxs)(Q,{onClick:()=>u(!0),children:[(0,G.jsx)(kl,{className:`w-4 h-4`}),e(`kProfiles.createFirstProfile`)]})]})}),s&&r&&(()=>{let{note:e,key:t}=be(s);return(0,G.jsx)(d5,{profile:s,printerId:r,nozzleDiameter:a,existingProfiles:N?.profiles,builtinFilaments:oe,filamentPresets:se,isDualNozzle:ue,supportsFlowType:de,initialNote:e,initialNoteKey:t,onSaveNote:ye,hasPermission:n,onClose:()=>{console.log(`[KProfiles] Edit modal onClose - refetching profiles...`),c(null),L()},onSave:()=>{c(null),L()}})})(),l&&r&&(0,G.jsx)(d5,{printerId:r,nozzleDiameter:a,existingProfiles:N?.profiles,builtinFilaments:oe,filamentPresets:se,isDualNozzle:ue,supportsFlowType:de,onSaveNote:ye,hasPermission:n,onClose:()=>{u(!1),L()},onSave:()=>{u(!1),L()}}),d&&r&&(0,G.jsx)(d5,{printerId:r,nozzleDiameter:a,existingProfiles:N?.profiles,builtinFilaments:oe,filamentPresets:se,isDualNozzle:ue,supportsFlowType:de,onSaveNote:ye,hasPermission:n,profile:{...d,slot_id:0,name:`${d.name} (Copy)`},onClose:()=>{p(null),L()},onSave:()=>{p(null),L()}}),E&&(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,children:(0,G.jsx)(zd,{className:`w-full max-w-sm`,children:(0,G.jsxs)(Vd,{className:`p-6`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 mb-4`,children:[(0,G.jsx)(`div`,{className:`w-10 h-10 rounded-full bg-red-500/20 flex items-center justify-center`,children:(0,G.jsx)(ju,{className:`w-5 h-5 text-red-500`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:e(`kProfiles.bulkDelete.title`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`kProfiles.bulkDelete.cannotUndo`)})]})]}),(0,G.jsx)(`p`,{className:`text-bambu-gray mb-6`,children:e(`kProfiles.bulkDelete.message`,{count:w.size})}),(0,G.jsxs)(`div`,{className:`flex gap-3`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>D(!1),disabled:O,className:`flex-1`,children:e(`common.cancel`)}),(0,G.jsxs)(Q,{onClick:_e,disabled:O,className:`flex-1 bg-red-500 hover:bg-red-600 text-white`,children:[O?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(ju,{className:`w-4 h-4`}),e(`common.delete`)]})]})]})})})]})}var p5=[`PLA`,`PETG`,`PCTG`,`ABS`,`ASA`,`TPU`,`PC`,`PA`,`PVA`,`HIPS`,`PP`,`PET`,`NYLON`],XKe={PLA:`E8E8E8`,PETG:`4A90D9`,ABS:`E67E22`,ASA:`D35400`,TPU:`9B59B6`,PC:`BDC3C7`,PA:`2ECC71`,NYLON:`2ECC71`,PVA:`F1C40F`,HIPS:`95A5A6`,PP:`ECF0F1`,PET:`3498DB`};function ZKe(e){let t=e.toUpperCase();for(let e of p5)if(RegExp(`\\b${e}\\b`).test(t))return e;return null}function QKe(e){let t=e.replace(/@.+$/,``).trim(),n=t.toUpperCase();for(let e of p5){let r=n.indexOf(e);if(r>0){let e=t.slice(0,r).trim();if(e&&e.length>1)return e}}return null}function m5({preset:e,onDelete:t,onExpand:n,isExpanded:r}){let{t:i}=U(),{hasPermission:a}=Nd(),o=e.filament_type||ZKe(e.name),s=e.filament_vendor||QKe(e.name),c=null,l=!1;if(e.default_filament_colour)try{let t=JSON.parse(e.default_filament_colour),n=Array.isArray(t)?t[0]:t;typeof n==`string`&&/^#?[0-9a-fA-F]{6,8}$/.test(n.replace(`#`,``))&&(c=n.replace(`#`,``).slice(0,6),l=!0)}catch{let t=e.default_filament_colour;/^#?[0-9a-fA-F]{6,8}$/.test(t.replace(`#`,``))&&(c=t.replace(`#`,``).slice(0,6),l=!0)}return!c&&o&&(c=XKe[o.toUpperCase()]||null),(0,G.jsx)(zd,{className:`bg-bambu-dark border-bambu-dark-tertiary hover:border-bambu-dark-tertiary/80 transition-colors`,children:(0,G.jsxs)(Vd,{className:`p-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[e.preset_type===`filament`&&(0,G.jsx)(`div`,{className:`w-4 h-4 rounded-full border border-black/20 flex-shrink-0 ${!l&&!c?`opacity-25`:l?``:`opacity-50`}`,style:{backgroundColor:c?`#${c}`:`#666`}}),(0,G.jsx)(`span`,{className:`text-sm font-medium text-white truncate`,children:e.name})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[o&&(0,G.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded bg-bambu-green/20 text-bambu-green`,children:o}),s&&(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:s}),(0,G.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400`,children:i(`profiles.localProfiles.badge`)})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1 flex-shrink-0`,children:[a(`settings:update`)&&(0,G.jsx)(`button`,{onClick:()=>t(e.id),className:`p-1 text-bambu-gray hover:text-red-600 dark:hover:text-red-400 transition-colors`,title:i(`profiles.localProfiles.delete`),children:(0,G.jsx)(ju,{className:`w-3.5 h-3.5`})}),(0,G.jsx)(`button`,{onClick:()=>n(r?null:e.id),className:`p-1 text-bambu-gray hover:text-white transition-colors`,children:r?(0,G.jsx)(ls,{className:`w-3.5 h-3.5`}):(0,G.jsx)(as,{className:`w-3.5 h-3.5`})})]})]}),r&&(0,G.jsxs)(`div`,{className:`mt-3 pt-3 border-t border-bambu-dark-tertiary text-xs space-y-1.5`,children:[o&&(0,G.jsxs)(`div`,{className:`flex justify-between`,children:[(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:i(`profiles.localProfiles.filamentType`)}),(0,G.jsx)(`span`,{className:`text-white`,children:o})]}),s&&(0,G.jsxs)(`div`,{className:`flex justify-between`,children:[(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:i(`profiles.localProfiles.vendor`)}),(0,G.jsx)(`span`,{className:`text-white`,children:s})]}),e.nozzle_temp_min!=null&&e.nozzle_temp_max!=null&&(0,G.jsxs)(`div`,{className:`flex justify-between`,children:[(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:i(`profiles.localProfiles.nozzleTemp`)}),(0,G.jsxs)(`span`,{className:`text-white`,children:[e.nozzle_temp_min,`–`,e.nozzle_temp_max,`°C`]})]}),e.filament_cost&&(0,G.jsxs)(`div`,{className:`flex justify-between`,children:[(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:i(`profiles.localProfiles.cost`)}),(0,G.jsx)(`span`,{className:`text-white`,children:e.filament_cost})]}),e.filament_density&&(0,G.jsxs)(`div`,{className:`flex justify-between`,children:[(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:i(`profiles.localProfiles.density`)}),(0,G.jsxs)(`span`,{className:`text-white`,children:[e.filament_density,` g/cm³`]})]}),e.pressure_advance&&(0,G.jsxs)(`div`,{className:`flex justify-between`,children:[(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:i(`profiles.localProfiles.pressureAdvance`)}),(0,G.jsx)(`span`,{className:`text-white`,children:e.pressure_advance})]}),e.compatible_printers&&(0,G.jsxs)(`div`,{className:`flex justify-between`,children:[(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:i(`profiles.localProfiles.compatiblePrinters`)}),(0,G.jsx)(`span`,{className:`text-white truncate ml-2`,children:(()=>{try{return JSON.parse(e.compatible_printers).join(`, `)}catch{return e.compatible_printers}})()})]}),e.inherits&&e.inherits!==e.name&&(0,G.jsxs)(`div`,{className:`flex justify-between`,children:[(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:i(`profiles.localProfiles.inheritsFrom`)}),(0,G.jsx)(`span`,{className:`text-white truncate ml-2`,children:e.inherits})]}),(0,G.jsxs)(`div`,{className:`flex justify-between`,children:[(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:i(`profiles.localProfiles.source`)}),(0,G.jsx)(`span`,{className:`text-white capitalize`,children:e.source})]})]})]})})}function $Ke(){let{t:e}=U(),{hasPermission:t}=Nd(),n=no(),{showToast:r}=qd(),[i,a]=(0,f.useState)(``),[o,s]=(0,f.useState)(null),[c,l]=(0,f.useState)(!1),[u,d]=(0,f.useState)(null),{data:p,isLoading:m}=K({queryKey:[`localPresets`],queryFn:()=>Z.getLocalPresets()}),h=q({mutationFn:async e=>{let t=[];for(let n of Array.from(e)){let e=new FormData;e.append(`file`,n),t.push(await Z.importLocalPresets(e))}return t},onSuccess:t=>{n.invalidateQueries({queryKey:[`localPresets`]}),n.invalidateQueries({queryKey:[`slicerPresets`]});let i=0,a=0,o=0;for(let e of t)i+=e.imported,a+=e.skipped,o+=e.errors.length;i>0&&r(e(`profiles.localProfiles.toast.importSuccess`,{count:i})),a>0&&r(e(`profiles.localProfiles.toast.importSkipped`,{count:a}),`warning`),o>0&&r(e(`profiles.localProfiles.toast.importError`,{count:o}),`error`)},onError:e=>{r(e.message,`error`)}}),g=q({mutationFn:e=>Z.deleteLocalPreset(e),onSuccess:(t,i)=>{n.setQueryData([`localPresets`],e=>e&&{filament:e.filament.filter(e=>e.id!==i),printer:e.printer.filter(e=>e.id!==i),process:e.process.filter(e=>e.id!==i)}),n.invalidateQueries({queryKey:[`localPresets`]}),n.invalidateQueries({queryKey:[`slicerPresets`]}),d(null),r(e(`profiles.localProfiles.toast.deleted`))}}),_=(0,f.useCallback)(e=>{!e||e.length===0||h.mutate(e)},[h]),v=(0,f.useCallback)(e=>{e.preventDefault(),l(!1),_(e.dataTransfer.files)},[_]),y=(0,f.useCallback)(e=>{if(!i)return e;let t=i.toLowerCase();return e.filter(e=>e.name.toLowerCase().includes(t)||e.filament_type?.toLowerCase().includes(t)||e.filament_vendor?.toLowerCase().includes(t))},[i]),b=(0,f.useMemo)(()=>y(p?.filament||[]),[p?.filament,y]),x=(0,f.useMemo)(()=>y(p?.printer||[]),[p?.printer,y]),S=(0,f.useMemo)(()=>y(p?.process||[]),[p?.process,y]),C=b.length+x.length+S.length,w=(p?.filament?.length??0)+(p?.printer?.length??0)+(p?.process?.length??0)>0;return m?(0,G.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,G.jsx)(Y,{className:`w-8 h-8 text-bambu-green animate-spin`})}):(0,G.jsxs)(`div`,{className:`space-y-6`,children:[t(`settings:update`)&&(0,G.jsxs)(`div`,{onDragOver:e=>{e.preventDefault(),l(!0)},onDragLeave:()=>l(!1),onDrop:v,className:`relative border-2 border-dashed rounded-lg p-6 text-center transition-colors ${c?`border-bambu-green bg-bambu-green/10`:`border-bambu-dark-tertiary hover:border-bambu-gray`}`,children:[(0,G.jsx)(`input`,{type:`file`,accept:`.json,.zip,.orca_filament,.bbscfg,.bbsflmt`,multiple:!0,className:`absolute inset-0 w-full h-full opacity-0 cursor-pointer`,onChange:e=>_(e.target.files)}),h.isPending?(0,G.jsxs)(`div`,{className:`flex items-center justify-center gap-2`,children:[(0,G.jsx)(Y,{className:`w-5 h-5 text-bambu-green animate-spin`}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:e(`profiles.localProfiles.importing`)})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Ru,{className:`w-8 h-8 text-bambu-gray mx-auto mb-2`}),(0,G.jsx)(`p`,{className:`text-sm text-white font-medium`,children:e(`profiles.localProfiles.import`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:e(`profiles.localProfiles.importDesc`)})]})]}),w&&(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(Kl,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray`}),(0,G.jsx)(`input`,{type:`text`,value:i,onChange:e=>a(e.target.value),placeholder:e(`profiles.localProfiles.search`),className:`w-full pl-9 pr-4 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-sm text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green`})]}),!w&&!m&&(0,G.jsxs)(`div`,{className:`text-center py-12`,children:[(0,G.jsx)(Dc,{className:`w-12 h-12 text-bambu-gray mx-auto mb-3 opacity-50`}),(0,G.jsx)(`p`,{className:`text-bambu-gray`,children:e(`profiles.localProfiles.noPresets`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray/60 mt-1`,children:e(`profiles.localProfiles.importDesc`)})]}),w&&C===0&&!m&&(0,G.jsxs)(`div`,{className:`text-center py-12`,children:[(0,G.jsx)(Kl,{className:`w-12 h-12 text-bambu-gray mx-auto mb-3 opacity-50`}),(0,G.jsx)(`p`,{className:`text-bambu-gray`,children:e(`profiles.localProfiles.noSearchResults`)})]}),C>0&&(0,G.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6`,children:[b.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,G.jsx)(Ws,{className:`w-4 h-4 text-bambu-green`}),(0,G.jsx)(`h3`,{className:`text-sm font-medium text-white`,children:e(`profiles.localProfiles.filament`)}),(0,G.jsxs)(`span`,{className:`text-xs text-bambu-gray`,children:[`(`,b.length,`)`]})]}),(0,G.jsx)(`div`,{className:`space-y-2`,children:b.map(e=>(0,G.jsx)(m5,{preset:e,onDelete:e=>d(e),onExpand:s,isExpanded:o===e.id},e.id))})]}),S.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,G.jsx)(Hc,{className:`w-4 h-4 text-blue-600 dark:text-blue-400`}),(0,G.jsx)(`h3`,{className:`text-sm font-medium text-white`,children:e(`profiles.localProfiles.process`)}),(0,G.jsxs)(`span`,{className:`text-xs text-bambu-gray`,children:[`(`,S.length,`)`]})]}),(0,G.jsx)(`div`,{className:`space-y-2`,children:S.map(e=>(0,G.jsx)(m5,{preset:e,onDelete:e=>d(e),onExpand:s,isExpanded:o===e.id},e.id))})]}),x.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,G.jsx)(Xl,{className:`w-4 h-4 text-orange-600 dark:text-orange-400`}),(0,G.jsx)(`h3`,{className:`text-sm font-medium text-white`,children:e(`profiles.localProfiles.printer`)}),(0,G.jsxs)(`span`,{className:`text-xs text-bambu-gray`,children:[`(`,x.length,`)`]})]}),(0,G.jsx)(`div`,{className:`space-y-2`,children:x.map(e=>(0,G.jsx)(m5,{preset:e,onDelete:e=>d(e),onExpand:s,isExpanded:o===e.id},e.id))})]})]}),u!==null&&(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50`,children:(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg p-6 max-w-sm mx-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,G.jsx)(fs,{className:`w-5 h-5 text-red-600 dark:text-red-400`}),(0,G.jsx)(`h3`,{className:`text-white font-medium`,children:e(`profiles.localProfiles.deleteConfirmTitle`)})]}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mb-4`,children:e(`profiles.localProfiles.deleteConfirm`)}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:()=>d(null),children:e(`profiles.localProfiles.cancel`)}),(0,G.jsxs)(Q,{variant:`danger`,size:`sm`,onClick:()=>g.mutate(u),disabled:g.isPending,children:[g.isPending?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(ju,{className:`w-4 h-4`}),e(`profiles.localProfiles.delete`)]})]})]})})]})}function eqe(e){let t=e.match(/@?\s*(?:BBL\s+)?(?:Bambu\s+Lab\s+)?([XPAH][1-9][A-Z]?(?:\s*(?:Carbon|mini))?|H2D)/i),n=e.match(/(\d+\.?\d*)\s*(?:mm\s*)?nozzle|nozzle\s*(\d+\.?\d*)/i),r=e.match(/(\d+\.?\d*)mm\s*(?:Standard|Fine|Extra Fine|Draft|Quality)?/i),i=e.match(/\b(PLA|PETG|ABS|ASA|TPU|PC|PA|PVA|HIPS|PP|PET(?:-?CF)?|PA(?:-?CF)?|PLA(?:-?CF)?)\b/i);return{printer:t?t[1].trim():null,nozzle:n?(n[1]||n[2])+`mm`:null,layerHeight:r?r[1]+`mm`:null,filamentType:i?i[1].toUpperCase():null}}function tqe({settings:e,lastSyncTime:t,onRefresh:n,isRefreshing:r,printers:i,t:a}){let[o,s]=(0,f.useState)(``),[c,l]=(0,f.useState)(`all`),[u,d]=(0,f.useState)(`all`),[p,m]=(0,f.useState)(`all`),[h,g]=(0,f.useState)(`all`),[_,v]=(0,f.useState)(`all`),[y,b]=(0,f.useState)(null),x=(0,f.useMemo)(()=>[...e.filament.map(e=>({...e,type:`filament`})),...e.printer.map(e=>({...e,type:`printer`})),...e.process.map(e=>({...e,type:`process`}))].map(e=>({...e,meta:eqe(e.name)})),[e]),S=(0,f.useMemo)(()=>{let e=new Set,t=new Set,n=new Set;return x.forEach(r=>{r.meta.nozzle&&e.add(r.meta.nozzle),r.meta.filamentType&&t.add(r.meta.filamentType),r.meta.layerHeight&&n.add(r.meta.layerHeight)}),{printers:i.map(e=>({id:e.id.toString(),name:e.name})),nozzles:Array.from(e).sort((e,t)=>parseFloat(e)-parseFloat(t)),filaments:Array.from(t).sort(),layerHeights:Array.from(n).sort((e,t)=>parseFloat(e)-parseFloat(t))}},[x,i]),C=(0,f.useMemo)(()=>u===`all`?null:i.find(e=>e.id.toString()===u)?.model||null,[u,i]),w=(0,f.useMemo)(()=>x.filter(e=>c===`all`||e.type===c).filter(e=>{if(u===`all`||!C)return!0;let t=e.meta.printer?.toLowerCase()||``,n=C.toLowerCase();return t.includes(n)||n.includes(t)}).filter(e=>p===`all`||e.meta.nozzle===p).filter(e=>h===`all`||e.meta.filamentType===h).filter(e=>_===`all`||e.meta.layerHeight===_).filter(e=>o===``||e.name.toLowerCase().includes(o.toLowerCase())).sort((e,t)=>e.name.localeCompare(t.name)),[x,c,u,C,p,h,_,o]),T=()=>{l(`all`),d(`all`),m(`all`),g(`all`),v(`all`),s(``)},E=c!==`all`||u!==`all`||p!==`all`||h!==`all`||_!==`all`||o!==``,D=e.filament.length+e.printer.length+e.process.length,O=e=>w.filter(t=>t.type===e);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`space-y-4 mb-6`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-3`,children:[(0,G.jsxs)(`div`,{className:`relative flex-1`,children:[(0,G.jsx)(Kl,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray`}),(0,G.jsx)(`input`,{type:`text`,value:o,onChange:e=>s(e.target.value),placeholder:a(`profiles.cloudView.searchPlaceholder`),className:`w-full pl-10 pr-4 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray-dark focus:border-bambu-green focus:outline-none`})]}),(0,G.jsx)(`div`,{className:`flex gap-2`,children:(0,G.jsxs)(Q,{variant:`secondary`,onClick:n,disabled:r,children:[(0,G.jsx)(Il,{className:`w-4 h-4 ${r?`animate-spin`:``}`}),a(`profiles.cloudView.refresh`)]})})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(_c,{className:`w-4 h-4 text-bambu-gray`}),(0,G.jsx)(v5,{label:a(`profiles.cloudView.filters.type`),value:c,options:[{value:`all`,label:a(`profiles.cloudView.filters.all`),count:D},{value:`filament`,label:a(`profiles.cloudView.filters.filament`),count:e.filament.length},{value:`printer`,label:a(`profiles.cloudView.filters.printer`),count:e.printer.length},{value:`process`,label:a(`profiles.cloudView.filters.process`),count:e.process.length}],onChange:e=>l(e)}),S.printers.length>0&&(0,G.jsx)(v5,{label:a(`profiles.cloudView.filters.printer`),value:u,options:[{value:`all`,label:a(`profiles.cloudView.filters.all`)},...S.printers.map(e=>({value:e.id,label:e.name}))],onChange:d}),S.nozzles.length>0&&(0,G.jsx)(v5,{label:a(`profiles.cloudView.filters.nozzle`),value:p,options:[{value:`all`,label:a(`profiles.cloudView.filters.all`)},...S.nozzles.map(e=>({value:e,label:e}))],onChange:m}),S.filaments.length>0&&(c===`all`||c===`filament`)&&(0,G.jsx)(v5,{label:a(`profiles.cloudView.filters.filament`),value:h,options:[{value:`all`,label:a(`profiles.cloudView.filters.all`)},...S.filaments.map(e=>({value:e,label:e}))],onChange:g}),S.layerHeights.length>0&&(c===`all`||c===`process`)&&(0,G.jsx)(v5,{label:a(`profiles.cloudView.filters.layer`),value:_,options:[{value:`all`,label:a(`profiles.cloudView.filters.all`)},...S.layerHeights.map(e=>({value:e,label:e}))],onChange:v}),E&&(0,G.jsx)(`button`,{onClick:T,className:`px-3 py-2 text-sm text-bambu-gray hover:text-white transition-colors`,children:a(`profiles.cloudView.clearFilters`)})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 mb-4 text-sm text-bambu-gray`,children:[t&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(ws,{className:`w-3 h-3`}),a(`profiles.cloudView.lastSynced`),` `,op(t.toISOString(),`system`,a)]}),(0,G.jsx)(`span`,{children:a(`profiles.cloudView.showingCount`,{showing:w.length,total:D})})]}),w.length===0?(0,G.jsxs)(`div`,{className:`text-center py-16`,children:[(0,G.jsx)(Hc,{className:`w-12 h-12 text-bambu-gray-dark mx-auto mb-4`}),(0,G.jsx)(`p`,{className:`text-bambu-gray`,children:a(`profiles.cloudView.noPresetsFound`)}),E&&(0,G.jsx)(`button`,{onClick:T,className:`mt-2 text-sm text-bambu-green hover:text-bambu-green-light`,children:a(`profiles.cloudView.clearFilters`)})]}):(0,G.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-6`,children:[(0,G.jsx)(h5,{icon:(0,G.jsx)(Ws,{className:`w-4 h-4 text-amber-600 dark:text-amber-400`}),title:a(`profiles.cloudView.columns.filament`),presets:O(`filament`),emptyText:a(`profiles.cloudView.noFilamentPresets`),onSelect:b}),(0,G.jsx)(h5,{icon:(0,G.jsx)(Xl,{className:`w-4 h-4 text-blue-600 dark:text-blue-400`}),title:a(`profiles.cloudView.columns.process`),presets:O(`process`),emptyText:a(`profiles.cloudView.noProcessPresets`),onSelect:b}),(0,G.jsx)(h5,{icon:(0,G.jsx)(Ml,{className:`w-4 h-4 text-purple-600 dark:text-purple-400`}),title:a(`profiles.cloudView.columns.printer`),presets:O(`printer`),emptyText:a(`profiles.cloudView.noPrinterPresets`),onSelect:b})]}),y&&(0,G.jsx)(rqe,{setting:y,onClose:()=>b(null),t:a})]})}function h5({icon:e,title:t,presets:n,emptyText:r,onSelect:i}){return(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-3 px-1`,children:[e,(0,G.jsx)(`h3`,{className:`text-sm font-medium text-bambu-gray`,children:t}),(0,G.jsxs)(`span`,{className:`text-xs text-bambu-gray-dark`,children:[`(`,n.length,`)`]})]}),(0,G.jsx)(`div`,{className:`space-y-1 max-h-[calc(100vh-320px)] overflow-y-auto pr-1`,children:n.length===0?(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray-dark px-3 py-2`,children:r}):n.map(e=>(0,G.jsx)(nqe,{preset:e,onClick:()=>i(e)},e.setting_id))})]})}function nqe({preset:e,onClick:t}){return(0,G.jsx)(`button`,{onClick:t,className:`w-full text-left px-3 py-2 rounded bg-bambu-dark hover:bg-bambu-dark-tertiary transition-colors`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-white text-sm truncate flex-1`,title:e.name,children:e.name}),e.meta.filamentType&&e.type===`filament`&&(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray whitespace-nowrap`,children:e.meta.filamentType}),e.meta.layerHeight&&e.type===`process`&&(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray whitespace-nowrap`,children:e.meta.layerHeight}),e.meta.printer&&(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray whitespace-nowrap`,children:e.meta.printer})]})})}function rqe({setting:e,onClose:t,t:n}){let{data:r,isLoading:i,error:a}=K({queryKey:[`orcaCloudProfileDetail`,e.setting_id],queryFn:()=>Z.orcaCloudGetProfile(e.setting_id),retry:!1});return(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/60 z-50 flex items-center justify-center p-4`,onClick:t,children:(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-2xl max-w-4xl w-full max-h-[90vh] flex flex-col`,onClick:e=>e.stopPropagation(),children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{className:`text-lg font-bold text-white`,children:e.name}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:e.type})]}),(0,G.jsx)(`button`,{onClick:t,className:`text-bambu-gray hover:text-white p-1`,children:(0,G.jsx)($u,{className:`w-5 h-5`})})]}),(0,G.jsx)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:i?(0,G.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,G.jsx)(Y,{className:`w-8 h-8 text-bambu-green animate-spin`})}):a?(0,G.jsx)(`p`,{className:`text-center text-bambu-gray py-16`,children:a.message}):r?(0,G.jsx)(`pre`,{className:`text-xs font-mono text-bambu-gray bg-bambu-dark p-3 rounded overflow-x-auto whitespace-pre`,children:JSON.stringify(r.setting,null,2)}):(0,G.jsx)(`p`,{className:`text-center text-bambu-gray py-16`,children:n(`profiles.cloudView.noPresetsFound`)})})]})})}function iqe(){let{t:e}=U(),t=no(),{showToast:n}=qd(),{hasPermission:r}=Nd(),i=r(`orca_cloud:auth`),[a,o]=(0,f.useState)(null),[s,c]=(0,f.useState)(5e3),[l,u]=(0,f.useState)(null),{data:d,isLoading:p}=K({queryKey:[`orcaCloudStatus`],queryFn:Z.orcaCloudStatus}),m=!!d?.connected,{data:h,isLoading:g,refetch:_,isRefetching:v,error:y,dataUpdatedAt:b}=K({queryKey:[`orcaCloudProfiles`],queryFn:Z.orcaCloudListProfiles,enabled:m,retry:!1,staleTime:1e3*60*5}),{data:x=[]}=K({queryKey:[`printers`],queryFn:Z.getPrinters,enabled:m}),[S,C]=(0,f.useState)();(0,f.useEffect)(()=>{b&&C(new Date(b))},[b]);let w=()=>{o(null),c(5e3)},T=t=>{t===`access_denied`?u(e(`profiles.orcaCloud.errors.denied`)):t===`expired_token`&&u(e(`profiles.orcaCloud.errors.expired`)),w()},E=q({mutationFn:Z.orcaCloudDeviceStart,onSuccess:e=>{u(null),c(Math.max(1,e.interval)*1e3),o(e)},onError:t=>{u(t.message||e(`profiles.orcaCloud.errors.startFailed`))}}),D=q({mutationFn:Z.orcaCloudLogout,onSuccess:()=>{t.invalidateQueries({queryKey:[`orcaCloudStatus`]}),t.removeQueries({queryKey:[`orcaCloudProfiles`]}),n(e(`profiles.orcaCloud.toast.disconnected`))}}),{data:O,error:k}=K({queryKey:[`orcaCloudDevicePoll`,a?.user_code??`none`],queryFn:Z.orcaCloudDevicePoll,enabled:a!==null,gcTime:0,retry:!1,refetchOnWindowFocus:!1,refetchInterval:a===null?!1:s}),A=(0,f.useRef)(null);return(0,f.useEffect)(()=>{if(!a||!O)return;let r=O.status;if(r===`slow_down`){c(e=>e+5e3);return}r!==`authorization_pending`&&A.current!==r&&(A.current=r,r===`complete`?(w(),t.invalidateQueries({queryKey:[`orcaCloudStatus`]}),t.invalidateQueries({queryKey:[`orcaCloudProfiles`]}),n(e(`profiles.orcaCloud.connectedShort`))):T(r))},[O,a]),(0,f.useEffect)(()=>{a&&k&&(u(e(`profiles.orcaCloud.errors.pollFailed`)),w())},[k,a]),(0,f.useEffect)(()=>{a&&(A.current=null)},[a]),p?(0,G.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,G.jsx)(Y,{className:`w-8 h-8 text-bambu-green animate-spin`})}):(0,G.jsxs)(`div`,{children:[m&&(0,G.jsxs)(`div`,{className:`flex items-center justify-between p-3 mb-6 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-2 h-2 rounded-full bg-bambu-green animate-pulse`}),(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:d?.email?(0,G.jsxs)(G.Fragment,{children:[e(`profiles.orcaCloud.connectedAs`),` `,(0,G.jsx)(`span`,{className:`text-white`,children:d.email})]}):(0,G.jsx)(`span`,{className:`text-white`,children:e(`profiles.orcaCloud.connectedShort`)})})]}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:()=>D.mutate(),disabled:D.isPending||!i,title:i?void 0:e(`profiles.orcaCloud.noLogoutPermission`),children:[(0,G.jsx)(Qc,{className:`w-4 h-4`}),e(`profiles.orcaCloud.logout`)]})]}),m?g?(0,G.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,G.jsx)(Y,{className:`w-8 h-8 text-bambu-green animate-spin`})}):y?(0,G.jsxs)(`div`,{className:`text-center py-16`,children:[(0,G.jsx)(`p`,{className:`text-bambu-gray mb-4`,children:y.message}),(0,G.jsx)(Q,{onClick:()=>_(),children:e(`profiles.orcaCloud.retry`)})]}):h?(0,G.jsx)(tqe,{settings:h,lastSyncTime:S,onRefresh:()=>_(),isRefreshing:v,printers:x,t:e}):null:(0,G.jsx)(aqe,{pairing:a,connectError:l,onConnect:()=>E.mutate(),onCancel:w,isStarting:E.isPending,canManage:i,t:e})]})}function aqe({pairing:e,connectError:t,onConnect:n,onCancel:r,isStarting:i,canManage:a,t:o}){return e?(0,G.jsx)(zd,{children:(0,G.jsxs)(Vd,{className:`p-8 text-center max-w-md mx-auto`,children:[(0,G.jsx)(Ds,{className:`w-12 h-12 text-bambu-green mx-auto mb-4`}),(0,G.jsx)(`h2`,{className:`text-xl font-bold text-white mb-2`,children:o(`profiles.orcaCloud.device.title`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray mb-6`,children:o(`profiles.orcaCloud.device.instruction`)}),(0,G.jsx)(`p`,{className:`text-xs uppercase tracking-wide text-bambu-gray mb-2`,children:o(`profiles.orcaCloud.device.codeLabel`)}),(0,G.jsx)(`div`,{className:`mb-6 py-3 px-4 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg`,children:(0,G.jsx)(`span`,{className:`text-2xl font-mono font-bold tracking-[0.3em] text-white select-all`,children:e.user_code})}),(0,G.jsx)(`a`,{href:e.verification_uri_complete,target:`_blank`,rel:`noopener noreferrer`,children:(0,G.jsxs)(Q,{className:`w-full mb-3`,children:[(0,G.jsx)(Xs,{className:`w-4 h-4`}),o(`profiles.orcaCloud.device.openButton`)]})}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray break-all mb-6`,children:o(`profiles.orcaCloud.device.manualHint`,{url:e.verification_uri})}),(0,G.jsxs)(`div`,{className:`flex items-center justify-center gap-2 text-sm text-bambu-gray mb-4`,children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin text-bambu-green`}),o(`profiles.orcaCloud.device.waiting`)]}),(0,G.jsx)(`button`,{type:`button`,onClick:r,className:`text-bambu-gray hover:text-white text-sm`,children:o(`profiles.orcaCloud.device.cancel`)})]})}):(0,G.jsx)(zd,{children:(0,G.jsxs)(Vd,{className:`p-8 text-center`,children:[(0,G.jsx)(Ds,{className:`w-12 h-12 text-bambu-green mx-auto mb-4`}),(0,G.jsx)(`h2`,{className:`text-xl font-bold text-white mb-2`,children:o(`profiles.orcaCloud.connect.title`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray mb-6 max-w-xl mx-auto`,children:o(`profiles.orcaCloud.connect.description`)}),(0,G.jsxs)(`div`,{className:`max-w-sm mx-auto`,children:[(0,G.jsxs)(Q,{onClick:n,disabled:i||!a,title:a?void 0:o(`profiles.orcaCloud.noConnectPermission`),className:`w-full`,children:[i?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(is,{className:`w-4 h-4`}),o(`profiles.orcaCloud.connectButton`)]}),t&&(0,G.jsxs)(`p`,{className:`mt-3 text-sm text-red-700 dark:text-red-400 flex items-center justify-center gap-2`,children:[(0,G.jsx)(fs,{className:`w-4 h-4 flex-shrink-0`}),t]})]})]})})}function g5(e,t){let n=`${e} ${t||``}`,r=n.match(/@?\s*(?:BBL\s+)?(?:Bambu\s+Lab\s+)?([XPAH][1-9][A-Z]?(?:\s*(?:Carbon|mini))?|H2D)/i),i=r?r[1].trim():null,a=n.match(/(\d+\.?\d*)\s*(?:mm\s*)?nozzle|nozzle\s*(\d+\.?\d*)/i),o=a?(a[1]||a[2])+`mm`:null,s=n.match(/(\d+\.?\d*)mm\s*(?:Standard|Fine|Extra Fine|Draft|Quality)?/i),c=s?s[1]+`mm`:null,l=n.match(/\b(PLA|PETG|ABS|ASA|TPU|PC|PA|PVA|HIPS|PP|PET(?:-?CF)?|PA(?:-?CF)?|PLA(?:-?CF)?)\b/i);return{printer:i,nozzle:o,layerHeight:c,filamentType:l?l[1].toUpperCase():null}}function _5(e){return/^(P[FPM]US|PF\d|PP\d)/.test(e)}function oqe({onSuccess:e,t}){let{showToast:n}=qd(),[r,i]=(0,f.useState)(`email`),[a,o]=(0,f.useState)(``),[s,c]=(0,f.useState)(``),[l,u]=(0,f.useState)(``),[d,p]=(0,f.useState)(``),[m,h]=(0,f.useState)(`global`),[g,_]=(0,f.useState)(null),[v,y]=(0,f.useState)(null),[b,x]=(0,f.useState)(!1),S=q({mutationFn:()=>Z.cloudLogin(a,s,m),onSuccess:r=>{if(x(r.reason===`captcha`),r.success)n(t(`profiles.login.toast.loggedIn`)),e();else if(r.reason===`captcha`)return;else r.needs_verification?(_(r.verification_type||`email`),y(r.tfa_key||null),r.verification_type===`totp`?n(t(`profiles.login.toast.enterTotp`)):n(t(`profiles.login.toast.codeSent`)),i(`code`)):n(r.message,`error`)},onError:e=>{x(!1),n(e.message,`error`)}}),C=q({mutationFn:()=>Z.cloudVerify(a,l,v||void 0,m),onSuccess:r=>{x(r.reason===`captcha`),r.success?(n(t(`profiles.login.toast.loggedIn`)),e()):r.reason!==`captcha`&&n(r.message,`error`)},onError:e=>{x(!1),n(e.message,`error`)}}),w=q({mutationFn:()=>Z.cloudSetToken(d,m),onSuccess:()=>{n(t(`profiles.login.toast.tokenSet`)),e()},onError:e=>n(e.message,`error`)}),T=e=>{e.preventDefault(),r===`email`?S.mutate():r===`code`?C.mutate():r===`token`&&w.mutate()},E=S.isPending||C.isPending||w.isPending;return(0,G.jsx)(zd,{className:`max-w-md mx-auto`,children:(0,G.jsxs)(Vd,{children:[(0,G.jsxs)(`div`,{className:`text-center mb-6`,children:[(0,G.jsx)(`div`,{className:`inline-flex items-center justify-center w-12 h-12 rounded-xl bg-bambu-green/20 mb-3`,children:(0,G.jsx)(Ds,{className:`w-6 h-6 text-bambu-green`})}),(0,G.jsx)(`h2`,{className:`text-xl font-semibold text-white`,children:t(`profiles.login.title`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:t(`profiles.login.subtitle`)})]}),b&&r!==`token`&&(0,G.jsx)(`div`,{role:`alert`,className:`mb-4 p-3 rounded-lg border border-amber-500/40 bg-amber-500/10`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(Ql,{className:`w-4 h-4 text-amber-400 shrink-0 mt-0.5`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-sm font-medium text-amber-300`,children:t(`profiles.login.captchaTitle`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:t(`profiles.login.captchaBody`)}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>{x(!1),i(`token`)},className:`mt-2 text-xs text-bambu-green hover:underline flex items-center gap-1`,children:[(0,G.jsx)(Bc,{className:`w-3 h-3`}),t(`profiles.login.useToken`)]})]})]})}),(0,G.jsxs)(`form`,{onSubmit:T,className:`space-y-4`,children:[r===`email`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:t(`profiles.login.email`)}),(0,G.jsx)(`input`,{type:`email`,value:a,onChange:e=>o(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray-dark focus:border-bambu-green focus:outline-none`,placeholder:`your@email.com`,required:!0})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:t(`profiles.login.password`)}),(0,G.jsx)(`input`,{type:`password`,value:s,onChange:e=>c(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray-dark focus:border-bambu-green focus:outline-none`,placeholder:`••••••••`,required:!0})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:t(`profiles.login.region`)}),(0,G.jsxs)(`select`,{value:m,onChange:e=>h(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,G.jsx)(`option`,{value:`global`,children:t(`profiles.login.regionGlobal`)}),(0,G.jsx)(`option`,{value:`china`,children:t(`profiles.login.regionChina`)})]})]})]}),r===`code`&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:t(g===`totp`?`profiles.login.totpCode`:`profiles.login.verificationCode`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mb-2`,children:g===`totp`?t(`profiles.login.enterTotpHint`):t(`profiles.login.checkEmail`,{email:a})}),(0,G.jsx)(`input`,{type:`text`,value:l,onChange:e=>u(e.target.value.replace(/\D/g,``).slice(0,6)),className:`w-full px-3 py-3 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-center text-2xl tracking-widest font-mono focus:border-bambu-green focus:outline-none`,placeholder:`000000`,maxLength:6,required:!0})]}),r===`token`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:t(`profiles.login.accessToken`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mb-2`,children:t(`profiles.login.accessTokenHint`)}),(0,G.jsx)(`textarea`,{value:d,onChange:e=>p(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-xs font-mono placeholder-bambu-gray-dark focus:border-bambu-green focus:outline-none resize-none`,placeholder:`eyJ...`,rows:4,required:!0})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:t(`profiles.login.region`)}),(0,G.jsxs)(`select`,{value:m,onChange:e=>h(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,children:[(0,G.jsx)(`option`,{value:`global`,children:t(`profiles.login.regionGlobal`)}),(0,G.jsx)(`option`,{value:`china`,children:t(`profiles.login.regionChina`)})]})]})]}),(0,G.jsxs)(`div`,{className:`flex gap-2 max-[550px]:flex-wrap max-[550px]:items-center`,children:[r===`code`&&(0,G.jsx)(Q,{type:`button`,variant:`secondary`,onClick:()=>i(`email`),className:`flex-1`,children:t(`profiles.login.back`)}),(0,G.jsxs)(Q,{type:`submit`,disabled:E,className:`flex-1`,children:[E?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(Zc,{className:`w-4 h-4`}),t(r===`email`?`profiles.login.loginButton`:r===`code`?`profiles.login.verifyButton`:`profiles.login.setTokenButton`)]})]}),r===`email`&&(0,G.jsx)(`div`,{className:`pt-4 border-t border-bambu-dark-tertiary`,children:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>i(`token`),className:`text-sm text-bambu-gray hover:text-white flex items-center gap-2 transition-colors`,children:[(0,G.jsx)(Bc,{className:`w-4 h-4`}),t(`profiles.login.useToken`)]})}),r===`token`&&(0,G.jsx)(`div`,{className:`pt-4 border-t border-bambu-dark-tertiary`,children:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>i(`email`),className:`text-sm text-bambu-gray hover:text-white flex items-center gap-2 transition-colors`,children:[(0,G.jsx)(Zc,{className:`w-4 h-4`}),t(`profiles.login.useEmail`)]})})]})]})})}function v5({label:e,value:t,options:n,onChange:r}){let[i,a]=(0,f.useState)(!1),o=n.find(e=>e.value===t);return(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsxs)(`button`,{onClick:()=>a(!i),className:`flex items-center gap-2 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-sm text-white hover:border-bambu-gray-dark transition-colors`,children:[(0,G.jsxs)(`span`,{className:`text-bambu-gray`,children:[e,`:`]}),(0,G.jsx)(`span`,{children:o?.label||`All`}),(0,G.jsx)(as,{className:`w-4 h-4 text-bambu-gray transition-transform ${i?`rotate-180`:``}`})]}),i&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`fixed inset-0 z-10`,onClick:()=>a(!1)}),(0,G.jsx)(`div`,{className:`absolute top-full left-0 mt-1 min-w-[160px] bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl z-20 py-1 max-h-60 overflow-y-auto`,children:n.map(e=>(0,G.jsxs)(`button`,{onClick:()=>{r(e.value),a(!1)},className:`w-full px-3 py-2 text-left text-sm flex items-center justify-between hover:bg-bambu-dark-tertiary transition-colors ${t===e.value?`text-bambu-green`:`text-white`}`,children:[(0,G.jsx)(`span`,{children:e.label}),e.count!==void 0&&(0,G.jsx)(`span`,{className:`text-bambu-gray text-xs`,children:e.count})]},e.value))})]})]})}function sqe(){let[e,t]=(0,f.useState)(!1);return(0,f.useEffect)(()=>{let e=()=>{t(window.scrollY>300)};return window.addEventListener(`scroll`,e),()=>window.removeEventListener(`scroll`,e)},[]),e?(0,G.jsx)(`button`,{onClick:()=>{window.scrollTo({top:0,behavior:`smooth`})},className:`fixed bottom-24 right-6 p-3 bg-bambu-green hover:bg-bambu-green-light text-white rounded-full shadow-lg shadow-bambu-green/25 transition-all z-40`,"aria-label":`Scroll to top`,children:(0,G.jsx)(Io,{className:`w-5 h-5`})}):null}function y5({setting:e,onClick:t,onDuplicate:n,compareMode:r,isCompareSelected:i,compareIndex:a,compareDisabled:o,t:s}){let c=g5(e.name),l=_5(e.setting_id);return(0,G.jsxs)(`div`,{className:`flex items-center gap-2 group`,children:[(0,G.jsx)(`button`,{onClick:t,disabled:o,className:`flex-1 text-left px-3 py-2 rounded transition-colors ${i?`bg-blue-500/20 border border-blue-500/50`:o?`bg-bambu-dark/50 opacity-40 cursor-not-allowed`:`bg-bambu-dark hover:bg-bambu-dark-tertiary`} ${r&&!o?`cursor-pointer`:``}`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i&&a!==void 0&&(0,G.jsx)(`span`,{className:`flex-shrink-0 w-5 h-5 rounded-full bg-blue-500 text-white text-xs flex items-center justify-center font-medium`,children:a+1}),!i&&l&&(0,G.jsx)(`span`,{className:`flex-shrink-0 w-1.5 h-1.5 rounded-full bg-bambu-green`,title:s(`profiles.presets.myPreset`)}),(0,G.jsx)(`span`,{className:`text-white text-sm truncate flex-1`,title:e.name,children:e.name}),c.filamentType&&e.type===`filament`&&(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray whitespace-nowrap`,children:c.filamentType}),c.layerHeight&&e.type===`process`&&(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray whitespace-nowrap`,children:c.layerHeight}),c.printer&&(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray whitespace-nowrap`,children:c.printer})]})}),(0,G.jsx)(`button`,{onClick:e=>{e.stopPropagation(),n()},className:`can-hover:opacity-0 group-hover:opacity-100 focus-visible:opacity-100 text-bambu-gray hover:text-white transition-all p-1`,title:s(`profiles.presets.duplicate`),children:(0,G.jsx)(Ps,{className:`w-4 h-4`})})]})}function b5(e,t=0){let n=` `.repeat(t);if(e===null)return`null`;if(e===void 0)return`undefined`;if(typeof e==`string`){if(e.includes(`\\n`)||e.includes(` `)){let t=e.replace(/\\n/g,` `).replace(/\\"/g,`"`).replace(/\\t/g,` `).split(` `);if(t.length>1)return`""" @@ -4399,7 +4399,7 @@ img.ProseMirror-separator { `});++r0&&n.push({type:`text`,value:` `}),n}function DQe(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function OQe(e,t){let n=SQe(e,t),r=n.one(e,void 0),i=lQe(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:` -`},i)),a}function kQe(e,t){return e&&`run`in e?async function(n,r){let i=OQe(n,{file:r,...t});await e.run(i,r)}:function(n,r){return OQe(n,{file:r,...e||t})}}function AQe(e){if(e)throw e}var jQe=r(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});ft.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var I7={basename:PQe,dirname:FQe,extname:IQe,join:LQe,sep:`/`};function PQe(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);L7(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function FQe(e){if(L7(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function IQe(e){L7(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function LQe(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function zQe(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function L7(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var BQe={cwd:VQe};function VQe(){return`/`}function R7(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function HQe(e){if(typeof e==`string`)e=new URL(e);else if(!R7(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return UQe(e)}function UQe(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n0){let[r,...a]=t,o=n[i][1];F7(o)&&F7(r)&&(r=(0,H7.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function U7(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function W7(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function G7(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function XQe(e){if(!F7(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function ZQe(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function K7(e){return QQe(e)?e:new WQe(e)}function QQe(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function $Qe(e){return typeof e==`string`||e$e(e)}function e$e(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var t$e=[],n$e={allowDangerousHtml:!0},r$e=/^(https?|ircs?|mailto|xmpp)$/i,i$e=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function a$e(e){let t=o$e(e),n=s$e(e);return c$e(t.runSync(t.parse(n),n),e)}function o$e(e){let t=e.rehypePlugins||t$e,n=e.remarkPlugins||t$e,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...n$e}:n$e;return YQe().use(xZe).use(n).use(kQe,r).use(t)}function s$e(e){let t=e.children||``,n=new WQe;return typeof t==`string`?n.value=t:``+t,n}function c$e(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||l$e;for(let e of i$e)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return t.className&&(e={type:`element`,tagName:`div`,properties:{className:t.className},children:e.type===`root`?e.children:[e]}),bQe(e,l),DJe(e,{Fragment:G.Fragment,components:i,ignoreInvalidStyle:!0,jsx:G.jsx,jsxs:G.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in t7)if(Object.hasOwn(t7,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=t7[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function l$e(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||r$e.test(e.slice(0,t))?e:``}y$e.peek=v$e;function u$e(){this.buffer()}function d$e(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function f$e(){this.buffer()}function p$e(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function m$e(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=a7(this.sliceSerialize(e)).toLowerCase(),n.label=t}function h$e(e){this.exit(e)}function g$e(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=a7(this.sliceSerialize(e)).toLowerCase(),n.label=t}function _$e(e){this.exit(e)}function v$e(){return`[`}function y$e(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function b$e(){return{enter:{gfmFootnoteCallString:u$e,gfmFootnoteCall:d$e,gfmFootnoteDefinitionLabelString:f$e,gfmFootnoteDefinition:p$e},exit:{gfmFootnoteCallString:m$e,gfmFootnoteCall:h$e,gfmFootnoteDefinitionLabelString:g$e,gfmFootnoteDefinition:_$e}}}w$e.peek=T$e;function x$e(){return{canContainEols:[`delete`],enter:{strikethrough:S$e},exit:{strikethrough:C$e}}}function S$e(e){this.enter({type:`delete`,children:[]},e)}function C$e(e){this.exit(e)}function w$e(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function T$e(){return`~`}function E$e(){return{enter:{table:D$e,tableData:J7,tableHeader:J7,tableRow:k$e},exit:{codeText:A$e,table:O$e,tableData:q7,tableHeader:q7,tableRow:q7}}}function D$e(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function O$e(e){this.exit(e),this.data.inTable=void 0}function k$e(e){this.enter({type:`tableRow`,children:[]},e)}function q7(e){this.exit(e)}function J7(e){this.enter({type:`tableCell`,children:[]},e)}function A$e(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,j$e));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function j$e(e,t){return t===`|`?t:e}function M$e(){return{exit:{taskListCheckValueChecked:N$e,taskListCheckValueUnchecked:N$e,paragraph:P$e}}}function N$e(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function P$e(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i999||s===93&&!o||s===null||s===91||d7(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(a7(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return d7(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function B$e(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||d7(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=a7(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return d7(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),h7(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function V$e(e,t,n){return e.check(y7,t,e.attempt(F$e,t,n))}function H$e(e){e.exit(`gfmFootnoteDefinition`)}function U$e(e,t,n){let r=this;return h7(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function W$e(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=g7(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var G$e=class{constructor(){this.map=[]}add(e,t,n){K$e(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function K$e(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):u7(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):f7(t)?h7(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||d7(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,f7(t)?h7(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return f7(t)?h7(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||u7(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return f7(t)?h7(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||u7(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||u7(n)?(e.exit(`tableRow`),t(n)):f7(n)?h7(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||d7(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function X$e(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new G$e;for(;++nn[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},X7(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function Z$e(e,t,n,r,i){let a=[],o=X7(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function X7(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var Q$e={name:`tasklistCheck`,tokenize:e1e};function $$e(){return{text:{91:Q$e}}}function e1e(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return d7(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return u7(r)?t(r):f7(r)?e.check({tokenize:t1e},t,n)(r):n(r)}}function t1e(e,t,n){return h7(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function n1e(){let e=this.data(),t=e.micromarkExtensions||=[],n=e.fromMarkdownExtensions||=[];t.push(I$e(),W$e(),J$e(),$$e()),n.push(b$e(),x$e(),E$e(),M$e())}var r1e=`fileManager.readmeCollapsed`;function i1e({folderId:e}){let{t}=U(),[n,r]=(0,f.useState)(()=>localStorage.getItem(r1e)===`1`);(0,f.useEffect)(()=>{localStorage.setItem(r1e,n?`1`:`0`)},[n]);let{data:i,isLoading:a,error:o}=K({queryKey:[`folder-readme`,e],queryFn:()=>Z.getLibraryFolderReadme(e),retry:!1,staleTime:3e4});return a||o||!i?null:n?(0,G.jsxs)(`div`,{className:`mb-2 lg:mb-0 order-first lg:order-none lg:w-10 lg:flex-shrink-0 lg:h-full`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>r(!1),title:t(`fileManager.readme.show`),"aria-label":t(`fileManager.readme.show`),className:`flex lg:hidden w-full items-center gap-2 px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg hover:bg-bambu-dark/40 transition-colors`,children:[(0,G.jsx)(ac,{className:`w-4 h-4 text-bambu-green flex-shrink-0`}),(0,G.jsx)(`span`,{className:`text-sm font-medium text-white truncate`,children:i.filename}),(0,G.jsx)(bl,{className:`w-4 h-4 text-bambu-gray flex-shrink-0 ml-auto`})]}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>r(!1),title:t(`fileManager.readme.show`),"aria-label":t(`fileManager.readme.show`),className:`hidden lg:flex h-full w-10 flex-col items-center gap-2 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg hover:bg-bambu-dark/40 transition-colors`,children:[(0,G.jsx)(bl,{className:`w-4 h-4 text-bambu-green flex-shrink-0`}),(0,G.jsx)(`span`,{className:`text-xs font-medium text-bambu-gray [writing-mode:vertical-rl] rotate-180 select-none`,children:t(`fileManager.readme.label`)})]})]}):(0,G.jsxs)(`div`,{className:`mb-4 lg:mb-0 order-first lg:order-none lg:w-80 xl:w-96 lg:flex-shrink-0 lg:h-full flex flex-col bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,G.jsx)(ac,{className:`w-4 h-4 text-bambu-green flex-shrink-0`}),(0,G.jsx)(`span`,{className:`text-sm font-medium text-white truncate`,title:i.filename,children:i.filename}),i.truncated&&(0,G.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded bg-amber-100 dark:bg-amber-500/20 text-amber-700 dark:text-amber-400 flex-shrink-0`,children:t(`fileManager.readme.truncated`)})]}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>r(!0),title:t(`fileManager.readme.hide`),"aria-label":t(`fileManager.readme.hide`),className:`p-1 rounded text-bambu-gray hover:text-white hover:bg-bambu-dark/40 transition-colors flex-shrink-0`,children:(0,G.jsx)(yl,{className:`w-4 h-4`})})]}),(0,G.jsx)(`div`,{className:`px-4 py-3 border-t border-bambu-dark-tertiary flex-1 overflow-y-auto max-h-96 lg:max-h-none text-sm text-bambu-gray-light leading-relaxed space-y-2`,children:(0,G.jsx)(a$e,{remarkPlugins:[n1e],components:{h1:({children:e})=>(0,G.jsx)(`h1`,{className:`text-lg font-semibold text-white mt-2 mb-1`,children:e}),h2:({children:e})=>(0,G.jsx)(`h2`,{className:`text-base font-semibold text-white mt-2 mb-1`,children:e}),h3:({children:e})=>(0,G.jsx)(`h3`,{className:`text-sm font-semibold text-white mt-2 mb-1`,children:e}),p:({children:e})=>(0,G.jsx)(`p`,{className:`my-1`,children:e}),ul:({children:e})=>(0,G.jsx)(`ul`,{className:`list-disc list-inside space-y-0.5 ml-2`,children:e}),ol:({children:e})=>(0,G.jsx)(`ol`,{className:`list-decimal list-inside space-y-0.5 ml-2`,children:e}),li:({children:e})=>(0,G.jsx)(`li`,{children:e}),code:({children:e,...t})=>t.className?(0,G.jsx)(`code`,{className:`block p-2 bg-bambu-dark rounded text-xs font-mono text-bambu-gray-light overflow-x-auto`,children:e}):(0,G.jsx)(`code`,{className:`px-1 py-0.5 bg-bambu-dark rounded text-xs font-mono text-bambu-green`,children:e}),pre:({children:e})=>(0,G.jsx)(`pre`,{className:`my-2`,children:e}),blockquote:({children:e})=>(0,G.jsx)(`blockquote`,{className:`border-l-2 border-bambu-dark-tertiary pl-3 text-bambu-gray italic`,children:e}),a:({children:e,href:t})=>(0,G.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,className:`text-bambu-green hover:underline`,children:e}),table:({children:e})=>(0,G.jsx)(`div`,{className:`overflow-x-auto`,children:(0,G.jsx)(`table`,{className:`min-w-full text-xs border-collapse`,children:e})}),th:({children:e})=>(0,G.jsx)(`th`,{className:`border border-bambu-dark-tertiary px-2 py-1 text-left font-semibold text-white`,children:e}),td:({children:e})=>(0,G.jsx)(`td`,{className:`border border-bambu-dark-tertiary px-2 py-1`,children:e}),hr:()=>(0,G.jsx)(`hr`,{className:`border-bambu-dark-tertiary my-2`})},children:i.content})})]})}function a1e({open:e,onClose:t,onPickTag:n}){let{t:r}=U(),i=no(),{showToast:a}=qd(),[o,s]=(0,f.useState)(!1),[c,l]=(0,f.useState)(null),[u,d]=(0,f.useState)(``),[p,m]=(0,f.useState)(null),{data:h=[],isLoading:g}=K({queryKey:A5,queryFn:Z.getLibraryTags,enabled:e}),_=()=>{i.invalidateQueries({queryKey:A5}),i.invalidateQueries({queryKey:[`library-files`]})},v=q({mutationFn:async()=>{let e=u.trim();if(!e)throw Error(r(`fileManager.tags.nameRequired`));return c?Z.updateLibraryTag(c.id,e):Z.createLibraryTag(e)},onSuccess:()=>{a(r(c?`fileManager.tags.updated`:`fileManager.tags.created`),`success`),s(!1),l(null),d(``),_()},onError:e=>{a(e.message||r(`fileManager.tags.saveFailed`),`error`)}}),y=q({mutationFn:e=>Z.deleteLibraryTag(e),onSuccess:()=>{a(r(`fileManager.tags.deleted`),`success`),m(null),_()},onError:e=>{a(e.message||r(`fileManager.tags.deleteFailed`),`error`)}}),b=()=>{l(null),d(``),s(!0)},x=e=>{l(e),d(e.name),s(!0)},S=(0,f.useCallback)(()=>{v.isPending||(s(!1),l(null),d(``))},[v.isPending]);(0,f.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&(v.isPending||y.isPending||(o?S():p||t()))};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,o,p,v.isPending,y.isPending,S,t]);let C=e=>{e.preventDefault(),v.mutate()};if(!e)return null;let w=`library-tags-modal-title`,T=`library-tag-editor-title`;return(0,G.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[(0,G.jsx)(`div`,{className:`absolute inset-0 bg-black/60`,onClick:()=>{v.isPending||y.isPending||t()}}),(0,G.jsxs)(`div`,{className:`relative w-full max-w-4xl mx-4 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-xl shadow-2xl max-h-[90vh] flex flex-col`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":w,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-4 px-6 py-4 border-b border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`h2`,{id:w,className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(xu,{className:`w-5 h-5 text-bambu-green`}),r(`fileManager.tags.title`)]}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-sm mt-0.5`,children:r(`fileManager.tags.subtitle`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(Q,{onClick:b,children:[(0,G.jsx)(kl,{className:`w-4 h-4`}),r(`fileManager.tags.add`)]}),(0,G.jsx)(`button`,{type:`button`,className:`p-1.5 text-bambu-gray hover:text-white rounded`,onClick:t,"aria-label":r(`common.close`),children:(0,G.jsx)($u,{className:`w-5 h-5`})})]})]}),(0,G.jsx)(`div`,{className:`overflow-y-auto`,children:g?(0,G.jsxs)(`div`,{className:`flex items-center justify-center py-16 text-bambu-gray`,children:[(0,G.jsx)(Y,{className:`w-6 h-6 animate-spin mr-2`}),r(`common.loading`)]}):h.length===0?(0,G.jsx)(`div`,{className:`py-16 text-center text-bambu-gray`,children:r(`fileManager.tags.empty`)}):(0,G.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary text-left text-bambu-gray`,children:[(0,G.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:r(`fileManager.tags.name`)}),(0,G.jsx)(`th`,{className:`px-4 py-3 font-medium text-right`,children:r(`fileManager.tags.fileCount`)}),(0,G.jsx)(`th`,{className:`px-4 py-3 font-medium text-right w-32`,children:r(`common.actions`)})]})}),(0,G.jsx)(`tbody`,{children:h.map(e=>(0,G.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary/60 hover:bg-bambu-dark-tertiary/30 ${n?`cursor-pointer`:``}`,onClick:()=>{n&&(n(e.id),t())},children:[(0,G.jsx)(`td`,{className:`px-4 py-3 text-white font-medium`,children:e.name}),(0,G.jsx)(`td`,{className:`px-4 py-3 text-right text-bambu-gray`,children:e.file_count}),(0,G.jsx)(`td`,{className:`px-4 py-3 text-right`,onClick:e=>e.stopPropagation(),children:(0,G.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[(0,G.jsx)(`button`,{type:`button`,className:`p-1.5 text-bambu-gray hover:text-bambu-green rounded`,onClick:()=>x(e),title:r(`common.edit`),"aria-label":r(`fileManager.tags.editAria`,{name:e.name}),children:(0,G.jsx)(wl,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{type:`button`,className:`p-1.5 text-bambu-gray hover:text-red-600 dark:hover:text-red-400 rounded`,onClick:()=>m(e),title:r(`common.delete`),"aria-label":r(`fileManager.tags.deleteAria`,{name:e.name}),children:(0,G.jsx)(ju,{className:`w-4 h-4`})})]})})]},e.id))})]})})]}),o&&(0,G.jsxs)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center`,children:[(0,G.jsx)(`div`,{className:`absolute inset-0 bg-black/60`,onClick:S}),(0,G.jsxs)(`div`,{className:`relative w-full max-w-md mx-4 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-xl p-6 shadow-2xl`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":T,children:[(0,G.jsx)(`h3`,{id:T,className:`text-lg font-semibold text-white mb-4`,children:r(c?`fileManager.tags.edit`:`fileManager.tags.add`)}),(0,G.jsxs)(`form`,{onSubmit:C,children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,htmlFor:`library-tag-name`,children:r(`fileManager.tags.name`)}),(0,G.jsx)(`input`,{id:`library-tag-name`,type:`text`,maxLength:64,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green mb-4`,placeholder:r(`fileManager.tags.createPlaceholder`),value:u,onChange:e=>d(e.target.value),autoFocus:!0}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,G.jsx)(Q,{type:`button`,variant:`secondary`,onClick:S,children:r(`common.cancel`)}),(0,G.jsxs)(Q,{type:`submit`,disabled:v.isPending||!u.trim(),children:[v.isPending&&(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),r(`common.save`)]})]})]})]})]}),p&&(0,G.jsx)(af,{title:r(`fileManager.tags.confirmDelete`,{name:p.name}),message:p.file_count>0?r(`fileManager.tags.confirmDeleteInUseMessage`,{count:p.file_count}):r(`fileManager.tags.confirmDeleteMessage`),confirmText:r(`common.delete`),variant:`danger`,isLoading:y.isPending,onConfirm:()=>y.mutate(p.id),onCancel:()=>m(null)})]})}function o1e({file:e,canEdit:t,onClose:n}){let{t:r}=U(),{showToast:i}=qd(),a=no(),{data:o}=K({queryKey:[`library-file`,e.id],queryFn:()=>Z.getLibraryFile(e.id)}),[s,c]=(0,f.useState)(``),[l,u]=(0,f.useState)(``),[d,p]=(0,f.useState)([]),[m,h]=(0,f.useState)(!1),[g,_]=(0,f.useState)(null),v=(0,f.useRef)(null),y=(0,f.useRef)(null);(0,f.useEffect)(()=>{!o||y.current===o.id||(y.current=o.id,c(o.notes??``),u(o.external_url??``),p(o.photos??[]))},[o]),(0,f.useEffect)(()=>{if(g!==null)return;let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[g,n]);let b=()=>{a.invalidateQueries({queryKey:[`library-files`]}),a.invalidateQueries({queryKey:[`library-file`,e.id]})},x=q({mutationFn:()=>Z.updateLibraryFile(e.id,{notes:s,external_url:l.trim()}),onSuccess:()=>{b(),i(r(`fileManager.details.saved`),`success`),n()},onError:()=>{i(r(`fileManager.details.saveFailed`),`error`)}}),S=!!o&&(s!==(o.notes??``)||l.trim()!==(o.external_url??``)),C=async t=>{let n=t.target.files?.[0];if(n){h(!0);try{p((await Z.uploadLibraryFilePhoto(e.id,n)).photos),b()}catch{i(r(`fileManager.details.uploadFailed`),`error`)}finally{h(!1),v.current&&(v.current.value=``)}}},w=async t=>{try{let n=(await Z.deleteLibraryFilePhoto(e.id,t)).photos??[];p(n),n.length===0&&_(null),b()}catch{i(r(`fileManager.details.deleteFailed`),`error`)}},T=e=>{e.preventDefault(),!(!t||!S)&&x.mutate()},E=l.trim(),D=[{label:r(`fileManager.details.size`),value:Gd(e.file_size)},{label:r(`fileManager.details.type`),value:e.file_type.toUpperCase()}];return o?.print_name&&D.push({label:r(`fileManager.details.printName`),value:o.print_name}),o?.print_time_seconds&&D.push({label:r(`fileManager.details.printTime`),value:ap(o.print_time_seconds)}),o?.filament_used_grams&&D.push({label:r(`fileManager.details.filament`),value:`${o.filament_used_grams.toFixed(1)} g`}),o?.sliced_for_model&&D.push({label:r(`fileManager.details.slicedFor`),value:o.sliced_for_model}),o?.source_url&&D.push({label:r(`fileManager.details.source`),value:(0,G.jsxs)(`a`,{href:o.source_url,target:`_blank`,rel:`noopener noreferrer`,className:`text-bambu-green hover:underline inline-flex items-center gap-1 min-w-0`,children:[(0,G.jsx)(`span`,{className:`truncate`,children:o.source_url}),(0,G.jsx)(Xs,{className:`w-3 h-3 flex-shrink-0`})]})}),D.push({label:r(`fileManager.details.created`),value:ep(e.created_at)}),D.push({label:r(`fileManager.details.modified`),value:ep(e.fs_modified_at??o?.updated_at??e.created_at)}),(0,G.jsxs)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,onClick:n,children:[(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary w-full max-w-lg max-h-[90vh] flex flex-col`,onClick:e=>e.stopPropagation(),children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-6 py-4 border-b border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:r(`fileManager.details.title`)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white truncate`,title:e.filename,children:e.filename}),(0,G.jsx)(`span`,{className:`flex-shrink-0 text-xs px-1.5 py-0.5 rounded font-medium bg-bambu-dark-tertiary text-bambu-gray`,children:e.file_type.toUpperCase()})]})]}),(0,G.jsx)(`button`,{type:`button`,onClick:n,className:`text-bambu-gray hover:text-white transition-colors flex-shrink-0`,"aria-label":r(`common.close`),children:(0,G.jsx)($u,{className:`w-5 h-5`})})]}),(0,G.jsxs)(`form`,{onSubmit:T,className:`p-6 space-y-4 overflow-y-auto flex-1`,children:[(0,G.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 text-sm`,children:D.map(e=>(0,G.jsxs)(`div`,{className:`contents`,children:[(0,G.jsx)(`dt`,{className:`text-bambu-gray whitespace-nowrap`,children:e.label}),(0,G.jsx)(`dd`,{className:`text-white min-w-0 truncate`,children:e.value})]},e.label))}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:[(0,G.jsx)(_u,{className:`w-4 h-4 inline mr-1`}),r(`fileManager.details.notes`)]}),(0,G.jsx)(`textarea`,{value:s,onChange:e=>c(e.target.value),rows:3,disabled:!t,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none resize-none disabled:opacity-60`,placeholder:r(`fileManager.details.notesPlaceholder`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:[(0,G.jsx)(Gc,{className:`w-4 h-4 inline mr-1`}),r(`fileManager.details.externalLink`)]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{type:`url`,value:l,onChange:e=>u(e.target.value),disabled:!t,className:`flex-1 min-w-0 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none disabled:opacity-60`,placeholder:r(`fileManager.details.externalLinkPlaceholder`)}),E&&(0,G.jsx)(`a`,{href:E,target:`_blank`,rel:`noopener noreferrer`,className:`p-2 rounded-lg text-bambu-gray hover:text-bambu-green hover:bg-bambu-dark transition-colors`,title:r(`fileManager.details.openLink`),"aria-label":r(`fileManager.details.openLink`),children:(0,G.jsx)(Xs,{className:`w-4 h-4`})})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:[(0,G.jsx)($o,{className:`w-4 h-4 inline mr-1`}),r(`fileManager.details.photos`)]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[d.map((n,i)=>(0,G.jsxs)(`div`,{className:`relative group`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>_(i),className:`block w-20 h-20 rounded-lg overflow-hidden border border-bambu-dark-tertiary hover:border-bambu-green transition-colors`,children:(0,G.jsx)(`img`,{src:Z.getLibraryFilePhotoUrl(e.id,n),alt:r(`fileManager.details.photos`),className:`w-full h-full object-cover`})}),t&&(0,G.jsx)(`button`,{type:`button`,onClick:()=>w(n),className:`absolute -top-1 -right-1 p-1 bg-red-500 rounded-full can-hover:opacity-0 group-hover:opacity-100 focus-visible:opacity-100 transition-opacity`,title:r(`fileManager.details.deletePhoto`),"aria-label":r(`fileManager.details.deletePhoto`),children:(0,G.jsx)(ju,{className:`w-3 h-3 text-white`})})]},n)),t&&(0,G.jsxs)(`label`,{className:`w-20 h-20 flex items-center justify-center border-2 border-dashed border-bambu-dark-tertiary rounded-lg cursor-pointer hover:border-bambu-green transition-colors`,title:r(`fileManager.details.addPhoto`),children:[(0,G.jsx)(`input`,{ref:v,type:`file`,accept:`image/jpeg,image/png,image/webp`,onChange:C,className:`hidden`,disabled:m,"aria-label":r(`fileManager.details.addPhoto`)}),m?(0,G.jsx)(Y,{className:`w-6 h-6 text-bambu-gray animate-spin`}):(0,G.jsx)(kl,{className:`w-6 h-6 text-bambu-gray`})]}),d.length===0&&!t&&(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:r(`fileManager.details.noPhotos`)})]})]}),(0,G.jsxs)(`div`,{className:`flex gap-3 pt-2`,children:[(0,G.jsx)(Q,{type:`button`,variant:`secondary`,onClick:n,className:`flex-1`,children:r(`common.close`)}),t&&(0,G.jsxs)(Q,{type:`submit`,variant:`primary`,className:`flex-1`,disabled:!S||x.isPending,children:[x.isPending?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(Vl,{className:`w-4 h-4`}),r(`fileManager.details.save`)]})]})]})]}),g!==null&&d.length>0&&(0,G.jsx)(XW,{archiveName:e.filename,photos:d,initialIndex:g,getPhotoUrl:t=>Z.getLibraryFilePhotoUrl(e.id,t),onClose:()=>_(null),onDelete:t?w:void 0})]})}var s1e=90;function c1e({onClose:e}){let{t}=U(),n=no(),{showToast:r}=qd(),[i,a]=(0,f.useState)(s1e),[o,s]=(0,f.useState)(!0),[c,l]=(0,f.useState)(i);(0,f.useEffect)(()=>{let e=window.setTimeout(()=>l(i),300);return()=>window.clearTimeout(e)},[i]);let u=K({queryKey:[`library-purge-preview`,c,o],queryFn:()=>Z.previewLibraryPurge(c,o),enabled:c>=1}),d=q({mutationFn:()=>Z.executeLibraryPurge(i,o),onSuccess:i=>{r(t(`libraryPurge.toast.success`,{count:i.moved_to_trash}),`success`),n.invalidateQueries({queryKey:[`library-files`]}),n.invalidateQueries({queryKey:[`library-folders`]}),n.invalidateQueries({queryKey:[`library-trash`]}),n.invalidateQueries({queryKey:[`library-trash-count`]}),e()},onError:e=>r(e.message||t(`libraryPurge.toast.failed`),`error`)});(0,f.useEffect)(()=>{let t=t=>{t.key===`Escape`&&!d.isPending&&e()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,d.isPending]);let p=u.data,m=p?.count??0,h=p?.total_bytes??0,g=m>0&&!d.isPending;return(0,G.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4`,children:(0,G.jsxs)(`div`,{className:`bg-white dark:bg-gray-900 rounded-lg shadow-xl max-w-lg w-full`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700`,children:[(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-gray-900 dark:text-gray-100 flex items-center gap-2`,children:[(0,G.jsx)(ju,{className:`w-5 h-5`}),t(`libraryPurge.title`)]}),(0,G.jsx)(`button`,{onClick:e,className:`text-gray-400 hover:text-gray-600 dark:hover:text-gray-200`,"aria-label":t(`common.close`),disabled:d.isPending,children:(0,G.jsx)($u,{className:`w-5 h-5`})})]}),(0,G.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,G.jsx)(`p`,{className:`text-sm text-gray-600 dark:text-gray-400`,children:t(`libraryPurge.description`)}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{htmlFor:`purge-days`,className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:t(`libraryPurge.ageLabel`)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`input`,{id:`purge-days`,type:`number`,min:1,max:3650,value:i,onChange:e=>a(Math.max(1,Math.min(3650,parseInt(e.target.value||`0`,10)||0))),className:`w-24 rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-sm px-2 py-1 text-gray-900 dark:text-gray-100`}),(0,G.jsx)(`span`,{className:`text-sm text-gray-600 dark:text-gray-400`,children:t(`libraryPurge.days`)})]})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-gray-700 dark:text-gray-300`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>s(e.target.checked),className:`rounded border-gray-300`}),t(`libraryPurge.includeNeverPrinted`)]}),(0,G.jsxs)(`div`,{className:`rounded border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/30 p-3`,children:[(0,G.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-wide text-gray-600 dark:text-gray-300 mb-2`,children:t(`libraryPurge.effectsTitle`)}),(0,G.jsxs)(`ul`,{className:`text-xs text-gray-700 dark:text-gray-300 space-y-1 list-disc pl-4`,children:[(0,G.jsx)(`li`,{children:t(`libraryPurge.effect1`)}),(0,G.jsx)(`li`,{children:t(`libraryPurge.effect2`)}),(0,G.jsx)(`li`,{children:t(`libraryPurge.effect3`)}),(0,G.jsx)(`li`,{children:t(`libraryPurge.effect4`)})]})]}),(0,G.jsx)(`div`,{className:`rounded border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50 p-3`,children:u.isLoading||u.isFetching?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-gray-500 dark:text-gray-400`,children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),` `,t(`libraryPurge.previewLoading`)]}):u.isError?(0,G.jsx)(`div`,{className:`text-sm text-red-600 dark:text-red-400`,children:u.error?.message??t(`libraryPurge.previewFailed`)}):(0,G.jsxs)(`div`,{className:`text-sm text-gray-900 dark:text-gray-100`,children:[(0,G.jsx)(`div`,{className:`font-medium`,children:t(`libraryPurge.previewSummary`,{count:m,size:Gd(h)})}),p?.sample_filenames&&p.sample_filenames.length>0&&(0,G.jsxs)(`ul`,{className:`mt-2 text-xs text-gray-600 dark:text-gray-400 space-y-0.5 list-disc pl-4`,children:[p.sample_filenames.map(e=>(0,G.jsx)(`li`,{className:`truncate`,children:e},e)),m>p.sample_filenames.length&&(0,G.jsx)(`li`,{className:`list-none italic text-gray-500`,children:t(`libraryPurge.andMore`,{count:m-p.sample_filenames.length})})]})]})}),(0,G.jsxs)(`div`,{className:`flex gap-2 items-start text-xs text-amber-700 dark:text-amber-400 bg-amber-50 dark:bg-amber-900/20 rounded px-3 py-2`,children:[(0,G.jsx)(Pu,{className:`w-4 h-4 mt-0.5 shrink-0`}),(0,G.jsx)(`span`,{children:t(`libraryPurge.warning`)})]})]}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-2 p-4 border-t border-gray-200 dark:border-gray-700`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:e,disabled:d.isPending,children:t(`common.cancel`)}),(0,G.jsx)(Q,{variant:`danger`,disabled:!g,onClick:()=>d.mutate(),children:d.isPending?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin mr-1`}),t(`libraryPurge.purging`)]}):t(`libraryPurge.confirmCta`,{count:m})})]})]})})}var l1e=(0,f.lazy)(()=>Dt(()=>import(`./PdfPreviewModal-CTzoG93b.js`).then(e=>({default:e.PdfPreviewModal})),__vite__mapDeps([0,1]))),u1e=(0,f.lazy)(()=>Dt(()=>import(`./SpreadsheetPreviewModal-BcNF67Td.js`).then(e=>({default:e.SpreadsheetPreviewModal})),__vite__mapDeps([2,1]))),d1e=(0,f.lazy)(()=>Dt(()=>import(`./ImagePreviewModal-DWRBCqB-.js`).then(e=>({default:e.ImagePreviewModal})),__vite__mapDeps([3,1])));function Z7(e){return e===`csv`||e===`xlsx`||e===`ods`}function Q7(e){return e===`step`||e===`stp`}var f1e=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`,`tiff`,`tif`]),p1e=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`]);function m1e(e){return f1e.has(e.toLowerCase())}function h1e(e){return p1e.has(e.toLowerCase())}function $7(e){let t=e.file_type;return T5(e)||t===`3mf`||t===`stl`||Q7(t)||t===`pdf`||Z7(t)||h1e(t)}var e9={onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation()};function t9(e){return T5(e)||e.file_type===`3mf`||e.file_type===`stl`||Q7(e.file_type)}function g1e(e){return e===`pdf`?(0,G.jsx)(ac,{className:`w-4 h-4`}):Z7(e)?(0,G.jsx)(ic,{className:`w-4 h-4`}):(0,G.jsx)(Ic,{className:`w-4 h-4`})}function _1e(e){return e===`stl`||e===`pdf`}function v1e({parentId:e,onClose:t,onSave:n,isLoading:r,t:i}){let[a,o]=(0,f.useState)(``);return(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,children:(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg w-full max-w-sm border border-bambu-dark-tertiary`,children:[(0,G.jsx)(`div`,{className:`p-4 border-b border-bambu-dark-tertiary`,children:(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:i(`fileManager.newFolder`)})}),(0,G.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),n({name:a.trim(),parent_id:e})},className:`p-4 space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-white mb-1`,children:i(`fileManager.folderName`)}),(0,G.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),className:`w-full bg-bambu-dark border border-bambu-dark-tertiary rounded px-3 py-2 text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green`,placeholder:i(`fileManager.folderNamePlaceholder`),autoFocus:!0,required:!0})]}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-2 pt-2`,children:[(0,G.jsx)(Q,{type:`button`,variant:`secondary`,onClick:t,children:i(`common.cancel`)}),(0,G.jsx)(Q,{type:`submit`,disabled:!a.trim()||r,children:r?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):i(`common.create`)})]})]})]})})}function y1e({onClose:e,onSave:t,isLoading:n,t:r}){let[i,a]=(0,f.useState)(``),[o,s]=(0,f.useState)(``),[c,l]=(0,f.useState)(!0),[u,d]=(0,f.useState)(!1);return(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,children:(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg w-full max-w-md border border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{className:`p-4 border-b border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(pc,{className:`w-5 h-5 text-bambu-green`}),r(`fileManager.linkExternalFolder`)]}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:r(`fileManager.linkExternalFolderDescription`)})]}),(0,G.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),t({name:i.trim(),external_path:o.trim(),readonly:c,show_hidden:u})},className:`p-4 space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-white mb-1`,children:r(`fileManager.folderName`)}),(0,G.jsx)(`input`,{type:`text`,value:i,onChange:e=>a(e.target.value),className:`w-full bg-bambu-dark border border-bambu-dark-tertiary rounded px-3 py-2 text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green`,placeholder:r(`fileManager.externalFolderNamePlaceholder`),autoFocus:!0,required:!0})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-white mb-1`,children:r(`fileManager.externalPath`)}),(0,G.jsx)(`input`,{type:`text`,value:o,onChange:e=>s(e.target.value),className:`w-full bg-bambu-dark border border-bambu-dark-tertiary rounded px-3 py-2 text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green font-mono text-sm`,placeholder:`/mnt/nas/3d-prints`,required:!0}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:r(`fileManager.externalPathHelp`)})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:c,onChange:e=>l(e.target.checked),className:`rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green`}),(0,G.jsx)(`span`,{className:`text-sm text-white`,children:r(`fileManager.readOnly`)}),(0,G.jsxs)(`span`,{className:`text-xs text-bambu-gray`,children:[`(`,r(`fileManager.readOnlyHelp`),`)`]})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:u,onChange:e=>d(e.target.checked),className:`rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green`}),(0,G.jsx)(`span`,{className:`text-sm text-white`,children:r(`fileManager.showHiddenFiles`)})]})]}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-2 pt-2`,children:[(0,G.jsx)(Q,{type:`button`,variant:`secondary`,onClick:e,children:r(`common.cancel`)}),(0,G.jsx)(Q,{type:`submit`,disabled:!i.trim()||!o.trim()||n,children:n?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):r(`fileManager.linkFolder`)})]})]})]})})}var b1e=`<>:"/\\|?*`;function x1e(e){for(let t of e)if(b1e.includes(t)||t.charCodeAt(0)<32)return t;return null}function S1e({type:e,currentName:t,onClose:n,onSave:r,isLoading:i,t:a}){let o=e===`file`?t.match(/(\.gcode\.3mf|\.3mf|\.gcode)$/i)?.[1]??``:``,s=e===`file`&&o?t.slice(0,-o.length):t,[c,l]=(0,f.useState)(s),u=e===`file`?x1e(c):null,d=u?a(`fileManager.invalidFilenameChar`,{char:u}):null;return(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,children:(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg w-full max-w-sm border border-bambu-dark-tertiary`,children:[(0,G.jsx)(`div`,{className:`p-4 border-b border-bambu-dark-tertiary`,children:(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:a(e===`file`?`fileManager.renameFile`:`fileManager.renameFolder`)})}),(0,G.jsxs)(`form`,{onSubmit:n=>{if(n.preventDefault(),d)return;let i=e===`file`?c.trim()+o:c.trim();c.trim()&&i!==t&&r(i)},className:`p-4 space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-white mb-1`,children:a(`common.name`)}),(0,G.jsxs)(`div`,{className:`flex items-center bg-bambu-dark border rounded focus-within:border-bambu-green ${d?`border-red-500`:`border-bambu-dark-tertiary`}`,children:[(0,G.jsx)(`input`,{type:`text`,value:c,onChange:e=>l(e.target.value),className:`flex-1 bg-transparent px-3 py-2 text-white placeholder-bambu-gray focus:outline-none min-w-0`,autoFocus:!0,required:!0}),o&&(0,G.jsx)(`span`,{className:`pr-3 text-bambu-gray text-sm select-none whitespace-nowrap`,children:o})]}),d&&(0,G.jsx)(`p`,{className:`mt-1 text-xs text-red-700 dark:text-red-400`,children:d})]}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-2 pt-2`,children:[(0,G.jsx)(Q,{type:`button`,variant:`secondary`,onClick:n,children:a(`common.cancel`)}),(0,G.jsx)(Q,{type:`submit`,disabled:!c.trim()||c.trim()===s||!!d||i,children:i?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):a(`common.rename`)})]})]})]})})}function C1e({folders:e,selectedFiles:t,currentFolderId:n,onClose:r,onMove:i,isLoading:a,t:o}){let[s,c]=(0,f.useState)(null),l=(e,t=0)=>{let n=[];for(let r of e)n.push({id:r.id,name:r.name,depth:t}),r.children.length>0&&n.push(...l(r.children,t+1));return n},u=[{id:null,name:o(`fileManager.rootNoFolder`),depth:0},...l(e)];return(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,children:(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg w-full max-w-sm border border-bambu-dark-tertiary`,children:[(0,G.jsx)(`div`,{className:`p-4 border-b border-bambu-dark-tertiary`,children:(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:o(`fileManager.moveFiles`,{count:t.length})})}),(0,G.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,G.jsx)(`div`,{className:`max-h-64 overflow-y-auto space-y-1`,children:u.map(e=>(0,G.jsxs)(`button`,{onClick:()=>c(e.id),disabled:e.id===n,className:`w-full text-left px-3 py-2 rounded transition-colors flex items-center gap-2 ${s===e.id?`bg-bambu-green/20 text-bambu-green`:e.id===n?`opacity-50 cursor-not-allowed text-bambu-gray`:`hover:bg-bambu-dark text-white`}`,style:{paddingLeft:`${12+e.depth*16}px`},children:[(0,G.jsx)(dc,{className:`w-4 h-4`}),e.name,e.id===n&&(0,G.jsxs)(`span`,{className:`text-xs text-bambu-gray ml-auto`,children:[`(`,o(`fileManager.current`),`)`]})]},e.id??`root`))}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-2 pt-2`,children:[(0,G.jsx)(Q,{type:`button`,variant:`secondary`,onClick:r,children:o(`common.cancel`)}),(0,G.jsx)(Q,{onClick:()=>i(s),disabled:a,children:a?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):o(`common.move`)})]})]})]})})}function w1e({folder:e,onClose:t,onLink:n,isLoading:r,t:i}){let[a,o]=(0,f.useState)(`project`),[s,c]=(0,f.useState)(e.project_id||e.archive_id||null);(0,f.useState)(()=>{e.archive_id&&o(`archive`)});let{data:l}=K({queryKey:[`projects`],queryFn:()=>Z.getProjects(),select:t=>Jp([...t].sort((e,t)=>e.name.localeCompare(t.name)),e.project_id)}),{data:u}=K({queryKey:[`archives-for-link`],queryFn:()=>Z.getArchives(void 0,void 0,100)}),d=()=>{n(a===`project`?{project_id:s,archive_id:0}:{project_id:0,archive_id:s})},p=()=>{n({project_id:0,archive_id:0})},m=e.project_id||e.archive_id;return(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,children:(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg w-full max-w-md border border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{className:`p-4 border-b border-bambu-dark-tertiary flex items-center justify-between`,children:[(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(Wc,{className:`w-5 h-5 text-bambu-green`}),i(`fileManager.linkFolder`)]}),(0,G.jsx)(`button`,{onClick:t,className:`p-1 hover:bg-bambu-dark rounded`,children:(0,G.jsx)($u,{className:`w-5 h-5 text-bambu-gray`})})]}),(0,G.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`fileManager.linkFolderDescription`,{name:e.name})}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsxs)(`button`,{onClick:()=>{o(`project`),c(null)},className:`flex-1 flex items-center justify-center gap-2 px-3 py-2 rounded-lg border transition-colors ${a===`project`?`border-bambu-green bg-bambu-green/10 text-bambu-green`:`border-bambu-dark-tertiary text-bambu-gray hover:text-white`}`,children:[(0,G.jsx)(Ko,{className:`w-4 h-4`}),i(`fileManager.project`)]}),(0,G.jsxs)(`button`,{onClick:()=>{o(`archive`),c(null)},className:`flex-1 flex items-center justify-center gap-2 px-3 py-2 rounded-lg border transition-colors ${a===`archive`?`border-bambu-green bg-bambu-green/10 text-bambu-green`:`border-bambu-dark-tertiary text-bambu-gray hover:text-white`}`,children:[(0,G.jsx)(Oo,{className:`w-4 h-4`}),i(`fileManager.archive`)]})]}),(0,G.jsx)(`div`,{className:`max-h-64 overflow-y-auto space-y-1 bg-bambu-dark rounded-lg p-2`,children:a===`project`?l&&l.length>0?l.map(e=>(0,G.jsxs)(`button`,{onClick:()=>c(e.id),className:`w-full text-left px-3 py-2 rounded transition-colors flex items-center gap-2 ${s===e.id?`bg-bambu-green/20 text-bambu-green`:`hover:bg-bambu-dark-tertiary text-white`}`,children:[(0,G.jsx)(`div`,{className:`w-3 h-3 rounded-full flex-shrink-0`,style:{backgroundColor:e.color||`#00ae42`}}),(0,G.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id)):(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray text-center py-4`,children:i(`fileManager.noProjectsFound`)}):u&&u.length>0?u.map(e=>(0,G.jsxs)(`button`,{onClick:()=>c(e.id),className:`w-full text-left px-3 py-2 rounded transition-colors flex items-center gap-2 ${s===e.id?`bg-bambu-green/20 text-bambu-green`:`hover:bg-bambu-dark-tertiary text-white`}`,children:[(0,G.jsx)(ec,{className:`w-4 h-4 text-bambu-gray flex-shrink-0`}),(0,G.jsx)(`span`,{className:`truncate`,children:e.print_name||e.filename})]},e.id)):(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray text-center py-4`,children:i(`fileManager.noArchivesFound`)})})]}),(0,G.jsxs)(`div`,{className:`p-4 border-t border-bambu-dark-tertiary flex justify-between`,children:[m&&(0,G.jsxs)(Q,{variant:`danger`,onClick:p,disabled:r,children:[(0,G.jsx)(Lu,{className:`w-4 h-4 mr-2`}),i(`fileManager.unlink`)]}),(0,G.jsxs)(`div`,{className:`flex gap-2 ${m?``:`ml-auto`}`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:t,children:i(`common.cancel`)}),(0,G.jsx)(Q,{onClick:d,disabled:!s||r,children:r?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):i(`fileManager.link`)})]})]})]})})}function T1e({folder:e,selectedFolderId:t,onSelect:n,onDelete:r,onLink:i,onRename:a,depth:o=0,wrapNames:s=!1,defaultExpanded:c=!0,showModified:l=!1,hasPermission:u,t:d}){let[p,m]=(0,f.useState)(c),[h,g]=(0,f.useState)(!1),_=e.children.length>0,v=e.project_id||e.archive_id,y=e.is_external,b=u(`library:delete_all`)||u(`library:delete_own`)&&e.file_count===0&&!_&&!y&&!v,x=b?void 0:u(`library:delete_own`)&&!y&&!v?d(`fileManager.onlyEmptyFoldersDeletable`):d(`fileManager.noPermissionDeleteFolder`);return(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`group flex items-center gap-1 px-2 py-1.5 rounded cursor-pointer transition-colors ${t===e.id?`bg-bambu-green/20 text-bambu-green`:`hover:bg-bambu-dark text-white`}`,style:{paddingLeft:`${8+o*12}px`},onClick:()=>n(e.id),children:[_?(0,G.jsx)(`button`,{onClick:e=>{e.stopPropagation(),m(!p)},className:`p-0.5 hover:bg-bambu-dark-tertiary rounded`,children:(0,G.jsx)(ss,{className:`w-3.5 h-3.5 transition-transform ${p?`rotate-90`:``}`})}):(0,G.jsx)(`div`,{className:`w-4.5`}),y?(0,G.jsx)(pc,{className:`w-4 h-4 text-purple-600 dark:text-purple-400 flex-shrink-0`}):(0,G.jsx)(dc,{className:`w-4 h-4 text-bambu-green flex-shrink-0`}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`span`,{className:`block text-sm ${s?`break-all`:`truncate`}`,title:e.name,children:e.name}),l&&e.latest_activity_at&&(0,G.jsxs)(`span`,{className:`mt-0.5 flex items-center gap-1 text-xs text-bambu-gray`,title:d(`fileManager.lastActivity`),children:[(0,G.jsx)(Zo,{className:`w-3 h-3 flex-shrink-0`}),(0,G.jsx)(`span`,{className:`truncate`,children:ep(e.latest_activity_at)})]})]}),v&&(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),i(e)},className:`flex-shrink-0 flex items-center gap-1 text-xs px-1.5 py-0.5 rounded bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400 hover:bg-blue-200 dark:hover:bg-blue-500/30 transition-colors`,title:`${e.project_name?`Project: ${e.project_name}`:`Archive: ${e.archive_name}`} (click to change)`,children:[(0,G.jsx)(Wc,{className:`w-3 h-3`}),e.project_name?(0,G.jsx)(Ko,{className:`w-3 h-3`}):(0,G.jsx)(Oo,{className:`w-3 h-3`})]}),y&&e.external_readonly&&(0,G.jsx)(`span`,{title:d(`fileManager.readOnly`),children:(0,G.jsx)(Xc,{className:`w-3 h-3 text-amber-600 dark:text-amber-400 flex-shrink-0`})}),e.file_count>0&&(0,G.jsx)(`span`,{className:`flex-shrink-0 text-xs text-bambu-gray`,children:e.file_count}),!v&&!y&&(0,G.jsx)(`button`,{onClick:t=>{t.stopPropagation(),i(e)},className:`flex-shrink-0 p-1 rounded hover:bg-bambu-dark-tertiary`,title:d(`fileManager.linkToProjectOrArchive`),children:(0,G.jsx)(Wc,{className:`w-3.5 h-3.5 text-bambu-gray hover:text-bambu-green`})}),(0,G.jsx)(`div`,{className:`flex-shrink-0 flex items-center gap-0.5 transition-opacity ${s?``:`can-hover:opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`}`,onClick:e=>e.stopPropagation(),children:(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(`button`,{onClick:()=>g(!h),className:`p-1 rounded hover:bg-bambu-dark-tertiary`,children:(0,G.jsx)(Ks,{className:`w-3.5 h-3.5 text-bambu-gray`})}),h&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`fixed inset-0 z-10`,onClick:()=>g(!1)}),(0,G.jsxs)(`div`,{className:`absolute right-0 top-full mt-1 z-20 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl py-1 min-w-[120px]`,children:[(0,G.jsxs)(`button`,{className:`w-full px-3 py-1.5 text-left text-sm flex items-center gap-2 ${u(`library:update_all`)?`text-white hover:bg-bambu-dark`:`text-bambu-gray cursor-not-allowed`}`,onClick:()=>{u(`library:update_all`)&&(a(e),g(!1))},disabled:!u(`library:update_all`),title:u(`library:update_all`)?void 0:d(`fileManager.noPermissionRenameFolder`),children:[(0,G.jsx)(wl,{className:`w-3.5 h-3.5`}),d(`common.rename`)]}),(0,G.jsxs)(`button`,{className:`w-full px-3 py-1.5 text-left text-sm flex items-center gap-2 ${u(`library:update_all`)?`text-white hover:bg-bambu-dark`:`text-bambu-gray cursor-not-allowed`}`,onClick:()=>{u(`library:update_all`)&&(i(e),g(!1))},disabled:!u(`library:update_all`),title:u(`library:update_all`)?void 0:d(`fileManager.noPermissionLinkFolder`),children:[(0,G.jsx)(Wc,{className:`w-3.5 h-3.5`}),d(v?`fileManager.changeLink`:`fileManager.linkTo`)]}),(0,G.jsxs)(`button`,{className:`w-full px-3 py-1.5 text-left text-sm flex items-center gap-2 ${b?`text-red-700 dark:text-red-400 hover:bg-bambu-dark`:`text-bambu-gray cursor-not-allowed`}`,onClick:()=>{b&&(r(e.id),g(!1))},disabled:!b,title:x,children:[(0,G.jsx)(ju,{className:`w-3.5 h-3.5`}),d(`common.delete`)]})]})]})]})})]}),_&&p&&(0,G.jsx)(`div`,{children:e.children.map(e=>(0,G.jsx)(T1e,{folder:e,selectedFolderId:t,onSelect:n,onDelete:r,onLink:i,onRename:a,depth:o+1,wrapNames:s,defaultExpanded:c,showModified:l,hasPermission:u,t:d},e.id))})]})}function E1e({file:e,isSelected:t,onSelect:n,onDelete:r,onDownload:i,onPrint:a,onSlice:o,onOpenInSlicer:s,onRunPipeline:c,useSlicerApi:l,desktopSlicer:u,canSlice:d,onPreview:p,onRename:m,onDetails:h,onGenerateThumbnail:g,onTagClick:_,thumbnailVersion:v,hasPermission:y,canModify:b,authEnabled:x,showModified:S,t:C}){let[w,T]=(0,f.useState)(null),E=y(`library:read`),D=b(`library`,`update`,e.created_by_id),O=b(`library`,`delete`,e.created_by_id),k=[];if(a&&T5(e)&&k.push({label:C(`common.print`),icon:(0,G.jsx)(Ml,{className:`w-4 h-4 text-bambu-green`}),onClick:()=>a(e),disabled:!y(`queue:create`),title:y(`queue:create`)?void 0:C(`fileManager.noPermissionAddToQueue`)}),E5(e,!!l,u)&&(l?o:s)&&k.push({label:C(`slice.action`),icon:l?(0,G.jsx)(js,{className:`w-4 h-4`}):(0,G.jsx)(Xs,{className:`w-4 h-4`}),onClick:()=>{l?o?.(e):s?.(e)},disabled:!d,title:d?void 0:C(l?`fileManager.noPermissionSlice`:`fileManager.noPermissionDownload`)}),c&&l&&E5(e,!0,u)&&k.push({label:C(`library.runWithPipeline.actionLabel`),icon:(0,G.jsx)(Dl,{className:`w-4 h-4`}),onClick:()=>c(e),disabled:!y(`pipelines:run`),title:y(`pipelines:run`)?void 0:C(`library.runWithPipeline.noPermission`)}),p&&$7(e)){let t=t9(e);k.push({label:C(t?`fileManager.preview3d`:`fileManager.preview.open`),icon:t?(0,G.jsx)(Go,{className:`w-4 h-4`}):g1e(e.file_type),onClick:()=>p(e),disabled:!E,title:E?void 0:C(`fileManager.noPermissionPreview`)})}return k.push({label:C(`common.download`),icon:(0,G.jsx)(Us,{className:`w-4 h-4`}),onClick:()=>i(e.id),disabled:!y(`library:read`),title:y(`library:read`)?void 0:C(`fileManager.noPermissionDownload`)}),m&&k.push({label:C(`common.rename`),icon:(0,G.jsx)(wl,{className:`w-4 h-4`}),onClick:()=>m(e),disabled:!D,title:D?void 0:C(`fileManager.noPermissionRenameFile`)}),h&&k.push({label:C(`fileManager.details.title`),icon:(0,G.jsx)(Rc,{className:`w-4 h-4`}),onClick:()=>h(e),disabled:!E,title:E?void 0:C(`fileManager.noPermissionPreview`)}),e.external_url&&k.push({label:C(`fileManager.details.openLink`),icon:(0,G.jsx)(Cc,{className:`w-4 h-4`}),onClick:()=>window.open(e.external_url,`_blank`,`noopener,noreferrer`)}),g&&_1e(e.file_type)&&k.push({label:C(`fileManager.generateThumbnail`),icon:(0,G.jsx)(Ic,{className:`w-4 h-4`}),onClick:()=>g(e),disabled:!D,title:D?void 0:C(`fileManager.noPermissionGenerateThumbnail`)}),k.push({label:C(`common.delete`),icon:(0,G.jsx)(ju,{className:`w-4 h-4`}),onClick:()=>r(e.id),danger:!0,disabled:!O,title:O?void 0:C(`fileManager.noPermissionDeleteFile`)}),(0,G.jsxs)(`div`,{className:`group relative bg-bambu-dark-secondary rounded-lg border transition-all cursor-pointer ${t?`border-bambu-green ring-1 ring-bambu-green`:`border-bambu-dark-tertiary hover:border-bambu-green/50`}`,onClick:()=>n(e.id),onDoubleClick:()=>p?.(e),children:[(0,G.jsxs)(`div`,{className:`aspect-square bg-bambu-dark flex items-center justify-center overflow-hidden rounded-t-lg`,children:[e.thumbnail_path?(0,G.jsx)(`img`,{src:`${Z.getLibraryFileThumbnailUrl(e.id)}${v?(Z.getLibraryFileThumbnailUrl(e.id).includes(`?`)?`&`:`?`)+`v=${v}`:``}`,alt:e.filename,className:`w-full h-full object-cover`}):e.file_type===`pdf`?(0,G.jsx)(ac,{className:`w-12 h-12 text-bambu-gray/30`}):Z7(e.file_type)?(0,G.jsx)(ic,{className:`w-12 h-12 text-bambu-gray/30`}):m1e(e.file_type)?(0,G.jsx)(Ic,{className:`w-12 h-12 text-bambu-gray/30`}):(0,G.jsx)(ec,{className:`w-12 h-12 text-bambu-gray/30`}),(0,G.jsx)(`div`,{className:`absolute top-2 right-2 text-xs px-1.5 py-0.5 rounded font-medium ${e.file_type===`3mf`?`bg-bambu-green/90 text-white`:e.file_type===`gcode`||e.file_type===`gcode.3mf`?`bg-blue-500/90 text-white`:e.file_type===`stl`?`bg-purple-500/90 text-white`:Q7(e.file_type)?`bg-amber-500/90 text-white`:e.file_type===`pdf`?`bg-red-500/90 text-white`:Z7(e.file_type)?`bg-teal-500/90 text-white`:`bg-bambu-gray/90 text-white`}`,children:e.file_type.toUpperCase()})]}),(0,G.jsxs)(`div`,{className:`p-3`,children:[(0,G.jsx)(`h3`,{className:`text-sm font-medium text-white truncate`,title:e.print_name||e.filename,children:e.print_name||e.filename}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 mt-1 text-xs text-bambu-gray`,children:[(0,G.jsx)(`span`,{children:Gd(e.file_size)}),e.print_time_seconds&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(ws,{className:`w-3 h-3`}),ap(e.print_time_seconds)]})]}),e.sliced_for_model&&(0,G.jsxs)(`div`,{className:`mt-1 text-xs text-bambu-gray flex items-center gap-1`,children:[(0,G.jsx)(Ml,{className:`w-3 h-3`}),e.sliced_for_model]}),(e.variant_count??0)>1&&(0,G.jsxs)(`div`,{className:`mt-1 text-xs text-bambu-green flex items-center gap-1`,children:[(0,G.jsx)(Hc,{className:`w-3 h-3`}),C(`fileManager.variants.badge`,{count:e.variant_count})]}),e.print_count>0&&(0,G.jsx)(`div`,{className:`mt-1 text-xs text-bambu-green`,children:C(`fileManager.printedCount`,{count:e.print_count})}),(e.external_url||e.has_notes||(e.photo_count??0)>0)&&(0,G.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-bambu-gray`,...e9,children:[e.external_url&&(0,G.jsx)(`a`,{href:e.external_url,target:`_blank`,rel:`noopener noreferrer`,className:`p-0.5 rounded hover:text-bambu-green`,title:C(`fileManager.details.openLink`),"aria-label":C(`fileManager.details.openLink`),children:(0,G.jsx)(Cc,{className:`w-3.5 h-3.5`})}),e.has_notes&&(0,G.jsx)(`button`,{type:`button`,onClick:()=>h?.(e),className:`p-0.5 rounded hover:text-bambu-green`,title:C(`fileManager.details.hasNotes`),"aria-label":C(`fileManager.details.hasNotes`),children:(0,G.jsx)(_u,{className:`w-3.5 h-3.5`})}),(e.photo_count??0)>0&&(0,G.jsxs)(`button`,{type:`button`,onClick:()=>h?.(e),className:`flex items-center gap-0.5 p-0.5 rounded hover:text-bambu-green`,title:C(`fileManager.details.photoCount`,{count:e.photo_count}),"aria-label":C(`fileManager.details.photoCount`,{count:e.photo_count}),children:[(0,G.jsx)($o,{className:`w-3.5 h-3.5`}),(0,G.jsx)(`span`,{children:e.photo_count})]})]}),x&&e.created_by_username&&(0,G.jsxs)(`div`,{className:`mt-1 text-xs text-bambu-gray flex items-center gap-1`,children:[(0,G.jsx)(zu,{className:`w-3 h-3`}),e.created_by_username]}),S&&(0,G.jsxs)(`div`,{className:`mt-1 text-xs text-bambu-gray flex items-center gap-1`,title:C(`fileManager.lastModified`),children:[(0,G.jsx)(Zo,{className:`w-3 h-3`}),ep(e.fs_modified_at??e.created_at)]}),(e.tags?.length??0)>0&&(0,G.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1`,...e9,children:e.tags.map(e=>(0,G.jsxs)(`button`,{type:`button`,onClick:()=>_?.(e.id),className:`inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded-full text-[10px] bg-bambu-green/10 text-bambu-green hover:bg-bambu-green/20 transition-colors max-w-full`,title:e.name,children:[(0,G.jsx)(xu,{className:`w-2.5 h-2.5 flex-shrink-0`}),(0,G.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id))})]}),(0,G.jsxs)(`div`,{className:`absolute bottom-2 right-2 transition-opacity can-hover:opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`,...e9,children:[(0,G.jsx)(`button`,{onClick:e=>{let t=e.currentTarget.getBoundingClientRect();T({x:t.left,y:t.bottom+4})},className:`p-1.5 rounded bg-bambu-dark-secondary/90 hover:bg-bambu-dark-tertiary`,children:(0,G.jsx)(Ks,{className:`w-4 h-4 text-bambu-gray`})}),w&&(0,G.jsx)(pE,{x:w.x,y:w.y,items:k,onClose:()=>T(null)})]}),(0,G.jsx)(`div`,{className:`absolute top-2 left-2 w-5 h-5 rounded border-2 flex items-center justify-center transition-all ${t?`bg-bambu-green border-bambu-green`:`border-white/30 bg-black/30 can-hover:opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`}`,children:t&&(0,G.jsx)(`div`,{className:`w-2 h-2 bg-white rounded-sm`})})]})}function D1e(){let{t:e}=U(),t=no(),{showToast:n}=qd(),{hasPermission:r,hasAnyPermission:i,canModify:a,authEnabled:o}=Nd(),[s]=ji(),c=$n(),l=s.get(`folder`),[u,d]=(0,f.useState)(l?parseInt(l,10):null),[p,m]=(0,f.useState)(`internal`),[h,g]=(0,f.useState)([]),[_,v]=(0,f.useState)(!1),[y,b]=(0,f.useState)(!1),[x,S]=(0,f.useState)(!1),[C,w]=(0,f.useState)(!1),[T,E]=(0,f.useState)([]),[D,O]=(0,f.useState)(!1),[k,A]=(0,f.useState)(!1),[j,M]=(0,f.useState)(!1),[N,P]=(0,f.useState)([]),[F,I]=(0,f.useState)(null),[L,R]=(0,f.useState)(null),[z,B]=(0,f.useState)(null),[V,ee]=(0,f.useState)(null),[te,ne]=(0,f.useState)(null),[re,ie]=(0,f.useState)(null),[ae,oe]=(0,f.useState)({}),[se,H]=(0,f.useState)(null),[ce,le]=(0,f.useState)(null),[ue,de]=(0,f.useState)(null),[fe,pe]=(0,f.useState)(null),[me,he]=(0,f.useState)(null),[ge,_e]=(0,f.useState)(()=>localStorage.getItem(`library-view-mode`)||`grid`),[ve,ye]=(0,f.useState)(()=>localStorage.getItem(`library-wrap-folders`)===`true`),[be,xe]=(0,f.useState)(()=>localStorage.getItem(`library-collapse-folders`)===`true`),[Se,Ce]=(0,f.useState)(()=>localStorage.getItem(`library-folder-sort-field`)===`activity`?`activity`:`name`),[we,Te]=(0,f.useState)(()=>localStorage.getItem(`library-folder-sort-direction`)===`desc`?`desc`:`asc`),[Ee,De]=(0,f.useState)(()=>{let e=localStorage.getItem(`library-sidebar-width`);return e?parseInt(e,10):256}),[Oe,ke]=(0,f.useState)(!1),Ae=(0,f.useRef)(null);(0,f.useEffect)(()=>{if(!Oe)return;document.body.style.userSelect=`none`,document.body.style.cursor=`col-resize`;let e=e=>{if(!Ae.current)return;let t=Ae.current.parentElement?.getBoundingClientRect();if(!t)return;let n=e.clientX-t.left;De(Math.min(500,Math.max(200,n)))},t=()=>{ke(!1),document.body.style.userSelect=``,document.body.style.cursor=``,localStorage.setItem(`library-sidebar-width`,String(Ee))};return document.addEventListener(`mousemove`,e),document.addEventListener(`mouseup`,t),()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,t),document.body.style.userSelect=``,document.body.style.cursor=``}},[Oe,Ee]);let[je,Me]=(0,f.useState)(``),[Ne,Pe]=(0,f.useState)(`all`),[Fe,Ie]=(0,f.useState)(``),[Le,Re]=(0,f.useState)(()=>localStorage.getItem(`library-sort-field`)||`name`),[ze,Be]=(0,f.useState)(()=>localStorage.getItem(`library-sort-direction`)||`asc`),[Ve,He]=(0,f.useState)(()=>localStorage.getItem(`library-show-modified`)===`true`);(0,f.useEffect)(()=>{let e=s.get(`folder`);e&&d(parseInt(e,10))},[s]);let{data:Ue}=K({queryKey:[`settings`],queryFn:()=>Z.getSettings()}),We=VW(Ue?.open_in_slicer,Ue?.preferred_slicer),Ge=(0,f.useCallback)(async t=>{try{let{token:e}=await Z.createLibrarySlicerToken(t.id),n=Z.getLibrarySlicerDownloadUrl(t.id,e,t.filename);GW(`${window.location.origin}${n}`,We)}catch{n(e(`fileManager.toast.openInSlicerFailed`),`error`);let r=Z.getLibraryFileDownloadUrl(t.id);GW(`${window.location.origin}${r}`,We)}},[We,n,e]),Ke=(0,f.useCallback)(()=>Ue?.use_slicer_api?r(`library:upload`):i(`library:read_all`,`library:read_own`),[Ue?.use_slicer_api,r,i]),{data:qe,isLoading:Je}=K({queryKey:[`library-folders`],queryFn:()=>Z.getLibraryFolders()}),Ye=(0,f.useMemo)(()=>{if(!qe)return qe;let e=t=>[...t].sort((e,t)=>{let n=0;if(Se===`name`)n=e.name.localeCompare(t.name);else{let r=e.latest_activity_at?new Date(e.latest_activity_at).getTime():null,i=t.latest_activity_at?new Date(t.latest_activity_at).getTime():null;if(r===null&&i===null)n=e.name.localeCompare(t.name);else if(r===null)return 1;else if(i===null)return-1;else n=r-i}return we===`asc`?n:-n}).map(t=>({...t,children:e(t.children)}));return e(qe)},[qe,Se,we]),{data:Xe}=K({queryKey:[`library-trash-count`],queryFn:async()=>{try{return(await Z.listLibraryTrash(1,0)).total}catch{return 0}},staleTime:3e4}),Ze=u!==null&&je.trim().length>0,Qe=(0,f.useMemo)(()=>[...N].sort((e,t)=>e-t),[N]),{data:$e=[]}=K({queryKey:[`library-tags`],queryFn:Z.getLibraryTags}),et=(0,f.useMemo)(()=>{let e=new Map;for(let t of $e)e.set(t.id,t.name);return e},[$e]);(0,f.useEffect)(()=>{$e.length!==0&&P(e=>{let t=e.filter(e=>et.has(e));return t.length===e.length?e:t})},[$e.length,et]);let tt=(0,f.useCallback)(e=>{P(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]),{data:nt,isLoading:rt}=K({queryKey:[`library-files`,u,p,Ze,Qe],queryFn:()=>Z.getLibraryFiles(u,!1,void 0,u===null?p:void 0,Ze,Qe)}),{data:it}=K({queryKey:[`library-stats`],queryFn:()=>Z.getLibraryStats()}),{data:at}=K({queryKey:[`users`,`slim`],queryFn:()=>Z.getUsersSlim()}),ot=(0,f.useMemo)(()=>{if(!nt)return[];let e=new Set(nt.map(e=>e.file_type));return Array.from(e).sort()},[nt]),st=(0,f.useMemo)(()=>{if(!nt)return[];let e=[...nt];if(je.trim()){let t=je.toLowerCase();e=e.filter(e=>e.filename.toLowerCase().includes(t)||e.print_name&&e.print_name.toLowerCase().includes(t))}if(Ne!==`all`&&(e=e.filter(e=>e.file_type===Ne)),Fe.trim()){let t=Fe.toLowerCase();e=e.filter(e=>e.created_by_username&&e.created_by_username.toLowerCase().includes(t))}return e.sort((e,t)=>{let n=0;switch(Le){case`name`:n=(e.print_name||e.filename).localeCompare(t.print_name||t.filename);break;case`date`:n=($f(e.fs_modified_at??e.created_at)?.getTime()??0)-($f(t.fs_modified_at??t.created_at)?.getTime()??0);break;case`size`:n=e.file_size-t.file_size;break;case`type`:n=e.file_type.localeCompare(t.file_type);break;case`prints`:n=e.print_count-t.print_count;break}return ze===`asc`?n:-n}),e},[nt,je,Ne,Fe,Le,ze]),ct=(0,f.useMemo)(()=>{if(!it||!Ue)return!1;let e=(Ue.library_disk_warning_gb||5)*1024*1024*1024;return it.disk_free_bytesZ.createLibraryFolder(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`library-folders`]}),v(!1),n(e(`fileManager.toast.folderCreated`),`success`)},onError:e=>n(e.message,`error`)}),ut=q({mutationFn:async e=>{let t=await Z.createExternalFolder(e);return await Z.scanExternalFolder(t.id),t},onSuccess:r=>{t.invalidateQueries({queryKey:[`library-folders`]}),t.invalidateQueries({queryKey:[`library-files`]}),t.invalidateQueries({queryKey:[`library-stats`]}),b(!1),d(r.id),n(e(`fileManager.toast.externalFolderLinked`),`success`)},onError:e=>n(e.message,`error`)}),dt=q({mutationFn:e=>Z.scanExternalFolder(e),onSuccess:r=>{t.invalidateQueries({queryKey:[`library-files`]}),t.invalidateQueries({queryKey:[`library-folders`]}),t.invalidateQueries({queryKey:[`library-stats`]}),n(e(`fileManager.toast.folderScanned`,{added:r.added,removed:r.removed}),`success`)},onError:e=>n(e.message,`error`)}),ft=q({mutationFn:e=>Z.deleteLibraryFolder(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`library-folders`]}),t.invalidateQueries({queryKey:[`library-files`]}),t.invalidateQueries({queryKey:[`library-stats`]}),u===L?.id&&d(null),R(null),n(e(`fileManager.toast.folderDeleted`),`success`)},onError:e=>{R(null),n(e.message,`error`)}}),pt=q({mutationFn:e=>Z.deleteLibraryFile(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`library-files`]}),t.invalidateQueries({queryKey:[`library-folders`]}),t.invalidateQueries({queryKey:[`library-stats`]}),t.invalidateQueries({queryKey:[`library-trash-count`]}),g(e=>e.filter(e=>e!==L?.id)),R(null),n(e(`fileManager.toast.fileDeleted`),`success`)},onError:e=>{R(null),n(e.message,`error`)}}),mt=q({mutationFn:e=>Z.createVariantGroup(e.map(e=>({library_file_id:e}))),onSuccess:r=>{t.invalidateQueries({queryKey:[`library-files`]}),n(e(`fileManager.variants.grouped`,{count:r.members.length}),`success`),g([])},onError:e=>n(e.message,`error`)}),ht=q({mutationFn:e=>Z.bulkDeleteLibrary(e,[]),onSuccess:(r,i)=>{t.invalidateQueries({queryKey:[`library-files`]}),t.invalidateQueries({queryKey:[`library-folders`]}),t.invalidateQueries({queryKey:[`library-stats`]}),t.invalidateQueries({queryKey:[`library-trash-count`]}),n(e(`fileManager.toast.filesDeleted`,{count:i.length}),`success`),g([]),R(null)},onError:e=>{R(null),n(e.message,`error`)}}),gt=q({mutationFn:({fileIds:e,folderId:t})=>Z.moveLibraryFiles(e,t),onSuccess:()=>{t.invalidateQueries({queryKey:[`library-files`]}),t.invalidateQueries({queryKey:[`library-folders`]}),g([]),S(!1),n(e(`fileManager.toast.filesMoved`),`success`)},onError:e=>n(e.message,`error`)}),_t=q({mutationFn:({id:e,data:t})=>Z.updateLibraryFolder(e,t),onSuccess:(r,i)=>{t.invalidateQueries({queryKey:[`library-folders`]}),t.invalidateQueries({queryKey:[`project-folders`]}),t.invalidateQueries({queryKey:[`archive-folders`]}),I(null),n(i.data.project_id===0&&i.data.archive_id===0?e(`fileManager.toast.folderUnlinked`):e(`fileManager.toast.folderLinked`),`success`)},onError:e=>n(e.message,`error`)}),vt=q({mutationFn:({id:e,filename:t})=>Z.updateLibraryFile(e,{filename:t}),onSuccess:()=>{t.invalidateQueries({queryKey:[`library-files`]}),ie(null),n(e(`fileManager.toast.fileRenamed`),`success`)},onError:e=>{ie(null),n(e.message,`error`)}}),yt=q({mutationFn:({id:e,name:t})=>Z.updateLibraryFolder(e,{name:t}),onSuccess:()=>{t.invalidateQueries({queryKey:[`library-folders`]}),t.invalidateQueries({queryKey:[`library-files`]}),ie(null),n(e(`fileManager.toast.folderRenamed`),`success`)},onError:e=>{ie(null),n(e.message,`error`)}}),bt=q({mutationFn:()=>Z.batchGenerateStlThumbnails({all_missing:!0}),onSuccess:r=>{if(t.invalidateQueries({queryKey:[`library-files`]}),r.succeeded>0){let e=Date.now(),t={};r.results.forEach(n=>{n.success&&(t[n.file_id]=e)}),oe(e=>({...e,...t}))}r.succeeded>0&&r.failed===0?n(e(`fileManager.toast.thumbnailsGenerated`,{count:r.succeeded}),`success`):r.succeeded>0&&r.failed>0?n(e(`fileManager.toast.thumbnailsGeneratedPartial`,{succeeded:r.succeeded,failed:r.failed}),`success`):r.processed===0?n(e(`fileManager.toast.noStlMissingThumbnails`),`info`):n(e(`fileManager.toast.failedToGenerateThumbnails`,{error:r.results[0]?.error||`Unknown error`}),`error`)},onError:e=>n(e.message,`error`)}),xt=q({mutationFn:e=>Z.batchGenerateStlThumbnails({file_ids:[e]}),onSuccess:r=>{if(t.invalidateQueries({queryKey:[`library-files`]}),r.succeeded>0){let t=r.results[0]?.file_id;t&&oe(e=>({...e,[t]:Date.now()})),n(e(`fileManager.toast.thumbnailGenerated`),`success`)}else n(e(`fileManager.toast.failedToGenerateThumbnail`,{error:r.results[0]?.error||`Unknown error`}),`error`)},onError:e=>n(e.message,`error`)}),St=(0,f.useCallback)(e=>{r(`library:read`)&&(T5(e)?c(`/gcode-viewer?library_file=${e.id}`):e.file_type===`3mf`||e.file_type===`stl`||Q7(e.file_type)?H(e):e.file_type===`pdf`?le(e):Z7(e.file_type)?de(e):h1e(e.file_type)&&he(e))},[r,c]),Ct=(0,f.useMemo)(()=>{if(!nt||h.length!==1)return null;let e=nt.find(e=>e.id===h[0]);return e&&$7(e)?e:null},[nt,h]),wt=(0,f.useMemo)(()=>nt?nt.filter(e=>h.includes(e.id)&&T5(e)):[],[nt,h]),{data:Tt}=K({queryKey:[`variant-group`,z?.variant_group_id],queryFn:()=>Z.getVariantGroup(z.variant_group_id),enabled:!!z?.variant_group_id}),Et=(0,f.useMemo)(()=>{if(z){if(wt.length>1)return wt.map(e=>({id:e.id,filename:e.filename,sliced_for_model:e.sliced_for_model}));if(Tt&&Tt.members.length>1)return Tt.members.map(e=>({id:e.library_file_id,filename:e.filename,sliced_for_model:e.target_model}))}},[z,wt,Tt]),Dt=(0,f.useCallback)(e=>{g(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]),Ot=(0,f.useCallback)(()=>{st.length>0&&g(st.map(e=>e.id))},[st]),kt=(0,f.useCallback)(()=>{g([])},[]),At=()=>{t.invalidateQueries({queryKey:[`library-files`]}),t.invalidateQueries({queryKey:[`library-folders`]}),t.invalidateQueries({queryKey:[`library-stats`]})},{isDraggingOver:jt,dragHandlers:Mt}=KW({disabled:!r(`library:upload`)||C,onFiles:e=>{E(e),w(!0)}}),Nt=(0,f.useCallback)(e=>{if(!e.thumbnail_path&&a(`library`,`update`,e.created_by_id))return n=>{Z.uploadLibraryPreviewThumbnail(e.id,n).then(n=>{n.updated&&(oe(t=>({...t,[e.id]:(t[e.id]||0)+1})),t.invalidateQueries({queryKey:[`library-files`]}))}).catch(()=>{})}},[a,t]),Pt=e=>{Z.downloadLibraryFile(e).catch(e=>{console.error(`Library file download failed:`,e)})},Ft=()=>{L&&(L.type===`file`?pt.mutate(L.id):L.type===`folder`?ft.mutate(L.id):L.type===`bulk`&&ht.mutate(h))},It=ft.isPending||pt.isPending||ht.isPending,Lt=e=>{_e(e),localStorage.setItem(`library-view-mode`,e)},Rt=Je||rt,zt=(0,f.useMemo)(()=>{if(!u||!qe)return null;let e=t=>{for(let n of t){if(n.id===u)return n;let t=e(n.children);if(t)return t}return null};return e(qe)},[u,qe]);return(0,G.jsxs)(`div`,{className:`p-4 md:p-8 min-h-[calc(100vh-64px)] lg:h-[calc(100vh-64px)] flex flex-col relative`,...Mt,children:[jt&&(0,G.jsx)(`div`,{className:`fixed inset-0 z-50 bg-bambu-dark/90 flex items-center justify-center pointer-events-none`,children:(0,G.jsxs)(`div`,{className:`border-4 border-dashed border-bambu-green rounded-xl p-12 text-center`,children:[(0,G.jsx)(Ru,{className:`w-16 h-16 mx-auto mb-4 text-bambu-green`}),(0,G.jsx)(`p`,{className:`text-2xl font-semibold text-white mb-2`,children:e(`fileManager.dropFilesHere`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray`,children:e(`fileManager.releaseToUpload`)})]})}),(0,G.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-4 mb-6`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`h1`,{className:`text-2xl font-bold text-white flex items-center gap-3`,children:[(0,G.jsx)(dc,{className:`w-7 h-7 text-bambu-green`}),e(`fileManager.title`)]}),(0,G.jsx)(`p`,{className:`text-bambu-gray mt-1`,children:e(`fileManager.subtitle`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center bg-bambu-dark rounded-lg p-1`,children:[(0,G.jsx)(`button`,{onClick:()=>Lt(`grid`),className:`p-1.5 rounded transition-colors ${ge===`grid`?`bg-bambu-dark-secondary text-white`:`text-bambu-gray hover:text-white`}`,title:e(`fileManager.gridView`),children:(0,G.jsx)(Uc,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{onClick:()=>Lt(`list`),className:`p-1.5 rounded transition-colors ${ge===`list`?`bg-bambu-dark-secondary text-white`:`text-bambu-gray hover:text-white`}`,title:e(`fileManager.listView`),children:(0,G.jsx)(Jc,{className:`w-4 h-4`})})]}),(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>bt.mutate(),disabled:bt.isPending||!i(`library:update_own`,`library:update_all`),title:i(`library:update_own`,`library:update_all`)?e(`fileManager.generateThumbnailsForMissing`):e(`fileManager.noPermissionGenerateThumbnail`),children:[bt.isPending?(0,G.jsx)(Y,{className:`w-4 h-4 mr-2 animate-spin`}):(0,G.jsx)(Ic,{className:`w-4 h-4 mr-2`}),e(`fileManager.generateThumbnails`)]}),(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>b(!0),disabled:!r(`library:upload`),title:r(`library:upload`)?e(`fileManager.linkExternalFolder`):e(`fileManager.noPermissionCreateFolder`),children:[(0,G.jsx)(pc,{className:`w-4 h-4 mr-2`}),e(`fileManager.linkExternal`)]}),(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>v(!0),disabled:!r(`library:upload`),title:r(`library:upload`)?void 0:e(`fileManager.noPermissionCreateFolder`),children:[(0,G.jsx)(fc,{className:`w-4 h-4 mr-2`}),e(`fileManager.newFolder`)]}),(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>A(!0),title:e(`fileManager.tags.manageTitle`),children:[(0,G.jsx)(xu,{className:`w-4 h-4 mr-2`}),e(`fileManager.tags.manage`)]}),r(`library:purge`)&&(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>O(!0),title:e(`libraryPurge.headerTooltip`),children:[(0,G.jsx)(ju,{className:`w-4 h-4 mr-2`}),e(`libraryPurge.headerButton`)]}),i(`library:delete_own`,`library:delete_all`)&&(0,G.jsxs)(Ci,{to:`/files/trash`,className:`inline-flex items-center px-3 py-1.5 text-sm rounded bg-bambu-dark-secondary text-bambu-gray hover:text-white hover:bg-bambu-dark transition-colors`,title:e(`libraryTrash.headerTooltip`),children:[(0,G.jsx)(ju,{className:`w-4 h-4 mr-2`}),e(`libraryTrash.headerButton`),typeof Xe==`number`&&Xe>0&&(0,G.jsx)(`span`,{className:`ml-1.5 px-1.5 py-0.5 text-xs rounded-full bg-bambu-green/20 text-bambu-green`,children:Xe})]}),(0,G.jsxs)(Q,{onClick:()=>w(!0),disabled:!r(`library:upload`),title:r(`library:upload`)?void 0:e(`fileManager.noPermissionUpload`),children:[(0,G.jsx)(Ru,{className:`w-4 h-4 mr-2`}),e(`common.upload`)]})]})]}),ct&&it&&Ue&&(0,G.jsxs)(`div`,{className:`flex items-center gap-3 mb-4 p-3 bg-amber-500/10 border border-amber-500/30 rounded-lg`,children:[(0,G.jsx)(Pu,{className:`w-5 h-5 text-amber-500 flex-shrink-0`}),(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`p`,{className:`text-sm text-amber-500 font-medium`,children:e(`fileManager.lowDiskSpaceWarning`)}),(0,G.jsx)(`p`,{className:`text-xs text-amber-500/80`,children:e(`fileManager.lowDiskSpaceDetails`,{free:Gd(it.disk_free_bytes),total:Gd(it.disk_total_bytes),threshold:Ue.library_disk_warning_gb})})]})]}),it&&(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 sm:gap-6 mb-6 p-3 bg-bambu-dark-secondary rounded-lg border border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,G.jsx)(oc,{className:`w-4 h-4 text-bambu-green`}),(0,G.jsxs)(`span`,{className:`text-bambu-gray`,children:[e(`fileManager.files`),`:`]}),(0,G.jsx)(`span`,{className:`text-white font-medium`,children:it.total_files})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,G.jsx)(dc,{className:`w-4 h-4 text-blue-600 dark:text-blue-400`}),(0,G.jsxs)(`span`,{className:`text-bambu-gray`,children:[e(`fileManager.folders`),`:`]}),(0,G.jsx)(`span`,{className:`text-white font-medium`,children:it.total_folders})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,G.jsx)(Dc,{className:`w-4 h-4 text-amber-600 dark:text-amber-400`}),(0,G.jsxs)(`span`,{className:`text-bambu-gray`,children:[e(`fileManager.size`),`:`]}),(0,G.jsx)(`span`,{className:`text-white font-medium`,children:Gd(it.total_size_bytes)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm sm:ml-auto`,children:[(0,G.jsxs)(`span`,{className:`text-bambu-gray`,children:[e(`fileManager.free`),`:`]}),(0,G.jsx)(`span`,{className:`font-medium ${ct?`text-amber-500`:`text-white`}`,children:Gd(it.disk_free_bytes)})]})]}),(0,G.jsxs)(`div`,{className:`flex-1 flex flex-col lg:flex-row gap-4 lg:gap-6 min-h-0`,children:[(0,G.jsx)(`div`,{className:`lg:hidden`,children:(0,G.jsxs)(`select`,{value:u===null?`__top:${p}`:String(u),onChange:e=>{let t=e.target.value;t.startsWith(`__top:`)?(d(null),m(t.slice(6))):d(parseInt(t,10))},className:`w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg px-3 py-2.5 text-white focus:outline-none focus:border-bambu-green`,children:[(0,G.jsxs)(`option`,{value:`__top:internal`,children:[`📁 `,e(`fileManager.allFiles`)]}),qe?.some(e=>e.is_external)&&(0,G.jsxs)(`option`,{value:`__top:external`,children:[`🔗 `,e(`fileManager.allExternal`)]}),Ye&&(()=>{let e=(t,n=0)=>{let r=[];for(let i of t)r.push({id:i.id,name:i.name,fileCount:i.file_count,depth:n}),i.children.length>0&&r.push(...e(i.children,n+1));return r};return e(Ye).map(e=>(0,G.jsxs)(`option`,{value:e.id,children:[`│ `.repeat(e.depth),`📂 `,e.name,` `,e.fileCount>0?`(${e.fileCount})`:``]},e.id))})()]})}),(0,G.jsxs)(`div`,{ref:Ae,className:`hidden lg:flex flex-shrink-0 bg-bambu-dark-secondary rounded-lg border border-bambu-dark-tertiary overflow-hidden flex-col relative`,style:{width:`${Ee}px`},children:[(0,G.jsx)(`div`,{className:`absolute right-0 top-0 bottom-0 w-1.5 cursor-col-resize z-10 group/resize flex items-center justify-center transition-colors ${Oe?`bg-bambu-green`:`hover:bg-bambu-green/50`}`,onMouseDown:e=>{e.preventDefault(),ke(!0)},onDoubleClick:()=>{De(256),localStorage.setItem(`library-sidebar-width`,`256`)},title:e(`fileManager.dragToResizeTooltip`),children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 opacity-0 group-hover/resize:opacity-100 transition-opacity ${Oe?`opacity-100`:``}`,children:[(0,G.jsx)(`div`,{className:`w-0.5 h-0.5 rounded-full bg-white/70`}),(0,G.jsx)(`div`,{className:`w-0.5 h-0.5 rounded-full bg-white/70`}),(0,G.jsx)(`div`,{className:`w-0.5 h-0.5 rounded-full bg-white/70`})]})}),(0,G.jsxs)(`div`,{className:`p-3 border-b border-bambu-dark-tertiary flex items-center justify-between`,children:[(0,G.jsx)(`h2`,{className:`text-sm font-medium text-white`,children:e(`fileManager.folders`)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsxs)(`select`,{value:Se,onChange:e=>{let t=e.target.value===`activity`?`activity`:`name`;Ce(t),localStorage.setItem(`library-folder-sort-field`,t)},className:`text-xs px-1 py-0.5 rounded bg-bambu-dark border border-bambu-dark-tertiary text-bambu-gray focus:outline-none focus:border-bambu-green`,title:e(`fileManager.folderSort`),"aria-label":e(`fileManager.folderSort`),children:[(0,G.jsx)(`option`,{value:`name`,children:e(`fileManager.folderSortByName`)}),(0,G.jsx)(`option`,{value:`activity`,children:e(`fileManager.folderSortByActivity`)})]}),(0,G.jsx)(`button`,{onClick:()=>{let e=we===`asc`?`desc`:`asc`;Te(e),localStorage.setItem(`library-folder-sort-direction`,e)},className:`text-bambu-gray hover:text-white hover:bg-bambu-dark p-1 rounded transition-colors`,title:e(we===`asc`?`fileManager.ascending`:`fileManager.descending`),"aria-label":e(we===`asc`?`fileManager.ascending`:`fileManager.descending`),children:we===`asc`?(0,G.jsx)(Fo,{className:`w-3.5 h-3.5`}):(0,G.jsx)(ko,{className:`w-3.5 h-3.5`})}),(0,G.jsx)(`button`,{onClick:()=>{let e=!be;xe(e),localStorage.setItem(`library-collapse-folders`,String(e))},className:`text-xs px-1.5 py-0.5 rounded transition-colors ${be?`bg-bambu-green/20 text-bambu-green`:`text-bambu-gray hover:text-white hover:bg-bambu-dark`}`,title:e(be?`fileManager.expandFoldersByDefault`:`fileManager.collapseFoldersByDefault`),children:e(`fileManager.collapse`)}),(0,G.jsx)(`button`,{onClick:()=>{let e=!ve;ye(e),localStorage.setItem(`library-wrap-folders`,String(e))},className:`text-xs px-1.5 py-0.5 rounded transition-colors ${ve?`bg-bambu-green/20 text-bambu-green`:`text-bambu-gray hover:text-white hover:bg-bambu-dark`}`,title:e(ve?`fileManager.disableTextWrapping`:`fileManager.enableTextWrapping`),children:e(`fileManager.wrap`)})]})]}),(0,G.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1.5 rounded cursor-pointer transition-colors ${u===null&&p===`internal`?`bg-bambu-green/20 text-bambu-green`:`hover:bg-bambu-dark text-white`}`,onClick:()=>{d(null),m(`internal`)},children:[(0,G.jsx)(ec,{className:`w-4 h-4`}),(0,G.jsx)(`span`,{className:`text-sm`,children:e(`fileManager.allFiles`)})]}),qe?.some(e=>e.is_external)&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1.5 rounded cursor-pointer transition-colors ${u===null&&p===`external`?`bg-bambu-green/20 text-bambu-green`:`hover:bg-bambu-dark text-white`}`,onClick:()=>{d(null),m(`external`)},children:[(0,G.jsx)(pc,{className:`w-4 h-4 text-purple-600 dark:text-purple-400`}),(0,G.jsx)(`span`,{className:`text-sm`,children:e(`fileManager.allExternal`)})]}),Ye?.map(t=>(0,G.jsx)(T1e,{folder:t,selectedFolderId:u,onSelect:d,onDelete:e=>R({type:`folder`,id:e}),onLink:I,onRename:e=>ie({type:`folder`,id:e.id,name:e.name}),wrapNames:ve,defaultExpanded:!be,showModified:Ve,hasPermission:r,t:e},`${t.id}-${be?`c`:`e`}`))]})]}),(0,G.jsxs)(`div`,{className:`flex-1 flex flex-col lg:flex-row min-w-0 min-h-0 gap-4 lg:gap-6`,children:[(0,G.jsxs)(`div`,{className:`flex-1 flex flex-col min-w-0 min-h-0`,children:[$e.length>0&&(0,G.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center gap-2 p-2 sm:p-3 bg-bambu-dark-secondary rounded-lg border border-bambu-dark-tertiary`,children:[(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray font-medium shrink-0`,children:e(`fileManager.tags.filterLabel`)}),$e.map(e=>{let t=N.includes(e.id);return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>tt(e.id),className:t?`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs bg-bambu-green/20 text-bambu-green border border-bambu-green/40 hover:bg-bambu-green/30 transition-colors`:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs bg-bambu-dark text-bambu-gray border border-bambu-dark-tertiary hover:text-white hover:border-bambu-green/40 transition-colors`,title:e.name,children:[(0,G.jsx)(xu,{className:`w-3 h-3`}),(0,G.jsx)(`span`,{children:e.name}),t&&(0,G.jsx)($u,{className:`w-3 h-3`})]},e.id)}),N.length>0&&(0,G.jsx)(`button`,{type:`button`,onClick:()=>P([]),className:`ml-auto text-xs text-bambu-gray hover:text-white shrink-0`,children:e(`fileManager.tags.clearAll`)})]}),zt?.is_external&&(0,G.jsxs)(`div`,{className:`flex items-center gap-3 mb-4 p-3 bg-purple-50 dark:bg-purple-500/10 border border-purple-300 dark:border-purple-500/30 rounded-lg`,children:[(0,G.jsx)(pc,{className:`w-5 h-5 text-purple-600 dark:text-purple-400 flex-shrink-0`}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium text-purple-700 dark:text-purple-300`,children:e(`fileManager.externalFolder`)}),zt.external_readonly&&(0,G.jsxs)(`span`,{className:`text-xs px-1.5 py-0.5 rounded bg-amber-100 dark:bg-amber-500/20 text-amber-700 dark:text-amber-400 flex items-center gap-1`,children:[(0,G.jsx)(Xc,{className:`w-3 h-3`}),e(`fileManager.readOnly`)]})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray truncate font-mono`,title:zt.external_path||``,children:zt.external_path})]}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:()=>u&&dt.mutate(u),disabled:dt.isPending,title:e(`fileManager.scanFolder`),children:[dt.isPending?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(Il,{className:`w-4 h-4`}),(0,G.jsx)(`span`,{className:`ml-1.5`,children:e(`fileManager.scanFolder`)})]})]}),nt&&nt.length>0&&(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 sm:gap-3 mb-4 p-2 sm:p-3 bg-bambu-dark-secondary rounded-lg border border-bambu-dark-tertiary sticky top-0 z-10 lg:static`,children:[(0,G.jsxs)(`div`,{className:`relative w-full sm:w-auto sm:flex-1 sm:max-w-xs`,children:[(0,G.jsx)(Kl,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray`}),(0,G.jsx)(`input`,{type:`text`,placeholder:e(`fileManager.searchFiles`),value:je,onChange:e=>Me(e.target.value),className:`w-full pl-9 pr-3 py-1.5 bg-bambu-dark border border-bambu-dark-tertiary rounded text-sm text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green`}),Ze&&(0,G.jsx)(`span`,{className:`absolute -bottom-4 left-0 text-[10px] text-bambu-gray whitespace-nowrap`,title:e(`fileManager.searchSubfoldersHint`),children:e(`fileManager.searchSubfoldersHint`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(_c,{className:`w-4 h-4 text-bambu-gray hidden sm:block`}),(0,G.jsxs)(`select`,{value:Ne,onChange:e=>Pe(e.target.value),className:`bg-bambu-dark border border-bambu-dark-tertiary rounded px-2 py-1.5 text-sm text-white focus:outline-none focus:border-bambu-green`,children:[(0,G.jsx)(`option`,{value:`all`,children:e(`fileManager.allTypes`)}),ot.map(e=>(0,G.jsx)(`option`,{value:e,children:e.toUpperCase()},e))]})]}),o&&(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(`input`,{type:`text`,placeholder:e(`fileManager.filterByUser`,{defaultValue:`Filter by user`}),value:Fe,onChange:e=>Ie(e.target.value),list:`usernames-list`,className:`w-32 sm:w-40 px-2 py-1.5 bg-bambu-dark border border-bambu-dark-tertiary rounded text-sm text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green ${Fe?`pr-7`:``}`,style:Fe?{WebkitAppearance:`none`,MozAppearance:`textfield`}:void 0}),Fe&&(0,G.jsx)(`button`,{onClick:()=>Ie(``),className:`absolute right-2 top-1/2 -translate-y-1/2 text-bambu-gray hover:text-white z-10`,children:(0,G.jsx)($u,{className:`w-3 h-3`})}),(0,G.jsx)(`datalist`,{id:`usernames-list`,children:at?.map(e=>(0,G.jsx)(`option`,{value:e.username},e.id))})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`select`,{value:Le,onChange:e=>{let t=e.target.value;Re(t),localStorage.setItem(`library-sort-field`,t)},className:`bg-bambu-dark border border-bambu-dark-tertiary rounded px-2 py-1.5 text-sm text-white focus:outline-none focus:border-bambu-green`,children:[(0,G.jsx)(`option`,{value:`name`,children:e(`common.name`)}),(0,G.jsx)(`option`,{value:`date`,children:e(`common.date`)}),(0,G.jsx)(`option`,{value:`size`,children:e(`fileManager.size`)}),(0,G.jsx)(`option`,{value:`type`,children:e(`common.type`)}),(0,G.jsx)(`option`,{value:`prints`,children:e(`fileManager.prints`)})]}),(0,G.jsx)(`button`,{onClick:()=>Be(e=>{let t=e===`asc`?`desc`:`asc`;return localStorage.setItem(`library-sort-direction`,t),t}),className:`p-1.5 rounded bg-bambu-dark border border-bambu-dark-tertiary hover:border-bambu-green transition-colors`,title:e(ze===`asc`?`fileManager.ascending`:`fileManager.descending`),children:ze===`asc`?(0,G.jsx)(Fo,{className:`w-4 h-4 text-white`}):(0,G.jsx)(ko,{className:`w-4 h-4 text-white`})}),(0,G.jsx)(`button`,{onClick:()=>He(e=>{let t=!e;return localStorage.setItem(`library-show-modified`,String(t)),t}),className:`p-1.5 rounded bg-bambu-dark border transition-colors ${Ve?`border-bambu-green text-bambu-green`:`border-bambu-dark-tertiary text-white hover:border-bambu-green`}`,title:e(Ve?`fileManager.hideModified`:`fileManager.showModified`),"aria-pressed":Ve,children:(0,G.jsx)(Zo,{className:`w-4 h-4`})})]}),(je||Ne!==`all`||Fe)&&(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray hidden sm:inline`,children:e(`fileManager.resultsCount`,{showing:st.length,total:nt.length})})]}),st.length>0&&(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 mb-4 p-2 bg-bambu-dark-secondary rounded-lg border border-bambu-dark-tertiary sticky top-[52px] z-10 lg:static`,children:[h.length===st.length&&h.length>0?(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:kt,children:[(0,G.jsx)(mu,{className:`w-4 h-4 sm:mr-1`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:e(`fileManager.deselectAll`)})]}):(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:Ot,children:[(0,G.jsx)(fu,{className:`w-4 h-4 sm:mr-1`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:e(`fileManager.selectAll`)})]}),h.length>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray ml-2`,children:e(`fileManager.selected`,{count:h.length})}),(0,G.jsx)(`div`,{className:`hidden sm:block flex-1`}),(0,G.jsxs)(`div`,{className:`w-full sm:w-auto flex flex-wrap items-center gap-2 mt-2 sm:mt-0`,children:[Ct&&(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:()=>St(Ct),disabled:!r(`library:read`),title:r(`library:read`)?void 0:e(`fileManager.noPermissionPreview`),children:[(0,G.jsx)(Qs,{className:`w-4 h-4 sm:mr-1`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:e(`fileManager.preview.open`)})]}),wt.length>=1&&(0,G.jsxs)(Q,{variant:`primary`,size:`sm`,onClick:()=>B(wt[0]),disabled:!r(`queue:create`),title:r(`queue:create`)?void 0:e(`fileManager.noPermissionAddToQueue`),children:[(0,G.jsx)(Ml,{className:`w-4 h-4 sm:mr-1`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:wt.length>1?e(`fileManager.variants.printAlternatives`,{count:wt.length}):e(`common.print`)})]}),wt.length>=2&&!wt.some(e=>e.variant_group_id)&&(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:()=>mt.mutate(wt.map(e=>e.id)),disabled:mt.isPending||!i(`library:update_own`,`library:update_all`),title:e(`fileManager.variants.groupTooltip`),children:[(0,G.jsx)(Hc,{className:`w-4 h-4 sm:mr-1`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:e(`fileManager.variants.groupAction`)})]}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:()=>S(!0),disabled:!i(`library:update_own`,`library:update_all`),title:i(`library:update_own`,`library:update_all`)?void 0:e(`fileManager.noPermissionMoveFiles`),children:[(0,G.jsx)(fl,{className:`w-4 h-4 sm:mr-1`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:e(`common.move`)})]}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:()=>M(!0),disabled:!i(`library:update_own`,`library:update_all`),title:i(`library:update_own`,`library:update_all`)?e(`fileManager.tags.bulkTooltip`):e(`fileManager.tags.noPermission`),children:[(0,G.jsx)(xu,{className:`w-4 h-4 sm:mr-1`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:e(`fileManager.tags.tagAction`)})]}),(0,G.jsxs)(Q,{variant:`danger`,size:`sm`,onClick:()=>{h.length===1?R({type:`file`,id:h[0]}):R({type:`bulk`,id:0,count:h.length})},disabled:!i(`library:delete_own`,`library:delete_all`),title:i(`library:delete_own`,`library:delete_all`)?void 0:e(`fileManager.noPermissionDeleteFiles`),children:[(0,G.jsx)(ju,{className:`w-4 h-4 sm:mr-1`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:e(`common.delete`)})]}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:kt,children:[(0,G.jsx)($u,{className:`w-4 h-4 sm:mr-1`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:e(`common.clear`)})]})]})]})]}),Rt?(0,G.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,G.jsx)(Y,{className:`w-8 h-8 animate-spin text-bambu-green`}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`fileManager.loadingFiles`)})]})}):nt?.length===0?(0,G.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center`,children:[(0,G.jsx)(`div`,{className:`p-4 bg-bambu-dark rounded-2xl mb-4`,children:(0,G.jsx)(ec,{className:`w-12 h-12 text-bambu-gray/50`})}),(0,G.jsx)(`h3`,{className:`text-lg font-medium text-white mb-2`,children:e(u===null?p===`external`?`fileManager.externalIsEmpty`:`fileManager.noFilesYet`:`fileManager.folderIsEmpty`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-center max-w-md mb-6`,children:e(u===null?p===`external`?`fileManager.externalEmptyDescription`:`fileManager.noFilesDescription`:`fileManager.folderEmptyDescription`)}),(0,G.jsxs)(Q,{onClick:()=>w(!0),disabled:!r(`library:upload`),title:r(`library:upload`)?void 0:e(`fileManager.noPermissionUpload`),children:[(0,G.jsx)(kl,{className:`w-4 h-4 mr-2`}),e(`fileManager.uploadFiles`)]})]}):st.length===0?(0,G.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center`,children:[(0,G.jsx)(`div`,{className:`p-4 bg-bambu-dark rounded-2xl mb-4`,children:(0,G.jsx)(Kl,{className:`w-12 h-12 text-bambu-gray/50`})}),(0,G.jsx)(`h3`,{className:`text-lg font-medium text-white mb-2`,children:e(`fileManager.noMatchingFiles`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-center max-w-md mb-6`,children:e(`fileManager.noMatchingFilesDescription`)}),(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>{Me(``),Pe(`all`)},children:e(`fileManager.clearFilters`)})]}):ge===`grid`?(0,G.jsx)(`div`,{className:`flex-1 lg:overflow-y-auto`,children:(0,G.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 2xl:grid-cols-6 gap-4`,children:st.map(t=>(0,G.jsx)(E1e,{file:t,isSelected:h.includes(t.id),t:e,onSelect:Dt,onDelete:e=>R({type:`file`,id:e}),onDownload:Pt,onPrint:B,onSlice:ee,onOpenInSlicer:Ge,desktopSlicer:We,onRunPipeline:ne,useSlicerApi:Ue?.use_slicer_api??!1,canSlice:Ke(),onPreview:St,onRename:e=>ie({type:`file`,id:e.id,name:e.filename}),onDetails:pe,onGenerateThumbnail:e=>xt.mutate(e.id),onTagClick:tt,thumbnailVersion:ae[t.id],hasPermission:r,canModify:a,authEnabled:o,showModified:Ve},t.id))})}):(0,G.jsx)(`div`,{className:`flex-1 lg:overflow-y-auto`,children:(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg border border-bambu-dark-tertiary overflow-x-auto`,children:[(0,G.jsxs)(`div`,{className:`hidden sm:grid ${o?`grid-cols-[auto_1fr_120px_100px_100px_100px_minmax(0,200px)_220px]`:`grid-cols-[auto_1fr_100px_100px_100px_minmax(0,200px)_220px]`} gap-4 px-4 py-2 bg-bambu-dark-secondary border-b border-bambu-dark-tertiary text-xs text-bambu-gray font-medium`,children:[(0,G.jsx)(`div`,{className:`w-6`}),(0,G.jsx)(`div`,{children:e(`common.name`)}),o&&(0,G.jsx)(`div`,{children:e(`fileManager.uploadedBy`,{defaultValue:`Uploaded By`})}),(0,G.jsx)(`div`,{children:e(`common.type`)}),(0,G.jsx)(`div`,{children:e(`fileManager.size`)}),(0,G.jsx)(`div`,{children:e(`fileManager.prints`)}),(0,G.jsx)(`div`,{children:e(`fileManager.tags.title`)}),(0,G.jsx)(`div`,{})]}),st.map(t=>(0,G.jsxs)(`div`,{className:`grid ${o?`grid-cols-[auto_1fr_120px_100px_100px_100px_minmax(0,200px)_220px]`:`grid-cols-[auto_1fr_100px_100px_100px_minmax(0,200px)_220px]`} gap-4 px-4 py-3 items-center border-b border-bambu-dark-tertiary last:border-b-0 cursor-pointer hover:bg-bambu-dark/50 transition-colors ${h.includes(t.id)?`bg-bambu-green/10`:``}`,onClick:()=>Dt(t.id),onDoubleClick:()=>St(t),children:[(0,G.jsx)(`div`,{className:`w-5 h-5 rounded border-2 flex items-center justify-center ${h.includes(t.id)?`bg-bambu-green border-bambu-green`:`border-bambu-gray/50`}`,children:h.includes(t.id)&&(0,G.jsx)(`div`,{className:`w-2 h-2 bg-white rounded-sm`})}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`relative group/thumb`,children:[(0,G.jsx)(`div`,{className:`w-10 h-10 rounded bg-bambu-dark flex-shrink-0 overflow-hidden`,children:t.thumbnail_path?(0,G.jsx)(`img`,{src:`${Z.getLibraryFileThumbnailUrl(t.id)}${ae[t.id]?(Z.getLibraryFileThumbnailUrl(t.id).includes(`?`)?`&`:`?`)+`v=${ae[t.id]}`:``}`,alt:``,className:`w-full h-full object-cover`}):(0,G.jsx)(`div`,{className:`w-full h-full flex items-center justify-center`,children:t.file_type===`pdf`?(0,G.jsx)(ac,{className:`w-5 h-5 text-bambu-gray/50`}):Z7(t.file_type)?(0,G.jsx)(ic,{className:`w-5 h-5 text-bambu-gray/50`}):m1e(t.file_type)?(0,G.jsx)(Ic,{className:`w-5 h-5 text-bambu-gray/50`}):(0,G.jsx)(ec,{className:`w-5 h-5 text-bambu-gray/50`})})}),t.thumbnail_path&&(0,G.jsx)(`div`,{className:`absolute left-0 top-full mt-2 z-50 hidden group-hover/thumb:block`,children:(0,G.jsx)(`div`,{className:`w-48 h-48 rounded-lg bg-bambu-dark-secondary border border-bambu-dark-tertiary shadow-xl overflow-hidden`,children:(0,G.jsx)(`img`,{src:`${Z.getLibraryFileThumbnailUrl(t.id)}${ae[t.id]?(Z.getLibraryFileThumbnailUrl(t.id).includes(`?`)?`&`:`?`)+`v=${ae[t.id]}`:``}`,alt:t.filename,className:`w-full h-full object-contain`})})})]}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,G.jsx)(`span`,{className:`text-sm text-white truncate`,children:t.print_name||t.filename}),t.external_url&&(0,G.jsx)(`a`,{href:t.external_url,target:`_blank`,rel:`noopener noreferrer`,...e9,className:`flex-shrink-0 text-bambu-gray hover:text-bambu-green`,title:e(`fileManager.details.openLink`),"aria-label":e(`fileManager.details.openLink`),children:(0,G.jsx)(Cc,{className:`w-3.5 h-3.5`})}),t.has_notes&&(0,G.jsx)(`span`,{className:`flex-shrink-0 text-bambu-gray`,title:e(`fileManager.details.hasNotes`),"aria-label":e(`fileManager.details.hasNotes`),children:(0,G.jsx)(_u,{className:`w-3.5 h-3.5`})}),(t.photo_count??0)>0&&(0,G.jsxs)(`span`,{className:`flex-shrink-0 flex items-center gap-0.5 text-xs text-bambu-gray`,title:e(`fileManager.details.photoCount`,{count:t.photo_count}),children:[(0,G.jsx)($o,{className:`w-3.5 h-3.5`}),t.photo_count]})]}),Ve&&(0,G.jsxs)(`div`,{className:`text-xs text-bambu-gray flex items-center gap-1 mt-0.5`,title:e(`fileManager.lastModified`),children:[(0,G.jsx)(Zo,{className:`w-3 h-3 flex-shrink-0`}),(0,G.jsx)(`span`,{className:`truncate`,children:ep(t.fs_modified_at??t.created_at)})]})]})]}),o&&(0,G.jsx)(`div`,{className:`text-sm text-bambu-gray flex items-center gap-1`,children:t.created_by_username?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(zu,{className:`w-3 h-3`}),(0,G.jsx)(`span`,{className:`truncate`,children:t.created_by_username})]}):`-`}),(0,G.jsx)(`div`,{children:(0,G.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded font-medium ${t.file_type===`3mf`?`bg-bambu-green/20 text-bambu-green`:t.file_type===`gcode`||t.file_type===`gcode.3mf`?`bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400`:t.file_type===`stl`?`bg-purple-100 dark:bg-purple-500/20 text-purple-700 dark:text-purple-400`:Q7(t.file_type)?`bg-amber-100 dark:bg-amber-500/20 text-amber-700 dark:text-amber-400`:t.file_type===`pdf`?`bg-red-100 dark:bg-red-500/20 text-red-700 dark:text-red-400`:Z7(t.file_type)?`bg-teal-100 dark:bg-teal-500/20 text-teal-700 dark:text-teal-400`:`bg-bambu-gray/20 text-bambu-gray`}`,children:t.file_type.toUpperCase()})}),(0,G.jsx)(`div`,{className:`text-sm text-bambu-gray`,children:Gd(t.file_size)}),(0,G.jsx)(`div`,{className:`text-sm text-bambu-gray`,children:t.print_count>0?`${t.print_count}x`:`-`}),(0,G.jsx)(`div`,{className:`min-w-0`,...e9,children:!t.tags||t.tags.length===0?(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray/50`,children:`-`}):(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:t.tags.map(e=>(0,G.jsxs)(`button`,{type:`button`,onClick:()=>tt(e.id),className:`inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded-full text-[10px] bg-bambu-green/10 text-bambu-green hover:bg-bambu-green/20 transition-colors max-w-full`,title:e.name,children:[(0,G.jsx)(xu,{className:`w-2.5 h-2.5 flex-shrink-0`}),(0,G.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id))})}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,...e9,children:[T5(t)&&(0,G.jsx)(G.Fragment,{children:(0,G.jsx)(`button`,{onClick:()=>r(`queue:create`)&&B(t),className:`p-1.5 rounded transition-colors ${r(`queue:create`)?`hover:bg-bambu-dark text-bambu-gray hover:text-bambu-green`:`text-bambu-gray/50 cursor-not-allowed`}`,title:r(`queue:create`)?e(`common.print`):e(`fileManager.noPermissionAddToQueue`),disabled:!r(`queue:create`),children:(0,G.jsx)(Ml,{className:`w-4 h-4`})})}),E5(t,!!Ue?.use_slicer_api,We)&&(0,G.jsx)(`button`,{onClick:()=>{Ke()&&(Ue?.use_slicer_api?ee:Ge)(t)},className:`p-1.5 rounded transition-colors ${Ke()?`hover:bg-bambu-dark text-bambu-gray hover:text-bambu-green`:`text-bambu-gray/50 cursor-not-allowed`}`,title:Ke()?e(`slice.action`):Ue?.use_slicer_api?e(`fileManager.noPermissionSlice`):e(`fileManager.noPermissionDownload`),disabled:!Ke(),children:Ue?.use_slicer_api?(0,G.jsx)(js,{className:`w-4 h-4`}):(0,G.jsx)(Xs,{className:`w-4 h-4`})}),(Ue?.use_slicer_api??!1)&&E5(t,!0,We)&&(0,G.jsx)(`button`,{onClick:()=>r(`pipelines:run`)&&ne(t),className:`p-1.5 rounded transition-colors ${r(`pipelines:run`)?`hover:bg-bambu-dark text-bambu-gray hover:text-bambu-green`:`text-bambu-gray/50 cursor-not-allowed`}`,title:r(`pipelines:run`)?e(`library.runWithPipeline.actionLabel`,`Run with pipeline`):e(`library.runWithPipeline.noPermission`,`You do not have permission to run pipelines`),disabled:!r(`pipelines:run`),children:(0,G.jsx)(Dl,{className:`w-4 h-4`})}),t9(t)&&(0,G.jsx)(`button`,{onClick:()=>St(t),className:`p-1.5 rounded transition-colors ${r(`library:read`)?`hover:bg-bambu-dark text-bambu-gray hover:text-bambu-green`:`text-bambu-gray/50 cursor-not-allowed`}`,title:r(`library:read`)?e(`fileManager.preview3d`):e(`fileManager.noPermissionPreview`),disabled:!r(`library:read`),children:(0,G.jsx)(Go,{className:`w-4 h-4`})}),!t9(t)&&$7(t)&&(0,G.jsx)(`button`,{onClick:()=>St(t),className:`p-1.5 rounded transition-colors ${r(`library:read`)?`hover:bg-bambu-dark text-bambu-gray hover:text-bambu-green`:`text-bambu-gray/50 cursor-not-allowed`}`,title:r(`library:read`)?e(`fileManager.preview.open`):e(`fileManager.noPermissionPreview`),disabled:!r(`library:read`),children:g1e(t.file_type)}),(0,G.jsx)(`button`,{onClick:()=>r(`library:read`)&&Pt(t.id),className:`p-1.5 rounded transition-colors ${r(`library:read`)?`hover:bg-bambu-dark text-bambu-gray hover:text-white`:`text-bambu-gray/50 cursor-not-allowed`}`,title:r(`library:read`)?e(`common.download`):e(`fileManager.noPermissionDownload`),disabled:!r(`library:read`),children:(0,G.jsx)(Us,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{onClick:()=>r(`library:read`)&&pe(t),className:`p-1.5 rounded transition-colors ${r(`library:read`)?`hover:bg-bambu-dark text-bambu-gray hover:text-white`:`text-bambu-gray/50 cursor-not-allowed`}`,title:r(`library:read`)?e(`fileManager.details.title`):e(`fileManager.noPermissionPreview`),disabled:!r(`library:read`),children:(0,G.jsx)(Rc,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{onClick:()=>a(`library`,`update`,t.created_by_id)&&ie({type:`file`,id:t.id,name:t.filename}),className:`p-1.5 rounded transition-colors ${a(`library`,`update`,t.created_by_id)?`hover:bg-bambu-dark text-bambu-gray hover:text-white`:`text-bambu-gray/50 cursor-not-allowed`}`,title:a(`library`,`update`,t.created_by_id)?e(`common.rename`):e(`fileManager.noPermissionRenameFile`),disabled:!a(`library`,`update`,t.created_by_id),children:(0,G.jsx)(wl,{className:`w-4 h-4`})}),_1e(t.file_type)&&(0,G.jsx)(`button`,{onClick:()=>a(`library`,`update`,t.created_by_id)&&xt.mutate(t.id),className:`p-1.5 rounded transition-colors ${a(`library`,`update`,t.created_by_id)?`hover:bg-bambu-dark text-bambu-gray hover:text-bambu-green`:`text-bambu-gray/50 cursor-not-allowed`}`,title:a(`library`,`update`,t.created_by_id)?e(`fileManager.generateThumbnail`):e(`fileManager.noPermissionGenerateThumbnail`),disabled:xt.isPending||!a(`library`,`update`,t.created_by_id),children:(0,G.jsx)(Ic,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{onClick:()=>a(`library`,`delete`,t.created_by_id)&&R({type:`file`,id:t.id}),className:`p-1.5 rounded transition-colors ${a(`library`,`delete`,t.created_by_id)?`hover:bg-bambu-dark text-bambu-gray hover:text-red-700 dark:hover:text-red-400`:`text-bambu-gray/50 cursor-not-allowed`}`,title:a(`library`,`delete`,t.created_by_id)?e(`common.delete`):e(`fileManager.noPermissionDeleteFile`),disabled:!a(`library`,`delete`,t.created_by_id),children:(0,G.jsx)(ju,{className:`w-4 h-4`})})]})]},t.id))]})})]}),u!==null&&(0,G.jsx)(i1e,{folderId:u})]})]}),_&&(0,G.jsx)(v1e,{parentId:u,onClose:()=>v(!1),onSave:e=>lt.mutate(e),isLoading:lt.isPending,t:e}),y&&(0,G.jsx)(y1e,{onClose:()=>b(!1),onSave:e=>ut.mutate(e),isLoading:ut.isPending,t:e}),x&&qe&&(0,G.jsx)(C1e,{folders:qe,selectedFiles:h,currentFolderId:u,onClose:()=>S(!1),onMove:e=>gt.mutate({fileIds:h,folderId:e}),isLoading:gt.isPending,t:e}),C&&(0,G.jsx)(BU,{folderId:u,onClose:()=>{w(!1),E([])},onUploadComplete:At,initialFiles:T.length>0?T:void 0}),D&&(0,G.jsx)(c1e,{onClose:()=>O(!1)}),(0,G.jsx)(a1e,{open:k,onClose:()=>A(!1),onPickTag:e=>{N.includes(e)||P(t=>[...t,e])}}),(0,G.jsx)(Rqe,{open:j,fileIds:h,onClose:()=>M(!1)}),F&&(0,G.jsx)(w1e,{folder:F,onClose:()=>I(null),onLink:e=>_t.mutate({id:F.id,data:e}),isLoading:_t.isPending,t:e}),L&&(0,G.jsx)(af,{title:L.type===`folder`?e(`fileManager.deleteFolder`):L.type===`bulk`?e(`fileManager.deleteFilesCount`,{count:L.count}):e(`fileManager.deleteFile`),message:L.type===`folder`?e(`fileManager.deleteFolderConfirm`):L.type===`bulk`?e(`fileManager.deleteFilesConfirm`,{count:L.count}):e(`fileManager.deleteFileConfirm`),confirmText:e(`common.delete`),variant:`danger`,isLoading:It,loadingText:e(`fileManager.deleting`),onConfirm:Ft,onCancel:()=>R(null)}),z&&(!z.variant_group_id||Tt!==void 0)&&(0,G.jsx)(Rm,{mode:`create`,libraryFileId:Et?.[0]?.id??z.id,variantFiles:Et,archiveName:Et&&Et.length>1?`${Et[0].filename} ${e(`common.plusNMore`,{count:Et.length-1})}`:z.print_name||z.filename,onClose:()=>B(null),onSuccess:()=>{B(null),g([]),t.invalidateQueries({queryKey:[`library-files`]}),t.invalidateQueries({queryKey:[`queue`]}),t.invalidateQueries({queryKey:[`archives`]})}}),V&&(0,G.jsx)(LW,{source:{kind:`libraryFile`,id:V.id,filename:V.filename},onClose:()=>ee(null)}),te&&(0,G.jsx)(BW,{source:{kind:`libraryFile`,id:te.id,filename:te.filename},onClose:()=>ne(null)}),se&&(0,G.jsx)(Lqe,{libraryFileId:se.id,title:se.print_name||se.filename,fileType:se.file_type,onClose:()=>H(null),onSnapshot:Q7(se.file_type)?Nt(se):void 0,onSliceWithBambuddy:E5(se,!0,We)&&r(`library:upload`)?()=>{let e=se;H(null),ee(e)}:void 0}),(ce||ue||me)&&(0,G.jsxs)(f.Suspense,{fallback:null,children:[ce&&(0,G.jsx)(l1e,{libraryFileId:ce.id,filename:ce.print_name||ce.filename,fileSize:ce.file_size,onClose:()=>le(null),onSnapshot:Nt(ce)}),ue&&(0,G.jsx)(u1e,{libraryFileId:ue.id,filename:ue.print_name||ue.filename,fileType:ue.file_type,fileSize:ue.file_size,onClose:()=>de(null),onSnapshot:Nt(ue)}),me&&(0,G.jsx)(d1e,{libraryFileId:me.id,filename:me.print_name||me.filename,fileSize:me.file_size,onClose:()=>he(null)})]}),fe&&(0,G.jsx)(o1e,{file:fe,canEdit:a(`library`,`update`,fe.created_by_id),onClose:()=>pe(null)}),re&&(0,G.jsx)(S1e,{type:re.type,currentName:re.name,onClose:()=>ie(null),onSave:e=>{re.type===`file`?vt.mutate({id:re.id,filename:e}):yt.mutate({id:re.id,name:e})},isLoading:vt.isPending||yt.isPending,t:e})]})}function O1e(e){let t=$f(e);if(!t)return``;let n=Math.ceil((t.getTime()-Date.now())/(1e3*60*60*24));return n<=0?`any moment`:n===1?`1 day`:`${n} days`}function k1e(e){let t=$f(e);return t?t.toLocaleString():e}function A1e(){let{t:e}=U(),t=$n(),n=no(),{showToast:r}=qd(),{hasPermission:i,authEnabled:a}=Nd(),[o,s]=(0,f.useState)(null),[c,l]=(0,f.useState)(new Set),u=!a||i(`library:purge`),d=K({queryKey:[`library-trash`],queryFn:()=>Z.listLibraryTrash(200,0)}),p=K({queryKey:[`library-trash-settings`],queryFn:()=>Z.getLibraryTrashSettings(),enabled:u}),[m,h]=(0,f.useState)(null);(0,f.useEffect)(()=>{p.data&&m===null&&h(p.data.retention_days)},[p.data,m]);let g=q({mutationFn:e=>{let t=p.data;return Z.updateLibraryTrashSettings({retention_days:e,auto_purge_enabled:t?.auto_purge_enabled??!1,auto_purge_days:t?.auto_purge_days??90,auto_purge_include_never_printed:t?.auto_purge_include_never_printed??!0})},onSuccess:t=>{r(e(`libraryTrash.toast.retentionSaved`,{days:t.retention_days}),`success`),n.invalidateQueries({queryKey:[`library-trash-settings`]}),n.invalidateQueries({queryKey:[`library-trash`]})},onError:t=>r(t.message||e(`libraryTrash.toast.retentionFailed`),`error`)}),_=q({mutationFn:e=>Z.restoreLibraryTrash(e),onSuccess:()=>{r(e(`libraryTrash.toast.restored`),`success`),n.invalidateQueries({queryKey:[`library-trash`]}),n.invalidateQueries({queryKey:[`library-trash-count`]}),n.invalidateQueries({queryKey:[`library-files`]}),n.invalidateQueries({queryKey:[`library-folders`]})},onError:t=>r(t.message||e(`libraryTrash.toast.restoreFailed`),`error`)}),v=q({mutationFn:e=>Z.hardDeleteLibraryTrash(e),onSuccess:()=>{r(e(`libraryTrash.toast.purged`),`success`),n.invalidateQueries({queryKey:[`library-trash`]}),n.invalidateQueries({queryKey:[`library-trash-count`]})},onError:t=>r(t.message||e(`libraryTrash.toast.purgeFailed`),`error`)}),y=q({mutationFn:()=>Z.emptyLibraryTrash(),onSuccess:t=>{r(e(`libraryTrash.toast.emptied`,{count:t.deleted}),`success`),n.invalidateQueries({queryKey:[`library-trash`]}),n.invalidateQueries({queryKey:[`library-trash-count`]})},onError:t=>r(t.message||e(`libraryTrash.toast.emptyFailed`),`error`)}),b=q({mutationFn:e=>Promise.all(e.map(e=>Z.restoreLibraryTrash(e))),onSuccess:(t,i)=>{r(e(`libraryTrash.toast.bulkRestored`,{count:i.length}),`success`),l(new Set),n.invalidateQueries({queryKey:[`library-trash`]}),n.invalidateQueries({queryKey:[`library-trash-count`]}),n.invalidateQueries({queryKey:[`library-files`]}),n.invalidateQueries({queryKey:[`library-folders`]})},onError:t=>r(t.message||e(`libraryTrash.toast.restoreFailed`),`error`)}),x=q({mutationFn:e=>Promise.all(e.map(e=>Z.hardDeleteLibraryTrash(e))),onSuccess:(t,i)=>{r(e(`libraryTrash.toast.bulkPurged`,{count:i.length}),`success`),l(new Set),n.invalidateQueries({queryKey:[`library-trash`]}),n.invalidateQueries({queryKey:[`library-trash-count`]})},onError:t=>r(t.message||e(`libraryTrash.toast.purgeFailed`),`error`)}),S=(0,f.useMemo)(()=>d.data?.items??[],[d.data?.items]),C=d.data?.retention_days??30,w=(0,f.useMemo)(()=>S.reduce((e,t)=>e+t.file_size,0),[S]),T=S.length>0&&S.every(e=>c.has(e.id)),E=c.size>0&&!T,D=e=>{l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return(0,G.jsxs)(`div`,{className:`p-6 max-w-screen-2xl mx-auto`,children:[(0,G.jsx)(`div`,{className:`flex items-center gap-3 mb-4`,children:(0,G.jsxs)(Ci,{to:`/files`,className:`inline-flex items-center gap-1 text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200`,children:[(0,G.jsx)(jo,{className:`w-4 h-4`}),` `,e(`libraryTrash.backToFiles`)]})}),(0,G.jsxs)(`div`,{className:`flex items-start justify-between mb-6 gap-4 flex-wrap`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`text-2xl font-bold text-gray-900 dark:text-gray-100`,children:e(`libraryTrash.title`)}),(0,G.jsx)(`p`,{className:`text-sm text-gray-600 dark:text-gray-400 mt-1`,children:e(u?`libraryTrash.subtitleAdmin`:`libraryTrash.subtitleUser`,{days:C})})]}),S.length>0&&(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>s({type:`empty`}),className:`text-red-600 dark:text-red-400`,children:[(0,G.jsx)(ju,{className:`w-4 h-4 mr-1`}),e(`libraryTrash.emptyTrash`)]})]}),u&&p.data&&(0,G.jsxs)(`div`,{className:`mb-4 border border-gray-200 dark:border-gray-700 rounded-lg p-3 flex items-center gap-3 bg-gray-50 dark:bg-gray-800/40`,children:[(0,G.jsx)(`label`,{htmlFor:`retention-days`,className:`text-sm font-medium text-gray-700 dark:text-gray-300`,children:e(`libraryTrash.retentionLabel`)}),(0,G.jsx)(`input`,{id:`retention-days`,type:`number`,min:1,max:365,value:m??p.data.retention_days,onChange:e=>h(Math.max(1,Math.min(365,parseInt(e.target.value||`0`,10)||0))),className:`w-20 rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-sm px-2 py-1 text-gray-900 dark:text-gray-100`}),(0,G.jsx)(`span`,{className:`text-sm text-gray-600 dark:text-gray-400`,children:e(`libraryTrash.days`)}),(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>m!=null&&g.mutate(m),disabled:g.isPending||m==null||m===p.data.retention_days,className:`ml-auto`,children:[(0,G.jsx)(Vl,{className:`w-4 h-4 mr-1`}),e(`common.save`)]})]}),d.isLoading?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-gray-500 dark:text-gray-400`,children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),` `,e(`libraryTrash.loading`)]}):S.length===0?(0,G.jsx)(`div`,{className:`border border-dashed border-gray-300 dark:border-gray-700 rounded-lg p-12 text-center`,children:(0,G.jsx)(`p`,{className:`text-gray-500 dark:text-gray-400`,children:e(`libraryTrash.empty`)})}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,G.jsx)(`div`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:e(`libraryTrash.summary`,{count:S.length,size:Gd(w)})}),c.size>0&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,G.jsx)(`span`,{className:`text-gray-600 dark:text-gray-400`,children:e(`libraryTrash.selectionCount`,{count:c.size})}),(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>b.mutate(Array.from(c)),disabled:b.isPending,children:[(0,G.jsx)(Rl,{className:`w-4 h-4 mr-1`}),e(`libraryTrash.bulkRestore`)]}),(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>s({type:`bulkDelete`,count:c.size}),disabled:x.isPending,className:`text-red-600 dark:text-red-400`,children:[(0,G.jsx)(ju,{className:`w-4 h-4 mr-1`}),e(`libraryTrash.bulkPurge`)]})]})]}),(0,G.jsx)(`div`,{className:`border border-gray-200 dark:border-gray-700 rounded-lg overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,G.jsx)(`thead`,{className:`bg-gray-50 dark:bg-gray-800 text-left text-gray-600 dark:text-gray-300`,children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{className:`px-3 py-2 w-10`,children:(0,G.jsx)(`input`,{type:`checkbox`,checked:T,ref:e=>{e&&(e.indeterminate=E)},onChange:()=>{l(e=>e.size===S.length?new Set:new Set(S.map(e=>e.id)))},"aria-label":e(`libraryTrash.selectAll`),className:`rounded border-gray-300 cursor-pointer`})}),(0,G.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`libraryTrash.col.filename`)}),(0,G.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`libraryTrash.col.folder`)}),(0,G.jsx)(`th`,{className:`px-3 py-2 font-medium text-right`,children:e(`libraryTrash.col.size`)}),(0,G.jsx)(`th`,{className:`px-3 py-2 font-medium whitespace-nowrap`,children:e(`libraryTrash.col.deleted`)}),(0,G.jsx)(`th`,{className:`px-3 py-2 font-medium whitespace-nowrap`,children:e(`libraryTrash.col.autoPurge`)}),u&&(0,G.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`libraryTrash.col.owner`)}),(0,G.jsx)(`th`,{className:`px-3 py-2 font-medium text-right`,children:e(`libraryTrash.col.actions`)})]})}),(0,G.jsx)(`tbody`,{className:`divide-y divide-gray-100 dark:divide-gray-800`,children:S.map(t=>(0,G.jsxs)(`tr`,{className:`hover:bg-gray-50 dark:hover:bg-gray-800/50`,children:[(0,G.jsx)(`td`,{className:`px-3 py-2`,children:(0,G.jsx)(`input`,{type:`checkbox`,checked:c.has(t.id),onChange:()=>D(t.id),"aria-label":e(`libraryTrash.selectOne`,{filename:t.filename}),className:`rounded border-gray-300 cursor-pointer`})}),(0,G.jsx)(`td`,{className:`px-3 py-2 text-gray-900 dark:text-gray-100 truncate max-w-md`,title:t.filename,children:t.filename}),(0,G.jsx)(`td`,{className:`px-3 py-2 text-gray-600 dark:text-gray-400`,children:t.folder_name??`—`}),(0,G.jsx)(`td`,{className:`px-3 py-2 text-right text-gray-600 dark:text-gray-400 tabular-nums whitespace-nowrap`,children:Gd(t.file_size)}),(0,G.jsx)(`td`,{className:`px-3 py-2 text-gray-600 dark:text-gray-400 whitespace-nowrap`,children:k1e(t.deleted_at)}),(0,G.jsx)(`td`,{className:`px-3 py-2 text-gray-600 dark:text-gray-400 whitespace-nowrap`,children:(0,G.jsx)(`span`,{title:k1e(t.auto_purge_at),children:e(`libraryTrash.autoPurgeIn`,{when:O1e(t.auto_purge_at)})})}),u&&(0,G.jsx)(`td`,{className:`px-3 py-2 text-gray-600 dark:text-gray-400`,children:t.created_by_username??`—`}),(0,G.jsxs)(`td`,{className:`px-3 py-2 text-right whitespace-nowrap`,children:[(0,G.jsxs)(`button`,{onClick:()=>_.mutate(t.id),disabled:_.isPending,className:`inline-flex items-center gap-1 px-2 py-1 text-xs text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300`,children:[(0,G.jsx)(Rl,{className:`w-3.5 h-3.5`}),e(`libraryTrash.restore`)]}),(0,G.jsxs)(`button`,{onClick:()=>s({type:`delete`,id:t.id,filename:t.filename}),disabled:v.isPending,className:`inline-flex items-center gap-1 px-2 py-1 text-xs text-red-600 hover:text-red-800 dark:text-red-400 dark:hover:text-red-300 ml-2`,children:[(0,G.jsx)(ju,{className:`w-3.5 h-3.5`}),e(`libraryTrash.purgeNow`)]})]})]},t.id))})]})})]}),o&&(0,G.jsx)(af,{onCancel:()=>s(null),onConfirm:()=>{o&&(o.type===`delete`?v.mutate(o.id):o.type===`bulkDelete`?x.mutate(Array.from(c)):y.mutate(),s(null))},title:o.type===`delete`?e(`libraryTrash.confirm.purgeTitle`):o.type===`bulkDelete`?e(`libraryTrash.confirm.bulkPurgeTitle`):e(`libraryTrash.confirm.emptyTitle`),message:o.type===`delete`?e(`libraryTrash.confirm.purgeBody`,{filename:o.filename}):o.type===`bulkDelete`?e(`libraryTrash.confirm.bulkPurgeBody`,{count:o.count}):e(`libraryTrash.confirm.emptyBody`,{count:S.length}),confirmText:e(`libraryTrash.confirm.cta`),variant:`danger`}),d.isError&&(0,G.jsxs)(`div`,{className:`mt-4 text-sm text-red-600 dark:text-red-400`,children:[d.error?.message??e(`libraryTrash.loadError`),(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>t(`/files`),className:`ml-3`,children:e(`libraryTrash.backToFiles`)})]})]})}function j1e(e){return e.includes(`/camera/`)}function M1e(e,t,n){let r=0;return e.querySelectorAll(`img[src*="/api/v1/"], video[src*="/api/v1/"]`).forEach(e=>{let i=e.getAttribute(`src`)||``,a=j1e(i)?n:t;if(!a)return;let o=`token=${encodeURIComponent(a)}`;if(i.includes(o))return;let s=i.replace(/([?&])token=[^&]*(&|$)/,(e,t,n)=>n===`&`?t:``);e.src=`${s}${s.includes(`?`)?`&`:`?`}${o}`,r+=1}),r}function N1e(){let{authEnabled:e,user:t,loading:n,hasPermission:r}=Nd(),i=no(),a=(0,f.useRef)(!1),o=!n&&(!e||t!==null),{data:s}=K({queryKey:[`media-token`,t?.id??null],queryFn:()=>Z.getMediaToken(),enabled:o,staleTime:3e3*1e3,refetchInterval:3e3*1e3}),c=!e||r(`camera:view`),{data:l}=K({queryKey:[`camera-stream-token`,t?.id??null],queryFn:()=>Z.getCameraStreamToken(),enabled:o&&c,staleTime:3e3*1e3,refetchInterval:3e3*1e3}),u=s?.token??null,d=l?.token??null;(0,f.useEffect)(()=>(fd(u),ud(d),(u||d)&&M1e(document,u,d),()=>{fd(null),ud(null)}),[u,d]),(0,f.useEffect)(()=>{if(!e)return;let t=e=>{let t=e.target;if(!(t instanceof HTMLImageElement||t instanceof HTMLVideoElement))return;let n=t.src||``,r=j1e(n),o=r?dd():pd();!o||!n.includes(`token=${encodeURIComponent(o)}`)||a.current||(a.current=!0,i.invalidateQueries({queryKey:r?[`camera-stream-token`]:[`media-token`]}),setTimeout(()=>{a.current=!1},5e3))};return document.addEventListener(`error`,t,!0),()=>document.removeEventListener(`error`,t,!0)},[e,i])}var n9=5,P1e=2e3,F1e=3e4,I1e=5e3;function L1e(){let{t:e}=U(),t=no(),{showToast:n}=qd(),{hasPermission:r,authEnabled:i,user:a}=Nd(),{printerId:o}=ir(),s=parseInt(o||`0`,10),[c]=ji(),l=parseInt(c.get(`fps`)||`15`,10),u=Math.min(Math.max(isNaN(l)?15:l,1),30);N1e();let{data:d,isPending:p}=K({queryKey:[`camera-stream-token`,a?.id??null],queryFn:()=>Z.getCameraStreamToken(),enabled:i?!!a:!0,staleTime:3e3*1e3}),m=d?.token??dd(),[h,g]=(0,f.useState)(`stream`),[_,v]=(0,f.useState)(!1),[y,b]=(0,f.useState)(!1),[x,S]=(0,f.useState)(!1),[C,w]=(0,f.useState)(!0),[T,E]=(0,f.useState)(Date.now()),[D,O]=(0,f.useState)(!1),[k,A]=(0,f.useState)(!1),[j,M]=(0,f.useState)(0),[N,P]=(0,f.useState)(!1),[F,I]=(0,f.useState)(0),[L,R]=(0,f.useState)(1),[z,B]=(0,f.useState)({x:0,y:0}),[V,ee]=(0,f.useState)(!1),[te,ne]=(0,f.useState)({x:0,y:0}),[re,ie]=(0,f.useState)(null),[ae,oe]=(0,f.useState)(null),se=(0,f.useRef)(null),H=(0,f.useRef)(null),ce=(0,f.useRef)(null),le=(0,f.useRef)(null),ue=(0,f.useRef)(null),de=(0,f.useRef)(0),{data:fe}=K({queryKey:[`printer`,s],queryFn:()=>Z.getPrinter(s),enabled:s>0}),{data:pe}=K({queryKey:[`printerStatus`,s],queryFn:()=>Z.getPrinterStatus(s),refetchInterval:3e4,enabled:s>0}),me=q({mutationFn:e=>Z.setChamberLight(s,e),onMutate:async e=>{await t.cancelQueries({queryKey:[`printerStatus`,s]});let n=t.getQueryData([`printerStatus`,s]);return t.setQueryData([`printerStatus`,s],t=>({...t,chamber_light:e})),{previousStatus:n}},onSuccess:(e,t)=>{n(`Chamber light ${t?`on`:`off`}`)},onError:(r,i,a)=>{a?.previousStatus&&t.setQueryData([`printerStatus`,s],a.previousStatus),n(r.message||e(`printers.toast.failedToControlChamberLight`),`error`)}}),he=(pe?.state===`RUNNING`||pe?.state===`PAUSE`)&&(pe?.printable_objects_count??0)>=2;(0,f.useEffect)(()=>(fe&&(document.title=`${fe.name} - Camera`),()=>{document.title=`Bambuddy`}),[fe]);let ge=(0,f.useRef)(!1);(0,f.useEffect)(()=>{let e=`/api/v1/printers/${s}/camera/stop`;ge.current=!1;let t=()=>{if(s>0&&!ge.current){ge.current=!0;let t={},n=sd();n&&(t.Authorization=`Bearer ${n}`),fetch(e,{method:`POST`,keepalive:!0,headers:t}).catch(()=>{})}},n=()=>{t()};window.addEventListener(`beforeunload`,n);let r=se.current;return()=>{window.removeEventListener(`beforeunload`,n),r&&(r.src=``),t()}},[s]),(0,f.useEffect)(()=>{if(C&&!D){let e=setTimeout(()=>{w(!1)},h===`stream`?3e3:2e4);return()=>clearTimeout(e)}},[h,C,T,D]),(0,f.useEffect)(()=>{let e=()=>{A(!!document.fullscreenElement),R(1),B({x:0,y:0}),h===`stream`&&!D&&(se.current&&(se.current.src=``),setTimeout(()=>{w(!0),E(Date.now())},200))};return document.addEventListener(`fullscreenchange`,e),()=>document.removeEventListener(`fullscreenchange`,e)},[h,D]),(0,f.useEffect)(()=>{let e,t=()=>{clearTimeout(e),e=setTimeout(()=>{localStorage.setItem(`cameraWindowState`,JSON.stringify({width:window.outerWidth,height:window.outerHeight,left:window.screenX,top:window.screenY}))},500)};return window.addEventListener(`resize`,t),()=>{clearTimeout(e),window.removeEventListener(`resize`,t)}},[]),(0,f.useEffect)(()=>()=>{ce.current&&clearTimeout(ce.current),le.current&&clearInterval(le.current),ue.current&&clearInterval(ue.current)},[]);let _e=(0,f.useCallback)(()=>{if(j>=n9){P(!1),S(!0);return}let e=Math.min(P1e*2**j,F1e);P(!0),I(Math.ceil(e/1e3)),le.current=setInterval(()=>{I(e=>e<=1?(le.current&&clearInterval(le.current),0):e-1)},1e3),ce.current=setTimeout(()=>{M(e=>e+1),P(!1),w(!0),S(!1),se.current&&(se.current.src=``),E(Date.now())},e)},[j]);(0,f.useEffect)(()=>{if(h!==`stream`||C||N||D){ue.current&&=(clearInterval(ue.current),null);return}return de.current=0,ue.current=setInterval(async()=>{try{let e=await Z.getCameraStatus(s);if(!(e.stalled||!e.active&&!x)){de.current=0;return}if(de.current+=1,de.current<2)return;de.current=0,console.log(`Stream issue detected: stalled=${e.stalled}, active=${e.active}, reconnecting...`),ue.current&&=(clearInterval(ue.current),null),w(!1),_e()}catch{}},I1e),()=>{ue.current&&=(clearInterval(ue.current),null)}},[h,C,x,N,D,s,_e]);let ve=()=>{w(!1),h===`stream`&&j{if(w(!1),S(!1),M(0),de.current=0,P(!1),ce.current&&clearTimeout(ce.current),le.current&&clearInterval(le.current),se.current&&!localStorage.getItem(`cameraWindowState`)){let e=se.current,t=e.naturalWidth,n=e.naturalHeight;if(t>0&&n>0){let e=window.outerWidth-window.innerWidth,r=window.outerHeight-window.innerHeight,i=t+16+e,a=n+45+16+r;try{window.resizeTo(i,a)}catch{}}}},be=()=>{if(s>0){let e={},t=sd();t&&(e.Authorization=`Bearer ${t}`),fetch(`/api/v1/printers/${s}/camera/stop`,{method:`POST`,headers:e}).catch(()=>{})}},xe=e=>{h===e||D||(O(!0),w(!0),S(!1),M(0),P(!1),R(1),B({x:0,y:0}),ce.current&&clearTimeout(ce.current),le.current&&clearInterval(le.current),se.current&&(se.current.src=``),h===`stream`&&be(),setTimeout(()=>{g(e),E(Date.now()),O(!1)},100))},Se=()=>{D||(O(!0),w(!0),S(!1),M(0),P(!1),ce.current&&clearTimeout(ce.current),le.current&&clearInterval(le.current),se.current&&(se.current.src=``),h===`stream`&&be(),setTimeout(()=>{E(Date.now()),O(!1)},100))},Ce=()=>{H.current&&(document.fullscreenElement?document.exitFullscreen():H.current.requestFullscreen())},we=()=>{R(e=>Math.min(e+.5,4))},Te=()=>{R(e=>{let t=Math.max(e-.5,1);return t===1&&B({x:0,y:0}),t})},Ee=e=>{e.preventDefault(),e.deltaY<0?we():Te()},De=e=>{L>1&&(e.preventDefault(),ee(!0),ne({x:e.clientX-z.x,y:e.clientY-z.y}))},Oe=(0,f.useCallback)(()=>{if(!H.current)return{x:300,y:200};let e=H.current.getBoundingClientRect(),t=e.width*(L-1)/2,n=e.height*(L-1)/2;return{x:Math.max(50,t),y:Math.max(50,n)}},[L]),ke=e=>{if(V&&L>1){let t=e.clientX-te.x,n=e.clientY-te.y,r=Oe();B({x:Math.max(-r.x,Math.min(r.x,t)),y:Math.max(-r.y,Math.min(r.y,n))})}},Ae=()=>{ee(!1)},je=e=>{if(e.length<2)return 0;let t=e[0].clientX-e[1].clientX,n=e[0].clientY-e[1].clientY;return Math.sqrt(t*t+n*n)},Me=e=>e.length<2?{x:e[0].clientX,y:e[0].clientY}:{x:(e[0].clientX+e[1].clientX)/2,y:(e[0].clientY+e[1].clientY)/2},Ne=e=>{e.touches.length===2?(e.preventDefault(),ie(je(e.touches)),oe(Me(e.touches))):e.touches.length===1&&L>1&&(e.preventDefault(),ee(!0),ne({x:e.touches[0].clientX-z.x,y:e.touches[0].clientY-z.y}))},Pe=e=>{if(e.touches.length===2&&re!==null){e.preventDefault();let t=je(e.touches),n=t/re;R(e=>{let t=Math.max(1,Math.min(4,e*n));return t===1&&B({x:0,y:0}),t}),ie(t);let r=Me(e.touches);if(ae){let e=Oe();B(t=>({x:Math.max(-e.x,Math.min(e.x,t.x+(r.x-ae.x))),y:Math.max(-e.y,Math.min(e.y,t.y+(r.y-ae.y)))}))}oe(r)}else if(e.touches.length===1&&V&&L>1){e.preventDefault();let t=e.touches[0].clientX-te.x,n=e.touches[0].clientY-te.y,r=Oe();B({x:Math.max(-r.x,Math.min(r.x,t)),y:Math.max(-r.y,Math.min(r.y,n))})}},Fe=e=>{e.touches.length<2&&(ie(null),oe(null)),e.touches.length===0&&ee(!1)},Ie=()=>{R(1),B({x:0,y:0})},Le=D||!m&&(i||p)?``:(e=>m?`${e}&token=${encodeURIComponent(m)}`:md(e))(h===`stream`?`/api/v1/printers/${s}/camera/stream?fps=${u}&t=${T}`:`/api/v1/printers/${s}/camera/snapshot?t=${T}`),Re=C||D||N;return s?(0,G.jsxs)(`div`,{ref:H,className:`min-h-screen bg-black flex flex-col`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 bg-bambu-dark-secondary border-b border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`h1`,{className:`text-sm font-medium text-white flex items-center gap-2`,children:[(0,G.jsx)($o,{className:`w-4 h-4`}),fe?.name||`Printer ${s}`]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex bg-bambu-dark rounded p-0.5`,children:[(0,G.jsx)(`button`,{onClick:()=>xe(`stream`),disabled:Re,className:`px-3 py-1 text-xs rounded transition-colors ${h===`stream`?`bg-bambu-green text-white`:`text-bambu-gray hover:text-white disabled:opacity-50`}`,children:e(`camera.live`)}),(0,G.jsx)(`button`,{onClick:()=>xe(`snapshot`),disabled:Re,className:`px-3 py-1 text-xs rounded transition-colors ${h===`snapshot`?`bg-bambu-green text-white`:`text-bambu-gray hover:text-white disabled:opacity-50`}`,children:e(`camera.snapshot`)})]}),(0,G.jsx)(`button`,{onClick:()=>me.mutate(!pe?.chamber_light),disabled:!pe?.connected||me.isPending||!r(`printers:control`),className:`p-1.5 rounded disabled:opacity-50 ${pe?.chamber_light?`bg-yellow-500/20 hover:bg-yellow-500/30`:`hover:bg-bambu-dark-tertiary`}`,title:r(`printers:control`)?e(`camera.chamberLight`):e(`printers.permission.noControl`),children:(0,G.jsx)(nE,{on:pe?.chamber_light??!1,className:`w-4 h-4`})}),(0,G.jsx)(`button`,{onClick:()=>v(!0),disabled:!he||!r(`printers:control`),className:`p-1.5 rounded disabled:opacity-50 ${he&&r(`printers:control`)?`hover:bg-bambu-dark-tertiary`:``}`,title:r(`printers:control`)?e(he?`printers.skipObjects.tooltip`:`printers.skipObjects.onlyWhilePrinting`):e(`printers.permission.noControl`),children:(0,G.jsx)(rE,{className:`w-4 h-4 text-bambu-gray`})}),(0,G.jsx)(`button`,{onClick:Se,disabled:Re,className:`p-1.5 hover:bg-bambu-dark-tertiary rounded disabled:opacity-50`,title:e(h===`stream`?`camera.restartStream`:`camera.refreshSnapshot`),children:(0,G.jsx)(Il,{className:`w-4 h-4 text-bambu-gray ${Re?`animate-spin`:``}`})}),(0,G.jsx)(`button`,{onClick:()=>b(!0),className:`p-1.5 hover:bg-bambu-dark-tertiary rounded`,title:e(`camera.diagnose.button`),children:(0,G.jsx)(gu,{className:`w-4 h-4 text-bambu-gray`})}),(0,G.jsx)(`button`,{onClick:Ce,className:`p-1.5 hover:bg-bambu-dark-tertiary rounded`,title:e(k?`camera.exitFullscreen`:`camera.fullscreen`),children:k?(0,G.jsx)(sl,{className:`w-4 h-4 text-bambu-gray`}):(0,G.jsx)(rl,{className:`w-4 h-4 text-bambu-gray`})})]})]}),(0,G.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-2 overflow-hidden`,onWheel:Ee,onMouseMove:ke,onMouseUp:Ae,onMouseLeave:Ae,onTouchStart:Ne,onTouchMove:Pe,onTouchEnd:Fe,style:{touchAction:`none`},children:(0,G.jsxs)(`div`,{className:`relative w-full h-full flex items-center justify-center`,children:[(C||D)&&!N&&(0,G.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-black/50 z-10`,children:(0,G.jsxs)(`div`,{className:`text-center`,children:[(0,G.jsx)(Il,{className:`w-8 h-8 text-bambu-gray animate-spin mx-auto mb-2`}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(h===`stream`?`camera.connectingToCamera`:`camera.capturingSnapshot`)})]})}),N&&(0,G.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-black/80 z-10`,children:(0,G.jsxs)(`div`,{className:`text-center p-4`,children:[(0,G.jsx)(Ju,{className:`w-10 h-10 text-orange-400 mx-auto mb-3`}),(0,G.jsx)(`p`,{className:`text-white mb-2`,children:e(`camera.connectionLost`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mb-3`,children:e(`camera.reconnecting`,{countdown:F,attempt:Math.min(j+1,n9),max:n9})}),(0,G.jsx)(`button`,{onClick:Se,className:`px-4 py-2 bg-bambu-green text-white text-sm rounded hover:bg-bambu-green/80 transition-colors`,children:e(`camera.reconnectNow`)})]})}),x&&!N&&(0,G.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-black z-10`,children:(0,G.jsxs)(`div`,{className:`text-center p-4`,children:[(0,G.jsx)(Pu,{className:`w-12 h-12 text-orange-400 mx-auto mb-3`}),(0,G.jsx)(`p`,{className:`text-white mb-2`,children:e(`camera.cameraUnavailable`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mb-4 max-w-md`,children:e(`camera.cameraUnavailableDesc`)}),(0,G.jsxs)(`div`,{className:`flex gap-2 justify-center`,children:[(0,G.jsx)(`button`,{onClick:Se,className:`px-4 py-2 bg-bambu-green text-white rounded hover:bg-bambu-green/80 transition-colors`,children:e(`camera.retry`)}),(0,G.jsx)(`button`,{onClick:()=>b(!0),className:`px-4 py-2 bg-bambu-dark border border-bambu-dark-tertiary text-bambu-gray hover:text-white rounded transition-colors`,children:e(`camera.diagnose.button`)})]})]})}),(0,G.jsx)(`img`,{ref:se,src:Le,alt:e(`camera.cameraStream`),className:`max-w-full max-h-full object-contain select-none`,style:{transform:`scale(${L}) translate(${z.x/L}px, ${z.y/L}px) rotate(${fe?.camera_rotation||0}deg)`,...fe?.camera_rotation===90||fe?.camera_rotation===270?{maxWidth:`100vh`,maxHeight:`100vw`}:{},cursor:L>1?V?`grabbing`:`grab`:`default`},onError:Le?ve:void 0,onLoad:Le?ye:void 0,onMouseDown:De,draggable:!1},T),(0,G.jsxs)(`div`,{className:`absolute bottom-4 left-4 flex items-center gap-1.5 bg-black/60 rounded-lg px-2 py-1.5`,children:[(0,G.jsx)(`button`,{onClick:Te,disabled:L<=1,className:`p-1.5 hover:bg-white/10 rounded disabled:opacity-30`,title:e(`camera.zoomOut`),children:(0,G.jsx)(nd,{className:`w-4 h-4 text-white`})}),(0,G.jsxs)(`button`,{onClick:Ie,className:`px-2 py-1 text-sm text-white hover:bg-white/10 rounded min-w-[48px]`,title:e(`camera.resetZoom`),children:[Math.round(L*100),`%`]}),(0,G.jsx)(`button`,{onClick:we,disabled:L>=4,className:`p-1.5 hover:bg-white/10 rounded disabled:opacity-30`,title:e(`camera.zoomIn`),children:(0,G.jsx)(ed,{className:`w-4 h-4 text-white`})})]})]})}),(0,G.jsx)(iE,{printerId:s,isOpen:_,onClose:()=>v(!1)}),y&&(0,G.jsx)(aE,{printerId:s,printerName:fe?.name||null,onClose:()=>b(!1)})]}):(0,G.jsx)(`div`,{className:`min-h-screen bg-black flex items-center justify-center`,children:(0,G.jsx)(`p`,{className:`text-white`,children:e(`camera.invalidPrinterId`)})})}var R1e=5e3,z1e=4,B1e=8,V1e=1,H1e=16,U1e=2,W1e=60;function G1e(e,t,n,r){let i=parseInt(e??``,10);return Number.isFinite(i)?Math.min(r,Math.max(n,i)):t}function K1e(e,t,n,r,i,a){return e.has(t)?G1e(e.get(t),r,i,a):G1e(localStorage.getItem(n),r,i,a)}function q1e(){let{t:e}=U(),t=Xn(),{authEnabled:n,loading:r,user:i}=Nd(),[a]=ji(),o=a.get(`token`),s=o!=null&&o!==``,[c,l]=(0,f.useState)(()=>K1e(a,`maxLive`,`camWallMaxLive`,z1e,V1e,H1e)),[u,d]=(0,f.useState)(()=>K1e(a,`interval`,`camWallSnapshotSec`,B1e,U1e,W1e)),[p,m]=(0,f.useState)(()=>{let e=a.get(`status`)??localStorage.getItem(`camWallStatusMode`);return(s?[`off`,`compact`]:[`off`,`compact`,`full`]).includes(e)?e:`compact`});(0,f.useEffect)(()=>{if(s)return ud(o),()=>ud(null)},[s,o]);let h=K({queryKey:[`camwall-printers`,o],queryFn:()=>Z.getCamWallPrinters(o??void 0),enabled:s,refetchInterval:R1e}),g=K({queryKey:[`printers`],queryFn:()=>Z.getPrinters(),enabled:!s&&!r&&(!n||i!==null),refetchInterval:R1e}),_=(0,f.useMemo)(()=>{let e=new Map;for(let t of h.data??[])e.set(t.id,{connected:t.connected,state:t.state,progress:t.progress,remaining_time:t.remaining_time,layer_num:t.layer_num,total_layers:t.total_layers,hms_errors:t.hms_errors});return e},[h.data]);if(!s&&r)return(0,G.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-bambu-dark text-bambu-gray`,children:e(`common.loading`)});if(!s&&n&&!i)return(0,G.jsx)(Or,{to:`/login`,replace:!0,state:{from:t}});let v=s?h:g,y=s?h.data??[]:g.data??[];return v.isError?(0,G.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-bambu-dark p-6 text-center`,children:(0,G.jsx)(`p`,{className:`max-w-md text-sm text-red-400`,children:e(s?`printers.camWall.page.tokenRejected`:`printers.camWall.page.loadFailed`)})}):(0,G.jsx)(`div`,{className:`min-h-screen bg-bambu-dark p-4`,children:(0,G.jsx)(fE,{printers:y,maxLive:c,snapshotIntervalSec:u,statusMode:p,statuses:s?_:void 0,showSettings:!s,onTileClick:s?void 0:e=>window.open(`/camera/${e}`,`camera-${e}`),onChangeMaxLive:e=>{l(e),localStorage.setItem(`camWallMaxLive`,String(e))},onChangeSnapshotIntervalSec:e=>{d(e),localStorage.setItem(`camWallSnapshotSec`,String(e))},onChangeStatusMode:e=>{m(e),localStorage.setItem(`camWallStatusMode`,e)}})})}function J1e(e,t){let[n,r]=(0,f.useState)(null);return(0,f.useLayoutEffect)(()=>{let n=e.current;if(!t||!n)return;let i=()=>{let{width:e,height:t}=n.getBoundingClientRect();e>0&&t>0&&r(n=>n&&n.width===e&&n.height===t?n:{width:e,height:t})};if(i(),typeof ResizeObserver>`u`)return window.addEventListener(`resize`,i),()=>window.removeEventListener(`resize`,i);let a=new ResizeObserver(i);return a.observe(n),()=>a.disconnect()},[e,t]),t?n:null}function Y1e(e){let{t}=U(),{camera:n,name:r,model:i,filename:a,status:o,state:s,progress:c,layers:l,remaining:u,eta:d,temperatures:p}=e,m=a||o||c!=null||l||u||d||p.length>0,h=n?.rotation??0,g=Math.abs(h%180)===90,_=(0,f.useRef)(null),v=J1e(_,g&&n!=null),y=[{key:`layers`,icon:(0,G.jsx)(Hc,{}),label:t(`streamOverlay.layer`),value:l},{key:`remaining`,icon:(0,G.jsx)(Au,{}),label:t(`streamOverlay.remaining`),value:u},{key:`eta`,icon:(0,G.jsx)(ws,{}),label:t(`streamOverlay.eta`),value:d}].filter(e=>e.value!=null);return(0,G.jsxs)(`div`,{className:`updated-overlay`,"data-size":e.size,"data-state":s,children:[(0,G.jsxs)(`header`,{className:`updated-overlay__header`,children:[(r||i)&&(0,G.jsxs)(`div`,{className:`updated-overlay__identity`,children:[(0,G.jsx)(Ml,{"aria-hidden":`true`}),(0,G.jsxs)(`div`,{children:[r&&(0,G.jsx)(`strong`,{children:r}),i&&(0,G.jsx)(`span`,{children:i})]})]}),(0,G.jsx)(`a`,{className:`updated-overlay__logo`,href:`https://github.com/maziggy/bambuddy`,target:`_blank`,rel:`noopener noreferrer`,children:(0,G.jsx)(`img`,{src:`/img/bambuddy_logo_powered_by.png`,alt:`Bambuddy`})})]}),n&&(0,G.jsx)(`div`,{className:`updated-overlay__camera`,ref:_,children:(0,G.jsx)(`img`,{src:n.url,alt:t(`streamOverlay.cameraStream`),style:{transform:`translate(-50%, -50%) rotate(${h}deg)`,...g&&v?{width:v.height,height:v.width}:{}},onError:n.onError},n.url)}),m&&(0,G.jsxs)(`section`,{className:`updated-overlay__panel`,children:[(a||o)&&(0,G.jsxs)(`div`,{className:`updated-overlay__summary`,children:[a&&(0,G.jsx)(`h1`,{children:a}),o&&(0,G.jsxs)(`div`,{className:`updated-overlay__status`,children:[(0,G.jsx)(`span`,{"aria-hidden":`true`}),o]})]}),c!=null&&(0,G.jsxs)(`div`,{className:`updated-overlay__progress`,children:[(0,G.jsx)(`span`,{children:t(`streamOverlay.progress`)}),(0,G.jsx)(`div`,{role:`progressbar`,"aria-label":t(`streamOverlay.progress`),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":c,children:(0,G.jsx)(`div`,{style:{width:`${c}%`}})}),(0,G.jsxs)(`strong`,{children:[Math.round(c),`%`]})]}),(y.length>0||p.length>0)&&(0,G.jsxs)(`div`,{className:`updated-overlay__readings`,children:[y.length>0&&(0,G.jsx)(`div`,{className:`updated-overlay__stats`,children:y.map(e=>(0,G.jsxs)(`div`,{className:`updated-overlay__reading`,children:[e.icon,(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{children:e.label}),(0,G.jsx)(`strong`,{children:e.value})]})]},e.key))}),p.length>0&&(0,G.jsx)(`div`,{className:`updated-overlay__temperatures`,children:p.map(e=>(0,G.jsxs)(`div`,{className:`updated-overlay__reading`,children:[e.icon,(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{children:e.label}),(0,G.jsxs)(`strong`,{children:[Math.round(e.current),`°C`,e.target!=null&&e.target>0&&Math.round(e.target)!==Math.round(e.current)&&(0,G.jsxs)(`small`,{children:[` / `,Math.round(e.target),`°C`]})]})]})]},e.key))})]})]})]})}function X1e(e,t,n){if(!e)return``;if(!t)return e;let r=t.match(/plate_(\d+)\.gcode/);return r&&parseInt(r[1],10)>1?`${e} — ${n(`printers.plateNumber`,`Plate {{number}}`,{number:r[1]})}`:e}function Z1e(e){let t=e.get(`show`)?.split(`,`)||[`progress`,`layers`,`eta`,`filename`,`status`],n=parseInt(e.get(`fps`)||`15`,10),r=Math.min(Math.max(isNaN(n)?15:n,1),30),i=e.get(`camera`),a=i!==`false`&&i!==`0`;return{size:e.get(`size`)||`medium`,fps:r,updatedArtwork:e.get(`artwork`)===`2`,showCamera:a,showProgress:t.includes(`progress`),showLayers:t.includes(`layers`),showEta:t.includes(`eta`),showFilename:t.includes(`filename`),showStatus:t.includes(`status`),showPrinter:t.includes(`printer`),showModel:t.includes(`model`),showNozzle:t.includes(`nozzle`),showBed:t.includes(`bed`),showChamber:t.includes(`chamber`)}}function Q1e(e,t){if(e.stg_cur_name)return e.stg_cur_name;switch(e.state){case`RUNNING`:return t(`streamOverlay.status.printing`);case`PAUSE`:return t(`streamOverlay.status.paused`);case`FINISH`:return t(`streamOverlay.status.finished`);case`FAILED`:return t(`streamOverlay.status.failed`);case`IDLE`:return t(`streamOverlay.status.idle`);default:return e.state||t(`streamOverlay.status.unknown`)}}function r9(e,t){let n=e[t];return typeof n==`number`?n:null}function $1e({icon:e,label:t,current:n,target:r,sizes:i}){let a=r!=null&&r>0&&Math.round(r)!==Math.round(n);return(0,G.jsxs)(`div`,{className:`flex items-center ${i.gap} text-white/70`,children:[e,(0,G.jsxs)(`span`,{className:i.text,children:[(0,G.jsx)(`span`,{className:`mr-1`,children:t}),(0,G.jsxs)(`span`,{className:`text-white`,children:[Math.round(n),`°C`]}),a&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`mx-1`,children:`/`}),(0,G.jsxs)(`span`,{children:[Math.round(r),`°C`]})]})]})]})}function e0e(e){switch(e){case`small`:return{container:`p-3`,text:`text-sm`,textLarge:`text-lg`,progressHeight:`h-2`,icon:`w-3 h-3`,gap:`gap-2`,logoHeight:`h-12`};case`large`:return{container:`p-6`,text:`text-xl`,textLarge:`text-3xl`,progressHeight:`h-4`,icon:`w-6 h-6`,gap:`gap-4`,logoHeight:`h-24`};default:return{container:`p-4`,text:`text-base`,textLarge:`text-xl`,progressHeight:`h-3`,icon:`w-4 h-4`,gap:`gap-3`,logoHeight:`h-16`}}}function t0e(){let{printerId:e}=ir(),[t]=ji(),{t:n}=U(),r=no(),i=parseInt(e||`0`,10),[a,o]=(0,f.useState)(Date.now()),s=(0,f.useMemo)(()=>Z1e(t),[t]),c=e0e(s.size),l=t.get(`token`),u=l!=null&&l!==``,{data:d}=K({queryKey:[`overlayStatus`,i,l],queryFn:()=>Z.getOverlayStatus(i,l??void 0),enabled:i>0&&u,refetchInterval:2e3}),{data:p}=K({queryKey:[`printer`,i],queryFn:()=>Z.getPrinter(i),enabled:i>0&&!u}),{data:m}=K({queryKey:[`printerStatus`,i],queryFn:()=>Z.getPrinterStatus(i),enabled:i>0&&!u,refetchInterval:2e3}),{data:h}=K({queryKey:[`settings`],queryFn:Z.getSettings,enabled:!u}),g=(0,f.useMemo)(()=>u?d&&{name:d.name,model:d.model,camera_rotation:d.camera_rotation}:p,[u,d,p]),_=[s.showPrinter?g?.name:null,s.showModel?oh(g?.model??null):null].filter(Boolean).join(` · `),v=u?d:m,y=(u?d?.time_format:h?.time_format)||`system`;(0,f.useEffect)(()=>{if(!i||u)return;let e=null,t=!1;return(async()=>{let n;try{n=(await Z.getWebSocketToken()).token}catch(e){let t=e instanceof id?e.status:0;if(t===401||t===403)return}if(t)return;let a=window.location.protocol===`https:`?`wss:`:`ws:`,o=n?`?token=${encodeURIComponent(n)}`:``,s=`${a}//${window.location.host}/api/v1/ws${o}`;e=new WebSocket(s),e.onmessage=e=>{try{let t=JSON.parse(e.data);t.type===`printer_status`&&t.printer_id===i&&r.setQueryData([`printerStatus`,i],t.status)}catch{}},e.onerror=()=>{}})(),()=>{t=!0,e&&e.close()}},[i,u,r]),(0,f.useEffect)(()=>(document.title=g?`${g.name} - ${n(`streamOverlay.title`)}`:n(`streamOverlay.title`),()=>{document.title=`Bambuddy`}),[g,n]);let b=()=>{setTimeout(()=>{o(Date.now())},3e3)};if(!i)return(0,G.jsx)(`div`,{className:`min-h-screen bg-black flex items-center justify-center`,children:(0,G.jsx)(`p`,{className:`text-white`,children:n(`streamOverlay.invalidPrinterId`)})});if(!v)return(0,G.jsx)(`div`,{className:`min-h-screen bg-black flex items-center justify-center`,children:(0,G.jsx)(`p`,{className:`text-gray-400`,children:n(`common.loading`)})});let x=v.state===`RUNNING`||v.state===`PAUSE`,S=v.progress||0,C=v.temperatures??{},w=[];if(s.showNozzle){let e=r9(C,`nozzle`),t=r9(C,`nozzle_2`);e!=null&&w.push({key:`nozzle`,icon:(0,G.jsx)(cc,{className:c.icon}),label:n(`printers.heaterHistory.nozzle`,`Nozzle`),current:e,target:r9(C,`nozzle_target`)}),t!=null&&w.push({key:`nozzle_2`,icon:(0,G.jsx)(cc,{className:c.icon}),label:n(`printers.heaterHistory.nozzle2`,`Nozzle 2`),current:t,target:r9(C,`nozzle_2_target`)})}if(s.showBed){let e=r9(C,`bed`);e!=null&&w.push({key:`bed`,icon:(0,G.jsx)(mu,{className:c.icon}),label:n(`printers.heaterHistory.bed`,`Bed`),current:e,target:r9(C,`bed_target`)})}if(s.showChamber){let e=r9(C,`chamber`);e!=null&&w.push({key:`chamber`,icon:(0,G.jsx)(Go,{className:c.icon}),label:n(`printers.heaterHistory.chamber`,`Chamber`),current:e,target:r9(C,`chamber_target`)})}let T=`/api/v1/printers/${i}/camera/stream?fps=${s.fps}&t=${a}`,E=u&&l?`${T}&token=${encodeURIComponent(l)}`:md(T);if(s.updatedArtwork){let e=v.connected&&x,t=v.remaining_time,r=e&&s.showEta&&t!=null&&t>0;return(0,G.jsx)(Y1e,{size:s.size,camera:s.showCamera?{url:E,rotation:g?.camera_rotation??0,onError:b}:null,name:s.showPrinter?g?.name??null:null,model:s.showModel&&oh(g?.model??null)||null,filename:s.showFilename&&v.current_print?X1e(v.current_print.replace(/\.gcode\.3mf$|\.3mf$|\.gcode$/i,``),v.gcode_file,n):null,status:s.showStatus?v.connected?Q1e(v,n):n(`streamOverlay.printerOffline`):null,state:v.connected?v.state:null,progress:e&&s.showProgress?Math.min(100,Math.max(0,Number.isFinite(S)?S:0)):null,layers:e&&s.showLayers&&v.layer_num!=null&&v.total_layers!=null&&v.total_layers>0?`${v.layer_num} / ${v.total_layers}`:null,remaining:r?ap(t*60):null,eta:r?ip(t,y,n):null,temperatures:v.connected?w:[]})}return(0,G.jsxs)(`div`,{className:`min-h-screen bg-black relative overflow-hidden`,children:[s.showCamera&&(0,G.jsx)(`img`,{src:E,alt:n(`streamOverlay.cameraStream`),className:`absolute inset-0 w-full h-full object-contain`,style:g?.camera_rotation?{transform:`rotate(${g.camera_rotation}deg)`}:void 0,onError:b},a),(0,G.jsx)(`a`,{href:`https://github.com/maziggy/bambuddy`,target:`_blank`,rel:`noopener noreferrer`,className:`absolute top-4 right-4 z-10`,children:(0,G.jsx)(`img`,{src:`/img/bambuddy_logo_dark_transparent.png`,alt:`Bambuddy`,className:`${c.logoHeight} object-contain drop-shadow-lg hover:scale-105 transition-transform`})}),(0,G.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 z-10 bg-gradient-to-t from-black/80 via-black/60 to-transparent`,children:(0,G.jsxs)(`div`,{className:`${c.container}`,children:[_&&(0,G.jsxs)(`div`,{className:`flex items-center ${c.gap} mb-2`,children:[(0,G.jsx)(Ml,{className:`${c.icon} shrink-0 text-white/70`}),(0,G.jsx)(`span`,{className:`${c.text} min-w-0 truncate text-white font-medium`,children:_})]}),s.showFilename&&v.current_print&&(0,G.jsx)(`div`,{className:`${c.textLarge} text-white font-semibold mb-2 truncate drop-shadow-md`,children:X1e(v.current_print.replace(/\.gcode\.3mf$|\.3mf$|\.gcode$/i,``),v.gcode_file,n)}),s.showStatus&&(0,G.jsx)(`div`,{className:`${c.text} text-white/70 mb-2`,children:Q1e(v,n)}),s.showProgress&&x&&(0,G.jsxs)(`div`,{className:`mb-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-1 ${c.text}`,children:[(0,G.jsx)(`span`,{className:`text-white/70`,children:n(`streamOverlay.progress`)}),(0,G.jsxs)(`span`,{className:`text-white font-bold`,children:[Math.round(S),`%`]})]}),(0,G.jsx)(`div`,{className:`w-full bg-white/20 rounded-full ${c.progressHeight}`,children:(0,G.jsx)(`div`,{className:`bg-bambu-green ${c.progressHeight} rounded-full transition-all duration-500`,style:{width:`${S}%`}})})]}),x&&(s.showLayers||s.showEta)&&(0,G.jsxs)(`div`,{className:`flex items-center ${c.gap} flex-wrap`,children:[s.showLayers&&v.layer_num!=null&&v.total_layers!=null&&v.total_layers>0&&(0,G.jsxs)(`div`,{className:`flex items-center ${c.gap} text-white/70`,children:[(0,G.jsx)(Hc,{className:c.icon}),(0,G.jsxs)(`span`,{className:c.text,children:[(0,G.jsx)(`span`,{className:`text-white`,children:v.layer_num}),(0,G.jsx)(`span`,{className:`mx-1`,children:`/`}),(0,G.jsx)(`span`,{children:v.total_layers})]})]}),s.showEta&&v.remaining_time!=null&&v.remaining_time>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-center ${c.gap} text-white/70`,children:[(0,G.jsx)(Au,{className:c.icon}),(0,G.jsx)(`span`,{className:`${c.text} text-white`,children:ap(v.remaining_time*60)})]}),(0,G.jsxs)(`div`,{className:`flex items-center ${c.gap} text-white/70`,children:[(0,G.jsx)(ws,{className:c.icon}),(0,G.jsxs)(`span`,{className:`${c.text} text-white`,children:[n(`streamOverlay.eta`),` `,ip(v.remaining_time,y,n)]})]})]})]}),!x&&(0,G.jsx)(`div`,{className:`${c.text} text-white/70 py-2`,children:v.connected?n(`streamOverlay.printerIdle`):n(`streamOverlay.printerOffline`)}),w.length>0&&(0,G.jsx)(`div`,{className:`flex items-center ${c.gap} flex-wrap mt-2`,children:w.map(e=>(0,G.jsx)($1e,{icon:e.icon,label:e.label,current:e.current,target:e.target,sizes:c},e.key))})]})})]})}function n0e(){let{t:e}=U(),{id:t}=ir(),{mode:n}=Id(),r=(0,f.useRef)(null),i=r0e(r),{data:a,isLoading:o,error:s}=K({queryKey:[`external-link`,t],queryFn:()=>Z.getExternalLink(Number(t)),enabled:!!t});return o?(0,G.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,G.jsx)(Y,{className:`w-8 h-8 text-bambu-green animate-spin`})}):s||!a?(0,G.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-4 text-bambu-gray`,children:[(0,G.jsx)(Pu,{className:`w-12 h-12`}),(0,G.jsx)(`p`,{children:e(`common.linkNotFound`)})]}):(0,G.jsx)(`iframe`,{ref:r,src:a.url,onLoad:i,className:`h-full w-full border-0`,style:{colorScheme:n},title:a.name,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox`})}function r0e(e){let{resolvedMode:t,darkStyle:n,darkBackground:r,darkAccent:i,lightStyle:a,lightBackground:o,lightAccent:s}=Id(),c=t===`dark`,l=c?n:a,u=c?r:o,d=c?i:s,p=(0,f.useCallback)(()=>{let n=e.current;if(!n?.contentWindow)return;let r;try{r=new URL(n.src).origin}catch{return}n.contentWindow.postMessage({type:`bambuddy:theme`,mode:t,style:l,background:u,accent:d},r)},[e,t,l,u,d]);return(0,f.useEffect)(()=>p(),[p]),(0,f.useEffect)(()=>{let t=t=>{t.source===e.current?.contentWindow&&t.data?.type===`bambuddy:theme-request`&&p()};return window.addEventListener(`message`,t),()=>window.removeEventListener(`message`,t)},[e,p]),p}function i0e(){let{id:e}=ir(),t=$n(),n=no(),{t:r}=U(),{showToast:i}=qd(),a=!!e,[o,s]=(0,f.useState)(``),[c,l]=(0,f.useState)(``),[u,d]=(0,f.useState)([]),[p,m]=(0,f.useState)(``),[h,g]=(0,f.useState)(!1),{data:_,isLoading:v}=K({queryKey:[`group`,e],queryFn:()=>Z.getGroup(Number(e)),enabled:a}),{data:y,isLoading:b}=K({queryKey:[`permissions`],queryFn:()=>Z.getPermissions()});a&&_&&!h&&(s(_.name),l(_.description||``),d(_.permissions),g(!0));let x=q({mutationFn:e=>Z.createGroup(e),onSuccess:()=>{n.invalidateQueries({queryKey:[`groups`]}),n.invalidateQueries({queryKey:[`group`]}),i(r(`groups.toast.created`)),t(`/settings?tab=users`)},onError:e=>{i(e.message,`error`)}}),S=q({mutationFn:t=>Z.updateGroup(Number(e),t),onSuccess:a=>{n.invalidateQueries({queryKey:[`groups`]}),a&&n.setQueryData([`group`,e],a),i(r(`groups.toast.updated`)),t(`/settings?tab=users`)},onError:e=>{i(e.message,`error`)}}),C=x.isPending||S.isPending,w=()=>{if(!o.trim()){i(r(`groups.toast.enterGroupName`),`error`);return}a?S.mutate({name:o===_?.name?void 0:o,description:c,permissions:u}):x.mutate({name:o,description:c||void 0,permissions:u})},T=e=>{d(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},E=(e,t)=>{let n=e.permissions.map(e=>e.value);d(e=>{let r=e.filter(e=>!n.includes(e));return t?[...r,...n]:r})},D=e=>e.permissions.every(e=>u.includes(e.value)),O=e=>{let t=e.permissions.filter(e=>u.includes(e.value)).length;return t>0&&t{y&&d(y.all_permissions)},A=()=>{d([])},j=p.toLowerCase(),M=(0,f.useMemo)(()=>y?j?y.categories.map(e=>({...e,permissions:e.permissions.filter(e=>e.label.toLowerCase().includes(j))})).filter(e=>e.permissions.length>0):y.categories:[],[y,j]),N=y?.all_permissions.length??0;return v||b?(0,G.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,G.jsx)(Y,{className:`w-8 h-8 text-bambu-green animate-spin`})}):(0,G.jsxs)(`div`,{className:`space-y-6 max-w-5xl mx-auto`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`button`,{onClick:()=>t(`/settings?tab=users`),className:`p-2 rounded-lg hover:bg-bambu-dark-tertiary text-bambu-gray hover:text-white transition-colors`,children:(0,G.jsx)(jo,{className:`w-5 h-5`})}),(0,G.jsx)(`h1`,{className:`text-xl font-bold text-white`,children:r(a?`groups.editor.title`:`groups.editor.createTitle`)})]}),a&&_?.is_system&&(0,G.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3 rounded-lg bg-yellow-50 dark:bg-yellow-500/10 border border-yellow-300 dark:border-yellow-500/20 text-yellow-700 dark:text-yellow-400 text-sm`,children:[(0,G.jsx)(Pu,{className:`w-4 h-4 shrink-0`}),r(`groups.form.systemGroupWarning`)]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:r(`groups.form.groupName`)}),(0,G.jsx)(`input`,{type:`text`,value:o,onChange:e=>s(e.target.value),disabled:a&&_?.is_system,className:`w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors disabled:opacity-50`,placeholder:r(`groups.form.groupNamePlaceholder`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:r(`groups.form.description`)}),(0,G.jsx)(`input`,{type:`text`,value:c,onChange:e=>l(e.target.value),className:`w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:r(`groups.form.descriptionPlaceholder`)})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between flex-wrap gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(`span`,{className:`text-sm text-bambu-gray`,children:[r(`groups.editor.permissionsSelected`,{count:u.length}),` / `,N]}),(0,G.jsx)(Q,{size:`sm`,variant:`ghost`,onClick:k,children:r(`groups.editor.selectAll`)}),(0,G.jsx)(Q,{size:`sm`,variant:`ghost`,onClick:A,children:r(`groups.editor.clearAll`)})]}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(Kl,{className:`w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-bambu-gray`}),(0,G.jsx)(`input`,{type:`text`,value:p,onChange:e=>m(e.target.value),placeholder:r(`groups.editor.search`),className:`pl-9 pr-4 py-2 text-sm bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors w-64`})]})]}),M.length===0?(0,G.jsx)(`div`,{className:`text-center py-12 text-bambu-gray`,children:r(`groups.editor.noResults`)}):(0,G.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:M.map(e=>{let t=y.categories.find(t=>t.name===e.name),n=t.permissions.filter(e=>u.includes(e.value)).length,i=t.permissions.length,a=D(t),o=O(t);return(0,G.jsxs)(zd,{children:[(0,G.jsxs)(`div`,{className:`sticky top-0 z-10 flex items-center justify-between px-4 py-3 bg-bambu-dark-secondary border-b border-bambu-dark-tertiary rounded-t-xl`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>E(t,!a),className:`w-5 h-5 rounded border flex items-center justify-center transition-colors shrink-0 ${a?`bg-bambu-green border-bambu-green`:o?`bg-bambu-green/50 border-bambu-green`:`border-bambu-gray hover:border-white`}`,children:[a&&(0,G.jsx)(is,{className:`w-3 h-3 text-white`}),o&&!a&&(0,G.jsx)(cl,{className:`w-3 h-3 text-white`})]}),(0,G.jsx)(tu,{className:`w-4 h-4 text-bambu-gray shrink-0`}),(0,G.jsx)(`span`,{className:`text-white font-medium text-sm`,children:e.name})]}),(0,G.jsxs)(`span`,{className:`text-xs text-bambu-gray tabular-nums`,children:[n,`/`,i]})]}),(0,G.jsx)(`div`,{className:`p-3 space-y-1`,children:e.permissions.map(e=>(0,G.jsxs)(`label`,{className:`flex items-center gap-3 px-2 py-1.5 rounded hover:bg-bambu-dark-secondary cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:u.includes(e.value),onChange:()=>T(e.value),className:`w-4 h-4 shrink-0 rounded border-bambu-gray text-bambu-green focus:ring-bambu-green focus:ring-offset-0 bg-bambu-dark-secondary`}),(0,G.jsxs)(`span`,{className:`flex flex-col`,children:[(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e.label}),e.value===`websocket:connect`&&(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray/60`,children:r(`groups.editor.websocketHint`)})]})]},e.value))})]},e.name)})}),(0,G.jsx)(`div`,{className:`h-16`}),(0,G.jsxs)(`div`,{className:`fixed bottom-0 left-0 right-0 z-20 px-6 py-3 bg-bambu-dark-secondary border-t border-bambu-dark-tertiary flex items-center justify-center gap-3`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>t(`/settings?tab=users`),children:r(`common.cancel`)}),(0,G.jsx)(Q,{onClick:w,disabled:C||!o.trim(),children:C?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),r(`common.saving`)]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Vl,{className:`w-4 h-4`}),r(`common.save`)]})})]})]})}var a0e=1.65,o0e=[`#1DB954`,`#3B82F6`,`#F59E0B`,`#EF4444`,`#8B5CF6`];function i9(e,t,n,r){return`${e}||${t??``}||${n??``}||${r??``}`}function a9(e,t){let n=new Date(e);return n.setDate(n.getDate()+Math.round(t)),n}function o9(e){return e.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function s9(e){return e.toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function s0e(e){if(e.length<2)return null;let t=new Map;for(let n of e){let e=n.created_at.slice(0,10);t.set(e,(t.get(e)??0)+n.weight_used)}if(t.size<2)return null;let n=[...t.entries()].map(([e,t])=>({ms:new Date(e).getTime(),totalG:t})).sort((e,t)=>e.ms-t.ms),r=Date.now(),i=Math.LN2/30,a=[];for(let e=1;ee+t.weight,0);if(o===0)return null;let s=a.reduce((e,t)=>e+t.rate*t.weight,0)/o,c=a.reduce((e,t)=>e+t.weight*(t.rate-s)**2,0)/o;return{rate:s,stdDev:Math.sqrt(c)}}function c0e(e){let t=e.reduce((e,t)=>e+Math.max(0,t.weight_used-(t.weight_used_baseline??0)),0);if(t===0)return null;let n=Date.now(),r=(n-e.reduce((e,t)=>{let n=new Date(t.created_at).getTime();return nZ.getAllUsageHistory(5e3),staleTime:6e4,enabled:o}),{data:O=[]}=K({queryKey:[`shopping-list`],queryFn:Z.getShoppingList,staleTime:3e4,enabled:o}),k=T?.forecast_global_lead_time_days??0,A=(0,f.useMemo)(()=>{let e=new Map;for(let t of E)e.set(i9(t.material,t.subtype,t.brand,t.color_name),t);return e},[E]),j=(0,f.useMemo)(()=>{let e=new Map;for(let t of D){let n=e.get(t.spool_id)??[];n.push(t),e.set(t.spool_id,n)}return e},[D]),M=(0,f.useMemo)(()=>{let t=new Map;for(let n of e){if(n.archived_at)continue;let e=i9(n.material,n.subtype,n.brand,n.color_name),r=t.get(e)??{key:e,material:n.material,subtype:n.subtype,brand:n.brand,colorName:n.color_name,spools:[]};r.spools.push(n),t.set(e,r)}return[...t.values()]},[e]),N=(0,f.useMemo)(()=>{let e=new Date;return e.setHours(0,0,0,0),M.map(t=>{let n=A.get(t.key)??(t.colorName===null?null:A.get(i9(t.material,t.subtype,t.brand,null))??null),r=n?.lead_time_days??0,i=Math.max(k,r),a=n?.safety_margin_value??14,o=n?.safety_margin_unit??`days`,s=t.spools.reduce((e,t)=>e+Math.max(0,t.label_weight-t.weight_used),0),c=t.spools.reduce((e,t)=>e+t.label_weight,0),l=t.spools.reduce((e,t)=>e+Math.max(0,t.weight_used-(t.weight_used_baseline??0)),0),u=[];for(let e of t.spools)(e.weight_used_baseline??0)===0&&u.push(...j.get(e.id)??[]);let d=null,f=null,p=`none`,m=s0e(u);if(m!==null)d=m.rate,f=m.stdDev,p=`history`;else{let e=c0e(t.spools);e!==null&&(d=e,p=`delta`)}let h=a0e*(f??(d===null?0:d*.2))*Math.sqrt(i)+(o===`g`?a:d===null?a*5:d*a),g=d===null?0:d*i+h,_=d&&d>0?Math.floor(s/d):null,v=_===null?null:a9(e,_),y=d&&d>0?Math.floor((s-g)/d):null,b=y===null?null:a9(e,Math.max(0,y)),x=_!==null&&i>0&&_<=i,S=!x&&y!==null&&y<=0;return{group:t,settings:n,totalRemainingG:s,totalLabelG:c,totalSpools:t.spools.length,totalUsedG:l,dailyRateG:d,dailyRateStdDev:f,rateTier:p,effectiveLeadTimeDays:i,safetyStockG:h,reorderPointG:g,daysRemaining:_,daysUntilROP:y,projectedEmptyDate:v,reorderTriggerDate:b,reorderAlert:S,stockBreakAlert:x}})},[M,A,j,k]),P=(0,f.useMemo)(()=>[...new Set(M.map(e=>e.material))].sort(),[M]),F=(0,f.useMemo)(()=>[...new Set(M.map(e=>e.brand).filter(Boolean))].sort(),[M]),I=(0,f.useMemo)(()=>{let e=[...N];return h&&(e=e.filter(e=>e.group.material===h)),_&&(e=e.filter(e=>e.group.brand===_)),e.sort((e,t)=>{let n=0,r=0;switch(u){case`material`:n=[e.group.material,e.group.subtype??``,e.group.brand??``].join(` `).toLowerCase(),r=[t.group.material,t.group.subtype??``,t.group.brand??``].join(` `).toLowerCase();break;case`used`:n=e.totalUsedG,r=t.totalUsedG;break;case`days_left`:n=e.daysRemaining??999999,r=t.daysRemaining??999999;break;case`stock`:n=e.totalRemainingG,r=t.totalRemainingG;break}let i=nr);return p===`asc`?i:-i}),e},[N,u,p,h,_]),L=(0,f.useMemo)(()=>N.filter(e=>!e.settings?.alerts_snoozed&&(e.stockBreakAlert||e.reorderAlert)),[N]),R=(0,f.useMemo)(()=>[...N].filter(e=>e.dailyRateG!==null).sort((e,t)=>t.totalUsedG-e.totalUsedG).slice(0,5),[N]);if(!o)return(0,G.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 text-bambu-gray gap-3`,children:[(0,G.jsx)(Xc,{className:`w-8 h-8 opacity-40`}),(0,G.jsx)(`p`,{className:`text-sm`,children:r(`forecast.noReadAccess`)})]});function z(e){u===e?m(e=>e===`asc`?`desc`:`asc`):(d(e),m(e===`days_left`?`asc`:`desc`))}let B=O.length>0?O.length:null;return(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[L.length>0&&(0,G.jsxs)(`button`,{onClick:()=>l(e=>!e),className:`flex items-center gap-2 px-3 py-1.5 rounded-lg border text-sm font-medium transition-colors ${L.some(e=>e.stockBreakAlert)?`bg-red-100 dark:bg-red-500/15 border-red-300 dark:border-red-500/30 text-red-700 dark:text-red-300 hover:bg-red-200 dark:hover:bg-red-500/25`:`bg-yellow-100 dark:bg-yellow-500/15 border-yellow-300 dark:border-yellow-500/30 text-yellow-700 dark:text-yellow-300 hover:bg-yellow-200 dark:hover:bg-yellow-500/25`}`,children:[(0,G.jsx)(Pu,{className:`w-4 h-4`}),r(`forecast.alertCount`,{count:L.length}),c?(0,G.jsx)(ls,{className:`w-3.5 h-3.5`}):(0,G.jsx)(as,{className:`w-3.5 h-3.5`})]}),s&&(0,G.jsx)(m0e,{value:k,onSave:e=>{Z.updateSettings({forecast_global_lead_time_days:e}).then(()=>{t.invalidateQueries({queryKey:[`settings`]}),n(r(`forecast.globalLeadTimeSaved`),`success`)})}}),(0,G.jsxs)(`select`,{value:h,onChange:e=>g(e.target.value),className:`px-3 py-1.5 rounded-lg border text-xs font-medium transition-colors cursor-pointer focus:outline-none ${h?`bg-bambu-green/20 text-bambu-green border-bambu-green/30`:`bg-transparent text-bambu-gray border-bambu-dark-tertiary hover:bg-bambu-dark-tertiary`}`,children:[(0,G.jsx)(`option`,{value:``,children:r(`inventory.material`)}),P.map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))]}),(0,G.jsxs)(`select`,{value:_,onChange:e=>v(e.target.value),className:`px-3 py-1.5 rounded-lg border text-xs font-medium transition-colors cursor-pointer focus:outline-none ${_?`bg-bambu-green/20 text-bambu-green border-bambu-green/30`:`bg-transparent text-bambu-gray border-bambu-dark-tertiary hover:bg-bambu-dark-tertiary`}`,children:[(0,G.jsx)(`option`,{value:``,children:r(`inventory.brand`)}),F.map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))]}),(0,G.jsxs)(`button`,{onClick:()=>S(e=>!e),className:`relative flex items-center gap-2 px-3 py-1.5 rounded-lg border border-bambu-dark-tertiary text-bambu-gray hover:bg-bambu-dark-tertiary text-sm transition-colors ml-auto`,children:[(0,G.jsx)(nu,{className:`w-4 h-4`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:r(`forecast.shoppingList`)}),B&&(0,G.jsx)(`span`,{className:`absolute -top-1.5 -right-1.5 w-4 h-4 rounded-full bg-bambu-green text-white text-[10px] font-bold flex items-center justify-center`,children:B})]})]}),c&&L.length>0&&(0,G.jsx)(`div`,{className:`space-y-2`,children:L.map(e=>(0,G.jsx)(d0e,{forecast:e,onCart:()=>b(e)},e.group.key))}),x&&(0,G.jsx)(y0e,{items:O,forecasts:N,globalLeadTime:k,canWrite:s,onClose:()=>S(!1),onRemove:e=>{Z.removeFromShoppingList(e).then(()=>t.invalidateQueries({queryKey:[`shopping-list`]})).catch(()=>n(r(`forecast.failedSaveSettings`),`error`))},onClear:()=>{Z.clearShoppingList().then(()=>t.invalidateQueries({queryKey:[`shopping-list`]})).catch(()=>n(r(`forecast.failedSaveSettings`),`error`))}}),R.length>0&&(0,G.jsx)(p0e,{forecasts:R,days:C,onDaysChange:w}),N.length===0?(0,G.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 text-bambu-gray`,children:[(0,G.jsx)(Mu,{className:`w-10 h-10 mb-3 opacity-40`}),(0,G.jsx)(`p`,{className:`text-sm`,children:r(`forecast.noSpools`)})]}):(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg overflow-hidden border border-bambu-dark-tertiary`,children:[(0,G.jsx)(`div`,{className:`overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary bg-bambu-dark-tertiary/30`,children:[(0,G.jsx)(`th`,{className:`w-8 px-4 py-3`}),(0,G.jsx)(c9,{col:`material`,active:u,dir:p,onSort:z,children:r(`forecast.sku`)}),(0,G.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:r(`locations.spools`)}),(0,G.jsx)(c9,{col:`stock`,active:u,dir:p,onSort:z,children:r(`forecast.stock`)}),(0,G.jsx)(c9,{col:`used`,active:u,dir:p,onSort:z,children:r(`forecast.dailyRate`)}),(0,G.jsx)(c9,{col:`days_left`,active:u,dir:p,onSort:z,children:r(`forecast.daysLeft`)}),(0,G.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:r(`forecast.emptyBy`)}),(0,G.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:r(`forecast.reorderBy`)}),(0,G.jsx)(`th`,{className:`w-24 px-4 py-3`})]})}),(0,G.jsx)(`tbody`,{className:`divide-y divide-bambu-dark-tertiary`,children:I.map(e=>(0,G.jsx)(h0e,{forecast:e,globalLeadTime:k,canWrite:s,onSaved:()=>t.invalidateQueries({queryKey:[`sku-settings`]}),onCart:()=>b(e),showToast:n},e.group.key))})]})}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 px-4 py-3 text-xs text-bambu-gray border-t border-bambu-dark-tertiary bg-bambu-dark-tertiary/20`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-bambu-green inline-block`}),r(`forecast.trendLegend`)]}),(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-blue-400 inline-block`}),r(`forecast.estimatedLegend`)]}),(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-bambu-gray/40 inline-block`}),r(`forecast.noDataLegend`)]})]})]}),y&&(0,G.jsx)(x0e,{forecast:y,onClose:()=>b(null),onAdd:e=>{Z.addToShoppingList(e).then(()=>{t.invalidateQueries({queryKey:[`shopping-list`]}),n(r(`forecast.addedToCart`),`success`),b(null),S(!0)}).catch(()=>n(r(`forecast.failedAddItem`),`error`))}})]})}function c9({col:e,active:t,dir:n,onSort:r,children:i}){return(0,G.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide cursor-pointer select-none hover:text-white transition-colors`,onClick:()=>r(e),children:(0,G.jsxs)(`span`,{className:`inline-flex items-center`,children:[i,t===e?n===`asc`?(0,G.jsx)(Io,{className:`w-3 h-3 ml-1 text-bambu-green`}):(0,G.jsx)(Ao,{className:`w-3 h-3 ml-1 text-bambu-green`}):(0,G.jsx)(Po,{className:`w-3 h-3 ml-1 opacity-40`})]})})}function d0e({forecast:e,onCart:t}){let{t:n}=U(),r=[e.group.brand,e.group.material,e.group.subtype,e.group.colorName].filter(Boolean).join(` `),i=e.stockBreakAlert;return(0,G.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3 rounded-lg border text-sm ${i?`bg-red-50 dark:bg-red-500/10 border-red-300 dark:border-red-500/30 text-red-700 dark:text-red-300`:`bg-yellow-50 dark:bg-yellow-500/10 border-yellow-300 dark:border-yellow-500/30 text-yellow-700 dark:text-yellow-300`}`,children:[(0,G.jsx)(Pu,{className:`w-4 h-4 flex-shrink-0`}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`span`,{className:`font-medium`,children:r}),i?(0,G.jsxs)(`span`,{className:`ml-2 text-xs opacity-80`,children:[n(`forecast.stockBreakRisk`),` — `,n(`forecast.stockBreakDetail`,{days:e.daysRemaining,lt:e.effectiveLeadTimeDays})]}):(0,G.jsxs)(`span`,{className:`ml-2 text-xs opacity-80`,children:[n(`forecast.reorderNow`),` — `,n(`forecast.reorderTriggerPassed`,{date:e.reorderTriggerDate?o9(e.reorderTriggerDate):`—`})]})]}),(0,G.jsxs)(`button`,{onClick:t,className:`flex items-center gap-1.5 px-2.5 py-1 rounded border border-current text-xs opacity-70 hover:opacity-100 transition-opacity`,children:[(0,G.jsx)(nu,{className:`w-3 h-3`}),` `,n(`forecast.order`)]})]})}var f0e=[{label:`1W`,value:7},{label:`1M`,value:30},{label:`6M`,value:180}];function p0e({forecasts:e,days:t,onDaysChange:n}){let{t:r}=U(),i=Array.from({length:t+1},(e,t)=>t),a=e.map((e,n)=>({key:e.group.key,label:[e.group.brand,e.group.material,e.group.subtype,e.group.colorName].filter(Boolean).join(` `),color:o0e[n%o0e.length],rop:e.reorderPointG,points:l0e(e,t)})),o=i.map(e=>{let t={day:e,label:s9(a9(new Date,e))};for(let n of a){let r=n.points.find(t=>t.day===e);t[n.key]=r?.stock??0}return t}),s=(()=>{for(let e=t;e>=0;e--)if(a.some(t=>o[e]?.[t.key]>0))return e;return t})(),c=o.slice(0,s+1),l=a.filter(e=>e.rop>0);return(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg overflow-hidden border border-bambu-dark-tertiary p-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-4`,children:[(0,G.jsx)(Mu,{className:`w-4 h-4 text-bambu-green`}),(0,G.jsx)(`h3`,{className:`text-sm font-semibold text-white`,children:r(`forecast.chartTitle`)}),(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray ml-1 hidden sm:inline`,children:r(`forecast.dashedLinesROP`)}),(0,G.jsx)(`div`,{className:`ml-auto flex items-center bg-bambu-dark-tertiary rounded-lg p-0.5`,children:f0e.map(e=>(0,G.jsx)(`button`,{onClick:()=>n(e.value),className:`px-2.5 py-1 text-xs font-medium rounded-md transition-colors ${t===e.value?`bg-bambu-dark-secondary text-white shadow`:`text-bambu-gray hover:text-white`}`,children:e.label},e.value))})]}),(0,G.jsx)(UA,{width:`100%`,height:220,children:(0,G.jsxs)(BH,{data:c,margin:{top:4,right:8,bottom:0,left:0},children:[(0,G.jsx)(`defs`,{children:a.map(e=>(0,G.jsxs)(`linearGradient`,{id:`grad-${e.key}`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,G.jsx)(`stop`,{offset:`5%`,stopColor:e.color,stopOpacity:.25}),(0,G.jsx)(`stop`,{offset:`95%`,stopColor:e.color,stopOpacity:.02})]},e.key))}),(0,G.jsx)(sV,{strokeDasharray:`3 3`,stroke:`#374151`,strokeOpacity:.5}),(0,G.jsx)(XV,{dataKey:`label`,tick:{fill:`#6B7280`,fontSize:10},interval:Math.max(0,Math.ceil(s/8)-1),axisLine:!1,tickLine:!1}),(0,G.jsx)(tH,{tick:{fill:`#6B7280`,fontSize:10},axisLine:!1,tickLine:!1,tickFormatter:e=>e>=1e3?`${(e/1e3).toFixed(1)}kg`:`${e}g`,width:48}),(0,G.jsx)(mz,{content:({label:e,payload:t})=>t?.length?(0,G.jsxs)(`div`,{style:{background:`#1a1a2e`,border:`1px solid #374151`,borderRadius:8,fontSize:12,padding:`8px 12px`},children:[(0,G.jsx)(`div`,{style:{color:`#9CA3AF`,marginBottom:6},children:e}),t.map(e=>{let t=a.find(t=>t.key===String(e.dataKey));return typeof e.value==`number`?(0,G.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,color:`#E5E7EB`,marginBottom:2},children:[(0,G.jsx)(`span`,{style:{color:t?.color??`#9CA3AF`,fontSize:10},children:`●`}),(0,G.jsx)(`span`,{children:t?.label??String(e.dataKey)}),(0,G.jsxs)(`span`,{style:{color:`#9CA3AF`,marginLeft:4},children:[e.value,`g`]})]},String(e.dataKey)):null})]}):null}),(0,G.jsx)(Bj,{formatter:e=>(0,G.jsx)(`span`,{style:{color:`#9CA3AF`,fontSize:11},children:a.find(t=>t.key===e)?.label??e})}),a.map(e=>(0,G.jsx)(OV,{type:`monotone`,dataKey:e.key,stroke:e.color,strokeWidth:2,fill:`url(#grad-${e.key})`,dot:!1,activeDot:{r:3}},e.key)),l.map(e=>(0,G.jsx)(XB,{y:e.rop,stroke:e.color,strokeDasharray:`4 3`,strokeOpacity:.6},`rop-${e.key}`))]})})]})}function m0e({value:e,onSave:t}){let{t:n}=U(),[r,i]=(0,f.useState)(!1),[a,o]=(0,f.useState)(String(e));function s(){let e=parseInt(a,10);isNaN(e)||e<0||(t(e),i(!1))}return(0,G.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 bg-bambu-dark-tertiary/40 rounded-lg border border-bambu-dark-tertiary text-xs text-bambu-gray`,children:[(0,G.jsx)(Rc,{className:`w-3.5 h-3.5 flex-shrink-0`,"aria-label":n(`forecast.globalLeadTimeHint`)}),(0,G.jsxs)(`span`,{className:`hidden sm:inline`,children:[n(`forecast.globalLeadTime`),`:`]}),r?(0,G.jsxs)(`form`,{className:`flex items-center gap-1.5`,onSubmit:e=>{e.preventDefault(),s()},children:[(0,G.jsx)(`input`,{type:`number`,min:0,max:365,value:a,onChange:e=>o(e.target.value),className:`w-14 px-1.5 py-0.5 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-sm text-white focus:outline-none focus:border-bambu-green`,autoFocus:!0}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:`d`}),(0,G.jsx)(`button`,{type:`submit`,className:`px-2 py-0.5 bg-bambu-green text-white text-xs rounded hover:bg-bambu-green/80`,children:n(`forecast.save`)}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>i(!1),className:`text-xs text-bambu-gray hover:text-white`,children:`✕`})]}):(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsxs)(`span`,{className:`font-semibold text-white`,children:[e,`d`]}),(0,G.jsx)(`button`,{onClick:()=>{o(String(e)),i(!0)},className:`p-0.5 text-bambu-gray hover:text-white rounded transition-colors`,children:(0,G.jsx)(Cl,{className:`w-3 h-3`})})]})]})}function h0e({forecast:e,globalLeadTime:t,canWrite:n,onSaved:r,onCart:i,showToast:a}){let{t:o}=U(),[s,c]=(0,f.useState)(!1),[l,u]=(0,f.useState)(!1),[d,p]=(0,f.useState)(!1),[m,h]=(0,f.useState)(String(e.settings?.lead_time_days??0)),[g,_]=(0,f.useState)(String(e.settings?.safety_margin_value??14)),[v,y]=(0,f.useState)(e.settings?.safety_margin_unit??`days`);(0,f.useEffect)(()=>{l||h(String(e.settings?.lead_time_days??0))},[e.settings?.lead_time_days,l]),(0,f.useEffect)(()=>{d||(_(String(e.settings?.safety_margin_value??14)),y(e.settings?.safety_margin_unit??`days`))},[e.settings?.safety_margin_value,e.settings?.safety_margin_unit,d]);let b=q({mutationFn:Z.upsertSkuSettings,onSuccess:()=>{r(),a(o(`forecast.settingsSaved`),`success`)},onError:()=>a(o(`forecast.failedSaveSettings`),`error`)}),x=e.settings?.alerts_snoozed??!1,S=[e.group.brand,e.group.material,e.group.subtype,e.group.colorName].filter(Boolean).join(` `),C=e.group.spools[0]?.rgba?jf(e.group.spools[0].rgba):{backgroundColor:`#4B5563`},w=e.totalLabelG>0?Math.round(e.totalRemainingG/e.totalLabelG*100):0,T=x||e.daysRemaining===null?`text-bambu-gray`:e.stockBreakAlert?`text-red-700 dark:text-red-400`:e.reorderAlert||e.daysRemaining<30?`text-yellow-700 dark:text-yellow-400`:`text-green-700 dark:text-green-400`;function E(t,n,r,i=x){b.mutate({material:e.group.material,subtype:e.group.subtype,brand:e.group.brand,color_name:e.group.colorName,lead_time_days:t,safety_margin_value:n,safety_margin_unit:r,alerts_snoozed:i})}function D(t){t.stopPropagation(),E(e.settings?.lead_time_days??0,e.settings?.safety_margin_value??14,e.settings?.safety_margin_unit??`days`,!x)}let O=e.rateTier===`history`?(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs px-1.5 py-0.5 rounded bg-bambu-green/15 text-bambu-green`,children:[(0,G.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-bambu-green`}),o(`forecast.trend`)]}):e.rateTier===`delta`?(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs px-1.5 py-0.5 rounded bg-blue-100 dark:bg-blue-400/15 text-blue-700 dark:text-blue-400`,children:[(0,G.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-blue-400`}),o(`forecast.estimated`)]}):(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs px-1.5 py-0.5 rounded bg-bambu-dark-tertiary text-bambu-gray/60`,children:[(0,G.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-bambu-gray/40`}),o(`forecast.noData`)]});return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary/50 cursor-pointer hover:bg-bambu-dark-tertiary/30 transition-colors ${x?``:e.stockBreakAlert?`bg-red-500/5`:e.reorderAlert?`bg-yellow-500/5`:``} ${x?`opacity-50`:``}`,onClick:()=>c(e=>!e),children:[(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`span`,{className:`block w-5 h-5 rounded-full border border-black/20`,style:C})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`span`,{className:`text-sm text-white`,children:S})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e.totalSpools})}),(0,G.jsx)(`td`,{className:`px-4 py-3 min-w-[140px]`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`flex-1 h-2 bg-bambu-dark-tertiary rounded-full overflow-hidden`,children:(0,G.jsx)(`div`,{className:`h-full rounded-full ${w>50?`bg-bambu-green`:w>20?`bg-yellow-500`:`bg-red-500`}`,style:{width:`${Math.min(w,100)}%`}})}),(0,G.jsxs)(`span`,{className:`text-xs text-bambu-gray min-w-[40px] text-right`,children:[Math.round(e.totalRemainingG),`g`]})]})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[(0,G.jsx)(`span`,{className:`text-sm text-white`,children:e.dailyRateG===null?`—`:`${e.dailyRateG.toFixed(1)}g/d`}),O]})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`span`,{className:`text-sm font-semibold ${T}`,children:e.daysRemaining===null?(0,G.jsx)(`span`,{className:`text-bambu-gray font-normal`,children:`—`}):`${e.daysRemaining}d`})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e.projectedEmptyDate?o9(e.projectedEmptyDate):`—`})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`span`,{className:`text-sm ${!x&&e.reorderAlert?`text-yellow-700 dark:text-yellow-400`:`text-bambu-gray`}`,children:e.reorderTriggerDate?o9(e.reorderTriggerDate):`—`})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,onClick:e=>e.stopPropagation(),children:(0,G.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[n&&(0,G.jsx)(`button`,{onClick:i,className:`p-1.5 text-bambu-gray hover:text-bambu-green rounded transition-colors`,title:o(`forecast.addToCart`),children:(0,G.jsx)(nu,{className:`w-4 h-4`})}),!x&&(e.stockBreakAlert?(0,G.jsx)(Pu,{className:`w-4 h-4 text-red-600 dark:text-red-400`,"aria-label":o(`forecast.stockBreakRisk`)}):e.reorderAlert?(0,G.jsx)(Pu,{className:`w-4 h-4 text-yellow-600 dark:text-yellow-400`,"aria-label":o(`forecast.reorderNow`)}):e.daysRemaining===null?null:(0,G.jsx)(is,{className:`w-4 h-4 text-bambu-green/50`})),n&&(0,G.jsx)(`button`,{onClick:D,className:`p-1 rounded transition-colors ${x?`text-amber-600/80 dark:text-amber-400/80 hover:text-amber-700 dark:hover:text-amber-300`:`text-slate-400 hover:text-white`}`,title:o(x?`forecast.alertsEnabled`:`forecast.alertsSnoozed`),children:(0,G.jsx)(Bo,{className:`w-3.5 h-3.5`})}),(0,G.jsx)(`button`,{onClick:e=>{e.stopPropagation(),c(e=>!e)},className:`p-1.5 text-bambu-gray hover:text-white rounded transition-colors`,children:s?(0,G.jsx)(ls,{className:`w-4 h-4`}):(0,G.jsx)(as,{className:`w-4 h-4`})})]})})]}),s&&(0,G.jsx)(`tr`,{className:`bg-bambu-dark-tertiary/10`,children:(0,G.jsx)(`td`,{colSpan:9,className:`px-6 py-4`,children:(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`grid gap-2 ${n?`grid-cols-2 sm:grid-cols-4`:`grid-cols-2`}`,children:[(0,G.jsx)(g0e,{label:o(`forecast.effectiveLeadTime`),value:`${e.effectiveLeadTimeDays}d`,hint:o(`forecast.effectiveLeadTimeHint`,{global:t,sku:e.settings?.lead_time_days??0})}),(0,G.jsx)(g0e,{label:o(`forecast.reorderPoint`),value:`${Math.round(e.reorderPointG)}g`,hint:o(`forecast.reorderPointHint`)}),n&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(_0e,{label:o(`forecast.skuLeadTimeOverride`),hint:o(`forecast.skuLeadTimeHint`),unit:o(`forecast.leadTime`),editing:l,value:e.settings?.lead_time_days??0,inputValue:m,onInputChange:h,onEdit:()=>{h(String(e.settings?.lead_time_days??0)),u(!0)},onSave:()=>{let t=parseInt(m,10);!isNaN(t)&&t>=0&&(E(t,e.settings?.safety_margin_value??14,v),u(!1))},onCancel:()=>u(!1),isPending:b.isPending,saveLabel:o(`forecast.save`),cancelLabel:o(`forecast.cancel`)}),(0,G.jsx)(v0e,{value:e.settings?.safety_margin_value??14,unit:v,editing:d,inputValue:g,dailyRateG:e.dailyRateG,onInputChange:_,onUnitChange:e=>y(e),onEdit:()=>{_(String(e.settings?.safety_margin_value??14)),y(e.settings?.safety_margin_unit??`days`),p(!0)},onSave:()=>{let t=parseInt(g,10);!isNaN(t)&&t>=0&&(E(e.settings?.lead_time_days??0,t,v),p(!1))},onCancel:()=>p(!1),isPending:b.isPending,saveLabel:o(`forecast.save`),cancelLabel:o(`forecast.cancel`),safetyMarginLabel:o(`forecast.safetyMarginLabel`)})]})]}),e.group.spools.length>1&&(0,G.jsxs)(`div`,{className:`border-t border-bambu-dark-tertiary pt-3`,children:[(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mb-2`,children:o(`forecast.individualSpools`)}),(0,G.jsx)(`div`,{className:`bg-bambu-dark-secondary rounded-lg overflow-hidden border border-bambu-dark-tertiary`,children:(0,G.jsxs)(`table`,{className:`w-full`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary bg-bambu-dark-tertiary/30`,children:[(0,G.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:`#`}),(0,G.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:o(`inventory.remaining`)}),(0,G.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:o(`inventory.used`)}),(0,G.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:o(`forecast.labelWeight`)})]})}),(0,G.jsx)(`tbody`,{className:`divide-y divide-bambu-dark-tertiary`,children:e.group.spools.map(e=>{let t=Math.max(0,e.label_weight-e.weight_used),n=e.label_weight>0?t/e.label_weight*100:0;return(0,G.jsxs)(`tr`,{className:`hover:bg-bambu-dark-tertiary/30 transition-colors`,children:[(0,G.jsx)(`td`,{className:`px-4 py-2`,children:(0,G.jsxs)(`span`,{className:`text-xs font-mono text-bambu-gray/70`,children:[`#`,e.id]})}),(0,G.jsx)(`td`,{className:`px-4 py-2`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-24 h-1.5 bg-bambu-dark-tertiary rounded-full overflow-hidden flex-shrink-0`,children:(0,G.jsx)(`div`,{className:`h-full rounded-full ${n>50?`bg-bambu-green`:n>20?`bg-yellow-500`:`bg-red-500`}`,style:{width:`${Math.min(n,100)}%`}})}),(0,G.jsxs)(`span`,{className:`text-sm text-white`,children:[Math.round(t),`g`]})]})}),(0,G.jsx)(`td`,{className:`px-4 py-2`,children:(0,G.jsxs)(`span`,{className:`text-sm text-bambu-gray`,children:[Math.round(Math.max(0,e.weight_used-(e.weight_used_baseline??0))),`g`]})}),(0,G.jsx)(`td`,{className:`px-4 py-2`,children:(0,G.jsxs)(`span`,{className:`text-sm text-bambu-gray`,children:[e.label_weight,`g`]})})]},e.id)})})]})})]})]})})})]})}function g0e({label:e,value:t,hint:n}){return(0,G.jsxs)(`div`,{className:`bg-bambu-dark-tertiary/40 rounded-lg p-3`,title:n,children:[(0,G.jsx)(`div`,{className:`text-xs font-medium text-white mb-1`,children:e}),(0,G.jsx)(`div`,{className:`text-lg font-semibold text-white`,children:t})]})}function _0e({label:e,hint:t,unit:n,editing:r,value:i,inputValue:a,onInputChange:o,onEdit:s,onSave:c,onCancel:l,isPending:u,saveLabel:d=`Save`,cancelLabel:f=`Cancel`}){return(0,G.jsxs)(`div`,{className:`bg-bambu-dark-tertiary/40 rounded-lg p-3 space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`text-xs font-medium text-white`,children:e}),(0,G.jsx)(`span`,{title:t,children:(0,G.jsx)(Rc,{className:`w-3 h-3 text-bambu-gray/50`})})]}),r?(0,G.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:e=>{e.preventDefault(),c()},children:[(0,G.jsx)(`input`,{type:`number`,min:0,max:365,value:a,onChange:e=>o(e.target.value),className:`w-20 px-2 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-sm text-white focus:outline-none focus:border-bambu-green`,autoFocus:!0,disabled:u}),(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:n}),(0,G.jsx)(`button`,{type:`submit`,disabled:u,className:`px-2 py-1 bg-bambu-green text-white text-xs rounded hover:bg-bambu-green/80 disabled:opacity-50`,children:d}),(0,G.jsx)(`button`,{type:`button`,onClick:l,disabled:u,className:`px-2 py-1 text-xs text-bambu-gray hover:text-white`,children:f})]}):(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-lg font-semibold text-white`,children:i}),(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:n}),(0,G.jsx)(`button`,{onClick:s,className:`p-1 text-bambu-gray hover:text-white rounded transition-colors`,children:(0,G.jsx)(Cl,{className:`w-3 h-3`})})]})]})}function v0e({value:e,unit:t,editing:n,inputValue:r,dailyRateG:i,onInputChange:a,onUnitChange:o,onEdit:s,onSave:c,onCancel:l,isPending:u,saveLabel:d=`Save`,cancelLabel:f=`Cancel`,safetyMarginLabel:p=`Safety Margin`}){let{t:m}=U(),h=t===`g`?e:i===null?null:Math.round(i*e),g=t===`days`?m(`forecast.safetyMarginHintDays`,{approx:h===null?``:m(`forecast.safetyMarginHintDaysApprox`,{g:h})}):m(`forecast.safetyMarginHintG`,{approx:i===null?``:m(`forecast.safetyMarginHintGApprox`,{days:Math.round(e/i)})});return(0,G.jsxs)(`div`,{className:`bg-bambu-dark-tertiary/40 rounded-lg p-3 space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`text-xs font-medium text-white`,children:p}),(0,G.jsx)(`span`,{title:g,children:(0,G.jsx)(Rc,{className:`w-3 h-3 text-bambu-gray/50`})})]}),n?(0,G.jsxs)(`form`,{className:`flex items-center gap-2 flex-wrap`,onSubmit:e=>{e.preventDefault(),c()},children:[(0,G.jsx)(`input`,{type:`number`,min:0,max:t===`g`?1e4:365,value:r,onChange:e=>a(e.target.value),className:`w-20 px-2 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-sm text-white focus:outline-none focus:border-bambu-green`,autoFocus:!0,disabled:u}),(0,G.jsxs)(`div`,{className:`flex bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded overflow-hidden text-xs`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>o(`days`),className:`px-2 py-1 transition-colors ${t===`days`?`bg-bambu-green text-white`:`text-bambu-gray hover:text-white`}`,children:`days`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>o(`g`),className:`px-2 py-1 transition-colors ${t===`g`?`bg-bambu-green text-white`:`text-bambu-gray hover:text-white`}`,children:`g`})]}),(0,G.jsx)(`button`,{type:`submit`,disabled:u,className:`px-2 py-1 bg-bambu-green text-white text-xs rounded hover:bg-bambu-green/80 disabled:opacity-50`,children:d}),(0,G.jsx)(`button`,{type:`button`,onClick:l,disabled:u,className:`px-2 py-1 text-xs text-bambu-gray hover:text-white`,children:f})]}):(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-lg font-semibold text-white`,children:e}),(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:t}),h!==null&&t===`days`&&(0,G.jsxs)(`span`,{className:`text-lg font-semibold text-white`,children:[`≈ `,h,`g`]}),t===`g`&&i!==null&&(0,G.jsxs)(`span`,{className:`text-lg font-semibold text-white`,children:[`≈ `,Math.round(e/i),`d`]}),(0,G.jsx)(`button`,{onClick:s,className:`p-1 text-bambu-gray hover:text-white rounded transition-colors`,children:(0,G.jsx)(Cl,{className:`w-3 h-3`})})]})]})}function y0e({items:e,forecasts:t,globalLeadTime:n,canWrite:r,onClose:i,onRemove:a,onClear:o}){let{t:s}=U(),c=no(),[l,u]=(0,f.useState)(`list`),d=q({mutationFn:async({id:e,status:t,item:n,avgSpoolG:r})=>{if(await Z.updateShoppingListStatus(e,t),t===`received`&&n){let t=r??1e3,i={material:n.material,subtype:n.subtype,brand:n.brand,label_weight:t,core_weight:0,core_weight_catalog_id:null,color_name:n.color_name,rgba:null,extra_colors:null,effect_type:null,nozzle_temp_min:null,nozzle_temp_max:null,note:n.note??null,tag_uid:null,tray_uuid:null,data_origin:`manual`,tag_type:null,cost_per_kg:null,last_scale_weight:null,last_weighed_at:null,weight_used:0,slicer_filament:null,slicer_filament_name:null,added_full:null,last_used:null,encode_time:null,category:`Stock`,low_stock_threshold_pct:null,material_number:null};await Z.bulkCreateSpools(i,n.quantity_spools),await Z.removeFromShoppingList(e)}},onSuccess:()=>{c.invalidateQueries({queryKey:[`shopping-list`]}),c.invalidateQueries({queryKey:[`spools`]})}}),p=(0,f.useMemo)(()=>{let e=new Map;for(let n of t)e.set(n.group.key,n);return e},[t]),m=(0,f.useMemo)(()=>e.map(e=>({item:e,forecast:p.get(i9(e.material,e.subtype,e.brand,e.color_name))??null})),[e,p]),h=(0,f.useMemo)(()=>m.filter(({forecast:e})=>!e||e.dailyRateG===null?!1:e.stockBreakAlert||e.daysRemaining!==null&&e.daysRemaining<=e.effectiveLeadTimeDays),[m]);function g(){let t=[s(`forecast.qty`),s(`forecast.material`),s(`inventory.brand`),s(`inventory.subtype`),s(`inventory.color`),`${s(`forecast.weight`)} (g)`,`${s(`forecast.leadTime`)} (d)`,s(`forecast.expectedRestock`),s(`forecast.status`),s(`forecast.note`)],r=e.map(e=>{let t=p.get(i9(e.material,e.subtype,e.brand,e.color_name))??null,r=t&&t.totalSpools>0?t.totalLabelG/t.totalSpools:1e3,i=Math.round(e.quantity_spools*r),a=t?.effectiveLeadTimeDays??n??0,o=a>0?o9(a9(new Date,a)):``;return[e.quantity_spools,e.material,e.brand??``,e.subtype??``,e.color_name??``,i,a||``,o,e.status,e.note??``].map(e=>`"${String(e).replace(/"/g,`""`)}"`).join(`,`)}),i=[t.join(`,`),...r].join(` +`},i)),a}function kQe(e,t){return e&&`run`in e?async function(n,r){let i=OQe(n,{file:r,...t});await e.run(i,r)}:function(n,r){return OQe(n,{file:r,...e||t})}}function AQe(e){if(e)throw e}var jQe=r(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});ft.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var I7={basename:PQe,dirname:FQe,extname:IQe,join:LQe,sep:`/`};function PQe(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);L7(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function FQe(e){if(L7(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function IQe(e){L7(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function LQe(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function zQe(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function L7(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var BQe={cwd:VQe};function VQe(){return`/`}function R7(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function HQe(e){if(typeof e==`string`)e=new URL(e);else if(!R7(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return UQe(e)}function UQe(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n0){let[r,...a]=t,o=n[i][1];F7(o)&&F7(r)&&(r=(0,H7.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function U7(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function W7(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function G7(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function XQe(e){if(!F7(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function ZQe(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function K7(e){return QQe(e)?e:new WQe(e)}function QQe(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function $Qe(e){return typeof e==`string`||e$e(e)}function e$e(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var t$e=[],n$e={allowDangerousHtml:!0},r$e=/^(https?|ircs?|mailto|xmpp)$/i,i$e=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function a$e(e){let t=o$e(e),n=s$e(e);return c$e(t.runSync(t.parse(n),n),e)}function o$e(e){let t=e.rehypePlugins||t$e,n=e.remarkPlugins||t$e,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...n$e}:n$e;return YQe().use(xZe).use(n).use(kQe,r).use(t)}function s$e(e){let t=e.children||``,n=new WQe;return typeof t==`string`?n.value=t:``+t,n}function c$e(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||l$e;for(let e of i$e)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return t.className&&(e={type:`element`,tagName:`div`,properties:{className:t.className},children:e.type===`root`?e.children:[e]}),bQe(e,l),DJe(e,{Fragment:G.Fragment,components:i,ignoreInvalidStyle:!0,jsx:G.jsx,jsxs:G.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in t7)if(Object.hasOwn(t7,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=t7[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function l$e(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||r$e.test(e.slice(0,t))?e:``}y$e.peek=v$e;function u$e(){this.buffer()}function d$e(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function f$e(){this.buffer()}function p$e(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function m$e(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=a7(this.sliceSerialize(e)).toLowerCase(),n.label=t}function h$e(e){this.exit(e)}function g$e(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=a7(this.sliceSerialize(e)).toLowerCase(),n.label=t}function _$e(e){this.exit(e)}function v$e(){return`[`}function y$e(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function b$e(){return{enter:{gfmFootnoteCallString:u$e,gfmFootnoteCall:d$e,gfmFootnoteDefinitionLabelString:f$e,gfmFootnoteDefinition:p$e},exit:{gfmFootnoteCallString:m$e,gfmFootnoteCall:h$e,gfmFootnoteDefinitionLabelString:g$e,gfmFootnoteDefinition:_$e}}}w$e.peek=T$e;function x$e(){return{canContainEols:[`delete`],enter:{strikethrough:S$e},exit:{strikethrough:C$e}}}function S$e(e){this.enter({type:`delete`,children:[]},e)}function C$e(e){this.exit(e)}function w$e(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function T$e(){return`~`}function E$e(){return{enter:{table:D$e,tableData:J7,tableHeader:J7,tableRow:k$e},exit:{codeText:A$e,table:O$e,tableData:q7,tableHeader:q7,tableRow:q7}}}function D$e(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function O$e(e){this.exit(e),this.data.inTable=void 0}function k$e(e){this.enter({type:`tableRow`,children:[]},e)}function q7(e){this.exit(e)}function J7(e){this.enter({type:`tableCell`,children:[]},e)}function A$e(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,j$e));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function j$e(e,t){return t===`|`?t:e}function M$e(){return{exit:{taskListCheckValueChecked:N$e,taskListCheckValueUnchecked:N$e,paragraph:P$e}}}function N$e(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function P$e(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i999||s===93&&!o||s===null||s===91||d7(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(a7(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return d7(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function B$e(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||d7(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=a7(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return d7(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),h7(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function V$e(e,t,n){return e.check(y7,t,e.attempt(F$e,t,n))}function H$e(e){e.exit(`gfmFootnoteDefinition`)}function U$e(e,t,n){let r=this;return h7(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function W$e(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=g7(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var G$e=class{constructor(){this.map=[]}add(e,t,n){K$e(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function K$e(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):u7(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):f7(t)?h7(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||d7(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,f7(t)?h7(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return f7(t)?h7(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||u7(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return f7(t)?h7(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||u7(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||u7(n)?(e.exit(`tableRow`),t(n)):f7(n)?h7(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||d7(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function X$e(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new G$e;for(;++nn[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},X7(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function Z$e(e,t,n,r,i){let a=[],o=X7(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function X7(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var Q$e={name:`tasklistCheck`,tokenize:e1e};function $$e(){return{text:{91:Q$e}}}function e1e(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return d7(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return u7(r)?t(r):f7(r)?e.check({tokenize:t1e},t,n)(r):n(r)}}function t1e(e,t,n){return h7(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function n1e(){let e=this.data(),t=e.micromarkExtensions||=[],n=e.fromMarkdownExtensions||=[];t.push(I$e(),W$e(),J$e(),$$e()),n.push(b$e(),x$e(),E$e(),M$e())}var r1e=`fileManager.readmeCollapsed`;function i1e({folderId:e}){let{t}=U(),[n,r]=(0,f.useState)(()=>localStorage.getItem(r1e)===`1`);(0,f.useEffect)(()=>{localStorage.setItem(r1e,n?`1`:`0`)},[n]);let{data:i,isLoading:a,error:o}=K({queryKey:[`folder-readme`,e],queryFn:()=>Z.getLibraryFolderReadme(e),retry:!1,staleTime:3e4});return a||o||!i?null:n?(0,G.jsxs)(`div`,{className:`mb-2 lg:mb-0 order-first lg:order-none lg:w-10 lg:flex-shrink-0 lg:h-full`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>r(!1),title:t(`fileManager.readme.show`),"aria-label":t(`fileManager.readme.show`),className:`flex lg:hidden w-full items-center gap-2 px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg hover:bg-bambu-dark/40 transition-colors`,children:[(0,G.jsx)(ac,{className:`w-4 h-4 text-bambu-green flex-shrink-0`}),(0,G.jsx)(`span`,{className:`text-sm font-medium text-white truncate`,children:i.filename}),(0,G.jsx)(bl,{className:`w-4 h-4 text-bambu-gray flex-shrink-0 ml-auto`})]}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>r(!1),title:t(`fileManager.readme.show`),"aria-label":t(`fileManager.readme.show`),className:`hidden lg:flex h-full w-10 flex-col items-center gap-2 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg hover:bg-bambu-dark/40 transition-colors`,children:[(0,G.jsx)(bl,{className:`w-4 h-4 text-bambu-green flex-shrink-0`}),(0,G.jsx)(`span`,{className:`text-xs font-medium text-bambu-gray [writing-mode:vertical-rl] rotate-180 select-none`,children:t(`fileManager.readme.label`)})]})]}):(0,G.jsxs)(`div`,{className:`mb-4 lg:mb-0 order-first lg:order-none lg:w-80 xl:w-96 lg:flex-shrink-0 lg:h-full flex flex-col bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,G.jsx)(ac,{className:`w-4 h-4 text-bambu-green flex-shrink-0`}),(0,G.jsx)(`span`,{className:`text-sm font-medium text-white truncate`,title:i.filename,children:i.filename}),i.truncated&&(0,G.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded bg-amber-100 dark:bg-amber-500/20 text-amber-700 dark:text-amber-400 flex-shrink-0`,children:t(`fileManager.readme.truncated`)})]}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>r(!0),title:t(`fileManager.readme.hide`),"aria-label":t(`fileManager.readme.hide`),className:`p-1 rounded text-bambu-gray hover:text-white hover:bg-bambu-dark/40 transition-colors flex-shrink-0`,children:(0,G.jsx)(yl,{className:`w-4 h-4`})})]}),(0,G.jsx)(`div`,{className:`px-4 py-3 border-t border-bambu-dark-tertiary flex-1 overflow-y-auto max-h-96 lg:max-h-none text-sm text-bambu-gray-light leading-relaxed space-y-2`,children:(0,G.jsx)(a$e,{remarkPlugins:[n1e],components:{h1:({children:e})=>(0,G.jsx)(`h1`,{className:`text-lg font-semibold text-white mt-2 mb-1`,children:e}),h2:({children:e})=>(0,G.jsx)(`h2`,{className:`text-base font-semibold text-white mt-2 mb-1`,children:e}),h3:({children:e})=>(0,G.jsx)(`h3`,{className:`text-sm font-semibold text-white mt-2 mb-1`,children:e}),p:({children:e})=>(0,G.jsx)(`p`,{className:`my-1`,children:e}),ul:({children:e})=>(0,G.jsx)(`ul`,{className:`list-disc list-inside space-y-0.5 ml-2`,children:e}),ol:({children:e})=>(0,G.jsx)(`ol`,{className:`list-decimal list-inside space-y-0.5 ml-2`,children:e}),li:({children:e})=>(0,G.jsx)(`li`,{children:e}),code:({children:e,...t})=>t.className?(0,G.jsx)(`code`,{className:`block p-2 bg-bambu-dark rounded text-xs font-mono text-bambu-gray-light overflow-x-auto`,children:e}):(0,G.jsx)(`code`,{className:`px-1 py-0.5 bg-bambu-dark rounded text-xs font-mono text-bambu-green`,children:e}),pre:({children:e})=>(0,G.jsx)(`pre`,{className:`my-2`,children:e}),blockquote:({children:e})=>(0,G.jsx)(`blockquote`,{className:`border-l-2 border-bambu-dark-tertiary pl-3 text-bambu-gray italic`,children:e}),a:({children:e,href:t})=>(0,G.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,className:`text-bambu-green hover:underline`,children:e}),table:({children:e})=>(0,G.jsx)(`div`,{className:`overflow-x-auto`,children:(0,G.jsx)(`table`,{className:`min-w-full text-xs border-collapse`,children:e})}),th:({children:e})=>(0,G.jsx)(`th`,{className:`border border-bambu-dark-tertiary px-2 py-1 text-left font-semibold text-white`,children:e}),td:({children:e})=>(0,G.jsx)(`td`,{className:`border border-bambu-dark-tertiary px-2 py-1`,children:e}),hr:()=>(0,G.jsx)(`hr`,{className:`border-bambu-dark-tertiary my-2`})},children:i.content})})]})}function a1e({open:e,onClose:t,onPickTag:n}){let{t:r}=U(),i=no(),{showToast:a}=qd(),[o,s]=(0,f.useState)(!1),[c,l]=(0,f.useState)(null),[u,d]=(0,f.useState)(``),[p,m]=(0,f.useState)(null),{data:h=[],isLoading:g}=K({queryKey:A5,queryFn:Z.getLibraryTags,enabled:e}),_=()=>{i.invalidateQueries({queryKey:A5}),i.invalidateQueries({queryKey:[`library-files`]})},v=q({mutationFn:async()=>{let e=u.trim();if(!e)throw Error(r(`fileManager.tags.nameRequired`));return c?Z.updateLibraryTag(c.id,e):Z.createLibraryTag(e)},onSuccess:()=>{a(r(c?`fileManager.tags.updated`:`fileManager.tags.created`),`success`),s(!1),l(null),d(``),_()},onError:e=>{a(e.message||r(`fileManager.tags.saveFailed`),`error`)}}),y=q({mutationFn:e=>Z.deleteLibraryTag(e),onSuccess:()=>{a(r(`fileManager.tags.deleted`),`success`),m(null),_()},onError:e=>{a(e.message||r(`fileManager.tags.deleteFailed`),`error`)}}),b=()=>{l(null),d(``),s(!0)},x=e=>{l(e),d(e.name),s(!0)},S=(0,f.useCallback)(()=>{v.isPending||(s(!1),l(null),d(``))},[v.isPending]);(0,f.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&(v.isPending||y.isPending||(o?S():p||t()))};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,o,p,v.isPending,y.isPending,S,t]);let C=e=>{e.preventDefault(),v.mutate()};if(!e)return null;let w=`library-tags-modal-title`,T=`library-tag-editor-title`;return(0,G.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[(0,G.jsx)(`div`,{className:`absolute inset-0 bg-black/60`,onClick:()=>{v.isPending||y.isPending||t()}}),(0,G.jsxs)(`div`,{className:`relative w-full max-w-4xl mx-4 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-xl shadow-2xl max-h-[90vh] flex flex-col`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":w,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-4 px-6 py-4 border-b border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`h2`,{id:w,className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(xu,{className:`w-5 h-5 text-bambu-green`}),r(`fileManager.tags.title`)]}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-sm mt-0.5`,children:r(`fileManager.tags.subtitle`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(Q,{onClick:b,children:[(0,G.jsx)(kl,{className:`w-4 h-4`}),r(`fileManager.tags.add`)]}),(0,G.jsx)(`button`,{type:`button`,className:`p-1.5 text-bambu-gray hover:text-white rounded`,onClick:t,"aria-label":r(`common.close`),children:(0,G.jsx)($u,{className:`w-5 h-5`})})]})]}),(0,G.jsx)(`div`,{className:`overflow-y-auto`,children:g?(0,G.jsxs)(`div`,{className:`flex items-center justify-center py-16 text-bambu-gray`,children:[(0,G.jsx)(Y,{className:`w-6 h-6 animate-spin mr-2`}),r(`common.loading`)]}):h.length===0?(0,G.jsx)(`div`,{className:`py-16 text-center text-bambu-gray`,children:r(`fileManager.tags.empty`)}):(0,G.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary text-left text-bambu-gray`,children:[(0,G.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:r(`fileManager.tags.name`)}),(0,G.jsx)(`th`,{className:`px-4 py-3 font-medium text-right`,children:r(`fileManager.tags.fileCount`)}),(0,G.jsx)(`th`,{className:`px-4 py-3 font-medium text-right w-32`,children:r(`common.actions`)})]})}),(0,G.jsx)(`tbody`,{children:h.map(e=>(0,G.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary/60 hover:bg-bambu-dark-tertiary/30 ${n?`cursor-pointer`:``}`,onClick:()=>{n&&(n(e.id),t())},children:[(0,G.jsx)(`td`,{className:`px-4 py-3 text-white font-medium`,children:e.name}),(0,G.jsx)(`td`,{className:`px-4 py-3 text-right text-bambu-gray`,children:e.file_count}),(0,G.jsx)(`td`,{className:`px-4 py-3 text-right`,onClick:e=>e.stopPropagation(),children:(0,G.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[(0,G.jsx)(`button`,{type:`button`,className:`p-1.5 text-bambu-gray hover:text-bambu-green rounded`,onClick:()=>x(e),title:r(`common.edit`),"aria-label":r(`fileManager.tags.editAria`,{name:e.name}),children:(0,G.jsx)(wl,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{type:`button`,className:`p-1.5 text-bambu-gray hover:text-red-600 dark:hover:text-red-400 rounded`,onClick:()=>m(e),title:r(`common.delete`),"aria-label":r(`fileManager.tags.deleteAria`,{name:e.name}),children:(0,G.jsx)(ju,{className:`w-4 h-4`})})]})})]},e.id))})]})})]}),o&&(0,G.jsxs)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center`,children:[(0,G.jsx)(`div`,{className:`absolute inset-0 bg-black/60`,onClick:S}),(0,G.jsxs)(`div`,{className:`relative w-full max-w-md mx-4 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-xl p-6 shadow-2xl`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":T,children:[(0,G.jsx)(`h3`,{id:T,className:`text-lg font-semibold text-white mb-4`,children:r(c?`fileManager.tags.edit`:`fileManager.tags.add`)}),(0,G.jsxs)(`form`,{onSubmit:C,children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,htmlFor:`library-tag-name`,children:r(`fileManager.tags.name`)}),(0,G.jsx)(`input`,{id:`library-tag-name`,type:`text`,maxLength:64,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green mb-4`,placeholder:r(`fileManager.tags.createPlaceholder`),value:u,onChange:e=>d(e.target.value),autoFocus:!0}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,G.jsx)(Q,{type:`button`,variant:`secondary`,onClick:S,children:r(`common.cancel`)}),(0,G.jsxs)(Q,{type:`submit`,disabled:v.isPending||!u.trim(),children:[v.isPending&&(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),r(`common.save`)]})]})]})]})]}),p&&(0,G.jsx)(af,{title:r(`fileManager.tags.confirmDelete`,{name:p.name}),message:p.file_count>0?r(`fileManager.tags.confirmDeleteInUseMessage`,{count:p.file_count}):r(`fileManager.tags.confirmDeleteMessage`),confirmText:r(`common.delete`),variant:`danger`,isLoading:y.isPending,onConfirm:()=>y.mutate(p.id),onCancel:()=>m(null)})]})}function o1e({file:e,canEdit:t,onClose:n}){let{t:r}=U(),{showToast:i}=qd(),a=no(),{data:o}=K({queryKey:[`library-file`,e.id],queryFn:()=>Z.getLibraryFile(e.id)}),[s,c]=(0,f.useState)(``),[l,u]=(0,f.useState)(``),[d,p]=(0,f.useState)([]),[m,h]=(0,f.useState)(!1),[g,_]=(0,f.useState)(null),v=(0,f.useRef)(null),y=(0,f.useRef)(null);(0,f.useEffect)(()=>{!o||y.current===o.id||(y.current=o.id,c(o.notes??``),u(o.external_url??``),p(o.photos??[]))},[o]),(0,f.useEffect)(()=>{if(g!==null)return;let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[g,n]);let b=()=>{a.invalidateQueries({queryKey:[`library-files`]}),a.invalidateQueries({queryKey:[`library-file`,e.id]})},x=q({mutationFn:()=>Z.updateLibraryFile(e.id,{notes:s,external_url:l.trim()}),onSuccess:()=>{b(),i(r(`fileManager.details.saved`),`success`),n()},onError:()=>{i(r(`fileManager.details.saveFailed`),`error`)}}),S=!!o&&(s!==(o.notes??``)||l.trim()!==(o.external_url??``)),C=async t=>{let n=t.target.files?.[0];if(n){h(!0);try{p((await Z.uploadLibraryFilePhoto(e.id,n)).photos),b()}catch{i(r(`fileManager.details.uploadFailed`),`error`)}finally{h(!1),v.current&&(v.current.value=``)}}},w=async t=>{try{let n=(await Z.deleteLibraryFilePhoto(e.id,t)).photos??[];p(n),n.length===0&&_(null),b()}catch{i(r(`fileManager.details.deleteFailed`),`error`)}},T=e=>{e.preventDefault(),!(!t||!S)&&x.mutate()},E=l.trim(),D=[{label:r(`fileManager.details.size`),value:Gd(e.file_size)},{label:r(`fileManager.details.type`),value:e.file_type.toUpperCase()}];return o?.print_name&&D.push({label:r(`fileManager.details.printName`),value:o.print_name}),o?.print_time_seconds&&D.push({label:r(`fileManager.details.printTime`),value:ap(o.print_time_seconds)}),o?.filament_used_grams&&D.push({label:r(`fileManager.details.filament`),value:`${o.filament_used_grams.toFixed(1)} g`}),o?.sliced_for_model&&D.push({label:r(`fileManager.details.slicedFor`),value:o.sliced_for_model}),o?.source_url&&D.push({label:r(`fileManager.details.source`),value:(0,G.jsxs)(`a`,{href:o.source_url,target:`_blank`,rel:`noopener noreferrer`,className:`text-bambu-green hover:underline inline-flex items-center gap-1 min-w-0`,children:[(0,G.jsx)(`span`,{className:`truncate`,children:o.source_url}),(0,G.jsx)(Xs,{className:`w-3 h-3 flex-shrink-0`})]})}),D.push({label:r(`fileManager.details.created`),value:ep(e.created_at)}),D.push({label:r(`fileManager.details.modified`),value:ep(e.fs_modified_at??o?.updated_at??e.created_at)}),(0,G.jsxs)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,onClick:n,children:[(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary w-full max-w-lg max-h-[90vh] flex flex-col`,onClick:e=>e.stopPropagation(),children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-6 py-4 border-b border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:r(`fileManager.details.title`)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white truncate`,title:e.filename,children:e.filename}),(0,G.jsx)(`span`,{className:`flex-shrink-0 text-xs px-1.5 py-0.5 rounded font-medium bg-bambu-dark-tertiary text-bambu-gray`,children:e.file_type.toUpperCase()})]})]}),(0,G.jsx)(`button`,{type:`button`,onClick:n,className:`text-bambu-gray hover:text-white transition-colors flex-shrink-0`,"aria-label":r(`common.close`),children:(0,G.jsx)($u,{className:`w-5 h-5`})})]}),(0,G.jsxs)(`form`,{onSubmit:T,className:`p-6 space-y-4 overflow-y-auto flex-1`,children:[(0,G.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 text-sm`,children:D.map(e=>(0,G.jsxs)(`div`,{className:`contents`,children:[(0,G.jsx)(`dt`,{className:`text-bambu-gray whitespace-nowrap`,children:e.label}),(0,G.jsx)(`dd`,{className:`text-white min-w-0 truncate`,children:e.value})]},e.label))}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:[(0,G.jsx)(_u,{className:`w-4 h-4 inline mr-1`}),r(`fileManager.details.notes`)]}),(0,G.jsx)(`textarea`,{value:s,onChange:e=>c(e.target.value),rows:3,disabled:!t,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none resize-none disabled:opacity-60`,placeholder:r(`fileManager.details.notesPlaceholder`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:[(0,G.jsx)(Gc,{className:`w-4 h-4 inline mr-1`}),r(`fileManager.details.externalLink`)]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{type:`url`,value:l,onChange:e=>u(e.target.value),disabled:!t,className:`flex-1 min-w-0 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none disabled:opacity-60`,placeholder:r(`fileManager.details.externalLinkPlaceholder`)}),E&&(0,G.jsx)(`a`,{href:E,target:`_blank`,rel:`noopener noreferrer`,className:`p-2 rounded-lg text-bambu-gray hover:text-bambu-green hover:bg-bambu-dark transition-colors`,title:r(`fileManager.details.openLink`),"aria-label":r(`fileManager.details.openLink`),children:(0,G.jsx)(Xs,{className:`w-4 h-4`})})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:[(0,G.jsx)($o,{className:`w-4 h-4 inline mr-1`}),r(`fileManager.details.photos`)]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[d.map((n,i)=>(0,G.jsxs)(`div`,{className:`relative group`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>_(i),className:`block w-20 h-20 rounded-lg overflow-hidden border border-bambu-dark-tertiary hover:border-bambu-green transition-colors`,children:(0,G.jsx)(`img`,{src:Z.getLibraryFilePhotoUrl(e.id,n),alt:r(`fileManager.details.photos`),className:`w-full h-full object-cover`})}),t&&(0,G.jsx)(`button`,{type:`button`,onClick:()=>w(n),className:`absolute -top-1 -right-1 p-1 bg-red-500 rounded-full can-hover:opacity-0 group-hover:opacity-100 focus-visible:opacity-100 transition-opacity`,title:r(`fileManager.details.deletePhoto`),"aria-label":r(`fileManager.details.deletePhoto`),children:(0,G.jsx)(ju,{className:`w-3 h-3 text-white`})})]},n)),t&&(0,G.jsxs)(`label`,{className:`w-20 h-20 flex items-center justify-center border-2 border-dashed border-bambu-dark-tertiary rounded-lg cursor-pointer hover:border-bambu-green transition-colors`,title:r(`fileManager.details.addPhoto`),children:[(0,G.jsx)(`input`,{ref:v,type:`file`,accept:`image/jpeg,image/png,image/webp`,onChange:C,className:`hidden`,disabled:m,"aria-label":r(`fileManager.details.addPhoto`)}),m?(0,G.jsx)(Y,{className:`w-6 h-6 text-bambu-gray animate-spin`}):(0,G.jsx)(kl,{className:`w-6 h-6 text-bambu-gray`})]}),d.length===0&&!t&&(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:r(`fileManager.details.noPhotos`)})]})]}),(0,G.jsxs)(`div`,{className:`flex gap-3 pt-2`,children:[(0,G.jsx)(Q,{type:`button`,variant:`secondary`,onClick:n,className:`flex-1`,children:r(`common.close`)}),t&&(0,G.jsxs)(Q,{type:`submit`,variant:`primary`,className:`flex-1`,disabled:!S||x.isPending,children:[x.isPending?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(Vl,{className:`w-4 h-4`}),r(`fileManager.details.save`)]})]})]})]}),g!==null&&d.length>0&&(0,G.jsx)(XW,{archiveName:e.filename,photos:d,initialIndex:g,getPhotoUrl:t=>Z.getLibraryFilePhotoUrl(e.id,t),onClose:()=>_(null),onDelete:t?w:void 0})]})}var s1e=90;function c1e({onClose:e}){let{t}=U(),n=no(),{showToast:r}=qd(),[i,a]=(0,f.useState)(s1e),[o,s]=(0,f.useState)(!0),[c,l]=(0,f.useState)(i);(0,f.useEffect)(()=>{let e=window.setTimeout(()=>l(i),300);return()=>window.clearTimeout(e)},[i]);let u=K({queryKey:[`library-purge-preview`,c,o],queryFn:()=>Z.previewLibraryPurge(c,o),enabled:c>=1}),d=q({mutationFn:()=>Z.executeLibraryPurge(i,o),onSuccess:i=>{r(t(`libraryPurge.toast.success`,{count:i.moved_to_trash}),`success`),n.invalidateQueries({queryKey:[`library-files`]}),n.invalidateQueries({queryKey:[`library-folders`]}),n.invalidateQueries({queryKey:[`library-trash`]}),n.invalidateQueries({queryKey:[`library-trash-count`]}),e()},onError:e=>r(e.message||t(`libraryPurge.toast.failed`),`error`)});(0,f.useEffect)(()=>{let t=t=>{t.key===`Escape`&&!d.isPending&&e()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,d.isPending]);let p=u.data,m=p?.count??0,h=p?.total_bytes??0,g=m>0&&!d.isPending;return(0,G.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4`,children:(0,G.jsxs)(`div`,{className:`bg-white dark:bg-gray-900 rounded-lg shadow-xl max-w-lg w-full`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700`,children:[(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-gray-900 dark:text-gray-100 flex items-center gap-2`,children:[(0,G.jsx)(ju,{className:`w-5 h-5`}),t(`libraryPurge.title`)]}),(0,G.jsx)(`button`,{onClick:e,className:`text-gray-400 hover:text-gray-600 dark:hover:text-gray-200`,"aria-label":t(`common.close`),disabled:d.isPending,children:(0,G.jsx)($u,{className:`w-5 h-5`})})]}),(0,G.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,G.jsx)(`p`,{className:`text-sm text-gray-600 dark:text-gray-400`,children:t(`libraryPurge.description`)}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{htmlFor:`purge-days`,className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:t(`libraryPurge.ageLabel`)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`input`,{id:`purge-days`,type:`number`,min:1,max:3650,value:i,onChange:e=>a(Math.max(1,Math.min(3650,parseInt(e.target.value||`0`,10)||0))),className:`w-24 rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-sm px-2 py-1 text-gray-900 dark:text-gray-100`}),(0,G.jsx)(`span`,{className:`text-sm text-gray-600 dark:text-gray-400`,children:t(`libraryPurge.days`)})]})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-gray-700 dark:text-gray-300`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>s(e.target.checked),className:`rounded border-gray-300`}),t(`libraryPurge.includeNeverPrinted`)]}),(0,G.jsxs)(`div`,{className:`rounded border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/30 p-3`,children:[(0,G.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-wide text-gray-600 dark:text-gray-300 mb-2`,children:t(`libraryPurge.effectsTitle`)}),(0,G.jsxs)(`ul`,{className:`text-xs text-gray-700 dark:text-gray-300 space-y-1 list-disc pl-4`,children:[(0,G.jsx)(`li`,{children:t(`libraryPurge.effect1`)}),(0,G.jsx)(`li`,{children:t(`libraryPurge.effect2`)}),(0,G.jsx)(`li`,{children:t(`libraryPurge.effect3`)}),(0,G.jsx)(`li`,{children:t(`libraryPurge.effect4`)})]})]}),(0,G.jsx)(`div`,{className:`rounded border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50 p-3`,children:u.isLoading||u.isFetching?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-gray-500 dark:text-gray-400`,children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),` `,t(`libraryPurge.previewLoading`)]}):u.isError?(0,G.jsx)(`div`,{className:`text-sm text-red-600 dark:text-red-400`,children:u.error?.message??t(`libraryPurge.previewFailed`)}):(0,G.jsxs)(`div`,{className:`text-sm text-gray-900 dark:text-gray-100`,children:[(0,G.jsx)(`div`,{className:`font-medium`,children:t(`libraryPurge.previewSummary`,{count:m,size:Gd(h)})}),p?.sample_filenames&&p.sample_filenames.length>0&&(0,G.jsxs)(`ul`,{className:`mt-2 text-xs text-gray-600 dark:text-gray-400 space-y-0.5 list-disc pl-4`,children:[p.sample_filenames.map(e=>(0,G.jsx)(`li`,{className:`truncate`,children:e},e)),m>p.sample_filenames.length&&(0,G.jsx)(`li`,{className:`list-none italic text-gray-500`,children:t(`libraryPurge.andMore`,{count:m-p.sample_filenames.length})})]})]})}),(0,G.jsxs)(`div`,{className:`flex gap-2 items-start text-xs text-amber-700 dark:text-amber-400 bg-amber-50 dark:bg-amber-900/20 rounded px-3 py-2`,children:[(0,G.jsx)(Pu,{className:`w-4 h-4 mt-0.5 shrink-0`}),(0,G.jsx)(`span`,{children:t(`libraryPurge.warning`)})]})]}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-2 p-4 border-t border-gray-200 dark:border-gray-700`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:e,disabled:d.isPending,children:t(`common.cancel`)}),(0,G.jsx)(Q,{variant:`danger`,disabled:!g,onClick:()=>d.mutate(),children:d.isPending?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin mr-1`}),t(`libraryPurge.purging`)]}):t(`libraryPurge.confirmCta`,{count:m})})]})]})})}var l1e=(0,f.lazy)(()=>Dt(()=>import(`./PdfPreviewModal-B_LYIkkC.js`).then(e=>({default:e.PdfPreviewModal})),__vite__mapDeps([0,1]))),u1e=(0,f.lazy)(()=>Dt(()=>import(`./SpreadsheetPreviewModal-BEobv_FV.js`).then(e=>({default:e.SpreadsheetPreviewModal})),__vite__mapDeps([2,1]))),d1e=(0,f.lazy)(()=>Dt(()=>import(`./ImagePreviewModal-yOK-BUmg.js`).then(e=>({default:e.ImagePreviewModal})),__vite__mapDeps([3,1])));function Z7(e){return e===`csv`||e===`xlsx`||e===`ods`}function Q7(e){return e===`step`||e===`stp`}var f1e=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`,`tiff`,`tif`]),p1e=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`]);function m1e(e){return f1e.has(e.toLowerCase())}function h1e(e){return p1e.has(e.toLowerCase())}function $7(e){let t=e.file_type;return T5(e)||t===`3mf`||t===`stl`||Q7(t)||t===`pdf`||Z7(t)||h1e(t)}var e9={onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation()};function t9(e){return T5(e)||e.file_type===`3mf`||e.file_type===`stl`||Q7(e.file_type)}function g1e(e){return e===`pdf`?(0,G.jsx)(ac,{className:`w-4 h-4`}):Z7(e)?(0,G.jsx)(ic,{className:`w-4 h-4`}):(0,G.jsx)(Ic,{className:`w-4 h-4`})}function _1e(e){return e===`stl`||e===`pdf`}function v1e({parentId:e,onClose:t,onSave:n,isLoading:r,t:i}){let[a,o]=(0,f.useState)(``);return(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,children:(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg w-full max-w-sm border border-bambu-dark-tertiary`,children:[(0,G.jsx)(`div`,{className:`p-4 border-b border-bambu-dark-tertiary`,children:(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:i(`fileManager.newFolder`)})}),(0,G.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),n({name:a.trim(),parent_id:e})},className:`p-4 space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-white mb-1`,children:i(`fileManager.folderName`)}),(0,G.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),className:`w-full bg-bambu-dark border border-bambu-dark-tertiary rounded px-3 py-2 text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green`,placeholder:i(`fileManager.folderNamePlaceholder`),autoFocus:!0,required:!0})]}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-2 pt-2`,children:[(0,G.jsx)(Q,{type:`button`,variant:`secondary`,onClick:t,children:i(`common.cancel`)}),(0,G.jsx)(Q,{type:`submit`,disabled:!a.trim()||r,children:r?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):i(`common.create`)})]})]})]})})}function y1e({onClose:e,onSave:t,isLoading:n,t:r}){let[i,a]=(0,f.useState)(``),[o,s]=(0,f.useState)(``),[c,l]=(0,f.useState)(!0),[u,d]=(0,f.useState)(!1);return(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,children:(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg w-full max-w-md border border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{className:`p-4 border-b border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(pc,{className:`w-5 h-5 text-bambu-green`}),r(`fileManager.linkExternalFolder`)]}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:r(`fileManager.linkExternalFolderDescription`)})]}),(0,G.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),t({name:i.trim(),external_path:o.trim(),readonly:c,show_hidden:u})},className:`p-4 space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-white mb-1`,children:r(`fileManager.folderName`)}),(0,G.jsx)(`input`,{type:`text`,value:i,onChange:e=>a(e.target.value),className:`w-full bg-bambu-dark border border-bambu-dark-tertiary rounded px-3 py-2 text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green`,placeholder:r(`fileManager.externalFolderNamePlaceholder`),autoFocus:!0,required:!0})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-white mb-1`,children:r(`fileManager.externalPath`)}),(0,G.jsx)(`input`,{type:`text`,value:o,onChange:e=>s(e.target.value),className:`w-full bg-bambu-dark border border-bambu-dark-tertiary rounded px-3 py-2 text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green font-mono text-sm`,placeholder:`/mnt/nas/3d-prints`,required:!0}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:r(`fileManager.externalPathHelp`)})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:c,onChange:e=>l(e.target.checked),className:`rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green`}),(0,G.jsx)(`span`,{className:`text-sm text-white`,children:r(`fileManager.readOnly`)}),(0,G.jsxs)(`span`,{className:`text-xs text-bambu-gray`,children:[`(`,r(`fileManager.readOnlyHelp`),`)`]})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:u,onChange:e=>d(e.target.checked),className:`rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green`}),(0,G.jsx)(`span`,{className:`text-sm text-white`,children:r(`fileManager.showHiddenFiles`)})]})]}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-2 pt-2`,children:[(0,G.jsx)(Q,{type:`button`,variant:`secondary`,onClick:e,children:r(`common.cancel`)}),(0,G.jsx)(Q,{type:`submit`,disabled:!i.trim()||!o.trim()||n,children:n?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):r(`fileManager.linkFolder`)})]})]})]})})}var b1e=`<>:"/\\|?*`;function x1e(e){for(let t of e)if(b1e.includes(t)||t.charCodeAt(0)<32)return t;return null}function S1e({type:e,currentName:t,onClose:n,onSave:r,isLoading:i,t:a}){let o=e===`file`?t.match(/(\.gcode\.3mf|\.3mf|\.gcode)$/i)?.[1]??``:``,s=e===`file`&&o?t.slice(0,-o.length):t,[c,l]=(0,f.useState)(s),u=e===`file`?x1e(c):null,d=u?a(`fileManager.invalidFilenameChar`,{char:u}):null;return(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,children:(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg w-full max-w-sm border border-bambu-dark-tertiary`,children:[(0,G.jsx)(`div`,{className:`p-4 border-b border-bambu-dark-tertiary`,children:(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:a(e===`file`?`fileManager.renameFile`:`fileManager.renameFolder`)})}),(0,G.jsxs)(`form`,{onSubmit:n=>{if(n.preventDefault(),d)return;let i=e===`file`?c.trim()+o:c.trim();c.trim()&&i!==t&&r(i)},className:`p-4 space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-white mb-1`,children:a(`common.name`)}),(0,G.jsxs)(`div`,{className:`flex items-center bg-bambu-dark border rounded focus-within:border-bambu-green ${d?`border-red-500`:`border-bambu-dark-tertiary`}`,children:[(0,G.jsx)(`input`,{type:`text`,value:c,onChange:e=>l(e.target.value),className:`flex-1 bg-transparent px-3 py-2 text-white placeholder-bambu-gray focus:outline-none min-w-0`,autoFocus:!0,required:!0}),o&&(0,G.jsx)(`span`,{className:`pr-3 text-bambu-gray text-sm select-none whitespace-nowrap`,children:o})]}),d&&(0,G.jsx)(`p`,{className:`mt-1 text-xs text-red-700 dark:text-red-400`,children:d})]}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-2 pt-2`,children:[(0,G.jsx)(Q,{type:`button`,variant:`secondary`,onClick:n,children:a(`common.cancel`)}),(0,G.jsx)(Q,{type:`submit`,disabled:!c.trim()||c.trim()===s||!!d||i,children:i?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):a(`common.rename`)})]})]})]})})}function C1e({folders:e,selectedFiles:t,currentFolderId:n,onClose:r,onMove:i,isLoading:a,t:o}){let[s,c]=(0,f.useState)(null),l=(e,t=0)=>{let n=[];for(let r of e)n.push({id:r.id,name:r.name,depth:t}),r.children.length>0&&n.push(...l(r.children,t+1));return n},u=[{id:null,name:o(`fileManager.rootNoFolder`),depth:0},...l(e)];return(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,children:(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg w-full max-w-sm border border-bambu-dark-tertiary`,children:[(0,G.jsx)(`div`,{className:`p-4 border-b border-bambu-dark-tertiary`,children:(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:o(`fileManager.moveFiles`,{count:t.length})})}),(0,G.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,G.jsx)(`div`,{className:`max-h-64 overflow-y-auto space-y-1`,children:u.map(e=>(0,G.jsxs)(`button`,{onClick:()=>c(e.id),disabled:e.id===n,className:`w-full text-left px-3 py-2 rounded transition-colors flex items-center gap-2 ${s===e.id?`bg-bambu-green/20 text-bambu-green`:e.id===n?`opacity-50 cursor-not-allowed text-bambu-gray`:`hover:bg-bambu-dark text-white`}`,style:{paddingLeft:`${12+e.depth*16}px`},children:[(0,G.jsx)(dc,{className:`w-4 h-4`}),e.name,e.id===n&&(0,G.jsxs)(`span`,{className:`text-xs text-bambu-gray ml-auto`,children:[`(`,o(`fileManager.current`),`)`]})]},e.id??`root`))}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-2 pt-2`,children:[(0,G.jsx)(Q,{type:`button`,variant:`secondary`,onClick:r,children:o(`common.cancel`)}),(0,G.jsx)(Q,{onClick:()=>i(s),disabled:a,children:a?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):o(`common.move`)})]})]})]})})}function w1e({folder:e,onClose:t,onLink:n,isLoading:r,t:i}){let[a,o]=(0,f.useState)(`project`),[s,c]=(0,f.useState)(e.project_id||e.archive_id||null);(0,f.useState)(()=>{e.archive_id&&o(`archive`)});let{data:l}=K({queryKey:[`projects`],queryFn:()=>Z.getProjects(),select:t=>Jp([...t].sort((e,t)=>e.name.localeCompare(t.name)),e.project_id)}),{data:u}=K({queryKey:[`archives-for-link`],queryFn:()=>Z.getArchives(void 0,void 0,100)}),d=()=>{n(a===`project`?{project_id:s,archive_id:0}:{project_id:0,archive_id:s})},p=()=>{n({project_id:0,archive_id:0})},m=e.project_id||e.archive_id;return(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,children:(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg w-full max-w-md border border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{className:`p-4 border-b border-bambu-dark-tertiary flex items-center justify-between`,children:[(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(Wc,{className:`w-5 h-5 text-bambu-green`}),i(`fileManager.linkFolder`)]}),(0,G.jsx)(`button`,{onClick:t,className:`p-1 hover:bg-bambu-dark rounded`,children:(0,G.jsx)($u,{className:`w-5 h-5 text-bambu-gray`})})]}),(0,G.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i(`fileManager.linkFolderDescription`,{name:e.name})}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsxs)(`button`,{onClick:()=>{o(`project`),c(null)},className:`flex-1 flex items-center justify-center gap-2 px-3 py-2 rounded-lg border transition-colors ${a===`project`?`border-bambu-green bg-bambu-green/10 text-bambu-green`:`border-bambu-dark-tertiary text-bambu-gray hover:text-white`}`,children:[(0,G.jsx)(Ko,{className:`w-4 h-4`}),i(`fileManager.project`)]}),(0,G.jsxs)(`button`,{onClick:()=>{o(`archive`),c(null)},className:`flex-1 flex items-center justify-center gap-2 px-3 py-2 rounded-lg border transition-colors ${a===`archive`?`border-bambu-green bg-bambu-green/10 text-bambu-green`:`border-bambu-dark-tertiary text-bambu-gray hover:text-white`}`,children:[(0,G.jsx)(Oo,{className:`w-4 h-4`}),i(`fileManager.archive`)]})]}),(0,G.jsx)(`div`,{className:`max-h-64 overflow-y-auto space-y-1 bg-bambu-dark rounded-lg p-2`,children:a===`project`?l&&l.length>0?l.map(e=>(0,G.jsxs)(`button`,{onClick:()=>c(e.id),className:`w-full text-left px-3 py-2 rounded transition-colors flex items-center gap-2 ${s===e.id?`bg-bambu-green/20 text-bambu-green`:`hover:bg-bambu-dark-tertiary text-white`}`,children:[(0,G.jsx)(`div`,{className:`w-3 h-3 rounded-full flex-shrink-0`,style:{backgroundColor:e.color||`#00ae42`}}),(0,G.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id)):(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray text-center py-4`,children:i(`fileManager.noProjectsFound`)}):u&&u.length>0?u.map(e=>(0,G.jsxs)(`button`,{onClick:()=>c(e.id),className:`w-full text-left px-3 py-2 rounded transition-colors flex items-center gap-2 ${s===e.id?`bg-bambu-green/20 text-bambu-green`:`hover:bg-bambu-dark-tertiary text-white`}`,children:[(0,G.jsx)(ec,{className:`w-4 h-4 text-bambu-gray flex-shrink-0`}),(0,G.jsx)(`span`,{className:`truncate`,children:e.print_name||e.filename})]},e.id)):(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray text-center py-4`,children:i(`fileManager.noArchivesFound`)})})]}),(0,G.jsxs)(`div`,{className:`p-4 border-t border-bambu-dark-tertiary flex justify-between`,children:[m&&(0,G.jsxs)(Q,{variant:`danger`,onClick:p,disabled:r,children:[(0,G.jsx)(Lu,{className:`w-4 h-4 mr-2`}),i(`fileManager.unlink`)]}),(0,G.jsxs)(`div`,{className:`flex gap-2 ${m?``:`ml-auto`}`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:t,children:i(`common.cancel`)}),(0,G.jsx)(Q,{onClick:d,disabled:!s||r,children:r?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):i(`fileManager.link`)})]})]})]})})}function T1e({folder:e,selectedFolderId:t,onSelect:n,onDelete:r,onLink:i,onRename:a,depth:o=0,wrapNames:s=!1,defaultExpanded:c=!0,showModified:l=!1,hasPermission:u,t:d}){let[p,m]=(0,f.useState)(c),[h,g]=(0,f.useState)(!1),_=e.children.length>0,v=e.project_id||e.archive_id,y=e.is_external,b=u(`library:delete_all`)||u(`library:delete_own`)&&e.file_count===0&&!_&&!y&&!v,x=b?void 0:u(`library:delete_own`)&&!y&&!v?d(`fileManager.onlyEmptyFoldersDeletable`):d(`fileManager.noPermissionDeleteFolder`);return(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`group flex items-center gap-1 px-2 py-1.5 rounded cursor-pointer transition-colors ${t===e.id?`bg-bambu-green/20 text-bambu-green`:`hover:bg-bambu-dark text-white`}`,style:{paddingLeft:`${8+o*12}px`},onClick:()=>n(e.id),children:[_?(0,G.jsx)(`button`,{onClick:e=>{e.stopPropagation(),m(!p)},className:`p-0.5 hover:bg-bambu-dark-tertiary rounded`,children:(0,G.jsx)(ss,{className:`w-3.5 h-3.5 transition-transform ${p?`rotate-90`:``}`})}):(0,G.jsx)(`div`,{className:`w-4.5`}),y?(0,G.jsx)(pc,{className:`w-4 h-4 text-purple-600 dark:text-purple-400 flex-shrink-0`}):(0,G.jsx)(dc,{className:`w-4 h-4 text-bambu-green flex-shrink-0`}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`span`,{className:`block text-sm ${s?`break-all`:`truncate`}`,title:e.name,children:e.name}),l&&e.latest_activity_at&&(0,G.jsxs)(`span`,{className:`mt-0.5 flex items-center gap-1 text-xs text-bambu-gray`,title:d(`fileManager.lastActivity`),children:[(0,G.jsx)(Zo,{className:`w-3 h-3 flex-shrink-0`}),(0,G.jsx)(`span`,{className:`truncate`,children:ep(e.latest_activity_at)})]})]}),v&&(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),i(e)},className:`flex-shrink-0 flex items-center gap-1 text-xs px-1.5 py-0.5 rounded bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400 hover:bg-blue-200 dark:hover:bg-blue-500/30 transition-colors`,title:`${e.project_name?`Project: ${e.project_name}`:`Archive: ${e.archive_name}`} (click to change)`,children:[(0,G.jsx)(Wc,{className:`w-3 h-3`}),e.project_name?(0,G.jsx)(Ko,{className:`w-3 h-3`}):(0,G.jsx)(Oo,{className:`w-3 h-3`})]}),y&&e.external_readonly&&(0,G.jsx)(`span`,{title:d(`fileManager.readOnly`),children:(0,G.jsx)(Xc,{className:`w-3 h-3 text-amber-600 dark:text-amber-400 flex-shrink-0`})}),e.file_count>0&&(0,G.jsx)(`span`,{className:`flex-shrink-0 text-xs text-bambu-gray`,children:e.file_count}),!v&&!y&&(0,G.jsx)(`button`,{onClick:t=>{t.stopPropagation(),i(e)},className:`flex-shrink-0 p-1 rounded hover:bg-bambu-dark-tertiary`,title:d(`fileManager.linkToProjectOrArchive`),children:(0,G.jsx)(Wc,{className:`w-3.5 h-3.5 text-bambu-gray hover:text-bambu-green`})}),(0,G.jsx)(`div`,{className:`flex-shrink-0 flex items-center gap-0.5 transition-opacity ${s?``:`can-hover:opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`}`,onClick:e=>e.stopPropagation(),children:(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(`button`,{onClick:()=>g(!h),className:`p-1 rounded hover:bg-bambu-dark-tertiary`,children:(0,G.jsx)(Ks,{className:`w-3.5 h-3.5 text-bambu-gray`})}),h&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`fixed inset-0 z-10`,onClick:()=>g(!1)}),(0,G.jsxs)(`div`,{className:`absolute right-0 top-full mt-1 z-20 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl py-1 min-w-[120px]`,children:[(0,G.jsxs)(`button`,{className:`w-full px-3 py-1.5 text-left text-sm flex items-center gap-2 ${u(`library:update_all`)?`text-white hover:bg-bambu-dark`:`text-bambu-gray cursor-not-allowed`}`,onClick:()=>{u(`library:update_all`)&&(a(e),g(!1))},disabled:!u(`library:update_all`),title:u(`library:update_all`)?void 0:d(`fileManager.noPermissionRenameFolder`),children:[(0,G.jsx)(wl,{className:`w-3.5 h-3.5`}),d(`common.rename`)]}),(0,G.jsxs)(`button`,{className:`w-full px-3 py-1.5 text-left text-sm flex items-center gap-2 ${u(`library:update_all`)?`text-white hover:bg-bambu-dark`:`text-bambu-gray cursor-not-allowed`}`,onClick:()=>{u(`library:update_all`)&&(i(e),g(!1))},disabled:!u(`library:update_all`),title:u(`library:update_all`)?void 0:d(`fileManager.noPermissionLinkFolder`),children:[(0,G.jsx)(Wc,{className:`w-3.5 h-3.5`}),d(v?`fileManager.changeLink`:`fileManager.linkTo`)]}),(0,G.jsxs)(`button`,{className:`w-full px-3 py-1.5 text-left text-sm flex items-center gap-2 ${b?`text-red-700 dark:text-red-400 hover:bg-bambu-dark`:`text-bambu-gray cursor-not-allowed`}`,onClick:()=>{b&&(r(e.id),g(!1))},disabled:!b,title:x,children:[(0,G.jsx)(ju,{className:`w-3.5 h-3.5`}),d(`common.delete`)]})]})]})]})})]}),_&&p&&(0,G.jsx)(`div`,{children:e.children.map(e=>(0,G.jsx)(T1e,{folder:e,selectedFolderId:t,onSelect:n,onDelete:r,onLink:i,onRename:a,depth:o+1,wrapNames:s,defaultExpanded:c,showModified:l,hasPermission:u,t:d},e.id))})]})}function E1e({file:e,isSelected:t,onSelect:n,onDelete:r,onDownload:i,onPrint:a,onSlice:o,onOpenInSlicer:s,onRunPipeline:c,useSlicerApi:l,desktopSlicer:u,canSlice:d,onPreview:p,onRename:m,onDetails:h,onGenerateThumbnail:g,onTagClick:_,thumbnailVersion:v,hasPermission:y,canModify:b,authEnabled:x,showModified:S,t:C}){let[w,T]=(0,f.useState)(null),E=y(`library:read`),D=b(`library`,`update`,e.created_by_id),O=b(`library`,`delete`,e.created_by_id),k=[];if(a&&T5(e)&&k.push({label:C(`common.print`),icon:(0,G.jsx)(Ml,{className:`w-4 h-4 text-bambu-green`}),onClick:()=>a(e),disabled:!y(`queue:create`),title:y(`queue:create`)?void 0:C(`fileManager.noPermissionAddToQueue`)}),E5(e,!!l,u)&&(l?o:s)&&k.push({label:C(`slice.action`),icon:l?(0,G.jsx)(js,{className:`w-4 h-4`}):(0,G.jsx)(Xs,{className:`w-4 h-4`}),onClick:()=>{l?o?.(e):s?.(e)},disabled:!d,title:d?void 0:C(l?`fileManager.noPermissionSlice`:`fileManager.noPermissionDownload`)}),c&&l&&E5(e,!0,u)&&k.push({label:C(`library.runWithPipeline.actionLabel`),icon:(0,G.jsx)(Dl,{className:`w-4 h-4`}),onClick:()=>c(e),disabled:!y(`pipelines:run`),title:y(`pipelines:run`)?void 0:C(`library.runWithPipeline.noPermission`)}),p&&$7(e)){let t=t9(e);k.push({label:C(t?`fileManager.preview3d`:`fileManager.preview.open`),icon:t?(0,G.jsx)(Go,{className:`w-4 h-4`}):g1e(e.file_type),onClick:()=>p(e),disabled:!E,title:E?void 0:C(`fileManager.noPermissionPreview`)})}return k.push({label:C(`common.download`),icon:(0,G.jsx)(Us,{className:`w-4 h-4`}),onClick:()=>i(e.id),disabled:!y(`library:read`),title:y(`library:read`)?void 0:C(`fileManager.noPermissionDownload`)}),m&&k.push({label:C(`common.rename`),icon:(0,G.jsx)(wl,{className:`w-4 h-4`}),onClick:()=>m(e),disabled:!D,title:D?void 0:C(`fileManager.noPermissionRenameFile`)}),h&&k.push({label:C(`fileManager.details.title`),icon:(0,G.jsx)(Rc,{className:`w-4 h-4`}),onClick:()=>h(e),disabled:!E,title:E?void 0:C(`fileManager.noPermissionPreview`)}),e.external_url&&k.push({label:C(`fileManager.details.openLink`),icon:(0,G.jsx)(Cc,{className:`w-4 h-4`}),onClick:()=>window.open(e.external_url,`_blank`,`noopener,noreferrer`)}),g&&_1e(e.file_type)&&k.push({label:C(`fileManager.generateThumbnail`),icon:(0,G.jsx)(Ic,{className:`w-4 h-4`}),onClick:()=>g(e),disabled:!D,title:D?void 0:C(`fileManager.noPermissionGenerateThumbnail`)}),k.push({label:C(`common.delete`),icon:(0,G.jsx)(ju,{className:`w-4 h-4`}),onClick:()=>r(e.id),danger:!0,disabled:!O,title:O?void 0:C(`fileManager.noPermissionDeleteFile`)}),(0,G.jsxs)(`div`,{className:`group relative bg-bambu-dark-secondary rounded-lg border transition-all cursor-pointer ${t?`border-bambu-green ring-1 ring-bambu-green`:`border-bambu-dark-tertiary hover:border-bambu-green/50`}`,onClick:()=>n(e.id),onDoubleClick:()=>p?.(e),children:[(0,G.jsxs)(`div`,{className:`aspect-square bg-bambu-dark flex items-center justify-center overflow-hidden rounded-t-lg`,children:[e.thumbnail_path?(0,G.jsx)(`img`,{src:`${Z.getLibraryFileThumbnailUrl(e.id)}${v?(Z.getLibraryFileThumbnailUrl(e.id).includes(`?`)?`&`:`?`)+`v=${v}`:``}`,alt:e.filename,className:`w-full h-full object-cover`}):e.file_type===`pdf`?(0,G.jsx)(ac,{className:`w-12 h-12 text-bambu-gray/30`}):Z7(e.file_type)?(0,G.jsx)(ic,{className:`w-12 h-12 text-bambu-gray/30`}):m1e(e.file_type)?(0,G.jsx)(Ic,{className:`w-12 h-12 text-bambu-gray/30`}):(0,G.jsx)(ec,{className:`w-12 h-12 text-bambu-gray/30`}),(0,G.jsx)(`div`,{className:`absolute top-2 right-2 text-xs px-1.5 py-0.5 rounded font-medium ${e.file_type===`3mf`?`bg-bambu-green/90 text-white`:e.file_type===`gcode`||e.file_type===`gcode.3mf`?`bg-blue-500/90 text-white`:e.file_type===`stl`?`bg-purple-500/90 text-white`:Q7(e.file_type)?`bg-amber-500/90 text-white`:e.file_type===`pdf`?`bg-red-500/90 text-white`:Z7(e.file_type)?`bg-teal-500/90 text-white`:`bg-bambu-gray/90 text-white`}`,children:e.file_type.toUpperCase()})]}),(0,G.jsxs)(`div`,{className:`p-3`,children:[(0,G.jsx)(`h3`,{className:`text-sm font-medium text-white truncate`,title:e.print_name||e.filename,children:e.print_name||e.filename}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 mt-1 text-xs text-bambu-gray`,children:[(0,G.jsx)(`span`,{children:Gd(e.file_size)}),e.print_time_seconds&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(ws,{className:`w-3 h-3`}),ap(e.print_time_seconds)]})]}),e.sliced_for_model&&(0,G.jsxs)(`div`,{className:`mt-1 text-xs text-bambu-gray flex items-center gap-1`,children:[(0,G.jsx)(Ml,{className:`w-3 h-3`}),e.sliced_for_model]}),(e.variant_count??0)>1&&(0,G.jsxs)(`div`,{className:`mt-1 text-xs text-bambu-green flex items-center gap-1`,children:[(0,G.jsx)(Hc,{className:`w-3 h-3`}),C(`fileManager.variants.badge`,{count:e.variant_count})]}),e.print_count>0&&(0,G.jsx)(`div`,{className:`mt-1 text-xs text-bambu-green`,children:C(`fileManager.printedCount`,{count:e.print_count})}),(e.external_url||e.has_notes||(e.photo_count??0)>0)&&(0,G.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-bambu-gray`,...e9,children:[e.external_url&&(0,G.jsx)(`a`,{href:e.external_url,target:`_blank`,rel:`noopener noreferrer`,className:`p-0.5 rounded hover:text-bambu-green`,title:C(`fileManager.details.openLink`),"aria-label":C(`fileManager.details.openLink`),children:(0,G.jsx)(Cc,{className:`w-3.5 h-3.5`})}),e.has_notes&&(0,G.jsx)(`button`,{type:`button`,onClick:()=>h?.(e),className:`p-0.5 rounded hover:text-bambu-green`,title:C(`fileManager.details.hasNotes`),"aria-label":C(`fileManager.details.hasNotes`),children:(0,G.jsx)(_u,{className:`w-3.5 h-3.5`})}),(e.photo_count??0)>0&&(0,G.jsxs)(`button`,{type:`button`,onClick:()=>h?.(e),className:`flex items-center gap-0.5 p-0.5 rounded hover:text-bambu-green`,title:C(`fileManager.details.photoCount`,{count:e.photo_count}),"aria-label":C(`fileManager.details.photoCount`,{count:e.photo_count}),children:[(0,G.jsx)($o,{className:`w-3.5 h-3.5`}),(0,G.jsx)(`span`,{children:e.photo_count})]})]}),x&&e.created_by_username&&(0,G.jsxs)(`div`,{className:`mt-1 text-xs text-bambu-gray flex items-center gap-1`,children:[(0,G.jsx)(zu,{className:`w-3 h-3`}),e.created_by_username]}),S&&(0,G.jsxs)(`div`,{className:`mt-1 text-xs text-bambu-gray flex items-center gap-1`,title:C(`fileManager.lastModified`),children:[(0,G.jsx)(Zo,{className:`w-3 h-3`}),ep(e.fs_modified_at??e.created_at)]}),(e.tags?.length??0)>0&&(0,G.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1`,...e9,children:e.tags.map(e=>(0,G.jsxs)(`button`,{type:`button`,onClick:()=>_?.(e.id),className:`inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded-full text-[10px] bg-bambu-green/10 text-bambu-green hover:bg-bambu-green/20 transition-colors max-w-full`,title:e.name,children:[(0,G.jsx)(xu,{className:`w-2.5 h-2.5 flex-shrink-0`}),(0,G.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id))})]}),(0,G.jsxs)(`div`,{className:`absolute bottom-2 right-2 transition-opacity can-hover:opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`,...e9,children:[(0,G.jsx)(`button`,{onClick:e=>{let t=e.currentTarget.getBoundingClientRect();T({x:t.left,y:t.bottom+4})},className:`p-1.5 rounded bg-bambu-dark-secondary/90 hover:bg-bambu-dark-tertiary`,children:(0,G.jsx)(Ks,{className:`w-4 h-4 text-bambu-gray`})}),w&&(0,G.jsx)(pE,{x:w.x,y:w.y,items:k,onClose:()=>T(null)})]}),(0,G.jsx)(`div`,{className:`absolute top-2 left-2 w-5 h-5 rounded border-2 flex items-center justify-center transition-all ${t?`bg-bambu-green border-bambu-green`:`border-white/30 bg-black/30 can-hover:opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`}`,children:t&&(0,G.jsx)(`div`,{className:`w-2 h-2 bg-white rounded-sm`})})]})}function D1e(){let{t:e}=U(),t=no(),{showToast:n}=qd(),{hasPermission:r,hasAnyPermission:i,canModify:a,authEnabled:o}=Nd(),[s]=ji(),c=$n(),l=s.get(`folder`),[u,d]=(0,f.useState)(l?parseInt(l,10):null),[p,m]=(0,f.useState)(`internal`),[h,g]=(0,f.useState)([]),[_,v]=(0,f.useState)(!1),[y,b]=(0,f.useState)(!1),[x,S]=(0,f.useState)(!1),[C,w]=(0,f.useState)(!1),[T,E]=(0,f.useState)([]),[D,O]=(0,f.useState)(!1),[k,A]=(0,f.useState)(!1),[j,M]=(0,f.useState)(!1),[N,P]=(0,f.useState)([]),[F,I]=(0,f.useState)(null),[L,R]=(0,f.useState)(null),[z,B]=(0,f.useState)(null),[V,ee]=(0,f.useState)(null),[te,ne]=(0,f.useState)(null),[re,ie]=(0,f.useState)(null),[ae,oe]=(0,f.useState)({}),[se,H]=(0,f.useState)(null),[ce,le]=(0,f.useState)(null),[ue,de]=(0,f.useState)(null),[fe,pe]=(0,f.useState)(null),[me,he]=(0,f.useState)(null),[ge,_e]=(0,f.useState)(()=>localStorage.getItem(`library-view-mode`)||`grid`),[ve,ye]=(0,f.useState)(()=>localStorage.getItem(`library-wrap-folders`)===`true`),[be,xe]=(0,f.useState)(()=>localStorage.getItem(`library-collapse-folders`)===`true`),[Se,Ce]=(0,f.useState)(()=>localStorage.getItem(`library-folder-sort-field`)===`activity`?`activity`:`name`),[we,Te]=(0,f.useState)(()=>localStorage.getItem(`library-folder-sort-direction`)===`desc`?`desc`:`asc`),[Ee,De]=(0,f.useState)(()=>{let e=localStorage.getItem(`library-sidebar-width`);return e?parseInt(e,10):256}),[Oe,ke]=(0,f.useState)(!1),Ae=(0,f.useRef)(null);(0,f.useEffect)(()=>{if(!Oe)return;document.body.style.userSelect=`none`,document.body.style.cursor=`col-resize`;let e=e=>{if(!Ae.current)return;let t=Ae.current.parentElement?.getBoundingClientRect();if(!t)return;let n=e.clientX-t.left;De(Math.min(500,Math.max(200,n)))},t=()=>{ke(!1),document.body.style.userSelect=``,document.body.style.cursor=``,localStorage.setItem(`library-sidebar-width`,String(Ee))};return document.addEventListener(`mousemove`,e),document.addEventListener(`mouseup`,t),()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,t),document.body.style.userSelect=``,document.body.style.cursor=``}},[Oe,Ee]);let[je,Me]=(0,f.useState)(``),[Ne,Pe]=(0,f.useState)(`all`),[Fe,Ie]=(0,f.useState)(``),[Le,Re]=(0,f.useState)(()=>localStorage.getItem(`library-sort-field`)||`name`),[ze,Be]=(0,f.useState)(()=>localStorage.getItem(`library-sort-direction`)||`asc`),[Ve,He]=(0,f.useState)(()=>localStorage.getItem(`library-show-modified`)===`true`);(0,f.useEffect)(()=>{let e=s.get(`folder`);e&&d(parseInt(e,10))},[s]);let{data:Ue}=K({queryKey:[`settings`],queryFn:()=>Z.getSettings()}),We=VW(Ue?.open_in_slicer,Ue?.preferred_slicer),Ge=(0,f.useCallback)(async t=>{try{let{token:e}=await Z.createLibrarySlicerToken(t.id),n=Z.getLibrarySlicerDownloadUrl(t.id,e,t.filename);GW(`${window.location.origin}${n}`,We)}catch{n(e(`fileManager.toast.openInSlicerFailed`),`error`);let r=Z.getLibraryFileDownloadUrl(t.id);GW(`${window.location.origin}${r}`,We)}},[We,n,e]),Ke=(0,f.useCallback)(()=>Ue?.use_slicer_api?r(`library:upload`):i(`library:read_all`,`library:read_own`),[Ue?.use_slicer_api,r,i]),{data:qe,isLoading:Je}=K({queryKey:[`library-folders`],queryFn:()=>Z.getLibraryFolders()}),Ye=(0,f.useMemo)(()=>{if(!qe)return qe;let e=t=>[...t].sort((e,t)=>{let n=0;if(Se===`name`)n=e.name.localeCompare(t.name);else{let r=e.latest_activity_at?new Date(e.latest_activity_at).getTime():null,i=t.latest_activity_at?new Date(t.latest_activity_at).getTime():null;if(r===null&&i===null)n=e.name.localeCompare(t.name);else if(r===null)return 1;else if(i===null)return-1;else n=r-i}return we===`asc`?n:-n}).map(t=>({...t,children:e(t.children)}));return e(qe)},[qe,Se,we]),{data:Xe}=K({queryKey:[`library-trash-count`],queryFn:async()=>{try{return(await Z.listLibraryTrash(1,0)).total}catch{return 0}},staleTime:3e4}),Ze=u!==null&&je.trim().length>0,Qe=(0,f.useMemo)(()=>[...N].sort((e,t)=>e-t),[N]),{data:$e=[]}=K({queryKey:[`library-tags`],queryFn:Z.getLibraryTags}),et=(0,f.useMemo)(()=>{let e=new Map;for(let t of $e)e.set(t.id,t.name);return e},[$e]);(0,f.useEffect)(()=>{$e.length!==0&&P(e=>{let t=e.filter(e=>et.has(e));return t.length===e.length?e:t})},[$e.length,et]);let tt=(0,f.useCallback)(e=>{P(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]),{data:nt,isLoading:rt}=K({queryKey:[`library-files`,u,p,Ze,Qe],queryFn:()=>Z.getLibraryFiles(u,!1,void 0,u===null?p:void 0,Ze,Qe)}),{data:it}=K({queryKey:[`library-stats`],queryFn:()=>Z.getLibraryStats()}),{data:at}=K({queryKey:[`users`,`slim`],queryFn:()=>Z.getUsersSlim()}),ot=(0,f.useMemo)(()=>{if(!nt)return[];let e=new Set(nt.map(e=>e.file_type));return Array.from(e).sort()},[nt]),st=(0,f.useMemo)(()=>{if(!nt)return[];let e=[...nt];if(je.trim()){let t=je.toLowerCase();e=e.filter(e=>e.filename.toLowerCase().includes(t)||e.print_name&&e.print_name.toLowerCase().includes(t))}if(Ne!==`all`&&(e=e.filter(e=>e.file_type===Ne)),Fe.trim()){let t=Fe.toLowerCase();e=e.filter(e=>e.created_by_username&&e.created_by_username.toLowerCase().includes(t))}return e.sort((e,t)=>{let n=0;switch(Le){case`name`:n=(e.print_name||e.filename).localeCompare(t.print_name||t.filename);break;case`date`:n=($f(e.fs_modified_at??e.created_at)?.getTime()??0)-($f(t.fs_modified_at??t.created_at)?.getTime()??0);break;case`size`:n=e.file_size-t.file_size;break;case`type`:n=e.file_type.localeCompare(t.file_type);break;case`prints`:n=e.print_count-t.print_count;break}return ze===`asc`?n:-n}),e},[nt,je,Ne,Fe,Le,ze]),ct=(0,f.useMemo)(()=>{if(!it||!Ue)return!1;let e=(Ue.library_disk_warning_gb||5)*1024*1024*1024;return it.disk_free_bytesZ.createLibraryFolder(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`library-folders`]}),v(!1),n(e(`fileManager.toast.folderCreated`),`success`)},onError:e=>n(e.message,`error`)}),ut=q({mutationFn:async e=>{let t=await Z.createExternalFolder(e);return await Z.scanExternalFolder(t.id),t},onSuccess:r=>{t.invalidateQueries({queryKey:[`library-folders`]}),t.invalidateQueries({queryKey:[`library-files`]}),t.invalidateQueries({queryKey:[`library-stats`]}),b(!1),d(r.id),n(e(`fileManager.toast.externalFolderLinked`),`success`)},onError:e=>n(e.message,`error`)}),dt=q({mutationFn:e=>Z.scanExternalFolder(e),onSuccess:r=>{t.invalidateQueries({queryKey:[`library-files`]}),t.invalidateQueries({queryKey:[`library-folders`]}),t.invalidateQueries({queryKey:[`library-stats`]}),n(e(`fileManager.toast.folderScanned`,{added:r.added,removed:r.removed}),`success`)},onError:e=>n(e.message,`error`)}),ft=q({mutationFn:e=>Z.deleteLibraryFolder(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`library-folders`]}),t.invalidateQueries({queryKey:[`library-files`]}),t.invalidateQueries({queryKey:[`library-stats`]}),u===L?.id&&d(null),R(null),n(e(`fileManager.toast.folderDeleted`),`success`)},onError:e=>{R(null),n(e.message,`error`)}}),pt=q({mutationFn:e=>Z.deleteLibraryFile(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`library-files`]}),t.invalidateQueries({queryKey:[`library-folders`]}),t.invalidateQueries({queryKey:[`library-stats`]}),t.invalidateQueries({queryKey:[`library-trash-count`]}),g(e=>e.filter(e=>e!==L?.id)),R(null),n(e(`fileManager.toast.fileDeleted`),`success`)},onError:e=>{R(null),n(e.message,`error`)}}),mt=q({mutationFn:e=>Z.createVariantGroup(e.map(e=>({library_file_id:e}))),onSuccess:r=>{t.invalidateQueries({queryKey:[`library-files`]}),n(e(`fileManager.variants.grouped`,{count:r.members.length}),`success`),g([])},onError:e=>n(e.message,`error`)}),ht=q({mutationFn:e=>Z.bulkDeleteLibrary(e,[]),onSuccess:(r,i)=>{t.invalidateQueries({queryKey:[`library-files`]}),t.invalidateQueries({queryKey:[`library-folders`]}),t.invalidateQueries({queryKey:[`library-stats`]}),t.invalidateQueries({queryKey:[`library-trash-count`]}),n(e(`fileManager.toast.filesDeleted`,{count:i.length}),`success`),g([]),R(null)},onError:e=>{R(null),n(e.message,`error`)}}),gt=q({mutationFn:({fileIds:e,folderId:t})=>Z.moveLibraryFiles(e,t),onSuccess:()=>{t.invalidateQueries({queryKey:[`library-files`]}),t.invalidateQueries({queryKey:[`library-folders`]}),g([]),S(!1),n(e(`fileManager.toast.filesMoved`),`success`)},onError:e=>n(e.message,`error`)}),_t=q({mutationFn:({id:e,data:t})=>Z.updateLibraryFolder(e,t),onSuccess:(r,i)=>{t.invalidateQueries({queryKey:[`library-folders`]}),t.invalidateQueries({queryKey:[`project-folders`]}),t.invalidateQueries({queryKey:[`archive-folders`]}),I(null),n(i.data.project_id===0&&i.data.archive_id===0?e(`fileManager.toast.folderUnlinked`):e(`fileManager.toast.folderLinked`),`success`)},onError:e=>n(e.message,`error`)}),vt=q({mutationFn:({id:e,filename:t})=>Z.updateLibraryFile(e,{filename:t}),onSuccess:()=>{t.invalidateQueries({queryKey:[`library-files`]}),ie(null),n(e(`fileManager.toast.fileRenamed`),`success`)},onError:e=>{ie(null),n(e.message,`error`)}}),yt=q({mutationFn:({id:e,name:t})=>Z.updateLibraryFolder(e,{name:t}),onSuccess:()=>{t.invalidateQueries({queryKey:[`library-folders`]}),t.invalidateQueries({queryKey:[`library-files`]}),ie(null),n(e(`fileManager.toast.folderRenamed`),`success`)},onError:e=>{ie(null),n(e.message,`error`)}}),bt=q({mutationFn:()=>Z.batchGenerateStlThumbnails({all_missing:!0}),onSuccess:r=>{if(t.invalidateQueries({queryKey:[`library-files`]}),r.succeeded>0){let e=Date.now(),t={};r.results.forEach(n=>{n.success&&(t[n.file_id]=e)}),oe(e=>({...e,...t}))}r.succeeded>0&&r.failed===0?n(e(`fileManager.toast.thumbnailsGenerated`,{count:r.succeeded}),`success`):r.succeeded>0&&r.failed>0?n(e(`fileManager.toast.thumbnailsGeneratedPartial`,{succeeded:r.succeeded,failed:r.failed}),`success`):r.processed===0?n(e(`fileManager.toast.noStlMissingThumbnails`),`info`):n(e(`fileManager.toast.failedToGenerateThumbnails`,{error:r.results[0]?.error||`Unknown error`}),`error`)},onError:e=>n(e.message,`error`)}),xt=q({mutationFn:e=>Z.batchGenerateStlThumbnails({file_ids:[e]}),onSuccess:r=>{if(t.invalidateQueries({queryKey:[`library-files`]}),r.succeeded>0){let t=r.results[0]?.file_id;t&&oe(e=>({...e,[t]:Date.now()})),n(e(`fileManager.toast.thumbnailGenerated`),`success`)}else n(e(`fileManager.toast.failedToGenerateThumbnail`,{error:r.results[0]?.error||`Unknown error`}),`error`)},onError:e=>n(e.message,`error`)}),St=(0,f.useCallback)(e=>{r(`library:read`)&&(T5(e)?c(`/gcode-viewer?library_file=${e.id}`):e.file_type===`3mf`||e.file_type===`stl`||Q7(e.file_type)?H(e):e.file_type===`pdf`?le(e):Z7(e.file_type)?de(e):h1e(e.file_type)&&he(e))},[r,c]),Ct=(0,f.useMemo)(()=>{if(!nt||h.length!==1)return null;let e=nt.find(e=>e.id===h[0]);return e&&$7(e)?e:null},[nt,h]),wt=(0,f.useMemo)(()=>nt?nt.filter(e=>h.includes(e.id)&&T5(e)):[],[nt,h]),{data:Tt}=K({queryKey:[`variant-group`,z?.variant_group_id],queryFn:()=>Z.getVariantGroup(z.variant_group_id),enabled:!!z?.variant_group_id}),Et=(0,f.useMemo)(()=>{if(z){if(wt.length>1)return wt.map(e=>({id:e.id,filename:e.filename,sliced_for_model:e.sliced_for_model}));if(Tt&&Tt.members.length>1)return Tt.members.map(e=>({id:e.library_file_id,filename:e.filename,sliced_for_model:e.target_model}))}},[z,wt,Tt]),Dt=(0,f.useCallback)(e=>{g(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]),Ot=(0,f.useCallback)(()=>{st.length>0&&g(st.map(e=>e.id))},[st]),kt=(0,f.useCallback)(()=>{g([])},[]),At=()=>{t.invalidateQueries({queryKey:[`library-files`]}),t.invalidateQueries({queryKey:[`library-folders`]}),t.invalidateQueries({queryKey:[`library-stats`]})},{isDraggingOver:jt,dragHandlers:Mt}=KW({disabled:!r(`library:upload`)||C,onFiles:e=>{E(e),w(!0)}}),Nt=(0,f.useCallback)(e=>{if(!e.thumbnail_path&&a(`library`,`update`,e.created_by_id))return n=>{Z.uploadLibraryPreviewThumbnail(e.id,n).then(n=>{n.updated&&(oe(t=>({...t,[e.id]:(t[e.id]||0)+1})),t.invalidateQueries({queryKey:[`library-files`]}))}).catch(()=>{})}},[a,t]),Pt=e=>{Z.downloadLibraryFile(e).catch(e=>{console.error(`Library file download failed:`,e)})},Ft=()=>{L&&(L.type===`file`?pt.mutate(L.id):L.type===`folder`?ft.mutate(L.id):L.type===`bulk`&&ht.mutate(h))},It=ft.isPending||pt.isPending||ht.isPending,Lt=e=>{_e(e),localStorage.setItem(`library-view-mode`,e)},Rt=Je||rt,zt=(0,f.useMemo)(()=>{if(!u||!qe)return null;let e=t=>{for(let n of t){if(n.id===u)return n;let t=e(n.children);if(t)return t}return null};return e(qe)},[u,qe]);return(0,G.jsxs)(`div`,{className:`p-4 md:p-8 min-h-[calc(100vh-64px)] lg:h-[calc(100vh-64px)] flex flex-col relative`,...Mt,children:[jt&&(0,G.jsx)(`div`,{className:`fixed inset-0 z-50 bg-bambu-dark/90 flex items-center justify-center pointer-events-none`,children:(0,G.jsxs)(`div`,{className:`border-4 border-dashed border-bambu-green rounded-xl p-12 text-center`,children:[(0,G.jsx)(Ru,{className:`w-16 h-16 mx-auto mb-4 text-bambu-green`}),(0,G.jsx)(`p`,{className:`text-2xl font-semibold text-white mb-2`,children:e(`fileManager.dropFilesHere`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray`,children:e(`fileManager.releaseToUpload`)})]})}),(0,G.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-4 mb-6`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`h1`,{className:`text-2xl font-bold text-white flex items-center gap-3`,children:[(0,G.jsx)(dc,{className:`w-7 h-7 text-bambu-green`}),e(`fileManager.title`)]}),(0,G.jsx)(`p`,{className:`text-bambu-gray mt-1`,children:e(`fileManager.subtitle`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center bg-bambu-dark rounded-lg p-1`,children:[(0,G.jsx)(`button`,{onClick:()=>Lt(`grid`),className:`p-1.5 rounded transition-colors ${ge===`grid`?`bg-bambu-dark-secondary text-white`:`text-bambu-gray hover:text-white`}`,title:e(`fileManager.gridView`),children:(0,G.jsx)(Uc,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{onClick:()=>Lt(`list`),className:`p-1.5 rounded transition-colors ${ge===`list`?`bg-bambu-dark-secondary text-white`:`text-bambu-gray hover:text-white`}`,title:e(`fileManager.listView`),children:(0,G.jsx)(Jc,{className:`w-4 h-4`})})]}),(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>bt.mutate(),disabled:bt.isPending||!i(`library:update_own`,`library:update_all`),title:i(`library:update_own`,`library:update_all`)?e(`fileManager.generateThumbnailsForMissing`):e(`fileManager.noPermissionGenerateThumbnail`),children:[bt.isPending?(0,G.jsx)(Y,{className:`w-4 h-4 mr-2 animate-spin`}):(0,G.jsx)(Ic,{className:`w-4 h-4 mr-2`}),e(`fileManager.generateThumbnails`)]}),(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>b(!0),disabled:!r(`library:upload`),title:r(`library:upload`)?e(`fileManager.linkExternalFolder`):e(`fileManager.noPermissionCreateFolder`),children:[(0,G.jsx)(pc,{className:`w-4 h-4 mr-2`}),e(`fileManager.linkExternal`)]}),(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>v(!0),disabled:!r(`library:upload`),title:r(`library:upload`)?void 0:e(`fileManager.noPermissionCreateFolder`),children:[(0,G.jsx)(fc,{className:`w-4 h-4 mr-2`}),e(`fileManager.newFolder`)]}),(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>A(!0),title:e(`fileManager.tags.manageTitle`),children:[(0,G.jsx)(xu,{className:`w-4 h-4 mr-2`}),e(`fileManager.tags.manage`)]}),r(`library:purge`)&&(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>O(!0),title:e(`libraryPurge.headerTooltip`),children:[(0,G.jsx)(ju,{className:`w-4 h-4 mr-2`}),e(`libraryPurge.headerButton`)]}),i(`library:delete_own`,`library:delete_all`)&&(0,G.jsxs)(Ci,{to:`/files/trash`,className:`inline-flex items-center px-3 py-1.5 text-sm rounded bg-bambu-dark-secondary text-bambu-gray hover:text-white hover:bg-bambu-dark transition-colors`,title:e(`libraryTrash.headerTooltip`),children:[(0,G.jsx)(ju,{className:`w-4 h-4 mr-2`}),e(`libraryTrash.headerButton`),typeof Xe==`number`&&Xe>0&&(0,G.jsx)(`span`,{className:`ml-1.5 px-1.5 py-0.5 text-xs rounded-full bg-bambu-green/20 text-bambu-green`,children:Xe})]}),(0,G.jsxs)(Q,{onClick:()=>w(!0),disabled:!r(`library:upload`),title:r(`library:upload`)?void 0:e(`fileManager.noPermissionUpload`),children:[(0,G.jsx)(Ru,{className:`w-4 h-4 mr-2`}),e(`common.upload`)]})]})]}),ct&&it&&Ue&&(0,G.jsxs)(`div`,{className:`flex items-center gap-3 mb-4 p-3 bg-amber-500/10 border border-amber-500/30 rounded-lg`,children:[(0,G.jsx)(Pu,{className:`w-5 h-5 text-amber-500 flex-shrink-0`}),(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`p`,{className:`text-sm text-amber-500 font-medium`,children:e(`fileManager.lowDiskSpaceWarning`)}),(0,G.jsx)(`p`,{className:`text-xs text-amber-500/80`,children:e(`fileManager.lowDiskSpaceDetails`,{free:Gd(it.disk_free_bytes),total:Gd(it.disk_total_bytes),threshold:Ue.library_disk_warning_gb})})]})]}),it&&(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 sm:gap-6 mb-6 p-3 bg-bambu-dark-secondary rounded-lg border border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,G.jsx)(oc,{className:`w-4 h-4 text-bambu-green`}),(0,G.jsxs)(`span`,{className:`text-bambu-gray`,children:[e(`fileManager.files`),`:`]}),(0,G.jsx)(`span`,{className:`text-white font-medium`,children:it.total_files})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,G.jsx)(dc,{className:`w-4 h-4 text-blue-600 dark:text-blue-400`}),(0,G.jsxs)(`span`,{className:`text-bambu-gray`,children:[e(`fileManager.folders`),`:`]}),(0,G.jsx)(`span`,{className:`text-white font-medium`,children:it.total_folders})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,G.jsx)(Dc,{className:`w-4 h-4 text-amber-600 dark:text-amber-400`}),(0,G.jsxs)(`span`,{className:`text-bambu-gray`,children:[e(`fileManager.size`),`:`]}),(0,G.jsx)(`span`,{className:`text-white font-medium`,children:Gd(it.total_size_bytes)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm sm:ml-auto`,children:[(0,G.jsxs)(`span`,{className:`text-bambu-gray`,children:[e(`fileManager.free`),`:`]}),(0,G.jsx)(`span`,{className:`font-medium ${ct?`text-amber-500`:`text-white`}`,children:Gd(it.disk_free_bytes)})]})]}),(0,G.jsxs)(`div`,{className:`flex-1 flex flex-col lg:flex-row gap-4 lg:gap-6 min-h-0`,children:[(0,G.jsx)(`div`,{className:`lg:hidden`,children:(0,G.jsxs)(`select`,{value:u===null?`__top:${p}`:String(u),onChange:e=>{let t=e.target.value;t.startsWith(`__top:`)?(d(null),m(t.slice(6))):d(parseInt(t,10))},className:`w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg px-3 py-2.5 text-white focus:outline-none focus:border-bambu-green`,children:[(0,G.jsxs)(`option`,{value:`__top:internal`,children:[`📁 `,e(`fileManager.allFiles`)]}),qe?.some(e=>e.is_external)&&(0,G.jsxs)(`option`,{value:`__top:external`,children:[`🔗 `,e(`fileManager.allExternal`)]}),Ye&&(()=>{let e=(t,n=0)=>{let r=[];for(let i of t)r.push({id:i.id,name:i.name,fileCount:i.file_count,depth:n}),i.children.length>0&&r.push(...e(i.children,n+1));return r};return e(Ye).map(e=>(0,G.jsxs)(`option`,{value:e.id,children:[`│ `.repeat(e.depth),`📂 `,e.name,` `,e.fileCount>0?`(${e.fileCount})`:``]},e.id))})()]})}),(0,G.jsxs)(`div`,{ref:Ae,className:`hidden lg:flex flex-shrink-0 bg-bambu-dark-secondary rounded-lg border border-bambu-dark-tertiary overflow-hidden flex-col relative`,style:{width:`${Ee}px`},children:[(0,G.jsx)(`div`,{className:`absolute right-0 top-0 bottom-0 w-1.5 cursor-col-resize z-10 group/resize flex items-center justify-center transition-colors ${Oe?`bg-bambu-green`:`hover:bg-bambu-green/50`}`,onMouseDown:e=>{e.preventDefault(),ke(!0)},onDoubleClick:()=>{De(256),localStorage.setItem(`library-sidebar-width`,`256`)},title:e(`fileManager.dragToResizeTooltip`),children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 opacity-0 group-hover/resize:opacity-100 transition-opacity ${Oe?`opacity-100`:``}`,children:[(0,G.jsx)(`div`,{className:`w-0.5 h-0.5 rounded-full bg-white/70`}),(0,G.jsx)(`div`,{className:`w-0.5 h-0.5 rounded-full bg-white/70`}),(0,G.jsx)(`div`,{className:`w-0.5 h-0.5 rounded-full bg-white/70`})]})}),(0,G.jsxs)(`div`,{className:`p-3 border-b border-bambu-dark-tertiary flex items-center justify-between`,children:[(0,G.jsx)(`h2`,{className:`text-sm font-medium text-white`,children:e(`fileManager.folders`)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsxs)(`select`,{value:Se,onChange:e=>{let t=e.target.value===`activity`?`activity`:`name`;Ce(t),localStorage.setItem(`library-folder-sort-field`,t)},className:`text-xs px-1 py-0.5 rounded bg-bambu-dark border border-bambu-dark-tertiary text-bambu-gray focus:outline-none focus:border-bambu-green`,title:e(`fileManager.folderSort`),"aria-label":e(`fileManager.folderSort`),children:[(0,G.jsx)(`option`,{value:`name`,children:e(`fileManager.folderSortByName`)}),(0,G.jsx)(`option`,{value:`activity`,children:e(`fileManager.folderSortByActivity`)})]}),(0,G.jsx)(`button`,{onClick:()=>{let e=we===`asc`?`desc`:`asc`;Te(e),localStorage.setItem(`library-folder-sort-direction`,e)},className:`text-bambu-gray hover:text-white hover:bg-bambu-dark p-1 rounded transition-colors`,title:e(we===`asc`?`fileManager.ascending`:`fileManager.descending`),"aria-label":e(we===`asc`?`fileManager.ascending`:`fileManager.descending`),children:we===`asc`?(0,G.jsx)(Fo,{className:`w-3.5 h-3.5`}):(0,G.jsx)(ko,{className:`w-3.5 h-3.5`})}),(0,G.jsx)(`button`,{onClick:()=>{let e=!be;xe(e),localStorage.setItem(`library-collapse-folders`,String(e))},className:`text-xs px-1.5 py-0.5 rounded transition-colors ${be?`bg-bambu-green/20 text-bambu-green`:`text-bambu-gray hover:text-white hover:bg-bambu-dark`}`,title:e(be?`fileManager.expandFoldersByDefault`:`fileManager.collapseFoldersByDefault`),children:e(`fileManager.collapse`)}),(0,G.jsx)(`button`,{onClick:()=>{let e=!ve;ye(e),localStorage.setItem(`library-wrap-folders`,String(e))},className:`text-xs px-1.5 py-0.5 rounded transition-colors ${ve?`bg-bambu-green/20 text-bambu-green`:`text-bambu-gray hover:text-white hover:bg-bambu-dark`}`,title:e(ve?`fileManager.disableTextWrapping`:`fileManager.enableTextWrapping`),children:e(`fileManager.wrap`)})]})]}),(0,G.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1.5 rounded cursor-pointer transition-colors ${u===null&&p===`internal`?`bg-bambu-green/20 text-bambu-green`:`hover:bg-bambu-dark text-white`}`,onClick:()=>{d(null),m(`internal`)},children:[(0,G.jsx)(ec,{className:`w-4 h-4`}),(0,G.jsx)(`span`,{className:`text-sm`,children:e(`fileManager.allFiles`)})]}),qe?.some(e=>e.is_external)&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1.5 rounded cursor-pointer transition-colors ${u===null&&p===`external`?`bg-bambu-green/20 text-bambu-green`:`hover:bg-bambu-dark text-white`}`,onClick:()=>{d(null),m(`external`)},children:[(0,G.jsx)(pc,{className:`w-4 h-4 text-purple-600 dark:text-purple-400`}),(0,G.jsx)(`span`,{className:`text-sm`,children:e(`fileManager.allExternal`)})]}),Ye?.map(t=>(0,G.jsx)(T1e,{folder:t,selectedFolderId:u,onSelect:d,onDelete:e=>R({type:`folder`,id:e}),onLink:I,onRename:e=>ie({type:`folder`,id:e.id,name:e.name}),wrapNames:ve,defaultExpanded:!be,showModified:Ve,hasPermission:r,t:e},`${t.id}-${be?`c`:`e`}`))]})]}),(0,G.jsxs)(`div`,{className:`flex-1 flex flex-col lg:flex-row min-w-0 min-h-0 gap-4 lg:gap-6`,children:[(0,G.jsxs)(`div`,{className:`flex-1 flex flex-col min-w-0 min-h-0`,children:[$e.length>0&&(0,G.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center gap-2 p-2 sm:p-3 bg-bambu-dark-secondary rounded-lg border border-bambu-dark-tertiary`,children:[(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray font-medium shrink-0`,children:e(`fileManager.tags.filterLabel`)}),$e.map(e=>{let t=N.includes(e.id);return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>tt(e.id),className:t?`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs bg-bambu-green/20 text-bambu-green border border-bambu-green/40 hover:bg-bambu-green/30 transition-colors`:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs bg-bambu-dark text-bambu-gray border border-bambu-dark-tertiary hover:text-white hover:border-bambu-green/40 transition-colors`,title:e.name,children:[(0,G.jsx)(xu,{className:`w-3 h-3`}),(0,G.jsx)(`span`,{children:e.name}),t&&(0,G.jsx)($u,{className:`w-3 h-3`})]},e.id)}),N.length>0&&(0,G.jsx)(`button`,{type:`button`,onClick:()=>P([]),className:`ml-auto text-xs text-bambu-gray hover:text-white shrink-0`,children:e(`fileManager.tags.clearAll`)})]}),zt?.is_external&&(0,G.jsxs)(`div`,{className:`flex items-center gap-3 mb-4 p-3 bg-purple-50 dark:bg-purple-500/10 border border-purple-300 dark:border-purple-500/30 rounded-lg`,children:[(0,G.jsx)(pc,{className:`w-5 h-5 text-purple-600 dark:text-purple-400 flex-shrink-0`}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium text-purple-700 dark:text-purple-300`,children:e(`fileManager.externalFolder`)}),zt.external_readonly&&(0,G.jsxs)(`span`,{className:`text-xs px-1.5 py-0.5 rounded bg-amber-100 dark:bg-amber-500/20 text-amber-700 dark:text-amber-400 flex items-center gap-1`,children:[(0,G.jsx)(Xc,{className:`w-3 h-3`}),e(`fileManager.readOnly`)]})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray truncate font-mono`,title:zt.external_path||``,children:zt.external_path})]}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:()=>u&&dt.mutate(u),disabled:dt.isPending,title:e(`fileManager.scanFolder`),children:[dt.isPending?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(Il,{className:`w-4 h-4`}),(0,G.jsx)(`span`,{className:`ml-1.5`,children:e(`fileManager.scanFolder`)})]})]}),nt&&nt.length>0&&(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 sm:gap-3 mb-4 p-2 sm:p-3 bg-bambu-dark-secondary rounded-lg border border-bambu-dark-tertiary sticky top-0 z-10 lg:static`,children:[(0,G.jsxs)(`div`,{className:`relative w-full sm:w-auto sm:flex-1 sm:max-w-xs`,children:[(0,G.jsx)(Kl,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray`}),(0,G.jsx)(`input`,{type:`text`,placeholder:e(`fileManager.searchFiles`),value:je,onChange:e=>Me(e.target.value),className:`w-full pl-9 pr-3 py-1.5 bg-bambu-dark border border-bambu-dark-tertiary rounded text-sm text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green`}),Ze&&(0,G.jsx)(`span`,{className:`absolute -bottom-4 left-0 text-[10px] text-bambu-gray whitespace-nowrap`,title:e(`fileManager.searchSubfoldersHint`),children:e(`fileManager.searchSubfoldersHint`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(_c,{className:`w-4 h-4 text-bambu-gray hidden sm:block`}),(0,G.jsxs)(`select`,{value:Ne,onChange:e=>Pe(e.target.value),className:`bg-bambu-dark border border-bambu-dark-tertiary rounded px-2 py-1.5 text-sm text-white focus:outline-none focus:border-bambu-green`,children:[(0,G.jsx)(`option`,{value:`all`,children:e(`fileManager.allTypes`)}),ot.map(e=>(0,G.jsx)(`option`,{value:e,children:e.toUpperCase()},e))]})]}),o&&(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(`input`,{type:`text`,placeholder:e(`fileManager.filterByUser`,{defaultValue:`Filter by user`}),value:Fe,onChange:e=>Ie(e.target.value),list:`usernames-list`,className:`w-32 sm:w-40 px-2 py-1.5 bg-bambu-dark border border-bambu-dark-tertiary rounded text-sm text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green ${Fe?`pr-7`:``}`,style:Fe?{WebkitAppearance:`none`,MozAppearance:`textfield`}:void 0}),Fe&&(0,G.jsx)(`button`,{onClick:()=>Ie(``),className:`absolute right-2 top-1/2 -translate-y-1/2 text-bambu-gray hover:text-white z-10`,children:(0,G.jsx)($u,{className:`w-3 h-3`})}),(0,G.jsx)(`datalist`,{id:`usernames-list`,children:at?.map(e=>(0,G.jsx)(`option`,{value:e.username},e.id))})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`select`,{value:Le,onChange:e=>{let t=e.target.value;Re(t),localStorage.setItem(`library-sort-field`,t)},className:`bg-bambu-dark border border-bambu-dark-tertiary rounded px-2 py-1.5 text-sm text-white focus:outline-none focus:border-bambu-green`,children:[(0,G.jsx)(`option`,{value:`name`,children:e(`common.name`)}),(0,G.jsx)(`option`,{value:`date`,children:e(`common.date`)}),(0,G.jsx)(`option`,{value:`size`,children:e(`fileManager.size`)}),(0,G.jsx)(`option`,{value:`type`,children:e(`common.type`)}),(0,G.jsx)(`option`,{value:`prints`,children:e(`fileManager.prints`)})]}),(0,G.jsx)(`button`,{onClick:()=>Be(e=>{let t=e===`asc`?`desc`:`asc`;return localStorage.setItem(`library-sort-direction`,t),t}),className:`p-1.5 rounded bg-bambu-dark border border-bambu-dark-tertiary hover:border-bambu-green transition-colors`,title:e(ze===`asc`?`fileManager.ascending`:`fileManager.descending`),children:ze===`asc`?(0,G.jsx)(Fo,{className:`w-4 h-4 text-white`}):(0,G.jsx)(ko,{className:`w-4 h-4 text-white`})}),(0,G.jsx)(`button`,{onClick:()=>He(e=>{let t=!e;return localStorage.setItem(`library-show-modified`,String(t)),t}),className:`p-1.5 rounded bg-bambu-dark border transition-colors ${Ve?`border-bambu-green text-bambu-green`:`border-bambu-dark-tertiary text-white hover:border-bambu-green`}`,title:e(Ve?`fileManager.hideModified`:`fileManager.showModified`),"aria-pressed":Ve,children:(0,G.jsx)(Zo,{className:`w-4 h-4`})})]}),(je||Ne!==`all`||Fe)&&(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray hidden sm:inline`,children:e(`fileManager.resultsCount`,{showing:st.length,total:nt.length})})]}),st.length>0&&(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 mb-4 p-2 bg-bambu-dark-secondary rounded-lg border border-bambu-dark-tertiary sticky top-[52px] z-10 lg:static`,children:[h.length===st.length&&h.length>0?(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:kt,children:[(0,G.jsx)(mu,{className:`w-4 h-4 sm:mr-1`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:e(`fileManager.deselectAll`)})]}):(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:Ot,children:[(0,G.jsx)(fu,{className:`w-4 h-4 sm:mr-1`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:e(`fileManager.selectAll`)})]}),h.length>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray ml-2`,children:e(`fileManager.selected`,{count:h.length})}),(0,G.jsx)(`div`,{className:`hidden sm:block flex-1`}),(0,G.jsxs)(`div`,{className:`w-full sm:w-auto flex flex-wrap items-center gap-2 mt-2 sm:mt-0`,children:[Ct&&(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:()=>St(Ct),disabled:!r(`library:read`),title:r(`library:read`)?void 0:e(`fileManager.noPermissionPreview`),children:[(0,G.jsx)(Qs,{className:`w-4 h-4 sm:mr-1`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:e(`fileManager.preview.open`)})]}),wt.length>=1&&(0,G.jsxs)(Q,{variant:`primary`,size:`sm`,onClick:()=>B(wt[0]),disabled:!r(`queue:create`),title:r(`queue:create`)?void 0:e(`fileManager.noPermissionAddToQueue`),children:[(0,G.jsx)(Ml,{className:`w-4 h-4 sm:mr-1`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:wt.length>1?e(`fileManager.variants.printAlternatives`,{count:wt.length}):e(`common.print`)})]}),wt.length>=2&&!wt.some(e=>e.variant_group_id)&&(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:()=>mt.mutate(wt.map(e=>e.id)),disabled:mt.isPending||!i(`library:update_own`,`library:update_all`),title:e(`fileManager.variants.groupTooltip`),children:[(0,G.jsx)(Hc,{className:`w-4 h-4 sm:mr-1`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:e(`fileManager.variants.groupAction`)})]}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:()=>S(!0),disabled:!i(`library:update_own`,`library:update_all`),title:i(`library:update_own`,`library:update_all`)?void 0:e(`fileManager.noPermissionMoveFiles`),children:[(0,G.jsx)(fl,{className:`w-4 h-4 sm:mr-1`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:e(`common.move`)})]}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:()=>M(!0),disabled:!i(`library:update_own`,`library:update_all`),title:i(`library:update_own`,`library:update_all`)?e(`fileManager.tags.bulkTooltip`):e(`fileManager.tags.noPermission`),children:[(0,G.jsx)(xu,{className:`w-4 h-4 sm:mr-1`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:e(`fileManager.tags.tagAction`)})]}),(0,G.jsxs)(Q,{variant:`danger`,size:`sm`,onClick:()=>{h.length===1?R({type:`file`,id:h[0]}):R({type:`bulk`,id:0,count:h.length})},disabled:!i(`library:delete_own`,`library:delete_all`),title:i(`library:delete_own`,`library:delete_all`)?void 0:e(`fileManager.noPermissionDeleteFiles`),children:[(0,G.jsx)(ju,{className:`w-4 h-4 sm:mr-1`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:e(`common.delete`)})]}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:kt,children:[(0,G.jsx)($u,{className:`w-4 h-4 sm:mr-1`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:e(`common.clear`)})]})]})]})]}),Rt?(0,G.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,G.jsx)(Y,{className:`w-8 h-8 animate-spin text-bambu-green`}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`fileManager.loadingFiles`)})]})}):nt?.length===0?(0,G.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center`,children:[(0,G.jsx)(`div`,{className:`p-4 bg-bambu-dark rounded-2xl mb-4`,children:(0,G.jsx)(ec,{className:`w-12 h-12 text-bambu-gray/50`})}),(0,G.jsx)(`h3`,{className:`text-lg font-medium text-white mb-2`,children:e(u===null?p===`external`?`fileManager.externalIsEmpty`:`fileManager.noFilesYet`:`fileManager.folderIsEmpty`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-center max-w-md mb-6`,children:e(u===null?p===`external`?`fileManager.externalEmptyDescription`:`fileManager.noFilesDescription`:`fileManager.folderEmptyDescription`)}),(0,G.jsxs)(Q,{onClick:()=>w(!0),disabled:!r(`library:upload`),title:r(`library:upload`)?void 0:e(`fileManager.noPermissionUpload`),children:[(0,G.jsx)(kl,{className:`w-4 h-4 mr-2`}),e(`fileManager.uploadFiles`)]})]}):st.length===0?(0,G.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center`,children:[(0,G.jsx)(`div`,{className:`p-4 bg-bambu-dark rounded-2xl mb-4`,children:(0,G.jsx)(Kl,{className:`w-12 h-12 text-bambu-gray/50`})}),(0,G.jsx)(`h3`,{className:`text-lg font-medium text-white mb-2`,children:e(`fileManager.noMatchingFiles`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-center max-w-md mb-6`,children:e(`fileManager.noMatchingFilesDescription`)}),(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>{Me(``),Pe(`all`)},children:e(`fileManager.clearFilters`)})]}):ge===`grid`?(0,G.jsx)(`div`,{className:`flex-1 lg:overflow-y-auto`,children:(0,G.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 2xl:grid-cols-6 gap-4`,children:st.map(t=>(0,G.jsx)(E1e,{file:t,isSelected:h.includes(t.id),t:e,onSelect:Dt,onDelete:e=>R({type:`file`,id:e}),onDownload:Pt,onPrint:B,onSlice:ee,onOpenInSlicer:Ge,desktopSlicer:We,onRunPipeline:ne,useSlicerApi:Ue?.use_slicer_api??!1,canSlice:Ke(),onPreview:St,onRename:e=>ie({type:`file`,id:e.id,name:e.filename}),onDetails:pe,onGenerateThumbnail:e=>xt.mutate(e.id),onTagClick:tt,thumbnailVersion:ae[t.id],hasPermission:r,canModify:a,authEnabled:o,showModified:Ve},t.id))})}):(0,G.jsx)(`div`,{className:`flex-1 lg:overflow-y-auto`,children:(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg border border-bambu-dark-tertiary overflow-x-auto`,children:[(0,G.jsxs)(`div`,{className:`hidden sm:grid ${o?`grid-cols-[auto_1fr_120px_100px_100px_100px_minmax(0,200px)_220px]`:`grid-cols-[auto_1fr_100px_100px_100px_minmax(0,200px)_220px]`} gap-4 px-4 py-2 bg-bambu-dark-secondary border-b border-bambu-dark-tertiary text-xs text-bambu-gray font-medium`,children:[(0,G.jsx)(`div`,{className:`w-6`}),(0,G.jsx)(`div`,{children:e(`common.name`)}),o&&(0,G.jsx)(`div`,{children:e(`fileManager.uploadedBy`,{defaultValue:`Uploaded By`})}),(0,G.jsx)(`div`,{children:e(`common.type`)}),(0,G.jsx)(`div`,{children:e(`fileManager.size`)}),(0,G.jsx)(`div`,{children:e(`fileManager.prints`)}),(0,G.jsx)(`div`,{children:e(`fileManager.tags.title`)}),(0,G.jsx)(`div`,{})]}),st.map(t=>(0,G.jsxs)(`div`,{className:`grid ${o?`grid-cols-[auto_1fr_120px_100px_100px_100px_minmax(0,200px)_220px]`:`grid-cols-[auto_1fr_100px_100px_100px_minmax(0,200px)_220px]`} gap-4 px-4 py-3 items-center border-b border-bambu-dark-tertiary last:border-b-0 cursor-pointer hover:bg-bambu-dark/50 transition-colors ${h.includes(t.id)?`bg-bambu-green/10`:``}`,onClick:()=>Dt(t.id),onDoubleClick:()=>St(t),children:[(0,G.jsx)(`div`,{className:`w-5 h-5 rounded border-2 flex items-center justify-center ${h.includes(t.id)?`bg-bambu-green border-bambu-green`:`border-bambu-gray/50`}`,children:h.includes(t.id)&&(0,G.jsx)(`div`,{className:`w-2 h-2 bg-white rounded-sm`})}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`relative group/thumb`,children:[(0,G.jsx)(`div`,{className:`w-10 h-10 rounded bg-bambu-dark flex-shrink-0 overflow-hidden`,children:t.thumbnail_path?(0,G.jsx)(`img`,{src:`${Z.getLibraryFileThumbnailUrl(t.id)}${ae[t.id]?(Z.getLibraryFileThumbnailUrl(t.id).includes(`?`)?`&`:`?`)+`v=${ae[t.id]}`:``}`,alt:``,className:`w-full h-full object-cover`}):(0,G.jsx)(`div`,{className:`w-full h-full flex items-center justify-center`,children:t.file_type===`pdf`?(0,G.jsx)(ac,{className:`w-5 h-5 text-bambu-gray/50`}):Z7(t.file_type)?(0,G.jsx)(ic,{className:`w-5 h-5 text-bambu-gray/50`}):m1e(t.file_type)?(0,G.jsx)(Ic,{className:`w-5 h-5 text-bambu-gray/50`}):(0,G.jsx)(ec,{className:`w-5 h-5 text-bambu-gray/50`})})}),t.thumbnail_path&&(0,G.jsx)(`div`,{className:`absolute left-0 top-full mt-2 z-50 hidden group-hover/thumb:block`,children:(0,G.jsx)(`div`,{className:`w-48 h-48 rounded-lg bg-bambu-dark-secondary border border-bambu-dark-tertiary shadow-xl overflow-hidden`,children:(0,G.jsx)(`img`,{src:`${Z.getLibraryFileThumbnailUrl(t.id)}${ae[t.id]?(Z.getLibraryFileThumbnailUrl(t.id).includes(`?`)?`&`:`?`)+`v=${ae[t.id]}`:``}`,alt:t.filename,className:`w-full h-full object-contain`})})})]}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,G.jsx)(`span`,{className:`text-sm text-white truncate`,children:t.print_name||t.filename}),t.external_url&&(0,G.jsx)(`a`,{href:t.external_url,target:`_blank`,rel:`noopener noreferrer`,...e9,className:`flex-shrink-0 text-bambu-gray hover:text-bambu-green`,title:e(`fileManager.details.openLink`),"aria-label":e(`fileManager.details.openLink`),children:(0,G.jsx)(Cc,{className:`w-3.5 h-3.5`})}),t.has_notes&&(0,G.jsx)(`span`,{className:`flex-shrink-0 text-bambu-gray`,title:e(`fileManager.details.hasNotes`),"aria-label":e(`fileManager.details.hasNotes`),children:(0,G.jsx)(_u,{className:`w-3.5 h-3.5`})}),(t.photo_count??0)>0&&(0,G.jsxs)(`span`,{className:`flex-shrink-0 flex items-center gap-0.5 text-xs text-bambu-gray`,title:e(`fileManager.details.photoCount`,{count:t.photo_count}),children:[(0,G.jsx)($o,{className:`w-3.5 h-3.5`}),t.photo_count]})]}),Ve&&(0,G.jsxs)(`div`,{className:`text-xs text-bambu-gray flex items-center gap-1 mt-0.5`,title:e(`fileManager.lastModified`),children:[(0,G.jsx)(Zo,{className:`w-3 h-3 flex-shrink-0`}),(0,G.jsx)(`span`,{className:`truncate`,children:ep(t.fs_modified_at??t.created_at)})]})]})]}),o&&(0,G.jsx)(`div`,{className:`text-sm text-bambu-gray flex items-center gap-1`,children:t.created_by_username?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(zu,{className:`w-3 h-3`}),(0,G.jsx)(`span`,{className:`truncate`,children:t.created_by_username})]}):`-`}),(0,G.jsx)(`div`,{children:(0,G.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded font-medium ${t.file_type===`3mf`?`bg-bambu-green/20 text-bambu-green`:t.file_type===`gcode`||t.file_type===`gcode.3mf`?`bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400`:t.file_type===`stl`?`bg-purple-100 dark:bg-purple-500/20 text-purple-700 dark:text-purple-400`:Q7(t.file_type)?`bg-amber-100 dark:bg-amber-500/20 text-amber-700 dark:text-amber-400`:t.file_type===`pdf`?`bg-red-100 dark:bg-red-500/20 text-red-700 dark:text-red-400`:Z7(t.file_type)?`bg-teal-100 dark:bg-teal-500/20 text-teal-700 dark:text-teal-400`:`bg-bambu-gray/20 text-bambu-gray`}`,children:t.file_type.toUpperCase()})}),(0,G.jsx)(`div`,{className:`text-sm text-bambu-gray`,children:Gd(t.file_size)}),(0,G.jsx)(`div`,{className:`text-sm text-bambu-gray`,children:t.print_count>0?`${t.print_count}x`:`-`}),(0,G.jsx)(`div`,{className:`min-w-0`,...e9,children:!t.tags||t.tags.length===0?(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray/50`,children:`-`}):(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:t.tags.map(e=>(0,G.jsxs)(`button`,{type:`button`,onClick:()=>tt(e.id),className:`inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded-full text-[10px] bg-bambu-green/10 text-bambu-green hover:bg-bambu-green/20 transition-colors max-w-full`,title:e.name,children:[(0,G.jsx)(xu,{className:`w-2.5 h-2.5 flex-shrink-0`}),(0,G.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id))})}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,...e9,children:[T5(t)&&(0,G.jsx)(G.Fragment,{children:(0,G.jsx)(`button`,{onClick:()=>r(`queue:create`)&&B(t),className:`p-1.5 rounded transition-colors ${r(`queue:create`)?`hover:bg-bambu-dark text-bambu-gray hover:text-bambu-green`:`text-bambu-gray/50 cursor-not-allowed`}`,title:r(`queue:create`)?e(`common.print`):e(`fileManager.noPermissionAddToQueue`),disabled:!r(`queue:create`),children:(0,G.jsx)(Ml,{className:`w-4 h-4`})})}),E5(t,!!Ue?.use_slicer_api,We)&&(0,G.jsx)(`button`,{onClick:()=>{Ke()&&(Ue?.use_slicer_api?ee:Ge)(t)},className:`p-1.5 rounded transition-colors ${Ke()?`hover:bg-bambu-dark text-bambu-gray hover:text-bambu-green`:`text-bambu-gray/50 cursor-not-allowed`}`,title:Ke()?e(`slice.action`):Ue?.use_slicer_api?e(`fileManager.noPermissionSlice`):e(`fileManager.noPermissionDownload`),disabled:!Ke(),children:Ue?.use_slicer_api?(0,G.jsx)(js,{className:`w-4 h-4`}):(0,G.jsx)(Xs,{className:`w-4 h-4`})}),(Ue?.use_slicer_api??!1)&&E5(t,!0,We)&&(0,G.jsx)(`button`,{onClick:()=>r(`pipelines:run`)&&ne(t),className:`p-1.5 rounded transition-colors ${r(`pipelines:run`)?`hover:bg-bambu-dark text-bambu-gray hover:text-bambu-green`:`text-bambu-gray/50 cursor-not-allowed`}`,title:r(`pipelines:run`)?e(`library.runWithPipeline.actionLabel`,`Run with pipeline`):e(`library.runWithPipeline.noPermission`,`You do not have permission to run pipelines`),disabled:!r(`pipelines:run`),children:(0,G.jsx)(Dl,{className:`w-4 h-4`})}),t9(t)&&(0,G.jsx)(`button`,{onClick:()=>St(t),className:`p-1.5 rounded transition-colors ${r(`library:read`)?`hover:bg-bambu-dark text-bambu-gray hover:text-bambu-green`:`text-bambu-gray/50 cursor-not-allowed`}`,title:r(`library:read`)?e(`fileManager.preview3d`):e(`fileManager.noPermissionPreview`),disabled:!r(`library:read`),children:(0,G.jsx)(Go,{className:`w-4 h-4`})}),!t9(t)&&$7(t)&&(0,G.jsx)(`button`,{onClick:()=>St(t),className:`p-1.5 rounded transition-colors ${r(`library:read`)?`hover:bg-bambu-dark text-bambu-gray hover:text-bambu-green`:`text-bambu-gray/50 cursor-not-allowed`}`,title:r(`library:read`)?e(`fileManager.preview.open`):e(`fileManager.noPermissionPreview`),disabled:!r(`library:read`),children:g1e(t.file_type)}),(0,G.jsx)(`button`,{onClick:()=>r(`library:read`)&&Pt(t.id),className:`p-1.5 rounded transition-colors ${r(`library:read`)?`hover:bg-bambu-dark text-bambu-gray hover:text-white`:`text-bambu-gray/50 cursor-not-allowed`}`,title:r(`library:read`)?e(`common.download`):e(`fileManager.noPermissionDownload`),disabled:!r(`library:read`),children:(0,G.jsx)(Us,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{onClick:()=>r(`library:read`)&&pe(t),className:`p-1.5 rounded transition-colors ${r(`library:read`)?`hover:bg-bambu-dark text-bambu-gray hover:text-white`:`text-bambu-gray/50 cursor-not-allowed`}`,title:r(`library:read`)?e(`fileManager.details.title`):e(`fileManager.noPermissionPreview`),disabled:!r(`library:read`),children:(0,G.jsx)(Rc,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{onClick:()=>a(`library`,`update`,t.created_by_id)&&ie({type:`file`,id:t.id,name:t.filename}),className:`p-1.5 rounded transition-colors ${a(`library`,`update`,t.created_by_id)?`hover:bg-bambu-dark text-bambu-gray hover:text-white`:`text-bambu-gray/50 cursor-not-allowed`}`,title:a(`library`,`update`,t.created_by_id)?e(`common.rename`):e(`fileManager.noPermissionRenameFile`),disabled:!a(`library`,`update`,t.created_by_id),children:(0,G.jsx)(wl,{className:`w-4 h-4`})}),_1e(t.file_type)&&(0,G.jsx)(`button`,{onClick:()=>a(`library`,`update`,t.created_by_id)&&xt.mutate(t.id),className:`p-1.5 rounded transition-colors ${a(`library`,`update`,t.created_by_id)?`hover:bg-bambu-dark text-bambu-gray hover:text-bambu-green`:`text-bambu-gray/50 cursor-not-allowed`}`,title:a(`library`,`update`,t.created_by_id)?e(`fileManager.generateThumbnail`):e(`fileManager.noPermissionGenerateThumbnail`),disabled:xt.isPending||!a(`library`,`update`,t.created_by_id),children:(0,G.jsx)(Ic,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{onClick:()=>a(`library`,`delete`,t.created_by_id)&&R({type:`file`,id:t.id}),className:`p-1.5 rounded transition-colors ${a(`library`,`delete`,t.created_by_id)?`hover:bg-bambu-dark text-bambu-gray hover:text-red-700 dark:hover:text-red-400`:`text-bambu-gray/50 cursor-not-allowed`}`,title:a(`library`,`delete`,t.created_by_id)?e(`common.delete`):e(`fileManager.noPermissionDeleteFile`),disabled:!a(`library`,`delete`,t.created_by_id),children:(0,G.jsx)(ju,{className:`w-4 h-4`})})]})]},t.id))]})})]}),u!==null&&(0,G.jsx)(i1e,{folderId:u})]})]}),_&&(0,G.jsx)(v1e,{parentId:u,onClose:()=>v(!1),onSave:e=>lt.mutate(e),isLoading:lt.isPending,t:e}),y&&(0,G.jsx)(y1e,{onClose:()=>b(!1),onSave:e=>ut.mutate(e),isLoading:ut.isPending,t:e}),x&&qe&&(0,G.jsx)(C1e,{folders:qe,selectedFiles:h,currentFolderId:u,onClose:()=>S(!1),onMove:e=>gt.mutate({fileIds:h,folderId:e}),isLoading:gt.isPending,t:e}),C&&(0,G.jsx)(BU,{folderId:u,onClose:()=>{w(!1),E([])},onUploadComplete:At,initialFiles:T.length>0?T:void 0}),D&&(0,G.jsx)(c1e,{onClose:()=>O(!1)}),(0,G.jsx)(a1e,{open:k,onClose:()=>A(!1),onPickTag:e=>{N.includes(e)||P(t=>[...t,e])}}),(0,G.jsx)(Rqe,{open:j,fileIds:h,onClose:()=>M(!1)}),F&&(0,G.jsx)(w1e,{folder:F,onClose:()=>I(null),onLink:e=>_t.mutate({id:F.id,data:e}),isLoading:_t.isPending,t:e}),L&&(0,G.jsx)(af,{title:L.type===`folder`?e(`fileManager.deleteFolder`):L.type===`bulk`?e(`fileManager.deleteFilesCount`,{count:L.count}):e(`fileManager.deleteFile`),message:L.type===`folder`?e(`fileManager.deleteFolderConfirm`):L.type===`bulk`?e(`fileManager.deleteFilesConfirm`,{count:L.count}):e(`fileManager.deleteFileConfirm`),confirmText:e(`common.delete`),variant:`danger`,isLoading:It,loadingText:e(`fileManager.deleting`),onConfirm:Ft,onCancel:()=>R(null)}),z&&(!z.variant_group_id||Tt!==void 0)&&(0,G.jsx)(Rm,{mode:`create`,libraryFileId:Et?.[0]?.id??z.id,variantFiles:Et,archiveName:Et&&Et.length>1?`${Et[0].filename} ${e(`common.plusNMore`,{count:Et.length-1})}`:z.print_name||z.filename,onClose:()=>B(null),onSuccess:()=>{B(null),g([]),t.invalidateQueries({queryKey:[`library-files`]}),t.invalidateQueries({queryKey:[`queue`]}),t.invalidateQueries({queryKey:[`archives`]})}}),V&&(0,G.jsx)(LW,{source:{kind:`libraryFile`,id:V.id,filename:V.filename},onClose:()=>ee(null)}),te&&(0,G.jsx)(BW,{source:{kind:`libraryFile`,id:te.id,filename:te.filename},onClose:()=>ne(null)}),se&&(0,G.jsx)(Lqe,{libraryFileId:se.id,title:se.print_name||se.filename,fileType:se.file_type,onClose:()=>H(null),onSnapshot:Q7(se.file_type)?Nt(se):void 0,onSliceWithBambuddy:E5(se,!0,We)&&r(`library:upload`)?()=>{let e=se;H(null),ee(e)}:void 0}),(ce||ue||me)&&(0,G.jsxs)(f.Suspense,{fallback:null,children:[ce&&(0,G.jsx)(l1e,{libraryFileId:ce.id,filename:ce.print_name||ce.filename,fileSize:ce.file_size,onClose:()=>le(null),onSnapshot:Nt(ce)}),ue&&(0,G.jsx)(u1e,{libraryFileId:ue.id,filename:ue.print_name||ue.filename,fileType:ue.file_type,fileSize:ue.file_size,onClose:()=>de(null),onSnapshot:Nt(ue)}),me&&(0,G.jsx)(d1e,{libraryFileId:me.id,filename:me.print_name||me.filename,fileSize:me.file_size,onClose:()=>he(null)})]}),fe&&(0,G.jsx)(o1e,{file:fe,canEdit:a(`library`,`update`,fe.created_by_id),onClose:()=>pe(null)}),re&&(0,G.jsx)(S1e,{type:re.type,currentName:re.name,onClose:()=>ie(null),onSave:e=>{re.type===`file`?vt.mutate({id:re.id,filename:e}):yt.mutate({id:re.id,name:e})},isLoading:vt.isPending||yt.isPending,t:e})]})}function O1e(e){let t=$f(e);if(!t)return``;let n=Math.ceil((t.getTime()-Date.now())/(1e3*60*60*24));return n<=0?`any moment`:n===1?`1 day`:`${n} days`}function k1e(e){let t=$f(e);return t?t.toLocaleString():e}function A1e(){let{t:e}=U(),t=$n(),n=no(),{showToast:r}=qd(),{hasPermission:i,authEnabled:a}=Nd(),[o,s]=(0,f.useState)(null),[c,l]=(0,f.useState)(new Set),u=!a||i(`library:purge`),d=K({queryKey:[`library-trash`],queryFn:()=>Z.listLibraryTrash(200,0)}),p=K({queryKey:[`library-trash-settings`],queryFn:()=>Z.getLibraryTrashSettings(),enabled:u}),[m,h]=(0,f.useState)(null);(0,f.useEffect)(()=>{p.data&&m===null&&h(p.data.retention_days)},[p.data,m]);let g=q({mutationFn:e=>{let t=p.data;return Z.updateLibraryTrashSettings({retention_days:e,auto_purge_enabled:t?.auto_purge_enabled??!1,auto_purge_days:t?.auto_purge_days??90,auto_purge_include_never_printed:t?.auto_purge_include_never_printed??!0})},onSuccess:t=>{r(e(`libraryTrash.toast.retentionSaved`,{days:t.retention_days}),`success`),n.invalidateQueries({queryKey:[`library-trash-settings`]}),n.invalidateQueries({queryKey:[`library-trash`]})},onError:t=>r(t.message||e(`libraryTrash.toast.retentionFailed`),`error`)}),_=q({mutationFn:e=>Z.restoreLibraryTrash(e),onSuccess:()=>{r(e(`libraryTrash.toast.restored`),`success`),n.invalidateQueries({queryKey:[`library-trash`]}),n.invalidateQueries({queryKey:[`library-trash-count`]}),n.invalidateQueries({queryKey:[`library-files`]}),n.invalidateQueries({queryKey:[`library-folders`]})},onError:t=>r(t.message||e(`libraryTrash.toast.restoreFailed`),`error`)}),v=q({mutationFn:e=>Z.hardDeleteLibraryTrash(e),onSuccess:()=>{r(e(`libraryTrash.toast.purged`),`success`),n.invalidateQueries({queryKey:[`library-trash`]}),n.invalidateQueries({queryKey:[`library-trash-count`]})},onError:t=>r(t.message||e(`libraryTrash.toast.purgeFailed`),`error`)}),y=q({mutationFn:()=>Z.emptyLibraryTrash(),onSuccess:t=>{r(e(`libraryTrash.toast.emptied`,{count:t.deleted}),`success`),n.invalidateQueries({queryKey:[`library-trash`]}),n.invalidateQueries({queryKey:[`library-trash-count`]})},onError:t=>r(t.message||e(`libraryTrash.toast.emptyFailed`),`error`)}),b=q({mutationFn:e=>Promise.all(e.map(e=>Z.restoreLibraryTrash(e))),onSuccess:(t,i)=>{r(e(`libraryTrash.toast.bulkRestored`,{count:i.length}),`success`),l(new Set),n.invalidateQueries({queryKey:[`library-trash`]}),n.invalidateQueries({queryKey:[`library-trash-count`]}),n.invalidateQueries({queryKey:[`library-files`]}),n.invalidateQueries({queryKey:[`library-folders`]})},onError:t=>r(t.message||e(`libraryTrash.toast.restoreFailed`),`error`)}),x=q({mutationFn:e=>Promise.all(e.map(e=>Z.hardDeleteLibraryTrash(e))),onSuccess:(t,i)=>{r(e(`libraryTrash.toast.bulkPurged`,{count:i.length}),`success`),l(new Set),n.invalidateQueries({queryKey:[`library-trash`]}),n.invalidateQueries({queryKey:[`library-trash-count`]})},onError:t=>r(t.message||e(`libraryTrash.toast.purgeFailed`),`error`)}),S=(0,f.useMemo)(()=>d.data?.items??[],[d.data?.items]),C=d.data?.retention_days??30,w=(0,f.useMemo)(()=>S.reduce((e,t)=>e+t.file_size,0),[S]),T=S.length>0&&S.every(e=>c.has(e.id)),E=c.size>0&&!T,D=e=>{l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return(0,G.jsxs)(`div`,{className:`p-6 max-w-screen-2xl mx-auto`,children:[(0,G.jsx)(`div`,{className:`flex items-center gap-3 mb-4`,children:(0,G.jsxs)(Ci,{to:`/files`,className:`inline-flex items-center gap-1 text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200`,children:[(0,G.jsx)(jo,{className:`w-4 h-4`}),` `,e(`libraryTrash.backToFiles`)]})}),(0,G.jsxs)(`div`,{className:`flex items-start justify-between mb-6 gap-4 flex-wrap`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`text-2xl font-bold text-gray-900 dark:text-gray-100`,children:e(`libraryTrash.title`)}),(0,G.jsx)(`p`,{className:`text-sm text-gray-600 dark:text-gray-400 mt-1`,children:e(u?`libraryTrash.subtitleAdmin`:`libraryTrash.subtitleUser`,{days:C})})]}),S.length>0&&(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>s({type:`empty`}),className:`text-red-600 dark:text-red-400`,children:[(0,G.jsx)(ju,{className:`w-4 h-4 mr-1`}),e(`libraryTrash.emptyTrash`)]})]}),u&&p.data&&(0,G.jsxs)(`div`,{className:`mb-4 border border-gray-200 dark:border-gray-700 rounded-lg p-3 flex items-center gap-3 bg-gray-50 dark:bg-gray-800/40`,children:[(0,G.jsx)(`label`,{htmlFor:`retention-days`,className:`text-sm font-medium text-gray-700 dark:text-gray-300`,children:e(`libraryTrash.retentionLabel`)}),(0,G.jsx)(`input`,{id:`retention-days`,type:`number`,min:1,max:365,value:m??p.data.retention_days,onChange:e=>h(Math.max(1,Math.min(365,parseInt(e.target.value||`0`,10)||0))),className:`w-20 rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-sm px-2 py-1 text-gray-900 dark:text-gray-100`}),(0,G.jsx)(`span`,{className:`text-sm text-gray-600 dark:text-gray-400`,children:e(`libraryTrash.days`)}),(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>m!=null&&g.mutate(m),disabled:g.isPending||m==null||m===p.data.retention_days,className:`ml-auto`,children:[(0,G.jsx)(Vl,{className:`w-4 h-4 mr-1`}),e(`common.save`)]})]}),d.isLoading?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-gray-500 dark:text-gray-400`,children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),` `,e(`libraryTrash.loading`)]}):S.length===0?(0,G.jsx)(`div`,{className:`border border-dashed border-gray-300 dark:border-gray-700 rounded-lg p-12 text-center`,children:(0,G.jsx)(`p`,{className:`text-gray-500 dark:text-gray-400`,children:e(`libraryTrash.empty`)})}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,G.jsx)(`div`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:e(`libraryTrash.summary`,{count:S.length,size:Gd(w)})}),c.size>0&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,G.jsx)(`span`,{className:`text-gray-600 dark:text-gray-400`,children:e(`libraryTrash.selectionCount`,{count:c.size})}),(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>b.mutate(Array.from(c)),disabled:b.isPending,children:[(0,G.jsx)(Rl,{className:`w-4 h-4 mr-1`}),e(`libraryTrash.bulkRestore`)]}),(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>s({type:`bulkDelete`,count:c.size}),disabled:x.isPending,className:`text-red-600 dark:text-red-400`,children:[(0,G.jsx)(ju,{className:`w-4 h-4 mr-1`}),e(`libraryTrash.bulkPurge`)]})]})]}),(0,G.jsx)(`div`,{className:`border border-gray-200 dark:border-gray-700 rounded-lg overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,G.jsx)(`thead`,{className:`bg-gray-50 dark:bg-gray-800 text-left text-gray-600 dark:text-gray-300`,children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{className:`px-3 py-2 w-10`,children:(0,G.jsx)(`input`,{type:`checkbox`,checked:T,ref:e=>{e&&(e.indeterminate=E)},onChange:()=>{l(e=>e.size===S.length?new Set:new Set(S.map(e=>e.id)))},"aria-label":e(`libraryTrash.selectAll`),className:`rounded border-gray-300 cursor-pointer`})}),(0,G.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`libraryTrash.col.filename`)}),(0,G.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`libraryTrash.col.folder`)}),(0,G.jsx)(`th`,{className:`px-3 py-2 font-medium text-right`,children:e(`libraryTrash.col.size`)}),(0,G.jsx)(`th`,{className:`px-3 py-2 font-medium whitespace-nowrap`,children:e(`libraryTrash.col.deleted`)}),(0,G.jsx)(`th`,{className:`px-3 py-2 font-medium whitespace-nowrap`,children:e(`libraryTrash.col.autoPurge`)}),u&&(0,G.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`libraryTrash.col.owner`)}),(0,G.jsx)(`th`,{className:`px-3 py-2 font-medium text-right`,children:e(`libraryTrash.col.actions`)})]})}),(0,G.jsx)(`tbody`,{className:`divide-y divide-gray-100 dark:divide-gray-800`,children:S.map(t=>(0,G.jsxs)(`tr`,{className:`hover:bg-gray-50 dark:hover:bg-gray-800/50`,children:[(0,G.jsx)(`td`,{className:`px-3 py-2`,children:(0,G.jsx)(`input`,{type:`checkbox`,checked:c.has(t.id),onChange:()=>D(t.id),"aria-label":e(`libraryTrash.selectOne`,{filename:t.filename}),className:`rounded border-gray-300 cursor-pointer`})}),(0,G.jsx)(`td`,{className:`px-3 py-2 text-gray-900 dark:text-gray-100 truncate max-w-md`,title:t.filename,children:t.filename}),(0,G.jsx)(`td`,{className:`px-3 py-2 text-gray-600 dark:text-gray-400`,children:t.folder_name??`—`}),(0,G.jsx)(`td`,{className:`px-3 py-2 text-right text-gray-600 dark:text-gray-400 tabular-nums whitespace-nowrap`,children:Gd(t.file_size)}),(0,G.jsx)(`td`,{className:`px-3 py-2 text-gray-600 dark:text-gray-400 whitespace-nowrap`,children:k1e(t.deleted_at)}),(0,G.jsx)(`td`,{className:`px-3 py-2 text-gray-600 dark:text-gray-400 whitespace-nowrap`,children:(0,G.jsx)(`span`,{title:k1e(t.auto_purge_at),children:e(`libraryTrash.autoPurgeIn`,{when:O1e(t.auto_purge_at)})})}),u&&(0,G.jsx)(`td`,{className:`px-3 py-2 text-gray-600 dark:text-gray-400`,children:t.created_by_username??`—`}),(0,G.jsxs)(`td`,{className:`px-3 py-2 text-right whitespace-nowrap`,children:[(0,G.jsxs)(`button`,{onClick:()=>_.mutate(t.id),disabled:_.isPending,className:`inline-flex items-center gap-1 px-2 py-1 text-xs text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300`,children:[(0,G.jsx)(Rl,{className:`w-3.5 h-3.5`}),e(`libraryTrash.restore`)]}),(0,G.jsxs)(`button`,{onClick:()=>s({type:`delete`,id:t.id,filename:t.filename}),disabled:v.isPending,className:`inline-flex items-center gap-1 px-2 py-1 text-xs text-red-600 hover:text-red-800 dark:text-red-400 dark:hover:text-red-300 ml-2`,children:[(0,G.jsx)(ju,{className:`w-3.5 h-3.5`}),e(`libraryTrash.purgeNow`)]})]})]},t.id))})]})})]}),o&&(0,G.jsx)(af,{onCancel:()=>s(null),onConfirm:()=>{o&&(o.type===`delete`?v.mutate(o.id):o.type===`bulkDelete`?x.mutate(Array.from(c)):y.mutate(),s(null))},title:o.type===`delete`?e(`libraryTrash.confirm.purgeTitle`):o.type===`bulkDelete`?e(`libraryTrash.confirm.bulkPurgeTitle`):e(`libraryTrash.confirm.emptyTitle`),message:o.type===`delete`?e(`libraryTrash.confirm.purgeBody`,{filename:o.filename}):o.type===`bulkDelete`?e(`libraryTrash.confirm.bulkPurgeBody`,{count:o.count}):e(`libraryTrash.confirm.emptyBody`,{count:S.length}),confirmText:e(`libraryTrash.confirm.cta`),variant:`danger`}),d.isError&&(0,G.jsxs)(`div`,{className:`mt-4 text-sm text-red-600 dark:text-red-400`,children:[d.error?.message??e(`libraryTrash.loadError`),(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>t(`/files`),className:`ml-3`,children:e(`libraryTrash.backToFiles`)})]})]})}function j1e(e){return e.includes(`/camera/`)}function M1e(e,t,n){let r=0;return e.querySelectorAll(`img[src*="/api/v1/"], video[src*="/api/v1/"]`).forEach(e=>{let i=e.getAttribute(`src`)||``,a=j1e(i)?n:t;if(!a)return;let o=`token=${encodeURIComponent(a)}`;if(i.includes(o))return;let s=i.replace(/([?&])token=[^&]*(&|$)/,(e,t,n)=>n===`&`?t:``);e.src=`${s}${s.includes(`?`)?`&`:`?`}${o}`,r+=1}),r}function N1e(){let{authEnabled:e,user:t,loading:n,hasPermission:r}=Nd(),i=no(),a=(0,f.useRef)(!1),o=!n&&(!e||t!==null),{data:s}=K({queryKey:[`media-token`,t?.id??null],queryFn:()=>Z.getMediaToken(),enabled:o,staleTime:3e3*1e3,refetchInterval:3e3*1e3}),c=!e||r(`camera:view`),{data:l}=K({queryKey:[`camera-stream-token`,t?.id??null],queryFn:()=>Z.getCameraStreamToken(),enabled:o&&c,staleTime:3e3*1e3,refetchInterval:3e3*1e3}),u=s?.token??null,d=l?.token??null;(0,f.useEffect)(()=>(fd(u),ud(d),(u||d)&&M1e(document,u,d),()=>{fd(null),ud(null)}),[u,d]),(0,f.useEffect)(()=>{if(!e)return;let t=e=>{let t=e.target;if(!(t instanceof HTMLImageElement||t instanceof HTMLVideoElement))return;let n=t.src||``,r=j1e(n),o=r?dd():pd();!o||!n.includes(`token=${encodeURIComponent(o)}`)||a.current||(a.current=!0,i.invalidateQueries({queryKey:r?[`camera-stream-token`]:[`media-token`]}),setTimeout(()=>{a.current=!1},5e3))};return document.addEventListener(`error`,t,!0),()=>document.removeEventListener(`error`,t,!0)},[e,i])}var n9=5,P1e=2e3,F1e=3e4,I1e=5e3;function L1e(){let{t:e}=U(),t=no(),{showToast:n}=qd(),{hasPermission:r,authEnabled:i,user:a}=Nd(),{printerId:o}=ir(),s=parseInt(o||`0`,10),[c]=ji(),l=parseInt(c.get(`fps`)||`15`,10),u=Math.min(Math.max(isNaN(l)?15:l,1),30);N1e();let{data:d,isPending:p}=K({queryKey:[`camera-stream-token`,a?.id??null],queryFn:()=>Z.getCameraStreamToken(),enabled:i?!!a:!0,staleTime:3e3*1e3}),m=d?.token??dd(),[h,g]=(0,f.useState)(`stream`),[_,v]=(0,f.useState)(!1),[y,b]=(0,f.useState)(!1),[x,S]=(0,f.useState)(!1),[C,w]=(0,f.useState)(!0),[T,E]=(0,f.useState)(Date.now()),[D,O]=(0,f.useState)(!1),[k,A]=(0,f.useState)(!1),[j,M]=(0,f.useState)(0),[N,P]=(0,f.useState)(!1),[F,I]=(0,f.useState)(0),[L,R]=(0,f.useState)(1),[z,B]=(0,f.useState)({x:0,y:0}),[V,ee]=(0,f.useState)(!1),[te,ne]=(0,f.useState)({x:0,y:0}),[re,ie]=(0,f.useState)(null),[ae,oe]=(0,f.useState)(null),se=(0,f.useRef)(null),H=(0,f.useRef)(null),ce=(0,f.useRef)(null),le=(0,f.useRef)(null),ue=(0,f.useRef)(null),de=(0,f.useRef)(0),{data:fe}=K({queryKey:[`printer`,s],queryFn:()=>Z.getPrinter(s),enabled:s>0}),{data:pe}=K({queryKey:[`printerStatus`,s],queryFn:()=>Z.getPrinterStatus(s),refetchInterval:3e4,enabled:s>0}),me=q({mutationFn:e=>Z.setChamberLight(s,e),onMutate:async e=>{await t.cancelQueries({queryKey:[`printerStatus`,s]});let n=t.getQueryData([`printerStatus`,s]);return t.setQueryData([`printerStatus`,s],t=>({...t,chamber_light:e})),{previousStatus:n}},onSuccess:(e,t)=>{n(`Chamber light ${t?`on`:`off`}`)},onError:(r,i,a)=>{a?.previousStatus&&t.setQueryData([`printerStatus`,s],a.previousStatus),n(r.message||e(`printers.toast.failedToControlChamberLight`),`error`)}}),he=(pe?.state===`RUNNING`||pe?.state===`PAUSE`)&&(pe?.printable_objects_count??0)>=2;(0,f.useEffect)(()=>(fe&&(document.title=`${fe.name} - Camera`),()=>{document.title=`Bambuddy`}),[fe]);let ge=(0,f.useRef)(!1);(0,f.useEffect)(()=>{let e=`/api/v1/printers/${s}/camera/stop`;ge.current=!1;let t=()=>{if(s>0&&!ge.current){ge.current=!0;let t={},n=sd();n&&(t.Authorization=`Bearer ${n}`),fetch(e,{method:`POST`,keepalive:!0,headers:t}).catch(()=>{})}},n=()=>{t()};window.addEventListener(`beforeunload`,n);let r=se.current;return()=>{window.removeEventListener(`beforeunload`,n),r&&(r.src=``),t()}},[s]),(0,f.useEffect)(()=>{if(C&&!D){let e=setTimeout(()=>{w(!1)},h===`stream`?3e3:2e4);return()=>clearTimeout(e)}},[h,C,T,D]),(0,f.useEffect)(()=>{let e=()=>{A(!!document.fullscreenElement),R(1),B({x:0,y:0}),h===`stream`&&!D&&(se.current&&(se.current.src=``),setTimeout(()=>{w(!0),E(Date.now())},200))};return document.addEventListener(`fullscreenchange`,e),()=>document.removeEventListener(`fullscreenchange`,e)},[h,D]),(0,f.useEffect)(()=>{let e,t=()=>{clearTimeout(e),e=setTimeout(()=>{localStorage.setItem(`cameraWindowState`,JSON.stringify({width:window.outerWidth,height:window.outerHeight,left:window.screenX,top:window.screenY}))},500)};return window.addEventListener(`resize`,t),()=>{clearTimeout(e),window.removeEventListener(`resize`,t)}},[]),(0,f.useEffect)(()=>()=>{ce.current&&clearTimeout(ce.current),le.current&&clearInterval(le.current),ue.current&&clearInterval(ue.current)},[]);let _e=(0,f.useCallback)(()=>{if(j>=n9){P(!1),S(!0);return}let e=Math.min(P1e*2**j,F1e);P(!0),I(Math.ceil(e/1e3)),le.current=setInterval(()=>{I(e=>e<=1?(le.current&&clearInterval(le.current),0):e-1)},1e3),ce.current=setTimeout(()=>{M(e=>e+1),P(!1),w(!0),S(!1),se.current&&(se.current.src=``),E(Date.now())},e)},[j]);(0,f.useEffect)(()=>{if(h!==`stream`||C||N||D){ue.current&&=(clearInterval(ue.current),null);return}return de.current=0,ue.current=setInterval(async()=>{try{let e=await Z.getCameraStatus(s);if(!(e.stalled||!e.active&&!x)){de.current=0;return}if(de.current+=1,de.current<2)return;de.current=0,console.log(`Stream issue detected: stalled=${e.stalled}, active=${e.active}, reconnecting...`),ue.current&&=(clearInterval(ue.current),null),w(!1),_e()}catch{}},I1e),()=>{ue.current&&=(clearInterval(ue.current),null)}},[h,C,x,N,D,s,_e]);let ve=()=>{w(!1),h===`stream`&&j{if(w(!1),S(!1),M(0),de.current=0,P(!1),ce.current&&clearTimeout(ce.current),le.current&&clearInterval(le.current),se.current&&!localStorage.getItem(`cameraWindowState`)){let e=se.current,t=e.naturalWidth,n=e.naturalHeight;if(t>0&&n>0){let e=window.outerWidth-window.innerWidth,r=window.outerHeight-window.innerHeight,i=t+16+e,a=n+45+16+r;try{window.resizeTo(i,a)}catch{}}}},be=()=>{if(s>0){let e={},t=sd();t&&(e.Authorization=`Bearer ${t}`),fetch(`/api/v1/printers/${s}/camera/stop`,{method:`POST`,headers:e}).catch(()=>{})}},xe=e=>{h===e||D||(O(!0),w(!0),S(!1),M(0),P(!1),R(1),B({x:0,y:0}),ce.current&&clearTimeout(ce.current),le.current&&clearInterval(le.current),se.current&&(se.current.src=``),h===`stream`&&be(),setTimeout(()=>{g(e),E(Date.now()),O(!1)},100))},Se=()=>{D||(O(!0),w(!0),S(!1),M(0),P(!1),ce.current&&clearTimeout(ce.current),le.current&&clearInterval(le.current),se.current&&(se.current.src=``),h===`stream`&&be(),setTimeout(()=>{E(Date.now()),O(!1)},100))},Ce=()=>{H.current&&(document.fullscreenElement?document.exitFullscreen():H.current.requestFullscreen())},we=()=>{R(e=>Math.min(e+.5,4))},Te=()=>{R(e=>{let t=Math.max(e-.5,1);return t===1&&B({x:0,y:0}),t})},Ee=e=>{e.preventDefault(),e.deltaY<0?we():Te()},De=e=>{L>1&&(e.preventDefault(),ee(!0),ne({x:e.clientX-z.x,y:e.clientY-z.y}))},Oe=(0,f.useCallback)(()=>{if(!H.current)return{x:300,y:200};let e=H.current.getBoundingClientRect(),t=e.width*(L-1)/2,n=e.height*(L-1)/2;return{x:Math.max(50,t),y:Math.max(50,n)}},[L]),ke=e=>{if(V&&L>1){let t=e.clientX-te.x,n=e.clientY-te.y,r=Oe();B({x:Math.max(-r.x,Math.min(r.x,t)),y:Math.max(-r.y,Math.min(r.y,n))})}},Ae=()=>{ee(!1)},je=e=>{if(e.length<2)return 0;let t=e[0].clientX-e[1].clientX,n=e[0].clientY-e[1].clientY;return Math.sqrt(t*t+n*n)},Me=e=>e.length<2?{x:e[0].clientX,y:e[0].clientY}:{x:(e[0].clientX+e[1].clientX)/2,y:(e[0].clientY+e[1].clientY)/2},Ne=e=>{e.touches.length===2?(e.preventDefault(),ie(je(e.touches)),oe(Me(e.touches))):e.touches.length===1&&L>1&&(e.preventDefault(),ee(!0),ne({x:e.touches[0].clientX-z.x,y:e.touches[0].clientY-z.y}))},Pe=e=>{if(e.touches.length===2&&re!==null){e.preventDefault();let t=je(e.touches),n=t/re;R(e=>{let t=Math.max(1,Math.min(4,e*n));return t===1&&B({x:0,y:0}),t}),ie(t);let r=Me(e.touches);if(ae){let e=Oe();B(t=>({x:Math.max(-e.x,Math.min(e.x,t.x+(r.x-ae.x))),y:Math.max(-e.y,Math.min(e.y,t.y+(r.y-ae.y)))}))}oe(r)}else if(e.touches.length===1&&V&&L>1){e.preventDefault();let t=e.touches[0].clientX-te.x,n=e.touches[0].clientY-te.y,r=Oe();B({x:Math.max(-r.x,Math.min(r.x,t)),y:Math.max(-r.y,Math.min(r.y,n))})}},Fe=e=>{e.touches.length<2&&(ie(null),oe(null)),e.touches.length===0&&ee(!1)},Ie=()=>{R(1),B({x:0,y:0})},Le=D||!m&&(i||p)?``:(e=>m?`${e}&token=${encodeURIComponent(m)}`:md(e))(h===`stream`?`/api/v1/printers/${s}/camera/stream?fps=${u}&t=${T}`:`/api/v1/printers/${s}/camera/snapshot?t=${T}`),Re=C||D||N;return s?(0,G.jsxs)(`div`,{ref:H,className:`min-h-screen bg-black flex flex-col`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 bg-bambu-dark-secondary border-b border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`h1`,{className:`text-sm font-medium text-white flex items-center gap-2`,children:[(0,G.jsx)($o,{className:`w-4 h-4`}),fe?.name||`Printer ${s}`]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex bg-bambu-dark rounded p-0.5`,children:[(0,G.jsx)(`button`,{onClick:()=>xe(`stream`),disabled:Re,className:`px-3 py-1 text-xs rounded transition-colors ${h===`stream`?`bg-bambu-green text-white`:`text-bambu-gray hover:text-white disabled:opacity-50`}`,children:e(`camera.live`)}),(0,G.jsx)(`button`,{onClick:()=>xe(`snapshot`),disabled:Re,className:`px-3 py-1 text-xs rounded transition-colors ${h===`snapshot`?`bg-bambu-green text-white`:`text-bambu-gray hover:text-white disabled:opacity-50`}`,children:e(`camera.snapshot`)})]}),(0,G.jsx)(`button`,{onClick:()=>me.mutate(!pe?.chamber_light),disabled:!pe?.connected||me.isPending||!r(`printers:control`),className:`p-1.5 rounded disabled:opacity-50 ${pe?.chamber_light?`bg-yellow-500/20 hover:bg-yellow-500/30`:`hover:bg-bambu-dark-tertiary`}`,title:r(`printers:control`)?e(`camera.chamberLight`):e(`printers.permission.noControl`),children:(0,G.jsx)(nE,{on:pe?.chamber_light??!1,className:`w-4 h-4`})}),(0,G.jsx)(`button`,{onClick:()=>v(!0),disabled:!he||!r(`printers:control`),className:`p-1.5 rounded disabled:opacity-50 ${he&&r(`printers:control`)?`hover:bg-bambu-dark-tertiary`:``}`,title:r(`printers:control`)?e(he?`printers.skipObjects.tooltip`:`printers.skipObjects.onlyWhilePrinting`):e(`printers.permission.noControl`),children:(0,G.jsx)(rE,{className:`w-4 h-4 text-bambu-gray`})}),(0,G.jsx)(`button`,{onClick:Se,disabled:Re,className:`p-1.5 hover:bg-bambu-dark-tertiary rounded disabled:opacity-50`,title:e(h===`stream`?`camera.restartStream`:`camera.refreshSnapshot`),children:(0,G.jsx)(Il,{className:`w-4 h-4 text-bambu-gray ${Re?`animate-spin`:``}`})}),(0,G.jsx)(`button`,{onClick:()=>b(!0),className:`p-1.5 hover:bg-bambu-dark-tertiary rounded`,title:e(`camera.diagnose.button`),children:(0,G.jsx)(gu,{className:`w-4 h-4 text-bambu-gray`})}),(0,G.jsx)(`button`,{onClick:Ce,className:`p-1.5 hover:bg-bambu-dark-tertiary rounded`,title:e(k?`camera.exitFullscreen`:`camera.fullscreen`),children:k?(0,G.jsx)(sl,{className:`w-4 h-4 text-bambu-gray`}):(0,G.jsx)(rl,{className:`w-4 h-4 text-bambu-gray`})})]})]}),(0,G.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-2 overflow-hidden`,onWheel:Ee,onMouseMove:ke,onMouseUp:Ae,onMouseLeave:Ae,onTouchStart:Ne,onTouchMove:Pe,onTouchEnd:Fe,style:{touchAction:`none`},children:(0,G.jsxs)(`div`,{className:`relative w-full h-full flex items-center justify-center`,children:[(C||D)&&!N&&(0,G.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-black/50 z-10`,children:(0,G.jsxs)(`div`,{className:`text-center`,children:[(0,G.jsx)(Il,{className:`w-8 h-8 text-bambu-gray animate-spin mx-auto mb-2`}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(h===`stream`?`camera.connectingToCamera`:`camera.capturingSnapshot`)})]})}),N&&(0,G.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-black/80 z-10`,children:(0,G.jsxs)(`div`,{className:`text-center p-4`,children:[(0,G.jsx)(Ju,{className:`w-10 h-10 text-orange-400 mx-auto mb-3`}),(0,G.jsx)(`p`,{className:`text-white mb-2`,children:e(`camera.connectionLost`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mb-3`,children:e(`camera.reconnecting`,{countdown:F,attempt:Math.min(j+1,n9),max:n9})}),(0,G.jsx)(`button`,{onClick:Se,className:`px-4 py-2 bg-bambu-green text-white text-sm rounded hover:bg-bambu-green/80 transition-colors`,children:e(`camera.reconnectNow`)})]})}),x&&!N&&(0,G.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-black z-10`,children:(0,G.jsxs)(`div`,{className:`text-center p-4`,children:[(0,G.jsx)(Pu,{className:`w-12 h-12 text-orange-400 mx-auto mb-3`}),(0,G.jsx)(`p`,{className:`text-white mb-2`,children:e(`camera.cameraUnavailable`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mb-4 max-w-md`,children:e(`camera.cameraUnavailableDesc`)}),(0,G.jsxs)(`div`,{className:`flex gap-2 justify-center`,children:[(0,G.jsx)(`button`,{onClick:Se,className:`px-4 py-2 bg-bambu-green text-white rounded hover:bg-bambu-green/80 transition-colors`,children:e(`camera.retry`)}),(0,G.jsx)(`button`,{onClick:()=>b(!0),className:`px-4 py-2 bg-bambu-dark border border-bambu-dark-tertiary text-bambu-gray hover:text-white rounded transition-colors`,children:e(`camera.diagnose.button`)})]})]})}),(0,G.jsx)(`img`,{ref:se,src:Le,alt:e(`camera.cameraStream`),className:`max-w-full max-h-full object-contain select-none`,style:{transform:`scale(${L}) translate(${z.x/L}px, ${z.y/L}px) rotate(${fe?.camera_rotation||0}deg)`,...fe?.camera_rotation===90||fe?.camera_rotation===270?{maxWidth:`100vh`,maxHeight:`100vw`}:{},cursor:L>1?V?`grabbing`:`grab`:`default`},onError:Le?ve:void 0,onLoad:Le?ye:void 0,onMouseDown:De,draggable:!1},T),(0,G.jsxs)(`div`,{className:`absolute bottom-4 left-4 flex items-center gap-1.5 bg-black/60 rounded-lg px-2 py-1.5`,children:[(0,G.jsx)(`button`,{onClick:Te,disabled:L<=1,className:`p-1.5 hover:bg-white/10 rounded disabled:opacity-30`,title:e(`camera.zoomOut`),children:(0,G.jsx)(nd,{className:`w-4 h-4 text-white`})}),(0,G.jsxs)(`button`,{onClick:Ie,className:`px-2 py-1 text-sm text-white hover:bg-white/10 rounded min-w-[48px]`,title:e(`camera.resetZoom`),children:[Math.round(L*100),`%`]}),(0,G.jsx)(`button`,{onClick:we,disabled:L>=4,className:`p-1.5 hover:bg-white/10 rounded disabled:opacity-30`,title:e(`camera.zoomIn`),children:(0,G.jsx)(ed,{className:`w-4 h-4 text-white`})})]})]})}),(0,G.jsx)(iE,{printerId:s,isOpen:_,onClose:()=>v(!1)}),y&&(0,G.jsx)(aE,{printerId:s,printerName:fe?.name||null,onClose:()=>b(!1)})]}):(0,G.jsx)(`div`,{className:`min-h-screen bg-black flex items-center justify-center`,children:(0,G.jsx)(`p`,{className:`text-white`,children:e(`camera.invalidPrinterId`)})})}var R1e=5e3,z1e=4,B1e=8,V1e=1,H1e=16,U1e=2,W1e=60;function G1e(e,t,n,r){let i=parseInt(e??``,10);return Number.isFinite(i)?Math.min(r,Math.max(n,i)):t}function K1e(e,t,n,r,i,a){return e.has(t)?G1e(e.get(t),r,i,a):G1e(localStorage.getItem(n),r,i,a)}function q1e(){let{t:e}=U(),t=Xn(),{authEnabled:n,loading:r,user:i}=Nd(),[a]=ji(),o=a.get(`token`),s=o!=null&&o!==``,[c,l]=(0,f.useState)(()=>K1e(a,`maxLive`,`camWallMaxLive`,z1e,V1e,H1e)),[u,d]=(0,f.useState)(()=>K1e(a,`interval`,`camWallSnapshotSec`,B1e,U1e,W1e)),[p,m]=(0,f.useState)(()=>{let e=a.get(`status`)??localStorage.getItem(`camWallStatusMode`);return(s?[`off`,`compact`]:[`off`,`compact`,`full`]).includes(e)?e:`compact`});(0,f.useEffect)(()=>{if(s)return ud(o),()=>ud(null)},[s,o]);let h=K({queryKey:[`camwall-printers`,o],queryFn:()=>Z.getCamWallPrinters(o??void 0),enabled:s,refetchInterval:R1e}),g=K({queryKey:[`printers`],queryFn:()=>Z.getPrinters(),enabled:!s&&!r&&(!n||i!==null),refetchInterval:R1e}),_=(0,f.useMemo)(()=>{let e=new Map;for(let t of h.data??[])e.set(t.id,{connected:t.connected,state:t.state,progress:t.progress,remaining_time:t.remaining_time,layer_num:t.layer_num,total_layers:t.total_layers,hms_errors:t.hms_errors});return e},[h.data]);if(!s&&r)return(0,G.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-bambu-dark text-bambu-gray`,children:e(`common.loading`)});if(!s&&n&&!i)return(0,G.jsx)(Or,{to:`/login`,replace:!0,state:{from:t}});let v=s?h:g,y=s?h.data??[]:g.data??[];return v.isError?(0,G.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-bambu-dark p-6 text-center`,children:(0,G.jsx)(`p`,{className:`max-w-md text-sm text-red-400`,children:e(s?`printers.camWall.page.tokenRejected`:`printers.camWall.page.loadFailed`)})}):(0,G.jsx)(`div`,{className:`min-h-screen bg-bambu-dark p-4`,children:(0,G.jsx)(fE,{printers:y,maxLive:c,snapshotIntervalSec:u,statusMode:p,statuses:s?_:void 0,showSettings:!s,onTileClick:s?void 0:e=>window.open(`/camera/${e}`,`camera-${e}`),onChangeMaxLive:e=>{l(e),localStorage.setItem(`camWallMaxLive`,String(e))},onChangeSnapshotIntervalSec:e=>{d(e),localStorage.setItem(`camWallSnapshotSec`,String(e))},onChangeStatusMode:e=>{m(e),localStorage.setItem(`camWallStatusMode`,e)}})})}function J1e(e,t){let[n,r]=(0,f.useState)(null);return(0,f.useLayoutEffect)(()=>{let n=e.current;if(!t||!n)return;let i=()=>{let{width:e,height:t}=n.getBoundingClientRect();e>0&&t>0&&r(n=>n&&n.width===e&&n.height===t?n:{width:e,height:t})};if(i(),typeof ResizeObserver>`u`)return window.addEventListener(`resize`,i),()=>window.removeEventListener(`resize`,i);let a=new ResizeObserver(i);return a.observe(n),()=>a.disconnect()},[e,t]),t?n:null}function Y1e(e){let{t}=U(),{camera:n,name:r,model:i,filename:a,status:o,state:s,progress:c,layers:l,remaining:u,eta:d,temperatures:p}=e,m=a||o||c!=null||l||u||d||p.length>0,h=n?.rotation??0,g=Math.abs(h%180)===90,_=(0,f.useRef)(null),v=J1e(_,g&&n!=null),y=[{key:`layers`,icon:(0,G.jsx)(Hc,{}),label:t(`streamOverlay.layer`),value:l},{key:`remaining`,icon:(0,G.jsx)(Au,{}),label:t(`streamOverlay.remaining`),value:u},{key:`eta`,icon:(0,G.jsx)(ws,{}),label:t(`streamOverlay.eta`),value:d}].filter(e=>e.value!=null);return(0,G.jsxs)(`div`,{className:`updated-overlay`,"data-size":e.size,"data-state":s,children:[(0,G.jsxs)(`header`,{className:`updated-overlay__header`,children:[(r||i)&&(0,G.jsxs)(`div`,{className:`updated-overlay__identity`,children:[(0,G.jsx)(Ml,{"aria-hidden":`true`}),(0,G.jsxs)(`div`,{children:[r&&(0,G.jsx)(`strong`,{children:r}),i&&(0,G.jsx)(`span`,{children:i})]})]}),(0,G.jsx)(`a`,{className:`updated-overlay__logo`,href:`https://github.com/maziggy/bambuddy`,target:`_blank`,rel:`noopener noreferrer`,children:(0,G.jsx)(`img`,{src:`/img/bambuddy_logo_powered_by.png`,alt:`Bambuddy`})})]}),n&&(0,G.jsx)(`div`,{className:`updated-overlay__camera`,ref:_,children:(0,G.jsx)(`img`,{src:n.url,alt:t(`streamOverlay.cameraStream`),style:{transform:`translate(-50%, -50%) rotate(${h}deg)`,...g&&v?{width:v.height,height:v.width}:{}},onError:n.onError},n.url)}),m&&(0,G.jsxs)(`section`,{className:`updated-overlay__panel`,children:[(a||o)&&(0,G.jsxs)(`div`,{className:`updated-overlay__summary`,children:[a&&(0,G.jsx)(`h1`,{children:a}),o&&(0,G.jsxs)(`div`,{className:`updated-overlay__status`,children:[(0,G.jsx)(`span`,{"aria-hidden":`true`}),o]})]}),c!=null&&(0,G.jsxs)(`div`,{className:`updated-overlay__progress`,children:[(0,G.jsx)(`span`,{children:t(`streamOverlay.progress`)}),(0,G.jsx)(`div`,{role:`progressbar`,"aria-label":t(`streamOverlay.progress`),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":c,children:(0,G.jsx)(`div`,{style:{width:`${c}%`}})}),(0,G.jsxs)(`strong`,{children:[Math.round(c),`%`]})]}),(y.length>0||p.length>0)&&(0,G.jsxs)(`div`,{className:`updated-overlay__readings`,children:[y.length>0&&(0,G.jsx)(`div`,{className:`updated-overlay__stats`,children:y.map(e=>(0,G.jsxs)(`div`,{className:`updated-overlay__reading`,children:[e.icon,(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{children:e.label}),(0,G.jsx)(`strong`,{children:e.value})]})]},e.key))}),p.length>0&&(0,G.jsx)(`div`,{className:`updated-overlay__temperatures`,children:p.map(e=>(0,G.jsxs)(`div`,{className:`updated-overlay__reading`,children:[e.icon,(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{children:e.label}),(0,G.jsxs)(`strong`,{children:[Math.round(e.current),`°C`,e.target!=null&&e.target>0&&Math.round(e.target)!==Math.round(e.current)&&(0,G.jsxs)(`small`,{children:[` / `,Math.round(e.target),`°C`]})]})]})]},e.key))})]})]})]})}function X1e(e,t,n){if(!e)return``;if(!t)return e;let r=t.match(/plate_(\d+)\.gcode/);return r&&parseInt(r[1],10)>1?`${e} — ${n(`printers.plateNumber`,`Plate {{number}}`,{number:r[1]})}`:e}function Z1e(e){let t=e.get(`show`)?.split(`,`)||[`progress`,`layers`,`eta`,`filename`,`status`],n=parseInt(e.get(`fps`)||`15`,10),r=Math.min(Math.max(isNaN(n)?15:n,1),30),i=e.get(`camera`),a=i!==`false`&&i!==`0`;return{size:e.get(`size`)||`medium`,fps:r,updatedArtwork:e.get(`artwork`)===`2`,showCamera:a,showProgress:t.includes(`progress`),showLayers:t.includes(`layers`),showEta:t.includes(`eta`),showFilename:t.includes(`filename`),showStatus:t.includes(`status`),showPrinter:t.includes(`printer`),showModel:t.includes(`model`),showNozzle:t.includes(`nozzle`),showBed:t.includes(`bed`),showChamber:t.includes(`chamber`)}}function Q1e(e,t){if(e.stg_cur_name)return e.stg_cur_name;switch(e.state){case`RUNNING`:return t(`streamOverlay.status.printing`);case`PAUSE`:return t(`streamOverlay.status.paused`);case`FINISH`:return t(`streamOverlay.status.finished`);case`FAILED`:return t(`streamOverlay.status.failed`);case`IDLE`:return t(`streamOverlay.status.idle`);default:return e.state||t(`streamOverlay.status.unknown`)}}function r9(e,t){let n=e[t];return typeof n==`number`?n:null}function $1e({icon:e,label:t,current:n,target:r,sizes:i}){let a=r!=null&&r>0&&Math.round(r)!==Math.round(n);return(0,G.jsxs)(`div`,{className:`flex items-center ${i.gap} text-white/70`,children:[e,(0,G.jsxs)(`span`,{className:i.text,children:[(0,G.jsx)(`span`,{className:`mr-1`,children:t}),(0,G.jsxs)(`span`,{className:`text-white`,children:[Math.round(n),`°C`]}),a&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`mx-1`,children:`/`}),(0,G.jsxs)(`span`,{children:[Math.round(r),`°C`]})]})]})]})}function e0e(e){switch(e){case`small`:return{container:`p-3`,text:`text-sm`,textLarge:`text-lg`,progressHeight:`h-2`,icon:`w-3 h-3`,gap:`gap-2`,logoHeight:`h-12`};case`large`:return{container:`p-6`,text:`text-xl`,textLarge:`text-3xl`,progressHeight:`h-4`,icon:`w-6 h-6`,gap:`gap-4`,logoHeight:`h-24`};default:return{container:`p-4`,text:`text-base`,textLarge:`text-xl`,progressHeight:`h-3`,icon:`w-4 h-4`,gap:`gap-3`,logoHeight:`h-16`}}}function t0e(){let{printerId:e}=ir(),[t]=ji(),{t:n}=U(),r=no(),i=parseInt(e||`0`,10),[a,o]=(0,f.useState)(Date.now()),s=(0,f.useMemo)(()=>Z1e(t),[t]),c=e0e(s.size),l=t.get(`token`),u=l!=null&&l!==``,{data:d}=K({queryKey:[`overlayStatus`,i,l],queryFn:()=>Z.getOverlayStatus(i,l??void 0),enabled:i>0&&u,refetchInterval:2e3}),{data:p}=K({queryKey:[`printer`,i],queryFn:()=>Z.getPrinter(i),enabled:i>0&&!u}),{data:m}=K({queryKey:[`printerStatus`,i],queryFn:()=>Z.getPrinterStatus(i),enabled:i>0&&!u,refetchInterval:2e3}),{data:h}=K({queryKey:[`settings`],queryFn:Z.getSettings,enabled:!u}),g=(0,f.useMemo)(()=>u?d&&{name:d.name,model:d.model,camera_rotation:d.camera_rotation}:p,[u,d,p]),_=[s.showPrinter?g?.name:null,s.showModel?oh(g?.model??null):null].filter(Boolean).join(` · `),v=u?d:m,y=(u?d?.time_format:h?.time_format)||`system`;(0,f.useEffect)(()=>{if(!i||u)return;let e=null,t=!1;return(async()=>{let n;try{n=(await Z.getWebSocketToken()).token}catch(e){let t=e instanceof id?e.status:0;if(t===401||t===403)return}if(t)return;let a=window.location.protocol===`https:`?`wss:`:`ws:`,o=n?`?token=${encodeURIComponent(n)}`:``,s=`${a}//${window.location.host}/api/v1/ws${o}`;e=new WebSocket(s),e.onmessage=e=>{try{let t=JSON.parse(e.data);t.type===`printer_status`&&t.printer_id===i&&r.setQueryData([`printerStatus`,i],t.status)}catch{}},e.onerror=()=>{}})(),()=>{t=!0,e&&e.close()}},[i,u,r]),(0,f.useEffect)(()=>(document.title=g?`${g.name} - ${n(`streamOverlay.title`)}`:n(`streamOverlay.title`),()=>{document.title=`Bambuddy`}),[g,n]);let b=()=>{setTimeout(()=>{o(Date.now())},3e3)};if(!i)return(0,G.jsx)(`div`,{className:`min-h-screen bg-black flex items-center justify-center`,children:(0,G.jsx)(`p`,{className:`text-white`,children:n(`streamOverlay.invalidPrinterId`)})});if(!v)return(0,G.jsx)(`div`,{className:`min-h-screen bg-black flex items-center justify-center`,children:(0,G.jsx)(`p`,{className:`text-gray-400`,children:n(`common.loading`)})});let x=v.state===`RUNNING`||v.state===`PAUSE`,S=v.progress||0,C=v.temperatures??{},w=[];if(s.showNozzle){let e=r9(C,`nozzle`),t=r9(C,`nozzle_2`);e!=null&&w.push({key:`nozzle`,icon:(0,G.jsx)(cc,{className:c.icon}),label:n(`printers.heaterHistory.nozzle`,`Nozzle`),current:e,target:r9(C,`nozzle_target`)}),t!=null&&w.push({key:`nozzle_2`,icon:(0,G.jsx)(cc,{className:c.icon}),label:n(`printers.heaterHistory.nozzle2`,`Nozzle 2`),current:t,target:r9(C,`nozzle_2_target`)})}if(s.showBed){let e=r9(C,`bed`);e!=null&&w.push({key:`bed`,icon:(0,G.jsx)(mu,{className:c.icon}),label:n(`printers.heaterHistory.bed`,`Bed`),current:e,target:r9(C,`bed_target`)})}if(s.showChamber){let e=r9(C,`chamber`);e!=null&&w.push({key:`chamber`,icon:(0,G.jsx)(Go,{className:c.icon}),label:n(`printers.heaterHistory.chamber`,`Chamber`),current:e,target:r9(C,`chamber_target`)})}let T=`/api/v1/printers/${i}/camera/stream?fps=${s.fps}&t=${a}`,E=u&&l?`${T}&token=${encodeURIComponent(l)}`:md(T);if(s.updatedArtwork){let e=v.connected&&x,t=v.remaining_time,r=e&&s.showEta&&t!=null&&t>0;return(0,G.jsx)(Y1e,{size:s.size,camera:s.showCamera?{url:E,rotation:g?.camera_rotation??0,onError:b}:null,name:s.showPrinter?g?.name??null:null,model:s.showModel&&oh(g?.model??null)||null,filename:s.showFilename&&v.current_print?X1e(v.current_print.replace(/\.gcode\.3mf$|\.3mf$|\.gcode$/i,``),v.gcode_file,n):null,status:s.showStatus?v.connected?Q1e(v,n):n(`streamOverlay.printerOffline`):null,state:v.connected?v.state:null,progress:e&&s.showProgress?Math.min(100,Math.max(0,Number.isFinite(S)?S:0)):null,layers:e&&s.showLayers&&v.layer_num!=null&&v.total_layers!=null&&v.total_layers>0?`${v.layer_num} / ${v.total_layers}`:null,remaining:r?ap(t*60):null,eta:r?ip(t,y,n):null,temperatures:v.connected?w:[]})}return(0,G.jsxs)(`div`,{className:`min-h-screen bg-black relative overflow-hidden`,children:[s.showCamera&&(0,G.jsx)(`img`,{src:E,alt:n(`streamOverlay.cameraStream`),className:`absolute inset-0 w-full h-full object-contain`,style:g?.camera_rotation?{transform:`rotate(${g.camera_rotation}deg)`}:void 0,onError:b},a),(0,G.jsx)(`a`,{href:`https://github.com/maziggy/bambuddy`,target:`_blank`,rel:`noopener noreferrer`,className:`absolute top-4 right-4 z-10`,children:(0,G.jsx)(`img`,{src:`/img/bambuddy_logo_dark_transparent.png`,alt:`Bambuddy`,className:`${c.logoHeight} object-contain drop-shadow-lg hover:scale-105 transition-transform`})}),(0,G.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 z-10 bg-gradient-to-t from-black/80 via-black/60 to-transparent`,children:(0,G.jsxs)(`div`,{className:`${c.container}`,children:[_&&(0,G.jsxs)(`div`,{className:`flex items-center ${c.gap} mb-2`,children:[(0,G.jsx)(Ml,{className:`${c.icon} shrink-0 text-white/70`}),(0,G.jsx)(`span`,{className:`${c.text} min-w-0 truncate text-white font-medium`,children:_})]}),s.showFilename&&v.current_print&&(0,G.jsx)(`div`,{className:`${c.textLarge} text-white font-semibold mb-2 truncate drop-shadow-md`,children:X1e(v.current_print.replace(/\.gcode\.3mf$|\.3mf$|\.gcode$/i,``),v.gcode_file,n)}),s.showStatus&&(0,G.jsx)(`div`,{className:`${c.text} text-white/70 mb-2`,children:Q1e(v,n)}),s.showProgress&&x&&(0,G.jsxs)(`div`,{className:`mb-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-1 ${c.text}`,children:[(0,G.jsx)(`span`,{className:`text-white/70`,children:n(`streamOverlay.progress`)}),(0,G.jsxs)(`span`,{className:`text-white font-bold`,children:[Math.round(S),`%`]})]}),(0,G.jsx)(`div`,{className:`w-full bg-white/20 rounded-full ${c.progressHeight}`,children:(0,G.jsx)(`div`,{className:`bg-bambu-green ${c.progressHeight} rounded-full transition-all duration-500`,style:{width:`${S}%`}})})]}),x&&(s.showLayers||s.showEta)&&(0,G.jsxs)(`div`,{className:`flex items-center ${c.gap} flex-wrap`,children:[s.showLayers&&v.layer_num!=null&&v.total_layers!=null&&v.total_layers>0&&(0,G.jsxs)(`div`,{className:`flex items-center ${c.gap} text-white/70`,children:[(0,G.jsx)(Hc,{className:c.icon}),(0,G.jsxs)(`span`,{className:c.text,children:[(0,G.jsx)(`span`,{className:`text-white`,children:v.layer_num}),(0,G.jsx)(`span`,{className:`mx-1`,children:`/`}),(0,G.jsx)(`span`,{children:v.total_layers})]})]}),s.showEta&&v.remaining_time!=null&&v.remaining_time>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-center ${c.gap} text-white/70`,children:[(0,G.jsx)(Au,{className:c.icon}),(0,G.jsx)(`span`,{className:`${c.text} text-white`,children:ap(v.remaining_time*60)})]}),(0,G.jsxs)(`div`,{className:`flex items-center ${c.gap} text-white/70`,children:[(0,G.jsx)(ws,{className:c.icon}),(0,G.jsxs)(`span`,{className:`${c.text} text-white`,children:[n(`streamOverlay.eta`),` `,ip(v.remaining_time,y,n)]})]})]})]}),!x&&(0,G.jsx)(`div`,{className:`${c.text} text-white/70 py-2`,children:v.connected?n(`streamOverlay.printerIdle`):n(`streamOverlay.printerOffline`)}),w.length>0&&(0,G.jsx)(`div`,{className:`flex items-center ${c.gap} flex-wrap mt-2`,children:w.map(e=>(0,G.jsx)($1e,{icon:e.icon,label:e.label,current:e.current,target:e.target,sizes:c},e.key))})]})})]})}function n0e(){let{t:e}=U(),{id:t}=ir(),{mode:n}=Id(),r=(0,f.useRef)(null),i=r0e(r),{data:a,isLoading:o,error:s}=K({queryKey:[`external-link`,t],queryFn:()=>Z.getExternalLink(Number(t)),enabled:!!t});return o?(0,G.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,G.jsx)(Y,{className:`w-8 h-8 text-bambu-green animate-spin`})}):s||!a?(0,G.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-4 text-bambu-gray`,children:[(0,G.jsx)(Pu,{className:`w-12 h-12`}),(0,G.jsx)(`p`,{children:e(`common.linkNotFound`)})]}):(0,G.jsx)(`iframe`,{ref:r,src:a.url,onLoad:i,className:`h-full w-full border-0`,style:{colorScheme:n},title:a.name,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox`})}function r0e(e){let{resolvedMode:t,darkStyle:n,darkBackground:r,darkAccent:i,lightStyle:a,lightBackground:o,lightAccent:s}=Id(),c=t===`dark`,l=c?n:a,u=c?r:o,d=c?i:s,p=(0,f.useCallback)(()=>{let n=e.current;if(!n?.contentWindow)return;let r;try{r=new URL(n.src).origin}catch{return}n.contentWindow.postMessage({type:`bambuddy:theme`,mode:t,style:l,background:u,accent:d},r)},[e,t,l,u,d]);return(0,f.useEffect)(()=>p(),[p]),(0,f.useEffect)(()=>{let t=t=>{t.source===e.current?.contentWindow&&t.data?.type===`bambuddy:theme-request`&&p()};return window.addEventListener(`message`,t),()=>window.removeEventListener(`message`,t)},[e,p]),p}function i0e(){let{id:e}=ir(),t=$n(),n=no(),{t:r}=U(),{showToast:i}=qd(),a=!!e,[o,s]=(0,f.useState)(``),[c,l]=(0,f.useState)(``),[u,d]=(0,f.useState)([]),[p,m]=(0,f.useState)(``),[h,g]=(0,f.useState)(!1),{data:_,isLoading:v}=K({queryKey:[`group`,e],queryFn:()=>Z.getGroup(Number(e)),enabled:a}),{data:y,isLoading:b}=K({queryKey:[`permissions`],queryFn:()=>Z.getPermissions()});a&&_&&!h&&(s(_.name),l(_.description||``),d(_.permissions),g(!0));let x=q({mutationFn:e=>Z.createGroup(e),onSuccess:()=>{n.invalidateQueries({queryKey:[`groups`]}),n.invalidateQueries({queryKey:[`group`]}),i(r(`groups.toast.created`)),t(`/settings?tab=users`)},onError:e=>{i(e.message,`error`)}}),S=q({mutationFn:t=>Z.updateGroup(Number(e),t),onSuccess:a=>{n.invalidateQueries({queryKey:[`groups`]}),a&&n.setQueryData([`group`,e],a),i(r(`groups.toast.updated`)),t(`/settings?tab=users`)},onError:e=>{i(e.message,`error`)}}),C=x.isPending||S.isPending,w=()=>{if(!o.trim()){i(r(`groups.toast.enterGroupName`),`error`);return}a?S.mutate({name:o===_?.name?void 0:o,description:c,permissions:u}):x.mutate({name:o,description:c||void 0,permissions:u})},T=e=>{d(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},E=(e,t)=>{let n=e.permissions.map(e=>e.value);d(e=>{let r=e.filter(e=>!n.includes(e));return t?[...r,...n]:r})},D=e=>e.permissions.every(e=>u.includes(e.value)),O=e=>{let t=e.permissions.filter(e=>u.includes(e.value)).length;return t>0&&t{y&&d(y.all_permissions)},A=()=>{d([])},j=p.toLowerCase(),M=(0,f.useMemo)(()=>y?j?y.categories.map(e=>({...e,permissions:e.permissions.filter(e=>e.label.toLowerCase().includes(j))})).filter(e=>e.permissions.length>0):y.categories:[],[y,j]),N=y?.all_permissions.length??0;return v||b?(0,G.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,G.jsx)(Y,{className:`w-8 h-8 text-bambu-green animate-spin`})}):(0,G.jsxs)(`div`,{className:`space-y-6 max-w-5xl mx-auto`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`button`,{onClick:()=>t(`/settings?tab=users`),className:`p-2 rounded-lg hover:bg-bambu-dark-tertiary text-bambu-gray hover:text-white transition-colors`,children:(0,G.jsx)(jo,{className:`w-5 h-5`})}),(0,G.jsx)(`h1`,{className:`text-xl font-bold text-white`,children:r(a?`groups.editor.title`:`groups.editor.createTitle`)})]}),a&&_?.is_system&&(0,G.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3 rounded-lg bg-yellow-50 dark:bg-yellow-500/10 border border-yellow-300 dark:border-yellow-500/20 text-yellow-700 dark:text-yellow-400 text-sm`,children:[(0,G.jsx)(Pu,{className:`w-4 h-4 shrink-0`}),r(`groups.form.systemGroupWarning`)]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:r(`groups.form.groupName`)}),(0,G.jsx)(`input`,{type:`text`,value:o,onChange:e=>s(e.target.value),disabled:a&&_?.is_system,className:`w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors disabled:opacity-50`,placeholder:r(`groups.form.groupNamePlaceholder`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-white mb-2`,children:r(`groups.form.description`)}),(0,G.jsx)(`input`,{type:`text`,value:c,onChange:e=>l(e.target.value),className:`w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:r(`groups.form.descriptionPlaceholder`)})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between flex-wrap gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(`span`,{className:`text-sm text-bambu-gray`,children:[r(`groups.editor.permissionsSelected`,{count:u.length}),` / `,N]}),(0,G.jsx)(Q,{size:`sm`,variant:`ghost`,onClick:k,children:r(`groups.editor.selectAll`)}),(0,G.jsx)(Q,{size:`sm`,variant:`ghost`,onClick:A,children:r(`groups.editor.clearAll`)})]}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(Kl,{className:`w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-bambu-gray`}),(0,G.jsx)(`input`,{type:`text`,value:p,onChange:e=>m(e.target.value),placeholder:r(`groups.editor.search`),className:`pl-9 pr-4 py-2 text-sm bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors w-64`})]})]}),M.length===0?(0,G.jsx)(`div`,{className:`text-center py-12 text-bambu-gray`,children:r(`groups.editor.noResults`)}):(0,G.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:M.map(e=>{let t=y.categories.find(t=>t.name===e.name),n=t.permissions.filter(e=>u.includes(e.value)).length,i=t.permissions.length,a=D(t),o=O(t);return(0,G.jsxs)(zd,{children:[(0,G.jsxs)(`div`,{className:`sticky top-0 z-10 flex items-center justify-between px-4 py-3 bg-bambu-dark-secondary border-b border-bambu-dark-tertiary rounded-t-xl`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>E(t,!a),className:`w-5 h-5 rounded border flex items-center justify-center transition-colors shrink-0 ${a?`bg-bambu-green border-bambu-green`:o?`bg-bambu-green/50 border-bambu-green`:`border-bambu-gray hover:border-white`}`,children:[a&&(0,G.jsx)(is,{className:`w-3 h-3 text-white`}),o&&!a&&(0,G.jsx)(cl,{className:`w-3 h-3 text-white`})]}),(0,G.jsx)(tu,{className:`w-4 h-4 text-bambu-gray shrink-0`}),(0,G.jsx)(`span`,{className:`text-white font-medium text-sm`,children:e.name})]}),(0,G.jsxs)(`span`,{className:`text-xs text-bambu-gray tabular-nums`,children:[n,`/`,i]})]}),(0,G.jsx)(`div`,{className:`p-3 space-y-1`,children:e.permissions.map(e=>(0,G.jsxs)(`label`,{className:`flex items-center gap-3 px-2 py-1.5 rounded hover:bg-bambu-dark-secondary cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:u.includes(e.value),onChange:()=>T(e.value),className:`w-4 h-4 shrink-0 rounded border-bambu-gray text-bambu-green focus:ring-bambu-green focus:ring-offset-0 bg-bambu-dark-secondary`}),(0,G.jsxs)(`span`,{className:`flex flex-col`,children:[(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e.label}),e.value===`websocket:connect`&&(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray/60`,children:r(`groups.editor.websocketHint`)})]})]},e.value))})]},e.name)})}),(0,G.jsx)(`div`,{className:`h-16`}),(0,G.jsxs)(`div`,{className:`fixed bottom-0 left-0 right-0 z-20 px-6 py-3 bg-bambu-dark-secondary border-t border-bambu-dark-tertiary flex items-center justify-center gap-3`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>t(`/settings?tab=users`),children:r(`common.cancel`)}),(0,G.jsx)(Q,{onClick:w,disabled:C||!o.trim(),children:C?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),r(`common.saving`)]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Vl,{className:`w-4 h-4`}),r(`common.save`)]})})]})]})}var a0e=1.65,o0e=[`#1DB954`,`#3B82F6`,`#F59E0B`,`#EF4444`,`#8B5CF6`];function i9(e,t,n,r){return`${e}||${t??``}||${n??``}||${r??``}`}function a9(e,t){let n=new Date(e);return n.setDate(n.getDate()+Math.round(t)),n}function o9(e){return e.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function s9(e){return e.toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function s0e(e){if(e.length<2)return null;let t=new Map;for(let n of e){let e=n.created_at.slice(0,10);t.set(e,(t.get(e)??0)+n.weight_used)}if(t.size<2)return null;let n=[...t.entries()].map(([e,t])=>({ms:new Date(e).getTime(),totalG:t})).sort((e,t)=>e.ms-t.ms),r=Date.now(),i=Math.LN2/30,a=[];for(let e=1;ee+t.weight,0);if(o===0)return null;let s=a.reduce((e,t)=>e+t.rate*t.weight,0)/o,c=a.reduce((e,t)=>e+t.weight*(t.rate-s)**2,0)/o;return{rate:s,stdDev:Math.sqrt(c)}}function c0e(e){let t=e.reduce((e,t)=>e+Math.max(0,t.weight_used-(t.weight_used_baseline??0)),0);if(t===0)return null;let n=Date.now(),r=(n-e.reduce((e,t)=>{let n=new Date(t.created_at).getTime();return nZ.getAllUsageHistory(5e3),staleTime:6e4,enabled:o}),{data:O=[]}=K({queryKey:[`shopping-list`],queryFn:Z.getShoppingList,staleTime:3e4,enabled:o}),k=T?.forecast_global_lead_time_days??0,A=(0,f.useMemo)(()=>{let e=new Map;for(let t of E)e.set(i9(t.material,t.subtype,t.brand,t.color_name),t);return e},[E]),j=(0,f.useMemo)(()=>{let e=new Map;for(let t of D){let n=e.get(t.spool_id)??[];n.push(t),e.set(t.spool_id,n)}return e},[D]),M=(0,f.useMemo)(()=>{let t=new Map;for(let n of e){if(n.archived_at)continue;let e=i9(n.material,n.subtype,n.brand,n.color_name),r=t.get(e)??{key:e,material:n.material,subtype:n.subtype,brand:n.brand,colorName:n.color_name,spools:[]};r.spools.push(n),t.set(e,r)}return[...t.values()]},[e]),N=(0,f.useMemo)(()=>{let e=new Date;return e.setHours(0,0,0,0),M.map(t=>{let n=A.get(t.key)??(t.colorName===null?null:A.get(i9(t.material,t.subtype,t.brand,null))??null),r=n?.lead_time_days??0,i=Math.max(k,r),a=n?.safety_margin_value??14,o=n?.safety_margin_unit??`days`,s=t.spools.reduce((e,t)=>e+Math.max(0,t.label_weight-t.weight_used),0),c=t.spools.reduce((e,t)=>e+t.label_weight,0),l=t.spools.reduce((e,t)=>e+Math.max(0,t.weight_used-(t.weight_used_baseline??0)),0),u=[];for(let e of t.spools)(e.weight_used_baseline??0)===0&&u.push(...j.get(e.id)??[]);let d=null,f=null,p=`none`,m=s0e(u);if(m!==null)d=m.rate,f=m.stdDev,p=`history`;else{let e=c0e(t.spools);e!==null&&(d=e,p=`delta`)}let h=a0e*(f??(d===null?0:d*.2))*Math.sqrt(i)+(o===`g`?a:d===null?a*5:d*a),g=d===null?0:d*i+h,_=d&&d>0?Math.floor(s/d):null,v=_===null?null:a9(e,_),y=d&&d>0?Math.floor((s-g)/d):null,b=y===null?null:a9(e,Math.max(0,y)),x=_!==null&&i>0&&_<=i,S=!x&&y!==null&&y<=0;return{group:t,settings:n,totalRemainingG:s,totalLabelG:c,totalSpools:t.spools.length,totalUsedG:l,dailyRateG:d,dailyRateStdDev:f,rateTier:p,effectiveLeadTimeDays:i,safetyStockG:h,reorderPointG:g,daysRemaining:_,daysUntilROP:y,projectedEmptyDate:v,reorderTriggerDate:b,reorderAlert:S,stockBreakAlert:x}})},[M,A,j,k]),P=(0,f.useMemo)(()=>[...new Set(M.map(e=>e.material))].sort(),[M]),F=(0,f.useMemo)(()=>[...new Set(M.map(e=>e.brand).filter(Boolean))].sort(),[M]),I=(0,f.useMemo)(()=>{let e=[...N];return h&&(e=e.filter(e=>e.group.material===h)),_&&(e=e.filter(e=>e.group.brand===_)),e.sort((e,t)=>{let n=0,r=0;switch(u){case`material`:n=[e.group.material,e.group.subtype??``,e.group.brand??``].join(` `).toLowerCase(),r=[t.group.material,t.group.subtype??``,t.group.brand??``].join(` `).toLowerCase();break;case`used`:n=e.totalUsedG,r=t.totalUsedG;break;case`days_left`:n=e.daysRemaining??999999,r=t.daysRemaining??999999;break;case`stock`:n=e.totalRemainingG,r=t.totalRemainingG;break}let i=nr);return p===`asc`?i:-i}),e},[N,u,p,h,_]),L=(0,f.useMemo)(()=>N.filter(e=>!e.settings?.alerts_snoozed&&(e.stockBreakAlert||e.reorderAlert)),[N]),R=(0,f.useMemo)(()=>[...N].filter(e=>e.dailyRateG!==null).sort((e,t)=>t.totalUsedG-e.totalUsedG).slice(0,5),[N]);if(!o)return(0,G.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 text-bambu-gray gap-3`,children:[(0,G.jsx)(Xc,{className:`w-8 h-8 opacity-40`}),(0,G.jsx)(`p`,{className:`text-sm`,children:r(`forecast.noReadAccess`)})]});function z(e){u===e?m(e=>e===`asc`?`desc`:`asc`):(d(e),m(e===`days_left`?`asc`:`desc`))}let B=O.length>0?O.length:null;return(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[L.length>0&&(0,G.jsxs)(`button`,{onClick:()=>l(e=>!e),className:`flex items-center gap-2 px-3 py-1.5 rounded-lg border text-sm font-medium transition-colors ${L.some(e=>e.stockBreakAlert)?`bg-red-100 dark:bg-red-500/15 border-red-300 dark:border-red-500/30 text-red-700 dark:text-red-300 hover:bg-red-200 dark:hover:bg-red-500/25`:`bg-yellow-100 dark:bg-yellow-500/15 border-yellow-300 dark:border-yellow-500/30 text-yellow-700 dark:text-yellow-300 hover:bg-yellow-200 dark:hover:bg-yellow-500/25`}`,children:[(0,G.jsx)(Pu,{className:`w-4 h-4`}),r(`forecast.alertCount`,{count:L.length}),c?(0,G.jsx)(ls,{className:`w-3.5 h-3.5`}):(0,G.jsx)(as,{className:`w-3.5 h-3.5`})]}),s&&(0,G.jsx)(m0e,{value:k,onSave:e=>{Z.updateSettings({forecast_global_lead_time_days:e}).then(()=>{t.invalidateQueries({queryKey:[`settings`]}),n(r(`forecast.globalLeadTimeSaved`),`success`)})}}),(0,G.jsxs)(`select`,{value:h,onChange:e=>g(e.target.value),className:`px-3 py-1.5 rounded-lg border text-xs font-medium transition-colors cursor-pointer focus:outline-none ${h?`bg-bambu-green/20 text-bambu-green border-bambu-green/30`:`bg-transparent text-bambu-gray border-bambu-dark-tertiary hover:bg-bambu-dark-tertiary`}`,children:[(0,G.jsx)(`option`,{value:``,children:r(`inventory.material`)}),P.map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))]}),(0,G.jsxs)(`select`,{value:_,onChange:e=>v(e.target.value),className:`px-3 py-1.5 rounded-lg border text-xs font-medium transition-colors cursor-pointer focus:outline-none ${_?`bg-bambu-green/20 text-bambu-green border-bambu-green/30`:`bg-transparent text-bambu-gray border-bambu-dark-tertiary hover:bg-bambu-dark-tertiary`}`,children:[(0,G.jsx)(`option`,{value:``,children:r(`inventory.brand`)}),F.map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))]}),(0,G.jsxs)(`button`,{onClick:()=>S(e=>!e),className:`relative flex items-center gap-2 px-3 py-1.5 rounded-lg border border-bambu-dark-tertiary text-bambu-gray hover:bg-bambu-dark-tertiary text-sm transition-colors ml-auto`,children:[(0,G.jsx)(nu,{className:`w-4 h-4`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:r(`forecast.shoppingList`)}),B&&(0,G.jsx)(`span`,{className:`absolute -top-1.5 -right-1.5 w-4 h-4 rounded-full bg-bambu-green text-white text-[10px] font-bold flex items-center justify-center`,children:B})]})]}),c&&L.length>0&&(0,G.jsx)(`div`,{className:`space-y-2`,children:L.map(e=>(0,G.jsx)(d0e,{forecast:e,onCart:()=>b(e)},e.group.key))}),x&&(0,G.jsx)(y0e,{items:O,forecasts:N,globalLeadTime:k,canWrite:s,onClose:()=>S(!1),onRemove:e=>{Z.removeFromShoppingList(e).then(()=>t.invalidateQueries({queryKey:[`shopping-list`]})).catch(()=>n(r(`forecast.failedSaveSettings`),`error`))},onClear:()=>{Z.clearShoppingList().then(()=>t.invalidateQueries({queryKey:[`shopping-list`]})).catch(()=>n(r(`forecast.failedSaveSettings`),`error`))}}),R.length>0&&(0,G.jsx)(p0e,{forecasts:R,days:C,onDaysChange:w}),N.length===0?(0,G.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 text-bambu-gray`,children:[(0,G.jsx)(Mu,{className:`w-10 h-10 mb-3 opacity-40`}),(0,G.jsx)(`p`,{className:`text-sm`,children:r(`forecast.noSpools`)})]}):(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg overflow-hidden border border-bambu-dark-tertiary`,children:[(0,G.jsx)(`div`,{className:`overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary bg-bambu-dark-tertiary/30`,children:[(0,G.jsx)(`th`,{className:`w-8 px-4 py-3`}),(0,G.jsx)(c9,{col:`material`,active:u,dir:p,onSort:z,children:r(`forecast.sku`)}),(0,G.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:r(`locations.spools`)}),(0,G.jsx)(c9,{col:`stock`,active:u,dir:p,onSort:z,children:r(`forecast.stock`)}),(0,G.jsx)(c9,{col:`used`,active:u,dir:p,onSort:z,children:r(`forecast.dailyRate`)}),(0,G.jsx)(c9,{col:`days_left`,active:u,dir:p,onSort:z,children:r(`forecast.daysLeft`)}),(0,G.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:r(`forecast.emptyBy`)}),(0,G.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:r(`forecast.reorderBy`)}),(0,G.jsx)(`th`,{className:`w-24 px-4 py-3`})]})}),(0,G.jsx)(`tbody`,{className:`divide-y divide-bambu-dark-tertiary`,children:I.map(e=>(0,G.jsx)(h0e,{forecast:e,globalLeadTime:k,canWrite:s,onSaved:()=>t.invalidateQueries({queryKey:[`sku-settings`]}),onCart:()=>b(e),showToast:n},e.group.key))})]})}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 px-4 py-3 text-xs text-bambu-gray border-t border-bambu-dark-tertiary bg-bambu-dark-tertiary/20`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-bambu-green inline-block`}),r(`forecast.trendLegend`)]}),(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-blue-400 inline-block`}),r(`forecast.estimatedLegend`)]}),(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-bambu-gray/40 inline-block`}),r(`forecast.noDataLegend`)]})]})]}),y&&(0,G.jsx)(x0e,{forecast:y,onClose:()=>b(null),onAdd:e=>{Z.addToShoppingList(e).then(()=>{t.invalidateQueries({queryKey:[`shopping-list`]}),n(r(`forecast.addedToCart`),`success`),b(null),S(!0)}).catch(()=>n(r(`forecast.failedAddItem`),`error`))}})]})}function c9({col:e,active:t,dir:n,onSort:r,children:i}){return(0,G.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide cursor-pointer select-none hover:text-white transition-colors`,onClick:()=>r(e),children:(0,G.jsxs)(`span`,{className:`inline-flex items-center`,children:[i,t===e?n===`asc`?(0,G.jsx)(Io,{className:`w-3 h-3 ml-1 text-bambu-green`}):(0,G.jsx)(Ao,{className:`w-3 h-3 ml-1 text-bambu-green`}):(0,G.jsx)(Po,{className:`w-3 h-3 ml-1 opacity-40`})]})})}function d0e({forecast:e,onCart:t}){let{t:n}=U(),r=[e.group.brand,e.group.material,e.group.subtype,e.group.colorName].filter(Boolean).join(` `),i=e.stockBreakAlert;return(0,G.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3 rounded-lg border text-sm ${i?`bg-red-50 dark:bg-red-500/10 border-red-300 dark:border-red-500/30 text-red-700 dark:text-red-300`:`bg-yellow-50 dark:bg-yellow-500/10 border-yellow-300 dark:border-yellow-500/30 text-yellow-700 dark:text-yellow-300`}`,children:[(0,G.jsx)(Pu,{className:`w-4 h-4 flex-shrink-0`}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`span`,{className:`font-medium`,children:r}),i?(0,G.jsxs)(`span`,{className:`ml-2 text-xs opacity-80`,children:[n(`forecast.stockBreakRisk`),` — `,n(`forecast.stockBreakDetail`,{days:e.daysRemaining,lt:e.effectiveLeadTimeDays})]}):(0,G.jsxs)(`span`,{className:`ml-2 text-xs opacity-80`,children:[n(`forecast.reorderNow`),` — `,n(`forecast.reorderTriggerPassed`,{date:e.reorderTriggerDate?o9(e.reorderTriggerDate):`—`})]})]}),(0,G.jsxs)(`button`,{onClick:t,className:`flex items-center gap-1.5 px-2.5 py-1 rounded border border-current text-xs opacity-70 hover:opacity-100 transition-opacity`,children:[(0,G.jsx)(nu,{className:`w-3 h-3`}),` `,n(`forecast.order`)]})]})}var f0e=[{label:`1W`,value:7},{label:`1M`,value:30},{label:`6M`,value:180}];function p0e({forecasts:e,days:t,onDaysChange:n}){let{t:r}=U(),i=Array.from({length:t+1},(e,t)=>t),a=e.map((e,n)=>({key:e.group.key,label:[e.group.brand,e.group.material,e.group.subtype,e.group.colorName].filter(Boolean).join(` `),color:o0e[n%o0e.length],rop:e.reorderPointG,points:l0e(e,t)})),o=i.map(e=>{let t={day:e,label:s9(a9(new Date,e))};for(let n of a){let r=n.points.find(t=>t.day===e);t[n.key]=r?.stock??0}return t}),s=(()=>{for(let e=t;e>=0;e--)if(a.some(t=>o[e]?.[t.key]>0))return e;return t})(),c=o.slice(0,s+1),l=a.filter(e=>e.rop>0);return(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg overflow-hidden border border-bambu-dark-tertiary p-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-4`,children:[(0,G.jsx)(Mu,{className:`w-4 h-4 text-bambu-green`}),(0,G.jsx)(`h3`,{className:`text-sm font-semibold text-white`,children:r(`forecast.chartTitle`)}),(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray ml-1 hidden sm:inline`,children:r(`forecast.dashedLinesROP`)}),(0,G.jsx)(`div`,{className:`ml-auto flex items-center bg-bambu-dark-tertiary rounded-lg p-0.5`,children:f0e.map(e=>(0,G.jsx)(`button`,{onClick:()=>n(e.value),className:`px-2.5 py-1 text-xs font-medium rounded-md transition-colors ${t===e.value?`bg-bambu-dark-secondary text-white shadow`:`text-bambu-gray hover:text-white`}`,children:e.label},e.value))})]}),(0,G.jsx)(UA,{width:`100%`,height:220,children:(0,G.jsxs)(BH,{data:c,margin:{top:4,right:8,bottom:0,left:0},children:[(0,G.jsx)(`defs`,{children:a.map(e=>(0,G.jsxs)(`linearGradient`,{id:`grad-${e.key}`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,G.jsx)(`stop`,{offset:`5%`,stopColor:e.color,stopOpacity:.25}),(0,G.jsx)(`stop`,{offset:`95%`,stopColor:e.color,stopOpacity:.02})]},e.key))}),(0,G.jsx)(sV,{strokeDasharray:`3 3`,stroke:`#374151`,strokeOpacity:.5}),(0,G.jsx)(XV,{dataKey:`label`,tick:{fill:`#6B7280`,fontSize:10},interval:Math.max(0,Math.ceil(s/8)-1),axisLine:!1,tickLine:!1}),(0,G.jsx)(tH,{tick:{fill:`#6B7280`,fontSize:10},axisLine:!1,tickLine:!1,tickFormatter:e=>e>=1e3?`${(e/1e3).toFixed(1)}kg`:`${e}g`,width:48}),(0,G.jsx)(mz,{content:({label:e,payload:t})=>t?.length?(0,G.jsxs)(`div`,{style:{background:`#1a1a2e`,border:`1px solid #374151`,borderRadius:8,fontSize:12,padding:`8px 12px`},children:[(0,G.jsx)(`div`,{style:{color:`#9CA3AF`,marginBottom:6},children:e}),t.map(e=>{let t=a.find(t=>t.key===String(e.dataKey));return typeof e.value==`number`?(0,G.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,color:`#E5E7EB`,marginBottom:2},children:[(0,G.jsx)(`span`,{style:{color:t?.color??`#9CA3AF`,fontSize:10},children:`●`}),(0,G.jsx)(`span`,{children:t?.label??String(e.dataKey)}),(0,G.jsxs)(`span`,{style:{color:`#9CA3AF`,marginLeft:4},children:[e.value,`g`]})]},String(e.dataKey)):null})]}):null}),(0,G.jsx)(Bj,{formatter:e=>(0,G.jsx)(`span`,{style:{color:`#9CA3AF`,fontSize:11},children:a.find(t=>t.key===e)?.label??e})}),a.map(e=>(0,G.jsx)(OV,{type:`monotone`,dataKey:e.key,stroke:e.color,strokeWidth:2,fill:`url(#grad-${e.key})`,dot:!1,activeDot:{r:3}},e.key)),l.map(e=>(0,G.jsx)(XB,{y:e.rop,stroke:e.color,strokeDasharray:`4 3`,strokeOpacity:.6},`rop-${e.key}`))]})})]})}function m0e({value:e,onSave:t}){let{t:n}=U(),[r,i]=(0,f.useState)(!1),[a,o]=(0,f.useState)(String(e));function s(){let e=parseInt(a,10);isNaN(e)||e<0||(t(e),i(!1))}return(0,G.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 bg-bambu-dark-tertiary/40 rounded-lg border border-bambu-dark-tertiary text-xs text-bambu-gray`,children:[(0,G.jsx)(Rc,{className:`w-3.5 h-3.5 flex-shrink-0`,"aria-label":n(`forecast.globalLeadTimeHint`)}),(0,G.jsxs)(`span`,{className:`hidden sm:inline`,children:[n(`forecast.globalLeadTime`),`:`]}),r?(0,G.jsxs)(`form`,{className:`flex items-center gap-1.5`,onSubmit:e=>{e.preventDefault(),s()},children:[(0,G.jsx)(`input`,{type:`number`,min:0,max:365,value:a,onChange:e=>o(e.target.value),className:`w-14 px-1.5 py-0.5 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-sm text-white focus:outline-none focus:border-bambu-green`,autoFocus:!0}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:`d`}),(0,G.jsx)(`button`,{type:`submit`,className:`px-2 py-0.5 bg-bambu-green text-white text-xs rounded hover:bg-bambu-green/80`,children:n(`forecast.save`)}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>i(!1),className:`text-xs text-bambu-gray hover:text-white`,children:`✕`})]}):(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsxs)(`span`,{className:`font-semibold text-white`,children:[e,`d`]}),(0,G.jsx)(`button`,{onClick:()=>{o(String(e)),i(!0)},className:`p-0.5 text-bambu-gray hover:text-white rounded transition-colors`,children:(0,G.jsx)(Cl,{className:`w-3 h-3`})})]})]})}function h0e({forecast:e,globalLeadTime:t,canWrite:n,onSaved:r,onCart:i,showToast:a}){let{t:o}=U(),[s,c]=(0,f.useState)(!1),[l,u]=(0,f.useState)(!1),[d,p]=(0,f.useState)(!1),[m,h]=(0,f.useState)(String(e.settings?.lead_time_days??0)),[g,_]=(0,f.useState)(String(e.settings?.safety_margin_value??14)),[v,y]=(0,f.useState)(e.settings?.safety_margin_unit??`days`);(0,f.useEffect)(()=>{l||h(String(e.settings?.lead_time_days??0))},[e.settings?.lead_time_days,l]),(0,f.useEffect)(()=>{d||(_(String(e.settings?.safety_margin_value??14)),y(e.settings?.safety_margin_unit??`days`))},[e.settings?.safety_margin_value,e.settings?.safety_margin_unit,d]);let b=q({mutationFn:Z.upsertSkuSettings,onSuccess:()=>{r(),a(o(`forecast.settingsSaved`),`success`)},onError:()=>a(o(`forecast.failedSaveSettings`),`error`)}),x=e.settings?.alerts_snoozed??!1,S=[e.group.brand,e.group.material,e.group.subtype,e.group.colorName].filter(Boolean).join(` `),C=e.group.spools[0]?.rgba?jf(e.group.spools[0].rgba):{backgroundColor:`#4B5563`},w=e.totalLabelG>0?Math.round(e.totalRemainingG/e.totalLabelG*100):0,T=x||e.daysRemaining===null?`text-bambu-gray`:e.stockBreakAlert?`text-red-700 dark:text-red-400`:e.reorderAlert||e.daysRemaining<30?`text-yellow-700 dark:text-yellow-400`:`text-green-700 dark:text-green-400`;function E(t,n,r,i=x){b.mutate({material:e.group.material,subtype:e.group.subtype,brand:e.group.brand,color_name:e.group.colorName,lead_time_days:t,safety_margin_value:n,safety_margin_unit:r,alerts_snoozed:i})}function D(t){t.stopPropagation(),E(e.settings?.lead_time_days??0,e.settings?.safety_margin_value??14,e.settings?.safety_margin_unit??`days`,!x)}let O=e.rateTier===`history`?(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs px-1.5 py-0.5 rounded bg-bambu-green/15 text-bambu-green`,children:[(0,G.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-bambu-green`}),o(`forecast.trend`)]}):e.rateTier===`delta`?(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs px-1.5 py-0.5 rounded bg-blue-100 dark:bg-blue-400/15 text-blue-700 dark:text-blue-400`,children:[(0,G.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-blue-400`}),o(`forecast.estimated`)]}):(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs px-1.5 py-0.5 rounded bg-bambu-dark-tertiary text-bambu-gray/60`,children:[(0,G.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-bambu-gray/40`}),o(`forecast.noData`)]});return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary/50 cursor-pointer hover:bg-bambu-dark-tertiary/30 transition-colors ${x?``:e.stockBreakAlert?`bg-red-500/5`:e.reorderAlert?`bg-yellow-500/5`:``} ${x?`opacity-50`:``}`,onClick:()=>c(e=>!e),children:[(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`span`,{className:`block w-5 h-5 rounded-full border border-black/20`,style:C})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`span`,{className:`text-sm text-white`,children:S})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e.totalSpools})}),(0,G.jsx)(`td`,{className:`px-4 py-3 min-w-[140px]`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`flex-1 h-2 bg-bambu-dark-tertiary rounded-full overflow-hidden`,children:(0,G.jsx)(`div`,{className:`h-full rounded-full ${w>50?`bg-bambu-green`:w>20?`bg-yellow-500`:`bg-red-500`}`,style:{width:`${Math.min(w,100)}%`}})}),(0,G.jsxs)(`span`,{className:`text-xs text-bambu-gray min-w-[40px] text-right`,children:[Math.round(e.totalRemainingG),`g`]})]})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[(0,G.jsx)(`span`,{className:`text-sm text-white`,children:e.dailyRateG===null?`—`:`${e.dailyRateG.toFixed(1)}g/d`}),O]})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`span`,{className:`text-sm font-semibold ${T}`,children:e.daysRemaining===null?(0,G.jsx)(`span`,{className:`text-bambu-gray font-normal`,children:`—`}):`${e.daysRemaining}d`})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e.projectedEmptyDate?o9(e.projectedEmptyDate):`—`})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`span`,{className:`text-sm ${!x&&e.reorderAlert?`text-yellow-700 dark:text-yellow-400`:`text-bambu-gray`}`,children:e.reorderTriggerDate?o9(e.reorderTriggerDate):`—`})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,onClick:e=>e.stopPropagation(),children:(0,G.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[n&&(0,G.jsx)(`button`,{onClick:i,className:`p-1.5 text-bambu-gray hover:text-bambu-green rounded transition-colors`,title:o(`forecast.addToCart`),children:(0,G.jsx)(nu,{className:`w-4 h-4`})}),!x&&(e.stockBreakAlert?(0,G.jsx)(Pu,{className:`w-4 h-4 text-red-600 dark:text-red-400`,"aria-label":o(`forecast.stockBreakRisk`)}):e.reorderAlert?(0,G.jsx)(Pu,{className:`w-4 h-4 text-yellow-600 dark:text-yellow-400`,"aria-label":o(`forecast.reorderNow`)}):e.daysRemaining===null?null:(0,G.jsx)(is,{className:`w-4 h-4 text-bambu-green/50`})),n&&(0,G.jsx)(`button`,{onClick:D,className:`p-1 rounded transition-colors ${x?`text-amber-600/80 dark:text-amber-400/80 hover:text-amber-700 dark:hover:text-amber-300`:`text-slate-400 hover:text-white`}`,title:o(x?`forecast.alertsEnabled`:`forecast.alertsSnoozed`),children:(0,G.jsx)(Bo,{className:`w-3.5 h-3.5`})}),(0,G.jsx)(`button`,{onClick:e=>{e.stopPropagation(),c(e=>!e)},className:`p-1.5 text-bambu-gray hover:text-white rounded transition-colors`,children:s?(0,G.jsx)(ls,{className:`w-4 h-4`}):(0,G.jsx)(as,{className:`w-4 h-4`})})]})})]}),s&&(0,G.jsx)(`tr`,{className:`bg-bambu-dark-tertiary/10`,children:(0,G.jsx)(`td`,{colSpan:9,className:`px-6 py-4`,children:(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`grid gap-2 ${n?`grid-cols-2 sm:grid-cols-4`:`grid-cols-2`}`,children:[(0,G.jsx)(g0e,{label:o(`forecast.effectiveLeadTime`),value:`${e.effectiveLeadTimeDays}d`,hint:o(`forecast.effectiveLeadTimeHint`,{global:t,sku:e.settings?.lead_time_days??0})}),(0,G.jsx)(g0e,{label:o(`forecast.reorderPoint`),value:`${Math.round(e.reorderPointG)}g`,hint:o(`forecast.reorderPointHint`)}),n&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(_0e,{label:o(`forecast.skuLeadTimeOverride`),hint:o(`forecast.skuLeadTimeHint`),unit:o(`forecast.leadTime`),editing:l,value:e.settings?.lead_time_days??0,inputValue:m,onInputChange:h,onEdit:()=>{h(String(e.settings?.lead_time_days??0)),u(!0)},onSave:()=>{let t=parseInt(m,10);!isNaN(t)&&t>=0&&(E(t,e.settings?.safety_margin_value??14,v),u(!1))},onCancel:()=>u(!1),isPending:b.isPending,saveLabel:o(`forecast.save`),cancelLabel:o(`forecast.cancel`)}),(0,G.jsx)(v0e,{value:e.settings?.safety_margin_value??14,unit:v,editing:d,inputValue:g,dailyRateG:e.dailyRateG,onInputChange:_,onUnitChange:e=>y(e),onEdit:()=>{_(String(e.settings?.safety_margin_value??14)),y(e.settings?.safety_margin_unit??`days`),p(!0)},onSave:()=>{let t=parseInt(g,10);!isNaN(t)&&t>=0&&(E(e.settings?.lead_time_days??0,t,v),p(!1))},onCancel:()=>p(!1),isPending:b.isPending,saveLabel:o(`forecast.save`),cancelLabel:o(`forecast.cancel`),safetyMarginLabel:o(`forecast.safetyMarginLabel`)})]})]}),e.group.spools.length>1&&(0,G.jsxs)(`div`,{className:`border-t border-bambu-dark-tertiary pt-3`,children:[(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mb-2`,children:o(`forecast.individualSpools`)}),(0,G.jsx)(`div`,{className:`bg-bambu-dark-secondary rounded-lg overflow-hidden border border-bambu-dark-tertiary`,children:(0,G.jsxs)(`table`,{className:`w-full`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary bg-bambu-dark-tertiary/30`,children:[(0,G.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:`#`}),(0,G.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:o(`inventory.remaining`)}),(0,G.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:o(`inventory.used`)}),(0,G.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:o(`forecast.labelWeight`)})]})}),(0,G.jsx)(`tbody`,{className:`divide-y divide-bambu-dark-tertiary`,children:e.group.spools.map(e=>{let t=Math.max(0,e.label_weight-e.weight_used),n=e.label_weight>0?t/e.label_weight*100:0;return(0,G.jsxs)(`tr`,{className:`hover:bg-bambu-dark-tertiary/30 transition-colors`,children:[(0,G.jsx)(`td`,{className:`px-4 py-2`,children:(0,G.jsxs)(`span`,{className:`text-xs font-mono text-bambu-gray/70`,children:[`#`,e.id]})}),(0,G.jsx)(`td`,{className:`px-4 py-2`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-24 h-1.5 bg-bambu-dark-tertiary rounded-full overflow-hidden flex-shrink-0`,children:(0,G.jsx)(`div`,{className:`h-full rounded-full ${n>50?`bg-bambu-green`:n>20?`bg-yellow-500`:`bg-red-500`}`,style:{width:`${Math.min(n,100)}%`}})}),(0,G.jsxs)(`span`,{className:`text-sm text-white`,children:[Math.round(t),`g`]})]})}),(0,G.jsx)(`td`,{className:`px-4 py-2`,children:(0,G.jsxs)(`span`,{className:`text-sm text-bambu-gray`,children:[Math.round(Math.max(0,e.weight_used-(e.weight_used_baseline??0))),`g`]})}),(0,G.jsx)(`td`,{className:`px-4 py-2`,children:(0,G.jsxs)(`span`,{className:`text-sm text-bambu-gray`,children:[e.label_weight,`g`]})})]},e.id)})})]})})]})]})})})]})}function g0e({label:e,value:t,hint:n}){return(0,G.jsxs)(`div`,{className:`bg-bambu-dark-tertiary/40 rounded-lg p-3`,title:n,children:[(0,G.jsx)(`div`,{className:`text-xs font-medium text-white mb-1`,children:e}),(0,G.jsx)(`div`,{className:`text-lg font-semibold text-white`,children:t})]})}function _0e({label:e,hint:t,unit:n,editing:r,value:i,inputValue:a,onInputChange:o,onEdit:s,onSave:c,onCancel:l,isPending:u,saveLabel:d=`Save`,cancelLabel:f=`Cancel`}){return(0,G.jsxs)(`div`,{className:`bg-bambu-dark-tertiary/40 rounded-lg p-3 space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`text-xs font-medium text-white`,children:e}),(0,G.jsx)(`span`,{title:t,children:(0,G.jsx)(Rc,{className:`w-3 h-3 text-bambu-gray/50`})})]}),r?(0,G.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:e=>{e.preventDefault(),c()},children:[(0,G.jsx)(`input`,{type:`number`,min:0,max:365,value:a,onChange:e=>o(e.target.value),className:`w-20 px-2 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-sm text-white focus:outline-none focus:border-bambu-green`,autoFocus:!0,disabled:u}),(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:n}),(0,G.jsx)(`button`,{type:`submit`,disabled:u,className:`px-2 py-1 bg-bambu-green text-white text-xs rounded hover:bg-bambu-green/80 disabled:opacity-50`,children:d}),(0,G.jsx)(`button`,{type:`button`,onClick:l,disabled:u,className:`px-2 py-1 text-xs text-bambu-gray hover:text-white`,children:f})]}):(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-lg font-semibold text-white`,children:i}),(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:n}),(0,G.jsx)(`button`,{onClick:s,className:`p-1 text-bambu-gray hover:text-white rounded transition-colors`,children:(0,G.jsx)(Cl,{className:`w-3 h-3`})})]})]})}function v0e({value:e,unit:t,editing:n,inputValue:r,dailyRateG:i,onInputChange:a,onUnitChange:o,onEdit:s,onSave:c,onCancel:l,isPending:u,saveLabel:d=`Save`,cancelLabel:f=`Cancel`,safetyMarginLabel:p=`Safety Margin`}){let{t:m}=U(),h=t===`g`?e:i===null?null:Math.round(i*e),g=t===`days`?m(`forecast.safetyMarginHintDays`,{approx:h===null?``:m(`forecast.safetyMarginHintDaysApprox`,{g:h})}):m(`forecast.safetyMarginHintG`,{approx:i===null?``:m(`forecast.safetyMarginHintGApprox`,{days:Math.round(e/i)})});return(0,G.jsxs)(`div`,{className:`bg-bambu-dark-tertiary/40 rounded-lg p-3 space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`text-xs font-medium text-white`,children:p}),(0,G.jsx)(`span`,{title:g,children:(0,G.jsx)(Rc,{className:`w-3 h-3 text-bambu-gray/50`})})]}),n?(0,G.jsxs)(`form`,{className:`flex items-center gap-2 flex-wrap`,onSubmit:e=>{e.preventDefault(),c()},children:[(0,G.jsx)(`input`,{type:`number`,min:0,max:t===`g`?1e4:365,value:r,onChange:e=>a(e.target.value),className:`w-20 px-2 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-sm text-white focus:outline-none focus:border-bambu-green`,autoFocus:!0,disabled:u}),(0,G.jsxs)(`div`,{className:`flex bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded overflow-hidden text-xs`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>o(`days`),className:`px-2 py-1 transition-colors ${t===`days`?`bg-bambu-green text-white`:`text-bambu-gray hover:text-white`}`,children:`days`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>o(`g`),className:`px-2 py-1 transition-colors ${t===`g`?`bg-bambu-green text-white`:`text-bambu-gray hover:text-white`}`,children:`g`})]}),(0,G.jsx)(`button`,{type:`submit`,disabled:u,className:`px-2 py-1 bg-bambu-green text-white text-xs rounded hover:bg-bambu-green/80 disabled:opacity-50`,children:d}),(0,G.jsx)(`button`,{type:`button`,onClick:l,disabled:u,className:`px-2 py-1 text-xs text-bambu-gray hover:text-white`,children:f})]}):(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-lg font-semibold text-white`,children:e}),(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:t}),h!==null&&t===`days`&&(0,G.jsxs)(`span`,{className:`text-lg font-semibold text-white`,children:[`≈ `,h,`g`]}),t===`g`&&i!==null&&(0,G.jsxs)(`span`,{className:`text-lg font-semibold text-white`,children:[`≈ `,Math.round(e/i),`d`]}),(0,G.jsx)(`button`,{onClick:s,className:`p-1 text-bambu-gray hover:text-white rounded transition-colors`,children:(0,G.jsx)(Cl,{className:`w-3 h-3`})})]})]})}function y0e({items:e,forecasts:t,globalLeadTime:n,canWrite:r,onClose:i,onRemove:a,onClear:o}){let{t:s}=U(),c=no(),[l,u]=(0,f.useState)(`list`),d=q({mutationFn:async({id:e,status:t,item:n,avgSpoolG:r})=>{if(await Z.updateShoppingListStatus(e,t),t===`received`&&n){let t=r??1e3,i={material:n.material,subtype:n.subtype,brand:n.brand,label_weight:t,core_weight:0,core_weight_catalog_id:null,color_name:n.color_name,rgba:null,extra_colors:null,effect_type:null,nozzle_temp_min:null,nozzle_temp_max:null,note:n.note??null,tag_uid:null,tray_uuid:null,data_origin:`manual`,tag_type:null,cost_per_kg:null,last_scale_weight:null,last_weighed_at:null,weight_used:0,slicer_filament:null,slicer_filament_name:null,added_full:null,last_used:null,encode_time:null,category:`Stock`,low_stock_threshold_pct:null,material_number:null};await Z.bulkCreateSpools(i,n.quantity_spools),await Z.removeFromShoppingList(e)}},onSuccess:()=>{c.invalidateQueries({queryKey:[`shopping-list`]}),c.invalidateQueries({queryKey:[`spools`]})}}),p=(0,f.useMemo)(()=>{let e=new Map;for(let n of t)e.set(n.group.key,n);return e},[t]),m=(0,f.useMemo)(()=>e.map(e=>({item:e,forecast:p.get(i9(e.material,e.subtype,e.brand,e.color_name))??null})),[e,p]),h=(0,f.useMemo)(()=>m.filter(({forecast:e})=>!e||e.dailyRateG===null?!1:e.stockBreakAlert||e.daysRemaining!==null&&e.daysRemaining<=e.effectiveLeadTimeDays),[m]);function g(){let t=[s(`forecast.qty`),s(`forecast.material`),s(`inventory.brand`),s(`inventory.subtype`),s(`inventory.color`),`${s(`forecast.weight`)} (g)`,`${s(`forecast.leadTime`)} (d)`,s(`forecast.expectedRestock`),s(`forecast.status`),s(`forecast.note`)],r=e.map(e=>{let t=p.get(i9(e.material,e.subtype,e.brand,e.color_name))??null,r=t&&t.totalSpools>0?t.totalLabelG/t.totalSpools:1e3,i=Math.round(e.quantity_spools*r),a=t?.effectiveLeadTimeDays??n??0,o=a>0?o9(a9(new Date,a)):``;return[e.quantity_spools,e.material,e.brand??``,e.subtype??``,e.color_name??``,i,a||``,o,e.status,e.note??``].map(e=>`"${String(e).replace(/"/g,`""`)}"`).join(`,`)}),i=[t.join(`,`),...r].join(` `),a=new Blob([i],{type:`text/csv`}),o=URL.createObjectURL(a),c=document.createElement(`a`);c.href=o,c.download=`shopping-list-${new Date().toISOString().slice(0,10)}.csv`,c.click(),setTimeout(()=>URL.revokeObjectURL(o),100)}return(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg overflow-hidden border border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b border-bambu-dark-tertiary bg-bambu-dark-tertiary/30`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(nu,{className:`w-4 h-4 text-bambu-green`}),(0,G.jsx)(`h3`,{className:`text-sm font-semibold text-white`,children:s(`forecast.shoppingList`)}),(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:s(`forecast.shoppingListItems`,{count:e.length})}),e.length>0&&(0,G.jsxs)(`div`,{className:`flex bg-bambu-dark-tertiary rounded-md p-0.5 ml-1`,children:[(0,G.jsxs)(`button`,{onClick:()=>u(`list`),className:`flex items-center gap-1.5 px-2 py-0.5 text-xs font-medium rounded transition-colors ${l===`list`?`bg-bambu-dark-secondary text-white shadow`:`text-bambu-gray hover:text-white`}`,children:[(0,G.jsx)(_l,{className:`w-3 h-3`}),s(`forecast.listView`)]}),(0,G.jsxs)(`button`,{onClick:()=>u(`logistics`),className:`flex items-center gap-1.5 px-2 py-0.5 text-xs font-medium rounded transition-colors ${l===`logistics`?`bg-bambu-dark-secondary text-white shadow`:`text-bambu-gray hover:text-white`}`,children:[(0,G.jsx)(ns,{className:`w-3 h-3`}),s(`forecast.logisticsView`),h.length>0&&(0,G.jsx)(`span`,{className:`w-3.5 h-3.5 rounded-full bg-red-500 text-white text-[9px] font-bold flex items-center justify-center`,children:h.length})]})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.length>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`button`,{onClick:g,className:`flex items-center gap-1.5 text-xs text-bambu-gray hover:text-white transition-colors px-2 py-1 rounded border border-bambu-dark-tertiary hover:bg-bambu-dark-tertiary`,children:[(0,G.jsx)(Us,{className:`w-3 h-3`}),s(`forecast.downloadCsv`)]}),r&&(0,G.jsx)(`button`,{onClick:o,className:`text-xs text-red-700 dark:text-red-400 hover:text-red-800 dark:hover:text-red-300 transition-colors px-2 py-1 rounded border border-red-200 dark:border-red-500/20 hover:bg-red-50 dark:hover:bg-red-500/10`,children:s(`forecast.clearAll`)})]}),(0,G.jsx)(`button`,{onClick:i,className:`p-1 text-bambu-gray hover:text-white transition-colors`,children:(0,G.jsx)($u,{className:`w-4 h-4`})})]})]}),e.length===0?(0,G.jsxs)(`div`,{className:`flex flex-col items-center py-8 text-bambu-gray`,children:[(0,G.jsx)(_l,{className:`w-8 h-8 mb-2 opacity-30`}),(0,G.jsx)(`p`,{className:`text-sm`,children:s(`forecast.shoppingListEmpty`)})]}):l===`list`?(0,G.jsx)(`div`,{className:`overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary bg-bambu-dark-tertiary/20`,children:[(0,G.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:s(`forecast.qty`)}),(0,G.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:s(`forecast.material`)}),(0,G.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:s(`forecast.weight`)}),(0,G.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:s(`forecast.leadTime`)}),(0,G.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:s(`forecast.expectedRestock`)}),(0,G.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:s(`forecast.status`)}),(0,G.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:s(`forecast.note`)}),(0,G.jsx)(`th`,{className:`px-4 py-2 text-right text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:s(`forecast.actions`)})]})}),(0,G.jsx)(`tbody`,{className:`divide-y divide-bambu-dark-tertiary`,children:e.map(e=>{let t=[e.brand,e.material,e.subtype,e.color_name].filter(Boolean).join(` `),i=h.some(t=>t.item.id===e.id),o=p.get(i9(e.material,e.subtype,e.brand,e.color_name))??null,c=o&&o.totalSpools>0?o.totalLabelG/o.totalSpools:1e3,l=Math.round(e.quantity_spools*c),u=o?.effectiveLeadTimeDays??n??0,f=u>0?a9(new Date,u):null,m=e.status===`purchased`||e.status===`received`,g=e.status===`received`,_=d.isPending;return(0,G.jsxs)(`tr`,{className:`hover:bg-bambu-dark-tertiary/30 transition-colors ${i&&!m?`bg-red-500/5`:``}`,children:[(0,G.jsx)(`td`,{className:`px-4 py-2.5`,children:(0,G.jsxs)(`span`,{className:`text-sm font-semibold text-bambu-green`,children:[e.quantity_spools,`×`]})}),(0,G.jsx)(`td`,{className:`px-4 py-2.5`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-sm text-white`,children:t}),i&&!m&&(0,G.jsx)(Pu,{className:`w-3.5 h-3.5 text-red-600 dark:text-red-400 flex-shrink-0`,"aria-label":s(`forecast.stockBreakBefore`)})]})}),(0,G.jsx)(`td`,{className:`px-4 py-2.5`,children:(0,G.jsx)(`span`,{className:`text-sm text-white`,children:l>=1e3?`${(l/1e3).toFixed(1)}kg`:`${l}g`})}),(0,G.jsx)(`td`,{className:`px-4 py-2.5`,children:(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:u>0?`${u}d`:`—`})}),(0,G.jsx)(`td`,{className:`px-4 py-2.5`,children:(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:f?o9(f):`—`})}),(0,G.jsx)(`td`,{className:`px-4 py-2.5`,children:(0,G.jsx)(`span`,{className:`inline-flex items-center px-2 py-0.5 rounded text-xs font-medium ${g?`bg-bambu-green/20 text-bambu-green`:m?`bg-blue-100 dark:bg-blue-400/20 text-blue-700 dark:text-blue-400`:`bg-bambu-dark-tertiary text-bambu-gray`}`,children:s(g?`forecast.received`:m?`forecast.purchased`:`forecast.pending`)})}),(0,G.jsx)(`td`,{className:`px-4 py-2.5`,children:(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:e.note||`—`})}),(0,G.jsx)(`td`,{className:`px-4 py-2.5`,children:(0,G.jsx)(`div`,{className:`flex items-center justify-end gap-1`,children:r&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`button`,{onClick:()=>d.mutate({id:e.id,status:m?`pending`:`purchased`}),disabled:_||g,title:s(m?`forecast.resetToPending`:`forecast.markPurchased`),className:`p-1.5 rounded transition-colors disabled:opacity-30 ${m?`text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300`:`text-blue-600/50 dark:text-blue-400/50 hover:text-blue-600 dark:hover:text-blue-400`}`,children:m?(0,G.jsx)(Rl,{className:`w-4 h-4`}):(0,G.jsx)(Is,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{onClick:()=>d.mutate({id:e.id,status:`received`,item:e,avgSpoolG:c}),disabled:_||!m||g,title:s(`forecast.markReceived`),className:`p-1.5 rounded transition-colors text-bambu-green/50 hover:text-bambu-green disabled:opacity-30`,children:(0,G.jsx)(hl,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{onClick:()=>a(e.id),className:`p-1 text-bambu-gray hover:text-red-600 dark:hover:text-red-400 transition-colors`,title:s(`forecast.remove`),children:(0,G.jsx)(ju,{className:`w-3.5 h-3.5`})})]})})})]},e.id)})})]})}):(0,G.jsx)(`div`,{className:`divide-y divide-bambu-dark-tertiary`,children:m.filter(({item:e})=>e.status!==`received`).map(({item:e,forecast:t})=>(0,G.jsx)(b0e,{item:e,forecast:t,globalLeadTime:n,canWrite:r,onRemove:()=>a(e.id)},e.id))})]})}function b0e({item:e,forecast:t,globalLeadTime:n,canWrite:r,onRemove:i}){let{t:a}=U(),o=[e.brand,e.material,e.subtype,e.color_name].filter(Boolean).join(` `),s=(0,f.useMemo)(()=>{if(!t||t.dailyRateG===null||t.dailyRateG<=0)return null;let n=t.dailyRateG,r=t.effectiveLeadTimeDays,i=t.totalSpools>0?t.totalLabelG/t.totalSpools:1e3,a=e.quantity_spools*i,o=Math.max(0,t.totalRemainingG-n*r),s=o+a,c=Math.ceil(s/n),l=Math.min(r+c+5,365),u=[];for(let e=0;e<=l;e++){let i=s9(a9(new Date,e));if(e===r)u.push({day:e,label:i,stock:Math.round(o),rop:Math.round(t.reorderPointG),safetyStock:Math.round(t.safetyStockG)}),u.push({day:e,label:i,stock:Math.round(s),rop:Math.round(t.reorderPointG),safetyStock:Math.round(t.safetyStockG),arrival:!0});else{let a=e{if(!t||t.dailyRateG===null||t.dailyRateG<=0)return null;let e=Math.floor(t.totalRemainingG/t.dailyRateG);return ee>=1e3?`${(e/1e3).toFixed(1)}kg`:`${e}g`,width:44}),(0,G.jsx)(mz,{contentStyle:{background:`#1a1a2e`,border:`1px solid #374151`,borderRadius:8,fontSize:11},labelStyle:{color:`#9CA3AF`},formatter:(e,t)=>typeof e==`number`?t===`stock`?`${e}g — ${a(`forecast.stock`)}`:t===`rop`?`${e}g — ${a(`forecast.reorderPoint`)}`:t===`safetyStock`?`${e}g — ${a(`forecast.safetyMarginLabel`)}`:`${e}`:``}),(0,G.jsx)(OV,{type:`linear`,dataKey:`stock`,stroke:`#1DB954`,strokeWidth:2,fill:`url(#cart-post-${e.id})`,dot:!1,activeDot:{r:3}}),t.reorderPointG>0&&(0,G.jsx)(XB,{y:t.reorderPointG,stroke:`#F59E0B`,strokeDasharray:`5 3`,strokeOpacity:.8,label:{value:`ROP`,position:`insideTopRight`,fill:`#F59E0B`,fontSize:9}}),t.safetyStockG>0&&(0,G.jsx)(XB,{y:t.safetyStockG,stroke:`#6B7280`,strokeDasharray:`3 3`,strokeOpacity:.6,label:{value:`SS`,position:`insideTopRight`,fill:`#6B7280`,fontSize:9}}),(0,G.jsx)(XB,{x:s9(a9(new Date,s.lt)),stroke:`#3B82F6`,strokeWidth:1.5,strokeDasharray:`4 3`,strokeOpacity:.9,label:{value:`+${s.arrivalG>=1e3?`${(s.arrivalG/1e3).toFixed(1)}kg`:`${Math.round(s.arrivalG)}g`} arrives (d${s.lt})`,position:`insideTopLeft`,fill:`#3B82F6`,fontSize:9}}),c!==null&&(0,G.jsx)(XB,{x:s9(a9(new Date,c)),stroke:`#EF4444`,strokeWidth:1.5,strokeOpacity:.9,label:{value:`OUT`,position:`insideTopLeft`,fill:`#EF4444`,fontSize:9}})]})}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 mt-2 text-[10px] text-bambu-gray`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(`span`,{className:`inline-block w-4 border-t-2 border-yellow-400 border-dashed`}),` `,a(`forecast.ropLabel`)]}),(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(`span`,{className:`inline-block w-4 border-t border-bambu-gray border-dashed`}),` `,a(`forecast.safetyStockLegend`)]}),(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(`span`,{className:`inline-block w-4 border-t-2 border-blue-400 border-dashed`}),` `,a(`forecast.stockArrivalLegend`)]}),l&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-red-700 dark:text-red-400`,children:[(0,G.jsx)(`span`,{className:`inline-block w-4 border-t-2 border-red-400`}),` `,a(`forecast.stockoutLegend`)]})]})]}):null]})}function x0e({forecast:e,onClose:t,onAdd:n}){let{t:r}=U(),i=[e.group.brand,e.group.material,e.group.subtype,e.group.colorName].filter(Boolean).join(` `),[a,o]=(0,f.useState)(`qty`),[s,c]=(0,f.useState)(`1`),[l,u]=(0,f.useState)(`30`),[d,p]=(0,f.useState)(``),m=(0,f.useMemo)(()=>{if(!e.dailyRateG||e.dailyRateG<=0)return null;let t=e.dailyRateG*Number(l),n=e.group.spools.length>0?e.group.spools.reduce((e,t)=>e+t.label_weight,0)/e.group.spools.length:1e3;return Math.ceil(t/n)},[e,l]),h=a===`qty`?parseInt(s,10)||1:m??1;function g(t){t.preventDefault(),n({material:e.group.material,subtype:e.group.subtype,brand:e.group.brand,color_name:e.group.colorName,quantity_spools:h,note:d||null})}return(0,G.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4`,children:(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-2xl border border-bambu-dark-tertiary w-full max-w-sm shadow-2xl`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between px-5 pt-5 pb-4 border-b border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(nu,{className:`w-5 h-5 text-bambu-green`}),(0,G.jsx)(`h2`,{className:`text-base font-semibold text-white`,children:r(`forecast.addToCartTitle`)})]}),(0,G.jsx)(`button`,{onClick:t,className:`p-1 text-bambu-gray hover:text-white transition-colors`,children:(0,G.jsx)($u,{className:`w-5 h-5`})})]}),(0,G.jsxs)(`form`,{onSubmit:g,className:`p-5 space-y-4`,children:[(0,G.jsx)(`div`,{className:`text-sm text-bambu-gray`,children:i}),(0,G.jsxs)(`div`,{className:`flex bg-bambu-dark-tertiary rounded-lg p-0.5`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>o(`qty`),className:`flex-1 py-1.5 text-xs font-medium rounded-md transition-colors ${a===`qty`?`bg-bambu-dark-secondary text-white shadow`:`text-bambu-gray hover:text-white`}`,children:r(`forecast.byQuantity`)}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>o(`duration`),className:`flex-1 py-1.5 text-xs font-medium rounded-md transition-colors ${a===`duration`?`bg-bambu-dark-secondary text-white shadow`:`text-bambu-gray hover:text-white`}`,children:r(`forecast.byDuration`)})]}),a===`qty`?(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(`label`,{className:`text-xs text-bambu-gray`,children:r(`forecast.numberOfSpools`)}),(0,G.jsx)(`input`,{type:`number`,min:1,max:99,value:s,onChange:e=>c(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark-tertiary border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`,autoFocus:!0})]}):(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(`label`,{className:`text-xs text-bambu-gray`,children:r(`forecast.lastHowManyDays`)}),(0,G.jsx)(`input`,{type:`number`,min:1,max:365,value:l,onChange:e=>u(e.target.value),className:`w-full px-3 py-2 bg-bambu-dark-tertiary border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`,autoFocus:!0})]}),e.dailyRateG===null?(0,G.jsx)(`div`,{className:`text-xs text-yellow-700 dark:text-yellow-400 px-1`,children:r(`forecast.noUsageQty`)}):(0,G.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 bg-bambu-dark-tertiary/50 rounded-lg`,children:[(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:`≈`}),(0,G.jsx)(`span`,{className:`text-sm font-semibold text-bambu-green`,children:r(`forecast.spoolCount`,{count:m??0})}),(0,G.jsxs)(`span`,{className:`text-xs text-bambu-gray`,children:[`at `,e.dailyRateG.toFixed(1),`g/day`]})]})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(`label`,{className:`text-xs text-bambu-gray`,children:r(`forecast.noteOptional`)}),(0,G.jsx)(`input`,{type:`text`,maxLength:200,value:d,onChange:e=>p(e.target.value),placeholder:r(`forecast.notePlaceholder`),className:`w-full px-3 py-2 bg-bambu-dark-tertiary border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/40 focus:outline-none focus:border-bambu-green`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 pt-1`,children:[(0,G.jsx)(`button`,{type:`submit`,className:`flex-1 py-2 bg-bambu-green text-white text-sm font-medium rounded-lg hover:bg-bambu-green/80 transition-colors`,children:r(`forecast.addNSpools`,{count:h})}),(0,G.jsx)(`button`,{type:`button`,onClick:t,className:`px-4 py-2 text-sm text-bambu-gray hover:text-white border border-bambu-dark-tertiary rounded-lg transition-colors`,children:r(`forecast.cancel`)})]})]})]})})}var l9={material:``,subtype:``,brand:``,color_name:``,rgba:`808080FF`,extra_colors:``,effect_type:``,label_weight:1e3,core_weight:250,core_weight_catalog_id:null,weight_used:0,slicer_filament:``,note:``,cost_per_kg:null,category:``,low_stock_threshold_pct:null,material_number:``,location_id:null,spoolman_filament_id:null},S0e=new Set([`material`,`subtype`,`brand`,`rgba`,`color_name`,`label_weight`]);function C0e(e,t=!1,n=!1,r=`create`){let i={};return t||n||r!==`create`?(!e.material&&!e.spoolman_filament_id&&(i.material=`Material is required`),{isValid:Object.keys(i).length===0,errors:i}):(e.slicer_filament||(i.slicer_filament=`Slicer preset is required`),e.material||(i.material=`Material is required`),e.brand||(i.brand=`Brand is required`),e.subtype||(i.subtype=`Subtype is required`),{isValid:Object.keys(i).length===0,errors:i})}var w0e={local:`bg-green-100 dark:bg-green-500/20 text-green-700 dark:text-green-400`,orca_cloud:`bg-purple-100 dark:bg-purple-500/20 text-purple-700 dark:text-purple-400`,cloud:`bg-bambu-blue/20 text-bambu-blue`,builtin:`bg-amber-100 dark:bg-amber-500/20 text-amber-700 dark:text-amber-400`};function u9({source:e}){let{t}=U(),n={local:t(`profiles.localProfiles.badge`),orca_cloud:t(`configureAmsSlot.orcaCloud`),cloud:t(`configureAmsSlot.bambuCloud`),builtin:t(`configureAmsSlot.builtin`)}[e];return(0,G.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded whitespace-nowrap ${w0e[e]}`,children:n})}function T0e({value:e,options:t,inheritLabel:n,onChange:r,disabled:i=!1,ariaLabel:a}){let{t:o}=U(),[s,c]=(0,f.useState)(!1),[l,u]=(0,f.useState)(``),d=(0,f.useRef)(null),p=t.find(t=>t.code===e);(0,f.useEffect)(()=>{if(!s)return;let e=e=>{d.current&&!d.current.contains(e.target)&&c(!1)},t=e=>{e.key===`Escape`&&(e.stopPropagation(),c(!1))};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t,!0),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t,!0)}},[s]);let m=l.trim().toLowerCase(),h=m?t.filter(e=>e.displayName.toLowerCase().includes(m)):t,g=e=>{r(e),c(!1),u(``)};return(0,G.jsxs)(`div`,{className:`relative`,ref:d,children:[(0,G.jsxs)(`button`,{type:`button`,"aria-label":a,"aria-haspopup":`listbox`,"aria-expanded":s,disabled:i,onClick:()=>c(e=>!e),className:`w-full flex items-center gap-2 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-sm text-left focus:outline-none focus:border-bambu-green disabled:opacity-50`,children:[(0,G.jsx)(`span`,{className:`flex-1 min-w-0 truncate ${p?`text-white`:`text-bambu-gray italic`}`,children:p?p.displayName:n}),p&&(0,G.jsx)(u9,{source:p.source}),(0,G.jsx)(as,{className:`w-3.5 h-3.5 text-bambu-gray shrink-0`})]}),s&&(0,G.jsxs)(`div`,{className:`absolute z-50 mt-1 w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl`,children:[(0,G.jsx)(`div`,{className:`p-2 border-b border-bambu-dark-tertiary`,children:(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(Kl,{className:`w-3.5 h-3.5 text-bambu-gray absolute left-2 top-1/2 -translate-y-1/2`}),(0,G.jsx)(`input`,{autoFocus:!0,type:`text`,value:l,onChange:e=>u(e.target.value),placeholder:o(`inventory.searchPresets`),className:`w-full pl-7 pr-7 py-1.5 bg-bambu-dark border border-bambu-dark-tertiary rounded-md text-sm text-white placeholder:text-bambu-gray/60 focus:outline-none focus:border-bambu-green`}),l&&(0,G.jsx)(`button`,{type:`button`,"aria-label":o(`common.clear`),onClick:()=>u(``),className:`absolute right-2 top-1/2 -translate-y-1/2 text-bambu-gray hover:text-white`,children:(0,G.jsx)($u,{className:`w-3.5 h-3.5`})})]})}),(0,G.jsxs)(`div`,{className:`max-h-56 overflow-y-auto p-1`,role:`listbox`,"aria-label":a,children:[(0,G.jsx)(`button`,{type:`button`,role:`option`,"aria-selected":!p,onClick:()=>g(null),className:`w-full text-left px-2 py-1.5 rounded-md text-sm italic ${p?`text-bambu-gray hover:bg-bambu-dark`:`bg-bambu-green/15 text-bambu-green`}`,children:n}),h.length===0?(0,G.jsx)(`p`,{className:`px-2 py-2 text-sm text-bambu-gray`,children:o(`inventory.noResults`)}):h.map(t=>(0,G.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":t.code===e,onClick:()=>g(t),className:`w-full flex items-center gap-2 text-left px-2 py-1.5 rounded-md text-sm ${t.code===e?`bg-bambu-green/15 text-bambu-green`:`text-white hover:bg-bambu-dark`}`,children:[(0,G.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,title:t.displayName,children:t.displayName}),(0,G.jsx)(u9,{source:t.source})]},t.code))]})]})]})}function E0e(e,t){if(t.length===0)return{top:[],rest:e};let n=new Set(t.map(e=>e.toLowerCase()));return{top:e.filter(e=>n.has(e.toLowerCase())),rest:e.filter(e=>!n.has(e.toLowerCase()))}}function d9({label:e}){return(0,G.jsx)(`div`,{className:`px-3 py-1 text-[11px] font-semibold uppercase tracking-wide text-bambu-gray/70 bg-bambu-dark-tertiary/40`,children:e})}function D0e({formData:e,updateField:t,cloudAuthenticated:n,loadingCloudPresets:r,presetInputValue:i,setPresetInputValue:a,selectedPresetOption:o,filamentOptions:s,availableBrands:c,availableMaterials:l,suggestedBrands:u,suggestedMaterials:d,quickAdd:p,detailsRequired:m,quantity:h,onQuantityChange:g,errors:_}){let{t:v}=U(),[y,b]=(0,f.useState)(!1),[x,S]=(0,f.useState)(!1),[C,w]=(0,f.useState)(!1),[T,E]=(0,f.useState)(!1),[D,O]=(0,f.useState)(``),[k,A]=(0,f.useState)(``),[j,M]=(0,f.useState)(``),[N,P]=(0,f.useState)(String(e.label_weight)),[F,I]=(0,f.useState)(!1),[L,R]=(0,f.useState)(new Set),z=(0,f.useRef)(null),B=(0,f.useRef)(null),V=(0,f.useRef)(null),ee=(0,f.useRef)(null);(0,f.useEffect)(()=>{let e=e=>{z.current&&!z.current.contains(e.target)&&b(!1),ee.current&&!ee.current.contains(e.target)&&E(!1),B.current&&!B.current.contains(e.target)&&S(!1),V.current&&!V.current.contains(e.target)&&w(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]);let te=(0,f.useMemo)(()=>{if(!i)return s;let e=i.toLowerCase();return s.filter(t=>t.displayName.toLowerCase().includes(e)||t.code.toLowerCase().includes(e))},[s,i]),ne=(0,f.useMemo)(()=>{if(!D)return c;let e=D.toLowerCase();return c.filter(t=>t.toLowerCase().includes(e)).sort((t,n)=>{let r=t.toLowerCase()===e,i=n.toLowerCase()===e;return r&&!i?-1:!r&&i?1:t.localeCompare(n)})},[c,D]),re=(0,f.useMemo)(()=>{if(!k)return cU;let e=k.toLowerCase();return cU.filter(t=>t.toLowerCase().includes(e))},[k]),ie=(0,f.useMemo)(()=>{if(!j)return l;let e=j.toLowerCase();return l.filter(t=>t.toLowerCase().includes(e)).sort((t,n)=>{let r=t.toLowerCase()===e,i=n.toLowerCase()===e;return r&&!i?-1:!r&&i?1:t.localeCompare(n)})},[j,l]),ae=(0,f.useMemo)(()=>E0e(ne,u),[ne,u]),oe=(0,f.useMemo)(()=>E0e(ie,d),[ie,d]);(0,f.useEffect)(()=>{F||P(String(e.label_weight))},[e.label_weight,F]);let se=n=>{t(`slicer_filament`,n.code),a(n.displayName),b(!1);let r=mU(n.name),i=new Set,o=[[`material`,r.material],[`brand`,r.brand],[`subtype`,r.variant]];for(let[n,r]of o)r&&(e[n]&&!L.has(n)||(t(n,r),i.add(n)));R(i)},H=(e,n)=>{L.has(e)&&R(t=>{let n=new Set(t);return n.delete(e),n}),t(e,n)},ce=t=>(0,G.jsx)(`button`,{type:`button`,className:`w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary ${e.brand===t?`bg-bambu-green/10 text-bambu-green`:`text-white`}`,onClick:()=>{H(`brand`,t),S(!1),O(``)},children:t},t),le=t=>(0,G.jsx)(`button`,{type:`button`,className:`w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary ${e.material===t?`bg-bambu-green/10 text-bambu-green`:`text-white`}`,onClick:()=>{H(`material`,t),E(!1),M(``)},children:t},t);return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[!p&&(0,G.jsx)(`div`,{className:`flex items-center gap-2 text-xs text-bambu-gray`,children:r?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{className:`w-3 h-3 animate-spin`}),` `,v(`inventory.loadingPresets`)]}):n?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Ds,{className:`w-3 h-3 text-bambu-green`}),` `,v(`inventory.cloudConnected`)]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Ts,{className:`w-3 h-3`}),` `,v(`inventory.cloudNotConnected`)]})}),!p&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:[v(`inventory.slicerPreset`),m&&` *`]}),(0,G.jsxs)(`div`,{className:`relative`,ref:z,children:[(0,G.jsx)(Kl,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray/50 pointer-events-none`}),(0,G.jsx)(`input`,{type:`text`,className:`w-full pl-9 pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green`,placeholder:v(`inventory.searchPresets`),value:i,onChange:e=>{a(e.target.value),b(!0)},onFocus:()=>{b(!0),a(``)}}),y&&(0,G.jsx)(`div`,{className:`absolute z-50 w-full mt-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-lg max-h-64 overflow-y-auto`,children:te.length===0?(0,G.jsx)(`div`,{className:`px-3 py-2 text-sm text-bambu-gray`,children:v(`inventory.noPresetsFound`)}):te.map(e=>(0,G.jsxs)(`button`,{type:`button`,className:`w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary flex items-center gap-2 ${o?.code===e.code?`bg-bambu-green/10 text-bambu-green`:`text-white`}`,onClick:()=>se(e),children:[(0,G.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,title:e.displayName,children:e.displayName}),(0,G.jsx)(u9,{source:e.source})]},`${e.code}::${e.name}`))})]}),o&&(0,G.jsxs)(`div`,{className:`mt-1 text-xs text-bambu-gray`,children:[v(`inventory.selectedPreset`),`: `,(0,G.jsx)(`span`,{className:`font-mono text-bambu-green`,children:o.code})]}),_?.slicer_filament&&(0,G.jsx)(`p`,{className:`mt-1 text-xs text-red-700 dark:text-red-400`,children:_.slicer_filament})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:[v(`inventory.material`),` *`]}),(0,G.jsxs)(`div`,{className:`relative`,ref:ee,children:[(0,G.jsx)(`input`,{type:`text`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green`,placeholder:v(`inventory.selectMaterial`),value:T?j:e.material,onChange:e=>{M(e.target.value),E(!0)},onFocus:()=>{E(!0),M(``)}}),(0,G.jsx)(as,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray/50 pointer-events-none`}),T&&(0,G.jsxs)(`div`,{className:`absolute z-50 w-full mt-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-lg max-h-48 overflow-y-auto`,children:[ie.length===0?(0,G.jsx)(`div`,{className:`px-3 py-2 text-sm text-bambu-gray`,children:v(`inventory.noResults`)}):(0,G.jsxs)(G.Fragment,{children:[oe.top.length>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(d9,{label:v(`inventory.suggestedOptions`)}),oe.top.map(le)]}),oe.rest.length>0&&(0,G.jsxs)(G.Fragment,{children:[oe.top.length>0&&(0,G.jsx)(d9,{label:v(`inventory.allOptions`)}),oe.rest.map(le)]})]}),j&&!ie.includes(j)&&(0,G.jsx)(`button`,{type:`button`,className:`w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary text-bambu-green border-t border-bambu-dark-tertiary`,onClick:()=>{H(`material`,j),E(!1),M(``)},children:v(`inventory.useCustomMaterial`,{material:j})})]})]}),_?.material&&(0,G.jsx)(`p`,{className:`mt-1 text-xs text-red-700 dark:text-red-400`,children:_.material})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:[v(`inventory.brand`),m&&` *`]}),(0,G.jsxs)(`div`,{className:`relative`,ref:B,children:[(0,G.jsx)(`input`,{type:`text`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green`,placeholder:v(`inventory.searchBrand`),value:x?D:e.brand,onChange:e=>{O(e.target.value),S(!0)},onFocus:()=>{S(!0),O(``)}}),(0,G.jsx)(as,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray/50 pointer-events-none`}),x&&(0,G.jsxs)(`div`,{className:`absolute z-50 w-full mt-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-lg max-h-48 overflow-y-auto`,children:[ne.length===0?(0,G.jsx)(`div`,{className:`px-3 py-2 text-sm text-bambu-gray`,children:v(`inventory.noResults`)}):(0,G.jsxs)(G.Fragment,{children:[ae.top.length>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(d9,{label:v(`inventory.suggestedOptions`)}),ae.top.map(ce)]}),ae.rest.length>0&&(0,G.jsxs)(G.Fragment,{children:[ae.top.length>0&&(0,G.jsx)(d9,{label:v(`inventory.allOptions`)}),ae.rest.map(ce)]})]}),D&&!ne.includes(D)&&(0,G.jsx)(`button`,{type:`button`,className:`w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary text-bambu-green border-t border-bambu-dark-tertiary`,onClick:()=>{H(`brand`,D),S(!1),O(``)},children:v(`inventory.useCustomBrand`,{brand:D})})]})]}),_?.brand&&(0,G.jsx)(`p`,{className:`mt-1 text-xs text-red-700 dark:text-red-400`,children:_.brand})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:[v(`inventory.subtype`),m&&` *`]}),(0,G.jsxs)(`div`,{className:`relative`,ref:V,children:[(0,G.jsx)(`input`,{type:`text`,value:C?k:e.subtype,onChange:e=>{A(e.target.value),w(!0)},onFocus:()=>{w(!0),A(``)},placeholder:`Basic, Matte, Silk...`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green`}),(0,G.jsx)(as,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray/50 pointer-events-none`}),C&&(0,G.jsxs)(`div`,{className:`absolute z-50 w-full mt-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-lg max-h-48 overflow-y-auto`,children:[re.length===0?(0,G.jsx)(`div`,{className:`px-3 py-2 text-sm text-bambu-gray`,children:v(`inventory.noResults`)}):re.map(t=>(0,G.jsx)(`button`,{type:`button`,className:`w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary ${e.subtype===t?`bg-bambu-green/10 text-bambu-green`:`text-white`}`,onClick:()=>{H(`subtype`,t),w(!1),A(``)},children:t},t)),k&&!cU.some(e=>e.toLowerCase()===k.toLowerCase().trim())&&(0,G.jsx)(`button`,{type:`button`,className:`w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary text-bambu-green border-t border-bambu-dark-tertiary`,onClick:()=>{H(`subtype`,k),w(!1),A(``)},children:v(`inventory.useCustomBrand`,{brand:k})})]})]}),_?.subtype&&(0,G.jsx)(`p`,{className:`mt-1 text-xs text-red-700 dark:text-red-400`,children:_.subtype})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:v(`inventory.labelWeight`)}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(`input`,{type:`number`,className:`w-full px-3 py-2 pr-7 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`,value:N,min:0,onFocus:()=>I(!0),onChange:e=>P(e.target.value),onBlur:()=>{I(!1);let n=N.trim(),r=Number(n);if(!n||!Number.isFinite(r)||r<0){P(String(e.label_weight));return}let i=Math.round(r);t(`label_weight`,i),P(String(i))}}),(0,G.jsx)(`span`,{className:`absolute right-2 top-1/2 -translate-y-1/2 text-xs text-bambu-gray`,children:`g`})]})]}),p&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:v(`inventory.quantity`)}),(0,G.jsx)(Xp,{className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`,value:h,min:1,max:100,onChange:g,fallback:1})]})]})}function O0e(e){let t=e.split(/[\s,]+/).map(e=>e.trim().replace(/^#/,``)).filter(Boolean),n=[],r=[];for(let e of t)(e.length===6||e.length===8)&&/^[0-9a-fA-F]+$/.test(e)?n.push(e.toLowerCase()):r.push(e);return{value:n.join(`,`),invalid:r}}function k0e({formData:e,updateField:t,recentColors:n,onColorUsed:r,catalogColors:i}){let{t:a}=U(),[o,s]=(0,f.useState)(!1),[c,l]=(0,f.useState)(``),u=(e.rgba.replace(`#`,``)+`FF`).substring(0,8).toUpperCase(),d=u.substring(0,6),p=u.substring(6,8)===`00`,[m,h]=(0,f.useState)(p?u:d);(0,f.useEffect)(()=>{h(p?u:d)},[d,u,p]);let g=e=>u===(e.replace(`#`,``)+`FF`).substring(0,8).toUpperCase(),_=e=>jf(e),v=(e,n,i,a)=>{let o=e.replace(`#`,``).toUpperCase();if(t(`rgba`,o.length===8?o:o+`FF`),t(`color_name`,n),i!==void 0){let e=i??``;w(e),E([]),D.current=e,t(`extra_colors`,e)}a!==void 0&&t(`effect_type`,a??``),r({name:n,hex:e})},y=(0,f.useMemo)(()=>{if(i.length===0)return[];let t=e.brand?.trim(),n=e.material?.toLowerCase().trim(),r=e.subtype?.toLowerCase().trim();if(!t&&!n)return[];let a=t?t.toLowerCase().split(/[\s\-_]+/).filter(e=>e.length>=2):[],o=e=>{if(a.length===0)return!0;let t=e.toLowerCase();return a.some(e=>t.includes(e))};if(t&&!n){let e=i.filter(e=>o(e.manufacturer));if(e.length>0)return e.map(e=>({name:e.color_name,hex:e.hex_color.replace(`#`,``).substring(0,6),manufacturer:e.manufacturer,material:typeof e.material==`string`?e.material:void 0,extra_colors:e.extra_colors??null,effect_type:e.effect_type??null}))}let s=n&&r?`${n} ${r}`:``;if(s){let e=i.filter(e=>o(e.manufacturer)&&e.material?.toLowerCase()===s);if(e.length>0)return e.map(e=>({name:e.color_name,hex:e.hex_color.replace(`#`,``).substring(0,6),manufacturer:e.manufacturer,material:typeof e.material==`string`?e.material:void 0,extra_colors:e.extra_colors??null,effect_type:e.effect_type??null}));let t=s.replace(/\+$/,``);if(t!==s){let e=i.filter(e=>o(e.manufacturer)&&e.material?.toLowerCase()===t);if(e.length>0)return e.map(e=>({name:e.color_name,hex:e.hex_color.replace(`#`,``).substring(0,6),manufacturer:e.manufacturer,material:typeof e.material==`string`?e.material:void 0}))}}if(n){let e=i.filter(e=>o(e.manufacturer)&&(!e.material||e.material.toLowerCase().startsWith(n)));if(e.length>0)return e.map(e=>({name:e.color_name,hex:e.hex_color.replace(`#`,``).substring(0,6),manufacturer:e.manufacturer,material:typeof e.material==`string`?e.material:void 0,extra_colors:e.extra_colors??null,effect_type:e.effect_type??null}))}return[]},[i,e.brand,e.material,e.subtype]),b=(0,f.useMemo)(()=>{if(!c)return y;if(y.length===0)return[];let e=c.toLowerCase();return y.filter(t=>t.name.toLowerCase().includes(e)||(t.manufacturer?.toLowerCase().includes(e)??!1)||(t.material?.toLowerCase().includes(e)??!1))},[c,y]),x=y.length>0,S=(0,f.useMemo)(()=>c?uU.filter(e=>e.name.toLowerCase().includes(c.toLowerCase())):o?uU:lU,[c,o]),[C,w]=(0,f.useState)(e.extra_colors),[T,E]=(0,f.useState)([]),D=(0,f.useRef)(e.extra_colors);(0,f.useEffect)(()=>{e.extra_colors!==D.current&&(w(e.extra_colors),E([]),D.current=e.extra_colors)},[e.extra_colors]);let O=(0,f.useMemo)(()=>bm({rgba:e.rgba,extraColors:e.extra_colors,effectType:e.effect_type,subtype:e.subtype,effectSize:`bar`}),[e.rgba,e.extra_colors,e.effect_type,e.subtype]),k=e=>{if(w(e),!e.trim()){E([]),D.current=``,t(`extra_colors`,``);return}let{value:n,invalid:r}=O0e(e);E(r),D.current=n,t(`extra_colors`,n)};return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(`div`,{className:`h-10 rounded-lg border border-bambu-dark-tertiary`,style:O,"data-testid":`color-preview-banner`}),n.length>0&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-bambu-gray shrink-0`,children:[(0,G.jsx)(ws,{className:`w-3 h-3`}),(0,G.jsx)(`span`,{children:a(`inventory.recentColors`)})]}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:n.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>v(e.hex,e.name),className:`w-6 h-6 rounded border-2 transition-all hover:scale-110 ${g(e.hex)?`border-bambu-green ring-1 ring-bambu-green/30 scale-110`:`border-bambu-dark-tertiary`}`,style:_(e.hex),title:e.name},e.hex))})]}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(Kl,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray/50 pointer-events-none`}),(0,G.jsx)(`input`,{type:`text`,className:`w-full pl-9 pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green`,placeholder:a(`inventory.searchColors`),value:c,onChange:e=>l(e.target.value)})]}),x?(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:c?a(`inventory.searchResults`):`${e.brand}${e.material?` ${e.material}`:``}`}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[b.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>v(e.hex,e.name,e.extra_colors,e.effect_type),className:`w-6 h-6 rounded border-2 transition-all hover:scale-110 hover:z-20 relative group ${g(e.hex)?`border-bambu-green ring-1 ring-bambu-green/30 scale-110`:`border-bambu-dark-tertiary`}`,style:_(e.hex),title:e.manufacturer&&e.material?`${e.name} (${e.manufacturer} — ${e.material})`:e.manufacturer?`${e.name} (${e.manufacturer})`:e.name,children:(0,G.jsx)(`span`,{className:`absolute -bottom-7 left-1/2 -translate-x-1/2 px-2 py-0.5 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-xs whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-20 shadow-lg text-white`,children:e.manufacturer&&e.material?`${e.name} (${e.manufacturer} — ${e.material})`:e.manufacturer?`${e.name} (${e.manufacturer})`:e.name})},`${e.hex}-${e.name}-${e.manufacturer??``}`)),b.length===0&&(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray py-1`,children:a(`inventory.noColorsFound`)})]})]}):(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-bambu-gray`,children:[(0,G.jsx)(`span`,{children:a(c?`inventory.searchResults`:o?`inventory.allColors`:`inventory.commonColors`)}),!c&&(0,G.jsx)(`button`,{type:`button`,onClick:()=>s(!o),className:`flex items-center gap-1 hover:text-white transition-colors`,children:o?(0,G.jsxs)(G.Fragment,{children:[a(`inventory.showLess`),` `,(0,G.jsx)(ls,{className:`w-3 h-3`})]}):(0,G.jsxs)(G.Fragment,{children:[a(`inventory.showAll`),` `,(0,G.jsx)(as,{className:`w-3 h-3`})]})})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[S.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>v(e.hex,e.name),className:`w-6 h-6 rounded border-2 transition-all hover:scale-110 hover:z-20 relative group ${g(e.hex)?`border-bambu-green ring-1 ring-bambu-green/30 scale-110`:`border-bambu-dark-tertiary`}`,style:_(e.hex),title:e.name,children:(0,G.jsx)(`span`,{className:`absolute -bottom-7 left-1/2 -translate-x-1/2 px-2 py-0.5 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-xs whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-20 shadow-lg text-white`,children:e.name})},e.hex)),S.length===0&&(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray py-1`,children:a(`inventory.noColorsFound`)})]})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:a(`inventory.colorName`)}),(0,G.jsx)(`input`,{type:`text`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green`,placeholder:a(`inventory.colorNamePlaceholder`),value:e.color_name,onChange:e=>t(`color_name`,e.target.value)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:a(`inventory.hexColor`)}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsxs)(`div`,{className:`relative flex-1`,children:[(0,G.jsx)(`span`,{className:`absolute left-3 top-1/2 -translate-y-1/2 text-bambu-gray`,children:`#`}),(0,G.jsx)(`input`,{type:`text`,className:`w-full pl-7 pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm font-mono uppercase focus:outline-none focus:border-bambu-green`,placeholder:`RRGGBB`,value:m.toUpperCase(),onChange:e=>{let n=e.target.value.replace(`#`,``).replace(/[^0-9A-Fa-f]/g,``).toUpperCase(),r=n.length>8?n.substring(0,8):n;h(r),r.length===6?t(`rgba`,r+`FF`):r.length===8&&t(`rgba`,r)},onBlur:()=>{if(m.length===7){let e=m+`0`;h(e),t(`rgba`,e)}else if(m.length>0&&m.length<6){let e=m.padEnd(6,`0`);h(e),t(`rgba`,e+`FF`)}}})]}),(0,G.jsx)(`input`,{type:`color`,className:`w-11 h-[38px] rounded-lg cursor-pointer border border-bambu-dark-tertiary shrink-0 bg-transparent`,value:`#${d}`,onChange:e=>{t(`rgba`,e.target.value.replace(`#`,``).toUpperCase()+`FF`)},title:a(`inventory.pickColor`)})]})]})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3 pt-2 border-t border-bambu-dark-tertiary/50`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:a(`inventory.extraColorsLabel`)}),(0,G.jsx)(`input`,{type:`text`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm font-mono placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green`,placeholder:a(`inventory.extraColorsPlaceholder`),value:C,onChange:e=>k(e.target.value),"data-testid":`extra-colors-input`}),T.length>0&&(0,G.jsx)(`p`,{className:`text-xs text-red-700 dark:text-red-400 mt-1`,children:a(`inventory.extraColorsInvalid`,{tokens:T.join(`, `)})}),!T.length&&(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray/70 mt-1`,children:a(`inventory.extraColorsHint`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1 flex items-center gap-1.5`,children:[(0,G.jsx)(du,{className:`w-3.5 h-3.5`}),a(`inventory.colorEffectLabel`)]}),(0,G.jsxs)(`div`,{className:`flex gap-2 items-stretch`,children:[(0,G.jsx)(`select`,{className:`flex-1 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`,value:e.effect_type,onChange:e=>t(`effect_type`,e.target.value),"data-testid":`effect-type-select`,children:_m.map(e=>(0,G.jsx)(`option`,{value:e.value,children:a(e.labelKey)},e.value||`none`))}),(0,G.jsx)(xm,{rgba:e.rgba,extraColors:e.extra_colors,effectType:e.effect_type,subtype:e.subtype,effectSize:`preview`,className:`w-10 h-10`,shape:`square`})]})]})]})]})}function A0e({catalog:e,value:t,onChange:n,catalogId:r,onCatalogIdChange:i}){let{t:a}=U(),[o,s]=(0,f.useState)(!1),[c,l]=(0,f.useState)(``),u=(0,f.useRef)(null),d=(0,f.useRef)(null);(0,f.useEffect)(()=>{let e=e=>{u.current&&!u.current.contains(e.target)&&s(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]),(0,f.useEffect)(()=>{if(e.length===0)return;let n=e.filter(e=>e.weight===t);if(r){let n=e.find(e=>e.id===r);if(n&&n.weight===t)return}n.length===1?i(n[0].id):n.length===0&&r!==null&&i(null)},[t,e,r,i]);let p=(0,f.useMemo)(()=>{if(!c)return e;let t=c.toLowerCase();return e.filter(e=>e.name.toLowerCase().includes(t)||e.weight.toString().includes(t))},[e,c]),m=(0,f.useMemo)(()=>e.filter(e=>e.weight===t),[e,t]),h=(0,f.useMemo)(()=>{if(o)return c;if(r){let t=e.find(e=>e.id===r);if(t)return t.name}return m.length>0?m[0].name:``},[o,c,r,e,m]);return(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Hl,{className:`w-3.5 h-3.5 text-bambu-gray`}),a(`inventory.coreWeight`)]})}),(0,G.jsxs)(`div`,{className:`flex gap-2 items-center`,children:[(0,G.jsxs)(`div`,{className:`flex-1 min-w-0 relative`,ref:u,children:[(0,G.jsx)(`input`,{ref:d,type:`text`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green`,placeholder:a(`inventory.searchSpoolWeight`),value:h,onFocus:()=>{s(!0),l(``)},onChange:e=>{l(e.target.value),s(!0)}}),o&&(0,G.jsx)(`div`,{className:`absolute z-50 w-full mt-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-lg max-h-64 overflow-y-auto`,children:p.length===0?(0,G.jsx)(`div`,{className:`px-3 py-2 text-sm text-bambu-gray`,children:a(`inventory.noResults`)}):p.map(e=>(0,G.jsxs)(`button`,{type:`button`,className:`w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary flex justify-between items-center ${(r?e.id===r:e.weight===t)?`bg-bambu-green/10 text-bambu-green`:`text-white`}`,onClick:()=>{i(e.id),n(e.weight),s(!1),l(``)},children:[(0,G.jsx)(`span`,{className:`truncate`,children:e.name}),(0,G.jsxs)(`span`,{className:`font-mono text-xs text-bambu-gray ml-2 shrink-0`,children:[e.weight,`g`]})]},e.id))})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,G.jsx)(`input`,{type:`number`,className:`w-16 px-2 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm text-center font-mono focus:outline-none focus:border-bambu-green`,value:t,min:0,max:2e3,onChange:e=>{let t=parseInt(e.target.value);!isNaN(t)&&t>=0&&n(t)}}),(0,G.jsx)(`span`,{className:`text-bambu-gray text-sm`,children:`g`})]})]})]})}function j0e({formData:e,updateField:t,spoolCatalog:n,currencySymbol:r,availableCategories:i,availableMaterialNumbers:a,availableLocations:o=[],onCreateLocation:s,globalLowStockThreshold:c,spoolmanMode:l=!1}){let{t:u}=U(),{showToast:d}=qd(),[p,m]=(0,f.useState)(``),[h,g]=(0,f.useState)(!1),[_,v]=(0,f.useState)(``),[y,b]=(0,f.useState)(!1),[x,S]=(0,f.useState)(``),[C,w]=(0,f.useState)(!1),T=Math.max(0,e.label_weight-e.weight_used),E=e.core_weight+T;return(0,f.useEffect)(()=>{h||m(String(E))},[h,E]),(0,f.useEffect)(()=>{y||v(String(T))},[y,T]),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-x-4 gap-y-4`,children:[(0,G.jsx)(`div`,{className:`sm:col-span-2`,children:(0,G.jsx)(A0e,{catalog:n,value:e.core_weight,onChange:e=>t(`core_weight`,e),catalogId:e.core_weight_catalog_id,onCatalogIdChange:e=>t(`core_weight_catalog_id`,e)})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:u(`inventory.currentWeight`)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`div`,{className:`relative flex-1`,children:[(0,G.jsx)(`input`,{type:`number`,value:_,min:0,max:e.label_weight,onFocus:()=>b(!0),onChange:e=>{v(e.target.value)},onBlur:()=>{b(!1);let n=_.trim(),r=Number(n);if(!n||!Number.isFinite(r)||r<0||r>e.label_weight){v(String(T));return}let i=Math.round(r);t(`weight_used`,Math.max(0,e.label_weight-i)),v(String(i))},className:`w-full px-3 py-2 pr-7 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`}),(0,G.jsx)(`span`,{className:`absolute right-2 top-1/2 -translate-y-1/2 text-xs text-bambu-gray`,children:`g`})]}),(0,G.jsxs)(`span`,{className:`text-xs text-bambu-gray shrink-0`,children:[`/ `,e.label_weight,`g`]})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:u(`inventory.measuredWeight`)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`div`,{className:`relative flex-1`,children:[(0,G.jsx)(`input`,{type:`number`,value:p,min:0,onFocus:()=>g(!0),onChange:e=>{m(e.target.value)},onBlur:()=>{g(!1);let n=p.trim(),r=Number(n),i=e.core_weight,a=e.core_weight+e.label_weight;if(!n||!Number.isFinite(r)||ra){d(u(`inventory.measuredWeightError`,{min:i,max:a}),`error`),m(String(E));return}let o=Math.round(r),s=Math.max(0,Math.min(e.label_weight,o-e.core_weight));t(`weight_used`,Math.max(0,e.label_weight-s)),m(String(o))},className:`w-full px-3 py-2 pr-7 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`}),(0,G.jsx)(`span`,{className:`absolute right-2 top-1/2 -translate-y-1/2 text-xs text-bambu-gray`,children:`g`})]}),(0,G.jsxs)(`span`,{className:`text-xs text-bambu-gray shrink-0`,children:[`/ `,e.core_weight+e.label_weight,`g`]})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:u(`inventory.costPerKg`,`Cost per kg`)}),(0,G.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,G.jsxs)(`div`,{className:`relative flex-1`,children:[(0,G.jsx)(`span`,{className:`absolute left-3 top-1/2 -translate-y-1/2 text-bambu-gray text-sm pointer-events-none`,children:r}),(0,G.jsx)(`input`,{type:`number`,value:e.cost_per_kg??``,min:0,step:.01,placeholder:`0.00`,onChange:e=>{t(`cost_per_kg`,e.target.value===``?null:parseFloat(e.target.value))},style:{paddingLeft:`${Math.max(2,r.length*.6+1)}rem`},className:`w-full py-2 pr-3 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`})]})})]}),!l&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,htmlFor:`spool-material-number`,children:u(`inventory.materialNumber`)}),(0,G.jsx)(`input`,{id:`spool-material-number`,type:`text`,list:`spool-material-number-options`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green`,placeholder:u(`inventory.materialNumberPlaceholder`),value:e.material_number,maxLength:64,onChange:e=>t(`material_number`,e.target.value)}),a.length>0&&(0,G.jsx)(`datalist`,{id:`spool-material-number-options`,children:a.map(e=>(0,G.jsx)(`option`,{value:e},e))}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:u(`inventory.materialNumberHelp`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,htmlFor:`spool-category`,children:u(`inventory.category`)}),(0,G.jsx)(`input`,{id:`spool-category`,type:`text`,list:`spool-category-options`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green`,placeholder:u(`inventory.categoryPlaceholder`),value:e.category,maxLength:50,onChange:e=>t(`category`,e.target.value)}),i.length>0&&(0,G.jsx)(`datalist`,{id:`spool-category-options`,children:i.map(e=>(0,G.jsx)(`option`,{value:e},e))})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,htmlFor:`spool-low-stock-threshold`,children:u(`inventory.lowStockThresholdOverride`)}),(0,G.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,G.jsxs)(`div`,{className:`relative flex-1`,children:[(0,G.jsx)(`input`,{id:`spool-low-stock-threshold`,type:`number`,className:`w-full px-3 py-2 pr-8 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green`,placeholder:String(c),value:e.low_stock_threshold_pct??``,min:1,max:99,step:1,onChange:e=>{let n=e.target.value;if(n===``){t(`low_stock_threshold_pct`,null);return}let r=Number(n);Number.isFinite(r)&&t(`low_stock_threshold_pct`,Math.min(99,Math.max(1,Math.round(r))))}}),(0,G.jsx)(`span`,{className:`absolute right-3 top-1/2 -translate-y-1/2 text-xs text-bambu-gray pointer-events-none`,children:`%`})]})}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:u(`inventory.lowStockThresholdOverrideHelp`,{global:c})})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,htmlFor:`spool-storage-location`,children:u(`inventory.storageLocation`)}),(0,G.jsxs)(`select`,{id:`spool-storage-location`,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`,value:e.location_id??``,onChange:e=>{let n=e.target.value;if(!n){t(`location_id`,null);return}t(`location_id`,Number(n))},children:[(0,G.jsx)(`option`,{value:``,children:u(`inventory.storageLocationNone`)}),o.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),s&&(0,G.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[(0,G.jsx)(`input`,{type:`text`,maxLength:255,className:`flex-1 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green`,placeholder:u(`locations.createPlaceholder`),value:x,onChange:e=>S(e.target.value)}),(0,G.jsx)(`button`,{type:`button`,className:`px-3 py-2 text-sm rounded-lg bg-bambu-dark-tertiary text-white hover:bg-bambu-gray-dark disabled:opacity-50`,disabled:!x.trim()||C,onClick:async()=>{let e=x.trim();if(!(!e||!s)){w(!0);try{let n=await s(e);n&&(t(`location_id`,n.id),S(``))}finally{w(!1)}}},children:u(`locations.addShort`)})]})]}),(0,G.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:u(`inventory.note`)}),(0,G.jsx)(`textarea`,{className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green resize-none min-h-[80px]`,placeholder:u(`inventory.notePlaceholder`),value:e.note,onChange:e=>t(`note`,e.target.value)})]})]})}function M0e({links:e,onChange:t,currencySymbol:n}){let{t:r}=U(),{showToast:i}=qd(),a=no(),o=(0,f.useRef)(null),[s,c]=(0,f.useState)(!1),[l,u]=(0,f.useState)(``),[d,p]=(0,f.useState)(!1),{data:m=[],isLoading:h,isError:g}=K({queryKey:h6,queryFn:Z.getSuppliers});(0,f.useEffect)(()=>{if(!s)return;let e=e=>{o.current&&!o.current.contains(e.target)&&(c(!1),u(``))};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[s]);let _=(0,f.useMemo)(()=>new Set(e.map(e=>e.supplier_id)),[e]),v=(0,f.useMemo)(()=>m.filter(e=>!_.has(e.id)).filter(e=>e.name.toLowerCase().includes(l.trim().toLowerCase())),[m,_,l]),y=m.some(e=>e.name.toLowerCase()===l.trim().toLowerCase()),b=n=>{t([...e,{supplier_id:n.id,supplier_name:n.name,supplier_article_number:``,quoted_price_per_kg:null,is_purchase_source:!1}]),c(!1),u(``)},x=async()=>{let e=l.trim();if(e){p(!0);try{let t=await Z.createSupplier({name:e});await g6(a),b(t)}catch(e){console.error(`SupplierSection.createAndAdd failed:`,e),i(r(e instanceof id&&e.status===409?`inventory.suppliers.duplicateName`:`inventory.suppliers.createFailed`),`error`)}finally{p(!1)}}},S=(n,r)=>{t(e.map(e=>e.supplier_id===n?{...e,...r}:r.is_purchase_source?{...e,is_purchase_source:!1}:e))},C=n=>{t(e.filter(e=>e.supplier_id!==n))};return(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:r(`inventory.suppliers.label`)}),e.length>0&&(0,G.jsx)(`div`,{className:`space-y-2 mb-2`,children:e.map(e=>(0,G.jsxs)(`div`,{className:`p-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs bg-bambu-green/10 text-bambu-green`,children:[(0,G.jsx)(vu,{className:`w-3 h-3`}),e.supplier_name]}),(0,G.jsxs)(`label`,{className:`ml-auto flex items-center gap-1.5 text-xs text-bambu-gray cursor-pointer`,title:r(`inventory.suppliers.purchaseSourceHelp`),children:[(0,G.jsx)(`input`,{type:`checkbox`,className:`w-3.5 h-3.5 accent-bambu-green`,checked:e.is_purchase_source,onChange:t=>S(e.supplier_id,{is_purchase_source:t.target.checked})}),r(`inventory.suppliers.purchaseSource`)]}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>C(e.supplier_id),className:`p-1 rounded text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary`,"aria-label":r(`common.remove`),children:(0,G.jsx)($u,{className:`w-3.5 h-3.5`})})]}),(0,G.jsxs)(`div`,{className:`flex gap-2 mt-2`,children:[(0,G.jsx)(`input`,{type:`text`,className:`flex-1 min-w-0 px-2 py-1.5 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-xs placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green`,placeholder:r(`inventory.suppliers.articleNumberPlaceholder`),value:e.supplier_article_number,maxLength:100,onChange:t=>S(e.supplier_id,{supplier_article_number:t.target.value})}),(0,G.jsxs)(`div`,{className:`relative w-28`,children:[(0,G.jsx)(`span`,{className:`absolute left-2 top-1/2 -translate-y-1/2 text-xs text-bambu-gray pointer-events-none`,children:n}),(0,G.jsx)(`input`,{type:`number`,className:`w-full pl-6 pr-2 py-1.5 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-xs text-right placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green`,placeholder:r(`inventory.suppliers.pricePlaceholder`),title:r(`inventory.suppliers.priceHelp`),min:0,step:.01,value:e.quoted_price_per_kg??``,onChange:t=>S(e.supplier_id,{quoted_price_per_kg:t.target.value===``?null:parseFloat(t.target.value)})})]})]})]},e.supplier_id))}),(0,G.jsxs)(`div`,{className:`relative`,ref:o,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>c(e=>!e),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-sm text-bambu-gray hover:text-white flex items-center justify-between transition-colors focus:outline-none focus:border-bambu-green`,children:[(0,G.jsx)(`span`,{children:r(`inventory.suppliers.addSupplier`)}),(0,G.jsx)(as,{className:`w-4 h-4 transition-transform ${s?`rotate-180`:``}`})]}),s&&(0,G.jsxs)(`div`,{className:`absolute z-50 w-full mt-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-lg`,children:[(0,G.jsx)(`div`,{className:`p-2 border-b border-bambu-dark-tertiary`,children:(0,G.jsx)(`input`,{type:`text`,autoFocus:!0,className:`w-full px-2 py-1.5 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green`,placeholder:r(`inventory.suppliers.searchPlaceholder`),value:l,onChange:e=>u(e.target.value)})}),(0,G.jsx)(`div`,{className:`max-h-48 overflow-y-auto py-1`,children:h?(0,G.jsxs)(`div`,{className:`px-3 py-2 text-sm text-bambu-gray flex items-center gap-2`,children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),r(`common.loading`)]}):g?(0,G.jsxs)(`div`,{className:`px-3 py-2 text-sm text-red-400 flex items-center gap-2`,children:[(0,G.jsx)(Pu,{className:`w-4 h-4`}),r(`inventory.suppliers.loadFailed`)]}):(0,G.jsxs)(G.Fragment,{children:[v.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>b(e),className:`w-full px-3 py-2 text-left text-sm text-white hover:bg-bambu-dark-tertiary`,children:e.name},e.id)),v.length===0&&!l.trim()&&(0,G.jsx)(`div`,{className:`px-3 py-2 text-sm text-bambu-gray`,children:r(`inventory.suppliers.noneLeft`)}),l.trim()&&!y&&(0,G.jsxs)(`button`,{type:`button`,onClick:x,disabled:d,className:`w-full px-3 py-2 text-left text-sm text-bambu-green hover:bg-bambu-dark-tertiary flex items-center gap-1.5`,children:[d?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(kl,{className:`w-4 h-4`}),r(`inventory.suppliers.createNew`,{name:l.trim()})]})]})})]})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:r(`inventory.suppliers.help`)})]})}function N0e({filaments:e,isLoading:t,selectedId:n,onSelect:r}){let{t:i}=U(),[a,o]=(0,f.useState)(!1),[s,c]=(0,f.useState)(``),l=(0,f.useRef)(null),u=(0,f.useRef)(null),d=(0,f.useMemo)(()=>e.find(e=>e.id===n)??null,[e,n]);(0,f.useEffect)(()=>{let e=e=>{l.current&&!l.current.contains(e.target)&&(o(!1),c(``))};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]);let p=(0,f.useMemo)(()=>{let t=s.toLowerCase().trim();return t?e.filter(e=>e.name.toLowerCase().includes(t)||(e.material?.toLowerCase().includes(t)??!1)||(e.vendor?.name.toLowerCase().includes(t)??!1)||(e.color_name?.toLowerCase().includes(t)??!1)):e},[e,s]);(0,f.useEffect)(()=>{a&&u.current?.focus()},[a]);let m=()=>{o(!0),c(``)},h=e=>{r(e),o(!1),c(``)};return(0,G.jsxs)(`div`,{ref:l,className:`relative`,children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,children:i(`inventory.pickFromSpoolmanCatalog`)}),(0,G.jsxs)(`button`,{type:`button`,onClick:m,className:`w-full flex items-center gap-2 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-left focus:outline-none focus:border-bambu-green hover:border-bambu-gray transition-colors`,children:[t?(0,G.jsx)(Y,{className:`w-4 h-4 text-bambu-gray animate-spin shrink-0`}):d?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`w-4 h-4 rounded-full shrink-0 border border-white/20`,style:jf(d.color_hex),"aria-label":i(`inventory.spoolmanFilamentColorSwatch`)}),(0,G.jsxs)(`span`,{className:`text-white text-sm truncate flex-1`,children:[d.vendor?.name?`${d.vendor.name} — `:``,d.name]})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(_l,{className:`w-4 h-4 text-bambu-gray shrink-0`}),(0,G.jsx)(`span`,{className:`text-bambu-gray text-sm flex-1`,children:i(`inventory.spoolmanFilamentCatalog`)})]}),(0,G.jsx)(as,{className:`w-4 h-4 text-bambu-gray shrink-0 ml-auto`})]}),a&&(0,G.jsxs)(`div`,{className:`absolute z-50 w-full mt-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl`,children:[(0,G.jsx)(`div`,{className:`p-2 border-b border-bambu-dark-tertiary`,children:(0,G.jsx)(`input`,{ref:u,type:`text`,value:s,onChange:e=>c(e.target.value),placeholder:i(`inventory.pickFromSpoolmanCatalog`),className:`w-full px-2 py-1.5 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm placeholder-bambu-gray focus:outline-none focus:border-bambu-green`})}),(0,G.jsx)(`ul`,{className:`max-h-56 overflow-y-auto py-1`,children:t?(0,G.jsxs)(`li`,{className:`flex items-center justify-center gap-2 py-4 text-bambu-gray text-sm`,children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),(0,G.jsx)(`span`,{children:i(`common.loading`,`Loading…`)})]}):p.length===0?(0,G.jsx)(`li`,{className:`py-4 text-center text-bambu-gray text-sm`,children:i(`inventory.noSpoolmanFilaments`)}):p.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>h(e),className:`w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-bambu-dark-tertiary transition-colors ${e.id===n?`bg-bambu-dark-tertiary`:``}`,children:[(0,G.jsx)(`span`,{className:`w-4 h-4 rounded-full shrink-0 border border-white/20`,style:jf(e.color_hex),"aria-label":i(`inventory.spoolmanFilamentColorSwatch`)}),(0,G.jsxs)(`span`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`span`,{className:`block text-white text-sm truncate`,children:[e.vendor?.name?`${e.vendor.name} — `:``,e.name]}),(0,G.jsxs)(`span`,{className:`block text-bambu-gray text-xs truncate`,children:[[e.material,e.color_name].filter(Boolean).join(` · `),e.weight?` · ${e.weight}g`:``]})]})]})},e.id))})]})]})}function f9(e){let t=(e??``).trim().toUpperCase().slice(0,2);return t===`HH`||t===`HS`?t:null}function p9(e){return e?e===`HH`?`HF`:`S`:null}function P0e(e,t){let n=e.nozzles??[];return f9(n[(e.printer.nozzle_count??1)>1&&t>0?t:0]?.nozzle_type)??f9(n[0]?.nozzle_type)}function F0e(e){let t=new Set;for(let n of e.nozzles??[]){let e=(n?.nozzle_diameter??``).trim();e&&parseFloat(e)>0&&t.add(e)}for(let n of e.calibrations){let e=(n.nozzle_diameter??``).trim();e&&parseFloat(e)>0&&t.add(e)}return Array.from(t).sort((e,t)=>parseFloat(e)-parseFloat(t))}function I0e(e,t){return(e.printer.nozzle_count??1)>1?[{extruder:1,label:t.left},{extruder:0,label:t.right}]:[{extruder:0,label:t.single}]}function L0e({formData:e,printersWithCalibrations:t,filamentOptions:n,modelPresets:r,setModelPresets:i,selectedProfiles:a,setSelectedProfiles:o,selectedGroupId:s,setSelectedGroupId:c,printerModels:l,isLoading:u=!1}){let{t:d}=U(),p=(0,f.useMemo)(()=>{let e=new Map,n=[];for(let r of t){let t=(r.printer.model||``).trim();if(!t){n.push(r);continue}let i=e.get(t);i?i.push(r):e.set(t,[r])}return[...Array.from(e.entries()).map(([e,t])=>({id:`m:${e}`,model:e,printers:t,diameters:Array.from(new Set([...fU,...t.flatMap(F0e)])).sort((e,t)=>parseFloat(e)-parseFloat(t))})).sort((e,t)=>e.model.localeCompare(t.model)),...n.map(e=>({id:`p:${e.printer.id}`,model:``,printers:[e],diameters:Array.from(new Set([...fU,...F0e(e)])).sort((e,t)=>parseFloat(e)-parseFloat(t))}))]},[t]),m=p.find(e=>e.id===s)??p[0],h=(0,f.useMemo)(()=>{let e=new Map;return(t,r)=>{if(!t)return n;let i=e.get(t);if(i||(i=n.filter(e=>{let n=aU(e.name,l??{});return!n||ZH(n,t)}),e.set(t,i)),r&&!i.some(e=>e.code===r)){let e=n.find(e=>e.code===r);if(e)return[e,...i]}return i}},[n,l]),g=[e.brand,e.material,e.subtype].map(e=>e.trim()).filter(Boolean).join(` `),_=/^[0-9A-Fa-f]{6,8}$/.test(e.rgba)?`#${e.rgba.slice(0,6)}`:`var(--bambu-gray, #808080)`,v=e=>I0e(e,{left:d(`inventory.leftNozzle`),right:d(`inventory.rightNozzle`),single:d(`inventory.nozzle`)}),y=t=>t.printer.connected?t.calibrations.filter(t=>EU(t,e)):[],b=e=>{let t=0;for(let n of e.printers){let r=y(n);for(let i of v(n))for(let o of e.diameters)r.some(e=>(e.extruder_id??0)===i.extruder&&((e.nozzle_diameter??``).trim()||`0.4`)===o)&&(a.get(wU(n.printer.id,i.extruder,o))||t++)}return t},x=(e,t,n)=>{i(r=>{let i=new Map(r),a=TU(e,t);return n?i.set(a,{code:n.code,name:n.name}):i.delete(a),i})},S=(e,t,n,r)=>{o(i=>{let a=new Map(i),o=wU(e,t,n);return r?a.set(o,r):a.delete(o),a})},C=()=>{let t=n.find(t=>t.code===e.slicer_filament);if(!t)return;let r=t.name.split(`@`)[0].trim().toLowerCase();r&&i(e=>{let t=new Map(e);for(let e of p){if(!e.model)continue;let n=h(e.model,void 0).filter(e=>e.name.toLowerCase().startsWith(r)&&aU(e.name,l??{})!==null);if(n.length!==0)for(let r of e.diameters){let i=n.find(e=>RegExp(`\\b${r.replace(`.`,`\\.`)}\\s*nozzle\\b`,`i`).test(e.name)),a=n.find(e=>!/\b[\d.]+\s*nozzle\b/i.test(e.name)),o=i??a;o&&t.set(TU(e.model,r),{code:o.code,name:o.name})}}return t})};if(t.length===0)return(0,G.jsx)(`div`,{className:`p-6 bg-bambu-dark rounded-lg text-center`,children:(0,G.jsxs)(`p`,{className:`text-bambu-gray flex items-center justify-center gap-2`,children:[u&&(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),d(u?`common.loading`:`inventory.noPrintersConfigured`)]})});let w=(e,t,n)=>{let i=TU(e,t),a=r.get(i),o=h(e,a?.code);return(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,G.jsx)(T0e,{ariaLabel:`${e} ${t}mm ${d(`inventory.filamentPreset`)}`,value:a?.code??``,options:o,inheritLabel:n,disabled:!e,onChange:n=>x(e,t,n)})}),(0,G.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide px-2 py-1 rounded-full shrink-0 ${a?`bg-bambu-green/20 text-bambu-green`:`bg-bambu-dark-tertiary text-bambu-gray`}`,children:d(a?`inventory.presetOverride`:`inventory.presetInherited`)})]})};return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(g||e.color_name)&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2.5 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg`,children:[(0,G.jsx)(`span`,{className:`w-5 h-5 rounded-full border border-white/15 shrink-0`,style:{background:_},"aria-hidden":`true`}),g&&(0,G.jsx)(`span`,{className:`text-sm text-white truncate`,children:g}),e.color_name&&(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray truncate`,children:e.color_name})]}),(0,G.jsxs)(`div`,{className:`flex flex-col md:flex-row gap-4`,children:[(0,G.jsx)(`div`,{role:`tablist`,"aria-label":d(`inventory.printersTab`),"aria-orientation":`vertical`,className:`md:w-52 md:shrink-0 md:self-start md:sticky md:top-0 flex md:flex-col gap-1.5 overflow-x-auto md:overflow-x-visible`,children:p.map(e=>{let t=e===m,n=b(e);return(0,G.jsxs)(`button`,{type:`button`,role:`tab`,onClick:()=>c(e.id),"aria-selected":t,className:`flex items-center gap-2 px-3 py-2 rounded-lg border text-left transition-colors shrink-0 md:shrink ${t?`bg-bambu-green/10 border-bambu-green/40 text-white`:`bg-transparent border-transparent text-bambu-gray hover:bg-bambu-dark hover:text-white`}`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`text-sm font-semibold truncate`,children:e.model||d(`inventory.unknownModel`)}),(0,G.jsx)(`div`,{className:`text-[11px] text-bambu-gray`,children:e.printers.length===1?d(`inventory.onePrinter`):d(`inventory.nPrinters`,{n:e.printers.length})})]}),n>0?(0,G.jsx)(`span`,{className:`text-[10px] font-mono px-1.5 py-0.5 rounded-full bg-bambu-dark-tertiary text-bambu-gray shrink-0`,children:n}):(0,G.jsx)(is,{className:`w-3.5 h-3.5 text-bambu-green shrink-0`})]},e.id)})}),(0,G.jsx)(`div`,{className:`flex-1 min-w-0`,children:m&&(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`h4`,{className:`text-base font-semibold text-white truncate`,children:m.model||d(`inventory.unknownModel`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:m.printers.map(e=>e.printer.name).join(`, `)})]}),e.slicer_filament&&(0,G.jsxs)(`button`,{type:`button`,onClick:C,title:d(`inventory.autoMatchPresetsHint`),className:`flex items-center gap-1.5 px-2 py-1 text-xs bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-bambu-gray hover:text-white hover:border-bambu-green transition-colors shrink-0`,children:[(0,G.jsx)(du,{className:`w-3.5 h-3.5`}),d(`inventory.autoMatchPresets`)]})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`p`,{className:`text-xs font-semibold text-bambu-gray uppercase tracking-wide`,children:d(`inventory.filamentPreset`)}),m.model?(0,G.jsx)(`div`,{className:`space-y-2`,children:m.diameters.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(`span`,{className:`text-xs font-mono text-bambu-gray w-14 shrink-0`,children:[e,`mm`]}),(0,G.jsx)(`div`,{className:`flex-1 min-w-0`,children:w(m.model,e,d(`inventory.presetUseSpoolDefault`))})]},e))}):(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray italic`,children:d(`inventory.presetNeedsModel`)})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`p`,{className:`text-xs font-semibold text-bambu-gray uppercase tracking-wide`,children:d(`inventory.kProfilesPerPrinter`)}),e.material?m.printers.map(e=>{let t=y(e);return(0,G.jsxs)(`div`,{className:`p-3 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,G.jsx)(Ml,{className:`w-3.5 h-3.5 text-bambu-gray shrink-0`}),(0,G.jsx)(`span`,{className:`text-sm font-semibold text-white truncate`,children:e.printer.name}),(0,G.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide px-2 py-0.5 rounded-full shrink-0 ${e.printer.connected?`bg-green-500/20 text-green-500`:`bg-bambu-dark-tertiary text-bambu-gray`}`,children:e.printer.connected?d(`inventory.connected`):d(`inventory.offline`)})]}),e.printer.connected?t.length===0?(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray italic py-1`,children:d(`inventory.noKProfilesMatch`)}):(0,G.jsxs)(`div`,{className:`grid gap-x-3 gap-y-1.5 items-center`,style:{gridTemplateColumns:`3.5rem repeat(${v(e).length}, minmax(0, 1fr))`},children:[(0,G.jsx)(`span`,{}),v(e).map(e=>(0,G.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-wide text-bambu-gray`,children:e.label},e.extruder)),m.diameters.map(n=>(0,G.jsxs)(f.Fragment,{children:[(0,G.jsxs)(`span`,{className:`text-xs font-mono text-bambu-gray`,children:[n,`mm`]}),v(e).map(r=>{let i=t.filter(e=>(e.extruder_id??0)===r.extruder&&((e.nozzle_diameter??``).trim()||`0.4`)===n),o=wU(e.printer.id,r.extruder,n),s=a.get(o);if(i.length===0)return(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray/50 px-2 py-1.5`,title:d(`inventory.noKProfilesMatch`),children:`—`},o);let c=P0e(e,r.extruder),l=f9(s?.nozzle_id),u=!!(c&&l&&c!==l);return(0,G.jsxs)(`select`,{title:u?d(`inventory.kProfileFlowMismatch`,{profile:p9(l),fitted:p9(c)}):void 0,"aria-label":`${e.printer.name} ${r.label} ${n}mm`,value:s?String(s.cali_idx):``,onChange:t=>{let a=i.find(e=>String(e.cali_idx)===t.target.value)??null;S(e.printer.id,r.extruder,n,a)},className:`min-w-0 px-2 py-1.5 bg-bambu-dark-secondary border rounded-lg text-sm text-white focus:outline-none focus:border-bambu-green ${u?`border-amber-500/60`:`border-bambu-dark-tertiary`}`,children:[(0,G.jsx)(`option`,{value:``,children:d(`inventory.kProfileNotSet`)}),i.map(e=>{let t=p9(f9(e.nozzle_id));return(0,G.jsx)(`option`,{value:e.cali_idx,children:`${t?`[${t}] `:``}${e.name||e.filament_id} K=${e.k_value.toFixed(3)}`},e.cali_idx)})]},o)})]},n))]}):(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray italic py-1`,children:d(`inventory.printerOffline`)})]},e.printer.id)}):(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray italic`,children:d(`inventory.selectMaterialFirst`)})]})]})})]})]})}function R0e(e){let t=$f(e);return t?t.toLocaleDateString(`en-GB`,{day:`2-digit`,month:`2-digit`,year:`2-digit`})+` `+t.toLocaleTimeString(`en-GB`,{hour:`2-digit`,minute:`2-digit`}):``}var z0e={completed:`text-bambu-green`,failed:`text-red-700 dark:text-red-400`,aborted:`text-yellow-700 dark:text-yellow-400`};function B0e({spoolId:e}){let{t}=U(),n=no(),{showToast:r}=qd(),{data:i,isLoading:a}=K({queryKey:[`spool-usage`,e],queryFn:()=>Z.getSpoolUsageHistory(e)}),o=q({mutationFn:()=>Z.clearSpoolUsageHistory(e),onSuccess:()=>{n.invalidateQueries({queryKey:[`spool-usage`,e]}),r(t(`inventory.historyCleared`),`success`)}});return a?(0,G.jsx)(`div`,{className:`flex justify-center py-4`,children:(0,G.jsx)(Y,{className:`w-5 h-5 animate-spin text-bambu-green`})}):!i||i.length===0?(0,G.jsxs)(`div`,{className:`text-center py-4 text-bambu-gray text-sm`,children:[(0,G.jsx)(ws,{className:`w-5 h-5 mx-auto mb-2 opacity-50`}),t(`inventory.noUsageHistory`)]}):(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`h4`,{className:`text-sm font-medium text-white`,children:t(`inventory.usageHistory`)}),(0,G.jsxs)(Q,{variant:`ghost`,size:`sm`,onClick:()=>o.mutate(),disabled:o.isPending,className:`text-xs text-bambu-gray hover:text-red-700 dark:hover:text-red-400`,children:[(0,G.jsx)(ju,{className:`w-3 h-3 mr-1`}),t(`inventory.clearHistory`)]})]}),(0,G.jsx)(`div`,{className:`max-h-48 overflow-y-auto space-y-1`,children:i.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center justify-between p-2 rounded bg-bambu-dark/50 text-xs`,children:[(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:R0e(e.created_at)}),e.print_name&&(0,G.jsx)(`span`,{className:`text-white ml-2 truncate`,title:e.print_name,children:e.print_name})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0 ml-2`,children:[(0,G.jsxs)(`span`,{className:`text-white font-medium`,children:[e.weight_used.toFixed(1),`g`]}),(0,G.jsxs)(`span`,{className:`text-bambu-gray`,children:[`(`,e.percent_used,`%)`]}),(0,G.jsx)(`span`,{className:z0e[e.status]||`text-bambu-gray`,children:e.status})]})]},e.id))})]})}function V0e(e){return e?`#${e.slice(0,6)}`:`#808080`}function H0e(e){return!e.tray_type||e.tray_type===``}function U0e(e){return e<=3?`AMS ${String.fromCharCode(65+e)}`:e>=128&&e<=135?`AMS HT ${String.fromCharCode(65+e-128)}`:`AMS ${e}`}function W0e({className:e}){return(0,G.jsx)(`svg`,{className:e,viewBox:`0 0 36 54`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,G.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 G0e({className:e}){return(0,G.jsxs)(`svg`,{className:e,viewBox:`0 0 35 53`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,G.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`}),(0,G.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 K0e({className:e}){return(0,G.jsxs)(`svg`,{className:e,viewBox:`0 0 36 54`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,G.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`}),(0,G.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 q0e({className:e}){return(0,G.jsxs)(`svg`,{className:e,viewBox:`0 0 12 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,G.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`}),(0,G.jsx)(`circle`,{cx:`6`,cy:`15`,r:`2.5`,stroke:`#C3C2C1`,strokeWidth:`1`,fill:`none`})]})}function J0e({className:e}){return(0,G.jsxs)(`svg`,{className:e,viewBox:`0 0 12 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,G.jsx)(`rect`,{x:`4.5`,y:`8`,width:`3`,height:`4.5`,fill:`#d4a017`,rx:`0.5`}),(0,G.jsx)(`circle`,{cx:`6`,cy:`15`,r:`2`,fill:`#d4a017`}),(0,G.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 Y0e({className:e}){return(0,G.jsxs)(`svg`,{className:e,viewBox:`0 0 12 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,G.jsx)(`rect`,{x:`4.5`,y:`3`,width:`3`,height:`9.5`,fill:`#c62828`,rx:`0.5`}),(0,G.jsx)(`circle`,{cx:`6`,cy:`15`,r:`2`,fill:`#c62828`}),(0,G.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 X0e({humidity:e,goodThreshold:t=40,fairThreshold:n=60}){let r,i;return e<=t?(r=`#22a352`,i=W0e):e<=n?(r=`#d4a017`,i=G0e):(r=`#c62828`,i=K0e),(0,G.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,G.jsx)(i,{className:`w-3 h-3.5`}),(0,G.jsxs)(`span`,{className:`font-medium tabular-nums text-xs`,style:{color:r},children:[e,`%`]})]})}function Z0e({temp:e,goodThreshold:t=28,fairThreshold:n=35}){let r,i;return e<=t?(r=`#22a352`,i=q0e):e<=n?(r=`#d4a017`,i=J0e):(r=`#c62828`,i=Y0e),(0,G.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,G.jsx)(i,{className:`w-3 h-3.5`}),(0,G.jsxs)(`span`,{className:`font-medium tabular-nums text-xs`,style:{color:r},children:[e,`°C`]})]})}function m9({side:e}){return(0,G.jsx)(`span`,{className:`inline-flex items-center justify-center w-4 h-4 text-[9px] font-bold rounded`,style:{backgroundColor:`#1a4d2e`,color:`#00ae42`},children:e})}function Q0e({tray:e,slotIndex:t,isActive:n,fillOverride:r,spoolmanFill:i,accessibleLabel:a,onClick:o}){let s=H0e(e),c=Dp(e),l=V0e(e.tray_color),u=e.remain!==null&&e.remain!==void 0&&e.remain>=0?e.remain:null,d=i??(r===0&&u!==null&&u>0?null:r)??u;return(0,G.jsxs)(`div`,{className:`relative flex flex-col items-center p-2.5 rounded-lg border transition-all ${n?`ring-2 ring-bambu-green border-bambu-green bg-bambu-green/10`:`border-transparent`} ${o?`cursor-pointer hover:border-bambu-gray hover:bg-bambu-dark-tertiary`:``}`,onClick:o,onKeyDown:o?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),o())}:void 0,role:o?`button`:void 0,tabIndex:o?0:void 0,"aria-pressed":o?n:void 0,"aria-label":o?a:void 0,title:o?a:void 0,"data-testid":o?`ams-slot`:void 0,children:[(0,G.jsxs)(`div`,{className:`relative w-16 h-16 mb-1`,children:[s?(0,G.jsx)(`div`,{className:`w-full h-full rounded-full border-2 border-dashed border-gray-500 flex items-center justify-center`,children:(0,G.jsx)(`div`,{className:`w-3 h-3 rounded-full bg-gray-600`})}):(0,G.jsxs)(`svg`,{viewBox:`0 0 56 56`,className:`w-full h-full`,children:[(0,G.jsx)(`circle`,{cx:`28`,cy:`28`,r:`26`,fill:l}),(0,G.jsx)(`circle`,{cx:`28`,cy:`28`,r:`20`,fill:l,style:{filter:`brightness(0.85)`}}),(0,G.jsx)(`ellipse`,{cx:`20`,cy:`20`,rx:`6`,ry:`4`,fill:`white`,opacity:`0.3`}),(0,G.jsx)(`circle`,{cx:`28`,cy:`28`,r:`8`,fill:`#2d2d2d`}),(0,G.jsx)(`circle`,{cx:`28`,cy:`28`,r:`5`,fill:`#1a1a1a`})]}),n&&(0,G.jsx)(`div`,{className:`absolute -bottom-1 left-1/2 -translate-x-1/2 w-2.5 h-2.5 bg-bambu-green rounded-full`})]}),(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray-light truncate max-w-full`,title:c===`reset`?`Spool loaded — slot not configured`:void 0,children:s?c===`reset`?`?`:`Empty`:e.tray_type||`Unknown`}),!s&&d!==null&&d>=0&&(0,G.jsx)(`div`,{className:`w-full h-1 bg-bambu-dark-tertiary rounded-full overflow-hidden mt-1`,children:(0,G.jsx)(`div`,{className:`h-full rounded-full transition-all`,style:{width:`${d}%`,backgroundColor:Ap(d)}})}),(0,G.jsx)(`span`,{className:`absolute top-1 right-1 rounded bg-bambu-dark-tertiary px-1.5 py-0.5 text-[10px] font-semibold text-bambu-gray-light`,children:t+1})]})}function $0e({unit:e,activeSlot:t,onConfigureSlot:n,isDualNozzle:r,nozzleSide:i,thresholds:a,fillOverrides:o,spoolmanFillOverrides:s}){let{t:c}=U(),l=e.tray||[],u=e.is_ams_ht,d=u?1:4,f=U0e(e.id);return(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-xl border border-[var(--border-color)] p-3 shadow-sm`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`text-white font-medium text-base`,children:f}),r&&i&&(0,G.jsx)(m9,{side:i})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.temp!=null&&(0,G.jsx)(Z0e,{temp:e.temp,goodThreshold:a?.tempGood,fairThreshold:a?.tempFair}),e.humidity!=null&&(0,G.jsx)(X0e,{humidity:e.humidity,goodThreshold:a?.humidityGood,fairThreshold:a?.humidityFair})]})]}),(0,G.jsx)(`div`,{className:`grid ${u?`grid-cols-1 max-w-[100px] mx-auto`:`grid-cols-4`} gap-2`,children:Array.from({length:d}).map((r,i)=>{let a=l[i]||{id:i,tray_color:null,tray_type:``,tray_sub_brands:null,tray_id_name:null,tray_info_idx:null,remain:-1,k:null,cali_idx:null,tag_uid:null,tray_uuid:null,nozzle_temp_min:null,nozzle_temp_max:null};return(0,G.jsx)(Q0e,{tray:a,slotIndex:i,isActive:t===i,fillOverride:o?.[`${e.id}-${i}`]??null,spoolmanFill:s?.[`${e.id}-${i}`]??null,accessibleLabel:c(`configureAmsSlot.slotLabel`,{ams:f,slot:i+1}),onClick:n?()=>n(e.id,i,H0e(a)?null:a):void 0},i)})})]})}function h9(e){return!!e&&(ym(e.extra_colors).length>0||!!e.effect_type)}function g9(e,t=`table`){return h9(e)?{...bm({effectSize:t,rgba:e.rgba,extraColors:e.extra_colors,effectType:e.effect_type,subtype:e.subtype}),backgroundPosition:`center`}:null}function _9(e){return e<=3?`AMS ${String.fromCharCode(65+e)}`:e>=128&&e<=135?`AMS HT ${String.fromCharCode(65+e-128)}`:`AMS ${e}`}function v9(e){return!e.tray_type||e.tray_type===``}function e2e(e){return e?`#${e.slice(0,6)}`:`#808080`}var t2e=[`a[href]`,`button:not([disabled])`,`input:not([disabled]):not([type="hidden"])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`,`);function n2e(e){return Array.from(e.querySelectorAll(t2e)).filter(e=>!e.hasAttribute(`hidden`)&&e.getAttribute(`aria-hidden`)!==`true`)}var y9=e=>(e??``).trim().toUpperCase();function r2e(e,t){let n=y9(e),r=y9(t);return!n||!r?`none`:n===r?`exact`:r.includes(n)||n.includes(r)?`partial`:`none`}function i2e(e,t){let n=y9(e),r=y9(t);return!n||!r?!1:n===r}function b9({isOpen:e,onClose:t,spool:n,printerId:r,variant:i=`dialog`,spoolmanMode:a=!1}){let{t:o}=U(),s=no(),c=(0,f.useRef)(null),[l,u]=(0,f.useState)(r),[d,p]=(0,f.useState)(null),[m,h]=(0,f.useState)(null),[g,_]=(0,f.useState)(null),[v,y]=(0,f.useState)(!1),[b,x]=(0,f.useState)(null),[S,C]=(0,f.useState)(null);(0,f.useEffect)(()=>{e&&(u(r),p(null),h(null),_(null),y(!1),x(null),C(null))},[e,r,n.id]);let w=r===null,T=w,E=r??l,{data:D=[],isLoading:O}=K({queryKey:[`printers`],queryFn:()=>Z.getPrinters(),enabled:e&&w}),k=(0,f.useMemo)(()=>D.filter(e=>e.is_active!==!1),[D]);(0,f.useEffect)(()=>{if(!e)return;let t=document.body.style.overflow,n=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow=`hidden`;let r=c.current;return((r?n2e(r)[0]:null)??r)?.focus(),()=>{document.body.style.overflow=t,n?.isConnected&&n.focus()}},[e]);let A=(0,f.useCallback)(e=>{if(v)return;if(e.key===`Escape`){e.preventDefault(),t();return}if(e.key!==`Tab`)return;let n=c.current;if(!n)return;let r=n2e(n);if(r.length===0){e.preventDefault(),n.focus();return}let i=r[0],a=r[r.length-1],o=document.activeElement;e.shiftKey&&(o===i||!n.contains(o))?(e.preventDefault(),a.focus()):!e.shiftKey&&(o===a||!n.contains(o))&&(e.preventDefault(),i.focus())},[t,v]);(0,f.useEffect)(()=>{if(e)return document.addEventListener(`keydown`,A),()=>document.removeEventListener(`keydown`,A)},[e,A]);let{data:j,isLoading:M}=K({queryKey:[`printerStatus`,E],queryFn:()=>Z.getPrinterStatus(E),enabled:e&&E!==null,refetchInterval:5e3}),{data:N}=K({queryKey:[`printer`,E],queryFn:()=>Z.getPrinter(E),enabled:e&&E!==null}),{data:P}=K({queryKey:[`settings`],queryFn:()=>Z.getSettings(),enabled:e,staleTime:300*1e3}),{data:F}=K({queryKey:[`spool-assignments`,E],queryFn:()=>Z.getAssignments(E),enabled:e&&E!==null,staleTime:30*1e3}),{data:I=[]}=K({queryKey:[`spoolman-slot-assignments`,E],queryFn:()=>Z.getSpoolmanSlotAssignments(E??void 0),enabled:e&&!!a&&E!==null,staleTime:30*1e3}),L=a?I.find(e=>e.spoolman_spool_id===n.id):void 0,R=(0,f.useMemo)(()=>{let e={};if(!F)return e;for(let t of F){let n=t.spool;if(n&&n.label_weight>0&&n.weight_used!=null){let r=Math.round(Math.max(0,n.label_weight-n.weight_used)/n.label_weight*100);e[`${t.ams_id}-${t.tray_id}`]=r}}return e},[F]),z=P?{humidityGood:Number(P.ams_humidity_good)||40,humidityFair:Number(P.ams_humidity_fair)||60,tempGood:Number(P.ams_temp_good)||28,tempFair:Number(P.ams_temp_fair)||35}:void 0,B=j?.connected??!1,V=(0,f.useMemo)(()=>j?.ams??[],[j?.ams]),ee=(0,f.useMemo)(()=>V.filter(e=>!e.is_ams_ht),[V]),te=(0,f.useMemo)(()=>V.filter(e=>e.is_ams_ht),[V]),ne=(0,f.useMemo)(()=>[...j?.vt_tray??[]].sort((e,t)=>(e.id??254)-(t.id??254)),[j?.vt_tray]),re=N?.nozzle_count===2||j?.temperatures?.nozzle_2!==void 0,ie=(0,f.useRef)({});(0,f.useEffect)(()=>{ie.current={}},[E]),(0,f.useEffect)(()=>{j?.ams_extruder_map&&Object.keys(j.ams_extruder_map).length>0&&(ie.current=j.ams_extruder_map)},[j?.ams_extruder_map]);let ae=j?.ams_extruder_map&&Object.keys(j.ams_extruder_map).length>0?j.ams_extruder_map:ie.current,oe=j?.fila_switch?.installed===!0,se=(0,f.useCallback)(e=>{if(!re)return null;let t=ae[String(e)];return t===void 0?oe?null:(e>=128?e-128:e)===1?`L`:`R`:t===1?`L`:`R`},[re,ae,oe]),H=q({mutationFn:async({amsId:e,trayId:t})=>{if(!E)throw Error(`No printer selected`);return a?await Z.assignSpoolmanSlot({spoolman_spool_id:n.id,printer_id:E,ams_id:e,tray_id:t}):await Z.assignSpool({spool_id:n.id,printer_id:E,ams_id:e,tray_id:t})},onSuccess:e=>{_(`success`);let n=e&&`pending_config`in e&&e.pending_config;h(n?o(`spoolbuddy.modal.assignPendingInsert`,`Assigned. Slot will configure when you insert the spool.`):o(`spoolbuddy.modal.assignSuccess`,`Assigned!`)),s.invalidateQueries({queryKey:[`slotPresets`]}),s.invalidateQueries({queryKey:[`spool-assignments`]}),s.invalidateQueries({queryKey:[`spoolman-slot-assignments`]}),s.invalidateQueries({queryKey:[`spoolman-slot-assignments-all`]}),s.invalidateQueries({queryKey:[`inventory-spools`]}),s.invalidateQueries({queryKey:[`spoolman-inventory-spools`]}),setTimeout(()=>t(),n?2500:1500)},onError:e=>{_(`error`),h(e instanceof Error?e.message:o(`spoolbuddy.modal.assignError`,`Failed to assign spool.`))}}),ce=H.isPending,le=(0,f.useCallback)((e,t)=>{if(e===254||e===255){let n=e===254?254:254+t;return ne.find(e=>(e.id??254)===n)||null}return V.find(t=>t.id===e)?.tray?.find(e=>e.id===t)||null},[V,ne]),ue=(0,f.useCallback)((e,t)=>e<=3?`${_9(e)} ${o(`ams.slot`,`Slot`)} ${t+1}`:e>=128&&e<=135?_9(e):re?e===254||e===255&&t===0?o(`printers.extL`,`Ext-L`):o(`printers.extR`,`Ext-R`):o(`printers.ext`,`Ext`),[o,re]),de=(0,f.useCallback)((e,t)=>{_(`info`),h(o(`spoolbuddy.modal.assigning`,`Configuring slot...`)),H.mutate({amsId:e,trayId:t})},[H,o]),fe=(0,f.useCallback)((e,t)=>{if(!ce){if(!P?.disable_filament_warnings){let r=le(e,t);if(r&&!v9(r)){let i=r.tray_sub_brands||r.tray_type||``,a=r2e(n.material,i),o=n.slicer_filament_name||n.slicer_filament,s=r.tray_type||``,c=i2e(o,s);if(a!==`exact`){let r;r=a===`none`&&!c?`material_profile`:a===`partial`&&!c?`partial_profile`:a===`none`?`material`:`partial`;let l=ue(e,t);C({amsId:e,trayId:t}),x({type:r,spoolMaterial:n.material||``,trayMaterial:i||``,spoolProfile:o||void 0,trayProfile:s||void 0,location:l}),y(!0);return}}}de(e,t)}},[ce,P?.disable_filament_warnings,n,le,ue,de]),pe=(0,f.useCallback)((e,t)=>{if(!ce){if(T){p({amsId:e,trayId:t}),h(null),_(null);return}fe(e,t)}},[T,ce,fe]),me=(0,f.useCallback)(()=>{d&&fe(d.amsId,d.trayId)},[fe,d]),he=(0,f.useCallback)(()=>{S&&(y(!1),x(null),de(S.amsId,S.trayId),C(null))},[S,de]),ge=(0,f.useMemo)(()=>{let e=[];for(let t of te){let n=t.tray?.[0]||{id:0,tray_color:null,tray_type:``,tray_sub_brands:null,tray_id_name:null,tray_info_idx:null,remain:-1,k:null,cali_idx:null,tag_uid:null,tray_uuid:null,nozzle_temp_min:null,nozzle_temp_max:null},r=R[`${t.id}-0`]??null,i=n.remain!=null&&n.remain>=0?n.remain:null,a=r===0&&i!==null&&i>0?null:r;e.push({key:`ht-${t.id}`,label:_9(t.id),amsId:t.id,trayId:0,tray:n,isEmpty:v9(n),nozzleSide:se(t.id),effectiveFill:a??i})}for(let t of ne){let n=t.id??254,r=n-254,i=R[`255-${r}`]??null,a=t.remain!=null&&t.remain>=0?t.remain:null,s=i===0&&a!==null&&a>0?null:i;e.push({key:`ext-${n}`,label:re?n===254?o(`printers.extL`,`Ext-L`):o(`printers.extR`,`Ext-R`):o(`printers.ext`,`Ext`),amsId:255,trayId:r,tray:t,isEmpty:v9(t),nozzleSide:re?n===254?`L`:`R`:null,effectiveFill:s??a})}return e},[te,ne,re,o,se,R]);if(!e)return null;let _e=g9(n)??jf(n.rgba),ve=d?ue(d.amsId,d.trayId):null,ye=i===`dialog`;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:ye?`fixed inset-0 z-[60] flex items-center justify-center bg-black/45 dark:bg-black/70 p-2 sm:p-4 backdrop-blur-sm animate-fade-in`:`fixed inset-0 z-[60] bg-bambu-dark`,onClick:ye&&!ce?t:void 0,children:(0,G.jsxs)(`div`,{ref:c,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`assign-to-ams-title`,tabIndex:-1,className:ye?`bg-bambu-dark-secondary text-white font-sans w-full max-w-3xl h-[calc(100vh-1rem)] sm:h-[calc(100vh-2rem)] max-h-[820px] border border-[var(--border-color)] rounded-xl sm:rounded-2xl shadow-2xl flex flex-col overflow-hidden animate-slide-up`:`w-full h-full bg-bambu-dark flex flex-col`,onClick:e=>e.stopPropagation(),children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between bg-bambu-dark-secondary px-5 py-3 border-b border-[var(--border-color)] shrink-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,G.jsx)(`div`,{className:`w-7 h-7 rounded-full shrink-0`,style:_e}),(0,G.jsx)(`div`,{className:`min-w-0`,children:(0,G.jsxs)(`h2`,{id:`assign-to-ams-title`,className:`text-sm font-semibold text-white truncate`,children:[o(`spoolbuddy.modal.assignToAmsTitle`,`Assign to AMS`),(0,G.jsxs)(`span`,{className:`font-normal text-bambu-gray-light ml-2`,children:[Of(n.color_name,n.rgba,n.color_name_is_synthesized)||o(`spoolbuddy.spool.unknownColor`),` • `,n.brand,` `,n.material,n.subtype&&` ${n.subtype}`]}),(0,G.jsxs)(`span`,{className:`text-[10px] font-mono text-bambu-gray ml-2 shrink-0`,children:[`#`,n.id]})]})})]}),(0,G.jsx)(`button`,{onClick:t,disabled:ce,"aria-label":o(`common.close`,`Close`),className:`p-2 rounded-lg text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary transition-colors shrink-0 disabled:opacity-50`,children:(0,G.jsx)($u,{className:`w-5 h-5`})})]}),w&&(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary px-5 py-3 border-b border-[var(--border-color)] shrink-0`,children:[(0,G.jsxs)(`label`,{htmlFor:`assign-spool-printer`,className:`flex items-center gap-2 text-sm font-medium text-white mb-2`,children:[(0,G.jsx)(`span`,{className:`inline-flex h-5 w-5 items-center justify-center rounded-full bg-bambu-green text-[11px] font-bold text-[#ffffff]`,children:`1`}),o(`printModal.selectPrinter`)]}),(0,G.jsxs)(`select`,{id:`assign-spool-printer`,"aria-label":o(`printModal.selectPrinter`),value:l??``,onChange:e=>{u(e.target.value?Number(e.target.value):null),p(null),h(null),_(null)},disabled:ce||O,className:`w-full bg-bambu-dark border border-[var(--border-color)] rounded-lg px-3 py-2.5 text-sm text-white focus:outline-none focus:border-bambu-green disabled:opacity-50`,children:[(0,G.jsx)(`option`,{value:``,children:O?o(`common.loading`):k.length===0?o(`common.noPrinters`):o(`printModal.selectPrinter`)}),k.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),m&&(0,G.jsxs)(`div`,{className:`mx-5 mt-3 p-3 rounded-lg flex items-center gap-3 border shrink-0 ${g===`info`?`bg-blue-50 border-blue-300 dark:bg-blue-500/10 dark:border-blue-500/40`:g===`success`?`bg-green-50 border-green-300 dark:bg-green-500/10 dark:border-green-500/40`:`bg-red-50 border-red-300 dark:bg-red-500/10 dark:border-red-500/40`}`,children:[g===`info`&&(0,G.jsx)(Y,{className:`w-4 h-4 text-blue-600 dark:text-blue-400 animate-spin shrink-0`}),g===`success`&&(0,G.jsx)(ms,{className:`w-4 h-4 text-green-600 dark:text-green-400 shrink-0`}),g===`error`&&(0,G.jsx)(bs,{className:`w-4 h-4 text-red-600 dark:text-red-400 shrink-0`}),(0,G.jsx)(`span`,{className:`text-sm ${g===`info`?`text-blue-700 dark:text-blue-300`:g===`success`?`text-green-700 dark:text-green-300`:`text-red-700 dark:text-red-300`}`,children:m})]}),(0,G.jsx)(`div`,{className:`flex-1 min-h-0 flex flex-col`,children:(0,G.jsxs)(`section`,{className:`flex min-h-[18rem] flex-col gap-3 bg-bambu-dark p-4 lg:min-h-0 lg:overflow-y-auto`,children:[w&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-white shrink-0`,children:[(0,G.jsx)(`span`,{className:`inline-flex h-5 w-5 items-center justify-center rounded-full bg-bambu-green text-[11px] font-bold text-[#ffffff]`,children:`2`}),o(`printModal.selectSlot`)]}),E?M?(0,G.jsxs)(`div`,{className:`flex flex-1 items-center justify-center text-bambu-gray-light`,children:[(0,G.jsx)(Y,{className:`mr-2 h-5 w-5 animate-spin text-bambu-green`}),o(`common.loading`)]}):B?V.length===0&&ne.length===0?(0,G.jsx)(`div`,{className:`flex flex-1 items-center justify-center rounded-xl border border-dashed border-[var(--border-color)] bg-bambu-dark-secondary p-8`,children:(0,G.jsxs)(`div`,{className:`text-center text-bambu-gray`,children:[(0,G.jsx)(Hc,{className:`w-12 h-12 mx-auto mb-3 opacity-60`}),(0,G.jsx)(`p`,{className:`text-base text-bambu-gray-light mb-1`,children:o(`spoolbuddy.ams.noData`,`No AMS detected`)}),(0,G.jsx)(`p`,{className:`text-sm`,children:o(`spoolbuddy.ams.connectAms`,`Connect an AMS to see filament slots`)})]})}):(0,G.jsxs)(G.Fragment,{children:[ee.length>0&&(0,G.jsx)(`div`,{className:`grid grid-cols-1 xl:grid-cols-2 gap-3`,children:ee.map(e=>(0,G.jsx)($0e,{unit:e,activeSlot:d?.amsId===e.id?d.trayId:L?.ams_id===e.id?L.tray_id??null:null,onConfigureSlot:(t,n)=>pe(e.id,n),isDualNozzle:re,nozzleSide:se(e.id),thresholds:z,fillOverrides:R},e.id))}),ge.length>0&&(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2 shrink-0`,children:ge.map(({key:e,label:t,amsId:n,trayId:r,tray:i,isEmpty:a,nozzleSide:s,effectiveFill:c})=>{let l=e2e(i.tray_color),u=d?d.amsId===n&&d.trayId===r:!!L&&L.ams_id===n&&L.tray_id===r;return(0,G.jsxs)(`button`,{type:`button`,"aria-pressed":u,title:ue(n,r),onClick:()=>pe(n,r),className:`bg-bambu-dark-secondary border rounded-lg px-3 py-2 hover:bg-bambu-dark-tertiary transition-all flex items-center gap-2 ${u?`ring-2 ring-bambu-green border-bambu-green bg-bambu-green/10`:`border-[var(--border-color)]`} ${ce?`opacity-50 pointer-events-none`:``}`,children:[(0,G.jsx)(`div`,{className:`relative w-10 h-10 shrink-0`,children:a?(0,G.jsx)(`div`,{className:`w-full h-full rounded-full border-2 border-dashed border-gray-500 flex items-center justify-center`,children:(0,G.jsx)(`div`,{className:`w-1.5 h-1.5 rounded-full bg-gray-600`})}):(0,G.jsxs)(`svg`,{viewBox:`0 0 56 56`,className:`w-full h-full`,children:[(0,G.jsx)(`circle`,{cx:`28`,cy:`28`,r:`26`,fill:l}),(0,G.jsx)(`circle`,{cx:`28`,cy:`28`,r:`20`,fill:l,style:{filter:`brightness(0.85)`}}),(0,G.jsx)(`ellipse`,{cx:`20`,cy:`20`,rx:`6`,ry:`4`,fill:`white`,opacity:`0.3`}),(0,G.jsx)(`circle`,{cx:`28`,cy:`28`,r:`8`,fill:`#2d2d2d`}),(0,G.jsx)(`circle`,{cx:`28`,cy:`28`,r:`5`,fill:`#1a1a1a`})]})}),(0,G.jsxs)(`div`,{className:`min-w-0 text-left`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray font-medium`,children:t}),s&&(0,G.jsx)(m9,{side:s})]}),(0,G.jsx)(`div`,{className:`text-sm text-white truncate`,children:a?o(`ams.empty`):i.tray_type||`?`})]}),!a&&c!=null&&c>=0&&(0,G.jsx)(`div`,{className:`w-1.5 h-8 bg-bambu-dark-tertiary rounded-full overflow-hidden shrink-0 flex flex-col-reverse`,children:(0,G.jsx)(`div`,{className:`w-full rounded-full`,style:{height:`${c}%`,backgroundColor:Ap(c)}})})]},e)})})]}):(0,G.jsx)(`div`,{className:`flex flex-1 items-center justify-center rounded-xl border border-red-300 bg-red-50 p-8 dark:border-red-500/30 dark:bg-red-500/5`,children:(0,G.jsx)(`p`,{className:`text-base text-red-700 dark:text-red-300`,children:o(`spoolbuddy.ams.printerDisconnected`,`Printer disconnected`)})}):(0,G.jsx)(`div`,{className:`flex flex-1 items-center justify-center rounded-xl border border-dashed border-[var(--border-color)] bg-bambu-dark-secondary p-8`,children:(0,G.jsxs)(`div`,{className:`text-center text-bambu-gray`,children:[(0,G.jsx)(Hc,{className:`w-12 h-12 mx-auto mb-3 opacity-60`}),(0,G.jsx)(`p`,{className:`text-base text-bambu-gray-light`,children:o(`printModal.selectPrinter`)})]})})]})}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 bg-bambu-dark-secondary px-5 py-3 border-t border-[var(--border-color)] shrink-0`,children:[T&&(0,G.jsxs)(`div`,{className:`min-w-0 flex-1 text-sm`,children:[(0,G.jsxs)(`span`,{className:`text-bambu-gray`,children:[o(`printModal.selectSlot`),`: `]}),(0,G.jsx)(`span`,{className:ve?`font-medium text-white`:`text-bambu-gray`,children:ve||`—`})]}),(0,G.jsx)(`button`,{onClick:t,disabled:ce,className:`px-5 py-2.5 rounded-lg border border-[var(--border-color)] text-sm font-medium bg-bambu-dark-tertiary text-white hover:bg-bambu-dark transition-colors min-h-[44px] disabled:opacity-50`,children:o(g===`success`?`common.close`:`common.cancel`)}),T&&(0,G.jsxs)(`button`,{type:`button`,onClick:me,disabled:!E||!d||ce||g===`success`,className:`inline-flex min-h-[44px] items-center gap-2 rounded-lg bg-bambu-green px-5 py-2.5 text-sm font-semibold text-[#ffffff] transition-colors hover:bg-bambu-green-dark disabled:cursor-not-allowed disabled:opacity-40`,children:[ce?(0,G.jsx)(Y,{className:`h-4 w-4 animate-spin`}):(0,G.jsx)(is,{className:`h-4 w-4`}),o(`inventory.assignSpool`)]})]})]})}),v&&b&&(()=>{let e=``;return b.type===`material`?e=o(`inventory.assignMismatchMessage`,{spoolMaterial:b.spoolMaterial,trayMaterial:b.trayMaterial,location:b.location}):b.type===`partial`?e=o(`inventory.assignPartialMismatchMessage`,{spoolMaterial:b.spoolMaterial,trayMaterial:b.trayMaterial,location:b.location}):b.type===`material_profile`?e=`${o(`inventory.assignMismatchMessage`,{spoolMaterial:b.spoolMaterial,trayMaterial:b.trayMaterial,location:b.location})}\n\n${o(`inventory.assignProfileMismatchMessage`,{spoolProfile:b.spoolProfile||o(`common.unknown`),trayProfile:b.trayProfile||o(`common.unknown`),location:b.location})}`:b.type===`partial_profile`&&(e=`${o(`inventory.assignPartialMismatchMessage`,{spoolMaterial:b.spoolMaterial,trayMaterial:b.trayMaterial,location:b.location})}\n\n${o(`inventory.assignProfileMismatchMessage`,{spoolProfile:b.spoolProfile||o(`common.unknown`),trayProfile:b.trayProfile||o(`common.unknown`),location:b.location})}`),e=`${e}\n\n${o(`inventory.assignReconfigureNote`)}`,(0,G.jsx)(af,{title:o(`inventory.assignMismatchTitle`),message:e,confirmText:o(`inventory.assignMismatchConfirm`),variant:`warning`,overlayZIndex:`z-[70]`,isLoading:H.isPending,onConfirm:he,onCancel:()=>{H.isPending||(y(!1),C(null),x(null))}})})()]})}var a2e={tag_uid:null,tray_uuid:null,tag_type:null,data_origin:null};function o2e({isOpen:e,onClose:t,spool:n,mode:r,printersWithCalibrations:i=[],currencySymbol:a,onSpoolsCreated:o,spoolmanMode:s=!1,spoolsQueryKey:c=[`inventory-spools`]}){let{t:l}=U(),u=no(),{showToast:d}=qd(),p=()=>_6(u,c),m=r===`edit`,h=r===`copy`,[g,_]=(0,f.useState)(l9),[v,y]=(0,f.useState)({}),[b,x]=(0,f.useState)(`filament`),[S,C]=(0,f.useState)(!1),[w,T]=(0,f.useState)(!1),[E,D]=(0,f.useState)(!1),[O,k]=(0,f.useState)([]),[A,j]=(0,f.useState)(!1),[M,N]=(0,f.useState)(!1),[P,F]=(0,f.useState)(1),[I,L]=(0,f.useState)(!1);(0,f.useEffect)(()=>{L(!1)},[e,n?.id]);let[R,z]=(0,f.useState)(!1),[B,V]=(0,f.useState)(!1),[ee,te]=(0,f.useState)([]),[ne,re]=(0,f.useState)(new Set),[ie,ae]=(0,f.useState)(``),[oe,se]=(0,f.useState)([]),[H,ce]=(0,f.useState)([]),[le,ue]=(0,f.useState)([]),[de,fe]=(0,f.useState)([]),[pe,me]=(0,f.useState)([]),[he,ge]=(0,f.useState)([]),[_e,ve]=(0,f.useState)([]),[ye,be]=(0,f.useState)(!1),[xe,Se]=(0,f.useState)(new Map),[Ce,we]=(0,f.useState)(new Map),[Te,Ee]=(0,f.useState)(``),De=i.length>0?i:_e,Oe=xe.size+Ce.size,{data:ke=[],isLoading:Ae,error:je}=K({queryKey:[`spoolman-inventory-filaments`],queryFn:()=>Z.getSpoolmanInventoryFilaments(),enabled:s&&e,staleTime:6e4,retry:!1});(0,f.useEffect)(()=>{ge(bU())},[]),(0,f.useEffect)(()=>{let t=!1;return e&&((async()=>{V(!0);try{let[e,n]=await Promise.allSettled([(async()=>(await Z.getCloudStatus()).is_authenticated?{connected:!0,presets:await Z.getFilamentPresets()}:{connected:!1,presets:[]})(),(async()=>(await Z.orcaCloudStatus()).connected?{connected:!0,presets:(await Z.orcaCloudListProfiles()).filament}:{connected:!1,presets:[]})()]);if(t)return;let r=e.status===`fulfilled`&&e.value.connected,i=n.status===`fulfilled`&&n.value.connected,a=e.status===`fulfilled`?e.value.presets:[],o=n.status===`fulfilled`?n.value.presets:[];z(r||i),te([...a,...o]),re(new Set(o.map(e=>e.setting_id)))}catch(e){if(t)return;console.error(`Failed to fetch cloud presets:`,e),z(!1)}finally{t||V(!1)}})(),Z.getSpoolCatalog().then(se).catch(console.error),Z.getColorCatalog().then(me).catch(console.error),Z.getLocalPresets().then(e=>ue(e.filament)).catch(console.error),Z.getBuiltinFilaments().then(fe).catch(console.error),Z.getLocations().then(e=>ce(e.map(e=>({id:e.id,name:e.name})))).catch(console.error),i.length===0&&(async()=>{be(!0);try{let e=await Z.getPrinters(),n=await Promise.all(e.map(e=>Z.getPrinterStatus(e.id).catch(()=>null))),r=await Promise.all(e.map(async(e,t)=>{let r=n[t],i=r?.connected??!1,a=[];return i&&(a=await pU(e.id,r)),{printer:{...e,connected:i},calibrations:a,nozzles:r?.nozzles}}));t||ve(r)}catch(e){console.error(`Failed to fetch printer calibrations:`,e)}finally{t||be(!1)}})()),()=>{t=!0}},[e,i.length]);let Me=(0,f.useMemo)(()=>gU(ee,new Set,le,de,ne),[ee,le,de,ne]),Ne=(0,f.useMemo)(()=>{let e=hU(ee,le),t=pe.map(e=>e.manufacturer?.trim()).filter(e=>!!e),n=new Set([...e,...t]);return Array.from(n).sort((e,t)=>e.localeCompare(t))},[ee,le,pe]),Pe=(0,f.useMemo)(()=>{let e=pe.map(e=>e.material?.trim()).filter(e=>!!e),t=new Set([...oU,...e]);return Array.from(t).sort((e,t)=>e.localeCompare(t))},[pe]),Fe=(0,f.useMemo)(()=>{let e=[];for(let t of pe){let n=t.manufacturer?.trim(),r=t.material?.trim();n&&r&&e.push({brand:n,material:r})}for(let t of ee){let n=mU(t.name);n.brand&&n.material&&e.push({brand:n.brand,material:n.material})}for(let t of le){let n=mU(t.name),r=t.filament_vendor?.trim()||n.brand,i=n.material;r&&i&&e.push({brand:r,material:i})}return e},[ee,pe,le]),Ie=(0,f.useMemo)(()=>{let e=new Map;for(let t of Fe){let n=t.brand.toLowerCase(),r=t.material.toLowerCase();e.has(n)||e.set(n,new Set),e.get(n).add(r)}return e},[Fe]),Le=(0,f.useMemo)(()=>{let e=new Map;for(let t of Fe){let n=t.brand.toLowerCase(),r=t.material.toLowerCase();e.has(r)||e.set(r,new Set),e.get(r).add(n)}return e},[Fe]),Re=(0,f.useMemo)(()=>vU(Ne,g.brand),[Ne,g.brand]),ze=(0,f.useMemo)(()=>vU(Pe,g.material),[Pe,g.material]),Be=(0,f.useMemo)(()=>yU(Re,g.material,Le),[Re,g.material,Le]),Ve=(0,f.useMemo)(()=>yU(ze,g.brand,Ie),[ze,g.brand,Ie]),He=(0,f.useMemo)(()=>_U(g.slicer_filament,Me),[g.slicer_filament,Me]);(0,f.useEffect)(()=>{if(e){if(n){let e=n.rgba&&/^[0-9A-Fa-f]{8}$/.test(n.rgba)?n.rgba:`808080FF`;if(_({material:n.material||``,subtype:n.subtype||``,brand:n.brand||``,color_name:n.color_name_is_synthesized?``:n.color_name||``,rgba:e,extra_colors:n.extra_colors||``,effect_type:n.effect_type||``,label_weight:n.label_weight||1e3,core_weight:n.core_weight??250,core_weight_catalog_id:n.core_weight_catalog_id??null,weight_used:h?0:n.weight_used||0,slicer_filament:n.slicer_filament||``,note:n.note||``,cost_per_kg:n.cost_per_kg??null,category:n.category||``,low_stock_threshold_pct:n.low_stock_threshold_pct??null,material_number:n.material_number||``,location_id:n.location_id??null,spoolman_filament_id:null}),ae(n.slicer_filament_name||n.slicer_filament||``),n.k_profiles&&n.k_profiles.length>0){let e=new Map;for(let t of n.k_profiles){if(t.cali_idx===null||t.cali_idx===void 0)continue;let n=(t.nozzle_diameter||``).trim()||`0.4`,r=t.extruder??0;e.set(wU(t.printer_id,r,n),{cali_idx:t.cali_idx,filament_id:``,setting_id:t.setting_id||``,name:t.name||``,k_value:t.k_value,n_coef:0,extruder_id:r,nozzle_diameter:n,nozzle_id:t.nozzle_type||``})}Se(e)}else Se(new Map);k((n.suppliers??[]).map(e=>({supplier_id:e.supplier_id,supplier_name:e.supplier_name,supplier_article_number:e.supplier_article_number??``,quoted_price_per_kg:e.quoted_price_per_kg,is_purchase_source:h?!1:e.is_purchase_source})))}else _(l9),ae(``),Se(new Map),k([]);N(!1),F(1),y({}),x(`filament`),Ee(``),we(new Map),C(!1),T(h&&n?.core_weight_is_inherited===!1),D(!1),j(!1)}},[e,n,r,h]),(0,f.useEffect)(()=>{if(!e||!n)return;let t=!1;return(s?Z.getSpoolmanFilamentPresets:Z.getSpoolFilamentPresets)(n.id).then(e=>{if(t)return;let n=new Map;for(let t of e)n.set(TU(t.printer_model,t.nozzle_diameter||``),{code:t.slicer_filament||``,name:t.slicer_filament_name||``});we(n)}).catch(e=>{t||(console.error(`Failed to load filament preset overrides:`,e),d(l(`inventory.filamentPresetsLoadFailed`),`warning`))}),()=>{t=!0}},[e,n?.id,s]),(0,f.useEffect)(()=>{if(!e||!n||E||g.location_id!=null)return;let t=n.storage_location?.trim();if(!t||H.length===0)return;let r=H.find(e=>e.name.toLowerCase()===t.toLowerCase());r&&_(e=>e.location_id===r.id?e:{...e,location_id:r.id})},[e,n,H,g.location_id,E]);let Ue=(e,t)=>{let n=S0e.has(e);s&&n&&g.spoolman_filament_id!==null&&d(l(`inventory.spoolmanFilamentUnlinked`),`info`),_(r=>({...r,[e]:t,...s&&n&&r.spoolman_filament_id!==null?{spoolman_filament_id:null}:{}})),e===`weight_used`&&C(!0),e===`core_weight`&&T(!0),e===`location_id`&&D(!0),v[e]&&y(t=>({...t,[e]:void 0}))},We=e=>{let t=e.material||``,n=e.name||``,r=t&&n.startsWith(t)?n.slice(t.length).trim():n,i=(e.color_hex??``).replace(`#`,``).toUpperCase(),a=/^[0-9A-F]{6}(?:[0-9A-F]{2})?$/.test(i)?i:`808080`,o=a.length===8?a:`${a}FF`;_(n=>({...n,spoolman_filament_id:e.id,material:t,subtype:r,brand:e.vendor?.name||``,rgba:o,color_name:e.color_name||``,label_weight:e.weight??n.label_weight})),d(l(`inventory.spoolmanFilamentSelected`),`success`)},Ge=e=>{ge(t=>xU(e,t))},Ke=q({mutationFn:e=>s?Z.createSpoolmanInventorySpool(e):Z.createSpool(e),onSuccess:async e=>{e?.id&&(!await dt(e.id)||!await ut(e.id))||(await p(),o&&o([e]),d(l(`inventory.spoolCreated`),`success`),t())},onError:e=>{e instanceof id&&e.status===503?d(l(`inventory.spoolmanUnreachable`),`error`):d(l(`inventory.saveFailed`),`error`)}}),qe=q({mutationFn:({data:e,qty:t})=>s?Z.bulkCreateSpoolmanInventorySpools(e,t):Z.bulkCreateSpools(e,t),onSuccess:async e=>{let n=s&&`created`in e?e:null,r=n?n.created:e;if(xe.size>0||Ce.size>0)for(let e of r)await dt(e.id);if(lt)for(let e of r)await ut(e.id);await p(),o&&o(r),n&&n.failed_count>0?d(l(`inventory.spoolsPartiallyCreated`,{created:r.length,total:n.requested_count}),`warning`):d(l(`inventory.spoolsCreated`,{count:r.length}),`success`),t()},onError:e=>{e instanceof id&&e.status===503?d(l(`inventory.spoolmanUnreachable`),`error`):d(l(`inventory.saveFailed`),`error`)}}),Je=q({mutationFn:e=>s?Z.updateSpoolmanInventorySpool(n.id,e):Z.updateSpool(n.id,e),onSuccess:async()=>{n?.id&&(!await dt(n.id)||!await ut(n.id))||(await p(),d(l(`inventory.spoolUpdated`),`success`),t())},onError:e=>{e instanceof id&&e.status===503?d(l(`inventory.spoolmanUnreachable`),`error`):d(l(`inventory.saveFailed`),`error`)}}),Ye=q({mutationFn:()=>s?Z.updateSpoolmanInventorySpool(n.id,a2e):Z.updateSpool(n.id,a2e),onSuccess:async()=>{await p(),d(l(`inventory.rfidCleared`,`RFID tag cleared`),`success`),t()},onError:e=>{e instanceof id&&e.status===503?d(l(`inventory.spoolmanUnreachable`),`error`):d(l(`inventory.tagClearFailed`),`error`)}}),{data:Xe,isLoading:Ze}=K({queryKey:[`spool-assignments`],queryFn:()=>Z.getAssignments(),enabled:e&&m&&!s}),{data:Qe,isLoading:$e}=K({queryKey:[`spoolman-slot-assignments-all`],queryFn:()=>Z.getSpoolmanSlotAssignments(),enabled:e&&m&&s}),et=(()=>{if(n)return s?Qe?.find(e=>e.spoolman_spool_id===n.id):Xe?.find(e=>e.spool_id===n.id)})(),tt=s?$e:Ze,{data:nt}=K({queryKey:[`inventory-spools`],queryFn:()=>Z.getSpools(!0),enabled:e}),{data:rt}=K({queryKey:[`settings`],queryFn:Z.getSettings,enabled:e}),{data:it}=K({queryKey:[`slicerPrinterModels`],queryFn:Z.getSlicerPrinterModels,enabled:e,staleTime:1/0}),at=(()=>{let e=new Set;for(let t of nt??[]){let n=t.category?.trim();n&&e.add(n)}return Array.from(e).sort((e,t)=>e.localeCompare(t))})(),ot=(()=>{let e=new Set;for(let t of nt??[]){let n=t.material_number?.trim();n&&e.add(n)}return Array.from(e).sort((e,t)=>e.localeCompare(t,void 0,{numeric:!0}))})(),st=rt?.low_stock_threshold??20,ct=q({mutationFn:async()=>{if(!et)throw Error(`No assignment`);if(s){if(!n)throw Error(`No spool`);await Z.unassignSpoolmanSlot(n.id);return}await Z.unassignSpool(et.printer_id,et.ams_id,et.tray_id)},onSuccess:async()=>{s?(await u.invalidateQueries({queryKey:[`spoolman-slot-assignments-all`]}),await u.invalidateQueries({queryKey:[`spoolman-slot-assignments`]})):await u.invalidateQueries({queryKey:[`spool-assignments`]}),d(l(`inventory.unassignSuccess`,`Spool unassigned`),`success`),t()},onError:e=>{d(e.message,`error`)}}),lt=A||h,ut=async e=>{if(!lt)return!0;let t=s?Z.setSpoolmanSpoolSuppliers:Z.setSpoolSuppliers;try{return await t(e,O.map(e=>({supplier_id:e.supplier_id,supplier_article_number:e.supplier_article_number.trim()||null,quoted_price_per_kg:e.quoted_price_per_kg,is_purchase_source:e.is_purchase_source}))),!0}catch(e){return console.error(`SpoolFormModal.saveSupplierLinks failed:`,e),d(l(`inventory.suppliers.saveFailed`),`error`),!1}},dt=async e=>{let t=s?Z.saveSpoolmanKProfiles:Z.saveSpoolKProfiles,n=s?Z.saveSpoolmanFilamentPresets:Z.saveSpoolFilamentPresets,r=[];for(let[e,t]of xe){let[n,i,a]=e.split(`:`);r.push({printer_id:parseInt(n),extruder:parseInt(i),nozzle_diameter:a||`0.4`,nozzle_type:f9(t.nozzle_id),k_value:t.k_value,name:t.name||null,cali_idx:t.cali_idx,setting_id:t.setting_id||null})}let i=[];for(let[e,t]of Ce){let{model:n,diameter:r}=CAe(e);n&&i.push({printer_model:n,nozzle_diameter:r,slicer_filament:t.code||null,slicer_filament_name:t.name||null})}try{await t(e,r)}catch(e){return console.error(`Failed to save K-profiles:`,e),d(l(`inventory.kProfileSaveFailed`),`warning`),!1}try{await n(e,i)}catch(e){return console.error(`Failed to save filament preset overrides:`,e),d(l(`inventory.filamentPresetSaveFailed`),`warning`),!1}return!0};if((0,f.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&!I&&t()};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,t,I]),!e)return null;let ft=()=>{let e=C0e(g,M,s,r);if(!e.isValid){y(e.errors),(e.errors.slicer_filament||e.errors.material||e.errors.brand||e.errors.subtype)&&x(`filament`);return}let t=He?.displayName||ie||null,n={material:g.material||null,subtype:g.subtype||null,brand:g.brand||null,color_name:g.color_name||null,rgba:g.rgba||null,extra_colors:g.extra_colors||null,effect_type:g.effect_type||null,label_weight:g.label_weight,...s?w?{core_weight:g.core_weight}:{}:{core_weight:g.core_weight,core_weight_catalog_id:g.core_weight_catalog_id},slicer_filament:g.slicer_filament||null,slicer_filament_name:t,nozzle_temp_min:null,nozzle_temp_max:null,note:g.note||null,cost_per_kg:g.cost_per_kg,category:g.category.trim()||null,low_stock_threshold_pct:g.low_stock_threshold_pct,material_number:g.material_number.trim()||null,...s?{spoolman_filament_id:g.spoolman_filament_id}:{}};(!m||S)&&(n.weight_used=g.weight_used),(!m||E)&&(n.location_id=g.location_id),m?Je.mutate(n):P>1?qe.mutate({data:n,qty:P}):Ke.mutate(n)},pt=Ke.isPending||qe.isPending||Je.isPending||Ye.isPending||ct.isPending;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[(0,G.jsx)(`div`,{className:`absolute inset-0 bg-black/60 backdrop-blur-sm`,onClick:t}),(0,G.jsxs)(`div`,{className:`relative w-full max-w-5xl mx-4 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-xl shadow-2xl max-h-[90vh] flex flex-col`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-bambu-dark-tertiary flex-shrink-0`,children:[(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-baseline gap-2`,children:[l(m?`inventory.editSpool`:h?`inventory.copySpool`:`inventory.addSpool`),m&&n&&(0,G.jsxs)(`span`,{className:`text-sm font-mono text-bambu-gray`,children:[`#`,n.id]})]}),(0,G.jsx)(`button`,{onClick:t,className:`p-1 text-bambu-gray hover:text-white rounded transition-colors`,children:(0,G.jsx)($u,{className:`w-5 h-5`})})]}),r===`create`&&(0,G.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 border-b border-bambu-dark-tertiary flex-shrink-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(td,{className:`w-4 h-4 text-amber-600 dark:text-amber-400`}),(0,G.jsx)(`span`,{className:`text-sm text-white`,children:l(`inventory.quickAdd`)})]}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>{N(!M),M||x(`filament`)},className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors ${M?`bg-bambu-green`:`bg-bambu-dark-tertiary`}`,children:(0,G.jsx)(`span`,{className:`inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform ${M?`translate-x-4`:`translate-x-0.5`}`})})]}),(0,G.jsxs)(`div`,{className:`flex border-b border-bambu-dark-tertiary flex-shrink-0`,children:[(0,G.jsxs)(`button`,{onClick:()=>x(`filament`),className:`flex-1 px-4 py-2.5 text-sm font-medium flex items-center justify-center gap-2 transition-colors ${b===`filament`?`text-bambu-green border-b-2 border-bambu-green`:`text-bambu-gray hover:text-white`}`,children:[(0,G.jsx)(zo,{className:`w-4 h-4`}),l(`inventory.filamentInfoTab`)]}),!M&&(0,G.jsxs)(`button`,{onClick:()=>x(`appearance`),className:`flex-1 px-4 py-2.5 text-sm font-medium flex items-center justify-center gap-2 transition-colors ${b===`appearance`?`text-bambu-green border-b-2 border-bambu-green`:`text-bambu-gray hover:text-white`}`,children:[(0,G.jsx)(vl,{className:`w-4 h-4`}),l(`inventory.colorAndCostTab`)]}),!M&&(0,G.jsxs)(`button`,{onClick:()=>x(`printers`),className:`flex-1 px-4 py-2.5 text-sm font-medium flex items-center justify-center gap-2 transition-colors ${b===`printers`?`text-bambu-green border-b-2 border-bambu-green`:`text-bambu-gray hover:text-white`}`,children:[(0,G.jsx)(td,{className:`w-4 h-4`}),l(`inventory.printersTab`),Oe>0&&(0,G.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded-full bg-bambu-green/20 text-bambu-green`,children:Oe})]})]}),(0,G.jsx)(`div`,{className:`p-4 overflow-y-auto flex-1`,style:{scrollbarGutter:`stable`},children:b===`filament`?(0,G.jsxs)(`div`,{className:`space-y-6`,children:[s&&!m&&(0,G.jsx)(`div`,{children:je?(0,G.jsx)(`p`,{className:`text-sm text-red-700 dark:text-red-400 px-1`,children:l(`inventory.spoolmanCatalogLoadFailed`)}):(0,G.jsx)(N0e,{filaments:ke,isLoading:Ae,selectedId:g.spoolman_filament_id,onSelect:We})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-sm font-semibold text-bambu-gray uppercase tracking-wide mb-3`,children:l(`inventory.filamentInfo`)}),(0,G.jsx)(D0e,{formData:g,updateField:Ue,cloudAuthenticated:R,loadingCloudPresets:B,presetInputValue:ie,setPresetInputValue:ae,selectedPresetOption:He,filamentOptions:Me,availableBrands:Re,availableMaterials:ze,suggestedBrands:Be,suggestedMaterials:Ve,quickAdd:M,detailsRequired:!M&&!s&&r===`create`,quantity:P,onQuantityChange:F,errors:v})]})]}):b===`appearance`?(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-sm font-semibold text-bambu-gray uppercase tracking-wide mb-3`,children:l(`inventory.color`)}),(0,G.jsx)(k0e,{formData:g,updateField:Ue,recentColors:he,onColorUsed:Ge,catalogColors:pe})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-sm font-semibold text-bambu-gray uppercase tracking-wide mb-3`,children:l(`inventory.additional`)}),(0,G.jsx)(j0e,{formData:g,updateField:Ue,spoolCatalog:oe,currencySymbol:a,availableCategories:at,availableMaterialNumbers:ot,availableLocations:H,onCreateLocation:async e=>{try{let t=await Z.createLocation({name:e});return ce(e=>[...e,{id:t.id,name:t.name}].sort((e,t)=>e.name.localeCompare(t.name))),await m6(u),{id:t.id,name:t.name}}catch(e){return console.error(e),d((e instanceof Error?e.message:l(`locations.saveFailed`))||l(`locations.saveFailed`),`error`),null}},globalLowStockThreshold:st,spoolmanMode:s})]}),(0,G.jsx)(`div`,{children:(0,G.jsx)(M0e,{links:O,onChange:e=>{k(e),j(!0)},currencySymbol:a})}),m&&n&&!s&&(0,G.jsx)(`div`,{children:(0,G.jsx)(B0e,{spoolId:n.id})})]}):(0,G.jsx)(L0e,{formData:g,printersWithCalibrations:De,filamentOptions:Me,modelPresets:Ce,setModelPresets:we,selectedProfiles:xe,setSelectedProfiles:Se,selectedGroupId:Te,setSelectedGroupId:Ee,printerModels:it,isLoading:ye})}),(0,G.jsxs)(`div`,{className:`flex gap-2 p-4 border-t border-bambu-dark-tertiary flex-shrink-0`,children:[m&&(0,G.jsxs)(`div`,{className:`flex gap-2 mr-auto`,children:[(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>Ye.mutate(),disabled:pt||!(n?.tag_uid||n?.tray_uuid),children:[(0,G.jsx)(xu,{className:`w-4 h-4`}),l(`inventory.clearRfid`,`Clear RFID Tag`)]}),et?(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>ct.mutate(),disabled:pt||tt,children:[(0,G.jsx)(Lu,{className:`w-4 h-4`}),l(`inventory.unassignSpool`,`Unassign`)]}):(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>L(!0),disabled:pt||tt,children:[(0,G.jsx)(Wc,{className:`w-4 h-4`}),l(`inventory.assignSpool`,`Assign Spool`)]})]}),(0,G.jsxs)(`div`,{className:`flex gap-2 ml-auto`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:t,children:l(`common.cancel`)}),(0,G.jsx)(Q,{onClick:ft,disabled:pt,children:pt?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),l(`common.saving`)]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Vl,{className:`w-4 h-4`}),l(m?`common.save`:h?`inventory.copySpool`:`inventory.addSpool`)]})})]})]})]})]}),m&&n&&(0,G.jsx)(b9,{isOpen:I,onClose:()=>L(!1),spool:n,printerId:null,variant:`dialog`,spoolmanMode:s})]})}var x9=[{value:`ams_holder_74x33`,i18nKey:`amsHolderSmall`,fallbackLabel:`AMS holder — small (74 × 33 mm)`,fallbackHint:`Single label per page; matches the printable label from MakerWorld model 752566 (AMS Filament Label Holder).`},{value:`ams_holder_75x55`,i18nKey:`amsHolderLarge`,fallbackLabel:`AMS holder — large (75 × 55 mm)`,fallbackHint:`Single label per page; fits the cardstock-insert variant of the AMS Filament Label Holder. Roomy enough for swatch, brand, material, ID, and QR code.`},{value:`box_40x30`,i18nKey:`box40x30`,fallbackLabel:`Box label (40 × 30 mm)`,fallbackHint:`Single label per page; common DK/Brother roll size, good for filament-bag and storage-bin labels.`},{value:`box_62x29`,i18nKey:`box`,fallbackLabel:`Box label (62 × 29 mm)`,fallbackHint:`Single label per page; sized for Brother PT/QL and Dymo small labels.`},{value:`avery_l7160`,i18nKey:`averyL7160`,fallbackLabel:`Avery L7160 — A4 sheet (38.1 × 63.5 mm × 21)`,fallbackHint:`EU sheet stock; 21 labels per A4 page.`},{value:`avery_5160`,i18nKey:`avery5160`,fallbackLabel:`Avery 5160 — US Letter sheet (25.4 × 66.7 mm × 30)`,fallbackHint:`US sheet stock; 30 labels per Letter page.`}],s2e={avery_l7160:21,avery_5160:30},c2e=[203,300,600],l2e={brand:{i18nKey:`brand`,fallback:`Brand`},material:{i18nKey:`material`,fallback:`Material and subtype`},hex:{i18nKey:`hex`,fallback:`Colour code`},name:{i18nKey:`name`,fallback:`Colour or filament name`},location:{i18nKey:`location`,fallback:`Storage location`},material_number:{i18nKey:`materialNumber`,fallback:`Material number`},temps:{i18nKey:`temps`,fallback:`Nozzle temperature`},weight:{i18nKey:`weight`,fallback:`Net weight`},note:{i18nKey:`note`,fallback:`Note`},added:{i18nKey:`added`,fallback:`Date added`},qr:{i18nKey:`qr`,fallback:`QR code`},spool_id:{i18nKey:`spoolId`,fallback:`Spool ID`}},u2e=`bambuddy-label-print-options`,S9={template:x9[0].value,fields:{},monochrome:!1,format:`pdf`,dpi:300};function d2e(){let e;try{e=JSON.parse(localStorage.getItem(u2e)??`null`)}catch{return S9}if(!e||typeof e!=`object`)return S9;let t=e,n=x9.map(e=>e.value),r={};if(t.fields&&typeof t.fields==`object`)for(let[e,i]of Object.entries(t.fields))!n.includes(e)||!Array.isArray(i)||(r[e]=i.filter(e=>bd.includes(e)));return{template:n.includes(t.template)?t.template:S9.template,fields:r,monochrome:t.monochrome===!0,format:t.format===`png`?`png`:`pdf`,dpi:c2e.includes(t.dpi)?t.dpi:S9.dpi}}function f2e(e){try{localStorage.setItem(u2e,JSON.stringify(e))}catch{}}function p2e(e,t){return e.fields[t]??xd}function m2e(e){let t=window.URL.createObjectURL(e);if(!window.open(t,`_blank`)){let e=document.createElement(`a`);e.href=t,e.download=`bambuddy-labels.pdf`,document.body.appendChild(e),e.click(),document.body.removeChild(e)}setTimeout(()=>window.URL.revokeObjectURL(t),6e4)}function h2e(e,t){let n=window.URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=`bambuddy-labels-${t}.${e.type===`application/zip`?`zip`:`png`}`,document.body.appendChild(r),r.click(),document.body.removeChild(r),setTimeout(()=>window.URL.revokeObjectURL(n),6e4)}function g2e(e){return jf(e)}function _2e(e){return Of(e.color_name,e.rgba,e.color_name_is_synthesized)}function v2e(e){return`${_2e(e)??`${e.material}${e.subtype?` ${e.subtype}`:``}`}${e.brand?` · ${e.brand}`:``}`}function y2e(e){return[_2e(e),e.color_name,e.material,e.subtype,e.brand,`#${e.id}`].filter(Boolean).join(` `).toLowerCase()}function b2e(e){if(!e)return[1,0];let t=e.replace(/^#/,``).slice(0,6);if(t.length!==6)return[1,0];let n=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16);if([n,r,i].some(Number.isNaN))return[1,0];let a=n/255,o=r/255,s=i/255,c=Math.max(a,o,s),l=Math.min(a,o,s),u=(c+l)/2,d=c-l;if((d===0?0:d/(1-Math.abs(2*u-1)))<.1)return[1,u];let f=0;return f=c===a?(o-s)/d%6:c===o?(s-a)/d+2:(a-o)/d+4,f*=60,f<0&&(f+=360),[0,f]}function x2e({isOpen:e,onClose:t,availableSpools:n,initialSelectedIds:r,spoolmanMode:i}){let{t:a}=U(),o=Pf(),{showToast:s}=qd(),[c,l]=(0,f.useState)(!1),[u,d]=(0,f.useState)(new Set),[p,m]=(0,f.useState)(``),[h,g]=(0,f.useState)(``),[_,v]=(0,f.useState)(`id`),[y,b]=(0,f.useState)(S9),[x,S]=(0,f.useState)(`1`),[C,w]=(0,f.useState)(null),[T,E]=(0,f.useState)(!1),[D,O]=(0,f.useState)(null),k=(0,f.useRef)(null);(0,f.useEffect)(()=>{if(e){let e=new Set(n.map(e=>e.id));d(new Set(r.filter(t=>e.has(t)))),m(``),g(``),v(`id`),b(d2e()),S(`1`),l(!1)}},[e]);let A=(0,f.useMemo)(()=>{let e=[...n];return _===`color`?(e.sort((e,t)=>{let n=b2e(e.rgba),r=b2e(t.rgba);return n[0]===r[0]?n[1]===r[1]?e.id-t.id:n[1]-r[1]:n[0]-r[0]}),e):(e.sort((e,t)=>e.id-t.id),e)},[n,_]),j=(0,f.useMemo)(()=>{let e=new Set;for(let t of A)t.material&&e.add(t.material.toUpperCase());return[...e].sort()},[A]),M=(0,f.useMemo)(()=>{let e=p.trim().toLowerCase();return A.filter(t=>!(h&&(t.material||``).toUpperCase()!==h||e&&!y2e(t).includes(e)))},[A,p,h,o]),N=M.length>0&&M.every(e=>u.has(e.id)),P=y.template,F=p2e(y,P),I=F.join(`,`),L=A.find(e=>u.has(e.id))?.id??null;function R(e){k.current&&window.URL.revokeObjectURL(k.current),k.current=e,w(e)}if((0,f.useEffect)(()=>{if(!e||L===null){R(null),O(null),E(!1);return}let t=new AbortController;E(!0);let n=window.setTimeout(async()=>{let e={spool_id:L,template:P,monochrome:y.monochrome,fields:I?I.split(`,`):[]};try{let n=i?await Z.previewSpoolmanSpoolLabel(e,t.signal):await Z.previewSpoolLabel(e,t.signal);if(t.signal.aborted)return;R(window.URL.createObjectURL(n)),O(null)}catch(e){if(t.signal.aborted)return;R(null),O(e instanceof Error?e.message:String(e))}finally{t.signal.aborted||E(!1)}},250);return()=>{window.clearTimeout(n),t.abort()}},[e,L,P,I,y.monochrome,i]),(0,f.useEffect)(()=>()=>{k.current&&window.URL.revokeObjectURL(k.current)},[]),!e)return null;let z=u.size,B=z===0,V=s2e[P],ee=Number(x),te=V===void 0||Number.isInteger(ee)&&ee>=1&&ee<=V,ne=x9.find(e=>e.value===P)??x9[0];function re(e){b(t=>{let n={...t,...e};return f2e(n),n})}function ie(e){let t=bd.filter(t=>e.includes(t));re({fields:{...y.fields,[P]:t}})}function ae(e){ie(F.includes(e)?F.filter(t=>t!==e):[...F,e])}function oe(e){d(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function se(){d(e=>{let t=new Set(e);for(let e of M)t.add(e.id);return t})}function H(){d(e=>{let t=new Set(e);for(let e of M)t.delete(e.id);return t})}function ce(){d(new Set)}async function le(){if(B||c||!te)return;let e={spool_ids:A.filter(e=>u.has(e.id)).map(e=>e.id),template:P,monochrome:y.monochrome,starting_position:V===void 0?1:ee,fields:F,format:y.format,dpi:y.dpi};l(!0);try{let n=i?await Z.printSpoolmanSpoolLabels(e):await Z.printSpoolLabels(e);y.format===`pdf`?m2e(n):h2e(n,P),t()}catch(e){s(a(`inventory.labels.error`,`Could not generate labels: {{msg}}`,{msg:e instanceof Error?e.message:String(e)}),`error`)}finally{l(!1)}}let ue=e=>`px-2 py-0.5 text-xs rounded-full border transition ${e?`bg-bambu-green text-bambu-dark border-bambu-green`:`bg-bambu-dark text-bambu-gray border-bambu-dark-tertiary hover:border-bambu-gray`}`;return(0,G.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-start sm:items-center justify-center p-4 overflow-y-auto`,children:[(0,G.jsx)(`div`,{className:`absolute inset-0 bg-black/60 backdrop-blur-sm`,onClick:t}),(0,G.jsxs)(`div`,{"data-testid":`label-template-picker-panel`,className:`relative w-full max-w-5xl bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-xl shadow-2xl max-h-[90vh] overflow-clip flex flex-col my-auto`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Ml,{className:`w-5 h-5 text-bambu-green`}),(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:a(`inventory.labels.title`,`Print spool labels`)}),z>0&&(0,G.jsxs)(`span`,{className:`text-sm text-bambu-gray`,children:[`(`,a(`inventory.labels.selectedCount`,`{{count}} selected`,{count:z}),`)`]})]}),(0,G.jsx)(`button`,{onClick:t,className:`p-1 text-bambu-gray hover:text-white rounded transition-colors`,"aria-label":a(`common.close`,`Close`),children:(0,G.jsx)($u,{className:`w-5 h-5`})})]}),(0,G.jsxs)(`div`,{className:`flex-1 min-h-0 overflow-y-auto md:overflow-hidden grid grid-cols-1 md:grid-cols-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col min-h-0 md:border-r border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{className:`p-4 space-y-2 border-b border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(Kl,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none`}),(0,G.jsx)(`input`,{type:`search`,value:p,onChange:e=>m(e.target.value),placeholder:a(`inventory.labels.searchPlaceholder`,`Search name, brand, or #ID`),className:`w-full pl-9 pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray focus:outline-none focus:border-bambu-green`})]}),j.length>1&&(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray mr-1`,children:a(`inventory.labels.filterByMaterial`,`Material:`)}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>g(``),className:`px-2 py-0.5 text-xs rounded-full border transition ${h===``?`bg-bambu-green text-bambu-dark border-bambu-green`:`bg-bambu-dark text-bambu-gray border-bambu-dark-tertiary hover:border-bambu-gray`}`,children:a(`inventory.labels.allMaterials`,`All`)}),j.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>g(e),className:`px-2 py-0.5 text-xs rounded-full border transition ${h===e?`bg-bambu-green text-bambu-dark border-bambu-green`:`bg-bambu-dark text-bambu-gray border-bambu-dark-tertiary hover:border-bambu-gray`}`,children:e},e))]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray mr-1`,children:a(`inventory.labels.sortBy.label`)}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>v(`id`),className:`px-2 py-0.5 text-xs rounded-full border transition ${_===`id`?`bg-bambu-green text-bambu-dark border-bambu-green`:`bg-bambu-dark text-bambu-gray border-bambu-dark-tertiary hover:border-bambu-gray`}`,children:a(`inventory.labels.sortBy.id`)}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>v(`color`),className:`px-2 py-0.5 text-xs rounded-full border transition ${_===`color`?`bg-bambu-green text-bambu-dark border-bambu-green`:`bg-bambu-dark text-bambu-gray border-bambu-dark-tertiary hover:border-bambu-gray`}`,children:a(`inventory.labels.sortBy.color`)})]})]}),(0,G.jsxs)(`div`,{className:`px-4 pt-3 pb-2 flex items-center justify-between gap-3 flex-wrap`,children:[(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:a(`inventory.labels.pickSpools`,`Pick which spools to print labels for:`)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 text-xs`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:N?H:se,disabled:M.length===0,className:`text-bambu-green hover:underline disabled:opacity-50 disabled:no-underline disabled:cursor-not-allowed`,children:N?a(`inventory.labels.deselectVisible`,`Deselect visible`):a(`inventory.labels.selectVisible`,`Select all visible ({{count}})`,{count:M.length})}),(0,G.jsx)(`button`,{type:`button`,onClick:ce,disabled:z===0,className:`text-bambu-gray hover:text-white hover:underline disabled:opacity-50 disabled:no-underline disabled:cursor-not-allowed`,children:a(`inventory.labels.clearAll`,`Clear all`)})]})]}),(0,G.jsx)(`div`,{className:`flex-1 overflow-y-auto px-2 pb-2 min-h-0 max-h-72 md:max-h-none`,children:M.length===0?(0,G.jsx)(`div`,{className:`text-center text-sm text-bambu-gray py-6`,children:A.length===0?a(`inventory.labels.noSpoolsToShow`,`No spools to show. Adjust your filter and try again.`):a(`inventory.labels.noMatches`,`No spools match the current search or filter.`)}):(0,G.jsx)(`ul`,{className:`space-y-0.5`,children:M.map(e=>{let t=u.has(e.id);return(0,G.jsx)(`li`,{children:(0,G.jsxs)(`label`,{className:`flex items-center gap-3 px-2 py-1.5 rounded hover:bg-bambu-dark-tertiary/50 cursor-pointer`,children:[t?(0,G.jsx)(fu,{className:`w-4 h-4 text-bambu-green shrink-0`}):(0,G.jsx)(mu,{className:`w-4 h-4 text-bambu-gray shrink-0`}),(0,G.jsx)(`input`,{type:`checkbox`,checked:t,onChange:()=>oe(e.id),className:`sr-only`}),(0,G.jsx)(`span`,{className:`w-4 h-4 rounded border border-black/20 shrink-0`,style:g2e(e.rgba)}),(0,G.jsx)(`span`,{className:`flex-1 min-w-0 truncate text-sm text-white`,children:v2e(e)}),(0,G.jsxs)(`span`,{className:`text-xs font-mono text-bambu-gray shrink-0`,children:[`#`,e.id]})]})},e.id)})})})]}),(0,G.jsxs)(`div`,{className:`md:overflow-y-auto p-4 space-y-4 border-t md:border-t-0 border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{htmlFor:`label-template`,className:`text-sm font-medium text-white`,children:a(`inventory.labels.template`,`Label size`)}),(0,G.jsx)(`select`,{id:`label-template`,"data-testid":`label-template-select`,value:P,onChange:e=>re({template:e.target.value}),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green`,children:x9.map(e=>(0,G.jsx)(`option`,{value:e.value,children:a(`inventory.labels.templates.${e.i18nKey}.label`,e.fallbackLabel)},e.value))}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:a(`inventory.labels.templates.${ne.i18nKey}.hint`,ne.fallbackHint)})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-white`,children:L===null?a(`inventory.labels.preview`,`Preview`):a(`inventory.labels.previewOf`,`Preview of #{{id}}`,{id:L})}),(0,G.jsxs)(`div`,{"data-testid":`label-preview`,className:`relative flex items-center justify-center min-h-40 p-3 rounded-lg bg-bambu-dark border border-bambu-dark-tertiary`,children:[L===null?(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray text-center`,children:a(`inventory.labels.previewNoSelection`,`Select a spool to see its label.`)}):D?(0,G.jsx)(`span`,{className:`text-sm text-red-400 text-center`,children:a(`inventory.labels.previewError`,`Could not render the preview: {{msg}}`,{msg:D})}):C?(0,G.jsx)(`img`,{src:C,alt:a(`inventory.labels.previewAlt`,`Label preview`),className:`max-h-56 max-w-full object-contain bg-white shadow`}):null,T&&(0,G.jsx)(Y,{className:`absolute top-2 right-2 w-4 h-4 animate-spin text-bambu-green`})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:a(`inventory.labels.previewHint`,`Lines that don't fit on this label size are left out.`)})]}),(0,G.jsxs)(`fieldset`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsx)(`legend`,{className:`text-sm font-medium text-white`,children:a(`inventory.labels.content`,`Print on the label`)}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>ie(xd),className:`text-xs text-bambu-green hover:underline`,children:a(`inventory.labels.resetFields`,`Reset to default`)})]}),(0,G.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-x-3 gap-y-1`,children:bd.map(e=>{let t=F.includes(e),{i18nKey:n,fallback:r}=l2e[e];return(0,G.jsxs)(`label`,{className:`flex items-center gap-2 py-0.5 cursor-pointer select-none`,children:[t?(0,G.jsx)(fu,{className:`w-4 h-4 text-bambu-green shrink-0`}):(0,G.jsx)(mu,{className:`w-4 h-4 text-bambu-gray shrink-0`}),(0,G.jsx)(`input`,{type:`checkbox`,"data-testid":`label-field-${e}`,checked:t,onChange:()=>ae(e),className:`sr-only`}),(0,G.jsx)(`span`,{className:`text-sm text-white`,children:a(`inventory.labels.fields.${n}`,r)})]},e)})})]}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`label`,{className:`inline-flex items-center gap-2 cursor-pointer select-none`,children:[y.monochrome?(0,G.jsx)(fu,{className:`w-4 h-4 text-bambu-green shrink-0`}):(0,G.jsx)(mu,{className:`w-4 h-4 text-bambu-gray shrink-0`}),(0,G.jsx)(`input`,{type:`checkbox`,checked:y.monochrome,onChange:e=>re({monochrome:e.target.checked}),className:`sr-only`}),(0,G.jsx)(`span`,{className:`text-sm text-white`,children:a(`inventory.labels.monochrome`,`Monochrome (black & white printer)`)}),(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:a(`inventory.labels.monochromeHint`,`Drops the colour swatch and widens the text`)})]}),V!==void 0&&(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`label`,{htmlFor:`label-starting-position`,className:`text-sm text-white whitespace-nowrap pt-1.5`,children:a(`inventory.labels.startingPosition`,`Starting label position`)}),(0,G.jsx)(`input`,{id:`label-starting-position`,"data-testid":`label-starting-position`,type:`number`,min:1,max:V,step:1,value:x,onChange:e=>S(e.target.value),"aria-describedby":`label-starting-position-help`,className:`w-20 px-2 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm focus:outline-none focus:border-bambu-green`}),(0,G.jsx)(`div`,{id:`label-starting-position-help`,"data-testid":`label-starting-position-status`,className:`text-xs pt-1.5 ${te?`text-bambu-gray`:`text-red-400`}`,children:te?ee===1?a(`inventory.labels.startingPositionFirst`,`Printing starts at position 1.`):a(`inventory.labels.startingPositionSkipped`,`Positions 1 through {{lastPosition}} will be left blank on the first sheet.`,{lastPosition:ee-1}):a(`inventory.labels.startingPositionInvalid`,`Enter a whole number from 1 to {{capacity}}.`,{capacity:V})})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`text-sm text-white mr-1`,children:a(`inventory.labels.format`,`Output:`)}),(0,G.jsx)(`button`,{type:`button`,"data-testid":`label-format-pdf`,"aria-pressed":y.format===`pdf`,onClick:()=>re({format:`pdf`}),className:ue(y.format===`pdf`),children:`PDF`}),(0,G.jsx)(`button`,{type:`button`,"data-testid":`label-format-png`,"aria-pressed":y.format===`png`,onClick:()=>re({format:`png`}),className:ue(y.format===`png`),children:`PNG`}),y.format===`png`&&(0,G.jsx)(`select`,{"data-testid":`label-dpi-select`,"aria-label":a(`inventory.labels.dpi`,`Resolution`),value:y.dpi,onChange:e=>re({dpi:Number(e.target.value)}),className:`ml-2 px-2 py-0.5 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-xs focus:outline-none focus:border-bambu-green`,children:c2e.map(e=>(0,G.jsxs)(`option`,{value:e,children:[e,` dpi`]},e))})]}),y.format===`png`&&(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:a(`inventory.labels.pngHint`,`For label printer software that takes images. Match your printer's resolution; several labels come as a ZIP.`)})]})]})]}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-2 px-5 py-3 border-t border-bambu-dark-tertiary`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:t,disabled:c,children:a(`common.cancel`,`Cancel`)}),(0,G.jsxs)(Q,{"data-testid":`label-print-button`,onClick:le,disabled:B||c||!te,children:[c?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):y.format===`pdf`?(0,G.jsx)(Ml,{className:`w-4 h-4`}):(0,G.jsx)(Us,{className:`w-4 h-4`}),y.format===`pdf`?a(`inventory.labels.createPdf`,`Create PDF`):a(`inventory.labels.downloadPng`,`Download PNG`)]})]})]})]})}function S2e({onClose:e,onImported:t}){let{t:n}=U(),[r,i]=(0,f.useState)(null),[a,o]=(0,f.useState)(!1),[s,c]=(0,f.useState)(null),[l,u]=(0,f.useState)(!1),[d,p]=(0,f.useState)(!1),[m,h]=(0,f.useState)(null),g=(0,f.useRef)(null),_=async e=>{i(e),c(null),h(null),u(!0);try{c(await Z.importSpoolsCsvPreview(e))}catch(e){h(e instanceof Error?e.message:n(`inventory.csv.previewError`,`Could not read the CSV file`))}finally{u(!1)}},v=e=>{let t=e.target.files?.[0];t&&_(t)},y=e=>{e.preventDefault(),o(!1);let t=e.dataTransfer.files?.[0];t&&_(t)},b=async()=>{if(r){p(!0),h(null);try{t((await Z.importSpoolsCsv(r)).created)}catch(e){h(e instanceof Error?e.message:n(`inventory.csv.importError`,`Import failed`)),p(!1)}}},x=e=>e===`valid`?(0,G.jsx)(ms,{className:`w-4 h-4 text-green-500 flex-shrink-0`}):e===`error`?(0,G.jsx)(bs,{className:`w-4 h-4 text-red-500 flex-shrink-0`}):(0,G.jsx)(_s,{className:`w-4 h-4 text-bambu-gray flex-shrink-0`}),S=s?.valid_count??0;return(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,children:(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg w-full max-w-3xl border border-bambu-dark-tertiary flex flex-col max-h-[90vh]`,children:[(0,G.jsxs)(`div`,{className:`p-4 border-b border-bambu-dark-tertiary flex items-center justify-between`,children:[(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:n(`inventory.csv.modalTitle`,`Import spools from CSV`)}),(0,G.jsx)(`button`,{onClick:e,className:`p-1 hover:bg-bambu-dark rounded`,children:(0,G.jsx)($u,{className:`w-5 h-5 text-bambu-gray`})})]}),(0,G.jsxs)(`div`,{className:`p-4 space-y-4 overflow-y-auto flex-1`,children:[(0,G.jsxs)(`div`,{onDragOver:e=>{e.preventDefault(),o(!0)},onDragLeave:e=>{e.preventDefault(),o(!1)},onDrop:y,onClick:()=>g.current?.click(),className:`border-2 border-dashed rounded-lg p-6 text-center cursor-pointer transition-colors ${a?`border-bambu-green bg-bambu-green/10`:`border-bambu-dark-tertiary hover:border-bambu-green/50`}`,children:[(0,G.jsx)(Ru,{className:`w-9 h-9 mx-auto mb-2 ${a?`text-bambu-green`:`text-bambu-gray`}`}),r?(0,G.jsxs)(`p`,{className:`text-white font-medium flex items-center justify-center gap-2`,children:[(0,G.jsx)(ac,{className:`w-4 h-4`}),` `,r.name]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`text-white font-medium`,children:n(`inventory.csv.selectFile`,`Choose a CSV file or drag it here`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray/70 mt-1`,children:n(`inventory.csv.dragHint`,`Header: material (required), brand, subtype, color_name, rgba, …`)})]})]}),(0,G.jsx)(`input`,{ref:g,type:`file`,accept:`.csv,text/csv`,className:`hidden`,onChange:v}),l&&(0,G.jsxs)(`div`,{className:`flex items-center justify-center gap-2 text-bambu-gray py-4`,children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),n(`inventory.csv.parsing`,`Reading file…`)]}),m&&(0,G.jsxs)(`div`,{className:`p-3 bg-red-50 dark:bg-red-500/10 border border-red-300 dark:border-red-500/30 rounded-lg flex items-start gap-3`,children:[(0,G.jsx)(bs,{className:`w-5 h-5 text-red-600 dark:text-red-400 mt-0.5 flex-shrink-0`}),(0,G.jsx)(`p`,{className:`text-sm text-red-700 dark:text-red-300 break-words`,children:m})]}),s&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-3 text-sm`,children:[(0,G.jsx)(`span`,{className:`px-2 py-1 rounded bg-green-50 dark:bg-green-500/10 text-green-700 dark:text-green-400`,children:n(`inventory.csv.validCount`,`{{count}} valid`,{count:s.valid_count})}),(0,G.jsx)(`span`,{className:`px-2 py-1 rounded bg-red-50 dark:bg-red-500/10 text-red-700 dark:text-red-400`,children:n(`inventory.csv.errorCount`,`{{count}} error`,{count:s.error_count})}),(0,G.jsx)(`span`,{className:`px-2 py-1 rounded bg-bambu-dark text-bambu-gray`,children:n(`inventory.csv.skippedCount`,`{{count}} skipped`,{count:s.skipped_count})})]}),s.warnings.length>0&&(0,G.jsx)(`div`,{className:`p-3 bg-yellow-50 dark:bg-yellow-500/10 border border-yellow-300 dark:border-yellow-500/30 rounded-lg space-y-1`,children:s.warnings.map((e,t)=>(0,G.jsx)(`p`,{className:`text-xs text-yellow-700 dark:text-yellow-300`,children:e},t))}),s.rows.length>0&&(0,G.jsx)(`div`,{className:`border border-bambu-dark-tertiary rounded-lg overflow-hidden`,children:(0,G.jsx)(`div`,{className:`max-h-72 overflow-y-auto`,children:(0,G.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,G.jsx)(`thead`,{className:`bg-bambu-dark sticky top-0`,children:(0,G.jsxs)(`tr`,{className:`text-left text-bambu-gray`,children:[(0,G.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:n(`inventory.csv.colRow`,`Row`)}),(0,G.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:n(`inventory.csv.colStatus`,`Status`)}),(0,G.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:n(`inventory.material`,`Material`)}),(0,G.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:n(`inventory.brand`,`Brand`)}),(0,G.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:n(`inventory.csv.colColor`,`Color`)})]})}),(0,G.jsx)(`tbody`,{children:s.rows.map(e=>(0,G.jsxs)(`tr`,{className:`border-t border-bambu-dark-tertiary`,children:[(0,G.jsx)(`td`,{className:`px-3 py-2 text-bambu-gray`,children:e.row_number}),(0,G.jsx)(`td`,{className:`px-3 py-2`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[x(e.status),e.status===`error`&&e.reason&&(0,G.jsx)(`span`,{className:`text-xs text-red-700 dark:text-red-400 break-words`,children:e.reason})]})}),(0,G.jsx)(`td`,{className:`px-3 py-2 text-white`,children:e.material||`—`}),(0,G.jsx)(`td`,{className:`px-3 py-2 text-white`,children:e.brand||`—`}),(0,G.jsx)(`td`,{className:`px-3 py-2`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.rgba&&(0,G.jsx)(`span`,{className:`inline-block w-4 h-4 rounded-full border border-bambu-dark-tertiary flex-shrink-0`,style:jf(e.rgba)}),(0,G.jsx)(`span`,{className:`text-white`,children:e.color_name||`—`}),e.resolved_color&&!e.cross_material_color&&(0,G.jsx)(`span`,{title:n(`inventory.csv.colorResolved`,`Color filled from catalog`),children:(0,G.jsx)(Ku,{className:`w-3.5 h-3.5 text-bambu-green flex-shrink-0`})}),e.cross_material_color&&(0,G.jsx)(`span`,{title:n(`inventory.csv.colorCrossMaterial`,`Color taken from a different material — no exact match in catalog`),children:(0,G.jsx)(Pu,{className:`w-3.5 h-3.5 text-yellow-500 flex-shrink-0`})}),e.duplicate_of_existing&&(0,G.jsx)(`span`,{title:n(`inventory.csv.duplicateExisting`,`A spool with this material, brand and color already exists — it will still be imported as a new spool`),children:(0,G.jsx)(Ps,{className:`w-3.5 h-3.5 text-amber-600 dark:text-amber-400 flex-shrink-0`})})]})})]},e.row_number))})]})})})]})]}),(0,G.jsxs)(`div`,{className:`p-4 border-t border-bambu-dark-tertiary flex justify-end gap-2`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:e,disabled:d,children:n(`common.cancel`)}),(0,G.jsx)(Q,{onClick:b,disabled:!s||S===0||d,children:d?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{className:`w-4 h-4 mr-2 animate-spin`}),n(`inventory.csv.importing`,`Importing…`)]}):S>0?n(`inventory.csv.importValidRows`,`Import {{count}} valid rows`,{count:S}):n(`inventory.csv.noValidRows`,`No valid rows`)})]})]})})}function C2e({open:e,onClose:t}){let{t:n}=U(),{showToast:r}=qd(),i=no(),{data:a=[],isLoading:o,isError:s}=K({queryKey:h6,queryFn:Z.getSuppliers,enabled:e}),[c,l]=(0,f.useState)(``),[u,d]=(0,f.useState)(!1),[p,m]=(0,f.useState)(null),[h,g]=(0,f.useState)(``),[_,v]=(0,f.useState)(``),[y,b]=(0,f.useState)(``),[x,S]=(0,f.useState)(``),[C,w]=(0,f.useState)(!1),[T,E]=(0,f.useState)(null);if((0,f.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t]),!e)return null;let D=a.filter(e=>e.name.toLowerCase().includes(c.toLowerCase())),O=()=>{g(``),v(``),b(``),S(``)},k=()=>({name:h.trim(),website:_.trim()||null,customer_number:y.trim()||null,note:x.trim()||null}),A=async()=>{if(!h.trim()){r(n(`inventory.suppliers.nameRequired`),`error`);return}w(!0);try{await Z.createSupplier(k()),await g6(i),d(!1),O(),r(n(`inventory.suppliers.added`),`success`)}catch(e){console.error(`SuppliersModal.handleAdd failed:`,e),r(n(e instanceof id&&e.status===409?`inventory.suppliers.duplicateName`:`inventory.suppliers.addFailed`),`error`)}finally{w(!1)}},j=e=>{m(e.id),g(e.name),v(e.website??``),b(e.customer_number??``),S(e.note??``)},M=()=>{m(null),O()},N=async e=>{if(!h.trim()){r(n(`inventory.suppliers.nameRequired`),`error`);return}w(!0);try{await Z.updateSupplier(e,k()),await g6(i),M(),r(n(`inventory.suppliers.updated`),`success`)}catch(e){console.error(`SuppliersModal.handleUpdate failed:`,e),r(n(e instanceof id&&e.status===409?`inventory.suppliers.duplicateName`:`inventory.suppliers.updateFailed`),`error`)}finally{w(!1)}},P=async()=>{if(T)try{await Z.deleteSupplier(T.id),await g6(i),r(n(`inventory.suppliers.deleted`),`success`)}catch(e){console.error(`SuppliersModal.handleDelete failed:`,e),e instanceof id&&e.status===409?r(n(`inventory.suppliers.deleteBlocked`,{count:T.spool_count}),`error`):r(n(`inventory.suppliers.deleteFailed`),`error`)}finally{E(null)}},F=(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`input`,{type:`text`,className:`w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`,placeholder:n(`inventory.suppliers.namePlaceholder`),value:h,maxLength:200,onChange:e=>g(e.target.value)}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(`input`,{type:`text`,className:`flex-1 min-w-0 px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`,placeholder:n(`inventory.suppliers.websitePlaceholder`),value:_,maxLength:500,onChange:e=>v(e.target.value)}),(0,G.jsx)(`input`,{type:`text`,className:`w-40 px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`,placeholder:n(`inventory.suppliers.customerNumberPlaceholder`),value:y,maxLength:100,onChange:e=>b(e.target.value)})]}),(0,G.jsx)(`input`,{type:`text`,className:`w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`,placeholder:n(`inventory.suppliers.notePlaceholder`),value:x,maxLength:500,onChange:e=>S(e.target.value)})]});return(0,G.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[(0,G.jsx)(`div`,{className:`absolute inset-0 bg-black/60`,onClick:t}),(0,G.jsxs)(`div`,{className:`relative w-full max-w-3xl mx-4 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-xl shadow-2xl max-h-[90vh] flex flex-col`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`suppliers-modal-title`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-4 px-6 py-4 border-b border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(vu,{className:`w-5 h-5 text-bambu-gray`}),(0,G.jsx)(`h2`,{id:`suppliers-modal-title`,className:`text-lg font-semibold text-white`,children:n(`inventory.suppliers.title`)}),(0,G.jsxs)(`span`,{className:`text-sm text-bambu-gray`,children:[`(`,a.length,`)`]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`button`,{onClick:()=>{d(!0),m(null),O()},className:`px-3 py-1.5 text-sm bg-bambu-green text-white rounded-lg hover:bg-bambu-green/80 transition-colors flex items-center gap-1.5`,children:[(0,G.jsx)(kl,{className:`w-4 h-4`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:n(`common.add`)})]}),(0,G.jsx)(`button`,{onClick:t,className:`p-1.5 rounded hover:bg-bambu-dark text-bambu-gray hover:text-white transition-colors`,"aria-label":n(`common.close`),children:(0,G.jsx)($u,{className:`w-5 h-5`})})]})]}),(0,G.jsxs)(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-6 py-4 space-y-4`,children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:n(`inventory.suppliers.description`)}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(Kl,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray`}),(0,G.jsx)(`input`,{type:`text`,className:`w-full pl-10 pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`,placeholder:n(`inventory.suppliers.search`),value:c,onChange:e=>l(e.target.value)})]}),u&&(0,G.jsxs)(`div`,{className:`p-4 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary space-y-3`,children:[(0,G.jsx)(`h3`,{className:`text-sm font-medium text-white`,children:n(`inventory.suppliers.addNew`)}),F,(0,G.jsxs)(`div`,{className:`flex gap-2 justify-end`,children:[(0,G.jsx)(`button`,{onClick:()=>{d(!1),O()},className:`px-3 py-2 rounded-lg text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary`,children:n(`common.cancel`)}),(0,G.jsxs)(`button`,{onClick:A,disabled:C,className:`px-3 py-2 bg-bambu-green text-white rounded-lg hover:bg-bambu-green/80 flex items-center gap-1`,children:[C?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(is,{className:`w-4 h-4`}),n(`common.add`)]})]})]}),o?(0,G.jsxs)(`div`,{className:`flex items-center justify-center py-8 text-bambu-gray`,children:[(0,G.jsx)(Y,{className:`w-5 h-5 animate-spin mr-2`}),n(`common.loading`)]}):s?(0,G.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-8 text-sm text-red-400`,children:[(0,G.jsx)(Pu,{className:`w-4 h-4`}),n(`inventory.suppliers.loadFailed`)]}):(0,G.jsx)(`div`,{className:`border border-bambu-dark-tertiary rounded-lg`,children:(0,G.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,G.jsx)(`thead`,{className:`bg-bambu-dark sticky top-0`,children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{className:`px-4 py-2 text-left text-bambu-gray font-medium`,children:n(`common.name`)}),(0,G.jsx)(`th`,{className:`px-4 py-2 text-left text-bambu-gray font-medium hidden sm:table-cell`,children:n(`inventory.suppliers.customerNumber`)}),(0,G.jsx)(`th`,{className:`px-4 py-2 text-right text-bambu-gray font-medium w-20`,children:n(`inventory.suppliers.spools`)}),(0,G.jsx)(`th`,{className:`px-4 py-2 w-24`})]})}),(0,G.jsx)(`tbody`,{children:D.length===0?(0,G.jsx)(`tr`,{children:(0,G.jsx)(`td`,{colSpan:4,className:`px-4 py-8 text-center text-bambu-gray`,children:n(c?`inventory.suppliers.noMatch`:`inventory.suppliers.empty`)})}):D.map(e=>(0,G.jsx)(`tr`,{className:`border-t border-bambu-dark-tertiary hover:bg-bambu-dark align-top`,children:p===e.id?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`td`,{className:`px-4 py-2`,colSpan:3,children:F}),(0,G.jsx)(`td`,{className:`px-4 py-2`,children:(0,G.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,G.jsx)(`button`,{onClick:()=>N(e.id),disabled:C,className:`p-1.5 rounded hover:bg-green-500/20 text-green-500`,children:C?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(is,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{onClick:M,className:`p-1.5 rounded hover:bg-bambu-dark-tertiary text-bambu-gray`,children:(0,G.jsx)($u,{className:`w-4 h-4`})})]})})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`td`,{className:`px-4 py-2 text-white`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{children:e.name}),e.website&&(0,G.jsx)(`a`,{href:e.website,target:`_blank`,rel:`noopener noreferrer`,className:`text-bambu-gray hover:text-bambu-green`,title:e.website,children:(0,G.jsx)(Xs,{className:`w-3.5 h-3.5`})})]}),e.note&&(0,G.jsx)(`div`,{className:`text-xs text-bambu-gray mt-0.5`,children:e.note})]}),(0,G.jsx)(`td`,{className:`px-4 py-2 text-bambu-gray hidden sm:table-cell`,children:e.customer_number||`-`}),(0,G.jsx)(`td`,{className:`px-4 py-2 text-right font-mono text-bambu-gray`,children:e.spool_count}),(0,G.jsx)(`td`,{className:`px-4 py-2`,children:(0,G.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,G.jsx)(`button`,{onClick:()=>{j(e),d(!1)},className:`p-1.5 rounded hover:bg-bambu-dark-tertiary text-bambu-gray hover:text-white`,children:(0,G.jsx)(wl,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{onClick:()=>E(e),className:`p-1.5 rounded bg-red-500/10 hover:bg-red-500/20 text-red-500`,children:(0,G.jsx)(ju,{className:`w-4 h-4`})})]})})]})},e.id))})]})})]})]}),T&&(0,G.jsx)(af,{title:n(`inventory.suppliers.deleteTitle`),message:T.spool_count>0?n(`inventory.suppliers.deleteConfirmReferenced`,{name:T.name,count:T.spool_count}):n(`inventory.suppliers.deleteConfirm`,{name:T.name}),confirmText:n(`common.delete`),variant:`danger`,onConfirm:P,onCancel:()=>E(null)})]})}var w2e=[{id:`material`,type:`searchable`,labelKey:`inventory.material`},{id:`subtype`,type:`searchable`,labelKey:`inventory.subtype`},{id:`brand`,type:`searchable`,labelKey:`inventory.brand`},{id:`color_name`,type:`text`,labelKey:`inventory.colorName`},{id:`rgba`,type:`color`,labelKey:`inventory.color`,pattern:`^[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?$`},{id:`location_id`,type:`searchableClosed`,labelKey:`inventory.storageLocation`},{id:`slicer_filament_name`,type:`searchable`,labelKey:`inventory.slicerFilamentName`},{id:`slicer_filament`,type:`searchable`,labelKey:`inventory.slicerFilament`},{id:`cost_per_kg`,type:`number`,labelKey:`inventory.costPerKg`,min:0,step:.01},{id:`note`,type:`textarea`,labelKey:`inventory.note`},{id:`label_weight`,type:`number`,labelKey:`inventory.labelWeight`,min:1,step:1},{id:`core_weight`,type:`number`,labelKey:`inventory.coreWeight`,min:0,step:1},{id:`category`,type:`searchable`,labelKey:`inventory.category`,internalOnly:!0},{id:`low_stock_threshold_pct`,type:`number`,labelKey:`inventory.lowStockThresholdOverride`,min:1,max:99,step:1,internalOnly:!0},{id:`material_number`,type:`searchable`,labelKey:`inventory.materialNumber`,internalOnly:!0}];function T2e({value:e,onChange:t,options:n,allowCustom:r,placeholderKey:i,disabled:a}){let{t:o}=U(),s=(0,f.useRef)(null),[c,l]=(0,f.useState)(!1),[u,d]=(0,f.useState)(``);(0,f.useEffect)(()=>{if(!c)return;let e=e=>{s.current&&!s.current.contains(e.target)&&(l(!1),d(``))},t=e=>{e.key===`Escape`&&(l(!1),d(``))};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[c]);let p=c?u:n.find(t=>t.value===e)?.label??e,m=(0,f.useMemo)(()=>{if(!c)return n;let e=u.trim().toLowerCase();return e?n.filter(t=>t.label.toLowerCase().includes(e)||t.value.toLowerCase().includes(e)):n},[c,u,n]),h=c&&u.trim()&&!n.some(e=>e.value.toLowerCase()===u.trim().toLowerCase());return(0,G.jsxs)(`div`,{className:`relative`,ref:s,children:[(0,G.jsx)(`input`,{type:`text`,disabled:a,value:p,onChange:e=>{d(e.target.value),l(!0),r&&t(e.target.value)},onFocus:()=>{l(!0),d(``)},placeholder:i?o(i):void 0,className:`w-full px-3 py-2 pr-9 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray/50 focus:border-bambu-green focus:outline-none`}),(0,G.jsx)(as,{className:`absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray/50 pointer-events-none`}),c&&(0,G.jsxs)(`div`,{className:`absolute z-50 left-0 right-0 mt-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-lg max-h-64 overflow-y-auto`,children:[m.length===0&&!r&&(0,G.jsx)(`div`,{className:`px-3 py-2 text-sm text-bambu-gray`,children:o(`inventory.noResults`)}),m.map(n=>(0,G.jsx)(`button`,{type:`button`,className:`w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary ${e===n.value?`bg-bambu-green/10 text-bambu-green`:`text-white`}`,onClick:()=>{t(n.value),l(!1),d(``)},children:n.label},n.value)),r&&h&&(0,G.jsx)(`button`,{type:`button`,className:`w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary text-bambu-green border-t border-bambu-dark-tertiary`,onClick:()=>{t(u.trim()),l(!1),d(``)},children:o(`inventory.bulk.useCustom`,{value:u.trim()})})]})]})}function C9(...e){let t=new Set;for(let n of e)for(let e of n){let n=e?.trim();n&&t.add(n)}return Array.from(t).sort((e,t)=>e.localeCompare(t))}function E2e({isOpen:e,selectedCount:t,isPending:n,availableLocations:r,availableMaterials:i,availableSubtypes:a,availableBrands:o,availableCategories:s,availableMaterialNumbers:c,availableSlicerFilaments:l,availableSlicerFilamentNames:u,spoolmanMode:d=!1,onClose:p,onApply:m}){let{t:h}=U(),g=(0,f.useMemo)(()=>w2e.filter(e=>!(d&&e.internalOnly)),[d]),{data:_=[]}=K({queryKey:[`bulk-edit-cloud-presets`],enabled:e,staleTime:300*1e3,queryFn:async()=>{let e=[];try{if((await Z.getCloudStatus()).is_authenticated){let t=await Z.getFilamentPresets();e.push(...t)}}catch{}try{if((await Z.orcaCloudStatus()).connected){let t=await Z.orcaCloudListProfiles();e.push(...t.filament)}}catch{}return e}}),{data:v}=K({queryKey:[`bulk-edit-local-presets`],enabled:e,staleTime:300*1e3,queryFn:Z.getLocalPresets}),{data:y=[]}=K({queryKey:[`builtin-filaments`],enabled:e,staleTime:300*1e3,queryFn:Z.getBuiltinFilaments}),b=(0,f.useMemo)(()=>gU(_,new Set,v?.filament??[],y),[_,v,y]),[x,S]=(0,f.useState)({}),C=(0,f.useMemo)(()=>C9(oU,i).map(e=>({value:e,label:e})),[i]),w=(0,f.useMemo)(()=>C9(cU,a).map(e=>({value:e,label:e})),[a]),T=(0,f.useMemo)(()=>C9(sU,o).map(e=>({value:e,label:e})),[o]),E=(0,f.useMemo)(()=>C9(s).map(e=>({value:e,label:e})),[s]),D=(0,f.useMemo)(()=>C9(c).map(e=>({value:e,label:e})),[c]),O=(0,f.useMemo)(()=>{let e=b.map(e=>({value:e.code,label:e.displayName})),t=l.filter(t=>!e.some(e=>e.value===t)).map(e=>({value:e,label:e}));return[...e,...t].sort((e,t)=>e.label.localeCompare(t.label))},[b,l]),k=(0,f.useMemo)(()=>{let e=b.map(e=>({value:e.displayName,label:e.displayName})),t=u.filter(t=>!e.some(e=>e.value===t)).map(e=>({value:e,label:e}));return[...e,...t].sort((e,t)=>e.label.localeCompare(t.label))},[b,u]),A=(0,f.useMemo)(()=>r.map(e=>({value:String(e.id),label:e.name})),[r]);if(!e)return null;let j=(e,t)=>{S(n=>({...n,[e]:t}))},M=e=>{S(t=>{let n={...t};return delete n[e],n})},N=(()=>{let e={};for(let t of g){let n=x[t.id];if(n===void 0)continue;let r=typeof n==`string`?n.trim():n;if(!(r===``||r===null))if(t.type===`number`){let n=Number(r);Number.isFinite(n)&&(e[t.id]=n)}else if(t.id===`location_id`){let n=Number(r);Number.isFinite(n)&&n>0&&(e[t.id]=n)}else if(t.id===`rgba`){let n=String(r).replace(/^#/,``),i=n.length===6?`${n}FF`:n;/^[0-9A-Fa-f]{8}$/.test(i)&&(e[t.id]=i.toUpperCase())}else e[t.id]=String(r)}return e})(),P=Object.keys(N).length>0,F=g.some(e=>{let t=x[e.id];return t===void 0||t.trim()===``?!1:N[e.id]===void 0}),I=e=>e===`material`?C:e===`subtype`?w:e===`brand`?T:e===`category`?E:e===`material_number`?D:e===`slicer_filament`?O:e===`slicer_filament_name`?k:e===`location_id`?A:[],L=e=>{let t=x[e.id]??``;if(e.type===`searchable`||e.type===`searchableClosed`)return(0,G.jsx)(T2e,{value:t,onChange:t=>{t===``?M(e.id):j(e.id,t)},options:I(e.id),allowCustom:e.type===`searchable`,disabled:n});if(e.type===`textarea`)return(0,G.jsx)(`textarea`,{disabled:n,value:t,onChange:t=>j(e.id,t.target.value),className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray/50 focus:border-bambu-green focus:outline-none resize-none min-h-[60px]`});if(e.type===`color`){let r=t.trim().replace(/^#/,``),i=r.length===6?`${r}FF`:r,a=t.trim()!==``&&!/^[0-9A-Fa-f]{8}$/.test(i);return(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{type:`color`,disabled:n,value:`#${(t||`808080`).replace(/^#/,``).slice(0,6)}`,onChange:t=>j(e.id,t.target.value.replace(/^#/,``).toUpperCase()),className:`h-9 w-12 rounded cursor-pointer`}),(0,G.jsx)(`input`,{type:`text`,disabled:n,value:t,onChange:t=>j(e.id,t.target.value.replace(/^#/,``).toUpperCase()),placeholder:`RRGGBB or RRGGBBAA`,className:`flex-1 px-3 py-2 bg-bambu-dark border rounded-lg text-white placeholder-bambu-gray/50 focus:outline-none ${a?`border-red-500 focus:border-red-500`:`border-bambu-dark-tertiary focus:border-bambu-green`}`,pattern:e.pattern})]}),a&&(0,G.jsx)(`p`,{className:`mt-1 text-xs text-red-600 dark:text-red-400`,children:h(`inventory.bulk.invalidHex`)})]})}return(0,G.jsx)(`input`,{type:e.type===`number`?`number`:`text`,disabled:n,value:t,onChange:t=>j(e.id,t.target.value),min:e.min,max:e.max,step:e.step,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray/50 focus:border-bambu-green focus:outline-none`})};return(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center p-4 z-50`,onClick:n?void 0:p,children:(0,G.jsxs)(`div`,{className:`w-full max-w-3xl bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg max-h-[90vh] flex flex-col`,onClick:e=>e.stopPropagation(),children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between p-5 border-b border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:h(`inventory.bulk.editTitle`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mt-0.5`,children:h(`inventory.bulk.editSubtitle`,{count:t})})]}),(0,G.jsx)(`button`,{onClick:p,disabled:n,className:`p-1 text-bambu-gray hover:text-white transition-colors`,"aria-label":h(`common.close`),children:(0,G.jsx)($u,{className:`w-5 h-5`})})]}),(0,G.jsx)(`p`,{className:`px-5 pt-4 text-xs text-bambu-gray`,children:h(`inventory.bulk.editHint`)}),(0,G.jsx)(`div`,{className:`flex-1 overflow-y-auto p-5 space-y-3`,children:g.map(e=>{let t=x[e.id]!==void 0;return(0,G.jsxs)(`div`,{className:`flex items-start gap-3 rounded-md p-2 transition-colors ${t?`bg-bambu-green/5 border border-bambu-green/30`:`border border-transparent`}`,children:[(0,G.jsx)(`div`,{className:`pt-2`,children:(0,G.jsx)(`input`,{type:`checkbox`,className:`h-4 w-4 cursor-pointer`,checked:t,onChange:t=>{t.target.checked?j(e.id,``):M(e.id)},"aria-label":h(`inventory.bulk.toggleField`)})}),(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:h(e.labelKey)}),L(e)]})]},e.id)})}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 p-5 border-t border-bambu-dark-tertiary`,children:[(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:h(`inventory.bulk.changeCount`,{count:Object.keys(N).length})}),(0,G.jsxs)(`div`,{className:`ml-auto flex gap-2`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:p,disabled:n,children:h(`common.cancel`)}),(0,G.jsx)(Q,{onClick:()=>m(N),disabled:!P||n||F,children:n?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{className:`w-4 h-4 mr-2 animate-spin`}),h(`inventory.bulk.applyPending`)]}):h(`inventory.bulk.applyButton`,{count:t})})]})]})]})})}function D2e(e){let t=e[0],n=0,r=0,i=0;for(let t of e)n+=t.label_weight,r+=t.weight_used,i+=t.core_weight;return{...t,label_weight:n,weight_used:r,core_weight:i}}function w9(e){let t=new Set;for(let n of e)if(typeof n==`string`){let e=n.trim();e&&t.add(e)}return Array.from(t).sort((e,t)=>e.localeCompare(t))}function O2e(e){return`${e.material}|${e.subtype||``}|${e.brand||``}|${e.color_name||``}|${e.rgba||``}|${e.extra_colors||``}|${e.effect_type||``}|${e.label_weight}`}var k2e=`bambuddy-inventory-columns`,A2e=`none`.padStart(65,`_`);function j2e(e){return(e||``).toLowerCase().replace(/\d+/g,e=>e.padStart(64,`0`))}var T9=[{id:`id`,label:`#`,visible:!0},{id:`added_time`,label:`Added`,visible:!0},{id:`encode_time`,label:`Encoded`,visible:!1},{id:`last_used_time`,label:`Last Used`,visible:!1},{id:`rgba`,label:`Color`,visible:!0},{id:`material`,label:`Material`,visible:!0},{id:`subtype`,label:`Subtype`,visible:!0},{id:`color_name`,label:`Color Name`,visible:!1},{id:`brand`,label:`Brand`,visible:!0},{id:`slicer_filament`,label:`Slicer Filament`,visible:!1},{id:`location`,label:`Location`,visible:!0},{id:`storage_location`,label:`Storage Location`,visible:!1},{id:`temperature`,label:`Temperature`,visible:!1},{id:`humidity`,label:`Humidity`,visible:!1},{id:`battery`,label:`Battery`,visible:!1},{id:`label_weight`,label:`Label`,visible:!0},{id:`net`,label:`Net`,visible:!0},{id:`gross`,label:`Gross`,visible:!1},{id:`added_full`,label:`Full`,visible:!1},{id:`used`,label:`Used`,visible:!1},{id:`printed_total`,label:`Printed Total`,visible:!1},{id:`printed_since_weight`,label:`Printed Since Weight`,visible:!1},{id:`note`,label:`Note`,visible:!1},{id:`material_number`,label:`Material No.`,visible:!1},{id:`suppliers`,label:`Suppliers`,visible:!1},{id:`pa_k`,label:`PA(K)`,visible:!0},{id:`tag_id`,label:`Tag ID`,visible:!1},{id:`data_origin`,label:`Data Origin`,visible:!1},{id:`tag_type`,label:`Linked Tag Type`,visible:!1},{id:`stock`,label:`Stock`,visible:!1},{id:`remaining`,label:`Remaining`,visible:!0},{id:`spool_name`,label:`Spool`,visible:!1},{id:`cost_per_kg`,label:`Cost/kg`,visible:!1},{id:`weight_check`,label:`Weight Check`,visible:!1}];function M2e(){try{let e=localStorage.getItem(k2e);if(e){let t=JSON.parse(e),n=new Set(T9.map(e=>e.id)),r=new Set(t.map(e=>e.id)),i=[...t.filter(e=>n.has(e.id))];for(let e of T9){if(r.has(e.id))continue;let t=T9.indexOf(e),n=i.length;for(let e=t-1;e>=0;e--){let t=i.findIndex(t=>t.id===T9[e].id);if(t!==-1){n=t+1;break}}i.splice(n,0,e)}return i}}catch{}return T9.map(e=>({...e}))}function N2e(e){try{localStorage.setItem(k2e,JSON.stringify(e))}catch{}}function E9(e,t=!1){return t&&e>=1e3?`${(e/1e3).toFixed(1)}kg`:`${Math.round(e)}g`}var P2e={PLA:`bg-green-100 dark:bg-green-500/20 text-green-700 dark:text-green-400`,ABS:`bg-red-100 dark:bg-red-500/20 text-red-700 dark:text-red-400`,PETG:`bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400`,TPU:`bg-purple-100 dark:bg-purple-500/20 text-purple-700 dark:text-purple-400`,ASA:`bg-orange-100 dark:bg-orange-500/20 text-orange-700 dark:text-orange-400`,PA:`bg-yellow-100 dark:bg-yellow-500/20 text-yellow-700 dark:text-yellow-400`,PC:`bg-cyan-100 dark:bg-cyan-500/20 text-cyan-700 dark:text-cyan-400`,PET:`bg-sky-100 dark:bg-sky-500/20 text-sky-700 dark:text-sky-400`};function D9(e,t=`system`){if(!e)return`-`;let n=$f(e);return n?Gf(n,t):`-`}var F2e={id:()=>`#`,added_time:()=>`Added`,encode_time:()=>`Encoded`,last_used_time:()=>`Last Used`,rgba:e=>e(`inventory.color`),material:e=>e(`inventory.material`),subtype:e=>e(`inventory.subtype`),color_name:e=>e(`inventory.colorName`),brand:e=>e(`inventory.brand`),slicer_filament:e=>e(`inventory.slicerFilament`),location:()=>`Location`,storage_location:e=>e(`inventory.storageLocation`),temperature:e=>e(`inventory.temperature`),humidity:e=>e(`inventory.humidity`),battery:e=>e(`inventory.battery`),label_weight:e=>e(`inventory.labelWeight`),net:e=>e(`inventory.net`),gross:()=>`Gross`,added_full:()=>`Full`,used:e=>e(`inventory.weightUsed`),printed_total:()=>`Printed Total`,printed_since_weight:()=>`Printed Since Weight`,note:e=>e(`inventory.note`),material_number:e=>e(`inventory.materialNumber`),suppliers:e=>e(`inventory.suppliers.label`),pa_k:()=>`PA(K)`,tag_id:()=>`Tag ID`,data_origin:()=>`Data Origin`,tag_type:()=>`Linked Tag Type`,stock:e=>e(`inventory.stock`),remaining:e=>e(`inventory.remaining`),spool_name:e=>e(`inventory.spoolName`),cost_per_kg:e=>e(`inventory.costPerKg`),weight_check:e=>e(`inventory.weightCheck`)},O9={id:({spool:e})=>(0,G.jsx)(`span`,{className:`text-sm font-medium text-white`,children:e.id}),added_time:({spool:e,dateFormat:t})=>(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:D9(e.created_at,t)}),encode_time:({spool:e,dateFormat:t})=>(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:D9(e.encode_time,t)}),last_used_time:({spool:e,dateFormat:t})=>(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e.last_used?D9(e.last_used,t):`Never`}),rgba:({spool:e})=>(0,G.jsx)(`div`,{className:`flex items-center justify-center`,children:(0,G.jsx)(xm,{rgba:e.rgba,extraColors:e.extra_colors,effectType:e.effect_type,effectSize:`table`,subtype:e.subtype})}),material:({spool:e})=>(0,G.jsx)(`span`,{className:`text-sm text-white`,children:e.material}),subtype:({spool:e})=>(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e.subtype||`-`}),color_name:({spool:e})=>(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:Of(e.color_name,e.rgba,e.color_name_is_synthesized)||`-`}),brand:({spool:e})=>(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e.brand||`-`}),slicer_filament:({spool:e})=>(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,title:e.slicer_filament||void 0,children:e.slicer_filament_name||e.slicer_filament||`-`}),location:({spool:e,assignmentMap:t})=>{let n=t[e.id];if(!n)return(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:`-`});let r=n.printer_name||`Printer ${n.printer_id}`,i=n.ams_id===254||n.ams_id===255,a=!i&&n.ams_id>=128;return(0,G.jsxs)(`span`,{className:`inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-purple-100 dark:bg-purple-500/20 text-purple-700 dark:text-purple-400`,children:[r,` `,Op(n.ams_id,n.tray_id,a,i),n.ams_label?` (${n.ams_label})`:``]})},storage_location:({spool:e})=>e.storage_location?(0,G.jsx)(`span`,{className:`inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400`,children:e.storage_location}):(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:`-`}),temperature:({spool:e,locationReadingsMap:t,t:n,colorizeLocationSensors:r,locationSensorAboveColor:i,locationSensorBelowColor:a,locationSensorOptimalColor:o})=>{let s=e.location_id?t[e.location_id]?.find(e=>e.device_class===`temperature`):void 0;return s?(0,G.jsx)(`span`,{title:s.name,className:`text-sm ${M9(s,r,i,a,o)}`,children:j9(s,n)}):(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray/50`,children:`-`})},humidity:({spool:e,locationReadingsMap:t,t:n,colorizeLocationSensors:r,locationSensorAboveColor:i,locationSensorBelowColor:a,locationSensorOptimalColor:o})=>{let s=e.location_id?t[e.location_id]?.find(e=>e.device_class===`humidity`):void 0;return s?(0,G.jsx)(`span`,{title:s.name,className:`text-sm ${M9(s,r,i,a,o)}`,children:j9(s,n)}):(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray/50`,children:`-`})},battery:({spool:e,locationReadingsMap:t,t:n,colorizeLocationSensors:r,locationSensorAboveColor:i,locationSensorBelowColor:a,locationSensorOptimalColor:o})=>{let s=e.location_id?t[e.location_id]?.find(e=>e.device_class===`battery`):void 0;return s?(0,G.jsx)(`span`,{title:s.name,className:`text-sm ${M9(s,r,i,a,o)}`,children:j9(s,n)}):(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray/50`,children:`-`})},label_weight:({spool:e})=>(0,G.jsx)(`span`,{className:`text-sm text-white`,children:E9(e.label_weight)}),net:({remaining:e})=>(0,G.jsx)(`span`,{className:`text-sm text-white`,children:E9(e)}),gross:({spool:e,remaining:t})=>(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:E9(t+e.core_weight)}),added_full:({spool:e})=>(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e.added_full==null?`-`:e.added_full?`Yes`:`No`}),used:({spool:e})=>(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e.weight_used>0?E9(e.weight_used):`-`}),printed_total:()=>(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray/50`,children:`-`}),printed_since_weight:()=>(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray/50`,children:`-`}),note:({spool:e})=>(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray max-w-[150px] truncate block`,title:e.note||void 0,children:e.note||`-`}),material_number:({spool:e})=>(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e.material_number||`-`}),suppliers:({spool:e})=>{let t=e.suppliers??[];return t.length===0?(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:`-`}):(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1 max-w-[220px]`,children:[...t].sort((e,t)=>Number(t.is_purchase_source)-Number(e.is_purchase_source)).map(e=>(0,G.jsx)(`span`,{title:e.supplier_article_number||void 0,className:`inline-flex items-center px-1.5 py-0.5 rounded-full text-[10px] font-medium ${e.is_purchase_source?`bg-bambu-green/20 text-bambu-green`:`bg-bambu-gray/10 text-bambu-gray`}`,children:e.supplier_name},e.id))})},pa_k:({spool:e})=>(e.k_profiles?.length??0)===0?(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:`-`}):(0,G.jsx)(`span`,{className:`inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-bambu-green/20 text-bambu-green`,children:`K`}),tag_id:({spool:e})=>{let t=e.tag_uid||e.tray_uuid;return t?(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray font-mono`,title:t,children:t.length>12?`${t.slice(0,6)}...${t.slice(-4)}`:t}):(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray/50`,children:`-`})},data_origin:({spool:e})=>(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e.data_origin||`-`}),tag_type:({spool:e})=>(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e.tag_type||`-`}),stock:({spool:e,t})=>e.slicer_filament?(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:`-`}):(0,G.jsx)(`span`,{className:`inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-amber-100 dark:bg-amber-500/20 text-amber-700 dark:text-amber-400`,children:t(`inventory.stock`)}),remaining:({remaining:e,pct:t})=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`flex-1 h-2 bg-bambu-dark-tertiary rounded-full overflow-hidden`,children:(0,G.jsx)(`div`,{className:`h-full rounded-full ${t>50?`bg-bambu-green`:t>20?`bg-yellow-500`:`bg-red-500`}`,style:{width:`${Math.min(t,100)}%`}})}),(0,G.jsxs)(`span`,{className:`text-xs text-bambu-gray min-w-[40px] text-right`,children:[Math.round(e),`g`]})]}),spool_name:({spool:e,catalogMap:t})=>(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:(e.core_weight_catalog_id==null?void 0:t[e.core_weight_catalog_id])?.name||`-`}),cost_per_kg:({spool:e,currencySymbol:t})=>(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e.cost_per_kg==null?`-`:`${t}${e.cost_per_kg.toFixed(2)}`}),weight_check:({spool:e,onSyncWeight:t})=>{let n=e.last_scale_weight;if(n==null)return(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray/50`,title:`No scale measurement`,children:`-`});let r=e.core_weight||0,i=Math.max(0,e.label_weight-e.weight_used)+r,a,o;n0?`+${Math.round(a)}`:`${Math.round(a)}`,c=o?`Scale: ${Math.round(n)}g\nCalculated: ${Math.round(i)}g\nDifference: ${s}g (within tolerance)`:`Scale: ${Math.round(n)}g\nCalculated: ${Math.round(i)}g\nDifference: ${s}g (mismatch!)`;return(0,G.jsxs)(`div`,{className:`flex items-center gap-1 text-sm font-medium ${o?`text-green-700 dark:text-green-400`:`text-yellow-700 dark:text-yellow-400`}`,title:c,children:[(0,G.jsxs)(`span`,{children:[Math.round(n),`g`]}),o?(0,G.jsx)(is,{className:`w-3 h-3`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Pu,{className:`w-3 h-3`}),t&&(0,G.jsx)(`button`,{type:`button`,onClick:n=>{n.stopPropagation(),n.preventDefault(),t(e)},className:`p-1 hover:bg-bambu-green/20 rounded transition-colors text-bambu-green`,title:`Sync: trust scale weight and reset tracking`,children:(0,G.jsx)(Il,{className:`w-3.5 h-3.5`})})]})]})}},k9={id:e=>e.id,added_time:e=>e.created_at||``,encode_time:e=>e.encode_time||``,last_used_time:e=>e.last_used||``,material:e=>(e.material||``).toLowerCase(),subtype:e=>(e.subtype||``).toLowerCase(),color_name:e=>(e.color_name||``).toLowerCase(),rgba:e=>Tf(e.rgba),brand:e=>(e.brand||``).toLowerCase(),slicer_filament:e=>(e.slicer_filament_name||e.slicer_filament||``).toLowerCase(),location:(e,t)=>{let n=t[e.id];if(!n)return``;let r=n.ams_id===254||n.ams_id===255,i=!r&&n.ams_id>=128,a=n.ams_label?` (${n.ams_label})`:``;return`${n.printer_name||``} ${Op(n.ams_id,n.tray_id,i,r)}${a}`},storage_location:e=>(e.storage_location||``).toLowerCase(),label_weight:e=>e.label_weight,net:e=>Math.max(0,e.label_weight-e.weight_used),gross:e=>Math.max(0,e.label_weight-e.weight_used)+e.core_weight,used:e=>e.weight_used,remaining:e=>e.label_weight>0?Math.max(0,e.label_weight-e.weight_used)/e.label_weight:0,note:e=>(e.note||``).toLowerCase(),material_number:e=>j2e(e.material_number),suppliers:e=>{let t=e.suppliers??[];return((t.find(e=>e.is_purchase_source)??t[0])?.supplier_name||``).toLowerCase()},data_origin:e=>(e.data_origin||``).toLowerCase(),tag_type:e=>(e.tag_type||``).toLowerCase(),stock:e=>+!!e.slicer_filament,spool_name:e=>e.core_weight_catalog_id??0,cost_per_kg:e=>e.cost_per_kg??0,weight_check:e=>{if(e.last_scale_weight==null)return-1;let t=Math.max(0,e.label_weight-e.weight_used)+e.core_weight;return Math.abs(e.last_scale_weight-t)},temperature:(e,t,n)=>(e.location_id?n[e.location_id]:void 0)?.find(e=>e.device_class===`temperature`)?.value??-1/0,humidity:(e,t,n)=>(e.location_id?n[e.location_id]:void 0)?.find(e=>e.device_class===`humidity`)?.value??-1/0,battery:(e,t,n)=>(e.location_id?n[e.location_id]:void 0)?.find(e=>e.device_class===`battery`)?.value??-1/0},A9=`bambuddy-inventory-sort`;function I2e(){try{let e=localStorage.getItem(A9);if(e)return JSON.parse(e)}catch{}return null}function L2e(e){try{e?localStorage.setItem(A9,JSON.stringify(e)):localStorage.removeItem(A9)}catch{}}function R2e(){let{data:e}=K({queryKey:[`spoolman-settings`],queryFn:Z.getSpoolmanSettings,staleTime:300*1e3}),t=e!==void 0;return(0,G.jsx)(z2e,{spoolmanMode:e?.spoolman_enabled===`true`&&!!e?.spoolman_url,spoolmanModeReady:t})}function z2e({spoolmanMode:e=!1,spoolmanModeReady:t=!0}){let{t:n}=U(),r=Pf(),i=no(),{showToast:a}=qd(),{hasPermission:o,loading:s}=Nd(),c=!s&&o(`inventory:forecast_read`),[l,u]=ji(),[d,p]=(0,f.useState)(null),m=(0,f.useRef)(!1),[h,g]=(0,f.useState)(null),[_,v]=(0,f.useState)(null),[y,b]=(0,f.useState)(!1),[x,S]=(0,f.useState)(!1),[C,w]=(0,f.useState)(!1),[T,E]=(0,f.useState)(!1),[D,O]=(0,f.useState)(`active`),[k,A]=(0,f.useState)(`all`),[j,M]=(0,f.useState)(``),[N,P]=(0,f.useState)(``),[F,I]=(0,f.useState)(``),[L,R]=(0,f.useState)(``),[z,B]=(0,f.useState)(``),[V,ee]=(0,f.useState)(``),[te,ne]=(0,f.useState)(`all`),[re,ie]=(0,f.useState)(``),[ae,oe]=(0,f.useState)(`table`),[se,H]=(0,f.useState)(I2e),[ce,le]=(0,f.useState)(M2e),[ue,de]=(0,f.useState)(!1),[fe,pe]=(0,f.useState)(()=>{try{return localStorage.getItem(`bambuddy-inventory-group`)===`true`}catch{return!1}}),[me,he]=(0,f.useState)(new Set),[ge,_e]=(0,f.useState)(new Set),[ve,ye]=(0,f.useState)(!1),[be,xe]=(0,f.useState)(null),Se=(0,f.useCallback)(e=>{_e(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Ce=(0,f.useCallback)(()=>_e(new Set),[]);(0,f.useEffect)(()=>{_e(new Set)},[D,k,j,N,F,L,z,V,te,re]);let[we,Te]=(0,f.useState)(0),[Ee,De]=(0,f.useState)(()=>{try{let e=localStorage.getItem(`bambuddy-inventory-pageSize`);if(e){let t=Number(e);if([15,30,50,100,-1].includes(t))return t}}catch{}return 15}),{data:Oe}=K({queryKey:[`settings`],queryFn:Z.getSettings}),ke=Oe?.date_format||`system`,Ae=(Oe?.location_sensor_poll_interval||120)*1e3,{colorize:je,aboveColor:Me,belowColor:Ne,optimalColor:Pe}=F6(),Fe=e?[`spoolman-inventory-spools`]:[`inventory-spools`],Ie=()=>_6(i,Fe),{data:Le,isLoading:Re}=K({queryKey:Fe,queryFn:()=>e?Z.getSpoolmanInventorySpools(!0):Z.getSpools(!0),refetchInterval:3e4}),ze=(0,f.useCallback)(async()=>{S(!0);try{await Z.exportSpoolsCsv()}catch(e){a(e instanceof Error?e.message:n(`inventory.csv.exportError`,`Export failed`),`error`)}finally{S(!1)}},[a,n]),Be=e?n(`inventory.csv.spoolmanHint`,`In Spoolman mode, use Spoolman's built-in CSV import/export.`):void 0,{data:Ve=[]}=K({queryKey:p6,queryFn:Z.getLocations}),He=l.get(`location_id`),Ue=He===`__none__`?`__none__`:He&&/^\d+$/.test(He)&&Number(He)>0?He:``,We=l.get(`spool`),Ge=We&&/^\d+$/.test(We)&&Number(We)>0?Number(We):null,Ke=Le?.find(e=>e.id===Ge)??null,qe=(0,f.useCallback)(()=>{m.current=!0,u(e=>(e.delete(`spool`),e),{replace:!0})},[u]),{data:Je,isError:Ye,error:Xe}=K({queryKey:e?[`spoolman-inventory-spool`,Ge]:[`inventory-spool`,Ge],queryFn:()=>e?Z.getSpoolmanInventorySpool(Ge):Z.getSpool(Ge),enabled:t&&Ge!==null&&Ke===null,staleTime:1/0,retry:(e,t)=>e<2&&!(t instanceof id&&t.status===404)});(0,f.useEffect)(()=>{if(!m.current){if(t&&Ge&&Ke){qe(),p({spool:Ke,mode:`edit`});return}if(Je){qe(),p({spool:Je,mode:`edit`});return}Ye&&(qe(),a(n(Xe instanceof id&&Xe.status===404?`inventory.deepLinkSpoolNotFound`:`inventory.deepLinkFetchFailed`),`error`))}},[t,Ge,Ke,Je,Ye,Xe,qe,a,n]);let{data:Ze}=K({queryKey:[`spool-assignments`],queryFn:()=>Z.getAssignments(),refetchInterval:3e4}),{data:Qe=[],isError:$e}=K({queryKey:[`spoolman-slot-assignments-all`],queryFn:()=>Z.getSpoolmanSlotAssignments(),enabled:e,refetchInterval:3e4,staleTime:1e4,retry:1}),et=(0,f.useRef)(!1);(0,f.useEffect)(()=>{$e&&!et.current?(et.current=!0,a(n(`inventory.spoolmanUnreachable`),`error`)):$e||(et.current=!1)},[$e,a,n]);let{data:tt}=K({queryKey:[`spool-catalog`],queryFn:()=>Z.getSpoolCatalog()}),nt=q({mutationFn:t=>e?Z.deleteSpoolmanInventorySpool(t):Z.deleteSpool(t),onSuccess:()=>{Ie(),a(n(`inventory.spoolDeleted`),`success`)},onError:e=>{e instanceof id&&e.status===404?a(n(`inventory.deleteSpoolNotFound`),`error`):e instanceof id&&e.status===503?a(n(`inventory.spoolmanUnreachable`),`error`):a(n(`inventory.deleteFailed`),`error`)}}),rt=q({mutationFn:t=>e?Z.archiveSpoolmanInventorySpool(t):Z.archiveSpool(t),onSuccess:()=>{Ie(),a(n(`inventory.spoolArchived`),`success`)},onError:e=>{e instanceof id&&e.status===404?a(n(`inventory.archiveSpoolNotFound`),`error`):e instanceof id&&e.status===503?a(n(`inventory.spoolmanUnreachable`),`error`):a(n(`inventory.archiveFailed`),`error`)}}),it=q({mutationFn:t=>e?Z.restoreSpoolmanInventorySpool(t):Z.restoreSpool(t),onSuccess:()=>{Ie(),a(n(`inventory.spoolRestored`),`success`)},onError:e=>{e instanceof id&&e.status===404?a(n(`inventory.restoreSpoolNotFound`),`error`):e instanceof id&&e.status===503?a(n(`inventory.spoolmanUnreachable`),`error`):a(n(`inventory.restoreFailed`),`error`)}}),at=q({mutationFn:t=>e?Z.resetSpoolmanInventorySpoolConsumedCounter(t):Z.resetSpoolConsumedCounter(t),onSuccess:()=>{i.invalidateQueries({queryKey:Fe}),a(n(`inventory.consumedCounterReset`),`success`)},onError:()=>{a(n(`inventory.resetConsumedCounterFailed`),`error`)}}),ot=q({mutationFn:t=>e?Z.bulkResetSpoolmanInventorySpoolConsumedCounter(t):Z.bulkResetSpoolConsumedCounter(t),onSuccess:e=>{i.invalidateQueries({queryKey:Fe}),a(n(`inventory.allConsumedCountersReset`,{count:e.reset}),`success`),xe(null),Ce()},onError:()=>{a(n(`inventory.resetConsumedCounterFailed`),`error`)}}),st=e=>(e.not_found?.length??0)+(e.errors?.length??0),ct=q({mutationFn:async({ids:t,update:n})=>e?Z.bulkUpdateSpoolmanInventorySpools(t,n):Z.bulkUpdateSpools(t,n),onSuccess:e=>{Ie();let t=st(e);if(e.updated===0){a(n(`inventory.bulk.updateAllFailed`,{count:t}),`error`);return}t>0?a(n(`inventory.bulk.updatePartial`,{ok:e.updated,failed:t}),`warning`):a(n(`inventory.bulk.updateSuccess`,{count:e.updated}),`success`),ye(!1),Ce()},onError:e=>{a(e.message||n(`inventory.bulk.updateFailed`),`error`)}}),lt=q({mutationFn:async t=>e?Z.bulkDeleteSpoolmanInventorySpools(t):Z.bulkDeleteSpools(t),onSuccess:e=>{Ie();let t=st(e);if(e.deleted===0){a(n(`inventory.bulk.deleteAllFailed`,{count:t}),`error`);return}t>0?a(n(`inventory.bulk.deletePartial`,{ok:e.deleted,failed:t}),`warning`):a(n(`inventory.bulk.deleteSuccess`,{count:e.deleted}),`success`),xe(null),Ce()},onError:e=>{a(e.message||n(`inventory.bulk.deleteFailed`),`error`)}}),ut=q({mutationFn:async t=>e?Z.bulkArchiveSpoolmanInventorySpools(t):Z.bulkArchiveSpools(t),onSuccess:e=>{Ie();let t=st(e);if(e.archived===0&&t>0){a(n(`inventory.bulk.archiveAllFailed`,{count:t}),`error`);return}t>0?a(n(`inventory.bulk.archivePartial`,{ok:e.archived,failed:t}),`warning`):a(n(`inventory.bulk.archiveSuccess`,{count:e.archived}),`success`),xe(null),Ce()},onError:e=>{a(e.message||n(`inventory.bulk.archiveFailed`),`error`)}}),dt=q({mutationFn:async t=>e?Z.bulkRestoreSpoolmanInventorySpools(t):Z.bulkRestoreSpools(t),onSuccess:e=>{Ie();let t=st(e);if(e.restored===0&&t>0){a(n(`inventory.bulk.restoreAllFailed`,{count:t}),`error`);return}t>0?a(n(`inventory.bulk.restorePartial`,{ok:e.restored,failed:t}),`warning`):a(n(`inventory.bulk.restoreSuccess`,{count:e.restored}),`success`),xe(null),Ce()},onError:e=>{a(e.message||n(`inventory.bulk.restoreFailed`),`error`)}}),ft=(0,f.useMemo)(()=>(Le??[]).map(e=>e.id),[Le]),pt=async t=>{if(t.last_scale_weight!=null)try{e?await Z.syncSpoolmanSpoolWeight(t.id,t.last_scale_weight):await Od.updateSpoolWeight(t.id,t.last_scale_weight),i.invalidateQueries({queryKey:Fe}),a(`Synced "${[t.brand,t.material,Of(t.color_name,t.rgba,t.color_name_is_synthesized)].filter(Boolean).join(` `)}" to scale weight`,`success`)}catch(e){let t=e instanceof id&&e.status===404,r=e instanceof id&&e.status===503;a(n(t?`inventory.syncWeightSpoolNotFound`:r?`inventory.syncWeightSpoolmanUnreachable`:`inventory.syncWeightFailed`),`error`)}},mt=Oe?.low_stock_threshold??20,[ht,gt]=(0,f.useState)(!1),[_t,vt]=(0,f.useState)(mt.toString());(0,f.useEffect)(()=>{ht||vt(mt.toString())},[mt,ht]);let yt=q({mutationFn:e=>Z.updateSettings({low_stock_threshold:e}),onSuccess:()=>{i.invalidateQueries({queryKey:[`settings`]}),a(n(`common.saved`),`success`),gt(!1)},onError:()=>{a(n(`inventory.lowStockThresholdError`),`error`)}}),bt=(0,f.useMemo)(()=>{if(!Le)return null;let e=0,t=0,n=0,r=0,i={};for(let a of Le){if(t+=Math.max(0,a.weight_used-(a.weight_used_baseline??0)),a.archived_at)continue;r++;let o=Math.max(0,a.label_weight-a.weight_used);e+=o,(a.label_weight>0?o/a.label_weight*100:0)<(a.low_stock_threshold_pct??mt)&&n++;let s=a.material||`Unknown`;i[s]||(i[s]={count:0,weight:0}),i[s].count++,i[s].weight+=o}return{totalWeight:e,totalConsumed:t,lowStock:n,byMaterial:i,totalSpools:r}},[Le,mt]),xt=(Ze?.length??0)+(e?Qe.length:0),St=If(Oe?.currency||`USD`),Ct=(0,f.useMemo)(()=>{let e={};for(let t of Ze||[])e[t.spool_id]={printer_id:t.printer_id,printer_name:t.printer_name,ams_id:t.ams_id,tray_id:t.tray_id,ams_label:t.ams_label??null};for(let t of Qe)typeof t?.spoolman_spool_id!=`number`||t.spoolman_spool_id<=0||typeof t.printer_id!=`number`||typeof t.ams_id!=`number`||typeof t.tray_id!=`number`||e[t.spoolman_spool_id]||(e[t.spoolman_spool_id]={printer_id:t.printer_id,printer_name:t.printer_name??null,ams_id:t.ams_id,tray_id:t.tray_id,ams_label:t.ams_label??null});return e},[Ze,Qe]),wt=(0,f.useMemo)(()=>{let e={};for(let t of tt||[])e[t.id]=t;return e},[tt]),{data:Tt}=K({queryKey:[`locationHaSensors`],queryFn:()=>Z.getLocationHASensors()}),Et=(0,f.useMemo)(()=>new Set((Tt??[]).map(e=>e.location_id)),[Tt]),Dt=(0,f.useMemo)(()=>{let e=new Set;for(let t of Le||[])t.location_id&&Et.has(t.location_id)&&e.add(t.location_id);return Array.from(e)},[Le,Et]),Ot=ae===`cards`||ae===`table`&&ce.some(e=>e.visible&&(e.id===`temperature`||e.id===`humidity`||e.id===`battery`)),kt=_o({queries:Dt.map(e=>({queryKey:[`locationHaSensorReadings`,e],queryFn:()=>Z.getLocationHASensorReadings(e,!1),refetchInterval:Ae,enabled:Ot}))}),At=(0,f.useMemo)(()=>{let e={};return Dt.forEach((t,n)=>{let r=kt[n]?.data;r&&(e[t]=r)}),e},[Dt,kt]),jt=(0,f.useMemo)(()=>bt?Object.entries(bt.byMaterial).sort((e,t)=>t[1].weight-e[1].weight).slice(0,4):[],[bt]),Mt=(0,f.useMemo)(()=>{let e=Le||[];if(e=D===`active`?e.filter(e=>!e.archived_at):e.filter(e=>!!e.archived_at),k===`used`?e=e.filter(e=>e.weight_used>0):k===`new`?e=e.filter(e=>e.weight_used===0):k===`lowstock`&&(e=e.filter(e=>{let t=Math.max(0,e.label_weight-e.weight_used);return(e.label_weight>0?t/e.label_weight*100:0)<(e.low_stock_threshold_pct??mt)})),j&&(e=e.filter(e=>e.material===j)),N&&(e=e.filter(e=>e.brand===N)),F&&(e=F===`__none__`?e.filter(e=>!e.category):e.filter(e=>e.category===F)),L&&(e=L===A2e?e.filter(e=>!e.material_number?.trim()):e.filter(e=>e.material_number===L)),z)if(z===`__none__`)e=e.filter(e=>(e.suppliers??[]).length===0);else{let t=Number(z);e=e.filter(e=>(e.suppliers??[]).some(e=>e.supplier_id===t))}if(V){let t=Number(V);e=e.filter(e=>e.core_weight_catalog_id===t)}if(Ue)if(Ue===`__none__`)e=e.filter(e=>!e.location_id&&!e.storage_location?.trim());else{let t=Number(Ue),n=Ve.find(e=>e.id===t)?.name?.trim().toLowerCase();e=e.filter(e=>e.location_id==null?n?(e.storage_location||``).trim().toLowerCase()===n:!1:e.location_id===t)}return te===`stock`?e=e.filter(e=>!e.slicer_filament):te===`configured`&&(e=e.filter(e=>!!e.slicer_filament)),re&&(e=JH(e,re)),e},[Le,D,k,j,N,F,L,z,V,te,Ue,re,mt,Ve,r]),Nt=()=>Te(0),Pt=(0,f.useCallback)(e=>{u(t=>(t.delete(`location_id`),e&&t.set(`location_id`,e),t),{replace:!0}),Nt()},[u]),Ft=[...new Set(Le?.map(e=>e.material)||[])].sort(),It=[...new Set(Le?.map(e=>e.brand).filter(Boolean)||[])].sort(),Lt=[...new Set(Le?.map(e=>e.category?.trim()).filter(Boolean)||[])].sort(),Rt=(Le??[]).some(e=>!e.category),zt=[...new Set(Le?.map(e=>e.material_number?.trim()).filter(Boolean)||[])].sort((e,t)=>e.localeCompare(t,void 0,{numeric:!0})),Bt=(Le??[]).some(e=>!e.material_number?.trim()),Vt=(0,f.useMemo)(()=>{let e=new Map;for(let t of Le??[])for(let n of t.suppliers??[])e.set(n.supplier_id,n.supplier_name);return[...e.entries()].map(([e,t])=>({id:e,name:t})).sort((e,t)=>e.name.localeCompare(t.name))},[Le]),Ht=(Le??[]).some(e=>(e.suppliers??[]).length===0),Ut=[...new Set(Le?.map(e=>e.core_weight_catalog_id).filter(e=>e!=null)||[])].sort((e,t)=>{let n=(wt[e]?.name||``).toLowerCase(),r=(wt[t]?.name||``).toLowerCase();return n.localeCompare(r)}),Wt=(Le??[]).some(e=>!e.location_id&&!e.storage_location?.trim()),Gt=D!==`active`||k!==`all`||!!j||!!N||!!F||!!L||!!z||!!V||!!Ue||te!==`all`||!!re,Kt=e=>{le(e),N2e(e)},qt=(0,f.useMemo)(()=>ce.filter(e=>e.visible).map(e=>e.id),[ce]),Jt=e=>{k9[e]&&(H(t=>{let n;return n=t?.column===e?t.direction===`asc`?{column:e,direction:`desc`}:null:{column:e,direction:`asc`},L2e(n),n}),Nt())},Yt=(0,f.useMemo)(()=>{if(!se)return Mt;let e=k9[se.column];return e?[...Mt].sort((t,n)=>{let r=e(t,Ct,At),i=e(n,Ct,At);return ri?se.direction===`asc`?1:-1:0}):Mt},[Mt,se,Ct,At]),Xt=(0,f.useMemo)(()=>{if(!fe)return Yt.map(e=>({type:`single`,spool:e}));let e=new Map;for(let t of Yt)if(!(t.weight_used>0||Ct[t.id])){let n=O2e(t),r=e.get(n);r?r.push(t):e.set(n,[t])}let t=[],n=new Set;for(let r of Yt){if(r.weight_used>0||Ct[r.id]){t.push({type:`single`,spool:r});continue}let i=O2e(r);if(n.has(i))continue;n.add(i);let a=e.get(i);a.length===1?t.push({type:`single`,spool:a[0]}):t.push({type:`group`,key:i,spools:a,representative:a[0]})}return t},[Yt,fe,Ct]),Zt=Ee===-1,Qt=Xt.length,$t=Zt?Qt||1:Ee,en=Math.max(1,Math.ceil(Qt/$t)),tn=Zt?0:Math.min(we,en-1),nn=Zt?Xt:Xt.slice(tn*$t,(tn+1)*$t),W=()=>{let e=!fe;pe(e),he(new Set),Nt();try{localStorage.setItem(`bambuddy-inventory-group`,String(e))}catch{}},rn=e=>{he(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},an=e=>{De(e),Te(0);try{localStorage.setItem(`bambuddy-inventory-pageSize`,String(e))}catch{}};return(0,G.jsxs)(`div`,{className:`p-4 md:p-8 space-y-6`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`h1`,{className:`text-2xl font-bold text-white flex items-center gap-3`,children:[(0,G.jsx)(_l,{className:`w-7 h-7 text-bambu-green`}),n(`inventory.title`)]}),(0,G.jsx)(`p`,{className:`text-bambu-gray mt-1`,children:n(`inventory.subtitle`)})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(Q,{variant:`secondary`,disabled:e,onClick:()=>b(!0),title:Be,children:[(0,G.jsx)(Ru,{className:`w-4 h-4`}),n(`inventory.csv.importButton`,`Import CSV`)]}),(0,G.jsxs)(Q,{variant:`secondary`,disabled:e||x,onClick:ze,title:Be,children:[x?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(Us,{className:`w-4 h-4`}),n(`inventory.csv.exportButton`,`Export CSV`)]}),(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>w(!0),children:[(0,G.jsx)(el,{className:`w-4 h-4`}),n(`locations.manage`)]}),(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>E(!0),children:[(0,G.jsx)(vu,{className:`w-4 h-4`}),n(`inventory.suppliers.title`)]}),(0,G.jsxs)(Q,{variant:`secondary`,disabled:Mt.length===0,onClick:()=>v(ge.size>0?[...ge]:Mt.map(e=>e.id)),title:Mt.length===0?n(`inventory.labels.noSpoolsTitle`,`No spools to label`):ge.size>0?n(`inventory.labels.selectedTitle`,`Print labels for the {{count}} selected spools`,{count:ge.size}):n(`inventory.labels.bulkTitle`,`Pick spools to print labels for from the {{count}} currently shown`,{count:Mt.length}),children:[(0,G.jsx)(Ml,{className:`w-4 h-4`}),n(`inventory.labels.printLabels`,`Print labels…`)]}),(0,G.jsxs)(Q,{onClick:()=>p({spool:null,mode:`create`}),children:[(0,G.jsx)(kl,{className:`w-4 h-4`}),n(`inventory.addSpool`)]})]})]}),bt&&!Re&&(0,G.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-3`,children:[(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg p-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,G.jsx)(_l,{className:`w-4 h-4 text-bambu-green`}),(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray font-medium uppercase tracking-wide`,children:n(`inventory.totalInventory`)})]}),(0,G.jsx)(`div`,{className:`text-xl font-bold text-white`,children:E9(bt.totalWeight,!0)}),(0,G.jsxs)(`div`,{className:`text-xs text-bambu-gray mt-1`,children:[bt.totalSpools,` `,bt.totalSpools===1?n(`inventory.spool`):n(`inventory.spools`)]})]}),(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg p-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mb-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Mu,{className:`w-4 h-4 text-blue-600 dark:text-blue-400`}),(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray font-medium uppercase tracking-wide`,children:n(`inventory.totalConsumed`)})]}),bt.totalConsumed>0&&ft.length>0&&(0,G.jsx)(`button`,{onClick:()=>g({type:`reset-all-consumed-counters`}),className:`p-1 text-bambu-gray hover:text-red-600 dark:hover:text-red-400 rounded transition-colors`,title:n(`inventory.resetAllConsumedCountersTooltip`),"aria-label":n(`inventory.resetAllConsumedCounters`),children:(0,G.jsx)(Ys,{className:`w-3.5 h-3.5`})})]}),(0,G.jsx)(`div`,{className:`text-xl font-bold text-white`,children:E9(bt.totalConsumed,!0)}),(0,G.jsx)(`div`,{className:`text-xs text-bambu-gray mt-1`,children:n(`inventory.sinceTracking`)})]}),(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg p-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,G.jsx)(Hc,{className:`w-4 h-4 text-green-600 dark:text-green-400`}),(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray font-medium uppercase tracking-wide`,children:n(`inventory.byMaterial`)})]}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5 mt-1`,children:jt.map(([e,t])=>(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium ${P2e[e]||`bg-bambu-dark-tertiary text-bambu-gray`}`,children:[e,` `,(0,G.jsx)(`span`,{className:`opacity-70`,children:E9(t.weight,!0)})]},e))})]}),(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg p-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,G.jsx)(Ml,{className:`w-4 h-4 text-purple-600 dark:text-purple-400`}),(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray font-medium uppercase tracking-wide`,children:n(`inventory.inPrinter`)})]}),(0,G.jsx)(`div`,{className:`text-xl font-bold text-white`,children:xt}),(0,G.jsx)(`div`,{className:`text-xs text-bambu-gray mt-1`,children:n(`inventory.loadedInAms`)})]}),(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg p-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,G.jsx)(Pu,{className:`w-4 h-4 text-yellow-600 dark:text-yellow-400`}),(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray font-medium uppercase tracking-wide`,children:n(`inventory.lowStock`)})]}),(0,G.jsx)(`div`,{className:`text-xl font-bold ${bt.lowStock>0?`text-yellow-700 dark:text-yellow-400`:`text-white`}`,children:bt.lowStock}),(0,G.jsx)(`div`,{className:`text-xs text-bambu-gray mt-1 flex items-center gap-2`,children:ht?(0,G.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let t=parseFloat(_t);!isNaN(t)&&t>=.1&&t<=99.9?yt.mutate(t):a(n(`inventory.lowStockThresholdError`),`error`)},className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:`<`}),(0,G.jsx)(`input`,{type:`text`,inputMode:`decimal`,pattern:`^\\d{0,2}(\\.\\d?)?$`,maxLength:4,value:_t,onChange:e=>{let t=e.target.value.replace(/[^\d.]/g,``);/^\d{0,2}(\.\d?)?$/.test(t)&&vt(t)},className:`px-1.5 py-1 rounded border border-bambu-dark-tertiary text-xs text-white bg-bambu-dark-secondary focus:outline-none focus:border-bambu-green w-14 text-center`,onWheel:e=>e.currentTarget.blur(),disabled:yt.isPending}),(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:`%`}),(0,G.jsx)(Q,{type:`submit`,size:`sm`,disabled:yt.isPending,children:n(`common.save`)}),(0,G.jsx)(Q,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>gt(!1),disabled:yt.isPending,children:n(`common.cancel`)})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{className:`text-bambu-gray`,children:[`< `,mt,`%`]}),(0,G.jsx)(`button`,{className:`p-1.5 text-bambu-gray hover:text-white rounded transition-colors`,title:n(`common.edit`),onClick:()=>{vt(mt.toString()),gt(!0)},children:(0,G.jsx)(Cl,{className:`w-4 h-4`})})]})})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-3 items-start sm:items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`relative flex-1 max-w-md ${ae===`forecast`?`invisible pointer-events-none`:``}`,children:[(0,G.jsx)(Kl,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray/50`}),(0,G.jsx)(`input`,{type:`text`,value:re,onChange:e=>{ie(e.target.value),Nt()},placeholder:n(`inventory.search`),className:`w-full pl-10 pr-8 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green`}),re&&(0,G.jsx)(`button`,{onClick:()=>{ie(``),Nt()},className:`absolute right-3 top-1/2 -translate-y-1/2 text-bambu-gray hover:text-white`,children:(0,G.jsx)($u,{className:`w-4 h-4`})})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[ae===`table`&&(0,G.jsxs)(`button`,{onClick:()=>de(!0),className:`flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium text-bambu-gray border border-bambu-dark-tertiary rounded-lg hover:bg-bambu-dark-tertiary transition-colors`,title:n(`inventory.configureColumns`),children:[(0,G.jsx)(Ms,{className:`w-4 h-4`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:n(`inventory.columns`)})]}),ae!==`forecast`&&(0,G.jsxs)(`button`,{onClick:W,className:`flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium border rounded-lg transition-colors ${fe?`bg-bambu-green/20 text-bambu-green border-bambu-green/30`:`text-bambu-gray border-bambu-dark-tertiary hover:bg-bambu-dark-tertiary`}`,title:n(`inventory.groupSimilar`),children:[(0,G.jsx)(Tc,{className:`w-4 h-4`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:n(`inventory.groupSimilar`)})]}),(0,G.jsxs)(`div`,{className:`flex bg-bambu-dark-primary border border-bambu-dark-tertiary rounded-lg overflow-hidden`,children:[(0,G.jsxs)(`button`,{onClick:()=>oe(`table`),className:`flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium transition-colors ${ae===`table`?`bg-bambu-green text-white`:`text-bambu-gray hover:bg-bambu-dark-tertiary`}`,children:[(0,G.jsx)(bu,{className:`w-4 h-4`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:n(`inventory.table`)})]}),(0,G.jsxs)(`button`,{onClick:()=>oe(`cards`),className:`flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium transition-colors ${ae===`cards`?`bg-bambu-green text-white`:`text-bambu-gray hover:bg-bambu-dark-tertiary`}`,children:[(0,G.jsx)(Uc,{className:`w-4 h-4`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:n(`inventory.cards`)})]}),(0,G.jsxs)(`button`,{onClick:()=>c&&oe(`forecast`),disabled:!c,title:c?void 0:n(`forecast.noReadAccess`),className:`flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium transition-colors disabled:opacity-40 disabled:cursor-not-allowed ${ae===`forecast`?`bg-bambu-green text-white`:`text-bambu-gray hover:bg-bambu-dark-tertiary`}`,children:[c?(0,G.jsx)(Nu,{className:`w-4 h-4`}):(0,G.jsx)(Xc,{className:`w-4 h-4`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:n(`forecast.title`)})]})]})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 ${ae===`forecast`?`hidden`:``}`,children:[(0,G.jsxs)(`div`,{className:`flex items-center rounded-lg border border-bambu-dark-tertiary overflow-hidden`,children:[(0,G.jsxs)(`button`,{onClick:()=>{O(`active`),Nt()},className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium transition-colors ${D===`active`?`bg-bambu-green/20 text-bambu-green`:`text-bambu-gray hover:bg-bambu-dark-tertiary`}`,children:[(0,G.jsx)(_l,{className:`w-3.5 h-3.5`}),n(`inventory.active`)]}),(0,G.jsxs)(`button`,{onClick:()=>{O(`archived`),Nt()},className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium transition-colors ${D===`archived`?`bg-bambu-green/20 text-bambu-green`:`text-bambu-gray hover:bg-bambu-dark-tertiary`}`,children:[(0,G.jsx)(Oo,{className:`w-3.5 h-3.5`}),n(`inventory.archived`)]})]}),(0,G.jsx)(`div`,{className:`w-px h-5 bg-bambu-dark-tertiary`}),(0,G.jsxs)(`div`,{className:`flex items-center rounded-lg border border-bambu-dark-tertiary overflow-hidden`,children:[(0,G.jsx)(`button`,{onClick:()=>{A(`all`),Nt()},className:`px-3 py-1.5 text-xs font-medium transition-colors ${k===`all`?`bg-bambu-green/20 text-bambu-green`:`text-bambu-gray hover:bg-bambu-dark-tertiary`}`,children:n(`inventory.all`)}),(0,G.jsxs)(`button`,{onClick:()=>{A(`used`),Nt()},className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium transition-colors ${k===`used`?`bg-bambu-green/20 text-bambu-green`:`text-bambu-gray hover:bg-bambu-dark-tertiary`}`,children:[(0,G.jsx)(ws,{className:`w-3.5 h-3.5`}),n(`inventory.used`)]}),(0,G.jsx)(`button`,{onClick:()=>{A(`new`),Nt()},className:`px-3 py-1.5 text-xs font-medium transition-colors ${k===`new`?`bg-bambu-green/20 text-bambu-green`:`text-bambu-gray hover:bg-bambu-dark-tertiary`}`,children:n(`inventory.new`)}),(0,G.jsxs)(`button`,{onClick:()=>{A(`lowstock`),Nt()},className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium transition-colors ${k===`lowstock`?`bg-yellow-100 dark:bg-yellow-500/20 text-yellow-700 dark:text-yellow-400`:`text-bambu-gray hover:bg-bambu-dark-tertiary`}`,children:[(0,G.jsx)(Pu,{className:`w-3.5 h-3.5`}),n(`inventory.lowStock`)]})]}),(0,G.jsxs)(`div`,{className:`flex items-center rounded-lg border border-bambu-dark-tertiary overflow-hidden`,children:[(0,G.jsx)(`button`,{onClick:()=>{ne(`all`),Nt()},className:`px-3 py-1.5 text-xs font-medium transition-colors ${te===`all`?`bg-bambu-green/20 text-bambu-green`:`text-bambu-gray hover:bg-bambu-dark-tertiary`}`,children:n(`inventory.all`)}),(0,G.jsx)(`button`,{onClick:()=>{ne(`stock`),Nt()},className:`px-3 py-1.5 text-xs font-medium transition-colors ${te===`stock`?`bg-amber-100 dark:bg-amber-500/20 text-amber-700 dark:text-amber-400`:`text-bambu-gray hover:bg-bambu-dark-tertiary`}`,children:n(`inventory.stock`)}),(0,G.jsx)(`button`,{onClick:()=>{ne(`configured`),Nt()},className:`px-3 py-1.5 text-xs font-medium transition-colors ${te===`configured`?`bg-bambu-green/20 text-bambu-green`:`text-bambu-gray hover:bg-bambu-dark-tertiary`}`,children:n(`inventory.configured`)})]}),(0,G.jsx)(`div`,{className:`w-px h-5 bg-bambu-dark-tertiary`}),(0,G.jsxs)(`select`,{value:j,onChange:e=>{M(e.target.value),Nt()},className:`px-3 py-1.5 rounded-lg border text-xs font-medium transition-colors cursor-pointer focus:outline-none ${j?`bg-bambu-green/20 text-bambu-green border-bambu-green/30`:`bg-transparent text-bambu-gray border-bambu-dark-tertiary hover:bg-bambu-dark-tertiary`}`,children:[(0,G.jsx)(`option`,{value:``,children:n(`inventory.material`)}),Ft.map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))]}),(0,G.jsxs)(`select`,{value:N,onChange:e=>{P(e.target.value),Nt()},className:`px-3 py-1.5 rounded-lg border text-xs font-medium transition-colors cursor-pointer focus:outline-none ${N?`bg-bambu-green/20 text-bambu-green border-bambu-green/30`:`bg-transparent text-bambu-gray border-bambu-dark-tertiary hover:bg-bambu-dark-tertiary`}`,children:[(0,G.jsx)(`option`,{value:``,children:n(`inventory.brand`)}),It.map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))]}),(Lt.length>0||F)&&(0,G.jsxs)(`select`,{value:F,onChange:e=>{I(e.target.value),Nt()},className:`px-3 py-1.5 rounded-lg border text-xs font-medium transition-colors cursor-pointer focus:outline-none ${F?`bg-bambu-green/20 text-bambu-green border-bambu-green/30`:`bg-transparent text-bambu-gray border-bambu-dark-tertiary hover:bg-bambu-dark-tertiary`}`,children:[(0,G.jsx)(`option`,{value:``,children:n(`inventory.category`)}),Lt.map(e=>(0,G.jsx)(`option`,{value:e,children:e},e)),Rt&&(0,G.jsx)(`option`,{value:`__none__`,children:n(`inventory.categoryNone`)})]}),(zt.length>0||L)&&(0,G.jsxs)(`select`,{value:L,onChange:e=>{R(e.target.value),Nt()},className:`px-3 py-1.5 rounded-lg border text-xs font-medium transition-colors cursor-pointer focus:outline-none ${L?`bg-bambu-green/20 text-bambu-green border-bambu-green/30`:`bg-transparent text-bambu-gray border-bambu-dark-tertiary hover:bg-bambu-dark-tertiary`}`,children:[(0,G.jsx)(`option`,{value:``,children:n(`inventory.materialNumber`)}),zt.map(e=>(0,G.jsx)(`option`,{value:e,children:e},e)),Bt&&(0,G.jsx)(`option`,{value:A2e,children:n(`inventory.materialNumberNone`)})]}),(Vt.length>0||z)&&(0,G.jsxs)(`select`,{value:z,onChange:e=>{B(e.target.value),Nt()},className:`px-3 py-1.5 rounded-lg border text-xs font-medium transition-colors cursor-pointer focus:outline-none ${z?`bg-bambu-green/20 text-bambu-green border-bambu-green/30`:`bg-transparent text-bambu-gray border-bambu-dark-tertiary hover:bg-bambu-dark-tertiary`}`,children:[(0,G.jsx)(`option`,{value:``,children:n(`inventory.suppliers.label`)}),Vt.map(e=>(0,G.jsx)(`option`,{value:String(e.id),children:e.name},e.id)),Ht&&(0,G.jsx)(`option`,{value:`__none__`,children:n(`inventory.suppliers.none`)})]}),Ut.length>0&&(0,G.jsxs)(`select`,{value:V,onChange:e=>{ee(e.target.value),Nt()},className:`px-3 py-1.5 rounded-lg border text-xs font-medium transition-colors cursor-pointer focus:outline-none ${V?`bg-bambu-green/20 text-bambu-green border-bambu-green/30`:`bg-transparent text-bambu-gray border-bambu-dark-tertiary hover:bg-bambu-dark-tertiary`}`,children:[(0,G.jsx)(`option`,{value:``,children:n(`inventory.spoolName`)}),Ut.map(e=>(0,G.jsx)(`option`,{value:e,children:wt[e]?.name||`#${e}`},e))]}),(Ve.length>0||Ue)&&(0,G.jsxs)(`select`,{value:Ue,onChange:e=>{Pt(e.target.value)},className:`px-3 py-1.5 rounded-lg border text-xs font-medium transition-colors cursor-pointer focus:outline-none ${Ue?`bg-bambu-green/20 text-bambu-green border-bambu-green/30`:`bg-transparent text-bambu-gray border-bambu-dark-tertiary hover:bg-bambu-dark-tertiary`}`,children:[(0,G.jsx)(`option`,{value:``,children:n(`inventory.storageLocation`)}),Ve.map(e=>(0,G.jsx)(`option`,{value:String(e.id),children:e.name},e.id)),Wt&&(0,G.jsx)(`option`,{value:`__none__`,children:n(`inventory.storageLocationNone`)})]}),Gt&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`w-px h-5 bg-bambu-dark-tertiary`}),(0,G.jsxs)(`button`,{onClick:()=>{O(`active`),A(`all`),M(``),P(``),I(``),R(``),B(``),ee(``),ne(`all`),ie(``),u(e=>(e.delete(`location_id`),e),{replace:!0}),Nt()},className:`flex items-center gap-1 text-xs text-bambu-gray hover:text-bambu-green transition-colors`,children:[(0,G.jsx)($u,{className:`w-3.5 h-3.5`}),n(`inventory.clearFilters`)]})]}),ae!==`forecast`&&(0,G.jsxs)(`span`,{className:`ml-auto text-xs text-bambu-gray`,children:[Yt.length,` `,Yt.length===1?n(`inventory.spool`):n(`inventory.spools`),fe&&Qt0&&ae!==`forecast`&&(0,G.jsxs)(`div`,{className:`sticky top-2 z-10 mb-4 flex items-center gap-2 px-3 py-2 bg-bambu-green/10 border border-bambu-green/30 rounded-lg backdrop-blur-sm`,children:[(0,G.jsx)(`span`,{className:`text-sm text-bambu-green font-medium`,children:n(`inventory.bulk.selectionCount`,{count:ge.size})}),(0,G.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(Q,{size:`sm`,variant:`secondary`,onClick:()=>ye(!0),children:[(0,G.jsx)(Cl,{className:`w-3.5 h-3.5 mr-1.5`}),n(`inventory.bulk.edit`)]}),(0,G.jsxs)(Q,{size:`sm`,variant:`secondary`,onClick:()=>v([...ge]),children:[(0,G.jsx)(Ml,{className:`w-3.5 h-3.5 mr-1.5`}),n(`inventory.bulk.printLabels`)]}),(0,G.jsxs)(Q,{size:`sm`,variant:`secondary`,onClick:()=>xe(`reset-consumed-counter`),children:[(0,G.jsx)(Ys,{className:`w-3.5 h-3.5 mr-1.5`}),n(`inventory.bulk.resetUsage`)]}),D===`archived`?(0,G.jsxs)(Q,{size:`sm`,variant:`secondary`,onClick:()=>xe(`restore`),children:[(0,G.jsx)(Rl,{className:`w-3.5 h-3.5 mr-1.5`}),n(`inventory.bulk.restore`)]}):(0,G.jsxs)(Q,{size:`sm`,variant:`secondary`,onClick:()=>xe(`archive`),children:[(0,G.jsx)(Oo,{className:`w-3.5 h-3.5 mr-1.5`}),n(`inventory.bulk.archive`)]}),(0,G.jsxs)(Q,{size:`sm`,variant:`danger`,onClick:()=>xe(`delete`),children:[(0,G.jsx)(ju,{className:`w-3.5 h-3.5 mr-1.5`}),n(`inventory.bulk.delete`)]}),(0,G.jsx)(`button`,{className:`p-1.5 text-bambu-gray hover:text-white rounded transition-colors`,onClick:Ce,title:n(`inventory.bulk.clearSelection`),"aria-label":n(`inventory.bulk.clearSelection`),children:(0,G.jsx)($u,{className:`w-4 h-4`})})]})]}),Re?(0,G.jsx)(`div`,{className:`flex justify-center py-16`,children:(0,G.jsx)(Y,{className:`w-8 h-8 text-bambu-green animate-spin`})}):ae===`forecast`?(0,G.jsx)(u0e,{spools:Le||[]}):ae===`cards`?nn.length>0?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4`,children:nn.map(e=>{if(e.type===`group`){let{key:t,spools:r,representative:i}=e,a=r.reduce((e,t)=>e+Math.max(0,t.label_weight-t.weight_used),0),o=bm({rgba:i.rgba,extraColors:i.extra_colors,effectType:i.effect_type,subtype:i.subtype,effectSize:`groupheader`}),s=me.has(t);return(0,G.jsxs)(`div`,{className:`col-span-full`,children:[(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg overflow-hidden border border-bambu-green/30 hover:border-bambu-green transition-colors cursor-pointer`,onClick:()=>rn(t),children:[(0,G.jsx)(`div`,{className:`h-10 flex items-center px-4 gap-3`,style:o,children:(0,G.jsx)(`span`,{className:`bg-white/90 text-gray-800 px-3 py-0.5 rounded-full text-sm font-medium`,children:Of(i.color_name,i.rgba,i.color_name_is_synthesized)||`-`})}),(0,G.jsxs)(`div`,{className:`px-4 py-3 flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(as,{className:`w-4 h-4 text-bambu-gray transition-transform ${s?``:`-rotate-90`}`}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`h3`,{className:`font-semibold text-white`,children:[i.material,i.subtype?` ${i.subtype}`:``]}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i.brand||`-`})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,title:n(`inventory.remaining`),children:E9(a)}),(0,G.jsx)(`span`,{className:`text-xs font-medium bg-bambu-green/20 text-bambu-green px-2 py-0.5 rounded-full`,children:n(`inventory.groupedSpools`,{count:r.length})})]})]})]}),s&&(0,G.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4 mt-2 ml-4`,children:r.map(e=>{let t=Math.max(0,e.label_weight-e.weight_used);return(0,G.jsx)(V2e,{spool:e,remaining:t,pct:e.label_weight>0?t/e.label_weight*100:0,onClick:()=>p({spool:e,mode:`edit`}),onPrintLabel:()=>v([e.id]),onCopy:()=>p({spool:e,mode:`copy`}),t:n,colorizeLocationSensors:je,locationSensorAboveColor:Me,locationSensorBelowColor:Ne,locationSensorOptimalColor:Pe},e.id)})})]},`group-${t}`)}let t=e.spool,r=Math.max(0,t.label_weight-t.weight_used);return(0,G.jsx)(V2e,{spool:t,remaining:r,pct:t.label_weight>0?r/t.label_weight*100:0,onClick:()=>p({spool:t,mode:`edit`}),onPrintLabel:()=>v([t.id]),onCopy:()=>p({spool:t,mode:`copy`}),t:n,colorizeLocationSensors:je,locationSensorAboveColor:Me,locationSensorBelowColor:Ne,locationSensorOptimalColor:Pe},t.id)})}),(0,G.jsx)(B2e,{pageIndex:tn,pageSize:Ee,totalRows:Qt,totalPages:en,onPageChange:Te,onPageSizeChange:an,t:n})]}):(0,G.jsx)(q2e,{hasFilters:Gt,onAddSpool:()=>p({spool:null,mode:`create`}),t:n}):nn.length>0?(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg overflow-hidden border border-bambu-dark-tertiary`,children:[(0,G.jsx)(`div`,{className:`overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary bg-bambu-dark-tertiary/30`,children:[(0,G.jsx)(`th`,{className:`w-10 px-3 py-3`,children:(0,G.jsx)(`input`,{type:`checkbox`,className:`h-4 w-4 cursor-pointer`,"aria-label":n(`inventory.bulk.selectAllVisible`),checked:nn.length>0&&nn.every(e=>(e.type===`group`?e.spools.map(e=>e.id):[e.spool.id]).every(e=>ge.has(e))),onChange:e=>{if(e.target.checked){let e=new Set(ge);for(let t of nn){let n=t.type===`group`?t.spools.map(e=>e.id):[t.spool.id];for(let t of n)e.add(t)}_e(e)}else{let e=new Set(ge);for(let t of nn){let n=t.type===`group`?t.spools.map(e=>e.id):[t.spool.id];for(let t of n)e.delete(t)}_e(e)}}})}),qt.map(e=>{let t=!!k9[e],r=se?.column===e;return(0,G.jsx)(`th`,{className:`text-left py-3 px-4 text-xs font-medium uppercase tracking-wide select-none ${e===`remaining`?`min-w-[150px]`:``} ${t?`cursor-pointer hover:text-bambu-green transition-colors`:``} ${r?`text-bambu-green`:`text-bambu-gray`}`,onClick:t?()=>Jt(e):void 0,children:(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[F2e[e]?.(n)??e,t&&(r?se.direction===`asc`?(0,G.jsx)(Io,{className:`w-3 h-3`}):(0,G.jsx)(Ao,{className:`w-3 h-3`}):(0,G.jsx)(Po,{className:`w-3 h-3 opacity-30`}))]})},e)}),(0,G.jsx)(`th`,{className:`text-right py-3 px-4 text-xs font-medium text-bambu-gray uppercase tracking-wide`,children:n(`common.actions`)})]})}),(0,G.jsx)(`tbody`,{children:nn.map(e=>{if(e.type===`group`){let{key:t,spools:r}=e,i=me.has(t),a=D2e(r),o=Math.max(0,a.label_weight-a.weight_used);return(0,G.jsx)(K2e,{spools:r,headerSpool:a,remaining:o,pct:a.label_weight>0?o/a.label_weight*100:0,isExpanded:i,onToggle:()=>rn(t),selectedIds:ge,onToggleSelected:Se,onToggleGroupSelected:(e,t)=>{_e(n=>{let r=new Set(n);for(let n of e)t?r.add(n):r.delete(n);return r})},onEdit:e=>p({spool:e,mode:`edit`}),onCopy:e=>p({spool:e,mode:`copy`}),onArchive:e=>g({type:`archive`,spoolId:e}),onDelete:e=>g({type:`delete`,spoolId:e}),onPrintLabel:e=>v([e]),onResetConsumedCounter:e=>g({type:`reset-consumed-counter`,spoolId:e}),visibleColumns:qt,assignmentMap:Ct,catalogMap:wt,locationReadingsMap:At,currencySymbol:St,dateFormat:ke,t:n,onSyncWeight:pt,colorizeLocationSensors:je,locationSensorAboveColor:Me,locationSensorBelowColor:Ne,locationSensorOptimalColor:Pe},`group-${t}`)}let t=e.spool,r=Math.max(0,t.label_weight-t.weight_used);return(0,G.jsx)(G2e,{spool:t,remaining:r,pct:t.label_weight>0?r/t.label_weight*100:0,isSelected:ge.has(t.id),onToggleSelected:()=>Se(t.id),onEdit:()=>p({spool:t,mode:`edit`}),onCopy:()=>p({spool:t,mode:`copy`}),onRestore:()=>it.mutate(t.id),onArchive:()=>g({type:`archive`,spoolId:t.id}),onDelete:()=>g({type:`delete`,spoolId:t.id}),onPrintLabel:()=>v([t.id]),onResetConsumedCounter:()=>g({type:`reset-consumed-counter`,spoolId:t.id}),visibleColumns:qt,assignmentMap:Ct,catalogMap:wt,locationReadingsMap:At,currencySymbol:St,dateFormat:ke,t:n,onSyncWeight:pt,colorizeLocationSensors:je,locationSensorAboveColor:Me,locationSensorBelowColor:Ne,locationSensorOptimalColor:Pe},t.id)})})]})}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 bg-bambu-dark-tertiary/50 border-t border-bambu-dark-tertiary text-sm`,children:[(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:Zt?`${Qt} ${n(Qt===1?`inventory.spool`:`inventory.spools`)}`:(0,G.jsxs)(G.Fragment,{children:[n(`inventory.showing`),` `,tn*$t+1,` `,n(`inventory.to`),` `,Math.min((tn+1)*$t,Qt),` `,n(`inventory.of`),` `,Qt,` `,n(`inventory.spools`)]})}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:n(`inventory.show`)}),(0,G.jsxs)(`select`,{value:Ee,onChange:e=>an(Number(e.target.value)),className:`px-2 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm focus:outline-none focus:border-bambu-green`,children:[[15,30,50,100].map(e=>(0,G.jsx)(`option`,{value:e,children:e},e)),(0,G.jsx)(`option`,{value:-1,children:n(`inventory.all`)})]}),!Zt&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`button`,{onClick:()=>Te(0),disabled:tn===0,className:`p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,title:`First page`,children:(0,G.jsx)(us,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{onClick:()=>Te(e=>Math.max(0,e-1)),disabled:tn===0,className:`p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:(0,G.jsx)(cs,{className:`w-4 h-4`})}),(0,G.jsxs)(`span`,{className:`text-bambu-gray px-2 whitespace-nowrap`,children:[n(`inventory.page`),` `,tn+1,` `,n(`inventory.of`),` `,en]}),(0,G.jsx)(`button`,{onClick:()=>Te(e=>Math.min(en-1,e+1)),disabled:tn>=en-1,className:`p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:(0,G.jsx)(ss,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{onClick:()=>Te(en-1),disabled:tn>=en-1,className:`p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,title:`Last page`,children:(0,G.jsx)(ds,{className:`w-4 h-4`})})]})]})]})]}):(0,G.jsx)(q2e,{hasFilters:Gt,onAddSpool:()=>p({spool:null,mode:`create`}),t:n}),d!==null&&(0,G.jsx)(o2e,{isOpen:!0,onClose:()=>p(null),spool:d.spool,mode:d.mode,currencySymbol:St,spoolmanMode:e,spoolsQueryKey:Fe}),h&&(0,G.jsx)(af,{title:h.type===`delete`?n(`common.delete`):h.type===`archive`?n(`inventory.archive`):h.type===`reset-consumed-counter`?n(`inventory.resetConsumedCounter`):n(`inventory.resetAllConsumedCounters`),message:h.type===`delete`?n(`inventory.deleteConfirm`):h.type===`archive`?n(`inventory.archiveConfirm`):h.type===`reset-consumed-counter`?n(`inventory.resetConsumedCounterConfirm`):n(`inventory.resetAllConsumedCountersConfirm`,{count:ft.length}),confirmText:h.type===`delete`?n(`common.delete`):h.type===`archive`?n(`inventory.archive`):n(`inventory.resetConsumedCounter`),variant:h.type===`archive`?`warning`:`danger`,onConfirm:()=>{h.type===`delete`?nt.mutate(h.spoolId):h.type===`archive`?rt.mutate(h.spoolId):h.type===`reset-consumed-counter`?at.mutate(h.spoolId):ot.mutate(ft),g(null)},onCancel:()=>g(null)}),(0,G.jsx)(JW,{isOpen:ue,onClose:()=>de(!1),columns:ce,defaultColumns:T9,onSave:Kt}),(0,G.jsx)(x2e,{isOpen:_!==null,onClose:()=>v(null),availableSpools:Mt,initialSelectedIds:_??[],spoolmanMode:e}),(0,G.jsx)(E2e,{isOpen:ve,selectedCount:ge.size,isPending:ct.isPending,availableLocations:Ve.map(e=>({id:e.id,name:e.name})),availableMaterials:w9((Le??[]).map(e=>e.material)),availableSubtypes:w9((Le??[]).map(e=>e.subtype)),availableBrands:w9((Le??[]).map(e=>e.brand)),availableCategories:w9((Le??[]).map(e=>e.category)),availableMaterialNumbers:w9((Le??[]).map(e=>e.material_number)),availableSlicerFilaments:w9((Le??[]).map(e=>e.slicer_filament)),availableSlicerFilamentNames:w9((Le??[]).map(e=>e.slicer_filament_name)),spoolmanMode:e,onClose:()=>ye(!1),onApply:e=>ct.mutate({ids:[...ge],update:e})}),be&&(0,G.jsx)(af,{title:n(be===`delete`?`inventory.bulk.deleteTitle`:be===`archive`?`inventory.bulk.archiveTitle`:be===`restore`?`inventory.bulk.restoreTitle`:`inventory.bulk.resetUsageTitle`),message:n(be===`delete`?`inventory.bulk.deleteMessage`:be===`archive`?`inventory.bulk.archiveMessage`:be===`restore`?`inventory.bulk.restoreMessage`:`inventory.bulk.resetUsageMessage`,{count:ge.size}),confirmText:n(be===`delete`?`common.delete`:be===`archive`?`inventory.archive`:be===`restore`?`inventory.restore`:`inventory.resetConsumedCounter`),variant:be===`delete`?`danger`:`warning`,isLoading:lt.isPending||ut.isPending||dt.isPending||ot.isPending,onConfirm:()=>{let e=[...ge];be===`delete`?lt.mutate(e):be===`archive`?ut.mutate(e):be===`restore`?dt.mutate(e):ot.mutate(e)},onCancel:()=>xe(null)}),y&&(0,G.jsx)(S2e,{onClose:()=>b(!1),onImported:e=>{b(!1),i.invalidateQueries({queryKey:Fe}),a(n(`inventory.csv.importSuccess`,`{{count}} spools imported`,{count:e}),`success`)}}),(0,G.jsx)(X6,{open:C,onClose:()=>w(!1),onPickLocation:e=>Pt(String(e))}),(0,G.jsx)(C2e,{open:T,onClose:()=>E(!1)})]})}function B2e({pageIndex:e,pageSize:t,totalRows:n,totalPages:r,onPageChange:i,onPageSizeChange:a,t:o}){let s=t===-1;if(r<=1&&!s)return null;let c=s?n||1:t;return(0,G.jsxs)(`div`,{className:`flex items-center justify-between pt-2 text-sm`,children:[(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:s?`${n} ${o(n===1?`inventory.spool`:`inventory.spools`)}`:(0,G.jsxs)(G.Fragment,{children:[o(`inventory.showing`),` `,e*c+1,` `,o(`inventory.to`),` `,Math.min((e+1)*c,n),` `,o(`inventory.of`),` `,n,` `,o(`inventory.spools`)]})}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:o(`inventory.show`)}),(0,G.jsxs)(`select`,{value:t,onChange:e=>a(Number(e.target.value)),className:`px-2 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm focus:outline-none focus:border-bambu-green`,children:[[15,30,50,100].map(e=>(0,G.jsx)(`option`,{value:e,children:e},e)),(0,G.jsx)(`option`,{value:-1,children:o(`inventory.all`)})]}),!s&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`button`,{onClick:()=>i(0),disabled:e===0,className:`p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:(0,G.jsx)(us,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{onClick:()=>i(Math.max(0,e-1)),disabled:e===0,className:`p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:(0,G.jsx)(cs,{className:`w-4 h-4`})}),(0,G.jsxs)(`span`,{className:`text-bambu-gray px-2 whitespace-nowrap`,children:[o(`inventory.page`),` `,e+1,` `,o(`inventory.of`),` `,r]}),(0,G.jsx)(`button`,{onClick:()=>i(Math.min(r-1,e+1)),disabled:e>=r-1,className:`p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:(0,G.jsx)(ss,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{onClick:()=>i(r-1),disabled:e>=r-1,className:`p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:(0,G.jsx)(ds,{className:`w-4 h-4`})})]})]})]})}function V2e({spool:e,remaining:t,pct:n,onClick:r,onPrintLabel:i,onCopy:a,t:o,colorizeLocationSensors:s,locationSensorAboveColor:c,locationSensorBelowColor:l,locationSensorOptimalColor:u}){let d=bm({rgba:e.rgba,extraColors:e.extra_colors,effectType:e.effect_type,subtype:e.subtype,effectSize:`card`});return(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg overflow-hidden border border-bambu-dark-tertiary hover:border-bambu-green transition-colors cursor-pointer ${e.archived_at?`opacity-50`:``}`,onClick:r,children:[(0,G.jsxs)(`div`,{className:`h-14 flex items-center justify-center`,style:d,children:[(0,G.jsx)(`span`,{className:`bg-white/90 text-gray-800 px-3 py-0.5 rounded-full text-sm font-medium`,children:Of(e.color_name,e.rgba,e.color_name_is_synthesized)||`-`}),a&&(0,G.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),a()},className:`p-1.5 bg-black/20 hover:bg-black/40 text-white rounded-full transition-colors`,title:o(`inventory.copySpool`),children:(0,G.jsx)(Ps,{className:`w-3.5 h-3.5`})})]}),(0,G.jsxs)(`div`,{className:`p-4 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`h3`,{className:`font-semibold text-white`,children:[e.material,e.subtype?` ${e.subtype}`:``]}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e.brand||`-`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[i&&(0,G.jsx)(`button`,{onClick:e=>{e.stopPropagation(),i()},className:`p-1 text-bambu-gray hover:text-white rounded transition-colors`,title:o(`inventory.labels.printOne`),"aria-label":o(`inventory.labels.printOne`),children:(0,G.jsx)(Ml,{className:`w-4 h-4`})}),(0,G.jsxs)(`span`,{className:`text-xs font-mono text-bambu-gray bg-bambu-dark-tertiary px-2 py-1 rounded`,children:[`#`,e.id]})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex justify-between text-xs text-bambu-gray mb-1`,children:[(0,G.jsx)(`span`,{children:o(`inventory.remaining`)}),(0,G.jsxs)(`span`,{children:[Math.round(n),`%`]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`flex-1 h-2 bg-bambu-dark-tertiary rounded-full overflow-hidden`,children:(0,G.jsx)(`div`,{className:`h-full rounded-full ${n>50?`bg-bambu-green`:n>20?`bg-yellow-500`:`bg-red-500`}`,style:{width:`${Math.min(n,100)}%`}})}),(0,G.jsxs)(`span`,{className:`text-xs text-bambu-gray min-w-[40px] text-right`,children:[Math.round(t),`g`]})]})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-xs`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`span`,{className:`text-bambu-gray/60`,children:[o(`inventory.labelWeight`),`: `]}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:E9(e.label_weight)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`span`,{className:`text-bambu-gray/60`,children:[o(`inventory.weightUsed`),`: `]}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:e.weight_used>0?E9(e.weight_used):`-`})]})]}),e.location_id&&(0,G.jsx)(W2e,{locationId:e.location_id,locationName:e.storage_location??null,isLast:!e.note,colorize:s,aboveColor:c,belowColor:l,optimalColor:u}),e.note&&(0,G.jsx)(`div`,{className:`text-xs text-bambu-gray/60 pt-3 border-t border-bambu-dark-tertiary truncate`,title:e.note,children:e.note})]})]})}var H2e={temperature:0,humidity:1,battery:2};function U2e(e){return e===`humidity`?`mr-[2px]`:e===`battery`?`mr-[3px]`:``}function j9(e,t){return vE(e,t,{decimals:2})}function M9(e,t,n,r,i){return t&&L6(I6(e),n,r,i)||`text-bambu-gray`}function W2e({locationId:e,locationName:t,isLast:n,colorize:r,aboveColor:i,belowColor:a,optimalColor:o}){let{t:s}=U(),{data:c}=K({queryKey:[`settings`],queryFn:Z.getSettings}),l=(c?.location_sensor_poll_interval||120)*1e3,{data:u}=K({queryKey:[`locationHaSensors`],queryFn:()=>Z.getLocationHASensors()}),d=(u??[]).some(t=>t.location_id===e),{data:f}=K({queryKey:[`locationHaSensorReadings`,e],queryFn:()=>Z.getLocationHASensorReadings(e,!1),refetchInterval:l,enabled:d}),p=f?.filter(e=>e.show_on_card);if(!p?.length)return null;let m=p.find(e=>e.device_class===`battery`),h=p.filter(e=>e.device_class!==`battery`).sort((e,t)=>(H2e[e.device_class??``]??99)-(H2e[t.device_class??``]??99));return(0,G.jsxs)(`div`,{className:`flex items-center gap-2 pt-3 border-t border-bambu-dark-tertiary text-xs text-bambu-gray ${n?`-mb-1`:``}`,children:[t&&(0,G.jsx)(`span`,{className:`truncate`,children:t}),(0,G.jsx)(`span`,{className:`text-bambu-gray/40`,children:`|`}),(0,G.jsx)(`div`,{className:`flex items-center gap-3`,children:h.map((e,t)=>{let n=yE(e),c=t===0?`ml-[-3.6px]`:``;return(0,G.jsxs)(`span`,{title:e.name,className:`flex items-center gap-[3px]`,children:[(0,G.jsx)(n,{className:`w-3 h-3 ${U2e(e.device_class)} ${c}`}),(0,G.jsx)(`span`,{className:M9(e,r,i,a,o),children:j9(e,s)})]},e.id)})}),m&&(()=>{let e=yE(m);return(0,G.jsxs)(`span`,{title:m.name,className:`flex items-center gap-[3px] ml-auto`,children:[(0,G.jsx)(e,{className:`w-3 h-3 ${U2e(m.device_class)}`}),(0,G.jsx)(`span`,{className:M9(m,r,i,a,o),children:j9(m,s)})]},m.id)})()]})}function G2e({spool:e,remaining:t,pct:n,isSelected:r,onToggleSelected:i,onEdit:a,onCopy:o,onRestore:s,onArchive:c,onDelete:l,onPrintLabel:u,onResetConsumedCounter:d,visibleColumns:f,assignmentMap:p,catalogMap:m,locationReadingsMap:h,currencySymbol:g,dateFormat:_,t:v,onSyncWeight:y,colorizeLocationSensors:b,locationSensorAboveColor:x,locationSensorBelowColor:S,locationSensorOptimalColor:C}){return(0,G.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary/50 hover:bg-bambu-dark-tertiary/30 transition-colors cursor-pointer ${e.archived_at?`opacity-50`:``} ${r?`bg-bambu-green/10`:``}`,onClick:a,children:[(0,G.jsx)(`td`,{className:`w-10 px-3 py-3`,onClick:e=>e.stopPropagation(),children:i&&(0,G.jsx)(`input`,{type:`checkbox`,className:`h-4 w-4 cursor-pointer`,"aria-label":v(`inventory.bulk.selectRow`),checked:!!r,onChange:i})}),f.map(r=>(0,G.jsx)(`td`,{className:`py-3 px-4`,children:O9[r]?.({spool:e,remaining:t,pct:n,assignmentMap:p,catalogMap:m,locationReadingsMap:h,currencySymbol:g,dateFormat:_,t:v,onSyncWeight:y,colorizeLocationSensors:b,locationSensorAboveColor:x,locationSensorBelowColor:S,locationSensorOptimalColor:C})},r)),(0,G.jsx)(`td`,{className:`py-3 px-4`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,onClick:e=>e.stopPropagation(),children:[(0,G.jsx)(`button`,{onClick:a,className:`p-1.5 text-bambu-gray hover:text-white rounded transition-colors`,title:v(`common.edit`),children:(0,G.jsx)(Cl,{className:`w-4 h-4`})}),o&&(0,G.jsx)(`button`,{onClick:o,className:`p-1.5 text-bambu-gray hover:text-bambu-green rounded transition-colors`,title:v(`inventory.copySpool`),children:(0,G.jsx)(Ps,{className:`w-4 h-4`})}),u&&(0,G.jsx)(`button`,{onClick:u,className:`p-1.5 text-bambu-gray hover:text-white rounded transition-colors`,title:v(`inventory.labels.printOne`),children:(0,G.jsx)(Ml,{className:`w-4 h-4`})}),d&&e.weight_used>0&&(0,G.jsx)(`button`,{onClick:d,className:`p-1.5 text-bambu-gray hover:text-orange-600 dark:hover:text-orange-400 rounded transition-colors`,title:v(`inventory.resetConsumedCounterTooltip`),children:(0,G.jsx)(Ys,{className:`w-4 h-4`})}),e.archived_at?(0,G.jsx)(`button`,{onClick:s,className:`p-1.5 text-bambu-gray hover:text-bambu-green rounded transition-colors`,title:v(`inventory.restore`),children:(0,G.jsx)(Rl,{className:`w-4 h-4`})}):(0,G.jsx)(`button`,{onClick:c,className:`p-1.5 text-bambu-gray hover:text-yellow-600 dark:hover:text-yellow-400 rounded transition-colors`,title:v(`inventory.archive`),children:(0,G.jsx)(Oo,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{onClick:l,className:`p-1.5 text-bambu-gray hover:text-red-600 dark:hover:text-red-400 rounded transition-colors`,title:v(`common.delete`),children:(0,G.jsx)(ju,{className:`w-4 h-4`})})]})})]})}function K2e({spools:e,headerSpool:t,remaining:n,pct:r,isExpanded:i,onToggle:a,onEdit:o,onCopy:s,onArchive:c,onDelete:l,onPrintLabel:u,onResetConsumedCounter:d,visibleColumns:f,assignmentMap:p,catalogMap:m,locationReadingsMap:h,currencySymbol:g,dateFormat:_,t:v,onSyncWeight:y,colorizeLocationSensors:b,locationSensorAboveColor:x,locationSensorBelowColor:S,locationSensorOptimalColor:C,selectedIds:w,onToggleSelected:T,onToggleGroupSelected:E}){let D=!!w&&e.every(e=>w.has(e.id));return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary/50 hover:bg-bambu-dark-tertiary/30 transition-colors cursor-pointer bg-bambu-green/5`,onClick:a,children:[(0,G.jsx)(`td`,{className:`w-10 px-3 py-3`,onClick:e=>e.stopPropagation(),children:E&&(0,G.jsx)(`input`,{type:`checkbox`,className:`h-4 w-4 cursor-pointer`,"aria-label":v(`inventory.bulk.selectGroup`),checked:D,onChange:t=>E(e.map(e=>e.id),t.target.checked)})}),f.map((a,o)=>(0,G.jsx)(`td`,{className:`py-3 px-4`,children:o===0?(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(as,{className:`w-4 h-4 text-bambu-gray transition-transform ${i?``:`-rotate-90`}`}),O9[a]?.({spool:t,remaining:n,pct:r,assignmentMap:p,catalogMap:m,locationReadingsMap:h,currencySymbol:g,dateFormat:_,t:v,onSyncWeight:y,colorizeLocationSensors:b,locationSensorAboveColor:x,locationSensorBelowColor:S,locationSensorOptimalColor:C})]}):a===`id`?(0,G.jsx)(`span`,{className:`text-xs font-medium bg-bambu-green/20 text-bambu-green px-2 py-0.5 rounded-full`,children:v(`inventory.groupedSpools`,{count:e.length})}):O9[a]?.({spool:t,remaining:n,pct:r,assignmentMap:p,catalogMap:m,locationReadingsMap:h,currencySymbol:g,dateFormat:_,t:v,onSyncWeight:y,colorizeLocationSensors:b,locationSensorAboveColor:x,locationSensorBelowColor:S,locationSensorOptimalColor:C})},a)),(0,G.jsx)(`td`,{className:`py-3 px-4`,children:(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:e.map(e=>`#${e.id}`).join(`, `)})})]}),i&&e.map(e=>{let t=Math.max(0,e.label_weight-e.weight_used);return(0,G.jsx)(G2e,{spool:e,remaining:t,pct:e.label_weight>0?t/e.label_weight*100:0,isSelected:w?.has(e.id),onToggleSelected:T?()=>T(e.id):void 0,onEdit:()=>o(e),onCopy:s?()=>s(e):void 0,onRestore:()=>{},onArchive:()=>c(e.id),onDelete:()=>l(e.id),onPrintLabel:u?()=>u(e.id):void 0,onResetConsumedCounter:d?()=>d(e.id):void 0,visibleColumns:f,assignmentMap:p,catalogMap:m,locationReadingsMap:h,currencySymbol:g,dateFormat:_,t:v,onSyncWeight:y,colorizeLocationSensors:b,locationSensorAboveColor:x,locationSensorBelowColor:S,locationSensorOptimalColor:C},e.id)})]})}function q2e({hasFilters:e,onAddSpool:t,t:n}){return(0,G.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 px-4`,children:[(0,G.jsxs)(`div`,{className:`relative mb-6`,children:[(0,G.jsx)(`div`,{className:`absolute inset-0 -m-4 bg-bambu-green/5 rounded-full blur-2xl`}),(0,G.jsxs)(`div`,{className:`relative flex items-center justify-center w-24 h-24 rounded-2xl bg-gradient-to-br from-bambu-dark-secondary to-bambu-dark-tertiary border border-bambu-dark-tertiary shadow-lg`,children:[(0,G.jsx)(`div`,{className:`absolute -top-1 -right-1 w-3 h-3 rounded-full bg-bambu-green/30`}),(0,G.jsx)(`div`,{className:`absolute -bottom-2 -left-2 w-2 h-2 rounded-full bg-bambu-green/20`}),e?(0,G.jsx)(Kl,{className:`w-10 h-10 text-bambu-gray/40`,strokeWidth:1.5}):(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(`div`,{className:`w-14 h-14 rounded-full border-4 border-bambu-gray/20 flex items-center justify-center`,children:(0,G.jsx)(`div`,{className:`w-6 h-6 rounded-full bg-bambu-gray/10 border-2 border-bambu-gray/20`})}),(0,G.jsx)(`div`,{className:`absolute -bottom-1 -right-1 w-6 h-6 rounded-full bg-bambu-green flex items-center justify-center shadow-md`,children:(0,G.jsx)(`span`,{className:`text-white text-lg font-bold leading-none`,children:`+`})})]})]})]}),(0,G.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-2 text-center`,children:e?n(`inventory.noSpoolsMatch`):n(`inventory.noSpools`).split(`.`)[0]}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray text-center max-w-sm mb-6`,children:n(e?`inventory.noSpoolsMatchDesc`:`inventory.noSpools`)}),!e&&(0,G.jsxs)(Q,{onClick:t,children:[(0,G.jsx)(_l,{className:`w-4 h-4`}),n(`inventory.addSpool`)]})]})}function N9(e,t){let n=e?.[t];return typeof n==`string`?n:``}function J2e(e){return e.replace(/(https?:\/\/(?:makerworld|public-cdn)\.bblmw\.com\/[^\s"']+)/gi,e=>`/api/v1/makerworld/thumbnail?url=${encodeURIComponent(e)}`)}function P9(e){return e?/^https?:\/\/(makerworld|public-cdn)\.bblmw\.com\//i.test(e)?`/api/v1/makerworld/thumbnail?url=${encodeURIComponent(e)}`:e:``}function F9(e,t){let n=e?.[t];return typeof n==`number`?n:null}function Y2e(e,t){let n=e?.[t];return n&&typeof n==`object`&&!Array.isArray(n)?n:void 0}function X2e(e,t=0,n=[]){n.push({folder:e,depth:t});for(let r of e.children??[])X2e(r,t+1,n);return n}function Z2e(e,t){return t(e<1?`makerworld.phaseResolving`:`makerworld.phaseDownloading`)}function Q2e(e){let[t,n]=(0,f.useState)(0);return(0,f.useEffect)(()=>{if(!e){n(0);return}let t=Date.now(),r=()=>n(Math.floor((Date.now()-t)/1e3));r();let i=window.setInterval(r,1e3);return()=>window.clearInterval(i)},[e]),t}function $2e(){let{t:e}=U(),{hasPermission:t}=Nd(),{showToast:n}=qd(),r=no(),i=t(`makerworld:import`),[a,o]=(0,f.useState)(``),[s,c]=(0,f.useState)(null),[l,u]=(0,f.useState)(null),[d,p]=(0,f.useState)(null),[m,h]=(0,f.useState)(null),[g,_]=(0,f.useState)(null),[v,y]=(0,f.useState)(``),[b,x]=(0,f.useState)({}),S=K({queryKey:[`makerworld-status`],queryFn:()=>Z.getMakerworldStatus()}),C=K({queryKey:[`library-folders`],queryFn:()=>Z.getLibraryFolders()}),w=K({queryKey:[`makerworld-recent-imports`],queryFn:()=>Z.getMakerworldRecentImports(10)}),T=K({queryKey:[`settings`],queryFn:()=>Z.getSettings()}),E=T.data?.use_slicer_api??!1,D=T.data?.preferred_slicer||`bambu_studio`,O=VW(T.data?.open_in_slicer,T.data?.preferred_slicer),k=E?D:O,A=k===`orcaslicer`?`OrcaSlicer`:`Bambu Studio`,[j,M]=(0,f.useState)(null),N=(e,t)=>{M({kind:`libraryFile`,id:e,filename:t})},P=q({mutationFn:e=>Z.resolveMakerworldUrl(e),onSuccess:(e,t)=>{c(e),y(t),x({})},onError:t=>n(t.message||e(`makerworld.errors.resolveFailed`),`error`)});(0,f.useEffect)(()=>{s!==null&&a.trim()!==v.trim()&&(c(null),y(``),x({}))},[a,s,v]);let F=q({mutationFn:({instanceId:e,profileId:t})=>Z.importMakerworldInstance(s?.model_id??0,e,t,l),onSuccess:t=>{r.invalidateQueries({queryKey:[`library-files`]}),r.invalidateQueries({queryKey:[`library-folders`]}),t.profile_id&&x(e=>({...e,[t.profile_id]:t})),n(t.was_existing?e(`makerworld.alreadyInLibrary`):e(`makerworld.importSuccess`,{filename:t.filename}),`success`)},onError:t=>n(t.message||e(`makerworld.errors.downloadFailed`),`error`)}),I=q({mutationFn:({libraryFileId:e})=>Z.deleteLibraryFile(e),onSuccess:(t,{profileId:i})=>{r.invalidateQueries({queryKey:[`library-files`]}),r.invalidateQueries({queryKey:[`library-folders`]}),r.invalidateQueries({queryKey:[`makerworld-recent-imports`]}),x(e=>{let t={...e};return delete t[i],t}),h(null),n(e(`makerworld.importDeleted`),`success`)},onError:t=>{h(null),n(t.message||e(`makerworld.errors.deleteFailed`),`error`)}}),L=q({mutationFn:({instanceId:e,profileId:t})=>Z.importMakerworldInstance(s?.model_id??0,e,t,l),onSuccess:async e=>{r.invalidateQueries({queryKey:[`library-files`]}),r.invalidateQueries({queryKey:[`library-folders`]}),r.invalidateQueries({queryKey:[`makerworld-recent-imports`]}),e.profile_id&&x(t=>({...t,[e.profile_id]:e})),E?N(e.library_file_id,e.filename):await te(e.library_file_id,e.filename,k)},onError:t=>n(t.message||e(`makerworld.errors.downloadFailed`),`error`)}),R=Q2e(F.isPending||L.isPending),z=Z2e(R,e),B=e=>{e?.preventDefault();let t=a.trim();t&&P.mutate(t)};(0,f.useEffect)(()=>{if(!g)return;let e=e=>{e.key===`Escape`?_(null):e.key===`ArrowLeft`?_(e=>e&&e.index>0?{...e,index:e.index-1}:e):e.key===`ArrowRight`&&_(e=>e&&e.indexwindow.removeEventListener(`keydown`,e)},[g]);let V=e=>{let t=(Array.isArray(e.pictures)?e.pictures:[]).filter(e=>typeof e==`object`&&!!e).map(e=>({name:N9(e,`name`)||`image`,url:N9(e,`url`)})).filter(e=>e.url);if(t.length>0)return t;let n=N9(e,`cover`);return n?[{name:`cover`,url:n}]:[]},ee=async()=>{if(!s)return;let e=s.instances.filter(e=>{let t=F9(e,`profileId`);return t!==null&&!b[t]});if(e.length!==0){p({current:0,total:e.length});try{for(let t=0;t{try{let{token:r}=await Z.createLibrarySlicerToken(e),i=Z.getLibrarySlicerDownloadUrl(e,r,t);GW(`${window.location.origin}${i}`,n)}catch{let t=Z.getLibraryFileDownloadUrl(e);GW(`${window.location.origin}${t}`,n)}},ne=s?.design,re=Y2e(ne,`designCreator`),ie=s?.instances??[],ae=(s?.already_imported_library_ids.length??0)>0,oe=S.data?.can_download??!1,se=S.data?.sign_in_expired??!1,H=(0,f.useMemo)(()=>N9(ne,`coverUrl`),[ne]),ce=N9(ne,`title`),le=N9(ne,`summary`),ue=N9(ne,`license`),de=F9(ne,`downloadCount`);return(0,G.jsxs)(`div`,{className:`p-4 md:p-8 max-w-screen-2xl space-y-6`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`h1`,{className:`text-2xl font-bold text-white flex items-center gap-3`,children:[(0,G.jsx)(Cc,{className:`w-7 h-7 text-bambu-green`}),e(`makerworld.title`)]}),(0,G.jsx)(`p`,{className:`text-bambu-gray mt-1`,children:e(`makerworld.description`)})]}),(0,G.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-[1fr_20rem]`,children:[(0,G.jsxs)(`div`,{className:`space-y-6 min-w-0`,children:[!oe&&(0,G.jsx)(zd,{className:`border-amber-300 dark:border-amber-700 bg-amber-50 dark:bg-amber-900/20`,children:(0,G.jsx)(Vd,{children:(0,G.jsxs)(`div`,{className:`flex items-start gap-3 py-2`,children:[(0,G.jsx)(fs,{className:`w-5 h-5 text-amber-600 dark:text-amber-400 mt-0.5 shrink-0`}),(0,G.jsxs)(`div`,{className:`text-sm`,children:[(0,G.jsx)(`p`,{className:`font-medium text-amber-900 dark:text-amber-100`,children:e(se?`makerworld.signInExpiredTitle`:`makerworld.signInRequiredTitle`)}),(0,G.jsxs)(`p`,{className:`text-amber-800 dark:text-amber-200 mt-1`,children:[e(se?`makerworld.signInExpiredBody`:`makerworld.signInRequiredBody`),` `,(0,G.jsx)(Ci,{to:`/profiles`,className:`underline`,children:e(`makerworld.openCloudSettings`)})]})]})]})})}),(0,G.jsxs)(zd,{children:[(0,G.jsx)(Bd,{children:(0,G.jsx)(`h2`,{className:`text-lg font-semibold`,children:e(`makerworld.pasteUrlHeader`)})}),(0,G.jsx)(Vd,{children:(0,G.jsxs)(`form`,{onSubmit:B,className:`flex gap-2`,children:[(0,G.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),placeholder:e(`makerworld.pasteUrlPlaceholder`),className:`flex-1 min-w-0 px-3 py-2 border rounded bg-white dark:bg-gray-800 border-gray-300 dark:border-gray-700`,autoComplete:`off`}),(0,G.jsxs)(Q,{type:`submit`,variant:`primary`,disabled:!a.trim()||P.isPending,children:[P.isPending?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(No,{className:`w-4 h-4`}),(0,G.jsx)(`span`,{className:`ml-2`,children:e(`makerworld.resolveButton`)})]})]})})]}),s&&(0,G.jsx)(zd,{children:(0,G.jsx)(Vd,{children:(0,G.jsxs)(`div`,{className:`flex gap-4 py-2`,children:[H&&(0,G.jsx)(`img`,{src:P9(H),alt:ce,className:`w-32 h-32 object-cover rounded`,loading:`lazy`}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`h3`,{className:`text-xl font-semibold truncate`,children:ce||e(`makerworld.untitledModel`)}),re&&(0,G.jsx)(`p`,{className:`text-sm text-gray-600 dark:text-gray-400 mt-1`,children:e(`makerworld.byCreator`,{name:N9(re,`name`)})}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-3 mt-2 text-xs text-gray-500 dark:text-gray-400`,children:[de!==null&&(0,G.jsx)(`span`,{children:e(`makerworld.downloadsCount`,{count:de})}),ue&&(0,G.jsxs)(`span`,{children:[e(`makerworld.licensePrefix`),`: `,ue]}),ae&&(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-emerald-600 dark:text-emerald-400`,children:[(0,G.jsx)(is,{className:`w-3 h-3`}),` `,e(`makerworld.alreadyImported`)]})]}),le&&(0,G.jsx)(`div`,{className:`mt-3 text-sm prose prose-sm max-w-none dark:prose-invert line-clamp-3`,dangerouslySetInnerHTML:{__html:VG.sanitize(J2e(le))}}),s&&(0,G.jsxs)(`a`,{href:`https://makerworld.com/models/${s.model_id}${s.profile_id?`#profileId-${s.profile_id}`:``}`,target:`_blank`,rel:`noopener noreferrer`,className:`mt-3 inline-flex items-center gap-1 text-xs text-brand-500 hover:underline`,children:[(0,G.jsx)(Xs,{className:`w-3 h-3`}),` `,e(`makerworld.openOnMakerworld`)]})]})]})})}),s&&ie.length>0&&(0,G.jsxs)(zd,{children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsx)(`h2`,{className:`text-lg font-semibold`,children:e(`makerworld.platesHeader`,{count:ie.length})}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`label`,{className:`text-xs text-gray-600 dark:text-gray-400`,children:e(`makerworld.importTo`)}),(0,G.jsxs)(`select`,{value:l??``,onChange:e=>u(e.target.value?Number(e.target.value):null),className:`text-sm px-2 py-1 border rounded bg-white dark:bg-gray-800 border-gray-300 dark:border-gray-700`,disabled:d!==null,children:[(0,G.jsx)(`option`,{value:``,children:e(`makerworld.folderAuto`)}),(C.data??[]).filter(e=>!(e.is_external&&e.external_readonly)).flatMap(e=>X2e(e)).map(({folder:e,depth:t})=>(0,G.jsx)(`option`,{value:e.id,children:`${`— `.repeat(t)}${e.name}`},e.id))]}),(0,G.jsx)(Q,{variant:`primary`,size:`sm`,disabled:!i||!oe||d!==null||F.isPending||L.isPending,onClick:ee,children:d===null?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Us,{className:`w-4 h-4`}),(0,G.jsx)(`span`,{className:`ml-2`,children:e(`makerworld.importAll`)})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),(0,G.jsxs)(`span`,{className:`ml-2`,children:[e(`makerworld.importAllProgress`,{current:d.current,total:d.total}),R>0&&` · ${z} · ${R}s`]})]})})]})]})}),(0,G.jsx)(Vd,{children:(0,G.jsx)(`div`,{className:`grid gap-3`,children:ie.map((t,n)=>{let r=F9(t,`id`),a=F9(t,`profileId`),o=N9(t,`title`),s=N9(t,`cover`),c=F9(t,`materialCnt`),l=t?.needAms===!0,u=F9(t,`downloadCount`),f=t?.compatibility??null,p=t?.otherCompatibility??null,m=f?.devProductName??null,g=Array.isArray(p)?p.map(e=>e?.devProductName??``).filter(Boolean):[];if(r==null)return null;let v=F.isPending&&F.variables?.instanceId===r,y=L.isPending&&L.variables?.instanceId===r,x=a===null?void 0:b[a];return(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 p-3 border rounded border-gray-200 dark:border-gray-700`,children:[(0,G.jsxs)(`div`,{className:`flex gap-3 items-center`,children:[(()=>{let n=V(t),r=n.length>0;return(0,G.jsxs)(`button`,{type:`button`,disabled:!r,onClick:()=>r&&_({images:n,index:0}),className:`relative w-16 h-16 shrink-0 rounded overflow-hidden group`,"aria-label":e(`makerworld.openGallery`),children:[s?(0,G.jsx)(`img`,{src:P9(s),alt:``,className:`w-16 h-16 object-cover`,loading:`lazy`}):(0,G.jsx)(`div`,{className:`w-16 h-16 bg-gray-100 dark:bg-gray-800`}),n.length>1&&(0,G.jsxs)(`span`,{className:`absolute bottom-0.5 right-0.5 bg-black/70 text-white text-[10px] px-1.5 py-0.5 rounded flex items-center gap-1`,children:[(0,G.jsx)(Lc,{className:`w-2.5 h-2.5`}),n.length]})]})})(),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`p`,{className:`font-medium truncate`,children:o||e(`makerworld.plateDefaultName`,{n:n+1})}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-3 text-xs text-gray-500 dark:text-gray-400 mt-1`,children:[m&&(0,G.jsx)(`span`,{className:`font-medium text-gray-700 dark:text-gray-300`,children:e(`makerworld.slicedFor`,{printer:m,defaultValue:`Sliced for {{printer}}`})}),c!==null&&(0,G.jsx)(`span`,{children:e(`makerworld.materialCount`,{count:c})}),l&&(0,G.jsx)(`span`,{children:e(`makerworld.amsRequired`)}),u!==null&&(0,G.jsx)(`span`,{children:e(`makerworld.downloadsCount`,{count:u})})]}),g.length>0&&(0,G.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 mt-1`,title:g.join(`, `),children:e(`makerworld.alsoCompatible`,{printers:g.slice(0,6).join(`, `)+(g.length>6?`…`:``),defaultValue:`Also marked compatible: {{printers}}`})})]}),(0,G.jsxs)(`div`,{className:`flex gap-2 shrink-0`,children:[(0,G.jsx)(Q,{variant:`ghost`,size:`sm`,disabled:!i||!oe||v||y||d!==null,onClick:()=>F.mutate({instanceId:r,profileId:a}),title:oe?void 0:e(`makerworld.signInRequiredTitle`),children:v?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),(0,G.jsxs)(`span`,{className:`ml-2`,children:[z,R>0&&` · ${R}s`]})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Us,{className:`w-4 h-4`}),(0,G.jsx)(`span`,{className:`ml-2`,children:e(`makerworld.importToLibrary`)})]})}),(0,G.jsx)(Q,{variant:`primary`,size:`sm`,disabled:!i||!oe||v||y||d!==null,onClick:()=>L.mutate({instanceId:r,profileId:a}),title:oe?void 0:e(`makerworld.signInRequiredTitle`),children:y?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),(0,G.jsxs)(`span`,{className:`ml-2`,children:[z,R>0&&` · ${R}s`]})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Xs,{className:`w-4 h-4`}),(0,G.jsx)(`span`,{className:`ml-2`,children:e(`makerworld.sliceIn`,{slicer:A})})]})})]})]}),x&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 pl-20 text-xs`,children:[(0,G.jsx)(is,{className:`w-3.5 h-3.5 text-emerald-600 dark:text-emerald-400 shrink-0`}),(0,G.jsx)(`span`,{className:`text-emerald-700 dark:text-emerald-300`,children:x.was_existing?e(`makerworld.lastImportAlreadyInLibrary`):e(`makerworld.lastImportSuccess`)}),(0,G.jsxs)(Q,{variant:`ghost`,size:`sm`,onClick:()=>{let e=x.folder_id?`/files?folder=${x.folder_id}`:`/files`;window.location.assign(e)},children:[(0,G.jsx)(dc,{className:`w-3.5 h-3.5`}),(0,G.jsx)(`span`,{className:`ml-1.5`,children:e(`makerworld.viewInLibrary`)})]}),E?(0,G.jsxs)(Q,{variant:`ghost`,size:`sm`,onClick:()=>N(x.library_file_id,x.filename),children:[(0,G.jsx)(js,{className:`w-3.5 h-3.5`}),(0,G.jsx)(`span`,{className:`ml-1.5`,children:e(`slice.action`,`Slice`)})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Q,{variant:`ghost`,size:`sm`,onClick:()=>te(x.library_file_id,x.filename,`bambu_studio`),children:[(0,G.jsx)(Xs,{className:`w-3.5 h-3.5`}),(0,G.jsx)(`span`,{className:`ml-1.5`,children:e(`makerworld.openInBambuStudio`)})]}),(0,G.jsxs)(Q,{variant:`ghost`,size:`sm`,onClick:()=>te(x.library_file_id,x.filename,`orcaslicer`),children:[(0,G.jsx)(Xs,{className:`w-3.5 h-3.5`}),(0,G.jsx)(`span`,{className:`ml-1.5`,children:e(`makerworld.openInOrcaSlicer`)})]})]}),(0,G.jsx)(`div`,{className:`ml-auto`,children:(0,G.jsx)(Q,{variant:`ghost`,size:`sm`,disabled:I.isPending&&I.variables?.profileId===a,onClick:()=>{a!==null&&h({libraryFileId:x.library_file_id,profileId:a,filename:x.filename})},title:e(`makerworld.deleteImport`),children:I.isPending&&I.variables?.profileId===a?(0,G.jsx)(Y,{className:`w-3.5 h-3.5 animate-spin`}):(0,G.jsx)(ju,{className:`w-3.5 h-3.5 text-red-500`})})})]})]},r)})})})]})]}),(0,G.jsx)(`aside`,{className:`lg:sticky lg:top-6 lg:self-start min-w-0`,children:w.data&&w.data.length>0&&(0,G.jsxs)(zd,{children:[(0,G.jsx)(Bd,{children:(0,G.jsx)(`h2`,{className:`text-base font-semibold`,children:e(`makerworld.recentImportsHeader`)})}),(0,G.jsx)(Vd,{children:(0,G.jsx)(`div`,{className:`flex flex-col gap-2 max-h-[28rem] overflow-y-auto -mx-2 px-2`,children:w.data.map(t=>(0,G.jsxs)(`div`,{className:`flex gap-2 p-2 border rounded border-gray-200 dark:border-gray-700`,children:[t.thumbnail_path?(0,G.jsx)(`img`,{src:Z.getLibraryFileThumbnailUrl(t.library_file_id),alt:``,className:`w-12 h-12 shrink-0 object-cover rounded bg-gray-100 dark:bg-gray-800`,loading:`lazy`}):(0,G.jsx)(`div`,{className:`w-12 h-12 shrink-0 rounded bg-gray-100 dark:bg-gray-800`}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0 flex flex-col gap-1`,children:[(0,G.jsx)(`p`,{className:`text-xs font-medium truncate`,title:t.filename,children:t.filename}),(0,G.jsxs)(`div`,{className:`flex gap-0.5`,children:[(0,G.jsx)(Q,{variant:`ghost`,size:`sm`,onClick:()=>{let e=t.folder_id?`/files?folder=${t.folder_id}`:`/files`;window.location.assign(e)},title:e(`makerworld.viewInLibrary`),children:(0,G.jsx)(dc,{className:`w-3.5 h-3.5`})}),E?(0,G.jsx)(Q,{variant:`ghost`,size:`sm`,onClick:()=>N(t.library_file_id,t.filename),title:e(`slice.action`,`Slice`),children:(0,G.jsx)(js,{className:`w-3.5 h-3.5`})}):(0,G.jsx)(Q,{variant:`ghost`,size:`sm`,onClick:()=>te(t.library_file_id,t.filename,`bambu_studio`),title:e(`makerworld.openInBambuStudio`),children:(0,G.jsx)(Xs,{className:`w-3.5 h-3.5`})}),t.source_url&&(0,G.jsx)(`a`,{href:t.source_url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center justify-center h-7 w-7 rounded text-gray-500 hover:text-gray-700 dark:hover:text-gray-300`,title:e(`makerworld.openOnMakerworld`),children:(0,G.jsx)(Cc,{className:`w-3.5 h-3.5`})})]})]})]},t.library_file_id))})})]})})]}),(0,G.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 pt-4 border-t border-gray-200 dark:border-gray-700`,children:e(`makerworld.disclaimer`)}),m&&(0,G.jsx)(af,{title:e(`makerworld.deleteImport`),message:e(`makerworld.confirmDelete`,{filename:m.filename}),confirmText:e(`makerworld.deleteImport`),variant:`danger`,isLoading:I.isPending,loadingText:e(`makerworld.importDeleting`),onCancel:()=>h(null),onConfirm:()=>I.mutate({libraryFileId:m.libraryFileId,profileId:m.profileId})}),j&&(0,G.jsx)(LW,{source:j,onClose:()=>M(null)}),g&&(0,G.jsxs)(`div`,{className:`fixed inset-0 bg-black/90 flex items-center justify-center z-50`,onClick:()=>_(null),role:`dialog`,"aria-modal":`true`,children:[(0,G.jsx)(`button`,{type:`button`,className:`absolute top-4 right-4 p-2 bg-white/10 hover:bg-white/20 rounded-full text-white`,onClick:e=>{e.stopPropagation(),_(null)},"aria-label":e(`common.close`,`Close`),children:(0,G.jsx)($u,{className:`w-5 h-5`})}),g.images.length>1&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`button`,{type:`button`,className:`absolute left-4 p-2 bg-white/10 hover:bg-white/20 rounded-full text-white disabled:opacity-30`,disabled:g.index===0,onClick:e=>{e.stopPropagation(),_(e=>e&&{...e,index:Math.max(0,e.index-1)})},"aria-label":e(`makerworld.galleryPrev`),children:(0,G.jsx)(cs,{className:`w-6 h-6`})}),(0,G.jsx)(`button`,{type:`button`,className:`absolute right-4 p-2 bg-white/10 hover:bg-white/20 rounded-full text-white disabled:opacity-30`,disabled:g.index>=g.images.length-1,onClick:e=>{e.stopPropagation(),_(e=>e&&{...e,index:Math.min(e.images.length-1,e.index+1)})},"aria-label":e(`makerworld.galleryNext`),children:(0,G.jsx)(ss,{className:`w-6 h-6`})})]}),(0,G.jsx)(`img`,{src:P9(g.images[g.index].url),alt:g.images[g.index].name,className:`max-w-[90vw] max-h-[90vh] object-contain`,onClick:e=>e.stopPropagation()}),g.images.length>1&&(0,G.jsxs)(`div`,{className:`absolute bottom-6 left-1/2 -translate-x-1/2 text-white bg-black/60 px-3 py-1 rounded text-xs`,children:[g.index+1,` / `,g.images.length]})]})]})}var e4e=[`DEBUG`,`INFO`,`WARNING`,`ERROR`],I9={DEBUG:`text-gray-400`,INFO:`text-blue-400`,WARNING:`text-yellow-400`,ERROR:`text-red-400`},t4e={DEBUG:qo,INFO:Rc,WARNING:Pu,ERROR:fs};function n4e(){let e=no(),[t,n]=(0,f.useState)(!0),[r,i]=(0,f.useState)(new Set),[a,o]=(0,f.useState)(``),[s,c]=(0,f.useState)(`ALL`),[l,u]=(0,f.useState)(!1),[d,p]=(0,f.useState)(!1),m=(0,f.useRef)(null),{data:h,isLoading:g,refetch:_}=K({queryKey:[`application-logs`,s,a],queryFn:()=>Dd.getLogs({limit:200,level:s===`ALL`?void 0:s,search:a||void 0}),refetchInterval:d?2e3:!1,enabled:l});(0,f.useEffect)(()=>{l||p(!1)},[l]);let v=q({mutationFn:()=>Dd.clearLogs(),onSuccess:()=>{e.invalidateQueries({queryKey:[`application-logs`]})}});(0,f.useEffect)(()=>{t&&m.current&&h?.entries&&(m.current.scrollTop=m.current.scrollHeight)},[h?.entries,t]);let y=e=>{i(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},b=e=>{let t=e.split(` `);return t.length>=2?t[1]:e},x=(0,f.useMemo)(()=>h?.entries??[],[h?.entries]),S=(0,f.useMemo)(()=>[...x].reverse(),[x]),C=({level:e})=>(0,G.jsx)(t4e[e]||Rc,{className:`w-3.5 h-3.5 ${I9[e]||`text-gray-400`}`});return(0,G.jsxs)(`div`,{className:`bg-bambu-dark rounded-lg overflow-hidden`,children:[(0,G.jsxs)(`button`,{onClick:()=>u(!l),className:`w-full flex items-center justify-between p-4 hover:bg-bambu-dark-tertiary/50 transition-colors`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`p-2 rounded-lg ${d?`bg-bambu-green/20 text-bambu-green`:`bg-bambu-dark-tertiary text-bambu-gray`}`,children:(0,G.jsx)(qo,{className:`w-5 h-5`})}),(0,G.jsxs)(`div`,{className:`text-left`,children:[(0,G.jsx)(`p`,{className:`font-medium text-white`,children:`Application Logs`}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:d?`Live streaming - ${h?.filtered_count??0} entries`:`View and filter application logs`})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[d&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5 px-2 py-1 bg-bambu-green/20 rounded text-bambu-green text-xs`,children:[(0,G.jsx)(`span`,{className:`w-1.5 h-1.5 bg-bambu-green rounded-full animate-pulse`}),`Live`]}),l?(0,G.jsx)(ls,{className:`w-5 h-5 text-bambu-gray`}):(0,G.jsx)(as,{className:`w-5 h-5 text-bambu-gray`})]})]}),l&&(0,G.jsxs)(`div`,{className:`border-t border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 p-4 border-b border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[d?(0,G.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),p(!1)},className:`flex items-center gap-1.5 px-3 py-1.5 text-sm bg-red-100 dark:bg-red-500/20 text-red-700 dark:text-red-400 hover:bg-red-200 dark:hover:bg-red-500/30 rounded transition-colors`,children:[(0,G.jsx)(mu,{className:`w-4 h-4`}),`Stop`]}):(0,G.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),p(!0),_()},className:`flex items-center gap-1.5 px-3 py-1.5 text-sm bg-bambu-green/20 text-bambu-green hover:bg-bambu-green/30 rounded transition-colors`,children:[(0,G.jsx)(Dl,{className:`w-4 h-4`}),`Start`]}),(0,G.jsxs)(`button`,{onClick:()=>v.mutate(),disabled:v.isPending||x.length===0,className:`flex items-center gap-1.5 px-3 py-1.5 text-sm bg-bambu-dark-tertiary text-bambu-gray hover:text-white hover:bg-bambu-dark-secondary rounded transition-colors disabled:opacity-50`,children:[(0,G.jsx)(ju,{className:`w-4 h-4`}),`Clear`]}),(0,G.jsx)(`button`,{onClick:()=>_(),disabled:g,className:`flex items-center gap-1.5 px-3 py-1.5 text-sm bg-bambu-dark-tertiary text-bambu-gray hover:text-white hover:bg-bambu-dark-secondary rounded transition-colors disabled:opacity-50`,children:(0,G.jsx)(Il,{className:`w-4 h-4 ${g?`animate-spin`:``}`})}),(0,G.jsx)(`div`,{className:`flex-1`}),(0,G.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-bambu-gray cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:t,onChange:e=>n(e.target.checked),className:`rounded border-bambu-dark-tertiary bg-bambu-dark-tertiary`}),`Auto-scroll`]}),(0,G.jsxs)(`span`,{className:`text-sm text-bambu-gray`,children:[h?.filtered_count??0,`/`,h?.total_in_file??0]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`div`,{className:`relative flex-1`,children:[(0,G.jsx)(Kl,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray`}),(0,G.jsx)(`input`,{type:`text`,placeholder:`Search message or logger name...`,value:a,onChange:e=>o(e.target.value),className:`w-full pl-8 pr-8 py-1.5 text-sm bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none`}),a&&(0,G.jsx)(`button`,{onClick:()=>o(``),className:`absolute right-2 top-1/2 -translate-y-1/2 text-bambu-gray hover:text-white`,children:(0,G.jsx)($u,{className:`w-4 h-4`})})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1 bg-bambu-dark-secondary rounded border border-bambu-dark-tertiary`,children:[(0,G.jsx)(`button`,{onClick:()=>c(`ALL`),className:`px-2 py-1.5 text-xs rounded-l transition-colors ${s===`ALL`?`bg-bambu-green text-white`:`text-bambu-gray hover:text-white`}`,children:`All`}),e4e.map((e,t)=>(0,G.jsx)(`button`,{onClick:()=>c(e),className:`px-2 py-1.5 text-xs transition-colors flex items-center gap-1 ${t===e4e.length-1?`rounded-r`:``} ${s===e?`${I9[e]} bg-bambu-dark-tertiary`:`text-bambu-gray hover:text-white`}`,children:e},e))]})]})]}),(0,G.jsx)(`div`,{ref:m,className:`overflow-auto font-mono text-xs bg-black min-h-[300px] max-h-[500px]`,children:x.length===0?(0,G.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-[300px] text-bambu-gray`,children:[(0,G.jsx)(`p`,{className:`mb-2`,children:`No log entries found`}),(0,G.jsx)(`p`,{className:`text-sm`,children:`Log file may be empty or cleared`})]}):(0,G.jsx)(`div`,{className:`divide-y divide-bambu-dark-tertiary/30`,children:S.map((e,t)=>{let n=r.has(t),i=e.message.includes(` `);return(0,G.jsx)(`div`,{className:`p-2 cursor-pointer hover:bg-bambu-dark-secondary/50 transition-colors ${n?`bg-bambu-dark-secondary/30`:``}`,onClick:()=>i&&y(t),children:(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(`span`,{className:`text-bambu-gray/70 shrink-0 w-20`,children:b(e.timestamp)}),(0,G.jsx)(`span`,{className:`shrink-0`,children:(0,G.jsx)(C,{level:e.level})}),(0,G.jsxs)(`span`,{className:`text-purple-400/80 shrink-0 max-w-[200px] truncate`,title:e.logger_name,children:[`[`,e.logger_name,`]`]}),(0,G.jsx)(`span`,{className:`flex-1 ${I9[e.level]||`text-white/80`} ${!n&&i?`truncate`:``}`,children:n?(0,G.jsx)(`pre`,{className:`whitespace-pre-wrap break-all`,children:e.message}):e.message.split(` `)[0]}),i&&(0,G.jsx)(`span`,{className:`text-bambu-gray/50 shrink-0`,children:n?(0,G.jsx)(ls,{className:`w-3.5 h-3.5`}):(0,G.jsx)(as,{className:`w-3.5 h-3.5`})})]})},t)})})}),(0,G.jsx)(`div`,{className:`flex items-center justify-between p-3 border-t border-bambu-dark-tertiary text-sm text-bambu-gray`,children:d?(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`w-2 h-2 bg-green-500 rounded-full animate-pulse`}),`Auto-refreshing every 2 seconds`]}):(0,G.jsx)(`span`,{children:`Click Start to enable live log streaming`})})]})]})}function r4e(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(2)} GB`}function L9({icon:e,label:t,value:n,subValue:r,color:i=`text-bambu-green`}){return(0,G.jsxs)(`div`,{className:`flex items-start gap-3 p-4 bg-bambu-dark rounded-lg`,children:[(0,G.jsx)(`div`,{className:`p-2 rounded-lg bg-bambu-dark-tertiary ${i}`,children:(0,G.jsx)(e,{className:`w-5 h-5`})}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:t}),(0,G.jsx)(`p`,{className:`text-lg font-semibold text-white truncate`,children:n}),r&&(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-0.5`,children:r})]})]})}function i4e({percent:e,color:t=`bg-bambu-green`}){return(0,G.jsx)(`div`,{className:`w-full h-2 bg-bambu-dark rounded-full overflow-hidden`,children:(0,G.jsx)(`div`,{className:`h-full ${t} transition-all duration-300`,style:{width:`${Math.min(100,e)}%`}})})}function R9({title:e,icon:t,children:n}){return(0,G.jsxs)(zd,{className:`p-6`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-4`,children:[(0,G.jsx)(t,{className:`w-5 h-5 text-bambu-green`}),(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:e})]}),n]})}function a4e(){let{t:e}=U(),t=no(),[n,r]=(0,f.useState)(null),[i,a]=(0,f.useState)(!1),[o,s]=(0,f.useState)(!1),[c,l]=(0,f.useState)(null),{data:u,isLoading:d,refetch:p,isFetching:m}=K({queryKey:[`systemInfo`],queryFn:Z.getSystemInfo,refetchInterval:3e4}),{data:h}=K({queryKey:[`debugLogging`],queryFn:Dd.getDebugLoggingState,staleTime:10*1e3,refetchInterval:10*1e3}),{data:g}=K({queryKey:[`settings`],queryFn:Z.getSettings}),{data:_}=K({queryKey:[`library-stats`],queryFn:Z.getLibraryStats}),{data:v}=K({queryKey:[`printers`],queryFn:Z.getPrinters}),{data:y,refetch:b,isFetching:x}=K({queryKey:[`systemHealth`],queryFn:Z.getSystemHealth,staleTime:60*1e3}),S=g?.time_format||`system`,C=async()=>{s(!0);try{let e=await Dd.setDebugLogging(!h?.enabled);t.setQueryData([`debugLogging`],e)}catch(e){console.error(`Failed to toggle debug logging:`,e)}finally{s(!1)}},w=async()=>{r(null),a(!0);try{await Dd.downloadSupportBundle()}catch(e){r(e instanceof Error?e.message:`Failed to download support bundle`)}finally{a(!1)}};if(d)return(0,G.jsx)(`div`,{className:`flex items-center justify-center h-64`,children:(0,G.jsx)(Y,{className:`w-8 h-8 text-bambu-green animate-spin`})});if(!u)return(0,G.jsx)(`div`,{className:`p-6 text-center text-bambu-gray`,children:e(`system.failedToLoad`,`Failed to load system information`)});let T=u.storage.disk_percent_used>90?`bg-red-500`:u.storage.disk_percent_used>75?`bg-yellow-500`:`bg-bambu-green`,E=u.memory.percent_used>90?`bg-red-500`:u.memory.percent_used>75?`bg-yellow-500`:`bg-bambu-green`;return(0,G.jsxs)(`div`,{className:`p-6 space-y-6`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col items-start gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`text-2xl font-bold text-white`,children:e(`system.title`,`System Information`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray mt-1`,children:e(`system.subtitle`,`Monitor system resources and database statistics`)})]}),(0,G.jsxs)(`button`,{onClick:()=>p(),disabled:m,className:`flex items-center gap-2 px-4 py-2 bg-bambu-dark-secondary hover:bg-bambu-dark-tertiary rounded-lg transition-colors disabled:opacity-50`,children:[(0,G.jsx)(Il,{className:`w-4 h-4 ${m?`animate-spin`:``}`}),e(`common.refresh`,`Refresh`)]})]}),(0,G.jsx)(R9,{title:e(`system.application`,`Application`),icon:Yl,children:(0,G.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-4`,children:[(0,G.jsx)(L9,{icon:Yl,label:e(`system.version`,`Version`),value:`v${u.app.version}`}),(0,G.jsx)(L9,{icon:ws,label:e(`system.uptime`,`System Uptime`),value:u.system.uptime_formatted}),(0,G.jsx)(L9,{icon:Yl,label:e(`system.hostname`,`Hostname`),value:u.system.hostname})]})}),(0,G.jsx)(R9,{title:e(`support.title`,`Support & Troubleshooting`),icon:kc,children:(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`support.description`,`Enable debug logging to capture detailed information, then download a support bundle to share when reporting issues.`)}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between p-4 bg-bambu-dark rounded-lg`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`p-2 rounded-lg ${h?.enabled?`bg-amber-500/20 text-amber-500`:`bg-bambu-dark-tertiary text-bambu-gray`}`,children:(0,G.jsx)(qo,{className:`w-5 h-5`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`font-medium text-white`,children:e(`support.debugLogging`,`Debug Logging`)}),(0,G.jsxs)(`p`,{className:`text-sm text-bambu-gray`,children:[h?.enabled?e(`support.debugLoggingEnabled`,`Capturing detailed logs`):e(`support.debugLoggingDisabled`,`Normal logging level`),h?.enabled&&h.duration_seconds!==null&&(0,G.jsxs)(`span`,{className:`text-amber-700 dark:text-amber-400 ml-2`,children:[`(`,Math.floor(h.duration_seconds/60),`m `,h.duration_seconds%60,`s)`]})]})]})]}),(0,G.jsxs)(`button`,{onClick:C,disabled:o,className:`px-4 py-2 rounded-lg font-medium transition-colors flex items-center gap-2 ${h?.enabled?`bg-amber-100 text-amber-700 hover:bg-amber-200 dark:bg-amber-500/20 dark:text-amber-400 dark:hover:bg-amber-500/30`:`bg-bambu-green/20 text-bambu-green hover:bg-bambu-green/30`} disabled:opacity-50`,children:[o&&(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),h?.enabled?e(`support.disableDebug`,`Disable`):e(`support.enableDebug`,`Enable`)]})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between p-4 bg-bambu-dark rounded-lg`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`p-2 rounded-lg bg-bambu-dark-tertiary text-bambu-green`,children:(0,G.jsx)(Us,{className:`w-5 h-5`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`font-medium text-white`,children:e(`support.supportBundle`,`Support Bundle`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`support.supportBundleDescription`,`Download system info and logs as a ZIP file`)})]})]}),(0,G.jsxs)(`button`,{onClick:w,disabled:i||!h?.enabled,className:`px-4 py-2 rounded-lg font-medium bg-bambu-green/20 text-bambu-green hover:bg-bambu-green/30 transition-colors flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed`,title:h?.enabled?void 0:e(`support.enableDebugFirst`,`Enable debug logging first`),children:[i&&(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),i?e(`support.bundleGenerating`,`Generating...`):e(`common.download`,`Download`)]})]}),i&&(0,G.jsxs)(`div`,{className:`p-3 bg-bambu-dark-tertiary/40 rounded-lg space-y-1`,children:[(0,G.jsxs)(`p`,{className:`text-sm font-medium text-white flex items-center gap-2`,children:[(0,G.jsx)(Y,{className:`w-3.5 h-3.5 animate-spin text-bambu-green`}),e(`support.bundleGenerating`,`Generating...`)]}),(0,G.jsxs)(`ul`,{className:`text-xs text-bambu-gray list-disc list-inside space-y-0.5 pl-1`,children:[(0,G.jsx)(`li`,{children:e(`support.bundleStepConnection`,`Running printer connectivity checks`)}),(0,G.jsx)(`li`,{children:e(`support.bundleStepVirtualPrinters`,`Running virtual-printer setup checks`)}),(0,G.jsx)(`li`,{children:e(`support.bundleStepLogScan`,`Scanning recent logs for known issues`)}),(0,G.jsx)(`li`,{children:e(`support.bundleStepBuild`,`Building the support bundle ZIP`)})]})]}),n&&(0,G.jsx)(`div`,{className:`p-3 bg-red-100 border border-red-300 rounded-lg text-red-700 dark:bg-red-500/20 dark:border-red-500/30 dark:text-red-400 text-sm`,children:n}),!h?.enabled&&(0,G.jsx)(`div`,{className:`p-4 bg-bambu-dark-tertiary/50 rounded-lg`,children:(0,G.jsxs)(`p`,{className:`text-sm text-bambu-gray`,children:[(0,G.jsx)(`span`,{className:`text-amber-700 dark:text-amber-400 font-medium`,children:e(`support.instructions`,`To report an issue:`)}),(0,G.jsx)(`br`,{}),`1. `,e(`support.step1`,`Enable debug logging`),(0,G.jsx)(`br`,{}),`2. `,e(`support.step2`,`Reproduce the issue`),(0,G.jsx)(`br`,{}),`3. `,e(`support.step3`,`Download the support bundle`),(0,G.jsx)(`br`,{}),`4. `,e(`support.step4`,`Attach the ZIP file to your issue report`)]})}),(0,G.jsxs)(`div`,{className:`p-4 bg-bambu-dark rounded-lg space-y-3`,children:[(0,G.jsx)(`p`,{className:`text-sm font-medium text-white`,children:e(`support.privacyTitle`,`What's in the support bundle?`)}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4 text-sm`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-bambu-green font-medium mb-1`,children:e(`support.collected`,`Collected:`)}),(0,G.jsxs)(`ul`,{className:`text-bambu-gray space-y-0.5`,children:[(0,G.jsxs)(`li`,{children:[`• `,e(`support.collectItem1`,`App version and debug mode`)]}),(0,G.jsxs)(`li`,{children:[`• `,e(`support.collectItem2`,`OS, architecture, Python version`)]}),(0,G.jsxs)(`li`,{children:[`• `,e(`support.collectItem3`,`Database statistics (counts only)`)]}),(0,G.jsxs)(`li`,{children:[`• `,e(`support.collectItem4`,`Printer models and nozzle counts`)]}),(0,G.jsxs)(`li`,{children:[`• `,e(`support.collectItem5`,`Non-sensitive settings (themes, formats)`)]}),(0,G.jsxs)(`li`,{children:[`• `,e(`support.collectItem6`,`Debug logs (sanitized)`)]}),(0,G.jsxs)(`li`,{children:[`• `,e(`support.collectItem7`,`Printer connectivity and firmware versions`)]}),(0,G.jsxs)(`li`,{children:[`• `,e(`support.collectItem8`,`Integration status (Spoolman, MQTT, HA)`)]}),(0,G.jsxs)(`li`,{children:[`• `,e(`support.collectItem9`,`Network interfaces (subnets only)`)]}),(0,G.jsxs)(`li`,{children:[`• `,e(`support.collectItem10`,`Python package versions`)]}),(0,G.jsxs)(`li`,{children:[`• `,e(`support.collectItem11`,`Database health checks`)]}),(0,G.jsxs)(`li`,{children:[`• `,e(`support.collectItem12`,`Docker environment details`)]})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-red-700 dark:text-red-400 font-medium mb-1`,children:e(`support.notCollected`,`NOT collected:`)}),(0,G.jsxs)(`ul`,{className:`text-bambu-gray space-y-0.5`,children:[(0,G.jsxs)(`li`,{children:[`• `,e(`support.notItem1`,`Printer names and serial numbers`)]}),(0,G.jsxs)(`li`,{children:[`• `,e(`support.notItem2`,`Access codes and passwords`)]}),(0,G.jsxs)(`li`,{children:[`• `,e(`support.notItem3`,`Email addresses`)]}),(0,G.jsxs)(`li`,{children:[`• `,e(`support.notItem4`,`API keys and tokens`)]}),(0,G.jsxs)(`li`,{children:[`• `,e(`support.notItem5`,`Webhook URLs`)]}),(0,G.jsxs)(`li`,{children:[`• `,e(`support.notItem6`,`Your hostname or username`)]}),(0,G.jsxs)(`li`,{children:[`• `,e(`support.notItem7`,`IP addresses`)]})]})]})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray/70`,children:e(`support.privacyNote`,`Email addresses in logs are replaced with [EMAIL], printer names with [PRINTER], serial numbers with [SERIAL], and IP addresses with [IP].`)})]}),(0,G.jsx)(n4e,{})]})}),(0,G.jsxs)(R9,{title:e(`diagnostic.sectionTitle`,`Connection Diagnostic`),icon:gu,children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mb-4`,children:e(`diagnostic.sectionDescription`,`Check why a printer won't connect or won't print — port reachability, LAN developer mode, Docker network mode, and credentials.`)}),v&&v.length>0?(0,G.jsx)(`div`,{className:`space-y-2`,children:v.map(t=>(0,G.jsxs)(`div`,{className:`flex items-center justify-between p-3 bg-bambu-dark rounded-lg`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`span`,{className:`font-medium text-white`,children:t.name}),(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray ml-2`,children:t.ip_address})]}),(0,G.jsxs)(`button`,{onClick:()=>l(t),className:`flex items-center gap-2 px-3 py-1.5 text-sm bg-bambu-dark-secondary hover:bg-bambu-dark-tertiary text-white rounded-lg transition-colors flex-shrink-0`,children:[(0,G.jsx)(gu,{className:`w-4 h-4`}),e(`diagnostic.runButton`,`Run diagnostic`)]})]},t.id))}):(0,G.jsx)(`p`,{className:`text-bambu-gray`,children:e(`diagnostic.noPrinters`,`No printers configured.`)})]}),(0,G.jsxs)(R9,{title:e(`systemHealth.sectionTitle`),icon:Ac,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3 mb-3`,children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`systemHealth.sectionDescription`)}),(0,G.jsxs)(`button`,{onClick:()=>b(),disabled:x,className:`flex items-center gap-2 px-3 py-1.5 text-sm bg-bambu-dark-secondary hover:bg-bambu-dark-tertiary text-white rounded-lg transition-colors flex-shrink-0 disabled:opacity-50`,children:[(0,G.jsx)(Il,{className:`w-4 h-4 ${x?`animate-spin`:``}`}),e(`systemHealth.rescan`)]})]}),y?(0,G.jsx)(Um,{result:y}):(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`common.loading`)})]}),(0,G.jsxs)(R9,{title:e(`system.database`,`Database`),icon:Rs,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4 mb-4`,children:[(0,G.jsx)(L9,{icon:Rs,label:e(`system.dbEngine`,`Database Engine`),value:u.database.engine||`SQLite`}),(0,G.jsx)(L9,{icon:Rs,label:e(`system.dbVersion`,`Version`),value:u.database.version||`unknown`})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-4 mb-4`,children:[(0,G.jsx)(L9,{icon:Oo,label:e(`system.totalArchives`,`Total Archives`),value:u.database.archives}),(0,G.jsx)(L9,{icon:hs,label:e(`system.completed`,`Completed`),value:u.database.archives_completed,color:`text-green-500`}),(0,G.jsx)(L9,{icon:bs,label:e(`system.failed`,`Failed`),value:u.database.archives_failed,color:`text-red-500`}),(0,G.jsx)(L9,{icon:Y,label:e(`system.printing`,`Printing`),value:u.database.archives_printing,color:`text-yellow-500`})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-4`,children:[(0,G.jsx)(L9,{icon:Ml,label:e(`system.printers`,`Printers`),value:u.database.printers}),(0,G.jsx)(L9,{icon:vl,label:e(`system.filaments`,`Filaments`),value:u.database.filaments}),(0,G.jsx)(L9,{icon:uc,label:e(`system.projects`,`Projects`),value:u.database.projects}),(0,G.jsx)(L9,{icon:Ol,label:e(`system.smartPlugs`,`Smart Plugs`),value:u.database.smart_plugs})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4 mt-4`,children:[(0,G.jsx)(L9,{icon:ws,label:e(`system.totalPrintTime`,`Total Print Time`),value:u.database.total_print_time_formatted}),(0,G.jsx)(L9,{icon:Oo,label:e(`system.totalFilament`,`Total Filament Used`),value:`${u.database.total_filament_kg} kg`,subValue:`${u.database.total_filament_grams.toLocaleString()} g`})]})]}),(0,G.jsxs)(R9,{title:e(`system.connectedPrinters`,`Connected Printers`),icon:Ml,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-4 mb-4`,children:[(0,G.jsx)(`div`,{className:`text-3xl font-bold text-bambu-green`,children:u.printers.connected}),(0,G.jsx)(`div`,{className:`text-bambu-gray`,children:e(`system.ofTotal`,`of {{total}} printers connected`,{total:u.printers.total})})]}),u.printers.connected_list.length>0?(0,G.jsx)(`div`,{className:`space-y-2`,children:u.printers.connected_list.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center justify-between p-3 bg-bambu-dark rounded-lg`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-2 h-2 rounded-full bg-bambu-green`}),(0,G.jsx)(`span`,{className:`font-medium text-white`,children:e.name})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-4 text-sm text-bambu-gray`,children:[(0,G.jsx)(`span`,{children:e.model}),(0,G.jsx)(`span`,{className:`px-2 py-0.5 rounded ${e.state===`RUNNING`?`bg-bambu-green/20 text-bambu-green`:e.state===`IDLE`?`bg-blue-100 text-blue-700 dark:bg-blue-500/20 dark:text-blue-400`:`bg-bambu-dark-tertiary`}`,children:e.state})]})]},e.id))}):(0,G.jsx)(`p`,{className:`text-bambu-gray`,children:e(`system.noPrintersConnected`,`No printers connected`)})]}),(0,G.jsx)(R9,{title:e(`system.storage`,`Storage`),icon:Dc,children:(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex justify-between text-sm mb-1`,children:[(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:e(`system.diskUsage`,`Disk Usage`)}),(0,G.jsxs)(`span`,{className:`text-white`,children:[u.storage.disk_used_formatted,` / `,u.storage.disk_total_formatted]})]}),(0,G.jsx)(i4e,{percent:u.storage.disk_percent_used,color:T}),(0,G.jsxs)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:[u.storage.disk_free_formatted,` `,e(`system.free`,`free`),` (`,(100-u.storage.disk_percent_used).toFixed(1),`%)`]})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-4`,children:[(0,G.jsx)(L9,{icon:Oo,label:e(`system.archiveStorage`,`Archive Storage`),value:u.storage.archive_size_formatted}),(0,G.jsx)(L9,{icon:Rs,label:e(`system.databaseSize`,`Database Size`),value:u.storage.database_size_formatted}),_&&(0,G.jsx)(L9,{icon:dc,label:e(`system.fileManagerStorage`,`File Manager`),value:r4e(_.total_size_bytes),subValue:`${_.total_files} files, ${_.total_folders} folders`})]})]})}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:[(0,G.jsx)(R9,{title:e(`system.memory`,`Memory`),icon:il,children:(0,G.jsx)(`div`,{className:`space-y-4`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex justify-between text-sm mb-1`,children:[(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:e(`system.memoryUsage`,`Memory Usage`)}),(0,G.jsxs)(`span`,{className:`text-white`,children:[u.memory.used_formatted,` / `,u.memory.total_formatted]})]}),(0,G.jsx)(i4e,{percent:u.memory.percent_used,color:E}),(0,G.jsxs)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:[u.memory.available_formatted,` `,e(`system.available`,`available`)]})]})})}),(0,G.jsx)(R9,{title:e(`system.cpu`,`CPU`),icon:Fs,children:(0,G.jsx)(`div`,{className:`space-y-4`,children:(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,G.jsx)(L9,{icon:Fs,label:e(`system.cores`,`Cores`),value:u.cpu.count,subValue:`${u.cpu.count_logical} logical`}),(0,G.jsx)(L9,{icon:Fs,label:e(`system.usage`,`Usage`),value:`${u.cpu.percent}%`})]})})})]}),(0,G.jsx)(R9,{title:e(`system.systemDetails`,`System Details`),icon:Yl,children:(0,G.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-4`,children:[(0,G.jsx)(L9,{icon:Yl,label:e(`system.os`,`Operating System`),value:u.system.platform,subValue:u.system.platform_release}),(0,G.jsx)(L9,{icon:Fs,label:e(`system.architecture`,`Architecture`),value:u.system.architecture}),(0,G.jsx)(L9,{icon:Yl,label:e(`system.python`,`Python`),value:u.system.python_version}),(0,G.jsx)(L9,{icon:ws,label:e(`system.bootTime`,`Boot Time`),value:np(u.system.boot_time,S)})]})}),c&&(0,G.jsx)(Vm,{printerId:c.id,printerName:c.name,onClose:()=>l(null)})]})}var z9=`auth_remember_me`,B9=`auth_post_login_redirect`;function V9(e){return e?`persistent`:`session`}function o4e(){try{let e=sessionStorage.getItem(z9)===`1`;return sessionStorage.removeItem(z9),e}catch(e){return console.warn(`consumeSavedRememberMe: sessionStorage unavailable, Remember Me preference lost across OIDC redirect`,e),!1}}function H9(e){return!e||!e.startsWith(`/`)||e.startsWith(`//`)||e.startsWith(`/login`)?null:e}function s4e(e){let t=H9(e);if(t)try{sessionStorage.setItem(B9,t)}catch(e){console.warn(`stashPostLoginRedirect: sessionStorage unavailable, post-login target will be lost across OIDC redirect`,e)}}function c4e(){try{let e=sessionStorage.getItem(B9);return sessionStorage.removeItem(B9),H9(e)}catch(e){return console.warn(`consumePostLoginRedirect: sessionStorage unavailable`,e),null}}function l4e({provider:e,onClick:t,disabled:n}){let{t:r}=U(),[i,a]=(0,f.useState)(!1);return(0,G.jsxs)(`button`,{type:`button`,onClick:t,disabled:n,className:`w-full flex items-center justify-center gap-3 py-3 px-4 bg-bambu-dark-secondary border border-bambu-dark-tertiary hover:border-bambu-green/50 rounded-lg text-white font-medium transition-colors disabled:opacity-50`,children:[e.has_icon&&!i?(0,G.jsx)(`img`,{src:Z.oidcProviderIconUrl(e.id),alt:``,className:`w-5 h-5 object-contain`,onError:()=>a(!0)}):(0,G.jsx)(tu,{className:`w-5 h-5 text-bambu-green`}),r(`login.twoFA.signInWith`,{provider:e.name})]})}function u4e(){let e=$n(),t=Xn(),[n]=ji(),{t:r}=U(),{login:i,loginWithToken:a,user:o,loading:s}=Nd(),{showToast:c}=qd(),{mode:l}=Id();function u(){let e=t.state?.from;if(e?.pathname){let t=H9(`${e.pathname}${e.search??``}`);if(t)return t}return c4e()??`/`}let[d,p]=(0,f.useState)(``),[m,h]=(0,f.useState)(``),[g,_]=(0,f.useState)(!1),[v,y]=(0,f.useState)(``),[b,x]=(0,f.useState)(`credentials`),[S,C]=(0,f.useState)(``),[w,T]=(0,f.useState)([]),[E,D]=(0,f.useState)(`totp`),[O,k]=(0,f.useState)(``),[A,j]=(0,f.useState)(!1),M=(0,f.useRef)(null),[N,P]=(0,f.useState)(!1),[F,I]=(0,f.useState)(``),[L,R]=(0,f.useState)(``),[z,B]=(0,f.useState)(``),{data:V}=K({queryKey:[`advancedAuthStatus`],queryFn:()=>Z.getAdvancedAuthStatus()}),{data:ee}=K({queryKey:[`oidcProviders`],queryFn:()=>Z.getOIDCProviders()}),[te,ne]=(0,f.useState)(!1);(0,f.useEffect)(()=>{!s&&o&&b===`credentials`&&e(`/`,{replace:!0})},[s,o,b,e]);let re=(0,f.useRef)(!1);(0,f.useEffect)(()=>{if(re.current||n.get(`fallback`)===`local`||!V||!V.autologin_provider_id||window.location.hash.startsWith(`#oidc_token=`)||n.get(`oidc_error`))return;re.current=!0;let e=V.autologin_provider_id,r=new Promise((e,t)=>setTimeout(()=>t(Error(`autologin timeout`)),5e3));Promise.race([Z.getOIDCAuthorizeUrl(e),r]).then(e=>{let n=t.state?.from;n?.pathname&&s4e(`${n.pathname}${n.search??``}`),window.location.href=e.auth_url}).catch(()=>{ne(!0)})},[V,n,t.state]);let ie=V?.local_login_enabled!==!1,ae=te&&V?.autologin_provider_id!=null;(0,f.useEffect)(()=>{let t=window.location.hash,n=t.startsWith(`#reset_token=`)?t.slice(13):null;n&&(I(n),x(`reset-password`),e(`/login`,{replace:!0}))},[]),(0,f.useEffect)(()=>{let t=window.location.hash,i=t.startsWith(`#oidc_token=`)?t.slice(12):null,o=n.get(`oidc_error`);if(!i&&!o)return;let s=o4e();if(o){c({oidc_provider_error:r(`login.oidcErrors.providerError`),missing_parameters:r(`login.oidcErrors.missingParameters`),invalid_state:r(`login.oidcErrors.invalidState`),state_expired:r(`login.oidcErrors.stateExpired`),provider_not_found:r(`login.oidcErrors.providerNotFound`),discovery_failed:r(`login.oidcErrors.discoveryFailed`),invalid_discovery_document:r(`login.oidcErrors.invalidDiscovery`),token_exchange_network_error:r(`login.oidcErrors.networkError`),token_exchange_bad_response:r(`login.oidcErrors.badResponse`),no_id_token:r(`login.oidcErrors.noIdToken`),token_validation_failed:r(`login.oidcErrors.validationFailed`),nonce_mismatch:r(`login.oidcErrors.nonceMismatch`),missing_sub_claim:r(`login.oidcErrors.missingSubClaim`),no_linked_account:r(`login.oidcErrors.noLinkedAccount`),account_inactive:r(`login.oidcErrors.accountInactive`),user_resolution_failed:r(`login.oidcErrors.userResolutionFailed`),internal_error:r(`login.oidcErrors.internalError`)}[o]??(o.startsWith(`token_exchange_`)?r(`login.oidcErrors.tokenExchangeFailed`):r(`login.oidcLoginFailed`)),`error`),e(`/login`,{replace:!0});return}i&&Z.exchangeOIDCToken(i).then(t=>{if(t.requires_2fa&&t.pre_auth_token){P(s),C(t.pre_auth_token);let n=t.two_fa_methods??[];T(n),n.includes(`totp`)?D(`totp`):n.includes(`email`)?D(`email`):D(`backup`),x(`2fa`),e(`/login`,{replace:!0})}else t.access_token&&t.user?(a(t.access_token,t.user,V9(s)),c(r(`login.loginSuccess`)),e(u(),{replace:!0})):(c(r(`login.oidcLoginFailed`),`error`),e(`/login`,{replace:!0}))}).catch(t=>{console.error(`OIDC token exchange failed`,t),c(r(`login.oidcLoginFailed`),`error`),e(`/login`,{replace:!0})})},[n]);let oe=q({mutationFn:()=>i(d,m,V9(N)),onSuccess:t=>{if(t.requires_2fa&&t.pre_auth_token){C(t.pre_auth_token);let e=t.two_fa_methods??[];T(e),e.includes(`totp`)?D(`totp`):e.includes(`email`)?D(`email`):D(`backup`),x(`2fa`)}else t.access_token&&t.user&&(c(r(`login.loginSuccess`)),e(u(),{replace:!0}))},onError:e=>{c(e.message||r(`login.loginFailed`),`error`)}}),se=q({mutationFn:e=>Z.forgotPassword({email:e}),onSuccess:e=>{c(e.message,`success`),_(!1),y(``)},onError:e=>{c(e.message,`error`)}}),H=q({mutationFn:()=>Z.forgotPasswordConfirm(F,L),onSuccess:e=>{c(e.message,`success`),x(`credentials`),I(``),R(``),B(``)},onError:e=>{c(e.message||r(`login.resetPassword.resetFailed`),`error`)}}),ce=q({mutationFn:()=>Z.sendEmailOTP(S),onSuccess:e=>{j(!0),e.pre_auth_token&&C(e.pre_auth_token),c(e.message,`success`)},onError:e=>{c(e.message||r(`login.twoFA.sendCodeFailed`),`error`)}}),le=q({mutationFn:()=>Z.verify2FA({pre_auth_token:S,code:O,method:E}),onSuccess:t=>{t.access_token&&t.user?(a(t.access_token,t.user,V9(N)),c(r(`login.loginSuccess`)),e(u(),{replace:!0})):(console.error(`2FA verify: unexpected response shape`,t),c(r(`login.loginFailed`),`error`))},onError:e=>{c(e.message||r(`login.twoFA.invalidCode`),`error`),k(``)}}),ue=q({mutationFn:e=>Z.getOIDCAuthorizeUrl(e),onSuccess:e=>{try{N?sessionStorage.setItem(z9,`1`):sessionStorage.removeItem(z9)}catch(e){console.warn(`setItem/removeItem auth_remember_me failed, Remember Me will not carry through OIDC redirect`,e)}let n=t.state?.from;n?.pathname&&s4e(`${n.pathname}${n.search??``}`),window.location.href=e.auth_url},onError:e=>{c(e.message||r(`login.oidcLoginFailed`),`error`)}}),de=e=>{if(e.preventDefault(),!d||!m){c(r(`login.enterCredentials`),`error`);return}oe.mutate()},fe=e=>{if(e.preventDefault(),!O.trim()){c(r(`login.twoFA.enterCode`),`error`);return}le.mutate()},pe=e=>{if(e.preventDefault(),!v){c(r(`login.enterEmail`),`error`);return}se.mutate(v)},me=e=>{D(e),k(``),j(!1),setTimeout(()=>M.current?.focus(),0)};return b===`reset-password`?(0,G.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-bambu-dark p-4`,children:(0,G.jsxs)(`div`,{className:`max-w-md w-full space-y-8 p-8 bg-gradient-to-br from-bambu-card to-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary shadow-lg`,children:[(0,G.jsxs)(`div`,{className:`text-center`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-center mb-4`,children:(0,G.jsx)(`div`,{className:`w-14 h-14 rounded-full bg-bambu-green/20 flex items-center justify-center`,children:(0,G.jsx)(Bc,{className:`w-7 h-7 text-bambu-green`})})}),(0,G.jsx)(`h2`,{className:`text-2xl font-bold text-white`,children:r(`login.resetPassword.title`)}),(0,G.jsx)(`p`,{className:`mt-2 text-sm text-bambu-gray`,children:r(`login.resetPassword.subtitle`)})]}),(0,G.jsxs)(`form`,{onSubmit:e=>{if(e.preventDefault(),L!==z){c(r(`login.resetPassword.passwordsDoNotMatch`),`error`);return}if(L.length<8){c(r(`login.resetPassword.passwordTooShort`),`error`);return}H.mutate()},className:`space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{htmlFor:`new-password`,className:`block text-sm font-medium text-white mb-2`,children:r(`login.resetPassword.newPassword`)}),(0,G.jsx)(`input`,{id:`new-password`,type:`password`,required:!0,value:L,onChange:e=>R(e.target.value),className:`block w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:r(`login.resetPassword.newPasswordPlaceholder`),autoFocus:!0,autoComplete:`new-password`,minLength:8})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{htmlFor:`confirm-password`,className:`block text-sm font-medium text-white mb-2`,children:r(`login.resetPassword.confirmPassword`)}),(0,G.jsx)(`input`,{id:`confirm-password`,type:`password`,required:!0,value:z,onChange:e=>B(e.target.value),className:`block w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:r(`login.resetPassword.confirmPasswordPlaceholder`),autoComplete:`new-password`})]}),(0,G.jsx)(`button`,{type:`submit`,disabled:H.isPending||!L||!z,className:`w-full flex justify-center py-3 px-4 bg-bambu-green hover:bg-bambu-green-light text-white font-medium rounded-lg shadow-lg shadow-bambu-green/20 hover:shadow-bambu-green/30 focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:ring-offset-2 focus:ring-offset-bambu-dark-secondary transition-all disabled:opacity-50 disabled:cursor-not-allowed`,children:H.isPending?r(`login.resetPassword.saving`):r(`login.resetPassword.submit`)})]}),(0,G.jsx)(`div`,{className:`text-center`,children:(0,G.jsx)(`button`,{type:`button`,onClick:()=>{x(`credentials`),I(``),R(``),B(``)},className:`text-sm text-bambu-gray hover:text-bambu-green transition-colors`,children:r(`login.resetPassword.backToLogin`)})})]})}):b===`2fa`?(0,G.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-bambu-dark p-4`,children:(0,G.jsxs)(`div`,{className:`max-w-md w-full space-y-8 p-8 bg-gradient-to-br from-bambu-card to-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary shadow-lg`,children:[(0,G.jsxs)(`div`,{className:`text-center`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-center mb-4`,children:(0,G.jsx)(`div`,{className:`w-14 h-14 rounded-full bg-bambu-green/20 flex items-center justify-center`,children:(0,G.jsx)(tu,{className:`w-7 h-7 text-bambu-green`})})}),(0,G.jsx)(`h2`,{className:`text-2xl font-bold text-white`,children:r(`login.twoFA.title`)}),(0,G.jsx)(`p`,{className:`mt-2 text-sm text-bambu-gray`,children:r(`login.twoFA.subtitle`)})]}),w.length>1&&(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[w.includes(`totp`)&&(0,G.jsxs)(`button`,{type:`button`,onClick:()=>me(`totp`),className:`flex-1 flex flex-col items-center gap-1 py-2 px-3 rounded-lg border text-xs font-medium transition-colors ${E===`totp`?`border-bambu-green bg-bambu-green/10 text-bambu-green`:`border-bambu-dark-tertiary text-bambu-gray hover:border-bambu-green/50`}`,children:[(0,G.jsx)(cu,{className:`w-4 h-4`}),r(`login.twoFA.methodAuthenticator`)]}),w.includes(`email`)&&(0,G.jsxs)(`button`,{type:`button`,onClick:()=>me(`email`),className:`flex-1 flex flex-col items-center gap-1 py-2 px-3 rounded-lg border text-xs font-medium transition-colors ${E===`email`?`border-bambu-green bg-bambu-green/10 text-bambu-green`:`border-bambu-dark-tertiary text-bambu-gray hover:border-bambu-green/50`}`,children:[(0,G.jsx)($c,{className:`w-4 h-4`}),r(`login.twoFA.methodEmail`)]}),w.includes(`backup`)&&(0,G.jsxs)(`button`,{type:`button`,onClick:()=>me(`backup`),className:`flex-1 flex flex-col items-center gap-1 py-2 px-3 rounded-lg border text-xs font-medium transition-colors ${E===`backup`?`border-bambu-green bg-bambu-green/10 text-bambu-green`:`border-bambu-dark-tertiary text-bambu-gray hover:border-bambu-green/50`}`,children:[(0,G.jsx)(Bc,{className:`w-4 h-4`}),r(`login.twoFA.methodBackup`)]})]}),(0,G.jsxs)(`form`,{onSubmit:fe,className:`space-y-4`,children:[E===`totp`&&(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:r(`login.twoFA.instructionsTotp`)}),E===`email`&&(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:r(A?`login.twoFA.instructionsEmail`:`login.twoFA.instructionsEmailNotSent`)}),!A&&(0,G.jsx)(Q,{type:`button`,variant:`secondary`,className:`w-full`,onClick:()=>ce.mutate(),disabled:ce.isPending,children:ce.isPending?r(`login.twoFA.sendingCode`):r(`login.twoFA.sendCodeButton`)}),A&&(0,G.jsx)(`button`,{type:`button`,onClick:()=>{j(!1),ce.mutate()},className:`text-xs text-bambu-gray hover:text-bambu-green transition-colors`,children:r(`login.twoFA.resendCode`)})]}),E===`backup`&&(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:r(`login.twoFA.instructionsBackup`)}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{htmlFor:`twofa-code`,className:`block text-sm font-medium text-white mb-2`,children:r(E===`backup`?`login.twoFA.backupCodeLabel`:`login.twoFA.codeLabel`)}),(0,G.jsx)(`input`,{ref:M,id:`twofa-code`,type:`text`,inputMode:E===`backup`?`text`:`numeric`,autoComplete:`one-time-code`,value:O,onChange:e=>k(e.target.value.trim()),disabled:E===`email`&&!A,className:`block w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray text-center tracking-widest text-xl font-mono focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors disabled:opacity-40`,placeholder:r(E===`backup`?`login.twoFA.backupCodePlaceholder`:`login.twoFA.codePlaceholder`),maxLength:E===`backup`?8:6,autoFocus:!0})]}),(0,G.jsx)(`button`,{type:`submit`,disabled:le.isPending||!O.trim()||E===`email`&&!A,className:`w-full flex justify-center py-3 px-4 bg-bambu-green hover:bg-bambu-green-light text-white font-medium rounded-lg shadow-lg shadow-bambu-green/20 hover:shadow-bambu-green/30 focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:ring-offset-2 focus:ring-offset-bambu-dark-secondary transition-all disabled:opacity-50 disabled:cursor-not-allowed`,children:le.isPending?r(`login.twoFA.verifyingButton`):r(`login.twoFA.verifyButton`)})]}),(0,G.jsx)(`div`,{className:`text-center`,children:(0,G.jsx)(`button`,{type:`button`,onClick:()=>{x(`credentials`),C(``),k(``),j(!1)},className:`text-sm text-bambu-gray hover:text-bambu-green transition-colors`,children:r(`login.twoFA.backToLogin`)})})]})}):(0,G.jsxs)(`div`,{className:`min-h-screen flex items-center justify-center bg-bambu-dark p-4`,children:[(0,G.jsxs)(`div`,{className:`max-w-md w-full space-y-8 p-8 bg-gradient-to-br from-bambu-card to-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary shadow-lg`,children:[(0,G.jsxs)(`div`,{className:`text-center`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-center mb-6`,children:(0,G.jsx)(`img`,{src:l===`dark`?`/img/bambuddy_logo_dark_transparent.png`:`/img/bambuddy_logo_light.png`,alt:`Bambuddy`,className:`h-16`})}),(0,G.jsx)(`h2`,{className:`text-3xl font-bold text-white`,children:r(`login.title`)}),(0,G.jsx)(`p`,{className:`mt-2 text-sm text-bambu-gray`,children:r(`login.subtitle`)})]}),ae&&(0,G.jsx)(`div`,{className:`mt-6 rounded-lg border border-amber-300 dark:border-amber-500/40 bg-amber-50 dark:bg-amber-500/10 px-4 py-3 text-sm text-amber-800 dark:text-amber-200`,children:r(`login.autologinFailed`)}),!ie&&(0,G.jsx)(`div`,{className:`mt-6 rounded-lg border border-bambu-dark-tertiary bg-bambu-dark/40 px-4 py-3 text-sm text-bambu-gray`,children:r(`login.localDisabledNotice`)}),ie&&(0,G.jsxs)(`form`,{className:`mt-8 space-y-6`,onSubmit:de,children:[(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{htmlFor:`username`,className:`block text-sm font-medium text-white mb-2`,children:V?.advanced_auth_enabled?r(`login.usernameOrEmail`):r(`login.username`)}),(0,G.jsx)(`input`,{id:`username`,type:`text`,required:!0,value:d,onChange:e=>p(e.target.value),className:`block w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:V?.advanced_auth_enabled?r(`login.usernameOrEmailPlaceholder`):r(`login.usernamePlaceholder`),autoComplete:`username`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{htmlFor:`password`,className:`block text-sm font-medium text-white mb-2`,children:r(`login.password`)||`Password`}),(0,G.jsx)(`input`,{id:`password`,type:`password`,required:!0,value:m,onChange:e=>h(e.target.value),className:`block w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:r(`login.passwordPlaceholder`),autoComplete:`current-password`})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{id:`remember-me`,type:`checkbox`,checked:N,onChange:e=>P(e.target.checked),className:`h-4 w-4 rounded border-bambu-dark-tertiary bg-bambu-dark-secondary text-bambu-green focus:ring-bambu-green/50 cursor-pointer`}),(0,G.jsx)(`label`,{htmlFor:`remember-me`,className:`text-sm text-bambu-gray cursor-pointer`,children:r(`login.rememberMe`)})]}),(0,G.jsx)(`div`,{children:(0,G.jsx)(`button`,{type:`submit`,disabled:oe.isPending,className:`w-full flex justify-center py-3 px-4 bg-bambu-green hover:bg-bambu-green-light text-white font-medium rounded-lg shadow-lg shadow-bambu-green/20 hover:shadow-bambu-green/30 focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:ring-offset-2 focus:ring-offset-bambu-dark-secondary transition-all disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-bambu-green`,children:oe.isPending?r(`login.signingIn`):r(`login.signIn`)})}),(0,G.jsx)(`div`,{className:`text-center`,children:(0,G.jsx)(`button`,{type:`button`,onClick:()=>_(!0),className:`text-sm text-bambu-gray hover:text-bambu-green transition-colors`,children:r(`login.forgotPassword`)})})]}),ee&&ee.length>0&&(0,G.jsxs)(`div`,{className:`space-y-3`,children:[ie&&(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(`div`,{className:`absolute inset-0 flex items-center`,children:(0,G.jsx)(`div`,{className:`w-full border-t border-bambu-dark-tertiary`})}),(0,G.jsx)(`div`,{className:`relative flex justify-center text-sm`,children:(0,G.jsx)(`span`,{className:`px-2 bg-bambu-dark-secondary text-bambu-gray`,children:r(`login.twoFA.orContinueWith`)})})]}),!ie&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{id:`remember-me`,type:`checkbox`,checked:N,onChange:e=>P(e.target.checked),className:`h-4 w-4 rounded border-bambu-dark-tertiary bg-bambu-dark-secondary text-bambu-green focus:ring-bambu-green/50 cursor-pointer`}),(0,G.jsx)(`label`,{htmlFor:`remember-me`,className:`text-sm text-bambu-gray cursor-pointer`,children:r(`login.rememberMe`)})]}),(0,G.jsx)(`div`,{className:`space-y-2`,children:ee.map(e=>(0,G.jsx)(l4e,{provider:e,onClick:()=>ue.mutate(e.id),disabled:ue.isPending},e.id))})]})]}),g&&(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,onClick:()=>_(!1),children:(0,G.jsxs)(zd,{className:`w-full max-w-md`,onClick:e=>e.stopPropagation(),children:[(0,G.jsx)(Bd,{children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)($c,{className:`w-5 h-5 text-bambu-green`}),(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:r(`login.forgotPasswordTitle`)})]}),(0,G.jsx)(Q,{variant:`ghost`,size:`sm`,onClick:()=>{_(!1),y(``)},children:(0,G.jsx)($u,{className:`w-5 h-5`})})]})}),(0,G.jsx)(Vd,{children:V?.advanced_auth_enabled?(0,G.jsxs)(`form`,{onSubmit:pe,className:`space-y-4`,children:[(0,G.jsx)(`p`,{className:`text-bambu-gray text-sm`,children:r(`login.forgotPasswordEmailMessage`)}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{htmlFor:`forgot-email`,className:`block text-sm font-medium text-white mb-2`,children:r(`login.emailAddress`)}),(0,G.jsx)(`input`,{id:`forgot-email`,type:`email`,required:!0,value:v,onChange:e=>y(e.target.value),className:`block w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:r(`login.emailPlaceholder`)})]}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(Q,{type:`button`,variant:`secondary`,className:`flex-1`,onClick:()=>{_(!1),y(``)},children:r(`login.cancel`)}),(0,G.jsx)(Q,{type:`submit`,className:`flex-1`,disabled:se.isPending,children:se.isPending?r(`login.sending`):r(`login.sendResetEmail`)})]})]}):(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`p`,{className:`text-bambu-gray`,children:r(`login.forgotPasswordMessage`)}),(0,G.jsxs)(`div`,{className:`bg-bambu-dark rounded-lg p-4 space-y-2`,children:[(0,G.jsx)(`p`,{className:`text-sm text-white font-medium`,children:r(`login.howToReset`)}),(0,G.jsxs)(`ol`,{className:`text-sm text-bambu-gray space-y-1 list-decimal list-inside`,children:[(0,G.jsx)(`li`,{children:r(`login.resetStep1`)}),(0,G.jsx)(`li`,{children:r(`login.resetStep2`)}),(0,G.jsx)(`li`,{children:r(`login.resetStep3`)}),(0,G.jsx)(`li`,{children:r(`login.resetStep4`)})]})]}),(0,G.jsx)(Q,{variant:`secondary`,className:`w-full`,onClick:()=>_(!1),children:r(`login.gotIt`)})]})})]})})]})}function d4e(e,t){let n=new URL(e);for(let[e,r]of Object.entries(t))r&&n.searchParams.set(e,r);return n.toString()}function f4e(){let{t:e}=U(),{authEnabled:t,loading:n}=Nd(),[r]=ji(),[i,a]=(0,f.useState)({kind:`loading`}),o=(0,f.useRef)(!1),s=r.get(`client_id`)??``,c=r.get(`redirect_uri`)??``,l=r.get(`state`)??``,u=r.get(`code_challenge`)??``,d=r.get(`code_challenge_method`)??``,p=async()=>{a({kind:`redirecting`});try{let e=await Z.connectAuthorize({client_id:s,redirect_uri:c,code_challenge:u,code_challenge_method:`S256`});window.location.replace(d4e(e.redirect_uri,{code:e.code,state:l}))}catch(t){a({kind:`error`,message:t instanceof Error?t.message:e(`connectedApps.authorize.failed`)})}};return(0,f.useEffect)(()=>{if(!(n||o.current)){if(o.current=!0,!t){a({kind:`error`,message:e(`connectedApps.authorize.authDisabled`)});return}if(!s||!c||!u||d!==`S256`){a({kind:`error`,message:e(`connectedApps.authorize.invalidRequest`)});return}Z.getConnectAuthorizeInfo(s,c).then(e=>{e.already_granted?p():a({kind:`consent`,info:e})}).catch(t=>{a({kind:`error`,message:t instanceof id&&t.status===409?e(`connectedApps.authorize.authDisabled`):e(`connectedApps.authorize.invalidRequest`)})})}},[n,t]),(0,G.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-bambu-dark p-4`,children:(0,G.jsxs)(`div`,{className:`max-w-md w-full space-y-6 p-8 bg-gradient-to-br from-bambu-card to-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary shadow-lg`,children:[(i.kind===`loading`||i.kind===`redirecting`)&&(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-3 text-bambu-gray`,role:`status`,children:[(0,G.jsx)(Y,{className:`w-8 h-8 animate-spin text-bambu-green`}),(0,G.jsx)(`p`,{children:i.kind===`loading`?e(`connectedApps.authorize.checking`):e(`connectedApps.authorize.redirecting`)})]}),i.kind===`error`&&(0,G.jsxs)(`div`,{className:`text-center space-y-3`,children:[(0,G.jsx)(Pu,{className:`w-10 h-10 mx-auto text-yellow-600 dark:text-yellow-400`}),(0,G.jsx)(`h1`,{className:`text-xl font-semibold text-white`,children:e(`connectedApps.authorize.errorTitle`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:i.message})]}),i.kind===`consent`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`text-center space-y-3`,children:[(0,G.jsx)(`div`,{className:`w-14 h-14 mx-auto rounded-full bg-bambu-green/20 flex items-center justify-center`,children:(0,G.jsx)(Wc,{className:`w-7 h-7 text-bambu-green`})}),(0,G.jsx)(`h1`,{className:`text-xl font-semibold text-white text-balance`,children:e(`connectedApps.authorize.title`,{app:i.info.app_name})}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`connectedApps.authorize.signedInAs`,{username:i.info.username})})]}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`connectedApps.authorize.sharedData`,{app:i.info.app_name})}),(0,G.jsxs)(`div`,{className:`flex gap-3`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>{window.location.replace(d4e(c,{error:`access_denied`,state:l}))},className:`flex-1 px-4 py-2 bg-bambu-dark-tertiary text-white rounded-md hover:bg-bambu-dark-tertiary/80 focus:outline-none focus-visible:ring-2 focus-visible:ring-bambu-green`,children:e(`connectedApps.authorize.deny`)}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>void p(),className:`flex-1 px-4 py-2 bg-bambu-green text-white rounded-md hover:bg-bambu-green/90 focus:outline-none focus-visible:ring-2 focus-visible:ring-white`,children:e(`connectedApps.authorize.allow`)})]})]})]})})}function p4e(){let e=$n(),{t}=U(),{showToast:n}=qd(),{mode:r}=Id(),{refreshAuth:i}=Nd(),[a,o]=(0,f.useState)(!1),[s,c]=(0,f.useState)(``),[l,u]=(0,f.useState)(``),[d,p]=(0,f.useState)(``),m=q({mutationFn:()=>Z.setupAuth({auth_enabled:a,admin_username:a?s:void 0,admin_password:a?l:void 0}),onSuccess:async r=>{await i(),r.auth_enabled?r.admin_created?(n(t(`setup.toast.authEnabledAdminCreated`)),e(`/login`)):(n(t(`setup.toast.authEnabledExistingAdmins`)),e(`/login`)):(n(t(`setup.toast.setupCompleted`)),e(`/`))},onError:e=>{n(e.message,`error`)}});return(0,G.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-bambu-dark p-4`,children:(0,G.jsxs)(`div`,{className:`max-w-md w-full space-y-8 p-8 bg-gradient-to-br from-bambu-card to-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary shadow-lg`,children:[(0,G.jsxs)(`div`,{className:`text-center`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-center mb-6`,children:(0,G.jsx)(`img`,{src:r===`dark`?`/img/bambuddy_logo_dark_transparent.png`:`/img/bambuddy_logo_light.png`,alt:`Bambuddy`,className:`h-16`})}),(0,G.jsx)(`h2`,{className:`text-3xl font-bold text-white`,children:t(`setup.title`)}),(0,G.jsx)(`p`,{className:`mt-2 text-sm text-bambu-gray`,children:t(`setup.subtitle`)})]}),(0,G.jsxs)(`form`,{className:`mt-8 space-y-6`,onSubmit:e=>{if(e.preventDefault(),a&&(s||l)){if(!s||!l){n(t(`setup.toast.enterBothCredentials`),`error`);return}if(l!==d){n(t(`setup.toast.passwordsDoNotMatch`),`error`);return}if(l.length<6){n(t(`setup.toast.passwordTooShort`),`error`);return}}m.mutate()},children:[(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center p-4 bg-bambu-dark-secondary/50 rounded-lg border border-bambu-dark-tertiary`,children:[(0,G.jsx)(`input`,{id:`auth-enabled`,type:`checkbox`,checked:a,onChange:e=>o(e.target.checked),className:`h-4 w-4 text-bambu-green focus:ring-bambu-green border-bambu-dark-tertiary rounded bg-bambu-dark-secondary`}),(0,G.jsx)(`label`,{htmlFor:`auth-enabled`,className:`ml-3 block text-sm font-medium text-white`,children:t(`setup.enableAuth`)})]}),a&&(0,G.jsxs)(`div`,{className:`space-y-4 mt-4`,children:[(0,G.jsx)(`div`,{className:`p-3 bg-bambu-dark-secondary/50 border border-bambu-dark-tertiary rounded-lg`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(Rc,{className:`w-4 h-4 text-bambu-green mt-0.5 flex-shrink-0`}),(0,G.jsxs)(`div`,{className:`text-sm text-bambu-gray`,children:[(0,G.jsx)(`p`,{className:`text-white font-medium mb-1`,children:t(`setup.adminAccount`)}),(0,G.jsx)(`p`,{children:t(`setup.adminAccountDesc`)})]})]})}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{htmlFor:`admin-username`,className:`block text-sm font-medium text-white mb-2`,children:[t(`setup.adminUsername`),` `,(0,G.jsx)(`span`,{className:`text-bambu-gray text-xs`,children:t(`setup.optionalIfAdminExists`)})]}),(0,G.jsx)(`input`,{id:`admin-username`,type:`text`,value:s,onChange:e=>c(e.target.value),className:`block w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:t(`setup.adminUsernamePlaceholder`),autoComplete:`username`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`label`,{htmlFor:`admin-password`,className:`block text-sm font-medium text-white mb-2`,children:[t(`setup.adminPassword`),` `,(0,G.jsx)(`span`,{className:`text-bambu-gray text-xs`,children:t(`setup.optionalIfAdminExists`)})]}),(0,G.jsx)(`input`,{id:`admin-password`,type:`password`,value:l,onChange:e=>u(e.target.value),className:`block w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:t(`setup.adminPasswordPlaceholder`),minLength:6,autoComplete:`new-password`})]}),l&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{htmlFor:`confirm-password`,className:`block text-sm font-medium text-white mb-2`,children:t(`setup.confirmPassword`)}),(0,G.jsx)(`input`,{id:`confirm-password`,type:`password`,value:d,onChange:e=>p(e.target.value),className:`block w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors`,placeholder:t(`setup.confirmPasswordPlaceholder`),minLength:6,autoComplete:`new-password`})]})]})]}),(0,G.jsx)(`div`,{children:(0,G.jsx)(`button`,{type:`submit`,disabled:m.isPending,className:`w-full flex justify-center py-3 px-4 bg-bambu-green hover:bg-bambu-green-light text-white font-medium rounded-lg shadow-lg shadow-bambu-green/20 hover:shadow-bambu-green/30 focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:ring-offset-2 focus:ring-offset-bambu-dark-secondary transition-all disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-bambu-green`,children:m.isPending?t(`setup.settingUp`):t(`setup.completeSetup`)})})]})]})})}function m4e(){let{t:e}=U(),{user:t}=Nd(),{showToast:n}=qd(),r=no(),i=$n(),[a,o]=(0,f.useState)(!0),[s,c]=(0,f.useState)(!0),[l,u]=(0,f.useState)(!0),[d,p]=(0,f.useState)(!0),[m,h]=(0,f.useState)(!1),{data:g,isLoading:_}=K({queryKey:[`advancedAuthStatus`],queryFn:Z.getAdvancedAuthStatus,staleTime:300*1e3}),{data:v,isLoading:y}=K({queryKey:[`settings`],queryFn:Z.getSettings,staleTime:300*1e3}),{data:b,isLoading:x}=K({queryKey:[`user-email-preferences`],queryFn:()=>Z.getUserEmailPreferences()});(0,f.useEffect)(()=>{(g&&!g.advanced_auth_enabled||v&&!v.user_notifications_enabled)&&i(`/settings`,{replace:!0})},[g,v,i]),(0,f.useEffect)(()=>{b&&(o(b.notify_print_start),c(b.notify_print_complete),u(b.notify_print_failed),p(b.notify_print_stopped),h(!1))},[b]);let S=q({mutationFn:()=>Z.updateUserEmailPreferences({notify_print_start:a,notify_print_complete:s,notify_print_failed:l,notify_print_stopped:d}),onSuccess:()=>{r.invalidateQueries({queryKey:[`user-email-preferences`]}),h(!1),n(e(`notifications.userEmail.saveSuccess`),`success`)},onError:t=>{n(t.message||e(`notifications.userEmail.saveError`),`error`)}}),C=(e,t)=>{e(!t),h(!0)};return x||_||y?(0,G.jsx)(`div`,{className:`flex items-center justify-center h-64`,children:(0,G.jsx)(Y,{className:`w-8 h-8 animate-spin text-bambu-green`})}):(0,G.jsxs)(`div`,{className:`p-4 md:p-6 max-w-2xl mx-auto`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 mb-6`,children:[(0,G.jsx)(Vo,{className:`w-7 h-7 text-bambu-green`}),(0,G.jsx)(`h1`,{className:`text-2xl font-bold text-white`,children:e(`notifications.userEmail.title`)})]}),(0,G.jsx)(zd,{className:`mb-6 border-blue-300 bg-blue-50 dark:border-blue-500/30 dark:bg-blue-500/5`,children:(0,G.jsx)(Vd,{className:`py-4`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`w-10 h-10 rounded-full flex items-center justify-center bg-blue-100 dark:bg-blue-500/20 flex-shrink-0`,children:(0,G.jsx)($c,{className:`w-5 h-5 text-blue-600 dark:text-blue-400`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-white font-medium`,children:e(`notifications.userEmail.emailNotifications`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:e(`notifications.userEmail.emailNotificationsDesc`)}),t?.email?(0,G.jsxs)(`p`,{className:`text-sm text-blue-700 dark:text-blue-400 mt-2`,children:[e(`notifications.userEmail.sendingTo`),`: `,(0,G.jsx)(`strong`,{children:t.email})]}):(0,G.jsx)(`p`,{className:`text-sm text-yellow-700 dark:text-yellow-400 mt-2`,children:e(`notifications.userEmail.noEmailWarning`)})]})]})})}),(0,G.jsxs)(zd,{className:`mb-6`,children:[(0,G.jsxs)(Bd,{children:[(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:e(`notifications.userEmail.printJobNotifications`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:e(`notifications.userEmail.printJobNotificationsDesc`)})]}),(0,G.jsxs)(Vd,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between p-4 bg-bambu-dark rounded-lg`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-10 h-10 rounded-full flex items-center justify-center ${a?`bg-bambu-green/20`:`bg-bambu-dark-tertiary`}`,children:(0,G.jsx)(hs,{className:`w-5 h-5 ${a?`text-bambu-green`:`text-bambu-gray`}`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white font-medium`,children:e(`notifications.userEmail.printJobStarts`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`notifications.userEmail.printJobStartsDesc`)})]})]}),(0,G.jsx)(`button`,{onClick:()=>C(o,a),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-bambu-green focus:ring-offset-2 focus:ring-offset-bambu-dark ${a?`bg-bambu-green`:`bg-bambu-dark-tertiary`}`,role:`switch`,"aria-checked":a,children:(0,G.jsx)(`span`,{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${a?`translate-x-6`:`translate-x-1`}`})})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between p-4 bg-bambu-dark rounded-lg`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-10 h-10 rounded-full flex items-center justify-center ${s?`bg-bambu-green/20`:`bg-bambu-dark-tertiary`}`,children:(0,G.jsx)(hs,{className:`w-5 h-5 ${s?`text-bambu-green`:`text-bambu-gray`}`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white font-medium`,children:e(`notifications.userEmail.printJobFinishes`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`notifications.userEmail.printJobFinishesDesc`)})]})]}),(0,G.jsx)(`button`,{onClick:()=>C(c,s),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-bambu-green focus:ring-offset-2 focus:ring-offset-bambu-dark ${s?`bg-bambu-green`:`bg-bambu-dark-tertiary`}`,role:`switch`,"aria-checked":s,children:(0,G.jsx)(`span`,{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${s?`translate-x-6`:`translate-x-1`}`})})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between p-4 bg-bambu-dark rounded-lg`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-10 h-10 rounded-full flex items-center justify-center ${l?`bg-bambu-green/20`:`bg-bambu-dark-tertiary`}`,children:(0,G.jsx)(hs,{className:`w-5 h-5 ${l?`text-bambu-green`:`text-bambu-gray`}`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white font-medium`,children:e(`notifications.userEmail.printErrors`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`notifications.userEmail.printErrorsDesc`)})]})]}),(0,G.jsx)(`button`,{onClick:()=>C(u,l),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-bambu-green focus:ring-offset-2 focus:ring-offset-bambu-dark ${l?`bg-bambu-green`:`bg-bambu-dark-tertiary`}`,role:`switch`,"aria-checked":l,children:(0,G.jsx)(`span`,{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${l?`translate-x-6`:`translate-x-1`}`})})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between p-4 bg-bambu-dark rounded-lg`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-10 h-10 rounded-full flex items-center justify-center ${d?`bg-bambu-green/20`:`bg-bambu-dark-tertiary`}`,children:(0,G.jsx)(hs,{className:`w-5 h-5 ${d?`text-bambu-green`:`text-bambu-gray`}`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white font-medium`,children:e(`notifications.userEmail.printJobStops`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`notifications.userEmail.printJobStopsDesc`)})]})]}),(0,G.jsx)(`button`,{onClick:()=>C(p,d),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-bambu-green focus:ring-offset-2 focus:ring-offset-bambu-dark ${d?`bg-bambu-green`:`bg-bambu-dark-tertiary`}`,role:`switch`,"aria-checked":d,children:(0,G.jsx)(`span`,{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${d?`translate-x-6`:`translate-x-1`}`})})]})]})]}),(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsx)(Q,{onClick:()=>S.mutate(),disabled:!m||S.isPending||!t?.email,children:S.isPending?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),e(`common.saving`)]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Vl,{className:`w-4 h-4`}),e(`common.save`)]})})})]})}function h4e(){let e=$n(),[t,n]=ji(),{t:r}=U(),i=t.get(`archive`),a=t.get(`library_file`),o=t.get(`plate`),s=K({queryKey:[`gcode-viewer-archive-colors`,i],queryFn:()=>Z.getArchiveCapabilities(Number(i)),enabled:!!i,staleTime:5*6e4,retry:!1}),c=K({queryKey:[`gcode-viewer-library-colors`,a],queryFn:()=>Z.getLibraryFilePlates(Number(a)),enabled:!!a,staleTime:5*6e4,retry:!1}),l=K({queryKey:[`gcode-viewer-archive-plates`,i],queryFn:()=>Z.getArchivePlates(Number(i)),enabled:!!i,staleTime:5*6e4,retry:!1}),u=(0,f.useMemo)(()=>(i?l.data?.plates:c.data?.plates)??[],[i,l.data,c.data]),d=(0,f.useMemo)(()=>o?Number(o):u.length===0?null:Math.min(...u.map(e=>e.index)),[o,u]),p=e=>{if(e===d)return;let r=new URLSearchParams(t);r.set(`plate`,String(e)),n(r,{replace:!0})},m=(0,f.useMemo)(()=>{if(i)return s.data?.filament_colors;let e=u.find(e=>e.index===d)||u[0];if(!e?.filaments?.length)return;let t=[];for(let n of e.filaments){let e=Math.max(0,(n.slot_id??1)-1);n.color&&(t[e]=n.color)}return t.length>0?t:void 0},[i,s.data,u,d]),h=(0,f.useMemo)(()=>{let e=e=>o?`${e}?plate=${encodeURIComponent(o)}`:e;return i?e(Z.getArchiveGcode(Number(i))):a?e(Z.getLibraryFileGcodeUrl(Number(a))):null},[i,a,o]),g=()=>{window.history.length>1?e(-1):e(i?`/archives`:`/files`)},_=i?r(`gcodeViewer.backToArchives`,`Back to Archives`):r(`gcodeViewer.backToFiles`,`Back to File Manager`);return(0,G.jsxs)(`div`,{className:`flex flex-col min-h-[calc(100vh-64px)] lg:h-[calc(100vh-64px)]`,children:[(0,G.jsxs)(`div`,{className:`flex-shrink-0 px-4 py-2 border-b border-bambu-dark-tertiary flex flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:g,className:`inline-flex items-center gap-1.5 text-sm text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white transition-colors`,children:[(0,G.jsx)(jo,{className:`w-4 h-4`}),_]}),u.length>1&&(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:r(`gcodeViewer.plates`,`Plates`)}),u.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>p(e.index),"aria-pressed":e.index===d,title:e.name??void 0,className:`px-2 py-0.5 rounded text-xs transition-colors ${e.index===d?`bg-bambu-green text-white`:`bg-bambu-dark-tertiary text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white`}`,children:r(`gcodeViewer.plateN`,`Plate {{n}}`,{n:e.index})},e.index))]})]}),h?(0,G.jsx)(eE,{gcodeUrl:h,filamentColors:m,className:`flex-1 min-h-0`}):(0,G.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-sm text-bambu-gray`,children:r(`gcodeViewer.noSource`,`No file was given to preview.`)})]})}var g4e=4401;function _4e(){let e=(0,f.useRef)(null),t=(0,f.useRef)(null),n=(0,f.useRef)(!1),r=no(),[i,a]=(0,f.useState)(!1),o=(0,f.useRef)(new Map),{showToast:s}=qd(),{t:c}=U(),l=(0,f.useRef)(new Set),u=(0,f.useRef)(null),d=(0,f.useRef)(new Map),p=(0,f.useRef)(null),m=(0,f.useRef)([]),h=(0,f.useRef)(!1),g=(0,f.useRef)(()=>{}),_=(0,f.useCallback)(()=>{if(h.current||m.current.length===0)return;h.current=!0;let e=()=>{let t=m.current.shift();t?(g.current(t),m.current.length>0?setTimeout(e,16):h.current=!1):h.current=!1};e()},[]),v=(0,f.useCallback)(async()=>{if(n.current||e.current?.readyState===WebSocket.OPEN)return;let r;try{r=(await Z.getWebSocketToken()).token}catch(e){let t=e instanceof id?e.status:0;if(t===401||t===403)return}if(n.current)return;let i=window.location.protocol===`https:`?`wss:`:`ws:`,o=r?`?token=${encodeURIComponent(r)}`:``,s=`${i}//${window.location.host}/api/v1/ws${o}`,c=new WebSocket(s),l=null;c.onopen=()=>{console.log(`[WebSocket] Connected`),a(!0),l=window.setInterval(()=>{c.readyState===WebSocket.OPEN&&c.send(JSON.stringify({type:`ping`}))},3e4)},c.onmessage=e=>{try{let t=JSON.parse(e.data);t.type===`printer_status`&&t.printer_id!==void 0&&t.data?g.current(t):(m.current.push(t),_())}catch{}},c.onclose=r=>{console.log(`[WebSocket] Closed`,r.code,r.reason),l&&=(clearInterval(l),null),a(!1),e.current=null,!(n.current||r.code===g4e)&&(t.current=window.setTimeout(()=>{v()},3e3))},c.onerror=e=>{console.error(`[WebSocket] Error`,e),c.close()},e.current=c},[_]),y=(0,f.useCallback)(()=>{p.current&&=(clearTimeout(p.current),null);let e=new Map(d.current);d.current.clear(),e.forEach((e,t)=>{r.setQueryData([`printerStatus`,t],t=>{let n={...t,...e};return n.wifi_signal==null&&t?.wifi_signal!=null&&(n.wifi_signal=t.wifi_signal),n})})},[r]),b=(0,f.useCallback)((e,t)=>{let n=d.current.get(e)||{};if(d.current.set(e,{...n,...t}),document.hidden){y();return}p.current||=window.setTimeout(y,100)},[y]),x=(0,f.useCallback)(e=>{l.current.add(e),u.current&&clearTimeout(u.current),u.current=window.setTimeout(()=>{let e=Array.from(l.current);l.current.clear(),u.current=null;let t=0;e.forEach(e=>{setTimeout(()=>{r.invalidateQueries({queryKey:[e]})},t),t+=500})},3e3)},[r]),S=(0,f.useCallback)(()=>{r.invalidateQueries({queryKey:[`spool-assignments`]}),r.invalidateQueries({queryKey:[`spoolman-slot-assignments`]}),r.invalidateQueries({queryKey:[`slotPresets`]})},[r]),C=(0,f.useCallback)(e=>{switch(e.type){case`printer_status`:e.printer_id!==void 0&&e.data&&b(e.printer_id,e.data);break;case`print_start`:e.printer_id!==void 0&&r.invalidateQueries({queryKey:[`printerStatus`,e.printer_id]});break;case`missing_spool_assignment`:{if(e.printer_id===void 0||!Array.isArray(e.missing_slots))break;let t=e.missing_slots.map(e=>e&&typeof e.slot==`string`?e.slot:`Unknown`).filter(e=>e.length>0);if(t.length===0){o.current.delete(e.printer_id);break}let n=t.join(`|`);if(o.current.get(e.printer_id)===n)break;o.current.set(e.printer_id,n),s(c(`printers.toast.missingSpoolAssignment`,{printer:e.printer_name||`Printer ${e.printer_id}`,slots:t.join(`, `)}),`warning`);break}case`print_complete`:x(`archives`),x(`archiveStats`);break;case`print_confirm_request`:{let t=e.data;t?.archive_id!=null&&window.dispatchEvent(new CustomEvent(`print-confirm-request`,{detail:t}));break}case`kill_switch_triggered`:s(c(`printers.toast.killSwitchTriggered`,{printer:e.printer_name||`Printer ${e.printer_id??`?`}`,filename:e.filename||c(`common.unknown`)}),`error`);break;case`billing_charge_failed`:s(c(`printers.toast.billingChargeFailed`,{printer:e.printer_name||`Printer ${e.printer_id??`?`}`,filename:e.filename||c(`common.unknown`)}),`error`);break;case`archive_created`:x(`archives`),x(`archiveStats`);break;case`archive_updated`:x(`archives`);break;case`pong`:break;case`plate_not_empty`:window.dispatchEvent(new CustomEvent(`plate-not-empty`,{detail:{printer_id:e.printer_id,printer_name:e.printer_name,message:e.message}}));break;case`inventory_changed`:x(`inventory-spools`),x(`spoolman-inventory-spools`),x(p6[0]),x(h6[0]),x(`material-number-stats`);break;case`spool_assignment_changed`:S();break;case`spool_assignment_verified`:{let t=e.printer_name||`Printer`,n=e.slot||`?`;e.verified?e.kprofile_applied===!1?s(c(`printers.toast.assignmentVerifiedNoKprofile`,{slot:n,printer:t}),`warning`):s(c(`printers.toast.assignmentVerified`,{slot:n,printer:t}),`success`):s(c(`printers.toast.assignmentNotConfirmed`,{slot:n,printer:t}),`warning`);break}case`spool_auto_assigned`:x(`inventory-spools`),S();break;case`spool_usage_logged`:x(`inventory-spools`);break;case`unknown_tag`:{let t=e;window.dispatchEvent(new CustomEvent(`unknown-tag`,{detail:{printer_id:t.printer_id,ams_id:t.ams_id,tray_id:t.tray_id,tag_uid:t.tag_uid,tray_uuid:t.tray_uuid,tray_type:t.tray_type,tray_color:t.tray_color,tray_sub_brands:t.tray_sub_brands,tray_count:t.tray_count}}));break}case`spoolbuddy_weight`:window.dispatchEvent(new CustomEvent(`spoolbuddy-weight`,{detail:e}));break;case`spoolbuddy_tag_matched`:window.dispatchEvent(new CustomEvent(`spoolbuddy-tag-matched`,{detail:e})),x(`inventory-spools`);break;case`spoolbuddy_unknown_tag`:window.dispatchEvent(new CustomEvent(`spoolbuddy-unknown-tag`,{detail:e}));break;case`spoolbuddy_tag_removed`:window.dispatchEvent(new CustomEvent(`spoolbuddy-tag-removed`,{detail:e}));break;case`spoolbuddy_tag_written`:window.dispatchEvent(new CustomEvent(`spoolbuddy-tag-written`,{detail:e})),x(`inventory-spools`);break;case`spoolbuddy_tag_write_failed`:window.dispatchEvent(new CustomEvent(`spoolbuddy-tag-write-failed`,{detail:e}));break;case`spoolbuddy_online`:window.dispatchEvent(new CustomEvent(`spoolbuddy-online`,{detail:e})),x(`spoolbuddy-devices`),x(`spoolbuddy-update-check`);break;case`spoolbuddy_offline`:window.dispatchEvent(new CustomEvent(`spoolbuddy-offline`,{detail:e})),x(`spoolbuddy-devices`);break;case`spoolbuddy_update`:x(`spoolbuddy-devices`),x(`spoolbuddy-update-check`);break;case`queue_item_uploading`:case`queue_item_upload_progress`:case`queue_item_acked`:case`queue_item_failed`:window.dispatchEvent(new CustomEvent(`bambuddy:dispatch-toast`,{detail:e}));break;case`pipeline_run_updated`:r.invalidateQueries({queryKey:[`pipeline-runs-all`]}),e.run?.pipeline_id&&r.invalidateQueries({queryKey:[`pipeline-runs`,e.run.pipeline_id]});break}},[r,x,S,b,s,c]);return(0,f.useEffect)(()=>{g.current=C},[C]),(0,f.useEffect)(()=>(n.current=!1,v(),()=>{n.current=!0,t.current&&clearTimeout(t.current),u.current&&clearTimeout(u.current),p.current&&clearTimeout(p.current),e.current&&e.current.close()}),[v]),{isConnected:i,sendMessage:(0,f.useCallback)(t=>{e.current?.readyState===WebSocket.OPEN&&e.current.send(JSON.stringify(t))},[])}}var v4e=`#00ae42`,y4e=e=>e!=null&&e>0?e:1/0;function b4e(e){let t=null;for(let n of e){if(!n||n.state!==`RUNNING`||n.progress==null)continue;if(t===null){t=n;continue}let e=y4e(n.remaining_time),r=y4e(t.remaining_time);(e(t.progress??0))&&(t=n)}return t}function x4e(e){let t=document.createElement(`canvas`);t.width=32,t.height=32;let n=t.getContext(`2d`);if(!n)return null;let r=getComputedStyle(document.documentElement).getPropertyValue(`--accent`).trim()||v4e,i=Math.max(0,Math.min(100,e))/100,a=-Math.PI/2;return n.lineWidth=4,n.beginPath(),n.arc(16,16,13,0,Math.PI*2),n.strokeStyle=`rgba(128,128,128,0.3)`,n.stroke(),n.beginPath(),n.arc(16,16,13,a,a+i*Math.PI*2),n.strokeStyle=r,n.lineCap=`round`,n.stroke(),t.toDataURL(`image/png`)}function U9(e,t){document.querySelectorAll(`link[rel~="icon"]`).forEach(n=>{if(e)t.has(n)||t.set(n,n.href),n.href=e;else{let e=t.get(n);e!==void 0&&(n.href=e)}}),e||t.clear()}function S4e(){let{progressInTitle:e,resolvedMode:t,darkAccent:n,lightAccent:r}=Id(),i=t===`dark`?n:r,{data:a}=K({queryKey:[`printers`],queryFn:Z.getPrinters,enabled:e}),o=_o({queries:(e?a??[]:[]).map(e=>({queryKey:[`printerStatus`,e.id],queryFn:()=>Z.getPrinterStatus(e.id)}))}),s=(0,f.useRef)(new Map),c=(0,f.useRef)(document.title),l=(0,f.useRef)(!1),u=e?b4e(o.map(e=>e.data)):null,d=u&&u.progress!=null?Math.round(u.progress):null;(0,f.useEffect)(()=>{e&&d!=null?(document.title=`${d}% · ${c.current}`,U9(x4e(d),s.current),l.current=!0):l.current&&=(document.title=c.current,U9(null,s.current),!1)},[e,d,i]),(0,f.useEffect)(()=>{let e=s.current,t=l,n=c.current;return()=>{t.current&&(document.title=n,U9(null,e))}},[])}function C4e({children:e}){let{authEnabled:t,user:n,loading:r}=Nd(),{data:i}=K({queryKey:[`color-catalog-map`],queryFn:async()=>{let e=await Z.getColorNameMap();return{colors:e.colors,byMaterial:e.by_material??{}}},staleTime:1/0,gcTime:1/0,retry:2,enabled:!r&&(!t||n!==null)});return(0,f.useEffect)(()=>{i&&_f(i.colors,i.byMaterial)},[i]),(0,G.jsx)(G.Fragment,{children:e})}function w4e({selectedPrinterId:e,onPrinterChange:t,deviceOnline:n}){let{t:r}=U(),[i,a]=(0,f.useState)(new Date),{data:o=[]}=K({queryKey:[`printers`],queryFn:()=>Z.getPrinters()}),s=_o({queries:o.map(e=>({queryKey:[`printerStatus`,e.id],queryFn:()=>Z.getPrinterStatus(e.id),refetchInterval:1e4}))}),c=(0,f.useMemo)(()=>o.filter((e,t)=>s[t]?.data?.connected),[o,s]);(0,f.useEffect)(()=>{let n=c.some(t=>t.id===e);(!e||!n)&&c.length>0&&t(c[0].id)},[c,e,t]);let{data:l}=K({queryKey:[`settings`],queryFn:Z.getSettings});return(0,f.useEffect)(()=>{let e=setInterval(()=>a(new Date),1e3);return()=>clearInterval(e)},[]),(0,G.jsxs)(`div`,{className:`h-12 bg-bambu-dark-secondary border-b border-bambu-dark-tertiary flex items-center px-3 gap-4 shrink-0`,children:[(0,G.jsx)(`div`,{className:`flex items-center shrink-0`,children:(0,G.jsx)(`img`,{src:`/img/spoolbuddy_logo_dark_small.png`,alt:`SpoolBuddy`,width:113,height:28,className:`h-7 w-auto`})}),(0,G.jsx)(`div`,{className:`flex-1 flex justify-center`,children:(0,G.jsx)(`select`,{value:e??``,onChange:e=>t(Number(e.target.value)),className:`bg-bambu-dark text-white text-base px-4 py-2 rounded border border-bambu-dark-tertiary focus:outline-none focus:border-bambu-green min-w-[180px]`,children:c.length===0?(0,G.jsx)(`option`,{value:``,children:r(`spoolbuddy.status.noPrinters`,`No printers online`)}):c.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))})}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 shrink-0`,children:[(0,G.jsx)(`div`,{className:`flex items-center`,title:n?r(`spoolbuddy.status.backend`,`Backend`):r(`spoolbuddy.status.offline`,`Offline`),children:n?(0,G.jsx)(`div`,{className:`flex items-end gap-0.5 h-4`,children:[1,2,3,4].map(e=>(0,G.jsx)(`div`,{className:`w-1 rounded-sm ${e<=4?`bg-white`:`bg-bambu-dark-tertiary`}`,style:{height:`${e*4}px`}},e))}):(0,G.jsx)(Ju,{className:`w-5 h-5 text-red-400`})}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`div`,{className:`w-3 h-3 rounded-full ${n?`bg-bambu-green shadow-[0_0_6px_rgba(34,197,94,0.5)]`:`bg-bambu-gray`}`}),(0,G.jsx)(`span`,{className:`text-sm text-white/50`,children:n?r(`spoolbuddy.status.backend`,`Backend`):r(`spoolbuddy.status.offline`,`Offline`)})]}),(0,G.jsx)(`span`,{className:`text-white/50 text-base font-mono min-w-[50px] text-right`,children:rp(i,l?.time_format||`system`)})]})]})}var T4e=[{to:`/spoolbuddy`,labelKey:`spoolbuddy.nav.dashboard`,fallback:`Dashboard`,icon:(0,G.jsx)(`svg`,{className:`w-6 h-6`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,children:(0,G.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6`})})},{to:`/spoolbuddy/ams`,labelKey:`spoolbuddy.nav.ams`,fallback:`AMS`,icon:(0,G.jsx)(`svg`,{className:`w-6 h-6`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,children:(0,G.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10`})})},{to:`/spoolbuddy/write-tag`,labelKey:`spoolbuddy.nav.writeTag`,fallback:`Write`,icon:(0,G.jsxs)(`svg`,{className:`w-6 h-6`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,children:[(0,G.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M8.288 15.038a5.25 5.25 0 017.424 0M5.106 11.856c3.807-3.808 9.98-3.808 13.788 0M1.924 8.674c5.565-5.565 14.587-5.565 20.152 0`}),(0,G.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12.53 18.22l-.53.53-.53-.53a.75.75 0 011.06 0z`})]})},{to:`/spoolbuddy/inventory`,labelKey:`spoolbuddy.nav.inventory`,fallback:`Inventory`,icon:(0,G.jsx)(`svg`,{className:`w-6 h-6`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,children:(0,G.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4`})})},{to:`/spoolbuddy/settings`,labelKey:`spoolbuddy.nav.settings`,fallback:`Settings`,icon:(0,G.jsxs)(`svg`,{className:`w-6 h-6`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,children:[(0,G.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z`}),(0,G.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M15 12a3 3 0 11-6 0 3 3 0 016 0z`})]})}];function E4e(){let{t:e}=U();return(0,G.jsx)(`nav`,{className:`h-14 bg-bambu-dark-secondary border-t border-bambu-dark-tertiary flex items-stretch shrink-0`,children:T4e.map(t=>(0,G.jsxs)(wi,{to:t.to,end:t.to===`/spoolbuddy`,className:({isActive:e})=>`flex-1 flex flex-col items-center justify-center gap-1 transition-colors ${e?`text-bambu-green bg-bambu-dark`:`text-white/50 hover:text-white/70 hover:bg-bambu-dark-tertiary`}`,children:[t.icon,(0,G.jsx)(`span`,{className:`text-xs font-medium`,children:e(t.labelKey,t.fallback)})]},t.to))})}function D4e({alert:e}){let{t}=U(),n=e?e.type===`error`?`bg-red-500`:e.type===`warning`?`bg-amber-500`:`bg-bambu-green`:`bg-bambu-green`;return(0,G.jsxs)(`div`,{className:`h-9 bg-bambu-dark-secondary border-t-2 ${e?e.type===`error`?`border-red-500`:e.type===`warning`?`border-amber-500`:`border-bambu-dark-tertiary`:`border-bambu-dark-tertiary`} flex items-center px-3 gap-3 shrink-0`,children:[(0,G.jsx)(`div`,{className:`w-3.5 h-3.5 rounded-full ${n}`}),(0,G.jsx)(`div`,{className:`flex-1 text-sm text-white/50 truncate`,children:e?(0,G.jsx)(`span`,{children:e.message}):(0,G.jsx)(`span`,{className:`text-bambu-green`,children:t(`spoolbuddy.status.systemReady`,`System Ready`)})})]})}function O4e({isOpen:e,onClose:t,deviceId:n,deviceOnline:r}){let{t:i}=U(),[a,o]=(0,f.useState)(null),[s,c]=(0,f.useState)(!1),[l,u]=(0,f.useState)(new Map),{data:d=[]}=K({queryKey:[`printers`],queryFn:()=>Z.getPrinters(),enabled:e}),{data:p=[]}=K({queryKey:[`smart-plugs`],queryFn:()=>Z.getSmartPlugs(),enabled:e}),m=d.map(e=>{let t=p.find(t=>t.printer_id===e.id&&t.plug_type!==`mqtt`&&t.enabled);if(!t)return null;let n=l.get(t.id);return{plug:t,printer:e,status:n?{state:n.state,reachable:!0,device_name:null,energy:null}:null,loading:n?.loading??!1}}).filter(Boolean);(0,f.useEffect)(()=>{!e||p.length===0||p.filter(e=>e.printer_id!==null&&e.plug_type!==`mqtt`&&e.enabled).forEach(async e=>{try{let t=await Z.getSmartPlugStatus(e.id);u(n=>{let r=new Map(n);return r.set(e.id,{loading:!1,state:t.state}),r})}catch{u(t=>{let n=new Map(t);return n.set(e.id,{loading:!1,state:null}),n})}})},[e,p]),(0,f.useEffect)(()=>{e||(o(null),c(!1))},[e]);let h=(0,f.useCallback)(async e=>{u(t=>{let n=new Map(t),r=n.get(e.id);return n.set(e.id,{loading:!0,state:r?.state??null}),n});try{await Z.controlSmartPlug(e.id,`toggle`);let t=await Z.getSmartPlugStatus(e.id);u(n=>{let r=new Map(n);return r.set(e.id,{loading:!1,state:t.state}),r})}catch{u(t=>{let n=new Map(t),r=n.get(e.id);return n.set(e.id,{loading:!1,state:r?.state??null}),n})}},[]),g=(0,f.useCallback)(async e=>{if(n){c(!0);try{await Od.systemCommand(n,e),setTimeout(()=>t(),500)}catch{c(!1)}}},[n,t]),_=(0,f.useCallback)(()=>{a&&(a.type===`system`?g(a.command):h(a.plug),o(null))},[a,g,h]);if(!e)return null;let v=e=>e===`ON`||e===`on`;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`fixed inset-0 z-40 bg-black/50`,onPointerDown:t}),(0,G.jsxs)(`div`,{className:`fixed top-0 left-0 right-0 z-50 bg-bambu-dark-secondary border-b border-bambu-dark-tertiary rounded-b-2xl shadow-2xl animate-slide-down`,children:[(0,G.jsx)(`div`,{className:`flex justify-center pt-2 pb-1`,children:(0,G.jsx)(`div`,{className:`w-10 h-1 rounded-full bg-zinc-600`})}),(0,G.jsxs)(`div`,{className:`px-4 pb-4 max-h-[80vh] overflow-y-auto`,children:[m.length>0&&(0,G.jsxs)(`div`,{className:`mb-4`,children:[(0,G.jsx)(`h3`,{className:`text-xs font-semibold text-zinc-500 uppercase tracking-wide mb-2`,children:i(`spoolbuddy.quickMenu.printerPower`,`Printer Power`)}),(0,G.jsx)(`div`,{className:`space-y-1`,children:m.map(({plug:e,printer:t,loading:n})=>{let r=l.get(e.id),i=v(r?.state??null);return(0,G.jsxs)(`button`,{onClick:()=>o({type:`plug`,plug:e,printer:t,currentState:r?.state??null}),disabled:n,className:`w-full flex items-center gap-2 px-3 py-1.5 rounded-lg bg-zinc-800/60 hover:bg-zinc-700/60 transition-colors min-h-[36px]`,children:[(0,G.jsx)(`div`,{className:`w-2 h-2 rounded-full shrink-0 ${i?`bg-green-500`:`bg-zinc-600`}`}),n&&(0,G.jsx)(Y,{className:`w-3 h-3 animate-spin text-zinc-400 shrink-0`}),(0,G.jsx)(`span`,{className:`flex-1 text-sm text-zinc-200 text-left truncate`,children:t.name}),(0,G.jsx)(`span`,{className:`text-xs font-medium ${i?`text-green-400`:`text-zinc-500`}`,children:r?.state??`—`})]},e.id)})})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-xs font-semibold text-zinc-500 uppercase tracking-wide mb-2`,children:i(`spoolbuddy.quickMenu.systemControls`,`System`)}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,G.jsx)(W9,{icon:(0,G.jsx)(zl,{className:`w-4 h-4`}),label:i(`spoolbuddy.quickMenu.restartDaemon`,`Restart Daemon`),onClick:()=>o({type:`system`,command:`restart_daemon`}),disabled:!n||!r||s}),(0,G.jsx)(W9,{icon:(0,G.jsx)(ul,{className:`w-4 h-4`}),label:i(`spoolbuddy.quickMenu.restartBrowser`,`Restart Browser`),onClick:()=>o({type:`system`,command:`restart_browser`}),disabled:!n||!r||s}),(0,G.jsx)(W9,{icon:(0,G.jsx)(zl,{className:`w-4 h-4`}),label:i(`spoolbuddy.quickMenu.reboot`,`Reboot`),onClick:()=>o({type:`system`,command:`reboot`}),disabled:!n||!r||s,variant:`warning`}),(0,G.jsx)(W9,{icon:(0,G.jsx)(Al,{className:`w-4 h-4`}),label:i(`spoolbuddy.quickMenu.shutdown`,`Shutdown`),onClick:()=>o({type:`system`,command:`shutdown`}),disabled:!n||!r||s,variant:`danger`})]})]}),(0,G.jsx)(`div`,{className:`flex justify-center mt-3`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-zinc-600`,children:[(0,G.jsx)(as,{className:`w-3 h-3`}),(0,G.jsx)(`span`,{children:i(`spoolbuddy.quickMenu.swipeToClose`,`Swipe down to close`)})]})})]})]}),a&&(0,G.jsx)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center bg-black/60`,children:(0,G.jsxs)(`div`,{className:`bg-zinc-800 rounded-2xl p-5 mx-4 max-w-sm w-full border border-zinc-700`,children:[(0,G.jsx)(`h3`,{className:`text-lg font-semibold text-zinc-100 mb-2`,children:i(`spoolbuddy.quickMenu.confirmTitle`,`Confirm`)}),(0,G.jsx)(`p`,{className:`text-sm text-zinc-400 mb-5`,children:a.type===`plug`?v(a.currentState)?i(`spoolbuddy.quickMenu.confirmPlugOff`,`Turn off {{name}}?`,{name:a.printer.name}):i(`spoolbuddy.quickMenu.confirmPlugOn`,`Turn on {{name}}?`,{name:a.printer.name}):a.command===`shutdown`?i(`spoolbuddy.quickMenu.confirmShutdown`,`Are you sure you want to shut down the SpoolBuddy? You will need physical access to turn it back on.`):a.command===`reboot`?i(`spoolbuddy.quickMenu.confirmReboot`,`Are you sure you want to reboot the SpoolBuddy?`):a.command===`restart_daemon`?i(`spoolbuddy.quickMenu.confirmRestartDaemon`,`Restart the SpoolBuddy daemon? NFC and scale will be temporarily unavailable.`):i(`spoolbuddy.quickMenu.confirmRestartBrowser`,`Restart the kiosk browser? The display will briefly go blank.`)}),(0,G.jsxs)(`div`,{className:`flex gap-3`,children:[(0,G.jsx)(`button`,{onClick:()=>o(null),className:`flex-1 px-4 py-2.5 rounded-lg text-sm font-medium bg-zinc-700 text-zinc-300 hover:bg-zinc-600 transition-colors min-h-[44px]`,children:i(`common.cancel`,`Cancel`)}),(0,G.jsx)(`button`,{onClick:_,disabled:s,className:`flex-1 px-4 py-2.5 rounded-lg text-sm font-medium text-white transition-colors min-h-[44px] ${a.type===`plug`?v(a.currentState)?`bg-red-600 hover:bg-red-700`:`bg-green-600 hover:bg-green-700`:a.command===`shutdown`?`bg-red-600 hover:bg-red-700`:a.command===`reboot`?`bg-amber-600 hover:bg-amber-700`:`bg-blue-600 hover:bg-blue-700`} disabled:opacity-50`,children:s?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin mx-auto`}):a.type===`plug`?v(a.currentState)?i(`spoolbuddy.quickMenu.turnOff`,`Turn Off`):i(`spoolbuddy.quickMenu.turnOn`,`Turn On`):i(`spoolbuddy.quickMenu.confirm`,`Confirm`)})]})]})})]})}function W9({icon:e,label:t,onClick:n,disabled:r,variant:i=`default`}){return(0,G.jsxs)(`button`,{onClick:n,disabled:r,className:`flex items-center gap-2.5 p-3 rounded-xl transition-colors min-h-[48px] disabled:opacity-40 ${{default:`bg-zinc-800/60 hover:bg-zinc-700/60 text-zinc-300`,warning:`bg-amber-900/30 hover:bg-amber-900/50 text-amber-400`,danger:`bg-red-900/30 hover:bg-red-900/50 text-red-400`}[i]}`,children:[e,(0,G.jsx)(`span`,{className:`text-sm font-medium`,children:t})]})}var k4e={weight:null,weightStable:!1,rawAdc:null,matchedSpool:null,unknownTagUid:null,unknownTrayUuid:null,deviceOnline:!1,deviceId:null};function A4e(e,t){switch(t.type){case`WEIGHT_UPDATE`:return{...e,weight:t.weight,weightStable:t.stable,rawAdc:t.rawAdc,deviceId:t.deviceId,deviceOnline:!0};case`TAG_MATCHED`:return{...e,matchedSpool:t.spool,unknownTagUid:null,unknownTrayUuid:null,deviceId:t.deviceId};case`UNKNOWN_TAG`:return{...e,matchedSpool:null,unknownTagUid:t.tagUid,unknownTrayUuid:t.trayUuid??null,deviceId:t.deviceId};case`TAG_REMOVED`:return{...e,matchedSpool:null,unknownTagUid:null,unknownTrayUuid:null};case`DEVICE_ONLINE`:return{...e,deviceOnline:!0,deviceId:t.deviceId};case`DEVICE_OFFLINE`:return{...e,deviceOnline:!1,weight:null,weightStable:!1,rawAdc:null};default:return e}}function j4e(){let[e,t]=(0,f.useReducer)(A4e,k4e),n=(0,f.useCallback)(e=>{let n=e.detail;t({type:`WEIGHT_UPDATE`,weight:n.weight_grams??n.data?.weight_grams,stable:n.stable??n.data?.stable??!1,rawAdc:n.raw_adc??n.data?.raw_adc??null,deviceId:n.device_id??n.data?.device_id??``})},[]),r=(0,f.useCallback)(e=>{let n=e.detail,r=n.spool??n.data?.spool;r&&t({type:`TAG_MATCHED`,spool:{id:r.id,tag_uid:n.tag_uid??n.data?.tag_uid??``,material:r.material??``,subtype:r.subtype??null,color_name:r.color_name??null,color_name_is_synthesized:r.color_name_is_synthesized??!1,rgba:r.rgba??null,extra_colors:r.extra_colors??null,effect_type:r.effect_type??null,brand:r.brand??null,label_weight:r.label_weight??0,core_weight:r.core_weight??0,weight_used:r.weight_used??0},deviceId:n.device_id??n.data?.device_id??``})},[]),i=(0,f.useCallback)(e=>{let n=e.detail;t({type:`UNKNOWN_TAG`,tagUid:n.tag_uid??n.data?.tag_uid??``,trayUuid:n.tray_uuid??n.data?.tray_uuid??null,deviceId:n.device_id??n.data?.device_id??``})},[]),a=(0,f.useCallback)(e=>{let n=e.detail;t({type:`TAG_REMOVED`,deviceId:n.device_id??n.data?.device_id??``})},[]),o=(0,f.useCallback)(e=>{let n=e.detail;t({type:`DEVICE_ONLINE`,deviceId:n.device_id??n.data?.device_id??``})},[]),s=(0,f.useCallback)(e=>{let n=e.detail;t({type:`DEVICE_OFFLINE`,deviceId:n.device_id??n.data?.device_id??``})},[]);(0,f.useEffect)(()=>(window.addEventListener(`spoolbuddy-weight`,n),window.addEventListener(`spoolbuddy-tag-matched`,r),window.addEventListener(`spoolbuddy-unknown-tag`,i),window.addEventListener(`spoolbuddy-tag-removed`,a),window.addEventListener(`spoolbuddy-online`,o),window.addEventListener(`spoolbuddy-offline`,s),()=>{window.removeEventListener(`spoolbuddy-weight`,n),window.removeEventListener(`spoolbuddy-tag-matched`,r),window.removeEventListener(`spoolbuddy-unknown-tag`,i),window.removeEventListener(`spoolbuddy-tag-removed`,a),window.removeEventListener(`spoolbuddy-online`,o),window.removeEventListener(`spoolbuddy-offline`,s)}),[n,r,i,a,o,s]);let c=e.matchedSpool?Math.max(0,e.matchedSpool.label_weight-e.matchedSpool.weight_used):null,l=e.weight!==null&&e.matchedSpool?Math.max(0,e.weight-e.matchedSpool.core_weight):null;return{...e,remainingWeight:c,netWeight:l}}var M4e=e(r(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r(a()):typeof define==`function`&&define.amd?define([`react`],r):typeof e==`object`?e.ReactSimpleKeyboard=r(a()):n.ReactSimpleKeyboard=r(n.React)})(e,(function(e){return function(){var t={981:function(){typeof Element>`u`||`remove`in Element.prototype||(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)}),typeof self<`u`&&`document`in self&&((!(`classList`in document.createElement(`_`))||document.createElementNS&&!(`classList`in document.createElementNS(`http://www.w3.org/2000/svg`,`g`)))&&function(e){if(`Element`in e){var t=`classList`,n=`prototype`,r=e.Element[n],i=Object,a=String[n].trim||function(){return this.replace(/^\s+|\s+$/g,``)},o=Array[n].indexOf||function(e){for(var t=0,n=this.length;t1?arguments[1]:void 0)}},7916:function(e,t,n){var r=n(6080),i=n(9565),a=n(8981),o=n(6319),s=n(4209),c=n(3517),l=n(6198),u=n(4659),d=n(4527),f=n(81),p=n(851),m=Array;e.exports=function(e){var t=a(e),n=c(this),h=arguments.length,g=h>1?arguments[1]:void 0,_=g!==void 0;_&&(g=r(g,h>2?arguments[2]:void 0));var v,y,b,x,S,C,w=p(t),T=0;if(!w||this===m&&s(w))for(v=l(t),y=n?new this(v):m(v);v>T;T++)C=_?g(t[T],T):t[T],u(y,T,C);else for(y=n?new this:[],S=(x=f(t,w)).next;!(b=i(S,x)).done;T++)C=_?o(x,g,[b.value,T],!0):b.value,u(y,T,C);return d(y,T),y}},9617:function(e,t,n){var r=n(5397),i=n(5610),a=n(6198),o=function(e){return function(t,n,o){var s=r(t),c=a(s);if(c===0)return!e&&-1;var l,u=i(o,c);if(e&&n!=n){for(;c>u;)if((l=s[u++])!=l)return!0}else for(;c>u;u++)if((e||u in s)&&s[u]===n)return e||u||0;return!e&&-1}};e.exports={includes:o(!0),indexOf:o(!1)}},9213:function(e,t,n){var r=n(6080),i=n(7055),a=n(8981),o=n(6198),s=n(1469),c=n(4659),l=function(e){var t=e===1,n=e===2,l=e===3,u=e===4,d=e===6,f=e===7,p=e===5||d;return function(m,h,g){for(var _,v,y=a(m),b=i(y),x=o(b),S=r(h,g),C=0,w=0,T=t?s(m,x):n||f?s(m,0):void 0;x>C;C++)if((p||C in b)&&(v=S(_=b[C],C,y),e))if(t)c(T,C,v);else if(v)switch(e){case 3:return!0;case 5:return _;case 6:return C;case 2:c(T,w++,_)}else switch(e){case 4:return!1;case 7:c(T,w++,_)}return d?-1:l||u?u:T}};e.exports={forEach:l(0),map:l(1),filter:l(2),some:l(3),every:l(4),find:l(5),findIndex:l(6),filterReject:l(7)}},597:function(e,t,n){var r=n(9039),i=n(8227),a=n(9519),o=i(`species`);e.exports=function(e){return a>=51||!r((function(){var t=[];return(t.constructor={})[o]=function(){return{foo:1}},t[e](Boolean).foo!==1}))}},4598:function(e,t,n){var r=n(9039);e.exports=function(e,t){var n=[][e];return!!n&&r((function(){n.call(null,t||function(){return 1},1)}))}},926:function(e,t,n){var r=n(9306),i=n(8981),a=n(7055),o=n(6198),s=TypeError,c=`Reduce of empty array with no initial value`,l=function(e){return function(t,n,l,u){var d=i(t),f=a(d),p=o(d);if(r(n),p===0&&l<2)throw new s(c);var m=e?p-1:0,h=e?-1:1;if(l<2)for(;;){if(m in f){u=f[m],m+=h;break}if(m+=h,e?m<0:p<=m)throw new s(c)}for(;e?m>=0:p>m;m+=h)m in f&&(u=n(u,f[m],m,d));return u}};e.exports={left:l(!1),right:l(!0)}},4527:function(e,t,n){var r=n(3724),i=n(4376),a=TypeError,o=Object.getOwnPropertyDescriptor;e.exports=r&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(e){return e instanceof TypeError}}()?function(e,t){if(i(e)&&!o(e,`length`).writable)throw new a(`Cannot set read only .length`);return e.length=t}:function(e,t){return e.length=t}},7680:function(e,t,n){e.exports=n(9504)([].slice)},4488:function(e,t,n){var r=n(7680),i=Math.floor,a=function(e,t){var n=e.length;if(n<8)for(var o,s,c=1;c0;)e[s]=e[--s];s!==c++&&(e[s]=o)}else for(var l=i(n/2),u=a(r(e,0,l),t),d=a(r(e,l),t),f=u.length,p=d.length,m=0,h=0;m9007199254740991)throw t(`Maximum allowed index exceeded`);return e}},7400:function(e){e.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},9296:function(e,t,n){var r=n(4055)(`span`).classList,i=r&&r.constructor&&r.constructor.prototype;e.exports=i===Object.prototype?void 0:i},8727:function(e){e.exports=[`constructor`,`hasOwnProperty`,`isPrototypeOf`,`propertyIsEnumerable`,`toLocaleString`,`toString`,`valueOf`]},3709:function(e,t,n){var r=n(2839).match(/firefox\/(\d+)/i);e.exports=!!r&&+r[1]},3763:function(e,t,n){var r=n(2839);e.exports=/MSIE|Trident/.test(r)},6193:function(e,t,n){e.exports=n(4215)===`NODE`},2839:function(e,t,n){var r=n(4576).navigator,i=r&&r.userAgent;e.exports=i?String(i):``},9519:function(e,t,n){var r,i,a=n(4576),o=n(2839),s=a.process,c=a.Deno,l=s&&s.versions||c&&c.version,u=l&&l.v8;u&&(i=(r=u.split(`.`))[0]>0&&r[0]<4?1:+(r[0]+r[1])),!i&&o&&(!(r=o.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=o.match(/Chrome\/(\d+)/))&&(i=+r[1]),e.exports=i},3607:function(e,t,n){var r=n(2839).match(/AppleWebKit\/(\d+)\./);e.exports=!!r&&+r[1]},4215:function(e,t,n){var r=n(4576),i=n(2839),a=n(2195),o=function(e){return i.slice(0,e.length)===e};e.exports=o(`Bun/`)?`BUN`:o(`Cloudflare-Workers`)?`CLOUDFLARE`:o(`Deno/`)?`DENO`:o(`Node.js/`)?`NODE`:r.Bun&&typeof Bun.version==`string`?`BUN`:r.Deno&&typeof Deno.version==`object`?`DENO`:a(r.process)===`process`?`NODE`:r.window&&r.document?`BROWSER`:`REST`},6518:function(e,t,n){var r=n(4576),i=n(7347).f,a=n(6699),o=n(6840),s=n(9433),c=n(7740),l=n(2796);e.exports=function(e,t){var n,u,d,f,p,m=e.target,h=e.global,g=e.stat;if(n=h?r:g?r[m]||s(m,{}):r[m]&&r[m].prototype)for(u in t){if(f=t[u],d=e.dontCallGetSet?(p=i(n,u))&&p.value:n[u],!l(h?u:m+(g?`.`:`#`)+u,e.forced)&&d!==void 0){if(typeof f==typeof d)continue;c(f,d)}(e.sham||d&&d.sham)&&a(f,`sham`,!0),o(n,u,f,e)}}},9039:function(e){e.exports=function(e){try{return!!e()}catch{return!0}}},9228:function(e,t,n){n(7495);var r=n(9565),i=n(6840),a=n(7323),o=n(9039),s=n(8227),c=n(6699),l=s(`species`),u=RegExp.prototype;e.exports=function(e,t,n,d){var f=s(e),p=!o((function(){var t={};return t[f]=function(){return 7},``[e](t)!==7})),m=p&&!o((function(){var t=!1,n=/a/;if(e===`split`){var r={};r[l]=function(){return n},(n={constructor:r,flags:``})[f]=/./[f]}return n.exec=function(){return t=!0,null},n[f](``),!t}));if(!p||!m||n){var h=/./[f],g=t(f,``[e],(function(e,t,n,i,o){var s=t.exec;return s===a||s===u.exec?p&&!o?{done:!0,value:r(h,t,n,i)}:{done:!0,value:r(e,n,t,i)}:{done:!1}}));i(String.prototype,e,g[0]),i(u,f,g[1])}d&&c(u[f],`sham`,!0)}},8745:function(e,t,n){var r=n(616),i=Function.prototype,a=i.apply,o=i.call;e.exports=typeof Reflect==`object`&&Reflect.apply||(r?o.bind(a):function(){return o.apply(a,arguments)})},6080:function(e,t,n){var r=n(7476),i=n(9306),a=n(616),o=r(r.bind);e.exports=function(e,t){return i(e),t===void 0?e:a?o(e,t):function(){return e.apply(t,arguments)}}},616:function(e,t,n){e.exports=!n(9039)((function(){var e=function(){}.bind();return typeof e!=`function`||e.hasOwnProperty(`prototype`)}))},566:function(e,t,n){var r=n(9504),i=n(9306),a=n(34),o=n(9297),s=n(7680),c=n(616),l=Function,u=r([].concat),d=r([].join),f={};e.exports=c?l.bind:function(e){var t=i(this),n=t.prototype,r=s(arguments,1),c=function(){var n=u(r,s(arguments));return this instanceof c?function(e,t,n){if(!o(f,t)){for(var r=[],i=0;i]*>)/g,u=/\$([$&'`]|\d{1,2})/g;e.exports=function(e,t,n,r,d,f){var p=n+e.length,m=r.length,h=u;return d!==void 0&&(d=i(d),h=l),s(f,h,(function(i,s){var l;switch(o(s,0)){case`$`:return`$`;case`&`:return e;case"`":return c(t,0,n);case`'`:return c(t,p);case`<`:l=d[c(s,1,-1)];break;default:var u=+s;if(u===0)return i;if(u>m){var f=a(u/10);return f===0?i:f<=m?r[f-1]===void 0?o(s,1):r[f-1]+o(s,1):i}l=r[u-1]}return l===void 0?``:l}))}},4576:function(e,t,n){var r=function(e){return e&&e.Math===Math&&e};e.exports=r(typeof globalThis==`object`&&globalThis)||r(typeof window==`object`&&window)||r(typeof self==`object`&&self)||r(typeof n.g==`object`&&n.g)||r(typeof this==`object`&&this)||function(){return this}()||Function(`return this`)()},9297:function(e,t,n){var r=n(9504),i=n(8981),a=r({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return a(i(e),t)}},421:function(e){e.exports={}},397:function(e,t,n){e.exports=n(7751)(`document`,`documentElement`)},5917:function(e,t,n){var r=n(3724),i=n(9039),a=n(4055);e.exports=!r&&!i((function(){return Object.defineProperty(a(`div`),"a",{get:function(){return 7}}).a!==7}))},7055:function(e,t,n){var r=n(9504),i=n(9039),a=n(2195),o=Object,s=r(``.split);e.exports=i((function(){return!o(`z`).propertyIsEnumerable(0)}))?function(e){return a(e)===`String`?s(e,``):o(e)}:o},3167:function(e,t,n){var r=n(4901),i=n(34),a=n(2967);e.exports=function(e,t,n){var o,s;return a&&r(o=t.constructor)&&o!==n&&i(s=o.prototype)&&s!==n.prototype&&a(e,s),e}},3706:function(e,t,n){var r=n(9504),i=n(4901),a=n(7629),o=r(Function.toString);i(a.inspectSource)||(a.inspectSource=function(e){return o(e)}),e.exports=a.inspectSource},1181:function(e,t,n){var r,i,a,o=n(8622),s=n(4576),c=n(34),l=n(6699),u=n(9297),d=n(7629),f=n(6119),p=n(421),m=`Object already initialized`,h=s.TypeError,g=s.WeakMap;if(o||d.state){var _=d.state||=new g;_.get=_.get,_.has=_.has,_.set=_.set,r=function(e,t){if(_.has(e))throw new h(m);return t.facade=e,_.set(e,t),t},i=function(e){return _.get(e)||{}},a=function(e){return _.has(e)}}else{var v=f(`state`);p[v]=!0,r=function(e,t){if(u(e,v))throw new h(m);return t.facade=e,l(e,v,t),t},i=function(e){return u(e,v)?e[v]:{}},a=function(e){return u(e,v)}}e.exports={set:r,get:i,has:a,enforce:function(e){return a(e)?i(e):r(e,{})},getterFor:function(e){return function(t){var n;if(!c(t)||(n=i(t)).type!==e)throw new h(`Incompatible receiver, `+e+` required`);return n}}}},4209:function(e,t,n){var r=n(8227),i=n(6269),a=r(`iterator`),o=Array.prototype;e.exports=function(e){return e!==void 0&&(i.Array===e||o[a]===e)}},4376:function(e,t,n){var r=n(2195);e.exports=Array.isArray||function(e){return r(e)===`Array`}},4901:function(e){var t=typeof document==`object`&&document.all;e.exports=t===void 0&&t!==void 0?function(e){return typeof e==`function`||e===t}:function(e){return typeof e==`function`}},3517:function(e,t,n){var r=n(9504),i=n(9039),a=n(4901),o=n(6955),s=n(7751),c=n(3706),l=function(){},u=s(`Reflect`,`construct`),d=/^\s*(?:class|function)\b/,f=r(d.exec),p=!d.test(l),m=function(e){if(!a(e))return!1;try{return u(l,[],e),!0}catch{return!1}},h=function(e){if(!a(e))return!1;switch(o(e)){case`AsyncFunction`:case`GeneratorFunction`:case`AsyncGeneratorFunction`:return!1}try{return p||!!f(d,c(e))}catch{return!0}};h.sham=!0,e.exports=!u||i((function(){var e;return m(m.call)||!m(Object)||!m((function(){e=!0}))||e}))?h:m},2796:function(e,t,n){var r=n(9039),i=n(4901),a=/#|\.prototype\./,o=function(e,t){var n=c[s(e)];return n===u||n!==l&&(i(t)?r(t):!!t)},s=o.normalize=function(e){return String(e).replace(a,`.`).toLowerCase()},c=o.data={},l=o.NATIVE=`N`,u=o.POLYFILL=`P`;e.exports=o},2087:function(e,t,n){var r=n(34),i=Math.floor;e.exports=Number.isInteger||function(e){return!r(e)&&isFinite(e)&&i(e)===e}},4117:function(e){e.exports=function(e){return e==null}},34:function(e,t,n){var r=n(4901);e.exports=function(e){return typeof e==`object`?e!==null:r(e)}},3925:function(e,t,n){var r=n(34);e.exports=function(e){return r(e)||e===null}},6395:function(e){e.exports=!1},5810:function(e,t,n){var r=n(34),i=n(1181).get;e.exports=function(e){if(!r(e))return!1;var t=i(e);return!!t&&t.type===`RawJSON`}},788:function(e,t,n){var r=n(34),i=n(2195),a=n(8227)(`match`);e.exports=function(e){var t;return r(e)&&((t=e[a])===void 0?i(e)===`RegExp`:!!t)}},757:function(e,t,n){var r=n(7751),i=n(4901),a=n(1625),o=n(7040),s=Object;e.exports=o?function(e){return typeof e==`symbol`}:function(e){var t=r(`Symbol`);return i(t)&&a(t.prototype,s(e))}},9539:function(e,t,n){var r=n(9565),i=n(8551),a=n(5966);e.exports=function(e,t,n){var o,s;i(e);try{if(!(o=a(e,`return`))){if(t===`throw`)throw n;return n}o=r(o,e)}catch(e){s=!0,o=e}if(t===`throw`)throw n;if(s)throw o;return i(o),n}},3994:function(e,t,n){var r=n(7657).IteratorPrototype,i=n(2360),a=n(6980),o=n(687),s=n(6269),c=function(){return this};e.exports=function(e,t,n,l){var u=t+` Iterator`;return e.prototype=i(r,{next:a(+!l,n)}),o(e,u,!1,!0),s[u]=c,e}},1088:function(e,t,n){var r=n(6518),i=n(9565),a=n(6395),o=n(350),s=n(4901),c=n(3994),l=n(2787),u=n(2967),d=n(687),f=n(6699),p=n(6840),m=n(8227),h=n(6269),g=n(7657),_=o.PROPER,v=o.CONFIGURABLE,y=g.IteratorPrototype,b=g.BUGGY_SAFARI_ITERATORS,x=m(`iterator`),S=`keys`,C=`values`,w=`entries`,T=function(){return this};e.exports=function(e,t,n,o,m,g,E){c(n,t,o);var D,O,k,A=function(e){if(e===m&&F)return F;if(!b&&e&&e in N)return N[e];switch(e){case S:case C:case w:return function(){return new n(this,e)}}return function(){return new n(this)}},j=t+` Iterator`,M=!1,N=e.prototype,P=N[x]||N[`@@iterator`]||m&&N[m],F=!b&&P||A(m),I=t===`Array`&&N.entries||P;if(I&&(D=l(I.call(new e)))!==Object.prototype&&D.next&&(a||l(D)===y||(u?u(D,y):s(D[x])||p(D,x,T)),d(D,j,!0,!0),a&&(h[j]=T)),_&&m===C&&P&&P.name!==C&&(!a&&v?f(N,`name`,C):(M=!0,F=function(){return i(P,this)})),m)if(O={values:A(C),keys:g?F:A(S),entries:A(w)},E)for(k in O)(b||M||!(k in N))&&p(N,k,O[k]);else r({target:t,proto:!0,forced:b||M},O);return a&&!E||N[x]===F||p(N,x,F,{name:m}),h[t]=F,O}},7657:function(e,t,n){var r,i,a,o=n(9039),s=n(4901),c=n(34),l=n(2360),u=n(2787),d=n(6840),f=n(8227),p=n(6395),m=f(`iterator`),h=!1;[].keys&&(`next`in(a=[].keys())?(i=u(u(a)))!==Object.prototype&&(r=i):h=!0),!c(r)||o((function(){var e={};return r[m].call(e)!==e}))?r={}:p&&(r=l(r)),s(r[m])||d(r,m,(function(){return this})),e.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:h}},6269:function(e){e.exports={}},6198:function(e,t,n){var r=n(8014);e.exports=function(e){return r(e.length)}},283:function(e,t,n){var r=n(9504),i=n(9039),a=n(4901),o=n(9297),s=n(3724),c=n(350).CONFIGURABLE,l=n(3706),u=n(1181),d=u.enforce,f=u.get,p=String,m=Object.defineProperty,h=r(``.slice),g=r(``.replace),_=r([].join),v=s&&!i((function(){return m((function(){}),`length`,{value:8}).length!==8})),y=String(String).split(`String`),b=e.exports=function(e,t,n){h(p(t),0,7)===`Symbol(`&&(t=`[`+g(p(t),/^Symbol\(([^)]*)\).*$/,`$1`)+`]`),n&&n.getter&&(t=`get `+t),n&&n.setter&&(t=`set `+t),(!o(e,`name`)||c&&e.name!==t)&&(s?m(e,`name`,{value:t,configurable:!0}):e.name=t),v&&n&&o(n,`arity`)&&e.length!==n.arity&&m(e,`length`,{value:n.arity});try{n&&o(n,`constructor`)&&n.constructor?s&&m(e,`prototype`,{writable:!1}):e.prototype&&=void 0}catch{}var r=d(e);return o(r,`source`)||(r.source=_(y,typeof t==`string`?t:``)),e};Function.prototype.toString=b((function(){return a(this)&&f(this).source||l(this)}),`toString`)},741:function(e){var t=Math.ceil,n=Math.floor;e.exports=Math.trunc||function(e){var r=+e;return(r>0?n:t)(r)}},7819:function(e,t,n){e.exports=!n(9039)((function(){var e=`9007199254740993`,t=JSON.rawJSON(e);return!JSON.isRawJSON(t)||JSON.stringify(t)!==e}))},5749:function(e,t,n){var r=n(788),i=TypeError;e.exports=function(e){if(r(e))throw new i(`The method doesn't accept regular expressions`);return e}},4213:function(e,t,n){var r=n(3724),i=n(9504),a=n(9565),o=n(9039),s=n(1072),c=n(3717),l=n(8773),u=n(8981),d=n(7055),f=Object.assign,p=Object.defineProperty,m=i([].concat);e.exports=!f||o((function(){if(r&&f({b:1},f(p({},`a`,{enumerable:!0,get:function(){p(this,`b`,{value:3,enumerable:!1})}}),{b:2})).b!==1)return!0;var e={},t={},n=Symbol(`assign detection`),i=`abcdefghijklmnopqrst`;return e[n]=7,i.split(``).forEach((function(e){t[e]=e})),f({},e)[n]!==7||s(f({},t)).join(``)!==i}))?function(e,t){for(var n=u(e),i=arguments.length,o=1,f=c.f,p=l.f;i>o;)for(var h,g=d(arguments[o++]),_=f?m(s(g),f(g)):s(g),v=_.length,y=0;v>y;)h=_[y++],r&&!a(p,g,h)||(n[h]=g[h]);return n}:f},2360:function(e,t,n){var r,i=n(8551),a=n(6801),o=n(8727),s=n(421),c=n(397),l=n(4055),u=n(6119),d=`prototype`,f=`script`,p=u(`IE_PROTO`),m=function(){},h=function(e){return`<`+f+`>`+e+``},g=function(e){e.write(h(``)),e.close();var t=e.parentWindow.Object;return e=null,t},_=function(){try{r=new ActiveXObject(`htmlfile`)}catch{}var e,t,n;_=typeof document<`u`?document.domain&&r?g(r):(t=l(`iframe`),n=`java`+f+`:`,t.style.display=`none`,c.appendChild(t),t.src=String(n),(e=t.contentWindow.document).open(),e.write(h(`document.F=Object`)),e.close(),e.F):g(r);for(var i=o.length;i--;)delete _[d][o[i]];return _()};s[p]=!0,e.exports=Object.create||function(e,t){var n;return e===null?n=_():(m[d]=i(e),n=new m,m[d]=null,n[p]=e),t===void 0?n:a.f(n,t)}},6801:function(e,t,n){var r=n(3724),i=n(8686),a=n(4913),o=n(8551),s=n(5397),c=n(1072);t.f=r&&!i?Object.defineProperties:function(e,t){o(e);for(var n,r=s(t),i=c(t),l=i.length,u=0;l>u;)a.f(e,n=i[u++],r[n]);return e}},4913:function(e,t,n){var r=n(3724),i=n(5917),a=n(8686),o=n(8551),s=n(6969),c=TypeError,l=Object.defineProperty,u=Object.getOwnPropertyDescriptor,d=`enumerable`,f=`configurable`,p=`writable`;t.f=r?a?function(e,t,n){if(o(e),t=s(t),o(n),typeof e==`function`&&t===`prototype`&&`value`in n&&p in n&&!n[p]){var r=u(e,t);r&&r[p]&&(e[t]=n.value,n={configurable:f in n?n[f]:r[f],enumerable:d in n?n[d]:r[d],writable:!1})}return l(e,t,n)}:l:function(e,t,n){if(o(e),t=s(t),o(n),i)try{return l(e,t,n)}catch{}if(`get`in n||`set`in n)throw new c(`Accessors not supported`);return`value`in n&&(e[t]=n.value),e}},7347:function(e,t,n){var r=n(3724),i=n(9565),a=n(8773),o=n(6980),s=n(5397),c=n(6969),l=n(9297),u=n(5917),d=Object.getOwnPropertyDescriptor;t.f=r?d:function(e,t){if(e=s(e),t=c(t),u)try{return d(e,t)}catch{}if(l(e,t))return o(!i(a.f,e,t),e[t])}},298:function(e,t,n){var r=n(2195),i=n(5397),a=n(8480).f,o=n(7680),s=typeof window==`object`&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return s&&r(e)===`Window`?function(e){try{return a(e)}catch{return o(s)}}(e):a(i(e))}},8480:function(e,t,n){var r=n(1828),i=n(8727).concat(`length`,`prototype`);t.f=Object.getOwnPropertyNames||function(e){return r(e,i)}},3717:function(e,t){t.f=Object.getOwnPropertySymbols},2787:function(e,t,n){var r=n(9297),i=n(4901),a=n(8981),o=n(6119),s=n(2211),c=o(`IE_PROTO`),l=Object,u=l.prototype;e.exports=s?l.getPrototypeOf:function(e){var t=a(e);if(r(t,c))return t[c];var n=t.constructor;return i(n)&&t instanceof n?n.prototype:t instanceof l?u:null}},1625:function(e,t,n){e.exports=n(9504)({}.isPrototypeOf)},1828:function(e,t,n){var r=n(9504),i=n(9297),a=n(5397),o=n(9617).indexOf,s=n(421),c=r([].push);e.exports=function(e,t){var n,r=a(e),l=0,u=[];for(n in r)!i(s,n)&&i(r,n)&&c(u,n);for(;t.length>l;)i(r,n=t[l++])&&(~o(u,n)||c(u,n));return u}},1072:function(e,t,n){var r=n(1828),i=n(8727);e.exports=Object.keys||function(e){return r(e,i)}},8773:function(e,t){var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor;t.f=r&&!n.call({1:2},1)?function(e){var t=r(this,e);return!!t&&t.enumerable}:n},2551:function(e,t,n){var r=n(6395),i=n(4576),a=n(9039),o=n(3607);e.exports=r||!a((function(){if(!(o&&o<535)){var e=Math.random();__defineSetter__.call(null,e,(function(){})),delete i[e]}}))},2967:function(e,t,n){var r=n(6706),i=n(34),a=n(7750),o=n(3506);e.exports=Object.setPrototypeOf||(`__proto__`in{}?function(){var e,t=!1,n={};try{(e=r(Object.prototype,`__proto__`,`set`))(n,[]),t=n instanceof Array}catch{}return function(n,r){return a(n),o(r),i(n)&&(t?e(n,r):n.__proto__=r),n}}():void 0)},3179:function(e,t,n){var r=n(2140),i=n(6955);e.exports=r?{}.toString:function(){return`[object `+i(this)+`]`}},4270:function(e,t,n){var r=n(9565),i=n(4901),a=n(34),o=TypeError;e.exports=function(e,t){var n,s;if(t===`string`&&i(n=e.toString)&&!a(s=r(n,e))||i(n=e.valueOf)&&!a(s=r(n,e))||t!==`string`&&i(n=e.toString)&&!a(s=r(n,e)))return s;throw new o(`Can't convert object to primitive value`)}},5031:function(e,t,n){var r=n(7751),i=n(9504),a=n(8480),o=n(3717),s=n(8551),c=i([].concat);e.exports=r(`Reflect`,`ownKeys`)||function(e){var t=a.f(s(e)),n=o.f;return n?c(t,n(e)):t}},8235:function(e,t,n){var r=n(9504),i=n(9297),a=SyntaxError,o=parseInt,s=String.fromCharCode,c=r(``.charAt),l=r(``.slice),u=r(/./.exec),d={'\\"':`"`,"\\\\":`\\`,"\\/":`/`,"\\b":`\b`,"\\f":`\f`,"\\n":` diff --git a/static/assets/index-V2lrrDnm.css b/static/assets/index-CT9srI0L.css similarity index 99% rename from static/assets/index-V2lrrDnm.css rename to static/assets/index-CT9srI0L.css index 84d6d6778..e86aabbab 100644 --- a/static/assets/index-V2lrrDnm.css +++ b/static/assets/index-CT9srI0L.css @@ -1,2 +1,2 @@ /*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */ -@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-content:""}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-100:oklch(93.6% .032 17.717);--color-red-200:oklch(88.5% .062 18.334);--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-red-800:oklch(44.4% .177 26.899);--color-red-900:oklch(39.6% .141 25.723);--color-red-950:oklch(25.8% .092 26.042);--color-orange-50:oklch(98% .016 73.684);--color-orange-100:oklch(95.4% .038 75.164);--color-orange-200:oklch(90.1% .076 70.697);--color-orange-300:oklch(83.7% .128 66.29);--color-orange-400:oklch(75% .183 55.934);--color-orange-500:oklch(70.5% .213 47.604);--color-orange-600:oklch(64.6% .222 41.116);--color-orange-700:oklch(55.3% .195 38.402);--color-orange-800:oklch(47% .157 37.304);--color-orange-900:oklch(40.8% .123 38.172);--color-amber-50:oklch(98.7% .022 95.277);--color-amber-100:oklch(96.2% .059 95.617);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-amber-700:oklch(55.5% .163 48.998);--color-amber-800:oklch(47.3% .137 46.201);--color-amber-900:oklch(41.4% .112 45.904);--color-yellow-50:oklch(98.7% .026 102.212);--color-yellow-100:oklch(97.3% .071 103.193);--color-yellow-200:oklch(94.5% .129 101.54);--color-yellow-300:oklch(90.5% .182 98.111);--color-yellow-400:oklch(85.2% .199 91.936);--color-yellow-500:oklch(79.5% .184 86.047);--color-yellow-600:oklch(68.1% .162 75.834);--color-yellow-700:oklch(55.4% .135 66.442);--color-yellow-800:oklch(47.6% .114 61.907);--color-lime-100:oklch(96.7% .067 122.328);--color-lime-400:oklch(84.1% .238 128.85);--color-lime-500:oklch(76.8% .233 130.85);--color-lime-700:oklch(53.2% .157 131.589);--color-green-50:oklch(98.2% .018 155.826);--color-green-100:oklch(96.2% .044 156.743);--color-green-200:oklch(92.5% .084 155.995);--color-green-300:oklch(87.1% .15 154.449);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-green-800:oklch(44.8% .119 151.328);--color-green-900:oklch(39.3% .095 152.535);--color-emerald-50:oklch(97.9% .021 166.113);--color-emerald-100:oklch(95% .052 163.051);--color-emerald-200:oklch(90.5% .093 164.15);--color-emerald-300:oklch(84.5% .143 164.978);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-600:oklch(59.6% .145 163.225);--color-emerald-700:oklch(50.8% .118 165.612);--color-teal-100:oklch(95.3% .051 180.801);--color-teal-400:oklch(77.7% .152 181.912);--color-teal-500:oklch(70.4% .14 182.503);--color-teal-600:oklch(60% .118 184.704);--color-teal-700:oklch(51.1% .096 186.391);--color-cyan-50:oklch(98.4% .019 200.873);--color-cyan-100:oklch(95.6% .045 203.388);--color-cyan-200:oklch(91.7% .08 205.041);--color-cyan-300:oklch(86.5% .127 207.078);--color-cyan-400:oklch(78.9% .154 211.53);--color-cyan-500:oklch(71.5% .143 215.221);--color-cyan-600:oklch(60.9% .126 221.723);--color-cyan-700:oklch(52% .105 223.128);--color-cyan-900:oklch(39.8% .07 227.392);--color-sky-50:oklch(97.7% .013 236.62);--color-sky-100:oklch(95.1% .026 236.824);--color-sky-400:oklch(74.6% .16 232.661);--color-sky-500:oklch(68.5% .169 237.323);--color-sky-600:oklch(58.8% .158 241.966);--color-sky-700:oklch(50% .134 242.749);--color-blue-50:oklch(97% .014 254.604);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-200:oklch(88.2% .059 254.128);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-blue-700:oklch(48.8% .243 264.376);--color-blue-800:oklch(42.4% .199 265.638);--color-blue-900:oklch(37.9% .146 265.522);--color-indigo-50:oklch(96.2% .018 272.314);--color-indigo-100:oklch(93% .034 272.788);--color-indigo-200:oklch(87% .065 274.039);--color-indigo-300:oklch(78.5% .115 274.713);--color-indigo-400:oklch(67.3% .182 276.935);--color-indigo-500:oklch(58.5% .233 277.117);--color-indigo-600:oklch(51.1% .262 276.966);--color-indigo-700:oklch(45.7% .24 277.023);--color-violet-500:oklch(60.6% .25 292.717);--color-purple-50:oklch(97.7% .014 308.299);--color-purple-100:oklch(94.6% .033 307.174);--color-purple-200:oklch(90.2% .063 306.703);--color-purple-300:oklch(82.7% .119 306.383);--color-purple-400:oklch(71.4% .203 305.504);--color-purple-500:oklch(62.7% .265 303.9);--color-purple-600:oklch(55.8% .288 302.321);--color-purple-700:oklch(49.6% .265 301.924);--color-fuchsia-100:oklch(95.2% .037 318.852);--color-fuchsia-300:oklch(83.3% .145 321.434);--color-fuchsia-500:oklch(66.7% .295 322.15);--color-fuchsia-700:oklch(51.8% .253 323.949);--color-pink-100:oklch(94.8% .028 342.258);--color-pink-400:oklch(71.8% .202 349.761);--color-pink-500:oklch(65.6% .241 354.308);--color-pink-700:oklch(52.5% .223 3.958);--color-rose-100:oklch(94.1% .03 12.58);--color-rose-200:oklch(89.2% .058 10.001);--color-rose-300:oklch(81% .117 11.638);--color-rose-400:oklch(71.2% .194 13.428);--color-rose-500:oklch(64.5% .246 16.439);--color-rose-600:oklch(58.6% .253 17.585);--color-rose-700:oklch(51.4% .222 16.935);--color-rose-900:oklch(41% .159 10.272);--color-slate-100:oklch(96.8% .007 247.896);--color-slate-200:oklch(92.9% .013 255.508);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-400:oklch(70.4% .04 256.788);--color-slate-500:oklch(55.4% .046 257.417);--color-slate-600:oklch(44.6% .043 257.281);--color-slate-700:oklch(37.2% .044 257.287);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-zinc-100:oklch(96.7% .001 286.375);--color-zinc-200:oklch(92% .004 286.32);--color-zinc-300:oklch(87.1% .006 286.286);--color-zinc-400:oklch(70.5% .015 286.067);--color-zinc-500:oklch(55.2% .016 285.938);--color-zinc-600:oklch(44.2% .017 285.786);--color-zinc-700:oklch(37% .013 285.805);--color-zinc-800:oklch(27.4% .006 286.033);--color-zinc-900:oklch(21% .006 285.885);--color-black:#000;--color-white:#fff;--spacing:.25rem;--breakpoint-2xl:96rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-xl:36rem;--container-2xl:42rem;--container-3xl:48rem;--container-4xl:56rem;--container-5xl:64rem;--container-6xl:72rem;--container-7xl:80rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height:calc(1.5/1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25/1.875);--text-5xl:3rem;--text-5xl--line-height:1;--font-weight-light:300;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-normal:0em;--tracking-wide:.025em;--tracking-wider:.05em;--tracking-widest:.1em;--leading-tight:1.25;--leading-snug:1.375;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--drop-shadow-md:0 3px 3px #0000001f;--drop-shadow-lg:0 4px 4px #00000026;--ease-out:cubic-bezier(0,0,.2,1);--ease-in-out:cubic-bezier(.4,0,.2,1);--animate-spin:spin 1s linear infinite;--animate-ping:ping 1s cubic-bezier(0,0,.2,1)infinite;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--blur-sm:8px;--blur-2xl:40px;--aspect-video:16/9;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-bambu-green:var(--accent);--color-bambu-green-light:var(--accent-light);--color-bambu-green-dark:var(--accent-dark);--color-status-ok:var(--status-ok);--color-status-error:var(--status-error);--color-status-warning:var(--status-warning);--color-bambu-dark:var(--bg-primary);--color-bambu-dark-secondary:var(--bg-secondary);--color-bambu-dark-tertiary:var(--bg-tertiary);--color-bambu-gray:var(--text-muted);--color-bambu-gray-light:var(--text-secondary);--color-bambu-gray-dark:var(--text-tertiary)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}button:not(:disabled),select:not(:disabled),summary,input[type=checkbox]:not(:disabled),input[type=radio]:not(:disabled),[role=button]:not([aria-disabled=true]){cursor:pointer}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing)*0)}.inset-2{inset:calc(var(--spacing)*2)}.inset-x-0{inset-inline:calc(var(--spacing)*0)}.inset-y-0{inset-block:calc(var(--spacing)*0)}.-top-0\.5{top:calc(var(--spacing)*-.5)}.-top-1{top:calc(var(--spacing)*-1)}.-top-1\.5{top:calc(var(--spacing)*-1.5)}.top-0{top:calc(var(--spacing)*0)}.top-0\.5{top:calc(var(--spacing)*.5)}.top-1{top:calc(var(--spacing)*1)}.top-1\.5{top:calc(var(--spacing)*1.5)}.top-1\/2{top:50%}.top-2{top:calc(var(--spacing)*2)}.top-2\.5{top:calc(var(--spacing)*2.5)}.top-3{top:calc(var(--spacing)*3)}.top-4{top:calc(var(--spacing)*4)}.top-8{top:calc(var(--spacing)*8)}.top-9{top:calc(var(--spacing)*9)}.top-16{top:calc(var(--spacing)*16)}.top-\[3px\]{top:3px}.top-\[52px\]{top:52px}.top-full{top:100%}.-right-0\.5{right:calc(var(--spacing)*-.5)}.-right-1{right:calc(var(--spacing)*-1)}.-right-1\.5{right:calc(var(--spacing)*-1.5)}.-right-2{right:calc(var(--spacing)*-2)}.right-0{right:calc(var(--spacing)*0)}.right-0\.5{right:calc(var(--spacing)*.5)}.right-1{right:calc(var(--spacing)*1)}.right-1\.5{right:calc(var(--spacing)*1.5)}.right-2{right:calc(var(--spacing)*2)}.right-3{right:calc(var(--spacing)*3)}.right-4{right:calc(var(--spacing)*4)}.right-6{right:calc(var(--spacing)*6)}.right-12{right:calc(var(--spacing)*12)}.right-\[5\.5rem\]{right:5.5rem}.right-full{right:100%}.-bottom-0\.5{bottom:calc(var(--spacing)*-.5)}.-bottom-1{bottom:calc(var(--spacing)*-1)}.-bottom-2{bottom:calc(var(--spacing)*-2)}.-bottom-4{bottom:calc(var(--spacing)*-4)}.-bottom-7{bottom:calc(var(--spacing)*-7)}.bottom-0{bottom:calc(var(--spacing)*0)}.bottom-0\.5{bottom:calc(var(--spacing)*.5)}.bottom-1{bottom:calc(var(--spacing)*1)}.bottom-2{bottom:calc(var(--spacing)*2)}.bottom-3{bottom:calc(var(--spacing)*3)}.bottom-4{bottom:calc(var(--spacing)*4)}.bottom-5{bottom:calc(var(--spacing)*5)}.bottom-6{bottom:calc(var(--spacing)*6)}.bottom-20{bottom:calc(var(--spacing)*20)}.bottom-24{bottom:calc(var(--spacing)*24)}.bottom-full{bottom:100%}.-left-1{left:calc(var(--spacing)*-1)}.-left-2{left:calc(var(--spacing)*-2)}.-left-\[9999px\]{left:-9999px}.left-0{left:calc(var(--spacing)*0)}.left-0\.5{left:calc(var(--spacing)*.5)}.left-1{left:calc(var(--spacing)*1)}.left-1\/2{left:50%}.left-2{left:calc(var(--spacing)*2)}.left-2\.5{left:calc(var(--spacing)*2.5)}.left-3{left:calc(var(--spacing)*3)}.left-4{left:calc(var(--spacing)*4)}.left-10{left:calc(var(--spacing)*10)}.left-12{left:calc(var(--spacing)*12)}.left-\[3px\]{left:3px}.left-full{left:100%}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.z-60{z-index:60}.z-\[1\]{z-index:1}.z-\[60\]{z-index:60}.z-\[70\]{z-index:70}.z-\[100\]{z-index:100}.z-\[101\]{z-index:101}.z-\[102\]{z-index:102}.z-\[110\]{z-index:110}.z-\[120\]{z-index:120}.z-\[1000\]{z-index:1000}.z-\[1001\]{z-index:1001}.z-\[9998\]{z-index:9998}.z-\[9999\]{z-index:9999}.order-first{order:-9999}.col-span-1{grid-column:span 1/span 1}.col-span-2{grid-column:span 2/span 2}.col-span-3{grid-column:span 3/span 3}.col-span-4{grid-column:span 4/span 4}.col-span-full{grid-column:1/-1}.\!container{width:100%!important}@media (min-width:40rem){.\!container{max-width:40rem!important}}@media (min-width:48rem){.\!container{max-width:48rem!important}}@media (min-width:64rem){.\!container{max-width:64rem!important}}@media (min-width:80rem){.\!container{max-width:80rem!important}}@media (min-width:96rem){.\!container{max-width:96rem!important}}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.-m-1{margin:calc(var(--spacing)*-1)}.-m-4{margin:calc(var(--spacing)*-4)}.-mx-2{margin-inline:calc(var(--spacing)*-2)}.-mx-4{margin-inline:calc(var(--spacing)*-4)}.mx-1{margin-inline:calc(var(--spacing)*1)}.mx-1\.5{margin-inline:calc(var(--spacing)*1.5)}.mx-2{margin-inline:calc(var(--spacing)*2)}.mx-4{margin-inline:calc(var(--spacing)*4)}.mx-5{margin-inline:calc(var(--spacing)*5)}.mx-auto{margin-inline:auto}.-my-1{margin-block:calc(var(--spacing)*-1)}.my-1{margin-block:calc(var(--spacing)*1)}.my-2{margin-block:calc(var(--spacing)*2)}.my-8{margin-block:calc(var(--spacing)*8)}.my-auto{margin-block:auto}.-mt-0\.5{margin-top:calc(var(--spacing)*-.5)}.-mt-2{margin-top:calc(var(--spacing)*-2)}.mt-0\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-1\.5{margin-top:calc(var(--spacing)*1.5)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-6{margin-top:calc(var(--spacing)*6)}.mt-8{margin-top:calc(var(--spacing)*8)}.mt-14{margin-top:calc(var(--spacing)*14)}.mt-auto{margin-top:auto}.-mr-2{margin-right:calc(var(--spacing)*-2)}.mr-1{margin-right:calc(var(--spacing)*1)}.mr-1\.5{margin-right:calc(var(--spacing)*1.5)}.mr-2{margin-right:calc(var(--spacing)*2)}.mr-3{margin-right:calc(var(--spacing)*3)}.mr-4{margin-right:calc(var(--spacing)*4)}.mr-\[2px\]{margin-right:2px}.mr-\[3px\]{margin-right:3px}.mr-auto{margin-right:auto}.-mb-1{margin-bottom:calc(var(--spacing)*-1)}.-mb-px{margin-bottom:-1px}.mb-0{margin-bottom:calc(var(--spacing)*0)}.mb-0\.5{margin-bottom:calc(var(--spacing)*.5)}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-1\.5{margin-bottom:calc(var(--spacing)*1.5)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-2\.5{margin-bottom:calc(var(--spacing)*2.5)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-5{margin-bottom:calc(var(--spacing)*5)}.mb-6{margin-bottom:calc(var(--spacing)*6)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.-ml-2{margin-left:calc(var(--spacing)*-2)}.ml-0{margin-left:calc(var(--spacing)*0)}.ml-0\.5{margin-left:calc(var(--spacing)*.5)}.ml-1{margin-left:calc(var(--spacing)*1)}.ml-1\.5{margin-left:calc(var(--spacing)*1.5)}.ml-2{margin-left:calc(var(--spacing)*2)}.ml-3{margin-left:calc(var(--spacing)*3)}.ml-4{margin-left:calc(var(--spacing)*4)}.ml-6{margin-left:calc(var(--spacing)*6)}.ml-7{margin-left:calc(var(--spacing)*7)}.ml-16{margin-left:calc(var(--spacing)*16)}.ml-64{margin-left:calc(var(--spacing)*64)}.ml-\[-3\.6px\]{margin-left:-3.6px}.ml-\[3\.25rem\]{margin-left:3.25rem}.ml-auto{margin-left:auto}.box-border{box-sizing:border-box}.line-clamp-1{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-3{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.table-row{display:table-row}.aspect-square{aspect-ratio:1}.aspect-video{aspect-ratio:var(--aspect-video)}.\!h-8{height:calc(var(--spacing)*8)!important}.h-0{height:calc(var(--spacing)*0)}.h-0\.5{height:calc(var(--spacing)*.5)}.h-1{height:calc(var(--spacing)*1)}.h-1\.5{height:calc(var(--spacing)*1.5)}.h-2{height:calc(var(--spacing)*2)}.h-2\.5{height:calc(var(--spacing)*2.5)}.h-3{height:calc(var(--spacing)*3)}.h-3\.5{height:calc(var(--spacing)*3.5)}.h-4{height:calc(var(--spacing)*4)}.h-4\.5{height:calc(var(--spacing)*4.5)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-7{height:calc(var(--spacing)*7)}.h-8{height:calc(var(--spacing)*8)}.h-9{height:calc(var(--spacing)*9)}.h-10{height:calc(var(--spacing)*10)}.h-12{height:calc(var(--spacing)*12)}.h-14{height:calc(var(--spacing)*14)}.h-16{height:calc(var(--spacing)*16)}.h-20{height:calc(var(--spacing)*20)}.h-24{height:calc(var(--spacing)*24)}.h-32{height:calc(var(--spacing)*32)}.h-40{height:calc(var(--spacing)*40)}.h-44{height:calc(var(--spacing)*44)}.h-48{height:calc(var(--spacing)*48)}.h-64{height:calc(var(--spacing)*64)}.h-80{height:calc(var(--spacing)*80)}.h-96{height:calc(var(--spacing)*96)}.h-\[2px\]{height:2px}.h-\[18px\]{height:18px}.h-\[38px\]{height:38px}.h-\[40px\]{height:40px}.h-\[48px\]{height:48px}.h-\[80vh\]{height:80vh}.h-\[94vh\]{height:94vh}.h-\[160px\]{height:160px}.h-\[300px\]{height:300px}.h-\[calc\(100\%-40px\)\]{height:calc(100% - 40px)}.h-\[calc\(100vh-1rem\)\]{height:calc(100vh - 1rem)}.h-\[calc\(100vh-64px\)\]{height:calc(100vh - 64px)}.h-\[var\(--pc-i2\,0\.5rem\)\]{height:var(--pc-i2,.5rem)}.h-\[var\(--pc-i3\,0\.75rem\)\]{height:var(--pc-i3,.75rem)}.h-\[var\(--pc-i4\,1rem\)\]{height:var(--pc-i4,1rem)}.h-\[var\(--pc-i5\,1\.25rem\)\]{height:var(--pc-i5,1.25rem)}.h-\[var\(--pc-i7\,28px\)\]{height:var(--pc-i7,28px)}.h-\[var\(--pc-i25\,0\.625rem\)\]{height:var(--pc-i25,.625rem)}.h-\[var\(--pc-i35\,0\.875rem\)\]{height:var(--pc-i35,.875rem)}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-40{max-height:calc(var(--spacing)*40)}.max-h-44{max-height:calc(var(--spacing)*44)}.max-h-48{max-height:calc(var(--spacing)*48)}.max-h-56{max-height:calc(var(--spacing)*56)}.max-h-60{max-height:calc(var(--spacing)*60)}.max-h-64{max-height:calc(var(--spacing)*64)}.max-h-72{max-height:calc(var(--spacing)*72)}.max-h-80{max-height:calc(var(--spacing)*80)}.max-h-96{max-height:calc(var(--spacing)*96)}.max-h-\[3\.75rem\]{max-height:3.75rem}.max-h-\[22rem\]{max-height:22rem}.max-h-\[24rem\]{max-height:24rem}.max-h-\[28rem\]{max-height:28rem}.max-h-\[50vh\]{max-height:50vh}.max-h-\[60vh\]{max-height:60vh}.max-h-\[75vh\]{max-height:75vh}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[86vh\]{max-height:86vh}.max-h-\[88vh\]{max-height:88vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[300px\]{max-height:300px}.max-h-\[400px\]{max-height:400px}.max-h-\[500px\]{max-height:500px}.max-h-\[600px\]{max-height:600px}.max-h-\[820px\]{max-height:820px}.max-h-\[calc\(90vh-80px\)\]{max-height:calc(90vh - 80px)}.max-h-\[calc\(100vh-2rem\)\]{max-height:calc(100vh - 2rem)}.max-h-\[calc\(100vh-320px\)\]{max-height:calc(100vh - 320px)}.max-h-full{max-height:100%}.\!min-h-8{min-height:calc(var(--spacing)*8)!important}.min-h-0{min-height:calc(var(--spacing)*0)}.min-h-7{min-height:calc(var(--spacing)*7)}.min-h-40{min-height:calc(var(--spacing)*40)}.min-h-\[8rem\]{min-height:8rem}.min-h-\[14px\]{min-height:14px}.min-h-\[16px\]{min-height:16px}.min-h-\[18px\]{min-height:18px}.min-h-\[18rem\]{min-height:18rem}.min-h-\[36px\]{min-height:36px}.min-h-\[40px\]{min-height:40px}.min-h-\[44px\]{min-height:44px}.min-h-\[48px\]{min-height:48px}.min-h-\[60px\]{min-height:60px}.min-h-\[80px\]{min-height:80px}.min-h-\[120px\]{min-height:120px}.min-h-\[300px\]{min-height:300px}.min-h-\[400px\]{min-height:400px}.min-h-\[calc\(100vh-64px\)\]{min-height:calc(100vh - 64px)}.min-h-screen{min-height:100vh}.\!w-6{width:calc(var(--spacing)*6)!important}.\!w-8{width:calc(var(--spacing)*8)!important}.w-0{width:calc(var(--spacing)*0)}.w-0\.5{width:calc(var(--spacing)*.5)}.w-1{width:calc(var(--spacing)*1)}.w-1\.5{width:calc(var(--spacing)*1.5)}.w-1\/2{width:50%}.w-1\/3{width:33.3333%}.w-2{width:calc(var(--spacing)*2)}.w-2\.5{width:calc(var(--spacing)*2.5)}.w-3{width:calc(var(--spacing)*3)}.w-3\.5{width:calc(var(--spacing)*3.5)}.w-4{width:calc(var(--spacing)*4)}.w-4\.5{width:calc(var(--spacing)*4.5)}.w-5{width:calc(var(--spacing)*5)}.w-5\/12{width:41.6667%}.w-6{width:calc(var(--spacing)*6)}.w-7{width:calc(var(--spacing)*7)}.w-7\/12{width:58.3333%}.w-8{width:calc(var(--spacing)*8)}.w-9{width:calc(var(--spacing)*9)}.w-10{width:calc(var(--spacing)*10)}.w-11{width:calc(var(--spacing)*11)}.w-12{width:calc(var(--spacing)*12)}.w-14{width:calc(var(--spacing)*14)}.w-16{width:calc(var(--spacing)*16)}.w-20{width:calc(var(--spacing)*20)}.w-24{width:calc(var(--spacing)*24)}.w-28{width:calc(var(--spacing)*28)}.w-32{width:calc(var(--spacing)*32)}.w-36{width:calc(var(--spacing)*36)}.w-40{width:calc(var(--spacing)*40)}.w-44{width:calc(var(--spacing)*44)}.w-48{width:calc(var(--spacing)*48)}.w-52{width:calc(var(--spacing)*52)}.w-56{width:calc(var(--spacing)*56)}.w-64{width:calc(var(--spacing)*64)}.w-72{width:calc(var(--spacing)*72)}.w-96{width:calc(var(--spacing)*96)}.w-\[18px\]{width:18px}.w-\[52px\]{width:52px}.w-\[216px\]{width:216px}.w-\[240px\]{width:240px}.w-\[300px\]{width:300px}.w-\[340px\]{width:340px}.w-\[420px\]{width:420px}.w-\[min\(1800px\,96vw\)\]{width:min(1800px,96vw)}.w-\[var\(--pc-i2\,0\.5rem\)\]{width:var(--pc-i2,.5rem)}.w-\[var\(--pc-i3\,0\.75rem\)\]{width:var(--pc-i3,.75rem)}.w-\[var\(--pc-i4\,1rem\)\]{width:var(--pc-i4,1rem)}.w-\[var\(--pc-i5\,1\.25rem\)\]{width:var(--pc-i5,1.25rem)}.w-\[var\(--pc-i7\,28px\)\]{width:var(--pc-i7,28px)}.w-\[var\(--pc-i25\,0\.625rem\)\]{width:var(--pc-i25,.625rem)}.w-\[var\(--pc-i35\,0\.875rem\)\]{width:var(--pc-i35,.875rem)}.w-auto{width:auto}.w-fit{width:fit-content}.w-full{width:100%}.w-max{width:max-content}.w-px{width:1px}.w-screen{width:100vw}.max-w-2xl{max-width:var(--container-2xl)}.max-w-3xl{max-width:var(--container-3xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-5xl{max-width:var(--container-5xl)}.max-w-6xl{max-width:var(--container-6xl)}.max-w-32{max-width:calc(var(--spacing)*32)}.max-w-\[14rem\]{max-width:14rem}.max-w-\[40\%\]{max-width:40%}.max-w-\[80px\]{max-width:80px}.max-w-\[86vh\]{max-width:86vh}.max-w-\[90vw\]{max-width:90vw}.max-w-\[100px\]{max-width:100px}.max-w-\[110px\]{max-width:110px}.max-w-\[120px\]{max-width:120px}.max-w-\[150px\]{max-width:150px}.max-w-\[160px\]{max-width:160px}.max-w-\[200px\]{max-width:200px}.max-w-\[220px\]{max-width:220px}.max-w-\[280px\]{max-width:280px}.max-w-\[980px\]{max-width:980px}.max-w-full{max-width:100%}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-none{max-width:none}.max-w-screen-2xl{max-width:var(--breakpoint-2xl)}.max-w-sm{max-width:var(--container-sm)}.max-w-xl{max-width:var(--container-xl)}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:calc(var(--spacing)*0)}.min-w-28{min-width:calc(var(--spacing)*28)}.min-w-40{min-width:calc(var(--spacing)*40)}.min-w-48{min-width:calc(var(--spacing)*48)}.min-w-\[10ch\]{min-width:10ch}.min-w-\[10rem\]{min-width:10rem}.min-w-\[12rem\]{min-width:12rem}.min-w-\[16ch\]{min-width:16ch}.min-w-\[16px\]{min-width:16px}.min-w-\[18px\]{min-width:18px}.min-w-\[32px\]{min-width:32px}.min-w-\[40px\]{min-width:40px}.min-w-\[48px\]{min-width:48px}.min-w-\[50px\]{min-width:50px}.min-w-\[80px\]{min-width:80px}.min-w-\[100px\]{min-width:100px}.min-w-\[120px\]{min-width:120px}.min-w-\[130px\]{min-width:130px}.min-w-\[140px\]{min-width:140px}.min-w-\[150px\]{min-width:150px}.min-w-\[160px\]{min-width:160px}.min-w-\[180px\]{min-width:180px}.min-w-\[200px\]{min-width:200px}.min-w-fit{min-width:fit-content}.min-w-full{min-width:100%}.flex-1{flex:1}.flex-\[0_1_auto\]{flex:0 auto}.flex-shrink{flex-shrink:1}.flex-shrink-0{flex-shrink:0}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.flex-grow,.grow{flex-grow:1}.table-fixed{table-layout:fixed}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x:calc(calc(1/2*100%)*-1);translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-x-full{--tw-translate-x:-100%;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-0{--tw-translate-x:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-0\.5{--tw-translate-x:calc(var(--spacing)*.5);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-1{--tw-translate-x:calc(var(--spacing)*1);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-3\.5{--tw-translate-x:calc(var(--spacing)*3.5);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-4{--tw-translate-x:calc(var(--spacing)*4);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-5{--tw-translate-x:calc(var(--spacing)*5);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-6{--tw-translate-x:calc(var(--spacing)*6);translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y:calc(calc(1/2*100%)*-1);translate:var(--tw-translate-x)var(--tw-translate-y)}.scale-105{--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x)var(--tw-scale-y)}.scale-110{--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x)var(--tw-scale-y)}.scale-\[1\.01\]{scale:1.01}.scale-\[1\.02\]{scale:1.02}.-rotate-90{rotate:-90deg}.rotate-45{rotate:45deg}.rotate-90{rotate:90deg}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-ping{animation:var(--animate-ping)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-col-resize{cursor:col-resize}.cursor-crosshair{cursor:crosshair}.cursor-default{cursor:default}.cursor-ew-resize{cursor:ew-resize}.cursor-grab{cursor:grab}.cursor-grabbing{cursor:grabbing}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.cursor-row-resize{cursor:row-resize}.cursor-se-resize{cursor:se-resize}.touch-none{touch-action:none}.resize{resize:both}.resize-none{resize:none}.resize-y{resize:vertical}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.\[appearance\:textfield\]{appearance:textfield}.appearance-none{appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.grid-cols-\[auto_1fr\]{grid-template-columns:auto 1fr}.grid-cols-\[auto_1fr_100px_100px_100px_minmax\(0\,200px\)_220px\]{grid-template-columns:auto 1fr 100px 100px 100px minmax(0,200px) 220px}.grid-cols-\[auto_1fr_120px_100px_100px_100px_minmax\(0\,200px\)_220px\]{grid-template-columns:auto 1fr 120px 100px 100px 100px minmax(0,200px) 220px}.grid-cols-\[minmax\(320px\,1fr\)_minmax\(340px\,0\.9fr\)\]{grid-template-columns:minmax(320px,1fr) minmax(340px,.9fr)}.grid-cols-\[repeat\(auto-fill\,minmax\(130px\,1fr\)\)\]{grid-template-columns:repeat(auto-fill,minmax(130px,1fr))}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-row{flex-direction:row}.flex-nowrap{flex-wrap:nowrap}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.items-stretch{align-items:stretch}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.justify-items-center{justify-items:center}.gap-0{gap:calc(var(--spacing)*0)}.gap-0\.5{gap:calc(var(--spacing)*.5)}.gap-1{gap:calc(var(--spacing)*1)}.gap-1\.5{gap:calc(var(--spacing)*1.5)}.gap-2{gap:calc(var(--spacing)*2)}.gap-2\.5{gap:calc(var(--spacing)*2.5)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.gap-5{gap:calc(var(--spacing)*5)}.gap-6{gap:calc(var(--spacing)*6)}.gap-8{gap:calc(var(--spacing)*8)}.gap-\[3px\]{gap:3px}.gap-\[20px\]{gap:20px}:where(.space-y-0>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*0)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*0)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*.5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1.5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2.5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*6)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*6)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*8)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*8)*calc(1 - var(--tw-space-y-reverse)))}.gap-x-2{column-gap:calc(var(--spacing)*2)}.gap-x-3{column-gap:calc(var(--spacing)*3)}.gap-x-4{column-gap:calc(var(--spacing)*4)}.gap-x-6{column-gap:calc(var(--spacing)*6)}.gap-y-0\.5{row-gap:calc(var(--spacing)*.5)}.gap-y-1{row-gap:calc(var(--spacing)*1)}.gap-y-1\.5{row-gap:calc(var(--spacing)*1.5)}.gap-y-2{row-gap:calc(var(--spacing)*2)}.gap-y-3{row-gap:calc(var(--spacing)*3)}.gap-y-4{row-gap:calc(var(--spacing)*4)}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px*var(--tw-divide-y-reverse));border-bottom-width:calc(1px*calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-bambu-dark-tertiary>:not(:last-child)),:where(.divide-bambu-dark-tertiary\/30>:not(:last-child)){border-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){:where(.divide-bambu-dark-tertiary\/30>:not(:last-child)){border-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)30%,transparent)}}:where(.divide-bambu-dark-tertiary\/40>:not(:last-child)){border-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){:where(.divide-bambu-dark-tertiary\/40>:not(:last-child)){border-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)40%,transparent)}}:where(.divide-bambu-gray\/20>:not(:last-child)){border-color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){:where(.divide-bambu-gray\/20>:not(:last-child)){border-color:color-mix(in oklab,var(--color-bambu-gray)20%,transparent)}}:where(.divide-gray-100>:not(:last-child)){border-color:var(--color-gray-100)}.self-start{align-self:flex-start}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-clip{overflow:clip}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-\[10px\]{border-radius:10px}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-none{border-radius:0}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.rounded-t-2xl{border-top-left-radius:var(--radius-2xl);border-top-right-radius:var(--radius-2xl)}.rounded-t-lg{border-top-left-radius:var(--radius-lg);border-top-right-radius:var(--radius-lg)}.rounded-t-xl{border-top-left-radius:var(--radius-xl);border-top-right-radius:var(--radius-xl)}.\!rounded-l-none{border-top-left-radius:0!important;border-bottom-left-radius:0!important}.rounded-l{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-l-lg{border-top-left-radius:var(--radius-lg);border-bottom-left-radius:var(--radius-lg)}.rounded-l-none{border-top-left-radius:0;border-bottom-left-radius:0}.rounded-tl{border-top-left-radius:.25rem}.\!rounded-r-none{border-top-right-radius:0!important;border-bottom-right-radius:0!important}.rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.rounded-r-lg{border-top-right-radius:var(--radius-lg);border-bottom-right-radius:var(--radius-lg)}.rounded-r-none{border-top-right-radius:0;border-bottom-right-radius:0}.rounded-b-2xl{border-bottom-right-radius:var(--radius-2xl);border-bottom-left-radius:var(--radius-2xl)}.rounded-b-lg{border-bottom-right-radius:var(--radius-lg);border-bottom-left-radius:var(--radius-lg)}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-4{border-style:var(--tw-border-style);border-width:4px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-0{border-top-style:var(--tw-border-style);border-top-width:0}.border-t-2{border-top-style:var(--tw-border-style);border-top-width:2px}.border-t-\[5px\]{border-top-style:var(--tw-border-style);border-top-width:5px}.border-t-\[6px\]{border-top-style:var(--tw-border-style);border-top-width:6px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-r-\[5px\]{border-right-style:var(--tw-border-style);border-right-width:5px}.border-r-\[6px\]{border-right-style:var(--tw-border-style);border-right-width:6px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-0{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-b-\[6px\]{border-bottom-style:var(--tw-border-style);border-bottom-width:6px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.border-l-\[3px\]{border-left-style:var(--tw-border-style);border-left-width:3px}.border-l-\[5px\]{border-left-style:var(--tw-border-style);border-left-width:5px}.border-l-\[6px\]{border-left-style:var(--tw-border-style);border-left-width:6px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-\[var\(--border-color\)\]{border-color:var(--border-color)}.border-amber-200{border-color:var(--color-amber-200)}.border-amber-300{border-color:var(--color-amber-300)}.border-amber-400\/20{border-color:#fcbb0033}@supports (color:color-mix(in lab, red, red)){.border-amber-400\/20{border-color:color-mix(in oklab,var(--color-amber-400)20%,transparent)}}.border-amber-500{border-color:var(--color-amber-500)}.border-amber-500\/20{border-color:#f99c0033}@supports (color:color-mix(in lab, red, red)){.border-amber-500\/20{border-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.border-amber-500\/30{border-color:#f99c004d}@supports (color:color-mix(in lab, red, red)){.border-amber-500\/30{border-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.border-amber-500\/40{border-color:#f99c0066}@supports (color:color-mix(in lab, red, red)){.border-amber-500\/40{border-color:color-mix(in oklab,var(--color-amber-500)40%,transparent)}}.border-amber-500\/60{border-color:#f99c0099}@supports (color:color-mix(in lab, red, red)){.border-amber-500\/60{border-color:color-mix(in oklab,var(--color-amber-500)60%,transparent)}}.border-bambu-dark{border-color:var(--color-bambu-dark)}.border-bambu-dark-secondary{border-color:var(--color-bambu-dark-secondary)}.border-bambu-dark-tertiary,.border-bambu-dark-tertiary\/20{border-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.border-bambu-dark-tertiary\/20{border-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)20%,transparent)}}.border-bambu-dark-tertiary\/30{border-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.border-bambu-dark-tertiary\/30{border-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)30%,transparent)}}.border-bambu-dark-tertiary\/40{border-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.border-bambu-dark-tertiary\/40{border-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)40%,transparent)}}.border-bambu-dark-tertiary\/50{border-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.border-bambu-dark-tertiary\/50{border-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)50%,transparent)}}.border-bambu-dark-tertiary\/60{border-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.border-bambu-dark-tertiary\/60{border-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)60%,transparent)}}.border-bambu-gray,.border-bambu-gray\/20{border-color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.border-bambu-gray\/20{border-color:color-mix(in oklab,var(--color-bambu-gray)20%,transparent)}}.border-bambu-gray\/30{border-color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.border-bambu-gray\/30{border-color:color-mix(in oklab,var(--color-bambu-gray)30%,transparent)}}.border-bambu-gray\/50{border-color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.border-bambu-gray\/50{border-color:color-mix(in oklab,var(--color-bambu-gray)50%,transparent)}}.border-bambu-green,.border-bambu-green\/20{border-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.border-bambu-green\/20{border-color:color-mix(in oklab,var(--color-bambu-green)20%,transparent)}}.border-bambu-green\/30{border-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.border-bambu-green\/30{border-color:color-mix(in oklab,var(--color-bambu-green)30%,transparent)}}.border-bambu-green\/40{border-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.border-bambu-green\/40{border-color:color-mix(in oklab,var(--color-bambu-green)40%,transparent)}}.border-bambu-green\/50{border-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.border-bambu-green\/50{border-color:color-mix(in oklab,var(--color-bambu-green)50%,transparent)}}.border-bambu-green\/60{border-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.border-bambu-green\/60{border-color:color-mix(in oklab,var(--color-bambu-green)60%,transparent)}}.border-black\/20{border-color:#0003}@supports (color:color-mix(in lab, red, red)){.border-black\/20{border-color:color-mix(in oklab,var(--color-black)20%,transparent)}}.border-blue-200{border-color:var(--color-blue-200)}.border-blue-300{border-color:var(--color-blue-300)}.border-blue-400{border-color:var(--color-blue-400)}.border-blue-400\/60{border-color:#54a2ff99}@supports (color:color-mix(in lab, red, red)){.border-blue-400\/60{border-color:color-mix(in oklab,var(--color-blue-400)60%,transparent)}}.border-blue-500{border-color:var(--color-blue-500)}.border-blue-500\/30{border-color:#3080ff4d}@supports (color:color-mix(in lab, red, red)){.border-blue-500\/30{border-color:color-mix(in oklab,var(--color-blue-500)30%,transparent)}}.border-blue-500\/50{border-color:#3080ff80}@supports (color:color-mix(in lab, red, red)){.border-blue-500\/50{border-color:color-mix(in oklab,var(--color-blue-500)50%,transparent)}}.border-current{border-color:currentColor}.border-cyan-300{border-color:var(--color-cyan-300)}.border-cyan-400{border-color:var(--color-cyan-400)}.border-cyan-400\/50{border-color:#00d2ef80}@supports (color:color-mix(in lab, red, red)){.border-cyan-400\/50{border-color:color-mix(in oklab,var(--color-cyan-400)50%,transparent)}}.border-emerald-200{border-color:var(--color-emerald-200)}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.border-gray-400\/20{border-color:#99a1af33}@supports (color:color-mix(in lab, red, red)){.border-gray-400\/20{border-color:color-mix(in oklab,var(--color-gray-400)20%,transparent)}}.border-gray-500{border-color:var(--color-gray-500)}.border-gray-500\/30{border-color:#6a72824d}@supports (color:color-mix(in lab, red, red)){.border-gray-500\/30{border-color:color-mix(in oklab,var(--color-gray-500)30%,transparent)}}.border-gray-500\/40{border-color:#6a728266}@supports (color:color-mix(in lab, red, red)){.border-gray-500\/40{border-color:color-mix(in oklab,var(--color-gray-500)40%,transparent)}}.border-gray-700{border-color:var(--color-gray-700)}.border-gray-800{border-color:var(--color-gray-800)}.border-green-200{border-color:var(--color-green-200)}.border-green-300{border-color:var(--color-green-300)}.border-green-400{border-color:var(--color-green-400)}.border-green-400\/60{border-color:#05df7299}@supports (color:color-mix(in lab, red, red)){.border-green-400\/60{border-color:color-mix(in oklab,var(--color-green-400)60%,transparent)}}.border-green-500{border-color:var(--color-green-500)}.border-green-500\/30{border-color:#00c7584d}@supports (color:color-mix(in lab, red, red)){.border-green-500\/30{border-color:color-mix(in oklab,var(--color-green-500)30%,transparent)}}.border-green-500\/40{border-color:#00c75866}@supports (color:color-mix(in lab, red, red)){.border-green-500\/40{border-color:color-mix(in oklab,var(--color-green-500)40%,transparent)}}.border-green-800{border-color:var(--color-green-800)}.border-orange-200{border-color:var(--color-orange-200)}.border-orange-300{border-color:var(--color-orange-300)}.border-orange-400\/60{border-color:#ff8b1a99}@supports (color:color-mix(in lab, red, red)){.border-orange-400\/60{border-color:color-mix(in oklab,var(--color-orange-400)60%,transparent)}}.border-orange-500{border-color:var(--color-orange-500)}.border-orange-500\/30{border-color:#fe6e004d}@supports (color:color-mix(in lab, red, red)){.border-orange-500\/30{border-color:color-mix(in oklab,var(--color-orange-500)30%,transparent)}}.border-purple-200{border-color:var(--color-purple-200)}.border-purple-300{border-color:var(--color-purple-300)}.border-purple-400\/60{border-color:#c07eff99}@supports (color:color-mix(in lab, red, red)){.border-purple-400\/60{border-color:color-mix(in oklab,var(--color-purple-400)60%,transparent)}}.border-purple-500{border-color:var(--color-purple-500)}.border-red-200{border-color:var(--color-red-200)}.border-red-300{border-color:var(--color-red-300)}.border-red-400{border-color:var(--color-red-400)}.border-red-400\/60{border-color:#ff656899}@supports (color:color-mix(in lab, red, red)){.border-red-400\/60{border-color:color-mix(in oklab,var(--color-red-400)60%,transparent)}}.border-red-500{border-color:var(--color-red-500)}.border-red-500\/20{border-color:#fb2c3633}@supports (color:color-mix(in lab, red, red)){.border-red-500\/20{border-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.border-red-500\/30{border-color:#fb2c364d}@supports (color:color-mix(in lab, red, red)){.border-red-500\/30{border-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.border-red-500\/40{border-color:#fb2c3666}@supports (color:color-mix(in lab, red, red)){.border-red-500\/40{border-color:color-mix(in oklab,var(--color-red-500)40%,transparent)}}.border-red-500\/50{border-color:#fb2c3680}@supports (color:color-mix(in lab, red, red)){.border-red-500\/50{border-color:color-mix(in oklab,var(--color-red-500)50%,transparent)}}.border-red-700{border-color:var(--color-red-700)}.border-red-800{border-color:var(--color-red-800)}.border-red-800\/70{border-color:#9f0712b3}@supports (color:color-mix(in lab, red, red)){.border-red-800\/70{border-color:color-mix(in oklab,var(--color-red-800)70%,transparent)}}.border-red-900\/40{border-color:#82181a66}@supports (color:color-mix(in lab, red, red)){.border-red-900\/40{border-color:color-mix(in oklab,var(--color-red-900)40%,transparent)}}.border-slate-500{border-color:var(--color-slate-500)}.border-status-error\/20{border-color:var(--color-status-error)}@supports (color:color-mix(in lab, red, red)){.border-status-error\/20{border-color:color-mix(in oklab,var(--color-status-error)20%,transparent)}}.border-status-ok,.border-status-ok\/20{border-color:var(--color-status-ok)}@supports (color:color-mix(in lab, red, red)){.border-status-ok\/20{border-color:color-mix(in oklab,var(--color-status-ok)20%,transparent)}}.border-status-warning\/20{border-color:var(--color-status-warning)}@supports (color:color-mix(in lab, red, red)){.border-status-warning\/20{border-color:color-mix(in oklab,var(--color-status-warning)20%,transparent)}}.border-teal-400\/60{border-color:#00d3bd99}@supports (color:color-mix(in lab, red, red)){.border-teal-400\/60{border-color:color-mix(in oklab,var(--color-teal-400)60%,transparent)}}.border-transparent{border-color:#0000}.border-white{border-color:var(--color-white)}.border-white\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab, red, red)){.border-white\/10{border-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.border-white\/15{border-color:#ffffff26}@supports (color:color-mix(in lab, red, red)){.border-white\/15{border-color:color-mix(in oklab,var(--color-white)15%,transparent)}}.border-white\/20{border-color:#fff3}@supports (color:color-mix(in lab, red, red)){.border-white\/20{border-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.border-white\/30{border-color:#ffffff4d}@supports (color:color-mix(in lab, red, red)){.border-white\/30{border-color:color-mix(in oklab,var(--color-white)30%,transparent)}}.border-yellow-200{border-color:var(--color-yellow-200)}.border-yellow-300{border-color:var(--color-yellow-300)}.border-yellow-400{border-color:var(--color-yellow-400)}.border-yellow-500{border-color:var(--color-yellow-500)}.border-yellow-500\/30{border-color:#edb2004d}@supports (color:color-mix(in lab, red, red)){.border-yellow-500\/30{border-color:color-mix(in oklab,var(--color-yellow-500)30%,transparent)}}.border-yellow-500\/40{border-color:#edb20066}@supports (color:color-mix(in lab, red, red)){.border-yellow-500\/40{border-color:color-mix(in oklab,var(--color-yellow-500)40%,transparent)}}.border-yellow-500\/50{border-color:#edb20080}@supports (color:color-mix(in lab, red, red)){.border-yellow-500\/50{border-color:color-mix(in oklab,var(--color-yellow-500)50%,transparent)}}.border-zinc-500{border-color:var(--color-zinc-500)}.border-zinc-600{border-color:var(--color-zinc-600)}.border-zinc-700{border-color:var(--color-zinc-700)}.border-zinc-700\/50{border-color:#3f3f4680}@supports (color:color-mix(in lab, red, red)){.border-zinc-700\/50{border-color:color-mix(in oklab,var(--color-zinc-700)50%,transparent)}}.border-t-bambu-dark-tertiary{border-top-color:var(--color-bambu-dark-tertiary)}.border-t-transparent{border-top-color:#0000}.border-r-transparent{border-right-color:#0000}.border-b-bambu-dark-tertiary{border-bottom-color:var(--color-bambu-dark-tertiary)}.border-l-blue-500{border-left-color:var(--color-blue-500)}.border-l-cyan-400{border-left-color:var(--color-cyan-400)}.border-l-emerald-500{border-left-color:var(--color-emerald-500)}.border-l-gray-500{border-left-color:var(--color-gray-500)}.border-l-red-500{border-left-color:var(--color-red-500)}.border-l-transparent{border-left-color:#0000}.border-l-yellow-500{border-left-color:var(--color-yellow-500)}.\!bg-bambu-green{background-color:var(--color-bambu-green)!important}.bg-amber-50{background-color:var(--color-amber-50)}.bg-amber-100{background-color:var(--color-amber-100)}.bg-amber-100\/60{background-color:#fef3c699}@supports (color:color-mix(in lab, red, red)){.bg-amber-100\/60{background-color:color-mix(in oklab,var(--color-amber-100)60%,transparent)}}.bg-amber-400{background-color:var(--color-amber-400)}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/5{background-color:#f99c000d}@supports (color:color-mix(in lab, red, red)){.bg-amber-500\/5{background-color:color-mix(in oklab,var(--color-amber-500)5%,transparent)}}.bg-amber-500\/10{background-color:#f99c001a}@supports (color:color-mix(in lab, red, red)){.bg-amber-500\/10{background-color:color-mix(in oklab,var(--color-amber-500)10%,transparent)}}.bg-amber-500\/20{background-color:#f99c0033}@supports (color:color-mix(in lab, red, red)){.bg-amber-500\/20{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.bg-amber-500\/70{background-color:#f99c00b3}@supports (color:color-mix(in lab, red, red)){.bg-amber-500\/70{background-color:color-mix(in oklab,var(--color-amber-500)70%,transparent)}}.bg-amber-500\/85{background-color:#f99c00d9}@supports (color:color-mix(in lab, red, red)){.bg-amber-500\/85{background-color:color-mix(in oklab,var(--color-amber-500)85%,transparent)}}.bg-amber-500\/90{background-color:#f99c00e6}@supports (color:color-mix(in lab, red, red)){.bg-amber-500\/90{background-color:color-mix(in oklab,var(--color-amber-500)90%,transparent)}}.bg-amber-600{background-color:var(--color-amber-600)}.bg-amber-700{background-color:var(--color-amber-700)}.bg-amber-900\/30{background-color:#7b33064d}@supports (color:color-mix(in lab, red, red)){.bg-amber-900\/30{background-color:color-mix(in oklab,var(--color-amber-900)30%,transparent)}}.bg-bambu-dark{background-color:var(--color-bambu-dark)}.bg-bambu-dark-secondary,.bg-bambu-dark-secondary\/30{background-color:var(--color-bambu-dark-secondary)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark-secondary\/30{background-color:color-mix(in oklab,var(--color-bambu-dark-secondary)30%,transparent)}}.bg-bambu-dark-secondary\/50{background-color:var(--color-bambu-dark-secondary)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark-secondary\/50{background-color:color-mix(in oklab,var(--color-bambu-dark-secondary)50%,transparent)}}.bg-bambu-dark-secondary\/60{background-color:var(--color-bambu-dark-secondary)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark-secondary\/60{background-color:color-mix(in oklab,var(--color-bambu-dark-secondary)60%,transparent)}}.bg-bambu-dark-secondary\/90{background-color:var(--color-bambu-dark-secondary)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark-secondary\/90{background-color:color-mix(in oklab,var(--color-bambu-dark-secondary)90%,transparent)}}.bg-bambu-dark-secondary\/95{background-color:var(--color-bambu-dark-secondary)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark-secondary\/95{background-color:color-mix(in oklab,var(--color-bambu-dark-secondary)95%,transparent)}}.bg-bambu-dark-tertiary,.bg-bambu-dark-tertiary\/10{background-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark-tertiary\/10{background-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)10%,transparent)}}.bg-bambu-dark-tertiary\/20{background-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark-tertiary\/20{background-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)20%,transparent)}}.bg-bambu-dark-tertiary\/30{background-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark-tertiary\/30{background-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)30%,transparent)}}.bg-bambu-dark-tertiary\/40{background-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark-tertiary\/40{background-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)40%,transparent)}}.bg-bambu-dark-tertiary\/50{background-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark-tertiary\/50{background-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)50%,transparent)}}.bg-bambu-dark-tertiary\/70{background-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark-tertiary\/70{background-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)70%,transparent)}}.bg-bambu-dark-tertiary\/80{background-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark-tertiary\/80{background-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)80%,transparent)}}.bg-bambu-dark\/20{background-color:var(--color-bambu-dark)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark\/20{background-color:color-mix(in oklab,var(--color-bambu-dark)20%,transparent)}}.bg-bambu-dark\/30{background-color:var(--color-bambu-dark)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark\/30{background-color:color-mix(in oklab,var(--color-bambu-dark)30%,transparent)}}.bg-bambu-dark\/40{background-color:var(--color-bambu-dark)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark\/40{background-color:color-mix(in oklab,var(--color-bambu-dark)40%,transparent)}}.bg-bambu-dark\/50{background-color:var(--color-bambu-dark)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark\/50{background-color:color-mix(in oklab,var(--color-bambu-dark)50%,transparent)}}.bg-bambu-dark\/60{background-color:var(--color-bambu-dark)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark\/60{background-color:color-mix(in oklab,var(--color-bambu-dark)60%,transparent)}}.bg-bambu-dark\/80{background-color:var(--color-bambu-dark)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark\/80{background-color:color-mix(in oklab,var(--color-bambu-dark)80%,transparent)}}.bg-bambu-dark\/85{background-color:var(--color-bambu-dark)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark\/85{background-color:color-mix(in oklab,var(--color-bambu-dark)85%,transparent)}}.bg-bambu-dark\/90{background-color:var(--color-bambu-dark)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark\/90{background-color:color-mix(in oklab,var(--color-bambu-dark)90%,transparent)}}.bg-bambu-gray,.bg-bambu-gray\/10{background-color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-gray\/10{background-color:color-mix(in oklab,var(--color-bambu-gray)10%,transparent)}}.bg-bambu-gray\/20{background-color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-gray\/20{background-color:color-mix(in oklab,var(--color-bambu-gray)20%,transparent)}}.bg-bambu-gray\/25{background-color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-gray\/25{background-color:color-mix(in oklab,var(--color-bambu-gray)25%,transparent)}}.bg-bambu-gray\/30{background-color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-gray\/30{background-color:color-mix(in oklab,var(--color-bambu-gray)30%,transparent)}}.bg-bambu-gray\/40{background-color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-gray\/40{background-color:color-mix(in oklab,var(--color-bambu-gray)40%,transparent)}}.bg-bambu-gray\/50{background-color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-gray\/50{background-color:color-mix(in oklab,var(--color-bambu-gray)50%,transparent)}}.bg-bambu-gray\/90{background-color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-gray\/90{background-color:color-mix(in oklab,var(--color-bambu-gray)90%,transparent)}}.bg-bambu-green,.bg-bambu-green\/5{background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-green\/5{background-color:color-mix(in oklab,var(--color-bambu-green)5%,transparent)}}.bg-bambu-green\/10{background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-green\/10{background-color:color-mix(in oklab,var(--color-bambu-green)10%,transparent)}}.bg-bambu-green\/15{background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-green\/15{background-color:color-mix(in oklab,var(--color-bambu-green)15%,transparent)}}.bg-bambu-green\/20{background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-green\/20{background-color:color-mix(in oklab,var(--color-bambu-green)20%,transparent)}}.bg-bambu-green\/30{background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-green\/30{background-color:color-mix(in oklab,var(--color-bambu-green)30%,transparent)}}.bg-bambu-green\/50{background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-green\/50{background-color:color-mix(in oklab,var(--color-bambu-green)50%,transparent)}}.bg-bambu-green\/75{background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-green\/75{background-color:color-mix(in oklab,var(--color-bambu-green)75%,transparent)}}.bg-bambu-green\/80{background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-green\/80{background-color:color-mix(in oklab,var(--color-bambu-green)80%,transparent)}}.bg-bambu-green\/85{background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-green\/85{background-color:color-mix(in oklab,var(--color-bambu-green)85%,transparent)}}.bg-bambu-green\/90{background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-green\/90{background-color:color-mix(in oklab,var(--color-bambu-green)90%,transparent)}}.bg-black{background-color:var(--color-black)}.bg-black\/10{background-color:#0000001a}@supports (color:color-mix(in lab, red, red)){.bg-black\/10{background-color:color-mix(in oklab,var(--color-black)10%,transparent)}}.bg-black\/15{background-color:#00000026}@supports (color:color-mix(in lab, red, red)){.bg-black\/15{background-color:color-mix(in oklab,var(--color-black)15%,transparent)}}.bg-black\/20{background-color:#0003}@supports (color:color-mix(in lab, red, red)){.bg-black\/20{background-color:color-mix(in oklab,var(--color-black)20%,transparent)}}.bg-black\/30{background-color:#0000004d}@supports (color:color-mix(in lab, red, red)){.bg-black\/30{background-color:color-mix(in oklab,var(--color-black)30%,transparent)}}.bg-black\/40{background-color:#0006}@supports (color:color-mix(in lab, red, red)){.bg-black\/40{background-color:color-mix(in oklab,var(--color-black)40%,transparent)}}.bg-black\/45{background-color:#00000073}@supports (color:color-mix(in lab, red, red)){.bg-black\/45{background-color:color-mix(in oklab,var(--color-black)45%,transparent)}}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab, red, red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black)50%,transparent)}}.bg-black\/55{background-color:#0000008c}@supports (color:color-mix(in lab, red, red)){.bg-black\/55{background-color:color-mix(in oklab,var(--color-black)55%,transparent)}}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab, red, red)){.bg-black\/60{background-color:color-mix(in oklab,var(--color-black)60%,transparent)}}.bg-black\/65{background-color:#000000a6}@supports (color:color-mix(in lab, red, red)){.bg-black\/65{background-color:color-mix(in oklab,var(--color-black)65%,transparent)}}.bg-black\/70{background-color:#000000b3}@supports (color:color-mix(in lab, red, red)){.bg-black\/70{background-color:color-mix(in oklab,var(--color-black)70%,transparent)}}.bg-black\/80{background-color:#000c}@supports (color:color-mix(in lab, red, red)){.bg-black\/80{background-color:color-mix(in oklab,var(--color-black)80%,transparent)}}.bg-black\/90{background-color:#000000e6}@supports (color:color-mix(in lab, red, red)){.bg-black\/90{background-color:color-mix(in oklab,var(--color-black)90%,transparent)}}.bg-blue-50{background-color:var(--color-blue-50)}.bg-blue-100{background-color:var(--color-blue-100)}.bg-blue-300{background-color:var(--color-blue-300)}.bg-blue-400{background-color:var(--color-blue-400)}.bg-blue-500{background-color:var(--color-blue-500)}.bg-blue-500\/5{background-color:#3080ff0d}@supports (color:color-mix(in lab, red, red)){.bg-blue-500\/5{background-color:color-mix(in oklab,var(--color-blue-500)5%,transparent)}}.bg-blue-500\/10{background-color:#3080ff1a}@supports (color:color-mix(in lab, red, red)){.bg-blue-500\/10{background-color:color-mix(in oklab,var(--color-blue-500)10%,transparent)}}.bg-blue-500\/20{background-color:#3080ff33}@supports (color:color-mix(in lab, red, red)){.bg-blue-500\/20{background-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.bg-blue-500\/30{background-color:#3080ff4d}@supports (color:color-mix(in lab, red, red)){.bg-blue-500\/30{background-color:color-mix(in oklab,var(--color-blue-500)30%,transparent)}}.bg-blue-500\/90{background-color:#3080ffe6}@supports (color:color-mix(in lab, red, red)){.bg-blue-500\/90{background-color:color-mix(in oklab,var(--color-blue-500)90%,transparent)}}.bg-blue-600{background-color:var(--color-blue-600)}.bg-blue-700{background-color:var(--color-blue-700)}.bg-cyan-100{background-color:var(--color-cyan-100)}.bg-cyan-500{background-color:var(--color-cyan-500)}.bg-cyan-500\/20{background-color:#00b7d733}@supports (color:color-mix(in lab, red, red)){.bg-cyan-500\/20{background-color:color-mix(in oklab,var(--color-cyan-500)20%,transparent)}}.bg-emerald-50{background-color:var(--color-emerald-50)}.bg-emerald-100{background-color:var(--color-emerald-100)}.bg-emerald-700{background-color:var(--color-emerald-700)}.bg-fuchsia-100{background-color:var(--color-fuchsia-100)}.bg-fuchsia-500{background-color:var(--color-fuchsia-500)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-400{background-color:var(--color-gray-400)}.bg-gray-400\/10{background-color:#99a1af1a}@supports (color:color-mix(in lab, red, red)){.bg-gray-400\/10{background-color:color-mix(in oklab,var(--color-gray-400)10%,transparent)}}.bg-gray-500{background-color:var(--color-gray-500)}.bg-gray-500\/15{background-color:#6a728226}@supports (color:color-mix(in lab, red, red)){.bg-gray-500\/15{background-color:color-mix(in oklab,var(--color-gray-500)15%,transparent)}}.bg-gray-500\/20{background-color:#6a728233}@supports (color:color-mix(in lab, red, red)){.bg-gray-500\/20{background-color:color-mix(in oklab,var(--color-gray-500)20%,transparent)}}.bg-gray-600{background-color:var(--color-gray-600)}.bg-gray-800{background-color:var(--color-gray-800)}.bg-gray-900{background-color:var(--color-gray-900)}.bg-green-50{background-color:var(--color-green-50)}.bg-green-100{background-color:var(--color-green-100)}.bg-green-400{background-color:var(--color-green-400)}.bg-green-500{background-color:var(--color-green-500)}.bg-green-500\/10{background-color:#00c7581a}@supports (color:color-mix(in lab, red, red)){.bg-green-500\/10{background-color:color-mix(in oklab,var(--color-green-500)10%,transparent)}}.bg-green-500\/15{background-color:#00c75826}@supports (color:color-mix(in lab, red, red)){.bg-green-500\/15{background-color:color-mix(in oklab,var(--color-green-500)15%,transparent)}}.bg-green-500\/20{background-color:#00c75833}@supports (color:color-mix(in lab, red, red)){.bg-green-500\/20{background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.bg-green-600{background-color:var(--color-green-600)}.bg-green-600\/20{background-color:#00a54433}@supports (color:color-mix(in lab, red, red)){.bg-green-600\/20{background-color:color-mix(in oklab,var(--color-green-600)20%,transparent)}}.bg-green-600\/40{background-color:#00a54466}@supports (color:color-mix(in lab, red, red)){.bg-green-600\/40{background-color:color-mix(in oklab,var(--color-green-600)40%,transparent)}}.bg-green-700{background-color:var(--color-green-700)}.bg-green-900\/30{background-color:#0d542b4d}@supports (color:color-mix(in lab, red, red)){.bg-green-900\/30{background-color:color-mix(in oklab,var(--color-green-900)30%,transparent)}}.bg-green-900\/50{background-color:#0d542b80}@supports (color:color-mix(in lab, red, red)){.bg-green-900\/50{background-color:color-mix(in oklab,var(--color-green-900)50%,transparent)}}.bg-indigo-50{background-color:var(--color-indigo-50)}.bg-indigo-100{background-color:var(--color-indigo-100)}.bg-lime-100{background-color:var(--color-lime-100)}.bg-lime-500{background-color:var(--color-lime-500)}.bg-orange-50{background-color:var(--color-orange-50)}.bg-orange-100{background-color:var(--color-orange-100)}.bg-orange-500{background-color:var(--color-orange-500)}.bg-orange-500\/10{background-color:#fe6e001a}@supports (color:color-mix(in lab, red, red)){.bg-orange-500\/10{background-color:color-mix(in oklab,var(--color-orange-500)10%,transparent)}}.bg-orange-500\/20{background-color:#fe6e0033}@supports (color:color-mix(in lab, red, red)){.bg-orange-500\/20{background-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.bg-orange-600{background-color:var(--color-orange-600)}.bg-pink-100{background-color:var(--color-pink-100)}.bg-purple-50{background-color:var(--color-purple-50)}.bg-purple-100{background-color:var(--color-purple-100)}.bg-purple-500{background-color:var(--color-purple-500)}.bg-purple-500\/80{background-color:#ac4bffcc}@supports (color:color-mix(in lab, red, red)){.bg-purple-500\/80{background-color:color-mix(in oklab,var(--color-purple-500)80%,transparent)}}.bg-purple-500\/90{background-color:#ac4bffe6}@supports (color:color-mix(in lab, red, red)){.bg-purple-500\/90{background-color:color-mix(in oklab,var(--color-purple-500)90%,transparent)}}.bg-purple-700{background-color:var(--color-purple-700)}.bg-red-50{background-color:var(--color-red-50)}.bg-red-100{background-color:var(--color-red-100)}.bg-red-400{background-color:var(--color-red-400)}.bg-red-500{background-color:var(--color-red-500)}.bg-red-500\/5{background-color:#fb2c360d}@supports (color:color-mix(in lab, red, red)){.bg-red-500\/5{background-color:color-mix(in oklab,var(--color-red-500)5%,transparent)}}.bg-red-500\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab, red, red)){.bg-red-500\/10{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.bg-red-500\/20{background-color:#fb2c3633}@supports (color:color-mix(in lab, red, red)){.bg-red-500\/20{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.bg-red-500\/30{background-color:#fb2c364d}@supports (color:color-mix(in lab, red, red)){.bg-red-500\/30{background-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.bg-red-500\/40{background-color:#fb2c3666}@supports (color:color-mix(in lab, red, red)){.bg-red-500\/40{background-color:color-mix(in oklab,var(--color-red-500)40%,transparent)}}.bg-red-500\/80{background-color:#fb2c36cc}@supports (color:color-mix(in lab, red, red)){.bg-red-500\/80{background-color:color-mix(in oklab,var(--color-red-500)80%,transparent)}}.bg-red-500\/85{background-color:#fb2c36d9}@supports (color:color-mix(in lab, red, red)){.bg-red-500\/85{background-color:color-mix(in oklab,var(--color-red-500)85%,transparent)}}.bg-red-500\/90{background-color:#fb2c36e6}@supports (color:color-mix(in lab, red, red)){.bg-red-500\/90{background-color:color-mix(in oklab,var(--color-red-500)90%,transparent)}}.bg-red-600{background-color:var(--color-red-600)}.bg-red-600\/20{background-color:#e4001433}@supports (color:color-mix(in lab, red, red)){.bg-red-600\/20{background-color:color-mix(in oklab,var(--color-red-600)20%,transparent)}}.bg-red-700{background-color:var(--color-red-700)}.bg-red-900\/20{background-color:#82181a33}@supports (color:color-mix(in lab, red, red)){.bg-red-900\/20{background-color:color-mix(in oklab,var(--color-red-900)20%,transparent)}}.bg-red-900\/30{background-color:#82181a4d}@supports (color:color-mix(in lab, red, red)){.bg-red-900\/30{background-color:color-mix(in oklab,var(--color-red-900)30%,transparent)}}.bg-red-950\/70{background-color:#460809b3}@supports (color:color-mix(in lab, red, red)){.bg-red-950\/70{background-color:color-mix(in oklab,var(--color-red-950)70%,transparent)}}.bg-rose-100{background-color:var(--color-rose-100)}.bg-rose-900{background-color:var(--color-rose-900)}.bg-sky-50{background-color:var(--color-sky-50)}.bg-sky-100{background-color:var(--color-sky-100)}.bg-sky-500{background-color:var(--color-sky-500)}.bg-sky-500\/80{background-color:#00a5efcc}@supports (color:color-mix(in lab, red, red)){.bg-sky-500\/80{background-color:color-mix(in oklab,var(--color-sky-500)80%,transparent)}}.bg-sky-700{background-color:var(--color-sky-700)}.bg-slate-100{background-color:var(--color-slate-100)}.bg-slate-700{background-color:var(--color-slate-700)}.bg-status-error,.bg-status-error\/10{background-color:var(--color-status-error)}@supports (color:color-mix(in lab, red, red)){.bg-status-error\/10{background-color:color-mix(in oklab,var(--color-status-error)10%,transparent)}}.bg-status-error\/20{background-color:var(--color-status-error)}@supports (color:color-mix(in lab, red, red)){.bg-status-error\/20{background-color:color-mix(in oklab,var(--color-status-error)20%,transparent)}}.bg-status-error\/80{background-color:var(--color-status-error)}@supports (color:color-mix(in lab, red, red)){.bg-status-error\/80{background-color:color-mix(in oklab,var(--color-status-error)80%,transparent)}}.bg-status-ok,.bg-status-ok\/10{background-color:var(--color-status-ok)}@supports (color:color-mix(in lab, red, red)){.bg-status-ok\/10{background-color:color-mix(in oklab,var(--color-status-ok)10%,transparent)}}.bg-status-ok\/20{background-color:var(--color-status-ok)}@supports (color:color-mix(in lab, red, red)){.bg-status-ok\/20{background-color:color-mix(in oklab,var(--color-status-ok)20%,transparent)}}.bg-status-warning,.bg-status-warning\/10{background-color:var(--color-status-warning)}@supports (color:color-mix(in lab, red, red)){.bg-status-warning\/10{background-color:color-mix(in oklab,var(--color-status-warning)10%,transparent)}}.bg-status-warning\/20{background-color:var(--color-status-warning)}@supports (color:color-mix(in lab, red, red)){.bg-status-warning\/20{background-color:color-mix(in oklab,var(--color-status-warning)20%,transparent)}}.bg-teal-100{background-color:var(--color-teal-100)}.bg-teal-500{background-color:var(--color-teal-500)}.bg-teal-500\/20{background-color:#00baa733}@supports (color:color-mix(in lab, red, red)){.bg-teal-500\/20{background-color:color-mix(in oklab,var(--color-teal-500)20%,transparent)}}.bg-teal-500\/90{background-color:#00baa7e6}@supports (color:color-mix(in lab, red, red)){.bg-teal-500\/90{background-color:color-mix(in oklab,var(--color-teal-500)90%,transparent)}}.bg-transparent{background-color:#0000}.bg-violet-500{background-color:var(--color-violet-500)}.bg-white{background-color:var(--color-white)}.bg-white\/10{background-color:#ffffff1a}@supports (color:color-mix(in lab, red, red)){.bg-white\/10{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.bg-white\/20{background-color:#fff3}@supports (color:color-mix(in lab, red, red)){.bg-white\/20{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.bg-white\/50{background-color:#ffffff80}@supports (color:color-mix(in lab, red, red)){.bg-white\/50{background-color:color-mix(in oklab,var(--color-white)50%,transparent)}}.bg-white\/70{background-color:#ffffffb3}@supports (color:color-mix(in lab, red, red)){.bg-white\/70{background-color:color-mix(in oklab,var(--color-white)70%,transparent)}}.bg-white\/90{background-color:#ffffffe6}@supports (color:color-mix(in lab, red, red)){.bg-white\/90{background-color:color-mix(in oklab,var(--color-white)90%,transparent)}}.bg-yellow-50{background-color:var(--color-yellow-50)}.bg-yellow-100{background-color:var(--color-yellow-100)}.bg-yellow-400{background-color:var(--color-yellow-400)}.bg-yellow-500{background-color:var(--color-yellow-500)}.bg-yellow-500\/5{background-color:#edb2000d}@supports (color:color-mix(in lab, red, red)){.bg-yellow-500\/5{background-color:color-mix(in oklab,var(--color-yellow-500)5%,transparent)}}.bg-yellow-500\/10{background-color:#edb2001a}@supports (color:color-mix(in lab, red, red)){.bg-yellow-500\/10{background-color:color-mix(in oklab,var(--color-yellow-500)10%,transparent)}}.bg-yellow-500\/20{background-color:#edb20033}@supports (color:color-mix(in lab, red, red)){.bg-yellow-500\/20{background-color:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.bg-yellow-700{background-color:var(--color-yellow-700)}.bg-zinc-600{background-color:var(--color-zinc-600)}.bg-zinc-700{background-color:var(--color-zinc-700)}.bg-zinc-800{background-color:var(--color-zinc-800)}.bg-zinc-800\/50{background-color:#27272a80}@supports (color:color-mix(in lab, red, red)){.bg-zinc-800\/50{background-color:color-mix(in oklab,var(--color-zinc-800)50%,transparent)}}.bg-zinc-800\/60{background-color:#27272a99}@supports (color:color-mix(in lab, red, red)){.bg-zinc-800\/60{background-color:color-mix(in oklab,var(--color-zinc-800)60%,transparent)}}.bg-zinc-900{background-color:var(--color-zinc-900)}.bg-zinc-900\/50{background-color:#18181b80}@supports (color:color-mix(in lab, red, red)){.bg-zinc-900\/50{background-color:color-mix(in oklab,var(--color-zinc-900)50%,transparent)}}.bg-gradient-to-b{--tw-gradient-position:to bottom in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-t{--tw-gradient-position:to top in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-bambu-dark-secondary{--tw-gradient-from:var(--color-bambu-dark-secondary);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-bambu-green\/15{--tw-gradient-from:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.from-bambu-green\/15{--tw-gradient-from:color-mix(in oklab,var(--color-bambu-green)15%,transparent)}}.from-bambu-green\/15{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-black\/80{--tw-gradient-from:#000c}@supports (color:color-mix(in lab, red, red)){.from-black\/80{--tw-gradient-from:color-mix(in oklab,var(--color-black)80%,transparent)}}.from-black\/80{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-black\/85{--tw-gradient-from:#000000d9}@supports (color:color-mix(in lab, red, red)){.from-black\/85{--tw-gradient-from:color-mix(in oklab,var(--color-black)85%,transparent)}}.from-black\/85{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-blue-500\/5{--tw-gradient-from:#3080ff0d}@supports (color:color-mix(in lab, red, red)){.from-blue-500\/5{--tw-gradient-from:color-mix(in oklab,var(--color-blue-500)5%,transparent)}}.from-blue-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-white\/10{--tw-gradient-from:#ffffff1a}@supports (color:color-mix(in lab, red, red)){.from-white\/10{--tw-gradient-from:color-mix(in oklab,var(--color-white)10%,transparent)}}.from-white\/10{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.via-bambu-green\/5{--tw-gradient-via:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.via-bambu-green\/5{--tw-gradient-via:color-mix(in oklab,var(--color-bambu-green)5%,transparent)}}.via-bambu-green\/5{--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.via-black\/55{--tw-gradient-via:#0000008c}@supports (color:color-mix(in lab, red, red)){.via-black\/55{--tw-gradient-via:color-mix(in oklab,var(--color-black)55%,transparent)}}.via-black\/55{--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.via-black\/60{--tw-gradient-via:#0009}@supports (color:color-mix(in lab, red, red)){.via-black\/60{--tw-gradient-via:color-mix(in oklab,var(--color-black)60%,transparent)}}.via-black\/60{--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-bambu-dark-secondary{--tw-gradient-to:var(--color-bambu-dark-secondary);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-bambu-dark-tertiary{--tw-gradient-to:var(--color-bambu-dark-tertiary);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-transparent{--tw-gradient-to:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.bg-cover{background-size:cover}.bg-center{background-position:50%}.fill-yellow-400{fill:var(--color-yellow-400)}.object-contain{object-fit:contain}.object-cover{object-fit:cover}.object-left{object-position:left}.p-0{padding:calc(var(--spacing)*0)}.p-0\.5{padding:calc(var(--spacing)*.5)}.p-1{padding:calc(var(--spacing)*1)}.p-1\.5{padding:calc(var(--spacing)*1.5)}.p-2{padding:calc(var(--spacing)*2)}.p-2\.5{padding:calc(var(--spacing)*2.5)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-5{padding:calc(var(--spacing)*5)}.p-6{padding:calc(var(--spacing)*6)}.p-8{padding:calc(var(--spacing)*8)}.p-12{padding:calc(var(--spacing)*12)}.\!px-0{padding-inline:calc(var(--spacing)*0)!important}.\!px-2{padding-inline:calc(var(--spacing)*2)!important}.\!px-3{padding-inline:calc(var(--spacing)*3)!important}.px-1{padding-inline:calc(var(--spacing)*1)}.px-1\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-2\.5{padding-inline:calc(var(--spacing)*2.5)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-5{padding-inline:calc(var(--spacing)*5)}.px-6{padding-inline:calc(var(--spacing)*6)}.\!py-0{padding-block:calc(var(--spacing)*0)!important}.py-0{padding-block:calc(var(--spacing)*0)}.py-0\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-2\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.py-6{padding-block:calc(var(--spacing)*6)}.py-8{padding-block:calc(var(--spacing)*8)}.py-12{padding-block:calc(var(--spacing)*12)}.py-16{padding-block:calc(var(--spacing)*16)}.py-20{padding-block:calc(var(--spacing)*20)}.py-24{padding-block:calc(var(--spacing)*24)}.py-px{padding-block:1px}.pt-0{padding-top:calc(var(--spacing)*0)}.pt-1{padding-top:calc(var(--spacing)*1)}.pt-1\.5{padding-top:calc(var(--spacing)*1.5)}.pt-2{padding-top:calc(var(--spacing)*2)}.pt-2\.5{padding-top:calc(var(--spacing)*2.5)}.pt-3{padding-top:calc(var(--spacing)*3)}.pt-4{padding-top:calc(var(--spacing)*4)}.pt-5{padding-top:calc(var(--spacing)*5)}.pr-1{padding-right:calc(var(--spacing)*1)}.pr-2{padding-right:calc(var(--spacing)*2)}.pr-3{padding-right:calc(var(--spacing)*3)}.pr-4{padding-right:calc(var(--spacing)*4)}.pr-5{padding-right:calc(var(--spacing)*5)}.pr-6{padding-right:calc(var(--spacing)*6)}.pr-7{padding-right:calc(var(--spacing)*7)}.pr-8{padding-right:calc(var(--spacing)*8)}.pr-9{padding-right:calc(var(--spacing)*9)}.pr-10{padding-right:calc(var(--spacing)*10)}.pb-0\.5{padding-bottom:calc(var(--spacing)*.5)}.pb-1{padding-bottom:calc(var(--spacing)*1)}.pb-1\.5{padding-bottom:calc(var(--spacing)*1.5)}.pb-2{padding-bottom:calc(var(--spacing)*2)}.pb-3{padding-bottom:calc(var(--spacing)*3)}.pb-4{padding-bottom:calc(var(--spacing)*4)}.pb-6{padding-bottom:calc(var(--spacing)*6)}.pb-\[env\(safe-area-inset-bottom\)\]{padding-bottom:env(safe-area-inset-bottom)}.pl-1{padding-left:calc(var(--spacing)*1)}.pl-2{padding-left:calc(var(--spacing)*2)}.pl-3{padding-left:calc(var(--spacing)*3)}.pl-4{padding-left:calc(var(--spacing)*4)}.pl-5{padding-left:calc(var(--spacing)*5)}.pl-6{padding-left:calc(var(--spacing)*6)}.pl-7{padding-left:calc(var(--spacing)*7)}.pl-8{padding-left:calc(var(--spacing)*8)}.pl-9{padding-left:calc(var(--spacing)*9)}.pl-10{padding-left:calc(var(--spacing)*10)}.pl-20{padding-left:calc(var(--spacing)*20)}.pl-\[28px\]{padding-left:28px}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-top{vertical-align:top}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:var(--font-sans)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-5xl{font-size:var(--text-5xl);line-height:var(--tw-leading,var(--text-5xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[0\.7rem\]{font-size:.7rem}.text-\[0\.65rem\]{font-size:.65rem}.text-\[6px\]{font-size:6px}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[length\:var\(--pc-t8\,8px\)\]{font-size:var(--pc-t8,8px)}.text-\[length\:var\(--pc-t9\,9px\)\]{font-size:var(--pc-t9,9px)}.text-\[length\:var\(--pc-t10\,10px\)\]{font-size:var(--pc-t10,10px)}.text-\[length\:var\(--pc-t11\,11px\)\]{font-size:var(--pc-t11,11px)}.leading-5{--tw-leading:calc(var(--spacing)*5);line-height:calc(var(--spacing)*5)}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-light{--tw-font-weight:var(--font-weight-light);font-weight:var(--font-weight-light)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[0\.3em\]{--tw-tracking:.3em;letter-spacing:.3em}.tracking-normal{--tw-tracking:var(--tracking-normal);letter-spacing:var(--tracking-normal)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.text-balance{text-wrap:balance}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.\!text-white{color:var(--color-white)!important}.text-\[\#ffffff\]{color:#fff}.text-amber-100{color:var(--color-amber-100)}.text-amber-200{color:var(--color-amber-200)}.text-amber-200\/80{color:#fee685cc}@supports (color:color-mix(in lab, red, red)){.text-amber-200\/80{color:color-mix(in oklab,var(--color-amber-200)80%,transparent)}}.text-amber-300{color:var(--color-amber-300)}.text-amber-400{color:var(--color-amber-400)}.text-amber-500{color:var(--color-amber-500)}.text-amber-500\/80{color:#f99c00cc}@supports (color:color-mix(in lab, red, red)){.text-amber-500\/80{color:color-mix(in oklab,var(--color-amber-500)80%,transparent)}}.text-amber-600{color:var(--color-amber-600)}.text-amber-600\/80{color:#dd7400cc}@supports (color:color-mix(in lab, red, red)){.text-amber-600\/80{color:color-mix(in oklab,var(--color-amber-600)80%,transparent)}}.text-amber-700{color:var(--color-amber-700)}.text-amber-700\/70{color:#b75000b3}@supports (color:color-mix(in lab, red, red)){.text-amber-700\/70{color:color-mix(in oklab,var(--color-amber-700)70%,transparent)}}.text-amber-700\/80{color:#b75000cc}@supports (color:color-mix(in lab, red, red)){.text-amber-700\/80{color:color-mix(in oklab,var(--color-amber-700)80%,transparent)}}.text-amber-700\/90{color:#b75000e6}@supports (color:color-mix(in lab, red, red)){.text-amber-700\/90{color:color-mix(in oklab,var(--color-amber-700)90%,transparent)}}.text-amber-800{color:var(--color-amber-800)}.text-amber-800\/70{color:#953d00b3}@supports (color:color-mix(in lab, red, red)){.text-amber-800\/70{color:color-mix(in oklab,var(--color-amber-800)70%,transparent)}}.text-amber-800\/90{color:#953d00e6}@supports (color:color-mix(in lab, red, red)){.text-amber-800\/90{color:color-mix(in oklab,var(--color-amber-800)90%,transparent)}}.text-amber-900{color:var(--color-amber-900)}.text-bambu-dark{color:var(--color-bambu-dark)}.text-bambu-dark-tertiary{color:var(--color-bambu-dark-tertiary)}.text-bambu-gray{color:var(--color-bambu-gray)}.text-bambu-gray-dark{color:var(--color-bambu-gray-dark)}.text-bambu-gray-light{color:var(--color-bambu-gray-light)}.text-bambu-gray\/30{color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.text-bambu-gray\/30{color:color-mix(in oklab,var(--color-bambu-gray)30%,transparent)}}.text-bambu-gray\/40{color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.text-bambu-gray\/40{color:color-mix(in oklab,var(--color-bambu-gray)40%,transparent)}}.text-bambu-gray\/50{color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.text-bambu-gray\/50{color:color-mix(in oklab,var(--color-bambu-gray)50%,transparent)}}.text-bambu-gray\/60{color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.text-bambu-gray\/60{color:color-mix(in oklab,var(--color-bambu-gray)60%,transparent)}}.text-bambu-gray\/70{color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.text-bambu-gray\/70{color:color-mix(in oklab,var(--color-bambu-gray)70%,transparent)}}.text-bambu-gray\/80{color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.text-bambu-gray\/80{color:color-mix(in oklab,var(--color-bambu-gray)80%,transparent)}}.text-bambu-gray\/90{color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.text-bambu-gray\/90{color:color-mix(in oklab,var(--color-bambu-gray)90%,transparent)}}.text-bambu-green,.text-bambu-green\/50{color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.text-bambu-green\/50{color:color-mix(in oklab,var(--color-bambu-green)50%,transparent)}}.text-bambu-green\/60{color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.text-bambu-green\/60{color:color-mix(in oklab,var(--color-bambu-green)60%,transparent)}}.text-bambu-green\/70{color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.text-bambu-green\/70{color:color-mix(in oklab,var(--color-bambu-green)70%,transparent)}}.text-bambu-green\/90{color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.text-bambu-green\/90{color:color-mix(in oklab,var(--color-bambu-green)90%,transparent)}}.text-black{color:var(--color-black)}.text-black\/80{color:#000c}@supports (color:color-mix(in lab, red, red)){.text-black\/80{color:color-mix(in oklab,var(--color-black)80%,transparent)}}.text-blue-100{color:var(--color-blue-100)}.text-blue-300{color:var(--color-blue-300)}.text-blue-400{color:var(--color-blue-400)}.text-blue-500{color:var(--color-blue-500)}.text-blue-600{color:var(--color-blue-600)}.text-blue-600\/50{color:#155dfc80}@supports (color:color-mix(in lab, red, red)){.text-blue-600\/50{color:color-mix(in oklab,var(--color-blue-600)50%,transparent)}}.text-blue-700{color:var(--color-blue-700)}.text-blue-700\/80{color:#1447e6cc}@supports (color:color-mix(in lab, red, red)){.text-blue-700\/80{color:color-mix(in oklab,var(--color-blue-700)80%,transparent)}}.text-blue-700\/90{color:#1447e6e6}@supports (color:color-mix(in lab, red, red)){.text-blue-700\/90{color:color-mix(in oklab,var(--color-blue-700)90%,transparent)}}.text-cyan-400{color:var(--color-cyan-400)}.text-cyan-600{color:var(--color-cyan-600)}.text-cyan-700{color:var(--color-cyan-700)}.text-emerald-100{color:var(--color-emerald-100)}.text-emerald-300{color:var(--color-emerald-300)}.text-emerald-600{color:var(--color-emerald-600)}.text-emerald-700{color:var(--color-emerald-700)}.text-fuchsia-700{color:var(--color-fuchsia-700)}.text-gray-300{color:var(--color-gray-300)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-800{color:var(--color-gray-800)}.text-gray-900{color:var(--color-gray-900)}.text-green-300{color:var(--color-green-300)}.text-green-400{color:var(--color-green-400)}.text-green-400\/60{color:#05df7299}@supports (color:color-mix(in lab, red, red)){.text-green-400\/60{color:color-mix(in oklab,var(--color-green-400)60%,transparent)}}.text-green-500{color:var(--color-green-500)}.text-green-600{color:var(--color-green-600)}.text-green-700{color:var(--color-green-700)}.text-green-700\/80{color:#008138cc}@supports (color:color-mix(in lab, red, red)){.text-green-700\/80{color:color-mix(in oklab,var(--color-green-700)80%,transparent)}}.text-green-800{color:var(--color-green-800)}.text-indigo-600{color:var(--color-indigo-600)}.text-indigo-700{color:var(--color-indigo-700)}.text-lime-700{color:var(--color-lime-700)}.text-orange-400{color:var(--color-orange-400)}.text-orange-500{color:var(--color-orange-500)}.text-orange-600{color:var(--color-orange-600)}.text-orange-700{color:var(--color-orange-700)}.text-orange-800{color:var(--color-orange-800)}.text-orange-800\/80{color:#9f2d00cc}@supports (color:color-mix(in lab, red, red)){.text-orange-800\/80{color:color-mix(in oklab,var(--color-orange-800)80%,transparent)}}.text-orange-900{color:var(--color-orange-900)}.text-pink-400{color:var(--color-pink-400)}.text-pink-700{color:var(--color-pink-700)}.text-purple-400{color:var(--color-purple-400)}.text-purple-400\/80{color:#c07effcc}@supports (color:color-mix(in lab, red, red)){.text-purple-400\/80{color:color-mix(in oklab,var(--color-purple-400)80%,transparent)}}.text-purple-600{color:var(--color-purple-600)}.text-purple-700{color:var(--color-purple-700)}.text-purple-700\/80{color:#8200dacc}@supports (color:color-mix(in lab, red, red)){.text-purple-700\/80{color:color-mix(in oklab,var(--color-purple-700)80%,transparent)}}.text-red-100{color:var(--color-red-100)}.text-red-300{color:var(--color-red-300)}.text-red-400{color:var(--color-red-400)}.text-red-500{color:var(--color-red-500)}.text-red-600{color:var(--color-red-600)}.text-red-700{color:var(--color-red-700)}.text-red-700\/50{color:#bf000f80}@supports (color:color-mix(in lab, red, red)){.text-red-700\/50{color:color-mix(in oklab,var(--color-red-700)50%,transparent)}}.text-red-700\/80{color:#bf000fcc}@supports (color:color-mix(in lab, red, red)){.text-red-700\/80{color:color-mix(in oklab,var(--color-red-700)80%,transparent)}}.text-red-700\/90{color:#bf000fe6}@supports (color:color-mix(in lab, red, red)){.text-red-700\/90{color:color-mix(in oklab,var(--color-red-700)90%,transparent)}}.text-red-800{color:var(--color-red-800)}.text-red-800\/60{color:#9f071299}@supports (color:color-mix(in lab, red, red)){.text-red-800\/60{color:color-mix(in oklab,var(--color-red-800)60%,transparent)}}.text-red-800\/80{color:#9f0712cc}@supports (color:color-mix(in lab, red, red)){.text-red-800\/80{color:color-mix(in oklab,var(--color-red-800)80%,transparent)}}.text-rose-200{color:var(--color-rose-200)}.text-rose-700{color:var(--color-rose-700)}.text-sky-100{color:var(--color-sky-100)}.text-sky-600{color:var(--color-sky-600)}.text-sky-700{color:var(--color-sky-700)}.text-slate-200{color:var(--color-slate-200)}.text-slate-300{color:var(--color-slate-300)}.text-slate-400{color:var(--color-slate-400)}.text-slate-500{color:var(--color-slate-500)}.text-slate-500\/90{color:#62748ee6}@supports (color:color-mix(in lab, red, red)){.text-slate-500\/90{color:color-mix(in oklab,var(--color-slate-500)90%,transparent)}}.text-slate-600{color:var(--color-slate-600)}.text-status-error{color:var(--color-status-error)}.text-status-ok{color:var(--color-status-ok)}.text-status-warning{color:var(--color-status-warning)}.text-teal-600{color:var(--color-teal-600)}.text-teal-700{color:var(--color-teal-700)}.text-white{color:var(--color-white)}.text-white\/30{color:#ffffff4d}@supports (color:color-mix(in lab, red, red)){.text-white\/30{color:color-mix(in oklab,var(--color-white)30%,transparent)}}.text-white\/40{color:#fff6}@supports (color:color-mix(in lab, red, red)){.text-white\/40{color:color-mix(in oklab,var(--color-white)40%,transparent)}}.text-white\/50{color:#ffffff80}@supports (color:color-mix(in lab, red, red)){.text-white\/50{color:color-mix(in oklab,var(--color-white)50%,transparent)}}.text-white\/60{color:#fff9}@supports (color:color-mix(in lab, red, red)){.text-white\/60{color:color-mix(in oklab,var(--color-white)60%,transparent)}}.text-white\/70{color:#ffffffb3}@supports (color:color-mix(in lab, red, red)){.text-white\/70{color:color-mix(in oklab,var(--color-white)70%,transparent)}}.text-white\/80{color:#fffc}@supports (color:color-mix(in lab, red, red)){.text-white\/80{color:color-mix(in oklab,var(--color-white)80%,transparent)}}.text-white\/90{color:#ffffffe6}@supports (color:color-mix(in lab, red, red)){.text-white\/90{color:color-mix(in oklab,var(--color-white)90%,transparent)}}.text-yellow-100{color:var(--color-yellow-100)}.text-yellow-300{color:var(--color-yellow-300)}.text-yellow-400{color:var(--color-yellow-400)}.text-yellow-500{color:var(--color-yellow-500)}.text-yellow-500\/70{color:#edb200b3}@supports (color:color-mix(in lab, red, red)){.text-yellow-500\/70{color:color-mix(in oklab,var(--color-yellow-500)70%,transparent)}}.text-yellow-500\/80{color:#edb200cc}@supports (color:color-mix(in lab, red, red)){.text-yellow-500\/80{color:color-mix(in oklab,var(--color-yellow-500)80%,transparent)}}.text-yellow-600{color:var(--color-yellow-600)}.text-yellow-700{color:var(--color-yellow-700)}.text-yellow-800{color:var(--color-yellow-800)}.text-yellow-800\/80{color:#874b00cc}@supports (color:color-mix(in lab, red, red)){.text-yellow-800\/80{color:color-mix(in oklab,var(--color-yellow-800)80%,transparent)}}.text-zinc-100{color:var(--color-zinc-100)}.text-zinc-200{color:var(--color-zinc-200)}.text-zinc-300{color:var(--color-zinc-300)}.text-zinc-400{color:var(--color-zinc-400)}.text-zinc-500{color:var(--color-zinc-500)}.text-zinc-600{color:var(--color-zinc-600)}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.line-through{text-decoration-line:line-through}.underline{text-decoration-line:underline}.placeholder-bambu-gray::placeholder{color:var(--color-bambu-gray)}.placeholder-bambu-gray-dark::placeholder{color:var(--color-bambu-gray-dark)}.placeholder-bambu-gray\/40::placeholder{color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.placeholder-bambu-gray\/40::placeholder{color:color-mix(in oklab,var(--color-bambu-gray)40%,transparent)}}.placeholder-bambu-gray\/50::placeholder{color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.placeholder-bambu-gray\/50::placeholder{color:color-mix(in oklab,var(--color-bambu-gray)50%,transparent)}}.placeholder-bambu-gray\/60::placeholder{color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.placeholder-bambu-gray\/60::placeholder{color:color-mix(in oklab,var(--color-bambu-gray)60%,transparent)}}.placeholder-gray-400::placeholder{color:var(--color-gray-400)}.placeholder-white\/30::placeholder{color:#ffffff4d}@supports (color:color-mix(in lab, red, red)){.placeholder-white\/30::placeholder{color:color-mix(in oklab,var(--color-white)30%,transparent)}}.placeholder-zinc-500::placeholder{color:var(--color-zinc-500)}.accent-bambu-green{accent-color:var(--color-bambu-green)}.accent-green-500{accent-color:var(--color-green-500)}.accent-red-500{accent-color:var(--color-red-500)}.\[color-scheme\:dark\]{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}.opacity-0{opacity:0}.opacity-20{opacity:.2}.opacity-25{opacity:.25}.opacity-30{opacity:.3}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-55{opacity:.55}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.opacity-80{opacity:.8}.opacity-90{opacity:.9}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_6px_rgba\(34\,197\,94\,0\.5\)\]{--tw-shadow:0 0 6px var(--tw-shadow-color,#22c55e80);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_8px_rgba\(248\,113\,113\,0\.6\)\]{--tw-shadow:0 0 8px var(--tw-shadow-color,#f8717199);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow\/depth{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring,.ring-1{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-bambu-green\/20{--tw-shadow-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.shadow-bambu-green\/20{--tw-shadow-color:color-mix(in oklab,color-mix(in oklab,var(--color-bambu-green)20%,transparent)var(--tw-shadow-alpha),transparent)}}.shadow-bambu-green\/25{--tw-shadow-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.shadow-bambu-green\/25{--tw-shadow-color:color-mix(in oklab,color-mix(in oklab,var(--color-bambu-green)25%,transparent)var(--tw-shadow-alpha),transparent)}}.ring-amber-400{--tw-ring-color:var(--color-amber-400)}.ring-bambu-green,.ring-bambu-green\/30{--tw-ring-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.ring-bambu-green\/30{--tw-ring-color:color-mix(in oklab,var(--color-bambu-green)30%,transparent)}}.ring-blue-400\/50{--tw-ring-color:#54a2ff80}@supports (color:color-mix(in lab, red, red)){.ring-blue-400\/50{--tw-ring-color:color-mix(in oklab,var(--color-blue-400)50%,transparent)}}.ring-green-500{--tw-ring-color:var(--color-green-500)}.ring-red-500\/60{--tw-ring-color:#fb2c3699}@supports (color:color-mix(in lab, red, red)){.ring-red-500\/60{--tw-ring-color:color-mix(in oklab,var(--color-red-500)60%,transparent)}}.ring-white{--tw-ring-color:var(--color-white)}.ring-offset-1{--tw-ring-offset-width:1px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.ring-offset-2{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.ring-offset-bambu-dark{--tw-ring-offset-color:var(--color-bambu-dark)}.ring-offset-bambu-dark-secondary{--tw-ring-offset-color:var(--color-bambu-dark-secondary)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.blur-2xl{--tw-blur:blur(var(--blur-2xl));filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.drop-shadow-lg{--tw-drop-shadow-size:drop-shadow(0 4px 4px var(--tw-drop-shadow-color,#00000026));--tw-drop-shadow:drop-shadow(var(--drop-shadow-lg));filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.drop-shadow-md{--tw-drop-shadow-size:drop-shadow(0 3px 3px var(--tw-drop-shadow-color,#0000001f));--tw-drop-shadow:drop-shadow(var(--drop-shadow-md));filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.invert{--tw-invert:invert(100%);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.\!filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)!important}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.outline-none{--tw-outline-style:none;outline-style:none}.select-all{-webkit-user-select:all;user-select:all}.select-none{-webkit-user-select:none;user-select:none}.\[writing-mode\:vertical-rl\]{writing-mode:vertical-rl}.group-focus-within\:opacity-100:is(:where(.group):focus-within *){opacity:1}@media (hover:hover){.group-hover\:bg-bambu-green\/20:is(:where(.group):hover *){background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.group-hover\:bg-bambu-green\/20:is(:where(.group):hover *){background-color:color-mix(in oklab,var(--color-bambu-green)20%,transparent)}}.group-hover\:bg-bambu-green\/30:is(:where(.group):hover *){background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.group-hover\:bg-bambu-green\/30:is(:where(.group):hover *){background-color:color-mix(in oklab,var(--color-bambu-green)30%,transparent)}}.group-hover\:break-all:is(:where(.group):hover *){word-break:break-all}.group-hover\:whitespace-normal:is(:where(.group):hover *){white-space:normal}.group-hover\:text-bambu-gray:is(:where(.group):hover *){color:var(--color-bambu-gray)}.group-hover\:text-bambu-green:is(:where(.group):hover *){color:var(--color-bambu-green)}.group-hover\:text-yellow-400:is(:where(.group):hover *){color:var(--color-yellow-400)}.group-hover\:opacity-100:is(:where(.group):hover *),.group-hover\/resize\:opacity-100:is(:where(.group\/resize):hover *){opacity:1}.group-hover\/thumb\:block:is(:where(.group\/thumb):hover *){display:block}}.peer-checked\:bg-amber-500:is(:where(.peer):checked~*){background-color:var(--color-amber-500)}.peer-checked\:bg-bambu-green:is(:where(.peer):checked~*){background-color:var(--color-bambu-green)}.peer-focus\:ring-2:is(:where(.peer):focus~*){--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.peer-focus\:ring-bambu-green\/50:is(:where(.peer):focus~*){--tw-ring-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.peer-focus\:ring-bambu-green\/50:is(:where(.peer):focus~*){--tw-ring-color:color-mix(in oklab,var(--color-bambu-green)50%,transparent)}}.peer-focus\:outline-none:is(:where(.peer):focus~*){--tw-outline-style:none;outline-style:none}.peer-disabled\:cursor-not-allowed:is(:where(.peer):disabled~*){cursor:not-allowed}.peer-disabled\:opacity-50:is(:where(.peer):disabled~*){opacity:.5}.placeholder\:text-bambu-gray::placeholder,.placeholder\:text-bambu-gray\/40::placeholder{color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.placeholder\:text-bambu-gray\/40::placeholder{color:color-mix(in oklab,var(--color-bambu-gray)40%,transparent)}}.placeholder\:text-bambu-gray\/50::placeholder{color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.placeholder\:text-bambu-gray\/50::placeholder{color:color-mix(in oklab,var(--color-bambu-gray)50%,transparent)}}.placeholder\:text-bambu-gray\/60::placeholder{color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.placeholder\:text-bambu-gray\/60::placeholder{color:color-mix(in oklab,var(--color-bambu-gray)60%,transparent)}}.before\:absolute:before{content:var(--tw-content);position:absolute}.before\:top-0:before{content:var(--tw-content);top:calc(var(--spacing)*0)}.before\:right-3:before{content:var(--tw-content);right:calc(var(--spacing)*3)}.before\:left-3:before{content:var(--tw-content);left:calc(var(--spacing)*3)}.before\:h-0\.5:before{content:var(--tw-content);height:calc(var(--spacing)*.5)}.before\:bg-bambu-green:before{content:var(--tw-content);background-color:var(--color-bambu-green)}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:top-0\.5:after{content:var(--tw-content);top:calc(var(--spacing)*.5)}.after\:top-\[2px\]:after{content:var(--tw-content);top:2px}.after\:left-0\.5:after{content:var(--tw-content);left:calc(var(--spacing)*.5)}.after\:left-\[2px\]:after{content:var(--tw-content);left:2px}.after\:h-4:after{content:var(--tw-content);height:calc(var(--spacing)*4)}.after\:h-5:after{content:var(--tw-content);height:calc(var(--spacing)*5)}.after\:w-4:after{content:var(--tw-content);width:calc(var(--spacing)*4)}.after\:w-5:after{content:var(--tw-content);width:calc(var(--spacing)*5)}.after\:rounded-full:after{content:var(--tw-content);border-radius:3.40282e38px}.after\:border:after{content:var(--tw-content);border-style:var(--tw-border-style);border-width:1px}.after\:border-gray-300:after{content:var(--tw-content);border-color:var(--color-gray-300)}.after\:bg-white:after{content:var(--tw-content);background-color:var(--color-white)}.after\:transition-all:after{content:var(--tw-content);transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.after\:transition-transform:after{content:var(--tw-content);transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.after\:content-\[\'\'\]:after{--tw-content:"";content:var(--tw-content)}.peer-checked\:after\:translate-x-5:is(:where(.peer):checked~*):after{content:var(--tw-content);--tw-translate-x:calc(var(--spacing)*5);translate:var(--tw-translate-x)var(--tw-translate-y)}.peer-checked\:after\:translate-x-full:is(:where(.peer):checked~*):after{content:var(--tw-content);--tw-translate-x:100%;translate:var(--tw-translate-x)var(--tw-translate-y)}.peer-checked\:after\:border-white:is(:where(.peer):checked~*):after{content:var(--tw-content);border-color:var(--color-white)}.last\:border-0:last-child{border-style:var(--tw-border-style);border-width:0}.last\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.focus-within\:border-bambu-green:focus-within{border-color:var(--color-bambu-green)}@media (hover:hover){.hover\:z-10:hover{z-index:10}.hover\:z-20:hover{z-index:20}.hover\:scale-105:hover{--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x)var(--tw-scale-y)}.hover\:scale-110:hover{--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x)var(--tw-scale-y)}.hover\:border-amber-500:hover{border-color:var(--color-amber-500)}.hover\:border-bambu-dark-tertiary\/80:hover{border-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.hover\:border-bambu-dark-tertiary\/80:hover{border-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)80%,transparent)}}.hover\:border-bambu-gray:hover{border-color:var(--color-bambu-gray)}.hover\:border-bambu-gray-dark:hover{border-color:var(--color-bambu-gray-dark)}.hover\:border-bambu-gray\/50:hover{border-color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.hover\:border-bambu-gray\/50:hover{border-color:color-mix(in oklab,var(--color-bambu-gray)50%,transparent)}}.hover\:border-bambu-gray\/60:hover{border-color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.hover\:border-bambu-gray\/60:hover{border-color:color-mix(in oklab,var(--color-bambu-gray)60%,transparent)}}.hover\:border-bambu-green:hover,.hover\:border-bambu-green\/40:hover{border-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.hover\:border-bambu-green\/40:hover{border-color:color-mix(in oklab,var(--color-bambu-green)40%,transparent)}}.hover\:border-bambu-green\/50:hover{border-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.hover\:border-bambu-green\/50:hover{border-color:color-mix(in oklab,var(--color-bambu-green)50%,transparent)}}.hover\:border-bambu-green\/60:hover{border-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.hover\:border-bambu-green\/60:hover{border-color:color-mix(in oklab,var(--color-bambu-green)60%,transparent)}}.hover\:border-gray-400:hover{border-color:var(--color-gray-400)}.hover\:border-green-500\/50:hover{border-color:#00c75880}@supports (color:color-mix(in lab, red, red)){.hover\:border-green-500\/50:hover{border-color:color-mix(in oklab,var(--color-green-500)50%,transparent)}}.hover\:border-white:hover{border-color:var(--color-white)}.hover\:border-white\/30:hover{border-color:#ffffff4d}@supports (color:color-mix(in lab, red, red)){.hover\:border-white\/30:hover{border-color:color-mix(in oklab,var(--color-white)30%,transparent)}}.hover\:border-white\/40:hover{border-color:#fff6}@supports (color:color-mix(in lab, red, red)){.hover\:border-white\/40:hover{border-color:color-mix(in oklab,var(--color-white)40%,transparent)}}.hover\:\!bg-bambu-green\/80:hover{background-color:var(--color-bambu-green)!important}@supports (color:color-mix(in lab, red, red)){.hover\:\!bg-bambu-green\/80:hover{background-color:color-mix(in oklab,var(--color-bambu-green)80%,transparent)!important}}.hover\:bg-amber-200:hover{background-color:var(--color-amber-200)}.hover\:bg-amber-500\/20:hover{background-color:#f99c0033}@supports (color:color-mix(in lab, red, red)){.hover\:bg-amber-500\/20:hover{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.hover\:bg-amber-600:hover{background-color:var(--color-amber-600)}.hover\:bg-amber-700:hover{background-color:var(--color-amber-700)}.hover\:bg-amber-900\/50:hover{background-color:#7b330680}@supports (color:color-mix(in lab, red, red)){.hover\:bg-amber-900\/50:hover{background-color:color-mix(in oklab,var(--color-amber-900)50%,transparent)}}.hover\:bg-bambu-dark:hover{background-color:var(--color-bambu-dark)}.hover\:bg-bambu-dark-secondary:hover,.hover\:bg-bambu-dark-secondary\/50:hover{background-color:var(--color-bambu-dark-secondary)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-dark-secondary\/50:hover{background-color:color-mix(in oklab,var(--color-bambu-dark-secondary)50%,transparent)}}.hover\:bg-bambu-dark-secondary\/80:hover{background-color:var(--color-bambu-dark-secondary)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-dark-secondary\/80:hover{background-color:color-mix(in oklab,var(--color-bambu-dark-secondary)80%,transparent)}}.hover\:bg-bambu-dark-tertiary:hover,.hover\:bg-bambu-dark-tertiary\/30:hover{background-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-dark-tertiary\/30:hover{background-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)30%,transparent)}}.hover\:bg-bambu-dark-tertiary\/40:hover{background-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-dark-tertiary\/40:hover{background-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)40%,transparent)}}.hover\:bg-bambu-dark-tertiary\/50:hover{background-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-dark-tertiary\/50:hover{background-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)50%,transparent)}}.hover\:bg-bambu-dark-tertiary\/60:hover{background-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-dark-tertiary\/60:hover{background-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)60%,transparent)}}.hover\:bg-bambu-dark-tertiary\/70:hover{background-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-dark-tertiary\/70:hover{background-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)70%,transparent)}}.hover\:bg-bambu-dark-tertiary\/80:hover{background-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-dark-tertiary\/80:hover{background-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)80%,transparent)}}.hover\:bg-bambu-dark\/30:hover{background-color:var(--color-bambu-dark)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-dark\/30:hover{background-color:color-mix(in oklab,var(--color-bambu-dark)30%,transparent)}}.hover\:bg-bambu-dark\/40:hover{background-color:var(--color-bambu-dark)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-dark\/40:hover{background-color:color-mix(in oklab,var(--color-bambu-dark)40%,transparent)}}.hover\:bg-bambu-dark\/50:hover{background-color:var(--color-bambu-dark)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-dark\/50:hover{background-color:color-mix(in oklab,var(--color-bambu-dark)50%,transparent)}}.hover\:bg-bambu-dark\/80:hover{background-color:var(--color-bambu-dark)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-dark\/80:hover{background-color:color-mix(in oklab,var(--color-bambu-dark)80%,transparent)}}.hover\:bg-bambu-gray-dark:hover{background-color:var(--color-bambu-gray-dark)}.hover\:bg-bambu-green:hover{background-color:var(--color-bambu-green)}.hover\:bg-bambu-green-dark:hover{background-color:var(--color-bambu-green-dark)}.hover\:bg-bambu-green-light:hover{background-color:var(--color-bambu-green-light)}.hover\:bg-bambu-green\/10:hover{background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-green\/10:hover{background-color:color-mix(in oklab,var(--color-bambu-green)10%,transparent)}}.hover\:bg-bambu-green\/20:hover{background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-green\/20:hover{background-color:color-mix(in oklab,var(--color-bambu-green)20%,transparent)}}.hover\:bg-bambu-green\/30:hover{background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-green\/30:hover{background-color:color-mix(in oklab,var(--color-bambu-green)30%,transparent)}}.hover\:bg-bambu-green\/40:hover{background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-green\/40:hover{background-color:color-mix(in oklab,var(--color-bambu-green)40%,transparent)}}.hover\:bg-bambu-green\/50:hover{background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-green\/50:hover{background-color:color-mix(in oklab,var(--color-bambu-green)50%,transparent)}}.hover\:bg-bambu-green\/80:hover{background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-green\/80:hover{background-color:color-mix(in oklab,var(--color-bambu-green)80%,transparent)}}.hover\:bg-bambu-green\/90:hover{background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-green\/90:hover{background-color:color-mix(in oklab,var(--color-bambu-green)90%,transparent)}}.hover\:bg-black\/10:hover{background-color:#0000001a}@supports (color:color-mix(in lab, red, red)){.hover\:bg-black\/10:hover{background-color:color-mix(in oklab,var(--color-black)10%,transparent)}}.hover\:bg-black\/40:hover{background-color:#0006}@supports (color:color-mix(in lab, red, red)){.hover\:bg-black\/40:hover{background-color:color-mix(in oklab,var(--color-black)40%,transparent)}}.hover\:bg-black\/70:hover{background-color:#000000b3}@supports (color:color-mix(in lab, red, red)){.hover\:bg-black\/70:hover{background-color:color-mix(in oklab,var(--color-black)70%,transparent)}}.hover\:bg-black\/80:hover{background-color:#000c}@supports (color:color-mix(in lab, red, red)){.hover\:bg-black\/80:hover{background-color:color-mix(in oklab,var(--color-black)80%,transparent)}}.hover\:bg-blue-200:hover{background-color:var(--color-blue-200)}.hover\:bg-blue-400:hover{background-color:var(--color-blue-400)}.hover\:bg-blue-500\/30:hover{background-color:#3080ff4d}@supports (color:color-mix(in lab, red, red)){.hover\:bg-blue-500\/30:hover{background-color:color-mix(in oklab,var(--color-blue-500)30%,transparent)}}.hover\:bg-blue-600:hover{background-color:var(--color-blue-600)}.hover\:bg-blue-700:hover{background-color:var(--color-blue-700)}.hover\:bg-cyan-50:hover{background-color:var(--color-cyan-50)}.hover\:bg-emerald-600:hover{background-color:var(--color-emerald-600)}.hover\:bg-gray-50:hover{background-color:var(--color-gray-50)}.hover\:bg-gray-100:hover{background-color:var(--color-gray-100)}.hover\:bg-gray-200:hover{background-color:var(--color-gray-200)}.hover\:bg-gray-700:hover{background-color:var(--color-gray-700)}.hover\:bg-green-400:hover{background-color:var(--color-green-400)}.hover\:bg-green-500\/20:hover{background-color:#00c75833}@supports (color:color-mix(in lab, red, red)){.hover\:bg-green-500\/20:hover{background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.hover\:bg-green-600:hover{background-color:var(--color-green-600)}.hover\:bg-green-700:hover{background-color:var(--color-green-700)}.hover\:bg-indigo-200:hover{background-color:var(--color-indigo-200)}.hover\:bg-indigo-500\/20:hover{background-color:#625fff33}@supports (color:color-mix(in lab, red, red)){.hover\:bg-indigo-500\/20:hover{background-color:color-mix(in oklab,var(--color-indigo-500)20%,transparent)}}.hover\:bg-orange-100:hover{background-color:var(--color-orange-100)}.hover\:bg-orange-200:hover{background-color:var(--color-orange-200)}.hover\:bg-orange-400:hover{background-color:var(--color-orange-400)}.hover\:bg-orange-500\/20:hover{background-color:#fe6e0033}@supports (color:color-mix(in lab, red, red)){.hover\:bg-orange-500\/20:hover{background-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.hover\:bg-purple-400:hover{background-color:var(--color-purple-400)}.hover\:bg-purple-600\/90:hover{background-color:#9810fae6}@supports (color:color-mix(in lab, red, red)){.hover\:bg-purple-600\/90:hover{background-color:color-mix(in oklab,var(--color-purple-600)90%,transparent)}}.hover\:bg-red-50:hover{background-color:var(--color-red-50)}.hover\:bg-red-100:hover{background-color:var(--color-red-100)}.hover\:bg-red-200:hover{background-color:var(--color-red-200)}.hover\:bg-red-400:hover{background-color:var(--color-red-400)}.hover\:bg-red-500:hover{background-color:var(--color-red-500)}.hover\:bg-red-500\/10:hover{background-color:#fb2c361a}@supports (color:color-mix(in lab, red, red)){.hover\:bg-red-500\/10:hover{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.hover\:bg-red-500\/20:hover{background-color:#fb2c3633}@supports (color:color-mix(in lab, red, red)){.hover\:bg-red-500\/20:hover{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.hover\:bg-red-500\/30:hover{background-color:#fb2c364d}@supports (color:color-mix(in lab, red, red)){.hover\:bg-red-500\/30:hover{background-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.hover\:bg-red-600:hover{background-color:var(--color-red-600)}.hover\:bg-red-600\/30:hover{background-color:#e400144d}@supports (color:color-mix(in lab, red, red)){.hover\:bg-red-600\/30:hover{background-color:color-mix(in oklab,var(--color-red-600)30%,transparent)}}.hover\:bg-red-700:hover{background-color:var(--color-red-700)}.hover\:bg-red-900\/50:hover{background-color:#82181a80}@supports (color:color-mix(in lab, red, red)){.hover\:bg-red-900\/50:hover{background-color:color-mix(in oklab,var(--color-red-900)50%,transparent)}}.hover\:bg-sky-500\/20:hover{background-color:#00a5ef33}@supports (color:color-mix(in lab, red, red)){.hover\:bg-sky-500\/20:hover{background-color:color-mix(in oklab,var(--color-sky-500)20%,transparent)}}.hover\:bg-teal-400:hover{background-color:var(--color-teal-400)}.hover\:bg-white\/5:hover{background-color:#ffffff0d}@supports (color:color-mix(in lab, red, red)){.hover\:bg-white\/5:hover{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.hover\:bg-white\/10:hover{background-color:#ffffff1a}@supports (color:color-mix(in lab, red, red)){.hover\:bg-white\/10:hover{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.hover\:bg-white\/20:hover{background-color:#fff3}@supports (color:color-mix(in lab, red, red)){.hover\:bg-white\/20:hover{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.hover\:bg-white\/80:hover{background-color:#fffc}@supports (color:color-mix(in lab, red, red)){.hover\:bg-white\/80:hover{background-color:color-mix(in oklab,var(--color-white)80%,transparent)}}.hover\:bg-yellow-200:hover{background-color:var(--color-yellow-200)}.hover\:bg-yellow-500\/20:hover{background-color:#edb20033}@supports (color:color-mix(in lab, red, red)){.hover\:bg-yellow-500\/20:hover{background-color:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.hover\:bg-yellow-500\/30:hover{background-color:#edb2004d}@supports (color:color-mix(in lab, red, red)){.hover\:bg-yellow-500\/30:hover{background-color:color-mix(in oklab,var(--color-yellow-500)30%,transparent)}}.hover\:bg-yellow-600:hover{background-color:var(--color-yellow-600)}.hover\:bg-zinc-600:hover{background-color:var(--color-zinc-600)}.hover\:bg-zinc-700:hover{background-color:var(--color-zinc-700)}.hover\:bg-zinc-700\/50:hover{background-color:#3f3f4680}@supports (color:color-mix(in lab, red, red)){.hover\:bg-zinc-700\/50:hover{background-color:color-mix(in oklab,var(--color-zinc-700)50%,transparent)}}.hover\:bg-zinc-700\/60:hover{background-color:#3f3f4699}@supports (color:color-mix(in lab, red, red)){.hover\:bg-zinc-700\/60:hover{background-color:color-mix(in oklab,var(--color-zinc-700)60%,transparent)}}.hover\:bg-zinc-800:hover{background-color:var(--color-zinc-800)}.hover\:from-bambu-green\/20:hover{--tw-gradient-from:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.hover\:from-bambu-green\/20:hover{--tw-gradient-from:color-mix(in oklab,var(--color-bambu-green)20%,transparent)}}.hover\:from-bambu-green\/20:hover{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.hover\:text-amber-700:hover{color:var(--color-amber-700)}.hover\:text-amber-800:hover{color:var(--color-amber-800)}.hover\:text-amber-900:hover{color:var(--color-amber-900)}.hover\:text-bambu-gray:hover{color:var(--color-bambu-gray)}.hover\:text-bambu-green:hover{color:var(--color-bambu-green)}.hover\:text-bambu-green-light:hover{color:var(--color-bambu-green-light)}.hover\:text-bambu-green\/70:hover{color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.hover\:text-bambu-green\/70:hover{color:color-mix(in oklab,var(--color-bambu-green)70%,transparent)}}.hover\:text-bambu-green\/80:hover{color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.hover\:text-bambu-green\/80:hover{color:color-mix(in oklab,var(--color-bambu-green)80%,transparent)}}.hover\:text-blue-600:hover{color:var(--color-blue-600)}.hover\:text-blue-700:hover{color:var(--color-blue-700)}.hover\:text-blue-800:hover{color:var(--color-blue-800)}.hover\:text-blue-900:hover{color:var(--color-blue-900)}.hover\:text-cyan-900:hover{color:var(--color-cyan-900)}.hover\:text-gray-600:hover{color:var(--color-gray-600)}.hover\:text-gray-700:hover{color:var(--color-gray-700)}.hover\:text-gray-900:hover{color:var(--color-gray-900)}.hover\:text-orange-600:hover{color:var(--color-orange-600)}.hover\:text-orange-700:hover{color:var(--color-orange-700)}.hover\:text-orange-900:hover{color:var(--color-orange-900)}.hover\:text-red-300:hover{color:var(--color-red-300)}.hover\:text-red-400:hover{color:var(--color-red-400)}.hover\:text-red-500:hover{color:var(--color-red-500)}.hover\:text-red-600:hover{color:var(--color-red-600)}.hover\:text-red-700:hover{color:var(--color-red-700)}.hover\:text-red-800:hover{color:var(--color-red-800)}.hover\:text-red-900:hover{color:var(--color-red-900)}.hover\:text-slate-700:hover{color:var(--color-slate-700)}.hover\:text-white:hover{color:var(--color-white)}.hover\:text-white\/60:hover{color:#fff9}@supports (color:color-mix(in lab, red, red)){.hover\:text-white\/60:hover{color:color-mix(in oklab,var(--color-white)60%,transparent)}}.hover\:text-white\/70:hover{color:#ffffffb3}@supports (color:color-mix(in lab, red, red)){.hover\:text-white\/70:hover{color:color-mix(in oklab,var(--color-white)70%,transparent)}}.hover\:text-white\/80:hover{color:#fffc}@supports (color:color-mix(in lab, red, red)){.hover\:text-white\/80:hover{color:color-mix(in oklab,var(--color-white)80%,transparent)}}.hover\:text-yellow-600:hover{color:var(--color-yellow-600)}.hover\:text-zinc-200:hover{color:var(--color-zinc-200)}.hover\:text-zinc-300:hover{color:var(--color-zinc-300)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-70:hover{opacity:.7}.hover\:opacity-80:hover{opacity:.8}.hover\:opacity-90:hover{opacity:.9}.hover\:opacity-100:hover{opacity:1}.hover\:shadow-lg:hover{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-xl:hover{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-bambu-green\/5:hover{--tw-shadow-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.hover\:shadow-bambu-green\/5:hover{--tw-shadow-color:color-mix(in oklab,color-mix(in oklab,var(--color-bambu-green)5%,transparent)var(--tw-shadow-alpha),transparent)}}.hover\:shadow-bambu-green\/30:hover{--tw-shadow-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.hover\:shadow-bambu-green\/30:hover{--tw-shadow-color:color-mix(in oklab,color-mix(in oklab,var(--color-bambu-green)30%,transparent)var(--tw-shadow-alpha),transparent)}}.hover\:brightness-110:hover{--tw-brightness:brightness(110%);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}}.focus\:border-amber-500\/50:focus{border-color:#f99c0080}@supports (color:color-mix(in lab, red, red)){.focus\:border-amber-500\/50:focus{border-color:color-mix(in oklab,var(--color-amber-500)50%,transparent)}}.focus\:border-bambu-gray:focus{border-color:var(--color-bambu-gray)}.focus\:border-bambu-green:focus{border-color:var(--color-bambu-green)}.focus\:border-red-500:focus{border-color:var(--color-red-500)}.focus\:border-transparent:focus{border-color:#0000}.focus\:ring-0:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-1:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-amber-400:focus{--tw-ring-color:var(--color-amber-400)}.focus\:ring-bambu-gray:focus{--tw-ring-color:var(--color-bambu-gray)}.focus\:ring-bambu-green:focus,.focus\:ring-bambu-green\/40:focus{--tw-ring-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.focus\:ring-bambu-green\/40:focus{--tw-ring-color:color-mix(in oklab,var(--color-bambu-green)40%,transparent)}}.focus\:ring-bambu-green\/50:focus{--tw-ring-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.focus\:ring-bambu-green\/50:focus{--tw-ring-color:color-mix(in oklab,var(--color-bambu-green)50%,transparent)}}.focus\:ring-blue-500:focus{--tw-ring-color:var(--color-blue-500)}.focus\:ring-red-500:focus{--tw-ring-color:var(--color-red-500)}.focus\:ring-offset-0:focus{--tw-ring-offset-width:0px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus\:ring-offset-bambu-dark:focus{--tw-ring-offset-color:var(--color-bambu-dark)}.focus\:ring-offset-bambu-dark-secondary:focus{--tw-ring-offset-color:var(--color-bambu-dark-secondary)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:opacity-100:focus-visible{opacity:1}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-bambu-green:focus-visible{--tw-ring-color:var(--color-bambu-green)}.focus-visible\:ring-white:focus-visible{--tw-ring-color:var(--color-white)}.active\:scale-95:active{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x)var(--tw-scale-y)}.active\:cursor-grabbing:active{cursor:grabbing}.active\:bg-amber-500\/30:active{background-color:#f99c004d}@supports (color:color-mix(in lab, red, red)){.active\:bg-amber-500\/30:active{background-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.active\:bg-white\/30:active{background-color:#ffffff4d}@supports (color:color-mix(in lab, red, red)){.active\:bg-white\/30:active{background-color:color-mix(in oklab,var(--color-white)30%,transparent)}}.active\:opacity-50:active{opacity:.5}.enabled\:cursor-pointer:enabled{cursor:pointer}@media (hover:hover){.enabled\:hover\:bg-amber-500:enabled:hover{background-color:var(--color-amber-500)}}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:cursor-wait:disabled{cursor:wait}.disabled\:bg-gray-600:disabled{background-color:var(--color-gray-600)}.disabled\:bg-zinc-700:disabled{background-color:var(--color-zinc-700)}.disabled\:no-underline:disabled{text-decoration-line:none}.disabled\:opacity-25:disabled{opacity:.25}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-35:disabled{opacity:.35}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:opacity-60:disabled{opacity:.6}@media (hover:hover){.disabled\:hover\:bg-bambu-dark:disabled:hover{background-color:var(--color-bambu-dark)}.disabled\:hover\:bg-bambu-green:disabled:hover{background-color:var(--color-bambu-green)}.disabled\:hover\:bg-transparent:disabled:hover{background-color:#0000}.disabled\:hover\:text-bambu-gray:disabled:hover{color:var(--color-bambu-gray)}}@media not all and (min-width:640px){.max-\[640px\]\:hidden{display:none}.max-\[640px\]\:w-full{width:100%}.max-\[640px\]\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.max-\[640px\]\:flex-col{flex-direction:column}.max-\[640px\]\:flex-wrap{flex-wrap:wrap}.max-\[640px\]\:items-center{align-items:center}.max-\[640px\]\:items-start{align-items:flex-start}}@media not all and (min-width:550px){.max-\[550px\]\:order-1{order:1}.max-\[550px\]\:order-2{order:2}.max-\[550px\]\:order-3{order:3}.max-\[550px\]\:order-4{order:4}.max-\[550px\]\:mt-1{margin-top:calc(var(--spacing)*1)}.max-\[550px\]\:w-full{width:100%}.max-\[550px\]\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.max-\[550px\]\:flex-col{flex-direction:column}.max-\[550px\]\:flex-wrap{flex-wrap:wrap}.max-\[550px\]\:items-center{align-items:center}.max-\[550px\]\:items-start{align-items:flex-start}.max-\[550px\]\:justify-end{justify-content:flex-end}.max-\[550px\]\:gap-3{gap:calc(var(--spacing)*3)}}@media not all and (min-width:520px){.max-\[520px\]\:h-20{height:calc(var(--spacing)*20)}.max-\[520px\]\:w-20{width:calc(var(--spacing)*20)}}@media not all and (min-width:48rem){.max-md\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.max-md\:overflow-y-auto{overflow-y:auto}.max-md\:border-r-0{border-right-style:var(--tw-border-style);border-right-width:0}.max-md\:border-b-0{border-bottom-style:var(--tw-border-style);border-bottom-width:0}}@media (min-width:40rem){.sm\:col-span-2{grid-column:span 2/span 2}.sm\:mt-0{margin-top:calc(var(--spacing)*0)}.sm\:mt-2{margin-top:calc(var(--spacing)*2)}.sm\:mt-3{margin-top:calc(var(--spacing)*3)}.sm\:mr-1{margin-right:calc(var(--spacing)*1)}.sm\:mb-4{margin-bottom:calc(var(--spacing)*4)}.sm\:ml-auto{margin-left:auto}.sm\:block{display:block}.sm\:flex{display:flex}.sm\:grid{display:grid}.sm\:hidden{display:none}.sm\:inline{display:inline}.sm\:table-cell{display:table-cell}.sm\:h-2{height:calc(var(--spacing)*2)}.sm\:h-3{height:calc(var(--spacing)*3)}.sm\:h-3\.5{height:calc(var(--spacing)*3.5)}.sm\:h-4{height:calc(var(--spacing)*4)}.sm\:h-5{height:calc(var(--spacing)*5)}.sm\:h-6{height:calc(var(--spacing)*6)}.sm\:h-12{height:calc(var(--spacing)*12)}.sm\:h-14{height:calc(var(--spacing)*14)}.sm\:h-\[calc\(100vh-2rem\)\]{height:calc(100vh - 2rem)}.sm\:w-1\/2{width:50%}.sm\:w-3{width:calc(var(--spacing)*3)}.sm\:w-3\.5{width:calc(var(--spacing)*3.5)}.sm\:w-4{width:calc(var(--spacing)*4)}.sm\:w-5{width:calc(var(--spacing)*5)}.sm\:w-6{width:calc(var(--spacing)*6)}.sm\:w-12{width:calc(var(--spacing)*12)}.sm\:w-14{width:calc(var(--spacing)*14)}.sm\:w-16{width:calc(var(--spacing)*16)}.sm\:w-40{width:calc(var(--spacing)*40)}.sm\:w-72{width:calc(var(--spacing)*72)}.sm\:w-auto{width:auto}.sm\:max-w-\[140px\]{max-width:140px}.sm\:max-w-none{max-width:none}.sm\:max-w-xs{max-width:var(--container-xs)}.sm\:flex-1{flex:1}.sm\:flex-none{flex:none}.sm\:cursor-default{cursor:default}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-between{justify-content:space-between}.sm\:gap-1{gap:calc(var(--spacing)*1)}.sm\:gap-1\.5{gap:calc(var(--spacing)*1.5)}.sm\:gap-2{gap:calc(var(--spacing)*2)}.sm\:gap-3{gap:calc(var(--spacing)*3)}.sm\:gap-4{gap:calc(var(--spacing)*4)}.sm\:gap-5{gap:calc(var(--spacing)*5)}.sm\:gap-6{gap:calc(var(--spacing)*6)}:where(.sm\:space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}:where(.sm\:space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*8)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*8)*calc(1 - var(--tw-space-y-reverse)))}.sm\:rounded-2xl{border-radius:var(--radius-2xl)}.sm\:border-bambu-dark-tertiary{border-color:var(--color-bambu-dark-tertiary)}.sm\:p-1\.5{padding:calc(var(--spacing)*1.5)}.sm\:p-2{padding:calc(var(--spacing)*2)}.sm\:p-3{padding:calc(var(--spacing)*3)}.sm\:p-4{padding:calc(var(--spacing)*4)}.sm\:px-2{padding-inline:calc(var(--spacing)*2)}.sm\:px-3{padding-inline:calc(var(--spacing)*3)}.sm\:text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.sm\:text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.sm\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.sm\:text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}}@media (min-width:48rem){.md\:sticky{position:sticky}.md\:top-0{top:calc(var(--spacing)*0)}.md\:top-\[2px\]{top:2px}.md\:left-\[2px\]{left:2px}.md\:col-span-2{grid-column:span 2/span 2}.md\:mx-0{margin-inline:calc(var(--spacing)*0)}.md\:ml-8{margin-left:calc(var(--spacing)*8)}.md\:block{display:block}.md\:inline{display:inline}.md\:h-4{height:calc(var(--spacing)*4)}.md\:h-5{height:calc(var(--spacing)*5)}.md\:max-h-none{max-height:none}.md\:min-h-0{min-height:calc(var(--spacing)*0)}.md\:w-4{width:calc(var(--spacing)*4)}.md\:w-9{width:calc(var(--spacing)*9)}.md\:w-52{width:calc(var(--spacing)*52)}.md\:min-w-\[200px\]{min-width:200px}.md\:flex-1{flex:1}.md\:shrink{flex-shrink:1}.md\:shrink-0{flex-shrink:0}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.md\:grid-cols-\[1fr_1\.5fr_auto\]{grid-template-columns:1fr 1.5fr auto}.md\:grid-cols-\[1fr_180px_140px_auto\]{grid-template-columns:1fr 180px 140px auto}.md\:flex-col{flex-direction:column}.md\:flex-row{flex-direction:row}.md\:flex-wrap{flex-wrap:wrap}.md\:items-center{align-items:center}.md\:gap-4{gap:calc(var(--spacing)*4)}.md\:self-auto{align-self:auto}.md\:self-start{align-self:flex-start}.md\:overflow-hidden{overflow:hidden}.md\:overflow-x-visible{overflow-x:visible}.md\:overflow-y-auto{overflow-y:auto}.md\:border-t-0{border-top-style:var(--tw-border-style);border-top-width:0}.md\:border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.md\:p-5{padding:calc(var(--spacing)*5)}.md\:p-6{padding:calc(var(--spacing)*6)}.md\:p-8{padding:calc(var(--spacing)*8)}.md\:px-0{padding-inline:calc(var(--spacing)*0)}.md\:py-2{padding-block:calc(var(--spacing)*2)}.md\:pb-0{padding-bottom:calc(var(--spacing)*0)}.md\:pl-6{padding-left:calc(var(--spacing)*6)}}@media (min-width:64rem){.lg\:static{position:static}.lg\:sticky{position:sticky}.lg\:top-4{top:calc(var(--spacing)*4)}.lg\:top-6{top:calc(var(--spacing)*6)}.lg\:order-none{order:0}.lg\:col-span-2{grid-column:span 2/span 2}.lg\:mt-0{margin-top:calc(var(--spacing)*0)}.lg\:mb-0{margin-bottom:calc(var(--spacing)*0)}.lg\:mb-6{margin-bottom:calc(var(--spacing)*6)}.lg\:-ml-px{margin-left:-1px}.lg\:flex{display:flex}.lg\:grid{display:grid}.lg\:hidden{display:none}.lg\:h-\[calc\(100vh-64px\)\]{height:calc(100vh - 64px)}.lg\:h-full{height:100%}.lg\:max-h-\[58vh\]{max-height:58vh}.lg\:max-h-none{max-height:none}.lg\:min-h-0{min-height:calc(var(--spacing)*0)}.lg\:w-1\/2{width:50%}.lg\:w-1\/3{width:33.3333%}.lg\:w-2\/3{width:66.6667%}.lg\:w-10{width:calc(var(--spacing)*10)}.lg\:w-48{width:calc(var(--spacing)*48)}.lg\:w-80{width:calc(var(--spacing)*80)}.lg\:w-\[480px\]{width:480px}.lg\:max-w-5xl{max-width:var(--container-5xl)}.lg\:max-w-md{max-width:var(--container-md)}.lg\:max-w-sm{max-width:var(--container-sm)}.lg\:max-w-xl{max-width:var(--container-xl)}.lg\:flex-shrink-0{flex-shrink:0}.lg\:cursor-default{cursor:default}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.lg\:grid-cols-\[1fr_20rem\]{grid-template-columns:1fr 20rem}.lg\:grid-cols-\[minmax\(0\,1fr\)_minmax\(0\,1fr\)_auto\]{grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto}.lg\:grid-cols-\[minmax\(20rem\,2fr\)_minmax\(0\,3fr\)\]{grid-template-columns:minmax(20rem,2fr) minmax(0,3fr)}.lg\:flex-col{flex-direction:column}.lg\:flex-row{flex-direction:row}.lg\:flex-nowrap{flex-wrap:nowrap}.lg\:items-end{align-items:flex-end}.lg\:items-start{align-items:flex-start}.lg\:justify-between{justify-content:space-between}.lg\:justify-end{justify-content:flex-end}.lg\:justify-start{justify-content:flex-start}.lg\:gap-0{gap:calc(var(--spacing)*0)}.lg\:gap-5{gap:calc(var(--spacing)*5)}.lg\:gap-6{gap:calc(var(--spacing)*6)}.lg\:gap-8{gap:calc(var(--spacing)*8)}.lg\:self-start{align-self:flex-start}.lg\:overflow-y-auto{overflow-y:auto}.lg\:border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.lg\:border-b-0{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.lg\:border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.lg\:pt-0{padding-top:calc(var(--spacing)*0)}}@media (min-width:80rem){.xl\:col-span-3{grid-column:span 3/span 3}.xl\:inline{display:inline}.xl\:w-96{width:calc(var(--spacing)*96)}.xl\:max-w-7xl{max-width:var(--container-7xl)}.xl\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.xl\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.xl\:grid-cols-\[minmax\(0\,1fr\)_minmax\(0\,1fr\)_minmax\(0\,1fr\)_auto\]{grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) auto}}@media (min-width:96rem){.\32 xl\:max-w-\[96rem\]{max-width:96rem}.\32 xl\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}}:where(.dark\:divide-gray-800:where(.dark,.dark *)>:not(:last-child)){border-color:var(--color-gray-800)}.dark\:border-amber-400\/60:where(.dark,.dark *){border-color:#fcbb0099}@supports (color:color-mix(in lab, red, red)){.dark\:border-amber-400\/60:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-amber-400)60%,transparent)}}.dark\:border-amber-500\/30:where(.dark,.dark *){border-color:#f99c004d}@supports (color:color-mix(in lab, red, red)){.dark\:border-amber-500\/30:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.dark\:border-amber-500\/40:where(.dark,.dark *){border-color:#f99c0066}@supports (color:color-mix(in lab, red, red)){.dark\:border-amber-500\/40:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-amber-500)40%,transparent)}}.dark\:border-amber-700:where(.dark,.dark *){border-color:var(--color-amber-700)}.dark\:border-amber-700\/40:where(.dark,.dark *){border-color:#b7500066}@supports (color:color-mix(in lab, red, red)){.dark\:border-amber-700\/40:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-amber-700)40%,transparent)}}.dark\:border-amber-800:where(.dark,.dark *){border-color:var(--color-amber-800)}.dark\:border-bambu-dark-tertiary:where(.dark,.dark *),.dark\:border-bambu-dark-tertiary\/60:where(.dark,.dark *){border-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.dark\:border-bambu-dark-tertiary\/60:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)60%,transparent)}}.dark\:border-blue-400\/20:where(.dark,.dark *){border-color:#54a2ff33}@supports (color:color-mix(in lab, red, red)){.dark\:border-blue-400\/20:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-blue-400)20%,transparent)}}.dark\:border-blue-400\/50:where(.dark,.dark *){border-color:#54a2ff80}@supports (color:color-mix(in lab, red, red)){.dark\:border-blue-400\/50:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-blue-400)50%,transparent)}}.dark\:border-blue-500\/20:where(.dark,.dark *){border-color:#3080ff33}@supports (color:color-mix(in lab, red, red)){.dark\:border-blue-500\/20:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.dark\:border-blue-500\/30:where(.dark,.dark *){border-color:#3080ff4d}@supports (color:color-mix(in lab, red, red)){.dark\:border-blue-500\/30:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-blue-500)30%,transparent)}}.dark\:border-blue-500\/40:where(.dark,.dark *){border-color:#3080ff66}@supports (color:color-mix(in lab, red, red)){.dark\:border-blue-500\/40:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-blue-500)40%,transparent)}}.dark\:border-blue-500\/50:where(.dark,.dark *){border-color:#3080ff80}@supports (color:color-mix(in lab, red, red)){.dark\:border-blue-500\/50:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-blue-500)50%,transparent)}}.dark\:border-cyan-500\/30:where(.dark,.dark *){border-color:#00b7d74d}@supports (color:color-mix(in lab, red, red)){.dark\:border-cyan-500\/30:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-cyan-500)30%,transparent)}}.dark\:border-emerald-500\/20:where(.dark,.dark *){border-color:#00bb7f33}@supports (color:color-mix(in lab, red, red)){.dark\:border-emerald-500\/20:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-emerald-500)20%,transparent)}}.dark\:border-gray-600:where(.dark,.dark *){border-color:var(--color-gray-600)}.dark\:border-gray-700:where(.dark,.dark *){border-color:var(--color-gray-700)}.dark\:border-green-500\/20:where(.dark,.dark *){border-color:#00c75833}@supports (color:color-mix(in lab, red, red)){.dark\:border-green-500\/20:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.dark\:border-green-500\/30:where(.dark,.dark *){border-color:#00c7584d}@supports (color:color-mix(in lab, red, red)){.dark\:border-green-500\/30:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-green-500)30%,transparent)}}.dark\:border-green-500\/40:where(.dark,.dark *){border-color:#00c75866}@supports (color:color-mix(in lab, red, red)){.dark\:border-green-500\/40:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-green-500)40%,transparent)}}.dark\:border-green-500\/50:where(.dark,.dark *){border-color:#00c75880}@supports (color:color-mix(in lab, red, red)){.dark\:border-green-500\/50:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-green-500)50%,transparent)}}.dark\:border-green-800:where(.dark,.dark *){border-color:var(--color-green-800)}.dark\:border-orange-400\/20:where(.dark,.dark *){border-color:#ff8b1a33}@supports (color:color-mix(in lab, red, red)){.dark\:border-orange-400\/20:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-orange-400)20%,transparent)}}.dark\:border-orange-400\/50:where(.dark,.dark *){border-color:#ff8b1a80}@supports (color:color-mix(in lab, red, red)){.dark\:border-orange-400\/50:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-orange-400)50%,transparent)}}.dark\:border-orange-500\/20:where(.dark,.dark *){border-color:#fe6e0033}@supports (color:color-mix(in lab, red, red)){.dark\:border-orange-500\/20:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.dark\:border-orange-500\/30:where(.dark,.dark *){border-color:#fe6e004d}@supports (color:color-mix(in lab, red, red)){.dark\:border-orange-500\/30:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-orange-500)30%,transparent)}}.dark\:border-orange-500\/40:where(.dark,.dark *){border-color:#fe6e0066}@supports (color:color-mix(in lab, red, red)){.dark\:border-orange-500\/40:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-orange-500)40%,transparent)}}.dark\:border-purple-400\/20:where(.dark,.dark *){border-color:#c07eff33}@supports (color:color-mix(in lab, red, red)){.dark\:border-purple-400\/20:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-purple-400)20%,transparent)}}.dark\:border-purple-500\/20:where(.dark,.dark *){border-color:#ac4bff33}@supports (color:color-mix(in lab, red, red)){.dark\:border-purple-500\/20:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.dark\:border-purple-500\/30:where(.dark,.dark *){border-color:#ac4bff4d}@supports (color:color-mix(in lab, red, red)){.dark\:border-purple-500\/30:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-purple-500)30%,transparent)}}.dark\:border-red-400:where(.dark,.dark *){border-color:var(--color-red-400)}.dark\:border-red-500\/20:where(.dark,.dark *){border-color:#fb2c3633}@supports (color:color-mix(in lab, red, red)){.dark\:border-red-500\/20:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.dark\:border-red-500\/30:where(.dark,.dark *){border-color:#fb2c364d}@supports (color:color-mix(in lab, red, red)){.dark\:border-red-500\/30:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.dark\:border-red-500\/40:where(.dark,.dark *){border-color:#fb2c3666}@supports (color:color-mix(in lab, red, red)){.dark\:border-red-500\/40:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-red-500)40%,transparent)}}.dark\:border-red-500\/50:where(.dark,.dark *){border-color:#fb2c3680}@supports (color:color-mix(in lab, red, red)){.dark\:border-red-500\/50:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-red-500)50%,transparent)}}.dark\:border-yellow-400\/20:where(.dark,.dark *){border-color:#fac80033}@supports (color:color-mix(in lab, red, red)){.dark\:border-yellow-400\/20:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-yellow-400)20%,transparent)}}.dark\:border-yellow-400\/40:where(.dark,.dark *){border-color:#fac80066}@supports (color:color-mix(in lab, red, red)){.dark\:border-yellow-400\/40:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-yellow-400)40%,transparent)}}.dark\:border-yellow-400\/50:where(.dark,.dark *){border-color:#fac80080}@supports (color:color-mix(in lab, red, red)){.dark\:border-yellow-400\/50:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-yellow-400)50%,transparent)}}.dark\:border-yellow-500\/20:where(.dark,.dark *){border-color:#edb20033}@supports (color:color-mix(in lab, red, red)){.dark\:border-yellow-500\/20:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.dark\:border-yellow-500\/30:where(.dark,.dark *){border-color:#edb2004d}@supports (color:color-mix(in lab, red, red)){.dark\:border-yellow-500\/30:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-yellow-500)30%,transparent)}}.dark\:border-yellow-500\/50:where(.dark,.dark *){border-color:#edb20080}@supports (color:color-mix(in lab, red, red)){.dark\:border-yellow-500\/50:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-yellow-500)50%,transparent)}}.dark\:bg-amber-400\/10:where(.dark,.dark *){background-color:#fcbb001a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-amber-400\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-amber-400)10%,transparent)}}.dark\:bg-amber-500\/10:where(.dark,.dark *){background-color:#f99c001a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-amber-500\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-amber-500)10%,transparent)}}.dark\:bg-amber-500\/15:where(.dark,.dark *){background-color:#f99c0026}@supports (color:color-mix(in lab, red, red)){.dark\:bg-amber-500\/15:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-amber-500)15%,transparent)}}.dark\:bg-amber-500\/20:where(.dark,.dark *){background-color:#f99c0033}@supports (color:color-mix(in lab, red, red)){.dark\:bg-amber-500\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.dark\:bg-amber-600\/20:where(.dark,.dark *){background-color:#dd740033}@supports (color:color-mix(in lab, red, red)){.dark\:bg-amber-600\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-amber-600)20%,transparent)}}.dark\:bg-amber-900\/20:where(.dark,.dark *){background-color:#7b330633}@supports (color:color-mix(in lab, red, red)){.dark\:bg-amber-900\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-amber-900)20%,transparent)}}.dark\:bg-amber-900\/30:where(.dark,.dark *){background-color:#7b33064d}@supports (color:color-mix(in lab, red, red)){.dark\:bg-amber-900\/30:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-amber-900)30%,transparent)}}.dark\:bg-bambu-dark:where(.dark,.dark *){background-color:var(--color-bambu-dark)}.dark\:bg-bambu-dark-secondary:where(.dark,.dark *){background-color:var(--color-bambu-dark-secondary)}.dark\:bg-black\/40:where(.dark,.dark *){background-color:#0006}@supports (color:color-mix(in lab, red, red)){.dark\:bg-black\/40:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-black)40%,transparent)}}.dark\:bg-black\/70:where(.dark,.dark *){background-color:#000000b3}@supports (color:color-mix(in lab, red, red)){.dark\:bg-black\/70:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-black)70%,transparent)}}.dark\:bg-blue-400\/10:where(.dark,.dark *){background-color:#54a2ff1a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-blue-400\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-blue-400)10%,transparent)}}.dark\:bg-blue-400\/15:where(.dark,.dark *){background-color:#54a2ff26}@supports (color:color-mix(in lab, red, red)){.dark\:bg-blue-400\/15:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-blue-400)15%,transparent)}}.dark\:bg-blue-400\/20:where(.dark,.dark *){background-color:#54a2ff33}@supports (color:color-mix(in lab, red, red)){.dark\:bg-blue-400\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-blue-400)20%,transparent)}}.dark\:bg-blue-500\/5:where(.dark,.dark *){background-color:#3080ff0d}@supports (color:color-mix(in lab, red, red)){.dark\:bg-blue-500\/5:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-blue-500)5%,transparent)}}.dark\:bg-blue-500\/10:where(.dark,.dark *){background-color:#3080ff1a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-blue-500\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-blue-500)10%,transparent)}}.dark\:bg-blue-500\/15:where(.dark,.dark *){background-color:#3080ff26}@supports (color:color-mix(in lab, red, red)){.dark\:bg-blue-500\/15:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-blue-500)15%,transparent)}}.dark\:bg-blue-500\/20:where(.dark,.dark *){background-color:#3080ff33}@supports (color:color-mix(in lab, red, red)){.dark\:bg-blue-500\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.dark\:bg-blue-600\/20:where(.dark,.dark *){background-color:#155dfc33}@supports (color:color-mix(in lab, red, red)){.dark\:bg-blue-600\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-blue-600)20%,transparent)}}.dark\:bg-blue-900\/20:where(.dark,.dark *){background-color:#1c398e33}@supports (color:color-mix(in lab, red, red)){.dark\:bg-blue-900\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-blue-900)20%,transparent)}}.dark\:bg-cyan-500\/15:where(.dark,.dark *){background-color:#00b7d726}@supports (color:color-mix(in lab, red, red)){.dark\:bg-cyan-500\/15:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-cyan-500)15%,transparent)}}.dark\:bg-cyan-500\/20:where(.dark,.dark *){background-color:#00b7d733}@supports (color:color-mix(in lab, red, red)){.dark\:bg-cyan-500\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-cyan-500)20%,transparent)}}.dark\:bg-cyan-600\/20:where(.dark,.dark *){background-color:#0092b533}@supports (color:color-mix(in lab, red, red)){.dark\:bg-cyan-600\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-cyan-600)20%,transparent)}}.dark\:bg-emerald-500\/10:where(.dark,.dark *){background-color:#00bb7f1a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-emerald-500\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-emerald-500)10%,transparent)}}.dark\:bg-emerald-500\/20:where(.dark,.dark *){background-color:#00bb7f33}@supports (color:color-mix(in lab, red, red)){.dark\:bg-emerald-500\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-emerald-500)20%,transparent)}}.dark\:bg-emerald-600\/20:where(.dark,.dark *){background-color:#00976733}@supports (color:color-mix(in lab, red, red)){.dark\:bg-emerald-600\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-emerald-600)20%,transparent)}}.dark\:bg-fuchsia-500\/20:where(.dark,.dark *){background-color:#e12afb33}@supports (color:color-mix(in lab, red, red)){.dark\:bg-fuchsia-500\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-fuchsia-500)20%,transparent)}}.dark\:bg-gray-700:where(.dark,.dark *){background-color:var(--color-gray-700)}.dark\:bg-gray-800:where(.dark,.dark *){background-color:var(--color-gray-800)}.dark\:bg-gray-800\/30:where(.dark,.dark *){background-color:#1e29394d}@supports (color:color-mix(in lab, red, red)){.dark\:bg-gray-800\/30:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-gray-800)30%,transparent)}}.dark\:bg-gray-800\/40:where(.dark,.dark *){background-color:#1e293966}@supports (color:color-mix(in lab, red, red)){.dark\:bg-gray-800\/40:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-gray-800)40%,transparent)}}.dark\:bg-gray-800\/50:where(.dark,.dark *){background-color:#1e293980}@supports (color:color-mix(in lab, red, red)){.dark\:bg-gray-800\/50:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-gray-800)50%,transparent)}}.dark\:bg-gray-900:where(.dark,.dark *){background-color:var(--color-gray-900)}.dark\:bg-green-400\/10:where(.dark,.dark *){background-color:#05df721a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-green-400\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-green-400)10%,transparent)}}.dark\:bg-green-500\/10:where(.dark,.dark *){background-color:#00c7581a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-green-500\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-green-500)10%,transparent)}}.dark\:bg-green-500\/20:where(.dark,.dark *){background-color:#00c75833}@supports (color:color-mix(in lab, red, red)){.dark\:bg-green-500\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.dark\:bg-green-900\/20:where(.dark,.dark *){background-color:#0d542b33}@supports (color:color-mix(in lab, red, red)){.dark\:bg-green-900\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-green-900)20%,transparent)}}.dark\:bg-indigo-500\/10:where(.dark,.dark *){background-color:#625fff1a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-indigo-500\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-indigo-500)10%,transparent)}}.dark\:bg-indigo-500\/15:where(.dark,.dark *){background-color:#625fff26}@supports (color:color-mix(in lab, red, red)){.dark\:bg-indigo-500\/15:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-indigo-500)15%,transparent)}}.dark\:bg-indigo-500\/20:where(.dark,.dark *){background-color:#625fff33}@supports (color:color-mix(in lab, red, red)){.dark\:bg-indigo-500\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-indigo-500)20%,transparent)}}.dark\:bg-lime-500\/20:where(.dark,.dark *){background-color:#80cd0033}@supports (color:color-mix(in lab, red, red)){.dark\:bg-lime-500\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-lime-500)20%,transparent)}}.dark\:bg-orange-400\/10:where(.dark,.dark *){background-color:#ff8b1a1a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-orange-400\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-orange-400)10%,transparent)}}.dark\:bg-orange-500\/10:where(.dark,.dark *){background-color:#fe6e001a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-orange-500\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-orange-500)10%,transparent)}}.dark\:bg-orange-500\/20:where(.dark,.dark *){background-color:#fe6e0033}@supports (color:color-mix(in lab, red, red)){.dark\:bg-orange-500\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.dark\:bg-orange-600\/20:where(.dark,.dark *){background-color:#f0510033}@supports (color:color-mix(in lab, red, red)){.dark\:bg-orange-600\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-orange-600)20%,transparent)}}.dark\:bg-pink-500\/20:where(.dark,.dark *){background-color:#f6339a33}@supports (color:color-mix(in lab, red, red)){.dark\:bg-pink-500\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-pink-500)20%,transparent)}}.dark\:bg-purple-400\/10:where(.dark,.dark *){background-color:#c07eff1a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-purple-400\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-purple-400)10%,transparent)}}.dark\:bg-purple-500\/10:where(.dark,.dark *){background-color:#ac4bff1a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-purple-500\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-purple-500)10%,transparent)}}.dark\:bg-purple-500\/20:where(.dark,.dark *){background-color:#ac4bff33}@supports (color:color-mix(in lab, red, red)){.dark\:bg-purple-500\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.dark\:bg-red-500\/5:where(.dark,.dark *){background-color:#fb2c360d}@supports (color:color-mix(in lab, red, red)){.dark\:bg-red-500\/5:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-red-500)5%,transparent)}}.dark\:bg-red-500\/10:where(.dark,.dark *){background-color:#fb2c361a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-red-500\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.dark\:bg-red-500\/15:where(.dark,.dark *){background-color:#fb2c3626}@supports (color:color-mix(in lab, red, red)){.dark\:bg-red-500\/15:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-red-500)15%,transparent)}}.dark\:bg-red-500\/20:where(.dark,.dark *){background-color:#fb2c3633}@supports (color:color-mix(in lab, red, red)){.dark\:bg-red-500\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.dark\:bg-red-600\/20:where(.dark,.dark *){background-color:#e4001433}@supports (color:color-mix(in lab, red, red)){.dark\:bg-red-600\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-red-600)20%,transparent)}}.dark\:bg-rose-500\/20:where(.dark,.dark *){background-color:#ff235733}@supports (color:color-mix(in lab, red, red)){.dark\:bg-rose-500\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-rose-500)20%,transparent)}}.dark\:bg-rose-600\/20:where(.dark,.dark *){background-color:#e7004433}@supports (color:color-mix(in lab, red, red)){.dark\:bg-rose-600\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-rose-600)20%,transparent)}}.dark\:bg-sky-500\/10:where(.dark,.dark *){background-color:#00a5ef1a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-sky-500\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-sky-500)10%,transparent)}}.dark\:bg-sky-500\/20:where(.dark,.dark *){background-color:#00a5ef33}@supports (color:color-mix(in lab, red, red)){.dark\:bg-sky-500\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-sky-500)20%,transparent)}}.dark\:bg-slate-500\/10:where(.dark,.dark *){background-color:#62748e1a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-slate-500\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-slate-500)10%,transparent)}}.dark\:bg-teal-500\/20:where(.dark,.dark *){background-color:#00baa733}@supports (color:color-mix(in lab, red, red)){.dark\:bg-teal-500\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-teal-500)20%,transparent)}}.dark\:bg-yellow-400\/10:where(.dark,.dark *){background-color:#fac8001a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-yellow-400\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-yellow-400)10%,transparent)}}.dark\:bg-yellow-400\/20:where(.dark,.dark *){background-color:#fac80033}@supports (color:color-mix(in lab, red, red)){.dark\:bg-yellow-400\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-yellow-400)20%,transparent)}}.dark\:bg-yellow-500\/10:where(.dark,.dark *){background-color:#edb2001a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-yellow-500\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-yellow-500)10%,transparent)}}.dark\:bg-yellow-500\/15:where(.dark,.dark *){background-color:#edb20026}@supports (color:color-mix(in lab, red, red)){.dark\:bg-yellow-500\/15:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-yellow-500)15%,transparent)}}.dark\:bg-yellow-500\/20:where(.dark,.dark *){background-color:#edb20033}@supports (color:color-mix(in lab, red, red)){.dark\:bg-yellow-500\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.dark\:text-amber-100:where(.dark,.dark *){color:var(--color-amber-100)}.dark\:text-amber-200:where(.dark,.dark *){color:var(--color-amber-200)}.dark\:text-amber-200\/60:where(.dark,.dark *){color:#fee68599}@supports (color:color-mix(in lab, red, red)){.dark\:text-amber-200\/60:where(.dark,.dark *){color:color-mix(in oklab,var(--color-amber-200)60%,transparent)}}.dark\:text-amber-200\/80:where(.dark,.dark *){color:#fee685cc}@supports (color:color-mix(in lab, red, red)){.dark\:text-amber-200\/80:where(.dark,.dark *){color:color-mix(in oklab,var(--color-amber-200)80%,transparent)}}.dark\:text-amber-300:where(.dark,.dark *){color:var(--color-amber-300)}.dark\:text-amber-300\/60:where(.dark,.dark *){color:#ffd23699}@supports (color:color-mix(in lab, red, red)){.dark\:text-amber-300\/60:where(.dark,.dark *){color:color-mix(in oklab,var(--color-amber-300)60%,transparent)}}.dark\:text-amber-300\/70:where(.dark,.dark *){color:#ffd236b3}@supports (color:color-mix(in lab, red, red)){.dark\:text-amber-300\/70:where(.dark,.dark *){color:color-mix(in oklab,var(--color-amber-300)70%,transparent)}}.dark\:text-amber-300\/80:where(.dark,.dark *){color:#ffd236cc}@supports (color:color-mix(in lab, red, red)){.dark\:text-amber-300\/80:where(.dark,.dark *){color:color-mix(in oklab,var(--color-amber-300)80%,transparent)}}.dark\:text-amber-400:where(.dark,.dark *){color:var(--color-amber-400)}.dark\:text-amber-400\/70:where(.dark,.dark *){color:#fcbb00b3}@supports (color:color-mix(in lab, red, red)){.dark\:text-amber-400\/70:where(.dark,.dark *){color:color-mix(in oklab,var(--color-amber-400)70%,transparent)}}.dark\:text-amber-400\/80:where(.dark,.dark *){color:#fcbb00cc}@supports (color:color-mix(in lab, red, red)){.dark\:text-amber-400\/80:where(.dark,.dark *){color:color-mix(in oklab,var(--color-amber-400)80%,transparent)}}.dark\:text-bambu-gray:where(.dark,.dark *){color:var(--color-bambu-gray)}.dark\:text-blue-200:where(.dark,.dark *){color:var(--color-blue-200)}.dark\:text-blue-200\/80:where(.dark,.dark *){color:#bedbffcc}@supports (color:color-mix(in lab, red, red)){.dark\:text-blue-200\/80:where(.dark,.dark *){color:color-mix(in oklab,var(--color-blue-200)80%,transparent)}}.dark\:text-blue-300:where(.dark,.dark *){color:var(--color-blue-300)}.dark\:text-blue-300\/70:where(.dark,.dark *){color:#90c5ffb3}@supports (color:color-mix(in lab, red, red)){.dark\:text-blue-300\/70:where(.dark,.dark *){color:color-mix(in oklab,var(--color-blue-300)70%,transparent)}}.dark\:text-blue-300\/80:where(.dark,.dark *){color:#90c5ffcc}@supports (color:color-mix(in lab, red, red)){.dark\:text-blue-300\/80:where(.dark,.dark *){color:color-mix(in oklab,var(--color-blue-300)80%,transparent)}}.dark\:text-blue-400:where(.dark,.dark *){color:var(--color-blue-400)}.dark\:text-blue-400\/50:where(.dark,.dark *){color:#54a2ff80}@supports (color:color-mix(in lab, red, red)){.dark\:text-blue-400\/50:where(.dark,.dark *){color:color-mix(in oklab,var(--color-blue-400)50%,transparent)}}.dark\:text-cyan-300:where(.dark,.dark *){color:var(--color-cyan-300)}.dark\:text-cyan-400:where(.dark,.dark *){color:var(--color-cyan-400)}.dark\:text-emerald-300:where(.dark,.dark *){color:var(--color-emerald-300)}.dark\:text-emerald-400:where(.dark,.dark *){color:var(--color-emerald-400)}.dark\:text-fuchsia-300:where(.dark,.dark *){color:var(--color-fuchsia-300)}.dark\:text-gray-100:where(.dark,.dark *){color:var(--color-gray-100)}.dark\:text-gray-300:where(.dark,.dark *){color:var(--color-gray-300)}.dark\:text-gray-400:where(.dark,.dark *){color:var(--color-gray-400)}.dark\:text-gray-500:where(.dark,.dark *){color:var(--color-gray-500)}.dark\:text-gray-600:where(.dark,.dark *){color:var(--color-gray-600)}.dark\:text-green-200:where(.dark,.dark *){color:var(--color-green-200)}.dark\:text-green-300:where(.dark,.dark *){color:var(--color-green-300)}.dark\:text-green-400:where(.dark,.dark *){color:var(--color-green-400)}.dark\:text-green-400\/70:where(.dark,.dark *){color:#05df72b3}@supports (color:color-mix(in lab, red, red)){.dark\:text-green-400\/70:where(.dark,.dark *){color:color-mix(in oklab,var(--color-green-400)70%,transparent)}}.dark\:text-indigo-300:where(.dark,.dark *){color:var(--color-indigo-300)}.dark\:text-indigo-400:where(.dark,.dark *){color:var(--color-indigo-400)}.dark\:text-lime-400:where(.dark,.dark *){color:var(--color-lime-400)}.dark\:text-orange-100:where(.dark,.dark *){color:var(--color-orange-100)}.dark\:text-orange-200:where(.dark,.dark *){color:var(--color-orange-200)}.dark\:text-orange-200\/70:where(.dark,.dark *){color:#ffd7a8b3}@supports (color:color-mix(in lab, red, red)){.dark\:text-orange-200\/70:where(.dark,.dark *){color:color-mix(in oklab,var(--color-orange-200)70%,transparent)}}.dark\:text-orange-300:where(.dark,.dark *){color:var(--color-orange-300)}.dark\:text-orange-400:where(.dark,.dark *){color:var(--color-orange-400)}.dark\:text-pink-400:where(.dark,.dark *){color:var(--color-pink-400)}.dark\:text-purple-300:where(.dark,.dark *){color:var(--color-purple-300)}.dark\:text-purple-300\/70:where(.dark,.dark *){color:#d9b3ffb3}@supports (color:color-mix(in lab, red, red)){.dark\:text-purple-300\/70:where(.dark,.dark *){color:color-mix(in oklab,var(--color-purple-300)70%,transparent)}}.dark\:text-purple-400:where(.dark,.dark *){color:var(--color-purple-400)}.dark\:text-red-200:where(.dark,.dark *){color:var(--color-red-200)}.dark\:text-red-200\/60:where(.dark,.dark *){color:#ffcaca99}@supports (color:color-mix(in lab, red, red)){.dark\:text-red-200\/60:where(.dark,.dark *){color:color-mix(in oklab,var(--color-red-200)60%,transparent)}}.dark\:text-red-200\/80:where(.dark,.dark *){color:#ffcacacc}@supports (color:color-mix(in lab, red, red)){.dark\:text-red-200\/80:where(.dark,.dark *){color:color-mix(in oklab,var(--color-red-200)80%,transparent)}}.dark\:text-red-300:where(.dark,.dark *){color:var(--color-red-300)}.dark\:text-red-300\/80:where(.dark,.dark *){color:#ffa3a3cc}@supports (color:color-mix(in lab, red, red)){.dark\:text-red-300\/80:where(.dark,.dark *){color:color-mix(in oklab,var(--color-red-300)80%,transparent)}}.dark\:text-red-400:where(.dark,.dark *){color:var(--color-red-400)}.dark\:text-red-400\/50:where(.dark,.dark *){color:#ff656880}@supports (color:color-mix(in lab, red, red)){.dark\:text-red-400\/50:where(.dark,.dark *){color:color-mix(in oklab,var(--color-red-400)50%,transparent)}}.dark\:text-red-400\/70:where(.dark,.dark *){color:#ff6568b3}@supports (color:color-mix(in lab, red, red)){.dark\:text-red-400\/70:where(.dark,.dark *){color:color-mix(in oklab,var(--color-red-400)70%,transparent)}}.dark\:text-rose-300:where(.dark,.dark *){color:var(--color-rose-300)}.dark\:text-rose-400:where(.dark,.dark *){color:var(--color-rose-400)}.dark\:text-sky-400:where(.dark,.dark *){color:var(--color-sky-400)}.dark\:text-slate-300:where(.dark,.dark *){color:var(--color-slate-300)}.dark\:text-slate-400:where(.dark,.dark *){color:var(--color-slate-400)}.dark\:text-slate-400\/80:where(.dark,.dark *){color:#90a1b9cc}@supports (color:color-mix(in lab, red, red)){.dark\:text-slate-400\/80:where(.dark,.dark *){color:color-mix(in oklab,var(--color-slate-400)80%,transparent)}}.dark\:text-teal-400:where(.dark,.dark *){color:var(--color-teal-400)}.dark\:text-white:where(.dark,.dark *){color:var(--color-white)}.dark\:text-yellow-200:where(.dark,.dark *){color:var(--color-yellow-200)}.dark\:text-yellow-200\/70:where(.dark,.dark *){color:#fff085b3}@supports (color:color-mix(in lab, red, red)){.dark\:text-yellow-200\/70:where(.dark,.dark *){color:color-mix(in oklab,var(--color-yellow-200)70%,transparent)}}.dark\:text-yellow-200\/80:where(.dark,.dark *){color:#fff085cc}@supports (color:color-mix(in lab, red, red)){.dark\:text-yellow-200\/80:where(.dark,.dark *){color:color-mix(in oklab,var(--color-yellow-200)80%,transparent)}}.dark\:text-yellow-300:where(.dark,.dark *){color:var(--color-yellow-300)}.dark\:text-yellow-400:where(.dark,.dark *){color:var(--color-yellow-400)}@media (hover:hover){.dark\:hover\:border-gray-500:where(.dark,.dark *):hover{border-color:var(--color-gray-500)}.dark\:hover\:bg-amber-500\/30:where(.dark,.dark *):hover{background-color:#f99c004d}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-amber-500\/30:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.dark\:hover\:bg-bambu-dark-tertiary:where(.dark,.dark *):hover{background-color:var(--color-bambu-dark-tertiary)}.dark\:hover\:bg-blue-500\/30:where(.dark,.dark *):hover{background-color:#3080ff4d}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-blue-500\/30:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-blue-500)30%,transparent)}}.dark\:hover\:bg-cyan-500\/10:where(.dark,.dark *):hover{background-color:#00b7d71a}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-cyan-500\/10:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-cyan-500)10%,transparent)}}.dark\:hover\:bg-gray-600:where(.dark,.dark *):hover{background-color:var(--color-gray-600)}.dark\:hover\:bg-gray-800\/50:where(.dark,.dark *):hover{background-color:#1e293980}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-gray-800\/50:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-gray-800)50%,transparent)}}.dark\:hover\:bg-indigo-500\/30:where(.dark,.dark *):hover{background-color:#625fff4d}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-indigo-500\/30:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-indigo-500)30%,transparent)}}.dark\:hover\:bg-orange-400\/20:where(.dark,.dark *):hover{background-color:#ff8b1a33}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-orange-400\/20:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-orange-400)20%,transparent)}}.dark\:hover\:bg-orange-500\/30:where(.dark,.dark *):hover{background-color:#fe6e004d}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-orange-500\/30:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-orange-500)30%,transparent)}}.dark\:hover\:bg-red-400\/10:where(.dark,.dark *):hover{background-color:#ff65681a}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-red-400\/10:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-red-400)10%,transparent)}}.dark\:hover\:bg-red-500\/10:where(.dark,.dark *):hover{background-color:#fb2c361a}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-red-500\/10:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.dark\:hover\:bg-red-500\/20:where(.dark,.dark *):hover{background-color:#fb2c3633}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-red-500\/20:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.dark\:hover\:bg-red-500\/25:where(.dark,.dark *):hover{background-color:#fb2c3640}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-red-500\/25:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-red-500)25%,transparent)}}.dark\:hover\:bg-red-500\/30:where(.dark,.dark *):hover{background-color:#fb2c364d}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-red-500\/30:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.dark\:hover\:bg-red-500\/40:where(.dark,.dark *):hover{background-color:#fb2c3666}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-red-500\/40:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-red-500)40%,transparent)}}.dark\:hover\:bg-white\/5:where(.dark,.dark *):hover{background-color:#ffffff0d}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-white\/5:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.dark\:hover\:bg-yellow-500\/25:where(.dark,.dark *):hover{background-color:#edb20040}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-yellow-500\/25:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-yellow-500)25%,transparent)}}.dark\:hover\:text-amber-100:where(.dark,.dark *):hover{color:var(--color-amber-100)}.dark\:hover\:text-amber-200:where(.dark,.dark *):hover{color:var(--color-amber-200)}.dark\:hover\:text-amber-300:where(.dark,.dark *):hover{color:var(--color-amber-300)}.dark\:hover\:text-blue-300:where(.dark,.dark *):hover{color:var(--color-blue-300)}.dark\:hover\:text-blue-400:where(.dark,.dark *):hover{color:var(--color-blue-400)}.dark\:hover\:text-cyan-200:where(.dark,.dark *):hover{color:var(--color-cyan-200)}.dark\:hover\:text-gray-200:where(.dark,.dark *):hover{color:var(--color-gray-200)}.dark\:hover\:text-gray-300:where(.dark,.dark *):hover{color:var(--color-gray-300)}.dark\:hover\:text-orange-300:where(.dark,.dark *):hover{color:var(--color-orange-300)}.dark\:hover\:text-orange-400:where(.dark,.dark *):hover{color:var(--color-orange-400)}.dark\:hover\:text-red-300:where(.dark,.dark *):hover{color:var(--color-red-300)}.dark\:hover\:text-red-400:where(.dark,.dark *):hover{color:var(--color-red-400)}.dark\:hover\:text-slate-200:where(.dark,.dark *):hover{color:var(--color-slate-200)}.dark\:hover\:text-white:where(.dark,.dark *):hover{color:var(--color-white)}.dark\:hover\:text-yellow-400:where(.dark,.dark *):hover{color:var(--color-yellow-400)}}@media (hover:hover) and (pointer:fine){.can-hover\:opacity-0{opacity:0}}.\[\&\:\:-webkit-inner-spin-button\]\:appearance-none::-webkit-inner-spin-button{appearance:none}.\[\&\:\:-webkit-outer-spin-button\]\:appearance-none::-webkit-outer-spin-button{appearance:none}.\[\&\:\:-webkit-slider-thumb\]\:h-3::-webkit-slider-thumb{height:calc(var(--spacing)*3)}.\[\&\:\:-webkit-slider-thumb\]\:w-3::-webkit-slider-thumb{width:calc(var(--spacing)*3)}.\[\&\:\:-webkit-slider-thumb\]\:cursor-pointer::-webkit-slider-thumb{cursor:pointer}.\[\&\:\:-webkit-slider-thumb\]\:appearance-none::-webkit-slider-thumb{appearance:none}.\[\&\:\:-webkit-slider-thumb\]\:rounded-full::-webkit-slider-thumb{border-radius:3.40282e38px}.\[\&\:\:-webkit-slider-thumb\]\:bg-bambu-green::-webkit-slider-thumb{background-color:var(--color-bambu-green)}.\[\&\>\*\]\:shrink-0>*{flex-shrink:0}}@font-face{font-family:Inter;font-style:normal;font-weight:100 900;font-display:swap;src:url(/fonts/inter-latin.woff2)format("woff2");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:Inter;font-style:normal;font-weight:100 900;font-display:swap;src:url(/fonts/inter-latin-ext.woff2)format("woff2");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}html{font-size:14.4px}:root{--accent:#00ae42;--accent-light:#00c64d;--accent-dark:#009438;--status-ok:#22c55e;--status-error:#ef4444;--status-warning:#f59e0b;--bg-primary:#f5f5f5;--bg-secondary:#fff;--bg-tertiary:#e5e5e5;--text-primary:#1a1a1a;--text-secondary:#4a4a4a;--text-muted:#6b6b6b;--text-tertiary:gray;--border-color:#d4d4d4;--card-shadow:0 2px 8px #00000014;--glow-color:transparent;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;font-synthesis:none;text-rendering:optimizelegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:Inter,system-ui,sans-serif;font-weight:400;line-height:1.5}.dark{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--bg-primary:#1a1a1a;--bg-secondary:#2d2d2d;--bg-tertiary:#3d3d3d;--text-primary:#fff;--text-secondary:#a0a0a0;--text-muted:gray;--text-tertiary:#4a4a4a;--border-color:#3d3d3d;--card-shadow:0 4px 16px #0006}.bg-warm{--bg-primary:#faf8f5;--bg-secondary:#fffefa;--bg-tertiary:#e8e4dd;--text-primary:#2d2a26;--text-secondary:#5c5750;--text-muted:#7a756c;--text-tertiary:#9a9590;--border-color:#d8d4cc}.bg-cool{--bg-primary:#f0f4f8;--bg-secondary:#fff;--bg-tertiary:#dce4ec;--text-primary:#1a2530;--text-secondary:#4a5568;--text-muted:#6b7a8a;--text-tertiary:#8a9aaa;--border-color:#c8d4e0}.dark.bg-neutral{--bg-primary:#1a1a1a;--bg-secondary:#2d2d2d;--bg-tertiary:#3d3d3d;--text-primary:#fff;--text-secondary:#a0a0a0;--text-muted:gray;--text-tertiary:#4a4a4a;--border-color:#3d3d3d}.dark.bg-warm{--bg-primary:#1c1a18;--bg-secondary:#2e2a26;--bg-tertiary:#3e3a36;--text-primary:#f5f0ea;--text-secondary:#b0a898;--text-muted:#8a8278;--text-tertiary:#5a5248;--border-color:#3e3a36}.dark.bg-cool{--bg-primary:#181c20;--bg-secondary:#262c32;--bg-tertiary:#363e46;--text-primary:#f0f4f8;--text-secondary:#98a8b8;--text-muted:#788898;--text-tertiary:#4a5a6a;--border-color:#363e46}.dark.bg-oled{--bg-primary:#000;--bg-secondary:#141414;--bg-tertiary:#1f1f1f;--text-primary:#fff;--text-secondary:#a0a0a0;--text-muted:#707070;--text-tertiary:#404040;--border-color:#2a2a2a}.dark.bg-slate{--bg-primary:#0f172a;--bg-secondary:#1e293b;--bg-tertiary:#334155;--text-primary:#f1f5f9;--text-secondary:#94a3b8;--text-muted:#64748b;--text-tertiary:#475569;--border-color:#334155}.dark.bg-forest{--bg-primary:#121a16;--bg-secondary:#1c2a22;--bg-tertiary:#2a3d30;--text-primary:#e8f5ec;--text-secondary:#8aa894;--text-muted:#6a8874;--text-tertiary:#4a6854;--border-color:#2a3d30}.printer-control-buttons-container{container-type:inline-size}@container (width<=220px){.printer-control-buttons{flex-direction:column;align-items:stretch}.printer-control-buttons>button{width:100%}}.style-glow{--card-shadow:0 2px 8px #00000014,0 0 25px var(--accent)}@supports (color:color-mix(in lab, red, red)){.style-glow{--card-shadow:0 2px 8px #00000014,0 0 25px color-mix(in srgb,var(--accent)12%,transparent)}}.dark.style-glow{--card-shadow:0 4px 20px #00000080,0 0 40px var(--accent)}@supports (color:color-mix(in lab, red, red)){.dark.style-glow{--card-shadow:0 4px 20px #00000080,0 0 40px color-mix(in srgb,var(--accent)15%,transparent)}}.style-vibrant{--card-shadow:0 8px 30px #00000026,0 2px 8px #0000001a}.dark.style-vibrant{--card-shadow:0 10px 40px #0009,0 4px 12px #0006}.accent-green{--accent:#00ae42;--accent-light:#00c64d;--accent-dark:#009438}.accent-teal{--accent:#14b8a6;--accent-light:#2dd4bf;--accent-dark:#0d9488}.accent-blue{--accent:#3b82f6;--accent-light:#60a5fa;--accent-dark:#2563eb}.accent-orange{--accent:#f97316;--accent-light:#fb923c;--accent-dark:#ea580c}.accent-purple{--accent:#8b5cf6;--accent-light:#a78bfa;--accent-dark:#7c3aed}.accent-red{--accent:#ef4444;--accent-light:#f87171;--accent-dark:#dc2626}body{background-color:var(--bg-primary);color:var(--text-primary);min-height:100vh;margin:0;transition:background-color .2s,color .2s}#root{min-height:100vh}.text-white,.hover\:text-white:hover{color:var(--text-primary)}.bg-bambu-dark,.bg-bambu-dark-secondary,.bg-bambu-dark-tertiary,.border-bambu-dark-tertiary{transition:background-color .2s,border-color .2s}@keyframes slide-in{0%{opacity:0;transform:translate(100%)}to{opacity:1;transform:translate(0)}}.animate-slide-in{animation:.2s ease-out slide-in}.icon-theme{opacity:.5}.dark .icon-theme{filter:invert();opacity:.4}.icon-green{filter:invert(48%)sepia(89%)saturate(459%)hue-rotate(93deg)brightness(95%)contrast(92%);opacity:1}.icon-heating{filter:invert(50%)sepia()saturate(1000%)hue-rotate(360deg)brightness()contrast();opacity:1}.dark .jogpad-theme{filter:brightness(.35)contrast(1.2)}.ams-empty-slot{background:repeating-linear-gradient(45deg,#444,#444 2px,#222 2px 4px)}.dark .ams-empty-slot{background:repeating-linear-gradient(45deg,#555,#555 2px,#333 2px 4px)}.touch-manipulation{touch-action:manipulation}.safe-area-bottom{padding-bottom:env(safe-area-inset-bottom,0)}.safe-area-top{padding-top:env(safe-area-inset-top,0)}.scrollbar-hide{-ms-overflow-style:none;scrollbar-width:none}.scrollbar-hide::-webkit-scrollbar{display:none}@keyframes slide-in-left{0%{transform:translate(-100%)}to{transform:translate(0)}}.animate-slide-in-left{animation:.3s ease-out slide-in-left}@keyframes spoolbuddy-optimized-ping{0%{opacity:.8;transform:scale(.8)}80%,to{opacity:0;transform:scale(2.2)}}.spoolbuddy-optimized-ping{will-change:auto;contain:layout;animation:3.5s cubic-bezier(0,0,.2,1) infinite spoolbuddy-optimized-ping}.spoolbuddy-spool-glow{will-change:auto;transform:scale(2)}@media (prefers-reduced-motion:reduce){.spoolbuddy-optimized-ping{opacity:.25;animation:none;transform:scale(1.2)}.spoolbuddy-spool-glow{transition:none}}@keyframes slide-down{0%{transform:translateY(-100%)}to{transform:translateY(0)}}.animate-slide-down{animation:.25s ease-out slide-down}.card-shadow{box-shadow:var(--card-shadow)}[data-spoolbuddy-kiosk] .fixed .relative.max-w-2xl{flex-direction:column;height:90vh;max-height:90vh;display:flex}[data-spoolbuddy-kiosk] .fixed .relative.max-w-2xl>div:first-child,[data-spoolbuddy-kiosk] .fixed .relative.max-w-2xl>div:last-child{flex-shrink:0}[data-spoolbuddy-kiosk] .fixed .relative.max-w-2xl>div:nth-child(2){flex:auto;min-height:0;overflow-y:auto}[data-spoolbuddy-kiosk] .fixed .relative.max-w-2xl .max-h-96{max-height:none}.calendar-scroll{scrollbar-width:thin;scrollbar-color:var(--text-muted)transparent}@supports (color:color-mix(in lab, red, red)){.calendar-scroll{scrollbar-color:color-mix(in srgb,var(--text-muted)60%,transparent)transparent}}.calendar-scroll::-webkit-scrollbar{width:8px}.calendar-scroll::-webkit-scrollbar-track{background:0 0}.calendar-scroll::-webkit-scrollbar-thumb{background-color:var(--text-muted)}@supports (color:color-mix(in lab, red, red)){.calendar-scroll::-webkit-scrollbar-thumb{background-color:color-mix(in srgb,var(--text-muted)60%,transparent)}}.calendar-scroll::-webkit-scrollbar-thumb{border:2px solid var(--bg-secondary);border-radius:999px}@supports (color:color-mix(in lab, red, red)){.calendar-scroll::-webkit-scrollbar-thumb{border:2px solid color-mix(in srgb,var(--bg-secondary)70%,transparent)}}.calendar-scroll::-webkit-scrollbar-thumb:hover{background-color:var(--text-muted)}@supports (color:color-mix(in lab, red, red)){.calendar-scroll::-webkit-scrollbar-thumb:hover{background-color:color-mix(in srgb,var(--text-muted)80%,transparent)}}@media (hover:hover) and (pointer:fine){.history-thumb-hover:hover .history-thumb-preview{opacity:1}}.slice-colour-swatch{appearance:none;overflow:hidden}.slice-colour-swatch::-webkit-color-swatch-wrapper{padding:0}.slice-colour-swatch::-webkit-color-swatch{border:none;border-radius:999px}.slice-colour-swatch::-moz-color-swatch{border:none;border-radius:999px}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}@keyframes spin{to{transform:rotate(360deg)}}@keyframes ping{75%,to{opacity:0;transform:scale(2)}}@keyframes pulse{50%{opacity:.5}}.updated-overlay{--overlay-scale:1;--overlay-space:clamp(12px, 2.5vmin, 32px);isolation:isolate;color:#fff;min-height:100vh;font-size:calc(clamp(14px, 2.2vmin, 28px) * var(--overlay-scale));font-variant-numeric:tabular-nums;background:#10171b;flex-direction:column;justify-content:space-between;line-height:1.3;display:flex;position:relative}.updated-overlay[data-size=small]{--overlay-scale:.8}.updated-overlay[data-size=large]{--overlay-scale:1.2}.updated-overlay__header{justify-content:space-between;align-items:flex-start;gap:var(--overlay-space);padding:var(--overlay-space);z-index:1;display:flex}.updated-overlay__identity{background:#0c1317e6;border-radius:.7em;align-items:center;gap:.7em;min-width:0;padding:.65em .9em;display:flex}.updated-overlay__identity svg{flex-shrink:0;width:2em;height:2em}.updated-overlay__identity div{overflow-wrap:anywhere;min-width:0}.updated-overlay__identity strong{font-size:1.35em;display:block}.updated-overlay__identity span{color:#b8c0c7;display:block}.updated-overlay__logo{flex-shrink:0;margin-left:auto}.updated-overlay__logo img{width:clamp(100px,19vmin,230px);height:auto}.updated-overlay__camera{z-index:-1;position:absolute;inset:0;overflow:hidden}.updated-overlay__camera img{object-fit:cover;width:100%;max-width:none;height:100%;position:absolute;top:50%;left:50%}.updated-overlay__panel{padding:var(--overlay-space);background:#0c1317e0}.updated-overlay__summary{justify-content:space-between;align-items:center;gap:1em;margin-bottom:.8em;display:flex}.updated-overlay__summary h1{overflow-wrap:anywhere;min-width:0;font-size:1.65em;font-weight:700;line-height:1.2}.updated-overlay__status{color:#b8c0c7;align-items:center;gap:.5em;font-size:1.15em;font-weight:600;display:flex}.updated-overlay__status>span{background:currentColor;border-radius:50%;flex-shrink:0;width:.75em;height:.75em}.updated-overlay[data-state=RUNNING] .updated-overlay__status,.updated-overlay[data-state=FINISH] .updated-overlay__status{color:#00d76a}.updated-overlay[data-state=PAUSE] .updated-overlay__status{color:#fbbf24}.updated-overlay[data-state=FAILED] .updated-overlay__status{color:#f87171}.updated-overlay__progress{align-items:center;gap:1em;display:flex}.updated-overlay__progress>span{color:#b8c0c7;text-transform:uppercase;font-size:.8em}.updated-overlay__progress>strong{color:#00d76a;font-size:1.4em}.updated-overlay__progress>div{background:#3c454c;border-radius:1em;flex:1;height:.65em;overflow:hidden}.updated-overlay__progress>div>div{border-radius:inherit;background:#00d76a;height:100%;transition:width .5s}.updated-overlay__readings{border-top:1px solid #ffffff35;flex-wrap:wrap;gap:1em;margin-top:.8em;padding-top:.8em;display:flex}.updated-overlay__stats,.updated-overlay__temperatures{flex-wrap:wrap;flex:auto;gap:1em;display:flex}.updated-overlay__reading{flex:auto;align-items:center;gap:.6em;min-width:0;display:flex}.updated-overlay__reading svg{flex-shrink:0;width:1.8em;height:1.8em}.updated-overlay__reading>div>span{color:#b8c0c7;text-transform:uppercase;font-size:.7em;display:block}.updated-overlay__reading strong{overflow-wrap:anywhere;font-size:1.3em;display:block}.updated-overlay__reading small{color:#b8c0c7;font-size:.65em}@media (orientation:portrait){.updated-overlay{font-size:calc(clamp(14px, 3vmin, 36px) * var(--overlay-scale));grid-template-rows:auto 1fr auto;grid-template-columns:minmax(0,1fr);min-height:100vh;display:grid}.updated-overlay__header{background:#10171b;grid-row:1;align-items:center}.updated-overlay__identity{background:0 0;padding:0}.updated-overlay__camera{z-index:0;grid-row:2;min-height:30vh;position:relative}.updated-overlay__panel{background:#10171b;grid-row:3}.updated-overlay__summary{flex-direction:column-reverse;align-items:stretch;gap:.65em}.updated-overlay__progress{flex-wrap:wrap;justify-content:space-between;gap:.3em}.updated-overlay__progress>div{flex:0 0 100%;order:1}.updated-overlay__readings{flex-direction:column}.updated-overlay__temperatures:not(:first-child){border-top:1px solid #ffffff35;padding-top:.8em}}@media (prefers-reduced-motion:reduce){.updated-overlay__progress>div>div{transition:none}}.hg-theme-default{box-sizing:border-box;touch-action:manipulation;-webkit-user-select:none;user-select:none;background-color:#ececec;border-radius:5px;width:100%;padding:5px;font-family:HelveticaNeue-Light,Helvetica Neue Light,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;overflow:hidden}.hg-theme-default .hg-button span,.hg-theme-default .hg-button span svg{pointer-events:none}.hg-theme-default button.hg-button{font-size:inherit;border-width:0}.hg-theme-default .hg-button{flex-grow:1;display:inline-block}.hg-theme-default .hg-row{display:flex}.hg-theme-default .hg-row:not(:last-child){margin-bottom:5px}.hg-theme-default .hg-row .hg-button-container,.hg-theme-default .hg-row .hg-button:not(:last-child){margin-right:5px}.hg-theme-default .hg-row>div:last-child{margin-right:0}.hg-theme-default .hg-row .hg-button-container{display:flex}.hg-theme-default .hg-button{box-sizing:border-box;cursor:pointer;-webkit-tap-highlight-color:#0000;background:#fff;border-bottom:1px solid #b5b5b5;border-radius:5px;justify-content:center;align-items:center;height:40px;padding:5px;display:flex;box-shadow:0 0 3px -1px #0000004d}.hg-theme-default .hg-button.hg-standardBtn{width:20px}.hg-theme-default .hg-button.hg-activeButton{background:#efefef}.hg-theme-default.hg-layout-numeric .hg-button{justify-content:center;align-items:center;width:33.3%;height:60px;display:flex}.hg-theme-default .hg-button.hg-button-numpadadd,.hg-theme-default .hg-button.hg-button-numpadenter{height:85px}.hg-theme-default .hg-button.hg-button-numpad0{width:105px}.hg-theme-default .hg-button.hg-button-com{max-width:85px}.hg-theme-default .hg-button.hg-standardBtn.hg-button-at{max-width:45px}.hg-theme-default .hg-button.hg-selectedButton{color:#fff;background:#05194687}.hg-theme-default .hg-button.hg-standardBtn[data-skbtn=\.com]{max-width:82px}.hg-theme-default .hg-button.hg-standardBtn[data-skbtn=\@]{max-width:60px}.hg-candidate-box{-webkit-user-select:none;user-select:none;background:#ececec;border-bottom:2px solid #b5b5b5;border-radius:5px;margin-top:-10px;display:inline-flex;position:absolute;transform:translateY(-100%)}ul.hg-candidate-box-list{flex:1;margin:0;padding:0;list-style:none;display:flex}li.hg-candidate-box-list-item{justify-content:center;align-items:center;width:40px;height:40px;display:flex}li.hg-candidate-box-list-item:hover{cursor:pointer;background:#00000008}li.hg-candidate-box-list-item:active{background:#0000001a}.hg-candidate-box-prev:before{content:"◄"}.hg-candidate-box-next:before{content:"►"}.hg-candidate-box-next,.hg-candidate-box-prev{color:#969696;cursor:pointer;align-items:center;padding:0 10px;display:flex}.hg-candidate-box-next{border-top-right-radius:5px;border-bottom-right-radius:5px}.hg-candidate-box-prev{border-top-left-radius:5px;border-bottom-left-radius:5px}.hg-candidate-box-btn-active{color:#444}.simple-keyboard.vkb-theme{background:#1a1a1a;border-top:1px solid #333;padding:8px 4px;font-family:inherit}.simple-keyboard.vkb-theme .hg-row{gap:4px;margin-bottom:4px;flex-flow:row!important;display:flex!important}.simple-keyboard.vkb-theme .hg-row:last-child{margin-bottom:0}.simple-keyboard.vkb-theme .hg-button{color:#e0e0e0;cursor:pointer;background:#2d2d2d;border:none;border-radius:6px;flex:auto;justify-content:center;align-items:center;min-width:0;height:44px;padding:0 2px;font-size:16px;font-weight:500;transition:background .1s;box-shadow:0 1px 2px #0000004d;display:inline-flex!important}.simple-keyboard.vkb-theme .hg-button:active{color:#fff;background:#00ae42}.simple-keyboard.vkb-theme .hg-button-bksp,.simple-keyboard.vkb-theme .hg-button-shift,.simple-keyboard.vkb-theme .hg-button-lock{color:#aaa;background:#3a3a3a;flex-grow:1.5}.simple-keyboard.vkb-theme .hg-button-close{color:#aaa;background:#3a3a3a;flex-grow:2;font-weight:600}.simple-keyboard.vkb-theme .hg-button-close:active{background:#555}.simple-keyboard.vkb-theme .hg-button-space{flex-grow:7}.simple-keyboard.vkb-theme .hg-activeButton{color:#fff;background:#00ae42} +@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-content:""}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-100:oklch(93.6% .032 17.717);--color-red-200:oklch(88.5% .062 18.334);--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-red-800:oklch(44.4% .177 26.899);--color-red-900:oklch(39.6% .141 25.723);--color-red-950:oklch(25.8% .092 26.042);--color-orange-50:oklch(98% .016 73.684);--color-orange-100:oklch(95.4% .038 75.164);--color-orange-200:oklch(90.1% .076 70.697);--color-orange-300:oklch(83.7% .128 66.29);--color-orange-400:oklch(75% .183 55.934);--color-orange-500:oklch(70.5% .213 47.604);--color-orange-600:oklch(64.6% .222 41.116);--color-orange-700:oklch(55.3% .195 38.402);--color-orange-800:oklch(47% .157 37.304);--color-orange-900:oklch(40.8% .123 38.172);--color-amber-50:oklch(98.7% .022 95.277);--color-amber-100:oklch(96.2% .059 95.617);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-amber-700:oklch(55.5% .163 48.998);--color-amber-800:oklch(47.3% .137 46.201);--color-amber-900:oklch(41.4% .112 45.904);--color-yellow-50:oklch(98.7% .026 102.212);--color-yellow-100:oklch(97.3% .071 103.193);--color-yellow-200:oklch(94.5% .129 101.54);--color-yellow-300:oklch(90.5% .182 98.111);--color-yellow-400:oklch(85.2% .199 91.936);--color-yellow-500:oklch(79.5% .184 86.047);--color-yellow-600:oklch(68.1% .162 75.834);--color-yellow-700:oklch(55.4% .135 66.442);--color-yellow-800:oklch(47.6% .114 61.907);--color-lime-100:oklch(96.7% .067 122.328);--color-lime-400:oklch(84.1% .238 128.85);--color-lime-500:oklch(76.8% .233 130.85);--color-lime-700:oklch(53.2% .157 131.589);--color-green-50:oklch(98.2% .018 155.826);--color-green-100:oklch(96.2% .044 156.743);--color-green-200:oklch(92.5% .084 155.995);--color-green-300:oklch(87.1% .15 154.449);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-green-800:oklch(44.8% .119 151.328);--color-green-900:oklch(39.3% .095 152.535);--color-emerald-50:oklch(97.9% .021 166.113);--color-emerald-100:oklch(95% .052 163.051);--color-emerald-200:oklch(90.5% .093 164.15);--color-emerald-300:oklch(84.5% .143 164.978);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-600:oklch(59.6% .145 163.225);--color-emerald-700:oklch(50.8% .118 165.612);--color-teal-100:oklch(95.3% .051 180.801);--color-teal-400:oklch(77.7% .152 181.912);--color-teal-500:oklch(70.4% .14 182.503);--color-teal-600:oklch(60% .118 184.704);--color-teal-700:oklch(51.1% .096 186.391);--color-cyan-50:oklch(98.4% .019 200.873);--color-cyan-100:oklch(95.6% .045 203.388);--color-cyan-200:oklch(91.7% .08 205.041);--color-cyan-300:oklch(86.5% .127 207.078);--color-cyan-400:oklch(78.9% .154 211.53);--color-cyan-500:oklch(71.5% .143 215.221);--color-cyan-600:oklch(60.9% .126 221.723);--color-cyan-700:oklch(52% .105 223.128);--color-cyan-900:oklch(39.8% .07 227.392);--color-sky-50:oklch(97.7% .013 236.62);--color-sky-100:oklch(95.1% .026 236.824);--color-sky-400:oklch(74.6% .16 232.661);--color-sky-500:oklch(68.5% .169 237.323);--color-sky-600:oklch(58.8% .158 241.966);--color-sky-700:oklch(50% .134 242.749);--color-blue-50:oklch(97% .014 254.604);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-200:oklch(88.2% .059 254.128);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-blue-700:oklch(48.8% .243 264.376);--color-blue-800:oklch(42.4% .199 265.638);--color-blue-900:oklch(37.9% .146 265.522);--color-indigo-50:oklch(96.2% .018 272.314);--color-indigo-100:oklch(93% .034 272.788);--color-indigo-200:oklch(87% .065 274.039);--color-indigo-300:oklch(78.5% .115 274.713);--color-indigo-400:oklch(67.3% .182 276.935);--color-indigo-500:oklch(58.5% .233 277.117);--color-indigo-600:oklch(51.1% .262 276.966);--color-indigo-700:oklch(45.7% .24 277.023);--color-violet-500:oklch(60.6% .25 292.717);--color-purple-50:oklch(97.7% .014 308.299);--color-purple-100:oklch(94.6% .033 307.174);--color-purple-200:oklch(90.2% .063 306.703);--color-purple-300:oklch(82.7% .119 306.383);--color-purple-400:oklch(71.4% .203 305.504);--color-purple-500:oklch(62.7% .265 303.9);--color-purple-600:oklch(55.8% .288 302.321);--color-purple-700:oklch(49.6% .265 301.924);--color-fuchsia-100:oklch(95.2% .037 318.852);--color-fuchsia-300:oklch(83.3% .145 321.434);--color-fuchsia-500:oklch(66.7% .295 322.15);--color-fuchsia-700:oklch(51.8% .253 323.949);--color-pink-100:oklch(94.8% .028 342.258);--color-pink-400:oklch(71.8% .202 349.761);--color-pink-500:oklch(65.6% .241 354.308);--color-pink-700:oklch(52.5% .223 3.958);--color-rose-100:oklch(94.1% .03 12.58);--color-rose-200:oklch(89.2% .058 10.001);--color-rose-300:oklch(81% .117 11.638);--color-rose-400:oklch(71.2% .194 13.428);--color-rose-500:oklch(64.5% .246 16.439);--color-rose-600:oklch(58.6% .253 17.585);--color-rose-700:oklch(51.4% .222 16.935);--color-rose-900:oklch(41% .159 10.272);--color-slate-100:oklch(96.8% .007 247.896);--color-slate-200:oklch(92.9% .013 255.508);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-400:oklch(70.4% .04 256.788);--color-slate-500:oklch(55.4% .046 257.417);--color-slate-600:oklch(44.6% .043 257.281);--color-slate-700:oklch(37.2% .044 257.287);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-zinc-100:oklch(96.7% .001 286.375);--color-zinc-200:oklch(92% .004 286.32);--color-zinc-300:oklch(87.1% .006 286.286);--color-zinc-400:oklch(70.5% .015 286.067);--color-zinc-500:oklch(55.2% .016 285.938);--color-zinc-600:oklch(44.2% .017 285.786);--color-zinc-700:oklch(37% .013 285.805);--color-zinc-800:oklch(27.4% .006 286.033);--color-zinc-900:oklch(21% .006 285.885);--color-black:#000;--color-white:#fff;--spacing:.25rem;--breakpoint-2xl:96rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-xl:36rem;--container-2xl:42rem;--container-3xl:48rem;--container-4xl:56rem;--container-5xl:64rem;--container-6xl:72rem;--container-7xl:80rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height:calc(1.5/1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25/1.875);--text-5xl:3rem;--text-5xl--line-height:1;--font-weight-light:300;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-normal:0em;--tracking-wide:.025em;--tracking-wider:.05em;--tracking-widest:.1em;--leading-tight:1.25;--leading-snug:1.375;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--drop-shadow-md:0 3px 3px #0000001f;--drop-shadow-lg:0 4px 4px #00000026;--ease-out:cubic-bezier(0,0,.2,1);--ease-in-out:cubic-bezier(.4,0,.2,1);--animate-spin:spin 1s linear infinite;--animate-ping:ping 1s cubic-bezier(0,0,.2,1)infinite;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--blur-sm:8px;--blur-2xl:40px;--aspect-video:16/9;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-bambu-green:var(--accent);--color-bambu-green-light:var(--accent-light);--color-bambu-green-dark:var(--accent-dark);--color-status-ok:var(--status-ok);--color-status-error:var(--status-error);--color-status-warning:var(--status-warning);--color-bambu-dark:var(--bg-primary);--color-bambu-dark-secondary:var(--bg-secondary);--color-bambu-dark-tertiary:var(--bg-tertiary);--color-bambu-gray:var(--text-muted);--color-bambu-gray-light:var(--text-secondary);--color-bambu-gray-dark:var(--text-tertiary)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}button:not(:disabled),select:not(:disabled),summary,input[type=checkbox]:not(:disabled),input[type=radio]:not(:disabled),[role=button]:not([aria-disabled=true]){cursor:pointer}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing)*0)}.inset-2{inset:calc(var(--spacing)*2)}.inset-x-0{inset-inline:calc(var(--spacing)*0)}.inset-y-0{inset-block:calc(var(--spacing)*0)}.-top-0\.5{top:calc(var(--spacing)*-.5)}.-top-1{top:calc(var(--spacing)*-1)}.-top-1\.5{top:calc(var(--spacing)*-1.5)}.top-0{top:calc(var(--spacing)*0)}.top-0\.5{top:calc(var(--spacing)*.5)}.top-1{top:calc(var(--spacing)*1)}.top-1\.5{top:calc(var(--spacing)*1.5)}.top-1\/2{top:50%}.top-2{top:calc(var(--spacing)*2)}.top-2\.5{top:calc(var(--spacing)*2.5)}.top-3{top:calc(var(--spacing)*3)}.top-4{top:calc(var(--spacing)*4)}.top-8{top:calc(var(--spacing)*8)}.top-9{top:calc(var(--spacing)*9)}.top-16{top:calc(var(--spacing)*16)}.top-\[3px\]{top:3px}.top-\[52px\]{top:52px}.top-full{top:100%}.-right-0\.5{right:calc(var(--spacing)*-.5)}.-right-1{right:calc(var(--spacing)*-1)}.-right-1\.5{right:calc(var(--spacing)*-1.5)}.-right-2{right:calc(var(--spacing)*-2)}.right-0{right:calc(var(--spacing)*0)}.right-0\.5{right:calc(var(--spacing)*.5)}.right-1{right:calc(var(--spacing)*1)}.right-1\.5{right:calc(var(--spacing)*1.5)}.right-2{right:calc(var(--spacing)*2)}.right-3{right:calc(var(--spacing)*3)}.right-4{right:calc(var(--spacing)*4)}.right-6{right:calc(var(--spacing)*6)}.right-12{right:calc(var(--spacing)*12)}.right-\[5\.5rem\]{right:5.5rem}.right-full{right:100%}.-bottom-0\.5{bottom:calc(var(--spacing)*-.5)}.-bottom-1{bottom:calc(var(--spacing)*-1)}.-bottom-2{bottom:calc(var(--spacing)*-2)}.-bottom-4{bottom:calc(var(--spacing)*-4)}.-bottom-7{bottom:calc(var(--spacing)*-7)}.bottom-0{bottom:calc(var(--spacing)*0)}.bottom-0\.5{bottom:calc(var(--spacing)*.5)}.bottom-1{bottom:calc(var(--spacing)*1)}.bottom-2{bottom:calc(var(--spacing)*2)}.bottom-3{bottom:calc(var(--spacing)*3)}.bottom-4{bottom:calc(var(--spacing)*4)}.bottom-5{bottom:calc(var(--spacing)*5)}.bottom-6{bottom:calc(var(--spacing)*6)}.bottom-20{bottom:calc(var(--spacing)*20)}.bottom-24{bottom:calc(var(--spacing)*24)}.bottom-full{bottom:100%}.-left-1{left:calc(var(--spacing)*-1)}.-left-2{left:calc(var(--spacing)*-2)}.-left-\[9999px\]{left:-9999px}.left-0{left:calc(var(--spacing)*0)}.left-0\.5{left:calc(var(--spacing)*.5)}.left-1{left:calc(var(--spacing)*1)}.left-1\/2{left:50%}.left-2{left:calc(var(--spacing)*2)}.left-2\.5{left:calc(var(--spacing)*2.5)}.left-3{left:calc(var(--spacing)*3)}.left-4{left:calc(var(--spacing)*4)}.left-10{left:calc(var(--spacing)*10)}.left-12{left:calc(var(--spacing)*12)}.left-\[3px\]{left:3px}.left-full{left:100%}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.z-60{z-index:60}.z-\[1\]{z-index:1}.z-\[60\]{z-index:60}.z-\[70\]{z-index:70}.z-\[100\]{z-index:100}.z-\[101\]{z-index:101}.z-\[102\]{z-index:102}.z-\[110\]{z-index:110}.z-\[120\]{z-index:120}.z-\[1000\]{z-index:1000}.z-\[1001\]{z-index:1001}.z-\[9998\]{z-index:9998}.z-\[9999\]{z-index:9999}.order-first{order:-9999}.col-span-1{grid-column:span 1/span 1}.col-span-2{grid-column:span 2/span 2}.col-span-3{grid-column:span 3/span 3}.col-span-4{grid-column:span 4/span 4}.col-span-full{grid-column:1/-1}.\!container{width:100%!important}@media (min-width:40rem){.\!container{max-width:40rem!important}}@media (min-width:48rem){.\!container{max-width:48rem!important}}@media (min-width:64rem){.\!container{max-width:64rem!important}}@media (min-width:80rem){.\!container{max-width:80rem!important}}@media (min-width:96rem){.\!container{max-width:96rem!important}}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.-m-1{margin:calc(var(--spacing)*-1)}.-m-4{margin:calc(var(--spacing)*-4)}.-mx-2{margin-inline:calc(var(--spacing)*-2)}.-mx-4{margin-inline:calc(var(--spacing)*-4)}.mx-1{margin-inline:calc(var(--spacing)*1)}.mx-1\.5{margin-inline:calc(var(--spacing)*1.5)}.mx-2{margin-inline:calc(var(--spacing)*2)}.mx-4{margin-inline:calc(var(--spacing)*4)}.mx-5{margin-inline:calc(var(--spacing)*5)}.mx-auto{margin-inline:auto}.-my-1{margin-block:calc(var(--spacing)*-1)}.my-1{margin-block:calc(var(--spacing)*1)}.my-2{margin-block:calc(var(--spacing)*2)}.my-8{margin-block:calc(var(--spacing)*8)}.my-auto{margin-block:auto}.-mt-0\.5{margin-top:calc(var(--spacing)*-.5)}.-mt-2{margin-top:calc(var(--spacing)*-2)}.mt-0\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-1\.5{margin-top:calc(var(--spacing)*1.5)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-6{margin-top:calc(var(--spacing)*6)}.mt-8{margin-top:calc(var(--spacing)*8)}.mt-14{margin-top:calc(var(--spacing)*14)}.mt-auto{margin-top:auto}.-mr-2{margin-right:calc(var(--spacing)*-2)}.mr-1{margin-right:calc(var(--spacing)*1)}.mr-1\.5{margin-right:calc(var(--spacing)*1.5)}.mr-2{margin-right:calc(var(--spacing)*2)}.mr-3{margin-right:calc(var(--spacing)*3)}.mr-4{margin-right:calc(var(--spacing)*4)}.mr-\[2px\]{margin-right:2px}.mr-\[3px\]{margin-right:3px}.mr-auto{margin-right:auto}.-mb-1{margin-bottom:calc(var(--spacing)*-1)}.-mb-px{margin-bottom:-1px}.mb-0{margin-bottom:calc(var(--spacing)*0)}.mb-0\.5{margin-bottom:calc(var(--spacing)*.5)}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-1\.5{margin-bottom:calc(var(--spacing)*1.5)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-2\.5{margin-bottom:calc(var(--spacing)*2.5)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-5{margin-bottom:calc(var(--spacing)*5)}.mb-6{margin-bottom:calc(var(--spacing)*6)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.-ml-2{margin-left:calc(var(--spacing)*-2)}.ml-0{margin-left:calc(var(--spacing)*0)}.ml-0\.5{margin-left:calc(var(--spacing)*.5)}.ml-1{margin-left:calc(var(--spacing)*1)}.ml-1\.5{margin-left:calc(var(--spacing)*1.5)}.ml-2{margin-left:calc(var(--spacing)*2)}.ml-3{margin-left:calc(var(--spacing)*3)}.ml-4{margin-left:calc(var(--spacing)*4)}.ml-6{margin-left:calc(var(--spacing)*6)}.ml-7{margin-left:calc(var(--spacing)*7)}.ml-16{margin-left:calc(var(--spacing)*16)}.ml-64{margin-left:calc(var(--spacing)*64)}.ml-\[-3\.6px\]{margin-left:-3.6px}.ml-\[3\.25rem\]{margin-left:3.25rem}.ml-auto{margin-left:auto}.box-border{box-sizing:border-box}.line-clamp-1{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-3{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.table-row{display:table-row}.aspect-square{aspect-ratio:1}.aspect-video{aspect-ratio:var(--aspect-video)}.\!h-8{height:calc(var(--spacing)*8)!important}.h-0{height:calc(var(--spacing)*0)}.h-0\.5{height:calc(var(--spacing)*.5)}.h-1{height:calc(var(--spacing)*1)}.h-1\.5{height:calc(var(--spacing)*1.5)}.h-2{height:calc(var(--spacing)*2)}.h-2\.5{height:calc(var(--spacing)*2.5)}.h-3{height:calc(var(--spacing)*3)}.h-3\.5{height:calc(var(--spacing)*3.5)}.h-4{height:calc(var(--spacing)*4)}.h-4\.5{height:calc(var(--spacing)*4.5)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-7{height:calc(var(--spacing)*7)}.h-8{height:calc(var(--spacing)*8)}.h-9{height:calc(var(--spacing)*9)}.h-10{height:calc(var(--spacing)*10)}.h-12{height:calc(var(--spacing)*12)}.h-14{height:calc(var(--spacing)*14)}.h-16{height:calc(var(--spacing)*16)}.h-20{height:calc(var(--spacing)*20)}.h-24{height:calc(var(--spacing)*24)}.h-32{height:calc(var(--spacing)*32)}.h-40{height:calc(var(--spacing)*40)}.h-44{height:calc(var(--spacing)*44)}.h-48{height:calc(var(--spacing)*48)}.h-64{height:calc(var(--spacing)*64)}.h-80{height:calc(var(--spacing)*80)}.h-96{height:calc(var(--spacing)*96)}.h-\[2px\]{height:2px}.h-\[18px\]{height:18px}.h-\[38px\]{height:38px}.h-\[40px\]{height:40px}.h-\[48px\]{height:48px}.h-\[80vh\]{height:80vh}.h-\[94vh\]{height:94vh}.h-\[160px\]{height:160px}.h-\[300px\]{height:300px}.h-\[calc\(100\%-40px\)\]{height:calc(100% - 40px)}.h-\[calc\(100vh-1rem\)\]{height:calc(100vh - 1rem)}.h-\[calc\(100vh-64px\)\]{height:calc(100vh - 64px)}.h-\[var\(--pc-i2\,0\.5rem\)\]{height:var(--pc-i2,.5rem)}.h-\[var\(--pc-i3\,0\.75rem\)\]{height:var(--pc-i3,.75rem)}.h-\[var\(--pc-i4\,1rem\)\]{height:var(--pc-i4,1rem)}.h-\[var\(--pc-i5\,1\.25rem\)\]{height:var(--pc-i5,1.25rem)}.h-\[var\(--pc-i7\,28px\)\]{height:var(--pc-i7,28px)}.h-\[var\(--pc-i25\,0\.625rem\)\]{height:var(--pc-i25,.625rem)}.h-\[var\(--pc-i35\,0\.875rem\)\]{height:var(--pc-i35,.875rem)}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-40{max-height:calc(var(--spacing)*40)}.max-h-44{max-height:calc(var(--spacing)*44)}.max-h-48{max-height:calc(var(--spacing)*48)}.max-h-56{max-height:calc(var(--spacing)*56)}.max-h-60{max-height:calc(var(--spacing)*60)}.max-h-64{max-height:calc(var(--spacing)*64)}.max-h-72{max-height:calc(var(--spacing)*72)}.max-h-80{max-height:calc(var(--spacing)*80)}.max-h-96{max-height:calc(var(--spacing)*96)}.max-h-\[3\.75rem\]{max-height:3.75rem}.max-h-\[22rem\]{max-height:22rem}.max-h-\[24rem\]{max-height:24rem}.max-h-\[28rem\]{max-height:28rem}.max-h-\[50vh\]{max-height:50vh}.max-h-\[60vh\]{max-height:60vh}.max-h-\[75vh\]{max-height:75vh}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[86vh\]{max-height:86vh}.max-h-\[88vh\]{max-height:88vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[300px\]{max-height:300px}.max-h-\[400px\]{max-height:400px}.max-h-\[500px\]{max-height:500px}.max-h-\[600px\]{max-height:600px}.max-h-\[820px\]{max-height:820px}.max-h-\[calc\(90vh-80px\)\]{max-height:calc(90vh - 80px)}.max-h-\[calc\(100vh-2rem\)\]{max-height:calc(100vh - 2rem)}.max-h-\[calc\(100vh-320px\)\]{max-height:calc(100vh - 320px)}.max-h-full{max-height:100%}.\!min-h-8{min-height:calc(var(--spacing)*8)!important}.min-h-0{min-height:calc(var(--spacing)*0)}.min-h-7{min-height:calc(var(--spacing)*7)}.min-h-40{min-height:calc(var(--spacing)*40)}.min-h-\[8rem\]{min-height:8rem}.min-h-\[14px\]{min-height:14px}.min-h-\[16px\]{min-height:16px}.min-h-\[18px\]{min-height:18px}.min-h-\[18rem\]{min-height:18rem}.min-h-\[36px\]{min-height:36px}.min-h-\[40px\]{min-height:40px}.min-h-\[44px\]{min-height:44px}.min-h-\[48px\]{min-height:48px}.min-h-\[60px\]{min-height:60px}.min-h-\[80px\]{min-height:80px}.min-h-\[120px\]{min-height:120px}.min-h-\[300px\]{min-height:300px}.min-h-\[400px\]{min-height:400px}.min-h-\[calc\(100vh-64px\)\]{min-height:calc(100vh - 64px)}.min-h-screen{min-height:100vh}.\!w-6{width:calc(var(--spacing)*6)!important}.\!w-8{width:calc(var(--spacing)*8)!important}.w-0{width:calc(var(--spacing)*0)}.w-0\.5{width:calc(var(--spacing)*.5)}.w-1{width:calc(var(--spacing)*1)}.w-1\.5{width:calc(var(--spacing)*1.5)}.w-1\/2{width:50%}.w-1\/3{width:33.3333%}.w-2{width:calc(var(--spacing)*2)}.w-2\.5{width:calc(var(--spacing)*2.5)}.w-3{width:calc(var(--spacing)*3)}.w-3\.5{width:calc(var(--spacing)*3.5)}.w-4{width:calc(var(--spacing)*4)}.w-4\.5{width:calc(var(--spacing)*4.5)}.w-5{width:calc(var(--spacing)*5)}.w-5\/12{width:41.6667%}.w-6{width:calc(var(--spacing)*6)}.w-7{width:calc(var(--spacing)*7)}.w-7\/12{width:58.3333%}.w-8{width:calc(var(--spacing)*8)}.w-9{width:calc(var(--spacing)*9)}.w-10{width:calc(var(--spacing)*10)}.w-11{width:calc(var(--spacing)*11)}.w-12{width:calc(var(--spacing)*12)}.w-14{width:calc(var(--spacing)*14)}.w-16{width:calc(var(--spacing)*16)}.w-20{width:calc(var(--spacing)*20)}.w-24{width:calc(var(--spacing)*24)}.w-28{width:calc(var(--spacing)*28)}.w-32{width:calc(var(--spacing)*32)}.w-36{width:calc(var(--spacing)*36)}.w-40{width:calc(var(--spacing)*40)}.w-44{width:calc(var(--spacing)*44)}.w-48{width:calc(var(--spacing)*48)}.w-52{width:calc(var(--spacing)*52)}.w-56{width:calc(var(--spacing)*56)}.w-64{width:calc(var(--spacing)*64)}.w-72{width:calc(var(--spacing)*72)}.w-96{width:calc(var(--spacing)*96)}.w-\[18px\]{width:18px}.w-\[52px\]{width:52px}.w-\[216px\]{width:216px}.w-\[240px\]{width:240px}.w-\[300px\]{width:300px}.w-\[340px\]{width:340px}.w-\[420px\]{width:420px}.w-\[min\(1800px\,96vw\)\]{width:min(1800px,96vw)}.w-\[var\(--pc-i2\,0\.5rem\)\]{width:var(--pc-i2,.5rem)}.w-\[var\(--pc-i3\,0\.75rem\)\]{width:var(--pc-i3,.75rem)}.w-\[var\(--pc-i4\,1rem\)\]{width:var(--pc-i4,1rem)}.w-\[var\(--pc-i5\,1\.25rem\)\]{width:var(--pc-i5,1.25rem)}.w-\[var\(--pc-i7\,28px\)\]{width:var(--pc-i7,28px)}.w-\[var\(--pc-i25\,0\.625rem\)\]{width:var(--pc-i25,.625rem)}.w-\[var\(--pc-i35\,0\.875rem\)\]{width:var(--pc-i35,.875rem)}.w-auto{width:auto}.w-fit{width:fit-content}.w-full{width:100%}.w-max{width:max-content}.w-px{width:1px}.w-screen{width:100vw}.max-w-2xl{max-width:var(--container-2xl)}.max-w-3xl{max-width:var(--container-3xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-5xl{max-width:var(--container-5xl)}.max-w-6xl{max-width:var(--container-6xl)}.max-w-32{max-width:calc(var(--spacing)*32)}.max-w-\[14rem\]{max-width:14rem}.max-w-\[40\%\]{max-width:40%}.max-w-\[80px\]{max-width:80px}.max-w-\[86vh\]{max-width:86vh}.max-w-\[90vw\]{max-width:90vw}.max-w-\[100px\]{max-width:100px}.max-w-\[110px\]{max-width:110px}.max-w-\[120px\]{max-width:120px}.max-w-\[150px\]{max-width:150px}.max-w-\[160px\]{max-width:160px}.max-w-\[200px\]{max-width:200px}.max-w-\[220px\]{max-width:220px}.max-w-\[280px\]{max-width:280px}.max-w-\[980px\]{max-width:980px}.max-w-full{max-width:100%}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-none{max-width:none}.max-w-screen-2xl{max-width:var(--breakpoint-2xl)}.max-w-sm{max-width:var(--container-sm)}.max-w-xl{max-width:var(--container-xl)}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:calc(var(--spacing)*0)}.min-w-28{min-width:calc(var(--spacing)*28)}.min-w-40{min-width:calc(var(--spacing)*40)}.min-w-48{min-width:calc(var(--spacing)*48)}.min-w-\[10ch\]{min-width:10ch}.min-w-\[10rem\]{min-width:10rem}.min-w-\[12rem\]{min-width:12rem}.min-w-\[16ch\]{min-width:16ch}.min-w-\[16px\]{min-width:16px}.min-w-\[18px\]{min-width:18px}.min-w-\[32px\]{min-width:32px}.min-w-\[40px\]{min-width:40px}.min-w-\[48px\]{min-width:48px}.min-w-\[50px\]{min-width:50px}.min-w-\[80px\]{min-width:80px}.min-w-\[100px\]{min-width:100px}.min-w-\[120px\]{min-width:120px}.min-w-\[130px\]{min-width:130px}.min-w-\[140px\]{min-width:140px}.min-w-\[150px\]{min-width:150px}.min-w-\[160px\]{min-width:160px}.min-w-\[180px\]{min-width:180px}.min-w-\[200px\]{min-width:200px}.min-w-fit{min-width:fit-content}.min-w-full{min-width:100%}.flex-1{flex:1}.flex-\[0_1_auto\]{flex:0 auto}.flex-shrink{flex-shrink:1}.flex-shrink-0{flex-shrink:0}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.flex-grow,.grow{flex-grow:1}.table-fixed{table-layout:fixed}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x:calc(calc(1/2*100%)*-1);translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-x-full{--tw-translate-x:-100%;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-0{--tw-translate-x:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-0\.5{--tw-translate-x:calc(var(--spacing)*.5);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-1{--tw-translate-x:calc(var(--spacing)*1);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-3\.5{--tw-translate-x:calc(var(--spacing)*3.5);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-4{--tw-translate-x:calc(var(--spacing)*4);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-5{--tw-translate-x:calc(var(--spacing)*5);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-6{--tw-translate-x:calc(var(--spacing)*6);translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y:calc(calc(1/2*100%)*-1);translate:var(--tw-translate-x)var(--tw-translate-y)}.scale-105{--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x)var(--tw-scale-y)}.scale-110{--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x)var(--tw-scale-y)}.scale-\[1\.01\]{scale:1.01}.scale-\[1\.02\]{scale:1.02}.-rotate-90{rotate:-90deg}.rotate-45{rotate:45deg}.rotate-90{rotate:90deg}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-ping{animation:var(--animate-ping)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-col-resize{cursor:col-resize}.cursor-crosshair{cursor:crosshair}.cursor-default{cursor:default}.cursor-ew-resize{cursor:ew-resize}.cursor-grab{cursor:grab}.cursor-grabbing{cursor:grabbing}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.cursor-row-resize{cursor:row-resize}.cursor-se-resize{cursor:se-resize}.touch-none{touch-action:none}.resize{resize:both}.resize-none{resize:none}.resize-y{resize:vertical}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.\[appearance\:textfield\]{appearance:textfield}.appearance-none{appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.grid-cols-\[auto_1fr\]{grid-template-columns:auto 1fr}.grid-cols-\[auto_1fr_100px_100px_100px_minmax\(0\,200px\)_220px\]{grid-template-columns:auto 1fr 100px 100px 100px minmax(0,200px) 220px}.grid-cols-\[auto_1fr_120px_100px_100px_100px_minmax\(0\,200px\)_220px\]{grid-template-columns:auto 1fr 120px 100px 100px 100px minmax(0,200px) 220px}.grid-cols-\[minmax\(320px\,1fr\)_minmax\(340px\,0\.9fr\)\]{grid-template-columns:minmax(320px,1fr) minmax(340px,.9fr)}.grid-cols-\[repeat\(auto-fill\,minmax\(130px\,1fr\)\)\]{grid-template-columns:repeat(auto-fill,minmax(130px,1fr))}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-row{flex-direction:row}.flex-nowrap{flex-wrap:nowrap}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.items-stretch{align-items:stretch}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.justify-items-center{justify-items:center}.gap-0{gap:calc(var(--spacing)*0)}.gap-0\.5{gap:calc(var(--spacing)*.5)}.gap-1{gap:calc(var(--spacing)*1)}.gap-1\.5{gap:calc(var(--spacing)*1.5)}.gap-2{gap:calc(var(--spacing)*2)}.gap-2\.5{gap:calc(var(--spacing)*2.5)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.gap-5{gap:calc(var(--spacing)*5)}.gap-6{gap:calc(var(--spacing)*6)}.gap-8{gap:calc(var(--spacing)*8)}.gap-\[3px\]{gap:3px}.gap-\[20px\]{gap:20px}:where(.space-y-0>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*0)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*0)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*.5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1.5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2.5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*6)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*6)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*8)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*8)*calc(1 - var(--tw-space-y-reverse)))}.gap-x-2{column-gap:calc(var(--spacing)*2)}.gap-x-3{column-gap:calc(var(--spacing)*3)}.gap-x-4{column-gap:calc(var(--spacing)*4)}.gap-x-6{column-gap:calc(var(--spacing)*6)}.gap-y-0\.5{row-gap:calc(var(--spacing)*.5)}.gap-y-1{row-gap:calc(var(--spacing)*1)}.gap-y-1\.5{row-gap:calc(var(--spacing)*1.5)}.gap-y-2{row-gap:calc(var(--spacing)*2)}.gap-y-3{row-gap:calc(var(--spacing)*3)}.gap-y-4{row-gap:calc(var(--spacing)*4)}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px*var(--tw-divide-y-reverse));border-bottom-width:calc(1px*calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-bambu-dark-tertiary>:not(:last-child)),:where(.divide-bambu-dark-tertiary\/30>:not(:last-child)){border-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){:where(.divide-bambu-dark-tertiary\/30>:not(:last-child)){border-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)30%,transparent)}}:where(.divide-bambu-dark-tertiary\/40>:not(:last-child)){border-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){:where(.divide-bambu-dark-tertiary\/40>:not(:last-child)){border-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)40%,transparent)}}:where(.divide-bambu-gray\/20>:not(:last-child)){border-color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){:where(.divide-bambu-gray\/20>:not(:last-child)){border-color:color-mix(in oklab,var(--color-bambu-gray)20%,transparent)}}:where(.divide-gray-100>:not(:last-child)){border-color:var(--color-gray-100)}.self-start{align-self:flex-start}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-clip{overflow:clip}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-\[10px\]{border-radius:10px}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-none{border-radius:0}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.rounded-t-2xl{border-top-left-radius:var(--radius-2xl);border-top-right-radius:var(--radius-2xl)}.rounded-t-lg{border-top-left-radius:var(--radius-lg);border-top-right-radius:var(--radius-lg)}.rounded-t-xl{border-top-left-radius:var(--radius-xl);border-top-right-radius:var(--radius-xl)}.\!rounded-l-none{border-top-left-radius:0!important;border-bottom-left-radius:0!important}.rounded-l{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-l-lg{border-top-left-radius:var(--radius-lg);border-bottom-left-radius:var(--radius-lg)}.rounded-l-none{border-top-left-radius:0;border-bottom-left-radius:0}.rounded-tl{border-top-left-radius:.25rem}.\!rounded-r-none{border-top-right-radius:0!important;border-bottom-right-radius:0!important}.rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.rounded-r-lg{border-top-right-radius:var(--radius-lg);border-bottom-right-radius:var(--radius-lg)}.rounded-r-none{border-top-right-radius:0;border-bottom-right-radius:0}.rounded-b-2xl{border-bottom-right-radius:var(--radius-2xl);border-bottom-left-radius:var(--radius-2xl)}.rounded-b-lg{border-bottom-right-radius:var(--radius-lg);border-bottom-left-radius:var(--radius-lg)}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-4{border-style:var(--tw-border-style);border-width:4px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-0{border-top-style:var(--tw-border-style);border-top-width:0}.border-t-2{border-top-style:var(--tw-border-style);border-top-width:2px}.border-t-\[5px\]{border-top-style:var(--tw-border-style);border-top-width:5px}.border-t-\[6px\]{border-top-style:var(--tw-border-style);border-top-width:6px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-r-\[5px\]{border-right-style:var(--tw-border-style);border-right-width:5px}.border-r-\[6px\]{border-right-style:var(--tw-border-style);border-right-width:6px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-0{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-b-\[6px\]{border-bottom-style:var(--tw-border-style);border-bottom-width:6px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.border-l-\[3px\]{border-left-style:var(--tw-border-style);border-left-width:3px}.border-l-\[5px\]{border-left-style:var(--tw-border-style);border-left-width:5px}.border-l-\[6px\]{border-left-style:var(--tw-border-style);border-left-width:6px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-\[var\(--border-color\)\]{border-color:var(--border-color)}.border-amber-200{border-color:var(--color-amber-200)}.border-amber-300{border-color:var(--color-amber-300)}.border-amber-400\/20{border-color:#fcbb0033}@supports (color:color-mix(in lab, red, red)){.border-amber-400\/20{border-color:color-mix(in oklab,var(--color-amber-400)20%,transparent)}}.border-amber-500{border-color:var(--color-amber-500)}.border-amber-500\/20{border-color:#f99c0033}@supports (color:color-mix(in lab, red, red)){.border-amber-500\/20{border-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.border-amber-500\/30{border-color:#f99c004d}@supports (color:color-mix(in lab, red, red)){.border-amber-500\/30{border-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.border-amber-500\/40{border-color:#f99c0066}@supports (color:color-mix(in lab, red, red)){.border-amber-500\/40{border-color:color-mix(in oklab,var(--color-amber-500)40%,transparent)}}.border-amber-500\/60{border-color:#f99c0099}@supports (color:color-mix(in lab, red, red)){.border-amber-500\/60{border-color:color-mix(in oklab,var(--color-amber-500)60%,transparent)}}.border-bambu-dark{border-color:var(--color-bambu-dark)}.border-bambu-dark-secondary{border-color:var(--color-bambu-dark-secondary)}.border-bambu-dark-tertiary,.border-bambu-dark-tertiary\/20{border-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.border-bambu-dark-tertiary\/20{border-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)20%,transparent)}}.border-bambu-dark-tertiary\/30{border-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.border-bambu-dark-tertiary\/30{border-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)30%,transparent)}}.border-bambu-dark-tertiary\/40{border-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.border-bambu-dark-tertiary\/40{border-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)40%,transparent)}}.border-bambu-dark-tertiary\/50{border-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.border-bambu-dark-tertiary\/50{border-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)50%,transparent)}}.border-bambu-dark-tertiary\/60{border-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.border-bambu-dark-tertiary\/60{border-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)60%,transparent)}}.border-bambu-gray,.border-bambu-gray\/20{border-color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.border-bambu-gray\/20{border-color:color-mix(in oklab,var(--color-bambu-gray)20%,transparent)}}.border-bambu-gray\/30{border-color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.border-bambu-gray\/30{border-color:color-mix(in oklab,var(--color-bambu-gray)30%,transparent)}}.border-bambu-gray\/50{border-color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.border-bambu-gray\/50{border-color:color-mix(in oklab,var(--color-bambu-gray)50%,transparent)}}.border-bambu-green,.border-bambu-green\/20{border-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.border-bambu-green\/20{border-color:color-mix(in oklab,var(--color-bambu-green)20%,transparent)}}.border-bambu-green\/30{border-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.border-bambu-green\/30{border-color:color-mix(in oklab,var(--color-bambu-green)30%,transparent)}}.border-bambu-green\/40{border-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.border-bambu-green\/40{border-color:color-mix(in oklab,var(--color-bambu-green)40%,transparent)}}.border-bambu-green\/50{border-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.border-bambu-green\/50{border-color:color-mix(in oklab,var(--color-bambu-green)50%,transparent)}}.border-bambu-green\/60{border-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.border-bambu-green\/60{border-color:color-mix(in oklab,var(--color-bambu-green)60%,transparent)}}.border-black\/20{border-color:#0003}@supports (color:color-mix(in lab, red, red)){.border-black\/20{border-color:color-mix(in oklab,var(--color-black)20%,transparent)}}.border-blue-200{border-color:var(--color-blue-200)}.border-blue-300{border-color:var(--color-blue-300)}.border-blue-400{border-color:var(--color-blue-400)}.border-blue-400\/60{border-color:#54a2ff99}@supports (color:color-mix(in lab, red, red)){.border-blue-400\/60{border-color:color-mix(in oklab,var(--color-blue-400)60%,transparent)}}.border-blue-500{border-color:var(--color-blue-500)}.border-blue-500\/30{border-color:#3080ff4d}@supports (color:color-mix(in lab, red, red)){.border-blue-500\/30{border-color:color-mix(in oklab,var(--color-blue-500)30%,transparent)}}.border-blue-500\/50{border-color:#3080ff80}@supports (color:color-mix(in lab, red, red)){.border-blue-500\/50{border-color:color-mix(in oklab,var(--color-blue-500)50%,transparent)}}.border-current{border-color:currentColor}.border-cyan-300{border-color:var(--color-cyan-300)}.border-cyan-400{border-color:var(--color-cyan-400)}.border-cyan-400\/50{border-color:#00d2ef80}@supports (color:color-mix(in lab, red, red)){.border-cyan-400\/50{border-color:color-mix(in oklab,var(--color-cyan-400)50%,transparent)}}.border-emerald-200{border-color:var(--color-emerald-200)}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.border-gray-400\/20{border-color:#99a1af33}@supports (color:color-mix(in lab, red, red)){.border-gray-400\/20{border-color:color-mix(in oklab,var(--color-gray-400)20%,transparent)}}.border-gray-500{border-color:var(--color-gray-500)}.border-gray-500\/30{border-color:#6a72824d}@supports (color:color-mix(in lab, red, red)){.border-gray-500\/30{border-color:color-mix(in oklab,var(--color-gray-500)30%,transparent)}}.border-gray-500\/40{border-color:#6a728266}@supports (color:color-mix(in lab, red, red)){.border-gray-500\/40{border-color:color-mix(in oklab,var(--color-gray-500)40%,transparent)}}.border-gray-700{border-color:var(--color-gray-700)}.border-gray-800{border-color:var(--color-gray-800)}.border-green-200{border-color:var(--color-green-200)}.border-green-300{border-color:var(--color-green-300)}.border-green-400{border-color:var(--color-green-400)}.border-green-400\/60{border-color:#05df7299}@supports (color:color-mix(in lab, red, red)){.border-green-400\/60{border-color:color-mix(in oklab,var(--color-green-400)60%,transparent)}}.border-green-500{border-color:var(--color-green-500)}.border-green-500\/30{border-color:#00c7584d}@supports (color:color-mix(in lab, red, red)){.border-green-500\/30{border-color:color-mix(in oklab,var(--color-green-500)30%,transparent)}}.border-green-500\/40{border-color:#00c75866}@supports (color:color-mix(in lab, red, red)){.border-green-500\/40{border-color:color-mix(in oklab,var(--color-green-500)40%,transparent)}}.border-green-800{border-color:var(--color-green-800)}.border-orange-200{border-color:var(--color-orange-200)}.border-orange-300{border-color:var(--color-orange-300)}.border-orange-400\/60{border-color:#ff8b1a99}@supports (color:color-mix(in lab, red, red)){.border-orange-400\/60{border-color:color-mix(in oklab,var(--color-orange-400)60%,transparent)}}.border-orange-500{border-color:var(--color-orange-500)}.border-orange-500\/30{border-color:#fe6e004d}@supports (color:color-mix(in lab, red, red)){.border-orange-500\/30{border-color:color-mix(in oklab,var(--color-orange-500)30%,transparent)}}.border-purple-200{border-color:var(--color-purple-200)}.border-purple-300{border-color:var(--color-purple-300)}.border-purple-400\/60{border-color:#c07eff99}@supports (color:color-mix(in lab, red, red)){.border-purple-400\/60{border-color:color-mix(in oklab,var(--color-purple-400)60%,transparent)}}.border-purple-500{border-color:var(--color-purple-500)}.border-red-200{border-color:var(--color-red-200)}.border-red-300{border-color:var(--color-red-300)}.border-red-400{border-color:var(--color-red-400)}.border-red-400\/60{border-color:#ff656899}@supports (color:color-mix(in lab, red, red)){.border-red-400\/60{border-color:color-mix(in oklab,var(--color-red-400)60%,transparent)}}.border-red-500{border-color:var(--color-red-500)}.border-red-500\/20{border-color:#fb2c3633}@supports (color:color-mix(in lab, red, red)){.border-red-500\/20{border-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.border-red-500\/30{border-color:#fb2c364d}@supports (color:color-mix(in lab, red, red)){.border-red-500\/30{border-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.border-red-500\/40{border-color:#fb2c3666}@supports (color:color-mix(in lab, red, red)){.border-red-500\/40{border-color:color-mix(in oklab,var(--color-red-500)40%,transparent)}}.border-red-500\/50{border-color:#fb2c3680}@supports (color:color-mix(in lab, red, red)){.border-red-500\/50{border-color:color-mix(in oklab,var(--color-red-500)50%,transparent)}}.border-red-700{border-color:var(--color-red-700)}.border-red-800{border-color:var(--color-red-800)}.border-red-800\/70{border-color:#9f0712b3}@supports (color:color-mix(in lab, red, red)){.border-red-800\/70{border-color:color-mix(in oklab,var(--color-red-800)70%,transparent)}}.border-red-900\/40{border-color:#82181a66}@supports (color:color-mix(in lab, red, red)){.border-red-900\/40{border-color:color-mix(in oklab,var(--color-red-900)40%,transparent)}}.border-slate-500{border-color:var(--color-slate-500)}.border-status-error\/20{border-color:var(--color-status-error)}@supports (color:color-mix(in lab, red, red)){.border-status-error\/20{border-color:color-mix(in oklab,var(--color-status-error)20%,transparent)}}.border-status-ok,.border-status-ok\/20{border-color:var(--color-status-ok)}@supports (color:color-mix(in lab, red, red)){.border-status-ok\/20{border-color:color-mix(in oklab,var(--color-status-ok)20%,transparent)}}.border-status-warning\/20{border-color:var(--color-status-warning)}@supports (color:color-mix(in lab, red, red)){.border-status-warning\/20{border-color:color-mix(in oklab,var(--color-status-warning)20%,transparent)}}.border-teal-400\/60{border-color:#00d3bd99}@supports (color:color-mix(in lab, red, red)){.border-teal-400\/60{border-color:color-mix(in oklab,var(--color-teal-400)60%,transparent)}}.border-transparent{border-color:#0000}.border-white{border-color:var(--color-white)}.border-white\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab, red, red)){.border-white\/10{border-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.border-white\/15{border-color:#ffffff26}@supports (color:color-mix(in lab, red, red)){.border-white\/15{border-color:color-mix(in oklab,var(--color-white)15%,transparent)}}.border-white\/20{border-color:#fff3}@supports (color:color-mix(in lab, red, red)){.border-white\/20{border-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.border-white\/30{border-color:#ffffff4d}@supports (color:color-mix(in lab, red, red)){.border-white\/30{border-color:color-mix(in oklab,var(--color-white)30%,transparent)}}.border-yellow-200{border-color:var(--color-yellow-200)}.border-yellow-300{border-color:var(--color-yellow-300)}.border-yellow-400{border-color:var(--color-yellow-400)}.border-yellow-500{border-color:var(--color-yellow-500)}.border-yellow-500\/30{border-color:#edb2004d}@supports (color:color-mix(in lab, red, red)){.border-yellow-500\/30{border-color:color-mix(in oklab,var(--color-yellow-500)30%,transparent)}}.border-yellow-500\/40{border-color:#edb20066}@supports (color:color-mix(in lab, red, red)){.border-yellow-500\/40{border-color:color-mix(in oklab,var(--color-yellow-500)40%,transparent)}}.border-yellow-500\/50{border-color:#edb20080}@supports (color:color-mix(in lab, red, red)){.border-yellow-500\/50{border-color:color-mix(in oklab,var(--color-yellow-500)50%,transparent)}}.border-zinc-500{border-color:var(--color-zinc-500)}.border-zinc-600{border-color:var(--color-zinc-600)}.border-zinc-700{border-color:var(--color-zinc-700)}.border-zinc-700\/50{border-color:#3f3f4680}@supports (color:color-mix(in lab, red, red)){.border-zinc-700\/50{border-color:color-mix(in oklab,var(--color-zinc-700)50%,transparent)}}.border-t-bambu-dark-tertiary{border-top-color:var(--color-bambu-dark-tertiary)}.border-t-transparent{border-top-color:#0000}.border-r-transparent{border-right-color:#0000}.border-b-bambu-dark-tertiary{border-bottom-color:var(--color-bambu-dark-tertiary)}.border-l-blue-500{border-left-color:var(--color-blue-500)}.border-l-cyan-400{border-left-color:var(--color-cyan-400)}.border-l-emerald-500{border-left-color:var(--color-emerald-500)}.border-l-gray-500{border-left-color:var(--color-gray-500)}.border-l-red-500{border-left-color:var(--color-red-500)}.border-l-transparent{border-left-color:#0000}.border-l-yellow-500{border-left-color:var(--color-yellow-500)}.\!bg-bambu-green{background-color:var(--color-bambu-green)!important}.bg-amber-50{background-color:var(--color-amber-50)}.bg-amber-100{background-color:var(--color-amber-100)}.bg-amber-100\/60{background-color:#fef3c699}@supports (color:color-mix(in lab, red, red)){.bg-amber-100\/60{background-color:color-mix(in oklab,var(--color-amber-100)60%,transparent)}}.bg-amber-400{background-color:var(--color-amber-400)}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/5{background-color:#f99c000d}@supports (color:color-mix(in lab, red, red)){.bg-amber-500\/5{background-color:color-mix(in oklab,var(--color-amber-500)5%,transparent)}}.bg-amber-500\/10{background-color:#f99c001a}@supports (color:color-mix(in lab, red, red)){.bg-amber-500\/10{background-color:color-mix(in oklab,var(--color-amber-500)10%,transparent)}}.bg-amber-500\/20{background-color:#f99c0033}@supports (color:color-mix(in lab, red, red)){.bg-amber-500\/20{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.bg-amber-500\/70{background-color:#f99c00b3}@supports (color:color-mix(in lab, red, red)){.bg-amber-500\/70{background-color:color-mix(in oklab,var(--color-amber-500)70%,transparent)}}.bg-amber-500\/85{background-color:#f99c00d9}@supports (color:color-mix(in lab, red, red)){.bg-amber-500\/85{background-color:color-mix(in oklab,var(--color-amber-500)85%,transparent)}}.bg-amber-500\/90{background-color:#f99c00e6}@supports (color:color-mix(in lab, red, red)){.bg-amber-500\/90{background-color:color-mix(in oklab,var(--color-amber-500)90%,transparent)}}.bg-amber-600{background-color:var(--color-amber-600)}.bg-amber-700{background-color:var(--color-amber-700)}.bg-amber-900\/30{background-color:#7b33064d}@supports (color:color-mix(in lab, red, red)){.bg-amber-900\/30{background-color:color-mix(in oklab,var(--color-amber-900)30%,transparent)}}.bg-bambu-dark{background-color:var(--color-bambu-dark)}.bg-bambu-dark-secondary,.bg-bambu-dark-secondary\/30{background-color:var(--color-bambu-dark-secondary)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark-secondary\/30{background-color:color-mix(in oklab,var(--color-bambu-dark-secondary)30%,transparent)}}.bg-bambu-dark-secondary\/50{background-color:var(--color-bambu-dark-secondary)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark-secondary\/50{background-color:color-mix(in oklab,var(--color-bambu-dark-secondary)50%,transparent)}}.bg-bambu-dark-secondary\/60{background-color:var(--color-bambu-dark-secondary)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark-secondary\/60{background-color:color-mix(in oklab,var(--color-bambu-dark-secondary)60%,transparent)}}.bg-bambu-dark-secondary\/90{background-color:var(--color-bambu-dark-secondary)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark-secondary\/90{background-color:color-mix(in oklab,var(--color-bambu-dark-secondary)90%,transparent)}}.bg-bambu-dark-secondary\/95{background-color:var(--color-bambu-dark-secondary)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark-secondary\/95{background-color:color-mix(in oklab,var(--color-bambu-dark-secondary)95%,transparent)}}.bg-bambu-dark-tertiary,.bg-bambu-dark-tertiary\/10{background-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark-tertiary\/10{background-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)10%,transparent)}}.bg-bambu-dark-tertiary\/20{background-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark-tertiary\/20{background-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)20%,transparent)}}.bg-bambu-dark-tertiary\/30{background-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark-tertiary\/30{background-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)30%,transparent)}}.bg-bambu-dark-tertiary\/40{background-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark-tertiary\/40{background-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)40%,transparent)}}.bg-bambu-dark-tertiary\/50{background-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark-tertiary\/50{background-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)50%,transparent)}}.bg-bambu-dark-tertiary\/70{background-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark-tertiary\/70{background-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)70%,transparent)}}.bg-bambu-dark-tertiary\/80{background-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark-tertiary\/80{background-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)80%,transparent)}}.bg-bambu-dark\/20{background-color:var(--color-bambu-dark)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark\/20{background-color:color-mix(in oklab,var(--color-bambu-dark)20%,transparent)}}.bg-bambu-dark\/30{background-color:var(--color-bambu-dark)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark\/30{background-color:color-mix(in oklab,var(--color-bambu-dark)30%,transparent)}}.bg-bambu-dark\/40{background-color:var(--color-bambu-dark)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark\/40{background-color:color-mix(in oklab,var(--color-bambu-dark)40%,transparent)}}.bg-bambu-dark\/50{background-color:var(--color-bambu-dark)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark\/50{background-color:color-mix(in oklab,var(--color-bambu-dark)50%,transparent)}}.bg-bambu-dark\/60{background-color:var(--color-bambu-dark)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark\/60{background-color:color-mix(in oklab,var(--color-bambu-dark)60%,transparent)}}.bg-bambu-dark\/80{background-color:var(--color-bambu-dark)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark\/80{background-color:color-mix(in oklab,var(--color-bambu-dark)80%,transparent)}}.bg-bambu-dark\/85{background-color:var(--color-bambu-dark)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark\/85{background-color:color-mix(in oklab,var(--color-bambu-dark)85%,transparent)}}.bg-bambu-dark\/90{background-color:var(--color-bambu-dark)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-dark\/90{background-color:color-mix(in oklab,var(--color-bambu-dark)90%,transparent)}}.bg-bambu-gray,.bg-bambu-gray\/10{background-color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-gray\/10{background-color:color-mix(in oklab,var(--color-bambu-gray)10%,transparent)}}.bg-bambu-gray\/20{background-color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-gray\/20{background-color:color-mix(in oklab,var(--color-bambu-gray)20%,transparent)}}.bg-bambu-gray\/25{background-color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-gray\/25{background-color:color-mix(in oklab,var(--color-bambu-gray)25%,transparent)}}.bg-bambu-gray\/30{background-color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-gray\/30{background-color:color-mix(in oklab,var(--color-bambu-gray)30%,transparent)}}.bg-bambu-gray\/40{background-color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-gray\/40{background-color:color-mix(in oklab,var(--color-bambu-gray)40%,transparent)}}.bg-bambu-gray\/50{background-color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-gray\/50{background-color:color-mix(in oklab,var(--color-bambu-gray)50%,transparent)}}.bg-bambu-gray\/90{background-color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-gray\/90{background-color:color-mix(in oklab,var(--color-bambu-gray)90%,transparent)}}.bg-bambu-green,.bg-bambu-green\/5{background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-green\/5{background-color:color-mix(in oklab,var(--color-bambu-green)5%,transparent)}}.bg-bambu-green\/10{background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-green\/10{background-color:color-mix(in oklab,var(--color-bambu-green)10%,transparent)}}.bg-bambu-green\/15{background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-green\/15{background-color:color-mix(in oklab,var(--color-bambu-green)15%,transparent)}}.bg-bambu-green\/20{background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-green\/20{background-color:color-mix(in oklab,var(--color-bambu-green)20%,transparent)}}.bg-bambu-green\/30{background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-green\/30{background-color:color-mix(in oklab,var(--color-bambu-green)30%,transparent)}}.bg-bambu-green\/50{background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-green\/50{background-color:color-mix(in oklab,var(--color-bambu-green)50%,transparent)}}.bg-bambu-green\/75{background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-green\/75{background-color:color-mix(in oklab,var(--color-bambu-green)75%,transparent)}}.bg-bambu-green\/80{background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-green\/80{background-color:color-mix(in oklab,var(--color-bambu-green)80%,transparent)}}.bg-bambu-green\/85{background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-green\/85{background-color:color-mix(in oklab,var(--color-bambu-green)85%,transparent)}}.bg-bambu-green\/90{background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.bg-bambu-green\/90{background-color:color-mix(in oklab,var(--color-bambu-green)90%,transparent)}}.bg-black{background-color:var(--color-black)}.bg-black\/10{background-color:#0000001a}@supports (color:color-mix(in lab, red, red)){.bg-black\/10{background-color:color-mix(in oklab,var(--color-black)10%,transparent)}}.bg-black\/15{background-color:#00000026}@supports (color:color-mix(in lab, red, red)){.bg-black\/15{background-color:color-mix(in oklab,var(--color-black)15%,transparent)}}.bg-black\/20{background-color:#0003}@supports (color:color-mix(in lab, red, red)){.bg-black\/20{background-color:color-mix(in oklab,var(--color-black)20%,transparent)}}.bg-black\/30{background-color:#0000004d}@supports (color:color-mix(in lab, red, red)){.bg-black\/30{background-color:color-mix(in oklab,var(--color-black)30%,transparent)}}.bg-black\/40{background-color:#0006}@supports (color:color-mix(in lab, red, red)){.bg-black\/40{background-color:color-mix(in oklab,var(--color-black)40%,transparent)}}.bg-black\/45{background-color:#00000073}@supports (color:color-mix(in lab, red, red)){.bg-black\/45{background-color:color-mix(in oklab,var(--color-black)45%,transparent)}}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab, red, red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black)50%,transparent)}}.bg-black\/55{background-color:#0000008c}@supports (color:color-mix(in lab, red, red)){.bg-black\/55{background-color:color-mix(in oklab,var(--color-black)55%,transparent)}}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab, red, red)){.bg-black\/60{background-color:color-mix(in oklab,var(--color-black)60%,transparent)}}.bg-black\/65{background-color:#000000a6}@supports (color:color-mix(in lab, red, red)){.bg-black\/65{background-color:color-mix(in oklab,var(--color-black)65%,transparent)}}.bg-black\/70{background-color:#000000b3}@supports (color:color-mix(in lab, red, red)){.bg-black\/70{background-color:color-mix(in oklab,var(--color-black)70%,transparent)}}.bg-black\/80{background-color:#000c}@supports (color:color-mix(in lab, red, red)){.bg-black\/80{background-color:color-mix(in oklab,var(--color-black)80%,transparent)}}.bg-black\/90{background-color:#000000e6}@supports (color:color-mix(in lab, red, red)){.bg-black\/90{background-color:color-mix(in oklab,var(--color-black)90%,transparent)}}.bg-blue-50{background-color:var(--color-blue-50)}.bg-blue-100{background-color:var(--color-blue-100)}.bg-blue-300{background-color:var(--color-blue-300)}.bg-blue-400{background-color:var(--color-blue-400)}.bg-blue-500{background-color:var(--color-blue-500)}.bg-blue-500\/5{background-color:#3080ff0d}@supports (color:color-mix(in lab, red, red)){.bg-blue-500\/5{background-color:color-mix(in oklab,var(--color-blue-500)5%,transparent)}}.bg-blue-500\/10{background-color:#3080ff1a}@supports (color:color-mix(in lab, red, red)){.bg-blue-500\/10{background-color:color-mix(in oklab,var(--color-blue-500)10%,transparent)}}.bg-blue-500\/20{background-color:#3080ff33}@supports (color:color-mix(in lab, red, red)){.bg-blue-500\/20{background-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.bg-blue-500\/30{background-color:#3080ff4d}@supports (color:color-mix(in lab, red, red)){.bg-blue-500\/30{background-color:color-mix(in oklab,var(--color-blue-500)30%,transparent)}}.bg-blue-500\/90{background-color:#3080ffe6}@supports (color:color-mix(in lab, red, red)){.bg-blue-500\/90{background-color:color-mix(in oklab,var(--color-blue-500)90%,transparent)}}.bg-blue-600{background-color:var(--color-blue-600)}.bg-blue-700{background-color:var(--color-blue-700)}.bg-cyan-100{background-color:var(--color-cyan-100)}.bg-cyan-500{background-color:var(--color-cyan-500)}.bg-cyan-500\/20{background-color:#00b7d733}@supports (color:color-mix(in lab, red, red)){.bg-cyan-500\/20{background-color:color-mix(in oklab,var(--color-cyan-500)20%,transparent)}}.bg-emerald-50{background-color:var(--color-emerald-50)}.bg-emerald-100{background-color:var(--color-emerald-100)}.bg-emerald-700{background-color:var(--color-emerald-700)}.bg-fuchsia-100{background-color:var(--color-fuchsia-100)}.bg-fuchsia-500{background-color:var(--color-fuchsia-500)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-400{background-color:var(--color-gray-400)}.bg-gray-400\/10{background-color:#99a1af1a}@supports (color:color-mix(in lab, red, red)){.bg-gray-400\/10{background-color:color-mix(in oklab,var(--color-gray-400)10%,transparent)}}.bg-gray-500{background-color:var(--color-gray-500)}.bg-gray-500\/15{background-color:#6a728226}@supports (color:color-mix(in lab, red, red)){.bg-gray-500\/15{background-color:color-mix(in oklab,var(--color-gray-500)15%,transparent)}}.bg-gray-500\/20{background-color:#6a728233}@supports (color:color-mix(in lab, red, red)){.bg-gray-500\/20{background-color:color-mix(in oklab,var(--color-gray-500)20%,transparent)}}.bg-gray-600{background-color:var(--color-gray-600)}.bg-gray-800{background-color:var(--color-gray-800)}.bg-gray-900{background-color:var(--color-gray-900)}.bg-green-50{background-color:var(--color-green-50)}.bg-green-100{background-color:var(--color-green-100)}.bg-green-400{background-color:var(--color-green-400)}.bg-green-500{background-color:var(--color-green-500)}.bg-green-500\/10{background-color:#00c7581a}@supports (color:color-mix(in lab, red, red)){.bg-green-500\/10{background-color:color-mix(in oklab,var(--color-green-500)10%,transparent)}}.bg-green-500\/15{background-color:#00c75826}@supports (color:color-mix(in lab, red, red)){.bg-green-500\/15{background-color:color-mix(in oklab,var(--color-green-500)15%,transparent)}}.bg-green-500\/20{background-color:#00c75833}@supports (color:color-mix(in lab, red, red)){.bg-green-500\/20{background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.bg-green-600{background-color:var(--color-green-600)}.bg-green-600\/20{background-color:#00a54433}@supports (color:color-mix(in lab, red, red)){.bg-green-600\/20{background-color:color-mix(in oklab,var(--color-green-600)20%,transparent)}}.bg-green-600\/40{background-color:#00a54466}@supports (color:color-mix(in lab, red, red)){.bg-green-600\/40{background-color:color-mix(in oklab,var(--color-green-600)40%,transparent)}}.bg-green-700{background-color:var(--color-green-700)}.bg-green-900\/30{background-color:#0d542b4d}@supports (color:color-mix(in lab, red, red)){.bg-green-900\/30{background-color:color-mix(in oklab,var(--color-green-900)30%,transparent)}}.bg-green-900\/50{background-color:#0d542b80}@supports (color:color-mix(in lab, red, red)){.bg-green-900\/50{background-color:color-mix(in oklab,var(--color-green-900)50%,transparent)}}.bg-indigo-50{background-color:var(--color-indigo-50)}.bg-indigo-100{background-color:var(--color-indigo-100)}.bg-lime-100{background-color:var(--color-lime-100)}.bg-lime-500{background-color:var(--color-lime-500)}.bg-orange-50{background-color:var(--color-orange-50)}.bg-orange-100{background-color:var(--color-orange-100)}.bg-orange-500{background-color:var(--color-orange-500)}.bg-orange-500\/10{background-color:#fe6e001a}@supports (color:color-mix(in lab, red, red)){.bg-orange-500\/10{background-color:color-mix(in oklab,var(--color-orange-500)10%,transparent)}}.bg-orange-500\/20{background-color:#fe6e0033}@supports (color:color-mix(in lab, red, red)){.bg-orange-500\/20{background-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.bg-orange-600{background-color:var(--color-orange-600)}.bg-pink-100{background-color:var(--color-pink-100)}.bg-purple-50{background-color:var(--color-purple-50)}.bg-purple-100{background-color:var(--color-purple-100)}.bg-purple-500{background-color:var(--color-purple-500)}.bg-purple-500\/80{background-color:#ac4bffcc}@supports (color:color-mix(in lab, red, red)){.bg-purple-500\/80{background-color:color-mix(in oklab,var(--color-purple-500)80%,transparent)}}.bg-purple-500\/90{background-color:#ac4bffe6}@supports (color:color-mix(in lab, red, red)){.bg-purple-500\/90{background-color:color-mix(in oklab,var(--color-purple-500)90%,transparent)}}.bg-purple-700{background-color:var(--color-purple-700)}.bg-red-50{background-color:var(--color-red-50)}.bg-red-100{background-color:var(--color-red-100)}.bg-red-400{background-color:var(--color-red-400)}.bg-red-500{background-color:var(--color-red-500)}.bg-red-500\/5{background-color:#fb2c360d}@supports (color:color-mix(in lab, red, red)){.bg-red-500\/5{background-color:color-mix(in oklab,var(--color-red-500)5%,transparent)}}.bg-red-500\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab, red, red)){.bg-red-500\/10{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.bg-red-500\/20{background-color:#fb2c3633}@supports (color:color-mix(in lab, red, red)){.bg-red-500\/20{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.bg-red-500\/30{background-color:#fb2c364d}@supports (color:color-mix(in lab, red, red)){.bg-red-500\/30{background-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.bg-red-500\/40{background-color:#fb2c3666}@supports (color:color-mix(in lab, red, red)){.bg-red-500\/40{background-color:color-mix(in oklab,var(--color-red-500)40%,transparent)}}.bg-red-500\/80{background-color:#fb2c36cc}@supports (color:color-mix(in lab, red, red)){.bg-red-500\/80{background-color:color-mix(in oklab,var(--color-red-500)80%,transparent)}}.bg-red-500\/85{background-color:#fb2c36d9}@supports (color:color-mix(in lab, red, red)){.bg-red-500\/85{background-color:color-mix(in oklab,var(--color-red-500)85%,transparent)}}.bg-red-500\/90{background-color:#fb2c36e6}@supports (color:color-mix(in lab, red, red)){.bg-red-500\/90{background-color:color-mix(in oklab,var(--color-red-500)90%,transparent)}}.bg-red-600{background-color:var(--color-red-600)}.bg-red-600\/20{background-color:#e4001433}@supports (color:color-mix(in lab, red, red)){.bg-red-600\/20{background-color:color-mix(in oklab,var(--color-red-600)20%,transparent)}}.bg-red-700{background-color:var(--color-red-700)}.bg-red-900\/20{background-color:#82181a33}@supports (color:color-mix(in lab, red, red)){.bg-red-900\/20{background-color:color-mix(in oklab,var(--color-red-900)20%,transparent)}}.bg-red-900\/30{background-color:#82181a4d}@supports (color:color-mix(in lab, red, red)){.bg-red-900\/30{background-color:color-mix(in oklab,var(--color-red-900)30%,transparent)}}.bg-red-950\/70{background-color:#460809b3}@supports (color:color-mix(in lab, red, red)){.bg-red-950\/70{background-color:color-mix(in oklab,var(--color-red-950)70%,transparent)}}.bg-rose-100{background-color:var(--color-rose-100)}.bg-rose-900{background-color:var(--color-rose-900)}.bg-sky-50{background-color:var(--color-sky-50)}.bg-sky-100{background-color:var(--color-sky-100)}.bg-sky-500{background-color:var(--color-sky-500)}.bg-sky-500\/80{background-color:#00a5efcc}@supports (color:color-mix(in lab, red, red)){.bg-sky-500\/80{background-color:color-mix(in oklab,var(--color-sky-500)80%,transparent)}}.bg-sky-700{background-color:var(--color-sky-700)}.bg-slate-100{background-color:var(--color-slate-100)}.bg-slate-700{background-color:var(--color-slate-700)}.bg-status-error,.bg-status-error\/10{background-color:var(--color-status-error)}@supports (color:color-mix(in lab, red, red)){.bg-status-error\/10{background-color:color-mix(in oklab,var(--color-status-error)10%,transparent)}}.bg-status-error\/20{background-color:var(--color-status-error)}@supports (color:color-mix(in lab, red, red)){.bg-status-error\/20{background-color:color-mix(in oklab,var(--color-status-error)20%,transparent)}}.bg-status-error\/80{background-color:var(--color-status-error)}@supports (color:color-mix(in lab, red, red)){.bg-status-error\/80{background-color:color-mix(in oklab,var(--color-status-error)80%,transparent)}}.bg-status-ok,.bg-status-ok\/10{background-color:var(--color-status-ok)}@supports (color:color-mix(in lab, red, red)){.bg-status-ok\/10{background-color:color-mix(in oklab,var(--color-status-ok)10%,transparent)}}.bg-status-ok\/20{background-color:var(--color-status-ok)}@supports (color:color-mix(in lab, red, red)){.bg-status-ok\/20{background-color:color-mix(in oklab,var(--color-status-ok)20%,transparent)}}.bg-status-warning,.bg-status-warning\/10{background-color:var(--color-status-warning)}@supports (color:color-mix(in lab, red, red)){.bg-status-warning\/10{background-color:color-mix(in oklab,var(--color-status-warning)10%,transparent)}}.bg-status-warning\/20{background-color:var(--color-status-warning)}@supports (color:color-mix(in lab, red, red)){.bg-status-warning\/20{background-color:color-mix(in oklab,var(--color-status-warning)20%,transparent)}}.bg-teal-100{background-color:var(--color-teal-100)}.bg-teal-500{background-color:var(--color-teal-500)}.bg-teal-500\/20{background-color:#00baa733}@supports (color:color-mix(in lab, red, red)){.bg-teal-500\/20{background-color:color-mix(in oklab,var(--color-teal-500)20%,transparent)}}.bg-teal-500\/90{background-color:#00baa7e6}@supports (color:color-mix(in lab, red, red)){.bg-teal-500\/90{background-color:color-mix(in oklab,var(--color-teal-500)90%,transparent)}}.bg-transparent{background-color:#0000}.bg-violet-500{background-color:var(--color-violet-500)}.bg-white{background-color:var(--color-white)}.bg-white\/10{background-color:#ffffff1a}@supports (color:color-mix(in lab, red, red)){.bg-white\/10{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.bg-white\/20{background-color:#fff3}@supports (color:color-mix(in lab, red, red)){.bg-white\/20{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.bg-white\/50{background-color:#ffffff80}@supports (color:color-mix(in lab, red, red)){.bg-white\/50{background-color:color-mix(in oklab,var(--color-white)50%,transparent)}}.bg-white\/70{background-color:#ffffffb3}@supports (color:color-mix(in lab, red, red)){.bg-white\/70{background-color:color-mix(in oklab,var(--color-white)70%,transparent)}}.bg-white\/90{background-color:#ffffffe6}@supports (color:color-mix(in lab, red, red)){.bg-white\/90{background-color:color-mix(in oklab,var(--color-white)90%,transparent)}}.bg-yellow-50{background-color:var(--color-yellow-50)}.bg-yellow-100{background-color:var(--color-yellow-100)}.bg-yellow-400{background-color:var(--color-yellow-400)}.bg-yellow-500{background-color:var(--color-yellow-500)}.bg-yellow-500\/5{background-color:#edb2000d}@supports (color:color-mix(in lab, red, red)){.bg-yellow-500\/5{background-color:color-mix(in oklab,var(--color-yellow-500)5%,transparent)}}.bg-yellow-500\/10{background-color:#edb2001a}@supports (color:color-mix(in lab, red, red)){.bg-yellow-500\/10{background-color:color-mix(in oklab,var(--color-yellow-500)10%,transparent)}}.bg-yellow-500\/20{background-color:#edb20033}@supports (color:color-mix(in lab, red, red)){.bg-yellow-500\/20{background-color:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.bg-yellow-700{background-color:var(--color-yellow-700)}.bg-zinc-600{background-color:var(--color-zinc-600)}.bg-zinc-700{background-color:var(--color-zinc-700)}.bg-zinc-800{background-color:var(--color-zinc-800)}.bg-zinc-800\/50{background-color:#27272a80}@supports (color:color-mix(in lab, red, red)){.bg-zinc-800\/50{background-color:color-mix(in oklab,var(--color-zinc-800)50%,transparent)}}.bg-zinc-800\/60{background-color:#27272a99}@supports (color:color-mix(in lab, red, red)){.bg-zinc-800\/60{background-color:color-mix(in oklab,var(--color-zinc-800)60%,transparent)}}.bg-zinc-900{background-color:var(--color-zinc-900)}.bg-zinc-900\/50{background-color:#18181b80}@supports (color:color-mix(in lab, red, red)){.bg-zinc-900\/50{background-color:color-mix(in oklab,var(--color-zinc-900)50%,transparent)}}.bg-gradient-to-b{--tw-gradient-position:to bottom in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-t{--tw-gradient-position:to top in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-bambu-dark-secondary{--tw-gradient-from:var(--color-bambu-dark-secondary);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-bambu-green\/15{--tw-gradient-from:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.from-bambu-green\/15{--tw-gradient-from:color-mix(in oklab,var(--color-bambu-green)15%,transparent)}}.from-bambu-green\/15{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-black\/80{--tw-gradient-from:#000c}@supports (color:color-mix(in lab, red, red)){.from-black\/80{--tw-gradient-from:color-mix(in oklab,var(--color-black)80%,transparent)}}.from-black\/80{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-black\/85{--tw-gradient-from:#000000d9}@supports (color:color-mix(in lab, red, red)){.from-black\/85{--tw-gradient-from:color-mix(in oklab,var(--color-black)85%,transparent)}}.from-black\/85{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-blue-500\/5{--tw-gradient-from:#3080ff0d}@supports (color:color-mix(in lab, red, red)){.from-blue-500\/5{--tw-gradient-from:color-mix(in oklab,var(--color-blue-500)5%,transparent)}}.from-blue-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-white\/10{--tw-gradient-from:#ffffff1a}@supports (color:color-mix(in lab, red, red)){.from-white\/10{--tw-gradient-from:color-mix(in oklab,var(--color-white)10%,transparent)}}.from-white\/10{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.via-bambu-green\/5{--tw-gradient-via:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.via-bambu-green\/5{--tw-gradient-via:color-mix(in oklab,var(--color-bambu-green)5%,transparent)}}.via-bambu-green\/5{--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.via-black\/55{--tw-gradient-via:#0000008c}@supports (color:color-mix(in lab, red, red)){.via-black\/55{--tw-gradient-via:color-mix(in oklab,var(--color-black)55%,transparent)}}.via-black\/55{--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.via-black\/60{--tw-gradient-via:#0009}@supports (color:color-mix(in lab, red, red)){.via-black\/60{--tw-gradient-via:color-mix(in oklab,var(--color-black)60%,transparent)}}.via-black\/60{--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-bambu-dark-secondary{--tw-gradient-to:var(--color-bambu-dark-secondary);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-bambu-dark-tertiary{--tw-gradient-to:var(--color-bambu-dark-tertiary);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-transparent{--tw-gradient-to:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.bg-cover{background-size:cover}.bg-center{background-position:50%}.fill-yellow-400{fill:var(--color-yellow-400)}.object-contain{object-fit:contain}.object-cover{object-fit:cover}.object-left{object-position:left}.p-0{padding:calc(var(--spacing)*0)}.p-0\.5{padding:calc(var(--spacing)*.5)}.p-1{padding:calc(var(--spacing)*1)}.p-1\.5{padding:calc(var(--spacing)*1.5)}.p-2{padding:calc(var(--spacing)*2)}.p-2\.5{padding:calc(var(--spacing)*2.5)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-5{padding:calc(var(--spacing)*5)}.p-6{padding:calc(var(--spacing)*6)}.p-8{padding:calc(var(--spacing)*8)}.p-12{padding:calc(var(--spacing)*12)}.\!px-0{padding-inline:calc(var(--spacing)*0)!important}.\!px-2{padding-inline:calc(var(--spacing)*2)!important}.\!px-3{padding-inline:calc(var(--spacing)*3)!important}.px-1{padding-inline:calc(var(--spacing)*1)}.px-1\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-2\.5{padding-inline:calc(var(--spacing)*2.5)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-5{padding-inline:calc(var(--spacing)*5)}.px-6{padding-inline:calc(var(--spacing)*6)}.\!py-0{padding-block:calc(var(--spacing)*0)!important}.py-0{padding-block:calc(var(--spacing)*0)}.py-0\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-2\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.py-6{padding-block:calc(var(--spacing)*6)}.py-8{padding-block:calc(var(--spacing)*8)}.py-12{padding-block:calc(var(--spacing)*12)}.py-16{padding-block:calc(var(--spacing)*16)}.py-20{padding-block:calc(var(--spacing)*20)}.py-24{padding-block:calc(var(--spacing)*24)}.py-px{padding-block:1px}.pt-0{padding-top:calc(var(--spacing)*0)}.pt-1{padding-top:calc(var(--spacing)*1)}.pt-1\.5{padding-top:calc(var(--spacing)*1.5)}.pt-2{padding-top:calc(var(--spacing)*2)}.pt-2\.5{padding-top:calc(var(--spacing)*2.5)}.pt-3{padding-top:calc(var(--spacing)*3)}.pt-4{padding-top:calc(var(--spacing)*4)}.pt-5{padding-top:calc(var(--spacing)*5)}.pr-1{padding-right:calc(var(--spacing)*1)}.pr-2{padding-right:calc(var(--spacing)*2)}.pr-3{padding-right:calc(var(--spacing)*3)}.pr-4{padding-right:calc(var(--spacing)*4)}.pr-5{padding-right:calc(var(--spacing)*5)}.pr-6{padding-right:calc(var(--spacing)*6)}.pr-7{padding-right:calc(var(--spacing)*7)}.pr-8{padding-right:calc(var(--spacing)*8)}.pr-9{padding-right:calc(var(--spacing)*9)}.pr-10{padding-right:calc(var(--spacing)*10)}.pb-0\.5{padding-bottom:calc(var(--spacing)*.5)}.pb-1{padding-bottom:calc(var(--spacing)*1)}.pb-1\.5{padding-bottom:calc(var(--spacing)*1.5)}.pb-2{padding-bottom:calc(var(--spacing)*2)}.pb-3{padding-bottom:calc(var(--spacing)*3)}.pb-4{padding-bottom:calc(var(--spacing)*4)}.pb-6{padding-bottom:calc(var(--spacing)*6)}.pb-\[env\(safe-area-inset-bottom\)\]{padding-bottom:env(safe-area-inset-bottom)}.pl-1{padding-left:calc(var(--spacing)*1)}.pl-2{padding-left:calc(var(--spacing)*2)}.pl-3{padding-left:calc(var(--spacing)*3)}.pl-4{padding-left:calc(var(--spacing)*4)}.pl-5{padding-left:calc(var(--spacing)*5)}.pl-6{padding-left:calc(var(--spacing)*6)}.pl-7{padding-left:calc(var(--spacing)*7)}.pl-8{padding-left:calc(var(--spacing)*8)}.pl-9{padding-left:calc(var(--spacing)*9)}.pl-10{padding-left:calc(var(--spacing)*10)}.pl-20{padding-left:calc(var(--spacing)*20)}.pl-\[28px\]{padding-left:28px}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-top{vertical-align:top}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:var(--font-sans)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-5xl{font-size:var(--text-5xl);line-height:var(--tw-leading,var(--text-5xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[0\.7rem\]{font-size:.7rem}.text-\[0\.65rem\]{font-size:.65rem}.text-\[6px\]{font-size:6px}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[length\:var\(--pc-t8\,8px\)\]{font-size:var(--pc-t8,8px)}.text-\[length\:var\(--pc-t9\,9px\)\]{font-size:var(--pc-t9,9px)}.text-\[length\:var\(--pc-t10\,10px\)\]{font-size:var(--pc-t10,10px)}.text-\[length\:var\(--pc-t11\,11px\)\]{font-size:var(--pc-t11,11px)}.leading-5{--tw-leading:calc(var(--spacing)*5);line-height:calc(var(--spacing)*5)}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-light{--tw-font-weight:var(--font-weight-light);font-weight:var(--font-weight-light)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[0\.3em\]{--tw-tracking:.3em;letter-spacing:.3em}.tracking-normal{--tw-tracking:var(--tracking-normal);letter-spacing:var(--tracking-normal)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.text-balance{text-wrap:balance}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.\!text-white{color:var(--color-white)!important}.text-\[\#ffffff\]{color:#fff}.text-amber-100{color:var(--color-amber-100)}.text-amber-200{color:var(--color-amber-200)}.text-amber-200\/80{color:#fee685cc}@supports (color:color-mix(in lab, red, red)){.text-amber-200\/80{color:color-mix(in oklab,var(--color-amber-200)80%,transparent)}}.text-amber-300{color:var(--color-amber-300)}.text-amber-400{color:var(--color-amber-400)}.text-amber-500{color:var(--color-amber-500)}.text-amber-500\/80{color:#f99c00cc}@supports (color:color-mix(in lab, red, red)){.text-amber-500\/80{color:color-mix(in oklab,var(--color-amber-500)80%,transparent)}}.text-amber-600{color:var(--color-amber-600)}.text-amber-600\/80{color:#dd7400cc}@supports (color:color-mix(in lab, red, red)){.text-amber-600\/80{color:color-mix(in oklab,var(--color-amber-600)80%,transparent)}}.text-amber-700{color:var(--color-amber-700)}.text-amber-700\/70{color:#b75000b3}@supports (color:color-mix(in lab, red, red)){.text-amber-700\/70{color:color-mix(in oklab,var(--color-amber-700)70%,transparent)}}.text-amber-700\/80{color:#b75000cc}@supports (color:color-mix(in lab, red, red)){.text-amber-700\/80{color:color-mix(in oklab,var(--color-amber-700)80%,transparent)}}.text-amber-700\/90{color:#b75000e6}@supports (color:color-mix(in lab, red, red)){.text-amber-700\/90{color:color-mix(in oklab,var(--color-amber-700)90%,transparent)}}.text-amber-800{color:var(--color-amber-800)}.text-amber-800\/70{color:#953d00b3}@supports (color:color-mix(in lab, red, red)){.text-amber-800\/70{color:color-mix(in oklab,var(--color-amber-800)70%,transparent)}}.text-amber-800\/90{color:#953d00e6}@supports (color:color-mix(in lab, red, red)){.text-amber-800\/90{color:color-mix(in oklab,var(--color-amber-800)90%,transparent)}}.text-amber-900{color:var(--color-amber-900)}.text-bambu-dark{color:var(--color-bambu-dark)}.text-bambu-dark-tertiary{color:var(--color-bambu-dark-tertiary)}.text-bambu-gray{color:var(--color-bambu-gray)}.text-bambu-gray-dark{color:var(--color-bambu-gray-dark)}.text-bambu-gray-light{color:var(--color-bambu-gray-light)}.text-bambu-gray\/30{color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.text-bambu-gray\/30{color:color-mix(in oklab,var(--color-bambu-gray)30%,transparent)}}.text-bambu-gray\/40{color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.text-bambu-gray\/40{color:color-mix(in oklab,var(--color-bambu-gray)40%,transparent)}}.text-bambu-gray\/50{color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.text-bambu-gray\/50{color:color-mix(in oklab,var(--color-bambu-gray)50%,transparent)}}.text-bambu-gray\/60{color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.text-bambu-gray\/60{color:color-mix(in oklab,var(--color-bambu-gray)60%,transparent)}}.text-bambu-gray\/70{color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.text-bambu-gray\/70{color:color-mix(in oklab,var(--color-bambu-gray)70%,transparent)}}.text-bambu-gray\/80{color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.text-bambu-gray\/80{color:color-mix(in oklab,var(--color-bambu-gray)80%,transparent)}}.text-bambu-gray\/90{color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.text-bambu-gray\/90{color:color-mix(in oklab,var(--color-bambu-gray)90%,transparent)}}.text-bambu-green,.text-bambu-green\/50{color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.text-bambu-green\/50{color:color-mix(in oklab,var(--color-bambu-green)50%,transparent)}}.text-bambu-green\/60{color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.text-bambu-green\/60{color:color-mix(in oklab,var(--color-bambu-green)60%,transparent)}}.text-bambu-green\/70{color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.text-bambu-green\/70{color:color-mix(in oklab,var(--color-bambu-green)70%,transparent)}}.text-bambu-green\/90{color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.text-bambu-green\/90{color:color-mix(in oklab,var(--color-bambu-green)90%,transparent)}}.text-black{color:var(--color-black)}.text-black\/80{color:#000c}@supports (color:color-mix(in lab, red, red)){.text-black\/80{color:color-mix(in oklab,var(--color-black)80%,transparent)}}.text-blue-100{color:var(--color-blue-100)}.text-blue-300{color:var(--color-blue-300)}.text-blue-400{color:var(--color-blue-400)}.text-blue-500{color:var(--color-blue-500)}.text-blue-600{color:var(--color-blue-600)}.text-blue-600\/50{color:#155dfc80}@supports (color:color-mix(in lab, red, red)){.text-blue-600\/50{color:color-mix(in oklab,var(--color-blue-600)50%,transparent)}}.text-blue-700{color:var(--color-blue-700)}.text-blue-700\/80{color:#1447e6cc}@supports (color:color-mix(in lab, red, red)){.text-blue-700\/80{color:color-mix(in oklab,var(--color-blue-700)80%,transparent)}}.text-blue-700\/90{color:#1447e6e6}@supports (color:color-mix(in lab, red, red)){.text-blue-700\/90{color:color-mix(in oklab,var(--color-blue-700)90%,transparent)}}.text-cyan-400{color:var(--color-cyan-400)}.text-cyan-600{color:var(--color-cyan-600)}.text-cyan-700{color:var(--color-cyan-700)}.text-emerald-100{color:var(--color-emerald-100)}.text-emerald-300{color:var(--color-emerald-300)}.text-emerald-600{color:var(--color-emerald-600)}.text-emerald-700{color:var(--color-emerald-700)}.text-fuchsia-700{color:var(--color-fuchsia-700)}.text-gray-300{color:var(--color-gray-300)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-800{color:var(--color-gray-800)}.text-gray-900{color:var(--color-gray-900)}.text-green-300{color:var(--color-green-300)}.text-green-400{color:var(--color-green-400)}.text-green-400\/60{color:#05df7299}@supports (color:color-mix(in lab, red, red)){.text-green-400\/60{color:color-mix(in oklab,var(--color-green-400)60%,transparent)}}.text-green-500{color:var(--color-green-500)}.text-green-600{color:var(--color-green-600)}.text-green-700{color:var(--color-green-700)}.text-green-700\/80{color:#008138cc}@supports (color:color-mix(in lab, red, red)){.text-green-700\/80{color:color-mix(in oklab,var(--color-green-700)80%,transparent)}}.text-green-800{color:var(--color-green-800)}.text-indigo-600{color:var(--color-indigo-600)}.text-indigo-700{color:var(--color-indigo-700)}.text-lime-700{color:var(--color-lime-700)}.text-orange-400{color:var(--color-orange-400)}.text-orange-500{color:var(--color-orange-500)}.text-orange-600{color:var(--color-orange-600)}.text-orange-700{color:var(--color-orange-700)}.text-orange-800{color:var(--color-orange-800)}.text-orange-800\/80{color:#9f2d00cc}@supports (color:color-mix(in lab, red, red)){.text-orange-800\/80{color:color-mix(in oklab,var(--color-orange-800)80%,transparent)}}.text-orange-900{color:var(--color-orange-900)}.text-pink-400{color:var(--color-pink-400)}.text-pink-700{color:var(--color-pink-700)}.text-purple-400{color:var(--color-purple-400)}.text-purple-400\/80{color:#c07effcc}@supports (color:color-mix(in lab, red, red)){.text-purple-400\/80{color:color-mix(in oklab,var(--color-purple-400)80%,transparent)}}.text-purple-600{color:var(--color-purple-600)}.text-purple-700{color:var(--color-purple-700)}.text-purple-700\/80{color:#8200dacc}@supports (color:color-mix(in lab, red, red)){.text-purple-700\/80{color:color-mix(in oklab,var(--color-purple-700)80%,transparent)}}.text-red-100{color:var(--color-red-100)}.text-red-300{color:var(--color-red-300)}.text-red-400{color:var(--color-red-400)}.text-red-500{color:var(--color-red-500)}.text-red-600{color:var(--color-red-600)}.text-red-700{color:var(--color-red-700)}.text-red-700\/50{color:#bf000f80}@supports (color:color-mix(in lab, red, red)){.text-red-700\/50{color:color-mix(in oklab,var(--color-red-700)50%,transparent)}}.text-red-700\/80{color:#bf000fcc}@supports (color:color-mix(in lab, red, red)){.text-red-700\/80{color:color-mix(in oklab,var(--color-red-700)80%,transparent)}}.text-red-700\/90{color:#bf000fe6}@supports (color:color-mix(in lab, red, red)){.text-red-700\/90{color:color-mix(in oklab,var(--color-red-700)90%,transparent)}}.text-red-800{color:var(--color-red-800)}.text-red-800\/60{color:#9f071299}@supports (color:color-mix(in lab, red, red)){.text-red-800\/60{color:color-mix(in oklab,var(--color-red-800)60%,transparent)}}.text-red-800\/80{color:#9f0712cc}@supports (color:color-mix(in lab, red, red)){.text-red-800\/80{color:color-mix(in oklab,var(--color-red-800)80%,transparent)}}.text-rose-200{color:var(--color-rose-200)}.text-rose-700{color:var(--color-rose-700)}.text-sky-100{color:var(--color-sky-100)}.text-sky-600{color:var(--color-sky-600)}.text-sky-700{color:var(--color-sky-700)}.text-slate-200{color:var(--color-slate-200)}.text-slate-300{color:var(--color-slate-300)}.text-slate-400{color:var(--color-slate-400)}.text-slate-500{color:var(--color-slate-500)}.text-slate-500\/90{color:#62748ee6}@supports (color:color-mix(in lab, red, red)){.text-slate-500\/90{color:color-mix(in oklab,var(--color-slate-500)90%,transparent)}}.text-slate-600{color:var(--color-slate-600)}.text-status-error{color:var(--color-status-error)}.text-status-ok{color:var(--color-status-ok)}.text-status-warning{color:var(--color-status-warning)}.text-teal-600{color:var(--color-teal-600)}.text-teal-700{color:var(--color-teal-700)}.text-white{color:var(--color-white)}.text-white\/30{color:#ffffff4d}@supports (color:color-mix(in lab, red, red)){.text-white\/30{color:color-mix(in oklab,var(--color-white)30%,transparent)}}.text-white\/40{color:#fff6}@supports (color:color-mix(in lab, red, red)){.text-white\/40{color:color-mix(in oklab,var(--color-white)40%,transparent)}}.text-white\/50{color:#ffffff80}@supports (color:color-mix(in lab, red, red)){.text-white\/50{color:color-mix(in oklab,var(--color-white)50%,transparent)}}.text-white\/60{color:#fff9}@supports (color:color-mix(in lab, red, red)){.text-white\/60{color:color-mix(in oklab,var(--color-white)60%,transparent)}}.text-white\/70{color:#ffffffb3}@supports (color:color-mix(in lab, red, red)){.text-white\/70{color:color-mix(in oklab,var(--color-white)70%,transparent)}}.text-white\/80{color:#fffc}@supports (color:color-mix(in lab, red, red)){.text-white\/80{color:color-mix(in oklab,var(--color-white)80%,transparent)}}.text-white\/90{color:#ffffffe6}@supports (color:color-mix(in lab, red, red)){.text-white\/90{color:color-mix(in oklab,var(--color-white)90%,transparent)}}.text-yellow-100{color:var(--color-yellow-100)}.text-yellow-300{color:var(--color-yellow-300)}.text-yellow-400{color:var(--color-yellow-400)}.text-yellow-500{color:var(--color-yellow-500)}.text-yellow-500\/70{color:#edb200b3}@supports (color:color-mix(in lab, red, red)){.text-yellow-500\/70{color:color-mix(in oklab,var(--color-yellow-500)70%,transparent)}}.text-yellow-500\/80{color:#edb200cc}@supports (color:color-mix(in lab, red, red)){.text-yellow-500\/80{color:color-mix(in oklab,var(--color-yellow-500)80%,transparent)}}.text-yellow-600{color:var(--color-yellow-600)}.text-yellow-700{color:var(--color-yellow-700)}.text-yellow-800{color:var(--color-yellow-800)}.text-yellow-800\/80{color:#874b00cc}@supports (color:color-mix(in lab, red, red)){.text-yellow-800\/80{color:color-mix(in oklab,var(--color-yellow-800)80%,transparent)}}.text-zinc-100{color:var(--color-zinc-100)}.text-zinc-200{color:var(--color-zinc-200)}.text-zinc-300{color:var(--color-zinc-300)}.text-zinc-400{color:var(--color-zinc-400)}.text-zinc-500{color:var(--color-zinc-500)}.text-zinc-600{color:var(--color-zinc-600)}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.line-through{text-decoration-line:line-through}.underline{text-decoration-line:underline}.placeholder-bambu-gray::placeholder{color:var(--color-bambu-gray)}.placeholder-bambu-gray-dark::placeholder{color:var(--color-bambu-gray-dark)}.placeholder-bambu-gray\/40::placeholder{color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.placeholder-bambu-gray\/40::placeholder{color:color-mix(in oklab,var(--color-bambu-gray)40%,transparent)}}.placeholder-bambu-gray\/50::placeholder{color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.placeholder-bambu-gray\/50::placeholder{color:color-mix(in oklab,var(--color-bambu-gray)50%,transparent)}}.placeholder-bambu-gray\/60::placeholder{color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.placeholder-bambu-gray\/60::placeholder{color:color-mix(in oklab,var(--color-bambu-gray)60%,transparent)}}.placeholder-gray-400::placeholder{color:var(--color-gray-400)}.placeholder-white\/30::placeholder{color:#ffffff4d}@supports (color:color-mix(in lab, red, red)){.placeholder-white\/30::placeholder{color:color-mix(in oklab,var(--color-white)30%,transparent)}}.placeholder-zinc-500::placeholder{color:var(--color-zinc-500)}.accent-bambu-green{accent-color:var(--color-bambu-green)}.accent-green-500{accent-color:var(--color-green-500)}.accent-red-500{accent-color:var(--color-red-500)}.\[color-scheme\:dark\]{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}.opacity-0{opacity:0}.opacity-20{opacity:.2}.opacity-25{opacity:.25}.opacity-30{opacity:.3}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-55{opacity:.55}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.opacity-80{opacity:.8}.opacity-90{opacity:.9}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_6px_rgba\(34\,197\,94\,0\.5\)\]{--tw-shadow:0 0 6px var(--tw-shadow-color,#22c55e80);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_8px_rgba\(248\,113\,113\,0\.6\)\]{--tw-shadow:0 0 8px var(--tw-shadow-color,#f8717199);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow\/depth{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring,.ring-1{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-bambu-green\/20{--tw-shadow-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.shadow-bambu-green\/20{--tw-shadow-color:color-mix(in oklab,color-mix(in oklab,var(--color-bambu-green)20%,transparent)var(--tw-shadow-alpha),transparent)}}.shadow-bambu-green\/25{--tw-shadow-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.shadow-bambu-green\/25{--tw-shadow-color:color-mix(in oklab,color-mix(in oklab,var(--color-bambu-green)25%,transparent)var(--tw-shadow-alpha),transparent)}}.ring-amber-400{--tw-ring-color:var(--color-amber-400)}.ring-bambu-green,.ring-bambu-green\/30{--tw-ring-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.ring-bambu-green\/30{--tw-ring-color:color-mix(in oklab,var(--color-bambu-green)30%,transparent)}}.ring-blue-400\/50{--tw-ring-color:#54a2ff80}@supports (color:color-mix(in lab, red, red)){.ring-blue-400\/50{--tw-ring-color:color-mix(in oklab,var(--color-blue-400)50%,transparent)}}.ring-green-500{--tw-ring-color:var(--color-green-500)}.ring-red-500\/60{--tw-ring-color:#fb2c3699}@supports (color:color-mix(in lab, red, red)){.ring-red-500\/60{--tw-ring-color:color-mix(in oklab,var(--color-red-500)60%,transparent)}}.ring-white{--tw-ring-color:var(--color-white)}.ring-offset-1{--tw-ring-offset-width:1px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.ring-offset-2{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.ring-offset-bambu-dark{--tw-ring-offset-color:var(--color-bambu-dark)}.ring-offset-bambu-dark-secondary{--tw-ring-offset-color:var(--color-bambu-dark-secondary)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.blur-2xl{--tw-blur:blur(var(--blur-2xl));filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.drop-shadow-lg{--tw-drop-shadow-size:drop-shadow(0 4px 4px var(--tw-drop-shadow-color,#00000026));--tw-drop-shadow:drop-shadow(var(--drop-shadow-lg));filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.drop-shadow-md{--tw-drop-shadow-size:drop-shadow(0 3px 3px var(--tw-drop-shadow-color,#0000001f));--tw-drop-shadow:drop-shadow(var(--drop-shadow-md));filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.invert{--tw-invert:invert(100%);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.\!filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)!important}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.outline-none{--tw-outline-style:none;outline-style:none}.select-all{-webkit-user-select:all;user-select:all}.select-none{-webkit-user-select:none;user-select:none}.\[writing-mode\:vertical-rl\]{writing-mode:vertical-rl}.group-focus-within\:opacity-100:is(:where(.group):focus-within *){opacity:1}@media (hover:hover){.group-hover\:bg-bambu-green\/20:is(:where(.group):hover *){background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.group-hover\:bg-bambu-green\/20:is(:where(.group):hover *){background-color:color-mix(in oklab,var(--color-bambu-green)20%,transparent)}}.group-hover\:bg-bambu-green\/30:is(:where(.group):hover *){background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.group-hover\:bg-bambu-green\/30:is(:where(.group):hover *){background-color:color-mix(in oklab,var(--color-bambu-green)30%,transparent)}}.group-hover\:break-all:is(:where(.group):hover *){word-break:break-all}.group-hover\:whitespace-normal:is(:where(.group):hover *){white-space:normal}.group-hover\:text-bambu-gray:is(:where(.group):hover *){color:var(--color-bambu-gray)}.group-hover\:text-bambu-green:is(:where(.group):hover *){color:var(--color-bambu-green)}.group-hover\:text-yellow-400:is(:where(.group):hover *){color:var(--color-yellow-400)}.group-hover\:opacity-100:is(:where(.group):hover *),.group-hover\/resize\:opacity-100:is(:where(.group\/resize):hover *){opacity:1}.group-hover\/thumb\:block:is(:where(.group\/thumb):hover *){display:block}}.peer-checked\:bg-amber-500:is(:where(.peer):checked~*){background-color:var(--color-amber-500)}.peer-checked\:bg-bambu-green:is(:where(.peer):checked~*){background-color:var(--color-bambu-green)}.peer-focus\:ring-2:is(:where(.peer):focus~*){--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.peer-focus\:ring-bambu-green\/50:is(:where(.peer):focus~*){--tw-ring-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.peer-focus\:ring-bambu-green\/50:is(:where(.peer):focus~*){--tw-ring-color:color-mix(in oklab,var(--color-bambu-green)50%,transparent)}}.peer-focus\:outline-none:is(:where(.peer):focus~*){--tw-outline-style:none;outline-style:none}.peer-disabled\:cursor-not-allowed:is(:where(.peer):disabled~*){cursor:not-allowed}.peer-disabled\:opacity-50:is(:where(.peer):disabled~*){opacity:.5}.placeholder\:text-bambu-gray::placeholder,.placeholder\:text-bambu-gray\/40::placeholder{color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.placeholder\:text-bambu-gray\/40::placeholder{color:color-mix(in oklab,var(--color-bambu-gray)40%,transparent)}}.placeholder\:text-bambu-gray\/50::placeholder{color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.placeholder\:text-bambu-gray\/50::placeholder{color:color-mix(in oklab,var(--color-bambu-gray)50%,transparent)}}.placeholder\:text-bambu-gray\/60::placeholder{color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.placeholder\:text-bambu-gray\/60::placeholder{color:color-mix(in oklab,var(--color-bambu-gray)60%,transparent)}}.before\:absolute:before{content:var(--tw-content);position:absolute}.before\:top-0:before{content:var(--tw-content);top:calc(var(--spacing)*0)}.before\:right-3:before{content:var(--tw-content);right:calc(var(--spacing)*3)}.before\:left-3:before{content:var(--tw-content);left:calc(var(--spacing)*3)}.before\:h-0\.5:before{content:var(--tw-content);height:calc(var(--spacing)*.5)}.before\:bg-bambu-green:before{content:var(--tw-content);background-color:var(--color-bambu-green)}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:top-0\.5:after{content:var(--tw-content);top:calc(var(--spacing)*.5)}.after\:top-\[2px\]:after{content:var(--tw-content);top:2px}.after\:left-0\.5:after{content:var(--tw-content);left:calc(var(--spacing)*.5)}.after\:left-\[2px\]:after{content:var(--tw-content);left:2px}.after\:h-4:after{content:var(--tw-content);height:calc(var(--spacing)*4)}.after\:h-5:after{content:var(--tw-content);height:calc(var(--spacing)*5)}.after\:w-4:after{content:var(--tw-content);width:calc(var(--spacing)*4)}.after\:w-5:after{content:var(--tw-content);width:calc(var(--spacing)*5)}.after\:rounded-full:after{content:var(--tw-content);border-radius:3.40282e38px}.after\:border:after{content:var(--tw-content);border-style:var(--tw-border-style);border-width:1px}.after\:border-gray-300:after{content:var(--tw-content);border-color:var(--color-gray-300)}.after\:bg-white:after{content:var(--tw-content);background-color:var(--color-white)}.after\:transition-all:after{content:var(--tw-content);transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.after\:transition-transform:after{content:var(--tw-content);transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.after\:content-\[\'\'\]:after{--tw-content:"";content:var(--tw-content)}.peer-checked\:after\:translate-x-5:is(:where(.peer):checked~*):after{content:var(--tw-content);--tw-translate-x:calc(var(--spacing)*5);translate:var(--tw-translate-x)var(--tw-translate-y)}.peer-checked\:after\:translate-x-full:is(:where(.peer):checked~*):after{content:var(--tw-content);--tw-translate-x:100%;translate:var(--tw-translate-x)var(--tw-translate-y)}.peer-checked\:after\:border-white:is(:where(.peer):checked~*):after{content:var(--tw-content);border-color:var(--color-white)}.last\:border-0:last-child{border-style:var(--tw-border-style);border-width:0}.last\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.focus-within\:border-bambu-green:focus-within{border-color:var(--color-bambu-green)}@media (hover:hover){.hover\:z-10:hover{z-index:10}.hover\:z-20:hover{z-index:20}.hover\:scale-105:hover{--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x)var(--tw-scale-y)}.hover\:scale-110:hover{--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x)var(--tw-scale-y)}.hover\:border-amber-500:hover{border-color:var(--color-amber-500)}.hover\:border-bambu-dark-tertiary\/80:hover{border-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.hover\:border-bambu-dark-tertiary\/80:hover{border-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)80%,transparent)}}.hover\:border-bambu-gray:hover{border-color:var(--color-bambu-gray)}.hover\:border-bambu-gray-dark:hover{border-color:var(--color-bambu-gray-dark)}.hover\:border-bambu-gray\/50:hover{border-color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.hover\:border-bambu-gray\/50:hover{border-color:color-mix(in oklab,var(--color-bambu-gray)50%,transparent)}}.hover\:border-bambu-gray\/60:hover{border-color:var(--color-bambu-gray)}@supports (color:color-mix(in lab, red, red)){.hover\:border-bambu-gray\/60:hover{border-color:color-mix(in oklab,var(--color-bambu-gray)60%,transparent)}}.hover\:border-bambu-green:hover,.hover\:border-bambu-green\/40:hover{border-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.hover\:border-bambu-green\/40:hover{border-color:color-mix(in oklab,var(--color-bambu-green)40%,transparent)}}.hover\:border-bambu-green\/50:hover{border-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.hover\:border-bambu-green\/50:hover{border-color:color-mix(in oklab,var(--color-bambu-green)50%,transparent)}}.hover\:border-bambu-green\/60:hover{border-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.hover\:border-bambu-green\/60:hover{border-color:color-mix(in oklab,var(--color-bambu-green)60%,transparent)}}.hover\:border-gray-400:hover{border-color:var(--color-gray-400)}.hover\:border-green-500\/50:hover{border-color:#00c75880}@supports (color:color-mix(in lab, red, red)){.hover\:border-green-500\/50:hover{border-color:color-mix(in oklab,var(--color-green-500)50%,transparent)}}.hover\:border-white:hover{border-color:var(--color-white)}.hover\:border-white\/30:hover{border-color:#ffffff4d}@supports (color:color-mix(in lab, red, red)){.hover\:border-white\/30:hover{border-color:color-mix(in oklab,var(--color-white)30%,transparent)}}.hover\:border-white\/40:hover{border-color:#fff6}@supports (color:color-mix(in lab, red, red)){.hover\:border-white\/40:hover{border-color:color-mix(in oklab,var(--color-white)40%,transparent)}}.hover\:\!bg-bambu-green\/80:hover{background-color:var(--color-bambu-green)!important}@supports (color:color-mix(in lab, red, red)){.hover\:\!bg-bambu-green\/80:hover{background-color:color-mix(in oklab,var(--color-bambu-green)80%,transparent)!important}}.hover\:bg-amber-200:hover{background-color:var(--color-amber-200)}.hover\:bg-amber-500\/20:hover{background-color:#f99c0033}@supports (color:color-mix(in lab, red, red)){.hover\:bg-amber-500\/20:hover{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.hover\:bg-amber-600:hover{background-color:var(--color-amber-600)}.hover\:bg-amber-700:hover{background-color:var(--color-amber-700)}.hover\:bg-amber-900\/50:hover{background-color:#7b330680}@supports (color:color-mix(in lab, red, red)){.hover\:bg-amber-900\/50:hover{background-color:color-mix(in oklab,var(--color-amber-900)50%,transparent)}}.hover\:bg-bambu-dark:hover{background-color:var(--color-bambu-dark)}.hover\:bg-bambu-dark-secondary:hover,.hover\:bg-bambu-dark-secondary\/50:hover{background-color:var(--color-bambu-dark-secondary)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-dark-secondary\/50:hover{background-color:color-mix(in oklab,var(--color-bambu-dark-secondary)50%,transparent)}}.hover\:bg-bambu-dark-secondary\/80:hover{background-color:var(--color-bambu-dark-secondary)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-dark-secondary\/80:hover{background-color:color-mix(in oklab,var(--color-bambu-dark-secondary)80%,transparent)}}.hover\:bg-bambu-dark-tertiary:hover,.hover\:bg-bambu-dark-tertiary\/30:hover{background-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-dark-tertiary\/30:hover{background-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)30%,transparent)}}.hover\:bg-bambu-dark-tertiary\/40:hover{background-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-dark-tertiary\/40:hover{background-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)40%,transparent)}}.hover\:bg-bambu-dark-tertiary\/50:hover{background-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-dark-tertiary\/50:hover{background-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)50%,transparent)}}.hover\:bg-bambu-dark-tertiary\/60:hover{background-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-dark-tertiary\/60:hover{background-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)60%,transparent)}}.hover\:bg-bambu-dark-tertiary\/70:hover{background-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-dark-tertiary\/70:hover{background-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)70%,transparent)}}.hover\:bg-bambu-dark-tertiary\/80:hover{background-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-dark-tertiary\/80:hover{background-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)80%,transparent)}}.hover\:bg-bambu-dark\/30:hover{background-color:var(--color-bambu-dark)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-dark\/30:hover{background-color:color-mix(in oklab,var(--color-bambu-dark)30%,transparent)}}.hover\:bg-bambu-dark\/40:hover{background-color:var(--color-bambu-dark)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-dark\/40:hover{background-color:color-mix(in oklab,var(--color-bambu-dark)40%,transparent)}}.hover\:bg-bambu-dark\/50:hover{background-color:var(--color-bambu-dark)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-dark\/50:hover{background-color:color-mix(in oklab,var(--color-bambu-dark)50%,transparent)}}.hover\:bg-bambu-dark\/80:hover{background-color:var(--color-bambu-dark)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-dark\/80:hover{background-color:color-mix(in oklab,var(--color-bambu-dark)80%,transparent)}}.hover\:bg-bambu-gray-dark:hover{background-color:var(--color-bambu-gray-dark)}.hover\:bg-bambu-green:hover{background-color:var(--color-bambu-green)}.hover\:bg-bambu-green-dark:hover{background-color:var(--color-bambu-green-dark)}.hover\:bg-bambu-green-light:hover{background-color:var(--color-bambu-green-light)}.hover\:bg-bambu-green\/10:hover{background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-green\/10:hover{background-color:color-mix(in oklab,var(--color-bambu-green)10%,transparent)}}.hover\:bg-bambu-green\/20:hover{background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-green\/20:hover{background-color:color-mix(in oklab,var(--color-bambu-green)20%,transparent)}}.hover\:bg-bambu-green\/30:hover{background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-green\/30:hover{background-color:color-mix(in oklab,var(--color-bambu-green)30%,transparent)}}.hover\:bg-bambu-green\/40:hover{background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-green\/40:hover{background-color:color-mix(in oklab,var(--color-bambu-green)40%,transparent)}}.hover\:bg-bambu-green\/50:hover{background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-green\/50:hover{background-color:color-mix(in oklab,var(--color-bambu-green)50%,transparent)}}.hover\:bg-bambu-green\/80:hover{background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-green\/80:hover{background-color:color-mix(in oklab,var(--color-bambu-green)80%,transparent)}}.hover\:bg-bambu-green\/90:hover{background-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-bambu-green\/90:hover{background-color:color-mix(in oklab,var(--color-bambu-green)90%,transparent)}}.hover\:bg-black\/10:hover{background-color:#0000001a}@supports (color:color-mix(in lab, red, red)){.hover\:bg-black\/10:hover{background-color:color-mix(in oklab,var(--color-black)10%,transparent)}}.hover\:bg-black\/40:hover{background-color:#0006}@supports (color:color-mix(in lab, red, red)){.hover\:bg-black\/40:hover{background-color:color-mix(in oklab,var(--color-black)40%,transparent)}}.hover\:bg-black\/70:hover{background-color:#000000b3}@supports (color:color-mix(in lab, red, red)){.hover\:bg-black\/70:hover{background-color:color-mix(in oklab,var(--color-black)70%,transparent)}}.hover\:bg-black\/80:hover{background-color:#000c}@supports (color:color-mix(in lab, red, red)){.hover\:bg-black\/80:hover{background-color:color-mix(in oklab,var(--color-black)80%,transparent)}}.hover\:bg-blue-200:hover{background-color:var(--color-blue-200)}.hover\:bg-blue-400:hover{background-color:var(--color-blue-400)}.hover\:bg-blue-500\/30:hover{background-color:#3080ff4d}@supports (color:color-mix(in lab, red, red)){.hover\:bg-blue-500\/30:hover{background-color:color-mix(in oklab,var(--color-blue-500)30%,transparent)}}.hover\:bg-blue-600:hover{background-color:var(--color-blue-600)}.hover\:bg-blue-700:hover{background-color:var(--color-blue-700)}.hover\:bg-cyan-50:hover{background-color:var(--color-cyan-50)}.hover\:bg-emerald-600:hover{background-color:var(--color-emerald-600)}.hover\:bg-gray-50:hover{background-color:var(--color-gray-50)}.hover\:bg-gray-100:hover{background-color:var(--color-gray-100)}.hover\:bg-gray-200:hover{background-color:var(--color-gray-200)}.hover\:bg-gray-700:hover{background-color:var(--color-gray-700)}.hover\:bg-green-400:hover{background-color:var(--color-green-400)}.hover\:bg-green-500\/20:hover{background-color:#00c75833}@supports (color:color-mix(in lab, red, red)){.hover\:bg-green-500\/20:hover{background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.hover\:bg-green-600:hover{background-color:var(--color-green-600)}.hover\:bg-green-700:hover{background-color:var(--color-green-700)}.hover\:bg-indigo-200:hover{background-color:var(--color-indigo-200)}.hover\:bg-indigo-500\/20:hover{background-color:#625fff33}@supports (color:color-mix(in lab, red, red)){.hover\:bg-indigo-500\/20:hover{background-color:color-mix(in oklab,var(--color-indigo-500)20%,transparent)}}.hover\:bg-orange-100:hover{background-color:var(--color-orange-100)}.hover\:bg-orange-200:hover{background-color:var(--color-orange-200)}.hover\:bg-orange-400:hover{background-color:var(--color-orange-400)}.hover\:bg-orange-500\/20:hover{background-color:#fe6e0033}@supports (color:color-mix(in lab, red, red)){.hover\:bg-orange-500\/20:hover{background-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.hover\:bg-purple-400:hover{background-color:var(--color-purple-400)}.hover\:bg-purple-600\/90:hover{background-color:#9810fae6}@supports (color:color-mix(in lab, red, red)){.hover\:bg-purple-600\/90:hover{background-color:color-mix(in oklab,var(--color-purple-600)90%,transparent)}}.hover\:bg-red-50:hover{background-color:var(--color-red-50)}.hover\:bg-red-100:hover{background-color:var(--color-red-100)}.hover\:bg-red-200:hover{background-color:var(--color-red-200)}.hover\:bg-red-400:hover{background-color:var(--color-red-400)}.hover\:bg-red-500:hover{background-color:var(--color-red-500)}.hover\:bg-red-500\/10:hover{background-color:#fb2c361a}@supports (color:color-mix(in lab, red, red)){.hover\:bg-red-500\/10:hover{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.hover\:bg-red-500\/20:hover{background-color:#fb2c3633}@supports (color:color-mix(in lab, red, red)){.hover\:bg-red-500\/20:hover{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.hover\:bg-red-500\/30:hover{background-color:#fb2c364d}@supports (color:color-mix(in lab, red, red)){.hover\:bg-red-500\/30:hover{background-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.hover\:bg-red-600:hover{background-color:var(--color-red-600)}.hover\:bg-red-600\/30:hover{background-color:#e400144d}@supports (color:color-mix(in lab, red, red)){.hover\:bg-red-600\/30:hover{background-color:color-mix(in oklab,var(--color-red-600)30%,transparent)}}.hover\:bg-red-700:hover{background-color:var(--color-red-700)}.hover\:bg-red-900\/50:hover{background-color:#82181a80}@supports (color:color-mix(in lab, red, red)){.hover\:bg-red-900\/50:hover{background-color:color-mix(in oklab,var(--color-red-900)50%,transparent)}}.hover\:bg-sky-500\/20:hover{background-color:#00a5ef33}@supports (color:color-mix(in lab, red, red)){.hover\:bg-sky-500\/20:hover{background-color:color-mix(in oklab,var(--color-sky-500)20%,transparent)}}.hover\:bg-teal-400:hover{background-color:var(--color-teal-400)}.hover\:bg-white\/5:hover{background-color:#ffffff0d}@supports (color:color-mix(in lab, red, red)){.hover\:bg-white\/5:hover{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.hover\:bg-white\/10:hover{background-color:#ffffff1a}@supports (color:color-mix(in lab, red, red)){.hover\:bg-white\/10:hover{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.hover\:bg-white\/20:hover{background-color:#fff3}@supports (color:color-mix(in lab, red, red)){.hover\:bg-white\/20:hover{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.hover\:bg-white\/80:hover{background-color:#fffc}@supports (color:color-mix(in lab, red, red)){.hover\:bg-white\/80:hover{background-color:color-mix(in oklab,var(--color-white)80%,transparent)}}.hover\:bg-yellow-200:hover{background-color:var(--color-yellow-200)}.hover\:bg-yellow-500\/20:hover{background-color:#edb20033}@supports (color:color-mix(in lab, red, red)){.hover\:bg-yellow-500\/20:hover{background-color:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.hover\:bg-yellow-500\/30:hover{background-color:#edb2004d}@supports (color:color-mix(in lab, red, red)){.hover\:bg-yellow-500\/30:hover{background-color:color-mix(in oklab,var(--color-yellow-500)30%,transparent)}}.hover\:bg-yellow-600:hover{background-color:var(--color-yellow-600)}.hover\:bg-zinc-600:hover{background-color:var(--color-zinc-600)}.hover\:bg-zinc-700:hover{background-color:var(--color-zinc-700)}.hover\:bg-zinc-700\/50:hover{background-color:#3f3f4680}@supports (color:color-mix(in lab, red, red)){.hover\:bg-zinc-700\/50:hover{background-color:color-mix(in oklab,var(--color-zinc-700)50%,transparent)}}.hover\:bg-zinc-700\/60:hover{background-color:#3f3f4699}@supports (color:color-mix(in lab, red, red)){.hover\:bg-zinc-700\/60:hover{background-color:color-mix(in oklab,var(--color-zinc-700)60%,transparent)}}.hover\:bg-zinc-800:hover{background-color:var(--color-zinc-800)}.hover\:from-bambu-green\/20:hover{--tw-gradient-from:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.hover\:from-bambu-green\/20:hover{--tw-gradient-from:color-mix(in oklab,var(--color-bambu-green)20%,transparent)}}.hover\:from-bambu-green\/20:hover{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.hover\:text-amber-700:hover{color:var(--color-amber-700)}.hover\:text-amber-800:hover{color:var(--color-amber-800)}.hover\:text-amber-900:hover{color:var(--color-amber-900)}.hover\:text-bambu-gray:hover{color:var(--color-bambu-gray)}.hover\:text-bambu-green:hover{color:var(--color-bambu-green)}.hover\:text-bambu-green-light:hover{color:var(--color-bambu-green-light)}.hover\:text-bambu-green\/70:hover{color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.hover\:text-bambu-green\/70:hover{color:color-mix(in oklab,var(--color-bambu-green)70%,transparent)}}.hover\:text-bambu-green\/80:hover{color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.hover\:text-bambu-green\/80:hover{color:color-mix(in oklab,var(--color-bambu-green)80%,transparent)}}.hover\:text-blue-600:hover{color:var(--color-blue-600)}.hover\:text-blue-700:hover{color:var(--color-blue-700)}.hover\:text-blue-800:hover{color:var(--color-blue-800)}.hover\:text-blue-900:hover{color:var(--color-blue-900)}.hover\:text-cyan-900:hover{color:var(--color-cyan-900)}.hover\:text-gray-600:hover{color:var(--color-gray-600)}.hover\:text-gray-700:hover{color:var(--color-gray-700)}.hover\:text-gray-900:hover{color:var(--color-gray-900)}.hover\:text-orange-600:hover{color:var(--color-orange-600)}.hover\:text-orange-700:hover{color:var(--color-orange-700)}.hover\:text-orange-900:hover{color:var(--color-orange-900)}.hover\:text-red-300:hover{color:var(--color-red-300)}.hover\:text-red-400:hover{color:var(--color-red-400)}.hover\:text-red-500:hover{color:var(--color-red-500)}.hover\:text-red-600:hover{color:var(--color-red-600)}.hover\:text-red-700:hover{color:var(--color-red-700)}.hover\:text-red-800:hover{color:var(--color-red-800)}.hover\:text-red-900:hover{color:var(--color-red-900)}.hover\:text-slate-700:hover{color:var(--color-slate-700)}.hover\:text-white:hover{color:var(--color-white)}.hover\:text-white\/60:hover{color:#fff9}@supports (color:color-mix(in lab, red, red)){.hover\:text-white\/60:hover{color:color-mix(in oklab,var(--color-white)60%,transparent)}}.hover\:text-white\/70:hover{color:#ffffffb3}@supports (color:color-mix(in lab, red, red)){.hover\:text-white\/70:hover{color:color-mix(in oklab,var(--color-white)70%,transparent)}}.hover\:text-white\/80:hover{color:#fffc}@supports (color:color-mix(in lab, red, red)){.hover\:text-white\/80:hover{color:color-mix(in oklab,var(--color-white)80%,transparent)}}.hover\:text-yellow-600:hover{color:var(--color-yellow-600)}.hover\:text-zinc-200:hover{color:var(--color-zinc-200)}.hover\:text-zinc-300:hover{color:var(--color-zinc-300)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-70:hover{opacity:.7}.hover\:opacity-80:hover{opacity:.8}.hover\:opacity-90:hover{opacity:.9}.hover\:opacity-100:hover{opacity:1}.hover\:shadow-lg:hover{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-xl:hover{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-bambu-green\/5:hover{--tw-shadow-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.hover\:shadow-bambu-green\/5:hover{--tw-shadow-color:color-mix(in oklab,color-mix(in oklab,var(--color-bambu-green)5%,transparent)var(--tw-shadow-alpha),transparent)}}.hover\:shadow-bambu-green\/30:hover{--tw-shadow-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.hover\:shadow-bambu-green\/30:hover{--tw-shadow-color:color-mix(in oklab,color-mix(in oklab,var(--color-bambu-green)30%,transparent)var(--tw-shadow-alpha),transparent)}}.hover\:brightness-110:hover{--tw-brightness:brightness(110%);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}}.focus\:border-amber-500\/50:focus{border-color:#f99c0080}@supports (color:color-mix(in lab, red, red)){.focus\:border-amber-500\/50:focus{border-color:color-mix(in oklab,var(--color-amber-500)50%,transparent)}}.focus\:border-bambu-gray:focus{border-color:var(--color-bambu-gray)}.focus\:border-bambu-green:focus{border-color:var(--color-bambu-green)}.focus\:border-red-500:focus{border-color:var(--color-red-500)}.focus\:border-transparent:focus{border-color:#0000}.focus\:ring-0:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-1:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-amber-400:focus{--tw-ring-color:var(--color-amber-400)}.focus\:ring-bambu-gray:focus{--tw-ring-color:var(--color-bambu-gray)}.focus\:ring-bambu-green:focus,.focus\:ring-bambu-green\/40:focus{--tw-ring-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.focus\:ring-bambu-green\/40:focus{--tw-ring-color:color-mix(in oklab,var(--color-bambu-green)40%,transparent)}}.focus\:ring-bambu-green\/50:focus{--tw-ring-color:var(--color-bambu-green)}@supports (color:color-mix(in lab, red, red)){.focus\:ring-bambu-green\/50:focus{--tw-ring-color:color-mix(in oklab,var(--color-bambu-green)50%,transparent)}}.focus\:ring-blue-500:focus{--tw-ring-color:var(--color-blue-500)}.focus\:ring-red-500:focus{--tw-ring-color:var(--color-red-500)}.focus\:ring-offset-0:focus{--tw-ring-offset-width:0px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus\:ring-offset-bambu-dark:focus{--tw-ring-offset-color:var(--color-bambu-dark)}.focus\:ring-offset-bambu-dark-secondary:focus{--tw-ring-offset-color:var(--color-bambu-dark-secondary)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:opacity-100:focus-visible{opacity:1}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-bambu-green:focus-visible{--tw-ring-color:var(--color-bambu-green)}.focus-visible\:ring-white:focus-visible{--tw-ring-color:var(--color-white)}.active\:scale-95:active{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x)var(--tw-scale-y)}.active\:cursor-grabbing:active{cursor:grabbing}.active\:bg-amber-500\/30:active{background-color:#f99c004d}@supports (color:color-mix(in lab, red, red)){.active\:bg-amber-500\/30:active{background-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.active\:bg-white\/30:active{background-color:#ffffff4d}@supports (color:color-mix(in lab, red, red)){.active\:bg-white\/30:active{background-color:color-mix(in oklab,var(--color-white)30%,transparent)}}.active\:opacity-50:active{opacity:.5}.enabled\:cursor-pointer:enabled{cursor:pointer}@media (hover:hover){.enabled\:hover\:bg-amber-500:enabled:hover{background-color:var(--color-amber-500)}}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:cursor-wait:disabled{cursor:wait}.disabled\:bg-gray-600:disabled{background-color:var(--color-gray-600)}.disabled\:bg-zinc-700:disabled{background-color:var(--color-zinc-700)}.disabled\:no-underline:disabled{text-decoration-line:none}.disabled\:opacity-25:disabled{opacity:.25}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-35:disabled{opacity:.35}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:opacity-60:disabled{opacity:.6}@media (hover:hover){.disabled\:hover\:bg-bambu-dark:disabled:hover{background-color:var(--color-bambu-dark)}.disabled\:hover\:bg-bambu-green:disabled:hover{background-color:var(--color-bambu-green)}.disabled\:hover\:bg-transparent:disabled:hover{background-color:#0000}.disabled\:hover\:text-bambu-gray:disabled:hover{color:var(--color-bambu-gray)}}@media not all and (min-width:640px){.max-\[640px\]\:hidden{display:none}.max-\[640px\]\:w-full{width:100%}.max-\[640px\]\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.max-\[640px\]\:flex-col{flex-direction:column}.max-\[640px\]\:flex-wrap{flex-wrap:wrap}.max-\[640px\]\:items-center{align-items:center}.max-\[640px\]\:items-start{align-items:flex-start}}@media not all and (min-width:550px){.max-\[550px\]\:order-1{order:1}.max-\[550px\]\:order-2{order:2}.max-\[550px\]\:order-3{order:3}.max-\[550px\]\:order-4{order:4}.max-\[550px\]\:mt-1{margin-top:calc(var(--spacing)*1)}.max-\[550px\]\:w-full{width:100%}.max-\[550px\]\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.max-\[550px\]\:flex-col{flex-direction:column}.max-\[550px\]\:flex-wrap{flex-wrap:wrap}.max-\[550px\]\:items-center{align-items:center}.max-\[550px\]\:items-start{align-items:flex-start}.max-\[550px\]\:justify-end{justify-content:flex-end}.max-\[550px\]\:gap-3{gap:calc(var(--spacing)*3)}}@media not all and (min-width:520px){.max-\[520px\]\:h-20{height:calc(var(--spacing)*20)}.max-\[520px\]\:w-20{width:calc(var(--spacing)*20)}}@media not all and (min-width:48rem){.max-md\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.max-md\:overflow-y-auto{overflow-y:auto}.max-md\:border-r-0{border-right-style:var(--tw-border-style);border-right-width:0}.max-md\:border-b-0{border-bottom-style:var(--tw-border-style);border-bottom-width:0}}@media (min-width:40rem){.sm\:col-span-2{grid-column:span 2/span 2}.sm\:mt-0{margin-top:calc(var(--spacing)*0)}.sm\:mt-2{margin-top:calc(var(--spacing)*2)}.sm\:mt-3{margin-top:calc(var(--spacing)*3)}.sm\:mr-1{margin-right:calc(var(--spacing)*1)}.sm\:mb-4{margin-bottom:calc(var(--spacing)*4)}.sm\:ml-auto{margin-left:auto}.sm\:block{display:block}.sm\:flex{display:flex}.sm\:grid{display:grid}.sm\:hidden{display:none}.sm\:inline{display:inline}.sm\:table-cell{display:table-cell}.sm\:h-2{height:calc(var(--spacing)*2)}.sm\:h-3{height:calc(var(--spacing)*3)}.sm\:h-3\.5{height:calc(var(--spacing)*3.5)}.sm\:h-4{height:calc(var(--spacing)*4)}.sm\:h-5{height:calc(var(--spacing)*5)}.sm\:h-6{height:calc(var(--spacing)*6)}.sm\:h-12{height:calc(var(--spacing)*12)}.sm\:h-14{height:calc(var(--spacing)*14)}.sm\:h-\[calc\(100vh-2rem\)\]{height:calc(100vh - 2rem)}.sm\:w-1\/2{width:50%}.sm\:w-3{width:calc(var(--spacing)*3)}.sm\:w-3\.5{width:calc(var(--spacing)*3.5)}.sm\:w-4{width:calc(var(--spacing)*4)}.sm\:w-5{width:calc(var(--spacing)*5)}.sm\:w-6{width:calc(var(--spacing)*6)}.sm\:w-12{width:calc(var(--spacing)*12)}.sm\:w-14{width:calc(var(--spacing)*14)}.sm\:w-16{width:calc(var(--spacing)*16)}.sm\:w-40{width:calc(var(--spacing)*40)}.sm\:w-72{width:calc(var(--spacing)*72)}.sm\:w-auto{width:auto}.sm\:max-w-\[140px\]{max-width:140px}.sm\:max-w-none{max-width:none}.sm\:max-w-xs{max-width:var(--container-xs)}.sm\:flex-1{flex:1}.sm\:flex-none{flex:none}.sm\:cursor-default{cursor:default}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-between{justify-content:space-between}.sm\:gap-1{gap:calc(var(--spacing)*1)}.sm\:gap-1\.5{gap:calc(var(--spacing)*1.5)}.sm\:gap-2{gap:calc(var(--spacing)*2)}.sm\:gap-3{gap:calc(var(--spacing)*3)}.sm\:gap-4{gap:calc(var(--spacing)*4)}.sm\:gap-5{gap:calc(var(--spacing)*5)}.sm\:gap-6{gap:calc(var(--spacing)*6)}:where(.sm\:space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}:where(.sm\:space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*8)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*8)*calc(1 - var(--tw-space-y-reverse)))}.sm\:rounded-2xl{border-radius:var(--radius-2xl)}.sm\:border-bambu-dark-tertiary{border-color:var(--color-bambu-dark-tertiary)}.sm\:p-1\.5{padding:calc(var(--spacing)*1.5)}.sm\:p-2{padding:calc(var(--spacing)*2)}.sm\:p-3{padding:calc(var(--spacing)*3)}.sm\:p-4{padding:calc(var(--spacing)*4)}.sm\:px-2{padding-inline:calc(var(--spacing)*2)}.sm\:px-3{padding-inline:calc(var(--spacing)*3)}.sm\:text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.sm\:text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.sm\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.sm\:text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}}@media (min-width:48rem){.md\:sticky{position:sticky}.md\:top-0{top:calc(var(--spacing)*0)}.md\:top-\[2px\]{top:2px}.md\:left-\[2px\]{left:2px}.md\:col-span-2{grid-column:span 2/span 2}.md\:mx-0{margin-inline:calc(var(--spacing)*0)}.md\:ml-8{margin-left:calc(var(--spacing)*8)}.md\:block{display:block}.md\:inline{display:inline}.md\:h-4{height:calc(var(--spacing)*4)}.md\:h-5{height:calc(var(--spacing)*5)}.md\:max-h-none{max-height:none}.md\:min-h-0{min-height:calc(var(--spacing)*0)}.md\:w-4{width:calc(var(--spacing)*4)}.md\:w-9{width:calc(var(--spacing)*9)}.md\:w-52{width:calc(var(--spacing)*52)}.md\:min-w-\[200px\]{min-width:200px}.md\:flex-1{flex:1}.md\:shrink{flex-shrink:1}.md\:shrink-0{flex-shrink:0}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.md\:grid-cols-\[1fr_1\.5fr_auto\]{grid-template-columns:1fr 1.5fr auto}.md\:grid-cols-\[1fr_180px_140px_auto\]{grid-template-columns:1fr 180px 140px auto}.md\:flex-col{flex-direction:column}.md\:flex-row{flex-direction:row}.md\:flex-wrap{flex-wrap:wrap}.md\:items-center{align-items:center}.md\:gap-4{gap:calc(var(--spacing)*4)}.md\:self-auto{align-self:auto}.md\:self-start{align-self:flex-start}.md\:overflow-hidden{overflow:hidden}.md\:overflow-x-visible{overflow-x:visible}.md\:overflow-y-auto{overflow-y:auto}.md\:border-t-0{border-top-style:var(--tw-border-style);border-top-width:0}.md\:border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.md\:p-5{padding:calc(var(--spacing)*5)}.md\:p-6{padding:calc(var(--spacing)*6)}.md\:p-8{padding:calc(var(--spacing)*8)}.md\:px-0{padding-inline:calc(var(--spacing)*0)}.md\:py-2{padding-block:calc(var(--spacing)*2)}.md\:pb-0{padding-bottom:calc(var(--spacing)*0)}.md\:pl-6{padding-left:calc(var(--spacing)*6)}}@media (min-width:64rem){.lg\:static{position:static}.lg\:sticky{position:sticky}.lg\:top-4{top:calc(var(--spacing)*4)}.lg\:top-6{top:calc(var(--spacing)*6)}.lg\:order-none{order:0}.lg\:col-span-2{grid-column:span 2/span 2}.lg\:mt-0{margin-top:calc(var(--spacing)*0)}.lg\:mb-0{margin-bottom:calc(var(--spacing)*0)}.lg\:mb-6{margin-bottom:calc(var(--spacing)*6)}.lg\:-ml-px{margin-left:-1px}.lg\:flex{display:flex}.lg\:grid{display:grid}.lg\:hidden{display:none}.lg\:h-\[calc\(100vh-64px\)\]{height:calc(100vh - 64px)}.lg\:h-full{height:100%}.lg\:max-h-\[58vh\]{max-height:58vh}.lg\:max-h-none{max-height:none}.lg\:min-h-0{min-height:calc(var(--spacing)*0)}.lg\:w-1\/2{width:50%}.lg\:w-1\/3{width:33.3333%}.lg\:w-2\/3{width:66.6667%}.lg\:w-10{width:calc(var(--spacing)*10)}.lg\:w-60{width:calc(var(--spacing)*60)}.lg\:w-80{width:calc(var(--spacing)*80)}.lg\:w-\[480px\]{width:480px}.lg\:max-w-5xl{max-width:var(--container-5xl)}.lg\:max-w-md{max-width:var(--container-md)}.lg\:max-w-sm{max-width:var(--container-sm)}.lg\:max-w-xl{max-width:var(--container-xl)}.lg\:flex-shrink-0{flex-shrink:0}.lg\:cursor-default{cursor:default}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.lg\:grid-cols-\[1fr_20rem\]{grid-template-columns:1fr 20rem}.lg\:grid-cols-\[minmax\(0\,1fr\)_minmax\(0\,1fr\)_auto\]{grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto}.lg\:grid-cols-\[minmax\(20rem\,2fr\)_minmax\(0\,3fr\)\]{grid-template-columns:minmax(20rem,2fr) minmax(0,3fr)}.lg\:flex-col{flex-direction:column}.lg\:flex-row{flex-direction:row}.lg\:flex-nowrap{flex-wrap:nowrap}.lg\:items-end{align-items:flex-end}.lg\:items-start{align-items:flex-start}.lg\:justify-between{justify-content:space-between}.lg\:justify-end{justify-content:flex-end}.lg\:justify-start{justify-content:flex-start}.lg\:gap-0{gap:calc(var(--spacing)*0)}.lg\:gap-5{gap:calc(var(--spacing)*5)}.lg\:gap-6{gap:calc(var(--spacing)*6)}.lg\:gap-8{gap:calc(var(--spacing)*8)}.lg\:self-start{align-self:flex-start}.lg\:overflow-y-auto{overflow-y:auto}.lg\:border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.lg\:border-b-0{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.lg\:border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.lg\:pt-0{padding-top:calc(var(--spacing)*0)}}@media (min-width:80rem){.xl\:col-span-3{grid-column:span 3/span 3}.xl\:inline{display:inline}.xl\:w-96{width:calc(var(--spacing)*96)}.xl\:max-w-7xl{max-width:var(--container-7xl)}.xl\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.xl\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.xl\:grid-cols-\[minmax\(0\,1fr\)_minmax\(0\,1fr\)_minmax\(0\,1fr\)_auto\]{grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) auto}}@media (min-width:96rem){.\32 xl\:max-w-\[96rem\]{max-width:96rem}.\32 xl\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}}:where(.dark\:divide-gray-800:where(.dark,.dark *)>:not(:last-child)){border-color:var(--color-gray-800)}.dark\:border-amber-400\/60:where(.dark,.dark *){border-color:#fcbb0099}@supports (color:color-mix(in lab, red, red)){.dark\:border-amber-400\/60:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-amber-400)60%,transparent)}}.dark\:border-amber-500\/30:where(.dark,.dark *){border-color:#f99c004d}@supports (color:color-mix(in lab, red, red)){.dark\:border-amber-500\/30:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.dark\:border-amber-500\/40:where(.dark,.dark *){border-color:#f99c0066}@supports (color:color-mix(in lab, red, red)){.dark\:border-amber-500\/40:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-amber-500)40%,transparent)}}.dark\:border-amber-700:where(.dark,.dark *){border-color:var(--color-amber-700)}.dark\:border-amber-700\/40:where(.dark,.dark *){border-color:#b7500066}@supports (color:color-mix(in lab, red, red)){.dark\:border-amber-700\/40:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-amber-700)40%,transparent)}}.dark\:border-amber-800:where(.dark,.dark *){border-color:var(--color-amber-800)}.dark\:border-bambu-dark-tertiary:where(.dark,.dark *),.dark\:border-bambu-dark-tertiary\/60:where(.dark,.dark *){border-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab, red, red)){.dark\:border-bambu-dark-tertiary\/60:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)60%,transparent)}}.dark\:border-blue-400\/20:where(.dark,.dark *){border-color:#54a2ff33}@supports (color:color-mix(in lab, red, red)){.dark\:border-blue-400\/20:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-blue-400)20%,transparent)}}.dark\:border-blue-400\/50:where(.dark,.dark *){border-color:#54a2ff80}@supports (color:color-mix(in lab, red, red)){.dark\:border-blue-400\/50:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-blue-400)50%,transparent)}}.dark\:border-blue-500\/20:where(.dark,.dark *){border-color:#3080ff33}@supports (color:color-mix(in lab, red, red)){.dark\:border-blue-500\/20:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.dark\:border-blue-500\/30:where(.dark,.dark *){border-color:#3080ff4d}@supports (color:color-mix(in lab, red, red)){.dark\:border-blue-500\/30:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-blue-500)30%,transparent)}}.dark\:border-blue-500\/40:where(.dark,.dark *){border-color:#3080ff66}@supports (color:color-mix(in lab, red, red)){.dark\:border-blue-500\/40:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-blue-500)40%,transparent)}}.dark\:border-blue-500\/50:where(.dark,.dark *){border-color:#3080ff80}@supports (color:color-mix(in lab, red, red)){.dark\:border-blue-500\/50:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-blue-500)50%,transparent)}}.dark\:border-cyan-500\/30:where(.dark,.dark *){border-color:#00b7d74d}@supports (color:color-mix(in lab, red, red)){.dark\:border-cyan-500\/30:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-cyan-500)30%,transparent)}}.dark\:border-emerald-500\/20:where(.dark,.dark *){border-color:#00bb7f33}@supports (color:color-mix(in lab, red, red)){.dark\:border-emerald-500\/20:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-emerald-500)20%,transparent)}}.dark\:border-gray-600:where(.dark,.dark *){border-color:var(--color-gray-600)}.dark\:border-gray-700:where(.dark,.dark *){border-color:var(--color-gray-700)}.dark\:border-green-500\/20:where(.dark,.dark *){border-color:#00c75833}@supports (color:color-mix(in lab, red, red)){.dark\:border-green-500\/20:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.dark\:border-green-500\/30:where(.dark,.dark *){border-color:#00c7584d}@supports (color:color-mix(in lab, red, red)){.dark\:border-green-500\/30:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-green-500)30%,transparent)}}.dark\:border-green-500\/40:where(.dark,.dark *){border-color:#00c75866}@supports (color:color-mix(in lab, red, red)){.dark\:border-green-500\/40:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-green-500)40%,transparent)}}.dark\:border-green-500\/50:where(.dark,.dark *){border-color:#00c75880}@supports (color:color-mix(in lab, red, red)){.dark\:border-green-500\/50:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-green-500)50%,transparent)}}.dark\:border-green-800:where(.dark,.dark *){border-color:var(--color-green-800)}.dark\:border-orange-400\/20:where(.dark,.dark *){border-color:#ff8b1a33}@supports (color:color-mix(in lab, red, red)){.dark\:border-orange-400\/20:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-orange-400)20%,transparent)}}.dark\:border-orange-400\/50:where(.dark,.dark *){border-color:#ff8b1a80}@supports (color:color-mix(in lab, red, red)){.dark\:border-orange-400\/50:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-orange-400)50%,transparent)}}.dark\:border-orange-500\/20:where(.dark,.dark *){border-color:#fe6e0033}@supports (color:color-mix(in lab, red, red)){.dark\:border-orange-500\/20:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.dark\:border-orange-500\/30:where(.dark,.dark *){border-color:#fe6e004d}@supports (color:color-mix(in lab, red, red)){.dark\:border-orange-500\/30:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-orange-500)30%,transparent)}}.dark\:border-orange-500\/40:where(.dark,.dark *){border-color:#fe6e0066}@supports (color:color-mix(in lab, red, red)){.dark\:border-orange-500\/40:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-orange-500)40%,transparent)}}.dark\:border-purple-400\/20:where(.dark,.dark *){border-color:#c07eff33}@supports (color:color-mix(in lab, red, red)){.dark\:border-purple-400\/20:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-purple-400)20%,transparent)}}.dark\:border-purple-500\/20:where(.dark,.dark *){border-color:#ac4bff33}@supports (color:color-mix(in lab, red, red)){.dark\:border-purple-500\/20:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.dark\:border-purple-500\/30:where(.dark,.dark *){border-color:#ac4bff4d}@supports (color:color-mix(in lab, red, red)){.dark\:border-purple-500\/30:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-purple-500)30%,transparent)}}.dark\:border-red-400:where(.dark,.dark *){border-color:var(--color-red-400)}.dark\:border-red-500\/20:where(.dark,.dark *){border-color:#fb2c3633}@supports (color:color-mix(in lab, red, red)){.dark\:border-red-500\/20:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.dark\:border-red-500\/30:where(.dark,.dark *){border-color:#fb2c364d}@supports (color:color-mix(in lab, red, red)){.dark\:border-red-500\/30:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.dark\:border-red-500\/40:where(.dark,.dark *){border-color:#fb2c3666}@supports (color:color-mix(in lab, red, red)){.dark\:border-red-500\/40:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-red-500)40%,transparent)}}.dark\:border-red-500\/50:where(.dark,.dark *){border-color:#fb2c3680}@supports (color:color-mix(in lab, red, red)){.dark\:border-red-500\/50:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-red-500)50%,transparent)}}.dark\:border-yellow-400\/20:where(.dark,.dark *){border-color:#fac80033}@supports (color:color-mix(in lab, red, red)){.dark\:border-yellow-400\/20:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-yellow-400)20%,transparent)}}.dark\:border-yellow-400\/40:where(.dark,.dark *){border-color:#fac80066}@supports (color:color-mix(in lab, red, red)){.dark\:border-yellow-400\/40:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-yellow-400)40%,transparent)}}.dark\:border-yellow-400\/50:where(.dark,.dark *){border-color:#fac80080}@supports (color:color-mix(in lab, red, red)){.dark\:border-yellow-400\/50:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-yellow-400)50%,transparent)}}.dark\:border-yellow-500\/20:where(.dark,.dark *){border-color:#edb20033}@supports (color:color-mix(in lab, red, red)){.dark\:border-yellow-500\/20:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.dark\:border-yellow-500\/30:where(.dark,.dark *){border-color:#edb2004d}@supports (color:color-mix(in lab, red, red)){.dark\:border-yellow-500\/30:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-yellow-500)30%,transparent)}}.dark\:border-yellow-500\/50:where(.dark,.dark *){border-color:#edb20080}@supports (color:color-mix(in lab, red, red)){.dark\:border-yellow-500\/50:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-yellow-500)50%,transparent)}}.dark\:bg-amber-400\/10:where(.dark,.dark *){background-color:#fcbb001a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-amber-400\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-amber-400)10%,transparent)}}.dark\:bg-amber-500\/10:where(.dark,.dark *){background-color:#f99c001a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-amber-500\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-amber-500)10%,transparent)}}.dark\:bg-amber-500\/15:where(.dark,.dark *){background-color:#f99c0026}@supports (color:color-mix(in lab, red, red)){.dark\:bg-amber-500\/15:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-amber-500)15%,transparent)}}.dark\:bg-amber-500\/20:where(.dark,.dark *){background-color:#f99c0033}@supports (color:color-mix(in lab, red, red)){.dark\:bg-amber-500\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.dark\:bg-amber-600\/20:where(.dark,.dark *){background-color:#dd740033}@supports (color:color-mix(in lab, red, red)){.dark\:bg-amber-600\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-amber-600)20%,transparent)}}.dark\:bg-amber-900\/20:where(.dark,.dark *){background-color:#7b330633}@supports (color:color-mix(in lab, red, red)){.dark\:bg-amber-900\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-amber-900)20%,transparent)}}.dark\:bg-amber-900\/30:where(.dark,.dark *){background-color:#7b33064d}@supports (color:color-mix(in lab, red, red)){.dark\:bg-amber-900\/30:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-amber-900)30%,transparent)}}.dark\:bg-bambu-dark:where(.dark,.dark *){background-color:var(--color-bambu-dark)}.dark\:bg-bambu-dark-secondary:where(.dark,.dark *){background-color:var(--color-bambu-dark-secondary)}.dark\:bg-black\/40:where(.dark,.dark *){background-color:#0006}@supports (color:color-mix(in lab, red, red)){.dark\:bg-black\/40:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-black)40%,transparent)}}.dark\:bg-black\/70:where(.dark,.dark *){background-color:#000000b3}@supports (color:color-mix(in lab, red, red)){.dark\:bg-black\/70:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-black)70%,transparent)}}.dark\:bg-blue-400\/10:where(.dark,.dark *){background-color:#54a2ff1a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-blue-400\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-blue-400)10%,transparent)}}.dark\:bg-blue-400\/15:where(.dark,.dark *){background-color:#54a2ff26}@supports (color:color-mix(in lab, red, red)){.dark\:bg-blue-400\/15:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-blue-400)15%,transparent)}}.dark\:bg-blue-400\/20:where(.dark,.dark *){background-color:#54a2ff33}@supports (color:color-mix(in lab, red, red)){.dark\:bg-blue-400\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-blue-400)20%,transparent)}}.dark\:bg-blue-500\/5:where(.dark,.dark *){background-color:#3080ff0d}@supports (color:color-mix(in lab, red, red)){.dark\:bg-blue-500\/5:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-blue-500)5%,transparent)}}.dark\:bg-blue-500\/10:where(.dark,.dark *){background-color:#3080ff1a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-blue-500\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-blue-500)10%,transparent)}}.dark\:bg-blue-500\/15:where(.dark,.dark *){background-color:#3080ff26}@supports (color:color-mix(in lab, red, red)){.dark\:bg-blue-500\/15:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-blue-500)15%,transparent)}}.dark\:bg-blue-500\/20:where(.dark,.dark *){background-color:#3080ff33}@supports (color:color-mix(in lab, red, red)){.dark\:bg-blue-500\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.dark\:bg-blue-600\/20:where(.dark,.dark *){background-color:#155dfc33}@supports (color:color-mix(in lab, red, red)){.dark\:bg-blue-600\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-blue-600)20%,transparent)}}.dark\:bg-blue-900\/20:where(.dark,.dark *){background-color:#1c398e33}@supports (color:color-mix(in lab, red, red)){.dark\:bg-blue-900\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-blue-900)20%,transparent)}}.dark\:bg-cyan-500\/15:where(.dark,.dark *){background-color:#00b7d726}@supports (color:color-mix(in lab, red, red)){.dark\:bg-cyan-500\/15:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-cyan-500)15%,transparent)}}.dark\:bg-cyan-500\/20:where(.dark,.dark *){background-color:#00b7d733}@supports (color:color-mix(in lab, red, red)){.dark\:bg-cyan-500\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-cyan-500)20%,transparent)}}.dark\:bg-cyan-600\/20:where(.dark,.dark *){background-color:#0092b533}@supports (color:color-mix(in lab, red, red)){.dark\:bg-cyan-600\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-cyan-600)20%,transparent)}}.dark\:bg-emerald-500\/10:where(.dark,.dark *){background-color:#00bb7f1a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-emerald-500\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-emerald-500)10%,transparent)}}.dark\:bg-emerald-500\/20:where(.dark,.dark *){background-color:#00bb7f33}@supports (color:color-mix(in lab, red, red)){.dark\:bg-emerald-500\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-emerald-500)20%,transparent)}}.dark\:bg-emerald-600\/20:where(.dark,.dark *){background-color:#00976733}@supports (color:color-mix(in lab, red, red)){.dark\:bg-emerald-600\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-emerald-600)20%,transparent)}}.dark\:bg-fuchsia-500\/20:where(.dark,.dark *){background-color:#e12afb33}@supports (color:color-mix(in lab, red, red)){.dark\:bg-fuchsia-500\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-fuchsia-500)20%,transparent)}}.dark\:bg-gray-700:where(.dark,.dark *){background-color:var(--color-gray-700)}.dark\:bg-gray-800:where(.dark,.dark *){background-color:var(--color-gray-800)}.dark\:bg-gray-800\/30:where(.dark,.dark *){background-color:#1e29394d}@supports (color:color-mix(in lab, red, red)){.dark\:bg-gray-800\/30:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-gray-800)30%,transparent)}}.dark\:bg-gray-800\/40:where(.dark,.dark *){background-color:#1e293966}@supports (color:color-mix(in lab, red, red)){.dark\:bg-gray-800\/40:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-gray-800)40%,transparent)}}.dark\:bg-gray-800\/50:where(.dark,.dark *){background-color:#1e293980}@supports (color:color-mix(in lab, red, red)){.dark\:bg-gray-800\/50:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-gray-800)50%,transparent)}}.dark\:bg-gray-900:where(.dark,.dark *){background-color:var(--color-gray-900)}.dark\:bg-green-400\/10:where(.dark,.dark *){background-color:#05df721a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-green-400\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-green-400)10%,transparent)}}.dark\:bg-green-500\/10:where(.dark,.dark *){background-color:#00c7581a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-green-500\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-green-500)10%,transparent)}}.dark\:bg-green-500\/20:where(.dark,.dark *){background-color:#00c75833}@supports (color:color-mix(in lab, red, red)){.dark\:bg-green-500\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.dark\:bg-green-900\/20:where(.dark,.dark *){background-color:#0d542b33}@supports (color:color-mix(in lab, red, red)){.dark\:bg-green-900\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-green-900)20%,transparent)}}.dark\:bg-indigo-500\/10:where(.dark,.dark *){background-color:#625fff1a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-indigo-500\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-indigo-500)10%,transparent)}}.dark\:bg-indigo-500\/15:where(.dark,.dark *){background-color:#625fff26}@supports (color:color-mix(in lab, red, red)){.dark\:bg-indigo-500\/15:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-indigo-500)15%,transparent)}}.dark\:bg-indigo-500\/20:where(.dark,.dark *){background-color:#625fff33}@supports (color:color-mix(in lab, red, red)){.dark\:bg-indigo-500\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-indigo-500)20%,transparent)}}.dark\:bg-lime-500\/20:where(.dark,.dark *){background-color:#80cd0033}@supports (color:color-mix(in lab, red, red)){.dark\:bg-lime-500\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-lime-500)20%,transparent)}}.dark\:bg-orange-400\/10:where(.dark,.dark *){background-color:#ff8b1a1a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-orange-400\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-orange-400)10%,transparent)}}.dark\:bg-orange-500\/10:where(.dark,.dark *){background-color:#fe6e001a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-orange-500\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-orange-500)10%,transparent)}}.dark\:bg-orange-500\/20:where(.dark,.dark *){background-color:#fe6e0033}@supports (color:color-mix(in lab, red, red)){.dark\:bg-orange-500\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.dark\:bg-orange-600\/20:where(.dark,.dark *){background-color:#f0510033}@supports (color:color-mix(in lab, red, red)){.dark\:bg-orange-600\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-orange-600)20%,transparent)}}.dark\:bg-pink-500\/20:where(.dark,.dark *){background-color:#f6339a33}@supports (color:color-mix(in lab, red, red)){.dark\:bg-pink-500\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-pink-500)20%,transparent)}}.dark\:bg-purple-400\/10:where(.dark,.dark *){background-color:#c07eff1a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-purple-400\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-purple-400)10%,transparent)}}.dark\:bg-purple-500\/10:where(.dark,.dark *){background-color:#ac4bff1a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-purple-500\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-purple-500)10%,transparent)}}.dark\:bg-purple-500\/20:where(.dark,.dark *){background-color:#ac4bff33}@supports (color:color-mix(in lab, red, red)){.dark\:bg-purple-500\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.dark\:bg-red-500\/5:where(.dark,.dark *){background-color:#fb2c360d}@supports (color:color-mix(in lab, red, red)){.dark\:bg-red-500\/5:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-red-500)5%,transparent)}}.dark\:bg-red-500\/10:where(.dark,.dark *){background-color:#fb2c361a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-red-500\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.dark\:bg-red-500\/15:where(.dark,.dark *){background-color:#fb2c3626}@supports (color:color-mix(in lab, red, red)){.dark\:bg-red-500\/15:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-red-500)15%,transparent)}}.dark\:bg-red-500\/20:where(.dark,.dark *){background-color:#fb2c3633}@supports (color:color-mix(in lab, red, red)){.dark\:bg-red-500\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.dark\:bg-red-600\/20:where(.dark,.dark *){background-color:#e4001433}@supports (color:color-mix(in lab, red, red)){.dark\:bg-red-600\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-red-600)20%,transparent)}}.dark\:bg-rose-500\/20:where(.dark,.dark *){background-color:#ff235733}@supports (color:color-mix(in lab, red, red)){.dark\:bg-rose-500\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-rose-500)20%,transparent)}}.dark\:bg-rose-600\/20:where(.dark,.dark *){background-color:#e7004433}@supports (color:color-mix(in lab, red, red)){.dark\:bg-rose-600\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-rose-600)20%,transparent)}}.dark\:bg-sky-500\/10:where(.dark,.dark *){background-color:#00a5ef1a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-sky-500\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-sky-500)10%,transparent)}}.dark\:bg-sky-500\/20:where(.dark,.dark *){background-color:#00a5ef33}@supports (color:color-mix(in lab, red, red)){.dark\:bg-sky-500\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-sky-500)20%,transparent)}}.dark\:bg-slate-500\/10:where(.dark,.dark *){background-color:#62748e1a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-slate-500\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-slate-500)10%,transparent)}}.dark\:bg-teal-500\/20:where(.dark,.dark *){background-color:#00baa733}@supports (color:color-mix(in lab, red, red)){.dark\:bg-teal-500\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-teal-500)20%,transparent)}}.dark\:bg-yellow-400\/10:where(.dark,.dark *){background-color:#fac8001a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-yellow-400\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-yellow-400)10%,transparent)}}.dark\:bg-yellow-400\/20:where(.dark,.dark *){background-color:#fac80033}@supports (color:color-mix(in lab, red, red)){.dark\:bg-yellow-400\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-yellow-400)20%,transparent)}}.dark\:bg-yellow-500\/10:where(.dark,.dark *){background-color:#edb2001a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-yellow-500\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-yellow-500)10%,transparent)}}.dark\:bg-yellow-500\/15:where(.dark,.dark *){background-color:#edb20026}@supports (color:color-mix(in lab, red, red)){.dark\:bg-yellow-500\/15:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-yellow-500)15%,transparent)}}.dark\:bg-yellow-500\/20:where(.dark,.dark *){background-color:#edb20033}@supports (color:color-mix(in lab, red, red)){.dark\:bg-yellow-500\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.dark\:text-amber-100:where(.dark,.dark *){color:var(--color-amber-100)}.dark\:text-amber-200:where(.dark,.dark *){color:var(--color-amber-200)}.dark\:text-amber-200\/60:where(.dark,.dark *){color:#fee68599}@supports (color:color-mix(in lab, red, red)){.dark\:text-amber-200\/60:where(.dark,.dark *){color:color-mix(in oklab,var(--color-amber-200)60%,transparent)}}.dark\:text-amber-200\/80:where(.dark,.dark *){color:#fee685cc}@supports (color:color-mix(in lab, red, red)){.dark\:text-amber-200\/80:where(.dark,.dark *){color:color-mix(in oklab,var(--color-amber-200)80%,transparent)}}.dark\:text-amber-300:where(.dark,.dark *){color:var(--color-amber-300)}.dark\:text-amber-300\/60:where(.dark,.dark *){color:#ffd23699}@supports (color:color-mix(in lab, red, red)){.dark\:text-amber-300\/60:where(.dark,.dark *){color:color-mix(in oklab,var(--color-amber-300)60%,transparent)}}.dark\:text-amber-300\/70:where(.dark,.dark *){color:#ffd236b3}@supports (color:color-mix(in lab, red, red)){.dark\:text-amber-300\/70:where(.dark,.dark *){color:color-mix(in oklab,var(--color-amber-300)70%,transparent)}}.dark\:text-amber-300\/80:where(.dark,.dark *){color:#ffd236cc}@supports (color:color-mix(in lab, red, red)){.dark\:text-amber-300\/80:where(.dark,.dark *){color:color-mix(in oklab,var(--color-amber-300)80%,transparent)}}.dark\:text-amber-400:where(.dark,.dark *){color:var(--color-amber-400)}.dark\:text-amber-400\/70:where(.dark,.dark *){color:#fcbb00b3}@supports (color:color-mix(in lab, red, red)){.dark\:text-amber-400\/70:where(.dark,.dark *){color:color-mix(in oklab,var(--color-amber-400)70%,transparent)}}.dark\:text-amber-400\/80:where(.dark,.dark *){color:#fcbb00cc}@supports (color:color-mix(in lab, red, red)){.dark\:text-amber-400\/80:where(.dark,.dark *){color:color-mix(in oklab,var(--color-amber-400)80%,transparent)}}.dark\:text-bambu-gray:where(.dark,.dark *){color:var(--color-bambu-gray)}.dark\:text-blue-200:where(.dark,.dark *){color:var(--color-blue-200)}.dark\:text-blue-200\/80:where(.dark,.dark *){color:#bedbffcc}@supports (color:color-mix(in lab, red, red)){.dark\:text-blue-200\/80:where(.dark,.dark *){color:color-mix(in oklab,var(--color-blue-200)80%,transparent)}}.dark\:text-blue-300:where(.dark,.dark *){color:var(--color-blue-300)}.dark\:text-blue-300\/70:where(.dark,.dark *){color:#90c5ffb3}@supports (color:color-mix(in lab, red, red)){.dark\:text-blue-300\/70:where(.dark,.dark *){color:color-mix(in oklab,var(--color-blue-300)70%,transparent)}}.dark\:text-blue-300\/80:where(.dark,.dark *){color:#90c5ffcc}@supports (color:color-mix(in lab, red, red)){.dark\:text-blue-300\/80:where(.dark,.dark *){color:color-mix(in oklab,var(--color-blue-300)80%,transparent)}}.dark\:text-blue-400:where(.dark,.dark *){color:var(--color-blue-400)}.dark\:text-blue-400\/50:where(.dark,.dark *){color:#54a2ff80}@supports (color:color-mix(in lab, red, red)){.dark\:text-blue-400\/50:where(.dark,.dark *){color:color-mix(in oklab,var(--color-blue-400)50%,transparent)}}.dark\:text-cyan-300:where(.dark,.dark *){color:var(--color-cyan-300)}.dark\:text-cyan-400:where(.dark,.dark *){color:var(--color-cyan-400)}.dark\:text-emerald-300:where(.dark,.dark *){color:var(--color-emerald-300)}.dark\:text-emerald-400:where(.dark,.dark *){color:var(--color-emerald-400)}.dark\:text-fuchsia-300:where(.dark,.dark *){color:var(--color-fuchsia-300)}.dark\:text-gray-100:where(.dark,.dark *){color:var(--color-gray-100)}.dark\:text-gray-300:where(.dark,.dark *){color:var(--color-gray-300)}.dark\:text-gray-400:where(.dark,.dark *){color:var(--color-gray-400)}.dark\:text-gray-500:where(.dark,.dark *){color:var(--color-gray-500)}.dark\:text-gray-600:where(.dark,.dark *){color:var(--color-gray-600)}.dark\:text-green-200:where(.dark,.dark *){color:var(--color-green-200)}.dark\:text-green-300:where(.dark,.dark *){color:var(--color-green-300)}.dark\:text-green-400:where(.dark,.dark *){color:var(--color-green-400)}.dark\:text-green-400\/70:where(.dark,.dark *){color:#05df72b3}@supports (color:color-mix(in lab, red, red)){.dark\:text-green-400\/70:where(.dark,.dark *){color:color-mix(in oklab,var(--color-green-400)70%,transparent)}}.dark\:text-indigo-300:where(.dark,.dark *){color:var(--color-indigo-300)}.dark\:text-indigo-400:where(.dark,.dark *){color:var(--color-indigo-400)}.dark\:text-lime-400:where(.dark,.dark *){color:var(--color-lime-400)}.dark\:text-orange-100:where(.dark,.dark *){color:var(--color-orange-100)}.dark\:text-orange-200:where(.dark,.dark *){color:var(--color-orange-200)}.dark\:text-orange-200\/70:where(.dark,.dark *){color:#ffd7a8b3}@supports (color:color-mix(in lab, red, red)){.dark\:text-orange-200\/70:where(.dark,.dark *){color:color-mix(in oklab,var(--color-orange-200)70%,transparent)}}.dark\:text-orange-300:where(.dark,.dark *){color:var(--color-orange-300)}.dark\:text-orange-400:where(.dark,.dark *){color:var(--color-orange-400)}.dark\:text-pink-400:where(.dark,.dark *){color:var(--color-pink-400)}.dark\:text-purple-300:where(.dark,.dark *){color:var(--color-purple-300)}.dark\:text-purple-300\/70:where(.dark,.dark *){color:#d9b3ffb3}@supports (color:color-mix(in lab, red, red)){.dark\:text-purple-300\/70:where(.dark,.dark *){color:color-mix(in oklab,var(--color-purple-300)70%,transparent)}}.dark\:text-purple-400:where(.dark,.dark *){color:var(--color-purple-400)}.dark\:text-red-200:where(.dark,.dark *){color:var(--color-red-200)}.dark\:text-red-200\/60:where(.dark,.dark *){color:#ffcaca99}@supports (color:color-mix(in lab, red, red)){.dark\:text-red-200\/60:where(.dark,.dark *){color:color-mix(in oklab,var(--color-red-200)60%,transparent)}}.dark\:text-red-200\/80:where(.dark,.dark *){color:#ffcacacc}@supports (color:color-mix(in lab, red, red)){.dark\:text-red-200\/80:where(.dark,.dark *){color:color-mix(in oklab,var(--color-red-200)80%,transparent)}}.dark\:text-red-300:where(.dark,.dark *){color:var(--color-red-300)}.dark\:text-red-300\/80:where(.dark,.dark *){color:#ffa3a3cc}@supports (color:color-mix(in lab, red, red)){.dark\:text-red-300\/80:where(.dark,.dark *){color:color-mix(in oklab,var(--color-red-300)80%,transparent)}}.dark\:text-red-400:where(.dark,.dark *){color:var(--color-red-400)}.dark\:text-red-400\/50:where(.dark,.dark *){color:#ff656880}@supports (color:color-mix(in lab, red, red)){.dark\:text-red-400\/50:where(.dark,.dark *){color:color-mix(in oklab,var(--color-red-400)50%,transparent)}}.dark\:text-red-400\/70:where(.dark,.dark *){color:#ff6568b3}@supports (color:color-mix(in lab, red, red)){.dark\:text-red-400\/70:where(.dark,.dark *){color:color-mix(in oklab,var(--color-red-400)70%,transparent)}}.dark\:text-rose-300:where(.dark,.dark *){color:var(--color-rose-300)}.dark\:text-rose-400:where(.dark,.dark *){color:var(--color-rose-400)}.dark\:text-sky-400:where(.dark,.dark *){color:var(--color-sky-400)}.dark\:text-slate-300:where(.dark,.dark *){color:var(--color-slate-300)}.dark\:text-slate-400:where(.dark,.dark *){color:var(--color-slate-400)}.dark\:text-slate-400\/80:where(.dark,.dark *){color:#90a1b9cc}@supports (color:color-mix(in lab, red, red)){.dark\:text-slate-400\/80:where(.dark,.dark *){color:color-mix(in oklab,var(--color-slate-400)80%,transparent)}}.dark\:text-teal-400:where(.dark,.dark *){color:var(--color-teal-400)}.dark\:text-white:where(.dark,.dark *){color:var(--color-white)}.dark\:text-yellow-200:where(.dark,.dark *){color:var(--color-yellow-200)}.dark\:text-yellow-200\/70:where(.dark,.dark *){color:#fff085b3}@supports (color:color-mix(in lab, red, red)){.dark\:text-yellow-200\/70:where(.dark,.dark *){color:color-mix(in oklab,var(--color-yellow-200)70%,transparent)}}.dark\:text-yellow-200\/80:where(.dark,.dark *){color:#fff085cc}@supports (color:color-mix(in lab, red, red)){.dark\:text-yellow-200\/80:where(.dark,.dark *){color:color-mix(in oklab,var(--color-yellow-200)80%,transparent)}}.dark\:text-yellow-300:where(.dark,.dark *){color:var(--color-yellow-300)}.dark\:text-yellow-400:where(.dark,.dark *){color:var(--color-yellow-400)}@media (hover:hover){.dark\:hover\:border-gray-500:where(.dark,.dark *):hover{border-color:var(--color-gray-500)}.dark\:hover\:bg-amber-500\/30:where(.dark,.dark *):hover{background-color:#f99c004d}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-amber-500\/30:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.dark\:hover\:bg-bambu-dark-tertiary:where(.dark,.dark *):hover{background-color:var(--color-bambu-dark-tertiary)}.dark\:hover\:bg-blue-500\/30:where(.dark,.dark *):hover{background-color:#3080ff4d}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-blue-500\/30:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-blue-500)30%,transparent)}}.dark\:hover\:bg-cyan-500\/10:where(.dark,.dark *):hover{background-color:#00b7d71a}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-cyan-500\/10:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-cyan-500)10%,transparent)}}.dark\:hover\:bg-gray-600:where(.dark,.dark *):hover{background-color:var(--color-gray-600)}.dark\:hover\:bg-gray-800\/50:where(.dark,.dark *):hover{background-color:#1e293980}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-gray-800\/50:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-gray-800)50%,transparent)}}.dark\:hover\:bg-indigo-500\/30:where(.dark,.dark *):hover{background-color:#625fff4d}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-indigo-500\/30:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-indigo-500)30%,transparent)}}.dark\:hover\:bg-orange-400\/20:where(.dark,.dark *):hover{background-color:#ff8b1a33}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-orange-400\/20:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-orange-400)20%,transparent)}}.dark\:hover\:bg-orange-500\/30:where(.dark,.dark *):hover{background-color:#fe6e004d}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-orange-500\/30:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-orange-500)30%,transparent)}}.dark\:hover\:bg-red-400\/10:where(.dark,.dark *):hover{background-color:#ff65681a}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-red-400\/10:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-red-400)10%,transparent)}}.dark\:hover\:bg-red-500\/10:where(.dark,.dark *):hover{background-color:#fb2c361a}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-red-500\/10:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.dark\:hover\:bg-red-500\/20:where(.dark,.dark *):hover{background-color:#fb2c3633}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-red-500\/20:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.dark\:hover\:bg-red-500\/25:where(.dark,.dark *):hover{background-color:#fb2c3640}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-red-500\/25:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-red-500)25%,transparent)}}.dark\:hover\:bg-red-500\/30:where(.dark,.dark *):hover{background-color:#fb2c364d}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-red-500\/30:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.dark\:hover\:bg-red-500\/40:where(.dark,.dark *):hover{background-color:#fb2c3666}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-red-500\/40:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-red-500)40%,transparent)}}.dark\:hover\:bg-white\/5:where(.dark,.dark *):hover{background-color:#ffffff0d}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-white\/5:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.dark\:hover\:bg-yellow-500\/25:where(.dark,.dark *):hover{background-color:#edb20040}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-yellow-500\/25:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-yellow-500)25%,transparent)}}.dark\:hover\:text-amber-100:where(.dark,.dark *):hover{color:var(--color-amber-100)}.dark\:hover\:text-amber-200:where(.dark,.dark *):hover{color:var(--color-amber-200)}.dark\:hover\:text-amber-300:where(.dark,.dark *):hover{color:var(--color-amber-300)}.dark\:hover\:text-blue-300:where(.dark,.dark *):hover{color:var(--color-blue-300)}.dark\:hover\:text-blue-400:where(.dark,.dark *):hover{color:var(--color-blue-400)}.dark\:hover\:text-cyan-200:where(.dark,.dark *):hover{color:var(--color-cyan-200)}.dark\:hover\:text-gray-200:where(.dark,.dark *):hover{color:var(--color-gray-200)}.dark\:hover\:text-gray-300:where(.dark,.dark *):hover{color:var(--color-gray-300)}.dark\:hover\:text-orange-300:where(.dark,.dark *):hover{color:var(--color-orange-300)}.dark\:hover\:text-orange-400:where(.dark,.dark *):hover{color:var(--color-orange-400)}.dark\:hover\:text-red-300:where(.dark,.dark *):hover{color:var(--color-red-300)}.dark\:hover\:text-red-400:where(.dark,.dark *):hover{color:var(--color-red-400)}.dark\:hover\:text-slate-200:where(.dark,.dark *):hover{color:var(--color-slate-200)}.dark\:hover\:text-white:where(.dark,.dark *):hover{color:var(--color-white)}.dark\:hover\:text-yellow-400:where(.dark,.dark *):hover{color:var(--color-yellow-400)}}@media (hover:hover) and (pointer:fine){.can-hover\:opacity-0{opacity:0}}.\[\&\:\:-webkit-inner-spin-button\]\:appearance-none::-webkit-inner-spin-button{appearance:none}.\[\&\:\:-webkit-outer-spin-button\]\:appearance-none::-webkit-outer-spin-button{appearance:none}.\[\&\:\:-webkit-slider-thumb\]\:h-3::-webkit-slider-thumb{height:calc(var(--spacing)*3)}.\[\&\:\:-webkit-slider-thumb\]\:w-3::-webkit-slider-thumb{width:calc(var(--spacing)*3)}.\[\&\:\:-webkit-slider-thumb\]\:cursor-pointer::-webkit-slider-thumb{cursor:pointer}.\[\&\:\:-webkit-slider-thumb\]\:appearance-none::-webkit-slider-thumb{appearance:none}.\[\&\:\:-webkit-slider-thumb\]\:rounded-full::-webkit-slider-thumb{border-radius:3.40282e38px}.\[\&\:\:-webkit-slider-thumb\]\:bg-bambu-green::-webkit-slider-thumb{background-color:var(--color-bambu-green)}.\[\&\>\*\]\:shrink-0>*{flex-shrink:0}}@font-face{font-family:Inter;font-style:normal;font-weight:100 900;font-display:swap;src:url(/fonts/inter-latin.woff2)format("woff2");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:Inter;font-style:normal;font-weight:100 900;font-display:swap;src:url(/fonts/inter-latin-ext.woff2)format("woff2");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}html{font-size:14.4px}:root{--accent:#00ae42;--accent-light:#00c64d;--accent-dark:#009438;--status-ok:#22c55e;--status-error:#ef4444;--status-warning:#f59e0b;--bg-primary:#f5f5f5;--bg-secondary:#fff;--bg-tertiary:#e5e5e5;--text-primary:#1a1a1a;--text-secondary:#4a4a4a;--text-muted:#6b6b6b;--text-tertiary:gray;--border-color:#d4d4d4;--card-shadow:0 2px 8px #00000014;--glow-color:transparent;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;font-synthesis:none;text-rendering:optimizelegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:Inter,system-ui,sans-serif;font-weight:400;line-height:1.5}.dark{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--bg-primary:#1a1a1a;--bg-secondary:#2d2d2d;--bg-tertiary:#3d3d3d;--text-primary:#fff;--text-secondary:#a0a0a0;--text-muted:gray;--text-tertiary:#4a4a4a;--border-color:#3d3d3d;--card-shadow:0 4px 16px #0006}.bg-warm{--bg-primary:#faf8f5;--bg-secondary:#fffefa;--bg-tertiary:#e8e4dd;--text-primary:#2d2a26;--text-secondary:#5c5750;--text-muted:#7a756c;--text-tertiary:#9a9590;--border-color:#d8d4cc}.bg-cool{--bg-primary:#f0f4f8;--bg-secondary:#fff;--bg-tertiary:#dce4ec;--text-primary:#1a2530;--text-secondary:#4a5568;--text-muted:#6b7a8a;--text-tertiary:#8a9aaa;--border-color:#c8d4e0}.dark.bg-neutral{--bg-primary:#1a1a1a;--bg-secondary:#2d2d2d;--bg-tertiary:#3d3d3d;--text-primary:#fff;--text-secondary:#a0a0a0;--text-muted:gray;--text-tertiary:#4a4a4a;--border-color:#3d3d3d}.dark.bg-warm{--bg-primary:#1c1a18;--bg-secondary:#2e2a26;--bg-tertiary:#3e3a36;--text-primary:#f5f0ea;--text-secondary:#b0a898;--text-muted:#8a8278;--text-tertiary:#5a5248;--border-color:#3e3a36}.dark.bg-cool{--bg-primary:#181c20;--bg-secondary:#262c32;--bg-tertiary:#363e46;--text-primary:#f0f4f8;--text-secondary:#98a8b8;--text-muted:#788898;--text-tertiary:#4a5a6a;--border-color:#363e46}.dark.bg-oled{--bg-primary:#000;--bg-secondary:#141414;--bg-tertiary:#1f1f1f;--text-primary:#fff;--text-secondary:#a0a0a0;--text-muted:#707070;--text-tertiary:#404040;--border-color:#2a2a2a}.dark.bg-slate{--bg-primary:#0f172a;--bg-secondary:#1e293b;--bg-tertiary:#334155;--text-primary:#f1f5f9;--text-secondary:#94a3b8;--text-muted:#64748b;--text-tertiary:#475569;--border-color:#334155}.dark.bg-forest{--bg-primary:#121a16;--bg-secondary:#1c2a22;--bg-tertiary:#2a3d30;--text-primary:#e8f5ec;--text-secondary:#8aa894;--text-muted:#6a8874;--text-tertiary:#4a6854;--border-color:#2a3d30}.printer-control-buttons-container{container-type:inline-size}@container (width<=220px){.printer-control-buttons{flex-direction:column;align-items:stretch}.printer-control-buttons>button{width:100%}}.style-glow{--card-shadow:0 2px 8px #00000014,0 0 25px var(--accent)}@supports (color:color-mix(in lab, red, red)){.style-glow{--card-shadow:0 2px 8px #00000014,0 0 25px color-mix(in srgb,var(--accent)12%,transparent)}}.dark.style-glow{--card-shadow:0 4px 20px #00000080,0 0 40px var(--accent)}@supports (color:color-mix(in lab, red, red)){.dark.style-glow{--card-shadow:0 4px 20px #00000080,0 0 40px color-mix(in srgb,var(--accent)15%,transparent)}}.style-vibrant{--card-shadow:0 8px 30px #00000026,0 2px 8px #0000001a}.dark.style-vibrant{--card-shadow:0 10px 40px #0009,0 4px 12px #0006}.accent-green{--accent:#00ae42;--accent-light:#00c64d;--accent-dark:#009438}.accent-teal{--accent:#14b8a6;--accent-light:#2dd4bf;--accent-dark:#0d9488}.accent-blue{--accent:#3b82f6;--accent-light:#60a5fa;--accent-dark:#2563eb}.accent-orange{--accent:#f97316;--accent-light:#fb923c;--accent-dark:#ea580c}.accent-purple{--accent:#8b5cf6;--accent-light:#a78bfa;--accent-dark:#7c3aed}.accent-red{--accent:#ef4444;--accent-light:#f87171;--accent-dark:#dc2626}body{background-color:var(--bg-primary);color:var(--text-primary);min-height:100vh;margin:0;transition:background-color .2s,color .2s}#root{min-height:100vh}.text-white,.hover\:text-white:hover{color:var(--text-primary)}.bg-bambu-dark,.bg-bambu-dark-secondary,.bg-bambu-dark-tertiary,.border-bambu-dark-tertiary{transition:background-color .2s,border-color .2s}@keyframes slide-in{0%{opacity:0;transform:translate(100%)}to{opacity:1;transform:translate(0)}}.animate-slide-in{animation:.2s ease-out slide-in}.icon-theme{opacity:.5}.dark .icon-theme{filter:invert();opacity:.4}.icon-green{filter:invert(48%)sepia(89%)saturate(459%)hue-rotate(93deg)brightness(95%)contrast(92%);opacity:1}.icon-heating{filter:invert(50%)sepia()saturate(1000%)hue-rotate(360deg)brightness()contrast();opacity:1}.dark .jogpad-theme{filter:brightness(.35)contrast(1.2)}.ams-empty-slot{background:repeating-linear-gradient(45deg,#444,#444 2px,#222 2px 4px)}.dark .ams-empty-slot{background:repeating-linear-gradient(45deg,#555,#555 2px,#333 2px 4px)}.touch-manipulation{touch-action:manipulation}.safe-area-bottom{padding-bottom:env(safe-area-inset-bottom,0)}.safe-area-top{padding-top:env(safe-area-inset-top,0)}.scrollbar-hide{-ms-overflow-style:none;scrollbar-width:none}.scrollbar-hide::-webkit-scrollbar{display:none}@keyframes slide-in-left{0%{transform:translate(-100%)}to{transform:translate(0)}}.animate-slide-in-left{animation:.3s ease-out slide-in-left}@keyframes spoolbuddy-optimized-ping{0%{opacity:.8;transform:scale(.8)}80%,to{opacity:0;transform:scale(2.2)}}.spoolbuddy-optimized-ping{will-change:auto;contain:layout;animation:3.5s cubic-bezier(0,0,.2,1) infinite spoolbuddy-optimized-ping}.spoolbuddy-spool-glow{will-change:auto;transform:scale(2)}@media (prefers-reduced-motion:reduce){.spoolbuddy-optimized-ping{opacity:.25;animation:none;transform:scale(1.2)}.spoolbuddy-spool-glow{transition:none}}@keyframes slide-down{0%{transform:translateY(-100%)}to{transform:translateY(0)}}.animate-slide-down{animation:.25s ease-out slide-down}.card-shadow{box-shadow:var(--card-shadow)}[data-spoolbuddy-kiosk] .fixed .relative.max-w-2xl{flex-direction:column;height:90vh;max-height:90vh;display:flex}[data-spoolbuddy-kiosk] .fixed .relative.max-w-2xl>div:first-child,[data-spoolbuddy-kiosk] .fixed .relative.max-w-2xl>div:last-child{flex-shrink:0}[data-spoolbuddy-kiosk] .fixed .relative.max-w-2xl>div:nth-child(2){flex:auto;min-height:0;overflow-y:auto}[data-spoolbuddy-kiosk] .fixed .relative.max-w-2xl .max-h-96{max-height:none}.calendar-scroll{scrollbar-width:thin;scrollbar-color:var(--text-muted)transparent}@supports (color:color-mix(in lab, red, red)){.calendar-scroll{scrollbar-color:color-mix(in srgb,var(--text-muted)60%,transparent)transparent}}.calendar-scroll::-webkit-scrollbar{width:8px}.calendar-scroll::-webkit-scrollbar-track{background:0 0}.calendar-scroll::-webkit-scrollbar-thumb{background-color:var(--text-muted)}@supports (color:color-mix(in lab, red, red)){.calendar-scroll::-webkit-scrollbar-thumb{background-color:color-mix(in srgb,var(--text-muted)60%,transparent)}}.calendar-scroll::-webkit-scrollbar-thumb{border:2px solid var(--bg-secondary);border-radius:999px}@supports (color:color-mix(in lab, red, red)){.calendar-scroll::-webkit-scrollbar-thumb{border:2px solid color-mix(in srgb,var(--bg-secondary)70%,transparent)}}.calendar-scroll::-webkit-scrollbar-thumb:hover{background-color:var(--text-muted)}@supports (color:color-mix(in lab, red, red)){.calendar-scroll::-webkit-scrollbar-thumb:hover{background-color:color-mix(in srgb,var(--text-muted)80%,transparent)}}@media (hover:hover) and (pointer:fine){.history-thumb-hover:hover .history-thumb-preview{opacity:1}}.slice-colour-swatch{appearance:none;overflow:hidden}.slice-colour-swatch::-webkit-color-swatch-wrapper{padding:0}.slice-colour-swatch::-webkit-color-swatch{border:none;border-radius:999px}.slice-colour-swatch::-moz-color-swatch{border:none;border-radius:999px}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}@keyframes spin{to{transform:rotate(360deg)}}@keyframes ping{75%,to{opacity:0;transform:scale(2)}}@keyframes pulse{50%{opacity:.5}}.updated-overlay{--overlay-scale:1;--overlay-space:clamp(12px, 2.5vmin, 32px);isolation:isolate;color:#fff;min-height:100vh;font-size:calc(clamp(14px, 2.2vmin, 28px) * var(--overlay-scale));font-variant-numeric:tabular-nums;background:#10171b;flex-direction:column;justify-content:space-between;line-height:1.3;display:flex;position:relative}.updated-overlay[data-size=small]{--overlay-scale:.8}.updated-overlay[data-size=large]{--overlay-scale:1.2}.updated-overlay__header{justify-content:space-between;align-items:flex-start;gap:var(--overlay-space);padding:var(--overlay-space);z-index:1;display:flex}.updated-overlay__identity{background:#0c1317e6;border-radius:.7em;align-items:center;gap:.7em;min-width:0;padding:.65em .9em;display:flex}.updated-overlay__identity svg{flex-shrink:0;width:2em;height:2em}.updated-overlay__identity div{overflow-wrap:anywhere;min-width:0}.updated-overlay__identity strong{font-size:1.35em;display:block}.updated-overlay__identity span{color:#b8c0c7;display:block}.updated-overlay__logo{flex-shrink:0;margin-left:auto}.updated-overlay__logo img{width:clamp(100px,19vmin,230px);height:auto}.updated-overlay__camera{z-index:-1;position:absolute;inset:0;overflow:hidden}.updated-overlay__camera img{object-fit:cover;width:100%;max-width:none;height:100%;position:absolute;top:50%;left:50%}.updated-overlay__panel{padding:var(--overlay-space);background:#0c1317e0}.updated-overlay__summary{justify-content:space-between;align-items:center;gap:1em;margin-bottom:.8em;display:flex}.updated-overlay__summary h1{overflow-wrap:anywhere;min-width:0;font-size:1.65em;font-weight:700;line-height:1.2}.updated-overlay__status{color:#b8c0c7;align-items:center;gap:.5em;font-size:1.15em;font-weight:600;display:flex}.updated-overlay__status>span{background:currentColor;border-radius:50%;flex-shrink:0;width:.75em;height:.75em}.updated-overlay[data-state=RUNNING] .updated-overlay__status,.updated-overlay[data-state=FINISH] .updated-overlay__status{color:#00d76a}.updated-overlay[data-state=PAUSE] .updated-overlay__status{color:#fbbf24}.updated-overlay[data-state=FAILED] .updated-overlay__status{color:#f87171}.updated-overlay__progress{align-items:center;gap:1em;display:flex}.updated-overlay__progress>span{color:#b8c0c7;text-transform:uppercase;font-size:.8em}.updated-overlay__progress>strong{color:#00d76a;font-size:1.4em}.updated-overlay__progress>div{background:#3c454c;border-radius:1em;flex:1;height:.65em;overflow:hidden}.updated-overlay__progress>div>div{border-radius:inherit;background:#00d76a;height:100%;transition:width .5s}.updated-overlay__readings{border-top:1px solid #ffffff35;flex-wrap:wrap;gap:1em;margin-top:.8em;padding-top:.8em;display:flex}.updated-overlay__stats,.updated-overlay__temperatures{flex-wrap:wrap;flex:auto;gap:1em;display:flex}.updated-overlay__reading{flex:auto;align-items:center;gap:.6em;min-width:0;display:flex}.updated-overlay__reading svg{flex-shrink:0;width:1.8em;height:1.8em}.updated-overlay__reading>div>span{color:#b8c0c7;text-transform:uppercase;font-size:.7em;display:block}.updated-overlay__reading strong{overflow-wrap:anywhere;font-size:1.3em;display:block}.updated-overlay__reading small{color:#b8c0c7;font-size:.65em}@media (orientation:portrait){.updated-overlay{font-size:calc(clamp(14px, 3vmin, 36px) * var(--overlay-scale));grid-template-rows:auto 1fr auto;grid-template-columns:minmax(0,1fr);min-height:100vh;display:grid}.updated-overlay__header{background:#10171b;grid-row:1;align-items:center}.updated-overlay__identity{background:0 0;padding:0}.updated-overlay__camera{z-index:0;grid-row:2;min-height:30vh;position:relative}.updated-overlay__panel{background:#10171b;grid-row:3}.updated-overlay__summary{flex-direction:column-reverse;align-items:stretch;gap:.65em}.updated-overlay__progress{flex-wrap:wrap;justify-content:space-between;gap:.3em}.updated-overlay__progress>div{flex:0 0 100%;order:1}.updated-overlay__readings{flex-direction:column}.updated-overlay__temperatures:not(:first-child){border-top:1px solid #ffffff35;padding-top:.8em}}@media (prefers-reduced-motion:reduce){.updated-overlay__progress>div>div{transition:none}}.hg-theme-default{box-sizing:border-box;touch-action:manipulation;-webkit-user-select:none;user-select:none;background-color:#ececec;border-radius:5px;width:100%;padding:5px;font-family:HelveticaNeue-Light,Helvetica Neue Light,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;overflow:hidden}.hg-theme-default .hg-button span,.hg-theme-default .hg-button span svg{pointer-events:none}.hg-theme-default button.hg-button{font-size:inherit;border-width:0}.hg-theme-default .hg-button{flex-grow:1;display:inline-block}.hg-theme-default .hg-row{display:flex}.hg-theme-default .hg-row:not(:last-child){margin-bottom:5px}.hg-theme-default .hg-row .hg-button-container,.hg-theme-default .hg-row .hg-button:not(:last-child){margin-right:5px}.hg-theme-default .hg-row>div:last-child{margin-right:0}.hg-theme-default .hg-row .hg-button-container{display:flex}.hg-theme-default .hg-button{box-sizing:border-box;cursor:pointer;-webkit-tap-highlight-color:#0000;background:#fff;border-bottom:1px solid #b5b5b5;border-radius:5px;justify-content:center;align-items:center;height:40px;padding:5px;display:flex;box-shadow:0 0 3px -1px #0000004d}.hg-theme-default .hg-button.hg-standardBtn{width:20px}.hg-theme-default .hg-button.hg-activeButton{background:#efefef}.hg-theme-default.hg-layout-numeric .hg-button{justify-content:center;align-items:center;width:33.3%;height:60px;display:flex}.hg-theme-default .hg-button.hg-button-numpadadd,.hg-theme-default .hg-button.hg-button-numpadenter{height:85px}.hg-theme-default .hg-button.hg-button-numpad0{width:105px}.hg-theme-default .hg-button.hg-button-com{max-width:85px}.hg-theme-default .hg-button.hg-standardBtn.hg-button-at{max-width:45px}.hg-theme-default .hg-button.hg-selectedButton{color:#fff;background:#05194687}.hg-theme-default .hg-button.hg-standardBtn[data-skbtn=\.com]{max-width:82px}.hg-theme-default .hg-button.hg-standardBtn[data-skbtn=\@]{max-width:60px}.hg-candidate-box{-webkit-user-select:none;user-select:none;background:#ececec;border-bottom:2px solid #b5b5b5;border-radius:5px;margin-top:-10px;display:inline-flex;position:absolute;transform:translateY(-100%)}ul.hg-candidate-box-list{flex:1;margin:0;padding:0;list-style:none;display:flex}li.hg-candidate-box-list-item{justify-content:center;align-items:center;width:40px;height:40px;display:flex}li.hg-candidate-box-list-item:hover{cursor:pointer;background:#00000008}li.hg-candidate-box-list-item:active{background:#0000001a}.hg-candidate-box-prev:before{content:"◄"}.hg-candidate-box-next:before{content:"►"}.hg-candidate-box-next,.hg-candidate-box-prev{color:#969696;cursor:pointer;align-items:center;padding:0 10px;display:flex}.hg-candidate-box-next{border-top-right-radius:5px;border-bottom-right-radius:5px}.hg-candidate-box-prev{border-top-left-radius:5px;border-bottom-left-radius:5px}.hg-candidate-box-btn-active{color:#444}.simple-keyboard.vkb-theme{background:#1a1a1a;border-top:1px solid #333;padding:8px 4px;font-family:inherit}.simple-keyboard.vkb-theme .hg-row{gap:4px;margin-bottom:4px;flex-flow:row!important;display:flex!important}.simple-keyboard.vkb-theme .hg-row:last-child{margin-bottom:0}.simple-keyboard.vkb-theme .hg-button{color:#e0e0e0;cursor:pointer;background:#2d2d2d;border:none;border-radius:6px;flex:auto;justify-content:center;align-items:center;min-width:0;height:44px;padding:0 2px;font-size:16px;font-weight:500;transition:background .1s;box-shadow:0 1px 2px #0000004d;display:inline-flex!important}.simple-keyboard.vkb-theme .hg-button:active{color:#fff;background:#00ae42}.simple-keyboard.vkb-theme .hg-button-bksp,.simple-keyboard.vkb-theme .hg-button-shift,.simple-keyboard.vkb-theme .hg-button-lock{color:#aaa;background:#3a3a3a;flex-grow:1.5}.simple-keyboard.vkb-theme .hg-button-close{color:#aaa;background:#3a3a3a;flex-grow:2;font-weight:600}.simple-keyboard.vkb-theme .hg-button-close:active{background:#555}.simple-keyboard.vkb-theme .hg-button-space{flex-grow:7}.simple-keyboard.vkb-theme .hg-activeButton{color:#fff;background:#00ae42} diff --git a/static/assets/pdf-C9LrqMbI.js b/static/assets/pdf-Dh_3UNyL.js similarity index 99% rename from static/assets/pdf-C9LrqMbI.js rename to static/assets/pdf-Dh_3UNyL.js index 65d510be1..d4b824478 100644 --- a/static/assets/pdf-C9LrqMbI.js +++ b/static/assets/pdf-Dh_3UNyL.js @@ -1,4 +1,4 @@ -import{_ as e}from"./index-DC8Fhl-1.js";var t={9306(e,t,n){var r=n(4901),i=n(6823),a=TypeError;e.exports=function(e){if(r(e))return e;throw new a(i(e)+` is not a function`)}},3506(e,t,n){var r=n(3925),i=String,a=TypeError;e.exports=function(e){if(r(e))return e;throw new a(`Can't set `+i(e)+` as a prototype`)}},7080(e,t,n){var r=n(4402).has;e.exports=function(e){return r(e),e}},3463(e){var t=TypeError;e.exports=function(e){if(typeof e==`string`)return e;throw new t(`Argument is not a string`)}},4328(e,t,n){var r=n(4995),i=new r.WeakMap,a=r.set,o=r.remove;e.exports=function(e){return a(i,e,1),o(i,e),e}},6557(e,t,n){var r=n(4995).has;e.exports=function(e){return r(e),e}},6469(e,t,n){var r=n(8227),i=n(2360),a=n(4913).f,o=r(`unscopables`),s=Array.prototype;s[o]===void 0&&a(s,o,{configurable:!0,value:i(null)}),e.exports=function(e){s[o][e]=!0}},679(e,t,n){var r=n(1625),i=TypeError;e.exports=function(e,t){if(r(t,e))return e;throw new i(`Incorrect invocation`)}},3972(e,t,n){var r=n(34),i=String,a=TypeError;e.exports=function(e){if(e===void 0||r(e))return e;throw new a(i(e)+` is not an object or undefined`)}},8551(e,t,n){var r=n(34),i=String,a=TypeError;e.exports=function(e){if(r(e))return e;throw new a(i(e)+` is not an object`)}},4154(e,t,n){var r=n(6955),i=TypeError;e.exports=function(e){if(r(e)===`Uint8Array`)return e;throw new i(`Argument is not an Uint8Array`)}},7811(e){e.exports=typeof ArrayBuffer<`u`&&typeof DataView<`u`},7394(e,t,n){var r=n(4576),i=n(6706),a=n(2195),o=r.ArrayBuffer,s=r.TypeError;e.exports=o&&i(o.prototype,`byteLength`,`get`)||function(e){if(a(e)!==`ArrayBuffer`)throw new s(`ArrayBuffer expected`);return e.byteLength}},3238(e,t,n){var r=n(4576),i=n(7811),a=n(7394),o=r.DataView;e.exports=function(e){if(!i||a(e)!==0)return!1;try{return new o(e),!1}catch{return!0}}},5169(e,t,n){var r=n(3238),i=TypeError;e.exports=function(e){if(r(e))throw new i(`ArrayBuffer is detached`);return e}},4644(e,t,n){var r=n(7811),i=n(3724),a=n(4576),o=n(4901),s=n(34),c=n(9297),l=n(6955),u=n(6823),d=n(6699),f=n(6840),p=n(2106),m=n(1625),h=n(2787),g=n(2967),_=n(8227),v=n(3392),y=n(1181),b=y.enforce,x=y.get,S=a.Int8Array,C=S&&S.prototype,w=a.Uint8ClampedArray,T=w&&w.prototype,E=S&&h(S),D=C&&h(C),O=Object.prototype,k=a.TypeError,A=_(`toStringTag`),j=v(`TYPED_ARRAY_TAG`),M=`TypedArrayConstructor`,N=r&&!!g&&l(a.opera)!==`Opera`,P=!1,F,I,L,R={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},ee={BigInt64Array:8,BigUint64Array:8},te=function(e){if(!s(e))return!1;var t=l(e);return t===`DataView`||c(R,t)||c(ee,t)},ne=function(e){var t=h(e);if(s(t)){var n=x(t);return n&&c(n,M)?n[M]:ne(t)}},re=function(e){if(!s(e))return!1;var t=l(e);return c(R,t)||c(ee,t)},ie=function(e){if(re(e))return e;throw new k(`Target is not a typed array`)},ae=function(e){if(o(e)&&(!g||m(E,e)))return e;throw new k(u(e)+` is not a typed array constructor`)},z=function(e,t,n,r){if(i){if(n)for(var o in R){var s=a[o];if(s&&c(s.prototype,e))try{delete s.prototype[e]}catch{try{s.prototype[e]=t}catch{}}}(!D[e]||n)&&f(D,e,n?t:N&&C[e]||t,r)}},B=function(e,t,n){var r,o;if(i){if(g){if(n){for(r in R)if(o=a[r],o&&c(o,e))try{delete o[e]}catch{}}if(!E[e]||n)try{return f(E,e,n?t:N&&E[e]||t)}catch{}else return}for(r in R)o=a[r],o&&(!o[e]||n)&&f(o,e,t)}};for(F in R)I=a[F],L=I&&I.prototype,L?b(L)[M]=I:N=!1;for(F in ee)I=a[F],L=I&&I.prototype,L&&(b(L)[M]=I);if((!N||!o(E)||E===Function.prototype)&&(E=function(){throw new k(`Incorrect invocation`)},N))for(F in R)a[F]&&g(a[F],E);if((!N||!D||D===O)&&(D=E.prototype,N))for(F in R)a[F]&&g(a[F].prototype,D);if(N&&h(T)!==D&&g(T,D),i&&!c(D,A))for(F in P=!0,p(D,A,{configurable:!0,get:function(){return s(this)?this[j]:void 0}}),R)a[F]&&d(a[F].prototype,j,F);e.exports={NATIVE_ARRAY_BUFFER_VIEWS:N,TYPED_ARRAY_TAG:P&&j,aTypedArray:ie,aTypedArrayConstructor:ae,exportTypedArrayMethod:z,exportTypedArrayStaticMethod:B,getTypedArrayConstructor:ne,isView:te,isTypedArray:re,TypedArray:E,TypedArrayPrototype:D}},5370(e,t,n){var r=n(6198);e.exports=function(e,t,n){for(var i=0,a=arguments.length>2?n:r(t),o=new e(a);a>i;)o[i]=t[i++];return o}},9617(e,t,n){var r=n(5397),i=n(5610),a=n(6198),o=function(e){return function(t,n,o){var s=r(t),c=a(s);if(c===0)return!e&&-1;var l=i(o,c),u;if(e&&n!==n){for(;c>l;)if(u=s[l++],u!==u)return!0}else for(;c>l;l++)if((e||l in s)&&s[l]===n)return e||l||0;return!e&&-1}};e.exports={includes:o(!0),indexOf:o(!1)}},4527(e,t,n){var r=n(3724),i=n(4376),a=TypeError,o=Object.getOwnPropertyDescriptor;e.exports=r&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(e){return e instanceof TypeError}}()?function(e,t){if(i(e)&&!o(e,`length`).writable)throw new a(`Cannot set read only .length`);return e.length=t}:function(e,t){return e.length=t}},7680(e,t,n){e.exports=n(9504)([].slice)},2804(e){var t=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`,n=t+`+/`,r=t+`-_`,i=function(e){for(var t={},n=0;n<64;n++)t[e.charAt(n)]=n;return t};e.exports={i2c:n,c2i:i(n),i2cUrl:r,c2iUrl:i(r)}},6319(e,t,n){var r=n(8551),i=n(9539);e.exports=function(e,t,n,a){try{return a?t(r(n)[0],n[1]):t(n)}catch(t){i(e,`throw`,t)}}},2195(e,t,n){var r=n(9504),i=r({}.toString),a=r(``.slice);e.exports=function(e){return a(i(e),8,-1)}},6955(e,t,n){var r=n(2140),i=n(4901),a=n(2195),o=n(8227)(`toStringTag`),s=Object,c=a(function(){return arguments}())===`Arguments`,l=function(e,t){try{return e[t]}catch{}};e.exports=r?a:function(e){var t,n,r;return e===void 0?`Undefined`:e===null?`Null`:typeof(n=l(t=s(e),o))==`string`?n:c?a(t):(r=a(t))===`Object`&&i(t.callee)?`Arguments`:r}},7740(e,t,n){var r=n(9297),i=n(5031),a=n(7347),o=n(4913);e.exports=function(e,t,n){for(var s=i(t),c=o.f,l=a.f,u=0;un)throw new t(`Maximum allowed index exceeded`);return e}},5002(e){e.exports={IndexSizeError:{s:`INDEX_SIZE_ERR`,c:1,m:1},DOMStringSizeError:{s:`DOMSTRING_SIZE_ERR`,c:2,m:0},HierarchyRequestError:{s:`HIERARCHY_REQUEST_ERR`,c:3,m:1},WrongDocumentError:{s:`WRONG_DOCUMENT_ERR`,c:4,m:1},InvalidCharacterError:{s:`INVALID_CHARACTER_ERR`,c:5,m:1},NoDataAllowedError:{s:`NO_DATA_ALLOWED_ERR`,c:6,m:0},NoModificationAllowedError:{s:`NO_MODIFICATION_ALLOWED_ERR`,c:7,m:1},NotFoundError:{s:`NOT_FOUND_ERR`,c:8,m:1},NotSupportedError:{s:`NOT_SUPPORTED_ERR`,c:9,m:1},InUseAttributeError:{s:`INUSE_ATTRIBUTE_ERR`,c:10,m:1},InvalidStateError:{s:`INVALID_STATE_ERR`,c:11,m:1},SyntaxError:{s:`SYNTAX_ERR`,c:12,m:1},InvalidModificationError:{s:`INVALID_MODIFICATION_ERR`,c:13,m:1},NamespaceError:{s:`NAMESPACE_ERR`,c:14,m:1},InvalidAccessError:{s:`INVALID_ACCESS_ERR`,c:15,m:1},ValidationError:{s:`VALIDATION_ERR`,c:16,m:0},TypeMismatchError:{s:`TYPE_MISMATCH_ERR`,c:17,m:1},SecurityError:{s:`SECURITY_ERR`,c:18,m:1},NetworkError:{s:`NETWORK_ERR`,c:19,m:1},AbortError:{s:`ABORT_ERR`,c:20,m:1},URLMismatchError:{s:`URL_MISMATCH_ERR`,c:21,m:1},QuotaExceededError:{s:`QUOTA_EXCEEDED_ERR`,c:22,m:1},TimeoutError:{s:`TIMEOUT_ERR`,c:23,m:1},InvalidNodeTypeError:{s:`INVALID_NODE_TYPE_ERR`,c:24,m:1},DataCloneError:{s:`DATA_CLONE_ERR`,c:25,m:1}}},8727(e){e.exports=[`constructor`,`hasOwnProperty`,`isPrototypeOf`,`propertyIsEnumerable`,`toLocaleString`,`toString`,`valueOf`]},2839(e,t,n){var r=n(4576).navigator,i=r&&r.userAgent;e.exports=i?String(i):``},9519(e,t,n){var r=n(4576),i=n(2839),a=r.process,o=r.Deno,s=a&&a.versions||o&&o.version,c=s&&s.v8,l,u;c&&(l=c.split(`.`),u=l[0]>0&&l[0]<4?1:+(l[0]+l[1])),!u&&i&&(l=i.match(/Edge\/(\d+)/),(!l||l[1]>=74)&&(l=i.match(/Chrome\/(\d+)/),l&&(u=+l[1]))),e.exports=u},6193(e,t,n){var r=n(9504),i=Error,a=r(``.replace),o=(function(e){return String(new i(e).stack)})(`zxcasd`),s=/\n\s*at [^:]*:[^\n]*/,c=s.test(o);e.exports=function(e,t){if(c&&typeof e==`string`&&!i.prepareStackTrace)for(;t--;)e=a(e,s,``);return e}},6518(e,t,n){var r=n(4576),i=n(7347).f,a=n(6699),o=n(6840),s=n(9433),c=n(7740),l=n(2796);e.exports=function(e,t){var n=e.target,u=e.global,d=e.stat,f,p=u?r:d?r[n]||s(n,{}):r[n]&&r[n].prototype,m,h,g,_;if(p)for(m in t){if(g=t[m],e.dontCallGetSet?(_=i(p,m),h=_&&_.value):h=p[m],f=l(u?m:n+(d?`.`:`#`)+m,e.forced),!f&&h!==void 0){if(typeof g==typeof h)continue;c(g,h)}(e.sham||h&&h.sham)&&a(g,`sham`,!0),o(p,m,g,e)}}},9039(e){e.exports=function(e){try{return!!e()}catch{return!0}}},8745(e,t,n){var r=n(616),i=Function.prototype,a=i.apply,o=i.call;e.exports=typeof Reflect==`object`&&Reflect.apply||(r?o.bind(a):function(){return o.apply(a,arguments)})},6080(e,t,n){var r=n(7476),i=n(9306),a=n(616),o=r(r.bind);e.exports=function(e,t){return i(e),t===void 0?e:a?o(e,t):function(){return e.apply(t,arguments)}}},616(e,t,n){e.exports=!n(9039)(function(){var e=function(){}.bind();return typeof e!=`function`||e.hasOwnProperty(`prototype`)})},9565(e,t,n){var r=n(616),i=Function.prototype.call;e.exports=r?i.bind(i):function(){return i.apply(i,arguments)}},350(e,t,n){var r=n(3724),i=n(9297),a=Function.prototype,o=r&&Object.getOwnPropertyDescriptor,s=i(a,`name`);e.exports={EXISTS:s,PROPER:s&&function(){}.name===`something`,CONFIGURABLE:s&&(!r||r&&o(a,`name`).configurable)}},6706(e,t,n){var r=n(9504),i=n(9306);e.exports=function(e,t,n){try{return r(i(Object.getOwnPropertyDescriptor(e,t)[n]))}catch{}}},7476(e,t,n){var r=n(2195),i=n(9504);e.exports=function(e){if(r(e)===`Function`)return i(e)}},9504(e,t,n){var r=n(616),i=Function.prototype,a=i.call,o=r&&i.bind.bind(a,a);e.exports=r?o:function(e){return function(){return a.apply(e,arguments)}}},944(e){var t=TypeError;e.exports=function(e){var n=e&&e.alphabet;if(n===void 0||n===`base64`||n===`base64url`)return n||`base64`;throw new t("Incorrect `alphabet` option")}},7751(e,t,n){var r=n(4576),i=n(4901),a=function(e){return i(e)?e:void 0};e.exports=function(e,t){return arguments.length<2?a(r[e]):r[e]&&r[e][t]}},1767(e){e.exports=function(e){return{iterator:e,next:e.next,done:!1}}},8646(e,t,n){var r=n(9565),i=n(8551),a=n(1767),o=n(851);e.exports=function(e,t){(!t||typeof e!=`string`)&&i(e);var n=o(e);return a(i(n===void 0?e:r(n,e)))}},851(e,t,n){var r=n(6955),i=n(5966),a=n(4117),o=n(6269),s=n(8227)(`iterator`);e.exports=function(e){if(!a(e))return i(e,s)||i(e,`@@iterator`)||o[r(e)]}},81(e,t,n){var r=n(9565),i=n(9306),a=n(8551),o=n(6823),s=n(851),c=TypeError;e.exports=function(e,t){var n=arguments.length<2?s(e):t;if(i(n))return a(r(n,e));throw new c(o(e)+` is not iterable`)}},5966(e,t,n){var r=n(9306),i=n(4117);e.exports=function(e,t){var n=e[t];return i(n)?void 0:r(n)}},3789(e,t,n){var r=n(9306),i=n(8551),a=n(9565),o=n(1291),s=n(1767),c=`Invalid size`,l=RangeError,u=TypeError,d=Math.max,f=function(e,t){this.set=e,this.size=d(t,0),this.has=r(e.has),this.keys=r(e.keys)};f.prototype={getIterator:function(){return s(i(a(this.keys,this.set)))},includes:function(e){return a(this.has,this.set,e)}},e.exports=function(e){i(e);var t=+e.size;if(t!==t)throw new u(c);var n=o(t);if(n<0)throw new l(c);return new f(e,n)}},4576(e){var t=function(e){return e&&e.Math===Math&&e};e.exports=t(typeof globalThis==`object`&&globalThis)||t(typeof window==`object`&&window)||t(typeof self==`object`&&self)||t(typeof global==`object`&&global)||t(typeof this==`object`&&this)||(function(){return this})()||Function(`return this`)()},9297(e,t,n){var r=n(9504),i=n(8981),a=r({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return a(i(e),t)}},421(e){e.exports={}},397(e,t,n){e.exports=n(7751)(`document`,`documentElement`)},5917(e,t,n){var r=n(3724),i=n(9039),a=n(4055);e.exports=!r&&!i(function(){return Object.defineProperty(a(`div`),"a",{get:function(){return 7}}).a!==7})},7055(e,t,n){var r=n(9504),i=n(9039),a=n(2195),o=Object,s=r(``.split);e.exports=i(function(){return!o(`z`).propertyIsEnumerable(0)})?function(e){return a(e)===`String`?s(e,``):o(e)}:o},3167(e,t,n){var r=n(4901),i=n(34),a=n(2967);e.exports=function(e,t,n){var o,s;return a&&r(o=t.constructor)&&o!==n&&i(s=o.prototype)&&s!==n.prototype&&a(e,s),e}},3706(e,t,n){var r=n(9504),i=n(4901),a=n(7629),o=r(Function.toString);i(a.inspectSource)||(a.inspectSource=function(e){return o(e)}),e.exports=a.inspectSource},1181(e,t,n){var r=n(8622),i=n(4576),a=n(34),o=n(6699),s=n(9297),c=n(7629),l=n(6119),u=n(421),d=`Object already initialized`,f=i.TypeError,p=i.WeakMap,m,h,g,_=function(e){return g(e)?h(e):m(e,{})},v=function(e){return function(t){var n;if(!a(t)||(n=h(t)).type!==e)throw new f(`Incompatible receiver, `+e+` required`);return n}};if(r||c.state){var y=c.state||=new p;y.get=y.get,y.has=y.has,y.set=y.set,m=function(e,t){if(y.has(e))throw new f(d);return t.facade=e,y.set(e,t),t},h=function(e){return y.get(e)||{}},g=function(e){return y.has(e)}}else{var b=l(`state`);u[b]=!0,m=function(e,t){if(s(e,b))throw new f(d);return t.facade=e,o(e,b,t),t},h=function(e){return s(e,b)?e[b]:{}},g=function(e){return s(e,b)}}e.exports={set:m,get:h,has:g,enforce:_,getterFor:v}},4209(e,t,n){var r=n(8227),i=n(6269),a=r(`iterator`),o=Array.prototype;e.exports=function(e){return e!==void 0&&(i.Array===e||o[a]===e)}},4376(e,t,n){var r=n(2195);e.exports=Array.isArray||function(e){return r(e)===`Array`}},1108(e,t,n){var r=n(6955);e.exports=function(e){var t=r(e);return t===`BigInt64Array`||t===`BigUint64Array`}},4901(e){var t=typeof document==`object`&&document.all;e.exports=t===void 0&&t!==void 0?function(e){return typeof e==`function`||e===t}:function(e){return typeof e==`function`}},2796(e,t,n){var r=n(9039),i=n(4901),a=/#|\.prototype\./,o=function(e,t){var n=c[s(e)];return n===u?!0:n===l?!1:i(t)?r(t):!!t},s=o.normalize=function(e){return String(e).replace(a,`.`).toLowerCase()},c=o.data={},l=o.NATIVE=`N`,u=o.POLYFILL=`P`;e.exports=o},4117(e){e.exports=function(e){return e==null}},34(e,t,n){var r=n(4901);e.exports=function(e){return typeof e==`object`?e!==null:r(e)}},3925(e,t,n){var r=n(34);e.exports=function(e){return r(e)||e===null}},6395(e){e.exports=!1},5810(e,t,n){var r=n(34),i=n(1181).get;e.exports=function(e){if(!r(e))return!1;var t=i(e);return!!t&&t.type===`RawJSON`}},757(e,t,n){var r=n(7751),i=n(4901),a=n(1625),o=n(7040),s=Object;e.exports=o?function(e){return typeof e==`symbol`}:function(e){var t=r(`Symbol`);return i(t)&&a(t.prototype,s(e))}},507(e,t,n){var r=n(9565);e.exports=function(e,t,n){for(var i=n?e:e.iterator,a=e.next,o,s;!(o=r(a,i)).done;)if(s=t(o.value),s!==void 0)return s}},2652(e,t,n){var r=n(6080),i=n(9565),a=n(8551),o=n(6823),s=n(4209),c=n(6198),l=n(1625),u=n(81),d=n(851),f=n(9539),p=TypeError,m=function(e,t){this.stopped=e,this.result=t},h=m.prototype;e.exports=function(e,t,n){var g=n&&n.that,_=!!(n&&n.AS_ENTRIES),v=!!(n&&n.IS_RECORD),y=!!(n&&n.IS_ITERATOR),b=!!(n&&n.INTERRUPTED),x=r(t,g),S,C,w,T,E,D,O,k=function(e){var t=S;return S=void 0,t&&f(t,`normal`),new m(!0,e)},A=function(e){return _?(a(e),b?x(e[0],e[1],k):x(e[0],e[1])):b?x(e,k):x(e)};if(v)S=e.iterator;else if(y)S=e;else{if(C=d(e),!C)throw new p(o(e)+` is not iterable`);if(s(C)){for(w=0,T=c(e);T>w;w++)if(E=A(e[w]),E&&l(h,E))return E;return new m(!1)}S=u(e,C)}for(D=v?e.next:S.next;!(O=i(D,S)).done;){var j=O.value;try{E=A(j)}catch(e){if(S)f(S,`throw`,e);else throw e}if(typeof E==`object`&&E&&l(h,E))return E}return new m(!1)}},1385(e,t,n){var r=n(9539);e.exports=function(e,t,n){for(var i=e.length-1;i>=0;i--)if(e[i]!==void 0)try{n=r(e[i].iterator,t,n)}catch(e){t=`throw`,n=e}if(t===`throw`)throw n;return n}},9539(e,t,n){var r=n(9565),i=n(8551),a=n(5966);e.exports=function(e,t,n){var o,s;i(e);try{if(o=a(e,`return`),!o){if(t===`throw`)throw n;return n}o=r(o,e)}catch(e){s=!0,o=e}if(t===`throw`)throw n;if(s)throw o;return i(o),n}},9462(e,t,n){var r=n(9565),i=n(2360),a=n(6699),o=n(6279),s=n(8227),c=n(1181),l=n(5966),u=n(7657).IteratorPrototype,d=n(2529),f=n(9539),p=n(1385),m=s(`toStringTag`),h=`IteratorHelper`,g=`WrapForValidIterator`,_=`normal`,v=`throw`,y=c.set,b=function(e){var t=c.getterFor(e?g:h);return o(i(u),{next:function(){var n=t(this);if(e)return n.nextHandler();if(n.done)return d(void 0,!0);try{var r=n.nextHandler();return n.returnHandlerResult?r:d(r,n.done)}catch(e){throw n.done=!0,e}},return:function(){var n=t(this),i=n.iterator,a=n.done;if(n.done=!0,e){var o=l(i,`return`);return o?r(o,i):d(void 0,!0)}if(a)return d(void 0,!0);if(n.inner)try{f(n.inner.iterator,_)}catch(e){return f(i,v,e)}if(n.openIters)try{p(n.openIters,_)}catch(e){if(i)return f(i,v,e);throw e}return i&&f(i,_),d(void 0,!0)}})},x=b(!0),S=b(!1);a(S,m,`Iterator Helper`),e.exports=function(e,t,n){var r=function(r,i){i?(i.iterator=r.iterator,i.next=r.next):i=r,i.type=t?g:h,i.returnHandlerResult=!!n,i.nextHandler=e,i.counter=0,i.done=!1,y(this,i)};return r.prototype=t?x:S,r}},684(e){e.exports=function(e,t){var n=typeof Iterator==`function`&&Iterator.prototype[e];if(n)try{n.call({next:null},t).next()}catch{return!0}}},4549(e,t,n){var r=n(4576);e.exports=function(e,t){var n=r.Iterator,i=n&&n.prototype,a=i&&i[e],o=!1;if(a)try{a.call({next:function(){return{done:!0}},return:function(){o=!0}},-1)}catch(e){e instanceof t||(o=!1)}if(!o)return a}},7657(e,t,n){var r=n(9039),i=n(4901),a=n(34),o=n(2360),s=n(2787),c=n(6840),l=n(8227),u=n(6395),d=l(`iterator`),f=!1,p,m,h;[].keys&&(h=[].keys(),`next`in h?(m=s(s(h)),m!==Object.prototype&&(p=m)):f=!0),!a(p)||r(function(){var e={};return p[d].call(e)!==e})?p={}:u&&(p=o(p)),i(p[d])||c(p,d,function(){return this}),e.exports={IteratorPrototype:p,BUGGY_SAFARI_ITERATORS:f}},6269(e){e.exports={}},6198(e,t,n){var r=n(8014);e.exports=function(e){return r(e.length)}},283(e,t,n){var r=n(9504),i=n(9039),a=n(4901),o=n(9297),s=n(3724),c=n(350).CONFIGURABLE,l=n(3706),u=n(1181),d=u.enforce,f=u.get,p=String,m=Object.defineProperty,h=r(``.slice),g=r(``.replace),_=r([].join),v=s&&!i(function(){return m(function(){},`length`,{value:8}).length!==8}),y=String(String).split(`String`),b=e.exports=function(e,t,n){h(p(t),0,7)===`Symbol(`&&(t=`[`+g(p(t),/^Symbol\(([^)]*)\).*$/,`$1`)+`]`),n&&n.getter&&(t=`get `+t),n&&n.setter&&(t=`set `+t),(!o(e,`name`)||c&&e.name!==t)&&(s?m(e,`name`,{value:t,configurable:!0}):e.name=t),v&&n&&o(n,`arity`)&&e.length!==n.arity&&m(e,`length`,{value:n.arity});try{n&&o(n,`constructor`)&&n.constructor?s&&m(e,`prototype`,{writable:!1}):e.prototype&&=void 0}catch{}var r=d(e);return o(r,`source`)||(r.source=_(y,typeof t==`string`?t:``)),e};Function.prototype.toString=b(function(){return a(this)&&f(this).source||l(this)},`toString`)},2248(e,t,n){var r=n(9504),i=Map.prototype;e.exports={Map,set:r(i.set),get:r(i.get),has:r(i.has),remove:r(i.delete),proto:i}},741(e){var t=Math.ceil,n=Math.floor;e.exports=Math.trunc||function(e){var r=+e;return(r>0?n:t)(r)}},7819(e,t,n){e.exports=!n(9039)(function(){var e=`9007199254740993`,t=JSON.rawJSON(e);return!JSON.isRawJSON(t)||JSON.stringify(t)!==e})},6043(e,t,n){var r=n(9306),i=TypeError,a=function(e){var t,n;this.promise=new e(function(e,r){if(t!==void 0||n!==void 0)throw new i(`Bad Promise constructor`);t=e,n=r}),this.resolve=r(t),this.reject=r(n)};e.exports.f=function(e){return new a(e)}},2603(e,t,n){var r=n(655);e.exports=function(e,t){return e===void 0?arguments.length<2?``:t:r(e)}},4149(e){var t=RangeError;e.exports=function(e){if(e===e)return e;throw new t(`NaN is not allowed`)}},2360(e,t,n){var r=n(8551),i=n(6801),a=n(8727),o=n(421),s=n(397),c=n(4055),l=n(6119),u=`>`,d=`<`,f=`prototype`,p=`script`,m=l(`IE_PROTO`),h=function(){},g=function(e){return d+p+u+e+d+`/`+p+u},_=function(e){e.write(g(``)),e.close();var t=e.parentWindow.Object;return e=null,t},v=function(){var e=c(`iframe`),t=`java`+p+`:`,n;return e.style.display=`none`,s.appendChild(e),e.src=String(t),n=e.contentWindow.document,n.open(),n.write(g(`document.F=Object`)),n.close(),n.F},y,b=function(){try{y=new ActiveXObject(`htmlfile`)}catch{}b=typeof document<`u`?document.domain&&y?_(y):v():_(y);for(var e=a.length;e--;)delete b[f][a[e]];return b()};o[m]=!0,e.exports=Object.create||function(e,t){var n;return e===null?n=b():(h[f]=r(e),n=new h,h[f]=null,n[m]=e),t===void 0?n:i.f(n,t)}},6801(e,t,n){var r=n(3724),i=n(8686),a=n(4913),o=n(8551),s=n(5397),c=n(1072);t.f=r&&!i?Object.defineProperties:function(e,t){o(e);for(var n=s(t),r=c(t),i=r.length,l=0,u;i>l;)a.f(e,u=r[l++],n[u]);return e}},4913(e,t,n){var r=n(3724),i=n(5917),a=n(8686),o=n(8551),s=n(6969),c=TypeError,l=Object.defineProperty,u=Object.getOwnPropertyDescriptor,d=`enumerable`,f=`configurable`,p=`writable`;t.f=r?a?function(e,t,n){if(o(e),t=s(t),o(n),typeof e==`function`&&t===`prototype`&&`value`in n&&p in n&&!n[p]){var r=u(e,t);r&&r[p]&&(e[t]=n.value,n={configurable:f in n?n[f]:r[f],enumerable:d in n?n[d]:r[d],writable:!1})}return l(e,t,n)}:l:function(e,t,n){if(o(e),t=s(t),o(n),i)try{return l(e,t,n)}catch{}if(`get`in n||`set`in n)throw new c(`Accessors not supported`);return`value`in n&&(e[t]=n.value),e}},7347(e,t,n){var r=n(3724),i=n(9565),a=n(8773),o=n(6980),s=n(5397),c=n(6969),l=n(9297),u=n(5917),d=Object.getOwnPropertyDescriptor;t.f=r?d:function(e,t){if(e=s(e),t=c(t),u)try{return d(e,t)}catch{}if(l(e,t))return o(!i(a.f,e,t),e[t])}},8480(e,t,n){var r=n(1828),i=n(8727).concat(`length`,`prototype`);t.f=Object.getOwnPropertyNames||function(e){return r(e,i)}},3717(e,t){t.f=Object.getOwnPropertySymbols},2787(e,t,n){var r=n(9297),i=n(4901),a=n(8981),o=n(6119),s=n(2211),c=o(`IE_PROTO`),l=Object,u=l.prototype;e.exports=s?l.getPrototypeOf:function(e){var t=a(e);if(r(t,c))return t[c];var n=t.constructor;return i(n)&&t instanceof n?n.prototype:t instanceof l?u:null}},1625(e,t,n){e.exports=n(9504)({}.isPrototypeOf)},1828(e,t,n){var r=n(9504),i=n(9297),a=n(5397),o=n(9617).indexOf,s=n(421),c=r([].push);e.exports=function(e,t){var n=a(e),r=0,l=[],u;for(u in n)!i(s,u)&&i(n,u)&&c(l,u);for(;t.length>r;)i(n,u=t[r++])&&(~o(l,u)||c(l,u));return l}},1072(e,t,n){var r=n(1828),i=n(8727);e.exports=Object.keys||function(e){return r(e,i)}},8773(e,t){var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor;t.f=r&&!n.call({1:2},1)?function(e){var t=r(this,e);return!!t&&t.enumerable}:n},2967(e,t,n){var r=n(6706),i=n(34),a=n(7750),o=n(3506);e.exports=Object.setPrototypeOf||(`__proto__`in{}?function(){var e=!1,t={},n;try{n=r(Object.prototype,`__proto__`,`set`),n(t,[]),e=t instanceof Array}catch{}return function(t,r){return a(t),o(r),i(t)&&(e?n(t,r):t.__proto__=r),t}}():void 0)},4270(e,t,n){var r=n(9565),i=n(4901),a=n(34),o=TypeError;e.exports=function(e,t){var n,s;if(t===`string`&&i(n=e.toString)&&!a(s=r(n,e))||i(n=e.valueOf)&&!a(s=r(n,e))||t!==`string`&&i(n=e.toString)&&!a(s=r(n,e)))return s;throw new o(`Can't convert object to primitive value`)}},5031(e,t,n){var r=n(7751),i=n(9504),a=n(8480),o=n(3717),s=n(8551),c=i([].concat);e.exports=r(`Reflect`,`ownKeys`)||function(e){var t=a.f(s(e)),n=o.f;return n?c(t,n(e)):t}},8235(e,t,n){var r=n(9504),i=n(9297),a=SyntaxError,o=parseInt,s=String.fromCharCode,c=r(``.charAt),l=r(``.slice),u=r(/./.exec),d={'\\"':`"`,"\\\\":`\\`,"\\/":`/`,"\\b":`\b`,"\\f":`\f`,"\\n":` +import{_ as e}from"./index-Bh3F0vXZ.js";var t={9306(e,t,n){var r=n(4901),i=n(6823),a=TypeError;e.exports=function(e){if(r(e))return e;throw new a(i(e)+` is not a function`)}},3506(e,t,n){var r=n(3925),i=String,a=TypeError;e.exports=function(e){if(r(e))return e;throw new a(`Can't set `+i(e)+` as a prototype`)}},7080(e,t,n){var r=n(4402).has;e.exports=function(e){return r(e),e}},3463(e){var t=TypeError;e.exports=function(e){if(typeof e==`string`)return e;throw new t(`Argument is not a string`)}},4328(e,t,n){var r=n(4995),i=new r.WeakMap,a=r.set,o=r.remove;e.exports=function(e){return a(i,e,1),o(i,e),e}},6557(e,t,n){var r=n(4995).has;e.exports=function(e){return r(e),e}},6469(e,t,n){var r=n(8227),i=n(2360),a=n(4913).f,o=r(`unscopables`),s=Array.prototype;s[o]===void 0&&a(s,o,{configurable:!0,value:i(null)}),e.exports=function(e){s[o][e]=!0}},679(e,t,n){var r=n(1625),i=TypeError;e.exports=function(e,t){if(r(t,e))return e;throw new i(`Incorrect invocation`)}},3972(e,t,n){var r=n(34),i=String,a=TypeError;e.exports=function(e){if(e===void 0||r(e))return e;throw new a(i(e)+` is not an object or undefined`)}},8551(e,t,n){var r=n(34),i=String,a=TypeError;e.exports=function(e){if(r(e))return e;throw new a(i(e)+` is not an object`)}},4154(e,t,n){var r=n(6955),i=TypeError;e.exports=function(e){if(r(e)===`Uint8Array`)return e;throw new i(`Argument is not an Uint8Array`)}},7811(e){e.exports=typeof ArrayBuffer<`u`&&typeof DataView<`u`},7394(e,t,n){var r=n(4576),i=n(6706),a=n(2195),o=r.ArrayBuffer,s=r.TypeError;e.exports=o&&i(o.prototype,`byteLength`,`get`)||function(e){if(a(e)!==`ArrayBuffer`)throw new s(`ArrayBuffer expected`);return e.byteLength}},3238(e,t,n){var r=n(4576),i=n(7811),a=n(7394),o=r.DataView;e.exports=function(e){if(!i||a(e)!==0)return!1;try{return new o(e),!1}catch{return!0}}},5169(e,t,n){var r=n(3238),i=TypeError;e.exports=function(e){if(r(e))throw new i(`ArrayBuffer is detached`);return e}},4644(e,t,n){var r=n(7811),i=n(3724),a=n(4576),o=n(4901),s=n(34),c=n(9297),l=n(6955),u=n(6823),d=n(6699),f=n(6840),p=n(2106),m=n(1625),h=n(2787),g=n(2967),_=n(8227),v=n(3392),y=n(1181),b=y.enforce,x=y.get,S=a.Int8Array,C=S&&S.prototype,w=a.Uint8ClampedArray,T=w&&w.prototype,E=S&&h(S),D=C&&h(C),O=Object.prototype,k=a.TypeError,A=_(`toStringTag`),j=v(`TYPED_ARRAY_TAG`),M=`TypedArrayConstructor`,N=r&&!!g&&l(a.opera)!==`Opera`,P=!1,F,I,L,R={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},ee={BigInt64Array:8,BigUint64Array:8},te=function(e){if(!s(e))return!1;var t=l(e);return t===`DataView`||c(R,t)||c(ee,t)},ne=function(e){var t=h(e);if(s(t)){var n=x(t);return n&&c(n,M)?n[M]:ne(t)}},re=function(e){if(!s(e))return!1;var t=l(e);return c(R,t)||c(ee,t)},ie=function(e){if(re(e))return e;throw new k(`Target is not a typed array`)},ae=function(e){if(o(e)&&(!g||m(E,e)))return e;throw new k(u(e)+` is not a typed array constructor`)},z=function(e,t,n,r){if(i){if(n)for(var o in R){var s=a[o];if(s&&c(s.prototype,e))try{delete s.prototype[e]}catch{try{s.prototype[e]=t}catch{}}}(!D[e]||n)&&f(D,e,n?t:N&&C[e]||t,r)}},B=function(e,t,n){var r,o;if(i){if(g){if(n){for(r in R)if(o=a[r],o&&c(o,e))try{delete o[e]}catch{}}if(!E[e]||n)try{return f(E,e,n?t:N&&E[e]||t)}catch{}else return}for(r in R)o=a[r],o&&(!o[e]||n)&&f(o,e,t)}};for(F in R)I=a[F],L=I&&I.prototype,L?b(L)[M]=I:N=!1;for(F in ee)I=a[F],L=I&&I.prototype,L&&(b(L)[M]=I);if((!N||!o(E)||E===Function.prototype)&&(E=function(){throw new k(`Incorrect invocation`)},N))for(F in R)a[F]&&g(a[F],E);if((!N||!D||D===O)&&(D=E.prototype,N))for(F in R)a[F]&&g(a[F].prototype,D);if(N&&h(T)!==D&&g(T,D),i&&!c(D,A))for(F in P=!0,p(D,A,{configurable:!0,get:function(){return s(this)?this[j]:void 0}}),R)a[F]&&d(a[F].prototype,j,F);e.exports={NATIVE_ARRAY_BUFFER_VIEWS:N,TYPED_ARRAY_TAG:P&&j,aTypedArray:ie,aTypedArrayConstructor:ae,exportTypedArrayMethod:z,exportTypedArrayStaticMethod:B,getTypedArrayConstructor:ne,isView:te,isTypedArray:re,TypedArray:E,TypedArrayPrototype:D}},5370(e,t,n){var r=n(6198);e.exports=function(e,t,n){for(var i=0,a=arguments.length>2?n:r(t),o=new e(a);a>i;)o[i]=t[i++];return o}},9617(e,t,n){var r=n(5397),i=n(5610),a=n(6198),o=function(e){return function(t,n,o){var s=r(t),c=a(s);if(c===0)return!e&&-1;var l=i(o,c),u;if(e&&n!==n){for(;c>l;)if(u=s[l++],u!==u)return!0}else for(;c>l;l++)if((e||l in s)&&s[l]===n)return e||l||0;return!e&&-1}};e.exports={includes:o(!0),indexOf:o(!1)}},4527(e,t,n){var r=n(3724),i=n(4376),a=TypeError,o=Object.getOwnPropertyDescriptor;e.exports=r&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(e){return e instanceof TypeError}}()?function(e,t){if(i(e)&&!o(e,`length`).writable)throw new a(`Cannot set read only .length`);return e.length=t}:function(e,t){return e.length=t}},7680(e,t,n){e.exports=n(9504)([].slice)},2804(e){var t=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`,n=t+`+/`,r=t+`-_`,i=function(e){for(var t={},n=0;n<64;n++)t[e.charAt(n)]=n;return t};e.exports={i2c:n,c2i:i(n),i2cUrl:r,c2iUrl:i(r)}},6319(e,t,n){var r=n(8551),i=n(9539);e.exports=function(e,t,n,a){try{return a?t(r(n)[0],n[1]):t(n)}catch(t){i(e,`throw`,t)}}},2195(e,t,n){var r=n(9504),i=r({}.toString),a=r(``.slice);e.exports=function(e){return a(i(e),8,-1)}},6955(e,t,n){var r=n(2140),i=n(4901),a=n(2195),o=n(8227)(`toStringTag`),s=Object,c=a(function(){return arguments}())===`Arguments`,l=function(e,t){try{return e[t]}catch{}};e.exports=r?a:function(e){var t,n,r;return e===void 0?`Undefined`:e===null?`Null`:typeof(n=l(t=s(e),o))==`string`?n:c?a(t):(r=a(t))===`Object`&&i(t.callee)?`Arguments`:r}},7740(e,t,n){var r=n(9297),i=n(5031),a=n(7347),o=n(4913);e.exports=function(e,t,n){for(var s=i(t),c=o.f,l=a.f,u=0;un)throw new t(`Maximum allowed index exceeded`);return e}},5002(e){e.exports={IndexSizeError:{s:`INDEX_SIZE_ERR`,c:1,m:1},DOMStringSizeError:{s:`DOMSTRING_SIZE_ERR`,c:2,m:0},HierarchyRequestError:{s:`HIERARCHY_REQUEST_ERR`,c:3,m:1},WrongDocumentError:{s:`WRONG_DOCUMENT_ERR`,c:4,m:1},InvalidCharacterError:{s:`INVALID_CHARACTER_ERR`,c:5,m:1},NoDataAllowedError:{s:`NO_DATA_ALLOWED_ERR`,c:6,m:0},NoModificationAllowedError:{s:`NO_MODIFICATION_ALLOWED_ERR`,c:7,m:1},NotFoundError:{s:`NOT_FOUND_ERR`,c:8,m:1},NotSupportedError:{s:`NOT_SUPPORTED_ERR`,c:9,m:1},InUseAttributeError:{s:`INUSE_ATTRIBUTE_ERR`,c:10,m:1},InvalidStateError:{s:`INVALID_STATE_ERR`,c:11,m:1},SyntaxError:{s:`SYNTAX_ERR`,c:12,m:1},InvalidModificationError:{s:`INVALID_MODIFICATION_ERR`,c:13,m:1},NamespaceError:{s:`NAMESPACE_ERR`,c:14,m:1},InvalidAccessError:{s:`INVALID_ACCESS_ERR`,c:15,m:1},ValidationError:{s:`VALIDATION_ERR`,c:16,m:0},TypeMismatchError:{s:`TYPE_MISMATCH_ERR`,c:17,m:1},SecurityError:{s:`SECURITY_ERR`,c:18,m:1},NetworkError:{s:`NETWORK_ERR`,c:19,m:1},AbortError:{s:`ABORT_ERR`,c:20,m:1},URLMismatchError:{s:`URL_MISMATCH_ERR`,c:21,m:1},QuotaExceededError:{s:`QUOTA_EXCEEDED_ERR`,c:22,m:1},TimeoutError:{s:`TIMEOUT_ERR`,c:23,m:1},InvalidNodeTypeError:{s:`INVALID_NODE_TYPE_ERR`,c:24,m:1},DataCloneError:{s:`DATA_CLONE_ERR`,c:25,m:1}}},8727(e){e.exports=[`constructor`,`hasOwnProperty`,`isPrototypeOf`,`propertyIsEnumerable`,`toLocaleString`,`toString`,`valueOf`]},2839(e,t,n){var r=n(4576).navigator,i=r&&r.userAgent;e.exports=i?String(i):``},9519(e,t,n){var r=n(4576),i=n(2839),a=r.process,o=r.Deno,s=a&&a.versions||o&&o.version,c=s&&s.v8,l,u;c&&(l=c.split(`.`),u=l[0]>0&&l[0]<4?1:+(l[0]+l[1])),!u&&i&&(l=i.match(/Edge\/(\d+)/),(!l||l[1]>=74)&&(l=i.match(/Chrome\/(\d+)/),l&&(u=+l[1]))),e.exports=u},6193(e,t,n){var r=n(9504),i=Error,a=r(``.replace),o=(function(e){return String(new i(e).stack)})(`zxcasd`),s=/\n\s*at [^:]*:[^\n]*/,c=s.test(o);e.exports=function(e,t){if(c&&typeof e==`string`&&!i.prepareStackTrace)for(;t--;)e=a(e,s,``);return e}},6518(e,t,n){var r=n(4576),i=n(7347).f,a=n(6699),o=n(6840),s=n(9433),c=n(7740),l=n(2796);e.exports=function(e,t){var n=e.target,u=e.global,d=e.stat,f,p=u?r:d?r[n]||s(n,{}):r[n]&&r[n].prototype,m,h,g,_;if(p)for(m in t){if(g=t[m],e.dontCallGetSet?(_=i(p,m),h=_&&_.value):h=p[m],f=l(u?m:n+(d?`.`:`#`)+m,e.forced),!f&&h!==void 0){if(typeof g==typeof h)continue;c(g,h)}(e.sham||h&&h.sham)&&a(g,`sham`,!0),o(p,m,g,e)}}},9039(e){e.exports=function(e){try{return!!e()}catch{return!0}}},8745(e,t,n){var r=n(616),i=Function.prototype,a=i.apply,o=i.call;e.exports=typeof Reflect==`object`&&Reflect.apply||(r?o.bind(a):function(){return o.apply(a,arguments)})},6080(e,t,n){var r=n(7476),i=n(9306),a=n(616),o=r(r.bind);e.exports=function(e,t){return i(e),t===void 0?e:a?o(e,t):function(){return e.apply(t,arguments)}}},616(e,t,n){e.exports=!n(9039)(function(){var e=function(){}.bind();return typeof e!=`function`||e.hasOwnProperty(`prototype`)})},9565(e,t,n){var r=n(616),i=Function.prototype.call;e.exports=r?i.bind(i):function(){return i.apply(i,arguments)}},350(e,t,n){var r=n(3724),i=n(9297),a=Function.prototype,o=r&&Object.getOwnPropertyDescriptor,s=i(a,`name`);e.exports={EXISTS:s,PROPER:s&&function(){}.name===`something`,CONFIGURABLE:s&&(!r||r&&o(a,`name`).configurable)}},6706(e,t,n){var r=n(9504),i=n(9306);e.exports=function(e,t,n){try{return r(i(Object.getOwnPropertyDescriptor(e,t)[n]))}catch{}}},7476(e,t,n){var r=n(2195),i=n(9504);e.exports=function(e){if(r(e)===`Function`)return i(e)}},9504(e,t,n){var r=n(616),i=Function.prototype,a=i.call,o=r&&i.bind.bind(a,a);e.exports=r?o:function(e){return function(){return a.apply(e,arguments)}}},944(e){var t=TypeError;e.exports=function(e){var n=e&&e.alphabet;if(n===void 0||n===`base64`||n===`base64url`)return n||`base64`;throw new t("Incorrect `alphabet` option")}},7751(e,t,n){var r=n(4576),i=n(4901),a=function(e){return i(e)?e:void 0};e.exports=function(e,t){return arguments.length<2?a(r[e]):r[e]&&r[e][t]}},1767(e){e.exports=function(e){return{iterator:e,next:e.next,done:!1}}},8646(e,t,n){var r=n(9565),i=n(8551),a=n(1767),o=n(851);e.exports=function(e,t){(!t||typeof e!=`string`)&&i(e);var n=o(e);return a(i(n===void 0?e:r(n,e)))}},851(e,t,n){var r=n(6955),i=n(5966),a=n(4117),o=n(6269),s=n(8227)(`iterator`);e.exports=function(e){if(!a(e))return i(e,s)||i(e,`@@iterator`)||o[r(e)]}},81(e,t,n){var r=n(9565),i=n(9306),a=n(8551),o=n(6823),s=n(851),c=TypeError;e.exports=function(e,t){var n=arguments.length<2?s(e):t;if(i(n))return a(r(n,e));throw new c(o(e)+` is not iterable`)}},5966(e,t,n){var r=n(9306),i=n(4117);e.exports=function(e,t){var n=e[t];return i(n)?void 0:r(n)}},3789(e,t,n){var r=n(9306),i=n(8551),a=n(9565),o=n(1291),s=n(1767),c=`Invalid size`,l=RangeError,u=TypeError,d=Math.max,f=function(e,t){this.set=e,this.size=d(t,0),this.has=r(e.has),this.keys=r(e.keys)};f.prototype={getIterator:function(){return s(i(a(this.keys,this.set)))},includes:function(e){return a(this.has,this.set,e)}},e.exports=function(e){i(e);var t=+e.size;if(t!==t)throw new u(c);var n=o(t);if(n<0)throw new l(c);return new f(e,n)}},4576(e){var t=function(e){return e&&e.Math===Math&&e};e.exports=t(typeof globalThis==`object`&&globalThis)||t(typeof window==`object`&&window)||t(typeof self==`object`&&self)||t(typeof global==`object`&&global)||t(typeof this==`object`&&this)||(function(){return this})()||Function(`return this`)()},9297(e,t,n){var r=n(9504),i=n(8981),a=r({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return a(i(e),t)}},421(e){e.exports={}},397(e,t,n){e.exports=n(7751)(`document`,`documentElement`)},5917(e,t,n){var r=n(3724),i=n(9039),a=n(4055);e.exports=!r&&!i(function(){return Object.defineProperty(a(`div`),"a",{get:function(){return 7}}).a!==7})},7055(e,t,n){var r=n(9504),i=n(9039),a=n(2195),o=Object,s=r(``.split);e.exports=i(function(){return!o(`z`).propertyIsEnumerable(0)})?function(e){return a(e)===`String`?s(e,``):o(e)}:o},3167(e,t,n){var r=n(4901),i=n(34),a=n(2967);e.exports=function(e,t,n){var o,s;return a&&r(o=t.constructor)&&o!==n&&i(s=o.prototype)&&s!==n.prototype&&a(e,s),e}},3706(e,t,n){var r=n(9504),i=n(4901),a=n(7629),o=r(Function.toString);i(a.inspectSource)||(a.inspectSource=function(e){return o(e)}),e.exports=a.inspectSource},1181(e,t,n){var r=n(8622),i=n(4576),a=n(34),o=n(6699),s=n(9297),c=n(7629),l=n(6119),u=n(421),d=`Object already initialized`,f=i.TypeError,p=i.WeakMap,m,h,g,_=function(e){return g(e)?h(e):m(e,{})},v=function(e){return function(t){var n;if(!a(t)||(n=h(t)).type!==e)throw new f(`Incompatible receiver, `+e+` required`);return n}};if(r||c.state){var y=c.state||=new p;y.get=y.get,y.has=y.has,y.set=y.set,m=function(e,t){if(y.has(e))throw new f(d);return t.facade=e,y.set(e,t),t},h=function(e){return y.get(e)||{}},g=function(e){return y.has(e)}}else{var b=l(`state`);u[b]=!0,m=function(e,t){if(s(e,b))throw new f(d);return t.facade=e,o(e,b,t),t},h=function(e){return s(e,b)?e[b]:{}},g=function(e){return s(e,b)}}e.exports={set:m,get:h,has:g,enforce:_,getterFor:v}},4209(e,t,n){var r=n(8227),i=n(6269),a=r(`iterator`),o=Array.prototype;e.exports=function(e){return e!==void 0&&(i.Array===e||o[a]===e)}},4376(e,t,n){var r=n(2195);e.exports=Array.isArray||function(e){return r(e)===`Array`}},1108(e,t,n){var r=n(6955);e.exports=function(e){var t=r(e);return t===`BigInt64Array`||t===`BigUint64Array`}},4901(e){var t=typeof document==`object`&&document.all;e.exports=t===void 0&&t!==void 0?function(e){return typeof e==`function`||e===t}:function(e){return typeof e==`function`}},2796(e,t,n){var r=n(9039),i=n(4901),a=/#|\.prototype\./,o=function(e,t){var n=c[s(e)];return n===u?!0:n===l?!1:i(t)?r(t):!!t},s=o.normalize=function(e){return String(e).replace(a,`.`).toLowerCase()},c=o.data={},l=o.NATIVE=`N`,u=o.POLYFILL=`P`;e.exports=o},4117(e){e.exports=function(e){return e==null}},34(e,t,n){var r=n(4901);e.exports=function(e){return typeof e==`object`?e!==null:r(e)}},3925(e,t,n){var r=n(34);e.exports=function(e){return r(e)||e===null}},6395(e){e.exports=!1},5810(e,t,n){var r=n(34),i=n(1181).get;e.exports=function(e){if(!r(e))return!1;var t=i(e);return!!t&&t.type===`RawJSON`}},757(e,t,n){var r=n(7751),i=n(4901),a=n(1625),o=n(7040),s=Object;e.exports=o?function(e){return typeof e==`symbol`}:function(e){var t=r(`Symbol`);return i(t)&&a(t.prototype,s(e))}},507(e,t,n){var r=n(9565);e.exports=function(e,t,n){for(var i=n?e:e.iterator,a=e.next,o,s;!(o=r(a,i)).done;)if(s=t(o.value),s!==void 0)return s}},2652(e,t,n){var r=n(6080),i=n(9565),a=n(8551),o=n(6823),s=n(4209),c=n(6198),l=n(1625),u=n(81),d=n(851),f=n(9539),p=TypeError,m=function(e,t){this.stopped=e,this.result=t},h=m.prototype;e.exports=function(e,t,n){var g=n&&n.that,_=!!(n&&n.AS_ENTRIES),v=!!(n&&n.IS_RECORD),y=!!(n&&n.IS_ITERATOR),b=!!(n&&n.INTERRUPTED),x=r(t,g),S,C,w,T,E,D,O,k=function(e){var t=S;return S=void 0,t&&f(t,`normal`),new m(!0,e)},A=function(e){return _?(a(e),b?x(e[0],e[1],k):x(e[0],e[1])):b?x(e,k):x(e)};if(v)S=e.iterator;else if(y)S=e;else{if(C=d(e),!C)throw new p(o(e)+` is not iterable`);if(s(C)){for(w=0,T=c(e);T>w;w++)if(E=A(e[w]),E&&l(h,E))return E;return new m(!1)}S=u(e,C)}for(D=v?e.next:S.next;!(O=i(D,S)).done;){var j=O.value;try{E=A(j)}catch(e){if(S)f(S,`throw`,e);else throw e}if(typeof E==`object`&&E&&l(h,E))return E}return new m(!1)}},1385(e,t,n){var r=n(9539);e.exports=function(e,t,n){for(var i=e.length-1;i>=0;i--)if(e[i]!==void 0)try{n=r(e[i].iterator,t,n)}catch(e){t=`throw`,n=e}if(t===`throw`)throw n;return n}},9539(e,t,n){var r=n(9565),i=n(8551),a=n(5966);e.exports=function(e,t,n){var o,s;i(e);try{if(o=a(e,`return`),!o){if(t===`throw`)throw n;return n}o=r(o,e)}catch(e){s=!0,o=e}if(t===`throw`)throw n;if(s)throw o;return i(o),n}},9462(e,t,n){var r=n(9565),i=n(2360),a=n(6699),o=n(6279),s=n(8227),c=n(1181),l=n(5966),u=n(7657).IteratorPrototype,d=n(2529),f=n(9539),p=n(1385),m=s(`toStringTag`),h=`IteratorHelper`,g=`WrapForValidIterator`,_=`normal`,v=`throw`,y=c.set,b=function(e){var t=c.getterFor(e?g:h);return o(i(u),{next:function(){var n=t(this);if(e)return n.nextHandler();if(n.done)return d(void 0,!0);try{var r=n.nextHandler();return n.returnHandlerResult?r:d(r,n.done)}catch(e){throw n.done=!0,e}},return:function(){var n=t(this),i=n.iterator,a=n.done;if(n.done=!0,e){var o=l(i,`return`);return o?r(o,i):d(void 0,!0)}if(a)return d(void 0,!0);if(n.inner)try{f(n.inner.iterator,_)}catch(e){return f(i,v,e)}if(n.openIters)try{p(n.openIters,_)}catch(e){if(i)return f(i,v,e);throw e}return i&&f(i,_),d(void 0,!0)}})},x=b(!0),S=b(!1);a(S,m,`Iterator Helper`),e.exports=function(e,t,n){var r=function(r,i){i?(i.iterator=r.iterator,i.next=r.next):i=r,i.type=t?g:h,i.returnHandlerResult=!!n,i.nextHandler=e,i.counter=0,i.done=!1,y(this,i)};return r.prototype=t?x:S,r}},684(e){e.exports=function(e,t){var n=typeof Iterator==`function`&&Iterator.prototype[e];if(n)try{n.call({next:null},t).next()}catch{return!0}}},4549(e,t,n){var r=n(4576);e.exports=function(e,t){var n=r.Iterator,i=n&&n.prototype,a=i&&i[e],o=!1;if(a)try{a.call({next:function(){return{done:!0}},return:function(){o=!0}},-1)}catch(e){e instanceof t||(o=!1)}if(!o)return a}},7657(e,t,n){var r=n(9039),i=n(4901),a=n(34),o=n(2360),s=n(2787),c=n(6840),l=n(8227),u=n(6395),d=l(`iterator`),f=!1,p,m,h;[].keys&&(h=[].keys(),`next`in h?(m=s(s(h)),m!==Object.prototype&&(p=m)):f=!0),!a(p)||r(function(){var e={};return p[d].call(e)!==e})?p={}:u&&(p=o(p)),i(p[d])||c(p,d,function(){return this}),e.exports={IteratorPrototype:p,BUGGY_SAFARI_ITERATORS:f}},6269(e){e.exports={}},6198(e,t,n){var r=n(8014);e.exports=function(e){return r(e.length)}},283(e,t,n){var r=n(9504),i=n(9039),a=n(4901),o=n(9297),s=n(3724),c=n(350).CONFIGURABLE,l=n(3706),u=n(1181),d=u.enforce,f=u.get,p=String,m=Object.defineProperty,h=r(``.slice),g=r(``.replace),_=r([].join),v=s&&!i(function(){return m(function(){},`length`,{value:8}).length!==8}),y=String(String).split(`String`),b=e.exports=function(e,t,n){h(p(t),0,7)===`Symbol(`&&(t=`[`+g(p(t),/^Symbol\(([^)]*)\).*$/,`$1`)+`]`),n&&n.getter&&(t=`get `+t),n&&n.setter&&(t=`set `+t),(!o(e,`name`)||c&&e.name!==t)&&(s?m(e,`name`,{value:t,configurable:!0}):e.name=t),v&&n&&o(n,`arity`)&&e.length!==n.arity&&m(e,`length`,{value:n.arity});try{n&&o(n,`constructor`)&&n.constructor?s&&m(e,`prototype`,{writable:!1}):e.prototype&&=void 0}catch{}var r=d(e);return o(r,`source`)||(r.source=_(y,typeof t==`string`?t:``)),e};Function.prototype.toString=b(function(){return a(this)&&f(this).source||l(this)},`toString`)},2248(e,t,n){var r=n(9504),i=Map.prototype;e.exports={Map,set:r(i.set),get:r(i.get),has:r(i.has),remove:r(i.delete),proto:i}},741(e){var t=Math.ceil,n=Math.floor;e.exports=Math.trunc||function(e){var r=+e;return(r>0?n:t)(r)}},7819(e,t,n){e.exports=!n(9039)(function(){var e=`9007199254740993`,t=JSON.rawJSON(e);return!JSON.isRawJSON(t)||JSON.stringify(t)!==e})},6043(e,t,n){var r=n(9306),i=TypeError,a=function(e){var t,n;this.promise=new e(function(e,r){if(t!==void 0||n!==void 0)throw new i(`Bad Promise constructor`);t=e,n=r}),this.resolve=r(t),this.reject=r(n)};e.exports.f=function(e){return new a(e)}},2603(e,t,n){var r=n(655);e.exports=function(e,t){return e===void 0?arguments.length<2?``:t:r(e)}},4149(e){var t=RangeError;e.exports=function(e){if(e===e)return e;throw new t(`NaN is not allowed`)}},2360(e,t,n){var r=n(8551),i=n(6801),a=n(8727),o=n(421),s=n(397),c=n(4055),l=n(6119),u=`>`,d=`<`,f=`prototype`,p=`script`,m=l(`IE_PROTO`),h=function(){},g=function(e){return d+p+u+e+d+`/`+p+u},_=function(e){e.write(g(``)),e.close();var t=e.parentWindow.Object;return e=null,t},v=function(){var e=c(`iframe`),t=`java`+p+`:`,n;return e.style.display=`none`,s.appendChild(e),e.src=String(t),n=e.contentWindow.document,n.open(),n.write(g(`document.F=Object`)),n.close(),n.F},y,b=function(){try{y=new ActiveXObject(`htmlfile`)}catch{}b=typeof document<`u`?document.domain&&y?_(y):v():_(y);for(var e=a.length;e--;)delete b[f][a[e]];return b()};o[m]=!0,e.exports=Object.create||function(e,t){var n;return e===null?n=b():(h[f]=r(e),n=new h,h[f]=null,n[m]=e),t===void 0?n:i.f(n,t)}},6801(e,t,n){var r=n(3724),i=n(8686),a=n(4913),o=n(8551),s=n(5397),c=n(1072);t.f=r&&!i?Object.defineProperties:function(e,t){o(e);for(var n=s(t),r=c(t),i=r.length,l=0,u;i>l;)a.f(e,u=r[l++],n[u]);return e}},4913(e,t,n){var r=n(3724),i=n(5917),a=n(8686),o=n(8551),s=n(6969),c=TypeError,l=Object.defineProperty,u=Object.getOwnPropertyDescriptor,d=`enumerable`,f=`configurable`,p=`writable`;t.f=r?a?function(e,t,n){if(o(e),t=s(t),o(n),typeof e==`function`&&t===`prototype`&&`value`in n&&p in n&&!n[p]){var r=u(e,t);r&&r[p]&&(e[t]=n.value,n={configurable:f in n?n[f]:r[f],enumerable:d in n?n[d]:r[d],writable:!1})}return l(e,t,n)}:l:function(e,t,n){if(o(e),t=s(t),o(n),i)try{return l(e,t,n)}catch{}if(`get`in n||`set`in n)throw new c(`Accessors not supported`);return`value`in n&&(e[t]=n.value),e}},7347(e,t,n){var r=n(3724),i=n(9565),a=n(8773),o=n(6980),s=n(5397),c=n(6969),l=n(9297),u=n(5917),d=Object.getOwnPropertyDescriptor;t.f=r?d:function(e,t){if(e=s(e),t=c(t),u)try{return d(e,t)}catch{}if(l(e,t))return o(!i(a.f,e,t),e[t])}},8480(e,t,n){var r=n(1828),i=n(8727).concat(`length`,`prototype`);t.f=Object.getOwnPropertyNames||function(e){return r(e,i)}},3717(e,t){t.f=Object.getOwnPropertySymbols},2787(e,t,n){var r=n(9297),i=n(4901),a=n(8981),o=n(6119),s=n(2211),c=o(`IE_PROTO`),l=Object,u=l.prototype;e.exports=s?l.getPrototypeOf:function(e){var t=a(e);if(r(t,c))return t[c];var n=t.constructor;return i(n)&&t instanceof n?n.prototype:t instanceof l?u:null}},1625(e,t,n){e.exports=n(9504)({}.isPrototypeOf)},1828(e,t,n){var r=n(9504),i=n(9297),a=n(5397),o=n(9617).indexOf,s=n(421),c=r([].push);e.exports=function(e,t){var n=a(e),r=0,l=[],u;for(u in n)!i(s,u)&&i(n,u)&&c(l,u);for(;t.length>r;)i(n,u=t[r++])&&(~o(l,u)||c(l,u));return l}},1072(e,t,n){var r=n(1828),i=n(8727);e.exports=Object.keys||function(e){return r(e,i)}},8773(e,t){var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor;t.f=r&&!n.call({1:2},1)?function(e){var t=r(this,e);return!!t&&t.enumerable}:n},2967(e,t,n){var r=n(6706),i=n(34),a=n(7750),o=n(3506);e.exports=Object.setPrototypeOf||(`__proto__`in{}?function(){var e=!1,t={},n;try{n=r(Object.prototype,`__proto__`,`set`),n(t,[]),e=t instanceof Array}catch{}return function(t,r){return a(t),o(r),i(t)&&(e?n(t,r):t.__proto__=r),t}}():void 0)},4270(e,t,n){var r=n(9565),i=n(4901),a=n(34),o=TypeError;e.exports=function(e,t){var n,s;if(t===`string`&&i(n=e.toString)&&!a(s=r(n,e))||i(n=e.valueOf)&&!a(s=r(n,e))||t!==`string`&&i(n=e.toString)&&!a(s=r(n,e)))return s;throw new o(`Can't convert object to primitive value`)}},5031(e,t,n){var r=n(7751),i=n(9504),a=n(8480),o=n(3717),s=n(8551),c=i([].concat);e.exports=r(`Reflect`,`ownKeys`)||function(e){var t=a.f(s(e)),n=o.f;return n?c(t,n(e)):t}},8235(e,t,n){var r=n(9504),i=n(9297),a=SyntaxError,o=parseInt,s=String.fromCharCode,c=r(``.charAt),l=r(``.slice),u=r(/./.exec),d={'\\"':`"`,"\\\\":`\\`,"\\/":`/`,"\\b":`\b`,"\\f":`\f`,"\\n":` `,"\\r":`\r`,"\\t":` `},f=/^[\da-f]{4}$/i,p=/^[\u0000-\u001F]$/;e.exports=function(e,t){for(var n=!0,r=``;tn.size?c(n.getIterator(),function(e){d(t,e)&&u(i,e)}):s(t,function(e){n.includes(e)&&u(i,e)}),i}},4449(e,t,n){var r=n(7080),i=n(4402).has,a=n(5170),o=n(3789),s=n(8469),c=n(507),l=n(9539);e.exports=function(e){var t=r(this),n=o(e);if(a(t)<=n.size)return s(t,function(e){if(n.includes(e))return!1},!0)!==!1;var u=n.getIterator();return c(u,function(e){if(i(t,e))return l(u.iterator,`normal`,!1)})!==!1}},3838(e,t,n){var r=n(7080),i=n(5170),a=n(8469),o=n(3789);e.exports=function(e){var t=r(this),n=o(e);return i(t)>n.size?!1:a(t,function(e){if(!n.includes(e))return!1},!0)!==!1}},8527(e,t,n){var r=n(7080),i=n(4402).has,a=n(5170),o=n(3789),s=n(507),c=n(9539);e.exports=function(e){var t=r(this),n=o(e);if(a(t)0?i(t,9007199254740991):0}},8981(e,t,n){var r=n(7750),i=Object;e.exports=function(e){return i(r(e))}},9590(e,t,n){var r=n(1291),i=RangeError;e.exports=function(e){var t=r(e);if(t<0)throw new i(`The argument can't be less than 0`);return t}},2777(e,t,n){var r=n(9565),i=n(34),a=n(757),o=n(5966),s=n(4270),c=n(8227),l=TypeError,u=c(`toPrimitive`);e.exports=function(e,t){if(!i(e)||a(e))return e;var n=o(e,u),c;if(n){if(t===void 0&&(t=`default`),c=r(n,e,t),!i(c)||a(c))return c;throw new l(`Can't convert object to primitive value`)}return t===void 0&&(t=`number`),s(e,t)}},6969(e,t,n){var r=n(2777),i=n(757);e.exports=function(e){var t=r(e,`string`);return i(t)?t:t+``}},2140(e,t,n){var r=n(8227)(`toStringTag`),i={};i[r]=`z`,e.exports=String(i)===`[object z]`},655(e,t,n){var r=n(6955),i=String;e.exports=function(e){if(r(e)===`Symbol`)throw TypeError(`Cannot convert a Symbol value to a string`);return i(e)}},6823(e){var t=String;e.exports=function(e){try{return t(e)}catch{return`Object`}}},3392(e,t,n){var r=n(9504),i=0,a=Math.random(),o=r(1.1.toString);e.exports=function(e){return`Symbol(`+(e===void 0?``:e)+`)_`+o(++i+a,36)}},9143(e,t,n){var r=n(4576),i=n(9504),a=n(3972),o=n(3463),s=n(9297),c=n(2804),l=n(944),u=n(5169),d=c.c2i,f=c.c2iUrl,p=r.SyntaxError,m=r.TypeError,h=i(``.charAt),g=function(e,t){for(var n=e.length;t>16&255,i>>8&255,i&255];if(r===2){if(n&&a[1]!==0)throw new p(`Extra bits`);return[a[0]]}if(r===3){if(n&&a[2]!==0)throw new p(`Extra bits`);return[a[0],a[1]]}return a},v=function(e,t,n){for(var r=t.length,i=0;i0){if(c===`stop-before-partial`)break;if(c===`loose`){if(C.length===1)throw new p(`Malformed padding: exactly one additional character`);x=v(b,_(C,i,!1),x)}else throw new p(`Missing padding`)}S=y;break}var T=h(e,w);if(++w,T===`=`){if(C.length<2)throw new p(`Padding is too early`);if(w=g(e,w),C.length===2){if(w===y){if(c===`stop-before-partial`)break;throw new p(`Malformed padding: only one =`)}h(e,w)===`=`&&(++w,w=g(e,w))}if(w>4}return{bytes:i,read:u<<1}}},7416(e,t,n){var r=n(9039),i=n(8227),a=n(3724),o=n(6395),s=i(`iterator`);e.exports=!r(function(){var e=new URL(`b?a=1&b=2&c=3`,`https://a`),t=e.searchParams,n=new URLSearchParams(`a=1&a=2&b=3`),r=``;return e.pathname=`c%20d`,t.forEach(function(e,n){t.delete(`b`),r+=n+e}),n.delete(`a`,2),n.delete(`b`,void 0),o&&(!e.toJSON||!n.has(`a`,1)||n.has(`a`,2)||!n.has(`a`,void 0)||n.has(`b`))||!t.size&&(o||!a)||!t.sort||e.href!==`https://a/c%20d?a=1&c=3`||t.get(`c`)!==`3`||String(new URLSearchParams(`?a=1`))!==`a=1`||!t[s]||new URL(`https://a@b`).username!==`a`||new URLSearchParams(new URLSearchParams(`a=b`)).get(`a`)!==`b`||new URL(`https://тест`).host!==`xn--e1aybc`||new URL(`https://a#б`).hash!==`#%D0%B1`||r!==`a1c3`||new URL(`https://x`,void 0).host!==`x`})},7040(e,t,n){e.exports=n(4495)&&!Symbol.sham&&typeof Symbol.iterator==`symbol`},8686(e,t,n){var r=n(3724),i=n(9039);e.exports=r&&i(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})},2812(e){var t=TypeError;e.exports=function(e,n){if(e1?arguments[1]:void 0)}}),o(`includes`)},4114(e,t,n){var r=n(6518),i=n(8981),a=n(6198),o=n(4527),s=n(6837);r({target:`Array`,proto:!0,arity:1,forced:n(9039)(function(){return[].push.call({length:4294967296},1)!==4294967297})||!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(e){return e instanceof TypeError}}()},{push:function(e){var t=i(this),n=a(t),r=arguments.length;s(n+r);for(var c=0;cm)throw new o(`Maximum allowed index exceeded`);if(typeof e!=`number`)throw new s(`Value is not a number`);r!==_&&(e===e?e===c?r=r===v?_:y:e===-c?r=r===y?_:v:(e!==0||1/e===c)&&(r===b||r===x)&&(r=x,f(t,e)):r=_)}),r){case _:return l;case v:return-c;case y:return c;case b:return-0}for(var i=[],d=0,C,w,T,E,D,O,k=0;k=0?i[N]:0;if(N--,u(d)>1||d>0&&P>0||d<0&&P<0)return d>0?c:-c;if(T=S(d*p,P/2),E=T.hi,D=T.lo,D*=2,u(2*E)===c)return E>0?E===p&&D===-(g/2)&&N>=0&&i[N]<0?h:c:E===-p&&D===g/2&&N>=0&&i[N]>0?-h:-c;D!==0&&(i[++N]=D,D=0),E*=2}for(;N>=0&&(T=S(E,i[N--]),E=T.hi,D=T.lo,D===0););return N>=0&&(D<0&&i[N]<0||D>0&&i[N]>0)&&(w=D*2,C=E+w,w===C-E&&(E=C)),E}})},1689(e,t,n){var r=n(6518),i=n(4576),a=n(8745),o=n(7680),s=n(6043),c=n(9306),l=n(1103),u=i.Promise,d=!1;r({target:`Promise`,stat:!0,forced:!u||!u.try||l(function(){u.try(function(e){d=e===8},8)}).error||!d},{try:function(e){var t=arguments.length>1?o(arguments,1):[],n=s.f(this),r=l(function(){return a(c(e),void 0,t)});return(r.error?n.reject:n.resolve)(r.value),n.promise}})},4628(e,t,n){var r=n(6518),i=n(6043);r({target:`Promise`,stat:!0},{withResolvers:function(){var e=i.f(this);return{promise:e.promise,resolve:e.resolve,reject:e.reject}}})},7642(e,t,n){var r=n(6518),i=n(3440),a=n(9039);r({target:`Set`,proto:!0,real:!0,forced:!n(4916)(`difference`,function(e){return e.size===0})||a(function(){var e={size:1,has:function(){return!0},keys:function(){var e=0;return{next:function(){var n=e++>1;return t.has(1)&&t.clear(),{done:n,value:2}}}}},t=new Set([1,2,3,4]);return t.difference(e).size!==3})},{difference:i})},8004(e,t,n){var r=n(6518),i=n(9039),a=n(8750);r({target:`Set`,proto:!0,real:!0,forced:!n(4916)(`intersection`,function(e){return e.size===2&&e.has(1)&&e.has(2)})||i(function(){return String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))!==`3,2`})},{intersection:a})},3853(e,t,n){var r=n(6518),i=n(4449);r({target:`Set`,proto:!0,real:!0,forced:!n(4916)(`isDisjointFrom`,function(e){return!e})},{isDisjointFrom:i})},5876(e,t,n){var r=n(6518),i=n(3838);r({target:`Set`,proto:!0,real:!0,forced:!n(4916)(`isSubsetOf`,function(e){return e})},{isSubsetOf:i})},2475(e,t,n){var r=n(6518),i=n(8527);r({target:`Set`,proto:!0,real:!0,forced:!n(4916)(`isSupersetOf`,function(e){return!e})},{isSupersetOf:i})},5024(e,t,n){var r=n(6518),i=n(3650),a=n(9835);r({target:`Set`,proto:!0,real:!0,forced:!n(4916)(`symmetricDifference`)||!a(`symmetricDifference`)},{symmetricDifference:i})},1698(e,t,n){var r=n(6518),i=n(4204),a=n(9835);r({target:`Set`,proto:!0,real:!0,forced:!n(4916)(`union`)||!a(`union`)},{union:i})},9577(e,t,n){var r=n(4644),i=n(1108),a=n(6198),o=n(1291),s=n(5854),c=r.aTypedArray,l=r.getTypedArrayConstructor,u=r.exportTypedArrayMethod,d=RangeError,f=function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(e){return e===8}}(),p=f&&function(){try{new Int8Array(1).with(-.5,1)}catch{return!0}}();u(`with`,{with:function(e,t){var n=c(this),r=a(n),u=o(e),f=u<0?r+u:u,p=i(n)?s(t):+t;if(f>=r||f<0)throw new d(`Incorrect index`);for(var m=new(l(n))(r),h=0;h1?arguments[1]:void 0,null,9007199254740991).bytes)}})},6632(e,t,n){var r=n(6518),i=n(4576),a=n(9143),o=n(4154),s=i.Uint8Array,c=!s||!s.prototype.setFromBase64||!function(){var e=new s([255,255,255,255,255]);try{e.setFromBase64(``,null);return}catch{}try{e.setFromBase64(`a`);return}catch{}try{e.setFromBase64(`MjYyZg===`)}catch{return e[0]===50&&e[1]===54&&e[2]===50&&e[3]===255&&e[4]===255}}();s&&r({target:`Uint8Array`,proto:!0,forced:c},{setFromBase64:function(e){o(this);var t=a(e,arguments.length>1?arguments[1]:void 0,this,this.length);return{read:t.read,written:t.written}}})},4226(e,t,n){var r=n(6518),i=n(4576),a=n(3463),o=n(4154),s=n(5169),c=n(2303);function l(){try{new Uint8Array(new ArrayBuffer(16,{maxByteLength:1024})).setFromHex(`cafed00d`)}catch{return!0}}i.Uint8Array&&r({target:`Uint8Array`,proto:!0,forced:l()},{setFromHex:function(e){o(this),a(e),s(this.buffer);var t=c(e,this).read;return{read:t,written:t/2}}})},9486(e,t,n){var r=n(6518),i=n(4576),a=n(9504),o=n(3972),s=n(4154),c=n(5169),l=n(2804),u=n(944),d=l.i2c,f=l.i2cUrl,p=a(``.charAt),m=i.Uint8Array,h=!m||!m.prototype.toBase64||!function(){try{new m().toBase64(null)}catch{return!0}}();m&&r({target:`Uint8Array`,proto:!0,forced:h},{toBase64:function(){var e=s(this),t=arguments.length?o(arguments[0]):void 0,n=u(t)===`base64`?d:f,r=!!t&&!!t.omitPadding;c(this.buffer);for(var i=``,a=0,l=e.length,m,h=function(e){return p(n,m>>6*e&63)};a+2{if(Array.isArray(t))for(var n=0;nObject.prototype.hasOwnProperty.call(e,t),r(4423),r(4114),r(8111),r(2489),r(5367),r(2731),r(7642),r(8004),r(3853),r(5876),r(2475),r(5024),r(1698),r(9577),r(6632),r(4226),r(9486),r(456),r(5781);var i=typeof process==`object`&&process+``==`[object process]`&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!==`browser`),a=[1/0,1/0,-1/0,-1/0],o=new Float32Array(a),s=[.001,0,0,.001,0,0],c=`http://www.w3.org/2000/svg`,l={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},u={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},d=`pdfjs_internal_id_`,f=`pdfjs_internal_editor_`,p={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},m={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,INK_COLOR_AND_OPACITY:24,HIGHLIGHT_COLOR:31,HIGHLIGHT_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},h={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},g={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},_={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},v={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26,RICHMEDIA:27},y={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},b={ERRORS:0,WARNINGS:1,INFOS:5},x={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93,rawFillPath:94},S={moveTo:0,lineTo:1,curveTo:2,quadraticCurveTo:3,closePath:4},C={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},w=b.WARNINGS;function T(e){Number.isInteger(e)&&(w=e)}function E(){return w}function D(e){w>=b.INFOS&&console.info(`Info: ${e}`)}function O(e){w>=b.WARNINGS&&console.warn(`Warning: ${e}`)}function k(e){throw Error(e)}function A(e,t){e||k(t)}function j(e){switch(e?.protocol){case`http:`:case`https:`:case`ftp:`:case`mailto:`:case`tel:`:return!0;default:return!1}}function M(e,t=null,n=null){if(!e)return null;if(n&&typeof e==`string`&&(n.addDefaultProtocol&&e.startsWith(`www.`)&&e.match(/\./g)?.length>=2&&(e=`http://${e}`),n.tryConvertEncoding))try{e=oe(e)}catch{}let r=t?URL.parse(e,t):URL.parse(e);return j(r)?r:null}function N(e,t,n=!1){let r=URL.parse(e);return r?(r.hash=t,r.href):n&&M(e,`http://example.com`)?e.split(`#`,1)[0]+`${t?`#${t}`:``}`:``}function P(e){return e.substring(e.lastIndexOf(`/`)+1)}function F(e,t,n,r=!1){return Object.defineProperty(e,t,{value:n,enumerable:!r,configurable:!0,writable:!1}),n}var I=function(){function e(e,t){this.message=e,this.name=t}return e.prototype=Error(),e.constructor=e,e}(),L=class extends I{constructor(e,t){super(e,`PasswordException`),this.code=t}},R=class extends I{constructor(e,t){super(e,`UnknownErrorException`),this.details=t}},ee=class extends I{constructor(e){super(e,`InvalidPDFException`)}},te=class extends I{constructor(e,t,n){super(e,`ResponseException`),this.status=t,this.missing=n}},ne=class extends I{constructor(e){super(e,`FormatError`)}},re=class extends I{constructor(e){super(e,`AbortException`)}};function ie(e){(typeof e!=`object`||e?.length===void 0)&&k(`Invalid argument for bytesToString`);let t=e.length,n=8192;if(t`u`)return F(this,`isAlphaColorInputSupported`,!1);let e=document.createElement(`input`);return e.type=`color`,e.setAttribute(`alpha`,``),e.value=`#ff000080`,F(this,`isAlphaColorInputSupported`,e.value!==`#ff0000`)}static get isBackdropFilterSupported(){return F(this,`isBackdropFilterSupported`,typeof CSS<`u`&&CSS.supports(`backdrop-filter`,`blur(1px)`))}},B=class{static get hexNums(){return F(this,`hexNums`,Array.from(Array(256).keys(),e=>e.toString(16).padStart(2,`0`)))}static makeHexColor(e,t,n){return`#${this.hexNums[e]}${this.hexNums[t]}${this.hexNums[n]}`}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static multiplyByDOMMatrix(e,t){return[e[0]*t.a+e[2]*t.b,e[1]*t.a+e[3]*t.b,e[0]*t.c+e[2]*t.d,e[1]*t.c+e[3]*t.d,e[0]*t.e+e[2]*t.f+e[4],e[1]*t.e+e[3]*t.f+e[5]]}static applyTransform(e,t,n=0){let r=e[n],i=e[n+1];e[n]=r*t[0]+i*t[2]+t[4],e[n+1]=r*t[1]+i*t[3]+t[5]}static applyTransformToBezier(e,t,n=0){let r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5];for(let t=0;t<6;t+=2){let l=e[n+t],u=e[n+t+1];e[n+t]=l*r+u*a+s,e[n+t+1]=l*i+u*o+c}}static applyInverseTransform(e,t){let n=e[0],r=e[1],i=t[0]*t[3]-t[1]*t[2];e[0]=(n*t[3]-r*t[2]+t[2]*t[5]-t[4]*t[3])/i,e[1]=(-n*t[1]+r*t[0]+t[4]*t[1]-t[5]*t[0])/i}static axialAlignedBoundingBox(e,t,n){let r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=e[0],u=e[1],d=e[2],f=e[3],p=r*l+s,m=p,h=r*d+s,g=h,_=o*u+c,v=_,y=o*f+c,b=y;if(i!==0||a!==0){let e=i*l,t=i*d,n=a*u,r=a*f;p+=n,g+=n,h+=r,m+=r,_+=e,b+=e,y+=t,v+=t}n[0]=Math.min(n[0],p,h,m,g),n[1]=Math.min(n[1],_,y,v,b),n[2]=Math.max(n[2],p,h,m,g),n[3]=Math.max(n[3],_,y,v,b)}static inverseTransform(e){let t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static singularValueDecompose2dScale(e,t){let n=e[0],r=e[1],i=e[2],a=e[3],o=n**2+r**2,s=n*i+r*a,c=i**2+a**2,l=(o+c)/2,u=Math.sqrt(l**2-(o*c-s**2));t[0]=Math.sqrt(l+u||1),t[1]=Math.sqrt(l-u||1)}static normalizeRect(e){let t=e.slice(0);return e[0]>e[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t}static intersect(e,t){let n=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),r=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(n>r)return null;let i=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),a=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return i>a?null:[n,i,r,a]}static pointBoundingBox(e,t,n){n[0]=Math.min(n[0],e),n[1]=Math.min(n[1],t),n[2]=Math.max(n[2],e),n[3]=Math.max(n[3],t)}static rectBoundingBox(e,t,n,r,i){i[0]=Math.min(i[0],e,n),i[1]=Math.min(i[1],t,r),i[2]=Math.max(i[2],e,n),i[3]=Math.max(i[3],t,r)}static#e(e,t,n,r,i,a,o,s,c,l){if(c<=0||c>=1)return;let u=1-c,d=c*c,f=d*c,p=u*(u*(u*e+3*c*t)+3*d*n)+f*r,m=u*(u*(u*i+3*c*a)+3*d*o)+f*s;l[0]=Math.min(l[0],p),l[1]=Math.min(l[1],m),l[2]=Math.max(l[2],p),l[3]=Math.max(l[3],m)}static#t(e,t,n,r,i,a,o,s,c,l,u,d){if(Math.abs(c)<1e-12){Math.abs(l)>=1e-12&&this.#e(e,t,n,r,i,a,o,s,-u/l,d);return}let f=l**2-4*u*c;if(f<0)return;let p=Math.sqrt(f),m=2*c;this.#e(e,t,n,r,i,a,o,s,(-l+p)/m,d),this.#e(e,t,n,r,i,a,o,s,(-l-p)/m,d)}static bezierBoundingBox(e,t,n,r,i,a,o,s,c){c[0]=Math.min(c[0],e,o),c[1]=Math.min(c[1],t,s),c[2]=Math.max(c[2],e,o),c[3]=Math.max(c[3],t,s),this.#t(e,n,i,o,t,r,a,s,3*(-e+3*(n-i)+o),6*(e-2*n+i),3*(n-e),c),this.#t(e,n,i,o,t,r,a,s,3*(-t+3*(r-a)+s),6*(t-2*r+a),3*(r-t),c)}};function oe(e){return decodeURIComponent(escape(e))}var se=null,ce=null;function le(e){return se||(se=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,ce=new Map([[`ſt`,`ſt`]])),e.replaceAll(se,(e,t,n)=>t?t.normalize(`NFKC`):ce.get(n))}function ue(){if(typeof crypto.randomUUID==`function`)return crypto.randomUUID();let e=new Uint8Array(32);return crypto.getRandomValues(e),ie(e)}function de(e,t,n){if(!Array.isArray(n)||n.length<2)return!1;let[r,i,...a]=n;if(!e(r)&&!Number.isInteger(r)||!t(i))return!1;let o=a.length,s=!0;switch(i.name){case`XYZ`:if(o<2||o>3)return!1;break;case`Fit`:case`FitB`:return o===0;case`FitH`:case`FitBH`:case`FitV`:case`FitBV`:if(o>1)return!1;break;case`FitR`:if(o!==4)return!1;s=!1;break;default:return!1}for(let e of a)if(!(typeof e==`number`||s&&e===null))return!1;return!0}var fe=()=>[],pe=()=>new Map,me=()=>Object.create(null),he=()=>new Set;typeof Blob.prototype.bytes!=`function`&&(Blob.prototype.bytes=async function(){return new Uint8Array(await this.arrayBuffer())}),typeof Response.prototype.bytes!=`function`&&(Response.prototype.bytes=async function(){return new Uint8Array(await this.arrayBuffer())}),typeof Iterator.prototype.join!=`function`&&(Iterator.prototype.join=function(e){return[...this].join(e)}),r(1701);function V(e,t,n){return Math.min(Math.max(e,t),n)}var ge=class e{constructor({viewBox:e,userUnit:t,scale:n,rotation:r,offsetX:i=0,offsetY:a=0,dontFlip:o=!1}){this.viewBox=e,this.userUnit=t,this.scale=n,this.rotation=r,this.offsetX=i,this.offsetY=a,n*=t;let s=(e[2]+e[0])/2,c=(e[3]+e[1])/2,l,u,d,f;switch(r%=360,r<0&&(r+=360),r){case 180:l=-1,u=0,d=0,f=1;break;case 90:l=0,u=1,d=1,f=0;break;case 270:l=0,u=-1,d=-1,f=0;break;case 0:l=1,u=0,d=0,f=-1;break;default:throw Error(`PageViewport: Invalid rotation, must be a multiple of 90 degrees.`)}o&&(d=-d,f=-f);let p,m,h,g;l===0?(p=Math.abs(c-e[1])*n+i,m=Math.abs(s-e[0])*n+a,h=(e[3]-e[1])*n,g=(e[2]-e[0])*n):(p=Math.abs(s-e[0])*n+i,m=Math.abs(c-e[1])*n+a,h=(e[2]-e[0])*n,g=(e[3]-e[1])*n),this.transform=[l*n,u*n,d*n,f*n,p-l*n*s-d*n*c,m-u*n*s-f*n*c],this.width=h,this.height=g}get rawDims(){let e=this.viewBox;return F(this,`rawDims`,{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone({scale:t=this.scale,rotation:n=this.rotation,offsetX:r=this.offsetX,offsetY:i=this.offsetY,dontFlip:a=!1}={}){return new e({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:t,rotation:n,offsetX:r,offsetY:i,dontFlip:a})}convertToViewportPoint(e,t){let n=[e,t];return B.applyTransform(n,this.transform),n}convertToPdfPoint(e,t){let n=[e,t];return B.applyInverseTransform(n,this.transform),n}},_e=class e{static textContent(t){let n=[],r={items:n,styles:Object.create(null)};function i(t){if(!t)return;let r=null,a=t.name;if(a===`#text`)r=t.value;else if(e.shouldBuildText(a))t?.attributes?.textContent?r=t.attributes.textContent:t.value&&(r=t.value);else return;if(r!==null&&n.push({str:r}),t.children)for(let e of t.children)i(e)}return i(t),r}static shouldBuildText(e){return!(e===`textarea`||e===`input`||e===`option`||e===`select`)}},ve=/url\(|image-set\(/i,ye=/^on/i,be=class{static get _allowedHtmlElements(){return F(this,`_allowedHtmlElements`,new Set([`a`,`b`,`br`,`button`,`div`,`i`,`img`,`input`,`label`,`li`,`ol`,`option`,`p`,`select`,`span`,`sub`,`sup`,`textarea`,`ul`]))}static get _allowedSvgElements(){return F(this,`_allowedSvgElements`,new Set([`ellipse`,`line`,`path`,`rect`,`svg`]))}static get _allowedRichTextElements(){return F(this,`_allowedRichTextElements`,new Set([`a`,`b`,`br`,`div`,`i`,`li`,`ol`,`p`,`span`,`sub`,`sup`,`ul`]))}static get _allowedRichTextAttributes(){return F(this,`_allowedRichTextAttributes`,new Set([`class`,`dir`,`style`]))}static get _allowedRichTextStyles(){return F(this,`_allowedRichTextStyles`,new Set(`color.font.fontFamily.fontSize.fontStretch.fontStyle.fontWeight.kerningMode.letterSpacing.lineHeight.margin.marginBottom.marginLeft.marginRight.marginTop.orphans.paddingLeft.paddingRight.breakAfter.breakBefore.breakInside.tabInterval.tabStop.textAlign.textDecoration.textIndent.transform.verticalAlign.widows`.split(`.`)))}static setupStorage(e,t,n,r,i){let a=r.getValue(t,{value:null});switch(n.name){case`textarea`:if(a.value!==null&&(e.textContent=a.value),i===`print`)break;e.addEventListener(`input`,e=>{r.setValue(t,{value:e.target.value})});break;case`input`:if(n.attributes.type===`radio`||n.attributes.type===`checkbox`){if(a.value===n.attributes.xfaOn?e.setAttribute(`checked`,!0):a.value===n.attributes.xfaOff&&e.removeAttribute(`checked`),i===`print`)break;e.addEventListener(`change`,e=>{r.setValue(t,{value:e.target.checked?e.target.getAttribute(`xfaOn`):e.target.getAttribute(`xfaOff`)})})}else{if(a.value!==null&&e.setAttribute(`value`,a.value),i===`print`)break;e.addEventListener(`input`,e=>{r.setValue(t,{value:e.target.value})})}break;case`select`:if(a.value!==null){e.setAttribute(`value`,a.value);for(let e of n.children)e.attributes.value===a.value?e.attributes.selected=!0:Object.hasOwn(e.attributes,`selected`)&&delete e.attributes.selected}e.addEventListener(`input`,e=>{let n=e.target.options,i=n.selectedIndex===-1?``:n[n.selectedIndex].value;r.setValue(t,{value:i})});break}}static setAttributes({html:e,element:t,storage:n=null,intent:r,linkService:i}){let{attributes:a}=t,o=e instanceof HTMLAnchorElement;a.type===`radio`&&(a.name=`${a.name}-${r}`);for(let[t,n]of Object.entries(a))if(n!=null&&!ye.test(t)&&!(r===`richText`&&!this._allowedRichTextAttributes.has(t)))switch(t){case`class`:n.length&&e.setAttribute(t,n.join(` `));break;case`dataId`:break;case`id`:e.setAttribute(`data-element-id`,n);break;case`style`:if(r===`richText`){let t=this._allowedRichTextStyles;for(let[r,i]of Object.entries(n))t.has(r)&&!ve.test(i)&&(e.style[r]=i)}else Object.assign(e.style,n);break;case`textContent`:e.textContent=n;break;default:(!o||t!==`href`&&t!==`newWindow`)&&e.setAttribute(t,n)}o&&i?.addLinkAttributes(e,a.href,a.newWindow),n&&a.dataId&&this.setupStorage(e,a.dataId,t,n)}static#e(e,t,n){return n===`richText`?!t&&this._allowedRichTextElements.has(e)?document.createElement(e):null:t?t===c&&this._allowedSvgElements.has(e)?document.createElementNS(c,e):null:this._allowedHtmlElements.has(e)?document.createElement(e):null}static render(e){let t=e.annotationStorage,n=e.linkService,r=e.xfaHtml,i=e.intent||`display`,a=this.#e(r.name,r.attributes?.xmlns,i)??document.createElement(`div`);r.attributes&&this.setAttributes({html:a,element:r,intent:i,linkService:n});let o=i!==`richText`,s=e.div;if(s.append(a),e.viewport){let t=`matrix(${e.viewport.transform.join(`,`)})`;s.style.transform=t}o&&s.setAttribute(`class`,`xfaLayer xfaFont`);let c=[];if(r.children.length===0){if(r.value){let e=document.createTextNode(r.value);a.append(e),o&&_e.shouldBuildText(r.name)&&c.push(e)}return{textDivs:c}}let l=[[r,-1,a]];for(;l.length>0;){let[e,r,a]=l.at(-1);if(r+1===e.children.length){l.pop();continue}let s=e.children[++l.at(-1)[1]];if(s===null)continue;let{name:u}=s;if(u===`#text`){let e=document.createTextNode(s.value);c.push(e),a.append(e);continue}let d=this.#e(u,s.attributes?.xmlns,i);if(d){if(a.append(d),s.attributes&&this.setAttributes({html:d,element:s,storage:t,intent:i,linkService:n}),s.children?.length>0)l.push([s,-1,d]);else if(s.value){let e=document.createTextNode(s.value);o&&_e.shouldBuildText(u)&&c.push(e),d.append(e)}}}for(let e of s.querySelectorAll(`.xfaNonInteractive input, .xfaNonInteractive textarea`))e.setAttribute(`readOnly`,!0);return{textDivs:c}}static update(e){let t=`matrix(${e.viewport.transform.join(`,`)})`;e.div.style.transform=t,e.div.hidden=!1}static getPageViewport(e,{scale:t=1,rotation:n=0}){let{width:r,height:i}=e.attributes.style;return new ge({viewBox:[0,0,parseInt(r,10),parseInt(i,10)],userUnit:1,scale:t,rotation:n})}},xe=class{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF};async function Se(e,t=`text`){if(ke(e,document.baseURI)){let n=await fetch(e);if(!n.ok)throw Error(n.statusText);switch(t){case`blob`:return n.blob();case`bytes`:return n.bytes();case`json`:return n.json()}return n.text()}return new Promise((n,r)=>{let i=new XMLHttpRequest;i.open(`GET`,e,!0),i.responseType=t===`bytes`?`arraybuffer`:t,i.onreadystatechange=()=>{if(i.readyState===XMLHttpRequest.DONE){if(i.status===200||i.status===0){switch(t){case`bytes`:n(new Uint8Array(i.response));return;case`blob`:case`json`:n(i.response);return}n(i.responseText);return}r(Error(i.statusText))}},i.send(null)})}var Ce=class extends I{constructor(e,t=0){super(e,`RenderingCancelledException`),this.extraDelay=t}};function we(e){let t=e.length,n=0;for(;n{try{return new URL(e)}catch{}try{return new URL(decodeURIComponent(e))}catch{}try{return new URL(e,`https://foo.bar`)}catch{}try{return new URL(decodeURIComponent(e),`https://foo.bar`)}catch{}return null})(e);if(!n)return t;let r=e=>{try{let t=decodeURIComponent(e);return t.includes(`/`)&&(t=P(t),t.length===4&&i.test(t))?e:t}catch{return e}},i=/\.pdf$/i,a=P(n.pathname);if(i.test(a))return r(a);if(n.searchParams.size>0){let e=e=>[...e].findLast(e=>i.test(e)),t=e(n.searchParams.values())??e(n.searchParams.keys());if(t)return r(t)}if(n.hash){let e=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(n.hash);if(e)return r(e[0])}return t}var Oe=class{#e=new Map;times=[];time(e){this.#e.has(e)&&O(`Timer is already running for ${e}`),this.#e.set(e,Date.now())}timeEnd(e){this.#e.has(e)||O(`Timer has not been started for ${e}`),this.times.push({name:e,start:this.#e.get(e),end:Date.now()}),this.#e.delete(e)}toString(){let e=Math.max(...this.times.map(e=>e.name.length));return this.times.map(t=>`${t.name.padEnd(e)} ${t.end-t.start}ms\n`).join(``)}};function ke(e,t){let n=t?URL.parse(e,t):URL.parse(e);return/https?:/.test(n?.protocol??``)}function H(e){e.preventDefault()}function U(e){e.preventDefault(),e.stopPropagation()}var Ae=class{static#e;static toDateObject(e){if(e instanceof Date)return e;if(!e||typeof e!=`string`)return null;this.#e||=RegExp(`^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+\\-])?(\\d{2})?'?(\\d{2})?'?`);let t=this.#e.exec(e);if(!t)return null;let n=parseInt(t[1],10),r=parseInt(t[2],10);r=r>=1&&r<=12?r-1:0;let i=parseInt(t[3],10);i=i>=1&&i<=31?i:1;let a=parseInt(t[4],10);a=a>=0&&a<=23?a:0;let o=parseInt(t[5],10);o=o>=0&&o<=59?o:0;let s=parseInt(t[6],10);s=s>=0&&s<=59?s:0;let c=t[7]||`Z`,l=parseInt(t[8],10);l=l>=0&&l<=23?l:0;let u=parseInt(t[9],10)||0;return u=u>=0&&u<=59?u:0,c===`-`?(a+=l,o+=u):c===`+`&&(a-=l,o-=u),new Date(Date.UTC(n,r,i,a,o,s))}};function je(e){if(e.startsWith(`#`)){let t=e.slice(1);return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16),t.length>=8?parseInt(t.slice(6,8),16)/255:1]}if(e.startsWith(`rgb(`)){let[t,n,r]=e.slice(4,-1).split(`,`).map(e=>parseInt(e,10));return[t,n,r,1]}if(e.startsWith(`rgba(`)){let t=e.slice(5,-1).split(`,`);return[parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3])]}let t=e.match(/^color\(srgb\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)(?:\s*\/\s*([\d.]+|none))?\)$/);return t?[Math.round(parseFloat(t[1])*255),Math.round(parseFloat(t[2])*255),Math.round(parseFloat(t[3])*255),t[4]!==void 0&&t[4]!==`none`?parseFloat(t[4]):1]:null}function Me(e){let t=je(e);return t?t.slice(0,3):(O(`Not a valid color format: "${e}"`),[0,0,0])}function Ne(e){let t=document.createElement(`span`);t.style.visibility=`hidden`,t.style.colorScheme=`only light`,document.body.append(t);for(let n of e.keys()){t.style.color=n;let r=window.getComputedStyle(t).color;e.set(n,Me(r))}t.remove()}function W(e){let{a:t,b:n,c:r,d:i,e:a,f:o}=e.getTransform();return[t,n,r,i,a,o]}function Pe(e){let{a:t,b:n,c:r,d:i,e:a,f:o}=e.getTransform().invertSelf();return[t,n,r,i,a,o]}function Fe(e,t,n=!1,r=!0){if(t instanceof ge){let{pageWidth:r,pageHeight:i}=t.rawDims,{style:a}=e,o=`round(down, var(--total-scale-factor) * ${r}px, var(--scale-round-x))`,s=`round(down, var(--total-scale-factor) * ${i}px, var(--scale-round-y))`;!n||t.rotation%180==0?(a.width=o,a.height=s):(a.width=s,a.height=o)}r&&e.setAttribute(`data-main-rotation`,t.rotation)}var Ie=class e{constructor(){let{pixelRatio:t}=e;this.sx=t,this.sy=t}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}limitCanvas(t,n,r,i,a=-1){let o=1/0,s=1/0,c=1/0;r=e.capPixels(r,a),r>0&&(o=Math.sqrt(r/(t*n))),i!==-1&&(s=i/t,c=i/n);let l=Math.min(o,s,c);return this.sx>l||this.sy>l?(this.sx=l,this.sy=l,!0):!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(e,t){if(t>=0){let n=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+t/100));return e>0?Math.min(e,n):n}return e}},Le=[`image/apng`,`image/avif`,`image/bmp`,`image/gif`,`image/jpeg`,`image/png`,`image/svg+xml`,`image/webp`,`image/x-icon`],Re=class{static get isDarkMode(){return F(this,`isDarkMode`,!!window?.matchMedia?.(`(prefers-color-scheme: dark)`).matches)}},ze=class{static get commentForegroundColor(){let e=document.createElement(`span`);e.classList.add(`comment`,`sidebar`);let{style:t}=e;t.width=t.height=`0`,t.display=`none`,t.color=`var(--comment-fg-color)`,document.body.append(e);let{color:n}=window.getComputedStyle(e);return e.remove(),F(this,`commentForegroundColor`,Me(n))}};function Be(e,t){t=V(t??1,0,1);let n=255*(1-t);return e.map(e=>Math.round(e*t+n))}function Ve(e,t){let n=e[0]/255,r=e[1]/255,i=e[2]/255,a=Math.max(n,r,i),o=Math.min(n,r,i),s=(a+o)/2;if(a===o)t[0]=t[1]=0;else{let e=a-o;switch(t[1]=s<.5?e/(a+o):e/(2-a-o),a){case n:t[0]=((r-i)/e+(ri?(r+.05)/(i+.05):(i+.05)/(r+.05)}var Ge=new Map;function Ke(e,t){let n=e[0]+e[1]*256+e[2]*65536+t[0]*16777216+t[1]*4294967296+t[2]*1099511627776,r=Ge.get(n);if(r)return r;let i=new Float32Array(9),a=i.subarray(0,3),o=i.subarray(3,6);Ve(e,o);let s=i.subarray(6,9);Ve(t,s);let c=s[2]<.5,l=c?12:4.5;if(o[2]=c?Math.sqrt(o[2]):1-Math.sqrt(1-o[2]),We(o,s,a).005;){let n=o[2]=(e+t)/2;c===We(o,s,a){n.delete()},{signal:n._signal}),this.#r.append(r)}get#p(){let e=document.createElement(`div`);return e.className=`divider`,e}async addAltText(e){let t=await e.render();this.#f(t),this.#r.append(t,this.#p),this.#i=e}addComment(e,t=null){if(this.#a)return;let n=e.renderForToolbar();if(!n)return;this.#f(n);let r=this.#o=this.#p;t?(this.#r.insertBefore(n,t),this.#r.insertBefore(r,t)):this.#r.append(n,r),this.#a=e,e.toolbar=this}addColorPicker(e){if(this.#t)return;this.#t=e;let t=e.renderButton();this.#f(t),this.#r.append(t,this.#p)}async addEditSignatureButton(e){let t=this.#s=await e.renderEditButton(this.#n);this.#f(t),this.#r.append(t,this.#p)}removeButton(e){switch(e){case`comment`:this.#a?.removeToolbarCommentButton(),this.#a=null,this.#o?.remove(),this.#o=null;break}}async addButton(e,t){switch(e){case`colorPicker`:t&&this.addColorPicker(t);break;case`altText`:t&&await this.addAltText(t);break;case`editSignature`:t&&await this.addEditSignatureButton(t);break;case`delete`:this.addDeleteButton();break;case`comment`:t&&this.addComment(t);break}}async addButtonBefore(e,t,n){if(!t&&e===`comment`)return;let r=this.#r.querySelector(n);r&&e===`comment`&&this.addComment(t,r)}updateEditSignatureButton(e){this.#s&&(this.#s.title=e)}remove(){this.#e.remove(),this.#t?.destroy(),this.#t=null}},Xe=class{#e=null;#t=null;#n;constructor(e){this.#n=e}#r(){let e=this.#t=document.createElement(`div`);e.className=`editToolbar`,e.setAttribute(`role`,`toolbar`);let t=this.#n._signal;t instanceof AbortSignal&&!t.aborted&&e.addEventListener(`contextmenu`,H,{signal:t});let n=this.#e=document.createElement(`div`);return n.className=`buttons`,e.append(n),this.#n.hasCommentManager()&&this.#a(`commentButton`,`pdfjs-comment-floating-button`,`pdfjs-comment-floating-button-label`,()=>{this.#n.commentSelection(`floating_button`)}),this.#a(`highlightButton`,`pdfjs-highlight-floating-button1`,`pdfjs-highlight-floating-button-label`,()=>{this.#n.highlightSelection(`floating_button`)}),e}#i(e,t){let n=0,r=0;for(let i of e){let e=i.y+i.height;if(en){r=a,n=e;continue}t?a>r&&(r=a):a=1}static clearPointerType(){e.#r=null}static clearPointerIds(){e.#e=NaN,e.#t=null}static clearTimeStamp(){e.#n=NaN}},$e=class{#e=0;get id(){return`${f}${this.#e++}`}},et=class e{#e=ue();#t=0;#n=null;static get _isSVGFittingCanvas(){let e=`data:image/svg+xml;charset=UTF-8,`,t=new OffscreenCanvas(1,3).getContext(`2d`,{willReadFrequently:!0}),n=new Image;n.src=e;let r=n.decode().then(()=>(t.drawImage(n,0,0,1,1,0,0,1,3),new Uint32Array(t.getImageData(0,0,1,1).data.buffer)[0]===0));return F(this,`_isSVGFittingCanvas`,r)}async#r(t,n){this.#n||=new Map;let r=this.#n.get(t);if(r===null)return null;if(r?.bitmap)return r.refCounter+=1,r;try{r||={bitmap:null,id:`image_${this.#e}_${this.#t++}`,refCounter:0,isSvg:!1};let t;if(typeof n==`string`?(r.url=n,t=await Se(n,`blob`)):n instanceof File?t=r.file=n:n instanceof Blob&&(t=n),t.type===`image/svg+xml`){let n=e._isSVGFittingCanvas,i=new FileReader,a=new Image,o=new Promise((e,t)=>{a.onload=()=>{r.bitmap=a,r.isSvg=!0,e()},i.onload=async()=>{let e=r.svgUrl=i.result;a.src=await n?`${e}#svgView(preserveAspectRatio(none))`:e},a.onerror=i.onerror=t});i.readAsDataURL(t),await o}else r.bitmap=await createImageBitmap(t);r.refCounter=1}catch(e){O(e),r=null}return this.#n.set(t,r),r&&this.#n.set(r.id,r),r}async getFromFile(e){let{lastModified:t,name:n,size:r,type:i}=e;return this.#r(`${t}_${n}_${r}_${i}`,e)}async getFromUrl(e){return this.#r(e,e)}async getFromBlob(e,t){let n=await t;return this.#r(e,n)}async getFromId(e){this.#n||=new Map;let t=this.#n.get(e);if(!t)return null;if(t.bitmap)return t.refCounter+=1,t;if(t.file)return this.getFromFile(t.file);if(t.blobPromise){let{blobPromise:e}=t;return delete t.blobPromise,this.getFromBlob(t.id,e)}return this.getFromUrl(t.url)}getFromCanvas(e,t){this.#n||=new Map;let n=this.#n.get(e);if(n?.bitmap)return n.refCounter+=1,n;let r=new OffscreenCanvas(t.width,t.height);return r.getContext(`2d`).drawImage(t,0,0),n={bitmap:r.transferToImageBitmap(),id:`image_${this.#e}_${this.#t++}`,refCounter:1,isSvg:!1},this.#n.set(e,n),this.#n.set(n.id,n),n}getSvgUrl(e){let t=this.#n.get(e);return t?.isSvg?t.svgUrl:null}deleteId(e){this.#n||=new Map;let t=this.#n.get(e);if(!t||(--t.refCounter,t.refCounter!==0))return;let{bitmap:n}=t;if(!t.url&&!t.file){let e=new OffscreenCanvas(n.width,n.height);e.getContext(`bitmaprenderer`).transferFromImageBitmap(n),t.blobPromise=e.convertToBlob()}n.close?.(),t.bitmap=null}isValidId(e){return e.startsWith(`image_${this.#e}_`)}},tt=class{#e=[];#t=!1;#n;#r=-1;constructor(e=128){this.#n=e}add({cmd:e,undo:t,post:n,mustExec:r,type:i=NaN,overwriteIfSameType:a=!1,keepUndo:o=!1}){if(r&&e(),this.#t)return;let s={cmd:e,undo:t,post:n,type:i};if(this.#r===-1){this.#e.length>0&&(this.#e.length=0),this.#r=0,this.#e.push(s);return}if(a&&this.#e[this.#r].type===i){o&&(s.undo=this.#e[this.#r].undo),this.#e[this.#r]=s;return}let c=this.#r+1;c===this.#n?this.#e.splice(0,1):(this.#r=c,c=0;t--)if(this.#e[t].type!==e){this.#e.splice(t+1,this.#r-t),this.#r=t;return}this.#e.length=0,this.#r=-1}}destroy(){this.#e=null}},nt=class e{static ALT=1;static CTRL=2;static META=4;static SHIFT=8;constructor(t){this.callbacks=new Map;let{isMac:n}=z.platform;for(let[r,i,a={}]of t){let t=r.some(e=>e.startsWith(`mac+`));for(let o of r){let r=o;if(t){let e=o.startsWith(`mac+`);if(n!==e)continue;e&&(r=o.slice(4))}let[s,c]=e.#e(r);s!==null&&this.callbacks.getOrInsertComputed(s,fe).push({callback:i,options:a,modifiers:c})}}}static#e(t){let n=null,r=0;for(let i of t.split(`+`)){if(i=i.trim(),!i)continue;let a=i.toUpperCase(),o=e[a];if(o){r|=o;continue}if(n!==null){O(`KeyboardManager: multiple keys in shortcut "${t}"`);break}n=a===`SPACE`?` `:i}return n===null&&O(`KeyboardManager: no key found in shortcut "${t}"`),[n,r]}static#t(e){let t=/^(?:Key([A-Z])|(?:Digit|Numpad)(\d))$/.exec(e);return t?t[1]?.toLowerCase()??t[2]:null}exec(t,n){let r=this.callbacks.get(n.key);if(!r){if(/^[a-z]$/i.test(n.key))return;let t=e.#t(n.code);if(t===null||t===n.key||(r=this.callbacks.get(t),!r))return}let i=(n.altKey?e.ALT:0)|(n.ctrlKey?e.CTRL:0)|(n.metaKey?e.META:0)|(n.shiftKey?e.SHIFT:0),a=r.find(e=>e.modifiers===i);if(!a)return;let{callback:o,options:{bubbles:s=!1,args:c=[],checker:l=null}}=a;l&&!l(t,n)||(o.bind(t,...c,n)(),s||U(n))}},rt=class e{static _colorsMapping=new Map([[`CanvasText`,[0,0,0]],[`Canvas`,[255,255,255]]]);get _colors(){let e=new Map([[`CanvasText`,null],[`Canvas`,null]]);return Ne(e),F(this,`_colors`,e)}convert(t){let n=Me(t);if(!window.matchMedia(`(forced-colors: active)`).matches)return n;for(let[t,r]of this._colors)if(r.every((e,t)=>e===n[t]))return e._colorsMapping.get(t);return n}getHexCode(e){let t=this._colors.get(e);return t?B.makeHexColor(...t):e}},it=class e{#e=new AbortController;#t=null;#n=null;#r=new Map;#i=new Map;#a=null;#o=null;#s=null;#c=null;#l=new tt;#u=null;#d=null;#f=null;#p=0;#m=new Set;#h=null;#g=null;#_=new Set;_editorUndoBar=null;#v=!1;#y=!1;#b=!1;#x=null;#S=null;#C=null;#w=null;#T=!1;#E=null;#D=new $e;#O=!1;#k=!1;#A=!1;#j=null;#M=null;#N=null;#P=null;#F=null;#I=p.NONE;#L=new Set;#R=null;#z=null;#B=null;#V=null;#H=null;#U={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#W=[0,0];#G=null;#K=null;#q=null;#J=null;#Y=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){let t=e.prototype,n=e=>e.#K.contains(document.activeElement)&&document.activeElement.tagName!==`BUTTON`&&e.hasSomethingToControl(),r=(e,{target:t})=>{if(t instanceof HTMLInputElement){let{type:e}=t;return e!==`text`&&e!==`number`}return!0},i=this.TRANSLATE_SMALL,a=this.TRANSLATE_BIG;return F(this,`_keyboardManager`,new nt([[[`ctrl+a`,`mac+meta+a`],t.selectAll,{checker:r}],[[`ctrl+z`,`mac+meta+z`],t.undo,{checker:r}],[[`ctrl+y`,`ctrl+shift+z`,`mac+meta+shift+z`,`ctrl+shift+Z`,`mac+meta+shift+Z`],t.redo,{checker:r}],[[`Backspace`,`alt+Backspace`,`ctrl+Backspace`,`shift+Backspace`,`mac+Backspace`,`mac+alt+Backspace`,`mac+ctrl+Backspace`,`Delete`,`ctrl+Delete`,`shift+Delete`,`mac+Delete`],t.delete,{checker:r}],[[`Enter`],t.addNewEditorFromKeyboard,{checker:(e,{target:t})=>!(t instanceof HTMLButtonElement)&&e.#K.contains(t)&&!e.isEnterHandled}],[[`Space`],t.addNewEditorFromKeyboard,{checker:(e,{target:t})=>!(t instanceof HTMLButtonElement)&&e.#K.contains(document.activeElement)}],[[`Escape`],t.unselectAll],[[`ArrowLeft`],t.translateSelectedEditors,{args:[-i,0],checker:n}],[[`ctrl+ArrowLeft`,`mac+shift+ArrowLeft`],t.translateSelectedEditors,{args:[-a,0],checker:n}],[[`ArrowRight`],t.translateSelectedEditors,{args:[i,0],checker:n}],[[`ctrl+ArrowRight`,`mac+shift+ArrowRight`],t.translateSelectedEditors,{args:[a,0],checker:n}],[[`ArrowUp`],t.translateSelectedEditors,{args:[0,-i],checker:n}],[[`ctrl+ArrowUp`,`mac+shift+ArrowUp`],t.translateSelectedEditors,{args:[0,-a],checker:n}],[[`ArrowDown`],t.translateSelectedEditors,{args:[0,i],checker:n}],[[`ctrl+ArrowDown`,`mac+shift+ArrowDown`],t.translateSelectedEditors,{args:[0,a],checker:n}]]))}constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=this._signal=this.#e.signal;this.#K=e,this.#q=t,this.#J=n,this.#o=r,this.#u=i,this.#z=a,this.#H=s,this._eventBus=o;let _={signal:g,...Ze};o.on(`editingaction`,this.onEditingAction.bind(this),_),o.on(`pagechanging`,this.onPageChanging.bind(this),_),o.on(`scalechanging`,this.onScaleChanging.bind(this),_),o.on(`rotationchanging`,this.onRotationChanging.bind(this),_),o.on(`setpreference`,this.onSetPreference.bind(this),_),o.on(`switchannotationeditorparams`,e=>this.updateParams(e.type,e.value),_),window.addEventListener(`pointerdown`,()=>{this.#k=!0},{capture:!0,signal:g}),window.addEventListener(`pointerup`,()=>{this.#k=!1},{capture:!0,signal:g}),window.addEventListener(`beforeunload`,this.endCurrentEditing.bind(this),{capture:!0,signal:g}),this.#te(),this.#ce(),this.#ie(),this.#s=s.annotationStorage,this.#x=s.filterFactory,this.#B=c,this.#w=l||null,this.#v=u,this.#y=d,this.#b=f,this.#F=p||null,this.viewParameters={realScale:xe.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=m||null,this._supportsPinchToZoom=h!==!1,i?.setSidebarUiManager(this)}destroy(){this.#Y?.resolve(),this.#Y=null,this.#e?.abort(),this.#e=null,this._signal=null;for(let e of this.#i.values())e.destroy();this.#i.clear(),this.#r.clear(),this.#_.clear(),this.#P?.clear(),this.#t=null,this.#L.clear(),this.#l.destroy(),this.#o?.destroy(),this.#u?.destroy(),this.#z?.destroy(),this.#E?.hide(),this.#E=null,this.#N?.destroy(),this.#N=null,this.#n=null,this.#S&&=(clearTimeout(this.#S),null),this.#G&&=(clearTimeout(this.#G),null),this._editorUndoBar?.destroy(),this.#H=null}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return this.#F}get useNewAltTextFlow(){return this.#y}get useNewAltTextWhenAddingImage(){return this.#b}get hcmFilter(){return F(this,`hcmFilter`,this.#B?this.#x.addHCMFilter(this.#B.foreground,this.#B.background):`none`)}get direction(){return F(this,`direction`,getComputedStyle(this.#K).direction)}get _highlightColors(){return F(this,`_highlightColors`,this.#w?new Map(this.#w.split(`,`).map(e=>(e=e.split(`=`).map(e=>e.trim()),e[1]=e[1].toUpperCase(),e))):null)}get highlightColors(){let{_highlightColors:e}=this;if(!e)return F(this,`highlightColors`,null);let t=new Map,n=!!this.#B;for(let[r,i]of e){let e=r.endsWith(`_HCM`);if(n&&e){t.set(r.replace(`_HCM`,``),i);continue}!n&&!e&&t.set(r,i)}return F(this,`highlightColors`,t)}get highlightColorNames(){return F(this,`highlightColorNames`,this.highlightColors?new Map(Array.from(this.highlightColors,e=>e.reverse())):null)}getNonHCMColor(e){if(!this._highlightColors)return e;let t=this.highlightColorNames.get(e);return this._highlightColors.get(t)||e}getNonHCMColorName(e){return this.highlightColorNames.get(e)||e}setCurrentDrawingSession(e){e?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),this.#f=e}setMainHighlightColorPicker(e){this.#N=e}editAltText(e,t=!1){this.#o?.editAltText(this,e,t)}hasCommentManager(){return!!this.#u}editComment(e,t,n,r){this.#u?.showDialog(this,e,t,n,r)}selectComment(e,t){(this.#i.get(e)?.getEditorByUID(t))?.toggleComment(!0,!0)}updateComment(e){this.#u?.updateComment(e.getData())}updatePopupColor(e){this.#u?.updatePopupColor(e)}removeComment(e){this.#u?.removeComments([e.uid])}deleteComment(e,t){let n=()=>{e.comment=t};this.addCommands({cmd:()=>{this._editorUndoBar?.show(n,`comment`),this.toggleComment(null),e.comment=null},undo:n,mustExec:!0})}toggleComment(e,t,n=void 0){this.#u?.toggleCommentPopup(e,t,n)}makeCommentColor(e,t){return e&&this.#u?.makeCommentColor(e,t)||null}getCommentDialogElement(){return this.#u?.dialogElement||null}async waitForEditorsRendered(e){if(this.#i.has(e-1))return;let{resolve:t,promise:n}=Promise.withResolvers(),r=n=>{n.pageNumber===e&&(this._eventBus.off(`editorsrendered`,r),t())};this._eventBus.on(`editorsrendered`,r,Ze),await n}getSignature(e){this.#z?.getSignature({uiManager:this,editor:e})}get signatureManager(){return this.#z}switchToMode(e,t){this._eventBus.on(`annotationeditormodechanged`,t,{once:!0,signal:this._signal,...Ze}),this._eventBus.dispatch(`showannotationeditorui`,{source:this,mode:e})}setPreference(e,t){this._eventBus.dispatch(`setpreference`,{source:this,name:e,value:t})}onSetPreference({name:e,value:t}){switch(e){case`enableNewAltTextWhenAddingImage`:this.#b=t;break}}onPageChanging({pageNumber:e}){this.#p=e-1}deletePage(e){for(let t of this.getEditors(e))t.remove();this.#i.delete(e),this.#p===e&&(this.#p=0)}focusMainContainer(){this.#K.focus()}findParent(e,t){for(let n of this.#i.values()){let{x:r,y:i,width:a,height:o}=n.div.getBoundingClientRect();if(e>=r&&e<=r+a&&t>=i&&t<=i+o)return n}return null}disableUserSelect(e=!1){this.#q.classList.toggle(`noUserSelect`,e)}addShouldRescale(e){this.#_.add(e)}removeShouldRescale(e){this.#_.delete(e)}onScaleChanging({scale:e}){this.commitOrRemove(),this.viewParameters.realScale=e*xe.PDF_TO_CSS_UNITS;for(let e of this.#_)e.onScaleChanging();this.#f?.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}#X({anchorNode:e}){return e.nodeType===Node.TEXT_NODE?e.parentElement:e}#Z(e){let{currentLayer:t}=this;if(t.hasTextLayer(e))return t;for(let t of this.#i.values())if(t.hasTextLayer(e))return t;return null}highlightSelection(e=``,t=!1){let n=document.getSelection();if(!n||n.isCollapsed)return;let{anchorNode:r,anchorOffset:i,focusNode:a,focusOffset:o}=n,s=n.toString(),c=this.#X(n).closest(`.textLayer`),l=this.getSelectionBoxes(c);if(!l)return;n.empty();let u=this.#Z(c),d=this.#I===p.NONE,f=()=>{let n=u?.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:l,anchorNode:r,anchorOffset:i,focusNode:a,focusOffset:o,text:s});d&&this.showAllEditors(`highlight`,!0,!0),t&&n?.editComment()};if(d){this.switchToMode(p.HIGHLIGHT,f);return}f()}commentSelection(e=``){this.highlightSelection(e,!0)}endCurrentEditing(){this.commitOrRemove(),this.currentLayer?.endDrawingSession(!1)}#Q(){let e=document.getSelection();if(!e||e.isCollapsed)return;let t=this.#X(e).closest(`.textLayer`),n=this.getSelectionBoxes(t);n&&(this.#E||=new Xe(this),this.#E.show(t,n,this.direction===`ltr`))}getAndRemoveDataFromAnnotationStorage(e){if(!this.#s)return null;let t=`${f}${e}`,n=this.#s.getRawValue(t);return n&&this.#s.remove(t),n}addToAnnotationStorage(e){!e.isEmpty()&&this.#s&&!this.#s.has(e.id)&&this.#s.setValue(e.id,e)}a11yAlert(e,t=null){let n=this.#J;n&&(n.setAttribute(`data-l10n-id`,e),t?n.setAttribute(`data-l10n-args`,JSON.stringify(t)):n.removeAttribute(`data-l10n-args`))}#$(){let e=document.getSelection();if(!e||e.isCollapsed){this.#R&&(this.#E?.hide(),this.#R=null,this.#le({hasSelectedText:!1}));return}let{anchorNode:t}=e;if(t===this.#R)return;let n=this.#X(e).closest(`.textLayer`);if(!n){this.#R&&(this.#E?.hide(),this.#R=null,this.#le({hasSelectedText:!1}));return}if(this.#E?.hide(),this.#R=t,this.#le({hasSelectedText:!0}),!(this.#I!==p.HIGHLIGHT&&this.#I!==p.NONE)&&(this.#I===p.HIGHLIGHT&&this.showAllEditors(`highlight`,!0,!0),this.#T=this.isShiftKeyDown,!this.isShiftKeyDown)){let e=this.#I===p.HIGHLIGHT?this.#Z(n):null;if(e?.toggleDrawing(),this.#k){let t=new AbortController,n=this.combinedSignal(t),r=n=>{n.type===`pointerup`&&n.button!==0||(t.abort(),e?.toggleDrawing(!0),n.type===`pointerup`&&this.#ee(`main_toolbar`))};window.addEventListener(`pointerup`,r,{signal:n}),window.addEventListener(`blur`,r,{signal:n})}else e?.toggleDrawing(!0),this.#ee(`main_toolbar`)}}#ee(e=``){this.#I===p.HIGHLIGHT?this.highlightSelection(e):this.#v&&this.#Q()}#te(){document.addEventListener(`selectionchange`,this.#$.bind(this),{signal:this._signal})}#ne(){if(this.#C)return;this.#C=new AbortController;let e=this.combinedSignal(this.#C);window.addEventListener(`focus`,this.focus.bind(this),{signal:e}),window.addEventListener(`blur`,this.blur.bind(this),{signal:e})}#re(){this.#C?.abort(),this.#C=null}blur(){if(this.isShiftKeyDown=!1,this.#T&&(this.#T=!1,this.#ee(`main_toolbar`)),!this.hasSelection)return;let{activeElement:e}=document;for(let t of this.#L)if(t.div.contains(e)){this.#M=[t,e],t._focusEventsAllowed=!1;break}}focus(){if(!this.#M)return;let[e,t]=this.#M;this.#M=null,t.addEventListener(`focusin`,()=>{e._focusEventsAllowed=!0},{once:!0,signal:this._signal}),t.focus()}#ie(){if(this.#j)return;this.#j=new AbortController;let e=this.combinedSignal(this.#j);window.addEventListener(`keydown`,this.keydown.bind(this),{signal:e}),window.addEventListener(`keyup`,this.keyup.bind(this),{signal:e})}#ae(){this.#j?.abort(),this.#j=null}#oe(){if(this.#d)return;this.#d=new AbortController;let e=this.combinedSignal(this.#d);document.addEventListener(`copy`,this.copy.bind(this),{signal:e}),document.addEventListener(`cut`,this.cut.bind(this),{signal:e}),document.addEventListener(`paste`,this.paste.bind(this),{signal:e})}#se(){this.#d?.abort(),this.#d=null}#ce(){let e=this._signal;document.addEventListener(`dragover`,this.dragOver.bind(this),{signal:e}),document.addEventListener(`drop`,this.drop.bind(this),{signal:e})}addEditListeners(){this.#ie(),this.setEditingState(!0)}removeEditListeners(){this.#ae(),this.setEditingState(!1)}dragOver(e){for(let{type:t}of e.dataTransfer.items)for(let n of this.#g)if(n.isHandlingMimeForPasting(t)){e.dataTransfer.dropEffect=`copy`,e.preventDefault();return}}drop(e){for(let t of e.dataTransfer.items)for(let n of this.#g)if(n.isHandlingMimeForPasting(t.type)){n.paste(t,this.currentLayer),e.preventDefault();return}}copy(e){if(e.preventDefault(),this.#t?.commitOrRemove(),!this.hasSelection)return;let t=[];for(let e of this.#L){let n=e.serialize(!0);n&&t.push(n)}t.length!==0&&e.clipboardData.setData(`application/pdfjs`,JSON.stringify(t))}cut(e){this.copy(e),this.delete()}async paste(e){e.preventDefault();let{clipboardData:t}=e;for(let e of t.items)for(let t of this.#g)if(t.isHandlingMimeForPasting(e.type)){t.paste(e,this.currentLayer);return}let n=t.getData(`application/pdfjs`);if(!n)return;try{n=JSON.parse(n)}catch(e){O(`paste: "${e.message}".`);return}if(!Array.isArray(n))return;this.unselectAll();let r=this.currentLayer;try{let e=[];for(let t of n){let n=await r.deserialize(t);if(!n)return;e.push(n)}this.addCommands({cmd:()=>{for(let t of e)this.#pe(t);this.#ge(e)},undo:()=>{for(let t of e)t.remove()},mustExec:!0})}catch(e){O(`paste: "${e.message}".`)}}keydown(t){!this.isShiftKeyDown&&t.key===`Shift`&&(this.isShiftKeyDown=!0),this.#I!==p.NONE&&!this.isEditorHandlingKeyboard&&e._keyboardManager.exec(this,t)}keyup(e){this.isShiftKeyDown&&e.key===`Shift`&&(this.isShiftKeyDown=!1,this.#T&&(this.#T=!1,this.#ee(`main_toolbar`)))}onEditingAction({name:e}){switch(e){case`undo`:case`redo`:case`delete`:case`selectAll`:this[e]();break;case`highlightSelection`:this.highlightSelection(`context_menu`);break;case`commentSelection`:this.commentSelection(`context_menu`);break}}updatePageIndex(e,t){for(let n of this.getEditors(e))n.pageIndex=t;let n=this.#a.get(e);n&&(n.pageIndex=t,this.#i.set(t,n),this.#O?n.enable():n.disable())}startUpdatePages(){this.#a=new Map(this.#i),this.#i.clear()}endUpdatePages(){this.#a=null}clonePage(e,t){for(let n of this.getEditors(e)){let e=n.serialize(n.mode!==p.HIGHLIGHT);e&&(e.pageIndex=t,e.id=this.getId(),e.isClone=!0,delete e.popupRef,this.#s.setValue(e.id,e))}}findClonesForPage(e){let t=[],{pageIndex:n}=e;for(let[r,i]of this.#s)i.pageIndex===n&&i.isClone&&(this.#s.remove(r),t.push(e.deserialize(i).then(t=>{t&&(t.isClone=!0,e.addOrRebuild(t))})));return Promise.all(t)}#le(e){Object.entries(e).some(([e,t])=>this.#U[e]!==t)&&(this._eventBus.dispatch(`editingstateschanged`,{source:this,details:Object.assign(this.#U,e)}),this.#I===p.HIGHLIGHT&&e.hasSelectedEditor===!1&&this.#ue([[m.HIGHLIGHT_FREE,!0]]))}#ue(e){this._eventBus.dispatch(`annotationeditorparamschanged`,{source:this,details:e})}setEditingState(e){e?(this.#ne(),this.#oe(),this.#le({isEditing:this.#I!==p.NONE,isEmpty:this.#he(),hasSomethingToUndo:this.#l.hasSomethingToUndo(),hasSomethingToRedo:this.#l.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#re(),this.#se(),this.#le({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!this.#g){this.#g=e;for(let e of this.#g)this.#ue(e.defaultPropertiesToUpdate)}}getId(){return this.#D.id}get currentLayer(){return this.#i.get(this.#p)}getLayer(e){return this.#i.get(e)}get currentPageIndex(){return this.#p}addLayer(e){this.#i.set(e.pageIndex,e),this.#O?e.enable():e.disable()}removeLayer(e){this.#i.delete(e.pageIndex)}async updateMode(e,t=null,n=!1,r=!1,i=!1,a=!1){if(this.#I!==e&&!(this.#Y&&(await this.#Y.promise,!this.#Y))){if(this.#Y=Promise.withResolvers(),this.#f?.commitOrRemove(),this.#I===p.POPUP&&this.#u?.hideSidebar(),this.#u?.destroyPopup(),this.#I=e,e===p.NONE){this.setEditingState(!1),this.#fe();for(let e of this.#r.values())e.hideStandaloneCommentButton();this._editorUndoBar?.hide(),this.toggleComment(null),this.#Y.resolve();return}for(let e of this.#r.values())e.addStandaloneCommentButton();e===p.SIGNATURE&&await this.#z?.loadSignatures(),n&&G.clearPointerType(),this.setEditingState(!0),await this.#de(),this.unselectAll();for(let t of this.#i.values())t.updateMode(e);if(e===p.POPUP){this.#n||=await this.#H.getAnnotationsByType(new Set(this.#g.map(e=>e._editorType)));let e=new Set,t=[];for(let n of this.#r.values()){let{annotationElementId:r,hasComment:i,deleted:a}=n;r&&e.add(r),i&&!a&&t.push(n.getData())}for(let n of this.#n){let{id:r,popupRef:i,contentsObj:a}=n;i&&a?.str&&!e.has(r)&&!this.#m.has(r)&&t.push(n)}this.#u?.showSidebar(t)}if(!t){r&&this.addNewEditorFromKeyboard(),this.#Y.resolve();return}for(let e of this.#r.values())e.uid===t?(this.setSelected(e),a?e.editComment():i?e.enterInEditMode():e.focus()):e.unselect();this.#Y.resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e.mode!==this.#I&&this._eventBus.dispatch(`switchannotationeditormode`,{source:this,...e})}updateParams(e,t){if(this.#g){switch(e){case m.CREATE:this.currentLayer.addNewEditor(t);return;case m.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch(`reporttelemetry`,{source:this,details:{type:`editing`,data:{type:`highlight`,action:`toggle_visibility`}}}),(this.#V||=new Map).set(e,t),this.showAllEditors(`highlight`,t);break}if(this.hasSelection)for(let n of this.#L)n.updateParams(e,t);else for(let n of this.#g)n.updateDefaultParams(e,t)}}showAllEditors(e,t,n=!1){for(let n of this.#r.values())n.editorType===e&&n.show(t);(this.#V?.get(m.HIGHLIGHT_SHOW_ALL)??!0)!==t&&this.#ue([[m.HIGHLIGHT_SHOW_ALL,t]])}enableWaiting(e=!1){if(this.#A!==e){this.#A=e;for(let t of this.#i.values())e?t.disableClick():t.enableClick(),t.div.classList.toggle(`waiting`,e)}}async#de(){if(!this.#O){this.#O=!0;let e=[];for(let t of this.#i.values())e.push(t.enable());await Promise.all(e);for(let e of this.#r.values())e.enable()}}#fe(){if(this.unselectAll(),this.#O){this.#O=!1;for(let e of this.#i.values())e.disable();for(let e of this.#r.values())e.disable()}}*getEditors(e){for(let t of this.#r.values())t.pageIndex===e&&(yield t)}getEditor(e){return this.#r.get(e)}addEditor(e){this.#r.set(e.id,e)}removeEditor(e){e.div.contains(document.activeElement)&&(this.#S&&clearTimeout(this.#S),this.#S=setTimeout(()=>{this.focusMainContainer(),this.#S=null},0)),this.#r.delete(e.id),e.annotationElementId&&this.#P?.delete(e.annotationElementId),this.unselect(e),(!e.annotationElementId||!this.#m.has(e.annotationElementId))&&this.#s?.remove(e.id)}addDeletedAnnotationElement(e){this.#m.add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}isDeletedAnnotationElement(e){return this.#m.has(e)}removeDeletedAnnotationElement(e){this.#m.delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}#pe(e){let t=this.#i.get(e.pageIndex);t?t.addOrRebuild(e):(this.addEditor(e),this.addToAnnotationStorage(e))}setActiveEditor(e){this.#t!==e&&(this.#t=e,e&&this.#ue(e.propertiesToUpdate))}get#me(){let e=null;for(e of this.#L);return e}updateUI(e){this.#me===e&&this.#ue(e.propertiesToUpdate)}updateUIForDefaultProperties(e){this.#ue(e.defaultPropertiesToUpdate)}toggleSelected(e){if(this.#L.has(e)){this.#L.delete(e),e.unselect(),this.#le({hasSelectedEditor:this.hasSelection});return}this.#L.add(e),e.select(),this.#ue(e.propertiesToUpdate),this.#le({hasSelectedEditor:!0})}setSelected(e){this.updateToolbar({mode:e.mode,editId:e.uid}),this.#f?.commitOrRemove();for(let t of this.#L)t!==e&&t.unselect();this.#u?.destroyPopup(),this.#L.clear(),this.#L.add(e),e.select(),this.#ue(e.propertiesToUpdate),this.#le({hasSelectedEditor:!0})}get firstSelectedEditor(){return this.#L.values().next().value}unselect(e){e.unselect(),this.#L.delete(e),this.#le({hasSelectedEditor:this.hasSelection})}get hasSelection(){return this.#L.size!==0}get isEnterHandled(){return this.#L.size===1&&this.firstSelectedEditor.isEnterHandled}undo(){this.#l.undo(),this.#le({hasSomethingToUndo:this.#l.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#he()}),this._editorUndoBar?.hide()}redo(){this.#l.redo(),this.#le({hasSomethingToUndo:!0,hasSomethingToRedo:this.#l.hasSomethingToRedo(),isEmpty:this.#he()})}addCommands(e){this.#l.add(e),this.#le({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#he()})}cleanUndoStack(e){this.#l.cleanType(e)}#he(){if(this.#r.size===0)return!0;if(this.#r.size===1)for(let e of this.#r.values())return e.isEmpty();return!1}delete(){this.commitOrRemove();let e=this.currentLayer?.endDrawingSession(!0);if(!this.hasSelection&&!e)return;let t=e?[e]:[...this.#L],n=()=>{this._editorUndoBar?.show(r,t.length===1?t[0].editorType:t.length);for(let e of t)e.remove()},r=()=>{for(let e of t)this.#pe(e)};this.addCommands({cmd:n,undo:r,mustExec:!0})}commitOrRemove(){this.#t?.commitOrRemove()}hasSomethingToControl(){return this.#t||this.hasSelection}#ge(e){for(let e of this.#L)e.unselect();this.#L.clear();for(let t of e)t.isEmpty()||(this.#L.add(t),t.select());this.#le({hasSelectedEditor:this.hasSelection})}selectAll(){for(let e of this.#L)e.commit();this.#ge(this.#r.values())}unselectAll(){if(!(this.#t&&(this.#t.commitOrRemove(),this.#I!==p.NONE))&&!this.#f?.commitOrRemove()&&(this.#u?.destroyPopup(),this.hasSelection)){for(let e of this.#L)e.unselect();this.#L.clear(),this.#le({hasSelectedEditor:!1})}}translateSelectedEditors(e,t,n=!1){if(n||this.commitOrRemove(),!this.hasSelection)return;this.#W[0]+=e,this.#W[1]+=t;let[r,i]=this.#W,a=[...this.#L];this.#G&&clearTimeout(this.#G),this.#G=setTimeout(()=>{this.#G=null,this.#W[0]=this.#W[1]=0,this.addCommands({cmd:()=>{for(let e of a)this.#r.has(e.id)&&(e.translateInPage(r,i),e.translationDone())},undo:()=>{for(let e of a)this.#r.has(e.id)&&(e.translateInPage(-r,-i),e.translationDone())},mustExec:!1})},1e3);for(let n of a)n.translateInPage(e,t),n.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#h=new Map;for(let e of this.#L)this.#h.set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#h)return!1;this.disableUserSelect(!1);let e=this.#h;this.#h=null;let t=!1;for(let[{x:n,y:r,pageIndex:i},a]of e)a.newX=n,a.newY=r,a.newPageIndex=i,t||=n!==a.savedX||r!==a.savedY||i!==a.savedPageIndex;if(!t)return!1;let n=(e,t,n,r)=>{if(this.#r.has(e.id)){let i=this.#i.get(r);i?e._setParentAndPosition(i,t,n):(e.pageIndex=r,e.x=t,e.y=n)}};return this.addCommands({cmd:()=>{for(let[t,{newX:r,newY:i,newPageIndex:a}]of e)n(t,r,i,a)},undo:()=>{for(let[t,{savedX:r,savedY:i,savedPageIndex:a}]of e)n(t,r,i,a)},mustExec:!0}),!0}dragSelectedEditors(e,t){if(this.#h)for(let n of this.#h.keys())n.drag(e,t)}rebuild(e){if(e.parent===null){let t=this.getLayer(e.pageIndex);t?(t.changeParent(e),t.addOrRebuild(e)):(this.addEditor(e),this.addToAnnotationStorage(e),e.rebuild())}else e.parent.addOrRebuild(e)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||this.#L.size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return this.#t===e}getActive(){return this.#t}getMode(){return this.#I}isEditingMode(){return this.#I!==p.NONE}get imageManager(){return F(this,`imageManager`,new et)}getSelectionBoxes(e){if(!e)return null;let t=document.getSelection();for(let n=0,r=t.rangeCount;n({x:(t-r)/a,y:1-(e+o-n)/i,width:s/a,height:o/i});break;case`180`:o=(e,t,o,s)=>({x:1-(e+o-n)/i,y:1-(t+s-r)/a,width:o/i,height:s/a});break;case`270`:o=(e,t,o,s)=>({x:1-(t+s-r)/a,y:(e-n)/i,width:s/a,height:o/i});break;default:o=(e,t,o,s)=>({x:(e-n)/i,y:(t-r)/a,width:o/i,height:s/a});break}let s=[];for(let e=0,n=t.rangeCount;ee.stopPropagation(),{signal:r});let i=e=>{e.preventDefault(),this.#c._uiManager.editAltText(this.#c),this.#d&&this.#c._reportTelemetry({action:`pdfjs.image.alt_text.image_status_label_clicked`,data:{label:this.#p}})};return t.addEventListener(`click`,i,{capture:!0,signal:r}),t.addEventListener(`keydown`,e=>{e.target===t&&e.key===`Enter`&&(this.#o=!0,i(e))},{signal:r}),await this.#m(),t}get#p(){return this.#e&&`added`||this.#e===null&&this.guessedText&&`review`||`missing`}finish(){this.#n&&(this.#n.focus({focusVisible:this.#o}),this.#o=!1)}isEmpty(){return this.#d?this.#e===null:!this.#e&&!this.#t}hasData(){return this.#d?this.#e!==null||!!this.#l:this.isEmpty()}get guessedText(){return this.#l}async setGuessedText(t){this.#e===null&&(this.#l=t,this.#u=await e._l10n.get(`pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer`,{generatedAltText:t}),this.#m())}toggleAltTextBadge(e=!1){if(!this.#d||this.#e){this.#s?.remove(),this.#s=null;return}if(!this.#s){let e=this.#s=document.createElement(`div`);e.className=`noAltTextBadge`,this.#c.div.append(e)}this.#s.classList.toggle(`hidden`,!e)}serialize(e){let t=this.#e;return!e&&this.#l===t&&(t=this.#u),{altText:t,decorative:this.#t,guessedText:this.#l,textWithDisclaimer:this.#u}}get data(){return{altText:this.#e,decorative:this.#t}}set data({altText:e,decorative:t,guessedText:n,textWithDisclaimer:r,cancel:i=!1}){n&&(this.#l=n,this.#u=r),!(this.#e===e&&this.#t===t)&&(i||(this.#e=e,this.#t=t),this.#m())}toggle(e=!1){this.#n&&(!e&&this.#a&&(clearTimeout(this.#a),this.#a=null),this.#n.disabled=!e)}shown(){this.#c._reportTelemetry({action:`pdfjs.image.alt_text.image_status_label_displayed`,data:{label:this.#p}})}destroy(){this.#n?.remove(),this.#n=null,this.#r=null,this.#i=null,this.#s?.remove(),this.#s=null}async#m(){let t=this.#n;if(!t)return;if(this.#d){if(t.classList.toggle(`done`,!!this.#e),t.setAttribute(`data-l10n-id`,e.#f[this.#p]),this.#r?.setAttribute(`data-l10n-id`,e.#f[`${this.#p}-label`]),!this.#e){this.#i?.remove();return}}else{if(!this.#e&&!this.#t){t.classList.remove(`done`),this.#i?.remove();return}t.classList.add(`done`),t.setAttribute(`data-l10n-id`,`pdfjs-editor-alt-text-edit-button`)}let n=this.#i;if(!n){this.#i=n=document.createElement(`span`),n.className=`tooltip`,n.setAttribute(`role`,`tooltip`),n.id=`alt-text-tooltip-${this.#c.id}`;let e=this.#c._uiManager._signal;e.addEventListener(`abort`,()=>{clearTimeout(this.#a),this.#a=null},{once:!0}),t.addEventListener(`mouseenter`,()=>{this.#a=setTimeout(()=>{this.#a=null,this.#i.classList.add(`show`),this.#c._reportTelemetry({action:`alt_text_tooltip`})},100)},{signal:e}),t.addEventListener(`mouseleave`,()=>{this.#a&&=(clearTimeout(this.#a),null),this.#i?.classList.remove(`show`)},{signal:e})}this.#t?n.setAttribute(`data-l10n-id`,`pdfjs-editor-alt-text-decorative-tooltip`):(n.removeAttribute(`data-l10n-id`),n.textContent=this.#e),n.parentNode||t.append(n),this.#c.getElementForAltText()?.setAttribute(`aria-describedby`,n.id)}},ot=class{#e=null;#t=null;#n=!1;#r=null;#i=null;#a=null;#o=null;#s=null;#c=!1;#l=null;constructor(e){this.#r=e}renderForToolbar(){let e=this.#t=document.createElement(`button`);return e.className=`comment`,this.#u(e,!1)}renderForStandalone(){let e=this.#e=document.createElement(`button`);e.className=`annotationCommentButton`;let t=this.#r.commentButtonPosition;if(t){let{style:n}=e;n.insetInlineEnd=`calc(${100*(this.#r._uiManager.direction===`ltr`?1-t[0]:t[0])}% - var(--comment-button-dim))`,n.top=`calc(${100*t[1]}% - var(--comment-button-dim))`;let r=this.#r.commentButtonColor;r&&(n.backgroundColor=r)}return this.#u(e,!0)}focusButton(){setTimeout(()=>{(this.#e??this.#t)?.focus()},0)}onUpdatedColor(){if(!this.#e)return;let e=this.#r.commentButtonColor;e&&(this.#e.style.backgroundColor=e),this.#r._uiManager.updatePopupColor(this.#r)}get commentButtonWidth(){return(this.#e?.getBoundingClientRect().width??0)/this.#r.parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(this.#l)return this.#l;if(!this.#e)return null;let{x:e,y:t,height:n}=this.#e.getBoundingClientRect(),{x:r,y:i,width:a,height:o}=this.#r.parent.boundingClientRect;return[(e-r)/a,(t+n-i)/o]}set commentPopupPositionInLayer(e){this.#l=e}hasDefaultPopupPosition(){return this.#l===null}removeStandaloneCommentButton(){this.#e?.remove(),this.#e=null}removeToolbarCommentButton(){this.#t?.remove(),this.#t=null}setCommentButtonStates({selected:e,hasPopup:t}){this.#e&&(this.#e.classList.toggle(`selected`,e),this.#e.ariaExpanded=t)}#u(e,t){if(!this.#r._uiManager.hasCommentManager())return null;e.tabIndex=`0`,e.ariaHasPopup=`dialog`,t?(e.ariaControls=`commentPopup`,e.setAttribute(`data-l10n-id`,`pdfjs-show-comment-button`)):(e.ariaControlsElements=[this.#r._uiManager.getCommentDialogElement()],e.setAttribute(`data-l10n-id`,`pdfjs-editor-add-comment-button`));let n=this.#r._uiManager._signal;if(!(n instanceof AbortSignal)||n.aborted)return e;e.addEventListener(`contextmenu`,H,{signal:n}),t&&(e.addEventListener(`focusin`,e=>{this.#r._focusEventsAllowed=!1,U(e)},{capture:!0,signal:n}),e.addEventListener(`focusout`,e=>{this.#r._focusEventsAllowed=!0,U(e)},{capture:!0,signal:n})),e.addEventListener(`pointerdown`,e=>e.stopPropagation(),{signal:n});let r=t=>{t.preventDefault(),e===this.#t?this.edit():this.#r.toggleComment(!0)};return e.addEventListener(`click`,r,{capture:!0,signal:n}),e.addEventListener(`keydown`,t=>{t.target===e&&t.key===`Enter`&&(this.#n=!0,r(t))},{signal:n}),e.addEventListener(`pointerenter`,()=>{this.#r.toggleComment(!1,!0)},{signal:n}),e.addEventListener(`pointerleave`,()=>{this.#r.toggleComment(!1,!1)},{signal:n}),e}edit(e){let t=this.commentPopupPositionInLayer,n,r;if(t)[n,r]=t;else{[n,r]=this.#r.commentButtonPosition;let{width:e,height:t,x:i,y:a}=this.#r;n=i+n*e,r=a+r*t}let i=this.#r.parent.boundingClientRect,{x:a,y:o,width:s,height:c}=i;this.#r._uiManager.editComment(this.#r,a+n*s,o+r*c,{...e,parentDimensions:i})}finish(){this.#t&&(this.#t.focus({focusVisible:this.#n}),this.#n=!1)}isDeleted(){return this.#c||this.#o===``}isEmpty(){return this.#o===null}hasBeenEdited(){return this.isDeleted()||this.#o!==this.#i}serialize(){return this.data}get data(){return{text:this.#o,richText:this.#a,date:this.#s,deleted:this.isDeleted()}}set data(e){if(e!==this.#o&&(this.#a=null),e===null){this.#o=``,this.#c=!0;return}this.#o=e,this.#s=new Date,this.#c=!1}restoreData({text:e,richText:t,date:n}){this.#o=e,this.#a=t,this.#s=n,this.#c=!1}setInitialText(e,t=null){this.#i=e,this.data=e,this.#s=null,this.#a=t}shown(){}destroy(){this.#t?.remove(),this.#t=null,this.#e?.remove(),this.#e=null,this.#o=``,this.#a=null,this.#s=null,this.#r=null,this.#n=!1,this.#c=!1}},st=class e{#e;#t=!1;#n=null;#r;#i;#a;#o;#s=null;#c;#l=null;#u;#d=null;constructor({container:e,isPinchingDisabled:t=null,isPinchingStopped:n=null,onPinchStart:r=null,onPinching:i=null,onPinchEnd:a=null,signal:o}){this.#e=e,this.#n=n,this.#r=t,this.#i=r,this.#a=i,this.#o=a,this.#u=new AbortController,this.#c=AbortSignal.any([o,this.#u.signal]),e.addEventListener(`touchstart`,this.#f.bind(this),{passive:!1,signal:this.#c})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/Ie.pixelRatio}#f(e){if(this.#r?.())return;if(e.touches.length===1){if(this.#s)return;let e=this.#s=new AbortController,t=AbortSignal.any([this.#c,e.signal]),n=this.#e,r={capture:!0,signal:t,passive:!1},i=e=>{e.pointerType===`touch`&&(this.#s?.abort(),this.#s=null)};n.addEventListener(`pointerdown`,e=>{e.pointerType===`touch`&&(U(e),i(e))},r),n.addEventListener(`pointerup`,i,r),n.addEventListener(`pointercancel`,i,r);return}if(!this.#d){this.#d=new AbortController;let e=AbortSignal.any([this.#c,this.#d.signal]),t=this.#e,n={signal:e,capture:!1,passive:!1};t.addEventListener(`touchmove`,this.#p.bind(this),n);let r=this.#m.bind(this);t.addEventListener(`touchend`,r,n),t.addEventListener(`touchcancel`,r,n),n.capture=!0,t.addEventListener(`pointerdown`,U,n),t.addEventListener(`pointermove`,U,n),t.addEventListener(`pointercancel`,U,n),t.addEventListener(`pointerup`,U,n),this.#i?.()}if(U(e),e.touches.length!==2||this.#n?.()){this.#l=null;return}let[t,n]=e.touches;t.identifier>n.identifier&&([t,n]=[n,t]),this.#l={touch0X:t.screenX,touch0Y:t.screenY,touch1X:n.screenX,touch1Y:n.screenY}}#p(t){if(!this.#l||t.touches.length!==2)return;U(t);let[n,r]=t.touches;n.identifier>r.identifier&&([n,r]=[r,n]);let{screenX:i,screenY:a}=n,{screenX:o,screenY:s}=r,c=this.#l,{touch0X:l,touch0Y:u,touch1X:d,touch1Y:f}=c,p=d-l,m=f-u,h=o-i,g=s-a,_=Math.hypot(h,g)||1,v=Math.hypot(p,m)||1;if(!this.#t&&Math.abs(v-_)<=e.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(c.touch0X=i,c.touch0Y=a,c.touch1X=o,c.touch1Y=s,!this.#t){this.#t=!0;return}let y=[(i+o)/2,(a+s)/2];this.#a?.(y,v,_)}#m(e){e.touches.length>=2||(this.#d&&(this.#d.abort(),this.#d=null,this.#o?.()),this.#l&&(U(e),this.#l=null,this.#t=!1))}destroy(){this.#u?.abort(),this.#u=null,this.#s?.abort(),this.#s=null}},K=class e{#e=null;#t=null;#n=null;#r=null;#i=null;#a=!1;#o=null;#s=``;#c=null;#l=null;#u=null;#d=null;#f=null;#p=``;#m=!1;#h=null;#g=!1;#_=!1;#v=!1;#y=null;#b=0;#x=0;#S=null;#C=null;isSelected=!1;_isCopy=!1;_editToolbar=null;_initialOptions=Object.create(null);_initialData=null;_isVisible=!0;_uiManager=null;_focusEventsAllowed=!0;static _l10n=null;static _l10nAlert=null;static _l10nResizer=null;#w=!1;#T=e._zIndex++;static _borderLineWidth=-1;static _colorManager=new rt;static _zIndex=1;static _telemetryTimeout=1e3;static get _resizerKeyboardManager(){let t=e.prototype._resizeWithKeyboard,n=it.TRANSLATE_SMALL,r=it.TRANSLATE_BIG;return F(this,`_resizerKeyboardManager`,new nt([[[`ArrowLeft`],t,{args:[-n,0]}],[[`ctrl+ArrowLeft`,`mac+shift+ArrowLeft`],t,{args:[-r,0]}],[[`ArrowRight`],t,{args:[n,0]}],[[`ctrl+ArrowRight`,`mac+shift+ArrowRight`],t,{args:[r,0]}],[[`ArrowUp`],t,{args:[0,-n]}],[[`ctrl+ArrowUp`,`mac+shift+ArrowUp`],t,{args:[0,-r]}],[[`ArrowDown`],t,{args:[0,n]}],[[`ctrl+ArrowDown`,`mac+shift+ArrowDown`],t,{args:[0,r]}],[[`Escape`],e.prototype._stopResizingWithKeyboard]]))}constructor(e){this.parent=e.parent,this.id=e.id,this.width=this.height=null,this.pageIndex=e.parent.pageIndex,this.name=e.name,this.div=null,this._uiManager=e.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=e.isCentered,this._structTreeParentId=null,this.annotationElementId=e.annotationElementId||null,this.creationDate=e.creationDate||new Date,this.modificationDate=e.modificationDate||null,this.canAddComment=!0;let{rotation:t,rawDims:{pageWidth:n,pageHeight:r,pageX:i,pageY:a}}=this.parent.viewport;this.rotation=t,this.pageRotation=(360+t-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[n,r],this.pageTranslation=[i,a];let[o,s]=this.parentDimensions;this.x=e.x/o,this.y=e.y/s,this.isAttachedToDOM=!1,this.deleted=!1}updatePageIndex(e){this.pageIndex=e}get editorType(){return Object.getPrototypeOf(this).constructor._type}get mode(){return Object.getPrototypeOf(this).constructor._editorType}static get isDrawer(){return!1}static get _defaultLineColor(){return F(this,`_defaultLineColor`,this._colorManager.getHexCode(`CanvasText`))}static deleteAnnotationElement(e){let t=new ct({id:e._uiManager.getId(),parent:e.parent,uiManager:e._uiManager});t.annotationElementId=e.annotationElementId,t.deleted=!0,t._uiManager.addToAnnotationStorage(t)}static initialize(t,n){if(e._l10n??=t,e._l10nAlert??=Object.freeze({highlight:`pdfjs-editor-highlight-added-alert`,freetext:`pdfjs-editor-freetext-added-alert`,ink:`pdfjs-editor-ink-added-alert`,stamp:`pdfjs-editor-stamp-added-alert`,signature:`pdfjs-editor-signature-added-alert`}),e._l10nResizer??=Object.freeze({topLeft:`pdfjs-editor-resizer-top-left`,topMiddle:`pdfjs-editor-resizer-top-middle`,topRight:`pdfjs-editor-resizer-top-right`,middleRight:`pdfjs-editor-resizer-middle-right`,bottomRight:`pdfjs-editor-resizer-bottom-right`,bottomMiddle:`pdfjs-editor-resizer-bottom-middle`,bottomLeft:`pdfjs-editor-resizer-bottom-left`,middleLeft:`pdfjs-editor-resizer-middle-left`}),e._borderLineWidth!==-1)return;let r=getComputedStyle(document.documentElement);e._borderLineWidth=parseFloat(r.getPropertyValue(`--outline-width`))||0}static updateDefaultParams(e,t){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,t){k(`Not implemented`)}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#w}set _isDraggable(e){this.#w=e,this.div?.classList.toggle(`draggable`,e)}get uid(){return this.annotationElementId||this.id}get isEnterHandled(){return!0}center(){let[e,t]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*t/(e*2),this.y+=this.width*e/(t*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*t/(e*2),this.y-=this.width*e/(t*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(e){this._uiManager.addCommands(e)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#T}setParent(e){e===null?(this.#W(),this.#d?.remove(),this.#d=null):(this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions),this.parent=e}focusin(e){this._focusEventsAllowed&&(this.#m?this.#m=!1:this.parent.setSelected(this))}focusout(e){this._focusEventsAllowed&&this.isAttachedToDOM&&(e.relatedTarget?.closest(`#${this.id}`)||(e.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove()))}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,t,n,r){let[i,a]=this.parentDimensions;[n,r]=this.screenToPageTranslation(n,r),this.x=(e+n)/i,this.y=(t+r)/a,this.fixAndSetPosition()}_moveAfterPaste(e,t){if(this.isClone){delete this.isClone;return}let[n,r]=this.parentDimensions;this.setAt(e*n,t*r,this.width*n,this.height*r),this._onTranslated()}#E([e,t],n,r){[n,r]=this.screenToPageTranslation(n,r),this.x+=n/e,this.y+=r/t,this._onTranslating(this.x,this.y),this.fixAndSetPosition()}translate(e,t){this.#E(this.parentDimensions,e,t)}translateInPage(e,t){this.#h||=[this.x,this.y,this.width,this.height],this.#E(this.pageDimensions,e,t),this.div.scrollIntoView({block:`nearest`})}translationDone(){this._onTranslated(this.x,this.y)}drag(e,t){this.#h||=[this.x,this.y,this.width,this.height];let{div:n,parentDimensions:[r,i]}=this;if(this.x+=e/r,this.y+=t/i,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){let{x:e,y:t}=this.div.getBoundingClientRect();this.parent.findNewParent(this,e,t)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:a,y:o}=this,[s,c]=this.getBaseTranslation();a+=s,o+=c;let{style:l}=n;l.left=`${(100*a).toFixed(2)}%`,l.top=`${(100*o).toFixed(2)}%`,this._onTranslating(a,o),n.scrollIntoView({block:`nearest`})}_onTranslating(e,t){}_onTranslated(e,t){}get _hasBeenMoved(){return!!this.#h&&(this.#h[0]!==this.x||this.#h[1]!==this.y)}get _hasBeenResized(){return!!this.#h&&(this.#h[2]!==this.width||this.#h[3]!==this.height)}getBaseTranslation(){let[t,n]=this.parentDimensions,{_borderLineWidth:r}=e,i=r/t,a=r/n;switch(this.rotation){case 90:return[-i,a];case 180:return[i,a];case 270:return[i,-a];default:return[-i,-a]}}get _mustFixPosition(){return!0}fixAndSetPosition(e=this.rotation){let{div:{style:t},pageDimensions:[n,r]}=this,{x:i,y:a,width:o,height:s}=this;if(o*=n,s*=r,i*=n,a*=r,this._mustFixPosition)switch(e){case 0:i=V(i,0,n-o),a=V(a,0,r-s);break;case 90:i=V(i,0,n-s),a=V(a,o,r);break;case 180:i=V(i,o,n),a=V(a,s,r);break;case 270:i=V(i,s,n),a=V(a,0,r-o);break}this.x=i/=n,this.y=a/=r;let[c,l]=this.getBaseTranslation();i+=c,a+=l,t.left=`${(100*i).toFixed(2)}%`,t.top=`${(100*a).toFixed(2)}%`,this.moveInDOM()}static#D(e,t,n){switch(n){case 90:return[t,-e];case 180:return[-e,-t];case 270:return[-t,e];default:return[e,t]}}screenToPageTranslation(t,n){return e.#D(t,n,this.parentRotation)}pageTranslationToScreen(t,n){return e.#D(t,n,360-this.parentRotation)}#O(e){switch(e){case 90:{let[e,t]=this.pageDimensions;return[0,-e/t,t/e,0]}case 180:return[-1,0,0,-1];case 270:{let[e,t]=this.pageDimensions;return[0,e/t,-t/e,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){let{parentScale:e,pageDimensions:[t,n]}=this;return[t*e,n*e]}setDims(){let{div:{style:e},width:t,height:n}=this;e.width=`${(100*t).toFixed(2)}%`,e.height=`${(100*n).toFixed(2)}%`}getInitialTranslation(){return[0,0]}#k(){if(this.#c)return;this.#c=document.createElement(`div`),this.#c.classList.add(`resizers`);let e=this._willKeepAspectRatio?[`topLeft`,`topRight`,`bottomRight`,`bottomLeft`]:[`topLeft`,`topMiddle`,`topRight`,`middleRight`,`bottomRight`,`bottomMiddle`,`bottomLeft`,`middleLeft`],t=this._uiManager._signal;for(let n of e){let e=document.createElement(`div`);this.#c.append(e),e.classList.add(`resizer`,n),e.setAttribute(`data-resizer-name`,n),e.addEventListener(`pointerdown`,this.#A.bind(this,n),{signal:t}),e.addEventListener(`contextmenu`,H,{signal:t}),e.tabIndex=-1}this.div.prepend(this.#c)}#A(e,t){t.preventDefault();let{isMac:n}=z.platform;if(t.button!==0||t.ctrlKey&&n)return;this.#n?.toggle(!1);let r=this._isDraggable;this._isDraggable=!1,this.#l=[t.screenX,t.screenY];let i=new AbortController,a=this._uiManager.combinedSignal(i);this.parent.togglePointerEvents(!1),window.addEventListener(`pointermove`,this.#N.bind(this,e),{passive:!0,capture:!0,signal:a}),window.addEventListener(`touchmove`,U,{passive:!1,signal:a}),window.addEventListener(`contextmenu`,H,{signal:a}),this.#u={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};let o=this.parent.div.style.cursor,s=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(t.target).cursor;let c=()=>{i.abort(),this.parent.togglePointerEvents(!0),this.#n?.toggle(!0),this._isDraggable=r,this.parent.div.style.cursor=o,this.div.style.cursor=s,this.#M()};window.addEventListener(`pointerup`,c,{signal:a}),window.addEventListener(`blur`,c,{signal:a})}#j(e,t,n,r){this.width=n,this.height=r,this.x=e,this.y=t,this.setDims(),this.fixAndSetPosition(),this._onResized()}_onResized(){}#M(){if(!this.#u)return;let{savedX:e,savedY:t,savedWidth:n,savedHeight:r}=this.#u;this.#u=null;let i=this.x,a=this.y,o=this.width,s=this.height;i===e&&a===t&&o===n&&s===r||this.addCommands({cmd:this.#j.bind(this,i,a,o,s),undo:this.#j.bind(this,e,t,n,r),mustExec:!0})}static _round(e){return Math.round(e*1e4)/1e4}#N(t,n){let[r,i]=this.parentDimensions,a=this.x,o=this.y,s=this.width,c=this.height,l=e.MIN_SIZE/r,u=e.MIN_SIZE/i,d=this.#O(this.rotation),f=(e,t)=>[d[0]*e+d[2]*t,d[1]*e+d[3]*t],p=this.#O(360-this.rotation),m=(e,t)=>[p[0]*e+p[2]*t,p[1]*e+p[3]*t],h,g,_=!1,v=!1;switch(t){case`topLeft`:_=!0,h=(e,t)=>[0,0],g=(e,t)=>[e,t];break;case`topMiddle`:h=(e,t)=>[e/2,0],g=(e,t)=>[e/2,t];break;case`topRight`:_=!0,h=(e,t)=>[e,0],g=(e,t)=>[0,t];break;case`middleRight`:v=!0,h=(e,t)=>[e,t/2],g=(e,t)=>[0,t/2];break;case`bottomRight`:_=!0,h=(e,t)=>[e,t],g=(e,t)=>[0,0];break;case`bottomMiddle`:h=(e,t)=>[e/2,t],g=(e,t)=>[e/2,0];break;case`bottomLeft`:_=!0,h=(e,t)=>[0,t],g=(e,t)=>[e,0];break;case`middleLeft`:v=!0,h=(e,t)=>[0,t/2],g=(e,t)=>[e,t/2];break}let y=h(s,c),b=g(s,c),x=f(...b),S=e._round(a+x[0]),C=e._round(o+x[1]),w=1,T=1,E,D;if(n.fromKeyboard)({deltaX:E,deltaY:D}=n);else{let{screenX:e,screenY:t}=n,[r,i]=this.#l;[E,D]=this.screenToPageTranslation(e-r,t-i),this.#l[0]=e,this.#l[1]=t}if([E,D]=m(E/r,D/i),_){let e=Math.hypot(s,c);w=T=Math.max(Math.min(Math.hypot(b[0]-y[0]-E,b[1]-y[1]-D)/e,1/s,1/c),l/s,u/c)}else v?w=V(Math.abs(b[0]-y[0]-E),l,1)/s:T=V(Math.abs(b[1]-y[1]-D),u,1)/c;let O=e._round(s*w),k=e._round(c*T);x=f(...g(O,k));let A=S-x[0],j=C-x[1];this.#h||=[this.x,this.y,this.width,this.height],this.width=O,this.height=k,this.x=A,this.y=j,this.setDims(),this.fixAndSetPosition(),this._onResizing()}_onResizing(){}altTextFinish(){this.#n?.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||this.#_)return this._editToolbar;this._editToolbar=new Ye(this),this.div.append(this._editToolbar.render());let{toolbarButtons:e}=this;if(e)for(let[t,n]of e)await this._editToolbar.addButton(t,n);return this.hasComment||this._editToolbar.addButton(`comment`,this.addCommentButton()),this._editToolbar.addButton(`delete`),this._editToolbar}addCommentButtonInToolbar(){this._editToolbar?.addButtonBefore(`comment`,this.addCommentButton(),`.deleteButton`)}removeCommentButtonFromToolbar(){this._editToolbar?.removeButton(`comment`)}removeEditToolbar(){this._editToolbar?.remove(),this._editToolbar=null,this.#n?.destroy()}addContainer(e){let t=this._editToolbar?.div;t?t.before(e):this.div.append(e)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return this.#n||(at.initialize(e._l10n),this.#n=new at(this),this.#e&&=(this.#n.data=this.#e,null)),this.#n}get altTextData(){return this.#n?.data}set altTextData(e){this.#n&&(this.#n.data=e)}get guessedAltText(){return this.#n?.guessedText}async setGuessedAltText(e){await this.#n?.setGuessedText(e)}serializeAltText(e){return this.#n?.serialize(e)}hasAltText(){return!!this.#n&&!this.#n.isEmpty()}hasAltTextData(){return this.#n?.hasData()??!1}focusCommentButton(){this.#r?.focusButton()}addCommentButton(){return this.canAddComment?this.#r||=new ot(this):null}addStandaloneCommentButton(){if(this._uiManager.hasCommentManager()){if(this.#i){this._uiManager.isEditingMode()&&this.#i.classList.remove(`hidden`);return}this.hasComment&&(this.#i=this.#r.renderForStandalone(),this.div.append(this.#i))}}removeStandaloneCommentButton(){this.#r.removeStandaloneCommentButton(),this.#i=null}hideStandaloneCommentButton(){this.#i?.classList.add(`hidden`)}get comment(){if(!this.#r)return null;let{data:{richText:e,text:t,date:n,deleted:r}}=this.#r;return{text:t,richText:e,date:n,deleted:r,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(e){this.#r||=new ot(this),typeof e==`object`&&e?this.#r.restoreData(e):this.#r.data=e,this.hasComment?(this.removeCommentButtonFromToolbar(),this.addStandaloneCommentButton(),this._uiManager.updateComment(this)):(this.addCommentButtonInToolbar(),this.removeStandaloneCommentButton(),this._uiManager.removeComment(this))}setCommentData({comment:e,popupRef:t,richText:n}){if(!t||(this.#r||=new ot(this),this.#r.setInitialText(e,n),!this.annotationElementId))return;let r=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);r&&this.updateFromAnnotationLayer(r)}get hasEditedComment(){return this.#r?.hasBeenEdited()}get hasDeletedComment(){return this.#r?.isDeleted()}get hasComment(){return!!this.#r&&!this.#r.isEmpty()&&!this.#r.isDeleted()}async editComment(e){this.#r||=new ot(this),this.#r.edit(e)}toggleComment(e,t=void 0){this.hasComment&&this._uiManager.toggleComment(this,e,t)}setSelectedCommentButton(e){this.#r.setSelectedButton(e)}addComment(e){if(this.hasEditedComment){let[,,,t]=e.rect,[n]=this.pageDimensions,[r]=this.pageTranslation,i=r+n+1,a=t-100,o=i+180;e.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[i,a,o,t]}}}updateFromAnnotationLayer({popup:{contents:e,deleted:t}}){this.#r.data=t?null:e}get parentBoundingClientRect(){return this.parent.boundingClientRect}render(){let e=this.div=document.createElement(`div`);e.setAttribute(`data-editor-rotation`,(360-this.rotation)%360),e.className=this.name,e.setAttribute(`id`,this.id),e.tabIndex=this.#a?-1:0,e.setAttribute(`role`,`application`),this.defaultL10nId&&e.setAttribute(`data-l10n-id`,this.defaultL10nId),this._isVisible||e.classList.add(`hidden`),this.setInForeground(),this.#z();let[t,n]=this.parentDimensions;this.parentRotation%180!=0&&(e.style.maxWidth=`${(100*n/t).toFixed(2)}%`,e.style.maxHeight=`${(100*t/n).toFixed(2)}%`);let[r,i]=this.getInitialTranslation();return this.translate(r,i),Qe(this,e,[`keydown`,`pointerdown`,`dblclick`]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(this.#C||=new st({container:e,isPinchingDisabled:()=>!this.isSelected,onPinchStart:this.#P.bind(this),onPinching:this.#F.bind(this),onPinchEnd:this.#I.bind(this),signal:this._uiManager._signal})),this.addStandaloneCommentButton(),this._uiManager._editorUndoBar?.hide(),e}#P(){this.#u={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height},this.#n?.toggle(!1),this.parent.togglePointerEvents(!1)}#F(t,n,r){let i=.7,a=r/n*i+1-i;if(a===1)return;let o=this.#O(this.rotation),s=(e,t)=>[o[0]*e+o[2]*t,o[1]*e+o[3]*t],[c,l]=this.parentDimensions,u=this.x,d=this.y,f=this.width,p=this.height,m=e.MIN_SIZE/c,h=e.MIN_SIZE/l;a=Math.max(Math.min(a,1/f,1/p),m/f,h/p);let g=e._round(f*a),_=e._round(p*a);if(g===f&&_===p)return;this.#h||=[u,d,f,p];let v=s(f/2,p/2),y=e._round(u+v[0]),b=e._round(d+v[1]),x=s(g/2,_/2);this.x=y-x[0],this.y=b-x[1],this.width=g,this.height=_,this.setDims(),this.fixAndSetPosition(),this._onResizing()}#I(){this.#n?.toggle(!0),this.parent.togglePointerEvents(!0),this.#M()}pointerdown(e){let{isMac:t}=z.platform;if(e.button!==0||e.ctrlKey&&t){e.preventDefault();return}if(this.#m=!0,this._isDraggable){this.#R(e);return}this.#L(e)}#L(e){let{isMac:t}=z.platform;e.ctrlKey&&!t||e.shiftKey||e.metaKey&&t?this.parent.toggleSelected(this):this.parent.setSelected(this)}#R(e){let{isSelected:t}=this;this._uiManager.setUpDragSession();let n=!1,r=new AbortController,i=this._uiManager.combinedSignal(r),a={capture:!0,passive:!1,signal:i},o=e=>{r.abort(),this.#o=null,this.#m=!1,this._uiManager.endDragSession()||this.#L(e),n&&this._onStopDragging()};t&&(this.#b=e.clientX,this.#x=e.clientY,this.#o=e.pointerId,this.#s=e.pointerType,window.addEventListener(`pointermove`,e=>{n||(n=!0,this._uiManager.toggleComment(this,!0,!1),this._onStartDragging());let{clientX:t,clientY:r,pointerId:i}=e;if(i!==this.#o){U(e);return}let[a,o]=this.screenToPageTranslation(t-this.#b,r-this.#x);this.#b=t,this.#x=r,this._uiManager.dragSelectedEditors(a,o)},a),window.addEventListener(`touchmove`,U,a),window.addEventListener(`pointerdown`,e=>{e.pointerType===this.#s&&(this.#C||e.isPrimary)&&o(e),U(e)},a));let s=e=>{if(!this.#o||this.#o===e.pointerId){o(e);return}U(e)};window.addEventListener(`pointerup`,s,{signal:i}),window.addEventListener(`blur`,s,{signal:i})}_onStartDragging(){}_onStopDragging(){}moveInDOM(){this.#y&&clearTimeout(this.#y),this.#y=setTimeout(()=>{this.#y=null,this.parent?.moveEditorInDOM(this)},0)}_setParentAndPosition(e,t,n){e.changeParent(this),this.x=t,this.y=n,this.fixAndSetPosition(),this._onTranslated()}getRect(e,t,n=this.rotation){let r=this.parentScale,[i,a]=this.pageDimensions,[o,s]=this.pageTranslation,c=e/r,l=t/r,u=this.x*i,d=this.y*a,f=this.width*i,p=this.height*a;switch(n){case 0:return[u+c+o,a-d-l-p+s,u+c+f+o,a-d-l+s];case 90:return[u+l+o,a-d+c+s,u+l+p+o,a-d+c+f+s];case 180:return[u-c-f+o,a-d+l+s,u-c+o,a-d+l+p+s];case 270:return[u-l-p+o,a-d-c-f+s,u-l+o,a-d-c+s];default:throw Error(`Invalid rotation`)}}getRectInCurrentCoords(e,t){let[n,r,i,a]=e,o=i-n,s=a-r;switch(this.rotation){case 0:return[n,t-a,o,s];case 90:return[n,t-r,s,o];case 180:return[i,t-r,o,s];case 270:return[i,t-a,s,o];default:throw Error(`Invalid rotation`)}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&e._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){this.#r?.onUpdatedColor()}getData(){let{comment:{text:e,color:t,date:n,opacity:r,deleted:i,richText:a},uid:o,pageIndex:s,creationDate:c,modificationDate:l}=this;return{id:o,pageIndex:s,rect:this.getPDFRect(),richText:a,contentsObj:{str:e},creationDate:c,modificationDate:n||l,popupRef:!i,color:t,opacity:r}}onceAdded(e){}isEmpty(){return!1}enableEditMode(){return this.isInEditMode()?!1:(this.parent.setEditingState(!1),this.#_=!0,!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),this.#_=!1,!0):!1}isInEditMode(){return this.#_}shouldGetKeyboardEvents(){return this.#v}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){let{top:e,left:t,bottom:n,right:r}=this.getClientDimensions(),{innerHeight:i,innerWidth:a}=window;return t0&&e0}#z(){if(this.#f||!this.div)return;this.#f=new AbortController;let e=this._uiManager.combinedSignal(this.#f);this.div.addEventListener(`focusin`,this.focusin.bind(this),{signal:e}),this.div.addEventListener(`focusout`,this.focusout.bind(this),{signal:e})}rebuild(){this.#z()}rotate(e){}resize(){}serializeDeleted(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:this._initialData?.popupRef||``}}serialize(e=!1,t=null){return{annotationType:this.mode,pageIndex:this.pageIndex,rect:this.getPDFRect(),rotation:this.rotation,structTreeParentId:this._structTreeParentId,popupRef:this._initialData?.popupRef||``}}static async deserialize(e,t,n){let r=new this.prototype.constructor({parent:t,id:n.getId(),uiManager:n,annotationElementId:e.annotationElementId,creationDate:e.creationDate,modificationDate:e.modificationDate});r.rotation=e.rotation,r.#e=e.accessibilityData,r._isCopy=e.isCopy||!1;let[i,a]=r.pageDimensions,[o,s,c,l]=r.getRectInCurrentCoords(e.rect,a);return r.x=o/i,r.y=s/a,r.width=c/i,r.height=l/a,r}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){if(this.#f?.abort(),this.#f=null,this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.hideCommentPopup(),this.#y&&=(clearTimeout(this.#y),null),this.#W(),this.removeEditToolbar(),this.#S){for(let e of this.#S.values())clearTimeout(e);this.#S=null}this.parent=null,this.#C?.destroy(),this.#C=null,this.#d?.remove(),this.#d=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#k(),this.#c.classList.remove(`hidden`))}get toolbarPosition(){return null}get commentButtonPosition(){return this._uiManager.direction===`ltr`?[1,0]:[0,0]}get commentButtonPositionInPage(){let{commentButtonPosition:[t,n]}=this,[r,i,a,o]=this.getPDFRect();return[e._round(r+(a-r)*t),e._round(i+(o-i)*(1-n))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return this.#r.commentPopupPositionInLayer}set commentPopupPosition(e){this.#r.commentPopupPositionInLayer=e}hasDefaultPopupPosition(){return this.#r.hasDefaultPopupPosition()}get commentButtonWidth(){return this.#r.commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(e){this.#r?.setCommentButtonStates(e)}keydown(t){if(!this.isResizable||t.target!==this.div||t.key!==`Enter`)return;this._uiManager.setSelected(this),this.#u={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};let n=this.#c.children;if(!this.#t){this.#t=Array.from(n);let t=this.#B.bind(this),r=this.#V.bind(this),i=this._uiManager._signal;for(let n of this.#t){let a=n.getAttribute(`data-resizer-name`);n.setAttribute(`role`,`spinbutton`),n.addEventListener(`keydown`,t,{signal:i}),n.addEventListener(`blur`,r,{signal:i}),n.addEventListener(`focus`,this.#H.bind(this,a),{signal:i}),n.setAttribute(`data-l10n-id`,e._l10nResizer[a])}}let r=this.#t[0],i=0;for(let e of n){if(e===r)break;i++}let a=(360-this.rotation+this.parentRotation)%360/90*(this.#t.length/4);if(a!==i){if(ai)for(let e=0;e{this.div?.classList.contains(`selectedEditor`)&&this._editToolbar?.show()});return}this._editToolbar?.show(),this.#n?.toggleAltTextBadge(!1)}focus(){this.div&&!this.div.contains(document.activeElement)&&setTimeout(()=>this.div?.focus({preventScroll:!0}),0)}unselect(){this.isSelected&&(this.isSelected=!1,this.#c?.classList.add(`hidden`),this.div?.classList.remove(`selectedEditor`),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),this._editToolbar?.hide(),this.#n?.toggleAltTextBadge(!0),this.hideCommentPopup())}hideCommentPopup(){this.hasComment&&this._uiManager.toggleComment(null)}updateParams(e,t){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(e){e.target.nodeName!==`BUTTON`&&(this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.uid}))}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return this.#g}set isEditing(e){this.#g=e,this.parent&&(e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:`added`}}get telemetryFinalData(){return null}_reportTelemetry(t,n=!1){if(n){this.#S||=new Map;let{action:n}=t,r=this.#S.get(n);r&&clearTimeout(r),r=setTimeout(()=>{this._reportTelemetry(t),this.#S.delete(n),this.#S.size===0&&(this.#S=null)},e._telemetryTimeout),this.#S.set(n,r);return}t.type||=this.editorType,this._uiManager._eventBus.dispatch(`reporttelemetry`,{source:this,details:{type:`editing`,data:t}})}show(e=this._isVisible){this.div.classList.toggle(`hidden`,!e),this._isVisible=e}enable(){this.div&&(this.div.tabIndex=0),this.#a=!1}disable(){this.div&&(this.div.tabIndex=-1),this.#a=!0}updateFakeAnnotationElement(e){if(!this.#d&&!this.deleted){this.#d=e.addFakeAnnotation(this);return}if(this.deleted){this.#d.remove(),this.#d=null;return}(this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&this.#d.updateEdited({rect:this.getPDFRect(),popup:this.comment})}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;let t=e.container.querySelector(`.annotationContent`);if(!t)t=document.createElement(`div`),t.classList.add(`annotationContent`,this.editorType),e.container.prepend(t);else if(t.nodeName===`CANVAS`){let e=t;t=document.createElement(`div`),t.classList.add(`annotationContent`,this.editorType),e.before(t)}return t}resetAnnotationElement(e){let{firstElementChild:t}=e.container;t?.nodeName===`DIV`&&t.classList.contains(`annotationContent`)&&t.remove()}},ct=class extends K{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}},lt=3285377520,ut=4294901760,dt=65535,ft=class{constructor(e){this.h1=e?e&4294967295:lt,this.h2=e?e&4294967295:lt}update(e){let t,n;if(typeof e==`string`){t=new Uint8Array(e.length*2),n=0;for(let r=0,i=e.length;r>>8,t[n++]=i&255)}}else if(ArrayBuffer.isView(e))t=e.slice(),n=t.byteLength;else throw Error(`Invalid data format, must be a string or TypedArray.`);let r=n>>2,i=n-r*4,a=new Uint32Array(t.buffer,0,r),o=0,s=0,c=this.h1,l=this.h2,u=3432918353,d=461845907,f=11601,p=13715;for(let e=0;e>>17,o=o*d&ut|o*p&dt,c^=o,c=c<<13|c>>>19,c=c*5+3864292196):(s=a[e],s=s*u&ut|s*f&dt,s=s<<15|s>>>17,s=s*d&ut|s*p&dt,l^=s,l=l<<13|l>>>19,l=l*5+3864292196);switch(o=0,i){case 3:o^=t[r*4+2]<<16;case 2:o^=t[r*4+1]<<8;case 1:o^=t[r*4],o=o*u&ut|o*f&dt,o=o<<15|o>>>17,o=o*d&ut|o*p&dt,r&1?c^=o:l^=o}this.h1=c,this.h2=l}hexdigest(){let e=this.h1,t=this.h2;return e^=t>>>1,e=e*3981806797&ut|e*36045&dt,t=t*4283543511&ut|((t<<16|e>>>16)*2950163797&ut)>>>16,e^=t>>>1,e=e*444984403&ut|e*60499&dt,t=t*3301882366&ut|((t<<16|e>>>16)*3120437893&ut)>>>16,e^=t>>>1,(e>>>0).toString(16).padStart(8,`0`)+(t>>>0).toString(16).padStart(8,`0`)}},pt=Object.freeze({map:null,hash:``,transfer:void 0}),mt=class{#e=!1;#t=null;#n=null;#r=new Map;onSetModified=null;onResetModified=null;onAnnotationEditor=null;getValue(e,t){let n=this.#r.get(e);return n===void 0?t:Object.assign(t,n)}getRawValue(e){return this.#r.get(e)}remove(e){let t=this.#r.get(e);t!==void 0&&(t instanceof K&&this.#n.delete(t.annotationElementId),this.#r.delete(e),this.#r.size===0&&this.resetModified(),!this.#r.values().some(e=>e instanceof K)&&this.onAnnotationEditor?.(null))}setValue(e,t){let n=this.#r.get(e),r=!1;if(n!==void 0)for(let[e,i]of Object.entries(t))n[e]!==i&&(r=!0,n[e]=i);else r=!0,this.#r.set(e,t);r&&this.#i(),t instanceof K&&((this.#n||=new Map).set(t.annotationElementId,t),this.onAnnotationEditor?.(t.constructor._type))}has(e){return this.#r.has(e)}get size(){return this.#r.size}#i(){this.#e||(this.#e=!0,this.onSetModified?.())}resetModified(){this.#e&&(this.#e=!1,this.onResetModified?.())}get print(){return new ht(this)}get serializable(){if(this.#r.size===0)return pt;let e=new Map,t=new ft,n=[],r=Object.create(null),i=!1;for(let[n,a]of this.#r){let o=a instanceof K?a.serialize(!1,r):a;a.page&&(a.pageIndex=a.page._pageIndex,delete a.page),o&&(e.set(n,o),t.update(`${n}:${JSON.stringify(o)}`),i||=!!o.bitmap)}if(i)for(let t of e.values())t.bitmap&&n.push(t.bitmap);return e.size>0?{map:e,hash:t.hexdigest(),transfer:n}:pt}get editorStats(){let e=null,t=new Map,n=0,r=0;for(let i of this.#r.values()){if(!(i instanceof K)){i.popup&&(i.popup.deleted?r+=1:n+=1);continue}i.isCommentDeleted?r+=1:i.hasEditedComment&&(n+=1);let a=i.telemetryFinalData;if(!a)continue;let{type:o}=a;t.getOrInsertComputed(o,()=>Object.getPrototypeOf(i).constructor),e||=Object.create(null);let s=e[o]||=new Map;for(let[e,t]of Object.entries(a)){if(e===`type`)continue;let n=s.getOrInsertComputed(e,pe);n.set(t,(n.get(t)??0)+1)}}if((r>0||n>0)&&(e||=Object.create(null),e.comments={deleted:r,edited:n}),!e)return null;for(let[n,r]of t)e[n]=r.computeTelemetryFinalData(e[n]);return e}resetModifiedIds(){this.#t=null}updateEditor(e,t){let n=this.#n?.get(e);return n?(n.updateFromAnnotationLayer(t),!0):!1}getEditor(e){return this.#n?.get(e)||null}get modifiedIds(){if(this.#t)return this.#t;let e=[];if(this.#n)for(let t of this.#n.values())t.serialize()&&e.push(t.annotationElementId);let t=``;if(e.length){let n=new ft;n.update(e.join(`,`)),t=n.hexdigest()}return this.#t={ids:new Set(e),hash:t}}[Symbol.iterator](){return this.#r.entries()}},ht=class extends mt{#e=pt;constructor(e){super();let{serializable:t}=e;if(t===pt)return;let{map:n,hash:r,transfer:i}=t,a=structuredClone(n,i?{transfer:i}:null);this.#e={map:a,hash:r,transfer:[]}}get print(){k(`Should not call PrintAnnotationStorage.print`)}get serializable(){return this.#e}get modifiedIds(){return F(this,`modifiedIds`,{ids:new Set,hash:``})}};r(7588);var gt=`__forcedDependency`,{floor:_t,ceil:vt}=Math;function yt(e,t,n,r,i,a){e[t*4+0]=Math.min(e[t*4+0],n),e[t*4+1]=Math.min(e[t*4+1],r),e[t*4+2]=Math.max(e[t*4+2],i),e[t*4+3]=Math.max(e[t*4+3],a)}function bt(e,t,n,r,i){let a;e?(e<0&&(a=i[0],i[0]=i[2],i[2]=a),i[0]*=e,i[2]*=e,t<0&&(a=i[1],i[1]=i[3],i[3]=a),i[1]*=t,i[3]*=t):i.fill(0),i[0]+=n,i[1]+=r,i[2]+=n,i[3]+=r}var xt=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0],St=class{#e;#t;constructor(e,t){this.#e=e,this.#t=t}get length(){return this.#e.length}isEmpty(e){return this.#e[e]===xt}minX(e){return this.#t[e*4+0]/256}minY(e){return this.#t[e*4+1]/256}maxX(e){return(this.#t[e*4+2]+1)/256}maxY(e){return(this.#t[e*4+3]+1)/256}},Ct=(e,t)=>e?.getOrInsertComputed(t,()=>({dependencies:new Set,isRenderingOperation:!1})),wt=class{#e=[[1,0,0,1,0,0]];#t=[-1/0,-1/0,1/0,1/0];#n=new Float64Array(a);_pendingBBoxIdx=-1;#r;#i;#a;#o;_savesStack=[];_markedContentStack=[];constructor(e,t){this.#r=e.width,this.#i=e.height,this.#s(t)}growOperationsCount(e){e>=this.#o.length&&this.#s(e,this.#o)}#s(e,t){let n=new ArrayBuffer(e*4);this.#a=new Uint8ClampedArray(n),this.#o=new Uint32Array(n),t&&t.length>0?(this.#o.set(t),this.#o.fill(xt,t.length)):this.#o.fill(xt)}get clipBox(){return this.#t}save(e){return this.#t={__proto__:this.#t},this._savesStack.push(e),this}restore(e,t){let n=Object.getPrototypeOf(this.#t);if(n===null)return this;this.#t=n;let r=this._savesStack.pop();return r!==void 0&&(t?.(r,e),this.#o[e]=this.#o[r]),this}recordOpenMarker(e){return this._savesStack.push(e),this}getOpenMarker(){return this._savesStack.length===0?null:this._savesStack.at(-1)}recordCloseMarker(e,t){let n=this._savesStack.pop();return n!==void 0&&(t?.(n,e),this.#o[e]=this.#o[n]),this}beginMarkedContent(e){return this._markedContentStack.push(e),this}endMarkedContent(e,t){let n=this._markedContentStack.pop();return n!==void 0&&(t?.(n,e),this.#o[e]=this.#o[n]),this}pushBaseTransform(e){return this.#e.push(B.multiplyByDOMMatrix(this.#e.at(-1),e.getTransform())),this}popBaseTransform(){return this.#e.length>1&&this.#e.pop(),this}resetBBox(e){return this._pendingBBoxIdx!==e&&(this._pendingBBoxIdx=e,this.#n.set(a,0)),this}recordClipBox(e,t,n,r,i,o){let s=B.multiplyByDOMMatrix(this.#e.at(-1),t.getTransform()),c=a.slice();B.axialAlignedBoundingBox([n,i,r,o],s,c);let l=B.intersect(this.#t,c);return l?(this.#t[0]=l[0],this.#t[1]=l[1],this.#t[2]=l[2],this.#t[3]=l[3]):(this.#t[0]=this.#t[1]=1/0,this.#t[2]=this.#t[3]=-1/0),this}recordBBox(e,t,n,r,i,o){let s=this.#t;if(s[0]===1/0)return this;let c=B.multiplyByDOMMatrix(this.#e.at(-1),t.getTransform());if(s[0]===-1/0)return B.axialAlignedBoundingBox([n,i,r,o],c,this.#n),this;let l=a.slice();return B.axialAlignedBoundingBox([n,i,r,o],c,l),this.#n[0]=V(l[0],s[0],this.#n[0]),this.#n[1]=V(l[1],s[1],this.#n[1]),this.#n[2]=V(l[2],this.#n[2],s[2]),this.#n[3]=V(l[3],this.#n[3],s[3]),this}recordFullPageBBox(e){return this.#n[0]=Math.max(0,this.#t[0]),this.#n[1]=Math.max(0,this.#t[1]),this.#n[2]=Math.min(this.#r,this.#t[2]),this.#n[3]=Math.min(this.#i,this.#t[3]),this}recordOperation(e,t=!1,n){if(this._pendingBBoxIdx!==e)return this;let r=_t(this.#n[0]*256/this.#r),i=_t(this.#n[1]*256/this.#i),a=vt(this.#n[2]*256/this.#r),o=vt(this.#n[3]*256/this.#i);if(yt(this.#a,e,r,i,a,o),n)for(let t of n)for(let n of t)n!==e&&yt(this.#a,n,r,i,a,o);return t||(this._pendingBBoxIdx=-1),this}bboxToClipBoxDropOperation(e){return this._pendingBBoxIdx===e&&(this._pendingBBoxIdx=-1,this.#t[0]=Math.max(this.#t[0],this.#n[0]),this.#t[1]=Math.max(this.#t[1],this.#n[1]),this.#t[2]=Math.min(this.#t[2],this.#n[2]),this.#t[3]=Math.min(this.#t[3],this.#n[3])),this}take(){return new St(this.#o,this.#a)}takeDebugMetadata(){throw Error(`Unreachable`)}recordSimpleData(e,t){return this}recordIncrementalData(e,t){return this}resetIncrementalData(e,t){return this}recordNamedData(e,t){return this}recordSimpleDataFromNamed(e,t,n){return this}recordFutureForcedDependency(e,t){return this}inheritSimpleDataAsFutureForcedDependencies(e){return this}inheritPendingDependenciesAsFutureForcedDependencies(){return this}recordCharacterBBox(e,t,n,r=1,i=0,a=0,o){return this}getSimpleIndex(e){}recordDependencies(e,t){return this}recordNamedDependency(e,t){return this}recordShowTextOperation(e,t=!1){return this}},Tt=class{#e={__proto__:null};#t={__proto__:null,transform:[],moveText:[],sameLineText:[],[gt]:[]};#n=new Map;#r=new Set;#i=new Map;#a;#o;#s;constructor(e,t=!1){this.#s=e,t&&(this.#a=new Map,this.#o=(e,t)=>{Ct(this.#a,t).dependencies.add(e)})}get clipBox(){return this.#s.clipBox}growOperationsCount(e){this.#s.growOperationsCount(e)}save(e){return this.#e={__proto__:this.#e},this.#t={__proto__:this.#t,transform:{__proto__:this.#t.transform},moveText:{__proto__:this.#t.moveText},sameLineText:{__proto__:this.#t.sameLineText},[gt]:{__proto__:this.#t[gt]}},this.#s.save(e),this}restore(e){this.#s.restore(e,this.#o);let t=Object.getPrototypeOf(this.#e);return t===null?this:(this.#e=t,this.#t=Object.getPrototypeOf(this.#t),this)}recordOpenMarker(e){return this.#s.recordOpenMarker(e,this.#o),this}getOpenMarker(){return this.#s.getOpenMarker()}recordCloseMarker(e){return this.#s.recordCloseMarker(e,this.#o),this}beginMarkedContent(e){return this.#s.beginMarkedContent(e),this}endMarkedContent(e){return this.#s.endMarkedContent(e,this.#o),this}pushBaseTransform(e){return this.#s.pushBaseTransform(e),this}popBaseTransform(){return this.#s.popBaseTransform(),this}recordSimpleData(e,t){return this.#e[e]=t,this}recordIncrementalData(e,t){return this.#t[e].push(t),this}resetIncrementalData(e,t){return this.#t[e].length=0,this}recordNamedData(e,t){return this.#n.set(e,t),this}recordSimpleDataFromNamed(e,t,n){this.#e[e]=this.#n.get(t)??n}recordFutureForcedDependency(e,t){return this.recordIncrementalData(gt,t),this}inheritSimpleDataAsFutureForcedDependencies(e){for(let t of e)t in this.#e&&this.recordFutureForcedDependency(t,this.#e[t]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(let e of this.#r)this.recordFutureForcedDependency(gt,e);return this}resetBBox(e){return this.#s.resetBBox(e),this}recordClipBox(e,t,n,r,i,a){return this.#s.recordClipBox(e,t,n,r,i,a),this}recordBBox(e,t,n,r,i,a){return this.#s.recordBBox(e,t,n,r,i,a),this}recordCharacterBBox(e,t,n,r=1,i=0,a=0,o){let s=n.bbox,c,l;if(s&&(c=s[2]!==s[0]&&s[3]!==s[1]&&this.#i.get(n),c!==!1&&(l=[0,0,0,0],B.axialAlignedBoundingBox(s,n.fontMatrix,l),(r!==1||i!==0||a!==0)&&bt(r,-r,i,a,l),c)))return this.recordBBox(e,t,l[0],l[2],l[1],l[3]);if(!o)return this.recordFullPageBBox(e);let u=o();return s&&l&&c===void 0&&(c=l[0]<=i-u.actualBoundingBoxLeft&&l[2]>=i+u.actualBoundingBoxRight&&l[1]<=a-u.actualBoundingBoxAscent&&l[3]>=a+u.actualBoundingBoxDescent,this.#i.set(n,c),c)?this.recordBBox(e,t,l[0],l[2],l[1],l[3]):this.recordBBox(e,t,i-u.actualBoundingBoxLeft,i+u.actualBoundingBoxRight,a-u.actualBoundingBoxAscent,a+u.actualBoundingBoxDescent)}recordFullPageBBox(e){return this.#s.recordFullPageBBox(e),this}getSimpleIndex(e){return this.#e[e]}recordDependencies(e,t){let n=this.#r,r=this.#e,i=this.#t;for(let e of t)e in this.#e?n.add(r[e]):e in i&&i[e].forEach(n.add,n);return this}recordNamedDependency(e,t){return this.#n.has(t)&&this.#r.add(this.#n.get(t)),this}recordOperation(e,t=!1){if(this.recordDependencies(e,[gt]),this.#a){let t=Ct(this.#a,e),{dependencies:n}=t;this.#r.forEach(n.add,n),this.#s._savesStack.forEach(n.add,n),this.#s._markedContentStack.forEach(n.add,n),n.delete(e),t.isRenderingOperation=!0}let n=!t&&e===this.#s._pendingBBoxIdx;return this.#s.recordOperation(e,t,[this.#r,this.#s._savesStack,this.#s._markedContentStack]),n&&this.#r.clear(),this}recordShowTextOperation(e,t=!1){let n=Array.from(this.#r);this.recordOperation(e,t),this.recordIncrementalData(`sameLineText`,e);for(let e of n)this.recordIncrementalData(`sameLineText`,e);return this}bboxToClipBoxDropOperation(e,t=!1){let n=!t&&e===this.#s._pendingBBoxIdx;return this.#s.bboxToClipBoxDropOperation(e),n&&this.#r.clear(),this}take(){return this.#i.clear(),this.#s.take()}takeDebugMetadata(){return this.#a}},Et=class e{#e;#t;#n;#r=0;#i=0;constructor(t,n,r){if(t instanceof e&&t.#n===!!r)return t;this.#e=t,this.#t=n,this.#n=!!r}get clipBox(){return this.#e.clipBox}growOperationsCount(){throw Error(`Unreachable`)}save(e){return this.#i++,this.#e.save(this.#t),this}restore(e){return this.#i>0&&(this.#e.restore(this.#t),this.#i--),this}recordOpenMarker(e){return this.#r++,this}getOpenMarker(){return this.#r>0?this.#t:this.#e.getOpenMarker()}recordCloseMarker(e){return this.#r--,this}beginMarkedContent(e){return this}endMarkedContent(e){return this}pushBaseTransform(e){return this.#e.pushBaseTransform(e),this}popBaseTransform(){return this.#e.popBaseTransform(),this}recordSimpleData(e,t){return this.#e.recordSimpleData(e,this.#t),this}recordIncrementalData(e,t){return this.#e.recordIncrementalData(e,this.#t),this}resetIncrementalData(e,t){return this.#e.resetIncrementalData(e,this.#t),this}recordNamedData(e,t){return this}recordSimpleDataFromNamed(e,t,n){return this.#e.recordSimpleDataFromNamed(e,t,this.#t),this}recordFutureForcedDependency(e,t){return this.#e.recordFutureForcedDependency(e,this.#t),this}inheritSimpleDataAsFutureForcedDependencies(e){return this.#e.inheritSimpleDataAsFutureForcedDependencies(e),this}inheritPendingDependenciesAsFutureForcedDependencies(){return this.#e.inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(e){return this.#n||this.#e.resetBBox(this.#t),this}recordClipBox(e,t,n,r,i,a){return this.#n||this.#e.recordClipBox(this.#t,t,n,r,i,a),this}recordBBox(e,t,n,r,i,a){return this.#n||this.#e.recordBBox(this.#t,t,n,r,i,a),this}recordCharacterBBox(e,t,n,r,i,a,o){return this.#n||this.#e.recordCharacterBBox(this.#t,t,n,r,i,a,o),this}recordFullPageBBox(e){return this.#n||this.#e.recordFullPageBBox(this.#t),this}getSimpleIndex(e){return this.#e.getSimpleIndex(e)}recordDependencies(e,t){return this.#e.recordDependencies(this.#t,t),this}recordNamedDependency(e,t){return this.#e.recordNamedDependency(this.#t,t),this}recordOperation(e){return this.#e.recordOperation(this.#t,!0),this}recordShowTextOperation(e){return this.#e.recordShowTextOperation(this.#t,!0),this}bboxToClipBoxDropOperation(e){return this.#n||this.#e.bboxToClipBoxDropOperation(this.#t,!0),this}take(){throw Error(`Unreachable`)}takeDebugMetadata(){throw Error(`Unreachable`)}},Dt={stroke:[`path`,`transform`,`filter`,`strokeColor`,`strokeAlpha`,`lineWidth`,`lineCap`,`lineJoin`,`miterLimit`,`dash`],fill:[`path`,`transform`,`filter`,`fillColor`,`fillAlpha`,`globalCompositeOperation`,`SMask`],imageXObject:[`transform`,`SMask`,`filter`,`fillAlpha`,`strokeAlpha`,`globalCompositeOperation`],rawFillPath:[`filter`,`fillColor`,`fillAlpha`],showText:[`transform`,`leading`,`charSpacing`,`wordSpacing`,`hScale`,`textRise`,`moveText`,`textMatrix`,`font`,`fontObj`,`filter`,`fillColor`,`textRenderingMode`,`SMask`,`fillAlpha`,`strokeAlpha`,`globalCompositeOperation`,`sameLineText`],transform:[`transform`],transformAndFill:[`transform`,`fillColor`]},Ot=class e{#e;#t;#n=4;#r=0;#i=new e.#a(this.#n*6);static#a=z.isFloat16ArraySupported?Float16Array:Float32Array;constructor(e){this.#e=e.width,this.#t=e.height}record(t,n,r,i){if(this.#r===this.#n){this.#n*=2;let t=new e.#a(this.#n*6);t.set(this.#i),this.#i=t}let o=W(t),s;if(i[0]!==1/0){let e=a.slice();B.axialAlignedBoundingBox([0,-r,n,0],o,e);let t=B.intersect(i,e);if(!t)return;let[c,l,u,d]=t;if(c!==e[0]||l!==e[1]||u!==e[2]||d!==e[3]){let e=Math.atan2(o[1],o[0]),t=Math.abs(Math.sin(e)),n=Math.abs(Math.cos(e));if(t<1e-6||n<1e-6||Math.abs(t-n)<1e-6)s=[c,l,c,d,u,l];else{let e=u-c,r=d-l,i=t*t,a=n*n,o=n*t,f=a-i,p=(r*a-e*o)/f;s=[c+(r*o-e*i)/f,l,c,l+p,u,d-p]}}}s||(s=[0,-r,0,0,n,-r],B.applyTransform(s,o,0),B.applyTransform(s,o,2),B.applyTransform(s,o,4)),s[0]/=this.#e,s[1]/=this.#t,s[2]/=this.#e,s[3]/=this.#t,s[4]/=this.#e,s[5]/=this.#t,this.#i.set(s,this.#r*6),this.#r++}take(){return this.#i.subarray(0,this.#r*6)}},kt=class{#e=new Set;#t=null;constructor({ownerDocument:e=globalThis.document,styleElement:t=null}){this._document=e,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(e){this.nativeFontFaces.add(e),this._document.fonts.add(e)}removeNativeFontFace(e){this.nativeFontFaces.delete(e),this._document.fonts.delete(e)}insertRule(e){let t=this.#n();t.insertRule(e,t.cssRules.length)}#n(){if(this.#t)return this.#t;let e=this._document.defaultView?.CSSStyleSheet||globalThis.CSSStyleSheet;if(!this.styleElement&&e){let{adoptedStyleSheets:t}=this._document;if(t){let n=new e;return t.push(n),this.#t=n}}return this.styleElement||(this.styleElement=this._document.createElement(`style`),this._document.documentElement.getElementsByTagName(`head`)[0].append(this.styleElement)),this.#t=this.styleElement.sheet}clear(){for(let e of this.nativeFontFaces)this._document.fonts.delete(e);if(this.nativeFontFaces.clear(),this.#e.clear(),this.#t){let{adoptedStyleSheets:e}=this._document;e?.includes(this.#t)&&(this._document.adoptedStyleSheets=e.filter(e=>e!==this.#t)),this.#t=null}this.styleElement&&=(this.styleElement.remove(),null)}async loadSystemFont({systemFontInfo:e,disableFontFace:t,_inspectFont:n}){if(!(!e||this.#e.has(e.loadedName))){if(A(!t,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){let{loadedName:t,src:r,style:i}=e,a=new FontFace(t,r,i);this.addNativeFontFace(a);try{await a.load(),this.#e.add(t),n?.(e)}catch{O(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(a)}return}k(`Not implemented: loadSystemFont without the Font Loading API.`)}}async bind(e){if(e.attached||e.missingFile&&!e.systemFontInfo)return;if(e.attached=!0,e.systemFontInfo){await this.loadSystemFont(e);return}if(this.isFontLoadingAPISupported){let t=e.createNativeFontFace();if(t){this.addNativeFontFace(t);try{await t.loaded}catch(n){throw O(`Failed to load font '${t.family}': '${n}'.`),e.disableFontFace=!0,n}}return}let t=e.createFontFaceRule();if(t){if(this.insertRule(t),this.isSyncFontLoadingSupported)return;await new Promise(t=>{let n=this._queueLoadingCallback(t);this._prepareFontLoadEvent(e,n)})}}get isFontLoadingAPISupported(){let e=!!this._document?.fonts;return F(this,`isFontLoadingAPISupported`,e)}get isSyncFontLoadingSupported(){return F(this,`isSyncFontLoadingSupported`,i||z.platform.isFirefox)}_queueLoadingCallback(e){function t(){for(A(!r.done,`completeRequest() cannot be called twice.`),r.done=!0;n.length>0&&n[0].done;){let e=n.shift();setTimeout(e.callback,0)}}let{loadingRequests:n}=this,r={done:!1,complete:t,callback:e};return n.push(r),r}get _loadTestFont(){let e=atob(`T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==`);return F(this,`_loadTestFont`,e)}_prepareFontLoadEvent(e,t){function n(e,t){return e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|e.charCodeAt(t+3)&255}function r(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,e&255)}function i(e,t,n,r){let i=e.substring(0,t),a=e.substring(t+n);return i+r+a}let a,o,s=this._document.createElement(`canvas`);s.width=1,s.height=1;let c=s.getContext(`2d`),l=0;function u(e,t){if(++l>30){O(`Load test font never loaded.`),t();return}if(c.font=`30px `+e,c.fillText(`.`,0,20),c.getImageData(0,0,1,1).data[3]>0){t();return}setTimeout(u.bind(null,e,t))}let d=`lt${Date.now()}${this.loadTestFontId++}`,f=this._loadTestFont;f=i(f,976,d.length,d);let p=1482184792,m=n(f,16);for(a=0,o=d.length-3;a{g.remove(),t.complete()})}},At=class{compiledGlyphs=Object.create(null);#e;constructor(e,t=null,n,r){this.#e=e,this._inspectFont=t,n&&(this.charProcOperatorList=n),r&&Object.assign(this,r)}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let e;if(!this.cssFontInfo)e=new FontFace(this.loadedName,this.data,{});else{let t={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(t.style=`oblique ${this.cssFontInfo.italicAngle}deg`),e=new FontFace(this.cssFontInfo.fontFamily,this.data,t)}return this._inspectFont?.(this),e}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;let e=`url(data:${this.mimetype};base64,${this.data.toBase64()});`,t;if(!this.cssFontInfo)t=`@font-face {font-family:"${this.loadedName}";src:${e}}`;else{let n=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(n+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),t=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${n}src:${e}}`}return this._inspectFont?.(this,e),t}getPathGenerator(e,t){if(this.compiledGlyphs[t]!==void 0)return this.compiledGlyphs[t];let n=this.loadedName+`_path_`+t,r;try{r=e.get(n)}catch(e){O(`getPathGenerator - ignoring character: "${e}".`)}let i=Je(r?.path);return this.fontExtraProperties||e.delete(n),this.compiledGlyphs[t]=i}get black(){return this.#e.black}get bold(){return this.#e.bold}get disableFontFace(){return this.#e.disableFontFace}set disableFontFace(e){F(this,`disableFontFace`,!!e)}get fontExtraProperties(){return this.#e.fontExtraProperties}get isInvalidPDFjsFont(){return this.#e.isInvalidPDFjsFont}get isType3Font(){return this.#e.isType3Font}get italic(){return this.#e.italic}get missingFile(){return this.#e.missingFile}get remeasure(){return this.#e.remeasure}get vertical(){return this.#e.vertical}get ascent(){return this.#e.ascent}get defaultWidth(){return this.#e.defaultWidth}get descent(){return this.#e.descent}get bbox(){return this.#e.bbox}get fontMatrix(){return this.#e.fontMatrix}get fallbackName(){return this.#e.fallbackName}get loadedName(){return this.#e.loadedName}get mimetype(){return this.#e.mimetype}get name(){return this.#e.name}get data(){return this.#e.data}clearData(){this.#e.clearData()}get cssFontInfo(){return this.#e.cssFontInfo}get systemFontInfo(){return this.#e.systemFontInfo}get defaultVMetrics(){return this.#e.defaultVMetrics}},jt=class{static strings=[`fontFamily`,`fontWeight`,`italicAngle`]},Mt=class{static strings=[`css`,`loadedName`,`baseFontName`,`src`]},Nt=class{static bools=[`black`,`bold`,`disableFontFace`,`fontExtraProperties`,`isInvalidPDFjsFont`,`isType3Font`,`italic`,`missingFile`,`remeasure`,`vertical`];static numbers=[`ascent`,`defaultWidth`,`descent`];static strings=[`fallbackName`,`loadedName`,`mimetype`,`name`];static OFFSET_NUMBERS=Math.ceil(this.bools.length*2/8);static OFFSET_BBOX=this.OFFSET_NUMBERS+this.numbers.length*8;static OFFSET_FONT_MATRIX=this.OFFSET_BBOX+1+8;static OFFSET_DEFAULT_VMETRICS=this.OFFSET_FONT_MATRIX+1+48;static OFFSET_STRINGS=this.OFFSET_DEFAULT_VMETRICS+1+6},Pt=class{static KIND=0;static HAS_BBOX=1;static HAS_BACKGROUND=2;static SHADING_TYPE=3;static N_COORD=4;static N_COLOR=8;static N_STOP=12;static N_FIGURES=16},Ft=class{#e;#t=new TextDecoder;#n;constructor(e){this.#e=e,this.#n=new DataView(e)}#r(e){A(e>n&3;return r===0?void 0:r===2}get black(){return this.#r(0)}get bold(){return this.#r(1)}get disableFontFace(){return this.#r(2)}get fontExtraProperties(){return this.#r(3)}get isInvalidPDFjsFont(){return this.#r(4)}get isType3Font(){return this.#r(5)}get italic(){return this.#r(6)}get missingFile(){return this.#r(7)}get remeasure(){return this.#r(8)}get vertical(){return this.#r(9)}#i(e){return A(e0){t=a.slice();for(let e=0,n=l.length;etypeof e==`object`&&Number.isInteger(e?.num)&&e.num>=0&&Number.isInteger(e?.gen)&&e.gen>=0,Wt=de.bind(null,Ut,e=>typeof e==`object`&&typeof e?.name==`string`),Gt=class{#e=new Map;#t=Promise.resolve();postMessage(e,t){let n={data:structuredClone(e,t?{transfer:t}:null)};this.#t.then(()=>{for(let[e]of this.#e)e.call(this,n)})}addEventListener(e,t,n=null){let r=null;if(n?.signal instanceof AbortSignal){let{signal:i}=n;if(i.aborted){O("LoopbackPort - cannot use an `aborted` signal.");return}let a=()=>this.removeEventListener(e,t);r=()=>i.removeEventListener(`abort`,a),i.addEventListener(`abort`,a)}this.#e.set(t,r)}removeEventListener(e,t){this.#e.get(t)?.(),this.#e.delete(t)}terminate(){for(let[,e]of this.#e)e?.();this.#e.clear()}};r(1689);var Kt={DATA:1,ERROR:2},q={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function qt(){}function J(e){if(e instanceof re||e instanceof ee||e instanceof L||e instanceof te||e instanceof R)return e;switch(e instanceof Error||typeof e==`object`&&e||k(`wrapReason: Expected "reason" to be a (possibly cloned) Error.`),e.name){case`AbortException`:return new re(e.message);case`InvalidPDFException`:return new ee(e.message);case`PasswordException`:return new L(e.message,e.code);case`ResponseException`:return new te(e.message,e.status,e.missing);case`UnknownErrorException`:return new R(e.message,e.details)}return new R(e.message,e.toString())}var Jt=class{#e=new AbortController;constructor(e,t,n){this.sourceName=e,this.targetName=t,this.comObj=n,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),n.addEventListener(`message`,this.#t.bind(this),{signal:this.#e.signal})}#t({data:e}){if(e.targetName!==this.sourceName)return;if(e.stream){this.#r(e);return}if(e.callback){let t=e.callbackId,n=this.callbackCapabilities[t];if(!n)throw Error(`Cannot resolve callback ${t}`);if(delete this.callbackCapabilities[t],e.callback===Kt.DATA)n.resolve(e.data);else if(e.callback===Kt.ERROR)n.reject(J(e.reason));else throw Error(`Unexpected callback case`);return}let t=this.actionHandler[e.action];if(!t)throw Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){let n=this.sourceName,r=e.sourceName,i=this.comObj;Promise.try(t,e.data).then(function(t){i.postMessage({sourceName:n,targetName:r,callback:Kt.DATA,callbackId:e.callbackId,data:t})},function(t){i.postMessage({sourceName:n,targetName:r,callback:Kt.ERROR,callbackId:e.callbackId,reason:J(t)})});return}if(e.streamId){this.#n(e);return}t(e.data)}on(e,t){let n=this.actionHandler;if(n[e])throw Error(`There is already an actionName called "${e}"`);n[e]=t}send(e,t,n){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t},n)}sendWithPromise(e,t,n){let r=this.callbackId++,i=Promise.withResolvers();this.callbackCapabilities[r]=i;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:r,data:t},n)}catch(e){i.reject(e)}return i.promise}sendWithStream(e,t,n,r){let i=this.streamId++,a=this.sourceName,o=this.targetName,s=this.comObj;return new ReadableStream({start:n=>{let c=Promise.withResolvers();return this.streamControllers[i]={controller:n,startCall:c,pullCall:null,cancelCall:null,isClosed:!1},s.postMessage({sourceName:a,targetName:o,action:e,streamId:i,data:t,desiredSize:n.desiredSize},r),c.promise},pull:e=>{let t=Promise.withResolvers();return this.streamControllers[i].pullCall=t,s.postMessage({sourceName:a,targetName:o,stream:q.PULL,streamId:i,desiredSize:e.desiredSize}),t.promise},cancel:e=>{A(e instanceof Error,`cancel must have a valid reason`);let t=Promise.withResolvers();return this.streamControllers[i].cancelCall=t,this.streamControllers[i].isClosed=!0,s.postMessage({sourceName:a,targetName:o,stream:q.CANCEL,streamId:i,reason:J(e)}),t.promise}},n)}#n(e){let t=e.streamId,n=this.sourceName,r=e.sourceName,i=this.comObj,a=this,o=this.actionHandler[e.action],s={enqueue(e,a=1,o){if(this.isCancelled)return;let s=this.desiredSize;this.desiredSize-=a,s>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),i.postMessage({sourceName:n,targetName:r,stream:q.ENQUEUE,streamId:t,chunk:e},o)},close(){this.isCancelled||(this.isCancelled=!0,i.postMessage({sourceName:n,targetName:r,stream:q.CLOSE,streamId:t}),delete a.streamSinks[t])},error(e){A(e instanceof Error,`error must have a valid reason`),!this.isCancelled&&(this.isCancelled=!0,i.postMessage({sourceName:n,targetName:r,stream:q.ERROR,streamId:t,reason:J(e)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};s.sinkCapability.resolve(),s.ready=s.sinkCapability.promise,this.streamSinks[t]=s,Promise.try(o,e.data,s).then(function(){i.postMessage({sourceName:n,targetName:r,stream:q.START_COMPLETE,streamId:t,success:!0})},function(e){i.postMessage({sourceName:n,targetName:r,stream:q.START_COMPLETE,streamId:t,reason:J(e)})})}#r(e){let t=e.streamId,n=this.sourceName,r=e.sourceName,i=this.comObj,a=this.streamControllers[t],o=this.streamSinks[t];switch(e.stream){case q.START_COMPLETE:e.success?a.startCall.resolve():a.startCall.reject(J(e.reason));break;case q.PULL_COMPLETE:e.success?a.pullCall.resolve():a.pullCall.reject(J(e.reason));break;case q.PULL:if(!o){i.postMessage({sourceName:n,targetName:r,stream:q.PULL_COMPLETE,streamId:t,success:!0});break}o.desiredSize<=0&&e.desiredSize>0&&o.sinkCapability.resolve(),o.desiredSize=e.desiredSize,Promise.try(o.onPull||qt).then(function(){i.postMessage({sourceName:n,targetName:r,stream:q.PULL_COMPLETE,streamId:t,success:!0})},function(e){i.postMessage({sourceName:n,targetName:r,stream:q.PULL_COMPLETE,streamId:t,reason:J(e)})});break;case q.ENQUEUE:if(A(a,`enqueue should have stream controller`),a.isClosed)break;a.controller.enqueue(e.chunk);break;case q.CLOSE:if(A(a,`close should have stream controller`),a.isClosed)break;a.isClosed=!0,a.controller.close(),this.#i(a,t);break;case q.ERROR:A(a,`error should have stream controller`),a.controller.error(J(e.reason)),this.#i(a,t);break;case q.CANCEL_COMPLETE:e.success?a.cancelCall.resolve():a.cancelCall.reject(J(e.reason)),this.#i(a,t);break;case q.CANCEL:if(!o)break;let s=J(e.reason);Promise.try(o.onCancel||qt,s).then(function(){i.postMessage({sourceName:n,targetName:r,stream:q.CANCEL_COMPLETE,streamId:t,success:!0})},function(e){i.postMessage({sourceName:n,targetName:r,stream:q.CANCEL_COMPLETE,streamId:t,reason:J(e)})}),o.sinkCapability.reject(s),o.isCancelled=!0,delete this.streamSinks[t];break;default:throw Error(`Unexpected stream case`)}}async#i(e,t){await Promise.allSettled([e.startCall?.promise,e.pullCall?.promise,e.cancelCall?.promise]),delete this.streamControllers[t]}destroy(){this.#e?.abort(),this.#e=null}},Yt=class{#e=Object.freeze({cMapUrl:`CMap`,standardFontDataUrl:`font`,wasmUrl:`wasm`});constructor({cMapUrl:e=null,standardFontDataUrl:t=null,wasmUrl:n=null}){this.cMapUrl=e,this.standardFontDataUrl=t,this.wasmUrl=n}async fetch({kind:e,filename:t}){switch(e){case`cMapUrl`:case`standardFontDataUrl`:case`wasmUrl`:break;default:k(`Not implemented: ${e}`)}let n=this[e];if(!n)throw Error(`Ensure that the \`${e}\` API parameter is provided.`);let r=`${n}${t}`;return this._fetch(r,e).catch(t=>{throw Error(`Unable to load ${this.#e[e]} data at: ${r}`)})}async _fetch(e,t){k("Abstract method `_fetch` called.")}},Xt=class extends Yt{async _fetch(e,t){let n=await Se(e,t===`cMapUrl`&&!e.endsWith(`.bcmap`)?`text`:`bytes`);return n instanceof Uint8Array?n:ae(n)}},Zt=class{#e=!1;constructor({enableHWA:e=!1}){this.#e=e}create(e,t){if(e<=0||t<=0)throw Error(`Invalid canvas size`);let n=this._createCanvas(e,t);return{canvas:n,context:n.getContext(`2d`,{willReadFrequently:!this.#e})}}reset({canvas:e},t,n){if(!e)throw Error(`Canvas is not specified`);if(t<=0||n<=0)throw Error(`Invalid canvas size`);e.width=t,e.height=n}destroy(e){let{canvas:t}=e;if(!t)throw Error(`Canvas is not specified`);t.width=t.height=0,e.canvas=null,e.context=null}_createCanvas(e,t){k("Abstract method `_createCanvas` called.")}},Qt=class extends Zt{constructor({ownerDocument:e=globalThis.document,enableHWA:t=!1}){super({enableHWA:t}),this._document=e}_createCanvas(e,t){let n=this._document.createElement(`canvas`);return n.width=e,n.height=t,n}},$t=class{addFilter(e){return`none`}addHCMFilter(e,t){return`none`}addAlphaFilter(e){return`none`}addLuminosityFilter(e){return`none`}addKnockoutFilter(e=0){return`none`}addHighlightHCMFilter(e,t,n,r,i){return`none`}addSelectionHCMFilter(e,t){return`none`}addSelectionFilter(){return`none`}createSelectionStyle(e=null){return null}destroy(e=!1){}},en=class extends $t{#e;#t;#n;#r;#i;#a;#o=0;constructor({docId:e,ownerDocument:t=globalThis.document}){super(),this.#r=e,this.#i=t}get#s(){return this.#t||=new Map}get#c(){return this.#a||=new Map}get#l(){if(!this.#n){let e=this.#i.createElement(`div`),{style:t}=e;t.colorScheme=`only light`,t.visibility=`hidden`,t.contain=`strict`,t.width=t.height=0,t.position=`absolute`,t.top=t.left=0,t.zIndex=-1;let n=this.#i.createElementNS(c,`svg`);n.setAttribute(`width`,0),n.setAttribute(`height`,0),this.#n=this.#i.createElementNS(c,`defs`),e.append(n),n.append(this.#n),this.#i.body.append(e)}return this.#n}#u(e){if(e.length===1){let t=e[0],n=Array(256);for(let e=0;e<256;e++)n[e]=t[e]/255;let r=n.join(`,`);return[r,r,r]}let[t,n,r]=e,i=Array(256),a=Array(256),o=Array(256);for(let e=0;e<256;e++)i[e]=t[e]/255,a[e]=n[e]/255,o[e]=r[e]/255;return[i.join(`,`),a.join(`,`),o.join(`,`)]}#d(e){if(this.#e===void 0){this.#e=``;let e=this.#i.URL;e!==this.#i.baseURI&&(we(e)?O(`#createUrl: ignore "data:"-URL for performance reasons.`):this.#e=N(e,``))}return`url(${this.#e}#${e})`}addFilter(e){if(!e)return`none`;let t=this.#s.get(e);if(t)return t;let[n,r,i]=this.#u(e),a=e.length===1?n:`${n}${r}${i}`;if(t=this.#s.get(a),t)return this.#s.set(e,t),t;let o=`g_${this.#r}_transfer_map_${this.#o++}`,s=this.#d(o);this.#s.set(e,s),this.#s.set(a,s);let c=this.#m(o);return this.#g(n,r,i,c),s}addHCMFilter(e,t){let n=`${e}-${t}`,r=`base`,i=this.#c.get(r);if(i?.key===n||(i?(i.filter?.remove(),i.key=n,i.url=`none`,i.filter=null):(i={key:n,url:`none`,filter:null},this.#c.set(r,i)),!e||!t))return i.url;let a=this.#v(e);e=B.makeHexColor(...a);let o=this.#v(t);if(t=B.makeHexColor(...o),this.#b(),e===`#000000`&&t===`#ffffff`||e===t)return i.url;let s=Array(256);for(let e=0;e<=255;e++){let t=e/255;s[e]=t<=.03928?t/12.92:((t+.055)/1.055)**2.4}let c=s.join(`,`),l=`g_${this.#r}_hcm_filter`,u=i.filter=this.#m(l);this.#g(c,c,c,u),this.#p(u);let d=(e,t)=>{let n=a[e]/255,r=o[e]/255,i=Array(t+1);for(let e=0;e<=t;e++)i[e]=n+e/t*(r-n);return i.join(`,`)};return this.#g(d(0,5),d(1,5),d(2,5),u),i.url=this.#d(l),i.url}addSelectionHCMFilter(e,t){return this.addHighlightHCMFilter(`selection`,e,t,`HighlightText`,`Highlight`)}addSelectionFilter(){return this.addHighlightHCMFilter(`selection_default`,`black`,`white`,`HighlightText`,`Highlight`)}createSelectionStyle(e=null){let t=e?this.addSelectionHCMFilter(e.foreground,e.background):this.addSelectionFilter();return t===`none`||!z.platform.isFirefox?null:{"backdrop-filter":t,"background-color":`transparent`}}addAlphaFilter(e){let t=this.#s.get(e);if(t)return t;let[n]=this.#u([e]),r=`alpha_${n}`;if(t=this.#s.get(r),t)return this.#s.set(e,t),t;let i=`g_${this.#r}_alpha_map_${this.#o++}`,a=this.#d(i);this.#s.set(e,a),this.#s.set(r,a);let o=this.#m(i);return this.#_(n,o),a}addLuminosityFilter(e){let t=this.#s.get(e||`luminosity`);if(t)return t;let n,r;if(e?([n]=this.#u([e]),r=`luminosity_${n}`):r=`luminosity`,t=this.#s.get(r),t)return this.#s.set(e,t),t;let i=`g_${this.#r}_luminosity_map_${this.#o++}`,a=this.#d(i);this.#s.set(e,a),this.#s.set(r,a);let o=this.#m(i);return this.#f(o),e&&this.#_(n,o),a}addKnockoutFilter(e=0){let t=e>0?Math.min(1/e,1e6):1e6,n=`knockout_${t}`,r=this.#s.get(n);if(r)return r;let i=`g_${this.#r}_knockout_filter_${this.#o++}`,a=this.#d(i);this.#s.set(n,a);let o=this.#m(i),s=this.#i.createElementNS(c,`feComponentTransfer`);o.append(s);let l=this.#i.createElementNS(c,`feFuncA`);return l.setAttribute(`type`,`linear`),l.setAttribute(`slope`,`${t}`),l.setAttribute(`intercept`,`0`),s.append(l),a}addHighlightHCMFilter(e,t,n,r,i){let a=`${t}-${n}-${r}-${i}`,o=this.#c.get(e);if(o?.key===a||(o?(o.filter?.remove(),o.key=a,o.url=`none`,o.filter=null):(o={key:a,url:`none`,filter:null},this.#c.set(e,o)),!t||!n))return o.url;let[s,c]=[t,n].map(this.#v.bind(this)),l=Math.round(.2126*s[0]+.7152*s[1]+.0722*s[2]),u=Math.round(.2126*c[0]+.7152*c[1]+.0722*c[2]),[d,f]=[r,i].map(this.#x.bind(this));u{let r=Array(256),i=(u-l)/n,a=e/255,o=(t-e)/(255*n),s=0;for(let e=0;e<=n;e++){let t=Math.round(l+e*i),n=a+e*o;for(let e=s;e<=t;e++)r[e]=n;s=t+1}for(let e=s;e<256;e++)r[e]=r[s-1];return r.join(`,`)},m=`g_${this.#r}_hcm_${e}_filter`,h=o.filter=this.#m(m);return this.#p(h),this.#g(p(d[0],f[0],5),p(d[1],f[1],5),p(d[2],f[2],5),h),o.url=this.#d(m),o.url}destroy(e=!1){e&&this.#a?.size||(this.#n?.parentNode.parentNode.remove(),this.#n=null,this.#t?.clear(),this.#t=null,this.#a?.clear(),this.#a=null,this.#o=0)}#f(e){let t=this.#i.createElementNS(c,`feColorMatrix`);t.setAttribute(`type`,`matrix`),t.setAttribute(`values`,`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0`),e.append(t)}#p(e){let t=this.#i.createElementNS(c,`feColorMatrix`);t.setAttribute(`type`,`matrix`),t.setAttribute(`values`,`0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0`),e.append(t)}#m(e){let t=this.#i.createElementNS(c,`filter`);return t.setAttribute(`color-interpolation-filters`,`sRGB`),t.setAttribute(`id`,e),this.#l.append(t),t}#h(e,t,n){let r=this.#i.createElementNS(c,t);r.setAttribute(`type`,`discrete`),r.setAttribute(`tableValues`,n),e.append(r)}#g(e,t,n,r){let i=this.#i.createElementNS(c,`feComponentTransfer`);r.append(i),this.#h(i,`feFuncR`,e),this.#h(i,`feFuncG`,t),this.#h(i,`feFuncB`,n)}#_(e,t){let n=this.#i.createElementNS(c,`feComponentTransfer`);t.append(n),this.#h(n,`feFuncA`,e)}#v(e){return this.#l.style.color=`CanvasText`,this.#l.style.backgroundColor=e,Me(getComputedStyle(this.#l).getPropertyValue(`background-color`))}#y(e){return this.#l.style.color=`CanvasText`,this.#l.style.backgroundColor=e,je(getComputedStyle(this.#l).getPropertyValue(`background-color`))}#b(){this.#l.style.color=``,this.#l.style.backgroundColor=``}#x(e){let[t,n,r,i]=this.#y(e);if(i===1)return[t,n,r];let[a,o,s]=this.#v(`Canvas`);return[tn(t,a,i),tn(n,o,i),tn(r,s,i)]}};function tn(e,t,n){return Math.round(n*e+(1-n)*t)}if(i){let e;try{let t=process.getBuiltinModule(`module`).createRequire(import.meta.url);try{e=t("@napi-rs/canvas")}catch(e){O(`Cannot load "@napi-rs/canvas" package: "${e}".`)}}catch(e){O(`Cannot access the \`require\` function: "${e}".`)}globalThis.DOMMatrix||(e?.DOMMatrix?globalThis.DOMMatrix=e.DOMMatrix:O("Cannot polyfill `DOMMatrix`, rendering may be broken.")),globalThis.Path2D||(e?.Path2D?globalThis.Path2D=e.Path2D:O("Cannot polyfill `Path2D`, rendering may be broken.")),globalThis.navigator?.language||(globalThis.navigator={language:`en-US`,platform:``,userAgent:``})}async function nn(e){let t=await process.getBuiltinModule(`fs/promises`).readFile(e);return new Uint8Array(t)}var rn=class extends $t{},an=class extends Zt{_createCanvas(e,t){return process.getBuiltinModule(`module`).createRequire(import.meta.url)(`@napi-rs/canvas`).createCanvas(e,t)}},on=class extends Yt{async _fetch(e,t){return nn(e)}};function sn({src:e,srcPos:t=0,dest:n,width:r,height:i,nonBlackColor:a=4294967295,inverseDecode:o=!1}){let s=z.isLittleEndian?4278190080:255,[c,l]=o?[a,s]:[s,a],u=r>>3,d=r&7,f=c^l,p=e.length;n=new Uint32Array(n.buffer);let m=0;for(let r=0;r>7&1)&f,n[m+1]=c^-(r>>6&1)&f,n[m+2]=c^-(r>>5&1)&f,n[m+3]=c^-(r>>4&1)&f,n[m+4]=c^-(r>>3&1)&f,n[m+5]=c^-(r>>2&1)&f,n[m+6]=c^-(r>>1&1)&f,n[m+7]=c^-(r&1)&f}if(d===0)continue;let r=t>7-e&1)&f}return{srcPos:t,destPos:m}}function cn({src:e,srcPos:t=0,dest:n,destPos:r=0,width:i,height:a}){let o=0,s=i*a*3,c=s>>2,l=new Uint32Array(e.buffer,t,c),u=z.isLittleEndian?4278190080:255;if(z.isLittleEndian){for(;o>>24|t<<8|u,n[r+2]=t>>>16|i<<16|u,n[r+3]=i>>>8|u}for(let i=o*4,a=t+s;i>>8|u,n[r+2]=t<<16|i>>>16|u,n[r+3]=i<<8|u}for(let i=o*4,a=t+s;i - + - +