From 502959a0df7f4b3fbd9055b0a23f46ea7fc52ff3 Mon Sep 17 00:00:00 2001 From: maziggy Date: Thu, 9 Apr 2026 08:00:58 +0200 Subject: [PATCH] Fix plate-clear button unclickable after second print (#912) The clearPlateMutation.isSuccess state from React Query persisted after the first successful plate clear. When the next print finished, the stale isSuccess rendered the static confirmation instead of the clickable button. Reset mutation state when printer leaves FINISH/FAILED. --- CHANGELOG.md | 3 +++ frontend/src/components/PrinterQueueWidget.tsx | 9 +++++++++ static/assets/{index-DMDXAsuP.js => index-CNOL7dUq.js} | 2 +- static/index.html | 2 +- 4 files changed, 14 insertions(+), 2 deletions(-) rename static/assets/{index-DMDXAsuP.js => index-CNOL7dUq.js} (99%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a8f2bd1d..8f132cbee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ All notable changes to Bambuddy will be documented in this file. ## [0.2.3b3] - Unreleased +### Fixed +- **"Build Plate Cleared" Button Unclickable After Second Print** ([#912](https://github.com/maziggy/bambuddy/issues/912)) — After completing the first queued print and confirming the plate was cleared, the "Build plate cleared — ready for next print" button became unresponsive after the second print finished. The React Query mutation's `isSuccess` state persisted from the first plate-clear confirmation, causing the component to render the static "Plate Ready" confirmation instead of the clickable button. The mutation state is now reset when the printer leaves the FINISH/FAILED state, so the button works correctly on every print cycle. + ## [0.2.3b2] - 2026-04-08 ### New Features diff --git a/frontend/src/components/PrinterQueueWidget.tsx b/frontend/src/components/PrinterQueueWidget.tsx index cd592e2dd..2b9d4e869 100644 --- a/frontend/src/components/PrinterQueueWidget.tsx +++ b/frontend/src/components/PrinterQueueWidget.tsx @@ -1,3 +1,4 @@ +import { useEffect } from 'react'; import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'; import { Clock, Calendar, ChevronRight, Loader2, CircleCheck } from 'lucide-react'; import { Link } from 'react-router-dom'; @@ -41,6 +42,14 @@ export function PrinterQueueWidget({ printerId, printerModel, printerState, plat }, }); + // Reset mutation state when printer starts a new print cycle so the button + // is clickable again when the next print finishes (fixes #912) + useEffect(() => { + if (printerState !== 'FINISH' && printerState !== 'FAILED') { + clearPlateMutation.reset(); + } + }, [printerState]); + // Filter queue to items this printer can actually print (filament type + color check) const compatibleQueue = queue ? filterCompatibleQueueItems(queue, loadedFilamentTypes, loadedFilaments) : undefined; diff --git a/static/assets/index-DMDXAsuP.js b/static/assets/index-CNOL7dUq.js similarity index 99% rename from static/assets/index-DMDXAsuP.js rename to static/assets/index-CNOL7dUq.js index cec7fd0fc..2d132da57 100644 --- a/static/assets/index-DMDXAsuP.js +++ b/static/assets/index-CNOL7dUq.js @@ -8437,7 +8437,7 @@ void main() { `,children:[a.jsxs("div",{className:` w-12 h-12 flex-shrink-0 rounded-lg flex flex-col items-center justify-center ${y.skipped?"bg-red-100 dark:bg-red-500/20 border border-red-300 dark:border-red-500/40":"bg-green-100 dark:bg-bambu-green/20 border border-green-300 dark:border-bambu-green/40"} - `,children:[a.jsx("span",{className:`text-lg font-mono font-bold ${y.skipped?"text-red-500 dark:text-red-400":"text-green-600 dark:text-bambu-green"}`,children:y.id}),a.jsx("span",{className:`text-[8px] uppercase tracking-wider ${y.skipped?"text-red-400/60":"text-green-500/60 dark:text-bambu-green/60"}`,children:"ID"})]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("span",{className:`block text-sm truncate ${y.skipped?"text-red-500 dark:text-red-400 line-through":"text-gray-900 dark:text-white"}`,children:y.name}),y.skipped&&a.jsx("span",{className:"text-[10px] text-red-400/60",children:r("printers.willBeSkipped")})]}),y.skipped?a.jsx("span",{className:"px-4 py-2 text-xs text-red-500 dark:text-red-400/70 bg-red-100 dark:bg-red-500/10 rounded-lg",children:r("printers.skipObjects.skipped")}):a.jsx("button",{onClick:()=>l({id:y.id,name:y.name}),disabled:f.isPending||(u?.layer_num??0)<=1||!s("printers:control"),className:`px-4 py-2 text-xs font-medium rounded-lg transition-colors ${(u?.layer_num??0)<=1||!s("printers:control")?"bg-gray-100 dark:bg-bambu-dark text-gray-400 dark:text-bambu-gray/50 cursor-not-allowed":"bg-red-100 dark:bg-red-500/20 text-red-600 dark:text-red-400 hover:bg-red-200 dark:hover:bg-red-500/30 border border-red-300 dark:border-red-500/30"}`,title:s("printers:control")?(u?.layer_num??0)<=1?r("printers.skipObjects.waitForLayer",{layer:u?.layer_num??0}):r("printers.skipObjects.skip"):r("printers.permission.noControl"),children:r("printers.skipObjects.skip")})]},y.id))})]})]}):a.jsx("div",{className:"flex items-center justify-center py-12",children:a.jsx(dt,{className:"w-5 h-5 animate-spin text-bambu-gray"})})]})]}),o&&a.jsx(_n,{variant:"warning",title:r("printers.skipObjects.confirmTitle"),message:r("printers.skipObjects.confirmMessage",{name:o.name}),confirmText:r("printers.skipObjects.skip"),isLoading:f.isPending,onConfirm:()=>f.mutate([o.id]),onCancel:()=>l(null)}),c&&m&&a.jsxs("div",{className:"fixed inset-0 bg-black/90 flex items-center justify-center z-60",onClick:()=>d(!1),children:[a.jsx("button",{onClick:()=>d(!1),className:"absolute top-4 right-4 p-2 text-white/70 hover:text-white transition-colors",children:a.jsx(Ht,{className:"w-6 h-6"})}),a.jsxs("div",{className:"relative max-w-[600px] max-h-[80vh] aspect-square",onClick:y=>y.stopPropagation(),children:[u?.cover_url?a.jsx("img",{src:`${u.cover_url}?view=top`,alt:r("printers.printPreview"),className:"w-full h-full object-contain rounded-lg bg-gray-900"}):a.jsx("div",{className:"w-full h-full rounded-lg bg-gray-800 flex items-center justify-center",children:a.jsx(ui,{className:"w-16 h-16 text-gray-500"})}),m.objects.length>0&&a.jsx("div",{className:"absolute inset-0 pointer-events-none",children:m.objects.map((y,v)=>{let g,b;if(y.x!=null&&y.y!=null&&m.bbox_all){const[_,N,P,k]=m.bbox_all,M=P-_,T=k-N,A=8,C=100-A*2;g=A+(y.x-_)/M*C,b=A+(k-y.y)/T*C,g=Math.max(5,Math.min(95,g)),b=Math.max(5,Math.min(95,b))}else if(y.x!=null&&y.y!=null)g=y.x/256*100,b=100-y.y/256*100,g=Math.max(5,Math.min(95,g)),b=Math.max(5,Math.min(95,b));else{const _=Math.ceil(Math.sqrt(m.objects.length)),N=Math.floor(v/_),P=v%_,k=Math.ceil(m.objects.length/_);g=15+P*(70/_)+35/_,b=15+N*(70/k)+35/k}return a.jsx("div",{className:`absolute flex items-center justify-center w-6 h-6 rounded-full text-[10px] font-bold shadow-lg ${y.skipped?"bg-red-500 text-white line-through":"bg-bambu-green text-black"}`,style:{left:`${g}%`,top:`${b}%`,transform:"translate(-50%, -50%)"},title:y.name,children:y.id},y.id)})}),a.jsx("div",{className:"absolute bottom-2 right-2 px-2 py-1 bg-white/90 dark:bg-black/80 rounded text-[10px] text-gray-700 dark:text-white shadow-sm",children:r("printers.skipObjects.activeCount",{count:m.objects.filter(y=>!y.skipped).length})})]})]})]}):null}const eje="embeddedCameraState_",_$=5,tje=2e3,nje=3e4,rje=5e3,EE={x:window.innerWidth-420,y:20,width:400,height:300};function aje({printerId:t,printerName:e,viewerIndex:n=0,onClose:r}){const{t:i}=Rt(),s=mn(),{showToast:o}=bn(),{hasPermission:l}=_r(),c=`${eje}${t}`,d=()=>{try{const $e=localStorage.getItem(c);if($e){const et=JSON.parse($e);return{x:Math.min(Math.max(0,et.x),window.innerWidth-100),y:Math.min(Math.max(0,et.y),window.innerHeight-100),width:Math.max(200,Math.min(et.width,window.innerWidth-20)),height:Math.max(150,Math.min(et.height,window.innerHeight-20))}}}catch{}const Ae=n*30;return{...EE,x:Math.max(0,EE.x-Ae),y:Math.max(0,EE.y+Ae)}},[u,m]=w.useState(d),[p,f]=w.useState(!1),[y,v]=w.useState(!1),[g,b]=w.useState({x:0,y:0}),[_,N]=w.useState(!1),[P,k]=w.useState(!1),[M,T]=w.useState(1),[A,C]=w.useState({x:0,y:0}),[F,$]=w.useState(!1),[I,Q]=w.useState({x:0,y:0}),[L,re]=w.useState(null),[ae,ee]=w.useState(null),[de,le]=w.useState(!1),[ue,Y]=w.useState(!0),[te,se]=w.useState(Date.now()),[ge,Ne]=w.useState(0),[B,W]=w.useState(!1),[D,j]=w.useState(0),z=w.useRef(null),K=w.useRef(null),q=w.useRef(null),ce=w.useRef(null),O=w.useRef(null),[G,X]=w.useState(!1),{data:V}=Je({queryKey:["printer",t],queryFn:()=>he.getPrinter(t),enabled:t>0}),{data:J}=Je({queryKey:["printerStatus",t],queryFn:()=>he.getPrinterStatus(t),refetchInterval:3e4,enabled:t>0}),ie=ct({mutationFn:Ae=>he.setChamberLight(t,Ae),onMutate:async Ae=>{await s.cancelQueries({queryKey:["printerStatus",t]});const $e=s.getQueryData(["printerStatus",t]);return s.setQueryData(["printerStatus",t],et=>({...et,chamber_light:Ae})),{previousStatus:$e}},onSuccess:(Ae,$e)=>{o(`Chamber light ${$e?"on":"off"}`)},onError:(Ae,$e,et)=>{et?.previousStatus&&s.setQueryData(["printerStatus",t],et.previousStatus),o(Ae.message||i("printers.toast.failedToControlChamberLight"),"error")}}),me=(J?.state==="RUNNING"||J?.state==="PAUSE")&&(J?.printable_objects_count??0)>=2;w.useEffect(()=>{const Ae=setTimeout(()=>{localStorage.setItem(c,JSON.stringify(u))},500);return()=>clearTimeout(Ae)},[u,c]);const pe=w.useRef(!1);w.useEffect(()=>{pe.current=!1;const Ae=`/api/v1/printers/${t}/camera/stop`,$e=()=>{if(t>0&&!pe.current){pe.current=!0;const lt={},gt=nm();gt&&(lt.Authorization=`Bearer ${gt}`),fetch(Ae,{method:"POST",keepalive:!0,headers:lt}).catch(()=>{})}},et=K.current;return()=>{et&&(et.src=""),$e(),q.current&&clearTimeout(q.current),ce.current&&clearInterval(ce.current),O.current&&clearInterval(O.current)}},[t]),w.useEffect(()=>{if(ue){const Ae=setTimeout(()=>Y(!1),3e3);return()=>clearTimeout(Ae)}},[ue,te]);const oe=w.useCallback(()=>{if(ge>=_$){W(!1),le(!0);return}const Ae=Math.min(tje*Math.pow(2,ge),nje);W(!0),j(Math.ceil(Ae/1e3)),ce.current=setInterval(()=>{j($e=>$e<=1?(ce.current&&clearInterval(ce.current),0):$e-1)},1e3),q.current=setTimeout(()=>{Ne($e=>$e+1),W(!1),Y(!0),le(!1),K.current&&(K.current.src=""),se(Date.now())},Ae)},[ge]);w.useEffect(()=>{if(ue||B||_){O.current&&(clearInterval(O.current),O.current=null);return}return O.current=setInterval(async()=>{try{const Ae=await he.getCameraStatus(t);(Ae.stalled||!Ae.active&&!de)&&(O.current&&(clearInterval(O.current),O.current=null),Y(!1),oe())}catch{}},rje),()=>{O.current&&(clearInterval(O.current),O.current=null)}},[ue,de,B,_,t,oe]),w.useEffect(()=>{const Ae=()=>{const $e=!!document.fullscreenElement;k($e),$e||(T(1),C({x:0,y:0}))};return document.addEventListener("fullscreenchange",Ae),()=>document.removeEventListener("fullscreenchange",Ae)},[]);const U=()=>{z.current&&(document.fullscreenElement?document.exitFullscreen():z.current.requestFullscreen())},R=()=>{T(Ae=>Math.min(Ae+.5,4))},ne=()=>{T(Ae=>{const $e=Math.max(Ae-.5,1);return $e===1&&C({x:0,y:0}),$e})},be=Ae=>{Ae.preventDefault(),Ae.deltaY<0?R():ne()},we=Ae=>{M>1&&(Ae.preventDefault(),$(!0),Q({x:Ae.clientX-A.x,y:Ae.clientY-A.y}))},xe=w.useCallback(()=>{if(!z.current||!K.current)return{x:200,y:150};const Ae=z.current.getBoundingClientRect(),$e=Ae.width*(M-1)/2,et=Ae.height*(M-1)/2;return{x:Math.max(50,$e),y:Math.max(50,et)}},[M]),ye=Ae=>{if(F&&M>1){const $e=Ae.clientX-I.x,et=Ae.clientY-I.y,lt=xe();C({x:Math.max(-lt.x,Math.min(lt.x,$e)),y:Math.max(-lt.y,Math.min(lt.y,et))})}},fe=()=>{$(!1)},Se=Ae=>{if(Ae.length<2)return 0;const $e=Ae[0].clientX-Ae[1].clientX,et=Ae[0].clientY-Ae[1].clientY;return Math.sqrt($e*$e+et*et)},Ee=Ae=>Ae.length<2?{x:Ae[0].clientX,y:Ae[0].clientY}:{x:(Ae[0].clientX+Ae[1].clientX)/2,y:(Ae[0].clientY+Ae[1].clientY)/2},Me=Ae=>{Ae.touches.length===2?(Ae.preventDefault(),re(Se(Ae.touches)),ee(Ee(Ae.touches))):Ae.touches.length===1&&M>1&&(Ae.preventDefault(),$(!0),Q({x:Ae.touches[0].clientX-A.x,y:Ae.touches[0].clientY-A.y}))},_e=Ae=>{if(Ae.touches.length===2&&L!==null){Ae.preventDefault();const $e=Se(Ae.touches),et=$e/L;T(gt=>{const ft=Math.max(1,Math.min(4,gt*et));return ft===1&&C({x:0,y:0}),ft}),re($e);const lt=Ee(Ae.touches);if(ae){const gt=xe();C(ft=>({x:Math.max(-gt.x,Math.min(gt.x,ft.x+(lt.x-ae.x))),y:Math.max(-gt.y,Math.min(gt.y,ft.y+(lt.y-ae.y)))}))}ee(lt)}else if(Ae.touches.length===1&&F&&M>1){Ae.preventDefault();const $e=Ae.touches[0].clientX-I.x,et=Ae.touches[0].clientY-I.y,lt=xe();C({x:Math.max(-lt.x,Math.min(lt.x,$e)),y:Math.max(-lt.y,Math.min(lt.y,et))})}},je=Ae=>{Ae.touches.length<2&&(re(null),ee(null)),Ae.touches.length===0&&$(!1)},ze=()=>{T(1),C({x:0,y:0})},Fe=()=>{Y(!1),ge<_$?oe():le(!0)},Xe=()=>{Y(!1),le(!1),Ne(0),W(!1),q.current&&clearTimeout(q.current),ce.current&&clearInterval(ce.current)},ve=()=>{Y(!0),le(!1),Ne(0),W(!1),q.current&&clearTimeout(q.current),ce.current&&clearInterval(ce.current);const Ae={},$e=nm();$e&&(Ae.Authorization=`Bearer ${$e}`),fetch(`/api/v1/printers/${t}/camera/stop`,{method:"POST",headers:Ae}).catch(()=>{}),K.current&&(K.current.src=""),setTimeout(()=>se(Date.now()),100)},Ge=Ae=>{Ae.target.closest(".no-drag")||(f(!0),b({x:Ae.clientX-u.x,y:Ae.clientY-u.y}))},De=Ae=>{if(Ae.target.closest(".no-drag"))return;const $e=Ae.touches[0];f(!0),b({x:$e.clientX-u.x,y:$e.clientY-u.y})},Qe=Ae=>{Ae.stopPropagation(),v(!0)},Ve=Ae=>{Ae.stopPropagation(),v(!0)};w.useEffect(()=>{const Ae=lt=>{if(p)m(gt=>({...gt,x:Math.max(0,Math.min(lt.clientX-g.x,window.innerWidth-gt.width)),y:Math.max(0,Math.min(lt.clientY-g.y,window.innerHeight-gt.height))}));else if(y&&z.current){const gt=z.current.getBoundingClientRect();m(ft=>({...ft,width:Math.max(200,Math.min(lt.clientX-gt.left,window.innerWidth-ft.x-10)),height:Math.max(150,Math.min(lt.clientY-gt.top,window.innerHeight-ft.y-10))}))}},$e=lt=>{if(!p&&!y)return;lt.preventDefault();const gt=lt.touches[0];if(p)m(ft=>({...ft,x:Math.max(0,Math.min(gt.clientX-g.x,window.innerWidth-ft.width)),y:Math.max(0,Math.min(gt.clientY-g.y,window.innerHeight-ft.height))}));else if(y&&z.current){const ft=z.current.getBoundingClientRect();m(Bt=>({...Bt,width:Math.max(200,Math.min(gt.clientX-ft.left,window.innerWidth-Bt.x-10)),height:Math.max(150,Math.min(gt.clientY-ft.top,window.innerHeight-Bt.y-10))}))}},et=()=>{f(!1),v(!1)};if(p||y)return document.addEventListener("mousemove",Ae),document.addEventListener("mouseup",et),document.addEventListener("touchmove",$e,{passive:!1}),document.addEventListener("touchend",et),document.addEventListener("touchcancel",et),()=>{document.removeEventListener("mousemove",Ae),document.removeEventListener("mouseup",et),document.removeEventListener("touchmove",$e),document.removeEventListener("touchend",et),document.removeEventListener("touchcancel",et)}},[p,y,g]);const Te=za(`/api/v1/printers/${t}/camera/stream?fps=15&t=${te}`);return a.jsxs("div",{ref:z,className:`${P?"fixed inset-0 z-[100]":"fixed z-40 rounded-lg shadow-2xl border border-bambu-dark-tertiary"} bg-bambu-dark-secondary overflow-hidden`,style:P?void 0:{left:u.x,top:u.y,width:_?200:u.width,height:_?40:u.height,cursor:p?"grabbing":"default"},children:[a.jsxs("div",{className:"flex items-center justify-between px-3 py-2 bg-bambu-dark border-b border-bambu-dark-tertiary cursor-grab active:cursor-grabbing",onMouseDown:Ge,onTouchStart:De,children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm text-white truncate",children:[a.jsx(Lh,{className:"w-4 h-4 text-bambu-gray flex-shrink-0"}),a.jsx("span",{className:"truncate",children:V?.name||e})]}),a.jsxs("div",{className:"flex items-center gap-1 no-drag",children:[a.jsx("button",{onClick:()=>ie.mutate(!J?.chamber_light),disabled:!J?.connected||ie.isPending||!l("printers:control"),className:`p-1 rounded disabled:opacity-50 ${J?.chamber_light?"bg-yellow-500/20 hover:bg-yellow-500/30":"hover:bg-bambu-dark-tertiary"}`,title:l("printers:control")?i("camera.chamberLight"):i("printers.permission.noControl"),children:a.jsx(KO,{on:J?.chamber_light??!1,className:"w-3.5 h-3.5"})}),a.jsx("button",{onClick:()=>X(!0),disabled:!me||!l("printers:control"),className:`p-1 rounded disabled:opacity-50 ${me&&l("printers:control")?"hover:bg-bambu-dark-tertiary":""}`,title:l("printers:control")?i(me?"printers.skipObjects.tooltip":"printers.skipObjects.onlyWhilePrinting"):i("printers.permission.noControl"),children:a.jsx(IP,{className:"w-3.5 h-3.5 text-bambu-gray"})}),a.jsx("button",{onClick:ve,disabled:ue||B,className:"p-1 hover:bg-bambu-dark-tertiary rounded disabled:opacity-50",title:"Refresh stream",children:a.jsx(wr,{className:`w-3.5 h-3.5 text-bambu-gray ${ue?"animate-spin":""}`})}),a.jsx("button",{onClick:U,className:"p-1 hover:bg-bambu-dark-tertiary rounded",title:P?"Exit fullscreen":"Fullscreen",children:P?a.jsx(gQ,{className:"w-3.5 h-3.5 text-bambu-gray"}):a.jsx(qfe,{className:"w-3.5 h-3.5 text-bambu-gray"})}),a.jsx("button",{onClick:()=>N(!_),className:"p-1 hover:bg-bambu-dark-tertiary rounded",title:_?"Expand":"Minimize",children:_?a.jsx(_P,{className:"w-3.5 h-3.5 text-bambu-gray"}):a.jsx(hO,{className:"w-3.5 h-3.5 text-bambu-gray"})}),a.jsx("button",{onClick:r,className:"p-1 hover:bg-red-500/20 rounded",title:"Close",children:a.jsx(Ht,{className:"w-3.5 h-3.5 text-bambu-gray hover:text-red-400"})})]})]}),!_&&a.jsxs("div",{className:"relative w-full bg-black flex items-center justify-center overflow-hidden h-[calc(100%-40px)]",onWheel:be,onMouseMove:ye,onMouseUp:fe,onMouseLeave:fe,onTouchStart:Me,onTouchMove:_e,onTouchEnd:je,style:{touchAction:"none"},children:[ue&&!B&&a.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50 z-10",children:a.jsx(wr,{className:"w-6 h-6 text-bambu-gray animate-spin"})}),B&&a.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/80 z-10",children:a.jsxs("div",{className:"text-center p-2",children:[a.jsx(tm,{className:"w-6 h-6 text-orange-400 mx-auto mb-2"}),a.jsxs("p",{className:"text-xs text-bambu-gray",children:["Reconnecting in ",D,"s..."]})]})}),de&&!B&&a.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black z-10",children:a.jsxs("div",{className:"text-center p-2",children:[a.jsx(Fn,{className:"w-6 h-6 text-orange-400 mx-auto mb-2"}),a.jsx("p",{className:"text-xs text-bambu-gray mb-2",children:"Camera unavailable"}),a.jsx("button",{onClick:ve,className:"px-2 py-1 text-xs bg-bambu-green text-white rounded hover:bg-bambu-green/80",children:"Retry"})]})}),a.jsx("img",{ref:K,src:Te,alt:"Camera stream",className:"max-w-full max-h-full object-contain select-none",style:{transform:`scale(${M}) translate(${A.x/M}px, ${A.y/M}px) rotate(${V?.camera_rotation||0}deg)`,...V?.camera_rotation===90||V?.camera_rotation===270?{maxWidth:"100%",maxHeight:"100%"}:{},cursor:M>1?F?"grabbing":"grab":"default"},onError:Fe,onLoad:Xe,onMouseDown:we,draggable:!1},te),a.jsxs("div",{className:"absolute bottom-2 left-2 flex items-center gap-1 bg-black/60 rounded px-1.5 py-1 no-drag",children:[a.jsx("button",{onClick:ne,disabled:M<=1,className:"p-1 hover:bg-white/10 rounded disabled:opacity-30",title:"Zoom out",children:a.jsx(xO,{className:"w-3.5 h-3.5 text-white"})}),a.jsxs("button",{onClick:ze,className:"px-1.5 py-0.5 text-xs text-white hover:bg-white/10 rounded min-w-[32px]",title:"Reset zoom",children:[Math.round(M*100),"%"]}),a.jsx("button",{onClick:R,disabled:M>=4,className:"p-1 hover:bg-white/10 rounded disabled:opacity-30",title:"Zoom in",children:a.jsx(bO,{className:"w-3.5 h-3.5 text-white"})})]}),!P&&a.jsx("div",{className:"absolute bottom-0 right-0 w-6 h-6 cursor-se-resize no-drag hover:bg-white/10 rounded-tl transition-colors",onMouseDown:Qe,onTouchStart:Ve,title:"Drag to resize",children:a.jsx("svg",{className:"w-6 h-6 text-bambu-gray/70 hover:text-bambu-gray",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M22 22H20V20H22V22ZM22 18H20V16H22V18ZM18 22H16V20H18V22ZM22 14H20V12H22V14ZM18 18H16V16H18V18ZM14 22H12V20H14V22ZM22 10H20V8H22V10ZM18 14H16V12H18V14ZM14 18H12V16H14V18ZM10 22H8V20H10V22Z"})})})]}),a.jsx(YO,{printerId:t,isOpen:G,onClose:()=>X(!1)})]})}function ije({printerId:t,printerName:e,onClose:n}){const{t:r}=Rt(),i=mn(),[s,o]=w.useState(!0),[l,c]=w.useState(new Set),[d,u]=w.useState(""),[m,p]=w.useState("all"),f=w.useRef(null),{data:y,isLoading:v,refetch:g}=Je({queryKey:["mqtt-logs",t],queryFn:()=>he.getMQTTLogs(t),refetchInterval:1e3}),b=ct({mutationFn:()=>he.enableMQTTLogging(t),onSuccess:()=>{i.invalidateQueries({queryKey:["mqtt-logs",t]})}}),_=ct({mutationFn:()=>he.disableMQTTLogging(t),onSuccess:()=>{i.invalidateQueries({queryKey:["mqtt-logs",t]})}}),N=ct({mutationFn:()=>he.clearMQTTLogs(t),onSuccess:()=>{i.invalidateQueries({queryKey:["mqtt-logs",t]})}});w.useEffect(()=>{const F=$=>{$.key==="Escape"&&n()};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[n]),w.useEffect(()=>{s&&f.current&&(f.current.scrollTop=f.current.scrollHeight)},[y?.logs,s]);const P=F=>{c($=>{const I=new Set($);return I.has(F)?I.delete(F):I.add(F),I})},k=F=>new Date(F).toLocaleTimeString("en-US",{hour12:!1,fractionalSecondDigits:3}),M=(F,$)=>{if(F==null)return"";const I=typeof F=="string"?JSON.parse(F):F,Q=JSON.stringify(I,null,$?2:0);return!$&&Q.length>100?Q.substring(0,100)+"...":Q},T=y?.logging_enabled??!1,A=w.useMemo(()=>y?.logs??[],[y?.logs]),C=w.useMemo(()=>A.filter(F=>{if(m!=="all"&&F.direction!==m)return!1;if(d.trim()){const $=d.toLowerCase(),I=F.topic.toLowerCase().includes($),L=JSON.stringify(F.payload).toLowerCase().includes($);return I||L}return!0}),[A,d,m]);return a.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",children:a.jsxs("div",{className:"bg-bambu-dark-secondary rounded-lg max-w-4xl w-full max-h-[85vh] flex flex-col",children:[a.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-semibold text-white",children:r("mqttDebug.title")}),a.jsx("p",{className:"text-sm text-bambu-gray",children:e})]}),a.jsx("button",{onClick:n,className:"text-bambu-gray hover:text-white transition-colors",children:a.jsx(Ht,{className:"w-5 h-5"})})]}),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",children:[T?a.jsxs(Ie,{size:"sm",variant:"secondary",onClick:()=>_.mutate(),disabled:_.isPending,children:[a.jsx(io,{className:"w-4 h-4"}),r("mqttDebug.stopLogging")]}):a.jsxs(Ie,{size:"sm",onClick:()=>b.mutate(),disabled:b.isPending,children:[a.jsx(zs,{className:"w-4 h-4"}),r("mqttDebug.startLogging")]}),a.jsxs(Ie,{size:"sm",variant:"secondary",onClick:()=>N.mutate(),disabled:N.isPending||A.length===0,children:[a.jsx(un,{className:"w-4 h-4"}),r("mqttDebug.clearLog")]}),a.jsx(Ie,{size:"sm",variant:"secondary",onClick:()=>g(),disabled:v,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:s,onChange:F=>o(F.target.checked),className:"rounded border-bambu-dark-tertiary"}),"Auto-scroll"]}),a.jsxs("span",{className:"text-sm text-bambu-gray",children:[C.length,"/",A.length]})]}),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:r("mqttDebug.searchPlaceholder"),value:d,onChange:F=>u(F.target.value),className:"w-full pl-8 pr-3 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none"}),d&&a.jsx("button",{onClick:()=>u(""),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 rounded border border-bambu-dark-tertiary",children:[a.jsx("button",{onClick:()=>p("all"),className:`px-2 py-1.5 text-xs rounded-l transition-colors ${m==="all"?"bg-bambu-green text-white":"text-bambu-gray hover:text-white"}`,children:r("mqttDebug.all")}),a.jsxs("button",{onClick:()=>p("in"),className:`px-2 py-1.5 text-xs transition-colors flex items-center gap-1 ${m==="in"?"bg-blue-500 text-white":"text-bambu-gray hover:text-white"}`,children:[a.jsx(xx,{className:"w-3 h-3"}),r("mqttDebug.incoming")]}),a.jsxs("button",{onClick:()=>p("out"),className:`px-2 py-1.5 text-xs rounded-r transition-colors flex items-center gap-1 ${m==="out"?"bg-green-500 text-white":"text-bambu-gray hover:text-white"}`,children:[a.jsx(If,{className:"w-3 h-3"}),r("mqttDebug.outgoing")]})]})]})]}),a.jsx("div",{ref:f,className:"flex-1 overflow-auto p-4 font-mono text-xs bg-black min-h-[400px]",children:A.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-bambu-gray",children:[a.jsx("p",{className:"mb-2",children:r("mqttDebug.noMessages")}),!T&&a.jsx("p",{className:"text-sm",children:r("mqttDebug.startLoggingHint")})]}):C.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-bambu-gray",children:[a.jsx("p",{className:"mb-2",children:r("mqttDebug.noMessagesMatch")}),a.jsx("p",{className:"text-sm",children:r("mqttDebug.adjustFilterHint")})]}):a.jsx("div",{className:"space-y-1",children:C.map((F,$)=>{const I=l.has($),Q=F.direction==="in";return a.jsxs("div",{className:`p-2 rounded cursor-pointer hover:bg-bambu-dark-secondary transition-colors ${I?"bg-bambu-dark-secondary":""}`,onClick:()=>P($),children:[a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"text-bambu-gray shrink-0",children:k(F.timestamp)}),a.jsx("span",{className:`shrink-0 ${Q?"text-blue-400":"text-green-400"}`,title:r(Q?"mqttDebug.incoming":"mqttDebug.outgoing"),children:Q?a.jsx(xx,{className:"w-3 h-3"}):a.jsx(If,{className:"w-3 h-3"})}),a.jsx("span",{className:"text-purple-400 shrink-0",children:F.topic})]}),I?a.jsx("pre",{className:"mt-2 p-3 bg-gray-900 border border-gray-700 rounded text-green-400 overflow-x-auto whitespace-pre-wrap break-all max-h-96 overflow-y-auto text-xs",children:M(F.payload,!0)}):a.jsx("pre",{className:"mt-1 text-white/80 truncate",children:M(F.payload,!1)})]},$)})})}),a.jsxs("div",{className:"flex items-center justify-between p-4 border-t border-bambu-dark-tertiary",children:[a.jsx("div",{className:"text-sm text-bambu-gray",children:T?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"}),r("mqttDebug.loggingActive")]}):a.jsx("span",{children:r("mqttDebug.loggingStopped")})}),a.jsx(Ie,{variant:"secondary",onClick:n,children:r("common.close")})]})]})})}function rJ(t){if(!t)return"/img/printers/default.png";const e=t.toLowerCase().replace(/\s+/g,"");return e.includes("x1e")?"/img/printers/x1e.png":e.includes("x1c")||e.includes("x1carbon")||e.includes("x1")?"/img/printers/x1c.png":e.includes("h2dpro")||e.includes("h2d-pro")?"/img/printers/h2dpro.png":e.includes("h2d")?"/img/printers/h2d.png":e.includes("h2c")?"/img/printers/h2c.png":e.includes("h2s")?"/img/printers/h2d.png":e.includes("p2s")||e.includes("p1s")?"/img/printers/p1s.png":e.includes("p1p")?"/img/printers/p1p.png":e.includes("a1mini")?"/img/printers/a1mini.png":e.includes("a1")?"/img/printers/a1.png":"/img/printers/default.png"}function aJ(t){return t>=-50?{labelKey:"printers.wifiSignal.excellent",color:"text-bambu-green",bars:4}:t>=-60?{labelKey:"printers.wifiSignal.good",color:"text-bambu-green",bars:3}:t>=-70?{labelKey:"printers.wifiSignal.fair",color:"text-yellow-400",bars:2}:t>=-80?{labelKey:"printers.wifiSignal.weak",color:"text-orange-400",bars:1}:{labelKey:"printers.wifiSignal.veryWeak",color:"text-red-400",bars:1}}function iJ(t,e,n){return t.filter(r=>{if(r.required_filament_types&&r.required_filament_types.length>0&&e!==void 0&&!r.required_filament_types.every(i=>e.has(i.toUpperCase())))return!1;if(r.filament_overrides&&r.filament_overrides.length>0&&n!==void 0){const i=r.filament_overrides.filter(o=>o.force_color_match===!0),s=r.filament_overrides.filter(o=>o.force_color_match!==!0);if(i.length>0&&!i.every(l=>{const c=(l.type||"").toUpperCase(),d=(l.color||"").replace("#","").toLowerCase().slice(0,6);return n.has(`${c}:${d}`)})||s.length>0&&i.length===0&&!s.some(l=>{const c=(l.type||"").toUpperCase(),d=(l.color||"").replace("#","").toLowerCase().slice(0,6);return n.has(`${c}:${d}`)}))return!1}return!0})}function sje({printerId:t,printerModel:e,printerState:n,plateCleared:r,requirePlateClear:i=!0,loadedFilamentTypes:s,loadedFilaments:o}){const{t:l}=Rt(),c=mn(),{showToast:d}=bn(),{hasPermission:u}=_r(),{data:m}=Je({queryKey:["queue",t,"pending",e],queryFn:()=>he.getQueue(t,"pending",e||void 0),refetchInterval:3e4}),p=ct({mutationFn:()=>he.clearPlate(t),onSuccess:()=>{c.invalidateQueries({queryKey:["queue",t]}),c.invalidateQueries({queryKey:["printerStatus",t]}),d(l("queue.clearPlateSuccess"),"success")},onError:N=>{d(N.message,"error")}}),f=m?iJ(m,s,o):void 0,y=f?.filter(N=>!N.manual_start)??[],v=f?.length||0;if(v===0)return null;const g=y[0],b=f?.[0];if(i&&(n==="FINISH"||n==="FAILED")&&!r&&y.length>0){const N=g||b;return a.jsxs("div",{className:"mb-3 p-3 bg-bambu-dark rounded-lg border border-yellow-400/30",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[a.jsx(Yr,{className:"w-5 h-5 text-yellow-400 flex-shrink-0"}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"text-xs text-bambu-gray",children:l("queue.nextInQueue")}),a.jsx("p",{className:"text-sm text-white truncate",children:N?.archive_name||N?.library_file_name||`File #${N?.archive_id||N?.library_file_id}`})]}),v>1&&a.jsxs("span",{className:"text-xs px-1.5 py-0.5 bg-yellow-400/20 text-yellow-400 rounded flex-shrink-0",children:["+",v-1]})]}),p.isSuccess?a.jsxs("div",{className:"w-full py-2 px-3 rounded-lg bg-bambu-green/10 border border-bambu-green/20 text-bambu-green text-sm flex items-center justify-center gap-2",children:[a.jsx(jc,{className:"w-4 h-4"}),l("queue.plateReady")]}):a.jsxs("button",{onClick:()=>p.mutate(),disabled:p.isPending||!u("printers:clear_plate"),className:"w-full py-2 px-3 rounded-lg bg-bambu-green/20 border border-bambu-green/40 text-bambu-green hover:bg-bambu-green/30 transition-colors text-sm font-medium flex items-center justify-center gap-2 disabled:opacity-50",children:[p.isPending?a.jsx(dt,{className:"w-4 h-4 animate-spin"}):a.jsx(jc,{className:"w-4 h-4"}),l("queue.clearPlate")]})]})}return a.jsx(To,{to:"/queue",className:"block mb-3 p-3 bg-bambu-dark rounded-lg hover:bg-bambu-dark-tertiary transition-colors",children:a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[a.jsx(Yr,{className:"w-5 h-5 text-yellow-400 flex-shrink-0"}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"text-xs text-bambu-gray",children:l("queue.nextInQueue")}),a.jsx("p",{className:"text-sm text-white truncate",children:b?.archive_name||b?.library_file_name||`File #${b?.archive_id||b?.library_file_id}`})]})]}),a.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[a.jsxs("span",{className:"text-xs text-bambu-gray flex items-center gap-1",children:[a.jsx(ir,{className:"w-3 h-3"}),b?.scheduled_time?_x(b.scheduled_time,"system",l):l("time.waiting")]}),v>1&&a.jsxs("span",{className:"text-xs px-1.5 py-0.5 bg-yellow-400/20 text-yellow-400 rounded",children:["+",v-1]}),a.jsx(Ya,{className:"w-4 h-4 text-bambu-gray"})]})]})})}function sJ(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{var{children:n,width:r,height:i,viewBox:s,className:o,style:l,title:c,desc:d}=t,u=mje(t,uje),m=s||{width:r,height:i,x:0,y:0},p=Sr("recharts-surface",o);return w.createElement("svg",ZF({},vs(u),{className:p,width:r,height:i,style:l,viewBox:"".concat(m.x," ").concat(m.y," ").concat(m.width," ").concat(m.height),ref:e}),w.createElement("title",null,c),w.createElement("desc",null,d),n)}),pje=["children","className"];function JF(){return JF=Object.assign?Object.assign.bind():function(t){for(var e=1;e{var{children:n,className:r}=t,i=fje(t,pje),s=Sr("recharts-layer",r);return w.createElement("g",JF({className:s},vs(i),{ref:e}),n)}),cJ=w.createContext(null),bje=()=>w.useContext(cJ);function la(t){return function(){return t}}const dJ=Math.cos,yk=Math.sin,Vc=Math.sqrt,vk=Math.PI,zP=2*vk,eR=Math.PI,tR=2*eR,Xp=1e-6,xje=tR-Xp;function uJ(t){this._+=t[0];for(let e=1,n=t.length;e=0))throw new Error(`invalid digits: ${t}`);if(e>15)return uJ;const n=10**e;return function(r){this._+=r[0];for(let i=1,s=r.length;iXp)if(!(Math.abs(m*c-d*u)>Xp)||!s)this._append`L${this._x1=e},${this._y1=n}`;else{let f=r-o,y=i-l,v=c*c+d*d,g=f*f+y*y,b=Math.sqrt(v),_=Math.sqrt(p),N=s*Math.tan((eR-Math.acos((v+p-g)/(2*b*_)))/2),P=N/_,k=N/b;Math.abs(P-1)>Xp&&this._append`L${e+P*u},${n+P*m}`,this._append`A${s},${s},0,0,${+(m*f>u*y)},${this._x1=e+k*c},${this._y1=n+k*d}`}}arc(e,n,r,i,s,o){if(e=+e,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let l=r*Math.cos(i),c=r*Math.sin(i),d=e+l,u=n+c,m=1^o,p=o?i-s:s-i;this._x1===null?this._append`M${d},${u}`:(Math.abs(this._x1-d)>Xp||Math.abs(this._y1-u)>Xp)&&this._append`L${d},${u}`,r&&(p<0&&(p=p%tR+tR),p>xje?this._append`A${r},${r},0,1,${m},${e-l},${n-c}A${r},${r},0,1,${m},${this._x1=d},${this._y1=u}`:p>Xp&&this._append`A${r},${r},0,${+(p>=eR)},${m},${this._x1=e+r*Math.cos(s)},${this._y1=n+r*Math.sin(s)}`)}rect(e,n,r,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function ZO(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(n==null)e=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);e=r}return t},()=>new vje(e)}function JO(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function mJ(t){this._context=t}mJ.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function UP(t){return new mJ(t)}function hJ(t){return t[0]}function pJ(t){return t[1]}function fJ(t,e){var n=la(!0),r=null,i=UP,s=null,o=ZO(l);t=typeof t=="function"?t:t===void 0?hJ:la(t),e=typeof e=="function"?e:e===void 0?pJ:la(e);function l(c){var d,u=(c=JO(c)).length,m,p=!1,f;for(r==null&&(s=i(f=o())),d=0;d<=u;++d)!(d=f;--y)l.point(N[y],P[y]);l.lineEnd(),l.areaEnd()}b&&(N[p]=+t(g,p,m),P[p]=+e(g,p,m),l.point(r?+r(g,p,m):N[p],n?+n(g,p,m):P[p]))}if(_)return l=null,_+""||null}function u(){return fJ().defined(i).curve(o).context(s)}return d.x=function(m){return arguments.length?(t=typeof m=="function"?m:la(+m),r=null,d):t},d.x0=function(m){return arguments.length?(t=typeof m=="function"?m:la(+m),d):t},d.x1=function(m){return arguments.length?(r=m==null?null:typeof m=="function"?m:la(+m),d):r},d.y=function(m){return arguments.length?(e=typeof m=="function"?m:la(+m),n=null,d):e},d.y0=function(m){return arguments.length?(e=typeof m=="function"?m:la(+m),d):e},d.y1=function(m){return arguments.length?(n=m==null?null:typeof m=="function"?m:la(+m),d):n},d.lineX0=d.lineY0=function(){return u().x(t).y(e)},d.lineY1=function(){return u().x(t).y(n)},d.lineX1=function(){return u().x(r).y(e)},d.defined=function(m){return arguments.length?(i=typeof m=="function"?m:la(!!m),d):i},d.curve=function(m){return arguments.length?(o=m,s!=null&&(l=o(s)),d):o},d.context=function(m){return arguments.length?(m==null?s=l=null:l=o(s=m),d):s},d}class gJ{constructor(e,n){this._context=e,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,n){switch(e=+e,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,n,e,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,e,this._y0,e,n);break}}this._x0=e,this._y0=n}}function wje(t){return new gJ(t,!0)}function Sje(t){return new gJ(t,!1)}const eI={draw(t,e){const n=Vc(e/vk);t.moveTo(n,0),t.arc(0,0,n,0,zP)}},_je={draw(t,e){const n=Vc(e/5)/2;t.moveTo(-3*n,-n),t.lineTo(-n,-n),t.lineTo(-n,-3*n),t.lineTo(n,-3*n),t.lineTo(n,-n),t.lineTo(3*n,-n),t.lineTo(3*n,n),t.lineTo(n,n),t.lineTo(n,3*n),t.lineTo(-n,3*n),t.lineTo(-n,n),t.lineTo(-3*n,n),t.closePath()}},bJ=Vc(1/3),Nje=bJ*2,kje={draw(t,e){const n=Vc(e/Nje),r=n*bJ;t.moveTo(0,-n),t.lineTo(r,0),t.lineTo(0,n),t.lineTo(-r,0),t.closePath()}},Cje={draw(t,e){const n=Vc(e),r=-n/2;t.rect(r,r,n,n)}},Pje=.8908130915292852,xJ=yk(vk/10)/yk(7*vk/10),Tje=yk(zP/10)*xJ,Aje=-dJ(zP/10)*xJ,Mje={draw(t,e){const n=Vc(e*Pje),r=Tje*n,i=Aje*n;t.moveTo(0,-n),t.lineTo(r,i);for(let s=1;s<5;++s){const o=zP*s/5,l=dJ(o),c=yk(o);t.lineTo(c*n,-l*n),t.lineTo(l*r-c*i,c*r+l*i)}t.closePath()}},DE=Vc(3),jje={draw(t,e){const n=-Vc(e/(DE*3));t.moveTo(0,n*2),t.lineTo(-DE*n,-n),t.lineTo(DE*n,-n),t.closePath()}},jl=-.5,El=Vc(3)/2,nR=1/Vc(12),Eje=(nR/2+1)*3,Dje={draw(t,e){const n=Vc(e/Eje),r=n/2,i=n*nR,s=r,o=n*nR+n,l=-s,c=o;t.moveTo(r,i),t.lineTo(s,o),t.lineTo(l,c),t.lineTo(jl*r-El*i,El*r+jl*i),t.lineTo(jl*s-El*o,El*s+jl*o),t.lineTo(jl*l-El*c,El*l+jl*c),t.lineTo(jl*r+El*i,jl*i-El*r),t.lineTo(jl*s+El*o,jl*o-El*s),t.lineTo(jl*l+El*c,jl*c-El*l),t.closePath()}};function Fje(t,e){let n=null,r=ZO(i);t=typeof t=="function"?t:la(t||eI),e=typeof e=="function"?e:la(e===void 0?64:+e);function i(){let s;if(n||(n=s=r()),t.apply(this,arguments).draw(n,+e.apply(this,arguments)),s)return n=null,s+""||null}return i.type=function(s){return arguments.length?(t=typeof s=="function"?s:la(s),i):t},i.size=function(s){return arguments.length?(e=typeof s=="function"?s:la(+s),i):e},i.context=function(s){return arguments.length?(n=s??null,i):n},i}function wk(){}function Sk(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function yJ(t){this._context=t}yJ.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Sk(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Sk(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Rje(t){return new yJ(t)}function vJ(t){this._context=t}vJ.prototype={areaStart:wk,areaEnd:wk,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:Sk(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Lje(t){return new vJ(t)}function wJ(t){this._context=t}wJ.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Sk(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Oje(t){return new wJ(t)}function SJ(t){this._context=t}SJ.prototype={areaStart:wk,areaEnd:wk,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function Ije(t){return new SJ(t)}function N$(t){return t<0?-1:1}function k$(t,e,n){var r=t._x1-t._x0,i=e-t._x1,s=(t._y1-t._y0)/(r||i<0&&-0),o=(n-t._y1)/(i||r<0&&-0),l=(s*i+o*r)/(r+i);return(N$(s)+N$(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(l))||0}function C$(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function FE(t,e,n){var r=t._x0,i=t._y0,s=t._x1,o=t._y1,l=(s-r)/3;t._context.bezierCurveTo(r+l,i+l*e,s-l,o-l*n,s,o)}function _k(t){this._context=t}_k.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:FE(this,this._t0,C$(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,FE(this,C$(this,n=k$(this,t,e)),n);break;default:FE(this,this._t0,n=k$(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function _J(t){this._context=new NJ(t)}(_J.prototype=Object.create(_k.prototype)).point=function(t,e){_k.prototype.point.call(this,e,t)};function NJ(t){this._context=t}NJ.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,i,s){this._context.bezierCurveTo(e,t,r,n,s,i)}};function zje(t){return new _k(t)}function Uje(t){return new _J(t)}function kJ(t){this._context=t}kJ.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),n===2)this._context.lineTo(t[1],e[1]);else for(var r=P$(t),i=P$(e),s=0,o=1;o=0;--e)i[e]=(o[e]-i[e+1])/s[e];for(s[n-1]=(t[n]+i[n-1])/2,e=0;e=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}break}}this._x=t,this._y=e}};function Hje(t){return new BP(t,.5)}function qje(t){return new BP(t,0)}function $je(t){return new BP(t,1)}function Xf(t,e){if((o=t.length)>1)for(var n=1,r,i,s=t[e[0]],o,l=s.length;n=0;)n[e]=e;return n}function Vje(t,e){return t[e]}function Gje(t){const e=[];return e.key=t,e}function Wje(){var t=la([]),e=rR,n=Xf,r=Vje;function i(s){var o=Array.from(t.apply(this,arguments),Gje),l,c=o.length,d=-1,u;for(const m of s)for(l=0,++d;l0){for(var n,r,i=0,s=t[0].length,o;i0){for(var n=0,r=t[e[0]],i,s=r.length;n0)||!((s=(i=t[e[0]]).length)>0))){for(var n=0,r=1,i,s,o;r1&&arguments[1]!==void 0?arguments[1]:tEe,n=10**e,r=Math.round(t*n)/n;return Object.is(r,-0)?0:r}function Ba(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r{var l=n[o-1];return typeof l=="string"?i+l+s:l!==void 0?i+Ch(l)+s:i+s},"")}var $i=t=>t===0?0:t>0?1:-1,Uc=t=>typeof t=="number"&&t!=+t,Zf=t=>typeof t=="string"&&t.indexOf("%")===t.length-1,an=t=>(typeof t=="number"||t instanceof Number)&&!Uc(t),sc=t=>an(t)||typeof t=="string",nEe=0,K0=t=>{var e=++nEe;return"".concat(t||"").concat(e)},Is=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!an(e)&&typeof e!="string")return r;var s;if(Zf(e)){if(n==null)return r;var o=e.indexOf("%");s=n*parseFloat(e.slice(0,o))/100}else s=+e;return Uc(s)&&(s=r),i&&n!=null&&s>n&&(s=n),s},PJ=t=>{if(!Array.isArray(t))return!1;for(var e=t.length,n={},r=0;rr&&(typeof e=="function"?e(r):Qf(r,e))===n)}var Ca=t=>t===null||typeof t>"u",Bw=t=>Ca(t)?t:"".concat(t.charAt(0).toUpperCase()).concat(t.slice(1));function Eo(t){return t!=null}function sp(){}var rEe=["type","size","sizeType"];function aR(){return aR=Object.assign?Object.assign.bind():function(t){for(var e=1;e{var e="symbol".concat(Bw(t));return AJ[e]||eI},uEe=(t,e,n)=>{if(e==="area")return t;switch(n){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var r=18*cEe;return 1.25*t*t*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2)}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},mEe=(t,e)=>{AJ["symbol".concat(Bw(t))]=e},aI=t=>{var{type:e="circle",size:n=64,sizeType:r="area"}=t,i=oEe(t,rEe),s=L$(L$({},i),{},{type:e,size:n,sizeType:r}),o="circle";typeof e=="string"&&(o=e);var l=()=>{var p=dEe(o),f=Fje().type(p).size(uEe(n,r,o)),y=f();if(y!==null)return y},{className:c,cx:d,cy:u}=s,m=vs(s);return an(d)&&an(u)&&an(n)?w.createElement("path",aR({},m,{className:Sr("recharts-symbols",c),transform:"translate(".concat(d,", ").concat(u,")"),d:l()})):null};aI.registerSymbol=mEe;var MJ=t=>"radius"in t&&"startAngle"in t&&"endAngle"in t,iI=(t,e)=>{if(!t||typeof t=="function"||typeof t=="boolean")return null;var n=t;if(w.isValidElement(t)&&(n=t.props),typeof n!="object"&&typeof n!="function")return null;var r={};return Object.keys(n).forEach(i=>{XO(i)&&(r[i]=(s=>n[i](n,s)))}),r},hEe=(t,e,n)=>r=>(t(e,n,r),null),Hw=(t,e,n)=>{if(t===null||typeof t!="object"&&typeof t!="function")return null;var r=null;return Object.keys(t).forEach(i=>{var s=t[i];XO(i)&&typeof s=="function"&&(r||(r={}),r[i]=hEe(s,e,n))}),r};function O$(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function pEe(t){for(var e=1;e(o[l]===void 0&&r[l]!==void 0&&(o[l]=r[l]),o),n);return s}function Nk(){return Nk=Object.assign?Object.assign.bind():function(t){for(var e=1;el({id:y.id,name:y.name}),disabled:f.isPending||(u?.layer_num??0)<=1||!s("printers:control"),className:`px-4 py-2 text-xs font-medium rounded-lg transition-colors ${(u?.layer_num??0)<=1||!s("printers:control")?"bg-gray-100 dark:bg-bambu-dark text-gray-400 dark:text-bambu-gray/50 cursor-not-allowed":"bg-red-100 dark:bg-red-500/20 text-red-600 dark:text-red-400 hover:bg-red-200 dark:hover:bg-red-500/30 border border-red-300 dark:border-red-500/30"}`,title:s("printers:control")?(u?.layer_num??0)<=1?r("printers.skipObjects.waitForLayer",{layer:u?.layer_num??0}):r("printers.skipObjects.skip"):r("printers.permission.noControl"),children:r("printers.skipObjects.skip")})]},y.id))})]})]}):a.jsx("div",{className:"flex items-center justify-center py-12",children:a.jsx(dt,{className:"w-5 h-5 animate-spin text-bambu-gray"})})]})]}),o&&a.jsx(_n,{variant:"warning",title:r("printers.skipObjects.confirmTitle"),message:r("printers.skipObjects.confirmMessage",{name:o.name}),confirmText:r("printers.skipObjects.skip"),isLoading:f.isPending,onConfirm:()=>f.mutate([o.id]),onCancel:()=>l(null)}),c&&m&&a.jsxs("div",{className:"fixed inset-0 bg-black/90 flex items-center justify-center z-60",onClick:()=>d(!1),children:[a.jsx("button",{onClick:()=>d(!1),className:"absolute top-4 right-4 p-2 text-white/70 hover:text-white transition-colors",children:a.jsx(Ht,{className:"w-6 h-6"})}),a.jsxs("div",{className:"relative max-w-[600px] max-h-[80vh] aspect-square",onClick:y=>y.stopPropagation(),children:[u?.cover_url?a.jsx("img",{src:`${u.cover_url}?view=top`,alt:r("printers.printPreview"),className:"w-full h-full object-contain rounded-lg bg-gray-900"}):a.jsx("div",{className:"w-full h-full rounded-lg bg-gray-800 flex items-center justify-center",children:a.jsx(ui,{className:"w-16 h-16 text-gray-500"})}),m.objects.length>0&&a.jsx("div",{className:"absolute inset-0 pointer-events-none",children:m.objects.map((y,v)=>{let g,b;if(y.x!=null&&y.y!=null&&m.bbox_all){const[_,N,P,k]=m.bbox_all,M=P-_,T=k-N,A=8,C=100-A*2;g=A+(y.x-_)/M*C,b=A+(k-y.y)/T*C,g=Math.max(5,Math.min(95,g)),b=Math.max(5,Math.min(95,b))}else if(y.x!=null&&y.y!=null)g=y.x/256*100,b=100-y.y/256*100,g=Math.max(5,Math.min(95,g)),b=Math.max(5,Math.min(95,b));else{const _=Math.ceil(Math.sqrt(m.objects.length)),N=Math.floor(v/_),P=v%_,k=Math.ceil(m.objects.length/_);g=15+P*(70/_)+35/_,b=15+N*(70/k)+35/k}return a.jsx("div",{className:`absolute flex items-center justify-center w-6 h-6 rounded-full text-[10px] font-bold shadow-lg ${y.skipped?"bg-red-500 text-white line-through":"bg-bambu-green text-black"}`,style:{left:`${g}%`,top:`${b}%`,transform:"translate(-50%, -50%)"},title:y.name,children:y.id},y.id)})}),a.jsx("div",{className:"absolute bottom-2 right-2 px-2 py-1 bg-white/90 dark:bg-black/80 rounded text-[10px] text-gray-700 dark:text-white shadow-sm",children:r("printers.skipObjects.activeCount",{count:m.objects.filter(y=>!y.skipped).length})})]})]})]}):null}const eje="embeddedCameraState_",_$=5,tje=2e3,nje=3e4,rje=5e3,EE={x:window.innerWidth-420,y:20,width:400,height:300};function aje({printerId:t,printerName:e,viewerIndex:n=0,onClose:r}){const{t:i}=Rt(),s=mn(),{showToast:o}=bn(),{hasPermission:l}=_r(),c=`${eje}${t}`,d=()=>{try{const $e=localStorage.getItem(c);if($e){const et=JSON.parse($e);return{x:Math.min(Math.max(0,et.x),window.innerWidth-100),y:Math.min(Math.max(0,et.y),window.innerHeight-100),width:Math.max(200,Math.min(et.width,window.innerWidth-20)),height:Math.max(150,Math.min(et.height,window.innerHeight-20))}}}catch{}const Ae=n*30;return{...EE,x:Math.max(0,EE.x-Ae),y:Math.max(0,EE.y+Ae)}},[u,m]=w.useState(d),[p,f]=w.useState(!1),[y,v]=w.useState(!1),[g,b]=w.useState({x:0,y:0}),[_,N]=w.useState(!1),[P,k]=w.useState(!1),[M,T]=w.useState(1),[A,C]=w.useState({x:0,y:0}),[F,$]=w.useState(!1),[I,Q]=w.useState({x:0,y:0}),[L,re]=w.useState(null),[ae,ee]=w.useState(null),[de,le]=w.useState(!1),[ue,Y]=w.useState(!0),[te,se]=w.useState(Date.now()),[ge,Ne]=w.useState(0),[B,W]=w.useState(!1),[D,j]=w.useState(0),z=w.useRef(null),K=w.useRef(null),q=w.useRef(null),ce=w.useRef(null),O=w.useRef(null),[G,X]=w.useState(!1),{data:V}=Je({queryKey:["printer",t],queryFn:()=>he.getPrinter(t),enabled:t>0}),{data:J}=Je({queryKey:["printerStatus",t],queryFn:()=>he.getPrinterStatus(t),refetchInterval:3e4,enabled:t>0}),ie=ct({mutationFn:Ae=>he.setChamberLight(t,Ae),onMutate:async Ae=>{await s.cancelQueries({queryKey:["printerStatus",t]});const $e=s.getQueryData(["printerStatus",t]);return s.setQueryData(["printerStatus",t],et=>({...et,chamber_light:Ae})),{previousStatus:$e}},onSuccess:(Ae,$e)=>{o(`Chamber light ${$e?"on":"off"}`)},onError:(Ae,$e,et)=>{et?.previousStatus&&s.setQueryData(["printerStatus",t],et.previousStatus),o(Ae.message||i("printers.toast.failedToControlChamberLight"),"error")}}),me=(J?.state==="RUNNING"||J?.state==="PAUSE")&&(J?.printable_objects_count??0)>=2;w.useEffect(()=>{const Ae=setTimeout(()=>{localStorage.setItem(c,JSON.stringify(u))},500);return()=>clearTimeout(Ae)},[u,c]);const pe=w.useRef(!1);w.useEffect(()=>{pe.current=!1;const Ae=`/api/v1/printers/${t}/camera/stop`,$e=()=>{if(t>0&&!pe.current){pe.current=!0;const lt={},gt=nm();gt&&(lt.Authorization=`Bearer ${gt}`),fetch(Ae,{method:"POST",keepalive:!0,headers:lt}).catch(()=>{})}},et=K.current;return()=>{et&&(et.src=""),$e(),q.current&&clearTimeout(q.current),ce.current&&clearInterval(ce.current),O.current&&clearInterval(O.current)}},[t]),w.useEffect(()=>{if(ue){const Ae=setTimeout(()=>Y(!1),3e3);return()=>clearTimeout(Ae)}},[ue,te]);const oe=w.useCallback(()=>{if(ge>=_$){W(!1),le(!0);return}const Ae=Math.min(tje*Math.pow(2,ge),nje);W(!0),j(Math.ceil(Ae/1e3)),ce.current=setInterval(()=>{j($e=>$e<=1?(ce.current&&clearInterval(ce.current),0):$e-1)},1e3),q.current=setTimeout(()=>{Ne($e=>$e+1),W(!1),Y(!0),le(!1),K.current&&(K.current.src=""),se(Date.now())},Ae)},[ge]);w.useEffect(()=>{if(ue||B||_){O.current&&(clearInterval(O.current),O.current=null);return}return O.current=setInterval(async()=>{try{const Ae=await he.getCameraStatus(t);(Ae.stalled||!Ae.active&&!de)&&(O.current&&(clearInterval(O.current),O.current=null),Y(!1),oe())}catch{}},rje),()=>{O.current&&(clearInterval(O.current),O.current=null)}},[ue,de,B,_,t,oe]),w.useEffect(()=>{const Ae=()=>{const $e=!!document.fullscreenElement;k($e),$e||(T(1),C({x:0,y:0}))};return document.addEventListener("fullscreenchange",Ae),()=>document.removeEventListener("fullscreenchange",Ae)},[]);const U=()=>{z.current&&(document.fullscreenElement?document.exitFullscreen():z.current.requestFullscreen())},R=()=>{T(Ae=>Math.min(Ae+.5,4))},ne=()=>{T(Ae=>{const $e=Math.max(Ae-.5,1);return $e===1&&C({x:0,y:0}),$e})},be=Ae=>{Ae.preventDefault(),Ae.deltaY<0?R():ne()},we=Ae=>{M>1&&(Ae.preventDefault(),$(!0),Q({x:Ae.clientX-A.x,y:Ae.clientY-A.y}))},xe=w.useCallback(()=>{if(!z.current||!K.current)return{x:200,y:150};const Ae=z.current.getBoundingClientRect(),$e=Ae.width*(M-1)/2,et=Ae.height*(M-1)/2;return{x:Math.max(50,$e),y:Math.max(50,et)}},[M]),ye=Ae=>{if(F&&M>1){const $e=Ae.clientX-I.x,et=Ae.clientY-I.y,lt=xe();C({x:Math.max(-lt.x,Math.min(lt.x,$e)),y:Math.max(-lt.y,Math.min(lt.y,et))})}},fe=()=>{$(!1)},Se=Ae=>{if(Ae.length<2)return 0;const $e=Ae[0].clientX-Ae[1].clientX,et=Ae[0].clientY-Ae[1].clientY;return Math.sqrt($e*$e+et*et)},Ee=Ae=>Ae.length<2?{x:Ae[0].clientX,y:Ae[0].clientY}:{x:(Ae[0].clientX+Ae[1].clientX)/2,y:(Ae[0].clientY+Ae[1].clientY)/2},Me=Ae=>{Ae.touches.length===2?(Ae.preventDefault(),re(Se(Ae.touches)),ee(Ee(Ae.touches))):Ae.touches.length===1&&M>1&&(Ae.preventDefault(),$(!0),Q({x:Ae.touches[0].clientX-A.x,y:Ae.touches[0].clientY-A.y}))},_e=Ae=>{if(Ae.touches.length===2&&L!==null){Ae.preventDefault();const $e=Se(Ae.touches),et=$e/L;T(gt=>{const ft=Math.max(1,Math.min(4,gt*et));return ft===1&&C({x:0,y:0}),ft}),re($e);const lt=Ee(Ae.touches);if(ae){const gt=xe();C(ft=>({x:Math.max(-gt.x,Math.min(gt.x,ft.x+(lt.x-ae.x))),y:Math.max(-gt.y,Math.min(gt.y,ft.y+(lt.y-ae.y)))}))}ee(lt)}else if(Ae.touches.length===1&&F&&M>1){Ae.preventDefault();const $e=Ae.touches[0].clientX-I.x,et=Ae.touches[0].clientY-I.y,lt=xe();C({x:Math.max(-lt.x,Math.min(lt.x,$e)),y:Math.max(-lt.y,Math.min(lt.y,et))})}},je=Ae=>{Ae.touches.length<2&&(re(null),ee(null)),Ae.touches.length===0&&$(!1)},ze=()=>{T(1),C({x:0,y:0})},Fe=()=>{Y(!1),ge<_$?oe():le(!0)},Xe=()=>{Y(!1),le(!1),Ne(0),W(!1),q.current&&clearTimeout(q.current),ce.current&&clearInterval(ce.current)},ve=()=>{Y(!0),le(!1),Ne(0),W(!1),q.current&&clearTimeout(q.current),ce.current&&clearInterval(ce.current);const Ae={},$e=nm();$e&&(Ae.Authorization=`Bearer ${$e}`),fetch(`/api/v1/printers/${t}/camera/stop`,{method:"POST",headers:Ae}).catch(()=>{}),K.current&&(K.current.src=""),setTimeout(()=>se(Date.now()),100)},Ge=Ae=>{Ae.target.closest(".no-drag")||(f(!0),b({x:Ae.clientX-u.x,y:Ae.clientY-u.y}))},De=Ae=>{if(Ae.target.closest(".no-drag"))return;const $e=Ae.touches[0];f(!0),b({x:$e.clientX-u.x,y:$e.clientY-u.y})},Qe=Ae=>{Ae.stopPropagation(),v(!0)},Ve=Ae=>{Ae.stopPropagation(),v(!0)};w.useEffect(()=>{const Ae=lt=>{if(p)m(gt=>({...gt,x:Math.max(0,Math.min(lt.clientX-g.x,window.innerWidth-gt.width)),y:Math.max(0,Math.min(lt.clientY-g.y,window.innerHeight-gt.height))}));else if(y&&z.current){const gt=z.current.getBoundingClientRect();m(ft=>({...ft,width:Math.max(200,Math.min(lt.clientX-gt.left,window.innerWidth-ft.x-10)),height:Math.max(150,Math.min(lt.clientY-gt.top,window.innerHeight-ft.y-10))}))}},$e=lt=>{if(!p&&!y)return;lt.preventDefault();const gt=lt.touches[0];if(p)m(ft=>({...ft,x:Math.max(0,Math.min(gt.clientX-g.x,window.innerWidth-ft.width)),y:Math.max(0,Math.min(gt.clientY-g.y,window.innerHeight-ft.height))}));else if(y&&z.current){const ft=z.current.getBoundingClientRect();m(Bt=>({...Bt,width:Math.max(200,Math.min(gt.clientX-ft.left,window.innerWidth-Bt.x-10)),height:Math.max(150,Math.min(gt.clientY-ft.top,window.innerHeight-Bt.y-10))}))}},et=()=>{f(!1),v(!1)};if(p||y)return document.addEventListener("mousemove",Ae),document.addEventListener("mouseup",et),document.addEventListener("touchmove",$e,{passive:!1}),document.addEventListener("touchend",et),document.addEventListener("touchcancel",et),()=>{document.removeEventListener("mousemove",Ae),document.removeEventListener("mouseup",et),document.removeEventListener("touchmove",$e),document.removeEventListener("touchend",et),document.removeEventListener("touchcancel",et)}},[p,y,g]);const Te=za(`/api/v1/printers/${t}/camera/stream?fps=15&t=${te}`);return a.jsxs("div",{ref:z,className:`${P?"fixed inset-0 z-[100]":"fixed z-40 rounded-lg shadow-2xl border border-bambu-dark-tertiary"} bg-bambu-dark-secondary overflow-hidden`,style:P?void 0:{left:u.x,top:u.y,width:_?200:u.width,height:_?40:u.height,cursor:p?"grabbing":"default"},children:[a.jsxs("div",{className:"flex items-center justify-between px-3 py-2 bg-bambu-dark border-b border-bambu-dark-tertiary cursor-grab active:cursor-grabbing",onMouseDown:Ge,onTouchStart:De,children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm text-white truncate",children:[a.jsx(Lh,{className:"w-4 h-4 text-bambu-gray flex-shrink-0"}),a.jsx("span",{className:"truncate",children:V?.name||e})]}),a.jsxs("div",{className:"flex items-center gap-1 no-drag",children:[a.jsx("button",{onClick:()=>ie.mutate(!J?.chamber_light),disabled:!J?.connected||ie.isPending||!l("printers:control"),className:`p-1 rounded disabled:opacity-50 ${J?.chamber_light?"bg-yellow-500/20 hover:bg-yellow-500/30":"hover:bg-bambu-dark-tertiary"}`,title:l("printers:control")?i("camera.chamberLight"):i("printers.permission.noControl"),children:a.jsx(KO,{on:J?.chamber_light??!1,className:"w-3.5 h-3.5"})}),a.jsx("button",{onClick:()=>X(!0),disabled:!me||!l("printers:control"),className:`p-1 rounded disabled:opacity-50 ${me&&l("printers:control")?"hover:bg-bambu-dark-tertiary":""}`,title:l("printers:control")?i(me?"printers.skipObjects.tooltip":"printers.skipObjects.onlyWhilePrinting"):i("printers.permission.noControl"),children:a.jsx(IP,{className:"w-3.5 h-3.5 text-bambu-gray"})}),a.jsx("button",{onClick:ve,disabled:ue||B,className:"p-1 hover:bg-bambu-dark-tertiary rounded disabled:opacity-50",title:"Refresh stream",children:a.jsx(wr,{className:`w-3.5 h-3.5 text-bambu-gray ${ue?"animate-spin":""}`})}),a.jsx("button",{onClick:U,className:"p-1 hover:bg-bambu-dark-tertiary rounded",title:P?"Exit fullscreen":"Fullscreen",children:P?a.jsx(gQ,{className:"w-3.5 h-3.5 text-bambu-gray"}):a.jsx(qfe,{className:"w-3.5 h-3.5 text-bambu-gray"})}),a.jsx("button",{onClick:()=>N(!_),className:"p-1 hover:bg-bambu-dark-tertiary rounded",title:_?"Expand":"Minimize",children:_?a.jsx(_P,{className:"w-3.5 h-3.5 text-bambu-gray"}):a.jsx(hO,{className:"w-3.5 h-3.5 text-bambu-gray"})}),a.jsx("button",{onClick:r,className:"p-1 hover:bg-red-500/20 rounded",title:"Close",children:a.jsx(Ht,{className:"w-3.5 h-3.5 text-bambu-gray hover:text-red-400"})})]})]}),!_&&a.jsxs("div",{className:"relative w-full bg-black flex items-center justify-center overflow-hidden h-[calc(100%-40px)]",onWheel:be,onMouseMove:ye,onMouseUp:fe,onMouseLeave:fe,onTouchStart:Me,onTouchMove:_e,onTouchEnd:je,style:{touchAction:"none"},children:[ue&&!B&&a.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50 z-10",children:a.jsx(wr,{className:"w-6 h-6 text-bambu-gray animate-spin"})}),B&&a.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/80 z-10",children:a.jsxs("div",{className:"text-center p-2",children:[a.jsx(tm,{className:"w-6 h-6 text-orange-400 mx-auto mb-2"}),a.jsxs("p",{className:"text-xs text-bambu-gray",children:["Reconnecting in ",D,"s..."]})]})}),de&&!B&&a.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black z-10",children:a.jsxs("div",{className:"text-center p-2",children:[a.jsx(Fn,{className:"w-6 h-6 text-orange-400 mx-auto mb-2"}),a.jsx("p",{className:"text-xs text-bambu-gray mb-2",children:"Camera unavailable"}),a.jsx("button",{onClick:ve,className:"px-2 py-1 text-xs bg-bambu-green text-white rounded hover:bg-bambu-green/80",children:"Retry"})]})}),a.jsx("img",{ref:K,src:Te,alt:"Camera stream",className:"max-w-full max-h-full object-contain select-none",style:{transform:`scale(${M}) translate(${A.x/M}px, ${A.y/M}px) rotate(${V?.camera_rotation||0}deg)`,...V?.camera_rotation===90||V?.camera_rotation===270?{maxWidth:"100%",maxHeight:"100%"}:{},cursor:M>1?F?"grabbing":"grab":"default"},onError:Fe,onLoad:Xe,onMouseDown:we,draggable:!1},te),a.jsxs("div",{className:"absolute bottom-2 left-2 flex items-center gap-1 bg-black/60 rounded px-1.5 py-1 no-drag",children:[a.jsx("button",{onClick:ne,disabled:M<=1,className:"p-1 hover:bg-white/10 rounded disabled:opacity-30",title:"Zoom out",children:a.jsx(xO,{className:"w-3.5 h-3.5 text-white"})}),a.jsxs("button",{onClick:ze,className:"px-1.5 py-0.5 text-xs text-white hover:bg-white/10 rounded min-w-[32px]",title:"Reset zoom",children:[Math.round(M*100),"%"]}),a.jsx("button",{onClick:R,disabled:M>=4,className:"p-1 hover:bg-white/10 rounded disabled:opacity-30",title:"Zoom in",children:a.jsx(bO,{className:"w-3.5 h-3.5 text-white"})})]}),!P&&a.jsx("div",{className:"absolute bottom-0 right-0 w-6 h-6 cursor-se-resize no-drag hover:bg-white/10 rounded-tl transition-colors",onMouseDown:Qe,onTouchStart:Ve,title:"Drag to resize",children:a.jsx("svg",{className:"w-6 h-6 text-bambu-gray/70 hover:text-bambu-gray",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M22 22H20V20H22V22ZM22 18H20V16H22V18ZM18 22H16V20H18V22ZM22 14H20V12H22V14ZM18 18H16V16H18V18ZM14 22H12V20H14V22ZM22 10H20V8H22V10ZM18 14H16V12H18V14ZM14 18H12V16H14V18ZM10 22H8V20H10V22Z"})})})]}),a.jsx(YO,{printerId:t,isOpen:G,onClose:()=>X(!1)})]})}function ije({printerId:t,printerName:e,onClose:n}){const{t:r}=Rt(),i=mn(),[s,o]=w.useState(!0),[l,c]=w.useState(new Set),[d,u]=w.useState(""),[m,p]=w.useState("all"),f=w.useRef(null),{data:y,isLoading:v,refetch:g}=Je({queryKey:["mqtt-logs",t],queryFn:()=>he.getMQTTLogs(t),refetchInterval:1e3}),b=ct({mutationFn:()=>he.enableMQTTLogging(t),onSuccess:()=>{i.invalidateQueries({queryKey:["mqtt-logs",t]})}}),_=ct({mutationFn:()=>he.disableMQTTLogging(t),onSuccess:()=>{i.invalidateQueries({queryKey:["mqtt-logs",t]})}}),N=ct({mutationFn:()=>he.clearMQTTLogs(t),onSuccess:()=>{i.invalidateQueries({queryKey:["mqtt-logs",t]})}});w.useEffect(()=>{const F=$=>{$.key==="Escape"&&n()};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[n]),w.useEffect(()=>{s&&f.current&&(f.current.scrollTop=f.current.scrollHeight)},[y?.logs,s]);const P=F=>{c($=>{const I=new Set($);return I.has(F)?I.delete(F):I.add(F),I})},k=F=>new Date(F).toLocaleTimeString("en-US",{hour12:!1,fractionalSecondDigits:3}),M=(F,$)=>{if(F==null)return"";const I=typeof F=="string"?JSON.parse(F):F,Q=JSON.stringify(I,null,$?2:0);return!$&&Q.length>100?Q.substring(0,100)+"...":Q},T=y?.logging_enabled??!1,A=w.useMemo(()=>y?.logs??[],[y?.logs]),C=w.useMemo(()=>A.filter(F=>{if(m!=="all"&&F.direction!==m)return!1;if(d.trim()){const $=d.toLowerCase(),I=F.topic.toLowerCase().includes($),L=JSON.stringify(F.payload).toLowerCase().includes($);return I||L}return!0}),[A,d,m]);return a.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",children:a.jsxs("div",{className:"bg-bambu-dark-secondary rounded-lg max-w-4xl w-full max-h-[85vh] flex flex-col",children:[a.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-semibold text-white",children:r("mqttDebug.title")}),a.jsx("p",{className:"text-sm text-bambu-gray",children:e})]}),a.jsx("button",{onClick:n,className:"text-bambu-gray hover:text-white transition-colors",children:a.jsx(Ht,{className:"w-5 h-5"})})]}),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",children:[T?a.jsxs(Ie,{size:"sm",variant:"secondary",onClick:()=>_.mutate(),disabled:_.isPending,children:[a.jsx(io,{className:"w-4 h-4"}),r("mqttDebug.stopLogging")]}):a.jsxs(Ie,{size:"sm",onClick:()=>b.mutate(),disabled:b.isPending,children:[a.jsx(zs,{className:"w-4 h-4"}),r("mqttDebug.startLogging")]}),a.jsxs(Ie,{size:"sm",variant:"secondary",onClick:()=>N.mutate(),disabled:N.isPending||A.length===0,children:[a.jsx(un,{className:"w-4 h-4"}),r("mqttDebug.clearLog")]}),a.jsx(Ie,{size:"sm",variant:"secondary",onClick:()=>g(),disabled:v,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:s,onChange:F=>o(F.target.checked),className:"rounded border-bambu-dark-tertiary"}),"Auto-scroll"]}),a.jsxs("span",{className:"text-sm text-bambu-gray",children:[C.length,"/",A.length]})]}),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:r("mqttDebug.searchPlaceholder"),value:d,onChange:F=>u(F.target.value),className:"w-full pl-8 pr-3 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none"}),d&&a.jsx("button",{onClick:()=>u(""),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 rounded border border-bambu-dark-tertiary",children:[a.jsx("button",{onClick:()=>p("all"),className:`px-2 py-1.5 text-xs rounded-l transition-colors ${m==="all"?"bg-bambu-green text-white":"text-bambu-gray hover:text-white"}`,children:r("mqttDebug.all")}),a.jsxs("button",{onClick:()=>p("in"),className:`px-2 py-1.5 text-xs transition-colors flex items-center gap-1 ${m==="in"?"bg-blue-500 text-white":"text-bambu-gray hover:text-white"}`,children:[a.jsx(xx,{className:"w-3 h-3"}),r("mqttDebug.incoming")]}),a.jsxs("button",{onClick:()=>p("out"),className:`px-2 py-1.5 text-xs rounded-r transition-colors flex items-center gap-1 ${m==="out"?"bg-green-500 text-white":"text-bambu-gray hover:text-white"}`,children:[a.jsx(If,{className:"w-3 h-3"}),r("mqttDebug.outgoing")]})]})]})]}),a.jsx("div",{ref:f,className:"flex-1 overflow-auto p-4 font-mono text-xs bg-black min-h-[400px]",children:A.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-bambu-gray",children:[a.jsx("p",{className:"mb-2",children:r("mqttDebug.noMessages")}),!T&&a.jsx("p",{className:"text-sm",children:r("mqttDebug.startLoggingHint")})]}):C.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-bambu-gray",children:[a.jsx("p",{className:"mb-2",children:r("mqttDebug.noMessagesMatch")}),a.jsx("p",{className:"text-sm",children:r("mqttDebug.adjustFilterHint")})]}):a.jsx("div",{className:"space-y-1",children:C.map((F,$)=>{const I=l.has($),Q=F.direction==="in";return a.jsxs("div",{className:`p-2 rounded cursor-pointer hover:bg-bambu-dark-secondary transition-colors ${I?"bg-bambu-dark-secondary":""}`,onClick:()=>P($),children:[a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"text-bambu-gray shrink-0",children:k(F.timestamp)}),a.jsx("span",{className:`shrink-0 ${Q?"text-blue-400":"text-green-400"}`,title:r(Q?"mqttDebug.incoming":"mqttDebug.outgoing"),children:Q?a.jsx(xx,{className:"w-3 h-3"}):a.jsx(If,{className:"w-3 h-3"})}),a.jsx("span",{className:"text-purple-400 shrink-0",children:F.topic})]}),I?a.jsx("pre",{className:"mt-2 p-3 bg-gray-900 border border-gray-700 rounded text-green-400 overflow-x-auto whitespace-pre-wrap break-all max-h-96 overflow-y-auto text-xs",children:M(F.payload,!0)}):a.jsx("pre",{className:"mt-1 text-white/80 truncate",children:M(F.payload,!1)})]},$)})})}),a.jsxs("div",{className:"flex items-center justify-between p-4 border-t border-bambu-dark-tertiary",children:[a.jsx("div",{className:"text-sm text-bambu-gray",children:T?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"}),r("mqttDebug.loggingActive")]}):a.jsx("span",{children:r("mqttDebug.loggingStopped")})}),a.jsx(Ie,{variant:"secondary",onClick:n,children:r("common.close")})]})]})})}function rJ(t){if(!t)return"/img/printers/default.png";const e=t.toLowerCase().replace(/\s+/g,"");return e.includes("x1e")?"/img/printers/x1e.png":e.includes("x1c")||e.includes("x1carbon")||e.includes("x1")?"/img/printers/x1c.png":e.includes("h2dpro")||e.includes("h2d-pro")?"/img/printers/h2dpro.png":e.includes("h2d")?"/img/printers/h2d.png":e.includes("h2c")?"/img/printers/h2c.png":e.includes("h2s")?"/img/printers/h2d.png":e.includes("p2s")||e.includes("p1s")?"/img/printers/p1s.png":e.includes("p1p")?"/img/printers/p1p.png":e.includes("a1mini")?"/img/printers/a1mini.png":e.includes("a1")?"/img/printers/a1.png":"/img/printers/default.png"}function aJ(t){return t>=-50?{labelKey:"printers.wifiSignal.excellent",color:"text-bambu-green",bars:4}:t>=-60?{labelKey:"printers.wifiSignal.good",color:"text-bambu-green",bars:3}:t>=-70?{labelKey:"printers.wifiSignal.fair",color:"text-yellow-400",bars:2}:t>=-80?{labelKey:"printers.wifiSignal.weak",color:"text-orange-400",bars:1}:{labelKey:"printers.wifiSignal.veryWeak",color:"text-red-400",bars:1}}function iJ(t,e,n){return t.filter(r=>{if(r.required_filament_types&&r.required_filament_types.length>0&&e!==void 0&&!r.required_filament_types.every(i=>e.has(i.toUpperCase())))return!1;if(r.filament_overrides&&r.filament_overrides.length>0&&n!==void 0){const i=r.filament_overrides.filter(o=>o.force_color_match===!0),s=r.filament_overrides.filter(o=>o.force_color_match!==!0);if(i.length>0&&!i.every(l=>{const c=(l.type||"").toUpperCase(),d=(l.color||"").replace("#","").toLowerCase().slice(0,6);return n.has(`${c}:${d}`)})||s.length>0&&i.length===0&&!s.some(l=>{const c=(l.type||"").toUpperCase(),d=(l.color||"").replace("#","").toLowerCase().slice(0,6);return n.has(`${c}:${d}`)}))return!1}return!0})}function sje({printerId:t,printerModel:e,printerState:n,plateCleared:r,requirePlateClear:i=!0,loadedFilamentTypes:s,loadedFilaments:o}){const{t:l}=Rt(),c=mn(),{showToast:d}=bn(),{hasPermission:u}=_r(),{data:m}=Je({queryKey:["queue",t,"pending",e],queryFn:()=>he.getQueue(t,"pending",e||void 0),refetchInterval:3e4}),p=ct({mutationFn:()=>he.clearPlate(t),onSuccess:()=>{c.invalidateQueries({queryKey:["queue",t]}),c.invalidateQueries({queryKey:["printerStatus",t]}),d(l("queue.clearPlateSuccess"),"success")},onError:N=>{d(N.message,"error")}});w.useEffect(()=>{n!=="FINISH"&&n!=="FAILED"&&p.reset()},[n]);const f=m?iJ(m,s,o):void 0,y=f?.filter(N=>!N.manual_start)??[],v=f?.length||0;if(v===0)return null;const g=y[0],b=f?.[0];if(i&&(n==="FINISH"||n==="FAILED")&&!r&&y.length>0){const N=g||b;return a.jsxs("div",{className:"mb-3 p-3 bg-bambu-dark rounded-lg border border-yellow-400/30",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[a.jsx(Yr,{className:"w-5 h-5 text-yellow-400 flex-shrink-0"}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"text-xs text-bambu-gray",children:l("queue.nextInQueue")}),a.jsx("p",{className:"text-sm text-white truncate",children:N?.archive_name||N?.library_file_name||`File #${N?.archive_id||N?.library_file_id}`})]}),v>1&&a.jsxs("span",{className:"text-xs px-1.5 py-0.5 bg-yellow-400/20 text-yellow-400 rounded flex-shrink-0",children:["+",v-1]})]}),p.isSuccess?a.jsxs("div",{className:"w-full py-2 px-3 rounded-lg bg-bambu-green/10 border border-bambu-green/20 text-bambu-green text-sm flex items-center justify-center gap-2",children:[a.jsx(jc,{className:"w-4 h-4"}),l("queue.plateReady")]}):a.jsxs("button",{onClick:()=>p.mutate(),disabled:p.isPending||!u("printers:clear_plate"),className:"w-full py-2 px-3 rounded-lg bg-bambu-green/20 border border-bambu-green/40 text-bambu-green hover:bg-bambu-green/30 transition-colors text-sm font-medium flex items-center justify-center gap-2 disabled:opacity-50",children:[p.isPending?a.jsx(dt,{className:"w-4 h-4 animate-spin"}):a.jsx(jc,{className:"w-4 h-4"}),l("queue.clearPlate")]})]})}return a.jsx(To,{to:"/queue",className:"block mb-3 p-3 bg-bambu-dark rounded-lg hover:bg-bambu-dark-tertiary transition-colors",children:a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[a.jsx(Yr,{className:"w-5 h-5 text-yellow-400 flex-shrink-0"}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"text-xs text-bambu-gray",children:l("queue.nextInQueue")}),a.jsx("p",{className:"text-sm text-white truncate",children:b?.archive_name||b?.library_file_name||`File #${b?.archive_id||b?.library_file_id}`})]})]}),a.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[a.jsxs("span",{className:"text-xs text-bambu-gray flex items-center gap-1",children:[a.jsx(ir,{className:"w-3 h-3"}),b?.scheduled_time?_x(b.scheduled_time,"system",l):l("time.waiting")]}),v>1&&a.jsxs("span",{className:"text-xs px-1.5 py-0.5 bg-yellow-400/20 text-yellow-400 rounded",children:["+",v-1]}),a.jsx(Ya,{className:"w-4 h-4 text-bambu-gray"})]})]})})}function sJ(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{var{children:n,width:r,height:i,viewBox:s,className:o,style:l,title:c,desc:d}=t,u=mje(t,uje),m=s||{width:r,height:i,x:0,y:0},p=Sr("recharts-surface",o);return w.createElement("svg",ZF({},vs(u),{className:p,width:r,height:i,style:l,viewBox:"".concat(m.x," ").concat(m.y," ").concat(m.width," ").concat(m.height),ref:e}),w.createElement("title",null,c),w.createElement("desc",null,d),n)}),pje=["children","className"];function JF(){return JF=Object.assign?Object.assign.bind():function(t){for(var e=1;e{var{children:n,className:r}=t,i=fje(t,pje),s=Sr("recharts-layer",r);return w.createElement("g",JF({className:s},vs(i),{ref:e}),n)}),cJ=w.createContext(null),bje=()=>w.useContext(cJ);function la(t){return function(){return t}}const dJ=Math.cos,yk=Math.sin,Vc=Math.sqrt,vk=Math.PI,zP=2*vk,eR=Math.PI,tR=2*eR,Xp=1e-6,xje=tR-Xp;function uJ(t){this._+=t[0];for(let e=1,n=t.length;e=0))throw new Error(`invalid digits: ${t}`);if(e>15)return uJ;const n=10**e;return function(r){this._+=r[0];for(let i=1,s=r.length;iXp)if(!(Math.abs(m*c-d*u)>Xp)||!s)this._append`L${this._x1=e},${this._y1=n}`;else{let f=r-o,y=i-l,v=c*c+d*d,g=f*f+y*y,b=Math.sqrt(v),_=Math.sqrt(p),N=s*Math.tan((eR-Math.acos((v+p-g)/(2*b*_)))/2),P=N/_,k=N/b;Math.abs(P-1)>Xp&&this._append`L${e+P*u},${n+P*m}`,this._append`A${s},${s},0,0,${+(m*f>u*y)},${this._x1=e+k*c},${this._y1=n+k*d}`}}arc(e,n,r,i,s,o){if(e=+e,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let l=r*Math.cos(i),c=r*Math.sin(i),d=e+l,u=n+c,m=1^o,p=o?i-s:s-i;this._x1===null?this._append`M${d},${u}`:(Math.abs(this._x1-d)>Xp||Math.abs(this._y1-u)>Xp)&&this._append`L${d},${u}`,r&&(p<0&&(p=p%tR+tR),p>xje?this._append`A${r},${r},0,1,${m},${e-l},${n-c}A${r},${r},0,1,${m},${this._x1=d},${this._y1=u}`:p>Xp&&this._append`A${r},${r},0,${+(p>=eR)},${m},${this._x1=e+r*Math.cos(s)},${this._y1=n+r*Math.sin(s)}`)}rect(e,n,r,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function ZO(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(n==null)e=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);e=r}return t},()=>new vje(e)}function JO(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function mJ(t){this._context=t}mJ.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function UP(t){return new mJ(t)}function hJ(t){return t[0]}function pJ(t){return t[1]}function fJ(t,e){var n=la(!0),r=null,i=UP,s=null,o=ZO(l);t=typeof t=="function"?t:t===void 0?hJ:la(t),e=typeof e=="function"?e:e===void 0?pJ:la(e);function l(c){var d,u=(c=JO(c)).length,m,p=!1,f;for(r==null&&(s=i(f=o())),d=0;d<=u;++d)!(d=f;--y)l.point(N[y],P[y]);l.lineEnd(),l.areaEnd()}b&&(N[p]=+t(g,p,m),P[p]=+e(g,p,m),l.point(r?+r(g,p,m):N[p],n?+n(g,p,m):P[p]))}if(_)return l=null,_+""||null}function u(){return fJ().defined(i).curve(o).context(s)}return d.x=function(m){return arguments.length?(t=typeof m=="function"?m:la(+m),r=null,d):t},d.x0=function(m){return arguments.length?(t=typeof m=="function"?m:la(+m),d):t},d.x1=function(m){return arguments.length?(r=m==null?null:typeof m=="function"?m:la(+m),d):r},d.y=function(m){return arguments.length?(e=typeof m=="function"?m:la(+m),n=null,d):e},d.y0=function(m){return arguments.length?(e=typeof m=="function"?m:la(+m),d):e},d.y1=function(m){return arguments.length?(n=m==null?null:typeof m=="function"?m:la(+m),d):n},d.lineX0=d.lineY0=function(){return u().x(t).y(e)},d.lineY1=function(){return u().x(t).y(n)},d.lineX1=function(){return u().x(r).y(e)},d.defined=function(m){return arguments.length?(i=typeof m=="function"?m:la(!!m),d):i},d.curve=function(m){return arguments.length?(o=m,s!=null&&(l=o(s)),d):o},d.context=function(m){return arguments.length?(m==null?s=l=null:l=o(s=m),d):s},d}class gJ{constructor(e,n){this._context=e,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,n){switch(e=+e,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,n,e,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,e,this._y0,e,n);break}}this._x0=e,this._y0=n}}function wje(t){return new gJ(t,!0)}function Sje(t){return new gJ(t,!1)}const eI={draw(t,e){const n=Vc(e/vk);t.moveTo(n,0),t.arc(0,0,n,0,zP)}},_je={draw(t,e){const n=Vc(e/5)/2;t.moveTo(-3*n,-n),t.lineTo(-n,-n),t.lineTo(-n,-3*n),t.lineTo(n,-3*n),t.lineTo(n,-n),t.lineTo(3*n,-n),t.lineTo(3*n,n),t.lineTo(n,n),t.lineTo(n,3*n),t.lineTo(-n,3*n),t.lineTo(-n,n),t.lineTo(-3*n,n),t.closePath()}},bJ=Vc(1/3),Nje=bJ*2,kje={draw(t,e){const n=Vc(e/Nje),r=n*bJ;t.moveTo(0,-n),t.lineTo(r,0),t.lineTo(0,n),t.lineTo(-r,0),t.closePath()}},Cje={draw(t,e){const n=Vc(e),r=-n/2;t.rect(r,r,n,n)}},Pje=.8908130915292852,xJ=yk(vk/10)/yk(7*vk/10),Tje=yk(zP/10)*xJ,Aje=-dJ(zP/10)*xJ,Mje={draw(t,e){const n=Vc(e*Pje),r=Tje*n,i=Aje*n;t.moveTo(0,-n),t.lineTo(r,i);for(let s=1;s<5;++s){const o=zP*s/5,l=dJ(o),c=yk(o);t.lineTo(c*n,-l*n),t.lineTo(l*r-c*i,c*r+l*i)}t.closePath()}},DE=Vc(3),jje={draw(t,e){const n=-Vc(e/(DE*3));t.moveTo(0,n*2),t.lineTo(-DE*n,-n),t.lineTo(DE*n,-n),t.closePath()}},jl=-.5,El=Vc(3)/2,nR=1/Vc(12),Eje=(nR/2+1)*3,Dje={draw(t,e){const n=Vc(e/Eje),r=n/2,i=n*nR,s=r,o=n*nR+n,l=-s,c=o;t.moveTo(r,i),t.lineTo(s,o),t.lineTo(l,c),t.lineTo(jl*r-El*i,El*r+jl*i),t.lineTo(jl*s-El*o,El*s+jl*o),t.lineTo(jl*l-El*c,El*l+jl*c),t.lineTo(jl*r+El*i,jl*i-El*r),t.lineTo(jl*s+El*o,jl*o-El*s),t.lineTo(jl*l+El*c,jl*c-El*l),t.closePath()}};function Fje(t,e){let n=null,r=ZO(i);t=typeof t=="function"?t:la(t||eI),e=typeof e=="function"?e:la(e===void 0?64:+e);function i(){let s;if(n||(n=s=r()),t.apply(this,arguments).draw(n,+e.apply(this,arguments)),s)return n=null,s+""||null}return i.type=function(s){return arguments.length?(t=typeof s=="function"?s:la(s),i):t},i.size=function(s){return arguments.length?(e=typeof s=="function"?s:la(+s),i):e},i.context=function(s){return arguments.length?(n=s??null,i):n},i}function wk(){}function Sk(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function yJ(t){this._context=t}yJ.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Sk(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Sk(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Rje(t){return new yJ(t)}function vJ(t){this._context=t}vJ.prototype={areaStart:wk,areaEnd:wk,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:Sk(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Lje(t){return new vJ(t)}function wJ(t){this._context=t}wJ.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Sk(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Oje(t){return new wJ(t)}function SJ(t){this._context=t}SJ.prototype={areaStart:wk,areaEnd:wk,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function Ije(t){return new SJ(t)}function N$(t){return t<0?-1:1}function k$(t,e,n){var r=t._x1-t._x0,i=e-t._x1,s=(t._y1-t._y0)/(r||i<0&&-0),o=(n-t._y1)/(i||r<0&&-0),l=(s*i+o*r)/(r+i);return(N$(s)+N$(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(l))||0}function C$(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function FE(t,e,n){var r=t._x0,i=t._y0,s=t._x1,o=t._y1,l=(s-r)/3;t._context.bezierCurveTo(r+l,i+l*e,s-l,o-l*n,s,o)}function _k(t){this._context=t}_k.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:FE(this,this._t0,C$(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,FE(this,C$(this,n=k$(this,t,e)),n);break;default:FE(this,this._t0,n=k$(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function _J(t){this._context=new NJ(t)}(_J.prototype=Object.create(_k.prototype)).point=function(t,e){_k.prototype.point.call(this,e,t)};function NJ(t){this._context=t}NJ.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,i,s){this._context.bezierCurveTo(e,t,r,n,s,i)}};function zje(t){return new _k(t)}function Uje(t){return new _J(t)}function kJ(t){this._context=t}kJ.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),n===2)this._context.lineTo(t[1],e[1]);else for(var r=P$(t),i=P$(e),s=0,o=1;o=0;--e)i[e]=(o[e]-i[e+1])/s[e];for(s[n-1]=(t[n]+i[n-1])/2,e=0;e=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}break}}this._x=t,this._y=e}};function Hje(t){return new BP(t,.5)}function qje(t){return new BP(t,0)}function $je(t){return new BP(t,1)}function Xf(t,e){if((o=t.length)>1)for(var n=1,r,i,s=t[e[0]],o,l=s.length;n=0;)n[e]=e;return n}function Vje(t,e){return t[e]}function Gje(t){const e=[];return e.key=t,e}function Wje(){var t=la([]),e=rR,n=Xf,r=Vje;function i(s){var o=Array.from(t.apply(this,arguments),Gje),l,c=o.length,d=-1,u;for(const m of s)for(l=0,++d;l0){for(var n,r,i=0,s=t[0].length,o;i0){for(var n=0,r=t[e[0]],i,s=r.length;n0)||!((s=(i=t[e[0]]).length)>0))){for(var n=0,r=1,i,s,o;r1&&arguments[1]!==void 0?arguments[1]:tEe,n=10**e,r=Math.round(t*n)/n;return Object.is(r,-0)?0:r}function Ba(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r{var l=n[o-1];return typeof l=="string"?i+l+s:l!==void 0?i+Ch(l)+s:i+s},"")}var $i=t=>t===0?0:t>0?1:-1,Uc=t=>typeof t=="number"&&t!=+t,Zf=t=>typeof t=="string"&&t.indexOf("%")===t.length-1,an=t=>(typeof t=="number"||t instanceof Number)&&!Uc(t),sc=t=>an(t)||typeof t=="string",nEe=0,K0=t=>{var e=++nEe;return"".concat(t||"").concat(e)},Is=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!an(e)&&typeof e!="string")return r;var s;if(Zf(e)){if(n==null)return r;var o=e.indexOf("%");s=n*parseFloat(e.slice(0,o))/100}else s=+e;return Uc(s)&&(s=r),i&&n!=null&&s>n&&(s=n),s},PJ=t=>{if(!Array.isArray(t))return!1;for(var e=t.length,n={},r=0;rr&&(typeof e=="function"?e(r):Qf(r,e))===n)}var Ca=t=>t===null||typeof t>"u",Bw=t=>Ca(t)?t:"".concat(t.charAt(0).toUpperCase()).concat(t.slice(1));function Eo(t){return t!=null}function sp(){}var rEe=["type","size","sizeType"];function aR(){return aR=Object.assign?Object.assign.bind():function(t){for(var e=1;e{var e="symbol".concat(Bw(t));return AJ[e]||eI},uEe=(t,e,n)=>{if(e==="area")return t;switch(n){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var r=18*cEe;return 1.25*t*t*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2)}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},mEe=(t,e)=>{AJ["symbol".concat(Bw(t))]=e},aI=t=>{var{type:e="circle",size:n=64,sizeType:r="area"}=t,i=oEe(t,rEe),s=L$(L$({},i),{},{type:e,size:n,sizeType:r}),o="circle";typeof e=="string"&&(o=e);var l=()=>{var p=dEe(o),f=Fje().type(p).size(uEe(n,r,o)),y=f();if(y!==null)return y},{className:c,cx:d,cy:u}=s,m=vs(s);return an(d)&&an(u)&&an(n)?w.createElement("path",aR({},m,{className:Sr("recharts-symbols",c),transform:"translate(".concat(d,", ").concat(u,")"),d:l()})):null};aI.registerSymbol=mEe;var MJ=t=>"radius"in t&&"startAngle"in t&&"endAngle"in t,iI=(t,e)=>{if(!t||typeof t=="function"||typeof t=="boolean")return null;var n=t;if(w.isValidElement(t)&&(n=t.props),typeof n!="object"&&typeof n!="function")return null;var r={};return Object.keys(n).forEach(i=>{XO(i)&&(r[i]=(s=>n[i](n,s)))}),r},hEe=(t,e,n)=>r=>(t(e,n,r),null),Hw=(t,e,n)=>{if(t===null||typeof t!="object"&&typeof t!="function")return null;var r=null;return Object.keys(t).forEach(i=>{var s=t[i];XO(i)&&typeof s=="function"&&(r||(r={}),r[i]=hEe(s,e,n))}),r};function O$(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function pEe(t){for(var e=1;e(o[l]===void 0&&r[l]!==void 0&&(o[l]=r[l]),o),n);return s}function Nk(){return Nk=Object.assign?Object.assign.bind():function(t){for(var e=1;e{var p=u.formatter||i,f=Sr({"recharts-legend-item":!0,["legend-item-".concat(m)]:!0,inactive:u.inactive});if(u.type==="none")return null;var y=u.inactive?s:u.color,v=p?p(u.value,u,m):u.value;return w.createElement("li",Nk({className:f,style:c,key:"legend-item-".concat(m)},Hw(t,u,m)),w.createElement(QO,{width:n,height:n,viewBox:l,style:d,"aria-label":"".concat(v," legend icon")},w.createElement(_Ee,{data:u,iconType:o,inactiveColor:s})),w.createElement("span",{className:"recharts-legend-item-text",style:{color:y}},v))})}var kEe=t=>{var e=Da(t,SEe),{payload:n,layout:r,align:i}=e;if(!n||!n.length)return null;var s={padding:0,margin:0,textAlign:r==="horizontal"?i:"left"};return w.createElement("ul",{className:"recharts-default-legend",style:s},w.createElement(NEe,Nk({},e,{payload:n})))},HE={},qE={},z$;function CEe(){return z$||(z$=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n,r){const i=new Map;for(let s=0;s=0}t.isLength=e})(KE)),KE}var q$;function sI(){return q$||(q$=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=TEe();function n(r){return r!=null&&typeof r!="function"&&e.isLength(r.length)}t.isArrayLike=n})(WE)),WE}var YE={},$$;function AEe(){return $$||($$=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return typeof n=="object"&&n!==null}t.isObjectLike=e})(YE)),YE}var V$;function MEe(){return V$||(V$=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=sI(),n=AEe();function r(i){return n.isObjectLike(i)&&e.isArrayLike(i)}t.isArrayLikeObject=r})(GE)),GE}var XE={},QE={},G$;function jEe(){return G$||(G$=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=rI();function n(r){return function(i){return e.get(i,r)}}t.property=n})(QE)),QE}var ZE={},JE={},e2={},t2={},W$;function EJ(){return W$||(W$=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return n!==null&&(typeof n=="object"||typeof n=="function")}t.isObject=e})(t2)),t2}var n2={},K$;function DJ(){return K$||(K$=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return n==null||typeof n!="object"&&typeof n!="function"}t.isPrimitive=e})(n2)),n2}var r2={},Y$;function FJ(){return Y$||(Y$=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n,r){return n===r||Number.isNaN(n)&&Number.isNaN(r)}t.isEqualsSameValueZero=e})(r2)),r2}var X$;function EEe(){return X$||(X$=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=EJ(),n=DJ(),r=FJ();function i(u,m,p){return typeof p!="function"?i(u,m,()=>{}):s(u,m,function f(y,v,g,b,_,N){const P=p(y,v,g,b,_,N);return P!==void 0?!!P:s(y,v,f,N)},new Map)}function s(u,m,p,f){if(m===u)return!0;switch(typeof m){case"object":return o(u,m,p,f);case"function":return Object.keys(m).length>0?s(u,{...m},p,f):r.isEqualsSameValueZero(u,m);default:return e.isObject(u)?typeof m=="string"?m==="":!0:r.isEqualsSameValueZero(u,m)}}function o(u,m,p,f){if(m==null)return!0;if(Array.isArray(m))return c(u,m,p,f);if(m instanceof Map)return l(u,m,p,f);if(m instanceof Set)return d(u,m,p,f);const y=Object.keys(m);if(u==null||n.isPrimitive(u))return y.length===0;if(y.length===0)return!0;if(f?.has(m))return f.get(m)===u;f?.set(m,u);try{for(let v=0;v{})}t.isMatch=n})(JE)),JE}var a2={},i2={},s2={},Z$;function DEe(){return Z$||(Z$=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return Object.getOwnPropertySymbols(n).filter(r=>Object.prototype.propertyIsEnumerable.call(n,r))}t.getSymbols=e})(s2)),s2}var o2={},J$;function oI(){return J$||(J$=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return n==null?n===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(n)}t.getTag=e})(o2)),o2}var l2={},eV;function LJ(){return eV||(eV=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e="[object RegExp]",n="[object String]",r="[object Number]",i="[object Boolean]",s="[object Arguments]",o="[object Symbol]",l="[object Date]",c="[object Map]",d="[object Set]",u="[object Array]",m="[object Function]",p="[object ArrayBuffer]",f="[object Object]",y="[object Error]",v="[object DataView]",g="[object Uint8Array]",b="[object Uint8ClampedArray]",_="[object Uint16Array]",N="[object Uint32Array]",P="[object BigUint64Array]",k="[object Int8Array]",M="[object Int16Array]",T="[object Int32Array]",A="[object BigInt64Array]",C="[object Float32Array]",F="[object Float64Array]";t.argumentsTag=s,t.arrayBufferTag=p,t.arrayTag=u,t.bigInt64ArrayTag=A,t.bigUint64ArrayTag=P,t.booleanTag=i,t.dataViewTag=v,t.dateTag=l,t.errorTag=y,t.float32ArrayTag=C,t.float64ArrayTag=F,t.functionTag=m,t.int16ArrayTag=M,t.int32ArrayTag=T,t.int8ArrayTag=k,t.mapTag=c,t.numberTag=r,t.objectTag=f,t.regexpTag=e,t.setTag=d,t.stringTag=n,t.symbolTag=o,t.uint16ArrayTag=_,t.uint32ArrayTag=N,t.uint8ArrayTag=g,t.uint8ClampedArrayTag=b})(l2)),l2}var c2={},tV;function FEe(){return tV||(tV=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}t.isTypedArray=e})(c2)),c2}var nV;function OJ(){return nV||(nV=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=DEe(),n=oI(),r=LJ(),i=DJ(),s=FEe();function o(u,m){return l(u,void 0,u,new Map,m)}function l(u,m,p,f=new Map,y=void 0){const v=y?.(u,m,p,f);if(v!==void 0)return v;if(i.isPrimitive(u))return u;if(f.has(u))return f.get(u);if(Array.isArray(u)){const g=new Array(u.length);f.set(u,g);for(let b=0;be.isMatch(s,i)}t.matches=r})(ZE)),ZE}var d2={},u2={},m2={},iV;function OEe(){return iV||(iV=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=OJ(),n=oI(),r=LJ();function i(s,o){return e.cloneDeepWith(s,(l,c,d,u)=>{const m=o?.(l,c,d,u);if(m!==void 0)return m;if(typeof s=="object"){if(n.getTag(s)===r.objectTag&&typeof s.constructor!="function"){const p={};return u.set(s,p),e.copyProperties(p,s,d,u),p}switch(Object.prototype.toString.call(s)){case r.numberTag:case r.stringTag:case r.booleanTag:{const p=new s.constructor(s?.valueOf());return e.copyProperties(p,s),p}case r.argumentsTag:{const p={};return e.copyProperties(p,s),p.length=s.length,p[Symbol.iterator]=s[Symbol.iterator],p}default:return}}})}t.cloneDeepWith=i})(m2)),m2}var sV;function IEe(){return sV||(sV=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=OEe();function n(r){return e.cloneDeepWith(r)}t.cloneDeep=n})(u2)),u2}var h2={},p2={},oV;function IJ(){return oV||(oV=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=/^(?:0|[1-9]\d*)$/;function n(r,i=Number.MAX_SAFE_INTEGER){switch(typeof r){case"number":return Number.isInteger(r)&&r>=0&&rt,ra=()=>{var t=w.useContext(lI);return t?t.store.dispatch:KEe},PN=()=>{},YEe=()=>PN,XEe=(t,e)=>t===e;function cn(t){var e=w.useContext(lI),n=w.useMemo(()=>e?r=>{if(r!=null)return t(r)}:PN,[e,t]);return UJ.useSyncExternalStoreWithSelector(e?e.subscription.addNestedSub:YEe,e?e.store.getState:PN,e?e.store.getState:PN,n,XEe)}function QEe(t,e=`expected a function, instead received ${typeof t}`){if(typeof t!="function")throw new TypeError(e)}function ZEe(t,e=`expected an object, instead received ${typeof t}`){if(typeof t!="object")throw new TypeError(e)}function JEe(t,e="expected all items to be functions, instead received the following types: "){if(!t.every(n=>typeof n=="function")){const n=t.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${e}[${n}]`)}}var bV=t=>Array.isArray(t)?t:[t];function e2e(t){const e=Array.isArray(t[0])?t[0]:t;return JEe(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function t2e(t,e){const n=[],{length:r}=t;for(let i=0;i{n=M1(),o.resetResultsCount()},o.resultsCount=()=>s,o.resetResultsCount=()=>{s=0},o}function i2e(t,...e){const n=typeof t=="function"?{memoize:t,memoizeOptions:e}:t,r=(...i)=>{let s=0,o=0,l,c={},d=i.pop();typeof d=="object"&&(c=d,d=i.pop()),QEe(d,`createSelector expects an output function after the inputs, but received: [${typeof d}]`);const u={...n,...c},{memoize:m,memoizeOptions:p=[],argsMemoize:f=BJ,argsMemoizeOptions:y=[]}=u,v=bV(p),g=bV(y),b=e2e(i),_=m(function(){return s++,d.apply(null,arguments)},...v),N=f(function(){o++;const k=t2e(b,arguments);return l=_.apply(null,k),l},...g);return Object.assign(N,{resultFunc:d,memoizedResultFunc:_,dependencies:b,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>l,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:m,argsMemoize:f})};return Object.assign(r,{withTypes:()=>r}),r}var yt=i2e(BJ),s2e=Object.assign((t,e=yt)=>{ZEe(t,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof t}`);const n=Object.keys(t),r=n.map(s=>t[s]);return e(r,(...s)=>s.reduce((o,l,c)=>(o[n[c]]=l,o),{}))},{withTypes:()=>s2e}),y2={},v2={},w2={},yV;function o2e(){return yV||(yV=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(r){return typeof r=="symbol"?1:r===null?2:r===void 0?3:r!==r?4:0}const n=(r,i,s)=>{if(r!==i){const o=e(r),l=e(i);if(o===l&&o===0){if(ri)return s==="desc"?-1:1}return s==="desc"?l-o:o-l}return 0};t.compareValues=n})(w2)),w2}var S2={},_2={},vV;function HJ(){return vV||(vV=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return typeof n=="symbol"||n instanceof Symbol}t.isSymbol=e})(_2)),_2}var wV;function l2e(){return wV||(wV=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=HJ(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(s,o){return Array.isArray(s)?!1:typeof s=="number"||typeof s=="boolean"||s==null||e.isSymbol(s)?!0:typeof s=="string"&&(r.test(s)||!n.test(s))||o!=null&&Object.hasOwn(o,s)}t.isKey=i})(S2)),S2}var SV;function c2e(){return SV||(SV=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=o2e(),n=l2e(),r=nI();function i(s,o,l,c){if(s==null)return[];l=c?void 0:l,Array.isArray(s)||(s=Object.values(s)),Array.isArray(o)||(o=o==null?[null]:[o]),o.length===0&&(o=[null]),Array.isArray(l)||(l=l==null?[]:[l]),l=l.map(f=>String(f));const d=(f,y)=>{let v=f;for(let g=0;gy==null||f==null?y:typeof f=="object"&&"key"in f?Object.hasOwn(y,f.key)?y[f.key]:d(y,f.path):typeof f=="function"?f(y):Array.isArray(f)?d(y,f):typeof y=="object"?y[f]:y,m=o.map(f=>(Array.isArray(f)&&f.length===1&&(f=f[0]),f==null||typeof f=="function"||Array.isArray(f)||n.isKey(f)?f:{key:f,path:r.toPath(f)}));return s.map(f=>({original:f,criteria:m.map(y=>u(y,f))})).slice().sort((f,y)=>{for(let v=0;vf.original)}t.orderBy=i})(v2)),v2}var N2={},_V;function d2e(){return _V||(_V=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n,r=1){const i=[],s=Math.floor(r),o=(l,c)=>{for(let d=0;d1&&r.isIterateeCall(s,o[0],o[1])?o=[]:l>2&&r.isIterateeCall(o[0],o[1],o[2])&&(o=[o[0]]),e.orderBy(s,n.flatten(o),["asc"])}t.sortBy=i})(y2)),y2}var C2,CV;function m2e(){return CV||(CV=1,C2=u2e().sortBy),C2}var h2e=m2e();const HP=dc(h2e);var $J=t=>t.legend.settings,p2e=t=>t.legend.size,f2e=t=>t.legend.payload,g2e=yt([f2e,$J],(t,e)=>{var{itemSorter:n}=e,r=t.flat(1);return n?HP(r,n):r});function b2e(){return cn(g2e)}var j1=1;function VJ(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[e,n]=w.useState({height:0,left:0,top:0,width:0}),r=w.useCallback(i=>{if(i!=null){var s=i.getBoundingClientRect(),o={height:s.height,left:s.left,top:s.top,width:s.width};(Math.abs(o.height-e.height)>j1||Math.abs(o.left-e.left)>j1||Math.abs(o.top-e.top)>j1||Math.abs(o.width-e.width)>j1)&&n({height:o.height,left:o.left,top:o.top,width:o.width})}},[e.width,e.height,e.top,e.left,...t]);return[e,r]}function ls(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var x2e=typeof Symbol=="function"&&Symbol.observable||"@@observable",PV=x2e,P2=()=>Math.random().toString(36).substring(7).split("").join("."),y2e={INIT:`@@redux/INIT${P2()}`,REPLACE:`@@redux/REPLACE${P2()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${P2()}`},kk=y2e;function cI(t){if(typeof t!="object"||t===null)return!1;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e||Object.getPrototypeOf(t)===null}function GJ(t,e,n){if(typeof t!="function")throw new Error(ls(2));if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(ls(0));if(typeof e=="function"&&typeof n>"u"&&(n=e,e=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(ls(1));return n(GJ)(t,e)}let r=t,i=e,s=new Map,o=s,l=0,c=!1;function d(){o===s&&(o=new Map,s.forEach((g,b)=>{o.set(b,g)}))}function u(){if(c)throw new Error(ls(3));return i}function m(g){if(typeof g!="function")throw new Error(ls(4));if(c)throw new Error(ls(5));let b=!0;d();const _=l++;return o.set(_,g),function(){if(b){if(c)throw new Error(ls(6));b=!1,d(),o.delete(_),s=null}}}function p(g){if(!cI(g))throw new Error(ls(7));if(typeof g.type>"u")throw new Error(ls(8));if(typeof g.type!="string")throw new Error(ls(17));if(c)throw new Error(ls(9));try{c=!0,i=r(i,g)}finally{c=!1}return(s=o).forEach(_=>{_()}),g}function f(g){if(typeof g!="function")throw new Error(ls(10));r=g,p({type:kk.REPLACE})}function y(){const g=m;return{subscribe(b){if(typeof b!="object"||b===null)throw new Error(ls(11));function _(){const P=b;P.next&&P.next(u())}return _(),{unsubscribe:g(_)}},[PV](){return this}}}return p({type:kk.INIT}),{dispatch:p,subscribe:m,getState:u,replaceReducer:f,[PV]:y}}function v2e(t){Object.keys(t).forEach(e=>{const n=t[e];if(typeof n(void 0,{type:kk.INIT})>"u")throw new Error(ls(12));if(typeof n(void 0,{type:kk.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(ls(13))})}function WJ(t){const e=Object.keys(t),n={};for(let s=0;s"u")throw l&&l.type,new Error(ls(14));d[m]=y,c=c||y!==f}return c=c||r.length!==Object.keys(o).length,c?d:o}}function Ck(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,n)=>(...r)=>e(n(...r)))}function w2e(...t){return e=>(n,r)=>{const i=e(n,r);let s=()=>{throw new Error(ls(15))};const o={getState:i.getState,dispatch:(c,...d)=>s(c,...d)},l=t.map(c=>c(o));return s=Ck(...l)(i.dispatch),{...i,dispatch:s}}}function KJ(t){return cI(t)&&"type"in t&&typeof t.type=="string"}var YJ=Symbol.for("immer-nothing"),TV=Symbol.for("immer-draftable"),oo=Symbol.for("immer-state");function Pc(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var ol=Object,Dx=ol.getPrototypeOf,Pk="constructor",qP="prototype",iR="configurable",Tk="enumerable",TN="writable",Y0="value",im=t=>!!t&&!!t[oo];function Bc(t){return t?XJ(t)||VP(t)||!!t[TV]||!!t[Pk]?.[TV]||GP(t)||WP(t):!1}var S2e=ol[qP][Pk].toString(),AV=new WeakMap;function XJ(t){if(!t||!dI(t))return!1;const e=Dx(t);if(e===null||e===ol[qP])return!0;const n=ol.hasOwnProperty.call(e,Pk)&&e[Pk];if(n===Object)return!0;if(!Hb(n))return!1;let r=AV.get(n);return r===void 0&&(r=Function.toString.call(n),AV.set(n,r)),r===S2e}function $P(t,e,n=!0){qw(t)===0?(n?Reflect.ownKeys(t):ol.keys(t)).forEach(i=>{e(i,t[i],t)}):t.forEach((r,i)=>e(i,r,t))}function qw(t){const e=t[oo];return e?e.type_:VP(t)?1:GP(t)?2:WP(t)?3:0}var MV=(t,e,n=qw(t))=>n===2?t.has(e):ol[qP].hasOwnProperty.call(t,e),sR=(t,e,n=qw(t))=>n===2?t.get(e):t[e],Ak=(t,e,n,r=qw(t))=>{r===2?t.set(e,n):r===3?t.add(n):t[e]=n};function _2e(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}var VP=Array.isArray,GP=t=>t instanceof Map,WP=t=>t instanceof Set,dI=t=>typeof t=="object",Hb=t=>typeof t=="function",T2=t=>typeof t=="boolean";function N2e(t){const e=+t;return Number.isInteger(e)&&String(e)===t}var Au=t=>t.copy_||t.base_,uI=t=>t.modified_?t.copy_:t.base_;function oR(t,e){if(GP(t))return new Map(t);if(WP(t))return new Set(t);if(VP(t))return Array[qP].slice.call(t);const n=XJ(t);if(e===!0||e==="class_only"&&!n){const r=ol.getOwnPropertyDescriptors(t);delete r[oo];let i=Reflect.ownKeys(r);for(let s=0;s1&&ol.defineProperties(t,{set:E1,add:E1,clear:E1,delete:E1}),ol.freeze(t),e&&$P(t,(n,r)=>{mI(r,!0)},!1)),t}function k2e(){Pc(2)}var E1={[Y0]:k2e};function KP(t){return t===null||!dI(t)?!0:ol.isFrozen(t)}var Mk="MapSet",lR="Patches",jV="ArrayMethods",QJ={};function Jf(t){const e=QJ[t];return e||Pc(0,t),e}var EV=t=>!!QJ[t],X0,ZJ=()=>X0,C2e=(t,e)=>({drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:EV(Mk)?Jf(Mk):void 0,arrayMethodsPlugin_:EV(jV)?Jf(jV):void 0});function DV(t,e){e&&(t.patchPlugin_=Jf(lR),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function cR(t){dR(t),t.drafts_.forEach(P2e),t.drafts_=null}function dR(t){t===X0&&(X0=t.parent_)}var FV=t=>X0=C2e(X0,t);function P2e(t){const e=t[oo];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function RV(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];if(t!==void 0&&t!==n){n[oo].modified_&&(cR(e),Pc(4)),Bc(t)&&(t=LV(e,t));const{patchPlugin_:i}=e;i&&i.generateReplacementPatches_(n[oo].base_,t,e)}else t=LV(e,n);return T2e(e,t,!0),cR(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==YJ?t:void 0}function LV(t,e){if(KP(e))return e;const n=e[oo];if(!n)return jk(e,t.handledSet_,t);if(!YP(n,t))return e;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:r}=n;if(r)for(;r.length>0;)r.pop()(t);tee(n,t)}return n.copy_}function T2e(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&mI(e,n)}function JJ(t){t.finalized_=!0,t.scope_.unfinalizedDrafts_--}var YP=(t,e)=>t.scope_===e,A2e=[];function eee(t,e,n,r){const i=Au(t),s=t.type_;if(r!==void 0&&sR(i,r,s)===e){Ak(i,r,n,s);return}if(!t.draftLocations_){const l=t.draftLocations_=new Map;$P(i,(c,d)=>{if(im(d)){const u=l.get(d)||[];u.push(c),l.set(d,u)}})}const o=t.draftLocations_.get(e)??A2e;for(const l of o)Ak(i,l,n,s)}function M2e(t,e,n){t.callbacks_.push(function(i){const s=e;if(!s||!YP(s,i))return;i.mapSetPlugin_?.fixSetContents(s);const o=uI(s);eee(t,s.draft_??s,o,n),tee(s,i)})}function tee(t,e){if(t.modified_&&!t.finalized_&&(t.type_===3||t.type_===1&&t.allIndicesReassigned_||(t.assigned_?.size??0)>0)){const{patchPlugin_:r}=e;if(r){const i=r.getPath(t);i&&r.generatePatches_(t,i,e)}JJ(t)}}function j2e(t,e,n){const{scope_:r}=t;if(im(n)){const i=n[oo];YP(i,r)&&i.callbacks_.push(function(){AN(t);const o=uI(i);eee(t,n,o,e)})}else Bc(n)&&t.callbacks_.push(function(){const s=Au(t);t.type_===3?s.has(n)&&jk(n,r.handledSet_,r):sR(s,e,t.type_)===n&&r.drafts_.length>1&&(t.assigned_.get(e)??!1)===!0&&t.copy_&&jk(sR(t.copy_,e,t.type_),r.handledSet_,r)})}function jk(t,e,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||im(t)||e.has(t)||!Bc(t)||KP(t)||(e.add(t),$P(t,(r,i)=>{if(im(i)){const s=i[oo];if(YP(s,n)){const o=uI(s);Ak(t,r,o,t.type_),JJ(s)}}else Bc(i)&&jk(i,e,n)})),t}function E2e(t,e){const n=VP(t),r={type_:n?1:0,scope_:e?e.scope_:ZJ(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=r,s=Ek;n&&(i=[r],s=Q0);const{revoke:o,proxy:l}=Proxy.revocable(i,s);return r.draft_=l,r.revoke_=o,[l,r]}var Ek={get(t,e){if(e===oo)return t;let n=t.scope_.arrayMethodsPlugin_;const r=t.type_===1&&typeof e=="string";if(r&&n?.isArrayOperationMethod(e))return n.createMethodInterceptor(t,e);const i=Au(t);if(!MV(i,e,t.type_))return D2e(t,i,e);const s=i[e];if(t.finalized_||!Bc(s)||r&&t.operationMethod&&n?.isMutatingArrayMethod(t.operationMethod)&&N2e(e))return s;if(s===A2(t.base_,e)){AN(t);const o=t.type_===1?+e:e,l=mR(t.scope_,s,t,o);return t.copy_[o]=l}return s},has(t,e){return e in Au(t)},ownKeys(t){return Reflect.ownKeys(Au(t))},set(t,e,n){const r=nee(Au(t),e);if(r?.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const i=A2(Au(t),e),s=i?.[oo];if(s&&s.base_===n)return t.copy_[e]=n,t.assigned_.set(e,!1),!0;if(_2e(n,i)&&(n!==void 0||MV(t.base_,e,t.type_)))return!0;AN(t),uR(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_.set(e,!0),j2e(t,e,n)),!0},deleteProperty(t,e){return AN(t),A2(t.base_,e)!==void 0||e in t.base_?(t.assigned_.set(e,!1),uR(t)):t.assigned_.delete(e),t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=Au(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{[TN]:!0,[iR]:t.type_!==1||e!=="length",[Tk]:r[Tk],[Y0]:n[e]}},defineProperty(){Pc(11)},getPrototypeOf(t){return Dx(t.base_)},setPrototypeOf(){Pc(12)}},Q0={};for(let t in Ek){let e=Ek[t];Q0[t]=function(){const n=arguments;return n[0]=n[0][0],e.apply(this,n)}}Q0.deleteProperty=function(t,e){return Q0.set.call(this,t,e,void 0)};Q0.set=function(t,e,n){return Ek.set.call(this,t[0],e,n,t[0])};function A2(t,e){const n=t[oo];return(n?Au(n):t)[e]}function D2e(t,e,n){const r=nee(e,n);return r?Y0 in r?r[Y0]:r.get?.call(t.draft_):void 0}function nee(t,e){if(!(e in t))return;let n=Dx(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=Dx(n)}}function uR(t){t.modified_||(t.modified_=!0,t.parent_&&uR(t.parent_))}function AN(t){t.copy_||(t.assigned_=new Map,t.copy_=oR(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var F2e=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(n,r,i)=>{if(Hb(n)&&!Hb(r)){const o=r;r=n;const l=this;return function(d=o,...u){return l.produce(d,m=>r.call(this,m,...u))}}Hb(r)||Pc(6),i!==void 0&&!Hb(i)&&Pc(7);let s;if(Bc(n)){const o=FV(this),l=mR(o,n,void 0);let c=!0;try{s=r(l),c=!1}finally{c?cR(o):dR(o)}return DV(o,i),RV(s,o)}else if(!n||!dI(n)){if(s=r(n),s===void 0&&(s=n),s===YJ&&(s=void 0),this.autoFreeze_&&mI(s,!0),i){const o=[],l=[];Jf(lR).generateReplacementPatches_(n,s,{patches_:o,inversePatches_:l}),i(o,l)}return s}else Pc(1,n)},this.produceWithPatches=(n,r)=>{if(Hb(n))return(l,...c)=>this.produceWithPatches(l,d=>n(d,...c));let i,s;return[this.produce(n,r,(l,c)=>{i=l,s=c}),i,s]},T2(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),T2(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),T2(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Bc(e)||Pc(8),im(e)&&(e=Lc(e));const n=FV(this),r=mR(n,e,void 0);return r[oo].isManual_=!0,dR(n),r}finishDraft(e,n){const r=e&&e[oo];(!r||!r.isManual_)&&Pc(9);const{scope_:i}=r;return DV(i,n),RV(void 0,i)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,n){let r;for(r=n.length-1;r>=0;r--){const s=n[r];if(s.path.length===0&&s.op==="replace"){e=s.value;break}}r>-1&&(n=n.slice(r+1));const i=Jf(lR).applyPatches_;return im(e)?i(e,n):this.produce(e,s=>i(s,n))}};function mR(t,e,n,r){const[i,s]=GP(e)?Jf(Mk).proxyMap_(e,n):WP(e)?Jf(Mk).proxySet_(e,n):E2e(e,n);return(n?.scope_??ZJ()).drafts_.push(i),s.callbacks_=n?.callbacks_??[],s.key_=r,n&&r!==void 0?M2e(n,s,r):s.callbacks_.push(function(c){c.mapSetPlugin_?.fixSetContents(s);const{patchPlugin_:d}=c;s.modified_&&d&&d.generatePatches_(s,[],c)}),i}function Lc(t){return im(t)||Pc(10,t),ree(t)}function ree(t){if(!Bc(t)||KP(t))return t;const e=t[oo];let n,r=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=oR(t,e.scope_.immer_.useStrictShallowCopy_),r=e.scope_.immer_.shouldUseStrictIteration()}else n=oR(t,!0);return $P(n,(i,s)=>{Ak(n,i,ree(s))},r),e&&(e.finalized_=!1),n}var R2e=new F2e,aee=R2e.produce;function iee(t){return({dispatch:n,getState:r})=>i=>s=>typeof s=="function"?s(n,r,t):i(s)}var L2e=iee(),O2e=iee,I2e=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Ck:Ck.apply(null,arguments)};function oc(t,e){function n(...r){if(e){let i=e(...r);if(!i)throw new Error(ul(0));return{type:t,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:t,payload:r[0]}}return n.toString=()=>`${t}`,n.type=t,n.match=r=>KJ(r)&&r.type===t,n}var see=class Wv extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,Wv.prototype)}static get[Symbol.species](){return Wv}concat(...e){return super.concat.apply(this,e)}prepend(...e){return e.length===1&&Array.isArray(e[0])?new Wv(...e[0].concat(this)):new Wv(...e.concat(this))}};function OV(t){return Bc(t)?aee(t,()=>{}):t}function D1(t,e,n){return t.has(e)?t.get(e):t.set(e,n(e)).get(e)}function z2e(t){return typeof t=="boolean"}var U2e=()=>function(e){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:s=!0}=e??{};let o=new see;return n&&(z2e(n)?o.push(L2e):o.push(O2e(n.extraArgument))),o},oee="RTK_autoBatch",wa=()=>t=>({payload:t,meta:{[oee]:!0}}),IV=t=>e=>{setTimeout(e,t)},lee=(t={type:"raf"})=>e=>(...n)=>{const r=e(...n);let i=!0,s=!1,o=!1;const l=new Set,c=t.type==="tick"?queueMicrotask:t.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:IV(10):t.type==="callback"?t.queueNotification:IV(t.timeout),d=()=>{o=!1,s&&(s=!1,l.forEach(u=>u()))};return Object.assign({},r,{subscribe(u){const m=()=>i&&u(),p=r.subscribe(m);return l.add(u),()=>{p(),l.delete(u)}},dispatch(u){try{return i=!u?.meta?.[oee],s=!i,s&&(o||(o=!0,c(d))),r.dispatch(u)}finally{i=!0}}})},B2e=t=>function(n){const{autoBatch:r=!0}=n??{};let i=new see(t);return r&&i.push(lee(typeof r=="object"?r:void 0)),i};function H2e(t){const e=U2e(),{reducer:n=void 0,middleware:r,devTools:i=!0,preloadedState:s=void 0,enhancers:o=void 0}=t||{};let l;if(typeof n=="function")l=n;else if(cI(n))l=WJ(n);else throw new Error(ul(1));let c;typeof r=="function"?c=r(e):c=e();let d=Ck;i&&(d=I2e({trace:!1,...typeof i=="object"&&i}));const u=w2e(...c),m=B2e(u);let p=typeof o=="function"?o(m):m();const f=d(...p);return GJ(l,s,f)}function cee(t){const e={},n=[];let r;const i={addCase(s,o){const l=typeof s=="string"?s:s.type;if(!l)throw new Error(ul(28));if(l in e)throw new Error(ul(29));return e[l]=o,i},addAsyncThunk(s,o){return o.pending&&(e[s.pending.type]=o.pending),o.rejected&&(e[s.rejected.type]=o.rejected),o.fulfilled&&(e[s.fulfilled.type]=o.fulfilled),o.settled&&n.push({matcher:s.settled,reducer:o.settled}),i},addMatcher(s,o){return n.push({matcher:s,reducer:o}),i},addDefaultCase(s){return r=s,i}};return t(i),[e,n,r]}function q2e(t){return typeof t=="function"}function $2e(t,e){let[n,r,i]=cee(e),s;if(q2e(t))s=()=>OV(t());else{const l=OV(t);s=()=>l}function o(l=s(),c){let d=[n[c.type],...r.filter(({matcher:u})=>u(c)).map(({reducer:u})=>u)];return d.filter(u=>!!u).length===0&&(d=[i]),d.reduce((u,m)=>{if(m)if(im(u)){const f=m(u,c);return f===void 0?u:f}else{if(Bc(u))return aee(u,p=>m(p,c));{const p=m(u,c);if(p===void 0){if(u===null)return u;throw Error("A case reducer on a non-draftable value must not return undefined")}return p}}return u},l)}return o.getInitialState=s,o}var V2e="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",G2e=(t=21)=>{let e="",n=t;for(;n--;)e+=V2e[Math.random()*64|0];return e},W2e=Symbol.for("rtk-slice-createasyncthunk");function K2e(t,e){return`${t}/${e}`}function Y2e({creators:t}={}){const e=t?.asyncThunk?.[W2e];return function(r){const{name:i,reducerPath:s=i}=r;if(!i)throw new Error(ul(11));const o=(typeof r.reducers=="function"?r.reducers(Q2e()):r.reducers)||{},l=Object.keys(o),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},d={addCase(N,P){const k=typeof N=="string"?N:N.type;if(!k)throw new Error(ul(12));if(k in c.sliceCaseReducersByType)throw new Error(ul(13));return c.sliceCaseReducersByType[k]=P,d},addMatcher(N,P){return c.sliceMatchers.push({matcher:N,reducer:P}),d},exposeAction(N,P){return c.actionCreators[N]=P,d},exposeCaseReducer(N,P){return c.sliceCaseReducersByName[N]=P,d}};l.forEach(N=>{const P=o[N],k={reducerName:N,type:K2e(i,N),createNotation:typeof r.reducers=="function"};J2e(P)?tDe(k,P,d,e):Z2e(k,P,d)});function u(){const[N={},P=[],k=void 0]=typeof r.extraReducers=="function"?cee(r.extraReducers):[r.extraReducers],M={...N,...c.sliceCaseReducersByType};return $2e(r.initialState,T=>{for(let A in M)T.addCase(A,M[A]);for(let A of c.sliceMatchers)T.addMatcher(A.matcher,A.reducer);for(let A of P)T.addMatcher(A.matcher,A.reducer);k&&T.addDefaultCase(k)})}const m=N=>N,p=new Map,f=new WeakMap;let y;function v(N,P){return y||(y=u()),y(N,P)}function g(){return y||(y=u()),y.getInitialState()}function b(N,P=!1){function k(T){let A=T[N];return typeof A>"u"&&P&&(A=D1(f,k,g)),A}function M(T=m){const A=D1(p,P,()=>new WeakMap);return D1(A,T,()=>{const C={};for(const[F,$]of Object.entries(r.selectors??{}))C[F]=X2e($,T,()=>D1(f,T,g),P);return C})}return{reducerPath:N,getSelectors:M,get selectors(){return M(k)},selectSlice:k}}const _={name:i,reducer:v,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:g,...b(s),injectInto(N,{reducerPath:P,...k}={}){const M=P??s;return N.inject({reducerPath:M,reducer:v},k),{..._,...b(M,!0)}}};return _}}function X2e(t,e,n,r){function i(s,...o){let l=e(s);return typeof l>"u"&&r&&(l=n()),t(l,...o)}return i.unwrapped=t,i}var Bo=Y2e();function Q2e(){function t(e,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...n}}return t.withTypes=()=>t,{reducer(e){return Object.assign({[e.name](...n){return e(...n)}}[e.name],{_reducerDefinitionType:"reducer"})},preparedReducer(e,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:n}},asyncThunk:t}}function Z2e({type:t,reducerName:e,createNotation:n},r,i){let s,o;if("reducer"in r){if(n&&!eDe(r))throw new Error(ul(17));s=r.reducer,o=r.prepare}else s=r;i.addCase(t,s).exposeCaseReducer(e,s).exposeAction(e,o?oc(t,o):oc(t))}function J2e(t){return t._reducerDefinitionType==="asyncThunk"}function eDe(t){return t._reducerDefinitionType==="reducerWithPrepare"}function tDe({type:t,reducerName:e},n,r,i){if(!i)throw new Error(ul(18));const{payloadCreator:s,fulfilled:o,pending:l,rejected:c,settled:d,options:u}=n,m=i(t,s,u);r.exposeAction(e,m),o&&r.addCase(m.fulfilled,o),l&&r.addCase(m.pending,l),c&&r.addCase(m.rejected,c),d&&r.addMatcher(m.settled,d),r.exposeCaseReducer(e,{fulfilled:o||F1,pending:l||F1,rejected:c||F1,settled:d||F1})}function F1(){}var nDe="task",dee="listener",uee="completed",hI="cancelled",rDe=`task-${hI}`,aDe=`task-${uee}`,hR=`${dee}-${hI}`,iDe=`${dee}-${uee}`,XP=class{constructor(t){this.code=t,this.message=`${nDe} ${hI} (reason: ${t})`}name="TaskAbortError";message},pI=(t,e)=>{if(typeof t!="function")throw new TypeError(ul(32))},Dk=()=>{},mee=(t,e=Dk)=>(t.catch(e),t),hee=(t,e)=>(t.addEventListener("abort",e,{once:!0}),()=>t.removeEventListener("abort",e)),Cf=t=>{if(t.aborted)throw new XP(t.reason)};function pee(t,e){let n=Dk;return new Promise((r,i)=>{const s=()=>i(new XP(t.reason));if(t.aborted){s();return}n=hee(t,s),e.finally(()=>n()).then(r,i)}).finally(()=>{n=Dk})}var sDe=async(t,e)=>{try{return await Promise.resolve(),{status:"ok",value:await t()}}catch(n){return{status:n instanceof XP?"cancelled":"rejected",error:n}}finally{e?.()}},Fk=t=>e=>mee(pee(t,e).then(n=>(Cf(t),n))),fee=t=>{const e=Fk(t);return n=>e(new Promise(r=>setTimeout(r,n)))},{assign:dx}=Object,zV={},QP="listenerMiddleware",oDe=(t,e)=>{const n=r=>hee(t,()=>r.abort(t.reason));return(r,i)=>{pI(r);const s=new AbortController;n(s);const o=sDe(async()=>{Cf(t),Cf(s.signal);const l=await r({pause:Fk(s.signal),delay:fee(s.signal),signal:s.signal});return Cf(s.signal),l},()=>s.abort(aDe));return i?.autoJoin&&e.push(o.catch(Dk)),{result:Fk(t)(o),cancel(){s.abort(rDe)}}}},lDe=(t,e)=>{const n=async(r,i)=>{Cf(e);let s=()=>{};const l=[new Promise((c,d)=>{let u=t({predicate:r,effect:(m,p)=>{p.unsubscribe(),c([m,p.getState(),p.getOriginalState()])}});s=()=>{u(),d()}})];i!=null&&l.push(new Promise(c=>setTimeout(c,i,null)));try{const c=await pee(e,Promise.race(l));return Cf(e),c}finally{s()}};return(r,i)=>mee(n(r,i))},gee=t=>{let{type:e,actionCreator:n,matcher:r,predicate:i,effect:s}=t;if(e)i=oc(e).match;else if(n)e=n.type,i=n.match;else if(r)i=r;else if(!i)throw new Error(ul(21));return pI(s),{predicate:i,type:e,effect:s}},bee=dx(t=>{const{type:e,predicate:n,effect:r}=gee(t);return{id:G2e(),effect:r,type:e,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(ul(22))}}},{withTypes:()=>bee}),UV=(t,e)=>{const{type:n,effect:r,predicate:i}=gee(e);return Array.from(t.values()).find(s=>(typeof n=="string"?s.type===n:s.predicate===i)&&s.effect===r)},pR=t=>{t.pending.forEach(e=>{e.abort(hR)})},cDe=(t,e)=>()=>{for(const n of e.keys())pR(n);t.clear()},BV=(t,e,n)=>{try{t(e,n)}catch(r){setTimeout(()=>{throw r},0)}},xee=dx(oc(`${QP}/add`),{withTypes:()=>xee}),dDe=oc(`${QP}/removeAll`),yee=dx(oc(`${QP}/remove`),{withTypes:()=>yee}),uDe=(...t)=>{console.error(`${QP}/error`,...t)},$w=(t={})=>{const e=new Map,n=new Map,r=f=>{const y=n.get(f)??0;n.set(f,y+1)},i=f=>{const y=n.get(f)??1;y===1?n.delete(f):n.set(f,y-1)},{extra:s,onError:o=uDe}=t;pI(o);const l=f=>(f.unsubscribe=()=>e.delete(f.id),e.set(f.id,f),y=>{f.unsubscribe(),y?.cancelActive&&pR(f)}),c=f=>{const y=UV(e,f)??bee(f);return l(y)};dx(c,{withTypes:()=>c});const d=f=>{const y=UV(e,f);return y&&(y.unsubscribe(),f.cancelActive&&pR(y)),!!y};dx(d,{withTypes:()=>d});const u=async(f,y,v,g)=>{const b=new AbortController,_=lDe(c,b.signal),N=[];try{f.pending.add(b),r(f),await Promise.resolve(f.effect(y,dx({},v,{getOriginalState:g,condition:(P,k)=>_(P,k).then(Boolean),take:_,delay:fee(b.signal),pause:Fk(b.signal),extra:s,signal:b.signal,fork:oDe(b.signal,N),unsubscribe:f.unsubscribe,subscribe:()=>{e.set(f.id,f)},cancelActiveListeners:()=>{f.pending.forEach((P,k,M)=>{P!==b&&(P.abort(hR),M.delete(P))})},cancel:()=>{b.abort(hR),f.pending.delete(b)},throwIfCancelled:()=>{Cf(b.signal)}})))}catch(P){P instanceof XP||BV(o,P,{raisedBy:"effect"})}finally{await Promise.all(N),b.abort(iDe),i(f),f.pending.delete(b)}},m=cDe(e,n);return{middleware:f=>y=>v=>{if(!KJ(v))return y(v);if(xee.match(v))return c(v.payload);if(dDe.match(v)){m();return}if(yee.match(v))return d(v.payload);let g=f.getState();const b=()=>{if(g===zV)throw new Error(ul(23));return g};let _;try{if(_=y(v),e.size>0){const N=f.getState(),P=Array.from(e.values());for(const k of P){let M=!1;try{M=k.predicate(v,N,g)}catch(T){M=!1,BV(o,T,{raisedBy:"predicate"})}M&&u(k,v,f,b)}}}finally{g=zV}return _},startListening:c,stopListening:d,clearListeners:m}};function ul(t){return`Minified Redux Toolkit error #${t}; visit https://redux-toolkit.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var mDe={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},vee=Bo({name:"chartLayout",initialState:mDe,reducers:{setLayout(t,e){t.layoutType=e.payload},setChartSize(t,e){t.width=e.payload.width,t.height=e.payload.height},setMargin(t,e){var n,r,i,s;t.margin.top=(n=e.payload.top)!==null&&n!==void 0?n:0,t.margin.right=(r=e.payload.right)!==null&&r!==void 0?r:0,t.margin.bottom=(i=e.payload.bottom)!==null&&i!==void 0?i:0,t.margin.left=(s=e.payload.left)!==null&&s!==void 0?s:0},setScale(t,e){t.scale=e.payload}}}),{setMargin:hDe,setLayout:pDe,setChartSize:fDe,setScale:gDe}=vee.actions,bDe=vee.reducer;function wee(t,e,n){return Array.isArray(t)&&t&&e+n!==0?t.slice(e,n+1):t}function qn(t){return Number.isFinite(t)}function Fd(t){return typeof t=="number"&&t>0&&Number.isFinite(t)}function HV(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Zb(t){for(var e=1;e{if(e&&n){var{width:r,height:i}=n,{align:s,verticalAlign:o,layout:l}=e;if((l==="vertical"||l==="horizontal"&&o==="middle")&&s!=="center"&&an(t[s]))return Zb(Zb({},t),{},{[s]:t[s]+(r||0)});if((l==="horizontal"||l==="vertical"&&s==="center")&&o!=="middle"&&an(t[o]))return Zb(Zb({},t),{},{[o]:t[o]+(i||0)})}return t},Gc=(t,e)=>t==="horizontal"&&e==="xAxis"||t==="vertical"&&e==="yAxis"||t==="centric"&&e==="angleAxis"||t==="radial"&&e==="radiusAxis",See=(t,e,n,r)=>{if(r)return t.map(l=>l.coordinate);var i,s,o=t.map(l=>(l.coordinate===e&&(i=!0),l.coordinate===n&&(s=!0),l.coordinate));return i||o.push(e),s||o.push(n),o},_ee=(t,e,n)=>{if(!t)return null;var{duplicateDomain:r,type:i,range:s,scale:o,realScaleType:l,isCategorical:c,categoricalDomain:d,tickCount:u,ticks:m,niceTicks:p,axisType:f}=t;if(!o)return null;var y=l==="scaleBand"&&o.bandwidth?o.bandwidth()/2:2,v=i==="category"&&o.bandwidth?o.bandwidth()/y:0;if(v=f==="angleAxis"&&s&&s.length>=2?$i(s[0]-s[1])*2*v:v,m||p){var g=(m||p||[]).map((b,_)=>{var N=r?r.indexOf(b):b,P=o.map(N);return qn(P)?{coordinate:P+v,value:b,offset:v,index:_}:null}).filter(Eo);return g}return c&&d?d.map((b,_)=>{var N=o.map(b);return qn(N)?{coordinate:N+v,value:b,index:_,offset:v}:null}).filter(Eo):o.ticks&&u!=null?o.ticks(u).map((b,_)=>{var N=o.map(b);return qn(N)?{coordinate:N+v,value:b,index:_,offset:v}:null}).filter(Eo):o.domain().map((b,_)=>{var N=o.map(b);return qn(N)?{coordinate:N+v,value:r?r[b]:b,index:_,offset:v}:null}).filter(Eo)},SDe=(t,e)=>{if(!e||e.length!==2||!an(e[0])||!an(e[1]))return t;var n=Math.min(e[0],e[1]),r=Math.max(e[0],e[1]),i=[t[0],t[1]];return(!an(t[0])||t[0]r)&&(i[1]=r),i[0]>r&&(i[0]=r),i[1]{var e,n=t.length;if(!(n<=0)){var r=(e=t[0])===null||e===void 0?void 0:e.length;if(!(r==null||r<=0))for(var i=0;i=0?(d[0]=s,s+=p,d[1]=s):(d[0]=o,o+=p,d[1]=o)}}}},NDe=t=>{var e,n=t.length;if(!(n<=0)){var r=(e=t[0])===null||e===void 0?void 0:e.length;if(!(r==null||r<=0))for(var i=0;i=0?(c[0]=s,s+=d,c[1]=s):(c[0]=0,c[1]=0)}}}},kDe={sign:_De,expand:Kje,none:Xf,silhouette:Yje,wiggle:Xje,positive:NDe},CDe=(t,e,n)=>{var r,i=(r=kDe[n])!==null&&r!==void 0?r:Xf,s=Wje().keys(e).value((l,c)=>Number(Rr(l,c,0))).order(rR).offset(i),o=s(t);return o.forEach((l,c)=>{l.forEach((d,u)=>{var m=Rr(t[u],e[c],0);Array.isArray(m)&&m.length===2&&an(m[0])&&an(m[1])&&(d[0]=m[0],d[1]=m[1])})}),o};function Nee(t){return t==null?void 0:String(t)}function Rk(t){var{axis:e,ticks:n,bandSize:r,entry:i,index:s,dataKey:o}=t;if(e.type==="category"){if(!e.allowDuplicatedCategory&&e.dataKey&&!Ca(i[e.dataKey])){var l=TJ(n,"value",i[e.dataKey]);if(l)return l.coordinate+r/2}return n!=null&&n[s]?n[s].coordinate+r/2:null}var c=Rr(i,Ca(o)?e.dataKey:o),d=e.scale.map(c);return an(d)?d:null}var qV=t=>{var{axis:e,ticks:n,offset:r,bandSize:i,entry:s,index:o}=t;if(e.type==="category")return n[o]?n[o].coordinate+r:null;var l=Rr(s,e.dataKey,e.scale.domain()[o]);if(Ca(l))return null;var c=e.scale.map(l);return an(c)?c-i/2+r:null},PDe=t=>{var{numericAxis:e}=t,n=e.scale.domain();if(e.type==="number"){var r=Math.min(n[0],n[1]),i=Math.max(n[0],n[1]);return r<=0&&i>=0?0:i<0?i:r}return n[0]},TDe=t=>{var e=t.flat(2).filter(an);return[Math.min(...e),Math.max(...e)]},ADe=t=>[t[0]===1/0?0:t[0],t[1]===-1/0?0:t[1]],MDe=(t,e,n)=>{if(t!=null)return ADe(Object.keys(t).reduce((r,i)=>{var s=t[i];if(!s)return r;var{stackedData:o}=s,l=o.reduce((c,d)=>{var u=wee(d,e,n),m=TDe(u);return!qn(m[0])||!qn(m[1])?c:[Math.min(c[0],m[0]),Math.max(c[1],m[1])]},[1/0,-1/0]);return[Math.min(l[0],r[0]),Math.max(l[1],r[1])]},[1/0,-1/0]))},$V=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,VV=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Jh=(t,e,n)=>{if(t&&t.scale&&t.scale.bandwidth){var r=t.scale.bandwidth();if(!n||r>0)return r}if(t&&e&&e.length>=2){for(var i=HP(e,u=>u.coordinate),s=1/0,o=1,l=i.length;o{if(e==="horizontal")return t.chartX;if(e==="vertical")return t.chartY},EDe=(t,e)=>e==="centric"?t.angle:t.radius,hm=t=>t.layout.width,pm=t=>t.layout.height,DDe=t=>t.layout.scale,kee=t=>t.layout.margin,ZP=yt(t=>t.cartesianAxis.xAxis,t=>Object.values(t)),JP=yt(t=>t.cartesianAxis.yAxis,t=>Object.values(t)),Cee="data-recharts-item-index",Pee="data-recharts-item-id",Vw=60;function WV(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function R1(t){for(var e=1;et.brush.height;function IDe(t){var e=JP(t);return e.reduce((n,r)=>{if(r.orientation==="left"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:Vw;return n+i}return n},0)}function zDe(t){var e=JP(t);return e.reduce((n,r)=>{if(r.orientation==="right"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:Vw;return n+i}return n},0)}function UDe(t){var e=ZP(t);return e.reduce((n,r)=>r.orientation==="top"&&!r.mirror&&!r.hide?n+r.height:n,0)}function BDe(t){var e=ZP(t);return e.reduce((n,r)=>r.orientation==="bottom"&&!r.mirror&&!r.hide?n+r.height:n,0)}var Ai=yt([hm,pm,kee,ODe,IDe,zDe,UDe,BDe,$J,p2e],(t,e,n,r,i,s,o,l,c,d)=>{var u={left:(n.left||0)+i,right:(n.right||0)+s},m={top:(n.top||0)+o,bottom:(n.bottom||0)+l},p=R1(R1({},m),u),f=p.bottom;p.bottom+=r,p=wDe(p,c,d);var y=t-p.left-p.right,v=e-p.top-p.bottom;return R1(R1({brushBottom:f},p),{},{width:Math.max(y,0),height:Math.max(v,0)})}),HDe=yt(Ai,t=>({x:t.left,y:t.top,width:t.width,height:t.height})),fI=yt(hm,pm,(t,e)=>({x:0,y:0,width:t,height:e})),qDe=w.createContext(null),Mi=()=>w.useContext(qDe)!=null,eT=t=>t.brush,tT=yt([eT,Ai,kee],(t,e,n)=>({height:t.height,x:an(t.x)?t.x:e.left,y:an(t.y)?t.y:e.top+e.height+e.brushBottom-(n?.bottom||0),width:an(t.width)?t.width:e.width})),M2={},j2={},E2={},KV;function $De(){return KV||(KV=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n,r,{signal:i,edges:s}={}){let o,l=null;const c=s!=null&&s.includes("leading"),d=s==null||s.includes("trailing"),u=()=>{l!==null&&(n.apply(o,l),o=void 0,l=null)},m=()=>{d&&u(),v()};let p=null;const f=()=>{p!=null&&clearTimeout(p),p=setTimeout(()=>{p=null,m()},r)},y=()=>{p!==null&&(clearTimeout(p),p=null)},v=()=>{y(),o=void 0,l=null},g=()=>{u()},b=function(..._){if(i?.aborted)return;o=this,l=_;const N=p==null;f(),c&&N&&u()};return b.schedule=f,b.cancel=v,b.flush=g,i?.addEventListener("abort",v,{once:!0}),b}t.debounce=e})(E2)),E2}var YV;function VDe(){return YV||(YV=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=$De();function n(r,i=0,s={}){typeof s!="object"&&(s={});const{leading:o=!1,trailing:l=!0,maxWait:c}=s,d=Array(2);o&&(d[0]="leading"),l&&(d[1]="trailing");let u,m=null;const p=e.debounce(function(...v){u=r.apply(this,v),m=null},i,{edges:d}),f=function(...v){return c!=null&&(m===null&&(m=Date.now()),Date.now()-m>=c)?(u=r.apply(this,v),m=Date.now(),p.cancel(),p.schedule(),u):(p.apply(this,v),u)},y=()=>(p.flush(),u);return f.cancel=p.cancel,f.flush=y,f}t.debounce=n})(j2)),j2}var XV;function GDe(){return XV||(XV=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=VDe();function n(r,i=0,s={}){const{leading:o=!0,trailing:l=!0}=s;return e.debounce(r,i,{leading:o,maxWait:i,trailing:l})}t.throttle=n})(M2)),M2}var D2,QV;function WDe(){return QV||(QV=1,D2=GDe().throttle),D2}var KDe=WDe();const YDe=dc(KDe);var Lk=function(e,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;si[o++]))}},_d={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},Tee=(t,e,n)=>{var{width:r=_d.width,height:i=_d.height,aspect:s,maxHeight:o}=n,l=Zf(r)?t:Number(r),c=Zf(i)?e:Number(i);return s&&s>0&&(l?c=l/s:c&&(l=c*s),o&&c!=null&&c>o&&(c=o)),{calculatedWidth:l,calculatedHeight:c}},XDe={width:0,height:0,overflow:"visible"},QDe={width:0,overflowX:"visible"},ZDe={height:0,overflowY:"visible"},JDe={},e3e=t=>{var{width:e,height:n}=t,r=Zf(e),i=Zf(n);return r&&i?XDe:r?QDe:i?ZDe:JDe};function t3e(t){var{width:e,height:n,aspect:r}=t,i=e,s=n;return i===void 0&&s===void 0?(i=_d.width,s=_d.height):i===void 0?i=r&&r>0?void 0:_d.width:s===void 0&&(s=r&&r>0?void 0:_d.height),{width:i,height:s}}function fR(){return fR=Object.assign?Object.assign.bind():function(t){for(var e=1;e({width:n,height:r}),[n,r]);return i3e(i)?w.createElement(Aee.Provider,{value:i},e):null}var gI=()=>w.useContext(Aee),s3e=w.forwardRef((t,e)=>{var{aspect:n,initialDimension:r=_d.initialDimension,width:i,height:s,minWidth:o=_d.minWidth,minHeight:l,maxHeight:c,children:d,debounce:u=_d.debounce,id:m,className:p,onResize:f,style:y={}}=t,v=w.useRef(null),g=w.useRef();g.current=f,w.useImperativeHandle(e,()=>v.current);var[b,_]=w.useState({containerWidth:r.width,containerHeight:r.height}),N=w.useCallback((A,C)=>{_(F=>{var $=Math.round(A),I=Math.round(C);return F.containerWidth===$&&F.containerHeight===I?F:{containerWidth:$,containerHeight:I}})},[]);w.useEffect(()=>{if(v.current==null||typeof ResizeObserver>"u")return sp;var A=I=>{var Q,L=I[0];if(L!=null){var{width:re,height:ae}=L.contentRect;N(re,ae),(Q=g.current)===null||Q===void 0||Q.call(g,re,ae)}};u>0&&(A=YDe(A,u,{trailing:!0,leading:!1}));var C=new ResizeObserver(A),{width:F,height:$}=v.current.getBoundingClientRect();return N(F,$),C.observe(v.current),()=>{C.disconnect()}},[N,u]);var{containerWidth:P,containerHeight:k}=b;Lk(!n||n>0,"The aspect(%s) must be greater than zero.",n);var{calculatedWidth:M,calculatedHeight:T}=Tee(P,k,{width:i,height:s,aspect:n,maxHeight:c});return Lk(M!=null&&M>0||T!=null&&T>0,`The width(%s) and height(%s) of chart should be greater than 0, diff --git a/static/index.html b/static/index.html index 963116438..ab4ff745a 100644 --- a/static/index.html +++ b/static/index.html @@ -23,7 +23,7 @@ - +