diff --git a/frontend/src/components/control/AMSSectionDual.tsx b/frontend/src/components/control/AMSSectionDual.tsx
index 5ac172b72..3f9fe0c6b 100644
--- a/frontend/src/components/control/AMSSectionDual.tsx
+++ b/frontend/src/components/control/AMSSectionDual.tsx
@@ -1170,13 +1170,14 @@ export function AMSSectionDual({ printerId, printerModel, status, nozzleCount }:
+ {/* Unload button: disabled if not connected, printing, mutation pending, or no filament loaded */}
{unloadMutation.isPending ? (
@@ -1185,13 +1186,14 @@ export function AMSSectionDual({ printerId, printerModel, status, nozzleCount }:
'Unload'
)}
+ {/* Load button: disabled if not connected, printing, mutation pending, no tray selected, or selected tray is already loaded */}
{loadMutation.isPending ? (
diff --git a/static/assets/index-Bt0Dm_0_.js b/static/assets/index-1a-urQlt.js
similarity index 99%
rename from static/assets/index-Bt0Dm_0_.js
rename to static/assets/index-1a-urQlt.js
index 269d38af1..b4e40018b 100644
--- a/static/assets/index-Bt0Dm_0_.js
+++ b/static/assets/index-1a-urQlt.js
@@ -8593,4 +8593,4 @@ Accuracy: ${t.time_accuracy.toFixed(0)}%`:t.actual_time_seconds?`Actual: ${Kg(t.
Press space again to drop the item in its new position, or press escape to cancel.
`},l8e={onDragStart(t){let{active:e}=t;return"Picked up draggable item "+e.id+"."},onDragOver(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was moved over droppable area "+n.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was dropped over droppable area "+n.id:"Draggable item "+e.id+" was dropped."},onDragCancel(t){let{active:e}=t;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function c8e(t){let{announcements:e=l8e,container:n,hiddenTextDescribedById:i,screenReaderInstructions:r=o8e}=t;const{announce:a,announcement:s}=r8e(),o=bv("DndLiveRegion"),[l,c]=E.useState(!1);if(E.useEffect(()=>{c(!0)},[]),a8e(E.useMemo(()=>({onDragStart(f){let{active:m}=f;a(e.onDragStart({active:m}))},onDragMove(f){let{active:m,over:g}=f;e.onDragMove&&a(e.onDragMove({active:m,over:g}))},onDragOver(f){let{active:m,over:g}=f;a(e.onDragOver({active:m,over:g}))},onDragEnd(f){let{active:m,over:g}=f;a(e.onDragEnd({active:m,over:g}))},onDragCancel(f){let{active:m,over:g}=f;a(e.onDragCancel({active:m,over:g}))}}),[a,e])),!l)return null;const u=ui.createElement(ui.Fragment,null,ui.createElement(n8e,{id:i,value:r.draggable}),ui.createElement(i8e,{id:o,announcement:s}));return n?Jl.createPortal(u,n):u}var nr;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(nr||(nr={}));function VS(){}function ZV(t,e){return E.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function u8e(){for(var t=arguments.length,e=new Array(t),n=0;n[...e].filter(i=>i!=null),[...e])}const Ao=Object.freeze({x:0,y:0});function DJ(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function OJ(t,e){let{data:{value:n}}=t,{data:{value:i}}=e;return n-i}function d8e(t,e){let{data:{value:n}}=t,{data:{value:i}}=e;return i-n}function QV(t){let{left:e,top:n,height:i,width:r}=t;return[{x:e,y:n},{x:e+r,y:n},{x:e,y:n+i},{x:e+r,y:n+i}]}function LJ(t,e){if(!t||t.length===0)return null;const[n]=t;return n[e]}function JV(t,e,n){return e===void 0&&(e=t.left),n===void 0&&(n=t.top),{x:e+t.width*.5,y:n+t.height*.5}}const f8e=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:i}=t;const r=JV(e,e.left,e.top),a=[];for(const s of i){const{id:o}=s,l=n.get(o);if(l){const c=DJ(JV(l),r);a.push({id:o,data:{droppableContainer:s,value:c}})}}return a.sort(OJ)},h8e=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:i}=t;const r=QV(e),a=[];for(const s of i){const{id:o}=s,l=n.get(o);if(l){const c=QV(l),u=r.reduce((m,g,b)=>m+DJ(c[b],g),0),f=Number((u/4).toFixed(4));a.push({id:o,data:{droppableContainer:s,value:f}})}}return a.sort(OJ)};function p8e(t,e){const n=Math.max(e.top,t.top),i=Math.max(e.left,t.left),r=Math.min(e.left+e.width,t.left+t.width),a=Math.min(e.top+e.height,t.top+t.height),s=r-i,o=a-n;if(i{let{collisionRect:e,droppableRects:n,droppableContainers:i}=t;const r=[];for(const a of i){const{id:s}=a,o=n.get(s);if(o){const l=p8e(o,e);l>0&&r.push({id:s,data:{droppableContainer:a,value:l}})}}return r.sort(d8e)};function g8e(t,e,n){return{...t,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function IJ(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:Ao}function x8e(t){return function(n){for(var i=arguments.length,r=new Array(i>1?i-1:0),a=1;a({...s,top:s.top+t*o.y,bottom:s.bottom+t*o.y,left:s.left+t*o.x,right:s.right+t*o.x}),{...n})}}const v8e=x8e(1);function b8e(t){if(t.startsWith("matrix3d(")){const e=t.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(t.startsWith("matrix(")){const e=t.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function y8e(t,e,n){const i=b8e(e);if(!i)return t;const{scaleX:r,scaleY:a,x:s,y:o}=i,l=t.left-s-(1-r)*parseFloat(n),c=t.top-o-(1-a)*parseFloat(n.slice(n.indexOf(" ")+1)),u=r?t.width/r:t.width,f=a?t.height/a:t.height;return{width:u,height:f,top:c,right:l+u,bottom:c+f,left:l}}const _8e={ignoreTransform:!1};function Bm(t,e){e===void 0&&(e=_8e);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:c,transformOrigin:u}=qa(t).getComputedStyle(t);c&&(n=y8e(n,c,u))}const{top:i,left:r,width:a,height:s,bottom:o,right:l}=n;return{top:i,left:r,width:a,height:s,bottom:o,right:l}}function eG(t){return Bm(t,{ignoreTransform:!0})}function S8e(t){const e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function w8e(t,e){return e===void 0&&(e=qa(t).getComputedStyle(t)),e.position==="fixed"}function M8e(t,e){e===void 0&&(e=qa(t).getComputedStyle(t));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(r=>{const a=e[r];return typeof a=="string"?n.test(a):!1})}function bM(t,e){const n=[];function i(r){if(e!=null&&n.length>=e||!r)return n;if(oL(r)&&r.scrollingElement!=null&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!xv(r)||RJ(r)||n.includes(r))return n;const a=qa(t).getComputedStyle(r);return r!==t&&M8e(r,a)&&n.push(r),w8e(r,a)?n:i(r.parentNode)}return t?i(t):n}function jJ(t){const[e]=bM(t,1);return e??null}function hN(t){return!vM||!t?null:Fm(t)?t:sL(t)?oL(t)||t===zm(t).scrollingElement?window:xv(t)?t:null:null}function UJ(t){return Fm(t)?t.scrollX:t.scrollLeft}function FJ(t){return Fm(t)?t.scrollY:t.scrollTop}function MP(t){return{x:UJ(t),y:FJ(t)}}var Er;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Er||(Er={}));function zJ(t){return!vM||!t?!1:t===document.scrollingElement}function BJ(t){const e={x:0,y:0},n=zJ(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},i={x:t.scrollWidth-n.width,y:t.scrollHeight-n.height},r=t.scrollTop<=e.y,a=t.scrollLeft<=e.x,s=t.scrollTop>=i.y,o=t.scrollLeft>=i.x;return{isTop:r,isLeft:a,isBottom:s,isRight:o,maxScroll:i,minScroll:e}}const E8e={x:.2,y:.2};function A8e(t,e,n,i,r){let{top:a,left:s,right:o,bottom:l}=n;i===void 0&&(i=10),r===void 0&&(r=E8e);const{isTop:c,isBottom:u,isLeft:f,isRight:m}=BJ(t),g={x:0,y:0},b={x:0,y:0},y={height:e.height*r.y,width:e.width*r.x};return!c&&a<=e.top+y.height?(g.y=Er.Backward,b.y=i*Math.abs((e.top+y.height-a)/y.height)):!u&&l>=e.bottom-y.height&&(g.y=Er.Forward,b.y=i*Math.abs((e.bottom-y.height-l)/y.height)),!m&&o>=e.right-y.width?(g.x=Er.Forward,b.x=i*Math.abs((e.right-y.width-o)/y.width)):!f&&s<=e.left+y.width&&(g.x=Er.Backward,b.x=i*Math.abs((e.left+y.width-s)/y.width)),{direction:g,speed:b}}function T8e(t){if(t===document.scrollingElement){const{innerWidth:a,innerHeight:s}=window;return{top:0,left:0,right:a,bottom:s,width:a,height:s}}const{top:e,left:n,right:i,bottom:r}=t.getBoundingClientRect();return{top:e,left:n,right:i,bottom:r,width:t.clientWidth,height:t.clientHeight}}function HJ(t){return t.reduce((e,n)=>Bp(e,MP(n)),Ao)}function C8e(t){return t.reduce((e,n)=>e+UJ(n),0)}function N8e(t){return t.reduce((e,n)=>e+FJ(n),0)}function R8e(t,e){if(e===void 0&&(e=Bm),!t)return;const{top:n,left:i,bottom:r,right:a}=e(t);jJ(t)&&(r<=0||a<=0||n>=window.innerHeight||i>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const P8e=[["x",["left","right"],C8e],["y",["top","bottom"],N8e]];class uL{constructor(e,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const i=bM(n),r=HJ(i);this.rect={...e},this.width=e.width,this.height=e.height;for(const[a,s,o]of P8e)for(const l of s)Object.defineProperty(this,l,{get:()=>{const c=o(i),u=r[a]-c;return this.rect[l]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ox{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var i;return(i=this.target)==null?void 0:i.removeEventListener(...n)})},this.target=e}add(e,n,i){var r;(r=this.target)==null||r.addEventListener(e,n,i),this.listeners.push([e,n,i])}}function k8e(t){const{EventTarget:e}=qa(t);return t instanceof e?t:zm(t)}function pN(t,e){const n=Math.abs(t.x),i=Math.abs(t.y);return typeof e=="number"?Math.sqrt(n**2+i**2)>e:"x"in e&&"y"in e?n>e.x&&i>e.y:"x"in e?n>e.x:"y"in e?i>e.y:!1}var js;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(js||(js={}));function tG(t){t.preventDefault()}function D8e(t){t.stopPropagation()}var _n;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(_n||(_n={}));const $J={start:[_n.Space,_n.Enter],cancel:[_n.Esc],end:[_n.Space,_n.Enter,_n.Tab]},O8e=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case _n.Right:return{...n,x:n.x+25};case _n.Left:return{...n,x:n.x-25};case _n.Down:return{...n,y:n.y+25};case _n.Up:return{...n,y:n.y-25}}};class dL{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new Ox(zm(n)),this.windowListeners=new Ox(qa(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(js.Resize,this.handleCancel),this.windowListeners.add(js.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(js.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,i=e.node.current;i&&R8e(i),n(Ao)}handleKeyDown(e){if(cL(e)){const{active:n,context:i,options:r}=this.props,{keyboardCodes:a=$J,coordinateGetter:s=O8e,scrollBehavior:o="smooth"}=r,{code:l}=e;if(a.end.includes(l)){this.handleEnd(e);return}if(a.cancel.includes(l)){this.handleCancel(e);return}const{collisionRect:c}=i.current,u=c?{x:c.left,y:c.top}:Ao;this.referenceCoordinates||(this.referenceCoordinates=u);const f=s(e,{active:n,context:i.current,currentCoordinates:u});if(f){const m=N0(f,u),g={x:0,y:0},{scrollableAncestors:b}=i.current;for(const y of b){const v=e.code,{isTop:x,isRight:M,isLeft:w,isBottom:A,maxScroll:T,minScroll:R}=BJ(y),N=T8e(y),j={x:Math.min(v===_n.Right?N.right-N.width/2:N.right,Math.max(v===_n.Right?N.left:N.left+N.width/2,f.x)),y:Math.min(v===_n.Down?N.bottom-N.height/2:N.bottom,Math.max(v===_n.Down?N.top:N.top+N.height/2,f.y))},C=v===_n.Right&&!M||v===_n.Left&&!w,k=v===_n.Down&&!A||v===_n.Up&&!x;if(C&&j.x!==f.x){const F=y.scrollLeft+m.x,I=v===_n.Right&&F<=T.x||v===_n.Left&&F>=R.x;if(I&&!m.y){y.scrollTo({left:F,behavior:o});return}I?g.x=y.scrollLeft-F:g.x=v===_n.Right?y.scrollLeft-T.x:y.scrollLeft-R.x,g.x&&y.scrollBy({left:-g.x,behavior:o});break}else if(k&&j.y!==f.y){const F=y.scrollTop+m.y,I=v===_n.Down&&F<=T.y||v===_n.Up&&F>=R.y;if(I&&!m.x){y.scrollTo({top:F,behavior:o});return}I?g.y=y.scrollTop-F:g.y=v===_n.Down?y.scrollTop-T.y:y.scrollTop-R.y,g.y&&y.scrollBy({top:-g.y,behavior:o});break}}this.handleMove(e,Bp(N0(f,this.referenceCoordinates),g))}}}handleMove(e,n){const{onMove:i}=this.props;e.preventDefault(),i(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}dL.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:i=$J,onActivation:r}=e,{active:a}=n;const{code:s}=t.nativeEvent;if(i.start.includes(s)){const o=a.activatorNode.current;return o&&t.target!==o?!1:(t.preventDefault(),r?.({event:t.nativeEvent}),!0)}return!1}}];function nG(t){return!!(t&&"distance"in t)}function iG(t){return!!(t&&"delay"in t)}class fL{constructor(e,n,i){var r;i===void 0&&(i=k8e(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;const{event:a}=e,{target:s}=a;this.props=e,this.events=n,this.document=zm(s),this.documentListeners=new Ox(this.document),this.listeners=new Ox(i),this.windowListeners=new Ox(qa(s)),this.initialCoordinates=(r=wP(a))!=null?r:Ao,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:n,bypassActivationConstraint:i}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(js.Resize,this.handleCancel),this.windowListeners.add(js.DragStart,tG),this.windowListeners.add(js.VisibilityChange,this.handleCancel),this.windowListeners.add(js.ContextMenu,tG),this.documentListeners.add(js.Keydown,this.handleKeydown),n){if(i!=null&&i({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(iG(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(nG(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,n){const{active:i,onPending:r}=this.props;r(i,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(js.Click,D8e,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(js.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:i,initialCoordinates:r,props:a}=this,{onMove:s,options:{activationConstraint:o}}=a;if(!r)return;const l=(n=wP(e))!=null?n:Ao,c=N0(r,l);if(!i&&o){if(nG(o)){if(o.tolerance!=null&&pN(c,o.tolerance))return this.handleCancel();if(pN(c,o.distance))return this.handleStart()}if(iG(o)&&pN(c,o.tolerance))return this.handleCancel();this.handlePending(o,c);return}e.cancelable&&e.preventDefault(),s(l)}handleEnd(){const{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){const{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===_n.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const L8e={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class hL extends fL{constructor(e){const{event:n}=e,i=zm(n.target);super(e,L8e,i)}}hL.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:i}=e;return!n.isPrimary||n.button!==0?!1:(i?.({event:n}),!0)}}];const I8e={move:{name:"mousemove"},end:{name:"mouseup"}};var EP;(function(t){t[t.RightClick=2]="RightClick"})(EP||(EP={}));class j8e extends fL{constructor(e){super(e,I8e,zm(e.event.target))}}j8e.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:i}=e;return n.button===EP.RightClick?!1:(i?.({event:n}),!0)}}];const mN={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class U8e extends fL{constructor(e){super(e,mN)}static setup(){return window.addEventListener(mN.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(mN.move.name,e)};function e(){}}}U8e.activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:i}=e;const{touches:r}=n;return r.length>1?!1:(i?.({event:n}),!0)}}];var Lx;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(Lx||(Lx={}));var GS;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(GS||(GS={}));function F8e(t){let{acceleration:e,activator:n=Lx.Pointer,canScroll:i,draggingRect:r,enabled:a,interval:s=5,order:o=GS.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:f,threshold:m}=t;const g=B8e({delta:f,disabled:!a}),[b,y]=ZHe(),v=E.useRef({x:0,y:0}),x=E.useRef({x:0,y:0}),M=E.useMemo(()=>{switch(n){case Lx.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Lx.DraggableRect:return r}},[n,r,l]),w=E.useRef(null),A=E.useCallback(()=>{const R=w.current;if(!R)return;const N=v.current.x*x.current.x,j=v.current.y*x.current.y;R.scrollBy(N,j)},[]),T=E.useMemo(()=>o===GS.TreeOrder?[...c].reverse():c,[o,c]);E.useEffect(()=>{if(!a||!c.length||!M){y();return}for(const R of T){if(i?.(R)===!1)continue;const N=c.indexOf(R),j=u[N];if(!j)continue;const{direction:C,speed:k}=A8e(R,j,M,e,m);for(const F of["x","y"])g[F][C[F]]||(k[F]=0,C[F]=0);if(k.x>0||k.y>0){y(),w.current=R,b(A,s),v.current=k,x.current=C;return}}v.current={x:0,y:0},x.current={x:0,y:0},y()},[e,A,i,y,a,s,JSON.stringify(M),JSON.stringify(g),b,c,T,u,JSON.stringify(m)])}const z8e={x:{[Er.Backward]:!1,[Er.Forward]:!1},y:{[Er.Backward]:!1,[Er.Forward]:!1}};function B8e(t){let{delta:e,disabled:n}=t;const i=SP(e);return vv(r=>{if(n||!i||!r)return z8e;const a={x:Math.sign(e.x-i.x),y:Math.sign(e.y-i.y)};return{x:{[Er.Backward]:r.x[Er.Backward]||a.x===-1,[Er.Forward]:r.x[Er.Forward]||a.x===1},y:{[Er.Backward]:r.y[Er.Backward]||a.y===-1,[Er.Forward]:r.y[Er.Forward]||a.y===1}}},[n,e,i])}function H8e(t,e){const n=e!=null?t.get(e):void 0,i=n?n.node.current:null;return vv(r=>{var a;return e==null?null:(a=i??r)!=null?a:null},[i,e])}function $8e(t,e){return E.useMemo(()=>t.reduce((n,i)=>{const{sensor:r}=i,a=r.activators.map(s=>({eventName:s.eventName,handler:e(s.handler,i)}));return[...n,...a]},[]),[t,e])}var P0;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(P0||(P0={}));var AP;(function(t){t.Optimized="optimized"})(AP||(AP={}));const rG=new Map;function V8e(t,e){let{dragging:n,dependencies:i,config:r}=e;const[a,s]=E.useState(null),{frequency:o,measure:l,strategy:c}=r,u=E.useRef(t),f=v(),m=C0(f),g=E.useCallback(function(x){x===void 0&&(x=[]),!m.current&&s(M=>M===null?x:M.concat(x.filter(w=>!M.includes(w))))},[m]),b=E.useRef(null),y=vv(x=>{if(f&&!n)return rG;if(!x||x===rG||u.current!==t||a!=null){const M=new Map;for(let w of t){if(!w)continue;if(a&&a.length>0&&!a.includes(w.id)&&w.rect.current){M.set(w.id,w.rect.current);continue}const A=w.node.current,T=A?new uL(l(A),A):null;w.rect.current=T,T&&M.set(w.id,T)}return M}return x},[t,a,n,f,l]);return E.useEffect(()=>{u.current=t},[t]),E.useEffect(()=>{f||g()},[n,f]),E.useEffect(()=>{a&&a.length>0&&s(null)},[JSON.stringify(a)]),E.useEffect(()=>{f||typeof o!="number"||b.current!==null||(b.current=setTimeout(()=>{g(),b.current=null},o))},[o,f,g,...i]),{droppableRects:y,measureDroppableContainers:g,measuringScheduled:a!=null};function v(){switch(c){case P0.Always:return!1;case P0.BeforeDragging:return n;default:return!n}}}function VJ(t,e){return vv(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function G8e(t,e){return VJ(t,e)}function W8e(t){let{callback:e,disabled:n}=t;const i=lL(e),r=E.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(i)},[i,n]);return E.useEffect(()=>()=>r?.disconnect(),[r]),r}function yM(t){let{callback:e,disabled:n}=t;const i=lL(e),r=E.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(i)},[n]);return E.useEffect(()=>()=>r?.disconnect(),[r]),r}function q8e(t){return new uL(Bm(t),t)}function aG(t,e,n){e===void 0&&(e=q8e);const[i,r]=E.useState(null);function a(){r(l=>{if(!t)return null;if(t.isConnected===!1){var c;return(c=l??n)!=null?c:null}const u=e(t);return JSON.stringify(l)===JSON.stringify(u)?l:u})}const s=W8e({callback(l){if(t)for(const c of l){const{type:u,target:f}=c;if(u==="childList"&&f instanceof HTMLElement&&f.contains(t)){a();break}}}}),o=yM({callback:a});return ll(()=>{a(),t?(o?.observe(t),s?.observe(document.body,{childList:!0,subtree:!0})):(o?.disconnect(),s?.disconnect())},[t]),i}function X8e(t){const e=VJ(t);return IJ(t,e)}const sG=[];function K8e(t){const e=E.useRef(t),n=vv(i=>t?i&&i!==sG&&t&&e.current&&t.parentNode===e.current.parentNode?i:bM(t):sG,[t]);return E.useEffect(()=>{e.current=t},[t]),n}function Y8e(t){const[e,n]=E.useState(null),i=E.useRef(t),r=E.useCallback(a=>{const s=hN(a.target);s&&n(o=>o?(o.set(s,MP(s)),new Map(o)):null)},[]);return E.useEffect(()=>{const a=i.current;if(t!==a){s(a);const o=t.map(l=>{const c=hN(l);return c?(c.addEventListener("scroll",r,{passive:!0}),[c,MP(c)]):null}).filter(l=>l!=null);n(o.length?new Map(o):null),i.current=t}return()=>{s(t),s(a)};function s(o){o.forEach(l=>{const c=hN(l);c?.removeEventListener("scroll",r)})}},[r,t]),E.useMemo(()=>t.length?e?Array.from(e.values()).reduce((a,s)=>Bp(a,s),Ao):HJ(t):Ao,[t,e])}function oG(t,e){e===void 0&&(e=[]);const n=E.useRef(null);return E.useEffect(()=>{n.current=null},e),E.useEffect(()=>{const i=t!==Ao;i&&!n.current&&(n.current=t),!i&&n.current&&(n.current=null)},[t]),n.current?N0(t,n.current):Ao}function Z8e(t){E.useEffect(()=>{if(!vM)return;const e=t.map(n=>{let{sensor:i}=n;return i.setup==null?void 0:i.setup()});return()=>{for(const n of e)n?.()}},t.map(e=>{let{sensor:n}=e;return n}))}function Q8e(t,e){return E.useMemo(()=>t.reduce((n,i)=>{let{eventName:r,handler:a}=i;return n[r]=s=>{a(s,e)},n},{}),[t,e])}function GJ(t){return E.useMemo(()=>t?S8e(t):null,[t])}const lG=[];function J8e(t,e){e===void 0&&(e=Bm);const[n]=t,i=GJ(n?qa(n):null),[r,a]=E.useState(lG);function s(){a(()=>t.length?t.map(l=>zJ(l)?i:new uL(e(l),l)):lG)}const o=yM({callback:s});return ll(()=>{o?.disconnect(),s(),t.forEach(l=>o?.observe(l))},[t]),r}function e$e(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return xv(e)?e:t}function t$e(t){let{measure:e}=t;const[n,i]=E.useState(null),r=E.useCallback(c=>{for(const{target:u}of c)if(xv(u)){i(f=>{const m=e(u);return f?{...f,width:m.width,height:m.height}:m});break}},[e]),a=yM({callback:r}),s=E.useCallback(c=>{const u=e$e(c);a?.disconnect(),u&&a?.observe(u),i(u?e(u):null)},[e,a]),[o,l]=$S(s);return E.useMemo(()=>({nodeRef:o,rect:n,setRef:l}),[n,o,l])}const n$e=[{sensor:hL,options:{}},{sensor:dL,options:{}}],i$e={current:{}},L_={draggable:{measure:eG},droppable:{measure:eG,strategy:P0.WhileDragging,frequency:AP.Optimized},dragOverlay:{measure:Bm}};class Ix extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,i;return(n=(i=this.get(e))==null?void 0:i.node.current)!=null?n:void 0}}const r$e={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ix,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:VS},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:L_,measureDroppableContainers:VS,windowRect:null,measuringScheduled:!1},a$e={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:VS,draggableNodes:new Map,over:null,measureDroppableContainers:VS},_M=E.createContext(a$e),WJ=E.createContext(r$e);function s$e(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ix}}}function o$e(t,e){switch(e.type){case nr.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case nr.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}};case nr.DragEnd:case nr.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case nr.RegisterDroppable:{const{element:n}=e,{id:i}=n,r=new Ix(t.droppable.containers);return r.set(i,n),{...t,droppable:{...t.droppable,containers:r}}}case nr.SetDroppableDisabled:{const{id:n,key:i,disabled:r}=e,a=t.droppable.containers.get(n);if(!a||i!==a.key)return t;const s=new Ix(t.droppable.containers);return s.set(n,{...a,disabled:r}),{...t,droppable:{...t.droppable,containers:s}}}case nr.UnregisterDroppable:{const{id:n,key:i}=e,r=t.droppable.containers.get(n);if(!r||i!==r.key)return t;const a=new Ix(t.droppable.containers);return a.delete(n),{...t,droppable:{...t.droppable,containers:a}}}default:return t}}function l$e(t){let{disabled:e}=t;const{active:n,activatorEvent:i,draggableNodes:r}=E.useContext(_M),a=SP(i),s=SP(n?.id);return E.useEffect(()=>{if(!e&&!i&&a&&s!=null){if(!cL(a)||document.activeElement===a.target)return;const o=r.get(s);if(!o)return;const{activatorNode:l,node:c}=o;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const u of[l.current,c.current]){if(!u)continue;const f=e8e(u);if(f){f.focus();break}}})}},[i,e,r,s,a]),null}function c$e(t,e){let{transform:n,...i}=e;return t!=null&&t.length?t.reduce((r,a)=>a({transform:r,...i}),n):n}function u$e(t){return E.useMemo(()=>({draggable:{...L_.draggable,...t?.draggable},droppable:{...L_.droppable,...t?.droppable},dragOverlay:{...L_.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function d$e(t){let{activeNode:e,measure:n,initialRect:i,config:r=!0}=t;const a=E.useRef(!1),{x:s,y:o}=typeof r=="boolean"?{x:r,y:r}:r;ll(()=>{if(!s&&!o||!e){a.current=!1;return}if(a.current||!i)return;const c=e?.node.current;if(!c||c.isConnected===!1)return;const u=n(c),f=IJ(u,i);if(s||(f.x=0),o||(f.y=0),a.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const m=jJ(c);m&&m.scrollBy({top:f.y,left:f.x})}},[e,s,o,i,n])}const qJ=E.createContext({...Ao,scaleX:1,scaleY:1});var Cu;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(Cu||(Cu={}));const f$e=E.memo(function(e){var n,i,r,a;let{id:s,accessibility:o,autoScroll:l=!0,children:c,sensors:u=n$e,collisionDetection:f=m8e,measuring:m,modifiers:g,...b}=e;const y=E.useReducer(o$e,void 0,s$e),[v,x]=y,[M,w]=s8e(),[A,T]=E.useState(Cu.Uninitialized),R=A===Cu.Initialized,{draggable:{active:N,nodes:j,translate:C},droppable:{containers:k}}=v,F=N!=null?j.get(N):null,I=E.useRef({initial:null,translated:null}),G=E.useMemo(()=>{var Oe;return N!=null?{id:N,data:(Oe=F?.data)!=null?Oe:i$e,rect:I}:null},[N,F]),O=E.useRef(null),[B,$]=E.useState(null),[V,K]=E.useState(null),Y=C0(b,Object.values(b)),se=bv("DndDescribedBy",s),H=E.useMemo(()=>k.getEnabled(),[k]),X=u$e(m),{droppableRects:ae,measureDroppableContainers:le,measuringScheduled:de}=V8e(H,{dragging:R,dependencies:[C.x,C.y],config:X.droppable}),Q=H8e(j,N),xe=E.useMemo(()=>V?wP(V):null,[V]),Re=he(),pe=G8e(Q,X.draggable.measure);d$e({activeNode:N!=null?j.get(N):null,config:Re.layoutShiftCompensation,initialRect:pe,measure:X.draggable.measure});const Me=aG(Q,X.draggable.measure,pe),Ie=aG(Q?Q.parentElement:null),ce=E.useRef({activatorEvent:null,active:null,activeNode:Q,collisionRect:null,collisions:null,droppableRects:ae,draggableNodes:j,draggingNode:null,draggingNodeRect:null,droppableContainers:k,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),dt=k.getNodeFor((n=ce.current.over)==null?void 0:n.id),z=t$e({measure:X.dragOverlay.measure}),q=(i=z.nodeRef.current)!=null?i:Q,re=R?(r=z.rect)!=null?r:Me:null,te=!!(z.nodeRef.current&&z.rect),ne=X8e(te?null:Me),oe=GJ(q?qa(q):null),ye=K8e(R?dt??Q:null),we=J8e(ye),ee=c$e(g,{transform:{x:C.x-ne.x,y:C.y-ne.y,scaleX:1,scaleY:1},activatorEvent:V,active:G,activeNodeRect:Me,containerNodeRect:Ie,draggingNodeRect:re,over:ce.current.over,overlayNodeRect:z.rect,scrollableAncestors:ye,scrollableAncestorRects:we,windowRect:oe}),U=xe?Bp(xe,C):null,L=Y8e(ye),Z=oG(L),ge=oG(L,[Me]),ve=Bp(ee,Z),me=re?v8e(re,ee):null,qe=G&&me?f({active:G,collisionRect:me,droppableRects:ae,droppableContainers:H,pointerCoordinates:U}):null,Le=LJ(qe,"id"),[Ke,st]=E.useState(null),je=te?ee:Bp(ee,ge),ke=g8e(je,(a=Ke?.rect)!=null?a:null,Me),pt=E.useRef(null),it=E.useCallback((Oe,Ae)=>{let{sensor:be,options:He}=Ae;if(O.current==null)return;const ct=j.get(O.current);if(!ct)return;const _t=Oe.nativeEvent,Rt=new be({active:O.current,activeNode:ct,event:_t,options:He,context:ce,onAbort(Dt){if(!j.get(Dt))return;const{onDragAbort:qn}=Y.current,pr={id:Dt};qn?.(pr),M({type:"onDragAbort",event:pr})},onPending(Dt,Pn,qn,pr){if(!j.get(Dt))return;const{onDragPending:mr}=Y.current,Pr={id:Dt,constraint:Pn,initialCoordinates:qn,offset:pr};mr?.(Pr),M({type:"onDragPending",event:Pr})},onStart(Dt){const Pn=O.current;if(Pn==null)return;const qn=j.get(Pn);if(!qn)return;const{onDragStart:pr}=Y.current,Zi={activatorEvent:_t,active:{id:Pn,data:qn.data,rect:I}};Jl.unstable_batchedUpdates(()=>{pr?.(Zi),T(Cu.Initializing),x({type:nr.DragStart,initialCoordinates:Dt,active:Pn}),M({type:"onDragStart",event:Zi}),$(pt.current),K(_t)})},onMove(Dt){x({type:nr.DragMove,coordinates:Dt})},onEnd:ln(nr.DragEnd),onCancel:ln(nr.DragCancel)});pt.current=Rt;function ln(Dt){return async function(){const{active:qn,collisions:pr,over:Zi,scrollAdjustedTranslate:mr}=ce.current;let Pr=null;if(qn&&mr){const{cancelDrop:qr}=Y.current;Pr={activatorEvent:_t,active:qn,collisions:pr,delta:mr,over:Zi},Dt===nr.DragEnd&&typeof qr=="function"&&await Promise.resolve(qr(Pr))&&(Dt=nr.DragCancel)}O.current=null,Jl.unstable_batchedUpdates(()=>{x({type:Dt}),T(Cu.Uninitialized),st(null),$(null),K(null),pt.current=null;const qr=Dt===nr.DragEnd?"onDragEnd":"onDragCancel";if(Pr){const Li=Y.current[qr];Li?.(Pr),M({type:qr,event:Pr})}})}}},[j]),nt=E.useCallback((Oe,Ae)=>(be,He)=>{const ct=be.nativeEvent,_t=j.get(He);if(O.current!==null||!_t||ct.dndKit||ct.defaultPrevented)return;const Rt={active:_t};Oe(be,Ae.options,Rt)===!0&&(ct.dndKit={capturedBy:Ae.sensor},O.current=He,it(be,Ae))},[j,it]),ut=$8e(u,nt);Z8e(u),ll(()=>{Me&&A===Cu.Initializing&&T(Cu.Initialized)},[Me,A]),E.useEffect(()=>{const{onDragMove:Oe}=Y.current,{active:Ae,activatorEvent:be,collisions:He,over:ct}=ce.current;if(!Ae||!be)return;const _t={active:Ae,activatorEvent:be,collisions:He,delta:{x:ve.x,y:ve.y},over:ct};Jl.unstable_batchedUpdates(()=>{Oe?.(_t),M({type:"onDragMove",event:_t})})},[ve.x,ve.y]),E.useEffect(()=>{const{active:Oe,activatorEvent:Ae,collisions:be,droppableContainers:He,scrollAdjustedTranslate:ct}=ce.current;if(!Oe||O.current==null||!Ae||!ct)return;const{onDragOver:_t}=Y.current,Rt=He.get(Le),ln=Rt&&Rt.rect.current?{id:Rt.id,rect:Rt.rect.current,data:Rt.data,disabled:Rt.disabled}:null,Dt={active:Oe,activatorEvent:Ae,collisions:be,delta:{x:ct.x,y:ct.y},over:ln};Jl.unstable_batchedUpdates(()=>{st(ln),_t?.(Dt),M({type:"onDragOver",event:Dt})})},[Le]),ll(()=>{ce.current={activatorEvent:V,active:G,activeNode:Q,collisionRect:me,collisions:qe,droppableRects:ae,draggableNodes:j,draggingNode:q,draggingNodeRect:re,droppableContainers:k,over:Ke,scrollableAncestors:ye,scrollAdjustedTranslate:ve},I.current={initial:re,translated:me}},[G,Q,qe,me,j,q,re,ae,k,Ke,ye,ve]),F8e({...Re,delta:C,draggingRect:me,pointerCoordinates:U,scrollableAncestors:ye,scrollableAncestorRects:we});const fe=E.useMemo(()=>({active:G,activeNode:Q,activeNodeRect:Me,activatorEvent:V,collisions:qe,containerNodeRect:Ie,dragOverlay:z,draggableNodes:j,droppableContainers:k,droppableRects:ae,over:Ke,measureDroppableContainers:le,scrollableAncestors:ye,scrollableAncestorRects:we,measuringConfiguration:X,measuringScheduled:de,windowRect:oe}),[G,Q,Me,V,qe,Ie,z,j,k,ae,Ke,le,ye,we,X,de,oe]),rt=E.useMemo(()=>({activatorEvent:V,activators:ut,active:G,activeNodeRect:Me,ariaDescribedById:{draggable:se},dispatch:x,draggableNodes:j,over:Ke,measureDroppableContainers:le}),[V,ut,G,Me,x,se,j,Ke,le]);return ui.createElement(kJ.Provider,{value:w},ui.createElement(_M.Provider,{value:rt},ui.createElement(WJ.Provider,{value:fe},ui.createElement(qJ.Provider,{value:ke},c)),ui.createElement(l$e,{disabled:o?.restoreFocus===!1})),ui.createElement(c8e,{...o,hiddenTextDescribedById:se}));function he(){const Oe=B?.autoScrollEnabled===!1,Ae=typeof l=="object"?l.enabled===!1:l===!1,be=R&&!Oe&&!Ae;return typeof l=="object"?{...l,enabled:be}:{enabled:be}}}),h$e=E.createContext(null),cG="button",p$e="Draggable";function m$e(t){let{id:e,data:n,disabled:i=!1,attributes:r}=t;const a=bv(p$e),{activators:s,activatorEvent:o,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:f,over:m}=E.useContext(_M),{role:g=cG,roleDescription:b="draggable",tabIndex:y=0}=r??{},v=l?.id===e,x=E.useContext(v?qJ:h$e),[M,w]=$S(),[A,T]=$S(),R=Q8e(s,e),N=C0(n);ll(()=>(f.set(e,{id:e,key:a,node:M,activatorNode:A,data:N}),()=>{const C=f.get(e);C&&C.key===a&&f.delete(e)}),[f,e]);const j=E.useMemo(()=>({role:g,tabIndex:y,"aria-disabled":i,"aria-pressed":v&&g===cG?!0:void 0,"aria-roledescription":b,"aria-describedby":u.draggable}),[i,g,y,v,b,u.draggable]);return{active:l,activatorEvent:o,activeNodeRect:c,attributes:j,isDragging:v,listeners:i?void 0:R,node:M,over:m,setNodeRef:w,setActivatorNodeRef:T,transform:x}}function g$e(){return E.useContext(WJ)}const x$e="Droppable",v$e={timeout:25};function b$e(t){let{data:e,disabled:n=!1,id:i,resizeObserverConfig:r}=t;const a=bv(x$e),{active:s,dispatch:o,over:l,measureDroppableContainers:c}=E.useContext(_M),u=E.useRef({disabled:n}),f=E.useRef(!1),m=E.useRef(null),g=E.useRef(null),{disabled:b,updateMeasurementsFor:y,timeout:v}={...v$e,...r},x=C0(y??i),M=E.useCallback(()=>{if(!f.current){f.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{c(Array.isArray(x.current)?x.current:[x.current]),g.current=null},v)},[v]),w=yM({callback:M,disabled:b||!s}),A=E.useCallback((j,C)=>{w&&(C&&(w.unobserve(C),f.current=!1),j&&w.observe(j))},[w]),[T,R]=$S(A),N=C0(e);return E.useEffect(()=>{!w||!T.current||(w.disconnect(),f.current=!1,w.observe(T.current))},[T,w]),E.useEffect(()=>(o({type:nr.RegisterDroppable,element:{id:i,key:a,disabled:n,node:T,rect:m,data:N}}),()=>o({type:nr.UnregisterDroppable,key:a,id:i})),[i]),E.useEffect(()=>{n!==u.current.disabled&&(o({type:nr.SetDroppableDisabled,id:i,key:a,disabled:n}),u.current.disabled=n)},[i,a,n,o]),{active:s,rect:m,isOver:l?.id===i,node:T,over:l,setNodeRef:R}}function pL(t,e,n){const i=t.slice();return i.splice(n<0?i.length+n:n,0,i.splice(e,1)[0]),i}function y$e(t,e){return t.reduce((n,i,r)=>{const a=e.get(i);return a&&(n[r]=a),n},Array(t.length))}function l_(t){return t!==null&&t>=0}function _$e(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n{let{rects:e,activeIndex:n,overIndex:i,index:r}=t;const a=pL(e,i,n),s=e[r],o=a[r];return!o||!s?null:{x:o.left-s.left,y:o.top-s.top,scaleX:o.width/s.width,scaleY:o.height/s.height}},XJ="Sortable",KJ=ui.createContext({activeIndex:-1,containerId:XJ,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:mL,disabled:{draggable:!1,droppable:!1}});function w$e(t){let{children:e,id:n,items:i,strategy:r=mL,disabled:a=!1}=t;const{active:s,dragOverlay:o,droppableRects:l,over:c,measureDroppableContainers:u}=g$e(),f=bv(XJ,n),m=o.rect!==null,g=E.useMemo(()=>i.map(R=>typeof R=="object"&&"id"in R?R.id:R),[i]),b=s!=null,y=s?g.indexOf(s.id):-1,v=c?g.indexOf(c.id):-1,x=E.useRef(g),M=!_$e(g,x.current),w=v!==-1&&y===-1||M,A=S$e(a);ll(()=>{M&&b&&u(g)},[M,g,b,u]),E.useEffect(()=>{x.current=g},[g]);const T=E.useMemo(()=>({activeIndex:y,containerId:f,disabled:A,disableTransforms:w,items:g,overIndex:v,useDragOverlay:m,sortedRects:y$e(g,l),strategy:r}),[y,f,A.draggable,A.droppable,w,g,v,l,m,r]);return ui.createElement(KJ.Provider,{value:T},e)}const M$e=t=>{let{id:e,items:n,activeIndex:i,overIndex:r}=t;return pL(n,i,r).indexOf(e)},E$e=t=>{let{containerId:e,isSorting:n,wasDragging:i,index:r,items:a,newIndex:s,previousItems:o,previousContainerId:l,transition:c}=t;return!c||!i||o!==a&&r===s?!1:n?!0:s!==r&&e===l},A$e={duration:200,easing:"ease"},YJ="transform",T$e=R0.Transition.toString({property:YJ,duration:0,easing:"linear"}),C$e={roleDescription:"sortable"};function N$e(t){let{disabled:e,index:n,node:i,rect:r}=t;const[a,s]=E.useState(null),o=E.useRef(n);return ll(()=>{if(!e&&n!==o.current&&i.current){const l=r.current;if(l){const c=Bm(i.current,{ignoreTransform:!0}),u={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(u.x||u.y)&&s(u)}}n!==o.current&&(o.current=n)},[e,n,i,r]),E.useEffect(()=>{a&&s(null)},[a]),a}function R$e(t){let{animateLayoutChanges:e=E$e,attributes:n,disabled:i,data:r,getNewIndex:a=M$e,id:s,strategy:o,resizeObserverConfig:l,transition:c=A$e}=t;const{items:u,containerId:f,activeIndex:m,disabled:g,disableTransforms:b,sortedRects:y,overIndex:v,useDragOverlay:x,strategy:M}=E.useContext(KJ),w=P$e(i,g),A=u.indexOf(s),T=E.useMemo(()=>({sortable:{containerId:f,index:A,items:u},...r}),[f,r,A,u]),R=E.useMemo(()=>u.slice(u.indexOf(s)),[u,s]),{rect:N,node:j,isOver:C,setNodeRef:k}=b$e({id:s,data:T,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:R,...l}}),{active:F,activatorEvent:I,activeNodeRect:G,attributes:O,setNodeRef:B,listeners:$,isDragging:V,over:K,setActivatorNodeRef:Y,transform:se}=m$e({id:s,data:T,attributes:{...C$e,...n},disabled:w.draggable}),H=YHe(k,B),X=!!F,ae=X&&!b&&l_(m)&&l_(v),le=!x&&V,de=le&&ae?se:null,xe=ae?de??(o??M)({rects:y,activeNodeRect:G,activeIndex:m,overIndex:v,index:A}):null,Re=l_(m)&&l_(v)?a({id:s,items:u,activeIndex:m,overIndex:v}):A,pe=F?.id,Me=E.useRef({activeId:pe,items:u,newIndex:Re,containerId:f}),Ie=u!==Me.current.items,ce=e({active:F,containerId:f,isDragging:V,isSorting:X,id:s,index:A,items:u,newIndex:Me.current.newIndex,previousItems:Me.current.items,previousContainerId:Me.current.containerId,transition:c,wasDragging:Me.current.activeId!=null}),dt=N$e({disabled:!ce,index:A,node:j,rect:N});return E.useEffect(()=>{X&&Me.current.newIndex!==Re&&(Me.current.newIndex=Re),f!==Me.current.containerId&&(Me.current.containerId=f),u!==Me.current.items&&(Me.current.items=u)},[X,Re,f,u]),E.useEffect(()=>{if(pe===Me.current.activeId)return;if(pe!=null&&Me.current.activeId==null){Me.current.activeId=pe;return}const q=setTimeout(()=>{Me.current.activeId=pe},50);return()=>clearTimeout(q)},[pe]),{active:F,activeIndex:m,attributes:O,data:T,rect:N,index:A,newIndex:Re,items:u,isOver:C,isSorting:X,isDragging:V,listeners:$,node:j,overIndex:v,over:K,setNodeRef:H,setActivatorNodeRef:Y,setDroppableNodeRef:k,setDraggableNodeRef:B,transform:dt??xe,transition:z()};function z(){if(dt||Ie&&Me.current.newIndex===A)return T$e;if(!(le&&!cL(I)||!c)&&(X||ce))return R0.Transition.toString({...c,property:YJ})}}function P$e(t,e){var n,i;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(n=t?.draggable)!=null?n:e.draggable,droppable:(i=t?.droppable)!=null?i:e.droppable}}function WS(t){if(!t)return!1;const e=t.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}const k$e=[_n.Down,_n.Right,_n.Up,_n.Left],D$e=(t,e)=>{let{context:{active:n,collisionRect:i,droppableRects:r,droppableContainers:a,over:s,scrollableAncestors:o}}=e;if(k$e.includes(t.code)){if(t.preventDefault(),!n||!i)return;const l=[];a.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const m=r.get(f.id);if(m)switch(t.code){case _n.Down:i.topm.top&&l.push(f);break;case _n.Left:i.left>m.left&&l.push(f);break;case _n.Right:i.left1&&(u=c[1].id),u!=null){const f=a.get(n.id),m=a.get(u),g=m?r.get(m.id):null,b=m?.node.current;if(b&&g&&f&&m){const v=bM(b).some((R,N)=>o[N]!==R),x=ZJ(f,m),M=O$e(f,m),w=v||!x?{x:0,y:0}:{x:M?i.width-g.width:0,y:M?i.height-g.height:0},A={x:g.left,y:g.top};return w.x&&w.y?A:N0(A,w)}}}};function ZJ(t,e){return!WS(t)||!WS(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function O$e(t,e){return!WS(t)||!WS(e)||!ZJ(t,e)?!1:t.data.current.sortable.index{const v={};return t.forEach(x=>{v[x.id]=x.defaultSize||4}),v},[r,a]=E.useState(()=>{const v=localStorage.getItem(e);if(v)try{const x=JSON.parse(v);return x.sizes||(x.sizes=i()),x}catch{}return{order:t.map(x=>x.id),hidden:t.filter(x=>x.defaultVisible===!1).map(x=>x.id),sizes:i()}}),[s,o]=E.useState(!1);E.useEffect(()=>{localStorage.setItem(e,JSON.stringify(r))},[r,e]),E.useEffect(()=>{const x=t.map(M=>M.id).filter(M=>!r.order.includes(M));x.length>0&&a(M=>({...M,order:[...M.order,...x]}))},[t,r.order]);const l=u8e(ZV(hL,{activationConstraint:{distance:8}}),ZV(dL,{coordinateGetter:D$e})),c=v=>{const{active:x,over:M}=v;M&&x.id!==M.id&&a(w=>{const A=w.order.indexOf(x.id),T=w.order.indexOf(M.id);return{...w,order:pL(w.order,A,T)}})},u=v=>{a(x=>({...x,hidden:x.hidden.includes(v)?x.hidden.filter(M=>M!==v):[...x.hidden,v]}))},f=v=>{a(x=>{const M=x.sizes[v]||4,w=M===1?2:M===2?4:1;return{...x,sizes:{...x.sizes,[v]:w}}})},m=()=>{const v={order:t.map(x=>x.id),hidden:t.filter(x=>x.defaultVisible===!1).map(x=>x.id),sizes:i()};a(v)},g=r.order.map(v=>t.find(x=>x.id===v)).filter(Boolean),b=g.filter(v=>!r.hidden.includes(v.id)),y=g.filter(v=>r.hidden.includes(v.id));return h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"flex items-center justify-end gap-2",children:[y.length>0&&h.jsxs(lt,{variant:"secondary",size:"sm",onClick:()=>o(!s),children:[h.jsx(KU,{className:"w-4 h-4"}),y.length," Hidden"]}),h.jsxs(lt,{variant:"secondary",size:"sm",onClick:m,children:[h.jsx(nw,{className:"w-4 h-4"}),"Reset Layout"]})]}),s&&y.length>0&&h.jsxs("div",{className:"p-4 bg-bambu-dark rounded-xl border border-bambu-dark-tertiary",children:[h.jsx("p",{className:"text-sm text-bambu-gray mb-3",children:"Hidden widgets (click to show):"}),h.jsx("div",{className:"flex flex-wrap gap-2",children:y.map(v=>h.jsxs("button",{onClick:()=>u(v.id),className:"px-3 py-1.5 bg-bambu-dark-tertiary hover:bg-bambu-green/20 rounded-lg text-sm text-white transition-colors flex items-center gap-2",children:[h.jsx(KU,{className:"w-3 h-3"}),v.title]},v.id))})]}),h.jsx(f$e,{sensors:l,collisionDetection:f8e,onDragEnd:c,children:h.jsx(w$e,{items:b.map(v=>v.id),strategy:mL,children:h.jsx("div",{className:"grid gap-6",style:{gridTemplateColumns:`repeat(${n}, minmax(0, 1fr))`},children:b.map(v=>h.jsx(L$e,{id:v.id,title:v.title,isHidden:r.hidden.includes(v.id),size:r.sizes[v.id]||2,onToggleVisibility:()=>u(v.id),onToggleSize:()=>f(v.id),children:v.component},v.id))})})}),b.length===0&&h.jsxs("div",{className:"text-center py-12 text-bambu-gray",children:[h.jsx("p",{children:"All widgets are hidden."}),h.jsx(lt,{className:"mt-4",onClick:m,children:"Reset Layout"})]})]})}function j$e({stats:t,currency:e}){return h.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[h.jsxs("div",{className:"flex items-start gap-3",children:[h.jsx("div",{className:"p-2 rounded-lg bg-bambu-dark text-bambu-green",children:h.jsx(W_,{className:"w-5 h-5"})}),h.jsxs("div",{children:[h.jsx("p",{className:"text-xs text-bambu-gray",children:"Total Prints"}),h.jsx("p",{className:"text-xl font-bold text-white",children:t?.total_prints||0})]})]}),h.jsxs("div",{className:"flex items-start gap-3",children:[h.jsx("div",{className:"p-2 rounded-lg bg-bambu-dark text-blue-400",children:h.jsx(ba,{className:"w-5 h-5"})}),h.jsxs("div",{children:[h.jsx("p",{className:"text-xs text-bambu-gray",children:"Print Time"}),h.jsxs("p",{className:"text-xl font-bold text-white",children:[t?.total_print_time_hours.toFixed(1)||0,"h"]})]})]}),h.jsxs("div",{className:"flex items-start gap-3",children:[h.jsx("div",{className:"p-2 rounded-lg bg-bambu-dark text-orange-400",children:h.jsx(W_,{className:"w-5 h-5"})}),h.jsxs("div",{children:[h.jsx("p",{className:"text-xs text-bambu-gray",children:"Filament Used"}),h.jsxs("p",{className:"text-xl font-bold text-white",children:[((t?.total_filament_grams||0)/1e3).toFixed(2),"kg"]})]})]}),h.jsxs("div",{className:"flex items-start gap-3",children:[h.jsx("div",{className:"p-2 rounded-lg bg-bambu-dark text-green-400",children:h.jsx(XU,{className:"w-5 h-5"})}),h.jsxs("div",{children:[h.jsx("p",{className:"text-xs text-bambu-gray",children:"Filament Cost"}),h.jsxs("p",{className:"text-xl font-bold text-white",children:[e," ",t?.total_cost.toFixed(2)||"0.00"]})]})]}),h.jsxs("div",{className:"flex items-start gap-3",children:[h.jsx("div",{className:"p-2 rounded-lg bg-bambu-dark text-yellow-400",children:h.jsx(x9,{className:"w-5 h-5"})}),h.jsxs("div",{children:[h.jsx("p",{className:"text-xs text-bambu-gray",children:"Energy Used"}),h.jsxs("p",{className:"text-xl font-bold text-white",children:[t?.total_energy_kwh.toFixed(2)||"0.00"," kWh"]})]})]}),h.jsxs("div",{className:"flex items-start gap-3",children:[h.jsx("div",{className:"p-2 rounded-lg bg-bambu-dark text-yellow-500",children:h.jsx(XU,{className:"w-5 h-5"})}),h.jsxs("div",{children:[h.jsx("p",{className:"text-xs text-bambu-gray",children:"Energy Cost"}),h.jsxs("p",{className:"text-xl font-bold text-white",children:[e," ",t?.total_energy_cost.toFixed(2)||"0.00"]})]})]})]})}function U$e({stats:t}){const e=t?.total_prints?Math.round(t.successful_prints/t.total_prints*100):0;return h.jsxs("div",{className:"flex items-center gap-6",children:[h.jsxs("div",{className:"relative w-28 h-28",children:[h.jsxs("svg",{className:"w-full h-full -rotate-90",children:[h.jsx("circle",{cx:"56",cy:"56",r:"48",fill:"none",stroke:"#3d3d3d",strokeWidth:"10"}),h.jsx("circle",{cx:"56",cy:"56",r:"48",fill:"none",stroke:"#00ae42",strokeWidth:"10",strokeLinecap:"round",strokeDasharray:`${e*3.02} 302`})]}),h.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:h.jsxs("span",{className:"text-xl font-bold text-white",children:[e,"%"]})})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(ld,{className:"w-4 h-4 text-bambu-green"}),h.jsx("span",{className:"text-sm text-bambu-gray",children:"Successful:"}),h.jsx("span",{className:"text-sm text-white font-medium",children:t?.successful_prints||0})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(L0,{className:"w-4 h-4 text-red-400"}),h.jsx("span",{className:"text-sm text-bambu-gray",children:"Failed:"}),h.jsx("span",{className:"text-sm text-white font-medium",children:t?.failed_prints||0})]})]})]})}function F$e({stats:t,printerMap:e}){const n=t?.average_time_accuracy;if(n==null)return h.jsx("div",{className:"flex items-center justify-center h-full",children:h.jsx("p",{className:"text-bambu-gray text-center py-4",children:"No time accuracy data yet"})});const r=(Math.min(150,Math.max(50,n))-50)/100*100,s=(l=>l>=95&&l<=105?"#00ae42":l>105?"#3b82f6":"#f97316")(n),o=n-100;return h.jsxs("div",{className:"flex items-center gap-6",children:[h.jsxs("div",{className:"relative w-28 h-28",children:[h.jsxs("svg",{className:"w-full h-full -rotate-90",children:[h.jsx("circle",{cx:"56",cy:"56",r:"48",fill:"none",stroke:"#3d3d3d",strokeWidth:"10"}),h.jsx("circle",{cx:"56",cy:"56",r:"48",fill:"none",stroke:s,strokeWidth:"10",strokeLinecap:"round",strokeDasharray:`${r*3.02} 302`})]}),h.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[h.jsxs("span",{className:"text-xl font-bold text-white",children:[n.toFixed(0),"%"]}),h.jsxs("span",{className:`text-xs ${o>=0?"text-blue-400":"text-orange-400"}`,children:[o>=0?"+":"",o.toFixed(0),"%"]})]})]}),h.jsxs("div",{className:"space-y-2 flex-1",children:[h.jsxs("div",{className:"flex items-center gap-2 text-xs text-bambu-gray",children:[h.jsx(ole,{className:"w-3 h-3"}),h.jsx("span",{children:"100% = perfect estimate"})]}),t?.time_accuracy_by_printer&&Object.keys(t.time_accuracy_by_printer).length>0&&h.jsx("div",{className:"space-y-1 mt-2",children:Object.entries(t.time_accuracy_by_printer).slice(0,3).map(([l,c])=>h.jsxs("div",{className:"flex items-center justify-between text-xs",children:[h.jsx("span",{className:"text-bambu-gray truncate max-w-[100px]",children:e.get(l)||`Printer ${l}`}),h.jsxs("span",{className:`font-medium ${c>=95&&c<=105?"text-bambu-green":c>105?"text-blue-400":"text-orange-400"}`,children:[c.toFixed(0),"%"]})]},l))})]})]})}function z$e({stats:t}){if(!t?.prints_by_filament_type||Object.keys(t.prints_by_filament_type).length===0)return h.jsx("p",{className:"text-bambu-gray text-center py-4",children:"No filament data available"});const e=Object.entries(t.prints_by_filament_type).sort(([,n],[,i])=>i-n);return h.jsx("div",{className:"space-y-3",children:e.map(([n,i])=>{const r=Math.round(i/(t.total_prints||1)*100);return h.jsxs("div",{children:[h.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[h.jsx("span",{className:"text-white",children:n}),h.jsxs("span",{className:"text-bambu-gray",children:[i," prints"]})]}),h.jsx("div",{className:"h-2 bg-bambu-dark rounded-full",children:h.jsx("div",{className:"h-full bg-bambu-green rounded-full transition-all",style:{width:`${r}%`}})})]},n)})})}function B$e({printDates:t}){return h.jsx(H2e,{printDates:t,months:4})}function H$e({stats:t,printerMap:e}){return!t?.prints_by_printer||Object.keys(t.prints_by_printer).length===0?h.jsx("p",{className:"text-bambu-gray text-center py-4",children:"No printer data available"}):h.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:Object.entries(t.prints_by_printer).map(([n,i])=>h.jsxs("div",{className:"flex items-center gap-3 p-3 bg-bambu-dark rounded-lg",children:[h.jsx("div",{className:"p-2 bg-bambu-dark-tertiary rounded-lg",children:h.jsx(mc,{className:"w-4 h-4 text-bambu-green"})}),h.jsxs("div",{children:[h.jsx("p",{className:"text-white font-medium text-sm",children:e.get(n)||`Printer ${n}`}),h.jsxs("p",{className:"text-xs text-bambu-gray",children:[i," prints"]})]})]},n))})}function $$e({archives:t,currency:e}){return!t||t.length===0?h.jsx("p",{className:"text-bambu-gray text-center py-4",children:"No print data available"}):h.jsx(KHe,{archives:t,currency:e})}function V$e(){const{data:t,isLoading:e}=Ft({queryKey:["archiveStats"],queryFn:Fe.getArchiveStats}),{data:n}=Ft({queryKey:["printers"],queryFn:Fe.getPrinters}),{data:i}=Ft({queryKey:["archives"],queryFn:()=>Fe.getArchives(void 0,1e3,0)}),{data:r}=Ft({queryKey:["settings"],queryFn:Fe.getSettings}),a=r?.currency||"$",s=new Map(n?.map(c=>[String(c.id),c.name])||[]),o=i?.map(c=>c.created_at)||[];if(e)return h.jsx("div",{className:"p-8",children:h.jsx("div",{className:"text-center py-12 text-bambu-gray",children:"Loading statistics..."})});const l=[{id:"quick-stats",title:"Quick Stats",component:h.jsx(j$e,{stats:t,currency:a}),defaultSize:2},{id:"success-rate",title:"Success Rate",component:h.jsx(U$e,{stats:t}),defaultSize:1},{id:"time-accuracy",title:"Time Accuracy",component:h.jsx(F$e,{stats:t,printerMap:s}),defaultSize:1},{id:"filament-types",title:"Filament Types",component:h.jsx(z$e,{stats:t}),defaultSize:1},{id:"print-activity",title:"Print Activity",component:h.jsx(B$e,{printDates:o}),defaultSize:2},{id:"prints-by-printer",title:"Prints by Printer",component:h.jsx(H$e,{stats:t,printerMap:s}),defaultSize:2},{id:"filament-trends",title:"Filament Usage Trends",component:h.jsx($$e,{archives:i||[],currency:a}),defaultSize:4}];return h.jsxs("div",{className:"p-8",children:[h.jsxs("div",{className:"mb-6",children:[h.jsx("h1",{className:"text-2xl font-bold text-white",children:"Dashboard"}),h.jsx("p",{className:"text-bambu-gray",children:"Drag widgets to rearrange. Click the eye icon to hide."})]}),h.jsx(I$e,{widgets:l,storageKey:"bambusy-dashboard-layout"})]})}function G$e({plug:t,onEdit:e}){const n=Rn(),[i,r]=E.useState(!1),[a,s]=E.useState(!1),[o,l]=E.useState(!1),[c,u]=E.useState(!1),{data:f,isLoading:m,refetch:g}=Ft({queryKey:["smart-plug-status",t.id],queryFn:()=>Fe.getSmartPlugStatus(t.id),refetchInterval:3e4}),{data:b}=Ft({queryKey:["printers"],queryFn:Fe.getPrinters}),y=b?.find(R=>R.id===t.printer_id),v=yt({mutationFn:R=>Fe.controlSmartPlug(t.id,R),onSuccess:()=>{g()}}),x=yt({mutationFn:R=>Fe.updateSmartPlug(t.id,R),onSuccess:()=>{n.invalidateQueries({queryKey:["smart-plugs"]}),t.printer_id&&n.invalidateQueries({queryKey:["smartPlugByPrinter",t.printer_id]})}}),M=yt({mutationFn:()=>Fe.deleteSmartPlug(t.id),onSuccess:()=>{n.invalidateQueries({queryKey:["smart-plugs"]})}}),w=f?.state==="ON",A=f?.reachable??!1,T=v.isPending;return h.jsxs(h.Fragment,{children:[h.jsx(Xt,{className:"relative",children:h.jsxs(en,{className:"p-4",children:[h.jsxs("div",{className:"flex items-start justify-between mb-3",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:`p-2 rounded-lg ${A?w?"bg-bambu-green/20":"bg-bambu-dark":"bg-red-500/20"}`,children:h.jsx(IN,{className:`w-5 h-5 ${A?w?"text-bambu-green":"text-bambu-gray":"text-red-400"}`})}),h.jsxs("div",{children:[h.jsx("h3",{className:"font-medium text-white",children:t.name}),h.jsx("p",{className:"text-sm text-bambu-gray",children:t.ip_address})]})]}),h.jsx("div",{className:"flex items-center gap-2",children:m?h.jsx(It,{className:"w-4 h-4 text-bambu-gray animate-spin"}):A?h.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[h.jsx(GP,{className:"w-4 h-4 text-bambu-green"}),h.jsx("span",{className:w?"text-bambu-green":"text-bambu-gray",children:f?.state||"Unknown"})]}):h.jsxs("div",{className:"flex items-center gap-1 text-sm text-red-400",children:[h.jsx(Vp,{className:"w-4 h-4"}),h.jsx("span",{children:"Offline"})]})})]}),y&&h.jsxs("div",{className:"mb-3 px-2 py-1.5 bg-bambu-dark rounded-lg",children:[h.jsx("span",{className:"text-xs text-bambu-gray",children:"Linked to: "}),h.jsx("span",{className:"text-sm text-white",children:y.name})]}),h.jsxs("div",{className:"flex gap-2 mb-3",children:[h.jsxs(lt,{size:"sm",variant:w?"primary":"secondary",disabled:!A||T,onClick:()=>s(!0),className:"flex-1",children:[T?h.jsx(It,{className:"w-4 h-4 animate-spin"}):h.jsx(tw,{className:"w-4 h-4"}),"On"]}),h.jsxs(lt,{size:"sm",variant:w?"secondary":"primary",disabled:!A||T,onClick:()=>l(!0),className:"flex-1",children:[T?h.jsx(It,{className:"w-4 h-4 animate-spin"}):h.jsx(h9,{className:"w-4 h-4"}),"Off"]})]}),h.jsxs("button",{onClick:()=>u(!c),className:"w-full flex items-center justify-between py-2 text-sm text-bambu-gray hover:text-white transition-colors",children:[h.jsxs("span",{className:"flex items-center gap-2",children:[h.jsx(VP,{className:"w-4 h-4"}),"Automation Settings"]}),h.jsx("span",{children:c?"-":"+"})]}),c&&h.jsxs("div",{className:"pt-3 border-t border-bambu-dark-tertiary space-y-4",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{children:[h.jsx("p",{className:"text-sm text-white",children:"Enabled"}),h.jsx("p",{className:"text-xs text-bambu-gray",children:"Enable automation for this plug"})]}),h.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[h.jsx("input",{type:"checkbox",checked:t.enabled,onChange:R=>x.mutate({enabled:R.target.checked}),className:"sr-only peer"}),h.jsx("div",{className:"w-9 h-5 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-bambu-green"})]})]}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{children:[h.jsx("p",{className:"text-sm text-white",children:"Auto On"}),h.jsx("p",{className:"text-xs text-bambu-gray",children:"Turn on when print starts"})]}),h.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[h.jsx("input",{type:"checkbox",checked:t.auto_on,onChange:R=>x.mutate({auto_on:R.target.checked}),className:"sr-only peer"}),h.jsx("div",{className:"w-9 h-5 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-bambu-green"})]})]}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{children:[h.jsx("p",{className:"text-sm text-white",children:"Auto Off"}),h.jsx("p",{className:"text-xs text-bambu-gray",children:"Turn off when print completes (one-shot)"})]}),h.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[h.jsx("input",{type:"checkbox",checked:t.auto_off,onChange:R=>x.mutate({auto_off:R.target.checked}),className:"sr-only peer"}),h.jsx("div",{className:"w-9 h-5 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-bambu-green"})]})]}),t.auto_off&&h.jsxs("div",{className:"space-y-3 pl-4 border-l-2 border-bambu-dark-tertiary",children:[h.jsxs("div",{children:[h.jsx("p",{className:"text-sm text-white mb-2",children:"Turn Off Delay Mode"}),h.jsxs("div",{className:"flex gap-2",children:[h.jsxs("button",{onClick:()=>x.mutate({off_delay_mode:"time"}),className:`flex-1 flex items-center justify-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors ${t.off_delay_mode==="time"?"bg-bambu-green text-white":"bg-bambu-dark text-bambu-gray hover:text-white"}`,children:[h.jsx(ba,{className:"w-4 h-4"}),"Time"]}),h.jsxs("button",{onClick:()=>x.mutate({off_delay_mode:"temperature"}),className:`flex-1 flex items-center justify-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors ${t.off_delay_mode==="temperature"?"bg-bambu-green text-white":"bg-bambu-dark text-bambu-gray hover:text-white"}`,children:[h.jsx(p_,{className:"w-4 h-4"}),"Temp"]})]})]}),t.off_delay_mode==="time"?h.jsxs("div",{children:[h.jsx("label",{className:"block text-xs text-bambu-gray mb-1",children:"Delay (minutes)"}),h.jsx("input",{type:"number",min:"1",max:"60",value:t.off_delay_minutes,onChange:R=>x.mutate({off_delay_minutes:parseInt(R.target.value)||5}),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:border-bambu-green focus:outline-none"})]}):h.jsxs("div",{children:[h.jsx("label",{className:"block text-xs text-bambu-gray mb-1",children:"Temperature threshold (C)"}),h.jsx("input",{type:"number",min:"30",max:"100",value:t.off_temp_threshold,onChange:R=>x.mutate({off_temp_threshold:parseInt(R.target.value)||70}),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:border-bambu-green focus:outline-none"}),h.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:"Turns off when nozzle cools below this temperature"})]})]}),h.jsxs("div",{className:"flex gap-2 pt-2",children:[h.jsxs(lt,{size:"sm",variant:"secondary",onClick:()=>e(t),className:"flex-1",children:[h.jsx(f9,{className:"w-4 h-4"}),"Edit"]}),h.jsx(lt,{size:"sm",variant:"secondary",onClick:()=>r(!0),className:"text-red-400 hover:text-red-300",children:h.jsx(aa,{className:"w-4 h-4"})})]})]})]})}),i&&h.jsx(rr,{title:"Delete Smart Plug",message:`Are you sure you want to delete "${t.name}"? This cannot be undone.`,confirmText:"Delete",variant:"danger",onConfirm:()=>{M.mutate(),r(!1)},onCancel:()=>r(!1)}),a&&h.jsx(rr,{title:"Turn On Smart Plug",message:`Are you sure you want to turn on "${t.name}"?`,confirmText:"Turn On",variant:"default",onConfirm:()=>{v.mutate("on"),s(!1)},onCancel:()=>s(!1)}),o&&h.jsx(rr,{title:"Turn Off Smart Plug",message:`Are you sure you want to turn off "${t.name}"? This will cut power to the connected device.`,confirmText:"Turn Off",variant:"danger",onConfirm:()=>{v.mutate("off"),l(!1)},onCancel:()=>l(!1)})]})}function W$e({plug:t,onClose:e}){const n=Rn(),i=!!t,[r,a]=E.useState(t?.name||""),[s,o]=E.useState(t?.ip_address||""),[l,c]=E.useState(t?.username||""),[u,f]=E.useState(t?.password||""),[m,g]=E.useState(t?.printer_id||null),[b,y]=E.useState(null),[v,x]=E.useState(null),{data:M}=Ft({queryKey:["printers"],queryFn:Fe.getPrinters}),{data:w}=Ft({queryKey:["smart-plugs"],queryFn:Fe.getSmartPlugs});E.useEffect(()=>{const k=F=>{F.key==="Escape"&&e()};return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[e]);const A=yt({mutationFn:()=>Fe.testSmartPlugConnection(s,l||null,u||null),onSuccess:k=>{y(k),x(null),!r&&k.device_name&&a(k.device_name)},onError:k=>{y(null),x(k.message)}}),T=yt({mutationFn:k=>Fe.createSmartPlug(k),onSuccess:()=>{n.invalidateQueries({queryKey:["smart-plugs"]}),e()},onError:k=>{x(k.message)}}),R=yt({mutationFn:k=>Fe.updateSmartPlug(t.id,k),onSuccess:()=>{n.invalidateQueries({queryKey:["smart-plugs"]}),e()},onError:k=>{x(k.message)}}),N=M?.filter(k=>!w?.some(I=>I.printer_id===k.id&&I.id!==t?.id)),j=k=>{if(k.preventDefault(),x(null),!r.trim()){x("Name is required");return}if(!s.trim()){x("IP address is required");return}const F={name:r.trim(),ip_address:s.trim(),username:l.trim()||null,password:u.trim()||null,printer_id:m};i?R.mutate(F):T.mutate(F)},C=T.isPending||R.isPending;return h.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",onClick:e,children:h.jsxs("div",{className:"bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary w-full max-w-md",onClick:k=>k.stopPropagation(),children:[h.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary",children:[h.jsx("h2",{className:"text-lg font-semibold text-white",children:i?"Edit Smart Plug":"Add Smart Plug"}),h.jsx("button",{onClick:e,className:"text-bambu-gray hover:text-white transition-colors",children:h.jsx(fn,{className:"w-5 h-5"})})]}),h.jsxs("form",{onSubmit:j,className:"p-6 space-y-4",children:[v&&h.jsx("div",{className:"p-3 bg-red-500/20 border border-red-500/50 rounded-lg text-sm text-red-400",children:v}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"IP Address *"}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx("input",{type:"text",value:s,onChange:k=>{o(k.target.value),y(null)},placeholder:"192.168.1.100",className:"flex-1 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none"}),h.jsxs(lt,{type:"button",variant:"secondary",onClick:()=>A.mutate(),disabled:!s.trim()||A.isPending,children:[A.isPending?h.jsx(It,{className:"w-4 h-4 animate-spin"}):h.jsx(GP,{className:"w-4 h-4"}),"Test"]})]})]}),b&&h.jsx("div",{className:`p-3 rounded-lg flex items-center gap-2 ${b.success?"bg-bambu-green/20 border border-bambu-green/50 text-bambu-green":"bg-red-500/20 border border-red-500/50 text-red-400"}`,children:b.success?h.jsxs(h.Fragment,{children:[h.jsx(ld,{className:"w-5 h-5"}),h.jsxs("div",{children:[h.jsx("p",{className:"font-medium",children:"Connected!"}),h.jsxs("p",{className:"text-sm opacity-80",children:[b.device_name&&`Device: ${b.device_name} - `,"State: ",b.state]})]})]}):h.jsxs(h.Fragment,{children:[h.jsx(Vp,{className:"w-5 h-5"}),h.jsx("span",{children:"Connection failed"})]})}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Name *"}),h.jsx("input",{type:"text",value:r,onChange:k=>a(k.target.value),placeholder:"Living Room Plug",className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none"})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Username"}),h.jsx("input",{type:"text",value:l,onChange:k=>c(k.target.value),placeholder:"admin",className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Password"}),h.jsx("input",{type:"password",value:u,onChange:k=>f(k.target.value),placeholder:"********",className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none"})]})]}),h.jsx("p",{className:"text-xs text-bambu-gray -mt-2",children:"Leave empty if your Tasmota device doesn't require authentication"}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Link to Printer"}),h.jsxs("select",{value:m??"",onChange:k=>g(k.target.value?Number(k.target.value):null),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",children:[h.jsx("option",{value:"",children:"No printer (manual control only)"}),N?.map(k=>h.jsx("option",{value:k.id,children:k.name},k.id))]}),h.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:"Linking enables automatic on/off when prints start/complete"})]}),h.jsxs("div",{className:"flex gap-3 pt-2",children:[h.jsx(lt,{type:"button",variant:"secondary",onClick:e,className:"flex-1",children:"Cancel"}),h.jsxs(lt,{type:"submit",disabled:C,className:"flex-1",children:[C?h.jsx(It,{className:"w-4 h-4 animate-spin"}):h.jsx(I0,{className:"w-4 h-4"}),i?"Save":"Add"]})]})]})]})})}function as({checked:t,onChange:e,disabled:n}){const i=r=>{r.preventDefault(),r.stopPropagation(),n||e(!t)};return h.jsx("button",{type:"button",role:"switch","aria-checked":t,disabled:n,onClick:i,className:`relative inline-flex w-9 h-5 rounded-full transition-colors flex-shrink-0 focus:outline-none focus:ring-2 focus:ring-bambu-green focus:ring-offset-2 focus:ring-offset-bambu-dark ${n?"bg-bambu-dark-tertiary/50 cursor-not-allowed opacity-50":t?"bg-bambu-green cursor-pointer":"bg-bambu-dark-tertiary cursor-pointer hover:bg-bambu-dark-tertiary/80"}`,children:h.jsx("span",{className:`pointer-events-none absolute top-[2px] left-[2px] w-4 h-4 bg-white rounded-full shadow transition-transform duration-200 ease-in-out ${t?"translate-x-4":"translate-x-0"}`})})}const q$e={callmebot:"CallMeBot/WhatsApp",ntfy:"ntfy",pushover:"Pushover",telegram:"Telegram",email:"Email"};function X$e({provider:t,onEdit:e}){const n=Rn(),[i,r]=E.useState(!1),[a,s]=E.useState(!1),[o,l]=E.useState(null),{data:c}=Ft({queryKey:["printers"],queryFn:Fe.getPrinters}),u=c?.find(y=>y.id===t.printer_id),f=yt({mutationFn:y=>Fe.updateNotificationProvider(t.id,y),onSuccess:()=>{n.invalidateQueries({queryKey:["notification-providers"]})}}),m=yt({mutationFn:()=>Fe.deleteNotificationProvider(t.id),onSuccess:()=>{n.invalidateQueries({queryKey:["notification-providers"]})}}),g=yt({mutationFn:()=>Fe.testNotificationProvider(t.id),onSuccess:y=>{l(y),n.invalidateQueries({queryKey:["notification-providers"]})},onError:y=>{l({success:!1,message:y.message})}}),b=y=>y||"";return h.jsxs(h.Fragment,{children:[h.jsx(Xt,{className:"relative",children:h.jsxs(en,{className:"p-4",children:[h.jsxs("div",{className:"flex items-start justify-between mb-3",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:`p-2 rounded-lg ${t.enabled?"bg-bambu-green/20":"bg-bambu-dark"}`,children:h.jsx(DN,{className:`w-5 h-5 ${t.enabled?"text-bambu-green":"text-bambu-gray"}`})}),h.jsxs("div",{children:[h.jsx("h3",{className:"font-medium text-white",children:t.name}),h.jsx("p",{className:"text-sm text-bambu-gray",children:q$e[t.provider_type]||t.provider_type})]})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[t.last_success&&h.jsxs("span",{className:"text-xs text-bambu-green",children:["Last sent: ",new Date(t.last_success).toLocaleDateString()]}),t.last_error&&h.jsx("span",{className:"text-xs text-red-400",title:t.last_error,children:"Error"})]})]}),u&&h.jsxs("div",{className:"mb-3 px-2 py-1.5 bg-bambu-dark rounded-lg",children:[h.jsx("span",{className:"text-xs text-bambu-gray",children:"Printer: "}),h.jsx("span",{className:"text-sm text-white",children:u.name})]}),!u&&!t.printer_id&&h.jsx("div",{className:"mb-3 px-2 py-1.5 bg-bambu-dark rounded-lg",children:h.jsx("span",{className:"text-xs text-bambu-gray",children:"All printers"})}),h.jsxs("div",{className:"mb-3 flex flex-wrap gap-1",children:[t.on_print_start&&h.jsx("span",{className:"px-2 py-0.5 bg-blue-500/20 text-blue-400 text-xs rounded",children:"Start"}),t.on_print_complete&&h.jsx("span",{className:"px-2 py-0.5 bg-bambu-green/20 text-bambu-green text-xs rounded",children:"Complete"}),t.on_print_failed&&h.jsx("span",{className:"px-2 py-0.5 bg-red-500/20 text-red-400 text-xs rounded",children:"Failed"}),t.on_print_stopped&&h.jsx("span",{className:"px-2 py-0.5 bg-orange-500/20 text-orange-400 text-xs rounded",children:"Stopped"}),t.on_print_progress&&h.jsx("span",{className:"px-2 py-0.5 bg-yellow-500/20 text-yellow-400 text-xs rounded",children:"Progress"}),t.on_printer_offline&&h.jsx("span",{className:"px-2 py-0.5 bg-gray-500/20 text-gray-400 text-xs rounded",children:"Offline"}),t.on_printer_error&&h.jsx("span",{className:"px-2 py-0.5 bg-orange-500/20 text-orange-400 text-xs rounded",children:"Error"}),t.on_filament_low&&h.jsx("span",{className:"px-2 py-0.5 bg-amber-500/20 text-amber-400 text-xs rounded",children:"Low Filament"}),t.on_maintenance_due&&h.jsx("span",{className:"px-2 py-0.5 bg-purple-500/20 text-purple-400 text-xs rounded",children:"Maintenance"}),t.quiet_hours_enabled&&h.jsxs("span",{className:"px-2 py-0.5 bg-purple-500/20 text-purple-400 text-xs rounded flex items-center gap-1",children:[h.jsx(G_,{className:"w-3 h-3"}),"Quiet"]})]}),h.jsx("div",{className:"mb-3",children:h.jsxs(lt,{size:"sm",variant:"secondary",disabled:g.isPending,onClick:()=>{l(null),g.mutate()},className:"w-full",children:[g.isPending?h.jsx(It,{className:"w-4 h-4 animate-spin"}):h.jsx(p9,{className:"w-4 h-4"}),"Send Test Notification"]})}),o&&h.jsxs("div",{className:`mb-3 p-2 rounded-lg flex items-center gap-2 text-sm ${o.success?"bg-bambu-green/20 text-bambu-green":"bg-red-500/20 text-red-400"}`,children:[o.success?h.jsx(ld,{className:"w-4 h-4"}):h.jsx(L0,{className:"w-4 h-4"}),h.jsx("span",{children:o.message})]}),h.jsxs("button",{onClick:()=>s(!a),className:"w-full flex items-center justify-between py-2 text-sm text-bambu-gray hover:text-white transition-colors border-t border-bambu-dark-tertiary",children:[h.jsxs("span",{className:"flex items-center gap-2",children:[h.jsx(VP,{className:"w-4 h-4"}),"Event Settings"]}),a?h.jsx(QS,{className:"w-4 h-4"}):h.jsx(Gf,{className:"w-4 h-4"})]}),a&&h.jsxs("div",{className:"pt-3 border-t border-bambu-dark-tertiary space-y-4",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{children:[h.jsx("p",{className:"text-sm text-white",children:"Enabled"}),h.jsx("p",{className:"text-xs text-bambu-gray",children:"Send notifications from this provider"})]}),h.jsx(as,{checked:t.enabled,onChange:y=>f.mutate({enabled:y})})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx("p",{className:"text-xs text-bambu-gray uppercase tracking-wide",children:"Print Events"}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("p",{className:"text-sm text-white",children:"Print Started"}),h.jsx(as,{checked:t.on_print_start,onChange:y=>f.mutate({on_print_start:y})})]}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("p",{className:"text-sm text-white",children:"Print Completed"}),h.jsx(as,{checked:t.on_print_complete,onChange:y=>f.mutate({on_print_complete:y})})]}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("p",{className:"text-sm text-white",children:"Print Failed"}),h.jsx(as,{checked:t.on_print_failed,onChange:y=>f.mutate({on_print_failed:y})})]}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("p",{className:"text-sm text-white",children:"Print Stopped"}),h.jsx(as,{checked:t.on_print_stopped,onChange:y=>f.mutate({on_print_stopped:y})})]}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{children:[h.jsx("p",{className:"text-sm text-white",children:"Progress Milestones"}),h.jsx("p",{className:"text-xs text-bambu-gray",children:"Notify at 25%, 50%, 75%"})]}),h.jsx(as,{checked:t.on_print_progress,onChange:y=>f.mutate({on_print_progress:y})})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx("p",{className:"text-xs text-bambu-gray uppercase tracking-wide",children:"Printer Status"}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("p",{className:"text-sm text-white",children:"Printer Offline"}),h.jsx(as,{checked:t.on_printer_offline,onChange:y=>f.mutate({on_printer_offline:y})})]}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("p",{className:"text-sm text-white",children:"Printer Error"}),h.jsx(as,{checked:t.on_printer_error,onChange:y=>f.mutate({on_printer_error:y})})]}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("p",{className:"text-sm text-white",children:"Low Filament"}),h.jsx(as,{checked:t.on_filament_low,onChange:y=>f.mutate({on_filament_low:y})})]}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{children:[h.jsx("p",{className:"text-sm text-white",children:"Maintenance Due"}),h.jsx("p",{className:"text-xs text-bambu-gray",children:"Notify when maintenance is needed"})]}),h.jsx(as,{checked:t.on_maintenance_due??!1,onChange:y=>f.mutate({on_maintenance_due:y})})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(G_,{className:"w-4 h-4 text-purple-400"}),h.jsx("p",{className:"text-sm text-white",children:"Quiet Hours"})]}),h.jsx(as,{checked:t.quiet_hours_enabled,onChange:y=>f.mutate({quiet_hours_enabled:y})})]}),t.quiet_hours_enabled&&h.jsxs("div",{className:"pl-4 border-l-2 border-bambu-dark-tertiary space-y-2",children:[h.jsx("p",{className:"text-xs text-bambu-gray",children:"No notifications during these hours"}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(ba,{className:"w-4 h-4 text-bambu-gray"}),h.jsxs("span",{className:"text-sm text-white",children:[b(t.quiet_hours_start)||"22:00"," - ",b(t.quiet_hours_end)||"07:00"]})]}),h.jsx("p",{className:"text-xs text-bambu-gray",children:"Edit provider to change quiet hours"})]})]}),h.jsxs("div",{className:"flex gap-2 pt-2",children:[h.jsxs(lt,{size:"sm",variant:"secondary",onClick:()=>e(t),className:"flex-1",children:[h.jsx(f9,{className:"w-4 h-4"}),"Edit"]}),h.jsx(lt,{size:"sm",variant:"secondary",onClick:()=>r(!0),className:"text-red-400 hover:text-red-300",children:h.jsx(aa,{className:"w-4 h-4"})})]})]})]})}),i&&h.jsx(rr,{title:"Delete Notification Provider",message:`Are you sure you want to delete "${t.name}"? This cannot be undone.`,confirmText:"Delete",variant:"danger",onConfirm:()=>{m.mutate(),r(!1)},onCancel:()=>r(!1)})]})}const uG=[{value:"callmebot",label:"CallMeBot/WhatsApp",description:"Free WhatsApp notifications via CallMeBot"},{value:"ntfy",label:"ntfy",description:"Free, self-hostable push notifications"},{value:"pushover",label:"Pushover",description:"Simple, reliable push notifications"},{value:"telegram",label:"Telegram",description:"Notifications via Telegram bot"},{value:"email",label:"Email",description:"SMTP email notifications"}];function K$e({provider:t,onClose:e}){const n=Rn(),i=!!t,[r,a]=E.useState(t?.name||""),[s,o]=E.useState(t?.provider_type||"ntfy"),[l,c]=E.useState(t?.printer_id||null),[u,f]=E.useState(t?.quiet_hours_enabled||!1),[m,g]=E.useState(t?.quiet_hours_start||"22:00"),[b,y]=E.useState(t?.quiet_hours_end||"07:00"),[v,x]=E.useState(t?.config?Object.fromEntries(Object.entries(t.config).map(([B,$])=>[B,String($)])):{}),[M,w]=E.useState(null),[A,T]=E.useState(null),{data:R}=Ft({queryKey:["printers"],queryFn:Fe.getPrinters});E.useEffect(()=>{const B=$=>{$.key==="Escape"&&e()};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[e]);const N=yt({mutationFn:()=>Fe.testNotificationConfig({provider_type:s,config:v}),onSuccess:B=>{w(B),T(null)},onError:B=>{w({success:!1,message:B.message})}}),j=yt({mutationFn:B=>Fe.createNotificationProvider(B),onSuccess:()=>{n.invalidateQueries({queryKey:["notification-providers"]}),e()},onError:B=>{T(B.message)}}),C=yt({mutationFn:B=>Fe.updateNotificationProvider(t.id,B),onSuccess:()=>{n.invalidateQueries({queryKey:["notification-providers"]}),e()},onError:B=>{T(B.message)}}),k=B=>{if(B.preventDefault(),T(null),!r.trim()){T("Name is required");return}const $=G(s);for(const K of $)if(!v[K.key]?.trim()){T(`${K.label} is required`);return}const V={name:r.trim(),provider_type:s,config:v,printer_id:l,quiet_hours_enabled:u,quiet_hours_start:u?m:null,quiet_hours_end:u?b:null};i?C.mutate(V):j.mutate(V)},F=j.isPending||C.isPending,I=B=>{switch(B){case"callmebot":return[{key:"phone",label:"Phone Number",placeholder:"+1234567890",type:"text",required:!0},{key:"apikey",label:"API Key",placeholder:"Your CallMeBot API key",type:"text",required:!0}];case"ntfy":return[{key:"server",label:"Server URL",placeholder:"https://ntfy.sh",type:"text",required:!1},{key:"topic",label:"Topic",placeholder:"my-bambutrack",type:"text",required:!0},{key:"auth_token",label:"Auth Token",placeholder:"Optional authentication",type:"password",required:!1}];case"pushover":return[{key:"user_key",label:"User Key",placeholder:"Your Pushover user key",type:"text",required:!0},{key:"app_token",label:"App Token",placeholder:"Your Pushover app token",type:"text",required:!0},{key:"priority",label:"Priority",placeholder:"0 (normal)",type:"number",required:!1}];case"telegram":return[{key:"bot_token",label:"Bot Token",placeholder:"Bot token from @BotFather",type:"password",required:!0},{key:"chat_id",label:"Chat ID",placeholder:"Your chat or group ID",type:"text",required:!0}];case"email":return[{key:"smtp_server",label:"SMTP Server",placeholder:"smtp.gmail.com",type:"text",required:!0},{key:"smtp_port",label:"SMTP Port",placeholder:"587",type:"number",required:!1},{key:"security",label:"Security",type:"select",required:!1,options:[{value:"starttls",label:"STARTTLS (Port 587)"},{value:"ssl",label:"SSL/TLS (Port 465)"},{value:"none",label:"None (Port 25)"}]},{key:"auth_enabled",label:"Authentication",type:"select",required:!1,options:[{value:"true",label:"Enabled"},{value:"false",label:"Disabled"}]},{key:"username",label:"Username",placeholder:"your@email.com",type:"text",required:!1},{key:"password",label:"Password",placeholder:"App password",type:"password",required:!1},{key:"from_email",label:"From Email",placeholder:"your@email.com",type:"text",required:!0},{key:"to_email",label:"To Email",placeholder:"recipient@email.com",type:"text",required:!0}];default:return[]}},G=B=>I(B).filter($=>$.required),O=I(s);return h.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4 overflow-y-auto",onClick:e,children:h.jsxs("div",{className:"bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary w-full max-w-lg my-8",onClick:B=>B.stopPropagation(),children:[h.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary",children:[h.jsx("h2",{className:"text-lg font-semibold text-white",children:i?"Edit Notification Provider":"Add Notification Provider"}),h.jsx("button",{onClick:e,className:"text-bambu-gray hover:text-white transition-colors",children:h.jsx(fn,{className:"w-5 h-5"})})]}),h.jsxs("form",{onSubmit:k,className:"p-6 space-y-4",children:[A&&h.jsx("div",{className:"p-3 bg-red-500/20 border border-red-500/50 rounded-lg text-sm text-red-400",children:A}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Name *"}),h.jsx("input",{type:"text",value:r,onChange:B=>a(B.target.value),placeholder:"My Notifications",className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Provider Type *"}),h.jsx("select",{value:s,onChange:B=>{o(B.target.value),x({}),w(null)},disabled:i,className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none disabled:opacity-50",children:uG.map(B=>h.jsx("option",{value:B.value,children:B.label},B.value))}),h.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:uG.find(B=>B.value===s)?.description})]}),h.jsxs("div",{className:"space-y-3",children:[h.jsx("p",{className:"text-sm text-bambu-gray",children:"Configuration"}),O.map(B=>h.jsxs("div",{children:[h.jsxs("label",{className:"block text-sm text-bambu-gray mb-1",children:[B.label," ",B.required&&"*"]}),B.type==="select"&&B.options?h.jsx("select",{value:v[B.key]||B.options[0]?.value||"",onChange:$=>{x({...v,[B.key]:$.target.value}),w(null)},className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",children:B.options.map($=>h.jsx("option",{value:$.value,children:$.label},$.value))}):h.jsx("input",{type:B.type,value:v[B.key]||"",onChange:$=>{x({...v,[B.key]:$.target.value}),w(null)},placeholder:B.placeholder,className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none"})]},B.key))]}),h.jsx("div",{className:"flex gap-2",children:h.jsxs(lt,{type:"button",variant:"secondary",onClick:()=>{w(null),N.mutate()},disabled:N.isPending||!v[G(s)[0]?.key],className:"flex-1",children:[N.isPending?h.jsx(It,{className:"w-4 h-4 animate-spin"}):h.jsx(p9,{className:"w-4 h-4"}),"Test Configuration"]})}),M&&h.jsx("div",{className:`p-3 rounded-lg flex items-center gap-2 ${M.success?"bg-bambu-green/20 border border-bambu-green/50 text-bambu-green":"bg-red-500/20 border border-red-500/50 text-red-400"}`,children:M.success?h.jsxs(h.Fragment,{children:[h.jsx(ld,{className:"w-5 h-5"}),h.jsx("span",{children:M.message})]}):h.jsxs(h.Fragment,{children:[h.jsx(L0,{className:"w-5 h-5"}),h.jsx("span",{children:M.message})]})}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Printer Filter"}),h.jsxs("select",{value:l??"",onChange:B=>c(B.target.value?Number(B.target.value):null),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",children:[h.jsx("option",{value:"",children:"All printers"}),R?.map(B=>h.jsx("option",{value:B.id,children:B.name},B.id))]}),h.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:"Only send notifications for events from this printer"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("label",{className:"text-sm text-white",children:"Quiet Hours (Do Not Disturb)"}),h.jsx(as,{checked:u,onChange:f})]}),u&&h.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[h.jsxs("div",{children:[h.jsx("label",{className:"block text-xs text-bambu-gray mb-1",children:"Start"}),h.jsx("input",{type:"time",value:m,onChange:B=>g(B.target.value),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-xs text-bambu-gray mb-1",children:"End"}),h.jsx("input",{type:"time",value:b,onChange:B=>y(B.target.value),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none"})]})]})]}),h.jsxs("div",{className:"flex gap-3 pt-2",children:[h.jsx(lt,{type:"button",variant:"secondary",onClick:e,className:"flex-1",children:"Cancel"}),h.jsxs(lt,{type:"submit",disabled:F,className:"flex-1",children:[F?h.jsx(It,{className:"w-4 h-4 animate-spin"}):h.jsx(I0,{className:"w-4 h-4"}),i?"Save":"Add"]})]})]})]})})}async function Y$e(){const t=await fetch("/api/v1/settings/spoolman");if(!t.ok)throw new Error("Failed to load Spoolman settings");return t.json()}async function Z$e(t){const e=await fetch("/api/v1/settings/spoolman",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!e.ok)throw new Error("Failed to save Spoolman settings");return e.json()}function Q$e(){const t=Rn(),[e,n]=E.useState(!1),[i,r]=E.useState(""),[a,s]=E.useState("auto"),[o,l]=E.useState(!1),[c,u]=E.useState(!1),[f,m]=E.useState("all"),{data:g,isLoading:b}=Ft({queryKey:["spoolman-settings"],queryFn:Y$e}),{data:y,isLoading:v,refetch:x}=Ft({queryKey:["spoolman-status"],queryFn:Fe.getSpoolmanStatus,refetchInterval:3e4}),{data:M}=Ft({queryKey:["printers"],queryFn:Fe.getPrinters});E.useEffect(()=>{g&&(n(g.spoolman_enabled==="true"),r(g.spoolman_url||""),s(g.spoolman_sync_mode||"auto"))},[g]),E.useEffect(()=>{if(g){const I=g.spoolman_enabled==="true"!==e||(g.spoolman_url||"")!==i||(g.spoolman_sync_mode||"auto")!==a;l(I)}},[g,e,i,a]);const w=yt({mutationFn:()=>Z$e({spoolman_enabled:e?"true":"false",spoolman_url:i,spoolman_sync_mode:a}),onSuccess:()=>{t.invalidateQueries({queryKey:["spoolman-settings"]}),t.invalidateQueries({queryKey:["spoolman-status"]}),l(!1),u(!0),setTimeout(()=>u(!1),2e3)}}),A=yt({mutationFn:Fe.connectSpoolman,onSuccess:()=>{x()}}),T=yt({mutationFn:Fe.disconnectSpoolman,onSuccess:()=>{x()}}),R=yt({mutationFn:Fe.syncAllPrintersAms,onSuccess:I=>{I.success}}),N=yt({mutationFn:I=>Fe.syncPrinterAms(I),onSuccess:I=>{I.success}}),j=()=>{f==="all"?R.mutate():N.mutate(f)},C=R.isPending||N.isPending,k=f==="all"?R.data:N.data,F=f==="all"?R.isSuccess:N.isSuccess;return b?h.jsxs(Xt,{children:[h.jsx(Xl,{children:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(qU,{className:"w-5 h-5 text-bambu-green"}),h.jsx("h2",{className:"text-lg font-semibold text-white",children:"Spoolman Integration"})]})}),h.jsx(en,{children:h.jsx("div",{className:"flex justify-center py-8",children:h.jsx(It,{className:"w-6 h-6 text-bambu-green animate-spin"})})})]}):h.jsxs(Xt,{children:[h.jsx(Xl,{children:h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(qU,{className:"w-5 h-5 text-bambu-green"}),h.jsx("h2",{className:"text-lg font-semibold text-white",children:"Spoolman Integration"})]}),o&&h.jsx(lt,{size:"sm",onClick:()=>w.mutate(),disabled:w.isPending,children:w.isPending?h.jsx(It,{className:"w-4 h-4 animate-spin"}):c?h.jsx(Hp,{className:"w-4 h-4"}):"Save"})]})}),h.jsxs(en,{className:"space-y-4",children:[h.jsx("p",{className:"text-sm text-bambu-gray",children:"Connect to Spoolman for filament inventory tracking. AMS data will sync automatically."}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{children:[h.jsx("p",{className:"text-white",children:"Enable Spoolman"}),h.jsx("p",{className:"text-sm text-bambu-gray",children:"Sync filament data with Spoolman server"})]}),h.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[h.jsx("input",{type:"checkbox",checked:e,onChange:I=>n(I.target.checked),className:"sr-only peer"}),h.jsx("div",{className:"w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green"})]})]}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Spoolman URL"}),h.jsx("input",{type:"text",placeholder:"http://192.168.1.100:7912",value:i,onChange:I=>r(I.target.value),disabled:!e,className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray/50 focus:border-bambu-green focus:outline-none disabled:opacity-50"}),h.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:"URL of your Spoolman server (e.g., http://localhost:7912)"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Sync Mode"}),h.jsxs("select",{value:a,onChange:I=>s(I.target.value),disabled:!e,className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none disabled:opacity-50",children:[h.jsx("option",{value:"auto",children:"Automatic"}),h.jsx("option",{value:"manual",children:"Manual Only"})]}),h.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:a==="auto"?"AMS data syncs automatically when changes are detected":"Only sync when manually triggered"})]}),e&&h.jsxs("div",{className:"pt-2 border-t border-bambu-dark-tertiary",children:[h.jsxs("div",{className:"flex items-center justify-between mb-3",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-sm text-bambu-gray",children:"Status:"}),v?h.jsx(It,{className:"w-4 h-4 text-bambu-gray animate-spin"}):y?.connected?h.jsxs("span",{className:"flex items-center gap-1 text-sm text-green-500",children:[h.jsx(Hp,{className:"w-4 h-4"}),"Connected"]}):h.jsxs("span",{className:"flex items-center gap-1 text-sm text-red-500",children:[h.jsx(fn,{className:"w-4 h-4"}),"Disconnected"]})]}),h.jsx("div",{className:"flex gap-2",children:y?.connected?h.jsxs(lt,{variant:"secondary",size:"sm",onClick:()=>T.mutate(),disabled:T.isPending,children:[T.isPending?h.jsx(It,{className:"w-4 h-4 animate-spin"}):h.jsx(roe,{className:"w-4 h-4"}),"Disconnect"]}):h.jsxs(lt,{size:"sm",onClick:()=>A.mutate(),disabled:A.isPending||!i,children:[A.isPending?h.jsx(It,{className:"w-4 h-4 animate-spin"}):h.jsx(soe,{className:"w-4 h-4"}),"Connect"]})})]}),A.isError&&h.jsx("div",{className:"mb-3 p-2 bg-red-500/20 border border-red-500/50 rounded text-sm text-red-400",children:A.error.message}),y?.connected&&h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{children:[h.jsx("p",{className:"text-sm text-white",children:"Sync AMS Data"}),h.jsx("p",{className:"text-xs text-bambu-gray",children:"Manually sync printer AMS data to Spoolman"})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs("div",{className:"relative flex-1",children:[h.jsxs("select",{value:f,onChange:I=>m(I.target.value==="all"?"all":Number(I.target.value)),className:"w-full px-3 py-2 pr-8 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:border-bambu-green focus:outline-none appearance-none cursor-pointer",children:[h.jsx("option",{value:"all",children:"All Printers"}),M?.map(I=>h.jsx("option",{value:I.id,children:I.name},I.id))]}),h.jsx(Gf,{className:"absolute right-2 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none"})]}),h.jsxs(lt,{variant:"secondary",size:"sm",onClick:j,disabled:C,children:[C?h.jsx(It,{className:"w-4 h-4 animate-spin"}):h.jsx(el,{className:"w-4 h-4"}),"Sync"]})]})]}),F&&k&&h.jsx("div",{className:`mt-2 p-2 rounded text-sm ${k.success?"bg-green-500/20 border border-green-500/50 text-green-400":"bg-yellow-500/20 border border-yellow-500/50 text-yellow-400"}`,children:k.success?`Synced ${k.synced_count} trays successfully`:`Synced ${k.synced_count} trays with ${k.errors.length} errors`})]})]})]})}function J$e(){const t=Rn(),{t:e,i18n:n}=RP(),[i,r]=E.useState(null),[a,s]=E.useState(!1),[o,l]=E.useState(!1),[c,u]=E.useState(!1),[f,m]=E.useState(null),[g,b]=E.useState(!1),[y,v]=E.useState(null),[x,M]=E.useState(b9()),w=X=>{M(X),Wle(X)},A=()=>{localStorage.removeItem("sidebarOrder"),window.location.reload()},{data:T,isLoading:R}=Ft({queryKey:["settings"],queryFn:Fe.getSettings}),{data:N,isLoading:j}=Ft({queryKey:["smart-plugs"],queryFn:Fe.getSmartPlugs}),{data:C,isLoading:k}=Ft({queryKey:["notification-providers"],queryFn:Fe.getNotificationProviders}),{data:F}=Ft({queryKey:["ffmpeg-status"],queryFn:Fe.checkFfmpeg}),{data:I}=Ft({queryKey:["version"],queryFn:Fe.getVersion}),{data:G,refetch:O,isRefetching:B}=Ft({queryKey:["updateCheck"],queryFn:Fe.checkForUpdates,staleTime:300*1e3}),{data:$,refetch:V}=Ft({queryKey:["updateStatus"],queryFn:Fe.getUpdateStatus,refetchInterval:X=>{const ae=X.state.data;return ae?.status==="downloading"||ae?.status==="installing"?1e3:!1}}),K=yt({mutationFn:Fe.applyUpdate,onSuccess:()=>{V()}});E.useEffect(()=>{T&&!i&&r(T)},[T,i]),E.useEffect(()=>{if(T&&i){const X=T.auto_archive!==i.auto_archive||T.save_thumbnails!==i.save_thumbnails||T.capture_finish_photo!==i.capture_finish_photo||T.default_filament_cost!==i.default_filament_cost||T.currency!==i.currency||T.energy_cost_per_kwh!==i.energy_cost_per_kwh||T.energy_tracking_mode!==i.energy_tracking_mode||T.check_updates!==i.check_updates||T.notification_language!==i.notification_language;s(X)}},[T,i]);const Y=yt({mutationFn:Fe.updateSettings,onSuccess:X=>{t.setQueryData(["settings"],X),r(X),s(!1),l(!0),setTimeout(()=>l(!1),2e3),t.invalidateQueries({queryKey:["archiveStats"]})}}),se=()=>{i&&Y.mutate(i)},H=(X,ae)=>{i&&r({...i,[X]:ae})};return R||!i?h.jsx("div",{className:"p-8 flex justify-center",children:h.jsx(It,{className:"w-8 h-8 text-bambu-green animate-spin"})}):h.jsxs("div",{className:"p-8",children:[h.jsxs("div",{className:"mb-8 flex items-center justify-between",children:[h.jsxs("div",{children:[h.jsx("h1",{className:"text-2xl font-bold text-white",children:"Settings"}),h.jsx("p",{className:"text-bambu-gray",children:"Configure Bambusy"})]}),h.jsxs(lt,{onClick:se,disabled:!a||Y.isPending,children:[Y.isPending?h.jsx(It,{className:"w-4 h-4 animate-spin"}):o?h.jsx(Hp,{className:"w-4 h-4"}):h.jsx(I0,{className:"w-4 h-4"}),o?"Saved!":"Save"]})]}),Y.isError&&h.jsxs("div",{className:"mb-6 p-3 bg-red-500/20 border border-red-500/50 rounded-lg text-sm text-red-400",children:["Failed to save settings: ",Y.error.message]}),h.jsxs("div",{className:"flex gap-8",children:[h.jsxs("div",{className:"space-y-6 flex-1 max-w-xl",children:[h.jsxs(Xt,{children:[h.jsx(Xl,{children:h.jsx("h2",{className:"text-lg font-semibold text-white",children:"Archive Settings"})}),h.jsxs(en,{className:"space-y-4",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{children:[h.jsx("p",{className:"text-white",children:"Auto-archive prints"}),h.jsx("p",{className:"text-sm text-bambu-gray",children:"Automatically save 3MF files when prints complete"})]}),h.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[h.jsx("input",{type:"checkbox",checked:i.auto_archive,onChange:X=>H("auto_archive",X.target.checked),className:"sr-only peer"}),h.jsx("div",{className:"w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green"})]})]}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{children:[h.jsx("p",{className:"text-white",children:"Save thumbnails"}),h.jsx("p",{className:"text-sm text-bambu-gray",children:"Extract and save preview images from 3MF files"})]}),h.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[h.jsx("input",{type:"checkbox",checked:i.save_thumbnails,onChange:X=>H("save_thumbnails",X.target.checked),className:"sr-only peer"}),h.jsx("div",{className:"w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green"})]})]}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{children:[h.jsx("p",{className:"text-white",children:"Capture finish photo"}),h.jsx("p",{className:"text-sm text-bambu-gray",children:"Take a photo from printer camera when print completes"})]}),h.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[h.jsx("input",{type:"checkbox",checked:i.capture_finish_photo,onChange:X=>H("capture_finish_photo",X.target.checked),className:"sr-only peer"}),h.jsx("div",{className:"w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green"})]})]}),i.capture_finish_photo&&F&&!F.installed&&h.jsxs("div",{className:"flex items-start gap-2 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[h.jsx(ya,{className:"w-5 h-5 text-yellow-500 flex-shrink-0 mt-0.5"}),h.jsxs("div",{className:"text-sm",children:[h.jsx("p",{className:"text-yellow-500 font-medium",children:"ffmpeg not installed"}),h.jsxs("p",{className:"text-bambu-gray mt-1",children:["Camera capture requires ffmpeg. Install it via"," ",h.jsx("code",{className:"bg-bambu-dark-tertiary px-1 rounded",children:"brew install ffmpeg"})," (macOS) or"," ",h.jsx("code",{className:"bg-bambu-dark-tertiary px-1 rounded",children:"apt install ffmpeg"})," (Linux)."]})]})]})]})]}),h.jsxs(Xt,{children:[h.jsx(Xl,{children:h.jsx("h2",{className:"text-lg font-semibold text-white",children:"Cost Tracking"})}),h.jsxs(en,{className:"space-y-4",children:[h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Default filament cost (per kg)"}),h.jsx("input",{type:"number",step:"0.01",min:"0",value:i.default_filament_cost,onChange:X=>H("default_filament_cost",parseFloat(X.target.value)||0),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Currency"}),h.jsxs("select",{value:i.currency,onChange:X=>H("currency",X.target.value),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",children:[h.jsx("option",{value:"USD",children:"USD ($)"}),h.jsx("option",{value:"EUR",children:"EUR (€)"}),h.jsx("option",{value:"GBP",children:"GBP (£)"}),h.jsx("option",{value:"CHF",children:"CHF (Fr.)"}),h.jsx("option",{value:"JPY",children:"JPY (¥)"}),h.jsx("option",{value:"CNY",children:"CNY (¥)"}),h.jsx("option",{value:"CAD",children:"CAD ($)"}),h.jsx("option",{value:"AUD",children:"AUD ($)"})]})]}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Electricity cost per kWh"}),h.jsx("input",{type:"number",step:"0.01",min:"0",value:i.energy_cost_per_kwh,onChange:X=>H("energy_cost_per_kwh",parseFloat(X.target.value)||0),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Energy display mode"}),h.jsxs("select",{value:i.energy_tracking_mode||"total",onChange:X=>H("energy_tracking_mode",X.target.value),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",children:[h.jsx("option",{value:"print",children:"Prints Only"}),h.jsx("option",{value:"total",children:"Total Consumption"})]}),h.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:i.energy_tracking_mode==="print"?"Dashboard shows sum of energy used during prints":"Dashboard shows lifetime energy from smart plugs"})]})]})]}),h.jsxs(Xt,{children:[h.jsx(Xl,{children:h.jsx("h2",{className:"text-lg font-semibold text-white",children:e("settings.general")})}),h.jsxs(en,{className:"space-y-4",children:[h.jsxs("div",{children:[h.jsxs("label",{className:"block text-sm text-bambu-gray mb-1",children:[h.jsx(V_,{className:"w-4 h-4 inline mr-1"}),e("settings.language")]}),h.jsx("select",{value:n.language,onChange:X=>n.changeLanguage(X.target.value),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",children:TU.map(X=>h.jsxs("option",{value:X.code,children:[X.nativeName," (",X.name,")"]},X.code))}),h.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:e("settings.languageDescription")})]}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:e("settings.defaultView")}),h.jsx("select",{value:x,onChange:X=>w(X.target.value),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",children:m_.map(X=>h.jsx("option",{value:X.to,children:e(X.labelKey)},X.id))}),h.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:e("settings.defaultViewDescription")})]}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{children:[h.jsx("p",{className:"text-white",children:"Sidebar order"}),h.jsx("p",{className:"text-sm text-bambu-gray",children:"Drag items in the sidebar to reorder. Reset to default order here."})]}),h.jsxs(lt,{variant:"secondary",size:"sm",onClick:A,children:[h.jsx(nw,{className:"w-4 h-4"}),"Reset"]})]})]})]})]}),h.jsxs("div",{className:"space-y-6 flex-1 max-w-md",children:[h.jsx(Q$e,{}),h.jsxs(Xt,{children:[h.jsx(Xl,{children:h.jsx("h2",{className:"text-lg font-semibold text-white",children:"Updates"})}),h.jsxs(en,{className:"space-y-4",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{children:[h.jsx("p",{className:"text-white",children:"Check for updates"}),h.jsx("p",{className:"text-sm text-bambu-gray",children:"Automatically check for new versions on startup"})]}),h.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[h.jsx("input",{type:"checkbox",checked:i.check_updates,onChange:X=>H("check_updates",X.target.checked),className:"sr-only peer"}),h.jsx("div",{className:"w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green"})]})]}),h.jsxs("div",{className:"border-t border-bambu-dark-tertiary pt-4",children:[h.jsxs("div",{className:"flex items-center justify-between mb-2",children:[h.jsxs("div",{children:[h.jsx("p",{className:"text-white",children:"Current version"}),h.jsxs("p",{className:"text-sm text-bambu-gray",children:["v",I?.version||"..."]})]}),h.jsxs(lt,{variant:"secondary",size:"sm",onClick:()=>O(),disabled:B,children:[B?h.jsx(It,{className:"w-4 h-4 animate-spin"}):h.jsx(el,{className:"w-4 h-4"}),"Check now"]})]}),G?.update_available?h.jsxs("div",{className:"mt-4 p-3 bg-bambu-green/10 border border-bambu-green/30 rounded-lg",children:[h.jsxs("div",{className:"flex items-start justify-between",children:[h.jsxs("div",{children:[h.jsxs("p",{className:"text-bambu-green font-medium",children:["Update available: v",G.latest_version]}),G.release_name&&G.release_name!==G.latest_version&&h.jsx("p",{className:"text-sm text-bambu-gray mt-1",children:G.release_name}),G.release_notes&&h.jsx("p",{className:"text-sm text-bambu-gray mt-2 whitespace-pre-line line-clamp-3",children:G.release_notes})]}),G.release_url&&h.jsx("a",{href:G.release_url,target:"_blank",rel:"noopener noreferrer",className:"text-bambu-gray hover:text-white transition-colors",title:"View release on GitHub",children:h.jsx(Qo,{className:"w-4 h-4"})})]}),$?.status==="downloading"||$?.status==="installing"?h.jsxs("div",{className:"mt-3",children:[h.jsxs("div",{className:"flex items-center gap-2 text-sm text-bambu-gray",children:[h.jsx(It,{className:"w-4 h-4 animate-spin"}),h.jsx("span",{children:$.message})]}),h.jsx("div",{className:"mt-2 w-full bg-bambu-dark-tertiary rounded-full h-2",children:h.jsx("div",{className:"bg-bambu-green h-2 rounded-full transition-all duration-300",style:{width:`${$.progress}%`}})})]}):$?.status==="complete"?h.jsx("div",{className:"mt-3 p-2 bg-bambu-green/20 rounded text-sm text-bambu-green",children:$.message}):$?.status==="error"?h.jsx("div",{className:"mt-3 p-2 bg-red-500/20 rounded text-sm text-red-400",children:$.error||$.message}):h.jsxs(lt,{className:"mt-3",onClick:()=>K.mutate(),disabled:K.isPending,children:[K.isPending?h.jsx(It,{className:"w-4 h-4 animate-spin"}):h.jsx(Ku,{className:"w-4 h-4"}),"Install Update"]})]}):G?.error?h.jsxs("div",{className:"mt-2 p-2 bg-red-500/10 border border-red-500/30 rounded text-sm text-red-400",children:["Failed to check for updates: ",G.error]}):G&&!G.update_available?h.jsx("p",{className:"mt-2 text-sm text-bambu-gray",children:"You're running the latest version"}):null]})]})]})]}),h.jsx("div",{className:"w-80 flex-shrink-0",children:h.jsxs(Xt,{children:[h.jsx(Xl,{children:h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(IN,{className:"w-5 h-5 text-bambu-green"}),h.jsx("h2",{className:"text-lg font-semibold text-white",children:"Smart Plugs"})]}),h.jsxs(lt,{size:"sm",onClick:()=>{m(null),u(!0)},children:[h.jsx(Jo,{className:"w-4 h-4"}),"Add"]})]})}),h.jsxs(en,{children:[h.jsx("p",{className:"text-sm text-bambu-gray mb-4",children:"Connect Tasmota-based smart plugs to automate power control for your printers."}),j?h.jsx("div",{className:"flex justify-center py-8",children:h.jsx(It,{className:"w-6 h-6 text-bambu-green animate-spin"})}):N&&N.length>0?h.jsx("div",{className:"space-y-4",children:N.map(X=>h.jsx(G$e,{plug:X,onEdit:ae=>{m(ae),u(!0)}},X.id))}):h.jsxs("div",{className:"text-center py-8 text-bambu-gray",children:[h.jsx(IN,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),h.jsx("p",{children:"No smart plugs configured"}),h.jsx("p",{className:"text-sm mt-1",children:"Add a Tasmota plug to get started"})]})]})]})}),h.jsx("div",{className:"w-80 flex-shrink-0",children:h.jsxs(Xt,{children:[h.jsx(Xl,{children:h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(DN,{className:"w-5 h-5 text-bambu-green"}),h.jsx("h2",{className:"text-lg font-semibold text-white",children:"Notifications"})]}),h.jsxs(lt,{size:"sm",onClick:()=>{v(null),b(!0)},children:[h.jsx(Jo,{className:"w-4 h-4"}),"Add"]})]})}),h.jsxs(en,{children:[h.jsx("p",{className:"text-sm text-bambu-gray mb-4",children:"Get notified about print events via WhatsApp, Telegram, Email, and more."}),h.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-bambu-dark-tertiary mb-4",children:[h.jsxs("div",{children:[h.jsx("p",{className:"text-white",children:e("settings.notificationLanguage")}),h.jsx("p",{className:"text-sm text-bambu-gray",children:e("settings.notificationLanguageDescription")})]}),h.jsx("select",{value:i.notification_language||"en",onChange:X=>H("notification_language",X.target.value),className:"px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:outline-none focus:ring-2 focus:ring-bambu-green",children:TU.map(X=>h.jsx("option",{value:X.code,children:X.nativeName},X.code))})]}),k?h.jsx("div",{className:"flex justify-center py-8",children:h.jsx(It,{className:"w-6 h-6 text-bambu-green animate-spin"})}):C&&C.length>0?h.jsx("div",{className:"space-y-4",children:C.map(X=>h.jsx(X$e,{provider:X,onEdit:ae=>{v(ae),b(!0)}},X.id))}):h.jsxs("div",{className:"text-center py-8 text-bambu-gray",children:[h.jsx(DN,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),h.jsx("p",{children:"No notification providers configured"}),h.jsx("p",{className:"text-sm mt-1",children:"Add a provider to get started"})]})]})]})})]}),c&&h.jsx(W$e,{plug:f,onClose:()=>{u(!1),m(null)}}),g&&h.jsx(K$e,{provider:y,onClose:()=>{b(!1),v(null)}})]})}const QJ=t=>{const e=parseFloat(t);return(Math.trunc(e*1e3)/1e3).toFixed(3)},eVe=t=>t.startsWith("HH")?"HF":"S",tVe=t=>{const e=t.match(/^([A-Z]{2}\d{2})/);return e?e[1]:"HH00"},JJ=t=>{const e=["High Flow_","High Flow ","Standard_","Standard ","HF_","HF ","S_","S "];for(const i of e)if(t.startsWith(i))return t.slice(i.length);const n=t.indexOf("_");return n>0?t.slice(n+1):t};function gN({profile:t,onEdit:e}){const n=eVe(t.nozzle_id),i=t.nozzle_diameter,r=t.name||"Unnamed",a=JJ(t.name||"");return h.jsxs("button",{onClick:e,className:"w-full text-left px-3 py-2 bg-bambu-dark rounded hover:bg-bambu-dark-tertiary transition-colors",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-bambu-green font-mono text-sm font-bold whitespace-nowrap",children:QJ(t.k_value)}),h.jsx("span",{className:"text-white text-sm truncate flex-1",title:r,children:r}),h.jsxs("span",{className:"text-xs text-bambu-gray whitespace-nowrap",children:[n," ",i]})]}),h.jsxs("div",{className:"text-xs text-bambu-gray mt-0.5 truncate",title:`Filament: ${a}`,children:["Filament: ",a||t.filament_id]})]})}function dG({profile:t,printerId:e,nozzleDiameter:n,existingProfiles:i=[],isDualNozzle:r=!1,onClose:a,onSave:s}){const{showToast:o}=eo(),l=Rn(),[c,u]=E.useState(t?.name||""),[f,m]=E.useState(t?.k_value?QJ(t.k_value):"0.020"),[g,b]=E.useState(t?.filament_id||""),[y,v]=E.useState(t?.nozzle_id?tVe(t.nozzle_id):"HH00"),[x,M]=E.useState(t?.nozzle_diameter||n),[w,A]=E.useState(t?[t.extruder_id]:r?[0,1]:[0]),[T,R]=E.useState(!1),[N,j]=E.useState({current:0,total:0}),C=ui.useMemo(()=>{const $=new Map;for(const V of i)if(V.filament_id&&!$.has(V.filament_id)){const K=JJ(V.name||"");$.set(V.filament_id,{id:V.filament_id,name:K||V.filament_id})}return Array.from($.values()).sort((V,K)=>V.name.localeCompare(K.name))},[i]),k=yt({mutationFn:$=>(console.log("[KProfile] Calling API..."),Fe.setKProfile(e,$)),onSuccess:$=>{console.log("[KProfile] Save success:",$),o("K-profile saved"),R(!0),setTimeout(()=>{l.invalidateQueries({queryKey:["kprofiles",e]}),R(!1),s()},2500)},onError:$=>{console.error("[KProfile] Save error:",$),o($.message,"error"),R(!1)}}),F=yt({mutationFn:$=>(console.log("[KProfile] Deleting profile..."),Fe.deleteKProfile(e,$)),onSuccess:$=>{console.log("[KProfile] Delete success:",$),o("K-profile deleted"),R(!0),setTimeout(()=>{l.invalidateQueries({queryKey:["kprofiles",e]}),R(!1),a()},2500)},onError:$=>{console.error("[KProfile] Delete error:",$),o($.message,"error"),R(!1)}}),[I,G]=E.useState(!1),O=()=>{t&&F.mutate({slot_id:t.slot_id,extruder_id:t.extruder_id,nozzle_id:t.nozzle_id,nozzle_diameter:t.nozzle_diameter,filament_id:t.filament_id,setting_id:t.setting_id})},B=async $=>{if($.preventDefault(),r&&!t&&w.length===0){o("Please select at least one extruder","error");return}const V=parseFloat(f).toFixed(6),K=`${y}-${x}`;if(t||w.length===1){const Y={name:c,k_value:V,filament_id:g,nozzle_id:K,nozzle_diameter:x,extruder_id:t?t.extruder_id:w[0],setting_id:t?.setting_id,slot_id:t?.slot_id??0};console.log("[KProfile] Saving profile:",Y),k.mutate(Y);return}R(!0),j({current:0,total:w.length});for(let Y=0;YsetTimeout(X,1500))}catch(X){console.error(`[KProfile] Failed to save for extruder ${se}:`,X),o(`Failed to save for ${se===1?"Left":"Right"} extruder`,"error"),R(!1),j({current:0,total:0});return}}o(`K-profile saved to ${w.length} extruders`),setTimeout(()=>{l.invalidateQueries({queryKey:["kprofiles",e]}),R(!1),j({current:0,total:0}),s()},2500)};return h.jsxs("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:[h.jsxs(Xt,{className:"w-full max-w-md relative",children:[T&&h.jsxs("div",{className:"absolute inset-0 bg-bambu-dark-secondary/90 flex flex-col items-center justify-center z-10 rounded-lg",children:[h.jsx(It,{className:"w-8 h-8 text-bambu-green animate-spin mb-3"}),h.jsx("p",{className:"text-white font-medium",children:N.total>1?`Saving to extruder ${N.current}/${N.total}...`:"Syncing with printer..."}),h.jsx("p",{className:"text-bambu-gray text-sm mt-1",children:"Please wait"})]}),h.jsxs(en,{className:"p-0",children:[h.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[h.jsx("h2",{className:"text-xl font-semibold text-white",children:t?"Edit K-Profile":"Add K-Profile"}),h.jsx("button",{onClick:a,className:"text-bambu-gray hover:text-white transition-colors",disabled:T,children:h.jsx(fn,{className:"w-5 h-5"})})]}),h.jsxs("form",{onSubmit:B,className:"p-4 space-y-4",children:[h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Profile Name"}),h.jsx("input",{type:"text",value:c,onChange:$=>u($.target.value),disabled:!!t,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none ${t?"opacity-60 cursor-not-allowed":""}`,placeholder:"My PLA Profile",required:!t})]}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"K-Value"}),h.jsx("input",{type:"text",inputMode:"decimal",value:f,onChange:$=>{const V=$.target.value;(V===""||/^\d*\.?\d*$/.test(V))&&m(V)},onBlur:$=>{const V=parseFloat($.target.value);isNaN(V)||m((Math.trunc(V*1e3)/1e3).toFixed(3))},className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none font-mono",placeholder:"0.020",required:!0}),h.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:"Typical range: 0.01 - 0.06 for PLA, 0.02 - 0.10 for PETG"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Filament"}),h.jsxs("select",{value:g,onChange:$=>{const V=$.target.value;if(b(V),!t&&V&&!c){const K=C.find(Y=>Y.id===V);K&&u(`${y==="HH00"?"HF":"S"} ${K.name}`)}},disabled:!!t,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none ${t?"opacity-60 cursor-not-allowed":""}`,required:!t,children:[h.jsx("option",{value:"",children:"Select filament..."}),t?.filament_id&&h.jsx("option",{value:t.filament_id,children:C.find($=>$.id===t.filament_id)?.name||t.filament_id},t.filament_id),!t&&C.map($=>h.jsx("option",{value:$.id,children:$.name},$.id))]}),!t&&C.length===0&&h.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:"No filaments found. Create a K-profile in Bambu Studio first."})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Flow Type"}),h.jsxs("select",{value:y,onChange:$=>{const V=$.target.value;if(v(V),!t&&g&&!c){const K=C.find(Y=>Y.id===g);K&&u(`${V==="HH00"?"HF":"S"} ${K.name}`)}},disabled:!!t,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none ${t?"opacity-60 cursor-not-allowed":""}`,children:[h.jsx("option",{value:"HH00",children:"High Flow"}),h.jsx("option",{value:"HS00",children:"Standard"})]})]}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Nozzle Size"}),h.jsxs("select",{value:x,onChange:$=>M($.target.value),disabled:!!t,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none ${t?"opacity-60 cursor-not-allowed":""}`,children:[h.jsx("option",{value:"0.2",children:"0.2mm"}),h.jsx("option",{value:"0.4",children:"0.4mm"}),h.jsx("option",{value:"0.6",children:"0.6mm"}),h.jsx("option",{value:"0.8",children:"0.8mm"})]})]})]}),r&&h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:t?"Extruder":"Extruders"}),t?h.jsx("div",{className:"px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white opacity-60",children:t.extruder_id===1?"Left":"Right"}):h.jsxs("div",{className:"flex gap-4",children:[h.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[h.jsx("input",{type:"checkbox",checked:w.includes(1),onChange:$=>{$.target.checked?A([...w,1]):A(w.filter(V=>V!==1))},className:"w-4 h-4 rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green focus:ring-offset-0 accent-bambu-green"}),h.jsx("span",{className:"text-white",children:"Left"})]}),h.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[h.jsx("input",{type:"checkbox",checked:w.includes(0),onChange:$=>{$.target.checked?A([...w,0]):A(w.filter(V=>V!==0))},className:"w-4 h-4 rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green focus:ring-offset-0 accent-bambu-green"}),h.jsx("span",{className:"text-white",children:"Right"})]})]})]}),h.jsxs("div",{className:"flex gap-2 pt-4",children:[t&&h.jsx(lt,{type:"button",variant:"secondary",onClick:()=>G(!0),disabled:F.isPending||T,className:"text-red-500 hover:bg-red-500/10",children:F.isPending?h.jsx(It,{className:"w-4 h-4 animate-spin"}):h.jsx(aa,{className:"w-4 h-4"})}),h.jsx(lt,{type:"button",variant:"secondary",onClick:a,disabled:T,className:"flex-1",children:"Cancel"}),h.jsxs(lt,{type:"submit",disabled:k.isPending||T,className:"flex-1",children:[k.isPending?h.jsx(It,{className:"w-4 h-4 animate-spin"}):h.jsx(BP,{className:"w-4 h-4"}),"Save"]})]})]})]})]}),I&&h.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-[60]",children:h.jsx(Xt,{className:"w-full max-w-sm",children:h.jsxs(en,{className:"p-6",children:[h.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[h.jsx("div",{className:"w-10 h-10 rounded-full bg-red-500/20 flex items-center justify-center",children:h.jsx(aa,{className:"w-5 h-5 text-red-500"})}),h.jsxs("div",{children:[h.jsx("h3",{className:"text-lg font-semibold text-white",children:"Delete Profile"}),h.jsx("p",{className:"text-sm text-bambu-gray",children:"This cannot be undone"})]})]}),h.jsxs("p",{className:"text-bambu-gray mb-6",children:["Are you sure you want to delete ",h.jsxs("span",{className:"text-white font-medium",children:['"',t?.name,'"']})," from the printer?"]}),h.jsxs("div",{className:"flex gap-3",children:[h.jsx(lt,{variant:"secondary",onClick:()=>G(!1),className:"flex-1",children:"Cancel"}),h.jsxs(lt,{onClick:()=>{G(!1),O()},disabled:F.isPending,className:"flex-1 bg-red-500 hover:bg-red-600 text-white",children:[F.isPending?h.jsx(It,{className:"w-4 h-4 animate-spin"}):h.jsx(aa,{className:"w-4 h-4"}),"Delete"]})]})]})})})]})}function nVe(){const[t,e]=E.useState(null),[n,i]=E.useState("0.4"),[r,a]=E.useState(null),[s,o]=E.useState(!1),[l,c]=E.useState(""),[u,f]=E.useState("all"),[m,g]=E.useState("all"),{data:b,isLoading:y}=Ft({queryKey:["printers"],queryFn:Fe.getPrinters}),{data:v,isLoading:x,error:M,refetch:w}=Ft({queryKey:["kprofiles",t,n],queryFn:()=>Fe.getKProfiles(t,n),enabled:!!t,retry:!1,staleTime:0,refetchOnMount:"always"}),A=M?.message?.includes("not connected");E.useEffect(()=>{if(!t&&b&&b.length>0){const C=b.find(k=>k.is_active);C&&e(C.id)}},[t,b]),E.useEffect(()=>{if(t){const C=setTimeout(()=>{w()},150);return()=>clearTimeout(C)}},[t,n]);const T=b?.filter(C=>C.is_active)||[],R=ui.useMemo(()=>v?.profiles?v.profiles.filter(C=>{const k=l.toLowerCase(),F=!k||C.name.toLowerCase().includes(k)||C.filament_id.toLowerCase().includes(k),I=u==="all"||u==="left"&&C.extruder_id===1||u==="right"&&C.extruder_id===0,G=m==="all"||m==="hf"&&C.nozzle_id.startsWith("HH")||m==="s"&&C.nozzle_id.startsWith("HS");return F&&I&&G}):[],[v?.profiles,l,u,m]),j=b?.find(C=>C.id===t)?.nozzle_count===2;return y?h.jsx("div",{className:"flex justify-center py-12",children:h.jsx(It,{className:"w-8 h-8 text-bambu-green animate-spin"})}):!b||b.length===0?h.jsx(Xt,{children:h.jsxs(en,{className:"py-12 text-center",children:[h.jsx(od,{className:"w-12 h-12 text-bambu-gray mx-auto mb-4"}),h.jsx("h3",{className:"text-lg font-semibold text-white mb-2",children:"No Printers Configured"}),h.jsx("p",{className:"text-bambu-gray",children:"Add a printer in Settings to manage K-profiles"})]})}):T.length===0?h.jsx(Xt,{children:h.jsxs(en,{className:"py-12 text-center",children:[h.jsx(mc,{className:"w-12 h-12 text-bambu-gray mx-auto mb-4"}),h.jsx("h3",{className:"text-lg font-semibold text-white mb-2",children:"No Active Printers"}),h.jsx("p",{className:"text-bambu-gray",children:"Enable a printer connection to view its K-profiles"})]})}):h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex flex-wrap gap-4 mb-6",children:[h.jsxs("div",{className:"flex-1 min-w-48",children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Printer"}),h.jsx("select",{value:t||"",onChange:C=>e(parseInt(C.target.value)),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",children:T.map(C=>h.jsx("option",{value:C.id,children:C.name},C.id))})]}),h.jsxs("div",{className:"w-32",children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Nozzle"}),h.jsxs("select",{value:n,onChange:C=>i(C.target.value),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",children:[h.jsx("option",{value:"0.2",children:"0.2mm"}),h.jsx("option",{value:"0.4",children:"0.4mm"}),h.jsx("option",{value:"0.6",children:"0.6mm"}),h.jsx("option",{value:"0.8",children:"0.8mm"})]})]}),h.jsxs("div",{className:"flex items-end gap-2",children:[h.jsxs(lt,{variant:"secondary",onClick:()=>w(),disabled:x,children:[h.jsx(el,{className:`w-4 h-4 ${x?"animate-spin":""}`}),"Refresh"]}),h.jsxs(lt,{onClick:()=>o(!0),children:[h.jsx(Jo,{className:"w-4 h-4"}),"Add Profile"]})]})]}),h.jsxs("div",{className:"flex flex-wrap gap-4 mb-6",children:[h.jsxs("div",{className:"flex-1 min-w-48 relative",children:[h.jsx(q_,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray"}),h.jsx("input",{type:"text",value:l,onChange:C=>c(C.target.value),placeholder:"Search by name or filament...",className:"w-full pl-10 pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none"})]}),j&&h.jsx("div",{className:"w-36",children:h.jsxs("select",{value:u,onChange:C=>f(C.target.value),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",children:[h.jsx("option",{value:"all",children:"All Extruders"}),h.jsx("option",{value:"left",children:"Left Only"}),h.jsx("option",{value:"right",children:"Right Only"})]})}),h.jsx("div",{className:"w-32",children:h.jsxs("select",{value:m,onChange:C=>g(C.target.value),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",children:[h.jsx("option",{value:"all",children:"All Flow"}),h.jsx("option",{value:"hf",children:"HF Only"}),h.jsx("option",{value:"s",children:"S Only"})]})})]}),x?h.jsx("div",{className:"flex justify-center py-12",children:h.jsx(It,{className:"w-8 h-8 text-bambu-green animate-spin"})}):A?h.jsx(Xt,{children:h.jsxs(en,{className:"py-12 text-center",children:[h.jsx(Vp,{className:"w-12 h-12 text-bambu-gray mx-auto mb-4"}),h.jsx("h3",{className:"text-lg font-semibold text-white mb-2",children:"Printer Offline"}),h.jsx("p",{className:"text-bambu-gray mb-4",children:"The selected printer is not connected. Power it on to view K-profiles."}),h.jsxs(lt,{variant:"secondary",onClick:()=>w(),children:[h.jsx(el,{className:"w-4 h-4"}),"Retry"]})]})}):R.length>0?j?h.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[h.jsxs("div",{children:[h.jsx("h3",{className:"text-sm font-medium text-bambu-gray mb-2 px-1",children:"Left Extruder"}),h.jsx("div",{className:"space-y-1",children:R.filter(C=>C.extruder_id===1).map(C=>h.jsx(gN,{profile:C,onEdit:()=>a(C)},C.slot_id))})]}),h.jsxs("div",{children:[h.jsx("h3",{className:"text-sm font-medium text-bambu-gray mb-2 px-1",children:"Right Extruder"}),h.jsx("div",{className:"space-y-1",children:R.filter(C=>C.extruder_id===0).map(C=>h.jsx(gN,{profile:C,onEdit:()=>a(C)},C.slot_id))})]})]}):h.jsx("div",{className:"space-y-1",children:R.map(C=>h.jsx(gN,{profile:C,onEdit:()=>a(C)},C.slot_id))}):l||u!=="all"||m!=="all"?h.jsx(Xt,{children:h.jsxs(en,{className:"py-12 text-center",children:[h.jsx(q_,{className:"w-12 h-12 text-bambu-gray mx-auto mb-4"}),h.jsx("h3",{className:"text-lg font-semibold text-white mb-2",children:"No Matching Profiles"}),h.jsx("p",{className:"text-bambu-gray",children:"No profiles match your search criteria"})]})}):h.jsx(Xt,{children:h.jsxs(en,{className:"py-12 text-center",children:[h.jsx(BP,{className:"w-12 h-12 text-bambu-gray mx-auto mb-4"}),h.jsx("h3",{className:"text-lg font-semibold text-white mb-2",children:"No K-Profiles"}),h.jsxs("p",{className:"text-bambu-gray mb-4",children:["No pressure advance profiles found for ",n,"mm nozzle"]}),h.jsxs(lt,{onClick:()=>o(!0),children:[h.jsx(Jo,{className:"w-4 h-4"}),"Create First Profile"]})]})}),r&&t&&h.jsx(dG,{profile:r,printerId:t,nozzleDiameter:n,existingProfiles:v?.profiles,isDualNozzle:j,onClose:()=>a(null),onSave:()=>a(null)}),s&&t&&h.jsx(dG,{printerId:t,nozzleDiameter:n,existingProfiles:v?.profiles,isDualNozzle:j,onClose:()=>o(!1),onSave:()=>o(!1)})]})}function iVe({onSuccess:t}){const{showToast:e}=eo(),[n,i]=E.useState("email"),[r,a]=E.useState(""),[s,o]=E.useState(""),[l,c]=E.useState(""),[u,f]=E.useState(""),[m,g]=E.useState("global"),b=yt({mutationFn:()=>Fe.cloudLogin(r,s,m),onSuccess:w=>{w.success?(e("Logged in successfully"),t()):w.needs_verification?(e("Verification code sent to your email"),i("code")):e(w.message,"error")},onError:w=>{e(w.message,"error")}}),y=yt({mutationFn:()=>Fe.cloudVerify(r,l),onSuccess:w=>{w.success?(e("Logged in successfully"),t()):e(w.message,"error")},onError:w=>{e(w.message,"error")}}),v=yt({mutationFn:()=>Fe.cloudSetToken(u),onSuccess:()=>{e("Token set successfully"),t()},onError:w=>{e(w.message,"error")}}),x=w=>{w.preventDefault(),n==="email"?b.mutate():n==="code"?y.mutate():n==="token"&&v.mutate()},M=b.isPending||y.isPending||v.isPending;return h.jsxs(Xt,{className:"max-w-md mx-auto",children:[h.jsx(Xl,{children:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(zP,{className:"w-5 h-5 text-bambu-green"}),h.jsx("h2",{className:"text-xl font-semibold text-white",children:"Connect to Bambu Cloud"})]})}),h.jsx(en,{children:h.jsxs("form",{onSubmit:x,className:"space-y-4",children:[n==="email"&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Email"}),h.jsx("input",{type:"email",value:r,onChange:w=>a(w.target.value),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",placeholder:"your@email.com",required:!0})]}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Password"}),h.jsx("input",{type:"password",value:s,onChange:w=>o(w.target.value),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",placeholder:"••••••••",required:!0})]}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Region"}),h.jsxs("select",{value:m,onChange:w=>g(w.target.value),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",children:[h.jsx("option",{value:"global",children:"Global"}),h.jsx("option",{value:"china",children:"China"})]})]})]}),n==="code"&&h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Verification Code"}),h.jsxs("p",{className:"text-xs text-bambu-gray mb-2",children:["Check your email (",r,") for a 6-digit code"]}),h.jsx("input",{type:"text",value:l,onChange:w=>c(w.target.value.replace(/\D/g,"").slice(0,6)),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-center text-2xl tracking-widest focus:border-bambu-green focus:outline-none",placeholder:"000000",maxLength:6,required:!0})]}),n==="token"&&h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Access Token"}),h.jsx("p",{className:"text-xs text-bambu-gray mb-2",children:"Paste your Bambu Lab access token (from Bambu Studio)"}),h.jsx("textarea",{value:u,onChange:w=>f(w.target.value),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-xs font-mono focus:border-bambu-green focus:outline-none resize-none",placeholder:"eyJ...",rows:3,required:!0})]}),h.jsxs("div",{className:"flex gap-2",children:[n==="code"&&h.jsx(lt,{type:"button",variant:"secondary",onClick:()=>i("email"),className:"flex-1",children:"Back"}),h.jsxs(lt,{type:"submit",disabled:M,className:"flex-1",children:[M?h.jsx(It,{className:"w-4 h-4 animate-spin"}):h.jsx(QU,{className:"w-4 h-4"}),n==="email"?"Login":n==="code"?"Verify":"Set Token"]})]}),n==="email"&&h.jsx("div",{className:"pt-4 border-t border-bambu-dark-tertiary",children:h.jsxs("button",{type:"button",onClick:()=>i("token"),className:"text-sm text-bambu-gray hover:text-white flex items-center gap-1",children:[h.jsx(Qse,{className:"w-3 h-3"}),"Use access token instead"]})}),n==="token"&&h.jsx("div",{className:"pt-4 border-t border-bambu-dark-tertiary",children:h.jsxs("button",{type:"button",onClick:()=>i("email"),className:"text-sm text-bambu-gray hover:text-white flex items-center gap-1",children:[h.jsx(QU,{className:"w-3 h-3"}),"Login with email instead"]})})]})})]})}function rVe({setting:t,onClick:e}){return h.jsxs("button",{onClick:e,className:"w-full text-left p-3 bg-bambu-dark rounded-lg hover:bg-bambu-dark-tertiary transition-colors",children:[h.jsx("p",{className:"text-white font-medium truncate",children:t.name}),t.updated_time&&h.jsxs("p",{className:"text-xs text-bambu-gray mt-1",children:["Updated: ",new Date(t.updated_time).toLocaleDateString()]})]})}function aVe({setting:t,onClose:e}){const{data:n,isLoading:i}=Ft({queryKey:["cloudSettingDetail",t.setting_id],queryFn:()=>Fe.getCloudSettingDetail(t.setting_id)});return h.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:h.jsx(Xt,{className:"w-full max-w-2xl max-h-[90vh] flex flex-col",children:h.jsxs(en,{className:"p-0 flex flex-col h-full",children:[h.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[h.jsxs("div",{children:[h.jsx("h2",{className:"text-xl font-semibold text-white",children:t.name}),h.jsxs("p",{className:"text-sm text-bambu-gray capitalize",children:[t.type," preset"]})]}),h.jsx("button",{onClick:e,className:"text-bambu-gray hover:text-white transition-colors",children:h.jsx(fn,{className:"w-5 h-5"})})]}),h.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:i?h.jsx("div",{className:"flex justify-center py-8",children:h.jsx(It,{className:"w-8 h-8 text-bambu-green animate-spin"})}):n?h.jsx("pre",{className:"text-xs text-bambu-gray font-mono whitespace-pre-wrap overflow-x-auto bg-bambu-dark p-4 rounded-lg",children:JSON.stringify(n,null,2)}):h.jsx("p",{className:"text-bambu-gray text-center py-8",children:"Failed to load preset details"})}),h.jsx("div",{className:"p-4 border-t border-bambu-dark-tertiary",children:h.jsx(lt,{variant:"secondary",onClick:e,className:"w-full",children:"Close"})})]})})})}function sVe({settings:t}){const[e,n]=E.useState(new Set),[i,r]=E.useState(null),a=l=>[...l].sort((c,u)=>c.name.localeCompare(u.name)),s=l=>{n(c=>{const u=new Set(c);return u.has(l)?u.delete(l):u.add(l),u})},o=[{key:"filament",label:"Filament Presets",icon:i9,items:a(t.filament)},{key:"printer",label:"Printer Presets",icon:mc,items:a(t.printer)},{key:"process",label:"Process Presets",icon:VP,items:a(t.process)}];return h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"space-y-4",children:o.map(({key:l,label:c,icon:u,items:f})=>h.jsxs(Xt,{children:[h.jsxs("button",{onClick:()=>s(l),className:"w-full flex items-center justify-between p-4",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx(u,{className:"w-5 h-5 text-bambu-green"}),h.jsx("span",{className:"text-lg font-semibold text-white",children:c}),h.jsxs("span",{className:"text-sm text-bambu-gray",children:["(",f.length,")"]})]}),e.has(l)?h.jsx(Gf,{className:"w-5 h-5 text-bambu-gray"}):h.jsx(Wf,{className:"w-5 h-5 text-bambu-gray"})]}),e.has(l)&&f.length>0&&h.jsx(en,{className:"pt-0",children:h.jsx("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-3",children:f.map(m=>h.jsx(rVe,{setting:m,onClick:()=>r(m)},m.setting_id))})}),e.has(l)&&f.length===0&&h.jsx(en,{className:"pt-0",children:h.jsx("p",{className:"text-bambu-gray text-sm",children:"No presets found"})})]},l))}),i&&h.jsx(aVe,{setting:i,onClose:()=>r(null)})]})}function oVe(){const t=Rn(),{showToast:e}=eo(),[n,i]=E.useState("kprofiles"),{data:r,isLoading:a}=Ft({queryKey:["cloudStatus"],queryFn:Fe.getCloudStatus}),{data:s,isLoading:o,refetch:l}=Ft({queryKey:["cloudSettings"],queryFn:()=>Fe.getCloudSettings(),enabled:!!r?.is_authenticated,retry:!1,staleTime:1e3*60*5}),c=yt({mutationFn:Fe.cloudLogout,onSuccess:()=>{t.invalidateQueries({queryKey:["cloudStatus"]}),t.removeQueries({queryKey:["cloudSettings"]}),e("Logged out")}}),u=()=>{t.invalidateQueries({queryKey:["cloudStatus"]})};return a?h.jsx("div",{className:"p-8 flex justify-center",children:h.jsx(It,{className:"w-8 h-8 text-bambu-green animate-spin"})}):h.jsxs("div",{className:"p-8",children:[h.jsxs("div",{className:"mb-6",children:[h.jsx("h1",{className:"text-2xl font-bold text-white",children:"Profiles"}),h.jsx("p",{className:"text-bambu-gray",children:"Manage your slicer presets and pressure advance calibrations"})]}),h.jsxs("div",{className:"flex border-b border-bambu-dark-tertiary mb-6",children:[h.jsxs("button",{onClick:()=>i("cloud"),className:`flex items-center gap-2 px-4 py-3 text-sm font-medium transition-colors border-b-2 -mb-px ${n==="cloud"?"text-bambu-green border-bambu-green":"text-bambu-gray hover:text-white border-transparent"}`,children:[h.jsx(zP,{className:"w-4 h-4"}),"Cloud Profiles"]}),h.jsxs("button",{onClick:()=>i("kprofiles"),className:`flex items-center gap-2 px-4 py-3 text-sm font-medium transition-colors border-b-2 -mb-px ${n==="kprofiles"?"text-bambu-green border-bambu-green":"text-bambu-gray hover:text-white border-transparent"}`,children:[h.jsx(BP,{className:"w-4 h-4"}),"K-Profiles"]})]}),n==="cloud"&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[h.jsx("p",{className:"text-bambu-gray",children:r?.is_authenticated?`Connected as ${r.email}`:"Connect to Bambu Cloud to access your slicer presets"}),r?.is_authenticated&&h.jsxs("div",{className:"flex gap-2",children:[h.jsxs(lt,{variant:"secondary",onClick:()=>l(),disabled:o,children:[h.jsx(el,{className:`w-4 h-4 ${o?"animate-spin":""}`}),"Refresh"]}),h.jsxs(lt,{variant:"secondary",onClick:()=>c.mutate(),disabled:c.isPending,children:[h.jsx(moe,{className:"w-4 h-4"}),"Logout"]})]})]}),r?.is_authenticated?o?h.jsx("div",{className:"flex justify-center py-12",children:h.jsx(It,{className:"w-8 h-8 text-bambu-green animate-spin"})}):s?h.jsx(sVe,{settings:s}):h.jsx(Xt,{children:h.jsxs(en,{className:"py-8 text-center",children:[h.jsx("p",{className:"text-bambu-gray",children:"Failed to load profiles"}),h.jsx(lt,{className:"mt-4",onClick:()=>l(),children:"Retry"})]})}):h.jsx(iVe,{onSuccess:u})]}),n==="kprofiles"&&h.jsx(nVe,{})]})}const TP={Droplet:i9,Flame:a9,Ruler:zoe,Sparkles:Qoe,Square:$p,Cable:Vae,Wrench:Gp};function I_(t){return t&&TP[t]||Gp}function jx(t){return t<1?`${Math.round(t*60)}m`:`${t.toFixed(1)}h`}function lVe(t){const e=Math.floor(t),n=Math.round((t-e)*60);return e===0?`${n} minutes`:n===0?`${e} hours`:`${e}h ${n}m`}function cVe({item:t,onPerform:e,onToggle:n}){const i=I_(t.maintenance_type_icon),r=Math.max(0,Math.min(100,(t.interval_hours-t.hours_until_due)/t.interval_hours*100)),a=()=>t.enabled?t.is_due?"text-red-400":t.is_warning?"text-yellow-400":"text-bambu-green":"text-bambu-gray",s=()=>t.enabled?t.is_due?"bg-red-500":t.is_warning?"bg-yellow-500":"bg-bambu-green":"bg-bambu-gray/30",o=()=>t.enabled?t.is_due?`Overdue by ${jx(Math.abs(t.hours_until_due))}`:t.is_warning?`Due in ${jx(t.hours_until_due)}`:`${jx(t.hours_until_due)} left`:"Disabled";return h.jsxs("div",{className:`flex items-center gap-4 p-3 rounded-lg ${t.is_due?"bg-red-500/10":t.is_warning?"bg-yellow-500/10":"bg-bambu-dark"}`,children:[h.jsxs("div",{className:"flex items-center gap-3 min-w-[180px]",children:[h.jsx(i,{className:`w-4 h-4 ${a()}`}),h.jsx("span",{className:`text-sm ${t.enabled?"text-white":"text-bambu-gray"}`,children:t.maintenance_type_name})]}),h.jsx("div",{className:"flex-1 max-w-[200px]",children:h.jsx("div",{className:"w-full h-1.5 bg-bambu-dark-tertiary rounded-full overflow-hidden",children:h.jsx("div",{className:`h-full transition-all ${s()}`,style:{width:`${r}%`}})})}),h.jsxs("div",{className:`text-xs min-w-[120px] ${a()}`,children:[t.is_due&&h.jsx(ya,{className:"w-3 h-3 inline mr-1"}),t.is_warning&&h.jsx(ba,{className:"w-3 h-3 inline mr-1"}),!t.is_due&&!t.is_warning&&t.enabled&&h.jsx(Hp,{className:"w-3 h-3 inline mr-1"}),o()]}),h.jsx(as,{checked:t.enabled,onChange:l=>n(t.id,l)}),h.jsxs(lt,{size:"sm",variant:t.is_due?"primary":"secondary",onClick:()=>e(t.id),disabled:!t.enabled,className:"min-w-[70px]",children:[h.jsx(nw,{className:"w-3 h-3"}),"Done"]})]})}function uVe({overview:t,onPerform:e,onToggle:n,onSetHours:i}){const[r,a]=E.useState(!1),[s,o]=E.useState(!1),[l,c]=E.useState(t.total_print_hours.toFixed(1)),u=[...t.maintenance_items].sort((g,b)=>g.maintenance_type_id-b.maintenance_type_id),f=[...t.maintenance_items].filter(g=>g.enabled).sort((g,b)=>g.is_due&&!b.is_due?-1:!g.is_due&&b.is_due?1:g.is_warning&&!b.is_warning?-1:!g.is_warning&&b.is_warning?1:g.hours_until_due-b.hours_until_due)[0],m=()=>{const g=parseFloat(l);!isNaN(g)&&g>=0&&(i(t.printer_id,g),o(!1))};return h.jsxs(Xt,{children:[h.jsxs("div",{className:"p-4",children:[h.jsxs("div",{className:"flex items-center justify-between mb-4",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("h2",{className:"text-lg font-semibold text-white",children:t.printer_name}),t.due_count>0&&h.jsxs("span",{className:"px-2.5 py-1 bg-red-500/20 text-red-400 text-xs font-medium rounded-full flex items-center gap-1",children:[h.jsx(ya,{className:"w-3 h-3"}),t.due_count," overdue"]}),t.warning_count>0&&h.jsxs("span",{className:"px-2.5 py-1 bg-yellow-500/20 text-yellow-400 text-xs font-medium rounded-full flex items-center gap-1",children:[h.jsx(ba,{className:"w-3 h-3"}),t.warning_count," due soon"]}),t.due_count===0&&t.warning_count===0&&h.jsxs("span",{className:"px-2.5 py-1 bg-bambu-green/20 text-bambu-green text-xs font-medium rounded-full flex items-center gap-1",children:[h.jsx(Hp,{className:"w-3 h-3"}),"All good"]})]}),h.jsx("button",{onClick:()=>a(!r),className:"flex items-center gap-1 px-3 py-1.5 text-sm text-bambu-gray hover:text-white hover:bg-bambu-dark rounded transition-colors",children:r?h.jsxs(h.Fragment,{children:[h.jsx(QS,{className:"w-4 h-4"}),"Hide"]}):h.jsxs(h.Fragment,{children:[h.jsx(Gf,{className:"w-4 h-4"}),"Details"]})})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[h.jsxs("div",{className:"p-3 bg-bambu-dark rounded-lg",children:[h.jsx("div",{className:"text-xs text-bambu-gray mb-1 uppercase tracking-wide",children:"Total Print Time"}),s?h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("input",{type:"number",value:l,onChange:g=>c(g.target.value),onKeyDown:g=>{g.key==="Enter"&&m(),g.key==="Escape"&&o(!1)},className:"w-20 px-2 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-lg font-semibold",min:"0",step:"1",autoFocus:!0}),h.jsx("span",{className:"text-sm text-bambu-gray",children:"hours"}),h.jsxs("div",{className:"flex gap-1 ml-auto",children:[h.jsx(lt,{size:"sm",onClick:m,children:"Save"}),h.jsx(lt,{size:"sm",variant:"secondary",onClick:()=>o(!1),children:"✕"})]})]}):h.jsxs("button",{onClick:()=>{c(Math.round(t.total_print_hours).toString()),o(!0)},className:"flex items-center gap-2 group",title:"Click to edit total print hours",children:[h.jsx("span",{className:"text-xl font-semibold text-white group-hover:text-bambu-green transition-colors",children:lVe(t.total_print_hours)}),h.jsx($P,{className:"w-4 h-4 text-bambu-gray group-hover:text-bambu-green transition-colors"})]})]}),h.jsxs("div",{className:`p-3 rounded-lg ${f?.is_due?"bg-red-500/10":f?.is_warning?"bg-yellow-500/10":"bg-bambu-dark"}`,children:[h.jsx("div",{className:"text-xs text-bambu-gray mb-1 uppercase tracking-wide",children:"Next Maintenance"}),f?h.jsxs("div",{children:[h.jsx("div",{className:`text-lg font-semibold ${f.is_due?"text-red-400":f.is_warning?"text-yellow-400":"text-white"}`,children:f.maintenance_type_name}),h.jsx("div",{className:`text-sm ${f.is_due?"text-red-400":f.is_warning?"text-yellow-400":"text-bambu-gray"}`,children:f.is_due?h.jsxs(h.Fragment,{children:["Overdue by ",jx(Math.abs(f.hours_until_due))]}):h.jsxs(h.Fragment,{children:["Due in ",jx(f.hours_until_due)]})})]}):h.jsx("div",{className:"text-white",children:"No tasks enabled"})]})]})]}),r&&h.jsx(en,{className:"pt-0 space-y-2 border-t border-bambu-dark-tertiary mt-4",children:h.jsx("div",{className:"pt-4",children:u.map(g=>h.jsx(cVe,{item:g,onPerform:e,onToggle:n},g.id))})})]})}function dVe({overview:t,types:e,onUpdateInterval:n,onAddType:i,onDeleteType:r}){const[a,s]=E.useState(null),[o,l]=E.useState(""),[c,u]=E.useState(!1),[f,m]=E.useState(""),[g,b]=E.useState("100"),[y,v]=E.useState("Wrench"),x=(R,N)=>{const j=parseFloat(o);if(!isNaN(j)&&j>0){const C=Math.abs(j-N)<.01?null:j;n(R,C)}s(null)},M=R=>{R.preventDefault(),f.trim()&&parseFloat(g)>0&&(i({name:f.trim(),default_interval_hours:parseFloat(g),icon:y}),m(""),b("100"),u(!1))},w=t?.map(R=>({printerId:R.printer_id,printerName:R.printer_name,items:R.maintenance_items.sort((N,j)=>N.maintenance_type_id-j.maintenance_type_id)})).sort((R,N)=>R.printerName.localeCompare(N.printerName))||[],A=e.filter(R=>R.is_system),T=e.filter(R=>!R.is_system);return h.jsxs("div",{className:"space-y-8",children:[h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center justify-between mb-4",children:[h.jsx("h2",{className:"text-lg font-semibold text-white",children:"Maintenance Types"}),h.jsxs(lt,{size:"sm",variant:"secondary",onClick:()=>u(!c),children:[h.jsx(Jo,{className:"w-4 h-4"}),"Add Custom Type"]})]}),c&&h.jsx(Xt,{className:"mb-4",children:h.jsx("div",{className:"p-4",children:h.jsx("form",{onSubmit:M,children:h.jsxs("div",{className:"flex gap-3 items-end",children:[h.jsxs("div",{className:"flex-1",children:[h.jsx("label",{className:"block text-xs text-bambu-gray mb-1",children:"Name"}),h.jsx("input",{type:"text",value:f,onChange:R=>m(R.target.value),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm",placeholder:"e.g., Replace HEPA Filter",autoFocus:!0})]}),h.jsxs("div",{className:"w-28",children:[h.jsx("label",{className:"block text-xs text-bambu-gray mb-1",children:"Interval (hours)"}),h.jsx("input",{type:"number",value:g,onChange:R=>b(R.target.value),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm",min:"1"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-xs text-bambu-gray mb-1",children:"Icon"}),h.jsx("div",{className:"flex gap-1",children:Object.keys(TP).map(R=>{const N=TP[R];return h.jsx("button",{type:"button",onClick:()=>v(R),className:`p-2 rounded ${y===R?"bg-bambu-green text-white":"bg-bambu-dark-tertiary text-bambu-gray hover:text-white"}`,children:h.jsx(N,{className:"w-4 h-4"})},R)})})]}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx(lt,{type:"submit",size:"sm",disabled:!f.trim(),children:"Add"}),h.jsx(lt,{type:"button",size:"sm",variant:"secondary",onClick:()=>u(!1),children:"Cancel"})]})]})})})}),h.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:[A.map(R=>{const N=I_(R.icon);return h.jsx("div",{className:"bg-bambu-dark-secondary rounded-lg p-4 border border-bambu-dark-tertiary",children:h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:"p-2 bg-bambu-dark rounded-lg",children:h.jsx(N,{className:"w-5 h-5 text-bambu-gray"})}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("div",{className:"text-sm font-medium text-white truncate",children:R.name}),h.jsxs("div",{className:"text-xs text-bambu-gray mt-0.5",children:[R.default_interval_hours,"h interval"]})]})]})},R.id)}),T.map(R=>{const N=I_(R.icon);return h.jsx("div",{className:"bg-bambu-dark-secondary rounded-lg p-4 border border-bambu-green/30",children:h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:"p-2 bg-bambu-green/20 rounded-lg",children:h.jsx(N,{className:"w-5 h-5 text-bambu-green"})}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-sm font-medium text-white truncate",children:R.name}),h.jsx("span",{className:"px-1.5 py-0.5 bg-bambu-green/20 text-bambu-green text-[10px] font-medium rounded",children:"Custom"})]}),h.jsxs("div",{className:"text-xs text-bambu-gray mt-0.5",children:[R.default_interval_hours,"h interval"]})]}),h.jsx("button",{onClick:()=>{confirm(`Delete "${R.name}"?`)&&r(R.id)},className:"p-1.5 rounded hover:bg-bambu-dark text-bambu-gray hover:text-red-400 transition-colors",children:h.jsx(aa,{className:"w-4 h-4"})})]})},R.id)})]})]}),w.length>0&&h.jsxs("div",{children:[h.jsx("h2",{className:"text-lg font-semibold text-white mb-2",children:"Interval Overrides"}),h.jsx("p",{className:"text-sm text-bambu-gray mb-4",children:"Set custom intervals per printer."}),h.jsx("div",{className:"space-y-3",children:w.map(R=>h.jsx(Xt,{children:h.jsxs("div",{className:"p-4",children:[h.jsx("h3",{className:"text-sm font-medium text-white mb-3",children:R.printerName}),h.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-2",children:R.items.map(N=>{const j=I_(N.maintenance_type_icon),k=e.find(I=>I.id===N.maintenance_type_id)?.default_interval_hours||N.interval_hours,F=a===N.id;return h.jsxs("div",{className:"flex items-center gap-2 p-2 bg-bambu-dark rounded-lg",children:[h.jsx(j,{className:"w-4 h-4 text-bambu-gray shrink-0"}),h.jsx("span",{className:"text-xs text-bambu-gray flex-1 truncate",children:N.maintenance_type_name}),F?h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("input",{type:"number",value:o,onChange:I=>l(I.target.value),onKeyDown:I=>{I.key==="Enter"&&x(N.id,k),I.key==="Escape"&&s(null)},className:"w-16 px-2 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-xs",min:"1",autoFocus:!0}),h.jsx(lt,{size:"sm",onClick:()=>x(N.id,k),children:"OK"})]}):h.jsxs("button",{onClick:()=>{s(N.id),l(N.interval_hours.toString())},className:"px-2 py-1 bg-bambu-dark-tertiary hover:bg-bambu-dark-secondary border border-bambu-dark-tertiary hover:border-bambu-green rounded text-xs font-medium text-white transition-colors",children:[N.interval_hours,"h",h.jsx($P,{className:"w-3 h-3 inline ml-1.5 text-bambu-gray"})]})]},N.id)})})]})},R.printerId))})]}),w.length===0&&h.jsx(Xt,{children:h.jsxs(en,{className:"text-center py-12",children:[h.jsx(ba,{className:"w-12 h-12 mx-auto mb-4 text-bambu-gray/30"}),h.jsx("p",{className:"text-bambu-gray",children:"No printers configured"}),h.jsx("p",{className:"text-sm text-bambu-gray/70 mt-1",children:"Add printers to configure maintenance intervals"})]})})]})}function fVe(){const t=Rn(),{showToast:e}=eo(),[n,i]=E.useState("status"),{data:r,isLoading:a}=Ft({queryKey:["maintenanceOverview"],queryFn:Fe.getMaintenanceOverview}),{data:s}=Ft({queryKey:["maintenanceTypes"],queryFn:Fe.getMaintenanceTypes}),o=yt({mutationFn:({id:x,notes:M})=>Fe.performMaintenance(x,M),onSuccess:()=>{t.invalidateQueries({queryKey:["maintenanceOverview"]}),t.invalidateQueries({queryKey:["maintenanceSummary"]}),e("Maintenance marked as done")},onError:x=>{e(x.message,"error")}}),l=yt({mutationFn:({id:x,data:M})=>Fe.updateMaintenanceItem(x,M),onSuccess:()=>{t.invalidateQueries({queryKey:["maintenanceOverview"]})},onError:x=>{e(x.message,"error")}}),c=yt({mutationFn:Fe.createMaintenanceType,onSuccess:()=>{t.invalidateQueries({queryKey:["maintenanceTypes"]}),t.invalidateQueries({queryKey:["maintenanceOverview"]}),e("Maintenance type added")},onError:x=>{e(x.message,"error")}}),u=yt({mutationFn:Fe.deleteMaintenanceType,onSuccess:()=>{t.invalidateQueries({queryKey:["maintenanceTypes"]}),t.invalidateQueries({queryKey:["maintenanceOverview"]}),e("Maintenance type deleted")},onError:x=>{e(x.message,"error")}}),f=yt({mutationFn:({printerId:x,hours:M})=>Fe.setPrinterHours(x,M),onSuccess:()=>{t.invalidateQueries({queryKey:["maintenanceOverview"]}),t.invalidateQueries({queryKey:["maintenanceSummary"]}),e("Print hours updated")},onError:x=>{e(x.message,"error")}}),m=x=>{o.mutate({id:x})},g=(x,M)=>{l.mutate({id:x,data:{enabled:M}})},b=(x,M)=>{f.mutate({printerId:x,hours:M})};if(a)return h.jsx("div",{className:"p-8 flex justify-center",children:h.jsx(It,{className:"w-8 h-8 text-bambu-green animate-spin"})});const y=r?.reduce((x,M)=>x+M.due_count,0)||0,v=r?.reduce((x,M)=>x+M.warning_count,0)||0;return h.jsxs("div",{className:"p-8",children:[h.jsxs("div",{className:"mb-6",children:[h.jsx("h1",{className:"text-2xl font-bold text-white",children:"Maintenance"}),h.jsx("p",{className:"text-bambu-gray text-sm",children:n==="status"?h.jsxs(h.Fragment,{children:[y>0&&h.jsxs("span",{className:"text-red-400",children:[y," tasks overdue"]}),y>0&&v>0&&" · ",v>0&&h.jsxs("span",{className:"text-yellow-400",children:[v," due soon"]}),y===0&&v===0&&"All maintenance up to date"]}):"Configure maintenance types and intervals"})]}),h.jsxs("div",{className:"flex gap-1 mb-6 border-b border-bambu-dark-tertiary",children:[h.jsx("button",{onClick:()=>i("status"),className:`px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors ${n==="status"?"text-bambu-green border-bambu-green":"text-bambu-gray border-transparent hover:text-white"}`,children:"Status"}),h.jsx("button",{onClick:()=>i("settings"),className:`px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors ${n==="settings"?"text-bambu-green border-bambu-green":"text-bambu-gray border-transparent hover:text-white"}`,children:"Settings"})]}),n==="status"?h.jsx("div",{className:"space-y-4",children:r&&r.length>0?[...r].sort((x,M)=>x.printer_name.localeCompare(M.printer_name)).map(x=>h.jsx(uVe,{overview:x,onPerform:m,onToggle:g,onSetHours:b},x.printer_id)):h.jsx(Xt,{children:h.jsxs(en,{className:"text-center py-12",children:[h.jsx(Gp,{className:"w-12 h-12 mx-auto mb-4 text-bambu-gray/30"}),h.jsx("p",{className:"text-bambu-gray",children:"No printers configured"}),h.jsx("p",{className:"text-sm text-bambu-gray/70 mt-1",children:"Add printers to start tracking maintenance"})]})})}):h.jsx(dVe,{overview:r,types:s||[],onUpdateInterval:(x,M)=>l.mutate({id:x,data:{custom_interval_hours:M}}),onAddType:x=>c.mutate(x),onDeleteType:x=>u.mutate(x)})]})}function hVe({printerId:t,isConnected:e}){const[n,i]=E.useState(!1),[r,a]=E.useState(!1),[s,o]=E.useState(null),l=E.useRef(null),c=Fe.getCameraStreamUrl(t,10),u=()=>{n?(i(!1),o(null)):(a(!0),o(null),i(!0))},f=()=>{a(!1),o(null)},m=()=>{a(!1),o("Failed to load camera stream")},g=()=>{l.current&&(document.fullscreenElement?document.exitFullscreen():l.current.requestFullscreen())},b=()=>{i(!1),setTimeout(()=>{a(!0),i(!0)},100)};return h.jsx("div",{className:"relative w-full h-full bg-black",children:n?h.jsxs(h.Fragment,{children:[r&&h.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:h.jsx(It,{className:"w-8 h-8 animate-spin text-bambu-green"})}),s?h.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-red-400",children:[h.jsx(Kae,{className:"w-12 h-12 mb-2"}),h.jsx("span",{className:"text-sm",children:s}),h.jsx("button",{onClick:b,className:"mt-2 text-xs text-bambu-green hover:underline",children:"Retry"})]}):h.jsx("img",{ref:l,src:c,alt:"Camera stream",className:"w-full h-full object-contain",onLoad:f,onError:m}),h.jsxs("div",{className:"absolute top-2 right-2 flex gap-2",children:[h.jsx("button",{onClick:b,className:"p-2 rounded bg-gray-500 hover:bg-gray-400 text-white transition-colors shadow-lg",title:"Refresh stream",children:h.jsx(el,{className:"w-4 h-4"})}),h.jsx("button",{onClick:g,className:"p-2 rounded bg-gray-500 hover:bg-gray-400 text-white transition-colors shadow-lg",title:"Fullscreen",children:h.jsx(u9,{className:"w-4 h-4"})}),h.jsx("button",{onClick:u,className:"px-3 py-1.5 rounded bg-red-600 hover:bg-red-500 text-white text-sm transition-colors shadow-lg",children:"Stop"})]})]}):h.jsx("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-bambu-gray",children:h.jsxs("div",{className:"bg-bambu-dark-secondary rounded-lg p-6 flex flex-col items-center",children:[h.jsx($_,{className:"w-8 h-8 mb-2"}),h.jsx("span",{className:"text-sm mb-3",children:e?"Click Start to view camera":"Printer not connected"}),h.jsx("button",{onClick:u,disabled:!e,className:"px-4 py-1.5 rounded text-sm bg-bambu-green text-white hover:bg-bambu-green-dark disabled:opacity-50 disabled:cursor-not-allowed",children:"Start"})]})})})}function pVe(t){if(!t)return"N/A";const e=new Date;return new Date(e.getTime()+t*1e3).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function mVe({printerId:t,status:e}){const n=Rn(),[i,r]=E.useState(null),a=e?.connected??!1,s=e?.state==="RUNNING",o=e?.state==="PAUSE",l=e?.progress??0,c=yt({mutationFn:()=>Fe.pausePrint(t),onSuccess:()=>{n.invalidateQueries({queryKey:["printerStatuses"]})}}),u=yt({mutationFn:()=>Fe.resumePrint(t),onSuccess:()=>{n.invalidateQueries({queryKey:["printerStatuses"]})}}),f=yt({mutationFn:x=>Fe.stopPrint(t,x),onSuccess:x=>{Wx(x)?r({action:"stop",token:x.token,warning:x.warning}):n.invalidateQueries({queryKey:["printerStatuses"]})}}),m=()=>{s?c.mutate():o&&u.mutate()},g=()=>{f.mutate(void 0)},b=()=>{i&&(f.mutate(i.token),r(null))},y=c.isPending||u.isPending||f.isPending,v=a&&(s||o);return h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"text-xs text-bambu-gray mb-3",children:"Printing Progress"}),h.jsxs("div",{className:"flex gap-4 items-center",children:[h.jsx("div",{className:"w-20 h-20 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg flex items-center justify-center flex-shrink-0 overflow-hidden",children:e?.subtask_name?h.jsx("img",{src:`/api/v1/archives/thumbnail/${encodeURIComponent(e.subtask_name)}`,alt:"",className:"w-full h-full object-contain",onError:x=>{x.target.style.display="none",x.target.parentElement.innerHTML='Bambu Lab '}}):h.jsxs("span",{className:"text-xs text-bambu-gray text-center",children:["Bambu",h.jsx("br",{}),"Lab"]})}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("div",{className:"font-medium text-sm text-white truncate mb-0.5",children:e?.subtask_name||"N/A"}),h.jsx("div",{className:`text-sm mb-2 ${e?.state==="RUNNING"||e?.state==="PAUSE"?"text-bambu-green":"text-bambu-gray"}`,children:e?.state||"N/A"}),h.jsx("div",{className:"h-1 bg-bambu-dark-tertiary rounded-full overflow-hidden mb-2",children:h.jsx("div",{className:`h-full transition-all duration-300 ${e?.state==="PAUSE"?"bg-yellow-500":"bg-bambu-green"}`,style:{width:`${l}%`}})}),h.jsxs("div",{className:"text-xs text-bambu-gray mb-1",children:["Layer: ",e?.layer_num??"N/A"," / ",e?.total_layers??"N/A"," ",Math.round(l),"%"]}),h.jsxs("div",{className:"text-xs text-bambu-gray",children:["Estimated finish time: ",pVe(e?.remaining_time)]})]}),h.jsxs("div",{className:"flex gap-1.5 flex-shrink-0",children:[h.jsx("button",{onClick:m,disabled:!v||y,className:"w-8 h-8 rounded-md border border-bambu-dark-tertiary bg-bambu-dark-secondary hover:bg-bambu-dark-tertiary flex items-center justify-center text-bambu-gray disabled:opacity-50 disabled:cursor-not-allowed",title:s?"Pause":"Resume",children:c.isPending||u.isPending?h.jsx(It,{className:"w-4 h-4 animate-spin"}):h.jsx(d9,{className:"w-4 h-4"})}),h.jsx("button",{onClick:g,disabled:!v||y,className:"w-8 h-8 rounded-md border border-bambu-dark-tertiary bg-bambu-dark-secondary hover:bg-bambu-dark-tertiary flex items-center justify-center text-bambu-gray disabled:opacity-50 disabled:cursor-not-allowed",title:"Stop",children:f.isPending?h.jsx(It,{className:"w-4 h-4 animate-spin"}):h.jsx($p,{className:"w-4 h-4"})}),h.jsx("button",{disabled:!v||y,className:"w-8 h-8 rounded-md border border-bambu-dark-tertiary bg-bambu-dark-secondary hover:bg-bambu-dark-tertiary flex items-center justify-center text-bambu-gray disabled:opacity-50 disabled:cursor-not-allowed",title:"Skip Objects",children:h.jsx("img",{src:"/icons/skip-objects.svg",alt:"Skip Objects",className:"w-4 h-4 icon-theme"})})]})]}),(c.error||u.error||f.error)&&h.jsx("p",{className:"mt-2 text-xs text-red-500",children:(c.error||u.error||f.error)?.message}),i&&h.jsx(rr,{title:"Confirm Stop",message:i.warning,confirmText:"Stop Print",variant:"danger",onConfirm:b,onCancel:()=>r(null)})]})}function gVe({checked:t,onChange:e,disabled:n}){return h.jsx("button",{onClick:()=>!n&&e(!t),disabled:n,className:`w-11 h-6 rounded-full relative transition-all shadow-inner border ${t?"bg-bambu-green border-bambu-green":"bg-bambu-dark-tertiary border-bambu-dark-tertiary"} ${n?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:h.jsx("div",{className:`w-5 h-5 rounded-full bg-white shadow-md absolute top-0.5 transition-transform ${t?"translate-x-5":"translate-x-0.5"}`})})}function xN({name:t,icon:e,speed:n,enabled:i,onToggle:r,onSpeedChange:a,disabled:s,showSpeedControl:o=!0}){const l=()=>{const u=Math.min(100,n+10);a(u)},c=()=>{const u=Math.max(0,n-10);a(u)};return h.jsxs("div",{className:"bg-bambu-dark rounded-xl p-4 shadow-lg border border-bambu-dark-tertiary/50",children:[h.jsxs("div",{className:"flex items-center justify-between mb-4",children:[h.jsxs("div",{className:"flex items-center gap-2.5",children:[h.jsx("div",{className:"w-8 h-8 rounded-lg bg-bambu-dark-tertiary flex items-center justify-center",children:e}),h.jsx("span",{className:"text-white font-medium",children:t})]}),o&&h.jsx(gVe,{checked:i,onChange:r,disabled:s})]}),o?h.jsxs("div",{className:"flex items-center justify-between bg-bambu-dark-secondary rounded-lg p-2",children:[h.jsx("button",{onClick:c,disabled:s||!i,className:"w-9 h-9 rounded-lg bg-bambu-dark-tertiary flex items-center justify-center text-white hover:bg-bambu-dark transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:h.jsx(yoe,{className:"w-4 h-4"})}),h.jsx("div",{className:"flex-1 text-center",children:h.jsxs("span",{className:`text-xl font-semibold ${i?"text-white":"text-bambu-gray"}`,children:[n,"%"]})}),h.jsx("button",{onClick:l,disabled:s||!i,className:"w-9 h-9 rounded-lg bg-bambu-dark-tertiary flex items-center justify-center text-white hover:bg-bambu-dark transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:h.jsx(Jo,{className:"w-4 h-4"})})]}):h.jsx("div",{className:"p-3 text-center",children:h.jsx("span",{className:"text-xl font-semibold text-bambu-green",children:i?"Auto":"Off"})})]})}function xVe({onConfirm:t,onCancel:e}){return h.jsx("div",{className:"absolute inset-0 bg-black/80 flex items-center justify-center z-10 rounded-2xl",children:h.jsxs("div",{className:"bg-bambu-dark-secondary rounded-xl p-5 m-4 max-w-sm border border-bambu-dark-tertiary shadow-xl",children:[h.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[h.jsx("div",{className:"w-10 h-10 rounded-full bg-yellow-500/20 flex items-center justify-center flex-shrink-0",children:h.jsx(ya,{className:"w-5 h-5 text-yellow-500"})}),h.jsxs("div",{children:[h.jsx("h3",{className:"text-white font-semibold",children:"Print in Progress"}),h.jsx("p",{className:"text-sm text-bambu-gray",children:"The printer is currently controlling air conditioning."})]})]}),h.jsx("p",{className:"text-sm text-bambu-gray mb-5",children:"Changing these settings during a print may affect print quality. Are you sure you want to continue?"}),h.jsxs("div",{className:"flex gap-3",children:[h.jsx("button",{onClick:e,className:"flex-1 py-2.5 px-4 rounded-lg font-medium text-sm bg-bambu-dark-tertiary text-white hover:bg-bambu-dark transition-colors",children:"Cancel"}),h.jsx("button",{onClick:t,className:"flex-1 py-2.5 px-4 rounded-lg font-medium text-sm bg-yellow-600 text-white hover:bg-yellow-700 transition-colors",children:"Continue"})]})]})})}function vVe({printer:t,status:e,onClose:n}){const i=e?.connected??!1,r=e?.state==="RUNNING"||e?.state==="PRINTING",a=!i,s=(e?.airduct_mode??0)===1?"heating":"cooling",[o,l]=E.useState(s),[c,u]=E.useState(!1),[f,m]=E.useState(null),[g,b]=E.useState(!1),[y,v]=E.useState(0),[x,M]=E.useState(!1),[w,A]=E.useState(0),[T,R]=E.useState(!1),[N,j]=E.useState(0),C=yt({mutationFn:Q=>Fe.setAirductMode(t.id,Q)}),k=yt({mutationFn:Q=>Fe.setPartFan(t.id,Q)}),F=yt({mutationFn:Q=>Fe.setAuxFan(t.id,Q)}),I=yt({mutationFn:Q=>Fe.setChamberFan(t.id,Q)}),G=Q=>{r?(m(()=>Q),u(!0)):Q()},O=()=>{f&&(f(),m(null)),u(!1)},B=()=>{m(null),u(!1)},$=Q=>{Q!==o&&G(()=>{l(Q),C.mutate(Q)})},V=Q=>{G(()=>{b(Q),Q||(v(0),k.mutate(0))})},K=Q=>{G(()=>{v(Q),b(Q>0),k.mutate(Q)})},Y=Q=>{G(()=>{M(Q),Q||(A(0),F.mutate(0))})},se=Q=>{G(()=>{A(Q),M(Q>0),F.mutate(Q)})},H=Q=>{G(()=>{R(Q),Q||(j(0),I.mutate(0))})},X=Q=>{G(()=>{j(Q),R(Q>0),I.mutate(Q)})};E.useEffect(()=>{const Q=xe=>{xe.key==="Escape"&&(c?B():n())};return window.addEventListener("keydown",Q),()=>window.removeEventListener("keydown",Q)},[n,c]);const ae={cooling:"Suitable for PLA, PETG, TPU. Filters and cools the chamber air.",heating:"Suitable for ABS, ASA, PC, PA. Circulates and heats chamber air."},le=()=>h.jsx("img",{src:"/icons/ventilation.svg",alt:"",className:"w-5 h-5 icon-theme"}),de=()=>h.jsx("img",{src:"/icons/chamber.svg",alt:"",className:"w-5 h-5 icon-theme"});return h.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4",onClick:n,children:h.jsxs("div",{className:"relative w-full max-w-lg bg-bambu-dark-secondary rounded-2xl shadow-2xl border border-bambu-dark-tertiary overflow-hidden",onClick:Q=>Q.stopPropagation(),children:[c&&h.jsx(xVe,{onConfirm:O,onCancel:B}),h.jsxs("div",{className:"flex items-center justify-between px-5 py-4 bg-bambu-dark border-b border-bambu-dark-tertiary",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:"w-8 h-8 rounded-lg bg-bambu-green/20 flex items-center justify-center",children:h.jsx("img",{src:"/icons/ventilation.svg",alt:"",className:"w-5 h-5 icon-green"})}),h.jsx("span",{className:"text-base font-semibold text-white",children:"Air Condition"})]}),h.jsx("button",{onClick:n,className:"w-8 h-8 rounded-lg flex items-center justify-center text-bambu-gray hover:bg-bambu-dark-tertiary hover:text-white transition-colors",children:h.jsx(fn,{className:"w-5 h-5"})})]}),h.jsxs("div",{className:"p-5 space-y-5",children:[r&&h.jsxs("div",{className:"flex items-center gap-2 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[h.jsx(ya,{className:"w-4 h-4 text-yellow-500 flex-shrink-0"}),h.jsx("span",{className:"text-xs text-yellow-500",children:"Print in progress. Changes may affect print quality."})]}),h.jsxs("div",{className:"bg-bambu-dark rounded-xl p-1.5 flex gap-1.5 shadow-inner",children:[h.jsxs("button",{onClick:()=>$("cooling"),disabled:a||C.isPending,className:`flex-1 py-3 px-4 rounded-lg flex items-center justify-center gap-2 font-medium transition-all disabled:opacity-50 ${o==="cooling"?"bg-bambu-green text-white shadow-lg":"text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary"}`,children:[h.jsx(kle,{className:"w-4 h-4"}),"Cooling"]}),h.jsxs("button",{onClick:()=>$("heating"),disabled:a||C.isPending,className:`flex-1 py-3 px-4 rounded-lg flex items-center justify-center gap-2 font-medium transition-all disabled:opacity-50 ${o==="heating"?"bg-bambu-green text-white shadow-lg":"text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary"}`,children:[h.jsx(a9,{className:"w-4 h-4"}),"Heating"]})]}),h.jsx("p",{className:"text-sm text-bambu-gray text-center px-2",children:ae[o]}),h.jsx("div",{className:"border-t border-bambu-dark-tertiary"}),h.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[h.jsx(xN,{name:"Part",icon:h.jsx(le,{}),speed:y,enabled:g,onToggle:V,onSpeedChange:K,disabled:a,showSpeedControl:!0}),h.jsx(xN,{name:"Aux",icon:h.jsx(le,{}),speed:w,enabled:x,onToggle:Y,onSpeedChange:se,disabled:a,showSpeedControl:o==="cooling"}),h.jsx(xN,{name:"Exhaust",icon:h.jsx(le,{}),speed:N,enabled:T,onToggle:H,onSpeedChange:X,disabled:a,showSpeedControl:o==="cooling"}),h.jsxs("div",{className:"bg-bambu-dark rounded-xl p-4 shadow-lg border border-bambu-dark-tertiary/50",children:[h.jsxs("div",{className:"flex items-center gap-2.5 mb-4",children:[h.jsx("div",{className:"w-8 h-8 rounded-lg bg-bambu-dark-tertiary flex items-center justify-center",children:h.jsx(de,{})}),h.jsx("span",{className:"text-white font-medium",children:"Heat"})]}),h.jsx("div",{className:"p-3 text-center",children:h.jsx("span",{className:"text-xl font-semibold text-bambu-green",children:o==="heating"?"Auto":"Off"})})]})]})]})]})})}const bVe=[{mode:1,name:"Silent",description:"Quieter printing, slower speed",percentage:"50%"},{mode:2,name:"Standard",description:"Balanced speed and quality",percentage:"100%"},{mode:3,name:"Sport",description:"Faster printing, moderate noise",percentage:"124%"},{mode:4,name:"Ludicrous",description:"Maximum speed",percentage:"166%"}];function yVe({printer:t,status:e,onClose:n}){const i=e?.connected??!1,r=e?.state==="RUNNING"||e?.state==="PRINTING",a=!i||!r,s=e?.speed_level??2,[o,l]=E.useState(s),c=yt({mutationFn:f=>Fe.setPrintSpeed(t.id,f)}),u=f=>{f===o||a||(l(f),c.mutate(f))};return E.useEffect(()=>{const f=m=>{m.key==="Escape"&&n()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[n]),h.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4",onClick:n,children:h.jsxs("div",{className:"relative w-full max-w-lg bg-bambu-dark-secondary rounded-2xl shadow-2xl border border-bambu-dark-tertiary overflow-hidden",onClick:f=>f.stopPropagation(),children:[h.jsxs("div",{className:"flex items-center justify-between px-5 py-4 bg-bambu-dark border-b border-bambu-dark-tertiary",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:"w-8 h-8 rounded-lg bg-bambu-green/20 flex items-center justify-center",children:h.jsx("img",{src:"/icons/speed.svg",alt:"",className:"w-5 h-5 icon-green"})}),h.jsx("span",{className:"text-base font-semibold text-white",children:"Print Speed"})]}),h.jsx("button",{onClick:n,className:"w-8 h-8 rounded-lg flex items-center justify-center text-bambu-gray hover:bg-bambu-dark-tertiary hover:text-white transition-colors",children:h.jsx(fn,{className:"w-5 h-5"})})]}),h.jsxs("div",{className:"p-5 space-y-4",children:[r?h.jsxs("div",{className:"flex items-center gap-2 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[h.jsx(ya,{className:"w-4 h-4 text-yellow-500 flex-shrink-0"}),h.jsx("span",{className:"text-xs text-yellow-500",children:"Speed changes take effect immediately."})]}):h.jsxs("div",{className:"flex items-center gap-2 p-3 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg",children:[h.jsx(ya,{className:"w-4 h-4 text-bambu-gray flex-shrink-0"}),h.jsx("span",{className:"text-xs text-bambu-gray",children:"No print in progress. Speed can only be changed during printing."})]}),h.jsx("div",{className:"space-y-2",children:bVe.map(f=>h.jsxs("button",{onClick:()=>u(f.mode),disabled:a||c.isPending,className:`w-full p-4 rounded-xl flex items-center justify-between transition-all disabled:opacity-50 disabled:cursor-not-allowed ${o===f.mode?"bg-bambu-green text-white shadow-lg":"bg-bambu-dark text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary border border-bambu-dark-tertiary"}`,children:[h.jsxs("div",{className:"flex flex-col items-start",children:[h.jsx("span",{className:"font-medium",children:f.name}),h.jsx("span",{className:`text-xs ${o===f.mode?"text-white/80":"text-bambu-gray"}`,children:f.description})]}),h.jsx("span",{className:`text-lg font-semibold ${o===f.mode?"text-white":"text-bambu-gray"}`,children:f.percentage})]},f.mode))})]})]})})}function _Ve({printer:t,status:e,disabled:n=!1}){const i=e?.temperatures??{},r=t.nozzle_count>1,a=(e?.connected??!1)&&!n,[s,o]=E.useState(null),[l,c]=E.useState(""),[u,f]=E.useState(!1),[m,g]=E.useState(!1),b=yt({mutationFn:I=>Fe.setBedTemperature(t.id,I)}),y=yt({mutationFn:({target:I,nozzle:G})=>Fe.setNozzleTemperature(t.id,I,G)}),v=yt({mutationFn:I=>Fe.setChamberTemperature(t.id,I)}),x=yt({mutationFn:I=>Fe.setChamberLight(t.id,I)}),M=(I,G)=>{a&&(o(I),c(String(Math.round(G))))},w=()=>{o(null),c("")},A=()=>{const I=parseInt(l,10);if(isNaN(I)||I<0){w();return}s==="bed"?b.mutate(I):s==="nozzle"?y.mutate({target:I,nozzle:r?1:0}):s==="nozzle_2"?y.mutate({target:I,nozzle:0}):s==="chamber"&&v.mutate(I),w()},T=I=>{I.key==="Enter"?A():I.key==="Escape"&&w()},R=!a,N=i.nozzle_heating??!1,j=i.nozzle_2_heating??!1,C=i.bed_heating??!1,k=i.chamber_heating??!1,F=(I,G)=>s===I?h.jsx("input",{type:"text",inputMode:"numeric",pattern:"[0-9]*",value:l,onChange:O=>{const B=O.target.value.replace(/[^0-9]/g,"");c(B)},onBlur:A,onKeyDown:T,autoFocus:!0,className:"w-12 text-sm bg-bambu-dark border border-bambu-green rounded px-1 py-0.5 text-white text-center [appearance:textfield]"}):h.jsxs("button",{onClick:()=>M(I,G),disabled:R,className:"text-sm text-bambu-gray hover:text-bambu-green disabled:hover:text-bambu-gray disabled:cursor-not-allowed",title:R?"Printer not connected":"Click to set target temperature",children:["/",Math.round(G)," °C"]});return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex flex-col justify-evenly min-w-[150px] pr-5 border-r border-bambu-dark-tertiary",children:[h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("div",{className:"w-5 h-5 flex items-center justify-center flex-shrink-0",children:h.jsx("img",{src:"/icons/hotend.svg",alt:"",className:`w-5 ${N?"icon-heating":"icon-theme"}`})}),r&&h.jsx("span",{className:"text-[11px] font-semibold text-bambu-green bg-bambu-green/20 px-1.5 py-0.5 rounded min-w-[18px] text-center flex-shrink-0",children:"L"}),h.jsx("span",{className:"text-lg font-medium text-white",children:Math.round(i.nozzle??0)}),F("nozzle",i.nozzle_target??0)]}),r&&h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("div",{className:"w-5 h-5 flex items-center justify-center flex-shrink-0",children:h.jsx("img",{src:"/icons/hotend.svg",alt:"",className:`w-5 ${j?"icon-heating":"icon-theme"}`})}),h.jsx("span",{className:"text-[11px] font-semibold text-bambu-green bg-bambu-green/20 px-1.5 py-0.5 rounded min-w-[18px] text-center flex-shrink-0",children:"R"}),h.jsx("span",{className:"text-lg font-medium text-white",children:Math.round(i.nozzle_2??0)}),F("nozzle_2",i.nozzle_2_target??0)]}),h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("div",{className:"w-5 h-5 flex items-center justify-center flex-shrink-0",children:h.jsx("img",{src:"/icons/heatbed.svg",alt:"",className:`w-5 ${C?"icon-heating":"icon-theme"}`})}),r&&h.jsx("span",{className:"min-w-[18px] flex-shrink-0"}),h.jsx("span",{className:"text-lg font-medium text-white",children:Math.round(i.bed??0)}),F("bed",i.bed_target??0)]}),h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("div",{className:"w-5 h-5 flex items-center justify-center flex-shrink-0",children:h.jsx("img",{src:"/icons/chamber.svg",alt:"",className:`w-5 ${k?"icon-heating":"icon-theme"}`})}),r&&h.jsx("span",{className:"min-w-[18px] flex-shrink-0"}),h.jsx("span",{className:"text-lg font-medium text-white",children:Math.round(i.chamber??0)}),F("chamber",i.chamber_target??0)]}),h.jsxs("button",{onClick:()=>f(!0),disabled:R,className:"flex items-center justify-between w-full px-3 py-4 rounded-md bg-bambu-dark-secondary hover:bg-bambu-dark-tertiary border border-bambu-dark-tertiary disabled:opacity-50 disabled:cursor-not-allowed",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("img",{src:"/icons/ventilation.svg",alt:"",className:"w-5 h-5 icon-theme"}),h.jsx("span",{className:"text-xs text-bambu-gray",children:"A/C"})]}),h.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded ${e?.airduct_mode===1?"bg-orange-500/20 text-orange-400":"bg-blue-500/20 text-blue-400"}`,children:e?.airduct_mode===1?"Heat":"Cool"})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs("button",{onClick:()=>g(!0),disabled:R,className:"flex-1 flex flex-col items-center py-2 rounded-md bg-bambu-dark-secondary hover:bg-bambu-dark-tertiary border border-bambu-dark-tertiary disabled:opacity-50 disabled:cursor-not-allowed",children:[h.jsx("img",{src:"/icons/speed.svg",alt:"",className:"w-5 h-5 icon-theme"}),h.jsx("span",{className:"text-[10px] text-bambu-gray mt-0.5",children:e?.speed_level===1?"50%":e?.speed_level===3?"124%":e?.speed_level===4?"166%":"100%"})]}),h.jsxs("button",{onClick:()=>x.mutate(!(e?.chamber_light??!1)),disabled:R||x.isPending,className:"flex-1 flex flex-col items-center py-2 rounded-md bg-bambu-dark-secondary hover:bg-bambu-dark-tertiary border border-bambu-dark-tertiary disabled:opacity-50 disabled:cursor-not-allowed",children:[h.jsx("img",{src:"/icons/lamp.svg",alt:"",className:`w-5 h-5 ${e?.chamber_light?"icon-green":"icon-theme"}`}),h.jsx("span",{className:"text-[10px] text-bambu-gray mt-0.5",children:"Lamp"})]})]})]}),u&&h.jsx(vVe,{printer:t,status:e,onClose:()=>f(!1)}),m&&h.jsx(yVe,{printer:t,status:e,onClose:()=>g(!1)})]})}const SVe=220,_r=SVe/2,c_=108,vu=72,u_=35,fG=28;function bu(t,e,n,i,r,a,s=8){const o=[];for(let l=0;l<=s;l++){const c=r+(a-r)*(l/s),u=Math.round(t+i*Math.cos(c)),f=Math.round(e+i*Math.sin(c));o.push(`${u},${f}`)}for(let l=s;l>=0;l--){const c=r+(a-r)*(l/s),u=Math.round(t+n*Math.cos(c)),f=Math.round(e+n*Math.sin(c));o.push(`${u},${f}`)}return o.join(",")}const ea={up:{start:-Math.PI*3/4,end:-Math.PI/4},right:{start:-Math.PI/4,end:Math.PI/4},down:{start:Math.PI/4,end:Math.PI*3/4},left:{start:Math.PI*3/4,end:Math.PI*5/4}};function wVe({printerId:t,status:e,disabled:n=!1}){const i=(e?.connected??!1)&&!n,r=E.useId(),[a,s]=E.useState(null),o=yt({mutationFn:({axes:y,token:v})=>Fe.homeAxes(t,y,v),onSuccess:y=>{Wx(y)&&s({action:"home",token:y.token,warning:y.warning,onConfirm:()=>o.mutate({axes:"XY",token:y.token})})}}),l=yt({mutationFn:({axis:y,distance:v,token:x})=>Fe.moveAxis(t,y,v,3e3,x),onSuccess:(y,v)=>{Wx(y)&&s({action:"move",token:y.token,warning:y.warning,onConfirm:()=>l.mutate({axis:v.axis,distance:v.distance,token:y.token})})}}),c=()=>{g||o.mutate({axes:"XY"})},u=(y,v)=>{g||l.mutate({axis:y,distance:v})},f=()=>{a&&(a.onConfirm(),s(null))},m=o.isPending||l.isPending,g=!i||m,b=Array.from({length:16},(y,v)=>{const x=v/16*Math.PI*2,M=Math.round(_r+fG*Math.cos(x)),w=Math.round(_r+fG*Math.sin(x));return`${M},${w}`}).join(",");return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"relative w-[220px] h-[220px] mb-3.5",children:[h.jsx("img",{src:"/icons/jogpad.svg",alt:"Jog Pad",useMap:`#${r}`,className:"w-full h-full jogpad-theme"}),h.jsxs("map",{name:r,children:[h.jsx("area",{shape:"poly",coords:bu(_r,_r,vu,c_,ea.up.start,ea.up.end),onClick:()=>u("Y",10),title:"Y+10mm",style:{cursor:g?"not-allowed":"pointer"}}),h.jsx("area",{shape:"poly",coords:bu(_r,_r,vu,c_,ea.down.start,ea.down.end),onClick:()=>u("Y",-10),title:"Y-10mm",style:{cursor:g?"not-allowed":"pointer"}}),h.jsx("area",{shape:"poly",coords:bu(_r,_r,vu,c_,ea.left.start,ea.left.end),onClick:()=>u("X",-10),title:"X-10mm",style:{cursor:g?"not-allowed":"pointer"}}),h.jsx("area",{shape:"poly",coords:bu(_r,_r,vu,c_,ea.right.start,ea.right.end),onClick:()=>u("X",10),title:"X+10mm",style:{cursor:g?"not-allowed":"pointer"}}),h.jsx("area",{shape:"poly",coords:bu(_r,_r,u_,vu,ea.up.start,ea.up.end),onClick:()=>u("Y",1),title:"Y+1mm",style:{cursor:g?"not-allowed":"pointer"}}),h.jsx("area",{shape:"poly",coords:bu(_r,_r,u_,vu,ea.down.start,ea.down.end),onClick:()=>u("Y",-1),title:"Y-1mm",style:{cursor:g?"not-allowed":"pointer"}}),h.jsx("area",{shape:"poly",coords:bu(_r,_r,u_,vu,ea.left.start,ea.left.end),onClick:()=>u("X",-1),title:"X-1mm",style:{cursor:g?"not-allowed":"pointer"}}),h.jsx("area",{shape:"poly",coords:bu(_r,_r,u_,vu,ea.right.start,ea.right.end),onClick:()=>u("X",1),title:"X+1mm",style:{cursor:g?"not-allowed":"pointer"}}),h.jsx("area",{shape:"poly",coords:b,onClick:c,title:"Home XY",style:{cursor:g?"not-allowed":"pointer"}})]})]}),a&&h.jsx(rr,{title:"Confirm Action",message:a.warning,confirmText:"Continue",variant:"warning",onConfirm:f,onCancel:()=>s(null)})]})}function MVe({printerId:t,status:e,disabled:n=!1}){const i=(e?.connected??!1)&&!n,[r,a]=E.useState(null),s=yt({mutationFn:({distance:u,token:f})=>Fe.moveAxis(t,"Z",u,1e3,f),onSuccess:(u,f)=>{Wx(u)&&a({token:u.token,warning:u.warning,distance:f.distance})}}),o=u=>{s.mutate({distance:u})},l=()=>{r&&(s.mutate({distance:r.distance,token:r.token}),a(null))},c=!i||s.isPending;return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("button",{onClick:()=>o(-10),disabled:c,className:"px-3.5 py-2 rounded-md bg-bambu-dark-secondary hover:bg-bambu-dark-tertiary border border-bambu-dark-tertiary text-sm text-bambu-gray disabled:opacity-50 disabled:cursor-not-allowed",title:"Bed up 10mm",children:"↑10"}),h.jsx("button",{onClick:()=>o(-1),disabled:c,className:"px-3.5 py-2 rounded-md bg-bambu-dark-secondary hover:bg-bambu-dark-tertiary border border-bambu-dark-tertiary text-sm text-bambu-gray disabled:opacity-50 disabled:cursor-not-allowed",title:"Bed up 1mm",children:"↑1"}),h.jsx("span",{className:"px-2 py-2 text-sm text-bambu-gray",children:"Bed"}),h.jsx("button",{onClick:()=>o(1),disabled:c,className:"px-3.5 py-2 rounded-md bg-bambu-dark-secondary hover:bg-bambu-dark-tertiary border border-bambu-dark-tertiary text-sm text-bambu-gray disabled:opacity-50 disabled:cursor-not-allowed",title:"Bed down 1mm",children:"↓1"}),h.jsx("button",{onClick:()=>o(10),disabled:c,className:"px-3.5 py-2 rounded-md bg-bambu-dark-secondary hover:bg-bambu-dark-tertiary border border-bambu-dark-tertiary text-sm text-bambu-gray disabled:opacity-50 disabled:cursor-not-allowed",title:"Bed down 10mm",children:"↓10"})]}),r&&h.jsx(rr,{title:"Confirm Bed Movement",message:r.warning,confirmText:"Continue",variant:"warning",onConfirm:l,onCancel:()=>a(null)})]})}function EVe({printerId:t,status:e,nozzleCount:n,disabled:i=!1}){const r=Rn(),a=(e?.connected??!1)&&!i,s=e?.state==="RUNNING"||e?.state==="PAUSE",o=n>1,l=e?.active_extruder??0,[c,u]=E.useState(null),f=yt({mutationFn:M=>(console.log("selectExtruder called with:",M),Fe.selectExtruder(t,M)),onSuccess:M=>{console.log("selectExtruder success:",M),setTimeout(()=>{r.invalidateQueries({queryKey:["printerStatuses"]})},2e3)},onError:M=>{console.error("selectExtruder error:",M)}}),m=yt({mutationFn:({distance:M,token:w})=>{const A=`G91
G1 E${M} F300
-G90`;return Fe.sendGcode(t,A,w)},onSuccess:(M,w)=>{Wx(M)&&u({token:M.token,warning:M.warning,distance:w.distance})}}),g=M=>{m.mutate({distance:M})},b=()=>{c&&(m.mutate({distance:c.distance,token:c.token}),u(null))},y=!a||s||m.isPending,v=f.isPending,x=()=>o?l===1?"/icons/dual-extruder-left.png":"/icons/dual-extruder-right.png":"/icons/single-extruder1.png";return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex flex-col items-center gap-1.5 justify-center",children:[o&&h.jsxs("div",{className:`flex rounded-md overflow-hidden border border-bambu-dark-tertiary mb-1 flex-shrink-0 ${y||v?"opacity-50":""}`,children:[h.jsx("button",{onClick:()=>f.mutate(1),disabled:y||v,className:`px-3 py-1.5 text-sm border-r border-bambu-dark-tertiary transition-colors disabled:cursor-not-allowed ${l===1?"bg-bambu-green text-white":"bg-bambu-dark-secondary text-bambu-gray hover:bg-bambu-dark-tertiary disabled:hover:bg-bambu-dark-secondary"}`,children:"Left"}),h.jsx("button",{onClick:()=>f.mutate(0),disabled:y||v,className:`px-3 py-1.5 text-sm transition-colors disabled:cursor-not-allowed ${l===0?"bg-bambu-green text-white":"bg-bambu-dark-secondary text-bambu-gray hover:bg-bambu-dark-tertiary disabled:hover:bg-bambu-dark-secondary"}`,children:"Right"})]}),h.jsx("button",{onClick:()=>g(5),disabled:y,className:"w-9 h-[30px] rounded-md bg-bambu-dark-secondary hover:bg-bambu-dark-tertiary border border-bambu-dark-tertiary flex items-center justify-center text-bambu-gray disabled:opacity-50 disabled:cursor-not-allowed",title:"Extrude 5mm",children:h.jsx(QS,{className:"w-4 h-4"})}),h.jsx("div",{className:"h-[120px] flex items-center justify-center",children:h.jsx("img",{src:x(),alt:o?`${l===1?"Left":"Right"} Extruder Active`:"Single Extruder",className:"h-full object-contain",onError:M=>{M.target.style.display="none"}})}),h.jsx("button",{onClick:()=>g(-5),disabled:y,className:"w-9 h-[30px] rounded-md bg-bambu-dark-secondary hover:bg-bambu-dark-tertiary border border-bambu-dark-tertiary flex items-center justify-center text-bambu-gray disabled:opacity-50 disabled:cursor-not-allowed",title:"Retract 5mm",children:h.jsx(Gf,{className:"w-4 h-4"})}),h.jsx("span",{className:"text-xs text-bambu-gray mt-0.5",children:"Extruder"})]}),c&&h.jsx(rr,{title:"Confirm Extrusion",message:c.warning,confirmText:"Continue",variant:"warning",onConfirm:b,onCancel:()=>u(null)})]})}function AVe({humidity:t}){const e=()=>t<25?"/icons/humidity-empty.svg":t<40?"/icons/humidity-half.svg":"/icons/humidity-full.svg";return h.jsx("img",{src:e(),alt:"",className:"w-16 h-24"})}function TVe({humidity:t,temperature:e,dryingStatus:n,remainingTime:i,onClose:r}){E.useEffect(()=>{const s=o=>{o.key==="Escape"&&r()};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[r]);const a=()=>{if(n==="idle")return"Idle";if(!i)return"Drying...";const s=Math.floor(i/60),o=i%60;return s>0?`${s}h ${o}m`:`${o}m`};return h.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:h.jsxs("div",{className:"bg-white dark:bg-bambu-dark-secondary rounded-lg shadow-xl max-w-md w-full",children:[h.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-bambu-dark-tertiary",children:[h.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Current AMS humidity"}),h.jsx("button",{onClick:r,className:"p-1 hover:bg-gray-100 dark:hover:bg-bambu-dark-tertiary rounded-lg transition-colors",children:h.jsx(fn,{className:"w-5 h-5 text-gray-500 dark:text-bambu-gray"})})]}),h.jsxs("div",{className:"p-6",children:[h.jsxs("div",{className:"flex flex-col items-center mb-6",children:[h.jsx(AVe,{humidity:t}),h.jsxs("div",{className:"flex items-center gap-2 mt-2 text-gray-600 dark:text-bambu-gray",children:[h.jsx("span",{className:"text-yellow-500",children:"❊"}),h.jsx("span",{children:n==="idle"?"Idle":"Drying"})]})]}),h.jsxs("div",{className:"grid grid-cols-3 gap-4 text-center",children:[h.jsxs("div",{children:[h.jsx("div",{className:"text-sm text-gray-500 dark:text-bambu-gray mb-1",children:"Humidity"}),h.jsxs("div",{className:"text-lg font-medium text-gray-900 dark:text-white",children:[t,"%"]})]}),h.jsxs("div",{children:[h.jsx("div",{className:"text-sm text-gray-500 dark:text-bambu-gray mb-1",children:"Temperature"}),h.jsxs("div",{className:"text-lg font-medium text-gray-900 dark:text-white",children:[e," °C"]})]}),h.jsxs("div",{children:[h.jsx("div",{className:"text-sm text-gray-500 dark:text-bambu-gray mb-1",children:"Remaining Time"}),h.jsx("div",{className:"text-lg font-medium text-gray-900 dark:text-white",children:a()})]})]})]})]})})}function vN(t){const e=t.indexOf(" @");return e>0?t.substring(0,e):t}function CVe(t){let e=t;e.startsWith("# ")&&(e=e.substring(2));const n=e.indexOf(" @");return n>0?e.substring(0,n):e}function NVe(t){let e=t;e.startsWith("# ")&&(e=e.substring(2));const n=e.indexOf(" @");return n>0?e.substring(0,n):e}function RVe(t){if(!t)return"rgb(128, 128, 128)";const e=t.replace("#","").substring(0,6),n=parseInt(e.substring(0,2),16),i=parseInt(e.substring(2,4),16),r=parseInt(e.substring(4,6),16),a=isNaN(n)?128:n,s=isNaN(i)?128:i,o=isNaN(r)?128:r;return`rgb(${a}, ${s}, ${o})`}function bN(t){return t?`#${t.replace("#","").substring(0,6)}`:"#808080"}function PVe(t){if(!t)return!1;const e=t.trim();return e.length!==32||e==="00000000000000000000000000000000"?!1:/^[0-9a-fA-F]{32}$/.test(e)}const kVe={Y2:"Sunflower Yellow",Y0:"Yellow",Y1:"Lemon Yellow",K0:"Black",W0:"White",W1:"Ivory White",R0:"Red",R1:"Scarlet Red",R2:"Magenta",B0:"Blue",B1:"Navy Blue",B2:"Sky Blue",B3:"Cyan",G0:"Green",G1:"Grass Green",G2:"Jade Green",O0:"Orange",O1:"Mandarin Orange",P0:"Purple",P1:"Pink",P2:"Sakura Pink",N0:"Gray",N1:"Silver Gray",N2:"Charcoal",D0:"Brown",D1:"Chocolate",T0:"Titan Gray",T1:"Jade White"};function DVe(t){if(!t)return null;const e=t.split("-");if(e.length<2)return null;const n=e[1];return kVe[n]||null}function OVe(t,e,n,i){if(!t.length)return null;const r=e?.toLowerCase()||"",a=n?.toUpperCase()||"",s=i?.toLowerCase()||"";if(r&&s){const l=t.find(c=>{const u=c.name.toLowerCase();return u.includes(r)&&u.includes(s)});if(l)return l}if(r){const l=t.find(c=>c.name.toLowerCase().includes(r));if(l)return l}if(a){const l=t.filter(c=>c.name.toUpperCase().includes(a));if(l.length>0){const c=l.find(u=>u.name.toLowerCase().includes("basic"));return c||l[0]}}return t.find(l=>l.name.toLowerCase()==="default"||l.slot_id===0)||null}function LVe({tray:t,amsId:e,slotLabel:n,printerId:i,printerModel:r,nozzleDiameter:a="0.4",onClose:s,onConfirm:o}){const l=Rn(),c=!t.tray_type||t.tray_type===""||t.tray_type==="NONE",u=PVe(t.tray_uuid),f=c||!u,{data:m}=Ft({queryKey:["kprofiles",i,a],queryFn:()=>Fe.getKProfiles(i,a)}),{data:g}=Ft({queryKey:["cloudSettings"],queryFn:()=>Fe.getCloudSettings()}),{data:b}=Ft({queryKey:["slotPreset",i,e,t.id],queryFn:()=>Fe.getSlotPreset(i,e,t.id),enabled:f}),y=yt({mutationFn:({presetId:de,presetName:Q})=>Fe.saveSlotPreset(i,e,t.id,de,Q),onSuccess:()=>{l.invalidateQueries({queryKey:["slotPreset",i,e,t.id]})}}),v=(()=>{const de=g?.filament||[],Q=new RegExp(`@.*\\b${r}\\b`,"i"),xe=[...de].sort((Ie,ce)=>{const dt=Q.test(Ie.name),z=Q.test(ce.name);return dt&&!z?-1:!dt&&z?1:0}),Re=new Set;return xe.filter(Ie=>{const ce=CVe(Ie.name);return Re.has(ce)?!1:(Re.add(ce),!0)}).sort((Ie,ce)=>vN(Ie.name).localeCompare(vN(ce.name)))})(),[x,M]=E.useState(null),[w,A]=E.useState(null),[T,R]=E.useState(t.tray_type||""),[N,j]=E.useState(bN(t.tray_color)),[C,k]=E.useState(t.nozzle_temp_max||220),[F,I]=E.useState(t.nozzle_temp_min||190),[G,O]=E.useState(""),[B,$]=E.useState(t.k||0);E.useEffect(()=>{b&&!x&&(M(b.preset_id),A(b.preset_name))},[b,x]);const V=de=>{if(!de){M(null),A(null);return}M(de);const Q=v.find(xe=>xe.setting_id===de);if(Q){A(Q.name);const xe=Q.name.match(/\b(PLA|PETG|ABS|TPU|ASA|PA|PC|PVA|HIPS|PLA-S|PETG-CF|PA-CF|PET-CF)\b/i);xe&&R(xe[1].toUpperCase())}},K=m?.profiles||[],Y=DVe(t.tray_id_name);E.useEffect(()=>{const de=u?t.tray_sub_brands:w?NVe(w):null,Q=u?t.tray_type:T||t.tray_type,Re=OVe(K,de,Q,u?Y:null);Re?(O(Re.name),$(parseFloat(Re.k_value)||0)):(O("Default"),$(0))},[K,T,w,t.tray_type,t.tray_sub_brands,t.tray_id_name,u,Y]),E.useEffect(()=>{const de=Q=>{Q.key==="Escape"&&s()};return window.addEventListener("keydown",de),()=>window.removeEventListener("keydown",de)},[s]);const se=de=>{O(de);const Q=K.find(xe=>xe.name===de);Q&&$(parseFloat(Q.k_value)||0)},H=()=>{f&&x&&w&&y.mutate({presetId:x,presetName:w}),o?.({filamentType:T,color:N,nozzleTempMax:C,nozzleTempMin:F,kProfile:G,kValue:B}),s()},X=()=>{R(t.tray_type||""),j(bN(t.tray_color)),k(t.nozzle_temp_max||220),I(t.nozzle_temp_min||190),$(t.k||0)},ae=u?t.tray_sub_brands||t.tray_type||"Unknown":T||"Select filament",le=u&&t.tray_uuid?t.tray_uuid:"N/A";return h.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:h.jsxs("div",{className:"bg-white dark:bg-bambu-dark-secondary rounded-lg shadow-xl max-w-md w-full",children:[h.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-bambu-dark-tertiary",children:[h.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:["AMS Materials Setting - ",n]}),h.jsx("button",{onClick:s,className:"p-1 hover:bg-gray-100 dark:hover:bg-bambu-dark-tertiary rounded-lg transition-colors",children:h.jsx(fn,{className:"w-5 h-5 text-gray-500 dark:text-bambu-gray"})})]}),h.jsxs("div",{className:"p-6 space-y-4",children:[u&&h.jsxs("div",{className:"flex items-center gap-2 text-xs text-bambu-green bg-bambu-green/10 px-3 py-1.5 rounded-md",children:[h.jsx("span",{className:"w-2 h-2 bg-bambu-green rounded-full"}),"Bambu Lab RFID detected - fields auto-filled"]}),!u&&!c&&h.jsxs("div",{className:"flex items-center gap-2 text-xs text-yellow-600 dark:text-yellow-400 bg-yellow-100 dark:bg-yellow-900/20 px-3 py-1.5 rounded-md",children:[h.jsx("span",{className:"w-2 h-2 bg-yellow-500 rounded-full"}),"Non-Bambu Lab filament - please verify settings"]}),c&&h.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 dark:text-bambu-gray bg-gray-100 dark:bg-bambu-dark px-3 py-1.5 rounded-md",children:[h.jsx("span",{className:"w-2 h-2 bg-gray-400 rounded-full"}),"Empty slot - configure filament settings"]}),h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsx("label",{className:"w-28 text-sm text-gray-600 dark:text-bambu-gray",children:"Filament"}),f?h.jsxs("select",{value:x||"",onChange:de=>V(de.target.value),className:"flex-1 min-w-0 px-3 py-2 bg-gray-100 dark:bg-bambu-dark rounded-md border border-gray-300 dark:border-bambu-dark-tertiary text-gray-900 dark:text-white text-sm truncate",children:[h.jsx("option",{value:"",children:"Select filament..."}),v.length>0?v.map(de=>h.jsx("option",{value:de.setting_id,children:vN(de.name)},de.setting_id)):h.jsxs("option",{value:"",disabled:!0,children:["No filament presets for ",r]})]}):h.jsx("div",{className:"flex-1 px-3 py-2 bg-gray-100 dark:bg-bambu-dark rounded-md text-gray-900 dark:text-white",children:ae})]}),h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsx("label",{className:"w-28 text-sm text-gray-600 dark:text-bambu-gray",children:"Color"}),h.jsx("div",{className:"flex items-center gap-2 flex-1",children:f?h.jsxs(h.Fragment,{children:[h.jsx("input",{type:"color",value:N,onChange:de=>j(de.target.value),className:"w-10 h-10 rounded cursor-pointer border-2 border-gray-300 dark:border-bambu-dark-tertiary"}),h.jsx("span",{className:"text-gray-900 dark:text-white text-sm",children:N.toUpperCase()})]}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"w-8 h-8 rounded-full border-2 border-gray-300 dark:border-bambu-dark-tertiary flex-shrink-0",style:{backgroundColor:RVe(t.tray_color)}}),h.jsx("span",{className:"text-gray-900 dark:text-white",children:Y||bN(t.tray_color).toUpperCase()})]})})]}),h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsx("label",{className:"w-28 text-sm text-gray-600 dark:text-bambu-gray",children:"Nozzle Temp"}),h.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[h.jsxs("div",{children:[h.jsx("div",{className:"text-xs text-gray-500 dark:text-bambu-gray mb-1",children:"min"}),h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("input",{type:"number",value:F,onChange:de=>I(Number(de.target.value)),disabled:!f,className:"w-20 px-2 py-1 bg-gray-100 dark:bg-bambu-dark rounded border border-gray-300 dark:border-bambu-dark-tertiary text-gray-900 dark:text-white disabled:opacity-60"}),h.jsx("span",{className:"text-gray-600 dark:text-bambu-gray",children:"°C"})]})]}),h.jsxs("div",{children:[h.jsx("div",{className:"text-xs text-gray-500 dark:text-bambu-gray mb-1",children:"max"}),h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("input",{type:"number",value:C,onChange:de=>k(Number(de.target.value)),disabled:!f,className:"w-20 px-2 py-1 bg-gray-100 dark:bg-bambu-dark rounded border border-gray-300 dark:border-bambu-dark-tertiary text-gray-900 dark:text-white disabled:opacity-60"}),h.jsx("span",{className:"text-gray-600 dark:text-bambu-gray",children:"°C"})]})]})]})]}),h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsx("label",{className:"w-28 text-sm text-gray-600 dark:text-bambu-gray",children:"SN"}),h.jsx("div",{className:"flex-1 px-3 py-2 bg-gray-100 dark:bg-bambu-dark rounded-md text-gray-900 dark:text-white text-xs font-mono truncate",children:le})]}),h.jsxs("div",{className:"pt-4 border-t border-gray-200 dark:border-bambu-dark-tertiary",children:[h.jsxs("h3",{className:"text-sm font-medium text-gray-900 dark:text-white mb-3",children:["Flow Dynamics Calibration"," ",h.jsxs("a",{href:"https://wiki.bambulab.com/en/software/bambu-studio/calibration_pa",target:"_blank",rel:"noopener noreferrer",className:"text-bambu-green hover:underline inline-flex items-center gap-1",children:["Wiki",h.jsx(Qo,{className:"w-3 h-3"})]})]}),h.jsxs("div",{className:"flex items-center gap-4 mb-3",children:[h.jsx("label",{className:"w-28 text-sm text-gray-600 dark:text-bambu-gray flex-shrink-0",children:"K Profile"}),h.jsxs("select",{value:G,onChange:de=>se(de.target.value),className:"flex-1 min-w-0 px-3 py-2 bg-gray-100 dark:bg-bambu-dark rounded-md border border-gray-300 dark:border-bambu-dark-tertiary text-gray-900 dark:text-white text-sm truncate",children:[h.jsx("option",{value:"Default",children:"Default"}),K.map(de=>h.jsxs("option",{value:de.name,children:[de.name," (K=",parseFloat(de.k_value).toFixed(3),")"]},de.slot_id))]})]}),h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsx("label",{className:"w-28 text-sm text-gray-600 dark:text-bambu-gray",children:"Factor K"}),h.jsx("div",{className:"flex-1 px-3 py-2 bg-gray-100 dark:bg-bambu-dark rounded-md text-gray-900 dark:text-white",children:B.toFixed(3)})]})]})]}),h.jsxs("div",{className:"flex items-center justify-center gap-3 p-4 border-t border-gray-200 dark:border-bambu-dark-tertiary",children:[h.jsx("button",{onClick:H,className:"px-6 py-2 bg-bambu-green text-white rounded-md hover:bg-bambu-green-dark transition-colors",children:"Confirm"}),h.jsx("button",{onClick:X,className:"px-6 py-2 bg-gray-200 dark:bg-bambu-dark text-gray-700 dark:text-bambu-gray rounded-md hover:bg-gray-300 dark:hover:bg-bambu-dark-tertiary transition-colors",children:"Reset"}),h.jsx("button",{onClick:s,className:"px-6 py-2 bg-gray-200 dark:bg-bambu-dark text-gray-700 dark:text-bambu-gray rounded-md hover:bg-gray-300 dark:hover:bg-bambu-dark-tertiary transition-colors",children:"Close"})]})]})})}function Ux(t){if(!t)return"rgb(128, 128, 128)";const e=t.replace("#","").substring(0,6),n=parseInt(e.substring(0,2),16),i=parseInt(e.substring(2,4),16),r=parseInt(e.substring(4,6),16),a=isNaN(n)?128:n,s=isNaN(i)?128:i,o=isNaN(r)?128:r;return`rgb(${a}, ${s}, ${o})`}function IVe(t){if(!t)return!1;const e=t.replace("#","").substring(0,6);if(e.length<6)return!1;const n=parseInt(e.substring(0,2),16),i=parseInt(e.substring(2,4),16),r=parseInt(e.substring(4,6),16);return isNaN(n)||isNaN(i)||isNaN(r)?!1:(.299*n+.587*i+.114*r)/255>.45}function jVe({humidity:t}){const e=()=>t<25?"/icons/humidity-empty.svg":t<40?"/icons/humidity-half.svg":"/icons/humidity-full.svg";return h.jsx("img",{src:e(),alt:"",className:"w-2.5 h-[14px]"})}function UVe({isLoading:t,amsStatusMain:e,amsStatusSub:n,trayNow:i,targetTrayId:r,onComplete:a,onRetry:s}){const[o,l]=E.useState(!1),[c,u]=E.useState(!1),f=E.useRef(e),m=E.useRef(i),g=E.useRef(null),b=2,y=3,v=4,x=5,M=6,w=7;E.useEffect(()=>{console.log(`[FilamentChangeCard] Status: main=${e}, sub=${n}, trayNow=${i}, isLoading=${t}`)},[e,n,i,t]),E.useEffect(()=>{const F=f.current===1,I=e===0,G=i!==m.current;F&&I?(console.log("[FilamentChangeCard] ams_status_main transitioned 1->0, operation complete!"),u(!0),g.current=setTimeout(()=>{a()},1500)):G&&(t&&r!==null&&i===r?(console.log(`[FilamentChangeCard] Load completed! tray_now=${i} matches target=${r}`),u(!0),g.current=setTimeout(()=>{a()},1500)):!t&&i===255&&(console.log("[FilamentChangeCard] Unload completed! tray_now=255 (no filament)"),u(!0),g.current=setTimeout(()=>{a()},1500))),f.current=e,m.current=i},[e,i,t,r,a]),E.useEffect(()=>()=>{g.current&&clearTimeout(g.current)},[]);const T=c?99:e!==1?0:t?n===x||n===M||n===y?1:n===b?2:n===w?3:1:n===b?1:n===v?2:1;console.log(`[FilamentChangeCard] Step calculation: currentStep=${T}, amsStatusSub=${n}`);const j=t?(()=>{let F="pending",I="pending",G="pending";return T>=99?(F="completed",I="completed",G="completed"):T>=3?(F="completed",I="completed",G="in_progress"):T>=2?(F="completed",I="in_progress"):T>=1&&(F="in_progress"),[{label:"Push new filament into extruder",stepNumber:1,status:F},{label:"Heat the nozzle",stepNumber:2,status:I},{label:"Purge old filament",stepNumber:3,status:G}]})():(()=>{let F="pending",I="pending";return T>=99?(F="completed",I="completed"):T>=2?(F="completed",I="in_progress"):T>=1&&(F="in_progress"),[{label:"Heat the nozzle",stepNumber:1,status:F},{label:"Retract filament from extruder",stepNumber:2,status:I}]})(),C=t?"Loading":"Unloading",k=t?"Filament loading...":"Filament unloading...";return h.jsxs("div",{className:"mt-3 border-l-4 border-bambu-green bg-white dark:bg-bambu-dark-secondary rounded-r-lg overflow-hidden",children:[h.jsxs("button",{onClick:()=>l(!o),className:"w-full flex items-center justify-between px-4 py-2 text-bambu-green hover:bg-gray-50 dark:hover:bg-bambu-dark-tertiary transition-colors",children:[h.jsx("span",{className:"text-sm font-medium",children:k}),o?h.jsx(Gf,{className:"w-4 h-4"}):h.jsx(QS,{className:"w-4 h-4"})]}),!o&&h.jsxs("div",{className:"px-4 pb-4",children:[h.jsxs("div",{className:"flex gap-6",children:[h.jsxs("div",{className:"flex-1",children:[h.jsx("h3",{className:"text-bambu-green font-semibold mb-3",children:C}),h.jsx("div",{className:"space-y-2",children:j.map(F=>h.jsxs("div",{className:"flex items-center gap-2",children:[F.status==="completed"?h.jsx("div",{className:"w-5 h-5 rounded-full bg-bambu-green flex items-center justify-center flex-shrink-0",children:h.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})})}):F.status==="in_progress"?h.jsx("div",{className:"w-5 h-5 rounded-full bg-bambu-green flex items-center justify-center flex-shrink-0",children:h.jsx("span",{className:"text-white text-xs font-bold",children:F.stepNumber})}):h.jsx("div",{className:"w-5 h-5 rounded-full border-2 border-gray-400 dark:border-gray-500 flex items-center justify-center flex-shrink-0",children:h.jsx("span",{className:"text-gray-400 dark:text-gray-500 text-xs font-medium",children:F.stepNumber})}),h.jsx("span",{className:`text-sm ${F.status==="in_progress"?"text-gray-900 dark:text-white font-semibold":F.status==="completed"?"text-gray-500 dark:text-gray-400":"text-gray-400 dark:text-gray-500"}`,children:F.label})]},F.stepNumber))})]}),h.jsx("div",{className:"flex-shrink-0",children:h.jsx("img",{src:"/icons/extruder-change-filament.png",alt:"Extruder",className:"w-[150px] h-auto"})})]}),s&&h.jsxs("button",{onClick:s,className:"mt-3 px-4 py-1.5 border border-bambu-gray rounded-full text-sm text-bambu-gray hover:bg-bambu-dark-tertiary transition-colors flex items-center gap-1.5",children:[h.jsx(Uoe,{className:"w-3.5 h-3.5"}),"Retry"]})]})]})}function hG(t,e){if(t>=128){const i=t-128,r=String.fromCharCode(65+e);return i===0?`HT-${r}`:`HT${i+1}-${r}`}return`${String.fromCharCode(65+t)}${e+1}`}function CP(t){return t>=128}function pG({units:t,side:e,isPrinting:n,selectedAmsIndex:i,onSelectAms:r,selectedTray:a,onSelectTray:s,onHumidityClick:o,onSlotRefresh:l,onEyeClick:c,refreshingSlot:u}){const f=t[i],m=f?CP(f.id):!1;return h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("div",{className:"flex gap-1.5 mb-2.5 p-1.5 bg-gray-300 dark:bg-bambu-dark rounded-lg",children:t.map((g,b)=>h.jsx("button",{onClick:()=>r(b),className:`flex items-center p-1.5 rounded border-2 transition-colors ${i===b?"border-bambu-green bg-white dark:bg-bambu-dark-tertiary":"bg-gray-200 dark:bg-bambu-dark-secondary border-transparent hover:border-bambu-gray"}`,children:h.jsx("div",{className:"flex gap-0.5",children:g.tray.map(y=>h.jsx("div",{className:"w-2.5 h-2.5 rounded-full",style:{backgroundColor:y.tray_color?Ux(y.tray_color):"#808080"}},y.id))})},g.id))}),f&&h.jsxs("div",{className:"bg-gray-100 dark:bg-bambu-dark-secondary rounded-[10px] p-2.5",children:[h.jsxs("button",{onClick:()=>o(f.humidity??0,f.temp??0),className:"flex items-center justify-center gap-4 text-xs text-bambu-gray mb-2.5 w-full py-1 hover:bg-gray-50 dark:hover:bg-bambu-dark-tertiary rounded-md transition-colors cursor-pointer",children:[f.humidity!==null&&h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(jVe,{humidity:f.humidity}),f.humidity," %"]}),f.temp!==null&&h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx("img",{src:"/icons/temperature.svg",alt:"",className:"w-3.5 icon-theme"}),f.temp,"°C"]})]}),h.jsx("div",{className:`flex gap-2 mb-1.5 ${m?"justify-start pl-2":"justify-center"}`,children:f.tray.map((g,b)=>{const y=hG(f.id,b),v=u?.amsId===f.id&&u?.trayId===g.id;return h.jsxs("button",{onClick:()=>l(f.id,g.id),disabled:v,className:`w-14 flex items-center justify-center gap-0.5 text-[10px] text-bambu-gray px-1.5 py-[3px] bg-bambu-dark rounded-full border border-bambu-dark-tertiary transition-colors ${v?"opacity-70 cursor-wait":"hover:bg-bambu-dark-tertiary"}`,children:[y,h.jsx("img",{src:"/icons/reload.svg",alt:"",className:`w-2.5 h-2.5 icon-theme ${v?"animate-spin":""}`})]},g.id)})}),h.jsx("div",{className:`flex gap-2 ${m?"justify-start pl-2":"justify-center"}`,children:f.tray.map((g,b)=>{const y=f.id*4+g.id,v=a===y,x=!g.tray_type||g.tray_type===""||g.tray_type==="NONE",M=IVe(g.tray_color),w=hG(f.id,b);return h.jsxs("div",{onClick:()=>{console.log(`[AMSSectionDual] Slot clicked: AMS ${f.id}, tray ${g.id}, globalTrayId: ${y}, isEmpty: ${x}, isPrinting: ${n}, isSelected: ${v}`),!x&&!n&&s(v?null:y)},className:`w-14 h-[80px] rounded-md border-2 overflow-hidden transition-all bg-bambu-dark relative ${v?"border-bambu-green":"border-bambu-dark-tertiary hover:border-bambu-gray"} ${x?"opacity-50":"cursor-pointer"}`,children:[!x&&g.remain>=0&&h.jsx("div",{className:"absolute bottom-0 left-0 right-0 transition-all",style:{height:`${Math.min(100,Math.max(0,g.remain))}%`,backgroundColor:Ux(g.tray_color)}}),!x&&g.remain<0&&h.jsx("div",{className:"absolute inset-0",style:{backgroundColor:Ux(g.tray_color)}}),x&&h.jsx("div",{className:"absolute inset-0",style:{background:"repeating-linear-gradient(45deg, #3a3a3a, #3a3a3a 4px, #4a4a4a 4px, #4a4a4a 8px)"}}),h.jsxs("div",{className:"relative w-full h-full flex flex-col items-center justify-end pb-[5px]",children:[h.jsx("span",{className:"text-[11px] font-semibold mb-1",style:{color:M?"#000000":"#ffffff"},children:x?"--":g.tray_type}),!x&&h.jsx("button",{onClick:A=>{A.stopPropagation(),c(g,w,f.id)},className:"w-4 h-4 flex items-center justify-center rounded hover:bg-black/20 transition-colors",children:h.jsx("img",{src:"/icons/eye.svg",alt:"Settings",className:`w-3.5 h-3.5 ${M?"":"invert"}`,style:{opacity:.8}})})]})]},g.id)})})]}),t.length===0&&h.jsxs("div",{className:"bg-bambu-dark-secondary rounded-[10px] p-6 text-center text-bambu-gray text-sm",children:["No AMS connected to ",e," nozzle"]})]})}function FVe({isDualNozzle:t,leftSlotCount:e,rightSlotCount:n,leftIsHT:i,rightIsHT:r,leftActiveSlot:a,rightActiveSlot:s,leftFilamentColor:o,rightFilamentColor:l}){if(!t)return null;const c="#909090",u=o?Ux(o):null,f=l?Ux(l):null,m=[54,118,182,246],g=[354,418,482,546];return h.jsxs("div",{className:"relative w-full pointer-events-none",style:{height:"120px"},children:[h.jsxs("svg",{className:"absolute inset-0 w-full h-full",viewBox:"0 0 600 120",preserveAspectRatio:"xMidYMid meet",children:[i?h.jsxs(h.Fragment,{children:[h.jsx("line",{x1:"36",y1:"0",x2:"36",y2:"36",stroke:a===0&&u?u:c,strokeWidth:a===0&&u?3:2}),e>1&&h.jsx("line",{x1:"100",y1:"0",x2:"100",y2:"36",stroke:a===1&&u?u:c,strokeWidth:a===1&&u?3:2}),e>1&&h.jsx("line",{x1:"36",y1:"36",x2:"100",y2:"36",stroke:u??c,strokeWidth:u?3:2}),h.jsx("line",{x1:e>1?"68":"36",y1:"36",x2:"288",y2:"36",stroke:u??c,strokeWidth:u?3:2}),h.jsx("line",{x1:"288",y1:"36",x2:"288",y2:"85",stroke:u??c,strokeWidth:u?3:2})]}):h.jsxs(h.Fragment,{children:[m.map((b,y)=>h.jsx("line",{x1:b,y1:"0",x2:b,y2:"14",stroke:a===y&&u?u:c,strokeWidth:a===y&&u?3:2},`left-slot-${y}`)),a!=null&&u?h.jsxs(h.Fragment,{children:[h.jsx("line",{x1:"54",y1:"14",x2:"246",y2:"14",stroke:c,strokeWidth:"2"}),h.jsx("line",{x1:Math.min(m[a],150),y1:"14",x2:Math.max(m[a],150),y2:"14",stroke:u,strokeWidth:"3"})]}):h.jsx("line",{x1:"54",y1:"14",x2:"246",y2:"14",stroke:c,strokeWidth:"2"}),h.jsx("rect",{x:"136",y:"8",width:"28",height:"14",rx:"2",fill:u??"#c0c0c0",stroke:u??c,strokeWidth:"1"}),h.jsx("line",{x1:"150",y1:"22",x2:"150",y2:"36",stroke:u??c,strokeWidth:u?3:2}),h.jsx("line",{x1:"150",y1:"36",x2:"288",y2:"36",stroke:u??c,strokeWidth:u?3:2}),h.jsx("line",{x1:"288",y1:"36",x2:"288",y2:"85",stroke:u??c,strokeWidth:u?3:2})]}),r?h.jsxs(h.Fragment,{children:[h.jsx("line",{x1:"336",y1:"0",x2:"336",y2:"36",stroke:s===0&&f?f:c,strokeWidth:s===0&&f?3:2}),n>1&&h.jsx("line",{x1:"400",y1:"0",x2:"400",y2:"36",stroke:s===1&&f?f:c,strokeWidth:s===1&&f?3:2}),n>1&&h.jsx("line",{x1:"336",y1:"36",x2:"400",y2:"36",stroke:f??c,strokeWidth:f?3:2}),h.jsx("line",{x1:"312",y1:"36",x2:n>1?"368":"336",y2:"36",stroke:f??c,strokeWidth:f?3:2}),h.jsx("line",{x1:"312",y1:"36",x2:"312",y2:"85",stroke:f??c,strokeWidth:f?3:2})]}):h.jsxs(h.Fragment,{children:[g.map((b,y)=>h.jsx("line",{x1:b,y1:"0",x2:b,y2:"14",stroke:s===y&&f?f:c,strokeWidth:s===y&&f?3:2},`right-slot-${y}`)),s!=null&&f?h.jsxs(h.Fragment,{children:[h.jsx("line",{x1:"354",y1:"14",x2:"546",y2:"14",stroke:c,strokeWidth:"2"}),h.jsx("line",{x1:Math.min(g[s],450),y1:"14",x2:Math.max(g[s],450),y2:"14",stroke:f,strokeWidth:"3"})]}):h.jsx("line",{x1:"354",y1:"14",x2:"546",y2:"14",stroke:c,strokeWidth:"2"}),h.jsx("rect",{x:"436",y:"8",width:"28",height:"14",rx:"2",fill:f??"#c0c0c0",stroke:f??c,strokeWidth:"1"}),h.jsx("line",{x1:"450",y1:"22",x2:"450",y2:"36",stroke:f??c,strokeWidth:f?3:2}),h.jsx("line",{x1:"312",y1:"36",x2:"450",y2:"36",stroke:f??c,strokeWidth:f?3:2}),h.jsx("line",{x1:"312",y1:"36",x2:"312",y2:"85",stroke:f??c,strokeWidth:f?3:2})]})]}),h.jsxs("div",{className:"absolute left-1/2 -translate-x-1/2 bottom-0 h-[50px] w-[39px]",children:[h.jsx("img",{src:"/icons/extruder-left-right.png",alt:"Extruder",className:"h-full w-full"}),h.jsx("div",{className:"absolute w-[8px] h-[8px] rounded-full",style:{left:"7px",top:"20px",backgroundColor:u??"transparent"}}),h.jsx("div",{className:"absolute w-[8px] h-[8px] rounded-full",style:{left:"25px",top:"20px",backgroundColor:f??"transparent"}})]})]})}function zVe({printerId:t,printerModel:e,status:n,nozzleCount:i}){const{showToast:r}=eo(),a=n?.connected??!1,s=n?.state==="RUNNING",o=i>1,l=n?.ams??[],c=n?.ams_extruder_map??{},u=o?Object.keys(c).length>0?l.filter(ye=>c[String(ye.id)]===0):l.filter((ye,we)=>we%2===0):l,f=o?Object.keys(c).length>0?l.filter(ye=>c[String(ye.id)]===1):l.filter((ye,we)=>we%2===1):[],[m,g]=E.useState(0),[b,y]=E.useState(0),[v,x]=E.useState(null),[M,w]=E.useState(null),[A,T]=E.useState(null),[R,N]=E.useState(null),[j,C]=E.useState(null),k=E.useRef(!1),F=E.useRef(null);E.useEffect(()=>{if(k.current)return;const ye=n?.tray_now;ye!=null&&(k.current=!0,ye!==255&&ye!==254?(console.log(`[AMSSectionDual] Initializing from tray_now: ${ye}`),x(ye)):console.log(`[AMSSectionDual] tray_now=${ye} (no AMS filament loaded)`))},[n?.tray_now]);const I=E.useRef("");E.useEffect(()=>{if(!R)return;const{amsId:ye,trayId:we,startTime:ee}=R,L=l.find(ve=>ve.id===ye)?.tray?.find(ve=>ve.id===we);if(!L)return;const Z=JSON.stringify({tag_uid:L.tag_uid,tray_uuid:L.tray_uuid,tray_id_name:L.tray_id_name,tray_type:L.tray_type,tray_color:L.tray_color}),ge=Date.now()-ee;I.current&&I.current!==Z&&ge>500&&(console.log(`[AMSSectionDual] RFID refresh complete for AMS ${ye} tray ${we} (took ${ge}ms)`),N(null)),I.current=Z},[R,l]);const G=yt({mutationFn:({trayId:ye,extruderId:we})=>Fe.amsLoadFilament(t,ye,we),onSuccess:(ye,{trayId:we,extruderId:ee})=>{console.log(`[AMSSectionDual] Load filament success (tray ${we}, extruder ${ee}):`,ye)},onError:(ye,{trayId:we,extruderId:ee})=>{console.error(`[AMSSectionDual] Load filament error (tray ${we}, extruder ${ee}):`,ye)}}),O=yt({mutationFn:()=>Fe.amsUnloadFilament(t),onSuccess:ye=>{console.log("[AMSSectionDual] Unload filament success:",ye)},onError:ye=>{console.error("[AMSSectionDual] Unload filament error:",ye)}}),B=ye=>{x(ye)},$=ye=>{if(o)for(const we of l){const ee=we.id>=128?2:4,U=we.id*4;if(ye>=U&&ye{if(console.log(`[AMSSectionDual] handleLoad called, selectedTray: ${v}`),v!==null){const ye=$(v);console.log(`[AMSSectionDual] Calling loadMutation.mutate(tray: ${v}, extruder: ${ye})`),F.current="load",C({isLoading:!0,targetTrayId:v}),G.mutate({trayId:v,extruderId:ye})}},K=()=>{console.log(`[AMSSectionDual] handleUnload called, printerId: ${t}, trayNow: ${n?.tray_now}`),F.current="unload",C({isLoading:!1,targetTrayId:null}),console.log("[AMSSectionDual] Calling unloadMutation.mutate()"),O.mutate()},Y=()=>{console.log("[AMSSectionDual] FilamentChangeCard completed, closing card"),F.current=null,C(null)},se=G.isPending||O.isPending,H=(ye,we)=>{w({humidity:ye,temp:we})},X=yt({mutationFn:({amsId:ye,trayId:we})=>Fe.refreshAmsTray(t,ye,we),onSuccess:(ye,we)=>{console.log(`[AMSSectionDual] Tray refresh response (AMS ${we.amsId}, Tray ${we.trayId}):`,ye),ye.success?r(ye.message||"RFID refresh started","success"):r(ye.message||"Failed to refresh tray","error")},onError:(ye,we)=>{console.error(`[AMSSectionDual] Tray refresh error (AMS ${we.amsId}, Tray ${we.trayId}):`,ye),r("Failed to refresh tray","error")}}),ae=(ye,we)=>{console.log(`[AMSSectionDual] Slot refresh triggered: AMS ${ye}, Slot ${we}, printerId: ${t}`),I.current="";const ee=Date.now();N({amsId:ye,trayId:we,startTime:ee}),X.mutate({amsId:ye,trayId:we}),setTimeout(()=>{N(U=>U&&U.startTime===ee?(console.log(`[AMSSectionDual] RFID refresh timeout for AMS ${ye} tray ${we}`),null):U)},15e3)},le=(ye,we,ee)=>{T({tray:ye,slotLabel:we,amsId:ee})},de=n?.ams_status_main??0,Q=de===1,xe=E.useRef(de),Re=E.useRef(!1);E.useEffect(()=>{const ye=xe.current===1;Q?(Re.current=!0,C(null)):ye&&!Q&&Re.current&&(console.log("[AMSSectionDual] ams_status_main transitioned 1->0, operation was started, closing card"),F.current=null,Re.current=!1,C(null)),xe.current=de},[Q,de]);const pe=Q||j!==null,Me=n?.tray_now??255,Ie=n?.ams_status_sub??0,dt=F.current==="load"?!0:F.current==="unload"?!1:j!==null?j.isLoading:!(Ie===4||Me===255),z=()=>{if(Me===255||Me===254)return{leftActiveSlot:null,rightActiveSlot:null,leftFilamentColor:null,rightFilamentColor:null};for(const ye of l){const we=ye.id>=128?2:4,ee=ye.id*4;if(Me>=ee&&Mew(null)}),A&&h.jsx(LVe,{tray:A.tray,amsId:A.amsId,slotLabel:A.slotLabel,printerId:t,printerModel:e,nozzleDiameter:n?.nozzles?.[0]?.nozzle_diameter||"0.4",onClose:()=>T(null)})]})}function BVe({printerId:t,status:e,onClose:n}){const i=Rn(),r=e?.connected??!1;E.useEffect(()=>{const c=u=>{u.key==="Escape"&&n()};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[n]);const a=yt({mutationFn:c=>Fe.setTimelapse(t,c),onSuccess:c=>{console.log("Timelapse mutation success:",c),i.invalidateQueries({queryKey:["printerStatuses"]})},onError:c=>{console.error("Timelapse mutation error:",c)}}),s=yt({mutationFn:c=>Fe.setLiveview(t,c),onSuccess:c=>{console.log("Liveview mutation success:",c),i.invalidateQueries({queryKey:["printerStatuses"]})},onError:c=>{console.error("Liveview mutation error:",c)}});console.log("CameraSettingsModal render - isConnected:",r,"status:",e);const o=()=>{console.log("Timelapse toggle clicked, current:",e?.timelapse,"setting to:",!e?.timelapse),a.mutate(!e?.timelapse)},l=()=>{console.log("Liveview toggle clicked, current:",e?.ipcam,"setting to:",!e?.ipcam),s.mutate(!e?.ipcam)};return h.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:n,children:h.jsx(Xt,{className:"w-full max-w-sm",onClick:c=>c.stopPropagation(),children:h.jsxs(en,{className:"p-0",children:[h.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-bambu-dark-tertiary",children:[h.jsx("span",{className:"text-sm font-medium text-white",children:"Camera Settings"}),h.jsx("button",{onClick:n,className:"p-1 rounded hover:bg-bambu-dark-tertiary text-bambu-gray hover:text-white",children:h.jsx(fn,{className:"w-4 h-4"})})]}),h.jsxs("div",{className:"p-4 space-y-4",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"text-sm text-white",children:"Auto-record Monitoring"}),h.jsx("button",{onClick:l,disabled:!r||s.isPending,className:`relative w-12 h-6 rounded-full transition-colors disabled:opacity-50 disabled:cursor-not-allowed ${e?.ipcam?"bg-bambu-green":"bg-bambu-dark-tertiary"}`,children:s.isPending?h.jsx(It,{className:"absolute inset-0 m-auto w-4 h-4 animate-spin text-white"}):h.jsx("span",{className:`absolute top-1 w-4 h-4 rounded-full bg-white transition-transform ${e?.ipcam?"left-7":"left-1"}`})})]}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"text-sm text-white",children:"Go Live"}),h.jsx("button",{onClick:o,disabled:!r||a.isPending,className:`relative w-12 h-6 rounded-full transition-colors disabled:opacity-50 disabled:cursor-not-allowed ${e?.timelapse?"bg-bambu-green":"bg-bambu-dark-tertiary"}`,children:a.isPending?h.jsx(It,{className:"absolute inset-0 m-auto w-4 h-4 animate-spin text-white"}):h.jsx("span",{className:`absolute top-1 w-4 h-4 rounded-full bg-white transition-transform ${e?.timelapse?"left-7":"left-1"}`})})]})]})]})})})}function mG(t){const e=t.toUpperCase();if(e.startsWith("HH")||e.startsWith("HS"))return"Hardened Steel";if(e.startsWith("SS"))return"Stainless Steel";switch(t){case"hardened_steel":return"Hardened Steel";case"stainless_steel":return"Stainless Steel";default:return t||"Unknown"}}function gG(t){return t.toUpperCase().startsWith("HH")?"High flow":"Standard"}function HVe({printer:t,status:e,onClose:n}){const i=Rn(),r=t.nozzle_count>1;E.useEffect(()=>{const u=f=>{f.key==="Escape"&&n()};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[n]);const a=e?.nozzles?.[0],s=e?.nozzles?.[1],o=s?.nozzle_type||s?.nozzle_diameter?s:a,l=yt({mutationFn:()=>Fe.refreshStatus(t.id),onSuccess:()=>{i.invalidateQueries({queryKey:["printerStatuses"]})}}),c=()=>{l.mutate()};return h.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:n,children:h.jsx(Xt,{className:"w-full max-w-2xl",onClick:u=>u.stopPropagation(),children:h.jsxs(en,{className:"p-0",children:[h.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-bambu-dark-tertiary",children:[h.jsx("span",{className:"text-sm font-medium text-white",children:"Printer Parts"}),h.jsx("button",{onClick:n,className:"p-1 rounded hover:bg-bambu-dark-tertiary text-bambu-gray hover:text-white",children:h.jsx(fn,{className:"w-4 h-4"})})]}),h.jsxs("div",{className:"p-6 space-y-6",children:[h.jsxs("div",{children:[h.jsx("h3",{className:"text-base font-semibold text-white mb-3",children:r?"Left Nozzle":"Nozzle"}),h.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1.5",children:"Type"}),h.jsx("div",{className:"px-3 py-2 bg-bambu-dark rounded border border-bambu-dark-tertiary text-sm text-bambu-gray",children:mG(a?.nozzle_type||"")})]}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1.5",children:"Diameter"}),h.jsx("div",{className:"px-3 py-2 bg-bambu-dark rounded border border-bambu-dark-tertiary text-sm text-bambu-gray",children:a?.nozzle_diameter||"—"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1.5",children:"Flow"}),h.jsx("div",{className:"px-3 py-2 bg-bambu-dark rounded border border-bambu-dark-tertiary text-sm text-bambu-gray",children:gG(a?.nozzle_type||"")})]})]})]}),r&&h.jsxs("div",{children:[h.jsx("h3",{className:"text-base font-semibold text-white mb-3",children:"Right Nozzle"}),h.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1.5",children:"Type"}),h.jsx("div",{className:"px-3 py-2 bg-bambu-dark rounded border border-bambu-dark-tertiary text-sm text-bambu-gray",children:mG(o?.nozzle_type||"")})]}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1.5",children:"Diameter"}),h.jsx("div",{className:"px-3 py-2 bg-bambu-dark rounded border border-bambu-dark-tertiary text-sm text-bambu-gray",children:o?.nozzle_diameter||"—"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1.5",children:"Flow"}),h.jsx("div",{className:"px-3 py-2 bg-bambu-dark rounded border border-bambu-dark-tertiary text-sm text-bambu-gray",children:gG(o?.nozzle_type||"")})]})]})]}),h.jsxs("p",{className:"text-sm text-bambu-gray",children:["Please change the nozzle settings on the printer."," ",h.jsx("a",{href:"https://wiki.bambulab.com",target:"_blank",rel:"noopener noreferrer",className:"text-bambu-green hover:underline",children:"View wiki"})]})]}),h.jsx("div",{className:"flex justify-end px-4 py-3 border-t border-bambu-dark-tertiary",children:h.jsxs("button",{onClick:c,disabled:l.isPending,className:"flex items-center gap-2 px-4 py-2 bg-bambu-green hover:bg-bambu-green-dark disabled:opacity-50 text-white text-sm font-medium rounded",children:[l.isPending?h.jsx(It,{className:"w-4 h-4 animate-spin"}):h.jsx(el,{className:"w-4 h-4"}),"Refresh"]})})]})})})}function $d({checked:t,onChange:e,disabled:n,loading:i}){return h.jsx("button",{onClick:()=>!n&&!i&&e(!t),disabled:n||i,className:`w-5 h-5 rounded border-2 flex items-center justify-center transition-colors ${t?"bg-bambu-green border-bambu-green":"bg-transparent border-bambu-gray"} ${n||i?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:i?h.jsx(It,{className:"w-3 h-3 animate-spin text-white"}):t?h.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):null})}function d_({value:t,onChange:e,disabled:n,loading:i}){const[r,a]=E.useState(!1),s=["Low","Medium","High"],o=t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),l=n||i;return h.jsxs("div",{className:"relative",children:[h.jsxs("button",{onClick:()=>!l&&a(!r),disabled:l,className:`flex items-center gap-2 px-3 py-1.5 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-sm text-white min-w-[100px] justify-between ${l?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-bambu-gray"}`,children:[i?h.jsx(It,{className:"w-4 h-4 animate-spin text-bambu-green"}):h.jsx("span",{children:o}),h.jsx(Gf,{className:"w-4 h-4 text-bambu-gray"})]}),r&&!l&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>a(!1)}),h.jsx("div",{className:"absolute top-full left-0 mt-1 w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded shadow-lg z-20",children:s.map(c=>h.jsx("button",{onClick:()=>{e(c.toLowerCase()),a(!1)},className:`w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary ${t.toLowerCase()===c.toLowerCase()?"text-bambu-green":"text-white"}`,children:c},c))})]})]})}function $Ve({printer:t,status:e,onClose:n}){const i=Rn(),r=e?.print_options,a=e?.connected??!1;E.useEffect(()=>{const f=m=>{m.key==="Escape"&&n()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[n]);const s=yt({mutationFn:({apiModuleName:f,enabled:m,printHalt:g,sensitivity:b})=>Fe.setPrintOption(t.id,f,m,g,b),onSuccess:()=>{i.invalidateQueries({queryKey:["printerStatuses"]})}}),o=(f,m,g)=>{const b=m&&g!==void 0&&g!=="never_halt";s.mutate({uiModuleName:f,apiModuleName:f,enabled:m,printHalt:b,sensitivity:g??"medium"})},l=(f,m)=>{let g=f;f==="pileup_detector"&&(g="spaghetti_detector"),s.mutate({uiModuleName:f,apiModuleName:g,enabled:!0,printHalt:!0,sensitivity:m})},c=f=>s.isPending&&s.variables?.uiModuleName===f,u=f=>{if(!s.isPending||!s.variables?.sensitivity)return!1;const m=s.variables.uiModuleName;return m===f||m==="spaghetti_detector"&&f==="pileup_detector"||m==="pileup_detector"&&f==="spaghetti_detector"};return h.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:n,children:h.jsx(Xt,{className:"w-full max-w-xl max-h-[90vh] flex flex-col",onClick:f=>f.stopPropagation(),children:h.jsxs(en,{className:"p-0 flex flex-col h-full",children:[h.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-bambu-dark-tertiary",children:[h.jsx("span",{className:"text-sm font-medium text-white",children:"Print Options"}),h.jsx("button",{onClick:n,className:"p-1 rounded hover:bg-bambu-dark-tertiary text-bambu-gray hover:text-white",children:h.jsx(fn,{className:"w-4 h-4"})})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[!a&&h.jsxs("div",{className:"flex items-center gap-2 p-3 bg-red-500/20 border border-red-500/50 rounded text-red-400",children:[h.jsx(ya,{className:"w-4 h-4"}),h.jsx("span",{className:"text-sm",children:"Printer not connected. Options cannot be changed."})]}),r?h.jsxs(h.Fragment,{children:[h.jsxs("div",{children:[h.jsx("h3",{className:"text-base font-semibold text-white mb-1",children:"AI Detections"}),h.jsx("p",{className:"text-xs text-bambu-gray mb-4",children:"Printer will send assistant message or pause printing if any of the following problem is detected."}),h.jsxs("div",{className:"space-y-5",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx($d,{checked:r.spaghetti_detector,onChange:f=>o("spaghetti_detector",f,r.halt_print_sensitivity),disabled:!a,loading:c("spaghetti_detector")}),h.jsx("span",{className:"text-sm font-medium text-white",children:"Spaghetti Detection"})]}),h.jsx("p",{className:"text-xs text-bambu-gray ml-8",children:"Detects spaghetti failure (scattered loose filament)."}),h.jsxs("div",{className:"flex items-center gap-3 ml-8",children:[h.jsx("span",{className:"text-xs text-bambu-gray",children:"Pausing Sensitivity:"}),h.jsx(d_,{value:r.halt_print_sensitivity||"medium",onChange:f=>l("spaghetti_detector",f),disabled:!a||!r.spaghetti_detector,loading:u("spaghetti_detector")})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx($d,{checked:r.pileup_detector,onChange:f=>o("pileup_detector",f,r.pileup_sensitivity),disabled:!a,loading:c("pileup_detector")}),h.jsx("span",{className:"text-sm font-medium text-white",children:"Purge Chute Pile-Up Detection"})]}),h.jsx("p",{className:"text-xs text-bambu-gray ml-8",children:"Monitors if the waste is piled up in the purge chute."}),h.jsxs("div",{className:"flex items-center gap-3 ml-8",children:[h.jsx("span",{className:"text-xs text-bambu-gray",children:"Pausing Sensitivity:"}),h.jsx(d_,{value:r.pileup_sensitivity||"medium",onChange:f=>l("pileup_detector",f),disabled:!a||!r.pileup_detector,loading:u("pileup_detector")})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx($d,{checked:r.nozzle_clumping_detector,onChange:f=>o("clump_detector",f,r.nozzle_clumping_sensitivity),disabled:!a,loading:c("clump_detector")}),h.jsx("span",{className:"text-sm font-medium text-white",children:"Nozzle Clumping Detection"})]}),h.jsx("p",{className:"text-xs text-bambu-gray ml-8",children:"Checks if the nozzle is clumping by filaments or other foreign objects."}),h.jsxs("div",{className:"flex items-center gap-3 ml-8",children:[h.jsx("span",{className:"text-xs text-bambu-gray",children:"Pausing Sensitivity:"}),h.jsx(d_,{value:r.nozzle_clumping_sensitivity||"medium",onChange:f=>l("clump_detector",f),disabled:!a||!r.nozzle_clumping_detector,loading:u("clump_detector")})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx($d,{checked:r.airprint_detector,onChange:f=>o("airprint_detector",f,r.airprint_sensitivity),disabled:!a,loading:c("airprint_detector")}),h.jsx("span",{className:"text-sm font-medium text-white",children:"Air Printing Detection"})]}),h.jsx("p",{className:"text-xs text-bambu-gray ml-8",children:"Detects air printing caused by nozzle clogging or filament grinding."}),h.jsxs("div",{className:"flex items-center gap-3 ml-8",children:[h.jsx("span",{className:"text-xs text-bambu-gray",children:"Pausing Sensitivity:"}),h.jsx(d_,{value:r.airprint_sensitivity||"medium",onChange:f=>l("airprint_detector",f),disabled:!a||!r.airprint_detector,loading:u("airprint_detector")})]})]})]})]}),h.jsx("hr",{className:"border-bambu-dark-tertiary"}),h.jsxs("div",{children:[h.jsx("h3",{className:"text-base font-semibold text-white mb-1",children:"Build Plate Detection"}),h.jsx("p",{className:"text-xs text-bambu-gray mb-4",children:"Ensures the build plate type and placement are correct."}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx($d,{checked:r.buildplate_marker_detector,onChange:f=>o("buildplate_marker_detector",f),disabled:!a,loading:c("buildplate_marker_detector")}),h.jsx("span",{className:"text-sm font-medium text-white",children:"Type Detection"})]}),h.jsx("p",{className:"text-xs text-bambu-gray ml-8",children:"Pauses printing when the detected build plate type does not match the selected one."})]})]}),h.jsx("hr",{className:"border-bambu-dark-tertiary"}),h.jsxs("div",{className:"space-y-5",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx($d,{checked:r.auto_recovery_step_loss,onChange:f=>o("auto_recovery_step_loss",f),disabled:!a,loading:c("auto_recovery_step_loss")}),h.jsx("span",{className:"text-sm font-medium text-white",children:"Auto-recover from step loss"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx($d,{checked:e?.store_to_sdcard??!1,onChange:()=>{},disabled:!0}),h.jsx("span",{className:"text-sm font-medium text-white",children:"Store Sent Files on External Storage"}),h.jsx("span",{className:"text-xs text-bambu-gray italic",children:"(read-only)"})]}),h.jsx("p",{className:"text-xs text-bambu-gray ml-8",children:"Save the printing files initiated from Bambu Studio, Bambu Handy and MakerWorld on External Storage. This option can only be changed on the printer's touchscreen."})]})]})]}):h.jsxs("div",{className:"flex items-center gap-2 text-bambu-gray",children:[h.jsx(ya,{className:"w-4 h-4"}),h.jsx("span",{className:"text-sm",children:"Print options not available. Try refreshing."})]})]})]})})})}const VVe=new Set([1,3,13,25,39,40,47,48,50]);function rx({checked:t,onChange:e,disabled:n}){return h.jsx("button",{onClick:()=>!n&&e(!t),disabled:n,className:`w-5 h-5 rounded border-2 flex items-center justify-center transition-colors ${t?"bg-bambu-green border-bambu-green":"bg-transparent border-bambu-gray"} ${n?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:t&&h.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})})}function GVe({step:t,name:e,isActive:n,isComplete:i,isLast:r}){return h.jsxs("div",{className:"flex items-start gap-3",children:[h.jsxs("div",{className:"flex flex-col items-center",children:[h.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs font-medium flex-shrink-0 bg-bambu-green text-white",children:t}),!r&&h.jsx("div",{className:`w-0.5 h-6 ${i?"bg-bambu-green":"bg-bambu-gray/30"}`})]}),h.jsx("span",{className:`text-sm pt-0.5 ${n?"text-white font-semibold":"text-bambu-gray"}`,children:e})]})}function WVe({printer:t,status:e,onClose:n}){const i=e?.connected??!1,r=t.nozzle_count===2,a=e?.stg_cur??-1,[s,o]=E.useState(!1),[l,c]=E.useState(!1),[u,f]=E.useState(!1),m=`calibration_options_${t.id}`,g=typeof window<"u"?localStorage.getItem(m):null,b=g?JSON.parse(g):null,[y,v]=E.useState(b?.bedLeveling??!0),[x,M]=E.useState(b?.vibration??!0),[w,A]=E.useState(b?.motorNoise??!0),[T,R]=E.useState(b?.nozzleOffset??r),[N,j]=E.useState(b?.highTempHeatbed??!1),[C,k]=E.useState(!1),F=e?.state,I=VVe.has(a)&&F==="RUNNING";E.useEffect(()=>{!C&&I?(c(!0),o(!0),k(!0)):!C&&!I&&k(!0)},[C,I]),E.useEffect(()=>{I&&!l&&(c(!0),f(!1))},[I,l]),E.useEffect(()=>{I&&!s&&o(!0)},[I,s]),E.useEffect(()=>{l&&!I&&!u&&f(!0)},[l,I,u]);const G=()=>{localStorage.removeItem(m),o(!1),c(!1),f(!1),v(!0),M(!0),A(!0),R(r),j(!1)};E.useEffect(()=>{const Y=se=>{se.key==="Escape"&&n()};return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[n]);const O=yt({mutationFn:()=>Fe.startCalibration(t.id,{bed_leveling:y,vibration:x,motor_noise:w,nozzle_offset:T,high_temp_heatbed:N}),onSuccess:()=>{localStorage.setItem(m,JSON.stringify({bedLeveling:y,vibration:x,motorNoise:w,nozzleOffset:T,highTempHeatbed:N})),o(!0)}}),B=y||x||w||T||N,$=i&&B&&!O.isPending&&!I&&!u,V=[];V.push({name:"Homing toolhead",stages:[13]}),(y||N)&&V.push({name:"Cooling heatbed",stages:[50]}),y&&V.push({name:"Auto bed leveling - phase 1",stages:[1,47]}),w&&V.push({name:"Motor noise cancellation",stages:[25]}),x&&V.push({name:"Vibration compensation",stages:[3]}),y&&V.push({name:"Auto bed leveling - phase 2",stages:[48]}),r&&T&&V.push({name:"Nozzle offset calibration",stages:[39]}),N&&V.push({name:"High-temp heatbed calibration",stages:[40]});const K=V.findIndex(Y=>Y.stages.includes(a));return h.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:n,children:h.jsx(Xt,{className:"w-full max-w-3xl max-h-[90vh] flex flex-col",onClick:Y=>Y.stopPropagation(),children:h.jsxs(en,{className:"p-0 flex flex-col h-full",children:[h.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-bambu-dark-tertiary",children:[h.jsx("span",{className:"text-sm font-medium text-white",children:"Calibration"}),h.jsx("button",{onClick:n,className:"p-1 rounded text-bambu-gray hover:bg-bambu-dark-tertiary hover:text-white",children:h.jsx(fn,{className:"w-4 h-4"})})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[!i&&h.jsxs("div",{className:"flex items-center gap-2 p-3 mb-4 bg-red-500/20 border border-red-500/50 rounded text-red-400",children:[h.jsx(ya,{className:"w-4 h-4"}),h.jsx("span",{className:"text-sm",children:"Printer not connected. Calibration cannot be started."})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-8",children:[h.jsxs("div",{children:[h.jsx("h3",{className:"text-base font-semibold text-white mb-4",children:"Calibration step selection"}),h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx(rx,{checked:y,onChange:v,disabled:!i||I}),h.jsx("span",{className:"text-sm text-white",children:"Bed leveling"})]}),h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx(rx,{checked:x,onChange:M,disabled:!i||I}),h.jsx("span",{className:"text-sm text-white",children:"Vibration compensation"})]}),h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx(rx,{checked:w,onChange:A,disabled:!i||I}),h.jsx("span",{className:"text-sm text-white",children:"Motor noise cancellation"})]}),r&&h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx(rx,{checked:T,onChange:R,disabled:!i||I}),h.jsx("span",{className:"text-sm text-white",children:"Nozzle offset calibration"})]}),h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx(rx,{checked:N,onChange:j,disabled:!i||I}),h.jsx("span",{className:"text-sm text-white whitespace-nowrap",children:"High-temperature Heatbed Calibration"})]})]}),h.jsxs("div",{className:"mt-6",children:[h.jsx("h4",{className:"text-sm font-semibold text-white mb-2",children:"Calibration program"}),h.jsx("p",{className:"text-xs text-bambu-gray",children:"The calibration program detects the status of your device automatically to minimize deviation. It keeps the device performing optimally."})]})]}),h.jsxs("div",{className:"flex flex-col",children:[h.jsx("h3",{className:"text-base font-semibold text-bambu-green mb-4 text-center border-b border-bambu-dark-tertiary pb-2",children:"Calibration Flow"}),h.jsx("div",{className:"flex-1 py-4 pl-4",children:B?h.jsxs("div",{className:"space-y-0",children:[V.map((Y,se)=>{const H=s&&!u&&Y.stages.includes(a),X=u||s&&K>se;return h.jsx(GVe,{step:se+1,name:Y.name,isActive:H,isComplete:X,isLast:se===V.length-1},Y.name)}),a>=0&&K===-1&&e?.stg_cur_name&&h.jsxs("div",{className:"mt-4 text-xs text-bambu-gray",children:["Current: ",e.stg_cur_name]})]}):h.jsx("div",{className:"flex items-center justify-center h-full text-sm text-bambu-gray italic",children:"Select calibration steps"})}),u?h.jsxs("div",{className:"space-y-2",children:[h.jsxs("button",{disabled:!0,className:"w-full py-2.5 px-4 rounded-lg font-medium text-sm flex items-center justify-center gap-2 bg-bambu-green text-white cursor-default",children:[h.jsx(Hp,{className:"w-4 h-4"}),"Completed"]}),h.jsx("button",{onClick:G,className:"w-full py-2 px-4 rounded-lg font-medium text-sm text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary transition-colors",children:"New Calibration"})]}):h.jsx("button",{onClick:()=>O.mutate(),disabled:!$,className:`w-full py-2.5 px-4 rounded-lg font-medium text-sm flex items-center justify-center gap-2 transition-colors ${I?"bg-bambu-gray/50 text-white cursor-not-allowed":$?"bg-bambu-green hover:bg-bambu-green/90 text-white":"bg-bambu-dark-tertiary text-bambu-gray cursor-not-allowed"}`,children:I?h.jsxs(h.Fragment,{children:[h.jsx(It,{className:"w-4 h-4 animate-spin"}),"Calibrating"]}):O.isPending?h.jsxs(h.Fragment,{children:[h.jsx(It,{className:"w-4 h-4 animate-spin"}),"Starting..."]}):"Start Calibration"}),O.isError&&h.jsx("div",{className:"mt-2 text-xs text-red-400 text-center",children:O.error?.message||"Failed to start calibration"})]})]})]})]})})})}function qVe(){const[t,e]=Ure(),[n,i]=E.useState(null),[r,a]=E.useState(!1),[s,o]=E.useState(!1),[l,c]=E.useState(!1),[u,f]=E.useState(!1),{data:m,isLoading:g}=Ft({queryKey:["printers"],queryFn:Fe.getPrinters}),{data:b}=Ft({queryKey:["printerStatuses"],queryFn:async()=>{if(!m)return{};const A={};return await Promise.all(m.map(async T=>{try{A[T.id]=await Fe.getPrinterStatus(T.id)}catch{}})),A},enabled:!!m&&m.length>0,refetchInterval:2e3});E.useEffect(()=>{const A=t.get("printer");if(A){const T=parseInt(A,10);if(!isNaN(T)){i(T);return}}m&&m.length>0&&!n&&i(m[0].id)},[m,t,n]);const y=A=>{i(A),e({printer:String(A)})},v=m?.find(A=>A.id===n),x=n?b?.[n]:null,w=x?new Set([1,3,13,25,39,40,47,48,50]).has(x.stg_cur):!1;return g?h.jsx("div",{className:"flex items-center justify-center h-screen",children:h.jsx(It,{className:"w-8 h-8 animate-spin text-bambu-green"})}):!m||m.length===0?h.jsxs("div",{className:"flex flex-col items-center justify-center h-screen text-bambu-gray",children:[h.jsx(Vp,{className:"w-16 h-16 mb-4"}),h.jsx("p",{className:"text-xl",children:"No printers configured"}),h.jsx("p",{className:"text-sm mt-2",children:"Add a printer in the Printers page first"})]}):h.jsxs("div",{className:"h-screen flex flex-col bg-bambu-dark",children:[h.jsx("div",{className:"bg-bambu-dark-secondary border-b border-bambu-dark-tertiary",children:h.jsx("div",{className:"flex overflow-x-auto",children:m.filter(A=>b?.[A.id]?.connected).map(A=>{const T=b?.[A.id],R=A.id===n;return h.jsxs("button",{onClick:()=>y(A.id),className:`flex items-center gap-2 px-6 py-3 text-sm font-medium transition-colors whitespace-nowrap border-b-2 ${R?"border-bambu-green text-bambu-green bg-bambu-dark":"border-transparent text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary"}`,children:[h.jsx("span",{className:"w-2 h-2 rounded-full bg-bambu-green"}),A.name,T?.state&&T.state!=="IDLE"&&h.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-bambu-dark-tertiary",children:T.state})]},A.id)})})}),v&&h.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[h.jsxs("div",{className:"flex-1 flex flex-col bg-bambu-dark",children:[h.jsxs("div",{className:"flex items-center justify-end gap-2 px-3 py-2.5 bg-bambu-dark-secondary border-b border-bambu-dark-tertiary min-h-[44px]",children:[h.jsx("button",{className:`p-1.5 rounded hover:bg-bambu-dark-tertiary ${x?.sdcard?"text-bambu-green":"text-bambu-gray hover:text-white"}`,children:h.jsx("img",{src:"/icons/micro-sd.svg",alt:"SD Card",className:`w-4 h-4 ${x?.sdcard?"icon-green":"icon-theme"}`})}),h.jsx("button",{className:`p-1.5 rounded hover:bg-bambu-dark-tertiary ${x?.timelapse?"text-red-500":"text-bambu-gray hover:text-white"}`,children:h.jsx(Ale,{className:"w-4 h-4"})}),h.jsx("button",{className:`p-1.5 rounded hover:bg-bambu-dark-tertiary ${x?.ipcam?"text-bambu-green":"text-bambu-gray hover:text-white"}`,children:h.jsx(Cle,{className:"w-4 h-4"})}),h.jsx("button",{onClick:()=>a(!0),className:"p-1.5 rounded hover:bg-bambu-dark-tertiary text-bambu-gray hover:text-white",children:h.jsx(m9,{className:"w-4 h-4"})})]}),h.jsx("div",{className:"flex-1 bg-black",children:h.jsx(hVe,{printerId:v.id,isConnected:x?.connected??!1})}),h.jsx("div",{className:"h-1 bg-bambu-green"}),h.jsx("div",{className:"bg-bambu-dark-secondary p-4 px-5",children:h.jsx(mVe,{printerId:v.id,status:x})})]}),h.jsxs("div",{className:"w-[680px] flex flex-col bg-bambu-dark-secondary border-l border-bambu-dark-tertiary overflow-y-auto",children:[h.jsxs("div",{className:"flex items-center justify-between px-3 py-2.5 border-b border-bambu-dark-tertiary min-h-[44px]",children:[h.jsx("span",{className:"text-sm text-bambu-gray",children:"Control"}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx("button",{onClick:()=>o(!0),className:"px-4 py-1.5 text-xs rounded bg-bambu-green text-white hover:bg-bambu-green-dark",children:"Printer Parts"}),h.jsx("button",{onClick:()=>c(!0),className:"px-4 py-1.5 text-xs rounded bg-bambu-green text-white hover:bg-bambu-green-dark",children:"Print Options"}),h.jsx("button",{onClick:()=>f(!0),className:"px-4 py-1.5 text-xs rounded bg-bambu-green text-white hover:bg-bambu-green-dark",children:"Calibration"})]})]}),!x?.connected&&h.jsxs("div",{className:"m-3 p-3 bg-red-500/20 border border-red-500/50 rounded-lg flex items-center gap-3",children:[h.jsx(Vp,{className:"w-4 h-4 text-red-500"}),h.jsx("span",{className:"text-sm text-red-400",children:"Printer is not connected. Controls are disabled."})]}),h.jsxs("div",{className:"flex-1 p-4 bg-bambu-dark",children:[h.jsx("div",{className:"mb-4 bg-bambu-dark-tertiary rounded-[10px] p-3",children:h.jsxs("div",{className:"flex gap-4 bg-bambu-dark-secondary rounded-[8px] p-4 overflow-hidden",style:{minHeight:"300px"},children:[h.jsx(_Ve,{printer:v,status:x,disabled:w}),h.jsxs("div",{className:"flex-1 flex gap-6 items-center justify-center",children:[h.jsxs("div",{className:"flex flex-col items-center",children:[h.jsx(wVe,{printerId:v.id,status:x,disabled:w}),h.jsx(MVe,{printerId:v.id,status:x,disabled:w})]}),h.jsx(EVe,{printerId:v.id,status:x,nozzleCount:v.nozzle_count,disabled:w})]})]})}),h.jsx(zVe,{printerId:v.id,printerModel:v.model||"X1C",status:x,nozzleCount:v.nozzle_count})]})]})]}),r&&v&&h.jsx(BVe,{printerId:v.id,status:x,onClose:()=>a(!1)}),s&&v&&h.jsx(HVe,{printer:v,status:x,onClose:()=>o(!1)}),l&&v&&h.jsx($Ve,{printer:v,status:x,onClose:()=>c(!1)}),u&&v&&h.jsx(WVe,{printer:v,status:x,onClose:()=>f(!1)})]})}function XVe(){const t=E.useRef(null),e=E.useRef(null),n=Rn(),[i,r]=E.useState(!1),a=E.useCallback(()=>{if(t.current?.readyState===WebSocket.OPEN)return;const c=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/v1/ws`,u=new WebSocket(c);let f=null;u.onopen=()=>{console.log("[WebSocket] Connected"),r(!0),f=window.setInterval(()=>{u.readyState===WebSocket.OPEN&&u.send(JSON.stringify({type:"ping"}))},3e4)},u.onmessage=m=>{try{const g=JSON.parse(m.data);s(g)}catch{}},u.onclose=m=>{console.log("[WebSocket] Closed",m.code,m.reason),f&&(clearInterval(f),f=null),r(!1),t.current=null,e.current=window.setTimeout(()=>{a()},3e3)},u.onerror=m=>{console.error("[WebSocket] Error",m),u.close()},t.current=u},[]),s=E.useCallback(l=>{switch(l.type){case"printer_status":l.printer_id!==void 0&&n.setQueryData(["printerStatus",l.printer_id],c=>({...c,...l.data}));break;case"print_complete":n.invalidateQueries({queryKey:["archives"]}),n.invalidateQueries({queryKey:["archiveStats"]});break;case"archive_created":n.invalidateQueries({queryKey:["archives"]}),n.invalidateQueries({queryKey:["archiveStats"]});break}},[n]);E.useEffect(()=>(a(),()=>{e.current&&clearTimeout(e.current),t.current&&t.current.close()}),[a]);const o=E.useCallback(l=>{t.current?.readyState===WebSocket.OPEN&&t.current.send(JSON.stringify(l))},[]);return{isConnected:i,sendMessage:o}}const KVe=new hae({defaultOptions:{queries:{staleTime:1e3*60,retry:1}}});function YVe({children:t}){return XVe(),h.jsx(h.Fragment,{children:t})}function ZVe(){return h.jsx(zle,{children:h.jsx(Yle,{children:h.jsx(pae,{client:KVe,children:h.jsx(YVe,{children:h.jsx(Ore,{children:h.jsx(ure,{children:h.jsxs(jo,{path:"/",element:h.jsx(qle,{}),children:[h.jsx(jo,{index:!0,element:h.jsx(fce,{})}),h.jsx(jo,{path:"archives",element:h.jsx(U2e,{})}),h.jsx(jo,{path:"queue",element:h.jsx(B2e,{})}),h.jsx(jo,{path:"stats",element:h.jsx(V$e,{})}),h.jsx(jo,{path:"profiles",element:h.jsx(oVe,{})}),h.jsx(jo,{path:"maintenance",element:h.jsx(fVe,{})}),h.jsx(jo,{path:"control",element:h.jsx(qVe,{})}),h.jsx(jo,{path:"settings",element:h.jsx(J$e,{})})]})})})})})})})}pne.createRoot(document.getElementById("root")).render(h.jsx(E.StrictMode,{children:h.jsx(ZVe,{})}));
+G90`;return Fe.sendGcode(t,A,w)},onSuccess:(M,w)=>{Wx(M)&&u({token:M.token,warning:M.warning,distance:w.distance})}}),g=M=>{m.mutate({distance:M})},b=()=>{c&&(m.mutate({distance:c.distance,token:c.token}),u(null))},y=!a||s||m.isPending,v=f.isPending,x=()=>o?l===1?"/icons/dual-extruder-left.png":"/icons/dual-extruder-right.png":"/icons/single-extruder1.png";return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex flex-col items-center gap-1.5 justify-center",children:[o&&h.jsxs("div",{className:`flex rounded-md overflow-hidden border border-bambu-dark-tertiary mb-1 flex-shrink-0 ${y||v?"opacity-50":""}`,children:[h.jsx("button",{onClick:()=>f.mutate(1),disabled:y||v,className:`px-3 py-1.5 text-sm border-r border-bambu-dark-tertiary transition-colors disabled:cursor-not-allowed ${l===1?"bg-bambu-green text-white":"bg-bambu-dark-secondary text-bambu-gray hover:bg-bambu-dark-tertiary disabled:hover:bg-bambu-dark-secondary"}`,children:"Left"}),h.jsx("button",{onClick:()=>f.mutate(0),disabled:y||v,className:`px-3 py-1.5 text-sm transition-colors disabled:cursor-not-allowed ${l===0?"bg-bambu-green text-white":"bg-bambu-dark-secondary text-bambu-gray hover:bg-bambu-dark-tertiary disabled:hover:bg-bambu-dark-secondary"}`,children:"Right"})]}),h.jsx("button",{onClick:()=>g(5),disabled:y,className:"w-9 h-[30px] rounded-md bg-bambu-dark-secondary hover:bg-bambu-dark-tertiary border border-bambu-dark-tertiary flex items-center justify-center text-bambu-gray disabled:opacity-50 disabled:cursor-not-allowed",title:"Extrude 5mm",children:h.jsx(QS,{className:"w-4 h-4"})}),h.jsx("div",{className:"h-[120px] flex items-center justify-center",children:h.jsx("img",{src:x(),alt:o?`${l===1?"Left":"Right"} Extruder Active`:"Single Extruder",className:"h-full object-contain",onError:M=>{M.target.style.display="none"}})}),h.jsx("button",{onClick:()=>g(-5),disabled:y,className:"w-9 h-[30px] rounded-md bg-bambu-dark-secondary hover:bg-bambu-dark-tertiary border border-bambu-dark-tertiary flex items-center justify-center text-bambu-gray disabled:opacity-50 disabled:cursor-not-allowed",title:"Retract 5mm",children:h.jsx(Gf,{className:"w-4 h-4"})}),h.jsx("span",{className:"text-xs text-bambu-gray mt-0.5",children:"Extruder"})]}),c&&h.jsx(rr,{title:"Confirm Extrusion",message:c.warning,confirmText:"Continue",variant:"warning",onConfirm:b,onCancel:()=>u(null)})]})}function AVe({humidity:t}){const e=()=>t<25?"/icons/humidity-empty.svg":t<40?"/icons/humidity-half.svg":"/icons/humidity-full.svg";return h.jsx("img",{src:e(),alt:"",className:"w-16 h-24"})}function TVe({humidity:t,temperature:e,dryingStatus:n,remainingTime:i,onClose:r}){E.useEffect(()=>{const s=o=>{o.key==="Escape"&&r()};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[r]);const a=()=>{if(n==="idle")return"Idle";if(!i)return"Drying...";const s=Math.floor(i/60),o=i%60;return s>0?`${s}h ${o}m`:`${o}m`};return h.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:h.jsxs("div",{className:"bg-white dark:bg-bambu-dark-secondary rounded-lg shadow-xl max-w-md w-full",children:[h.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-bambu-dark-tertiary",children:[h.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Current AMS humidity"}),h.jsx("button",{onClick:r,className:"p-1 hover:bg-gray-100 dark:hover:bg-bambu-dark-tertiary rounded-lg transition-colors",children:h.jsx(fn,{className:"w-5 h-5 text-gray-500 dark:text-bambu-gray"})})]}),h.jsxs("div",{className:"p-6",children:[h.jsxs("div",{className:"flex flex-col items-center mb-6",children:[h.jsx(AVe,{humidity:t}),h.jsxs("div",{className:"flex items-center gap-2 mt-2 text-gray-600 dark:text-bambu-gray",children:[h.jsx("span",{className:"text-yellow-500",children:"❊"}),h.jsx("span",{children:n==="idle"?"Idle":"Drying"})]})]}),h.jsxs("div",{className:"grid grid-cols-3 gap-4 text-center",children:[h.jsxs("div",{children:[h.jsx("div",{className:"text-sm text-gray-500 dark:text-bambu-gray mb-1",children:"Humidity"}),h.jsxs("div",{className:"text-lg font-medium text-gray-900 dark:text-white",children:[t,"%"]})]}),h.jsxs("div",{children:[h.jsx("div",{className:"text-sm text-gray-500 dark:text-bambu-gray mb-1",children:"Temperature"}),h.jsxs("div",{className:"text-lg font-medium text-gray-900 dark:text-white",children:[e," °C"]})]}),h.jsxs("div",{children:[h.jsx("div",{className:"text-sm text-gray-500 dark:text-bambu-gray mb-1",children:"Remaining Time"}),h.jsx("div",{className:"text-lg font-medium text-gray-900 dark:text-white",children:a()})]})]})]})]})})}function vN(t){const e=t.indexOf(" @");return e>0?t.substring(0,e):t}function CVe(t){let e=t;e.startsWith("# ")&&(e=e.substring(2));const n=e.indexOf(" @");return n>0?e.substring(0,n):e}function NVe(t){let e=t;e.startsWith("# ")&&(e=e.substring(2));const n=e.indexOf(" @");return n>0?e.substring(0,n):e}function RVe(t){if(!t)return"rgb(128, 128, 128)";const e=t.replace("#","").substring(0,6),n=parseInt(e.substring(0,2),16),i=parseInt(e.substring(2,4),16),r=parseInt(e.substring(4,6),16),a=isNaN(n)?128:n,s=isNaN(i)?128:i,o=isNaN(r)?128:r;return`rgb(${a}, ${s}, ${o})`}function bN(t){return t?`#${t.replace("#","").substring(0,6)}`:"#808080"}function PVe(t){if(!t)return!1;const e=t.trim();return e.length!==32||e==="00000000000000000000000000000000"?!1:/^[0-9a-fA-F]{32}$/.test(e)}const kVe={Y2:"Sunflower Yellow",Y0:"Yellow",Y1:"Lemon Yellow",K0:"Black",W0:"White",W1:"Ivory White",R0:"Red",R1:"Scarlet Red",R2:"Magenta",B0:"Blue",B1:"Navy Blue",B2:"Sky Blue",B3:"Cyan",G0:"Green",G1:"Grass Green",G2:"Jade Green",O0:"Orange",O1:"Mandarin Orange",P0:"Purple",P1:"Pink",P2:"Sakura Pink",N0:"Gray",N1:"Silver Gray",N2:"Charcoal",D0:"Brown",D1:"Chocolate",T0:"Titan Gray",T1:"Jade White"};function DVe(t){if(!t)return null;const e=t.split("-");if(e.length<2)return null;const n=e[1];return kVe[n]||null}function OVe(t,e,n,i){if(!t.length)return null;const r=e?.toLowerCase()||"",a=n?.toUpperCase()||"",s=i?.toLowerCase()||"";if(r&&s){const l=t.find(c=>{const u=c.name.toLowerCase();return u.includes(r)&&u.includes(s)});if(l)return l}if(r){const l=t.find(c=>c.name.toLowerCase().includes(r));if(l)return l}if(a){const l=t.filter(c=>c.name.toUpperCase().includes(a));if(l.length>0){const c=l.find(u=>u.name.toLowerCase().includes("basic"));return c||l[0]}}return t.find(l=>l.name.toLowerCase()==="default"||l.slot_id===0)||null}function LVe({tray:t,amsId:e,slotLabel:n,printerId:i,printerModel:r,nozzleDiameter:a="0.4",onClose:s,onConfirm:o}){const l=Rn(),c=!t.tray_type||t.tray_type===""||t.tray_type==="NONE",u=PVe(t.tray_uuid),f=c||!u,{data:m}=Ft({queryKey:["kprofiles",i,a],queryFn:()=>Fe.getKProfiles(i,a)}),{data:g}=Ft({queryKey:["cloudSettings"],queryFn:()=>Fe.getCloudSettings()}),{data:b}=Ft({queryKey:["slotPreset",i,e,t.id],queryFn:()=>Fe.getSlotPreset(i,e,t.id),enabled:f}),y=yt({mutationFn:({presetId:de,presetName:Q})=>Fe.saveSlotPreset(i,e,t.id,de,Q),onSuccess:()=>{l.invalidateQueries({queryKey:["slotPreset",i,e,t.id]})}}),v=(()=>{const de=g?.filament||[],Q=new RegExp(`@.*\\b${r}\\b`,"i"),xe=[...de].sort((Ie,ce)=>{const dt=Q.test(Ie.name),z=Q.test(ce.name);return dt&&!z?-1:!dt&&z?1:0}),Re=new Set;return xe.filter(Ie=>{const ce=CVe(Ie.name);return Re.has(ce)?!1:(Re.add(ce),!0)}).sort((Ie,ce)=>vN(Ie.name).localeCompare(vN(ce.name)))})(),[x,M]=E.useState(null),[w,A]=E.useState(null),[T,R]=E.useState(t.tray_type||""),[N,j]=E.useState(bN(t.tray_color)),[C,k]=E.useState(t.nozzle_temp_max||220),[F,I]=E.useState(t.nozzle_temp_min||190),[G,O]=E.useState(""),[B,$]=E.useState(t.k||0);E.useEffect(()=>{b&&!x&&(M(b.preset_id),A(b.preset_name))},[b,x]);const V=de=>{if(!de){M(null),A(null);return}M(de);const Q=v.find(xe=>xe.setting_id===de);if(Q){A(Q.name);const xe=Q.name.match(/\b(PLA|PETG|ABS|TPU|ASA|PA|PC|PVA|HIPS|PLA-S|PETG-CF|PA-CF|PET-CF)\b/i);xe&&R(xe[1].toUpperCase())}},K=m?.profiles||[],Y=DVe(t.tray_id_name);E.useEffect(()=>{const de=u?t.tray_sub_brands:w?NVe(w):null,Q=u?t.tray_type:T||t.tray_type,Re=OVe(K,de,Q,u?Y:null);Re?(O(Re.name),$(parseFloat(Re.k_value)||0)):(O("Default"),$(0))},[K,T,w,t.tray_type,t.tray_sub_brands,t.tray_id_name,u,Y]),E.useEffect(()=>{const de=Q=>{Q.key==="Escape"&&s()};return window.addEventListener("keydown",de),()=>window.removeEventListener("keydown",de)},[s]);const se=de=>{O(de);const Q=K.find(xe=>xe.name===de);Q&&$(parseFloat(Q.k_value)||0)},H=()=>{f&&x&&w&&y.mutate({presetId:x,presetName:w}),o?.({filamentType:T,color:N,nozzleTempMax:C,nozzleTempMin:F,kProfile:G,kValue:B}),s()},X=()=>{R(t.tray_type||""),j(bN(t.tray_color)),k(t.nozzle_temp_max||220),I(t.nozzle_temp_min||190),$(t.k||0)},ae=u?t.tray_sub_brands||t.tray_type||"Unknown":T||"Select filament",le=u&&t.tray_uuid?t.tray_uuid:"N/A";return h.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:h.jsxs("div",{className:"bg-white dark:bg-bambu-dark-secondary rounded-lg shadow-xl max-w-md w-full",children:[h.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-bambu-dark-tertiary",children:[h.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:["AMS Materials Setting - ",n]}),h.jsx("button",{onClick:s,className:"p-1 hover:bg-gray-100 dark:hover:bg-bambu-dark-tertiary rounded-lg transition-colors",children:h.jsx(fn,{className:"w-5 h-5 text-gray-500 dark:text-bambu-gray"})})]}),h.jsxs("div",{className:"p-6 space-y-4",children:[u&&h.jsxs("div",{className:"flex items-center gap-2 text-xs text-bambu-green bg-bambu-green/10 px-3 py-1.5 rounded-md",children:[h.jsx("span",{className:"w-2 h-2 bg-bambu-green rounded-full"}),"Bambu Lab RFID detected - fields auto-filled"]}),!u&&!c&&h.jsxs("div",{className:"flex items-center gap-2 text-xs text-yellow-600 dark:text-yellow-400 bg-yellow-100 dark:bg-yellow-900/20 px-3 py-1.5 rounded-md",children:[h.jsx("span",{className:"w-2 h-2 bg-yellow-500 rounded-full"}),"Non-Bambu Lab filament - please verify settings"]}),c&&h.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 dark:text-bambu-gray bg-gray-100 dark:bg-bambu-dark px-3 py-1.5 rounded-md",children:[h.jsx("span",{className:"w-2 h-2 bg-gray-400 rounded-full"}),"Empty slot - configure filament settings"]}),h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsx("label",{className:"w-28 text-sm text-gray-600 dark:text-bambu-gray",children:"Filament"}),f?h.jsxs("select",{value:x||"",onChange:de=>V(de.target.value),className:"flex-1 min-w-0 px-3 py-2 bg-gray-100 dark:bg-bambu-dark rounded-md border border-gray-300 dark:border-bambu-dark-tertiary text-gray-900 dark:text-white text-sm truncate",children:[h.jsx("option",{value:"",children:"Select filament..."}),v.length>0?v.map(de=>h.jsx("option",{value:de.setting_id,children:vN(de.name)},de.setting_id)):h.jsxs("option",{value:"",disabled:!0,children:["No filament presets for ",r]})]}):h.jsx("div",{className:"flex-1 px-3 py-2 bg-gray-100 dark:bg-bambu-dark rounded-md text-gray-900 dark:text-white",children:ae})]}),h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsx("label",{className:"w-28 text-sm text-gray-600 dark:text-bambu-gray",children:"Color"}),h.jsx("div",{className:"flex items-center gap-2 flex-1",children:f?h.jsxs(h.Fragment,{children:[h.jsx("input",{type:"color",value:N,onChange:de=>j(de.target.value),className:"w-10 h-10 rounded cursor-pointer border-2 border-gray-300 dark:border-bambu-dark-tertiary"}),h.jsx("span",{className:"text-gray-900 dark:text-white text-sm",children:N.toUpperCase()})]}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"w-8 h-8 rounded-full border-2 border-gray-300 dark:border-bambu-dark-tertiary flex-shrink-0",style:{backgroundColor:RVe(t.tray_color)}}),h.jsx("span",{className:"text-gray-900 dark:text-white",children:Y||bN(t.tray_color).toUpperCase()})]})})]}),h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsx("label",{className:"w-28 text-sm text-gray-600 dark:text-bambu-gray",children:"Nozzle Temp"}),h.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[h.jsxs("div",{children:[h.jsx("div",{className:"text-xs text-gray-500 dark:text-bambu-gray mb-1",children:"min"}),h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("input",{type:"number",value:F,onChange:de=>I(Number(de.target.value)),disabled:!f,className:"w-20 px-2 py-1 bg-gray-100 dark:bg-bambu-dark rounded border border-gray-300 dark:border-bambu-dark-tertiary text-gray-900 dark:text-white disabled:opacity-60"}),h.jsx("span",{className:"text-gray-600 dark:text-bambu-gray",children:"°C"})]})]}),h.jsxs("div",{children:[h.jsx("div",{className:"text-xs text-gray-500 dark:text-bambu-gray mb-1",children:"max"}),h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("input",{type:"number",value:C,onChange:de=>k(Number(de.target.value)),disabled:!f,className:"w-20 px-2 py-1 bg-gray-100 dark:bg-bambu-dark rounded border border-gray-300 dark:border-bambu-dark-tertiary text-gray-900 dark:text-white disabled:opacity-60"}),h.jsx("span",{className:"text-gray-600 dark:text-bambu-gray",children:"°C"})]})]})]})]}),h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsx("label",{className:"w-28 text-sm text-gray-600 dark:text-bambu-gray",children:"SN"}),h.jsx("div",{className:"flex-1 px-3 py-2 bg-gray-100 dark:bg-bambu-dark rounded-md text-gray-900 dark:text-white text-xs font-mono truncate",children:le})]}),h.jsxs("div",{className:"pt-4 border-t border-gray-200 dark:border-bambu-dark-tertiary",children:[h.jsxs("h3",{className:"text-sm font-medium text-gray-900 dark:text-white mb-3",children:["Flow Dynamics Calibration"," ",h.jsxs("a",{href:"https://wiki.bambulab.com/en/software/bambu-studio/calibration_pa",target:"_blank",rel:"noopener noreferrer",className:"text-bambu-green hover:underline inline-flex items-center gap-1",children:["Wiki",h.jsx(Qo,{className:"w-3 h-3"})]})]}),h.jsxs("div",{className:"flex items-center gap-4 mb-3",children:[h.jsx("label",{className:"w-28 text-sm text-gray-600 dark:text-bambu-gray flex-shrink-0",children:"K Profile"}),h.jsxs("select",{value:G,onChange:de=>se(de.target.value),className:"flex-1 min-w-0 px-3 py-2 bg-gray-100 dark:bg-bambu-dark rounded-md border border-gray-300 dark:border-bambu-dark-tertiary text-gray-900 dark:text-white text-sm truncate",children:[h.jsx("option",{value:"Default",children:"Default"}),K.map(de=>h.jsxs("option",{value:de.name,children:[de.name," (K=",parseFloat(de.k_value).toFixed(3),")"]},de.slot_id))]})]}),h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsx("label",{className:"w-28 text-sm text-gray-600 dark:text-bambu-gray",children:"Factor K"}),h.jsx("div",{className:"flex-1 px-3 py-2 bg-gray-100 dark:bg-bambu-dark rounded-md text-gray-900 dark:text-white",children:B.toFixed(3)})]})]})]}),h.jsxs("div",{className:"flex items-center justify-center gap-3 p-4 border-t border-gray-200 dark:border-bambu-dark-tertiary",children:[h.jsx("button",{onClick:H,className:"px-6 py-2 bg-bambu-green text-white rounded-md hover:bg-bambu-green-dark transition-colors",children:"Confirm"}),h.jsx("button",{onClick:X,className:"px-6 py-2 bg-gray-200 dark:bg-bambu-dark text-gray-700 dark:text-bambu-gray rounded-md hover:bg-gray-300 dark:hover:bg-bambu-dark-tertiary transition-colors",children:"Reset"}),h.jsx("button",{onClick:s,className:"px-6 py-2 bg-gray-200 dark:bg-bambu-dark text-gray-700 dark:text-bambu-gray rounded-md hover:bg-gray-300 dark:hover:bg-bambu-dark-tertiary transition-colors",children:"Close"})]})]})})}function Ux(t){if(!t)return"rgb(128, 128, 128)";const e=t.replace("#","").substring(0,6),n=parseInt(e.substring(0,2),16),i=parseInt(e.substring(2,4),16),r=parseInt(e.substring(4,6),16),a=isNaN(n)?128:n,s=isNaN(i)?128:i,o=isNaN(r)?128:r;return`rgb(${a}, ${s}, ${o})`}function IVe(t){if(!t)return!1;const e=t.replace("#","").substring(0,6);if(e.length<6)return!1;const n=parseInt(e.substring(0,2),16),i=parseInt(e.substring(2,4),16),r=parseInt(e.substring(4,6),16);return isNaN(n)||isNaN(i)||isNaN(r)?!1:(.299*n+.587*i+.114*r)/255>.45}function jVe({humidity:t}){const e=()=>t<25?"/icons/humidity-empty.svg":t<40?"/icons/humidity-half.svg":"/icons/humidity-full.svg";return h.jsx("img",{src:e(),alt:"",className:"w-2.5 h-[14px]"})}function UVe({isLoading:t,amsStatusMain:e,amsStatusSub:n,trayNow:i,targetTrayId:r,onComplete:a,onRetry:s}){const[o,l]=E.useState(!1),[c,u]=E.useState(!1),f=E.useRef(e),m=E.useRef(i),g=E.useRef(null),b=2,y=3,v=4,x=5,M=6,w=7;E.useEffect(()=>{console.log(`[FilamentChangeCard] Status: main=${e}, sub=${n}, trayNow=${i}, isLoading=${t}`)},[e,n,i,t]),E.useEffect(()=>{const F=f.current===1,I=e===0,G=i!==m.current;F&&I?(console.log("[FilamentChangeCard] ams_status_main transitioned 1->0, operation complete!"),u(!0),g.current=setTimeout(()=>{a()},1500)):G&&(t&&r!==null&&i===r?(console.log(`[FilamentChangeCard] Load completed! tray_now=${i} matches target=${r}`),u(!0),g.current=setTimeout(()=>{a()},1500)):!t&&i===255&&(console.log("[FilamentChangeCard] Unload completed! tray_now=255 (no filament)"),u(!0),g.current=setTimeout(()=>{a()},1500))),f.current=e,m.current=i},[e,i,t,r,a]),E.useEffect(()=>()=>{g.current&&clearTimeout(g.current)},[]);const T=c?99:e!==1?0:t?n===x||n===M||n===y?1:n===b?2:n===w?3:1:n===b?1:n===v?2:1;console.log(`[FilamentChangeCard] Step calculation: currentStep=${T}, amsStatusSub=${n}`);const j=t?(()=>{let F="pending",I="pending",G="pending";return T>=99?(F="completed",I="completed",G="completed"):T>=3?(F="completed",I="completed",G="in_progress"):T>=2?(F="completed",I="in_progress"):T>=1&&(F="in_progress"),[{label:"Push new filament into extruder",stepNumber:1,status:F},{label:"Heat the nozzle",stepNumber:2,status:I},{label:"Purge old filament",stepNumber:3,status:G}]})():(()=>{let F="pending",I="pending";return T>=99?(F="completed",I="completed"):T>=2?(F="completed",I="in_progress"):T>=1&&(F="in_progress"),[{label:"Heat the nozzle",stepNumber:1,status:F},{label:"Retract filament from extruder",stepNumber:2,status:I}]})(),C=t?"Loading":"Unloading",k=t?"Filament loading...":"Filament unloading...";return h.jsxs("div",{className:"mt-3 border-l-4 border-bambu-green bg-white dark:bg-bambu-dark-secondary rounded-r-lg overflow-hidden",children:[h.jsxs("button",{onClick:()=>l(!o),className:"w-full flex items-center justify-between px-4 py-2 text-bambu-green hover:bg-gray-50 dark:hover:bg-bambu-dark-tertiary transition-colors",children:[h.jsx("span",{className:"text-sm font-medium",children:k}),o?h.jsx(Gf,{className:"w-4 h-4"}):h.jsx(QS,{className:"w-4 h-4"})]}),!o&&h.jsxs("div",{className:"px-4 pb-4",children:[h.jsxs("div",{className:"flex gap-6",children:[h.jsxs("div",{className:"flex-1",children:[h.jsx("h3",{className:"text-bambu-green font-semibold mb-3",children:C}),h.jsx("div",{className:"space-y-2",children:j.map(F=>h.jsxs("div",{className:"flex items-center gap-2",children:[F.status==="completed"?h.jsx("div",{className:"w-5 h-5 rounded-full bg-bambu-green flex items-center justify-center flex-shrink-0",children:h.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})})}):F.status==="in_progress"?h.jsx("div",{className:"w-5 h-5 rounded-full bg-bambu-green flex items-center justify-center flex-shrink-0",children:h.jsx("span",{className:"text-white text-xs font-bold",children:F.stepNumber})}):h.jsx("div",{className:"w-5 h-5 rounded-full border-2 border-gray-400 dark:border-gray-500 flex items-center justify-center flex-shrink-0",children:h.jsx("span",{className:"text-gray-400 dark:text-gray-500 text-xs font-medium",children:F.stepNumber})}),h.jsx("span",{className:`text-sm ${F.status==="in_progress"?"text-gray-900 dark:text-white font-semibold":F.status==="completed"?"text-gray-500 dark:text-gray-400":"text-gray-400 dark:text-gray-500"}`,children:F.label})]},F.stepNumber))})]}),h.jsx("div",{className:"flex-shrink-0",children:h.jsx("img",{src:"/icons/extruder-change-filament.png",alt:"Extruder",className:"w-[150px] h-auto"})})]}),s&&h.jsxs("button",{onClick:s,className:"mt-3 px-4 py-1.5 border border-bambu-gray rounded-full text-sm text-bambu-gray hover:bg-bambu-dark-tertiary transition-colors flex items-center gap-1.5",children:[h.jsx(Uoe,{className:"w-3.5 h-3.5"}),"Retry"]})]})]})}function hG(t,e){if(t>=128){const i=t-128,r=String.fromCharCode(65+e);return i===0?`HT-${r}`:`HT${i+1}-${r}`}return`${String.fromCharCode(65+t)}${e+1}`}function CP(t){return t>=128}function pG({units:t,side:e,isPrinting:n,selectedAmsIndex:i,onSelectAms:r,selectedTray:a,onSelectTray:s,onHumidityClick:o,onSlotRefresh:l,onEyeClick:c,refreshingSlot:u}){const f=t[i],m=f?CP(f.id):!1;return h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("div",{className:"flex gap-1.5 mb-2.5 p-1.5 bg-gray-300 dark:bg-bambu-dark rounded-lg",children:t.map((g,b)=>h.jsx("button",{onClick:()=>r(b),className:`flex items-center p-1.5 rounded border-2 transition-colors ${i===b?"border-bambu-green bg-white dark:bg-bambu-dark-tertiary":"bg-gray-200 dark:bg-bambu-dark-secondary border-transparent hover:border-bambu-gray"}`,children:h.jsx("div",{className:"flex gap-0.5",children:g.tray.map(y=>h.jsx("div",{className:"w-2.5 h-2.5 rounded-full",style:{backgroundColor:y.tray_color?Ux(y.tray_color):"#808080"}},y.id))})},g.id))}),f&&h.jsxs("div",{className:"bg-gray-100 dark:bg-bambu-dark-secondary rounded-[10px] p-2.5",children:[h.jsxs("button",{onClick:()=>o(f.humidity??0,f.temp??0),className:"flex items-center justify-center gap-4 text-xs text-bambu-gray mb-2.5 w-full py-1 hover:bg-gray-50 dark:hover:bg-bambu-dark-tertiary rounded-md transition-colors cursor-pointer",children:[f.humidity!==null&&h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(jVe,{humidity:f.humidity}),f.humidity," %"]}),f.temp!==null&&h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx("img",{src:"/icons/temperature.svg",alt:"",className:"w-3.5 icon-theme"}),f.temp,"°C"]})]}),h.jsx("div",{className:`flex gap-2 mb-1.5 ${m?"justify-start pl-2":"justify-center"}`,children:f.tray.map((g,b)=>{const y=hG(f.id,b),v=u?.amsId===f.id&&u?.trayId===g.id;return h.jsxs("button",{onClick:()=>l(f.id,g.id),disabled:v,className:`w-14 flex items-center justify-center gap-0.5 text-[10px] text-bambu-gray px-1.5 py-[3px] bg-bambu-dark rounded-full border border-bambu-dark-tertiary transition-colors ${v?"opacity-70 cursor-wait":"hover:bg-bambu-dark-tertiary"}`,children:[y,h.jsx("img",{src:"/icons/reload.svg",alt:"",className:`w-2.5 h-2.5 icon-theme ${v?"animate-spin":""}`})]},g.id)})}),h.jsx("div",{className:`flex gap-2 ${m?"justify-start pl-2":"justify-center"}`,children:f.tray.map((g,b)=>{const y=f.id*4+g.id,v=a===y,x=!g.tray_type||g.tray_type===""||g.tray_type==="NONE",M=IVe(g.tray_color),w=hG(f.id,b);return h.jsxs("div",{onClick:()=>{console.log(`[AMSSectionDual] Slot clicked: AMS ${f.id}, tray ${g.id}, globalTrayId: ${y}, isEmpty: ${x}, isPrinting: ${n}, isSelected: ${v}`),!x&&!n&&s(v?null:y)},className:`w-14 h-[80px] rounded-md border-2 overflow-hidden transition-all bg-bambu-dark relative ${v?"border-bambu-green":"border-bambu-dark-tertiary hover:border-bambu-gray"} ${x?"opacity-50":"cursor-pointer"}`,children:[!x&&g.remain>=0&&h.jsx("div",{className:"absolute bottom-0 left-0 right-0 transition-all",style:{height:`${Math.min(100,Math.max(0,g.remain))}%`,backgroundColor:Ux(g.tray_color)}}),!x&&g.remain<0&&h.jsx("div",{className:"absolute inset-0",style:{backgroundColor:Ux(g.tray_color)}}),x&&h.jsx("div",{className:"absolute inset-0",style:{background:"repeating-linear-gradient(45deg, #3a3a3a, #3a3a3a 4px, #4a4a4a 4px, #4a4a4a 8px)"}}),h.jsxs("div",{className:"relative w-full h-full flex flex-col items-center justify-end pb-[5px]",children:[h.jsx("span",{className:"text-[11px] font-semibold mb-1",style:{color:M?"#000000":"#ffffff"},children:x?"--":g.tray_type}),!x&&h.jsx("button",{onClick:A=>{A.stopPropagation(),c(g,w,f.id)},className:"w-4 h-4 flex items-center justify-center rounded hover:bg-black/20 transition-colors",children:h.jsx("img",{src:"/icons/eye.svg",alt:"Settings",className:`w-3.5 h-3.5 ${M?"":"invert"}`,style:{opacity:.8}})})]})]},g.id)})})]}),t.length===0&&h.jsxs("div",{className:"bg-bambu-dark-secondary rounded-[10px] p-6 text-center text-bambu-gray text-sm",children:["No AMS connected to ",e," nozzle"]})]})}function FVe({isDualNozzle:t,leftSlotCount:e,rightSlotCount:n,leftIsHT:i,rightIsHT:r,leftActiveSlot:a,rightActiveSlot:s,leftFilamentColor:o,rightFilamentColor:l}){if(!t)return null;const c="#909090",u=o?Ux(o):null,f=l?Ux(l):null,m=[54,118,182,246],g=[354,418,482,546];return h.jsxs("div",{className:"relative w-full pointer-events-none",style:{height:"120px"},children:[h.jsxs("svg",{className:"absolute inset-0 w-full h-full",viewBox:"0 0 600 120",preserveAspectRatio:"xMidYMid meet",children:[i?h.jsxs(h.Fragment,{children:[h.jsx("line",{x1:"36",y1:"0",x2:"36",y2:"36",stroke:a===0&&u?u:c,strokeWidth:a===0&&u?3:2}),e>1&&h.jsx("line",{x1:"100",y1:"0",x2:"100",y2:"36",stroke:a===1&&u?u:c,strokeWidth:a===1&&u?3:2}),e>1&&h.jsx("line",{x1:"36",y1:"36",x2:"100",y2:"36",stroke:u??c,strokeWidth:u?3:2}),h.jsx("line",{x1:e>1?"68":"36",y1:"36",x2:"288",y2:"36",stroke:u??c,strokeWidth:u?3:2}),h.jsx("line",{x1:"288",y1:"36",x2:"288",y2:"85",stroke:u??c,strokeWidth:u?3:2})]}):h.jsxs(h.Fragment,{children:[m.map((b,y)=>h.jsx("line",{x1:b,y1:"0",x2:b,y2:"14",stroke:a===y&&u?u:c,strokeWidth:a===y&&u?3:2},`left-slot-${y}`)),a!=null&&u?h.jsxs(h.Fragment,{children:[h.jsx("line",{x1:"54",y1:"14",x2:"246",y2:"14",stroke:c,strokeWidth:"2"}),h.jsx("line",{x1:Math.min(m[a],150),y1:"14",x2:Math.max(m[a],150),y2:"14",stroke:u,strokeWidth:"3"})]}):h.jsx("line",{x1:"54",y1:"14",x2:"246",y2:"14",stroke:c,strokeWidth:"2"}),h.jsx("rect",{x:"136",y:"8",width:"28",height:"14",rx:"2",fill:u??"#c0c0c0",stroke:u??c,strokeWidth:"1"}),h.jsx("line",{x1:"150",y1:"22",x2:"150",y2:"36",stroke:u??c,strokeWidth:u?3:2}),h.jsx("line",{x1:"150",y1:"36",x2:"288",y2:"36",stroke:u??c,strokeWidth:u?3:2}),h.jsx("line",{x1:"288",y1:"36",x2:"288",y2:"85",stroke:u??c,strokeWidth:u?3:2})]}),r?h.jsxs(h.Fragment,{children:[h.jsx("line",{x1:"336",y1:"0",x2:"336",y2:"36",stroke:s===0&&f?f:c,strokeWidth:s===0&&f?3:2}),n>1&&h.jsx("line",{x1:"400",y1:"0",x2:"400",y2:"36",stroke:s===1&&f?f:c,strokeWidth:s===1&&f?3:2}),n>1&&h.jsx("line",{x1:"336",y1:"36",x2:"400",y2:"36",stroke:f??c,strokeWidth:f?3:2}),h.jsx("line",{x1:"312",y1:"36",x2:n>1?"368":"336",y2:"36",stroke:f??c,strokeWidth:f?3:2}),h.jsx("line",{x1:"312",y1:"36",x2:"312",y2:"85",stroke:f??c,strokeWidth:f?3:2})]}):h.jsxs(h.Fragment,{children:[g.map((b,y)=>h.jsx("line",{x1:b,y1:"0",x2:b,y2:"14",stroke:s===y&&f?f:c,strokeWidth:s===y&&f?3:2},`right-slot-${y}`)),s!=null&&f?h.jsxs(h.Fragment,{children:[h.jsx("line",{x1:"354",y1:"14",x2:"546",y2:"14",stroke:c,strokeWidth:"2"}),h.jsx("line",{x1:Math.min(g[s],450),y1:"14",x2:Math.max(g[s],450),y2:"14",stroke:f,strokeWidth:"3"})]}):h.jsx("line",{x1:"354",y1:"14",x2:"546",y2:"14",stroke:c,strokeWidth:"2"}),h.jsx("rect",{x:"436",y:"8",width:"28",height:"14",rx:"2",fill:f??"#c0c0c0",stroke:f??c,strokeWidth:"1"}),h.jsx("line",{x1:"450",y1:"22",x2:"450",y2:"36",stroke:f??c,strokeWidth:f?3:2}),h.jsx("line",{x1:"312",y1:"36",x2:"450",y2:"36",stroke:f??c,strokeWidth:f?3:2}),h.jsx("line",{x1:"312",y1:"36",x2:"312",y2:"85",stroke:f??c,strokeWidth:f?3:2})]})]}),h.jsxs("div",{className:"absolute left-1/2 -translate-x-1/2 bottom-0 h-[50px] w-[39px]",children:[h.jsx("img",{src:"/icons/extruder-left-right.png",alt:"Extruder",className:"h-full w-full"}),h.jsx("div",{className:"absolute w-[8px] h-[8px] rounded-full",style:{left:"7px",top:"20px",backgroundColor:u??"transparent"}}),h.jsx("div",{className:"absolute w-[8px] h-[8px] rounded-full",style:{left:"25px",top:"20px",backgroundColor:f??"transparent"}})]})]})}function zVe({printerId:t,printerModel:e,status:n,nozzleCount:i}){const{showToast:r}=eo(),a=n?.connected??!1,s=n?.state==="RUNNING",o=i>1,l=n?.ams??[],c=n?.ams_extruder_map??{},u=o?Object.keys(c).length>0?l.filter(ye=>c[String(ye.id)]===0):l.filter((ye,we)=>we%2===0):l,f=o?Object.keys(c).length>0?l.filter(ye=>c[String(ye.id)]===1):l.filter((ye,we)=>we%2===1):[],[m,g]=E.useState(0),[b,y]=E.useState(0),[v,x]=E.useState(null),[M,w]=E.useState(null),[A,T]=E.useState(null),[R,N]=E.useState(null),[j,C]=E.useState(null),k=E.useRef(!1),F=E.useRef(null);E.useEffect(()=>{if(k.current)return;const ye=n?.tray_now;ye!=null&&(k.current=!0,ye!==255&&ye!==254?(console.log(`[AMSSectionDual] Initializing from tray_now: ${ye}`),x(ye)):console.log(`[AMSSectionDual] tray_now=${ye} (no AMS filament loaded)`))},[n?.tray_now]);const I=E.useRef("");E.useEffect(()=>{if(!R)return;const{amsId:ye,trayId:we,startTime:ee}=R,L=l.find(ve=>ve.id===ye)?.tray?.find(ve=>ve.id===we);if(!L)return;const Z=JSON.stringify({tag_uid:L.tag_uid,tray_uuid:L.tray_uuid,tray_id_name:L.tray_id_name,tray_type:L.tray_type,tray_color:L.tray_color}),ge=Date.now()-ee;I.current&&I.current!==Z&&ge>500&&(console.log(`[AMSSectionDual] RFID refresh complete for AMS ${ye} tray ${we} (took ${ge}ms)`),N(null)),I.current=Z},[R,l]);const G=yt({mutationFn:({trayId:ye,extruderId:we})=>Fe.amsLoadFilament(t,ye,we),onSuccess:(ye,{trayId:we,extruderId:ee})=>{console.log(`[AMSSectionDual] Load filament success (tray ${we}, extruder ${ee}):`,ye)},onError:(ye,{trayId:we,extruderId:ee})=>{console.error(`[AMSSectionDual] Load filament error (tray ${we}, extruder ${ee}):`,ye)}}),O=yt({mutationFn:()=>Fe.amsUnloadFilament(t),onSuccess:ye=>{console.log("[AMSSectionDual] Unload filament success:",ye)},onError:ye=>{console.error("[AMSSectionDual] Unload filament error:",ye)}}),B=ye=>{x(ye)},$=ye=>{if(o)for(const we of l){const ee=we.id>=128?2:4,U=we.id*4;if(ye>=U&&ye{if(console.log(`[AMSSectionDual] handleLoad called, selectedTray: ${v}`),v!==null){const ye=$(v);console.log(`[AMSSectionDual] Calling loadMutation.mutate(tray: ${v}, extruder: ${ye})`),F.current="load",C({isLoading:!0,targetTrayId:v}),G.mutate({trayId:v,extruderId:ye})}},K=()=>{console.log(`[AMSSectionDual] handleUnload called, printerId: ${t}, trayNow: ${n?.tray_now}`),F.current="unload",C({isLoading:!1,targetTrayId:null}),console.log("[AMSSectionDual] Calling unloadMutation.mutate()"),O.mutate()},Y=()=>{console.log("[AMSSectionDual] FilamentChangeCard completed, closing card"),F.current=null,C(null)},se=G.isPending||O.isPending,H=(ye,we)=>{w({humidity:ye,temp:we})},X=yt({mutationFn:({amsId:ye,trayId:we})=>Fe.refreshAmsTray(t,ye,we),onSuccess:(ye,we)=>{console.log(`[AMSSectionDual] Tray refresh response (AMS ${we.amsId}, Tray ${we.trayId}):`,ye),ye.success?r(ye.message||"RFID refresh started","success"):r(ye.message||"Failed to refresh tray","error")},onError:(ye,we)=>{console.error(`[AMSSectionDual] Tray refresh error (AMS ${we.amsId}, Tray ${we.trayId}):`,ye),r("Failed to refresh tray","error")}}),ae=(ye,we)=>{console.log(`[AMSSectionDual] Slot refresh triggered: AMS ${ye}, Slot ${we}, printerId: ${t}`),I.current="";const ee=Date.now();N({amsId:ye,trayId:we,startTime:ee}),X.mutate({amsId:ye,trayId:we}),setTimeout(()=>{N(U=>U&&U.startTime===ee?(console.log(`[AMSSectionDual] RFID refresh timeout for AMS ${ye} tray ${we}`),null):U)},15e3)},le=(ye,we,ee)=>{T({tray:ye,slotLabel:we,amsId:ee})},de=n?.ams_status_main??0,Q=de===1,xe=E.useRef(de),Re=E.useRef(!1);E.useEffect(()=>{const ye=xe.current===1;Q?(Re.current=!0,C(null)):ye&&!Q&&Re.current&&(console.log("[AMSSectionDual] ams_status_main transitioned 1->0, operation was started, closing card"),F.current=null,Re.current=!1,C(null)),xe.current=de},[Q,de]);const pe=Q||j!==null,Me=n?.tray_now??255,Ie=n?.ams_status_sub??0,dt=F.current==="load"?!0:F.current==="unload"?!1:j!==null?j.isLoading:!(Ie===4||Me===255),z=()=>{if(Me===255||Me===254)return{leftActiveSlot:null,rightActiveSlot:null,leftFilamentColor:null,rightFilamentColor:null};for(const ye of l){const we=ye.id>=128?2:4,ee=ye.id*4;if(Me>=ee&&Mew(null)}),A&&h.jsx(LVe,{tray:A.tray,amsId:A.amsId,slotLabel:A.slotLabel,printerId:t,printerModel:e,nozzleDiameter:n?.nozzles?.[0]?.nozzle_diameter||"0.4",onClose:()=>T(null)})]})}function BVe({printerId:t,status:e,onClose:n}){const i=Rn(),r=e?.connected??!1;E.useEffect(()=>{const c=u=>{u.key==="Escape"&&n()};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[n]);const a=yt({mutationFn:c=>Fe.setTimelapse(t,c),onSuccess:c=>{console.log("Timelapse mutation success:",c),i.invalidateQueries({queryKey:["printerStatuses"]})},onError:c=>{console.error("Timelapse mutation error:",c)}}),s=yt({mutationFn:c=>Fe.setLiveview(t,c),onSuccess:c=>{console.log("Liveview mutation success:",c),i.invalidateQueries({queryKey:["printerStatuses"]})},onError:c=>{console.error("Liveview mutation error:",c)}});console.log("CameraSettingsModal render - isConnected:",r,"status:",e);const o=()=>{console.log("Timelapse toggle clicked, current:",e?.timelapse,"setting to:",!e?.timelapse),a.mutate(!e?.timelapse)},l=()=>{console.log("Liveview toggle clicked, current:",e?.ipcam,"setting to:",!e?.ipcam),s.mutate(!e?.ipcam)};return h.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:n,children:h.jsx(Xt,{className:"w-full max-w-sm",onClick:c=>c.stopPropagation(),children:h.jsxs(en,{className:"p-0",children:[h.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-bambu-dark-tertiary",children:[h.jsx("span",{className:"text-sm font-medium text-white",children:"Camera Settings"}),h.jsx("button",{onClick:n,className:"p-1 rounded hover:bg-bambu-dark-tertiary text-bambu-gray hover:text-white",children:h.jsx(fn,{className:"w-4 h-4"})})]}),h.jsxs("div",{className:"p-4 space-y-4",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"text-sm text-white",children:"Auto-record Monitoring"}),h.jsx("button",{onClick:l,disabled:!r||s.isPending,className:`relative w-12 h-6 rounded-full transition-colors disabled:opacity-50 disabled:cursor-not-allowed ${e?.ipcam?"bg-bambu-green":"bg-bambu-dark-tertiary"}`,children:s.isPending?h.jsx(It,{className:"absolute inset-0 m-auto w-4 h-4 animate-spin text-white"}):h.jsx("span",{className:`absolute top-1 w-4 h-4 rounded-full bg-white transition-transform ${e?.ipcam?"left-7":"left-1"}`})})]}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"text-sm text-white",children:"Go Live"}),h.jsx("button",{onClick:o,disabled:!r||a.isPending,className:`relative w-12 h-6 rounded-full transition-colors disabled:opacity-50 disabled:cursor-not-allowed ${e?.timelapse?"bg-bambu-green":"bg-bambu-dark-tertiary"}`,children:a.isPending?h.jsx(It,{className:"absolute inset-0 m-auto w-4 h-4 animate-spin text-white"}):h.jsx("span",{className:`absolute top-1 w-4 h-4 rounded-full bg-white transition-transform ${e?.timelapse?"left-7":"left-1"}`})})]})]})]})})})}function mG(t){const e=t.toUpperCase();if(e.startsWith("HH")||e.startsWith("HS"))return"Hardened Steel";if(e.startsWith("SS"))return"Stainless Steel";switch(t){case"hardened_steel":return"Hardened Steel";case"stainless_steel":return"Stainless Steel";default:return t||"Unknown"}}function gG(t){return t.toUpperCase().startsWith("HH")?"High flow":"Standard"}function HVe({printer:t,status:e,onClose:n}){const i=Rn(),r=t.nozzle_count>1;E.useEffect(()=>{const u=f=>{f.key==="Escape"&&n()};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[n]);const a=e?.nozzles?.[0],s=e?.nozzles?.[1],o=s?.nozzle_type||s?.nozzle_diameter?s:a,l=yt({mutationFn:()=>Fe.refreshStatus(t.id),onSuccess:()=>{i.invalidateQueries({queryKey:["printerStatuses"]})}}),c=()=>{l.mutate()};return h.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:n,children:h.jsx(Xt,{className:"w-full max-w-2xl",onClick:u=>u.stopPropagation(),children:h.jsxs(en,{className:"p-0",children:[h.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-bambu-dark-tertiary",children:[h.jsx("span",{className:"text-sm font-medium text-white",children:"Printer Parts"}),h.jsx("button",{onClick:n,className:"p-1 rounded hover:bg-bambu-dark-tertiary text-bambu-gray hover:text-white",children:h.jsx(fn,{className:"w-4 h-4"})})]}),h.jsxs("div",{className:"p-6 space-y-6",children:[h.jsxs("div",{children:[h.jsx("h3",{className:"text-base font-semibold text-white mb-3",children:r?"Left Nozzle":"Nozzle"}),h.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1.5",children:"Type"}),h.jsx("div",{className:"px-3 py-2 bg-bambu-dark rounded border border-bambu-dark-tertiary text-sm text-bambu-gray",children:mG(a?.nozzle_type||"")})]}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1.5",children:"Diameter"}),h.jsx("div",{className:"px-3 py-2 bg-bambu-dark rounded border border-bambu-dark-tertiary text-sm text-bambu-gray",children:a?.nozzle_diameter||"—"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1.5",children:"Flow"}),h.jsx("div",{className:"px-3 py-2 bg-bambu-dark rounded border border-bambu-dark-tertiary text-sm text-bambu-gray",children:gG(a?.nozzle_type||"")})]})]})]}),r&&h.jsxs("div",{children:[h.jsx("h3",{className:"text-base font-semibold text-white mb-3",children:"Right Nozzle"}),h.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1.5",children:"Type"}),h.jsx("div",{className:"px-3 py-2 bg-bambu-dark rounded border border-bambu-dark-tertiary text-sm text-bambu-gray",children:mG(o?.nozzle_type||"")})]}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1.5",children:"Diameter"}),h.jsx("div",{className:"px-3 py-2 bg-bambu-dark rounded border border-bambu-dark-tertiary text-sm text-bambu-gray",children:o?.nozzle_diameter||"—"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-bambu-gray mb-1.5",children:"Flow"}),h.jsx("div",{className:"px-3 py-2 bg-bambu-dark rounded border border-bambu-dark-tertiary text-sm text-bambu-gray",children:gG(o?.nozzle_type||"")})]})]})]}),h.jsxs("p",{className:"text-sm text-bambu-gray",children:["Please change the nozzle settings on the printer."," ",h.jsx("a",{href:"https://wiki.bambulab.com",target:"_blank",rel:"noopener noreferrer",className:"text-bambu-green hover:underline",children:"View wiki"})]})]}),h.jsx("div",{className:"flex justify-end px-4 py-3 border-t border-bambu-dark-tertiary",children:h.jsxs("button",{onClick:c,disabled:l.isPending,className:"flex items-center gap-2 px-4 py-2 bg-bambu-green hover:bg-bambu-green-dark disabled:opacity-50 text-white text-sm font-medium rounded",children:[l.isPending?h.jsx(It,{className:"w-4 h-4 animate-spin"}):h.jsx(el,{className:"w-4 h-4"}),"Refresh"]})})]})})})}function $d({checked:t,onChange:e,disabled:n,loading:i}){return h.jsx("button",{onClick:()=>!n&&!i&&e(!t),disabled:n||i,className:`w-5 h-5 rounded border-2 flex items-center justify-center transition-colors ${t?"bg-bambu-green border-bambu-green":"bg-transparent border-bambu-gray"} ${n||i?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:i?h.jsx(It,{className:"w-3 h-3 animate-spin text-white"}):t?h.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):null})}function d_({value:t,onChange:e,disabled:n,loading:i}){const[r,a]=E.useState(!1),s=["Low","Medium","High"],o=t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),l=n||i;return h.jsxs("div",{className:"relative",children:[h.jsxs("button",{onClick:()=>!l&&a(!r),disabled:l,className:`flex items-center gap-2 px-3 py-1.5 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-sm text-white min-w-[100px] justify-between ${l?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-bambu-gray"}`,children:[i?h.jsx(It,{className:"w-4 h-4 animate-spin text-bambu-green"}):h.jsx("span",{children:o}),h.jsx(Gf,{className:"w-4 h-4 text-bambu-gray"})]}),r&&!l&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>a(!1)}),h.jsx("div",{className:"absolute top-full left-0 mt-1 w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded shadow-lg z-20",children:s.map(c=>h.jsx("button",{onClick:()=>{e(c.toLowerCase()),a(!1)},className:`w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary ${t.toLowerCase()===c.toLowerCase()?"text-bambu-green":"text-white"}`,children:c},c))})]})]})}function $Ve({printer:t,status:e,onClose:n}){const i=Rn(),r=e?.print_options,a=e?.connected??!1;E.useEffect(()=>{const f=m=>{m.key==="Escape"&&n()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[n]);const s=yt({mutationFn:({apiModuleName:f,enabled:m,printHalt:g,sensitivity:b})=>Fe.setPrintOption(t.id,f,m,g,b),onSuccess:()=>{i.invalidateQueries({queryKey:["printerStatuses"]})}}),o=(f,m,g)=>{const b=m&&g!==void 0&&g!=="never_halt";s.mutate({uiModuleName:f,apiModuleName:f,enabled:m,printHalt:b,sensitivity:g??"medium"})},l=(f,m)=>{let g=f;f==="pileup_detector"&&(g="spaghetti_detector"),s.mutate({uiModuleName:f,apiModuleName:g,enabled:!0,printHalt:!0,sensitivity:m})},c=f=>s.isPending&&s.variables?.uiModuleName===f,u=f=>{if(!s.isPending||!s.variables?.sensitivity)return!1;const m=s.variables.uiModuleName;return m===f||m==="spaghetti_detector"&&f==="pileup_detector"||m==="pileup_detector"&&f==="spaghetti_detector"};return h.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:n,children:h.jsx(Xt,{className:"w-full max-w-xl max-h-[90vh] flex flex-col",onClick:f=>f.stopPropagation(),children:h.jsxs(en,{className:"p-0 flex flex-col h-full",children:[h.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-bambu-dark-tertiary",children:[h.jsx("span",{className:"text-sm font-medium text-white",children:"Print Options"}),h.jsx("button",{onClick:n,className:"p-1 rounded hover:bg-bambu-dark-tertiary text-bambu-gray hover:text-white",children:h.jsx(fn,{className:"w-4 h-4"})})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[!a&&h.jsxs("div",{className:"flex items-center gap-2 p-3 bg-red-500/20 border border-red-500/50 rounded text-red-400",children:[h.jsx(ya,{className:"w-4 h-4"}),h.jsx("span",{className:"text-sm",children:"Printer not connected. Options cannot be changed."})]}),r?h.jsxs(h.Fragment,{children:[h.jsxs("div",{children:[h.jsx("h3",{className:"text-base font-semibold text-white mb-1",children:"AI Detections"}),h.jsx("p",{className:"text-xs text-bambu-gray mb-4",children:"Printer will send assistant message or pause printing if any of the following problem is detected."}),h.jsxs("div",{className:"space-y-5",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx($d,{checked:r.spaghetti_detector,onChange:f=>o("spaghetti_detector",f,r.halt_print_sensitivity),disabled:!a,loading:c("spaghetti_detector")}),h.jsx("span",{className:"text-sm font-medium text-white",children:"Spaghetti Detection"})]}),h.jsx("p",{className:"text-xs text-bambu-gray ml-8",children:"Detects spaghetti failure (scattered loose filament)."}),h.jsxs("div",{className:"flex items-center gap-3 ml-8",children:[h.jsx("span",{className:"text-xs text-bambu-gray",children:"Pausing Sensitivity:"}),h.jsx(d_,{value:r.halt_print_sensitivity||"medium",onChange:f=>l("spaghetti_detector",f),disabled:!a||!r.spaghetti_detector,loading:u("spaghetti_detector")})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx($d,{checked:r.pileup_detector,onChange:f=>o("pileup_detector",f,r.pileup_sensitivity),disabled:!a,loading:c("pileup_detector")}),h.jsx("span",{className:"text-sm font-medium text-white",children:"Purge Chute Pile-Up Detection"})]}),h.jsx("p",{className:"text-xs text-bambu-gray ml-8",children:"Monitors if the waste is piled up in the purge chute."}),h.jsxs("div",{className:"flex items-center gap-3 ml-8",children:[h.jsx("span",{className:"text-xs text-bambu-gray",children:"Pausing Sensitivity:"}),h.jsx(d_,{value:r.pileup_sensitivity||"medium",onChange:f=>l("pileup_detector",f),disabled:!a||!r.pileup_detector,loading:u("pileup_detector")})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx($d,{checked:r.nozzle_clumping_detector,onChange:f=>o("clump_detector",f,r.nozzle_clumping_sensitivity),disabled:!a,loading:c("clump_detector")}),h.jsx("span",{className:"text-sm font-medium text-white",children:"Nozzle Clumping Detection"})]}),h.jsx("p",{className:"text-xs text-bambu-gray ml-8",children:"Checks if the nozzle is clumping by filaments or other foreign objects."}),h.jsxs("div",{className:"flex items-center gap-3 ml-8",children:[h.jsx("span",{className:"text-xs text-bambu-gray",children:"Pausing Sensitivity:"}),h.jsx(d_,{value:r.nozzle_clumping_sensitivity||"medium",onChange:f=>l("clump_detector",f),disabled:!a||!r.nozzle_clumping_detector,loading:u("clump_detector")})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx($d,{checked:r.airprint_detector,onChange:f=>o("airprint_detector",f,r.airprint_sensitivity),disabled:!a,loading:c("airprint_detector")}),h.jsx("span",{className:"text-sm font-medium text-white",children:"Air Printing Detection"})]}),h.jsx("p",{className:"text-xs text-bambu-gray ml-8",children:"Detects air printing caused by nozzle clogging or filament grinding."}),h.jsxs("div",{className:"flex items-center gap-3 ml-8",children:[h.jsx("span",{className:"text-xs text-bambu-gray",children:"Pausing Sensitivity:"}),h.jsx(d_,{value:r.airprint_sensitivity||"medium",onChange:f=>l("airprint_detector",f),disabled:!a||!r.airprint_detector,loading:u("airprint_detector")})]})]})]})]}),h.jsx("hr",{className:"border-bambu-dark-tertiary"}),h.jsxs("div",{children:[h.jsx("h3",{className:"text-base font-semibold text-white mb-1",children:"Build Plate Detection"}),h.jsx("p",{className:"text-xs text-bambu-gray mb-4",children:"Ensures the build plate type and placement are correct."}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx($d,{checked:r.buildplate_marker_detector,onChange:f=>o("buildplate_marker_detector",f),disabled:!a,loading:c("buildplate_marker_detector")}),h.jsx("span",{className:"text-sm font-medium text-white",children:"Type Detection"})]}),h.jsx("p",{className:"text-xs text-bambu-gray ml-8",children:"Pauses printing when the detected build plate type does not match the selected one."})]})]}),h.jsx("hr",{className:"border-bambu-dark-tertiary"}),h.jsxs("div",{className:"space-y-5",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx($d,{checked:r.auto_recovery_step_loss,onChange:f=>o("auto_recovery_step_loss",f),disabled:!a,loading:c("auto_recovery_step_loss")}),h.jsx("span",{className:"text-sm font-medium text-white",children:"Auto-recover from step loss"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx($d,{checked:e?.store_to_sdcard??!1,onChange:()=>{},disabled:!0}),h.jsx("span",{className:"text-sm font-medium text-white",children:"Store Sent Files on External Storage"}),h.jsx("span",{className:"text-xs text-bambu-gray italic",children:"(read-only)"})]}),h.jsx("p",{className:"text-xs text-bambu-gray ml-8",children:"Save the printing files initiated from Bambu Studio, Bambu Handy and MakerWorld on External Storage. This option can only be changed on the printer's touchscreen."})]})]})]}):h.jsxs("div",{className:"flex items-center gap-2 text-bambu-gray",children:[h.jsx(ya,{className:"w-4 h-4"}),h.jsx("span",{className:"text-sm",children:"Print options not available. Try refreshing."})]})]})]})})})}const VVe=new Set([1,3,13,25,39,40,47,48,50]);function rx({checked:t,onChange:e,disabled:n}){return h.jsx("button",{onClick:()=>!n&&e(!t),disabled:n,className:`w-5 h-5 rounded border-2 flex items-center justify-center transition-colors ${t?"bg-bambu-green border-bambu-green":"bg-transparent border-bambu-gray"} ${n?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:t&&h.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})})}function GVe({step:t,name:e,isActive:n,isComplete:i,isLast:r}){return h.jsxs("div",{className:"flex items-start gap-3",children:[h.jsxs("div",{className:"flex flex-col items-center",children:[h.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs font-medium flex-shrink-0 bg-bambu-green text-white",children:t}),!r&&h.jsx("div",{className:`w-0.5 h-6 ${i?"bg-bambu-green":"bg-bambu-gray/30"}`})]}),h.jsx("span",{className:`text-sm pt-0.5 ${n?"text-white font-semibold":"text-bambu-gray"}`,children:e})]})}function WVe({printer:t,status:e,onClose:n}){const i=e?.connected??!1,r=t.nozzle_count===2,a=e?.stg_cur??-1,[s,o]=E.useState(!1),[l,c]=E.useState(!1),[u,f]=E.useState(!1),m=`calibration_options_${t.id}`,g=typeof window<"u"?localStorage.getItem(m):null,b=g?JSON.parse(g):null,[y,v]=E.useState(b?.bedLeveling??!0),[x,M]=E.useState(b?.vibration??!0),[w,A]=E.useState(b?.motorNoise??!0),[T,R]=E.useState(b?.nozzleOffset??r),[N,j]=E.useState(b?.highTempHeatbed??!1),[C,k]=E.useState(!1),F=e?.state,I=VVe.has(a)&&F==="RUNNING";E.useEffect(()=>{!C&&I?(c(!0),o(!0),k(!0)):!C&&!I&&k(!0)},[C,I]),E.useEffect(()=>{I&&!l&&(c(!0),f(!1))},[I,l]),E.useEffect(()=>{I&&!s&&o(!0)},[I,s]),E.useEffect(()=>{l&&!I&&!u&&f(!0)},[l,I,u]);const G=()=>{localStorage.removeItem(m),o(!1),c(!1),f(!1),v(!0),M(!0),A(!0),R(r),j(!1)};E.useEffect(()=>{const Y=se=>{se.key==="Escape"&&n()};return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[n]);const O=yt({mutationFn:()=>Fe.startCalibration(t.id,{bed_leveling:y,vibration:x,motor_noise:w,nozzle_offset:T,high_temp_heatbed:N}),onSuccess:()=>{localStorage.setItem(m,JSON.stringify({bedLeveling:y,vibration:x,motorNoise:w,nozzleOffset:T,highTempHeatbed:N})),o(!0)}}),B=y||x||w||T||N,$=i&&B&&!O.isPending&&!I&&!u,V=[];V.push({name:"Homing toolhead",stages:[13]}),(y||N)&&V.push({name:"Cooling heatbed",stages:[50]}),y&&V.push({name:"Auto bed leveling - phase 1",stages:[1,47]}),w&&V.push({name:"Motor noise cancellation",stages:[25]}),x&&V.push({name:"Vibration compensation",stages:[3]}),y&&V.push({name:"Auto bed leveling - phase 2",stages:[48]}),r&&T&&V.push({name:"Nozzle offset calibration",stages:[39]}),N&&V.push({name:"High-temp heatbed calibration",stages:[40]});const K=V.findIndex(Y=>Y.stages.includes(a));return h.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:n,children:h.jsx(Xt,{className:"w-full max-w-3xl max-h-[90vh] flex flex-col",onClick:Y=>Y.stopPropagation(),children:h.jsxs(en,{className:"p-0 flex flex-col h-full",children:[h.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-bambu-dark-tertiary",children:[h.jsx("span",{className:"text-sm font-medium text-white",children:"Calibration"}),h.jsx("button",{onClick:n,className:"p-1 rounded text-bambu-gray hover:bg-bambu-dark-tertiary hover:text-white",children:h.jsx(fn,{className:"w-4 h-4"})})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[!i&&h.jsxs("div",{className:"flex items-center gap-2 p-3 mb-4 bg-red-500/20 border border-red-500/50 rounded text-red-400",children:[h.jsx(ya,{className:"w-4 h-4"}),h.jsx("span",{className:"text-sm",children:"Printer not connected. Calibration cannot be started."})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-8",children:[h.jsxs("div",{children:[h.jsx("h3",{className:"text-base font-semibold text-white mb-4",children:"Calibration step selection"}),h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx(rx,{checked:y,onChange:v,disabled:!i||I}),h.jsx("span",{className:"text-sm text-white",children:"Bed leveling"})]}),h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx(rx,{checked:x,onChange:M,disabled:!i||I}),h.jsx("span",{className:"text-sm text-white",children:"Vibration compensation"})]}),h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx(rx,{checked:w,onChange:A,disabled:!i||I}),h.jsx("span",{className:"text-sm text-white",children:"Motor noise cancellation"})]}),r&&h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx(rx,{checked:T,onChange:R,disabled:!i||I}),h.jsx("span",{className:"text-sm text-white",children:"Nozzle offset calibration"})]}),h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx(rx,{checked:N,onChange:j,disabled:!i||I}),h.jsx("span",{className:"text-sm text-white whitespace-nowrap",children:"High-temperature Heatbed Calibration"})]})]}),h.jsxs("div",{className:"mt-6",children:[h.jsx("h4",{className:"text-sm font-semibold text-white mb-2",children:"Calibration program"}),h.jsx("p",{className:"text-xs text-bambu-gray",children:"The calibration program detects the status of your device automatically to minimize deviation. It keeps the device performing optimally."})]})]}),h.jsxs("div",{className:"flex flex-col",children:[h.jsx("h3",{className:"text-base font-semibold text-bambu-green mb-4 text-center border-b border-bambu-dark-tertiary pb-2",children:"Calibration Flow"}),h.jsx("div",{className:"flex-1 py-4 pl-4",children:B?h.jsxs("div",{className:"space-y-0",children:[V.map((Y,se)=>{const H=s&&!u&&Y.stages.includes(a),X=u||s&&K>se;return h.jsx(GVe,{step:se+1,name:Y.name,isActive:H,isComplete:X,isLast:se===V.length-1},Y.name)}),a>=0&&K===-1&&e?.stg_cur_name&&h.jsxs("div",{className:"mt-4 text-xs text-bambu-gray",children:["Current: ",e.stg_cur_name]})]}):h.jsx("div",{className:"flex items-center justify-center h-full text-sm text-bambu-gray italic",children:"Select calibration steps"})}),u?h.jsxs("div",{className:"space-y-2",children:[h.jsxs("button",{disabled:!0,className:"w-full py-2.5 px-4 rounded-lg font-medium text-sm flex items-center justify-center gap-2 bg-bambu-green text-white cursor-default",children:[h.jsx(Hp,{className:"w-4 h-4"}),"Completed"]}),h.jsx("button",{onClick:G,className:"w-full py-2 px-4 rounded-lg font-medium text-sm text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary transition-colors",children:"New Calibration"})]}):h.jsx("button",{onClick:()=>O.mutate(),disabled:!$,className:`w-full py-2.5 px-4 rounded-lg font-medium text-sm flex items-center justify-center gap-2 transition-colors ${I?"bg-bambu-gray/50 text-white cursor-not-allowed":$?"bg-bambu-green hover:bg-bambu-green/90 text-white":"bg-bambu-dark-tertiary text-bambu-gray cursor-not-allowed"}`,children:I?h.jsxs(h.Fragment,{children:[h.jsx(It,{className:"w-4 h-4 animate-spin"}),"Calibrating"]}):O.isPending?h.jsxs(h.Fragment,{children:[h.jsx(It,{className:"w-4 h-4 animate-spin"}),"Starting..."]}):"Start Calibration"}),O.isError&&h.jsx("div",{className:"mt-2 text-xs text-red-400 text-center",children:O.error?.message||"Failed to start calibration"})]})]})]})]})})})}function qVe(){const[t,e]=Ure(),[n,i]=E.useState(null),[r,a]=E.useState(!1),[s,o]=E.useState(!1),[l,c]=E.useState(!1),[u,f]=E.useState(!1),{data:m,isLoading:g}=Ft({queryKey:["printers"],queryFn:Fe.getPrinters}),{data:b}=Ft({queryKey:["printerStatuses"],queryFn:async()=>{if(!m)return{};const A={};return await Promise.all(m.map(async T=>{try{A[T.id]=await Fe.getPrinterStatus(T.id)}catch{}})),A},enabled:!!m&&m.length>0,refetchInterval:2e3});E.useEffect(()=>{const A=t.get("printer");if(A){const T=parseInt(A,10);if(!isNaN(T)){i(T);return}}m&&m.length>0&&!n&&i(m[0].id)},[m,t,n]);const y=A=>{i(A),e({printer:String(A)})},v=m?.find(A=>A.id===n),x=n?b?.[n]:null,w=x?new Set([1,3,13,25,39,40,47,48,50]).has(x.stg_cur):!1;return g?h.jsx("div",{className:"flex items-center justify-center h-screen",children:h.jsx(It,{className:"w-8 h-8 animate-spin text-bambu-green"})}):!m||m.length===0?h.jsxs("div",{className:"flex flex-col items-center justify-center h-screen text-bambu-gray",children:[h.jsx(Vp,{className:"w-16 h-16 mb-4"}),h.jsx("p",{className:"text-xl",children:"No printers configured"}),h.jsx("p",{className:"text-sm mt-2",children:"Add a printer in the Printers page first"})]}):h.jsxs("div",{className:"h-screen flex flex-col bg-bambu-dark",children:[h.jsx("div",{className:"bg-bambu-dark-secondary border-b border-bambu-dark-tertiary",children:h.jsx("div",{className:"flex overflow-x-auto",children:m.filter(A=>b?.[A.id]?.connected).map(A=>{const T=b?.[A.id],R=A.id===n;return h.jsxs("button",{onClick:()=>y(A.id),className:`flex items-center gap-2 px-6 py-3 text-sm font-medium transition-colors whitespace-nowrap border-b-2 ${R?"border-bambu-green text-bambu-green bg-bambu-dark":"border-transparent text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary"}`,children:[h.jsx("span",{className:"w-2 h-2 rounded-full bg-bambu-green"}),A.name,T?.state&&T.state!=="IDLE"&&h.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-bambu-dark-tertiary",children:T.state})]},A.id)})})}),v&&h.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[h.jsxs("div",{className:"flex-1 flex flex-col bg-bambu-dark",children:[h.jsxs("div",{className:"flex items-center justify-end gap-2 px-3 py-2.5 bg-bambu-dark-secondary border-b border-bambu-dark-tertiary min-h-[44px]",children:[h.jsx("button",{className:`p-1.5 rounded hover:bg-bambu-dark-tertiary ${x?.sdcard?"text-bambu-green":"text-bambu-gray hover:text-white"}`,children:h.jsx("img",{src:"/icons/micro-sd.svg",alt:"SD Card",className:`w-4 h-4 ${x?.sdcard?"icon-green":"icon-theme"}`})}),h.jsx("button",{className:`p-1.5 rounded hover:bg-bambu-dark-tertiary ${x?.timelapse?"text-red-500":"text-bambu-gray hover:text-white"}`,children:h.jsx(Ale,{className:"w-4 h-4"})}),h.jsx("button",{className:`p-1.5 rounded hover:bg-bambu-dark-tertiary ${x?.ipcam?"text-bambu-green":"text-bambu-gray hover:text-white"}`,children:h.jsx(Cle,{className:"w-4 h-4"})}),h.jsx("button",{onClick:()=>a(!0),className:"p-1.5 rounded hover:bg-bambu-dark-tertiary text-bambu-gray hover:text-white",children:h.jsx(m9,{className:"w-4 h-4"})})]}),h.jsx("div",{className:"flex-1 bg-black",children:h.jsx(hVe,{printerId:v.id,isConnected:x?.connected??!1})}),h.jsx("div",{className:"h-1 bg-bambu-green"}),h.jsx("div",{className:"bg-bambu-dark-secondary p-4 px-5",children:h.jsx(mVe,{printerId:v.id,status:x})})]}),h.jsxs("div",{className:"w-[680px] flex flex-col bg-bambu-dark-secondary border-l border-bambu-dark-tertiary overflow-y-auto",children:[h.jsxs("div",{className:"flex items-center justify-between px-3 py-2.5 border-b border-bambu-dark-tertiary min-h-[44px]",children:[h.jsx("span",{className:"text-sm text-bambu-gray",children:"Control"}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx("button",{onClick:()=>o(!0),className:"px-4 py-1.5 text-xs rounded bg-bambu-green text-white hover:bg-bambu-green-dark",children:"Printer Parts"}),h.jsx("button",{onClick:()=>c(!0),className:"px-4 py-1.5 text-xs rounded bg-bambu-green text-white hover:bg-bambu-green-dark",children:"Print Options"}),h.jsx("button",{onClick:()=>f(!0),className:"px-4 py-1.5 text-xs rounded bg-bambu-green text-white hover:bg-bambu-green-dark",children:"Calibration"})]})]}),!x?.connected&&h.jsxs("div",{className:"m-3 p-3 bg-red-500/20 border border-red-500/50 rounded-lg flex items-center gap-3",children:[h.jsx(Vp,{className:"w-4 h-4 text-red-500"}),h.jsx("span",{className:"text-sm text-red-400",children:"Printer is not connected. Controls are disabled."})]}),h.jsxs("div",{className:"flex-1 p-4 bg-bambu-dark",children:[h.jsx("div",{className:"mb-4 bg-bambu-dark-tertiary rounded-[10px] p-3",children:h.jsxs("div",{className:"flex gap-4 bg-bambu-dark-secondary rounded-[8px] p-4 overflow-hidden",style:{minHeight:"300px"},children:[h.jsx(_Ve,{printer:v,status:x,disabled:w}),h.jsxs("div",{className:"flex-1 flex gap-6 items-center justify-center",children:[h.jsxs("div",{className:"flex flex-col items-center",children:[h.jsx(wVe,{printerId:v.id,status:x,disabled:w}),h.jsx(MVe,{printerId:v.id,status:x,disabled:w})]}),h.jsx(EVe,{printerId:v.id,status:x,nozzleCount:v.nozzle_count,disabled:w})]})]})}),h.jsx(zVe,{printerId:v.id,printerModel:v.model||"X1C",status:x,nozzleCount:v.nozzle_count})]})]})]}),r&&v&&h.jsx(BVe,{printerId:v.id,status:x,onClose:()=>a(!1)}),s&&v&&h.jsx(HVe,{printer:v,status:x,onClose:()=>o(!1)}),l&&v&&h.jsx($Ve,{printer:v,status:x,onClose:()=>c(!1)}),u&&v&&h.jsx(WVe,{printer:v,status:x,onClose:()=>f(!1)})]})}function XVe(){const t=E.useRef(null),e=E.useRef(null),n=Rn(),[i,r]=E.useState(!1),a=E.useCallback(()=>{if(t.current?.readyState===WebSocket.OPEN)return;const c=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/v1/ws`,u=new WebSocket(c);let f=null;u.onopen=()=>{console.log("[WebSocket] Connected"),r(!0),f=window.setInterval(()=>{u.readyState===WebSocket.OPEN&&u.send(JSON.stringify({type:"ping"}))},3e4)},u.onmessage=m=>{try{const g=JSON.parse(m.data);s(g)}catch{}},u.onclose=m=>{console.log("[WebSocket] Closed",m.code,m.reason),f&&(clearInterval(f),f=null),r(!1),t.current=null,e.current=window.setTimeout(()=>{a()},3e3)},u.onerror=m=>{console.error("[WebSocket] Error",m),u.close()},t.current=u},[]),s=E.useCallback(l=>{switch(l.type){case"printer_status":l.printer_id!==void 0&&n.setQueryData(["printerStatus",l.printer_id],c=>({...c,...l.data}));break;case"print_complete":n.invalidateQueries({queryKey:["archives"]}),n.invalidateQueries({queryKey:["archiveStats"]});break;case"archive_created":n.invalidateQueries({queryKey:["archives"]}),n.invalidateQueries({queryKey:["archiveStats"]});break}},[n]);E.useEffect(()=>(a(),()=>{e.current&&clearTimeout(e.current),t.current&&t.current.close()}),[a]);const o=E.useCallback(l=>{t.current?.readyState===WebSocket.OPEN&&t.current.send(JSON.stringify(l))},[]);return{isConnected:i,sendMessage:o}}const KVe=new hae({defaultOptions:{queries:{staleTime:1e3*60,retry:1}}});function YVe({children:t}){return XVe(),h.jsx(h.Fragment,{children:t})}function ZVe(){return h.jsx(zle,{children:h.jsx(Yle,{children:h.jsx(pae,{client:KVe,children:h.jsx(YVe,{children:h.jsx(Ore,{children:h.jsx(ure,{children:h.jsxs(jo,{path:"/",element:h.jsx(qle,{}),children:[h.jsx(jo,{index:!0,element:h.jsx(fce,{})}),h.jsx(jo,{path:"archives",element:h.jsx(U2e,{})}),h.jsx(jo,{path:"queue",element:h.jsx(B2e,{})}),h.jsx(jo,{path:"stats",element:h.jsx(V$e,{})}),h.jsx(jo,{path:"profiles",element:h.jsx(oVe,{})}),h.jsx(jo,{path:"maintenance",element:h.jsx(fVe,{})}),h.jsx(jo,{path:"control",element:h.jsx(qVe,{})}),h.jsx(jo,{path:"settings",element:h.jsx(J$e,{})})]})})})})})})})}pne.createRoot(document.getElementById("root")).render(h.jsx(E.StrictMode,{children:h.jsx(ZVe,{})}));
diff --git a/static/assets/index-BREH29lW.css b/static/assets/index-BREH29lW.css
deleted file mode 100644
index 9edbaab34..000000000
--- a/static/assets/index-BREH29lW.css
+++ /dev/null
@@ -1 +0,0 @@
-@import"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap";@layer properties,theme,base,components,utilities;@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-orange-400:oklch(75% .183 55.934);--color-orange-500:oklch(70.5% .213 47.604);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-yellow-100:oklch(97.3% .071 103.193);--color-yellow-400:oklch(85.2% .199 91.936);--color-yellow-500:oklch(79.5% .184 86.047);--color-yellow-600:oklch(68.1% .162 75.834);--color-yellow-700:oklch(55.4% .135 66.442);--color-yellow-900:oklch(42.1% .095 57.708);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-purple-400:oklch(71.4% .203 305.504);--color-purple-500:oklch(62.7% .265 303.9);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-900:oklch(21% .034 264.665);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-xl:36rem;--container-2xl:42rem;--container-3xl:48rem;--container-4xl:56rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-wide:.025em;--tracking-widest:.1em;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--ease-in-out:cubic-bezier(.4,0,.2,1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--blur-sm:8px;--aspect-video:16/9;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-bambu-green:#00ae42;--color-bambu-green-light:#00c64d;--color-bambu-green-dark:#009438;--color-bambu-dark:var(--bg-primary);--color-bambu-dark-secondary:var(--bg-secondary);--color-bambu-dark-tertiary:var(--bg-tertiary);--color-bambu-gray:var(--text-muted);--color-bambu-gray-light:var(--text-secondary);--color-bambu-gray-dark:var(--text-tertiary)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer utilities{.pointer-events-none{pointer-events:none}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.inset-0{inset:calc(var(--spacing)*0)}.inset-y-0{inset-block:calc(var(--spacing)*0)}.-top-1{top:calc(var(--spacing)*-1)}.top-0\.5{top:calc(var(--spacing)*.5)}.top-1{top:calc(var(--spacing)*1)}.top-1\/2{top:50%}.top-2{top:calc(var(--spacing)*2)}.top-4{top:calc(var(--spacing)*4)}.top-\[2px\]{top:2px}.top-full{top:100%}.-right-1{right:calc(var(--spacing)*-1)}.right-0{right:calc(var(--spacing)*0)}.right-2{right:calc(var(--spacing)*2)}.right-4{right:calc(var(--spacing)*4)}.right-12{right:calc(var(--spacing)*12)}.bottom-0{bottom:calc(var(--spacing)*0)}.bottom-1{bottom:calc(var(--spacing)*1)}.bottom-2{bottom:calc(var(--spacing)*2)}.bottom-4{bottom:calc(var(--spacing)*4)}.bottom-6{bottom:calc(var(--spacing)*6)}.left-0{left:calc(var(--spacing)*0)}.left-1{left:calc(var(--spacing)*1)}.left-1\/2{left:50%}.left-2{left:calc(var(--spacing)*2)}.left-2\.5{left:calc(var(--spacing)*2.5)}.left-3{left:calc(var(--spacing)*3)}.left-4{left:calc(var(--spacing)*4)}.left-7{left:calc(var(--spacing)*7)}.left-12{left:calc(var(--spacing)*12)}.left-\[2px\]{left:2px}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.z-60,.z-\[60\]{z-index:60}.col-span-1{grid-column:span 1/span 1}.col-span-2{grid-column:span 2/span 2}.col-span-4{grid-column:span 4/span 4}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.m-3{margin:calc(var(--spacing)*3)}.m-4{margin:calc(var(--spacing)*4)}.m-auto{margin:auto}.mx-1{margin-inline:calc(var(--spacing)*1)}.mx-2{margin-inline:calc(var(--spacing)*2)}.mx-4{margin-inline:calc(var(--spacing)*4)}.mx-auto{margin-inline:auto}.my-1{margin-block:calc(var(--spacing)*1)}.my-8{margin-block:calc(var(--spacing)*8)}.-mt-2{margin-top:calc(var(--spacing)*-2)}.-mt-\[50px\]{margin-top:-50px}.mt-0\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-6{margin-top:calc(var(--spacing)*6)}.mr-1{margin-right:calc(var(--spacing)*1)}.mr-3{margin-right:calc(var(--spacing)*3)}.mr-4{margin-right:calc(var(--spacing)*4)}.-mb-px{margin-bottom:-1px}.mb-0\.5{margin-bottom:calc(var(--spacing)*.5)}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-1\.5{margin-bottom:calc(var(--spacing)*1.5)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-2\.5{margin-bottom:calc(var(--spacing)*2.5)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-3\.5{margin-bottom:calc(var(--spacing)*3.5)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-5{margin-bottom:calc(var(--spacing)*5)}.mb-6{margin-bottom:calc(var(--spacing)*6)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.-ml-1{margin-left:calc(var(--spacing)*-1)}.ml-0\.5{margin-left:calc(var(--spacing)*.5)}.ml-1\.5{margin-left:calc(var(--spacing)*1.5)}.ml-2{margin-left:calc(var(--spacing)*2)}.ml-8{margin-left:calc(var(--spacing)*8)}.ml-16{margin-left:calc(var(--spacing)*16)}.ml-64{margin-left:calc(var(--spacing)*64)}.ml-auto{margin-left:auto}.line-clamp-3{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.aspect-square{aspect-ratio:1}.aspect-video{aspect-ratio:var(--aspect-video)}.h-1{height:calc(var(--spacing)*1)}.h-1\.5{height:calc(var(--spacing)*1.5)}.h-2{height:calc(var(--spacing)*2)}.h-2\.5{height:calc(var(--spacing)*2.5)}.h-3{height:calc(var(--spacing)*3)}.h-3\.5{height:calc(var(--spacing)*3.5)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-8{height:calc(var(--spacing)*8)}.h-9{height:calc(var(--spacing)*9)}.h-10{height:calc(var(--spacing)*10)}.h-12{height:calc(var(--spacing)*12)}.h-16{height:calc(var(--spacing)*16)}.h-20{height:calc(var(--spacing)*20)}.h-24{height:calc(var(--spacing)*24)}.h-28{height:calc(var(--spacing)*28)}.h-64{height:calc(var(--spacing)*64)}.h-\[8px\]{height:8px}.h-\[14px\]{height:14px}.h-\[30px\]{height:30px}.h-\[50px\]{height:50px}.h-\[80px\]{height:80px}.h-\[80vh\]{height:80vh}.h-\[120px\]{height:120px}.h-\[160px\]{height:160px}.h-\[220px\]{height:220px}.h-auto{height:auto}.h-full{height:100%}.h-screen{height:100vh}.max-h-40{max-height:calc(var(--spacing)*40)}.max-h-60{max-height:calc(var(--spacing)*60)}.max-h-96{max-height:calc(var(--spacing)*96)}.max-h-\[60vh\]{max-height:60vh}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-full{max-height:100%}.min-h-0{min-height:calc(var(--spacing)*0)}.min-h-\[44px\]{min-height:44px}.min-h-\[48px\]{min-height:48px}.min-h-\[120px\]{min-height:120px}.min-h-\[400px\]{min-height:400px}.min-h-full{min-height:100%}.min-h-screen{min-height:100vh}.w-0\.5{width:calc(var(--spacing)*.5)}.w-2{width:calc(var(--spacing)*2)}.w-2\.5{width:calc(var(--spacing)*2.5)}.w-3{width:calc(var(--spacing)*3)}.w-3\.5{width:calc(var(--spacing)*3.5)}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-6{width:calc(var(--spacing)*6)}.w-8{width:calc(var(--spacing)*8)}.w-9{width:calc(var(--spacing)*9)}.w-10{width:calc(var(--spacing)*10)}.w-11{width:calc(var(--spacing)*11)}.w-12{width:calc(var(--spacing)*12)}.w-14{width:calc(var(--spacing)*14)}.w-16{width:calc(var(--spacing)*16)}.w-20{width:calc(var(--spacing)*20)}.w-28{width:calc(var(--spacing)*28)}.w-32{width:calc(var(--spacing)*32)}.w-36{width:calc(var(--spacing)*36)}.w-40{width:calc(var(--spacing)*40)}.w-48{width:calc(var(--spacing)*48)}.w-64{width:calc(var(--spacing)*64)}.w-80{width:calc(var(--spacing)*80)}.w-\[8px\]{width:8px}.w-\[39px\]{width:39px}.w-\[150px\]{width:150px}.w-\[220px\]{width:220px}.w-\[680px\]{width:680px}.w-auto{width:auto}.w-full{width:100%}.w-px{width:1px}.max-w-2xl{max-width:var(--container-2xl)}.max-w-3xl{max-width:var(--container-3xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-\[90vw\]{max-width:90vw}.max-w-\[100px\]{max-width:100px}.max-w-\[200px\]{max-width:200px}.max-w-full{max-width:100%}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-none{max-width:none}.max-w-sm{max-width:var(--container-sm)}.max-w-xl{max-width:var(--container-xl)}.min-w-0{min-width:calc(var(--spacing)*0)}.min-w-48{min-width:calc(var(--spacing)*48)}.min-w-\[18px\]{min-width:18px}.min-w-\[70px\]{min-width:70px}.min-w-\[80px\]{min-width:80px}.min-w-\[100px\]{min-width:100px}.min-w-\[120px\]{min-width:120px}.min-w-\[150px\]{min-width:150px}.min-w-\[160px\]{min-width:160px}.min-w-\[180px\]{min-width:180px}.min-w-\[200px\]{min-width:200px}.flex-1{flex:1}.flex-shrink-0,.shrink-0{flex-shrink:0}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-0{--tw-translate-x:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-0\.5{--tw-translate-x:calc(var(--spacing)*.5);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-1{--tw-translate-x:calc(var(--spacing)*1);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-4{--tw-translate-x:calc(var(--spacing)*4);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-5{--tw-translate-x:calc(var(--spacing)*5);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-7{--tw-translate-x:calc(var(--spacing)*7);translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.scale-110{--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x)var(--tw-scale-y)}.-rotate-90{rotate:-90deg}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.cursor-wait{cursor:wait}.resize{resize:both}.resize-none{resize:none}.\[appearance\:textfield\]{appearance:textfield}.appearance-none{appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-evenly{justify-content:space-evenly}.justify-start{justify-content:flex-start}.gap-0\.5{gap:calc(var(--spacing)*.5)}.gap-1{gap:calc(var(--spacing)*1)}.gap-1\.5{gap:calc(var(--spacing)*1.5)}.gap-2{gap:calc(var(--spacing)*2)}.gap-2\.5{gap:calc(var(--spacing)*2.5)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.gap-5{gap:calc(var(--spacing)*5)}.gap-6{gap:calc(var(--spacing)*6)}.gap-8{gap:calc(var(--spacing)*8)}:where(.space-y-0>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*0)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*0)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*6)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*6)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*8)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*8)*calc(1 - var(--tw-space-y-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px*var(--tw-divide-y-reverse));border-bottom-width:calc(1px*calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-bambu-dark-tertiary>:not(:last-child)){border-color:var(--color-bambu-dark-tertiary)}.self-center{align-self:center}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-\[8px\]{border-radius:8px}.rounded-\[10px\]{border-radius:10px}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-t-xl{border-top-left-radius:var(--radius-xl);border-top-right-radius:var(--radius-xl)}.rounded-r-lg{border-top-right-radius:var(--radius-lg);border-bottom-right-radius:var(--radius-lg)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-4{border-style:var(--tw-border-style);border-width:4px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-bambu-dark-tertiary,.border-bambu-dark-tertiary\/50{border-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab,red,red)){.border-bambu-dark-tertiary\/50{border-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)50%,transparent)}}.border-bambu-gray{border-color:var(--color-bambu-gray)}.border-bambu-green{border-color:var(--color-bambu-green)}.border-bambu-green\/30{border-color:#00ae424d}@supports (color:color-mix(in lab,red,red)){.border-bambu-green\/30{border-color:color-mix(in oklab,var(--color-bambu-green)30%,transparent)}}.border-bambu-green\/50{border-color:#00ae4280}@supports (color:color-mix(in lab,red,red)){.border-bambu-green\/50{border-color:color-mix(in oklab,var(--color-bambu-green)50%,transparent)}}.border-blue-500\/30{border-color:#3080ff4d}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/30{border-color:color-mix(in oklab,var(--color-blue-500)30%,transparent)}}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.border-gray-400{border-color:var(--color-gray-400)}.border-gray-700{border-color:var(--color-gray-700)}.border-green-500\/30{border-color:#00c7584d}@supports (color:color-mix(in lab,red,red)){.border-green-500\/30{border-color:color-mix(in oklab,var(--color-green-500)30%,transparent)}}.border-green-500\/50{border-color:#00c75880}@supports (color:color-mix(in lab,red,red)){.border-green-500\/50{border-color:color-mix(in oklab,var(--color-green-500)50%,transparent)}}.border-red-500\/30{border-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.border-red-500\/30{border-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.border-red-500\/50{border-color:#fb2c3680}@supports (color:color-mix(in lab,red,red)){.border-red-500\/50{border-color:color-mix(in oklab,var(--color-red-500)50%,transparent)}}.border-transparent{border-color:#0000}.border-white\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.border-white\/10{border-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.border-white\/20{border-color:#fff3}@supports (color:color-mix(in lab,red,red)){.border-white\/20{border-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.border-yellow-500{border-color:var(--color-yellow-500)}.border-yellow-500\/30{border-color:#edb2004d}@supports (color:color-mix(in lab,red,red)){.border-yellow-500\/30{border-color:color-mix(in oklab,var(--color-yellow-500)30%,transparent)}}.border-yellow-500\/50{border-color:#edb20080}@supports (color:color-mix(in lab,red,red)){.border-yellow-500\/50{border-color:color-mix(in oklab,var(--color-yellow-500)50%,transparent)}}.border-t-transparent{border-top-color:#0000}.bg-amber-500\/20{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/20{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.bg-bambu-dark{background-color:var(--color-bambu-dark)}.bg-bambu-dark-secondary,.bg-bambu-dark-secondary\/90{background-color:var(--color-bambu-dark-secondary)}@supports (color:color-mix(in lab,red,red)){.bg-bambu-dark-secondary\/90{background-color:color-mix(in oklab,var(--color-bambu-dark-secondary)90%,transparent)}}.bg-bambu-dark-tertiary,.bg-bambu-dark-tertiary\/50{background-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab,red,red)){.bg-bambu-dark-tertiary\/50{background-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)50%,transparent)}}.bg-bambu-dark\/30{background-color:var(--color-bambu-dark)}@supports (color:color-mix(in lab,red,red)){.bg-bambu-dark\/30{background-color:color-mix(in oklab,var(--color-bambu-dark)30%,transparent)}}.bg-bambu-dark\/50{background-color:var(--color-bambu-dark)}@supports (color:color-mix(in lab,red,red)){.bg-bambu-dark\/50{background-color:color-mix(in oklab,var(--color-bambu-dark)50%,transparent)}}.bg-bambu-dark\/80{background-color:var(--color-bambu-dark)}@supports (color:color-mix(in lab,red,red)){.bg-bambu-dark\/80{background-color:color-mix(in oklab,var(--color-bambu-dark)80%,transparent)}}.bg-bambu-dark\/90{background-color:var(--color-bambu-dark)}@supports (color:color-mix(in lab,red,red)){.bg-bambu-dark\/90{background-color:color-mix(in oklab,var(--color-bambu-dark)90%,transparent)}}.bg-bambu-gray\/20{background-color:var(--color-bambu-gray)}@supports (color:color-mix(in lab,red,red)){.bg-bambu-gray\/20{background-color:color-mix(in oklab,var(--color-bambu-gray)20%,transparent)}}.bg-bambu-gray\/30{background-color:var(--color-bambu-gray)}@supports (color:color-mix(in lab,red,red)){.bg-bambu-gray\/30{background-color:color-mix(in oklab,var(--color-bambu-gray)30%,transparent)}}.bg-bambu-gray\/50{background-color:var(--color-bambu-gray)}@supports (color:color-mix(in lab,red,red)){.bg-bambu-gray\/50{background-color:color-mix(in oklab,var(--color-bambu-gray)50%,transparent)}}.bg-bambu-green{background-color:var(--color-bambu-green)}.bg-bambu-green\/10{background-color:#00ae421a}@supports (color:color-mix(in lab,red,red)){.bg-bambu-green\/10{background-color:color-mix(in oklab,var(--color-bambu-green)10%,transparent)}}.bg-bambu-green\/20{background-color:#00ae4233}@supports (color:color-mix(in lab,red,red)){.bg-bambu-green\/20{background-color:color-mix(in oklab,var(--color-bambu-green)20%,transparent)}}.bg-bambu-green\/30{background-color:#00ae424d}@supports (color:color-mix(in lab,red,red)){.bg-bambu-green\/30{background-color:color-mix(in oklab,var(--color-bambu-green)30%,transparent)}}.bg-bambu-green\/50{background-color:#00ae4280}@supports (color:color-mix(in lab,red,red)){.bg-bambu-green\/50{background-color:color-mix(in oklab,var(--color-bambu-green)50%,transparent)}}.bg-bambu-green\/75{background-color:#00ae42bf}@supports (color:color-mix(in lab,red,red)){.bg-bambu-green\/75{background-color:color-mix(in oklab,var(--color-bambu-green)75%,transparent)}}.bg-black{background-color:var(--color-black)}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black)50%,transparent)}}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab,red,red)){.bg-black\/60{background-color:color-mix(in oklab,var(--color-black)60%,transparent)}}.bg-black\/70{background-color:#000000b3}@supports (color:color-mix(in lab,red,red)){.bg-black\/70{background-color:color-mix(in oklab,var(--color-black)70%,transparent)}}.bg-black\/80{background-color:#000c}@supports (color:color-mix(in lab,red,red)){.bg-black\/80{background-color:color-mix(in oklab,var(--color-black)80%,transparent)}}.bg-black\/90{background-color:#000000e6}@supports (color:color-mix(in lab,red,red)){.bg-black\/90{background-color:color-mix(in oklab,var(--color-black)90%,transparent)}}.bg-blue-400\/10{background-color:#54a2ff1a}@supports (color:color-mix(in lab,red,red)){.bg-blue-400\/10{background-color:color-mix(in oklab,var(--color-blue-400)10%,transparent)}}.bg-blue-500{background-color:var(--color-blue-500)}.bg-blue-500\/10{background-color:#3080ff1a}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/10{background-color:color-mix(in oklab,var(--color-blue-500)10%,transparent)}}.bg-blue-500\/20{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/20{background-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-200{background-color:var(--color-gray-200)}.bg-gray-300{background-color:var(--color-gray-300)}.bg-gray-400{background-color:var(--color-gray-400)}.bg-gray-400\/10{background-color:#99a1af1a}@supports (color:color-mix(in lab,red,red)){.bg-gray-400\/10{background-color:color-mix(in oklab,var(--color-gray-400)10%,transparent)}}.bg-gray-500{background-color:var(--color-gray-500)}.bg-gray-500\/20{background-color:#6a728233}@supports (color:color-mix(in lab,red,red)){.bg-gray-500\/20{background-color:color-mix(in oklab,var(--color-gray-500)20%,transparent)}}.bg-green-400{background-color:var(--color-green-400)}.bg-green-400\/10{background-color:#05df721a}@supports (color:color-mix(in lab,red,red)){.bg-green-400\/10{background-color:color-mix(in oklab,var(--color-green-400)10%,transparent)}}.bg-green-500{background-color:var(--color-green-500)}.bg-green-500\/10{background-color:#00c7581a}@supports (color:color-mix(in lab,red,red)){.bg-green-500\/10{background-color:color-mix(in oklab,var(--color-green-500)10%,transparent)}}.bg-green-500\/20{background-color:#00c75833}@supports (color:color-mix(in lab,red,red)){.bg-green-500\/20{background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.bg-orange-400\/10{background-color:#ff8b1a1a}@supports (color:color-mix(in lab,red,red)){.bg-orange-400\/10{background-color:color-mix(in oklab,var(--color-orange-400)10%,transparent)}}.bg-orange-500{background-color:var(--color-orange-500)}.bg-orange-500\/20{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/20{background-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.bg-purple-500\/20{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/20{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.bg-purple-500\/80{background-color:#ac4bffcc}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/80{background-color:color-mix(in oklab,var(--color-purple-500)80%,transparent)}}.bg-red-400{background-color:var(--color-red-400)}.bg-red-400\/10{background-color:#ff65681a}@supports (color:color-mix(in lab,red,red)){.bg-red-400\/10{background-color:color-mix(in oklab,var(--color-red-400)10%,transparent)}}.bg-red-500{background-color:var(--color-red-500)}.bg-red-500\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/10{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.bg-red-500\/15{background-color:#fb2c3626}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/15{background-color:color-mix(in oklab,var(--color-red-500)15%,transparent)}}.bg-red-500\/20{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/20{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.bg-red-500\/30{background-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/30{background-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.bg-red-500\/80{background-color:#fb2c36cc}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/80{background-color:color-mix(in oklab,var(--color-red-500)80%,transparent)}}.bg-red-600{background-color:var(--color-red-600)}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-yellow-100{background-color:var(--color-yellow-100)}.bg-yellow-400{background-color:var(--color-yellow-400)}.bg-yellow-400\/10{background-color:#fac8001a}@supports (color:color-mix(in lab,red,red)){.bg-yellow-400\/10{background-color:color-mix(in oklab,var(--color-yellow-400)10%,transparent)}}.bg-yellow-400\/20{background-color:#fac80033}@supports (color:color-mix(in lab,red,red)){.bg-yellow-400\/20{background-color:color-mix(in oklab,var(--color-yellow-400)20%,transparent)}}.bg-yellow-500{background-color:var(--color-yellow-500)}.bg-yellow-500\/10{background-color:#edb2001a}@supports (color:color-mix(in lab,red,red)){.bg-yellow-500\/10{background-color:color-mix(in oklab,var(--color-yellow-500)10%,transparent)}}.bg-yellow-500\/20{background-color:#edb20033}@supports (color:color-mix(in lab,red,red)){.bg-yellow-500\/20{background-color:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.bg-yellow-600{background-color:var(--color-yellow-600)}.fill-yellow-400{fill:var(--color-yellow-400)}.object-contain{object-fit:contain}.object-cover{object-fit:cover}.object-left{object-position:left}.p-0{padding:calc(var(--spacing)*0)}.p-1{padding:calc(var(--spacing)*1)}.p-1\.5{padding:calc(var(--spacing)*1.5)}.p-2{padding:calc(var(--spacing)*2)}.p-2\.5{padding:calc(var(--spacing)*2.5)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-5{padding:calc(var(--spacing)*5)}.p-6{padding:calc(var(--spacing)*6)}.p-8{padding:calc(var(--spacing)*8)}.p-12{padding:calc(var(--spacing)*12)}.px-1{padding-inline:calc(var(--spacing)*1)}.px-1\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-2\.5{padding-inline:calc(var(--spacing)*2.5)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-3\.5{padding-inline:calc(var(--spacing)*3.5)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-5{padding-inline:calc(var(--spacing)*5)}.px-6{padding-inline:calc(var(--spacing)*6)}.px-7{padding-inline:calc(var(--spacing)*7)}.px-\[18px\]{padding-inline:18px}.py-0\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-2\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.py-8{padding-block:calc(var(--spacing)*8)}.py-12{padding-block:calc(var(--spacing)*12)}.py-\[3px\]{padding-block:3px}.pt-0{padding-top:calc(var(--spacing)*0)}.pt-0\.5{padding-top:calc(var(--spacing)*.5)}.pt-2{padding-top:calc(var(--spacing)*2)}.pt-3{padding-top:calc(var(--spacing)*3)}.pt-4{padding-top:calc(var(--spacing)*4)}.pr-3{padding-right:calc(var(--spacing)*3)}.pr-4{padding-right:calc(var(--spacing)*4)}.pr-5{padding-right:calc(var(--spacing)*5)}.pr-8{padding-right:calc(var(--spacing)*8)}.pb-2{padding-bottom:calc(var(--spacing)*2)}.pb-4{padding-bottom:calc(var(--spacing)*4)}.pb-\[5px\]{padding-bottom:5px}.pl-2{padding-left:calc(var(--spacing)*2)}.pl-4{padding-left:calc(var(--spacing)*4)}.pl-8{padding-left:calc(var(--spacing)*8)}.pl-10{padding-left:calc(var(--spacing)*10)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.text-amber-400{color:var(--color-amber-400)}.text-bambu-dark-tertiary{color:var(--color-bambu-dark-tertiary)}.text-bambu-gray{color:var(--color-bambu-gray)}.text-bambu-gray-light{color:var(--color-bambu-gray-light)}.text-bambu-gray\/30{color:var(--color-bambu-gray)}@supports (color:color-mix(in lab,red,red)){.text-bambu-gray\/30{color:color-mix(in oklab,var(--color-bambu-gray)30%,transparent)}}.text-bambu-gray\/50{color:var(--color-bambu-gray)}@supports (color:color-mix(in lab,red,red)){.text-bambu-gray\/50{color:color-mix(in oklab,var(--color-bambu-gray)50%,transparent)}}.text-bambu-gray\/70{color:var(--color-bambu-gray)}@supports (color:color-mix(in lab,red,red)){.text-bambu-gray\/70{color:color-mix(in oklab,var(--color-bambu-gray)70%,transparent)}}.text-bambu-green{color:var(--color-bambu-green)}.text-blue-400{color:var(--color-blue-400)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-900{color:var(--color-gray-900)}.text-green-400{color:var(--color-green-400)}.text-green-500{color:var(--color-green-500)}.text-orange-400{color:var(--color-orange-400)}.text-purple-400{color:var(--color-purple-400)}.text-red-400{color:var(--color-red-400)}.text-red-500{color:var(--color-red-500)}.text-white{color:var(--color-white)}.text-white\/80{color:#fffc}@supports (color:color-mix(in lab,red,red)){.text-white\/80{color:color-mix(in oklab,var(--color-white)80%,transparent)}}.text-yellow-400{color:var(--color-yellow-400)}.text-yellow-500{color:var(--color-yellow-500)}.text-yellow-600{color:var(--color-yellow-600)}.capitalize{text-transform:capitalize}.uppercase{text-transform:uppercase}.italic{font-style:italic}.underline{text-decoration-line:underline}.placeholder-bambu-gray::placeholder,.placeholder-bambu-gray\/50::placeholder{color:var(--color-bambu-gray)}@supports (color:color-mix(in lab,red,red)){.placeholder-bambu-gray\/50::placeholder{color:color-mix(in oklab,var(--color-bambu-gray)50%,transparent)}}.accent-bambu-green{accent-color:var(--color-bambu-green)}.opacity-0{opacity:0}.opacity-20{opacity:.2}.opacity-30{opacity:.3}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-80{opacity:.8}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-inner{--tw-shadow:inset 0 2px 4px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring,.ring-1{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-bambu-green{--tw-ring-color:var(--color-bambu-green)}.ring-white{--tw-ring-color:var(--color-white)}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.invert{--tw-invert:invert(100%);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}@media(hover:hover){.group-hover\:text-bambu-green:is(:where(.group):hover *){color:var(--color-bambu-green)}.group-hover\:opacity-50:is(:where(.group):hover *){opacity:.5}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.peer-checked\:bg-bambu-green:is(:where(.peer):checked~*){background-color:var(--color-bambu-green)}.peer-focus\:outline-none:is(:where(.peer):focus~*){--tw-outline-style:none;outline-style:none}.before\:absolute:before{content:var(--tw-content);position:absolute}.before\:top-0:before{content:var(--tw-content);top:calc(var(--spacing)*0)}.before\:right-0:before{content:var(--tw-content);right:calc(var(--spacing)*0)}.before\:left-0:before{content:var(--tw-content);left:calc(var(--spacing)*0)}.before\:h-0\.5:before{content:var(--tw-content);height:calc(var(--spacing)*.5)}.before\:bg-bambu-green:before{content:var(--tw-content);background-color:var(--color-bambu-green)}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:top-\[2px\]:after{content:var(--tw-content);top:2px}.after\:left-\[2px\]:after{content:var(--tw-content);left:2px}.after\:h-4:after{content:var(--tw-content);height:calc(var(--spacing)*4)}.after\:h-5:after{content:var(--tw-content);height:calc(var(--spacing)*5)}.after\:w-4:after{content:var(--tw-content);width:calc(var(--spacing)*4)}.after\:w-5:after{content:var(--tw-content);width:calc(var(--spacing)*5)}.after\:rounded-full:after{content:var(--tw-content);border-radius:3.40282e38px}.after\:bg-white:after{content:var(--tw-content);background-color:var(--color-white)}.after\:transition-all:after{content:var(--tw-content);transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.after\:content-\[\'\'\]:after{--tw-content:"";content:var(--tw-content)}.peer-checked\:after\:translate-x-full:is(:where(.peer):checked~*):after{content:var(--tw-content);--tw-translate-x:100%;translate:var(--tw-translate-x)var(--tw-translate-y)}.peer-checked\:after\:border-white:is(:where(.peer):checked~*):after{content:var(--tw-content);border-color:var(--color-white)}@media(hover:hover){.hover\:border-bambu-gray:hover{border-color:var(--color-bambu-gray)}.hover\:border-bambu-green:hover{border-color:var(--color-bambu-green)}.hover\:border-bambu-green-dark:hover{border-color:var(--color-bambu-green-dark)}.hover\:border-white\/40:hover{border-color:#fff6}@supports (color:color-mix(in lab,red,red)){.hover\:border-white\/40:hover{border-color:color-mix(in oklab,var(--color-white)40%,transparent)}}.hover\:bg-bambu-dark:hover{background-color:var(--color-bambu-dark)}.hover\:bg-bambu-dark-secondary:hover{background-color:var(--color-bambu-dark-secondary)}.hover\:bg-bambu-dark-tertiary:hover,.hover\:bg-bambu-dark-tertiary\/30:hover{background-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-bambu-dark-tertiary\/30:hover{background-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)30%,transparent)}}.hover\:bg-bambu-dark-tertiary\/50:hover{background-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-bambu-dark-tertiary\/50:hover{background-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)50%,transparent)}}.hover\:bg-bambu-dark-tertiary\/70:hover{background-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-bambu-dark-tertiary\/70:hover{background-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)70%,transparent)}}.hover\:bg-bambu-dark-tertiary\/80:hover{background-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-bambu-dark-tertiary\/80:hover{background-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)80%,transparent)}}.hover\:bg-bambu-gray-dark:hover{background-color:var(--color-bambu-gray-dark)}.hover\:bg-bambu-green-dark:hover{background-color:var(--color-bambu-green-dark)}.hover\:bg-bambu-green-light:hover{background-color:var(--color-bambu-green-light)}.hover\:bg-bambu-green\/20:hover{background-color:#00ae4233}@supports (color:color-mix(in lab,red,red)){.hover\:bg-bambu-green\/20:hover{background-color:color-mix(in oklab,var(--color-bambu-green)20%,transparent)}}.hover\:bg-bambu-green\/30:hover{background-color:#00ae424d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-bambu-green\/30:hover{background-color:color-mix(in oklab,var(--color-bambu-green)30%,transparent)}}.hover\:bg-bambu-green\/90:hover{background-color:#00ae42e6}@supports (color:color-mix(in lab,red,red)){.hover\:bg-bambu-green\/90:hover{background-color:color-mix(in oklab,var(--color-bambu-green)90%,transparent)}}.hover\:bg-black\/20:hover{background-color:#0003}@supports (color:color-mix(in lab,red,red)){.hover\:bg-black\/20:hover{background-color:color-mix(in oklab,var(--color-black)20%,transparent)}}.hover\:bg-black\/70:hover{background-color:#000000b3}@supports (color:color-mix(in lab,red,red)){.hover\:bg-black\/70:hover{background-color:color-mix(in oklab,var(--color-black)70%,transparent)}}.hover\:bg-black\/80:hover{background-color:#000c}@supports (color:color-mix(in lab,red,red)){.hover\:bg-black\/80:hover{background-color:color-mix(in oklab,var(--color-black)80%,transparent)}}.hover\:bg-gray-50:hover{background-color:var(--color-gray-50)}.hover\:bg-gray-100:hover{background-color:var(--color-gray-100)}.hover\:bg-gray-300:hover{background-color:var(--color-gray-300)}.hover\:bg-gray-400:hover{background-color:var(--color-gray-400)}.hover\:bg-gray-700:hover{background-color:var(--color-gray-700)}.hover\:bg-red-400\/10:hover{background-color:#ff65681a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-400\/10:hover{background-color:color-mix(in oklab,var(--color-red-400)10%,transparent)}}.hover\:bg-red-500:hover{background-color:var(--color-red-500)}.hover\:bg-red-500\/10:hover{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/10:hover{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.hover\:bg-red-500\/30:hover{background-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/30:hover{background-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.hover\:bg-red-600:hover{background-color:var(--color-red-600)}.hover\:bg-red-700:hover{background-color:var(--color-red-700)}.hover\:bg-yellow-500\/30:hover{background-color:#edb2004d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-yellow-500\/30:hover{background-color:color-mix(in oklab,var(--color-yellow-500)30%,transparent)}}.hover\:bg-yellow-600:hover{background-color:var(--color-yellow-600)}.hover\:bg-yellow-700:hover{background-color:var(--color-yellow-700)}.hover\:text-bambu-green:hover{color:var(--color-bambu-green)}.hover\:text-bambu-green\/80:hover{color:#00ae42cc}@supports (color:color-mix(in lab,red,red)){.hover\:text-bambu-green\/80:hover{color:color-mix(in oklab,var(--color-bambu-green)80%,transparent)}}.hover\:text-red-300:hover{color:var(--color-red-300)}.hover\:text-red-400:hover{color:var(--color-red-400)}.hover\:text-white:hover{color:var(--color-white)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-70:hover{opacity:.7}.hover\:opacity-80:hover{opacity:.8}}.focus\:border-bambu-green:focus{border-color:var(--color-bambu-green)}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-bambu-gray:focus{--tw-ring-color:var(--color-bambu-gray)}.focus\:ring-bambu-green:focus{--tw-ring-color:var(--color-bambu-green)}.focus\:ring-red-500:focus{--tw-ring-color:var(--color-red-500)}.focus\:ring-offset-0:focus{--tw-ring-offset-width:0px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus\:ring-offset-bambu-dark:focus{--tw-ring-offset-color:var(--color-bambu-dark)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.active\:cursor-grabbing:active{cursor:grabbing}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:opacity-60:disabled{opacity:.6}@media(hover:hover){.disabled\:hover\:bg-bambu-dark-secondary:disabled:hover{background-color:var(--color-bambu-dark-secondary)}.disabled\:hover\:text-bambu-gray:disabled:hover{color:var(--color-bambu-gray)}}@media(min-width:40rem){.sm\:inline{display:inline}.sm\:h-4{height:calc(var(--spacing)*4)}.sm\:w-4{width:calc(var(--spacing)*4)}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:p-1\.5{padding:calc(var(--spacing)*1.5)}}@media(min-width:48rem){.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}}@media(min-width:64rem){.lg\:w-80{width:calc(var(--spacing)*80)}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:flex-row{flex-direction:row}}@media(min-width:80rem){.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}.dark\:border-bambu-dark-tertiary:where(.dark,.dark *){border-color:var(--color-bambu-dark-tertiary)}.dark\:border-gray-500:where(.dark,.dark *){border-color:var(--color-gray-500)}.dark\:bg-bambu-dark:where(.dark,.dark *){background-color:var(--color-bambu-dark)}.dark\:bg-bambu-dark-secondary:where(.dark,.dark *){background-color:var(--color-bambu-dark-secondary)}.dark\:bg-bambu-dark-tertiary:where(.dark,.dark *){background-color:var(--color-bambu-dark-tertiary)}.dark\:bg-yellow-900\/20:where(.dark,.dark *){background-color:#733e0a33}@supports (color:color-mix(in lab,red,red)){.dark\:bg-yellow-900\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-yellow-900)20%,transparent)}}.dark\:text-bambu-gray:where(.dark,.dark *){color:var(--color-bambu-gray)}.dark\:text-gray-400:where(.dark,.dark *){color:var(--color-gray-400)}.dark\:text-gray-500:where(.dark,.dark *){color:var(--color-gray-500)}.dark\:text-white:where(.dark,.dark *){color:var(--color-white)}.dark\:text-yellow-400:where(.dark,.dark *){color:var(--color-yellow-400)}@media(hover:hover){.dark\:hover\:bg-bambu-dark-tertiary:where(.dark,.dark *):hover{background-color:var(--color-bambu-dark-tertiary)}}.\[\&\:\:-moz-range-thumb\]\:h-4::-moz-range-thumb{height:calc(var(--spacing)*4)}.\[\&\:\:-moz-range-thumb\]\:w-4::-moz-range-thumb{width:calc(var(--spacing)*4)}.\[\&\:\:-moz-range-thumb\]\:cursor-pointer::-moz-range-thumb{cursor:pointer}.\[\&\:\:-moz-range-thumb\]\:rounded-full::-moz-range-thumb{border-radius:3.40282e38px}.\[\&\:\:-moz-range-thumb\]\:border-0::-moz-range-thumb{border-style:var(--tw-border-style);border-width:0}.\[\&\:\:-moz-range-thumb\]\:bg-bambu-green::-moz-range-thumb{background-color:var(--color-bambu-green)}.\[\&\:\:-webkit-slider-thumb\]\:h-3::-webkit-slider-thumb{height:calc(var(--spacing)*3)}.\[\&\:\:-webkit-slider-thumb\]\:h-4::-webkit-slider-thumb{height:calc(var(--spacing)*4)}.\[\&\:\:-webkit-slider-thumb\]\:w-3::-webkit-slider-thumb{width:calc(var(--spacing)*3)}.\[\&\:\:-webkit-slider-thumb\]\:w-4::-webkit-slider-thumb{width:calc(var(--spacing)*4)}.\[\&\:\:-webkit-slider-thumb\]\:cursor-pointer::-webkit-slider-thumb{cursor:pointer}.\[\&\:\:-webkit-slider-thumb\]\:appearance-none::-webkit-slider-thumb{appearance:none}.\[\&\:\:-webkit-slider-thumb\]\:rounded-full::-webkit-slider-thumb{border-radius:3.40282e38px}.\[\&\:\:-webkit-slider-thumb\]\:bg-bambu-green::-webkit-slider-thumb{background-color:var(--color-bambu-green)}}:root{--bg-primary:#f5f5f5;--bg-secondary:#fff;--bg-tertiary:#e5e5e5;--text-primary:#1a1a1a;--text-secondary:#4a4a4a;--text-muted:#6b6b6b;--text-tertiary:gray;--border-color:#d4d4d4;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:Inter,system-ui,sans-serif;font-weight:400;line-height:1.5}.dark{--bg-primary:#1a1a1a;--bg-secondary:#2d2d2d;--bg-tertiary:#3d3d3d;--text-primary:#fff;--text-secondary:#a0a0a0;--text-muted:gray;--text-tertiary:#4a4a4a;--border-color:#3d3d3d}body{background-color:var(--bg-primary);color:var(--text-primary);min-height:100vh;margin:0;transition:background-color .2s,color .2s}#root{min-height:100vh}.text-white{color:var(--text-primary)}.bg-bambu-dark,.bg-bambu-dark-secondary,.bg-bambu-dark-tertiary,.border-bambu-dark-tertiary{transition:background-color .2s,border-color .2s}@keyframes slide-in{0%{opacity:0;transform:translate(100%)}to{opacity:1;transform:translate(0)}}.animate-slide-in{animation:.2s ease-out slide-in}.icon-theme{opacity:.5}.dark .icon-theme{filter:invert();opacity:.4}.icon-green{filter:invert(48%)sepia(89%)saturate(459%)hue-rotate(93deg)brightness(95%)contrast(92%);opacity:1}.icon-heating{filter:invert(50%)sepia()saturate(1000%)hue-rotate(360deg)brightness()contrast();opacity:1}.dark .jogpad-theme{filter:brightness(.35)contrast(1.2)}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-content:""}}}
diff --git a/static/assets/index-gD5e-c1O.css b/static/assets/index-gD5e-c1O.css
new file mode 100644
index 000000000..01c5b6369
--- /dev/null
+++ b/static/assets/index-gD5e-c1O.css
@@ -0,0 +1 @@
+@import"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap";@layer properties,theme,base,components,utilities;@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-orange-400:oklch(75% .183 55.934);--color-orange-500:oklch(70.5% .213 47.604);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-yellow-100:oklch(97.3% .071 103.193);--color-yellow-400:oklch(85.2% .199 91.936);--color-yellow-500:oklch(79.5% .184 86.047);--color-yellow-600:oklch(68.1% .162 75.834);--color-yellow-700:oklch(55.4% .135 66.442);--color-yellow-900:oklch(42.1% .095 57.708);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-purple-400:oklch(71.4% .203 305.504);--color-purple-500:oklch(62.7% .265 303.9);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-900:oklch(21% .034 264.665);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-xl:36rem;--container-2xl:42rem;--container-3xl:48rem;--container-4xl:56rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-wide:.025em;--tracking-widest:.1em;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--ease-in-out:cubic-bezier(.4,0,.2,1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--blur-sm:8px;--aspect-video:16/9;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-bambu-green:#00ae42;--color-bambu-green-light:#00c64d;--color-bambu-green-dark:#009438;--color-bambu-dark:var(--bg-primary);--color-bambu-dark-secondary:var(--bg-secondary);--color-bambu-dark-tertiary:var(--bg-tertiary);--color-bambu-gray:var(--text-muted);--color-bambu-gray-light:var(--text-secondary);--color-bambu-gray-dark:var(--text-tertiary)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer utilities{.pointer-events-none{pointer-events:none}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.inset-0{inset:calc(var(--spacing)*0)}.inset-y-0{inset-block:calc(var(--spacing)*0)}.-top-1{top:calc(var(--spacing)*-1)}.top-0\.5{top:calc(var(--spacing)*.5)}.top-1{top:calc(var(--spacing)*1)}.top-1\/2{top:50%}.top-2{top:calc(var(--spacing)*2)}.top-4{top:calc(var(--spacing)*4)}.top-\[2px\]{top:2px}.top-full{top:100%}.-right-1{right:calc(var(--spacing)*-1)}.right-0{right:calc(var(--spacing)*0)}.right-2{right:calc(var(--spacing)*2)}.right-4{right:calc(var(--spacing)*4)}.right-12{right:calc(var(--spacing)*12)}.bottom-0{bottom:calc(var(--spacing)*0)}.bottom-1{bottom:calc(var(--spacing)*1)}.bottom-2{bottom:calc(var(--spacing)*2)}.bottom-4{bottom:calc(var(--spacing)*4)}.bottom-6{bottom:calc(var(--spacing)*6)}.left-0{left:calc(var(--spacing)*0)}.left-1{left:calc(var(--spacing)*1)}.left-1\/2{left:50%}.left-2{left:calc(var(--spacing)*2)}.left-2\.5{left:calc(var(--spacing)*2.5)}.left-3{left:calc(var(--spacing)*3)}.left-4{left:calc(var(--spacing)*4)}.left-7{left:calc(var(--spacing)*7)}.left-12{left:calc(var(--spacing)*12)}.left-\[2px\]{left:2px}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.z-60,.z-\[60\]{z-index:60}.col-span-1{grid-column:span 1/span 1}.col-span-2{grid-column:span 2/span 2}.col-span-4{grid-column:span 4/span 4}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.m-3{margin:calc(var(--spacing)*3)}.m-4{margin:calc(var(--spacing)*4)}.m-auto{margin:auto}.mx-1{margin-inline:calc(var(--spacing)*1)}.mx-2{margin-inline:calc(var(--spacing)*2)}.mx-4{margin-inline:calc(var(--spacing)*4)}.mx-auto{margin-inline:auto}.my-1{margin-block:calc(var(--spacing)*1)}.my-8{margin-block:calc(var(--spacing)*8)}.-mt-2{margin-top:calc(var(--spacing)*-2)}.-mt-\[50px\]{margin-top:-50px}.mt-0\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-6{margin-top:calc(var(--spacing)*6)}.mr-1{margin-right:calc(var(--spacing)*1)}.mr-3{margin-right:calc(var(--spacing)*3)}.mr-4{margin-right:calc(var(--spacing)*4)}.-mb-px{margin-bottom:-1px}.mb-0\.5{margin-bottom:calc(var(--spacing)*.5)}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-1\.5{margin-bottom:calc(var(--spacing)*1.5)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-2\.5{margin-bottom:calc(var(--spacing)*2.5)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-3\.5{margin-bottom:calc(var(--spacing)*3.5)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-5{margin-bottom:calc(var(--spacing)*5)}.mb-6{margin-bottom:calc(var(--spacing)*6)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.-ml-1{margin-left:calc(var(--spacing)*-1)}.ml-0\.5{margin-left:calc(var(--spacing)*.5)}.ml-1\.5{margin-left:calc(var(--spacing)*1.5)}.ml-2{margin-left:calc(var(--spacing)*2)}.ml-8{margin-left:calc(var(--spacing)*8)}.ml-16{margin-left:calc(var(--spacing)*16)}.ml-64{margin-left:calc(var(--spacing)*64)}.ml-auto{margin-left:auto}.line-clamp-3{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.aspect-square{aspect-ratio:1}.aspect-video{aspect-ratio:var(--aspect-video)}.h-1{height:calc(var(--spacing)*1)}.h-1\.5{height:calc(var(--spacing)*1.5)}.h-2{height:calc(var(--spacing)*2)}.h-2\.5{height:calc(var(--spacing)*2.5)}.h-3{height:calc(var(--spacing)*3)}.h-3\.5{height:calc(var(--spacing)*3.5)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-8{height:calc(var(--spacing)*8)}.h-9{height:calc(var(--spacing)*9)}.h-10{height:calc(var(--spacing)*10)}.h-12{height:calc(var(--spacing)*12)}.h-16{height:calc(var(--spacing)*16)}.h-20{height:calc(var(--spacing)*20)}.h-24{height:calc(var(--spacing)*24)}.h-28{height:calc(var(--spacing)*28)}.h-64{height:calc(var(--spacing)*64)}.h-\[8px\]{height:8px}.h-\[14px\]{height:14px}.h-\[30px\]{height:30px}.h-\[50px\]{height:50px}.h-\[80px\]{height:80px}.h-\[80vh\]{height:80vh}.h-\[120px\]{height:120px}.h-\[160px\]{height:160px}.h-\[220px\]{height:220px}.h-auto{height:auto}.h-full{height:100%}.h-screen{height:100vh}.max-h-40{max-height:calc(var(--spacing)*40)}.max-h-60{max-height:calc(var(--spacing)*60)}.max-h-96{max-height:calc(var(--spacing)*96)}.max-h-\[60vh\]{max-height:60vh}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-full{max-height:100%}.min-h-0{min-height:calc(var(--spacing)*0)}.min-h-\[44px\]{min-height:44px}.min-h-\[48px\]{min-height:48px}.min-h-\[120px\]{min-height:120px}.min-h-\[400px\]{min-height:400px}.min-h-full{min-height:100%}.min-h-screen{min-height:100vh}.w-0\.5{width:calc(var(--spacing)*.5)}.w-2{width:calc(var(--spacing)*2)}.w-2\.5{width:calc(var(--spacing)*2.5)}.w-3{width:calc(var(--spacing)*3)}.w-3\.5{width:calc(var(--spacing)*3.5)}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-6{width:calc(var(--spacing)*6)}.w-8{width:calc(var(--spacing)*8)}.w-9{width:calc(var(--spacing)*9)}.w-10{width:calc(var(--spacing)*10)}.w-11{width:calc(var(--spacing)*11)}.w-12{width:calc(var(--spacing)*12)}.w-14{width:calc(var(--spacing)*14)}.w-16{width:calc(var(--spacing)*16)}.w-20{width:calc(var(--spacing)*20)}.w-28{width:calc(var(--spacing)*28)}.w-32{width:calc(var(--spacing)*32)}.w-36{width:calc(var(--spacing)*36)}.w-40{width:calc(var(--spacing)*40)}.w-48{width:calc(var(--spacing)*48)}.w-64{width:calc(var(--spacing)*64)}.w-80{width:calc(var(--spacing)*80)}.w-\[8px\]{width:8px}.w-\[39px\]{width:39px}.w-\[150px\]{width:150px}.w-\[220px\]{width:220px}.w-\[680px\]{width:680px}.w-auto{width:auto}.w-full{width:100%}.w-px{width:1px}.max-w-2xl{max-width:var(--container-2xl)}.max-w-3xl{max-width:var(--container-3xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-\[90vw\]{max-width:90vw}.max-w-\[100px\]{max-width:100px}.max-w-\[200px\]{max-width:200px}.max-w-full{max-width:100%}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-none{max-width:none}.max-w-sm{max-width:var(--container-sm)}.max-w-xl{max-width:var(--container-xl)}.min-w-0{min-width:calc(var(--spacing)*0)}.min-w-48{min-width:calc(var(--spacing)*48)}.min-w-\[18px\]{min-width:18px}.min-w-\[70px\]{min-width:70px}.min-w-\[80px\]{min-width:80px}.min-w-\[100px\]{min-width:100px}.min-w-\[120px\]{min-width:120px}.min-w-\[150px\]{min-width:150px}.min-w-\[160px\]{min-width:160px}.min-w-\[180px\]{min-width:180px}.min-w-\[200px\]{min-width:200px}.flex-1{flex:1}.flex-shrink-0,.shrink-0{flex-shrink:0}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-0{--tw-translate-x:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-0\.5{--tw-translate-x:calc(var(--spacing)*.5);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-1{--tw-translate-x:calc(var(--spacing)*1);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-4{--tw-translate-x:calc(var(--spacing)*4);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-5{--tw-translate-x:calc(var(--spacing)*5);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-7{--tw-translate-x:calc(var(--spacing)*7);translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.scale-110{--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x)var(--tw-scale-y)}.-rotate-90{rotate:-90deg}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.cursor-wait{cursor:wait}.resize{resize:both}.resize-none{resize:none}.\[appearance\:textfield\]{appearance:textfield}.appearance-none{appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-evenly{justify-content:space-evenly}.justify-start{justify-content:flex-start}.gap-0\.5{gap:calc(var(--spacing)*.5)}.gap-1{gap:calc(var(--spacing)*1)}.gap-1\.5{gap:calc(var(--spacing)*1.5)}.gap-2{gap:calc(var(--spacing)*2)}.gap-2\.5{gap:calc(var(--spacing)*2.5)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.gap-5{gap:calc(var(--spacing)*5)}.gap-6{gap:calc(var(--spacing)*6)}.gap-8{gap:calc(var(--spacing)*8)}:where(.space-y-0>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*0)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*0)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*6)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*6)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*8)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*8)*calc(1 - var(--tw-space-y-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px*var(--tw-divide-y-reverse));border-bottom-width:calc(1px*calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-bambu-dark-tertiary>:not(:last-child)){border-color:var(--color-bambu-dark-tertiary)}.self-center{align-self:center}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-\[8px\]{border-radius:8px}.rounded-\[10px\]{border-radius:10px}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-t-xl{border-top-left-radius:var(--radius-xl);border-top-right-radius:var(--radius-xl)}.rounded-r-lg{border-top-right-radius:var(--radius-lg);border-bottom-right-radius:var(--radius-lg)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-4{border-style:var(--tw-border-style);border-width:4px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-bambu-dark-tertiary,.border-bambu-dark-tertiary\/50{border-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab,red,red)){.border-bambu-dark-tertiary\/50{border-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)50%,transparent)}}.border-bambu-gray{border-color:var(--color-bambu-gray)}.border-bambu-gray-dark{border-color:var(--color-bambu-gray-dark)}.border-bambu-green{border-color:var(--color-bambu-green)}.border-bambu-green\/30{border-color:#00ae424d}@supports (color:color-mix(in lab,red,red)){.border-bambu-green\/30{border-color:color-mix(in oklab,var(--color-bambu-green)30%,transparent)}}.border-bambu-green\/50{border-color:#00ae4280}@supports (color:color-mix(in lab,red,red)){.border-bambu-green\/50{border-color:color-mix(in oklab,var(--color-bambu-green)50%,transparent)}}.border-blue-500\/30{border-color:#3080ff4d}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/30{border-color:color-mix(in oklab,var(--color-blue-500)30%,transparent)}}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.border-gray-400{border-color:var(--color-gray-400)}.border-gray-700{border-color:var(--color-gray-700)}.border-green-500\/30{border-color:#00c7584d}@supports (color:color-mix(in lab,red,red)){.border-green-500\/30{border-color:color-mix(in oklab,var(--color-green-500)30%,transparent)}}.border-green-500\/50{border-color:#00c75880}@supports (color:color-mix(in lab,red,red)){.border-green-500\/50{border-color:color-mix(in oklab,var(--color-green-500)50%,transparent)}}.border-red-500\/30{border-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.border-red-500\/30{border-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.border-red-500\/50{border-color:#fb2c3680}@supports (color:color-mix(in lab,red,red)){.border-red-500\/50{border-color:color-mix(in oklab,var(--color-red-500)50%,transparent)}}.border-transparent{border-color:#0000}.border-white\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.border-white\/10{border-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.border-white\/20{border-color:#fff3}@supports (color:color-mix(in lab,red,red)){.border-white\/20{border-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.border-yellow-500{border-color:var(--color-yellow-500)}.border-yellow-500\/30{border-color:#edb2004d}@supports (color:color-mix(in lab,red,red)){.border-yellow-500\/30{border-color:color-mix(in oklab,var(--color-yellow-500)30%,transparent)}}.border-yellow-500\/50{border-color:#edb20080}@supports (color:color-mix(in lab,red,red)){.border-yellow-500\/50{border-color:color-mix(in oklab,var(--color-yellow-500)50%,transparent)}}.border-t-transparent{border-top-color:#0000}.bg-amber-500\/20{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/20{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.bg-bambu-dark{background-color:var(--color-bambu-dark)}.bg-bambu-dark-secondary,.bg-bambu-dark-secondary\/90{background-color:var(--color-bambu-dark-secondary)}@supports (color:color-mix(in lab,red,red)){.bg-bambu-dark-secondary\/90{background-color:color-mix(in oklab,var(--color-bambu-dark-secondary)90%,transparent)}}.bg-bambu-dark-tertiary,.bg-bambu-dark-tertiary\/50{background-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab,red,red)){.bg-bambu-dark-tertiary\/50{background-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)50%,transparent)}}.bg-bambu-dark\/30{background-color:var(--color-bambu-dark)}@supports (color:color-mix(in lab,red,red)){.bg-bambu-dark\/30{background-color:color-mix(in oklab,var(--color-bambu-dark)30%,transparent)}}.bg-bambu-dark\/50{background-color:var(--color-bambu-dark)}@supports (color:color-mix(in lab,red,red)){.bg-bambu-dark\/50{background-color:color-mix(in oklab,var(--color-bambu-dark)50%,transparent)}}.bg-bambu-dark\/80{background-color:var(--color-bambu-dark)}@supports (color:color-mix(in lab,red,red)){.bg-bambu-dark\/80{background-color:color-mix(in oklab,var(--color-bambu-dark)80%,transparent)}}.bg-bambu-dark\/90{background-color:var(--color-bambu-dark)}@supports (color:color-mix(in lab,red,red)){.bg-bambu-dark\/90{background-color:color-mix(in oklab,var(--color-bambu-dark)90%,transparent)}}.bg-bambu-gray-dark{background-color:var(--color-bambu-gray-dark)}.bg-bambu-gray\/20{background-color:var(--color-bambu-gray)}@supports (color:color-mix(in lab,red,red)){.bg-bambu-gray\/20{background-color:color-mix(in oklab,var(--color-bambu-gray)20%,transparent)}}.bg-bambu-gray\/30{background-color:var(--color-bambu-gray)}@supports (color:color-mix(in lab,red,red)){.bg-bambu-gray\/30{background-color:color-mix(in oklab,var(--color-bambu-gray)30%,transparent)}}.bg-bambu-gray\/50{background-color:var(--color-bambu-gray)}@supports (color:color-mix(in lab,red,red)){.bg-bambu-gray\/50{background-color:color-mix(in oklab,var(--color-bambu-gray)50%,transparent)}}.bg-bambu-green{background-color:var(--color-bambu-green)}.bg-bambu-green\/10{background-color:#00ae421a}@supports (color:color-mix(in lab,red,red)){.bg-bambu-green\/10{background-color:color-mix(in oklab,var(--color-bambu-green)10%,transparent)}}.bg-bambu-green\/20{background-color:#00ae4233}@supports (color:color-mix(in lab,red,red)){.bg-bambu-green\/20{background-color:color-mix(in oklab,var(--color-bambu-green)20%,transparent)}}.bg-bambu-green\/30{background-color:#00ae424d}@supports (color:color-mix(in lab,red,red)){.bg-bambu-green\/30{background-color:color-mix(in oklab,var(--color-bambu-green)30%,transparent)}}.bg-bambu-green\/50{background-color:#00ae4280}@supports (color:color-mix(in lab,red,red)){.bg-bambu-green\/50{background-color:color-mix(in oklab,var(--color-bambu-green)50%,transparent)}}.bg-bambu-green\/75{background-color:#00ae42bf}@supports (color:color-mix(in lab,red,red)){.bg-bambu-green\/75{background-color:color-mix(in oklab,var(--color-bambu-green)75%,transparent)}}.bg-black{background-color:var(--color-black)}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black)50%,transparent)}}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab,red,red)){.bg-black\/60{background-color:color-mix(in oklab,var(--color-black)60%,transparent)}}.bg-black\/70{background-color:#000000b3}@supports (color:color-mix(in lab,red,red)){.bg-black\/70{background-color:color-mix(in oklab,var(--color-black)70%,transparent)}}.bg-black\/80{background-color:#000c}@supports (color:color-mix(in lab,red,red)){.bg-black\/80{background-color:color-mix(in oklab,var(--color-black)80%,transparent)}}.bg-black\/90{background-color:#000000e6}@supports (color:color-mix(in lab,red,red)){.bg-black\/90{background-color:color-mix(in oklab,var(--color-black)90%,transparent)}}.bg-blue-400\/10{background-color:#54a2ff1a}@supports (color:color-mix(in lab,red,red)){.bg-blue-400\/10{background-color:color-mix(in oklab,var(--color-blue-400)10%,transparent)}}.bg-blue-500{background-color:var(--color-blue-500)}.bg-blue-500\/10{background-color:#3080ff1a}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/10{background-color:color-mix(in oklab,var(--color-blue-500)10%,transparent)}}.bg-blue-500\/20{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/20{background-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-200{background-color:var(--color-gray-200)}.bg-gray-300{background-color:var(--color-gray-300)}.bg-gray-400{background-color:var(--color-gray-400)}.bg-gray-400\/10{background-color:#99a1af1a}@supports (color:color-mix(in lab,red,red)){.bg-gray-400\/10{background-color:color-mix(in oklab,var(--color-gray-400)10%,transparent)}}.bg-gray-500{background-color:var(--color-gray-500)}.bg-gray-500\/20{background-color:#6a728233}@supports (color:color-mix(in lab,red,red)){.bg-gray-500\/20{background-color:color-mix(in oklab,var(--color-gray-500)20%,transparent)}}.bg-green-400{background-color:var(--color-green-400)}.bg-green-400\/10{background-color:#05df721a}@supports (color:color-mix(in lab,red,red)){.bg-green-400\/10{background-color:color-mix(in oklab,var(--color-green-400)10%,transparent)}}.bg-green-500{background-color:var(--color-green-500)}.bg-green-500\/10{background-color:#00c7581a}@supports (color:color-mix(in lab,red,red)){.bg-green-500\/10{background-color:color-mix(in oklab,var(--color-green-500)10%,transparent)}}.bg-green-500\/20{background-color:#00c75833}@supports (color:color-mix(in lab,red,red)){.bg-green-500\/20{background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.bg-orange-400\/10{background-color:#ff8b1a1a}@supports (color:color-mix(in lab,red,red)){.bg-orange-400\/10{background-color:color-mix(in oklab,var(--color-orange-400)10%,transparent)}}.bg-orange-500{background-color:var(--color-orange-500)}.bg-orange-500\/20{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/20{background-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.bg-purple-500\/20{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/20{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.bg-purple-500\/80{background-color:#ac4bffcc}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/80{background-color:color-mix(in oklab,var(--color-purple-500)80%,transparent)}}.bg-red-400{background-color:var(--color-red-400)}.bg-red-400\/10{background-color:#ff65681a}@supports (color:color-mix(in lab,red,red)){.bg-red-400\/10{background-color:color-mix(in oklab,var(--color-red-400)10%,transparent)}}.bg-red-500{background-color:var(--color-red-500)}.bg-red-500\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/10{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.bg-red-500\/15{background-color:#fb2c3626}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/15{background-color:color-mix(in oklab,var(--color-red-500)15%,transparent)}}.bg-red-500\/20{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/20{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.bg-red-500\/30{background-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/30{background-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.bg-red-500\/80{background-color:#fb2c36cc}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/80{background-color:color-mix(in oklab,var(--color-red-500)80%,transparent)}}.bg-red-600{background-color:var(--color-red-600)}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-yellow-100{background-color:var(--color-yellow-100)}.bg-yellow-400{background-color:var(--color-yellow-400)}.bg-yellow-400\/10{background-color:#fac8001a}@supports (color:color-mix(in lab,red,red)){.bg-yellow-400\/10{background-color:color-mix(in oklab,var(--color-yellow-400)10%,transparent)}}.bg-yellow-400\/20{background-color:#fac80033}@supports (color:color-mix(in lab,red,red)){.bg-yellow-400\/20{background-color:color-mix(in oklab,var(--color-yellow-400)20%,transparent)}}.bg-yellow-500{background-color:var(--color-yellow-500)}.bg-yellow-500\/10{background-color:#edb2001a}@supports (color:color-mix(in lab,red,red)){.bg-yellow-500\/10{background-color:color-mix(in oklab,var(--color-yellow-500)10%,transparent)}}.bg-yellow-500\/20{background-color:#edb20033}@supports (color:color-mix(in lab,red,red)){.bg-yellow-500\/20{background-color:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.bg-yellow-600{background-color:var(--color-yellow-600)}.fill-yellow-400{fill:var(--color-yellow-400)}.object-contain{object-fit:contain}.object-cover{object-fit:cover}.object-left{object-position:left}.p-0{padding:calc(var(--spacing)*0)}.p-1{padding:calc(var(--spacing)*1)}.p-1\.5{padding:calc(var(--spacing)*1.5)}.p-2{padding:calc(var(--spacing)*2)}.p-2\.5{padding:calc(var(--spacing)*2.5)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-5{padding:calc(var(--spacing)*5)}.p-6{padding:calc(var(--spacing)*6)}.p-8{padding:calc(var(--spacing)*8)}.p-12{padding:calc(var(--spacing)*12)}.px-1{padding-inline:calc(var(--spacing)*1)}.px-1\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-2\.5{padding-inline:calc(var(--spacing)*2.5)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-3\.5{padding-inline:calc(var(--spacing)*3.5)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-5{padding-inline:calc(var(--spacing)*5)}.px-6{padding-inline:calc(var(--spacing)*6)}.px-7{padding-inline:calc(var(--spacing)*7)}.px-\[18px\]{padding-inline:18px}.py-0\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-2\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.py-8{padding-block:calc(var(--spacing)*8)}.py-12{padding-block:calc(var(--spacing)*12)}.py-\[3px\]{padding-block:3px}.pt-0{padding-top:calc(var(--spacing)*0)}.pt-0\.5{padding-top:calc(var(--spacing)*.5)}.pt-2{padding-top:calc(var(--spacing)*2)}.pt-3{padding-top:calc(var(--spacing)*3)}.pt-4{padding-top:calc(var(--spacing)*4)}.pr-3{padding-right:calc(var(--spacing)*3)}.pr-4{padding-right:calc(var(--spacing)*4)}.pr-5{padding-right:calc(var(--spacing)*5)}.pr-8{padding-right:calc(var(--spacing)*8)}.pb-2{padding-bottom:calc(var(--spacing)*2)}.pb-4{padding-bottom:calc(var(--spacing)*4)}.pb-\[5px\]{padding-bottom:5px}.pl-2{padding-left:calc(var(--spacing)*2)}.pl-4{padding-left:calc(var(--spacing)*4)}.pl-8{padding-left:calc(var(--spacing)*8)}.pl-10{padding-left:calc(var(--spacing)*10)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.text-amber-400{color:var(--color-amber-400)}.text-bambu-dark-tertiary{color:var(--color-bambu-dark-tertiary)}.text-bambu-gray{color:var(--color-bambu-gray)}.text-bambu-gray-light{color:var(--color-bambu-gray-light)}.text-bambu-gray\/30{color:var(--color-bambu-gray)}@supports (color:color-mix(in lab,red,red)){.text-bambu-gray\/30{color:color-mix(in oklab,var(--color-bambu-gray)30%,transparent)}}.text-bambu-gray\/50{color:var(--color-bambu-gray)}@supports (color:color-mix(in lab,red,red)){.text-bambu-gray\/50{color:color-mix(in oklab,var(--color-bambu-gray)50%,transparent)}}.text-bambu-gray\/70{color:var(--color-bambu-gray)}@supports (color:color-mix(in lab,red,red)){.text-bambu-gray\/70{color:color-mix(in oklab,var(--color-bambu-gray)70%,transparent)}}.text-bambu-green{color:var(--color-bambu-green)}.text-blue-400{color:var(--color-blue-400)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-900{color:var(--color-gray-900)}.text-green-400{color:var(--color-green-400)}.text-green-500{color:var(--color-green-500)}.text-orange-400{color:var(--color-orange-400)}.text-purple-400{color:var(--color-purple-400)}.text-red-400{color:var(--color-red-400)}.text-red-500{color:var(--color-red-500)}.text-white{color:var(--color-white)}.text-white\/80{color:#fffc}@supports (color:color-mix(in lab,red,red)){.text-white\/80{color:color-mix(in oklab,var(--color-white)80%,transparent)}}.text-yellow-400{color:var(--color-yellow-400)}.text-yellow-500{color:var(--color-yellow-500)}.text-yellow-600{color:var(--color-yellow-600)}.capitalize{text-transform:capitalize}.uppercase{text-transform:uppercase}.italic{font-style:italic}.underline{text-decoration-line:underline}.placeholder-bambu-gray::placeholder,.placeholder-bambu-gray\/50::placeholder{color:var(--color-bambu-gray)}@supports (color:color-mix(in lab,red,red)){.placeholder-bambu-gray\/50::placeholder{color:color-mix(in oklab,var(--color-bambu-gray)50%,transparent)}}.accent-bambu-green{accent-color:var(--color-bambu-green)}.opacity-0{opacity:0}.opacity-20{opacity:.2}.opacity-30{opacity:.3}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-80{opacity:.8}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-inner{--tw-shadow:inset 0 2px 4px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring,.ring-1{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-bambu-green{--tw-ring-color:var(--color-bambu-green)}.ring-white{--tw-ring-color:var(--color-white)}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.invert{--tw-invert:invert(100%);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}@media(hover:hover){.group-hover\:text-bambu-green:is(:where(.group):hover *){color:var(--color-bambu-green)}.group-hover\:opacity-50:is(:where(.group):hover *){opacity:.5}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.peer-checked\:bg-bambu-green:is(:where(.peer):checked~*){background-color:var(--color-bambu-green)}.peer-focus\:outline-none:is(:where(.peer):focus~*){--tw-outline-style:none;outline-style:none}.before\:absolute:before{content:var(--tw-content);position:absolute}.before\:top-0:before{content:var(--tw-content);top:calc(var(--spacing)*0)}.before\:right-0:before{content:var(--tw-content);right:calc(var(--spacing)*0)}.before\:left-0:before{content:var(--tw-content);left:calc(var(--spacing)*0)}.before\:h-0\.5:before{content:var(--tw-content);height:calc(var(--spacing)*.5)}.before\:bg-bambu-green:before{content:var(--tw-content);background-color:var(--color-bambu-green)}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:top-\[2px\]:after{content:var(--tw-content);top:2px}.after\:left-\[2px\]:after{content:var(--tw-content);left:2px}.after\:h-4:after{content:var(--tw-content);height:calc(var(--spacing)*4)}.after\:h-5:after{content:var(--tw-content);height:calc(var(--spacing)*5)}.after\:w-4:after{content:var(--tw-content);width:calc(var(--spacing)*4)}.after\:w-5:after{content:var(--tw-content);width:calc(var(--spacing)*5)}.after\:rounded-full:after{content:var(--tw-content);border-radius:3.40282e38px}.after\:bg-white:after{content:var(--tw-content);background-color:var(--color-white)}.after\:transition-all:after{content:var(--tw-content);transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.after\:content-\[\'\'\]:after{--tw-content:"";content:var(--tw-content)}.peer-checked\:after\:translate-x-full:is(:where(.peer):checked~*):after{content:var(--tw-content);--tw-translate-x:100%;translate:var(--tw-translate-x)var(--tw-translate-y)}.peer-checked\:after\:border-white:is(:where(.peer):checked~*):after{content:var(--tw-content);border-color:var(--color-white)}@media(hover:hover){.hover\:border-bambu-gray:hover{border-color:var(--color-bambu-gray)}.hover\:border-bambu-green:hover{border-color:var(--color-bambu-green)}.hover\:border-white\/40:hover{border-color:#fff6}@supports (color:color-mix(in lab,red,red)){.hover\:border-white\/40:hover{border-color:color-mix(in oklab,var(--color-white)40%,transparent)}}.hover\:bg-bambu-dark:hover{background-color:var(--color-bambu-dark)}.hover\:bg-bambu-dark-secondary:hover{background-color:var(--color-bambu-dark-secondary)}.hover\:bg-bambu-dark-tertiary:hover,.hover\:bg-bambu-dark-tertiary\/30:hover{background-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-bambu-dark-tertiary\/30:hover{background-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)30%,transparent)}}.hover\:bg-bambu-dark-tertiary\/50:hover{background-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-bambu-dark-tertiary\/50:hover{background-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)50%,transparent)}}.hover\:bg-bambu-dark-tertiary\/70:hover{background-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-bambu-dark-tertiary\/70:hover{background-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)70%,transparent)}}.hover\:bg-bambu-dark-tertiary\/80:hover{background-color:var(--color-bambu-dark-tertiary)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-bambu-dark-tertiary\/80:hover{background-color:color-mix(in oklab,var(--color-bambu-dark-tertiary)80%,transparent)}}.hover\:bg-bambu-gray-dark:hover{background-color:var(--color-bambu-gray-dark)}.hover\:bg-bambu-green-dark:hover{background-color:var(--color-bambu-green-dark)}.hover\:bg-bambu-green-light:hover{background-color:var(--color-bambu-green-light)}.hover\:bg-bambu-green\/20:hover{background-color:#00ae4233}@supports (color:color-mix(in lab,red,red)){.hover\:bg-bambu-green\/20:hover{background-color:color-mix(in oklab,var(--color-bambu-green)20%,transparent)}}.hover\:bg-bambu-green\/30:hover{background-color:#00ae424d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-bambu-green\/30:hover{background-color:color-mix(in oklab,var(--color-bambu-green)30%,transparent)}}.hover\:bg-bambu-green\/90:hover{background-color:#00ae42e6}@supports (color:color-mix(in lab,red,red)){.hover\:bg-bambu-green\/90:hover{background-color:color-mix(in oklab,var(--color-bambu-green)90%,transparent)}}.hover\:bg-black\/20:hover{background-color:#0003}@supports (color:color-mix(in lab,red,red)){.hover\:bg-black\/20:hover{background-color:color-mix(in oklab,var(--color-black)20%,transparent)}}.hover\:bg-black\/70:hover{background-color:#000000b3}@supports (color:color-mix(in lab,red,red)){.hover\:bg-black\/70:hover{background-color:color-mix(in oklab,var(--color-black)70%,transparent)}}.hover\:bg-black\/80:hover{background-color:#000c}@supports (color:color-mix(in lab,red,red)){.hover\:bg-black\/80:hover{background-color:color-mix(in oklab,var(--color-black)80%,transparent)}}.hover\:bg-gray-50:hover{background-color:var(--color-gray-50)}.hover\:bg-gray-100:hover{background-color:var(--color-gray-100)}.hover\:bg-gray-300:hover{background-color:var(--color-gray-300)}.hover\:bg-gray-400:hover{background-color:var(--color-gray-400)}.hover\:bg-gray-700:hover{background-color:var(--color-gray-700)}.hover\:bg-red-400\/10:hover{background-color:#ff65681a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-400\/10:hover{background-color:color-mix(in oklab,var(--color-red-400)10%,transparent)}}.hover\:bg-red-500:hover{background-color:var(--color-red-500)}.hover\:bg-red-500\/10:hover{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/10:hover{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.hover\:bg-red-500\/30:hover{background-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/30:hover{background-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.hover\:bg-red-600:hover{background-color:var(--color-red-600)}.hover\:bg-red-700:hover{background-color:var(--color-red-700)}.hover\:bg-yellow-500\/30:hover{background-color:#edb2004d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-yellow-500\/30:hover{background-color:color-mix(in oklab,var(--color-yellow-500)30%,transparent)}}.hover\:bg-yellow-600:hover{background-color:var(--color-yellow-600)}.hover\:bg-yellow-700:hover{background-color:var(--color-yellow-700)}.hover\:text-bambu-green:hover{color:var(--color-bambu-green)}.hover\:text-bambu-green\/80:hover{color:#00ae42cc}@supports (color:color-mix(in lab,red,red)){.hover\:text-bambu-green\/80:hover{color:color-mix(in oklab,var(--color-bambu-green)80%,transparent)}}.hover\:text-red-300:hover{color:var(--color-red-300)}.hover\:text-red-400:hover{color:var(--color-red-400)}.hover\:text-white:hover{color:var(--color-white)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-70:hover{opacity:.7}.hover\:opacity-80:hover{opacity:.8}}.focus\:border-bambu-green:focus{border-color:var(--color-bambu-green)}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-bambu-gray:focus{--tw-ring-color:var(--color-bambu-gray)}.focus\:ring-bambu-green:focus{--tw-ring-color:var(--color-bambu-green)}.focus\:ring-red-500:focus{--tw-ring-color:var(--color-red-500)}.focus\:ring-offset-0:focus{--tw-ring-offset-width:0px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus\:ring-offset-bambu-dark:focus{--tw-ring-offset-color:var(--color-bambu-dark)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.active\:cursor-grabbing:active{cursor:grabbing}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:opacity-60:disabled{opacity:.6}@media(hover:hover){.disabled\:hover\:bg-bambu-dark-secondary:disabled:hover{background-color:var(--color-bambu-dark-secondary)}.disabled\:hover\:text-bambu-gray:disabled:hover{color:var(--color-bambu-gray)}}@media(min-width:40rem){.sm\:inline{display:inline}.sm\:h-4{height:calc(var(--spacing)*4)}.sm\:w-4{width:calc(var(--spacing)*4)}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:p-1\.5{padding:calc(var(--spacing)*1.5)}}@media(min-width:48rem){.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}}@media(min-width:64rem){.lg\:w-80{width:calc(var(--spacing)*80)}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:flex-row{flex-direction:row}}@media(min-width:80rem){.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}.dark\:border-bambu-dark-tertiary:where(.dark,.dark *){border-color:var(--color-bambu-dark-tertiary)}.dark\:border-gray-500:where(.dark,.dark *){border-color:var(--color-gray-500)}.dark\:bg-bambu-dark:where(.dark,.dark *){background-color:var(--color-bambu-dark)}.dark\:bg-bambu-dark-secondary:where(.dark,.dark *){background-color:var(--color-bambu-dark-secondary)}.dark\:bg-bambu-dark-tertiary:where(.dark,.dark *){background-color:var(--color-bambu-dark-tertiary)}.dark\:bg-yellow-900\/20:where(.dark,.dark *){background-color:#733e0a33}@supports (color:color-mix(in lab,red,red)){.dark\:bg-yellow-900\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-yellow-900)20%,transparent)}}.dark\:text-bambu-gray:where(.dark,.dark *){color:var(--color-bambu-gray)}.dark\:text-gray-400:where(.dark,.dark *){color:var(--color-gray-400)}.dark\:text-gray-500:where(.dark,.dark *){color:var(--color-gray-500)}.dark\:text-white:where(.dark,.dark *){color:var(--color-white)}.dark\:text-yellow-400:where(.dark,.dark *){color:var(--color-yellow-400)}@media(hover:hover){.dark\:hover\:bg-bambu-dark-tertiary:where(.dark,.dark *):hover{background-color:var(--color-bambu-dark-tertiary)}}.\[\&\:\:-moz-range-thumb\]\:h-4::-moz-range-thumb{height:calc(var(--spacing)*4)}.\[\&\:\:-moz-range-thumb\]\:w-4::-moz-range-thumb{width:calc(var(--spacing)*4)}.\[\&\:\:-moz-range-thumb\]\:cursor-pointer::-moz-range-thumb{cursor:pointer}.\[\&\:\:-moz-range-thumb\]\:rounded-full::-moz-range-thumb{border-radius:3.40282e38px}.\[\&\:\:-moz-range-thumb\]\:border-0::-moz-range-thumb{border-style:var(--tw-border-style);border-width:0}.\[\&\:\:-moz-range-thumb\]\:bg-bambu-green::-moz-range-thumb{background-color:var(--color-bambu-green)}.\[\&\:\:-webkit-slider-thumb\]\:h-3::-webkit-slider-thumb{height:calc(var(--spacing)*3)}.\[\&\:\:-webkit-slider-thumb\]\:h-4::-webkit-slider-thumb{height:calc(var(--spacing)*4)}.\[\&\:\:-webkit-slider-thumb\]\:w-3::-webkit-slider-thumb{width:calc(var(--spacing)*3)}.\[\&\:\:-webkit-slider-thumb\]\:w-4::-webkit-slider-thumb{width:calc(var(--spacing)*4)}.\[\&\:\:-webkit-slider-thumb\]\:cursor-pointer::-webkit-slider-thumb{cursor:pointer}.\[\&\:\:-webkit-slider-thumb\]\:appearance-none::-webkit-slider-thumb{appearance:none}.\[\&\:\:-webkit-slider-thumb\]\:rounded-full::-webkit-slider-thumb{border-radius:3.40282e38px}.\[\&\:\:-webkit-slider-thumb\]\:bg-bambu-green::-webkit-slider-thumb{background-color:var(--color-bambu-green)}}:root{--bg-primary:#f5f5f5;--bg-secondary:#fff;--bg-tertiary:#e5e5e5;--text-primary:#1a1a1a;--text-secondary:#4a4a4a;--text-muted:#6b6b6b;--text-tertiary:gray;--border-color:#d4d4d4;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:Inter,system-ui,sans-serif;font-weight:400;line-height:1.5}.dark{--bg-primary:#1a1a1a;--bg-secondary:#2d2d2d;--bg-tertiary:#3d3d3d;--text-primary:#fff;--text-secondary:#a0a0a0;--text-muted:gray;--text-tertiary:#4a4a4a;--border-color:#3d3d3d}body{background-color:var(--bg-primary);color:var(--text-primary);min-height:100vh;margin:0;transition:background-color .2s,color .2s}#root{min-height:100vh}.text-white{color:var(--text-primary)}.bg-bambu-dark,.bg-bambu-dark-secondary,.bg-bambu-dark-tertiary,.border-bambu-dark-tertiary{transition:background-color .2s,border-color .2s}@keyframes slide-in{0%{opacity:0;transform:translate(100%)}to{opacity:1;transform:translate(0)}}.animate-slide-in{animation:.2s ease-out slide-in}.icon-theme{opacity:.5}.dark .icon-theme{filter:invert();opacity:.4}.icon-green{filter:invert(48%)sepia(89%)saturate(459%)hue-rotate(93deg)brightness(95%)contrast(92%);opacity:1}.icon-heating{filter:invert(50%)sepia()saturate(1000%)hue-rotate(360deg)brightness()contrast();opacity:1}.dark .jogpad-theme{filter:brightness(.35)contrast(1.2)}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-content:""}}}
diff --git a/static/index.html b/static/index.html
index e07125844..2ab8a4db0 100644
--- a/static/index.html
+++ b/static/index.html
@@ -7,8 +7,8 @@
-
-
+
+