From bda14f75332ecdc3e429feb6802123f5e2432816 Mon Sep 17 00:00:00 2001 From: maziggy Date: Sun, 27 Sep 2026 10:11:57 +0200 Subject: [PATCH] Widened slicing modal --- CHANGELOG.md | 1 + frontend/src/components/SliceModal.tsx | 9 ++++++--- ...viewModal-DfszICrN.js => PdfPreviewModal-Dz2eXvGI.js} | 4 ++-- ...l-D1xIlPVC.js => SpreadsheetPreviewModal-DCA5VnZ1.js} | 2 +- static/assets/index-DDT9pHR2.css | 2 ++ static/assets/{index-C3lPAZBn.js => index-DZQZ7yaD.js} | 8 ++++---- static/assets/index-TpYl7fWS.css | 2 -- static/assets/{pdf-Dy5qow0P.js => pdf-PYIYFK2D.js} | 2 +- static/index.html | 4 ++-- 9 files changed, 19 insertions(+), 15 deletions(-) rename static/assets/{PdfPreviewModal-DfszICrN.js => PdfPreviewModal-Dz2eXvGI.js} (95%) rename static/assets/{SpreadsheetPreviewModal-D1xIlPVC.js => SpreadsheetPreviewModal-DCA5VnZ1.js} (97%) create mode 100644 static/assets/index-DDT9pHR2.css rename static/assets/{index-C3lPAZBn.js => index-DZQZ7yaD.js} (99%) delete mode 100644 static/assets/index-TpYl7fWS.css rename static/assets/{pdf-Dy5qow0P.js => pdf-PYIYFK2D.js} (99%) diff --git a/CHANGELOG.md b/CHANGELOG.md index c65f291e6..5a7118c8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ All notable changes to Bambuddy will be documented in this file. - **Dutch (nl) is now a supported interface language (#2891, requested and contributed by @Igiegel)** — Adds `nl` as the fourteenth locale, listed as "Nederlands" in the language picker. The translation was contributed as a file on the issue and needed three corrections before it could be wired up, all of which the parity gate found. First, the nine `stats.timeframe.*` entries had their **keys** translated along with their values (`'today'` had become `'vandaag'`), which would have left the Statistics timeframe selector resolving nothing and rendering raw key names for every Dutch user — the values were kept and the keys restored. Second, the file was translated against an older `en.ts` and was 84 leaves short, missing the Filament Track Switch feed prompts, the AI-detection status strings, the no-3MF internal-history banner, the batch-order stranded-plate notices, the Avery starting-position field and the whole `locationHaSensors` section from #2824; those were translated and added. Rather than splice them in, `nl.ts` was regenerated from the `en.ts` skeleton with the contributor's strings carried over, so its structure, key order and section comments now match the reference locale exactly and a future diff against `en.ts` reads as content rather than as reordering. Third, 229 leaves were identical to English; each was checked individually and all were kept, because Dutch takes most technical UI vocabulary verbatim — printer, filament, status, nozzle, timelapse, dashboard — and Dutch slicer users use the English feature names (support, ironing, prime tower, gap fill) untranslated. Those 123 distinct values are now listed explicitly in a `NL_COGNATES` allow-list in `check-i18n-parity.mjs`, the same shape the other twelve locales use, so the exemption is an enumerated translator decision rather than a blanket skip. Parity green at 6264 leaves across all 14 locales. ### Changed +- **The Slice dialog uses more of a large screen** — The dialog stopped at 1024 px wide however large the screen, and its left column was fixed at 320 px. So preset names were cut off, and every filament row wrapped its label and its "hidden / Show all" note, while the process-settings panel beside it sat half empty. The dialog now widens to 1280 px on wide screens and 1536 px on very wide ones, and the left column takes two fifths of it instead of a fixed width. Below 1024 px it is still a single column. - **A STEP preview says it is converting, and for how long (#2976)** — A large STEP export can take over a minute to turn into a mesh in the browser (a 25 MB FreeCAD file took about 75 seconds; coarser meshing settings do not help, the time goes into reading the file), and for all that time the preview showed only a small spinner, which looked like a preview that never opens. STEP loads now show **Converting STEP model… N s** with a running counter and a note that large files can take a minute or more, in all 15 languages. Other formats load in a moment and keep the plain spinner. - **The schema no longer contains a cycle that `metadata.sorted_tables` cannot sort** — `print_archives.library_file_id` → `library_files.folder_id` → `library_folders.archive_id` → back to `print_archives`: three nullable `SET NULL` links, each reasonable alone, that together made a loop SQLAlchemy answered with a sort it could not make and a warning on every backup and every restore. The order it returned could place a child before its parent, which is what once imported `library_files` ahead of `library_folders` and killed a restore on a foreign key violation — the restore has since stopped depending on that order by stripping every foreign key before importing and adding them back afterwards, but the backup export sorts the same way, and the warning ends with "may raise an error in a future release", which would break backup and restore on the same upgrade. One edge of the loop is now marked `use_alter`, which removes it from the sort graph without removing the constraint from the database: PostgreSQL emits it as `ALTER TABLE ... ADD CONSTRAINT`, as it already did for every constraint on those three tables, and SQLite — which reports no ALTER support — inlines it into `CREATE TABLE` exactly as before, so `ON DELETE SET NULL` keeps working on both. `use_alter` requires a name, so new databases carry `fk_library_folders_archive_id` where existing ones keep PostgreSQL's generated `library_folders_archive_id_fkey`; nothing refers to either by name. Pinned by a test that fails if a new foreign key closes a loop again, and by one asserting the key still exists on SQLite — if that inlining ever stopped, deleting an archive would leave a dangling `library_folders.archive_id` instead of nulling it, silently. - **The MakerWorld integration is now a model-provider package, so a second model site is an implementation rather than a second copy of the feature ([PR #2845](https://github.com/maziggy/bambuddy/pull/2845) by @pascalheidmann)** — `services/makerworld.py` was a single 635-line module that owned everything from URL parsing to the presigned S3 download, and the routes called it by name, so Thingiverse or Printables would have meant a second route file beside the first. It is now an interface: a `ModelProvider` descriptor carrying identity, host patterns, the credentials it needs, its library folder, its permissions and its SSRF allowlists, plus a per-request `ProviderService` that does the transport — with MakerWorld as the first implementation and a registry that hands a pasted URL to whichever provider claims it. Nothing about the MakerWorld flow changes: the endpoints and their request and response shapes are unchanged, the new `source_type` field defaults to `makerworld` so existing callers send exactly what they sent before, and the transport moved verbatim — thirteen of the eighteen functions are byte-identical by AST comparison, including the CDN allowlist, the 200 MB download cap and the certifi-pinned TLS context that keeps S3 downloads working on Windows. Four things did change. Bambu Cloud credential storage moved out of `routes/cloud.py` into `services/bambu_cloud_credentials.py`, because a feature package that has to import a route module to read a stored token is a dependency pointing the wrong way; the cloud endpoints themselves did not move. An import naming a provider that is not registered is now refused before anything happens, where it used to create the destination folder on its way to failing. "Your Bambu sign-in expired" is now an explicit flag the provider sets rather than something inferred from whether an error message happened to be present, so a network failure or a rate limit can no longer be reported to you as an expired sign-in. And each request is authorised against the permission of the provider it actually named instead of MakerWorld's — latent while MakerWorld is the only one registered, wrong on the day it is not. diff --git a/frontend/src/components/SliceModal.tsx b/frontend/src/components/SliceModal.tsx index e39361544..b09d83413 100644 --- a/frontend/src/components/SliceModal.tsx +++ b/frontend/src/components/SliceModal.tsx @@ -738,7 +738,7 @@ export function SliceModal({ source, onClose }: SliceModalProps) { }} >
e.stopPropagation()} > {/* Header */} @@ -813,8 +813,11 @@ export function SliceModal({ source, onClose }: SliceModalProps) { "what am I slicing with" decisions together; the right gives the process-settings panel a column of its own, which is the only way 348 options are comfortable to work through. Below - lg both collapse back into the original single stack. */} -
+ lg both collapse back into the original single stack. The + left column grows with the modal: fixed at 20rem it cut + preset names off and wrapped every filament label while the + settings panel sat half empty. */} +
{/* Slicer Pipelines (#1425): apply a saved preset bundle to all four slots, or save the current selection as a pipeline. diff --git a/static/assets/PdfPreviewModal-DfszICrN.js b/static/assets/PdfPreviewModal-Dz2eXvGI.js similarity index 95% rename from static/assets/PdfPreviewModal-DfszICrN.js rename to static/assets/PdfPreviewModal-Dz2eXvGI.js index 6b6ee38e8..dfcc22a3f 100644 --- a/static/assets/PdfPreviewModal-DfszICrN.js +++ b/static/assets/PdfPreviewModal-Dz2eXvGI.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/pdf-Dy5qow0P.js","assets/index-C3lPAZBn.js","assets/chunk-aKtaBQYM.js","assets/index-TpYl7fWS.css"])))=>i.map(i=>d[i]); -import{i as e}from"./chunk-aKtaBQYM.js";import{a as t,c as n,d as r,f as i,h as a,i as o,m as s,n as c,o as l,p as u,r as d,s as f,t as p,u as m}from"./index-C3lPAZBn.js";var h=e(a(),1),g=i();function _(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 v({libraryFileId:e,filename:i,fileSize:a,onClose:v,onSnapshot:y}){let{t:b}=s(),x=(0,h.useRef)(null),S=(0,h.useRef)(null),C=(0,h.useRef)(null),w=(0,h.useRef)(!1),T=(0,h.useRef)(y);(0,h.useEffect)(()=>{T.current=y});let[E,D]=(0,h.useState)(null),[O,k]=(0,h.useState)(1),[A,j]=(0,h.useState)(1),[M,N]=(0,h.useState)(null),[P,F]=(0,h.useState)(!0);(0,h.useEffect)(()=>{let e=e=>{e.key===`Escape`&&v()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[v]),(0,h.useEffect)(()=>{let t=!1,n=null;if(D(null),N(null),k(1),F(!0),a>52428800){N(b(`fileManager.preview.tooLarge`,{size:p(a)})),F(!1);return}let r={},i=d();return i&&(r.Authorization=`Bearer ${i}`),(async()=>{let i=await fetch(c.getLibraryFileDownloadUrl(e),{headers:r});if(!i.ok)throw Error(`HTTP ${i.status}`);let a=await i.arrayBuffer(),o=await u(()=>import(`./pdf-Dy5qow0P.js`),__vite__mapDeps([0,1,2,3]));o.GlobalWorkerOptions.workerSrc||(o.GlobalWorkerOptions.workerSrc=(await u(async()=>{let{default:e}=await import(`./pdf.worker.min-DpOxPwGP.js`);return{default:e}},[])).default),n=o.getDocument({data:new Uint8Array(a)});let s=await n.promise;t||D(s)})().catch(()=>{t||(N(b(`fileManager.preview.error`)),F(!1))}),()=>{t=!0,C.current?.cancel(),C.current=null,n?.destroy()}},[e,a,b]),(0,h.useEffect)(()=>{if(!E)return;let e=!1;return F(!0),(async()=>{let t=await E.getPage(O),n=S.current,r=x.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=t.getViewport({scale:a*A*o});n.width=s.width,n.height=s.height,n.style.width=`${s.width/o}px`,n.style.height=`${s.height/o}px`,C.current?.cancel();let c=t.render({canvas:n,viewport:s});if(C.current=c,await c.promise,!e&&(F(!1),O===1&&T.current&&!w.current)){w.current=!0;let t=await _(n);t&&!e&&T.current?.(t)}})().catch(t=>{!e&&t?.name!==`RenderingCancelledException`&&(N(b(`fileManager.preview.error`)),F(!1))}),()=>{e=!0}},[E,O,A,b]);let I=E?.numPages??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-5xl h-[85vh] border border-bambu-dark-tertiary flex flex-col`,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 min-w-0`,children:[(0,g.jsx)(n,{className:`w-5 h-5 text-bambu-green flex-shrink-0`}),(0,g.jsx)(`h2`,{className:`text-lg font-semibold text-white truncate`,children:i})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[E&&I>1&&(0,g.jsxs)(`div`,{className:`flex items-center gap-1 mr-2`,children:[(0,g.jsx)(`button`,{onClick:()=>k(e=>Math.max(1,e-1)),disabled:O<=1,className:`p-1.5 rounded hover:bg-bambu-dark text-bambu-gray hover:text-white transition-colors disabled:opacity-40 disabled:cursor-not-allowed`,"aria-label":b(`fileManager.preview.prevPage`),children:(0,g.jsx)(m,{className:`w-4 h-4`})}),(0,g.jsx)(`span`,{className:`text-sm text-bambu-gray whitespace-nowrap`,children:b(`fileManager.preview.page`,{current:O,total:I})}),(0,g.jsx)(`button`,{onClick:()=>k(e=>Math.min(I,e+1)),disabled:O>=I,className:`p-1.5 rounded hover:bg-bambu-dark text-bambu-gray hover:text-white transition-colors disabled:opacity-40 disabled:cursor-not-allowed`,"aria-label":b(`fileManager.preview.nextPage`),children:(0,g.jsx)(r,{className:`w-4 h-4`})})]}),E&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`button`,{onClick:()=>j(e=>Math.max(.4,e*.8)),className:`p-1.5 rounded hover:bg-bambu-dark text-bambu-gray hover:text-white transition-colors`,"aria-label":b(`fileManager.preview.zoomOut`),children:(0,g.jsx)(o,{className:`w-4 h-4`})}),(0,g.jsx)(`button`,{onClick:()=>j(e=>Math.min(4,e*1.25)),className:`p-1.5 rounded hover:bg-bambu-dark text-bambu-gray hover:text-white transition-colors`,"aria-label":b(`fileManager.preview.zoomIn`),children:(0,g.jsx)(t,{className:`w-4 h-4`})})]}),(0,g.jsx)(`button`,{onClick:v,className:`p-1.5 rounded hover:bg-bambu-dark text-bambu-gray hover:text-white transition-colors`,"aria-label":b(`common.close`),children:(0,g.jsx)(l,{className:`w-5 h-5`})})]})]}),(0,g.jsxs)(`div`,{ref:x,className:`relative flex-1 min-h-0 overflow-auto bg-bambu-dark rounded-b-lg p-4`,children:[M?(0,g.jsx)(`div`,{className:`h-full flex items-center justify-center`,children:(0,g.jsx)(`p`,{className:`text-bambu-gray text-center`,children:M})}):(0,g.jsx)(`div`,{className:`flex justify-center min-w-fit`,children:(0,g.jsx)(`canvas`,{ref:S,className:`shadow-lg`})}),!M&&P&&(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{v as PdfPreviewModal}; \ No newline at end of file +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/pdf-PYIYFK2D.js","assets/index-DZQZ7yaD.js","assets/chunk-aKtaBQYM.js","assets/index-DDT9pHR2.css"])))=>i.map(i=>d[i]); +import{i as e}from"./chunk-aKtaBQYM.js";import{a as t,c as n,d as r,f as i,h as a,i as o,m as s,n as c,o as l,p as u,r as d,s as f,t as p,u as m}from"./index-DZQZ7yaD.js";var h=e(a(),1),g=i();function _(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 v({libraryFileId:e,filename:i,fileSize:a,onClose:v,onSnapshot:y}){let{t:b}=s(),x=(0,h.useRef)(null),S=(0,h.useRef)(null),C=(0,h.useRef)(null),w=(0,h.useRef)(!1),T=(0,h.useRef)(y);(0,h.useEffect)(()=>{T.current=y});let[E,D]=(0,h.useState)(null),[O,k]=(0,h.useState)(1),[A,j]=(0,h.useState)(1),[M,N]=(0,h.useState)(null),[P,F]=(0,h.useState)(!0);(0,h.useEffect)(()=>{let e=e=>{e.key===`Escape`&&v()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[v]),(0,h.useEffect)(()=>{let t=!1,n=null;if(D(null),N(null),k(1),F(!0),a>52428800){N(b(`fileManager.preview.tooLarge`,{size:p(a)})),F(!1);return}let r={},i=d();return i&&(r.Authorization=`Bearer ${i}`),(async()=>{let i=await fetch(c.getLibraryFileDownloadUrl(e),{headers:r});if(!i.ok)throw Error(`HTTP ${i.status}`);let a=await i.arrayBuffer(),o=await u(()=>import(`./pdf-PYIYFK2D.js`),__vite__mapDeps([0,1,2,3]));o.GlobalWorkerOptions.workerSrc||(o.GlobalWorkerOptions.workerSrc=(await u(async()=>{let{default:e}=await import(`./pdf.worker.min-DpOxPwGP.js`);return{default:e}},[])).default),n=o.getDocument({data:new Uint8Array(a)});let s=await n.promise;t||D(s)})().catch(()=>{t||(N(b(`fileManager.preview.error`)),F(!1))}),()=>{t=!0,C.current?.cancel(),C.current=null,n?.destroy()}},[e,a,b]),(0,h.useEffect)(()=>{if(!E)return;let e=!1;return F(!0),(async()=>{let t=await E.getPage(O),n=S.current,r=x.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=t.getViewport({scale:a*A*o});n.width=s.width,n.height=s.height,n.style.width=`${s.width/o}px`,n.style.height=`${s.height/o}px`,C.current?.cancel();let c=t.render({canvas:n,viewport:s});if(C.current=c,await c.promise,!e&&(F(!1),O===1&&T.current&&!w.current)){w.current=!0;let t=await _(n);t&&!e&&T.current?.(t)}})().catch(t=>{!e&&t?.name!==`RenderingCancelledException`&&(N(b(`fileManager.preview.error`)),F(!1))}),()=>{e=!0}},[E,O,A,b]);let I=E?.numPages??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-5xl h-[85vh] border border-bambu-dark-tertiary flex flex-col`,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 min-w-0`,children:[(0,g.jsx)(n,{className:`w-5 h-5 text-bambu-green flex-shrink-0`}),(0,g.jsx)(`h2`,{className:`text-lg font-semibold text-white truncate`,children:i})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[E&&I>1&&(0,g.jsxs)(`div`,{className:`flex items-center gap-1 mr-2`,children:[(0,g.jsx)(`button`,{onClick:()=>k(e=>Math.max(1,e-1)),disabled:O<=1,className:`p-1.5 rounded hover:bg-bambu-dark text-bambu-gray hover:text-white transition-colors disabled:opacity-40 disabled:cursor-not-allowed`,"aria-label":b(`fileManager.preview.prevPage`),children:(0,g.jsx)(m,{className:`w-4 h-4`})}),(0,g.jsx)(`span`,{className:`text-sm text-bambu-gray whitespace-nowrap`,children:b(`fileManager.preview.page`,{current:O,total:I})}),(0,g.jsx)(`button`,{onClick:()=>k(e=>Math.min(I,e+1)),disabled:O>=I,className:`p-1.5 rounded hover:bg-bambu-dark text-bambu-gray hover:text-white transition-colors disabled:opacity-40 disabled:cursor-not-allowed`,"aria-label":b(`fileManager.preview.nextPage`),children:(0,g.jsx)(r,{className:`w-4 h-4`})})]}),E&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`button`,{onClick:()=>j(e=>Math.max(.4,e*.8)),className:`p-1.5 rounded hover:bg-bambu-dark text-bambu-gray hover:text-white transition-colors`,"aria-label":b(`fileManager.preview.zoomOut`),children:(0,g.jsx)(o,{className:`w-4 h-4`})}),(0,g.jsx)(`button`,{onClick:()=>j(e=>Math.min(4,e*1.25)),className:`p-1.5 rounded hover:bg-bambu-dark text-bambu-gray hover:text-white transition-colors`,"aria-label":b(`fileManager.preview.zoomIn`),children:(0,g.jsx)(t,{className:`w-4 h-4`})})]}),(0,g.jsx)(`button`,{onClick:v,className:`p-1.5 rounded hover:bg-bambu-dark text-bambu-gray hover:text-white transition-colors`,"aria-label":b(`common.close`),children:(0,g.jsx)(l,{className:`w-5 h-5`})})]})]}),(0,g.jsxs)(`div`,{ref:x,className:`relative flex-1 min-h-0 overflow-auto bg-bambu-dark rounded-b-lg p-4`,children:[M?(0,g.jsx)(`div`,{className:`h-full flex items-center justify-center`,children:(0,g.jsx)(`p`,{className:`text-bambu-gray text-center`,children:M})}):(0,g.jsx)(`div`,{className:`flex justify-center min-w-fit`,children:(0,g.jsx)(`canvas`,{ref:S,className:`shadow-lg`})}),!M&&P&&(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{v as PdfPreviewModal}; \ No newline at end of file diff --git a/static/assets/SpreadsheetPreviewModal-D1xIlPVC.js b/static/assets/SpreadsheetPreviewModal-DCA5VnZ1.js similarity index 97% rename from static/assets/SpreadsheetPreviewModal-D1xIlPVC.js rename to static/assets/SpreadsheetPreviewModal-DCA5VnZ1.js index c0f399d7f..bfc28d878 100644 --- a/static/assets/SpreadsheetPreviewModal-D1xIlPVC.js +++ b/static/assets/SpreadsheetPreviewModal-DCA5VnZ1.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{f as t,h as n,l as r,m as i,n as a,o,p as s,r as c,s as l,t as u}from"./index-C3lPAZBn.js";var d=e(n(),1),f=t(),p=500,m=40;function h(e){let t=``,n=e;for(;n>=0;)t=String.fromCharCode(65+n%26)+t,n=Math.floor(n/26)-1;return t}function g(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 _({libraryFileId:t,filename:n,fileType:_,fileSize:v,onClose:y,onSnapshot:b}){let{t:x}=i(),[S,C]=(0,d.useState)(null),[w,T]=(0,d.useState)(0),[E,D]=(0,d.useState)(null),O=(0,d.useRef)(!1),k=(0,d.useRef)(b);(0,d.useEffect)(()=>{k.current=b}),(0,d.useEffect)(()=>{let e=e=>{e.key===`Escape`&&y()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[y]),(0,d.useEffect)(()=>{let r=!1;if(C(null),D(null),T(0),v>20971520){D(x(`fileManager.preview.tooLarge`,{size:u(v)}));return}let i={},o=c();return o&&(i.Authorization=`Bearer ${o}`),(async()=>{let o=await fetch(a.getLibraryFileDownloadUrl(t),{headers:i});if(!o.ok)throw Error(`HTTP ${o.status}`);let c=await o.arrayBuffer(),l;if(_===`csv`){let t=(await s(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(c),i=t.parse(r,{skipEmptyLines:!1}).data.filter(e=>Array.isArray(e));for(;i.length>0&&i[i.length-1].every(e=>!e);)i.pop();let a=i.length,o=i.reduce((e,t)=>Math.max(e,t.length),0);l=[{name:n,rows:i.slice(0,p).map(e=>e.slice(0,m).map(e=>e??``)),totalRows:a,totalCols:o}]}else{let e=await s(()=>import(`./xlsx-CKkngM-o.js`),[]),t=e.read(c,{dense:!0});l=t.SheetNames.map(n=>{let r=t.Sheets[n],i=r?.[`!ref`];if(!r||!i)return{name:n,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+p-1),c:Math.min(a.e.c,a.s.c+m-1)}};return{name:n,rows:e.utils.sheet_to_json(r,{header:1,raw:!1,defval:``,range:e.utils.encode_range(c)}),totalRows:o,totalCols:s}})}if(!r&&(C(l),k.current&&!O.current)){let e=l.find(e=>e.rows.length>0);if(e){O.current=!0;let t=await g(e.rows);t&&!r&&k.current?.(t)}}})().catch(()=>{r||D(x(`fileManager.preview.error`))}),()=>{r=!0}},[t,_,v,n,x]);let A=S?.[w]??null,j=A!=null&&A.totalRows>A.rows.length,M=A!=null&&A.totalCols>m,N=A==null?0:Math.min(A.totalCols,m);return(0,f.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,children:(0,f.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg w-full max-w-6xl h-[85vh] border border-bambu-dark-tertiary flex flex-col`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-bambu-dark-tertiary`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,f.jsx)(r,{className:`w-5 h-5 text-bambu-green flex-shrink-0`}),(0,f.jsx)(`h2`,{className:`text-lg font-semibold text-white truncate`,children:n})]}),(0,f.jsx)(`button`,{onClick:y,className:`p-1.5 rounded hover:bg-bambu-dark text-bambu-gray hover:text-white transition-colors`,"aria-label":x(`common.close`),children:(0,f.jsx)(o,{className:`w-5 h-5`})})]}),S&&S.length>1&&(0,f.jsx)(`div`,{className:`flex gap-1 px-4 pt-2 overflow-x-auto flex-shrink-0`,children:S.map((e,t)=>(0,f.jsx)(`button`,{onClick:()=>T(t),className:`px-3 py-1.5 text-sm rounded-t whitespace-nowrap transition-colors ${t===w?`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,f.jsx)(`div`,{className:`flex-1 min-h-0 overflow-auto bg-bambu-dark rounded-b-lg`,children:E?(0,f.jsx)(`div`,{className:`h-full flex items-center justify-center p-6`,children:(0,f.jsx)(`p`,{className:`text-bambu-gray text-center`,children:E})}):S?!A||A.rows.length===0?(0,f.jsx)(`div`,{className:`h-full flex items-center justify-center p-6`,children:(0,f.jsx)(`p`,{className:`text-bambu-gray`,children:x(`fileManager.preview.emptySheet`)})}):(0,f.jsxs)(`table`,{className:`border-collapse text-xs`,children:[(0,f.jsx)(`thead`,{children:(0,f.jsxs)(`tr`,{children:[(0,f.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:N},(e,t)=>(0,f.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:h(t)},t))]})}),(0,f.jsx)(`tbody`,{children:A.rows.map((e,t)=>(0,f.jsxs)(`tr`,{children:[(0,f.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:N},(t,n)=>(0,f.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,f.jsx)(`div`,{className:`h-full flex items-center justify-center`,children:(0,f.jsx)(l,{className:`w-8 h-8 text-bambu-green animate-spin`})})}),(j||M)&&A&&(0,f.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:[j&&(0,f.jsx)(`span`,{children:x(`fileManager.preview.truncatedRows`,{shown:A.rows.length,total:A.totalRows})}),M&&(0,f.jsx)(`span`,{children:x(`fileManager.preview.truncatedCols`,{shown:N,total:A.totalCols})})]})]})})}export{_ as SpreadsheetPreviewModal}; \ No newline at end of file +import{i as e}from"./chunk-aKtaBQYM.js";import{f as t,h as n,l as r,m as i,n as a,o,p as s,r as c,s as l,t as u}from"./index-DZQZ7yaD.js";var d=e(n(),1),f=t(),p=500,m=40;function h(e){let t=``,n=e;for(;n>=0;)t=String.fromCharCode(65+n%26)+t,n=Math.floor(n/26)-1;return t}function g(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 _({libraryFileId:t,filename:n,fileType:_,fileSize:v,onClose:y,onSnapshot:b}){let{t:x}=i(),[S,C]=(0,d.useState)(null),[w,T]=(0,d.useState)(0),[E,D]=(0,d.useState)(null),O=(0,d.useRef)(!1),k=(0,d.useRef)(b);(0,d.useEffect)(()=>{k.current=b}),(0,d.useEffect)(()=>{let e=e=>{e.key===`Escape`&&y()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[y]),(0,d.useEffect)(()=>{let r=!1;if(C(null),D(null),T(0),v>20971520){D(x(`fileManager.preview.tooLarge`,{size:u(v)}));return}let i={},o=c();return o&&(i.Authorization=`Bearer ${o}`),(async()=>{let o=await fetch(a.getLibraryFileDownloadUrl(t),{headers:i});if(!o.ok)throw Error(`HTTP ${o.status}`);let c=await o.arrayBuffer(),l;if(_===`csv`){let t=(await s(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(c),i=t.parse(r,{skipEmptyLines:!1}).data.filter(e=>Array.isArray(e));for(;i.length>0&&i[i.length-1].every(e=>!e);)i.pop();let a=i.length,o=i.reduce((e,t)=>Math.max(e,t.length),0);l=[{name:n,rows:i.slice(0,p).map(e=>e.slice(0,m).map(e=>e??``)),totalRows:a,totalCols:o}]}else{let e=await s(()=>import(`./xlsx-CKkngM-o.js`),[]),t=e.read(c,{dense:!0});l=t.SheetNames.map(n=>{let r=t.Sheets[n],i=r?.[`!ref`];if(!r||!i)return{name:n,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+p-1),c:Math.min(a.e.c,a.s.c+m-1)}};return{name:n,rows:e.utils.sheet_to_json(r,{header:1,raw:!1,defval:``,range:e.utils.encode_range(c)}),totalRows:o,totalCols:s}})}if(!r&&(C(l),k.current&&!O.current)){let e=l.find(e=>e.rows.length>0);if(e){O.current=!0;let t=await g(e.rows);t&&!r&&k.current?.(t)}}})().catch(()=>{r||D(x(`fileManager.preview.error`))}),()=>{r=!0}},[t,_,v,n,x]);let A=S?.[w]??null,j=A!=null&&A.totalRows>A.rows.length,M=A!=null&&A.totalCols>m,N=A==null?0:Math.min(A.totalCols,m);return(0,f.jsx)(`div`,{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4`,children:(0,f.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg w-full max-w-6xl h-[85vh] border border-bambu-dark-tertiary flex flex-col`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-bambu-dark-tertiary`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,f.jsx)(r,{className:`w-5 h-5 text-bambu-green flex-shrink-0`}),(0,f.jsx)(`h2`,{className:`text-lg font-semibold text-white truncate`,children:n})]}),(0,f.jsx)(`button`,{onClick:y,className:`p-1.5 rounded hover:bg-bambu-dark text-bambu-gray hover:text-white transition-colors`,"aria-label":x(`common.close`),children:(0,f.jsx)(o,{className:`w-5 h-5`})})]}),S&&S.length>1&&(0,f.jsx)(`div`,{className:`flex gap-1 px-4 pt-2 overflow-x-auto flex-shrink-0`,children:S.map((e,t)=>(0,f.jsx)(`button`,{onClick:()=>T(t),className:`px-3 py-1.5 text-sm rounded-t whitespace-nowrap transition-colors ${t===w?`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,f.jsx)(`div`,{className:`flex-1 min-h-0 overflow-auto bg-bambu-dark rounded-b-lg`,children:E?(0,f.jsx)(`div`,{className:`h-full flex items-center justify-center p-6`,children:(0,f.jsx)(`p`,{className:`text-bambu-gray text-center`,children:E})}):S?!A||A.rows.length===0?(0,f.jsx)(`div`,{className:`h-full flex items-center justify-center p-6`,children:(0,f.jsx)(`p`,{className:`text-bambu-gray`,children:x(`fileManager.preview.emptySheet`)})}):(0,f.jsxs)(`table`,{className:`border-collapse text-xs`,children:[(0,f.jsx)(`thead`,{children:(0,f.jsxs)(`tr`,{children:[(0,f.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:N},(e,t)=>(0,f.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:h(t)},t))]})}),(0,f.jsx)(`tbody`,{children:A.rows.map((e,t)=>(0,f.jsxs)(`tr`,{children:[(0,f.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:N},(t,n)=>(0,f.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,f.jsx)(`div`,{className:`h-full flex items-center justify-center`,children:(0,f.jsx)(l,{className:`w-8 h-8 text-bambu-green animate-spin`})})}),(j||M)&&A&&(0,f.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:[j&&(0,f.jsx)(`span`,{children:x(`fileManager.preview.truncatedRows`,{shown:A.rows.length,total:A.totalRows})}),M&&(0,f.jsx)(`span`,{children:x(`fileManager.preview.truncatedCols`,{shown:N,total:A.totalCols})})]})]})})}export{_ as SpreadsheetPreviewModal}; \ No newline at end of file diff --git a/static/assets/index-DDT9pHR2.css b/static/assets/index-DDT9pHR2.css new file mode 100644 index 000000000..42d54a0f6 --- /dev/null +++ b/static/assets/index-DDT9pHR2.css @@ -0,0 +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-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-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-\[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}.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-\[85vh\]{height:85vh}.h-\[160px\]{height:160px}.h-\[300px\]{height:300px}.h-\[calc\(100\%-40px\)\]{height:calc(100% - 40px)}.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-\[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-\[8rem\]{min-height:8rem}.min-h-\[14px\]{min-height:14px}.min-h-\[16px\]{min-height:16px}.min-h-\[18px\]{min-height:18px}.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-\[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-\[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-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-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\/40{border-color:#3080ff66}@supports (color:color-mix(in lab, red, red)){.border-blue-500\/40{border-color:color-mix(in oklab,var(--color-blue-500)40%,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-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-zinc-800{border-color:var(--color-zinc-800)}.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\/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-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-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-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-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\:border-bambu-dark-tertiary:disabled:hover{border-color:var(--color-bambu-dark-tertiary)}.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\: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\: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\: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\: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-x-visible{overflow-x:visible}.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\: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\/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\/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-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\/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-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\/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-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-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-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}}.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/index-C3lPAZBn.js b/static/assets/index-DZQZ7yaD.js similarity index 99% rename from static/assets/index-C3lPAZBn.js rename to static/assets/index-DZQZ7yaD.js index ace1da805..7f049d209 100644 --- a/static/assets/index-C3lPAZBn.js +++ b/static/assets/index-DZQZ7yaD.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PdfPreviewModal-DfszICrN.js","assets/chunk-aKtaBQYM.js","assets/SpreadsheetPreviewModal-D1xIlPVC.js"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PdfPreviewModal-Dz2eXvGI.js","assets/chunk-aKtaBQYM.js","assets/SpreadsheetPreviewModal-DCA5VnZ1.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)`:-10||W.vt_tray.length>0)&&r===`expanded`&&(()=>{let t=Dn.filter(e=>e.tray.length>1),n=Dn.filter(e=>e.tray.length===1),r=Dn.length>0&&W.vt_tray.length>0,f=!(r&&Se),_=e.nozzle_count===2||W?.temperatures?.nozzle_2!==void 0,v=vW[i]??1,y=e=>`${Math.round(e*v*1e3)/1e3}rem`,b=`3.5rem`,x={minWidth:b},S={minWidth:b,maxWidth:y(7.25)},C=e=>({gridTemplateColumns:`repeat(${e}, minmax(${b}, 1fr))`}),w=(W.state===`RUNNING`||W.state===`PAUSE`)&&Array.isArray(W.ams_mapping)?W.ams_mapping:[],T=e=>{let t=Math.max(1,e),n=`calc(${t} * ${b} + ${Math.max(0,t-1)} * 0.25rem + 1rem)`;return{flex:`1 1 ${n}`,minWidth:n}};return(0,G.jsxs)(`div`,{className:`mt-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,G.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] uppercase tracking-wider text-bambu-gray font-medium`,children:F(`printers.filaments`)}),(0,G.jsx)(OAe,{state:W.ams_filament_backup,onClick:()=>xe(!0)}),(0,G.jsx)(`div`,{className:`flex-1 h-[2px] bg-bambu-dark-tertiary`}),r&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(kAe,{hidden:Se,onClick:we}),(0,G.jsx)(`div`,{className:`w-3 h-[2px] bg-bambu-dark-tertiary`})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[t.map(t=>{let n=tW(t.id,Sn,Tn,wn);return(0,G.jsxs)(`div`,{style:T(4),className:`min-w-0 p-2 bg-bambu-dark rounded-[10px] space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex w-full min-h-7 items-center justify-between gap-2 rounded-lg bg-bambu-dark-secondary px-2 py-1`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[(0,G.jsx)(gW,{ams:t,printerId:e.id,label:up(t.id,t.tray.length),amsLabels:mn,canEdit:z(`printers:update`),onSaved:hn,children:(0,G.jsx)(`span`,{className:`block truncate text-[length:var(--pc-t10,10px)] text-white font-medium cursor-default select-none`,children:mn?.[t.id]||up(t.id,t.tray.length)})}),n?.kind===`inlet`?(0,G.jsx)(eW,{inlet:n.inlet,title:F(`printers.amsSwitchInletTooltip`,{inlet:n.inlet,side:sp[n.inlet]})}):_&&n?.kind===`nozzle`?(0,G.jsx)($U,{side:n.side}):null]}),(t.humidity!=null||t.temp!=null)&&(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[t.humidity!=null&&(0,G.jsx)(oW,{humidity:t.humidity,goodThreshold:a?.humidityGood,fairThreshold:a?.humidityFair,onClick:()=>Pt({amsId:t.id,amsLabel:up(t.id,t.tray.length),mode:`humidity`}),compact:!0}),t.temp!=null&&(0,G.jsx)(`div`,{className:`mr-1`,children:(0,G.jsx)(sW,{temp:t.temp,goodThreshold:a?.tempGood,fairThreshold:a?.tempFair,onClick:()=>Pt({amsId:t.id,amsLabel:up(t.id,t.tray.length),mode:`temperature`}),compact:!0})}),(W.supports_drying||W.drying_screen_only)&&(t.module_type===`n3f`||t.module_type===`n3s`)&&z(`printers:control`)&&(0,G.jsx)(`button`,{disabled:W.drying_screen_only||!!(t.dry_sf_reason?.length&&t.dry_time===0),onClick:e=>{t.dry_time>0?lr.mutate(t.id):Qe===t.id?$e(null):bt(t,e.currentTarget)},className:`ml-1 flex items-center gap-0.5 px-1 py-0.5 rounded text-[length:var(--pc-t9,9px)] transition-colors ${t.dry_time>0?`bg-amber-100 dark:bg-amber-500/20 text-amber-700 dark:text-amber-400`:W.drying_screen_only||t.dry_sf_reason?.length?`bg-bambu-dark text-bambu-gray/50 cursor-not-allowed`:`bg-bambu-dark text-bambu-gray hover:text-white hover:bg-bambu-dark/80`}`,title:W.drying_screen_only?F(`printers.drying.screenOnly`):t.dry_time>0?F(`printers.drying.stop`):t.dry_sf_reason?.length?F(_Ae(t.dry_sf_reason)):F(`printers.drying.start`),children:(0,G.jsx)(lc,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`})})]})]}),t.dry_time>0&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-amber-50 dark:bg-amber-500/10 px-2 py-1 text-[length:var(--pc-t9,9px)]`,children:[(0,G.jsx)(lc,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)] text-amber-600 dark:text-amber-400 shrink-0`}),(0,G.jsx)(`span`,{className:`text-amber-700 dark:text-amber-400 font-medium`,children:F(`printers.drying.active`)}),t.dry_filament&&(0,G.jsx)(`span`,{className:`text-amber-700/80 dark:text-amber-300/70`,children:t.dry_target_temp==null?t.dry_filament:F(`printers.drying.targetSummary`,{filament:t.dry_filament,temp:t.dry_target_temp})}),(0,G.jsx)(`span`,{className:`text-amber-700/80 dark:text-amber-300/70`,children:F(`printers.drying.timeRemaining`,{time:t.dry_time>=60?`${Math.floor(t.dry_time/60)}h ${t.dry_time%60}m`:`${t.dry_time}m`})}),!W.drying_screen_only&&(0,G.jsx)(`button`,{onClick:()=>lr.mutate(t.id),disabled:lr.isPending,className:`ml-auto text-amber-700 dark:text-amber-400 hover:text-amber-900 dark:hover:text-amber-300 transition-colors disabled:opacity-50`,title:F(`printers.drying.stop`),children:(0,G.jsx)(Zu,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`})})]}),(0,G.jsx)(`div`,{className:`grid w-full gap-1`,style:C(4),children:[0,1,2,3].map(n=>{let r=t.tray[n]||t.tray.find(e=>e.id===n),i=r?.tray_type&&r.remain>=0,a=!r?.tray_type,f=cW(r),_=t.id*4+n,v=jn===_,y=Mn!==null&&Mn===_,b=Nn!==null&&Nn===_,S=r?.tray_info_idx?ln?.[r.tray_info_idx]:null,C=un?.[_],T=Lp(C?.preset_id,r?.tray_info_idx)?C?.preset_name:void 0,E=(r?.tray_uuid||r?.tag_uid||Dp(e.serial_number,t.id,n))?.toUpperCase(),D=E?s?.[E]:void 0,O=wp(D),k=o&&!h?m?.find(r=>r.printer_id===e.id&&r.ams_id===t.id&&r.tray_id===n):void 0,A=k?p?.find(e=>e.id===k.spoolman_spool_id):void 0,j=A&&(A.label_weight??0)>0?Math.round(Math.max(0,(A.label_weight??0)-A.weight_used)/(A.label_weight??1)*100):null,M=u?.(e.id,t.id,n),N=(()=>{let e=M?.spool;return e&&e.label_weight>0&&e.weight_used!=null?Math.round(Math.max(0,e.label_weight-e.weight_used)/e.label_weight*100):null})(),P=N===0&&i&&r.remain>0?null:N,I=O??j??P??(i?r.remain:null),L=O!==null||j!==null?`spoolman`:P===null?i?`ams`:void 0:`inventory`,R=r?.tray_type?{vendor:Ip(r)?`Bambu Lab`:`Generic`,profile:T||(A?[A.brand,A.slicer_filament_name?.split(`@`)[0].trim()||A.material].filter(Boolean).join(` `).trim():null)||M?.spool?.slicer_filament_name||S?.name||r.tray_sub_brands||r.tray_type,colorName:bf(r.tray_color||``,r.tray_sub_brands),colorHex:r.tray_color||null,kFactor:ZU(r.k),fillLevel:I,trayUuid:r.tray_uuid||null,tagUid:r.tag_uid||null,fillSource:L}:null,B=Vr?.amsId===t.id&&Vr?.slotId===n,V=w.indexOf(_),ee=V>=0?`P${V+1}`:null,te=(0,G.jsxs)(`div`,{className:`relative w-full bg-bambu-dark-secondary rounded-lg p-1 text-center ${a?`opacity-50`:``} ${y?`ring-2 ring-amber-400 ring-offset-1 ring-offset-bambu-dark animate-pulse`:b?`ring-2 ring-red-500/60 ring-offset-1 ring-offset-bambu-dark`:v?`ring-2 ring-bambu-green ring-offset-1 ring-offset-bambu-dark`:``}`,children:[y&&(0,G.jsx)(`span`,{"aria-label":F(`printers.expectedSlot.ariaLabel`,{n:n+1}),title:F(`printers.expectedSlot.title`),className:`absolute top-0.5 left-0.5 px-1 py-px text-[length:var(--pc-t8,8px)] font-bold text-bambu-dark bg-amber-400 rounded pointer-events-none leading-none`,children:`↓`}),ee&&(0,G.jsx)(`span`,{"aria-label":F(`printers.activeJobSlot.ariaLabel`,{n:V+1}),title:F(`printers.activeJobSlot.title`,{n:V+1}),className:`absolute top-0.5 right-0.5 px-1 py-px text-[length:var(--pc-t8,8px)] font-bold text-bambu-dark bg-bambu-green rounded pointer-events-none leading-none`,children:ee}),(0,G.jsx)(JU,{trayColor:r?.tray_color,trayType:r?.tray_type,isEmpty:a,emptyKind:f,slotNumber:n+1}),(0,G.jsx)(`div`,{className:`text-[length:var(--pc-t9,9px)] text-white font-bold truncate`,children:r?.tray_type||F(f===`reset`?`ams.slotUnconfigured`:`ams.slotEmpty`)}),(0,G.jsx)(QU,{k:R?r?.k:null,reserve:On}),(0,G.jsx)(`div`,{className:`mt-1 h-1.5 bg-black/30 rounded-full overflow-hidden`,children:I!==null&&I>=0&&!a&&r&&(0,G.jsx)(`div`,{className:`h-full rounded-full transition-all`,style:{width:`${I}%`,backgroundColor:Cp(I)}})})]});return(0,G.jsxs)(`div`,{className:`relative group w-full`,style:x,children:[B&&(0,G.jsx)(`div`,{className:`absolute inset-0 bg-bambu-dark-tertiary/80 rounded flex items-center justify-center z-20`,children:(0,G.jsx)(Fl,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)] text-bambu-green animate-spin`})}),R?(0,G.jsx)(YH,{data:R,actions:Ei({amsId:t.id,slotId:n,loadTrayId:t.id*4+n,isRefreshing:B}),spoolman:{enabled:o,linkedSpoolId:k?.spoolman_spool_id??(E?s?.[E]?.id:void 0),spoolmanUrl:c,syncMode:l,onLinkSpool:o&&!k&&!M?()=>{let r=(R.trayUuid||R.tagUid||Dp(e.serial_number,t.id,n)).toUpperCase();Rt({tagUid:R.tagUid||r,trayUuid:R.trayUuid||``,printerId:e.id,amsId:t.id,trayId:n})}:void 0,onUnlinkSpool:D?.id?()=>or.mutate(D.id):void 0},inventory:(()=>{if(o){if(h)return;let i=k,a=A;return{assignedSpool:a?{id:a.id,material:a.material,subtype:a.subtype,brand:a.brand??null,color_name:a.color_name??null,color_name_is_synthesized:a.color_name_is_synthesized,rgba:a.rgba??null,extra_colors:a.extra_colors??null,effect_type:a.effect_type??null,remainingWeightGrams:a.label_weight?Math.max(0,Math.round(a.label_weight-a.weight_used)):void 0}:null,onAssignSpool:()=>Bt({printerId:e.id,amsId:t.id,trayId:n,trayInfo:{type:r?.tray_type||R.profile,material:r?.tray_type??void 0,profile:R.profile,color:R.colorHex||``,location:`${up(t.id,t.tray.length)} Slot ${n+1}`}}),onUnassignSpool:a&&!Ip(r)?()=>g?.(a.id):void 0,isAssigned:!!i||Ip(r)}}let i=u?.(e.id,t.id,n);return{assignedSpool:i?.spool?{id:i.spool.id,material:i.spool.material,subtype:i.spool.subtype,brand:i.spool.brand,color_name:i.spool.color_name,rgba:i.spool.rgba??null,extra_colors:i.spool.extra_colors??null,effect_type:i.spool.effect_type??null,remainingWeightGrams:Math.max(0,Math.round(i.spool.label_weight-i.spool.weight_used))}:null,onAssignSpool:()=>Bt({printerId:e.id,amsId:t.id,trayId:n,trayInfo:{type:r?.tray_type||R.profile,material:r?.tray_type??void 0,profile:R.profile,color:R.colorHex||``,location:`${up(t.id,t.tray.length)} Slot ${n+1}`}}),onUnassignSpool:i&&!Ip(r)?()=>d?.(e.id,t.id,n):void 0,isAssigned:!!i||Ip(r)}})(),configureSlot:{enabled:z(`printers:control`),onConfigure:()=>Ht({amsId:t.id,trayId:n,trayCount:t.tray.length,trayType:r?.tray_type||void 0,trayColor:r?.tray_color||void 0,traySubBrands:r?.tray_sub_brands||void 0,trayInfoIdx:r?.tray_info_idx||void 0,extruderId:lp(t.id,r?.id??0,Sn,Tn),caliIdx:r?.cali_idx,savedPresetId:C?.preset_id})},children:te}):(0,G.jsx)(XH,{kind:f??void 0,actions:Ei({amsId:t.id,slotId:n,loadTrayId:t.id*4+n,isRefreshing:B}),configureSlot:{enabled:z(`printers:control`),onConfigure:()=>Ht({amsId:t.id,trayId:n,trayCount:t.tray.length,extruderId:lp(t.id,r?.id??0,Sn,Tn)})},onAssignSpool:()=>Bt({printerId:e.id,amsId:t.id,trayId:n,trayInfo:{type:``,material:void 0,profile:``,color:``,location:`${up(t.id,t.tray.length)} Slot ${n+1}`}}),children:te})]},n)})})]},t.id)}),n.map(t=>{let n=tW(t.id,Sn,Tn,wn),r=t.tray[0],i=r?.tray_type&&r.remain>=0,f=!r?.tray_type,v=cW(r),x=Sp(t.id,r?.id??0,!1),C=jn===x,T=Mn!==null&&Mn===x,E=Nn!==null&&Nn===x,D=r?.tray_info_idx?ln?.[r.tray_info_idx]:null,O=un?.[x],k=Lp(O?.preset_id,r?.tray_info_idx)?O?.preset_name:void 0,A=r?.id??0,j=(r?.tray_uuid||r?.tag_uid||Dp(e.serial_number,t.id,A))?.toUpperCase(),M=j?s?.[j]:void 0,N=wp(M),P=u?.(e.id,t.id,A),I=(()=>{let e=P?.spool;return e&&e.label_weight>0&&e.weight_used!=null?Math.round(Math.max(0,e.label_weight-e.weight_used)/e.label_weight*100):null})(),L=I===0&&i&&r.remain>0?null:I,R=o&&!h?m?.find(n=>n.printer_id===e.id&&n.ams_id===t.id&&n.tray_id===A):void 0,B=R?p?.find(e=>e.id===R.spoolman_spool_id):void 0,V=B&&(B.label_weight??0)>0?Math.round(Math.max(0,(B.label_weight??0)-B.weight_used)/(B.label_weight??1)*100):null,ee=N??V??L??(i?r.remain:null),te=N!==null||V!==null?`spoolman`:L===null?i?`ams`:void 0:`inventory`,ne=r?.tray_type?{vendor:Ip(r)?`Bambu Lab`:`Generic`,profile:k||(B?[B.brand,B.slicer_filament_name?.split(`@`)[0].trim()||B.material].filter(Boolean).join(` `).trim():null)||P?.spool?.slicer_filament_name||D?.name||r.tray_sub_brands||r.tray_type,colorName:bf(r.tray_color||``,r.tray_sub_brands),colorHex:r.tray_color||null,kFactor:ZU(r.k),fillLevel:ee,trayUuid:r.tray_uuid||null,tagUid:r.tag_uid||null,fillSource:te}:null,re=Vr?.amsId===t.id&&Vr?.slotId===A,ie=w.indexOf(x),ae=ie>=0?`P${ie+1}`:null,oe=(0,G.jsxs)(`div`,{className:`relative w-full bg-bambu-dark-secondary rounded-lg p-1 text-center ${f?`opacity-50`:``} ${T?`ring-2 ring-amber-400 ring-offset-1 ring-offset-bambu-dark animate-pulse`:E?`ring-2 ring-red-500/60 ring-offset-1 ring-offset-bambu-dark`:C?`ring-2 ring-bambu-green ring-offset-1 ring-offset-bambu-dark`:``}`,children:[T&&(0,G.jsx)(`span`,{"aria-label":F(`printers.expectedSlot.ariaLabel`,{n:1}),title:F(`printers.expectedSlot.title`),className:`absolute top-0.5 left-0.5 px-1 py-px text-[length:var(--pc-t8,8px)] font-bold text-bambu-dark bg-amber-400 rounded pointer-events-none leading-none`,children:`↓`}),ae&&(0,G.jsx)(`span`,{"aria-label":F(`printers.activeJobSlot.ariaLabel`,{n:ie+1}),title:F(`printers.activeJobSlot.title`,{n:ie+1}),className:`absolute top-0.5 right-0.5 px-1 py-px text-[length:var(--pc-t8,8px)] font-bold text-bambu-dark bg-bambu-green rounded pointer-events-none leading-none`,children:ae}),(0,G.jsx)(JU,{trayColor:r?.tray_color,trayType:r?.tray_type,isEmpty:f,emptyKind:v,slotNumber:1}),(0,G.jsx)(`div`,{className:`text-[length:var(--pc-t9,9px)] text-white font-bold truncate`,children:r?.tray_type||F(v===`reset`?`ams.slotUnconfigured`:`ams.slotEmpty`)}),(0,G.jsx)(QU,{k:ne?r?.k:null,reserve:On}),(0,G.jsx)(`div`,{className:`mt-1 h-1.5 bg-black/30 rounded-full overflow-hidden`,children:ee!==null&&ee>=0&&!f&&(0,G.jsx)(`div`,{className:`h-full rounded-full transition-all`,style:{width:`${ee}%`,backgroundColor:Cp(ee)}})})]}),se=y(11);return(0,G.jsxs)(`div`,{style:{flex:`1 1 ${se}`,minWidth:se,maxWidth:`calc(4 * ${b} + 3 * 0.25rem + 1rem)`},className:`min-w-0 p-2 bg-bambu-dark rounded-[10px] space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex w-full min-h-7 items-center gap-1.5 rounded-lg bg-bambu-dark-secondary px-2 py-1`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[(0,G.jsx)(gW,{ams:t,printerId:e.id,label:up(t.id,t.tray.length),amsLabels:mn,canEdit:z(`printers:update`),onSaved:hn,children:(0,G.jsx)(`span`,{className:`block truncate text-[length:var(--pc-t10,10px)] text-white font-medium cursor-default select-none`,children:mn?.[t.id]||up(t.id,t.tray.length)})}),n?.kind===`inlet`?(0,G.jsx)(eW,{inlet:n.inlet,title:F(`printers.amsSwitchInletTooltip`,{inlet:n.inlet,side:sp[n.inlet]})}):_&&n?.kind===`nozzle`?(0,G.jsx)($U,{side:n.side}):null]}),(W.supports_drying||W.drying_screen_only)&&(t.module_type===`n3f`||t.module_type===`n3s`)&&z(`printers:control`)&&(0,G.jsx)(`div`,{className:`relative ml-auto`,children:(0,G.jsx)(`button`,{disabled:W.drying_screen_only,onClick:e=>{t.dry_time>0?lr.mutate(t.id):Qe===t.id?$e(null):bt(t,e.currentTarget)},className:`flex items-center gap-0.5 px-1 py-0.5 rounded text-[length:var(--pc-t9,9px)] transition-colors ${t.dry_time>0?`bg-amber-100 dark:bg-amber-500/20 text-amber-700 dark:text-amber-400`:W.drying_screen_only?`bg-bambu-dark text-bambu-gray/50 cursor-not-allowed`:`bg-bambu-dark text-bambu-gray hover:text-white hover:bg-bambu-dark/80`}`,title:W.drying_screen_only?F(`printers.drying.screenOnly`):t.dry_time>0?F(`printers.drying.stop`):F(`printers.drying.start`),children:(0,G.jsx)(lc,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`})})})]}),t.dry_time>0&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 overflow-hidden whitespace-nowrap rounded-lg bg-amber-50 dark:bg-amber-500/10 px-2 py-1 text-[length:var(--pc-t9,9px)]`,children:[(0,G.jsx)(lc,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)] text-amber-600 dark:text-amber-400 shrink-0`}),t.dry_filament&&(0,G.jsx)(`span`,{className:`text-amber-700/80 dark:text-amber-300/70 text-[length:var(--pc-t8,8px)] truncate`,children:t.dry_target_temp==null?t.dry_filament:F(`printers.drying.targetSummary`,{filament:t.dry_filament,temp:t.dry_target_temp})}),(0,G.jsx)(`span`,{className:`text-amber-700/80 dark:text-amber-300/70 text-[length:var(--pc-t8,8px)] truncate`,children:t.dry_time>=60?`${Math.floor(t.dry_time/60)}h ${t.dry_time%60}m`:`${t.dry_time}m`}),!W.drying_screen_only&&(0,G.jsx)(`button`,{onClick:()=>lr.mutate(t.id),disabled:lr.isPending,className:`ml-auto text-amber-700 dark:text-amber-400 hover:text-amber-900 dark:hover:text-amber-300 transition-colors disabled:opacity-50 shrink-0`,title:F(`printers.drying.stop`),children:(0,G.jsx)(Zu,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)]`})})]}),(0,G.jsxs)(`div`,{className:`flex gap-1.5 max-[550px]:flex-col max-[550px]:items-start`,children:[(0,G.jsxs)(`div`,{className:`relative group flex-1`,style:S,children:[re&&(0,G.jsx)(`div`,{className:`absolute inset-0 bg-bambu-dark-tertiary/80 rounded flex items-center justify-center z-20`,children:(0,G.jsx)(Fl,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)] text-bambu-green animate-spin`})}),ne?(0,G.jsx)(YH,{data:ne,actions:Ei({amsId:t.id,slotId:A,loadTrayId:t.id*4+A,isRefreshing:re}),spoolman:{enabled:o,linkedSpoolId:R?.spoolman_spool_id??(j?s?.[j]?.id:void 0),spoolmanUrl:c,syncMode:l,onLinkSpool:o&&!R&&!P?()=>{let n=(ne.trayUuid||ne.tagUid||Dp(e.serial_number,t.id,A)).toUpperCase();Rt({tagUid:ne.tagUid||n,trayUuid:ne.trayUuid||``,printerId:e.id,amsId:t.id,trayId:A})}:void 0,onUnlinkSpool:M?.id?()=>or.mutate(M.id):void 0},inventory:(()=>{if(o){if(h)return;let n=R,i=B;return{assignedSpool:i?{id:i.id,material:i.material,subtype:i.subtype,brand:i.brand??null,color_name:i.color_name??null,color_name_is_synthesized:i.color_name_is_synthesized,rgba:i.rgba??null,extra_colors:i.extra_colors??null,effect_type:i.effect_type??null,remainingWeightGrams:i.label_weight?Math.max(0,Math.round(i.label_weight-i.weight_used)):void 0}:null,onAssignSpool:()=>Bt({printerId:e.id,amsId:t.id,trayId:A,trayInfo:{type:r?.tray_type||ne.profile,material:r?.tray_type??void 0,profile:ne.profile,color:ne.colorHex||``,location:up(t.id,t.tray.length)}}),onUnassignSpool:i&&!Ip(r)?()=>g?.(i.id):void 0,isAssigned:!!n||Ip(r)}}let n=u?.(e.id,t.id,A);return{assignedSpool:n?.spool?{id:n.spool.id,material:n.spool.material,subtype:n.spool.subtype,brand:n.spool.brand,color_name:n.spool.color_name,rgba:n.spool.rgba??null,extra_colors:n.spool.extra_colors??null,effect_type:n.spool.effect_type??null,remainingWeightGrams:Math.max(0,Math.round(n.spool.label_weight-n.spool.weight_used))}:null,onAssignSpool:()=>Bt({printerId:e.id,amsId:t.id,trayId:A,trayInfo:{type:r?.tray_type||ne.profile,material:r?.tray_type??void 0,profile:ne.profile,color:ne.colorHex||``,location:up(t.id,t.tray.length)}}),onUnassignSpool:n&&!Ip(r)?()=>d?.(e.id,t.id,A):void 0,isAssigned:!!n||Ip(r)}})(),configureSlot:{enabled:z(`printers:control`),onConfigure:()=>Ht({amsId:t.id,trayId:A,trayCount:t.tray.length,trayType:r?.tray_type||void 0,trayColor:r?.tray_color||void 0,traySubBrands:r?.tray_sub_brands||void 0,trayInfoIdx:r?.tray_info_idx||void 0,extruderId:lp(t.id,r?.id??0,Sn,Tn),caliIdx:r?.cali_idx,savedPresetId:O?.preset_id})},children:oe}):(0,G.jsx)(XH,{kind:v??void 0,actions:Ei({amsId:t.id,slotId:A,loadTrayId:t.id*4+A,isRefreshing:re}),configureSlot:{enabled:z(`printers:control`),onConfigure:()=>Ht({amsId:t.id,trayId:A,trayCount:t.tray.length,extruderId:lp(t.id,r?.id??0,Sn,Tn)})},onAssignSpool:()=>Bt({printerId:e.id,amsId:t.id,trayId:A,trayInfo:{type:``,material:void 0,profile:``,color:``,location:up(t.id,t.tray.length)}}),children:oe})]}),(t.humidity!=null||t.temp!=null)&&(0,G.jsxs)(`div`,{className:`flex flex-col justify-center gap-1 shrink-0 max-[550px]:w-full`,children:[t.temp!=null&&(0,G.jsx)(sW,{temp:t.temp,goodThreshold:a?.tempGood,fairThreshold:a?.tempFair,onClick:()=>Pt({amsId:t.id,amsLabel:up(t.id,t.tray.length),mode:`temperature`}),compact:!0}),t.humidity!=null&&(0,G.jsx)(oW,{humidity:t.humidity,goodThreshold:a?.humidityGood,fairThreshold:a?.humidityFair,onClick:()=>Pt({amsId:t.id,amsLabel:up(t.id,t.tray.length),mode:`humidity`}),compact:!0})]})]})]},t.id)}),W.vt_tray.length>0&&f&&(0,G.jsxs)(`div`,{style:T(W.vt_tray.length),className:`min-w-0 p-2 bg-bambu-dark rounded-[10px] space-y-1`,children:[(0,G.jsx)(`div`,{className:`flex w-full min-h-7 items-center gap-1.5 rounded-lg bg-bambu-dark-secondary px-2 py-1`,children:(0,G.jsx)(`span`,{className:`block min-w-0 flex-1 truncate text-[length:var(--pc-t10,10px)] text-white font-medium`,children:F(`printers.external`)})}),(0,G.jsx)(`div`,{className:`grid w-full gap-1`,style:C(W.vt_tray.length>1?2:1),children:[...W.vt_tray].sort((e,t)=>(e.id??254)-(t.id??254)).map(t=>{let n=t.id??254,r=_&&jn===254?n===254&&W.active_extruder===1||n===255&&W.active_extruder===0:jn===n,i=n-254,a=_?F(n===254?`printers.extL`:`printers.extR`):``,f=t.tray_info_idx?ln?.[t.tray_info_idx]:null,v=un?.[1020+i],y=Lp(v?.preset_id,t.tray_info_idx)?v?.preset_name:void 0,b=(t.tray_uuid||t.tag_uid||Dp(e.serial_number,255,i))?.toUpperCase(),S=b?s?.[b]:void 0,C=wp(S),w=u?.(e.id,255,i),T=(()=>{let e=w?.spool;return e&&e.label_weight>0&&e.weight_used!=null?Math.round(Math.max(0,e.label_weight-e.weight_used)/e.label_weight*100):null})(),E=t.tray_type&&t.remain>=0,D=T===0&&E&&t.remain>0?null:T,O=o&&!h?m?.find(t=>t.printer_id===e.id&&t.ams_id===255&&t.tray_id===i):void 0,k=O?p?.find(e=>e.id===O.spoolman_spool_id):void 0,A=k&&(k.label_weight??0)>0?Math.round(Math.max(0,(k.label_weight??0)-k.weight_used)/(k.label_weight??1)*100):null,j=C??A??D??(E?t.remain:null),M=C!==null||A!==null?`spoolman`:D===null?E?`ams`:void 0:`inventory`,N={vendor:Ip(t)?`Bambu Lab`:`Generic`,profile:y||(k?[k.brand,k.slicer_filament_name?.split(`@`)[0].trim()||k.material].filter(Boolean).join(` `).trim():null)||w?.spool?.slicer_filament_name||f?.name||t.tray_sub_brands||t.tray_type||`Unknown`,colorName:bf(t.tray_color||``,t.tray_sub_brands),colorHex:t.tray_color||null,kFactor:ZU(t.k),fillLevel:j,trayUuid:t.tray_uuid||null,tagUid:t.tag_uid||null,fillSource:M},P=!t.tray_type,I=cW(t),L=(0,G.jsxs)(`div`,{className:`w-full bg-bambu-dark-secondary rounded-lg p-1 text-center ${P?`opacity-50`:``} ${r?`ring-2 ring-bambu-green ring-offset-1 ring-offset-bambu-dark`:``}`,children:[(0,G.jsx)(JU,{trayColor:t.tray_color,trayType:t.tray_type,isEmpty:P,emptyKind:I,slotNumber:_?n===254?`L`:`R`:i+1}),(0,G.jsx)(`div`,{className:`text-[length:var(--pc-t9,9px)] font-bold truncate ${P?`text-white/40`:`text-white`}`,children:t.tray_type||F(`ams.slotEmpty`)}),(0,G.jsx)(QU,{k:P?null:t.k,reserve:On}),(0,G.jsx)(`div`,{className:`mt-1 h-1.5 bg-black/30 rounded-full overflow-hidden`,children:j!==null&&j>=0&&!P&&(0,G.jsx)(`div`,{className:`h-full rounded-full transition-all`,style:{width:`${j}%`,backgroundColor:Cp(j)}})})]});return(0,G.jsx)(`div`,{className:`relative group w-full`,style:x,children:P?(0,G.jsx)(XH,{kind:I??void 0,actions:Ei({amsId:255,slotId:i,loadTrayId:n,includeRfid:!1}),configureSlot:{enabled:z(`printers:control`),onConfigure:()=>Ht({amsId:255,trayId:i,trayCount:1,extruderId:_?+(n===254):void 0})},onAssignSpool:()=>Bt({printerId:e.id,amsId:255,trayId:i,trayInfo:{type:``,material:void 0,profile:``,color:``,location:`External Slot ${i+1}`}}),children:L}):(0,G.jsx)(YH,{data:N,actions:Ei({amsId:255,slotId:i,loadTrayId:n,includeRfid:!1}),spoolman:{enabled:o,linkedSpoolId:O?.spoolman_spool_id??(b?s?.[b]?.id:void 0),spoolmanUrl:c,syncMode:l,onLinkSpool:o&&!O&&!w?()=>{let t=(N.trayUuid||N.tagUid||Dp(e.serial_number,255,i)).toUpperCase();Rt({tagUid:N.tagUid||t,trayUuid:N.trayUuid||``,printerId:e.id,amsId:255,trayId:i})}:void 0,onUnlinkSpool:S?.id?()=>or.mutate(S.id):void 0},inventory:(()=>{if(o){if(h)return;let n=O,r=k;return{assignedSpool:r?{id:r.id,material:r.material,subtype:r.subtype,brand:r.brand??null,color_name:r.color_name??null,color_name_is_synthesized:r.color_name_is_synthesized,rgba:r.rgba??null,extra_colors:r.extra_colors??null,effect_type:r.effect_type??null,remainingWeightGrams:r.label_weight?Math.max(0,Math.round(r.label_weight-r.weight_used)):void 0}:null,onAssignSpool:()=>Bt({printerId:e.id,amsId:255,trayId:i,trayInfo:{type:t.tray_type||N.profile,material:t.tray_type??void 0,profile:N.profile,color:N.colorHex||``,location:a||F(`printers.external`)}}),onUnassignSpool:r&&!Ip(t)?()=>g?.(r.id):void 0,isAssigned:!!n||Ip(t)}}let n=u?.(e.id,255,i);return{assignedSpool:n?.spool?{id:n.spool.id,material:n.spool.material,subtype:n.spool.subtype,brand:n.spool.brand,color_name:n.spool.color_name,rgba:n.spool.rgba??null,extra_colors:n.spool.extra_colors??null,effect_type:n.spool.effect_type??null,remainingWeightGrams:Math.max(0,Math.round(n.spool.label_weight-n.spool.weight_used))}:null,onAssignSpool:()=>Bt({printerId:e.id,amsId:255,trayId:i,trayInfo:{type:t.tray_type||N.profile,material:t.tray_type??void 0,profile:N.profile,color:N.colorHex||``,location:a||F(`printers.external`)}}),onUnassignSpool:n&&!Ip(t)?()=>d?.(e.id,255,i):void 0,isAssigned:!!n||Ip(t)}})(),configureSlot:{enabled:z(`printers:control`),onConfigure:()=>Ht({amsId:255,trayId:i,trayCount:1,trayType:t.tray_type||void 0,trayColor:t.tray_color||void 0,traySubBrands:t.tray_sub_brands||void 0,trayInfoIdx:t.tray_info_idx||void 0,extruderId:_?+(n===254):void 0,caliIdx:t.cali_idx,savedPresetId:v?.preset_id})},children:L})},n)})})]})]})]})})()]}),e.is_active!==!1&&!W?.connected&&r===`expanded`&&Yn&&xr,r===`expanded`&&(0,G.jsxs)(`div`,{className:`mt-auto`,children:[In&&(0,G.jsxs)(`div`,{className:`pt-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,G.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] uppercase tracking-wider text-bambu-gray font-medium`,children:F(`printers.power`,`Power`)}),(0,G.jsx)(`div`,{className:`flex-1 h-[2px] bg-bambu-dark-tertiary`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 rounded-[10px] bg-bambu-dark p-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0 pl-1`,children:[(0,G.jsx)($u,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)] text-bambu-gray flex-shrink-0`}),(0,G.jsx)(`span`,{className:`text-sm text-white truncate`,children:In.name}),(0,G.jsx)(`span`,{className:`px-1.5 py-0.5 rounded-full bg-bambu-dark-tertiary text-bambu-gray text-[length:var(--pc-t10,10px)] font-medium flex-shrink-0`,title:F(`smartPlugs.power`),children:Rn?.energy?.power!==null&&Rn?.energy?.power!==void 0?`${Math.round(Rn.energy.power)}W`:`--`})]}),(0,G.jsx)(`div`,{className:`flex-1`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`button`,{onClick:()=>fr.mutate(!In.auto_off),disabled:fr.isPending||In.auto_off_executed||!z(`smart_plugs:control`),title:z(`smart_plugs:control`)?In.auto_off_executed?F(`printers.autoOffExecuted`):F(`printers.autoOffAfterPrint`):F(`printers.permission.noSmartPlugControl`),className:`flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-lg text-xs font-bold transition-colors disabled:opacity-50 disabled:cursor-not-allowed ${z(`smart_plugs:control`)?In.auto_off||In.auto_off_executed?`bg-bambu-green/20 text-bambu-green hover:bg-bambu-green/30`:`bg-bambu-dark-tertiary text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary/80`:`bg-bambu-dark-tertiary/50 text-bambu-gray/50`}`,children:(0,G.jsx)(Ts,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`})}),(0,G.jsx)(`button`,{onClick:()=>{Rn?.state===`ON`?pe(!0):de(!0)},disabled:dr.isPending||!z(`smart_plugs:control`),className:`flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-lg text-xs transition-colors disabled:opacity-50 disabled:cursor-not-allowed ${z(`smart_plugs:control`)?Rn?.state===`ON`?`bg-bambu-green/20 text-bambu-green hover:bg-bambu-green/30`:`bg-bambu-dark-tertiary text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary/80`:`bg-bambu-dark-tertiary/50 text-bambu-gray/50`}`,title:z(`smart_plugs:control`)?Rn?.state===`ON`?`Turn off`:`Turn on`:F(`printers.permission.noSmartPlugControl`),children:(0,G.jsx)($u,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`})})]})]}),Ln&&Ln.length>0&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mt-2`,children:[(0,G.jsx)(Pc,{className:`w-[var(--pc-i35,0.875rem)] h-[var(--pc-i35,0.875rem)] text-blue-600 dark:text-blue-400 flex-shrink-0`}),(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:`HA:`}),(0,G.jsx)(`div`,{className:`h-[2px] w-5 bg-bambu-dark-tertiary/50`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:Ln.map(e=>{let t=e.ha_entity_id?.startsWith(`script.`);return(0,G.jsxs)(`button`,{onClick:()=>{t?pr.mutate({id:e.id,action:`on`}):he(e)},disabled:pr.isPending,title:`${t?`Run`:`Toggle`} ${e.ha_entity_id}`,className:`px-2 py-0.5 text-xs bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400 hover:bg-blue-500/30 rounded transition-colors flex items-center gap-1`,children:[(0,G.jsx)(El,{className:`w-[var(--pc-i25,0.625rem)] h-[var(--pc-i25,0.625rem)]`}),e.name]},e.id)})})]})]}),(0,G.jsx)(Qce,{printerId:e.id}),(0,G.jsxs)(`div`,{className:`pt-4`,children:[(0,G.jsx)(`div`,{className:`mb-3 h-[2px] bg-bambu-dark-tertiary`}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[Di,(0,G.jsxs)(`div`,{className:`flex items-center justify-end gap-2 flex-wrap`,children:[(0,G.jsxs)(`div`,{className:`flex items-center flex-shrink-0`,children:[(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:()=>wi(v),disabled:!W?.connected||!z(`camera:view`),title:z(`camera:view`)?F(v===`embedded`?`printers.openCameraOverlay`:`printers.openCameraWindow`):F(`printers.permission.noCamera`),className:`${Ci} !rounded-r-none`,children:(0,G.jsx)(Bu,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`})}),(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:e=>{let t=e.currentTarget.getBoundingClientRect();jt({x:t.left,y:t.bottom+4})},disabled:!W?.connected||!z(`camera:view`),title:z(`camera:view`)?F(`settings.cameraViewMode`):F(`printers.permission.noCamera`),"aria-label":F(`settings.cameraViewMode`),className:`!h-8 !min-h-8 !w-6 !px-0 !py-0 !rounded-l-none border-l border-bambu-dark`,children:(0,G.jsx)(ss,{className:`w-3 h-3`})})]}),At&&(0,G.jsx)(lE,{x:At.x,y:At.y,items:Ti,onClose:()=>jt(null)}),(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:()=>H(!0),disabled:!z(`printers:files`),title:z(`printers:files`)?F(`printers.browseFiles`):F(`printers.permission.noFiles`),className:Ci,children:(0,G.jsx)(Oc,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`})}),(0,G.jsxs)(Q,{size:`sm`,onClick:()=>We(!0),disabled:!z(`library:upload`)||!z(`queue:create`),title:z(`library:upload`)?z(`queue:create`)?F(`common.print`):F(`fileManager.noPermissionAddToQueue`):F(`fileManager.noPermissionUpload`),className:`!h-8 !min-h-8 !px-2 !py-0 !bg-bambu-green hover:!bg-bambu-green/80 !text-white`,children:[(0,G.jsx)(jl,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)]`}),F(`common.print`)]})]})]})]})]}),(0,G.jsx)(zAe,{printerId:e.id,dryingActive:Dn.some(e=>(e.dry_time??0)>0),timeFormat:_})]}),se&&(0,G.jsx)(Nce,{printerId:e.id,printerName:e.name,onClose:()=>H(!1)}),Ue&&(0,G.jsx)(WU,{folderId:null,onClose:()=>We(!1),onUploadComplete:()=>{},autoUpload:!0,accept:`.gcode,.3mf`,validateFile:e=>{let t=e.name.toLowerCase();if(!t.endsWith(`.gcode`)&&!t.includes(`.gcode.`))return F(`printers.dropNotPrintable`,`Only .gcode and .gcode.3mf files can be printed`)},onFileUploaded:t=>{let n=t.metadata?.sliced_for_model,r=hW(e.model);if(n&&r&&n.toLowerCase()!==r.toLowerCase())return Z.deleteLibraryFile(t.id).catch(()=>{}),F(`printers.incompatibleFile`,`This file was sliced for {{slicedFor}}, but this printer is a {{printerModel}}`,{slicedFor:n,printerModel:r});Ze({id:t.id,filename:t.filename})}}),Xe&&(0,G.jsx)(Tm,{mode:`create`,libraryFileId:Xe.id,archiveName:Xe.filename,initialSelectedPrinterIds:[e.id],onClose:()=>Ze(null),onSuccess:()=>Ze(null),cleanupLibraryAfterDispatch:!0}),ce&&(0,G.jsx)(Jce,{printerId:e.id,printerName:e.name,onClose:()=>le(!1)}),qe&&(0,G.jsx)(Om,{printerId:e.id,printerName:e.name,onClose:()=>Je(!1)}),Ge&&(0,G.jsx)(lAe,{printer:e,status:W,totalPrintHours:n?.total_print_hours,onClose:Ye}),Gt&&(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,onClick:()=>oi(),children:(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-xl shadow-2xl max-w-lg w-full`,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`,{className:`flex items-center gap-2`,children:[Gt.needs_calibration?(0,G.jsx)(Ul,{className:`w-[var(--pc-i5,1.25rem)] h-[var(--pc-i5,1.25rem)] text-blue-500`}):Gt.is_empty?(0,G.jsx)(hs,{className:`w-[var(--pc-i5,1.25rem)] h-[var(--pc-i5,1.25rem)] text-green-500`}):(0,G.jsx)(xs,{className:`w-[var(--pc-i5,1.25rem)] h-[var(--pc-i5,1.25rem)] text-yellow-500`}),(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:`Build Plate Check`}),Gt.reference_count!==void 0&&Gt.max_references&&(0,G.jsxs)(`span`,{className:`text-xs text-bambu-gray bg-bambu-dark-tertiary px-2 py-1 rounded`,children:[Gt.reference_count,`/`,Gt.max_references,` refs`]})]}),(0,G.jsx)(`button`,{onClick:()=>oi(),className:`p-1 text-bambu-gray hover:text-white rounded transition-colors`,children:(0,G.jsx)(Zu,{className:`w-[var(--pc-i5,1.25rem)] h-[var(--pc-i5,1.25rem)]`})})]}),(0,G.jsxs)(`div`,{className:`p-4 space-y-4`,children:[Gt.needs_calibration?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`p-3 rounded-lg bg-blue-100 dark:bg-blue-500/20 border border-blue-300 dark:border-blue-500/50`,children:[(0,G.jsx)(`p`,{className:`font-medium text-blue-700 dark:text-blue-400`,children:F(`printers.plateDetection.calibrationRequired`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,dangerouslySetInnerHTML:{__html:F(`printers.plateDetection.calibrationInstructions`)}})]}),(0,G.jsxs)(`div`,{className:`text-sm text-bambu-gray space-y-2`,children:[(0,G.jsx)(`p`,{children:F(`printers.plateDetection.calibrationDescription`)}),(0,G.jsx)(`p`,{dangerouslySetInnerHTML:{__html:F(`printers.plateDetection.calibrationTip`)}})]})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`p-3 rounded-lg ${Gt.is_empty?`bg-green-100 dark:bg-green-500/20 border border-green-300 dark:border-green-500/50`:`bg-yellow-100 dark:bg-yellow-500/20 border border-yellow-300 dark:border-yellow-500/50`}`,children:[(0,G.jsx)(`p`,{className:`font-medium ${Gt.is_empty?`text-green-700 dark:text-green-400`:`text-yellow-700 dark:text-yellow-400`}`,children:Gt.is_empty?F(`printers.plateDetection.plateEmpty`):F(`printers.plateDetection.objectsDetected`)}),(0,G.jsxs)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:[F(`printers.plateDetection.confidence`),`: `,Math.round(Gt.confidence*100),`% | `,F(`printers.plateDetection.difference`),`: `,Gt.difference_percent.toFixed(1),`%`]})]}),Gt.debug_image_url&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mb-2`,children:F(`printers.plateDetection.analysisPreview`)}),(0,G.jsx)(`img`,{src:Gt.debug_image_url,alt:F(`printers.plateDetection.analysisPreview`),className:`w-full rounded-lg border border-bambu-dark-tertiary`}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-2`,children:F(`printers.plateDetection.analysisLegend`)})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:Gt.message})]}),$r&&$r.references.length>0&&(0,G.jsxs)(`div`,{className:`mt-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,G.jsx)(`p`,{className:`text-sm font-medium text-white shrink-0`,children:F(`printers.plateDetection.savedReferences`,{count:$r.references.length,max:$r.max_references})}),(0,G.jsx)(`div`,{className:`flex-1 h-[2px] bg-bambu-dark-tertiary`})]}),(0,G.jsx)(`div`,{className:`grid grid-cols-5 gap-2`,children:$r.references.map(t=>(0,G.jsxs)(`div`,{className:`relative group`,children:[(0,G.jsx)(`img`,{src:Z.getPlateReferenceThumbnailUrl(e.id,t.index),alt:t.label||`Reference ${t.index+1}`,className:`w-full aspect-video object-cover rounded border border-bambu-dark-tertiary`}),(0,G.jsx)(`button`,{onClick:()=>li(t.index),className:`absolute top-1 right-1 p-0.5 bg-red-500/80 rounded can-hover:opacity-0 group-hover:opacity-100 focus-visible:opacity-100 transition-opacity`,title:F(`printers.plateDetection.deleteReference`),children:(0,G.jsx)(Zu,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)] text-white`})}),ti?.index===t.index?(0,G.jsx)(`input`,{type:`text`,value:ti.label,onChange:e=>ni({...ti,label:e.target.value}),onBlur:()=>ci(t.index,ti.label),onKeyDown:e=>{e.key===`Enter`&&ci(t.index,ti.label),e.key===`Escape`&&ni(null)},className:`w-full mt-1 px-1 py-0.5 text-xs bg-bambu-dark-tertiary border border-bambu-green rounded text-white`,autoFocus:!0,placeholder:F(`printers.plateDetection.labelPlaceholder`)}):(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1 truncate cursor-pointer hover:text-white`,onClick:()=>ni({index:t.index,label:t.label}),title:t.label?F(`printers.plateDetection.clickToEdit`,{label:t.label}):F(`printers.plateDetection.clickToAddLabel`),children:t.label||(0,G.jsx)(`span`,{className:`italic opacity-50`,children:F(`printers.noLabel`)})}),(0,G.jsx)(`p`,{className:`text-[length:var(--pc-t10,10px)] text-bambu-gray/60`,children:t.timestamp?Jf(t.timestamp)?.toLocaleDateString()??``:``})]},t.index))})]}),!Gt.needs_calibration&&(0,G.jsxs)(`div`,{className:`mt-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,G.jsx)(`p`,{className:`text-sm font-medium text-white shrink-0`,children:F(`printers.roi.title`)}),(0,G.jsx)(`div`,{className:`flex-1 h-[2px] bg-bambu-dark-tertiary`})]}),Zt?(0,G.jsxs)(`div`,{className:`flex gap-1`,children:[(0,G.jsx)(Q,{variant:`ghost`,size:`sm`,onClick:()=>Qt(null),disabled:$t,children:F(`common.cancel`)}),(0,G.jsx)(Q,{size:`sm`,onClick:ui,disabled:$t,children:$t?(0,G.jsx)(Y,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)] animate-spin`}):F(`common.save`)})]}):(0,G.jsxs)(Q,{variant:`ghost`,size:`sm`,onClick:()=>Qt(Gt.roi||{x:.15,y:.35,w:.7,h:.55}),children:[(0,G.jsx)(Cl,{className:`w-[var(--pc-i3,0.75rem)] h-[var(--pc-i3,0.75rem)] mr-1`}),F(`common.edit`)]})]}),Zt?(0,G.jsxs)(`div`,{className:`space-y-3 bg-bambu-dark-tertiary/50 p-3 rounded-lg`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`text-xs text-bambu-gray`,children:F(`printers.roi.xStart`)}),(0,G.jsx)(`input`,{type:`range`,min:`0`,max:`0.9`,step:`0.01`,value:Zt.x,onChange:e=>Qt({...Zt,x:parseFloat(e.target.value)}),className:`w-full h-1.5 bg-bambu-dark-tertiary rounded-lg cursor-pointer accent-green-500`}),(0,G.jsxs)(`span`,{className:`text-xs text-bambu-gray`,children:[Math.round(Zt.x*100),`%`]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`text-xs text-bambu-gray`,children:F(`printers.roi.yStart`)}),(0,G.jsx)(`input`,{type:`range`,min:`0`,max:`0.9`,step:`0.01`,value:Zt.y,onChange:e=>Qt({...Zt,y:parseFloat(e.target.value)}),className:`w-full h-1.5 bg-bambu-dark-tertiary rounded-lg cursor-pointer accent-green-500`}),(0,G.jsxs)(`span`,{className:`text-xs text-bambu-gray`,children:[Math.round(Zt.y*100),`%`]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`text-xs text-bambu-gray`,children:F(`printers.width`)}),(0,G.jsx)(`input`,{type:`range`,min:`0.1`,max:`1`,step:`0.01`,value:Zt.w,onChange:e=>Qt({...Zt,w:parseFloat(e.target.value)}),className:`w-full h-1.5 bg-bambu-dark-tertiary rounded-lg cursor-pointer accent-green-500`}),(0,G.jsxs)(`span`,{className:`text-xs text-bambu-gray`,children:[Math.round(Zt.w*100),`%`]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`text-xs text-bambu-gray`,children:F(`printers.height`)}),(0,G.jsx)(`input`,{type:`range`,min:`0.1`,max:`1`,step:`0.01`,value:Zt.h,onChange:e=>Qt({...Zt,h:parseFloat(e.target.value)}),className:`w-full h-1.5 bg-bambu-dark-tertiary rounded-lg cursor-pointer accent-green-500`}),(0,G.jsxs)(`span`,{className:`text-xs text-bambu-gray`,children:[Math.round(Zt.h*100),`%`]})]})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:F(`printers.roi.instruction`)})]}):(0,G.jsxs)(`p`,{className:`text-xs text-bambu-gray`,children:[`Current: X=`,Math.round((Gt.roi?.x||.15)*100),`%, Y=`,Math.round((Gt.roi?.y||.35)*100),`%, W=`,Math.round((Gt.roi?.w||.7)*100),`%, H=`,Math.round((Gt.roi?.h||.55)*100),`%`]})]})]}),(0,G.jsx)(`div`,{className:`flex justify-end gap-2 p-4`,children:Gt.needs_calibration?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Q,{variant:`ghost`,onClick:()=>oi(),children:F(`common.cancel`)}),(0,G.jsx)(Q,{onClick:()=>si(),disabled:Yt,children:Yt?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{className:`w-[var(--pc-i4,1rem)] h-[var(--pc-i4,1rem)] mr-2 animate-spin`}),`Calibrating...`]}):`Calibrate Empty Plate`})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Q,{variant:`ghost`,onClick:()=>si(),disabled:Yt,children:Yt?`Adding...`:`Add Reference (${$r?.references.length||0}/${$r?.max_references||5})`}),(0,G.jsx)(Q,{onClick:()=>oi(),children:`Close`})]})})]})}),ue&&In&&(0,G.jsx)($d,{title:F(`printers.confirm.powerOnTitle`),message:F(`printers.confirm.powerOnMessage`,{name:e.name}),confirmText:F(`printers.confirm.powerOnButton`),variant:`default`,onConfirm:()=>{dr.mutate(`on`),de(!1)},onCancel:()=>de(!1)}),Ir&&(0,G.jsx)($d,{title:F(`printers.maintenance.confirmMidPrintTitle`),message:F(`printers.maintenance.confirmMidPrintMessage`,{name:e.name}),confirmText:F(`printers.maintenance.menuEnter`),variant:`danger`,onConfirm:()=>{Fr.mutate(!1),Lr(!1)},onCancel:()=>Lr(!1)}),fe&&In&&(0,G.jsx)($d,{title:F(`printers.confirm.powerOffTitle`),message:W?.state===`RUNNING`?F(`printers.confirm.powerOffWarning`,{name:e.name}):F(`printers.confirm.powerOffMessage`,{name:e.name}),confirmText:F(`printers.confirm.powerOffButton`),variant:`danger`,onConfirm:()=>{dr.mutate(`off`),pe(!1)},onCancel:()=>pe(!1)}),me&&(0,G.jsx)($d,{title:F(`printers.confirm.haToggleTitle`,{name:me.name}),message:W?.state===`RUNNING`?F(`printers.confirm.haToggleWarning`,{name:e.name,entity:me.ha_entity_id||me.name}):F(`printers.confirm.haToggleMessage`,{entity:me.ha_entity_id||me.name}),confirmText:F(`printers.confirm.haToggleButton`),variant:W?.state===`RUNNING`?`danger`:`default`,onConfirm:()=>{pr.mutate({id:me.id,action:`toggle`}),he(null)},onCancel:()=>he(null)}),Te&&(0,G.jsx)($d,{title:F(`printers.confirm.stopTitle`),message:F(`printers.confirm.stopMessage`,{name:e.name}),confirmText:F(`printers.confirm.stopButton`),variant:`danger`,onConfirm:()=>{mr.mutate(),Ee(!1)},onCancel:()=>Ee(!1)}),De&&(0,G.jsx)($d,{title:F(`printers.confirm.pauseTitle`),message:F(`printers.confirm.pauseMessage`,{name:e.name}),confirmText:F(`printers.confirm.pauseButton`),variant:`default`,onConfirm:()=>{hr.mutate(),Oe(!1)},onCancel:()=>Oe(!1)}),ze&&(0,G.jsx)($d,{title:F(`printers.confirm.resumeTitle`),message:F(`printers.confirm.resumeMessage`,{name:e.name}),confirmText:F(`printers.confirm.resumeButton`),variant:`default`,onConfirm:()=>{gr.mutate(),Be(!1)},onCancel:()=>Be(!1)}),(0,G.jsx)(eE,{printerId:e.id,isOpen:Ve,onClose:()=>He(!1)}),ge&&(0,G.jsx)(Dte,{printerName:e.name,errors:W?.hms_errors||[],onClose:()=>_e(!1),printerId:e.id,hasPermission:z,runoutGuidance:Fn}),ve&&(0,G.jsx)(Xce,{printerName:e.name,detection:N,lastError:P,onClose:()=>ye(!1)}),be&&W&&(0,G.jsx)(zke,{isOpen:be,state:W.ams_filament_backup,amsUnits:W.ams,amsExtruderMap:W.ams_extruder_map,isDualNozzle:e.nozzle_count===2||W?.temperatures?.nozzle_2!==void 0,canToggle:z(`printers:control`),pending:ur.isPending,onToggle:e=>ur.mutate(e),onClose:()=>xe(!1)}),Nt&&(0,G.jsx)(Fke,{isOpen:!!Nt,onClose:()=>Pt(null),printerId:e.id,printerName:e.name,amsId:Nt.amsId,amsLabel:Nt.amsLabel,initialMode:Nt.mode,thresholds:a}),Ft&&(0,G.jsx)(Vke,{isOpen:!!Ft,onClose:()=>It(null),printerId:e.id,printerName:e.name,initialKind:Ft.initialKind,availableKinds:Ft.availableKinds}),Lt&&(0,G.jsx)(ZH,{isOpen:!!Lt,onClose:()=>Rt(null),tagUid:Lt.tagUid,trayUuid:Lt.trayUuid,printerId:Lt.printerId,amsId:Lt.amsId,trayId:Lt.trayId}),zt&&(0,G.jsx)($H,{isOpen:!!zt,onClose:()=>Bt(null),printerId:zt.printerId,amsId:zt.amsId,trayId:zt.trayId,trayInfo:zt.trayInfo,spoolmanEnabled:!!o}),Vt&&(0,G.jsx)(HU,{isOpen:!!Vt,onClose:()=>Ht(null),printerId:e.id,slotInfo:Vt,printerModel:hW(e.model)||void 0,nozzleDiameter:oee(W,Vt.amsId),onSuccess:()=>{I.invalidateQueries({queryKey:[`slotPresets`,e.id]}),I.invalidateQueries({queryKey:[`printerStatus`,e.id]})}}),Yr&&(0,G.jsx)(uAe,{slotLabel:Yr.slotLabel,amsId:Yr.amsId,slotId:Yr.slotId,extruderSlots:W?.extruder_slots??{},isLoading:qr.isPending,onConfirm:e=>qr.mutate({trayId:Yr.trayId,extruderId:e}),onCancel:()=>Xr(null)}),ae&&(0,G.jsx)(HAe,{printer:e,onClose:()=>oe(!1)}),Ut&&rn&&(0,G.jsx)(VAe,{printer:e,firmwareInfo:rn,onClose:()=>Wt(!1)}),Qe!==null&>&&(()=>{let e=et===`n3s`?85:65,t=e+10;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`fixed inset-0 z-[100]`,"data-testid":`drying-popover-backdrop`,onMouseDown:()=>{St.current=xt.current!==null&&document.activeElement===xt.current},onClick:()=>{if(St.current){St.current=!1;return}$e(null)}}),(0,G.jsxs)(`div`,{className:`fixed z-[101] flex flex-col w-[240px] bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-xl shadow-2xl overflow-hidden`,style:{left:gt.left,...gt.placement===`above`?{bottom:`calc(100dvh - ${gt.anchorY}px)`,maxHeight:`${gt.anchorY-8}px`}:{top:gt.top,maxHeight:`calc(100dvh - ${gt.top}px - 8px)`}},onClick:e=>e.stopPropagation(),children:[(0,G.jsxs)(`div`,{className:`shrink-0 flex items-center justify-center gap-2 px-3 py-2.5`,children:[(0,G.jsx)(lc,{className:`w-[var(--pc-i35,0.875rem)] h-[var(--pc-i35,0.875rem)] text-bambu-green`}),(0,G.jsx)(`span`,{className:`text-sm text-white font-medium text-center`,children:F(`printers.drying.start`)})]}),(0,G.jsx)(`div`,{className:`shrink-0 h-px bg-bambu-dark-tertiary`}),(0,G.jsxs)(`div`,{className:`px-3 py-2.5 space-y-2.5 overflow-y-auto min-h-0`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`text-[length:var(--pc-t10,10px)] text-white/70 font-medium mb-1 block`,children:F(`printers.filaments`)}),(0,G.jsx)(lW,{value:nt,options:Object.keys(S).map(e=>({value:e,label:e})),onChange:e=>{rt(e);let t=S[e];t&&(at(t[et===`n3s`?`n3s`:`n3f`]),st(et===`n3s`?t.n3s_hours:t.n3f_hours))},fullWidth:!0})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,G.jsx)(`label`,{className:`text-[length:var(--pc-t10,10px)] text-white/70 font-medium`,children:F(`printers.drying.temperature`)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(`input`,{type:`number`,min:45,max:e,value:it,onChange:t=>at(Math.min(e,Math.max(45,Number(t.target.value)||45))),className:`w-12 px-1 py-0.5 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-[length:var(--pc-t11,11px)] text-center focus:outline-none focus:border-bambu-green [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`}),(0,G.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] text-bambu-gray`,children:`°C`})]})]}),(0,G.jsx)(`input`,{type:`range`,min:35,max:t,value:it,onChange:t=>at(Math.min(e,Math.max(45,Number(t.target.value)))),className:`w-full h-1 accent-bambu-green cursor-pointer`}),(0,G.jsxs)(`div`,{className:`flex justify-between text-[length:var(--pc-t9,9px)] text-bambu-gray/50 mt-0.5`,children:[(0,G.jsx)(`span`,{children:`45°C`}),(0,G.jsxs)(`span`,{children:[e,`°C`]})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,G.jsx)(`label`,{className:`text-[length:var(--pc-t10,10px)] text-white/70 font-medium`,children:F(`printers.drying.duration`)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(`input`,{type:`number`,min:1,max:24,value:ot,onChange:e=>st(Math.min(24,Math.max(1,Number(e.target.value)||1))),className:`w-10 px-1 py-0.5 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-[length:var(--pc-t11,11px)] text-center focus:outline-none focus:border-bambu-green [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`}),(0,G.jsx)(`span`,{className:`text-[length:var(--pc-t10,10px)] text-bambu-gray`,children:F(`printers.drying.hours`)})]})]}),(0,G.jsx)(`input`,{type:`range`,min:1,max:24,value:ot,onChange:e=>st(Number(e.target.value)),className:`w-full h-1 accent-bambu-green cursor-pointer`}),(0,G.jsxs)(`div`,{className:`flex justify-between text-[length:var(--pc-t9,9px)] text-bambu-gray/50 mt-0.5`,children:[(0,G.jsx)(`span`,{children:`1h`}),(0,G.jsx)(`span`,{children:`24h`})]})]}),(()=>{let e=((Qe===null?void 0:Dn.find(e=>e.id===Qe))?.tray??[]).some(e=>e.state===11),t=ct&&!e;return(0,G.jsx)(`button`,{type:`button`,onClick:()=>lt(e=>!e),"aria-pressed":t,disabled:e,title:e?F(`printers.drying.rotateUnavailableReason`):void 0,className:`h-8 w-full rounded-lg border px-2 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50 ${t?`bg-bambu-green border-bambu-green text-white`:`bg-bambu-dark border-bambu-dark-tertiary text-white hover:bg-bambu-dark-tertiary disabled:hover:bg-bambu-dark`}`,children:F(`printers.drying.rotateTray`)})})(),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`text-[10px] text-white/70 font-medium mb-1 block`,children:F(`printers.drying.startMode`)}),(0,G.jsx)(`div`,{className:`grid grid-cols-3 gap-1`,children:[`now`,`delay`,`at_time`].map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>dt(e),className:`py-1 rounded-lg border text-[10px] font-medium transition-colors ${ut===e?`bg-bambu-green border-bambu-green text-white`:`bg-bambu-dark border-bambu-dark-tertiary text-white hover:bg-bambu-dark-tertiary`}`,children:F(e===`now`?`printers.drying.modeNow`:e===`delay`?`printers.drying.modeDelay`:`printers.drying.modeAtTime`)},e))}),ut===`delay`&&(0,G.jsx)(`div`,{className:`mt-1.5 grid grid-cols-4 gap-1`,children:mAe.map(e=>(0,G.jsx)(`button`,{type:`button`,"aria-pressed":ft===e,onClick:()=>pt(e),className:`py-1 rounded-lg border text-[10px] font-medium transition-colors ${ft===e?`bg-bambu-green border-bambu-green text-white`:`bg-bambu-dark border-bambu-dark-tertiary text-white hover:bg-bambu-dark-tertiary`}`,children:rp(e/60)},e))}),ut===`at_time`&&(0,G.jsx)(`input`,{ref:xt,type:`datetime-local`,"data-testid":`drying-start-at`,value:mt,onChange:e=>ht(e.target.value),className:`mt-1.5 w-full px-2 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-[11px] focus:outline-none focus:border-bambu-green [color-scheme:dark]`})]})]}),(0,G.jsx)(`div`,{className:`shrink-0 h-px bg-bambu-dark-tertiary`}),(0,G.jsx)(`div`,{className:`shrink-0 px-3 pt-2.5 pb-3`,children:(0,G.jsx)(`button`,{onClick:()=>{if(Qe!==null){let e=(Dn.find(e=>e.id===Qe)?.tray??[]).some(e=>e.state===11),t=ct&&!e;if(ut===`now`)sr.mutate({amsId:Qe,temp:it,duration:ot,filament:nt,rotateTray:t});else{let e=bte(ut,ft,mt);e&&cr.mutate({amsId:Qe,temp:it,duration:ot,filament:nt,rotateTray:t,startAfter:e})}}},disabled:sr.isPending||cr.isPending||ut===`at_time`&&!mt,"data-testid":`drying-start-confirm`,className:`w-full py-1.5 bg-bambu-green hover:bg-bambu-green/80 text-white text-xs font-medium rounded-lg transition-colors disabled:opacity-50`,children:ut===`now`?sr.isPending?F(`printers.drying.startingDrying`):F(`printers.drying.start`):F(`printers.drying.schedule`)})})]}),(0,G.jsx)(`div`,{className:`fixed z-[102] w-2.5 h-2.5 rotate-45 bg-bambu-dark-secondary border-bambu-dark-tertiary pointer-events-none`,style:{left:gt.left+gt.arrowLeft-5,top:gt.anchorY-5,...gt.placement===`above`?{borderRightWidth:1,borderBottomWidth:1}:{borderLeftWidth:1,borderTopWidth:1}}})]})})()]})}function BAe({onClose:e,onAdd:t,existingSerials:n}){let{t:r}=U(),[i,a]=(0,f.useState)({name:``,serial_number:``,ip_address:``,access_code:``,model:``,location:``,auto_archive:!0}),[o,s]=(0,f.useState)(!1),[c,l]=(0,f.useState)([]),[u,d]=(0,f.useState)(``),[p,m]=(0,f.useState)(!1),[h,g]=(0,f.useState)(!1),[_,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)({scanned:0,total:0}),[D,O]=(0,f.useState)(!1),[k,A]=(0,f.useState)(!1),[j,M]=(0,f.useState)(null);(0,f.useEffect)(()=>{_d.getInfo().then(e=>{g(e.is_docker),e.subnets.length>0&&(v(e.subnets),b(e.subnets[0]))}).catch(()=>{});try{let e=localStorage.getItem(`bambuddy.discovery.customSubnet`);e&&S(e)}catch{}},[]);let N=c.filter(e=>!n.includes(e.serial)),P=async e=>{e.preventDefault(),A(!0);try{let e=await Z.diagnoseConnection({ip_address:i.ip_address.trim(),serial_number:i.serial_number.trim()||void 0,access_code:i.access_code||void 0});if(e.checks.some(e=>e.status===`fail`)){M(e);return}}catch{}finally{A(!1)}t(i)},F=async()=>{d(``),l([]),s(!0),m(!1),E({scanned:0,total:0});let e=C?x.trim():y,t=h||C;if(t&&C)try{localStorage.setItem(`bambuddy.discovery.customSubnet`,e)}catch{}try{if(t){await _d.startSubnetScan(e);let t=setInterval(async()=>{try{let e=await _d.getScanStatus();E({scanned:e.scanned,total:e.total}),l(await _d.getDiscoveredPrinters()),e.running||(clearInterval(t),s(!1),m(!0))}catch(e){console.error(`Failed to get scan status:`,e)}},500)}else{await _d.startDiscovery(10);let e=setInterval(async()=>{try{l(await _d.getDiscoveredPrinters())}catch(e){console.error(`Failed to get discovered printers:`,e)}},1e3);setTimeout(async()=>{clearInterval(e);try{await _d.stopDiscovery()}catch{}s(!1),m(!0);try{l(await _d.getDiscoveredPrinters())}catch(e){console.error(`Failed to get final discovered printers:`,e)}},1e4)}}catch(e){console.error(`Failed to start discovery:`,e),d(e instanceof Error?e.message:r(`printers.discovery.failedToStart`)),s(!1),m(!0)}},I=e=>{let t=e.serial.startsWith(`unknown-`)?``:e.serial;a({...i,name:e.name||``,serial_number:t,ip_address:e.ip_address,model:hW(e.model)}),l([])};return(0,f.useEffect)(()=>()=>{_d.stopDiscovery().catch(()=>{}),_d.stopSubnetScan().catch(()=>{})},[]),(0,f.useEffect)(()=>{let t=t=>{t.key===`Escape`&&e()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e]),(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-start sm:items-center justify-center z-50 p-4 overflow-y-auto`,onClick:e,children:(0,G.jsx)(Pd,{className:`w-full max-w-md my-auto max-h-[calc(100vh-2rem)] overflow-y-auto`,onClick:e=>e.stopPropagation(),children:(0,G.jsxs)(Id,{children:[(0,G.jsx)(`h2`,{className:`text-xl font-semibold mb-4`,children:r(`printers.addPrinter`)}),(0,G.jsxs)(`div`,{className:`mb-4 pb-4 border-b border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{className:`mb-3`,children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:r(`printers.discovery.subnetToScan`)}),_.length>0?(0,G.jsxs)(`select`,{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 text-sm`,value:C?`__custom__`:y,onChange:e=>{e.target.value===`__custom__`?w(!0):(w(!1),b(e.target.value))},disabled:o,children:[_.map(e=>(0,G.jsx)(`option`,{value:e,children:e},e)),(0,G.jsx)(`option`,{value:`__custom__`,children:r(`printers.discovery.customSubnetOption`)})]}):(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 focus:border-bambu-green focus:outline-none text-sm`,value:y,onChange:e=>b(e.target.value),placeholder:`192.168.1.0/24`,disabled:o}),C&&(0,G.jsx)(`input`,{type:`text`,"aria-label":r(`printers.discovery.customSubnetLabel`),className:`mt-2 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 text-sm`,value:x,onChange:e=>S(e.target.value),placeholder:`10.1.1.0/24`,disabled:o}),(0,G.jsx)(`p`,{className:`mt-1 text-xs text-bambu-gray`,children:r(h?`printers.discovery.dockerNote`:`printers.discovery.customSubnetNote`)})]}),(0,G.jsx)(Q,{type:`button`,variant:`secondary`,onClick:F,disabled:o,className:`w-full`,children:o?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),(h||C)&&T.total>0?r(`printers.discovery.scanProgress`,{scanned:T.scanned,total:T.total}):r(`printers.discovery.scanning`)]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Gl,{className:`w-4 h-4`}),r(h||C?`printers.discovery.scanSubnet`:`printers.discovery.discoverNetwork`)]})}),u&&(0,G.jsx)(`div`,{className:`mt-2 text-sm text-red-700 dark:text-red-400`,children:u}),N.length>0&&(0,G.jsx)(`div`,{className:`mt-3 space-y-2 max-h-40 overflow-y-auto`,children:N.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center justify-between p-2 bg-bambu-dark rounded-lg hover:bg-bambu-dark-secondary cursor-pointer transition-colors`,onClick:()=>I(e),children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`p`,{className:`font-medium text-white text-sm truncate`,children:e.name||e.serial}),(0,G.jsxs)(`p`,{className:`text-xs text-bambu-gray truncate`,children:[hW(e.model)||r(`printers.discovery.unknown`),` • `,e.ip_address,e.serial.startsWith(`unknown-`)&&(0,G.jsxs)(`span`,{className:`text-yellow-500`,children:[` • `,r(`printers.discovery.serialRequired`)]})]})]}),(0,G.jsx)(ss,{className:`w-4 h-4 text-bambu-gray -rotate-90 flex-shrink-0 ml-2`})]},e.serial))}),o&&(0,G.jsx)(`p`,{className:`mt-2 text-sm text-bambu-gray text-center`,children:r(h||C?`printers.discovery.scanningSubnet`:`printers.discovery.scanningNetwork`)}),p&&!o&&c.length===0&&(0,G.jsx)(`p`,{className:`mt-2 text-sm text-bambu-gray text-center`,children:r(h||C?`printers.discovery.noPrintersFoundSubnet`:`printers.discovery.noPrintersFoundNetwork`)}),p&&!o&&c.length>0&&N.length===0&&(0,G.jsx)(`p`,{className:`mt-2 text-sm text-bambu-gray text-center`,children:r(`printers.discovery.allConfigured`)})]}),(0,G.jsxs)(`form`,{onSubmit:P,className:`space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:r(`printers.name`)}),(0,G.jsx)(`input`,{type:`text`,required:!0,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`,value:i.name,onChange:e=>a({...i,name:e.target.value}),placeholder:r(`printers.modal.myPrinter`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:r(`printers.ipAddress`)}),(0,G.jsx)(`input`,{type:`text`,required:!0,pattern:`(\\d{1,3}(\\.\\d{1,3}){3}|[a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?(\\.[a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?)*)`,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`,value:i.ip_address,onChange:e=>a({...i,ip_address:e.target.value}),placeholder:`192.168.1.100 or printer.local`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:r(`printers.serialNumber`)}),(0,G.jsx)(`input`,{type:`text`,required:!0,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`,value:i.serial_number,onChange:e=>a({...i,serial_number:e.target.value}),placeholder:`01P00A000000000`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:r(`printers.accessCode`)}),(0,G.jsx)(`input`,{type:`password`,required:!0,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`,value:i.access_code,onChange:e=>a({...i,access_code:e.target.value}),placeholder:r(`printers.modal.fromPrinterSettings`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:r(`printers.modal.modelOptional`)}),(0,G.jsxs)(`select`,{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`,value:i.model||``,onChange:e=>a({...i,model:e.target.value}),children:[(0,G.jsx)(`option`,{value:``,children:r(`printers.modal.selectModel`)}),(0,G.jsxs)(`optgroup`,{label:`A1 Series`,children:[(0,G.jsx)(`option`,{value:`A1`,children:`A1`}),(0,G.jsx)(`option`,{value:`A1 Mini`,children:`A1 Mini`})]}),(0,G.jsx)(`optgroup`,{label:`A2 Series`,children:(0,G.jsx)(`option`,{value:`A2L`,children:`A2L`})}),(0,G.jsxs)(`optgroup`,{label:`H2 Series`,children:[(0,G.jsx)(`option`,{value:`H2C`,children:`H2C`}),(0,G.jsx)(`option`,{value:`H2D`,children:`H2D`}),(0,G.jsx)(`option`,{value:`H2D Pro`,children:`H2D Pro`}),(0,G.jsx)(`option`,{value:`H2S`,children:`H2S`})]}),(0,G.jsxs)(`optgroup`,{label:`P Series`,children:[(0,G.jsx)(`option`,{value:`P1P`,children:`P1P`}),(0,G.jsx)(`option`,{value:`P1S`,children:`P1S`}),(0,G.jsx)(`option`,{value:`P2S`,children:`P2S`})]}),(0,G.jsxs)(`optgroup`,{label:`X1 Series`,children:[(0,G.jsx)(`option`,{value:`X1`,children:`X1`}),(0,G.jsx)(`option`,{value:`X1C`,children:`X1 Carbon`}),(0,G.jsx)(`option`,{value:`X1E`,children:`X1E`})]}),(0,G.jsx)(`optgroup`,{label:`X2 Series`,children:(0,G.jsx)(`option`,{value:`X2D`,children:`X2D`})})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:r(`printers.modal.locationGroup`)}),(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 focus:border-bambu-green focus:outline-none`,value:i.location||``,onChange:e=>a({...i,location:e.target.value}),placeholder:r(`printers.modal.locationPlaceholder`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:r(`printers.locationHelp`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{type:`checkbox`,id:`auto_archive`,checked:i.auto_archive,onChange:e=>a({...i,auto_archive:e.target.checked}),className:`rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green`}),(0,G.jsx)(`label`,{htmlFor:`auto_archive`,className:`text-sm text-bambu-gray`,children:r(`printers.modal.autoArchiveLabel`)})]}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>O(!0),disabled:!i.ip_address.trim(),className:`w-full flex items-center justify-center gap-2 px-3 py-2 text-sm text-bambu-gray hover:text-white disabled:opacity-40 disabled:cursor-not-allowed border border-bambu-dark-tertiary rounded-lg transition-colors`,children:[(0,G.jsx)(hu,{className:`w-4 h-4`}),r(`diagnostic.runButton`)]}),j?(0,G.jsxs)(`div`,{className:`rounded-lg bg-amber-50 dark:bg-amber-500/10 border border-amber-300 dark:border-amber-500/30 p-3 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(Mu,{className:`w-4 h-4 mt-0.5 flex-shrink-0 text-amber-600 dark:text-amber-400`}),(0,G.jsx)(`p`,{className:`text-sm text-amber-700 dark:text-amber-300`,children:r(`printers.addPreflight.warning`)})]}),(0,G.jsx)(Dm,{result:j}),(0,G.jsxs)(`div`,{className:`flex gap-3`,children:[(0,G.jsx)(Q,{type:`button`,variant:`secondary`,onClick:()=>M(null),className:`flex-1`,children:r(`printers.addPreflight.back`)}),(0,G.jsx)(Q,{type:`button`,onClick:()=>t(i),className:`flex-1`,children:r(`printers.addPreflight.saveAnyway`)})]})]}):(0,G.jsxs)(`div`,{className:`flex gap-3 pt-2`,children:[(0,G.jsx)(Q,{type:`button`,variant:`secondary`,onClick:e,className:`flex-1`,children:r(`common.cancel`)}),(0,G.jsx)(Q,{type:`submit`,disabled:k,className:`flex-1`,children:r(k?`printers.addPreflight.checking`:`printers.addPrinter`)})]})]})]})})}),D&&(0,G.jsx)(Om,{connection:{ip_address:i.ip_address.trim(),serial_number:i.serial_number.trim()||void 0,access_code:i.access_code||void 0},printerName:i.name||null,onClose:()=>O(!1)})]})}function VAe({printer:e,firmwareInfo:t,onClose:n}){let{t:r}=U(),i=no(),{showToast:a}=Hd(),{hasPermission:o}=Od(),s=o(`firmware:update`),[c,l]=(0,f.useState)(null),[u,d]=(0,f.useState)(!1),[p,m]=(0,f.useState)(null),[h,g]=(0,f.useState)(t.update_available?t.latest_version:null),{data:_,isLoading:v}=K({queryKey:[`firmwarePrepare`,e.id,h],queryFn:()=>xd.prepareUpload(e.id,h??void 0),staleTime:3e4,enabled:!!h&&s&&!u}),y=q({mutationFn:()=>xd.startUpload(e.id,h??void 0),onSuccess:()=>{d(!0);let t=setInterval(async()=>{try{let n=await xd.getUploadStatus(e.id);l(n),(n.status===`complete`||n.status===`error`)&&(clearInterval(t),m(null),d(!1),n.status===`complete`&&(a(r(`printers.firmwareModal.uploadedToast`),`success`),i.invalidateQueries({queryKey:[`firmwareUpdate`,e.id]})))}catch{}},2e3);m(t)},onError:e=>{a(r(`printers.firmwareModal.uploadFailed`,{error:e.message}),`error`),d(!1)}});return(0,f.useEffect)(()=>()=>{p&&clearInterval(p)},[p]),(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50`,children:(0,G.jsx)(Pd,{className:`w-full max-w-md mx-4`,children:(0,G.jsxs)(Id,{children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3 mb-4`,children:[(0,G.jsx)(`div`,{className:`p-2 rounded-full ${t.update_available?`bg-orange-100 dark:bg-orange-500/20`:`bg-status-ok/20`}`,children:t.update_available?(0,G.jsx)(Ws,{className:`w-5 h-5 text-orange-600 dark:text-orange-400`}):(0,G.jsx)(hs,{className:`w-5 h-5 text-status-ok`})}),(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:t.update_available?r(`printers.firmwareModal.title`):r(`printers.firmwareModal.titleUpToDate`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:e.name})]})]}),(()=>{let e=h?t.available_versions?.find(e=>e.version===h):null,n=h??t.latest_version,i=e?.release_notes??t.release_notes,a=!!n&&n!==t.current_version;return(0,G.jsxs)(`div`,{className:`bg-bambu-dark rounded-lg p-3 mb-4`,children:[(0,G.jsxs)(`div`,{className:`flex justify-between items-center text-sm`,children:[(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:r(`printers.firmwareModal.currentVersion`)}),(0,G.jsx)(`span`,{className:`font-mono ${a?`text-white`:`text-status-ok`}`,children:t.current_version||r(`common.unknown`)})]}),a&&(0,G.jsxs)(`div`,{className:`flex justify-between items-center text-sm mt-1`,children:[(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:r(`printers.firmwareModal.latestVersion`)}),(0,G.jsx)(`span`,{className:`text-orange-700 dark:text-orange-400 font-mono`,children:n})]}),i&&(0,G.jsxs)(`details`,{className:`mt-3 text-sm`,open:!a,children:[(0,G.jsx)(`summary`,{className:`cursor-pointer hover:underline ${a?`text-orange-700 dark:text-orange-400`:`text-status-ok`}`,children:r(`printers.firmwareModal.releaseNotes`)}),(0,G.jsx)(`div`,{className:`mt-2 text-bambu-gray text-xs max-h-40 overflow-y-auto whitespace-pre-wrap`,children:i})]},n??`none`)]})})(),t.available_versions&&t.available_versions.length>0&&!u&&c?.status!==`complete`&&(0,G.jsxs)(`div`,{className:`mb-4`,children:[(0,G.jsx)(`div`,{className:`text-xs text-bambu-gray mb-2`,children:r(`printers.firmwareModal.availableVersions`)}),(0,G.jsx)(`div`,{className:`max-h-56 overflow-y-auto border border-bambu-dark-tertiary rounded-lg divide-y divide-bambu-dark-tertiary`,children:t.available_versions.map(e=>{let n=t.current_version===e.version,i=h===e.version,a=t.current_version?ute(e.version,t.current_version):0,o=r(n?`printers.firmwareModal.currentBadge`:a>0?`printers.firmwareModal.newerBadge`:`printers.firmwareModal.olderBadge`),c=n?`text-bambu-gray`:a>0?`text-orange-700 dark:text-orange-400`:`text-blue-700 dark:text-blue-400`;return(0,G.jsxs)(`button`,{type:`button`,disabled:!e.file_available||!s||n,onClick:()=>g(e.version),className:`w-full text-left px-3 py-2 text-sm flex items-center justify-between gap-2 transition-colors ${i?`bg-orange-50 dark:bg-orange-500/10`:`hover:bg-bambu-dark`} ${!e.file_available||!s||n?`opacity-60 cursor-not-allowed`:`cursor-pointer`}`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,G.jsx)(`span`,{className:`font-mono text-white`,children:e.version}),(0,G.jsx)(`span`,{className:`text-xs ${c}`,children:o})]}),(0,G.jsx)(`span`,{className:`text-xs px-2 py-0.5 rounded-full ${n?`bg-blue-50 dark:bg-blue-500/15 text-blue-700 dark:text-blue-400 border border-blue-300 dark:border-blue-500/30`:e.file_available?`bg-bambu-green/15 text-bambu-green border border-bambu-green/30`:`bg-bambu-gray/10 text-bambu-gray border border-bambu-gray/30`}`,children:n?r(`printers.firmwareModal.installed`):e.file_available?r(`printers.firmwareModal.usable`):r(`printers.firmwareModal.unavailable`)})]},e.version)})})]}),h?v?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-bambu-gray text-sm mb-4`,children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),r(`printers.firmwareModal.checkingPrereqs`)]}):_&&!u&&!c?(0,G.jsx)(`div`,{className:`mb-4`,children:_.can_proceed?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-bambu-green text-sm`,children:[(0,G.jsx)(Go,{className:`w-4 h-4`}),r(`printers.firmwareModal.sdCardReady`)]}):(0,G.jsx)(`div`,{className:`space-y-1`,children:_.errors.map((e,t)=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-red-700 dark:text-red-400 text-sm`,children:[(0,G.jsx)(ps,{className:`w-4 h-4 flex-shrink-0`}),e]},t))})}):null:null,(u||c)&&c&&(0,G.jsxs)(`div`,{className:`mb-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between text-sm mb-1`,children:[(0,G.jsx)(`span`,{className:`text-bambu-gray capitalize`,children:c.status}),(0,G.jsxs)(`span`,{className:`text-white`,children:[c.progress,`%`]})]}),(0,G.jsx)(`div`,{className:`w-full bg-bambu-dark-tertiary rounded-full h-2`,children:(0,G.jsx)(`div`,{className:`h-2 rounded-full transition-all ${c.status===`error`?`bg-status-error`:c.status===`complete`?`bg-status-ok`:`bg-orange-500`} ${c.status===`uploading`?`animate-pulse`:``}`,style:{width:`${c.progress}%`}})}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:c.message}),c.error&&(0,G.jsx)(`p`,{className:`text-xs text-red-700 dark:text-red-400 mt-1`,children:c.error})]}),c?.status===`complete`&&(0,G.jsxs)(`div`,{className:`bg-bambu-green/10 border border-bambu-green/30 rounded-lg p-3 mb-4`,children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-green font-medium mb-2`,children:r(`printers.firmwareModal.uploadedSuccess`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:r(`printers.firmwareModal.applyInstructions`)}),(0,G.jsxs)(`ol`,{className:`text-xs text-bambu-gray mt-1 list-decimal list-inside space-y-1`,children:[(0,G.jsx)(`li`,{dangerouslySetInnerHTML:{__html:r(`printers.firmwareModal.step1`)}}),(0,G.jsx)(`li`,{dangerouslySetInnerHTML:{__html:r(`printers.firmwareModal.step2`)}}),(0,G.jsx)(`li`,{dangerouslySetInnerHTML:{__html:r(`printers.firmwareModal.step3`)}}),(0,G.jsx)(`li`,{children:r(`printers.firmwareModal.step4`)})]})]}),(0,G.jsxs)(`div`,{className:`flex gap-2 justify-end`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:n,children:c?.status===`complete`?r(`printers.firmwareModal.done`):r(`common.cancel`)}),_?.can_proceed&&!u&&c?.status!==`complete`&&s&&(0,G.jsx)(Q,{onClick:()=>{l(null),y.mutate()},disabled:y.isPending,children:y.isPending?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin mr-2`}),r(`printers.firmwareModal.starting`)]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Ws,{className:`w-4 h-4 mr-2`}),r(`printers.firmwareModal.uploadFirmware`)]})})]})]})})})}function HAe({printer:e,onClose:t}){let{t:n}=U(),r=no(),{showToast:i}=Hd(),[a,o]=(0,f.useState)({name:e.name,ip_address:e.ip_address,access_code:``,model:e.model||``,location:e.location||``,auto_archive:e.auto_archive,is_active:e.is_active}),[s,c]=(0,f.useState)(!1),[l,u]=(0,f.useState)(null),d=q({mutationFn:t=>Z.updatePrinter(e.id,t),onSuccess:()=>{r.invalidateQueries({queryKey:[`printers`]}),r.invalidateQueries({queryKey:[`printerStatus`,e.id]}),t()},onError:e=>i(e.message||n(`printers.toast.failedToUpdate`),`error`)});(0,f.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]);let p=()=>{let e={name:a.name,ip_address:a.ip_address,model:a.model||void 0,location:a.location||void 0,auto_archive:a.auto_archive,is_active:a.is_active};a.access_code&&(e.access_code=a.access_code),d.mutate(e)};return(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-start sm:items-center justify-center z-50 p-4 overflow-y-auto`,onClick:t,children:(0,G.jsx)(Pd,{className:`w-full max-w-md my-auto max-h-[calc(100vh-2rem)] overflow-y-auto`,onClick:e=>e.stopPropagation(),children:(0,G.jsxs)(Id,{children:[(0,G.jsx)(`h2`,{className:`text-xl font-semibold mb-4`,children:n(`printers.editPrinter`)}),(0,G.jsxs)(`form`,{onSubmit:async t=>{t.preventDefault(),c(!0);try{let t=await Z.diagnoseConnection({ip_address:a.ip_address.trim(),serial_number:e.serial_number,access_code:a.access_code||void 0});if(t.checks.some(e=>e.status===`fail`)){u(t);return}}catch{}finally{c(!1)}p()},className:`space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`printers.name`)}),(0,G.jsx)(`input`,{type:`text`,required:!0,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`,value:a.name,onChange:e=>o({...a,name:e.target.value}),placeholder:n(`printers.modal.myPrinter`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`printers.ipAddress`)}),(0,G.jsx)(`input`,{type:`text`,required:!0,pattern:`(\\d{1,3}(\\.\\d{1,3}){3}|[a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?(\\.[a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?)*)`,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`,value:a.ip_address,onChange:e=>o({...a,ip_address:e.target.value}),placeholder:`192.168.1.100 or printer.local`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`printers.serialNumber`)}),(0,G.jsx)(`input`,{type:`text`,disabled:!0,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-bambu-gray cursor-not-allowed`,value:e.serial_number}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:n(`printers.serialCannotBeChanged`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`printers.accessCode`)}),(0,G.jsx)(`input`,{type:`password`,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`,value:a.access_code,onChange:e=>o({...a,access_code:e.target.value}),placeholder:n(`printers.accessCodePlaceholder`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:n(`printers.model`)}),(0,G.jsxs)(`select`,{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`,value:a.model,onChange:e=>o({...a,model:e.target.value}),children:[(0,G.jsx)(`option`,{value:``,children:n(`printers.modal.selectModel`)}),(0,G.jsxs)(`optgroup`,{label:`A1 Series`,children:[(0,G.jsx)(`option`,{value:`A1`,children:`A1`}),(0,G.jsx)(`option`,{value:`A1 Mini`,children:`A1 Mini`})]}),(0,G.jsx)(`optgroup`,{label:`A2 Series`,children:(0,G.jsx)(`option`,{value:`A2L`,children:`A2L`})}),(0,G.jsxs)(`optgroup`,{label:`H2 Series`,children:[(0,G.jsx)(`option`,{value:`H2C`,children:`H2C`}),(0,G.jsx)(`option`,{value:`H2D`,children:`H2D`}),(0,G.jsx)(`option`,{value:`H2D Pro`,children:`H2D Pro`}),(0,G.jsx)(`option`,{value:`H2S`,children:`H2S`})]}),(0,G.jsxs)(`optgroup`,{label:`P Series`,children:[(0,G.jsx)(`option`,{value:`P1P`,children:`P1P`}),(0,G.jsx)(`option`,{value:`P1S`,children:`P1S`}),(0,G.jsx)(`option`,{value:`P2S`,children:`P2S`})]}),(0,G.jsxs)(`optgroup`,{label:`X1 Series`,children:[(0,G.jsx)(`option`,{value:`X1`,children:`X1`}),(0,G.jsx)(`option`,{value:`X1C`,children:`X1 Carbon`}),(0,G.jsx)(`option`,{value:`X1E`,children:`X1E`})]}),(0,G.jsx)(`optgroup`,{label:`X2 Series`,children:(0,G.jsx)(`option`,{value:`X2D`,children:`X2D`})})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:`Location / Group`}),(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 focus:border-bambu-green focus:outline-none`,value:a.location,onChange:e=>o({...a,location:e.target.value}),placeholder:n(`printers.modal.locationPlaceholder`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:n(`printers.locationHelp`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{type:`checkbox`,id:`edit_auto_archive`,checked:a.auto_archive,onChange:e=>o({...a,auto_archive:e.target.checked}),className:`rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green`}),(0,G.jsx)(`label`,{htmlFor:`edit_auto_archive`,className:`text-sm text-bambu-gray`,children:n(`printers.modal.autoArchiveLabel`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{type:`checkbox`,id:`edit_maintenance_mode`,checked:!a.is_active,onChange:e=>o({...a,is_active:!e.target.checked}),className:`rounded border-bambu-dark-tertiary bg-bambu-dark text-amber-400 focus:ring-amber-400`}),(0,G.jsxs)(`label`,{htmlFor:`edit_maintenance_mode`,className:`text-sm text-bambu-gray flex items-center gap-1.5`,children:[(0,G.jsx)(Xu,{className:`w-3.5 h-3.5 text-amber-600 dark:text-amber-400`}),n(`printers.maintenance.editFieldLabel`)]})]}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray/70 mt-1 ml-6`,children:n(`printers.maintenance.editFieldHelp`)})]}),l?(0,G.jsxs)(`div`,{className:`rounded-lg bg-amber-50 dark:bg-amber-500/10 border border-amber-300 dark:border-amber-500/30 p-3 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(Mu,{className:`w-4 h-4 mt-0.5 flex-shrink-0 text-amber-600 dark:text-amber-400`}),(0,G.jsx)(`p`,{className:`text-sm text-amber-700 dark:text-amber-300`,children:n(`printers.addPreflight.warning`)})]}),(0,G.jsx)(Dm,{result:l}),(0,G.jsxs)(`div`,{className:`flex gap-3`,children:[(0,G.jsx)(Q,{type:`button`,variant:`secondary`,onClick:()=>u(null),className:`flex-1`,children:n(`printers.addPreflight.back`)}),(0,G.jsx)(Q,{type:`button`,onClick:p,className:`flex-1`,disabled:d.isPending,children:n(`printers.addPreflight.saveAnyway`)})]})]}):(0,G.jsxs)(`div`,{className:`flex gap-3 pt-4`,children:[(0,G.jsx)(Q,{type:`button`,variant:`secondary`,onClick:t,className:`flex-1`,children:n(`common.cancel`)}),(0,G.jsx)(Q,{type:`submit`,className:`flex-1`,disabled:d.isPending||s,children:s?n(`printers.addPreflight.checking`):d.isPending?n(`common.saving`):n(`printers.modal.saveChanges`)})]})]})]})})})}function UAe(e){let{data:t}=K({queryKey:[`printerStatus`,e],queryFn:()=>Z.getPrinterStatus(e),refetchInterval:3e4});return!t?.connected}function WAe({printer:e,plug:t,onPowerOn:n,isPowering:r}){let i=UAe(e.id),{data:a}=K({queryKey:[`smartPlugStatus`,t.id],queryFn:()=>Z.getSmartPlugStatus(t.id),refetchInterval:1e4});return i?(0,G.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 hover:bg-gray-100 dark:hover:bg-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,G.jsx)(`span`,{className:`text-sm text-white truncate`,children:e.name}),a&&(0,G.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded ${a.state===`ON`?`bg-bambu-green/20 text-bambu-green`:`bg-red-100 dark:bg-red-500/20 text-red-700 dark:text-red-400`}`,children:a.state||`?`})]}),(0,G.jsxs)(`button`,{onClick:()=>n(t.id),disabled:r||a?.state===`ON`,className:`px-2 py-1 text-xs rounded transition-colors flex items-center gap-1 ${a?.state===`ON`?`bg-bambu-green/20 text-bambu-green cursor-default`:`bg-bambu-green/20 text-bambu-green hover:bg-bambu-green hover:text-white`}`,children:[(0,G.jsx)(Al,{className:`w-3 h-3`}),r?`...`:`On`]})]}):null}function GAe(){let{t:e}=U(),{resolvedMode:t,darkAccent:n,lightAccent:r}=jd(),i={green:`bg-green-500 text-white hover:bg-green-400 border-green-400/60`,teal:`bg-teal-500 text-white hover:bg-teal-400 border-teal-400/60`,blue:`bg-blue-500 text-white hover:bg-blue-400 border-blue-400/60`,orange:`bg-orange-500 text-white hover:bg-orange-400 border-orange-400/60`,purple:`bg-purple-500 text-white hover:bg-purple-400 border-purple-400/60`,red:`bg-red-500 text-white hover:bg-red-400 border-red-400/60`}[t===`dark`?n:r],[a,o]=(0,f.useState)(!1),[s,c]=(0,f.useState)(()=>localStorage.getItem(`hideDisconnectedPrinters`)===`true`),[l,u]=(0,f.useState)(!1),[d,p]=(0,f.useState)(null),[m,h]=(0,f.useState)(()=>localStorage.getItem(`printerSortBy`)||`name`),[g,_]=(0,f.useState)(()=>localStorage.getItem(`printerSortAsc`)!==`false`),[v,y]=(0,f.useState)(()=>{let e=localStorage.getItem(`printerCardSize`);return e?parseInt(e,10):2}),[b,x]=(0,f.useState)(()=>localStorage.getItem(`printerPageView`)===`camwall`?`camwall`:`cards`),[S,C]=(0,f.useState)(()=>{let e=parseInt(localStorage.getItem(`camWallMaxLive`)||``,10);return Number.isFinite(e)&&e>0?e:4}),[w,T]=(0,f.useState)(()=>{let e=parseInt(localStorage.getItem(`camWallSnapshotSec`)||``,10);return Number.isFinite(e)&&e>0?e:8}),[E,D]=(0,f.useState)(()=>{let e=localStorage.getItem(`camWallStatusMode`);return e===`off`||e===`compact`||e===`full`?e:`full`}),O=v===1?`compact`:`expanded`,[k,A]=(0,f.useState)(null),j=(0,f.useCallback)(e=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{let t=document.getElementById(`printer-card-${e}`);if(!t)return;let n=document.querySelector(`header`)?.getBoundingClientRect().height??56,r=t.getBoundingClientRect().top+window.scrollY-n-16;window.scrollTo({top:Math.max(0,r),behavior:`smooth`})})})},[]),M=(0,f.useCallback)(e=>{A(e),y(2),localStorage.setItem(`printerCardSize`,`2`),j(e)},[j]),N=(0,f.useCallback)(()=>{let e=k;A(null),y(1),localStorage.setItem(`printerCardSize`,`1`),e!=null&&j(e)},[k,j]),[P,F]=(0,f.useState)(``),[I,L]=(0,f.useState)(()=>{let e=localStorage.getItem(`printerStatusFilter`);return vAe(e)?e:`all`}),[R,z]=(0,f.useState)(()=>localStorage.getItem(`printerLocationFilter`)||`all`),[B,V]=(0,f.useState)(0),[ee,te]=(0,f.useState)(()=>{try{let e=localStorage.getItem(`printerCollapsedSections`);return e?JSON.parse(e):{}}catch{return{}}}),ne=no(),{showToast:re}=Hd(),{hasPermission:ie}=Od(),[ae,oe]=(0,f.useState)(()=>gte()),[se,H]=(0,f.useState)(()=>{let e=localStorage.getItem(`openEmbeddedCameras`);if(e)try{let t=JSON.parse(e);return new Map(t.map(e=>[e.id,e]))}catch{return new Map}return new Map});(0,f.useEffect)(()=>{let e=Array.from(se.values());e.length>0?localStorage.setItem(`openEmbeddedCameras`,JSON.stringify(e)):localStorage.removeItem(`openEmbeddedCameras`)},[se]);let{data:ce,isLoading:le}=K({queryKey:[`printers`],queryFn:Z.getPrinters}),{data:ue}=K({queryKey:[`ui-preferences`],queryFn:Z.getUiPreferences}),de=(0,f.useMemo)(()=>rh(ue?.nozzle_temp_presets,$m,0,320),[ue?.nozzle_temp_presets]),fe=(0,f.useMemo)(()=>rh(ue?.bed_temp_presets,eh,0,140),[ue?.bed_temp_presets]),pe=(0,f.useMemo)(()=>rh(ue?.chamber_temp_presets,th,0,65),[ue?.chamber_temp_presets]),me=(0,f.useMemo)(()=>rh(ue?.fan_speed_presets,nh,0,100),[ue?.fan_speed_presets]),he=(0,f.useMemo)(()=>{if(ue?.drying_presets)try{let e=JSON.parse(ue.drying_presets);if(typeof e==`object`&&e&&Object.keys(e).length>0)return{..._W,...e}}catch{}return _W},[ue?.drying_presets]),ge=ae??(ue?.camera_view_mode===`embedded`?`embedded`:`window`),_e=(0,f.useCallback)(e=>{_te(e),oe(e),ie(`settings:update`)&&Z.updateSettings({camera_view_mode:e}).then(()=>ne.invalidateQueries({queryKey:[`ui-preferences`]})).catch(e=>console.warn(`Could not save camera view mode as the default:`,e))},[ie,ne]),{data:ve}=K({queryKey:[`smart-plugs`],queryFn:Z.getSmartPlugs}),{data:ye}=K({queryKey:[`maintenanceOverview`],queryFn:Z.getMaintenanceOverview,staleTime:60*1e3}),{data:be}=K({queryKey:[`obico-printer-status`],queryFn:Z.getObicoPrinterStatus,refetchInterval:1e4}),xe=(0,f.useCallback)(e=>be?.enabled===!0&&(be.monitored_printers===null||be.monitored_printers.includes(e)),[be]),{data:Se}=K({queryKey:[`spoolman-status`],queryFn:Z.getSpoolmanStatus,staleTime:60*1e3}),Ce=Se?.enabled&&Se?.connected,{data:we}=K({queryKey:[`spoolman-settings`],queryFn:Z.getSpoolmanSettings,enabled:!!Ce,staleTime:60*1e3}),Te=we?.spoolman_sync_mode,{data:Ee}=K({queryKey:[`unlinked-spools`],queryFn:Z.getUnlinkedSpools,enabled:!!Ce,staleTime:30*1e3}),De=Ee&&Ee.length>0,{data:Oe}=K({queryKey:[`linked-spools`],queryFn:Z.getLinkedSpools,enabled:!!Ce,staleTime:30*1e3}),ke=Oe?.linked,{data:Ae}=K({queryKey:[`spool-assignments`],queryFn:()=>Z.getAssignments(),enabled:ie(`inventory:view_assignments`),staleTime:30*1e3}),je=q({mutationFn:({printerId:e,amsId:t,trayId:n})=>Z.unassignSpool(e,t,n),onSuccess:()=>{ne.invalidateQueries({queryKey:[`spool-assignments`]})}}),{data:Me,isLoading:Ne}=K({queryKey:[`spoolman-inventory-spools`],queryFn:()=>Z.getSpoolmanInventorySpools(!1),enabled:!!Ce,staleTime:30*1e3}),{data:Pe,isLoading:Fe}=K({queryKey:[`spoolman-slot-assignments`],queryFn:()=>Z.getSpoolmanSlotAssignments(),enabled:!!Ce,staleTime:30*1e3}),Ie=q({mutationFn:e=>Z.unassignSpoolmanSlot(e),onSuccess:()=>{ne.invalidateQueries({queryKey:[`spoolman-inventory-spools`]}),ne.invalidateQueries({queryKey:[`spoolman-slot-assignments`]})}}),Le=(e,t,n)=>Ae?.find(r=>r.printer_id===e&&r.ams_id===Number(t)&&r.tray_id===Number(n)),Re=ye?.reduce((e,t)=>(e[t.printer_id]={due_count:t.due_count,warning_count:t.warning_count,total_print_hours:t.total_print_hours},e),{})||{},ze=ve?.reduce((e,t)=>(t.printer_id&&(e[t.printer_id]=t),e),{})||{},Be=q({mutationFn:Z.createPrinter,onSuccess:()=>{ne.invalidateQueries({queryKey:[`printers`]}),ne.invalidateQueries({queryKey:[`maintenanceOverview`]}),o(!1)},onError:t=>{if(t instanceof nd&&t.code===`printer_connection_failed`){re(e(`printers.toast.connectionFailedNotAdded`),`error`);return}re(t.message||e(`printers.toast.failedToAdd`),`error`)}}),Ve=q({mutationFn:e=>Z.controlSmartPlug(e,`on`),onSuccess:()=>{ne.invalidateQueries({queryKey:[`smart-plugs`]}),p(null)},onError:()=>{p(null)}}),[He,Ue]=(0,f.useState)(new Set),[We,Ge]=(0,f.useState)(!1),[Ke,qe]=(0,f.useState)(null),[Je,Ye]=(0,f.useState)(!1),Xe=We||He.size>0,Ze=(0,f.useCallback)(e=>{Ue(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Qe=(0,f.useCallback)(()=>{Ue(new Set),Ge(!1)},[]);(0,f.useEffect)(()=>{let e=e=>{e.key===`Escape`&&Xe&&Qe()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Xe,Qe]);let $e=(0,f.useCallback)(async t=>{Ye(!0);let n=Array.from(He).filter(e=>{let n=ne.getQueryData([`printerStatus`,e]);if(t===`clearPlate`)return!!n?.awaiting_plate_clear;if(!n?.connected)return!1;switch(t){case`stop`:return n.state===`RUNNING`||n.state===`PAUSE`;case`pause`:return n.state===`RUNNING`;case`resume`:return n.state===`PAUSE`;case`clearHMS`:return n.hms_errors&&ch(n.hms_errors).length>0;default:return!1}});if(n.length===0){re(e(`printers.bulk.noneApplicable`),`error`),Ye(!1),qe(null);return}let r={stop:Z.stopPrint,pause:Z.pausePrint,resume:Z.resumePrint,clearPlate:Z.clearPlate,clearHMS:Z.clearHMSErrors}[t],i=await Promise.allSettled(n.map(e=>r(e))),a=i.filter(e=>e.status===`fulfilled`).length,o=i.filter(e=>e.status===`rejected`).length;o===0?re(e(`printers.bulk.success`,{action:e(`printers.bulk.actions.${t}`),count:a})):re(e(`printers.bulk.partial`,{succeeded:a,failed:o}),`error`),n.forEach(e=>{ne.invalidateQueries({queryKey:[`printerStatus`,e]})}),Ye(!1),qe(null)},[He,ne,re,e]),et=(0,f.useCallback)(e=>{e===`stop`||e===`pause`||e===`clearPlate`?qe(e):$e(e)},[$e]),tt=()=>{let e=!s;c(e),localStorage.setItem(`hideDisconnectedPrinters`,String(e))},nt=e=>{h(e),localStorage.setItem(`printerSortBy`,e)},rt=e=>{L(e),localStorage.setItem(`printerStatusFilter`,e)},it=e=>{z(e),localStorage.setItem(`printerLocationFilter`,e)},at=()=>{let e=!g;_(e),localStorage.setItem(`printerSortAsc`,String(e))},ot=()=>{switch(v){case 1:return`grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5`;case 2:return`grid-cols-1 md:grid-cols-2 xl:grid-cols-3`;case 3:return`grid-cols-1 lg:grid-cols-2`;case 4:return`grid-cols-1`;default:return`grid-cols-1 md:grid-cols-2 xl:grid-cols-3`}},st=[`S`,`M`,`L`,`XL`];(0,f.useEffect)(()=>ne.getQueryCache().subscribe(e=>{e.type===`updated`&&Array.isArray(e.query.queryKey)&&e.query.queryKey[0]===`printerStatus`&&V(e=>e+1)}),[ne]);let ct=(0,f.useMemo)(()=>{if(!ce)return[];let e=ce;if(P.trim()){let t=P.trim().toLowerCase();e=e.filter(e=>e.name.toLowerCase().includes(t)||(e.model||``).toLowerCase().includes(t)||(e.location||``).toLowerCase().includes(t)||(e.serial_number||``).toLowerCase().includes(t))}return R!==`all`&&(e=e.filter(e=>(e.location||``)===R)),I!==`all`&&(e=e.filter(e=>{let t=ne.getQueryData([`printerStatus`,e.id]);if(!t?.connected)return I===`offline`;let n=t.hms_errors?ch(t.hms_errors):[];switch(I){case`printing`:return t.state===`RUNNING`;case`paused`:return t.state===`PAUSE`;case`finished`:return t.state===`FINISH`;case`error`:return t.state===`FAILED`||n.length>0;case`idle`:return t.state!==`RUNNING`&&t.state!==`PAUSE`&&t.state!==`FINISH`&&t.state!==`FAILED`&&n.length===0;case`offline`:return!1;default:return!0}})),e},[ce,P,I,R,ne,B]),lt=(0,f.useMemo)(()=>ce?[...new Set(ce.map(e=>e.location||``).filter(Boolean))].sort():[],[ce]);(0,f.useEffect)(()=>{!ce||R===`all`||lt.includes(R)||(z(`all`),localStorage.setItem(`printerLocationFilter`,`all`))},[ce,lt,R]);let ut=(0,f.useMemo)(()=>{let e=[...ct];switch(m){case`name`:e.sort((e,t)=>e.name.localeCompare(t.name));break;case`model`:e.sort((e,t)=>(e.model||``).localeCompare(t.model||``));break;case`location`:e.sort((e,t)=>{let n=e.location||``,r=t.location||``;return!n&&r?1:n&&!r?-1:n.localeCompare(r)||e.name.localeCompare(t.name)});break;case`status`:e.sort((e,t)=>{let n=ne.getQueryData([`printerStatus`,e.id]),r=ne.getQueryData([`printerStatus`,t.id]),i=e=>e?.connected?(e.hms_errors?ch(e.hms_errors):[]).length>0?0:e.state===`RUNNING`?1:2:3;return i(n)-i(r)});break;case`eta`:e.sort((e,t)=>{let n=ne.getQueryData([`printerStatus`,e.id]),r=ne.getQueryData([`printerStatus`,t.id]),i=e=>e?.connected?e.state===`RUNNING`&&e.remaining_time!=null&&e.remaining_time>0?0:e.state===`RUNNING`?1:2:3,a=i(n),o=i(r);if(a!==o)return a-o;if(a===0){let e=(n.remaining_time??0)-(r.remaining_time??0);if(e!==0)return e}return e.name.localeCompare(t.name)});break}return g||e.reverse(),e},[ct,m,g,ne]),dt=(0,f.useCallback)(()=>{Ue(new Set(ut.map(e=>e.id))),Ge(!0)},[ut]),ft=(0,f.useCallback)(e=>{Ue(t=>{let n=new Set(t);return ut.forEach(t=>{mW(ne.getQueryData([`printerStatus`,t.id]))===e&&n.add(t.id)}),n}),Ge(!0)},[ut,ne]),pt=(0,f.useCallback)(e=>{Ue(t=>{let n=new Set(t);return ut.filter(t=>(t.location||``)===e).forEach(e=>n.add(e.id)),n}),Ge(!0)},[ut]),mt=(0,f.useCallback)(e=>{Ue(t=>{let n=new Set(t);return ut.filter(t=>(t.model||`Unknown`)===e).forEach(e=>n.add(e.id)),n}),Ge(!0)},[ut]),ht=(0,f.useCallback)(e=>{te(t=>{let n={...t,[e]:!t[e]};try{localStorage.setItem(`printerCollapsedSections`,JSON.stringify(n))}catch{}return n})},[]),gt=(0,f.useMemo)(()=>{if(m===`name`||m===`eta`)return null;let e={};return m===`location`?ut.forEach(t=>{let n=t.location||`Ungrouped`;e[n]||(e[n]=[]),e[n].push(t)}):m===`model`?ut.forEach(t=>{let n=t.model||`Unknown`;e[n]||(e[n]=[]),e[n].push(t)}):m===`status`&&ut.forEach(t=>{let n=mW(ne.getQueryData([`printerStatus`,t.id]));e[n]||(e[n]=[]),e[n].push(t)}),e},[m,ut,ne,B]),_t=(0,f.useRef)(null),vt=(0,f.useRef)(null),yt=(0,f.useRef)(0),[bt,xt]=(0,f.useState)(!1),St=(0,f.useCallback)(()=>{let e=_t.current;if(!e)return;let t=vt.current?.offsetWidth;t&&(yt.current=t);let n=yt.current>0&&e.clientWidthe===n?e:n)},[]),Ct=Object.keys(ze).length;(0,f.useLayoutEffect)(()=>{St();let e=_t.current;if(!e)return;if(typeof ResizeObserver>`u`)return window.addEventListener(`resize`,St),()=>window.removeEventListener(`resize`,St);let t=new ResizeObserver(()=>St());return t.observe(e),window.addEventListener(`resize`,St),()=>{t.disconnect(),window.removeEventListener(`resize`,St)}},[St,ce?.length,lt.length,s,Ct]);let wt=(t=!1)=>(0,G.jsxs)(G.Fragment,{children:[ce&&ce.length>0&&(0,G.jsx)(lW,{value:I,onChange:rt,fullWidth:t,options:XU.map(t=>({value:t.value,label:e(t.labelKey)}))}),ce&&ce.length>0&<.length>0&&(0,G.jsx)(lW,{value:R,onChange:it,fullWidth:t,options:[{value:`all`,label:e(`printers.filter.allLocations`)},...lt.map(e=>({value:e,label:e}))]}),(0,G.jsx)(`button`,{type:`button`,onClick:tt,"aria-pressed":s,className:`h-8 px-2 rounded-lg border text-sm font-medium transition-colors ${t?`w-full`:``} ${s?`bg-bambu-green border-bambu-green text-white`:`bg-bambu-dark border-bambu-dark-tertiary text-white hover:bg-bambu-dark-tertiary`}`,children:e(`printers.hideOffline`)})]}),Tt=(t=!1)=>(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1 ${t?`w-full`:``}`,children:[(0,G.jsx)(lW,{value:m,onChange:nt,fullWidth:t,options:[{value:`name`,label:e(`printers.sort.name`)},{value:`status`,label:e(`printers.sort.status`)},{value:`model`,label:e(`printers.sort.model`)},{value:`location`,label:e(`printers.sort.location`)},{value:`eta`,label:e(`printers.sort.eta`)}]}),(0,G.jsx)(`button`,{onClick:at,className:`h-8 shrink-0 px-2 rounded-lg border bg-bambu-dark border-bambu-dark-tertiary text-white hover:bg-bambu-dark-tertiary transition-colors flex items-center justify-center`,title:e(g?`printers.sort.descending`:`printers.sort.ascending`),children:g?(0,G.jsx)(Io,{className:`w-4 h-4 text-white`}):(0,G.jsx)(Ao,{className:`w-4 h-4 text-white`})})]}),(0,G.jsxs)(`div`,{className:`flex h-8 items-center bg-bambu-dark rounded-lg border border-bambu-dark-tertiary ${t?`w-full`:``}`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>{x(`cards`),localStorage.setItem(`printerPageView`,`cards`)},className:`flex h-full items-center gap-1 rounded-l-lg px-2 text-xs font-medium transition-colors ${t?`flex-1 justify-center`:``} ${b===`cards`?`bg-bambu-green text-white`:`text-white hover:bg-bambu-dark-tertiary`}`,title:e(`printers.pageView.cards`),"aria-pressed":b===`cards`,children:[(0,G.jsx)(Uc,{className:`w-3.5 h-3.5`}),t&&(0,G.jsx)(`span`,{children:e(`printers.pageView.cards`)})]}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>{x(`camwall`),localStorage.setItem(`printerPageView`,`camwall`)},className:`flex h-full items-center gap-1 rounded-r-lg px-2 text-xs font-medium transition-colors ${t?`flex-1 justify-center`:``} ${b===`camwall`?`bg-bambu-green text-white`:`text-white hover:bg-bambu-dark-tertiary`}`,title:e(`printers.pageView.camWall`),"aria-pressed":b===`camwall`,disabled:!ie(`camera:view`),children:[(0,G.jsx)(cl,{className:`w-3.5 h-3.5`}),t&&(0,G.jsx)(`span`,{children:e(`printers.pageView.camWall`)})]})]}),b===`camwall`&&ie(`camera:view`)&&(0,G.jsxs)(Ci,{to:`/camwall`,className:`flex h-8 items-center gap-1 rounded-lg border border-bambu-dark-tertiary bg-bambu-dark px-2 text-xs font-medium text-white transition-colors hover:bg-bambu-dark-tertiary ${t?`w-full justify-center`:``}`,title:e(`printers.pageView.openCamWallPage`),children:[(0,G.jsx)(Zs,{className:`w-3.5 h-3.5`}),t&&(0,G.jsx)(`span`,{children:e(`printers.pageView.openCamWallPage`)})]}),(0,G.jsx)(`div`,{className:`flex h-8 items-center bg-bambu-dark rounded-lg border border-bambu-dark-tertiary ${b===`camwall`?`opacity-40 pointer-events-none`:``} ${t?`w-full`:``}`,children:st.map((n,r)=>{let i=r+1,a=v===i;return(0,G.jsx)(`button`,{onClick:()=>{A(null),y(i),localStorage.setItem(`printerCardSize`,String(i))},className:`h-full px-2 text-xs font-medium transition-colors ${t?`flex-1`:``} ${r===0?`rounded-l-lg`:``} ${r===st.length-1?`rounded-r-lg`:``} ${a?`bg-bambu-green text-white`:`text-white hover:bg-bambu-dark-tertiary`}`,title:e(n===`S`?`printers.cardSize.small`:n===`M`?`printers.cardSize.medium`:n===`L`?`printers.cardSize.large`:`printers.cardSize.extraLarge`),children:n},n)})})]}),Et=(t=!1)=>(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`button`,{onClick:()=>{Xe?Qe():Ge(!0)},className:`h-8 px-2 rounded-lg border transition-colors ${t?`w-full justify-center gap-1.5 text-sm font-medium flex items-center`:``} ${Xe?`bg-bambu-green border-bambu-green text-white`:`bg-bambu-dark border-bambu-dark-tertiary text-white hover:bg-bambu-dark-tertiary`}`,title:e(`printers.bulk.select`),disabled:!ie(`printers:control`),children:[(0,G.jsx)(du,{className:`w-4 h-4`}),t&&(0,G.jsx)(`span`,{children:e(`printers.bulk.select`)})]}),s&&Object.keys(ze).length>0&&(0,G.jsxs)(`div`,{className:`relative ${t?`w-full`:``}`,children:[(0,G.jsxs)(`button`,{onClick:()=>u(!l),className:`h-8 flex items-center gap-1.5 px-2 text-sm rounded-lg border transition-colors ${t?`w-full justify-between bg-bambu-dark border-bambu-dark-tertiary text-white hover:bg-bambu-dark-tertiary hover:text-white`:`bg-bambu-dark border-bambu-dark-tertiary text-white hover:bg-bambu-dark-tertiary`}`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(Al,{className:`w-4 h-4`}),e(`printers.powerOn`)]}),(0,G.jsx)(ss,{className:`w-3 h-3 transition-transform ${l?`rotate-180`:``}`})]}),l&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`fixed inset-0 z-10`,onClick:()=>u(!1)}),(0,G.jsxs)(`div`,{className:`absolute right-0 mt-2 w-56 bg-white dark:bg-bambu-dark-secondary border border-gray-200 dark:border-bambu-dark-tertiary rounded-lg shadow-lg z-20 py-1`,children:[(0,G.jsx)(`div`,{className:`px-3 py-2 text-xs text-gray-500 dark:text-bambu-gray border-b border-gray-200 dark:border-bambu-dark-tertiary`,children:e(`printers.offlinePrintersWithPlugs`)}),ce?.filter(e=>ze[e.id]).map(e=>(0,G.jsx)(WAe,{printer:e,plug:ze[e.id],onPowerOn:e=>{p(e),Ve.mutate(e)},isPowering:d===ze[e.id]?.id},e.id)),ce?.filter(e=>ze[e.id]).length===0&&(0,G.jsx)(`div`,{className:`px-3 py-2 text-sm text-bambu-gray`,children:`No printers with smart plugs`})]})]})]}),(0,G.jsxs)(Q,{onClick:()=>o(!0),disabled:!ie(`printers:create`),title:ie(`printers:create`)?void 0:e(`printers.permission.noAdd`),className:`!h-8 !min-h-8 px-2 py-0 ${t?`w-full`:``}`,children:[(0,G.jsx)(Ol,{className:`w-4 h-4`}),e(`printers.addPrinter`)]})]});return(0,G.jsxs)(`div`,{className:`p-4 md:p-8`,children:[(0,G.jsxs)(`div`,{className:`space-y-3 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)(jl,{className:`w-7 h-7 text-bambu-green`}),e(`printers.title`)]}),(0,G.jsx)(MAe,{printers:ce})]}),(0,G.jsxs)(`div`,{ref:_t,className:`relative flex items-center gap-2`,children:[ce&&ce.length>0&&(0,G.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,G.jsx)(Gl,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray/50`}),(0,G.jsx)(`input`,{type:`search`,name:`printer-search`,autoComplete:`off`,"data-1p-ignore":!0,"data-lpignore":`true`,value:P,onChange:e=>F(e.target.value),placeholder:e(`printers.search`),"aria-label":e(`printers.search`),className:`w-full h-8 pl-9 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`}),P&&(0,G.jsx)(`button`,{type:`button`,"aria-label":e(`common.clear`),onClick:()=>F(``),className:`absolute right-3 top-1/2 -translate-y-1/2 text-bambu-gray hover:text-white`,children:(0,G.jsx)(Zu,{className:`w-4 h-4`})})]}),(0,G.jsxs)(`div`,{ref:vt,"aria-hidden":bt,inert:bt,className:`${bt?`absolute -left-[9999px] top-0 flex w-max pointer-events-none opacity-0`:`flex`} ml-auto items-center justify-end gap-2 flex-nowrap [&>*]:shrink-0`,children:[(0,G.jsx)(`div`,{className:`h-6 w-px bg-bambu-dark-tertiary`}),(0,G.jsx)(`div`,{className:`flex items-center gap-2`,children:wt()}),(0,G.jsx)(`div`,{className:`h-6 w-px bg-bambu-dark-tertiary`}),(0,G.jsx)(`div`,{className:`flex items-center gap-2`,children:Tt()}),(0,G.jsx)(`div`,{className:`h-6 w-px bg-bambu-dark-tertiary`}),(0,G.jsx)(`div`,{className:`flex items-center gap-2`,children:Et()})]}),bt&&(0,G.jsxs)(`div`,{className:`ml-auto flex items-center justify-end gap-1`,children:[(0,G.jsx)(uW,{label:e(`printers.toolbar.filters`,`Filters`),icon:(0,G.jsx)(vc,{className:`w-4 h-4`}),children:(0,G.jsx)(`div`,{className:`flex w-48 flex-col gap-2`,children:wt(!0)})}),(0,G.jsx)(uW,{label:e(`printers.toolbar.view`,`View`),icon:(0,G.jsx)(au,{className:`w-4 h-4`}),children:(0,G.jsx)(`div`,{className:`flex w-48 flex-col gap-2`,children:Tt(!0)})}),(0,G.jsx)(uW,{label:e(`printers.toolbar.actions`,`Actions`),icon:(0,G.jsx)(Js,{className:`w-4 h-4`}),children:(0,G.jsx)(`div`,{className:`flex w-48 flex-col gap-2`,children:Et(!0)})})]})]})]}),le?(0,G.jsx)(`div`,{className:`text-center py-12 text-bambu-gray`,children:e(`common.loading`)}):ce?.length===0?(0,G.jsx)(Pd,{children:(0,G.jsxs)(Id,{className:`text-center py-12`,children:[(0,G.jsx)(`p`,{className:`text-bambu-gray mb-4`,children:e(`printers.noPrintersConfigured`)}),(0,G.jsxs)(Q,{onClick:()=>o(!0),disabled:!ie(`printers:create`),title:ie(`printers:create`)?void 0:e(`printers.permission.noAdd`),children:[(0,G.jsx)(Ol,{className:`w-4 h-4`}),e(`printers.addPrinter`)]})]})}):ut.length===0&&(P.trim()||I!==`all`||R!==`all`)?(0,G.jsx)(Pd,{children:(0,G.jsx)(Id,{className:`text-center py-12`,children:(0,G.jsx)(`p`,{className:`text-bambu-gray`,children:e(`printers.noSearchResults`)})})}):b===`camwall`?(0,G.jsx)(cE,{printers:ut,maxLive:S,snapshotIntervalSec:w,onTileClick:(e,t)=>{ge===`embedded`?H(n=>new Map(n).set(e,{id:e,name:t})):Xm(e)},statusMode:E,onChangeMaxLive:e=>{C(e),localStorage.setItem(`camWallMaxLive`,String(e))},onChangeSnapshotIntervalSec:e=>{T(e),localStorage.setItem(`camWallSnapshotSec`,String(e))},onChangeStatusMode:e=>{D(e),localStorage.setItem(`camWallStatusMode`,e)}}):gt?(0,G.jsx)(`div`,{className:`space-y-6`,children:(()=>{let e=m===`status`?PAe.filter(e=>gt[e]?.length>0):Object.keys(gt);return g?e:[...e].reverse()})().map(t=>{let n=gt[t],r=`${m}:${t}`,i=!ee[r],a=m===`status`&&pW[t]?.dot||`bg-bambu-green`,o=m===`status`?e(pW[t]?.labelKey||t):t;return(0,G.jsx)(jm,{open:i,onToggle:()=>ht(r),summaryClassName:`py-1`,summary:(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`w-2 h-2 rounded-full ${a}`}),o,(0,G.jsxs)(`span`,{className:`text-sm font-normal text-bambu-gray`,children:[`(`,n.length,`)`]}),Xe&&(0,G.jsx)(`button`,{onClick:e=>{e.stopPropagation(),m===`location`?pt(t===`Ungrouped`?``:t):m===`status`?ft(t):m===`model`&&mt(t)},className:`text-xs text-bambu-green hover:text-bambu-green-light transition-colors ml-1`,children:e(`printers.bulk.selectAll`)})]}),children:(0,G.jsx)(`div`,{className:`grid gap-4 ${v>=3?`gap-6`:``} ${ot()}`,children:n.map(e=>(0,G.jsx)(yW,{printer:e,hideIfDisconnected:s,maintenanceInfo:Re[e.id],viewMode:O,cardSize:v,amsThresholds:ue?{humidityGood:Number(ue.ams_humidity_good)||40,humidityFair:Number(ue.ams_humidity_fair)||60,tempGood:Number(ue.ams_temp_good)||28,tempFair:Number(ue.ams_temp_fair)||35}:void 0,spoolmanEnabled:Ce,hasUnlinkedSpools:De,linkedSpools:ke,spoolmanUrl:Se?.url,spoolmanSyncMode:Te,onGetAssignment:Le,onUnassignSpool:(e,t,n)=>je.mutate({printerId:e,amsId:t,trayId:n}),spoolmanSpools:Me,spoolmanSlotAssignments:Pe,spoolmanLoading:Ne||Fe,onUnassignSpoolmanSpool:e=>Ie.mutate(e),timeFormat:ue?.time_format||`system`,cameraViewMode:ge,onOpenEmbeddedCamera:(e,t)=>H(n=>new Map(n).set(e,{id:e,name:t})),onSelectCameraViewMode:_e,checkPrinterFirmware:ue?.check_printer_firmware!==!1,dryingPresets:he,nozzleTempPresets:de,bedTempPresets:fe,chamberTempPresets:pe,fanSpeedPresets:me,requirePlateClear:ue?.require_plate_clear===!0,selectionMode:Xe,isSelected:He.has(e.id),onToggleSelect:Ze,onOpenCompactCard:M,aiDetectionEnabled:xe(e.id),aiDetection:be?.enabled?be.per_printer[String(e.id)]:void 0,aiLastError:be?.last_error??null},e.id))})},t)})}):(0,G.jsx)(`div`,{className:`grid gap-4 ${v>=3?`gap-6`:``} ${ot()}`,children:ut.map(e=>(0,G.jsx)(yW,{printer:e,hideIfDisconnected:s,maintenanceInfo:Re[e.id],viewMode:O,cardSize:v,spoolmanEnabled:Ce,hasUnlinkedSpools:De,linkedSpools:ke,spoolmanUrl:Se?.url,spoolmanSyncMode:Te,onGetAssignment:Le,onUnassignSpool:(e,t,n)=>je.mutate({printerId:e,amsId:t,trayId:n}),spoolmanSpools:Me,spoolmanSlotAssignments:Pe,spoolmanLoading:Ne||Fe,onUnassignSpoolmanSpool:e=>Ie.mutate(e),amsThresholds:ue?{humidityGood:Number(ue.ams_humidity_good)||40,humidityFair:Number(ue.ams_humidity_fair)||60,tempGood:Number(ue.ams_temp_good)||28,tempFair:Number(ue.ams_temp_fair)||35}:void 0,timeFormat:ue?.time_format||`system`,cameraViewMode:ge,onOpenEmbeddedCamera:(e,t)=>H(n=>new Map(n).set(e,{id:e,name:t})),onSelectCameraViewMode:_e,checkPrinterFirmware:ue?.check_printer_firmware!==!1,dryingPresets:he,nozzleTempPresets:de,bedTempPresets:fe,chamberTempPresets:pe,fanSpeedPresets:me,requirePlateClear:ue?.require_plate_clear===!0,selectionMode:Xe,isSelected:He.has(e.id),onToggleSelect:Ze,onOpenCompactCard:M,aiDetectionEnabled:xe(e.id),aiDetection:be?.enabled?be.per_printer[String(e.id)]:void 0,aiLastError:be?.last_error??null},e.id))}),v===2&&k!=null&&(0,G.jsxs)(`button`,{type:`button`,onClick:N,className:`fixed bottom-5 left-1/2 z-40 inline-flex -translate-x-1/2 items-center gap-2 rounded-full border px-4 py-2 text-sm font-medium shadow-xl transition-colors ${i}`,title:e(`common.back`,`Back`),children:[(0,G.jsx)(jo,{className:`w-4 h-4`}),e(`common.back`,`Back`)]}),a&&(0,G.jsx)(BAe,{onClose:()=>o(!1),onAdd:e=>Be.mutate(e),existingSerials:ce?.map(e=>e.serial_number)||[]}),Xe&&ce&&(0,G.jsx)(kte,{selectedIds:He,printers:ce,onClose:Qe,onSelectAll:dt,onSelectByLocation:pt,onSelectByState:ft,onAction:et,actionPending:Je}),Ke===`stop`&&(0,G.jsx)($d,{title:e(`printers.bulk.confirm.stopTitle`,{count:He.size}),message:e(`printers.bulk.confirm.stopMessage`,{count:He.size}),confirmText:e(`printers.bulk.confirm.stopButton`),variant:`danger`,isLoading:Je,onConfirm:()=>$e(`stop`),onCancel:()=>qe(null)}),Ke===`pause`&&(0,G.jsx)($d,{title:e(`printers.bulk.confirm.pauseTitle`,{count:He.size}),message:e(`printers.bulk.confirm.pauseMessage`,{count:He.size}),confirmText:e(`printers.bulk.confirm.pauseButton`),isLoading:Je,onConfirm:()=>$e(`pause`),onCancel:()=>qe(null)}),Ke===`clearPlate`&&(0,G.jsx)($d,{title:e(`printers.bulk.confirm.clearPlateTitle`,{count:He.size}),message:e(`printers.bulk.confirm.clearPlateMessage`,{count:He.size}),confirmText:e(`printers.bulk.confirm.clearPlateButton`),isLoading:Je,onConfirm:()=>$e(`clearPlate`),onCancel:()=>qe(null)}),Array.from(se.values()).map((e,t)=>(0,G.jsx)(Vce,{printerId:e.id,printerName:e.name,viewerIndex:t,onClose:()=>H(t=>{let n=new Map(t);return n.delete(e.id),n})},e.id))]})}function KAe({title:e,message:t,subtitle:n,closeText:r,variant:i=`error`,onClose:a}){let{t:o}=U(),s=r??o(`common.close`);return(0,f.useEffect)(()=>{let e=e=>{e.key===`Escape`&&a()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[a]),(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center p-4 z-[120]`,onClick:a,children:(0,G.jsx)(Pd,{className:`w-full max-w-md`,onClick:e=>e.stopPropagation(),children:(0,G.jsxs)(Id,{className:`p-6`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,G.jsx)(`div`,{className:`p-2 rounded-full bg-bambu-dark ${i===`warning`?`text-yellow-600 dark:text-yellow-400`:`text-red-600 dark:text-red-400`}`,children:(0,G.jsx)(Mu,{className:`w-6 h-6`})}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-1`,children:e}),n&&(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mb-2 truncate`,children:n}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-sm whitespace-pre-line break-words`,children:t})]})]}),(0,G.jsx)(`div`,{className:`flex mt-6`,children:(0,G.jsx)(Q,{onClick:a,className:`flex-1`,children:s})})]})})})}var bW=(0,f.createContext)(null),qAe=1500,JAe=1e3,xW=e=>`slice-job-${e}`;function SW(e){try{return decodeURIComponent(e)}catch{return e}}function YAe(e){let t=Math.max(0,Math.floor(e));if(t<60)return`${t}s`;let n=Math.floor(t/60),r=t%60;return n<60?`${n}m ${r}s`:`${Math.floor(n/60)}h ${n%60}m`}function XAe({children:e}){let{t}=U(),{showToast:n,showPersistentToast:r,dismissToast:i}=Hd(),a=no(),[o,s]=(0,f.useState)([]),[c,l]=(0,f.useState)(null),u=(0,f.useRef)([]);u.current=o;let d=(0,f.useRef)(new Map),p=(0,f.useRef)(new Map),m=(0,f.useRef)(new Map),h=(0,f.useRef)(new Set),g=(0,f.useCallback)(e=>{let n=d.current.get(e.id);if(n==null)return;let i=(Date.now()-n)/1e3,a=p.current.get(e.id)??`pending`,o=YAe(i),s=m.current.get(e.id)??null,c=s&&s.stage&&s.total_percent>0;if(a===`running`&&c){let n=SW(e.sourceName),i=s.stage,a=Math.min(100,Math.max(0,Math.round(s.total_percent))),c=typeof s.multi_plate_index==`number`&&typeof s.multi_plate_count==`number`&&s.multi_plate_count>1?t(`slice.runningWithProgressMultiPlate`,`Plate {{plateIndex}} of {{plateCount}} • {{name}} — {{stage}} ({{percent}}%) — {{elapsed}}`,{plateIndex:s.multi_plate_index,plateCount:s.multi_plate_count,name:n,stage:i,percent:a,elapsed:o}):t(`slice.runningWithProgress`,`{{name}} — {{stage}} ({{percent}}%) — {{elapsed}}`,{name:n,stage:i,percent:a,elapsed:o});r(xW(e.id),c,`loading`);return}let l=a===`pending`?`slice.queuedToast`:`slice.runningToast`,u=a===`pending`?`Queued: {{name}} — {{elapsed}}`:`Slicing {{name}} — {{elapsed}}`;r(xW(e.id),t(l,u,{name:SW(e.sourceName),elapsed:o}),`loading`)},[r,t]),_=(0,f.useCallback)((e,t,n)=>{s(r=>r.some(t=>t.id===e)?r:[...r,{id:e,kind:t,sourceName:n}]),h.current.delete(e),d.current.set(e,Date.now()),p.current.set(e,`pending`),m.current.set(e,null),g({id:e,kind:t,sourceName:n})},[g]),v=(0,f.useCallback)((e,r)=>{h.current.has(e.id)||(h.current.add(e.id),s(t=>t.filter(t=>t.id!==e.id)),d.current.delete(e.id),p.current.delete(e.id),m.current.delete(e.id),i(xW(e.id)),r.status===`completed`?(n(t(`slice.completedToast`,`Sliced {{name}}`,{name:SW(e.sourceName)}),`success`),r.result&&`external_write_fallback`in r.result&&r.result.external_write_fallback&&n(t(`slice.externalWriteFallbackToast`,`Saved to the internal library: the external folder could not be written to`),`warning`)):r.status===`failed`&&l({name:SW(e.sourceName),detail:r.error_detail||t(`slice.failed`)}),a.invalidateQueries({queryKey:[`library-files`]}),a.invalidateQueries({queryKey:[`archives`]}))},[i,a,n,t]);return(0,f.useEffect)(()=>{if(o.length===0)return;let e=!1,t=!1,n=setInterval(async()=>{if(!(e||t)){t=!0;try{let t=[...u.current];for(let n of t)try{let t=await Z.getSliceJob(n.id);if(e)return;p.current.set(n.id,t.status),t.progress&&m.current.set(n.id,t.progress),(t.status===`completed`||t.status===`failed`)&&v(n,t)}catch{}}finally{t=!1}}},qAe);return()=>{e=!0,clearInterval(n)}},[o.length,v]),(0,f.useEffect)(()=>{if(o.length===0)return;let e=setInterval(()=>{for(let e of u.current)g(e)},JAe);return()=>clearInterval(e)},[o.length,g]),(0,G.jsxs)(bW.Provider,{value:{trackJob:_,activeJobs:o},children:[e,c&&(0,G.jsx)(KAe,{title:t(`slice.failedTitle`),subtitle:c.name,message:c.detail,onClose:()=>l(null)})]})}function CW(){let e=(0,f.useContext)(bW);if(!e)throw Error(`useSliceJobTracker must be used inside SliceJobTrackerProvider`);return e}var wW=1024;function ZAe(){let[e,t]=(0,f.useState)(()=>typeof window<`u`?window.innerWidth>=wW:!1);return(0,f.useEffect)(()=>{let e=window.matchMedia(`(min-width: ${wW}px)`),n=e=>{t(e.matches)};return t(e.matches),e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function TW({plates:e,onSelect:t,onClose:n}){let{t:r}=U();return(0,G.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4`,onClick:n,children:(0,G.jsxs)(`div`,{className:`w-full max-w-3xl max-h-[85vh] flex flex-col rounded-lg bg-bambu-dark-secondary border border-bambu-dark-tertiary/60`,onClick:e=>e.stopPropagation(),children:[(0,G.jsxs)(`div`,{className:`flex-shrink-0 flex items-start justify-between gap-3 px-4 pt-4 pb-3 border-b border-bambu-dark-tertiary/40`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`h3`,{className:`text-white font-medium`,children:r(`archives.platePicker.title`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1`,children:r(`archives.platePicker.hint`)})]}),(0,G.jsx)(`button`,{onClick:n,className:`flex-shrink-0 text-bambu-gray hover:text-white transition-colors`,"aria-label":r(`common.close`,`Close`),children:(0,G.jsx)(Zu,{className:`w-5 h-5`})})]}),(0,G.jsx)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:(0,G.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-2`,children:e.map(e=>(0,G.jsxs)(`button`,{type:`button`,onClick:()=>t(e.index),className:`flex items-center gap-2 p-2 rounded-lg border border-bambu-dark-tertiary bg-bambu-dark hover:border-bambu-gray transition-colors text-left`,children:[e.has_thumbnail&&e.thumbnail_url!=null?(0,G.jsx)(`img`,{src:pd(e.thumbnail_url),alt:`Plate ${e.index}`,className:`w-12 h-12 rounded object-cover bg-bambu-dark-tertiary flex-shrink-0`}):(0,G.jsx)(`div`,{className:`w-12 h-12 rounded bg-bambu-dark-tertiary flex items-center justify-center flex-shrink-0`,children:(0,G.jsx)(Hc,{className:`w-5 h-5 text-bambu-gray`})}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`p`,{className:`text-sm text-white font-medium truncate`,children:e.name?`${r(`archives.platePicker.plateLabel`,{index:e.index})} — ${e.name}`:r(`archives.platePicker.plateLabel`,{index:e.index})}),(0,G.jsxs)(`p`,{className:`text-xs text-bambu-gray truncate`,children:[e.objects.length>0?e.objects.slice(0,3).join(`, `)+(e.objects.length>3?`…`:``):e.object_count!=null&&e.object_count>0?r(`archives.platePicker.objectCount`,{count:e.object_count}):`${e.filaments.length} filament${e.filaments.length===1?``:`s`}`,e.print_time_seconds==null?``:` • ${ep(e.print_time_seconds)}`]})]})]},e.index))})})]})})}var EW=e=>typeof e==`object`&&!!e&&`enumKey`in e,DW=`enum:`;function OW(e){if(typeof e==`number`)return e;if(typeof e==`boolean`)return+!!e;if(typeof e!=`string`)return;let t=Number.parseFloat(e);return Number.isFinite(t)?t:void 0}function kW(e){if(typeof e==`boolean`)return e;if(typeof e==`number`)return e!==0;if(e===`1`||e===`true`)return!0;if(e===`0`||e===`false`)return!1}function QAe(e,t){return{get:n=>{let r=e[n];if((r===void 0||r===``)&&(r=t[n]?.default),Array.isArray(r)&&(r=r[0]),typeof r==`boolean`||typeof r==`number`||typeof r==`string`)return r},has:e=>e in t}}var $Ae=[`->`,`||`,`&&`,`==`,`!=`,`<=`,`>=`,`(`,`)`,`,`,`<`,`>`,`!`];function eje(e){let t=[],n=0;for(;ne.startsWith(t,n));if(a){t.push({kind:`op`,value:a}),n+=a.length;continue}let o=/^[A-Za-z_][A-Za-z0-9_]*(::[A-Za-z_][A-Za-z0-9_]*)*/.exec(e.slice(n));if(o){t.push({kind:`id`,value:o[0]}),n+=o[0].length;continue}return}return t}var tje=new Set([`opt_bool`,`opt_int`,`opt_float`,`opt_float_nullable`,`opt_int_nullable`,`opt_bool_nullable`,`opt_enum`,`opt_string`,`option`,`has`]),nje=class e{tokens=[];pos=0;cfg;locals;schema;resolving;memo;constructor(e,t,n,r,i){this.cfg=e,this.locals=t,this.schema=n,this.resolving=r,this.memo=i}evaluate(e){let t=eje(e);if(!t||t.length===0)return;this.tokens=t,this.pos=0;let n=this.parseOr();if(this.pos===this.tokens.length)return n}peek(){return this.tokens[this.pos]}eatOp(e){let t=this.peek();return t&&t.kind===`op`&&t.value===e?(this.pos+=1,!0):!1}parseOr(){let e=this.parseAnd();for(;this.eatOp(`||`);){let t=this.parseAnd(),n=kW(e),r=kW(t);e=n===!0||r===!0?!0:n===void 0||r===void 0?void 0:n||r}return e}parseAnd(){let e=this.parseComparison();for(;this.eatOp(`&&`);){let t=this.parseComparison(),n=kW(e),r=kW(t);e=n===!1||r===!1?!1:n===void 0||r===void 0?void 0:n&&r}return e}parseComparison(){let e=this.parseUnary();for(let t of[`==`,`!=`,`<=`,`>=`,`<`,`>`])if(this.eatOp(t))return rje(e,this.parseUnary(),t,this.schema);return e}parseUnary(){if(this.eatOp(`!`)){let e=kW(this.parseUnary());return e===void 0?void 0:!e}return this.parsePrimary()}parsePrimary(){let e=this.peek();if(!e)return;if(e.kind===`num`||e.kind===`str`)return this.pos+=1,e.value;if(e.kind===`op`&&e.value===`(`){this.pos+=1;let e=this.parseOr();return this.eatOp(`)`)?e:void 0}if(e.kind!==`id`)return;if(this.pos+=1,e.value===`true`)return!0;if(e.value===`false`)return!1;if(e.value===`config`)return this.parseConfigAccess();let t=this.locals[e.value];return t===void 0?`${DW}${e.value}`:this.resolveLocal(e.value,t)}parseConfigAccess(){if(!this.eatOp(`->`))return;let e=this.peek();if(!e||e.kind!==`id`||!tje.has(e.value))return;if(this.pos+=1,this.eatOp(`<`)){let e=1;for(;e>0;){let t=this.peek();if(!t)return;this.pos+=1,t.kind===`op`&&t.value===`<`&&(e+=1),t.kind===`op`&&t.value===`>`&&--e}}if(!this.eatOp(`(`))return;let t=this.peek();if(!t||t.kind!==`str`)return;this.pos+=1;let n=t.value;for(;this.eatOp(`,`);){let e=0;for(;;){let t=this.peek();if(!t)return;if(t.kind===`op`&&t.value===`(`&&(e+=1),t.kind===`op`&&t.value===`)`){if(e===0)break;--e}if(t.kind===`op`&&t.value===`,`&&e===0)break;this.pos+=1}}if(!this.eatOp(`)`))return;if(this.eatOp(`->`)){let e=this.peek();if(!e||e.kind!==`id`)return;this.pos+=1}if(e.value===`has`)return this.cfg.has(n);let r=this.cfg.get(n);return this.schema[n]?.enum_values?{enumKey:n,value:typeof r==`string`?r:void 0}:r}resolveLocal(t,n){let r=this.memo.get(t);if(r!==void 0||this.memo.has(t))return r;if(this.resolving.has(t))return;this.resolving.add(t);let i=new e(this.cfg,this.locals,this.schema,this.resolving,this.memo).evaluate(n);return this.resolving.delete(t),this.memo.set(t,i),i}};function rje(e,t,n,r){let i=typeof e==`string`&&e.startsWith(DW)?e:typeof t==`string`&&t.startsWith(DW)?t:void 0;if(i!==void 0){if(n!==`==`&&n!==`!=`)return;let a=i===e?t:e;if(!EW(a))return;let o=r[a.enumKey]?.enum_values;if(!o||a.value===void 0)return;let s=ije(i.slice(5)).filter(e=>o.includes(e));if(s.length!==1)return;let c=s[0]===a.value;return n===`==`?c:!c}let a=EW(e)?e.value:e,o=EW(t)?t.value:t;if(n===`==`||n===`!=`){if(a===void 0||o===void 0)return;let e=typeof a==`string`||typeof o==`string`?String(a)===String(o):OW(a)===OW(o);return n===`==`?e:!e}let s=OW(a),c=OW(o);if(!(s===void 0||c===void 0)){if(n===`<`)return s`)return s>c;if(n===`>=`)return s>=c}}function ije(e){let t=e.includes(`::`)?e.slice(e.lastIndexOf(`::`)+2):e,n=[t,/^[a-z]+([A-Z].*)$/.exec(t)?.[1]].filter(e=>!!e),r=new Set;for(let e of n){let t=e.replace(/([a-z0-9])([A-Z])/g,`$1_$2`).toLowerCase();r.add(t),r.add(t.replace(/_/g,` `)),r.add(t.replace(/_/g,``))}return[...r]}function aje(e,t,n){let r=QAe(e,t),i=new Map,a=new Set;for(let e of n.rules){let o=oje(e.enable_if);if(o&&kW(new nje(r,n.locals,t,new Set,i).evaluate(o))===!1)for(let t of e.fields)a.add(t)}return a}function oje(e){let t=0;for(let n=0;nsje.has(e.type);function AW(e){if(typeof e==`number`)return Number.isFinite(e)?e:void 0;if(typeof e!=`string`)return;let t=Number.parseFloat(e);return Number.isFinite(t)?t:void 0}function lje(e){let t=e.sidetext;if(!(!t||t.includes(`->`)||t.includes(`::`)))return t}function jW(e,t){let n=t===void 0?e.default:t;return n===void 0?``:Array.isArray(n)?n.map(String).join(`, `):typeof n==`boolean`?n?`1`:`0`:String(n)}function MW(e,t){if(cje(e))return(Array.isArray(t)?t.map(String):String(t).split(`,`)).map(e=>e.trim()).filter(e=>e!==``);if(e.type===`coBool`)return typeof t==`boolean`?t?`1`:`0`:t===`1`||t===`true`||t===1?`1`:`0`;let n=String(t).trim();return e.type===`coPercent`?n.endsWith(`%`)?n:`${n}%`:n}function uje(e,t){let n={};for(let[r,i]of Object.entries(e)){let e=t[r];e&&(n[r]=MW(e,i))}return n}function NW(e,t,n){if(t===void 0||t===``)return!1;let r=t=>{let n=MW(e,Array.isArray(t)?t.map(String).join(`, `):t);return Array.isArray(n)?n.join(`, `):n},i=r(t),a=n===void 0?e.default:n;return a===void 0?i!==``:i!==r(a)}var dje=new Set([`support_filament`,`support_interface_filament`,`outer_wall_filament_id`,`inner_wall_filament_id`,`top_surface_filament_id`,`bottom_surface_filament_id`,`internal_solid_filament_id`,`sparse_infill_filament_id`]),fje=[`simple`,`advanced`,`expert`],PW={simple:0,advanced:1,expert:2,develop:3};function pje({values:e,onChange:t,disabled:n=!1,sourceOverrides:r=[],sourceSelected:i,onToggleSource:a,filamentChoices:o,presetValues:s,presetValuesResolved:c=!0,presetValuesReason:l}){let{t:u}=U(),[d,p]=(0,f.useState)(null),[m,h]=(0,f.useState)(`simple`),[g,_]=(0,f.useState)(null),[v,y]=(0,f.useState)(``);(0,f.useEffect)(()=>{let e=!1;return Promise.all([Dt(()=>import(`./process-schema-CzfeynAH.js`),[]),Dt(()=>import(`./process-ui-tree-BWrKRLV6.js`),[]),Dt(()=>import(`./process-toggle-rules-DDBax3G5.js`),[])]).then(([t,n,r])=>{e||p({schema:t.default??t,tree:n.default??n,toggles:r.default??r})}),()=>{e=!0}},[]);let b=(0,f.useMemo)(()=>{let t={...s??{}};for(let e of r)i?.has(e.key)&&(t[e.key]=e.value);for(let[n,r]of Object.entries(e))r!==void 0&&r!==``&&(t[n]=r);return t},[s,r,i,e]),x=(0,f.useMemo)(()=>d?aje(b,d.schema,d.toggles):new Set,[d,b]),S=(0,f.useMemo)(()=>new Map(r.map(e=>[e.key,e])),[r]),C=(0,f.useMemo)(()=>r.filter(e=>!e.printer_coupled&&!e.preset_defining),[r]),w=(0,f.useMemo)(()=>r.filter(e=>i?.has(e.key)).length,[r,i]),T=(0,f.useMemo)(()=>d?r.filter(e=>!d.schema[e.key]):[],[d,r]),E=e=>{if(!d)return;let n={};for(let[t,r]of Object.entries(e))d.schema[t]&&NW(d.schema[t],r,s?.[t])&&(n[t]=r);t(e,uje(n,d.schema))},D=(t,n)=>{let r={...e};n===void 0?delete r[t]:r[t]=n,E(r)},O=(0,f.useMemo)(()=>{if(!d)return[];let e=e=>e.toLowerCase().replace(/[_\s]+/g,` `).trim(),t=e(v),n=e=>PW[d.schema[e]?.mode??`expert`]<=PW[m],r=(n,r,i)=>{if(!t)return!0;let a=d.schema[n];return[n,a?.label??``,a?.tooltip??``,r,i].some(n=>e(n).includes(t))};return d.tree.map(e=>({...e,groups:e.groups.map(t=>({...t,options:t.options.filter(i=>n(i)&&r(i,t.group,e.page))})).filter(e=>e.options.length>0)})).filter(e=>e.groups.length>0)},[d,m,v]),k=(0,f.useMemo)(()=>O.length===0||v.trim()?null:O.find(e=>e.page===g)??O[0],[O,g,v]),A=(0,f.useMemo)(()=>d?Object.keys(e).filter(t=>d.schema[t]&&NW(d.schema[t],e[t],s?.[t])).length:0,[d,e,s]);if(!d)return(0,G.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-8 text-sm text-bambu-gray`,children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),u(`slicerSettings.loading`,`Loading slicer settings...`)]});let j=k?[k]:O;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`flex overflow-hidden rounded border border-bambu-dark-tertiary`,children:fje.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>h(e),disabled:n,className:`px-2.5 py-1 text-xs capitalize transition-colors ${m===e?`bg-bambu-green text-white`:`text-bambu-gray hover:text-white`}`,children:u(`slicerSettings.mode.${e}`,e)},e))}),(0,G.jsxs)(`div`,{className:`relative flex-1 min-w-[10rem]`,children:[(0,G.jsx)(Gl,{className:`absolute left-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-bambu-gray`}),(0,G.jsx)(`input`,{type:`search`,value:v,onChange:e=>y(e.target.value),disabled:n,placeholder:u(`slicerSettings.searchPlaceholder`,`Search settings`),className:`w-full rounded border border-bambu-dark-tertiary bg-bambu-dark pl-7 pr-2 py-1 text-xs text-white placeholder:text-bambu-gray/60 focus:border-bambu-green focus:outline-none disabled:opacity-40`})]}),A>0&&(0,G.jsxs)(`button`,{type:`button`,onClick:()=>E({}),disabled:n,className:`flex items-center gap-1 text-xs text-bambu-gray hover:text-white`,children:[(0,G.jsx)(Ll,{className:`w-3 h-3`}),u(`slicerSettings.resetAll`,`Reset {{count}}`,{count:A})]})]}),!c&&(0,G.jsx)(`p`,{className:`rounded border border-amber-300 bg-amber-50 px-2 py-1 text-[0.7rem] text-amber-800 dark:border-amber-700/40 dark:bg-amber-900/20 dark:text-amber-200`,children:l===`sidecar_outdated`?u(`slicerSettings.presetValuesOutdatedSidecar`,`Showing slicer defaults: your slicer sidecar is older than this feature and can't report a preset's values. Update the sidecar image to see them. Anything you don't change still uses the preset.`):l===`not_configured`?u(`slicerSettings.presetValuesNotConfigured`,`Showing slicer defaults: no slicer sidecar is configured, so a preset's values can't be read. Anything you don't change still uses the preset.`):l===`sidecar_unavailable`?u(`slicerSettings.presetValuesSidecarUnavailable`,`Showing slicer defaults: the slicer sidecar did not answer, so a preset's values can't be read. Anything you don't change still uses the preset.`):u(`slicerSettings.presetValuesUnavailable`,`Showing slicer defaults: the picked preset's own values could not be read. Anything you don't change still uses the preset.`)}),r.length>0&&a&&(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 rounded border border-bambu-dark-tertiary px-2 py-1.5 text-[0.7rem] text-bambu-gray`,children:[(0,G.jsx)(`span`,{className:`min-w-0 flex-1`,children:u(`slicerSettings.fromFileSummary`,`The designer changed {{count}} process settings in this file. Only the ones you tick are used.`,{count:r.length})}),(0,G.jsx)(`button`,{type:`button`,disabled:n,onClick:()=>C.forEach(e=>a(e.key,!0)),title:u(`slicerSettings.fromFileUseAllHint`,`Ticks the settings that carry across printers. The ones tuned for the designer's own printer, and the ones that define the preset you picked, stay off.`),className:`shrink-0 rounded border border-bambu-dark-tertiary px-1.5 py-0.5 hover:text-white disabled:opacity-40`,children:u(`slicerSettings.fromFileUseAll`,`Use the designer's settings`)}),w>0&&(0,G.jsx)(`button`,{type:`button`,disabled:n,onClick:()=>r.forEach(e=>a(e.key,!1)),className:`shrink-0 rounded border border-bambu-dark-tertiary px-1.5 py-0.5 hover:text-white disabled:opacity-40`,children:u(`slicerSettings.fromFileClear`,`Clear {{count}}`,{count:w})})]}),!v.trim()&&(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:O.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>_(e.page),disabled:n,className:`px-2 py-1 text-xs rounded transition-colors ${k?.page===e.page?`bg-bambu-dark-tertiary text-white`:`text-bambu-gray hover:text-white`}`,children:e.page},e.page))}),j.length===0?(0,G.jsx)(`p`,{className:`py-6 text-center text-xs text-bambu-gray`,children:u(`slicerSettings.noMatches`,`No settings match this search.`)}):(0,G.jsxs)(`div`,{className:`flex flex-col gap-4 max-h-[22rem] lg:max-h-[58vh] overflow-y-auto pr-1`,children:[j.map(t=>(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[v.trim()&&(0,G.jsx)(`p`,{className:`text-[0.7rem] uppercase tracking-wide text-bambu-gray/70`,children:t.page}),t.groups.map(r=>(0,G.jsxs)(`fieldset`,{className:`flex flex-col gap-1.5`,children:[(0,G.jsx)(`legend`,{className:`mb-1 text-xs font-medium text-white`,children:r.group}),r.options.map(t=>(0,G.jsx)(mje,{optionKey:t,option:d.schema[t],value:e[t],onChange:e=>D(t,e),disabled:n||x.has(t),disabledBySlicer:x.has(t),formDisabled:n,source:S.get(t),sourceOn:i?.has(t)??!1,onToggleSource:a,filamentChoices:dje.has(t)?o:void 0,presetValue:s?.[t]},t))]},`${t.page}:${r.group}`))]},t.page)),T.length>0&&!v.trim()&&(0,G.jsxs)(`fieldset`,{className:`flex flex-col gap-1.5`,children:[(0,G.jsx)(`legend`,{className:`mb-1 text-xs font-medium text-white`,children:u(`slicerSettings.otherFromFile`,`Other settings from this file`)}),T.map(e=>(0,G.jsxs)(`label`,{className:`flex items-center gap-2 text-xs cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:i?.has(e.key)??!1,disabled:n||!a,onChange:t=>a?.(e.key,t.target.checked),className:`shrink-0 cursor-pointer disabled:opacity-40`}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[(0,G.jsx)(`span`,{className:`font-mono text-bambu-gray`,children:e.key}),(0,G.jsx)(`span`,{className:`ml-1.5 text-white`,children:FW(e.value)})]}),(e.printer_coupled||e.preset_defining)&&(0,G.jsx)(`span`,{className:`shrink-0 rounded bg-amber-100 px-1 py-0.5 text-[10px] text-amber-700 dark:bg-amber-500/20 dark:text-amber-400`,children:e.printer_coupled?u(`slicerSettings.fromFilePrinterCoupled`,`designer's printer`):u(`slicerSettings.fromFileOverridesPreset`,`overrides preset`)})]},e.key))]})]})]})}function mje({optionKey:e,option:t,value:n,onChange:r,disabled:i,disabledBySlicer:a,formDisabled:o,source:s,sourceOn:c=!1,onToggleSource:l,filamentChoices:u,presetValue:d}){let{t:f}=U(),p=NW(t,n,d),m=lje(t),h=n===void 0?c&&s?FW(s.value):jW(t,d):String(n);return(0,G.jsxs)(`div`,{className:`flex items-center gap-2 group`,title:t.tooltip,children:[(0,G.jsxs)(`label`,{htmlFor:`slicer-opt-${e}`,className:`flex min-w-0 flex-1 items-center gap-1 text-xs ${a?`text-bambu-gray/40`:`text-bambu-gray`}`,children:[(0,G.jsx)(`span`,{className:`truncate`,title:t.label||e,children:t.label||e}),p&&(0,G.jsx)(`span`,{className:`shrink-0 text-bambu-green`,"aria-hidden":`true`,children:`•`}),s&&(0,G.jsx)(`span`,{className:`shrink-0 rounded px-1 py-0.5 text-[10px] ${s.printer_coupled||s.preset_defining?`bg-amber-100 text-amber-700 dark:bg-amber-500/20 dark:text-amber-400`:`bg-bambu-green/15 text-bambu-green`}`,title:s.printer_coupled?f(`slicerSettings.fromFilePrinterCoupledHint`,`Tuned for the printer this file was designed for -- may be wrong or out of range on yours.`):s.preset_defining?f(`slicerSettings.fromFileOverridesPresetHint`,`The file sets this to {{value}} where the preset you picked uses {{preset}}. Tick it only if the file should win.`,{value:FW(s.value),preset:jW(t,d)}):f(`slicerSettings.fromFileHint`,`The designer changed this in the source file. Its value is {{value}}.`,{value:FW(s.value)}),children:s.printer_coupled?f(`slicerSettings.fromFilePrinterCoupled`,`designer's printer`):s.preset_defining?f(`slicerSettings.fromFileOverridesPreset`,`overrides preset`):f(`slicerSettings.fromFile`,`from file`)})]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`flex w-3 shrink-0 justify-center`,children:s&&l&&(0,G.jsx)(`input`,{type:`checkbox`,checked:c,disabled:o,onChange:t=>l(e,t.target.checked),"aria-label":f(`slicerSettings.useFromFile`,`Use the source file's value for {{option}}`,{option:t.label||e}),title:f(`slicerSettings.useFromFile`,`Use the source file's value for {{option}}`,{option:t.label||e}),className:`w-3 h-3 cursor-pointer disabled:opacity-40`})}),(0,G.jsx)(`div`,{className:`w-40`,children:(0,G.jsx)(hje,{id:`slicer-opt-${e}`,option:t,current:h,onChange:r,disabled:i,filamentChoices:u})}),(0,G.jsx)(`span`,{className:`w-16 shrink-0 whitespace-nowrap text-[0.65rem] text-bambu-gray/60`,children:m??``}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>r(void 0),disabled:i||!p,"aria-label":f(`slicerSettings.resetOption`,`Reset to default`),className:`p-0.5 transition-opacity ${p?`text-bambu-gray hover:text-white`:`opacity-0 pointer-events-none`}`,children:(0,G.jsx)(Ll,{className:`w-3 h-3`})})]})]})}function FW(e){return Array.isArray(e)?e.map(e=>String(e)).join(`, `):e==null?``:String(e)}function hje({id:e,option:t,current:n,onChange:r,disabled:i,filamentChoices:a}){let{t:o}=U(),s=`w-full rounded border border-bambu-dark-tertiary bg-bambu-dark px-1.5 py-0.5 text-xs text-white focus:border-bambu-green focus:outline-none disabled:opacity-40`;if(a&&a.length>0){let t=a.find(e=>String(e.index)===n);return(0,G.jsxs)(`div`,{className:`relative w-full`,children:[(0,G.jsxs)(`select`,{id:e,value:n,onChange:e=>r(e.target.value),disabled:i,className:`${s} w-full cursor-pointer appearance-none pr-5`,title:t?.label,children:[(0,G.jsx)(`option`,{value:`0`,children:o(`slicerSettings.filamentDefault`,`Default`)}),a.map(e=>(0,G.jsxs)(`option`,{value:String(e.index),children:[e.index,`: `,e.label]},e.index))]}),(0,G.jsx)(ss,{className:`pointer-events-none absolute right-1.5 top-1/2 h-3 w-3 -translate-y-1/2 text-bambu-gray`})]})}return t.type===`coBool`?(0,G.jsx)(`input`,{id:e,type:`checkbox`,checked:n===`1`||n===`true`,onChange:e=>r(e.target.checked),disabled:i,className:`w-3.5 h-3.5 cursor-pointer disabled:opacity-40`}):t.type===`coEnum`&&t.enum_values?(0,G.jsxs)(`div`,{className:`relative w-full`,children:[(0,G.jsx)(`select`,{id:e,value:n,onChange:e=>r(e.target.value),disabled:i,className:`${s} w-full cursor-pointer appearance-none pr-5`,children:t.enum_values.map((e,n)=>(0,G.jsx)(`option`,{value:e,children:t.enum_labels?.[n]??e},e))}),(0,G.jsx)(ss,{className:`pointer-events-none absolute right-1.5 top-1/2 h-3 w-3 -translate-y-1/2 text-bambu-gray`})]}):t.type===`coInt`||t.type===`coFloat`||t.type===`coPercent`?(0,G.jsx)(`input`,{id:e,type:`number`,value:n.replace(`%`,``),min:AW(t.min),max:AW(t.max),step:t.type===`coInt`?1:`any`,onChange:e=>r(e.target.value),disabled:i,className:s}):(0,G.jsx)(`input`,{id:e,type:`text`,value:n,onChange:e=>r(e.target.value),disabled:i,className:s})}var IW=[`local`,`orca_cloud`,`cloud`,`standard`],gje={local:1.75,orca_cloud:1.5,cloud:1,standard:.5};function LW(e,t){for(let n of IW){let r=e[n][t];if(r.length>0)return{source:r[0].source,id:r[0].id}}return null}function RW(e,t,n){return t?e[t.source][n].find(e=>e.id===t.id)??null:null}function zW(e,t,n){if(!n)return null;for(let r of IW){let i=e[r][t].find(e=>e.name===n);if(i)return{source:i.source,id:i.id}}return null}function _je(e,t,n,r){let i=zW(e,`process`,r);if(i){let r=RW(e,i,`process`);if(r&&cU(r,`process`,t,n)!==`mismatch`)return i}for(let r of[`match`,`unknown`])for(let i of IW){let a=bje(e[i].process.filter(e=>cU(e,`process`,t,n)===r));if(a)return{source:a.source,id:a.id}}return LW(e,`process`)}var vje=.2,yje=/^\s*([\d.]+)\s*mm\b/i;function bje(e){let t=null,n=1/0,r=-1/0;for(let i of e){let e=yje.exec(i.name),a=e?Number.parseFloat(e[1]):NaN,o=Number.isFinite(a)&&a>0,s=o?Math.abs(a-vje):1/0;(t==null||sr)&&(t=i,n=s,r=o?a:-1/0)}return t}function BW(e,t){let n=t.trim().toUpperCase(),r=(e.filament_type??``).trim().toUpperCase();return!!n&&!!r&&n!==r}function xje(e,t,n,r){let i=t.type.trim().toUpperCase(),a=op(t.color),o=null,s=null,c=null;for(let l of IW)for(let u of e[l].filament){let e=0,d=(u.filament_type??``).trim().toUpperCase(),f=op(u.filament_colour??``);i&&d&&i===d&&(e+=10),a&&f&&(f===a?e+=5:hp(u.filament_colour??``,t.color)&&(e+=2)),e+=gje[l];let p={source:u.source,id:u.id};BW(u,i)?(c==null||e>c.score)&&(c={ref:p,score:e}):cU(u,`filament`,n,r)===`mismatch`?(s==null||e>s.score)&&(s={ref:p,score:e}):(o==null||e>o.score)&&(o={ref:p,score:e})}return o==null?s==null?c==null?LW(e,`filament`):c.ref:s.ref:o.ref}function VW(e){return e?`${e.source}:${e.id}`:``}function Sje(e){if(!e)return null;let t=e.indexOf(`:`);if(t<0)return null;let n=e.slice(0,t),r=e.slice(t+1);return n!==`orca_cloud`&&n!==`cloud`&&n!==`local`&&n!==`standard`?null:{source:n,id:r}}function Cje({requestId:e,sourceName:t}){let{t:n}=U(),{showPersistentToast:r,dismissToast:i}=Hd(),[a,o]=(0,f.useState)(0),[s,c]=(0,f.useState)(null),l=t;try{l=decodeURIComponent(t)}catch{}(0,f.useEffect)(()=>{let e=Date.now(),t=setInterval(()=>o(Math.floor((Date.now()-e)/1e3)),1e3);return()=>clearInterval(t)},[]),(0,f.useEffect)(()=>{let t=!1,n=setInterval(async()=>{if(t)return;let n=await Z.getPreviewSliceProgress(e);!t&&n&&c(n)},1e3);return()=>{t=!0,clearInterval(n)}},[e]);let u=`slice-preview-${e}`;(0,f.useEffect)(()=>{let e=s&&s.stage&&s.total_percent>0,t=wje(a);return e?r(u,n(`slice.previewWithProgress`,`Analyzing {{name}} — {{stage}} ({{percent}}%) — {{elapsed}}`,{name:l,stage:s.stage,percent:Math.min(100,Math.max(0,Math.round(s.total_percent))),elapsed:t}),`loading`):r(u,n(`slice.previewToast`,{name:l,elapsed:t}),`loading`),()=>{i(u)}},[a,s,l,r,i,n,u]);let d=s?.stage,p=s?.total_percent,m=d&&typeof p==`number`&&p>0?`${d} (${Math.min(100,Math.max(0,Math.round(p)))}%)`:n(`slice.analyzingPlateFilaments`);return(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 text-bambu-gray text-sm py-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),m,(0,G.jsxs)(`span`,{className:`text-xs tabular-nums`,children:[a,`s`]})]}),a>=5&&(0,G.jsx)(`div`,{className:`text-xs text-bambu-gray/70 pl-6`,children:n(`slice.analyzingPlateFilamentsHint`,`Running a preview slice to discover which AMS slots this plate uses. Cached after — re-opening is instant.`)})]})}function wje(e){let t=Math.max(0,Math.floor(e));if(t<60)return`${t}s`;let n=Math.floor(t/60),r=t%60;return n<60?`${n}m ${r}s`:`${Math.floor(n/60)}h ${n%60}m`}var Tje=`#00AE42`;function HW(e){let t=(e||``).trim();return/^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/.test(t)?t.slice(0,7).toUpperCase():Tje}function UW({source:e,onClose:t}){let{t:n}=U(),{trackJob:r}=CW(),i=no(),[a,o]=(0,f.useState)(null),[s,c]=(0,f.useState)(null),[l,u]=(0,f.useState)([]),d=(0,f.useRef)(new Set),[p,m]=(0,f.useState)([]),[h,g]=(0,f.useState)(null),[_,v]=(0,f.useState)(null),[y,b]=(0,f.useState)(!1),[x,S]=(0,f.useState)(null),[C,w]=(0,f.useState)(!1),[T,E]=(0,f.useState)(!1),[D,O]=(0,f.useState)(!1),[k,A]=(0,f.useState)(new Set),[j,M]=(0,f.useState)({}),[N,P]=(0,f.useState)({}),[F,I]=(0,f.useState)(!1),L=ZAe(),R=L||F,z=K({queryKey:[`slicer-pipelines`],queryFn:()=>Z.listSlicerPipelines(),staleTime:6e4}),[B,V]=(0,f.useState)(!1),[ee,te]=(0,f.useState)(``),{showToast:ne}=Hd(),re=q({mutationFn:e=>Z.createSlicerPipeline(e),onSuccess:()=>{i.invalidateQueries({queryKey:[`slicer-pipelines`]}),ne(n(`slice.pipelines.toast.saved`,`Pipeline saved`),`success`),V(!1),te(``)},onError:e=>{ne(e.message||n(`slice.pipelines.toast.saveFailed`,`Save failed`),`error`)}}),ie=K({queryKey:[`slicePlates`,e.kind,e.id],queryFn:async()=>e.kind===`libraryFile`?Z.getLibraryFilePlates(e.id):Z.getArchivePlates(e.id),staleTime:6e4}),ae=!!ie.data?.is_multi_plate&&(ie.data?.plates?.length??0)>1,oe=ae&&_==null,se=_??1,H=(0,f.useMemo)(()=>{let t=typeof crypto<`u`&&`randomUUID`in crypto?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`;return`${e.kind}-${e.id}-p${se}-${t}`},[e.kind,e.id,se]),ce=K({queryKey:[`sliceFilamentReqs`,e.kind,e.id,se],queryFn:async()=>e.kind===`libraryFile`?Z.getLibraryFileFilamentRequirements(e.id,se,H,!0):Z.getArchiveFilamentRequirements(e.id,se,H,!0),enabled:!oe,staleTime:6e4}),le=(0,f.useMemo)(()=>{let e=ce.data?.filaments??[],t=e.length>0?e:[{slot_id:1,type:``,color:``,used_grams:0,used_meters:0}];return y?t.map(e=>({...e,used_in_plate:!0})):t},[y,ce.data]),ue=K({queryKey:[`slicerPresets`],queryFn:()=>Z.getSlicerPresets(),staleTime:6e4,enabled:!ie.isLoading&&!oe}),[de,fe]=(0,f.useState)(!1),pe=async()=>{if(!de){fe(!0);try{let e=await Z.getSlicerPresets({refresh:!0});i.setQueryData([`slicerPresets`],e)}catch{i.invalidateQueries({queryKey:[`slicerPresets`]})}finally{fe(!1)}}},me=K({queryKey:[`slicerPrinterModels`],queryFn:Z.getSlicerPrinterModels,staleTime:1/0}),he=(0,f.useMemo)(()=>!ue.data||!a?null:RW(ue.data,a,`printer`)?.name??null,[ue.data,a]),ge=(0,f.useMemo)(()=>nU(me.data??{}),[me.data]),_e=K({queryKey:[`slicer-preset-values`,s?.source,s?.id],queryFn:()=>Z.getSlicerPresetValues(s),enabled:s!=null,staleTime:5*6e4}),ve=_e.data?.values,ye=_e.data?.resolved??_e.isLoading,be=_e.data?.reason??(_e.isError?`sidecar_unavailable`:void 0),xe=(0,f.useMemo)(()=>{let e=ue.data;return le.map((t,r)=>{let i=l[r]??null,a=e&&i?RW(e,i,`filament`):null;return{index:r+1,label:a?.name||t.type||n(`slice.filamentSlotUnset`,`not set`),color:t.color||void 0}})},[le,l,ue.data,n]),Se=ie.data?.embedded_printer??null,Ce=(0,f.useMemo)(()=>ie.data?.design_overrides??[],[ie.data]),we=ie.data?.embedded_process??null,Te=(0,f.useMemo)(()=>{if(!Se||!we||!he)return!1;let e=e=>e.replace(/^#\s*/,``).trim().toLowerCase();return e(he)===e(Se)},[Se,we,he]);(0,f.useEffect)(()=>{Te||w(!1)},[Te]),(0,f.useEffect)(()=>{A(C?new Set(Ce.map(e=>e.key)):new Set)},[Ce,C]),(0,f.useEffect)(()=>{let e=ue.data;e&&(a??o(zW(e,`printer`,Se)??LW(e,`printer`)))},[ue.data,Se]),(0,f.useEffect)(()=>{let e=ue.data;e&&c(t=>{if(t){let n=RW(e,t,`process`);if(n&&cU(n,`process`,he,ge)!==`mismatch`)return t}return _je(e,he,ge,we)})},[ue.data,he,ge,we]),(0,f.useEffect)(()=>{let e=ue.data;e&&u(t=>le.map((n,r)=>{let i=t[r]??null;if(i){let t=RW(e,i,`filament`),a=t&&!d.current.has(r)&&BW(t,n.type);if(t&&!a&&cU(t,`filament`,he,ge)!==`mismatch`)return i}return xje(e,{type:n.type,color:n.color},he,ge)}))},[ue.data,le,he,ge]),(0,f.useEffect)(()=>{m(e=>e.length===le.length?e:(d.current=new Set,le.map(()=>null)))},[le]);let Ee=q({mutationFn:async t=>{let n=De(t);return e.kind===`libraryFile`?Z.sliceLibraryFile(e.id,n):Z.sliceArchive(e.id,n)},onSuccess:n=>{r(n.job_id,e.kind,e.filename),t()},onError:e=>{g(e instanceof Error?e.message:String(e))}});function De(e){if(!a||!s||l.length===0||l.some(e=>e==null))throw Error(n(`slice.allPresetsRequired`));return{printer_preset:a,process_preset:s,filament_preset:l[0],filament_presets:l,filament_colours:le.map((e,t)=>p[t]??e.color??``),...e==null?{}:{plate:e},...x==null?{}:{bed_type:x},...C&&Te?{use_embedded_settings:!0}:{},...!C&&Ce.length>0?{design_overrides:[...k]}:{},...!C&&Object.keys(j).length>0?{process_overrides:N}:{},...T?{auto_orient:!0}:{},...D?{auto_arrange:!0}:{}}}let Oe=a!=null&&s!=null&&ce.isSuccess&&l.length>0&&l.every(e=>e!=null),ke=Ee.isPending,Ae=ie.data?.plates?.length??0,je=ae&&Ae>1&&!oe;return oe&&ie.data?(0,G.jsx)(TW,{plates:ie.data.plates,onSelect:e=>v(e),onClose:t}):(0,G.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4`,onClick:()=>{ke||t()},children:(0,G.jsxs)(`div`,{className:`w-full max-w-xl lg:max-w-5xl max-h-[85vh] flex flex-col rounded-lg bg-bambu-dark-secondary border border-bambu-dark-tertiary/60`,onClick:e=>e.stopPropagation(),children:[(0,G.jsxs)(`div`,{className:`flex-shrink-0 flex items-start justify-between gap-3 px-4 pt-4 pb-3 border-b border-bambu-dark-tertiary/40`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`h3`,{className:`text-white font-medium flex items-center gap-2`,children:[(0,G.jsx)(Ms,{className:`w-4 h-4`}),n(`slice.title`)]}),(0,G.jsxs)(`p`,{className:`text-xs text-bambu-gray mt-1 truncate`,title:e.filename,children:[e.filename,_==null?``:` • ${n(`archives.platePicker.plateLabel`,{index:_})}`]})]}),(0,G.jsx)(`button`,{onClick:t,disabled:ke,className:`flex-shrink-0 text-bambu-gray hover:text-white transition-colors disabled:opacity-50`,"aria-label":n(`common.close`),children:(0,G.jsx)(Zu,{className:`w-5 h-5`})})]}),(0,G.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4 space-y-4`,children:[(ie.isLoading||ue.isLoading)&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-bambu-gray text-sm`,children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),n(`slice.loadingPresets`)]}),ue.isError&&(0,G.jsx)(`div`,{className:`text-sm text-red-700 dark:text-red-400`,role:`alert`,children:n(`slice.presetsLoadFailed`,`Failed to load presets. Open Settings → Profiles to import them, or sign in to Bambu Cloud.`)}),ue.data&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,G.jsx)(WW,{status:ue.data.cloud_status,cloudName:`bambu`}),(0,G.jsx)(WW,{status:ue.data.orca_cloud_status,cloudName:`orca`})]}),(0,G.jsxs)(`button`,{type:`button`,onClick:pe,disabled:de||ke,className:`flex-shrink-0 inline-flex items-center gap-1 px-2 py-1 rounded-md text-xs text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary/40 disabled:opacity-50 disabled:cursor-not-allowed transition-colors`,title:n(`slice.refreshPresetsTitle`),"aria-label":n(`slice.refreshPresets`),children:[(0,G.jsx)(Fl,{className:`w-3.5 h-3.5 ${de?`animate-spin`:``}`}),n(`slice.refreshPresets`)]})]}),(0,G.jsxs)(`div`,{className:`lg:grid lg:grid-cols-[minmax(0,20rem)_minmax(0,1fr)] lg:gap-5 lg:items-start`,children:[(0,G.jsxs)(`div`,{className:`space-y-4 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-2 py-1.5 rounded-md bg-bambu-dark/40 border border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`span`,{className:`text-xs font-medium text-bambu-gray flex items-center gap-1`,children:[(0,G.jsx)(Ms,{className:`w-3.5 h-3.5`}),` `,n(`slice.pipelines.label`,`Pipeline`)]}),(0,G.jsxs)(`select`,{value:``,disabled:ke||(z.data?.pipelines.length??0)===0,onChange:e=>{let t=parseInt(e.target.value,10);if(Number.isNaN(t))return;let r=z.data?.pipelines.find(e=>e.id===t);r&&(o(r.printer_preset),c(r.process_preset),S(r.bed_type),u(e=>{let t=e.length>0?[...e]:r.filament_presets.map(()=>null);for(let e=0;e(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),B?(0,G.jsxs)(`div`,{className:`flex items-center gap-1 flex-1 min-w-[16ch]`,children:[(0,G.jsx)(`input`,{autoFocus:!0,value:ee,onChange:e=>te(e.target.value),placeholder:n(`slice.pipelines.namePlaceholder`,`Pipeline name`),"aria-label":n(`slice.pipelines.nameAria`,`New pipeline name`),className:`flex-1 text-xs px-2 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>{let e=ee.trim();if(!e||!a||!s)return;let t=l.filter(e=>e!==null);t.length!==0&&re.mutate({name:e,printer_preset:a,process_preset:s,filament_presets:t,bed_type:x})},disabled:re.isPending||!ee.trim(),className:`text-xs px-2 py-1 bg-bambu-green hover:bg-bambu-green/80 text-white rounded disabled:opacity-50`,children:re.isPending?(0,G.jsx)(Y,{className:`w-3 h-3 animate-spin`}):n(`common.save`,`Save`)}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>{V(!1),te(``)},className:`text-xs px-2 py-1 text-bambu-gray hover:text-white`,children:n(`common.cancel`,`Cancel`)})]}):(0,G.jsx)(`button`,{type:`button`,onClick:()=>{te(``),V(!0)},disabled:ke||!a||!s||l.length===0||l.some(e=>e===null),className:`text-xs px-2 py-1 bg-bambu-green/20 hover:bg-bambu-green/30 text-bambu-green border border-bambu-green/40 rounded disabled:opacity-50 disabled:cursor-not-allowed`,title:n(`slice.pipelines.saveTitle`,`Save the current four-slot selection as a reusable pipeline`),children:n(`slice.pipelines.saveButton`,`Save as pipeline`)})]}),(0,G.jsx)(GW,{label:n(`slice.printer`),slot:`printer`,data:ue.data,value:a,onChange:o,disabled:ke||C}),Te&&(0,G.jsxs)(`label`,{className:`flex items-start gap-2 text-sm text-bambu-gray cursor-pointer select-none`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:C,onChange:e=>w(e.target.checked),disabled:ke,className:`mt-0.5 cursor-pointer`}),(0,G.jsxs)(`span`,{children:[n(`slice.useEmbedded`),(0,G.jsx)(`span`,{className:`block text-xs text-bambu-gray/70`,children:n(`slice.useEmbeddedHint`)})]})]}),(0,G.jsx)(GW,{label:n(`slice.process`),slot:`process`,data:ue.data,value:s,onChange:c,disabled:ke||C,selectedPrinterName:he,compatIndex:ge}),(0,G.jsx)(Dje,{value:x,onChange:S,disabled:ke||C}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsxs)(`label`,{className:`flex items-start gap-2 text-sm text-bambu-gray cursor-pointer select-none`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:T,onChange:e=>E(e.target.checked),disabled:ke,className:`mt-0.5 cursor-pointer`}),(0,G.jsxs)(`span`,{children:[n(`slice.autoOrient`),(0,G.jsx)(`span`,{className:`block text-xs text-bambu-gray/70`,children:n(`slice.autoOrientHint`)})]})]}),(0,G.jsxs)(`label`,{className:`flex items-start gap-2 text-sm text-bambu-gray cursor-pointer select-none`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:D,onChange:e=>O(e.target.checked),disabled:ke,className:`mt-0.5 cursor-pointer`}),(0,G.jsxs)(`span`,{children:[n(`slice.autoArrange`),(0,G.jsx)(`span`,{className:`block text-xs text-bambu-gray/70`,children:n(`slice.autoArrangeHint`)})]})]})]}),ce.isLoading?(0,G.jsx)(Cje,{requestId:H,sourceName:e.filename}):le.map((e,t)=>{let r=e.used_in_plate!==!1,i=le.length>1?n(`slice.filamentSlot`,{index:t+1,type:e.type}):n(`slice.filament`);return(0,G.jsx)(GW,{label:r?i:`${i} ${n(`slice.notUsedByPlate`)}`,slot:`filament`,data:ue.data,value:l[t]??null,onChange:e=>{d.current.add(t),u(n=>{let r=n.length===le.length?[...n]:le.map((e,t)=>n[t]??null);return r[t]=e,r})},disabled:ke||!r||C,swatchColor:p[t]??e.color,swatchColorLabel:n(`slice.filamentColour`),onSwatchColorChange:e=>m(n=>{let r=n.length===le.length?[...n]:le.map((e,t)=>n[t]??null);return r[t]=e,r}),selectedPrinterName:he,compatIndex:ge},`filament-${t}`)})]}),(0,G.jsx)(`div`,{className:`mt-4 lg:mt-0 min-w-0`,children:(0,G.jsxs)(`div`,{className:`rounded border border-bambu-dark-tertiary p-3 ${C?`opacity-60`:``}`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>I(e=>!e),"aria-expanded":R,disabled:L,className:`flex w-full items-center justify-between gap-2 text-left lg:cursor-default`,children:[(0,G.jsxs)(`span`,{className:`text-sm text-white`,children:[n(`slice.processSettings`,`Process settings`),(0,G.jsx)(`span`,{className:`block text-xs text-bambu-gray/70`,children:C?n(`slice.processSettingsEmbedded`,`Not used while "Use the file's built-in settings" is on -- the file's own settings drive this slice.`):n(`slice.processSettingsHint`,`Adjust the picked preset for this slice. Anything you don't touch stays as the preset defines it.`)})]}),(0,G.jsx)(`span`,{className:`shrink-0 text-xs text-bambu-gray`,children:C?n(`slice.processSettingsInactive`,`Inactive`):Object.keys(N).length>0?n(`slice.processSettingsChanged`,`{{count}} changed`,{count:Object.keys(N).length}):n(`slice.processSettingsUnchanged`,`Preset defaults`)})]}),R&&(0,G.jsx)(`div`,{className:`mt-3 border-t border-bambu-dark-tertiary pt-3`,children:(0,G.jsx)(pje,{values:j,onChange:(e,t)=>{M(e),P(t)},disabled:ke||C,filamentChoices:xe,presetValues:ve,presetValuesResolved:ye,presetValuesReason:be,sourceOverrides:Ce,sourceSelected:k,onToggleSource:(e,t)=>A(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})})})]})})]})]}),h&&(0,G.jsx)(`div`,{className:`text-sm text-red-700 dark:text-red-400 bg-red-900/20 border border-red-900/40 rounded p-2`,role:`alert`,children:h})]}),(0,G.jsxs)(`div`,{className:`flex-shrink-0 flex justify-end gap-2 px-4 py-3 border-t border-bambu-dark-tertiary/40`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:t,disabled:ke,className:`px-3 py-1.5 text-sm rounded-md border border-bambu-dark-tertiary text-bambu-gray hover:text-white hover:border-bambu-gray transition-colors disabled:opacity-50`,children:n(`common.cancel`)}),je&&(0,G.jsxs)(`label`,{className:`flex items-center gap-2 mr-auto text-sm text-bambu-gray cursor-pointer select-none`,title:n(`slice.actionAllTitle`,{count:Ae}),children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:y,onChange:e=>b(e.target.checked),disabled:ke,className:`cursor-pointer`}),n(`slice.allPlatesToggle`,{count:Ae})]}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>{g(null);let e=y?0:_;Ee.mutate(e)},disabled:!Oe||ke,className:`px-3 py-1.5 text-sm rounded-md bg-bambu-green hover:bg-bambu-green/90 text-bambu-dark font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2`,children:ke?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),n(`slice.enqueuing`)]}):y?n(`slice.actionAll`,{count:Ae}):n(`slice.action`)})]})]})})}function WW({status:e,cloudName:t=`bambu`}){let{t:n}=U();if(e===`ok`||e===`not_authenticated`)return null;let r=t===`orca`?{expired:{key:`slice.orcaCloud.expired`,fallback:`Orca Cloud session expired — sign in again to refresh your Orca presets.`},unreachable:{key:`slice.orcaCloud.unreachable`,fallback:`Orca Cloud is unreachable right now. Other presets still work.`}}:{expired:{key:`slice.cloud.expired`,fallback:`Bambu Cloud session expired — sign in again to refresh your cloud presets.`},unreachable:{key:`slice.cloud.unreachable`,fallback:`Bambu Cloud is unreachable right now. Local and standard presets still work.`}},{tone:i,icon:a}={expired:{tone:`border-amber-300 dark:border-amber-700/40 bg-amber-50 dark:bg-amber-900/20 text-amber-800 dark:text-amber-200`,icon:Es},unreachable:{tone:`border-bambu-dark-tertiary/40 bg-bambu-dark text-bambu-gray`,icon:Es}}[e],{key:o,fallback:s}=r[e];return(0,G.jsxs)(`div`,{className:`flex items-start gap-2 text-xs rounded-md border p-2 ${i}`,role:`status`,children:[(0,G.jsx)(a,{className:`w-4 h-4 flex-shrink-0 mt-0.5`}),(0,G.jsx)(`span`,{children:n(o,s)})]})}var Eje=[{value:`Cool Plate`,labelKey:`slice.bedType.coolPlate`,fallback:`Cool Plate`},{value:`Cool Plate (SuperTack)`,labelKey:`slice.bedType.coolPlateSuperTack`,fallback:`Cool Plate SuperTack`},{value:`Engineering Plate`,labelKey:`slice.bedType.engineering`,fallback:`Engineering Plate`},{value:`High Temp Plate`,labelKey:`slice.bedType.highTemp`,fallback:`High Temp Plate`},{value:`Textured PEI Plate`,labelKey:`slice.bedType.texturedPEI`,fallback:`Textured PEI Plate`},{value:`Smooth PEI Plate`,labelKey:`slice.bedType.smoothPEI`,fallback:`Smooth PEI Plate`}];function Dje({value:e,onChange:t,disabled:n}){let{t:r}=U();return(0,G.jsxs)(`label`,{className:`block`,children:[(0,G.jsx)(`span`,{className:`block text-xs text-bambu-gray mb-1`,children:r(`slice.bedType.label`)}),(0,G.jsxs)(`select`,{value:e??``,onChange:e=>t(e.target.value===``?null:e.target.value),disabled:n,className:`flex-1 min-w-0 px-3 py-2 rounded-md bg-bambu-dark border border-bambu-dark-tertiary text-white text-sm focus:outline-none focus:border-bambu-gray disabled:opacity-50`,children:[(0,G.jsx)(`option`,{value:``,children:r(`slice.bedType.auto`)}),Eje.map(e=>(0,G.jsx)(`option`,{value:e.value,children:r(e.labelKey,e.fallback)},e.value))]})]})}function GW({label:e,slot:t,data:n,value:r,onChange:i,disabled:a,swatchColor:o,onSwatchColorChange:s,swatchColorLabel:c,selectedPrinterName:l,compatIndex:u}){let{t:d}=U(),[p,m]=(0,f.useState)(!1),h=(0,f.useId)(),g=`${h}-colour`,{sections:_,otherEntries:v}=(0,f.useMemo)(()=>{let e=[{key:`local`,label:`slice.tier.local`,fallback:`Imported`},{key:`orca_cloud`,label:`slice.tier.orcaCloud`,fallback:`Orca Cloud`},{key:`cloud`,label:`slice.tier.cloud`,fallback:`Bambu Cloud`},{key:`standard`,label:`slice.tier.standard`,fallback:`Standard`}],r=t!==`printer`,i=[],a=[],o=[];for(let{key:s,label:c,fallback:f}of e){let e=n[s][t];if(e.length>0&&a.push({tierLabel:d(c,f),entries:e}),!r){e.length>0&&i.push({tierLabel:d(c,f),entries:e});continue}let p=[];for(let n of e)cU(n,t,l??null,u??Uke)===`mismatch`?o.push(n):p.push(n);p.length>0&&i.push({tierLabel:d(c,f),entries:p})}return i.length===0&&o.length>0?{sections:a,otherEntries:[]}:{sections:i,otherEntries:o}},[n,t,d,l,u]),y=VW(r),b=(0,f.useMemo)(()=>p?v:v.filter(e=>`${e.source}:${e.id}`===y),[p,v,y]),x=v.length-b.length,S=_.reduce((e,t)=>e+t.entries.length,0)+b.length;return(0,G.jsxs)(`div`,{className:`block`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-bambu-gray mb-1`,children:[!s&&o&&(0,G.jsx)(`span`,{className:`inline-block w-3 h-3 rounded-full border border-bambu-dark-tertiary`,style:{backgroundColor:o},"aria-hidden":!0}),(0,G.jsx)(`label`,{htmlFor:h,children:e}),(x>0||p)&&(0,G.jsxs)(`span`,{className:`ml-auto flex items-center gap-1.5 font-normal`,children:[x>0&&(0,G.jsx)(`span`,{className:`text-bambu-gray/60`,children:d(`slice.presetsHidden`,`{{count}} hidden`,{count:x})}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>m(e=>!e),disabled:a,className:`text-bambu-green hover:underline disabled:opacity-50 disabled:no-underline`,children:p?d(`slice.showFewerPresets`,`Show fewer`):d(`slice.showAllPresets`,`Show all`)})]})]}),(0,G.jsxs)(`div`,{className:`flex items-stretch gap-2`,children:[(0,G.jsxs)(`select`,{id:h,value:VW(r),onChange:e=>i(Sje(e.target.value)),disabled:a||S===0,className:`w-full px-3 py-2 rounded-md bg-bambu-dark border border-bambu-dark-tertiary text-white text-sm focus:outline-none focus:border-bambu-gray disabled:opacity-50`,children:[(0,G.jsx)(`option`,{value:``,children:d(S===0?`slice.noPresetsForSlot`:`slice.selectPreset`)}),_.map(e=>(0,G.jsx)(`optgroup`,{label:e.tierLabel,children:e.entries.map(e=>(0,G.jsx)(`option`,{value:`${e.source}:${e.id}`,children:e.name},`${e.source}:${e.id}`))},e.tierLabel)),b.length>0&&(0,G.jsx)(`optgroup`,{label:d(`slice.otherPrinters`),children:b.map(e=>(0,G.jsx)(`option`,{value:`${e.source}:${e.id}`,children:e.name},`${e.source}:${e.id}`))})]}),s&&(0,G.jsxs)(`label`,{htmlFor:g,title:c,className:`flex items-center gap-2 px-2.5 rounded-md bg-bambu-dark border border-bambu-dark-tertiary text-sm ${a?`opacity-50 cursor-not-allowed`:`cursor-pointer hover:border-bambu-gray transition-colors`}`,children:[(0,G.jsx)(`input`,{id:g,type:`color`,value:HW(o),onChange:e=>s(e.target.value.toUpperCase()),disabled:a,"aria-label":c,style:{backgroundColor:HW(o)},className:`slice-colour-swatch w-4 h-4 shrink-0 rounded-full border border-bambu-dark-tertiary p-0 disabled:cursor-not-allowed enabled:cursor-pointer`}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-white tracking-tight`,children:HW(o)})]})]})]})}function KW({source:e,onClose:t}){let{t:n}=U(),r=no(),{showToast:i}=Hd(),[a,o]=(0,f.useState)(null),[s,c]=(0,f.useState)(null),[l,u]=(0,f.useState)(1),{trackJob:d}=CW(),{data:p,isLoading:m}=K({queryKey:[`slicer-pipelines`],queryFn:()=>Z.listSlicerPipelines()}),{data:h}=K({queryKey:[`printers`],queryFn:()=>Z.getPrinters()}),{data:g}=K({queryKey:[`app-settings`],queryFn:()=>Z.getSettings()}),_=g?.pipeline_max_copies??50,v={kind:e.kind,id:e.id},y=q({mutationFn:e=>Z.checkPipelineEligibility(e,v)}),b=q({mutationFn:({pipelineId:e,force:t})=>Z.runPipeline(e,v,t,l),onSuccess:a=>{r.invalidateQueries({queryKey:[`slicer-pipelines`]}),r.invalidateQueries({queryKey:[`pipeline-runs`]}),a.slice_job_id&&d(a.slice_job_id,e.kind,e.filename),i(n(`library.runWithPipeline.toast.started`,`Pipeline run started`),`success`),t()},onError:e=>{i(e.message||n(`library.runWithPipeline.toast.failed`,`Could not start run`),`error`)}}),x=p?.pipelines??[],S=(h??[]).reduce((e,t)=>(e[t.id]=t,e),{});return(0,G.jsx)(`div`,{className:`fixed inset-0 z-50 bg-black/60 flex items-center justify-center p-4`,onClick:t,role:`dialog`,"aria-modal":`true`,"aria-label":n(`library.runWithPipeline.modalTitle`,`Run with pipeline`),children:(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-2xl w-full max-w-md max-h-[80vh] flex flex-col overflow-hidden`,onClick:e=>e.stopPropagation(),children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`h3`,{className:`text-sm font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(El,{className:`w-4 h-4 text-bambu-green`}),a&&s?n(`library.runWithPipeline.confirmTitle`,`Confirm run`):n(`library.runWithPipeline.modalTitle`,`Run with pipeline`)]}),(0,G.jsx)(`button`,{type:`button`,onClick:t,"aria-label":n(`common.close`,`Close`),className:`text-bambu-gray hover:text-white`,children:(0,G.jsx)(Zu,{className:`w-4 h-4`})})]}),(0,G.jsx)(`div`,{className:`flex-1 overflow-y-auto p-4 space-y-3`,children:a&&s?(0,G.jsx)(kje,{pipeline:a,report:s,source:e,onBack:()=>{o(null),c(null)},onConfirm:()=>{a&&b.mutate({pipelineId:a.id,force:!0})},running:b.isPending}):(0,G.jsx)(Oje,{source:e,pipelines:x,printerById:S,loading:m||y.isPending,onPick:async e=>{if(!(e.target_printer_id||e.target_kind===`printer_class`&&e.target_model_class)){i(n(`library.runWithPipeline.noTargetMessage`,`This pipeline has no target printer set. Open it in Settings to pick one.`),`error`);return}o(e);try{let t=await y.mutateAsync(e.id);c(t),t.ok&&b.mutate({pipelineId:e.id,force:!1})}catch{o(null)}},copies:l,maxCopies:_,onCopiesChange:u})})]})})}function Oje({source:e,pipelines:t,printerById:n,loading:r,onPick:i,copies:a,maxCopies:o,onCopiesChange:s}){let{t:c}=U();return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`p`,{className:`text-xs text-bambu-gray`,children:[c(`library.runWithPipeline.sourceHint`,`Source`),`:`,` `,(0,G.jsx)(`span`,{className:`text-white`,children:e.filename})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`label`,{className:`text-xs text-bambu-gray`,htmlFor:`run-pipeline-copies`,children:[c(`library.runWithPipeline.copies`,`Copies`),`:`]}),(0,G.jsx)(`input`,{id:`run-pipeline-copies`,type:`number`,min:1,max:o,value:a,onChange:e=>{let t=parseInt(e.target.value,10);Number.isNaN(t)||s(Math.max(1,Math.min(o,t)))},"aria-label":c(`library.runWithPipeline.copies`,`Copies`),className:`w-20 px-2 py-1 text-xs bg-bambu-dark border border-bambu-dark-tertiary rounded text-white`}),(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray/60`,children:c(`library.runWithPipeline.copiesHint`,`max {{n}}`,{n:o})})]}),r&&(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`}),c(`library.runWithPipeline.loading`,`Loading…`)]}),!r&&t.length===0&&(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:c(`library.runWithPipeline.empty`,`No pipelines saved yet. Open the Slice dialog and click "Save as pipeline" to create one.`)}),!r&&t.length>0&&(0,G.jsx)(`ul`,{className:`space-y-1.5`,"aria-label":c(`library.runWithPipeline.pipelineListAria`,`Available pipelines`),children:t.map(e=>{let t=e.target_kind===`printer_class`,r=e.target_printer_id?n[e.target_printer_id]?.name:null,a=t&&e.target_model_class?c(`library.runWithPipeline.classTarget`,`Any {{model}}`,{model:e.target_model_class}):null;return(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>i(e),disabled:!(e.target_printer_id||t&&e.target_model_class),className:`w-full text-left px-3 py-2 rounded-md border border-bambu-dark-tertiary bg-bambu-dark/40 hover:bg-bambu-dark-tertiary disabled:opacity-50 disabled:cursor-not-allowed transition-colors`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Ms,{className:`w-3.5 h-3.5 text-bambu-green flex-shrink-0`}),(0,G.jsx)(`span`,{className:`text-sm font-medium text-white truncate`,children:e.name})]}),(0,G.jsxs)(`div`,{className:`mt-1 text-xs text-bambu-gray flex items-center gap-1`,children:[(0,G.jsx)(jl,{className:`w-3 h-3`}),a?(0,G.jsx)(`span`,{children:a}):r?(0,G.jsx)(`span`,{children:r}):(0,G.jsx)(`span`,{className:`text-amber-700 dark:text-amber-400`,children:c(`library.runWithPipeline.noTarget`,`No target printer set`)})]})]})},e.id)})})]})}function kje({pipeline:e,report:t,source:n,onBack:r,onConfirm:i,running:a}){let{t:o}=U();return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`text-xs text-bambu-gray`,children:[(0,G.jsxs)(`p`,{children:[o(`library.runWithPipeline.confirmIntro`,`Pre-flight found issues with this run`),`:`]}),(0,G.jsxs)(`p`,{className:`mt-1`,children:[(0,G.jsxs)(`span`,{className:`text-bambu-gray/70`,children:[o(`library.runWithPipeline.sourceHint`,`Source`),`: `]}),(0,G.jsx)(`span`,{className:`text-white`,children:n.filename})]}),(0,G.jsxs)(`p`,{children:[(0,G.jsxs)(`span`,{className:`text-bambu-gray/70`,children:[o(`library.runWithPipeline.pipelineHint`,`Pipeline`),`: `]}),(0,G.jsx)(`span`,{className:`text-white`,children:e.name})]}),t.target_printer_name&&(0,G.jsxs)(`p`,{children:[(0,G.jsxs)(`span`,{className:`text-bambu-gray/70`,children:[o(`library.runWithPipeline.targetHint`,`Target`),`: `]}),(0,G.jsx)(`span`,{className:`text-white`,children:t.target_printer_name})]})]}),(0,G.jsx)(`ul`,{className:`space-y-1.5`,children:t.issues.map((e,t)=>(0,G.jsxs)(`li`,{className:`flex items-start gap-2 text-xs`,children:[(0,G.jsx)(Mu,{className:`w-3.5 h-3.5 text-amber-600 dark:text-amber-400 flex-shrink-0 mt-0.5`}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:(0,G.jsx)(Aje,{issue:e})})]},t))}),(0,G.jsxs)(`div`,{className:`flex items-center justify-end gap-2 pt-2 border-t border-bambu-dark-tertiary`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:r,disabled:a,className:`px-3 py-1.5 text-xs text-bambu-gray hover:text-white`,children:o(`common.back`,`Back`)}),(0,G.jsxs)(`button`,{type:`button`,onClick:i,disabled:a,className:`px-3 py-1.5 text-xs bg-amber-500 hover:bg-amber-600 text-white rounded disabled:opacity-50 flex items-center gap-1`,children:[a?(0,G.jsx)(Y,{className:`w-3 h-3 animate-spin`}):(0,G.jsx)(El,{className:`w-3 h-3`}),o(`library.runWithPipeline.runAnyway`,`Run anyway`)]})]})]})}function Aje({issue:e}){let{t}=U();switch(e.kind){case`printer_not_set`:return(0,G.jsx)(G.Fragment,{children:t(`library.runWithPipeline.issue.printerNotSet`,`No target printer set on this pipeline.`)});case`printer_not_found`:return(0,G.jsx)(G.Fragment,{children:t(`library.runWithPipeline.issue.printerNotFound`,`Target printer no longer exists.`)});case`printer_disabled`:return(0,G.jsx)(G.Fragment,{children:t(`library.runWithPipeline.issue.printerDisabled`,`Target printer is disabled.`)});case`printer_offline`:return(0,G.jsx)(G.Fragment,{children:t(`library.runWithPipeline.issue.printerOffline`,`Target printer is offline.`)});case`filament_type_mismatch`:return(0,G.jsx)(G.Fragment,{children:t(`library.runWithPipeline.issue.filamentType`,`Filament slot {{slot}}: expected {{expected}}, AMS has {{actual}}`,{slot:(e.slot_index??0)+1,expected:e.expected??`?`,actual:e.actual??`?`})});case`filament_color_mismatch`:return(0,G.jsx)(G.Fragment,{children:t(`library.runWithPipeline.issue.filamentColor`,`Filament slot {{slot}}: colour differs (expected {{expected}}, AMS has {{actual}})`,{slot:(e.slot_index??0)+1,expected:e.expected??`?`,actual:e.actual??`?`})});case`ams_slot_missing`:return(0,G.jsx)(G.Fragment,{children:t(`library.runWithPipeline.issue.amsSlotMissing`,`AMS slot {{slot}} not available on this printer`,{slot:(e.slot_index??0)+1})});case`filament_unverified`:return(0,G.jsx)(G.Fragment,{children:t(`library.runWithPipeline.issue.filamentUnverified`,`Filament slot {{slot}} comes from a cloud / standard preset and could not be statically verified.`,{slot:(e.slot_index??0)+1})});default:return(0,G.jsx)(G.Fragment,{children:e.kind})}}function qW(e,t){return e??t??`bambu_studio`}var JW={bambu_studio:[`3mf`],orcaslicer:[`3mf`,`stl`,`step`,`stp`]};function YW(e){return JW[e]??JW.bambu_studio}var XW=[`3mf`,`stl`];function jje(e,t){let n=(e||``).toLowerCase();return YW(t).includes(n)}function Mje(e,t){let n=e.toLowerCase();return n.endsWith(`.gcode`)||n.endsWith(`.gcode.3mf`)?!1:YW(t).some(e=>n.endsWith(`.${e}`))}function Nje(e){let t=e.toLowerCase();return t.endsWith(`.gcode`)||t.endsWith(`.gcode.3mf`)?!1:XW.some(e=>t.endsWith(`.${e}`))}function Pje(){let e=navigator.userAgent.toLowerCase(),t=navigator.platform?.toLowerCase()||``;return e.includes(`win`)||t.includes(`win`)?`windows`:e.includes(`mac`)||t.includes(`mac`)?`macos`:e.includes(`linux`)||t.includes(`linux`)?`linux`:`unknown`}function ZW(e,t=`bambu_studio`){let n,r=encodeURIComponent(e);n=t===`orcaslicer`?`orcaslicer://open?file=${r}`:Pje()===`macos`?`bambustudioopen://${r}`:`bambustudio://open?file=${r}`;let i=document.createElement(`a`);i.href=n,i.style.display=`none`,document.body.appendChild(i),i.click(),document.body.removeChild(i)}function Fje(e){let t=(e||``).toLowerCase();return XW.includes(t)}function QW({onFiles:e,onRejected:t,extensions:n,disabled:r=!1}){let[i,a]=(0,f.useState)(!1),o=(0,f.useRef)(e),s=(0,f.useRef)(t),c=(0,f.useRef)(n);(0,f.useEffect)(()=>{o.current=e},[e]),(0,f.useEffect)(()=>{s.current=t},[t]),(0,f.useEffect)(()=>{c.current=n},[n]);let l=(0,f.useCallback)(e=>{r||(e.preventDefault(),e.dataTransfer.types.includes(`Files`)&&a(!0))},[r]),u=(0,f.useCallback)(e=>{r||(e.preventDefault(),e.dataTransfer.types.includes(`Files`)&&a(!0))},[r]),d=(0,f.useCallback)(e=>{if(r)return;e.preventDefault();let t=e.currentTarget,n=e.relatedTarget;(!n||!t.contains(n))&&a(!1)},[r]),p=(0,f.useCallback)(e=>{if(r)return;e.preventDefault(),a(!1);let t=Array.from(e.dataTransfer.files);if(t.length===0)return;let n=c.current,i=n&&n.length>0?t.filter(e=>n.some(t=>e.name.toLowerCase().endsWith(t))):t;i.length>0?o.current(i):s.current?.()},[r]);return(0,f.useEffect)(()=>{if(!i)return;let e=()=>a(!1),t=t=>{t.key===`Escape`&&e()};return document.addEventListener(`drop`,e),document.addEventListener(`dragend`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`drop`,e),document.removeEventListener(`dragend`,e),document.removeEventListener(`keydown`,t)}},[i]),{isDraggingOver:i,dragHandlers:{onDragOver:l,onDragEnter:u,onDragLeave:d,onDrop:p}}}function Ije({onClose:e,initialFiles:t}){let{t:n}=U(),r=no(),{showToast:i}=Hd(),a=(0,f.useRef)(null),[o,s]=(0,f.useState)(()=>t?.filter(e=>e.name.endsWith(`.3mf`)).map(e=>({file:e,status:`pending`}))||[]),[c,l]=(0,f.useState)(!1),[u,d]=(0,f.useState)(null);(0,f.useEffect)(()=>{let t=t=>{t.key===`Escape`&&e()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e]);let p=q({mutationFn:e=>Z.uploadArchivesBulk(e),onSuccess:e=>{d(e),r.invalidateQueries({queryKey:[`archives`]}),r.invalidateQueries({queryKey:[`archiveStats`]}),s(t=>t.map(t=>{let n=e.results.find(e=>e.filename===t.file.name),r=e.errors.find(e=>e.filename===t.file.name);return n?{...t,status:`success`,archiveId:n.id}:r?{...t,status:`error`,error:r.error}:t})),e.failed===0?i(`${e.uploaded} file${e.uploaded===1?``:`s`} uploaded`):e.uploaded===0?i(`Failed to upload ${e.failed} file${e.failed===1?``:`s`}`,`error`):i(`${e.uploaded} uploaded, ${e.failed} failed`,`warning`)},onError:()=>{s(e=>e.map(e=>({...e,status:`error`,error:`Upload failed`}))),i(`Upload failed`,`error`)}}),m=(0,f.useCallback)(e=>{e.preventDefault(),l(!0)},[]),h=(0,f.useCallback)(e=>{e.preventDefault(),l(!1)},[]),g=(0,f.useCallback)(e=>{e.preventDefault(),l(!1);let t=Array.from(e.dataTransfer.files).filter(e=>e.name.endsWith(`.3mf`));t.length>0&&s(e=>[...e,...t.map(e=>({file:e,status:`pending`}))])},[]),_=(0,f.useCallback)(e=>{let t=Array.from(e.target.files||[]).filter(e=>e.name.endsWith(`.3mf`));t.length>0&&s(e=>[...e,...t.map(e=>({file:e,status:`pending`}))]),a.current&&(a.current.value=``)},[]),v=(0,f.useCallback)(e=>{s(t=>t.filter((t,n)=>n!==e))},[]),y=()=>{if(o.length===0)return;let e=o.filter(e=>e.status===`pending`);e.length!==0&&(s(e=>e.map(e=>e.status===`pending`?{...e,status:`uploading`}:e)),p.mutate(e.map(e=>e.file)))},b=o.filter(e=>e.status===`pending`).length,x=p.isPending;return(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,children:(0,G.jsx)(Pd,{className:`w-full max-w-2xl max-h-[90vh] flex flex-col`,children:(0,G.jsxs)(Id,{className:`p-0 flex flex-col h-full`,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:n(`uploadModal.title`)}),(0,G.jsx)(`button`,{onClick:e,className:`text-bambu-gray hover:text-white transition-colors`,children:(0,G.jsx)(Zu,{className:`w-5 h-5`})})]}),(0,G.jsx)(`div`,{className:`p-4`,children:(0,G.jsxs)(`div`,{className:`border-2 border-dashed rounded-lg p-8 text-center transition-colors ${c?`border-bambu-green bg-bambu-green/10`:`border-bambu-dark-tertiary hover:border-bambu-gray`}`,onDragOver:m,onDragLeave:h,onDrop:g,children:[(0,G.jsx)(Iu,{className:`w-12 h-12 mx-auto mb-4 text-bambu-gray`}),(0,G.jsx)(`p`,{className:`text-white mb-2`,children:n(`uploadModal.dragDrop`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-sm mb-4`,children:n(`uploadModal.or`)}),(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>a.current?.click(),disabled:x,children:n(`uploadModal.browseFiles`)}),(0,G.jsx)(`input`,{ref:a,type:`file`,accept:`.3mf`,multiple:!0,className:`hidden`,onChange:_})]})}),(0,G.jsx)(`div`,{className:`px-4 pb-4`,children:(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`uploadModal.extractionInfo`)})}),o.length>0&&(0,G.jsx)(`div`,{className:`px-4 pb-4 max-h-60 overflow-y-auto`,children:(0,G.jsx)(`div`,{className:`space-y-2`,children:o.map((e,t)=>(0,G.jsxs)(`div`,{className:`flex items-center gap-3 p-3 bg-bambu-dark rounded-lg`,children:[(0,G.jsx)(sc,{className:`w-5 h-5 text-bambu-gray flex-shrink-0`}),(0,G.jsx)(`span`,{className:`flex-1 text-white text-sm truncate`,children:e.file.name}),(0,G.jsxs)(`span`,{className:`text-xs text-bambu-gray`,children:[(e.file.size/(1024*1024)).toFixed(1),` MB`]}),e.status===`pending`&&(0,G.jsx)(`button`,{onClick:()=>v(t),className:`text-bambu-gray hover:text-red-600 dark:hover:text-red-400 transition-colors`,disabled:x,children:(0,G.jsx)(Zu,{className:`w-4 h-4`})}),e.status===`uploading`&&(0,G.jsx)(Y,{className:`w-4 h-4 text-bambu-green animate-spin`}),e.status===`success`&&(0,G.jsx)(hs,{className:`w-4 h-4 text-bambu-green`}),e.status===`error`&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-xs text-red-700 dark:text-red-400`,children:e.error}),(0,G.jsx)(ps,{className:`w-4 h-4 text-red-600 dark:text-red-400`})]})]},`${e.file.name}-${t}`))})}),u&&(0,G.jsx)(`div`,{className:`px-4 pb-4`,children:(0,G.jsx)(`div`,{className:`p-3 bg-bambu-dark rounded-lg`,children:(0,G.jsxs)(`p`,{className:`text-sm text-white`,children:[(0,G.jsx)(`span`,{className:`text-bambu-green`,children:u.uploaded}),` `,n(`uploadModal.uploaded`),u.failed>0&&(0,G.jsxs)(G.Fragment,{children:[`, `,(0,G.jsx)(`span`,{className:`text-red-700 dark:text-red-400`,children:u.failed}),` `,n(`uploadModal.failed`)]})]})})}),(0,G.jsxs)(`div`,{className:`flex gap-3 p-4 border-t border-bambu-dark-tertiary`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:e,className:`flex-1`,children:n(u?`common.close`:`common.cancel`)}),!u&&(0,G.jsx)(Q,{onClick:y,disabled:b===0||x,className:`flex-1`,children:x?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),n(`uploadModal.uploading`)]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Iu,{className:`w-4 h-4`}),n(`uploadModal.upload`),` `,b>0&&`(${b})`]})})]})]})})})}var Lje=365;function Rje({onClose:e,initialDays:t}){let{t:n}=U(),r=no(),{showToast:i}=Hd(),[a,o]=(0,f.useState)(t??Lje),[s,c]=(0,f.useState)(!1),[l,u]=(0,f.useState)(a);(0,f.useEffect)(()=>{let e=window.setTimeout(()=>u(a),300);return()=>window.clearTimeout(e)},[a]);let d=K({queryKey:[`archive-purge-preview`,l,s],queryFn:()=>Z.previewArchivePurge(l,s),enabled:l>=1}),p=q({mutationFn:()=>Z.executeArchivePurge(a,s),onSuccess:t=>{i(n(`archivePurge.toast.success`,{count:t.deleted}),`success`),r.invalidateQueries({queryKey:[`archives`]}),r.invalidateQueries({queryKey:[`archive-stats`]}),e()},onError:e=>i(e.message||n(`archivePurge.toast.failed`),`error`)});(0,f.useEffect)(()=>{let t=t=>{t.key===`Escape`&&!p.isPending&&e()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,p.isPending]);let m=d.data,h=m?.count??0,g=m?.total_bytes??0,_=h>0&&!p.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)(ku,{className:`w-5 h-5`}),n(`archivePurge.title`)]}),(0,G.jsx)(`button`,{onClick:e,className:`text-gray-400 hover:text-gray-600 dark:hover:text-gray-200`,"aria-label":n(`common.close`),disabled:p.isPending,children:(0,G.jsx)(Zu,{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:n(`archivePurge.description`)}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{htmlFor:`archive-purge-days`,className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:n(`archivePurge.ageLabel`)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`input`,{id:`archive-purge-days`,type:`number`,min:1,max:3650,value:a,onChange:e=>o(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:n(`archivePurge.days`)})]})]}),(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:n(`archivePurge.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:n(`archivePurge.effect1`)}),(0,G.jsx)(`li`,{children:n(`archivePurge.effect2`)}),(0,G.jsx)(`li`,{children:n(`archivePurge.effect3`)}),(0,G.jsx)(`li`,{children:n(`archivePurge.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:d.isLoading||d.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`}),` `,n(`archivePurge.previewLoading`)]}):d.isError?(0,G.jsx)(`div`,{className:`text-sm text-red-600 dark:text-red-400`,children:d.error?.message??n(`archivePurge.previewFailed`)}):(0,G.jsxs)(`div`,{className:`text-sm text-gray-900 dark:text-gray-100`,children:[(0,G.jsx)(`div`,{className:`font-medium`,children:n(`archivePurge.previewSummary`,{count:h,size:Bd(g)})}),m?.sample_filenames&&m.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:[m.sample_filenames.map(e=>(0,G.jsx)(`li`,{className:`truncate`,children:e},e)),h>m.sample_filenames.length&&(0,G.jsx)(`li`,{className:`list-none italic text-gray-500`,children:n(`archivePurge.andMore`,{count:h-m.sample_filenames.length})})]})]})}),(0,G.jsxs)(`label`,{className:`flex gap-2 items-start rounded border border-gray-200 dark:border-gray-700 px-3 py-2 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800/50`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:s,onChange:e=>c(e.target.checked),disabled:p.isPending,className:`mt-0.5 shrink-0`}),(0,G.jsxs)(`span`,{className:`text-xs text-gray-700 dark:text-gray-300`,children:[(0,G.jsx)(`span`,{className:`font-medium block mb-0.5`,children:n(`archivePurge.purgeStatsLabel`)}),(0,G.jsx)(`span`,{className:`text-gray-500 dark:text-gray-400`,children:n(`archivePurge.purgeStatsHint`)})]})]}),(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)(Mu,{className:`w-4 h-4 mt-0.5 shrink-0`}),(0,G.jsx)(`span`,{children:n(`archivePurge.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:p.isPending,children:n(`common.cancel`)}),(0,G.jsx)(Q,{variant:`danger`,disabled:!_,onClick:()=>p.mutate(),children:p.isPending?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin mr-1`}),n(`archivePurge.purging`)]}):n(`archivePurge.confirmCta`,{count:h})})]})]})})}function $W({archiveId:e,archiveName:t,onClose:n}){let{t:r}=U();return(0,f.useEffect)(()=>{let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),(0,G.jsx)(`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-2xl max-h-[85vh] flex flex-col`,onClick:e=>e.stopPropagation(),children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,G.jsx)(Nc,{className:`w-5 h-5 text-bambu-green flex-shrink-0`}),(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white truncate`,title:t||``,children:r(`archives.runLog.modalTitle`,{name:t||r(`archives.runLog.modalTitleFallback`)})})]}),(0,G.jsx)(`button`,{onClick:n,className:`text-bambu-gray hover:text-white transition-colors`,title:r(`common.close`),children:(0,G.jsx)(Zu,{className:`w-5 h-5`})})]}),(0,G.jsx)(`div`,{className:`p-6 overflow-y-auto flex-1`,children:(0,G.jsx)(zp,{archiveId:e})})]})})}function eG({isOpen:e,onClose:t,columns:n,defaultColumns:r,onSave:i}){let{t:a}=U(),[o,s]=(0,f.useState)(n),[c,l]=(0,f.useState)(null),u=(0,f.useRef)(null);if((0,f.useEffect)(()=>{e&&s(n.map(e=>({...e})))},[e,n]),(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=e=>{s(t=>t.map((t,n)=>n===e?{...t,visible:!t.visible}:t))},p=(e,t)=>{t<0||t>=o.length||s(n=>{let r=[...n],[i]=r.splice(e,1);return r.splice(t,0,i),r})},m=(e,t)=>{u.current=t,l(t),e.dataTransfer.effectAllowed=`move`},h=(e,t)=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`;let n=u.current;n!==null&&n!==t&&(p(n,t),u.current=t,l(t))},g=e=>{e.preventDefault()},_=()=>{u.current=null,l(null)},v=()=>{s(r.map(e=>({...e})))},y=()=>{i(o),t()},b=o.filter(e=>e.visible).length;return(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,onClick:t,children:(0,G.jsx)(Pd,{className:`w-full max-w-md max-h-[80vh] flex flex-col`,onClick:e=>e.stopPropagation(),children:(0,G.jsxs)(Id,{className:`p-6 flex flex-col min-h-0`,children:[(0,G.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-2`,children:a(`inventory.configureColumns`)}),(0,G.jsxs)(`p`,{className:`text-sm text-bambu-gray mb-4`,children:[a(`inventory.configureColumnsDesc`),(0,G.jsxs)(`span`,{className:`ml-2 text-bambu-gray/60`,children:[`(`,b,` `,a(`inventory.of`),` `,o.length,` `,a(`inventory.visible`),`)`]})]}),(0,G.jsx)(`div`,{className:`space-y-1 overflow-y-auto flex-1 min-h-0 pr-1`,children:o.map((e,t)=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2 p-2 rounded-lg border transition-colors ${c===t?`border-bambu-green bg-bambu-green/10`:`border-bambu-dark-tertiary bg-bambu-dark-tertiary/50`} ${e.visible?``:`opacity-50`}`,draggable:!0,onDragStart:e=>m(e,t),onDragOver:e=>h(e,t),onDrop:g,onDragEnd:_,children:[(0,G.jsx)(`div`,{className:`cursor-grab text-bambu-gray/50 hover:text-bambu-gray`,children:(0,G.jsx)(Tc,{className:`w-4 h-4`})}),(0,G.jsx)(`span`,{className:`flex-1 font-medium text-sm text-white`,children:e.label}),(0,G.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,G.jsx)(`button`,{onClick:()=>p(t,t-1),disabled:t===0,className:`p-1 rounded text-bambu-gray hover:bg-bambu-dark-secondary disabled:opacity-30 disabled:cursor-not-allowed`,title:a(`inventory.moveUp`),children:(0,G.jsx)(us,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{onClick:()=>p(t,t+1),disabled:t===o.length-1,className:`p-1 rounded text-bambu-gray hover:bg-bambu-dark-secondary disabled:opacity-30 disabled:cursor-not-allowed`,title:a(`inventory.moveDown`),children:(0,G.jsx)(ss,{className:`w-4 h-4`})})]}),(0,G.jsx)(`button`,{onClick:()=>d(t),className:`p-1.5 rounded transition-colors ${e.visible?`text-bambu-green hover:bg-bambu-green/10`:`text-bambu-gray/50 hover:bg-bambu-dark-secondary`}`,title:e.visible?a(`inventory.hideColumn`):a(`inventory.showColumn`),children:e.visible?(0,G.jsx)($s,{className:`w-4 h-4`}):(0,G.jsx)(Qs,{className:`w-4 h-4`})})]},e.id))}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 mt-4 pt-4 border-t border-bambu-dark-tertiary`,children:[(0,G.jsxs)(Q,{variant:`secondary`,onClick:v,className:`mr-auto`,children:[(0,G.jsx)(Ll,{className:`w-4 h-4`}),a(`inventory.reset`)]}),(0,G.jsx)(Q,{variant:`secondary`,onClick:t,children:a(`inventory.cancel`)}),(0,G.jsx)(Q,{onClick:y,children:a(`inventory.applyChanges`)})]})]})})})}function zje({selectedIds:e,existingTags:t,onClose:n}){let r=no(),{showToast:i}=Hd(),[a,o]=(0,f.useState)(``),[s,c]=(0,f.useState)(new Set),[l,u]=(0,f.useState)(`add`);(0,f.useEffect)(()=>{let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]);let d=q({mutationFn:async()=>{let t=Array.from(s),n=0;for(let r of e)try{let e=await Z.getArchive(r),i=e.tags?e.tags.split(`,`).map(e=>e.trim()).filter(Boolean):[],a;a=l===`add`?[...new Set([...i,...t])]:i.filter(e=>!s.has(e)),await Z.updateArchive(r,{tags:a.join(`, `)}),n++}catch(e){throw console.error(`Failed to update archive ${r}:`,e),Error(`Failed on archive ${r}: ${e instanceof Error?e.message:`Unknown error`}`)}return{count:n,mode:l,tags:t}},onSuccess:({count:e,mode:t,tags:a})=>{r.invalidateQueries({queryKey:[`archives`]}),i(`${t===`add`?`Added`:`Removed`} ${a.length} tag${a.length===1?``:`s`} ${t===`add`?`to`:`from`} ${e} archive${e===1?``:`s`}`),n()},onError:e=>{i(e.message||`Failed to update tags`,`error`)}}),p=e=>{c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},m=()=>{a.trim()&&!s.has(a.trim())&&(c(e=>new Set([...e,a.trim()])),o(``))};return(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,children:(0,G.jsx)(Pd,{className:`w-full max-w-md`,children:(0,G.jsxs)(Id,{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.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(yu,{className:`w-5 h-5 text-bambu-green`}),(0,G.jsx)(`h2`,{className:`text-xl font-semibold text-white`,children:l===`add`?`Add Tags`:`Remove Tags`})]}),(0,G.jsx)(`button`,{onClick:n,className:`text-bambu-gray hover:text-white transition-colors`,children:(0,G.jsx)(Zu,{className:`w-5 h-5`})})]}),(0,G.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,G.jsxs)(`p`,{className:`text-sm text-bambu-gray`,children:[l===`add`?`Add`:`Remove`,` tags for `,e.length,` selected archive`,e.length===1?``:`s`]}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(Q,{size:`sm`,variant:l===`add`?`primary`:`secondary`,onClick:()=>u(`add`),children:`Add Tags`}),(0,G.jsx)(Q,{size:`sm`,variant:l===`remove`?`primary`:`secondary`,onClick:()=>u(`remove`),children:`Remove Tags`})]}),l===`add`&&(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(`input`,{type:`text`,placeholder:`Enter new tag...`,className:`flex-1 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:border-bambu-green focus:outline-none`,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),m())}}),(0,G.jsx)(Q,{size:`sm`,variant:`secondary`,onClick:m,disabled:!a.trim(),children:(0,G.jsx)(Ol,{className:`w-4 h-4`})})]}),t.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mb-2`,children:`Existing tags:`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.map(e=>(0,G.jsx)(`button`,{onClick:()=>p(e),className:`px-2 py-1 rounded text-sm transition-colors ${s.has(e)?`bg-bambu-green text-white`:`bg-bambu-dark-tertiary text-bambu-gray-light hover:bg-bambu-dark`}`,children:e},e))})]}),s.size>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`p`,{className:`text-xs text-bambu-gray mb-2`,children:[`Tags to `,l===`add`?`add`:`remove`,`:`]}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Array.from(s).map(e=>(0,G.jsxs)(`span`,{className:`px-2 py-1 rounded text-sm flex items-center gap-1 ${l===`add`?`bg-green-100 dark:bg-green-500/20 text-green-700 dark:text-green-400`:`bg-red-100 dark:bg-red-500/20 text-red-700 dark:text-red-400`}`,children:[e,(0,G.jsx)(`button`,{onClick:()=>p(e),className:`hover:opacity-70`,children:(0,G.jsx)(Zu,{className:`w-3 h-3`})})]},e))})]})]}),(0,G.jsxs)(`div`,{className:`flex gap-3 p-4 border-t border-bambu-dark-tertiary`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:n,className:`flex-1`,children:`Cancel`}),(0,G.jsx)(Q,{onClick:()=>d.mutate(),disabled:s.size===0||d.isPending,className:`flex-1`,children:d.isPending?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),`Processing...`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(yu,{className:`w-4 h-4`}),l===`add`?`Add Tags`:`Remove Tags`]})})]})]})})})}function Bje({selectedIds:e,onClose:t}){let{t:n}=U(),r=no(),{showToast:i}=Hd(),[a,o]=(0,f.useState)(``),{data:s,isLoading:c}=K({queryKey:[`projects`],queryFn:()=>Z.getProjects()}),l=(0,f.useMemo)(()=>s?Vp([...s].sort((e,t)=>e.name.localeCompare(t.name))):void 0,[s]),u=a.trim().toLowerCase(),d=u?l?.filter(e=>e.name.toLowerCase().includes(u)):l,p=(l?.length??0)>5;(0,f.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]);let m=()=>Bp(r),h=q({mutationFn:async t=>(await Z.addArchivesToProject(t,e),t),onSuccess:n=>{let r=s?.find(e=>e.id===n);m(),i(`Added ${e.length} archive${e.length===1?``:`s`} to "${r?.name}"`),t()},onError:()=>{i(`Failed to assign project`,`error`)}}),g=q({mutationFn:async()=>{for(let t of e)await Z.updateArchive(t,{project_id:null});return e.length},onSuccess:e=>{m(),i(`Removed ${e} archive${e===1?``:`s`} from project`),t()},onError:()=>{i(`Failed to remove from project`,`error`)}}),_=h.isPending||g.isPending;return(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,children:(0,G.jsx)(Pd,{className:`w-full max-w-md max-h-[80vh] flex flex-col`,children:(0,G.jsxs)(Id,{className:`p-0 flex flex-col min-h-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-bambu-dark-tertiary shrink-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(dc,{className:`w-5 h-5 text-bambu-green`}),(0,G.jsx)(`h2`,{className:`text-xl font-semibold text-white`,children:`Assign to Project`})]}),(0,G.jsx)(`button`,{onClick:t,className:`text-bambu-gray hover:text-white transition-colors`,disabled:_,children:(0,G.jsx)(Zu,{className:`w-5 h-5`})})]}),(0,G.jsxs)(`div`,{className:`p-4 space-y-3 overflow-y-auto min-h-0`,children:[(0,G.jsxs)(`p`,{className:`text-sm text-bambu-gray`,children:[`Assign `,e.length,` selected archive`,e.length===1?``:`s`,` to a project`]}),c?(0,G.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,G.jsx)(Y,{className:`w-6 h-6 animate-spin text-bambu-gray`})}):(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`button`,{onClick:()=>g.mutate(),disabled:_,className:`w-full flex items-center gap-3 p-3 rounded-lg bg-bambu-dark hover:bg-bambu-dark-tertiary border border-bambu-dark-tertiary transition-colors text-left disabled:opacity-50`,children:[(0,G.jsx)(`div`,{className:`w-8 h-8 rounded-full bg-red-500/20 flex items-center justify-center shrink-0`,children:(0,G.jsx)(xs,{className:`w-4 h-4 text-red-600 dark:text-red-400`})}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`p`,{className:`text-white font-medium`,children:`Remove from project`}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray truncate`,children:`Clear project assignment`})]}),g.isPending&&(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin text-bambu-gray shrink-0`})]}),l&&l.length>0&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 py-2`,children:[(0,G.jsx)(`div`,{className:`flex-1 h-px bg-bambu-dark-tertiary`}),(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:`or assign to`}),(0,G.jsx)(`div`,{className:`flex-1 h-px bg-bambu-dark-tertiary`})]}),p&&(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(Gl,{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:`text`,value:a,onChange:e=>o(e.target.value),placeholder:n(`archives.menu.searchProjects`),className:`w-full pl-9 pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray text-sm focus:border-bambu-green focus:outline-none`})]}),d?.map(e=>(0,G.jsxs)(`button`,{onClick:()=>h.mutate(e.id),disabled:_,className:`w-full flex items-center gap-3 p-3 rounded-lg bg-bambu-dark hover:bg-bambu-dark-tertiary border border-bambu-dark-tertiary transition-colors text-left disabled:opacity-50`,children:[(0,G.jsx)(`div`,{className:`w-8 h-8 rounded-full flex items-center justify-center shrink-0`,style:{backgroundColor:e.color?`${e.color}20`:`rgb(var(--bambu-green) / 0.2)`},children:(0,G.jsx)(dc,{className:`w-4 h-4`,style:{color:e.color||`rgb(var(--bambu-green))`}})}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`p`,{className:`text-white font-medium truncate`,children:e.name}),(0,G.jsxs)(`p`,{className:`text-sm text-bambu-gray truncate`,children:[e.archive_count,` archive`,e.archive_count===1?``:`s`,e.status&&` • ${e.status}`]})]}),h.isPending&&h.variables===e.id&&(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin text-bambu-gray shrink-0`})]},e.id)),(!l||l.length===0)&&(0,G.jsx)(`p`,{className:`text-center text-bambu-gray py-4`,children:`No projects yet. Create one from the Projects page.`}),l&&l.length>0&&d?.length===0&&(0,G.jsx)(`p`,{className:`text-center text-bambu-gray text-sm py-4`,children:`—`})]})]}),(0,G.jsx)(`div`,{className:`flex gap-3 p-4 border-t border-bambu-dark-tertiary shrink-0`,children:(0,G.jsx)(Q,{variant:`secondary`,onClick:t,className:`flex-1`,disabled:_,children:`Cancel`})})]})})})}function Vje(e,t){return new Date(e,t+1,0).getDate()}function Hje(e,t){return new Date(e,t,1).getDay()}var Uje=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],Wje=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`];function Gje({archives:e,onArchiveClick:t,highlightedArchiveId:n}){let r=new Date,[i,a]=(0,f.useState)(r.getMonth()),[o,s]=(0,f.useState)(r.getFullYear()),[c,l]=(0,f.useState)(null),[u,d]=(0,f.useState)(null),p=(0,f.useMemo)(()=>{let t=new Map;return e.forEach(e=>{let n=Jf(e.completed_at||e.created_at)||new Date,r=`${n.getFullYear()}-${String(n.getMonth()+1).padStart(2,`0`)}-${String(n.getDate()).padStart(2,`0`)}`,i=t.get(r)||[];i.push(e),t.set(r,i)}),t},[e]),m=Vje(o,i),h=Hje(o,i),g=()=>{i===0?(a(11),s(o-1)):a(i-1)},_=()=>{i===11?(a(0),s(o+1)):a(i+1)},v=()=>{a(r.getMonth()),s(r.getFullYear())},y=[];for(let e=0;e{e!==c&&d(null),l(e)};return(0,G.jsxs)(`div`,{className:`flex flex-col lg:flex-row gap-6`,children:[(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,G.jsx)(`button`,{onClick:g,className:`p-2 hover:bg-bambu-dark-tertiary rounded-lg transition-colors`,children:(0,G.jsx)(ls,{className:`w-5 h-5 text-bambu-gray`})}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white`,children:[Uje[i],` `,o]}),(0,G.jsx)(`button`,{onClick:v,className:`px-2 py-1 text-xs bg-bambu-dark-tertiary hover:bg-bambu-green/20 text-bambu-gray hover:text-white rounded transition-colors`,children:`Today`})]}),(0,G.jsx)(`button`,{onClick:_,className:`p-2 hover:bg-bambu-dark-tertiary rounded-lg transition-colors`,children:(0,G.jsx)(cs,{className:`w-5 h-5 text-bambu-gray`})})]}),(0,G.jsx)(`div`,{className:`grid grid-cols-7 gap-1 mb-1`,children:Wje.map(e=>(0,G.jsx)(`div`,{className:`text-center text-xs text-bambu-gray py-2`,children:e},e))}),(0,G.jsx)(`div`,{className:`grid grid-cols-7 gap-1`,children:y.map((e,t)=>{if(e===null)return(0,G.jsx)(`div`,{className:`aspect-square`},`empty-${t}`);let n=`${o}-${String(i+1).padStart(2,`0`)}-${String(e).padStart(2,`0`)}`,a=p.get(n)||[],s=a.length>0,l=e===r.getDate()&&i===r.getMonth()&&o===r.getFullYear(),u=n===c,d=a.filter(e=>e.status===`completed`).length,f=a.filter(e=>e.status===`failed`).length;return(0,G.jsxs)(`button`,{onClick:()=>x(u?null:n),className:`aspect-square rounded-lg p-1 flex flex-col items-center justify-center transition-colors relative ${u?`bg-bambu-green text-white`:l?`bg-bambu-green/20 text-white ring-2 ring-bambu-green`:s?`bg-bambu-dark-tertiary hover:bg-bambu-dark-tertiary/70 text-white`:`hover:bg-bambu-dark-tertiary/50 text-bambu-gray`}`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium ${l&&!u?`text-bambu-green`:``}`,children:e}),s&&(0,G.jsxs)(`div`,{className:`absolute bottom-1 left-1/2 -translate-x-1/2 flex items-center gap-1`,children:[(0,G.jsx)(`div`,{className:`w-2 h-2 rounded-full ${f>0&&d===0?`bg-red-400`:f>0?`bg-yellow-400`:`bg-green-400`}`}),(0,G.jsx)(`span`,{className:`text-xs font-medium`,children:a.length})]})]},e)})}),(0,G.jsx)(`div`,{className:`mt-4 pt-4 border-t border-bambu-dark-tertiary`,children:(0,G.jsxs)(`div`,{className:`grid grid-cols-3 gap-4 text-center`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-2xl font-bold text-white`,children:e.filter(e=>{let t=Jf(e.completed_at||e.created_at)||new Date;return t.getMonth()===i&&t.getFullYear()===o}).length}),(0,G.jsx)(`div`,{className:`text-xs text-bambu-gray`,children:`Prints this month`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-2xl font-bold text-green-700 dark:text-green-400`,children:e.filter(e=>{let t=Jf(e.completed_at||e.created_at)||new Date;return t.getMonth()===i&&t.getFullYear()===o&&e.status===`completed`}).length}),(0,G.jsx)(`div`,{className:`text-xs text-bambu-gray`,children:`Successful`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-2xl font-bold text-red-700 dark:text-red-400`,children:e.filter(e=>{let t=Jf(e.completed_at||e.created_at)||new Date;return t.getMonth()===i&&t.getFullYear()===o&&e.status===`failed`}).length}),(0,G.jsx)(`div`,{className:`text-xs text-bambu-gray`,children:`Failed`})]})]})})]}),(0,G.jsx)(`div`,{className:`lg:w-80 bg-bambu-dark rounded-xl p-4`,children:c?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`h3`,{className:`text-sm font-medium text-bambu-gray mb-3`,children:new Date(c+`T12:00:00`).toLocaleDateString(`en-US`,{weekday:`long`,month:`long`,day:`numeric`,year:`numeric`})}),b.length>0?(0,G.jsx)(`div`,{className:`calendar-scroll space-y-2 max-h-96 overflow-y-auto`,children:b.map(e=>{let r=e.id===u||e.id===n;return(0,G.jsxs)(`button`,{onClick:()=>{d(e.id),t?.(e)},className:`w-full flex items-center gap-3 p-2 rounded-lg transition-colors text-left ${r?``:`hover:bg-bambu-dark-tertiary`}`,style:r?{outline:`4px solid #facc15`,outlineOffset:`2px`}:void 0,children:[e.thumbnail_path?(0,G.jsx)(`img`,{src:Z.getArchiveThumbnail(e.id),alt:``,className:`w-12 h-12 rounded object-cover`}):(0,G.jsx)(`div`,{className:`w-12 h-12 rounded bg-bambu-dark-tertiary flex items-center justify-center`,children:(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:`3MF`})}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`p`,{className:`text-sm text-white truncate`,children:e.print_name||e.filename}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,G.jsx)(`span`,{className:e.status===`failed`?`text-red-700 dark:text-red-400`:`text-green-700 dark:text-green-400`,children:e.status===`failed`?`Failed`:`Completed`}),e.filament_color&&(0,G.jsx)(`div`,{className:`flex gap-0.5`,children:e.filament_color.split(`,`).map((e,t)=>(0,G.jsx)(`div`,{className:`w-3 h-3 rounded-full border border-black/20`,style:{backgroundColor:e}},t))})]})]})]},e.id)})}):(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:`No prints on this day`})]}):(0,G.jsx)(`div`,{className:`text-center py-8`,children:(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:`Select a day to see prints`})})})]})}function tG({archiveId:e,archiveName:t,onClose:n}){let r=Z.getArchiveQRCodeUrl(e,300);return(0,f.useEffect)(()=>{let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),(0,G.jsx)(`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-sm`,onClick:e=>e.stopPropagation(),children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary`,children:[(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:`QR Code`}),(0,G.jsx)(`button`,{onClick:n,className:`text-bambu-gray hover:text-white transition-colors`,children:(0,G.jsx)(Zu,{className:`w-5 h-5`})})]}),(0,G.jsxs)(`div`,{className:`p-6 flex flex-col items-center`,children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mb-4 text-center truncate max-w-full`,children:t}),(0,G.jsx)(`div`,{className:`bg-white p-4 rounded-lg mb-4`,children:(0,G.jsx)(`img`,{src:r,alt:`QR Code`,className:`w-64 h-64`})}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mb-4 text-center`,children:`Scan to open this archive`}),(0,G.jsxs)(Q,{onClick:()=>{let e=document.createElement(`a`);e.href=r,e.download=`${t}_qrcode.png`,e.click()},className:`w-full`,children:[(0,G.jsx)(Ws,{className:`w-4 h-4`}),`Download QR Code`]})]})]})})}function nG(e){let{archiveName:t,photos:n,initialIndex:r,onClose:i,onDelete:a}=e,[o,s]=(0,f.useState)(()=>Math.min(Math.max(r??0,0),Math.max(n.length-1,0))),[c,l]=(0,f.useState)(!1);if((0,f.useEffect)(()=>{if(c)return;let e=e=>{e.key===`Escape`&&i(),e.key===`ArrowLeft`&&s(e=>Math.max(0,e-1)),e.key===`ArrowRight`&&s(e=>Math.min(n.length-1,e+1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[i,n.length,c]),(0,f.useEffect)(()=>{o>=n.length&&s(Math.max(0,n.length-1))},[n.length,o]),n.length===0)return i(),null;let u=t=>e.getPhotoUrl?e.getPhotoUrl(t):Z.getArchivePhotoUrl(e.archiveId,t),d=n[o],p=u(d);return(0,G.jsxs)(`div`,{className:`fixed inset-0 bg-black/90 flex items-center justify-center z-50`,onClick:e=>{e.stopPropagation(),i()},children:[(0,G.jsxs)(`div`,{className:`relative w-full h-full flex flex-col`,onClick:e=>e.stopPropagation(),children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between px-6 py-4 bg-black/50`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:t}),(0,G.jsxs)(`p`,{className:`text-sm text-bambu-gray`,children:[`Photo `,o+1,` of `,n.length]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:()=>{let e=document.createElement(`a`);e.href=p,e.download=`${t}_photo_${o+1}.jpg`,e.click()},children:[(0,G.jsx)(Ws,{className:`w-4 h-4`}),`Download`]}),a&&(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:()=>{a&&l(!0)},className:`text-red-400 hover:text-red-300`,children:(0,G.jsx)(ku,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{onClick:i,className:`p-2 text-bambu-gray hover:text-white transition-colors`,children:(0,G.jsx)(Zu,{className:`w-6 h-6`})})]})]}),(0,G.jsxs)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center p-4 relative overflow-hidden`,children:[o>0&&(0,G.jsx)(`button`,{onClick:()=>s(e=>e-1),className:`absolute left-4 z-10 p-3 bg-black/50 hover:bg-black/70 rounded-full transition-colors`,children:(0,G.jsx)(ls,{className:`w-8 h-8 text-white`})}),(0,G.jsx)(`img`,{src:p,alt:`Photo ${o+1}`,className:`max-w-full max-h-full object-contain rounded-lg`,style:{maxHeight:`calc(100vh - 200px)`}}),os(e=>e+1),className:`absolute right-4 z-10 p-3 bg-black/50 hover:bg-black/70 rounded-full transition-colors`,children:(0,G.jsx)(cs,{className:`w-8 h-8 text-white`})})]}),n.length>1&&(0,G.jsx)(`div`,{className:`flex justify-center gap-2 p-4 bg-black/50`,children:n.map((e,t)=>(0,G.jsx)(`button`,{onClick:()=>s(t),className:`w-16 h-16 rounded-lg overflow-hidden border-2 transition-colors ${t===o?`border-bambu-green`:`border-transparent hover:border-bambu-gray`}`,children:(0,G.jsx)(`img`,{src:u(e),alt:`Thumbnail ${t+1}`,className:`w-full h-full object-cover`})},e))})]}),c&&(0,G.jsx)(`div`,{onClick:e=>e.stopPropagation(),children:(0,G.jsx)($d,{title:`Delete Photo`,message:`Delete this photo? This cannot be undone.`,confirmText:`Delete`,variant:`danger`,onConfirm:()=>{a?.(d),l(!1)},onCancel:()=>l(!1)})})]})}function rG(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);ne.startsWith(t,n));if(a){t.push({kind:`op`,value:a}),n+=a.length;continue}let o=/^[A-Za-z_][A-Za-z0-9_]*(::[A-Za-z_][A-Za-z0-9_]*)*/.exec(e.slice(n));if(o){t.push({kind:`id`,value:o[0]}),n+=o[0].length;continue}return}return t}var tje=new Set([`opt_bool`,`opt_int`,`opt_float`,`opt_float_nullable`,`opt_int_nullable`,`opt_bool_nullable`,`opt_enum`,`opt_string`,`option`,`has`]),nje=class e{tokens=[];pos=0;cfg;locals;schema;resolving;memo;constructor(e,t,n,r,i){this.cfg=e,this.locals=t,this.schema=n,this.resolving=r,this.memo=i}evaluate(e){let t=eje(e);if(!t||t.length===0)return;this.tokens=t,this.pos=0;let n=this.parseOr();if(this.pos===this.tokens.length)return n}peek(){return this.tokens[this.pos]}eatOp(e){let t=this.peek();return t&&t.kind===`op`&&t.value===e?(this.pos+=1,!0):!1}parseOr(){let e=this.parseAnd();for(;this.eatOp(`||`);){let t=this.parseAnd(),n=kW(e),r=kW(t);e=n===!0||r===!0?!0:n===void 0||r===void 0?void 0:n||r}return e}parseAnd(){let e=this.parseComparison();for(;this.eatOp(`&&`);){let t=this.parseComparison(),n=kW(e),r=kW(t);e=n===!1||r===!1?!1:n===void 0||r===void 0?void 0:n&&r}return e}parseComparison(){let e=this.parseUnary();for(let t of[`==`,`!=`,`<=`,`>=`,`<`,`>`])if(this.eatOp(t))return rje(e,this.parseUnary(),t,this.schema);return e}parseUnary(){if(this.eatOp(`!`)){let e=kW(this.parseUnary());return e===void 0?void 0:!e}return this.parsePrimary()}parsePrimary(){let e=this.peek();if(!e)return;if(e.kind===`num`||e.kind===`str`)return this.pos+=1,e.value;if(e.kind===`op`&&e.value===`(`){this.pos+=1;let e=this.parseOr();return this.eatOp(`)`)?e:void 0}if(e.kind!==`id`)return;if(this.pos+=1,e.value===`true`)return!0;if(e.value===`false`)return!1;if(e.value===`config`)return this.parseConfigAccess();let t=this.locals[e.value];return t===void 0?`${DW}${e.value}`:this.resolveLocal(e.value,t)}parseConfigAccess(){if(!this.eatOp(`->`))return;let e=this.peek();if(!e||e.kind!==`id`||!tje.has(e.value))return;if(this.pos+=1,this.eatOp(`<`)){let e=1;for(;e>0;){let t=this.peek();if(!t)return;this.pos+=1,t.kind===`op`&&t.value===`<`&&(e+=1),t.kind===`op`&&t.value===`>`&&--e}}if(!this.eatOp(`(`))return;let t=this.peek();if(!t||t.kind!==`str`)return;this.pos+=1;let n=t.value;for(;this.eatOp(`,`);){let e=0;for(;;){let t=this.peek();if(!t)return;if(t.kind===`op`&&t.value===`(`&&(e+=1),t.kind===`op`&&t.value===`)`){if(e===0)break;--e}if(t.kind===`op`&&t.value===`,`&&e===0)break;this.pos+=1}}if(!this.eatOp(`)`))return;if(this.eatOp(`->`)){let e=this.peek();if(!e||e.kind!==`id`)return;this.pos+=1}if(e.value===`has`)return this.cfg.has(n);let r=this.cfg.get(n);return this.schema[n]?.enum_values?{enumKey:n,value:typeof r==`string`?r:void 0}:r}resolveLocal(t,n){let r=this.memo.get(t);if(r!==void 0||this.memo.has(t))return r;if(this.resolving.has(t))return;this.resolving.add(t);let i=new e(this.cfg,this.locals,this.schema,this.resolving,this.memo).evaluate(n);return this.resolving.delete(t),this.memo.set(t,i),i}};function rje(e,t,n,r){let i=typeof e==`string`&&e.startsWith(DW)?e:typeof t==`string`&&t.startsWith(DW)?t:void 0;if(i!==void 0){if(n!==`==`&&n!==`!=`)return;let a=i===e?t:e;if(!EW(a))return;let o=r[a.enumKey]?.enum_values;if(!o||a.value===void 0)return;let s=ije(i.slice(5)).filter(e=>o.includes(e));if(s.length!==1)return;let c=s[0]===a.value;return n===`==`?c:!c}let a=EW(e)?e.value:e,o=EW(t)?t.value:t;if(n===`==`||n===`!=`){if(a===void 0||o===void 0)return;let e=typeof a==`string`||typeof o==`string`?String(a)===String(o):OW(a)===OW(o);return n===`==`?e:!e}let s=OW(a),c=OW(o);if(!(s===void 0||c===void 0)){if(n===`<`)return s`)return s>c;if(n===`>=`)return s>=c}}function ije(e){let t=e.includes(`::`)?e.slice(e.lastIndexOf(`::`)+2):e,n=[t,/^[a-z]+([A-Z].*)$/.exec(t)?.[1]].filter(e=>!!e),r=new Set;for(let e of n){let t=e.replace(/([a-z0-9])([A-Z])/g,`$1_$2`).toLowerCase();r.add(t),r.add(t.replace(/_/g,` `)),r.add(t.replace(/_/g,``))}return[...r]}function aje(e,t,n){let r=QAe(e,t),i=new Map,a=new Set;for(let e of n.rules){let o=oje(e.enable_if);if(o&&kW(new nje(r,n.locals,t,new Set,i).evaluate(o))===!1)for(let t of e.fields)a.add(t)}return a}function oje(e){let t=0;for(let n=0;nsje.has(e.type);function AW(e){if(typeof e==`number`)return Number.isFinite(e)?e:void 0;if(typeof e!=`string`)return;let t=Number.parseFloat(e);return Number.isFinite(t)?t:void 0}function lje(e){let t=e.sidetext;if(!(!t||t.includes(`->`)||t.includes(`::`)))return t}function jW(e,t){let n=t===void 0?e.default:t;return n===void 0?``:Array.isArray(n)?n.map(String).join(`, `):typeof n==`boolean`?n?`1`:`0`:String(n)}function MW(e,t){if(cje(e))return(Array.isArray(t)?t.map(String):String(t).split(`,`)).map(e=>e.trim()).filter(e=>e!==``);if(e.type===`coBool`)return typeof t==`boolean`?t?`1`:`0`:t===`1`||t===`true`||t===1?`1`:`0`;let n=String(t).trim();return e.type===`coPercent`?n.endsWith(`%`)?n:`${n}%`:n}function uje(e,t){let n={};for(let[r,i]of Object.entries(e)){let e=t[r];e&&(n[r]=MW(e,i))}return n}function NW(e,t,n){if(t===void 0||t===``)return!1;let r=t=>{let n=MW(e,Array.isArray(t)?t.map(String).join(`, `):t);return Array.isArray(n)?n.join(`, `):n},i=r(t),a=n===void 0?e.default:n;return a===void 0?i!==``:i!==r(a)}var dje=new Set([`support_filament`,`support_interface_filament`,`outer_wall_filament_id`,`inner_wall_filament_id`,`top_surface_filament_id`,`bottom_surface_filament_id`,`internal_solid_filament_id`,`sparse_infill_filament_id`]),fje=[`simple`,`advanced`,`expert`],PW={simple:0,advanced:1,expert:2,develop:3};function pje({values:e,onChange:t,disabled:n=!1,sourceOverrides:r=[],sourceSelected:i,onToggleSource:a,filamentChoices:o,presetValues:s,presetValuesResolved:c=!0,presetValuesReason:l}){let{t:u}=U(),[d,p]=(0,f.useState)(null),[m,h]=(0,f.useState)(`simple`),[g,_]=(0,f.useState)(null),[v,y]=(0,f.useState)(``);(0,f.useEffect)(()=>{let e=!1;return Promise.all([Dt(()=>import(`./process-schema-CzfeynAH.js`),[]),Dt(()=>import(`./process-ui-tree-BWrKRLV6.js`),[]),Dt(()=>import(`./process-toggle-rules-DDBax3G5.js`),[])]).then(([t,n,r])=>{e||p({schema:t.default??t,tree:n.default??n,toggles:r.default??r})}),()=>{e=!0}},[]);let b=(0,f.useMemo)(()=>{let t={...s??{}};for(let e of r)i?.has(e.key)&&(t[e.key]=e.value);for(let[n,r]of Object.entries(e))r!==void 0&&r!==``&&(t[n]=r);return t},[s,r,i,e]),x=(0,f.useMemo)(()=>d?aje(b,d.schema,d.toggles):new Set,[d,b]),S=(0,f.useMemo)(()=>new Map(r.map(e=>[e.key,e])),[r]),C=(0,f.useMemo)(()=>r.filter(e=>!e.printer_coupled&&!e.preset_defining),[r]),w=(0,f.useMemo)(()=>r.filter(e=>i?.has(e.key)).length,[r,i]),T=(0,f.useMemo)(()=>d?r.filter(e=>!d.schema[e.key]):[],[d,r]),E=e=>{if(!d)return;let n={};for(let[t,r]of Object.entries(e))d.schema[t]&&NW(d.schema[t],r,s?.[t])&&(n[t]=r);t(e,uje(n,d.schema))},D=(t,n)=>{let r={...e};n===void 0?delete r[t]:r[t]=n,E(r)},O=(0,f.useMemo)(()=>{if(!d)return[];let e=e=>e.toLowerCase().replace(/[_\s]+/g,` `).trim(),t=e(v),n=e=>PW[d.schema[e]?.mode??`expert`]<=PW[m],r=(n,r,i)=>{if(!t)return!0;let a=d.schema[n];return[n,a?.label??``,a?.tooltip??``,r,i].some(n=>e(n).includes(t))};return d.tree.map(e=>({...e,groups:e.groups.map(t=>({...t,options:t.options.filter(i=>n(i)&&r(i,t.group,e.page))})).filter(e=>e.options.length>0)})).filter(e=>e.groups.length>0)},[d,m,v]),k=(0,f.useMemo)(()=>O.length===0||v.trim()?null:O.find(e=>e.page===g)??O[0],[O,g,v]),A=(0,f.useMemo)(()=>d?Object.keys(e).filter(t=>d.schema[t]&&NW(d.schema[t],e[t],s?.[t])).length:0,[d,e,s]);if(!d)return(0,G.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-8 text-sm text-bambu-gray`,children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),u(`slicerSettings.loading`,`Loading slicer settings...`)]});let j=k?[k]:O;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`flex overflow-hidden rounded border border-bambu-dark-tertiary`,children:fje.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>h(e),disabled:n,className:`px-2.5 py-1 text-xs capitalize transition-colors ${m===e?`bg-bambu-green text-white`:`text-bambu-gray hover:text-white`}`,children:u(`slicerSettings.mode.${e}`,e)},e))}),(0,G.jsxs)(`div`,{className:`relative flex-1 min-w-[10rem]`,children:[(0,G.jsx)(Gl,{className:`absolute left-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-bambu-gray`}),(0,G.jsx)(`input`,{type:`search`,value:v,onChange:e=>y(e.target.value),disabled:n,placeholder:u(`slicerSettings.searchPlaceholder`,`Search settings`),className:`w-full rounded border border-bambu-dark-tertiary bg-bambu-dark pl-7 pr-2 py-1 text-xs text-white placeholder:text-bambu-gray/60 focus:border-bambu-green focus:outline-none disabled:opacity-40`})]}),A>0&&(0,G.jsxs)(`button`,{type:`button`,onClick:()=>E({}),disabled:n,className:`flex items-center gap-1 text-xs text-bambu-gray hover:text-white`,children:[(0,G.jsx)(Ll,{className:`w-3 h-3`}),u(`slicerSettings.resetAll`,`Reset {{count}}`,{count:A})]})]}),!c&&(0,G.jsx)(`p`,{className:`rounded border border-amber-300 bg-amber-50 px-2 py-1 text-[0.7rem] text-amber-800 dark:border-amber-700/40 dark:bg-amber-900/20 dark:text-amber-200`,children:l===`sidecar_outdated`?u(`slicerSettings.presetValuesOutdatedSidecar`,`Showing slicer defaults: your slicer sidecar is older than this feature and can't report a preset's values. Update the sidecar image to see them. Anything you don't change still uses the preset.`):l===`not_configured`?u(`slicerSettings.presetValuesNotConfigured`,`Showing slicer defaults: no slicer sidecar is configured, so a preset's values can't be read. Anything you don't change still uses the preset.`):l===`sidecar_unavailable`?u(`slicerSettings.presetValuesSidecarUnavailable`,`Showing slicer defaults: the slicer sidecar did not answer, so a preset's values can't be read. Anything you don't change still uses the preset.`):u(`slicerSettings.presetValuesUnavailable`,`Showing slicer defaults: the picked preset's own values could not be read. Anything you don't change still uses the preset.`)}),r.length>0&&a&&(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 rounded border border-bambu-dark-tertiary px-2 py-1.5 text-[0.7rem] text-bambu-gray`,children:[(0,G.jsx)(`span`,{className:`min-w-0 flex-1`,children:u(`slicerSettings.fromFileSummary`,`The designer changed {{count}} process settings in this file. Only the ones you tick are used.`,{count:r.length})}),(0,G.jsx)(`button`,{type:`button`,disabled:n,onClick:()=>C.forEach(e=>a(e.key,!0)),title:u(`slicerSettings.fromFileUseAllHint`,`Ticks the settings that carry across printers. The ones tuned for the designer's own printer, and the ones that define the preset you picked, stay off.`),className:`shrink-0 rounded border border-bambu-dark-tertiary px-1.5 py-0.5 hover:text-white disabled:opacity-40`,children:u(`slicerSettings.fromFileUseAll`,`Use the designer's settings`)}),w>0&&(0,G.jsx)(`button`,{type:`button`,disabled:n,onClick:()=>r.forEach(e=>a(e.key,!1)),className:`shrink-0 rounded border border-bambu-dark-tertiary px-1.5 py-0.5 hover:text-white disabled:opacity-40`,children:u(`slicerSettings.fromFileClear`,`Clear {{count}}`,{count:w})})]}),!v.trim()&&(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:O.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>_(e.page),disabled:n,className:`px-2 py-1 text-xs rounded transition-colors ${k?.page===e.page?`bg-bambu-dark-tertiary text-white`:`text-bambu-gray hover:text-white`}`,children:e.page},e.page))}),j.length===0?(0,G.jsx)(`p`,{className:`py-6 text-center text-xs text-bambu-gray`,children:u(`slicerSettings.noMatches`,`No settings match this search.`)}):(0,G.jsxs)(`div`,{className:`flex flex-col gap-4 max-h-[22rem] lg:max-h-[58vh] overflow-y-auto pr-1`,children:[j.map(t=>(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[v.trim()&&(0,G.jsx)(`p`,{className:`text-[0.7rem] uppercase tracking-wide text-bambu-gray/70`,children:t.page}),t.groups.map(r=>(0,G.jsxs)(`fieldset`,{className:`flex flex-col gap-1.5`,children:[(0,G.jsx)(`legend`,{className:`mb-1 text-xs font-medium text-white`,children:r.group}),r.options.map(t=>(0,G.jsx)(mje,{optionKey:t,option:d.schema[t],value:e[t],onChange:e=>D(t,e),disabled:n||x.has(t),disabledBySlicer:x.has(t),formDisabled:n,source:S.get(t),sourceOn:i?.has(t)??!1,onToggleSource:a,filamentChoices:dje.has(t)?o:void 0,presetValue:s?.[t]},t))]},`${t.page}:${r.group}`))]},t.page)),T.length>0&&!v.trim()&&(0,G.jsxs)(`fieldset`,{className:`flex flex-col gap-1.5`,children:[(0,G.jsx)(`legend`,{className:`mb-1 text-xs font-medium text-white`,children:u(`slicerSettings.otherFromFile`,`Other settings from this file`)}),T.map(e=>(0,G.jsxs)(`label`,{className:`flex items-center gap-2 text-xs cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:i?.has(e.key)??!1,disabled:n||!a,onChange:t=>a?.(e.key,t.target.checked),className:`shrink-0 cursor-pointer disabled:opacity-40`}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[(0,G.jsx)(`span`,{className:`font-mono text-bambu-gray`,children:e.key}),(0,G.jsx)(`span`,{className:`ml-1.5 text-white`,children:FW(e.value)})]}),(e.printer_coupled||e.preset_defining)&&(0,G.jsx)(`span`,{className:`shrink-0 rounded bg-amber-100 px-1 py-0.5 text-[10px] text-amber-700 dark:bg-amber-500/20 dark:text-amber-400`,children:e.printer_coupled?u(`slicerSettings.fromFilePrinterCoupled`,`designer's printer`):u(`slicerSettings.fromFileOverridesPreset`,`overrides preset`)})]},e.key))]})]})]})}function mje({optionKey:e,option:t,value:n,onChange:r,disabled:i,disabledBySlicer:a,formDisabled:o,source:s,sourceOn:c=!1,onToggleSource:l,filamentChoices:u,presetValue:d}){let{t:f}=U(),p=NW(t,n,d),m=lje(t),h=n===void 0?c&&s?FW(s.value):jW(t,d):String(n);return(0,G.jsxs)(`div`,{className:`flex items-center gap-2 group`,title:t.tooltip,children:[(0,G.jsxs)(`label`,{htmlFor:`slicer-opt-${e}`,className:`flex min-w-0 flex-1 items-center gap-1 text-xs ${a?`text-bambu-gray/40`:`text-bambu-gray`}`,children:[(0,G.jsx)(`span`,{className:`truncate`,title:t.label||e,children:t.label||e}),p&&(0,G.jsx)(`span`,{className:`shrink-0 text-bambu-green`,"aria-hidden":`true`,children:`•`}),s&&(0,G.jsx)(`span`,{className:`shrink-0 rounded px-1 py-0.5 text-[10px] ${s.printer_coupled||s.preset_defining?`bg-amber-100 text-amber-700 dark:bg-amber-500/20 dark:text-amber-400`:`bg-bambu-green/15 text-bambu-green`}`,title:s.printer_coupled?f(`slicerSettings.fromFilePrinterCoupledHint`,`Tuned for the printer this file was designed for -- may be wrong or out of range on yours.`):s.preset_defining?f(`slicerSettings.fromFileOverridesPresetHint`,`The file sets this to {{value}} where the preset you picked uses {{preset}}. Tick it only if the file should win.`,{value:FW(s.value),preset:jW(t,d)}):f(`slicerSettings.fromFileHint`,`The designer changed this in the source file. Its value is {{value}}.`,{value:FW(s.value)}),children:s.printer_coupled?f(`slicerSettings.fromFilePrinterCoupled`,`designer's printer`):s.preset_defining?f(`slicerSettings.fromFileOverridesPreset`,`overrides preset`):f(`slicerSettings.fromFile`,`from file`)})]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`flex w-3 shrink-0 justify-center`,children:s&&l&&(0,G.jsx)(`input`,{type:`checkbox`,checked:c,disabled:o,onChange:t=>l(e,t.target.checked),"aria-label":f(`slicerSettings.useFromFile`,`Use the source file's value for {{option}}`,{option:t.label||e}),title:f(`slicerSettings.useFromFile`,`Use the source file's value for {{option}}`,{option:t.label||e}),className:`w-3 h-3 cursor-pointer disabled:opacity-40`})}),(0,G.jsx)(`div`,{className:`w-40`,children:(0,G.jsx)(hje,{id:`slicer-opt-${e}`,option:t,current:h,onChange:r,disabled:i,filamentChoices:u})}),(0,G.jsx)(`span`,{className:`w-16 shrink-0 whitespace-nowrap text-[0.65rem] text-bambu-gray/60`,children:m??``}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>r(void 0),disabled:i||!p,"aria-label":f(`slicerSettings.resetOption`,`Reset to default`),className:`p-0.5 transition-opacity ${p?`text-bambu-gray hover:text-white`:`opacity-0 pointer-events-none`}`,children:(0,G.jsx)(Ll,{className:`w-3 h-3`})})]})]})}function FW(e){return Array.isArray(e)?e.map(e=>String(e)).join(`, `):e==null?``:String(e)}function hje({id:e,option:t,current:n,onChange:r,disabled:i,filamentChoices:a}){let{t:o}=U(),s=`w-full rounded border border-bambu-dark-tertiary bg-bambu-dark px-1.5 py-0.5 text-xs text-white focus:border-bambu-green focus:outline-none disabled:opacity-40`;if(a&&a.length>0){let t=a.find(e=>String(e.index)===n);return(0,G.jsxs)(`div`,{className:`relative w-full`,children:[(0,G.jsxs)(`select`,{id:e,value:n,onChange:e=>r(e.target.value),disabled:i,className:`${s} w-full cursor-pointer appearance-none pr-5`,title:t?.label,children:[(0,G.jsx)(`option`,{value:`0`,children:o(`slicerSettings.filamentDefault`,`Default`)}),a.map(e=>(0,G.jsxs)(`option`,{value:String(e.index),children:[e.index,`: `,e.label]},e.index))]}),(0,G.jsx)(ss,{className:`pointer-events-none absolute right-1.5 top-1/2 h-3 w-3 -translate-y-1/2 text-bambu-gray`})]})}return t.type===`coBool`?(0,G.jsx)(`input`,{id:e,type:`checkbox`,checked:n===`1`||n===`true`,onChange:e=>r(e.target.checked),disabled:i,className:`w-3.5 h-3.5 cursor-pointer disabled:opacity-40`}):t.type===`coEnum`&&t.enum_values?(0,G.jsxs)(`div`,{className:`relative w-full`,children:[(0,G.jsx)(`select`,{id:e,value:n,onChange:e=>r(e.target.value),disabled:i,className:`${s} w-full cursor-pointer appearance-none pr-5`,children:t.enum_values.map((e,n)=>(0,G.jsx)(`option`,{value:e,children:t.enum_labels?.[n]??e},e))}),(0,G.jsx)(ss,{className:`pointer-events-none absolute right-1.5 top-1/2 h-3 w-3 -translate-y-1/2 text-bambu-gray`})]}):t.type===`coInt`||t.type===`coFloat`||t.type===`coPercent`?(0,G.jsx)(`input`,{id:e,type:`number`,value:n.replace(`%`,``),min:AW(t.min),max:AW(t.max),step:t.type===`coInt`?1:`any`,onChange:e=>r(e.target.value),disabled:i,className:s}):(0,G.jsx)(`input`,{id:e,type:`text`,value:n,onChange:e=>r(e.target.value),disabled:i,className:s})}var IW=[`local`,`orca_cloud`,`cloud`,`standard`],gje={local:1.75,orca_cloud:1.5,cloud:1,standard:.5};function LW(e,t){for(let n of IW){let r=e[n][t];if(r.length>0)return{source:r[0].source,id:r[0].id}}return null}function RW(e,t,n){return t?e[t.source][n].find(e=>e.id===t.id)??null:null}function zW(e,t,n){if(!n)return null;for(let r of IW){let i=e[r][t].find(e=>e.name===n);if(i)return{source:i.source,id:i.id}}return null}function _je(e,t,n,r){let i=zW(e,`process`,r);if(i){let r=RW(e,i,`process`);if(r&&cU(r,`process`,t,n)!==`mismatch`)return i}for(let r of[`match`,`unknown`])for(let i of IW){let a=bje(e[i].process.filter(e=>cU(e,`process`,t,n)===r));if(a)return{source:a.source,id:a.id}}return LW(e,`process`)}var vje=.2,yje=/^\s*([\d.]+)\s*mm\b/i;function bje(e){let t=null,n=1/0,r=-1/0;for(let i of e){let e=yje.exec(i.name),a=e?Number.parseFloat(e[1]):NaN,o=Number.isFinite(a)&&a>0,s=o?Math.abs(a-vje):1/0;(t==null||sr)&&(t=i,n=s,r=o?a:-1/0)}return t}function BW(e,t){let n=t.trim().toUpperCase(),r=(e.filament_type??``).trim().toUpperCase();return!!n&&!!r&&n!==r}function xje(e,t,n,r){let i=t.type.trim().toUpperCase(),a=op(t.color),o=null,s=null,c=null;for(let l of IW)for(let u of e[l].filament){let e=0,d=(u.filament_type??``).trim().toUpperCase(),f=op(u.filament_colour??``);i&&d&&i===d&&(e+=10),a&&f&&(f===a?e+=5:hp(u.filament_colour??``,t.color)&&(e+=2)),e+=gje[l];let p={source:u.source,id:u.id};BW(u,i)?(c==null||e>c.score)&&(c={ref:p,score:e}):cU(u,`filament`,n,r)===`mismatch`?(s==null||e>s.score)&&(s={ref:p,score:e}):(o==null||e>o.score)&&(o={ref:p,score:e})}return o==null?s==null?c==null?LW(e,`filament`):c.ref:s.ref:o.ref}function VW(e){return e?`${e.source}:${e.id}`:``}function Sje(e){if(!e)return null;let t=e.indexOf(`:`);if(t<0)return null;let n=e.slice(0,t),r=e.slice(t+1);return n!==`orca_cloud`&&n!==`cloud`&&n!==`local`&&n!==`standard`?null:{source:n,id:r}}function Cje({requestId:e,sourceName:t}){let{t:n}=U(),{showPersistentToast:r,dismissToast:i}=Hd(),[a,o]=(0,f.useState)(0),[s,c]=(0,f.useState)(null),l=t;try{l=decodeURIComponent(t)}catch{}(0,f.useEffect)(()=>{let e=Date.now(),t=setInterval(()=>o(Math.floor((Date.now()-e)/1e3)),1e3);return()=>clearInterval(t)},[]),(0,f.useEffect)(()=>{let t=!1,n=setInterval(async()=>{if(t)return;let n=await Z.getPreviewSliceProgress(e);!t&&n&&c(n)},1e3);return()=>{t=!0,clearInterval(n)}},[e]);let u=`slice-preview-${e}`;(0,f.useEffect)(()=>{let e=s&&s.stage&&s.total_percent>0,t=wje(a);return e?r(u,n(`slice.previewWithProgress`,`Analyzing {{name}} — {{stage}} ({{percent}}%) — {{elapsed}}`,{name:l,stage:s.stage,percent:Math.min(100,Math.max(0,Math.round(s.total_percent))),elapsed:t}),`loading`):r(u,n(`slice.previewToast`,{name:l,elapsed:t}),`loading`),()=>{i(u)}},[a,s,l,r,i,n,u]);let d=s?.stage,p=s?.total_percent,m=d&&typeof p==`number`&&p>0?`${d} (${Math.min(100,Math.max(0,Math.round(p)))}%)`:n(`slice.analyzingPlateFilaments`);return(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 text-bambu-gray text-sm py-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),m,(0,G.jsxs)(`span`,{className:`text-xs tabular-nums`,children:[a,`s`]})]}),a>=5&&(0,G.jsx)(`div`,{className:`text-xs text-bambu-gray/70 pl-6`,children:n(`slice.analyzingPlateFilamentsHint`,`Running a preview slice to discover which AMS slots this plate uses. Cached after — re-opening is instant.`)})]})}function wje(e){let t=Math.max(0,Math.floor(e));if(t<60)return`${t}s`;let n=Math.floor(t/60),r=t%60;return n<60?`${n}m ${r}s`:`${Math.floor(n/60)}h ${n%60}m`}var Tje=`#00AE42`;function HW(e){let t=(e||``).trim();return/^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/.test(t)?t.slice(0,7).toUpperCase():Tje}function UW({source:e,onClose:t}){let{t:n}=U(),{trackJob:r}=CW(),i=no(),[a,o]=(0,f.useState)(null),[s,c]=(0,f.useState)(null),[l,u]=(0,f.useState)([]),d=(0,f.useRef)(new Set),[p,m]=(0,f.useState)([]),[h,g]=(0,f.useState)(null),[_,v]=(0,f.useState)(null),[y,b]=(0,f.useState)(!1),[x,S]=(0,f.useState)(null),[C,w]=(0,f.useState)(!1),[T,E]=(0,f.useState)(!1),[D,O]=(0,f.useState)(!1),[k,A]=(0,f.useState)(new Set),[j,M]=(0,f.useState)({}),[N,P]=(0,f.useState)({}),[F,I]=(0,f.useState)(!1),L=ZAe(),R=L||F,z=K({queryKey:[`slicer-pipelines`],queryFn:()=>Z.listSlicerPipelines(),staleTime:6e4}),[B,V]=(0,f.useState)(!1),[ee,te]=(0,f.useState)(``),{showToast:ne}=Hd(),re=q({mutationFn:e=>Z.createSlicerPipeline(e),onSuccess:()=>{i.invalidateQueries({queryKey:[`slicer-pipelines`]}),ne(n(`slice.pipelines.toast.saved`,`Pipeline saved`),`success`),V(!1),te(``)},onError:e=>{ne(e.message||n(`slice.pipelines.toast.saveFailed`,`Save failed`),`error`)}}),ie=K({queryKey:[`slicePlates`,e.kind,e.id],queryFn:async()=>e.kind===`libraryFile`?Z.getLibraryFilePlates(e.id):Z.getArchivePlates(e.id),staleTime:6e4}),ae=!!ie.data?.is_multi_plate&&(ie.data?.plates?.length??0)>1,oe=ae&&_==null,se=_??1,H=(0,f.useMemo)(()=>{let t=typeof crypto<`u`&&`randomUUID`in crypto?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`;return`${e.kind}-${e.id}-p${se}-${t}`},[e.kind,e.id,se]),ce=K({queryKey:[`sliceFilamentReqs`,e.kind,e.id,se],queryFn:async()=>e.kind===`libraryFile`?Z.getLibraryFileFilamentRequirements(e.id,se,H,!0):Z.getArchiveFilamentRequirements(e.id,se,H,!0),enabled:!oe,staleTime:6e4}),le=(0,f.useMemo)(()=>{let e=ce.data?.filaments??[],t=e.length>0?e:[{slot_id:1,type:``,color:``,used_grams:0,used_meters:0}];return y?t.map(e=>({...e,used_in_plate:!0})):t},[y,ce.data]),ue=K({queryKey:[`slicerPresets`],queryFn:()=>Z.getSlicerPresets(),staleTime:6e4,enabled:!ie.isLoading&&!oe}),[de,fe]=(0,f.useState)(!1),pe=async()=>{if(!de){fe(!0);try{let e=await Z.getSlicerPresets({refresh:!0});i.setQueryData([`slicerPresets`],e)}catch{i.invalidateQueries({queryKey:[`slicerPresets`]})}finally{fe(!1)}}},me=K({queryKey:[`slicerPrinterModels`],queryFn:Z.getSlicerPrinterModels,staleTime:1/0}),he=(0,f.useMemo)(()=>!ue.data||!a?null:RW(ue.data,a,`printer`)?.name??null,[ue.data,a]),ge=(0,f.useMemo)(()=>nU(me.data??{}),[me.data]),_e=K({queryKey:[`slicer-preset-values`,s?.source,s?.id],queryFn:()=>Z.getSlicerPresetValues(s),enabled:s!=null,staleTime:5*6e4}),ve=_e.data?.values,ye=_e.data?.resolved??_e.isLoading,be=_e.data?.reason??(_e.isError?`sidecar_unavailable`:void 0),xe=(0,f.useMemo)(()=>{let e=ue.data;return le.map((t,r)=>{let i=l[r]??null,a=e&&i?RW(e,i,`filament`):null;return{index:r+1,label:a?.name||t.type||n(`slice.filamentSlotUnset`,`not set`),color:t.color||void 0}})},[le,l,ue.data,n]),Se=ie.data?.embedded_printer??null,Ce=(0,f.useMemo)(()=>ie.data?.design_overrides??[],[ie.data]),we=ie.data?.embedded_process??null,Te=(0,f.useMemo)(()=>{if(!Se||!we||!he)return!1;let e=e=>e.replace(/^#\s*/,``).trim().toLowerCase();return e(he)===e(Se)},[Se,we,he]);(0,f.useEffect)(()=>{Te||w(!1)},[Te]),(0,f.useEffect)(()=>{A(C?new Set(Ce.map(e=>e.key)):new Set)},[Ce,C]),(0,f.useEffect)(()=>{let e=ue.data;e&&(a??o(zW(e,`printer`,Se)??LW(e,`printer`)))},[ue.data,Se]),(0,f.useEffect)(()=>{let e=ue.data;e&&c(t=>{if(t){let n=RW(e,t,`process`);if(n&&cU(n,`process`,he,ge)!==`mismatch`)return t}return _je(e,he,ge,we)})},[ue.data,he,ge,we]),(0,f.useEffect)(()=>{let e=ue.data;e&&u(t=>le.map((n,r)=>{let i=t[r]??null;if(i){let t=RW(e,i,`filament`),a=t&&!d.current.has(r)&&BW(t,n.type);if(t&&!a&&cU(t,`filament`,he,ge)!==`mismatch`)return i}return xje(e,{type:n.type,color:n.color},he,ge)}))},[ue.data,le,he,ge]),(0,f.useEffect)(()=>{m(e=>e.length===le.length?e:(d.current=new Set,le.map(()=>null)))},[le]);let Ee=q({mutationFn:async t=>{let n=De(t);return e.kind===`libraryFile`?Z.sliceLibraryFile(e.id,n):Z.sliceArchive(e.id,n)},onSuccess:n=>{r(n.job_id,e.kind,e.filename),t()},onError:e=>{g(e instanceof Error?e.message:String(e))}});function De(e){if(!a||!s||l.length===0||l.some(e=>e==null))throw Error(n(`slice.allPresetsRequired`));return{printer_preset:a,process_preset:s,filament_preset:l[0],filament_presets:l,filament_colours:le.map((e,t)=>p[t]??e.color??``),...e==null?{}:{plate:e},...x==null?{}:{bed_type:x},...C&&Te?{use_embedded_settings:!0}:{},...!C&&Ce.length>0?{design_overrides:[...k]}:{},...!C&&Object.keys(j).length>0?{process_overrides:N}:{},...T?{auto_orient:!0}:{},...D?{auto_arrange:!0}:{}}}let Oe=a!=null&&s!=null&&ce.isSuccess&&l.length>0&&l.every(e=>e!=null),ke=Ee.isPending,Ae=ie.data?.plates?.length??0,je=ae&&Ae>1&&!oe;return oe&&ie.data?(0,G.jsx)(TW,{plates:ie.data.plates,onSelect:e=>v(e),onClose:t}):(0,G.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4`,onClick:()=>{ke||t()},children:(0,G.jsxs)(`div`,{className:`w-full max-w-xl lg:max-w-5xl xl:max-w-7xl 2xl:max-w-[96rem] max-h-[85vh] flex flex-col rounded-lg bg-bambu-dark-secondary border border-bambu-dark-tertiary/60`,onClick:e=>e.stopPropagation(),children:[(0,G.jsxs)(`div`,{className:`flex-shrink-0 flex items-start justify-between gap-3 px-4 pt-4 pb-3 border-b border-bambu-dark-tertiary/40`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`h3`,{className:`text-white font-medium flex items-center gap-2`,children:[(0,G.jsx)(Ms,{className:`w-4 h-4`}),n(`slice.title`)]}),(0,G.jsxs)(`p`,{className:`text-xs text-bambu-gray mt-1 truncate`,title:e.filename,children:[e.filename,_==null?``:` • ${n(`archives.platePicker.plateLabel`,{index:_})}`]})]}),(0,G.jsx)(`button`,{onClick:t,disabled:ke,className:`flex-shrink-0 text-bambu-gray hover:text-white transition-colors disabled:opacity-50`,"aria-label":n(`common.close`),children:(0,G.jsx)(Zu,{className:`w-5 h-5`})})]}),(0,G.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4 space-y-4`,children:[(ie.isLoading||ue.isLoading)&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-bambu-gray text-sm`,children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),n(`slice.loadingPresets`)]}),ue.isError&&(0,G.jsx)(`div`,{className:`text-sm text-red-700 dark:text-red-400`,role:`alert`,children:n(`slice.presetsLoadFailed`,`Failed to load presets. Open Settings → Profiles to import them, or sign in to Bambu Cloud.`)}),ue.data&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,G.jsx)(WW,{status:ue.data.cloud_status,cloudName:`bambu`}),(0,G.jsx)(WW,{status:ue.data.orca_cloud_status,cloudName:`orca`})]}),(0,G.jsxs)(`button`,{type:`button`,onClick:pe,disabled:de||ke,className:`flex-shrink-0 inline-flex items-center gap-1 px-2 py-1 rounded-md text-xs text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary/40 disabled:opacity-50 disabled:cursor-not-allowed transition-colors`,title:n(`slice.refreshPresetsTitle`),"aria-label":n(`slice.refreshPresets`),children:[(0,G.jsx)(Fl,{className:`w-3.5 h-3.5 ${de?`animate-spin`:``}`}),n(`slice.refreshPresets`)]})]}),(0,G.jsxs)(`div`,{className:`lg:grid lg:grid-cols-[minmax(20rem,2fr)_minmax(0,3fr)] lg:gap-5 lg:items-start`,children:[(0,G.jsxs)(`div`,{className:`space-y-4 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-2 py-1.5 rounded-md bg-bambu-dark/40 border border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`span`,{className:`text-xs font-medium text-bambu-gray flex items-center gap-1`,children:[(0,G.jsx)(Ms,{className:`w-3.5 h-3.5`}),` `,n(`slice.pipelines.label`,`Pipeline`)]}),(0,G.jsxs)(`select`,{value:``,disabled:ke||(z.data?.pipelines.length??0)===0,onChange:e=>{let t=parseInt(e.target.value,10);if(Number.isNaN(t))return;let r=z.data?.pipelines.find(e=>e.id===t);r&&(o(r.printer_preset),c(r.process_preset),S(r.bed_type),u(e=>{let t=e.length>0?[...e]:r.filament_presets.map(()=>null);for(let e=0;e(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),B?(0,G.jsxs)(`div`,{className:`flex items-center gap-1 flex-1 min-w-[16ch]`,children:[(0,G.jsx)(`input`,{autoFocus:!0,value:ee,onChange:e=>te(e.target.value),placeholder:n(`slice.pipelines.namePlaceholder`,`Pipeline name`),"aria-label":n(`slice.pipelines.nameAria`,`New pipeline name`),className:`flex-1 text-xs px-2 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>{let e=ee.trim();if(!e||!a||!s)return;let t=l.filter(e=>e!==null);t.length!==0&&re.mutate({name:e,printer_preset:a,process_preset:s,filament_presets:t,bed_type:x})},disabled:re.isPending||!ee.trim(),className:`text-xs px-2 py-1 bg-bambu-green hover:bg-bambu-green/80 text-white rounded disabled:opacity-50`,children:re.isPending?(0,G.jsx)(Y,{className:`w-3 h-3 animate-spin`}):n(`common.save`,`Save`)}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>{V(!1),te(``)},className:`text-xs px-2 py-1 text-bambu-gray hover:text-white`,children:n(`common.cancel`,`Cancel`)})]}):(0,G.jsx)(`button`,{type:`button`,onClick:()=>{te(``),V(!0)},disabled:ke||!a||!s||l.length===0||l.some(e=>e===null),className:`text-xs px-2 py-1 bg-bambu-green/20 hover:bg-bambu-green/30 text-bambu-green border border-bambu-green/40 rounded disabled:opacity-50 disabled:cursor-not-allowed`,title:n(`slice.pipelines.saveTitle`,`Save the current four-slot selection as a reusable pipeline`),children:n(`slice.pipelines.saveButton`,`Save as pipeline`)})]}),(0,G.jsx)(GW,{label:n(`slice.printer`),slot:`printer`,data:ue.data,value:a,onChange:o,disabled:ke||C}),Te&&(0,G.jsxs)(`label`,{className:`flex items-start gap-2 text-sm text-bambu-gray cursor-pointer select-none`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:C,onChange:e=>w(e.target.checked),disabled:ke,className:`mt-0.5 cursor-pointer`}),(0,G.jsxs)(`span`,{children:[n(`slice.useEmbedded`),(0,G.jsx)(`span`,{className:`block text-xs text-bambu-gray/70`,children:n(`slice.useEmbeddedHint`)})]})]}),(0,G.jsx)(GW,{label:n(`slice.process`),slot:`process`,data:ue.data,value:s,onChange:c,disabled:ke||C,selectedPrinterName:he,compatIndex:ge}),(0,G.jsx)(Dje,{value:x,onChange:S,disabled:ke||C}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsxs)(`label`,{className:`flex items-start gap-2 text-sm text-bambu-gray cursor-pointer select-none`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:T,onChange:e=>E(e.target.checked),disabled:ke,className:`mt-0.5 cursor-pointer`}),(0,G.jsxs)(`span`,{children:[n(`slice.autoOrient`),(0,G.jsx)(`span`,{className:`block text-xs text-bambu-gray/70`,children:n(`slice.autoOrientHint`)})]})]}),(0,G.jsxs)(`label`,{className:`flex items-start gap-2 text-sm text-bambu-gray cursor-pointer select-none`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:D,onChange:e=>O(e.target.checked),disabled:ke,className:`mt-0.5 cursor-pointer`}),(0,G.jsxs)(`span`,{children:[n(`slice.autoArrange`),(0,G.jsx)(`span`,{className:`block text-xs text-bambu-gray/70`,children:n(`slice.autoArrangeHint`)})]})]})]}),ce.isLoading?(0,G.jsx)(Cje,{requestId:H,sourceName:e.filename}):le.map((e,t)=>{let r=e.used_in_plate!==!1,i=le.length>1?n(`slice.filamentSlot`,{index:t+1,type:e.type}):n(`slice.filament`);return(0,G.jsx)(GW,{label:r?i:`${i} ${n(`slice.notUsedByPlate`)}`,slot:`filament`,data:ue.data,value:l[t]??null,onChange:e=>{d.current.add(t),u(n=>{let r=n.length===le.length?[...n]:le.map((e,t)=>n[t]??null);return r[t]=e,r})},disabled:ke||!r||C,swatchColor:p[t]??e.color,swatchColorLabel:n(`slice.filamentColour`),onSwatchColorChange:e=>m(n=>{let r=n.length===le.length?[...n]:le.map((e,t)=>n[t]??null);return r[t]=e,r}),selectedPrinterName:he,compatIndex:ge},`filament-${t}`)})]}),(0,G.jsx)(`div`,{className:`mt-4 lg:mt-0 min-w-0`,children:(0,G.jsxs)(`div`,{className:`rounded border border-bambu-dark-tertiary p-3 ${C?`opacity-60`:``}`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>I(e=>!e),"aria-expanded":R,disabled:L,className:`flex w-full items-center justify-between gap-2 text-left lg:cursor-default`,children:[(0,G.jsxs)(`span`,{className:`text-sm text-white`,children:[n(`slice.processSettings`,`Process settings`),(0,G.jsx)(`span`,{className:`block text-xs text-bambu-gray/70`,children:C?n(`slice.processSettingsEmbedded`,`Not used while "Use the file's built-in settings" is on -- the file's own settings drive this slice.`):n(`slice.processSettingsHint`,`Adjust the picked preset for this slice. Anything you don't touch stays as the preset defines it.`)})]}),(0,G.jsx)(`span`,{className:`shrink-0 text-xs text-bambu-gray`,children:C?n(`slice.processSettingsInactive`,`Inactive`):Object.keys(N).length>0?n(`slice.processSettingsChanged`,`{{count}} changed`,{count:Object.keys(N).length}):n(`slice.processSettingsUnchanged`,`Preset defaults`)})]}),R&&(0,G.jsx)(`div`,{className:`mt-3 border-t border-bambu-dark-tertiary pt-3`,children:(0,G.jsx)(pje,{values:j,onChange:(e,t)=>{M(e),P(t)},disabled:ke||C,filamentChoices:xe,presetValues:ve,presetValuesResolved:ye,presetValuesReason:be,sourceOverrides:Ce,sourceSelected:k,onToggleSource:(e,t)=>A(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})})})]})})]})]}),h&&(0,G.jsx)(`div`,{className:`text-sm text-red-700 dark:text-red-400 bg-red-900/20 border border-red-900/40 rounded p-2`,role:`alert`,children:h})]}),(0,G.jsxs)(`div`,{className:`flex-shrink-0 flex justify-end gap-2 px-4 py-3 border-t border-bambu-dark-tertiary/40`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:t,disabled:ke,className:`px-3 py-1.5 text-sm rounded-md border border-bambu-dark-tertiary text-bambu-gray hover:text-white hover:border-bambu-gray transition-colors disabled:opacity-50`,children:n(`common.cancel`)}),je&&(0,G.jsxs)(`label`,{className:`flex items-center gap-2 mr-auto text-sm text-bambu-gray cursor-pointer select-none`,title:n(`slice.actionAllTitle`,{count:Ae}),children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:y,onChange:e=>b(e.target.checked),disabled:ke,className:`cursor-pointer`}),n(`slice.allPlatesToggle`,{count:Ae})]}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>{g(null);let e=y?0:_;Ee.mutate(e)},disabled:!Oe||ke,className:`px-3 py-1.5 text-sm rounded-md bg-bambu-green hover:bg-bambu-green/90 text-bambu-dark font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2`,children:ke?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),n(`slice.enqueuing`)]}):y?n(`slice.actionAll`,{count:Ae}):n(`slice.action`)})]})]})})}function WW({status:e,cloudName:t=`bambu`}){let{t:n}=U();if(e===`ok`||e===`not_authenticated`)return null;let r=t===`orca`?{expired:{key:`slice.orcaCloud.expired`,fallback:`Orca Cloud session expired — sign in again to refresh your Orca presets.`},unreachable:{key:`slice.orcaCloud.unreachable`,fallback:`Orca Cloud is unreachable right now. Other presets still work.`}}:{expired:{key:`slice.cloud.expired`,fallback:`Bambu Cloud session expired — sign in again to refresh your cloud presets.`},unreachable:{key:`slice.cloud.unreachable`,fallback:`Bambu Cloud is unreachable right now. Local and standard presets still work.`}},{tone:i,icon:a}={expired:{tone:`border-amber-300 dark:border-amber-700/40 bg-amber-50 dark:bg-amber-900/20 text-amber-800 dark:text-amber-200`,icon:Es},unreachable:{tone:`border-bambu-dark-tertiary/40 bg-bambu-dark text-bambu-gray`,icon:Es}}[e],{key:o,fallback:s}=r[e];return(0,G.jsxs)(`div`,{className:`flex items-start gap-2 text-xs rounded-md border p-2 ${i}`,role:`status`,children:[(0,G.jsx)(a,{className:`w-4 h-4 flex-shrink-0 mt-0.5`}),(0,G.jsx)(`span`,{children:n(o,s)})]})}var Eje=[{value:`Cool Plate`,labelKey:`slice.bedType.coolPlate`,fallback:`Cool Plate`},{value:`Cool Plate (SuperTack)`,labelKey:`slice.bedType.coolPlateSuperTack`,fallback:`Cool Plate SuperTack`},{value:`Engineering Plate`,labelKey:`slice.bedType.engineering`,fallback:`Engineering Plate`},{value:`High Temp Plate`,labelKey:`slice.bedType.highTemp`,fallback:`High Temp Plate`},{value:`Textured PEI Plate`,labelKey:`slice.bedType.texturedPEI`,fallback:`Textured PEI Plate`},{value:`Smooth PEI Plate`,labelKey:`slice.bedType.smoothPEI`,fallback:`Smooth PEI Plate`}];function Dje({value:e,onChange:t,disabled:n}){let{t:r}=U();return(0,G.jsxs)(`label`,{className:`block`,children:[(0,G.jsx)(`span`,{className:`block text-xs text-bambu-gray mb-1`,children:r(`slice.bedType.label`)}),(0,G.jsxs)(`select`,{value:e??``,onChange:e=>t(e.target.value===``?null:e.target.value),disabled:n,className:`flex-1 min-w-0 px-3 py-2 rounded-md bg-bambu-dark border border-bambu-dark-tertiary text-white text-sm focus:outline-none focus:border-bambu-gray disabled:opacity-50`,children:[(0,G.jsx)(`option`,{value:``,children:r(`slice.bedType.auto`)}),Eje.map(e=>(0,G.jsx)(`option`,{value:e.value,children:r(e.labelKey,e.fallback)},e.value))]})]})}function GW({label:e,slot:t,data:n,value:r,onChange:i,disabled:a,swatchColor:o,onSwatchColorChange:s,swatchColorLabel:c,selectedPrinterName:l,compatIndex:u}){let{t:d}=U(),[p,m]=(0,f.useState)(!1),h=(0,f.useId)(),g=`${h}-colour`,{sections:_,otherEntries:v}=(0,f.useMemo)(()=>{let e=[{key:`local`,label:`slice.tier.local`,fallback:`Imported`},{key:`orca_cloud`,label:`slice.tier.orcaCloud`,fallback:`Orca Cloud`},{key:`cloud`,label:`slice.tier.cloud`,fallback:`Bambu Cloud`},{key:`standard`,label:`slice.tier.standard`,fallback:`Standard`}],r=t!==`printer`,i=[],a=[],o=[];for(let{key:s,label:c,fallback:f}of e){let e=n[s][t];if(e.length>0&&a.push({tierLabel:d(c,f),entries:e}),!r){e.length>0&&i.push({tierLabel:d(c,f),entries:e});continue}let p=[];for(let n of e)cU(n,t,l??null,u??Uke)===`mismatch`?o.push(n):p.push(n);p.length>0&&i.push({tierLabel:d(c,f),entries:p})}return i.length===0&&o.length>0?{sections:a,otherEntries:[]}:{sections:i,otherEntries:o}},[n,t,d,l,u]),y=VW(r),b=(0,f.useMemo)(()=>p?v:v.filter(e=>`${e.source}:${e.id}`===y),[p,v,y]),x=v.length-b.length,S=_.reduce((e,t)=>e+t.entries.length,0)+b.length;return(0,G.jsxs)(`div`,{className:`block`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-bambu-gray mb-1`,children:[!s&&o&&(0,G.jsx)(`span`,{className:`inline-block w-3 h-3 rounded-full border border-bambu-dark-tertiary`,style:{backgroundColor:o},"aria-hidden":!0}),(0,G.jsx)(`label`,{htmlFor:h,children:e}),(x>0||p)&&(0,G.jsxs)(`span`,{className:`ml-auto flex items-center gap-1.5 font-normal`,children:[x>0&&(0,G.jsx)(`span`,{className:`text-bambu-gray/60`,children:d(`slice.presetsHidden`,`{{count}} hidden`,{count:x})}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>m(e=>!e),disabled:a,className:`text-bambu-green hover:underline disabled:opacity-50 disabled:no-underline`,children:p?d(`slice.showFewerPresets`,`Show fewer`):d(`slice.showAllPresets`,`Show all`)})]})]}),(0,G.jsxs)(`div`,{className:`flex items-stretch gap-2`,children:[(0,G.jsxs)(`select`,{id:h,value:VW(r),onChange:e=>i(Sje(e.target.value)),disabled:a||S===0,className:`w-full px-3 py-2 rounded-md bg-bambu-dark border border-bambu-dark-tertiary text-white text-sm focus:outline-none focus:border-bambu-gray disabled:opacity-50`,children:[(0,G.jsx)(`option`,{value:``,children:d(S===0?`slice.noPresetsForSlot`:`slice.selectPreset`)}),_.map(e=>(0,G.jsx)(`optgroup`,{label:e.tierLabel,children:e.entries.map(e=>(0,G.jsx)(`option`,{value:`${e.source}:${e.id}`,children:e.name},`${e.source}:${e.id}`))},e.tierLabel)),b.length>0&&(0,G.jsx)(`optgroup`,{label:d(`slice.otherPrinters`),children:b.map(e=>(0,G.jsx)(`option`,{value:`${e.source}:${e.id}`,children:e.name},`${e.source}:${e.id}`))})]}),s&&(0,G.jsxs)(`label`,{htmlFor:g,title:c,className:`flex items-center gap-2 px-2.5 rounded-md bg-bambu-dark border border-bambu-dark-tertiary text-sm ${a?`opacity-50 cursor-not-allowed`:`cursor-pointer hover:border-bambu-gray transition-colors`}`,children:[(0,G.jsx)(`input`,{id:g,type:`color`,value:HW(o),onChange:e=>s(e.target.value.toUpperCase()),disabled:a,"aria-label":c,style:{backgroundColor:HW(o)},className:`slice-colour-swatch w-4 h-4 shrink-0 rounded-full border border-bambu-dark-tertiary p-0 disabled:cursor-not-allowed enabled:cursor-pointer`}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-white tracking-tight`,children:HW(o)})]})]})]})}function KW({source:e,onClose:t}){let{t:n}=U(),r=no(),{showToast:i}=Hd(),[a,o]=(0,f.useState)(null),[s,c]=(0,f.useState)(null),[l,u]=(0,f.useState)(1),{trackJob:d}=CW(),{data:p,isLoading:m}=K({queryKey:[`slicer-pipelines`],queryFn:()=>Z.listSlicerPipelines()}),{data:h}=K({queryKey:[`printers`],queryFn:()=>Z.getPrinters()}),{data:g}=K({queryKey:[`app-settings`],queryFn:()=>Z.getSettings()}),_=g?.pipeline_max_copies??50,v={kind:e.kind,id:e.id},y=q({mutationFn:e=>Z.checkPipelineEligibility(e,v)}),b=q({mutationFn:({pipelineId:e,force:t})=>Z.runPipeline(e,v,t,l),onSuccess:a=>{r.invalidateQueries({queryKey:[`slicer-pipelines`]}),r.invalidateQueries({queryKey:[`pipeline-runs`]}),a.slice_job_id&&d(a.slice_job_id,e.kind,e.filename),i(n(`library.runWithPipeline.toast.started`,`Pipeline run started`),`success`),t()},onError:e=>{i(e.message||n(`library.runWithPipeline.toast.failed`,`Could not start run`),`error`)}}),x=p?.pipelines??[],S=(h??[]).reduce((e,t)=>(e[t.id]=t,e),{});return(0,G.jsx)(`div`,{className:`fixed inset-0 z-50 bg-black/60 flex items-center justify-center p-4`,onClick:t,role:`dialog`,"aria-modal":`true`,"aria-label":n(`library.runWithPipeline.modalTitle`,`Run with pipeline`),children:(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-2xl w-full max-w-md max-h-[80vh] flex flex-col overflow-hidden`,onClick:e=>e.stopPropagation(),children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`h3`,{className:`text-sm font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(El,{className:`w-4 h-4 text-bambu-green`}),a&&s?n(`library.runWithPipeline.confirmTitle`,`Confirm run`):n(`library.runWithPipeline.modalTitle`,`Run with pipeline`)]}),(0,G.jsx)(`button`,{type:`button`,onClick:t,"aria-label":n(`common.close`,`Close`),className:`text-bambu-gray hover:text-white`,children:(0,G.jsx)(Zu,{className:`w-4 h-4`})})]}),(0,G.jsx)(`div`,{className:`flex-1 overflow-y-auto p-4 space-y-3`,children:a&&s?(0,G.jsx)(kje,{pipeline:a,report:s,source:e,onBack:()=>{o(null),c(null)},onConfirm:()=>{a&&b.mutate({pipelineId:a.id,force:!0})},running:b.isPending}):(0,G.jsx)(Oje,{source:e,pipelines:x,printerById:S,loading:m||y.isPending,onPick:async e=>{if(!(e.target_printer_id||e.target_kind===`printer_class`&&e.target_model_class)){i(n(`library.runWithPipeline.noTargetMessage`,`This pipeline has no target printer set. Open it in Settings to pick one.`),`error`);return}o(e);try{let t=await y.mutateAsync(e.id);c(t),t.ok&&b.mutate({pipelineId:e.id,force:!1})}catch{o(null)}},copies:l,maxCopies:_,onCopiesChange:u})})]})})}function Oje({source:e,pipelines:t,printerById:n,loading:r,onPick:i,copies:a,maxCopies:o,onCopiesChange:s}){let{t:c}=U();return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`p`,{className:`text-xs text-bambu-gray`,children:[c(`library.runWithPipeline.sourceHint`,`Source`),`:`,` `,(0,G.jsx)(`span`,{className:`text-white`,children:e.filename})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`label`,{className:`text-xs text-bambu-gray`,htmlFor:`run-pipeline-copies`,children:[c(`library.runWithPipeline.copies`,`Copies`),`:`]}),(0,G.jsx)(`input`,{id:`run-pipeline-copies`,type:`number`,min:1,max:o,value:a,onChange:e=>{let t=parseInt(e.target.value,10);Number.isNaN(t)||s(Math.max(1,Math.min(o,t)))},"aria-label":c(`library.runWithPipeline.copies`,`Copies`),className:`w-20 px-2 py-1 text-xs bg-bambu-dark border border-bambu-dark-tertiary rounded text-white`}),(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray/60`,children:c(`library.runWithPipeline.copiesHint`,`max {{n}}`,{n:o})})]}),r&&(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`}),c(`library.runWithPipeline.loading`,`Loading…`)]}),!r&&t.length===0&&(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:c(`library.runWithPipeline.empty`,`No pipelines saved yet. Open the Slice dialog and click "Save as pipeline" to create one.`)}),!r&&t.length>0&&(0,G.jsx)(`ul`,{className:`space-y-1.5`,"aria-label":c(`library.runWithPipeline.pipelineListAria`,`Available pipelines`),children:t.map(e=>{let t=e.target_kind===`printer_class`,r=e.target_printer_id?n[e.target_printer_id]?.name:null,a=t&&e.target_model_class?c(`library.runWithPipeline.classTarget`,`Any {{model}}`,{model:e.target_model_class}):null;return(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>i(e),disabled:!(e.target_printer_id||t&&e.target_model_class),className:`w-full text-left px-3 py-2 rounded-md border border-bambu-dark-tertiary bg-bambu-dark/40 hover:bg-bambu-dark-tertiary disabled:opacity-50 disabled:cursor-not-allowed transition-colors`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Ms,{className:`w-3.5 h-3.5 text-bambu-green flex-shrink-0`}),(0,G.jsx)(`span`,{className:`text-sm font-medium text-white truncate`,children:e.name})]}),(0,G.jsxs)(`div`,{className:`mt-1 text-xs text-bambu-gray flex items-center gap-1`,children:[(0,G.jsx)(jl,{className:`w-3 h-3`}),a?(0,G.jsx)(`span`,{children:a}):r?(0,G.jsx)(`span`,{children:r}):(0,G.jsx)(`span`,{className:`text-amber-700 dark:text-amber-400`,children:c(`library.runWithPipeline.noTarget`,`No target printer set`)})]})]})},e.id)})})]})}function kje({pipeline:e,report:t,source:n,onBack:r,onConfirm:i,running:a}){let{t:o}=U();return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`text-xs text-bambu-gray`,children:[(0,G.jsxs)(`p`,{children:[o(`library.runWithPipeline.confirmIntro`,`Pre-flight found issues with this run`),`:`]}),(0,G.jsxs)(`p`,{className:`mt-1`,children:[(0,G.jsxs)(`span`,{className:`text-bambu-gray/70`,children:[o(`library.runWithPipeline.sourceHint`,`Source`),`: `]}),(0,G.jsx)(`span`,{className:`text-white`,children:n.filename})]}),(0,G.jsxs)(`p`,{children:[(0,G.jsxs)(`span`,{className:`text-bambu-gray/70`,children:[o(`library.runWithPipeline.pipelineHint`,`Pipeline`),`: `]}),(0,G.jsx)(`span`,{className:`text-white`,children:e.name})]}),t.target_printer_name&&(0,G.jsxs)(`p`,{children:[(0,G.jsxs)(`span`,{className:`text-bambu-gray/70`,children:[o(`library.runWithPipeline.targetHint`,`Target`),`: `]}),(0,G.jsx)(`span`,{className:`text-white`,children:t.target_printer_name})]})]}),(0,G.jsx)(`ul`,{className:`space-y-1.5`,children:t.issues.map((e,t)=>(0,G.jsxs)(`li`,{className:`flex items-start gap-2 text-xs`,children:[(0,G.jsx)(Mu,{className:`w-3.5 h-3.5 text-amber-600 dark:text-amber-400 flex-shrink-0 mt-0.5`}),(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:(0,G.jsx)(Aje,{issue:e})})]},t))}),(0,G.jsxs)(`div`,{className:`flex items-center justify-end gap-2 pt-2 border-t border-bambu-dark-tertiary`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:r,disabled:a,className:`px-3 py-1.5 text-xs text-bambu-gray hover:text-white`,children:o(`common.back`,`Back`)}),(0,G.jsxs)(`button`,{type:`button`,onClick:i,disabled:a,className:`px-3 py-1.5 text-xs bg-amber-500 hover:bg-amber-600 text-white rounded disabled:opacity-50 flex items-center gap-1`,children:[a?(0,G.jsx)(Y,{className:`w-3 h-3 animate-spin`}):(0,G.jsx)(El,{className:`w-3 h-3`}),o(`library.runWithPipeline.runAnyway`,`Run anyway`)]})]})]})}function Aje({issue:e}){let{t}=U();switch(e.kind){case`printer_not_set`:return(0,G.jsx)(G.Fragment,{children:t(`library.runWithPipeline.issue.printerNotSet`,`No target printer set on this pipeline.`)});case`printer_not_found`:return(0,G.jsx)(G.Fragment,{children:t(`library.runWithPipeline.issue.printerNotFound`,`Target printer no longer exists.`)});case`printer_disabled`:return(0,G.jsx)(G.Fragment,{children:t(`library.runWithPipeline.issue.printerDisabled`,`Target printer is disabled.`)});case`printer_offline`:return(0,G.jsx)(G.Fragment,{children:t(`library.runWithPipeline.issue.printerOffline`,`Target printer is offline.`)});case`filament_type_mismatch`:return(0,G.jsx)(G.Fragment,{children:t(`library.runWithPipeline.issue.filamentType`,`Filament slot {{slot}}: expected {{expected}}, AMS has {{actual}}`,{slot:(e.slot_index??0)+1,expected:e.expected??`?`,actual:e.actual??`?`})});case`filament_color_mismatch`:return(0,G.jsx)(G.Fragment,{children:t(`library.runWithPipeline.issue.filamentColor`,`Filament slot {{slot}}: colour differs (expected {{expected}}, AMS has {{actual}})`,{slot:(e.slot_index??0)+1,expected:e.expected??`?`,actual:e.actual??`?`})});case`ams_slot_missing`:return(0,G.jsx)(G.Fragment,{children:t(`library.runWithPipeline.issue.amsSlotMissing`,`AMS slot {{slot}} not available on this printer`,{slot:(e.slot_index??0)+1})});case`filament_unverified`:return(0,G.jsx)(G.Fragment,{children:t(`library.runWithPipeline.issue.filamentUnverified`,`Filament slot {{slot}} comes from a cloud / standard preset and could not be statically verified.`,{slot:(e.slot_index??0)+1})});default:return(0,G.jsx)(G.Fragment,{children:e.kind})}}function qW(e,t){return e??t??`bambu_studio`}var JW={bambu_studio:[`3mf`],orcaslicer:[`3mf`,`stl`,`step`,`stp`]};function YW(e){return JW[e]??JW.bambu_studio}var XW=[`3mf`,`stl`];function jje(e,t){let n=(e||``).toLowerCase();return YW(t).includes(n)}function Mje(e,t){let n=e.toLowerCase();return n.endsWith(`.gcode`)||n.endsWith(`.gcode.3mf`)?!1:YW(t).some(e=>n.endsWith(`.${e}`))}function Nje(e){let t=e.toLowerCase();return t.endsWith(`.gcode`)||t.endsWith(`.gcode.3mf`)?!1:XW.some(e=>t.endsWith(`.${e}`))}function Pje(){let e=navigator.userAgent.toLowerCase(),t=navigator.platform?.toLowerCase()||``;return e.includes(`win`)||t.includes(`win`)?`windows`:e.includes(`mac`)||t.includes(`mac`)?`macos`:e.includes(`linux`)||t.includes(`linux`)?`linux`:`unknown`}function ZW(e,t=`bambu_studio`){let n,r=encodeURIComponent(e);n=t===`orcaslicer`?`orcaslicer://open?file=${r}`:Pje()===`macos`?`bambustudioopen://${r}`:`bambustudio://open?file=${r}`;let i=document.createElement(`a`);i.href=n,i.style.display=`none`,document.body.appendChild(i),i.click(),document.body.removeChild(i)}function Fje(e){let t=(e||``).toLowerCase();return XW.includes(t)}function QW({onFiles:e,onRejected:t,extensions:n,disabled:r=!1}){let[i,a]=(0,f.useState)(!1),o=(0,f.useRef)(e),s=(0,f.useRef)(t),c=(0,f.useRef)(n);(0,f.useEffect)(()=>{o.current=e},[e]),(0,f.useEffect)(()=>{s.current=t},[t]),(0,f.useEffect)(()=>{c.current=n},[n]);let l=(0,f.useCallback)(e=>{r||(e.preventDefault(),e.dataTransfer.types.includes(`Files`)&&a(!0))},[r]),u=(0,f.useCallback)(e=>{r||(e.preventDefault(),e.dataTransfer.types.includes(`Files`)&&a(!0))},[r]),d=(0,f.useCallback)(e=>{if(r)return;e.preventDefault();let t=e.currentTarget,n=e.relatedTarget;(!n||!t.contains(n))&&a(!1)},[r]),p=(0,f.useCallback)(e=>{if(r)return;e.preventDefault(),a(!1);let t=Array.from(e.dataTransfer.files);if(t.length===0)return;let n=c.current,i=n&&n.length>0?t.filter(e=>n.some(t=>e.name.toLowerCase().endsWith(t))):t;i.length>0?o.current(i):s.current?.()},[r]);return(0,f.useEffect)(()=>{if(!i)return;let e=()=>a(!1),t=t=>{t.key===`Escape`&&e()};return document.addEventListener(`drop`,e),document.addEventListener(`dragend`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`drop`,e),document.removeEventListener(`dragend`,e),document.removeEventListener(`keydown`,t)}},[i]),{isDraggingOver:i,dragHandlers:{onDragOver:l,onDragEnter:u,onDragLeave:d,onDrop:p}}}function Ije({onClose:e,initialFiles:t}){let{t:n}=U(),r=no(),{showToast:i}=Hd(),a=(0,f.useRef)(null),[o,s]=(0,f.useState)(()=>t?.filter(e=>e.name.endsWith(`.3mf`)).map(e=>({file:e,status:`pending`}))||[]),[c,l]=(0,f.useState)(!1),[u,d]=(0,f.useState)(null);(0,f.useEffect)(()=>{let t=t=>{t.key===`Escape`&&e()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e]);let p=q({mutationFn:e=>Z.uploadArchivesBulk(e),onSuccess:e=>{d(e),r.invalidateQueries({queryKey:[`archives`]}),r.invalidateQueries({queryKey:[`archiveStats`]}),s(t=>t.map(t=>{let n=e.results.find(e=>e.filename===t.file.name),r=e.errors.find(e=>e.filename===t.file.name);return n?{...t,status:`success`,archiveId:n.id}:r?{...t,status:`error`,error:r.error}:t})),e.failed===0?i(`${e.uploaded} file${e.uploaded===1?``:`s`} uploaded`):e.uploaded===0?i(`Failed to upload ${e.failed} file${e.failed===1?``:`s`}`,`error`):i(`${e.uploaded} uploaded, ${e.failed} failed`,`warning`)},onError:()=>{s(e=>e.map(e=>({...e,status:`error`,error:`Upload failed`}))),i(`Upload failed`,`error`)}}),m=(0,f.useCallback)(e=>{e.preventDefault(),l(!0)},[]),h=(0,f.useCallback)(e=>{e.preventDefault(),l(!1)},[]),g=(0,f.useCallback)(e=>{e.preventDefault(),l(!1);let t=Array.from(e.dataTransfer.files).filter(e=>e.name.endsWith(`.3mf`));t.length>0&&s(e=>[...e,...t.map(e=>({file:e,status:`pending`}))])},[]),_=(0,f.useCallback)(e=>{let t=Array.from(e.target.files||[]).filter(e=>e.name.endsWith(`.3mf`));t.length>0&&s(e=>[...e,...t.map(e=>({file:e,status:`pending`}))]),a.current&&(a.current.value=``)},[]),v=(0,f.useCallback)(e=>{s(t=>t.filter((t,n)=>n!==e))},[]),y=()=>{if(o.length===0)return;let e=o.filter(e=>e.status===`pending`);e.length!==0&&(s(e=>e.map(e=>e.status===`pending`?{...e,status:`uploading`}:e)),p.mutate(e.map(e=>e.file)))},b=o.filter(e=>e.status===`pending`).length,x=p.isPending;return(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,children:(0,G.jsx)(Pd,{className:`w-full max-w-2xl max-h-[90vh] flex flex-col`,children:(0,G.jsxs)(Id,{className:`p-0 flex flex-col h-full`,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:n(`uploadModal.title`)}),(0,G.jsx)(`button`,{onClick:e,className:`text-bambu-gray hover:text-white transition-colors`,children:(0,G.jsx)(Zu,{className:`w-5 h-5`})})]}),(0,G.jsx)(`div`,{className:`p-4`,children:(0,G.jsxs)(`div`,{className:`border-2 border-dashed rounded-lg p-8 text-center transition-colors ${c?`border-bambu-green bg-bambu-green/10`:`border-bambu-dark-tertiary hover:border-bambu-gray`}`,onDragOver:m,onDragLeave:h,onDrop:g,children:[(0,G.jsx)(Iu,{className:`w-12 h-12 mx-auto mb-4 text-bambu-gray`}),(0,G.jsx)(`p`,{className:`text-white mb-2`,children:n(`uploadModal.dragDrop`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-sm mb-4`,children:n(`uploadModal.or`)}),(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>a.current?.click(),disabled:x,children:n(`uploadModal.browseFiles`)}),(0,G.jsx)(`input`,{ref:a,type:`file`,accept:`.3mf`,multiple:!0,className:`hidden`,onChange:_})]})}),(0,G.jsx)(`div`,{className:`px-4 pb-4`,children:(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:n(`uploadModal.extractionInfo`)})}),o.length>0&&(0,G.jsx)(`div`,{className:`px-4 pb-4 max-h-60 overflow-y-auto`,children:(0,G.jsx)(`div`,{className:`space-y-2`,children:o.map((e,t)=>(0,G.jsxs)(`div`,{className:`flex items-center gap-3 p-3 bg-bambu-dark rounded-lg`,children:[(0,G.jsx)(sc,{className:`w-5 h-5 text-bambu-gray flex-shrink-0`}),(0,G.jsx)(`span`,{className:`flex-1 text-white text-sm truncate`,children:e.file.name}),(0,G.jsxs)(`span`,{className:`text-xs text-bambu-gray`,children:[(e.file.size/(1024*1024)).toFixed(1),` MB`]}),e.status===`pending`&&(0,G.jsx)(`button`,{onClick:()=>v(t),className:`text-bambu-gray hover:text-red-600 dark:hover:text-red-400 transition-colors`,disabled:x,children:(0,G.jsx)(Zu,{className:`w-4 h-4`})}),e.status===`uploading`&&(0,G.jsx)(Y,{className:`w-4 h-4 text-bambu-green animate-spin`}),e.status===`success`&&(0,G.jsx)(hs,{className:`w-4 h-4 text-bambu-green`}),e.status===`error`&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-xs text-red-700 dark:text-red-400`,children:e.error}),(0,G.jsx)(ps,{className:`w-4 h-4 text-red-600 dark:text-red-400`})]})]},`${e.file.name}-${t}`))})}),u&&(0,G.jsx)(`div`,{className:`px-4 pb-4`,children:(0,G.jsx)(`div`,{className:`p-3 bg-bambu-dark rounded-lg`,children:(0,G.jsxs)(`p`,{className:`text-sm text-white`,children:[(0,G.jsx)(`span`,{className:`text-bambu-green`,children:u.uploaded}),` `,n(`uploadModal.uploaded`),u.failed>0&&(0,G.jsxs)(G.Fragment,{children:[`, `,(0,G.jsx)(`span`,{className:`text-red-700 dark:text-red-400`,children:u.failed}),` `,n(`uploadModal.failed`)]})]})})}),(0,G.jsxs)(`div`,{className:`flex gap-3 p-4 border-t border-bambu-dark-tertiary`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:e,className:`flex-1`,children:n(u?`common.close`:`common.cancel`)}),!u&&(0,G.jsx)(Q,{onClick:y,disabled:b===0||x,className:`flex-1`,children:x?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),n(`uploadModal.uploading`)]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Iu,{className:`w-4 h-4`}),n(`uploadModal.upload`),` `,b>0&&`(${b})`]})})]})]})})})}var Lje=365;function Rje({onClose:e,initialDays:t}){let{t:n}=U(),r=no(),{showToast:i}=Hd(),[a,o]=(0,f.useState)(t??Lje),[s,c]=(0,f.useState)(!1),[l,u]=(0,f.useState)(a);(0,f.useEffect)(()=>{let e=window.setTimeout(()=>u(a),300);return()=>window.clearTimeout(e)},[a]);let d=K({queryKey:[`archive-purge-preview`,l,s],queryFn:()=>Z.previewArchivePurge(l,s),enabled:l>=1}),p=q({mutationFn:()=>Z.executeArchivePurge(a,s),onSuccess:t=>{i(n(`archivePurge.toast.success`,{count:t.deleted}),`success`),r.invalidateQueries({queryKey:[`archives`]}),r.invalidateQueries({queryKey:[`archive-stats`]}),e()},onError:e=>i(e.message||n(`archivePurge.toast.failed`),`error`)});(0,f.useEffect)(()=>{let t=t=>{t.key===`Escape`&&!p.isPending&&e()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,p.isPending]);let m=d.data,h=m?.count??0,g=m?.total_bytes??0,_=h>0&&!p.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)(ku,{className:`w-5 h-5`}),n(`archivePurge.title`)]}),(0,G.jsx)(`button`,{onClick:e,className:`text-gray-400 hover:text-gray-600 dark:hover:text-gray-200`,"aria-label":n(`common.close`),disabled:p.isPending,children:(0,G.jsx)(Zu,{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:n(`archivePurge.description`)}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{htmlFor:`archive-purge-days`,className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:n(`archivePurge.ageLabel`)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`input`,{id:`archive-purge-days`,type:`number`,min:1,max:3650,value:a,onChange:e=>o(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:n(`archivePurge.days`)})]})]}),(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:n(`archivePurge.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:n(`archivePurge.effect1`)}),(0,G.jsx)(`li`,{children:n(`archivePurge.effect2`)}),(0,G.jsx)(`li`,{children:n(`archivePurge.effect3`)}),(0,G.jsx)(`li`,{children:n(`archivePurge.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:d.isLoading||d.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`}),` `,n(`archivePurge.previewLoading`)]}):d.isError?(0,G.jsx)(`div`,{className:`text-sm text-red-600 dark:text-red-400`,children:d.error?.message??n(`archivePurge.previewFailed`)}):(0,G.jsxs)(`div`,{className:`text-sm text-gray-900 dark:text-gray-100`,children:[(0,G.jsx)(`div`,{className:`font-medium`,children:n(`archivePurge.previewSummary`,{count:h,size:Bd(g)})}),m?.sample_filenames&&m.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:[m.sample_filenames.map(e=>(0,G.jsx)(`li`,{className:`truncate`,children:e},e)),h>m.sample_filenames.length&&(0,G.jsx)(`li`,{className:`list-none italic text-gray-500`,children:n(`archivePurge.andMore`,{count:h-m.sample_filenames.length})})]})]})}),(0,G.jsxs)(`label`,{className:`flex gap-2 items-start rounded border border-gray-200 dark:border-gray-700 px-3 py-2 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800/50`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:s,onChange:e=>c(e.target.checked),disabled:p.isPending,className:`mt-0.5 shrink-0`}),(0,G.jsxs)(`span`,{className:`text-xs text-gray-700 dark:text-gray-300`,children:[(0,G.jsx)(`span`,{className:`font-medium block mb-0.5`,children:n(`archivePurge.purgeStatsLabel`)}),(0,G.jsx)(`span`,{className:`text-gray-500 dark:text-gray-400`,children:n(`archivePurge.purgeStatsHint`)})]})]}),(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)(Mu,{className:`w-4 h-4 mt-0.5 shrink-0`}),(0,G.jsx)(`span`,{children:n(`archivePurge.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:p.isPending,children:n(`common.cancel`)}),(0,G.jsx)(Q,{variant:`danger`,disabled:!_,onClick:()=>p.mutate(),children:p.isPending?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin mr-1`}),n(`archivePurge.purging`)]}):n(`archivePurge.confirmCta`,{count:h})})]})]})})}function $W({archiveId:e,archiveName:t,onClose:n}){let{t:r}=U();return(0,f.useEffect)(()=>{let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),(0,G.jsx)(`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-2xl max-h-[85vh] flex flex-col`,onClick:e=>e.stopPropagation(),children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,G.jsx)(Nc,{className:`w-5 h-5 text-bambu-green flex-shrink-0`}),(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white truncate`,title:t||``,children:r(`archives.runLog.modalTitle`,{name:t||r(`archives.runLog.modalTitleFallback`)})})]}),(0,G.jsx)(`button`,{onClick:n,className:`text-bambu-gray hover:text-white transition-colors`,title:r(`common.close`),children:(0,G.jsx)(Zu,{className:`w-5 h-5`})})]}),(0,G.jsx)(`div`,{className:`p-6 overflow-y-auto flex-1`,children:(0,G.jsx)(zp,{archiveId:e})})]})})}function eG({isOpen:e,onClose:t,columns:n,defaultColumns:r,onSave:i}){let{t:a}=U(),[o,s]=(0,f.useState)(n),[c,l]=(0,f.useState)(null),u=(0,f.useRef)(null);if((0,f.useEffect)(()=>{e&&s(n.map(e=>({...e})))},[e,n]),(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=e=>{s(t=>t.map((t,n)=>n===e?{...t,visible:!t.visible}:t))},p=(e,t)=>{t<0||t>=o.length||s(n=>{let r=[...n],[i]=r.splice(e,1);return r.splice(t,0,i),r})},m=(e,t)=>{u.current=t,l(t),e.dataTransfer.effectAllowed=`move`},h=(e,t)=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`;let n=u.current;n!==null&&n!==t&&(p(n,t),u.current=t,l(t))},g=e=>{e.preventDefault()},_=()=>{u.current=null,l(null)},v=()=>{s(r.map(e=>({...e})))},y=()=>{i(o),t()},b=o.filter(e=>e.visible).length;return(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,onClick:t,children:(0,G.jsx)(Pd,{className:`w-full max-w-md max-h-[80vh] flex flex-col`,onClick:e=>e.stopPropagation(),children:(0,G.jsxs)(Id,{className:`p-6 flex flex-col min-h-0`,children:[(0,G.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-2`,children:a(`inventory.configureColumns`)}),(0,G.jsxs)(`p`,{className:`text-sm text-bambu-gray mb-4`,children:[a(`inventory.configureColumnsDesc`),(0,G.jsxs)(`span`,{className:`ml-2 text-bambu-gray/60`,children:[`(`,b,` `,a(`inventory.of`),` `,o.length,` `,a(`inventory.visible`),`)`]})]}),(0,G.jsx)(`div`,{className:`space-y-1 overflow-y-auto flex-1 min-h-0 pr-1`,children:o.map((e,t)=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2 p-2 rounded-lg border transition-colors ${c===t?`border-bambu-green bg-bambu-green/10`:`border-bambu-dark-tertiary bg-bambu-dark-tertiary/50`} ${e.visible?``:`opacity-50`}`,draggable:!0,onDragStart:e=>m(e,t),onDragOver:e=>h(e,t),onDrop:g,onDragEnd:_,children:[(0,G.jsx)(`div`,{className:`cursor-grab text-bambu-gray/50 hover:text-bambu-gray`,children:(0,G.jsx)(Tc,{className:`w-4 h-4`})}),(0,G.jsx)(`span`,{className:`flex-1 font-medium text-sm text-white`,children:e.label}),(0,G.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,G.jsx)(`button`,{onClick:()=>p(t,t-1),disabled:t===0,className:`p-1 rounded text-bambu-gray hover:bg-bambu-dark-secondary disabled:opacity-30 disabled:cursor-not-allowed`,title:a(`inventory.moveUp`),children:(0,G.jsx)(us,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{onClick:()=>p(t,t+1),disabled:t===o.length-1,className:`p-1 rounded text-bambu-gray hover:bg-bambu-dark-secondary disabled:opacity-30 disabled:cursor-not-allowed`,title:a(`inventory.moveDown`),children:(0,G.jsx)(ss,{className:`w-4 h-4`})})]}),(0,G.jsx)(`button`,{onClick:()=>d(t),className:`p-1.5 rounded transition-colors ${e.visible?`text-bambu-green hover:bg-bambu-green/10`:`text-bambu-gray/50 hover:bg-bambu-dark-secondary`}`,title:e.visible?a(`inventory.hideColumn`):a(`inventory.showColumn`),children:e.visible?(0,G.jsx)($s,{className:`w-4 h-4`}):(0,G.jsx)(Qs,{className:`w-4 h-4`})})]},e.id))}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 mt-4 pt-4 border-t border-bambu-dark-tertiary`,children:[(0,G.jsxs)(Q,{variant:`secondary`,onClick:v,className:`mr-auto`,children:[(0,G.jsx)(Ll,{className:`w-4 h-4`}),a(`inventory.reset`)]}),(0,G.jsx)(Q,{variant:`secondary`,onClick:t,children:a(`inventory.cancel`)}),(0,G.jsx)(Q,{onClick:y,children:a(`inventory.applyChanges`)})]})]})})})}function zje({selectedIds:e,existingTags:t,onClose:n}){let r=no(),{showToast:i}=Hd(),[a,o]=(0,f.useState)(``),[s,c]=(0,f.useState)(new Set),[l,u]=(0,f.useState)(`add`);(0,f.useEffect)(()=>{let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]);let d=q({mutationFn:async()=>{let t=Array.from(s),n=0;for(let r of e)try{let e=await Z.getArchive(r),i=e.tags?e.tags.split(`,`).map(e=>e.trim()).filter(Boolean):[],a;a=l===`add`?[...new Set([...i,...t])]:i.filter(e=>!s.has(e)),await Z.updateArchive(r,{tags:a.join(`, `)}),n++}catch(e){throw console.error(`Failed to update archive ${r}:`,e),Error(`Failed on archive ${r}: ${e instanceof Error?e.message:`Unknown error`}`)}return{count:n,mode:l,tags:t}},onSuccess:({count:e,mode:t,tags:a})=>{r.invalidateQueries({queryKey:[`archives`]}),i(`${t===`add`?`Added`:`Removed`} ${a.length} tag${a.length===1?``:`s`} ${t===`add`?`to`:`from`} ${e} archive${e===1?``:`s`}`),n()},onError:e=>{i(e.message||`Failed to update tags`,`error`)}}),p=e=>{c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},m=()=>{a.trim()&&!s.has(a.trim())&&(c(e=>new Set([...e,a.trim()])),o(``))};return(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,children:(0,G.jsx)(Pd,{className:`w-full max-w-md`,children:(0,G.jsxs)(Id,{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.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(yu,{className:`w-5 h-5 text-bambu-green`}),(0,G.jsx)(`h2`,{className:`text-xl font-semibold text-white`,children:l===`add`?`Add Tags`:`Remove Tags`})]}),(0,G.jsx)(`button`,{onClick:n,className:`text-bambu-gray hover:text-white transition-colors`,children:(0,G.jsx)(Zu,{className:`w-5 h-5`})})]}),(0,G.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,G.jsxs)(`p`,{className:`text-sm text-bambu-gray`,children:[l===`add`?`Add`:`Remove`,` tags for `,e.length,` selected archive`,e.length===1?``:`s`]}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(Q,{size:`sm`,variant:l===`add`?`primary`:`secondary`,onClick:()=>u(`add`),children:`Add Tags`}),(0,G.jsx)(Q,{size:`sm`,variant:l===`remove`?`primary`:`secondary`,onClick:()=>u(`remove`),children:`Remove Tags`})]}),l===`add`&&(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(`input`,{type:`text`,placeholder:`Enter new tag...`,className:`flex-1 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:border-bambu-green focus:outline-none`,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),m())}}),(0,G.jsx)(Q,{size:`sm`,variant:`secondary`,onClick:m,disabled:!a.trim(),children:(0,G.jsx)(Ol,{className:`w-4 h-4`})})]}),t.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mb-2`,children:`Existing tags:`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.map(e=>(0,G.jsx)(`button`,{onClick:()=>p(e),className:`px-2 py-1 rounded text-sm transition-colors ${s.has(e)?`bg-bambu-green text-white`:`bg-bambu-dark-tertiary text-bambu-gray-light hover:bg-bambu-dark`}`,children:e},e))})]}),s.size>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`p`,{className:`text-xs text-bambu-gray mb-2`,children:[`Tags to `,l===`add`?`add`:`remove`,`:`]}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Array.from(s).map(e=>(0,G.jsxs)(`span`,{className:`px-2 py-1 rounded text-sm flex items-center gap-1 ${l===`add`?`bg-green-100 dark:bg-green-500/20 text-green-700 dark:text-green-400`:`bg-red-100 dark:bg-red-500/20 text-red-700 dark:text-red-400`}`,children:[e,(0,G.jsx)(`button`,{onClick:()=>p(e),className:`hover:opacity-70`,children:(0,G.jsx)(Zu,{className:`w-3 h-3`})})]},e))})]})]}),(0,G.jsxs)(`div`,{className:`flex gap-3 p-4 border-t border-bambu-dark-tertiary`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:n,className:`flex-1`,children:`Cancel`}),(0,G.jsx)(Q,{onClick:()=>d.mutate(),disabled:s.size===0||d.isPending,className:`flex-1`,children:d.isPending?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),`Processing...`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(yu,{className:`w-4 h-4`}),l===`add`?`Add Tags`:`Remove Tags`]})})]})]})})})}function Bje({selectedIds:e,onClose:t}){let{t:n}=U(),r=no(),{showToast:i}=Hd(),[a,o]=(0,f.useState)(``),{data:s,isLoading:c}=K({queryKey:[`projects`],queryFn:()=>Z.getProjects()}),l=(0,f.useMemo)(()=>s?Vp([...s].sort((e,t)=>e.name.localeCompare(t.name))):void 0,[s]),u=a.trim().toLowerCase(),d=u?l?.filter(e=>e.name.toLowerCase().includes(u)):l,p=(l?.length??0)>5;(0,f.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]);let m=()=>Bp(r),h=q({mutationFn:async t=>(await Z.addArchivesToProject(t,e),t),onSuccess:n=>{let r=s?.find(e=>e.id===n);m(),i(`Added ${e.length} archive${e.length===1?``:`s`} to "${r?.name}"`),t()},onError:()=>{i(`Failed to assign project`,`error`)}}),g=q({mutationFn:async()=>{for(let t of e)await Z.updateArchive(t,{project_id:null});return e.length},onSuccess:e=>{m(),i(`Removed ${e} archive${e===1?``:`s`} from project`),t()},onError:()=>{i(`Failed to remove from project`,`error`)}}),_=h.isPending||g.isPending;return(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,children:(0,G.jsx)(Pd,{className:`w-full max-w-md max-h-[80vh] flex flex-col`,children:(0,G.jsxs)(Id,{className:`p-0 flex flex-col min-h-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-bambu-dark-tertiary shrink-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(dc,{className:`w-5 h-5 text-bambu-green`}),(0,G.jsx)(`h2`,{className:`text-xl font-semibold text-white`,children:`Assign to Project`})]}),(0,G.jsx)(`button`,{onClick:t,className:`text-bambu-gray hover:text-white transition-colors`,disabled:_,children:(0,G.jsx)(Zu,{className:`w-5 h-5`})})]}),(0,G.jsxs)(`div`,{className:`p-4 space-y-3 overflow-y-auto min-h-0`,children:[(0,G.jsxs)(`p`,{className:`text-sm text-bambu-gray`,children:[`Assign `,e.length,` selected archive`,e.length===1?``:`s`,` to a project`]}),c?(0,G.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,G.jsx)(Y,{className:`w-6 h-6 animate-spin text-bambu-gray`})}):(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`button`,{onClick:()=>g.mutate(),disabled:_,className:`w-full flex items-center gap-3 p-3 rounded-lg bg-bambu-dark hover:bg-bambu-dark-tertiary border border-bambu-dark-tertiary transition-colors text-left disabled:opacity-50`,children:[(0,G.jsx)(`div`,{className:`w-8 h-8 rounded-full bg-red-500/20 flex items-center justify-center shrink-0`,children:(0,G.jsx)(xs,{className:`w-4 h-4 text-red-600 dark:text-red-400`})}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`p`,{className:`text-white font-medium`,children:`Remove from project`}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray truncate`,children:`Clear project assignment`})]}),g.isPending&&(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin text-bambu-gray shrink-0`})]}),l&&l.length>0&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 py-2`,children:[(0,G.jsx)(`div`,{className:`flex-1 h-px bg-bambu-dark-tertiary`}),(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:`or assign to`}),(0,G.jsx)(`div`,{className:`flex-1 h-px bg-bambu-dark-tertiary`})]}),p&&(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(Gl,{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:`text`,value:a,onChange:e=>o(e.target.value),placeholder:n(`archives.menu.searchProjects`),className:`w-full pl-9 pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray text-sm focus:border-bambu-green focus:outline-none`})]}),d?.map(e=>(0,G.jsxs)(`button`,{onClick:()=>h.mutate(e.id),disabled:_,className:`w-full flex items-center gap-3 p-3 rounded-lg bg-bambu-dark hover:bg-bambu-dark-tertiary border border-bambu-dark-tertiary transition-colors text-left disabled:opacity-50`,children:[(0,G.jsx)(`div`,{className:`w-8 h-8 rounded-full flex items-center justify-center shrink-0`,style:{backgroundColor:e.color?`${e.color}20`:`rgb(var(--bambu-green) / 0.2)`},children:(0,G.jsx)(dc,{className:`w-4 h-4`,style:{color:e.color||`rgb(var(--bambu-green))`}})}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`p`,{className:`text-white font-medium truncate`,children:e.name}),(0,G.jsxs)(`p`,{className:`text-sm text-bambu-gray truncate`,children:[e.archive_count,` archive`,e.archive_count===1?``:`s`,e.status&&` • ${e.status}`]})]}),h.isPending&&h.variables===e.id&&(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin text-bambu-gray shrink-0`})]},e.id)),(!l||l.length===0)&&(0,G.jsx)(`p`,{className:`text-center text-bambu-gray py-4`,children:`No projects yet. Create one from the Projects page.`}),l&&l.length>0&&d?.length===0&&(0,G.jsx)(`p`,{className:`text-center text-bambu-gray text-sm py-4`,children:`—`})]})]}),(0,G.jsx)(`div`,{className:`flex gap-3 p-4 border-t border-bambu-dark-tertiary shrink-0`,children:(0,G.jsx)(Q,{variant:`secondary`,onClick:t,className:`flex-1`,disabled:_,children:`Cancel`})})]})})})}function Vje(e,t){return new Date(e,t+1,0).getDate()}function Hje(e,t){return new Date(e,t,1).getDay()}var Uje=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],Wje=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`];function Gje({archives:e,onArchiveClick:t,highlightedArchiveId:n}){let r=new Date,[i,a]=(0,f.useState)(r.getMonth()),[o,s]=(0,f.useState)(r.getFullYear()),[c,l]=(0,f.useState)(null),[u,d]=(0,f.useState)(null),p=(0,f.useMemo)(()=>{let t=new Map;return e.forEach(e=>{let n=Jf(e.completed_at||e.created_at)||new Date,r=`${n.getFullYear()}-${String(n.getMonth()+1).padStart(2,`0`)}-${String(n.getDate()).padStart(2,`0`)}`,i=t.get(r)||[];i.push(e),t.set(r,i)}),t},[e]),m=Vje(o,i),h=Hje(o,i),g=()=>{i===0?(a(11),s(o-1)):a(i-1)},_=()=>{i===11?(a(0),s(o+1)):a(i+1)},v=()=>{a(r.getMonth()),s(r.getFullYear())},y=[];for(let e=0;e{e!==c&&d(null),l(e)};return(0,G.jsxs)(`div`,{className:`flex flex-col lg:flex-row gap-6`,children:[(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,G.jsx)(`button`,{onClick:g,className:`p-2 hover:bg-bambu-dark-tertiary rounded-lg transition-colors`,children:(0,G.jsx)(ls,{className:`w-5 h-5 text-bambu-gray`})}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white`,children:[Uje[i],` `,o]}),(0,G.jsx)(`button`,{onClick:v,className:`px-2 py-1 text-xs bg-bambu-dark-tertiary hover:bg-bambu-green/20 text-bambu-gray hover:text-white rounded transition-colors`,children:`Today`})]}),(0,G.jsx)(`button`,{onClick:_,className:`p-2 hover:bg-bambu-dark-tertiary rounded-lg transition-colors`,children:(0,G.jsx)(cs,{className:`w-5 h-5 text-bambu-gray`})})]}),(0,G.jsx)(`div`,{className:`grid grid-cols-7 gap-1 mb-1`,children:Wje.map(e=>(0,G.jsx)(`div`,{className:`text-center text-xs text-bambu-gray py-2`,children:e},e))}),(0,G.jsx)(`div`,{className:`grid grid-cols-7 gap-1`,children:y.map((e,t)=>{if(e===null)return(0,G.jsx)(`div`,{className:`aspect-square`},`empty-${t}`);let n=`${o}-${String(i+1).padStart(2,`0`)}-${String(e).padStart(2,`0`)}`,a=p.get(n)||[],s=a.length>0,l=e===r.getDate()&&i===r.getMonth()&&o===r.getFullYear(),u=n===c,d=a.filter(e=>e.status===`completed`).length,f=a.filter(e=>e.status===`failed`).length;return(0,G.jsxs)(`button`,{onClick:()=>x(u?null:n),className:`aspect-square rounded-lg p-1 flex flex-col items-center justify-center transition-colors relative ${u?`bg-bambu-green text-white`:l?`bg-bambu-green/20 text-white ring-2 ring-bambu-green`:s?`bg-bambu-dark-tertiary hover:bg-bambu-dark-tertiary/70 text-white`:`hover:bg-bambu-dark-tertiary/50 text-bambu-gray`}`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium ${l&&!u?`text-bambu-green`:``}`,children:e}),s&&(0,G.jsxs)(`div`,{className:`absolute bottom-1 left-1/2 -translate-x-1/2 flex items-center gap-1`,children:[(0,G.jsx)(`div`,{className:`w-2 h-2 rounded-full ${f>0&&d===0?`bg-red-400`:f>0?`bg-yellow-400`:`bg-green-400`}`}),(0,G.jsx)(`span`,{className:`text-xs font-medium`,children:a.length})]})]},e)})}),(0,G.jsx)(`div`,{className:`mt-4 pt-4 border-t border-bambu-dark-tertiary`,children:(0,G.jsxs)(`div`,{className:`grid grid-cols-3 gap-4 text-center`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-2xl font-bold text-white`,children:e.filter(e=>{let t=Jf(e.completed_at||e.created_at)||new Date;return t.getMonth()===i&&t.getFullYear()===o}).length}),(0,G.jsx)(`div`,{className:`text-xs text-bambu-gray`,children:`Prints this month`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-2xl font-bold text-green-700 dark:text-green-400`,children:e.filter(e=>{let t=Jf(e.completed_at||e.created_at)||new Date;return t.getMonth()===i&&t.getFullYear()===o&&e.status===`completed`}).length}),(0,G.jsx)(`div`,{className:`text-xs text-bambu-gray`,children:`Successful`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-2xl font-bold text-red-700 dark:text-red-400`,children:e.filter(e=>{let t=Jf(e.completed_at||e.created_at)||new Date;return t.getMonth()===i&&t.getFullYear()===o&&e.status===`failed`}).length}),(0,G.jsx)(`div`,{className:`text-xs text-bambu-gray`,children:`Failed`})]})]})})]}),(0,G.jsx)(`div`,{className:`lg:w-80 bg-bambu-dark rounded-xl p-4`,children:c?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`h3`,{className:`text-sm font-medium text-bambu-gray mb-3`,children:new Date(c+`T12:00:00`).toLocaleDateString(`en-US`,{weekday:`long`,month:`long`,day:`numeric`,year:`numeric`})}),b.length>0?(0,G.jsx)(`div`,{className:`calendar-scroll space-y-2 max-h-96 overflow-y-auto`,children:b.map(e=>{let r=e.id===u||e.id===n;return(0,G.jsxs)(`button`,{onClick:()=>{d(e.id),t?.(e)},className:`w-full flex items-center gap-3 p-2 rounded-lg transition-colors text-left ${r?``:`hover:bg-bambu-dark-tertiary`}`,style:r?{outline:`4px solid #facc15`,outlineOffset:`2px`}:void 0,children:[e.thumbnail_path?(0,G.jsx)(`img`,{src:Z.getArchiveThumbnail(e.id),alt:``,className:`w-12 h-12 rounded object-cover`}):(0,G.jsx)(`div`,{className:`w-12 h-12 rounded bg-bambu-dark-tertiary flex items-center justify-center`,children:(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:`3MF`})}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`p`,{className:`text-sm text-white truncate`,children:e.print_name||e.filename}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,G.jsx)(`span`,{className:e.status===`failed`?`text-red-700 dark:text-red-400`:`text-green-700 dark:text-green-400`,children:e.status===`failed`?`Failed`:`Completed`}),e.filament_color&&(0,G.jsx)(`div`,{className:`flex gap-0.5`,children:e.filament_color.split(`,`).map((e,t)=>(0,G.jsx)(`div`,{className:`w-3 h-3 rounded-full border border-black/20`,style:{backgroundColor:e}},t))})]})]})]},e.id)})}):(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:`No prints on this day`})]}):(0,G.jsx)(`div`,{className:`text-center py-8`,children:(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:`Select a day to see prints`})})})]})}function tG({archiveId:e,archiveName:t,onClose:n}){let r=Z.getArchiveQRCodeUrl(e,300);return(0,f.useEffect)(()=>{let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),(0,G.jsx)(`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-sm`,onClick:e=>e.stopPropagation(),children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary`,children:[(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:`QR Code`}),(0,G.jsx)(`button`,{onClick:n,className:`text-bambu-gray hover:text-white transition-colors`,children:(0,G.jsx)(Zu,{className:`w-5 h-5`})})]}),(0,G.jsxs)(`div`,{className:`p-6 flex flex-col items-center`,children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mb-4 text-center truncate max-w-full`,children:t}),(0,G.jsx)(`div`,{className:`bg-white p-4 rounded-lg mb-4`,children:(0,G.jsx)(`img`,{src:r,alt:`QR Code`,className:`w-64 h-64`})}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mb-4 text-center`,children:`Scan to open this archive`}),(0,G.jsxs)(Q,{onClick:()=>{let e=document.createElement(`a`);e.href=r,e.download=`${t}_qrcode.png`,e.click()},className:`w-full`,children:[(0,G.jsx)(Ws,{className:`w-4 h-4`}),`Download QR Code`]})]})]})})}function nG(e){let{archiveName:t,photos:n,initialIndex:r,onClose:i,onDelete:a}=e,[o,s]=(0,f.useState)(()=>Math.min(Math.max(r??0,0),Math.max(n.length-1,0))),[c,l]=(0,f.useState)(!1);if((0,f.useEffect)(()=>{if(c)return;let e=e=>{e.key===`Escape`&&i(),e.key===`ArrowLeft`&&s(e=>Math.max(0,e-1)),e.key===`ArrowRight`&&s(e=>Math.min(n.length-1,e+1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[i,n.length,c]),(0,f.useEffect)(()=>{o>=n.length&&s(Math.max(0,n.length-1))},[n.length,o]),n.length===0)return i(),null;let u=t=>e.getPhotoUrl?e.getPhotoUrl(t):Z.getArchivePhotoUrl(e.archiveId,t),d=n[o],p=u(d);return(0,G.jsxs)(`div`,{className:`fixed inset-0 bg-black/90 flex items-center justify-center z-50`,onClick:e=>{e.stopPropagation(),i()},children:[(0,G.jsxs)(`div`,{className:`relative w-full h-full flex flex-col`,onClick:e=>e.stopPropagation(),children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between px-6 py-4 bg-black/50`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:t}),(0,G.jsxs)(`p`,{className:`text-sm text-bambu-gray`,children:[`Photo `,o+1,` of `,n.length]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:()=>{let e=document.createElement(`a`);e.href=p,e.download=`${t}_photo_${o+1}.jpg`,e.click()},children:[(0,G.jsx)(Ws,{className:`w-4 h-4`}),`Download`]}),a&&(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:()=>{a&&l(!0)},className:`text-red-400 hover:text-red-300`,children:(0,G.jsx)(ku,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{onClick:i,className:`p-2 text-bambu-gray hover:text-white transition-colors`,children:(0,G.jsx)(Zu,{className:`w-6 h-6`})})]})]}),(0,G.jsxs)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center p-4 relative overflow-hidden`,children:[o>0&&(0,G.jsx)(`button`,{onClick:()=>s(e=>e-1),className:`absolute left-4 z-10 p-3 bg-black/50 hover:bg-black/70 rounded-full transition-colors`,children:(0,G.jsx)(ls,{className:`w-8 h-8 text-white`})}),(0,G.jsx)(`img`,{src:p,alt:`Photo ${o+1}`,className:`max-w-full max-h-full object-contain rounded-lg`,style:{maxHeight:`calc(100vh - 200px)`}}),os(e=>e+1),className:`absolute right-4 z-10 p-3 bg-black/50 hover:bg-black/70 rounded-full transition-colors`,children:(0,G.jsx)(cs,{className:`w-8 h-8 text-white`})})]}),n.length>1&&(0,G.jsx)(`div`,{className:`flex justify-center gap-2 p-4 bg-black/50`,children:n.map((e,t)=>(0,G.jsx)(`button`,{onClick:()=>s(t),className:`w-16 h-16 rounded-lg overflow-hidden border-2 transition-colors ${t===o?`border-bambu-green`:`border-transparent hover:border-bambu-gray`}`,children:(0,G.jsx)(`img`,{src:u(e),alt:`Thumbnail ${t+1}`,className:`w-full h-full object-cover`})},e))})]}),c&&(0,G.jsx)(`div`,{onClick:e=>e.stopPropagation(),children:(0,G.jsx)($d,{title:`Delete Photo`,message:`Delete this photo? This cannot be undone.`,confirmText:`Delete`,variant:`danger`,onConfirm:()=>{a?.(d),l(!1)},onCancel:()=>l(!1)})})]})}function rG(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n`u`?null:DG(BigInt.prototype.toString),SG=typeof Symbol>`u`?null:DG(Symbol.prototype.toString),CG=DG(Object.prototype.hasOwnProperty),wG=DG(Object.prototype.toString),TG=DG(RegExp.prototype.test),EG=aMe(TypeError);function DG(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return uG(e,t,n)}}function aMe(e){return function(){return dG(e,[...arguments])}}function OG(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:gG;if(aG&&aG(e,null),!hG(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(Zje(t)||(t[r]=e),i=e)}e[i]=!0}return e}function oMe(e){for(let t=0;t/g),pMe=sG(/\${[\w\W]*/g),mMe=sG(/^data-[\-\w.\u00B7-\uFFFF]+$/),hMe=sG(/^aria-[\-\w]+$/),BG=sG(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),gMe=sG(/^(?:\w+script|data):/i),_Me=sG(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),vMe=sG(/^html$/i),yMe=sG(/^[a-z][.\w]*(-[.\w]+)+$/i),VG=sG(/<[/\w!]/g),HG=sG(/<[/\w]/g),bMe=sG(/<\/no(script|embed|frames)/i),xMe=sG(/\/>/i),UG={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},SMe=function(){return typeof window>`u`?null:window},CMe=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},WG=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},GG=function(e,t,n,r){return CG(e,t)&&hG(e[t])?OG(r.base?kG(r.base):{},e[t],r.transform):n};function KG(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:SMe(),t=e=>KG(e);if(t.version=`3.4.13`,t.removed=[],!e||!e.document||e.document.nodeType!==UG.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=AG(d,`cloneNode`),p=AG(d,`remove`),m=AG(d,`nextSibling`),h=AG(d,`childNodes`),g=AG(d,`parentNode`),_=AG(d,`shadowRoot`),v=AG(d,`attributes`),y=o&&o.prototype?AG(o.prototype,`nodeType`):null,b=o&&o.prototype?AG(o.prototype,`nodeName`):null,x=o&&o.prototype?AG(o.prototype,`ownerDocument`):null;if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let S,C=``,w,T=!1,E=0,D=function(){if(E>0)throw EG(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},O=function(e){D(),E++;try{return S.createHTML(e)}finally{E--}},k=function(e){D(),E++;try{return S.createScriptURL(e)}finally{E--}},A=function(){return T||=(w=CMe(u,i),!0),w},j=n,M=j.implementation,N=j.createNodeIterator,P=j.createDocumentFragment,F=j.getElementsByTagName,I=r.importNode,L=WG();t.isSupported=typeof iG==`function`&&typeof g==`function`&&M&&M.createHTMLDocument!==void 0;let R=dMe,z=fMe,B=pMe,V=mMe,ee=hMe,te=gMe,ne=_Me,re=yMe,ie=BG,ae=null,oe=OG({},[...jG,...MG,...NG,...PG,...FG]),se=null,H=OG({},[...IG,...LG,...RG,...zG]),ce=Object.seal(cG(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),le=null,ue=null,de=Object.seal(cG(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),fe=!0,pe=!0,me=!1,he=!0,ge=!1,_e=!0,ve=!1,ye=!1,be=null,xe=null,Se=!1,Ce=!1,we=!1,Te=!1,Ee=!0,De=!1,Oe=`user-content-`,ke=!0,Ae=!1,je={},Me=null,Ne=OG({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),Pe=null,Fe=OG({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Ie=null,Le=OG({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Re=`http://www.w3.org/1998/Math/MathML`,ze=`http://www.w3.org/2000/svg`,Be=`http://www.w3.org/1999/xhtml`,Ve=Be,He=!1,Ue=null,We=OG({},[Re,ze,Be],_G),Ge=oG([`mi`,`mo`,`mn`,`ms`,`mtext`]),Ke=OG({},Ge),qe=oG([`annotation-xml`]),U=OG({},qe),Je=OG({},[`title`,`style`,`font`,`a`,`script`]),Ye=null,Xe=[`application/xhtml+xml`,`text/html`],Ze=null,Qe=null,$e=n.createElement(`form`),et=function(e){return e instanceof RegExp||e instanceof Function},tt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Qe&&Qe===e)return;(!e||typeof e!=`object`)&&(e={}),e=kG(e),Ye=Xe.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,Ze=Ye===`application/xhtml+xml`?_G:gG,ae=GG(e,`ALLOWED_TAGS`,oe,{transform:Ze}),se=GG(e,`ALLOWED_ATTR`,H,{transform:Ze}),Ue=GG(e,`ALLOWED_NAMESPACES`,We,{transform:_G}),Ie=GG(e,`ADD_URI_SAFE_ATTR`,Le,{transform:Ze,base:Le}),Pe=GG(e,`ADD_DATA_URI_TAGS`,Fe,{transform:Ze,base:Fe}),Me=GG(e,`FORBID_CONTENTS`,Ne,{transform:Ze}),le=GG(e,`FORBID_TAGS`,kG({}),{transform:Ze}),ue=GG(e,`FORBID_ATTR`,kG({}),{transform:Ze}),je=CG(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?kG(e.USE_PROFILES):e.USE_PROFILES:!1,fe=e.ALLOW_ARIA_ATTR!==!1,pe=e.ALLOW_DATA_ATTR!==!1,me=e.ALLOW_UNKNOWN_PROTOCOLS||!1,he=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ge=e.SAFE_FOR_TEMPLATES||!1,_e=e.SAFE_FOR_XML!==!1,ve=e.WHOLE_DOCUMENT||!1,Ce=e.RETURN_DOM||!1,we=e.RETURN_DOM_FRAGMENT||!1,Te=e.RETURN_TRUSTED_TYPE||!1,Se=e.FORCE_BODY||!1,Ee=e.SANITIZE_DOM!==!1,De=e.SANITIZE_NAMED_PROPS||!1,ke=e.KEEP_CONTENT!==!1,Ae=e.IN_PLACE||!1,ie=cMe(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:BG,Ve=typeof e.NAMESPACE==`string`?e.NAMESPACE:Be,Ke=CG(e,`MATHML_TEXT_INTEGRATION_POINTS`)&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS==`object`?kG(e.MATHML_TEXT_INTEGRATION_POINTS):OG({},Ge),U=CG(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?kG(e.HTML_INTEGRATION_POINTS):OG({},qe);let t=CG(e,`CUSTOM_ELEMENT_HANDLING`)&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING==`object`?kG(e.CUSTOM_ELEMENT_HANDLING):cG(null);if(ce=cG(null),CG(t,`tagNameCheck`)&&et(t.tagNameCheck)&&(ce.tagNameCheck=t.tagNameCheck),CG(t,`attributeNameCheck`)&&et(t.attributeNameCheck)&&(ce.attributeNameCheck=t.attributeNameCheck),CG(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(ce.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),sG(ce),ge&&(pe=!1),we&&(Ce=!0),je&&(ae=OG({},FG),se=cG(null),je.html===!0&&(OG(ae,jG),OG(se,IG)),je.svg===!0&&(OG(ae,MG),OG(se,LG),OG(se,zG)),je.svgFilters===!0&&(OG(ae,NG),OG(se,LG),OG(se,zG)),je.mathMl===!0&&(OG(ae,PG),OG(se,RG),OG(se,zG))),de.tagCheck=null,de.attributeCheck=null,CG(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?de.tagCheck=e.ADD_TAGS:hG(e.ADD_TAGS)&&(ae===oe&&(ae=kG(ae)),OG(ae,e.ADD_TAGS,Ze))),CG(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?de.attributeCheck=e.ADD_ATTR:hG(e.ADD_ATTR)&&(se===H&&(se=kG(se)),OG(se,e.ADD_ATTR,Ze))),CG(e,`ADD_URI_SAFE_ATTR`)&&hG(e.ADD_URI_SAFE_ATTR)&&OG(Ie,e.ADD_URI_SAFE_ATTR,Ze),CG(e,`FORBID_CONTENTS`)&&hG(e.FORBID_CONTENTS)&&(Me===Ne&&(Me=kG(Me)),OG(Me,e.FORBID_CONTENTS,Ze)),CG(e,`ADD_FORBID_CONTENTS`)&&hG(e.ADD_FORBID_CONTENTS)&&(Me===Ne&&(Me=kG(Me)),OG(Me,e.ADD_FORBID_CONTENTS,Ze)),ke&&(ae[`#text`]=!0),ve&&OG(ae,[`html`,`head`,`body`]),ae.table&&(OG(ae,[`tbody`]),delete le.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw EG(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw EG(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=S;S=e.TRUSTED_TYPES_POLICY;try{C=O(``)}catch(e){throw S=t,e}}else e.TRUSTED_TYPES_POLICY===null?(S=void 0,C=``):(S===void 0&&(S=A()),S&&typeof C==`string`&&(C=O(``)));oG&&oG(e),Qe=e},nt=OG({},[...MG,...NG,...lMe]),rt=OG({},[...PG,...uMe]),it=function(e,t,n){return t.namespaceURI===Be?e===`svg`:t.namespaceURI===Re?e===`svg`&&(n===`annotation-xml`||Ke[n]):!!nt[e]},at=function(e,t,n){return t.namespaceURI===Be?e===`math`:t.namespaceURI===ze?e===`math`&&U[n]:!!rt[e]},ot=function(e,t,n){return t.namespaceURI===ze&&!U[n]||t.namespaceURI===Re&&!Ke[n]?!1:!rt[e]&&(Je[e]||!nt[e])},st=function(e){let t=g(e);(!t||!t.tagName)&&(t={namespaceURI:Ve,tagName:`template`});let n=gG(e.tagName),r=gG(t.tagName);return Ue[e.namespaceURI]?e.namespaceURI===ze?it(n,t,r):e.namespaceURI===Re?at(n,t,r):e.namespaceURI===Be?ot(n,t,r):!!(Ye===`application/xhtml+xml`&&Ue[e.namespaceURI]):!1},ct=function(e){mG(t.removed,{element:e});try{g(e).removeChild(e)}catch{if(p(e),!g(e))throw EG(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},lt=function(e){ft(e);let t=h(e);if(t){let e=[];fG(t,t=>{mG(e,t)}),fG(e,e=>{try{p(e)}catch{}})}let n=v(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;if(typeof i==`string`)try{e.removeAttribute(i)}catch{}}},ut=function(e,n){try{mG(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{mG(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(Ce||we)try{ct(n)}catch{}else try{n.setAttribute(e,``)}catch{}},dt=function(e){let t=v(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;if(!(typeof i!=`string`||se[Ze(i)]))try{e.removeAttribute(i)}catch{}}},ft=function(e){let t=[e];for(;t.length>0;){let e=t.pop();(y?y(e):e.nodeType)===UG.element&&dt(e);let n=h(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},pt=function(e){if(!_e)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=y?y(e):e.nodeType;if(n===UG.processingInstruction||n===UG.comment&&TG(HG,e.data)){try{p(e)}catch{}continue}if(n===UG.element){let t=e,n=Ze(b?b(e):e.nodeName);try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&n!==`label`&&n!==`output`&&t.removeAttribute(`for`)}catch{}}let r=h(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}},mt=function(e){let t=null,r=null;if(Se)e=``+e;else{let t=vG(e,/^[\r\n\t ]+/);r=t&&t[0]}Ye===`application/xhtml+xml`&&Ve===Be&&(e=``+e+``);let i=S?O(e):e;if(Ve===Be)try{t=new l().parseFromString(i,Ye)}catch{}if(!t||!t.documentElement){t=M.createDocument(Ve,`template`,null);try{t.documentElement.innerHTML=He?C:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Ve===Be?F.call(t,ve?`html`:`body`)[0]:ve?t.documentElement:a},ht=function(e){let t=x?x(e):e.ownerDocument;return N.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},gt=function(e){return e=yG(e,R,` `),e=yG(e,z,` `),e=yG(e,B,` `),e},_t=function(e){e.normalize();let t=x?x(e):e.ownerDocument,n=N.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=gt(r.data),r=n.nextNode();let i=e.querySelectorAll?.call(e,`template`);i&&fG(i,e=>{yt(e.content)&&_t(e.content)})},vt=function(e){let t=b?b(e):null;return typeof t!=`string`||Ze(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==v(e)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==y(e)||e.childNodes!==h(e)},yt=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return y(e)===UG.documentFragment}catch{return!1}},bt=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return typeof y(e)==`number`}catch{return!1}};function xt(e,n,r){e.length!==0&&fG(e,e=>{e.call(t,n,r,Qe)})}let St=function(e,t){return!!(_e&&e.hasChildNodes()&&!bt(e.firstElementChild)&&TG(VG,e.textContent)&&TG(VG,e.innerHTML)||_e&&e.namespaceURI===Be&&t===`style`&&bt(e.firstElementChild)||e.nodeType===UG.processingInstruction||_e&&e.nodeType===UG.comment&&TG(HG,e.data))},Ct=function(e,t,n){if(!le[t]&&Ot(t)&&(ce.tagNameCheck instanceof RegExp&&TG(ce.tagNameCheck,t)||ce.tagNameCheck instanceof Function&&ce.tagNameCheck(t)))return!1;if(ke&&!Me[t]){let t=g(e),r=h(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,m(e))}}}return ct(e),!0},wt=function(e,t,n,r){return e.length===0?t:t===n||t===r?kG(t):t},Tt=function(e,n){if(xt(L.beforeSanitizeElements,e,null),e!==n&&g(e)===null)return Ae&&ft(e),!0;if(vt(e))return ct(e),!0;let r=Ze(b?b(e):e.nodeName);if(ae=wt(L.uponSanitizeElement,ae,oe,be),xt(L.uponSanitizeElement,e,{tagName:r,allowedTags:ae}),e!==n&&g(e)===null)return Ae&&ft(e),!0;if(St(e,r))return ct(e),!0;if(le[r]||!(de.tagCheck instanceof Function&&de.tagCheck(r))&&!ae[r]){let t=Ct(e,r,n);return t===!1&&xt(L.afterSanitizeElements,e,null),t}if((y?y(e):e.nodeType)===UG.element&&!st(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&TG(bMe,e.innerHTML))return ct(e),!0;if(ge&&e.nodeType===UG.text){let n=gt(e.textContent);e.textContent!==n&&(mG(t.removed,{element:e.cloneNode()}),e.textContent=n)}return xt(L.afterSanitizeElements,e,null),!1},Et=function(e,t,r){if(ue[t]||_e&&t===`patchsrc`||_e&&t===`for`&&e!==`label`&&e!==`output`||Ee&&(t===`id`||t===`name`)&&(r in n||r in $e))return!1;let i=se[t]||de.attributeCheck instanceof Function&&de.attributeCheck(t,e);if(!(pe&&TG(V,t))&&!(fe&&TG(ee,t))){if(!i){if(!(Ot(e)&&(ce.tagNameCheck instanceof RegExp&&TG(ce.tagNameCheck,e)||ce.tagNameCheck instanceof Function&&ce.tagNameCheck(e))&&(ce.attributeNameCheck instanceof RegExp&&TG(ce.attributeNameCheck,t)||ce.attributeNameCheck instanceof Function&&ce.attributeNameCheck(t,e))||t===`is`&&ce.allowCustomizedBuiltInElements&&(ce.tagNameCheck instanceof RegExp&&TG(ce.tagNameCheck,r)||ce.tagNameCheck instanceof Function&&ce.tagNameCheck(r))))return!1}else if(!Ie[t]&&!TG(ie,yG(r,ne,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&bG(r,`data:`)===0&&Pe[e])&&!(me&&!TG(te,yG(r,ne,``)))&&r)return!1}return!0},Dt=OG({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Ot=function(e){return!Dt[gG(e)]&&TG(re,e)},kt=function(e,t,n,r){if(S&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return O(r);case`TrustedScriptURL`:return k(r)}return r},At=function(e,n,r,i){try{r?e.setAttributeNS(r,n,i):e.setAttribute(n,i),vt(e)?ct(e):pG(t.removed)}catch{ut(n,e)}},jt=function(e){xt(L.beforeSanitizeAttributes,e,null);let t=e.attributes;if(!t||vt(e))return;se=wt(L.uponSanitizeAttribute,se,H,xe);let n={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:se,forceKeepAttr:void 0},r=t.length,i=Ze(e.nodeName);for(;r--;){let a=t[r],o=a.name,s=a.namespaceURI,c=a.value,l=Ze(o),u=c,d=o===`value`?u:nMe(u);if(n.attrName=l,n.attrValue=d,n.keepAttr=!0,n.forceKeepAttr=void 0,xt(L.uponSanitizeAttribute,e,n),d=n.attrValue,De&&(l===`id`||l===`name`)&&bG(d,Oe)!==0&&(ut(o,e),d=Oe+d),_e&&TG(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){ut(o,e);continue}if(l===`attributename`&&vG(d,`href`)){ut(o,e);continue}if(!n.forceKeepAttr){if(!n.keepAttr){ut(o,e);continue}if(!he&&TG(xMe,d)){ut(o,e);continue}if(ge&&(d=gt(d)),!Et(i,l,d)){ut(o,e);continue}d=kt(i,l,s,d),d!==u&&At(e,o,s,d)}}xt(L.afterSanitizeAttributes,e,null)},Mt=function(e){let t=null,n=ht(e);for(xt(L.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(xt(L.uponSanitizeShadowNode,t,null),Tt(t,e),jt(t),yt(t.content)&&Mt(t.content),(y?y(t):t.nodeType)===UG.element){let e=_(t);yt(e)&&(Nt(e),Mt(e))}xt(L.afterSanitizeShadowDOM,e,null)},Nt=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){Mt(e.shadow);continue}let n=e.node,r=(y?y(n):n.nodeType)===UG.element,i=h(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=b?b(n):null;if(typeof e==`string`&&Ze(e)===`template`){let e=n.content;yt(e)&&t.push({node:e,shadow:null})}}if(r){let e=_(n);yt(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(He=!e,He&&(e=``),typeof e!=`string`&&!bt(e)&&(e=sMe(e),typeof e!=`string`))throw EG(`dirty is not a string, aborting`);if(!t.isSupported)return e;ye?(ae=be,se=xe):tt(n),(L.uponSanitizeElement.length>0||L.uponSanitizeAttribute.length>0)&&(ae=kG(ae)),L.uponSanitizeAttribute.length>0&&(se=kG(se)),t.removed=[];let c=Ae&&typeof e!=`string`&&bt(e);if(c){pt(e);let t=b?b(e):e.nodeName;if(typeof t==`string`){let n=Ze(t);if(!ae[n]||le[n])throw lt(e),EG(`root node is forbidden and cannot be sanitized in-place`)}if(vt(e))throw lt(e),EG(`root node is clobbered and cannot be sanitized in-place`);try{Nt(e)}catch(t){throw lt(e),t}}else if(bt(e))i=mt(``),a=i.ownerDocument.importNode(e,!0),a.nodeType===UG.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Nt(a);else{if(!Ce&&!ge&&!ve&&e.indexOf(`<`)===-1)return S&&Te?O(e):e;if(i=mt(e),!i)return Ce?null:Te?C:``}i&&Se&&ct(i.firstChild);let l=c?e:i;try{let e=ht(l);for(;o=e.nextNode();)Tt(o,l),jt(o),yt(o.content)&&Mt(o.content)}catch(n){throw c&&(lt(e),fG(t.removed,e=>{e.element&&ft(e.element)})),n}if(c)return fG(t.removed,e=>{e.element&&ft(e.element)}),ge&&_t(e),e;if(Ce){if(ge&&_t(i),we)for(s=P.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(se.shadowroot||se.shadowrootmode)&&(s=I.call(r,s,!0)),s}let u=ve?i.outerHTML:i.innerHTML;return ve&&ae[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&TG(vMe,i.ownerDocument.doctype.name)&&(u=` `+u),ge&&(u=gt(u)),S&&Te?O(u):u},t.setConfig=function(){tt(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),ye=!0,be=ae,xe=se},t.clearConfig=function(){Qe=null,ye=!1,be=null,xe=null,S=w,C=``},t.isValidAttribute=function(e,t,n){return Qe||tt({}),Et(Ze(e),Ze(t),n)},t.addHook=function(e,t){typeof t==`function`&&CG(L,e)&&mG(L[e],t)},t.removeHook=function(e,t){if(CG(L,e)){if(t!==void 0){let n=eMe(L[e],t);return n===-1?void 0:tMe(L[e],n,1)[0]}return pG(L[e])}},t.removeHooks=function(e){CG(L,e)&&(L[e]=[])},t.removeAllHooks=function(){L=WG()},t}var qG=KG(),JG=Object.defineProperty,wMe=(e,t)=>{let n={};for(var r in e)JG(n,r,{get:e[r],enumerable:!0});return t||JG(n,Symbol.toStringTag,{value:`Module`}),n};function YG(e){this.content=e}YG.prototype={constructor:YG,find:function(e){for(var t=0;t>1}},YG.from=function(e){if(e instanceof YG)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new YG(t)};function XG(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i=56320&&e<57344}function $G(e){return e>=55296&&e<56320}var eK=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;te&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);at)for(let e=0,a=0;at&&((an)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;tthis.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?nK(t+1,i):nK(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;ethis.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;te.type.rank-t.type.rank),n}};iK.none=[];var aK=class extends Error{},oK=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=cK(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(sK(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(eK.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};oK.empty=new oK(eK.empty,0,0);function sK(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(sK(a.content,t-i-1,n-i-1)))}function cK(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=cK(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function TMe(e,t,n){if(n.openStart>e.depth)throw new aK(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new aK(`Inconsistent open depths`);return lK(e,t,n,0)}function lK(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function pK(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(fK(e.nodeAfter,r),a++));for(let e=a;ei&&dK(e,t,i+1),o=r.depth>i&&dK(n,r,i+1),s=[];return pK(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(uK(a,o),fK(mK(a,hK(e,t,n,r,i+1)),s)):(a&&fK(mK(a,gK(e,t,i+1)),s),pK(t,n,i,s),o&&fK(mK(o,gK(n,r,i+1)),s)),pK(r,null,i,s),new eK(s)}function gK(e,t,n){let r=[];return pK(null,e,n,r),e.depth>n&&fK(mK(dK(e,t,n+1),gK(e,t,n+1)),r),pK(t,null,n,r),new eK(r)}function EMe(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(eK.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var _K=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new yK(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=vK.get(t);if(r)for(let e=0;ee&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),xK(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=eK.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;ee.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=eK.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};bK.prototype.text=void 0;var AMe=class e extends bK{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):xK(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function xK(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var SK=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new jMe(t,n);if(r.next==null)return e.empty;let i=CK(r);r.next&&r.err(`Unexpected trailing text`);let a=RMe(LMe(i));return zMe(a,r),a}matchType(e){for(let t=0;te.createAndFill()));for(let e=0;e=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n`+e.indexOf(t.next[n].next);return r}).join(` `)}};SK.empty=new SK(!0);var jMe=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}};function CK(e){let t=[];do t.push(MMe(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function MMe(e){let t=[];do t.push(NMe(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function NMe(e){let t=IMe(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=PMe(e,t);else break;return t}function wK(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function PMe(e,t){let n=wK(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:wK(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function FMe(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function IMe(e){if(e.eat(`(`)){let t=CK(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=FMe(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function LMe(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new SK(r.indexOf(e.length-1)>-1);for(let e=0;e-1}get whitespace(){return this.spec.whitespace||(this.spec.code?`pre`:`normal`)}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:OK(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new bK(this,this.computeAttrs(e),eK.from(t),iK.setFrom(n))}createChecked(e=null,t,n){return t=eK.from(t),this.checkContent(t),new bK(this,this.computeAttrs(e),t,iK.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=eK.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(eK.empty,!0);return i?new bK(this,e,t.append(i),iK.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;tr[t]=new e(t,n,i));let i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(let e in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}};function BMe(e,t,n){let r=n.split(`|`);return n=>{let i=n===null?`null`:typeof n;if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var VMe=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?BMe(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},MK=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=AK(e,r.attrs),this.excluded=null;let i=DK(this.attrs);this.instance=i?new iK(this,i):null}create(e=null){return!e&&this.instance?this.instance:new iK(this,OK(this.attrs,e))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,a)=>r[t]=new e(t,i++,n,a)),r}removeFromSet(e){for(var t=0;t-1}},NK=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=YG.from(e.nodes),t.marks=YG.from(e.marks||{}),this.nodes=jK.compile(this.spec.nodes,this),this.marks=MK.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+` can not be both a node and a mark`);let t=this.nodes[e],r=t.spec.content||``,i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=SK.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!t.isInline||!t.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=t}t.markSet=i==`_`?null:i?PK(this,i.split(` `)):i==``||!t.inlineContent?[]:null}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=n==null?[t]:n==``?[]:PK(this,n.split(` `))}this.nodeFromJSON=e=>bK.fromJSON(this,e),this.markFromJSON=e=>iK.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||`doc`],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof jK))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw RangeError(`Node type from different schema used (`+e.name+`)`);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new AMe(n,n.defaultAttrs,e,iK.setFrom(t))}mark(e,t){return typeof e==`string`&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError(`Unknown node type: `+e);return t}};function PK(e,t){let n=[];for(let r=0;r-1)&&n.push(o=r)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}function HMe(e){return e.tag!=null}function UMe(e){return e.style!=null}var FK=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(HMe(e))this.tags.push(e);else if(UMe(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new UK(this,t,!1);return n.addAll(e,iK.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new UK(this,t,!0);return n.addAll(e,iK.none,t.from,t.to),oK.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;re.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(e===!1)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=e.priority==null?50:e.priority,r=0;for(;r{n(e=WK(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=WK(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},IK={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},WMe={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},LK={ol:!0,ul:!0},RK=1,zK=2,BK=4;function VK(e,t,n){return t==null?e&&e.whitespace==`pre`?3:n&-5:(t?RK:0)|(t===`full`?zK:0)}var HK=class{constructor(e,t,n,r,i,a){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=a,this.content=[],this.activeMarks=iK.none,this.match=i||(a&BK?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(eK.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&RK)){let e=this.content[this.content.length-1],t;if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let t=eK.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(eK.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!IK.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},UK=class{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=VK(null,t.preserveWhitespace,0)|(n?BK:0);i=r?new HK(r.type,r.attrs,iK.none,!0,t.topMatch||r.type.contentMatch,a):n?new HK(null,null,iK.none,!0,null,a):new HK(e.schema.topNodeType,null,iK.none,!0,null,a),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=r.options&zK?`full`:this.localPreserveWS||(r.options&RK)>0,{schema:a}=this.parser;if(i===`full`||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(!i){if(n=n.replace(/[ \t\r\n\u000c]+/g,` `),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&i.nodeName==`BR`||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}}else if(i===`full`)n=n.replace(/\r\n?/g,` @@ -4352,7 +4352,7 @@ img.ProseMirror-separator { [&::-webkit-slider-thumb]:bg-bambu-green [&::-webkit-slider-thumb]:rounded-full`}),(0,G.jsx)(`button`,{onClick:F,className:`p-2 hover:bg-red-100 dark:hover:bg-red-500/20 rounded transition-colors`,children:(0,G.jsx)(ku,{className:`w-4 h-4 text-red-600 dark:text-red-400`})})]}):(0,G.jsxs)(`label`,{className:`flex flex-col items-center justify-center gap-2 p-6 border-2 border-dashed border-bambu-dark-tertiary rounded-lg cursor-pointer hover:border-bambu-green/50 transition-colors`,children:[(0,G.jsx)(Iu,{className:`w-8 h-8 text-bambu-gray`}),(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:`Drop audio file or click to upload`}),(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray/60`,children:`MP3, WAV, M4A, AAC, OGG`}),(0,G.jsx)(`input`,{type:`file`,accept:`.mp3,.wav,.m4a,.aac,.ogg,audio/*`,onChange:P,className:`hidden`})]})]}),(0,G.jsxs)(`div`,{className:`p-3 bg-bambu-dark rounded-lg text-sm space-y-1`,children:[(0,G.jsxs)(`p`,{className:`text-bambu-gray`,children:[(0,G.jsx)(`span`,{className:`text-white`,children:`Original:`}),` `,np(d),` @ `,O?.width,`x`,O?.height]}),(0,G.jsxs)(`p`,{className:`text-bambu-gray`,children:[(0,G.jsx)(`span`,{className:`text-white`,children:`Output:`}),` `,np(L),` @ `,v,`x speed`,b&&` + music overlay`]})]})]}),j.isPending&&(0,G.jsxs)(`div`,{className:`absolute inset-0 bg-black/80 flex flex-col items-center justify-center gap-4`,children:[(0,G.jsx)(Y,{className:`w-12 h-12 text-bambu-green animate-spin`}),(0,G.jsx)(`p`,{className:`text-white text-lg`,children:`Processing timelapse...`}),(0,G.jsx)(`p`,{className:`text-bambu-gray text-sm`,children:`This may take a few moments`})]})]})})}var LVe=[.25,.5,.75,1,1.5,2,3,4];function B2({src:e,title:t,downloadFilename:n,archiveId:r,onClose:i,onEdit:a}){let o=(0,f.useRef)(null),[s,c]=(0,f.useState)(!0),[l,u]=(0,f.useState)(1),[d,p]=(0,f.useState)(0),[m,h]=(0,f.useState)(0),[g,_]=(0,f.useState)(!1);(0,f.useEffect)(()=>{let e=o.current;e&&(e.playbackRate=l)},[l]),(0,f.useEffect)(()=>{let e=e=>{e.key===`Escape`&&i()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[i]),(0,f.useEffect)(()=>{let e=o.current;if(!e)return;let t=()=>p(e.currentTime),n=()=>h(e.duration),r=()=>c(!0),i=()=>c(!1);return e.addEventListener(`timeupdate`,t),e.addEventListener(`durationchange`,n),e.addEventListener(`play`,r),e.addEventListener(`pause`,i),()=>{e.removeEventListener(`timeupdate`,t),e.removeEventListener(`durationchange`,n),e.removeEventListener(`play`,r),e.removeEventListener(`pause`,i)}},[]);let v=()=>{let e=o.current;e&&(s?e.pause():e.play())};return(0,G.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/80`,children:[(0,G.jsxs)(`div`,{className:`relative bg-bambu-dark-secondary rounded-xl max-w-4xl w-full mx-4 overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-bambu-dark-tertiary`,children:[(0,G.jsxs)(`h3`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,G.jsx)(cc,{className:`w-5 h-5 text-bambu-green`}),t]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[r&&(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:()=>_(!0),children:[(0,G.jsx)(Cl,{className:`w-4 h-4`}),`Edit`]}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:()=>{let t=document.createElement(`a`);t.href=e,t.download=n,t.click()},children:[(0,G.jsx)(Ws,{className:`w-4 h-4`}),`Download`]}),(0,G.jsx)(`button`,{onClick:i,className:`p-1 hover:bg-bambu-dark-tertiary rounded transition-colors`,children:(0,G.jsx)(Zu,{className:`w-5 h-5 text-bambu-gray`})})]})]}),(0,G.jsxs)(`div`,{className:`p-4`,children:[(0,G.jsx)(`video`,{ref:o,src:e,autoPlay:!0,className:`w-full rounded-lg`,onClick:v}),(0,G.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray w-12 text-right`,children:np(d)}),(0,G.jsx)(`input`,{type:`range`,min:0,max:m||100,value:d,onChange:e=>{let t=o.current;t&&(t.currentTime=parseFloat(e.target.value))},className:`flex-1 h-1 bg-bambu-dark-tertiary rounded-lg appearance-none cursor-pointer [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3 [&::-webkit-slider-thumb]:bg-bambu-green [&::-webkit-slider-thumb]:rounded-full - [&::-webkit-slider-thumb]:cursor-pointer`}),(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray w-12`,children:np(m)})]}),(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)(`button`,{onClick:()=>{let e=o.current;e&&(e.currentTime=Math.max(0,e.currentTime-5))},className:`p-2 hover:bg-bambu-dark-tertiary rounded-lg transition-colors`,title:`Skip back 5s`,children:(0,G.jsx)(ru,{className:`w-5 h-5 text-bambu-gray`})}),(0,G.jsx)(`button`,{onClick:v,className:`p-2 bg-bambu-green hover:bg-bambu-green-dark rounded-lg transition-colors`,children:s?(0,G.jsx)(bl,{className:`w-5 h-5 text-white`}):(0,G.jsx)(El,{className:`w-5 h-5 text-white`})}),(0,G.jsx)(`button`,{onClick:()=>{let e=o.current;e&&(e.currentTime=Math.min(m,e.currentTime+5))},className:`p-2 hover:bg-bambu-dark-tertiary rounded-lg transition-colors`,title:`Skip forward 5s`,children:(0,G.jsx)(iu,{className:`w-5 h-5 text-bambu-gray`})})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:`Speed:`}),(0,G.jsx)(`div`,{className:`flex gap-1`,children:LVe.map(e=>(0,G.jsxs)(`button`,{onClick:()=>u(e),className:`px-2 py-1 text-xs rounded transition-colors ${l===e?`bg-bambu-green text-white`:`bg-bambu-dark-tertiary text-bambu-gray hover:bg-bambu-dark-tertiary/80`}`,children:[e,`x`]},e))})]})]})]})]})]}),g&&r&&(0,G.jsx)(IVe,{archiveId:r,timelapseSrc:e,onClose:()=>_(!1),onSave:a})]})}function V2({archiveId:e,archiveName:t,printerName:n,onClose:r}){let{t:i}=U(),{showToast:a}=Hd(),[o,s]=(0,f.useState)(new Set),[c,l]=(0,f.useState)(!1),[u,d]=(0,f.useState)(null),p=(0,f.useRef)(null),m=(0,f.useRef)(null),h=K({queryKey:[`archive-printer-media`,e],queryFn:()=>Z.getArchivePrinterMedia(e),staleTime:6e4}),g=(0,f.useMemo)(()=>h.data?.remote_files??[],[h.data]);(0,f.useEffect)(()=>{!h.data||p.current===e||(p.current=e,g.length===1&&s(new Set([g[0].path])))},[e,h.data,g]),(0,f.useEffect)(()=>{let e=new Set(g.map(e=>e.path));s(t=>new Set([...t].filter(t=>e.has(t))))},[g]),(0,f.useEffect)(()=>()=>m.current?.abort(),[]),(0,f.useEffect)(()=>{let e=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]);let _=e=>{s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},v=async()=>{let n=h.data?.local_timelapse?.name??``,r=n.includes(`.`)?`.${n.split(`.`).pop()}`:``;try{await Z.downloadArchiveTimelapse(e,`${t}_timelapse${r}`)}catch(e){a(i(`printerFiles.downloadFailed`,{error:e instanceof Error?e.message:i(`printerFiles.unknownError`)}),`error`)}},y=async()=>{if(!h.data?.printer_id||o.size===0)return;let e=g.filter(e=>o.has(e.path));if(e.length===0)return;let n=new AbortController;m.current=n,l(!0);try{let r=await Z.downloadPrinterFilesAsZip(h.data.printer_id,e.map(e=>e.path),Object.fromEntries(e.map(e=>[e.path,e.size])),`${t.replace(/[^a-zA-Z0-9]/g,`_`)}-printer-videos.zip`,!0,n.signal,(e,t)=>d({current:e,total:t}));r.failed>0?a(i(`printerFiles.zipPartial`,{successful:r.successful,total:r.requested}),`warning`):a(i(`printerFiles.zipStarted`,{count:r.successful}))}catch(e){a(i(`printerFiles.downloadFailed`,{error:e instanceof Error?e.message:i(`printerFiles.unknownError`)}),`error`)}finally{m.current===n&&(m.current=null),d(null),l(!1)}},b=!!h.data?.local_timelapse||g.length>0,x=e=>i(e===`printer_files_forbidden`?`printers.permission.noFiles`:e===`printer_missing`?`archives.media.printerMissing`:e===`timelapse_unavailable`?`archives.media.timelapseUnavailable`:`archives.media.ipcamUnavailable`),S=(h.data?.warnings??[]).map(e=>(0,G.jsx)(`p`,{className:`text-xs text-amber-600 dark:text-amber-400`,children:x(e)},e));return(0,G.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-4`,onClick:r,children:(0,G.jsxs)(`div`,{className:`flex max-h-[85vh] w-full max-w-2xl flex-col overflow-hidden rounded-xl border border-bambu-dark-tertiary bg-bambu-dark-secondary`,onClick:e=>e.stopPropagation(),children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between border-b border-bambu-dark-tertiary p-4`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`h3`,{className:`flex items-center gap-2 text-lg font-semibold text-white`,children:[(0,G.jsx)(Bu,{className:`h-5 w-5 text-bambu-green`}),i(`archives.media.title`)]}),(0,G.jsxs)(`p`,{className:`truncate text-sm text-bambu-gray`,children:[t,` · `,n]})]}),(0,G.jsx)(`button`,{onClick:r,className:`rounded p-1 text-bambu-gray hover:bg-bambu-dark-tertiary hover:text-white`,children:(0,G.jsx)(Zu,{className:`h-5 w-5`})})]}),(0,G.jsx)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:h.isLoading?(0,G.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-12 text-bambu-gray`,children:[(0,G.jsx)(Y,{className:`h-5 w-5 animate-spin`}),i(`archives.media.searching`)]}):h.isError?(0,G.jsx)(`p`,{className:`py-8 text-center text-red-500`,children:i(`archives.media.searchFailed`)}):b?(0,G.jsxs)(`div`,{className:`space-y-4`,children:[h.data?.local_timelapse&&(0,G.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border border-bambu-dark-tertiary bg-bambu-dark p-3`,children:[(0,G.jsx)(cc,{className:`h-5 w-5 shrink-0 text-bambu-green`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`p`,{className:`truncate text-sm font-medium text-white`,children:h.data.local_timelapse.name}),(0,G.jsxs)(`p`,{className:`text-xs text-bambu-gray`,children:[i(`archives.media.attachedTimelapse`),` · `,Bd(h.data.local_timelapse.size)]})]}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:v,children:[(0,G.jsx)(Ws,{className:`h-4 w-4`}),i(`common.download`)]})]}),g.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,G.jsxs)(`p`,{className:`text-sm text-bambu-gray`,children:[i(`archives.media.printerFiles`),` (`,g.length,`)`]}),(0,G.jsx)(`button`,{className:`text-xs text-bambu-green hover:text-bambu-green-light`,onClick:()=>s(o.size===g.length?new Set:new Set(g.map(e=>e.path))),children:o.size===g.length?i(`common.deselectAll`):i(`common.selectAll`)})]}),(0,G.jsx)(`div`,{className:`space-y-1`,children:g.map(e=>{let t=o.has(e.path);return(0,G.jsxs)(`button`,{className:`flex w-full items-center gap-3 rounded-lg border p-3 text-left transition-colors ${t?`border-bambu-green/60 bg-bambu-green/10`:`border-bambu-dark-tertiary bg-bambu-dark hover:border-bambu-gray`}`,onClick:()=>_(e.path),children:[t?(0,G.jsx)(du,{className:`h-5 w-5 shrink-0 text-bambu-green`}):(0,G.jsx)(pu,{className:`h-5 w-5 shrink-0 text-bambu-gray`}),e.kind===`timelapse`?(0,G.jsx)(cc,{className:`h-5 w-5 shrink-0 text-bambu-green`}):(0,G.jsx)(Bu,{className:`h-5 w-5 shrink-0 text-blue-400`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-white`,children:e.name}),(0,G.jsx)(`span`,{className:`shrink-0 text-xs text-bambu-gray`,children:Bd(e.size)})]},e.path)})})]}),S]}):(0,G.jsxs)(`div`,{className:`space-y-3 py-8 text-center`,children:[(0,G.jsx)(`p`,{className:`text-bambu-gray`,children:i(`archives.media.none`)}),S]})}),g.length>0&&(0,G.jsx)(`div`,{className:`flex items-center justify-end border-t border-bambu-dark-tertiary p-4`,children:(0,G.jsxs)(Q,{variant:`primary`,onClick:y,disabled:o.size===0||c,children:[c?(0,G.jsx)(Y,{className:`h-4 w-4 animate-spin`}):(0,G.jsx)(Ws,{className:`h-4 w-4`}),u?`${u.current}/${u.total}`:`${i(`archives.media.downloadSelected`)} (${o.size})`]})})]})})}function RVe({archiveIds:e,onClose:t}){(0,f.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]);let{data:n,isLoading:r,error:i}=K({queryKey:[`archive-comparison`,e],queryFn:()=>Z.compareArchives(e)});return(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/80 flex items-center justify-center z-50 p-4`,onClick:t,children:(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg max-w-4xl w-full max-h-[90vh] flex flex-col border border-bambu-dark-tertiary`,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)(`h3`,{className:`text-lg font-semibold text-white`,children:[`Compare Archives (`,e.length,`)`]}),(0,G.jsx)(`button`,{onClick:t,className:`text-bambu-gray hover:text-white p-1`,children:(0,G.jsx)(Zu,{className:`w-5 h-5`})})]}),(0,G.jsx)(`div`,{className:`flex-1 overflow-auto p-4 bg-bambu-dark-secondary`,children:r?(0,G.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,G.jsx)(Y,{className:`w-8 h-8 text-bambu-green animate-spin`})}):i?(0,G.jsxs)(`div`,{className:`text-center py-12 text-red-700 dark:text-red-400`,children:[(0,G.jsx)(Mu,{className:`w-12 h-12 mx-auto mb-4 opacity-50`}),(0,G.jsx)(`p`,{children:`Failed to load comparison`}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mt-2`,children:i instanceof Error?i.message:`Unknown error`})]}):n?(0,G.jsx)(zVe,{comparison:n}):null}),(0,G.jsx)(`div`,{className:`p-4 border-t border-bambu-dark-tertiary`,children:(0,G.jsx)(Q,{variant:`secondary`,onClick:t,className:`w-full`,children:`Close`})})]})})}function zVe({comparison:e}){return(0,G.jsxs)(`div`,{className:`space-y-6`,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`,{children:[(0,G.jsx)(`th`,{className:`text-left text-sm text-bambu-gray font-medium pb-2 pr-4 min-w-[150px]`,children:`Setting`}),e.archives.map(e=>(0,G.jsxs)(`th`,{className:`text-left text-sm font-medium pb-2 px-2 min-w-[120px]`,children:[(0,G.jsx)(`div`,{className:`text-white truncate max-w-[150px]`,title:e.print_name,children:e.print_name}),(0,G.jsx)(`div`,{className:`text-xs ${e.status===`completed`?`text-status-ok`:e.status===`failed`?`text-status-error`:`text-bambu-gray`}`,children:e.status})]},e.id))]})}),(0,G.jsx)(`tbody`,{className:`divide-y divide-bambu-gray/20`,children:e.comparison.map(e=>(0,G.jsxs)(`tr`,{className:e.has_difference?`bg-yellow-500/5`:``,children:[(0,G.jsx)(`td`,{className:`py-2 pr-4 text-sm`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.has_difference&&(0,G.jsx)(Mu,{className:`w-3 h-3 text-yellow-600 dark:text-yellow-400 flex-shrink-0`}),(0,G.jsx)(`span`,{className:e.has_difference?`text-yellow-700 dark:text-yellow-400`:`text-bambu-gray`,children:e.label})]})}),e.values.map((t,n)=>(0,G.jsxs)(`td`,{className:`py-2 px-2 text-sm text-white`,children:[t??(0,G.jsx)(`span`,{className:`text-bambu-gray/50`,children:`-`}),e.unit&&t!==null&&(0,G.jsx)(`span`,{className:`text-bambu-gray ml-1`,children:e.unit})]},n))]},e.field))})]})}),e.differences.length>0&&(0,G.jsxs)(`div`,{className:`p-4 bg-yellow-50 border border-yellow-300 dark:bg-yellow-500/10 dark:border-yellow-500/30 rounded-lg`,children:[(0,G.jsxs)(`h4`,{className:`text-sm font-medium text-yellow-700 dark:text-yellow-400 mb-2 flex items-center gap-2`,children:[(0,G.jsx)(Mu,{className:`w-4 h-4`}),e.differences.length,` Difference`,e.differences.length>1?`s`:``,` Found`]}),(0,G.jsxs)(`ul`,{className:`text-sm text-white/80 space-y-1`,children:[e.differences.slice(0,5).map(e=>(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`text-yellow-700 dark:text-yellow-400`,children:e.label}),`: `,e.values.join(` vs `),` `,e.unit||``]},e.field)),e.differences.length>5&&(0,G.jsxs)(`li`,{className:`text-bambu-gray`,children:[`...and `,e.differences.length-5,` more`]})]})]}),e.success_correlation.has_both_outcomes?(0,G.jsxs)(`div`,{className:`p-4 bg-bambu-dark rounded-lg`,children:[(0,G.jsxs)(`h4`,{className:`text-sm font-medium text-white mb-3 flex items-center gap-2`,children:[(0,G.jsx)(as,{className:`w-4 h-4 text-bambu-green`}),`Success/Failure Analysis`]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-4 text-sm mb-3`,children:[(0,G.jsxs)(`span`,{className:`text-bambu-green`,children:[e.success_correlation.successful_count,` successful`]}),(0,G.jsxs)(`span`,{className:`text-red-700 dark:text-red-400`,children:[e.success_correlation.failed_count,` failed`]})]}),e.success_correlation.insights&&e.success_correlation.insights.length>0?(0,G.jsx)(`div`,{className:`space-y-2`,children:e.success_correlation.insights.map(e=>(0,G.jsxs)(`div`,{className:`text-sm p-2 bg-bambu-dark-secondary rounded`,children:[(0,G.jsxs)(`span`,{className:`text-white font-medium`,children:[e.label,`:`]}),` `,(0,G.jsx)(`span`,{className:`text-white/80`,children:e.insight})]},e.field))}):(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:`No clear correlations found between settings and outcomes.`})]}):(0,G.jsx)(`div`,{className:`p-4 bg-bambu-dark rounded-lg text-sm text-bambu-gray`,children:(0,G.jsx)(`p`,{children:e.success_correlation.message||`Need both successful and failed prints for correlation analysis.`})})]})}function BVe(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return`Just now`;if(r<60)return`${r}m ago`;let i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function VVe({upload:e,projects:t,onArchive:n,onDiscard:r,isArchiving:i,isDiscarding:a}){let[o,s]=(0,f.useState)(!1),[c,l]=(0,f.useState)(e.tags||``),[u,d]=(0,f.useState)(e.notes||``),[p,m]=(0,f.useState)(e.project_id),[h,g]=(0,f.useState)(!1);return(0,G.jsx)(Pd,{children:(0,G.jsxs)(Id,{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)(tc,{className:`w-8 h-8 text-bambu-green flex-shrink-0`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white font-medium`,title:e.filename,children:e.display_name||e.filename}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-bambu-gray`,children:[(0,G.jsx)(`span`,{children:Bd(e.file_size)}),(0,G.jsx)(`span`,{children:`·`}),(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(Ts,{className:`w-3 h-3`}),BVe(e.uploaded_at)]}),e.source_ip&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{children:`·`}),(0,G.jsxs)(`span`,{children:[`from `,e.source_ip]})]})]})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`button`,{onClick:()=>s(!o),className:`p-1 text-bambu-gray hover:text-white transition-colors`,children:o?(0,G.jsx)(us,{className:`w-5 h-5`}):(0,G.jsx)(ss,{className:`w-5 h-5`})}),(0,G.jsx)(Q,{variant:`primary`,size:`sm`,onClick:()=>n(e.id,{tags:c,notes:u,project_id:p||void 0}),disabled:i,children:i?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Oo,{className:`w-4 h-4`}),`Archive`]})}),(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:()=>g(!0),disabled:a,children:a?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(ku,{className:`w-4 h-4 text-red-600 dark:text-red-400`})})]})]}),h&&(0,G.jsx)($d,{title:`Discard Upload`,message:`Are you sure you want to discard "${e.filename}"? This cannot be undone.`,confirmText:`Discard`,variant:`danger`,onConfirm:()=>{r(e.id),g(!1)},onCancel:()=>g(!1)}),o&&(0,G.jsxs)(`div`,{className:`mt-4 pt-4 border-t border-bambu-dark-tertiary space-y-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:`Tags`}),(0,G.jsx)(`input`,{type:`text`,value:c,onChange:e=>l(e.target.value),placeholder:`e.g., functional, prototype, gift`,className:`w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-md px-3 py-2 text-white placeholder-bambu-gray text-sm`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:`Notes`}),(0,G.jsx)(`textarea`,{value:u,onChange:e=>d(e.target.value),placeholder:`Add notes about this print...`,rows:2,className:`w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-md px-3 py-2 text-white placeholder-bambu-gray text-sm resize-none`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:`Project`}),(0,G.jsxs)(`select`,{value:p||``,onChange:e=>m(e.target.value?Number(e.target.value):null),className:`w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-md px-3 py-2 text-white text-sm`,children:[(0,G.jsx)(`option`,{value:``,children:`No project`}),t.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]})]})]})})}function HVe(){let e=no(),{showToast:t}=Hd(),[n,r]=(0,f.useState)(!1),[i,a]=(0,f.useState)(!1),[o,s]=(0,f.useState)(new Set),[c,l]=(0,f.useState)(new Set),{data:u,isLoading:d}=K({queryKey:[`pending-uploads`],queryFn:bd.list,refetchInterval:1e4}),{data:p}=K({queryKey:[`projects`],queryFn:()=>Z.getProjects(),select:e=>Vp([...e].sort((e,t)=>e.name.localeCompare(t.name)))}),m=q({mutationFn:({id:e,data:t})=>bd.archive(e,t),onMutate:({id:e})=>{s(t=>new Set(t).add(e))},onSettled:(e,t,{id:n})=>{s(e=>{let t=new Set(e);return t.delete(n),t})},onSuccess:n=>{e.invalidateQueries({queryKey:[`pending-uploads`]}),e.invalidateQueries({queryKey:[`archives`]}),t(`Archived: ${n.print_name}`)},onError:e=>{t(e.message||`Failed to archive`,`error`)}}),h=q({mutationFn:e=>bd.discard(e),onMutate:e=>{l(t=>new Set(t).add(e))},onSettled:(e,t,n)=>{l(e=>{let t=new Set(e);return t.delete(n),t})},onSuccess:()=>{e.invalidateQueries({queryKey:[`pending-uploads`]}),t(`Upload discarded`)},onError:e=>{t(e.message||`Failed to discard`,`error`)}}),g=q({mutationFn:bd.archiveAll,onSuccess:n=>{e.invalidateQueries({queryKey:[`pending-uploads`]}),e.invalidateQueries({queryKey:[`archives`]}),t(`Archived ${n.archived} files${n.failed>0?`, ${n.failed} failed`:``}`)},onError:e=>{t(e.message||`Failed to archive all`,`error`)}}),_=q({mutationFn:bd.discardAll,onSuccess:n=>{e.invalidateQueries({queryKey:[`pending-uploads`]}),t(`Discarded ${n.discarded} files`)},onError:e=>{t(e.message||`Failed to discard all`,`error`)}});return d?(0,G.jsx)(Pd,{children:(0,G.jsx)(Id,{className:`py-8 flex justify-center`,children:(0,G.jsx)(Y,{className:`w-6 h-6 animate-spin text-bambu-green`})})}):!u||u.length===0?null:(0,G.jsxs)(`div`,{className:`mb-6`,children:[(0,G.jsxs)(Pd,{className:`border-l-4 border-l-yellow-500`,children:[(0,G.jsx)(Fd,{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)(Iu,{className:`w-5 h-5 text-yellow-500`}),(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white`,children:[`Pending Uploads (`,u.length,`)`]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Q,{variant:`primary`,size:`sm`,onClick:()=>r(!0),disabled:g.isPending,children:g.isPending?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Oo,{className:`w-4 h-4`}),`Archive All`]})}),(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:()=>a(!0),disabled:_.isPending,children:_.isPending?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ku,{className:`w-4 h-4`}),`Discard All`]})})]})]})}),(0,G.jsxs)(Id,{children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mb-4`,children:`These files were uploaded via the virtual printer. Review and archive them to add to your collection.`}),(0,G.jsx)(`div`,{className:`space-y-3`,children:u.map(e=>(0,G.jsx)(VVe,{upload:e,projects:p||[],onArchive:(e,t)=>m.mutate({id:e,data:t}),onDiscard:e=>h.mutate(e),isArchiving:o.has(e.id),isDiscarding:c.has(e.id)},e.id))})]})]}),n&&(0,G.jsx)($d,{title:`Archive All Uploads`,message:`Are you sure you want to archive all ${u.length} pending uploads?`,confirmText:`Archive All`,onConfirm:()=>{g.mutate(),r(!1)},onCancel:()=>r(!1)}),i&&(0,G.jsx)($d,{title:`Discard All Uploads`,message:`Are you sure you want to discard all ${u.length} pending uploads? This cannot be undone.`,confirmText:`Discard All`,variant:`danger`,onConfirm:()=>{_.mutate(),a(!1)},onCancel:()=>a(!1)})]})}function UVe({onClose:e}){let t=no(),{showToast:n}=Hd(),[r,i]=(0,f.useState)(``),[a,o]=(0,f.useState)(null),[s,c]=(0,f.useState)(``),[l,u]=(0,f.useState)(null),[d,p]=(0,f.useState)(`count`);(0,f.useEffect)(()=>{let t=t=>{t.key===`Escape`&&(a?o(null):l?u(null):e())};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,a,l]);let{data:m,isLoading:h}=K({queryKey:[`tags`],queryFn:Z.getTags}),g=q({mutationFn:({oldName:e,newName:t})=>Z.renameTag(e,t),onSuccess:(e,{oldName:r,newName:i})=>{t.invalidateQueries({queryKey:[`tags`]}),t.invalidateQueries({queryKey:[`archives`]}),n(`Renamed "${r}" to "${i}" in ${e.affected} archive${e.affected===1?``:`s`}`),o(null)},onError:e=>{n(e.message||`Failed to rename tag`,`error`)}}),_=q({mutationFn:e=>Z.deleteTag(e),onSuccess:(e,r)=>{t.invalidateQueries({queryKey:[`tags`]}),t.invalidateQueries({queryKey:[`archives`]}),n(`Deleted "${r}" from ${e.affected} archive${e.affected===1?``:`s`}`),u(null)},onError:e=>{n(e.message||`Failed to delete tag`,`error`)}}),v=e=>{o(e.name),c(e.name),u(null)},y=()=>{o(null),c(``)},b=()=>{if(!a||!s.trim())return;let e=s.trim();if(e===a){y();return}g.mutate({oldName:a,newName:e})},x=e=>{e.key===`Enter`?(e.preventDefault(),b()):e.key===`Escape`&&(e.preventDefault(),y())},S=e=>{u(e),o(null)},C=()=>{l&&_.mutate(l)},w=m?.filter(e=>e.name.toLowerCase().includes(r.toLowerCase())).sort((e,t)=>d===`count`&&t.count-e.count||e.name.localeCompare(t.name)),T=m?.reduce((e,t)=>e+t.count,0)||0;return(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,children:(0,G.jsx)(Pd,{className:`w-full max-w-lg max-h-[80vh] flex flex-col`,children:(0,G.jsxs)(Id,{className:`p-0 flex flex-col min-h-0`,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)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(yu,{className:`w-5 h-5 text-bambu-green`}),(0,G.jsx)(`h2`,{className:`text-xl font-semibold text-white`,children:`Manage Tags`})]}),(0,G.jsx)(`button`,{onClick:e,className:`text-bambu-gray hover:text-white transition-colors`,children:(0,G.jsx)(Zu,{className:`w-5 h-5`})})]}),(0,G.jsxs)(`div`,{className:`p-4 border-b border-bambu-dark-tertiary flex-shrink-0`,children:[(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsxs)(`div`,{className:`relative flex-1`,children:[(0,G.jsx)(Gl,{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:`Search tags...`,className:`w-full pl-9 pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:border-bambu-green focus:outline-none`,value:r,onChange:e=>i(e.target.value)})]}),(0,G.jsxs)(`select`,{className:`px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:border-bambu-green focus:outline-none`,value:d,onChange:e=>p(e.target.value),children:[(0,G.jsx)(`option`,{value:`count`,children:`Sort by Count`}),(0,G.jsx)(`option`,{value:`name`,children:`Sort by Name`})]})]}),m&&(0,G.jsxs)(`p`,{className:`text-xs text-bambu-gray mt-2`,children:[m.length,` tag`,m.length===1?``:`s`,` across `,T,` usage`,T===1?``:`s`]})]}),(0,G.jsx)(`div`,{className:`flex-1 overflow-y-auto min-h-0 p-4`,children:h?(0,G.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,G.jsx)(Y,{className:`w-6 h-6 animate-spin text-bambu-gray`})}):w?.length?(0,G.jsx)(`div`,{className:`space-y-2`,children:w.map(e=>(0,G.jsx)(`div`,{className:`flex items-center gap-2 p-2 rounded-lg bg-bambu-dark hover:bg-bambu-dark-tertiary transition-colors group`,children:a===e.name?(0,G.jsxs)(`div`,{className:`flex-1 flex items-center gap-2`,children:[(0,G.jsx)(`input`,{type:`text`,className:`flex-1 px-2 py-1 bg-bambu-dark-tertiary border border-bambu-green rounded text-white text-sm focus:outline-none`,value:s,onChange:e=>c(e.target.value),onKeyDown:x,autoFocus:!0}),(0,G.jsx)(Q,{size:`sm`,variant:`primary`,onClick:b,disabled:!s.trim()||g.isPending,className:`p-1.5`,children:g.isPending?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(as,{className:`w-4 h-4`})}),(0,G.jsx)(Q,{size:`sm`,variant:`ghost`,onClick:y,className:`p-1.5`,children:(0,G.jsx)(Zu,{className:`w-4 h-4`})})]}):l===e.name?(0,G.jsxs)(`div`,{className:`flex-1 flex items-center gap-2`,children:[(0,G.jsx)(Mu,{className:`w-4 h-4 text-yellow-600 dark:text-yellow-400 flex-shrink-0`}),(0,G.jsxs)(`span`,{className:`text-sm text-bambu-gray-light flex-1`,children:[`Delete "`,e.name,`" from `,e.count,` archive`,e.count===1?``:`s`,`?`]}),(0,G.jsx)(Q,{size:`sm`,variant:`danger`,onClick:C,disabled:_.isPending,className:`p-1.5`,children:_.isPending?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(ku,{className:`w-4 h-4`})}),(0,G.jsx)(Q,{size:`sm`,variant:`ghost`,onClick:()=>u(null),className:`p-1.5`,children:(0,G.jsx)(Zu,{className:`w-4 h-4`})})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(yu,{className:`w-4 h-4 text-bambu-gray flex-shrink-0`}),(0,G.jsx)(`span`,{className:`text-white flex-1 truncate`,children:e.name}),(0,G.jsx)(`span`,{className:`px-2 py-0.5 rounded-full bg-bambu-dark-tertiary text-bambu-gray text-xs`,children:e.count}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1 can-hover:opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition-opacity`,children:[(0,G.jsx)(`button`,{onClick:()=>v(e),className:`p-1.5 rounded hover:bg-bambu-dark text-bambu-gray hover:text-white transition-colors`,title:`Rename tag`,children:(0,G.jsx)(Cl,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{onClick:()=>S(e.name),className:`p-1.5 rounded hover:bg-bambu-dark text-bambu-gray hover:text-red-700 dark:hover:text-red-400 transition-colors`,title:`Delete tag`,children:(0,G.jsx)(ku,{className:`w-4 h-4`})})]})]})},e.name))}):(0,G.jsx)(`div`,{className:`text-center py-8 text-bambu-gray`,children:r?`No tags match your search`:`No tags found`})}),(0,G.jsx)(`div`,{className:`flex gap-3 p-4 border-t border-bambu-dark-tertiary flex-shrink-0`,children:(0,G.jsx)(Q,{variant:`secondary`,onClick:e,className:`flex-1`,children:`Close`})})]})})})}var H2=`bambuddy-printlog-columns`,U2={date:`archives.log.date`,print_name:`archives.log.printName`,printer:`archives.log.printer`,user:`archives.log.user`,status:`archives.log.status`,duration:`archives.log.duration`,completed_at:`archives.log.completedAt`,filament:`archives.log.filament`,filament_used:`archives.log.filamentUsed`,cost:`archives.log.cost`,energy:`archives.log.energy`,energy_cost:`archives.log.energyCost`},W2=[{id:`date`,visible:!0},{id:`print_name`,visible:!0},{id:`printer`,visible:!0},{id:`user`,visible:!0},{id:`status`,visible:!0},{id:`duration`,visible:!0},{id:`filament`,visible:!0},{id:`filament_used`,visible:!0},{id:`completed_at`,visible:!1},{id:`cost`,visible:!1},{id:`energy`,visible:!1},{id:`energy_cost`,visible:!1}];function WVe(){try{let e=localStorage.getItem(H2);if(e){let t=JSON.parse(e),n=new Set(Object.keys(U2)),r=new Set(t.map(e=>e.id)),i=t.filter(e=>n.has(e.id)).map(e=>({id:e.id,visible:!!e.visible})),a=W2.filter(e=>!r.has(e.id));if(i.length>0)return[...i,...a]}}catch{}return W2.map(e=>({...e}))}var G2=`bambuddy-printlog-sort`,K2=new Set(Object.keys(U2)),GVe={column:`date`,direction:`desc`};function KVe(){try{let e=localStorage.getItem(G2);if(e){let t=JSON.parse(e);if(K2.has(t?.column)&&(t.direction===`asc`||t.direction===`desc`))return t}}catch{}return{...GVe}}function qVe(e){try{localStorage.setItem(G2,JSON.stringify(e))}catch{}}function JVe(e){try{localStorage.setItem(H2,JSON.stringify(e.map(e=>({id:e.id,visible:e.visible}))))}catch{}}function q2(e){let t=e.filename;if(t){let e=t.toLowerCase();if(e.endsWith(`.gcode`)||e.includes(`.gcode.`))return!0}return!!(e.total_layers||e.print_time_seconds)}async function J2(e,t,n,r){try{if(n===`source`){let{token:n}=await Z.createSourceSlicerToken(e),i=Z.getSourceSlicerDownloadUrl(e,n,t);ZW(`${window.location.origin}${i}`,r)}else{let{token:n}=await Z.createArchiveSlicerToken(e),i=Z.getArchiveSlicerDownloadUrl(e,n,t);ZW(`${window.location.origin}${i}`,r)}}catch{let i=n===`source`?Z.getSource3mfForSlicer(e,t):Z.getArchiveForSlicer(e,t);ZW(`${window.location.origin}${i}`,r)}}function YVe({archive:e,printerName:t,printerMap:n,isSelected:r,onSelect:i,selectionMode:a,projects:o,isHighlighted:s,timeFormat:c=`system`,preferredSlicer:l=`bambu_studio`,useSlicerApi:u=!1,currency:d,t:p,onNavigateToArchive:m}){s&&console.log(`ArchiveCard isHighlighted=true for archive:`,e.id);let h=no(),{showToast:g}=Hd(),{hasPermission:_,canModify:v}=Od(),y=$n(),b=(0,f.useMemo)(()=>{let t=e.extra_data?.slicer_ams_mapping;if(!(!t||!Array.isArray(t.mapping)||t.printer_id==null))return n.get(t.printer_id)},[e.extra_data,n]),[x,S]=(0,f.useState)(!1),[C,w]=(0,f.useState)(!1),[T,E]=(0,f.useState)(!1),[D,O]=(0,f.useState)(!1),[k,A]=(0,f.useState)(!1),[j,M]=(0,f.useState)(!1),N=K({queryKey:[`archive`,e.id,`delete-impact`],queryFn:()=>Z.getArchiveDeleteImpact(e.id),enabled:k,staleTime:0}),[P,F]=(0,f.useState)(!1),[I,L]=(0,f.useState)(!1),[R,z]=(0,f.useState)(!1),[B,V]=(0,f.useState)(!1),[ee,te]=(0,f.useState)(!1),[ne,re]=(0,f.useState)([]),[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)(!1),[pe,me]=(0,f.useState)(!1),[he,ge]=(0,f.useState)(null),[_e,ve]=(0,f.useState)(null),[ye,be]=(0,f.useState)(!1),[xe,Se]=(0,f.useState)(null),Ce=(0,f.useRef)(null),we=(0,f.useRef)(null),Te=(0,f.useRef)(null),{data:Ee}=K({queryKey:[`archive-plates`,e.id],queryFn:()=>Z.getArchivePlates(e.id),enabled:ye,staleTime:300*1e3}),De=e.duplicate_sequence??0,Oe=Hp(e.user_verdict_source),ke=e.original_archive_id??null,Ae=Ee?.plates??[],je=Ee?.is_multi_plate??!1,Me=_e??0,Ne=async()=>{try{let t=await Z.getArchivePlates(e.id);if(t.has_gcode===!1){g(p(`archives.platePicker.noGcode`),`info`);return}if(t.is_multi_plate&&t.plates.length>1){Se(t.plates);return}}catch{}y(`/gcode-viewer?archive=${e.id}`)},Pe=q({mutationFn:()=>Z.deleteArchiveTimelapse(e.id),onSuccess:()=>{h.invalidateQueries({queryKey:[`archives`]}),g(p(`archives.toast.timelapseRemoved`))},onError:e=>{g(e.message||p(`archives.toast.failedRemoveTimelapse`),`error`)}}),Fe=q({mutationFn:t=>Z.uploadArchiveTimelapse(e.id,t),onSuccess:e=>{h.invalidateQueries({queryKey:[`archives`]}),g(p(`archives.toast.timelapseUploaded`,{filename:e.filename}))},onError:e=>{g(e.message||p(`archives.toast.failedUploadTimelapse`),`error`)}}),Ie=q({mutationFn:t=>Z.uploadSource3mf(e.id,t),onSuccess:e=>{h.invalidateQueries({queryKey:[`archives`]}),g(p(`archives.toast.source3mfAttached`,{filename:e.filename}))},onError:e=>{g(e.message||p(`archives.toast.failedUploadSource3mf`),`error`)}}),Le=q({mutationFn:()=>Z.deleteSource3mf(e.id),onSuccess:()=>{h.invalidateQueries({queryKey:[`archives`]}),g(p(`archives.toast.source3mfRemoved`))},onError:e=>{g(e.message||p(`archives.toast.failedRemoveSource3mf`),`error`)}}),Re=q({mutationFn:t=>Z.uploadF3d(e.id,t),onSuccess:e=>{h.invalidateQueries({queryKey:[`archives`]}),g(p(`archives.toast.f3dAttached`,{filename:e.filename}))},onError:e=>{g(e.message||p(`archives.toast.failedUploadF3d`),`error`)}}),ze=q({mutationFn:()=>Z.deleteF3d(e.id),onSuccess:()=>{h.invalidateQueries({queryKey:[`archives`]}),g(p(`archives.toast.f3dRemoved`))},onError:e=>{g(e.message||p(`archives.toast.failedRemoveF3d`),`error`)}}),Be=q({mutationFn:()=>Z.scanArchiveTimelapse(e.id),onSuccess:e=>{e.status===`attached`?(h.invalidateQueries({queryKey:[`archives`]}),g(p(`archives.toast.timelapseAttached`,{filename:e.filename}))):e.status===`exists`?g(p(`archives.toast.timelapseAlreadyAttached`)):e.status===`not_found`&&e.available_files&&e.available_files.length>0?(re(e.available_files),te(!0)):g(e.message||p(`archives.toast.noMatchingTimelapse`),`warning`)},onError:e=>{g(e.message||p(`archives.toast.failedScanTimelapse`),`error`)}}),Ve=q({mutationFn:t=>Z.selectArchiveTimelapse(e.id,t),onSuccess:e=>{h.invalidateQueries({queryKey:[`archives`]}),g(p(`archives.toast.timelapseAttached`,{filename:e.filename})),te(!1),re([])},onError:e=>{g(e.message||p(`archives.toast.failedAttachTimelapse`),`error`)}}),He=q({mutationFn:t=>Z.deleteArchive(e.id,t),onSuccess:()=>{Bp(h),g(p(`archives.toast.archiveDeleted`))},onError:()=>{g(p(`archives.toast.failedDeleteArchive`),`error`)}}),Ue=q({mutationFn:()=>Z.toggleFavorite(e.id),onSuccess:e=>{h.invalidateQueries({queryKey:[`archives`]}),g(e.is_favorite?p(`archives.toast.addedToFavorites`):p(`archives.toast.removedFromFavorites`))}}),{data:We}=K({queryKey:[`archive-folders`,e.id],queryFn:()=>Z.getLibraryFoldersByArchive(e.id)}),Ge=q({mutationFn:t=>Z.updateArchive(e.id,{project_id:t}),onSuccess:()=>{Bp(h),g(p(`archives.toast.projectUpdated`))},onError:()=>{g(p(`archives.toast.failedUpdateProject`),`error`)}}),Ke=e=>{e.preventDefault(),ge({x:e.clientX,y:e.clientY})},qe=[...q2(e)?[{label:p(`common.print`),icon:(0,G.jsx)(jl,{className:`w-4 h-4`}),onClick:()=>S(!0),disabled:!e.file_path||!_(`queue:create`)||!v(`archives`,`reprint`,e.created_by_id),title:e.file_path?_(`queue:create`)?v(`archives`,`reprint`,e.created_by_id)?void 0:p(`archives.permission.noReprint`):p(`archives.permission.noAddToQueue`):p(`archives.card.noFileForReprint`)},{label:p(`archives.menu.openInBambuStudio`),icon:(0,G.jsx)(Zs,{className:`w-4 h-4`}),onClick:()=>{let t=e.print_name||e.filename||`model`;J2(e.id,t,`file`,l)},disabled:!e.file_path,title:e.file_path?void 0:p(`archives.card.noFileForReprint`)}]:[{label:p(`archives.menu.slice`),icon:u?(0,G.jsx)(Ms,{className:`w-4 h-4`}):(0,G.jsx)(Zs,{className:`w-4 h-4`}),onClick:()=>{if(u)E(!0);else{let t=e.print_name||e.filename||`model`;J2(e.id,t,`file`,l)}}},...u?[{label:p(`library.runWithPipeline.actionLabel`),icon:(0,G.jsx)(El,{className:`w-4 h-4`}),onClick:()=>O(!0),disabled:!_(`pipelines:run`),title:_(`pipelines:run`)?void 0:p(`library.runWithPipeline.noPermission`)}]:[]],{label:e.external_url?p(`archives.menu.externalLink`):p(`archives.menu.viewOnMakerWorld`),icon:(0,G.jsx)(wc,{className:`w-4 h-4`}),onClick:()=>{let t=e.external_url||e.makerworld_url;t&&window.open(t,`_blank`)},disabled:!e.external_url&&!e.makerworld_url},...e.status===`completed`?[{label:p(`archives.menu.confirmOutcome`),icon:e.user_verdict===`reject`?(0,G.jsx)(Eu,{className:`w-4 h-4`}):(0,G.jsx)(Du,{className:`w-4 h-4`}),onClick:()=>w(!0),disabled:!v(`archives`,`update`,e.created_by_id),title:v(`archives`,`update`,e.created_by_id)?void 0:p(`archives.permission.noUpdateArchives`)}]:[],{label:``,divider:!0,onClick:()=>{}},{label:p(`archives.menu.preview3d`),icon:(0,G.jsx)(Go,{className:`w-4 h-4`}),onClick:()=>{Ne()}},{label:p(`archives.menu.viewTimelapse`),icon:(0,G.jsx)(cc,{className:`w-4 h-4`}),onClick:()=>z(!0),disabled:!e.timelapse_path},{label:p(`archives.media.download`),icon:(0,G.jsx)(ic,{className:`w-4 h-4`}),onClick:()=>V(!0),disabled:!e.timelapse_path&&(!_(`printers:files`)||!e.printer_id||!e.started_at),title:!e.timelapse_path&&!_(`printers:files`)?p(`printers.permission.noFiles`):void 0},{label:p(`archives.menu.scanForTimelapse`),icon:(0,G.jsx)(Ul,{className:`w-4 h-4`}),onClick:()=>Be.mutate(),disabled:!e.printer_id||!!e.timelapse_path||Be.isPending||!v(`archives`,`update`,e.created_by_id),title:v(`archives`,`update`,e.created_by_id)?void 0:p(`archives.permission.noUpdateArchives`)},{label:p(`archives.menu.uploadTimelapse`),icon:(0,G.jsx)(Iu,{className:`w-4 h-4`}),onClick:()=>Te.current?.click(),disabled:!!e.timelapse_path||!v(`archives`,`update`,e.created_by_id),title:v(`archives`,`update`,e.created_by_id)?void 0:p(`archives.permission.noUpdateArchives`)},...e.timelapse_path?[{label:p(`archives.menu.removeTimelapse`),icon:(0,G.jsx)(ku,{className:`w-4 h-4`}),onClick:()=>me(!0),danger:!0,disabled:!v(`archives`,`update`,e.created_by_id),title:v(`archives`,`update`,e.created_by_id)?void 0:p(`archives.permission.noUpdateArchives`)}]:[],{label:``,divider:!0,onClick:()=>{}},{label:e.source_3mf_path?p(`archives.menu.downloadSource3mf`):p(`archives.menu.uploadSource3mf`),icon:(0,G.jsx)(nc,{className:`w-4 h-4`}),onClick:()=>{e.source_3mf_path?Z.downloadSource3mf(e.id).catch(e=>{console.error(`Source 3MF download failed:`,e)}):Ce.current?.click()},disabled:!e.source_3mf_path&&!v(`archives`,`update`,e.created_by_id),title:!e.source_3mf_path&&!v(`archives`,`update`,e.created_by_id)?p(`archives.permission.noUploadFiles`):void 0},...e.source_3mf_path?[{label:p(`archives.menu.replaceSource3mf`),icon:(0,G.jsx)(Iu,{className:`w-4 h-4`}),onClick:()=>Ce.current?.click(),disabled:!v(`archives`,`update`,e.created_by_id),title:v(`archives`,`update`,e.created_by_id)?void 0:p(`archives.permission.noUpdateArchives`)},{label:p(`archives.menu.removeSource3mf`),icon:(0,G.jsx)(ku,{className:`w-4 h-4`}),onClick:()=>ue(!0),danger:!0,disabled:!v(`archives`,`update`,e.created_by_id),title:v(`archives`,`update`,e.created_by_id)?void 0:p(`archives.permission.noUpdateArchives`)}]:[],{label:e.f3d_path?p(`archives.menu.replaceF3d`):p(`archives.menu.uploadF3d`),icon:(0,G.jsx)(Go,{className:`w-4 h-4`}),onClick:()=>we.current?.click(),disabled:!v(`archives`,`update`,e.created_by_id),title:v(`archives`,`update`,e.created_by_id)?void 0:p(`archives.permission.noUpdateArchives`)},...e.f3d_path?[{label:p(`archives.menu.downloadF3d`),icon:(0,G.jsx)(Ws,{className:`w-4 h-4`}),onClick:()=>{Z.downloadF3d(e.id).catch(e=>{console.error(`F3D download failed:`,e)})}},{label:p(`archives.menu.removeF3d`),icon:(0,G.jsx)(ku,{className:`w-4 h-4`}),onClick:()=>fe(!0),danger:!0,disabled:!v(`archives`,`update`,e.created_by_id),title:v(`archives`,`update`,e.created_by_id)?void 0:p(`archives.permission.noUpdateArchives`)}]:[],{label:``,divider:!0,onClick:()=>{}},{label:p(`archives.menu.download`),icon:(0,G.jsx)(Ws,{className:`w-4 h-4`}),onClick:()=>{Z.downloadArchive(e.id,`${e.print_name||e.filename}.3mf`).catch(e=>{console.error(`Archive download failed:`,e)})},disabled:!_(`archives:read`),title:_(`archives:read`)?void 0:p(`archives.permission.noDownload`)},{label:p(`archives.menu.copyDownloadLink`),icon:(0,G.jsx)(Fs,{className:`w-4 h-4`}),onClick:()=>{let t=`${window.location.origin}${Z.getArchiveDownload(e.id)}`;navigator.clipboard.writeText(t).then(()=>{g(p(`archives.toast.linkCopied`))}).catch(()=>{g(p(`archives.toast.failedCopyLink`),`error`)})},disabled:!_(`archives:read`),title:_(`archives:read`)?void 0:p(`archives.permission.noCopyLink`)},{label:p(`archives.menu.qrCode`),icon:(0,G.jsx)(Ml,{className:`w-4 h-4`}),onClick:()=>ae(!0)},{label:e.photos?.length?p(`archives.menu.viewPhotosCount`,{count:e.photos.length}):p(`archives.menu.viewPhotos`),icon:(0,G.jsx)(es,{className:`w-4 h-4`}),onClick:()=>se(!0),disabled:!e.photos?.length},{label:p(`archives.menu.projectPage`),icon:(0,G.jsx)(oc,{className:`w-4 h-4`}),onClick:()=>ce(!0)},{label:``,divider:!0,onClick:()=>{}},{label:e.is_favorite?p(`archives.menu.removeFromFavorites`):p(`archives.menu.addToFavorites`),icon:(0,G.jsx)(mu,{className:`w-4 h-4 ${e.is_favorite?`fill-yellow-400 text-yellow-400`:v(`archives`,`update`,e.created_by_id)?`group-hover:text-yellow-400`:``}`}),onClick:()=>Ue.mutate(),disabled:!v(`archives`,`update`,e.created_by_id),title:v(`archives`,`update`,e.created_by_id)?void 0:p(`archives.permission.noUpdateArchives`)},{label:p(`archives.menu.edit`),icon:(0,G.jsx)(Cl,{className:`w-4 h-4`}),onClick:()=>F(!0),disabled:!v(`archives`,`update`,e.created_by_id),title:v(`archives`,`update`,e.created_by_id)?void 0:p(`archives.permission.noUpdateArchives`)},{label:p(`archives.menu.printLog`),icon:(0,G.jsx)(Nc,{className:`w-4 h-4`}),onClick:()=>L(!0)},...e.project_id&&e.project_name?[{label:p(`archives.menu.goToProject`,{name:e.project_name}),icon:(0,G.jsx)(dc,{className:`w-4 h-4 text-bambu-green`}),onClick:()=>window.location.href=`/projects`}]:[],{label:p(`archives.menu.addToProject`),icon:(0,G.jsx)(dc,{className:`w-4 h-4`}),onClick:()=>{},disabled:!v(`archives`,`update`,e.created_by_id),title:v(`archives`,`update`,e.created_by_id)?void 0:p(`archives.permission.noUpdateArchives`),submenuSearchPlaceholder:Vp(o??[],e.project_id).length>5?p(`archives.menu.searchProjects`):void 0,submenu:(()=>{let t=[];if(e.project_id&&t.push({label:p(`archives.menu.removeFromProject`),icon:(0,G.jsx)(Zu,{className:`w-4 h-4`}),onClick:()=>Ge.mutate(null),disabled:!v(`archives`,`update`,e.created_by_id)}),!o)t.push({label:p(`archives.menu.loading`),icon:(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),onClick:()=>{},disabled:!0});else{let n=Vp(o,e.project_id).sort((e,t)=>e.name.localeCompare(t.name));n.length===0?t.push({label:p(`archives.menu.noProjectsAvailable`),icon:(0,G.jsx)(dc,{className:`w-4 h-4 opacity-50`}),onClick:()=>{},disabled:!0}):n.forEach(n=>{t.push({label:n.name,icon:(0,G.jsx)(`div`,{className:`w-3 h-3 rounded-full flex-shrink-0`,style:{backgroundColor:n.color||`#888`}}),onClick:()=>Ge.mutate(n.id),disabled:e.project_id===n.id||!v(`archives`,`update`,e.created_by_id)})})}return t})()},{label:p(r?`archives.menu.deselect`:`archives.menu.select`),icon:r?(0,G.jsx)(du,{className:`w-4 h-4`}):(0,G.jsx)(pu,{className:`w-4 h-4`}),onClick:()=>i(e.id)},{label:``,divider:!0,onClick:()=>{}},{label:p(`archives.menu.delete`),icon:(0,G.jsx)(ku,{className:`w-4 h-4`}),onClick:()=>A(!0),danger:!0,disabled:!v(`archives`,`delete`,e.created_by_id),title:v(`archives`,`delete`,e.created_by_id)?void 0:p(`archives.permission.noDelete`)}];return(0,G.jsxs)(Pd,{"data-archive-id":e.id,className:`relative flex flex-col group ${r?`ring-2 ring-bambu-green`:``} ${a?`cursor-pointer`:``}`,style:s?{outline:`4px solid #facc15`,outlineOffset:`2px`}:void 0,onContextMenu:Ke,onClick:a?()=>i(e.id):void 0,children:[a&&(0,G.jsx)(`button`,{className:`absolute top-2 left-2 z-10 p-1 rounded bg-black/50 hover:bg-black/70 transition-colors`,onClick:t=>{t.stopPropagation(),i(e.id)},children:r?(0,G.jsx)(du,{className:`w-5 h-5 text-bambu-green`}):(0,G.jsx)(pu,{className:`w-5 h-5 text-white`})}),(0,G.jsxs)(`div`,{className:`aspect-video bg-bambu-dark relative flex-shrink-0 overflow-hidden rounded-t-xl`,onMouseEnter:()=>be(!0),onMouseLeave:()=>be(!1),children:[e.thumbnail_path?(0,G.jsx)(`img`,{src:_e!==null&&Ae.length>0?Z.getArchivePlateThumbnail(e.id,Ae[Me]?.index??0):Z.getArchiveThumbnail(e.id),alt:e.print_name||e.filename,className:`w-full h-full object-cover`}):(0,G.jsx)(`div`,{className:`w-full h-full flex items-center justify-center`,children:(0,G.jsx)(Ic,{className:`w-12 h-12 text-bambu-dark-tertiary`})}),je&&Ae.length>1&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`button`,{className:`absolute left-1 top-1/2 -translate-y-1/2 p-1 rounded-full bg-black/60 hover:bg-black/80 transition-all can-hover:opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`,onClick:e=>{e.stopPropagation(),ve(e=>{let t=e??0;return t>0?t-1:Ae.length-1})},title:p(`archives.card.previousPlate`),children:(0,G.jsx)(ls,{className:`w-4 h-4 text-white`})}),(0,G.jsx)(`button`,{className:`absolute right-1 top-1/2 -translate-y-1/2 p-1 rounded-full bg-black/60 hover:bg-black/80 transition-all can-hover:opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`,onClick:e=>{e.stopPropagation(),ve(e=>{let t=e??0;return t(0,G.jsx)(`button`,{className:`w-2 h-2 rounded-full transition-colors ${t===Me?`bg-bambu-green`:`bg-white/50 hover:bg-white/80`}`,onClick:e=>{e.stopPropagation(),ve(t)},title:e.name||p(`archives.card.plateNumber`,{index:e.index})},e.index))})]}),(0,G.jsx)(`button`,{className:`absolute top-2 left-2 p-1.5 rounded bg-black/50 hover:bg-black/70 transition-all can-hover:opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 ${a?`left-10`:``}`,onClick:e=>{e.stopPropagation();let t=e.currentTarget.getBoundingClientRect();ge({x:t.left,y:t.bottom+4})},title:p(`archives.card.moreOptions`),children:(0,G.jsx)(qs,{className:`w-5 h-5 text-white`})}),(0,G.jsx)(`button`,{className:`absolute top-2 right-2 p-1 rounded transition-colors ${v(`archives`,`update`,e.created_by_id)?`bg-black/50 hover:bg-black/70`:`bg-black/30 cursor-not-allowed`}`,onClick:t=>{t.stopPropagation(),v(`archives`,`update`,e.created_by_id)&&Ue.mutate()},disabled:!v(`archives`,`update`,e.created_by_id),title:v(`archives`,`update`,e.created_by_id)?e.is_favorite?p(`archives.card.removeFromFavorites`):p(`archives.card.addToFavorites`):p(`archives.permission.noUpdateArchives`),children:(0,G.jsx)(mu,{className:`w-5 h-5 ${e.is_favorite?`text-yellow-400 fill-yellow-400`:`text-white`} ${v(`archives`,`update`,e.created_by_id)?``:`opacity-50`}`})}),(e.status===`failed`||e.status===`aborted`)&&(0,G.jsx)(`div`,{className:`absolute top-2 left-12 px-2 py-1 rounded text-xs bg-status-error/80 text-white`,children:e.status===`aborted`?p(`archives.card.cancelled`):p(`archives.card.failed`)}),e.status===`completed`&&e.confirm_requested&&e.user_verdict==null&&(0,G.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),w(!0)},disabled:!v(`archives`,`update`,e.created_by_id),className:`absolute top-2 left-12 px-2 py-1 rounded text-xs bg-amber-500/90 enabled:hover:bg-amber-500 text-black flex items-center gap-1 transition-colors enabled:cursor-pointer`,title:v(`archives`,`update`,e.created_by_id)?p(`archives.card.confirmPendingTitle`):p(`archives.permission.noUpdateArchives`),children:[(0,G.jsx)(Du,{className:`w-3 h-3`}),p(`archives.card.confirmPending`)]}),e.status===`completed`&&e.user_verdict===`reject`&&(0,G.jsxs)(`div`,{className:`absolute top-2 left-12 px-2 py-1 rounded text-xs bg-status-error/80 text-white flex items-center gap-1`,title:`${p(`archives.card.rejectedTitle`)}${Oe?` — ${p(Oe)}`:``}`,children:[(0,G.jsx)(Eu,{className:`w-3 h-3`}),p(`archives.card.rejected`)]}),e.status===`completed`&&e.user_verdict===`good`&&(0,G.jsxs)(`div`,{className:`absolute top-2 left-12 px-2 py-1 rounded text-xs bg-bambu-green/80 text-white flex items-center gap-1`,title:`${p(`archives.card.confirmedGoodTitle`)}${Oe?` — ${p(Oe)}`:``}`,children:[(0,G.jsx)(Du,{className:`w-3 h-3`}),p(`archives.card.confirmedGood`)]}),e.duplicate_count>0&&De>0&&ke&&(0,G.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),m?.(ke)},className:`absolute top-2 right-12 px-2 py-1 rounded text-xs bg-purple-500/80 hover:bg-purple-600/90 text-white flex items-center gap-1 transition-colors cursor-pointer`,title:p(`archives.viewOriginalPrint`,{id:ke}),children:[(0,G.jsx)(Fs,{className:`w-3 h-3`}),`#`,De]}),e.duplicate_count>0&&De===0&&(0,G.jsxs)(`span`,{className:`absolute top-2 right-12 px-2 py-1 rounded text-xs bg-purple-500/80 text-white flex items-center gap-1`,title:`${e.duplicate_count} reprint${e.duplicate_count===1?``:`s`}`,children:[(0,G.jsx)(xc,{className:`w-3 h-3`}),`+`,e.duplicate_count]}),e.source_3mf_path&&(0,G.jsx)(`button`,{className:`absolute bottom-2 left-2 p-1.5 rounded bg-black/60 hover:bg-black/80 transition-colors`,onClick:t=>{t.stopPropagation();let n=(e.print_name||e.filename||`source`).replace(/\.gcode\.3mf$/i,``)+`_source`;J2(e.id,n,`source`,l)},title:p(`archives.card.openSource3mf`),children:(0,G.jsx)(nc,{className:`w-4 h-4 text-orange-400`})}),e.f3d_path&&(0,G.jsx)(`button`,{className:`absolute bottom-2 ${e.source_3mf_path?`left-12`:`left-2`} p-1.5 rounded bg-black/60 hover:bg-black/80 transition-colors`,onClick:t=>{t.stopPropagation(),Z.downloadF3d(e.id).catch(e=>{console.error(`F3D download failed:`,e)})},title:p(`archives.card.downloadF3d`),children:(0,G.jsx)(Go,{className:`w-4 h-4 text-cyan-400`})}),(0,G.jsx)(`button`,{className:`absolute bottom-2 right-2 p-1.5 rounded bg-black/60 hover:bg-black/80 transition-colors`,onClick:e=>{e.stopPropagation(),Ne()},title:p(`archives.card.preview3d`),children:(0,G.jsx)(Hc,{className:`w-4 h-4 text-white`})}),e.timelapse_path&&(0,G.jsx)(`button`,{className:`absolute bottom-2 right-12 p-1.5 rounded bg-black/60 hover:bg-black/80 transition-colors`,onClick:e=>{e.stopPropagation(),z(!0)},title:p(`archives.card.viewTimelapse`),children:(0,G.jsx)(cc,{className:`w-4 h-4 text-bambu-green`})}),e.photos&&e.photos.length>0&&(0,G.jsxs)(`button`,{className:`absolute bottom-2 ${e.timelapse_path?`right-[5.5rem]`:`right-12`} p-1.5 rounded bg-black/60 hover:bg-black/80 transition-colors`,onClick:e=>{e.stopPropagation(),se(!0)},title:e.photos.length===1?p(`archives.card.viewPhoto`):p(`archives.card.viewPhotos`,{count:e.photos.length}),children:[(0,G.jsx)(es,{className:`w-4 h-4 text-blue-400`}),e.photos.length>1&&(0,G.jsx)(`span`,{className:`absolute -top-1 -right-1 w-4 h-4 bg-blue-500 rounded-full text-[10px] text-white flex items-center justify-center`,children:e.photos.length})]}),We&&We.length>0&&(0,G.jsx)(Ci,{to:`/files?folder=${We[0].id}`,className:`absolute bottom-2 p-1.5 rounded bg-black/60 hover:bg-black/80 transition-colors`,onClick:e=>e.stopPropagation(),title:p(`archives.card.openFolder`,{name:We[0].name}),style:{left:e.source_3mf_path?e.f3d_path?`5.5rem`:`3rem`:e.f3d_path?`3rem`:`0.5rem`},children:(0,G.jsx)(fc,{className:`w-4 h-4 text-yellow-400`})})]}),(0,G.jsxs)(Id,{className:`p-4 flex-1 flex flex-col`,children:[(0,G.jsxs)(`p`,{className:`text-[10px] text-bambu-gray/70 mb-1`,children:[`#`,e.id]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mb-1`,children:[(0,G.jsxs)(`h3`,{className:`min-w-0 font-medium text-white truncate`,children:[e.print_name||e.filename,e.plate_id!=null&&e.plate_id>1&&` — ${p(`printers.plateNumber`,{number:e.plate_id})}`]}),(0,G.jsx)(Q,{variant:`ghost`,size:`sm`,className:`p-1 sm:p-1.5 shrink-0`,onClick:()=>F(!0),disabled:!v(`archives`,`update`,e.created_by_id),title:v(`archives`,`update`,e.created_by_id)?p(`archives.card.edit`):p(`archives.card.noPermissionEdit`),children:(0,G.jsx)(Cl,{className:`w-3 h-3 sm:w-4 sm:h-4`})})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-3 flex-wrap`,children:[(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:t}),(()=>{let t=om(e.bed_type);return t?(0,G.jsx)(`img`,{src:t.icon,alt:t.label,title:t.label,className:`w-4 h-4 flex-shrink-0`}):null})(),(0,G.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded font-medium ${q2(e)?`bg-bambu-green/20 text-bambu-green`:`bg-orange-100 dark:bg-orange-500/20 text-orange-700 dark:text-orange-400`}`,title:q2(e)?p(`archives.card.slicedFile`):p(`archives.card.sourceFile`),children:q2(e)?p(`archives.card.gcode`):p(`archives.card.source`)}),e.content_hash&&(0,G.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded font-mono bg-bambu-dark-tertiary/50 text-bambu-gray-light opacity-0 transition-opacity duration-150 group-hover:opacity-100`,title:`SHA256: ${e.content_hash}`,children:e.content_hash.slice(0,8).toUpperCase()}),e.project_name&&(0,G.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded-full truncate max-w-[120px]`,style:{backgroundColor:`${o?.find(t=>t.id===e.project_id)?.color||`#6b7280`}20`,color:o?.find(t=>t.id===e.project_id)?.color||`#6b7280`},title:p(`archives.card.project`,{name:e.project_name}),children:e.project_name}),e.run_count>1&&(0,G.jsx)(`button`,{className:`text-[10px] px-1.5 py-0.5 rounded font-medium bg-bambu-orange/20 text-bambu-orange hover:bg-bambu-orange/30 transition-colors cursor-pointer`,onClick:e=>{e.stopPropagation(),L(!0)},title:p(`archives.card.runsBadgeTitle`,{count:e.run_count,successful:e.successful_run_count,failed:e.failed_run_count}),children:p(`archives.card.runsBadge`,{count:e.run_count})})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-xs mb-4 min-h-[48px]`,children:[(e.print_time_seconds||e.actual_time_seconds)&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-bambu-gray`,title:e.time_accuracy?`Estimated: ${ep(e.print_time_seconds||0)}\nActual: ${ep(e.actual_time_seconds||0)}\nAccuracy: ${e.time_accuracy.toFixed(0)}%`:e.actual_time_seconds?`Actual: ${ep(e.actual_time_seconds)}`:`Estimated: ${ep(e.print_time_seconds||0)}`,children:[(0,G.jsx)(Ts,{className:`w-3 h-3`}),ep(e.actual_time_seconds||e.print_time_seconds||0),e.time_accuracy&&(0,G.jsxs)(`span`,{className:`text-[10px] px-1 rounded ${e.time_accuracy>=95&&e.time_accuracy<=105?`bg-bambu-green/20 text-bambu-green`:e.time_accuracy>105?`bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400`:`bg-orange-100 dark:bg-orange-500/20 text-orange-700 dark:text-orange-400`}`,children:[e.time_accuracy>100?`+`:``,(e.time_accuracy-100).toFixed(0),`%`]})]}),e.filament_used_grams&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-bambu-gray`,children:[(0,G.jsx)(gl,{className:`w-3 h-3`}),e.filament_used_grams.toFixed(1),`g`]}),(e.cost!=null||e.energy_cost!=null)&&(0,G.jsxs)(`div`,{className:`flex items-center gap-3 text-bambu-gray`,children:[e.cost!=null&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(js,{className:`w-3 h-3`}),d,e.cost.toFixed(2)]}),e.energy_cost!=null&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,title:`${p(`stats.energyUsed`)}: ${e.energy_kwh?.toFixed(3)||`N/A`} kWh`,children:[(0,G.jsx)($u,{className:`w-3 h-3`}),d,e.energy_cost.toFixed(2)]})]}),(e.layer_height||e.total_layers)&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-bambu-gray`,children:[(0,G.jsx)(Hc,{className:`w-3 h-3`}),e.total_layers&&(0,G.jsx)(`span`,{children:e.total_layers===1?p(`archives.card.layer`,{count:e.total_layers}):p(`archives.card.layers`,{count:e.total_layers})}),e.total_layers&&e.layer_height&&(0,G.jsx)(`span`,{className:`text-bambu-gray/50`,children:`·`}),e.layer_height&&(0,G.jsxs)(`span`,{children:[e.layer_height,`mm`]})]}),e.object_count!=null&&e.object_count>0&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-bambu-gray`,title:e.object_count===1?p(`archives.card.object`,{count:e.object_count}):p(`archives.card.objects`,{count:e.object_count}),children:[(0,G.jsx)(Go,{className:`w-3 h-3`}),e.object_count===1?p(`archives.card.object`,{count:e.object_count}):p(`archives.card.objects`,{count:e.object_count})]}),e.sliced_for_model&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-bambu-gray`,title:p(`archives.card.slicedFor`,{model:e.sliced_for_model}),children:[(0,G.jsx)(jl,{className:`w-3 h-3`}),e.sliced_for_model]}),e.filament_type&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 col-span-2`,children:[(0,G.jsx)(`span`,{className:`text-bambu-gray text-xs`,children:e.filament_type}),e.filament_color&&(0,G.jsx)(`div`,{className:`flex items-center gap-0.5 flex-wrap`,children:e.filament_color.split(`,`).map((e,t)=>(0,G.jsx)(`div`,{className:`w-3 h-3 rounded-full border border-black/20`,style:{backgroundColor:e},title:e},t))})]})]}),b&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-bambu-green text-xs mb-3`,title:p(`archives.card.slicerAmsMappingTooltip`,{printer:b}),children:[(0,G.jsx)(gs,{className:`w-3.5 h-3.5`}),p(`archives.card.slicerAmsMapping`,{printer:b})]}),(e.tags||e.notes)&&(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 mb-3`,children:[e.notes&&(0,G.jsx)(`div`,{className:`flex items-center gap-1 px-1.5 py-0.5 bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400 rounded text-xs`,title:e.notes,children:(0,G.jsx)(gu,{className:`w-3 h-3`})}),e.tags?.split(`,`).map((e,t)=>(0,G.jsx)(`span`,{className:`px-1.5 py-0.5 bg-bambu-dark-tertiary text-bambu-gray-light rounded text-xs`,children:e.trim()},t))]}),(0,G.jsx)(`div`,{className:`flex-1`}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-bambu-gray border-t border-bambu-dark-tertiary pt-3`,children:[(0,G.jsx)(`span`,{children:Zf(e.created_at,c)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.created_by_username&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,title:p(`archives.card.uploadedBy`,{name:e.created_by_username}),children:[(0,G.jsx)(Lu,{className:`w-3 h-3`}),e.created_by_username]}),(0,G.jsx)(`span`,{children:Bd(e.file_size)})]})]}),(0,G.jsxs)(`div`,{className:`flex gap-1 mt-3`,children:[q2(e)?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Q,{variant:`primary`,size:`sm`,className:`flex-1 min-w-0 overflow-hidden`,onClick:()=>S(!0),disabled:!e.file_path||!_(`queue:create`)||!v(`archives`,`reprint`,e.created_by_id),title:e.file_path?_(`queue:create`)?v(`archives`,`reprint`,e.created_by_id)?void 0:p(`archives.card.noPermissionReprint`):p(`archives.permission.noAddToQueue`):p(`archives.card.noFileForReprint`),children:[(0,G.jsx)(jl,{className:`w-3 h-3 flex-shrink-0`}),(0,G.jsx)(`span`,{className:`hidden xl:inline truncate`,children:p(`common.print`)})]}),(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,className:`min-w-0 p-1 sm:p-1.5`,onClick:()=>{let t=e.print_name||e.filename||`model`;J2(e.id,t,`file`,l)},title:p(`archives.card.openInBambuStudio`),children:(0,G.jsx)(Zs,{className:`w-3 h-3 sm:w-4 sm:h-4`})})]}):(0,G.jsxs)(Q,{variant:`primary`,size:`sm`,className:`flex-1 min-w-0 overflow-hidden`,onClick:()=>{if(u)E(!0);else{let t=e.print_name||e.filename||`model`;J2(e.id,t,`file`,l)}},title:p(u?`slice.title`:`archives.card.openInBambuStudioToSlice`),children:[u?(0,G.jsx)(Ms,{className:`w-3 h-3 flex-shrink-0`}):(0,G.jsx)(Zs,{className:`w-3 h-3 flex-shrink-0`}),(0,G.jsx)(`span`,{className:`hidden xl:inline truncate`,children:p(`archives.card.slice`)})]}),(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,className:`min-w-0 p-1 sm:p-1.5`,onClick:()=>{let t=e.external_url||e.makerworld_url;t&&window.open(t,`_blank`)},disabled:!e.external_url&&!e.makerworld_url,title:e.external_url?p(`archives.card.externalLink`):e.makerworld_url?p(`archives.card.makerWorld`,{designer:e.designer||p(`archives.card.viewProject`)}):p(`archives.card.noExternalLink`),children:(0,G.jsx)(wc,{className:`w-3 h-3 sm:w-4 sm:h-4 ${!e.external_url&&!e.makerworld_url?`opacity-20`:``}`})}),(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,className:`min-w-0 p-1 sm:p-1.5`,onClick:()=>{Z.downloadArchive(e.id,`${e.print_name||e.filename}.3mf`).catch(e=>{console.error(`Archive download failed:`,e)})},title:p(`archives.card.download`),children:(0,G.jsx)(Ws,{className:`w-3 h-3 sm:w-4 sm:h-4`})}),(0,G.jsx)(Q,{variant:`ghost`,size:`sm`,className:`min-w-0 p-1 sm:p-1.5`,onClick:()=>A(!0),disabled:!v(`archives`,`delete`,e.created_by_id),title:v(`archives`,`delete`,e.created_by_id)?p(`archives.card.delete`):p(`archives.card.noPermissionDelete`),children:(0,G.jsx)(ku,{className:`w-3 h-3 sm:w-4 sm:h-4 text-red-600 dark:text-red-400`})})]})]}),P&&(0,G.jsx)(Gp,{archive:e,onClose:()=>F(!1)}),I&&(0,G.jsx)($W,{archiveId:e.id,archiveName:e.print_name||e.filename,onClose:()=>L(!1)}),xe&&(0,G.jsx)(TW,{plates:xe,onSelect:t=>{Se(null),y(`/gcode-viewer?archive=${e.id}&plate=${t}`)},onClose:()=>Se(null)}),x&&(0,G.jsx)(Tm,{mode:`create`,archiveId:e.id,archiveName:e.print_name||e.filename,onClose:()=>S(!1)}),C&&(0,G.jsx)(Em,{archiveId:e.id,onClose:()=>w(!1)}),T&&(0,G.jsx)(UW,{source:{kind:`archive`,id:e.id,filename:e.print_name||e.filename||`model`},onClose:()=>E(!1)}),D&&(0,G.jsx)(KW,{source:{kind:`archive`,id:e.id,filename:e.print_name||e.filename||`model`},onClose:()=>O(!1)}),k&&(0,G.jsxs)($d,{title:p(`archives.modal.deleteArchive`),message:p(`archives.modal.deleteConfirm`,{name:e.print_name||e.filename}),confirmText:p(`archives.modal.deleteButton`),variant:`danger`,confirmDisabled:(N.data?.currently_printing??0)>0,onConfirm:()=>{He.mutate(j),A(!1),M(!1)},onCancel:()=>{A(!1),M(!1)},children:[(N.data?.related_queue_items??0)>0&&(0,G.jsx)(`div`,{className:(N.data?.currently_printing??0)>0?`text-sm text-red-600 dark:text-red-400 mb-2`:`text-sm text-amber-600 dark:text-amber-400 mb-2`,children:(N.data?.currently_printing??0)>0?p(`archives.modal.deleteBlockedByPrinting`,{count:N.data.currently_printing}):p(`archives.modal.deleteQueueItemsWarning`,{count:N.data.related_queue_items})}),(0,G.jsxs)(`label`,{className:`flex items-start gap-2 cursor-pointer text-sm text-bambu-gray`,children:[(0,G.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 accent-red-500`,checked:j,onChange:e=>M(e.target.checked)}),(0,G.jsx)(`span`,{children:p(`archives.modal.deletePurgeStats`)})]})]}),le&&(0,G.jsx)($d,{title:p(`archives.modal.removeSource3mf`),message:p(`archives.modal.removeSource3mfConfirm`,{name:e.print_name||e.filename}),confirmText:p(`archives.modal.removeButton`),variant:`danger`,onConfirm:()=>{Le.mutate(),ue(!1)},onCancel:()=>ue(!1)}),de&&(0,G.jsx)($d,{title:p(`archives.modal.removeF3d`),message:p(`archives.modal.removeF3dConfirm`,{name:e.print_name||e.filename}),confirmText:p(`archives.modal.removeButton`),variant:`danger`,onConfirm:()=>{ze.mutate(),fe(!1)},onCancel:()=>fe(!1)}),pe&&(0,G.jsx)($d,{title:p(`archives.modal.removeTimelapse`),message:p(`archives.modal.removeTimelapseConfirm`,{name:e.print_name||e.filename}),confirmText:p(`archives.modal.removeButton`),variant:`danger`,onConfirm:()=>{Pe.mutate(),me(!1)},onCancel:()=>me(!1)}),he&&(0,G.jsx)(lE,{x:he.x,y:he.y,items:qe,onClose:()=>ge(null)}),B&&(0,G.jsx)(V2,{archiveId:e.id,archiveName:e.print_name||e.filename,printerName:t,onClose:()=>V(!1)}),R&&e.timelapse_path&&(0,G.jsx)(B2,{src:Z.getArchiveTimelapse(e.id),title:p(`archives.modal.timelapse`,{name:e.print_name||e.filename}),downloadFilename:`${e.print_name||e.filename}_timelapse.mp4`,archiveId:e.id,onClose:()=>z(!1),onEdit:()=>{h.invalidateQueries({queryKey:[`archives`]}),z(!1)}}),ee&&ne.length>0&&(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/80 flex items-center justify-center z-50 p-4`,children:(0,G.jsxs)(`div`,{className:`bg-card-dark rounded-lg max-w-lg w-full max-h-[80vh] flex flex-col`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-gray-700`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:p(`archives.modal.selectTimelapse`)}),(0,G.jsx)(`p`,{className:`text-sm text-gray-400 mt-1`,children:p(`archives.modal.selectTimelapseDesc`)})]}),(0,G.jsx)(`button`,{onClick:()=>{te(!1),re([])},className:`text-gray-400 hover:text-white p-1`,children:(0,G.jsx)(Zu,{className:`w-5 h-5`})})]}),(0,G.jsx)(`div`,{className:`overflow-y-auto flex-1 p-2`,children:ne.map(e=>(0,G.jsxs)(`button`,{onClick:()=>Ve.mutate(e.name),disabled:Ve.isPending,className:`w-full text-left p-3 rounded-lg hover:bg-gray-700 transition-colors flex items-center gap-3 disabled:opacity-50`,children:[(0,G.jsx)(cc,{className:`w-8 h-8 text-bambu-green flex-shrink-0`}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`p`,{className:`text-white font-medium truncate`,children:e.name}),(0,G.jsxs)(`p`,{className:`text-sm text-gray-400`,children:[Bd(e.size),e.mtime&&` • ${Zf(e.mtime,c)}`]})]})]},e.name))}),(0,G.jsx)(`div`,{className:`p-4 border-t border-gray-700`,children:(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>{te(!1),re([])},className:`w-full`,children:`Cancel`})})]})}),ie&&(0,G.jsx)(tG,{archiveId:e.id,archiveName:e.print_name||e.filename,onClose:()=>ae(!1)}),oe&&e.photos&&e.photos.length>0&&(0,G.jsx)(nG,{archiveId:e.id,archiveName:e.print_name||e.filename,photos:e.photos,onClose:()=>se(!1),onDelete:async t=>{try{await Z.deleteArchivePhoto(e.id,t),h.invalidateQueries({queryKey:[`archives`]}),g(p(`archives.toast.photoDeleted`))}catch{g(p(`archives.toast.failedDeletePhoto`),`error`)}}}),H&&(0,G.jsx)(z2,{archiveId:e.id,archiveName:e.print_name||e.filename,onClose:()=>ce(!1)}),(0,G.jsx)(`input`,{ref:Ce,type:`file`,accept:`.3mf`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&Ie.mutate(t),e.target.value=``}}),(0,G.jsx)(`input`,{ref:we,type:`file`,accept:`.f3d`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&Re.mutate(t),e.target.value=``}}),(0,G.jsx)(`input`,{ref:Te,type:`file`,accept:`.mp4,.avi,.mkv`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&Fe.mutate(t),e.target.value=``}})]})}function XVe({archive:e,printerName:t,isSelected:n,onSelect:r,selectionMode:i,projects:a,isHighlighted:o,preferredSlicer:s=`bambu_studio`,useSlicerApi:c=!1,t:l,onNavigateToArchive:u}){let d=no(),{showToast:p}=Hd(),{hasPermission:m,canModify:h}=Od(),[g,_]=(0,f.useState)(!1),[v,y]=(0,f.useState)(!1),[b,x]=(0,f.useState)(!1),[S,C]=(0,f.useState)(!1),w=K({queryKey:[`archive`,e.id,`delete-impact`],queryFn:()=>Z.getArchiveDeleteImpact(e.id),enabled:b,staleTime:0}),T=$n(),[E,D]=(0,f.useState)(!1),[O,k]=(0,f.useState)(!1),[A,j]=(0,f.useState)(!1),[M,N]=(0,f.useState)(!1),[P,F]=(0,f.useState)(!1),[I,L]=(0,f.useState)(!1),[R,z]=(0,f.useState)(!1),[B,V]=(0,f.useState)([]),[ee,te]=(0,f.useState)(!1),[ne,re]=(0,f.useState)(!1),[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)(null),pe=(0,f.useRef)(null),me=(0,f.useRef)(null),he=(0,f.useRef)(null),[ge,_e]=(0,f.useState)(null),ve=e.duplicate_sequence??0,ye=Hp(e.user_verdict_source),be=e.original_archive_id??null,xe=async()=>{try{let t=await Z.getArchivePlates(e.id);if(t.is_multi_plate&&t.plates.length>1){_e(t.plates);return}}catch{}T(`/gcode-viewer?archive=${e.id}`)},Se=q({mutationFn:()=>Z.deleteArchiveTimelapse(e.id),onSuccess:()=>{d.invalidateQueries({queryKey:[`archives`]}),p(l(`archives.toast.timelapseRemoved`))},onError:e=>{p(e.message||l(`archives.toast.failedRemoveTimelapse`),`error`)}}),Ce=q({mutationFn:t=>Z.uploadArchiveTimelapse(e.id,t),onSuccess:e=>{d.invalidateQueries({queryKey:[`archives`]}),p(l(`archives.toast.timelapseUploaded`,{filename:e.filename}))},onError:e=>{p(e.message||l(`archives.toast.failedUploadTimelapse`),`error`)}}),we=q({mutationFn:t=>Z.uploadSource3mf(e.id,t),onSuccess:e=>{d.invalidateQueries({queryKey:[`archives`]}),p(l(`archives.toast.source3mfAttached`,{filename:e.filename}))},onError:e=>{p(e.message||l(`archives.toast.failedUploadSource3mf`),`error`)}}),Te=q({mutationFn:()=>Z.deleteSource3mf(e.id),onSuccess:()=>{d.invalidateQueries({queryKey:[`archives`]}),p(l(`archives.toast.source3mfRemoved`))},onError:e=>{p(e.message||l(`archives.toast.failedRemoveSource3mf`),`error`)}}),Ee=q({mutationFn:t=>Z.uploadF3d(e.id,t),onSuccess:e=>{d.invalidateQueries({queryKey:[`archives`]}),p(l(`archives.toast.f3dAttached`,{filename:e.filename}))},onError:e=>{p(e.message||l(`archives.toast.failedUploadF3d`),`error`)}}),De=q({mutationFn:()=>Z.deleteF3d(e.id),onSuccess:()=>{d.invalidateQueries({queryKey:[`archives`]}),p(l(`archives.toast.f3dRemoved`))},onError:e=>{p(e.message||l(`archives.toast.failedRemoveF3d`),`error`)}}),Oe=q({mutationFn:()=>Z.scanArchiveTimelapse(e.id),onSuccess:e=>{e.status===`attached`?(d.invalidateQueries({queryKey:[`archives`]}),p(l(`archives.toast.timelapseAttached`,{filename:e.filename}))):e.status===`exists`?p(l(`archives.toast.timelapseAlreadyAttached`)):e.status===`not_found`&&e.available_files&&e.available_files.length>0?(V(e.available_files),z(!0)):p(e.message||l(`archives.toast.noMatchingTimelapse`),`warning`)},onError:e=>{p(e.message||l(`archives.toast.failedScanTimelapse`),`error`)}}),ke=q({mutationFn:t=>Z.selectArchiveTimelapse(e.id,t),onSuccess:e=>{d.invalidateQueries({queryKey:[`archives`]}),p(l(`archives.toast.timelapseAttached`,{filename:e.filename})),z(!1),V([])},onError:e=>{p(e.message||l(`archives.toast.failedAttachTimelapse`),`error`)}}),Ae=q({mutationFn:t=>Z.deleteArchive(e.id,t),onSuccess:()=>{Bp(d),p(l(`archives.toast.archiveDeleted`))},onError:()=>{p(l(`archives.toast.failedDeleteArchive`),`error`)}}),je=q({mutationFn:()=>Z.toggleFavorite(e.id),onSuccess:e=>{d.invalidateQueries({queryKey:[`archives`]}),p(e.is_favorite?l(`archives.toast.addedToFavorites`):l(`archives.toast.removedFromFavorites`))}}),{data:Me}=K({queryKey:[`archive-folders`,e.id],queryFn:()=>Z.getLibraryFoldersByArchive(e.id)}),Ne=q({mutationFn:t=>Z.updateArchive(e.id,{project_id:t}),onSuccess:()=>{Bp(d),p(l(`archives.toast.projectUpdated`))},onError:()=>{p(l(`archives.toast.failedUpdateProject`),`error`)}}),Pe=e=>{e.preventDefault(),fe({x:e.clientX,y:e.clientY})},Fe=[...q2(e)?[{label:l(`common.print`),icon:(0,G.jsx)(jl,{className:`w-4 h-4`}),onClick:()=>D(!0),disabled:!e.file_path||!m(`queue:create`)||!h(`archives`,`reprint`,e.created_by_id),title:e.file_path?m(`queue:create`)?h(`archives`,`reprint`,e.created_by_id)?void 0:l(`archives.permission.noReprint`):l(`archives.permission.noAddToQueue`):l(`archives.card.noFileForReprint`)},{label:l(`archives.menu.openInBambuStudio`),icon:(0,G.jsx)(Zs,{className:`w-4 h-4`}),onClick:()=>{let t=e.print_name||e.filename||`model`;J2(e.id,t,`file`,s)},disabled:!e.file_path,title:e.file_path?void 0:l(`archives.card.noFileForReprint`)}]:[{label:l(`archives.menu.slice`),icon:c?(0,G.jsx)(Ms,{className:`w-4 h-4`}):(0,G.jsx)(Zs,{className:`w-4 h-4`}),onClick:()=>{if(c)j(!0);else{let t=e.print_name||e.filename||`model`;J2(e.id,t,`file`,s)}}},...c?[{label:l(`library.runWithPipeline.actionLabel`),icon:(0,G.jsx)(El,{className:`w-4 h-4`}),onClick:()=>N(!0),disabled:!m(`pipelines:run`),title:m(`pipelines:run`)?void 0:l(`library.runWithPipeline.noPermission`)}]:[]],{label:e.external_url?l(`archives.menu.externalLink`):l(`archives.menu.viewOnMakerWorld`),icon:(0,G.jsx)(wc,{className:`w-4 h-4`}),onClick:()=>{let t=e.external_url||e.makerworld_url;t&&window.open(t,`_blank`)},disabled:!e.external_url&&!e.makerworld_url},...e.status===`completed`?[{label:l(`archives.menu.confirmOutcome`),icon:e.user_verdict===`reject`?(0,G.jsx)(Eu,{className:`w-4 h-4`}):(0,G.jsx)(Du,{className:`w-4 h-4`}),onClick:()=>k(!0),disabled:!h(`archives`,`update`,e.created_by_id),title:h(`archives`,`update`,e.created_by_id)?void 0:l(`archives.permission.noUpdateArchives`)}]:[],{label:``,divider:!0,onClick:()=>{}},{label:l(`archives.menu.preview3d`),icon:(0,G.jsx)(Go,{className:`w-4 h-4`}),onClick:()=>{xe()}},{label:l(`archives.menu.viewTimelapse`),icon:(0,G.jsx)(cc,{className:`w-4 h-4`}),onClick:()=>F(!0),disabled:!e.timelapse_path},{label:l(`archives.menu.scanForTimelapse`),icon:(0,G.jsx)(Ul,{className:`w-4 h-4`}),onClick:()=>Oe.mutate(),disabled:!e.printer_id||!!e.timelapse_path||Oe.isPending||!h(`archives`,`update`,e.created_by_id),title:h(`archives`,`update`,e.created_by_id)?void 0:l(`archives.permission.noUpdateArchives`)},{label:l(`archives.menu.uploadTimelapse`),icon:(0,G.jsx)(Iu,{className:`w-4 h-4`}),onClick:()=>he.current?.click(),disabled:!!e.timelapse_path||!h(`archives`,`update`,e.created_by_id),title:h(`archives`,`update`,e.created_by_id)?void 0:l(`archives.permission.noUpdateArchives`)},...e.timelapse_path?[{label:l(`archives.menu.removeTimelapse`),icon:(0,G.jsx)(ku,{className:`w-4 h-4`}),onClick:()=>ue(!0),danger:!0,disabled:!h(`archives`,`update`,e.created_by_id),title:h(`archives`,`update`,e.created_by_id)?void 0:l(`archives.permission.noUpdateArchives`)}]:[],{label:``,divider:!0,onClick:()=>{}},{label:e.source_3mf_path?l(`archives.menu.downloadSource3mf`):l(`archives.menu.uploadSource3mf`),icon:(0,G.jsx)(nc,{className:`w-4 h-4`}),onClick:()=>{e.source_3mf_path?Z.downloadSource3mf(e.id).catch(e=>{console.error(`Source 3MF download failed:`,e)}):pe.current?.click()},disabled:!e.source_3mf_path&&!h(`archives`,`update`,e.created_by_id),title:!e.source_3mf_path&&!h(`archives`,`update`,e.created_by_id)?l(`archives.permission.noUploadFiles`):void 0},...e.source_3mf_path?[{label:l(`archives.menu.replaceSource3mf`),icon:(0,G.jsx)(Iu,{className:`w-4 h-4`}),onClick:()=>pe.current?.click(),disabled:!h(`archives`,`update`,e.created_by_id),title:h(`archives`,`update`,e.created_by_id)?void 0:l(`archives.permission.noUpdateArchives`)},{label:l(`archives.menu.removeSource3mf`),icon:(0,G.jsx)(ku,{className:`w-4 h-4`}),onClick:()=>se(!0),danger:!0,disabled:!h(`archives`,`update`,e.created_by_id),title:h(`archives`,`update`,e.created_by_id)?void 0:l(`archives.permission.noUpdateArchives`)}]:[],{label:e.f3d_path?l(`archives.menu.replaceF3d`):l(`archives.menu.uploadF3d`),icon:(0,G.jsx)(Go,{className:`w-4 h-4`}),onClick:()=>me.current?.click(),disabled:!h(`archives`,`update`,e.created_by_id),title:h(`archives`,`update`,e.created_by_id)?void 0:l(`archives.permission.noUpdateArchives`)},...e.f3d_path?[{label:l(`archives.menu.downloadF3d`),icon:(0,G.jsx)(Ws,{className:`w-4 h-4`}),onClick:()=>{Z.downloadF3d(e.id).catch(e=>{console.error(`F3D download failed:`,e)})}},{label:l(`archives.menu.removeF3d`),icon:(0,G.jsx)(ku,{className:`w-4 h-4`}),onClick:()=>ce(!0),danger:!0,disabled:!h(`archives`,`update`,e.created_by_id),title:h(`archives`,`update`,e.created_by_id)?void 0:l(`archives.permission.noUpdateArchives`)}]:[],{label:``,divider:!0,onClick:()=>{}},{label:l(`archives.menu.download`),icon:(0,G.jsx)(Ws,{className:`w-4 h-4`}),onClick:()=>{Z.downloadArchive(e.id,`${e.print_name||e.filename}.3mf`).catch(e=>{console.error(`Archive download failed:`,e)})},disabled:!m(`archives:read`),title:m(`archives:read`)?void 0:l(`archives.permission.noDownload`)},{label:l(`archives.menu.copyDownloadLink`),icon:(0,G.jsx)(Fs,{className:`w-4 h-4`}),onClick:()=>{let t=`${window.location.origin}${Z.getArchiveDownload(e.id)}`;navigator.clipboard.writeText(t).then(()=>{p(l(`archives.toast.linkCopied`))}).catch(()=>{p(l(`archives.toast.failedCopyLink`),`error`)})},disabled:!m(`archives:read`),title:m(`archives:read`)?void 0:l(`archives.permission.noCopyLink`)},{label:l(`archives.menu.qrCode`),icon:(0,G.jsx)(Ml,{className:`w-4 h-4`}),onClick:()=>te(!0)},{label:e.photos?.length?l(`archives.menu.viewPhotosCount`,{count:e.photos.length}):l(`archives.menu.viewPhotos`),icon:(0,G.jsx)(es,{className:`w-4 h-4`}),onClick:()=>re(!0),disabled:!e.photos?.length},{label:l(`archives.menu.projectPage`),icon:(0,G.jsx)(oc,{className:`w-4 h-4`}),onClick:()=>ae(!0)},{label:``,divider:!0,onClick:()=>{}},{label:e.is_favorite?l(`archives.menu.removeFromFavorites`):l(`archives.menu.addToFavorites`),icon:(0,G.jsx)(mu,{className:`w-4 h-4 ${e.is_favorite?`fill-yellow-400 text-yellow-400`:h(`archives`,`update`,e.created_by_id)?`group-hover:text-yellow-400`:``}`}),onClick:()=>je.mutate(),disabled:!h(`archives`,`update`,e.created_by_id),title:h(`archives`,`update`,e.created_by_id)?void 0:l(`archives.permission.noUpdateArchives`)},{label:l(`archives.menu.edit`),icon:(0,G.jsx)(Cl,{className:`w-4 h-4`}),onClick:()=>_(!0),disabled:!h(`archives`,`update`,e.created_by_id),title:h(`archives`,`update`,e.created_by_id)?void 0:l(`archives.permission.noUpdateArchives`)},{label:l(`archives.menu.printLog`),icon:(0,G.jsx)(Nc,{className:`w-4 h-4`}),onClick:()=>y(!0)},...e.project_id&&e.project_name?[{label:l(`archives.menu.goToProject`,{name:e.project_name}),icon:(0,G.jsx)(dc,{className:`w-4 h-4 text-bambu-green`}),onClick:()=>window.location.href=`/projects`}]:[],{label:l(`archives.menu.addToProject`),icon:(0,G.jsx)(dc,{className:`w-4 h-4`}),onClick:()=>{},submenuSearchPlaceholder:Vp(a??[],e.project_id).length>5?l(`archives.menu.searchProjects`):void 0,submenu:(()=>{let t=[];if(e.project_id&&t.push({label:l(`archives.menu.removeFromProject`),icon:(0,G.jsx)(Zu,{className:`w-4 h-4`}),onClick:()=>Ne.mutate(null)}),!a)t.push({label:l(`archives.menu.loading`),icon:(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),onClick:()=>{},disabled:!0});else{let n=Vp(a,e.project_id).sort((e,t)=>e.name.localeCompare(t.name));n.length===0?t.push({label:l(`archives.menu.noProjectsAvailable`),icon:(0,G.jsx)(dc,{className:`w-4 h-4 opacity-50`}),onClick:()=>{},disabled:!0}):n.forEach(n=>{t.push({label:n.name,icon:(0,G.jsx)(`div`,{className:`w-3 h-3 rounded-full flex-shrink-0`,style:{backgroundColor:n.color||`#888`}}),onClick:()=>Ne.mutate(n.id),disabled:e.project_id===n.id})})}return t})()},{label:l(n?`archives.menu.deselect`:`archives.menu.select`),icon:n?(0,G.jsx)(du,{className:`w-4 h-4`}):(0,G.jsx)(pu,{className:`w-4 h-4`}),onClick:()=>r(e.id)},{label:``,divider:!0,onClick:()=>{}},{label:l(`archives.menu.delete`),icon:(0,G.jsx)(ku,{className:`w-4 h-4`}),onClick:()=>x(!0),danger:!0,disabled:!h(`archives`,`delete`,e.created_by_id),title:h(`archives`,`delete`,e.created_by_id)?void 0:l(`archives.permission.noDelete`)}];return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{"data-archive-id":e.id,className:`grid grid-cols-12 gap-4 px-4 py-3 items-center hover:bg-bambu-dark-tertiary/30 ${n?`bg-bambu-green/10`:``}`,style:o?{outline:`4px solid #facc15`,outlineOffset:`-4px`}:void 0,onContextMenu:Pe,children:[(0,G.jsxs)(`div`,{className:`col-span-1 flex items-center gap-2`,children:[i&&(0,G.jsx)(`button`,{onClick:()=>r(e.id),children:n?(0,G.jsx)(du,{className:`w-4 h-4 text-bambu-green`}):(0,G.jsx)(pu,{className:`w-4 h-4 text-bambu-gray`})}),e.thumbnail_path?(0,G.jsx)(`img`,{src:Z.getArchiveThumbnail(e.id),alt:``,className:`w-10 h-10 object-cover rounded`}):(0,G.jsx)(`div`,{className:`w-10 h-10 bg-bambu-dark rounded flex items-center justify-center`,children:(0,G.jsx)(Ic,{className:`w-5 h-5 text-bambu-dark-tertiary`})})]}),(0,G.jsxs)(`div`,{className:`col-span-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`p`,{className:`text-white text-sm truncate`,children:e.print_name||e.filename}),(e.status===`failed`||e.status===`aborted`)&&(0,G.jsx)(`span`,{className:`px-1.5 py-0.5 rounded text-[10px] leading-tight bg-status-error/80 text-white flex-shrink-0`,children:e.status===`aborted`?l(`archives.card.cancelled`):l(`archives.card.failed`)}),e.status===`completed`&&e.confirm_requested&&e.user_verdict==null&&(0,G.jsx)(`button`,{onClick:e=>{e.stopPropagation(),k(!0)},disabled:!h(`archives`,`update`,e.created_by_id),className:`px-1.5 py-0.5 rounded text-[10px] leading-tight bg-amber-500/90 enabled:hover:bg-amber-500 text-black flex-shrink-0 transition-colors`,title:h(`archives`,`update`,e.created_by_id)?l(`archives.card.confirmPendingTitle`):l(`archives.permission.noUpdateArchives`),children:l(`archives.card.confirmPending`)}),e.status===`completed`&&e.user_verdict===`reject`&&(0,G.jsx)(`span`,{className:`px-1.5 py-0.5 rounded text-[10px] leading-tight bg-status-error/80 text-white flex-shrink-0`,title:`${l(`archives.card.rejectedTitle`)}${ye?` — ${l(ye)}`:``}`,children:l(`archives.card.rejected`)}),e.status===`completed`&&e.user_verdict===`good`&&(0,G.jsx)(`span`,{className:`px-1.5 py-0.5 rounded text-[10px] leading-tight bg-bambu-green/80 text-white flex-shrink-0`,title:`${l(`archives.card.confirmedGoodTitle`)}${ye?` — ${l(ye)}`:``}`,children:l(`archives.card.confirmedGood`)}),e.duplicate_count>0&&ve>0&&be&&(0,G.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),u?.(be)},className:`px-1.5 py-0.5 rounded text-[10px] leading-tight bg-purple-500/80 hover:bg-purple-600/90 text-white flex-shrink-0 transition-colors flex items-center gap-1`,title:l(`archives.viewOriginalPrint`,{id:be}),children:[(0,G.jsx)(Fs,{className:`w-3 h-3`}),`#`,ve]}),e.duplicate_count>0&&ve===0&&(0,G.jsxs)(`span`,{className:`px-1.5 py-0.5 rounded text-[10px] leading-tight bg-purple-500/80 text-white flex-shrink-0 flex items-center gap-1`,title:`${e.duplicate_count} reprint${e.duplicate_count===1?``:`s`}`,children:[(0,G.jsx)(xc,{className:`w-3 h-3`}),`+`,e.duplicate_count]}),e.timelapse_path&&(0,G.jsx)(`span`,{title:l(`archives.list.hasTimelapse`),children:(0,G.jsx)(cc,{className:`w-3.5 h-3.5 text-bambu-green flex-shrink-0`})}),Me&&Me.length>0&&(0,G.jsx)(Ci,{to:`/files?folder=${Me[0].id}`,className:`flex-shrink-0`,title:l(`archives.card.openFolder`,{name:Me[0].name}),onClick:e=>e.stopPropagation(),children:(0,G.jsx)(fc,{className:`w-3.5 h-3.5 text-yellow-600 dark:text-yellow-400`})})]}),(e.filament_type||e.sliced_for_model)&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-0.5`,children:[e.sliced_for_model&&(0,G.jsxs)(`span`,{className:`text-xs text-bambu-gray flex items-center gap-1`,title:l(`archives.card.slicedFor`,{model:e.sliced_for_model}),children:[(0,G.jsx)(jl,{className:`w-2.5 h-2.5`}),e.sliced_for_model]}),(()=>{let t=om(e.bed_type);return t?(0,G.jsx)(`img`,{src:t.icon,alt:t.label,title:t.label,className:`w-3.5 h-3.5 flex-shrink-0`}):null})(),e.sliced_for_model&&e.filament_type&&(0,G.jsx)(`span`,{className:`text-bambu-gray/50`,children:`·`}),e.filament_type&&(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:e.filament_type}),e.filament_color&&(0,G.jsx)(`div`,{className:`flex items-center gap-0.5 flex-wrap`,children:e.filament_color.split(`,`).map((e,t)=>(0,G.jsx)(`div`,{className:`w-2.5 h-2.5 rounded-full border border-black/20`,style:{backgroundColor:e},title:e},t))})]})]}),(0,G.jsx)(`div`,{className:`col-span-2 text-sm text-bambu-gray truncate`,children:t}),(0,G.jsxs)(`div`,{className:`col-span-2 text-sm text-bambu-gray`,children:[(0,G.jsx)(`div`,{children:Xf(e.created_at)}),e.created_by_username&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1 text-xs opacity-75`,title:l(`archives.card.uploadedBy`,{name:e.created_by_username}),children:[(0,G.jsx)(Lu,{className:`w-3 h-3`}),e.created_by_username]})]}),(0,G.jsx)(`div`,{className:`col-span-1 text-sm text-bambu-gray`,children:Bd(e.file_size)}),(0,G.jsxs)(`div`,{className:`col-span-2 flex justify-end gap-1`,children:[q2(e)&&(0,G.jsx)(Q,{variant:`ghost`,size:`sm`,onClick:()=>D(!0),disabled:!e.file_path||!m(`queue:create`)||!h(`archives`,`reprint`,e.created_by_id),title:e.file_path?m(`queue:create`)?h(`archives`,`reprint`,e.created_by_id)?l(`common.print`):l(`archives.card.noPermissionReprint`):l(`archives.permission.noAddToQueue`):l(`archives.card.noFileForReprint`),className:`text-bambu-green hover:text-bambu-green-light hover:bg-bambu-green/10`,children:(0,G.jsx)(El,{className:`w-4 h-4`})}),(0,G.jsx)(Q,{variant:`ghost`,size:`sm`,onClick:()=>{let t=e.print_name||e.filename||`model`;J2(e.id,t,`file`,s)},title:l(`archives.card.openInBambuStudio`),children:(0,G.jsx)(Zs,{className:`w-4 h-4`})}),(e.external_url||e.makerworld_url)&&(0,G.jsx)(Q,{variant:`ghost`,size:`sm`,onClick:()=>window.open(e.external_url||e.makerworld_url,`_blank`),title:e.external_url?l(`archives.card.externalLink`):`MakerWorld`,children:(0,G.jsx)(wc,{className:`w-4 h-4`})}),(0,G.jsx)(Q,{variant:`ghost`,size:`sm`,onClick:()=>L(!0),disabled:!e.timelapse_path&&(!m(`printers:files`)||!e.printer_id||!e.started_at),title:!e.timelapse_path&&!m(`printers:files`)?l(`printers.permission.noFiles`):l(`archives.media.download`),children:(0,G.jsx)(cc,{className:`w-4 h-4`})}),(0,G.jsx)(Q,{variant:`ghost`,size:`sm`,onClick:()=>{Z.downloadArchive(e.id,`${e.print_name||e.filename}.3mf`).catch(e=>{console.error(`Archive download failed:`,e)})},title:l(`archives.card.download`),children:(0,G.jsx)(Ws,{className:`w-4 h-4`})}),(0,G.jsx)(Q,{variant:`ghost`,size:`sm`,onClick:()=>_(!0),disabled:!h(`archives`,`update`,e.created_by_id),title:h(`archives`,`update`,e.created_by_id)?l(`archives.card.edit`):l(`archives.card.noPermissionEdit`),children:(0,G.jsx)(Cl,{className:`w-4 h-4`})}),(0,G.jsx)(Q,{variant:`ghost`,size:`sm`,onClick:()=>x(!0),disabled:!h(`archives`,`delete`,e.created_by_id),title:h(`archives`,`delete`,e.created_by_id)?l(`archives.card.delete`):l(`archives.card.noPermissionDelete`),children:(0,G.jsx)(ku,{className:`w-4 h-4 text-red-600 dark:text-red-400`})}),(0,G.jsx)(Q,{variant:`ghost`,size:`sm`,onClick:e=>{let t=e.currentTarget.getBoundingClientRect();fe({x:t.left,y:t.bottom+4})},title:l(`archives.card.moreOptions`),children:(0,G.jsx)(qs,{className:`w-4 h-4`})})]})]}),g&&(0,G.jsx)(Gp,{archive:e,onClose:()=>_(!1)}),v&&(0,G.jsx)($W,{archiveId:e.id,archiveName:e.print_name||e.filename,onClose:()=>y(!1)}),ge&&(0,G.jsx)(TW,{plates:ge,onSelect:t=>{_e(null),T(`/gcode-viewer?archive=${e.id}&plate=${t}`)},onClose:()=>_e(null)}),E&&(0,G.jsx)(Tm,{mode:`create`,archiveId:e.id,archiveName:e.print_name||e.filename,onClose:()=>D(!1)}),O&&(0,G.jsx)(Em,{archiveId:e.id,onClose:()=>k(!1)}),A&&(0,G.jsx)(UW,{source:{kind:`archive`,id:e.id,filename:e.print_name||e.filename||`model`},onClose:()=>j(!1)}),M&&(0,G.jsx)(KW,{source:{kind:`archive`,id:e.id,filename:e.print_name||e.filename||`model`},onClose:()=>N(!1)}),b&&(0,G.jsxs)($d,{title:l(`archives.modal.deleteArchive`),message:l(`archives.modal.deleteConfirm`,{name:e.print_name||e.filename}),confirmText:l(`archives.modal.deleteButton`),variant:`danger`,confirmDisabled:(w.data?.currently_printing??0)>0,onConfirm:()=>{Ae.mutate(S),x(!1),C(!1)},onCancel:()=>{x(!1),C(!1)},children:[(w.data?.related_queue_items??0)>0&&(0,G.jsx)(`div`,{className:(w.data?.currently_printing??0)>0?`text-sm text-red-600 dark:text-red-400 mb-2`:`text-sm text-amber-600 dark:text-amber-400 mb-2`,children:(w.data?.currently_printing??0)>0?l(`archives.modal.deleteBlockedByPrinting`,{count:w.data.currently_printing}):l(`archives.modal.deleteQueueItemsWarning`,{count:w.data.related_queue_items})}),(0,G.jsxs)(`label`,{className:`flex items-start gap-2 cursor-pointer text-sm text-bambu-gray`,children:[(0,G.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 accent-red-500`,checked:S,onChange:e=>C(e.target.checked)}),(0,G.jsx)(`span`,{children:l(`archives.modal.deletePurgeStats`)})]})]}),oe&&(0,G.jsx)($d,{title:l(`archives.modal.removeSource3mf`),message:l(`archives.modal.removeSource3mfConfirm`,{name:e.print_name||e.filename}),confirmText:l(`archives.modal.removeButton`),variant:`danger`,onConfirm:()=>{Te.mutate(),se(!1)},onCancel:()=>se(!1)}),H&&(0,G.jsx)($d,{title:l(`archives.modal.removeF3d`),message:l(`archives.modal.removeF3dConfirm`,{name:e.print_name||e.filename}),confirmText:l(`archives.modal.removeButton`),variant:`danger`,onConfirm:()=>{De.mutate(),ce(!1)},onCancel:()=>ce(!1)}),le&&(0,G.jsx)($d,{title:l(`archives.modal.removeTimelapse`),message:l(`archives.modal.removeTimelapseConfirm`,{name:e.print_name||e.filename}),confirmText:l(`archives.modal.removeButton`),variant:`danger`,onConfirm:()=>{Se.mutate(),ue(!1)},onCancel:()=>ue(!1)}),de&&(0,G.jsx)(lE,{x:de.x,y:de.y,items:Fe,onClose:()=>fe(null)}),I&&(0,G.jsx)(V2,{archiveId:e.id,archiveName:e.print_name||e.filename,printerName:t,onClose:()=>L(!1)}),P&&e.timelapse_path&&(0,G.jsx)(B2,{src:Z.getArchiveTimelapse(e.id),title:l(`archives.modal.timelapse`,{name:e.print_name||e.filename}),downloadFilename:`${e.print_name||e.filename}_timelapse.mp4`,archiveId:e.id,onClose:()=>F(!1),onEdit:()=>{d.invalidateQueries({queryKey:[`archives`]}),F(!1)}}),R&&B.length>0&&(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/80 flex items-center justify-center z-50 p-4`,children:(0,G.jsxs)(`div`,{className:`bg-card-dark rounded-lg max-w-lg w-full max-h-[80vh] flex flex-col`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-gray-700`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:l(`archives.modal.selectTimelapse`)}),(0,G.jsx)(`p`,{className:`text-sm text-gray-400 mt-1`,children:l(`archives.modal.selectTimelapseDesc`)})]}),(0,G.jsx)(`button`,{onClick:()=>{z(!1),V([])},className:`text-gray-400 hover:text-white p-1`,children:(0,G.jsx)(Zu,{className:`w-5 h-5`})})]}),(0,G.jsx)(`div`,{className:`overflow-y-auto flex-1 p-2`,children:B.map(e=>(0,G.jsxs)(`button`,{onClick:()=>ke.mutate(e.name),disabled:ke.isPending,className:`w-full text-left p-3 rounded-lg hover:bg-gray-700 transition-colors mb-1`,children:[(0,G.jsx)(`div`,{className:`font-medium text-white`,children:e.name}),(0,G.jsxs)(`div`,{className:`text-sm text-gray-400 flex gap-3`,children:[(0,G.jsx)(`span`,{children:Bd(e.size)}),e.mtime&&(0,G.jsx)(`span`,{children:Xf(e.mtime)})]})]},e.name))})]})}),ee&&(0,G.jsx)(tG,{archiveId:e.id,archiveName:e.print_name||e.filename,onClose:()=>te(!1)}),ne&&e.photos&&(0,G.jsx)(nG,{archiveId:e.id,archiveName:e.print_name||e.filename,photos:e.photos,onClose:()=>re(!1),onDelete:async t=>{try{await Z.deleteArchivePhoto(e.id,t),d.invalidateQueries({queryKey:[`archives`]}),p(l(`archives.toast.photoDeleted`))}catch{p(l(`archives.toast.failedDeletePhoto`),`error`)}}}),ie&&(0,G.jsx)(z2,{archiveId:e.id,archiveName:e.print_name||e.filename,onClose:()=>ae(!1)}),(0,G.jsx)(`input`,{ref:pe,type:`file`,accept:`.3mf`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&we.mutate(t),e.target.value=``}}),(0,G.jsx)(`input`,{ref:me,type:`file`,accept:`.f3d`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&Ee.mutate(t),e.target.value=``}}),(0,G.jsx)(`input`,{ref:he,type:`file`,accept:`.mp4,.avi,.mkv`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&Ce.mutate(t),e.target.value=``}})]})}var ZVe=[`completed`,`failed`,`aborted`,`cancelled`,`stopped`],QVe=[{id:`all`,label:`All Archives`,icon:(0,G.jsx)(fc,{className:`w-4 h-4`})},{id:`recent`,label:`Last 24 Hours`,icon:(0,G.jsx)(Ts,{className:`w-4 h-4`})},{id:`this-week`,label:`This Week`,icon:(0,G.jsx)($o,{className:`w-4 h-4`})},{id:`this-month`,label:`This Month`,icon:(0,G.jsx)($o,{className:`w-4 h-4`})},{id:`favorites`,label:`Favorites`,icon:(0,G.jsx)(mu,{className:`w-4 h-4`})},{id:`not-printed`,label:`Not Printed`,icon:(0,G.jsx)(Iu,{className:`w-4 h-4`})},{id:`printed`,label:`Printed`,icon:(0,G.jsx)(jl,{className:`w-4 h-4`})},{id:`failed`,label:`Failed Prints`,icon:(0,G.jsx)(ps,{className:`w-4 h-4`})},{id:`duplicates`,label:`Duplicates`,icon:(0,G.jsx)(Fs,{className:`w-4 h-4`})}];function $Ve(){let{t:e}=U(),t=no(),{showToast:n}=Hd(),{hasPermission:r,hasAnyPermission:i}=Od(),a=(0,f.useRef)(null),[o,s]=(0,f.useState)(``),[c,l]=(0,f.useState)(()=>{let e=localStorage.getItem(`archiveFilterPrinter`);return e?Number(e):null}),[u,d]=(0,f.useState)(()=>localStorage.getItem(`archiveFilterMaterial`)),[p,m]=(0,f.useState)(()=>{let e=localStorage.getItem(`archiveFilterColors`);return e?new Set(JSON.parse(e)):new Set}),[h,g]=(0,f.useState)(()=>localStorage.getItem(`archiveColorFilterMode`)||`or`),[_,v]=(0,f.useState)(()=>localStorage.getItem(`archiveFilterFavorites`)===`true`),[y,b]=(0,f.useState)(()=>localStorage.getItem(`archiveHideFailed`)===`true`),[x,S]=(0,f.useState)(()=>localStorage.getItem(`archiveFilterUnconfirmed`)===`true`),[C,w]=(0,f.useState)(()=>localStorage.getItem(`archiveHideDuplicates`)===`true`),[T,E]=(0,f.useState)(()=>localStorage.getItem(`archiveFilterTag`)),[D,O]=(0,f.useState)(()=>localStorage.getItem(`archiveFilterFileType`)||`all`),[k,A]=(0,f.useState)(!1),[j,M]=(0,f.useState)([]),[N,P]=(0,f.useState)(new Set),[F,I]=(0,f.useState)(()=>localStorage.getItem(`archiveNo3MFWarningDismissed`)===`true`),{data:L}=K({queryKey:[`archives`,`no-3mf-warning`],queryFn:Z.getNo3MFWarning,staleTime:300*1e3,enabled:!F}),R=()=>{localStorage.setItem(`archiveNo3MFWarningDismissed`,`true`),I(!0)},z=L?.reason===`ftps_cooloff`?`FtpsCooloff`:L?.reason===`ftp_transfer_failed`?`FtpTransferFailed`:L?.reason===`internal_storage`?`InternalStorage`:L?.reason===`no_external_storage`?`NoExternalStorage`:L?.reason===`internal_history`?`InternalHistory`:``,B=L?.reason===`ftps_cooloff`?`https://wiki.bambuddy.cool/reference/troubleshooting/#ftps-tls-failure`:L?.reason===`ftp_transfer_failed`?`https://wiki.bambuddy.cool/reference/troubleshooting/#ftp-transfer-timed-out`:L?.reason===`internal_storage`?`https://wiki.bambuddy.cool/reference/troubleshooting/#archive-card-has-only-a-name`:L?.reason===`no_external_storage`?null:L?.reason===`internal_history`?`https://wiki.bambuddy.cool/reference/troubleshooting/#print-started-on-the-printer-has-no-thumbnail`:`https://wiki.bambuddy.cool/getting-started/#step-4-enable-store-sent-files-on-external-storage`,[V,ee]=(0,f.useState)(!1),[te,ne]=(0,f.useState)(!1),[re,ie]=(0,f.useState)(!1),[ae,oe]=(0,f.useState)(!1),[se,H]=(0,f.useState)(()=>localStorage.getItem(`archiveViewMode`)||`grid`),[ce,le]=(0,f.useState)(()=>localStorage.getItem(`archiveSortBy`)||`date-desc`),[ue,de]=(0,f.useState)(()=>localStorage.getItem(`archiveCollection`)||`all`),[fe,pe]=(0,f.useState)(0),[me,he]=(0,f.useState)(()=>{try{let e=localStorage.getItem(`archivePageSize`);return e?Number(e):50}catch{return 50}}),[ge,_e]=(0,f.useState)(!1),[ve,ye]=(0,f.useState)(!1),[be,xe]=(0,f.useState)(!1),[Se,Ce]=(0,f.useState)(!1),[we,Te]=(0,f.useState)(!1),[Ee,De]=(0,f.useState)(null),[Oe,ke]=(0,f.useState)(null),[Ae,je]=(0,f.useState)(()=>localStorage.getItem(`logFilterUser`)||null),[Me,Ne]=(0,f.useState)(()=>localStorage.getItem(`logFilterStatus`)),[Pe,Fe]=(0,f.useState)(()=>localStorage.getItem(`logFilterDateFrom`)||``),[Ie,Le]=(0,f.useState)(()=>localStorage.getItem(`logFilterDateTo`)||``),[Re,ze]=(0,f.useState)(()=>{let e=localStorage.getItem(`logOffset`);return e?Number(e):0}),[Be,Ve]=(0,f.useState)(!1),[He,Ue]=(0,f.useState)(null),[We,Ge]=(0,f.useState)(null),[Ke,qe]=(0,f.useState)(``),[Je,Ye]=(0,f.useState)(``),[Xe,Ze]=(0,f.useState)(()=>{let e=localStorage.getItem(`logPageSize`);return e?Number(e):25}),[Qe,$e]=(0,f.useState)(WVe),[et,tt]=(0,f.useState)(!1),[nt,rt]=(0,f.useState)(KVe),it=(0,f.useMemo)(()=>Qe.filter(e=>e.visible).map(e=>e.id),[Qe]),at=(0,f.useCallback)(e=>{ke(e),De(e)},[]);(0,f.useEffect)(()=>{if(Ee){let t=setTimeout(()=>{let t=document.querySelector(`[data-archive-id="${Ee}"]`);t?t.scrollIntoView({behavior:`smooth`,block:`center`}):Oe===Ee&&n(e(`archives.originalPrintNotVisible`),`warning`),Oe===Ee&&ke(null)},100),r=setTimeout(()=>De(null),5e3);return()=>{clearTimeout(t),clearTimeout(r)}}},[Ee,Oe,n,e]);let{data:ot,isLoading:st}=K({queryKey:[`archives`,c],queryFn:()=>Z.getArchives(c||void 0)}),{data:ct}=K({queryKey:[`printers`],queryFn:Z.getPrinters}),{data:lt}=K({queryKey:[`projects`],queryFn:()=>Z.getProjects()}),{data:ut}=K({queryKey:[`settings`],queryFn:Z.getSettings}),{data:dt}=K({queryKey:[`users`,`slim`],queryFn:Z.getUsersSlim,enabled:se===`log`}),{data:ft,isLoading:pt}=K({queryKey:[`print-log`,c,Ae,Me,Pe,Ie,o,Re,Xe,nt.column,nt.direction],queryFn:()=>Z.getPrintLog({search:o||void 0,printerId:c||void 0,username:Ae||void 0,status:Me||void 0,dateFrom:Pe||void 0,dateTo:Ie||void 0,limit:Xe,offset:Re,sortBy:nt.column,sortDir:nt.direction}),enabled:se===`log`}),mt=ut?.time_format||`system`,ht=qW(ut?.open_in_slicer,ut?.preferred_slicer),gt=ut?.use_slicer_api??!1,_t=Af(ut?.currency||`USD`),vt=(0,f.useMemo)(()=>Qe.map(t=>({...t,label:e(U2[t.id]??t.id)})),[Qe,e]),yt=(0,f.useMemo)(()=>W2.map(t=>({...t,label:e(U2[t.id]??t.id)})),[e]),bt=(0,f.useCallback)(e=>{K2.has(e)&&(rt(t=>{let n=t.column===e?{column:e,direction:t.direction===`asc`?`desc`:`asc`}:{column:e,direction:[`date`,`completed_at`,`duration`,`filament_used`,`cost`,`energy`,`energy_cost`].includes(e)?`desc`:`asc`};return qVe(n),n}),ze(0))},[]),xt=(0,f.useCallback)(e=>{let t=e.map(e=>({id:e.id,visible:e.visible}));$e(t),JVe(t)},[]),St=(0,f.useMemo)(()=>new Set([`duration`,`filament_used`,`cost`,`energy`,`energy_cost`]),[]),Ct=(0,f.useCallback)((t,n)=>{switch(t){case`date`:return(0,G.jsx)(`span`,{className:`text-white whitespace-nowrap`,children:Zf(n.started_at||n.created_at,mt)});case`completed_at`:return(0,G.jsx)(`span`,{className:`text-bambu-gray-light whitespace-nowrap`,children:n.completed_at?Zf(n.completed_at,mt):`—`});case`print_name`:return(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n.thumbnail_path&&(0,G.jsx)(`img`,{src:Z.getPrintLogThumbnail(n.id),alt:``,className:`w-8 h-8 rounded object-cover flex-shrink-0`,onError:e=>{e.target.style.display=`none`}}),(0,G.jsx)(`span`,{className:`text-white break-words`,title:n.print_name||``,children:n.print_name||`—`})]});case`printer`:return(0,G.jsx)(`span`,{className:`text-bambu-gray-light`,children:n.printer_name||`—`});case`user`:return(0,G.jsx)(`span`,{className:`text-bambu-gray-light`,children:n.created_by_username||`—`});case`status`:return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${n.status===`completed`?`bg-green-100 dark:bg-green-500/20 text-green-700 dark:text-green-400`:n.status===`failed`?`bg-red-100 dark:bg-red-500/20 text-red-700 dark:text-red-400`:n.status===`stopped`?`bg-yellow-100 dark:bg-yellow-500/20 text-yellow-700 dark:text-yellow-400`:n.status===`cancelled`?`bg-orange-100 dark:bg-orange-500/20 text-orange-700 dark:text-orange-400`:n.status===`skipped`?`bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400`:`bg-gray-500/20 text-gray-400`}`,children:n.status}),n.failure_reason&&(0,G.jsx)(`span`,{className:`block text-[10px] text-bambu-gray mt-0.5`,children:e(`editArchive.failureReasons.${n.failure_reason}`,{defaultValue:n.failure_reason})})]});case`duration`:return(0,G.jsx)(`span`,{className:`text-bambu-gray-light whitespace-nowrap`,children:n.duration_seconds?ep(n.duration_seconds):`—`});case`filament`:return(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[n.filament_color&&(0,G.jsx)(`div`,{className:`flex items-center gap-0.5 flex-wrap`,children:n.filament_color.split(`,`).map((e,t)=>{let n=e.trim();return(0,G.jsx)(`span`,{className:`w-3 h-3 rounded-full border border-black/20 flex-shrink-0`,style:{backgroundColor:n.startsWith(`#`)?n:void 0},title:n},t)})}),(0,G.jsx)(`span`,{className:`text-bambu-gray-light text-xs`,children:n.filament_type||`—`})]});case`filament_used`:return(0,G.jsx)(`span`,{className:`text-bambu-gray-light whitespace-nowrap tabular-nums`,children:n.filament_used_grams==null?`—`:`${n.filament_used_grams.toFixed(1)} g`});case`cost`:return(0,G.jsx)(`span`,{className:`text-bambu-gray-light whitespace-nowrap tabular-nums`,children:n.cost==null?`—`:`${_t}${n.cost.toFixed(2)}`});case`energy`:return(0,G.jsx)(`span`,{className:`text-bambu-gray-light whitespace-nowrap tabular-nums`,children:n.energy_kwh==null?`—`:`${n.energy_kwh.toFixed(2)} kWh`});case`energy_cost`:return(0,G.jsx)(`span`,{className:`text-bambu-gray-light whitespace-nowrap tabular-nums`,children:n.energy_cost==null?`—`:`${_t}${n.energy_cost.toFixed(2)}`});default:return null}},[_t,e,mt]),wt=q({mutationFn:async e=>(await Promise.all(e.map(e=>Z.deleteArchive(e))),e.length),onSuccess:e=>{Bp(t),P(new Set),n(`${e} archive${e===1?``:`s`} deleted`)},onError:()=>{n(e(`archives.toast.failedDeleteArchives`),`error`)}}),Tt=q({mutationFn:()=>Z.clearPrintLog(),onSuccess:r=>{t.invalidateQueries({queryKey:[`print-log`]}),ze(0),n(e(`archives.log.cleared`,{count:r.deleted}))},onError:()=>{n(e(`archives.log.clearFailed`),`error`)}}),Et=q({mutationFn:e=>Z.deletePrintLogEntry(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`print-log`]}),t.invalidateQueries({queryKey:[`archives-stats`]}),n(e(`archives.log.entryDeleted`))},onError:()=>{n(e(`archives.log.entryDeleteFailed`),`error`)}}),Dt=q({mutationFn:({id:e,body:t})=>Z.updatePrintLogEntry(e,t),onSuccess:()=>{t.invalidateQueries({queryKey:[`print-log`]}),t.invalidateQueries({queryKey:[`archives-stats`]}),Ge(null),n(e(`archives.log.entryUpdated`))},onError:()=>{n(e(`archives.log.entryUpdateFailed`),`error`)}});(0,f.useEffect)(()=>{c===null?localStorage.removeItem(`archiveFilterPrinter`):localStorage.setItem(`archiveFilterPrinter`,c.toString())},[c]),(0,f.useEffect)(()=>{u?localStorage.setItem(`archiveFilterMaterial`,u):localStorage.removeItem(`archiveFilterMaterial`)},[u]),(0,f.useEffect)(()=>{localStorage.setItem(`archiveFilterColors`,JSON.stringify([...p]))},[p]),(0,f.useEffect)(()=>{localStorage.setItem(`archiveColorFilterMode`,h)},[h]),(0,f.useEffect)(()=>{localStorage.setItem(`archiveFilterFavorites`,_.toString())},[_]),(0,f.useEffect)(()=>{localStorage.setItem(`archiveHideFailed`,y.toString())},[y]),(0,f.useEffect)(()=>{localStorage.setItem(`archiveFilterUnconfirmed`,x.toString())},[x]),(0,f.useEffect)(()=>{localStorage.setItem(`archiveHideDuplicates`,C.toString())},[C]),(0,f.useEffect)(()=>{T?localStorage.setItem(`archiveFilterTag`,T):localStorage.removeItem(`archiveFilterTag`)},[T]),(0,f.useEffect)(()=>{localStorage.setItem(`archiveFilterFileType`,D)},[D]),(0,f.useEffect)(()=>{pe(0)},[o,c,u,p,h,_,y,x,C,T,D,ce,ue]),(0,f.useEffect)(()=>{try{localStorage.setItem(`archivePageSize`,String(me))}catch{}},[me]),(0,f.useEffect)(()=>{localStorage.setItem(`archiveViewMode`,se)},[se]),(0,f.useEffect)(()=>{localStorage.setItem(`archiveSortBy`,ce)},[ce]),(0,f.useEffect)(()=>{localStorage.setItem(`archiveCollection`,ue)},[ue]),(0,f.useEffect)(()=>{Ae?localStorage.setItem(`logFilterUser`,Ae):localStorage.removeItem(`logFilterUser`)},[Ae]),(0,f.useEffect)(()=>{Me?localStorage.setItem(`logFilterStatus`,Me):localStorage.removeItem(`logFilterStatus`)},[Me]),(0,f.useEffect)(()=>{Pe?localStorage.setItem(`logFilterDateFrom`,Pe):localStorage.removeItem(`logFilterDateFrom`)},[Pe]),(0,f.useEffect)(()=>{Ie?localStorage.setItem(`logFilterDateTo`,Ie):localStorage.removeItem(`logFilterDateTo`)},[Ie]),(0,f.useEffect)(()=>{localStorage.setItem(`logOffset`,Re.toString())},[Re]),(0,f.useEffect)(()=>{localStorage.setItem(`logPageSize`,Xe.toString())},[Xe]);let Ot=(0,f.useMemo)(()=>new Map(ct?.map(e=>[e.id,e.name])||[]),[ct]),kt=[...new Set(ot?.flatMap(e=>e.filament_type?.split(`, `)||[]).filter(Boolean)||[])].sort(),At=[...new Set(ot?.flatMap(e=>e.filament_color?.split(`,`)||[]).filter(Boolean)||[])],jt=[...new Set(ot?.flatMap(e=>e.tags?.split(`,`).map(e=>e.trim())||[]).filter(Boolean)||[])].sort(),Mt=ot?.filter(e=>{let t=new Date,n=Jf(e.created_at)||new Date(0),r=!0;switch(ue){case`recent`:r=t.getTime()-n.getTime()<1440*60*1e3;break;case`this-week`:r=t.getTime()-n.getTime()<10080*60*1e3;break;case`this-month`:r=n.getMonth()===t.getMonth()&&n.getFullYear()===t.getFullYear();break;case`favorites`:r=e.is_favorite===!0;break;case`not-printed`:r=e.status===`archived`;break;case`printed`:r=ZVe.includes(e.status);break;case`failed`:r=e.status===`failed`||e.status===`aborted`;break;case`duplicates`:r=e.duplicate_count>0;break}let i=(e.print_name||e.filename).toLowerCase().includes(o.toLowerCase()),a=!u||e.filament_type?.split(`, `).includes(u),s=e.filament_color?.split(`,`)||[],c=p.size===0||(h===`or`?s.some(e=>p.has(e)):[...p].every(e=>s.includes(e))),l=ue===`favorites`||!_||e.is_favorite,d=ue===`failed`||!y||e.status!==`failed`&&e.status!==`aborted`,f=!x||e.confirm_requested&&e.user_verdict==null,m=ue===`duplicates`||!C||e.duplicate_count===0||e.duplicate_sequence===0,g=e.tags?.split(`,`).map(e=>e.trim())||[],v=!T||g.includes(T),b=q2(e);return r&&i&&a&&c&&l&&d&&f&&m&&v&&(D===`all`||D===`gcode`&&b||D===`source`&&!b)}).sort((e,t)=>{switch(ce){case`date-desc`:return(Jf(t.created_at)?.getTime()||0)-(Jf(e.created_at)?.getTime()||0);case`date-asc`:return(Jf(e.created_at)?.getTime()||0)-(Jf(t.created_at)?.getTime()||0);case`name-asc`:return(e.print_name||e.filename).localeCompare(t.print_name||t.filename);case`name-desc`:return(t.print_name||t.filename).localeCompare(e.print_name||e.filename);case`size-desc`:return t.file_size-e.file_size;case`size-asc`:return e.file_size-t.file_size;default:return 0}}),Nt=Mt?.length||0,Pt=me===-1,Ft=Pt?Nt||1:me,It=Math.max(1,Math.ceil(Nt/Ft)),Lt=Pt?Mt:Mt?.slice(fe*Ft,(fe+1)*Ft);(0,f.useEffect)(()=>{if(Ee&&Mt&&!Pt){let e=Mt.findIndex(e=>e.id===Ee);if(e>=0){let t=Math.floor(e/Ft);t!==fe&&pe(t)}}},[Ee]);let Rt=V||N.size>0,zt=e=>{P(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Bt=()=>{Mt&&P(new Set(Mt.map(e=>e.id)))},Vt=()=>{P(new Set),ee(!1)},Ht=e=>{m(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Ut=()=>{m(new Set)},Wt=()=>{s(``),l(null),d(null),v(!1),b(!1),w(!1),E(null),O(`all`)},Gt=o||c||u||_||y||x||C||T||D!==`all`,{isDraggingOver:Kt,dragHandlers:qt}=QW({disabled:k,extensions:[`.3mf`],onFiles:e=>{M(e),A(!0)},onRejected:()=>n(e(`archives.page.only3mfSupported`),`warning`)}),Jt=(0,f.useCallback)(e=>{let t=e.target;if(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable){e.key===`Escape`&&t.blur();return}switch(e.key){case`/`:e.preventDefault(),a.current?.focus();break;case`u`:case`U`:!e.metaKey&&!e.ctrlKey&&(e.preventDefault(),A(!0));break;case`Escape`:Rt&&Vt();break}},[Rt]);return(0,f.useEffect)(()=>(document.addEventListener(`keydown`,Jt),()=>document.removeEventListener(`keydown`,Jt)),[Jt]),(0,G.jsxs)(`div`,{className:`p-4 md:p-8 relative`,...qt,children:[Kt&&(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)(Iu,{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(`archives.page.dropFilesHere`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray`,children:e(`archives.releaseToUpload`)})]})}),Rt&&(0,G.jsxs)(`div`,{className:`fixed bottom-6 left-1/2 -translate-x-1/2 z-40 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl px-4 py-3 flex items-center gap-4`,children:[(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:Vt,children:[(0,G.jsx)(Zu,{className:`w-4 h-4`}),`Close`]}),(0,G.jsx)(`div`,{className:`w-px h-6 bg-bambu-dark-tertiary`}),(0,G.jsxs)(`span`,{className:`text-white font-medium`,children:[N.size,` selected`]}),(0,G.jsx)(`div`,{className:`w-px h-6 bg-bambu-dark-tertiary`}),(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:Bt,children:`Select All`}),(0,G.jsx)(`div`,{className:`w-px h-6 bg-bambu-dark-tertiary`}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:()=>ie(!0),disabled:!i(`archives:update_own`,`archives:update_all`),title:i(`archives:update_own`,`archives:update_all`)?void 0:e(`archives.permission.noUpdateArchives`),children:[(0,G.jsx)(yu,{className:`w-4 h-4`}),`Tags`]}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:()=>oe(!0),disabled:!i(`archives:update_own`,`archives:update_all`),title:i(`archives:update_own`,`archives:update_all`)?void 0:e(`archives.permission.noUpdateArchives`),children:[(0,G.jsx)(dc,{className:`w-4 h-4`}),`Project`]}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,disabled:!i(`archives:update_own`,`archives:update_all`),title:i(`archives:update_own`,`archives:update_all`)?void 0:e(`archives.permission.noUpdateArchives`),onClick:()=>{let r=Array.from(N);Promise.all(r.map(e=>Z.toggleFavorite(e))).then(()=>{t.invalidateQueries({queryKey:[`archives`]}),n(`Toggled favorites for ${r.length} archive${r.length===1?``:`s`}`)}).catch(()=>{n(e(`archives.toast.failedUpdateFavorites`),`error`)})},children:[(0,G.jsx)(mu,{className:`w-4 h-4`}),`Favorite`]}),(0,G.jsxs)(Q,{size:`sm`,className:`bg-red-500 hover:bg-red-600`,onClick:()=>ne(!0),disabled:!i(`archives:delete_own`,`archives:delete_all`),title:i(`archives:delete_own`,`archives:delete_all`)?void 0:e(`archives.permission.noDelete`),children:[(0,G.jsx)(ku,{className:`w-4 h-4`}),`Delete`]})]}),L?.has_fallback&&!F&&(0,G.jsxs)(`div`,{className:`mb-6 rounded-lg border border-amber-300 dark:border-amber-500/30 bg-amber-50 dark:bg-amber-500/10 px-4 py-3 flex items-start gap-3`,children:[(0,G.jsx)(ps,{className:`w-5 h-5 text-amber-600 dark:text-amber-400 flex-shrink-0 mt-0.5`}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-amber-900 dark:text-amber-200`,children:e(`archives.no3mfBanner.title${z}`)}),(0,G.jsxs)(`div`,{className:`text-xs text-amber-800/90 dark:text-amber-200/80 mt-1`,children:[e(`archives.no3mfBanner.body${z}`),B&&(0,G.jsxs)(G.Fragment,{children:[` `,(0,G.jsxs)(`a`,{href:B,target:`_blank`,rel:`noreferrer`,className:`underline hover:text-amber-900 dark:hover:text-amber-100 inline-flex items-center gap-1`,children:[e(L?.reason===`internal_storage`||L?.reason===`internal_history`||L?.reason===`ftps_cooloff`||L?.reason===`ftp_transfer_failed`?`archives.no3mfBanner.docsLinkInternalStorage`:`archives.no3mfBanner.docsLink`),(0,G.jsx)(Zs,{className:`w-3 h-3`})]})]})]})]}),(0,G.jsx)(`button`,{onClick:R,className:`text-amber-800/70 dark:text-amber-200/60 hover:text-amber-900 dark:hover:text-amber-200 flex-shrink-0 p-1 -m-1`,title:e(`archives.no3mfBanner.dismissLabel`),"aria-label":e(`archives.no3mfBanner.dismissLabel`),children:(0,G.jsx)(Zu,{className:`w-4 h-4`})})]}),(0,G.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-8`,children:[(0,G.jsx)(`div`,{children:(0,G.jsxs)(`div`,{className:`flex items-start 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)(Oo,{className:`w-7 h-7 text-bambu-green`}),`Archives`]}),(0,G.jsxs)(`p`,{className:`text-bambu-gray mt-1`,children:[Mt?.length||0,` of `,ot?.length||0,` prints`]})]}),(0,G.jsx)(`select`,{className:`mt-0.5 px-3 py-1.5 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-bambu-gray-light text-sm focus:border-bambu-green focus:outline-none`,value:ue,onChange:e=>de(e.target.value),children:QVe.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.label},e.id))})]})}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 sm:gap-3 flex-wrap`,children:[(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>_e(!ge),disabled:ve,children:[ve?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(ac,{className:`w-4 h-4`}),`Export`]}),ge&&(0,G.jsxs)(`div`,{className:`absolute right-0 top-full mt-1 w-48 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl z-20`,children:[(0,G.jsxs)(`button`,{className:`w-full px-4 py-2 text-left text-white hover:bg-bambu-dark-tertiary transition-colors flex items-center gap-2 rounded-t-lg`,onClick:async()=>{_e(!1),ye(!0);try{let{blob:t,filename:r}=await Z.exportArchives({format:`csv`,printerId:c||void 0,status:ue===`failed`?`failed`:void 0,search:o||void 0}),i=URL.createObjectURL(t),a=document.createElement(`a`);a.href=i,a.download=r,a.click(),URL.revokeObjectURL(i),n(e(`archives.toast.exportDownloaded`))}catch{n(e(`archives.toast.exportFailed`),`error`)}finally{ye(!1)}},children:[(0,G.jsx)(oc,{className:`w-4 h-4`}),`Export as CSV`]}),(0,G.jsxs)(`button`,{className:`w-full px-4 py-2 text-left text-white hover:bg-bambu-dark-tertiary transition-colors flex items-center gap-2 rounded-b-lg`,onClick:async()=>{_e(!1),ye(!0);try{let{blob:t,filename:r}=await Z.exportArchives({format:`xlsx`,printerId:c||void 0,status:ue===`failed`?`failed`:void 0,search:o||void 0}),i=URL.createObjectURL(t),a=document.createElement(`a`);a.href=i,a.download=r,a.click(),URL.revokeObjectURL(i),n(e(`archives.toast.exportDownloaded`))}catch{n(e(`archives.toast.exportFailed`),`error`)}finally{ye(!1)}},children:[(0,G.jsx)(ac,{className:`w-4 h-4`}),`Export as Excel`]})]})]}),N.size>=2&&N.size<=5&&(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>xe(!0),children:[(0,G.jsx)(Sc,{className:`w-4 h-4`}),`Compare (`,N.size,`)`]}),!Rt&&(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>ee(!0),children:[(0,G.jsx)(du,{className:`w-4 h-4`}),`Select`]}),(0,G.jsxs)(Q,{onClick:()=>A(!0),disabled:!r(`archives:create`),title:r(`archives:create`)?void 0:e(`archives.permission.noCreate`),children:[(0,G.jsx)(Iu,{className:`w-4 h-4`}),`Upload 3MF`]}),r(`archives:purge`)&&(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>Te(!0),title:e(`archivePurge.headerTooltip`),children:[(0,G.jsx)(ku,{className:`w-4 h-4 mr-2`}),e(`archivePurge.headerButton`)]})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center border border-bambu-dark-tertiary rounded-lg overflow-hidden flex-shrink-0 w-fit mb-4`,children:[(0,G.jsx)(`button`,{className:`p-2 ${se===`grid`?`bg-bambu-green text-white`:`bg-bambu-dark text-bambu-gray hover:text-white`}`,onClick:()=>H(`grid`),title:e(`archives.gridView`),children:(0,G.jsx)(Uc,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{className:`p-2 ${se===`list`?`bg-bambu-green text-white`:`bg-bambu-dark text-bambu-gray hover:text-white`}`,onClick:()=>H(`list`),title:e(`archives.listView`),children:(0,G.jsx)(Jc,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{className:`p-2 ${se===`calendar`?`bg-bambu-green text-white`:`bg-bambu-dark text-bambu-gray hover:text-white`}`,onClick:()=>H(`calendar`),title:e(`archives.calendarView`),children:(0,G.jsx)(Qo,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{className:`p-2 ${se===`log`?`bg-bambu-green text-white`:`bg-bambu-dark text-bambu-gray hover:text-white`}`,onClick:()=>H(`log`),title:e(`archives.logView`),children:(0,G.jsx)(Cs,{className:`w-4 h-4`})})]}),se!==`log`&&(0,G.jsx)(Pd,{className:`mb-6`,children:(0,G.jsxs)(Id,{className:`py-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col md:flex-row gap-3 md:gap-4 md:items-center md:flex-wrap`,children:[(0,G.jsxs)(`div`,{className:`w-full md:flex-1 relative md:min-w-[200px]`,children:[(0,G.jsx)(Gl,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray`}),(0,G.jsx)(`input`,{ref:a,type:`text`,placeholder:e(`archives.searchPlaceholder`),className:`w-full pl-10 pr-4 py-3 md:py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,value:o,onChange:e=>s(e.target.value)})]}),(0,G.jsxs)(`div`,{className:`flex gap-2 md:gap-4 overflow-x-auto pb-1 md:pb-0 -mx-4 px-4 md:mx-0 md:px-0 md:flex-wrap scrollbar-hide`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,G.jsx)(vc,{className:`w-4 h-4 text-bambu-gray hidden md:block`}),(0,G.jsxs)(`select`,{className:`px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,value:c||``,onChange:e=>l(e.target.value?Number(e.target.value):null),children:[(0,G.jsx)(`option`,{value:``,children:`All Printers`}),ct?.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,G.jsx)(gl,{className:`w-4 h-4 text-bambu-gray hidden md:block`}),(0,G.jsxs)(`select`,{className:`px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,value:u||``,onChange:e=>d(e.target.value||null),children:[(0,G.jsx)(`option`,{value:``,children:`All Materials`}),kt.map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,G.jsx)(nc,{className:`w-4 h-4 text-bambu-gray hidden md:block`}),(0,G.jsxs)(`select`,{className:`px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,value:D,onChange:e=>O(e.target.value),children:[(0,G.jsx)(`option`,{value:`all`,children:`All Files`}),(0,G.jsx)(`option`,{value:`gcode`,children:`Sliced (GCODE)`}),(0,G.jsx)(`option`,{value:`source`,children:`Source Only`})]})]}),(0,G.jsxs)(`button`,{onClick:()=>v(!_),className:`flex items-center gap-2 px-3 py-2 rounded-lg border transition-colors flex-shrink-0 ${_?`bg-yellow-100 dark:bg-yellow-500/20 border-yellow-500 text-yellow-700 dark:text-yellow-400`:`bg-bambu-dark border-bambu-dark-tertiary text-bambu-gray hover:text-white`}`,title:e(_?`archives.showAll`:`archives.showFavoritesOnly`),children:[(0,G.jsx)(mu,{className:`w-4 h-4 ${_?`fill-yellow-400`:``}`}),(0,G.jsx)(`span`,{className:`text-sm hidden md:inline`,children:`Favorites`})]}),(0,G.jsxs)(`button`,{onClick:()=>b(!y),className:`flex items-center gap-2 px-3 py-2 rounded-lg border transition-colors flex-shrink-0 ${y?`bg-red-100 dark:bg-red-500/20 border-red-500 text-red-700 dark:text-red-400`:`bg-bambu-dark border-bambu-dark-tertiary text-bambu-gray hover:text-white`}`,title:e(y?`archives.showFailedPrints`:`archives.hideFailedPrints`),children:[(0,G.jsx)(ps,{className:`w-4 h-4 `}),(0,G.jsx)(`span`,{className:`text-sm hidden md:inline`,children:`Hide Failed`})]}),(0,G.jsxs)(`button`,{onClick:()=>S(!x),className:`flex items-center gap-2 px-3 py-2 rounded-lg border transition-colors flex-shrink-0 ${x?`bg-amber-100 dark:bg-amber-500/20 border-amber-500 text-amber-700 dark:text-amber-400`:`bg-bambu-dark border-bambu-dark-tertiary text-bambu-gray hover:text-white`}`,title:e(`archives.filterUnconfirmedTitle`),children:[(0,G.jsx)(Du,{className:`w-4 h-4`}),(0,G.jsx)(`span`,{className:`text-sm hidden md:inline`,children:e(`archives.filterUnconfirmed`)})]}),(0,G.jsxs)(`button`,{onClick:()=>w(!C),className:`flex items-center gap-2 px-3 py-2 rounded-lg border transition-colors flex-shrink-0 ${C?`bg-purple-100 dark:bg-purple-500/20 border-purple-500 text-purple-700 dark:text-purple-400`:`bg-bambu-dark border-bambu-dark-tertiary text-bambu-gray hover:text-white`}`,title:e(`archives.hideDuplicates`),children:[(0,G.jsx)(Fs,{className:`w-4 h-4`}),(0,G.jsx)(`span`,{className:`text-sm hidden md:inline`,children:e(`archives.hideDuplicates`)})]}),jt.length>0&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,G.jsx)(yu,{className:`w-4 h-4 text-bambu-gray hidden md:block`}),(0,G.jsxs)(`select`,{className:`px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,value:T||``,onChange:e=>E(e.target.value||null),children:[(0,G.jsx)(`option`,{value:``,children:`All Tags`}),jt.map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))]}),(0,G.jsx)(`button`,{onClick:()=>Ce(!0),className:`p-2 rounded-lg bg-bambu-dark border border-bambu-dark-tertiary text-bambu-gray hover:text-white hover:border-bambu-green transition-colors`,title:e(`archives.manageTags`),children:(0,G.jsx)(Xl,{className:`w-4 h-4`})})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,G.jsx)(Po,{className:`w-4 h-4 text-bambu-gray hidden md:block`}),(0,G.jsxs)(`select`,{className:`px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,value:ce,onChange:e=>le(e.target.value),children:[(0,G.jsx)(`option`,{value:`date-desc`,children:e(`archives.sortNewest`)}),(0,G.jsx)(`option`,{value:`date-asc`,children:e(`archives.sortOldest`)}),(0,G.jsxs)(`option`,{value:`name-asc`,children:[e(`archives.sortName`),` A-Z`]}),(0,G.jsxs)(`option`,{value:`name-desc`,children:[e(`archives.sortName`),` Z-A`]}),(0,G.jsx)(`option`,{value:`size-desc`,children:e(`archives.sortLargest`)}),(0,G.jsx)(`option`,{value:`size-asc`,children:e(`archives.sortSmallest`)})]})]})]}),Gt&&(0,G.jsxs)(Q,{variant:`ghost`,size:`sm`,onClick:Wt,className:`text-bambu-gray hover:text-white`,children:[(0,G.jsx)(Zu,{className:`w-4 h-4`}),`Reset`]})]}),At.length>0&&(0,G.jsxs)(`div`,{className:`flex items-center gap-3 mt-4 pt-4 border-t border-bambu-dark-tertiary`,children:[(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:`Colors:`}),p.size>1&&(0,G.jsx)(`button`,{onClick:()=>g(e=>e===`or`?`and`:`or`),className:`px-2 py-0.5 text-xs rounded transition-colors ${h===`and`?`bg-bambu-green text-white`:`bg-bambu-dark-tertiary text-bambu-gray hover:text-white`}`,title:h===`or`?`Match ANY selected color`:`Match ALL selected colors`,children:h.toUpperCase()}),(0,G.jsx)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:At.map(e=>(0,G.jsx)(`button`,{onClick:()=>Ht(e),className:`w-6 h-6 rounded-full border-2 transition-all ${p.has(e)?`border-bambu-green scale-110`:`border-white/20 hover:border-white/40`}`,style:{backgroundColor:e},title:e},e))}),p.size>0&&(0,G.jsxs)(`button`,{onClick:Ut,className:`text-xs text-bambu-gray hover:text-white flex items-center gap-1`,children:[(0,G.jsx)(Zu,{className:`w-3 h-3`}),`Clear`]})]})]})}),(0,G.jsx)(HVe,{}),st?(0,G.jsx)(`div`,{className:`text-center py-12 text-bambu-gray`,children:e(`archives.loadingArchives`)}):Mt?.length===0&&se!==`log`?(0,G.jsx)(Pd,{children:(0,G.jsxs)(Id,{className:`text-center py-12`,children:[(0,G.jsx)(`p`,{className:`text-bambu-gray`,children:e(o?`archives.noArchivesSearch`:`archives.noArchivesYet`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mt-2`,children:`Archives are created automatically when prints complete`})]})}):se===`calendar`?(0,G.jsx)(Pd,{className:`p-6`,children:(0,G.jsx)(Gje,{archives:Mt||[],onArchiveClick:e=>{s(``),H(`grid`),De(e.id)},highlightedArchiveId:Ee})}):se===`grid`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6`,children:Lt?.map(t=>(0,G.jsx)(YVe,{archive:t,printerName:t.printer_id?Ot.get(t.printer_id)||`Unknown`:t.sliced_for_model||`No Printer`,printerMap:Ot,isSelected:N.has(t.id),onSelect:zt,selectionMode:Rt,projects:lt,isHighlighted:t.id===Ee,timeFormat:mt,preferredSlicer:ht,useSlicerApi:gt,currency:_t,t:e,onNavigateToArchive:at},t.id))}),(0,G.jsx)(Y2,{pageIndex:fe,pageSize:me,totalRows:Nt,totalPages:It,onPageChange:pe,onPageSizeChange:e=>{he(e),pe(0)},t:e})]}):se===`list`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Pd,{children:(0,G.jsxs)(`div`,{className:`divide-y divide-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-12 gap-4 px-4 py-3 text-xs text-bambu-gray font-medium`,children:[(0,G.jsx)(`div`,{className:`col-span-1`}),(0,G.jsx)(`div`,{className:`col-span-4`,children:`Name`}),(0,G.jsx)(`div`,{className:`col-span-2`,children:`Printer`}),(0,G.jsx)(`div`,{className:`col-span-2`,children:`Date`}),(0,G.jsx)(`div`,{className:`col-span-1`,children:`Size`}),(0,G.jsx)(`div`,{className:`col-span-2 text-right`,children:`Actions`})]}),Lt?.map(t=>(0,G.jsx)(XVe,{archive:t,printerName:t.printer_id?Ot.get(t.printer_id)||`Unknown`:t.sliced_for_model||`No Printer`,isSelected:N.has(t.id),onSelect:zt,selectionMode:Rt,projects:lt,isHighlighted:t.id===Ee,preferredSlicer:ht,useSlicerApi:gt,t:e,onNavigateToArchive:at},t.id))]})}),(0,G.jsx)(Y2,{pageIndex:fe,pageSize:me,totalRows:Nt,totalPages:It,onPageChange:pe,onPageSizeChange:e=>{he(e),pe(0)},t:e})]}):se===`log`?(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(Pd,{children:(0,G.jsx)(Id,{className:`py-3`,children:(0,G.jsxs)(`div`,{className:`flex flex-col md:flex-row gap-3 md:items-center md:flex-wrap`,children:[(0,G.jsxs)(`div`,{className:`flex-1 relative md:min-w-[200px]`,children:[(0,G.jsx)(Gl,{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(`archives.searchPlaceholder`),className:`w-full pl-10 pr-4 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none text-sm`,value:o,onChange:e=>{s(e.target.value),ze(0)}})]}),(0,G.jsxs)(`select`,{className:`px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none text-sm`,value:c||``,onChange:e=>{l(e.target.value?Number(e.target.value):null),ze(0)},children:[(0,G.jsx)(`option`,{value:``,children:e(`archives.log.allPrinters`)}),ct?.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,G.jsxs)(`select`,{className:`px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none text-sm`,value:Ae||``,onChange:e=>{je(e.target.value||null),ze(0)},children:[(0,G.jsx)(`option`,{value:``,children:e(`archives.log.allUsers`)}),dt?.map(e=>(0,G.jsx)(`option`,{value:e.username,children:e.username},e.id))]}),(0,G.jsxs)(`select`,{className:`px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none text-sm`,value:Me||``,onChange:e=>{Ne(e.target.value||null),ze(0)},children:[(0,G.jsx)(`option`,{value:``,children:e(`archives.log.allStatuses`)}),(0,G.jsx)(`option`,{value:`completed`,children:e(`archives.status.completed`)}),(0,G.jsx)(`option`,{value:`failed`,children:e(`archives.status.failed`)}),(0,G.jsx)(`option`,{value:`stopped`,children:e(`archives.status.stopped`)}),(0,G.jsx)(`option`,{value:`cancelled`,children:e(`archives.log.cancelled`)}),(0,G.jsx)(`option`,{value:`skipped`,children:e(`archives.log.skipped`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`label`,{className:`text-sm text-bambu-gray`,children:e(`archives.log.dateFrom`)}),(0,G.jsx)(`input`,{type:`date`,className:`px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none text-sm`,value:Pe,onChange:e=>{Fe(e.target.value),ze(0)}})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`label`,{className:`text-sm text-bambu-gray`,children:e(`archives.log.dateTo`)}),(0,G.jsx)(`input`,{type:`date`,className:`px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none text-sm`,value:Ie,onChange:e=>{Le(e.target.value),ze(0)}})]}),(0,G.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>tt(!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:e(`inventory.configureColumns`),children:[(0,G.jsx)(Ns,{className:`w-4 h-4`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:e(`archives.log.columns`)})]}),(0,G.jsxs)(Q,{variant:`danger`,size:`sm`,onClick:()=>Ve(!0),disabled:!r(`archives:delete_all`)||Tt.isPending,children:[(0,G.jsx)(ku,{className:`w-4 h-4`}),e(`archives.log.clearLog`)]})]})]})})}),(0,G.jsx)(Pd,{children:pt?(0,G.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,G.jsx)(Y,{className:`w-6 h-6 animate-spin text-bambu-green`})}):ft?.items.length?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`overflow-x-auto`,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 text-bambu-gray text-left`,children:[it.map(t=>{let n=K2.has(t),r=nt.column===t,i=e(U2[t]??t);return(0,G.jsx)(`th`,{scope:`col`,"aria-sort":r?nt.direction===`asc`?`ascending`:`descending`:`none`,className:`px-4 py-3 font-medium ${St.has(t)?`text-right`:``}`,children:n?(0,G.jsxs)(`button`,{type:`button`,onClick:()=>bt(t),className:`inline-flex items-center gap-1 font-medium transition-colors hover:text-bambu-green ${r?`text-bambu-green`:``}`,title:e(`archives.log.sortBy`,{column:i}),children:[i,r?nt.direction===`asc`?(0,G.jsx)(us,{className:`w-3.5 h-3.5`}):(0,G.jsx)(ss,{className:`w-3.5 h-3.5`}):(0,G.jsx)(Po,{className:`w-3.5 h-3.5 opacity-30`})]}):i},t)}),(0,G.jsx)(`th`,{className:`px-4 py-3 font-medium w-10`,"aria-label":e(`common.actions`)})]})}),(0,G.jsx)(`tbody`,{className:`divide-y divide-bambu-dark-tertiary`,children:ft.items.map(t=>(0,G.jsxs)(`tr`,{className:`hover:bg-bambu-dark-secondary/50`,children:[it.map(e=>(0,G.jsx)(`td`,{className:`px-4 py-3 ${St.has(e)?`text-right`:``}`,children:Ct(e,t)},e)),(0,G.jsx)(`td`,{className:`px-4 py-3 text-right`,children:(0,G.jsxs)(`div`,{className:`inline-flex items-center gap-2`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>{Ge(t),qe(t.failure_reason||``),Ye(t.status)},disabled:Dt.isPending||!(r(`archives:update_all`)||r(`archives:update_own`)),title:r(`archives:update_all`)||r(`archives:update_own`)?e(`archives.log.editEntryTitle`):e(`archives.permission.noEdit`),className:`text-bambu-gray hover:text-bambu-blue disabled:opacity-40 disabled:hover:text-bambu-gray transition-colors`,children:(0,G.jsx)(Cl,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>Ue(t.id),disabled:Et.isPending||!(r(`archives:delete_all`)||r(`archives:delete_own`)),title:r(`archives:delete_all`)||r(`archives:delete_own`)?e(`archives.log.deleteEntryTitle`):e(`archives.permission.noDelete`),className:`text-bambu-gray hover:text-red-600 dark:hover:text-red-400 disabled:opacity-40 disabled:hover:text-bambu-gray transition-colors`,children:(0,G.jsx)(ku,{className:`w-4 h-4`})})]})})]},t.id))})]})}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-t border-bambu-dark-tertiary flex-wrap gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e(`archives.log.showing`,{count:Math.min(Re+Xe,ft.total),total:ft.total})}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`label`,{className:`text-xs text-bambu-gray`,children:e(`archives.log.rowsPerPage`)}),(0,G.jsxs)(`select`,{className:`px-2 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-xs focus:border-bambu-green focus:outline-none`,value:Xe,onChange:e=>{Ze(Number(e.target.value)),ze(0)},children:[(0,G.jsx)(`option`,{value:10,children:`10`}),(0,G.jsx)(`option`,{value:25,children:`25`}),(0,G.jsx)(`option`,{value:50,children:`50`}),(0,G.jsx)(`option`,{value:100,children:`100`})]})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`span`,{className:`text-sm text-bambu-gray`,children:[e(`archives.log.page`),` `,Math.floor(Re/Xe)+1,` / `,Math.max(1,Math.ceil(ft.total/Xe))]}),(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:()=>ze(Math.max(0,Re-Xe)),disabled:Re===0,children:(0,G.jsx)(ls,{className:`w-4 h-4`})}),(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:()=>ze(Re+Xe),disabled:Re+Xe>=ft.total,children:(0,G.jsx)(cs,{className:`w-4 h-4`})})]})]})]}):(0,G.jsx)(`div`,{className:`text-center py-12 text-bambu-gray`,children:e(`archives.log.noEntries`)})})]}):null,k&&(0,G.jsx)(Ije,{onClose:()=>{A(!1),M([])},initialFiles:j}),we&&(0,G.jsx)(Rje,{onClose:()=>Te(!1)}),te&&(0,G.jsx)($d,{title:e(`archives.modal.deleteArchives`),message:e(`archives.modal.deleteArchivesConfirm`,{count:N.size}),confirmText:e(`archives.modal.deleteCount`,{count:N.size}),variant:`danger`,onConfirm:()=>{wt.mutate(Array.from(N)),ne(!1)},onCancel:()=>ne(!1)}),re&&(0,G.jsx)(zje,{selectedIds:Array.from(N),existingTags:jt,onClose:()=>ie(!1)}),ae&&(0,G.jsx)(Bje,{selectedIds:Array.from(N),onClose:()=>oe(!1)}),be&&N.size>=2&&N.size<=5&&(0,G.jsx)(RVe,{archiveIds:Array.from(N),onClose:()=>{xe(!1),P(new Set),ee(!1)}}),Se&&(0,G.jsx)(UVe,{onClose:()=>Ce(!1)}),(0,G.jsx)(eG,{isOpen:et,onClose:()=>tt(!1),columns:vt,defaultColumns:yt,onSave:xt}),Be&&(0,G.jsx)($d,{title:e(`archives.log.clearLogTitle`),message:e(`archives.log.clearLogConfirm`),confirmText:e(`archives.log.clearLogButton`),variant:`danger`,onConfirm:()=>{Tt.mutate(),Ve(!1)},onCancel:()=>Ve(!1)}),He!==null&&(0,G.jsx)($d,{title:e(`archives.log.deleteEntryTitle`),message:e(`archives.log.deleteEntryConfirm`),confirmText:e(`common.delete`),variant:`danger`,onConfirm:()=>{Et.mutate(He),Ue(null)},onCancel:()=>Ue(null)}),We!==null&&(0,G.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm`,onClick:()=>Ge(null),children:(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg w-full max-w-md mx-4 p-6`,onClick:e=>e.stopPropagation(),children:[(0,G.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-4`,children:e(`archives.log.editEntryTitle`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mb-4`,children:e(`archives.log.editEntryDescription`)}),(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:e(`editArchive.status`)}),(0,G.jsxs)(`select`,{value:Je,onChange:e=>Ye(e.target.value),className:`w-full px-3 py-2 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:`completed`,children:e(`archives.log.statuses.completed`,{defaultValue:`completed`})}),(0,G.jsx)(`option`,{value:`failed`,children:e(`archives.log.statuses.failed`,{defaultValue:`failed`})}),(0,G.jsx)(`option`,{value:`stopped`,children:e(`archives.log.statuses.stopped`,{defaultValue:`stopped`})}),(0,G.jsx)(`option`,{value:`cancelled`,children:e(`archives.log.statuses.cancelled`,{defaultValue:`cancelled`})}),(0,G.jsx)(`option`,{value:`skipped`,children:e(`archives.log.statuses.skipped`,{defaultValue:`skipped`})})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:e(`editArchive.failureReason`)}),(0,G.jsxs)(`select`,{value:Ke,onChange:e=>qe(e.target.value),className:`w-full px-3 py-2 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:e(`editArchive.selectReason`)}),Up.map(t=>(0,G.jsx)(`option`,{value:t,children:e(`editArchive.failureReasons.${t}`)},t))]})]})]}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-2 mt-6`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>Ge(null),children:e(`common.cancel`)}),(0,G.jsx)(Q,{variant:`primary`,onClick:()=>{let e={};if(Ke!==(We.failure_reason||``)&&(e.failure_reason=Ke||null),Je!==We.status&&(e.status=Je),Object.keys(e).length===0){Ge(null);return}Dt.mutate({id:We.id,body:e})},disabled:Dt.isPending,children:Dt.isPending?e(`editArchive.saving`):e(`common.save`)})]})]})})]})}function Y2({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(`archives.prints`)}`:(0,G.jsxs)(G.Fragment,{children:[o(`archives.pagination.showing`),` `,e*c+1,` `,o(`archives.pagination.to`),` `,Math.min((e+1)*c,n),` `,o(`archives.pagination.of`),` `,n,` `,o(`archives.prints`)]})}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:o(`archives.pagination.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:[[25,50,100,200].map(e=>(0,G.jsx)(`option`,{value:e,children:e},e)),(0,G.jsx)(`option`,{value:-1,children:o(`archives.pagination.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)(ds,{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)(ls,{className:`w-4 h-4`})}),(0,G.jsxs)(`span`,{className:`text-bambu-gray px-2 whitespace-nowrap`,children:[o(`archives.pagination.page`),` `,e+1,` `,o(`archives.pagination.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)(cs,{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)(fs,{className:`w-4 h-4`})})]})]})]})}function eHe(){var e=[...arguments];return(0,f.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var X2=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Z2(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function Q2(e){return`nodeType`in e}function $2(e){return e?Z2(e)?e:Q2(e)?e.ownerDocument?.defaultView??window:window:window}function e4(e){let{Document:t}=$2(e);return e instanceof t}function t4(e){return Z2(e)?!1:e instanceof $2(e).HTMLElement}function n4(e){return e instanceof $2(e).SVGElement}function r4(e){return e?Z2(e)?e.document:Q2(e)?e4(e)?e:t4(e)||n4(e)?e.ownerDocument:document:document:document}var i4=X2?f.useLayoutEffect:f.useEffect;function a4(e){let t=(0,f.useRef)(e);return i4(()=>{t.current=e}),(0,f.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function tHe(){let e=(0,f.useRef)(null);return[(0,f.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,f.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function o4(e,t){t===void 0&&(t=[e]);let n=(0,f.useRef)(e);return i4(()=>{n.current!==e&&(n.current=e)},t),n}function s4(e,t){let n=(0,f.useRef)();return(0,f.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function c4(e){let t=a4(e),n=(0,f.useRef)(null);return[n,(0,f.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function l4(e){let t=(0,f.useRef)();return(0,f.useEffect)(()=>{t.current=e},[e]),t.current}var u4={};function d4(e,t){return(0,f.useMemo)(()=>{if(t)return t;let n=u4[e]==null?0:u4[e]+1;return u4[e]=n,e+`-`+n},[e,t])}function f4(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var p4=f4(1),m4=f4(-1);function nHe(e){return`clientX`in e&&`clientY`in e}function h4(e){if(!e)return!1;let{KeyboardEvent:t}=$2(e.target);return t&&e instanceof t}function rHe(e){if(!e)return!1;let{TouchEvent:t}=$2(e.target);return t&&e instanceof t}function g4(e){if(rHe(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return nHe(e)?{x:e.clientX,y:e.clientY}:null}var _4=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[_4.Translate.toString(e),_4.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),v4=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function iHe(e){return e.matches(v4)?e:e.querySelector(v4)}var aHe={display:`none`};function oHe(e){let{id:t,value:n}=e;return f.createElement(`div`,{id:t,style:aHe},n)}function sHe(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return f.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function cHe(){let[e,t]=(0,f.useState)(``);return{announce:(0,f.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var y4=(0,f.createContext)(null);function lHe(e){let t=(0,f.useContext)(y4);(0,f.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of `);return t(e)},[e,t])}function uHe(){let[e]=(0,f.useState)(()=>new Set),t=(0,f.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,f.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var dHe={draggable:` + [&::-webkit-slider-thumb]:cursor-pointer`}),(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray w-12`,children:np(m)})]}),(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)(`button`,{onClick:()=>{let e=o.current;e&&(e.currentTime=Math.max(0,e.currentTime-5))},className:`p-2 hover:bg-bambu-dark-tertiary rounded-lg transition-colors`,title:`Skip back 5s`,children:(0,G.jsx)(ru,{className:`w-5 h-5 text-bambu-gray`})}),(0,G.jsx)(`button`,{onClick:v,className:`p-2 bg-bambu-green hover:bg-bambu-green-dark rounded-lg transition-colors`,children:s?(0,G.jsx)(bl,{className:`w-5 h-5 text-white`}):(0,G.jsx)(El,{className:`w-5 h-5 text-white`})}),(0,G.jsx)(`button`,{onClick:()=>{let e=o.current;e&&(e.currentTime=Math.min(m,e.currentTime+5))},className:`p-2 hover:bg-bambu-dark-tertiary rounded-lg transition-colors`,title:`Skip forward 5s`,children:(0,G.jsx)(iu,{className:`w-5 h-5 text-bambu-gray`})})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:`Speed:`}),(0,G.jsx)(`div`,{className:`flex gap-1`,children:LVe.map(e=>(0,G.jsxs)(`button`,{onClick:()=>u(e),className:`px-2 py-1 text-xs rounded transition-colors ${l===e?`bg-bambu-green text-white`:`bg-bambu-dark-tertiary text-bambu-gray hover:bg-bambu-dark-tertiary/80`}`,children:[e,`x`]},e))})]})]})]})]})]}),g&&r&&(0,G.jsx)(IVe,{archiveId:r,timelapseSrc:e,onClose:()=>_(!1),onSave:a})]})}function V2({archiveId:e,archiveName:t,printerName:n,onClose:r}){let{t:i}=U(),{showToast:a}=Hd(),[o,s]=(0,f.useState)(new Set),[c,l]=(0,f.useState)(!1),[u,d]=(0,f.useState)(null),p=(0,f.useRef)(null),m=(0,f.useRef)(null),h=K({queryKey:[`archive-printer-media`,e],queryFn:()=>Z.getArchivePrinterMedia(e),staleTime:6e4}),g=(0,f.useMemo)(()=>h.data?.remote_files??[],[h.data]);(0,f.useEffect)(()=>{!h.data||p.current===e||(p.current=e,g.length===1&&s(new Set([g[0].path])))},[e,h.data,g]),(0,f.useEffect)(()=>{let e=new Set(g.map(e=>e.path));s(t=>new Set([...t].filter(t=>e.has(t))))},[g]),(0,f.useEffect)(()=>()=>m.current?.abort(),[]),(0,f.useEffect)(()=>{let e=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]);let _=e=>{s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},v=async()=>{let n=h.data?.local_timelapse?.name??``,r=n.includes(`.`)?`.${n.split(`.`).pop()}`:``;try{await Z.downloadArchiveTimelapse(e,`${t}_timelapse${r}`)}catch(e){a(i(`printerFiles.downloadFailed`,{error:e instanceof Error?e.message:i(`printerFiles.unknownError`)}),`error`)}},y=async()=>{if(!h.data?.printer_id||o.size===0)return;let e=g.filter(e=>o.has(e.path));if(e.length===0)return;let n=new AbortController;m.current=n,l(!0);try{let r=await Z.downloadPrinterFilesAsZip(h.data.printer_id,e.map(e=>e.path),Object.fromEntries(e.map(e=>[e.path,e.size])),`${t.replace(/[^a-zA-Z0-9]/g,`_`)}-printer-videos.zip`,!0,n.signal,(e,t)=>d({current:e,total:t}));r.failed>0?a(i(`printerFiles.zipPartial`,{successful:r.successful,total:r.requested}),`warning`):a(i(`printerFiles.zipStarted`,{count:r.successful}))}catch(e){a(i(`printerFiles.downloadFailed`,{error:e instanceof Error?e.message:i(`printerFiles.unknownError`)}),`error`)}finally{m.current===n&&(m.current=null),d(null),l(!1)}},b=!!h.data?.local_timelapse||g.length>0,x=e=>i(e===`printer_files_forbidden`?`printers.permission.noFiles`:e===`printer_missing`?`archives.media.printerMissing`:e===`timelapse_unavailable`?`archives.media.timelapseUnavailable`:`archives.media.ipcamUnavailable`),S=(h.data?.warnings??[]).map(e=>(0,G.jsx)(`p`,{className:`text-xs text-amber-600 dark:text-amber-400`,children:x(e)},e));return(0,G.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-4`,onClick:r,children:(0,G.jsxs)(`div`,{className:`flex max-h-[85vh] w-full max-w-2xl flex-col overflow-hidden rounded-xl border border-bambu-dark-tertiary bg-bambu-dark-secondary`,onClick:e=>e.stopPropagation(),children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between border-b border-bambu-dark-tertiary p-4`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`h3`,{className:`flex items-center gap-2 text-lg font-semibold text-white`,children:[(0,G.jsx)(Bu,{className:`h-5 w-5 text-bambu-green`}),i(`archives.media.title`)]}),(0,G.jsxs)(`p`,{className:`truncate text-sm text-bambu-gray`,children:[t,` · `,n]})]}),(0,G.jsx)(`button`,{onClick:r,className:`rounded p-1 text-bambu-gray hover:bg-bambu-dark-tertiary hover:text-white`,children:(0,G.jsx)(Zu,{className:`h-5 w-5`})})]}),(0,G.jsx)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:h.isLoading?(0,G.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-12 text-bambu-gray`,children:[(0,G.jsx)(Y,{className:`h-5 w-5 animate-spin`}),i(`archives.media.searching`)]}):h.isError?(0,G.jsx)(`p`,{className:`py-8 text-center text-red-500`,children:i(`archives.media.searchFailed`)}):b?(0,G.jsxs)(`div`,{className:`space-y-4`,children:[h.data?.local_timelapse&&(0,G.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border border-bambu-dark-tertiary bg-bambu-dark p-3`,children:[(0,G.jsx)(cc,{className:`h-5 w-5 shrink-0 text-bambu-green`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`p`,{className:`truncate text-sm font-medium text-white`,children:h.data.local_timelapse.name}),(0,G.jsxs)(`p`,{className:`text-xs text-bambu-gray`,children:[i(`archives.media.attachedTimelapse`),` · `,Bd(h.data.local_timelapse.size)]})]}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:v,children:[(0,G.jsx)(Ws,{className:`h-4 w-4`}),i(`common.download`)]})]}),g.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,G.jsxs)(`p`,{className:`text-sm text-bambu-gray`,children:[i(`archives.media.printerFiles`),` (`,g.length,`)`]}),(0,G.jsx)(`button`,{className:`text-xs text-bambu-green hover:text-bambu-green-light`,onClick:()=>s(o.size===g.length?new Set:new Set(g.map(e=>e.path))),children:o.size===g.length?i(`common.deselectAll`):i(`common.selectAll`)})]}),(0,G.jsx)(`div`,{className:`space-y-1`,children:g.map(e=>{let t=o.has(e.path);return(0,G.jsxs)(`button`,{className:`flex w-full items-center gap-3 rounded-lg border p-3 text-left transition-colors ${t?`border-bambu-green/60 bg-bambu-green/10`:`border-bambu-dark-tertiary bg-bambu-dark hover:border-bambu-gray`}`,onClick:()=>_(e.path),children:[t?(0,G.jsx)(du,{className:`h-5 w-5 shrink-0 text-bambu-green`}):(0,G.jsx)(pu,{className:`h-5 w-5 shrink-0 text-bambu-gray`}),e.kind===`timelapse`?(0,G.jsx)(cc,{className:`h-5 w-5 shrink-0 text-bambu-green`}):(0,G.jsx)(Bu,{className:`h-5 w-5 shrink-0 text-blue-400`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-white`,children:e.name}),(0,G.jsx)(`span`,{className:`shrink-0 text-xs text-bambu-gray`,children:Bd(e.size)})]},e.path)})})]}),S]}):(0,G.jsxs)(`div`,{className:`space-y-3 py-8 text-center`,children:[(0,G.jsx)(`p`,{className:`text-bambu-gray`,children:i(`archives.media.none`)}),S]})}),g.length>0&&(0,G.jsx)(`div`,{className:`flex items-center justify-end border-t border-bambu-dark-tertiary p-4`,children:(0,G.jsxs)(Q,{variant:`primary`,onClick:y,disabled:o.size===0||c,children:[c?(0,G.jsx)(Y,{className:`h-4 w-4 animate-spin`}):(0,G.jsx)(Ws,{className:`h-4 w-4`}),u?`${u.current}/${u.total}`:`${i(`archives.media.downloadSelected`)} (${o.size})`]})})]})})}function RVe({archiveIds:e,onClose:t}){(0,f.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]);let{data:n,isLoading:r,error:i}=K({queryKey:[`archive-comparison`,e],queryFn:()=>Z.compareArchives(e)});return(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/80 flex items-center justify-center z-50 p-4`,onClick:t,children:(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-lg max-w-4xl w-full max-h-[90vh] flex flex-col border border-bambu-dark-tertiary`,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)(`h3`,{className:`text-lg font-semibold text-white`,children:[`Compare Archives (`,e.length,`)`]}),(0,G.jsx)(`button`,{onClick:t,className:`text-bambu-gray hover:text-white p-1`,children:(0,G.jsx)(Zu,{className:`w-5 h-5`})})]}),(0,G.jsx)(`div`,{className:`flex-1 overflow-auto p-4 bg-bambu-dark-secondary`,children:r?(0,G.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,G.jsx)(Y,{className:`w-8 h-8 text-bambu-green animate-spin`})}):i?(0,G.jsxs)(`div`,{className:`text-center py-12 text-red-700 dark:text-red-400`,children:[(0,G.jsx)(Mu,{className:`w-12 h-12 mx-auto mb-4 opacity-50`}),(0,G.jsx)(`p`,{children:`Failed to load comparison`}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mt-2`,children:i instanceof Error?i.message:`Unknown error`})]}):n?(0,G.jsx)(zVe,{comparison:n}):null}),(0,G.jsx)(`div`,{className:`p-4 border-t border-bambu-dark-tertiary`,children:(0,G.jsx)(Q,{variant:`secondary`,onClick:t,className:`w-full`,children:`Close`})})]})})}function zVe({comparison:e}){return(0,G.jsxs)(`div`,{className:`space-y-6`,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`,{children:[(0,G.jsx)(`th`,{className:`text-left text-sm text-bambu-gray font-medium pb-2 pr-4 min-w-[150px]`,children:`Setting`}),e.archives.map(e=>(0,G.jsxs)(`th`,{className:`text-left text-sm font-medium pb-2 px-2 min-w-[120px]`,children:[(0,G.jsx)(`div`,{className:`text-white truncate max-w-[150px]`,title:e.print_name,children:e.print_name}),(0,G.jsx)(`div`,{className:`text-xs ${e.status===`completed`?`text-status-ok`:e.status===`failed`?`text-status-error`:`text-bambu-gray`}`,children:e.status})]},e.id))]})}),(0,G.jsx)(`tbody`,{className:`divide-y divide-bambu-gray/20`,children:e.comparison.map(e=>(0,G.jsxs)(`tr`,{className:e.has_difference?`bg-yellow-500/5`:``,children:[(0,G.jsx)(`td`,{className:`py-2 pr-4 text-sm`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.has_difference&&(0,G.jsx)(Mu,{className:`w-3 h-3 text-yellow-600 dark:text-yellow-400 flex-shrink-0`}),(0,G.jsx)(`span`,{className:e.has_difference?`text-yellow-700 dark:text-yellow-400`:`text-bambu-gray`,children:e.label})]})}),e.values.map((t,n)=>(0,G.jsxs)(`td`,{className:`py-2 px-2 text-sm text-white`,children:[t??(0,G.jsx)(`span`,{className:`text-bambu-gray/50`,children:`-`}),e.unit&&t!==null&&(0,G.jsx)(`span`,{className:`text-bambu-gray ml-1`,children:e.unit})]},n))]},e.field))})]})}),e.differences.length>0&&(0,G.jsxs)(`div`,{className:`p-4 bg-yellow-50 border border-yellow-300 dark:bg-yellow-500/10 dark:border-yellow-500/30 rounded-lg`,children:[(0,G.jsxs)(`h4`,{className:`text-sm font-medium text-yellow-700 dark:text-yellow-400 mb-2 flex items-center gap-2`,children:[(0,G.jsx)(Mu,{className:`w-4 h-4`}),e.differences.length,` Difference`,e.differences.length>1?`s`:``,` Found`]}),(0,G.jsxs)(`ul`,{className:`text-sm text-white/80 space-y-1`,children:[e.differences.slice(0,5).map(e=>(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`text-yellow-700 dark:text-yellow-400`,children:e.label}),`: `,e.values.join(` vs `),` `,e.unit||``]},e.field)),e.differences.length>5&&(0,G.jsxs)(`li`,{className:`text-bambu-gray`,children:[`...and `,e.differences.length-5,` more`]})]})]}),e.success_correlation.has_both_outcomes?(0,G.jsxs)(`div`,{className:`p-4 bg-bambu-dark rounded-lg`,children:[(0,G.jsxs)(`h4`,{className:`text-sm font-medium text-white mb-3 flex items-center gap-2`,children:[(0,G.jsx)(as,{className:`w-4 h-4 text-bambu-green`}),`Success/Failure Analysis`]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-4 text-sm mb-3`,children:[(0,G.jsxs)(`span`,{className:`text-bambu-green`,children:[e.success_correlation.successful_count,` successful`]}),(0,G.jsxs)(`span`,{className:`text-red-700 dark:text-red-400`,children:[e.success_correlation.failed_count,` failed`]})]}),e.success_correlation.insights&&e.success_correlation.insights.length>0?(0,G.jsx)(`div`,{className:`space-y-2`,children:e.success_correlation.insights.map(e=>(0,G.jsxs)(`div`,{className:`text-sm p-2 bg-bambu-dark-secondary rounded`,children:[(0,G.jsxs)(`span`,{className:`text-white font-medium`,children:[e.label,`:`]}),` `,(0,G.jsx)(`span`,{className:`text-white/80`,children:e.insight})]},e.field))}):(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:`No clear correlations found between settings and outcomes.`})]}):(0,G.jsx)(`div`,{className:`p-4 bg-bambu-dark rounded-lg text-sm text-bambu-gray`,children:(0,G.jsx)(`p`,{children:e.success_correlation.message||`Need both successful and failed prints for correlation analysis.`})})]})}function BVe(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return`Just now`;if(r<60)return`${r}m ago`;let i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function VVe({upload:e,projects:t,onArchive:n,onDiscard:r,isArchiving:i,isDiscarding:a}){let[o,s]=(0,f.useState)(!1),[c,l]=(0,f.useState)(e.tags||``),[u,d]=(0,f.useState)(e.notes||``),[p,m]=(0,f.useState)(e.project_id),[h,g]=(0,f.useState)(!1);return(0,G.jsx)(Pd,{children:(0,G.jsxs)(Id,{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)(tc,{className:`w-8 h-8 text-bambu-green flex-shrink-0`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-white font-medium`,title:e.filename,children:e.display_name||e.filename}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-bambu-gray`,children:[(0,G.jsx)(`span`,{children:Bd(e.file_size)}),(0,G.jsx)(`span`,{children:`·`}),(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(Ts,{className:`w-3 h-3`}),BVe(e.uploaded_at)]}),e.source_ip&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{children:`·`}),(0,G.jsxs)(`span`,{children:[`from `,e.source_ip]})]})]})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`button`,{onClick:()=>s(!o),className:`p-1 text-bambu-gray hover:text-white transition-colors`,children:o?(0,G.jsx)(us,{className:`w-5 h-5`}):(0,G.jsx)(ss,{className:`w-5 h-5`})}),(0,G.jsx)(Q,{variant:`primary`,size:`sm`,onClick:()=>n(e.id,{tags:c,notes:u,project_id:p||void 0}),disabled:i,children:i?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Oo,{className:`w-4 h-4`}),`Archive`]})}),(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:()=>g(!0),disabled:a,children:a?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(ku,{className:`w-4 h-4 text-red-600 dark:text-red-400`})})]})]}),h&&(0,G.jsx)($d,{title:`Discard Upload`,message:`Are you sure you want to discard "${e.filename}"? This cannot be undone.`,confirmText:`Discard`,variant:`danger`,onConfirm:()=>{r(e.id),g(!1)},onCancel:()=>g(!1)}),o&&(0,G.jsxs)(`div`,{className:`mt-4 pt-4 border-t border-bambu-dark-tertiary space-y-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:`Tags`}),(0,G.jsx)(`input`,{type:`text`,value:c,onChange:e=>l(e.target.value),placeholder:`e.g., functional, prototype, gift`,className:`w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-md px-3 py-2 text-white placeholder-bambu-gray text-sm`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:`Notes`}),(0,G.jsx)(`textarea`,{value:u,onChange:e=>d(e.target.value),placeholder:`Add notes about this print...`,rows:2,className:`w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-md px-3 py-2 text-white placeholder-bambu-gray text-sm resize-none`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:`Project`}),(0,G.jsxs)(`select`,{value:p||``,onChange:e=>m(e.target.value?Number(e.target.value):null),className:`w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-md px-3 py-2 text-white text-sm`,children:[(0,G.jsx)(`option`,{value:``,children:`No project`}),t.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]})]})]})})}function HVe(){let e=no(),{showToast:t}=Hd(),[n,r]=(0,f.useState)(!1),[i,a]=(0,f.useState)(!1),[o,s]=(0,f.useState)(new Set),[c,l]=(0,f.useState)(new Set),{data:u,isLoading:d}=K({queryKey:[`pending-uploads`],queryFn:bd.list,refetchInterval:1e4}),{data:p}=K({queryKey:[`projects`],queryFn:()=>Z.getProjects(),select:e=>Vp([...e].sort((e,t)=>e.name.localeCompare(t.name)))}),m=q({mutationFn:({id:e,data:t})=>bd.archive(e,t),onMutate:({id:e})=>{s(t=>new Set(t).add(e))},onSettled:(e,t,{id:n})=>{s(e=>{let t=new Set(e);return t.delete(n),t})},onSuccess:n=>{e.invalidateQueries({queryKey:[`pending-uploads`]}),e.invalidateQueries({queryKey:[`archives`]}),t(`Archived: ${n.print_name}`)},onError:e=>{t(e.message||`Failed to archive`,`error`)}}),h=q({mutationFn:e=>bd.discard(e),onMutate:e=>{l(t=>new Set(t).add(e))},onSettled:(e,t,n)=>{l(e=>{let t=new Set(e);return t.delete(n),t})},onSuccess:()=>{e.invalidateQueries({queryKey:[`pending-uploads`]}),t(`Upload discarded`)},onError:e=>{t(e.message||`Failed to discard`,`error`)}}),g=q({mutationFn:bd.archiveAll,onSuccess:n=>{e.invalidateQueries({queryKey:[`pending-uploads`]}),e.invalidateQueries({queryKey:[`archives`]}),t(`Archived ${n.archived} files${n.failed>0?`, ${n.failed} failed`:``}`)},onError:e=>{t(e.message||`Failed to archive all`,`error`)}}),_=q({mutationFn:bd.discardAll,onSuccess:n=>{e.invalidateQueries({queryKey:[`pending-uploads`]}),t(`Discarded ${n.discarded} files`)},onError:e=>{t(e.message||`Failed to discard all`,`error`)}});return d?(0,G.jsx)(Pd,{children:(0,G.jsx)(Id,{className:`py-8 flex justify-center`,children:(0,G.jsx)(Y,{className:`w-6 h-6 animate-spin text-bambu-green`})})}):!u||u.length===0?null:(0,G.jsxs)(`div`,{className:`mb-6`,children:[(0,G.jsxs)(Pd,{className:`border-l-4 border-l-yellow-500`,children:[(0,G.jsx)(Fd,{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)(Iu,{className:`w-5 h-5 text-yellow-500`}),(0,G.jsxs)(`h2`,{className:`text-lg font-semibold text-white`,children:[`Pending Uploads (`,u.length,`)`]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Q,{variant:`primary`,size:`sm`,onClick:()=>r(!0),disabled:g.isPending,children:g.isPending?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Oo,{className:`w-4 h-4`}),`Archive All`]})}),(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:()=>a(!0),disabled:_.isPending,children:_.isPending?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ku,{className:`w-4 h-4`}),`Discard All`]})})]})]})}),(0,G.jsxs)(Id,{children:[(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mb-4`,children:`These files were uploaded via the virtual printer. Review and archive them to add to your collection.`}),(0,G.jsx)(`div`,{className:`space-y-3`,children:u.map(e=>(0,G.jsx)(VVe,{upload:e,projects:p||[],onArchive:(e,t)=>m.mutate({id:e,data:t}),onDiscard:e=>h.mutate(e),isArchiving:o.has(e.id),isDiscarding:c.has(e.id)},e.id))})]})]}),n&&(0,G.jsx)($d,{title:`Archive All Uploads`,message:`Are you sure you want to archive all ${u.length} pending uploads?`,confirmText:`Archive All`,onConfirm:()=>{g.mutate(),r(!1)},onCancel:()=>r(!1)}),i&&(0,G.jsx)($d,{title:`Discard All Uploads`,message:`Are you sure you want to discard all ${u.length} pending uploads? This cannot be undone.`,confirmText:`Discard All`,variant:`danger`,onConfirm:()=>{_.mutate(),a(!1)},onCancel:()=>a(!1)})]})}function UVe({onClose:e}){let t=no(),{showToast:n}=Hd(),[r,i]=(0,f.useState)(``),[a,o]=(0,f.useState)(null),[s,c]=(0,f.useState)(``),[l,u]=(0,f.useState)(null),[d,p]=(0,f.useState)(`count`);(0,f.useEffect)(()=>{let t=t=>{t.key===`Escape`&&(a?o(null):l?u(null):e())};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,a,l]);let{data:m,isLoading:h}=K({queryKey:[`tags`],queryFn:Z.getTags}),g=q({mutationFn:({oldName:e,newName:t})=>Z.renameTag(e,t),onSuccess:(e,{oldName:r,newName:i})=>{t.invalidateQueries({queryKey:[`tags`]}),t.invalidateQueries({queryKey:[`archives`]}),n(`Renamed "${r}" to "${i}" in ${e.affected} archive${e.affected===1?``:`s`}`),o(null)},onError:e=>{n(e.message||`Failed to rename tag`,`error`)}}),_=q({mutationFn:e=>Z.deleteTag(e),onSuccess:(e,r)=>{t.invalidateQueries({queryKey:[`tags`]}),t.invalidateQueries({queryKey:[`archives`]}),n(`Deleted "${r}" from ${e.affected} archive${e.affected===1?``:`s`}`),u(null)},onError:e=>{n(e.message||`Failed to delete tag`,`error`)}}),v=e=>{o(e.name),c(e.name),u(null)},y=()=>{o(null),c(``)},b=()=>{if(!a||!s.trim())return;let e=s.trim();if(e===a){y();return}g.mutate({oldName:a,newName:e})},x=e=>{e.key===`Enter`?(e.preventDefault(),b()):e.key===`Escape`&&(e.preventDefault(),y())},S=e=>{u(e),o(null)},C=()=>{l&&_.mutate(l)},w=m?.filter(e=>e.name.toLowerCase().includes(r.toLowerCase())).sort((e,t)=>d===`count`&&t.count-e.count||e.name.localeCompare(t.name)),T=m?.reduce((e,t)=>e+t.count,0)||0;return(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4`,children:(0,G.jsx)(Pd,{className:`w-full max-w-lg max-h-[80vh] flex flex-col`,children:(0,G.jsxs)(Id,{className:`p-0 flex flex-col min-h-0`,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)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(yu,{className:`w-5 h-5 text-bambu-green`}),(0,G.jsx)(`h2`,{className:`text-xl font-semibold text-white`,children:`Manage Tags`})]}),(0,G.jsx)(`button`,{onClick:e,className:`text-bambu-gray hover:text-white transition-colors`,children:(0,G.jsx)(Zu,{className:`w-5 h-5`})})]}),(0,G.jsxs)(`div`,{className:`p-4 border-b border-bambu-dark-tertiary flex-shrink-0`,children:[(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsxs)(`div`,{className:`relative flex-1`,children:[(0,G.jsx)(Gl,{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:`Search tags...`,className:`w-full pl-9 pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:border-bambu-green focus:outline-none`,value:r,onChange:e=>i(e.target.value)})]}),(0,G.jsxs)(`select`,{className:`px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:border-bambu-green focus:outline-none`,value:d,onChange:e=>p(e.target.value),children:[(0,G.jsx)(`option`,{value:`count`,children:`Sort by Count`}),(0,G.jsx)(`option`,{value:`name`,children:`Sort by Name`})]})]}),m&&(0,G.jsxs)(`p`,{className:`text-xs text-bambu-gray mt-2`,children:[m.length,` tag`,m.length===1?``:`s`,` across `,T,` usage`,T===1?``:`s`]})]}),(0,G.jsx)(`div`,{className:`flex-1 overflow-y-auto min-h-0 p-4`,children:h?(0,G.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,G.jsx)(Y,{className:`w-6 h-6 animate-spin text-bambu-gray`})}):w?.length?(0,G.jsx)(`div`,{className:`space-y-2`,children:w.map(e=>(0,G.jsx)(`div`,{className:`flex items-center gap-2 p-2 rounded-lg bg-bambu-dark hover:bg-bambu-dark-tertiary transition-colors group`,children:a===e.name?(0,G.jsxs)(`div`,{className:`flex-1 flex items-center gap-2`,children:[(0,G.jsx)(`input`,{type:`text`,className:`flex-1 px-2 py-1 bg-bambu-dark-tertiary border border-bambu-green rounded text-white text-sm focus:outline-none`,value:s,onChange:e=>c(e.target.value),onKeyDown:x,autoFocus:!0}),(0,G.jsx)(Q,{size:`sm`,variant:`primary`,onClick:b,disabled:!s.trim()||g.isPending,className:`p-1.5`,children:g.isPending?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(as,{className:`w-4 h-4`})}),(0,G.jsx)(Q,{size:`sm`,variant:`ghost`,onClick:y,className:`p-1.5`,children:(0,G.jsx)(Zu,{className:`w-4 h-4`})})]}):l===e.name?(0,G.jsxs)(`div`,{className:`flex-1 flex items-center gap-2`,children:[(0,G.jsx)(Mu,{className:`w-4 h-4 text-yellow-600 dark:text-yellow-400 flex-shrink-0`}),(0,G.jsxs)(`span`,{className:`text-sm text-bambu-gray-light flex-1`,children:[`Delete "`,e.name,`" from `,e.count,` archive`,e.count===1?``:`s`,`?`]}),(0,G.jsx)(Q,{size:`sm`,variant:`danger`,onClick:C,disabled:_.isPending,className:`p-1.5`,children:_.isPending?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(ku,{className:`w-4 h-4`})}),(0,G.jsx)(Q,{size:`sm`,variant:`ghost`,onClick:()=>u(null),className:`p-1.5`,children:(0,G.jsx)(Zu,{className:`w-4 h-4`})})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(yu,{className:`w-4 h-4 text-bambu-gray flex-shrink-0`}),(0,G.jsx)(`span`,{className:`text-white flex-1 truncate`,children:e.name}),(0,G.jsx)(`span`,{className:`px-2 py-0.5 rounded-full bg-bambu-dark-tertiary text-bambu-gray text-xs`,children:e.count}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1 can-hover:opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition-opacity`,children:[(0,G.jsx)(`button`,{onClick:()=>v(e),className:`p-1.5 rounded hover:bg-bambu-dark text-bambu-gray hover:text-white transition-colors`,title:`Rename tag`,children:(0,G.jsx)(Cl,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{onClick:()=>S(e.name),className:`p-1.5 rounded hover:bg-bambu-dark text-bambu-gray hover:text-red-700 dark:hover:text-red-400 transition-colors`,title:`Delete tag`,children:(0,G.jsx)(ku,{className:`w-4 h-4`})})]})]})},e.name))}):(0,G.jsx)(`div`,{className:`text-center py-8 text-bambu-gray`,children:r?`No tags match your search`:`No tags found`})}),(0,G.jsx)(`div`,{className:`flex gap-3 p-4 border-t border-bambu-dark-tertiary flex-shrink-0`,children:(0,G.jsx)(Q,{variant:`secondary`,onClick:e,className:`flex-1`,children:`Close`})})]})})})}var H2=`bambuddy-printlog-columns`,U2={date:`archives.log.date`,print_name:`archives.log.printName`,printer:`archives.log.printer`,user:`archives.log.user`,status:`archives.log.status`,duration:`archives.log.duration`,completed_at:`archives.log.completedAt`,filament:`archives.log.filament`,filament_used:`archives.log.filamentUsed`,cost:`archives.log.cost`,energy:`archives.log.energy`,energy_cost:`archives.log.energyCost`},W2=[{id:`date`,visible:!0},{id:`print_name`,visible:!0},{id:`printer`,visible:!0},{id:`user`,visible:!0},{id:`status`,visible:!0},{id:`duration`,visible:!0},{id:`filament`,visible:!0},{id:`filament_used`,visible:!0},{id:`completed_at`,visible:!1},{id:`cost`,visible:!1},{id:`energy`,visible:!1},{id:`energy_cost`,visible:!1}];function WVe(){try{let e=localStorage.getItem(H2);if(e){let t=JSON.parse(e),n=new Set(Object.keys(U2)),r=new Set(t.map(e=>e.id)),i=t.filter(e=>n.has(e.id)).map(e=>({id:e.id,visible:!!e.visible})),a=W2.filter(e=>!r.has(e.id));if(i.length>0)return[...i,...a]}}catch{}return W2.map(e=>({...e}))}var G2=`bambuddy-printlog-sort`,K2=new Set(Object.keys(U2)),GVe={column:`date`,direction:`desc`};function KVe(){try{let e=localStorage.getItem(G2);if(e){let t=JSON.parse(e);if(K2.has(t?.column)&&(t.direction===`asc`||t.direction===`desc`))return t}}catch{}return{...GVe}}function qVe(e){try{localStorage.setItem(G2,JSON.stringify(e))}catch{}}function JVe(e){try{localStorage.setItem(H2,JSON.stringify(e.map(e=>({id:e.id,visible:e.visible}))))}catch{}}function q2(e){let t=e.filename;if(t){let e=t.toLowerCase();if(e.endsWith(`.gcode`)||e.includes(`.gcode.`))return!0}return!!(e.total_layers||e.print_time_seconds)}async function J2(e,t,n,r){try{if(n===`source`){let{token:n}=await Z.createSourceSlicerToken(e),i=Z.getSourceSlicerDownloadUrl(e,n,t);ZW(`${window.location.origin}${i}`,r)}else{let{token:n}=await Z.createArchiveSlicerToken(e),i=Z.getArchiveSlicerDownloadUrl(e,n,t);ZW(`${window.location.origin}${i}`,r)}}catch{let i=n===`source`?Z.getSource3mfForSlicer(e,t):Z.getArchiveForSlicer(e,t);ZW(`${window.location.origin}${i}`,r)}}function YVe({archive:e,printerName:t,printerMap:n,isSelected:r,onSelect:i,selectionMode:a,projects:o,isHighlighted:s,timeFormat:c=`system`,preferredSlicer:l=`bambu_studio`,useSlicerApi:u=!1,currency:d,t:p,onNavigateToArchive:m}){s&&console.log(`ArchiveCard isHighlighted=true for archive:`,e.id);let h=no(),{showToast:g}=Hd(),{hasPermission:_,canModify:v}=Od(),y=$n(),b=(0,f.useMemo)(()=>{let t=e.extra_data?.slicer_ams_mapping;if(!(!t||!Array.isArray(t.mapping)||t.printer_id==null))return n.get(t.printer_id)},[e.extra_data,n]),[x,S]=(0,f.useState)(!1),[C,w]=(0,f.useState)(!1),[T,E]=(0,f.useState)(!1),[D,O]=(0,f.useState)(!1),[k,A]=(0,f.useState)(!1),[j,M]=(0,f.useState)(!1),N=K({queryKey:[`archive`,e.id,`delete-impact`],queryFn:()=>Z.getArchiveDeleteImpact(e.id),enabled:k,staleTime:0}),[P,F]=(0,f.useState)(!1),[I,L]=(0,f.useState)(!1),[R,z]=(0,f.useState)(!1),[B,V]=(0,f.useState)(!1),[ee,te]=(0,f.useState)(!1),[ne,re]=(0,f.useState)([]),[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)(!1),[pe,me]=(0,f.useState)(!1),[he,ge]=(0,f.useState)(null),[_e,ve]=(0,f.useState)(null),[ye,be]=(0,f.useState)(!1),[xe,Se]=(0,f.useState)(null),Ce=(0,f.useRef)(null),we=(0,f.useRef)(null),Te=(0,f.useRef)(null),{data:Ee}=K({queryKey:[`archive-plates`,e.id],queryFn:()=>Z.getArchivePlates(e.id),enabled:ye,staleTime:300*1e3}),De=e.duplicate_sequence??0,Oe=Hp(e.user_verdict_source),ke=e.original_archive_id??null,Ae=Ee?.plates??[],je=Ee?.is_multi_plate??!1,Me=_e??0,Ne=async()=>{try{let t=await Z.getArchivePlates(e.id);if(t.has_gcode===!1){g(p(`archives.platePicker.noGcode`),`info`);return}if(t.is_multi_plate&&t.plates.length>1){Se(t.plates);return}}catch{}y(`/gcode-viewer?archive=${e.id}`)},Pe=q({mutationFn:()=>Z.deleteArchiveTimelapse(e.id),onSuccess:()=>{h.invalidateQueries({queryKey:[`archives`]}),g(p(`archives.toast.timelapseRemoved`))},onError:e=>{g(e.message||p(`archives.toast.failedRemoveTimelapse`),`error`)}}),Fe=q({mutationFn:t=>Z.uploadArchiveTimelapse(e.id,t),onSuccess:e=>{h.invalidateQueries({queryKey:[`archives`]}),g(p(`archives.toast.timelapseUploaded`,{filename:e.filename}))},onError:e=>{g(e.message||p(`archives.toast.failedUploadTimelapse`),`error`)}}),Ie=q({mutationFn:t=>Z.uploadSource3mf(e.id,t),onSuccess:e=>{h.invalidateQueries({queryKey:[`archives`]}),g(p(`archives.toast.source3mfAttached`,{filename:e.filename}))},onError:e=>{g(e.message||p(`archives.toast.failedUploadSource3mf`),`error`)}}),Le=q({mutationFn:()=>Z.deleteSource3mf(e.id),onSuccess:()=>{h.invalidateQueries({queryKey:[`archives`]}),g(p(`archives.toast.source3mfRemoved`))},onError:e=>{g(e.message||p(`archives.toast.failedRemoveSource3mf`),`error`)}}),Re=q({mutationFn:t=>Z.uploadF3d(e.id,t),onSuccess:e=>{h.invalidateQueries({queryKey:[`archives`]}),g(p(`archives.toast.f3dAttached`,{filename:e.filename}))},onError:e=>{g(e.message||p(`archives.toast.failedUploadF3d`),`error`)}}),ze=q({mutationFn:()=>Z.deleteF3d(e.id),onSuccess:()=>{h.invalidateQueries({queryKey:[`archives`]}),g(p(`archives.toast.f3dRemoved`))},onError:e=>{g(e.message||p(`archives.toast.failedRemoveF3d`),`error`)}}),Be=q({mutationFn:()=>Z.scanArchiveTimelapse(e.id),onSuccess:e=>{e.status===`attached`?(h.invalidateQueries({queryKey:[`archives`]}),g(p(`archives.toast.timelapseAttached`,{filename:e.filename}))):e.status===`exists`?g(p(`archives.toast.timelapseAlreadyAttached`)):e.status===`not_found`&&e.available_files&&e.available_files.length>0?(re(e.available_files),te(!0)):g(e.message||p(`archives.toast.noMatchingTimelapse`),`warning`)},onError:e=>{g(e.message||p(`archives.toast.failedScanTimelapse`),`error`)}}),Ve=q({mutationFn:t=>Z.selectArchiveTimelapse(e.id,t),onSuccess:e=>{h.invalidateQueries({queryKey:[`archives`]}),g(p(`archives.toast.timelapseAttached`,{filename:e.filename})),te(!1),re([])},onError:e=>{g(e.message||p(`archives.toast.failedAttachTimelapse`),`error`)}}),He=q({mutationFn:t=>Z.deleteArchive(e.id,t),onSuccess:()=>{Bp(h),g(p(`archives.toast.archiveDeleted`))},onError:()=>{g(p(`archives.toast.failedDeleteArchive`),`error`)}}),Ue=q({mutationFn:()=>Z.toggleFavorite(e.id),onSuccess:e=>{h.invalidateQueries({queryKey:[`archives`]}),g(e.is_favorite?p(`archives.toast.addedToFavorites`):p(`archives.toast.removedFromFavorites`))}}),{data:We}=K({queryKey:[`archive-folders`,e.id],queryFn:()=>Z.getLibraryFoldersByArchive(e.id)}),Ge=q({mutationFn:t=>Z.updateArchive(e.id,{project_id:t}),onSuccess:()=>{Bp(h),g(p(`archives.toast.projectUpdated`))},onError:()=>{g(p(`archives.toast.failedUpdateProject`),`error`)}}),Ke=e=>{e.preventDefault(),ge({x:e.clientX,y:e.clientY})},qe=[...q2(e)?[{label:p(`common.print`),icon:(0,G.jsx)(jl,{className:`w-4 h-4`}),onClick:()=>S(!0),disabled:!e.file_path||!_(`queue:create`)||!v(`archives`,`reprint`,e.created_by_id),title:e.file_path?_(`queue:create`)?v(`archives`,`reprint`,e.created_by_id)?void 0:p(`archives.permission.noReprint`):p(`archives.permission.noAddToQueue`):p(`archives.card.noFileForReprint`)},{label:p(`archives.menu.openInBambuStudio`),icon:(0,G.jsx)(Zs,{className:`w-4 h-4`}),onClick:()=>{let t=e.print_name||e.filename||`model`;J2(e.id,t,`file`,l)},disabled:!e.file_path,title:e.file_path?void 0:p(`archives.card.noFileForReprint`)}]:[{label:p(`archives.menu.slice`),icon:u?(0,G.jsx)(Ms,{className:`w-4 h-4`}):(0,G.jsx)(Zs,{className:`w-4 h-4`}),onClick:()=>{if(u)E(!0);else{let t=e.print_name||e.filename||`model`;J2(e.id,t,`file`,l)}}},...u?[{label:p(`library.runWithPipeline.actionLabel`),icon:(0,G.jsx)(El,{className:`w-4 h-4`}),onClick:()=>O(!0),disabled:!_(`pipelines:run`),title:_(`pipelines:run`)?void 0:p(`library.runWithPipeline.noPermission`)}]:[]],{label:e.external_url?p(`archives.menu.externalLink`):p(`archives.menu.viewOnMakerWorld`),icon:(0,G.jsx)(wc,{className:`w-4 h-4`}),onClick:()=>{let t=e.external_url||e.makerworld_url;t&&window.open(t,`_blank`)},disabled:!e.external_url&&!e.makerworld_url},...e.status===`completed`?[{label:p(`archives.menu.confirmOutcome`),icon:e.user_verdict===`reject`?(0,G.jsx)(Eu,{className:`w-4 h-4`}):(0,G.jsx)(Du,{className:`w-4 h-4`}),onClick:()=>w(!0),disabled:!v(`archives`,`update`,e.created_by_id),title:v(`archives`,`update`,e.created_by_id)?void 0:p(`archives.permission.noUpdateArchives`)}]:[],{label:``,divider:!0,onClick:()=>{}},{label:p(`archives.menu.preview3d`),icon:(0,G.jsx)(Go,{className:`w-4 h-4`}),onClick:()=>{Ne()}},{label:p(`archives.menu.viewTimelapse`),icon:(0,G.jsx)(cc,{className:`w-4 h-4`}),onClick:()=>z(!0),disabled:!e.timelapse_path},{label:p(`archives.media.download`),icon:(0,G.jsx)(ic,{className:`w-4 h-4`}),onClick:()=>V(!0),disabled:!e.timelapse_path&&(!_(`printers:files`)||!e.printer_id||!e.started_at),title:!e.timelapse_path&&!_(`printers:files`)?p(`printers.permission.noFiles`):void 0},{label:p(`archives.menu.scanForTimelapse`),icon:(0,G.jsx)(Ul,{className:`w-4 h-4`}),onClick:()=>Be.mutate(),disabled:!e.printer_id||!!e.timelapse_path||Be.isPending||!v(`archives`,`update`,e.created_by_id),title:v(`archives`,`update`,e.created_by_id)?void 0:p(`archives.permission.noUpdateArchives`)},{label:p(`archives.menu.uploadTimelapse`),icon:(0,G.jsx)(Iu,{className:`w-4 h-4`}),onClick:()=>Te.current?.click(),disabled:!!e.timelapse_path||!v(`archives`,`update`,e.created_by_id),title:v(`archives`,`update`,e.created_by_id)?void 0:p(`archives.permission.noUpdateArchives`)},...e.timelapse_path?[{label:p(`archives.menu.removeTimelapse`),icon:(0,G.jsx)(ku,{className:`w-4 h-4`}),onClick:()=>me(!0),danger:!0,disabled:!v(`archives`,`update`,e.created_by_id),title:v(`archives`,`update`,e.created_by_id)?void 0:p(`archives.permission.noUpdateArchives`)}]:[],{label:``,divider:!0,onClick:()=>{}},{label:e.source_3mf_path?p(`archives.menu.downloadSource3mf`):p(`archives.menu.uploadSource3mf`),icon:(0,G.jsx)(nc,{className:`w-4 h-4`}),onClick:()=>{e.source_3mf_path?Z.downloadSource3mf(e.id).catch(e=>{console.error(`Source 3MF download failed:`,e)}):Ce.current?.click()},disabled:!e.source_3mf_path&&!v(`archives`,`update`,e.created_by_id),title:!e.source_3mf_path&&!v(`archives`,`update`,e.created_by_id)?p(`archives.permission.noUploadFiles`):void 0},...e.source_3mf_path?[{label:p(`archives.menu.replaceSource3mf`),icon:(0,G.jsx)(Iu,{className:`w-4 h-4`}),onClick:()=>Ce.current?.click(),disabled:!v(`archives`,`update`,e.created_by_id),title:v(`archives`,`update`,e.created_by_id)?void 0:p(`archives.permission.noUpdateArchives`)},{label:p(`archives.menu.removeSource3mf`),icon:(0,G.jsx)(ku,{className:`w-4 h-4`}),onClick:()=>ue(!0),danger:!0,disabled:!v(`archives`,`update`,e.created_by_id),title:v(`archives`,`update`,e.created_by_id)?void 0:p(`archives.permission.noUpdateArchives`)}]:[],{label:e.f3d_path?p(`archives.menu.replaceF3d`):p(`archives.menu.uploadF3d`),icon:(0,G.jsx)(Go,{className:`w-4 h-4`}),onClick:()=>we.current?.click(),disabled:!v(`archives`,`update`,e.created_by_id),title:v(`archives`,`update`,e.created_by_id)?void 0:p(`archives.permission.noUpdateArchives`)},...e.f3d_path?[{label:p(`archives.menu.downloadF3d`),icon:(0,G.jsx)(Ws,{className:`w-4 h-4`}),onClick:()=>{Z.downloadF3d(e.id).catch(e=>{console.error(`F3D download failed:`,e)})}},{label:p(`archives.menu.removeF3d`),icon:(0,G.jsx)(ku,{className:`w-4 h-4`}),onClick:()=>fe(!0),danger:!0,disabled:!v(`archives`,`update`,e.created_by_id),title:v(`archives`,`update`,e.created_by_id)?void 0:p(`archives.permission.noUpdateArchives`)}]:[],{label:``,divider:!0,onClick:()=>{}},{label:p(`archives.menu.download`),icon:(0,G.jsx)(Ws,{className:`w-4 h-4`}),onClick:()=>{Z.downloadArchive(e.id,`${e.print_name||e.filename}.3mf`).catch(e=>{console.error(`Archive download failed:`,e)})},disabled:!_(`archives:read`),title:_(`archives:read`)?void 0:p(`archives.permission.noDownload`)},{label:p(`archives.menu.copyDownloadLink`),icon:(0,G.jsx)(Fs,{className:`w-4 h-4`}),onClick:()=>{let t=`${window.location.origin}${Z.getArchiveDownload(e.id)}`;navigator.clipboard.writeText(t).then(()=>{g(p(`archives.toast.linkCopied`))}).catch(()=>{g(p(`archives.toast.failedCopyLink`),`error`)})},disabled:!_(`archives:read`),title:_(`archives:read`)?void 0:p(`archives.permission.noCopyLink`)},{label:p(`archives.menu.qrCode`),icon:(0,G.jsx)(Ml,{className:`w-4 h-4`}),onClick:()=>ae(!0)},{label:e.photos?.length?p(`archives.menu.viewPhotosCount`,{count:e.photos.length}):p(`archives.menu.viewPhotos`),icon:(0,G.jsx)(es,{className:`w-4 h-4`}),onClick:()=>se(!0),disabled:!e.photos?.length},{label:p(`archives.menu.projectPage`),icon:(0,G.jsx)(oc,{className:`w-4 h-4`}),onClick:()=>ce(!0)},{label:``,divider:!0,onClick:()=>{}},{label:e.is_favorite?p(`archives.menu.removeFromFavorites`):p(`archives.menu.addToFavorites`),icon:(0,G.jsx)(mu,{className:`w-4 h-4 ${e.is_favorite?`fill-yellow-400 text-yellow-400`:v(`archives`,`update`,e.created_by_id)?`group-hover:text-yellow-400`:``}`}),onClick:()=>Ue.mutate(),disabled:!v(`archives`,`update`,e.created_by_id),title:v(`archives`,`update`,e.created_by_id)?void 0:p(`archives.permission.noUpdateArchives`)},{label:p(`archives.menu.edit`),icon:(0,G.jsx)(Cl,{className:`w-4 h-4`}),onClick:()=>F(!0),disabled:!v(`archives`,`update`,e.created_by_id),title:v(`archives`,`update`,e.created_by_id)?void 0:p(`archives.permission.noUpdateArchives`)},{label:p(`archives.menu.printLog`),icon:(0,G.jsx)(Nc,{className:`w-4 h-4`}),onClick:()=>L(!0)},...e.project_id&&e.project_name?[{label:p(`archives.menu.goToProject`,{name:e.project_name}),icon:(0,G.jsx)(dc,{className:`w-4 h-4 text-bambu-green`}),onClick:()=>window.location.href=`/projects`}]:[],{label:p(`archives.menu.addToProject`),icon:(0,G.jsx)(dc,{className:`w-4 h-4`}),onClick:()=>{},disabled:!v(`archives`,`update`,e.created_by_id),title:v(`archives`,`update`,e.created_by_id)?void 0:p(`archives.permission.noUpdateArchives`),submenuSearchPlaceholder:Vp(o??[],e.project_id).length>5?p(`archives.menu.searchProjects`):void 0,submenu:(()=>{let t=[];if(e.project_id&&t.push({label:p(`archives.menu.removeFromProject`),icon:(0,G.jsx)(Zu,{className:`w-4 h-4`}),onClick:()=>Ge.mutate(null),disabled:!v(`archives`,`update`,e.created_by_id)}),!o)t.push({label:p(`archives.menu.loading`),icon:(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),onClick:()=>{},disabled:!0});else{let n=Vp(o,e.project_id).sort((e,t)=>e.name.localeCompare(t.name));n.length===0?t.push({label:p(`archives.menu.noProjectsAvailable`),icon:(0,G.jsx)(dc,{className:`w-4 h-4 opacity-50`}),onClick:()=>{},disabled:!0}):n.forEach(n=>{t.push({label:n.name,icon:(0,G.jsx)(`div`,{className:`w-3 h-3 rounded-full flex-shrink-0`,style:{backgroundColor:n.color||`#888`}}),onClick:()=>Ge.mutate(n.id),disabled:e.project_id===n.id||!v(`archives`,`update`,e.created_by_id)})})}return t})()},{label:p(r?`archives.menu.deselect`:`archives.menu.select`),icon:r?(0,G.jsx)(du,{className:`w-4 h-4`}):(0,G.jsx)(pu,{className:`w-4 h-4`}),onClick:()=>i(e.id)},{label:``,divider:!0,onClick:()=>{}},{label:p(`archives.menu.delete`),icon:(0,G.jsx)(ku,{className:`w-4 h-4`}),onClick:()=>A(!0),danger:!0,disabled:!v(`archives`,`delete`,e.created_by_id),title:v(`archives`,`delete`,e.created_by_id)?void 0:p(`archives.permission.noDelete`)}];return(0,G.jsxs)(Pd,{"data-archive-id":e.id,className:`relative flex flex-col group ${r?`ring-2 ring-bambu-green`:``} ${a?`cursor-pointer`:``}`,style:s?{outline:`4px solid #facc15`,outlineOffset:`2px`}:void 0,onContextMenu:Ke,onClick:a?()=>i(e.id):void 0,children:[a&&(0,G.jsx)(`button`,{className:`absolute top-2 left-2 z-10 p-1 rounded bg-black/50 hover:bg-black/70 transition-colors`,onClick:t=>{t.stopPropagation(),i(e.id)},children:r?(0,G.jsx)(du,{className:`w-5 h-5 text-bambu-green`}):(0,G.jsx)(pu,{className:`w-5 h-5 text-white`})}),(0,G.jsxs)(`div`,{className:`aspect-video bg-bambu-dark relative flex-shrink-0 overflow-hidden rounded-t-xl`,onMouseEnter:()=>be(!0),onMouseLeave:()=>be(!1),children:[e.thumbnail_path?(0,G.jsx)(`img`,{src:_e!==null&&Ae.length>0?Z.getArchivePlateThumbnail(e.id,Ae[Me]?.index??0):Z.getArchiveThumbnail(e.id),alt:e.print_name||e.filename,className:`w-full h-full object-cover`}):(0,G.jsx)(`div`,{className:`w-full h-full flex items-center justify-center`,children:(0,G.jsx)(Ic,{className:`w-12 h-12 text-bambu-dark-tertiary`})}),je&&Ae.length>1&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`button`,{className:`absolute left-1 top-1/2 -translate-y-1/2 p-1 rounded-full bg-black/60 hover:bg-black/80 transition-all can-hover:opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`,onClick:e=>{e.stopPropagation(),ve(e=>{let t=e??0;return t>0?t-1:Ae.length-1})},title:p(`archives.card.previousPlate`),children:(0,G.jsx)(ls,{className:`w-4 h-4 text-white`})}),(0,G.jsx)(`button`,{className:`absolute right-1 top-1/2 -translate-y-1/2 p-1 rounded-full bg-black/60 hover:bg-black/80 transition-all can-hover:opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`,onClick:e=>{e.stopPropagation(),ve(e=>{let t=e??0;return t(0,G.jsx)(`button`,{className:`w-2 h-2 rounded-full transition-colors ${t===Me?`bg-bambu-green`:`bg-white/50 hover:bg-white/80`}`,onClick:e=>{e.stopPropagation(),ve(t)},title:e.name||p(`archives.card.plateNumber`,{index:e.index})},e.index))})]}),(0,G.jsx)(`button`,{className:`absolute top-2 left-2 p-1.5 rounded bg-black/50 hover:bg-black/70 transition-all can-hover:opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 ${a?`left-10`:``}`,onClick:e=>{e.stopPropagation();let t=e.currentTarget.getBoundingClientRect();ge({x:t.left,y:t.bottom+4})},title:p(`archives.card.moreOptions`),children:(0,G.jsx)(qs,{className:`w-5 h-5 text-white`})}),(0,G.jsx)(`button`,{className:`absolute top-2 right-2 p-1 rounded transition-colors ${v(`archives`,`update`,e.created_by_id)?`bg-black/50 hover:bg-black/70`:`bg-black/30 cursor-not-allowed`}`,onClick:t=>{t.stopPropagation(),v(`archives`,`update`,e.created_by_id)&&Ue.mutate()},disabled:!v(`archives`,`update`,e.created_by_id),title:v(`archives`,`update`,e.created_by_id)?e.is_favorite?p(`archives.card.removeFromFavorites`):p(`archives.card.addToFavorites`):p(`archives.permission.noUpdateArchives`),children:(0,G.jsx)(mu,{className:`w-5 h-5 ${e.is_favorite?`text-yellow-400 fill-yellow-400`:`text-white`} ${v(`archives`,`update`,e.created_by_id)?``:`opacity-50`}`})}),(e.status===`failed`||e.status===`aborted`)&&(0,G.jsx)(`div`,{className:`absolute top-2 left-12 px-2 py-1 rounded text-xs bg-status-error/80 text-white`,children:e.status===`aborted`?p(`archives.card.cancelled`):p(`archives.card.failed`)}),e.status===`completed`&&e.confirm_requested&&e.user_verdict==null&&(0,G.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),w(!0)},disabled:!v(`archives`,`update`,e.created_by_id),className:`absolute top-2 left-12 px-2 py-1 rounded text-xs bg-amber-500/90 enabled:hover:bg-amber-500 text-black flex items-center gap-1 transition-colors enabled:cursor-pointer`,title:v(`archives`,`update`,e.created_by_id)?p(`archives.card.confirmPendingTitle`):p(`archives.permission.noUpdateArchives`),children:[(0,G.jsx)(Du,{className:`w-3 h-3`}),p(`archives.card.confirmPending`)]}),e.status===`completed`&&e.user_verdict===`reject`&&(0,G.jsxs)(`div`,{className:`absolute top-2 left-12 px-2 py-1 rounded text-xs bg-status-error/80 text-white flex items-center gap-1`,title:`${p(`archives.card.rejectedTitle`)}${Oe?` — ${p(Oe)}`:``}`,children:[(0,G.jsx)(Eu,{className:`w-3 h-3`}),p(`archives.card.rejected`)]}),e.status===`completed`&&e.user_verdict===`good`&&(0,G.jsxs)(`div`,{className:`absolute top-2 left-12 px-2 py-1 rounded text-xs bg-bambu-green/80 text-white flex items-center gap-1`,title:`${p(`archives.card.confirmedGoodTitle`)}${Oe?` — ${p(Oe)}`:``}`,children:[(0,G.jsx)(Du,{className:`w-3 h-3`}),p(`archives.card.confirmedGood`)]}),e.duplicate_count>0&&De>0&&ke&&(0,G.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),m?.(ke)},className:`absolute top-2 right-12 px-2 py-1 rounded text-xs bg-purple-500/80 hover:bg-purple-600/90 text-white flex items-center gap-1 transition-colors cursor-pointer`,title:p(`archives.viewOriginalPrint`,{id:ke}),children:[(0,G.jsx)(Fs,{className:`w-3 h-3`}),`#`,De]}),e.duplicate_count>0&&De===0&&(0,G.jsxs)(`span`,{className:`absolute top-2 right-12 px-2 py-1 rounded text-xs bg-purple-500/80 text-white flex items-center gap-1`,title:`${e.duplicate_count} reprint${e.duplicate_count===1?``:`s`}`,children:[(0,G.jsx)(xc,{className:`w-3 h-3`}),`+`,e.duplicate_count]}),e.source_3mf_path&&(0,G.jsx)(`button`,{className:`absolute bottom-2 left-2 p-1.5 rounded bg-black/60 hover:bg-black/80 transition-colors`,onClick:t=>{t.stopPropagation();let n=(e.print_name||e.filename||`source`).replace(/\.gcode\.3mf$/i,``)+`_source`;J2(e.id,n,`source`,l)},title:p(`archives.card.openSource3mf`),children:(0,G.jsx)(nc,{className:`w-4 h-4 text-orange-400`})}),e.f3d_path&&(0,G.jsx)(`button`,{className:`absolute bottom-2 ${e.source_3mf_path?`left-12`:`left-2`} p-1.5 rounded bg-black/60 hover:bg-black/80 transition-colors`,onClick:t=>{t.stopPropagation(),Z.downloadF3d(e.id).catch(e=>{console.error(`F3D download failed:`,e)})},title:p(`archives.card.downloadF3d`),children:(0,G.jsx)(Go,{className:`w-4 h-4 text-cyan-400`})}),(0,G.jsx)(`button`,{className:`absolute bottom-2 right-2 p-1.5 rounded bg-black/60 hover:bg-black/80 transition-colors`,onClick:e=>{e.stopPropagation(),Ne()},title:p(`archives.card.preview3d`),children:(0,G.jsx)(Hc,{className:`w-4 h-4 text-white`})}),e.timelapse_path&&(0,G.jsx)(`button`,{className:`absolute bottom-2 right-12 p-1.5 rounded bg-black/60 hover:bg-black/80 transition-colors`,onClick:e=>{e.stopPropagation(),z(!0)},title:p(`archives.card.viewTimelapse`),children:(0,G.jsx)(cc,{className:`w-4 h-4 text-bambu-green`})}),e.photos&&e.photos.length>0&&(0,G.jsxs)(`button`,{className:`absolute bottom-2 ${e.timelapse_path?`right-[5.5rem]`:`right-12`} p-1.5 rounded bg-black/60 hover:bg-black/80 transition-colors`,onClick:e=>{e.stopPropagation(),se(!0)},title:e.photos.length===1?p(`archives.card.viewPhoto`):p(`archives.card.viewPhotos`,{count:e.photos.length}),children:[(0,G.jsx)(es,{className:`w-4 h-4 text-blue-400`}),e.photos.length>1&&(0,G.jsx)(`span`,{className:`absolute -top-1 -right-1 w-4 h-4 bg-blue-500 rounded-full text-[10px] text-white flex items-center justify-center`,children:e.photos.length})]}),We&&We.length>0&&(0,G.jsx)(Ci,{to:`/files?folder=${We[0].id}`,className:`absolute bottom-2 p-1.5 rounded bg-black/60 hover:bg-black/80 transition-colors`,onClick:e=>e.stopPropagation(),title:p(`archives.card.openFolder`,{name:We[0].name}),style:{left:e.source_3mf_path?e.f3d_path?`5.5rem`:`3rem`:e.f3d_path?`3rem`:`0.5rem`},children:(0,G.jsx)(fc,{className:`w-4 h-4 text-yellow-400`})})]}),(0,G.jsxs)(Id,{className:`p-4 flex-1 flex flex-col`,children:[(0,G.jsxs)(`p`,{className:`text-[10px] text-bambu-gray/70 mb-1`,children:[`#`,e.id]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mb-1`,children:[(0,G.jsxs)(`h3`,{className:`min-w-0 font-medium text-white truncate`,children:[e.print_name||e.filename,e.plate_id!=null&&e.plate_id>1&&` — ${p(`printers.plateNumber`,{number:e.plate_id})}`]}),(0,G.jsx)(Q,{variant:`ghost`,size:`sm`,className:`p-1 sm:p-1.5 shrink-0`,onClick:()=>F(!0),disabled:!v(`archives`,`update`,e.created_by_id),title:v(`archives`,`update`,e.created_by_id)?p(`archives.card.edit`):p(`archives.card.noPermissionEdit`),children:(0,G.jsx)(Cl,{className:`w-3 h-3 sm:w-4 sm:h-4`})})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-3 flex-wrap`,children:[(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray`,children:t}),(()=>{let t=om(e.bed_type);return t?(0,G.jsx)(`img`,{src:t.icon,alt:t.label,title:t.label,className:`w-4 h-4 flex-shrink-0`}):null})(),(0,G.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded font-medium ${q2(e)?`bg-bambu-green/20 text-bambu-green`:`bg-orange-100 dark:bg-orange-500/20 text-orange-700 dark:text-orange-400`}`,title:q2(e)?p(`archives.card.slicedFile`):p(`archives.card.sourceFile`),children:q2(e)?p(`archives.card.gcode`):p(`archives.card.source`)}),e.content_hash&&(0,G.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded font-mono bg-bambu-dark-tertiary/50 text-bambu-gray-light opacity-0 transition-opacity duration-150 group-hover:opacity-100`,title:`SHA256: ${e.content_hash}`,children:e.content_hash.slice(0,8).toUpperCase()}),e.project_name&&(0,G.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded-full truncate max-w-[120px]`,style:{backgroundColor:`${o?.find(t=>t.id===e.project_id)?.color||`#6b7280`}20`,color:o?.find(t=>t.id===e.project_id)?.color||`#6b7280`},title:p(`archives.card.project`,{name:e.project_name}),children:e.project_name}),e.run_count>1&&(0,G.jsx)(`button`,{className:`text-[10px] px-1.5 py-0.5 rounded font-medium bg-bambu-orange/20 text-bambu-orange hover:bg-bambu-orange/30 transition-colors cursor-pointer`,onClick:e=>{e.stopPropagation(),L(!0)},title:p(`archives.card.runsBadgeTitle`,{count:e.run_count,successful:e.successful_run_count,failed:e.failed_run_count}),children:p(`archives.card.runsBadge`,{count:e.run_count})})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-xs mb-4 min-h-[48px]`,children:[(e.print_time_seconds||e.actual_time_seconds)&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-bambu-gray`,title:e.time_accuracy?`Estimated: ${ep(e.print_time_seconds||0)}\nActual: ${ep(e.actual_time_seconds||0)}\nAccuracy: ${e.time_accuracy.toFixed(0)}%`:e.actual_time_seconds?`Actual: ${ep(e.actual_time_seconds)}`:`Estimated: ${ep(e.print_time_seconds||0)}`,children:[(0,G.jsx)(Ts,{className:`w-3 h-3`}),ep(e.actual_time_seconds||e.print_time_seconds||0),e.time_accuracy&&(0,G.jsxs)(`span`,{className:`text-[10px] px-1 rounded ${e.time_accuracy>=95&&e.time_accuracy<=105?`bg-bambu-green/20 text-bambu-green`:e.time_accuracy>105?`bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400`:`bg-orange-100 dark:bg-orange-500/20 text-orange-700 dark:text-orange-400`}`,children:[e.time_accuracy>100?`+`:``,(e.time_accuracy-100).toFixed(0),`%`]})]}),e.filament_used_grams&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-bambu-gray`,children:[(0,G.jsx)(gl,{className:`w-3 h-3`}),e.filament_used_grams.toFixed(1),`g`]}),(e.cost!=null||e.energy_cost!=null)&&(0,G.jsxs)(`div`,{className:`flex items-center gap-3 text-bambu-gray`,children:[e.cost!=null&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(js,{className:`w-3 h-3`}),d,e.cost.toFixed(2)]}),e.energy_cost!=null&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,title:`${p(`stats.energyUsed`)}: ${e.energy_kwh?.toFixed(3)||`N/A`} kWh`,children:[(0,G.jsx)($u,{className:`w-3 h-3`}),d,e.energy_cost.toFixed(2)]})]}),(e.layer_height||e.total_layers)&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-bambu-gray`,children:[(0,G.jsx)(Hc,{className:`w-3 h-3`}),e.total_layers&&(0,G.jsx)(`span`,{children:e.total_layers===1?p(`archives.card.layer`,{count:e.total_layers}):p(`archives.card.layers`,{count:e.total_layers})}),e.total_layers&&e.layer_height&&(0,G.jsx)(`span`,{className:`text-bambu-gray/50`,children:`·`}),e.layer_height&&(0,G.jsxs)(`span`,{children:[e.layer_height,`mm`]})]}),e.object_count!=null&&e.object_count>0&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-bambu-gray`,title:e.object_count===1?p(`archives.card.object`,{count:e.object_count}):p(`archives.card.objects`,{count:e.object_count}),children:[(0,G.jsx)(Go,{className:`w-3 h-3`}),e.object_count===1?p(`archives.card.object`,{count:e.object_count}):p(`archives.card.objects`,{count:e.object_count})]}),e.sliced_for_model&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-bambu-gray`,title:p(`archives.card.slicedFor`,{model:e.sliced_for_model}),children:[(0,G.jsx)(jl,{className:`w-3 h-3`}),e.sliced_for_model]}),e.filament_type&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 col-span-2`,children:[(0,G.jsx)(`span`,{className:`text-bambu-gray text-xs`,children:e.filament_type}),e.filament_color&&(0,G.jsx)(`div`,{className:`flex items-center gap-0.5 flex-wrap`,children:e.filament_color.split(`,`).map((e,t)=>(0,G.jsx)(`div`,{className:`w-3 h-3 rounded-full border border-black/20`,style:{backgroundColor:e},title:e},t))})]})]}),b&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-bambu-green text-xs mb-3`,title:p(`archives.card.slicerAmsMappingTooltip`,{printer:b}),children:[(0,G.jsx)(gs,{className:`w-3.5 h-3.5`}),p(`archives.card.slicerAmsMapping`,{printer:b})]}),(e.tags||e.notes)&&(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 mb-3`,children:[e.notes&&(0,G.jsx)(`div`,{className:`flex items-center gap-1 px-1.5 py-0.5 bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400 rounded text-xs`,title:e.notes,children:(0,G.jsx)(gu,{className:`w-3 h-3`})}),e.tags?.split(`,`).map((e,t)=>(0,G.jsx)(`span`,{className:`px-1.5 py-0.5 bg-bambu-dark-tertiary text-bambu-gray-light rounded text-xs`,children:e.trim()},t))]}),(0,G.jsx)(`div`,{className:`flex-1`}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-bambu-gray border-t border-bambu-dark-tertiary pt-3`,children:[(0,G.jsx)(`span`,{children:Zf(e.created_at,c)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.created_by_username&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,title:p(`archives.card.uploadedBy`,{name:e.created_by_username}),children:[(0,G.jsx)(Lu,{className:`w-3 h-3`}),e.created_by_username]}),(0,G.jsx)(`span`,{children:Bd(e.file_size)})]})]}),(0,G.jsxs)(`div`,{className:`flex gap-1 mt-3`,children:[q2(e)?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Q,{variant:`primary`,size:`sm`,className:`flex-1 min-w-0 overflow-hidden`,onClick:()=>S(!0),disabled:!e.file_path||!_(`queue:create`)||!v(`archives`,`reprint`,e.created_by_id),title:e.file_path?_(`queue:create`)?v(`archives`,`reprint`,e.created_by_id)?void 0:p(`archives.card.noPermissionReprint`):p(`archives.permission.noAddToQueue`):p(`archives.card.noFileForReprint`),children:[(0,G.jsx)(jl,{className:`w-3 h-3 flex-shrink-0`}),(0,G.jsx)(`span`,{className:`hidden xl:inline truncate`,children:p(`common.print`)})]}),(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,className:`min-w-0 p-1 sm:p-1.5`,onClick:()=>{let t=e.print_name||e.filename||`model`;J2(e.id,t,`file`,l)},title:p(`archives.card.openInBambuStudio`),children:(0,G.jsx)(Zs,{className:`w-3 h-3 sm:w-4 sm:h-4`})})]}):(0,G.jsxs)(Q,{variant:`primary`,size:`sm`,className:`flex-1 min-w-0 overflow-hidden`,onClick:()=>{if(u)E(!0);else{let t=e.print_name||e.filename||`model`;J2(e.id,t,`file`,l)}},title:p(u?`slice.title`:`archives.card.openInBambuStudioToSlice`),children:[u?(0,G.jsx)(Ms,{className:`w-3 h-3 flex-shrink-0`}):(0,G.jsx)(Zs,{className:`w-3 h-3 flex-shrink-0`}),(0,G.jsx)(`span`,{className:`hidden xl:inline truncate`,children:p(`archives.card.slice`)})]}),(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,className:`min-w-0 p-1 sm:p-1.5`,onClick:()=>{let t=e.external_url||e.makerworld_url;t&&window.open(t,`_blank`)},disabled:!e.external_url&&!e.makerworld_url,title:e.external_url?p(`archives.card.externalLink`):e.makerworld_url?p(`archives.card.makerWorld`,{designer:e.designer||p(`archives.card.viewProject`)}):p(`archives.card.noExternalLink`),children:(0,G.jsx)(wc,{className:`w-3 h-3 sm:w-4 sm:h-4 ${!e.external_url&&!e.makerworld_url?`opacity-20`:``}`})}),(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,className:`min-w-0 p-1 sm:p-1.5`,onClick:()=>{Z.downloadArchive(e.id,`${e.print_name||e.filename}.3mf`).catch(e=>{console.error(`Archive download failed:`,e)})},title:p(`archives.card.download`),children:(0,G.jsx)(Ws,{className:`w-3 h-3 sm:w-4 sm:h-4`})}),(0,G.jsx)(Q,{variant:`ghost`,size:`sm`,className:`min-w-0 p-1 sm:p-1.5`,onClick:()=>A(!0),disabled:!v(`archives`,`delete`,e.created_by_id),title:v(`archives`,`delete`,e.created_by_id)?p(`archives.card.delete`):p(`archives.card.noPermissionDelete`),children:(0,G.jsx)(ku,{className:`w-3 h-3 sm:w-4 sm:h-4 text-red-600 dark:text-red-400`})})]})]}),P&&(0,G.jsx)(Gp,{archive:e,onClose:()=>F(!1)}),I&&(0,G.jsx)($W,{archiveId:e.id,archiveName:e.print_name||e.filename,onClose:()=>L(!1)}),xe&&(0,G.jsx)(TW,{plates:xe,onSelect:t=>{Se(null),y(`/gcode-viewer?archive=${e.id}&plate=${t}`)},onClose:()=>Se(null)}),x&&(0,G.jsx)(Tm,{mode:`create`,archiveId:e.id,archiveName:e.print_name||e.filename,onClose:()=>S(!1)}),C&&(0,G.jsx)(Em,{archiveId:e.id,onClose:()=>w(!1)}),T&&(0,G.jsx)(UW,{source:{kind:`archive`,id:e.id,filename:e.print_name||e.filename||`model`},onClose:()=>E(!1)}),D&&(0,G.jsx)(KW,{source:{kind:`archive`,id:e.id,filename:e.print_name||e.filename||`model`},onClose:()=>O(!1)}),k&&(0,G.jsxs)($d,{title:p(`archives.modal.deleteArchive`),message:p(`archives.modal.deleteConfirm`,{name:e.print_name||e.filename}),confirmText:p(`archives.modal.deleteButton`),variant:`danger`,confirmDisabled:(N.data?.currently_printing??0)>0,onConfirm:()=>{He.mutate(j),A(!1),M(!1)},onCancel:()=>{A(!1),M(!1)},children:[(N.data?.related_queue_items??0)>0&&(0,G.jsx)(`div`,{className:(N.data?.currently_printing??0)>0?`text-sm text-red-600 dark:text-red-400 mb-2`:`text-sm text-amber-600 dark:text-amber-400 mb-2`,children:(N.data?.currently_printing??0)>0?p(`archives.modal.deleteBlockedByPrinting`,{count:N.data.currently_printing}):p(`archives.modal.deleteQueueItemsWarning`,{count:N.data.related_queue_items})}),(0,G.jsxs)(`label`,{className:`flex items-start gap-2 cursor-pointer text-sm text-bambu-gray`,children:[(0,G.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 accent-red-500`,checked:j,onChange:e=>M(e.target.checked)}),(0,G.jsx)(`span`,{children:p(`archives.modal.deletePurgeStats`)})]})]}),le&&(0,G.jsx)($d,{title:p(`archives.modal.removeSource3mf`),message:p(`archives.modal.removeSource3mfConfirm`,{name:e.print_name||e.filename}),confirmText:p(`archives.modal.removeButton`),variant:`danger`,onConfirm:()=>{Le.mutate(),ue(!1)},onCancel:()=>ue(!1)}),de&&(0,G.jsx)($d,{title:p(`archives.modal.removeF3d`),message:p(`archives.modal.removeF3dConfirm`,{name:e.print_name||e.filename}),confirmText:p(`archives.modal.removeButton`),variant:`danger`,onConfirm:()=>{ze.mutate(),fe(!1)},onCancel:()=>fe(!1)}),pe&&(0,G.jsx)($d,{title:p(`archives.modal.removeTimelapse`),message:p(`archives.modal.removeTimelapseConfirm`,{name:e.print_name||e.filename}),confirmText:p(`archives.modal.removeButton`),variant:`danger`,onConfirm:()=>{Pe.mutate(),me(!1)},onCancel:()=>me(!1)}),he&&(0,G.jsx)(lE,{x:he.x,y:he.y,items:qe,onClose:()=>ge(null)}),B&&(0,G.jsx)(V2,{archiveId:e.id,archiveName:e.print_name||e.filename,printerName:t,onClose:()=>V(!1)}),R&&e.timelapse_path&&(0,G.jsx)(B2,{src:Z.getArchiveTimelapse(e.id),title:p(`archives.modal.timelapse`,{name:e.print_name||e.filename}),downloadFilename:`${e.print_name||e.filename}_timelapse.mp4`,archiveId:e.id,onClose:()=>z(!1),onEdit:()=>{h.invalidateQueries({queryKey:[`archives`]}),z(!1)}}),ee&&ne.length>0&&(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/80 flex items-center justify-center z-50 p-4`,children:(0,G.jsxs)(`div`,{className:`bg-card-dark rounded-lg max-w-lg w-full max-h-[80vh] flex flex-col`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-gray-700`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:p(`archives.modal.selectTimelapse`)}),(0,G.jsx)(`p`,{className:`text-sm text-gray-400 mt-1`,children:p(`archives.modal.selectTimelapseDesc`)})]}),(0,G.jsx)(`button`,{onClick:()=>{te(!1),re([])},className:`text-gray-400 hover:text-white p-1`,children:(0,G.jsx)(Zu,{className:`w-5 h-5`})})]}),(0,G.jsx)(`div`,{className:`overflow-y-auto flex-1 p-2`,children:ne.map(e=>(0,G.jsxs)(`button`,{onClick:()=>Ve.mutate(e.name),disabled:Ve.isPending,className:`w-full text-left p-3 rounded-lg hover:bg-gray-700 transition-colors flex items-center gap-3 disabled:opacity-50`,children:[(0,G.jsx)(cc,{className:`w-8 h-8 text-bambu-green flex-shrink-0`}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`p`,{className:`text-white font-medium truncate`,children:e.name}),(0,G.jsxs)(`p`,{className:`text-sm text-gray-400`,children:[Bd(e.size),e.mtime&&` • ${Zf(e.mtime,c)}`]})]})]},e.name))}),(0,G.jsx)(`div`,{className:`p-4 border-t border-gray-700`,children:(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>{te(!1),re([])},className:`w-full`,children:`Cancel`})})]})}),ie&&(0,G.jsx)(tG,{archiveId:e.id,archiveName:e.print_name||e.filename,onClose:()=>ae(!1)}),oe&&e.photos&&e.photos.length>0&&(0,G.jsx)(nG,{archiveId:e.id,archiveName:e.print_name||e.filename,photos:e.photos,onClose:()=>se(!1),onDelete:async t=>{try{await Z.deleteArchivePhoto(e.id,t),h.invalidateQueries({queryKey:[`archives`]}),g(p(`archives.toast.photoDeleted`))}catch{g(p(`archives.toast.failedDeletePhoto`),`error`)}}}),H&&(0,G.jsx)(z2,{archiveId:e.id,archiveName:e.print_name||e.filename,onClose:()=>ce(!1)}),(0,G.jsx)(`input`,{ref:Ce,type:`file`,accept:`.3mf`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&Ie.mutate(t),e.target.value=``}}),(0,G.jsx)(`input`,{ref:we,type:`file`,accept:`.f3d`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&Re.mutate(t),e.target.value=``}}),(0,G.jsx)(`input`,{ref:Te,type:`file`,accept:`.mp4,.avi,.mkv`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&Fe.mutate(t),e.target.value=``}})]})}function XVe({archive:e,printerName:t,isSelected:n,onSelect:r,selectionMode:i,projects:a,isHighlighted:o,preferredSlicer:s=`bambu_studio`,useSlicerApi:c=!1,t:l,onNavigateToArchive:u}){let d=no(),{showToast:p}=Hd(),{hasPermission:m,canModify:h}=Od(),[g,_]=(0,f.useState)(!1),[v,y]=(0,f.useState)(!1),[b,x]=(0,f.useState)(!1),[S,C]=(0,f.useState)(!1),w=K({queryKey:[`archive`,e.id,`delete-impact`],queryFn:()=>Z.getArchiveDeleteImpact(e.id),enabled:b,staleTime:0}),T=$n(),[E,D]=(0,f.useState)(!1),[O,k]=(0,f.useState)(!1),[A,j]=(0,f.useState)(!1),[M,N]=(0,f.useState)(!1),[P,F]=(0,f.useState)(!1),[I,L]=(0,f.useState)(!1),[R,z]=(0,f.useState)(!1),[B,V]=(0,f.useState)([]),[ee,te]=(0,f.useState)(!1),[ne,re]=(0,f.useState)(!1),[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)(null),pe=(0,f.useRef)(null),me=(0,f.useRef)(null),he=(0,f.useRef)(null),[ge,_e]=(0,f.useState)(null),ve=e.duplicate_sequence??0,ye=Hp(e.user_verdict_source),be=e.original_archive_id??null,xe=async()=>{try{let t=await Z.getArchivePlates(e.id);if(t.is_multi_plate&&t.plates.length>1){_e(t.plates);return}}catch{}T(`/gcode-viewer?archive=${e.id}`)},Se=q({mutationFn:()=>Z.deleteArchiveTimelapse(e.id),onSuccess:()=>{d.invalidateQueries({queryKey:[`archives`]}),p(l(`archives.toast.timelapseRemoved`))},onError:e=>{p(e.message||l(`archives.toast.failedRemoveTimelapse`),`error`)}}),Ce=q({mutationFn:t=>Z.uploadArchiveTimelapse(e.id,t),onSuccess:e=>{d.invalidateQueries({queryKey:[`archives`]}),p(l(`archives.toast.timelapseUploaded`,{filename:e.filename}))},onError:e=>{p(e.message||l(`archives.toast.failedUploadTimelapse`),`error`)}}),we=q({mutationFn:t=>Z.uploadSource3mf(e.id,t),onSuccess:e=>{d.invalidateQueries({queryKey:[`archives`]}),p(l(`archives.toast.source3mfAttached`,{filename:e.filename}))},onError:e=>{p(e.message||l(`archives.toast.failedUploadSource3mf`),`error`)}}),Te=q({mutationFn:()=>Z.deleteSource3mf(e.id),onSuccess:()=>{d.invalidateQueries({queryKey:[`archives`]}),p(l(`archives.toast.source3mfRemoved`))},onError:e=>{p(e.message||l(`archives.toast.failedRemoveSource3mf`),`error`)}}),Ee=q({mutationFn:t=>Z.uploadF3d(e.id,t),onSuccess:e=>{d.invalidateQueries({queryKey:[`archives`]}),p(l(`archives.toast.f3dAttached`,{filename:e.filename}))},onError:e=>{p(e.message||l(`archives.toast.failedUploadF3d`),`error`)}}),De=q({mutationFn:()=>Z.deleteF3d(e.id),onSuccess:()=>{d.invalidateQueries({queryKey:[`archives`]}),p(l(`archives.toast.f3dRemoved`))},onError:e=>{p(e.message||l(`archives.toast.failedRemoveF3d`),`error`)}}),Oe=q({mutationFn:()=>Z.scanArchiveTimelapse(e.id),onSuccess:e=>{e.status===`attached`?(d.invalidateQueries({queryKey:[`archives`]}),p(l(`archives.toast.timelapseAttached`,{filename:e.filename}))):e.status===`exists`?p(l(`archives.toast.timelapseAlreadyAttached`)):e.status===`not_found`&&e.available_files&&e.available_files.length>0?(V(e.available_files),z(!0)):p(e.message||l(`archives.toast.noMatchingTimelapse`),`warning`)},onError:e=>{p(e.message||l(`archives.toast.failedScanTimelapse`),`error`)}}),ke=q({mutationFn:t=>Z.selectArchiveTimelapse(e.id,t),onSuccess:e=>{d.invalidateQueries({queryKey:[`archives`]}),p(l(`archives.toast.timelapseAttached`,{filename:e.filename})),z(!1),V([])},onError:e=>{p(e.message||l(`archives.toast.failedAttachTimelapse`),`error`)}}),Ae=q({mutationFn:t=>Z.deleteArchive(e.id,t),onSuccess:()=>{Bp(d),p(l(`archives.toast.archiveDeleted`))},onError:()=>{p(l(`archives.toast.failedDeleteArchive`),`error`)}}),je=q({mutationFn:()=>Z.toggleFavorite(e.id),onSuccess:e=>{d.invalidateQueries({queryKey:[`archives`]}),p(e.is_favorite?l(`archives.toast.addedToFavorites`):l(`archives.toast.removedFromFavorites`))}}),{data:Me}=K({queryKey:[`archive-folders`,e.id],queryFn:()=>Z.getLibraryFoldersByArchive(e.id)}),Ne=q({mutationFn:t=>Z.updateArchive(e.id,{project_id:t}),onSuccess:()=>{Bp(d),p(l(`archives.toast.projectUpdated`))},onError:()=>{p(l(`archives.toast.failedUpdateProject`),`error`)}}),Pe=e=>{e.preventDefault(),fe({x:e.clientX,y:e.clientY})},Fe=[...q2(e)?[{label:l(`common.print`),icon:(0,G.jsx)(jl,{className:`w-4 h-4`}),onClick:()=>D(!0),disabled:!e.file_path||!m(`queue:create`)||!h(`archives`,`reprint`,e.created_by_id),title:e.file_path?m(`queue:create`)?h(`archives`,`reprint`,e.created_by_id)?void 0:l(`archives.permission.noReprint`):l(`archives.permission.noAddToQueue`):l(`archives.card.noFileForReprint`)},{label:l(`archives.menu.openInBambuStudio`),icon:(0,G.jsx)(Zs,{className:`w-4 h-4`}),onClick:()=>{let t=e.print_name||e.filename||`model`;J2(e.id,t,`file`,s)},disabled:!e.file_path,title:e.file_path?void 0:l(`archives.card.noFileForReprint`)}]:[{label:l(`archives.menu.slice`),icon:c?(0,G.jsx)(Ms,{className:`w-4 h-4`}):(0,G.jsx)(Zs,{className:`w-4 h-4`}),onClick:()=>{if(c)j(!0);else{let t=e.print_name||e.filename||`model`;J2(e.id,t,`file`,s)}}},...c?[{label:l(`library.runWithPipeline.actionLabel`),icon:(0,G.jsx)(El,{className:`w-4 h-4`}),onClick:()=>N(!0),disabled:!m(`pipelines:run`),title:m(`pipelines:run`)?void 0:l(`library.runWithPipeline.noPermission`)}]:[]],{label:e.external_url?l(`archives.menu.externalLink`):l(`archives.menu.viewOnMakerWorld`),icon:(0,G.jsx)(wc,{className:`w-4 h-4`}),onClick:()=>{let t=e.external_url||e.makerworld_url;t&&window.open(t,`_blank`)},disabled:!e.external_url&&!e.makerworld_url},...e.status===`completed`?[{label:l(`archives.menu.confirmOutcome`),icon:e.user_verdict===`reject`?(0,G.jsx)(Eu,{className:`w-4 h-4`}):(0,G.jsx)(Du,{className:`w-4 h-4`}),onClick:()=>k(!0),disabled:!h(`archives`,`update`,e.created_by_id),title:h(`archives`,`update`,e.created_by_id)?void 0:l(`archives.permission.noUpdateArchives`)}]:[],{label:``,divider:!0,onClick:()=>{}},{label:l(`archives.menu.preview3d`),icon:(0,G.jsx)(Go,{className:`w-4 h-4`}),onClick:()=>{xe()}},{label:l(`archives.menu.viewTimelapse`),icon:(0,G.jsx)(cc,{className:`w-4 h-4`}),onClick:()=>F(!0),disabled:!e.timelapse_path},{label:l(`archives.menu.scanForTimelapse`),icon:(0,G.jsx)(Ul,{className:`w-4 h-4`}),onClick:()=>Oe.mutate(),disabled:!e.printer_id||!!e.timelapse_path||Oe.isPending||!h(`archives`,`update`,e.created_by_id),title:h(`archives`,`update`,e.created_by_id)?void 0:l(`archives.permission.noUpdateArchives`)},{label:l(`archives.menu.uploadTimelapse`),icon:(0,G.jsx)(Iu,{className:`w-4 h-4`}),onClick:()=>he.current?.click(),disabled:!!e.timelapse_path||!h(`archives`,`update`,e.created_by_id),title:h(`archives`,`update`,e.created_by_id)?void 0:l(`archives.permission.noUpdateArchives`)},...e.timelapse_path?[{label:l(`archives.menu.removeTimelapse`),icon:(0,G.jsx)(ku,{className:`w-4 h-4`}),onClick:()=>ue(!0),danger:!0,disabled:!h(`archives`,`update`,e.created_by_id),title:h(`archives`,`update`,e.created_by_id)?void 0:l(`archives.permission.noUpdateArchives`)}]:[],{label:``,divider:!0,onClick:()=>{}},{label:e.source_3mf_path?l(`archives.menu.downloadSource3mf`):l(`archives.menu.uploadSource3mf`),icon:(0,G.jsx)(nc,{className:`w-4 h-4`}),onClick:()=>{e.source_3mf_path?Z.downloadSource3mf(e.id).catch(e=>{console.error(`Source 3MF download failed:`,e)}):pe.current?.click()},disabled:!e.source_3mf_path&&!h(`archives`,`update`,e.created_by_id),title:!e.source_3mf_path&&!h(`archives`,`update`,e.created_by_id)?l(`archives.permission.noUploadFiles`):void 0},...e.source_3mf_path?[{label:l(`archives.menu.replaceSource3mf`),icon:(0,G.jsx)(Iu,{className:`w-4 h-4`}),onClick:()=>pe.current?.click(),disabled:!h(`archives`,`update`,e.created_by_id),title:h(`archives`,`update`,e.created_by_id)?void 0:l(`archives.permission.noUpdateArchives`)},{label:l(`archives.menu.removeSource3mf`),icon:(0,G.jsx)(ku,{className:`w-4 h-4`}),onClick:()=>se(!0),danger:!0,disabled:!h(`archives`,`update`,e.created_by_id),title:h(`archives`,`update`,e.created_by_id)?void 0:l(`archives.permission.noUpdateArchives`)}]:[],{label:e.f3d_path?l(`archives.menu.replaceF3d`):l(`archives.menu.uploadF3d`),icon:(0,G.jsx)(Go,{className:`w-4 h-4`}),onClick:()=>me.current?.click(),disabled:!h(`archives`,`update`,e.created_by_id),title:h(`archives`,`update`,e.created_by_id)?void 0:l(`archives.permission.noUpdateArchives`)},...e.f3d_path?[{label:l(`archives.menu.downloadF3d`),icon:(0,G.jsx)(Ws,{className:`w-4 h-4`}),onClick:()=>{Z.downloadF3d(e.id).catch(e=>{console.error(`F3D download failed:`,e)})}},{label:l(`archives.menu.removeF3d`),icon:(0,G.jsx)(ku,{className:`w-4 h-4`}),onClick:()=>ce(!0),danger:!0,disabled:!h(`archives`,`update`,e.created_by_id),title:h(`archives`,`update`,e.created_by_id)?void 0:l(`archives.permission.noUpdateArchives`)}]:[],{label:``,divider:!0,onClick:()=>{}},{label:l(`archives.menu.download`),icon:(0,G.jsx)(Ws,{className:`w-4 h-4`}),onClick:()=>{Z.downloadArchive(e.id,`${e.print_name||e.filename}.3mf`).catch(e=>{console.error(`Archive download failed:`,e)})},disabled:!m(`archives:read`),title:m(`archives:read`)?void 0:l(`archives.permission.noDownload`)},{label:l(`archives.menu.copyDownloadLink`),icon:(0,G.jsx)(Fs,{className:`w-4 h-4`}),onClick:()=>{let t=`${window.location.origin}${Z.getArchiveDownload(e.id)}`;navigator.clipboard.writeText(t).then(()=>{p(l(`archives.toast.linkCopied`))}).catch(()=>{p(l(`archives.toast.failedCopyLink`),`error`)})},disabled:!m(`archives:read`),title:m(`archives:read`)?void 0:l(`archives.permission.noCopyLink`)},{label:l(`archives.menu.qrCode`),icon:(0,G.jsx)(Ml,{className:`w-4 h-4`}),onClick:()=>te(!0)},{label:e.photos?.length?l(`archives.menu.viewPhotosCount`,{count:e.photos.length}):l(`archives.menu.viewPhotos`),icon:(0,G.jsx)(es,{className:`w-4 h-4`}),onClick:()=>re(!0),disabled:!e.photos?.length},{label:l(`archives.menu.projectPage`),icon:(0,G.jsx)(oc,{className:`w-4 h-4`}),onClick:()=>ae(!0)},{label:``,divider:!0,onClick:()=>{}},{label:e.is_favorite?l(`archives.menu.removeFromFavorites`):l(`archives.menu.addToFavorites`),icon:(0,G.jsx)(mu,{className:`w-4 h-4 ${e.is_favorite?`fill-yellow-400 text-yellow-400`:h(`archives`,`update`,e.created_by_id)?`group-hover:text-yellow-400`:``}`}),onClick:()=>je.mutate(),disabled:!h(`archives`,`update`,e.created_by_id),title:h(`archives`,`update`,e.created_by_id)?void 0:l(`archives.permission.noUpdateArchives`)},{label:l(`archives.menu.edit`),icon:(0,G.jsx)(Cl,{className:`w-4 h-4`}),onClick:()=>_(!0),disabled:!h(`archives`,`update`,e.created_by_id),title:h(`archives`,`update`,e.created_by_id)?void 0:l(`archives.permission.noUpdateArchives`)},{label:l(`archives.menu.printLog`),icon:(0,G.jsx)(Nc,{className:`w-4 h-4`}),onClick:()=>y(!0)},...e.project_id&&e.project_name?[{label:l(`archives.menu.goToProject`,{name:e.project_name}),icon:(0,G.jsx)(dc,{className:`w-4 h-4 text-bambu-green`}),onClick:()=>window.location.href=`/projects`}]:[],{label:l(`archives.menu.addToProject`),icon:(0,G.jsx)(dc,{className:`w-4 h-4`}),onClick:()=>{},submenuSearchPlaceholder:Vp(a??[],e.project_id).length>5?l(`archives.menu.searchProjects`):void 0,submenu:(()=>{let t=[];if(e.project_id&&t.push({label:l(`archives.menu.removeFromProject`),icon:(0,G.jsx)(Zu,{className:`w-4 h-4`}),onClick:()=>Ne.mutate(null)}),!a)t.push({label:l(`archives.menu.loading`),icon:(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}),onClick:()=>{},disabled:!0});else{let n=Vp(a,e.project_id).sort((e,t)=>e.name.localeCompare(t.name));n.length===0?t.push({label:l(`archives.menu.noProjectsAvailable`),icon:(0,G.jsx)(dc,{className:`w-4 h-4 opacity-50`}),onClick:()=>{},disabled:!0}):n.forEach(n=>{t.push({label:n.name,icon:(0,G.jsx)(`div`,{className:`w-3 h-3 rounded-full flex-shrink-0`,style:{backgroundColor:n.color||`#888`}}),onClick:()=>Ne.mutate(n.id),disabled:e.project_id===n.id})})}return t})()},{label:l(n?`archives.menu.deselect`:`archives.menu.select`),icon:n?(0,G.jsx)(du,{className:`w-4 h-4`}):(0,G.jsx)(pu,{className:`w-4 h-4`}),onClick:()=>r(e.id)},{label:``,divider:!0,onClick:()=>{}},{label:l(`archives.menu.delete`),icon:(0,G.jsx)(ku,{className:`w-4 h-4`}),onClick:()=>x(!0),danger:!0,disabled:!h(`archives`,`delete`,e.created_by_id),title:h(`archives`,`delete`,e.created_by_id)?void 0:l(`archives.permission.noDelete`)}];return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{"data-archive-id":e.id,className:`grid grid-cols-12 gap-4 px-4 py-3 items-center hover:bg-bambu-dark-tertiary/30 ${n?`bg-bambu-green/10`:``}`,style:o?{outline:`4px solid #facc15`,outlineOffset:`-4px`}:void 0,onContextMenu:Pe,children:[(0,G.jsxs)(`div`,{className:`col-span-1 flex items-center gap-2`,children:[i&&(0,G.jsx)(`button`,{onClick:()=>r(e.id),children:n?(0,G.jsx)(du,{className:`w-4 h-4 text-bambu-green`}):(0,G.jsx)(pu,{className:`w-4 h-4 text-bambu-gray`})}),e.thumbnail_path?(0,G.jsx)(`img`,{src:Z.getArchiveThumbnail(e.id),alt:``,className:`w-10 h-10 object-cover rounded`}):(0,G.jsx)(`div`,{className:`w-10 h-10 bg-bambu-dark rounded flex items-center justify-center`,children:(0,G.jsx)(Ic,{className:`w-5 h-5 text-bambu-dark-tertiary`})})]}),(0,G.jsxs)(`div`,{className:`col-span-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`p`,{className:`text-white text-sm truncate`,children:e.print_name||e.filename}),(e.status===`failed`||e.status===`aborted`)&&(0,G.jsx)(`span`,{className:`px-1.5 py-0.5 rounded text-[10px] leading-tight bg-status-error/80 text-white flex-shrink-0`,children:e.status===`aborted`?l(`archives.card.cancelled`):l(`archives.card.failed`)}),e.status===`completed`&&e.confirm_requested&&e.user_verdict==null&&(0,G.jsx)(`button`,{onClick:e=>{e.stopPropagation(),k(!0)},disabled:!h(`archives`,`update`,e.created_by_id),className:`px-1.5 py-0.5 rounded text-[10px] leading-tight bg-amber-500/90 enabled:hover:bg-amber-500 text-black flex-shrink-0 transition-colors`,title:h(`archives`,`update`,e.created_by_id)?l(`archives.card.confirmPendingTitle`):l(`archives.permission.noUpdateArchives`),children:l(`archives.card.confirmPending`)}),e.status===`completed`&&e.user_verdict===`reject`&&(0,G.jsx)(`span`,{className:`px-1.5 py-0.5 rounded text-[10px] leading-tight bg-status-error/80 text-white flex-shrink-0`,title:`${l(`archives.card.rejectedTitle`)}${ye?` — ${l(ye)}`:``}`,children:l(`archives.card.rejected`)}),e.status===`completed`&&e.user_verdict===`good`&&(0,G.jsx)(`span`,{className:`px-1.5 py-0.5 rounded text-[10px] leading-tight bg-bambu-green/80 text-white flex-shrink-0`,title:`${l(`archives.card.confirmedGoodTitle`)}${ye?` — ${l(ye)}`:``}`,children:l(`archives.card.confirmedGood`)}),e.duplicate_count>0&&ve>0&&be&&(0,G.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),u?.(be)},className:`px-1.5 py-0.5 rounded text-[10px] leading-tight bg-purple-500/80 hover:bg-purple-600/90 text-white flex-shrink-0 transition-colors flex items-center gap-1`,title:l(`archives.viewOriginalPrint`,{id:be}),children:[(0,G.jsx)(Fs,{className:`w-3 h-3`}),`#`,ve]}),e.duplicate_count>0&&ve===0&&(0,G.jsxs)(`span`,{className:`px-1.5 py-0.5 rounded text-[10px] leading-tight bg-purple-500/80 text-white flex-shrink-0 flex items-center gap-1`,title:`${e.duplicate_count} reprint${e.duplicate_count===1?``:`s`}`,children:[(0,G.jsx)(xc,{className:`w-3 h-3`}),`+`,e.duplicate_count]}),e.timelapse_path&&(0,G.jsx)(`span`,{title:l(`archives.list.hasTimelapse`),children:(0,G.jsx)(cc,{className:`w-3.5 h-3.5 text-bambu-green flex-shrink-0`})}),Me&&Me.length>0&&(0,G.jsx)(Ci,{to:`/files?folder=${Me[0].id}`,className:`flex-shrink-0`,title:l(`archives.card.openFolder`,{name:Me[0].name}),onClick:e=>e.stopPropagation(),children:(0,G.jsx)(fc,{className:`w-3.5 h-3.5 text-yellow-600 dark:text-yellow-400`})})]}),(e.filament_type||e.sliced_for_model)&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-0.5`,children:[e.sliced_for_model&&(0,G.jsxs)(`span`,{className:`text-xs text-bambu-gray flex items-center gap-1`,title:l(`archives.card.slicedFor`,{model:e.sliced_for_model}),children:[(0,G.jsx)(jl,{className:`w-2.5 h-2.5`}),e.sliced_for_model]}),(()=>{let t=om(e.bed_type);return t?(0,G.jsx)(`img`,{src:t.icon,alt:t.label,title:t.label,className:`w-3.5 h-3.5 flex-shrink-0`}):null})(),e.sliced_for_model&&e.filament_type&&(0,G.jsx)(`span`,{className:`text-bambu-gray/50`,children:`·`}),e.filament_type&&(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:e.filament_type}),e.filament_color&&(0,G.jsx)(`div`,{className:`flex items-center gap-0.5 flex-wrap`,children:e.filament_color.split(`,`).map((e,t)=>(0,G.jsx)(`div`,{className:`w-2.5 h-2.5 rounded-full border border-black/20`,style:{backgroundColor:e},title:e},t))})]})]}),(0,G.jsx)(`div`,{className:`col-span-2 text-sm text-bambu-gray truncate`,children:t}),(0,G.jsxs)(`div`,{className:`col-span-2 text-sm text-bambu-gray`,children:[(0,G.jsx)(`div`,{children:Xf(e.created_at)}),e.created_by_username&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1 text-xs opacity-75`,title:l(`archives.card.uploadedBy`,{name:e.created_by_username}),children:[(0,G.jsx)(Lu,{className:`w-3 h-3`}),e.created_by_username]})]}),(0,G.jsx)(`div`,{className:`col-span-1 text-sm text-bambu-gray`,children:Bd(e.file_size)}),(0,G.jsxs)(`div`,{className:`col-span-2 flex justify-end gap-1`,children:[q2(e)&&(0,G.jsx)(Q,{variant:`ghost`,size:`sm`,onClick:()=>D(!0),disabled:!e.file_path||!m(`queue:create`)||!h(`archives`,`reprint`,e.created_by_id),title:e.file_path?m(`queue:create`)?h(`archives`,`reprint`,e.created_by_id)?l(`common.print`):l(`archives.card.noPermissionReprint`):l(`archives.permission.noAddToQueue`):l(`archives.card.noFileForReprint`),className:`text-bambu-green hover:text-bambu-green-light hover:bg-bambu-green/10`,children:(0,G.jsx)(El,{className:`w-4 h-4`})}),(0,G.jsx)(Q,{variant:`ghost`,size:`sm`,onClick:()=>{let t=e.print_name||e.filename||`model`;J2(e.id,t,`file`,s)},title:l(`archives.card.openInBambuStudio`),children:(0,G.jsx)(Zs,{className:`w-4 h-4`})}),(e.external_url||e.makerworld_url)&&(0,G.jsx)(Q,{variant:`ghost`,size:`sm`,onClick:()=>window.open(e.external_url||e.makerworld_url,`_blank`),title:e.external_url?l(`archives.card.externalLink`):`MakerWorld`,children:(0,G.jsx)(wc,{className:`w-4 h-4`})}),(0,G.jsx)(Q,{variant:`ghost`,size:`sm`,onClick:()=>L(!0),disabled:!e.timelapse_path&&(!m(`printers:files`)||!e.printer_id||!e.started_at),title:!e.timelapse_path&&!m(`printers:files`)?l(`printers.permission.noFiles`):l(`archives.media.download`),children:(0,G.jsx)(cc,{className:`w-4 h-4`})}),(0,G.jsx)(Q,{variant:`ghost`,size:`sm`,onClick:()=>{Z.downloadArchive(e.id,`${e.print_name||e.filename}.3mf`).catch(e=>{console.error(`Archive download failed:`,e)})},title:l(`archives.card.download`),children:(0,G.jsx)(Ws,{className:`w-4 h-4`})}),(0,G.jsx)(Q,{variant:`ghost`,size:`sm`,onClick:()=>_(!0),disabled:!h(`archives`,`update`,e.created_by_id),title:h(`archives`,`update`,e.created_by_id)?l(`archives.card.edit`):l(`archives.card.noPermissionEdit`),children:(0,G.jsx)(Cl,{className:`w-4 h-4`})}),(0,G.jsx)(Q,{variant:`ghost`,size:`sm`,onClick:()=>x(!0),disabled:!h(`archives`,`delete`,e.created_by_id),title:h(`archives`,`delete`,e.created_by_id)?l(`archives.card.delete`):l(`archives.card.noPermissionDelete`),children:(0,G.jsx)(ku,{className:`w-4 h-4 text-red-600 dark:text-red-400`})}),(0,G.jsx)(Q,{variant:`ghost`,size:`sm`,onClick:e=>{let t=e.currentTarget.getBoundingClientRect();fe({x:t.left,y:t.bottom+4})},title:l(`archives.card.moreOptions`),children:(0,G.jsx)(qs,{className:`w-4 h-4`})})]})]}),g&&(0,G.jsx)(Gp,{archive:e,onClose:()=>_(!1)}),v&&(0,G.jsx)($W,{archiveId:e.id,archiveName:e.print_name||e.filename,onClose:()=>y(!1)}),ge&&(0,G.jsx)(TW,{plates:ge,onSelect:t=>{_e(null),T(`/gcode-viewer?archive=${e.id}&plate=${t}`)},onClose:()=>_e(null)}),E&&(0,G.jsx)(Tm,{mode:`create`,archiveId:e.id,archiveName:e.print_name||e.filename,onClose:()=>D(!1)}),O&&(0,G.jsx)(Em,{archiveId:e.id,onClose:()=>k(!1)}),A&&(0,G.jsx)(UW,{source:{kind:`archive`,id:e.id,filename:e.print_name||e.filename||`model`},onClose:()=>j(!1)}),M&&(0,G.jsx)(KW,{source:{kind:`archive`,id:e.id,filename:e.print_name||e.filename||`model`},onClose:()=>N(!1)}),b&&(0,G.jsxs)($d,{title:l(`archives.modal.deleteArchive`),message:l(`archives.modal.deleteConfirm`,{name:e.print_name||e.filename}),confirmText:l(`archives.modal.deleteButton`),variant:`danger`,confirmDisabled:(w.data?.currently_printing??0)>0,onConfirm:()=>{Ae.mutate(S),x(!1),C(!1)},onCancel:()=>{x(!1),C(!1)},children:[(w.data?.related_queue_items??0)>0&&(0,G.jsx)(`div`,{className:(w.data?.currently_printing??0)>0?`text-sm text-red-600 dark:text-red-400 mb-2`:`text-sm text-amber-600 dark:text-amber-400 mb-2`,children:(w.data?.currently_printing??0)>0?l(`archives.modal.deleteBlockedByPrinting`,{count:w.data.currently_printing}):l(`archives.modal.deleteQueueItemsWarning`,{count:w.data.related_queue_items})}),(0,G.jsxs)(`label`,{className:`flex items-start gap-2 cursor-pointer text-sm text-bambu-gray`,children:[(0,G.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 accent-red-500`,checked:S,onChange:e=>C(e.target.checked)}),(0,G.jsx)(`span`,{children:l(`archives.modal.deletePurgeStats`)})]})]}),oe&&(0,G.jsx)($d,{title:l(`archives.modal.removeSource3mf`),message:l(`archives.modal.removeSource3mfConfirm`,{name:e.print_name||e.filename}),confirmText:l(`archives.modal.removeButton`),variant:`danger`,onConfirm:()=>{Te.mutate(),se(!1)},onCancel:()=>se(!1)}),H&&(0,G.jsx)($d,{title:l(`archives.modal.removeF3d`),message:l(`archives.modal.removeF3dConfirm`,{name:e.print_name||e.filename}),confirmText:l(`archives.modal.removeButton`),variant:`danger`,onConfirm:()=>{De.mutate(),ce(!1)},onCancel:()=>ce(!1)}),le&&(0,G.jsx)($d,{title:l(`archives.modal.removeTimelapse`),message:l(`archives.modal.removeTimelapseConfirm`,{name:e.print_name||e.filename}),confirmText:l(`archives.modal.removeButton`),variant:`danger`,onConfirm:()=>{Se.mutate(),ue(!1)},onCancel:()=>ue(!1)}),de&&(0,G.jsx)(lE,{x:de.x,y:de.y,items:Fe,onClose:()=>fe(null)}),I&&(0,G.jsx)(V2,{archiveId:e.id,archiveName:e.print_name||e.filename,printerName:t,onClose:()=>L(!1)}),P&&e.timelapse_path&&(0,G.jsx)(B2,{src:Z.getArchiveTimelapse(e.id),title:l(`archives.modal.timelapse`,{name:e.print_name||e.filename}),downloadFilename:`${e.print_name||e.filename}_timelapse.mp4`,archiveId:e.id,onClose:()=>F(!1),onEdit:()=>{d.invalidateQueries({queryKey:[`archives`]}),F(!1)}}),R&&B.length>0&&(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/80 flex items-center justify-center z-50 p-4`,children:(0,G.jsxs)(`div`,{className:`bg-card-dark rounded-lg max-w-lg w-full max-h-[80vh] flex flex-col`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-gray-700`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:l(`archives.modal.selectTimelapse`)}),(0,G.jsx)(`p`,{className:`text-sm text-gray-400 mt-1`,children:l(`archives.modal.selectTimelapseDesc`)})]}),(0,G.jsx)(`button`,{onClick:()=>{z(!1),V([])},className:`text-gray-400 hover:text-white p-1`,children:(0,G.jsx)(Zu,{className:`w-5 h-5`})})]}),(0,G.jsx)(`div`,{className:`overflow-y-auto flex-1 p-2`,children:B.map(e=>(0,G.jsxs)(`button`,{onClick:()=>ke.mutate(e.name),disabled:ke.isPending,className:`w-full text-left p-3 rounded-lg hover:bg-gray-700 transition-colors mb-1`,children:[(0,G.jsx)(`div`,{className:`font-medium text-white`,children:e.name}),(0,G.jsxs)(`div`,{className:`text-sm text-gray-400 flex gap-3`,children:[(0,G.jsx)(`span`,{children:Bd(e.size)}),e.mtime&&(0,G.jsx)(`span`,{children:Xf(e.mtime)})]})]},e.name))})]})}),ee&&(0,G.jsx)(tG,{archiveId:e.id,archiveName:e.print_name||e.filename,onClose:()=>te(!1)}),ne&&e.photos&&(0,G.jsx)(nG,{archiveId:e.id,archiveName:e.print_name||e.filename,photos:e.photos,onClose:()=>re(!1),onDelete:async t=>{try{await Z.deleteArchivePhoto(e.id,t),d.invalidateQueries({queryKey:[`archives`]}),p(l(`archives.toast.photoDeleted`))}catch{p(l(`archives.toast.failedDeletePhoto`),`error`)}}}),ie&&(0,G.jsx)(z2,{archiveId:e.id,archiveName:e.print_name||e.filename,onClose:()=>ae(!1)}),(0,G.jsx)(`input`,{ref:pe,type:`file`,accept:`.3mf`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&we.mutate(t),e.target.value=``}}),(0,G.jsx)(`input`,{ref:me,type:`file`,accept:`.f3d`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&Ee.mutate(t),e.target.value=``}}),(0,G.jsx)(`input`,{ref:he,type:`file`,accept:`.mp4,.avi,.mkv`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&Ce.mutate(t),e.target.value=``}})]})}var ZVe=[`completed`,`failed`,`aborted`,`cancelled`,`stopped`],QVe=[{id:`all`,label:`All Archives`,icon:(0,G.jsx)(fc,{className:`w-4 h-4`})},{id:`recent`,label:`Last 24 Hours`,icon:(0,G.jsx)(Ts,{className:`w-4 h-4`})},{id:`this-week`,label:`This Week`,icon:(0,G.jsx)($o,{className:`w-4 h-4`})},{id:`this-month`,label:`This Month`,icon:(0,G.jsx)($o,{className:`w-4 h-4`})},{id:`favorites`,label:`Favorites`,icon:(0,G.jsx)(mu,{className:`w-4 h-4`})},{id:`not-printed`,label:`Not Printed`,icon:(0,G.jsx)(Iu,{className:`w-4 h-4`})},{id:`printed`,label:`Printed`,icon:(0,G.jsx)(jl,{className:`w-4 h-4`})},{id:`failed`,label:`Failed Prints`,icon:(0,G.jsx)(ps,{className:`w-4 h-4`})},{id:`duplicates`,label:`Duplicates`,icon:(0,G.jsx)(Fs,{className:`w-4 h-4`})}];function $Ve(){let{t:e}=U(),t=no(),{showToast:n}=Hd(),{hasPermission:r,hasAnyPermission:i}=Od(),a=(0,f.useRef)(null),[o,s]=(0,f.useState)(``),[c,l]=(0,f.useState)(()=>{let e=localStorage.getItem(`archiveFilterPrinter`);return e?Number(e):null}),[u,d]=(0,f.useState)(()=>localStorage.getItem(`archiveFilterMaterial`)),[p,m]=(0,f.useState)(()=>{let e=localStorage.getItem(`archiveFilterColors`);return e?new Set(JSON.parse(e)):new Set}),[h,g]=(0,f.useState)(()=>localStorage.getItem(`archiveColorFilterMode`)||`or`),[_,v]=(0,f.useState)(()=>localStorage.getItem(`archiveFilterFavorites`)===`true`),[y,b]=(0,f.useState)(()=>localStorage.getItem(`archiveHideFailed`)===`true`),[x,S]=(0,f.useState)(()=>localStorage.getItem(`archiveFilterUnconfirmed`)===`true`),[C,w]=(0,f.useState)(()=>localStorage.getItem(`archiveHideDuplicates`)===`true`),[T,E]=(0,f.useState)(()=>localStorage.getItem(`archiveFilterTag`)),[D,O]=(0,f.useState)(()=>localStorage.getItem(`archiveFilterFileType`)||`all`),[k,A]=(0,f.useState)(!1),[j,M]=(0,f.useState)([]),[N,P]=(0,f.useState)(new Set),[F,I]=(0,f.useState)(()=>localStorage.getItem(`archiveNo3MFWarningDismissed`)===`true`),{data:L}=K({queryKey:[`archives`,`no-3mf-warning`],queryFn:Z.getNo3MFWarning,staleTime:300*1e3,enabled:!F}),R=()=>{localStorage.setItem(`archiveNo3MFWarningDismissed`,`true`),I(!0)},z=L?.reason===`ftps_cooloff`?`FtpsCooloff`:L?.reason===`ftp_transfer_failed`?`FtpTransferFailed`:L?.reason===`internal_storage`?`InternalStorage`:L?.reason===`no_external_storage`?`NoExternalStorage`:L?.reason===`internal_history`?`InternalHistory`:``,B=L?.reason===`ftps_cooloff`?`https://wiki.bambuddy.cool/reference/troubleshooting/#ftps-tls-failure`:L?.reason===`ftp_transfer_failed`?`https://wiki.bambuddy.cool/reference/troubleshooting/#ftp-transfer-timed-out`:L?.reason===`internal_storage`?`https://wiki.bambuddy.cool/reference/troubleshooting/#archive-card-has-only-a-name`:L?.reason===`no_external_storage`?null:L?.reason===`internal_history`?`https://wiki.bambuddy.cool/reference/troubleshooting/#print-started-on-the-printer-has-no-thumbnail`:`https://wiki.bambuddy.cool/getting-started/#step-4-enable-store-sent-files-on-external-storage`,[V,ee]=(0,f.useState)(!1),[te,ne]=(0,f.useState)(!1),[re,ie]=(0,f.useState)(!1),[ae,oe]=(0,f.useState)(!1),[se,H]=(0,f.useState)(()=>localStorage.getItem(`archiveViewMode`)||`grid`),[ce,le]=(0,f.useState)(()=>localStorage.getItem(`archiveSortBy`)||`date-desc`),[ue,de]=(0,f.useState)(()=>localStorage.getItem(`archiveCollection`)||`all`),[fe,pe]=(0,f.useState)(0),[me,he]=(0,f.useState)(()=>{try{let e=localStorage.getItem(`archivePageSize`);return e?Number(e):50}catch{return 50}}),[ge,_e]=(0,f.useState)(!1),[ve,ye]=(0,f.useState)(!1),[be,xe]=(0,f.useState)(!1),[Se,Ce]=(0,f.useState)(!1),[we,Te]=(0,f.useState)(!1),[Ee,De]=(0,f.useState)(null),[Oe,ke]=(0,f.useState)(null),[Ae,je]=(0,f.useState)(()=>localStorage.getItem(`logFilterUser`)||null),[Me,Ne]=(0,f.useState)(()=>localStorage.getItem(`logFilterStatus`)),[Pe,Fe]=(0,f.useState)(()=>localStorage.getItem(`logFilterDateFrom`)||``),[Ie,Le]=(0,f.useState)(()=>localStorage.getItem(`logFilterDateTo`)||``),[Re,ze]=(0,f.useState)(()=>{let e=localStorage.getItem(`logOffset`);return e?Number(e):0}),[Be,Ve]=(0,f.useState)(!1),[He,Ue]=(0,f.useState)(null),[We,Ge]=(0,f.useState)(null),[Ke,qe]=(0,f.useState)(``),[Je,Ye]=(0,f.useState)(``),[Xe,Ze]=(0,f.useState)(()=>{let e=localStorage.getItem(`logPageSize`);return e?Number(e):25}),[Qe,$e]=(0,f.useState)(WVe),[et,tt]=(0,f.useState)(!1),[nt,rt]=(0,f.useState)(KVe),it=(0,f.useMemo)(()=>Qe.filter(e=>e.visible).map(e=>e.id),[Qe]),at=(0,f.useCallback)(e=>{ke(e),De(e)},[]);(0,f.useEffect)(()=>{if(Ee){let t=setTimeout(()=>{let t=document.querySelector(`[data-archive-id="${Ee}"]`);t?t.scrollIntoView({behavior:`smooth`,block:`center`}):Oe===Ee&&n(e(`archives.originalPrintNotVisible`),`warning`),Oe===Ee&&ke(null)},100),r=setTimeout(()=>De(null),5e3);return()=>{clearTimeout(t),clearTimeout(r)}}},[Ee,Oe,n,e]);let{data:ot,isLoading:st}=K({queryKey:[`archives`,c],queryFn:()=>Z.getArchives(c||void 0)}),{data:ct}=K({queryKey:[`printers`],queryFn:Z.getPrinters}),{data:lt}=K({queryKey:[`projects`],queryFn:()=>Z.getProjects()}),{data:ut}=K({queryKey:[`settings`],queryFn:Z.getSettings}),{data:dt}=K({queryKey:[`users`,`slim`],queryFn:Z.getUsersSlim,enabled:se===`log`}),{data:ft,isLoading:pt}=K({queryKey:[`print-log`,c,Ae,Me,Pe,Ie,o,Re,Xe,nt.column,nt.direction],queryFn:()=>Z.getPrintLog({search:o||void 0,printerId:c||void 0,username:Ae||void 0,status:Me||void 0,dateFrom:Pe||void 0,dateTo:Ie||void 0,limit:Xe,offset:Re,sortBy:nt.column,sortDir:nt.direction}),enabled:se===`log`}),mt=ut?.time_format||`system`,ht=qW(ut?.open_in_slicer,ut?.preferred_slicer),gt=ut?.use_slicer_api??!1,_t=Af(ut?.currency||`USD`),vt=(0,f.useMemo)(()=>Qe.map(t=>({...t,label:e(U2[t.id]??t.id)})),[Qe,e]),yt=(0,f.useMemo)(()=>W2.map(t=>({...t,label:e(U2[t.id]??t.id)})),[e]),bt=(0,f.useCallback)(e=>{K2.has(e)&&(rt(t=>{let n=t.column===e?{column:e,direction:t.direction===`asc`?`desc`:`asc`}:{column:e,direction:[`date`,`completed_at`,`duration`,`filament_used`,`cost`,`energy`,`energy_cost`].includes(e)?`desc`:`asc`};return qVe(n),n}),ze(0))},[]),xt=(0,f.useCallback)(e=>{let t=e.map(e=>({id:e.id,visible:e.visible}));$e(t),JVe(t)},[]),St=(0,f.useMemo)(()=>new Set([`duration`,`filament_used`,`cost`,`energy`,`energy_cost`]),[]),Ct=(0,f.useCallback)((t,n)=>{switch(t){case`date`:return(0,G.jsx)(`span`,{className:`text-white whitespace-nowrap`,children:Zf(n.started_at||n.created_at,mt)});case`completed_at`:return(0,G.jsx)(`span`,{className:`text-bambu-gray-light whitespace-nowrap`,children:n.completed_at?Zf(n.completed_at,mt):`—`});case`print_name`:return(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n.thumbnail_path&&(0,G.jsx)(`img`,{src:Z.getPrintLogThumbnail(n.id),alt:``,className:`w-8 h-8 rounded object-cover flex-shrink-0`,onError:e=>{e.target.style.display=`none`}}),(0,G.jsx)(`span`,{className:`text-white break-words`,title:n.print_name||``,children:n.print_name||`—`})]});case`printer`:return(0,G.jsx)(`span`,{className:`text-bambu-gray-light`,children:n.printer_name||`—`});case`user`:return(0,G.jsx)(`span`,{className:`text-bambu-gray-light`,children:n.created_by_username||`—`});case`status`:return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${n.status===`completed`?`bg-green-100 dark:bg-green-500/20 text-green-700 dark:text-green-400`:n.status===`failed`?`bg-red-100 dark:bg-red-500/20 text-red-700 dark:text-red-400`:n.status===`stopped`?`bg-yellow-100 dark:bg-yellow-500/20 text-yellow-700 dark:text-yellow-400`:n.status===`cancelled`?`bg-orange-100 dark:bg-orange-500/20 text-orange-700 dark:text-orange-400`:n.status===`skipped`?`bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400`:`bg-gray-500/20 text-gray-400`}`,children:n.status}),n.failure_reason&&(0,G.jsx)(`span`,{className:`block text-[10px] text-bambu-gray mt-0.5`,children:e(`editArchive.failureReasons.${n.failure_reason}`,{defaultValue:n.failure_reason})})]});case`duration`:return(0,G.jsx)(`span`,{className:`text-bambu-gray-light whitespace-nowrap`,children:n.duration_seconds?ep(n.duration_seconds):`—`});case`filament`:return(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[n.filament_color&&(0,G.jsx)(`div`,{className:`flex items-center gap-0.5 flex-wrap`,children:n.filament_color.split(`,`).map((e,t)=>{let n=e.trim();return(0,G.jsx)(`span`,{className:`w-3 h-3 rounded-full border border-black/20 flex-shrink-0`,style:{backgroundColor:n.startsWith(`#`)?n:void 0},title:n},t)})}),(0,G.jsx)(`span`,{className:`text-bambu-gray-light text-xs`,children:n.filament_type||`—`})]});case`filament_used`:return(0,G.jsx)(`span`,{className:`text-bambu-gray-light whitespace-nowrap tabular-nums`,children:n.filament_used_grams==null?`—`:`${n.filament_used_grams.toFixed(1)} g`});case`cost`:return(0,G.jsx)(`span`,{className:`text-bambu-gray-light whitespace-nowrap tabular-nums`,children:n.cost==null?`—`:`${_t}${n.cost.toFixed(2)}`});case`energy`:return(0,G.jsx)(`span`,{className:`text-bambu-gray-light whitespace-nowrap tabular-nums`,children:n.energy_kwh==null?`—`:`${n.energy_kwh.toFixed(2)} kWh`});case`energy_cost`:return(0,G.jsx)(`span`,{className:`text-bambu-gray-light whitespace-nowrap tabular-nums`,children:n.energy_cost==null?`—`:`${_t}${n.energy_cost.toFixed(2)}`});default:return null}},[_t,e,mt]),wt=q({mutationFn:async e=>(await Promise.all(e.map(e=>Z.deleteArchive(e))),e.length),onSuccess:e=>{Bp(t),P(new Set),n(`${e} archive${e===1?``:`s`} deleted`)},onError:()=>{n(e(`archives.toast.failedDeleteArchives`),`error`)}}),Tt=q({mutationFn:()=>Z.clearPrintLog(),onSuccess:r=>{t.invalidateQueries({queryKey:[`print-log`]}),ze(0),n(e(`archives.log.cleared`,{count:r.deleted}))},onError:()=>{n(e(`archives.log.clearFailed`),`error`)}}),Et=q({mutationFn:e=>Z.deletePrintLogEntry(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`print-log`]}),t.invalidateQueries({queryKey:[`archives-stats`]}),n(e(`archives.log.entryDeleted`))},onError:()=>{n(e(`archives.log.entryDeleteFailed`),`error`)}}),Dt=q({mutationFn:({id:e,body:t})=>Z.updatePrintLogEntry(e,t),onSuccess:()=>{t.invalidateQueries({queryKey:[`print-log`]}),t.invalidateQueries({queryKey:[`archives-stats`]}),Ge(null),n(e(`archives.log.entryUpdated`))},onError:()=>{n(e(`archives.log.entryUpdateFailed`),`error`)}});(0,f.useEffect)(()=>{c===null?localStorage.removeItem(`archiveFilterPrinter`):localStorage.setItem(`archiveFilterPrinter`,c.toString())},[c]),(0,f.useEffect)(()=>{u?localStorage.setItem(`archiveFilterMaterial`,u):localStorage.removeItem(`archiveFilterMaterial`)},[u]),(0,f.useEffect)(()=>{localStorage.setItem(`archiveFilterColors`,JSON.stringify([...p]))},[p]),(0,f.useEffect)(()=>{localStorage.setItem(`archiveColorFilterMode`,h)},[h]),(0,f.useEffect)(()=>{localStorage.setItem(`archiveFilterFavorites`,_.toString())},[_]),(0,f.useEffect)(()=>{localStorage.setItem(`archiveHideFailed`,y.toString())},[y]),(0,f.useEffect)(()=>{localStorage.setItem(`archiveFilterUnconfirmed`,x.toString())},[x]),(0,f.useEffect)(()=>{localStorage.setItem(`archiveHideDuplicates`,C.toString())},[C]),(0,f.useEffect)(()=>{T?localStorage.setItem(`archiveFilterTag`,T):localStorage.removeItem(`archiveFilterTag`)},[T]),(0,f.useEffect)(()=>{localStorage.setItem(`archiveFilterFileType`,D)},[D]),(0,f.useEffect)(()=>{pe(0)},[o,c,u,p,h,_,y,x,C,T,D,ce,ue]),(0,f.useEffect)(()=>{try{localStorage.setItem(`archivePageSize`,String(me))}catch{}},[me]),(0,f.useEffect)(()=>{localStorage.setItem(`archiveViewMode`,se)},[se]),(0,f.useEffect)(()=>{localStorage.setItem(`archiveSortBy`,ce)},[ce]),(0,f.useEffect)(()=>{localStorage.setItem(`archiveCollection`,ue)},[ue]),(0,f.useEffect)(()=>{Ae?localStorage.setItem(`logFilterUser`,Ae):localStorage.removeItem(`logFilterUser`)},[Ae]),(0,f.useEffect)(()=>{Me?localStorage.setItem(`logFilterStatus`,Me):localStorage.removeItem(`logFilterStatus`)},[Me]),(0,f.useEffect)(()=>{Pe?localStorage.setItem(`logFilterDateFrom`,Pe):localStorage.removeItem(`logFilterDateFrom`)},[Pe]),(0,f.useEffect)(()=>{Ie?localStorage.setItem(`logFilterDateTo`,Ie):localStorage.removeItem(`logFilterDateTo`)},[Ie]),(0,f.useEffect)(()=>{localStorage.setItem(`logOffset`,Re.toString())},[Re]),(0,f.useEffect)(()=>{localStorage.setItem(`logPageSize`,Xe.toString())},[Xe]);let Ot=(0,f.useMemo)(()=>new Map(ct?.map(e=>[e.id,e.name])||[]),[ct]),kt=[...new Set(ot?.flatMap(e=>e.filament_type?.split(`, `)||[]).filter(Boolean)||[])].sort(),At=[...new Set(ot?.flatMap(e=>e.filament_color?.split(`,`)||[]).filter(Boolean)||[])],jt=[...new Set(ot?.flatMap(e=>e.tags?.split(`,`).map(e=>e.trim())||[]).filter(Boolean)||[])].sort(),Mt=ot?.filter(e=>{let t=new Date,n=Jf(e.created_at)||new Date(0),r=!0;switch(ue){case`recent`:r=t.getTime()-n.getTime()<1440*60*1e3;break;case`this-week`:r=t.getTime()-n.getTime()<10080*60*1e3;break;case`this-month`:r=n.getMonth()===t.getMonth()&&n.getFullYear()===t.getFullYear();break;case`favorites`:r=e.is_favorite===!0;break;case`not-printed`:r=e.status===`archived`;break;case`printed`:r=ZVe.includes(e.status);break;case`failed`:r=e.status===`failed`||e.status===`aborted`;break;case`duplicates`:r=e.duplicate_count>0;break}let i=(e.print_name||e.filename).toLowerCase().includes(o.toLowerCase()),a=!u||e.filament_type?.split(`, `).includes(u),s=e.filament_color?.split(`,`)||[],c=p.size===0||(h===`or`?s.some(e=>p.has(e)):[...p].every(e=>s.includes(e))),l=ue===`favorites`||!_||e.is_favorite,d=ue===`failed`||!y||e.status!==`failed`&&e.status!==`aborted`,f=!x||e.confirm_requested&&e.user_verdict==null,m=ue===`duplicates`||!C||e.duplicate_count===0||e.duplicate_sequence===0,g=e.tags?.split(`,`).map(e=>e.trim())||[],v=!T||g.includes(T),b=q2(e);return r&&i&&a&&c&&l&&d&&f&&m&&v&&(D===`all`||D===`gcode`&&b||D===`source`&&!b)}).sort((e,t)=>{switch(ce){case`date-desc`:return(Jf(t.created_at)?.getTime()||0)-(Jf(e.created_at)?.getTime()||0);case`date-asc`:return(Jf(e.created_at)?.getTime()||0)-(Jf(t.created_at)?.getTime()||0);case`name-asc`:return(e.print_name||e.filename).localeCompare(t.print_name||t.filename);case`name-desc`:return(t.print_name||t.filename).localeCompare(e.print_name||e.filename);case`size-desc`:return t.file_size-e.file_size;case`size-asc`:return e.file_size-t.file_size;default:return 0}}),Nt=Mt?.length||0,Pt=me===-1,Ft=Pt?Nt||1:me,It=Math.max(1,Math.ceil(Nt/Ft)),Lt=Pt?Mt:Mt?.slice(fe*Ft,(fe+1)*Ft);(0,f.useEffect)(()=>{if(Ee&&Mt&&!Pt){let e=Mt.findIndex(e=>e.id===Ee);if(e>=0){let t=Math.floor(e/Ft);t!==fe&&pe(t)}}},[Ee]);let Rt=V||N.size>0,zt=e=>{P(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Bt=()=>{Mt&&P(new Set(Mt.map(e=>e.id)))},Vt=()=>{P(new Set),ee(!1)},Ht=e=>{m(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Ut=()=>{m(new Set)},Wt=()=>{s(``),l(null),d(null),v(!1),b(!1),S(!1),w(!1),E(null),O(`all`)},Gt=o||c||u||_||y||x||C||T||D!==`all`,{isDraggingOver:Kt,dragHandlers:qt}=QW({disabled:k,extensions:[`.3mf`],onFiles:e=>{M(e),A(!0)},onRejected:()=>n(e(`archives.page.only3mfSupported`),`warning`)}),Jt=(0,f.useCallback)(e=>{let t=e.target;if(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable){e.key===`Escape`&&t.blur();return}switch(e.key){case`/`:e.preventDefault(),a.current?.focus();break;case`u`:case`U`:!e.metaKey&&!e.ctrlKey&&(e.preventDefault(),A(!0));break;case`Escape`:Rt&&Vt();break}},[Rt]);return(0,f.useEffect)(()=>(document.addEventListener(`keydown`,Jt),()=>document.removeEventListener(`keydown`,Jt)),[Jt]),(0,G.jsxs)(`div`,{className:`p-4 md:p-8 relative`,...qt,children:[Kt&&(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)(Iu,{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(`archives.page.dropFilesHere`)}),(0,G.jsx)(`p`,{className:`text-bambu-gray`,children:e(`archives.releaseToUpload`)})]})}),Rt&&(0,G.jsxs)(`div`,{className:`fixed bottom-6 left-1/2 -translate-x-1/2 z-40 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl px-4 py-3 flex items-center gap-4`,children:[(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:Vt,children:[(0,G.jsx)(Zu,{className:`w-4 h-4`}),`Close`]}),(0,G.jsx)(`div`,{className:`w-px h-6 bg-bambu-dark-tertiary`}),(0,G.jsxs)(`span`,{className:`text-white font-medium`,children:[N.size,` selected`]}),(0,G.jsx)(`div`,{className:`w-px h-6 bg-bambu-dark-tertiary`}),(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:Bt,children:`Select All`}),(0,G.jsx)(`div`,{className:`w-px h-6 bg-bambu-dark-tertiary`}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:()=>ie(!0),disabled:!i(`archives:update_own`,`archives:update_all`),title:i(`archives:update_own`,`archives:update_all`)?void 0:e(`archives.permission.noUpdateArchives`),children:[(0,G.jsx)(yu,{className:`w-4 h-4`}),`Tags`]}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:()=>oe(!0),disabled:!i(`archives:update_own`,`archives:update_all`),title:i(`archives:update_own`,`archives:update_all`)?void 0:e(`archives.permission.noUpdateArchives`),children:[(0,G.jsx)(dc,{className:`w-4 h-4`}),`Project`]}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,disabled:!i(`archives:update_own`,`archives:update_all`),title:i(`archives:update_own`,`archives:update_all`)?void 0:e(`archives.permission.noUpdateArchives`),onClick:()=>{let r=Array.from(N);Promise.all(r.map(e=>Z.toggleFavorite(e))).then(()=>{t.invalidateQueries({queryKey:[`archives`]}),n(`Toggled favorites for ${r.length} archive${r.length===1?``:`s`}`)}).catch(()=>{n(e(`archives.toast.failedUpdateFavorites`),`error`)})},children:[(0,G.jsx)(mu,{className:`w-4 h-4`}),`Favorite`]}),(0,G.jsxs)(Q,{size:`sm`,className:`bg-red-500 hover:bg-red-600`,onClick:()=>ne(!0),disabled:!i(`archives:delete_own`,`archives:delete_all`),title:i(`archives:delete_own`,`archives:delete_all`)?void 0:e(`archives.permission.noDelete`),children:[(0,G.jsx)(ku,{className:`w-4 h-4`}),`Delete`]})]}),L?.has_fallback&&!F&&(0,G.jsxs)(`div`,{className:`mb-6 rounded-lg border border-amber-300 dark:border-amber-500/30 bg-amber-50 dark:bg-amber-500/10 px-4 py-3 flex items-start gap-3`,children:[(0,G.jsx)(ps,{className:`w-5 h-5 text-amber-600 dark:text-amber-400 flex-shrink-0 mt-0.5`}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-amber-900 dark:text-amber-200`,children:e(`archives.no3mfBanner.title${z}`)}),(0,G.jsxs)(`div`,{className:`text-xs text-amber-800/90 dark:text-amber-200/80 mt-1`,children:[e(`archives.no3mfBanner.body${z}`),B&&(0,G.jsxs)(G.Fragment,{children:[` `,(0,G.jsxs)(`a`,{href:B,target:`_blank`,rel:`noreferrer`,className:`underline hover:text-amber-900 dark:hover:text-amber-100 inline-flex items-center gap-1`,children:[e(L?.reason===`internal_storage`||L?.reason===`internal_history`||L?.reason===`ftps_cooloff`||L?.reason===`ftp_transfer_failed`?`archives.no3mfBanner.docsLinkInternalStorage`:`archives.no3mfBanner.docsLink`),(0,G.jsx)(Zs,{className:`w-3 h-3`})]})]})]})]}),(0,G.jsx)(`button`,{onClick:R,className:`text-amber-800/70 dark:text-amber-200/60 hover:text-amber-900 dark:hover:text-amber-200 flex-shrink-0 p-1 -m-1`,title:e(`archives.no3mfBanner.dismissLabel`),"aria-label":e(`archives.no3mfBanner.dismissLabel`),children:(0,G.jsx)(Zu,{className:`w-4 h-4`})})]}),(0,G.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-8`,children:[(0,G.jsx)(`div`,{children:(0,G.jsxs)(`div`,{className:`flex items-start 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)(Oo,{className:`w-7 h-7 text-bambu-green`}),`Archives`]}),(0,G.jsxs)(`p`,{className:`text-bambu-gray mt-1`,children:[Mt?.length||0,` of `,ot?.length||0,` prints`]})]}),(0,G.jsx)(`select`,{className:`mt-0.5 px-3 py-1.5 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-bambu-gray-light text-sm focus:border-bambu-green focus:outline-none`,value:ue,onChange:e=>de(e.target.value),children:QVe.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.label},e.id))})]})}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 sm:gap-3 flex-wrap`,children:[(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>_e(!ge),disabled:ve,children:[ve?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(ac,{className:`w-4 h-4`}),`Export`]}),ge&&(0,G.jsxs)(`div`,{className:`absolute right-0 top-full mt-1 w-48 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl z-20`,children:[(0,G.jsxs)(`button`,{className:`w-full px-4 py-2 text-left text-white hover:bg-bambu-dark-tertiary transition-colors flex items-center gap-2 rounded-t-lg`,onClick:async()=>{_e(!1),ye(!0);try{let{blob:t,filename:r}=await Z.exportArchives({format:`csv`,printerId:c||void 0,status:ue===`failed`?`failed`:void 0,search:o||void 0}),i=URL.createObjectURL(t),a=document.createElement(`a`);a.href=i,a.download=r,a.click(),URL.revokeObjectURL(i),n(e(`archives.toast.exportDownloaded`))}catch{n(e(`archives.toast.exportFailed`),`error`)}finally{ye(!1)}},children:[(0,G.jsx)(oc,{className:`w-4 h-4`}),`Export as CSV`]}),(0,G.jsxs)(`button`,{className:`w-full px-4 py-2 text-left text-white hover:bg-bambu-dark-tertiary transition-colors flex items-center gap-2 rounded-b-lg`,onClick:async()=>{_e(!1),ye(!0);try{let{blob:t,filename:r}=await Z.exportArchives({format:`xlsx`,printerId:c||void 0,status:ue===`failed`?`failed`:void 0,search:o||void 0}),i=URL.createObjectURL(t),a=document.createElement(`a`);a.href=i,a.download=r,a.click(),URL.revokeObjectURL(i),n(e(`archives.toast.exportDownloaded`))}catch{n(e(`archives.toast.exportFailed`),`error`)}finally{ye(!1)}},children:[(0,G.jsx)(ac,{className:`w-4 h-4`}),`Export as Excel`]})]})]}),N.size>=2&&N.size<=5&&(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>xe(!0),children:[(0,G.jsx)(Sc,{className:`w-4 h-4`}),`Compare (`,N.size,`)`]}),!Rt&&(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>ee(!0),children:[(0,G.jsx)(du,{className:`w-4 h-4`}),`Select`]}),(0,G.jsxs)(Q,{onClick:()=>A(!0),disabled:!r(`archives:create`),title:r(`archives:create`)?void 0:e(`archives.permission.noCreate`),children:[(0,G.jsx)(Iu,{className:`w-4 h-4`}),`Upload 3MF`]}),r(`archives:purge`)&&(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>Te(!0),title:e(`archivePurge.headerTooltip`),children:[(0,G.jsx)(ku,{className:`w-4 h-4 mr-2`}),e(`archivePurge.headerButton`)]})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center border border-bambu-dark-tertiary rounded-lg overflow-hidden flex-shrink-0 w-fit mb-4`,children:[(0,G.jsx)(`button`,{className:`p-2 ${se===`grid`?`bg-bambu-green text-white`:`bg-bambu-dark text-bambu-gray hover:text-white`}`,onClick:()=>H(`grid`),title:e(`archives.gridView`),children:(0,G.jsx)(Uc,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{className:`p-2 ${se===`list`?`bg-bambu-green text-white`:`bg-bambu-dark text-bambu-gray hover:text-white`}`,onClick:()=>H(`list`),title:e(`archives.listView`),children:(0,G.jsx)(Jc,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{className:`p-2 ${se===`calendar`?`bg-bambu-green text-white`:`bg-bambu-dark text-bambu-gray hover:text-white`}`,onClick:()=>H(`calendar`),title:e(`archives.calendarView`),children:(0,G.jsx)(Qo,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{className:`p-2 ${se===`log`?`bg-bambu-green text-white`:`bg-bambu-dark text-bambu-gray hover:text-white`}`,onClick:()=>H(`log`),title:e(`archives.logView`),children:(0,G.jsx)(Cs,{className:`w-4 h-4`})})]}),se!==`log`&&(0,G.jsx)(Pd,{className:`mb-6`,children:(0,G.jsxs)(Id,{className:`py-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col md:flex-row gap-3 md:gap-4 md:items-center md:flex-wrap`,children:[(0,G.jsxs)(`div`,{className:`w-full md:flex-1 relative md:min-w-[200px]`,children:[(0,G.jsx)(Gl,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray`}),(0,G.jsx)(`input`,{ref:a,type:`text`,placeholder:e(`archives.searchPlaceholder`),className:`w-full pl-10 pr-4 py-3 md:py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,value:o,onChange:e=>s(e.target.value)})]}),(0,G.jsxs)(`div`,{className:`flex gap-2 md:gap-4 overflow-x-auto pb-1 md:pb-0 -mx-4 px-4 md:mx-0 md:px-0 md:flex-wrap scrollbar-hide`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,G.jsx)(vc,{className:`w-4 h-4 text-bambu-gray hidden md:block`}),(0,G.jsxs)(`select`,{className:`px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,value:c||``,onChange:e=>l(e.target.value?Number(e.target.value):null),children:[(0,G.jsx)(`option`,{value:``,children:`All Printers`}),ct?.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,G.jsx)(gl,{className:`w-4 h-4 text-bambu-gray hidden md:block`}),(0,G.jsxs)(`select`,{className:`px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,value:u||``,onChange:e=>d(e.target.value||null),children:[(0,G.jsx)(`option`,{value:``,children:`All Materials`}),kt.map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,G.jsx)(nc,{className:`w-4 h-4 text-bambu-gray hidden md:block`}),(0,G.jsxs)(`select`,{className:`px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,value:D,onChange:e=>O(e.target.value),children:[(0,G.jsx)(`option`,{value:`all`,children:`All Files`}),(0,G.jsx)(`option`,{value:`gcode`,children:`Sliced (GCODE)`}),(0,G.jsx)(`option`,{value:`source`,children:`Source Only`})]})]}),(0,G.jsxs)(`button`,{onClick:()=>v(!_),className:`flex items-center gap-2 px-3 py-2 rounded-lg border transition-colors flex-shrink-0 ${_?`bg-yellow-100 dark:bg-yellow-500/20 border-yellow-500 text-yellow-700 dark:text-yellow-400`:`bg-bambu-dark border-bambu-dark-tertiary text-bambu-gray hover:text-white`}`,title:e(_?`archives.showAll`:`archives.showFavoritesOnly`),children:[(0,G.jsx)(mu,{className:`w-4 h-4 ${_?`fill-yellow-400`:``}`}),(0,G.jsx)(`span`,{className:`text-sm hidden md:inline`,children:`Favorites`})]}),(0,G.jsxs)(`button`,{onClick:()=>b(!y),className:`flex items-center gap-2 px-3 py-2 rounded-lg border transition-colors flex-shrink-0 ${y?`bg-red-100 dark:bg-red-500/20 border-red-500 text-red-700 dark:text-red-400`:`bg-bambu-dark border-bambu-dark-tertiary text-bambu-gray hover:text-white`}`,title:e(y?`archives.showFailedPrints`:`archives.hideFailedPrints`),children:[(0,G.jsx)(ps,{className:`w-4 h-4 `}),(0,G.jsx)(`span`,{className:`text-sm hidden md:inline`,children:`Hide Failed`})]}),(0,G.jsxs)(`button`,{onClick:()=>S(!x),className:`flex items-center gap-2 px-3 py-2 rounded-lg border transition-colors flex-shrink-0 ${x?`bg-amber-100 dark:bg-amber-500/20 border-amber-500 text-amber-700 dark:text-amber-400`:`bg-bambu-dark border-bambu-dark-tertiary text-bambu-gray hover:text-white`}`,title:e(`archives.filterUnconfirmedTitle`),children:[(0,G.jsx)(Du,{className:`w-4 h-4`}),(0,G.jsx)(`span`,{className:`text-sm hidden md:inline`,children:e(`archives.filterUnconfirmed`)})]}),(0,G.jsxs)(`button`,{onClick:()=>w(!C),className:`flex items-center gap-2 px-3 py-2 rounded-lg border transition-colors flex-shrink-0 ${C?`bg-purple-100 dark:bg-purple-500/20 border-purple-500 text-purple-700 dark:text-purple-400`:`bg-bambu-dark border-bambu-dark-tertiary text-bambu-gray hover:text-white`}`,title:e(`archives.hideDuplicates`),children:[(0,G.jsx)(Fs,{className:`w-4 h-4`}),(0,G.jsx)(`span`,{className:`text-sm hidden md:inline`,children:e(`archives.hideDuplicates`)})]}),jt.length>0&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,G.jsx)(yu,{className:`w-4 h-4 text-bambu-gray hidden md:block`}),(0,G.jsxs)(`select`,{className:`px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,value:T||``,onChange:e=>E(e.target.value||null),children:[(0,G.jsx)(`option`,{value:``,children:`All Tags`}),jt.map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))]}),(0,G.jsx)(`button`,{onClick:()=>Ce(!0),className:`p-2 rounded-lg bg-bambu-dark border border-bambu-dark-tertiary text-bambu-gray hover:text-white hover:border-bambu-green transition-colors`,title:e(`archives.manageTags`),children:(0,G.jsx)(Xl,{className:`w-4 h-4`})})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,G.jsx)(Po,{className:`w-4 h-4 text-bambu-gray hidden md:block`}),(0,G.jsxs)(`select`,{className:`px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none`,value:ce,onChange:e=>le(e.target.value),children:[(0,G.jsx)(`option`,{value:`date-desc`,children:e(`archives.sortNewest`)}),(0,G.jsx)(`option`,{value:`date-asc`,children:e(`archives.sortOldest`)}),(0,G.jsxs)(`option`,{value:`name-asc`,children:[e(`archives.sortName`),` A-Z`]}),(0,G.jsxs)(`option`,{value:`name-desc`,children:[e(`archives.sortName`),` Z-A`]}),(0,G.jsx)(`option`,{value:`size-desc`,children:e(`archives.sortLargest`)}),(0,G.jsx)(`option`,{value:`size-asc`,children:e(`archives.sortSmallest`)})]})]})]}),Gt&&(0,G.jsxs)(Q,{variant:`ghost`,size:`sm`,onClick:Wt,className:`text-bambu-gray hover:text-white`,children:[(0,G.jsx)(Zu,{className:`w-4 h-4`}),`Reset`]})]}),At.length>0&&(0,G.jsxs)(`div`,{className:`flex items-center gap-3 mt-4 pt-4 border-t border-bambu-dark-tertiary`,children:[(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:`Colors:`}),p.size>1&&(0,G.jsx)(`button`,{onClick:()=>g(e=>e===`or`?`and`:`or`),className:`px-2 py-0.5 text-xs rounded transition-colors ${h===`and`?`bg-bambu-green text-white`:`bg-bambu-dark-tertiary text-bambu-gray hover:text-white`}`,title:h===`or`?`Match ANY selected color`:`Match ALL selected colors`,children:h.toUpperCase()}),(0,G.jsx)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:At.map(e=>(0,G.jsx)(`button`,{onClick:()=>Ht(e),className:`w-6 h-6 rounded-full border-2 transition-all ${p.has(e)?`border-bambu-green scale-110`:`border-white/20 hover:border-white/40`}`,style:{backgroundColor:e},title:e},e))}),p.size>0&&(0,G.jsxs)(`button`,{onClick:Ut,className:`text-xs text-bambu-gray hover:text-white flex items-center gap-1`,children:[(0,G.jsx)(Zu,{className:`w-3 h-3`}),`Clear`]})]})]})}),(0,G.jsx)(HVe,{}),st?(0,G.jsx)(`div`,{className:`text-center py-12 text-bambu-gray`,children:e(`archives.loadingArchives`)}):Mt?.length===0&&se!==`log`?(0,G.jsx)(Pd,{children:(0,G.jsxs)(Id,{className:`text-center py-12`,children:[(0,G.jsx)(`p`,{className:`text-bambu-gray`,children:e(o?`archives.noArchivesSearch`:`archives.noArchivesYet`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mt-2`,children:`Archives are created automatically when prints complete`})]})}):se===`calendar`?(0,G.jsx)(Pd,{className:`p-6`,children:(0,G.jsx)(Gje,{archives:Mt||[],onArchiveClick:e=>{s(``),H(`grid`),De(e.id)},highlightedArchiveId:Ee})}):se===`grid`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6`,children:Lt?.map(t=>(0,G.jsx)(YVe,{archive:t,printerName:t.printer_id?Ot.get(t.printer_id)||`Unknown`:t.sliced_for_model||`No Printer`,printerMap:Ot,isSelected:N.has(t.id),onSelect:zt,selectionMode:Rt,projects:lt,isHighlighted:t.id===Ee,timeFormat:mt,preferredSlicer:ht,useSlicerApi:gt,currency:_t,t:e,onNavigateToArchive:at},t.id))}),(0,G.jsx)(Y2,{pageIndex:fe,pageSize:me,totalRows:Nt,totalPages:It,onPageChange:pe,onPageSizeChange:e=>{he(e),pe(0)},t:e})]}):se===`list`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Pd,{children:(0,G.jsxs)(`div`,{className:`divide-y divide-bambu-dark-tertiary`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-12 gap-4 px-4 py-3 text-xs text-bambu-gray font-medium`,children:[(0,G.jsx)(`div`,{className:`col-span-1`}),(0,G.jsx)(`div`,{className:`col-span-4`,children:`Name`}),(0,G.jsx)(`div`,{className:`col-span-2`,children:`Printer`}),(0,G.jsx)(`div`,{className:`col-span-2`,children:`Date`}),(0,G.jsx)(`div`,{className:`col-span-1`,children:`Size`}),(0,G.jsx)(`div`,{className:`col-span-2 text-right`,children:`Actions`})]}),Lt?.map(t=>(0,G.jsx)(XVe,{archive:t,printerName:t.printer_id?Ot.get(t.printer_id)||`Unknown`:t.sliced_for_model||`No Printer`,isSelected:N.has(t.id),onSelect:zt,selectionMode:Rt,projects:lt,isHighlighted:t.id===Ee,preferredSlicer:ht,useSlicerApi:gt,t:e,onNavigateToArchive:at},t.id))]})}),(0,G.jsx)(Y2,{pageIndex:fe,pageSize:me,totalRows:Nt,totalPages:It,onPageChange:pe,onPageSizeChange:e=>{he(e),pe(0)},t:e})]}):se===`log`?(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(Pd,{children:(0,G.jsx)(Id,{className:`py-3`,children:(0,G.jsxs)(`div`,{className:`flex flex-col md:flex-row gap-3 md:items-center md:flex-wrap`,children:[(0,G.jsxs)(`div`,{className:`flex-1 relative md:min-w-[200px]`,children:[(0,G.jsx)(Gl,{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(`archives.searchPlaceholder`),className:`w-full pl-10 pr-4 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none text-sm`,value:o,onChange:e=>{s(e.target.value),ze(0)}})]}),(0,G.jsxs)(`select`,{className:`px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none text-sm`,value:c||``,onChange:e=>{l(e.target.value?Number(e.target.value):null),ze(0)},children:[(0,G.jsx)(`option`,{value:``,children:e(`archives.log.allPrinters`)}),ct?.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,G.jsxs)(`select`,{className:`px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none text-sm`,value:Ae||``,onChange:e=>{je(e.target.value||null),ze(0)},children:[(0,G.jsx)(`option`,{value:``,children:e(`archives.log.allUsers`)}),dt?.map(e=>(0,G.jsx)(`option`,{value:e.username,children:e.username},e.id))]}),(0,G.jsxs)(`select`,{className:`px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none text-sm`,value:Me||``,onChange:e=>{Ne(e.target.value||null),ze(0)},children:[(0,G.jsx)(`option`,{value:``,children:e(`archives.log.allStatuses`)}),(0,G.jsx)(`option`,{value:`completed`,children:e(`archives.status.completed`)}),(0,G.jsx)(`option`,{value:`failed`,children:e(`archives.status.failed`)}),(0,G.jsx)(`option`,{value:`stopped`,children:e(`archives.status.stopped`)}),(0,G.jsx)(`option`,{value:`cancelled`,children:e(`archives.log.cancelled`)}),(0,G.jsx)(`option`,{value:`skipped`,children:e(`archives.log.skipped`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`label`,{className:`text-sm text-bambu-gray`,children:e(`archives.log.dateFrom`)}),(0,G.jsx)(`input`,{type:`date`,className:`px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none text-sm`,value:Pe,onChange:e=>{Fe(e.target.value),ze(0)}})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`label`,{className:`text-sm text-bambu-gray`,children:e(`archives.log.dateTo`)}),(0,G.jsx)(`input`,{type:`date`,className:`px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none text-sm`,value:Ie,onChange:e=>{Le(e.target.value),ze(0)}})]}),(0,G.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>tt(!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:e(`inventory.configureColumns`),children:[(0,G.jsx)(Ns,{className:`w-4 h-4`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:e(`archives.log.columns`)})]}),(0,G.jsxs)(Q,{variant:`danger`,size:`sm`,onClick:()=>Ve(!0),disabled:!r(`archives:delete_all`)||Tt.isPending,children:[(0,G.jsx)(ku,{className:`w-4 h-4`}),e(`archives.log.clearLog`)]})]})]})})}),(0,G.jsx)(Pd,{children:pt?(0,G.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,G.jsx)(Y,{className:`w-6 h-6 animate-spin text-bambu-green`})}):ft?.items.length?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`overflow-x-auto`,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 text-bambu-gray text-left`,children:[it.map(t=>{let n=K2.has(t),r=nt.column===t,i=e(U2[t]??t);return(0,G.jsx)(`th`,{scope:`col`,"aria-sort":r?nt.direction===`asc`?`ascending`:`descending`:`none`,className:`px-4 py-3 font-medium ${St.has(t)?`text-right`:``}`,children:n?(0,G.jsxs)(`button`,{type:`button`,onClick:()=>bt(t),className:`inline-flex items-center gap-1 font-medium transition-colors hover:text-bambu-green ${r?`text-bambu-green`:``}`,title:e(`archives.log.sortBy`,{column:i}),children:[i,r?nt.direction===`asc`?(0,G.jsx)(us,{className:`w-3.5 h-3.5`}):(0,G.jsx)(ss,{className:`w-3.5 h-3.5`}):(0,G.jsx)(Po,{className:`w-3.5 h-3.5 opacity-30`})]}):i},t)}),(0,G.jsx)(`th`,{className:`px-4 py-3 font-medium w-10`,"aria-label":e(`common.actions`)})]})}),(0,G.jsx)(`tbody`,{className:`divide-y divide-bambu-dark-tertiary`,children:ft.items.map(t=>(0,G.jsxs)(`tr`,{className:`hover:bg-bambu-dark-secondary/50`,children:[it.map(e=>(0,G.jsx)(`td`,{className:`px-4 py-3 ${St.has(e)?`text-right`:``}`,children:Ct(e,t)},e)),(0,G.jsx)(`td`,{className:`px-4 py-3 text-right`,children:(0,G.jsxs)(`div`,{className:`inline-flex items-center gap-2`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>{Ge(t),qe(t.failure_reason||``),Ye(t.status)},disabled:Dt.isPending||!(r(`archives:update_all`)||r(`archives:update_own`)),title:r(`archives:update_all`)||r(`archives:update_own`)?e(`archives.log.editEntryTitle`):e(`archives.permission.noEdit`),className:`text-bambu-gray hover:text-bambu-blue disabled:opacity-40 disabled:hover:text-bambu-gray transition-colors`,children:(0,G.jsx)(Cl,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>Ue(t.id),disabled:Et.isPending||!(r(`archives:delete_all`)||r(`archives:delete_own`)),title:r(`archives:delete_all`)||r(`archives:delete_own`)?e(`archives.log.deleteEntryTitle`):e(`archives.permission.noDelete`),className:`text-bambu-gray hover:text-red-600 dark:hover:text-red-400 disabled:opacity-40 disabled:hover:text-bambu-gray transition-colors`,children:(0,G.jsx)(ku,{className:`w-4 h-4`})})]})})]},t.id))})]})}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-t border-bambu-dark-tertiary flex-wrap gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e(`archives.log.showing`,{count:Math.min(Re+Xe,ft.total),total:ft.total})}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`label`,{className:`text-xs text-bambu-gray`,children:e(`archives.log.rowsPerPage`)}),(0,G.jsxs)(`select`,{className:`px-2 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-xs focus:border-bambu-green focus:outline-none`,value:Xe,onChange:e=>{Ze(Number(e.target.value)),ze(0)},children:[(0,G.jsx)(`option`,{value:10,children:`10`}),(0,G.jsx)(`option`,{value:25,children:`25`}),(0,G.jsx)(`option`,{value:50,children:`50`}),(0,G.jsx)(`option`,{value:100,children:`100`})]})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`span`,{className:`text-sm text-bambu-gray`,children:[e(`archives.log.page`),` `,Math.floor(Re/Xe)+1,` / `,Math.max(1,Math.ceil(ft.total/Xe))]}),(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:()=>ze(Math.max(0,Re-Xe)),disabled:Re===0,children:(0,G.jsx)(ls,{className:`w-4 h-4`})}),(0,G.jsx)(Q,{variant:`secondary`,size:`sm`,onClick:()=>ze(Re+Xe),disabled:Re+Xe>=ft.total,children:(0,G.jsx)(cs,{className:`w-4 h-4`})})]})]})]}):(0,G.jsx)(`div`,{className:`text-center py-12 text-bambu-gray`,children:e(`archives.log.noEntries`)})})]}):null,k&&(0,G.jsx)(Ije,{onClose:()=>{A(!1),M([])},initialFiles:j}),we&&(0,G.jsx)(Rje,{onClose:()=>Te(!1)}),te&&(0,G.jsx)($d,{title:e(`archives.modal.deleteArchives`),message:e(`archives.modal.deleteArchivesConfirm`,{count:N.size}),confirmText:e(`archives.modal.deleteCount`,{count:N.size}),variant:`danger`,onConfirm:()=>{wt.mutate(Array.from(N)),ne(!1)},onCancel:()=>ne(!1)}),re&&(0,G.jsx)(zje,{selectedIds:Array.from(N),existingTags:jt,onClose:()=>ie(!1)}),ae&&(0,G.jsx)(Bje,{selectedIds:Array.from(N),onClose:()=>oe(!1)}),be&&N.size>=2&&N.size<=5&&(0,G.jsx)(RVe,{archiveIds:Array.from(N),onClose:()=>{xe(!1),P(new Set),ee(!1)}}),Se&&(0,G.jsx)(UVe,{onClose:()=>Ce(!1)}),(0,G.jsx)(eG,{isOpen:et,onClose:()=>tt(!1),columns:vt,defaultColumns:yt,onSave:xt}),Be&&(0,G.jsx)($d,{title:e(`archives.log.clearLogTitle`),message:e(`archives.log.clearLogConfirm`),confirmText:e(`archives.log.clearLogButton`),variant:`danger`,onConfirm:()=>{Tt.mutate(),Ve(!1)},onCancel:()=>Ve(!1)}),He!==null&&(0,G.jsx)($d,{title:e(`archives.log.deleteEntryTitle`),message:e(`archives.log.deleteEntryConfirm`),confirmText:e(`common.delete`),variant:`danger`,onConfirm:()=>{Et.mutate(He),Ue(null)},onCancel:()=>Ue(null)}),We!==null&&(0,G.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm`,onClick:()=>Ge(null),children:(0,G.jsxs)(`div`,{className:`bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg w-full max-w-md mx-4 p-6`,onClick:e=>e.stopPropagation(),children:[(0,G.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-4`,children:e(`archives.log.editEntryTitle`)}),(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray mb-4`,children:e(`archives.log.editEntryDescription`)}),(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:e(`editArchive.status`)}),(0,G.jsxs)(`select`,{value:Je,onChange:e=>Ye(e.target.value),className:`w-full px-3 py-2 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:`completed`,children:e(`archives.log.statuses.completed`,{defaultValue:`completed`})}),(0,G.jsx)(`option`,{value:`failed`,children:e(`archives.log.statuses.failed`,{defaultValue:`failed`})}),(0,G.jsx)(`option`,{value:`stopped`,children:e(`archives.log.statuses.stopped`,{defaultValue:`stopped`})}),(0,G.jsx)(`option`,{value:`cancelled`,children:e(`archives.log.statuses.cancelled`,{defaultValue:`cancelled`})}),(0,G.jsx)(`option`,{value:`skipped`,children:e(`archives.log.statuses.skipped`,{defaultValue:`skipped`})})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm text-bambu-gray mb-1`,children:e(`editArchive.failureReason`)}),(0,G.jsxs)(`select`,{value:Ke,onChange:e=>qe(e.target.value),className:`w-full px-3 py-2 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:e(`editArchive.selectReason`)}),Up.map(t=>(0,G.jsx)(`option`,{value:t,children:e(`editArchive.failureReasons.${t}`)},t))]})]})]}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-2 mt-6`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:()=>Ge(null),children:e(`common.cancel`)}),(0,G.jsx)(Q,{variant:`primary`,onClick:()=>{let e={};if(Ke!==(We.failure_reason||``)&&(e.failure_reason=Ke||null),Je!==We.status&&(e.status=Je),Object.keys(e).length===0){Ge(null);return}Dt.mutate({id:We.id,body:e})},disabled:Dt.isPending,children:Dt.isPending?e(`editArchive.saving`):e(`common.save`)})]})]})})]})}function Y2({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(`archives.prints`)}`:(0,G.jsxs)(G.Fragment,{children:[o(`archives.pagination.showing`),` `,e*c+1,` `,o(`archives.pagination.to`),` `,Math.min((e+1)*c,n),` `,o(`archives.pagination.of`),` `,n,` `,o(`archives.prints`)]})}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-bambu-gray`,children:o(`archives.pagination.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:[[25,50,100,200].map(e=>(0,G.jsx)(`option`,{value:e,children:e},e)),(0,G.jsx)(`option`,{value:-1,children:o(`archives.pagination.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)(ds,{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)(ls,{className:`w-4 h-4`})}),(0,G.jsxs)(`span`,{className:`text-bambu-gray px-2 whitespace-nowrap`,children:[o(`archives.pagination.page`),` `,e+1,` `,o(`archives.pagination.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)(cs,{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)(fs,{className:`w-4 h-4`})})]})]})]})}function eHe(){var e=[...arguments];return(0,f.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var X2=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Z2(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function Q2(e){return`nodeType`in e}function $2(e){return e?Z2(e)?e:Q2(e)?e.ownerDocument?.defaultView??window:window:window}function e4(e){let{Document:t}=$2(e);return e instanceof t}function t4(e){return Z2(e)?!1:e instanceof $2(e).HTMLElement}function n4(e){return e instanceof $2(e).SVGElement}function r4(e){return e?Z2(e)?e.document:Q2(e)?e4(e)?e:t4(e)||n4(e)?e.ownerDocument:document:document:document}var i4=X2?f.useLayoutEffect:f.useEffect;function a4(e){let t=(0,f.useRef)(e);return i4(()=>{t.current=e}),(0,f.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function tHe(){let e=(0,f.useRef)(null);return[(0,f.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,f.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function o4(e,t){t===void 0&&(t=[e]);let n=(0,f.useRef)(e);return i4(()=>{n.current!==e&&(n.current=e)},t),n}function s4(e,t){let n=(0,f.useRef)();return(0,f.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function c4(e){let t=a4(e),n=(0,f.useRef)(null);return[n,(0,f.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function l4(e){let t=(0,f.useRef)();return(0,f.useEffect)(()=>{t.current=e},[e]),t.current}var u4={};function d4(e,t){return(0,f.useMemo)(()=>{if(t)return t;let n=u4[e]==null?0:u4[e]+1;return u4[e]=n,e+`-`+n},[e,t])}function f4(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var p4=f4(1),m4=f4(-1);function nHe(e){return`clientX`in e&&`clientY`in e}function h4(e){if(!e)return!1;let{KeyboardEvent:t}=$2(e.target);return t&&e instanceof t}function rHe(e){if(!e)return!1;let{TouchEvent:t}=$2(e.target);return t&&e instanceof t}function g4(e){if(rHe(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return nHe(e)?{x:e.clientX,y:e.clientY}:null}var _4=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[_4.Translate.toString(e),_4.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),v4=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function iHe(e){return e.matches(v4)?e:e.querySelector(v4)}var aHe={display:`none`};function oHe(e){let{id:t,value:n}=e;return f.createElement(`div`,{id:t,style:aHe},n)}function sHe(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return f.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function cHe(){let[e,t]=(0,f.useState)(``);return{announce:(0,f.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var y4=(0,f.createContext)(null);function lHe(e){let t=(0,f.useContext)(y4);(0,f.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of `);return t(e)},[e,t])}function uHe(){let[e]=(0,f.useState)(()=>new Set),t=(0,f.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,f.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var dHe={draggable:` To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel. @@ -4398,7 +4398,7 @@ img.ProseMirror-separator { `});++r0&&n.push({type:`text`,value:` `}),n}function JZe(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function YZe(e,t){let n=UZe(e,t),r=n.one(e,void 0),i=AZe(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 XZe(e,t){return e&&`run`in e?async function(n,r){let i=YZe(n,{file:r,...t});await e.run(i,r)}:function(n,r){return YZe(n,{file:r,...e||t})}}function ZZe(e){if(e)throw e}var QZe=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 V7={basename:tQe,dirname:nQe,extname:rQe,join:iQe,sep:`/`};function tQe(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);H7(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 nQe(e){if(H7(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 rQe(e){H7(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 iQe(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function oQe(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 H7(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var sQe={cwd:cQe};function cQe(){return`/`}function U7(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function lQe(e){if(typeof e==`string`)e=new URL(e);else if(!U7(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];B7(o)&&B7(r)&&(r=(0,q7.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function J7(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function Y7(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function X7(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 _Qe(e){if(!B7(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function vQe(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function Z7(e){return yQe(e)?e:new dQe(e)}function yQe(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function bQe(e){return typeof e==`string`||xQe(e)}function xQe(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var SQe=[],CQe={allowDangerousHtml:!0},wQe=/^(https?|ircs?|mailto|xmpp)$/i,TQe=[{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 EQe(e){let t=DQe(e),n=OQe(e);return kQe(t.runSync(t.parse(n),n),e)}function DQe(e){let t=e.rehypePlugins||SQe,n=e.remarkPlugins||SQe,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...CQe}:CQe;return gQe().use(HXe).use(n).use(XZe,r).use(t)}function OQe(e){let t=e.children||``,n=new dQe;return typeof t==`string`?n.value=t:``+t,n}function kQe(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||AQe;for(let e of TQe)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]}),VZe(e,l),Jqe(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 o7)if(Object.hasOwn(o7,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=o7[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 AQe(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||wQe.test(e.slice(0,t))?e:``}BQe.peek=zQe;function jQe(){this.buffer()}function MQe(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function NQe(){this.buffer()}function PQe(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function FQe(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=u7(this.sliceSerialize(e)).toLowerCase(),n.label=t}function IQe(e){this.exit(e)}function LQe(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=u7(this.sliceSerialize(e)).toLowerCase(),n.label=t}function RQe(e){this.exit(e)}function zQe(){return`[`}function BQe(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 VQe(){return{enter:{gfmFootnoteCallString:jQe,gfmFootnoteCall:MQe,gfmFootnoteDefinitionLabelString:NQe,gfmFootnoteDefinition:PQe},exit:{gfmFootnoteCallString:FQe,gfmFootnoteCall:IQe,gfmFootnoteDefinitionLabelString:LQe,gfmFootnoteDefinition:RQe}}}GQe.peek=KQe;function HQe(){return{canContainEols:[`delete`],enter:{strikethrough:UQe},exit:{strikethrough:WQe}}}function UQe(e){this.enter({type:`delete`,children:[]},e)}function WQe(e){this.exit(e)}function GQe(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 KQe(){return`~`}function qQe(){return{enter:{table:JQe,tableData:ZQe,tableHeader:ZQe,tableRow:XQe},exit:{codeText:QQe,table:YQe,tableData:Q7,tableHeader:Q7,tableRow:Q7}}}function JQe(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 YQe(e){this.exit(e),this.data.inTable=void 0}function XQe(e){this.enter({type:`tableRow`,children:[]},e)}function Q7(e){this.exit(e)}function ZQe(e){this.enter({type:`tableCell`,children:[]},e)}function QQe(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,$Qe));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function $Qe(e,t){return t===`|`?t:e}function e$e(){return{exit:{taskListCheckValueChecked:t$e,taskListCheckValueUnchecked:t$e,paragraph:n$e}}}function t$e(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function n$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||g7(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(u7(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return g7(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 c$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||g7(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=u7(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return g7(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),b7(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function l$e(e,t,n){return e.check(w7,t,e.attempt(r$e,t,n))}function u$e(e){e.exit(`gfmFootnoteDefinition`)}function d$e(e,t,n){let r=this;return b7(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 f$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=x7(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var p$e=class{constructor(){this.map=[]}add(e,t,n){m$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 m$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):h7(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):_7(t)?b7(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||g7(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,_7(t)?b7(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 _7(t)?b7(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||h7(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 _7(t)?b7(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||h7(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||h7(n)?(e.exit(`tableRow`),t(n)):_7(n)?b7(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||g7(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 v$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 p$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({},e9(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function y$e(e,t,n,r,i){let a=[],o=e9(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 e9(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var b$e={name:`tasklistCheck`,tokenize:S$e};function x$e(){return{text:{91:b$e}}}function S$e(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 g7(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 h7(r)?t(r):_7(r)?e.check({tokenize:C$e},t,n)(r):n(r)}}function C$e(e,t,n){return b7(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function w$e(){let e=this.data(),t=e.micromarkExtensions||=[],n=e.fromMarkdownExtensions||=[];t.push(i$e(),f$e(),g$e(),x$e()),n.push(VQe(),HQe(),qQe(),e$e())}var T$e=`fileManager.readmeCollapsed`;function E$e({folderId:e}){let{t}=U(),[n,r]=(0,f.useState)(()=>localStorage.getItem(T$e)===`1`);(0,f.useEffect)(()=>{localStorage.setItem(T$e,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)(oc,{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)(yl,{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)(yl,{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)(oc,{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)(vl,{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)(EQe,{remarkPlugins:[w$e],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 D$e({open:e,onClose:t,onPickTag:n}){let{t:r}=U(),i=no(),{showToast:a}=Hd(),[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:F5,queryFn:Z.getLibraryTags,enabled:e}),_=()=>{i.invalidateQueries({queryKey:F5}),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)(yu,{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)(Ol,{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)(Zu,{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)(Cl,{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)(ku,{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)($d,{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 O$e({file:e,canEdit:t,onClose:n}){let{t:r}=U(),{showToast:i}=Hd(),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:Bd(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:ep(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)(Zs,{className:`w-3 h-3 flex-shrink-0`})]})}),D.push({label:r(`fileManager.details.created`),value:Yf(e.created_at)}),D.push({label:r(`fileManager.details.modified`),value:Yf(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)(Zu,{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)(gu,{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)(Zs,{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)(es,{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)(ku,{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)(Ol,{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)(Bl,{className:`w-4 h-4`}),r(`fileManager.details.save`)]})]})]})]}),g!==null&&d.length>0&&(0,G.jsx)(nG,{archiveName:e.filename,photos:d,initialIndex:g,getPhotoUrl:t=>Z.getLibraryFilePhotoUrl(e.id,t),onClose:()=>_(null),onDelete:t?w:void 0})]})}var k$e=90;function A$e({onClose:e}){let{t}=U(),n=no(),{showToast:r}=Hd(),[i,a]=(0,f.useState)(k$e),[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)(ku,{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)(Zu,{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:Bd(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)(Mu,{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 j$e=(0,f.lazy)(()=>Dt(()=>import(`./PdfPreviewModal-DfszICrN.js`).then(e=>({default:e.PdfPreviewModal})),__vite__mapDeps([0,1]))),M$e=(0,f.lazy)(()=>Dt(()=>import(`./SpreadsheetPreviewModal-D1xIlPVC.js`).then(e=>({default:e.SpreadsheetPreviewModal})),__vite__mapDeps([2,1])));function t9(e){return e===`csv`||e===`xlsx`||e===`ods`}function n9(e){return e===`step`||e===`stp`}function N$e({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 P$e({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)(mc,{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 F$e=`<>:"/\\|?*`;function I$e(e){for(let t of e)if(F$e.includes(t)||t.charCodeAt(0)<32)return t;return null}function L$e({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`?I$e(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 R$e({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)(fc,{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 z$e({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=>Vp([...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)(Zu,{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)(tc,{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)(Fu,{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 B$e({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)(cs,{className:`w-3.5 h-3.5 transition-transform ${p?`rotate-90`:``}`})}):(0,G.jsx)(`div`,{className:`w-4.5`}),y?(0,G.jsx)(mc,{className:`w-4 h-4 text-purple-600 dark:text-purple-400 flex-shrink-0`}):(0,G.jsx)(fc,{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:Yf(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)(qs,{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)(Cl,{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)(ku,{className:`w-3.5 h-3.5`}),d(`common.delete`)]})]})]})]})})]}),_&&p&&(0,G.jsx)(`div`,{children:e.children.map(e=>(0,G.jsx)(B$e,{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 V$e({file:e,isSelected:t,onSelect:n,onDelete:r,onDownload:i,onPrint:a,onSlice:o,onOpenInSlicer:s,onRunPipeline:c,useSlicerApi:l,desktopSlicer:u,canSlice:d,onPreview3d:p,onPreviewDocument:m,onRename:h,onDetails:g,onGenerateThumbnail:_,onTagClick:v,thumbnailVersion:y,hasPermission:b,canModify:x,authEnabled:S,showModified:C,t:w}){let[T,E]=(0,f.useState)(null),D=b(`library:read`),O=x(`library`,`update`,e.created_by_id),k=x(`library`,`delete`,e.created_by_id),A=[];return a&&j5(e)&&A.push({label:w(`common.print`),icon:(0,G.jsx)(jl,{className:`w-4 h-4 text-bambu-green`}),onClick:()=>a(e),disabled:!b(`queue:create`),title:b(`queue:create`)?void 0:w(`fileManager.noPermissionAddToQueue`)}),M5(e,!!l,u)&&(l?o:s)&&A.push({label:w(`slice.action`),icon:l?(0,G.jsx)(Ms,{className:`w-4 h-4`}):(0,G.jsx)(Zs,{className:`w-4 h-4`}),onClick:()=>{l?o?.(e):s?.(e)},disabled:!d,title:d?void 0:w(l?`fileManager.noPermissionSlice`:`fileManager.noPermissionDownload`)}),c&&l&&M5(e,!0,u)&&A.push({label:w(`library.runWithPipeline.actionLabel`),icon:(0,G.jsx)(El,{className:`w-4 h-4`}),onClick:()=>c(e),disabled:!b(`pipelines:run`),title:b(`pipelines:run`)?void 0:w(`library.runWithPipeline.noPermission`)}),p&&(e.file_type===`3mf`||e.file_type===`gcode`||e.file_type===`stl`||e.file_type===`gcode.3mf`||n9(e.file_type))&&A.push({label:w(`fileManager.preview3d`),icon:(0,G.jsx)(Go,{className:`w-4 h-4`}),onClick:()=>p(e),disabled:!D,title:D?void 0:w(`fileManager.noPermissionPreview`)}),m&&(e.file_type===`pdf`||t9(e.file_type))&&A.push({label:w(`fileManager.preview.open`),icon:e.file_type===`pdf`?(0,G.jsx)(oc,{className:`w-4 h-4`}):(0,G.jsx)(ac,{className:`w-4 h-4`}),onClick:()=>m(e),disabled:!D,title:D?void 0:w(`fileManager.noPermissionPreview`)}),A.push({label:w(`common.download`),icon:(0,G.jsx)(Ws,{className:`w-4 h-4`}),onClick:()=>i(e.id),disabled:!b(`library:read`),title:b(`library:read`)?void 0:w(`fileManager.noPermissionDownload`)}),h&&A.push({label:w(`common.rename`),icon:(0,G.jsx)(Cl,{className:`w-4 h-4`}),onClick:()=>h(e),disabled:!O,title:O?void 0:w(`fileManager.noPermissionRenameFile`)}),g&&A.push({label:w(`fileManager.details.title`),icon:(0,G.jsx)(Rc,{className:`w-4 h-4`}),onClick:()=>g(e),disabled:!D,title:D?void 0:w(`fileManager.noPermissionPreview`)}),e.external_url&&A.push({label:w(`fileManager.details.openLink`),icon:(0,G.jsx)(wc,{className:`w-4 h-4`}),onClick:()=>window.open(e.external_url,`_blank`,`noopener,noreferrer`)}),_&&e.file_type===`stl`&&A.push({label:w(`fileManager.generateThumbnail`),icon:(0,G.jsx)(Ic,{className:`w-4 h-4`}),onClick:()=>_(e),disabled:!O,title:O?void 0:w(`fileManager.noPermissionGenerateThumbnail`)}),A.push({label:w(`common.delete`),icon:(0,G.jsx)(ku,{className:`w-4 h-4`}),onClick:()=>r(e.id),danger:!0,disabled:!k,title:k?void 0:w(`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),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)}${y?(Z.getLibraryFileThumbnailUrl(e.id).includes(`?`)?`&`:`?`)+`v=${y}`:``}`,alt:e.filename,className:`w-full h-full object-cover`}):e.file_type===`pdf`?(0,G.jsx)(oc,{className:`w-12 h-12 text-bambu-gray/30`}):t9(e.file_type)?(0,G.jsx)(ac,{className:`w-12 h-12 text-bambu-gray/30`}):(0,G.jsx)(tc,{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`:n9(e.file_type)?`bg-amber-500/90 text-white`:e.file_type===`pdf`?`bg-red-500/90 text-white`:t9(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:Bd(e.file_size)}),e.print_time_seconds&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(Ts,{className:`w-3 h-3`}),ep(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)(jl,{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`}),w(`fileManager.variants.badge`,{count:e.variant_count})]}),e.print_count>0&&(0,G.jsx)(`div`,{className:`mt-1 text-xs text-bambu-green`,children:w(`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`,onClick:e=>e.stopPropagation(),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:w(`fileManager.details.openLink`),"aria-label":w(`fileManager.details.openLink`),children:(0,G.jsx)(wc,{className:`w-3.5 h-3.5`})}),e.has_notes&&(0,G.jsx)(`button`,{type:`button`,onClick:()=>g?.(e),className:`p-0.5 rounded hover:text-bambu-green`,title:w(`fileManager.details.hasNotes`),"aria-label":w(`fileManager.details.hasNotes`),children:(0,G.jsx)(gu,{className:`w-3.5 h-3.5`})}),(e.photo_count??0)>0&&(0,G.jsxs)(`button`,{type:`button`,onClick:()=>g?.(e),className:`flex items-center gap-0.5 p-0.5 rounded hover:text-bambu-green`,title:w(`fileManager.details.photoCount`,{count:e.photo_count}),"aria-label":w(`fileManager.details.photoCount`,{count:e.photo_count}),children:[(0,G.jsx)(es,{className:`w-3.5 h-3.5`}),(0,G.jsx)(`span`,{children:e.photo_count})]})]}),S&&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)(Lu,{className:`w-3 h-3`}),e.created_by_username]}),C&&(0,G.jsxs)(`div`,{className:`mt-1 text-xs text-bambu-gray flex items-center gap-1`,title:w(`fileManager.lastModified`),children:[(0,G.jsx)(Zo,{className:`w-3 h-3`}),Yf(e.fs_modified_at??e.created_at)]}),(e.tags?.length??0)>0&&(0,G.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1`,onClick:e=>e.stopPropagation(),children:e.tags.map(e=>(0,G.jsxs)(`button`,{type:`button`,onClick:()=>v?.(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)(yu,{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`,onClick:e=>e.stopPropagation(),children:[(0,G.jsx)(`button`,{onClick:e=>{let t=e.currentTarget.getBoundingClientRect();E({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)(qs,{className:`w-4 h-4 text-bambu-gray`})}),T&&(0,G.jsx)(lE,{x:T.x,y:T.y,items:A,onClose:()=>E(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 H$e(){let{t:e}=U(),t=no(),{showToast:n}=Hd(),{hasPermission:r,hasAnyPermission:i,canModify:a,authEnabled:o}=Od(),[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)(()=>localStorage.getItem(`library-view-mode`)||`grid`),[ge,_e]=(0,f.useState)(()=>localStorage.getItem(`library-wrap-folders`)===`true`),[ve,ye]=(0,f.useState)(()=>localStorage.getItem(`library-collapse-folders`)===`true`),[be,xe]=(0,f.useState)(()=>localStorage.getItem(`library-folder-sort-field`)===`activity`?`activity`:`name`),[Se,Ce]=(0,f.useState)(()=>localStorage.getItem(`library-folder-sort-direction`)===`desc`?`desc`:`asc`),[we,Te]=(0,f.useState)(()=>{let e=localStorage.getItem(`library-sidebar-width`);return e?parseInt(e,10):256}),[Ee,De]=(0,f.useState)(!1),Oe=(0,f.useRef)(null);(0,f.useEffect)(()=>{if(!Ee)return;document.body.style.userSelect=`none`,document.body.style.cursor=`col-resize`;let e=e=>{if(!Oe.current)return;let t=Oe.current.parentElement?.getBoundingClientRect();if(!t)return;let n=e.clientX-t.left;Te(Math.min(500,Math.max(200,n)))},t=()=>{De(!1),document.body.style.userSelect=``,document.body.style.cursor=``,localStorage.setItem(`library-sidebar-width`,String(we))};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=``}},[Ee,we]);let[ke,Ae]=(0,f.useState)(``),[je,Me]=(0,f.useState)(`all`),[Ne,Pe]=(0,f.useState)(``),[Fe,Ie]=(0,f.useState)(()=>localStorage.getItem(`library-sort-field`)||`name`),[Le,Re]=(0,f.useState)(()=>localStorage.getItem(`library-sort-direction`)||`asc`),[ze,Be]=(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:Ve}=K({queryKey:[`settings`],queryFn:()=>Z.getSettings()}),He=qW(Ve?.open_in_slicer,Ve?.preferred_slicer),Ue=(0,f.useCallback)(async t=>{try{let{token:e}=await Z.createLibrarySlicerToken(t.id),n=Z.getLibrarySlicerDownloadUrl(t.id,e,t.filename);ZW(`${window.location.origin}${n}`,He)}catch{n(e(`fileManager.toast.openInSlicerFailed`),`error`);let r=Z.getLibraryFileDownloadUrl(t.id);ZW(`${window.location.origin}${r}`,He)}},[He,n,e]),We=(0,f.useCallback)(()=>Ve?.use_slicer_api?r(`library:upload`):i(`library:read_all`,`library:read_own`),[Ve?.use_slicer_api,r,i]),{data:Ge,isLoading:Ke}=K({queryKey:[`library-folders`],queryFn:()=>Z.getLibraryFolders()}),qe=(0,f.useMemo)(()=>{if(!Ge)return Ge;let e=t=>[...t].sort((e,t)=>{let n=0;if(be===`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 Se===`asc`?n:-n}).map(t=>({...t,children:e(t.children)}));return e(Ge)},[Ge,be,Se]),{data:Je}=K({queryKey:[`library-trash-count`],queryFn:async()=>{try{return(await Z.listLibraryTrash(1,0)).total}catch{return 0}},staleTime:3e4}),Ye=u!==null&&ke.trim().length>0,Xe=(0,f.useMemo)(()=>[...N].sort((e,t)=>e-t),[N]),{data:Ze=[]}=K({queryKey:[`library-tags`],queryFn:Z.getLibraryTags}),Qe=(0,f.useMemo)(()=>{let e=new Map;for(let t of Ze)e.set(t.id,t.name);return e},[Ze]);(0,f.useEffect)(()=>{Ze.length!==0&&P(e=>{let t=e.filter(e=>Qe.has(e));return t.length===e.length?e:t})},[Ze.length,Qe]);let $e=(0,f.useCallback)(e=>{P(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]),{data:et,isLoading:tt}=K({queryKey:[`library-files`,u,p,Ye,Xe],queryFn:()=>Z.getLibraryFiles(u,!1,void 0,u===null?p:void 0,Ye,Xe)}),{data:nt}=K({queryKey:[`library-stats`],queryFn:()=>Z.getLibraryStats()}),{data:rt}=K({queryKey:[`users`,`slim`],queryFn:()=>Z.getUsersSlim()}),it=(0,f.useMemo)(()=>{if(!et)return[];let e=new Set(et.map(e=>e.file_type));return Array.from(e).sort()},[et]),at=(0,f.useMemo)(()=>{if(!et)return[];let e=[...et];if(ke.trim()){let t=ke.toLowerCase();e=e.filter(e=>e.filename.toLowerCase().includes(t)||e.print_name&&e.print_name.toLowerCase().includes(t))}if(je!==`all`&&(e=e.filter(e=>e.file_type===je)),Ne.trim()){let t=Ne.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(Fe){case`name`:n=(e.print_name||e.filename).localeCompare(t.print_name||t.filename);break;case`date`:n=(Jf(e.fs_modified_at??e.created_at)?.getTime()??0)-(Jf(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 Le===`asc`?n:-n}),e},[et,ke,je,Ne,Fe,Le]),ot=(0,f.useMemo)(()=>{if(!nt||!Ve)return!1;let e=(Ve.library_disk_warning_gb||5)*1024*1024*1024;return nt.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`)}),ct=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`)}),lt=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`)}),ut=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`)}}),dt=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`)}}),ft=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`)}),pt=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`)}}),mt=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`)}),ht=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`)}),gt=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`)}}),_t=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`)}}),vt=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`)}),yt=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`)}),bt=(0,f.useMemo)(()=>et?et.filter(e=>h.includes(e.id)&&j5(e)):[],[et,h]),{data:xt}=K({queryKey:[`variant-group`,z?.variant_group_id],queryFn:()=>Z.getVariantGroup(z.variant_group_id),enabled:!!z?.variant_group_id}),St=(0,f.useMemo)(()=>{if(z){if(bt.length>1)return bt.map(e=>({id:e.id,filename:e.filename,sliced_for_model:e.sliced_for_model}));if(xt&&xt.members.length>1)return xt.members.map(e=>({id:e.library_file_id,filename:e.filename,sliced_for_model:e.target_model}))}},[z,bt,xt]),Ct=(0,f.useCallback)(e=>{g(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]),wt=(0,f.useCallback)(()=>{at.length>0&&g(at.map(e=>e.id))},[at]),Tt=(0,f.useCallback)(()=>{g([])},[]),Et=()=>{t.invalidateQueries({queryKey:[`library-files`]}),t.invalidateQueries({queryKey:[`library-folders`]}),t.invalidateQueries({queryKey:[`library-stats`]})},{isDraggingOver:Dt,dragHandlers:Ot}=QW({disabled:!r(`library:upload`)||C,onFiles:e=>{E(e),w(!0)}}),kt=(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]),At=e=>{Z.downloadLibraryFile(e).catch(e=>{console.error(`Library file download failed:`,e)})},jt=()=>{L&&(L.type===`file`?dt.mutate(L.id):L.type===`folder`?ut.mutate(L.id):L.type===`bulk`&&pt.mutate(h))},Mt=ut.isPending||dt.isPending||pt.isPending,Nt=e=>{he(e),localStorage.setItem(`library-view-mode`,e)},Pt=Ke||tt,Ft=(0,f.useMemo)(()=>{if(!u||!Ge)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(Ge)},[u,Ge]);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`,...Ot,children:[Dt&&(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)(Iu,{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)(fc,{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:()=>Nt(`grid`),className:`p-1.5 rounded transition-colors ${me===`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:()=>Nt(`list`),className:`p-1.5 rounded transition-colors ${me===`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:()=>vt.mutate(),disabled:vt.isPending||!i(`library:update_own`,`library:update_all`),title:i(`library:update_own`,`library:update_all`)?e(`fileManager.generateThumbnailsForMissing`):e(`fileManager.noPermissionGenerateThumbnail`),children:[vt.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)(mc,{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)(pc,{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)(yu,{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)(ku,{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)(ku,{className:`w-4 h-4 mr-2`}),e(`libraryTrash.headerButton`),typeof Je==`number`&&Je>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:Je})]}),(0,G.jsxs)(Q,{onClick:()=>w(!0),disabled:!r(`library:upload`),title:r(`library:upload`)?void 0:e(`fileManager.noPermissionUpload`),children:[(0,G.jsx)(Iu,{className:`w-4 h-4 mr-2`}),e(`common.upload`)]})]})]}),ot&&nt&&Ve&&(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)(Mu,{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:Bd(nt.disk_free_bytes),total:Bd(nt.disk_total_bytes),threshold:Ve.library_disk_warning_gb})})]})]}),nt&&(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)(sc,{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:nt.total_files})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,G.jsx)(fc,{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:nt.total_folders})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,G.jsx)(Oc,{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:Bd(nt.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 ${ot?`text-amber-500`:`text-white`}`,children:Bd(nt.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`)]}),Ge?.some(e=>e.is_external)&&(0,G.jsxs)(`option`,{value:`__top:external`,children:[`🔗 `,e(`fileManager.allExternal`)]}),qe&&(()=>{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(qe).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:Oe,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:`${we}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 ${Ee?`bg-bambu-green`:`hover:bg-bambu-green/50`}`,onMouseDown:e=>{e.preventDefault(),De(!0)},onDoubleClick:()=>{Te(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 ${Ee?`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:be,onChange:e=>{let t=e.target.value===`activity`?`activity`:`name`;xe(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=Se===`asc`?`desc`:`asc`;Ce(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(Se===`asc`?`fileManager.ascending`:`fileManager.descending`),"aria-label":e(Se===`asc`?`fileManager.ascending`:`fileManager.descending`),children:Se===`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=!ve;ye(e),localStorage.setItem(`library-collapse-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.expandFoldersByDefault`:`fileManager.collapseFoldersByDefault`),children:e(`fileManager.collapse`)}),(0,G.jsx)(`button`,{onClick:()=>{let e=!ge;_e(e),localStorage.setItem(`library-wrap-folders`,String(e))},className:`text-xs px-1.5 py-0.5 rounded transition-colors ${ge?`bg-bambu-green/20 text-bambu-green`:`text-bambu-gray hover:text-white hover:bg-bambu-dark`}`,title:e(ge?`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)(tc,{className:`w-4 h-4`}),(0,G.jsx)(`span`,{className:`text-sm`,children:e(`fileManager.allFiles`)})]}),Ge?.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)(mc,{className:`w-4 h-4 text-purple-600 dark:text-purple-400`}),(0,G.jsx)(`span`,{className:`text-sm`,children:e(`fileManager.allExternal`)})]}),qe?.map(t=>(0,G.jsx)(B$e,{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:ge,defaultExpanded:!ve,showModified:ze,hasPermission:r,t:e},`${t.id}-${ve?`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:[Ze.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`)}),Ze.map(e=>{let t=N.includes(e.id);return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>$e(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)(yu,{className:`w-3 h-3`}),(0,G.jsx)(`span`,{children:e.name}),t&&(0,G.jsx)(Zu,{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`)})]}),Ft?.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)(mc,{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`)}),Ft.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:Ft.external_path||``,children:Ft.external_path})]}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:()=>u&<.mutate(u),disabled:lt.isPending,title:e(`fileManager.scanFolder`),children:[lt.isPending?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(Fl,{className:`w-4 h-4`}),(0,G.jsx)(`span`,{className:`ml-1.5`,children:e(`fileManager.scanFolder`)})]})]}),et&&et.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)(Gl,{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:ke,onChange:e=>Ae(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`}),Ye&&(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)(vc,{className:`w-4 h-4 text-bambu-gray hidden sm:block`}),(0,G.jsxs)(`select`,{value:je,onChange:e=>Me(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`)}),it.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:Ne,onChange:e=>Pe(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 ${Ne?`pr-7`:``}`,style:Ne?{WebkitAppearance:`none`,MozAppearance:`textfield`}:void 0}),Ne&&(0,G.jsx)(`button`,{onClick:()=>Pe(``),className:`absolute right-2 top-1/2 -translate-y-1/2 text-bambu-gray hover:text-white z-10`,children:(0,G.jsx)(Zu,{className:`w-3 h-3`})}),(0,G.jsx)(`datalist`,{id:`usernames-list`,children:rt?.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:Fe,onChange:e=>{let t=e.target.value;Ie(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:()=>Re(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(Le===`asc`?`fileManager.ascending`:`fileManager.descending`),children:Le===`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:()=>Be(e=>{let t=!e;return localStorage.setItem(`library-show-modified`,String(t)),t}),className:`p-1.5 rounded bg-bambu-dark border transition-colors ${ze?`border-bambu-green text-bambu-green`:`border-bambu-dark-tertiary text-white hover:border-bambu-green`}`,title:e(ze?`fileManager.hideModified`:`fileManager.showModified`),"aria-pressed":ze,children:(0,G.jsx)(Zo,{className:`w-4 h-4`})})]}),(ke||je!==`all`||Ne)&&(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray hidden sm:inline`,children:e(`fileManager.resultsCount`,{showing:at.length,total:et.length})})]}),at.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===at.length&&h.length>0?(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:Tt,children:[(0,G.jsx)(pu,{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:wt,children:[(0,G.jsx)(du,{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:[bt.length>=1&&(0,G.jsxs)(Q,{variant:`primary`,size:`sm`,onClick:()=>B(bt[0]),disabled:!r(`queue:create`),title:r(`queue:create`)?void 0:e(`fileManager.noPermissionAddToQueue`),children:[(0,G.jsx)(jl,{className:`w-4 h-4 sm:mr-1`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:bt.length>1?e(`fileManager.variants.printAlternatives`,{count:bt.length}):e(`common.print`)})]}),bt.length>=2&&!bt.some(e=>e.variant_group_id)&&(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:()=>ft.mutate(bt.map(e=>e.id)),disabled:ft.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)(dl,{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)(yu,{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)(ku,{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:Tt,children:[(0,G.jsx)(Zu,{className:`w-4 h-4 sm:mr-1`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:e(`common.clear`)})]})]})]})]}),Pt?(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`)})]})}):et?.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)(tc,{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)(Ol,{className:`w-4 h-4 mr-2`}),e(`fileManager.uploadFiles`)]})]}):at.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)(Gl,{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:()=>{Ae(``),Me(`all`)},children:e(`fileManager.clearFilters`)})]}):me===`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:at.map(t=>(0,G.jsx)(V$e,{file:t,isSelected:h.includes(t.id),t:e,onSelect:Ct,onDelete:e=>R({type:`file`,id:e}),onDownload:At,onPrint:B,onSlice:ee,onOpenInSlicer:Ue,desktopSlicer:He,onRunPipeline:ne,useSlicerApi:Ve?.use_slicer_api??!1,canSlice:We(),onPreview3d:e=>{j5(e)?c(`/gcode-viewer?library_file=${e.id}`):H(e)},onPreviewDocument:e=>{e.file_type===`pdf`?le(e):de(e)},onRename:e=>ie({type:`file`,id:e.id,name:e.filename}),onDetails:pe,onGenerateThumbnail:e=>yt.mutate(e.id),onTagClick:$e,thumbnailVersion:ae[t.id],hasPermission:r,canModify:a,authEnabled:o,showModified:ze},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`,{})]}),at.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:()=>Ct(t.id),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)(oc,{className:`w-5 h-5 text-bambu-gray/50`}):t9(t.file_type)?(0,G.jsx)(ac,{className:`w-5 h-5 text-bambu-gray/50`}):(0,G.jsx)(tc,{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`,onClick:e=>e.stopPropagation(),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)(wc,{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)(gu,{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)(es,{className:`w-3.5 h-3.5`}),t.photo_count]})]}),ze&&(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:Yf(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)(Lu,{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`:n9(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`:t9(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:Bd(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`,onClick:e=>e.stopPropagation(),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:()=>$e(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)(yu,{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`,onClick:e=>e.stopPropagation(),children:[j5(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)(jl,{className:`w-4 h-4`})})}),M5(t,!!Ve?.use_slicer_api,He)&&(0,G.jsx)(`button`,{onClick:()=>{We()&&(Ve?.use_slicer_api?ee:Ue)(t)},className:`p-1.5 rounded transition-colors ${We()?`hover:bg-bambu-dark text-bambu-gray hover:text-bambu-green`:`text-bambu-gray/50 cursor-not-allowed`}`,title:We()?e(`slice.action`):Ve?.use_slicer_api?e(`fileManager.noPermissionSlice`):e(`fileManager.noPermissionDownload`),disabled:!We(),children:Ve?.use_slicer_api?(0,G.jsx)(Ms,{className:`w-4 h-4`}):(0,G.jsx)(Zs,{className:`w-4 h-4`})}),(Ve?.use_slicer_api??!1)&&M5(t,!0,He)&&(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)(El,{className:`w-4 h-4`})}),(t.file_type===`3mf`||t.file_type===`gcode`||t.file_type===`gcode.3mf`||t.file_type===`stl`||n9(t.file_type))&&(0,G.jsx)(`button`,{onClick:()=>{r(`library:read`)&&(j5(t)?c(`/gcode-viewer?library_file=${t.id}`):H(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`})}),(t.file_type===`pdf`||t9(t.file_type))&&(0,G.jsx)(`button`,{onClick:()=>{r(`library:read`)&&(t.file_type===`pdf`?le(t):de(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:t.file_type===`pdf`?(0,G.jsx)(oc,{className:`w-4 h-4`}):(0,G.jsx)(ac,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{onClick:()=>r(`library:read`)&&At(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)(Ws,{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)(Cl,{className:`w-4 h-4`})}),t.file_type===`stl`&&(0,G.jsx)(`button`,{onClick:()=>a(`library`,`update`,t.created_by_id)&&yt.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:yt.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)(ku,{className:`w-4 h-4`})})]})]},t.id))]})})]}),u!==null&&(0,G.jsx)(E$e,{folderId:u})]})]}),_&&(0,G.jsx)(N$e,{parentId:u,onClose:()=>v(!1),onSave:e=>st.mutate(e),isLoading:st.isPending,t:e}),y&&(0,G.jsx)(P$e,{onClose:()=>b(!1),onSave:e=>ct.mutate(e),isLoading:ct.isPending,t:e}),x&&Ge&&(0,G.jsx)(R$e,{folders:Ge,selectedFiles:h,currentFolderId:u,onClose:()=>S(!1),onMove:e=>mt.mutate({fileIds:h,folderId:e}),isLoading:mt.isPending,t:e}),C&&(0,G.jsx)(WU,{folderId:u,onClose:()=>{w(!1),E([])},onUploadComplete:Et,initialFiles:T.length>0?T:void 0}),D&&(0,G.jsx)(A$e,{onClose:()=>O(!1)}),(0,G.jsx)(D$e,{open:k,onClose:()=>A(!1),onPickTag:e=>{N.includes(e)||P(t=>[...t,e])}}),(0,G.jsx)(aqe,{open:j,fileIds:h,onClose:()=>M(!1)}),F&&(0,G.jsx)(z$e,{folder:F,onClose:()=>I(null),onLink:e=>ht.mutate({id:F.id,data:e}),isLoading:ht.isPending,t:e}),L&&(0,G.jsx)($d,{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:Mt,loadingText:e(`fileManager.deleting`),onConfirm:jt,onCancel:()=>R(null)}),z&&(!z.variant_group_id||xt!==void 0)&&(0,G.jsx)(Tm,{mode:`create`,libraryFileId:St?.[0]?.id??z.id,variantFiles:St,archiveName:St&&St.length>1?`${St[0].filename} ${e(`common.plusNMore`,{count:St.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)(UW,{source:{kind:`libraryFile`,id:V.id,filename:V.filename},onClose:()=>ee(null)}),te&&(0,G.jsx)(KW,{source:{kind:`libraryFile`,id:te.id,filename:te.filename},onClose:()=>ne(null)}),se&&(0,G.jsx)(iqe,{libraryFileId:se.id,title:se.print_name||se.filename,fileType:se.file_type,onClose:()=>H(null),onSnapshot:n9(se.file_type)?kt(se):void 0,onSliceWithBambuddy:M5(se,!0,He)&&r(`library:upload`)?()=>{let e=se;H(null),ee(e)}:void 0}),(ce||ue)&&(0,G.jsxs)(f.Suspense,{fallback:null,children:[ce&&(0,G.jsx)(j$e,{libraryFileId:ce.id,filename:ce.print_name||ce.filename,fileSize:ce.file_size,onClose:()=>le(null),onSnapshot:kt(ce)}),ue&&(0,G.jsx)(M$e,{libraryFileId:ue.id,filename:ue.print_name||ue.filename,fileType:ue.file_type,fileSize:ue.file_size,onClose:()=>de(null),onSnapshot:kt(ue)})]}),fe&&(0,G.jsx)(O$e,{file:fe,canEdit:a(`library`,`update`,fe.created_by_id),onClose:()=>pe(null)}),re&&(0,G.jsx)(L$e,{type:re.type,currentName:re.name,onClose:()=>ie(null),onSave:e=>{re.type===`file`?gt.mutate({id:re.id,filename:e}):_t.mutate({id:re.id,name:e})},isLoading:gt.isPending||_t.isPending,t:e})]})}function U$e(e){let t=Jf(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 W$e(e){let t=Jf(e);return t?t.toLocaleString():e}function G$e(){let{t:e}=U(),t=$n(),n=no(),{showToast:r}=Hd(),{hasPermission:i,authEnabled:a}=Od(),[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)(ku,{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)(Bl,{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:Bd(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)(Ll,{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)(ku,{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:Bd(t.file_size)}),(0,G.jsx)(`td`,{className:`px-3 py-2 text-gray-600 dark:text-gray-400 whitespace-nowrap`,children:W$e(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:W$e(t.auto_purge_at),children:e(`libraryTrash.autoPurgeIn`,{when:U$e(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)(Ll,{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)(ku,{className:`w-3.5 h-3.5`}),e(`libraryTrash.purgeNow`)]})]})]},t.id))})]})})]}),o&&(0,G.jsx)($d,{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 K$e(e){return e.includes(`/camera/`)}function q$e(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=K$e(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 J$e(){let{authEnabled:e,user:t,loading:n,hasPermission:r}=Od(),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)(()=>(ud(u),cd(d),(u||d)&&q$e(document,u,d),()=>{ud(null),cd(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=K$e(n),o=r?ld():dd();!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 r9=5,Y$e=2e3,X$e=3e4,Z$e=5e3;function Q$e(){let{t:e}=U(),t=no(),{showToast:n}=Hd(),{hasPermission:r,authEnabled:i,user:a}=Od(),{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);J$e();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??ld(),[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=ad();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>=r9){P(!1),S(!0);return}let e=Math.min(Y$e*2**j,X$e);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{}},Z$e),()=>{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=ad();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)}`:fd(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)(es,{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)(QT,{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)($T,{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)(Fl,{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)(hu,{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)(ol,{className:`w-4 h-4 text-bambu-gray`}):(0,G.jsx)(nl,{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)(Fl,{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)(Ku,{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,r9),max:r9})}),(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)(Mu,{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)(ed,{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)(Qu,{className:`w-4 h-4 text-white`})})]})]})}),(0,G.jsx)(eE,{printerId:s,isOpen:_,onClose:()=>v(!1)}),y&&(0,G.jsx)(tE,{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 $$e=5e3,e1e=4,t1e=8,n1e=1,r1e=16,i1e=2,a1e=60;function o1e(e,t,n,r){let i=parseInt(e??``,10);return Number.isFinite(i)?Math.min(r,Math.max(n,i)):t}function s1e(e,t,n,r,i,a){return e.has(t)?o1e(e.get(t),r,i,a):o1e(localStorage.getItem(n),r,i,a)}function c1e(){let{t:e}=U(),t=Xn(),{authEnabled:n,loading:r,user:i}=Od(),[a]=ji(),o=a.get(`token`),s=o!=null&&o!==``,[c,l]=(0,f.useState)(()=>s1e(a,`maxLive`,`camWallMaxLive`,e1e,n1e,r1e)),[u,d]=(0,f.useState)(()=>s1e(a,`interval`,`camWallSnapshotSec`,t1e,i1e,a1e)),[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 cd(o),()=>cd(null)},[s,o]);let h=K({queryKey:[`camwall-printers`,o],queryFn:()=>Z.getCamWallPrinters(o??void 0),enabled:s,refetchInterval:$$e}),g=K({queryKey:[`printers`],queryFn:()=>Z.getPrinters(),enabled:!s&&!r&&(!n||i!==null),refetchInterval:$$e}),_=(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)(cE,{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 l1e(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 u1e(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,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`),showNozzle:t.includes(`nozzle`),showBed:t.includes(`bed`),showChamber:t.includes(`chamber`)}}function d1e(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 i9(e,t){let n=e[t];return typeof n==`number`?n:null}function f1e({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 p1e(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 m1e(){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)(()=>u1e(t),[t]),c=p1e(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,camera_rotation:d.camera_rotation}:p,[u,d,p]),_=u?d:m,v=(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 nd?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 y=()=>{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(!_)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 b=_.state===`RUNNING`||_.state===`PAUSE`,x=_.progress||0,S=_.temperatures??{},C=[];if(s.showNozzle){let e=i9(S,`nozzle`),t=i9(S,`nozzle_2`);e!=null&&C.push({key:`nozzle`,icon:(0,G.jsx)(lc,{className:c.icon}),label:n(`printers.heaterHistory.nozzle`,`Nozzle`),current:e,target:i9(S,`nozzle_target`)}),t!=null&&C.push({key:`nozzle_2`,icon:(0,G.jsx)(lc,{className:c.icon}),label:n(`printers.heaterHistory.nozzle2`,`Nozzle 2`),current:t,target:i9(S,`nozzle_2_target`)})}if(s.showBed){let e=i9(S,`bed`);e!=null&&C.push({key:`bed`,icon:(0,G.jsx)(pu,{className:c.icon}),label:n(`printers.heaterHistory.bed`,`Bed`),current:e,target:i9(S,`bed_target`)})}if(s.showChamber){let e=i9(S,`chamber`);e!=null&&C.push({key:`chamber`,icon:(0,G.jsx)(Go,{className:c.icon}),label:n(`printers.heaterHistory.chamber`,`Chamber`),current:e,target:i9(S,`chamber_target`)})}let w=`/api/v1/printers/${i}/camera/stream?fps=${s.fps}&t=${a}`,T=u&&l?`${w}&token=${encodeURIComponent(l)}`:fd(w);return(0,G.jsxs)(`div`,{className:`min-h-screen bg-black relative overflow-hidden`,children:[s.showCamera&&(0,G.jsx)(`img`,{src:T,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:y},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:[s.showPrinter&&g&&(0,G.jsxs)(`div`,{className:`flex items-center ${c.gap} mb-2`,children:[(0,G.jsx)(jl,{className:`${c.icon} text-white/70`}),(0,G.jsx)(`span`,{className:`${c.text} text-white font-medium`,children:g.name})]}),s.showFilename&&_.current_print&&(0,G.jsx)(`div`,{className:`${c.textLarge} text-white font-semibold mb-2 truncate drop-shadow-md`,children:l1e(_.current_print.replace(/\.gcode\.3mf$|\.3mf$|\.gcode$/i,``),_.gcode_file,n)}),s.showStatus&&(0,G.jsx)(`div`,{className:`${c.text} text-white/70 mb-2`,children:d1e(_,n)}),s.showProgress&&b&&(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(x),`%`]})]}),(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:`${x}%`}})})]}),b&&(s.showLayers||s.showEta)&&(0,G.jsxs)(`div`,{className:`flex items-center ${c.gap} flex-wrap`,children:[s.showLayers&&_.layer_num!=null&&_.total_layers!=null&&_.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:_.layer_num}),(0,G.jsx)(`span`,{className:`mx-1`,children:`/`}),(0,G.jsx)(`span`,{children:_.total_layers})]})]}),s.showEta&&_.remaining_time!=null&&_.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)(Ou,{className:c.icon}),(0,G.jsx)(`span`,{className:`${c.text} text-white`,children:ep(_.remaining_time*60)})]}),(0,G.jsxs)(`div`,{className:`flex items-center ${c.gap} text-white/70`,children:[(0,G.jsx)(Ts,{className:c.icon}),(0,G.jsxs)(`span`,{className:`${c.text} text-white`,children:[n(`streamOverlay.eta`),` `,$f(_.remaining_time,v,n)]})]})]})]}),!b&&(0,G.jsx)(`div`,{className:`${c.text} text-white/70 py-2`,children:_.connected?n(`streamOverlay.printerIdle`):n(`streamOverlay.printerOffline`)}),C.length>0&&(0,G.jsx)(`div`,{className:`flex items-center ${c.gap} flex-wrap mt-2`,children:C.map(e=>(0,G.jsx)(f1e,{icon:e.icon,label:e.label,current:e.current,target:e.target,sizes:c},e.key))})]})})]})}function h1e(){let{t:e}=U(),{id:t}=ir(),{mode:n}=jd(),{data:r,isLoading:i,error:a}=K({queryKey:[`external-link`,t],queryFn:()=>Z.getExternalLink(Number(t)),enabled:!!t});return i?(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`})}):a||!r?(0,G.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-4 text-bambu-gray`,children:[(0,G.jsx)(Mu,{className:`w-12 h-12`}),(0,G.jsx)(`p`,{children:e(`common.linkNotFound`)})]}):(0,G.jsx)(`iframe`,{src:r.url,className:`h-full w-full border-0`,style:{colorScheme:n},title:r.name,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox`})}function g1e(){let{id:e}=ir(),t=$n(),n=no(),{t:r}=U(),{showToast:i}=Hd(),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)(Mu,{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)(Gl,{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)(Pd,{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)(as,{className:`w-3 h-3 text-white`}),o&&!a&&(0,G.jsx)(sl,{className:`w-3 h-3 text-white`})]}),(0,G.jsx)(eu,{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)(Bl,{className:`w-4 h-4`}),r(`common.save`)]})})]})]})}var _1e=1.65,v1e=[`#1DB954`,`#3B82F6`,`#F59E0B`,`#EF4444`,`#8B5CF6`];function a9(e,t,n,r){return`${e}||${t??``}||${n??``}||${r??``}`}function o9(e,t){let n=new Date(e);return n.setDate(n.getDate()+Math.round(t)),n}function s9(e){return e.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function c9(e){return e.toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function y1e(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 b1e(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(a9(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=a9(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(a9(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=y1e(u);if(m!==null)d=m.rate,f=m.stdDev,p=`history`;else{let e=b1e(t.spools);e!==null&&(d=e,p=`delta`)}let h=_1e*(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:o9(e,_),y=d&&d>0?Math.floor((s-g)/d):null,b=y===null?null:o9(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)(Mu,{className:`w-4 h-4`}),r(`forecast.alertCount`,{count:L.length}),c?(0,G.jsx)(us,{className:`w-3.5 h-3.5`}):(0,G.jsx)(ss,{className:`w-3.5 h-3.5`})]}),s&&(0,G.jsx)(E1e,{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)(tu,{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)(C1e,{forecast:e,onCart:()=>b(e)},e.group.key))}),x&&(0,G.jsx)(j1e,{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)(T1e,{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)(Au,{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)(l9,{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)(l9,{col:`stock`,active:u,dir:p,onSort:z,children:r(`forecast.stock`)}),(0,G.jsx)(l9,{col:`used`,active:u,dir:p,onSort:z,children:r(`forecast.dailyRate`)}),(0,G.jsx)(l9,{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)(D1e,{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)(N1e,{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 l9({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 C1e({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)(Mu,{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?s9(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)(tu,{className:`w-3 h-3`}),` `,n(`forecast.order`)]})]})}var w1e=[{label:`1W`,value:7},{label:`1M`,value:30},{label:`6M`,value:180}];function T1e({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:v1e[n%v1e.length],rop:e.reorderPointG,points:x1e(e,t)})),o=i.map(e=>{let t={day:e,label:c9(o9(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)(Au,{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:w1e.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)(WA,{width:`100%`,height:220,children:(0,G.jsxs)(WH,{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)(lV,{strokeDasharray:`3 3`,stroke:`#374151`,strokeOpacity:.5}),(0,G.jsx)(eH,{dataKey:`label`,tick:{fill:`#6B7280`,fontSize:10},interval:Math.max(0,Math.ceil(s/8)-1),axisLine:!1,tickLine:!1}),(0,G.jsx)(aH,{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)(Jz,{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)(Yj,{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)(MV,{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)(QB,{y:e.rop,stroke:e.color,strokeDasharray:`4 3`,strokeOpacity:.6},`rop-${e.key}`))]})})]})}function E1e({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)(Sl,{className:`w-3 h-3`})})]})]})}function D1e({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?Tf(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?s9(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?s9(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)(tu,{className:`w-4 h-4`})}),!x&&(e.stockBreakAlert?(0,G.jsx)(Mu,{className:`w-4 h-4 text-red-600 dark:text-red-400`,"aria-label":o(`forecast.stockBreakRisk`)}):e.reorderAlert?(0,G.jsx)(Mu,{className:`w-4 h-4 text-yellow-600 dark:text-yellow-400`,"aria-label":o(`forecast.reorderNow`)}):e.daysRemaining===null?null:(0,G.jsx)(as,{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)(us,{className:`w-4 h-4`}):(0,G.jsx)(ss,{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)(O1e,{label:o(`forecast.effectiveLeadTime`),value:`${e.effectiveLeadTimeDays}d`,hint:o(`forecast.effectiveLeadTimeHint`,{global:t,sku:e.settings?.lead_time_days??0})}),(0,G.jsx)(O1e,{label:o(`forecast.reorderPoint`),value:`${Math.round(e.reorderPointG)}g`,hint:o(`forecast.reorderPointHint`)}),n&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(k1e,{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)(A1e,{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 O1e({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 k1e({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)(Sl,{className:`w-3 h-3`})})]})]})}function A1e({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)(Sl,{className:`w-3 h-3`})})]})]})}function j1e({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};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(a9(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(a9(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?s9(o9(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 XZe(e,t){return e&&`run`in e?async function(n,r){let i=YZe(n,{file:r,...t});await e.run(i,r)}:function(n,r){return YZe(n,{file:r,...e||t})}}function ZZe(e){if(e)throw e}var QZe=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 V7={basename:tQe,dirname:nQe,extname:rQe,join:iQe,sep:`/`};function tQe(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);H7(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 nQe(e){if(H7(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 rQe(e){H7(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 iQe(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function oQe(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 H7(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var sQe={cwd:cQe};function cQe(){return`/`}function U7(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function lQe(e){if(typeof e==`string`)e=new URL(e);else if(!U7(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];B7(o)&&B7(r)&&(r=(0,q7.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function J7(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function Y7(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function X7(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 _Qe(e){if(!B7(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function vQe(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function Z7(e){return yQe(e)?e:new dQe(e)}function yQe(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function bQe(e){return typeof e==`string`||xQe(e)}function xQe(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var SQe=[],CQe={allowDangerousHtml:!0},wQe=/^(https?|ircs?|mailto|xmpp)$/i,TQe=[{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 EQe(e){let t=DQe(e),n=OQe(e);return kQe(t.runSync(t.parse(n),n),e)}function DQe(e){let t=e.rehypePlugins||SQe,n=e.remarkPlugins||SQe,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...CQe}:CQe;return gQe().use(HXe).use(n).use(XZe,r).use(t)}function OQe(e){let t=e.children||``,n=new dQe;return typeof t==`string`?n.value=t:``+t,n}function kQe(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||AQe;for(let e of TQe)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]}),VZe(e,l),Jqe(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 o7)if(Object.hasOwn(o7,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=o7[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 AQe(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||wQe.test(e.slice(0,t))?e:``}BQe.peek=zQe;function jQe(){this.buffer()}function MQe(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function NQe(){this.buffer()}function PQe(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function FQe(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=u7(this.sliceSerialize(e)).toLowerCase(),n.label=t}function IQe(e){this.exit(e)}function LQe(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=u7(this.sliceSerialize(e)).toLowerCase(),n.label=t}function RQe(e){this.exit(e)}function zQe(){return`[`}function BQe(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 VQe(){return{enter:{gfmFootnoteCallString:jQe,gfmFootnoteCall:MQe,gfmFootnoteDefinitionLabelString:NQe,gfmFootnoteDefinition:PQe},exit:{gfmFootnoteCallString:FQe,gfmFootnoteCall:IQe,gfmFootnoteDefinitionLabelString:LQe,gfmFootnoteDefinition:RQe}}}GQe.peek=KQe;function HQe(){return{canContainEols:[`delete`],enter:{strikethrough:UQe},exit:{strikethrough:WQe}}}function UQe(e){this.enter({type:`delete`,children:[]},e)}function WQe(e){this.exit(e)}function GQe(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 KQe(){return`~`}function qQe(){return{enter:{table:JQe,tableData:ZQe,tableHeader:ZQe,tableRow:XQe},exit:{codeText:QQe,table:YQe,tableData:Q7,tableHeader:Q7,tableRow:Q7}}}function JQe(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 YQe(e){this.exit(e),this.data.inTable=void 0}function XQe(e){this.enter({type:`tableRow`,children:[]},e)}function Q7(e){this.exit(e)}function ZQe(e){this.enter({type:`tableCell`,children:[]},e)}function QQe(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,$Qe));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function $Qe(e,t){return t===`|`?t:e}function e$e(){return{exit:{taskListCheckValueChecked:t$e,taskListCheckValueUnchecked:t$e,paragraph:n$e}}}function t$e(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function n$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||g7(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(u7(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return g7(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 c$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||g7(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=u7(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return g7(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),b7(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function l$e(e,t,n){return e.check(w7,t,e.attempt(r$e,t,n))}function u$e(e){e.exit(`gfmFootnoteDefinition`)}function d$e(e,t,n){let r=this;return b7(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 f$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=x7(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var p$e=class{constructor(){this.map=[]}add(e,t,n){m$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 m$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):h7(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):_7(t)?b7(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||g7(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,_7(t)?b7(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 _7(t)?b7(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||h7(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 _7(t)?b7(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||h7(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||h7(n)?(e.exit(`tableRow`),t(n)):_7(n)?b7(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||g7(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 v$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 p$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({},e9(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function y$e(e,t,n,r,i){let a=[],o=e9(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 e9(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var b$e={name:`tasklistCheck`,tokenize:S$e};function x$e(){return{text:{91:b$e}}}function S$e(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 g7(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 h7(r)?t(r):_7(r)?e.check({tokenize:C$e},t,n)(r):n(r)}}function C$e(e,t,n){return b7(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function w$e(){let e=this.data(),t=e.micromarkExtensions||=[],n=e.fromMarkdownExtensions||=[];t.push(i$e(),f$e(),g$e(),x$e()),n.push(VQe(),HQe(),qQe(),e$e())}var T$e=`fileManager.readmeCollapsed`;function E$e({folderId:e}){let{t}=U(),[n,r]=(0,f.useState)(()=>localStorage.getItem(T$e)===`1`);(0,f.useEffect)(()=>{localStorage.setItem(T$e,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)(oc,{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)(yl,{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)(yl,{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)(oc,{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)(vl,{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)(EQe,{remarkPlugins:[w$e],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 D$e({open:e,onClose:t,onPickTag:n}){let{t:r}=U(),i=no(),{showToast:a}=Hd(),[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:F5,queryFn:Z.getLibraryTags,enabled:e}),_=()=>{i.invalidateQueries({queryKey:F5}),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)(yu,{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)(Ol,{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)(Zu,{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)(Cl,{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)(ku,{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)($d,{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 O$e({file:e,canEdit:t,onClose:n}){let{t:r}=U(),{showToast:i}=Hd(),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:Bd(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:ep(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)(Zs,{className:`w-3 h-3 flex-shrink-0`})]})}),D.push({label:r(`fileManager.details.created`),value:Yf(e.created_at)}),D.push({label:r(`fileManager.details.modified`),value:Yf(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)(Zu,{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)(gu,{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)(Zs,{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)(es,{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)(ku,{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)(Ol,{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)(Bl,{className:`w-4 h-4`}),r(`fileManager.details.save`)]})]})]})]}),g!==null&&d.length>0&&(0,G.jsx)(nG,{archiveName:e.filename,photos:d,initialIndex:g,getPhotoUrl:t=>Z.getLibraryFilePhotoUrl(e.id,t),onClose:()=>_(null),onDelete:t?w:void 0})]})}var k$e=90;function A$e({onClose:e}){let{t}=U(),n=no(),{showToast:r}=Hd(),[i,a]=(0,f.useState)(k$e),[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)(ku,{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)(Zu,{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:Bd(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)(Mu,{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 j$e=(0,f.lazy)(()=>Dt(()=>import(`./PdfPreviewModal-Dz2eXvGI.js`).then(e=>({default:e.PdfPreviewModal})),__vite__mapDeps([0,1]))),M$e=(0,f.lazy)(()=>Dt(()=>import(`./SpreadsheetPreviewModal-DCA5VnZ1.js`).then(e=>({default:e.SpreadsheetPreviewModal})),__vite__mapDeps([2,1])));function t9(e){return e===`csv`||e===`xlsx`||e===`ods`}function n9(e){return e===`step`||e===`stp`}function N$e({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 P$e({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)(mc,{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 F$e=`<>:"/\\|?*`;function I$e(e){for(let t of e)if(F$e.includes(t)||t.charCodeAt(0)<32)return t;return null}function L$e({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`?I$e(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 R$e({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)(fc,{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 z$e({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=>Vp([...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)(Zu,{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)(tc,{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)(Fu,{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 B$e({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)(cs,{className:`w-3.5 h-3.5 transition-transform ${p?`rotate-90`:``}`})}):(0,G.jsx)(`div`,{className:`w-4.5`}),y?(0,G.jsx)(mc,{className:`w-4 h-4 text-purple-600 dark:text-purple-400 flex-shrink-0`}):(0,G.jsx)(fc,{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:Yf(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)(qs,{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)(Cl,{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)(ku,{className:`w-3.5 h-3.5`}),d(`common.delete`)]})]})]})]})})]}),_&&p&&(0,G.jsx)(`div`,{children:e.children.map(e=>(0,G.jsx)(B$e,{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 V$e({file:e,isSelected:t,onSelect:n,onDelete:r,onDownload:i,onPrint:a,onSlice:o,onOpenInSlicer:s,onRunPipeline:c,useSlicerApi:l,desktopSlicer:u,canSlice:d,onPreview3d:p,onPreviewDocument:m,onRename:h,onDetails:g,onGenerateThumbnail:_,onTagClick:v,thumbnailVersion:y,hasPermission:b,canModify:x,authEnabled:S,showModified:C,t:w}){let[T,E]=(0,f.useState)(null),D=b(`library:read`),O=x(`library`,`update`,e.created_by_id),k=x(`library`,`delete`,e.created_by_id),A=[];return a&&j5(e)&&A.push({label:w(`common.print`),icon:(0,G.jsx)(jl,{className:`w-4 h-4 text-bambu-green`}),onClick:()=>a(e),disabled:!b(`queue:create`),title:b(`queue:create`)?void 0:w(`fileManager.noPermissionAddToQueue`)}),M5(e,!!l,u)&&(l?o:s)&&A.push({label:w(`slice.action`),icon:l?(0,G.jsx)(Ms,{className:`w-4 h-4`}):(0,G.jsx)(Zs,{className:`w-4 h-4`}),onClick:()=>{l?o?.(e):s?.(e)},disabled:!d,title:d?void 0:w(l?`fileManager.noPermissionSlice`:`fileManager.noPermissionDownload`)}),c&&l&&M5(e,!0,u)&&A.push({label:w(`library.runWithPipeline.actionLabel`),icon:(0,G.jsx)(El,{className:`w-4 h-4`}),onClick:()=>c(e),disabled:!b(`pipelines:run`),title:b(`pipelines:run`)?void 0:w(`library.runWithPipeline.noPermission`)}),p&&(e.file_type===`3mf`||e.file_type===`gcode`||e.file_type===`stl`||e.file_type===`gcode.3mf`||n9(e.file_type))&&A.push({label:w(`fileManager.preview3d`),icon:(0,G.jsx)(Go,{className:`w-4 h-4`}),onClick:()=>p(e),disabled:!D,title:D?void 0:w(`fileManager.noPermissionPreview`)}),m&&(e.file_type===`pdf`||t9(e.file_type))&&A.push({label:w(`fileManager.preview.open`),icon:e.file_type===`pdf`?(0,G.jsx)(oc,{className:`w-4 h-4`}):(0,G.jsx)(ac,{className:`w-4 h-4`}),onClick:()=>m(e),disabled:!D,title:D?void 0:w(`fileManager.noPermissionPreview`)}),A.push({label:w(`common.download`),icon:(0,G.jsx)(Ws,{className:`w-4 h-4`}),onClick:()=>i(e.id),disabled:!b(`library:read`),title:b(`library:read`)?void 0:w(`fileManager.noPermissionDownload`)}),h&&A.push({label:w(`common.rename`),icon:(0,G.jsx)(Cl,{className:`w-4 h-4`}),onClick:()=>h(e),disabled:!O,title:O?void 0:w(`fileManager.noPermissionRenameFile`)}),g&&A.push({label:w(`fileManager.details.title`),icon:(0,G.jsx)(Rc,{className:`w-4 h-4`}),onClick:()=>g(e),disabled:!D,title:D?void 0:w(`fileManager.noPermissionPreview`)}),e.external_url&&A.push({label:w(`fileManager.details.openLink`),icon:(0,G.jsx)(wc,{className:`w-4 h-4`}),onClick:()=>window.open(e.external_url,`_blank`,`noopener,noreferrer`)}),_&&e.file_type===`stl`&&A.push({label:w(`fileManager.generateThumbnail`),icon:(0,G.jsx)(Ic,{className:`w-4 h-4`}),onClick:()=>_(e),disabled:!O,title:O?void 0:w(`fileManager.noPermissionGenerateThumbnail`)}),A.push({label:w(`common.delete`),icon:(0,G.jsx)(ku,{className:`w-4 h-4`}),onClick:()=>r(e.id),danger:!0,disabled:!k,title:k?void 0:w(`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),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)}${y?(Z.getLibraryFileThumbnailUrl(e.id).includes(`?`)?`&`:`?`)+`v=${y}`:``}`,alt:e.filename,className:`w-full h-full object-cover`}):e.file_type===`pdf`?(0,G.jsx)(oc,{className:`w-12 h-12 text-bambu-gray/30`}):t9(e.file_type)?(0,G.jsx)(ac,{className:`w-12 h-12 text-bambu-gray/30`}):(0,G.jsx)(tc,{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`:n9(e.file_type)?`bg-amber-500/90 text-white`:e.file_type===`pdf`?`bg-red-500/90 text-white`:t9(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:Bd(e.file_size)}),e.print_time_seconds&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(Ts,{className:`w-3 h-3`}),ep(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)(jl,{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`}),w(`fileManager.variants.badge`,{count:e.variant_count})]}),e.print_count>0&&(0,G.jsx)(`div`,{className:`mt-1 text-xs text-bambu-green`,children:w(`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`,onClick:e=>e.stopPropagation(),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:w(`fileManager.details.openLink`),"aria-label":w(`fileManager.details.openLink`),children:(0,G.jsx)(wc,{className:`w-3.5 h-3.5`})}),e.has_notes&&(0,G.jsx)(`button`,{type:`button`,onClick:()=>g?.(e),className:`p-0.5 rounded hover:text-bambu-green`,title:w(`fileManager.details.hasNotes`),"aria-label":w(`fileManager.details.hasNotes`),children:(0,G.jsx)(gu,{className:`w-3.5 h-3.5`})}),(e.photo_count??0)>0&&(0,G.jsxs)(`button`,{type:`button`,onClick:()=>g?.(e),className:`flex items-center gap-0.5 p-0.5 rounded hover:text-bambu-green`,title:w(`fileManager.details.photoCount`,{count:e.photo_count}),"aria-label":w(`fileManager.details.photoCount`,{count:e.photo_count}),children:[(0,G.jsx)(es,{className:`w-3.5 h-3.5`}),(0,G.jsx)(`span`,{children:e.photo_count})]})]}),S&&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)(Lu,{className:`w-3 h-3`}),e.created_by_username]}),C&&(0,G.jsxs)(`div`,{className:`mt-1 text-xs text-bambu-gray flex items-center gap-1`,title:w(`fileManager.lastModified`),children:[(0,G.jsx)(Zo,{className:`w-3 h-3`}),Yf(e.fs_modified_at??e.created_at)]}),(e.tags?.length??0)>0&&(0,G.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1`,onClick:e=>e.stopPropagation(),children:e.tags.map(e=>(0,G.jsxs)(`button`,{type:`button`,onClick:()=>v?.(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)(yu,{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`,onClick:e=>e.stopPropagation(),children:[(0,G.jsx)(`button`,{onClick:e=>{let t=e.currentTarget.getBoundingClientRect();E({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)(qs,{className:`w-4 h-4 text-bambu-gray`})}),T&&(0,G.jsx)(lE,{x:T.x,y:T.y,items:A,onClose:()=>E(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 H$e(){let{t:e}=U(),t=no(),{showToast:n}=Hd(),{hasPermission:r,hasAnyPermission:i,canModify:a,authEnabled:o}=Od(),[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)(()=>localStorage.getItem(`library-view-mode`)||`grid`),[ge,_e]=(0,f.useState)(()=>localStorage.getItem(`library-wrap-folders`)===`true`),[ve,ye]=(0,f.useState)(()=>localStorage.getItem(`library-collapse-folders`)===`true`),[be,xe]=(0,f.useState)(()=>localStorage.getItem(`library-folder-sort-field`)===`activity`?`activity`:`name`),[Se,Ce]=(0,f.useState)(()=>localStorage.getItem(`library-folder-sort-direction`)===`desc`?`desc`:`asc`),[we,Te]=(0,f.useState)(()=>{let e=localStorage.getItem(`library-sidebar-width`);return e?parseInt(e,10):256}),[Ee,De]=(0,f.useState)(!1),Oe=(0,f.useRef)(null);(0,f.useEffect)(()=>{if(!Ee)return;document.body.style.userSelect=`none`,document.body.style.cursor=`col-resize`;let e=e=>{if(!Oe.current)return;let t=Oe.current.parentElement?.getBoundingClientRect();if(!t)return;let n=e.clientX-t.left;Te(Math.min(500,Math.max(200,n)))},t=()=>{De(!1),document.body.style.userSelect=``,document.body.style.cursor=``,localStorage.setItem(`library-sidebar-width`,String(we))};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=``}},[Ee,we]);let[ke,Ae]=(0,f.useState)(``),[je,Me]=(0,f.useState)(`all`),[Ne,Pe]=(0,f.useState)(``),[Fe,Ie]=(0,f.useState)(()=>localStorage.getItem(`library-sort-field`)||`name`),[Le,Re]=(0,f.useState)(()=>localStorage.getItem(`library-sort-direction`)||`asc`),[ze,Be]=(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:Ve}=K({queryKey:[`settings`],queryFn:()=>Z.getSettings()}),He=qW(Ve?.open_in_slicer,Ve?.preferred_slicer),Ue=(0,f.useCallback)(async t=>{try{let{token:e}=await Z.createLibrarySlicerToken(t.id),n=Z.getLibrarySlicerDownloadUrl(t.id,e,t.filename);ZW(`${window.location.origin}${n}`,He)}catch{n(e(`fileManager.toast.openInSlicerFailed`),`error`);let r=Z.getLibraryFileDownloadUrl(t.id);ZW(`${window.location.origin}${r}`,He)}},[He,n,e]),We=(0,f.useCallback)(()=>Ve?.use_slicer_api?r(`library:upload`):i(`library:read_all`,`library:read_own`),[Ve?.use_slicer_api,r,i]),{data:Ge,isLoading:Ke}=K({queryKey:[`library-folders`],queryFn:()=>Z.getLibraryFolders()}),qe=(0,f.useMemo)(()=>{if(!Ge)return Ge;let e=t=>[...t].sort((e,t)=>{let n=0;if(be===`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 Se===`asc`?n:-n}).map(t=>({...t,children:e(t.children)}));return e(Ge)},[Ge,be,Se]),{data:Je}=K({queryKey:[`library-trash-count`],queryFn:async()=>{try{return(await Z.listLibraryTrash(1,0)).total}catch{return 0}},staleTime:3e4}),Ye=u!==null&&ke.trim().length>0,Xe=(0,f.useMemo)(()=>[...N].sort((e,t)=>e-t),[N]),{data:Ze=[]}=K({queryKey:[`library-tags`],queryFn:Z.getLibraryTags}),Qe=(0,f.useMemo)(()=>{let e=new Map;for(let t of Ze)e.set(t.id,t.name);return e},[Ze]);(0,f.useEffect)(()=>{Ze.length!==0&&P(e=>{let t=e.filter(e=>Qe.has(e));return t.length===e.length?e:t})},[Ze.length,Qe]);let $e=(0,f.useCallback)(e=>{P(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]),{data:et,isLoading:tt}=K({queryKey:[`library-files`,u,p,Ye,Xe],queryFn:()=>Z.getLibraryFiles(u,!1,void 0,u===null?p:void 0,Ye,Xe)}),{data:nt}=K({queryKey:[`library-stats`],queryFn:()=>Z.getLibraryStats()}),{data:rt}=K({queryKey:[`users`,`slim`],queryFn:()=>Z.getUsersSlim()}),it=(0,f.useMemo)(()=>{if(!et)return[];let e=new Set(et.map(e=>e.file_type));return Array.from(e).sort()},[et]),at=(0,f.useMemo)(()=>{if(!et)return[];let e=[...et];if(ke.trim()){let t=ke.toLowerCase();e=e.filter(e=>e.filename.toLowerCase().includes(t)||e.print_name&&e.print_name.toLowerCase().includes(t))}if(je!==`all`&&(e=e.filter(e=>e.file_type===je)),Ne.trim()){let t=Ne.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(Fe){case`name`:n=(e.print_name||e.filename).localeCompare(t.print_name||t.filename);break;case`date`:n=(Jf(e.fs_modified_at??e.created_at)?.getTime()??0)-(Jf(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 Le===`asc`?n:-n}),e},[et,ke,je,Ne,Fe,Le]),ot=(0,f.useMemo)(()=>{if(!nt||!Ve)return!1;let e=(Ve.library_disk_warning_gb||5)*1024*1024*1024;return nt.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`)}),ct=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`)}),lt=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`)}),ut=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`)}}),dt=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`)}}),ft=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`)}),pt=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`)}}),mt=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`)}),ht=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`)}),gt=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`)}}),_t=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`)}}),vt=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`)}),yt=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`)}),bt=(0,f.useMemo)(()=>et?et.filter(e=>h.includes(e.id)&&j5(e)):[],[et,h]),{data:xt}=K({queryKey:[`variant-group`,z?.variant_group_id],queryFn:()=>Z.getVariantGroup(z.variant_group_id),enabled:!!z?.variant_group_id}),St=(0,f.useMemo)(()=>{if(z){if(bt.length>1)return bt.map(e=>({id:e.id,filename:e.filename,sliced_for_model:e.sliced_for_model}));if(xt&&xt.members.length>1)return xt.members.map(e=>({id:e.library_file_id,filename:e.filename,sliced_for_model:e.target_model}))}},[z,bt,xt]),Ct=(0,f.useCallback)(e=>{g(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]),wt=(0,f.useCallback)(()=>{at.length>0&&g(at.map(e=>e.id))},[at]),Tt=(0,f.useCallback)(()=>{g([])},[]),Et=()=>{t.invalidateQueries({queryKey:[`library-files`]}),t.invalidateQueries({queryKey:[`library-folders`]}),t.invalidateQueries({queryKey:[`library-stats`]})},{isDraggingOver:Dt,dragHandlers:Ot}=QW({disabled:!r(`library:upload`)||C,onFiles:e=>{E(e),w(!0)}}),kt=(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]),At=e=>{Z.downloadLibraryFile(e).catch(e=>{console.error(`Library file download failed:`,e)})},jt=()=>{L&&(L.type===`file`?dt.mutate(L.id):L.type===`folder`?ut.mutate(L.id):L.type===`bulk`&&pt.mutate(h))},Mt=ut.isPending||dt.isPending||pt.isPending,Nt=e=>{he(e),localStorage.setItem(`library-view-mode`,e)},Pt=Ke||tt,Ft=(0,f.useMemo)(()=>{if(!u||!Ge)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(Ge)},[u,Ge]);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`,...Ot,children:[Dt&&(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)(Iu,{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)(fc,{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:()=>Nt(`grid`),className:`p-1.5 rounded transition-colors ${me===`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:()=>Nt(`list`),className:`p-1.5 rounded transition-colors ${me===`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:()=>vt.mutate(),disabled:vt.isPending||!i(`library:update_own`,`library:update_all`),title:i(`library:update_own`,`library:update_all`)?e(`fileManager.generateThumbnailsForMissing`):e(`fileManager.noPermissionGenerateThumbnail`),children:[vt.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)(mc,{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)(pc,{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)(yu,{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)(ku,{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)(ku,{className:`w-4 h-4 mr-2`}),e(`libraryTrash.headerButton`),typeof Je==`number`&&Je>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:Je})]}),(0,G.jsxs)(Q,{onClick:()=>w(!0),disabled:!r(`library:upload`),title:r(`library:upload`)?void 0:e(`fileManager.noPermissionUpload`),children:[(0,G.jsx)(Iu,{className:`w-4 h-4 mr-2`}),e(`common.upload`)]})]})]}),ot&&nt&&Ve&&(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)(Mu,{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:Bd(nt.disk_free_bytes),total:Bd(nt.disk_total_bytes),threshold:Ve.library_disk_warning_gb})})]})]}),nt&&(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)(sc,{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:nt.total_files})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,G.jsx)(fc,{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:nt.total_folders})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,G.jsx)(Oc,{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:Bd(nt.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 ${ot?`text-amber-500`:`text-white`}`,children:Bd(nt.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`)]}),Ge?.some(e=>e.is_external)&&(0,G.jsxs)(`option`,{value:`__top:external`,children:[`🔗 `,e(`fileManager.allExternal`)]}),qe&&(()=>{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(qe).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:Oe,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:`${we}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 ${Ee?`bg-bambu-green`:`hover:bg-bambu-green/50`}`,onMouseDown:e=>{e.preventDefault(),De(!0)},onDoubleClick:()=>{Te(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 ${Ee?`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:be,onChange:e=>{let t=e.target.value===`activity`?`activity`:`name`;xe(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=Se===`asc`?`desc`:`asc`;Ce(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(Se===`asc`?`fileManager.ascending`:`fileManager.descending`),"aria-label":e(Se===`asc`?`fileManager.ascending`:`fileManager.descending`),children:Se===`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=!ve;ye(e),localStorage.setItem(`library-collapse-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.expandFoldersByDefault`:`fileManager.collapseFoldersByDefault`),children:e(`fileManager.collapse`)}),(0,G.jsx)(`button`,{onClick:()=>{let e=!ge;_e(e),localStorage.setItem(`library-wrap-folders`,String(e))},className:`text-xs px-1.5 py-0.5 rounded transition-colors ${ge?`bg-bambu-green/20 text-bambu-green`:`text-bambu-gray hover:text-white hover:bg-bambu-dark`}`,title:e(ge?`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)(tc,{className:`w-4 h-4`}),(0,G.jsx)(`span`,{className:`text-sm`,children:e(`fileManager.allFiles`)})]}),Ge?.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)(mc,{className:`w-4 h-4 text-purple-600 dark:text-purple-400`}),(0,G.jsx)(`span`,{className:`text-sm`,children:e(`fileManager.allExternal`)})]}),qe?.map(t=>(0,G.jsx)(B$e,{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:ge,defaultExpanded:!ve,showModified:ze,hasPermission:r,t:e},`${t.id}-${ve?`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:[Ze.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`)}),Ze.map(e=>{let t=N.includes(e.id);return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>$e(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)(yu,{className:`w-3 h-3`}),(0,G.jsx)(`span`,{children:e.name}),t&&(0,G.jsx)(Zu,{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`)})]}),Ft?.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)(mc,{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`)}),Ft.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:Ft.external_path||``,children:Ft.external_path})]}),(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:()=>u&<.mutate(u),disabled:lt.isPending,title:e(`fileManager.scanFolder`),children:[lt.isPending?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(Fl,{className:`w-4 h-4`}),(0,G.jsx)(`span`,{className:`ml-1.5`,children:e(`fileManager.scanFolder`)})]})]}),et&&et.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)(Gl,{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:ke,onChange:e=>Ae(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`}),Ye&&(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)(vc,{className:`w-4 h-4 text-bambu-gray hidden sm:block`}),(0,G.jsxs)(`select`,{value:je,onChange:e=>Me(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`)}),it.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:Ne,onChange:e=>Pe(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 ${Ne?`pr-7`:``}`,style:Ne?{WebkitAppearance:`none`,MozAppearance:`textfield`}:void 0}),Ne&&(0,G.jsx)(`button`,{onClick:()=>Pe(``),className:`absolute right-2 top-1/2 -translate-y-1/2 text-bambu-gray hover:text-white z-10`,children:(0,G.jsx)(Zu,{className:`w-3 h-3`})}),(0,G.jsx)(`datalist`,{id:`usernames-list`,children:rt?.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:Fe,onChange:e=>{let t=e.target.value;Ie(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:()=>Re(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(Le===`asc`?`fileManager.ascending`:`fileManager.descending`),children:Le===`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:()=>Be(e=>{let t=!e;return localStorage.setItem(`library-show-modified`,String(t)),t}),className:`p-1.5 rounded bg-bambu-dark border transition-colors ${ze?`border-bambu-green text-bambu-green`:`border-bambu-dark-tertiary text-white hover:border-bambu-green`}`,title:e(ze?`fileManager.hideModified`:`fileManager.showModified`),"aria-pressed":ze,children:(0,G.jsx)(Zo,{className:`w-4 h-4`})})]}),(ke||je!==`all`||Ne)&&(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray hidden sm:inline`,children:e(`fileManager.resultsCount`,{showing:at.length,total:et.length})})]}),at.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===at.length&&h.length>0?(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:Tt,children:[(0,G.jsx)(pu,{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:wt,children:[(0,G.jsx)(du,{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:[bt.length>=1&&(0,G.jsxs)(Q,{variant:`primary`,size:`sm`,onClick:()=>B(bt[0]),disabled:!r(`queue:create`),title:r(`queue:create`)?void 0:e(`fileManager.noPermissionAddToQueue`),children:[(0,G.jsx)(jl,{className:`w-4 h-4 sm:mr-1`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:bt.length>1?e(`fileManager.variants.printAlternatives`,{count:bt.length}):e(`common.print`)})]}),bt.length>=2&&!bt.some(e=>e.variant_group_id)&&(0,G.jsxs)(Q,{variant:`secondary`,size:`sm`,onClick:()=>ft.mutate(bt.map(e=>e.id)),disabled:ft.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)(dl,{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)(yu,{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)(ku,{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:Tt,children:[(0,G.jsx)(Zu,{className:`w-4 h-4 sm:mr-1`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:e(`common.clear`)})]})]})]})]}),Pt?(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`)})]})}):et?.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)(tc,{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)(Ol,{className:`w-4 h-4 mr-2`}),e(`fileManager.uploadFiles`)]})]}):at.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)(Gl,{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:()=>{Ae(``),Me(`all`)},children:e(`fileManager.clearFilters`)})]}):me===`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:at.map(t=>(0,G.jsx)(V$e,{file:t,isSelected:h.includes(t.id),t:e,onSelect:Ct,onDelete:e=>R({type:`file`,id:e}),onDownload:At,onPrint:B,onSlice:ee,onOpenInSlicer:Ue,desktopSlicer:He,onRunPipeline:ne,useSlicerApi:Ve?.use_slicer_api??!1,canSlice:We(),onPreview3d:e=>{j5(e)?c(`/gcode-viewer?library_file=${e.id}`):H(e)},onPreviewDocument:e=>{e.file_type===`pdf`?le(e):de(e)},onRename:e=>ie({type:`file`,id:e.id,name:e.filename}),onDetails:pe,onGenerateThumbnail:e=>yt.mutate(e.id),onTagClick:$e,thumbnailVersion:ae[t.id],hasPermission:r,canModify:a,authEnabled:o,showModified:ze},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`,{})]}),at.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:()=>Ct(t.id),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)(oc,{className:`w-5 h-5 text-bambu-gray/50`}):t9(t.file_type)?(0,G.jsx)(ac,{className:`w-5 h-5 text-bambu-gray/50`}):(0,G.jsx)(tc,{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`,onClick:e=>e.stopPropagation(),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)(wc,{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)(gu,{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)(es,{className:`w-3.5 h-3.5`}),t.photo_count]})]}),ze&&(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:Yf(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)(Lu,{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`:n9(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`:t9(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:Bd(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`,onClick:e=>e.stopPropagation(),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:()=>$e(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)(yu,{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`,onClick:e=>e.stopPropagation(),children:[j5(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)(jl,{className:`w-4 h-4`})})}),M5(t,!!Ve?.use_slicer_api,He)&&(0,G.jsx)(`button`,{onClick:()=>{We()&&(Ve?.use_slicer_api?ee:Ue)(t)},className:`p-1.5 rounded transition-colors ${We()?`hover:bg-bambu-dark text-bambu-gray hover:text-bambu-green`:`text-bambu-gray/50 cursor-not-allowed`}`,title:We()?e(`slice.action`):Ve?.use_slicer_api?e(`fileManager.noPermissionSlice`):e(`fileManager.noPermissionDownload`),disabled:!We(),children:Ve?.use_slicer_api?(0,G.jsx)(Ms,{className:`w-4 h-4`}):(0,G.jsx)(Zs,{className:`w-4 h-4`})}),(Ve?.use_slicer_api??!1)&&M5(t,!0,He)&&(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)(El,{className:`w-4 h-4`})}),(t.file_type===`3mf`||t.file_type===`gcode`||t.file_type===`gcode.3mf`||t.file_type===`stl`||n9(t.file_type))&&(0,G.jsx)(`button`,{onClick:()=>{r(`library:read`)&&(j5(t)?c(`/gcode-viewer?library_file=${t.id}`):H(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`})}),(t.file_type===`pdf`||t9(t.file_type))&&(0,G.jsx)(`button`,{onClick:()=>{r(`library:read`)&&(t.file_type===`pdf`?le(t):de(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:t.file_type===`pdf`?(0,G.jsx)(oc,{className:`w-4 h-4`}):(0,G.jsx)(ac,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{onClick:()=>r(`library:read`)&&At(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)(Ws,{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)(Cl,{className:`w-4 h-4`})}),t.file_type===`stl`&&(0,G.jsx)(`button`,{onClick:()=>a(`library`,`update`,t.created_by_id)&&yt.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:yt.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)(ku,{className:`w-4 h-4`})})]})]},t.id))]})})]}),u!==null&&(0,G.jsx)(E$e,{folderId:u})]})]}),_&&(0,G.jsx)(N$e,{parentId:u,onClose:()=>v(!1),onSave:e=>st.mutate(e),isLoading:st.isPending,t:e}),y&&(0,G.jsx)(P$e,{onClose:()=>b(!1),onSave:e=>ct.mutate(e),isLoading:ct.isPending,t:e}),x&&Ge&&(0,G.jsx)(R$e,{folders:Ge,selectedFiles:h,currentFolderId:u,onClose:()=>S(!1),onMove:e=>mt.mutate({fileIds:h,folderId:e}),isLoading:mt.isPending,t:e}),C&&(0,G.jsx)(WU,{folderId:u,onClose:()=>{w(!1),E([])},onUploadComplete:Et,initialFiles:T.length>0?T:void 0}),D&&(0,G.jsx)(A$e,{onClose:()=>O(!1)}),(0,G.jsx)(D$e,{open:k,onClose:()=>A(!1),onPickTag:e=>{N.includes(e)||P(t=>[...t,e])}}),(0,G.jsx)(aqe,{open:j,fileIds:h,onClose:()=>M(!1)}),F&&(0,G.jsx)(z$e,{folder:F,onClose:()=>I(null),onLink:e=>ht.mutate({id:F.id,data:e}),isLoading:ht.isPending,t:e}),L&&(0,G.jsx)($d,{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:Mt,loadingText:e(`fileManager.deleting`),onConfirm:jt,onCancel:()=>R(null)}),z&&(!z.variant_group_id||xt!==void 0)&&(0,G.jsx)(Tm,{mode:`create`,libraryFileId:St?.[0]?.id??z.id,variantFiles:St,archiveName:St&&St.length>1?`${St[0].filename} ${e(`common.plusNMore`,{count:St.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)(UW,{source:{kind:`libraryFile`,id:V.id,filename:V.filename},onClose:()=>ee(null)}),te&&(0,G.jsx)(KW,{source:{kind:`libraryFile`,id:te.id,filename:te.filename},onClose:()=>ne(null)}),se&&(0,G.jsx)(iqe,{libraryFileId:se.id,title:se.print_name||se.filename,fileType:se.file_type,onClose:()=>H(null),onSnapshot:n9(se.file_type)?kt(se):void 0,onSliceWithBambuddy:M5(se,!0,He)&&r(`library:upload`)?()=>{let e=se;H(null),ee(e)}:void 0}),(ce||ue)&&(0,G.jsxs)(f.Suspense,{fallback:null,children:[ce&&(0,G.jsx)(j$e,{libraryFileId:ce.id,filename:ce.print_name||ce.filename,fileSize:ce.file_size,onClose:()=>le(null),onSnapshot:kt(ce)}),ue&&(0,G.jsx)(M$e,{libraryFileId:ue.id,filename:ue.print_name||ue.filename,fileType:ue.file_type,fileSize:ue.file_size,onClose:()=>de(null),onSnapshot:kt(ue)})]}),fe&&(0,G.jsx)(O$e,{file:fe,canEdit:a(`library`,`update`,fe.created_by_id),onClose:()=>pe(null)}),re&&(0,G.jsx)(L$e,{type:re.type,currentName:re.name,onClose:()=>ie(null),onSave:e=>{re.type===`file`?gt.mutate({id:re.id,filename:e}):_t.mutate({id:re.id,name:e})},isLoading:gt.isPending||_t.isPending,t:e})]})}function U$e(e){let t=Jf(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 W$e(e){let t=Jf(e);return t?t.toLocaleString():e}function G$e(){let{t:e}=U(),t=$n(),n=no(),{showToast:r}=Hd(),{hasPermission:i,authEnabled:a}=Od(),[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)(ku,{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)(Bl,{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:Bd(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)(Ll,{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)(ku,{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:Bd(t.file_size)}),(0,G.jsx)(`td`,{className:`px-3 py-2 text-gray-600 dark:text-gray-400 whitespace-nowrap`,children:W$e(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:W$e(t.auto_purge_at),children:e(`libraryTrash.autoPurgeIn`,{when:U$e(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)(Ll,{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)(ku,{className:`w-3.5 h-3.5`}),e(`libraryTrash.purgeNow`)]})]})]},t.id))})]})})]}),o&&(0,G.jsx)($d,{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 K$e(e){return e.includes(`/camera/`)}function q$e(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=K$e(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 J$e(){let{authEnabled:e,user:t,loading:n,hasPermission:r}=Od(),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)(()=>(ud(u),cd(d),(u||d)&&q$e(document,u,d),()=>{ud(null),cd(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=K$e(n),o=r?ld():dd();!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 r9=5,Y$e=2e3,X$e=3e4,Z$e=5e3;function Q$e(){let{t:e}=U(),t=no(),{showToast:n}=Hd(),{hasPermission:r,authEnabled:i,user:a}=Od(),{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);J$e();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??ld(),[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=ad();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>=r9){P(!1),S(!0);return}let e=Math.min(Y$e*2**j,X$e);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{}},Z$e),()=>{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=ad();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)}`:fd(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)(es,{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)(QT,{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)($T,{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)(Fl,{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)(hu,{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)(ol,{className:`w-4 h-4 text-bambu-gray`}):(0,G.jsx)(nl,{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)(Fl,{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)(Ku,{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,r9),max:r9})}),(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)(Mu,{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)(ed,{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)(Qu,{className:`w-4 h-4 text-white`})})]})]})}),(0,G.jsx)(eE,{printerId:s,isOpen:_,onClose:()=>v(!1)}),y&&(0,G.jsx)(tE,{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 $$e=5e3,e1e=4,t1e=8,n1e=1,r1e=16,i1e=2,a1e=60;function o1e(e,t,n,r){let i=parseInt(e??``,10);return Number.isFinite(i)?Math.min(r,Math.max(n,i)):t}function s1e(e,t,n,r,i,a){return e.has(t)?o1e(e.get(t),r,i,a):o1e(localStorage.getItem(n),r,i,a)}function c1e(){let{t:e}=U(),t=Xn(),{authEnabled:n,loading:r,user:i}=Od(),[a]=ji(),o=a.get(`token`),s=o!=null&&o!==``,[c,l]=(0,f.useState)(()=>s1e(a,`maxLive`,`camWallMaxLive`,e1e,n1e,r1e)),[u,d]=(0,f.useState)(()=>s1e(a,`interval`,`camWallSnapshotSec`,t1e,i1e,a1e)),[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 cd(o),()=>cd(null)},[s,o]);let h=K({queryKey:[`camwall-printers`,o],queryFn:()=>Z.getCamWallPrinters(o??void 0),enabled:s,refetchInterval:$$e}),g=K({queryKey:[`printers`],queryFn:()=>Z.getPrinters(),enabled:!s&&!r&&(!n||i!==null),refetchInterval:$$e}),_=(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)(cE,{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 l1e(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 u1e(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,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`),showNozzle:t.includes(`nozzle`),showBed:t.includes(`bed`),showChamber:t.includes(`chamber`)}}function d1e(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 i9(e,t){let n=e[t];return typeof n==`number`?n:null}function f1e({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 p1e(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 m1e(){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)(()=>u1e(t),[t]),c=p1e(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,camera_rotation:d.camera_rotation}:p,[u,d,p]),_=u?d:m,v=(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 nd?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 y=()=>{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(!_)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 b=_.state===`RUNNING`||_.state===`PAUSE`,x=_.progress||0,S=_.temperatures??{},C=[];if(s.showNozzle){let e=i9(S,`nozzle`),t=i9(S,`nozzle_2`);e!=null&&C.push({key:`nozzle`,icon:(0,G.jsx)(lc,{className:c.icon}),label:n(`printers.heaterHistory.nozzle`,`Nozzle`),current:e,target:i9(S,`nozzle_target`)}),t!=null&&C.push({key:`nozzle_2`,icon:(0,G.jsx)(lc,{className:c.icon}),label:n(`printers.heaterHistory.nozzle2`,`Nozzle 2`),current:t,target:i9(S,`nozzle_2_target`)})}if(s.showBed){let e=i9(S,`bed`);e!=null&&C.push({key:`bed`,icon:(0,G.jsx)(pu,{className:c.icon}),label:n(`printers.heaterHistory.bed`,`Bed`),current:e,target:i9(S,`bed_target`)})}if(s.showChamber){let e=i9(S,`chamber`);e!=null&&C.push({key:`chamber`,icon:(0,G.jsx)(Go,{className:c.icon}),label:n(`printers.heaterHistory.chamber`,`Chamber`),current:e,target:i9(S,`chamber_target`)})}let w=`/api/v1/printers/${i}/camera/stream?fps=${s.fps}&t=${a}`,T=u&&l?`${w}&token=${encodeURIComponent(l)}`:fd(w);return(0,G.jsxs)(`div`,{className:`min-h-screen bg-black relative overflow-hidden`,children:[s.showCamera&&(0,G.jsx)(`img`,{src:T,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:y},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:[s.showPrinter&&g&&(0,G.jsxs)(`div`,{className:`flex items-center ${c.gap} mb-2`,children:[(0,G.jsx)(jl,{className:`${c.icon} text-white/70`}),(0,G.jsx)(`span`,{className:`${c.text} text-white font-medium`,children:g.name})]}),s.showFilename&&_.current_print&&(0,G.jsx)(`div`,{className:`${c.textLarge} text-white font-semibold mb-2 truncate drop-shadow-md`,children:l1e(_.current_print.replace(/\.gcode\.3mf$|\.3mf$|\.gcode$/i,``),_.gcode_file,n)}),s.showStatus&&(0,G.jsx)(`div`,{className:`${c.text} text-white/70 mb-2`,children:d1e(_,n)}),s.showProgress&&b&&(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(x),`%`]})]}),(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:`${x}%`}})})]}),b&&(s.showLayers||s.showEta)&&(0,G.jsxs)(`div`,{className:`flex items-center ${c.gap} flex-wrap`,children:[s.showLayers&&_.layer_num!=null&&_.total_layers!=null&&_.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:_.layer_num}),(0,G.jsx)(`span`,{className:`mx-1`,children:`/`}),(0,G.jsx)(`span`,{children:_.total_layers})]})]}),s.showEta&&_.remaining_time!=null&&_.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)(Ou,{className:c.icon}),(0,G.jsx)(`span`,{className:`${c.text} text-white`,children:ep(_.remaining_time*60)})]}),(0,G.jsxs)(`div`,{className:`flex items-center ${c.gap} text-white/70`,children:[(0,G.jsx)(Ts,{className:c.icon}),(0,G.jsxs)(`span`,{className:`${c.text} text-white`,children:[n(`streamOverlay.eta`),` `,$f(_.remaining_time,v,n)]})]})]})]}),!b&&(0,G.jsx)(`div`,{className:`${c.text} text-white/70 py-2`,children:_.connected?n(`streamOverlay.printerIdle`):n(`streamOverlay.printerOffline`)}),C.length>0&&(0,G.jsx)(`div`,{className:`flex items-center ${c.gap} flex-wrap mt-2`,children:C.map(e=>(0,G.jsx)(f1e,{icon:e.icon,label:e.label,current:e.current,target:e.target,sizes:c},e.key))})]})})]})}function h1e(){let{t:e}=U(),{id:t}=ir(),{mode:n}=jd(),{data:r,isLoading:i,error:a}=K({queryKey:[`external-link`,t],queryFn:()=>Z.getExternalLink(Number(t)),enabled:!!t});return i?(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`})}):a||!r?(0,G.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-4 text-bambu-gray`,children:[(0,G.jsx)(Mu,{className:`w-12 h-12`}),(0,G.jsx)(`p`,{children:e(`common.linkNotFound`)})]}):(0,G.jsx)(`iframe`,{src:r.url,className:`h-full w-full border-0`,style:{colorScheme:n},title:r.name,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox`})}function g1e(){let{id:e}=ir(),t=$n(),n=no(),{t:r}=U(),{showToast:i}=Hd(),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)(Mu,{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)(Gl,{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)(Pd,{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)(as,{className:`w-3 h-3 text-white`}),o&&!a&&(0,G.jsx)(sl,{className:`w-3 h-3 text-white`})]}),(0,G.jsx)(eu,{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)(Bl,{className:`w-4 h-4`}),r(`common.save`)]})})]})]})}var _1e=1.65,v1e=[`#1DB954`,`#3B82F6`,`#F59E0B`,`#EF4444`,`#8B5CF6`];function a9(e,t,n,r){return`${e}||${t??``}||${n??``}||${r??``}`}function o9(e,t){let n=new Date(e);return n.setDate(n.getDate()+Math.round(t)),n}function s9(e){return e.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function c9(e){return e.toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function y1e(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 b1e(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(a9(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=a9(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(a9(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=y1e(u);if(m!==null)d=m.rate,f=m.stdDev,p=`history`;else{let e=b1e(t.spools);e!==null&&(d=e,p=`delta`)}let h=_1e*(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:o9(e,_),y=d&&d>0?Math.floor((s-g)/d):null,b=y===null?null:o9(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)(Mu,{className:`w-4 h-4`}),r(`forecast.alertCount`,{count:L.length}),c?(0,G.jsx)(us,{className:`w-3.5 h-3.5`}):(0,G.jsx)(ss,{className:`w-3.5 h-3.5`})]}),s&&(0,G.jsx)(E1e,{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)(tu,{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)(C1e,{forecast:e,onCart:()=>b(e)},e.group.key))}),x&&(0,G.jsx)(j1e,{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)(T1e,{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)(Au,{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)(l9,{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)(l9,{col:`stock`,active:u,dir:p,onSort:z,children:r(`forecast.stock`)}),(0,G.jsx)(l9,{col:`used`,active:u,dir:p,onSort:z,children:r(`forecast.dailyRate`)}),(0,G.jsx)(l9,{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)(D1e,{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)(N1e,{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 l9({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 C1e({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)(Mu,{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?s9(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)(tu,{className:`w-3 h-3`}),` `,n(`forecast.order`)]})]})}var w1e=[{label:`1W`,value:7},{label:`1M`,value:30},{label:`6M`,value:180}];function T1e({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:v1e[n%v1e.length],rop:e.reorderPointG,points:x1e(e,t)})),o=i.map(e=>{let t={day:e,label:c9(o9(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)(Au,{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:w1e.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)(WA,{width:`100%`,height:220,children:(0,G.jsxs)(WH,{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)(lV,{strokeDasharray:`3 3`,stroke:`#374151`,strokeOpacity:.5}),(0,G.jsx)(eH,{dataKey:`label`,tick:{fill:`#6B7280`,fontSize:10},interval:Math.max(0,Math.ceil(s/8)-1),axisLine:!1,tickLine:!1}),(0,G.jsx)(aH,{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)(Jz,{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)(Yj,{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)(MV,{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)(QB,{y:e.rop,stroke:e.color,strokeDasharray:`4 3`,strokeOpacity:.6},`rop-${e.key}`))]})})]})}function E1e({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)(Sl,{className:`w-3 h-3`})})]})]})}function D1e({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?Tf(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?s9(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?s9(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)(tu,{className:`w-4 h-4`})}),!x&&(e.stockBreakAlert?(0,G.jsx)(Mu,{className:`w-4 h-4 text-red-600 dark:text-red-400`,"aria-label":o(`forecast.stockBreakRisk`)}):e.reorderAlert?(0,G.jsx)(Mu,{className:`w-4 h-4 text-yellow-600 dark:text-yellow-400`,"aria-label":o(`forecast.reorderNow`)}):e.daysRemaining===null?null:(0,G.jsx)(as,{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)(us,{className:`w-4 h-4`}):(0,G.jsx)(ss,{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)(O1e,{label:o(`forecast.effectiveLeadTime`),value:`${e.effectiveLeadTimeDays}d`,hint:o(`forecast.effectiveLeadTimeHint`,{global:t,sku:e.settings?.lead_time_days??0})}),(0,G.jsx)(O1e,{label:o(`forecast.reorderPoint`),value:`${Math.round(e.reorderPointG)}g`,hint:o(`forecast.reorderPointHint`)}),n&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(k1e,{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)(A1e,{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 O1e({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 k1e({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)(Sl,{className:`w-3 h-3`})})]})]})}function A1e({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)(Sl,{className:`w-3 h-3`})})]})]})}function j1e({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};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(a9(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(a9(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?s9(o9(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)(tu,{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)(gl,{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)(rs,{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)(Ws,{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)(Zu,{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)(gl,{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(a9(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?o9(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)(Mu,{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?s9(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)(Ll,{className:`w-4 h-4`}):(0,G.jsx)(Ls,{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)(ml,{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)(ku,{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)(M1e,{item:e,forecast:t,globalLeadTime:n,canWrite:r,onRemove:()=>a(e.id)},e.id))})]})}function M1e({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=c9(o9(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)(Jz,{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)(MV,{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)(QB,{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)(QB,{y:t.safetyStockG,stroke:`#6B7280`,strokeDasharray:`3 3`,strokeOpacity:.6,label:{value:`SS`,position:`insideTopRight`,fill:`#6B7280`,fontSize:9}}),(0,G.jsx)(QB,{x:c9(o9(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)(QB,{x:c9(o9(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 N1e({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)(tu,{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)(Zu,{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 u9={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,location_id:null,spoolman_filament_id:null},P1e=new Set([`material`,`subtype`,`brand`,`rgba`,`color_name`,`label_weight`]);function F1e(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 I1e={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 d9({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 ${I1e[e]}`,children:n})}function L1e({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)(d9,{source:p.source}),(0,G.jsx)(ss,{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)(Gl,{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)(Zu,{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)(d9,{source:t.source})]},t.code))]})]})]})}function R1e(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 f9({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 z1e({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 fU;let e=k.toLowerCase();return fU.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)(()=>R1e(ne,u),[ne,u]),oe=(0,f.useMemo)(()=>R1e(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=vU(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)(Os,{className:`w-3 h-3 text-bambu-green`}),` `,v(`inventory.cloudConnected`)]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Es,{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)(Gl,{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)(d9,{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)(ss,{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)(f9,{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)(f9,{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)(ss,{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)(f9,{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)(f9,{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)(ss,{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&&!fU.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)(`input`,{type:`number`,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:e=>{g(Math.max(1,Math.min(100,parseInt(e.target.value)||1)))}})]})]})}function B1e(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 V1e({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=>Tf(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?mU.filter(e=>e.name.toLowerCase().includes(c.toLowerCase())):o?mU:pU,[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)(()=>dm({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}=B1e(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)(Ts,{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)(Gl,{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)(us,{className:`w-3 h-3`})]}):(0,G.jsxs)(G.Fragment,{children:[a(`inventory.showAll`),` `,(0,G.jsx)(ss,{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)(uu,{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:lm.map(e=>(0,G.jsx)(`option`,{value:e.value,children:a(e.labelKey)},e.value||`none`))}),(0,G.jsx)(fm,{rgba:e.rgba,extraColors:e.extra_colors,effectType:e.effect_type,subtype:e.subtype,effectSize:`preview`,className:`w-10 h-10`,shape:`square`})]})]})]})]})}function H1e({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)(Vl,{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 U1e({formData:e,updateField:t,spoolCatalog:n,currencySymbol:r,availableCategories:i,availableLocations:a=[],onCreateLocation:o,globalLowStockThreshold:s,spoolmanMode:c=!1}){let{t:l}=U(),{showToast:u}=Hd(),[d,p]=(0,f.useState)(``),[m,h]=(0,f.useState)(!1),[g,_]=(0,f.useState)(``),[v,y]=(0,f.useState)(!1),[b,x]=(0,f.useState)(``),[S,C]=(0,f.useState)(!1),w=Math.max(0,e.label_weight-e.weight_used),T=e.core_weight+w;return(0,f.useEffect)(()=>{m||p(String(T))},[m,T]),(0,f.useEffect)(()=>{v||_(String(w))},[v,w]),(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:c?(0,G.jsx)(`p`,{className:`text-xs text-bambu-gray px-1`,children:l(`inventory.spoolWeightManagedBySpoolman`)}):(0,G.jsx)(H1e,{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:l(`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:g,min:0,max:e.label_weight,onFocus:()=>y(!0),onChange:e=>{_(e.target.value)},onBlur:()=>{y(!1);let n=g.trim(),r=Number(n);if(!n||!Number.isFinite(r)||r<0||r>e.label_weight){_(String(w));return}let i=Math.round(r);t(`weight_used`,Math.max(0,e.label_weight-i)),_(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:l(`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:d,min:0,onFocus:()=>h(!0),onChange:e=>{p(e.target.value)},onBlur:()=>{h(!1);let n=d.trim(),r=Number(n),i=e.core_weight,a=e.core_weight+e.label_weight;if(!n||!Number.isFinite(r)||ra){u(l(`inventory.measuredWeightError`,{min:i,max:a}),`error`),p(String(T));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)),p(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:l(`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`})]})})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-sm font-medium text-bambu-gray mb-1`,htmlFor:`spool-category`,children:l(`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:l(`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:l(`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(s),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:l(`inventory.lowStockThresholdOverrideHelp`,{global:s})})]}),(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:l(`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:l(`inventory.storageLocationNone`)}),a.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),o&&(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:l(`locations.createPlaceholder`),value:b,onChange:e=>x(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:!b.trim()||S,onClick:async()=>{let e=b.trim();if(!(!e||!o)){C(!0);try{let n=await o(e);n&&(t(`location_id`,n.id),x(``))}finally{C(!1)}}},children:l(`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:l(`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:l(`inventory.notePlaceholder`),value:e.note,onChange:e=>t(`note`,e.target.value)})]})]})}function W1e({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:Tf(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)(gl,{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)(ss,{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:Tf(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 p9(e){let t=(e??``).trim().toUpperCase().slice(0,2);return t===`HH`||t===`HS`?t:null}function m9(e){return e?e===`HH`?`HF`:`S`:null}function G1e(e,t){let n=e.nozzles??[];return p9(n[(e.printer.nozzle_count??1)>1&&t>0?t:0]?.nozzle_type)??p9(n[0]?.nozzle_type)}function K1e(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 q1e(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 J1e({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([...gU,...t.flatMap(K1e)])).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([...gU,...K1e(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=lU(e.name,l??{});return!n||tU(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=>q1e(e,{left:d(`inventory.leftNozzle`),right:d(`inventory.rightNozzle`),single:d(`inventory.nozzle`)}),y=t=>t.printer.connected?t.calibrations.filter(t=>AU(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(OU(n.printer.id,i.extruder,o))||t++)}return t},x=(e,t,n)=>{i(r=>{let i=new Map(r),a=kU(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=OU(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)&&lU(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(kU(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=kU(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)(L1e,{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)(as,{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)(uu,{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)(jl,{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=OU(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=G1e(e,r.extruder),l=p9(s?.nozzle_id),u=!!(c&&l&&c!==l);return(0,G.jsxs)(`select`,{title:u?d(`inventory.kProfileFlowMismatch`,{profile:m9(l),fitted:m9(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=m9(p9(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 Y1e(e){let t=Jf(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 X1e={completed:`text-bambu-green`,failed:`text-red-700 dark:text-red-400`,aborted:`text-yellow-700 dark:text-yellow-400`};function Z1e({spoolId:e}){let{t}=U(),n=no(),{showToast:r}=Hd(),{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)(Ts,{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)(ku,{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:Y1e(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:X1e[e.status]||`text-bambu-gray`,children:e.status})]})]},e.id))})]})}var Q1e={tag_uid:null,tray_uuid:null,tag_type:null,data_origin:null};function $1e({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}=Hd(),p=()=>v6(u,c),m=r===`edit`,h=r===`copy`,[g,_]=(0,f.useState)(u9),[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)(1),[A,j]=(0,f.useState)(!1),[M,N]=(0,f.useState)(!1),[P,F]=(0,f.useState)([]),[I,L]=(0,f.useState)(new Set),[R,z]=(0,f.useState)(``),[B,V]=(0,f.useState)([]),[ee,te]=(0,f.useState)([]),[ne,re]=(0,f.useState)([]),[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)(!1),[pe,me]=(0,f.useState)(new Map),[he,ge]=(0,f.useState)(new Map),[_e,ve]=(0,f.useState)(``),ye=i.length>0?i:le,be=pe.size+he.size,{data:xe=[],isLoading:Se,error:Ce}=K({queryKey:[`spoolman-inventory-filaments`],queryFn:()=>Z.getSpoolmanInventoryFilaments(),enabled:s&&e,staleTime:6e4,retry:!1});(0,f.useEffect)(()=>{ce(wU())},[]),(0,f.useEffect)(()=>{let t=!1;return e&&((async()=>{N(!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:[];j(r||i),F([...a,...o]),L(new Set(o.map(e=>e.setting_id)))}catch(e){if(t)return;console.error(`Failed to fetch cloud presets:`,e),j(!1)}finally{t||N(!1)}})(),s||Z.getSpoolCatalog().then(V).catch(console.error),Z.getColorCatalog().then(se).catch(console.error),Z.getLocalPresets().then(e=>re(e.filament)).catch(console.error),Z.getBuiltinFilaments().then(ae).catch(console.error),Z.getLocations().then(e=>te(e.map(e=>({id:e.id,name:e.name})))).catch(console.error),i.length===0&&(async()=>{fe(!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 _U(e.id,r)),{printer:{...e,connected:i},calibrations:a,nozzles:r?.nozzles}}));t||ue(r)}catch(e){console.error(`Failed to fetch printer calibrations:`,e)}finally{t||fe(!1)}})()),()=>{t=!0}},[e,i.length]);let we=(0,f.useMemo)(()=>bU(P,new Set,ne,ie,I),[P,ne,ie,I]),Te=(0,f.useMemo)(()=>{let e=yU(P,ne),t=oe.map(e=>e.manufacturer?.trim()).filter(e=>!!e),n=new Set([...e,...t]);return Array.from(n).sort((e,t)=>e.localeCompare(t))},[P,ne,oe]),Ee=(0,f.useMemo)(()=>{let e=oe.map(e=>e.material?.trim()).filter(e=>!!e),t=new Set([...uU,...e]);return Array.from(t).sort((e,t)=>e.localeCompare(t))},[oe]),De=(0,f.useMemo)(()=>{let e=[];for(let t of oe){let n=t.manufacturer?.trim(),r=t.material?.trim();n&&r&&e.push({brand:n,material:r})}for(let t of P){let n=vU(t.name);n.brand&&n.material&&e.push({brand:n.brand,material:n.material})}for(let t of ne){let n=vU(t.name),r=t.filament_vendor?.trim()||n.brand,i=n.material;r&&i&&e.push({brand:r,material:i})}return e},[P,oe,ne]),Oe=(0,f.useMemo)(()=>{let e=new Map;for(let t of De){let n=t.brand.toLowerCase(),r=t.material.toLowerCase();e.has(n)||e.set(n,new Set),e.get(n).add(r)}return e},[De]),ke=(0,f.useMemo)(()=>{let e=new Map;for(let t of De){let n=t.brand.toLowerCase(),r=t.material.toLowerCase();e.has(r)||e.set(r,new Set),e.get(r).add(n)}return e},[De]),Ae=(0,f.useMemo)(()=>SU(Te,g.brand),[Te,g.brand]),je=(0,f.useMemo)(()=>SU(Ee,g.material),[Ee,g.material]),Me=(0,f.useMemo)(()=>CU(Ae,g.material,ke),[Ae,g.material,ke]),Ne=(0,f.useMemo)(()=>CU(je,g.brand,Oe),[je,g.brand,Oe]),Pe=(0,f.useMemo)(()=>xU(g.slicer_filament,we),[g.slicer_filament,we]);(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,location_id:n.location_id??null,spoolman_filament_id:null}),z(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(OU(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||``})}me(e)}else me(new Map)}else _(u9),z(``),me(new Map);D(!1),k(1),y({}),x(`filament`),ve(``),ge(new Map),C(!1),T(!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(kU(t.printer_model,t.nozzle_diameter||``),{code:t.slicer_filament||``,name:t.slicer_filament_name||``});ge(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||w||g.location_id!=null)return;let t=n.storage_location?.trim();if(!t||ee.length===0)return;let r=ee.find(e=>e.name.toLowerCase()===t.toLowerCase());r&&_(e=>e.location_id===r.id?e:{...e,location_id:r.id})},[e,n,ee,g.location_id,w]);let Fe=(e,t)=>{let n=P1e.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===`location_id`&&T(!0),v[e]&&y(t=>({...t,[e]:void 0}))},Ie=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`)},Le=e=>{ce(t=>TU(e,t))},Re=q({mutationFn:e=>s?Z.createSpoolmanInventorySpool(e):Z.createSpool(e),onSuccess:async e=>{e?.id&&!await Ze(e.id)||(await p(),o&&o([e]),d(l(`inventory.spoolCreated`),`success`),t())},onError:e=>{e instanceof nd&&e.status===503?d(l(`inventory.spoolmanUnreachable`),`error`):d(l(`inventory.saveFailed`),`error`)}}),ze=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(pe.size>0||he.size>0)for(let e of r)await Ze(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 nd&&e.status===503?d(l(`inventory.spoolmanUnreachable`),`error`):d(l(`inventory.saveFailed`),`error`)}}),Be=q({mutationFn:e=>s?Z.updateSpoolmanInventorySpool(n.id,e):Z.updateSpool(n.id,e),onSuccess:async()=>{n?.id&&!await Ze(n.id)||(await p(),d(l(`inventory.spoolUpdated`),`success`),t())},onError:e=>{e instanceof nd&&e.status===503?d(l(`inventory.spoolmanUnreachable`),`error`):d(l(`inventory.saveFailed`),`error`)}}),Ve=q({mutationFn:()=>s?Z.updateSpoolmanInventorySpool(n.id,Q1e):Z.updateSpool(n.id,Q1e),onSuccess:async()=>{await p(),d(l(`inventory.rfidCleared`,`RFID tag cleared`),`success`),t()},onError:e=>{e instanceof nd&&e.status===503?d(l(`inventory.spoolmanUnreachable`),`error`):d(l(`inventory.tagClearFailed`),`error`)}}),{data:He}=K({queryKey:[`spool-assignments`],queryFn:()=>Z.getAssignments(),enabled:e&&m&&!s}),{data:Ue}=K({queryKey:[`spoolman-slot-assignments-all`],queryFn:()=>Z.getSpoolmanSlotAssignments(),enabled:e&&m&&s}),We=(()=>{if(n)return s?Ue?.find(e=>e.spoolman_spool_id===n.id):He?.find(e=>e.spool_id===n.id)})(),{data:Ge}=K({queryKey:[`inventory-spools`],queryFn:()=>Z.getSpools(!0),enabled:e}),{data:Ke}=K({queryKey:[`settings`],queryFn:Z.getSettings,enabled:e}),{data:qe}=K({queryKey:[`slicerPrinterModels`],queryFn:Z.getSlicerPrinterModels,enabled:e,staleTime:1/0}),Je=(()=>{let e=new Set;for(let t of Ge??[]){let n=t.category?.trim();n&&e.add(n)}return Array.from(e).sort((e,t)=>e.localeCompare(t))})(),Ye=Ke?.low_stock_threshold??20,Xe=q({mutationFn:async()=>{if(!We)throw Error(`No assignment`);if(s){if(!n)throw Error(`No spool`);await Z.unassignSpoolmanSlot(n.id);return}await Z.unassignSpool(We.printer_id,We.ams_id,We.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`)}}),Ze=async e=>{let t=s?Z.saveSpoolmanKProfiles:Z.saveSpoolKProfiles,n=s?Z.saveSpoolmanFilamentPresets:Z.saveSpoolFilamentPresets,r=[];for(let[e,t]of pe){let[n,i,a]=e.split(`:`);r.push({printer_id:parseInt(n),extruder:parseInt(i),nozzle_diameter:a||`0.4`,nozzle_type:p9(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 he){let{model:n,diameter:r}=oAe(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`&&t()};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,t]),!e)return null;let Qe=()=>{let e=F1e(g,E,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=Pe?.displayName||R||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?{}:{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,...s?{spoolman_filament_id:g.spoolman_filament_id}:{}};(!m||S)&&(n.weight_used=g.weight_used),(!m||w)&&(n.location_id=g.location_id),m?Be.mutate(n):O>1?ze.mutate({data:n,qty:O}):Re.mutate(n)},$e=Re.isPending||ze.isPending||Be.isPending||Ve.isPending||Xe.isPending;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 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)(Zu,{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)($u,{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:()=>{D(!E),E||x(`filament`)},className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors ${E?`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 ${E?`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`)]}),!E&&(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)(_l,{className:`w-4 h-4`}),l(`inventory.colorAndCostTab`)]}),!E&&(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)($u,{className:`w-4 h-4`}),l(`inventory.printersTab`),be>0&&(0,G.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded-full bg-bambu-green/20 text-bambu-green`,children:be})]})]}),(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:Ce?(0,G.jsx)(`p`,{className:`text-sm text-red-700 dark:text-red-400 px-1`,children:l(`inventory.spoolmanCatalogLoadFailed`)}):(0,G.jsx)(W1e,{filaments:xe,isLoading:Se,selectedId:g.spoolman_filament_id,onSelect:Ie})}),(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)(z1e,{formData:g,updateField:Fe,cloudAuthenticated:A,loadingCloudPresets:M,presetInputValue:R,setPresetInputValue:z,selectedPresetOption:Pe,filamentOptions:we,availableBrands:Ae,availableMaterials:je,suggestedBrands:Me,suggestedMaterials:Ne,quickAdd:E,detailsRequired:!E&&!s&&r===`create`,quantity:O,onQuantityChange:k,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)(V1e,{formData:g,updateField:Fe,recentColors:H,onColorUsed:Le,catalogColors:oe})]}),(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)(U1e,{formData:g,updateField:Fe,spoolCatalog:B,currencySymbol:a,availableCategories:Je,availableLocations:ee,onCreateLocation:async e=>{try{let t=await Z.createLocation({name:e});return te(e=>[...e,{id:t.id,name:t.name}].sort((e,t)=>e.name.localeCompare(t.name))),await _6(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:Ye,spoolmanMode:s})]}),m&&n&&!s&&(0,G.jsx)(`div`,{children:(0,G.jsx)(Z1e,{spoolId:n.id})})]}):(0,G.jsx)(J1e,{formData:g,printersWithCalibrations:ye,filamentOptions:we,modelPresets:he,setModelPresets:ge,selectedProfiles:pe,setSelectedProfiles:me,selectedGroupId:_e,setSelectedGroupId:ve,printerModels:qe,isLoading:de})}),(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:()=>Ve.mutate(),disabled:$e||!(n?.tag_uid||n?.tray_uuid),children:[(0,G.jsx)(yu,{className:`w-4 h-4`}),l(`inventory.clearRfid`,`Clear RFID Tag`)]}),(0,G.jsxs)(Q,{variant:`secondary`,onClick:()=>Xe.mutate(),disabled:$e||!We,children:[(0,G.jsx)(Fu,{className:`w-4 h-4`}),l(`inventory.unassignSpool`,`Unassign`)]})]}),(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:Qe,disabled:$e,children:$e?(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)(Bl,{className:`w-4 h-4`}),l(m?`common.save`:h?`inventory.copySpool`:`inventory.addSpool`)]})})]})]})]})]})}var e0e=[{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.`}],h9={avery_l7160:21,avery_5160:30},g9=Math.max(...Object.values(h9));function t0e(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 n0e(e){return Tf(e)}function r0e(e){return Sf(e.color_name,e.rgba,e.color_name_is_synthesized)}function i0e(e){return`${r0e(e)??`${e.material}${e.subtype?` ${e.subtype}`:``}`}${e.brand?` · ${e.brand}`:``}`}function a0e(e){return[r0e(e),e.color_name,e.material,e.subtype,e.brand,`#${e.id}`].filter(Boolean).join(` `).toLowerCase()}function o0e(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 s0e({isOpen:e,onClose:t,availableSpools:n,initialSelectedIds:r,spoolmanMode:i}){let{t:a}=U(),o=Of(),{showToast:s}=Hd(),[c,l]=(0,f.useState)(null),[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)(!1),[x,S]=(0,f.useState)(`1`);(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(!1),S(`1`),l(null)}},[e]);let C=(0,f.useMemo)(()=>{let e=[...n];return _===`color`?(e.sort((e,t)=>{let n=o0e(e.rgba),r=o0e(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,_]),w=(0,f.useMemo)(()=>{let e=new Set;for(let t of C)t.material&&e.add(t.material.toUpperCase());return[...e].sort()},[C]),T=(0,f.useMemo)(()=>{let e=p.trim().toLowerCase();return C.filter(t=>!(h&&(t.material||``).toUpperCase()!==h||e&&!a0e(t).includes(e)))},[C,p,h,o]),E=T.length>0&&T.every(e=>u.has(e.id));if(!e)return null;let D=u.size,O=D===0,k=Number(x),A=Number.isInteger(k)&&k>=1&&k<=g9;function j(e){d(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function M(){d(e=>{let t=new Set(e);for(let e of T)t.add(e.id);return t})}function N(){d(e=>{let t=new Set(e);for(let e of T)t.delete(e.id);return t})}function P(){d(new Set)}async function F(e){if(O||c)return;let n=h9[e];if(n!==void 0&&(!A||k>n)){s(a(`inventory.labels.startingPositionRangeError`,`Starting position must be between 1 and {{capacity}} for this sheet.`,{capacity:n}),`error`);return}let r=C.filter(e=>u.has(e.id)).map(e=>e.id);l(e);try{t0e(i?await Z.printSpoolmanSpoolLabels({spool_ids:r,template:e,monochrome:y,starting_position:n===void 0?1:k}):await Z.printSpoolLabels({spool_ids:r,template:e,monochrome:y,starting_position:n===void 0?1:k})),t()}catch(e){s(a(`inventory.labels.error`,`Could not generate labels: {{msg}}`,{msg:e instanceof Error?e.message:String(e)}),`error`)}finally{l(null)}}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-3xl 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)(jl,{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`)}),D>0&&(0,G.jsxs)(`span`,{className:`text-sm text-bambu-gray`,children:[`(`,a(`inventory.labels.selectedCount`,`{{count}} selected`,{count:D}),`)`]})]}),(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)(Zu,{className:`w-5 h-5`})})]}),(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)(Gl,{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`})]}),w.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`)}),w.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:E?N:M,disabled:T.length===0,className:`text-bambu-green hover:underline disabled:opacity-50 disabled:no-underline disabled:cursor-not-allowed`,children:E?a(`inventory.labels.deselectVisible`,`Deselect visible`):a(`inventory.labels.selectVisible`,`Select all visible ({{count}})`,{count:T.length})}),(0,G.jsx)(`button`,{type:`button`,onClick:P,disabled:D===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`,children:T.length===0?(0,G.jsx)(`div`,{className:`text-center text-sm text-bambu-gray py-6`,children:C.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:T.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)(du,{className:`w-4 h-4 text-bambu-green shrink-0`}):(0,G.jsx)(pu,{className:`w-4 h-4 text-bambu-gray shrink-0`}),(0,G.jsx)(`input`,{type:`checkbox`,checked:t,onChange:()=>j(e.id),className:`sr-only`}),(0,G.jsx)(`span`,{className:`w-4 h-4 rounded border border-black/20 shrink-0`,style:n0e(e.rgba)}),(0,G.jsx)(`span`,{className:`flex-1 min-w-0 truncate text-sm text-white`,children:i0e(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:`px-4 pt-2 pb-1 border-t border-bambu-dark-tertiary space-y-2`,children:[(0,G.jsxs)(`label`,{className:`inline-flex items-center gap-2 cursor-pointer select-none`,children:[y?(0,G.jsx)(du,{className:`w-4 h-4 text-bambu-green shrink-0`}):(0,G.jsx)(pu,{className:`w-4 h-4 text-bambu-gray shrink-0`}),(0,G.jsx)(`input`,{type:`checkbox`,checked:y,onChange:e=>b(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`)})]}),(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:g9,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.jsxs)(`div`,{id:`label-starting-position-help`,className:`text-xs text-bambu-gray pt-1.5`,children:[(0,G.jsx)(`div`,{children:a(`inventory.labels.startingPositionRange`,`Sheet templates only: L7160 supports 1–21; 5160 supports 1–30.`)}),(0,G.jsx)(`div`,{"data-testid":`label-starting-position-status`,className:A?``:`text-red-400`,children:A?k===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:k-1}):a(`inventory.labels.startingPositionInvalid`,`Enter a whole number from 1 to {{capacity}}.`,{capacity:g9})})]})]})]}),(0,G.jsx)(`div`,{className:`px-3 pt-1 pb-2 grid grid-cols-1 sm:grid-cols-2 gap-2`,children:e0e.map(e=>{let t=c===e.value,n=h9[e.value],r=n!==void 0&&(!A||k>n),i=a(`inventory.labels.templates.${e.i18nKey}.label`,e.fallbackLabel),o=r?a(`inventory.labels.startingPositionRangeError`,`Starting position must be between 1 and {{capacity}} for this sheet.`,{capacity:n}):a(`inventory.labels.templates.${e.i18nKey}.hint`,e.fallbackHint);return(0,G.jsxs)(`button`,{"data-testid":`print-labels-${e.value}`,disabled:O||c!==null||r,onClick:()=>F(e.value),title:`${i} — ${o}`,className:`w-full text-left p-2.5 rounded-lg border border-bambu-dark-tertiary bg-bambu-dark hover:border-bambu-green hover:bg-bambu-green/10 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:border-bambu-dark-tertiary disabled:hover:bg-bambu-dark transition flex items-center gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`div`,{className:`font-medium text-white text-sm truncate`,children:i}),(0,G.jsx)(`div`,{className:`text-xs text-bambu-gray mt-0.5 truncate`,children:o})]}),t&&(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin text-bambu-green shrink-0`})]},e.value)})}),(0,G.jsx)(`div`,{className:`flex justify-end gap-2 px-5 py-2 border-t border-bambu-dark-tertiary`,children:(0,G.jsx)(Q,{variant:`secondary`,onClick:t,disabled:c!==null,children:a(`common.cancel`,`Cancel`)})})]})]})}function c0e({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)(hs,{className:`w-4 h-4 text-green-500 flex-shrink-0`}):e===`error`?(0,G.jsx)(xs,{className:`w-4 h-4 text-red-500 flex-shrink-0`}):(0,G.jsx)(vs,{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)(Zu,{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)(Iu,{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)(oc,{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)(xs,{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:Tf(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)(Wu,{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)(Mu,{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)(Fs,{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`)})]})]})})}var _9=[{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`},{id:`low_stock_threshold_pct`,type:`number`,labelKey:`inventory.lowStockThresholdOverride`,min:1,max:99,step:1}];function l0e({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)(ss,{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 v9(...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 u0e({isOpen:e,selectedCount:t,isPending:n,availableLocations:r,availableMaterials:i,availableSubtypes:a,availableBrands:o,availableCategories:s,availableSlicerFilaments:c,availableSlicerFilamentNames:l,onClose:u,onApply:d}){let{t:p}=U(),{data:m=[]}=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:h}=K({queryKey:[`bulk-edit-local-presets`],enabled:e,staleTime:300*1e3,queryFn:Z.getLocalPresets}),{data:g=[]}=K({queryKey:[`builtin-filaments`],enabled:e,staleTime:300*1e3,queryFn:Z.getBuiltinFilaments}),_=(0,f.useMemo)(()=>bU(m,new Set,h?.filament??[],g),[m,h,g]),[v,y]=(0,f.useState)({}),b=(0,f.useMemo)(()=>v9(uU,i).map(e=>({value:e,label:e})),[i]),x=(0,f.useMemo)(()=>v9(fU,a).map(e=>({value:e,label:e})),[a]),S=(0,f.useMemo)(()=>v9(dU,o).map(e=>({value:e,label:e})),[o]),C=(0,f.useMemo)(()=>v9(s).map(e=>({value:e,label:e})),[s]),w=(0,f.useMemo)(()=>{let e=_.map(e=>({value:e.code,label:e.displayName})),t=c.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))},[_,c]),T=(0,f.useMemo)(()=>{let e=_.map(e=>({value:e.displayName,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))},[_,l]),E=(0,f.useMemo)(()=>r.map(e=>({value:String(e.id),label:e.name})),[r]);if(!e)return null;let D=(e,t)=>{y(n=>({...n,[e]:t}))},O=e=>{y(t=>{let n={...t};return delete n[e],n})},k=(()=>{let e={};for(let t of _9){let n=v[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})(),A=Object.keys(k).length>0,j=_9.some(e=>{let t=v[e.id];return t===void 0||t.trim()===``?!1:k[e.id]===void 0}),M=e=>e===`material`?b:e===`subtype`?x:e===`brand`?S:e===`category`?C:e===`slicer_filament`?w:e===`slicer_filament_name`?T:e===`location_id`?E:[],N=e=>{let t=v[e.id]??``;if(e.type===`searchable`||e.type===`searchableClosed`)return(0,G.jsx)(l0e,{value:t,onChange:t=>{t===``?O(e.id):D(e.id,t)},options:M(e.id),allowCustom:e.type===`searchable`,disabled:n});if(e.type===`textarea`)return(0,G.jsx)(`textarea`,{disabled:n,value:t,onChange:t=>D(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=>D(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=>D(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:p(`inventory.bulk.invalidHex`)})]})}return(0,G.jsx)(`input`,{type:e.type===`number`?`number`:`text`,disabled:n,value:t,onChange:t=>D(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:u,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:p(`inventory.bulk.editTitle`)}),(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray mt-0.5`,children:p(`inventory.bulk.editSubtitle`,{count:t})})]}),(0,G.jsx)(`button`,{onClick:u,disabled:n,className:`p-1 text-bambu-gray hover:text-white transition-colors`,"aria-label":p(`common.close`),children:(0,G.jsx)(Zu,{className:`w-5 h-5`})})]}),(0,G.jsx)(`p`,{className:`px-5 pt-4 text-xs text-bambu-gray`,children:p(`inventory.bulk.editHint`)}),(0,G.jsx)(`div`,{className:`flex-1 overflow-y-auto p-5 space-y-3`,children:_9.map(e=>{let t=v[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?D(e.id,``):O(e.id)},"aria-label":p(`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:p(e.labelKey)}),N(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:p(`inventory.bulk.changeCount`,{count:Object.keys(k).length})}),(0,G.jsxs)(`div`,{className:`ml-auto flex gap-2`,children:[(0,G.jsx)(Q,{variant:`secondary`,onClick:u,disabled:n,children:p(`common.cancel`)}),(0,G.jsx)(Q,{onClick:()=>d(k),disabled:!A||n||j,children:n?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{className:`w-4 h-4 mr-2 animate-spin`}),p(`inventory.bulk.applyPending`)]}):p(`inventory.bulk.applyButton`,{count:t})})]})]})]})})}function d0e(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 y9(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 f0e(e){return`${e.material}|${e.subtype||``}|${e.brand||``}|${e.color_name||``}|${e.rgba||``}|${e.extra_colors||``}|${e.effect_type||``}|${e.label_weight}`}var p0e=`bambuddy-inventory-columns`,b9=[{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:`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 m0e(){try{let e=localStorage.getItem(p0e);if(e){let t=JSON.parse(e),n=new Set(b9.map(e=>e.id)),r=new Set(t.map(e=>e.id)),i=[...t.filter(e=>n.has(e.id))];for(let e of b9){if(r.has(e.id))continue;let t=b9.indexOf(e),n=i.length;for(let e=t-1;e>=0;e--){let t=i.findIndex(t=>t.id===b9[e].id);if(t!==-1){n=t+1;break}}i.splice(n,0,e)}return i}}catch{}return b9.map(e=>({...e}))}function h0e(e){try{localStorage.setItem(p0e,JSON.stringify(e))}catch{}}function x9(e,t=!1){return t&&e>=1e3?`${(e/1e3).toFixed(1)}kg`:`${Math.round(e)}g`}var g0e={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 S9(e,t=`system`){if(!e)return`-`;let n=Jf(e);return n?Hf(n,t):`-`}var _0e={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`),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`)},C9={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:S9(e.created_at,t)}),encode_time:({spool:e,dateFormat:t})=>(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:S9(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?S9(e.last_used,t):`Never`}),rgba:({spool:e})=>(0,G.jsx)(`div`,{className:`flex items-center justify-center`,children:(0,G.jsx)(fm,{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:Sf(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,` `,xp(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 ${D9(s,r,i,a,o)}`,children:E9(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 ${D9(s,r,i,a,o)}`,children:E9(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 ${D9(s,r,i,a,o)}`,children:E9(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:x9(e.label_weight)}),net:({remaining:e})=>(0,G.jsx)(`span`,{className:`text-sm text-white`,children:x9(e)}),gross:({spool:e,remaining:t})=>(0,G.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:x9(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?x9(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||`-`}),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)(as,{className:`w-3 h-3`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Mu,{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)(Fl,{className:`w-3.5 h-3.5`})})]})]})}},w9={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=>yf(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||``} ${xp(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(),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},T9=`bambuddy-inventory-sort`;function v0e(){try{let e=localStorage.getItem(T9);if(e)return JSON.parse(e)}catch{}return null}function y0e(e){try{e?localStorage.setItem(T9,JSON.stringify(e)):localStorage.removeItem(T9)}catch{}}function b0e(){let{data:e}=K({queryKey:[`spoolman-settings`],queryFn:Z.getSpoolmanSettings,staleTime:300*1e3}),t=e!==void 0;return(0,G.jsx)(x0e,{spoolmanMode:e?.spoolman_enabled===`true`&&!!e?.spoolman_url,spoolmanModeReady:t})}function x0e({spoolmanMode:e=!1,spoolmanModeReady:t=!0}){let{t:n}=U(),r=Of(),i=no(),{showToast:a}=Hd(),{hasPermission:o,loading:s}=Od(),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)(`active`),[D,O]=(0,f.useState)(`all`),[k,A]=(0,f.useState)(``),[j,M]=(0,f.useState)(``),[N,P]=(0,f.useState)(``),[F,I]=(0,f.useState)(``),[L,R]=(0,f.useState)(`all`),[z,B]=(0,f.useState)(``),[V,ee]=(0,f.useState)(`table`),[te,ne]=(0,f.useState)(v0e),[re,ie]=(0,f.useState)(m0e),[ae,oe]=(0,f.useState)(!1),[se,H]=(0,f.useState)(()=>{try{return localStorage.getItem(`bambuddy-inventory-group`)===`true`}catch{return!1}}),[ce,le]=(0,f.useState)(new Set),[ue,de]=(0,f.useState)(new Set),[fe,pe]=(0,f.useState)(!1),[me,he]=(0,f.useState)(null),ge=(0,f.useCallback)(e=>{de(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),_e=(0,f.useCallback)(()=>de(new Set),[]);(0,f.useEffect)(()=>{de(new Set)},[T,D,k,j,N,F,L,z]);let[ve,ye]=(0,f.useState)(0),[be,xe]=(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:Se}=K({queryKey:[`settings`],queryFn:Z.getSettings}),Ce=Se?.date_format||`system`,we=(Se?.location_sensor_poll_interval||120)*1e3,{colorize:Te,aboveColor:Ee,belowColor:De,optimalColor:Oe}=I6(),ke=e?[`spoolman-inventory-spools`]:[`inventory-spools`],Ae=()=>v6(i,ke),{data:je,isLoading:Me}=K({queryKey:ke,queryFn:()=>e?Z.getSpoolmanInventorySpools(!0):Z.getSpools(!0),refetchInterval:3e4}),Ne=(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]),Pe=e?n(`inventory.csv.spoolmanHint`,`In Spoolman mode, use Spoolman's built-in CSV import/export.`):void 0,{data:Fe=[]}=K({queryKey:g6,queryFn:Z.getLocations}),Ie=l.get(`location_id`),Le=Ie===`__none__`?`__none__`:Ie&&/^\d+$/.test(Ie)&&Number(Ie)>0?Ie:``,Re=l.get(`spool`),ze=Re&&/^\d+$/.test(Re)&&Number(Re)>0?Number(Re):null,Be=je?.find(e=>e.id===ze)??null,Ve=(0,f.useCallback)(()=>{m.current=!0,u(e=>(e.delete(`spool`),e),{replace:!0})},[u]),{data:He,isError:Ue,error:We}=K({queryKey:e?[`spoolman-inventory-spool`,ze]:[`inventory-spool`,ze],queryFn:()=>e?Z.getSpoolmanInventorySpool(ze):Z.getSpool(ze),enabled:t&&ze!==null&&Be===null,staleTime:1/0,retry:(e,t)=>e<2&&!(t instanceof nd&&t.status===404)});(0,f.useEffect)(()=>{if(!m.current){if(t&&ze&&Be){Ve(),p({spool:Be,mode:`edit`});return}if(He){Ve(),p({spool:He,mode:`edit`});return}Ue&&(Ve(),a(n(We instanceof nd&&We.status===404?`inventory.deepLinkSpoolNotFound`:`inventory.deepLinkFetchFailed`),`error`))}},[t,ze,Be,He,Ue,We,Ve,a,n]);let{data:Ge}=K({queryKey:[`spool-assignments`],queryFn:()=>Z.getAssignments(),refetchInterval:3e4}),{data:Ke=[],isError:qe}=K({queryKey:[`spoolman-slot-assignments-all`],queryFn:()=>Z.getSpoolmanSlotAssignments(),enabled:e,refetchInterval:3e4,staleTime:1e4,retry:1}),Je=(0,f.useRef)(!1);(0,f.useEffect)(()=>{qe&&!Je.current?(Je.current=!0,a(n(`inventory.spoolmanUnreachable`),`error`)):qe||(Je.current=!1)},[qe,a,n]);let{data:Ye}=K({queryKey:[`spool-catalog`],queryFn:()=>Z.getSpoolCatalog()}),Xe=q({mutationFn:t=>e?Z.deleteSpoolmanInventorySpool(t):Z.deleteSpool(t),onSuccess:()=>{Ae(),a(n(`inventory.spoolDeleted`),`success`)},onError:e=>{e instanceof nd&&e.status===404?a(n(`inventory.deleteSpoolNotFound`),`error`):e instanceof nd&&e.status===503?a(n(`inventory.spoolmanUnreachable`),`error`):a(n(`inventory.deleteFailed`),`error`)}}),Ze=q({mutationFn:t=>e?Z.archiveSpoolmanInventorySpool(t):Z.archiveSpool(t),onSuccess:()=>{Ae(),a(n(`inventory.spoolArchived`),`success`)},onError:e=>{e instanceof nd&&e.status===404?a(n(`inventory.archiveSpoolNotFound`),`error`):e instanceof nd&&e.status===503?a(n(`inventory.spoolmanUnreachable`),`error`):a(n(`inventory.archiveFailed`),`error`)}}),Qe=q({mutationFn:t=>e?Z.restoreSpoolmanInventorySpool(t):Z.restoreSpool(t),onSuccess:()=>{Ae(),a(n(`inventory.spoolRestored`),`success`)},onError:e=>{e instanceof nd&&e.status===404?a(n(`inventory.restoreSpoolNotFound`),`error`):e instanceof nd&&e.status===503?a(n(`inventory.spoolmanUnreachable`),`error`):a(n(`inventory.restoreFailed`),`error`)}}),$e=q({mutationFn:t=>e?Z.resetSpoolmanInventorySpoolConsumedCounter(t):Z.resetSpoolConsumedCounter(t),onSuccess:()=>{i.invalidateQueries({queryKey:ke}),a(n(`inventory.consumedCounterReset`),`success`)},onError:()=>{a(n(`inventory.resetConsumedCounterFailed`),`error`)}}),et=q({mutationFn:t=>e?Z.bulkResetSpoolmanInventorySpoolConsumedCounter(t):Z.bulkResetSpoolConsumedCounter(t),onSuccess:e=>{i.invalidateQueries({queryKey:ke}),a(n(`inventory.allConsumedCountersReset`,{count:e.reset}),`success`),he(null),_e()},onError:()=>{a(n(`inventory.resetConsumedCounterFailed`),`error`)}}),tt=e=>(e.not_found?.length??0)+(e.errors?.length??0),nt=q({mutationFn:async({ids:t,update:n})=>e?Z.bulkUpdateSpoolmanInventorySpools(t,n):Z.bulkUpdateSpools(t,n),onSuccess:e=>{Ae();let t=tt(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`),pe(!1),_e()},onError:e=>{a(e.message||n(`inventory.bulk.updateFailed`),`error`)}}),rt=q({mutationFn:async t=>e?Z.bulkDeleteSpoolmanInventorySpools(t):Z.bulkDeleteSpools(t),onSuccess:e=>{Ae();let t=tt(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`),he(null),_e()},onError:e=>{a(e.message||n(`inventory.bulk.deleteFailed`),`error`)}}),it=q({mutationFn:async t=>e?Z.bulkArchiveSpoolmanInventorySpools(t):Z.bulkArchiveSpools(t),onSuccess:e=>{Ae();let t=tt(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`),he(null),_e()},onError:e=>{a(e.message||n(`inventory.bulk.archiveFailed`),`error`)}}),at=q({mutationFn:async t=>e?Z.bulkRestoreSpoolmanInventorySpools(t):Z.bulkRestoreSpools(t),onSuccess:e=>{Ae();let t=tt(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`),he(null),_e()},onError:e=>{a(e.message||n(`inventory.bulk.restoreFailed`),`error`)}}),ot=(0,f.useMemo)(()=>(je??[]).map(e=>e.id),[je]),st=async t=>{if(t.last_scale_weight!=null)try{e?await Z.syncSpoolmanSpoolWeight(t.id,t.last_scale_weight):await Cd.updateSpoolWeight(t.id,t.last_scale_weight),i.invalidateQueries({queryKey:ke}),a(`Synced "${[t.brand,t.material,Sf(t.color_name,t.rgba,t.color_name_is_synthesized)].filter(Boolean).join(` `)}" to scale weight`,`success`)}catch(e){let t=e instanceof nd&&e.status===404,r=e instanceof nd&&e.status===503;a(n(t?`inventory.syncWeightSpoolNotFound`:r?`inventory.syncWeightSpoolmanUnreachable`:`inventory.syncWeightFailed`),`error`)}},ct=Se?.low_stock_threshold??20,[lt,ut]=(0,f.useState)(!1),[dt,ft]=(0,f.useState)(ct.toString());(0,f.useEffect)(()=>{lt||ft(ct.toString())},[ct,lt]);let pt=q({mutationFn:e=>Z.updateSettings({low_stock_threshold:e}),onSuccess:()=>{i.invalidateQueries({queryKey:[`settings`]}),a(n(`common.saved`),`success`),ut(!1)},onError:()=>{a(n(`inventory.lowStockThresholdError`),`error`)}}),mt=(0,f.useMemo)(()=>{if(!je)return null;let e=0,t=0,n=0,r=0,i={};for(let a of je){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??ct)&&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}},[je,ct]),ht=(Ge?.length??0)+(e?Ke.length:0),gt=Af(Se?.currency||`USD`),_t=(0,f.useMemo)(()=>{let e={};for(let t of Ge||[])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 Ke)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},[Ge,Ke]),vt=(0,f.useMemo)(()=>{let e={};for(let t of Ye||[])e[t.id]=t;return e},[Ye]),{data:yt}=K({queryKey:[`locationHaSensors`],queryFn:()=>Z.getLocationHASensors()}),bt=(0,f.useMemo)(()=>new Set((yt??[]).map(e=>e.location_id)),[yt]),xt=(0,f.useMemo)(()=>{let e=new Set;for(let t of je||[])t.location_id&&bt.has(t.location_id)&&e.add(t.location_id);return Array.from(e)},[je,bt]),St=V===`cards`||V===`table`&&re.some(e=>e.visible&&(e.id===`temperature`||e.id===`humidity`||e.id===`battery`)),Ct=_o({queries:xt.map(e=>({queryKey:[`locationHaSensorReadings`,e],queryFn:()=>Z.getLocationHASensorReadings(e,!1),refetchInterval:we,enabled:St}))}),wt=(0,f.useMemo)(()=>{let e={};return xt.forEach((t,n)=>{let r=Ct[n]?.data;r&&(e[t]=r)}),e},[xt,Ct]),Tt=(0,f.useMemo)(()=>mt?Object.entries(mt.byMaterial).sort((e,t)=>t[1].weight-e[1].weight).slice(0,4):[],[mt]),Et=(0,f.useMemo)(()=>{let e=je||[];if(e=T===`active`?e.filter(e=>!e.archived_at):e.filter(e=>!!e.archived_at),D===`used`?e=e.filter(e=>e.weight_used>0):D===`new`?e=e.filter(e=>e.weight_used===0):D===`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??ct)})),k&&(e=e.filter(e=>e.material===k)),j&&(e=e.filter(e=>e.brand===j)),N&&(e=N===`__none__`?e.filter(e=>!e.category):e.filter(e=>e.category===N)),F){let t=Number(F);e=e.filter(e=>e.core_weight_catalog_id===t)}if(Le)if(Le===`__none__`)e=e.filter(e=>!e.location_id&&!e.storage_location?.trim());else{let t=Number(Le),n=Fe.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 L===`stock`?e=e.filter(e=>!e.slicer_filament):L===`configured`&&(e=e.filter(e=>!!e.slicer_filament)),z&&(e=QH(e,z)),e},[je,T,D,k,j,N,F,L,Le,z,ct,Fe,r]),Dt=()=>ye(0),Ot=(0,f.useCallback)(e=>{u(t=>(t.delete(`location_id`),e&&t.set(`location_id`,e),t),{replace:!0}),Dt()},[u]),kt=[...new Set(je?.map(e=>e.material)||[])].sort(),At=[...new Set(je?.map(e=>e.brand).filter(Boolean)||[])].sort(),jt=[...new Set(je?.map(e=>e.category?.trim()).filter(Boolean)||[])].sort(),Mt=(je??[]).some(e=>!e.category),Nt=[...new Set(je?.map(e=>e.core_weight_catalog_id).filter(e=>e!=null)||[])].sort((e,t)=>{let n=(vt[e]?.name||``).toLowerCase(),r=(vt[t]?.name||``).toLowerCase();return n.localeCompare(r)}),Pt=(je??[]).some(e=>!e.location_id&&!e.storage_location?.trim()),Ft=T!==`active`||D!==`all`||!!k||!!j||!!N||!!F||!!Le||L!==`all`||!!z,It=e=>{ie(e),h0e(e)},Lt=(0,f.useMemo)(()=>re.filter(e=>e.visible).map(e=>e.id),[re]),Rt=e=>{w9[e]&&(ne(t=>{let n;return n=t?.column===e?t.direction===`asc`?{column:e,direction:`desc`}:null:{column:e,direction:`asc`},y0e(n),n}),Dt())},zt=(0,f.useMemo)(()=>{if(!te)return Et;let e=w9[te.column];return e?[...Et].sort((t,n)=>{let r=e(t,_t,wt),i=e(n,_t,wt);return ri?te.direction===`asc`?1:-1:0}):Et},[Et,te,_t,wt]),Bt=(0,f.useMemo)(()=>{if(!se)return zt.map(e=>({type:`single`,spool:e}));let e=new Map;for(let t of zt)if(!(t.weight_used>0||_t[t.id])){let n=f0e(t),r=e.get(n);r?r.push(t):e.set(n,[t])}let t=[],n=new Set;for(let r of zt){if(r.weight_used>0||_t[r.id]){t.push({type:`single`,spool:r});continue}let i=f0e(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},[zt,se,_t]),Vt=be===-1,Ht=Bt.length,Ut=Vt?Ht||1:be,Wt=Math.max(1,Math.ceil(Ht/Ut)),Gt=Vt?0:Math.min(ve,Wt-1),Kt=Vt?Bt:Bt.slice(Gt*Ut,(Gt+1)*Ut),qt=()=>{let e=!se;H(e),le(new Set),Dt();try{localStorage.setItem(`bambuddy-inventory-group`,String(e))}catch{}},Jt=e=>{le(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Yt=e=>{xe(e),ye(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)(gl,{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:Pe,children:[(0,G.jsx)(Iu,{className:`w-4 h-4`}),n(`inventory.csv.importButton`,`Import CSV`)]}),(0,G.jsxs)(Q,{variant:`secondary`,disabled:e||x,onClick:Ne,title:Pe,children:[x?(0,G.jsx)(Y,{className:`w-4 h-4 animate-spin`}):(0,G.jsx)(Ws,{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`,disabled:Et.length===0,onClick:()=>v(Et.map(e=>e.id)),title:Et.length===0?n(`inventory.labels.noSpoolsTitle`,`No spools to label`):n(`inventory.labels.bulkTitle`,`Pick spools to print labels for from the {{count}} currently shown`,{count:Et.length}),children:[(0,G.jsx)(jl,{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)(Ol,{className:`w-4 h-4`}),n(`inventory.addSpool`)]})]})]}),mt&&!Me&&(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)(gl,{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:x9(mt.totalWeight,!0)}),(0,G.jsxs)(`div`,{className:`text-xs text-bambu-gray mt-1`,children:[mt.totalSpools,` `,mt.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)(Au,{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`)})]}),mt.totalConsumed>0&&ot.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)(Xs,{className:`w-3.5 h-3.5`})})]}),(0,G.jsx)(`div`,{className:`text-xl font-bold text-white`,children:x9(mt.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:Tt.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 ${g0e[e]||`bg-bambu-dark-tertiary text-bambu-gray`}`,children:[e,` `,(0,G.jsx)(`span`,{className:`opacity-70`,children:x9(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)(jl,{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:ht}),(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)(Mu,{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 ${mt.lowStock>0?`text-yellow-700 dark:text-yellow-400`:`text-white`}`,children:mt.lowStock}),(0,G.jsx)(`div`,{className:`text-xs text-bambu-gray mt-1 flex items-center gap-2`,children:lt?(0,G.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let t=parseFloat(dt);!isNaN(t)&&t>=.1&&t<=99.9?pt.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:dt,onChange:e=>{let t=e.target.value.replace(/[^\d.]/g,``);/^\d{0,2}(\.\d?)?$/.test(t)&&ft(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:pt.isPending}),(0,G.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:`%`}),(0,G.jsx)(Q,{type:`submit`,size:`sm`,disabled:pt.isPending,children:n(`common.save`)}),(0,G.jsx)(Q,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>ut(!1),disabled:pt.isPending,children:n(`common.cancel`)})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{className:`text-bambu-gray`,children:[`< `,ct,`%`]}),(0,G.jsx)(`button`,{className:`p-1.5 text-bambu-gray hover:text-white rounded transition-colors`,title:n(`common.edit`),onClick:()=>{ft(ct.toString()),ut(!0)},children:(0,G.jsx)(Sl,{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 ${V===`forecast`?`invisible pointer-events-none`:``}`,children:[(0,G.jsx)(Gl,{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:z,onChange:e=>{B(e.target.value),Dt()},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`}),z&&(0,G.jsx)(`button`,{onClick:()=>{B(``),Dt()},className:`absolute right-3 top-1/2 -translate-y-1/2 text-bambu-gray hover:text-white`,children:(0,G.jsx)(Zu,{className:`w-4 h-4`})})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[V===`table`&&(0,G.jsxs)(`button`,{onClick:()=>oe(!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)(Ns,{className:`w-4 h-4`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:n(`inventory.columns`)})]}),V!==`forecast`&&(0,G.jsxs)(`button`,{onClick:qt,className:`flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium border rounded-lg transition-colors ${se?`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)(Ec,{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:()=>ee(`table`),className:`flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium transition-colors ${V===`table`?`bg-bambu-green text-white`:`text-bambu-gray hover:bg-bambu-dark-tertiary`}`,children:[(0,G.jsx)(vu,{className:`w-4 h-4`}),(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:n(`inventory.table`)})]}),(0,G.jsxs)(`button`,{onClick:()=>ee(`cards`),className:`flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium transition-colors ${V===`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&&ee(`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 ${V===`forecast`?`bg-bambu-green text-white`:`text-bambu-gray hover:bg-bambu-dark-tertiary`}`,children:[c?(0,G.jsx)(ju,{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 ${V===`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:()=>{E(`active`),Dt()},className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium transition-colors ${T===`active`?`bg-bambu-green/20 text-bambu-green`:`text-bambu-gray hover:bg-bambu-dark-tertiary`}`,children:[(0,G.jsx)(gl,{className:`w-3.5 h-3.5`}),n(`inventory.active`)]}),(0,G.jsxs)(`button`,{onClick:()=>{E(`archived`),Dt()},className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium transition-colors ${T===`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:()=>{O(`all`),Dt()},className:`px-3 py-1.5 text-xs font-medium transition-colors ${D===`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:()=>{O(`used`),Dt()},className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium transition-colors ${D===`used`?`bg-bambu-green/20 text-bambu-green`:`text-bambu-gray hover:bg-bambu-dark-tertiary`}`,children:[(0,G.jsx)(Ts,{className:`w-3.5 h-3.5`}),n(`inventory.used`)]}),(0,G.jsx)(`button`,{onClick:()=>{O(`new`),Dt()},className:`px-3 py-1.5 text-xs font-medium transition-colors ${D===`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:()=>{O(`lowstock`),Dt()},className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium transition-colors ${D===`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)(Mu,{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:()=>{R(`all`),Dt()},className:`px-3 py-1.5 text-xs font-medium transition-colors ${L===`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:()=>{R(`stock`),Dt()},className:`px-3 py-1.5 text-xs font-medium transition-colors ${L===`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:()=>{R(`configured`),Dt()},className:`px-3 py-1.5 text-xs font-medium transition-colors ${L===`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:k,onChange:e=>{A(e.target.value),Dt()},className:`px-3 py-1.5 rounded-lg border text-xs font-medium transition-colors cursor-pointer focus:outline-none ${k?`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`)}),kt.map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))]}),(0,G.jsxs)(`select`,{value:j,onChange:e=>{M(e.target.value),Dt()},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.brand`)}),At.map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))]}),(jt.length>0||N)&&(0,G.jsxs)(`select`,{value:N,onChange:e=>{P(e.target.value),Dt()},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.category`)}),jt.map(e=>(0,G.jsx)(`option`,{value:e,children:e},e)),Mt&&(0,G.jsx)(`option`,{value:`__none__`,children:n(`inventory.categoryNone`)})]}),Nt.length>0&&(0,G.jsxs)(`select`,{value:F,onChange:e=>{I(e.target.value),Dt()},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.spoolName`)}),Nt.map(e=>(0,G.jsx)(`option`,{value:e,children:vt[e]?.name||`#${e}`},e))]}),(Fe.length>0||Le)&&(0,G.jsxs)(`select`,{value:Le,onChange:e=>{Ot(e.target.value)},className:`px-3 py-1.5 rounded-lg border text-xs font-medium transition-colors cursor-pointer focus:outline-none ${Le?`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`)}),Fe.map(e=>(0,G.jsx)(`option`,{value:String(e.id),children:e.name},e.id)),Pt&&(0,G.jsx)(`option`,{value:`__none__`,children:n(`inventory.storageLocationNone`)})]}),Ft&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`w-px h-5 bg-bambu-dark-tertiary`}),(0,G.jsxs)(`button`,{onClick:()=>{E(`active`),O(`all`),A(``),M(``),P(``),I(``),R(`all`),B(``),u(e=>(e.delete(`location_id`),e),{replace:!0}),Dt()},className:`flex items-center gap-1 text-xs text-bambu-gray hover:text-bambu-green transition-colors`,children:[(0,G.jsx)(Zu,{className:`w-3.5 h-3.5`}),n(`inventory.clearFilters`)]})]}),V!==`forecast`&&(0,G.jsxs)(`span`,{className:`ml-auto text-xs text-bambu-gray`,children:[zt.length,` `,zt.length===1?n(`inventory.spool`):n(`inventory.spools`),se&&Ht0&&V!==`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:ue.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:()=>pe(!0),children:[(0,G.jsx)(Sl,{className:`w-3.5 h-3.5 mr-1.5`}),n(`inventory.bulk.edit`)]}),(0,G.jsxs)(Q,{size:`sm`,variant:`secondary`,onClick:()=>v([...ue]),children:[(0,G.jsx)(jl,{className:`w-3.5 h-3.5 mr-1.5`}),n(`inventory.bulk.printLabels`)]}),(0,G.jsxs)(Q,{size:`sm`,variant:`secondary`,onClick:()=>he(`reset-consumed-counter`),children:[(0,G.jsx)(Xs,{className:`w-3.5 h-3.5 mr-1.5`}),n(`inventory.bulk.resetUsage`)]}),T===`archived`?(0,G.jsxs)(Q,{size:`sm`,variant:`secondary`,onClick:()=>he(`restore`),children:[(0,G.jsx)(Ll,{className:`w-3.5 h-3.5 mr-1.5`}),n(`inventory.bulk.restore`)]}):(0,G.jsxs)(Q,{size:`sm`,variant:`secondary`,onClick:()=>he(`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:()=>he(`delete`),children:[(0,G.jsx)(ku,{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:_e,title:n(`inventory.bulk.clearSelection`),"aria-label":n(`inventory.bulk.clearSelection`),children:(0,G.jsx)(Zu,{className:`w-4 h-4`})})]})]}),Me?(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`})}):V===`forecast`?(0,G.jsx)(S1e,{spools:je||[]}):V===`cards`?Kt.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:Kt.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=dm({rgba:i.rgba,extraColors:i.extra_colors,effectType:i.effect_type,subtype:i.subtype,effectSize:`groupheader`}),s=ce.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:()=>Jt(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:Sf(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)(ss,{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:x9(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)(C0e,{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:Te,locationSensorAboveColor:Ee,locationSensorBelowColor:De,locationSensorOptimalColor:Oe},e.id)})})]},`group-${t}`)}let t=e.spool,r=Math.max(0,t.label_weight-t.weight_used);return(0,G.jsx)(C0e,{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:Te,locationSensorAboveColor:Ee,locationSensorBelowColor:De,locationSensorOptimalColor:Oe},t.id)})}),(0,G.jsx)(S0e,{pageIndex:Gt,pageSize:be,totalRows:Ht,totalPages:Wt,onPageChange:ye,onPageSizeChange:Yt,t:n})]}):(0,G.jsx)(k0e,{hasFilters:Ft,onAddSpool:()=>p({spool:null,mode:`create`}),t:n}):Kt.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:Kt.length>0&&Kt.every(e=>(e.type===`group`?e.spools.map(e=>e.id):[e.spool.id]).every(e=>ue.has(e))),onChange:e=>{if(e.target.checked){let e=new Set(ue);for(let t of Kt){let n=t.type===`group`?t.spools.map(e=>e.id):[t.spool.id];for(let t of n)e.add(t)}de(e)}else{let e=new Set(ue);for(let t of Kt){let n=t.type===`group`?t.spools.map(e=>e.id):[t.spool.id];for(let t of n)e.delete(t)}de(e)}}})}),Lt.map(e=>{let t=!!w9[e],r=te?.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?()=>Rt(e):void 0,children:(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[_0e[e]?.(n)??e,t&&(r?te.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:Kt.map(e=>{if(e.type===`group`){let{key:t,spools:r}=e,i=ce.has(t),a=d0e(r),o=Math.max(0,a.label_weight-a.weight_used);return(0,G.jsx)(O0e,{spools:r,headerSpool:a,remaining:o,pct:a.label_weight>0?o/a.label_weight*100:0,isExpanded:i,onToggle:()=>Jt(t),selectedIds:ue,onToggleSelected:ge,onToggleGroupSelected:(e,t)=>{de(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:Lt,assignmentMap:_t,catalogMap:vt,locationReadingsMap:wt,currencySymbol:gt,dateFormat:Ce,t:n,onSyncWeight:st,colorizeLocationSensors:Te,locationSensorAboveColor:Ee,locationSensorBelowColor:De,locationSensorOptimalColor:Oe},`group-${t}`)}let t=e.spool,r=Math.max(0,t.label_weight-t.weight_used);return(0,G.jsx)(D0e,{spool:t,remaining:r,pct:t.label_weight>0?r/t.label_weight*100:0,isSelected:ue.has(t.id),onToggleSelected:()=>ge(t.id),onEdit:()=>p({spool:t,mode:`edit`}),onCopy:()=>p({spool:t,mode:`copy`}),onRestore:()=>Qe.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:Lt,assignmentMap:_t,catalogMap:vt,locationReadingsMap:wt,currencySymbol:gt,dateFormat:Ce,t:n,onSyncWeight:st,colorizeLocationSensors:Te,locationSensorAboveColor:Ee,locationSensorBelowColor:De,locationSensorOptimalColor:Oe},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:Vt?`${Ht} ${n(Ht===1?`inventory.spool`:`inventory.spools`)}`:(0,G.jsxs)(G.Fragment,{children:[n(`inventory.showing`),` `,Gt*Ut+1,` `,n(`inventory.to`),` `,Math.min((Gt+1)*Ut,Ht),` `,n(`inventory.of`),` `,Ht,` `,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:be,onChange:e=>Yt(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`)})]}),!Vt&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`button`,{onClick:()=>ye(0),disabled:Gt===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)(ds,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{onClick:()=>ye(e=>Math.max(0,e-1)),disabled:Gt===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)(ls,{className:`w-4 h-4`})}),(0,G.jsxs)(`span`,{className:`text-bambu-gray px-2 whitespace-nowrap`,children:[n(`inventory.page`),` `,Gt+1,` `,n(`inventory.of`),` `,Wt]}),(0,G.jsx)(`button`,{onClick:()=>ye(e=>Math.min(Wt-1,e+1)),disabled:Gt>=Wt-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)(cs,{className:`w-4 h-4`})}),(0,G.jsx)(`button`,{onClick:()=>ye(Wt-1),disabled:Gt>=Wt-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)(fs,{className:`w-4 h-4`})})]})]})]})]}):(0,G.jsx)(k0e,{hasFilters:Ft,onAddSpool:()=>p({spool:null,mode:`create`}),t:n}),d!==null&&(0,G.jsx)($1e,{isOpen:!0,onClose:()=>p(null),spool:d.spool,mode:d.mode,currencySymbol:gt,spoolmanMode:e,spoolsQueryKey:ke}),h&&(0,G.jsx)($d,{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:ot.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`?Xe.mutate(h.spoolId):h.type===`archive`?Ze.mutate(h.spoolId):h.type===`reset-consumed-counter`?$e.mutate(h.spoolId):et.mutate(ot),g(null)},onCancel:()=>g(null)}),(0,G.jsx)(eG,{isOpen:ae,onClose:()=>oe(!1),columns:re,defaultColumns:b9,onSave:It}),(0,G.jsx)(s0e,{isOpen:_!==null,onClose:()=>v(null),availableSpools:Et,initialSelectedIds:_??[],spoolmanMode:e}),(0,G.jsx)(u0e,{isOpen:fe,selectedCount:ue.size,isPending:nt.isPending,availableLocations:Fe.map(e=>({id:e.id,name:e.name})),availableMaterials:y9((je??[]).map(e=>e.material)),availableSubtypes:y9((je??[]).map(e=>e.subtype)),availableBrands:y9((je??[]).map(e=>e.brand)),availableCategories:y9((je??[]).map(e=>e.category)),availableSlicerFilaments:y9((je??[]).map(e=>e.slicer_filament)),availableSlicerFilamentNames:y9((je??[]).map(e=>e.slicer_filament_name)),onClose:()=>pe(!1),onApply:e=>nt.mutate({ids:[...ue],update:e})}),me&&(0,G.jsx)($d,{title:n(me===`delete`?`inventory.bulk.deleteTitle`:me===`archive`?`inventory.bulk.archiveTitle`:me===`restore`?`inventory.bulk.restoreTitle`:`inventory.bulk.resetUsageTitle`),message:n(me===`delete`?`inventory.bulk.deleteMessage`:me===`archive`?`inventory.bulk.archiveMessage`:me===`restore`?`inventory.bulk.restoreMessage`:`inventory.bulk.resetUsageMessage`,{count:ue.size}),confirmText:n(me===`delete`?`common.delete`:me===`archive`?`inventory.archive`:me===`restore`?`inventory.restore`:`inventory.resetConsumedCounter`),variant:me===`delete`?`danger`:`warning`,isLoading:rt.isPending||it.isPending||at.isPending||et.isPending,onConfirm:()=>{let e=[...ue];me===`delete`?rt.mutate(e):me===`archive`?it.mutate(e):me===`restore`?at.mutate(e):et.mutate(e)},onCancel:()=>he(null)}),y&&(0,G.jsx)(c0e,{onClose:()=>b(!1),onImported:e=>{b(!1),i.invalidateQueries({queryKey:ke}),a(n(`inventory.csv.importSuccess`,`{{count}} spools imported`,{count:e}),`success`)}}),(0,G.jsx)(Z6,{open:C,onClose:()=>w(!1),onPickLocation:e=>Ot(String(e))})]})}function S0e({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)(ds,{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)(ls,{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)(cs,{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)(fs,{className:`w-4 h-4`})})]})]})]})}function C0e({spool:e,remaining:t,pct:n,onClick:r,onPrintLabel:i,onCopy:a,t:o,colorizeLocationSensors:s,locationSensorAboveColor:c,locationSensorBelowColor:l,locationSensorOptimalColor:u}){let d=dm({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:Sf(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)(Fs,{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)(jl,{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:x9(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?x9(e.weight_used):`-`})]})]}),e.location_id&&(0,G.jsx)(E0e,{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 w0e={temperature:0,humidity:1,battery:2};function T0e(e){return e===`humidity`?`mr-[2px]`:e===`battery`?`mr-[3px]`:``}function E9(e,t){return mE(e,t,{decimals:2})}function D9(e,t,n,r,i){return t&&R6(L6(e),n,r,i)||`text-bambu-gray`}function E0e({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)=>(w0e[e.device_class??``]??99)-(w0e[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=hE(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 ${T0e(e.device_class)} ${c}`}),(0,G.jsx)(`span`,{className:D9(e,r,i,a,o),children:E9(e,s)})]},e.id)})}),m&&(()=>{let e=hE(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 ${T0e(m.device_class)}`}),(0,G.jsx)(`span`,{className:D9(m,r,i,a,o),children:E9(m,s)})]},m.id)})()]})}function D0e({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:C9[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)(Sl,{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)(Fs,{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)(jl,{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)(Xs,{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)(Ll,{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)(ku,{className:`w-4 h-4`})})]})})]})}function O0e({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)(ss,{className:`w-4 h-4 text-bambu-gray transition-transform ${i?``:`-rotate-90`}`}),C9[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})}):C9[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)(D0e,{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 k0e({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)(Gl,{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)(gl,{className:`w-4 h-4`}),n(`inventory.addSpool`)]})]})}function O9(e,t){let n=e?.[t];return typeof n==`string`?n:``}function A0e(e){return e.replace(/(https?:\/\/(?:makerworld|public-cdn)\.bblmw\.com\/[^\s"']+)/gi,e=>`/api/v1/makerworld/thumbnail?url=${encodeURIComponent(e)}`)}function k9(e){return e?/^https?:\/\/(makerworld|public-cdn)\.bblmw\.com\//i.test(e)?`/api/v1/makerworld/thumbnail?url=${encodeURIComponent(e)}`:e:``}function A9(e,t){let n=e?.[t];return typeof n==`number`?n:null}function j0e(e,t){let n=e?.[t];return n&&typeof n==`object`&&!Array.isArray(n)?n:void 0}function M0e(e,t=0,n=[]){n.push({folder:e,depth:t});for(let r of e.children??[])M0e(r,t+1,n);return n}function N0e(e,t){return t(e<1?`makerworld.phaseResolving`:`makerworld.phaseDownloading`)}function P0e(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 F0e(){let{t:e}=U(),{hasPermission:t}=Od(),{showToast:n}=Hd(),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=qW(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=P0e(F.isPending||L.isPending),z=N0e(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:O9(e,`name`)||`image`,url:O9(e,`url`)})).filter(e=>e.url);if(t.length>0)return t;let n=O9(e,`cover`);return n?[{name:`cover`,url:n}]:[]},ee=async()=>{if(!s)return;let e=s.instances.filter(e=>{let t=A9(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);ZW(`${window.location.origin}${i}`,n)}catch{let t=Z.getLibraryFileDownloadUrl(e);ZW(`${window.location.origin}${t}`,n)}},ne=s?.design,re=j0e(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)(()=>O9(ne,`coverUrl`),[ne]),ce=O9(ne,`title`),le=O9(ne,`summary`),ue=O9(ne,`license`),de=A9(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)(wc,{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)(Pd,{className:`border-amber-300 dark:border-amber-700 bg-amber-50 dark:bg-amber-900/20`,children:(0,G.jsx)(Id,{children:(0,G.jsxs)(`div`,{className:`flex items-start gap-3 py-2`,children:[(0,G.jsx)(ps,{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)(Pd,{children:[(0,G.jsx)(Fd,{children:(0,G.jsx)(`h2`,{className:`text-lg font-semibold`,children:e(`makerworld.pasteUrlHeader`)})}),(0,G.jsx)(Id,{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)(Pd,{children:(0,G.jsx)(Id,{children:(0,G.jsxs)(`div`,{className:`flex gap-4 py-2`,children:[H&&(0,G.jsx)(`img`,{src:k9(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:O9(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)(as,{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:qG.sanitize(A0e(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)(Zs,{className:`w-3 h-3`}),` `,e(`makerworld.openOnMakerworld`)]})]})]})})}),s&&ie.length>0&&(0,G.jsxs)(Pd,{children:[(0,G.jsx)(Fd,{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=>M0e(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)(Ws,{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)(Id,{children:(0,G.jsx)(`div`,{className:`grid gap-3`,children:ie.map((t,n)=>{let r=A9(t,`id`),a=A9(t,`profileId`),o=O9(t,`title`),s=O9(t,`cover`),c=A9(t,`materialCnt`),l=t?.needAms===!0,u=A9(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:k9(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)(Ws,{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)(Zs,{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)(as,{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)(fc,{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)(Ms,{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)(Zs,{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)(Zs,{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)(ku,{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)(Pd,{children:[(0,G.jsx)(Fd,{children:(0,G.jsx)(`h2`,{className:`text-base font-semibold`,children:e(`makerworld.recentImportsHeader`)})}),(0,G.jsx)(Id,{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)(fc,{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)(Ms,{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)(Zs,{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)(wc,{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)($d,{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)(UW,{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)(Zu,{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)(ls,{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)(cs,{className:`w-6 h-6`})})]}),(0,G.jsx)(`img`,{src:k9(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 j9=[`DEBUG`,`INFO`,`WARNING`,`ERROR`],M9={DEBUG:`text-gray-400`,INFO:`text-blue-400`,WARNING:`text-yellow-400`,ERROR:`text-red-400`},I0e={DEBUG:qo,INFO:Rc,WARNING:Mu,ERROR:ps};function L0e(){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:()=>Sd.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:()=>Sd.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)(I0e[e]||Rc,{className:`w-3.5 h-3.5 ${M9[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)(us,{className:`w-5 h-5 text-bambu-gray`}):(0,G.jsx)(ss,{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)(pu,{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)(El,{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)(ku,{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)(Fl,{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)(Gl,{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)(Zu,{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`}),j9.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===j9.length-1?`rounded-r`:``} ${s===e?`${M9[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 ${M9[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)(us,{className:`w-3.5 h-3.5`}):(0,G.jsx)(ss,{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 R0e(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 N9({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 z0e({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 P9({title:e,icon:t,children:n}){return(0,G.jsxs)(Pd,{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 B0e(){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:Sd.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 Sd.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 Sd.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)(Fl,{className:`w-4 h-4 ${m?`animate-spin`:``}`}),e(`common.refresh`,`Refresh`)]})]}),(0,G.jsx)(P9,{title:e(`system.application`,`Application`),icon:Jl,children:(0,G.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-4`,children:[(0,G.jsx)(N9,{icon:Jl,label:e(`system.version`,`Version`),value:`v${u.app.version}`}),(0,G.jsx)(N9,{icon:Ts,label:e(`system.uptime`,`System Uptime`),value:u.system.uptime_formatted}),(0,G.jsx)(N9,{icon:Jl,label:e(`system.hostname`,`Hostname`),value:u.system.hostname})]})}),(0,G.jsx)(P9,{title:e(`support.title`,`Support & Troubleshooting`),icon:Ac,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)(Ws,{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)(L0e,{})]})}),(0,G.jsxs)(P9,{title:e(`diagnostic.sectionTitle`,`Connection Diagnostic`),icon:hu,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)(hu,{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)(P9,{title:e(`systemHealth.sectionTitle`),icon:jc,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)(Fl,{className:`w-4 h-4 ${x?`animate-spin`:``}`}),e(`systemHealth.rescan`)]})]}),y?(0,G.jsx)(Am,{result:y}):(0,G.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`common.loading`)})]}),(0,G.jsxs)(P9,{title:e(`system.database`,`Database`),icon:zs,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4 mb-4`,children:[(0,G.jsx)(N9,{icon:zs,label:e(`system.dbEngine`,`Database Engine`),value:u.database.engine||`SQLite`}),(0,G.jsx)(N9,{icon:zs,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)(N9,{icon:Oo,label:e(`system.totalArchives`,`Total Archives`),value:u.database.archives}),(0,G.jsx)(N9,{icon:gs,label:e(`system.completed`,`Completed`),value:u.database.archives_completed,color:`text-green-500`}),(0,G.jsx)(N9,{icon:xs,label:e(`system.failed`,`Failed`),value:u.database.archives_failed,color:`text-red-500`}),(0,G.jsx)(N9,{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)(N9,{icon:jl,label:e(`system.printers`,`Printers`),value:u.database.printers}),(0,G.jsx)(N9,{icon:_l,label:e(`system.filaments`,`Filaments`),value:u.database.filaments}),(0,G.jsx)(N9,{icon:dc,label:e(`system.projects`,`Projects`),value:u.database.projects}),(0,G.jsx)(N9,{icon:Dl,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)(N9,{icon:Ts,label:e(`system.totalPrintTime`,`Total Print Time`),value:u.database.total_print_time_formatted}),(0,G.jsx)(N9,{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)(P9,{title:e(`system.connectedPrinters`,`Connected Printers`),icon:jl,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)(P9,{title:e(`system.storage`,`Storage`),icon:Oc,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)(z0e,{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)(N9,{icon:Oo,label:e(`system.archiveStorage`,`Archive Storage`),value:u.storage.archive_size_formatted}),(0,G.jsx)(N9,{icon:zs,label:e(`system.databaseSize`,`Database Size`),value:u.storage.database_size_formatted}),_&&(0,G.jsx)(N9,{icon:fc,label:e(`system.fileManagerStorage`,`File Manager`),value:R0e(_.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)(P9,{title:e(`system.memory`,`Memory`),icon:rl,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)(z0e,{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)(P9,{title:e(`system.cpu`,`CPU`),icon:Is,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)(N9,{icon:Is,label:e(`system.cores`,`Cores`),value:u.cpu.count,subValue:`${u.cpu.count_logical} logical`}),(0,G.jsx)(N9,{icon:Is,label:e(`system.usage`,`Usage`),value:`${u.cpu.percent}%`})]})})})]}),(0,G.jsx)(P9,{title:e(`system.systemDetails`,`System Details`),icon:Jl,children:(0,G.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-4`,children:[(0,G.jsx)(N9,{icon:Jl,label:e(`system.os`,`Operating System`),value:u.system.platform,subValue:u.system.platform_release}),(0,G.jsx)(N9,{icon:Is,label:e(`system.architecture`,`Architecture`),value:u.system.architecture}),(0,G.jsx)(N9,{icon:Jl,label:e(`system.python`,`Python`),value:u.system.python_version}),(0,G.jsx)(N9,{icon:Ts,label:e(`system.bootTime`,`Boot Time`),value:Zf(u.system.boot_time,S)})]})}),c&&(0,G.jsx)(Om,{printerId:c.id,printerName:c.name,onClose:()=>l(null)})]})}var F9=`auth_remember_me`,I9=`auth_post_login_redirect`;function L9(e){return e?`persistent`:`session`}function V0e(){try{let e=sessionStorage.getItem(F9)===`1`;return sessionStorage.removeItem(F9),e}catch(e){return console.warn(`consumeSavedRememberMe: sessionStorage unavailable, Remember Me preference lost across OIDC redirect`,e),!1}}function R9(e){return!e||!e.startsWith(`/`)||e.startsWith(`//`)||e.startsWith(`/login`)?null:e}function H0e(e){let t=R9(e);if(t)try{sessionStorage.setItem(I9,t)}catch(e){console.warn(`stashPostLoginRedirect: sessionStorage unavailable, post-login target will be lost across OIDC redirect`,e)}}function U0e(){try{let e=sessionStorage.getItem(I9);return sessionStorage.removeItem(I9),R9(e)}catch(e){return console.warn(`consumePostLoginRedirect: sessionStorage unavailable`,e),null}}function W0e({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)(eu,{className:`w-5 h-5 text-bambu-green`}),r(`login.twoFA.signInWith`,{provider:e.name})]})}function G0e(){let e=$n(),t=Xn(),[n]=ji(),{t:r}=U(),{login:i,loginWithToken:a,user:o,loading:s}=Od(),{showToast:c}=Hd(),{mode:l}=jd();function u(){let e=t.state?.from;if(e?.pathname){let t=R9(`${e.pathname}${e.search??``}`);if(t)return t}return U0e()??`/`}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,t=new Promise((e,t)=>setTimeout(()=>t(Error(`autologin timeout`)),5e3));Promise.race([Z.getOIDCAuthorizeUrl(e),t]).then(e=>{window.location.href=e.auth_url}).catch(()=>{ne(!0)})},[V,n]);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=V0e();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,L9(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,L9(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,L9(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=>{if(N)try{sessionStorage.setItem(F9,`1`)}catch(e){console.warn(`setItem auth_remember_me failed, Remember Me will not carry through OIDC redirect`,e)}let n=t.state?.from;n?.pathname&&H0e(`${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)(eu,{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)(su,{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:[(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`)})})]}),(0,G.jsx)(`div`,{className:`space-y-2`,children:ee.map(e=>(0,G.jsx)(W0e,{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)(Pd,{className:`w-full max-w-md`,onClick:e=>e.stopPropagation(),children:[(0,G.jsx)(Fd,{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)(Zu,{className:`w-5 h-5`})})]})}),(0,G.jsx)(Id,{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 K0e(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 q0e(){let{t:e}=U(),{authEnabled:t,loading:n}=Od(),[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(K0e(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 nd&&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)(Mu,{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(K0e(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 J0e(){let e=$n(),{t}=U(),{showToast:n}=Hd(),{mode:r}=jd(),{refreshAuth:i}=Od(),[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 Y0e(){let{t:e}=U(),{user:t}=Od(),{showToast:n}=Hd(),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)(Pd,{className:`mb-6 border-blue-300 bg-blue-50 dark:border-blue-500/30 dark:bg-blue-500/5`,children:(0,G.jsx)(Id,{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)(Pd,{className:`mb-6`,children:[(0,G.jsxs)(Fd,{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)(Id,{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)(gs,{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)(gs,{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)(gs,{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)(gs,{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)(Bl,{className:`w-4 h-4`}),e(`common.save`)]})})})]})}function X0e(){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)(XT,{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 Z0e=4401;function Q0e(){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}=Hd(),{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 nd?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===Z0e)&&(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(g6[0]);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 $0e=`#00ae42`,e2e=e=>e!=null&&e>0?e:1/0;function t2e(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=e2e(n.remaining_time),r=e2e(t.remaining_time);(e(t.progress??0))&&(t=n)}return t}function n2e(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()||$0e,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 z9(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 r2e(){let{progressInTitle:e,resolvedMode:t,darkAccent:n,lightAccent:r}=jd(),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?t2e(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}`,z9(n2e(d),s.current),l.current=!0):l.current&&=(document.title=c.current,z9(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,z9(null,e))}},[])}function i2e({children:e}){let{authEnabled:t,user:n,loading:r}=Od(),{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&&df(i.colors,i.byMaterial)},[i]),(0,G.jsx)(G.Fragment,{children:e})}function a2e({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)(Ku,{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:Qf(i,l?.time_format||`system`)})]})]})}var o2e=[{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 s2e(){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:o2e.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 c2e({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 l2e({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 Cd.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)(B9,{icon:(0,G.jsx)(Rl,{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)(B9,{icon:(0,G.jsx)(ll,{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)(B9,{icon:(0,G.jsx)(Rl,{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)(B9,{icon:(0,G.jsx)(kl,{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)(ss,{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 B9({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 u2e={weight:null,weightStable:!1,rawAdc:null,matchedSpool:null,unknownTagUid:null,unknownTrayUuid:null,deviceOnline:!1,deviceId:null};function d2e(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 f2e(){let[e,t]=(0,f.useReducer)(d2e,u2e),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,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 p2e=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-TpYl7fWS.css b/static/assets/index-TpYl7fWS.css deleted file mode 100644 index aa0faee3d..000000000 --- a/static/assets/index-TpYl7fWS.css +++ /dev/null @@ -1,2 +0,0 @@ -/*! 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-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-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;--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-\[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}.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-\[85vh\]{height:85vh}.h-\[160px\]{height:160px}.h-\[300px\]{height:300px}.h-\[calc\(100\%-40px\)\]{height:calc(100% - 40px)}.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-\[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-\[8rem\]{min-height:8rem}.min-h-\[14px\]{min-height:14px}.min-h-\[16px\]{min-height:16px}.min-h-\[18px\]{min-height:18px}.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-\[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-\[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-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-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\/40{border-color:#3080ff66}@supports (color:color-mix(in lab, red, red)){.border-blue-500\/40{border-color:color-mix(in oklab,var(--color-blue-500)40%,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-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-zinc-800{border-color:var(--color-zinc-800)}.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\/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-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-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-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-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\:border-bambu-dark-tertiary:disabled:hover{border-color:var(--color-bambu-dark-tertiary)}.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\: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\: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\: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\: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-x-visible{overflow-x:visible}.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\: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\(0\,20rem\)_minmax\(0\,1fr\)\]{grid-template-columns:minmax(0,20rem) minmax(0,1fr)}.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\: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\: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\/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\/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-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\/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-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\/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-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-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-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}}.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-Dy5qow0P.js b/static/assets/pdf-PYIYFK2D.js similarity index 99% rename from static/assets/pdf-Dy5qow0P.js rename to static/assets/pdf-PYIYFK2D.js index 68e3513ca..069f4a413 100644 --- a/static/assets/pdf-Dy5qow0P.js +++ b/static/assets/pdf-PYIYFK2D.js @@ -1,4 +1,4 @@ -import{p as e}from"./index-C3lPAZBn.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{p as e}from"./index-DZQZ7yaD.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 - + - +