From 4c052e04e1c7192306424ad427bb56f42144291c Mon Sep 17 00:00:00 2001 From: maziggy Date: Tue, 7 Apr 2026 12:32:44 +0200 Subject: [PATCH] Fix SpoolBuddy inventory not updating on spool changes (#905) Spool CRUD endpoints (create, bulk create, update, delete, archive, restore) did not emit websocket events, so SpoolBuddy Dashboard and other tabs relying on event-driven cache invalidation never refreshed. All inventory mutation endpoints now broadcast an `inventory_changed` websocket event. Frontend handles it by invalidating `inventory-spools`. --- CHANGELOG.md | 1 + backend/app/api/routes/inventory.py | 6 ++++++ frontend/src/hooks/useWebSocket.ts | 5 +++++ static/assets/{index-q3PKuEzO.js => index-CflptLB_.js} | 2 +- static/index.html | 2 +- 5 files changed, 14 insertions(+), 2 deletions(-) rename static/assets/{index-q3PKuEzO.js => index-CflptLB_.js} (99%) diff --git a/CHANGELOG.md b/CHANGELOG.md index d65a04a58..2806b6c41 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ All notable changes to Bambuddy will be documented in this file. - **Queue Widget Ignores Plate-Clear Setting** ([#752](https://github.com/maziggy/bambuddy/issues/752)) — The "Clear Plate & Start Next" button on printer cards appeared even when "Require plate-clear confirmation" was disabled in Settings → Queue. The backend correctly auto-dispatched without waiting, but the frontend widget always showed the prompt. The widget now respects the setting and shows a passive queue link instead when plate-clear confirmation is disabled. - **Ghost Jobs From SQLite Lock on Print Completion** ([#897](https://github.com/maziggy/bambuddy/issues/897)) — When a print finished, the queue status update (`printing` → `completed`) could fail silently if the SQLite database was locked by another writer (e.g. the runtime tracker). The failed commit left the job permanently stuck in `printing` status — a "ghost job" that caused the UI to show false double-assignments when the next job started. The critical queue status commit now retries up to 3 times with backoff on SQLite lock errors (PostgreSQL is unaffected — it uses row-level locking). Additionally, the runtime tracker was holding a single long transaction across all printers; it now commits per-printer to minimize lock hold time. - **Multi-Plug Automation Only Works for First Plug** ([#903](https://github.com/maziggy/bambuddy/issues/903)) — When multiple smart plugs were assigned to the same printer (e.g. a TUYA printer plug and a particle filter plug via Home Assistant), only the first plug's automation worked. The auto-on at print start, auto-off at print completion, and queue auto-off all queried for a single plug instead of iterating all plugs linked to the printer. All automation paths now control every assigned plug. Also fixed the queue auto-off path which was hardcoded to Tasmota instead of using the correct service for the plug type (HA, MQTT, REST). +- **SpoolBuddy Inventory Not Updating on Spool Changes** — Adding, editing, deleting, archiving, or restoring a spool in the internal inventory did not update SpoolBuddy's frontend views until the next manual refresh or 30-second poll. The spool CRUD endpoints did not emit websocket events, and the SpoolBuddy Dashboard had no polling fallback. All inventory mutation endpoints now broadcast an `inventory_changed` websocket event, and the frontend invalidates the spool cache on receipt — so SpoolBuddy (and all other tabs) reflect changes instantly. - **AMS Slot Changes Fail Until Reconnect** ([#887](https://github.com/maziggy/bambuddy/issues/887)) — After a keep-alive timeout, paho-mqtt auto-reconnects but the new session can be half-broken: the printer continues sending status updates but silently ignores commands. The developer mode probe detected this (no response, leaving `developer_mode` as `null`), but had no timeout or recovery — one unanswered probe permanently blocked retries. Added a 10-second probe timeout with one retry; after two consecutive unanswered probes, Bambuddy force-closes the socket to trigger a clean reconnect with a fresh session. Additionally, the developer mode probe was firing on every auto-reconnect, which destabilized some firmware MQTT brokers (A1/P1 series) — causing a reconnect → probe → disconnect feedback loop. The probe result is now cached across reconnects and only runs once on the first connection, with a 5-second delay after connect to let the session stabilize. - **WebSocket Crash on Printers Without `fun` Field** ([#873](https://github.com/maziggy/bambuddy/issues/873)) — Connecting to printers that don't send the MQTT `fun` field (A1, P1 series, X1Plus firmware) caused a repeating `'str' object has no attribute 'get'` crash in the WebSocket handler, showing the printer as offline with missing AMS and SD card info. The developer mode probe introduced in 0.2.3b1 published an MQTT message inside `_update_state()` between overwriting `raw_data` with the full MQTT dict (where `vt_tray` is a raw dict) and restoring the previously normalized list — the `publish()` call released the GIL, letting the event loop read the un-normalized dict and iterate over string keys instead of spool dicts. Fixed by normalizing `vt_tray` dict→list in the MQTT data before assignment, and moving preserved field restoration before the probe. Added defensive normalization in `printer_state_to_dict` as a belt-and-suspenders guard. diff --git a/backend/app/api/routes/inventory.py b/backend/app/api/routes/inventory.py index cffef7fdf..b10530d91 100644 --- a/backend/app/api/routes/inventory.py +++ b/backend/app/api/routes/inventory.py @@ -522,6 +522,7 @@ async def create_spool( await db.commit() await db.refresh(spool) result = await db.execute(select(Spool).options(selectinload(Spool.k_profiles)).where(Spool.id == spool.id)) + await ws_manager.broadcast({"type": "inventory_changed"}) return result.scalar_one() @@ -540,6 +541,7 @@ async def bulk_create_spools( await db.commit() ids = [s.id for s in spools] result = await db.execute(select(Spool).options(selectinload(Spool.k_profiles)).where(Spool.id.in_(ids))) + await ws_manager.broadcast({"type": "inventory_changed"}) return list(result.scalars().all()) @@ -566,6 +568,7 @@ async def update_spool( await db.commit() result = await db.execute(select(Spool).options(selectinload(Spool.k_profiles)).where(Spool.id == spool_id)) + await ws_manager.broadcast({"type": "inventory_changed"}) return result.scalar_one() @@ -583,6 +586,7 @@ async def delete_spool( await db.delete(spool) await db.commit() + await ws_manager.broadcast({"type": "inventory_changed"}) return {"status": "deleted"} @@ -603,6 +607,7 @@ async def archive_spool( spool.archived_at = datetime.now(timezone.utc) await db.commit() result = await db.execute(select(Spool).options(selectinload(Spool.k_profiles)).where(Spool.id == spool_id)) + await ws_manager.broadcast({"type": "inventory_changed"}) return result.scalar_one() @@ -621,6 +626,7 @@ async def restore_spool( spool.archived_at = None await db.commit() result = await db.execute(select(Spool).options(selectinload(Spool.k_profiles)).where(Spool.id == spool_id)) + await ws_manager.broadcast({"type": "inventory_changed"}) return result.scalar_one() diff --git a/frontend/src/hooks/useWebSocket.ts b/frontend/src/hooks/useWebSocket.ts index d430f9583..8280d462a 100644 --- a/frontend/src/hooks/useWebSocket.ts +++ b/frontend/src/hooks/useWebSocket.ts @@ -263,6 +263,11 @@ export function useWebSocket() { })); break; + case 'inventory_changed': + // Spool created/updated/deleted/archived/restored - refresh inventory across all tabs + debouncedInvalidate('inventory-spools'); + break; + case 'spool_assignment_changed': // Spool assigned/unassigned - refresh assignment data across all tabs debouncedInvalidate('spool-assignments'); diff --git a/static/assets/index-q3PKuEzO.js b/static/assets/index-CflptLB_.js similarity index 99% rename from static/assets/index-q3PKuEzO.js rename to static/assets/index-CflptLB_.js index bc9f77153..5597374ec 100644 --- a/static/assets/index-q3PKuEzO.js +++ b/static/assets/index-CflptLB_.js @@ -8720,7 +8720,7 @@ Difference: ${l}g (within tolerance)`:`Scale: ${Math.round(n)}g Calculated: ${Math.round(i)}g Difference: ${l}g (mismatch!)`;return a.jsxs("div",{className:`flex items-center gap-1 text-sm font-medium ${o?"text-green-400":"text-yellow-400"}`,title:c,children:[a.jsxs("span",{children:[Math.round(n),"g"]}),o?a.jsx(Xr,{className:"w-3 h-3"}):a.jsxs(a.Fragment,{children:[a.jsx(In,{className:"w-3 h-3"}),e&&a.jsx("button",{type:"button",onClick:d=>{d.stopPropagation(),d.preventDefault(),e(t)},className:"p-1 hover:bg-bambu-green/20 rounded transition-colors text-bambu-green",title:"Sync: trust scale weight and reset tracking",children:a.jsx(wr,{className:"w-3.5 h-3.5"})})]})]})}},p3={id:t=>t.id,added_time:t=>t.created_at||"",encode_time:t=>t.encode_time||"",last_used_time:t=>t.last_used||"",material:t=>(t.material||"").toLowerCase(),subtype:t=>(t.subtype||"").toLowerCase(),color_name:t=>(t.color_name||"").toLowerCase(),brand:t=>(t.brand||"").toLowerCase(),slicer_filament:t=>(t.slicer_filament_name||t.slicer_filament||"").toLowerCase(),location:(t,e)=>{const n=e[t.id];if(!n)return"";const r=n.ams_id===254||n.ams_id===255,i=!r&&n.ams_id>=128,s=n.ams_label?` (${n.ams_label})`:"";return`${n.printer_name||""} ${sS(n.ams_id,n.tray_id,i,r)}${s}`},label_weight:t=>t.label_weight,net:t=>Math.max(0,t.label_weight-t.weight_used),gross:t=>Math.max(0,t.label_weight-t.weight_used)+t.core_weight,used:t=>t.weight_used,remaining:t=>t.label_weight>0?Math.max(0,t.label_weight-t.weight_used)/t.label_weight:0,note:t=>(t.note||"").toLowerCase(),data_origin:t=>(t.data_origin||"").toLowerCase(),tag_type:t=>(t.tag_type||"").toLowerCase(),stock:t=>t.slicer_filament?1:0,spool_name:t=>t.core_weight_catalog_id??0,cost_per_kg:t=>t.cost_per_kg??0,weight_check:t=>{if(t.last_scale_weight==null)return-1;const e=Math.max(0,t.label_weight-t.weight_used)+t.core_weight;return Math.abs(t.last_scale_weight-e)}},qL="bambuddy-inventory-sort";function Unt(){try{const t=localStorage.getItem(qL);if(t)return JSON.parse(t)}catch{}return null}function Bnt(t){try{t?localStorage.setItem(qL,JSON.stringify(t)):localStorage.removeItem(qL)}catch{}}function Hnt(){const{data:t}=Je({queryKey:["spoolman-settings"],queryFn:pe.getSpoolmanSettings,staleTime:3e5});return t?.spoolman_enabled==="true"&&t?.spoolman_url?a.jsx("iframe",{src:`${t.spoolman_url.replace(/\/+$/,"")}/spool`,className:"h-full w-full border-0",title:"Spoolman",sandbox:"allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox"}):a.jsx(qnt,{})}function qnt(){const{t}=Lt(),e=hn(),{showToast:n}=xn(),[r,i]=w.useState(null),[s,o]=w.useState(null),[l,c]=w.useState("active"),[d,u]=w.useState("all"),[m,p]=w.useState(""),[f,y]=w.useState(""),[v,g]=w.useState(""),[b,_]=w.useState("all"),[N,P]=w.useState(""),[k,M]=w.useState("table"),[T,A]=w.useState(Unt),[C,F]=w.useState(Lnt),[$,I]=w.useState(!1),[Q,L]=w.useState(()=>{try{return localStorage.getItem("bambuddy-inventory-group")==="true"}catch{return!1}}),[re,ae]=w.useState(new Set),[J,le]=w.useState(0),[ue,de]=w.useState(()=>{try{const Pe=localStorage.getItem("bambuddy-inventory-pageSize");if(Pe){const Ae=Number(Pe);if([15,30,50,100,-1].includes(Ae))return Ae}}catch{}return 15}),{data:Y}=Je({queryKey:["settings"],queryFn:pe.getSettings}),te=Y?.date_format||"system",{data:ie,isLoading:xe}=Je({queryKey:["inventory-spools"],queryFn:()=>pe.getSpools(!0),refetchInterval:3e4}),{data:Ne}=Je({queryKey:["spool-assignments"],queryFn:()=>pe.getAssignments(),refetchInterval:3e4}),{data:B}=Je({queryKey:["spool-catalog"],queryFn:()=>pe.getSpoolCatalog()}),W=ct({mutationFn:Pe=>pe.deleteSpool(Pe),onSuccess:()=>{e.invalidateQueries({queryKey:["inventory-spools"]}),n(t("inventory.spoolDeleted"),"success")}}),D=ct({mutationFn:Pe=>pe.archiveSpool(Pe),onSuccess:()=>{e.invalidateQueries({queryKey:["inventory-spools"]}),n(t("inventory.spoolArchived"),"success")}}),j=ct({mutationFn:Pe=>pe.restoreSpool(Pe),onSuccess:()=>{e.invalidateQueries({queryKey:["inventory-spools"]}),n(t("inventory.spoolRestored"),"success")}}),z=async Pe=>{if(Pe.last_scale_weight!=null)try{await ja.updateSpoolWeight(Pe.id,Pe.last_scale_weight),e.invalidateQueries({queryKey:["inventory-spools"]});const Ae=[Pe.brand,Pe.material,Pe.color_name].filter(Boolean).join(" ");n(`Synced "${Ae}" to scale weight`,"success")}catch{n("Failed to sync weight","error")}},K=Y?.low_stock_threshold??20,[q,ce]=w.useState(!1),[O,G]=w.useState(K.toString());w.useEffect(()=>{q||G(K.toString())},[K,q]);const X=ct({mutationFn:Pe=>pe.updateSettings({low_stock_threshold:Pe}),onSuccess:()=>{e.invalidateQueries({queryKey:["settings"]}),n(t("common.saved"),"success"),ce(!1)},onError:()=>{n(t("inventory.lowStockThresholdError"),"error")}}),V=w.useMemo(()=>{if(!ie)return null;let Pe=0,Ae=0,$e=0,et=0;const ot={};for(const gt of ie){if(gt.archived_at)continue;et++;const ft=Math.max(0,gt.label_weight-gt.weight_used);Pe+=ft,Ae+=gt.weight_used,(gt.label_weight>0?ft/gt.label_weight*100:0){const Pe={};for(const Ae of Ne||[])Pe[Ae.spool_id]=Ae;return Pe},[Ne]),he=w.useMemo(()=>{const Pe={};for(const Ae of B||[])Pe[Ae.id]=Ae;return Pe},[B]),oe=w.useMemo(()=>V?Object.entries(V.byMaterial).sort((Pe,Ae)=>Ae[1].weight-Pe[1].weight).slice(0,4):[],[V]),U=w.useMemo(()=>{let Pe=ie||[];if(l==="active"?Pe=Pe.filter(Ae=>!Ae.archived_at):Pe=Pe.filter(Ae=>!!Ae.archived_at),d==="used"?Pe=Pe.filter(Ae=>Ae.weight_used>0):d==="new"?Pe=Pe.filter(Ae=>Ae.weight_used===0):d==="lowstock"&&(Pe=Pe.filter(Ae=>{const $e=Math.max(0,Ae.label_weight-Ae.weight_used);return(Ae.label_weight>0?$e/Ae.label_weight*100:0)Ae.material===m)),f&&(Pe=Pe.filter(Ae=>Ae.brand===f)),v){const Ae=Number(v);Pe=Pe.filter($e=>$e.core_weight_catalog_id===Ae)}if(b==="stock"?Pe=Pe.filter(Ae=>!Ae.slicer_filament):b==="configured"&&(Pe=Pe.filter(Ae=>!!Ae.slicer_filament)),N){const Ae=N.toLowerCase();Pe=Pe.filter($e=>$e.brand?.toLowerCase().includes(Ae)||$e.material.toLowerCase().includes(Ae)||$e.color_name?.toLowerCase().includes(Ae)||$e.subtype?.toLowerCase().includes(Ae)||$e.note?.toLowerCase().includes(Ae)||$e.slicer_filament_name?.toLowerCase().includes(Ae))}return Pe},[ie,l,d,m,f,v,b,N,K]),R=()=>le(0),ne=[...new Set(ie?.map(Pe=>Pe.material)||[])].sort(),ge=[...new Set(ie?.map(Pe=>Pe.brand).filter(Boolean)||[])].sort(),we=[...new Set(ie?.map(Pe=>Pe.core_weight_catalog_id).filter(Pe=>Pe!=null)||[])].sort((Pe,Ae)=>{const $e=(he[Pe]?.name||"").toLowerCase(),et=(he[Ae]?.name||"").toLowerCase();return $e.localeCompare(et)}),be=l!=="active"||d!=="all"||!!m||!!f||!!v||b!=="all"||!!N,ye=Pe=>{F(Pe),Ont(Pe)},fe=w.useMemo(()=>C.filter(Pe=>Pe.visible).map(Pe=>Pe.id),[C]),Se=Pe=>{p3[Pe]&&(A(Ae=>{let $e;return Ae?.column===Pe?$e=Ae.direction==="asc"?{column:Pe,direction:"desc"}:null:$e={column:Pe,direction:"asc"},Bnt($e),$e}),R())},Ee=w.useMemo(()=>{if(!T)return U;const Pe=p3[T.column];return Pe?[...U].sort(($e,et)=>{const ot=Pe($e,me),gt=Pe(et,me);return otgt?T.direction==="asc"?1:-1:0}):U},[U,T,me]),Me=w.useMemo(()=>{if(!Q)return Ee.map(et=>({type:"single",spool:et}));const Pe=new Map;for(const et of Ee)if(!(et.weight_used>0||me[et.id])){const ot=nX(et),gt=Pe.get(ot);gt?gt.push(et):Pe.set(ot,[et])}const Ae=[],$e=new Set;for(const et of Ee){if(et.weight_used>0||me[et.id]){Ae.push({type:"single",spool:et});continue}const ot=nX(et);if($e.has(ot))continue;$e.add(ot);const gt=Pe.get(ot);gt.length===1?Ae.push({type:"single",spool:gt[0]}):Ae.push({type:"group",key:ot,spools:gt,representative:gt[0]})}return Ae},[Ee,Q,me]),_e=ue===-1,je=Me.length,ze=_e?je||1:ue,Fe=Math.max(1,Math.ceil(je/ze)),Xe=_e?0:Math.min(J,Fe-1),ve=_e?Me:Me.slice(Xe*ze,(Xe+1)*ze),Ge=()=>{const Pe=!Q;L(Pe),ae(new Set),R();try{localStorage.setItem("bambuddy-inventory-group",String(Pe))}catch{}},De=Pe=>{ae(Ae=>{const $e=new Set(Ae);return $e.has(Pe)?$e.delete(Pe):$e.add(Pe),$e})},Qe=Pe=>{de(Pe),le(0);try{localStorage.setItem("bambuddy-inventory-pageSize",String(Pe))}catch{}},Ve=()=>{c("active"),u("all"),p(""),y(""),g(""),_("all"),P(""),R()};return a.jsxs("div",{className:"p-4 md:p-6 space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Ma,{className:"w-6 h-6 text-bambu-green"}),a.jsx("h1",{className:"text-2xl font-bold text-white",children:t("inventory.title")})]}),a.jsx("p",{className:"text-sm text-bambu-gray mt-1 ml-9",children:(t("inventory.noSpools").split(".")[0],"")})]}),a.jsxs(Ie,{onClick:()=>i({spool:null}),children:[a.jsx(mr,{className:"w-4 h-4"}),t("inventory.addSpool")]})]}),V&&!xe&&a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-3",children:[a.jsxs("div",{className:"bg-bambu-dark-secondary rounded-lg p-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx(Ma,{className:"w-4 h-4 text-bambu-green"}),a.jsx("span",{className:"text-xs text-bambu-gray font-medium uppercase tracking-wide",children:t("inventory.totalInventory")})]}),a.jsx("div",{className:"text-xl font-bold text-white",children:Nd(V.totalWeight,!0)}),a.jsxs("div",{className:"text-xs text-bambu-gray mt-1",children:[V.totalSpools," ",V.totalSpools!==1?t("inventory.spools"):t("inventory.spool")]})]}),a.jsxs("div",{className:"bg-bambu-dark-secondary rounded-lg p-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx(hO,{className:"w-4 h-4 text-blue-400"}),a.jsx("span",{className:"text-xs text-bambu-gray font-medium uppercase tracking-wide",children:t("inventory.totalConsumed")})]}),a.jsx("div",{className:"text-xl font-bold text-white",children:Nd(V.totalConsumed,!0)}),a.jsx("div",{className:"text-xs text-bambu-gray mt-1",children:t("inventory.sinceTracking")})]}),a.jsxs("div",{className:"bg-bambu-dark-secondary rounded-lg p-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx(na,{className:"w-4 h-4 text-green-400"}),a.jsx("span",{className:"text-xs text-bambu-gray font-medium uppercase tracking-wide",children:t("inventory.byMaterial")})]}),a.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1",children:oe.map(([Pe,Ae])=>a.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium ${Int[Pe]||"bg-bambu-dark-tertiary text-bambu-gray"}`,children:[Pe," ",a.jsx("span",{className:"opacity-70",children:Nd(Ae.weight,!0)})]},Pe))})]}),a.jsxs("div",{className:"bg-bambu-dark-secondary rounded-lg p-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx(Tr,{className:"w-4 h-4 text-purple-400"}),a.jsx("span",{className:"text-xs text-bambu-gray font-medium uppercase tracking-wide",children:t("inventory.inPrinter")})]}),a.jsx("div",{className:"text-xl font-bold text-white",children:ee}),a.jsx("div",{className:"text-xs text-bambu-gray mt-1",children:t("inventory.loadedInAms")})]}),a.jsxs("div",{className:"bg-bambu-dark-secondary rounded-lg p-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx(In,{className:"w-4 h-4 text-yellow-400"}),a.jsx("span",{className:"text-xs text-bambu-gray font-medium uppercase tracking-wide",children:t("inventory.lowStock")})]}),a.jsx("div",{className:`text-xl font-bold ${V.lowStock>0?"text-yellow-400":"text-white"}`,children:V.lowStock}),a.jsx("div",{className:"text-xs text-bambu-gray mt-1 flex items-center gap-2",children:q?a.jsxs("form",{onSubmit:Pe=>{Pe.preventDefault();const Ae=parseFloat(O);!isNaN(Ae)&&Ae>=.1&&Ae<=99.9?X.mutate(Ae):n(t("inventory.lowStockThresholdError"),"error")},className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-xs text-bambu-gray",children:"<"}),a.jsx("input",{type:"text",inputMode:"decimal",pattern:"^\\d{0,2}(\\.\\d?)?$",maxLength:4,value:O,onChange:Pe=>{const Ae=Pe.target.value.replace(/[^\d.]/g,"");/^\d{0,2}(\.\d?)?$/.test(Ae)&&G(Ae)},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:Pe=>Pe.currentTarget.blur(),disabled:X.isPending}),a.jsx("span",{className:"text-xs text-bambu-gray",children:"%"}),a.jsx(Ie,{type:"submit",size:"sm",disabled:X.isPending,children:t("common.save")}),a.jsx(Ie,{type:"button",size:"sm",variant:"ghost",onClick:()=>ce(!1),disabled:X.isPending,children:t("common.cancel")})]}):a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"text-bambu-gray",children:["< ",K,"%"]}),a.jsx("button",{className:"p-1.5 text-bambu-gray hover:text-white rounded transition-colors",title:t("common.edit"),onClick:()=>{G(K.toString()),ce(!0)},children:a.jsx(kh,{className:"w-4 h-4"})})]})})]})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 items-start sm:items-center justify-between",children:[a.jsxs("div",{className:"relative flex-1 max-w-md",children:[a.jsx(Fr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray/50"}),a.jsx("input",{type:"text",value:N,onChange:Pe=>{P(Pe.target.value),R()},placeholder:t("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"}),N&&a.jsx("button",{onClick:()=>{P(""),R()},className:"absolute right-3 top-1/2 -translate-y-1/2 text-bambu-gray hover:text-white",children:a.jsx(Ht,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[k==="table"&&a.jsxs("button",{onClick:()=>I(!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:t("inventory.configureColumns"),children:[a.jsx(efe,{className:"w-4 h-4"}),a.jsx("span",{className:"hidden sm:inline",children:t("inventory.columns")})]}),a.jsxs("button",{onClick:Ge,className:`flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium border rounded-lg transition-colors ${Q?"bg-bambu-green/20 text-bambu-green border-bambu-green/30":"text-bambu-gray border-bambu-dark-tertiary hover:bg-bambu-dark-tertiary"}`,title:t("inventory.groupSimilar"),children:[a.jsx(Qfe,{className:"w-4 h-4"}),a.jsx("span",{className:"hidden sm:inline",children:t("inventory.groupSimilar")})]}),a.jsxs("div",{className:"flex bg-bambu-dark-primary border border-bambu-dark-tertiary rounded-lg overflow-hidden",children:[a.jsxs("button",{onClick:()=>M("table"),className:`flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium transition-colors ${k==="table"?"bg-bambu-green text-white":"text-bambu-gray hover:bg-bambu-dark-tertiary"}`,children:[a.jsx($be,{className:"w-4 h-4"}),a.jsx("span",{className:"hidden sm:inline",children:t("inventory.table")})]}),a.jsxs("button",{onClick:()=>M("cards"),className:`flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium transition-colors ${k==="cards"?"bg-bambu-green text-white":"text-bambu-gray hover:bg-bambu-dark-tertiary"}`,children:[a.jsx(Aw,{className:"w-4 h-4"}),a.jsx("span",{className:"hidden sm:inline",children:t("inventory.cards")})]})]})]})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsxs("div",{className:"flex items-center rounded-lg border border-bambu-dark-tertiary overflow-hidden",children:[a.jsxs("button",{onClick:()=>{c("active"),R()},className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium transition-colors ${l==="active"?"bg-bambu-green/20 text-bambu-green":"text-bambu-gray hover:bg-bambu-dark-tertiary"}`,children:[a.jsx(Ma,{className:"w-3.5 h-3.5"}),t("inventory.active")]}),a.jsxs("button",{onClick:()=>{c("archived"),R()},className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium transition-colors ${l==="archived"?"bg-bambu-green/20 text-bambu-green":"text-bambu-gray hover:bg-bambu-dark-tertiary"}`,children:[a.jsx(ro,{className:"w-3.5 h-3.5"}),t("inventory.archived")]})]}),a.jsx("div",{className:"w-px h-5 bg-bambu-dark-tertiary"}),a.jsxs("div",{className:"flex items-center rounded-lg border border-bambu-dark-tertiary overflow-hidden",children:[a.jsx("button",{onClick:()=>{u("all"),R()},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:t("inventory.all")}),a.jsxs("button",{onClick:()=>{u("used"),R()},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:[a.jsx(rr,{className:"w-3.5 h-3.5"}),t("inventory.used")]}),a.jsx("button",{onClick:()=>{u("new"),R()},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:t("inventory.new")}),a.jsxs("button",{onClick:()=>{u("lowstock"),R()},className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium transition-colors ${d==="lowstock"?"bg-yellow-500/20 text-yellow-400":"text-bambu-gray hover:bg-bambu-dark-tertiary"}`,children:[a.jsx(In,{className:"w-3.5 h-3.5"}),t("inventory.lowStock")]})]}),a.jsxs("div",{className:"flex items-center rounded-lg border border-bambu-dark-tertiary overflow-hidden",children:[a.jsx("button",{onClick:()=>{_("all"),R()},className:`px-3 py-1.5 text-xs font-medium transition-colors ${b==="all"?"bg-bambu-green/20 text-bambu-green":"text-bambu-gray hover:bg-bambu-dark-tertiary"}`,children:t("inventory.all")}),a.jsx("button",{onClick:()=>{_("stock"),R()},className:`px-3 py-1.5 text-xs font-medium transition-colors ${b==="stock"?"bg-amber-500/20 text-amber-400":"text-bambu-gray hover:bg-bambu-dark-tertiary"}`,children:t("inventory.stock")}),a.jsx("button",{onClick:()=>{_("configured"),R()},className:`px-3 py-1.5 text-xs font-medium transition-colors ${b==="configured"?"bg-bambu-green/20 text-bambu-green":"text-bambu-gray hover:bg-bambu-dark-tertiary"}`,children:t("inventory.configured")})]}),a.jsx("div",{className:"w-px h-5 bg-bambu-dark-tertiary"}),a.jsxs("select",{value:m,onChange:Pe=>{p(Pe.target.value),R()},className:`px-3 py-1.5 rounded-lg border text-xs font-medium transition-colors cursor-pointer focus:outline-none ${m?"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:[a.jsx("option",{value:"",children:t("inventory.material")}),ne.map(Pe=>a.jsx("option",{value:Pe,children:Pe},Pe))]}),a.jsxs("select",{value:f,onChange:Pe=>{y(Pe.target.value),R()},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:[a.jsx("option",{value:"",children:t("inventory.brand")}),ge.map(Pe=>a.jsx("option",{value:Pe,children:Pe},Pe))]}),we.length>0&&a.jsxs("select",{value:v,onChange:Pe=>{g(Pe.target.value),R()},className:`px-3 py-1.5 rounded-lg border text-xs font-medium transition-colors cursor-pointer focus:outline-none ${v?"bg-bambu-green/20 text-bambu-green border-bambu-green/30":"bg-transparent text-bambu-gray border-bambu-dark-tertiary hover:bg-bambu-dark-tertiary"}`,children:[a.jsx("option",{value:"",children:t("inventory.spoolName")}),we.map(Pe=>a.jsx("option",{value:Pe,children:he[Pe]?.name||`#${Pe}`},Pe))]}),be&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-px h-5 bg-bambu-dark-tertiary"}),a.jsxs("button",{onClick:Ve,className:"flex items-center gap-1 text-xs text-bambu-gray hover:text-bambu-green transition-colors",children:[a.jsx(Ht,{className:"w-3.5 h-3.5"}),t("inventory.clearFilters")]})]}),a.jsxs("span",{className:"ml-auto text-xs text-bambu-gray",children:[Ee.length," ",Ee.length!==1?t("inventory.spools"):t("inventory.spool"),Q&&je0?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:ve.map(Pe=>{if(Pe.type==="group"){const{key:gt,spools:ft,representative:Bt}=Pe,Jt=Bt.rgba?`#${Bt.rgba.substring(0,6)}`:"#808080",Qt=re.has(gt);return a.jsxs("div",{className:"col-span-full",children:[a.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:()=>De(gt),children:[a.jsx("div",{className:"h-10 flex items-center px-4 gap-3",style:{backgroundColor:Jt},children:a.jsx("span",{className:"bg-white/90 text-gray-800 px-3 py-0.5 rounded-full text-sm font-medium",children:EP(Bt.color_name,Bt.rgba)||"-"})}),a.jsxs("div",{className:"px-4 py-3 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Fn,{className:`w-4 h-4 text-bambu-gray transition-transform ${Qt?"":"-rotate-90"}`}),a.jsxs("div",{children:[a.jsxs("h3",{className:"font-semibold text-white",children:[Bt.material,Bt.subtype?` ${Bt.subtype}`:""]}),a.jsx("p",{className:"text-sm text-bambu-gray",children:Bt.brand||"-"})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm text-bambu-gray",children:Nd(Bt.label_weight)}),a.jsx("span",{className:"text-xs font-medium bg-bambu-green/20 text-bambu-green px-2 py-0.5 rounded-full",children:t("inventory.groupedSpools",{count:ft.length})})]})]})]}),Qt&&a.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:ft.map(xt=>{const Wt=Math.max(0,xt.label_weight-xt.weight_used),We=xt.label_weight>0?Wt/xt.label_weight*100:0,Et=xt.rgba?`#${xt.rgba.substring(0,6)}`:"#808080";return a.jsx(rX,{spool:xt,remaining:Wt,pct:We,colorStyle:Et,onClick:()=>i({spool:xt}),t},xt.id)})})]},`group-${gt}`)}const Ae=Pe.spool,$e=Math.max(0,Ae.label_weight-Ae.weight_used),et=Ae.label_weight>0?$e/Ae.label_weight*100:0,ot=Ae.rgba?`#${Ae.rgba.substring(0,6)}`:"#808080";return a.jsx(rX,{spool:Ae,remaining:$e,pct:et,colorStyle:ot,onClick:()=>i({spool:Ae}),t},Ae.id)})}),a.jsx($nt,{pageIndex:Xe,pageSize:ue,totalRows:je,totalPages:Fe,onPageChange:le,onPageSizeChange:Qe,t})]}):a.jsx(aX,{hasFilters:be,onAddSpool:()=>i({spool:null}),t}):ve.length>0?a.jsxs("div",{className:"bg-bambu-dark-secondary rounded-lg overflow-hidden border border-bambu-dark-tertiary",children:[a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-bambu-dark-tertiary bg-bambu-dark-tertiary/30",children:[fe.map(Pe=>{const Ae=!!p3[Pe],$e=T?.column===Pe;return a.jsx("th",{className:`text-left py-3 px-4 text-xs font-medium uppercase tracking-wide select-none ${Pe==="remaining"?"min-w-[150px]":""} ${Ae?"cursor-pointer hover:text-bambu-green transition-colors":""} ${$e?"text-bambu-green":"text-bambu-gray"}`,onClick:Ae?()=>Se(Pe):void 0,children:a.jsxs("span",{className:"inline-flex items-center gap-1",children:[znt[Pe]?.(t)??Pe,Ae&&($e?T.direction==="asc"?a.jsx(zf,{className:"w-3 h-3"}):a.jsx(bx,{className:"w-3 h-3"}):a.jsx(sO,{className:"w-3 h-3 opacity-30"}))]})},Pe)}),a.jsx("th",{className:"text-right py-3 px-4 text-xs font-medium text-bambu-gray uppercase tracking-wide",children:t("common.actions")})]})}),a.jsx("tbody",{children:ve.map(Pe=>{if(Pe.type==="group"){const{key:ot,spools:gt,representative:ft}=Pe,Bt=re.has(ot),Jt=Math.max(0,ft.label_weight-ft.weight_used),Qt=ft.label_weight>0?Jt/ft.label_weight*100:0;return a.jsx(Vnt,{spools:gt,representative:ft,remaining:Jt,pct:Qt,isExpanded:Bt,onToggle:()=>De(ot),onEdit:xt=>i({spool:xt}),onArchive:xt=>o({type:"archive",spoolId:xt}),onDelete:xt=>o({type:"delete",spoolId:xt}),visibleColumns:fe,assignmentMap:me,catalogMap:he,currencySymbol:se,dateFormat:te,t,onSyncWeight:z},`group-${ot}`)}const Ae=Pe.spool,$e=Math.max(0,Ae.label_weight-Ae.weight_used),et=Ae.label_weight>0?$e/Ae.label_weight*100:0;return a.jsx(Cle,{spool:Ae,remaining:$e,pct:et,onEdit:()=>i({spool:Ae}),onRestore:()=>j.mutate(Ae.id),onArchive:()=>o({type:"archive",spoolId:Ae.id}),onDelete:()=>o({type:"delete",spoolId:Ae.id}),visibleColumns:fe,assignmentMap:me,catalogMap:he,currencySymbol:se,dateFormat:te,t,onSyncWeight:z},Ae.id)})})]})}),a.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:[a.jsx("span",{className:"text-bambu-gray",children:_e?`${je} ${t(je!==1?"inventory.spools":"inventory.spool")}`:a.jsxs(a.Fragment,{children:[t("inventory.showing")," ",Xe*ze+1," ",t("inventory.to")," ",Math.min((Xe+1)*ze,je)," ",t("inventory.of")," ",je," ",t("inventory.spools")]})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-bambu-gray",children:t("inventory.show")}),a.jsxs("select",{value:ue,onChange:Pe=>Qe(Number(Pe.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(Pe=>a.jsx("option",{value:Pe,children:Pe},Pe)),a.jsx("option",{value:-1,children:t("inventory.all")})]}),!_e&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>le(0),disabled:Xe===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:a.jsx(lO,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>le(Pe=>Math.max(0,Pe-1)),disabled:Xe===0,className:"p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:a.jsx(ml,{className:"w-4 h-4"})}),a.jsxs("span",{className:"text-bambu-gray px-2 whitespace-nowrap",children:[t("inventory.page")," ",Xe+1," ",t("inventory.of")," ",Fe]}),a.jsx("button",{onClick:()=>le(Pe=>Math.min(Fe-1,Pe+1)),disabled:Xe>=Fe-1,className:"p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:a.jsx(Qa,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>le(Fe-1),disabled:Xe>=Fe-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:a.jsx(cO,{className:"w-4 h-4"})})]})]})]})]}):a.jsx(aX,{hasFilters:be,onAddSpool:()=>i({spool:null}),t}),r!==null&&a.jsx(Fnt,{isOpen:!0,onClose:()=>i(null),spool:r.spool,currencySymbol:se}),s&&a.jsx(kn,{title:s.type==="delete"?t("common.delete"):t("inventory.archive"),message:s.type==="delete"?t("inventory.deleteConfirm"):t("inventory.archiveConfirm"),confirmText:s.type==="delete"?t("common.delete"):t("inventory.archive"),variant:s.type==="delete"?"danger":"warning",onConfirm:()=>{s.type==="delete"?W.mutate(s.spoolId):D.mutate(s.spoolId),o(null)},onCancel:()=>o(null)}),a.jsx(Rnt,{isOpen:$,onClose:()=>I(!1),columns:C,defaultColumns:zk,onSave:ye})]})}function $nt({pageIndex:t,pageSize:e,totalRows:n,totalPages:r,onPageChange:i,onPageSizeChange:s,t:o}){const l=e===-1;if(r<=1&&!l)return null;const c=l?n||1:e;return a.jsxs("div",{className:"flex items-center justify-between pt-2 text-sm",children:[a.jsx("span",{className:"text-bambu-gray",children:l?`${n} ${o(n!==1?"inventory.spools":"inventory.spool")}`:a.jsxs(a.Fragment,{children:[o("inventory.showing")," ",t*c+1," ",o("inventory.to")," ",Math.min((t+1)*c,n)," ",o("inventory.of")," ",n," ",o("inventory.spools")]})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-bambu-gray",children:o("inventory.show")}),a.jsxs("select",{value:e,onChange:d=>s(Number(d.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(d=>a.jsx("option",{value:d,children:d},d)),a.jsx("option",{value:-1,children:o("inventory.all")})]}),!l&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>i(0),disabled:t===0,className:"p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:a.jsx(lO,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>i(Math.max(0,t-1)),disabled:t===0,className:"p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:a.jsx(ml,{className:"w-4 h-4"})}),a.jsxs("span",{className:"text-bambu-gray px-2 whitespace-nowrap",children:[o("inventory.page")," ",t+1," ",o("inventory.of")," ",r]}),a.jsx("button",{onClick:()=>i(Math.min(r-1,t+1)),disabled:t>=r-1,className:"p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:a.jsx(Qa,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>i(r-1),disabled:t>=r-1,className:"p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:a.jsx(cO,{className:"w-4 h-4"})})]})]})]})}function rX({spool:t,remaining:e,pct:n,colorStyle:r,onClick:i,t:s}){return a.jsxs("div",{className:`bg-bambu-dark-secondary rounded-lg overflow-hidden border border-bambu-dark-tertiary hover:border-bambu-green transition-colors cursor-pointer ${t.archived_at?"opacity-50":""}`,onClick:i,children:[a.jsx("div",{className:"h-14 flex items-center justify-center",style:{backgroundColor:r},children:a.jsx("span",{className:"bg-white/90 text-gray-800 px-3 py-0.5 rounded-full text-sm font-medium",children:EP(t.color_name,t.rgba)||"-"})}),a.jsxs("div",{className:"p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{children:[a.jsxs("h3",{className:"font-semibold text-white",children:[t.material,t.subtype?` ${t.subtype}`:""]}),a.jsx("p",{className:"text-sm text-bambu-gray",children:t.brand||"-"})]}),a.jsxs("span",{className:"text-xs font-mono text-bambu-gray bg-bambu-dark-tertiary px-2 py-1 rounded",children:["#",t.id]})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs text-bambu-gray mb-1",children:[a.jsx("span",{children:s("inventory.remaining")}),a.jsxs("span",{children:[Math.round(n),"%"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"flex-1 h-2 bg-bambu-dark-tertiary rounded-full overflow-hidden",children:a.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)}%`}})}),a.jsxs("span",{className:"text-xs text-bambu-gray min-w-[40px] text-right",children:[Math.round(e),"g"]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[a.jsxs("div",{children:[a.jsxs("span",{className:"text-bambu-gray/60",children:[s("inventory.labelWeight"),": "]}),a.jsx("span",{className:"text-bambu-gray",children:Nd(t.label_weight)})]}),a.jsxs("div",{children:[a.jsxs("span",{className:"text-bambu-gray/60",children:[s("inventory.weightUsed"),": "]}),a.jsx("span",{className:"text-bambu-gray",children:t.weight_used>0?Nd(t.weight_used):"-"})]})]}),t.note&&a.jsx("div",{className:"text-xs text-bambu-gray/60 pt-2 border-t border-bambu-dark-tertiary truncate",title:t.note,children:t.note})]})]})}function Cle({spool:t,remaining:e,pct:n,onEdit:r,onRestore:i,onArchive:s,onDelete:o,visibleColumns:l,assignmentMap:c,catalogMap:d,currencySymbol:u,dateFormat:m,t:p,onSyncWeight:f}){return a.jsxs("tr",{className:`border-b border-bambu-dark-tertiary/50 hover:bg-bambu-dark-tertiary/30 transition-colors cursor-pointer ${t.archived_at?"opacity-50":""}`,onClick:r,children:[l.map(y=>a.jsx("td",{className:"py-3 px-4",children:HL[y]?.({spool:t,remaining:e,pct:n,assignmentMap:c,catalogMap:d,currencySymbol:u,dateFormat:m,t:p,onSyncWeight:f})},y)),a.jsx("td",{className:"py-3 px-4",children:a.jsxs("div",{className:"flex items-center justify-end gap-1",onClick:y=>y.stopPropagation(),children:[a.jsx("button",{onClick:r,className:"p-1.5 text-bambu-gray hover:text-white rounded transition-colors",title:p("common.edit"),children:a.jsx(kh,{className:"w-4 h-4"})}),t.archived_at?a.jsx("button",{onClick:i,className:"p-1.5 text-bambu-gray hover:text-bambu-green rounded transition-colors",title:p("inventory.restore"),children:a.jsx(Io,{className:"w-4 h-4"})}):a.jsx("button",{onClick:s,className:"p-1.5 text-bambu-gray hover:text-yellow-400 rounded transition-colors",title:p("inventory.archive"),children:a.jsx(ro,{className:"w-4 h-4"})}),a.jsx("button",{onClick:o,className:"p-1.5 text-bambu-gray hover:text-red-400 rounded transition-colors",title:p("common.delete"),children:a.jsx(un,{className:"w-4 h-4"})})]})})]})}function Vnt({spools:t,representative:e,remaining:n,pct:r,isExpanded:i,onToggle:s,onEdit:o,onArchive:l,onDelete:c,visibleColumns:d,assignmentMap:u,catalogMap:m,currencySymbol:p,dateFormat:f,t:y,onSyncWeight:v}){return a.jsxs(a.Fragment,{children:[a.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:s,children:[d.map((g,b)=>a.jsx("td",{className:"py-3 px-4",children:b===0?a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Fn,{className:`w-4 h-4 text-bambu-gray transition-transform ${i?"":"-rotate-90"}`}),HL[g]?.({spool:e,remaining:n,pct:r,assignmentMap:u,catalogMap:m,currencySymbol:p,dateFormat:f,t:y,onSyncWeight:v})]}):g==="id"?a.jsx("span",{className:"text-xs font-medium bg-bambu-green/20 text-bambu-green px-2 py-0.5 rounded-full",children:y("inventory.groupedSpools",{count:t.length})}):HL[g]?.({spool:e,remaining:n,pct:r,assignmentMap:u,catalogMap:m,currencySymbol:p,dateFormat:f,t:y,onSyncWeight:v})},g)),a.jsx("td",{className:"py-3 px-4",children:a.jsx("span",{className:"text-xs text-bambu-gray",children:t.map(g=>`#${g.id}`).join(", ")})})]}),i&&t.map(g=>{const b=Math.max(0,g.label_weight-g.weight_used),_=g.label_weight>0?b/g.label_weight*100:0;return a.jsx(Cle,{spool:g,remaining:b,pct:_,onEdit:()=>o(g),onRestore:()=>{},onArchive:()=>l(g.id),onDelete:()=>c(g.id),visibleColumns:d,assignmentMap:u,catalogMap:m,currencySymbol:p,dateFormat:f,t:y,onSyncWeight:v},g.id)})]})}function aX({hasFilters:t,onAddSpool:e,t:n}){return a.jsxs("div",{className:"flex flex-col items-center justify-center py-16 px-4",children:[a.jsxs("div",{className:"relative mb-6",children:[a.jsx("div",{className:"absolute inset-0 -m-4 bg-bambu-green/5 rounded-full blur-2xl"}),a.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:[a.jsx("div",{className:"absolute -top-1 -right-1 w-3 h-3 rounded-full bg-bambu-green/30"}),a.jsx("div",{className:"absolute -bottom-2 -left-2 w-2 h-2 rounded-full bg-bambu-green/20"}),t?a.jsx(Fr,{className:"w-10 h-10 text-bambu-gray/40",strokeWidth:1.5}):a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"w-14 h-14 rounded-full border-4 border-bambu-gray/20 flex items-center justify-center",children:a.jsx("div",{className:"w-6 h-6 rounded-full bg-bambu-gray/10 border-2 border-bambu-gray/20"})}),a.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:a.jsx("span",{className:"text-white text-lg font-bold leading-none",children:"+"})})]})]})]}),a.jsx("h3",{className:"text-lg font-semibold text-white mb-2 text-center",children:t?n("inventory.noSpoolsMatch"):n("inventory.noSpools").split(".")[0]}),a.jsx("p",{className:"text-sm text-bambu-gray text-center max-w-sm mb-6",children:n(t?"inventory.noSpoolsMatchDesc":"inventory.noSpools")}),!t&&a.jsxs(Ie,{onClick:e,children:[a.jsx(Ma,{className:"w-4 h-4"}),n("inventory.addSpool")]})]})}const iX=["DEBUG","INFO","WARNING","ERROR"],f3={DEBUG:"text-gray-400",INFO:"text-blue-400",WARNING:"text-yellow-400",ERROR:"text-red-400"},Gnt={DEBUG:xx,INFO:eo,WARNING:In,ERROR:Ya};function Wnt(){const t=hn(),[e,n]=w.useState(!0),[r,i]=w.useState(new Set),[s,o]=w.useState(""),[l,c]=w.useState("ALL"),[d,u]=w.useState(!1),[m,p]=w.useState(!1),f=w.useRef(null),{data:y,isLoading:v,refetch:g}=Je({queryKey:["application-logs",l,s],queryFn:()=>nx.getLogs({limit:200,level:l==="ALL"?void 0:l,search:s||void 0}),refetchInterval:m?2e3:!1,enabled:d});w.useEffect(()=>{d||p(!1)},[d]);const b=ct({mutationFn:()=>nx.clearLogs(),onSuccess:()=>{t.invalidateQueries({queryKey:["application-logs"]})}});w.useEffect(()=>{e&&f.current&&y?.entries&&(f.current.scrollTop=f.current.scrollHeight)},[y?.entries,e]);const _=T=>{i(A=>{const C=new Set(A);return C.has(T)?C.delete(T):C.add(T),C})},N=T=>{const A=T.split(" ");return A.length>=2?A[1]:T},P=w.useMemo(()=>y?.entries??[],[y?.entries]),k=w.useMemo(()=>[...P].reverse(),[P]),M=({level:T})=>{const A=Gnt[T]||eo;return a.jsx(A,{className:`w-3.5 h-3.5 ${f3[T]||"text-gray-400"}`})};return a.jsxs("div",{className:"bg-bambu-dark rounded-lg overflow-hidden",children:[a.jsxs("button",{onClick:()=>u(!d),className:"w-full flex items-center justify-between p-4 hover:bg-bambu-dark-tertiary/50 transition-colors",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${m?"bg-bambu-green/20 text-bambu-green":"bg-bambu-dark-tertiary text-bambu-gray"}`,children:a.jsx(xx,{className:"w-5 h-5"})}),a.jsxs("div",{className:"text-left",children:[a.jsx("p",{className:"font-medium text-white",children:"Application Logs"}),a.jsx("p",{className:"text-sm text-bambu-gray",children:m?`Live streaming - ${y?.filtered_count??0} entries`:"View and filter application logs"})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[m&&a.jsxs("span",{className:"flex items-center gap-1.5 px-2 py-1 bg-bambu-green/20 rounded text-bambu-green text-xs",children:[a.jsx("span",{className:"w-1.5 h-1.5 bg-bambu-green rounded-full animate-pulse"}),"Live"]}),d?a.jsx(nc,{className:"w-5 h-5 text-bambu-gray"}):a.jsx(Fn,{className:"w-5 h-5 text-bambu-gray"})]})]}),d&&a.jsxs("div",{className:"border-t border-bambu-dark-tertiary",children:[a.jsxs("div",{className:"flex flex-col gap-2 p-4 border-b border-bambu-dark-tertiary",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[m?a.jsxs("button",{onClick:T=>{T.stopPropagation(),p(!1)},className:"flex items-center gap-1.5 px-3 py-1.5 text-sm bg-red-500/20 text-red-400 hover:bg-red-500/30 rounded transition-colors",children:[a.jsx(so,{className:"w-4 h-4"}),"Stop"]}):a.jsxs("button",{onClick:T=>{T.stopPropagation(),p(!0),g()},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:[a.jsx(zs,{className:"w-4 h-4"}),"Start"]}),a.jsxs("button",{onClick:()=>b.mutate(),disabled:b.isPending||P.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:[a.jsx(un,{className:"w-4 h-4"}),"Clear"]}),a.jsx("button",{onClick:()=>g(),disabled:v,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:a.jsx(wr,{className:`w-4 h-4 ${v?"animate-spin":""}`})}),a.jsx("div",{className:"flex-1"}),a.jsxs("label",{className:"flex items-center gap-2 text-sm text-bambu-gray cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:e,onChange:T=>n(T.target.checked),className:"rounded border-bambu-dark-tertiary bg-bambu-dark-tertiary"}),"Auto-scroll"]}),a.jsxs("span",{className:"text-sm text-bambu-gray",children:[y?.filtered_count??0,"/",y?.total_in_file??0]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx(Fr,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray"}),a.jsx("input",{type:"text",placeholder:"Search message or logger name...",value:s,onChange:T=>o(T.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"}),s&&a.jsx("button",{onClick:()=>o(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-bambu-gray hover:text-white",children:a.jsx(Ht,{className:"w-4 h-4"})})]}),a.jsxs("div",{className:"flex items-center gap-1 bg-bambu-dark-secondary rounded border border-bambu-dark-tertiary",children:[a.jsx("button",{onClick:()=>c("ALL"),className:`px-2 py-1.5 text-xs rounded-l transition-colors ${l==="ALL"?"bg-bambu-green text-white":"text-bambu-gray hover:text-white"}`,children:"All"}),iX.map((T,A)=>a.jsx("button",{onClick:()=>c(T),className:`px-2 py-1.5 text-xs transition-colors flex items-center gap-1 ${A===iX.length-1?"rounded-r":""} ${l===T?`${f3[T]} bg-bambu-dark-tertiary`:"text-bambu-gray hover:text-white"}`,children:T},T))]})]})]}),a.jsx("div",{ref:f,className:"overflow-auto font-mono text-xs bg-black min-h-[300px] max-h-[500px]",children:P.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center h-[300px] text-bambu-gray",children:[a.jsx("p",{className:"mb-2",children:"No log entries found"}),a.jsx("p",{className:"text-sm",children:"Log file may be empty or cleared"})]}):a.jsx("div",{className:"divide-y divide-bambu-dark-tertiary/30",children:k.map((T,A)=>{const C=r.has(A),F=T.message.includes(` `);return a.jsx("div",{className:`p-2 cursor-pointer hover:bg-bambu-dark-secondary/50 transition-colors ${C?"bg-bambu-dark-secondary/30":""}`,onClick:()=>F&&_(A),children:a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"text-bambu-gray/70 shrink-0 w-20",children:N(T.timestamp)}),a.jsx("span",{className:"shrink-0",children:a.jsx(M,{level:T.level})}),a.jsxs("span",{className:"text-purple-400/80 shrink-0 max-w-[200px] truncate",title:T.logger_name,children:["[",T.logger_name,"]"]}),a.jsx("span",{className:`flex-1 ${f3[T.level]||"text-white/80"} ${!C&&F?"truncate":""}`,children:C?a.jsx("pre",{className:"whitespace-pre-wrap break-all",children:T.message}):T.message.split(` -`)[0]}),F&&a.jsx("span",{className:"text-bambu-gray/50 shrink-0",children:C?a.jsx(nc,{className:"w-3.5 h-3.5"}):a.jsx(Fn,{className:"w-3.5 h-3.5"})})]})},A)})})}),a.jsx("div",{className:"flex items-center justify-between p-3 border-t border-bambu-dark-tertiary text-sm text-bambu-gray",children:m?a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"w-2 h-2 bg-green-500 rounded-full animate-pulse"}),"Auto-refreshing every 2 seconds"]}):a.jsx("span",{children:"Click Start to enable live log streaming"})})]})]})}function Knt(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:t<1024*1024*1024?`${(t/(1024*1024)).toFixed(1)} MB`:`${(t/(1024*1024*1024)).toFixed(2)} GB`}function wa({icon:t,label:e,value:n,subValue:r,color:i="text-bambu-green"}){return a.jsxs("div",{className:"flex items-start gap-3 p-4 bg-bambu-dark rounded-lg",children:[a.jsx("div",{className:`p-2 rounded-lg bg-bambu-dark-tertiary ${i}`,children:a.jsx(t,{className:"w-5 h-5"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm text-bambu-gray",children:e}),a.jsx("p",{className:"text-lg font-semibold text-white truncate",children:n}),r&&a.jsx("p",{className:"text-xs text-bambu-gray mt-0.5",children:r})]})]})}function sX({percent:t,color:e="bg-bambu-green"}){return a.jsx("div",{className:"w-full h-2 bg-bambu-dark rounded-full overflow-hidden",children:a.jsx("div",{className:`h-full ${e} transition-all duration-300`,style:{width:`${Math.min(100,t)}%`}})})}function sh({title:t,icon:e,children:n}){return a.jsxs(Dt,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(e,{className:"w-5 h-5 text-bambu-green"}),a.jsx("h2",{className:"text-lg font-semibold text-white",children:t})]}),n]})}function Ynt(){const{t}=Lt(),e=hn(),[n,r]=w.useState(null),[i,s]=w.useState(!1),[o,l]=w.useState(!1),{data:c,isLoading:d,refetch:u,isFetching:m}=Je({queryKey:["systemInfo"],queryFn:pe.getSystemInfo,refetchInterval:3e4}),{data:p}=Je({queryKey:["debugLogging"],queryFn:nx.getDebugLoggingState,staleTime:10*1e3,refetchInterval:10*1e3}),{data:f}=Je({queryKey:["settings"],queryFn:pe.getSettings}),{data:y}=Je({queryKey:["library-stats"],queryFn:pe.getLibraryStats}),v=f?.time_format||"system",g=async()=>{l(!0);try{const P=await nx.setDebugLogging(!p?.enabled);e.setQueryData(["debugLogging"],P)}catch(P){console.error("Failed to toggle debug logging:",P)}finally{l(!1)}},b=async()=>{r(null),s(!0);try{await nx.downloadSupportBundle()}catch(P){r(P instanceof Error?P.message:"Failed to download support bundle")}finally{s(!1)}};if(d)return a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx(dt,{className:"w-8 h-8 text-bambu-green animate-spin"})});if(!c)return a.jsx("div",{className:"p-6 text-center text-bambu-gray",children:t("system.failedToLoad","Failed to load system information")});const _=c.storage.disk_percent_used>90?"bg-red-500":c.storage.disk_percent_used>75?"bg-yellow-500":"bg-bambu-green",N=c.memory.percent_used>90?"bg-red-500":c.memory.percent_used>75?"bg-yellow-500":"bg-bambu-green";return a.jsxs("div",{className:"p-6 space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold text-white",children:t("system.title","System Information")}),a.jsx("p",{className:"text-bambu-gray mt-1",children:t("system.subtitle","Monitor system resources and database statistics")})]}),a.jsxs("button",{onClick:()=>u(),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:[a.jsx(wr,{className:`w-4 h-4 ${m?"animate-spin":""}`}),t("common.refresh","Refresh")]})]}),a.jsx(sh,{title:t("system.application","Application"),icon:Kp,children:a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[a.jsx(wa,{icon:Kp,label:t("system.version","Version"),value:`v${c.app.version}`}),a.jsx(wa,{icon:rr,label:t("system.uptime","System Uptime"),value:c.system.uptime_formatted}),a.jsx(wa,{icon:Kp,label:t("system.hostname","Hostname"),value:c.system.hostname})]})}),a.jsx(sh,{title:t("support.title","Support & Troubleshooting"),icon:rge,children:a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-bambu-gray",children:t("support.description","Enable debug logging to capture detailed information, then download a support bundle to share when reporting issues.")}),a.jsxs("div",{className:"flex items-center justify-between p-4 bg-bambu-dark rounded-lg",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${p?.enabled?"bg-amber-500/20 text-amber-500":"bg-bambu-dark-tertiary text-bambu-gray"}`,children:a.jsx(xx,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium text-white",children:t("support.debugLogging","Debug Logging")}),a.jsxs("p",{className:"text-sm text-bambu-gray",children:[p?.enabled?t("support.debugLoggingEnabled","Capturing detailed logs"):t("support.debugLoggingDisabled","Normal logging level"),p?.enabled&&p.duration_seconds!==null&&a.jsxs("span",{className:"text-amber-400 ml-2",children:["(",Math.floor(p.duration_seconds/60),"m ",p.duration_seconds%60,"s)"]})]})]})]}),a.jsxs("button",{onClick:g,disabled:o,className:`px-4 py-2 rounded-lg font-medium transition-colors flex items-center gap-2 ${p?.enabled?"bg-amber-500/20 text-amber-400 hover:bg-amber-500/30":"bg-bambu-green/20 text-bambu-green hover:bg-bambu-green/30"} disabled:opacity-50`,children:[o&&a.jsx(dt,{className:"w-4 h-4 animate-spin"}),p?.enabled?t("support.disableDebug","Disable"):t("support.enableDebug","Enable")]})]}),a.jsxs("div",{className:"flex items-center justify-between p-4 bg-bambu-dark rounded-lg",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 rounded-lg bg-bambu-dark-tertiary text-bambu-green",children:a.jsx(Na,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium text-white",children:t("support.supportBundle","Support Bundle")}),a.jsx("p",{className:"text-sm text-bambu-gray",children:t("support.supportBundleDescription","Download system info and logs as a ZIP file")})]})]}),a.jsxs("button",{onClick:b,disabled:i||!p?.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:p?.enabled?void 0:t("support.enableDebugFirst","Enable debug logging first"),children:[i&&a.jsx(dt,{className:"w-4 h-4 animate-spin"}),t("common.download","Download")]})]}),n&&a.jsx("div",{className:"p-3 bg-red-500/20 border border-red-500/30 rounded-lg text-red-400 text-sm",children:n}),!p?.enabled&&a.jsx("div",{className:"p-4 bg-bambu-dark-tertiary/50 rounded-lg",children:a.jsxs("p",{className:"text-sm text-bambu-gray",children:[a.jsx("span",{className:"text-amber-400 font-medium",children:t("support.instructions","To report an issue:")}),a.jsx("br",{}),"1. ",t("support.step1","Enable debug logging"),a.jsx("br",{}),"2. ",t("support.step2","Reproduce the issue"),a.jsx("br",{}),"3. ",t("support.step3","Download the support bundle"),a.jsx("br",{}),"4. ",t("support.step4","Attach the ZIP file to your issue report")]})}),a.jsxs("div",{className:"p-4 bg-bambu-dark rounded-lg space-y-3",children:[a.jsx("p",{className:"text-sm font-medium text-white",children:t("support.privacyTitle","What's in the support bundle?")}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 text-sm",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-bambu-green font-medium mb-1",children:t("support.collected","Collected:")}),a.jsxs("ul",{className:"text-bambu-gray space-y-0.5",children:[a.jsxs("li",{children:["• ",t("support.collectItem1","App version and debug mode")]}),a.jsxs("li",{children:["• ",t("support.collectItem2","OS, architecture, Python version")]}),a.jsxs("li",{children:["• ",t("support.collectItem3","Database statistics (counts only)")]}),a.jsxs("li",{children:["• ",t("support.collectItem4","Printer models and nozzle counts")]}),a.jsxs("li",{children:["• ",t("support.collectItem5","Non-sensitive settings (themes, formats)")]}),a.jsxs("li",{children:["• ",t("support.collectItem6","Debug logs (sanitized)")]}),a.jsxs("li",{children:["• ",t("support.collectItem7","Printer connectivity and firmware versions")]}),a.jsxs("li",{children:["• ",t("support.collectItem8","Integration status (Spoolman, MQTT, HA)")]}),a.jsxs("li",{children:["• ",t("support.collectItem9","Network interfaces (subnets only)")]}),a.jsxs("li",{children:["• ",t("support.collectItem10","Python package versions")]}),a.jsxs("li",{children:["• ",t("support.collectItem11","Database health checks")]}),a.jsxs("li",{children:["• ",t("support.collectItem12","Docker environment details")]})]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-red-400 font-medium mb-1",children:t("support.notCollected","NOT collected:")}),a.jsxs("ul",{className:"text-bambu-gray space-y-0.5",children:[a.jsxs("li",{children:["• ",t("support.notItem1","Printer names and serial numbers")]}),a.jsxs("li",{children:["• ",t("support.notItem2","Access codes and passwords")]}),a.jsxs("li",{children:["• ",t("support.notItem3","Email addresses")]}),a.jsxs("li",{children:["• ",t("support.notItem4","API keys and tokens")]}),a.jsxs("li",{children:["• ",t("support.notItem5","Webhook URLs")]}),a.jsxs("li",{children:["• ",t("support.notItem6","Your hostname or username")]}),a.jsxs("li",{children:["• ",t("support.notItem7","IP addresses")]})]})]})]}),a.jsx("p",{className:"text-xs text-bambu-gray/70",children:t("support.privacyNote","Email addresses in logs are replaced with [EMAIL], printer names with [PRINTER], serial numbers with [SERIAL], and IP addresses with [IP].")})]}),a.jsx(Wnt,{})]})}),a.jsxs(sh,{title:t("system.database","Database"),icon:Wl,children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[a.jsx(wa,{icon:Wl,label:t("system.dbEngine","Database Engine"),value:c.database.engine||"SQLite"}),a.jsx(wa,{icon:Wl,label:t("system.dbVersion","Version"),value:c.database.version||"unknown"})]}),a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-4",children:[a.jsx(wa,{icon:ro,label:t("system.totalArchives","Total Archives"),value:c.database.archives}),a.jsx(wa,{icon:Ec,label:t("system.completed","Completed"),value:c.database.archives_completed,color:"text-green-500"}),a.jsx(wa,{icon:Xa,label:t("system.failed","Failed"),value:c.database.archives_failed,color:"text-red-500"}),a.jsx(wa,{icon:dt,label:t("system.printing","Printing"),value:c.database.archives_printing,color:"text-yellow-500"})]}),a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[a.jsx(wa,{icon:Tr,label:t("system.printers","Printers"),value:c.database.printers}),a.jsx(wa,{icon:jw,label:t("system.filaments","Filaments"),value:c.database.filaments}),a.jsx(wa,{icon:Os,label:t("system.projects","Projects"),value:c.database.projects}),a.jsx(wa,{icon:Xl,label:t("system.smartPlugs","Smart Plugs"),value:c.database.smart_plugs})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mt-4",children:[a.jsx(wa,{icon:rr,label:t("system.totalPrintTime","Total Print Time"),value:c.database.total_print_time_formatted}),a.jsx(wa,{icon:ro,label:t("system.totalFilament","Total Filament Used"),value:`${c.database.total_filament_kg} kg`,subValue:`${c.database.total_filament_grams.toLocaleString()} g`})]})]}),a.jsxs(sh,{title:t("system.connectedPrinters","Connected Printers"),icon:Tr,children:[a.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[a.jsx("div",{className:"text-3xl font-bold text-bambu-green",children:c.printers.connected}),a.jsx("div",{className:"text-bambu-gray",children:t("system.ofTotal","of {{total}} printers connected",{total:c.printers.total})})]}),c.printers.connected_list.length>0?a.jsx("div",{className:"space-y-2",children:c.printers.connected_list.map(P=>a.jsxs("div",{className:"flex items-center justify-between p-3 bg-bambu-dark rounded-lg",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-2 h-2 rounded-full bg-bambu-green"}),a.jsx("span",{className:"font-medium text-white",children:P.name})]}),a.jsxs("div",{className:"flex items-center gap-4 text-sm text-bambu-gray",children:[a.jsx("span",{children:P.model}),a.jsx("span",{className:`px-2 py-0.5 rounded ${P.state==="RUNNING"?"bg-bambu-green/20 text-bambu-green":P.state==="IDLE"?"bg-blue-500/20 text-blue-400":"bg-bambu-dark-tertiary"}`,children:P.state})]})]},P.id))}):a.jsx("p",{className:"text-bambu-gray",children:t("system.noPrintersConnected","No printers connected")})]}),a.jsx(sh,{title:t("system.storage","Storage"),icon:ty,children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{className:"text-bambu-gray",children:t("system.diskUsage","Disk Usage")}),a.jsxs("span",{className:"text-white",children:[c.storage.disk_used_formatted," / ",c.storage.disk_total_formatted]})]}),a.jsx(sX,{percent:c.storage.disk_percent_used,color:_}),a.jsxs("p",{className:"text-xs text-bambu-gray mt-1",children:[c.storage.disk_free_formatted," ",t("system.free","free")," (",(100-c.storage.disk_percent_used).toFixed(1),"%)"]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[a.jsx(wa,{icon:ro,label:t("system.archiveStorage","Archive Storage"),value:c.storage.archive_size_formatted}),a.jsx(wa,{icon:Wl,label:t("system.databaseSize","Database Size"),value:c.storage.database_size_formatted}),y&&a.jsx(wa,{icon:Uc,label:t("system.fileManagerStorage","File Manager"),value:Knt(y.total_size_bytes),subValue:`${y.total_files} files, ${y.total_folders} folders`})]})]})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx(sh,{title:t("system.memory","Memory"),icon:Rge,children:a.jsx("div",{className:"space-y-4",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{className:"text-bambu-gray",children:t("system.memoryUsage","Memory Usage")}),a.jsxs("span",{className:"text-white",children:[c.memory.used_formatted," / ",c.memory.total_formatted]})]}),a.jsx(sX,{percent:c.memory.percent_used,color:N}),a.jsxs("p",{className:"text-xs text-bambu-gray mt-1",children:[c.memory.available_formatted," ",t("system.available","available")]})]})})}),a.jsx(sh,{title:t("system.cpu","CPU"),icon:__,children:a.jsx("div",{className:"space-y-4",children:a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(wa,{icon:__,label:t("system.cores","Cores"),value:c.cpu.count,subValue:`${c.cpu.count_logical} logical`}),a.jsx(wa,{icon:__,label:t("system.usage","Usage"),value:`${c.cpu.percent}%`})]})})})]}),a.jsx(sh,{title:t("system.systemDetails","System Details"),icon:Kp,children:a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[a.jsx(wa,{icon:Kp,label:t("system.os","Operating System"),value:c.system.platform,subValue:c.system.platform_release}),a.jsx(wa,{icon:__,label:t("system.architecture","Architecture"),value:c.system.architecture}),a.jsx(wa,{icon:Kp,label:t("system.python","Python"),value:c.system.python_version}),a.jsx(wa,{icon:rr,label:t("system.bootTime","Boot Time"),value:$f(c.system.boot_time,v)})]})})]})}function Xnt(){const t=zo(),{t:e}=Lt(),{login:n}=Ar(),{showToast:r}=xn(),{mode:i}=mg(),[s,o]=w.useState(""),[l,c]=w.useState(""),[d,u]=w.useState(!1),[m,p]=w.useState(""),{data:f}=Je({queryKey:["advancedAuthStatus"],queryFn:()=>pe.getAdvancedAuthStatus()}),y=ct({mutationFn:()=>n(s,l),onSuccess:()=>{r(e("login.loginSuccess")),t("/")},onError:_=>{r(_.message||e("login.loginFailed"),"error")}}),v=ct({mutationFn:_=>pe.forgotPassword({email:_}),onSuccess:_=>{r(_.message,"success"),u(!1),p("")},onError:_=>{r(_.message,"error")}}),g=_=>{if(_.preventDefault(),!s||!l){r(e("login.enterCredentials"),"error");return}y.mutate()},b=_=>{if(_.preventDefault(),!m){r("Please enter your email address","error");return}v.mutate(m)};return a.jsxs("div",{className:"min-h-screen flex items-center justify-center bg-bambu-dark p-4",children:[a.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:[a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"flex items-center justify-center mb-6",children:a.jsx("img",{src:i==="dark"?"/img/bambuddy_logo_dark_transparent.png":"/img/bambuddy_logo_light.png",alt:"Bambuddy",className:"h-16"})}),a.jsx("h2",{className:"text-3xl font-bold text-white",children:e("login.title")}),a.jsx("p",{className:"mt-2 text-sm text-bambu-gray",children:e("login.subtitle")})]}),a.jsxs("form",{className:"mt-8 space-y-6",onSubmit:g,children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-white mb-2",children:f?.advanced_auth_enabled?e("login.usernameOrEmail")||"Username or Email":e("login.username")}),a.jsx("input",{id:"username",type:"text",required:!0,value:s,onChange:_=>o(_.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:f?.advanced_auth_enabled?e("login.usernameOrEmailPlaceholder")||"Enter your username or email":e("login.usernamePlaceholder"),autoComplete:"username"})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-white mb-2",children:e("login.password")}),a.jsx("input",{id:"password",type:"password",required:!0,value:l,onChange:_=>c(_.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:e("login.passwordPlaceholder"),autoComplete:"current-password"})]})]}),a.jsx("div",{children:a.jsx("button",{type:"submit",disabled:y.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:y.isPending?e("login.signingIn"):e("login.signIn")})}),f?.advanced_auth_enabled&&a.jsx("div",{className:"text-center",children:a.jsx("button",{type:"button",onClick:()=>u(!0),className:"text-sm text-bambu-gray hover:text-bambu-green transition-colors",children:e("login.forgotPassword")})})]})]}),d&&a.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",onClick:()=>u(!1),children:a.jsxs(Dt,{className:"w-full max-w-md",onClick:_=>_.stopPropagation(),children:[a.jsx(Dn,{children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(vx,{className:"w-5 h-5 text-bambu-green"}),a.jsx("h2",{className:"text-lg font-semibold text-white",children:e("login.forgotPasswordTitle")})]}),a.jsx(Ie,{variant:"ghost",size:"sm",onClick:()=>{u(!1),p("")},children:a.jsx(Ht,{className:"w-5 h-5"})})]})}),a.jsx(Rt,{children:f?.advanced_auth_enabled?a.jsxs("form",{onSubmit:b,className:"space-y-4",children:[a.jsx("p",{className:"text-bambu-gray text-sm",children:e("login.forgotPasswordEmailMessage")||"Enter your email address and we'll send you a new password."}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"forgot-email",className:"block text-sm font-medium text-white mb-2",children:e("login.emailAddress")||"Email Address"}),a.jsx("input",{id:"forgot-email",type:"email",required:!0,value:m,onChange:_=>p(_.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:e("login.emailPlaceholder")||"your.email@example.com"})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Ie,{type:"button",variant:"secondary",className:"flex-1",onClick:()=>{u(!1),p("")},children:e("login.cancel")||"Cancel"}),a.jsx(Ie,{type:"submit",className:"flex-1",disabled:v.isPending,children:v.isPending?e("login.sending")||"Sending...":e("login.sendResetEmail")||"Send Reset Email"})]})]}):a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-bambu-gray",children:e("login.forgotPasswordMessage")}),a.jsxs("div",{className:"bg-bambu-dark rounded-lg p-4 space-y-2",children:[a.jsx("p",{className:"text-sm text-white font-medium",children:e("login.howToReset")}),a.jsxs("ol",{className:"text-sm text-bambu-gray space-y-1 list-decimal list-inside",children:[a.jsx("li",{children:e("login.resetStep1")}),a.jsx("li",{children:e("login.resetStep2")}),a.jsx("li",{children:e("login.resetStep3")}),a.jsx("li",{children:e("login.resetStep4")})]})]}),a.jsx(Ie,{variant:"secondary",className:"w-full",onClick:()=>u(!1),children:e("login.gotIt")})]})})]})})]})}function Qnt(){const t=zo(),{t:e}=Lt(),{showToast:n}=xn(),{mode:r}=mg(),{refreshAuth:i}=Ar(),[s,o]=w.useState(!1),[l,c]=w.useState(""),[d,u]=w.useState(""),[m,p]=w.useState(""),f=ct({mutationFn:()=>pe.setupAuth({auth_enabled:s,admin_username:s?l:void 0,admin_password:s?d:void 0}),onSuccess:async v=>{await i(),v.auth_enabled?v.admin_created?(n(e("setup.toast.authEnabledAdminCreated")),t("/login")):(n(e("setup.toast.authEnabledExistingAdmins")),t("/login")):(n(e("setup.toast.setupCompleted")),t("/"))},onError:v=>{n(v.message,"error")}}),y=v=>{if(v.preventDefault(),s&&(l||d)){if(!l||!d){n(e("setup.toast.enterBothCredentials"),"error");return}if(d!==m){n(e("setup.toast.passwordsDoNotMatch"),"error");return}if(d.length<6){n(e("setup.toast.passwordTooShort"),"error");return}}f.mutate()};return a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-bambu-dark p-4",children:a.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:[a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"flex items-center justify-center mb-6",children:a.jsx("img",{src:r==="dark"?"/img/bambuddy_logo_dark_transparent.png":"/img/bambuddy_logo_light.png",alt:"Bambuddy",className:"h-16"})}),a.jsx("h2",{className:"text-3xl font-bold text-white",children:e("setup.title")}),a.jsx("p",{className:"mt-2 text-sm text-bambu-gray",children:e("setup.subtitle")})]}),a.jsxs("form",{className:"mt-8 space-y-6",onSubmit:y,children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center p-4 bg-bambu-dark-secondary/50 rounded-lg border border-bambu-dark-tertiary",children:[a.jsx("input",{id:"auth-enabled",type:"checkbox",checked:s,onChange:v=>o(v.target.checked),className:"h-4 w-4 text-bambu-green focus:ring-bambu-green border-bambu-dark-tertiary rounded bg-bambu-dark-secondary"}),a.jsx("label",{htmlFor:"auth-enabled",className:"ml-3 block text-sm font-medium text-white",children:e("setup.enableAuth")})]}),s&&a.jsxs("div",{className:"space-y-4 mt-4",children:[a.jsx("div",{className:"p-3 bg-bambu-dark-secondary/50 border border-bambu-dark-tertiary rounded-lg",children:a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(eo,{className:"w-4 h-4 text-bambu-green mt-0.5 flex-shrink-0"}),a.jsxs("div",{className:"text-sm text-bambu-gray",children:[a.jsx("p",{className:"text-white font-medium mb-1",children:e("setup.adminAccount")}),a.jsx("p",{children:e("setup.adminAccountDesc")})]})]})}),a.jsxs("div",{children:[a.jsxs("label",{htmlFor:"admin-username",className:"block text-sm font-medium text-white mb-2",children:[e("setup.adminUsername")," ",a.jsx("span",{className:"text-bambu-gray text-xs",children:e("setup.optionalIfAdminExists")})]}),a.jsx("input",{id:"admin-username",type:"text",value:l,onChange:v=>c(v.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:e("setup.adminUsernamePlaceholder"),autoComplete:"username"})]}),a.jsxs("div",{children:[a.jsxs("label",{htmlFor:"admin-password",className:"block text-sm font-medium text-white mb-2",children:[e("setup.adminPassword")," ",a.jsx("span",{className:"text-bambu-gray text-xs",children:e("setup.optionalIfAdminExists")})]}),a.jsx("input",{id:"admin-password",type:"password",value:d,onChange:v=>u(v.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:e("setup.adminPasswordPlaceholder"),minLength:6,autoComplete:"new-password"})]}),d&&a.jsxs("div",{children:[a.jsx("label",{htmlFor:"confirm-password",className:"block text-sm font-medium text-white mb-2",children:e("setup.confirmPassword")}),a.jsx("input",{id:"confirm-password",type:"password",value:m,onChange:v=>p(v.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:e("setup.confirmPasswordPlaceholder"),minLength:6,autoComplete:"new-password"})]})]})]}),a.jsx("div",{children:a.jsx("button",{type:"submit",disabled:f.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:f.isPending?e("setup.settingUp"):e("setup.completeSetup")})})]})]})})}function Znt(){const{t}=Lt(),{user:e}=Ar(),{showToast:n}=xn(),r=hn(),i=zo(),[s,o]=w.useState(!0),[l,c]=w.useState(!0),[d,u]=w.useState(!0),[m,p]=w.useState(!0),[f,y]=w.useState(!1),{data:v,isLoading:g}=Je({queryKey:["advancedAuthStatus"],queryFn:pe.getAdvancedAuthStatus,staleTime:300*1e3}),{data:b,isLoading:_}=Je({queryKey:["settings"],queryFn:pe.getSettings,staleTime:300*1e3}),{data:N,isLoading:P}=Je({queryKey:["user-email-preferences"],queryFn:()=>pe.getUserEmailPreferences()});w.useEffect(()=>{(v&&!v.advanced_auth_enabled||b&&!b.user_notifications_enabled)&&i("/settings",{replace:!0})},[v,b,i]),w.useEffect(()=>{N&&(o(N.notify_print_start),c(N.notify_print_complete),u(N.notify_print_failed),p(N.notify_print_stopped),y(!1))},[N]);const k=ct({mutationFn:()=>pe.updateUserEmailPreferences({notify_print_start:s,notify_print_complete:l,notify_print_failed:d,notify_print_stopped:m}),onSuccess:()=>{r.invalidateQueries({queryKey:["user-email-preferences"]}),y(!1),n(t("notifications.userEmail.saveSuccess"),"success")},onError:T=>{n(T.message||t("notifications.userEmail.saveError"),"error")}}),M=(T,A)=>{T(!A),y(!0)};return P||g||_?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx(dt,{className:"w-8 h-8 animate-spin text-bambu-green"})}):a.jsxs("div",{className:"p-4 md:p-6 max-w-2xl mx-auto",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[a.jsx(Rh,{className:"w-7 h-7 text-bambu-green"}),a.jsx("h1",{className:"text-2xl font-bold text-white",children:t("notifications.userEmail.title")})]}),a.jsx(Dt,{className:"mb-6 border-blue-500/30 bg-blue-500/5",children:a.jsx(Rt,{className:"py-4",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center bg-blue-500/20 flex-shrink-0",children:a.jsx(vx,{className:"w-5 h-5 text-blue-400"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-white font-medium",children:t("notifications.userEmail.emailNotifications")}),a.jsx("p",{className:"text-sm text-bambu-gray mt-1",children:t("notifications.userEmail.emailNotificationsDesc")}),e?.email?a.jsxs("p",{className:"text-sm text-blue-400 mt-2",children:[t("notifications.userEmail.sendingTo"),": ",a.jsx("strong",{children:e.email})]}):a.jsx("p",{className:"text-sm text-yellow-400 mt-2",children:t("notifications.userEmail.noEmailWarning")})]})]})})}),a.jsxs(Dt,{className:"mb-6",children:[a.jsxs(Dn,{children:[a.jsx("h2",{className:"text-lg font-semibold text-white",children:t("notifications.userEmail.printJobNotifications")}),a.jsx("p",{className:"text-sm text-bambu-gray mt-1",children:t("notifications.userEmail.printJobNotificationsDesc")})]}),a.jsxs(Rt,{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between p-4 bg-bambu-dark rounded-lg",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`w-10 h-10 rounded-full flex items-center justify-center ${s?"bg-bambu-green/20":"bg-bambu-dark-tertiary"}`,children:a.jsx(Ec,{className:`w-5 h-5 ${s?"text-bambu-green":"text-bambu-gray"}`})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-white font-medium",children:t("notifications.userEmail.printJobStarts")}),a.jsx("p",{className:"text-sm text-bambu-gray",children:t("notifications.userEmail.printJobStartsDesc")})]})]}),a.jsx("button",{onClick:()=>M(o,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:a.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${s?"translate-x-6":"translate-x-1"}`})})]}),a.jsxs("div",{className:"flex items-center justify-between p-4 bg-bambu-dark rounded-lg",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`w-10 h-10 rounded-full flex items-center justify-center ${l?"bg-bambu-green/20":"bg-bambu-dark-tertiary"}`,children:a.jsx(Ec,{className:`w-5 h-5 ${l?"text-bambu-green":"text-bambu-gray"}`})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-white font-medium",children:t("notifications.userEmail.printJobFinishes")}),a.jsx("p",{className:"text-sm text-bambu-gray",children:t("notifications.userEmail.printJobFinishesDesc")})]})]}),a.jsx("button",{onClick:()=>M(c,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:a.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${l?"translate-x-6":"translate-x-1"}`})})]}),a.jsxs("div",{className:"flex items-center justify-between p-4 bg-bambu-dark rounded-lg",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`w-10 h-10 rounded-full flex items-center justify-center ${d?"bg-bambu-green/20":"bg-bambu-dark-tertiary"}`,children:a.jsx(Ec,{className:`w-5 h-5 ${d?"text-bambu-green":"text-bambu-gray"}`})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-white font-medium",children:t("notifications.userEmail.printErrors")}),a.jsx("p",{className:"text-sm text-bambu-gray",children:t("notifications.userEmail.printErrorsDesc")})]})]}),a.jsx("button",{onClick:()=>M(u,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:a.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${d?"translate-x-6":"translate-x-1"}`})})]}),a.jsxs("div",{className:"flex items-center justify-between p-4 bg-bambu-dark rounded-lg",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`w-10 h-10 rounded-full flex items-center justify-center ${m?"bg-bambu-green/20":"bg-bambu-dark-tertiary"}`,children:a.jsx(Ec,{className:`w-5 h-5 ${m?"text-bambu-green":"text-bambu-gray"}`})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-white font-medium",children:t("notifications.userEmail.printJobStops")}),a.jsx("p",{className:"text-sm text-bambu-gray",children:t("notifications.userEmail.printJobStopsDesc")})]})]}),a.jsx("button",{onClick:()=>M(p,m),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 ${m?"bg-bambu-green":"bg-bambu-dark-tertiary"}`,role:"switch","aria-checked":m,children:a.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${m?"translate-x-6":"translate-x-1"}`})})]})]})]}),a.jsx("div",{className:"flex justify-end",children:a.jsx(Ie,{onClick:()=>k.mutate(),disabled:!f||k.isPending||!e?.email,children:k.isPending?a.jsxs(a.Fragment,{children:[a.jsx(dt,{className:"w-4 h-4 animate-spin"}),t("common.saving")]}):a.jsxs(a.Fragment,{children:[a.jsx(fs,{className:"w-4 h-4"}),t("common.save")]})})})]})}function Jnt(){const t=w.useRef(null),e=w.useRef(null),n=hn(),[r,i]=w.useState(!1),s=w.useRef(new Map),{showToast:o}=xn(),{t:l}=Lt(),c=w.useRef(new Set),d=w.useRef(null),u=w.useRef(new Map),m=w.useRef(null),p=w.useRef([]),f=w.useRef(!1),y=w.useRef(()=>{}),v=w.useCallback(()=>{if(f.current||p.current.length===0)return;f.current=!0;const k=()=>{const M=p.current.shift();M?requestAnimationFrame(()=>{y.current(M),p.current.length>0?setTimeout(k,16):f.current=!1}):f.current=!1};k()},[]),g=w.useCallback(()=>{if(t.current?.readyState===WebSocket.OPEN)return;const M=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/v1/ws`,T=new WebSocket(M);let A=null;T.onopen=()=>{console.log("[WebSocket] Connected"),i(!0),A=window.setInterval(()=>{T.readyState===WebSocket.OPEN&&T.send(JSON.stringify({type:"ping"}))},3e4)},T.onmessage=C=>{try{const F=JSON.parse(C.data);F.type==="printer_status"&&F.printer_id!==void 0&&F.data?y.current(F):(p.current.push(F),v())}catch{}},T.onclose=C=>{console.log("[WebSocket] Closed",C.code,C.reason),A&&(clearInterval(A),A=null),i(!1),t.current=null,e.current=window.setTimeout(()=>{g()},3e3)},T.onerror=C=>{console.error("[WebSocket] Error",C),T.close()},t.current=T},[v]),b=w.useCallback((k,M)=>{const T=u.current.get(k)||{};u.current.set(k,{...T,...M}),m.current||(m.current=window.setTimeout(()=>{const A=new Map(u.current);u.current.clear(),m.current=null,requestAnimationFrame(()=>{A.forEach((C,F)=>{n.setQueryData(["printerStatus",F],$=>{const I={...$,...C};return I.wifi_signal==null&&$?.wifi_signal!=null&&(I.wifi_signal=$.wifi_signal),I})})})},100))},[n]),_=w.useCallback(k=>{c.current.add(k),d.current&&clearTimeout(d.current),d.current=window.setTimeout(()=>{const M=Array.from(c.current);c.current.clear(),d.current=null;let T=0;M.forEach(A=>{setTimeout(()=>{requestAnimationFrame(()=>{n.invalidateQueries({queryKey:[A]})})},T),T+=500})},3e3)},[n]),N=w.useCallback(k=>{switch(k.type){case"printer_status":k.printer_id!==void 0&&k.data&&b(k.printer_id,k.data);break;case"print_start":k.printer_id!==void 0&&n.invalidateQueries({queryKey:["printerStatus",k.printer_id]});break;case"missing_spool_assignment":{if(k.printer_id===void 0||!Array.isArray(k.missing_slots))break;const M=k.missing_slots.map(F=>F&&typeof F.slot=="string"?F.slot:"Unknown").filter(F=>F.length>0);if(M.length===0){s.current.delete(k.printer_id);break}const T=M.join("|");if(s.current.get(k.printer_id)===T)break;s.current.set(k.printer_id,T);const A=k.printer_name||`Printer ${k.printer_id}`,C=l("printers.toast.missingSpoolAssignment",{printer:A,slots:M.join(", ")});o(C,"warning");break}case"print_complete":_("archives"),_("archiveStats");break;case"archive_created":_("archives"),_("archiveStats");break;case"archive_updated":_("archives");break;case"pong":break;case"plate_not_empty":window.dispatchEvent(new CustomEvent("plate-not-empty",{detail:{printer_id:k.printer_id,printer_name:k.printer_name,message:k.message}}));break;case"spool_assignment_changed":_("spool-assignments"),_("slotPresets");break;case"spool_auto_assigned":_("inventory-spools"),_("spool-assignments");break;case"spool_usage_logged":_("inventory-spools");break;case"unknown_tag":window.dispatchEvent(new CustomEvent("unknown-tag",{detail:{printer_id:k.printer_id,ams_id:k.ams_id,tray_id:k.tray_id,tag_uid:k.tag_uid,tray_uuid:k.tray_uuid}}));break;case"background_dispatch":window.dispatchEvent(new CustomEvent("background-dispatch",{detail:k.data||{}}));break;case"spoolbuddy_weight":window.dispatchEvent(new CustomEvent("spoolbuddy-weight",{detail:k}));break;case"spoolbuddy_tag_matched":window.dispatchEvent(new CustomEvent("spoolbuddy-tag-matched",{detail:k})),_("inventory-spools");break;case"spoolbuddy_unknown_tag":window.dispatchEvent(new CustomEvent("spoolbuddy-unknown-tag",{detail:k}));break;case"spoolbuddy_tag_removed":window.dispatchEvent(new CustomEvent("spoolbuddy-tag-removed",{detail:k}));break;case"spoolbuddy_tag_written":window.dispatchEvent(new CustomEvent("spoolbuddy-tag-written",{detail:k})),_("inventory-spools");break;case"spoolbuddy_tag_write_failed":window.dispatchEvent(new CustomEvent("spoolbuddy-tag-write-failed",{detail:k}));break;case"spoolbuddy_online":window.dispatchEvent(new CustomEvent("spoolbuddy-online",{detail:k})),_("spoolbuddy-devices"),_("spoolbuddy-update-check");break;case"spoolbuddy_offline":window.dispatchEvent(new CustomEvent("spoolbuddy-offline",{detail:k})),_("spoolbuddy-devices");break;case"spoolbuddy_update":_("spoolbuddy-devices"),_("spoolbuddy-update-check");break}},[n,_,b,o,l]);w.useEffect(()=>{y.current=N},[N]),w.useEffect(()=>(g(),()=>{e.current&&clearTimeout(e.current),d.current&&clearTimeout(d.current),m.current&&clearTimeout(m.current),t.current&&t.current.close()}),[g]);const P=w.useCallback(k=>{t.current?.readyState===WebSocket.OPEN&&t.current.send(JSON.stringify(k))},[]);return{isConnected:r,sendMessage:P}}function ert(){const{authEnabled:t}=Ar(),e=hn(),n=w.useRef(!1),{data:r}=Je({queryKey:["camera-stream-token"],queryFn:()=>pe.getCameraStreamToken(),enabled:t,staleTime:3e3*1e3,refetchInterval:3e3*1e3});w.useEffect(()=>(u6(r?.token??null),()=>u6(null)),[r?.token]),w.useEffect(()=>{if(!t)return;const i=s=>{const o=s.target;if(!(o instanceof HTMLImageElement||o instanceof HTMLVideoElement))return;const l=o.src||"",c=Txe();!c||!l.includes(`token=${encodeURIComponent(c)}`)||n.current||(n.current=!0,e.invalidateQueries({queryKey:["camera-stream-token"]}),setTimeout(()=>{n.current=!1},5e3))};return document.addEventListener("error",i,!0),()=>document.removeEventListener("error",i,!0)},[t,e])}function trt({selectedPrinterId:t,onPrinterChange:e,deviceOnline:n}){const{t:r}=Lt(),[i,s]=w.useState(new Date),{data:o=[]}=Je({queryKey:["printers"],queryFn:()=>pe.getPrinters()}),l=op({queries:o.map(u=>({queryKey:["printerStatus",u.id],queryFn:()=>pe.getPrinterStatus(u.id),refetchInterval:1e4}))}),c=w.useMemo(()=>o.filter((u,m)=>l[m]?.data?.connected),[o,l]);w.useEffect(()=>{const u=c.some(m=>m.id===t);(!t||!u)&&c.length>0&&e(c[0].id)},[c,t,e]);const{data:d}=Je({queryKey:["settings"],queryFn:pe.getSettings});return w.useEffect(()=>{const u=setInterval(()=>s(new Date),1e3);return()=>clearInterval(u)},[]),a.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:[a.jsx("div",{className:"flex items-center shrink-0",children:a.jsx("img",{src:"/img/spoolbuddy_logo_dark_small.png",alt:"SpoolBuddy",width:113,height:28,className:"h-7 w-auto"})}),a.jsx("div",{className:"flex-1 flex justify-center",children:a.jsx("select",{value:t??"",onChange:u=>e(Number(u.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?a.jsx("option",{value:"",children:r("spoolbuddy.status.noPrinters","No printers online")}):c.map(u=>a.jsx("option",{value:u.id,children:u.name},u.id))})}),a.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[a.jsx("div",{className:"flex items-center",title:n?r("spoolbuddy.status.backend","Backend"):r("spoolbuddy.status.offline","Offline"),children:n?a.jsx("div",{className:"flex items-end gap-0.5 h-4",children:[1,2,3,4].map(u=>a.jsx("div",{className:`w-1 rounded-sm ${u<=4?"bg-white":"bg-bambu-dark-tertiary"}`,style:{height:`${u*4}px`}},u))}):a.jsx(nm,{className:"w-5 h-5 text-red-400"})}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.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"}`}),a.jsx("span",{className:"text-sm text-white/50",children:n?r("spoolbuddy.status.backend","Backend"):r("spoolbuddy.status.offline","Offline")})]}),a.jsx("span",{className:"text-white/50 text-base font-mono min-w-[50px] text-right",children:AQ(i,d?.time_format||"system")})]})]})}const nrt=[{to:"/spoolbuddy",labelKey:"spoolbuddy.nav.dashboard",fallback:"Dashboard",icon:a.jsx("svg",{className:"w-6 h-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:a.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:a.jsx("svg",{className:"w-6 h-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:a.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:a.jsxs("svg",{className:"w-6 h-6",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[a.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"}),a.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:a.jsx("svg",{className:"w-6 h-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:a.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:a.jsxs("svg",{className:"w-6 h-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[a.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"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}];function rrt(){const{t}=Lt();return a.jsx("nav",{className:"h-14 bg-bambu-dark-secondary border-t border-bambu-dark-tertiary flex items-stretch shrink-0",children:nrt.map(e=>a.jsxs(Wb,{to:e.to,end:e.to==="/spoolbuddy",className:({isActive:n})=>`flex-1 flex flex-col items-center justify-center gap-1 transition-colors ${n?"text-bambu-green bg-bambu-dark":"text-white/50 hover:text-white/70 hover:bg-bambu-dark-tertiary"}`,children:[e.icon,a.jsx("span",{className:"text-xs font-medium",children:t(e.labelKey,e.fallback)})]},e.to))})}function art({alert:t}){const{t:e}=Lt(),n=t?t.type==="error"?"bg-red-500":t.type==="warning"?"bg-amber-500":"bg-bambu-green":"bg-bambu-green",r=t?t.type==="error"?"border-red-500":t.type==="warning"?"border-amber-500":"border-bambu-dark-tertiary":"border-bambu-dark-tertiary";return a.jsxs("div",{className:`h-9 bg-bambu-dark-secondary border-t-2 ${r} flex items-center px-3 gap-3 shrink-0`,children:[a.jsx("div",{className:`w-3.5 h-3.5 rounded-full ${n}`}),a.jsx("div",{className:"flex-1 text-sm text-white/50 truncate",children:t?a.jsx("span",{children:t.message}):a.jsx("span",{className:"text-bambu-green",children:e("spoolbuddy.status.systemReady","System Ready")})})]})}const irt={weight:null,weightStable:!1,rawAdc:null,matchedSpool:null,unknownTagUid:null,deviceOnline:!1,deviceId:null};function srt(t,e){switch(e.type){case"WEIGHT_UPDATE":return{...t,weight:e.weight,weightStable:e.stable,rawAdc:e.rawAdc,deviceId:e.deviceId,deviceOnline:!0};case"TAG_MATCHED":return{...t,matchedSpool:e.spool,unknownTagUid:null,deviceId:e.deviceId};case"UNKNOWN_TAG":return{...t,matchedSpool:null,unknownTagUid:e.tagUid,deviceId:e.deviceId};case"TAG_REMOVED":return{...t,matchedSpool:null,unknownTagUid:null};case"DEVICE_ONLINE":return{...t,deviceOnline:!0,deviceId:e.deviceId};case"DEVICE_OFFLINE":return{...t,deviceOnline:!1,weight:null,weightStable:!1,rawAdc:null};default:return t}}function ort(){const[t,e]=w.useReducer(srt,irt),n=w.useCallback(u=>{const m=u.detail;e({type:"WEIGHT_UPDATE",weight:m.weight_grams??m.data?.weight_grams,stable:m.stable??m.data?.stable??!1,rawAdc:m.raw_adc??m.data?.raw_adc??null,deviceId:m.device_id??m.data?.device_id??""})},[]),r=w.useCallback(u=>{const m=u.detail,p=m.spool??m.data?.spool;p&&e({type:"TAG_MATCHED",spool:{id:p.id,tag_uid:m.tag_uid??m.data?.tag_uid??"",material:p.material??"",subtype:p.subtype??null,color_name:p.color_name??null,rgba:p.rgba??null,brand:p.brand??null,label_weight:p.label_weight??0,core_weight:p.core_weight??0,weight_used:p.weight_used??0},deviceId:m.device_id??m.data?.device_id??""})},[]),i=w.useCallback(u=>{const m=u.detail;e({type:"UNKNOWN_TAG",tagUid:m.tag_uid??m.data?.tag_uid??"",deviceId:m.device_id??m.data?.device_id??""})},[]),s=w.useCallback(u=>{const m=u.detail;e({type:"TAG_REMOVED",deviceId:m.device_id??m.data?.device_id??""})},[]),o=w.useCallback(u=>{const m=u.detail;e({type:"DEVICE_ONLINE",deviceId:m.device_id??m.data?.device_id??""})},[]),l=w.useCallback(u=>{const m=u.detail;e({type:"DEVICE_OFFLINE",deviceId:m.device_id??m.data?.device_id??""})},[]);w.useEffect(()=>(window.addEventListener("spoolbuddy-weight",n),window.addEventListener("spoolbuddy-tag-matched",r),window.addEventListener("spoolbuddy-unknown-tag",i),window.addEventListener("spoolbuddy-tag-removed",s),window.addEventListener("spoolbuddy-online",o),window.addEventListener("spoolbuddy-offline",l),()=>{window.removeEventListener("spoolbuddy-weight",n),window.removeEventListener("spoolbuddy-tag-matched",r),window.removeEventListener("spoolbuddy-unknown-tag",i),window.removeEventListener("spoolbuddy-tag-removed",s),window.removeEventListener("spoolbuddy-online",o),window.removeEventListener("spoolbuddy-offline",l)}),[n,r,i,s,o,l]);const c=t.matchedSpool?Math.max(0,t.matchedSpool.label_weight-t.matchedSpool.weight_used):null,d=t.weight!==null&&t.matchedSpool?Math.max(0,t.weight-t.matchedSpool.core_weight):null;return{...t,remainingWeight:c,netWeight:d}}var Uk={exports:{}};var lrt=Uk.exports,oX;function crt(){return oX||(oX=1,(function(t,e){(function(n,r){t.exports=r(dg())})(lrt,(function(n){return(function(){var r={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(l){if("Element"in l){var c="classList",d="prototype",u=l.Element[d],m=Object,p=String[d].trim||function(){return this.replace(/^\s+|\s+$/g,"")},f=Array[d].indexOf||function(P){for(var k=0,M=this.length;k1?arguments[1]:void 0)}},7916:function(B,W,D){var j=D(6080),z=D(9565),K=D(8981),q=D(6319),ce=D(4209),O=D(3517),G=D(6198),X=D(4659),V=D(4527),ee=D(81),se=D(851),me=Array;B.exports=function(he){var oe=K(he),U=O(this),R=arguments.length,ne=R>1?arguments[1]:void 0,ge=ne!==void 0;ge&&(ne=j(ne,R>2?arguments[2]:void 0));var we,be,ye,fe,Se,Ee,Me=se(oe),_e=0;if(!Me||this===me&&ce(Me))for(we=G(oe),be=U?new this(we):me(we);we>_e;_e++)Ee=ge?ne(oe[_e],_e):oe[_e],X(be,_e,Ee);else for(be=U?new this:[],Se=(fe=ee(oe,Me)).next;!(ye=z(Se,fe)).done;_e++)Ee=ge?q(fe,ne,[ye.value,_e],!0):ye.value,X(be,_e,Ee);return V(be,_e),be}},9617:function(B,W,D){var j=D(5397),z=D(5610),K=D(6198),q=function(ce){return function(O,G,X){var V=j(O),ee=K(V);if(ee===0)return!ce&&-1;var se,me=z(X,ee);if(ce&&G!=G){for(;ee>me;)if((se=V[me++])!=se)return!0}else for(;ee>me;me++)if((ce||me in V)&&V[me]===G)return ce||me||0;return!ce&&-1}};B.exports={includes:q(!0),indexOf:q(!1)}},9213:function(B,W,D){var j=D(6080),z=D(7055),K=D(8981),q=D(6198),ce=D(1469),O=D(4659),G=function(X){var V=X===1,ee=X===2,se=X===3,me=X===4,he=X===6,oe=X===7,U=X===5||he;return function(R,ne,ge){for(var we,be,ye=K(R),fe=z(ye),Se=q(fe),Ee=j(ne,ge),Me=0,_e=0,je=V?ce(R,Se):ee||oe?ce(R,0):void 0;Se>Me;Me++)if((U||Me in fe)&&(be=Ee(we=fe[Me],Me,ye),X))if(V)O(je,Me,be);else if(be)switch(X){case 3:return!0;case 5:return we;case 6:return Me;case 2:O(je,_e++,we)}else switch(X){case 4:return!1;case 7:O(je,_e++,we)}return he?-1:se||me?me:je}};B.exports={forEach:G(0),map:G(1),filter:G(2),some:G(3),every:G(4),find:G(5),findIndex:G(6),filterReject:G(7)}},597:function(B,W,D){var j=D(9039),z=D(8227),K=D(9519),q=z("species");B.exports=function(ce){return K>=51||!j((function(){var O=[];return(O.constructor={})[q]=function(){return{foo:1}},O[ce](Boolean).foo!==1}))}},4598:function(B,W,D){var j=D(9039);B.exports=function(z,K){var q=[][z];return!!q&&j((function(){q.call(null,K||function(){return 1},1)}))}},926:function(B,W,D){var j=D(9306),z=D(8981),K=D(7055),q=D(6198),ce=TypeError,O="Reduce of empty array with no initial value",G=function(X){return function(V,ee,se,me){var he=z(V),oe=K(he),U=q(he);if(j(ee),U===0&&se<2)throw new ce(O);var R=X?U-1:0,ne=X?-1:1;if(se<2)for(;;){if(R in oe){me=oe[R],R+=ne;break}if(R+=ne,X?R<0:U<=R)throw new ce(O)}for(;X?R>=0:U>R;R+=ne)R in oe&&(me=ee(me,oe[R],R,he));return me}};B.exports={left:G(!1),right:G(!0)}},4527:function(B,W,D){var j=D(3724),z=D(4376),K=TypeError,q=Object.getOwnPropertyDescriptor,ce=j&&!(function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(O){return O instanceof TypeError}})();B.exports=ce?function(O,G){if(z(O)&&!q(O,"length").writable)throw new K("Cannot set read only .length");return O.length=G}:function(O,G){return O.length=G}},7680:function(B,W,D){var j=D(9504);B.exports=j([].slice)},4488:function(B,W,D){var j=D(7680),z=Math.floor,K=function(q,ce){var O=q.length;if(O<8)for(var G,X,V=1;V0;)q[X]=q[--X];X!==V++&&(q[X]=G)}else for(var ee=z(O/2),se=K(j(q,0,ee),ce),me=K(j(q,ee),ce),he=se.length,oe=me.length,U=0,R=0;U9007199254740991)throw W("Maximum allowed index exceeded");return D}},7400:function(B){B.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(B,W,D){var j=D(4055)("span").classList,z=j&&j.constructor&&j.constructor.prototype;B.exports=z===Object.prototype?void 0:z},8727:function(B){B.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},3709:function(B,W,D){var j=D(2839).match(/firefox\/(\d+)/i);B.exports=!!j&&+j[1]},3763:function(B,W,D){var j=D(2839);B.exports=/MSIE|Trident/.test(j)},6193:function(B,W,D){var j=D(4215);B.exports=j==="NODE"},2839:function(B,W,D){var j=D(4576).navigator,z=j&&j.userAgent;B.exports=z?String(z):""},9519:function(B,W,D){var j,z,K=D(4576),q=D(2839),ce=K.process,O=K.Deno,G=ce&&ce.versions||O&&O.version,X=G&&G.v8;X&&(z=(j=X.split("."))[0]>0&&j[0]<4?1:+(j[0]+j[1])),!z&&q&&(!(j=q.match(/Edge\/(\d+)/))||j[1]>=74)&&(j=q.match(/Chrome\/(\d+)/))&&(z=+j[1]),B.exports=z},3607:function(B,W,D){var j=D(2839).match(/AppleWebKit\/(\d+)\./);B.exports=!!j&&+j[1]},4215:function(B,W,D){var j=D(4576),z=D(2839),K=D(2195),q=function(ce){return z.slice(0,ce.length)===ce};B.exports=q("Bun/")?"BUN":q("Cloudflare-Workers")?"CLOUDFLARE":q("Deno/")?"DENO":q("Node.js/")?"NODE":j.Bun&&typeof Bun.version=="string"?"BUN":j.Deno&&typeof Deno.version=="object"?"DENO":K(j.process)==="process"?"NODE":j.window&&j.document?"BROWSER":"REST"},6518:function(B,W,D){var j=D(4576),z=D(7347).f,K=D(6699),q=D(6840),ce=D(9433),O=D(7740),G=D(2796);B.exports=function(X,V){var ee,se,me,he,oe,U=X.target,R=X.global,ne=X.stat;if(ee=R?j:ne?j[U]||ce(U,{}):j[U]&&j[U].prototype)for(se in V){if(he=V[se],me=X.dontCallGetSet?(oe=z(ee,se))&&oe.value:ee[se],!G(R?se:U+(ne?".":"#")+se,X.forced)&&me!==void 0){if(typeof he==typeof me)continue;O(he,me)}(X.sham||me&&me.sham)&&K(he,"sham",!0),q(ee,se,he,X)}}},9039:function(B){B.exports=function(W){try{return!!W()}catch{return!0}}},9228:function(B,W,D){D(7495);var j=D(9565),z=D(6840),K=D(7323),q=D(9039),ce=D(8227),O=D(6699),G=ce("species"),X=RegExp.prototype;B.exports=function(V,ee,se,me){var he=ce(V),oe=!q((function(){var ge={};return ge[he]=function(){return 7},""[V](ge)!==7})),U=oe&&!q((function(){var ge=!1,we=/a/;if(V==="split"){var be={};be[G]=function(){return we},(we={constructor:be,flags:""})[he]=/./[he]}return we.exec=function(){return ge=!0,null},we[he](""),!ge}));if(!oe||!U||se){var R=/./[he],ne=ee(he,""[V],(function(ge,we,be,ye,fe){var Se=we.exec;return Se===K||Se===X.exec?oe&&!fe?{done:!0,value:j(R,we,be,ye)}:{done:!0,value:j(ge,be,we,ye)}:{done:!1}}));z(String.prototype,V,ne[0]),z(X,he,ne[1])}me&&O(X[he],"sham",!0)}},8745:function(B,W,D){var j=D(616),z=Function.prototype,K=z.apply,q=z.call;B.exports=typeof Reflect=="object"&&Reflect.apply||(j?q.bind(K):function(){return q.apply(K,arguments)})},6080:function(B,W,D){var j=D(7476),z=D(9306),K=D(616),q=j(j.bind);B.exports=function(ce,O){return z(ce),O===void 0?ce:K?q(ce,O):function(){return ce.apply(O,arguments)}}},616:function(B,W,D){var j=D(9039);B.exports=!j((function(){var z=(function(){}).bind();return typeof z!="function"||z.hasOwnProperty("prototype")}))},566:function(B,W,D){var j=D(9504),z=D(9306),K=D(34),q=D(9297),ce=D(7680),O=D(616),G=Function,X=j([].concat),V=j([].join),ee={};B.exports=O?G.bind:function(se){var me=z(this),he=me.prototype,oe=ce(arguments,1),U=function(){var R=X(oe,ce(arguments));return this instanceof U?(function(ne,ge,we){if(!q(ee,ge)){for(var be=[],ye=0;ye]*>)/g,X=/\$([$&'`]|\d{1,2})/g;B.exports=function(V,ee,se,me,he,oe){var U=se+V.length,R=me.length,ne=X;return he!==void 0&&(he=z(he),ne=G),ce(oe,ne,(function(ge,we){var be;switch(q(we,0)){case"$":return"$";case"&":return V;case"`":return O(ee,0,se);case"'":return O(ee,U);case"<":be=he[O(we,1,-1)];break;default:var ye=+we;if(ye===0)return ge;if(ye>R){var fe=K(ye/10);return fe===0?ge:fe<=R?me[fe-1]===void 0?q(we,1):me[fe-1]+q(we,1):ge}be=me[ye-1]}return be===void 0?"":be}))}},4576:function(B,W,D){var j=function(z){return z&&z.Math===Math&&z};B.exports=j(typeof globalThis=="object"&&globalThis)||j(typeof window=="object"&&window)||j(typeof self=="object"&&self)||j(typeof D.g=="object"&&D.g)||j(typeof this=="object"&&this)||(function(){return this})()||Function("return this")()},9297:function(B,W,D){var j=D(9504),z=D(8981),K=j({}.hasOwnProperty);B.exports=Object.hasOwn||function(q,ce){return K(z(q),ce)}},421:function(B){B.exports={}},397:function(B,W,D){var j=D(7751);B.exports=j("document","documentElement")},5917:function(B,W,D){var j=D(3724),z=D(9039),K=D(4055);B.exports=!j&&!z((function(){return Object.defineProperty(K("div"),"a",{get:function(){return 7}}).a!==7}))},7055:function(B,W,D){var j=D(9504),z=D(9039),K=D(2195),q=Object,ce=j("".split);B.exports=z((function(){return!q("z").propertyIsEnumerable(0)}))?function(O){return K(O)==="String"?ce(O,""):q(O)}:q},3167:function(B,W,D){var j=D(4901),z=D(34),K=D(2967);B.exports=function(q,ce,O){var G,X;return K&&j(G=ce.constructor)&&G!==O&&z(X=G.prototype)&&X!==O.prototype&&K(q,X),q}},3706:function(B,W,D){var j=D(9504),z=D(4901),K=D(7629),q=j(Function.toString);z(K.inspectSource)||(K.inspectSource=function(ce){return q(ce)}),B.exports=K.inspectSource},1181:function(B,W,D){var j,z,K,q=D(8622),ce=D(4576),O=D(34),G=D(6699),X=D(9297),V=D(7629),ee=D(6119),se=D(421),me="Object already initialized",he=ce.TypeError,oe=ce.WeakMap;if(q||V.state){var U=V.state||(V.state=new oe);U.get=U.get,U.has=U.has,U.set=U.set,j=function(ne,ge){if(U.has(ne))throw new he(me);return ge.facade=ne,U.set(ne,ge),ge},z=function(ne){return U.get(ne)||{}},K=function(ne){return U.has(ne)}}else{var R=ee("state");se[R]=!0,j=function(ne,ge){if(X(ne,R))throw new he(me);return ge.facade=ne,G(ne,R,ge),ge},z=function(ne){return X(ne,R)?ne[R]:{}},K=function(ne){return X(ne,R)}}B.exports={set:j,get:z,has:K,enforce:function(ne){return K(ne)?z(ne):j(ne,{})},getterFor:function(ne){return function(ge){var we;if(!O(ge)||(we=z(ge)).type!==ne)throw new he("Incompatible receiver, "+ne+" required");return we}}}},4209:function(B,W,D){var j=D(8227),z=D(6269),K=j("iterator"),q=Array.prototype;B.exports=function(ce){return ce!==void 0&&(z.Array===ce||q[K]===ce)}},4376:function(B,W,D){var j=D(2195);B.exports=Array.isArray||function(z){return j(z)==="Array"}},4901:function(B){var W=typeof document=="object"&&document.all;B.exports=W===void 0&&W!==void 0?function(D){return typeof D=="function"||D===W}:function(D){return typeof D=="function"}},3517:function(B,W,D){var j=D(9504),z=D(9039),K=D(4901),q=D(6955),ce=D(7751),O=D(3706),G=function(){},X=ce("Reflect","construct"),V=/^\s*(?:class|function)\b/,ee=j(V.exec),se=!V.test(G),me=function(oe){if(!K(oe))return!1;try{return X(G,[],oe),!0}catch{return!1}},he=function(oe){if(!K(oe))return!1;switch(q(oe)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return se||!!ee(V,O(oe))}catch{return!0}};he.sham=!0,B.exports=!X||z((function(){var oe;return me(me.call)||!me(Object)||!me((function(){oe=!0}))||oe}))?he:me},2796:function(B,W,D){var j=D(9039),z=D(4901),K=/#|\.prototype\./,q=function(V,ee){var se=O[ce(V)];return se===X||se!==G&&(z(ee)?j(ee):!!ee)},ce=q.normalize=function(V){return String(V).replace(K,".").toLowerCase()},O=q.data={},G=q.NATIVE="N",X=q.POLYFILL="P";B.exports=q},2087:function(B,W,D){var j=D(34),z=Math.floor;B.exports=Number.isInteger||function(K){return!j(K)&&isFinite(K)&&z(K)===K}},4117:function(B){B.exports=function(W){return W==null}},34:function(B,W,D){var j=D(4901);B.exports=function(z){return typeof z=="object"?z!==null:j(z)}},3925:function(B,W,D){var j=D(34);B.exports=function(z){return j(z)||z===null}},6395:function(B){B.exports=!1},5810:function(B,W,D){var j=D(34),z=D(1181).get;B.exports=function(K){if(!j(K))return!1;var q=z(K);return!!q&&q.type==="RawJSON"}},788:function(B,W,D){var j=D(34),z=D(2195),K=D(8227)("match");B.exports=function(q){var ce;return j(q)&&((ce=q[K])!==void 0?!!ce:z(q)==="RegExp")}},757:function(B,W,D){var j=D(7751),z=D(4901),K=D(1625),q=D(7040),ce=Object;B.exports=q?function(O){return typeof O=="symbol"}:function(O){var G=j("Symbol");return z(G)&&K(G.prototype,ce(O))}},9539:function(B,W,D){var j=D(9565),z=D(8551),K=D(5966);B.exports=function(q,ce,O){var G,X;z(q);try{if(!(G=K(q,"return"))){if(ce==="throw")throw O;return O}G=j(G,q)}catch(V){X=!0,G=V}if(ce==="throw")throw O;if(X)throw G;return z(G),O}},3994:function(B,W,D){var j=D(7657).IteratorPrototype,z=D(2360),K=D(6980),q=D(687),ce=D(6269),O=function(){return this};B.exports=function(G,X,V,ee){var se=X+" Iterator";return G.prototype=z(j,{next:K(+!ee,V)}),q(G,se,!1,!0),ce[se]=O,G}},1088:function(B,W,D){var j=D(6518),z=D(9565),K=D(6395),q=D(350),ce=D(4901),O=D(3994),G=D(2787),X=D(2967),V=D(687),ee=D(6699),se=D(6840),me=D(8227),he=D(6269),oe=D(7657),U=q.PROPER,R=q.CONFIGURABLE,ne=oe.IteratorPrototype,ge=oe.BUGGY_SAFARI_ITERATORS,we=me("iterator"),be="keys",ye="values",fe="entries",Se=function(){return this};B.exports=function(Ee,Me,_e,je,ze,Fe,Xe){O(_e,Me,je);var ve,Ge,De,Qe=function(gt){if(gt===ze&&et)return et;if(!ge&>&> in Ae)return Ae[gt];switch(gt){case be:case ye:case fe:return function(){return new _e(this,gt)}}return function(){return new _e(this)}},Ve=Me+" Iterator",Pe=!1,Ae=Ee.prototype,$e=Ae[we]||Ae["@@iterator"]||ze&&Ae[ze],et=!ge&&$e||Qe(ze),ot=Me==="Array"&&Ae.entries||$e;if(ot&&(ve=G(ot.call(new Ee)))!==Object.prototype&&ve.next&&(K||G(ve)===ne||(X?X(ve,ne):ce(ve[we])||se(ve,we,Se)),V(ve,Ve,!0,!0),K&&(he[Ve]=Se)),U&&ze===ye&&$e&&$e.name!==ye&&(!K&&R?ee(Ae,"name",ye):(Pe=!0,et=function(){return z($e,this)})),ze)if(Ge={values:Qe(ye),keys:Fe?et:Qe(be),entries:Qe(fe)},Xe)for(De in Ge)(ge||Pe||!(De in Ae))&&se(Ae,De,Ge[De]);else j({target:Me,proto:!0,forced:ge||Pe},Ge);return K&&!Xe||Ae[we]===et||se(Ae,we,et,{name:ze}),he[Me]=et,Ge}},7657:function(B,W,D){var j,z,K,q=D(9039),ce=D(4901),O=D(34),G=D(2360),X=D(2787),V=D(6840),ee=D(8227),se=D(6395),me=ee("iterator"),he=!1;[].keys&&("next"in(K=[].keys())?(z=X(X(K)))!==Object.prototype&&(j=z):he=!0),!O(j)||q((function(){var oe={};return j[me].call(oe)!==oe}))?j={}:se&&(j=G(j)),ce(j[me])||V(j,me,(function(){return this})),B.exports={IteratorPrototype:j,BUGGY_SAFARI_ITERATORS:he}},6269:function(B){B.exports={}},6198:function(B,W,D){var j=D(8014);B.exports=function(z){return j(z.length)}},283:function(B,W,D){var j=D(9504),z=D(9039),K=D(4901),q=D(9297),ce=D(3724),O=D(350).CONFIGURABLE,G=D(3706),X=D(1181),V=X.enforce,ee=X.get,se=String,me=Object.defineProperty,he=j("".slice),oe=j("".replace),U=j([].join),R=ce&&!z((function(){return me((function(){}),"length",{value:8}).length!==8})),ne=String(String).split("String"),ge=B.exports=function(we,be,ye){he(se(be),0,7)==="Symbol("&&(be="["+oe(se(be),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),ye&&ye.getter&&(be="get "+be),ye&&ye.setter&&(be="set "+be),(!q(we,"name")||O&&we.name!==be)&&(ce?me(we,"name",{value:be,configurable:!0}):we.name=be),R&&ye&&q(ye,"arity")&&we.length!==ye.arity&&me(we,"length",{value:ye.arity});try{ye&&q(ye,"constructor")&&ye.constructor?ce&&me(we,"prototype",{writable:!1}):we.prototype&&(we.prototype=void 0)}catch{}var fe=V(we);return q(fe,"source")||(fe.source=U(ne,typeof be=="string"?be:"")),we};Function.prototype.toString=ge((function(){return K(this)&&ee(this).source||G(this)}),"toString")},741:function(B){var W=Math.ceil,D=Math.floor;B.exports=Math.trunc||function(j){var z=+j;return(z>0?D:W)(z)}},7819:function(B,W,D){var j=D(9039);B.exports=!j((function(){var z="9007199254740993",K=JSON.rawJSON(z);return!JSON.isRawJSON(K)||JSON.stringify(K)!==z}))},5749:function(B,W,D){var j=D(788),z=TypeError;B.exports=function(K){if(j(K))throw new z("The method doesn't accept regular expressions");return K}},4213:function(B,W,D){var j=D(3724),z=D(9504),K=D(9565),q=D(9039),ce=D(1072),O=D(3717),G=D(8773),X=D(8981),V=D(7055),ee=Object.assign,se=Object.defineProperty,me=z([].concat);B.exports=!ee||q((function(){if(j&&ee({b:1},ee(se({},"a",{enumerable:!0,get:function(){se(this,"b",{value:3,enumerable:!1})}}),{b:2})).b!==1)return!0;var he={},oe={},U=Symbol("assign detection"),R="abcdefghijklmnopqrst";return he[U]=7,R.split("").forEach((function(ne){oe[ne]=ne})),ee({},he)[U]!==7||ce(ee({},oe)).join("")!==R}))?function(he,oe){for(var U=X(he),R=arguments.length,ne=1,ge=O.f,we=G.f;R>ne;)for(var be,ye=V(arguments[ne++]),fe=ge?me(ce(ye),ge(ye)):ce(ye),Se=fe.length,Ee=0;Se>Ee;)be=fe[Ee++],j&&!K(we,ye,be)||(U[be]=ye[be]);return U}:ee},2360:function(B,W,D){var j,z=D(8551),K=D(6801),q=D(8727),ce=D(421),O=D(397),G=D(4055),X=D(6119),V="prototype",ee="script",se=X("IE_PROTO"),me=function(){},he=function(R){return"<"+ee+">"+R+""},oe=function(R){R.write(he("")),R.close();var ne=R.parentWindow.Object;return R=null,ne},U=function(){try{j=new ActiveXObject("htmlfile")}catch{}var R,ne,ge;U=typeof document<"u"?document.domain&&j?oe(j):(ne=G("iframe"),ge="java"+ee+":",ne.style.display="none",O.appendChild(ne),ne.src=String(ge),(R=ne.contentWindow.document).open(),R.write(he("document.F=Object")),R.close(),R.F):oe(j);for(var we=q.length;we--;)delete U[V][q[we]];return U()};ce[se]=!0,B.exports=Object.create||function(R,ne){var ge;return R!==null?(me[V]=z(R),ge=new me,me[V]=null,ge[se]=R):ge=U(),ne===void 0?ge:K.f(ge,ne)}},6801:function(B,W,D){var j=D(3724),z=D(8686),K=D(4913),q=D(8551),ce=D(5397),O=D(1072);W.f=j&&!z?Object.defineProperties:function(G,X){q(G);for(var V,ee=ce(X),se=O(X),me=se.length,he=0;me>he;)K.f(G,V=se[he++],ee[V]);return G}},4913:function(B,W,D){var j=D(3724),z=D(5917),K=D(8686),q=D(8551),ce=D(6969),O=TypeError,G=Object.defineProperty,X=Object.getOwnPropertyDescriptor,V="enumerable",ee="configurable",se="writable";W.f=j?K?function(me,he,oe){if(q(me),he=ce(he),q(oe),typeof me=="function"&&he==="prototype"&&"value"in oe&&se in oe&&!oe[se]){var U=X(me,he);U&&U[se]&&(me[he]=oe.value,oe={configurable:ee in oe?oe[ee]:U[ee],enumerable:V in oe?oe[V]:U[V],writable:!1})}return G(me,he,oe)}:G:function(me,he,oe){if(q(me),he=ce(he),q(oe),z)try{return G(me,he,oe)}catch{}if("get"in oe||"set"in oe)throw new O("Accessors not supported");return"value"in oe&&(me[he]=oe.value),me}},7347:function(B,W,D){var j=D(3724),z=D(9565),K=D(8773),q=D(6980),ce=D(5397),O=D(6969),G=D(9297),X=D(5917),V=Object.getOwnPropertyDescriptor;W.f=j?V:function(ee,se){if(ee=ce(ee),se=O(se),X)try{return V(ee,se)}catch{}if(G(ee,se))return q(!z(K.f,ee,se),ee[se])}},298:function(B,W,D){var j=D(2195),z=D(5397),K=D(8480).f,q=D(7680),ce=typeof window=="object"&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];B.exports.f=function(O){return ce&&j(O)==="Window"?(function(G){try{return K(G)}catch{return q(ce)}})(O):K(z(O))}},8480:function(B,W,D){var j=D(1828),z=D(8727).concat("length","prototype");W.f=Object.getOwnPropertyNames||function(K){return j(K,z)}},3717:function(B,W){W.f=Object.getOwnPropertySymbols},2787:function(B,W,D){var j=D(9297),z=D(4901),K=D(8981),q=D(6119),ce=D(2211),O=q("IE_PROTO"),G=Object,X=G.prototype;B.exports=ce?G.getPrototypeOf:function(V){var ee=K(V);if(j(ee,O))return ee[O];var se=ee.constructor;return z(se)&&ee instanceof se?se.prototype:ee instanceof G?X:null}},1625:function(B,W,D){var j=D(9504);B.exports=j({}.isPrototypeOf)},1828:function(B,W,D){var j=D(9504),z=D(9297),K=D(5397),q=D(9617).indexOf,ce=D(421),O=j([].push);B.exports=function(G,X){var V,ee=K(G),se=0,me=[];for(V in ee)!z(ce,V)&&z(ee,V)&&O(me,V);for(;X.length>se;)z(ee,V=X[se++])&&(~q(me,V)||O(me,V));return me}},1072:function(B,W,D){var j=D(1828),z=D(8727);B.exports=Object.keys||function(K){return j(K,z)}},8773:function(B,W){var D={}.propertyIsEnumerable,j=Object.getOwnPropertyDescriptor,z=j&&!D.call({1:2},1);W.f=z?function(K){var q=j(this,K);return!!q&&q.enumerable}:D},2551:function(B,W,D){var j=D(6395),z=D(4576),K=D(9039),q=D(3607);B.exports=j||!K((function(){if(!(q&&q<535)){var ce=Math.random();__defineSetter__.call(null,ce,(function(){})),delete z[ce]}}))},2967:function(B,W,D){var j=D(6706),z=D(34),K=D(7750),q=D(3506);B.exports=Object.setPrototypeOf||("__proto__"in{}?(function(){var ce,O=!1,G={};try{(ce=j(Object.prototype,"__proto__","set"))(G,[]),O=G instanceof Array}catch{}return function(X,V){return K(X),q(V),z(X)&&(O?ce(X,V):X.__proto__=V),X}})():void 0)},3179:function(B,W,D){var j=D(2140),z=D(6955);B.exports=j?{}.toString:function(){return"[object "+z(this)+"]"}},4270:function(B,W,D){var j=D(9565),z=D(4901),K=D(34),q=TypeError;B.exports=function(ce,O){var G,X;if(O==="string"&&z(G=ce.toString)&&!K(X=j(G,ce))||z(G=ce.valueOf)&&!K(X=j(G,ce))||O!=="string"&&z(G=ce.toString)&&!K(X=j(G,ce)))return X;throw new q("Can't convert object to primitive value")}},5031:function(B,W,D){var j=D(7751),z=D(9504),K=D(8480),q=D(3717),ce=D(8551),O=z([].concat);B.exports=j("Reflect","ownKeys")||function(G){var X=K.f(ce(G)),V=q.f;return V?O(X,V(G)):X}},8235:function(B,W,D){var j=D(9504),z=D(9297),K=SyntaxError,q=parseInt,ce=String.fromCharCode,O=j("".charAt),G=j("".slice),X=j(/./.exec),V={'\\"':'"',"\\\\":"\\","\\/":"/","\\b":"\b","\\f":"\f","\\n":` +`)[0]}),F&&a.jsx("span",{className:"text-bambu-gray/50 shrink-0",children:C?a.jsx(nc,{className:"w-3.5 h-3.5"}):a.jsx(Fn,{className:"w-3.5 h-3.5"})})]})},A)})})}),a.jsx("div",{className:"flex items-center justify-between p-3 border-t border-bambu-dark-tertiary text-sm text-bambu-gray",children:m?a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"w-2 h-2 bg-green-500 rounded-full animate-pulse"}),"Auto-refreshing every 2 seconds"]}):a.jsx("span",{children:"Click Start to enable live log streaming"})})]})]})}function Knt(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:t<1024*1024*1024?`${(t/(1024*1024)).toFixed(1)} MB`:`${(t/(1024*1024*1024)).toFixed(2)} GB`}function wa({icon:t,label:e,value:n,subValue:r,color:i="text-bambu-green"}){return a.jsxs("div",{className:"flex items-start gap-3 p-4 bg-bambu-dark rounded-lg",children:[a.jsx("div",{className:`p-2 rounded-lg bg-bambu-dark-tertiary ${i}`,children:a.jsx(t,{className:"w-5 h-5"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm text-bambu-gray",children:e}),a.jsx("p",{className:"text-lg font-semibold text-white truncate",children:n}),r&&a.jsx("p",{className:"text-xs text-bambu-gray mt-0.5",children:r})]})]})}function sX({percent:t,color:e="bg-bambu-green"}){return a.jsx("div",{className:"w-full h-2 bg-bambu-dark rounded-full overflow-hidden",children:a.jsx("div",{className:`h-full ${e} transition-all duration-300`,style:{width:`${Math.min(100,t)}%`}})})}function sh({title:t,icon:e,children:n}){return a.jsxs(Dt,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(e,{className:"w-5 h-5 text-bambu-green"}),a.jsx("h2",{className:"text-lg font-semibold text-white",children:t})]}),n]})}function Ynt(){const{t}=Lt(),e=hn(),[n,r]=w.useState(null),[i,s]=w.useState(!1),[o,l]=w.useState(!1),{data:c,isLoading:d,refetch:u,isFetching:m}=Je({queryKey:["systemInfo"],queryFn:pe.getSystemInfo,refetchInterval:3e4}),{data:p}=Je({queryKey:["debugLogging"],queryFn:nx.getDebugLoggingState,staleTime:10*1e3,refetchInterval:10*1e3}),{data:f}=Je({queryKey:["settings"],queryFn:pe.getSettings}),{data:y}=Je({queryKey:["library-stats"],queryFn:pe.getLibraryStats}),v=f?.time_format||"system",g=async()=>{l(!0);try{const P=await nx.setDebugLogging(!p?.enabled);e.setQueryData(["debugLogging"],P)}catch(P){console.error("Failed to toggle debug logging:",P)}finally{l(!1)}},b=async()=>{r(null),s(!0);try{await nx.downloadSupportBundle()}catch(P){r(P instanceof Error?P.message:"Failed to download support bundle")}finally{s(!1)}};if(d)return a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx(dt,{className:"w-8 h-8 text-bambu-green animate-spin"})});if(!c)return a.jsx("div",{className:"p-6 text-center text-bambu-gray",children:t("system.failedToLoad","Failed to load system information")});const _=c.storage.disk_percent_used>90?"bg-red-500":c.storage.disk_percent_used>75?"bg-yellow-500":"bg-bambu-green",N=c.memory.percent_used>90?"bg-red-500":c.memory.percent_used>75?"bg-yellow-500":"bg-bambu-green";return a.jsxs("div",{className:"p-6 space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold text-white",children:t("system.title","System Information")}),a.jsx("p",{className:"text-bambu-gray mt-1",children:t("system.subtitle","Monitor system resources and database statistics")})]}),a.jsxs("button",{onClick:()=>u(),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:[a.jsx(wr,{className:`w-4 h-4 ${m?"animate-spin":""}`}),t("common.refresh","Refresh")]})]}),a.jsx(sh,{title:t("system.application","Application"),icon:Kp,children:a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[a.jsx(wa,{icon:Kp,label:t("system.version","Version"),value:`v${c.app.version}`}),a.jsx(wa,{icon:rr,label:t("system.uptime","System Uptime"),value:c.system.uptime_formatted}),a.jsx(wa,{icon:Kp,label:t("system.hostname","Hostname"),value:c.system.hostname})]})}),a.jsx(sh,{title:t("support.title","Support & Troubleshooting"),icon:rge,children:a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-bambu-gray",children:t("support.description","Enable debug logging to capture detailed information, then download a support bundle to share when reporting issues.")}),a.jsxs("div",{className:"flex items-center justify-between p-4 bg-bambu-dark rounded-lg",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${p?.enabled?"bg-amber-500/20 text-amber-500":"bg-bambu-dark-tertiary text-bambu-gray"}`,children:a.jsx(xx,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium text-white",children:t("support.debugLogging","Debug Logging")}),a.jsxs("p",{className:"text-sm text-bambu-gray",children:[p?.enabled?t("support.debugLoggingEnabled","Capturing detailed logs"):t("support.debugLoggingDisabled","Normal logging level"),p?.enabled&&p.duration_seconds!==null&&a.jsxs("span",{className:"text-amber-400 ml-2",children:["(",Math.floor(p.duration_seconds/60),"m ",p.duration_seconds%60,"s)"]})]})]})]}),a.jsxs("button",{onClick:g,disabled:o,className:`px-4 py-2 rounded-lg font-medium transition-colors flex items-center gap-2 ${p?.enabled?"bg-amber-500/20 text-amber-400 hover:bg-amber-500/30":"bg-bambu-green/20 text-bambu-green hover:bg-bambu-green/30"} disabled:opacity-50`,children:[o&&a.jsx(dt,{className:"w-4 h-4 animate-spin"}),p?.enabled?t("support.disableDebug","Disable"):t("support.enableDebug","Enable")]})]}),a.jsxs("div",{className:"flex items-center justify-between p-4 bg-bambu-dark rounded-lg",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 rounded-lg bg-bambu-dark-tertiary text-bambu-green",children:a.jsx(Na,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium text-white",children:t("support.supportBundle","Support Bundle")}),a.jsx("p",{className:"text-sm text-bambu-gray",children:t("support.supportBundleDescription","Download system info and logs as a ZIP file")})]})]}),a.jsxs("button",{onClick:b,disabled:i||!p?.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:p?.enabled?void 0:t("support.enableDebugFirst","Enable debug logging first"),children:[i&&a.jsx(dt,{className:"w-4 h-4 animate-spin"}),t("common.download","Download")]})]}),n&&a.jsx("div",{className:"p-3 bg-red-500/20 border border-red-500/30 rounded-lg text-red-400 text-sm",children:n}),!p?.enabled&&a.jsx("div",{className:"p-4 bg-bambu-dark-tertiary/50 rounded-lg",children:a.jsxs("p",{className:"text-sm text-bambu-gray",children:[a.jsx("span",{className:"text-amber-400 font-medium",children:t("support.instructions","To report an issue:")}),a.jsx("br",{}),"1. ",t("support.step1","Enable debug logging"),a.jsx("br",{}),"2. ",t("support.step2","Reproduce the issue"),a.jsx("br",{}),"3. ",t("support.step3","Download the support bundle"),a.jsx("br",{}),"4. ",t("support.step4","Attach the ZIP file to your issue report")]})}),a.jsxs("div",{className:"p-4 bg-bambu-dark rounded-lg space-y-3",children:[a.jsx("p",{className:"text-sm font-medium text-white",children:t("support.privacyTitle","What's in the support bundle?")}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 text-sm",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-bambu-green font-medium mb-1",children:t("support.collected","Collected:")}),a.jsxs("ul",{className:"text-bambu-gray space-y-0.5",children:[a.jsxs("li",{children:["• ",t("support.collectItem1","App version and debug mode")]}),a.jsxs("li",{children:["• ",t("support.collectItem2","OS, architecture, Python version")]}),a.jsxs("li",{children:["• ",t("support.collectItem3","Database statistics (counts only)")]}),a.jsxs("li",{children:["• ",t("support.collectItem4","Printer models and nozzle counts")]}),a.jsxs("li",{children:["• ",t("support.collectItem5","Non-sensitive settings (themes, formats)")]}),a.jsxs("li",{children:["• ",t("support.collectItem6","Debug logs (sanitized)")]}),a.jsxs("li",{children:["• ",t("support.collectItem7","Printer connectivity and firmware versions")]}),a.jsxs("li",{children:["• ",t("support.collectItem8","Integration status (Spoolman, MQTT, HA)")]}),a.jsxs("li",{children:["• ",t("support.collectItem9","Network interfaces (subnets only)")]}),a.jsxs("li",{children:["• ",t("support.collectItem10","Python package versions")]}),a.jsxs("li",{children:["• ",t("support.collectItem11","Database health checks")]}),a.jsxs("li",{children:["• ",t("support.collectItem12","Docker environment details")]})]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-red-400 font-medium mb-1",children:t("support.notCollected","NOT collected:")}),a.jsxs("ul",{className:"text-bambu-gray space-y-0.5",children:[a.jsxs("li",{children:["• ",t("support.notItem1","Printer names and serial numbers")]}),a.jsxs("li",{children:["• ",t("support.notItem2","Access codes and passwords")]}),a.jsxs("li",{children:["• ",t("support.notItem3","Email addresses")]}),a.jsxs("li",{children:["• ",t("support.notItem4","API keys and tokens")]}),a.jsxs("li",{children:["• ",t("support.notItem5","Webhook URLs")]}),a.jsxs("li",{children:["• ",t("support.notItem6","Your hostname or username")]}),a.jsxs("li",{children:["• ",t("support.notItem7","IP addresses")]})]})]})]}),a.jsx("p",{className:"text-xs text-bambu-gray/70",children:t("support.privacyNote","Email addresses in logs are replaced with [EMAIL], printer names with [PRINTER], serial numbers with [SERIAL], and IP addresses with [IP].")})]}),a.jsx(Wnt,{})]})}),a.jsxs(sh,{title:t("system.database","Database"),icon:Wl,children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[a.jsx(wa,{icon:Wl,label:t("system.dbEngine","Database Engine"),value:c.database.engine||"SQLite"}),a.jsx(wa,{icon:Wl,label:t("system.dbVersion","Version"),value:c.database.version||"unknown"})]}),a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-4",children:[a.jsx(wa,{icon:ro,label:t("system.totalArchives","Total Archives"),value:c.database.archives}),a.jsx(wa,{icon:Ec,label:t("system.completed","Completed"),value:c.database.archives_completed,color:"text-green-500"}),a.jsx(wa,{icon:Xa,label:t("system.failed","Failed"),value:c.database.archives_failed,color:"text-red-500"}),a.jsx(wa,{icon:dt,label:t("system.printing","Printing"),value:c.database.archives_printing,color:"text-yellow-500"})]}),a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[a.jsx(wa,{icon:Tr,label:t("system.printers","Printers"),value:c.database.printers}),a.jsx(wa,{icon:jw,label:t("system.filaments","Filaments"),value:c.database.filaments}),a.jsx(wa,{icon:Os,label:t("system.projects","Projects"),value:c.database.projects}),a.jsx(wa,{icon:Xl,label:t("system.smartPlugs","Smart Plugs"),value:c.database.smart_plugs})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mt-4",children:[a.jsx(wa,{icon:rr,label:t("system.totalPrintTime","Total Print Time"),value:c.database.total_print_time_formatted}),a.jsx(wa,{icon:ro,label:t("system.totalFilament","Total Filament Used"),value:`${c.database.total_filament_kg} kg`,subValue:`${c.database.total_filament_grams.toLocaleString()} g`})]})]}),a.jsxs(sh,{title:t("system.connectedPrinters","Connected Printers"),icon:Tr,children:[a.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[a.jsx("div",{className:"text-3xl font-bold text-bambu-green",children:c.printers.connected}),a.jsx("div",{className:"text-bambu-gray",children:t("system.ofTotal","of {{total}} printers connected",{total:c.printers.total})})]}),c.printers.connected_list.length>0?a.jsx("div",{className:"space-y-2",children:c.printers.connected_list.map(P=>a.jsxs("div",{className:"flex items-center justify-between p-3 bg-bambu-dark rounded-lg",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-2 h-2 rounded-full bg-bambu-green"}),a.jsx("span",{className:"font-medium text-white",children:P.name})]}),a.jsxs("div",{className:"flex items-center gap-4 text-sm text-bambu-gray",children:[a.jsx("span",{children:P.model}),a.jsx("span",{className:`px-2 py-0.5 rounded ${P.state==="RUNNING"?"bg-bambu-green/20 text-bambu-green":P.state==="IDLE"?"bg-blue-500/20 text-blue-400":"bg-bambu-dark-tertiary"}`,children:P.state})]})]},P.id))}):a.jsx("p",{className:"text-bambu-gray",children:t("system.noPrintersConnected","No printers connected")})]}),a.jsx(sh,{title:t("system.storage","Storage"),icon:ty,children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{className:"text-bambu-gray",children:t("system.diskUsage","Disk Usage")}),a.jsxs("span",{className:"text-white",children:[c.storage.disk_used_formatted," / ",c.storage.disk_total_formatted]})]}),a.jsx(sX,{percent:c.storage.disk_percent_used,color:_}),a.jsxs("p",{className:"text-xs text-bambu-gray mt-1",children:[c.storage.disk_free_formatted," ",t("system.free","free")," (",(100-c.storage.disk_percent_used).toFixed(1),"%)"]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[a.jsx(wa,{icon:ro,label:t("system.archiveStorage","Archive Storage"),value:c.storage.archive_size_formatted}),a.jsx(wa,{icon:Wl,label:t("system.databaseSize","Database Size"),value:c.storage.database_size_formatted}),y&&a.jsx(wa,{icon:Uc,label:t("system.fileManagerStorage","File Manager"),value:Knt(y.total_size_bytes),subValue:`${y.total_files} files, ${y.total_folders} folders`})]})]})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx(sh,{title:t("system.memory","Memory"),icon:Rge,children:a.jsx("div",{className:"space-y-4",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{className:"text-bambu-gray",children:t("system.memoryUsage","Memory Usage")}),a.jsxs("span",{className:"text-white",children:[c.memory.used_formatted," / ",c.memory.total_formatted]})]}),a.jsx(sX,{percent:c.memory.percent_used,color:N}),a.jsxs("p",{className:"text-xs text-bambu-gray mt-1",children:[c.memory.available_formatted," ",t("system.available","available")]})]})})}),a.jsx(sh,{title:t("system.cpu","CPU"),icon:__,children:a.jsx("div",{className:"space-y-4",children:a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(wa,{icon:__,label:t("system.cores","Cores"),value:c.cpu.count,subValue:`${c.cpu.count_logical} logical`}),a.jsx(wa,{icon:__,label:t("system.usage","Usage"),value:`${c.cpu.percent}%`})]})})})]}),a.jsx(sh,{title:t("system.systemDetails","System Details"),icon:Kp,children:a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[a.jsx(wa,{icon:Kp,label:t("system.os","Operating System"),value:c.system.platform,subValue:c.system.platform_release}),a.jsx(wa,{icon:__,label:t("system.architecture","Architecture"),value:c.system.architecture}),a.jsx(wa,{icon:Kp,label:t("system.python","Python"),value:c.system.python_version}),a.jsx(wa,{icon:rr,label:t("system.bootTime","Boot Time"),value:$f(c.system.boot_time,v)})]})})]})}function Xnt(){const t=zo(),{t:e}=Lt(),{login:n}=Ar(),{showToast:r}=xn(),{mode:i}=mg(),[s,o]=w.useState(""),[l,c]=w.useState(""),[d,u]=w.useState(!1),[m,p]=w.useState(""),{data:f}=Je({queryKey:["advancedAuthStatus"],queryFn:()=>pe.getAdvancedAuthStatus()}),y=ct({mutationFn:()=>n(s,l),onSuccess:()=>{r(e("login.loginSuccess")),t("/")},onError:_=>{r(_.message||e("login.loginFailed"),"error")}}),v=ct({mutationFn:_=>pe.forgotPassword({email:_}),onSuccess:_=>{r(_.message,"success"),u(!1),p("")},onError:_=>{r(_.message,"error")}}),g=_=>{if(_.preventDefault(),!s||!l){r(e("login.enterCredentials"),"error");return}y.mutate()},b=_=>{if(_.preventDefault(),!m){r("Please enter your email address","error");return}v.mutate(m)};return a.jsxs("div",{className:"min-h-screen flex items-center justify-center bg-bambu-dark p-4",children:[a.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:[a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"flex items-center justify-center mb-6",children:a.jsx("img",{src:i==="dark"?"/img/bambuddy_logo_dark_transparent.png":"/img/bambuddy_logo_light.png",alt:"Bambuddy",className:"h-16"})}),a.jsx("h2",{className:"text-3xl font-bold text-white",children:e("login.title")}),a.jsx("p",{className:"mt-2 text-sm text-bambu-gray",children:e("login.subtitle")})]}),a.jsxs("form",{className:"mt-8 space-y-6",onSubmit:g,children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-white mb-2",children:f?.advanced_auth_enabled?e("login.usernameOrEmail")||"Username or Email":e("login.username")}),a.jsx("input",{id:"username",type:"text",required:!0,value:s,onChange:_=>o(_.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:f?.advanced_auth_enabled?e("login.usernameOrEmailPlaceholder")||"Enter your username or email":e("login.usernamePlaceholder"),autoComplete:"username"})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-white mb-2",children:e("login.password")}),a.jsx("input",{id:"password",type:"password",required:!0,value:l,onChange:_=>c(_.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:e("login.passwordPlaceholder"),autoComplete:"current-password"})]})]}),a.jsx("div",{children:a.jsx("button",{type:"submit",disabled:y.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:y.isPending?e("login.signingIn"):e("login.signIn")})}),f?.advanced_auth_enabled&&a.jsx("div",{className:"text-center",children:a.jsx("button",{type:"button",onClick:()=>u(!0),className:"text-sm text-bambu-gray hover:text-bambu-green transition-colors",children:e("login.forgotPassword")})})]})]}),d&&a.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",onClick:()=>u(!1),children:a.jsxs(Dt,{className:"w-full max-w-md",onClick:_=>_.stopPropagation(),children:[a.jsx(Dn,{children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(vx,{className:"w-5 h-5 text-bambu-green"}),a.jsx("h2",{className:"text-lg font-semibold text-white",children:e("login.forgotPasswordTitle")})]}),a.jsx(Ie,{variant:"ghost",size:"sm",onClick:()=>{u(!1),p("")},children:a.jsx(Ht,{className:"w-5 h-5"})})]})}),a.jsx(Rt,{children:f?.advanced_auth_enabled?a.jsxs("form",{onSubmit:b,className:"space-y-4",children:[a.jsx("p",{className:"text-bambu-gray text-sm",children:e("login.forgotPasswordEmailMessage")||"Enter your email address and we'll send you a new password."}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"forgot-email",className:"block text-sm font-medium text-white mb-2",children:e("login.emailAddress")||"Email Address"}),a.jsx("input",{id:"forgot-email",type:"email",required:!0,value:m,onChange:_=>p(_.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:e("login.emailPlaceholder")||"your.email@example.com"})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Ie,{type:"button",variant:"secondary",className:"flex-1",onClick:()=>{u(!1),p("")},children:e("login.cancel")||"Cancel"}),a.jsx(Ie,{type:"submit",className:"flex-1",disabled:v.isPending,children:v.isPending?e("login.sending")||"Sending...":e("login.sendResetEmail")||"Send Reset Email"})]})]}):a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-bambu-gray",children:e("login.forgotPasswordMessage")}),a.jsxs("div",{className:"bg-bambu-dark rounded-lg p-4 space-y-2",children:[a.jsx("p",{className:"text-sm text-white font-medium",children:e("login.howToReset")}),a.jsxs("ol",{className:"text-sm text-bambu-gray space-y-1 list-decimal list-inside",children:[a.jsx("li",{children:e("login.resetStep1")}),a.jsx("li",{children:e("login.resetStep2")}),a.jsx("li",{children:e("login.resetStep3")}),a.jsx("li",{children:e("login.resetStep4")})]})]}),a.jsx(Ie,{variant:"secondary",className:"w-full",onClick:()=>u(!1),children:e("login.gotIt")})]})})]})})]})}function Qnt(){const t=zo(),{t:e}=Lt(),{showToast:n}=xn(),{mode:r}=mg(),{refreshAuth:i}=Ar(),[s,o]=w.useState(!1),[l,c]=w.useState(""),[d,u]=w.useState(""),[m,p]=w.useState(""),f=ct({mutationFn:()=>pe.setupAuth({auth_enabled:s,admin_username:s?l:void 0,admin_password:s?d:void 0}),onSuccess:async v=>{await i(),v.auth_enabled?v.admin_created?(n(e("setup.toast.authEnabledAdminCreated")),t("/login")):(n(e("setup.toast.authEnabledExistingAdmins")),t("/login")):(n(e("setup.toast.setupCompleted")),t("/"))},onError:v=>{n(v.message,"error")}}),y=v=>{if(v.preventDefault(),s&&(l||d)){if(!l||!d){n(e("setup.toast.enterBothCredentials"),"error");return}if(d!==m){n(e("setup.toast.passwordsDoNotMatch"),"error");return}if(d.length<6){n(e("setup.toast.passwordTooShort"),"error");return}}f.mutate()};return a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-bambu-dark p-4",children:a.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:[a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"flex items-center justify-center mb-6",children:a.jsx("img",{src:r==="dark"?"/img/bambuddy_logo_dark_transparent.png":"/img/bambuddy_logo_light.png",alt:"Bambuddy",className:"h-16"})}),a.jsx("h2",{className:"text-3xl font-bold text-white",children:e("setup.title")}),a.jsx("p",{className:"mt-2 text-sm text-bambu-gray",children:e("setup.subtitle")})]}),a.jsxs("form",{className:"mt-8 space-y-6",onSubmit:y,children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center p-4 bg-bambu-dark-secondary/50 rounded-lg border border-bambu-dark-tertiary",children:[a.jsx("input",{id:"auth-enabled",type:"checkbox",checked:s,onChange:v=>o(v.target.checked),className:"h-4 w-4 text-bambu-green focus:ring-bambu-green border-bambu-dark-tertiary rounded bg-bambu-dark-secondary"}),a.jsx("label",{htmlFor:"auth-enabled",className:"ml-3 block text-sm font-medium text-white",children:e("setup.enableAuth")})]}),s&&a.jsxs("div",{className:"space-y-4 mt-4",children:[a.jsx("div",{className:"p-3 bg-bambu-dark-secondary/50 border border-bambu-dark-tertiary rounded-lg",children:a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(eo,{className:"w-4 h-4 text-bambu-green mt-0.5 flex-shrink-0"}),a.jsxs("div",{className:"text-sm text-bambu-gray",children:[a.jsx("p",{className:"text-white font-medium mb-1",children:e("setup.adminAccount")}),a.jsx("p",{children:e("setup.adminAccountDesc")})]})]})}),a.jsxs("div",{children:[a.jsxs("label",{htmlFor:"admin-username",className:"block text-sm font-medium text-white mb-2",children:[e("setup.adminUsername")," ",a.jsx("span",{className:"text-bambu-gray text-xs",children:e("setup.optionalIfAdminExists")})]}),a.jsx("input",{id:"admin-username",type:"text",value:l,onChange:v=>c(v.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:e("setup.adminUsernamePlaceholder"),autoComplete:"username"})]}),a.jsxs("div",{children:[a.jsxs("label",{htmlFor:"admin-password",className:"block text-sm font-medium text-white mb-2",children:[e("setup.adminPassword")," ",a.jsx("span",{className:"text-bambu-gray text-xs",children:e("setup.optionalIfAdminExists")})]}),a.jsx("input",{id:"admin-password",type:"password",value:d,onChange:v=>u(v.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:e("setup.adminPasswordPlaceholder"),minLength:6,autoComplete:"new-password"})]}),d&&a.jsxs("div",{children:[a.jsx("label",{htmlFor:"confirm-password",className:"block text-sm font-medium text-white mb-2",children:e("setup.confirmPassword")}),a.jsx("input",{id:"confirm-password",type:"password",value:m,onChange:v=>p(v.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:e("setup.confirmPasswordPlaceholder"),minLength:6,autoComplete:"new-password"})]})]})]}),a.jsx("div",{children:a.jsx("button",{type:"submit",disabled:f.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:f.isPending?e("setup.settingUp"):e("setup.completeSetup")})})]})]})})}function Znt(){const{t}=Lt(),{user:e}=Ar(),{showToast:n}=xn(),r=hn(),i=zo(),[s,o]=w.useState(!0),[l,c]=w.useState(!0),[d,u]=w.useState(!0),[m,p]=w.useState(!0),[f,y]=w.useState(!1),{data:v,isLoading:g}=Je({queryKey:["advancedAuthStatus"],queryFn:pe.getAdvancedAuthStatus,staleTime:300*1e3}),{data:b,isLoading:_}=Je({queryKey:["settings"],queryFn:pe.getSettings,staleTime:300*1e3}),{data:N,isLoading:P}=Je({queryKey:["user-email-preferences"],queryFn:()=>pe.getUserEmailPreferences()});w.useEffect(()=>{(v&&!v.advanced_auth_enabled||b&&!b.user_notifications_enabled)&&i("/settings",{replace:!0})},[v,b,i]),w.useEffect(()=>{N&&(o(N.notify_print_start),c(N.notify_print_complete),u(N.notify_print_failed),p(N.notify_print_stopped),y(!1))},[N]);const k=ct({mutationFn:()=>pe.updateUserEmailPreferences({notify_print_start:s,notify_print_complete:l,notify_print_failed:d,notify_print_stopped:m}),onSuccess:()=>{r.invalidateQueries({queryKey:["user-email-preferences"]}),y(!1),n(t("notifications.userEmail.saveSuccess"),"success")},onError:T=>{n(T.message||t("notifications.userEmail.saveError"),"error")}}),M=(T,A)=>{T(!A),y(!0)};return P||g||_?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx(dt,{className:"w-8 h-8 animate-spin text-bambu-green"})}):a.jsxs("div",{className:"p-4 md:p-6 max-w-2xl mx-auto",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[a.jsx(Rh,{className:"w-7 h-7 text-bambu-green"}),a.jsx("h1",{className:"text-2xl font-bold text-white",children:t("notifications.userEmail.title")})]}),a.jsx(Dt,{className:"mb-6 border-blue-500/30 bg-blue-500/5",children:a.jsx(Rt,{className:"py-4",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center bg-blue-500/20 flex-shrink-0",children:a.jsx(vx,{className:"w-5 h-5 text-blue-400"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-white font-medium",children:t("notifications.userEmail.emailNotifications")}),a.jsx("p",{className:"text-sm text-bambu-gray mt-1",children:t("notifications.userEmail.emailNotificationsDesc")}),e?.email?a.jsxs("p",{className:"text-sm text-blue-400 mt-2",children:[t("notifications.userEmail.sendingTo"),": ",a.jsx("strong",{children:e.email})]}):a.jsx("p",{className:"text-sm text-yellow-400 mt-2",children:t("notifications.userEmail.noEmailWarning")})]})]})})}),a.jsxs(Dt,{className:"mb-6",children:[a.jsxs(Dn,{children:[a.jsx("h2",{className:"text-lg font-semibold text-white",children:t("notifications.userEmail.printJobNotifications")}),a.jsx("p",{className:"text-sm text-bambu-gray mt-1",children:t("notifications.userEmail.printJobNotificationsDesc")})]}),a.jsxs(Rt,{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between p-4 bg-bambu-dark rounded-lg",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`w-10 h-10 rounded-full flex items-center justify-center ${s?"bg-bambu-green/20":"bg-bambu-dark-tertiary"}`,children:a.jsx(Ec,{className:`w-5 h-5 ${s?"text-bambu-green":"text-bambu-gray"}`})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-white font-medium",children:t("notifications.userEmail.printJobStarts")}),a.jsx("p",{className:"text-sm text-bambu-gray",children:t("notifications.userEmail.printJobStartsDesc")})]})]}),a.jsx("button",{onClick:()=>M(o,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:a.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${s?"translate-x-6":"translate-x-1"}`})})]}),a.jsxs("div",{className:"flex items-center justify-between p-4 bg-bambu-dark rounded-lg",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`w-10 h-10 rounded-full flex items-center justify-center ${l?"bg-bambu-green/20":"bg-bambu-dark-tertiary"}`,children:a.jsx(Ec,{className:`w-5 h-5 ${l?"text-bambu-green":"text-bambu-gray"}`})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-white font-medium",children:t("notifications.userEmail.printJobFinishes")}),a.jsx("p",{className:"text-sm text-bambu-gray",children:t("notifications.userEmail.printJobFinishesDesc")})]})]}),a.jsx("button",{onClick:()=>M(c,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:a.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${l?"translate-x-6":"translate-x-1"}`})})]}),a.jsxs("div",{className:"flex items-center justify-between p-4 bg-bambu-dark rounded-lg",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`w-10 h-10 rounded-full flex items-center justify-center ${d?"bg-bambu-green/20":"bg-bambu-dark-tertiary"}`,children:a.jsx(Ec,{className:`w-5 h-5 ${d?"text-bambu-green":"text-bambu-gray"}`})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-white font-medium",children:t("notifications.userEmail.printErrors")}),a.jsx("p",{className:"text-sm text-bambu-gray",children:t("notifications.userEmail.printErrorsDesc")})]})]}),a.jsx("button",{onClick:()=>M(u,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:a.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${d?"translate-x-6":"translate-x-1"}`})})]}),a.jsxs("div",{className:"flex items-center justify-between p-4 bg-bambu-dark rounded-lg",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`w-10 h-10 rounded-full flex items-center justify-center ${m?"bg-bambu-green/20":"bg-bambu-dark-tertiary"}`,children:a.jsx(Ec,{className:`w-5 h-5 ${m?"text-bambu-green":"text-bambu-gray"}`})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-white font-medium",children:t("notifications.userEmail.printJobStops")}),a.jsx("p",{className:"text-sm text-bambu-gray",children:t("notifications.userEmail.printJobStopsDesc")})]})]}),a.jsx("button",{onClick:()=>M(p,m),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 ${m?"bg-bambu-green":"bg-bambu-dark-tertiary"}`,role:"switch","aria-checked":m,children:a.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${m?"translate-x-6":"translate-x-1"}`})})]})]})]}),a.jsx("div",{className:"flex justify-end",children:a.jsx(Ie,{onClick:()=>k.mutate(),disabled:!f||k.isPending||!e?.email,children:k.isPending?a.jsxs(a.Fragment,{children:[a.jsx(dt,{className:"w-4 h-4 animate-spin"}),t("common.saving")]}):a.jsxs(a.Fragment,{children:[a.jsx(fs,{className:"w-4 h-4"}),t("common.save")]})})})]})}function Jnt(){const t=w.useRef(null),e=w.useRef(null),n=hn(),[r,i]=w.useState(!1),s=w.useRef(new Map),{showToast:o}=xn(),{t:l}=Lt(),c=w.useRef(new Set),d=w.useRef(null),u=w.useRef(new Map),m=w.useRef(null),p=w.useRef([]),f=w.useRef(!1),y=w.useRef(()=>{}),v=w.useCallback(()=>{if(f.current||p.current.length===0)return;f.current=!0;const k=()=>{const M=p.current.shift();M?requestAnimationFrame(()=>{y.current(M),p.current.length>0?setTimeout(k,16):f.current=!1}):f.current=!1};k()},[]),g=w.useCallback(()=>{if(t.current?.readyState===WebSocket.OPEN)return;const M=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/v1/ws`,T=new WebSocket(M);let A=null;T.onopen=()=>{console.log("[WebSocket] Connected"),i(!0),A=window.setInterval(()=>{T.readyState===WebSocket.OPEN&&T.send(JSON.stringify({type:"ping"}))},3e4)},T.onmessage=C=>{try{const F=JSON.parse(C.data);F.type==="printer_status"&&F.printer_id!==void 0&&F.data?y.current(F):(p.current.push(F),v())}catch{}},T.onclose=C=>{console.log("[WebSocket] Closed",C.code,C.reason),A&&(clearInterval(A),A=null),i(!1),t.current=null,e.current=window.setTimeout(()=>{g()},3e3)},T.onerror=C=>{console.error("[WebSocket] Error",C),T.close()},t.current=T},[v]),b=w.useCallback((k,M)=>{const T=u.current.get(k)||{};u.current.set(k,{...T,...M}),m.current||(m.current=window.setTimeout(()=>{const A=new Map(u.current);u.current.clear(),m.current=null,requestAnimationFrame(()=>{A.forEach((C,F)=>{n.setQueryData(["printerStatus",F],$=>{const I={...$,...C};return I.wifi_signal==null&&$?.wifi_signal!=null&&(I.wifi_signal=$.wifi_signal),I})})})},100))},[n]),_=w.useCallback(k=>{c.current.add(k),d.current&&clearTimeout(d.current),d.current=window.setTimeout(()=>{const M=Array.from(c.current);c.current.clear(),d.current=null;let T=0;M.forEach(A=>{setTimeout(()=>{requestAnimationFrame(()=>{n.invalidateQueries({queryKey:[A]})})},T),T+=500})},3e3)},[n]),N=w.useCallback(k=>{switch(k.type){case"printer_status":k.printer_id!==void 0&&k.data&&b(k.printer_id,k.data);break;case"print_start":k.printer_id!==void 0&&n.invalidateQueries({queryKey:["printerStatus",k.printer_id]});break;case"missing_spool_assignment":{if(k.printer_id===void 0||!Array.isArray(k.missing_slots))break;const M=k.missing_slots.map(F=>F&&typeof F.slot=="string"?F.slot:"Unknown").filter(F=>F.length>0);if(M.length===0){s.current.delete(k.printer_id);break}const T=M.join("|");if(s.current.get(k.printer_id)===T)break;s.current.set(k.printer_id,T);const A=k.printer_name||`Printer ${k.printer_id}`,C=l("printers.toast.missingSpoolAssignment",{printer:A,slots:M.join(", ")});o(C,"warning");break}case"print_complete":_("archives"),_("archiveStats");break;case"archive_created":_("archives"),_("archiveStats");break;case"archive_updated":_("archives");break;case"pong":break;case"plate_not_empty":window.dispatchEvent(new CustomEvent("plate-not-empty",{detail:{printer_id:k.printer_id,printer_name:k.printer_name,message:k.message}}));break;case"inventory_changed":_("inventory-spools");break;case"spool_assignment_changed":_("spool-assignments"),_("slotPresets");break;case"spool_auto_assigned":_("inventory-spools"),_("spool-assignments");break;case"spool_usage_logged":_("inventory-spools");break;case"unknown_tag":window.dispatchEvent(new CustomEvent("unknown-tag",{detail:{printer_id:k.printer_id,ams_id:k.ams_id,tray_id:k.tray_id,tag_uid:k.tag_uid,tray_uuid:k.tray_uuid}}));break;case"background_dispatch":window.dispatchEvent(new CustomEvent("background-dispatch",{detail:k.data||{}}));break;case"spoolbuddy_weight":window.dispatchEvent(new CustomEvent("spoolbuddy-weight",{detail:k}));break;case"spoolbuddy_tag_matched":window.dispatchEvent(new CustomEvent("spoolbuddy-tag-matched",{detail:k})),_("inventory-spools");break;case"spoolbuddy_unknown_tag":window.dispatchEvent(new CustomEvent("spoolbuddy-unknown-tag",{detail:k}));break;case"spoolbuddy_tag_removed":window.dispatchEvent(new CustomEvent("spoolbuddy-tag-removed",{detail:k}));break;case"spoolbuddy_tag_written":window.dispatchEvent(new CustomEvent("spoolbuddy-tag-written",{detail:k})),_("inventory-spools");break;case"spoolbuddy_tag_write_failed":window.dispatchEvent(new CustomEvent("spoolbuddy-tag-write-failed",{detail:k}));break;case"spoolbuddy_online":window.dispatchEvent(new CustomEvent("spoolbuddy-online",{detail:k})),_("spoolbuddy-devices"),_("spoolbuddy-update-check");break;case"spoolbuddy_offline":window.dispatchEvent(new CustomEvent("spoolbuddy-offline",{detail:k})),_("spoolbuddy-devices");break;case"spoolbuddy_update":_("spoolbuddy-devices"),_("spoolbuddy-update-check");break}},[n,_,b,o,l]);w.useEffect(()=>{y.current=N},[N]),w.useEffect(()=>(g(),()=>{e.current&&clearTimeout(e.current),d.current&&clearTimeout(d.current),m.current&&clearTimeout(m.current),t.current&&t.current.close()}),[g]);const P=w.useCallback(k=>{t.current?.readyState===WebSocket.OPEN&&t.current.send(JSON.stringify(k))},[]);return{isConnected:r,sendMessage:P}}function ert(){const{authEnabled:t}=Ar(),e=hn(),n=w.useRef(!1),{data:r}=Je({queryKey:["camera-stream-token"],queryFn:()=>pe.getCameraStreamToken(),enabled:t,staleTime:3e3*1e3,refetchInterval:3e3*1e3});w.useEffect(()=>(u6(r?.token??null),()=>u6(null)),[r?.token]),w.useEffect(()=>{if(!t)return;const i=s=>{const o=s.target;if(!(o instanceof HTMLImageElement||o instanceof HTMLVideoElement))return;const l=o.src||"",c=Txe();!c||!l.includes(`token=${encodeURIComponent(c)}`)||n.current||(n.current=!0,e.invalidateQueries({queryKey:["camera-stream-token"]}),setTimeout(()=>{n.current=!1},5e3))};return document.addEventListener("error",i,!0),()=>document.removeEventListener("error",i,!0)},[t,e])}function trt({selectedPrinterId:t,onPrinterChange:e,deviceOnline:n}){const{t:r}=Lt(),[i,s]=w.useState(new Date),{data:o=[]}=Je({queryKey:["printers"],queryFn:()=>pe.getPrinters()}),l=op({queries:o.map(u=>({queryKey:["printerStatus",u.id],queryFn:()=>pe.getPrinterStatus(u.id),refetchInterval:1e4}))}),c=w.useMemo(()=>o.filter((u,m)=>l[m]?.data?.connected),[o,l]);w.useEffect(()=>{const u=c.some(m=>m.id===t);(!t||!u)&&c.length>0&&e(c[0].id)},[c,t,e]);const{data:d}=Je({queryKey:["settings"],queryFn:pe.getSettings});return w.useEffect(()=>{const u=setInterval(()=>s(new Date),1e3);return()=>clearInterval(u)},[]),a.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:[a.jsx("div",{className:"flex items-center shrink-0",children:a.jsx("img",{src:"/img/spoolbuddy_logo_dark_small.png",alt:"SpoolBuddy",width:113,height:28,className:"h-7 w-auto"})}),a.jsx("div",{className:"flex-1 flex justify-center",children:a.jsx("select",{value:t??"",onChange:u=>e(Number(u.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?a.jsx("option",{value:"",children:r("spoolbuddy.status.noPrinters","No printers online")}):c.map(u=>a.jsx("option",{value:u.id,children:u.name},u.id))})}),a.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[a.jsx("div",{className:"flex items-center",title:n?r("spoolbuddy.status.backend","Backend"):r("spoolbuddy.status.offline","Offline"),children:n?a.jsx("div",{className:"flex items-end gap-0.5 h-4",children:[1,2,3,4].map(u=>a.jsx("div",{className:`w-1 rounded-sm ${u<=4?"bg-white":"bg-bambu-dark-tertiary"}`,style:{height:`${u*4}px`}},u))}):a.jsx(nm,{className:"w-5 h-5 text-red-400"})}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.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"}`}),a.jsx("span",{className:"text-sm text-white/50",children:n?r("spoolbuddy.status.backend","Backend"):r("spoolbuddy.status.offline","Offline")})]}),a.jsx("span",{className:"text-white/50 text-base font-mono min-w-[50px] text-right",children:AQ(i,d?.time_format||"system")})]})]})}const nrt=[{to:"/spoolbuddy",labelKey:"spoolbuddy.nav.dashboard",fallback:"Dashboard",icon:a.jsx("svg",{className:"w-6 h-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:a.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:a.jsx("svg",{className:"w-6 h-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:a.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:a.jsxs("svg",{className:"w-6 h-6",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[a.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"}),a.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:a.jsx("svg",{className:"w-6 h-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:a.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:a.jsxs("svg",{className:"w-6 h-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[a.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"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}];function rrt(){const{t}=Lt();return a.jsx("nav",{className:"h-14 bg-bambu-dark-secondary border-t border-bambu-dark-tertiary flex items-stretch shrink-0",children:nrt.map(e=>a.jsxs(Wb,{to:e.to,end:e.to==="/spoolbuddy",className:({isActive:n})=>`flex-1 flex flex-col items-center justify-center gap-1 transition-colors ${n?"text-bambu-green bg-bambu-dark":"text-white/50 hover:text-white/70 hover:bg-bambu-dark-tertiary"}`,children:[e.icon,a.jsx("span",{className:"text-xs font-medium",children:t(e.labelKey,e.fallback)})]},e.to))})}function art({alert:t}){const{t:e}=Lt(),n=t?t.type==="error"?"bg-red-500":t.type==="warning"?"bg-amber-500":"bg-bambu-green":"bg-bambu-green",r=t?t.type==="error"?"border-red-500":t.type==="warning"?"border-amber-500":"border-bambu-dark-tertiary":"border-bambu-dark-tertiary";return a.jsxs("div",{className:`h-9 bg-bambu-dark-secondary border-t-2 ${r} flex items-center px-3 gap-3 shrink-0`,children:[a.jsx("div",{className:`w-3.5 h-3.5 rounded-full ${n}`}),a.jsx("div",{className:"flex-1 text-sm text-white/50 truncate",children:t?a.jsx("span",{children:t.message}):a.jsx("span",{className:"text-bambu-green",children:e("spoolbuddy.status.systemReady","System Ready")})})]})}const irt={weight:null,weightStable:!1,rawAdc:null,matchedSpool:null,unknownTagUid:null,deviceOnline:!1,deviceId:null};function srt(t,e){switch(e.type){case"WEIGHT_UPDATE":return{...t,weight:e.weight,weightStable:e.stable,rawAdc:e.rawAdc,deviceId:e.deviceId,deviceOnline:!0};case"TAG_MATCHED":return{...t,matchedSpool:e.spool,unknownTagUid:null,deviceId:e.deviceId};case"UNKNOWN_TAG":return{...t,matchedSpool:null,unknownTagUid:e.tagUid,deviceId:e.deviceId};case"TAG_REMOVED":return{...t,matchedSpool:null,unknownTagUid:null};case"DEVICE_ONLINE":return{...t,deviceOnline:!0,deviceId:e.deviceId};case"DEVICE_OFFLINE":return{...t,deviceOnline:!1,weight:null,weightStable:!1,rawAdc:null};default:return t}}function ort(){const[t,e]=w.useReducer(srt,irt),n=w.useCallback(u=>{const m=u.detail;e({type:"WEIGHT_UPDATE",weight:m.weight_grams??m.data?.weight_grams,stable:m.stable??m.data?.stable??!1,rawAdc:m.raw_adc??m.data?.raw_adc??null,deviceId:m.device_id??m.data?.device_id??""})},[]),r=w.useCallback(u=>{const m=u.detail,p=m.spool??m.data?.spool;p&&e({type:"TAG_MATCHED",spool:{id:p.id,tag_uid:m.tag_uid??m.data?.tag_uid??"",material:p.material??"",subtype:p.subtype??null,color_name:p.color_name??null,rgba:p.rgba??null,brand:p.brand??null,label_weight:p.label_weight??0,core_weight:p.core_weight??0,weight_used:p.weight_used??0},deviceId:m.device_id??m.data?.device_id??""})},[]),i=w.useCallback(u=>{const m=u.detail;e({type:"UNKNOWN_TAG",tagUid:m.tag_uid??m.data?.tag_uid??"",deviceId:m.device_id??m.data?.device_id??""})},[]),s=w.useCallback(u=>{const m=u.detail;e({type:"TAG_REMOVED",deviceId:m.device_id??m.data?.device_id??""})},[]),o=w.useCallback(u=>{const m=u.detail;e({type:"DEVICE_ONLINE",deviceId:m.device_id??m.data?.device_id??""})},[]),l=w.useCallback(u=>{const m=u.detail;e({type:"DEVICE_OFFLINE",deviceId:m.device_id??m.data?.device_id??""})},[]);w.useEffect(()=>(window.addEventListener("spoolbuddy-weight",n),window.addEventListener("spoolbuddy-tag-matched",r),window.addEventListener("spoolbuddy-unknown-tag",i),window.addEventListener("spoolbuddy-tag-removed",s),window.addEventListener("spoolbuddy-online",o),window.addEventListener("spoolbuddy-offline",l),()=>{window.removeEventListener("spoolbuddy-weight",n),window.removeEventListener("spoolbuddy-tag-matched",r),window.removeEventListener("spoolbuddy-unknown-tag",i),window.removeEventListener("spoolbuddy-tag-removed",s),window.removeEventListener("spoolbuddy-online",o),window.removeEventListener("spoolbuddy-offline",l)}),[n,r,i,s,o,l]);const c=t.matchedSpool?Math.max(0,t.matchedSpool.label_weight-t.matchedSpool.weight_used):null,d=t.weight!==null&&t.matchedSpool?Math.max(0,t.weight-t.matchedSpool.core_weight):null;return{...t,remainingWeight:c,netWeight:d}}var Uk={exports:{}};var lrt=Uk.exports,oX;function crt(){return oX||(oX=1,(function(t,e){(function(n,r){t.exports=r(dg())})(lrt,(function(n){return(function(){var r={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(l){if("Element"in l){var c="classList",d="prototype",u=l.Element[d],m=Object,p=String[d].trim||function(){return this.replace(/^\s+|\s+$/g,"")},f=Array[d].indexOf||function(P){for(var k=0,M=this.length;k1?arguments[1]:void 0)}},7916:function(B,W,D){var j=D(6080),z=D(9565),K=D(8981),q=D(6319),ce=D(4209),O=D(3517),G=D(6198),X=D(4659),V=D(4527),ee=D(81),se=D(851),me=Array;B.exports=function(he){var oe=K(he),U=O(this),R=arguments.length,ne=R>1?arguments[1]:void 0,ge=ne!==void 0;ge&&(ne=j(ne,R>2?arguments[2]:void 0));var we,be,ye,fe,Se,Ee,Me=se(oe),_e=0;if(!Me||this===me&&ce(Me))for(we=G(oe),be=U?new this(we):me(we);we>_e;_e++)Ee=ge?ne(oe[_e],_e):oe[_e],X(be,_e,Ee);else for(be=U?new this:[],Se=(fe=ee(oe,Me)).next;!(ye=z(Se,fe)).done;_e++)Ee=ge?q(fe,ne,[ye.value,_e],!0):ye.value,X(be,_e,Ee);return V(be,_e),be}},9617:function(B,W,D){var j=D(5397),z=D(5610),K=D(6198),q=function(ce){return function(O,G,X){var V=j(O),ee=K(V);if(ee===0)return!ce&&-1;var se,me=z(X,ee);if(ce&&G!=G){for(;ee>me;)if((se=V[me++])!=se)return!0}else for(;ee>me;me++)if((ce||me in V)&&V[me]===G)return ce||me||0;return!ce&&-1}};B.exports={includes:q(!0),indexOf:q(!1)}},9213:function(B,W,D){var j=D(6080),z=D(7055),K=D(8981),q=D(6198),ce=D(1469),O=D(4659),G=function(X){var V=X===1,ee=X===2,se=X===3,me=X===4,he=X===6,oe=X===7,U=X===5||he;return function(R,ne,ge){for(var we,be,ye=K(R),fe=z(ye),Se=q(fe),Ee=j(ne,ge),Me=0,_e=0,je=V?ce(R,Se):ee||oe?ce(R,0):void 0;Se>Me;Me++)if((U||Me in fe)&&(be=Ee(we=fe[Me],Me,ye),X))if(V)O(je,Me,be);else if(be)switch(X){case 3:return!0;case 5:return we;case 6:return Me;case 2:O(je,_e++,we)}else switch(X){case 4:return!1;case 7:O(je,_e++,we)}return he?-1:se||me?me:je}};B.exports={forEach:G(0),map:G(1),filter:G(2),some:G(3),every:G(4),find:G(5),findIndex:G(6),filterReject:G(7)}},597:function(B,W,D){var j=D(9039),z=D(8227),K=D(9519),q=z("species");B.exports=function(ce){return K>=51||!j((function(){var O=[];return(O.constructor={})[q]=function(){return{foo:1}},O[ce](Boolean).foo!==1}))}},4598:function(B,W,D){var j=D(9039);B.exports=function(z,K){var q=[][z];return!!q&&j((function(){q.call(null,K||function(){return 1},1)}))}},926:function(B,W,D){var j=D(9306),z=D(8981),K=D(7055),q=D(6198),ce=TypeError,O="Reduce of empty array with no initial value",G=function(X){return function(V,ee,se,me){var he=z(V),oe=K(he),U=q(he);if(j(ee),U===0&&se<2)throw new ce(O);var R=X?U-1:0,ne=X?-1:1;if(se<2)for(;;){if(R in oe){me=oe[R],R+=ne;break}if(R+=ne,X?R<0:U<=R)throw new ce(O)}for(;X?R>=0:U>R;R+=ne)R in oe&&(me=ee(me,oe[R],R,he));return me}};B.exports={left:G(!1),right:G(!0)}},4527:function(B,W,D){var j=D(3724),z=D(4376),K=TypeError,q=Object.getOwnPropertyDescriptor,ce=j&&!(function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(O){return O instanceof TypeError}})();B.exports=ce?function(O,G){if(z(O)&&!q(O,"length").writable)throw new K("Cannot set read only .length");return O.length=G}:function(O,G){return O.length=G}},7680:function(B,W,D){var j=D(9504);B.exports=j([].slice)},4488:function(B,W,D){var j=D(7680),z=Math.floor,K=function(q,ce){var O=q.length;if(O<8)for(var G,X,V=1;V0;)q[X]=q[--X];X!==V++&&(q[X]=G)}else for(var ee=z(O/2),se=K(j(q,0,ee),ce),me=K(j(q,ee),ce),he=se.length,oe=me.length,U=0,R=0;U9007199254740991)throw W("Maximum allowed index exceeded");return D}},7400:function(B){B.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(B,W,D){var j=D(4055)("span").classList,z=j&&j.constructor&&j.constructor.prototype;B.exports=z===Object.prototype?void 0:z},8727:function(B){B.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},3709:function(B,W,D){var j=D(2839).match(/firefox\/(\d+)/i);B.exports=!!j&&+j[1]},3763:function(B,W,D){var j=D(2839);B.exports=/MSIE|Trident/.test(j)},6193:function(B,W,D){var j=D(4215);B.exports=j==="NODE"},2839:function(B,W,D){var j=D(4576).navigator,z=j&&j.userAgent;B.exports=z?String(z):""},9519:function(B,W,D){var j,z,K=D(4576),q=D(2839),ce=K.process,O=K.Deno,G=ce&&ce.versions||O&&O.version,X=G&&G.v8;X&&(z=(j=X.split("."))[0]>0&&j[0]<4?1:+(j[0]+j[1])),!z&&q&&(!(j=q.match(/Edge\/(\d+)/))||j[1]>=74)&&(j=q.match(/Chrome\/(\d+)/))&&(z=+j[1]),B.exports=z},3607:function(B,W,D){var j=D(2839).match(/AppleWebKit\/(\d+)\./);B.exports=!!j&&+j[1]},4215:function(B,W,D){var j=D(4576),z=D(2839),K=D(2195),q=function(ce){return z.slice(0,ce.length)===ce};B.exports=q("Bun/")?"BUN":q("Cloudflare-Workers")?"CLOUDFLARE":q("Deno/")?"DENO":q("Node.js/")?"NODE":j.Bun&&typeof Bun.version=="string"?"BUN":j.Deno&&typeof Deno.version=="object"?"DENO":K(j.process)==="process"?"NODE":j.window&&j.document?"BROWSER":"REST"},6518:function(B,W,D){var j=D(4576),z=D(7347).f,K=D(6699),q=D(6840),ce=D(9433),O=D(7740),G=D(2796);B.exports=function(X,V){var ee,se,me,he,oe,U=X.target,R=X.global,ne=X.stat;if(ee=R?j:ne?j[U]||ce(U,{}):j[U]&&j[U].prototype)for(se in V){if(he=V[se],me=X.dontCallGetSet?(oe=z(ee,se))&&oe.value:ee[se],!G(R?se:U+(ne?".":"#")+se,X.forced)&&me!==void 0){if(typeof he==typeof me)continue;O(he,me)}(X.sham||me&&me.sham)&&K(he,"sham",!0),q(ee,se,he,X)}}},9039:function(B){B.exports=function(W){try{return!!W()}catch{return!0}}},9228:function(B,W,D){D(7495);var j=D(9565),z=D(6840),K=D(7323),q=D(9039),ce=D(8227),O=D(6699),G=ce("species"),X=RegExp.prototype;B.exports=function(V,ee,se,me){var he=ce(V),oe=!q((function(){var ge={};return ge[he]=function(){return 7},""[V](ge)!==7})),U=oe&&!q((function(){var ge=!1,we=/a/;if(V==="split"){var be={};be[G]=function(){return we},(we={constructor:be,flags:""})[he]=/./[he]}return we.exec=function(){return ge=!0,null},we[he](""),!ge}));if(!oe||!U||se){var R=/./[he],ne=ee(he,""[V],(function(ge,we,be,ye,fe){var Se=we.exec;return Se===K||Se===X.exec?oe&&!fe?{done:!0,value:j(R,we,be,ye)}:{done:!0,value:j(ge,be,we,ye)}:{done:!1}}));z(String.prototype,V,ne[0]),z(X,he,ne[1])}me&&O(X[he],"sham",!0)}},8745:function(B,W,D){var j=D(616),z=Function.prototype,K=z.apply,q=z.call;B.exports=typeof Reflect=="object"&&Reflect.apply||(j?q.bind(K):function(){return q.apply(K,arguments)})},6080:function(B,W,D){var j=D(7476),z=D(9306),K=D(616),q=j(j.bind);B.exports=function(ce,O){return z(ce),O===void 0?ce:K?q(ce,O):function(){return ce.apply(O,arguments)}}},616:function(B,W,D){var j=D(9039);B.exports=!j((function(){var z=(function(){}).bind();return typeof z!="function"||z.hasOwnProperty("prototype")}))},566:function(B,W,D){var j=D(9504),z=D(9306),K=D(34),q=D(9297),ce=D(7680),O=D(616),G=Function,X=j([].concat),V=j([].join),ee={};B.exports=O?G.bind:function(se){var me=z(this),he=me.prototype,oe=ce(arguments,1),U=function(){var R=X(oe,ce(arguments));return this instanceof U?(function(ne,ge,we){if(!q(ee,ge)){for(var be=[],ye=0;ye]*>)/g,X=/\$([$&'`]|\d{1,2})/g;B.exports=function(V,ee,se,me,he,oe){var U=se+V.length,R=me.length,ne=X;return he!==void 0&&(he=z(he),ne=G),ce(oe,ne,(function(ge,we){var be;switch(q(we,0)){case"$":return"$";case"&":return V;case"`":return O(ee,0,se);case"'":return O(ee,U);case"<":be=he[O(we,1,-1)];break;default:var ye=+we;if(ye===0)return ge;if(ye>R){var fe=K(ye/10);return fe===0?ge:fe<=R?me[fe-1]===void 0?q(we,1):me[fe-1]+q(we,1):ge}be=me[ye-1]}return be===void 0?"":be}))}},4576:function(B,W,D){var j=function(z){return z&&z.Math===Math&&z};B.exports=j(typeof globalThis=="object"&&globalThis)||j(typeof window=="object"&&window)||j(typeof self=="object"&&self)||j(typeof D.g=="object"&&D.g)||j(typeof this=="object"&&this)||(function(){return this})()||Function("return this")()},9297:function(B,W,D){var j=D(9504),z=D(8981),K=j({}.hasOwnProperty);B.exports=Object.hasOwn||function(q,ce){return K(z(q),ce)}},421:function(B){B.exports={}},397:function(B,W,D){var j=D(7751);B.exports=j("document","documentElement")},5917:function(B,W,D){var j=D(3724),z=D(9039),K=D(4055);B.exports=!j&&!z((function(){return Object.defineProperty(K("div"),"a",{get:function(){return 7}}).a!==7}))},7055:function(B,W,D){var j=D(9504),z=D(9039),K=D(2195),q=Object,ce=j("".split);B.exports=z((function(){return!q("z").propertyIsEnumerable(0)}))?function(O){return K(O)==="String"?ce(O,""):q(O)}:q},3167:function(B,W,D){var j=D(4901),z=D(34),K=D(2967);B.exports=function(q,ce,O){var G,X;return K&&j(G=ce.constructor)&&G!==O&&z(X=G.prototype)&&X!==O.prototype&&K(q,X),q}},3706:function(B,W,D){var j=D(9504),z=D(4901),K=D(7629),q=j(Function.toString);z(K.inspectSource)||(K.inspectSource=function(ce){return q(ce)}),B.exports=K.inspectSource},1181:function(B,W,D){var j,z,K,q=D(8622),ce=D(4576),O=D(34),G=D(6699),X=D(9297),V=D(7629),ee=D(6119),se=D(421),me="Object already initialized",he=ce.TypeError,oe=ce.WeakMap;if(q||V.state){var U=V.state||(V.state=new oe);U.get=U.get,U.has=U.has,U.set=U.set,j=function(ne,ge){if(U.has(ne))throw new he(me);return ge.facade=ne,U.set(ne,ge),ge},z=function(ne){return U.get(ne)||{}},K=function(ne){return U.has(ne)}}else{var R=ee("state");se[R]=!0,j=function(ne,ge){if(X(ne,R))throw new he(me);return ge.facade=ne,G(ne,R,ge),ge},z=function(ne){return X(ne,R)?ne[R]:{}},K=function(ne){return X(ne,R)}}B.exports={set:j,get:z,has:K,enforce:function(ne){return K(ne)?z(ne):j(ne,{})},getterFor:function(ne){return function(ge){var we;if(!O(ge)||(we=z(ge)).type!==ne)throw new he("Incompatible receiver, "+ne+" required");return we}}}},4209:function(B,W,D){var j=D(8227),z=D(6269),K=j("iterator"),q=Array.prototype;B.exports=function(ce){return ce!==void 0&&(z.Array===ce||q[K]===ce)}},4376:function(B,W,D){var j=D(2195);B.exports=Array.isArray||function(z){return j(z)==="Array"}},4901:function(B){var W=typeof document=="object"&&document.all;B.exports=W===void 0&&W!==void 0?function(D){return typeof D=="function"||D===W}:function(D){return typeof D=="function"}},3517:function(B,W,D){var j=D(9504),z=D(9039),K=D(4901),q=D(6955),ce=D(7751),O=D(3706),G=function(){},X=ce("Reflect","construct"),V=/^\s*(?:class|function)\b/,ee=j(V.exec),se=!V.test(G),me=function(oe){if(!K(oe))return!1;try{return X(G,[],oe),!0}catch{return!1}},he=function(oe){if(!K(oe))return!1;switch(q(oe)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return se||!!ee(V,O(oe))}catch{return!0}};he.sham=!0,B.exports=!X||z((function(){var oe;return me(me.call)||!me(Object)||!me((function(){oe=!0}))||oe}))?he:me},2796:function(B,W,D){var j=D(9039),z=D(4901),K=/#|\.prototype\./,q=function(V,ee){var se=O[ce(V)];return se===X||se!==G&&(z(ee)?j(ee):!!ee)},ce=q.normalize=function(V){return String(V).replace(K,".").toLowerCase()},O=q.data={},G=q.NATIVE="N",X=q.POLYFILL="P";B.exports=q},2087:function(B,W,D){var j=D(34),z=Math.floor;B.exports=Number.isInteger||function(K){return!j(K)&&isFinite(K)&&z(K)===K}},4117:function(B){B.exports=function(W){return W==null}},34:function(B,W,D){var j=D(4901);B.exports=function(z){return typeof z=="object"?z!==null:j(z)}},3925:function(B,W,D){var j=D(34);B.exports=function(z){return j(z)||z===null}},6395:function(B){B.exports=!1},5810:function(B,W,D){var j=D(34),z=D(1181).get;B.exports=function(K){if(!j(K))return!1;var q=z(K);return!!q&&q.type==="RawJSON"}},788:function(B,W,D){var j=D(34),z=D(2195),K=D(8227)("match");B.exports=function(q){var ce;return j(q)&&((ce=q[K])!==void 0?!!ce:z(q)==="RegExp")}},757:function(B,W,D){var j=D(7751),z=D(4901),K=D(1625),q=D(7040),ce=Object;B.exports=q?function(O){return typeof O=="symbol"}:function(O){var G=j("Symbol");return z(G)&&K(G.prototype,ce(O))}},9539:function(B,W,D){var j=D(9565),z=D(8551),K=D(5966);B.exports=function(q,ce,O){var G,X;z(q);try{if(!(G=K(q,"return"))){if(ce==="throw")throw O;return O}G=j(G,q)}catch(V){X=!0,G=V}if(ce==="throw")throw O;if(X)throw G;return z(G),O}},3994:function(B,W,D){var j=D(7657).IteratorPrototype,z=D(2360),K=D(6980),q=D(687),ce=D(6269),O=function(){return this};B.exports=function(G,X,V,ee){var se=X+" Iterator";return G.prototype=z(j,{next:K(+!ee,V)}),q(G,se,!1,!0),ce[se]=O,G}},1088:function(B,W,D){var j=D(6518),z=D(9565),K=D(6395),q=D(350),ce=D(4901),O=D(3994),G=D(2787),X=D(2967),V=D(687),ee=D(6699),se=D(6840),me=D(8227),he=D(6269),oe=D(7657),U=q.PROPER,R=q.CONFIGURABLE,ne=oe.IteratorPrototype,ge=oe.BUGGY_SAFARI_ITERATORS,we=me("iterator"),be="keys",ye="values",fe="entries",Se=function(){return this};B.exports=function(Ee,Me,_e,je,ze,Fe,Xe){O(_e,Me,je);var ve,Ge,De,Qe=function(gt){if(gt===ze&&et)return et;if(!ge&>&> in Ae)return Ae[gt];switch(gt){case be:case ye:case fe:return function(){return new _e(this,gt)}}return function(){return new _e(this)}},Ve=Me+" Iterator",Pe=!1,Ae=Ee.prototype,$e=Ae[we]||Ae["@@iterator"]||ze&&Ae[ze],et=!ge&&$e||Qe(ze),ot=Me==="Array"&&Ae.entries||$e;if(ot&&(ve=G(ot.call(new Ee)))!==Object.prototype&&ve.next&&(K||G(ve)===ne||(X?X(ve,ne):ce(ve[we])||se(ve,we,Se)),V(ve,Ve,!0,!0),K&&(he[Ve]=Se)),U&&ze===ye&&$e&&$e.name!==ye&&(!K&&R?ee(Ae,"name",ye):(Pe=!0,et=function(){return z($e,this)})),ze)if(Ge={values:Qe(ye),keys:Fe?et:Qe(be),entries:Qe(fe)},Xe)for(De in Ge)(ge||Pe||!(De in Ae))&&se(Ae,De,Ge[De]);else j({target:Me,proto:!0,forced:ge||Pe},Ge);return K&&!Xe||Ae[we]===et||se(Ae,we,et,{name:ze}),he[Me]=et,Ge}},7657:function(B,W,D){var j,z,K,q=D(9039),ce=D(4901),O=D(34),G=D(2360),X=D(2787),V=D(6840),ee=D(8227),se=D(6395),me=ee("iterator"),he=!1;[].keys&&("next"in(K=[].keys())?(z=X(X(K)))!==Object.prototype&&(j=z):he=!0),!O(j)||q((function(){var oe={};return j[me].call(oe)!==oe}))?j={}:se&&(j=G(j)),ce(j[me])||V(j,me,(function(){return this})),B.exports={IteratorPrototype:j,BUGGY_SAFARI_ITERATORS:he}},6269:function(B){B.exports={}},6198:function(B,W,D){var j=D(8014);B.exports=function(z){return j(z.length)}},283:function(B,W,D){var j=D(9504),z=D(9039),K=D(4901),q=D(9297),ce=D(3724),O=D(350).CONFIGURABLE,G=D(3706),X=D(1181),V=X.enforce,ee=X.get,se=String,me=Object.defineProperty,he=j("".slice),oe=j("".replace),U=j([].join),R=ce&&!z((function(){return me((function(){}),"length",{value:8}).length!==8})),ne=String(String).split("String"),ge=B.exports=function(we,be,ye){he(se(be),0,7)==="Symbol("&&(be="["+oe(se(be),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),ye&&ye.getter&&(be="get "+be),ye&&ye.setter&&(be="set "+be),(!q(we,"name")||O&&we.name!==be)&&(ce?me(we,"name",{value:be,configurable:!0}):we.name=be),R&&ye&&q(ye,"arity")&&we.length!==ye.arity&&me(we,"length",{value:ye.arity});try{ye&&q(ye,"constructor")&&ye.constructor?ce&&me(we,"prototype",{writable:!1}):we.prototype&&(we.prototype=void 0)}catch{}var fe=V(we);return q(fe,"source")||(fe.source=U(ne,typeof be=="string"?be:"")),we};Function.prototype.toString=ge((function(){return K(this)&&ee(this).source||G(this)}),"toString")},741:function(B){var W=Math.ceil,D=Math.floor;B.exports=Math.trunc||function(j){var z=+j;return(z>0?D:W)(z)}},7819:function(B,W,D){var j=D(9039);B.exports=!j((function(){var z="9007199254740993",K=JSON.rawJSON(z);return!JSON.isRawJSON(K)||JSON.stringify(K)!==z}))},5749:function(B,W,D){var j=D(788),z=TypeError;B.exports=function(K){if(j(K))throw new z("The method doesn't accept regular expressions");return K}},4213:function(B,W,D){var j=D(3724),z=D(9504),K=D(9565),q=D(9039),ce=D(1072),O=D(3717),G=D(8773),X=D(8981),V=D(7055),ee=Object.assign,se=Object.defineProperty,me=z([].concat);B.exports=!ee||q((function(){if(j&&ee({b:1},ee(se({},"a",{enumerable:!0,get:function(){se(this,"b",{value:3,enumerable:!1})}}),{b:2})).b!==1)return!0;var he={},oe={},U=Symbol("assign detection"),R="abcdefghijklmnopqrst";return he[U]=7,R.split("").forEach((function(ne){oe[ne]=ne})),ee({},he)[U]!==7||ce(ee({},oe)).join("")!==R}))?function(he,oe){for(var U=X(he),R=arguments.length,ne=1,ge=O.f,we=G.f;R>ne;)for(var be,ye=V(arguments[ne++]),fe=ge?me(ce(ye),ge(ye)):ce(ye),Se=fe.length,Ee=0;Se>Ee;)be=fe[Ee++],j&&!K(we,ye,be)||(U[be]=ye[be]);return U}:ee},2360:function(B,W,D){var j,z=D(8551),K=D(6801),q=D(8727),ce=D(421),O=D(397),G=D(4055),X=D(6119),V="prototype",ee="script",se=X("IE_PROTO"),me=function(){},he=function(R){return"<"+ee+">"+R+""},oe=function(R){R.write(he("")),R.close();var ne=R.parentWindow.Object;return R=null,ne},U=function(){try{j=new ActiveXObject("htmlfile")}catch{}var R,ne,ge;U=typeof document<"u"?document.domain&&j?oe(j):(ne=G("iframe"),ge="java"+ee+":",ne.style.display="none",O.appendChild(ne),ne.src=String(ge),(R=ne.contentWindow.document).open(),R.write(he("document.F=Object")),R.close(),R.F):oe(j);for(var we=q.length;we--;)delete U[V][q[we]];return U()};ce[se]=!0,B.exports=Object.create||function(R,ne){var ge;return R!==null?(me[V]=z(R),ge=new me,me[V]=null,ge[se]=R):ge=U(),ne===void 0?ge:K.f(ge,ne)}},6801:function(B,W,D){var j=D(3724),z=D(8686),K=D(4913),q=D(8551),ce=D(5397),O=D(1072);W.f=j&&!z?Object.defineProperties:function(G,X){q(G);for(var V,ee=ce(X),se=O(X),me=se.length,he=0;me>he;)K.f(G,V=se[he++],ee[V]);return G}},4913:function(B,W,D){var j=D(3724),z=D(5917),K=D(8686),q=D(8551),ce=D(6969),O=TypeError,G=Object.defineProperty,X=Object.getOwnPropertyDescriptor,V="enumerable",ee="configurable",se="writable";W.f=j?K?function(me,he,oe){if(q(me),he=ce(he),q(oe),typeof me=="function"&&he==="prototype"&&"value"in oe&&se in oe&&!oe[se]){var U=X(me,he);U&&U[se]&&(me[he]=oe.value,oe={configurable:ee in oe?oe[ee]:U[ee],enumerable:V in oe?oe[V]:U[V],writable:!1})}return G(me,he,oe)}:G:function(me,he,oe){if(q(me),he=ce(he),q(oe),z)try{return G(me,he,oe)}catch{}if("get"in oe||"set"in oe)throw new O("Accessors not supported");return"value"in oe&&(me[he]=oe.value),me}},7347:function(B,W,D){var j=D(3724),z=D(9565),K=D(8773),q=D(6980),ce=D(5397),O=D(6969),G=D(9297),X=D(5917),V=Object.getOwnPropertyDescriptor;W.f=j?V:function(ee,se){if(ee=ce(ee),se=O(se),X)try{return V(ee,se)}catch{}if(G(ee,se))return q(!z(K.f,ee,se),ee[se])}},298:function(B,W,D){var j=D(2195),z=D(5397),K=D(8480).f,q=D(7680),ce=typeof window=="object"&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];B.exports.f=function(O){return ce&&j(O)==="Window"?(function(G){try{return K(G)}catch{return q(ce)}})(O):K(z(O))}},8480:function(B,W,D){var j=D(1828),z=D(8727).concat("length","prototype");W.f=Object.getOwnPropertyNames||function(K){return j(K,z)}},3717:function(B,W){W.f=Object.getOwnPropertySymbols},2787:function(B,W,D){var j=D(9297),z=D(4901),K=D(8981),q=D(6119),ce=D(2211),O=q("IE_PROTO"),G=Object,X=G.prototype;B.exports=ce?G.getPrototypeOf:function(V){var ee=K(V);if(j(ee,O))return ee[O];var se=ee.constructor;return z(se)&&ee instanceof se?se.prototype:ee instanceof G?X:null}},1625:function(B,W,D){var j=D(9504);B.exports=j({}.isPrototypeOf)},1828:function(B,W,D){var j=D(9504),z=D(9297),K=D(5397),q=D(9617).indexOf,ce=D(421),O=j([].push);B.exports=function(G,X){var V,ee=K(G),se=0,me=[];for(V in ee)!z(ce,V)&&z(ee,V)&&O(me,V);for(;X.length>se;)z(ee,V=X[se++])&&(~q(me,V)||O(me,V));return me}},1072:function(B,W,D){var j=D(1828),z=D(8727);B.exports=Object.keys||function(K){return j(K,z)}},8773:function(B,W){var D={}.propertyIsEnumerable,j=Object.getOwnPropertyDescriptor,z=j&&!D.call({1:2},1);W.f=z?function(K){var q=j(this,K);return!!q&&q.enumerable}:D},2551:function(B,W,D){var j=D(6395),z=D(4576),K=D(9039),q=D(3607);B.exports=j||!K((function(){if(!(q&&q<535)){var ce=Math.random();__defineSetter__.call(null,ce,(function(){})),delete z[ce]}}))},2967:function(B,W,D){var j=D(6706),z=D(34),K=D(7750),q=D(3506);B.exports=Object.setPrototypeOf||("__proto__"in{}?(function(){var ce,O=!1,G={};try{(ce=j(Object.prototype,"__proto__","set"))(G,[]),O=G instanceof Array}catch{}return function(X,V){return K(X),q(V),z(X)&&(O?ce(X,V):X.__proto__=V),X}})():void 0)},3179:function(B,W,D){var j=D(2140),z=D(6955);B.exports=j?{}.toString:function(){return"[object "+z(this)+"]"}},4270:function(B,W,D){var j=D(9565),z=D(4901),K=D(34),q=TypeError;B.exports=function(ce,O){var G,X;if(O==="string"&&z(G=ce.toString)&&!K(X=j(G,ce))||z(G=ce.valueOf)&&!K(X=j(G,ce))||O!=="string"&&z(G=ce.toString)&&!K(X=j(G,ce)))return X;throw new q("Can't convert object to primitive value")}},5031:function(B,W,D){var j=D(7751),z=D(9504),K=D(8480),q=D(3717),ce=D(8551),O=z([].concat);B.exports=j("Reflect","ownKeys")||function(G){var X=K.f(ce(G)),V=q.f;return V?O(X,V(G)):X}},8235:function(B,W,D){var j=D(9504),z=D(9297),K=SyntaxError,q=parseInt,ce=String.fromCharCode,O=j("".charAt),G=j("".slice),X=j(/./.exec),V={'\\"':'"',"\\\\":"\\","\\/":"/","\\b":"\b","\\f":"\f","\\n":` `,"\\r":"\r","\\t":" "},ee=/^[\da-f]{4}$/i,se=/^[\u0000-\u001F]$/;B.exports=function(me,he){for(var oe=!0,U="";he0&&(!ve.multiline||ve.multiline&&R(De,ve.lastIndex-1)!==` `)&&($e="(?: "+$e+")",ot=" "+ot,et++),Me=new RegExp("^(?:"+$e+")",Ae)),fe&&(Me=new RegExp("^"+$e+"$(?!\\s)",Ae)),be&&(_e=ve.lastIndex),je=K(oe,Pe?Me:ve,ot),Pe?je?(je.input=we(je.input,et),je[0]=we(je[0],et),je.index=ve.lastIndex,ve.lastIndex+=je[0].length):ve.lastIndex=0:be&&je&&(ve.lastIndex=ve.global?je.index+je[0].length:_e),fe&&je&&je.length>1&&K(he,je[0],Me,(function(){for(ze=1;zeb)","g");return K.exec("b").groups.a!=="b"||"b".replace(K,"$c")!=="bc"}))},7750:function(B,W,D){var j=D(4117),z=TypeError;B.exports=function(K){if(j(K))throw new z("Can't call method on "+K);return K}},7633:function(B,W,D){var j=D(7751),z=D(2106),K=D(8227),q=D(3724),ce=K("species");B.exports=function(O){var G=j(O);q&&G&&!G[ce]&&z(G,ce,{configurable:!0,get:function(){return this}})}},687:function(B,W,D){var j=D(4913).f,z=D(9297),K=D(8227)("toStringTag");B.exports=function(q,ce,O){q&&!O&&(q=q.prototype),q&&!z(q,K)&&j(q,K,{configurable:!0,value:ce})}},6119:function(B,W,D){var j=D(5745),z=D(3392),K=j("keys");B.exports=function(q){return K[q]||(K[q]=z(q))}},7629:function(B,W,D){var j=D(6395),z=D(4576),K=D(9433),q="__core-js_shared__",ce=B.exports=z[q]||K(q,{});(ce.versions||(ce.versions=[])).push({version:"3.48.0",mode:j?"pure":"global",copyright:"© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.",license:"https://github.com/zloirock/core-js/blob/v3.48.0/LICENSE",source:"https://github.com/zloirock/core-js"})},5745:function(B,W,D){var j=D(7629);B.exports=function(z,K){return j[z]||(j[z]=K||{})}},2293:function(B,W,D){var j=D(8551),z=D(5548),K=D(4117),q=D(8227)("species");B.exports=function(ce,O){var G,X=j(ce).constructor;return X===void 0||K(G=j(X)[q])?O:z(G)}},8183:function(B,W,D){var j=D(9504),z=D(1291),K=D(655),q=D(7750),ce=j("".charAt),O=j("".charCodeAt),G=j("".slice),X=function(V){return function(ee,se){var me,he,oe=K(q(ee)),U=z(se),R=oe.length;return U<0||U>=R?V?"":void 0:(me=O(oe,U))<55296||me>56319||U+1===R||(he=O(oe,U+1))<56320||he>57343?V?ce(oe,U):me:V?G(oe,U,U+2):he-56320+(me-55296<<10)+65536}};B.exports={codeAt:X(!1),charAt:X(!0)}},706:function(B,W,D){var j=D(350).PROPER,z=D(9039),K=D(7452);B.exports=function(q){return z((function(){return!!K[q]()||"​…᠎"[q]()!=="​…᠎"||j&&K[q].name!==q}))}},3802:function(B,W,D){var j=D(9504),z=D(7750),K=D(655),q=D(7452),ce=j("".replace),O=RegExp("^["+q+"]+"),G=RegExp("(^|[^"+q+"])["+q+"]+$"),X=function(V){return function(ee){var se=K(z(ee));return 1&V&&(se=ce(se,O,"")),2&V&&(se=ce(se,G,"$1")),se}};B.exports={start:X(1),end:X(2),trim:X(3)}},4495:function(B,W,D){var j=D(9519),z=D(9039),K=D(4576).String;B.exports=!!Object.getOwnPropertySymbols&&!z((function(){var q=Symbol("symbol detection");return!K(q)||!(Object(q)instanceof Symbol)||!Symbol.sham&&j&&j<41}))},8242:function(B,W,D){var j=D(9565),z=D(7751),K=D(8227),q=D(6840);B.exports=function(){var ce=z("Symbol"),O=ce&&ce.prototype,G=O&&O.valueOf,X=K("toPrimitive");O&&!O[X]&&q(O,X,(function(V){return j(G,this)}),{arity:1})}},1296:function(B,W,D){var j=D(4495);B.exports=j&&!!Symbol.for&&!!Symbol.keyFor},1240:function(B,W,D){var j=D(9504);B.exports=j(1.1.valueOf)},5610:function(B,W,D){var j=D(1291),z=Math.max,K=Math.min;B.exports=function(q,ce){var O=j(q);return O<0?z(O+ce,0):K(O,ce)}},5397:function(B,W,D){var j=D(7055),z=D(7750);B.exports=function(K){return j(z(K))}},1291:function(B,W,D){var j=D(741);B.exports=function(z){var K=+z;return K!=K||K===0?0:j(K)}},8014:function(B,W,D){var j=D(1291),z=Math.min;B.exports=function(K){var q=j(K);return q>0?z(q,9007199254740991):0}},8981:function(B,W,D){var j=D(7750),z=Object;B.exports=function(K){return z(j(K))}},2777:function(B,W,D){var j=D(9565),z=D(34),K=D(757),q=D(5966),ce=D(4270),O=D(8227),G=TypeError,X=O("toPrimitive");B.exports=function(V,ee){if(!z(V)||K(V))return V;var se,me=q(V,X);if(me){if(ee===void 0&&(ee="default"),se=j(me,V,ee),!z(se)||K(se))return se;throw new G("Can't convert object to primitive value")}return ee===void 0&&(ee="number"),ce(V,ee)}},6969:function(B,W,D){var j=D(2777),z=D(757);B.exports=function(K){var q=j(K,"string");return z(q)?q:q+""}},2140:function(B,W,D){var j={};j[D(8227)("toStringTag")]="z",B.exports=String(j)==="[object z]"},655:function(B,W,D){var j=D(6955),z=String;B.exports=function(K){if(j(K)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return z(K)}},6823:function(B){var W=String;B.exports=function(D){try{return W(D)}catch{return"Object"}}},3392:function(B,W,D){var j=D(9504),z=0,K=Math.random(),q=j(1.1.toString);B.exports=function(ce){return"Symbol("+(ce===void 0?"":ce)+")_"+q(++z+K,36)}},7040:function(B,W,D){var j=D(4495);B.exports=j&&!Symbol.sham&&typeof Symbol.iterator=="symbol"},8686:function(B,W,D){var j=D(3724),z=D(9039);B.exports=j&&z((function(){return Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype!==42}))},8622:function(B,W,D){var j=D(4576),z=D(4901),K=j.WeakMap;B.exports=z(K)&&/native code/.test(String(K))},511:function(B,W,D){var j=D(9167),z=D(9297),K=D(1951),q=D(4913).f;B.exports=function(ce){var O=j.Symbol||(j.Symbol={});z(O,ce)||q(O,ce,{value:K.f(ce)})}},1951:function(B,W,D){var j=D(8227);W.f=j},8227:function(B,W,D){var j=D(4576),z=D(5745),K=D(9297),q=D(3392),ce=D(4495),O=D(7040),G=j.Symbol,X=z("wks"),V=O?G.for||G:G&&G.withoutSetter||q;B.exports=function(ee){return K(X,ee)||(X[ee]=ce&&K(G,ee)?G[ee]:V("Symbol."+ee)),X[ee]}},7452:function(B){B.exports=` diff --git a/static/index.html b/static/index.html index 940fd69fc..3f18d4279 100644 --- a/static/index.html +++ b/static/index.html @@ -23,7 +23,7 @@ - +