mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-15 17:12:59 -04:00
126 lines
494 KiB
JavaScript
126 lines
494 KiB
JavaScript
(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const f of document.querySelectorAll('link[rel="modulepreload"]'))r(f);new MutationObserver(f=>{for(const d of f)if(d.type==="childList")for(const h of d.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&r(h)}).observe(document,{childList:!0,subtree:!0});function i(f){const d={};return f.integrity&&(d.integrity=f.integrity),f.referrerPolicy&&(d.referrerPolicy=f.referrerPolicy),f.crossOrigin==="use-credentials"?d.credentials="include":f.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function r(f){if(f.ep)return;f.ep=!0;const d=i(f);fetch(f.href,d)}})();function _y(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var ku={exports:{}},ni={};var K0;function Dy(){if(K0)return ni;K0=1;var a=Symbol.for("react.transitional.element"),l=Symbol.for("react.fragment");function i(r,f,d){var h=null;if(d!==void 0&&(h=""+d),f.key!==void 0&&(h=""+f.key),"key"in f){d={};for(var p in f)p!=="key"&&(d[p]=f[p])}else d=f;return f=d.ref,{$$typeof:a,type:r,key:h,ref:f!==void 0?f:null,props:d}}return ni.Fragment=l,ni.jsx=i,ni.jsxs=i,ni}var F0;function Oy(){return F0||(F0=1,ku.exports=Dy()),ku.exports}var o=Oy(),Tu={exports:{}},be={};var Z0;function By(){if(Z0)return be;Z0=1;var a=Symbol.for("react.transitional.element"),l=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),h=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),v=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),N=Symbol.iterator;function M(w){return w===null||typeof w!="object"?null:(w=N&&w[N]||w["@@iterator"],typeof w=="function"?w:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,j={};function R(w,z,P){this.props=w,this.context=z,this.refs=j,this.updater=P||C}R.prototype.isReactComponent={},R.prototype.setState=function(w,z){if(typeof w!="object"&&typeof w!="function"&&w!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,w,z,"setState")},R.prototype.forceUpdate=function(w){this.updater.enqueueForceUpdate(this,w,"forceUpdate")};function A(){}A.prototype=R.prototype;function T(w,z,P){this.props=w,this.context=z,this.refs=j,this.updater=P||C}var O=T.prototype=new A;O.constructor=T,E(O,R.prototype),O.isPureReactComponent=!0;var L=Array.isArray;function Z(){}var D={H:null,A:null,T:null,S:null},G=Object.prototype.hasOwnProperty;function Y(w,z,P){var ae=P.ref;return{$$typeof:a,type:w,key:z,ref:ae!==void 0?ae:null,props:P}}function F(w,z){return Y(w.type,z,w.props)}function Q(w){return typeof w=="object"&&w!==null&&w.$$typeof===a}function ne(w){var z={"=":"=0",":":"=2"};return"$"+w.replace(/[=:]/g,function(P){return z[P]})}var ce=/\/+/g;function pe(w,z){return typeof w=="object"&&w!==null&&w.key!=null?ne(""+w.key):z.toString(36)}function V(w){switch(w.status){case"fulfilled":return w.value;case"rejected":throw w.reason;default:switch(typeof w.status=="string"?w.then(Z,Z):(w.status="pending",w.then(function(z){w.status==="pending"&&(w.status="fulfilled",w.value=z)},function(z){w.status==="pending"&&(w.status="rejected",w.reason=z)})),w.status){case"fulfilled":return w.value;case"rejected":throw w.reason}}throw w}function q(w,z,P,ae,le){var se=typeof w;(se==="undefined"||se==="boolean")&&(w=null);var oe=!1;if(w===null)oe=!0;else switch(se){case"bigint":case"string":case"number":oe=!0;break;case"object":switch(w.$$typeof){case a:case l:oe=!0;break;case y:return oe=w._init,q(oe(w._payload),z,P,ae,le)}}if(oe)return le=le(w),oe=ae===""?"."+pe(w,0):ae,L(le)?(P="",oe!=null&&(P=oe.replace(ce,"$&/")+"/"),q(le,z,P,"",function(Oe){return Oe})):le!=null&&(Q(le)&&(le=F(le,P+(le.key==null||w&&w.key===le.key?"":(""+le.key).replace(ce,"$&/")+"/")+oe)),z.push(le)),1;oe=0;var ve=ae===""?".":ae+":";if(L(w))for(var he=0;he<w.length;he++)ae=w[he],se=ve+pe(ae,he),oe+=q(ae,z,P,se,le);else if(he=M(w),typeof he=="function")for(w=he.call(w),he=0;!(ae=w.next()).done;)ae=ae.value,se=ve+pe(ae,he++),oe+=q(ae,z,P,se,le);else if(se==="object"){if(typeof w.then=="function")return q(V(w),z,P,ae,le);throw z=String(w),Error("Objects are not valid as a React child (found: "+(z==="[object Object]"?"object with keys {"+Object.keys(w).join(", ")+"}":z)+"). If you meant to render a collection of children, use an array instead.")}return oe}function X(w,z,P){if(w==null)return w;var ae=[],le=0;return q(w,ae,"","",function(se){return z.call(P,se,le++)}),ae}function W(w){if(w._status===-1){var z=w._result;z=z(),z.then(function(P){(w._status===0||w._status===-1)&&(w._status=1,w._result=P)},function(P){(w._status===0||w._status===-1)&&(w._status=2,w._result=P)}),w._status===-1&&(w._status=0,w._result=z)}if(w._status===1)return w._result.default;throw w._result}var re=typeof reportError=="function"?reportError:function(w){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var z=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof w=="object"&&w!==null&&typeof w.message=="string"?String(w.message):String(w),error:w});if(!window.dispatchEvent(z))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",w);return}console.error(w)},de={map:X,forEach:function(w,z,P){X(w,function(){z.apply(this,arguments)},P)},count:function(w){var z=0;return X(w,function(){z++}),z},toArray:function(w){return X(w,function(z){return z})||[]},only:function(w){if(!Q(w))throw Error("React.Children.only expected to receive a single React element child.");return w}};return be.Activity=b,be.Children=de,be.Component=R,be.Fragment=i,be.Profiler=f,be.PureComponent=T,be.StrictMode=r,be.Suspense=x,be.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=D,be.__COMPILER_RUNTIME={__proto__:null,c:function(w){return D.H.useMemoCache(w)}},be.cache=function(w){return function(){return w.apply(null,arguments)}},be.cacheSignal=function(){return null},be.cloneElement=function(w,z,P){if(w==null)throw Error("The argument must be a React element, but you passed "+w+".");var ae=E({},w.props),le=w.key;if(z!=null)for(se in z.key!==void 0&&(le=""+z.key),z)!G.call(z,se)||se==="key"||se==="__self"||se==="__source"||se==="ref"&&z.ref===void 0||(ae[se]=z[se]);var se=arguments.length-2;if(se===1)ae.children=P;else if(1<se){for(var oe=Array(se),ve=0;ve<se;ve++)oe[ve]=arguments[ve+2];ae.children=oe}return Y(w.type,le,ae)},be.createContext=function(w){return w={$$typeof:h,_currentValue:w,_currentValue2:w,_threadCount:0,Provider:null,Consumer:null},w.Provider=w,w.Consumer={$$typeof:d,_context:w},w},be.createElement=function(w,z,P){var ae,le={},se=null;if(z!=null)for(ae in z.key!==void 0&&(se=""+z.key),z)G.call(z,ae)&&ae!=="key"&&ae!=="__self"&&ae!=="__source"&&(le[ae]=z[ae]);var oe=arguments.length-2;if(oe===1)le.children=P;else if(1<oe){for(var ve=Array(oe),he=0;he<oe;he++)ve[he]=arguments[he+2];le.children=ve}if(w&&w.defaultProps)for(ae in oe=w.defaultProps,oe)le[ae]===void 0&&(le[ae]=oe[ae]);return Y(w,se,le)},be.createRef=function(){return{current:null}},be.forwardRef=function(w){return{$$typeof:p,render:w}},be.isValidElement=Q,be.lazy=function(w){return{$$typeof:y,_payload:{_status:-1,_result:w},_init:W}},be.memo=function(w,z){return{$$typeof:v,type:w,compare:z===void 0?null:z}},be.startTransition=function(w){var z=D.T,P={};D.T=P;try{var ae=w(),le=D.S;le!==null&&le(P,ae),typeof ae=="object"&&ae!==null&&typeof ae.then=="function"&&ae.then(Z,re)}catch(se){re(se)}finally{z!==null&&P.types!==null&&(z.types=P.types),D.T=z}},be.unstable_useCacheRefresh=function(){return D.H.useCacheRefresh()},be.use=function(w){return D.H.use(w)},be.useActionState=function(w,z,P){return D.H.useActionState(w,z,P)},be.useCallback=function(w,z){return D.H.useCallback(w,z)},be.useContext=function(w){return D.H.useContext(w)},be.useDebugValue=function(){},be.useDeferredValue=function(w,z){return D.H.useDeferredValue(w,z)},be.useEffect=function(w,z){return D.H.useEffect(w,z)},be.useEffectEvent=function(w){return D.H.useEffectEvent(w)},be.useId=function(){return D.H.useId()},be.useImperativeHandle=function(w,z,P){return D.H.useImperativeHandle(w,z,P)},be.useInsertionEffect=function(w,z){return D.H.useInsertionEffect(w,z)},be.useLayoutEffect=function(w,z){return D.H.useLayoutEffect(w,z)},be.useMemo=function(w,z){return D.H.useMemo(w,z)},be.useOptimistic=function(w,z){return D.H.useOptimistic(w,z)},be.useReducer=function(w,z,P){return D.H.useReducer(w,z,P)},be.useRef=function(w){return D.H.useRef(w)},be.useState=function(w){return D.H.useState(w)},be.useSyncExternalStore=function(w,z,P){return D.H.useSyncExternalStore(w,z,P)},be.useTransition=function(){return D.H.useTransition()},be.version="19.2.0",be}var J0;function Ef(){return J0||(J0=1,Tu.exports=By()),Tu.exports}var m=Ef();const dl=_y(m);var _u={exports:{}},ai={},Du={exports:{}},Ou={};var I0;function Ly(){return I0||(I0=1,(function(a){function l(q,X){var W=q.length;q.push(X);e:for(;0<W;){var re=W-1>>>1,de=q[re];if(0<f(de,X))q[re]=X,q[W]=de,W=re;else break e}}function i(q){return q.length===0?null:q[0]}function r(q){if(q.length===0)return null;var X=q[0],W=q.pop();if(W!==X){q[0]=W;e:for(var re=0,de=q.length,w=de>>>1;re<w;){var z=2*(re+1)-1,P=q[z],ae=z+1,le=q[ae];if(0>f(P,W))ae<de&&0>f(le,P)?(q[re]=le,q[ae]=W,re=ae):(q[re]=P,q[z]=W,re=z);else if(ae<de&&0>f(le,W))q[re]=le,q[ae]=W,re=ae;else break e}}return X}function f(q,X){var W=q.sortIndex-X.sortIndex;return W!==0?W:q.id-X.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;a.unstable_now=function(){return d.now()}}else{var h=Date,p=h.now();a.unstable_now=function(){return h.now()-p}}var x=[],v=[],y=1,b=null,N=3,M=!1,C=!1,E=!1,j=!1,R=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;function O(q){for(var X=i(v);X!==null;){if(X.callback===null)r(v);else if(X.startTime<=q)r(v),X.sortIndex=X.expirationTime,l(x,X);else break;X=i(v)}}function L(q){if(E=!1,O(q),!C)if(i(x)!==null)C=!0,Z||(Z=!0,ne());else{var X=i(v);X!==null&&V(L,X.startTime-q)}}var Z=!1,D=-1,G=5,Y=-1;function F(){return j?!0:!(a.unstable_now()-Y<G)}function Q(){if(j=!1,Z){var q=a.unstable_now();Y=q;var X=!0;try{e:{C=!1,E&&(E=!1,A(D),D=-1),M=!0;var W=N;try{t:{for(O(q),b=i(x);b!==null&&!(b.expirationTime>q&&F());){var re=b.callback;if(typeof re=="function"){b.callback=null,N=b.priorityLevel;var de=re(b.expirationTime<=q);if(q=a.unstable_now(),typeof de=="function"){b.callback=de,O(q),X=!0;break t}b===i(x)&&r(x),O(q)}else r(x);b=i(x)}if(b!==null)X=!0;else{var w=i(v);w!==null&&V(L,w.startTime-q),X=!1}}break e}finally{b=null,N=W,M=!1}X=void 0}}finally{X?ne():Z=!1}}}var ne;if(typeof T=="function")ne=function(){T(Q)};else if(typeof MessageChannel<"u"){var ce=new MessageChannel,pe=ce.port2;ce.port1.onmessage=Q,ne=function(){pe.postMessage(null)}}else ne=function(){R(Q,0)};function V(q,X){D=R(function(){q(a.unstable_now())},X)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(q){q.callback=null},a.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):G=0<q?Math.floor(1e3/q):5},a.unstable_getCurrentPriorityLevel=function(){return N},a.unstable_next=function(q){switch(N){case 1:case 2:case 3:var X=3;break;default:X=N}var W=N;N=X;try{return q()}finally{N=W}},a.unstable_requestPaint=function(){j=!0},a.unstable_runWithPriority=function(q,X){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var W=N;N=q;try{return X()}finally{N=W}},a.unstable_scheduleCallback=function(q,X,W){var re=a.unstable_now();switch(typeof W=="object"&&W!==null?(W=W.delay,W=typeof W=="number"&&0<W?re+W:re):W=re,q){case 1:var de=-1;break;case 2:de=250;break;case 5:de=1073741823;break;case 4:de=1e4;break;default:de=5e3}return de=W+de,q={id:y++,callback:X,priorityLevel:q,startTime:W,expirationTime:de,sortIndex:-1},W>re?(q.sortIndex=W,l(v,q),i(x)===null&&q===i(v)&&(E?(A(D),D=-1):E=!0,V(L,W-re))):(q.sortIndex=de,l(x,q),C||M||(C=!0,Z||(Z=!0,ne()))),q},a.unstable_shouldYield=F,a.unstable_wrapCallback=function(q){var X=N;return function(){var W=N;N=X;try{return q.apply(this,arguments)}finally{N=W}}}})(Ou)),Ou}var W0;function zy(){return W0||(W0=1,Du.exports=Ly()),Du.exports}var Bu={exports:{}},Nt={};var P0;function Uy(){if(P0)return Nt;P0=1;var a=Ef();function l(x){var v="https://react.dev/errors/"+x;if(1<arguments.length){v+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)v+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+x+"; visit "+v+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var r={d:{f:i,r:function(){throw Error(l(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},f=Symbol.for("react.portal");function d(x,v,y){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:f,key:b==null?null:""+b,children:x,containerInfo:v,implementation:y}}var h=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function p(x,v){if(x==="font")return"";if(typeof v=="string")return v==="use-credentials"?v:""}return Nt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Nt.createPortal=function(x,v){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!v||v.nodeType!==1&&v.nodeType!==9&&v.nodeType!==11)throw Error(l(299));return d(x,v,null,y)},Nt.flushSync=function(x){var v=h.T,y=r.p;try{if(h.T=null,r.p=2,x)return x()}finally{h.T=v,r.p=y,r.d.f()}},Nt.preconnect=function(x,v){typeof x=="string"&&(v?(v=v.crossOrigin,v=typeof v=="string"?v==="use-credentials"?v:"":void 0):v=null,r.d.C(x,v))},Nt.prefetchDNS=function(x){typeof x=="string"&&r.d.D(x)},Nt.preinit=function(x,v){if(typeof x=="string"&&v&&typeof v.as=="string"){var y=v.as,b=p(y,v.crossOrigin),N=typeof v.integrity=="string"?v.integrity:void 0,M=typeof v.fetchPriority=="string"?v.fetchPriority:void 0;y==="style"?r.d.S(x,typeof v.precedence=="string"?v.precedence:void 0,{crossOrigin:b,integrity:N,fetchPriority:M}):y==="script"&&r.d.X(x,{crossOrigin:b,integrity:N,fetchPriority:M,nonce:typeof v.nonce=="string"?v.nonce:void 0})}},Nt.preinitModule=function(x,v){if(typeof x=="string")if(typeof v=="object"&&v!==null){if(v.as==null||v.as==="script"){var y=p(v.as,v.crossOrigin);r.d.M(x,{crossOrigin:y,integrity:typeof v.integrity=="string"?v.integrity:void 0,nonce:typeof v.nonce=="string"?v.nonce:void 0})}}else v==null&&r.d.M(x)},Nt.preload=function(x,v){if(typeof x=="string"&&typeof v=="object"&&v!==null&&typeof v.as=="string"){var y=v.as,b=p(y,v.crossOrigin);r.d.L(x,y,{crossOrigin:b,integrity:typeof v.integrity=="string"?v.integrity:void 0,nonce:typeof v.nonce=="string"?v.nonce:void 0,type:typeof v.type=="string"?v.type:void 0,fetchPriority:typeof v.fetchPriority=="string"?v.fetchPriority:void 0,referrerPolicy:typeof v.referrerPolicy=="string"?v.referrerPolicy:void 0,imageSrcSet:typeof v.imageSrcSet=="string"?v.imageSrcSet:void 0,imageSizes:typeof v.imageSizes=="string"?v.imageSizes:void 0,media:typeof v.media=="string"?v.media:void 0})}},Nt.preloadModule=function(x,v){if(typeof x=="string")if(v){var y=p(v.as,v.crossOrigin);r.d.m(x,{as:typeof v.as=="string"&&v.as!=="script"?v.as:void 0,crossOrigin:y,integrity:typeof v.integrity=="string"?v.integrity:void 0})}else r.d.m(x)},Nt.requestFormReset=function(x){r.d.r(x)},Nt.unstable_batchedUpdates=function(x,v){return x(v)},Nt.useFormState=function(x,v,y){return h.H.useFormState(x,v,y)},Nt.useFormStatus=function(){return h.H.useHostTransitionStatus()},Nt.version="19.2.0",Nt}var ep;function Hy(){if(ep)return Bu.exports;ep=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(l){console.error(l)}}return a(),Bu.exports=Uy(),Bu.exports}var tp;function Vy(){if(tp)return ai;tp=1;var a=zy(),l=Ef(),i=Hy();function r(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function f(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function d(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function h(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function p(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function x(e){if(d(e)!==e)throw Error(r(188))}function v(e){var t=e.alternate;if(!t){if(t=d(e),t===null)throw Error(r(188));return t!==e?null:e}for(var n=e,s=t;;){var c=n.return;if(c===null)break;var u=c.alternate;if(u===null){if(s=c.return,s!==null){n=s;continue}break}if(c.child===u.child){for(u=c.child;u;){if(u===n)return x(c),e;if(u===s)return x(c),t;u=u.sibling}throw Error(r(188))}if(n.return!==s.return)n=c,s=u;else{for(var g=!1,S=c.child;S;){if(S===n){g=!0,n=c,s=u;break}if(S===s){g=!0,s=c,n=u;break}S=S.sibling}if(!g){for(S=u.child;S;){if(S===n){g=!0,n=u,s=c;break}if(S===s){g=!0,s=u,n=c;break}S=S.sibling}if(!g)throw Error(r(189))}}if(n.alternate!==s)throw Error(r(190))}if(n.tag!==3)throw Error(r(188));return n.stateNode.current===n?e:t}function y(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=y(e),t!==null)return t;e=e.sibling}return null}var b=Object.assign,N=Symbol.for("react.element"),M=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),j=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),T=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),Z=Symbol.for("react.suspense_list"),D=Symbol.for("react.memo"),G=Symbol.for("react.lazy"),Y=Symbol.for("react.activity"),F=Symbol.for("react.memo_cache_sentinel"),Q=Symbol.iterator;function ne(e){return e===null||typeof e!="object"?null:(e=Q&&e[Q]||e["@@iterator"],typeof e=="function"?e:null)}var ce=Symbol.for("react.client.reference");function pe(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ce?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case E:return"Fragment";case R:return"Profiler";case j:return"StrictMode";case L:return"Suspense";case Z:return"SuspenseList";case Y:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case C:return"Portal";case T:return e.displayName||"Context";case A:return(e._context.displayName||"Context")+".Consumer";case O:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case D:return t=e.displayName||null,t!==null?t:pe(e.type)||"Memo";case G:t=e._payload,e=e._init;try{return pe(e(t))}catch{}}return null}var V=Array.isArray,q=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W={pending:!1,data:null,method:null,action:null},re=[],de=-1;function w(e){return{current:e}}function z(e){0>de||(e.current=re[de],re[de]=null,de--)}function P(e,t){de++,re[de]=e.current,e.current=t}var ae=w(null),le=w(null),se=w(null),oe=w(null);function ve(e,t){switch(P(se,t),P(le,e),P(ae,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?g0(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=g0(t),e=x0(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}z(ae),P(ae,e)}function he(){z(ae),z(le),z(se)}function Oe(e){e.memoizedState!==null&&P(oe,e);var t=ae.current,n=x0(t,e.type);t!==n&&(P(le,e),P(ae,n))}function te(e){le.current===e&&(z(ae),z(le)),oe.current===e&&(z(oe),Ws._currentValue=W)}var ie,Se;function Be(e){if(ie===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);ie=t&&t[1]||"",Se=-1<n.stack.indexOf(`
|
||
at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
|
||
`+ie+e+Se}var Te=!1;function We(e,t){if(!e||Te)return"";Te=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(t){var ee=function(){throw Error()};if(Object.defineProperty(ee.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ee,[])}catch(K){var $=K}Reflect.construct(e,[],ee)}else{try{ee.call()}catch(K){$=K}e.call(ee.prototype)}}else{try{throw Error()}catch(K){$=K}(ee=e())&&typeof ee.catch=="function"&&ee.catch(function(){})}}catch(K){if(K&&$&&typeof K.stack=="string")return[K.stack,$.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var c=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");c&&c.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var u=s.DetermineComponentFrameRoot(),g=u[0],S=u[1];if(g&&S){var k=g.split(`
|
||
`),H=S.split(`
|
||
`);for(c=s=0;s<k.length&&!k[s].includes("DetermineComponentFrameRoot");)s++;for(;c<H.length&&!H[c].includes("DetermineComponentFrameRoot");)c++;if(s===k.length||c===H.length)for(s=k.length-1,c=H.length-1;1<=s&&0<=c&&k[s]!==H[c];)c--;for(;1<=s&&0<=c;s--,c--)if(k[s]!==H[c]){if(s!==1||c!==1)do if(s--,c--,0>c||k[s]!==H[c]){var J=`
|
||
`+k[s].replace(" at new "," at ");return e.displayName&&J.includes("<anonymous>")&&(J=J.replace("<anonymous>",e.displayName)),J}while(1<=s&&0<=c);break}}}finally{Te=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Be(n):""}function On(e,t){switch(e.tag){case 26:case 27:case 5:return Be(e.type);case 16:return Be("Lazy");case 13:return e.child!==t&&t!==null?Be("Suspense Fallback"):Be("Suspense");case 19:return Be("SuspenseList");case 0:case 15:return We(e.type,!1);case 11:return We(e.type.render,!1);case 1:return We(e.type,!0);case 31:return Be("Activity");default:return""}}function Ua(e){try{var t="",n=null;do t+=On(e,n),n=e,e=e.return;while(e);return t}catch(s){return`
|
||
Error generating stack: `+s.message+`
|
||
`+s.stack}}var Bn=Object.prototype.hasOwnProperty,gt=a.unstable_scheduleCallback,St=a.unstable_cancelCallback,vn=a.unstable_shouldYield,Ln=a.unstable_requestPaint,wt=a.unstable_now,So=a.unstable_getCurrentPriorityLevel,zt=a.unstable_ImmediatePriority,Ut=a.unstable_UserBlockingPriority,ua=a.unstable_NormalPriority,Ao=a.unstable_LowPriority,us=a.unstable_IdlePriority,Zt=a.log,jo=a.unstable_setDisableYieldValue,Ha=null,Et=null;function Mt(e){if(typeof Zt=="function"&&jo(e),Et&&typeof Et.setStrictMode=="function")try{Et.setStrictMode(Ha,e)}catch{}}var ht=Math.clz32?Math.clz32:Ci,fs=Math.log,yn=Math.LN2;function Ci(e){return e>>>=0,e===0?32:31-(fs(e)/yn|0)|0}var Va=256,fa=262144,hl=4194304;function cn(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function bn(e,t,n){var s=e.pendingLanes;if(s===0)return 0;var c=0,u=e.suspendedLanes,g=e.pingedLanes;e=e.warmLanes;var S=s&134217727;return S!==0?(s=S&~u,s!==0?c=cn(s):(g&=S,g!==0?c=cn(g):n||(n=S&~e,n!==0&&(c=cn(n))))):(S=s&~u,S!==0?c=cn(S):g!==0?c=cn(g):n||(n=s&~e,n!==0&&(c=cn(n)))),c===0?0:t!==0&&t!==c&&(t&u)===0&&(u=c&-c,n=t&-t,u>=n||u===32&&(n&4194048)!==0)?t:c}function Sn(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function ds(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ya(){var e=hl;return hl<<=1,(hl&62914560)===0&&(hl=4194304),e}function qi(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function At(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ne(e,t,n,s,c,u){var g=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var S=e.entanglements,k=e.expirationTimes,H=e.hiddenUpdates;for(n=g&~n;0<n;){var J=31-ht(n),ee=1<<J;S[J]=0,k[J]=-1;var $=H[J];if($!==null)for(H[J]=null,J=0;J<$.length;J++){var K=$[J];K!==null&&(K.lane&=-536870913)}n&=~ee}s!==0&&Mi(e,s,0),u!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=u&~(g&~t))}function Mi(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-ht(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|n&261930}function da(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var s=31-ht(n),c=1<<s;c&t|e[s]&t&&(e[s]|=t),n&=~c}}function pl(e,t){var n=t&-t;return n=(n&42)!==0?1:ma(n),(n&(e.suspendedLanes|t))!==0?0:n}function ma(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function An(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function $a(){var e=X.p;return e!==0?e:(e=window.event,e===void 0?32:H0(e.type))}function ms(e,t){var n=X.p;try{return X.p=e,t()}finally{X.p=n}}var jn=Math.random().toString(36).slice(2),dt="__reactFiber$"+jn,jt="__reactProps$"+jn,zn="__reactContainer$"+jn,Ht="__reactEvents$"+jn,ue="__reactListeners$"+jn,$e="__reactHandles$"+jn,ke="__reactResources$"+jn,ye="__reactMarker$"+jn;function Ge(e){delete e[dt],delete e[jt],delete e[Ht],delete e[ue],delete e[$e]}function ze(e){var t=e[dt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[zn]||n[dt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=N0(e);e!==null;){if(n=e[dt])return n;e=N0(e)}return t}e=n,n=e.parentNode}return null}function Rt(e){if(e=e[dt]||e[zn]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Vt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(r(33))}function Ue(e){var t=e[ke];return t||(t=e[ke]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Ze(e){e[ye]=!0}var hs=new Set,sd={};function Ga(e,t){gl(e,t),gl(e+"Capture",t)}function gl(e,t){for(sd[e]=t,e=0;e<t.length;e++)hs.add(t[e])}var Nx=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),id={},rd={};function wx(e){return Bn.call(rd,e)?!0:Bn.call(id,e)?!1:Nx.test(e)?rd[e]=!0:(id[e]=!0,!1)}function Ri(e,t,n){if(wx(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var s=t.toLowerCase().slice(0,5);if(s!=="data-"&&s!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function ki(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+n)}}function Un(e,t,n,s){if(s===null)e.removeAttribute(n);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+s)}}function Jt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function od(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Ex(e,t,n){var s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var c=s.get,u=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(g){n=""+g,u.call(this,g)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return n},setValue:function(g){n=""+g},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function No(e){if(!e._valueTracker){var t=od(e)?"checked":"value";e._valueTracker=Ex(e,t,""+e[t])}}function cd(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=od(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}function Ti(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Cx=/[\n"\\]/g;function It(e){return e.replace(Cx,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function wo(e,t,n,s,c,u,g,S){e.name="",g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"?e.type=g:e.removeAttribute("type"),t!=null?g==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Jt(t)):e.value!==""+Jt(t)&&(e.value=""+Jt(t)):g!=="submit"&&g!=="reset"||e.removeAttribute("value"),t!=null?Eo(e,g,Jt(t)):n!=null?Eo(e,g,Jt(n)):s!=null&&e.removeAttribute("value"),c==null&&u!=null&&(e.defaultChecked=!!u),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?e.name=""+Jt(S):e.removeAttribute("name")}function ud(e,t,n,s,c,u,g,S){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(e.type=u),t!=null||n!=null){if(!(u!=="submit"&&u!=="reset"||t!=null)){No(e);return}n=n!=null?""+Jt(n):"",t=t!=null?""+Jt(t):n,S||t===e.value||(e.value=t),e.defaultValue=t}s=s??c,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=S?e.checked:!!s,e.defaultChecked=!!s,g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(e.name=g),No(e)}function Eo(e,t,n){t==="number"&&Ti(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function xl(e,t,n,s){if(e=e.options,t){t={};for(var c=0;c<n.length;c++)t["$"+n[c]]=!0;for(n=0;n<e.length;n++)c=t.hasOwnProperty("$"+e[n].value),e[n].selected!==c&&(e[n].selected=c),c&&s&&(e[n].defaultSelected=!0)}else{for(n=""+Jt(n),t=null,c=0;c<e.length;c++){if(e[c].value===n){e[c].selected=!0,s&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function fd(e,t,n){if(t!=null&&(t=""+Jt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Jt(n):""}function dd(e,t,n,s){if(t==null){if(s!=null){if(n!=null)throw Error(r(92));if(V(s)){if(1<s.length)throw Error(r(93));s=s[0]}n=s}n==null&&(n=""),t=n}n=Jt(t),e.defaultValue=n,s=e.textContent,s===n&&s!==""&&s!==null&&(e.value=s),No(e)}function vl(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var qx=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function md(e,t,n){var s=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?s?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":s?e.setProperty(t,n):typeof n!="number"||n===0||qx.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function hd(e,t,n){if(t!=null&&typeof t!="object")throw Error(r(62));if(e=e.style,n!=null){for(var s in n)!n.hasOwnProperty(s)||t!=null&&t.hasOwnProperty(s)||(s.indexOf("--")===0?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="");for(var c in t)s=t[c],t.hasOwnProperty(c)&&n[c]!==s&&md(e,c,s)}else for(var u in t)t.hasOwnProperty(u)&&md(e,u,t[u])}function Co(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Mx=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Rx=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function _i(e){return Rx.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Hn(){}var qo=null;function Mo(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var yl=null,bl=null;function pd(e){var t=Rt(e);if(t&&(e=t.stateNode)){var n=e[jt]||null;e:switch(e=t.stateNode,t.type){case"input":if(wo(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+It(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var s=n[t];if(s!==e&&s.form===e.form){var c=s[jt]||null;if(!c)throw Error(r(90));wo(s,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name)}}for(t=0;t<n.length;t++)s=n[t],s.form===e.form&&cd(s)}break e;case"textarea":fd(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&xl(e,!!n.multiple,t,!1)}}}var Ro=!1;function gd(e,t,n){if(Ro)return e(t,n);Ro=!0;try{var s=e(t);return s}finally{if(Ro=!1,(yl!==null||bl!==null)&&(br(),yl&&(t=yl,e=bl,bl=yl=null,pd(t),e)))for(t=0;t<e.length;t++)pd(e[t])}}function ps(e,t){var n=e.stateNode;if(n===null)return null;var s=n[jt]||null;if(s===null)return null;n=s[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(r(231,t,typeof n));return n}var Vn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ko=!1;if(Vn)try{var gs={};Object.defineProperty(gs,"passive",{get:function(){ko=!0}}),window.addEventListener("test",gs,gs),window.removeEventListener("test",gs,gs)}catch{ko=!1}var ha=null,To=null,Di=null;function xd(){if(Di)return Di;var e,t=To,n=t.length,s,c="value"in ha?ha.value:ha.textContent,u=c.length;for(e=0;e<n&&t[e]===c[e];e++);var g=n-e;for(s=1;s<=g&&t[n-s]===c[u-s];s++);return Di=c.slice(e,1<s?1-s:void 0)}function Oi(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Bi(){return!0}function vd(){return!1}function kt(e){function t(n,s,c,u,g){this._reactName=n,this._targetInst=c,this.type=s,this.nativeEvent=u,this.target=g,this.currentTarget=null;for(var S in e)e.hasOwnProperty(S)&&(n=e[S],this[S]=n?n(u):u[S]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?Bi:vd,this.isPropagationStopped=vd,this}return b(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Bi)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Bi)},persist:function(){},isPersistent:Bi}),t}var Xa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Li=kt(Xa),xs=b({},Xa,{view:0,detail:0}),kx=kt(xs),_o,Do,vs,zi=b({},xs,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Bo,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==vs&&(vs&&e.type==="mousemove"?(_o=e.screenX-vs.screenX,Do=e.screenY-vs.screenY):Do=_o=0,vs=e),_o)},movementY:function(e){return"movementY"in e?e.movementY:Do}}),yd=kt(zi),Tx=b({},zi,{dataTransfer:0}),_x=kt(Tx),Dx=b({},xs,{relatedTarget:0}),Oo=kt(Dx),Ox=b({},Xa,{animationName:0,elapsedTime:0,pseudoElement:0}),Bx=kt(Ox),Lx=b({},Xa,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),zx=kt(Lx),Ux=b({},Xa,{data:0}),bd=kt(Ux),Hx={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Vx={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Yx={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function $x(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Yx[e])?!!t[e]:!1}function Bo(){return $x}var Gx=b({},xs,{key:function(e){if(e.key){var t=Hx[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Oi(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Vx[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Bo,charCode:function(e){return e.type==="keypress"?Oi(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Oi(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Xx=kt(Gx),Qx=b({},zi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Sd=kt(Qx),Kx=b({},xs,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Bo}),Fx=kt(Kx),Zx=b({},Xa,{propertyName:0,elapsedTime:0,pseudoElement:0}),Jx=kt(Zx),Ix=b({},zi,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Wx=kt(Ix),Px=b({},Xa,{newState:0,oldState:0}),ev=kt(Px),tv=[9,13,27,32],Lo=Vn&&"CompositionEvent"in window,ys=null;Vn&&"documentMode"in document&&(ys=document.documentMode);var nv=Vn&&"TextEvent"in window&&!ys,Ad=Vn&&(!Lo||ys&&8<ys&&11>=ys),jd=" ",Nd=!1;function wd(e,t){switch(e){case"keyup":return tv.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ed(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Sl=!1;function av(e,t){switch(e){case"compositionend":return Ed(t);case"keypress":return t.which!==32?null:(Nd=!0,jd);case"textInput":return e=t.data,e===jd&&Nd?null:e;default:return null}}function lv(e,t){if(Sl)return e==="compositionend"||!Lo&&wd(e,t)?(e=xd(),Di=To=ha=null,Sl=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Ad&&t.locale!=="ko"?null:t.data;default:return null}}var sv={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Cd(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!sv[e.type]:t==="textarea"}function qd(e,t,n,s){yl?bl?bl.push(s):bl=[s]:yl=s,t=Cr(t,"onChange"),0<t.length&&(n=new Li("onChange","change",null,n,s),e.push({event:n,listeners:t}))}var bs=null,Ss=null;function iv(e){u0(e,0)}function Ui(e){var t=Vt(e);if(cd(t))return e}function Md(e,t){if(e==="change")return t}var Rd=!1;if(Vn){var zo;if(Vn){var Uo="oninput"in document;if(!Uo){var kd=document.createElement("div");kd.setAttribute("oninput","return;"),Uo=typeof kd.oninput=="function"}zo=Uo}else zo=!1;Rd=zo&&(!document.documentMode||9<document.documentMode)}function Td(){bs&&(bs.detachEvent("onpropertychange",_d),Ss=bs=null)}function _d(e){if(e.propertyName==="value"&&Ui(Ss)){var t=[];qd(t,Ss,e,Mo(e)),gd(iv,t)}}function rv(e,t,n){e==="focusin"?(Td(),bs=t,Ss=n,bs.attachEvent("onpropertychange",_d)):e==="focusout"&&Td()}function ov(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ui(Ss)}function cv(e,t){if(e==="click")return Ui(t)}function uv(e,t){if(e==="input"||e==="change")return Ui(t)}function fv(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Yt=typeof Object.is=="function"?Object.is:fv;function As(e,t){if(Yt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(s=0;s<n.length;s++){var c=n[s];if(!Bn.call(t,c)||!Yt(e[c],t[c]))return!1}return!0}function Dd(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Od(e,t){var n=Dd(e);e=0;for(var s;n;){if(n.nodeType===3){if(s=e+n.textContent.length,e<=t&&s>=t)return{node:n,offset:t-e};e=s}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Dd(n)}}function Bd(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Bd(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ld(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ti(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ti(e.document)}return t}function Ho(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var dv=Vn&&"documentMode"in document&&11>=document.documentMode,Al=null,Vo=null,js=null,Yo=!1;function zd(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Yo||Al==null||Al!==Ti(s)||(s=Al,"selectionStart"in s&&Ho(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),js&&As(js,s)||(js=s,s=Cr(Vo,"onSelect"),0<s.length&&(t=new Li("onSelect","select",null,t,n),e.push({event:t,listeners:s}),t.target=Al)))}function Qa(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var jl={animationend:Qa("Animation","AnimationEnd"),animationiteration:Qa("Animation","AnimationIteration"),animationstart:Qa("Animation","AnimationStart"),transitionrun:Qa("Transition","TransitionRun"),transitionstart:Qa("Transition","TransitionStart"),transitioncancel:Qa("Transition","TransitionCancel"),transitionend:Qa("Transition","TransitionEnd")},$o={},Ud={};Vn&&(Ud=document.createElement("div").style,"AnimationEvent"in window||(delete jl.animationend.animation,delete jl.animationiteration.animation,delete jl.animationstart.animation),"TransitionEvent"in window||delete jl.transitionend.transition);function Ka(e){if($o[e])return $o[e];if(!jl[e])return e;var t=jl[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Ud)return $o[e]=t[n];return e}var Hd=Ka("animationend"),Vd=Ka("animationiteration"),Yd=Ka("animationstart"),mv=Ka("transitionrun"),hv=Ka("transitionstart"),pv=Ka("transitioncancel"),$d=Ka("transitionend"),Gd=new Map,Go="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Go.push("scrollEnd");function un(e,t){Gd.set(e,t),Ga(t,[e])}var Hi=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Wt=[],Nl=0,Xo=0;function Vi(){for(var e=Nl,t=Xo=Nl=0;t<e;){var n=Wt[t];Wt[t++]=null;var s=Wt[t];Wt[t++]=null;var c=Wt[t];Wt[t++]=null;var u=Wt[t];if(Wt[t++]=null,s!==null&&c!==null){var g=s.pending;g===null?c.next=c:(c.next=g.next,g.next=c),s.pending=c}u!==0&&Xd(n,c,u)}}function Yi(e,t,n,s){Wt[Nl++]=e,Wt[Nl++]=t,Wt[Nl++]=n,Wt[Nl++]=s,Xo|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function Qo(e,t,n,s){return Yi(e,t,n,s),$i(e)}function Fa(e,t){return Yi(e,null,null,t),$i(e)}function Xd(e,t,n){e.lanes|=n;var s=e.alternate;s!==null&&(s.lanes|=n);for(var c=!1,u=e.return;u!==null;)u.childLanes|=n,s=u.alternate,s!==null&&(s.childLanes|=n),u.tag===22&&(e=u.stateNode,e===null||e._visibility&1||(c=!0)),e=u,u=u.return;return e.tag===3?(u=e.stateNode,c&&t!==null&&(c=31-ht(n),e=u.hiddenUpdates,s=e[c],s===null?e[c]=[t]:s.push(t),t.lane=n|536870912),u):null}function $i(e){if(50<Xs)throw Xs=0,tu=null,Error(r(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var wl={};function gv(e,t,n,s){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function $t(e,t,n,s){return new gv(e,t,n,s)}function Ko(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Yn(e,t){var n=e.alternate;return n===null?(n=$t(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function Qd(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Gi(e,t,n,s,c,u){var g=0;if(s=e,typeof e=="function")Ko(e)&&(g=1);else if(typeof e=="string")g=Sy(e,n,ae.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Y:return e=$t(31,n,t,c),e.elementType=Y,e.lanes=u,e;case E:return Za(n.children,c,u,t);case j:g=8,c|=24;break;case R:return e=$t(12,n,t,c|2),e.elementType=R,e.lanes=u,e;case L:return e=$t(13,n,t,c),e.elementType=L,e.lanes=u,e;case Z:return e=$t(19,n,t,c),e.elementType=Z,e.lanes=u,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case T:g=10;break e;case A:g=9;break e;case O:g=11;break e;case D:g=14;break e;case G:g=16,s=null;break e}g=29,n=Error(r(130,e===null?"null":typeof e,"")),s=null}return t=$t(g,n,t,c),t.elementType=e,t.type=s,t.lanes=u,t}function Za(e,t,n,s){return e=$t(7,e,s,t),e.lanes=n,e}function Fo(e,t,n){return e=$t(6,e,null,t),e.lanes=n,e}function Kd(e){var t=$t(18,null,null,0);return t.stateNode=e,t}function Zo(e,t,n){return t=$t(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Fd=new WeakMap;function Pt(e,t){if(typeof e=="object"&&e!==null){var n=Fd.get(e);return n!==void 0?n:(t={value:e,source:t,stack:Ua(t)},Fd.set(e,t),t)}return{value:e,source:t,stack:Ua(t)}}var El=[],Cl=0,Xi=null,Ns=0,en=[],tn=0,pa=null,Nn=1,wn="";function $n(e,t){El[Cl++]=Ns,El[Cl++]=Xi,Xi=e,Ns=t}function Zd(e,t,n){en[tn++]=Nn,en[tn++]=wn,en[tn++]=pa,pa=e;var s=Nn;e=wn;var c=32-ht(s)-1;s&=~(1<<c),n+=1;var u=32-ht(t)+c;if(30<u){var g=c-c%5;u=(s&(1<<g)-1).toString(32),s>>=g,c-=g,Nn=1<<32-ht(t)+c|n<<c|s,wn=u+e}else Nn=1<<u|n<<c|s,wn=e}function Jo(e){e.return!==null&&($n(e,1),Zd(e,1,0))}function Io(e){for(;e===Xi;)Xi=El[--Cl],El[Cl]=null,Ns=El[--Cl],El[Cl]=null;for(;e===pa;)pa=en[--tn],en[tn]=null,wn=en[--tn],en[tn]=null,Nn=en[--tn],en[tn]=null}function Jd(e,t){en[tn++]=Nn,en[tn++]=wn,en[tn++]=pa,Nn=t.id,wn=t.overflow,pa=e}var xt=null,Je=null,Me=!1,ga=null,nn=!1,Wo=Error(r(519));function xa(e){var t=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ws(Pt(t,e)),Wo}function Id(e){var t=e.stateNode,n=e.type,s=e.memoizedProps;switch(t[dt]=e,t[jt]=s,n){case"dialog":Ee("cancel",t),Ee("close",t);break;case"iframe":case"object":case"embed":Ee("load",t);break;case"video":case"audio":for(n=0;n<Ks.length;n++)Ee(Ks[n],t);break;case"source":Ee("error",t);break;case"img":case"image":case"link":Ee("error",t),Ee("load",t);break;case"details":Ee("toggle",t);break;case"input":Ee("invalid",t),ud(t,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":Ee("invalid",t);break;case"textarea":Ee("invalid",t),dd(t,s.value,s.defaultValue,s.children)}n=s.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||s.suppressHydrationWarning===!0||h0(t.textContent,n)?(s.popover!=null&&(Ee("beforetoggle",t),Ee("toggle",t)),s.onScroll!=null&&Ee("scroll",t),s.onScrollEnd!=null&&Ee("scrollend",t),s.onClick!=null&&(t.onclick=Hn),t=!0):t=!1,t||xa(e,!0)}function Wd(e){for(xt=e.return;xt;)switch(xt.tag){case 5:case 31:case 13:nn=!1;return;case 27:case 3:nn=!0;return;default:xt=xt.return}}function ql(e){if(e!==xt)return!1;if(!Me)return Wd(e),Me=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||gu(e.type,e.memoizedProps)),n=!n),n&&Je&&xa(e),Wd(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));Je=j0(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));Je=j0(e)}else t===27?(t=Je,ka(e.type)?(e=Su,Su=null,Je=e):Je=t):Je=xt?ln(e.stateNode.nextSibling):null;return!0}function Ja(){Je=xt=null,Me=!1}function Po(){var e=ga;return e!==null&&(Ot===null?Ot=e:Ot.push.apply(Ot,e),ga=null),e}function ws(e){ga===null?ga=[e]:ga.push(e)}var ec=w(null),Ia=null,Gn=null;function va(e,t,n){P(ec,t._currentValue),t._currentValue=n}function Xn(e){e._currentValue=ec.current,z(ec)}function tc(e,t,n){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===n)break;e=e.return}}function nc(e,t,n,s){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var u=c.dependencies;if(u!==null){var g=c.child;u=u.firstContext;e:for(;u!==null;){var S=u;u=c;for(var k=0;k<t.length;k++)if(S.context===t[k]){u.lanes|=n,S=u.alternate,S!==null&&(S.lanes|=n),tc(u.return,n,e),s||(g=null);break e}u=S.next}}else if(c.tag===18){if(g=c.return,g===null)throw Error(r(341));g.lanes|=n,u=g.alternate,u!==null&&(u.lanes|=n),tc(g,n,e),g=null}else g=c.child;if(g!==null)g.return=c;else for(g=c;g!==null;){if(g===e){g=null;break}if(c=g.sibling,c!==null){c.return=g.return,g=c;break}g=g.return}c=g}}function Ml(e,t,n,s){e=null;for(var c=t,u=!1;c!==null;){if(!u){if((c.flags&524288)!==0)u=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var g=c.alternate;if(g===null)throw Error(r(387));if(g=g.memoizedProps,g!==null){var S=c.type;Yt(c.pendingProps.value,g.value)||(e!==null?e.push(S):e=[S])}}else if(c===oe.current){if(g=c.alternate,g===null)throw Error(r(387));g.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(Ws):e=[Ws])}c=c.return}e!==null&&nc(t,e,n,s),t.flags|=262144}function Qi(e){for(e=e.firstContext;e!==null;){if(!Yt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Wa(e){Ia=e,Gn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function vt(e){return Pd(Ia,e)}function Ki(e,t){return Ia===null&&Wa(e),Pd(e,t)}function Pd(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Gn===null){if(e===null)throw Error(r(308));Gn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Gn=Gn.next=t;return n}var xv=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,s){e.push(s)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},vv=a.unstable_scheduleCallback,yv=a.unstable_NormalPriority,rt={$$typeof:T,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ac(){return{controller:new xv,data:new Map,refCount:0}}function Es(e){e.refCount--,e.refCount===0&&vv(yv,function(){e.controller.abort()})}var Cs=null,lc=0,Rl=0,kl=null;function bv(e,t){if(Cs===null){var n=Cs=[];lc=0,Rl=ru(),kl={status:"pending",value:void 0,then:function(s){n.push(s)}}}return lc++,t.then(em,em),t}function em(){if(--lc===0&&Cs!==null){kl!==null&&(kl.status="fulfilled");var e=Cs;Cs=null,Rl=0,kl=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Sv(e,t){var n=[],s={status:"pending",value:null,reason:null,then:function(c){n.push(c)}};return e.then(function(){s.status="fulfilled",s.value=t;for(var c=0;c<n.length;c++)(0,n[c])(t)},function(c){for(s.status="rejected",s.reason=c,c=0;c<n.length;c++)(0,n[c])(void 0)}),s}var tm=q.S;q.S=function(e,t){zh=wt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&bv(e,t),tm!==null&&tm(e,t)};var Pa=w(null);function sc(){var e=Pa.current;return e!==null?e:Fe.pooledCache}function Fi(e,t){t===null?P(Pa,Pa.current):P(Pa,t.pool)}function nm(){var e=sc();return e===null?null:{parent:rt._currentValue,pool:e}}var Tl=Error(r(460)),ic=Error(r(474)),Zi=Error(r(542)),Ji={then:function(){}};function am(e){return e=e.status,e==="fulfilled"||e==="rejected"}function lm(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Hn,Hn),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,im(e),e;default:if(typeof t.status=="string")t.then(Hn,Hn);else{if(e=Fe,e!==null&&100<e.shellSuspendCounter)throw Error(r(482));e=t,e.status="pending",e.then(function(s){if(t.status==="pending"){var c=t;c.status="fulfilled",c.value=s}},function(s){if(t.status==="pending"){var c=t;c.status="rejected",c.reason=s}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,im(e),e}throw tl=t,Tl}}function el(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(tl=n,Tl):n}}var tl=null;function sm(){if(tl===null)throw Error(r(459));var e=tl;return tl=null,e}function im(e){if(e===Tl||e===Zi)throw Error(r(483))}var _l=null,qs=0;function Ii(e){var t=qs;return qs+=1,_l===null&&(_l=[]),lm(_l,e,t)}function Ms(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Wi(e,t){throw t.$$typeof===N?Error(r(525)):(e=Object.prototype.toString.call(t),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function rm(e){function t(B,_){if(e){var U=B.deletions;U===null?(B.deletions=[_],B.flags|=16):U.push(_)}}function n(B,_){if(!e)return null;for(;_!==null;)t(B,_),_=_.sibling;return null}function s(B){for(var _=new Map;B!==null;)B.key!==null?_.set(B.key,B):_.set(B.index,B),B=B.sibling;return _}function c(B,_){return B=Yn(B,_),B.index=0,B.sibling=null,B}function u(B,_,U){return B.index=U,e?(U=B.alternate,U!==null?(U=U.index,U<_?(B.flags|=67108866,_):U):(B.flags|=67108866,_)):(B.flags|=1048576,_)}function g(B){return e&&B.alternate===null&&(B.flags|=67108866),B}function S(B,_,U,I){return _===null||_.tag!==6?(_=Fo(U,B.mode,I),_.return=B,_):(_=c(_,U),_.return=B,_)}function k(B,_,U,I){var ge=U.type;return ge===E?J(B,_,U.props.children,I,U.key):_!==null&&(_.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===G&&el(ge)===_.type)?(_=c(_,U.props),Ms(_,U),_.return=B,_):(_=Gi(U.type,U.key,U.props,null,B.mode,I),Ms(_,U),_.return=B,_)}function H(B,_,U,I){return _===null||_.tag!==4||_.stateNode.containerInfo!==U.containerInfo||_.stateNode.implementation!==U.implementation?(_=Zo(U,B.mode,I),_.return=B,_):(_=c(_,U.children||[]),_.return=B,_)}function J(B,_,U,I,ge){return _===null||_.tag!==7?(_=Za(U,B.mode,I,ge),_.return=B,_):(_=c(_,U),_.return=B,_)}function ee(B,_,U){if(typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint")return _=Fo(""+_,B.mode,U),_.return=B,_;if(typeof _=="object"&&_!==null){switch(_.$$typeof){case M:return U=Gi(_.type,_.key,_.props,null,B.mode,U),Ms(U,_),U.return=B,U;case C:return _=Zo(_,B.mode,U),_.return=B,_;case G:return _=el(_),ee(B,_,U)}if(V(_)||ne(_))return _=Za(_,B.mode,U,null),_.return=B,_;if(typeof _.then=="function")return ee(B,Ii(_),U);if(_.$$typeof===T)return ee(B,Ki(B,_),U);Wi(B,_)}return null}function $(B,_,U,I){var ge=_!==null?_.key:null;if(typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint")return ge!==null?null:S(B,_,""+U,I);if(typeof U=="object"&&U!==null){switch(U.$$typeof){case M:return U.key===ge?k(B,_,U,I):null;case C:return U.key===ge?H(B,_,U,I):null;case G:return U=el(U),$(B,_,U,I)}if(V(U)||ne(U))return ge!==null?null:J(B,_,U,I,null);if(typeof U.then=="function")return $(B,_,Ii(U),I);if(U.$$typeof===T)return $(B,_,Ki(B,U),I);Wi(B,U)}return null}function K(B,_,U,I,ge){if(typeof I=="string"&&I!==""||typeof I=="number"||typeof I=="bigint")return B=B.get(U)||null,S(_,B,""+I,ge);if(typeof I=="object"&&I!==null){switch(I.$$typeof){case M:return B=B.get(I.key===null?U:I.key)||null,k(_,B,I,ge);case C:return B=B.get(I.key===null?U:I.key)||null,H(_,B,I,ge);case G:return I=el(I),K(B,_,U,I,ge)}if(V(I)||ne(I))return B=B.get(U)||null,J(_,B,I,ge,null);if(typeof I.then=="function")return K(B,_,U,Ii(I),ge);if(I.$$typeof===T)return K(B,_,U,Ki(_,I),ge);Wi(_,I)}return null}function fe(B,_,U,I){for(var ge=null,_e=null,me=_,je=_=0,qe=null;me!==null&&je<U.length;je++){me.index>je?(qe=me,me=null):qe=me.sibling;var De=$(B,me,U[je],I);if(De===null){me===null&&(me=qe);break}e&&me&&De.alternate===null&&t(B,me),_=u(De,_,je),_e===null?ge=De:_e.sibling=De,_e=De,me=qe}if(je===U.length)return n(B,me),Me&&$n(B,je),ge;if(me===null){for(;je<U.length;je++)me=ee(B,U[je],I),me!==null&&(_=u(me,_,je),_e===null?ge=me:_e.sibling=me,_e=me);return Me&&$n(B,je),ge}for(me=s(me);je<U.length;je++)qe=K(me,B,je,U[je],I),qe!==null&&(e&&qe.alternate!==null&&me.delete(qe.key===null?je:qe.key),_=u(qe,_,je),_e===null?ge=qe:_e.sibling=qe,_e=qe);return e&&me.forEach(function(Ba){return t(B,Ba)}),Me&&$n(B,je),ge}function xe(B,_,U,I){if(U==null)throw Error(r(151));for(var ge=null,_e=null,me=_,je=_=0,qe=null,De=U.next();me!==null&&!De.done;je++,De=U.next()){me.index>je?(qe=me,me=null):qe=me.sibling;var Ba=$(B,me,De.value,I);if(Ba===null){me===null&&(me=qe);break}e&&me&&Ba.alternate===null&&t(B,me),_=u(Ba,_,je),_e===null?ge=Ba:_e.sibling=Ba,_e=Ba,me=qe}if(De.done)return n(B,me),Me&&$n(B,je),ge;if(me===null){for(;!De.done;je++,De=U.next())De=ee(B,De.value,I),De!==null&&(_=u(De,_,je),_e===null?ge=De:_e.sibling=De,_e=De);return Me&&$n(B,je),ge}for(me=s(me);!De.done;je++,De=U.next())De=K(me,B,je,De.value,I),De!==null&&(e&&De.alternate!==null&&me.delete(De.key===null?je:De.key),_=u(De,_,je),_e===null?ge=De:_e.sibling=De,_e=De);return e&&me.forEach(function(Ty){return t(B,Ty)}),Me&&$n(B,je),ge}function Ke(B,_,U,I){if(typeof U=="object"&&U!==null&&U.type===E&&U.key===null&&(U=U.props.children),typeof U=="object"&&U!==null){switch(U.$$typeof){case M:e:{for(var ge=U.key;_!==null;){if(_.key===ge){if(ge=U.type,ge===E){if(_.tag===7){n(B,_.sibling),I=c(_,U.props.children),I.return=B,B=I;break e}}else if(_.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===G&&el(ge)===_.type){n(B,_.sibling),I=c(_,U.props),Ms(I,U),I.return=B,B=I;break e}n(B,_);break}else t(B,_);_=_.sibling}U.type===E?(I=Za(U.props.children,B.mode,I,U.key),I.return=B,B=I):(I=Gi(U.type,U.key,U.props,null,B.mode,I),Ms(I,U),I.return=B,B=I)}return g(B);case C:e:{for(ge=U.key;_!==null;){if(_.key===ge)if(_.tag===4&&_.stateNode.containerInfo===U.containerInfo&&_.stateNode.implementation===U.implementation){n(B,_.sibling),I=c(_,U.children||[]),I.return=B,B=I;break e}else{n(B,_);break}else t(B,_);_=_.sibling}I=Zo(U,B.mode,I),I.return=B,B=I}return g(B);case G:return U=el(U),Ke(B,_,U,I)}if(V(U))return fe(B,_,U,I);if(ne(U)){if(ge=ne(U),typeof ge!="function")throw Error(r(150));return U=ge.call(U),xe(B,_,U,I)}if(typeof U.then=="function")return Ke(B,_,Ii(U),I);if(U.$$typeof===T)return Ke(B,_,Ki(B,U),I);Wi(B,U)}return typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint"?(U=""+U,_!==null&&_.tag===6?(n(B,_.sibling),I=c(_,U),I.return=B,B=I):(n(B,_),I=Fo(U,B.mode,I),I.return=B,B=I),g(B)):n(B,_)}return function(B,_,U,I){try{qs=0;var ge=Ke(B,_,U,I);return _l=null,ge}catch(me){if(me===Tl||me===Zi)throw me;var _e=$t(29,me,null,B.mode);return _e.lanes=I,_e.return=B,_e}finally{}}}var nl=rm(!0),om=rm(!1),ya=!1;function rc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function oc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function ba(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Sa(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Le&2)!==0){var c=s.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),s.pending=t,t=$i(e),Xd(e,null,n),t}return Yi(e,s,t,n),$i(e)}function Rs(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,da(e,n)}}function cc(e,t){var n=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,n===s)){var c=null,u=null;if(n=n.firstBaseUpdate,n!==null){do{var g={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};u===null?c=u=g:u=u.next=g,n=n.next}while(n!==null);u===null?c=u=t:u=u.next=t}else c=u=t;n={baseState:s.baseState,firstBaseUpdate:c,lastBaseUpdate:u,shared:s.shared,callbacks:s.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var uc=!1;function ks(){if(uc){var e=kl;if(e!==null)throw e}}function Ts(e,t,n,s){uc=!1;var c=e.updateQueue;ya=!1;var u=c.firstBaseUpdate,g=c.lastBaseUpdate,S=c.shared.pending;if(S!==null){c.shared.pending=null;var k=S,H=k.next;k.next=null,g===null?u=H:g.next=H,g=k;var J=e.alternate;J!==null&&(J=J.updateQueue,S=J.lastBaseUpdate,S!==g&&(S===null?J.firstBaseUpdate=H:S.next=H,J.lastBaseUpdate=k))}if(u!==null){var ee=c.baseState;g=0,J=H=k=null,S=u;do{var $=S.lane&-536870913,K=$!==S.lane;if(K?(Ce&$)===$:(s&$)===$){$!==0&&$===Rl&&(uc=!0),J!==null&&(J=J.next={lane:0,tag:S.tag,payload:S.payload,callback:null,next:null});e:{var fe=e,xe=S;$=t;var Ke=n;switch(xe.tag){case 1:if(fe=xe.payload,typeof fe=="function"){ee=fe.call(Ke,ee,$);break e}ee=fe;break e;case 3:fe.flags=fe.flags&-65537|128;case 0:if(fe=xe.payload,$=typeof fe=="function"?fe.call(Ke,ee,$):fe,$==null)break e;ee=b({},ee,$);break e;case 2:ya=!0}}$=S.callback,$!==null&&(e.flags|=64,K&&(e.flags|=8192),K=c.callbacks,K===null?c.callbacks=[$]:K.push($))}else K={lane:$,tag:S.tag,payload:S.payload,callback:S.callback,next:null},J===null?(H=J=K,k=ee):J=J.next=K,g|=$;if(S=S.next,S===null){if(S=c.shared.pending,S===null)break;K=S,S=K.next,K.next=null,c.lastBaseUpdate=K,c.shared.pending=null}}while(!0);J===null&&(k=ee),c.baseState=k,c.firstBaseUpdate=H,c.lastBaseUpdate=J,u===null&&(c.shared.lanes=0),Ea|=g,e.lanes=g,e.memoizedState=ee}}function cm(e,t){if(typeof e!="function")throw Error(r(191,e));e.call(t)}function um(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)cm(n[e],t)}var Dl=w(null),Pi=w(0);function fm(e,t){e=ea,P(Pi,e),P(Dl,t),ea=e|t.baseLanes}function fc(){P(Pi,ea),P(Dl,Dl.current)}function dc(){ea=Pi.current,z(Dl),z(Pi)}var Gt=w(null),an=null;function Aa(e){var t=e.alternate;P(at,at.current&1),P(Gt,e),an===null&&(t===null||Dl.current!==null||t.memoizedState!==null)&&(an=e)}function mc(e){P(at,at.current),P(Gt,e),an===null&&(an=e)}function dm(e){e.tag===22?(P(at,at.current),P(Gt,e),an===null&&(an=e)):ja()}function ja(){P(at,at.current),P(Gt,Gt.current)}function Xt(e){z(Gt),an===e&&(an=null),z(at)}var at=w(0);function er(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||yu(n)||bu(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Qn=0,Ae=null,Xe=null,ot=null,tr=!1,Ol=!1,al=!1,nr=0,_s=0,Bl=null,Av=0;function tt(){throw Error(r(321))}function hc(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Yt(e[n],t[n]))return!1;return!0}function pc(e,t,n,s,c,u){return Qn=u,Ae=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,q.H=e===null||e.memoizedState===null?Zm:Rc,al=!1,u=n(s,c),al=!1,Ol&&(u=hm(t,n,s,c)),mm(e),u}function mm(e){q.H=Bs;var t=Xe!==null&&Xe.next!==null;if(Qn=0,ot=Xe=Ae=null,tr=!1,_s=0,Bl=null,t)throw Error(r(300));e===null||ct||(e=e.dependencies,e!==null&&Qi(e)&&(ct=!0))}function hm(e,t,n,s){Ae=e;var c=0;do{if(Ol&&(Bl=null),_s=0,Ol=!1,25<=c)throw Error(r(301));if(c+=1,ot=Xe=null,e.updateQueue!=null){var u=e.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}q.H=Jm,u=t(n,s)}while(Ol);return u}function jv(){var e=q.H,t=e.useState()[0];return t=typeof t.then=="function"?Ds(t):t,e=e.useState()[0],(Xe!==null?Xe.memoizedState:null)!==e&&(Ae.flags|=1024),t}function gc(){var e=nr!==0;return nr=0,e}function xc(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function vc(e){if(tr){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}tr=!1}Qn=0,ot=Xe=Ae=null,Ol=!1,_s=nr=0,Bl=null}function Ct(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ot===null?Ae.memoizedState=ot=e:ot=ot.next=e,ot}function lt(){if(Xe===null){var e=Ae.alternate;e=e!==null?e.memoizedState:null}else e=Xe.next;var t=ot===null?Ae.memoizedState:ot.next;if(t!==null)ot=t,Xe=e;else{if(e===null)throw Ae.alternate===null?Error(r(467)):Error(r(310));Xe=e,e={memoizedState:Xe.memoizedState,baseState:Xe.baseState,baseQueue:Xe.baseQueue,queue:Xe.queue,next:null},ot===null?Ae.memoizedState=ot=e:ot=ot.next=e}return ot}function ar(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ds(e){var t=_s;return _s+=1,Bl===null&&(Bl=[]),e=lm(Bl,e,t),t=Ae,(ot===null?t.memoizedState:ot.next)===null&&(t=t.alternate,q.H=t===null||t.memoizedState===null?Zm:Rc),e}function lr(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Ds(e);if(e.$$typeof===T)return vt(e)}throw Error(r(438,String(e)))}function yc(e){var t=null,n=Ae.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var s=Ae.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(t={data:s.data.map(function(c){return c.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=ar(),Ae.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),s=0;s<e;s++)n[s]=F;return t.index++,n}function Kn(e,t){return typeof t=="function"?t(e):t}function sr(e){var t=lt();return bc(t,Xe,e)}function bc(e,t,n){var s=e.queue;if(s===null)throw Error(r(311));s.lastRenderedReducer=n;var c=e.baseQueue,u=s.pending;if(u!==null){if(c!==null){var g=c.next;c.next=u.next,u.next=g}t.baseQueue=c=u,s.pending=null}if(u=e.baseState,c===null)e.memoizedState=u;else{t=c.next;var S=g=null,k=null,H=t,J=!1;do{var ee=H.lane&-536870913;if(ee!==H.lane?(Ce&ee)===ee:(Qn&ee)===ee){var $=H.revertLane;if($===0)k!==null&&(k=k.next={lane:0,revertLane:0,gesture:null,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null}),ee===Rl&&(J=!0);else if((Qn&$)===$){H=H.next,$===Rl&&(J=!0);continue}else ee={lane:0,revertLane:H.revertLane,gesture:null,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null},k===null?(S=k=ee,g=u):k=k.next=ee,Ae.lanes|=$,Ea|=$;ee=H.action,al&&n(u,ee),u=H.hasEagerState?H.eagerState:n(u,ee)}else $={lane:ee,revertLane:H.revertLane,gesture:H.gesture,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null},k===null?(S=k=$,g=u):k=k.next=$,Ae.lanes|=ee,Ea|=ee;H=H.next}while(H!==null&&H!==t);if(k===null?g=u:k.next=S,!Yt(u,e.memoizedState)&&(ct=!0,J&&(n=kl,n!==null)))throw n;e.memoizedState=u,e.baseState=g,e.baseQueue=k,s.lastRenderedState=u}return c===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function Sc(e){var t=lt(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var s=n.dispatch,c=n.pending,u=t.memoizedState;if(c!==null){n.pending=null;var g=c=c.next;do u=e(u,g.action),g=g.next;while(g!==c);Yt(u,t.memoizedState)||(ct=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),n.lastRenderedState=u}return[u,s]}function pm(e,t,n){var s=Ae,c=lt(),u=Me;if(u){if(n===void 0)throw Error(r(407));n=n()}else n=t();var g=!Yt((Xe||c).memoizedState,n);if(g&&(c.memoizedState=n,ct=!0),c=c.queue,Nc(vm.bind(null,s,c,e),[e]),c.getSnapshot!==t||g||ot!==null&&ot.memoizedState.tag&1){if(s.flags|=2048,Ll(9,{destroy:void 0},xm.bind(null,s,c,n,t),null),Fe===null)throw Error(r(349));u||(Qn&127)!==0||gm(s,t,n)}return n}function gm(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ae.updateQueue,t===null?(t=ar(),Ae.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function xm(e,t,n,s){t.value=n,t.getSnapshot=s,ym(t)&&bm(e)}function vm(e,t,n){return n(function(){ym(t)&&bm(e)})}function ym(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Yt(e,n)}catch{return!0}}function bm(e){var t=Fa(e,2);t!==null&&Bt(t,e,2)}function Ac(e){var t=Ct();if(typeof e=="function"){var n=e;if(e=n(),al){Mt(!0);try{n()}finally{Mt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kn,lastRenderedState:e},t}function Sm(e,t,n,s){return e.baseState=n,bc(e,Xe,typeof s=="function"?s:Kn)}function Nv(e,t,n,s,c){if(or(e))throw Error(r(485));if(e=t.action,e!==null){var u={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(g){u.listeners.push(g)}};q.T!==null?n(!0):u.isTransition=!1,s(u),n=t.pending,n===null?(u.next=t.pending=u,Am(t,u)):(u.next=n.next,t.pending=n.next=u)}}function Am(e,t){var n=t.action,s=t.payload,c=e.state;if(t.isTransition){var u=q.T,g={};q.T=g;try{var S=n(c,s),k=q.S;k!==null&&k(g,S),jm(e,t,S)}catch(H){jc(e,t,H)}finally{u!==null&&g.types!==null&&(u.types=g.types),q.T=u}}else try{u=n(c,s),jm(e,t,u)}catch(H){jc(e,t,H)}}function jm(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(s){Nm(e,t,s)},function(s){return jc(e,t,s)}):Nm(e,t,n)}function Nm(e,t,n){t.status="fulfilled",t.value=n,wm(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Am(e,n)))}function jc(e,t,n){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=n,wm(t),t=t.next;while(t!==s)}e.action=null}function wm(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Em(e,t){return t}function Cm(e,t){if(Me){var n=Fe.formState;if(n!==null){e:{var s=Ae;if(Me){if(Je){t:{for(var c=Je,u=nn;c.nodeType!==8;){if(!u){c=null;break t}if(c=ln(c.nextSibling),c===null){c=null;break t}}u=c.data,c=u==="F!"||u==="F"?c:null}if(c){Je=ln(c.nextSibling),s=c.data==="F!";break e}}xa(s)}s=!1}s&&(t=n[0])}}return n=Ct(),n.memoizedState=n.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Em,lastRenderedState:t},n.queue=s,n=Qm.bind(null,Ae,s),s.dispatch=n,s=Ac(!1),u=Mc.bind(null,Ae,!1,s.queue),s=Ct(),c={state:t,dispatch:null,action:e,pending:null},s.queue=c,n=Nv.bind(null,Ae,c,u,n),c.dispatch=n,s.memoizedState=e,[t,n,!1]}function qm(e){var t=lt();return Mm(t,Xe,e)}function Mm(e,t,n){if(t=bc(e,t,Em)[0],e=sr(Kn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=Ds(t)}catch(g){throw g===Tl?Zi:g}else s=t;t=lt();var c=t.queue,u=c.dispatch;return n!==t.memoizedState&&(Ae.flags|=2048,Ll(9,{destroy:void 0},wv.bind(null,c,n),null)),[s,u,e]}function wv(e,t){e.action=t}function Rm(e){var t=lt(),n=Xe;if(n!==null)return Mm(t,n,e);lt(),t=t.memoizedState,n=lt();var s=n.queue.dispatch;return n.memoizedState=e,[t,s,!1]}function Ll(e,t,n,s){return e={tag:e,create:n,deps:s,inst:t,next:null},t=Ae.updateQueue,t===null&&(t=ar(),Ae.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(s=n.next,n.next=e,e.next=s,t.lastEffect=e),e}function km(){return lt().memoizedState}function ir(e,t,n,s){var c=Ct();Ae.flags|=e,c.memoizedState=Ll(1|t,{destroy:void 0},n,s===void 0?null:s)}function rr(e,t,n,s){var c=lt();s=s===void 0?null:s;var u=c.memoizedState.inst;Xe!==null&&s!==null&&hc(s,Xe.memoizedState.deps)?c.memoizedState=Ll(t,u,n,s):(Ae.flags|=e,c.memoizedState=Ll(1|t,u,n,s))}function Tm(e,t){ir(8390656,8,e,t)}function Nc(e,t){rr(2048,8,e,t)}function Ev(e){Ae.flags|=4;var t=Ae.updateQueue;if(t===null)t=ar(),Ae.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function _m(e){var t=lt().memoizedState;return Ev({ref:t,nextImpl:e}),function(){if((Le&2)!==0)throw Error(r(440));return t.impl.apply(void 0,arguments)}}function Dm(e,t){return rr(4,2,e,t)}function Om(e,t){return rr(4,4,e,t)}function Bm(e,t){if(typeof t=="function"){e=e();var n=t(e);return function(){typeof n=="function"?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Lm(e,t,n){n=n!=null?n.concat([e]):null,rr(4,4,Bm.bind(null,t,e),n)}function wc(){}function zm(e,t){var n=lt();t=t===void 0?null:t;var s=n.memoizedState;return t!==null&&hc(t,s[1])?s[0]:(n.memoizedState=[e,t],e)}function Um(e,t){var n=lt();t=t===void 0?null:t;var s=n.memoizedState;if(t!==null&&hc(t,s[1]))return s[0];if(s=e(),al){Mt(!0);try{e()}finally{Mt(!1)}}return n.memoizedState=[s,t],s}function Ec(e,t,n){return n===void 0||(Qn&1073741824)!==0&&(Ce&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=Hh(),Ae.lanes|=e,Ea|=e,n)}function Hm(e,t,n,s){return Yt(n,t)?n:Dl.current!==null?(e=Ec(e,n,s),Yt(e,t)||(ct=!0),e):(Qn&42)===0||(Qn&1073741824)!==0&&(Ce&261930)===0?(ct=!0,e.memoizedState=n):(e=Hh(),Ae.lanes|=e,Ea|=e,t)}function Vm(e,t,n,s,c){var u=X.p;X.p=u!==0&&8>u?u:8;var g=q.T,S={};q.T=S,Mc(e,!1,t,n);try{var k=c(),H=q.S;if(H!==null&&H(S,k),k!==null&&typeof k=="object"&&typeof k.then=="function"){var J=Sv(k,s);Os(e,t,J,Ft(e))}else Os(e,t,s,Ft(e))}catch(ee){Os(e,t,{then:function(){},status:"rejected",reason:ee},Ft())}finally{X.p=u,g!==null&&S.types!==null&&(g.types=S.types),q.T=g}}function Cv(){}function Cc(e,t,n,s){if(e.tag!==5)throw Error(r(476));var c=Ym(e).queue;Vm(e,c,t,W,n===null?Cv:function(){return $m(e),n(s)})}function Ym(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:W,baseState:W,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kn,lastRenderedState:W},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kn,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function $m(e){var t=Ym(e);t.next===null&&(t=e.alternate.memoizedState),Os(e,t.next.queue,{},Ft())}function qc(){return vt(Ws)}function Gm(){return lt().memoizedState}function Xm(){return lt().memoizedState}function qv(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Ft();e=ba(n);var s=Sa(t,e,n);s!==null&&(Bt(s,t,n),Rs(s,t,n)),t={cache:ac()},e.payload=t;return}t=t.return}}function Mv(e,t,n){var s=Ft();n={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},or(e)?Km(t,n):(n=Qo(e,t,n,s),n!==null&&(Bt(n,e,s),Fm(n,t,s)))}function Qm(e,t,n){var s=Ft();Os(e,t,n,s)}function Os(e,t,n,s){var c={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(or(e))Km(t,c);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var g=t.lastRenderedState,S=u(g,n);if(c.hasEagerState=!0,c.eagerState=S,Yt(S,g))return Yi(e,t,c,0),Fe===null&&Vi(),!1}catch{}finally{}if(n=Qo(e,t,c,s),n!==null)return Bt(n,e,s),Fm(n,t,s),!0}return!1}function Mc(e,t,n,s){if(s={lane:2,revertLane:ru(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},or(e)){if(t)throw Error(r(479))}else t=Qo(e,n,s,2),t!==null&&Bt(t,e,2)}function or(e){var t=e.alternate;return e===Ae||t!==null&&t===Ae}function Km(e,t){Ol=tr=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Fm(e,t,n){if((n&4194048)!==0){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,da(e,n)}}var Bs={readContext:vt,use:lr,useCallback:tt,useContext:tt,useEffect:tt,useImperativeHandle:tt,useLayoutEffect:tt,useInsertionEffect:tt,useMemo:tt,useReducer:tt,useRef:tt,useState:tt,useDebugValue:tt,useDeferredValue:tt,useTransition:tt,useSyncExternalStore:tt,useId:tt,useHostTransitionStatus:tt,useFormState:tt,useActionState:tt,useOptimistic:tt,useMemoCache:tt,useCacheRefresh:tt};Bs.useEffectEvent=tt;var Zm={readContext:vt,use:lr,useCallback:function(e,t){return Ct().memoizedState=[e,t===void 0?null:t],e},useContext:vt,useEffect:Tm,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,ir(4194308,4,Bm.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ir(4194308,4,e,t)},useInsertionEffect:function(e,t){ir(4,2,e,t)},useMemo:function(e,t){var n=Ct();t=t===void 0?null:t;var s=e();if(al){Mt(!0);try{e()}finally{Mt(!1)}}return n.memoizedState=[s,t],s},useReducer:function(e,t,n){var s=Ct();if(n!==void 0){var c=n(t);if(al){Mt(!0);try{n(t)}finally{Mt(!1)}}}else c=t;return s.memoizedState=s.baseState=c,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:c},s.queue=e,e=e.dispatch=Mv.bind(null,Ae,e),[s.memoizedState,e]},useRef:function(e){var t=Ct();return e={current:e},t.memoizedState=e},useState:function(e){e=Ac(e);var t=e.queue,n=Qm.bind(null,Ae,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:wc,useDeferredValue:function(e,t){var n=Ct();return Ec(n,e,t)},useTransition:function(){var e=Ac(!1);return e=Vm.bind(null,Ae,e.queue,!0,!1),Ct().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var s=Ae,c=Ct();if(Me){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),Fe===null)throw Error(r(349));(Ce&127)!==0||gm(s,t,n)}c.memoizedState=n;var u={value:n,getSnapshot:t};return c.queue=u,Tm(vm.bind(null,s,u,e),[e]),s.flags|=2048,Ll(9,{destroy:void 0},xm.bind(null,s,u,n,t),null),n},useId:function(){var e=Ct(),t=Fe.identifierPrefix;if(Me){var n=wn,s=Nn;n=(s&~(1<<32-ht(s)-1)).toString(32)+n,t="_"+t+"R_"+n,n=nr++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=Av++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:qc,useFormState:Cm,useActionState:Cm,useOptimistic:function(e){var t=Ct();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Mc.bind(null,Ae,!0,n),n.dispatch=t,[e,t]},useMemoCache:yc,useCacheRefresh:function(){return Ct().memoizedState=qv.bind(null,Ae)},useEffectEvent:function(e){var t=Ct(),n={impl:e};return t.memoizedState=n,function(){if((Le&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}},Rc={readContext:vt,use:lr,useCallback:zm,useContext:vt,useEffect:Nc,useImperativeHandle:Lm,useInsertionEffect:Dm,useLayoutEffect:Om,useMemo:Um,useReducer:sr,useRef:km,useState:function(){return sr(Kn)},useDebugValue:wc,useDeferredValue:function(e,t){var n=lt();return Hm(n,Xe.memoizedState,e,t)},useTransition:function(){var e=sr(Kn)[0],t=lt().memoizedState;return[typeof e=="boolean"?e:Ds(e),t]},useSyncExternalStore:pm,useId:Gm,useHostTransitionStatus:qc,useFormState:qm,useActionState:qm,useOptimistic:function(e,t){var n=lt();return Sm(n,Xe,e,t)},useMemoCache:yc,useCacheRefresh:Xm};Rc.useEffectEvent=_m;var Jm={readContext:vt,use:lr,useCallback:zm,useContext:vt,useEffect:Nc,useImperativeHandle:Lm,useInsertionEffect:Dm,useLayoutEffect:Om,useMemo:Um,useReducer:Sc,useRef:km,useState:function(){return Sc(Kn)},useDebugValue:wc,useDeferredValue:function(e,t){var n=lt();return Xe===null?Ec(n,e,t):Hm(n,Xe.memoizedState,e,t)},useTransition:function(){var e=Sc(Kn)[0],t=lt().memoizedState;return[typeof e=="boolean"?e:Ds(e),t]},useSyncExternalStore:pm,useId:Gm,useHostTransitionStatus:qc,useFormState:Rm,useActionState:Rm,useOptimistic:function(e,t){var n=lt();return Xe!==null?Sm(n,Xe,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:yc,useCacheRefresh:Xm};Jm.useEffectEvent=_m;function kc(e,t,n,s){t=e.memoizedState,n=n(s,t),n=n==null?t:b({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Tc={enqueueSetState:function(e,t,n){e=e._reactInternals;var s=Ft(),c=ba(s);c.payload=t,n!=null&&(c.callback=n),t=Sa(e,c,s),t!==null&&(Bt(t,e,s),Rs(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var s=Ft(),c=ba(s);c.tag=1,c.payload=t,n!=null&&(c.callback=n),t=Sa(e,c,s),t!==null&&(Bt(t,e,s),Rs(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Ft(),s=ba(n);s.tag=2,t!=null&&(s.callback=t),t=Sa(e,s,n),t!==null&&(Bt(t,e,n),Rs(t,e,n))}};function Im(e,t,n,s,c,u,g){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,u,g):t.prototype&&t.prototype.isPureReactComponent?!As(n,s)||!As(c,u):!0}function Wm(e,t,n,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,s),t.state!==e&&Tc.enqueueReplaceState(t,t.state,null)}function ll(e,t){var n=t;if("ref"in t){n={};for(var s in t)s!=="ref"&&(n[s]=t[s])}if(e=e.defaultProps){n===t&&(n=b({},n));for(var c in e)n[c]===void 0&&(n[c]=e[c])}return n}function Pm(e){Hi(e)}function eh(e){console.error(e)}function th(e){Hi(e)}function cr(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function nh(e,t,n){try{var s=e.onCaughtError;s(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(c){setTimeout(function(){throw c})}}function _c(e,t,n){return n=ba(n),n.tag=3,n.payload={element:null},n.callback=function(){cr(e,t)},n}function ah(e){return e=ba(e),e.tag=3,e}function lh(e,t,n,s){var c=n.type.getDerivedStateFromError;if(typeof c=="function"){var u=s.value;e.payload=function(){return c(u)},e.callback=function(){nh(t,n,s)}}var g=n.stateNode;g!==null&&typeof g.componentDidCatch=="function"&&(e.callback=function(){nh(t,n,s),typeof c!="function"&&(Ca===null?Ca=new Set([this]):Ca.add(this));var S=s.stack;this.componentDidCatch(s.value,{componentStack:S!==null?S:""})})}function Rv(e,t,n,s,c){if(n.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=n.alternate,t!==null&&Ml(t,n,c,!0),n=Gt.current,n!==null){switch(n.tag){case 31:case 13:return an===null?Sr():n.alternate===null&&nt===0&&(nt=3),n.flags&=-257,n.flags|=65536,n.lanes=c,s===Ji?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([s]):t.add(s),lu(e,s,c)),!1;case 22:return n.flags|=65536,s===Ji?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([s])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([s]):n.add(s)),lu(e,s,c)),!1}throw Error(r(435,n.tag))}return lu(e,s,c),Sr(),!1}if(Me)return t=Gt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,s!==Wo&&(e=Error(r(422),{cause:s}),ws(Pt(e,n)))):(s!==Wo&&(t=Error(r(423),{cause:s}),ws(Pt(t,n))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,s=Pt(s,n),c=_c(e.stateNode,s,c),cc(e,c),nt!==4&&(nt=2)),!1;var u=Error(r(520),{cause:s});if(u=Pt(u,n),Gs===null?Gs=[u]:Gs.push(u),nt!==4&&(nt=2),t===null)return!0;s=Pt(s,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=c&-c,n.lanes|=e,e=_c(n.stateNode,s,e),cc(n,e),!1;case 1:if(t=n.type,u=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||u!==null&&typeof u.componentDidCatch=="function"&&(Ca===null||!Ca.has(u))))return n.flags|=65536,c&=-c,n.lanes|=c,c=ah(c),lh(c,e,n,s),cc(n,c),!1}n=n.return}while(n!==null);return!1}var Dc=Error(r(461)),ct=!1;function yt(e,t,n,s){t.child=e===null?om(t,null,n,s):nl(t,e.child,n,s)}function sh(e,t,n,s,c){n=n.render;var u=t.ref;if("ref"in s){var g={};for(var S in s)S!=="ref"&&(g[S]=s[S])}else g=s;return Wa(t),s=pc(e,t,n,g,u,c),S=gc(),e!==null&&!ct?(xc(e,t,c),Fn(e,t,c)):(Me&&S&&Jo(t),t.flags|=1,yt(e,t,s,c),t.child)}function ih(e,t,n,s,c){if(e===null){var u=n.type;return typeof u=="function"&&!Ko(u)&&u.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=u,rh(e,t,u,s,c)):(e=Gi(n.type,null,s,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!Yc(e,c)){var g=u.memoizedProps;if(n=n.compare,n=n!==null?n:As,n(g,s)&&e.ref===t.ref)return Fn(e,t,c)}return t.flags|=1,e=Yn(u,s),e.ref=t.ref,e.return=t,t.child=e}function rh(e,t,n,s,c){if(e!==null){var u=e.memoizedProps;if(As(u,s)&&e.ref===t.ref)if(ct=!1,t.pendingProps=s=u,Yc(e,c))(e.flags&131072)!==0&&(ct=!0);else return t.lanes=e.lanes,Fn(e,t,c)}return Oc(e,t,n,s,c)}function oh(e,t,n,s){var c=s.children,u=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.mode==="hidden"){if((t.flags&128)!==0){if(u=u!==null?u.baseLanes|n:n,e!==null){for(s=t.child=e.child,c=0;s!==null;)c=c|s.lanes|s.childLanes,s=s.sibling;s=c&~u}else s=0,t.child=null;return ch(e,t,u,n,s)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Fi(t,u!==null?u.cachePool:null),u!==null?fm(t,u):fc(),dm(t);else return s=t.lanes=536870912,ch(e,t,u!==null?u.baseLanes|n:n,n,s)}else u!==null?(Fi(t,u.cachePool),fm(t,u),ja(),t.memoizedState=null):(e!==null&&Fi(t,null),fc(),ja());return yt(e,t,c,n),t.child}function Ls(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function ch(e,t,n,s,c){var u=sc();return u=u===null?null:{parent:rt._currentValue,pool:u},t.memoizedState={baseLanes:n,cachePool:u},e!==null&&Fi(t,null),fc(),dm(t),e!==null&&Ml(e,t,s,!0),t.childLanes=c,null}function ur(e,t){return t=dr({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function uh(e,t,n){return nl(t,e.child,null,n),e=ur(t,t.pendingProps),e.flags|=2,Xt(t),t.memoizedState=null,e}function kv(e,t,n){var s=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Me){if(s.mode==="hidden")return e=ur(t,s),t.lanes=536870912,Ls(null,e);if(mc(t),(e=Je)?(e=A0(e,nn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:pa!==null?{id:Nn,overflow:wn}:null,retryLane:536870912,hydrationErrors:null},n=Kd(e),n.return=t,t.child=n,xt=t,Je=null)):e=null,e===null)throw xa(t);return t.lanes=536870912,null}return ur(t,s)}var u=e.memoizedState;if(u!==null){var g=u.dehydrated;if(mc(t),c)if(t.flags&256)t.flags&=-257,t=uh(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(r(558));else if(ct||Ml(e,t,n,!1),c=(n&e.childLanes)!==0,ct||c){if(s=Fe,s!==null&&(g=pl(s,n),g!==0&&g!==u.retryLane))throw u.retryLane=g,Fa(e,g),Bt(s,e,g),Dc;Sr(),t=uh(e,t,n)}else e=u.treeContext,Je=ln(g.nextSibling),xt=t,Me=!0,ga=null,nn=!1,e!==null&&Jd(t,e),t=ur(t,s),t.flags|=4096;return t}return e=Yn(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function fr(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(r(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function Oc(e,t,n,s,c){return Wa(t),n=pc(e,t,n,s,void 0,c),s=gc(),e!==null&&!ct?(xc(e,t,c),Fn(e,t,c)):(Me&&s&&Jo(t),t.flags|=1,yt(e,t,n,c),t.child)}function fh(e,t,n,s,c,u){return Wa(t),t.updateQueue=null,n=hm(t,s,n,c),mm(e),s=gc(),e!==null&&!ct?(xc(e,t,u),Fn(e,t,u)):(Me&&s&&Jo(t),t.flags|=1,yt(e,t,n,u),t.child)}function dh(e,t,n,s,c){if(Wa(t),t.stateNode===null){var u=wl,g=n.contextType;typeof g=="object"&&g!==null&&(u=vt(g)),u=new n(s,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=Tc,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=s,u.state=t.memoizedState,u.refs={},rc(t),g=n.contextType,u.context=typeof g=="object"&&g!==null?vt(g):wl,u.state=t.memoizedState,g=n.getDerivedStateFromProps,typeof g=="function"&&(kc(t,n,g,s),u.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(g=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),g!==u.state&&Tc.enqueueReplaceState(u,u.state,null),Ts(t,s,u,c),ks(),u.state=t.memoizedState),typeof u.componentDidMount=="function"&&(t.flags|=4194308),s=!0}else if(e===null){u=t.stateNode;var S=t.memoizedProps,k=ll(n,S);u.props=k;var H=u.context,J=n.contextType;g=wl,typeof J=="object"&&J!==null&&(g=vt(J));var ee=n.getDerivedStateFromProps;J=typeof ee=="function"||typeof u.getSnapshotBeforeUpdate=="function",S=t.pendingProps!==S,J||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(S||H!==g)&&Wm(t,u,s,g),ya=!1;var $=t.memoizedState;u.state=$,Ts(t,s,u,c),ks(),H=t.memoizedState,S||$!==H||ya?(typeof ee=="function"&&(kc(t,n,ee,s),H=t.memoizedState),(k=ya||Im(t,n,k,s,$,H,g))?(J||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(t.flags|=4194308)):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=H),u.props=s,u.state=H,u.context=g,s=k):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{u=t.stateNode,oc(e,t),g=t.memoizedProps,J=ll(n,g),u.props=J,ee=t.pendingProps,$=u.context,H=n.contextType,k=wl,typeof H=="object"&&H!==null&&(k=vt(H)),S=n.getDerivedStateFromProps,(H=typeof S=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(g!==ee||$!==k)&&Wm(t,u,s,k),ya=!1,$=t.memoizedState,u.state=$,Ts(t,s,u,c),ks();var K=t.memoizedState;g!==ee||$!==K||ya||e!==null&&e.dependencies!==null&&Qi(e.dependencies)?(typeof S=="function"&&(kc(t,n,S,s),K=t.memoizedState),(J=ya||Im(t,n,J,s,$,K,k)||e!==null&&e.dependencies!==null&&Qi(e.dependencies))?(H||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(s,K,k),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(s,K,k)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||g===e.memoizedProps&&$===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||g===e.memoizedProps&&$===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=K),u.props=s,u.state=K,u.context=k,s=J):(typeof u.componentDidUpdate!="function"||g===e.memoizedProps&&$===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||g===e.memoizedProps&&$===e.memoizedState||(t.flags|=1024),s=!1)}return u=s,fr(e,t),s=(t.flags&128)!==0,u||s?(u=t.stateNode,n=s&&typeof n.getDerivedStateFromError!="function"?null:u.render(),t.flags|=1,e!==null&&s?(t.child=nl(t,e.child,null,c),t.child=nl(t,null,n,c)):yt(e,t,n,c),t.memoizedState=u.state,e=t.child):e=Fn(e,t,c),e}function mh(e,t,n,s){return Ja(),t.flags|=256,yt(e,t,n,s),t.child}var Bc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Lc(e){return{baseLanes:e,cachePool:nm()}}function zc(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Kt),e}function hh(e,t,n){var s=t.pendingProps,c=!1,u=(t.flags&128)!==0,g;if((g=u)||(g=e!==null&&e.memoizedState===null?!1:(at.current&2)!==0),g&&(c=!0,t.flags&=-129),g=(t.flags&32)!==0,t.flags&=-33,e===null){if(Me){if(c?Aa(t):ja(),(e=Je)?(e=A0(e,nn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:pa!==null?{id:Nn,overflow:wn}:null,retryLane:536870912,hydrationErrors:null},n=Kd(e),n.return=t,t.child=n,xt=t,Je=null)):e=null,e===null)throw xa(t);return bu(e)?t.lanes=32:t.lanes=536870912,null}var S=s.children;return s=s.fallback,c?(ja(),c=t.mode,S=dr({mode:"hidden",children:S},c),s=Za(s,c,n,null),S.return=t,s.return=t,S.sibling=s,t.child=S,s=t.child,s.memoizedState=Lc(n),s.childLanes=zc(e,g,n),t.memoizedState=Bc,Ls(null,s)):(Aa(t),Uc(t,S))}var k=e.memoizedState;if(k!==null&&(S=k.dehydrated,S!==null)){if(u)t.flags&256?(Aa(t),t.flags&=-257,t=Hc(e,t,n)):t.memoizedState!==null?(ja(),t.child=e.child,t.flags|=128,t=null):(ja(),S=s.fallback,c=t.mode,s=dr({mode:"visible",children:s.children},c),S=Za(S,c,n,null),S.flags|=2,s.return=t,S.return=t,s.sibling=S,t.child=s,nl(t,e.child,null,n),s=t.child,s.memoizedState=Lc(n),s.childLanes=zc(e,g,n),t.memoizedState=Bc,t=Ls(null,s));else if(Aa(t),bu(S)){if(g=S.nextSibling&&S.nextSibling.dataset,g)var H=g.dgst;g=H,s=Error(r(419)),s.stack="",s.digest=g,ws({value:s,source:null,stack:null}),t=Hc(e,t,n)}else if(ct||Ml(e,t,n,!1),g=(n&e.childLanes)!==0,ct||g){if(g=Fe,g!==null&&(s=pl(g,n),s!==0&&s!==k.retryLane))throw k.retryLane=s,Fa(e,s),Bt(g,e,s),Dc;yu(S)||Sr(),t=Hc(e,t,n)}else yu(S)?(t.flags|=192,t.child=e.child,t=null):(e=k.treeContext,Je=ln(S.nextSibling),xt=t,Me=!0,ga=null,nn=!1,e!==null&&Jd(t,e),t=Uc(t,s.children),t.flags|=4096);return t}return c?(ja(),S=s.fallback,c=t.mode,k=e.child,H=k.sibling,s=Yn(k,{mode:"hidden",children:s.children}),s.subtreeFlags=k.subtreeFlags&65011712,H!==null?S=Yn(H,S):(S=Za(S,c,n,null),S.flags|=2),S.return=t,s.return=t,s.sibling=S,t.child=s,Ls(null,s),s=t.child,S=e.child.memoizedState,S===null?S=Lc(n):(c=S.cachePool,c!==null?(k=rt._currentValue,c=c.parent!==k?{parent:k,pool:k}:c):c=nm(),S={baseLanes:S.baseLanes|n,cachePool:c}),s.memoizedState=S,s.childLanes=zc(e,g,n),t.memoizedState=Bc,Ls(e.child,s)):(Aa(t),n=e.child,e=n.sibling,n=Yn(n,{mode:"visible",children:s.children}),n.return=t,n.sibling=null,e!==null&&(g=t.deletions,g===null?(t.deletions=[e],t.flags|=16):g.push(e)),t.child=n,t.memoizedState=null,n)}function Uc(e,t){return t=dr({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function dr(e,t){return e=$t(22,e,null,t),e.lanes=0,e}function Hc(e,t,n){return nl(t,e.child,null,n),e=Uc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function ph(e,t,n){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),tc(e.return,t,n)}function Vc(e,t,n,s,c,u){var g=e.memoizedState;g===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:n,tailMode:c,treeForkCount:u}:(g.isBackwards=t,g.rendering=null,g.renderingStartTime=0,g.last=s,g.tail=n,g.tailMode=c,g.treeForkCount=u)}function gh(e,t,n){var s=t.pendingProps,c=s.revealOrder,u=s.tail;s=s.children;var g=at.current,S=(g&2)!==0;if(S?(g=g&1|2,t.flags|=128):g&=1,P(at,g),yt(e,t,s,n),s=Me?Ns:0,!S&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&ph(e,n,t);else if(e.tag===19)ph(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(c){case"forwards":for(n=t.child,c=null;n!==null;)e=n.alternate,e!==null&&er(e)===null&&(c=n),n=n.sibling;n=c,n===null?(c=t.child,t.child=null):(c=n.sibling,n.sibling=null),Vc(t,!1,c,n,u,s);break;case"backwards":case"unstable_legacy-backwards":for(n=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&er(e)===null){t.child=c;break}e=c.sibling,c.sibling=n,n=c,c=e}Vc(t,!0,n,null,u,s);break;case"together":Vc(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function Fn(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ea|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Ml(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,n=Yn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Yn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Yc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Qi(e)))}function Tv(e,t,n){switch(t.tag){case 3:ve(t,t.stateNode.containerInfo),va(t,rt,e.memoizedState.cache),Ja();break;case 27:case 5:Oe(t);break;case 4:ve(t,t.stateNode.containerInfo);break;case 10:va(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,mc(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(Aa(t),t.flags|=128,null):(n&t.child.childLanes)!==0?hh(e,t,n):(Aa(t),e=Fn(e,t,n),e!==null?e.sibling:null);Aa(t);break;case 19:var c=(e.flags&128)!==0;if(s=(n&t.childLanes)!==0,s||(Ml(e,t,n,!1),s=(n&t.childLanes)!==0),c){if(s)return gh(e,t,n);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),P(at,at.current),s)break;return null;case 22:return t.lanes=0,oh(e,t,n,t.pendingProps);case 24:va(t,rt,e.memoizedState.cache)}return Fn(e,t,n)}function xh(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)ct=!0;else{if(!Yc(e,n)&&(t.flags&128)===0)return ct=!1,Tv(e,t,n);ct=(e.flags&131072)!==0}else ct=!1,Me&&(t.flags&1048576)!==0&&Zd(t,Ns,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=el(t.elementType),t.type=e,typeof e=="function")Ko(e)?(s=ll(e,s),t.tag=1,t=dh(null,t,e,s,n)):(t.tag=0,t=Oc(null,t,e,s,n));else{if(e!=null){var c=e.$$typeof;if(c===O){t.tag=11,t=sh(null,t,e,s,n);break e}else if(c===D){t.tag=14,t=ih(null,t,e,s,n);break e}}throw t=pe(e)||e,Error(r(306,t,""))}}return t;case 0:return Oc(e,t,t.type,t.pendingProps,n);case 1:return s=t.type,c=ll(s,t.pendingProps),dh(e,t,s,c,n);case 3:e:{if(ve(t,t.stateNode.containerInfo),e===null)throw Error(r(387));s=t.pendingProps;var u=t.memoizedState;c=u.element,oc(e,t),Ts(t,s,null,n);var g=t.memoizedState;if(s=g.cache,va(t,rt,s),s!==u.cache&&nc(t,[rt],n,!0),ks(),s=g.element,u.isDehydrated)if(u={element:s,isDehydrated:!1,cache:g.cache},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){t=mh(e,t,s,n);break e}else if(s!==c){c=Pt(Error(r(424)),t),ws(c),t=mh(e,t,s,n);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Je=ln(e.firstChild),xt=t,Me=!0,ga=null,nn=!0,n=om(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ja(),s===c){t=Fn(e,t,n);break e}yt(e,t,s,n)}t=t.child}return t;case 26:return fr(e,t),e===null?(n=q0(t.type,null,t.pendingProps,null))?t.memoizedState=n:Me||(n=t.type,e=t.pendingProps,s=qr(se.current).createElement(n),s[dt]=t,s[jt]=e,bt(s,n,e),Ze(s),t.stateNode=s):t.memoizedState=q0(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Oe(t),e===null&&Me&&(s=t.stateNode=w0(t.type,t.pendingProps,se.current),xt=t,nn=!0,c=Je,ka(t.type)?(Su=c,Je=ln(s.firstChild)):Je=c),yt(e,t,t.pendingProps.children,n),fr(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Me&&((c=s=Je)&&(s=oy(s,t.type,t.pendingProps,nn),s!==null?(t.stateNode=s,xt=t,Je=ln(s.firstChild),nn=!1,c=!0):c=!1),c||xa(t)),Oe(t),c=t.type,u=t.pendingProps,g=e!==null?e.memoizedProps:null,s=u.children,gu(c,u)?s=null:g!==null&&gu(c,g)&&(t.flags|=32),t.memoizedState!==null&&(c=pc(e,t,jv,null,null,n),Ws._currentValue=c),fr(e,t),yt(e,t,s,n),t.child;case 6:return e===null&&Me&&((e=n=Je)&&(n=cy(n,t.pendingProps,nn),n!==null?(t.stateNode=n,xt=t,Je=null,e=!0):e=!1),e||xa(t)),null;case 13:return hh(e,t,n);case 4:return ve(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=nl(t,null,s,n):yt(e,t,s,n),t.child;case 11:return sh(e,t,t.type,t.pendingProps,n);case 7:return yt(e,t,t.pendingProps,n),t.child;case 8:return yt(e,t,t.pendingProps.children,n),t.child;case 12:return yt(e,t,t.pendingProps.children,n),t.child;case 10:return s=t.pendingProps,va(t,t.type,s.value),yt(e,t,s.children,n),t.child;case 9:return c=t.type._context,s=t.pendingProps.children,Wa(t),c=vt(c),s=s(c),t.flags|=1,yt(e,t,s,n),t.child;case 14:return ih(e,t,t.type,t.pendingProps,n);case 15:return rh(e,t,t.type,t.pendingProps,n);case 19:return gh(e,t,n);case 31:return kv(e,t,n);case 22:return oh(e,t,n,t.pendingProps);case 24:return Wa(t),s=vt(rt),e===null?(c=sc(),c===null&&(c=Fe,u=ac(),c.pooledCache=u,u.refCount++,u!==null&&(c.pooledCacheLanes|=n),c=u),t.memoizedState={parent:s,cache:c},rc(t),va(t,rt,c)):((e.lanes&n)!==0&&(oc(e,t),Ts(t,null,null,n),ks()),c=e.memoizedState,u=t.memoizedState,c.parent!==s?(c={parent:s,cache:s},t.memoizedState=c,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=c),va(t,rt,s)):(s=u.cache,va(t,rt,s),s!==c.cache&&nc(t,[rt],n,!0))),yt(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(r(156,t.tag))}function Zn(e){e.flags|=4}function $c(e,t,n,s,c){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(c&335544128)===c)if(e.stateNode.complete)e.flags|=8192;else if(Gh())e.flags|=8192;else throw tl=Ji,ic}else e.flags&=-16777217}function vh(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!_0(t))if(Gh())e.flags|=8192;else throw tl=Ji,ic}function mr(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Ya():536870912,e.lanes|=t,Vl|=t)}function zs(e,t){if(!Me)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var s=null;n!==null;)n.alternate!==null&&(s=n),n=n.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function Ie(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,s=0;if(t)for(var c=e.child;c!==null;)n|=c.lanes|c.childLanes,s|=c.subtreeFlags&65011712,s|=c.flags&65011712,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)n|=c.lanes|c.childLanes,s|=c.subtreeFlags,s|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=s,e.childLanes=n,t}function _v(e,t,n){var s=t.pendingProps;switch(Io(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ie(t),null;case 1:return Ie(t),null;case 3:return n=t.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),Xn(rt),he(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ql(t)?Zn(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Po())),Ie(t),null;case 26:var c=t.type,u=t.memoizedState;return e===null?(Zn(t),u!==null?(Ie(t),vh(t,u)):(Ie(t),$c(t,c,null,s,n))):u?u!==e.memoizedState?(Zn(t),Ie(t),vh(t,u)):(Ie(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&Zn(t),Ie(t),$c(t,c,e,s,n)),null;case 27:if(te(t),n=se.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&Zn(t);else{if(!s){if(t.stateNode===null)throw Error(r(166));return Ie(t),null}e=ae.current,ql(t)?Id(t):(e=w0(c,s,n),t.stateNode=e,Zn(t))}return Ie(t),null;case 5:if(te(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&Zn(t);else{if(!s){if(t.stateNode===null)throw Error(r(166));return Ie(t),null}if(u=ae.current,ql(t))Id(t);else{var g=qr(se.current);switch(u){case 1:u=g.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:u=g.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":u=g.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":u=g.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":u=g.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof s.is=="string"?g.createElement("select",{is:s.is}):g.createElement("select"),s.multiple?u.multiple=!0:s.size&&(u.size=s.size);break;default:u=typeof s.is=="string"?g.createElement(c,{is:s.is}):g.createElement(c)}}u[dt]=t,u[jt]=s;e:for(g=t.child;g!==null;){if(g.tag===5||g.tag===6)u.appendChild(g.stateNode);else if(g.tag!==4&&g.tag!==27&&g.child!==null){g.child.return=g,g=g.child;continue}if(g===t)break e;for(;g.sibling===null;){if(g.return===null||g.return===t)break e;g=g.return}g.sibling.return=g.return,g=g.sibling}t.stateNode=u;e:switch(bt(u,c,s),c){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&Zn(t)}}return Ie(t),$c(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&Zn(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(r(166));if(e=se.current,ql(t)){if(e=t.stateNode,n=t.memoizedProps,s=null,c=xt,c!==null)switch(c.tag){case 27:case 5:s=c.memoizedProps}e[dt]=t,e=!!(e.nodeValue===n||s!==null&&s.suppressHydrationWarning===!0||h0(e.nodeValue,n)),e||xa(t,!0)}else e=qr(e).createTextNode(s),e[dt]=t,t.stateNode=e}return Ie(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(s=ql(t),n!==null){if(e===null){if(!s)throw Error(r(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(557));e[dt]=t}else Ja(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ie(t),e=!1}else n=Po(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Xt(t),t):(Xt(t),null);if((t.flags&128)!==0)throw Error(r(558))}return Ie(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=ql(t),s!==null&&s.dehydrated!==null){if(e===null){if(!c)throw Error(r(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(r(317));c[dt]=t}else Ja(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ie(t),c=!1}else c=Po(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(Xt(t),t):(Xt(t),null)}return Xt(t),(t.flags&128)!==0?(t.lanes=n,t):(n=s!==null,e=e!==null&&e.memoizedState!==null,n&&(s=t.child,c=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(c=s.alternate.memoizedState.cachePool.pool),u=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),u!==c&&(s.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),mr(t,t.updateQueue),Ie(t),null);case 4:return he(),e===null&&fu(t.stateNode.containerInfo),Ie(t),null;case 10:return Xn(t.type),Ie(t),null;case 19:if(z(at),s=t.memoizedState,s===null)return Ie(t),null;if(c=(t.flags&128)!==0,u=s.rendering,u===null)if(c)zs(s,!1);else{if(nt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=er(e),u!==null){for(t.flags|=128,zs(s,!1),e=u.updateQueue,t.updateQueue=e,mr(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Qd(n,e),n=n.sibling;return P(at,at.current&1|2),Me&&$n(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&wt()>vr&&(t.flags|=128,c=!0,zs(s,!1),t.lanes=4194304)}else{if(!c)if(e=er(u),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,mr(t,e),zs(s,!0),s.tail===null&&s.tailMode==="hidden"&&!u.alternate&&!Me)return Ie(t),null}else 2*wt()-s.renderingStartTime>vr&&n!==536870912&&(t.flags|=128,c=!0,zs(s,!1),t.lanes=4194304);s.isBackwards?(u.sibling=t.child,t.child=u):(e=s.last,e!==null?e.sibling=u:t.child=u,s.last=u)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=wt(),e.sibling=null,n=at.current,P(at,c?n&1|2:n&1),Me&&$n(t,s.treeForkCount),e):(Ie(t),null);case 22:case 23:return Xt(t),dc(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?(n&536870912)!==0&&(t.flags&128)===0&&(Ie(t),t.subtreeFlags&6&&(t.flags|=8192)):Ie(t),n=t.updateQueue,n!==null&&mr(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),s=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),s!==n&&(t.flags|=2048),e!==null&&z(Pa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Xn(rt),Ie(t),null;case 25:return null;case 30:return null}throw Error(r(156,t.tag))}function Dv(e,t){switch(Io(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Xn(rt),he(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return te(t),null;case 31:if(t.memoizedState!==null){if(Xt(t),t.alternate===null)throw Error(r(340));Ja()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Xt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Ja()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return z(at),null;case 4:return he(),null;case 10:return Xn(t.type),null;case 22:case 23:return Xt(t),dc(),e!==null&&z(Pa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Xn(rt),null;case 25:return null;default:return null}}function yh(e,t){switch(Io(t),t.tag){case 3:Xn(rt),he();break;case 26:case 27:case 5:te(t);break;case 4:he();break;case 31:t.memoizedState!==null&&Xt(t);break;case 13:Xt(t);break;case 19:z(at);break;case 10:Xn(t.type);break;case 22:case 23:Xt(t),dc(),e!==null&&z(Pa);break;case 24:Xn(rt)}}function Us(e,t){try{var n=t.updateQueue,s=n!==null?n.lastEffect:null;if(s!==null){var c=s.next;n=c;do{if((n.tag&e)===e){s=void 0;var u=n.create,g=n.inst;s=u(),g.destroy=s}n=n.next}while(n!==c)}}catch(S){Ve(t,t.return,S)}}function Na(e,t,n){try{var s=t.updateQueue,c=s!==null?s.lastEffect:null;if(c!==null){var u=c.next;s=u;do{if((s.tag&e)===e){var g=s.inst,S=g.destroy;if(S!==void 0){g.destroy=void 0,c=t;var k=n,H=S;try{H()}catch(J){Ve(c,k,J)}}}s=s.next}while(s!==u)}}catch(J){Ve(t,t.return,J)}}function bh(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{um(t,n)}catch(s){Ve(e,e.return,s)}}}function Sh(e,t,n){n.props=ll(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(s){Ve(e,t,s)}}function Hs(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof n=="function"?e.refCleanup=n(s):n.current=s}}catch(c){Ve(e,t,c)}}function En(e,t){var n=e.ref,s=e.refCleanup;if(n!==null)if(typeof s=="function")try{s()}catch(c){Ve(e,t,c)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(c){Ve(e,t,c)}else n.current=null}function Ah(e){var t=e.type,n=e.memoizedProps,s=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&s.focus();break e;case"img":n.src?s.src=n.src:n.srcSet&&(s.srcset=n.srcSet)}}catch(c){Ve(e,e.return,c)}}function Gc(e,t,n){try{var s=e.stateNode;ny(s,e.type,n,t),s[jt]=t}catch(c){Ve(e,e.return,c)}}function jh(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ka(e.type)||e.tag===4}function Xc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||jh(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&ka(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Qc(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Hn));else if(s!==4&&(s===27&&ka(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Qc(e,t,n),e=e.sibling;e!==null;)Qc(e,t,n),e=e.sibling}function hr(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(s!==4&&(s===27&&ka(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(hr(e,t,n),e=e.sibling;e!==null;)hr(e,t,n),e=e.sibling}function Nh(e){var t=e.stateNode,n=e.memoizedProps;try{for(var s=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);bt(t,s,n),t[dt]=e,t[jt]=n}catch(u){Ve(e,e.return,u)}}var Jn=!1,ut=!1,Kc=!1,wh=typeof WeakSet=="function"?WeakSet:Set,pt=null;function Ov(e,t){if(e=e.containerInfo,hu=Or,e=Ld(e),Ho(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var s=n.getSelection&&n.getSelection();if(s&&s.rangeCount!==0){n=s.anchorNode;var c=s.anchorOffset,u=s.focusNode;s=s.focusOffset;try{n.nodeType,u.nodeType}catch{n=null;break e}var g=0,S=-1,k=-1,H=0,J=0,ee=e,$=null;t:for(;;){for(var K;ee!==n||c!==0&&ee.nodeType!==3||(S=g+c),ee!==u||s!==0&&ee.nodeType!==3||(k=g+s),ee.nodeType===3&&(g+=ee.nodeValue.length),(K=ee.firstChild)!==null;)$=ee,ee=K;for(;;){if(ee===e)break t;if($===n&&++H===c&&(S=g),$===u&&++J===s&&(k=g),(K=ee.nextSibling)!==null)break;ee=$,$=ee.parentNode}ee=K}n=S===-1||k===-1?null:{start:S,end:k}}else n=null}n=n||{start:0,end:0}}else n=null;for(pu={focusedElem:e,selectionRange:n},Or=!1,pt=t;pt!==null;)if(t=pt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,pt=e;else for(;pt!==null;){switch(t=pt,u=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n<e.length;n++)c=e[n],c.ref.impl=c.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&u!==null){e=void 0,n=t,c=u.memoizedProps,u=u.memoizedState,s=n.stateNode;try{var fe=ll(n.type,c);e=s.getSnapshotBeforeUpdate(fe,u),s.__reactInternalSnapshotBeforeUpdate=e}catch(xe){Ve(n,n.return,xe)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)vu(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":vu(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(r(163))}if(e=t.sibling,e!==null){e.return=t.return,pt=e;break}pt=t.return}}function Eh(e,t,n){var s=n.flags;switch(n.tag){case 0:case 11:case 15:Wn(e,n),s&4&&Us(5,n);break;case 1:if(Wn(e,n),s&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(g){Ve(n,n.return,g)}else{var c=ll(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(g){Ve(n,n.return,g)}}s&64&&bh(n),s&512&&Hs(n,n.return);break;case 3:if(Wn(e,n),s&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{um(e,t)}catch(g){Ve(n,n.return,g)}}break;case 27:t===null&&s&4&&Nh(n);case 26:case 5:Wn(e,n),t===null&&s&4&&Ah(n),s&512&&Hs(n,n.return);break;case 12:Wn(e,n);break;case 31:Wn(e,n),s&4&&Mh(e,n);break;case 13:Wn(e,n),s&4&&Rh(e,n),s&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Gv.bind(null,n),uy(e,n))));break;case 22:if(s=n.memoizedState!==null||Jn,!s){t=t!==null&&t.memoizedState!==null||ut,c=Jn;var u=ut;Jn=s,(ut=t)&&!u?Pn(e,n,(n.subtreeFlags&8772)!==0):Wn(e,n),Jn=c,ut=u}break;case 30:break;default:Wn(e,n)}}function Ch(e){var t=e.alternate;t!==null&&(e.alternate=null,Ch(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Ge(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Pe=null,Tt=!1;function In(e,t,n){for(n=n.child;n!==null;)qh(e,t,n),n=n.sibling}function qh(e,t,n){if(Et&&typeof Et.onCommitFiberUnmount=="function")try{Et.onCommitFiberUnmount(Ha,n)}catch{}switch(n.tag){case 26:ut||En(n,t),In(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:ut||En(n,t);var s=Pe,c=Tt;ka(n.type)&&(Pe=n.stateNode,Tt=!1),In(e,t,n),Zs(n.stateNode),Pe=s,Tt=c;break;case 5:ut||En(n,t);case 6:if(s=Pe,c=Tt,Pe=null,In(e,t,n),Pe=s,Tt=c,Pe!==null)if(Tt)try{(Pe.nodeType===9?Pe.body:Pe.nodeName==="HTML"?Pe.ownerDocument.body:Pe).removeChild(n.stateNode)}catch(u){Ve(n,t,u)}else try{Pe.removeChild(n.stateNode)}catch(u){Ve(n,t,u)}break;case 18:Pe!==null&&(Tt?(e=Pe,b0(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Zl(e)):b0(Pe,n.stateNode));break;case 4:s=Pe,c=Tt,Pe=n.stateNode.containerInfo,Tt=!0,In(e,t,n),Pe=s,Tt=c;break;case 0:case 11:case 14:case 15:Na(2,n,t),ut||Na(4,n,t),In(e,t,n);break;case 1:ut||(En(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"&&Sh(n,t,s)),In(e,t,n);break;case 21:In(e,t,n);break;case 22:ut=(s=ut)||n.memoizedState!==null,In(e,t,n),ut=s;break;default:In(e,t,n)}}function Mh(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Zl(e)}catch(n){Ve(t,t.return,n)}}}function Rh(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Zl(e)}catch(n){Ve(t,t.return,n)}}function Bv(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new wh),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new wh),t;default:throw Error(r(435,e.tag))}}function pr(e,t){var n=Bv(e);t.forEach(function(s){if(!n.has(s)){n.add(s);var c=Xv.bind(null,e,s);s.then(c,c)}})}function _t(e,t){var n=t.deletions;if(n!==null)for(var s=0;s<n.length;s++){var c=n[s],u=e,g=t,S=g;e:for(;S!==null;){switch(S.tag){case 27:if(ka(S.type)){Pe=S.stateNode,Tt=!1;break e}break;case 5:Pe=S.stateNode,Tt=!1;break e;case 3:case 4:Pe=S.stateNode.containerInfo,Tt=!0;break e}S=S.return}if(Pe===null)throw Error(r(160));qh(u,g,c),Pe=null,Tt=!1,u=c.alternate,u!==null&&(u.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)kh(t,e),t=t.sibling}var fn=null;function kh(e,t){var n=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:_t(t,e),Dt(e),s&4&&(Na(3,e,e.return),Us(3,e),Na(5,e,e.return));break;case 1:_t(t,e),Dt(e),s&512&&(ut||n===null||En(n,n.return)),s&64&&Jn&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?s:n.concat(s))));break;case 26:var c=fn;if(_t(t,e),Dt(e),s&512&&(ut||n===null||En(n,n.return)),s&4){var u=n!==null?n.memoizedState:null;if(s=e.memoizedState,n===null)if(s===null)if(e.stateNode===null){e:{s=e.type,n=e.memoizedProps,c=c.ownerDocument||c;t:switch(s){case"title":u=c.getElementsByTagName("title")[0],(!u||u[ye]||u[dt]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=c.createElement(s),c.head.insertBefore(u,c.querySelector("head > title"))),bt(u,s,n),u[dt]=e,Ze(u),s=u;break e;case"link":var g=k0("link","href",c).get(s+(n.href||""));if(g){for(var S=0;S<g.length;S++)if(u=g[S],u.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&u.getAttribute("rel")===(n.rel==null?null:n.rel)&&u.getAttribute("title")===(n.title==null?null:n.title)&&u.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){g.splice(S,1);break t}}u=c.createElement(s),bt(u,s,n),c.head.appendChild(u);break;case"meta":if(g=k0("meta","content",c).get(s+(n.content||""))){for(S=0;S<g.length;S++)if(u=g[S],u.getAttribute("content")===(n.content==null?null:""+n.content)&&u.getAttribute("name")===(n.name==null?null:n.name)&&u.getAttribute("property")===(n.property==null?null:n.property)&&u.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&u.getAttribute("charset")===(n.charSet==null?null:n.charSet)){g.splice(S,1);break t}}u=c.createElement(s),bt(u,s,n),c.head.appendChild(u);break;default:throw Error(r(468,s))}u[dt]=e,Ze(u),s=u}e.stateNode=s}else T0(c,e.type,e.stateNode);else e.stateNode=R0(c,s,e.memoizedProps);else u!==s?(u===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):u.count--,s===null?T0(c,e.type,e.stateNode):R0(c,s,e.memoizedProps)):s===null&&e.stateNode!==null&&Gc(e,e.memoizedProps,n.memoizedProps)}break;case 27:_t(t,e),Dt(e),s&512&&(ut||n===null||En(n,n.return)),n!==null&&s&4&&Gc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(_t(t,e),Dt(e),s&512&&(ut||n===null||En(n,n.return)),e.flags&32){c=e.stateNode;try{vl(c,"")}catch(fe){Ve(e,e.return,fe)}}s&4&&e.stateNode!=null&&(c=e.memoizedProps,Gc(e,c,n!==null?n.memoizedProps:c)),s&1024&&(Kc=!0);break;case 6:if(_t(t,e),Dt(e),s&4){if(e.stateNode===null)throw Error(r(162));s=e.memoizedProps,n=e.stateNode;try{n.nodeValue=s}catch(fe){Ve(e,e.return,fe)}}break;case 3:if(kr=null,c=fn,fn=Mr(t.containerInfo),_t(t,e),fn=c,Dt(e),s&4&&n!==null&&n.memoizedState.isDehydrated)try{Zl(t.containerInfo)}catch(fe){Ve(e,e.return,fe)}Kc&&(Kc=!1,Th(e));break;case 4:s=fn,fn=Mr(e.stateNode.containerInfo),_t(t,e),Dt(e),fn=s;break;case 12:_t(t,e),Dt(e);break;case 31:_t(t,e),Dt(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,pr(e,s)));break;case 13:_t(t,e),Dt(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(xr=wt()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,pr(e,s)));break;case 22:c=e.memoizedState!==null;var k=n!==null&&n.memoizedState!==null,H=Jn,J=ut;if(Jn=H||c,ut=J||k,_t(t,e),ut=J,Jn=H,Dt(e),s&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(n===null||k||Jn||ut||sl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){k=n=t;try{if(u=k.stateNode,c)g=u.style,typeof g.setProperty=="function"?g.setProperty("display","none","important"):g.display="none";else{S=k.stateNode;var ee=k.memoizedProps.style,$=ee!=null&&ee.hasOwnProperty("display")?ee.display:null;S.style.display=$==null||typeof $=="boolean"?"":(""+$).trim()}}catch(fe){Ve(k,k.return,fe)}}}else if(t.tag===6){if(n===null){k=t;try{k.stateNode.nodeValue=c?"":k.memoizedProps}catch(fe){Ve(k,k.return,fe)}}}else if(t.tag===18){if(n===null){k=t;try{var K=k.stateNode;c?S0(K,!0):S0(k.stateNode,!1)}catch(fe){Ve(k,k.return,fe)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}s&4&&(s=e.updateQueue,s!==null&&(n=s.retryQueue,n!==null&&(s.retryQueue=null,pr(e,n))));break;case 19:_t(t,e),Dt(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,pr(e,s)));break;case 30:break;case 21:break;default:_t(t,e),Dt(e)}}function Dt(e){var t=e.flags;if(t&2){try{for(var n,s=e.return;s!==null;){if(jh(s)){n=s;break}s=s.return}if(n==null)throw Error(r(160));switch(n.tag){case 27:var c=n.stateNode,u=Xc(e);hr(e,u,c);break;case 5:var g=n.stateNode;n.flags&32&&(vl(g,""),n.flags&=-33);var S=Xc(e);hr(e,S,g);break;case 3:case 4:var k=n.stateNode.containerInfo,H=Xc(e);Qc(e,H,k);break;default:throw Error(r(161))}}catch(J){Ve(e,e.return,J)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Th(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Th(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Wn(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Eh(e,t.alternate,t),t=t.sibling}function sl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Na(4,t,t.return),sl(t);break;case 1:En(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&Sh(t,t.return,n),sl(t);break;case 27:Zs(t.stateNode);case 26:case 5:En(t,t.return),sl(t);break;case 22:t.memoizedState===null&&sl(t);break;case 30:sl(t);break;default:sl(t)}e=e.sibling}}function Pn(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var s=t.alternate,c=e,u=t,g=u.flags;switch(u.tag){case 0:case 11:case 15:Pn(c,u,n),Us(4,u);break;case 1:if(Pn(c,u,n),s=u,c=s.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(H){Ve(s,s.return,H)}if(s=u,c=s.updateQueue,c!==null){var S=s.stateNode;try{var k=c.shared.hiddenCallbacks;if(k!==null)for(c.shared.hiddenCallbacks=null,c=0;c<k.length;c++)cm(k[c],S)}catch(H){Ve(s,s.return,H)}}n&&g&64&&bh(u),Hs(u,u.return);break;case 27:Nh(u);case 26:case 5:Pn(c,u,n),n&&s===null&&g&4&&Ah(u),Hs(u,u.return);break;case 12:Pn(c,u,n);break;case 31:Pn(c,u,n),n&&g&4&&Mh(c,u);break;case 13:Pn(c,u,n),n&&g&4&&Rh(c,u);break;case 22:u.memoizedState===null&&Pn(c,u,n),Hs(u,u.return);break;case 30:break;default:Pn(c,u,n)}t=t.sibling}}function Fc(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Es(n))}function Zc(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Es(e))}function dn(e,t,n,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)_h(e,t,n,s),t=t.sibling}function _h(e,t,n,s){var c=t.flags;switch(t.tag){case 0:case 11:case 15:dn(e,t,n,s),c&2048&&Us(9,t);break;case 1:dn(e,t,n,s);break;case 3:dn(e,t,n,s),c&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Es(e)));break;case 12:if(c&2048){dn(e,t,n,s),e=t.stateNode;try{var u=t.memoizedProps,g=u.id,S=u.onPostCommit;typeof S=="function"&&S(g,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(k){Ve(t,t.return,k)}}else dn(e,t,n,s);break;case 31:dn(e,t,n,s);break;case 13:dn(e,t,n,s);break;case 23:break;case 22:u=t.stateNode,g=t.alternate,t.memoizedState!==null?u._visibility&2?dn(e,t,n,s):Vs(e,t):u._visibility&2?dn(e,t,n,s):(u._visibility|=2,zl(e,t,n,s,(t.subtreeFlags&10256)!==0||!1)),c&2048&&Fc(g,t);break;case 24:dn(e,t,n,s),c&2048&&Zc(t.alternate,t);break;default:dn(e,t,n,s)}}function zl(e,t,n,s,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var u=e,g=t,S=n,k=s,H=g.flags;switch(g.tag){case 0:case 11:case 15:zl(u,g,S,k,c),Us(8,g);break;case 23:break;case 22:var J=g.stateNode;g.memoizedState!==null?J._visibility&2?zl(u,g,S,k,c):Vs(u,g):(J._visibility|=2,zl(u,g,S,k,c)),c&&H&2048&&Fc(g.alternate,g);break;case 24:zl(u,g,S,k,c),c&&H&2048&&Zc(g.alternate,g);break;default:zl(u,g,S,k,c)}t=t.sibling}}function Vs(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,s=t,c=s.flags;switch(s.tag){case 22:Vs(n,s),c&2048&&Fc(s.alternate,s);break;case 24:Vs(n,s),c&2048&&Zc(s.alternate,s);break;default:Vs(n,s)}t=t.sibling}}var Ys=8192;function Ul(e,t,n){if(e.subtreeFlags&Ys)for(e=e.child;e!==null;)Dh(e,t,n),e=e.sibling}function Dh(e,t,n){switch(e.tag){case 26:Ul(e,t,n),e.flags&Ys&&e.memoizedState!==null&&Ay(n,fn,e.memoizedState,e.memoizedProps);break;case 5:Ul(e,t,n);break;case 3:case 4:var s=fn;fn=Mr(e.stateNode.containerInfo),Ul(e,t,n),fn=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=Ys,Ys=16777216,Ul(e,t,n),Ys=s):Ul(e,t,n));break;default:Ul(e,t,n)}}function Oh(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function $s(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var s=t[n];pt=s,Lh(s,e)}Oh(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Bh(e),e=e.sibling}function Bh(e){switch(e.tag){case 0:case 11:case 15:$s(e),e.flags&2048&&Na(9,e,e.return);break;case 3:$s(e);break;case 12:$s(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,gr(e)):$s(e);break;default:$s(e)}}function gr(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var s=t[n];pt=s,Lh(s,e)}Oh(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Na(8,t,t.return),gr(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,gr(t));break;default:gr(t)}e=e.sibling}}function Lh(e,t){for(;pt!==null;){var n=pt;switch(n.tag){case 0:case 11:case 15:Na(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var s=n.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:Es(n.memoizedState.cache)}if(s=n.child,s!==null)s.return=n,pt=s;else e:for(n=e;pt!==null;){s=pt;var c=s.sibling,u=s.return;if(Ch(s),s===n){pt=null;break e}if(c!==null){c.return=u,pt=c;break e}pt=u}}}var Lv={getCacheForType:function(e){var t=vt(rt),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return vt(rt).controller.signal}},zv=typeof WeakMap=="function"?WeakMap:Map,Le=0,Fe=null,we=null,Ce=0,He=0,Qt=null,wa=!1,Hl=!1,Jc=!1,ea=0,nt=0,Ea=0,il=0,Ic=0,Kt=0,Vl=0,Gs=null,Ot=null,Wc=!1,xr=0,zh=0,vr=1/0,yr=null,Ca=null,mt=0,qa=null,Yl=null,ta=0,Pc=0,eu=null,Uh=null,Xs=0,tu=null;function Ft(){return(Le&2)!==0&&Ce!==0?Ce&-Ce:q.T!==null?ru():$a()}function Hh(){if(Kt===0)if((Ce&536870912)===0||Me){var e=fa;fa<<=1,(fa&3932160)===0&&(fa=262144),Kt=e}else Kt=536870912;return e=Gt.current,e!==null&&(e.flags|=32),Kt}function Bt(e,t,n){(e===Fe&&(He===2||He===9)||e.cancelPendingCommit!==null)&&($l(e,0),Ma(e,Ce,Kt,!1)),At(e,n),((Le&2)===0||e!==Fe)&&(e===Fe&&((Le&2)===0&&(il|=n),nt===4&&Ma(e,Ce,Kt,!1)),Cn(e))}function Vh(e,t,n){if((Le&6)!==0)throw Error(r(327));var s=!n&&(t&127)===0&&(t&e.expiredLanes)===0||Sn(e,t),c=s?Vv(e,t):au(e,t,!0),u=s;do{if(c===0){Hl&&!s&&Ma(e,t,0,!1);break}else{if(n=e.current.alternate,u&&!Uv(n)){c=au(e,t,!1),u=!1;continue}if(c===2){if(u=t,e.errorRecoveryDisabledLanes&u)var g=0;else g=e.pendingLanes&-536870913,g=g!==0?g:g&536870912?536870912:0;if(g!==0){t=g;e:{var S=e;c=Gs;var k=S.current.memoizedState.isDehydrated;if(k&&($l(S,g).flags|=256),g=au(S,g,!1),g!==2){if(Jc&&!k){S.errorRecoveryDisabledLanes|=u,il|=u,c=4;break e}u=Ot,Ot=c,u!==null&&(Ot===null?Ot=u:Ot.push.apply(Ot,u))}c=g}if(u=!1,c!==2)continue}}if(c===1){$l(e,0),Ma(e,t,0,!0);break}e:{switch(s=e,u=c,u){case 0:case 1:throw Error(r(345));case 4:if((t&4194048)!==t)break;case 6:Ma(s,t,Kt,!wa);break e;case 2:Ot=null;break;case 3:case 5:break;default:throw Error(r(329))}if((t&62914560)===t&&(c=xr+300-wt(),10<c)){if(Ma(s,t,Kt,!wa),bn(s,0,!0)!==0)break e;ta=t,s.timeoutHandle=v0(Yh.bind(null,s,n,Ot,yr,Wc,t,Kt,il,Vl,wa,u,"Throttled",-0,0),c);break e}Yh(s,n,Ot,yr,Wc,t,Kt,il,Vl,wa,u,null,-0,0)}}break}while(!0);Cn(e)}function Yh(e,t,n,s,c,u,g,S,k,H,J,ee,$,K){if(e.timeoutHandle=-1,ee=t.subtreeFlags,ee&8192||(ee&16785408)===16785408){ee={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Hn},Dh(t,u,ee);var fe=(u&62914560)===u?xr-wt():(u&4194048)===u?zh-wt():0;if(fe=jy(ee,fe),fe!==null){ta=u,e.cancelPendingCommit=fe(Jh.bind(null,e,t,u,n,s,c,g,S,k,J,ee,null,$,K)),Ma(e,u,g,!H);return}}Jh(e,t,u,n,s,c,g,S,k)}function Uv(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var s=0;s<n.length;s++){var c=n[s],u=c.getSnapshot;c=c.value;try{if(!Yt(u(),c))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Ma(e,t,n,s){t&=~Ic,t&=~il,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var c=t;0<c;){var u=31-ht(c),g=1<<u;s[u]=-1,c&=~g}n!==0&&Mi(e,n,t)}function br(){return(Le&6)===0?(Qs(0),!1):!0}function nu(){if(we!==null){if(He===0)var e=we.return;else e=we,Gn=Ia=null,vc(e),_l=null,qs=0,e=we;for(;e!==null;)yh(e.alternate,e),e=e.return;we=null}}function $l(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,sy(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),ta=0,nu(),Fe=e,we=n=Yn(e.current,null),Ce=t,He=0,Qt=null,wa=!1,Hl=Sn(e,t),Jc=!1,Vl=Kt=Ic=il=Ea=nt=0,Ot=Gs=null,Wc=!1,(t&8)!==0&&(t|=t&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=t;0<s;){var c=31-ht(s),u=1<<c;t|=e[c],s&=~u}return ea=t,Vi(),n}function $h(e,t){Ae=null,q.H=Bs,t===Tl||t===Zi?(t=sm(),He=3):t===ic?(t=sm(),He=4):He=t===Dc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Qt=t,we===null&&(nt=1,cr(e,Pt(t,e.current)))}function Gh(){var e=Gt.current;return e===null?!0:(Ce&4194048)===Ce?an===null:(Ce&62914560)===Ce||(Ce&536870912)!==0?e===an:!1}function Xh(){var e=q.H;return q.H=Bs,e===null?Bs:e}function Qh(){var e=q.A;return q.A=Lv,e}function Sr(){nt=4,wa||(Ce&4194048)!==Ce&&Gt.current!==null||(Hl=!0),(Ea&134217727)===0&&(il&134217727)===0||Fe===null||Ma(Fe,Ce,Kt,!1)}function au(e,t,n){var s=Le;Le|=2;var c=Xh(),u=Qh();(Fe!==e||Ce!==t)&&(yr=null,$l(e,t)),t=!1;var g=nt;e:do try{if(He!==0&&we!==null){var S=we,k=Qt;switch(He){case 8:nu(),g=6;break e;case 3:case 2:case 9:case 6:Gt.current===null&&(t=!0);var H=He;if(He=0,Qt=null,Gl(e,S,k,H),n&&Hl){g=0;break e}break;default:H=He,He=0,Qt=null,Gl(e,S,k,H)}}Hv(),g=nt;break}catch(J){$h(e,J)}while(!0);return t&&e.shellSuspendCounter++,Gn=Ia=null,Le=s,q.H=c,q.A=u,we===null&&(Fe=null,Ce=0,Vi()),g}function Hv(){for(;we!==null;)Kh(we)}function Vv(e,t){var n=Le;Le|=2;var s=Xh(),c=Qh();Fe!==e||Ce!==t?(yr=null,vr=wt()+500,$l(e,t)):Hl=Sn(e,t);e:do try{if(He!==0&&we!==null){t=we;var u=Qt;t:switch(He){case 1:He=0,Qt=null,Gl(e,t,u,1);break;case 2:case 9:if(am(u)){He=0,Qt=null,Fh(t);break}t=function(){He!==2&&He!==9||Fe!==e||(He=7),Cn(e)},u.then(t,t);break e;case 3:He=7;break e;case 4:He=5;break e;case 7:am(u)?(He=0,Qt=null,Fh(t)):(He=0,Qt=null,Gl(e,t,u,7));break;case 5:var g=null;switch(we.tag){case 26:g=we.memoizedState;case 5:case 27:var S=we;if(g?_0(g):S.stateNode.complete){He=0,Qt=null;var k=S.sibling;if(k!==null)we=k;else{var H=S.return;H!==null?(we=H,Ar(H)):we=null}break t}}He=0,Qt=null,Gl(e,t,u,5);break;case 6:He=0,Qt=null,Gl(e,t,u,6);break;case 8:nu(),nt=6;break e;default:throw Error(r(462))}}Yv();break}catch(J){$h(e,J)}while(!0);return Gn=Ia=null,q.H=s,q.A=c,Le=n,we!==null?0:(Fe=null,Ce=0,Vi(),nt)}function Yv(){for(;we!==null&&!vn();)Kh(we)}function Kh(e){var t=xh(e.alternate,e,ea);e.memoizedProps=e.pendingProps,t===null?Ar(e):we=t}function Fh(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=fh(n,t,t.pendingProps,t.type,void 0,Ce);break;case 11:t=fh(n,t,t.pendingProps,t.type.render,t.ref,Ce);break;case 5:vc(t);default:yh(n,t),t=we=Qd(t,ea),t=xh(n,t,ea)}e.memoizedProps=e.pendingProps,t===null?Ar(e):we=t}function Gl(e,t,n,s){Gn=Ia=null,vc(t),_l=null,qs=0;var c=t.return;try{if(Rv(e,c,t,n,Ce)){nt=1,cr(e,Pt(n,e.current)),we=null;return}}catch(u){if(c!==null)throw we=c,u;nt=1,cr(e,Pt(n,e.current)),we=null;return}t.flags&32768?(Me||s===1?e=!0:Hl||(Ce&536870912)!==0?e=!1:(wa=e=!0,(s===2||s===9||s===3||s===6)&&(s=Gt.current,s!==null&&s.tag===13&&(s.flags|=16384))),Zh(t,e)):Ar(t)}function Ar(e){var t=e;do{if((t.flags&32768)!==0){Zh(t,wa);return}e=t.return;var n=_v(t.alternate,t,ea);if(n!==null){we=n;return}if(t=t.sibling,t!==null){we=t;return}we=t=e}while(t!==null);nt===0&&(nt=5)}function Zh(e,t){do{var n=Dv(e.alternate,e);if(n!==null){n.flags&=32767,we=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){we=e;return}we=e=n}while(e!==null);nt=6,we=null}function Jh(e,t,n,s,c,u,g,S,k){e.cancelPendingCommit=null;do jr();while(mt!==0);if((Le&6)!==0)throw Error(r(327));if(t!==null){if(t===e.current)throw Error(r(177));if(u=t.lanes|t.childLanes,u|=Xo,Ne(e,n,u,g,S,k),e===Fe&&(we=Fe=null,Ce=0),Yl=t,qa=e,ta=n,Pc=u,eu=c,Uh=s,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Qv(ua,function(){return t0(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||s){s=q.T,q.T=null,c=X.p,X.p=2,g=Le,Le|=4;try{Ov(e,t,n)}finally{Le=g,X.p=c,q.T=s}}mt=1,Ih(),Wh(),Ph()}}function Ih(){if(mt===1){mt=0;var e=qa,t=Yl,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=q.T,q.T=null;var s=X.p;X.p=2;var c=Le;Le|=4;try{kh(t,e);var u=pu,g=Ld(e.containerInfo),S=u.focusedElem,k=u.selectionRange;if(g!==S&&S&&S.ownerDocument&&Bd(S.ownerDocument.documentElement,S)){if(k!==null&&Ho(S)){var H=k.start,J=k.end;if(J===void 0&&(J=H),"selectionStart"in S)S.selectionStart=H,S.selectionEnd=Math.min(J,S.value.length);else{var ee=S.ownerDocument||document,$=ee&&ee.defaultView||window;if($.getSelection){var K=$.getSelection(),fe=S.textContent.length,xe=Math.min(k.start,fe),Ke=k.end===void 0?xe:Math.min(k.end,fe);!K.extend&&xe>Ke&&(g=Ke,Ke=xe,xe=g);var B=Od(S,xe),_=Od(S,Ke);if(B&&_&&(K.rangeCount!==1||K.anchorNode!==B.node||K.anchorOffset!==B.offset||K.focusNode!==_.node||K.focusOffset!==_.offset)){var U=ee.createRange();U.setStart(B.node,B.offset),K.removeAllRanges(),xe>Ke?(K.addRange(U),K.extend(_.node,_.offset)):(U.setEnd(_.node,_.offset),K.addRange(U))}}}}for(ee=[],K=S;K=K.parentNode;)K.nodeType===1&&ee.push({element:K,left:K.scrollLeft,top:K.scrollTop});for(typeof S.focus=="function"&&S.focus(),S=0;S<ee.length;S++){var I=ee[S];I.element.scrollLeft=I.left,I.element.scrollTop=I.top}}Or=!!hu,pu=hu=null}finally{Le=c,X.p=s,q.T=n}}e.current=t,mt=2}}function Wh(){if(mt===2){mt=0;var e=qa,t=Yl,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=q.T,q.T=null;var s=X.p;X.p=2;var c=Le;Le|=4;try{Eh(e,t.alternate,t)}finally{Le=c,X.p=s,q.T=n}}mt=3}}function Ph(){if(mt===4||mt===3){mt=0,Ln();var e=qa,t=Yl,n=ta,s=Uh;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?mt=5:(mt=0,Yl=qa=null,e0(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(Ca=null),An(n),t=t.stateNode,Et&&typeof Et.onCommitFiberRoot=="function")try{Et.onCommitFiberRoot(Ha,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=q.T,c=X.p,X.p=2,q.T=null;try{for(var u=e.onRecoverableError,g=0;g<s.length;g++){var S=s[g];u(S.value,{componentStack:S.stack})}}finally{q.T=t,X.p=c}}(ta&3)!==0&&jr(),Cn(e),c=e.pendingLanes,(n&261930)!==0&&(c&42)!==0?e===tu?Xs++:(Xs=0,tu=e):Xs=0,Qs(0)}}function e0(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Es(t)))}function jr(){return Ih(),Wh(),Ph(),t0()}function t0(){if(mt!==5)return!1;var e=qa,t=Pc;Pc=0;var n=An(ta),s=q.T,c=X.p;try{X.p=32>n?32:n,q.T=null,n=eu,eu=null;var u=qa,g=ta;if(mt=0,Yl=qa=null,ta=0,(Le&6)!==0)throw Error(r(331));var S=Le;if(Le|=4,Bh(u.current),_h(u,u.current,g,n),Le=S,Qs(0,!1),Et&&typeof Et.onPostCommitFiberRoot=="function")try{Et.onPostCommitFiberRoot(Ha,u)}catch{}return!0}finally{X.p=c,q.T=s,e0(e,t)}}function n0(e,t,n){t=Pt(n,t),t=_c(e.stateNode,t,2),e=Sa(e,t,2),e!==null&&(At(e,2),Cn(e))}function Ve(e,t,n){if(e.tag===3)n0(e,e,n);else for(;t!==null;){if(t.tag===3){n0(t,e,n);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Ca===null||!Ca.has(s))){e=Pt(n,e),n=ah(2),s=Sa(t,n,2),s!==null&&(lh(n,s,t,e),At(s,2),Cn(s));break}}t=t.return}}function lu(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new zv;var c=new Set;s.set(t,c)}else c=s.get(t),c===void 0&&(c=new Set,s.set(t,c));c.has(n)||(Jc=!0,c.add(n),e=$v.bind(null,e,t,n),t.then(e,e))}function $v(e,t,n){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Fe===e&&(Ce&n)===n&&(nt===4||nt===3&&(Ce&62914560)===Ce&&300>wt()-xr?(Le&2)===0&&$l(e,0):Ic|=n,Vl===Ce&&(Vl=0)),Cn(e)}function a0(e,t){t===0&&(t=Ya()),e=Fa(e,t),e!==null&&(At(e,t),Cn(e))}function Gv(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),a0(e,n)}function Xv(e,t){var n=0;switch(e.tag){case 31:case 13:var s=e.stateNode,c=e.memoizedState;c!==null&&(n=c.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(r(314))}s!==null&&s.delete(t),a0(e,n)}function Qv(e,t){return gt(e,t)}var Nr=null,Xl=null,su=!1,wr=!1,iu=!1,Ra=0;function Cn(e){e!==Xl&&e.next===null&&(Xl===null?Nr=Xl=e:Xl=Xl.next=e),wr=!0,su||(su=!0,Fv())}function Qs(e,t){if(!iu&&wr){iu=!0;do for(var n=!1,s=Nr;s!==null;){if(e!==0){var c=s.pendingLanes;if(c===0)var u=0;else{var g=s.suspendedLanes,S=s.pingedLanes;u=(1<<31-ht(42|e)+1)-1,u&=c&~(g&~S),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(n=!0,r0(s,u))}else u=Ce,u=bn(s,s===Fe?u:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(u&3)===0||Sn(s,u)||(n=!0,r0(s,u));s=s.next}while(n);iu=!1}}function Kv(){l0()}function l0(){wr=su=!1;var e=0;Ra!==0&&ly()&&(e=Ra);for(var t=wt(),n=null,s=Nr;s!==null;){var c=s.next,u=s0(s,t);u===0?(s.next=null,n===null?Nr=c:n.next=c,c===null&&(Xl=n)):(n=s,(e!==0||(u&3)!==0)&&(wr=!0)),s=c}mt!==0&&mt!==5||Qs(e),Ra!==0&&(Ra=0)}function s0(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,c=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var g=31-ht(u),S=1<<g,k=c[g];k===-1?((S&n)===0||(S&s)!==0)&&(c[g]=ds(S,t)):k<=t&&(e.expiredLanes|=S),u&=~S}if(t=Fe,n=Ce,n=bn(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,n===0||e===t&&(He===2||He===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&St(s),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||Sn(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(s!==null&&St(s),An(n)){case 2:case 8:n=Ut;break;case 32:n=ua;break;case 268435456:n=us;break;default:n=ua}return s=i0.bind(null,e),n=gt(n,s),e.callbackPriority=t,e.callbackNode=n,t}return s!==null&&s!==null&&St(s),e.callbackPriority=2,e.callbackNode=null,2}function i0(e,t){if(mt!==0&&mt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(jr()&&e.callbackNode!==n)return null;var s=Ce;return s=bn(e,e===Fe?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(Vh(e,s,t),s0(e,wt()),e.callbackNode!=null&&e.callbackNode===n?i0.bind(null,e):null)}function r0(e,t){if(jr())return null;Vh(e,t,!0)}function Fv(){iy(function(){(Le&6)!==0?gt(zt,Kv):l0()})}function ru(){if(Ra===0){var e=Rl;e===0&&(e=Va,Va<<=1,(Va&261888)===0&&(Va=256)),Ra=e}return Ra}function o0(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:_i(""+e)}function c0(e,t){var n=t.ownerDocument.createElement("input");return n.name=t.name,n.value=t.value,e.id&&n.setAttribute("form",e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function Zv(e,t,n,s,c){if(t==="submit"&&n&&n.stateNode===c){var u=o0((c[jt]||null).action),g=s.submitter;g&&(t=(t=g[jt]||null)?o0(t.formAction):g.getAttribute("formAction"),t!==null&&(u=t,g=null));var S=new Li("action","action",null,s,c);e.push({event:S,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(Ra!==0){var k=g?c0(c,g):new FormData(c);Cc(n,{pending:!0,data:k,method:c.method,action:u},null,k)}}else typeof u=="function"&&(S.preventDefault(),k=g?c0(c,g):new FormData(c),Cc(n,{pending:!0,data:k,method:c.method,action:u},u,k))},currentTarget:c}]})}}for(var ou=0;ou<Go.length;ou++){var cu=Go[ou],Jv=cu.toLowerCase(),Iv=cu[0].toUpperCase()+cu.slice(1);un(Jv,"on"+Iv)}un(Hd,"onAnimationEnd"),un(Vd,"onAnimationIteration"),un(Yd,"onAnimationStart"),un("dblclick","onDoubleClick"),un("focusin","onFocus"),un("focusout","onBlur"),un(mv,"onTransitionRun"),un(hv,"onTransitionStart"),un(pv,"onTransitionCancel"),un($d,"onTransitionEnd"),gl("onMouseEnter",["mouseout","mouseover"]),gl("onMouseLeave",["mouseout","mouseover"]),gl("onPointerEnter",["pointerout","pointerover"]),gl("onPointerLeave",["pointerout","pointerover"]),Ga("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ga("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ga("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ga("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ga("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ga("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ks="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Wv=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ks));function u0(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var s=e[n],c=s.event;s=s.listeners;e:{var u=void 0;if(t)for(var g=s.length-1;0<=g;g--){var S=s[g],k=S.instance,H=S.currentTarget;if(S=S.listener,k!==u&&c.isPropagationStopped())break e;u=S,c.currentTarget=H;try{u(c)}catch(J){Hi(J)}c.currentTarget=null,u=k}else for(g=0;g<s.length;g++){if(S=s[g],k=S.instance,H=S.currentTarget,S=S.listener,k!==u&&c.isPropagationStopped())break e;u=S,c.currentTarget=H;try{u(c)}catch(J){Hi(J)}c.currentTarget=null,u=k}}}}function Ee(e,t){var n=t[Ht];n===void 0&&(n=t[Ht]=new Set);var s=e+"__bubble";n.has(s)||(f0(t,e,2,!1),n.add(s))}function uu(e,t,n){var s=0;t&&(s|=4),f0(n,e,s,t)}var Er="_reactListening"+Math.random().toString(36).slice(2);function fu(e){if(!e[Er]){e[Er]=!0,hs.forEach(function(n){n!=="selectionchange"&&(Wv.has(n)||uu(n,!1,e),uu(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Er]||(t[Er]=!0,uu("selectionchange",!1,t))}}function f0(e,t,n,s){switch(H0(t)){case 2:var c=Ey;break;case 8:c=Cy;break;default:c=Eu}n=c.bind(null,t,n,e),c=void 0,!ko||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),s?c!==void 0?e.addEventListener(t,n,{capture:!0,passive:c}):e.addEventListener(t,n,!0):c!==void 0?e.addEventListener(t,n,{passive:c}):e.addEventListener(t,n,!1)}function du(e,t,n,s,c){var u=s;if((t&1)===0&&(t&2)===0&&s!==null)e:for(;;){if(s===null)return;var g=s.tag;if(g===3||g===4){var S=s.stateNode.containerInfo;if(S===c)break;if(g===4)for(g=s.return;g!==null;){var k=g.tag;if((k===3||k===4)&&g.stateNode.containerInfo===c)return;g=g.return}for(;S!==null;){if(g=ze(S),g===null)return;if(k=g.tag,k===5||k===6||k===26||k===27){s=u=g;continue e}S=S.parentNode}}s=s.return}gd(function(){var H=u,J=Mo(n),ee=[];e:{var $=Gd.get(e);if($!==void 0){var K=Li,fe=e;switch(e){case"keypress":if(Oi(n)===0)break e;case"keydown":case"keyup":K=Xx;break;case"focusin":fe="focus",K=Oo;break;case"focusout":fe="blur",K=Oo;break;case"beforeblur":case"afterblur":K=Oo;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":K=yd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":K=_x;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":K=Fx;break;case Hd:case Vd:case Yd:K=Bx;break;case $d:K=Jx;break;case"scroll":case"scrollend":K=kx;break;case"wheel":K=Wx;break;case"copy":case"cut":case"paste":K=zx;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":K=Sd;break;case"toggle":case"beforetoggle":K=ev}var xe=(t&4)!==0,Ke=!xe&&(e==="scroll"||e==="scrollend"),B=xe?$!==null?$+"Capture":null:$;xe=[];for(var _=H,U;_!==null;){var I=_;if(U=I.stateNode,I=I.tag,I!==5&&I!==26&&I!==27||U===null||B===null||(I=ps(_,B),I!=null&&xe.push(Fs(_,I,U))),Ke)break;_=_.return}0<xe.length&&($=new K($,fe,null,n,J),ee.push({event:$,listeners:xe}))}}if((t&7)===0){e:{if($=e==="mouseover"||e==="pointerover",K=e==="mouseout"||e==="pointerout",$&&n!==qo&&(fe=n.relatedTarget||n.fromElement)&&(ze(fe)||fe[zn]))break e;if((K||$)&&($=J.window===J?J:($=J.ownerDocument)?$.defaultView||$.parentWindow:window,K?(fe=n.relatedTarget||n.toElement,K=H,fe=fe?ze(fe):null,fe!==null&&(Ke=d(fe),xe=fe.tag,fe!==Ke||xe!==5&&xe!==27&&xe!==6)&&(fe=null)):(K=null,fe=H),K!==fe)){if(xe=yd,I="onMouseLeave",B="onMouseEnter",_="mouse",(e==="pointerout"||e==="pointerover")&&(xe=Sd,I="onPointerLeave",B="onPointerEnter",_="pointer"),Ke=K==null?$:Vt(K),U=fe==null?$:Vt(fe),$=new xe(I,_+"leave",K,n,J),$.target=Ke,$.relatedTarget=U,I=null,ze(J)===H&&(xe=new xe(B,_+"enter",fe,n,J),xe.target=U,xe.relatedTarget=Ke,I=xe),Ke=I,K&&fe)t:{for(xe=Pv,B=K,_=fe,U=0,I=B;I;I=xe(I))U++;I=0;for(var ge=_;ge;ge=xe(ge))I++;for(;0<U-I;)B=xe(B),U--;for(;0<I-U;)_=xe(_),I--;for(;U--;){if(B===_||_!==null&&B===_.alternate){xe=B;break t}B=xe(B),_=xe(_)}xe=null}else xe=null;K!==null&&d0(ee,$,K,xe,!1),fe!==null&&Ke!==null&&d0(ee,Ke,fe,xe,!0)}}e:{if($=H?Vt(H):window,K=$.nodeName&&$.nodeName.toLowerCase(),K==="select"||K==="input"&&$.type==="file")var _e=Md;else if(Cd($))if(Rd)_e=uv;else{_e=ov;var me=rv}else K=$.nodeName,!K||K.toLowerCase()!=="input"||$.type!=="checkbox"&&$.type!=="radio"?H&&Co(H.elementType)&&(_e=Md):_e=cv;if(_e&&(_e=_e(e,H))){qd(ee,_e,n,J);break e}me&&me(e,$,H),e==="focusout"&&H&&$.type==="number"&&H.memoizedProps.value!=null&&Eo($,"number",$.value)}switch(me=H?Vt(H):window,e){case"focusin":(Cd(me)||me.contentEditable==="true")&&(Al=me,Vo=H,js=null);break;case"focusout":js=Vo=Al=null;break;case"mousedown":Yo=!0;break;case"contextmenu":case"mouseup":case"dragend":Yo=!1,zd(ee,n,J);break;case"selectionchange":if(dv)break;case"keydown":case"keyup":zd(ee,n,J)}var je;if(Lo)e:{switch(e){case"compositionstart":var qe="onCompositionStart";break e;case"compositionend":qe="onCompositionEnd";break e;case"compositionupdate":qe="onCompositionUpdate";break e}qe=void 0}else Sl?wd(e,n)&&(qe="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(qe="onCompositionStart");qe&&(Ad&&n.locale!=="ko"&&(Sl||qe!=="onCompositionStart"?qe==="onCompositionEnd"&&Sl&&(je=xd()):(ha=J,To="value"in ha?ha.value:ha.textContent,Sl=!0)),me=Cr(H,qe),0<me.length&&(qe=new bd(qe,e,null,n,J),ee.push({event:qe,listeners:me}),je?qe.data=je:(je=Ed(n),je!==null&&(qe.data=je)))),(je=nv?av(e,n):lv(e,n))&&(qe=Cr(H,"onBeforeInput"),0<qe.length&&(me=new bd("onBeforeInput","beforeinput",null,n,J),ee.push({event:me,listeners:qe}),me.data=je)),Zv(ee,e,H,n,J)}u0(ee,t)})}function Fs(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Cr(e,t){for(var n=t+"Capture",s=[];e!==null;){var c=e,u=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||u===null||(c=ps(e,n),c!=null&&s.unshift(Fs(e,c,u)),c=ps(e,t),c!=null&&s.push(Fs(e,c,u))),e.tag===3)return s;e=e.return}return[]}function Pv(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function d0(e,t,n,s,c){for(var u=t._reactName,g=[];n!==null&&n!==s;){var S=n,k=S.alternate,H=S.stateNode;if(S=S.tag,k!==null&&k===s)break;S!==5&&S!==26&&S!==27||H===null||(k=H,c?(H=ps(n,u),H!=null&&g.unshift(Fs(n,H,k))):c||(H=ps(n,u),H!=null&&g.push(Fs(n,H,k)))),n=n.return}g.length!==0&&e.push({event:t,listeners:g})}var ey=/\r\n?/g,ty=/\u0000|\uFFFD/g;function m0(e){return(typeof e=="string"?e:""+e).replace(ey,`
|
||
`).replace(ty,"")}function h0(e,t){return t=m0(t),m0(e)===t}function Qe(e,t,n,s,c,u){switch(n){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||vl(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&vl(e,""+s);break;case"className":ki(e,"class",s);break;case"tabIndex":ki(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":ki(e,n,s);break;case"style":hd(e,s,u);break;case"data":if(t!=="object"){ki(e,"data",s);break}case"src":case"href":if(s===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(n);break}s=_i(""+s),e.setAttribute(n,s);break;case"action":case"formAction":if(typeof s=="function"){e.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof u=="function"&&(n==="formAction"?(t!=="input"&&Qe(e,t,"name",c.name,c,null),Qe(e,t,"formEncType",c.formEncType,c,null),Qe(e,t,"formMethod",c.formMethod,c,null),Qe(e,t,"formTarget",c.formTarget,c,null)):(Qe(e,t,"encType",c.encType,c,null),Qe(e,t,"method",c.method,c,null),Qe(e,t,"target",c.target,c,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(n);break}s=_i(""+s),e.setAttribute(n,s);break;case"onClick":s!=null&&(e.onclick=Hn);break;case"onScroll":s!=null&&Ee("scroll",e);break;case"onScrollEnd":s!=null&&Ee("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(r(61));if(n=s.__html,n!=null){if(c.children!=null)throw Error(r(60));e.innerHTML=n}}break;case"multiple":e.multiple=s&&typeof s!="function"&&typeof s!="symbol";break;case"muted":e.muted=s&&typeof s!="function"&&typeof s!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(s==null||typeof s=="function"||typeof s=="boolean"||typeof s=="symbol"){e.removeAttribute("xlink:href");break}n=_i(""+s),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(n,""+s):e.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":s&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":s===!0?e.setAttribute(n,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(n,s):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(n,s):e.removeAttribute(n);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(n):e.setAttribute(n,s);break;case"popover":Ee("beforetoggle",e),Ee("toggle",e),Ri(e,"popover",s);break;case"xlinkActuate":Un(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":Un(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":Un(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":Un(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":Un(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":Un(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":Un(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":Un(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":Un(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":Ri(e,"is",s);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=Mx.get(n)||n,Ri(e,n,s))}}function mu(e,t,n,s,c,u){switch(n){case"style":hd(e,s,u);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(r(61));if(n=s.__html,n!=null){if(c.children!=null)throw Error(r(60));e.innerHTML=n}}break;case"children":typeof s=="string"?vl(e,s):(typeof s=="number"||typeof s=="bigint")&&vl(e,""+s);break;case"onScroll":s!=null&&Ee("scroll",e);break;case"onScrollEnd":s!=null&&Ee("scrollend",e);break;case"onClick":s!=null&&(e.onclick=Hn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!sd.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(c=n.endsWith("Capture"),t=n.slice(2,c?n.length-7:void 0),u=e[jt]||null,u=u!=null?u[n]:null,typeof u=="function"&&e.removeEventListener(t,u,c),typeof s=="function")){typeof u!="function"&&u!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,s,c);break e}n in e?e[n]=s:s===!0?e.setAttribute(n,""):Ri(e,n,s)}}}function bt(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ee("error",e),Ee("load",e);var s=!1,c=!1,u;for(u in n)if(n.hasOwnProperty(u)){var g=n[u];if(g!=null)switch(u){case"src":s=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:Qe(e,t,u,g,n,null)}}c&&Qe(e,t,"srcSet",n.srcSet,n,null),s&&Qe(e,t,"src",n.src,n,null);return;case"input":Ee("invalid",e);var S=u=g=c=null,k=null,H=null;for(s in n)if(n.hasOwnProperty(s)){var J=n[s];if(J!=null)switch(s){case"name":c=J;break;case"type":g=J;break;case"checked":k=J;break;case"defaultChecked":H=J;break;case"value":u=J;break;case"defaultValue":S=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(r(137,t));break;default:Qe(e,t,s,J,n,null)}}ud(e,u,S,k,H,g,c,!1);return;case"select":Ee("invalid",e),s=g=u=null;for(c in n)if(n.hasOwnProperty(c)&&(S=n[c],S!=null))switch(c){case"value":u=S;break;case"defaultValue":g=S;break;case"multiple":s=S;default:Qe(e,t,c,S,n,null)}t=u,n=g,e.multiple=!!s,t!=null?xl(e,!!s,t,!1):n!=null&&xl(e,!!s,n,!0);return;case"textarea":Ee("invalid",e),u=c=s=null;for(g in n)if(n.hasOwnProperty(g)&&(S=n[g],S!=null))switch(g){case"value":s=S;break;case"defaultValue":c=S;break;case"children":u=S;break;case"dangerouslySetInnerHTML":if(S!=null)throw Error(r(91));break;default:Qe(e,t,g,S,n,null)}dd(e,s,c,u);return;case"option":for(k in n)if(n.hasOwnProperty(k)&&(s=n[k],s!=null))switch(k){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:Qe(e,t,k,s,n,null)}return;case"dialog":Ee("beforetoggle",e),Ee("toggle",e),Ee("cancel",e),Ee("close",e);break;case"iframe":case"object":Ee("load",e);break;case"video":case"audio":for(s=0;s<Ks.length;s++)Ee(Ks[s],e);break;case"image":Ee("error",e),Ee("load",e);break;case"details":Ee("toggle",e);break;case"embed":case"source":case"link":Ee("error",e),Ee("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(H in n)if(n.hasOwnProperty(H)&&(s=n[H],s!=null))switch(H){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:Qe(e,t,H,s,n,null)}return;default:if(Co(t)){for(J in n)n.hasOwnProperty(J)&&(s=n[J],s!==void 0&&mu(e,t,J,s,n,void 0));return}}for(S in n)n.hasOwnProperty(S)&&(s=n[S],s!=null&&Qe(e,t,S,s,n,null))}function ny(e,t,n,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,u=null,g=null,S=null,k=null,H=null,J=null;for(K in n){var ee=n[K];if(n.hasOwnProperty(K)&&ee!=null)switch(K){case"checked":break;case"value":break;case"defaultValue":k=ee;default:s.hasOwnProperty(K)||Qe(e,t,K,null,s,ee)}}for(var $ in s){var K=s[$];if(ee=n[$],s.hasOwnProperty($)&&(K!=null||ee!=null))switch($){case"type":u=K;break;case"name":c=K;break;case"checked":H=K;break;case"defaultChecked":J=K;break;case"value":g=K;break;case"defaultValue":S=K;break;case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(r(137,t));break;default:K!==ee&&Qe(e,t,$,K,s,ee)}}wo(e,g,S,k,H,J,u,c);return;case"select":K=g=S=$=null;for(u in n)if(k=n[u],n.hasOwnProperty(u)&&k!=null)switch(u){case"value":break;case"multiple":K=k;default:s.hasOwnProperty(u)||Qe(e,t,u,null,s,k)}for(c in s)if(u=s[c],k=n[c],s.hasOwnProperty(c)&&(u!=null||k!=null))switch(c){case"value":$=u;break;case"defaultValue":S=u;break;case"multiple":g=u;default:u!==k&&Qe(e,t,c,u,s,k)}t=S,n=g,s=K,$!=null?xl(e,!!n,$,!1):!!s!=!!n&&(t!=null?xl(e,!!n,t,!0):xl(e,!!n,n?[]:"",!1));return;case"textarea":K=$=null;for(S in n)if(c=n[S],n.hasOwnProperty(S)&&c!=null&&!s.hasOwnProperty(S))switch(S){case"value":break;case"children":break;default:Qe(e,t,S,null,s,c)}for(g in s)if(c=s[g],u=n[g],s.hasOwnProperty(g)&&(c!=null||u!=null))switch(g){case"value":$=c;break;case"defaultValue":K=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(r(91));break;default:c!==u&&Qe(e,t,g,c,s,u)}fd(e,$,K);return;case"option":for(var fe in n)if($=n[fe],n.hasOwnProperty(fe)&&$!=null&&!s.hasOwnProperty(fe))switch(fe){case"selected":e.selected=!1;break;default:Qe(e,t,fe,null,s,$)}for(k in s)if($=s[k],K=n[k],s.hasOwnProperty(k)&&$!==K&&($!=null||K!=null))switch(k){case"selected":e.selected=$&&typeof $!="function"&&typeof $!="symbol";break;default:Qe(e,t,k,$,s,K)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var xe in n)$=n[xe],n.hasOwnProperty(xe)&&$!=null&&!s.hasOwnProperty(xe)&&Qe(e,t,xe,null,s,$);for(H in s)if($=s[H],K=n[H],s.hasOwnProperty(H)&&$!==K&&($!=null||K!=null))switch(H){case"children":case"dangerouslySetInnerHTML":if($!=null)throw Error(r(137,t));break;default:Qe(e,t,H,$,s,K)}return;default:if(Co(t)){for(var Ke in n)$=n[Ke],n.hasOwnProperty(Ke)&&$!==void 0&&!s.hasOwnProperty(Ke)&&mu(e,t,Ke,void 0,s,$);for(J in s)$=s[J],K=n[J],!s.hasOwnProperty(J)||$===K||$===void 0&&K===void 0||mu(e,t,J,$,s,K);return}}for(var B in n)$=n[B],n.hasOwnProperty(B)&&$!=null&&!s.hasOwnProperty(B)&&Qe(e,t,B,null,s,$);for(ee in s)$=s[ee],K=n[ee],!s.hasOwnProperty(ee)||$===K||$==null&&K==null||Qe(e,t,ee,$,s,K)}function p0(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function ay(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),s=0;s<n.length;s++){var c=n[s],u=c.transferSize,g=c.initiatorType,S=c.duration;if(u&&S&&p0(g)){for(g=0,S=c.responseEnd,s+=1;s<n.length;s++){var k=n[s],H=k.startTime;if(H>S)break;var J=k.transferSize,ee=k.initiatorType;J&&p0(ee)&&(k=k.responseEnd,g+=J*(k<S?1:(S-H)/(k-H)))}if(--s,t+=8*(u+g)/(c.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var hu=null,pu=null;function qr(e){return e.nodeType===9?e:e.ownerDocument}function g0(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function x0(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function gu(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var xu=null;function ly(){var e=window.event;return e&&e.type==="popstate"?e===xu?!1:(xu=e,!0):(xu=null,!1)}var v0=typeof setTimeout=="function"?setTimeout:void 0,sy=typeof clearTimeout=="function"?clearTimeout:void 0,y0=typeof Promise=="function"?Promise:void 0,iy=typeof queueMicrotask=="function"?queueMicrotask:typeof y0<"u"?function(e){return y0.resolve(null).then(e).catch(ry)}:v0;function ry(e){setTimeout(function(){throw e})}function ka(e){return e==="head"}function b0(e,t){var n=t,s=0;do{var c=n.nextSibling;if(e.removeChild(n),c&&c.nodeType===8)if(n=c.data,n==="/$"||n==="/&"){if(s===0){e.removeChild(c),Zl(t);return}s--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")s++;else if(n==="html")Zs(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,Zs(n);for(var u=n.firstChild;u;){var g=u.nextSibling,S=u.nodeName;u[ye]||S==="SCRIPT"||S==="STYLE"||S==="LINK"&&u.rel.toLowerCase()==="stylesheet"||n.removeChild(u),u=g}}else n==="body"&&Zs(e.ownerDocument.body);n=c}while(n);Zl(t)}function S0(e,t){var n=e;e=0;do{var s=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),s&&s.nodeType===8)if(n=s.data,n==="/$"){if(e===0)break;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=s}while(n)}function vu(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":vu(n),Ge(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function oy(e,t,n,s){for(;e.nodeType===1;){var c=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[ye])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(u=e.getAttribute("rel"),u==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(u!==c.rel||e.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||e.getAttribute("title")!==(c.title==null?null:c.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(u=e.getAttribute("src"),(u!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&u&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var u=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===u)return e}else return e;if(e=ln(e.nextSibling),e===null)break}return null}function cy(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=ln(e.nextSibling),e===null))return null;return e}function A0(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=ln(e.nextSibling),e===null))return null;return e}function yu(e){return e.data==="$?"||e.data==="$~"}function bu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function uy(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var s=function(){t(),n.removeEventListener("DOMContentLoaded",s)};n.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function ln(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var Su=null;function j0(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return ln(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function N0(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(t===0)return e;t--}else n!=="/$"&&n!=="/&"||t++}e=e.previousSibling}return null}function w0(e,t,n){switch(t=qr(n),e){case"html":if(e=t.documentElement,!e)throw Error(r(452));return e;case"head":if(e=t.head,!e)throw Error(r(453));return e;case"body":if(e=t.body,!e)throw Error(r(454));return e;default:throw Error(r(451))}}function Zs(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Ge(e)}var sn=new Map,E0=new Set;function Mr(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var na=X.d;X.d={f:fy,r:dy,D:my,C:hy,L:py,m:gy,X:vy,S:xy,M:yy};function fy(){var e=na.f(),t=br();return e||t}function dy(e){var t=Rt(e);t!==null&&t.tag===5&&t.type==="form"?$m(t):na.r(e)}var Ql=typeof document>"u"?null:document;function C0(e,t,n){var s=Ql;if(s&&typeof t=="string"&&t){var c=It(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof n=="string"&&(c+='[crossorigin="'+n+'"]'),E0.has(c)||(E0.add(c),e={rel:e,crossOrigin:n,href:t},s.querySelector(c)===null&&(t=s.createElement("link"),bt(t,"link",e),Ze(t),s.head.appendChild(t)))}}function my(e){na.D(e),C0("dns-prefetch",e,null)}function hy(e,t){na.C(e,t),C0("preconnect",e,t)}function py(e,t,n){na.L(e,t,n);var s=Ql;if(s&&e&&t){var c='link[rel="preload"][as="'+It(t)+'"]';t==="image"&&n&&n.imageSrcSet?(c+='[imagesrcset="'+It(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(c+='[imagesizes="'+It(n.imageSizes)+'"]')):c+='[href="'+It(e)+'"]';var u=c;switch(t){case"style":u=Kl(e);break;case"script":u=Fl(e)}sn.has(u)||(e=b({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),sn.set(u,e),s.querySelector(c)!==null||t==="style"&&s.querySelector(Js(u))||t==="script"&&s.querySelector(Is(u))||(t=s.createElement("link"),bt(t,"link",e),Ze(t),s.head.appendChild(t)))}}function gy(e,t){na.m(e,t);var n=Ql;if(n&&e){var s=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+It(s)+'"][href="'+It(e)+'"]',u=c;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=Fl(e)}if(!sn.has(u)&&(e=b({rel:"modulepreload",href:e},t),sn.set(u,e),n.querySelector(c)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Is(u)))return}s=n.createElement("link"),bt(s,"link",e),Ze(s),n.head.appendChild(s)}}}function xy(e,t,n){na.S(e,t,n);var s=Ql;if(s&&e){var c=Ue(s).hoistableStyles,u=Kl(e);t=t||"default";var g=c.get(u);if(!g){var S={loading:0,preload:null};if(g=s.querySelector(Js(u)))S.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":t},n),(n=sn.get(u))&&Au(e,n);var k=g=s.createElement("link");Ze(k),bt(k,"link",e),k._p=new Promise(function(H,J){k.onload=H,k.onerror=J}),k.addEventListener("load",function(){S.loading|=1}),k.addEventListener("error",function(){S.loading|=2}),S.loading|=4,Rr(g,t,s)}g={type:"stylesheet",instance:g,count:1,state:S},c.set(u,g)}}}function vy(e,t){na.X(e,t);var n=Ql;if(n&&e){var s=Ue(n).hoistableScripts,c=Fl(e),u=s.get(c);u||(u=n.querySelector(Is(c)),u||(e=b({src:e,async:!0},t),(t=sn.get(c))&&ju(e,t),u=n.createElement("script"),Ze(u),bt(u,"link",e),n.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},s.set(c,u))}}function yy(e,t){na.M(e,t);var n=Ql;if(n&&e){var s=Ue(n).hoistableScripts,c=Fl(e),u=s.get(c);u||(u=n.querySelector(Is(c)),u||(e=b({src:e,async:!0,type:"module"},t),(t=sn.get(c))&&ju(e,t),u=n.createElement("script"),Ze(u),bt(u,"link",e),n.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},s.set(c,u))}}function q0(e,t,n,s){var c=(c=se.current)?Mr(c):null;if(!c)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=Kl(n.href),n=Ue(c).hoistableStyles,s=n.get(t),s||(s={type:"style",instance:null,count:0,state:null},n.set(t,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=Kl(n.href);var u=Ue(c).hoistableStyles,g=u.get(e);if(g||(c=c.ownerDocument||c,g={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,g),(u=c.querySelector(Js(e)))&&!u._p&&(g.instance=u,g.state.loading=5),sn.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},sn.set(e,n),u||by(c,e,n,g.state))),t&&s===null)throw Error(r(528,""));return g}if(t&&s!==null)throw Error(r(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Fl(n),n=Ue(c).hoistableScripts,s=n.get(t),s||(s={type:"script",instance:null,count:0,state:null},n.set(t,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function Kl(e){return'href="'+It(e)+'"'}function Js(e){return'link[rel="stylesheet"]['+e+"]"}function M0(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function by(e,t,n,s){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?s.loading=1:(t=e.createElement("link"),s.preload=t,t.addEventListener("load",function(){return s.loading|=1}),t.addEventListener("error",function(){return s.loading|=2}),bt(t,"link",n),Ze(t),e.head.appendChild(t))}function Fl(e){return'[src="'+It(e)+'"]'}function Is(e){return"script[async]"+e}function R0(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+It(n.href)+'"]');if(s)return t.instance=s,Ze(s),s;var c=b({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),Ze(s),bt(s,"style",c),Rr(s,n.precedence,e),t.instance=s;case"stylesheet":c=Kl(n.href);var u=e.querySelector(Js(c));if(u)return t.state.loading|=4,t.instance=u,Ze(u),u;s=M0(n),(c=sn.get(c))&&Au(s,c),u=(e.ownerDocument||e).createElement("link"),Ze(u);var g=u;return g._p=new Promise(function(S,k){g.onload=S,g.onerror=k}),bt(u,"link",s),t.state.loading|=4,Rr(u,n.precedence,e),t.instance=u;case"script":return u=Fl(n.src),(c=e.querySelector(Is(u)))?(t.instance=c,Ze(c),c):(s=n,(c=sn.get(u))&&(s=b({},n),ju(s,c)),e=e.ownerDocument||e,c=e.createElement("script"),Ze(c),bt(c,"link",s),e.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(r(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(s=t.instance,t.state.loading|=4,Rr(s,n.precedence,e));return t.instance}function Rr(e,t,n){for(var s=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=s.length?s[s.length-1]:null,u=c,g=0;g<s.length;g++){var S=s[g];if(S.dataset.precedence===t)u=S;else if(u!==c)break}u?u.parentNode.insertBefore(e,u.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Au(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function ju(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var kr=null;function k0(e,t,n){if(kr===null){var s=new Map,c=kr=new Map;c.set(n,s)}else c=kr,s=c.get(n),s||(s=new Map,c.set(n,s));if(s.has(e))return s;for(s.set(e,null),n=n.getElementsByTagName(e),c=0;c<n.length;c++){var u=n[c];if(!(u[ye]||u[dt]||e==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var g=u.getAttribute(t)||"";g=e+g;var S=s.get(g);S?S.push(u):s.set(g,[u])}}return s}function T0(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function Sy(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function _0(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Ay(e,t,n,s){if(n.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var c=Kl(s.href),u=t.querySelector(Js(c));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Tr.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=u,Ze(u);return}u=t.ownerDocument||t,s=M0(s),(c=sn.get(c))&&Au(s,c),u=u.createElement("link"),Ze(u);var g=u;g._p=new Promise(function(S,k){g.onload=S,g.onerror=k}),bt(u,"link",s),n.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=Tr.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var Nu=0;function jy(e,t){return e.stylesheets&&e.count===0&&Dr(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var s=setTimeout(function(){if(e.stylesheets&&Dr(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&Nu===0&&(Nu=62500*ay());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Dr(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>Nu?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(c)}}:null}function Tr(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Dr(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var _r=null;function Dr(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,_r=new Map,t.forEach(Ny,e),_r=null,Tr.call(e))}function Ny(e,t){if(!(t.state.loading&4)){var n=_r.get(e);if(n)var s=n.get(null);else{n=new Map,_r.set(e,n);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<c.length;u++){var g=c[u];(g.nodeName==="LINK"||g.getAttribute("media")!=="not all")&&(n.set(g.dataset.precedence,g),s=g)}s&&n.set(null,s)}c=t.instance,g=c.getAttribute("data-precedence"),u=n.get(g)||s,u===s&&n.set(null,c),n.set(g,c),this.count++,s=Tr.bind(this),c.addEventListener("load",s),c.addEventListener("error",s),u?u.parentNode.insertBefore(c,u.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(c,e.firstChild)),t.state.loading|=4}}var Ws={$$typeof:T,Provider:null,Consumer:null,_currentValue:W,_currentValue2:W,_threadCount:0};function wy(e,t,n,s,c,u,g,S,k){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=qi(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qi(0),this.hiddenUpdates=qi(null),this.identifierPrefix=s,this.onUncaughtError=c,this.onCaughtError=u,this.onRecoverableError=g,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=k,this.incompleteTransitions=new Map}function D0(e,t,n,s,c,u,g,S,k,H,J,ee){return e=new wy(e,t,n,g,k,H,J,ee,S),t=1,u===!0&&(t|=24),u=$t(3,null,null,t),e.current=u,u.stateNode=e,t=ac(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:s,isDehydrated:n,cache:t},rc(u),e}function O0(e){return e?(e=wl,e):wl}function B0(e,t,n,s,c,u){c=O0(c),s.context===null?s.context=c:s.pendingContext=c,s=ba(t),s.payload={element:n},u=u===void 0?null:u,u!==null&&(s.callback=u),n=Sa(e,s,t),n!==null&&(Bt(n,e,t),Rs(n,e,t))}function L0(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function wu(e,t){L0(e,t),(e=e.alternate)&&L0(e,t)}function z0(e){if(e.tag===13||e.tag===31){var t=Fa(e,67108864);t!==null&&Bt(t,e,67108864),wu(e,67108864)}}function U0(e){if(e.tag===13||e.tag===31){var t=Ft();t=ma(t);var n=Fa(e,t);n!==null&&Bt(n,e,t),wu(e,t)}}var Or=!0;function Ey(e,t,n,s){var c=q.T;q.T=null;var u=X.p;try{X.p=2,Eu(e,t,n,s)}finally{X.p=u,q.T=c}}function Cy(e,t,n,s){var c=q.T;q.T=null;var u=X.p;try{X.p=8,Eu(e,t,n,s)}finally{X.p=u,q.T=c}}function Eu(e,t,n,s){if(Or){var c=Cu(s);if(c===null)du(e,t,s,Br,n),V0(e,s);else if(My(c,e,t,n,s))s.stopPropagation();else if(V0(e,s),t&4&&-1<qy.indexOf(e)){for(;c!==null;){var u=Rt(c);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var g=cn(u.pendingLanes);if(g!==0){var S=u;for(S.pendingLanes|=2,S.entangledLanes|=2;g;){var k=1<<31-ht(g);S.entanglements[1]|=k,g&=~k}Cn(u),(Le&6)===0&&(vr=wt()+500,Qs(0))}}break;case 31:case 13:S=Fa(u,2),S!==null&&Bt(S,u,2),br(),wu(u,2)}if(u=Cu(s),u===null&&du(e,t,s,Br,n),u===c)break;c=u}c!==null&&s.stopPropagation()}else du(e,t,s,null,n)}}function Cu(e){return e=Mo(e),qu(e)}var Br=null;function qu(e){if(Br=null,e=ze(e),e!==null){var t=d(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=h(t),e!==null)return e;e=null}else if(n===31){if(e=p(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Br=e,null}function H0(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(So()){case zt:return 2;case Ut:return 8;case ua:case Ao:return 32;case us:return 268435456;default:return 32}default:return 32}}var Mu=!1,Ta=null,_a=null,Da=null,Ps=new Map,ei=new Map,Oa=[],qy="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function V0(e,t){switch(e){case"focusin":case"focusout":Ta=null;break;case"dragenter":case"dragleave":_a=null;break;case"mouseover":case"mouseout":Da=null;break;case"pointerover":case"pointerout":Ps.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ei.delete(t.pointerId)}}function ti(e,t,n,s,c,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:n,eventSystemFlags:s,nativeEvent:u,targetContainers:[c]},t!==null&&(t=Rt(t),t!==null&&z0(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function My(e,t,n,s,c){switch(t){case"focusin":return Ta=ti(Ta,e,t,n,s,c),!0;case"dragenter":return _a=ti(_a,e,t,n,s,c),!0;case"mouseover":return Da=ti(Da,e,t,n,s,c),!0;case"pointerover":var u=c.pointerId;return Ps.set(u,ti(Ps.get(u)||null,e,t,n,s,c)),!0;case"gotpointercapture":return u=c.pointerId,ei.set(u,ti(ei.get(u)||null,e,t,n,s,c)),!0}return!1}function Y0(e){var t=ze(e.target);if(t!==null){var n=d(t);if(n!==null){if(t=n.tag,t===13){if(t=h(n),t!==null){e.blockedOn=t,ms(e.priority,function(){U0(n)});return}}else if(t===31){if(t=p(n),t!==null){e.blockedOn=t,ms(e.priority,function(){U0(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Lr(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Cu(e.nativeEvent);if(n===null){n=e.nativeEvent;var s=new n.constructor(n.type,n);qo=s,n.target.dispatchEvent(s),qo=null}else return t=Rt(n),t!==null&&z0(t),e.blockedOn=n,!1;t.shift()}return!0}function $0(e,t,n){Lr(e)&&n.delete(t)}function Ry(){Mu=!1,Ta!==null&&Lr(Ta)&&(Ta=null),_a!==null&&Lr(_a)&&(_a=null),Da!==null&&Lr(Da)&&(Da=null),Ps.forEach($0),ei.forEach($0)}function zr(e,t){e.blockedOn===t&&(e.blockedOn=null,Mu||(Mu=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,Ry)))}var Ur=null;function G0(e){Ur!==e&&(Ur=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){Ur===e&&(Ur=null);for(var t=0;t<e.length;t+=3){var n=e[t],s=e[t+1],c=e[t+2];if(typeof s!="function"){if(qu(s||n)===null)continue;break}var u=Rt(n);u!==null&&(e.splice(t,3),t-=3,Cc(u,{pending:!0,data:c,method:n.method,action:s},s,c))}}))}function Zl(e){function t(k){return zr(k,e)}Ta!==null&&zr(Ta,e),_a!==null&&zr(_a,e),Da!==null&&zr(Da,e),Ps.forEach(t),ei.forEach(t);for(var n=0;n<Oa.length;n++){var s=Oa[n];s.blockedOn===e&&(s.blockedOn=null)}for(;0<Oa.length&&(n=Oa[0],n.blockedOn===null);)Y0(n),n.blockedOn===null&&Oa.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(s=0;s<n.length;s+=3){var c=n[s],u=n[s+1],g=c[jt]||null;if(typeof u=="function")g||G0(n);else if(g){var S=null;if(u&&u.hasAttribute("formAction")){if(c=u,g=u[jt]||null)S=g.formAction;else if(qu(c)!==null)continue}else S=g.action;typeof S=="function"?n[s+1]=S:(n.splice(s,3),s-=3),G0(n)}}}function X0(){function e(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(g){return c=g})},focusReset:"manual",scroll:"manual"})}function t(){c!==null&&(c(),c=null),s||setTimeout(n,20)}function n(){if(!s&&!navigation.transition){var u=navigation.currentEntry;u&&u.url!=null&&navigation.navigate(u.url,{state:u.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var s=!1,c=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),c!==null&&(c(),c=null)}}}function Ru(e){this._internalRoot=e}Hr.prototype.render=Ru.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));var n=t.current,s=Ft();B0(n,s,e,t,null,null)},Hr.prototype.unmount=Ru.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;B0(e.current,2,null,e,null,null),br(),t[zn]=null}};function Hr(e){this._internalRoot=e}Hr.prototype.unstable_scheduleHydration=function(e){if(e){var t=$a();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Oa.length&&t!==0&&t<Oa[n].priority;n++);Oa.splice(n,0,e),n===0&&Y0(e)}};var Q0=l.version;if(Q0!=="19.2.0")throw Error(r(527,Q0,"19.2.0"));X.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(r(188)):(e=Object.keys(e).join(","),Error(r(268,e)));return e=v(t),e=e!==null?y(e):null,e=e===null?null:e.stateNode,e};var ky={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:q,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Vr=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Vr.isDisabled&&Vr.supportsFiber)try{Ha=Vr.inject(ky),Et=Vr}catch{}}return ai.createRoot=function(e,t){if(!f(e))throw Error(r(299));var n=!1,s="",c=Pm,u=eh,g=th;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onUncaughtError!==void 0&&(c=t.onUncaughtError),t.onCaughtError!==void 0&&(u=t.onCaughtError),t.onRecoverableError!==void 0&&(g=t.onRecoverableError)),t=D0(e,1,!1,null,null,n,s,null,c,u,g,X0),e[zn]=t.current,fu(e),new Ru(t)},ai.hydrateRoot=function(e,t,n){if(!f(e))throw Error(r(299));var s=!1,c="",u=Pm,g=eh,S=th,k=null;return n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(c=n.identifierPrefix),n.onUncaughtError!==void 0&&(u=n.onUncaughtError),n.onCaughtError!==void 0&&(g=n.onCaughtError),n.onRecoverableError!==void 0&&(S=n.onRecoverableError),n.formState!==void 0&&(k=n.formState)),t=D0(e,1,!0,t,n??null,s,c,k,u,g,S,X0),t.context=O0(null),n=t.current,s=Ft(),s=ma(s),c=ba(s),c.callback=null,Sa(n,c,s),n=s,t.current.lanes=n,At(t,n),Cn(t),e[zn]=t.current,fu(e),new Hr(t)},ai.version="19.2.0",ai}var np;function Yy(){if(np)return _u.exports;np=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(l){console.error(l)}}return a(),_u.exports=Vy(),_u.exports}var $y=Yy();var ap="popstate";function Gy(a={}){function l(r,f){let{pathname:d,search:h,hash:p}=r.location;return of("",{pathname:d,search:h,hash:p},f.state&&f.state.usr||null,f.state&&f.state.key||"default")}function i(r,f){return typeof f=="string"?f:hi(f)}return Qy(l,i,null,a)}function et(a,l){if(a===!1||a===null||typeof a>"u")throw new Error(l)}function xn(a,l){if(!a){typeof console<"u"&&console.warn(l);try{throw new Error(l)}catch{}}}function Xy(){return Math.random().toString(36).substring(2,10)}function lp(a,l){return{usr:a.state,key:a.key,idx:l}}function of(a,l,i=null,r){return{pathname:typeof a=="string"?a:a.pathname,search:"",hash:"",...typeof l=="string"?is(l):l,state:i,key:l&&l.key||r||Xy()}}function hi({pathname:a="/",search:l="",hash:i=""}){return l&&l!=="?"&&(a+=l.charAt(0)==="?"?l:"?"+l),i&&i!=="#"&&(a+=i.charAt(0)==="#"?i:"#"+i),a}function is(a){let l={};if(a){let i=a.indexOf("#");i>=0&&(l.hash=a.substring(i),a=a.substring(0,i));let r=a.indexOf("?");r>=0&&(l.search=a.substring(r),a=a.substring(0,r)),a&&(l.pathname=a)}return l}function Qy(a,l,i,r={}){let{window:f=document.defaultView,v5Compat:d=!1}=r,h=f.history,p="POP",x=null,v=y();v==null&&(v=0,h.replaceState({...h.state,idx:v},""));function y(){return(h.state||{idx:null}).idx}function b(){p="POP";let j=y(),R=j==null?null:j-v;v=j,x&&x({action:p,location:E.location,delta:R})}function N(j,R){p="PUSH";let A=of(E.location,j,R);v=y()+1;let T=lp(A,v),O=E.createHref(A);try{h.pushState(T,"",O)}catch(L){if(L instanceof DOMException&&L.name==="DataCloneError")throw L;f.location.assign(O)}d&&x&&x({action:p,location:E.location,delta:1})}function M(j,R){p="REPLACE";let A=of(E.location,j,R);v=y();let T=lp(A,v),O=E.createHref(A);h.replaceState(T,"",O),d&&x&&x({action:p,location:E.location,delta:0})}function C(j){return Ky(j)}let E={get action(){return p},get location(){return a(f,h)},listen(j){if(x)throw new Error("A history only accepts one active listener");return f.addEventListener(ap,b),x=j,()=>{f.removeEventListener(ap,b),x=null}},createHref(j){return l(f,j)},createURL:C,encodeLocation(j){let R=C(j);return{pathname:R.pathname,search:R.search,hash:R.hash}},push:N,replace:M,go(j){return h.go(j)}};return E}function Ky(a,l=!1){let i="http://localhost";typeof window<"u"&&(i=window.location.origin!=="null"?window.location.origin:window.location.href),et(i,"No window.location.(origin|href) available to create URL");let r=typeof a=="string"?a:hi(a);return r=r.replace(/ $/,"%20"),!l&&r.startsWith("//")&&(r=i+r),new URL(r,i)}function Wp(a,l,i="/"){return Fy(a,l,i,!1)}function Fy(a,l,i,r){let f=typeof l=="string"?is(l):l,d=oa(f.pathname||"/",i);if(d==null)return null;let h=Pp(a);Zy(h);let p=null;for(let x=0;p==null&&x<h.length;++x){let v=ib(d);p=lb(h[x],v,r)}return p}function Pp(a,l=[],i=[],r="",f=!1){let d=(h,p,x=f,v)=>{let y={relativePath:v===void 0?h.path||"":v,caseSensitive:h.caseSensitive===!0,childrenIndex:p,route:h};if(y.relativePath.startsWith("/")){if(!y.relativePath.startsWith(r)&&x)return;et(y.relativePath.startsWith(r),`Absolute route path "${y.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),y.relativePath=y.relativePath.slice(r.length)}let b=ra([r,y.relativePath]),N=i.concat(y);h.children&&h.children.length>0&&(et(h.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${b}".`),Pp(h.children,l,N,b,x)),!(h.path==null&&!h.index)&&l.push({path:b,score:nb(b,h.index),routesMeta:N})};return a.forEach((h,p)=>{if(h.path===""||!h.path?.includes("?"))d(h,p);else for(let x of eg(h.path))d(h,p,!0,x)}),l}function eg(a){let l=a.split("/");if(l.length===0)return[];let[i,...r]=l,f=i.endsWith("?"),d=i.replace(/\?$/,"");if(r.length===0)return f?[d,""]:[d];let h=eg(r.join("/")),p=[];return p.push(...h.map(x=>x===""?d:[d,x].join("/"))),f&&p.push(...h),p.map(x=>a.startsWith("/")&&x===""?"/":x)}function Zy(a){a.sort((l,i)=>l.score!==i.score?i.score-l.score:ab(l.routesMeta.map(r=>r.childrenIndex),i.routesMeta.map(r=>r.childrenIndex)))}var Jy=/^:[\w-]+$/,Iy=3,Wy=2,Py=1,eb=10,tb=-2,sp=a=>a==="*";function nb(a,l){let i=a.split("/"),r=i.length;return i.some(sp)&&(r+=tb),l&&(r+=Wy),i.filter(f=>!sp(f)).reduce((f,d)=>f+(Jy.test(d)?Iy:d===""?Py:eb),r)}function ab(a,l){return a.length===l.length&&a.slice(0,-1).every((r,f)=>r===l[f])?a[a.length-1]-l[l.length-1]:0}function lb(a,l,i=!1){let{routesMeta:r}=a,f={},d="/",h=[];for(let p=0;p<r.length;++p){let x=r[p],v=p===r.length-1,y=d==="/"?l:l.slice(d.length)||"/",b=lo({path:x.relativePath,caseSensitive:x.caseSensitive,end:v},y),N=x.route;if(!b&&v&&i&&!r[r.length-1].route.index&&(b=lo({path:x.relativePath,caseSensitive:x.caseSensitive,end:!1},y)),!b)return null;Object.assign(f,b.params),h.push({params:f,pathname:ra([d,b.pathname]),pathnameBase:fb(ra([d,b.pathnameBase])),route:N}),b.pathnameBase!=="/"&&(d=ra([d,b.pathnameBase]))}return h}function lo(a,l){typeof a=="string"&&(a={path:a,caseSensitive:!1,end:!0});let[i,r]=sb(a.path,a.caseSensitive,a.end),f=l.match(i);if(!f)return null;let d=f[0],h=d.replace(/(.)\/+$/,"$1"),p=f.slice(1);return{params:r.reduce((v,{paramName:y,isOptional:b},N)=>{if(y==="*"){let C=p[N]||"";h=d.slice(0,d.length-C.length).replace(/(.)\/+$/,"$1")}const M=p[N];return b&&!M?v[y]=void 0:v[y]=(M||"").replace(/%2F/g,"/"),v},{}),pathname:d,pathnameBase:h,pattern:a}}function sb(a,l=!1,i=!0){xn(a==="*"||!a.endsWith("*")||a.endsWith("/*"),`Route path "${a}" will be treated as if it were "${a.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${a.replace(/\*$/,"/*")}".`);let r=[],f="^"+a.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(h,p,x)=>(r.push({paramName:p,isOptional:x!=null}),x?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return a.endsWith("*")?(r.push({paramName:"*"}),f+=a==="*"||a==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):i?f+="\\/*$":a!==""&&a!=="/"&&(f+="(?:(?=\\/|$))"),[new RegExp(f,l?void 0:"i"),r]}function ib(a){try{return a.split("/").map(l=>decodeURIComponent(l).replace(/\//g,"%2F")).join("/")}catch(l){return xn(!1,`The URL path "${a}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${l}).`),a}}function oa(a,l){if(l==="/")return a;if(!a.toLowerCase().startsWith(l.toLowerCase()))return null;let i=l.endsWith("/")?l.length-1:l.length,r=a.charAt(i);return r&&r!=="/"?null:a.slice(i)||"/"}var rb=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ob=a=>rb.test(a);function cb(a,l="/"){let{pathname:i,search:r="",hash:f=""}=typeof a=="string"?is(a):a,d;if(i)if(ob(i))d=i;else{if(i.includes("//")){let h=i;i=i.replace(/\/\/+/g,"/"),xn(!1,`Pathnames cannot have embedded double slashes - normalizing ${h} -> ${i}`)}i.startsWith("/")?d=ip(i.substring(1),"/"):d=ip(i,l)}else d=l;return{pathname:d,search:db(r),hash:mb(f)}}function ip(a,l){let i=l.replace(/\/+$/,"").split("/");return a.split("/").forEach(f=>{f===".."?i.length>1&&i.pop():f!=="."&&i.push(f)}),i.length>1?i.join("/"):"/"}function Lu(a,l,i,r){return`Cannot include a '${a}' character in a manually specified \`to.${l}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${i}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function ub(a){return a.filter((l,i)=>i===0||l.route.path&&l.route.path.length>0)}function tg(a){let l=ub(a);return l.map((i,r)=>r===l.length-1?i.pathname:i.pathnameBase)}function ng(a,l,i,r=!1){let f;typeof a=="string"?f=is(a):(f={...a},et(!f.pathname||!f.pathname.includes("?"),Lu("?","pathname","search",f)),et(!f.pathname||!f.pathname.includes("#"),Lu("#","pathname","hash",f)),et(!f.search||!f.search.includes("#"),Lu("#","search","hash",f)));let d=a===""||f.pathname==="",h=d?"/":f.pathname,p;if(h==null)p=i;else{let b=l.length-1;if(!r&&h.startsWith("..")){let N=h.split("/");for(;N[0]==="..";)N.shift(),b-=1;f.pathname=N.join("/")}p=b>=0?l[b]:"/"}let x=cb(f,p),v=h&&h!=="/"&&h.endsWith("/"),y=(d||h===".")&&i.endsWith("/");return!x.pathname.endsWith("/")&&(v||y)&&(x.pathname+="/"),x}var ra=a=>a.join("/").replace(/\/\/+/g,"/"),fb=a=>a.replace(/\/+$/,"").replace(/^\/*/,"/"),db=a=>!a||a==="?"?"":a.startsWith("?")?a:"?"+a,mb=a=>!a||a==="#"?"":a.startsWith("#")?a:"#"+a;function hb(a){return a!=null&&typeof a.status=="number"&&typeof a.statusText=="string"&&typeof a.internal=="boolean"&&"data"in a}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var ag=["POST","PUT","PATCH","DELETE"];new Set(ag);var pb=["GET",...ag];new Set(pb);var rs=m.createContext(null);rs.displayName="DataRouter";var fo=m.createContext(null);fo.displayName="DataRouterState";m.createContext(!1);var lg=m.createContext({isTransitioning:!1});lg.displayName="ViewTransition";var gb=m.createContext(new Map);gb.displayName="Fetchers";var xb=m.createContext(null);xb.displayName="Await";var _n=m.createContext(null);_n.displayName="Navigation";var Ai=m.createContext(null);Ai.displayName="Location";var ca=m.createContext({outlet:null,matches:[],isDataRoute:!1});ca.displayName="Route";var Cf=m.createContext(null);Cf.displayName="RouteError";function vb(a,{relative:l}={}){et(ji(),"useHref() may be used only in the context of a <Router> component.");let{basename:i,navigator:r}=m.useContext(_n),{hash:f,pathname:d,search:h}=Ni(a,{relative:l}),p=d;return i!=="/"&&(p=d==="/"?i:ra([i,d])),r.createHref({pathname:p,search:h,hash:f})}function ji(){return m.useContext(Ai)!=null}function ml(){return et(ji(),"useLocation() may be used only in the context of a <Router> component."),m.useContext(Ai).location}var sg="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function ig(a){m.useContext(_n).static||m.useLayoutEffect(a)}function yb(){let{isDataRoute:a}=m.useContext(ca);return a?Tb():bb()}function bb(){et(ji(),"useNavigate() may be used only in the context of a <Router> component.");let a=m.useContext(rs),{basename:l,navigator:i}=m.useContext(_n),{matches:r}=m.useContext(ca),{pathname:f}=ml(),d=JSON.stringify(tg(r)),h=m.useRef(!1);return ig(()=>{h.current=!0}),m.useCallback((x,v={})=>{if(xn(h.current,sg),!h.current)return;if(typeof x=="number"){i.go(x);return}let y=ng(x,JSON.parse(d),f,v.relative==="path");a==null&&l!=="/"&&(y.pathname=y.pathname==="/"?l:ra([l,y.pathname])),(v.replace?i.replace:i.push)(y,v.state,v)},[l,i,d,f,a])}m.createContext(null);function Ni(a,{relative:l}={}){let{matches:i}=m.useContext(ca),{pathname:r}=ml(),f=JSON.stringify(tg(i));return m.useMemo(()=>ng(a,JSON.parse(f),r,l==="path"),[a,f,r,l])}function Sb(a,l){return rg(a,l)}function rg(a,l,i,r,f){et(ji(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:d}=m.useContext(_n),{matches:h}=m.useContext(ca),p=h[h.length-1],x=p?p.params:{},v=p?p.pathname:"/",y=p?p.pathnameBase:"/",b=p&&p.route;{let A=b&&b.path||"";og(v,!b||A.endsWith("*")||A.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${v}" (under <Route path="${A}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
||
|
||
Please change the parent <Route path="${A}"> to <Route path="${A==="/"?"*":`${A}/*`}">.`)}let N=ml(),M;if(l){let A=typeof l=="string"?is(l):l;et(y==="/"||A.pathname?.startsWith(y),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${y}" but pathname "${A.pathname}" was given in the \`location\` prop.`),M=A}else M=N;let C=M.pathname||"/",E=C;if(y!=="/"){let A=y.replace(/^\//,"").split("/");E="/"+C.replace(/^\//,"").split("/").slice(A.length).join("/")}let j=Wp(a,{pathname:E});xn(b||j!=null,`No routes matched location "${M.pathname}${M.search}${M.hash}" `),xn(j==null||j[j.length-1].route.element!==void 0||j[j.length-1].route.Component!==void 0||j[j.length-1].route.lazy!==void 0,`Matched leaf route at location "${M.pathname}${M.search}${M.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let R=Eb(j&&j.map(A=>Object.assign({},A,{params:Object.assign({},x,A.params),pathname:ra([y,d.encodeLocation?d.encodeLocation(A.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:A.pathname]),pathnameBase:A.pathnameBase==="/"?y:ra([y,d.encodeLocation?d.encodeLocation(A.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:A.pathnameBase])})),h,i,r,f);return l&&R?m.createElement(Ai.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...M},navigationType:"POP"}},R):R}function Ab(){let a=kb(),l=hb(a)?`${a.status} ${a.statusText}`:a instanceof Error?a.message:JSON.stringify(a),i=a instanceof Error?a.stack:null,r="rgba(200,200,200, 0.5)",f={padding:"0.5rem",backgroundColor:r},d={padding:"2px 4px",backgroundColor:r},h=null;return console.error("Error handled by React Router default ErrorBoundary:",a),h=m.createElement(m.Fragment,null,m.createElement("p",null,"💿 Hey developer 👋"),m.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",m.createElement("code",{style:d},"ErrorBoundary")," or"," ",m.createElement("code",{style:d},"errorElement")," prop on your route.")),m.createElement(m.Fragment,null,m.createElement("h2",null,"Unexpected Application Error!"),m.createElement("h3",{style:{fontStyle:"italic"}},l),i?m.createElement("pre",{style:f},i):null,h)}var jb=m.createElement(Ab,null),Nb=class extends m.Component{constructor(a){super(a),this.state={location:a.location,revalidation:a.revalidation,error:a.error}}static getDerivedStateFromError(a){return{error:a}}static getDerivedStateFromProps(a,l){return l.location!==a.location||l.revalidation!=="idle"&&a.revalidation==="idle"?{error:a.error,location:a.location,revalidation:a.revalidation}:{error:a.error!==void 0?a.error:l.error,location:l.location,revalidation:a.revalidation||l.revalidation}}componentDidCatch(a,l){this.props.onError?this.props.onError(a,l):console.error("React Router caught the following error during render",a)}render(){return this.state.error!==void 0?m.createElement(ca.Provider,{value:this.props.routeContext},m.createElement(Cf.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function wb({routeContext:a,match:l,children:i}){let r=m.useContext(rs);return r&&r.static&&r.staticContext&&(l.route.errorElement||l.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=l.route.id),m.createElement(ca.Provider,{value:a},i)}function Eb(a,l=[],i=null,r=null,f=null){if(a==null){if(!i)return null;if(i.errors)a=i.matches;else if(l.length===0&&!i.initialized&&i.matches.length>0)a=i.matches;else return null}let d=a,h=i?.errors;if(h!=null){let y=d.findIndex(b=>b.route.id&&h?.[b.route.id]!==void 0);et(y>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(h).join(",")}`),d=d.slice(0,Math.min(d.length,y+1))}let p=!1,x=-1;if(i)for(let y=0;y<d.length;y++){let b=d[y];if((b.route.HydrateFallback||b.route.hydrateFallbackElement)&&(x=y),b.route.id){let{loaderData:N,errors:M}=i,C=b.route.loader&&!N.hasOwnProperty(b.route.id)&&(!M||M[b.route.id]===void 0);if(b.route.lazy||C){p=!0,x>=0?d=d.slice(0,x+1):d=[d[0]];break}}}let v=i&&r?(y,b)=>{r(y,{location:i.location,params:i.matches?.[0]?.params??{},errorInfo:b})}:void 0;return d.reduceRight((y,b,N)=>{let M,C=!1,E=null,j=null;i&&(M=h&&b.route.id?h[b.route.id]:void 0,E=b.route.errorElement||jb,p&&(x<0&&N===0?(og("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),C=!0,j=null):x===N&&(C=!0,j=b.route.hydrateFallbackElement||null)));let R=l.concat(d.slice(0,N+1)),A=()=>{let T;return M?T=E:C?T=j:b.route.Component?T=m.createElement(b.route.Component,null):b.route.element?T=b.route.element:T=y,m.createElement(wb,{match:b,routeContext:{outlet:y,matches:R,isDataRoute:i!=null},children:T})};return i&&(b.route.ErrorBoundary||b.route.errorElement||N===0)?m.createElement(Nb,{location:i.location,revalidation:i.revalidation,component:E,error:M,children:A(),routeContext:{outlet:null,matches:R,isDataRoute:!0},onError:v}):A()},null)}function qf(a){return`${a} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Cb(a){let l=m.useContext(rs);return et(l,qf(a)),l}function qb(a){let l=m.useContext(fo);return et(l,qf(a)),l}function Mb(a){let l=m.useContext(ca);return et(l,qf(a)),l}function Mf(a){let l=Mb(a),i=l.matches[l.matches.length-1];return et(i.route.id,`${a} can only be used on routes that contain a unique "id"`),i.route.id}function Rb(){return Mf("useRouteId")}function kb(){let a=m.useContext(Cf),l=qb("useRouteError"),i=Mf("useRouteError");return a!==void 0?a:l.errors?.[i]}function Tb(){let{router:a}=Cb("useNavigate"),l=Mf("useNavigate"),i=m.useRef(!1);return ig(()=>{i.current=!0}),m.useCallback(async(f,d={})=>{xn(i.current,sg),i.current&&(typeof f=="number"?a.navigate(f):await a.navigate(f,{fromRouteId:l,...d}))},[a,l])}var rp={};function og(a,l,i){!l&&!rp[a]&&(rp[a]=!0,xn(!1,i))}m.memo(_b);function _b({routes:a,future:l,state:i,unstable_onError:r}){return rg(a,void 0,i,r,l)}function Fr(a){et(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function Db({basename:a="/",children:l=null,location:i,navigationType:r="POP",navigator:f,static:d=!1}){et(!ji(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let h=a.replace(/^\/*/,"/"),p=m.useMemo(()=>({basename:h,navigator:f,static:d,future:{}}),[h,f,d]);typeof i=="string"&&(i=is(i));let{pathname:x="/",search:v="",hash:y="",state:b=null,key:N="default"}=i,M=m.useMemo(()=>{let C=oa(x,h);return C==null?null:{location:{pathname:C,search:v,hash:y,state:b,key:N},navigationType:r}},[h,x,v,y,b,N,r]);return xn(M!=null,`<Router basename="${h}"> is not able to match the URL "${x}${v}${y}" because it does not start with the basename, so the <Router> won't render anything.`),M==null?null:m.createElement(_n.Provider,{value:p},m.createElement(Ai.Provider,{children:l,value:M}))}function Ob({children:a,location:l}){return Sb(cf(a),l)}function cf(a,l=[]){let i=[];return m.Children.forEach(a,(r,f)=>{if(!m.isValidElement(r))return;let d=[...l,f];if(r.type===m.Fragment){i.push.apply(i,cf(r.props.children,d));return}et(r.type===Fr,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),et(!r.props.index||!r.props.children,"An index route cannot have child routes.");let h={id:r.props.id||d.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(h.children=cf(r.props.children,d)),i.push(h)}),i}var Zr="get",Jr="application/x-www-form-urlencoded";function mo(a){return a!=null&&typeof a.tagName=="string"}function Bb(a){return mo(a)&&a.tagName.toLowerCase()==="button"}function Lb(a){return mo(a)&&a.tagName.toLowerCase()==="form"}function zb(a){return mo(a)&&a.tagName.toLowerCase()==="input"}function Ub(a){return!!(a.metaKey||a.altKey||a.ctrlKey||a.shiftKey)}function Hb(a,l){return a.button===0&&(!l||l==="_self")&&!Ub(a)}var Yr=null;function Vb(){if(Yr===null)try{new FormData(document.createElement("form"),0),Yr=!1}catch{Yr=!0}return Yr}var Yb=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function zu(a){return a!=null&&!Yb.has(a)?(xn(!1,`"${a}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Jr}"`),null):a}function $b(a,l){let i,r,f,d,h;if(Lb(a)){let p=a.getAttribute("action");r=p?oa(p,l):null,i=a.getAttribute("method")||Zr,f=zu(a.getAttribute("enctype"))||Jr,d=new FormData(a)}else if(Bb(a)||zb(a)&&(a.type==="submit"||a.type==="image")){let p=a.form;if(p==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let x=a.getAttribute("formaction")||p.getAttribute("action");if(r=x?oa(x,l):null,i=a.getAttribute("formmethod")||p.getAttribute("method")||Zr,f=zu(a.getAttribute("formenctype"))||zu(p.getAttribute("enctype"))||Jr,d=new FormData(p,a),!Vb()){let{name:v,type:y,value:b}=a;if(y==="image"){let N=v?`${v}.`:"";d.append(`${N}x`,"0"),d.append(`${N}y`,"0")}else v&&d.append(v,b)}}else{if(mo(a))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');i=Zr,r=null,f=Jr,h=a}return d&&f==="text/plain"&&(h=d,d=void 0),{action:r,method:i.toLowerCase(),encType:f,formData:d,body:h}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Rf(a,l){if(a===!1||a===null||typeof a>"u")throw new Error(l)}function Gb(a,l,i){let r=typeof a=="string"?new URL(a,typeof window>"u"?"server://singlefetch/":window.location.origin):a;return r.pathname==="/"?r.pathname=`_root.${i}`:l&&oa(r.pathname,l)==="/"?r.pathname=`${l.replace(/\/$/,"")}/_root.${i}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${i}`,r}async function Xb(a,l){if(a.id in l)return l[a.id];try{let i=await import(a.module);return l[a.id]=i,i}catch(i){return console.error(`Error loading route module \`${a.module}\`, reloading page...`),console.error(i),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Qb(a){return a==null?!1:a.href==null?a.rel==="preload"&&typeof a.imageSrcSet=="string"&&typeof a.imageSizes=="string":typeof a.rel=="string"&&typeof a.href=="string"}async function Kb(a,l,i){let r=await Promise.all(a.map(async f=>{let d=l.routes[f.route.id];if(d){let h=await Xb(d,i);return h.links?h.links():[]}return[]}));return Ib(r.flat(1).filter(Qb).filter(f=>f.rel==="stylesheet"||f.rel==="preload").map(f=>f.rel==="stylesheet"?{...f,rel:"prefetch",as:"style"}:{...f,rel:"prefetch"}))}function op(a,l,i,r,f,d){let h=(x,v)=>i[v]?x.route.id!==i[v].route.id:!0,p=(x,v)=>i[v].pathname!==x.pathname||i[v].route.path?.endsWith("*")&&i[v].params["*"]!==x.params["*"];return d==="assets"?l.filter((x,v)=>h(x,v)||p(x,v)):d==="data"?l.filter((x,v)=>{let y=r.routes[x.route.id];if(!y||!y.hasLoader)return!1;if(h(x,v)||p(x,v))return!0;if(x.route.shouldRevalidate){let b=x.route.shouldRevalidate({currentUrl:new URL(f.pathname+f.search+f.hash,window.origin),currentParams:i[0]?.params||{},nextUrl:new URL(a,window.origin),nextParams:x.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function Fb(a,l,{includeHydrateFallback:i}={}){return Zb(a.map(r=>{let f=l.routes[r.route.id];if(!f)return[];let d=[f.module];return f.clientActionModule&&(d=d.concat(f.clientActionModule)),f.clientLoaderModule&&(d=d.concat(f.clientLoaderModule)),i&&f.hydrateFallbackModule&&(d=d.concat(f.hydrateFallbackModule)),f.imports&&(d=d.concat(f.imports)),d}).flat(1))}function Zb(a){return[...new Set(a)]}function Jb(a){let l={},i=Object.keys(a).sort();for(let r of i)l[r]=a[r];return l}function Ib(a,l){let i=new Set;return new Set(l),a.reduce((r,f)=>{let d=JSON.stringify(Jb(f));return i.has(d)||(i.add(d),r.push({key:d,link:f})),r},[])}function cg(){let a=m.useContext(rs);return Rf(a,"You must render this element inside a <DataRouterContext.Provider> element"),a}function Wb(){let a=m.useContext(fo);return Rf(a,"You must render this element inside a <DataRouterStateContext.Provider> element"),a}var kf=m.createContext(void 0);kf.displayName="FrameworkContext";function ug(){let a=m.useContext(kf);return Rf(a,"You must render this element inside a <HydratedRouter> element"),a}function Pb(a,l){let i=m.useContext(kf),[r,f]=m.useState(!1),[d,h]=m.useState(!1),{onFocus:p,onBlur:x,onMouseEnter:v,onMouseLeave:y,onTouchStart:b}=l,N=m.useRef(null);m.useEffect(()=>{if(a==="render"&&h(!0),a==="viewport"){let E=R=>{R.forEach(A=>{h(A.isIntersecting)})},j=new IntersectionObserver(E,{threshold:.5});return N.current&&j.observe(N.current),()=>{j.disconnect()}}},[a]),m.useEffect(()=>{if(r){let E=setTimeout(()=>{h(!0)},100);return()=>{clearTimeout(E)}}},[r]);let M=()=>{f(!0)},C=()=>{f(!1),h(!1)};return i?a!=="intent"?[d,N,{}]:[d,N,{onFocus:li(p,M),onBlur:li(x,C),onMouseEnter:li(v,M),onMouseLeave:li(y,C),onTouchStart:li(b,M)}]:[!1,N,{}]}function li(a,l){return i=>{a&&a(i),i.defaultPrevented||l(i)}}function e1({page:a,...l}){let{router:i}=cg(),r=m.useMemo(()=>Wp(i.routes,a,i.basename),[i.routes,a,i.basename]);return r?m.createElement(n1,{page:a,matches:r,...l}):null}function t1(a){let{manifest:l,routeModules:i}=ug(),[r,f]=m.useState([]);return m.useEffect(()=>{let d=!1;return Kb(a,l,i).then(h=>{d||f(h)}),()=>{d=!0}},[a,l,i]),r}function n1({page:a,matches:l,...i}){let r=ml(),{manifest:f,routeModules:d}=ug(),{basename:h}=cg(),{loaderData:p,matches:x}=Wb(),v=m.useMemo(()=>op(a,l,x,f,r,"data"),[a,l,x,f,r]),y=m.useMemo(()=>op(a,l,x,f,r,"assets"),[a,l,x,f,r]),b=m.useMemo(()=>{if(a===r.pathname+r.search+r.hash)return[];let C=new Set,E=!1;if(l.forEach(R=>{let A=f.routes[R.route.id];!A||!A.hasLoader||(!v.some(T=>T.route.id===R.route.id)&&R.route.id in p&&d[R.route.id]?.shouldRevalidate||A.hasClientLoader?E=!0:C.add(R.route.id))}),C.size===0)return[];let j=Gb(a,h,"data");return E&&C.size>0&&j.searchParams.set("_routes",l.filter(R=>C.has(R.route.id)).map(R=>R.route.id).join(",")),[j.pathname+j.search]},[h,p,r,f,v,l,a,d]),N=m.useMemo(()=>Fb(y,f),[y,f]),M=t1(y);return m.createElement(m.Fragment,null,b.map(C=>m.createElement("link",{key:C,rel:"prefetch",as:"fetch",href:C,...i})),N.map(C=>m.createElement("link",{key:C,rel:"modulepreload",href:C,...i})),M.map(({key:C,link:E})=>m.createElement("link",{key:C,nonce:i.nonce,...E})))}function a1(...a){return l=>{a.forEach(i=>{typeof i=="function"?i(l):i!=null&&(i.current=l)})}}var fg=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{fg&&(window.__reactRouterVersion="7.9.6")}catch{}function l1({basename:a,children:l,window:i}){let r=m.useRef();r.current==null&&(r.current=Gy({window:i,v5Compat:!0}));let f=r.current,[d,h]=m.useState({action:f.action,location:f.location}),p=m.useCallback(x=>{m.startTransition(()=>h(x))},[h]);return m.useLayoutEffect(()=>f.listen(p),[f,p]),m.createElement(Db,{basename:a,children:l,location:d.location,navigationType:d.action,navigator:f})}var dg=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,mg=m.forwardRef(function({onClick:l,discover:i="render",prefetch:r="none",relative:f,reloadDocument:d,replace:h,state:p,target:x,to:v,preventScrollReset:y,viewTransition:b,...N},M){let{basename:C}=m.useContext(_n),E=typeof v=="string"&&dg.test(v),j,R=!1;if(typeof v=="string"&&E&&(j=v,fg))try{let Y=new URL(window.location.href),F=v.startsWith("//")?new URL(Y.protocol+v):new URL(v),Q=oa(F.pathname,C);F.origin===Y.origin&&Q!=null?v=Q+F.search+F.hash:R=!0}catch{xn(!1,`<Link to="${v}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let A=vb(v,{relative:f}),[T,O,L]=Pb(r,N),Z=o1(v,{replace:h,state:p,target:x,preventScrollReset:y,relative:f,viewTransition:b});function D(Y){l&&l(Y),Y.defaultPrevented||Z(Y)}let G=m.createElement("a",{...N,...L,href:j||A,onClick:R||d?l:D,ref:a1(M,O),target:x,"data-discover":!E&&i==="render"?"true":void 0});return T&&!E?m.createElement(m.Fragment,null,G,m.createElement(e1,{page:A})):G});mg.displayName="Link";var s1=m.forwardRef(function({"aria-current":l="page",caseSensitive:i=!1,className:r="",end:f=!1,style:d,to:h,viewTransition:p,children:x,...v},y){let b=Ni(h,{relative:v.relative}),N=ml(),M=m.useContext(fo),{navigator:C,basename:E}=m.useContext(_n),j=M!=null&&m1(b)&&p===!0,R=C.encodeLocation?C.encodeLocation(b).pathname:b.pathname,A=N.pathname,T=M&&M.navigation&&M.navigation.location?M.navigation.location.pathname:null;i||(A=A.toLowerCase(),T=T?T.toLowerCase():null,R=R.toLowerCase()),T&&E&&(T=oa(T,E)||T);const O=R!=="/"&&R.endsWith("/")?R.length-1:R.length;let L=A===R||!f&&A.startsWith(R)&&A.charAt(O)==="/",Z=T!=null&&(T===R||!f&&T.startsWith(R)&&T.charAt(R.length)==="/"),D={isActive:L,isPending:Z,isTransitioning:j},G=L?l:void 0,Y;typeof r=="function"?Y=r(D):Y=[r,L?"active":null,Z?"pending":null,j?"transitioning":null].filter(Boolean).join(" ");let F=typeof d=="function"?d(D):d;return m.createElement(mg,{...v,"aria-current":G,className:Y,ref:y,style:F,to:h,viewTransition:p},typeof x=="function"?x(D):x)});s1.displayName="NavLink";var i1=m.forwardRef(({discover:a="render",fetcherKey:l,navigate:i,reloadDocument:r,replace:f,state:d,method:h=Zr,action:p,onSubmit:x,relative:v,preventScrollReset:y,viewTransition:b,...N},M)=>{let C=f1(),E=d1(p,{relative:v}),j=h.toLowerCase()==="get"?"get":"post",R=typeof p=="string"&&dg.test(p),A=T=>{if(x&&x(T),T.defaultPrevented)return;T.preventDefault();let O=T.nativeEvent.submitter,L=O?.getAttribute("formmethod")||h;C(O||T.currentTarget,{fetcherKey:l,method:L,navigate:i,replace:f,state:d,relative:v,preventScrollReset:y,viewTransition:b})};return m.createElement("form",{ref:M,method:j,action:E,onSubmit:r?x:A,...N,"data-discover":!R&&a==="render"?"true":void 0})});i1.displayName="Form";function r1(a){return`${a} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function hg(a){let l=m.useContext(rs);return et(l,r1(a)),l}function o1(a,{target:l,replace:i,state:r,preventScrollReset:f,relative:d,viewTransition:h}={}){let p=yb(),x=ml(),v=Ni(a,{relative:d});return m.useCallback(y=>{if(Hb(y,l)){y.preventDefault();let b=i!==void 0?i:hi(x)===hi(v);p(a,{replace:b,state:r,preventScrollReset:f,relative:d,viewTransition:h})}},[x,p,v,i,r,l,a,f,d,h])}var c1=0,u1=()=>`__${String(++c1)}__`;function f1(){let{router:a}=hg("useSubmit"),{basename:l}=m.useContext(_n),i=Rb();return m.useCallback(async(r,f={})=>{let{action:d,method:h,encType:p,formData:x,body:v}=$b(r,l);if(f.navigate===!1){let y=f.fetcherKey||u1();await a.fetch(y,i,f.action||d,{preventScrollReset:f.preventScrollReset,formData:x,body:v,formMethod:f.method||h,formEncType:f.encType||p,flushSync:f.flushSync})}else await a.navigate(f.action||d,{preventScrollReset:f.preventScrollReset,formData:x,body:v,formMethod:f.method||h,formEncType:f.encType||p,replace:f.replace,state:f.state,fromRouteId:i,flushSync:f.flushSync,viewTransition:f.viewTransition})},[a,l,i])}function d1(a,{relative:l}={}){let{basename:i}=m.useContext(_n),r=m.useContext(ca);et(r,"useFormAction must be used inside a RouteContext");let[f]=r.matches.slice(-1),d={...Ni(a||".",{relative:l})},h=ml();if(a==null){d.search=h.search;let p=new URLSearchParams(d.search),x=p.getAll("index");if(x.some(y=>y==="")){p.delete("index"),x.filter(b=>b).forEach(b=>p.append("index",b));let y=p.toString();d.search=y?`?${y}`:""}}return(!a||a===".")&&f.route.index&&(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),i!=="/"&&(d.pathname=d.pathname==="/"?i:ra([i,d.pathname])),hi(d)}function m1(a,{relative:l}={}){let i=m.useContext(lg);et(i!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=hg("useViewTransitionState"),f=Ni(a,{relative:l});if(!i.isTransitioning)return!1;let d=oa(i.currentLocation.pathname,r)||i.currentLocation.pathname,h=oa(i.nextLocation.pathname,r)||i.nextLocation.pathname;return lo(f.pathname,h)!=null||lo(f.pathname,d)!=null}const Tn=Object.create(null);Tn.open="0";Tn.close="1";Tn.ping="2";Tn.pong="3";Tn.message="4";Tn.upgrade="5";Tn.noop="6";const Ir=Object.create(null);Object.keys(Tn).forEach(a=>{Ir[Tn[a]]=a});const uf={type:"error",data:"parser error"},pg=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",gg=typeof ArrayBuffer=="function",xg=a=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(a):a&&a.buffer instanceof ArrayBuffer,Tf=({type:a,data:l},i,r)=>pg&&l instanceof Blob?i?r(l):cp(l,r):gg&&(l instanceof ArrayBuffer||xg(l))?i?r(l):cp(new Blob([l]),r):r(Tn[a]+(l||"")),cp=(a,l)=>{const i=new FileReader;return i.onload=function(){const r=i.result.split(",")[1];l("b"+(r||""))},i.readAsDataURL(a)};function up(a){return a instanceof Uint8Array?a:a instanceof ArrayBuffer?new Uint8Array(a):new Uint8Array(a.buffer,a.byteOffset,a.byteLength)}let Uu;function h1(a,l){if(pg&&a.data instanceof Blob)return a.data.arrayBuffer().then(up).then(l);if(gg&&(a.data instanceof ArrayBuffer||xg(a.data)))return l(up(a.data));Tf(a,!1,i=>{Uu||(Uu=new TextEncoder),l(Uu.encode(i))})}const fp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ui=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let a=0;a<fp.length;a++)ui[fp.charCodeAt(a)]=a;const p1=a=>{let l=a.length*.75,i=a.length,r,f=0,d,h,p,x;a[a.length-1]==="="&&(l--,a[a.length-2]==="="&&l--);const v=new ArrayBuffer(l),y=new Uint8Array(v);for(r=0;r<i;r+=4)d=ui[a.charCodeAt(r)],h=ui[a.charCodeAt(r+1)],p=ui[a.charCodeAt(r+2)],x=ui[a.charCodeAt(r+3)],y[f++]=d<<2|h>>4,y[f++]=(h&15)<<4|p>>2,y[f++]=(p&3)<<6|x&63;return v},g1=typeof ArrayBuffer=="function",_f=(a,l)=>{if(typeof a!="string")return{type:"message",data:vg(a,l)};const i=a.charAt(0);return i==="b"?{type:"message",data:x1(a.substring(1),l)}:Ir[i]?a.length>1?{type:Ir[i],data:a.substring(1)}:{type:Ir[i]}:uf},x1=(a,l)=>{if(g1){const i=p1(a);return vg(i,l)}else return{base64:!0,data:a}},vg=(a,l)=>{switch(l){case"blob":return a instanceof Blob?a:new Blob([a]);case"arraybuffer":default:return a instanceof ArrayBuffer?a:a.buffer}},yg="",v1=(a,l)=>{const i=a.length,r=new Array(i);let f=0;a.forEach((d,h)=>{Tf(d,!1,p=>{r[h]=p,++f===i&&l(r.join(yg))})})},y1=(a,l)=>{const i=a.split(yg),r=[];for(let f=0;f<i.length;f++){const d=_f(i[f],l);if(r.push(d),d.type==="error")break}return r};function b1(){return new TransformStream({transform(a,l){h1(a,i=>{const r=i.length;let f;if(r<126)f=new Uint8Array(1),new DataView(f.buffer).setUint8(0,r);else if(r<65536){f=new Uint8Array(3);const d=new DataView(f.buffer);d.setUint8(0,126),d.setUint16(1,r)}else{f=new Uint8Array(9);const d=new DataView(f.buffer);d.setUint8(0,127),d.setBigUint64(1,BigInt(r))}a.data&&typeof a.data!="string"&&(f[0]|=128),l.enqueue(f),l.enqueue(i)})}})}let Hu;function $r(a){return a.reduce((l,i)=>l+i.length,0)}function Gr(a,l){if(a[0].length===l)return a.shift();const i=new Uint8Array(l);let r=0;for(let f=0;f<l;f++)i[f]=a[0][r++],r===a[0].length&&(a.shift(),r=0);return a.length&&r<a[0].length&&(a[0]=a[0].slice(r)),i}function S1(a,l){Hu||(Hu=new TextDecoder);const i=[];let r=0,f=-1,d=!1;return new TransformStream({transform(h,p){for(i.push(h);;){if(r===0){if($r(i)<1)break;const x=Gr(i,1);d=(x[0]&128)===128,f=x[0]&127,f<126?r=3:f===126?r=1:r=2}else if(r===1){if($r(i)<2)break;const x=Gr(i,2);f=new DataView(x.buffer,x.byteOffset,x.length).getUint16(0),r=3}else if(r===2){if($r(i)<8)break;const x=Gr(i,8),v=new DataView(x.buffer,x.byteOffset,x.length),y=v.getUint32(0);if(y>Math.pow(2,21)-1){p.enqueue(uf);break}f=y*Math.pow(2,32)+v.getUint32(4),r=3}else{if($r(i)<f)break;const x=Gr(i,f);p.enqueue(_f(d?x:Hu.decode(x),l)),r=0}if(f===0||f>a){p.enqueue(uf);break}}}})}const bg=4;function ft(a){if(a)return A1(a)}function A1(a){for(var l in ft.prototype)a[l]=ft.prototype[l];return a}ft.prototype.on=ft.prototype.addEventListener=function(a,l){return this._callbacks=this._callbacks||{},(this._callbacks["$"+a]=this._callbacks["$"+a]||[]).push(l),this};ft.prototype.once=function(a,l){function i(){this.off(a,i),l.apply(this,arguments)}return i.fn=l,this.on(a,i),this};ft.prototype.off=ft.prototype.removeListener=ft.prototype.removeAllListeners=ft.prototype.removeEventListener=function(a,l){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var i=this._callbacks["$"+a];if(!i)return this;if(arguments.length==1)return delete this._callbacks["$"+a],this;for(var r,f=0;f<i.length;f++)if(r=i[f],r===l||r.fn===l){i.splice(f,1);break}return i.length===0&&delete this._callbacks["$"+a],this};ft.prototype.emit=function(a){this._callbacks=this._callbacks||{};for(var l=new Array(arguments.length-1),i=this._callbacks["$"+a],r=1;r<arguments.length;r++)l[r-1]=arguments[r];if(i){i=i.slice(0);for(var r=0,f=i.length;r<f;++r)i[r].apply(this,l)}return this};ft.prototype.emitReserved=ft.prototype.emit;ft.prototype.listeners=function(a){return this._callbacks=this._callbacks||{},this._callbacks["$"+a]||[]};ft.prototype.hasListeners=function(a){return!!this.listeners(a).length};const ho=typeof Promise=="function"&&typeof Promise.resolve=="function"?l=>Promise.resolve().then(l):(l,i)=>i(l,0),on=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),j1="arraybuffer";function Sg(a,...l){return l.reduce((i,r)=>(a.hasOwnProperty(r)&&(i[r]=a[r]),i),{})}const N1=on.setTimeout,w1=on.clearTimeout;function po(a,l){l.useNativeTimers?(a.setTimeoutFn=N1.bind(on),a.clearTimeoutFn=w1.bind(on)):(a.setTimeoutFn=on.setTimeout.bind(on),a.clearTimeoutFn=on.clearTimeout.bind(on))}const E1=1.33;function C1(a){return typeof a=="string"?q1(a):Math.ceil((a.byteLength||a.size)*E1)}function q1(a){let l=0,i=0;for(let r=0,f=a.length;r<f;r++)l=a.charCodeAt(r),l<128?i+=1:l<2048?i+=2:l<55296||l>=57344?i+=3:(r++,i+=4);return i}function Ag(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function M1(a){let l="";for(let i in a)a.hasOwnProperty(i)&&(l.length&&(l+="&"),l+=encodeURIComponent(i)+"="+encodeURIComponent(a[i]));return l}function R1(a){let l={},i=a.split("&");for(let r=0,f=i.length;r<f;r++){let d=i[r].split("=");l[decodeURIComponent(d[0])]=decodeURIComponent(d[1])}return l}class k1 extends Error{constructor(l,i,r){super(l),this.description=i,this.context=r,this.type="TransportError"}}class Df extends ft{constructor(l){super(),this.writable=!1,po(this,l),this.opts=l,this.query=l.query,this.socket=l.socket,this.supportsBinary=!l.forceBase64}onError(l,i,r){return super.emitReserved("error",new k1(l,i,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(l){this.readyState==="open"&&this.write(l)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(l){const i=_f(l,this.socket.binaryType);this.onPacket(i)}onPacket(l){super.emitReserved("packet",l)}onClose(l){this.readyState="closed",super.emitReserved("close",l)}pause(l){}createUri(l,i={}){return l+"://"+this._hostname()+this._port()+this.opts.path+this._query(i)}_hostname(){const l=this.opts.hostname;return l.indexOf(":")===-1?l:"["+l+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(l){const i=M1(l);return i.length?"?"+i:""}}class T1 extends Df{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(l){this.readyState="pausing";const i=()=>{this.readyState="paused",l()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||i()})),this.writable||(r++,this.once("drain",function(){--r||i()}))}else i()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(l){const i=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};y1(l,this.socket.binaryType).forEach(i),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const l=()=>{this.write([{type:"close"}])};this.readyState==="open"?l():this.once("open",l)}write(l){this.writable=!1,v1(l,i=>{this.doWrite(i,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const l=this.opts.secure?"https":"http",i=this.query||{};return this.opts.timestampRequests!==!1&&(i[this.opts.timestampParam]=Ag()),!this.supportsBinary&&!i.sid&&(i.b64=1),this.createUri(l,i)}}let jg=!1;try{jg=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const _1=jg;function D1(){}class O1 extends T1{constructor(l){if(super(l),typeof location<"u"){const i=location.protocol==="https:";let r=location.port;r||(r=i?"443":"80"),this.xd=typeof location<"u"&&l.hostname!==location.hostname||r!==l.port}}doWrite(l,i){const r=this.request({method:"POST",data:l});r.on("success",i),r.on("error",(f,d)=>{this.onError("xhr post error",f,d)})}doPoll(){const l=this.request();l.on("data",this.onData.bind(this)),l.on("error",(i,r)=>{this.onError("xhr poll error",i,r)}),this.pollXhr=l}}class kn extends ft{constructor(l,i,r){super(),this.createRequest=l,po(this,r),this._opts=r,this._method=r.method||"GET",this._uri=i,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var l;const i=Sg(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");i.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(i);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let f in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(f)&&r.setRequestHeader(f,this._opts.extraHeaders[f])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(l=this._opts.cookieJar)===null||l===void 0||l.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var f;r.readyState===3&&((f=this._opts.cookieJar)===null||f===void 0||f.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(f){this.setTimeoutFn(()=>{this._onError(f)},0);return}typeof document<"u"&&(this._index=kn.requestsCount++,kn.requests[this._index]=this)}_onError(l){this.emitReserved("error",l,this._xhr),this._cleanup(!0)}_cleanup(l){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=D1,l)try{this._xhr.abort()}catch{}typeof document<"u"&&delete kn.requests[this._index],this._xhr=null}}_onLoad(){const l=this._xhr.responseText;l!==null&&(this.emitReserved("data",l),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}kn.requestsCount=0;kn.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",dp);else if(typeof addEventListener=="function"){const a="onpagehide"in on?"pagehide":"unload";addEventListener(a,dp,!1)}}function dp(){for(let a in kn.requests)kn.requests.hasOwnProperty(a)&&kn.requests[a].abort()}const B1=(function(){const a=Ng({xdomain:!1});return a&&a.responseType!==null})();class L1 extends O1{constructor(l){super(l);const i=l&&l.forceBase64;this.supportsBinary=B1&&!i}request(l={}){return Object.assign(l,{xd:this.xd},this.opts),new kn(Ng,this.uri(),l)}}function Ng(a){const l=a.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!l||_1))return new XMLHttpRequest}catch{}if(!l)try{return new on[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const wg=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class z1 extends Df{get name(){return"websocket"}doOpen(){const l=this.uri(),i=this.opts.protocols,r=wg?{}:Sg(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(l,i,r)}catch(f){return this.emitReserved("error",f)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=l=>this.onClose({description:"websocket connection closed",context:l}),this.ws.onmessage=l=>this.onData(l.data),this.ws.onerror=l=>this.onError("websocket error",l)}write(l){this.writable=!1;for(let i=0;i<l.length;i++){const r=l[i],f=i===l.length-1;Tf(r,this.supportsBinary,d=>{try{this.doWrite(r,d)}catch{}f&&ho(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const l=this.opts.secure?"wss":"ws",i=this.query||{};return this.opts.timestampRequests&&(i[this.opts.timestampParam]=Ag()),this.supportsBinary||(i.b64=1),this.createUri(l,i)}}const Vu=on.WebSocket||on.MozWebSocket;class U1 extends z1{createSocket(l,i,r){return wg?new Vu(l,i,r):i?new Vu(l,i):new Vu(l)}doWrite(l,i){this.ws.send(i)}}class H1 extends Df{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(l){return this.emitReserved("error",l)}this._transport.closed.then(()=>{this.onClose()}).catch(l=>{this.onError("webtransport error",l)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(l=>{const i=S1(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=l.readable.pipeThrough(i).getReader(),f=b1();f.readable.pipeTo(l.writable),this._writer=f.writable.getWriter();const d=()=>{r.read().then(({done:p,value:x})=>{p||(this.onPacket(x),d())}).catch(p=>{})};d();const h={type:"open"};this.query.sid&&(h.data=`{"sid":"${this.query.sid}"}`),this._writer.write(h).then(()=>this.onOpen())})})}write(l){this.writable=!1;for(let i=0;i<l.length;i++){const r=l[i],f=i===l.length-1;this._writer.write(r).then(()=>{f&&ho(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var l;(l=this._transport)===null||l===void 0||l.close()}}const V1={websocket:U1,webtransport:H1,polling:L1},Y1=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,$1=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function ff(a){if(a.length>8e3)throw"URI too long";const l=a,i=a.indexOf("["),r=a.indexOf("]");i!=-1&&r!=-1&&(a=a.substring(0,i)+a.substring(i,r).replace(/:/g,";")+a.substring(r,a.length));let f=Y1.exec(a||""),d={},h=14;for(;h--;)d[$1[h]]=f[h]||"";return i!=-1&&r!=-1&&(d.source=l,d.host=d.host.substring(1,d.host.length-1).replace(/;/g,":"),d.authority=d.authority.replace("[","").replace("]","").replace(/;/g,":"),d.ipv6uri=!0),d.pathNames=G1(d,d.path),d.queryKey=X1(d,d.query),d}function G1(a,l){const i=/\/{2,9}/g,r=l.replace(i,"/").split("/");return(l.slice(0,1)=="/"||l.length===0)&&r.splice(0,1),l.slice(-1)=="/"&&r.splice(r.length-1,1),r}function X1(a,l){const i={};return l.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,f,d){f&&(i[f]=d)}),i}const df=typeof addEventListener=="function"&&typeof removeEventListener=="function",Wr=[];df&&addEventListener("offline",()=>{Wr.forEach(a=>a())},!1);class za extends ft{constructor(l,i){if(super(),this.binaryType=j1,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,l&&typeof l=="object"&&(i=l,l=null),l){const r=ff(l);i.hostname=r.host,i.secure=r.protocol==="https"||r.protocol==="wss",i.port=r.port,r.query&&(i.query=r.query)}else i.host&&(i.hostname=ff(i.host).host);po(this,i),this.secure=i.secure!=null?i.secure:typeof location<"u"&&location.protocol==="https:",i.hostname&&!i.port&&(i.port=this.secure?"443":"80"),this.hostname=i.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=i.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},i.transports.forEach(r=>{const f=r.prototype.name;this.transports.push(f),this._transportsByName[f]=r}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},i),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=R1(this.opts.query)),df&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Wr.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(l){const i=Object.assign({},this.opts.query);i.EIO=bg,i.transport=l,this.id&&(i.sid=this.id);const r=Object.assign({},this.opts,{query:i,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[l]);return new this._transportsByName[l](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const l=this.opts.rememberUpgrade&&za.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const i=this.createTransport(l);i.open(),this.setTransport(i)}setTransport(l){this.transport&&this.transport.removeAllListeners(),this.transport=l,l.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",i=>this._onClose("transport close",i))}onOpen(){this.readyState="open",za.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(l){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",l),this.emitReserved("heartbeat"),l.type){case"open":this.onHandshake(JSON.parse(l.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const i=new Error("server error");i.code=l.data,this._onError(i);break;case"message":this.emitReserved("data",l.data),this.emitReserved("message",l.data);break}}onHandshake(l){this.emitReserved("handshake",l),this.id=l.sid,this.transport.query.sid=l.sid,this._pingInterval=l.pingInterval,this._pingTimeout=l.pingTimeout,this._maxPayload=l.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const l=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+l,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},l),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const l=this._getWritablePackets();this.transport.send(l),this._prevBufferLen=l.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let i=1;for(let r=0;r<this.writeBuffer.length;r++){const f=this.writeBuffer[r].data;if(f&&(i+=C1(f)),r>0&&i>this._maxPayload)return this.writeBuffer.slice(0,r);i+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const l=Date.now()>this._pingTimeoutTime;return l&&(this._pingTimeoutTime=0,ho(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),l}write(l,i,r){return this._sendPacket("message",l,i,r),this}send(l,i,r){return this._sendPacket("message",l,i,r),this}_sendPacket(l,i,r,f){if(typeof i=="function"&&(f=i,i=void 0),typeof r=="function"&&(f=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const d={type:l,data:i,options:r};this.emitReserved("packetCreate",d),this.writeBuffer.push(d),f&&this.once("flush",f),this.flush()}close(){const l=()=>{this._onClose("forced close"),this.transport.close()},i=()=>{this.off("upgrade",i),this.off("upgradeError",i),l()},r=()=>{this.once("upgrade",i),this.once("upgradeError",i)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():l()}):this.upgrading?r():l()),this}_onError(l){if(za.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",l),this._onClose("transport error",l)}_onClose(l,i){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),df&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=Wr.indexOf(this._offlineEventListener);r!==-1&&Wr.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",l,i),this.writeBuffer=[],this._prevBufferLen=0}}}za.protocol=bg;class Q1 extends za{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let l=0;l<this._upgrades.length;l++)this._probe(this._upgrades[l])}_probe(l){let i=this.createTransport(l),r=!1;za.priorWebsocketSuccess=!1;const f=()=>{r||(i.send([{type:"ping",data:"probe"}]),i.once("packet",b=>{if(!r)if(b.type==="pong"&&b.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",i),!i)return;za.priorWebsocketSuccess=i.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(y(),this.setTransport(i),i.send([{type:"upgrade"}]),this.emitReserved("upgrade",i),i=null,this.upgrading=!1,this.flush())})}else{const N=new Error("probe error");N.transport=i.name,this.emitReserved("upgradeError",N)}}))};function d(){r||(r=!0,y(),i.close(),i=null)}const h=b=>{const N=new Error("probe error: "+b);N.transport=i.name,d(),this.emitReserved("upgradeError",N)};function p(){h("transport closed")}function x(){h("socket closed")}function v(b){i&&b.name!==i.name&&d()}const y=()=>{i.removeListener("open",f),i.removeListener("error",h),i.removeListener("close",p),this.off("close",x),this.off("upgrading",v)};i.once("open",f),i.once("error",h),i.once("close",p),this.once("close",x),this.once("upgrading",v),this._upgrades.indexOf("webtransport")!==-1&&l!=="webtransport"?this.setTimeoutFn(()=>{r||i.open()},200):i.open()}onHandshake(l){this._upgrades=this._filterUpgrades(l.upgrades),super.onHandshake(l)}_filterUpgrades(l){const i=[];for(let r=0;r<l.length;r++)~this.transports.indexOf(l[r])&&i.push(l[r]);return i}}let K1=class extends Q1{constructor(l,i={}){const r=typeof l=="object"?l:i;(!r.transports||r.transports&&typeof r.transports[0]=="string")&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(f=>V1[f]).filter(f=>!!f)),super(l,r)}};function F1(a,l="",i){let r=a;i=i||typeof location<"u"&&location,a==null&&(a=i.protocol+"//"+i.host),typeof a=="string"&&(a.charAt(0)==="/"&&(a.charAt(1)==="/"?a=i.protocol+a:a=i.host+a),/^(https?|wss?):\/\//.test(a)||(typeof i<"u"?a=i.protocol+"//"+a:a="https://"+a),r=ff(a)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const d=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+d+":"+r.port+l,r.href=r.protocol+"://"+d+(i&&i.port===r.port?"":":"+r.port),r}const Z1=typeof ArrayBuffer=="function",J1=a=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(a):a.buffer instanceof ArrayBuffer,Eg=Object.prototype.toString,I1=typeof Blob=="function"||typeof Blob<"u"&&Eg.call(Blob)==="[object BlobConstructor]",W1=typeof File=="function"||typeof File<"u"&&Eg.call(File)==="[object FileConstructor]";function Of(a){return Z1&&(a instanceof ArrayBuffer||J1(a))||I1&&a instanceof Blob||W1&&a instanceof File}function Pr(a,l){if(!a||typeof a!="object")return!1;if(Array.isArray(a)){for(let i=0,r=a.length;i<r;i++)if(Pr(a[i]))return!0;return!1}if(Of(a))return!0;if(a.toJSON&&typeof a.toJSON=="function"&&arguments.length===1)return Pr(a.toJSON(),!0);for(const i in a)if(Object.prototype.hasOwnProperty.call(a,i)&&Pr(a[i]))return!0;return!1}function P1(a){const l=[],i=a.data,r=a;return r.data=mf(i,l),r.attachments=l.length,{packet:r,buffers:l}}function mf(a,l){if(!a)return a;if(Of(a)){const i={_placeholder:!0,num:l.length};return l.push(a),i}else if(Array.isArray(a)){const i=new Array(a.length);for(let r=0;r<a.length;r++)i[r]=mf(a[r],l);return i}else if(typeof a=="object"&&!(a instanceof Date)){const i={};for(const r in a)Object.prototype.hasOwnProperty.call(a,r)&&(i[r]=mf(a[r],l));return i}return a}function eS(a,l){return a.data=hf(a.data,l),delete a.attachments,a}function hf(a,l){if(!a)return a;if(a&&a._placeholder===!0){if(typeof a.num=="number"&&a.num>=0&&a.num<l.length)return l[a.num];throw new Error("illegal attachments")}else if(Array.isArray(a))for(let i=0;i<a.length;i++)a[i]=hf(a[i],l);else if(typeof a=="object")for(const i in a)Object.prototype.hasOwnProperty.call(a,i)&&(a[i]=hf(a[i],l));return a}const tS=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],nS=5;var Re;(function(a){a[a.CONNECT=0]="CONNECT",a[a.DISCONNECT=1]="DISCONNECT",a[a.EVENT=2]="EVENT",a[a.ACK=3]="ACK",a[a.CONNECT_ERROR=4]="CONNECT_ERROR",a[a.BINARY_EVENT=5]="BINARY_EVENT",a[a.BINARY_ACK=6]="BINARY_ACK"})(Re||(Re={}));class aS{constructor(l){this.replacer=l}encode(l){return(l.type===Re.EVENT||l.type===Re.ACK)&&Pr(l)?this.encodeAsBinary({type:l.type===Re.EVENT?Re.BINARY_EVENT:Re.BINARY_ACK,nsp:l.nsp,data:l.data,id:l.id}):[this.encodeAsString(l)]}encodeAsString(l){let i=""+l.type;return(l.type===Re.BINARY_EVENT||l.type===Re.BINARY_ACK)&&(i+=l.attachments+"-"),l.nsp&&l.nsp!=="/"&&(i+=l.nsp+","),l.id!=null&&(i+=l.id),l.data!=null&&(i+=JSON.stringify(l.data,this.replacer)),i}encodeAsBinary(l){const i=P1(l),r=this.encodeAsString(i.packet),f=i.buffers;return f.unshift(r),f}}function mp(a){return Object.prototype.toString.call(a)==="[object Object]"}class Bf extends ft{constructor(l){super(),this.reviver=l}add(l){let i;if(typeof l=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");i=this.decodeString(l);const r=i.type===Re.BINARY_EVENT;r||i.type===Re.BINARY_ACK?(i.type=r?Re.EVENT:Re.ACK,this.reconstructor=new lS(i),i.attachments===0&&super.emitReserved("decoded",i)):super.emitReserved("decoded",i)}else if(Of(l)||l.base64)if(this.reconstructor)i=this.reconstructor.takeBinaryData(l),i&&(this.reconstructor=null,super.emitReserved("decoded",i));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+l)}decodeString(l){let i=0;const r={type:Number(l.charAt(0))};if(Re[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===Re.BINARY_EVENT||r.type===Re.BINARY_ACK){const d=i+1;for(;l.charAt(++i)!=="-"&&i!=l.length;);const h=l.substring(d,i);if(h!=Number(h)||l.charAt(i)!=="-")throw new Error("Illegal attachments");r.attachments=Number(h)}if(l.charAt(i+1)==="/"){const d=i+1;for(;++i&&!(l.charAt(i)===","||i===l.length););r.nsp=l.substring(d,i)}else r.nsp="/";const f=l.charAt(i+1);if(f!==""&&Number(f)==f){const d=i+1;for(;++i;){const h=l.charAt(i);if(h==null||Number(h)!=h){--i;break}if(i===l.length)break}r.id=Number(l.substring(d,i+1))}if(l.charAt(++i)){const d=this.tryParse(l.substr(i));if(Bf.isPayloadValid(r.type,d))r.data=d;else throw new Error("invalid payload")}return r}tryParse(l){try{return JSON.parse(l,this.reviver)}catch{return!1}}static isPayloadValid(l,i){switch(l){case Re.CONNECT:return mp(i);case Re.DISCONNECT:return i===void 0;case Re.CONNECT_ERROR:return typeof i=="string"||mp(i);case Re.EVENT:case Re.BINARY_EVENT:return Array.isArray(i)&&(typeof i[0]=="number"||typeof i[0]=="string"&&tS.indexOf(i[0])===-1);case Re.ACK:case Re.BINARY_ACK:return Array.isArray(i)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class lS{constructor(l){this.packet=l,this.buffers=[],this.reconPack=l}takeBinaryData(l){if(this.buffers.push(l),this.buffers.length===this.reconPack.attachments){const i=eS(this.reconPack,this.buffers);return this.finishedReconstruction(),i}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const sS=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Bf,Encoder:aS,get PacketType(){return Re},protocol:nS},Symbol.toStringTag,{value:"Module"}));function hn(a,l,i){return a.on(l,i),function(){a.off(l,i)}}const iS=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Cg extends ft{constructor(l,i,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=l,this.nsp=i,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const l=this.io;this.subs=[hn(l,"open",this.onopen.bind(this)),hn(l,"packet",this.onpacket.bind(this)),hn(l,"error",this.onerror.bind(this)),hn(l,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...l){return l.unshift("message"),this.emit.apply(this,l),this}emit(l,...i){var r,f,d;if(iS.hasOwnProperty(l))throw new Error('"'+l.toString()+'" is a reserved event name');if(i.unshift(l),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(i),this;const h={type:Re.EVENT,data:i};if(h.options={},h.options.compress=this.flags.compress!==!1,typeof i[i.length-1]=="function"){const y=this.ids++,b=i.pop();this._registerAckCallback(y,b),h.id=y}const p=(f=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||f===void 0?void 0:f.writable,x=this.connected&&!(!((d=this.io.engine)===null||d===void 0)&&d._hasPingExpired());return this.flags.volatile&&!p||(x?(this.notifyOutgoingListeners(h),this.packet(h)):this.sendBuffer.push(h)),this.flags={},this}_registerAckCallback(l,i){var r;const f=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(f===void 0){this.acks[l]=i;return}const d=this.io.setTimeoutFn(()=>{delete this.acks[l];for(let p=0;p<this.sendBuffer.length;p++)this.sendBuffer[p].id===l&&this.sendBuffer.splice(p,1);i.call(this,new Error("operation has timed out"))},f),h=(...p)=>{this.io.clearTimeoutFn(d),i.apply(this,p)};h.withError=!0,this.acks[l]=h}emitWithAck(l,...i){return new Promise((r,f)=>{const d=(h,p)=>h?f(h):r(p);d.withError=!0,i.push(d),this.emit(l,...i)})}_addToQueue(l){let i;typeof l[l.length-1]=="function"&&(i=l.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:l,flags:Object.assign({fromQueue:!0},this.flags)};l.push((f,...d)=>r!==this._queue[0]?void 0:(f!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),i&&i(f)):(this._queue.shift(),i&&i(null,...d)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(l=!1){if(!this.connected||this._queue.length===0)return;const i=this._queue[0];i.pending&&!l||(i.pending=!0,i.tryCount++,this.flags=i.flags,this.emit.apply(this,i.args))}packet(l){l.nsp=this.nsp,this.io._packet(l)}onopen(){typeof this.auth=="function"?this.auth(l=>{this._sendConnectPacket(l)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(l){this.packet({type:Re.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},l):l})}onerror(l){this.connected||this.emitReserved("connect_error",l)}onclose(l,i){this.connected=!1,delete this.id,this.emitReserved("disconnect",l,i),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(l=>{if(!this.sendBuffer.some(r=>String(r.id)===l)){const r=this.acks[l];delete this.acks[l],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(l){if(l.nsp===this.nsp)switch(l.type){case Re.CONNECT:l.data&&l.data.sid?this.onconnect(l.data.sid,l.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Re.EVENT:case Re.BINARY_EVENT:this.onevent(l);break;case Re.ACK:case Re.BINARY_ACK:this.onack(l);break;case Re.DISCONNECT:this.ondisconnect();break;case Re.CONNECT_ERROR:this.destroy();const r=new Error(l.data.message);r.data=l.data.data,this.emitReserved("connect_error",r);break}}onevent(l){const i=l.data||[];l.id!=null&&i.push(this.ack(l.id)),this.connected?this.emitEvent(i):this.receiveBuffer.push(Object.freeze(i))}emitEvent(l){if(this._anyListeners&&this._anyListeners.length){const i=this._anyListeners.slice();for(const r of i)r.apply(this,l)}super.emit.apply(this,l),this._pid&&l.length&&typeof l[l.length-1]=="string"&&(this._lastOffset=l[l.length-1])}ack(l){const i=this;let r=!1;return function(...f){r||(r=!0,i.packet({type:Re.ACK,id:l,data:f}))}}onack(l){const i=this.acks[l.id];typeof i=="function"&&(delete this.acks[l.id],i.withError&&l.data.unshift(null),i.apply(this,l.data))}onconnect(l,i){this.id=l,this.recovered=i&&this._pid===i,this._pid=i,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(l=>this.emitEvent(l)),this.receiveBuffer=[],this.sendBuffer.forEach(l=>{this.notifyOutgoingListeners(l),this.packet(l)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(l=>l()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Re.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(l){return this.flags.compress=l,this}get volatile(){return this.flags.volatile=!0,this}timeout(l){return this.flags.timeout=l,this}onAny(l){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(l),this}prependAny(l){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(l),this}offAny(l){if(!this._anyListeners)return this;if(l){const i=this._anyListeners;for(let r=0;r<i.length;r++)if(l===i[r])return i.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(l){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(l),this}prependAnyOutgoing(l){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(l),this}offAnyOutgoing(l){if(!this._anyOutgoingListeners)return this;if(l){const i=this._anyOutgoingListeners;for(let r=0;r<i.length;r++)if(l===i[r])return i.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(l){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const i=this._anyOutgoingListeners.slice();for(const r of i)r.apply(this,l.data)}}}function os(a){a=a||{},this.ms=a.min||100,this.max=a.max||1e4,this.factor=a.factor||2,this.jitter=a.jitter>0&&a.jitter<=1?a.jitter:0,this.attempts=0}os.prototype.duration=function(){var a=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var l=Math.random(),i=Math.floor(l*this.jitter*a);a=(Math.floor(l*10)&1)==0?a-i:a+i}return Math.min(a,this.max)|0};os.prototype.reset=function(){this.attempts=0};os.prototype.setMin=function(a){this.ms=a};os.prototype.setMax=function(a){this.max=a};os.prototype.setJitter=function(a){this.jitter=a};class pf extends ft{constructor(l,i){var r;super(),this.nsps={},this.subs=[],l&&typeof l=="object"&&(i=l,l=void 0),i=i||{},i.path=i.path||"/socket.io",this.opts=i,po(this,i),this.reconnection(i.reconnection!==!1),this.reconnectionAttempts(i.reconnectionAttempts||1/0),this.reconnectionDelay(i.reconnectionDelay||1e3),this.reconnectionDelayMax(i.reconnectionDelayMax||5e3),this.randomizationFactor((r=i.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new os({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(i.timeout==null?2e4:i.timeout),this._readyState="closed",this.uri=l;const f=i.parser||sS;this.encoder=new f.Encoder,this.decoder=new f.Decoder,this._autoConnect=i.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(l){return arguments.length?(this._reconnection=!!l,l||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(l){return l===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=l,this)}reconnectionDelay(l){var i;return l===void 0?this._reconnectionDelay:(this._reconnectionDelay=l,(i=this.backoff)===null||i===void 0||i.setMin(l),this)}randomizationFactor(l){var i;return l===void 0?this._randomizationFactor:(this._randomizationFactor=l,(i=this.backoff)===null||i===void 0||i.setJitter(l),this)}reconnectionDelayMax(l){var i;return l===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=l,(i=this.backoff)===null||i===void 0||i.setMax(l),this)}timeout(l){return arguments.length?(this._timeout=l,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(l){if(~this._readyState.indexOf("open"))return this;this.engine=new K1(this.uri,this.opts);const i=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const f=hn(i,"open",function(){r.onopen(),l&&l()}),d=p=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",p),l?l(p):this.maybeReconnectOnOpen()},h=hn(i,"error",d);if(this._timeout!==!1){const p=this._timeout,x=this.setTimeoutFn(()=>{f(),d(new Error("timeout")),i.close()},p);this.opts.autoUnref&&x.unref(),this.subs.push(()=>{this.clearTimeoutFn(x)})}return this.subs.push(f),this.subs.push(h),this}connect(l){return this.open(l)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const l=this.engine;this.subs.push(hn(l,"ping",this.onping.bind(this)),hn(l,"data",this.ondata.bind(this)),hn(l,"error",this.onerror.bind(this)),hn(l,"close",this.onclose.bind(this)),hn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(l){try{this.decoder.add(l)}catch(i){this.onclose("parse error",i)}}ondecoded(l){ho(()=>{this.emitReserved("packet",l)},this.setTimeoutFn)}onerror(l){this.emitReserved("error",l)}socket(l,i){let r=this.nsps[l];return r?this._autoConnect&&!r.active&&r.connect():(r=new Cg(this,l,i),this.nsps[l]=r),r}_destroy(l){const i=Object.keys(this.nsps);for(const r of i)if(this.nsps[r].active)return;this._close()}_packet(l){const i=this.encoder.encode(l);for(let r=0;r<i.length;r++)this.engine.write(i[r],l.options)}cleanup(){this.subs.forEach(l=>l()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(l,i){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",l,i),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const l=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const i=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{l.skipReconnect||(this.emitReserved("reconnect_attempt",l.backoff.attempts),!l.skipReconnect&&l.open(f=>{f?(l._reconnecting=!1,l.reconnect(),this.emitReserved("reconnect_error",f)):l.onreconnect()}))},i);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const l=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",l)}}const si={};function eo(a,l){typeof a=="object"&&(l=a,a=void 0),l=l||{};const i=F1(a,l.path||"/socket.io"),r=i.source,f=i.id,d=i.path,h=si[f]&&d in si[f].nsps,p=l.forceNew||l["force new connection"]||l.multiplex===!1||h;let x;return p?x=new pf(r,l):(si[f]||(si[f]=new pf(r,l)),x=si[f]),i.query&&!l.query&&(l.query=i.queryKey),x.socket(i.path,l)}Object.assign(eo,{Manager:pf,Socket:Cg,io:eo,connect:eo});const qg="roverSettings",rS=3600*24*365;function oS(a){try{const l=decodeURIComponent(a??"");return JSON.parse(l)}catch(l){return console.warn("Failed to parse settings cookie",l),null}}function gf(){if(typeof document>"u")return{};const a=`${qg}=`,l=document.cookie.split(";").map(r=>r.trim()).find(r=>r.startsWith(a));if(!l)return{};const i=l.substring(a.length);return oS(i)??{}}function hp(a){if(typeof document>"u")return!1;try{const l=encodeURIComponent(JSON.stringify(a??{})),i=`${qg}=${l}; path=/; max-age=${rS}; samesite=strict`;return document.cookie=i,!0}catch(l){return console.warn("Failed to write settings cookie",l),!1}}const Mg=window.location.origin;console.info("[socket] connecting to",Mg);const cS=gf(),uS=cS?.page?.connectionTransport||"websocket",fS=uS==="polling"?["polling"]:["websocket","polling"],Lf=eo(Mg,{transports:fS,timeout:15e3});Lf.on("connect_error",a=>console.error("connect_error",a.code,a.message,a.data));const Rg=m.createContext(Lf),dS=({children:a})=>o.jsx(Rg.Provider,{value:Lf,children:a}),Dn=()=>m.useContext(Rg),kg=m.createContext({connected:!1,session:null,logs:[],adminLogs:[],login:async()=>{},setRole:async()=>{},requestControl:async()=>{},releaseControl:async()=>{},subscribeAll:async()=>{},homeAssistantToggle:async()=>{},homeAssistantSetState:async()=>{},homeAssistantSetLightColor:async()=>{},setNickname:async()=>{},triggerReplay:async()=>{},setCommunityGoal:async()=>{},setAdminReason:async()=>{},rebootRover:async()=>{},rebootServer:async()=>{}});function mS(a){return m.useCallback((l,i={})=>new Promise((r,f)=>{a.emit(l,i,(d={})=>{d.error?f(new Error(d.error)):r(d)})}),[a])}function hS({children:a}){const l=Dn(),i=mS(l),[r,f]=m.useState(null),[d,h]=m.useState([]),[p,x]=m.useState([]),[v,y]=m.useState([]),[b,N]=m.useState(l.connected);m.useEffect(()=>{const E=()=>N(!0),j=()=>N(!1);return l.on("connect",E),l.on("disconnect",j),()=>{l.off("connect",E),l.off("disconnect",j)}},[l]),m.useEffect(()=>{function E(O){f(O)}function j(O=[]){h(O)}function R(O){h(L=>[...L.slice(-199),O])}function A(O=[]){x(O)}function T(O){x(L=>[...L.slice(-199),O])}return l.on("session:sync",E),l.on("log:init",j),l.on("log:entry",R),l.on("adminlog:init",A),l.on("adminlog:entry",T),l.on("alert:new",(O={})=>{y(L=>[...L.slice(-49),{...O,receivedAt:Date.now()}])}),()=>{l.off("session:sync",E),l.off("log:init",j),l.off("log:entry",R),l.off("adminlog:init",A),l.off("adminlog:entry",T),l.off("alert:new")}},[l]);const M=m.useMemo(()=>({login:(E,j)=>i("auth:login",{username:E,password:j}),setRole:E=>i("session:setRole",{role:E}),requestControl:(E,j={})=>i("session:requestControl",{roverId:E,...j}),releaseControl:E=>i("session:releaseControl",{roverId:E}),subscribeAll:()=>i("session:subscribeAll"),lockRover:(E,j)=>i("session:lockRover",{roverId:E,locked:j}),setMode:E=>i("setMode",{mode:E}),homeAssistantToggle:E=>i("homeAssistant:toggle",{entityId:E}),homeAssistantSetState:(E,j)=>i("homeAssistant:setState",{entityId:E,state:j}),homeAssistantSetLightColor:(E,j)=>i("homeAssistant:lightColor",{entityId:E,rgbColor:j}),setNickname:E=>i("nickname:set",{nickname:E}),triggerReplay:(E=[])=>i("replay:trigger",{sources:E}),setCommunityGoal:E=>i("communityGoal:set",{text:E}),setAdminReason:E=>i("adminReason:set",{text:E}),rebootRover:E=>i("command",{roverId:E,type:"reboot",data:{reboot:{}}}),rebootServer:()=>i("server:reboot"),pushAlert:E=>y(j=>[...j.slice(-49),{...E,receivedAt:Date.now(),id:E.id||Math.random().toString(36).slice(2)}])}),[i]),C=m.useMemo(()=>({connected:b,session:r,logs:d,adminLogs:p,alerts:v,...M}),[M,p,v,b,d,r]);return o.jsx(kg.Provider,{value:C,children:a})}function Ye(){return m.useContext(kg)}const Tg=m.createContext({frames:{}});function pS({children:a}){const l=Dn(),[i,r]=m.useState({});m.useEffect(()=>{function d({roverId:h,sensors:p={},frame:x={}}){h&&r(v=>({...v,[h]:{roverId:h,sensors:p,raw:x?.data||null,receivedAt:Date.now()}}))}return l.on("sensorFrame",d),()=>{l.off("sensorFrame",d)}},[l]);const f=m.useMemo(()=>({frames:i}),[i]);return o.jsx(Tg.Provider,{value:f,children:a})}function zf(){return m.useContext(Tg).frames}function cs(a){const l=zf();return a?l[a]??null:null}const gS=650,xS={161:{red:!0},164:{green:!0},165:{force:!0},168:{red:!0,green:!0},169:{red:!0,force:!0},172:{green:!0,force:!0},173:{red:!0,green:!0,force:!0}};function Yu(a){if(typeof a!="number"||a<=0)return null;const l=xS[a];return l?{code:a,...l}:null}function vS(a,l={}){const i=l.holdMs||gS,[r,f]=m.useState({left:null,right:null,omni:null}),[d,h]=m.useState(0);return m.useEffect(()=>{const p=setInterval(()=>h(Date.now()),Math.max(i/2,100));return()=>clearInterval(p)},[i]),m.useEffect(()=>{const p=Date.now(),x=Yu(a?.infraredCharacterLeft),v=Yu(a?.infraredCharacterRight),y=Yu(a?.infraredCharacterOmni);!x&&!v&&!y||f(b=>({left:x?{...x,ts:p}:b.left,right:v?{...v,ts:p}:b.right,omni:y?{...y,ts:p}:b.omni}))},[a?.infraredCharacterLeft,a?.infraredCharacterRight,a?.infraredCharacterOmni]),m.useEffect(()=>{const{left:p,right:x,omni:v}=r;if(!(p?.ts||x?.ts||v?.ts))return;const b=new Date().toISOString();console.debug("[DockIR]",b,{left:p?.code??0,omni:v?.code??0,right:x?.code??0})},[r.left?.code,r.right?.code,r.omni?.code]),m.useMemo(()=>{const p=Date.now(),x=j=>{if(!j)return{active:!1,red:!1,green:!1,force:!1,age:null,code:null};const R=p-j.ts,A=R<=i;return{active:A,age:R,code:j.code,red:!!(j.red&&A),green:!!(j.green&&A),force:!!(j.force&&A)}},v=x(r.left),y=x(r.right),b=x(r.omni),N=v.force||y.force||b.force,M=v.active||y.active||b.active,C=v.active&&!y.active?"right":y.active&&!v.active?"left":"center",E=(y.active?1:0)-(v.active?1:0);return{visible:M,forceDetected:N,left:v,right:y,omni:b,bias:C,balance:Math.max(-1,Math.min(1,E))}},[r.left,r.right,r.omni,i,d])}function yS(){const{connected:a,session:l}=Ye(),i=l?.assignment?.roverId,r=cs(i),f=r?.sensors||{},d=vS(f),h=f.voltageMv!=null?`${(f.voltageMv/1e3).toFixed(2)} V`:null,p=f.currentMa!=null?`${f.currentMa} mA`:null,x=f.batteryTemperatureC!=null?`${f.batteryTemperatureC} °C`:null,v=f.batteryChargeMah,y=f.batteryCapacityMah;r?.receivedAt&&new Date(r.receivedAt).toLocaleTimeString();const b=r?.raw?r.raw:null,N=i?l?.activeDrivers?.[i]:null;return m.useMemo(()=>i?N?N===l?.socketId?"You":(l?.users||[]).find(C=>C.socketId===N)?.nickname||N.slice(0,6):"Available":"n/a",[N,i,l?.socketId,l?.users]),o.jsxs("section",{className:"panel-section space-y-0.5 text-base text-slate-100",children:[i?r?o.jsxs(o.Fragment,{children:[o.jsx(bS,{sensors:f,voltage:h,current:p,batteryTemp:x,charge:v,capacity:y}),o.jsx(SS,{sensors:f,dockState:d})]}):o.jsx("p",{className:"text-sm text-slate-500",children:"Waiting for sensor frames…"}):o.jsx("p",{className:"text-sm text-slate-500",children:"Assign a rover to view sensors."}),b&&o.jsx("pre",{className:"surface whitespace-pre-wrap break-words text-xs text-lime-300",children:b})]})}function bS({sensors:a,voltage:l,current:i,batteryTemp:r,charge:f,capacity:d}){const h=f!=null&&d?`${Math.round(f/d*100)}`:"--",p=a?.oiMode?.label||"--",x=a?.chargingSources?.homeBase?"Yes":"No",v=a?.chargingState?.label||"--";return o.jsxs("div",{className:"grid grid-cols-2 gap-0.5 md:grid-cols-3",children:[o.jsx(aa,{label:"Voltage",value:l??"--"}),o.jsx(aa,{label:"Current",value:i??"--"}),o.jsx(aa,{label:"Battery temp",value:r??"--"}),o.jsx(aa,{label:"Charge",value:f!=null?`${f} mAh`:"--"}),o.jsx(aa,{label:"Capacity",value:d!=null?`${d} mAh`:"--"}),o.jsx(aa,{label:"Charge",value:h}),o.jsx(aa,{label:"OI mode",value:p}),o.jsx(aa,{label:"Docked",value:x}),o.jsx(aa,{label:"Charging state",value:v})]})}function aa({label:a,value:l}){return o.jsxs("div",{className:"surface flex items-center justify-between gap-0.5 px-1 py-0.5 text-sm",children:[o.jsx("span",{className:"text-slate-400",children:a}),o.jsx("span",{className:"text-slate-100",children:l})]})}function SS({sensors:a,dockState:l}){const i=a?.bumpsAndWheelDrops||{},r=a?.wheelOvercurrents||{},f=[{label:"Left",value:a?.lightBumpLeftSignal},{label:"Front Left",value:a?.lightBumpFrontLeftSignal},{label:"Center Left",value:a?.lightBumpCenterLeftSignal},{label:"Center Right",value:a?.lightBumpCenterRightSignal},{label:"Front Right",value:a?.lightBumpFrontRightSignal},{label:"Right",value:a?.lightBumpRightSignal}],d=[{label:"Left",value:a?.cliffLeftSignal,active:a?.cliffLeft},{label:"Front Left",value:a?.cliffFrontLeftSignal,active:a?.cliffFrontLeft},{label:"Front Right",value:a?.cliffFrontRightSignal,active:a?.cliffFrontRight},{label:"Right",value:a?.cliffRightSignal,active:a?.cliffRight}],h=[{label:"Wheel L",value:a?.wheelLeftCurrentMa,over:r.leftWheel},{label:"Wheel R",value:a?.wheelRightCurrentMa,over:r.rightWheel},{label:"Side brush",value:a?.sideBrushCurrentMa,over:r.sideBrush},{label:"Main brush",value:a?.mainBrushCurrentMa,over:r.mainBrush}];return o.jsxs("div",{className:"grid gap-0.5 md:grid-cols-2",children:[o.jsxs(Jl,{title:"Dock IR",children:[o.jsx(AS,{sensors:a}),o.jsx(jS,{state:l})]}),o.jsxs(Jl,{title:"Bumps & drops",children:[o.jsx(la,{label:"Bump L",value:o.jsx(ii,{active:i.bumpLeft})}),o.jsx(la,{label:"Bump R",value:o.jsx(ii,{active:i.bumpRight})}),o.jsx(la,{label:"Wheel drop L",value:o.jsx(ii,{active:i.wheelDropLeft,tone:"amber"})}),o.jsx(la,{label:"Wheel drop R",value:o.jsx(ii,{active:i.wheelDropRight,tone:"amber"})})]}),o.jsx(Jl,{title:"Light bumps (raw)",children:f.map(p=>o.jsx(la,{label:p.label,value:ri(p.value)},p.label))}),o.jsx(Jl,{title:"Cliff sensors",children:d.map(p=>o.jsx(la,{label:p.label,value:`${ri(p.value)} · ${p.active?"bool: true":"bool: false"}`},p.label))}),o.jsx(Jl,{title:"Currents",children:h.map(p=>o.jsx(la,{label:p.label,value:o.jsxs("span",{className:"flex items-center gap-0.5",children:[o.jsx("span",{children:ri(p.value,"mA")}),p.over?o.jsx(ii,{active:!0,tone:"red",label:"over"}):null]})},p.label))}),o.jsxs(Jl,{title:"Dirt detect",children:[o.jsx(la,{label:"Left",value:ri(a?.dirtDetectLeft)}),o.jsx(la,{label:"Right",value:ri(a?.dirtDetect)})]})]})}function Jl({title:a,children:l}){return o.jsxs("div",{className:"surface space-y-0.5 p-1 text-sm",children:[o.jsx("div",{className:"text-[0.8rem] uppercase tracking-wide text-slate-400",children:a}),o.jsx("div",{className:"space-y-0.5",children:l})]})}function la({label:a,value:l}){return o.jsxs("div",{className:"flex items-center justify-between gap-0.5",children:[o.jsx("span",{className:"text-slate-300",children:a}),o.jsx("span",{className:"text-slate-100",children:l})]})}function ii({active:a,tone:l="green",label:i}){const r="rounded px-1.5 py-0.5 text-[0.7rem] font-semibold",f=l==="red"?a?"bg-red-600 text-white":"bg-slate-700 text-slate-300":l==="amber"?a?"bg-amber-500 text-slate-900":"bg-slate-700 text-slate-300":a?"bg-emerald-600 text-white":"bg-slate-700 text-slate-300";return o.jsx("span",{className:`${r} ${f}`,children:i||(a?"true":"false")})}function ri(a,l){return a==null||Number.isNaN(a)?"--":l?`${a} ${l}`:a}function AS({sensors:a}){const l=a?.infraredCharacterLeft,i=a?.infraredCharacterRight,r=a?.infraredCharacterOmni,f=d=>o.jsx("span",{className:`rounded px-1 py-0.25 text-[0.7rem] font-semibold ${d?"bg-emerald-600 text-white":"bg-slate-700 text-slate-300"}`,children:d||"--"});return o.jsxs("div",{className:"flex items-center justify-between gap-0.5 text-xs text-slate-200",children:[o.jsxs("div",{className:"flex items-center gap-0.5",children:[o.jsx("span",{className:"text-slate-400",children:"L"}),f(l)]}),o.jsxs("div",{className:"flex items-center gap-0.5",children:[o.jsx("span",{className:"text-slate-400",children:"O"}),f(r)]}),o.jsxs("div",{className:"flex items-center gap-0.5",children:[o.jsx("span",{className:"text-slate-400",children:"R"}),f(i)]})]})}function jS({state:a}){if(!a)return null;const l=r=>{const f=[];return r?.red&&f.push("R"),r?.green&&f.push("G"),r?.force&&f.push("F"),f.length?f.join(""):"none"},i=r=>r?.age!=null?`${r.age}ms`:"--";return o.jsxs("div",{className:"text-[0.7rem] text-slate-400",children:[o.jsx("div",{children:`Left: ${a.left.code??"--"} (${l(a.left)}) · age ${i(a.left)}`}),o.jsx("div",{children:`Omni: ${a.omni.code??"--"} (${l(a.omni)}) · age ${i(a.omni)}`}),o.jsx("div",{children:`Right: ${a.right.code??"--"} (${l(a.right)}) · age ${i(a.right)}`})]})}const _g=m.createContext(null);function NS({children:a}){const[l,i]=m.useState(()=>({status:"loading",data:{}}));m.useEffect(()=>{const p=gf();i({status:"ready",data:p??{}})},[]);const r=m.useCallback(()=>{const p=gf();i({status:"ready",data:p??{}})},[]),f=m.useCallback(p=>{const x=hp(p??{});return i(x?{status:"ready",data:p??{}}:v=>({...v,status:"error"})),x},[]),d=m.useCallback((p,x)=>{i(v=>{const y=v.data[p]||{},b=typeof x=="function"?x(y):{...y,...x??{}},N={...v.data,[p]:b};return hp(N)?{status:"ready",data:N}:{...v,status:"error"}})},[]),h=m.useMemo(()=>({data:l.data,status:l.status,reload:r,saveAll:f,setNamespace:d}),[l,r,f,d]);return o.jsx(_g.Provider,{value:h,children:a})}function wS(){const a=m.useContext(_g);if(!a)throw new Error("useSettings must be used within SettingsProvider");return a}function it(a,l={}){const{data:i,status:r,setNamespace:f}=wS(),d=i[a]??l??{},h=m.useCallback(v=>{f(a,y=>{const b=y??{};return typeof v=="function"?v(b):{...b,...v??{}}})},[a,f]),p=m.useCallback(v=>{f(a,()=>v??{})},[a,f]),x=m.useCallback(()=>{const v=typeof l=="object"?{...l}:l;f(a,()=>v??{})},[l,a,f]);return{value:d,status:r,save:h,replace:p,reset:x}}function ES(a=[]){return a.map(l=>!l?.type||!l?.id?null:{type:l.type,id:String(l.id),label:l.label||String(l.id),key:`${l.type}:${l.id}`}).filter(Boolean)}function Uf({panelId:a="replay-sources",fillHeight:l=!1}){const{session:i,triggerReplay:r}=Ye(),f=ES(i?.replaySources||[]),{value:d,save:h}=it("replaySources",{}),[p,x]=m.useState([]),[v,y]=m.useState(!1),[b,N]=m.useState(null),[M,C]=m.useState(null),E=i?.replay||null,[j,R]=m.useState(0),A=m.useMemo(()=>{const Y=i?.assignment?.roverId;return Y?[`rover:${Y}`]:[]},[i?.assignment?.roverId]);m.useEffect(()=>{const Y=d?.[a];if(Array.isArray(Y)&&Y.length){x(Y);return}x(A)},[d?.[a],A,a]),m.useEffect(()=>{const Y=new Set(f.map(F=>F.key));x(F=>F.filter(Q=>Y.has(Q)))},[f]);const T=m.useMemo(()=>({rovers:f.filter(Y=>Y.type==="rover"),rooms:f.filter(Y=>Y.type==="room")}),[f]);m.useEffect(()=>{if(!E?.lastTriggeredAt||!E?.cooldownMs){R(0);return}const Y=()=>{const Q=E.lastTriggeredAt+E.cooldownMs-Date.now();R(Math.max(0,Q))};Y();const F=setInterval(Y,250);return()=>clearInterval(F)},[E?.lastTriggeredAt,E?.cooldownMs,E?.remainingMs]);const O=v||i?.mode==="lockdown"||j>0||!p.length,L=Y=>{x(F=>{const Q=F.includes(Y)?F.filter(ne=>ne!==Y):[...F,Y];return h(ne=>({...ne||{},[a]:Q})),Q}),C(null)},Z=async()=>{if(!O){y(!0),N(null),C(null);try{const Y=p.map(F=>{const[Q,ne]=F.split(":");return{type:Q,id:ne}});await r(Y),C("Replay sent. Check the Discord replay channel.")}catch(Y){N(Y.message)}finally{y(!1)}}},D=l?"h-full flex flex-col":"",G=l?"flex-1 min-h-0 overflow-y-auto":"";return o.jsxs("section",{className:`panel-section p-0.75 text-sm ${D}`,children:[o.jsxs("header",{className:"panel-muted flex items-center justify-between text-xs",children:[o.jsx("span",{children:"Replay Sources"}),o.jsx("span",{children:f.length})]}),o.jsxs("div",{className:`grid gap-0.5 md:grid-cols-2 ${G}`,children:[o.jsx(pp,{title:"Rovers",items:T.rovers,selected:p,onToggle:L}),o.jsx(pp,{title:"Room Cams",items:T.rooms,selected:p,onToggle:L})]}),o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("button",{type:"button",className:"button-dark w-full text-xs disabled:opacity-40",onClick:Z,disabled:O,children:j>0?`Replay (${Math.ceil(j/1e3)}s)`:v?"Replay…":"Replay"}),b?o.jsx("div",{className:"text-xs text-amber-400",children:b}):null,M?o.jsx("div",{className:"text-xs text-emerald-300",children:M}):null]})]})}function pp({title:a,items:l,selected:i,onToggle:r}){return l.length?o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("div",{className:"panel-muted text-xs",children:a}),o.jsx("div",{className:"space-y-0.5",children:l.map(f=>o.jsxs("label",{className:"surface flex items-center gap-0.5 text-xs",children:[o.jsx("input",{type:"checkbox",checked:i.includes(f.key),onChange:()=>r(f.key),className:"accent-emerald-400"}),o.jsx("span",{className:"truncate",children:f.label})]},f.key))})]}):null}var Dg={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},gp=dl.createContext&&dl.createContext(Dg),CS=["attr","size","title"];function qS(a,l){if(a==null)return{};var i=MS(a,l),r,f;if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);for(f=0;f<d.length;f++)r=d[f],!(l.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(a,r)&&(i[r]=a[r])}return i}function MS(a,l){if(a==null)return{};var i={};for(var r in a)if(Object.prototype.hasOwnProperty.call(a,r)){if(l.indexOf(r)>=0)continue;i[r]=a[r]}return i}function so(){return so=Object.assign?Object.assign.bind():function(a){for(var l=1;l<arguments.length;l++){var i=arguments[l];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(a[r]=i[r])}return a},so.apply(this,arguments)}function xp(a,l){var i=Object.keys(a);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);l&&(r=r.filter(function(f){return Object.getOwnPropertyDescriptor(a,f).enumerable})),i.push.apply(i,r)}return i}function io(a){for(var l=1;l<arguments.length;l++){var i=arguments[l]!=null?arguments[l]:{};l%2?xp(Object(i),!0).forEach(function(r){RS(a,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(i)):xp(Object(i)).forEach(function(r){Object.defineProperty(a,r,Object.getOwnPropertyDescriptor(i,r))})}return a}function RS(a,l,i){return l=kS(l),l in a?Object.defineProperty(a,l,{value:i,enumerable:!0,configurable:!0,writable:!0}):a[l]=i,a}function kS(a){var l=TS(a,"string");return typeof l=="symbol"?l:l+""}function TS(a,l){if(typeof a!="object"||!a)return a;var i=a[Symbol.toPrimitive];if(i!==void 0){var r=i.call(a,l);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(l==="string"?String:Number)(a)}function Og(a){return a&&a.map((l,i)=>dl.createElement(l.tag,io({key:i},l.attr),Og(l.child)))}function wi(a){return l=>dl.createElement(_S,so({attr:io({},a.attr)},l),Og(a.child))}function _S(a){var l=i=>{var{attr:r,size:f,title:d}=a,h=qS(a,CS),p=f||i.size||"1em",x;return i.className&&(x=i.className),a.className&&(x=(x?x+" ":"")+a.className),dl.createElement("svg",so({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},i.attr,r,h,{className:x,style:io(io({color:a.color||i.color},i.style),a.style),height:p,width:p,xmlns:"http://www.w3.org/2000/svg"}),d&&dl.createElement("title",null,d),a.children)};return gp!==void 0?dl.createElement(gp.Consumer,null,i=>l(i)):l(Dg)}function Bg(a){return wi({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M524.531,69.836a1.5,1.5,0,0,0-.764-.7A485.065,485.065,0,0,0,404.081,32.03a1.816,1.816,0,0,0-1.923.91,337.461,337.461,0,0,0-14.9,30.6,447.848,447.848,0,0,0-134.426,0,309.541,309.541,0,0,0-15.135-30.6,1.89,1.89,0,0,0-1.924-.91A483.689,483.689,0,0,0,116.085,69.137a1.712,1.712,0,0,0-.788.676C39.068,183.651,18.186,294.69,28.43,404.354a2.016,2.016,0,0,0,.765,1.375A487.666,487.666,0,0,0,176.02,479.918a1.9,1.9,0,0,0,2.063-.676A348.2,348.2,0,0,0,208.12,430.4a1.86,1.86,0,0,0-1.019-2.588,321.173,321.173,0,0,1-45.868-21.853,1.885,1.885,0,0,1-.185-3.126c3.082-2.309,6.166-4.711,9.109-7.137a1.819,1.819,0,0,1,1.9-.256c96.229,43.917,200.41,43.917,295.5,0a1.812,1.812,0,0,1,1.924.233c2.944,2.426,6.027,4.851,9.132,7.16a1.884,1.884,0,0,1-.162,3.126,301.407,301.407,0,0,1-45.89,21.83,1.875,1.875,0,0,0-1,2.611,391.055,391.055,0,0,0,30.014,48.815,1.864,1.864,0,0,0,2.063.7A486.048,486.048,0,0,0,610.7,405.729a1.882,1.882,0,0,0,.765-1.352C623.729,277.594,590.933,167.465,524.531,69.836ZM222.491,337.58c-28.972,0-52.844-26.587-52.844-59.239S193.056,219.1,222.491,219.1c29.665,0,53.306,26.82,52.843,59.239C275.334,310.993,251.924,337.58,222.491,337.58Zm195.38,0c-28.971,0-52.843-26.587-52.843-59.239S388.437,219.1,417.871,219.1c29.667,0,53.307,26.82,52.844,59.239C470.715,310.993,447.538,337.58,417.871,337.58Z"},child:[]}]})(a)}function DS(a){return wi({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M448 360V24c0-13.3-10.7-24-24-24H96C43 0 0 43 0 96v320c0 53 43 96 96 96h328c13.3 0 24-10.7 24-24v-16c0-7.5-3.5-14.3-8.9-18.7-4.2-15.4-4.2-59.3 0-74.7 5.4-4.3 8.9-11.1 8.9-18.6zM128 134c0-3.3 2.7-6 6-6h212c3.3 0 6 2.7 6 6v20c0 3.3-2.7 6-6 6H134c-3.3 0-6-2.7-6-6v-20zm0 64c0-3.3 2.7-6 6-6h212c3.3 0 6 2.7 6 6v20c0 3.3-2.7 6-6 6H134c-3.3 0-6-2.7-6-6v-20zm253.4 250H96c-17.7 0-32-14.3-32-32 0-17.6 14.4-32 32-32h285.4c-1.9 17.1-1.9 46.9 0 64z"},child:[]}]})(a)}function vp(a){return wi({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M192 384h192c53 0 96-43 96-96h32c70.6 0 128-57.4 128-128S582.6 32 512 32H120c-13.3 0-24 10.7-24 24v232c0 53 43 96 96 96zM512 96c35.3 0 64 28.7 64 64s-28.7 64-64 64h-32V96h32zm47.7 384H48.3c-47.6 0-61-64-36-64h583.3c25 0 11.8 64-35.9 64z"},child:[]}]})(a)}function OS(a){return wi({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M528 448H112c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h416c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm64-320c-26.5 0-48 21.5-48 48 0 7.1 1.6 13.7 4.4 19.8L476 239.2c-15.4 9.2-35.3 4-44.2-11.6L350.3 85C361 76.2 368 63 368 48c0-26.5-21.5-48-48-48s-48 21.5-48 48c0 15 7 28.2 17.7 37l-81.5 142.6c-8.9 15.6-28.9 20.8-44.2 11.6l-72.3-43.4c2.7-6 4.4-12.7 4.4-19.8 0-26.5-21.5-48-48-48S0 149.5 0 176s21.5 48 48 48c2.6 0 5.2-.4 7.7-.8L128 416h384l72.3-192.8c2.5.4 5.1.8 7.7.8 26.5 0 48-21.5 48-48s-21.5-48-48-48z"},child:[]}]})(a)}function BS(a){return wi({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M326.612 185.391c59.747 59.809 58.927 155.698.36 214.59-.11.12-.24.25-.36.37l-67.2 67.2c-59.27 59.27-155.699 59.262-214.96 0-59.27-59.26-59.27-155.7 0-214.96l37.106-37.106c9.84-9.84 26.786-3.3 27.294 10.606.648 17.722 3.826 35.527 9.69 52.721 1.986 5.822.567 12.262-3.783 16.612l-13.087 13.087c-28.026 28.026-28.905 73.66-1.155 101.96 28.024 28.579 74.086 28.749 102.325.51l67.2-67.19c28.191-28.191 28.073-73.757 0-101.83-3.701-3.694-7.429-6.564-10.341-8.569a16.037 16.037 0 0 1-6.947-12.606c-.396-10.567 3.348-21.456 11.698-29.806l21.054-21.055c5.521-5.521 14.182-6.199 20.584-1.731a152.482 152.482 0 0 1 20.522 17.197zM467.547 44.449c-59.261-59.262-155.69-59.27-214.96 0l-67.2 67.2c-.12.12-.25.25-.36.37-58.566 58.892-59.387 154.781.36 214.59a152.454 152.454 0 0 0 20.521 17.196c6.402 4.468 15.064 3.789 20.584-1.731l21.054-21.055c8.35-8.35 12.094-19.239 11.698-29.806a16.037 16.037 0 0 0-6.947-12.606c-2.912-2.005-6.64-4.875-10.341-8.569-28.073-28.073-28.191-73.639 0-101.83l67.2-67.19c28.239-28.239 74.3-28.069 102.325.51 27.75 28.3 26.872 73.934-1.155 101.96l-13.087 13.087c-4.35 4.35-5.769 10.79-3.783 16.612 5.864 17.194 9.042 34.999 9.69 52.721.509 13.906 17.454 20.446 27.294 10.606l37.106-37.106c59.271-59.259 59.271-155.699.001-214.959z"},child:[]}]})(a)}function LS(a){switch(a){case"admin":case"lockdown":case"lockdown-admin":return"text-amber-300";case"spectator":return"text-slate-400";default:return"text-sky-300"}}function zS(a){const l=new Date(a);return`${l.getHours().toString().padStart(2,"0")}:${l.getMinutes().toString().padStart(2,"0")}`}function yp(a){return a.nickname||a.socketId?.slice(0,6)||"unknown"}function US({guildIconUrl:a,userAvatarUrl:l,label:i}){return!a&&!l?null:o.jsxs("span",{className:"flex h-4 w-4 overflow-hidden rounded-full border border-slate-700/80",title:i,children:[o.jsx("span",{className:`h-full w-1/2 bg-slate-700/70 ${a?"bg-cover":""}`,style:a?{backgroundImage:`url(${a})`,backgroundPosition:"left center",backgroundSize:"200% 100%"}:void 0}),o.jsx("span",{className:`h-full w-1/2 bg-slate-700/70 ${l?"bg-cover":""}`,style:l?{backgroundImage:`url(${l})`,backgroundPosition:"right center",backgroundSize:"200% 100%"}:void 0})]})}function Lg({message:a}){const l=a.fromDiscord?`${a.discordGuildName||"Discord"} · ${yp(a)}`:null;return o.jsxs(o.Fragment,{children:[a.fromDiscord?o.jsxs(o.Fragment,{children:[o.jsx(Bg,{className:"h-3.5 w-3.5 text-indigo-200"}),o.jsx(US,{guildIconUrl:a.discordGuildIconUrl,userAvatarUrl:a.discordUserAvatarUrl,label:l})]}):null,o.jsx("span",{className:`font-semibold text-[0.85rem] ${LS(a.role)}`,children:yp(a)}),a.roverId&&o.jsx("span",{className:"rounded bg-slate-800 px-1 text-[0.7rem]",children:a.roverId})]})}function zg(a){return`surface-muted relative flex flex-wrap items-start gap-0.5 text-sm ${a.role==="admin"||a.role==="lockdown"||a.role==="lockdown-admin"?"border border-amber-400/30":a.fromDiscord?"border border-indigo-400/30 bg-indigo-900/20":""}`}function Ug({message:a}){return o.jsxs("div",{className:zg(a),children:[o.jsx(Lg,{message:a}),o.jsx("span",{className:"text-slate-100 break-words leading-tight whitespace-pre-wrap",children:a.text}),o.jsx("span",{className:"absolute bottom-0.5 right-1 text-[0.65rem] text-slate-400/60",children:zS(a.ts)})]})}function Hg({message:a}){return o.jsxs("div",{className:`${zg(a)} italic opacity-80 border-slate-600/40 bg-slate-900/40`,children:[o.jsx(Lg,{message:a}),o.jsx("span",{className:"text-slate-300",children:"typing..."})]})}const HS=3e3,VS="#2196f3";function YS(a){return a.id?a.id:a.timestamp?`${a.timestamp}-${a.message}`:`${a.title||"alert"}-${a.message}`}function Hf({scale:a=1}){const{alerts:l}=Ye(),[i,r]=m.useState(()=>Date.now()),f=m.useMemo(()=>l.slice(-3).map(x=>({alert:x,key:YS(x)})),[l]);m.useEffect(()=>{if(!f.length)return;const x=setInterval(()=>r(Date.now()),200);return()=>clearInterval(x)},[f.length]);const d=f.map(x=>({...x,age:i-(x.alert.receivedAt??x.alert.timestamp??0)})).filter(x=>x.age<=HS);if(!d.length)return null;const h=a===1?void 0:{transform:`translateX(-50%) scale(${a})`,transformOrigin:"top center"},p=a===1?"pointer-events-none fixed top-0.5 left-1/2 z-50 flex -translate-x-1/2 flex-col gap-0.5":"pointer-events-none fixed top-0.5 left-1/2 z-50 flex flex-col gap-0.5";return o.jsx("div",{className:p,style:h,children:d.map(x=>o.jsx($S,{alert:x.alert},x.key))})}function bp(a){const l=typeof a=="string"?a.trim():"",i=/^#?([0-9a-fA-F]{6})$/.exec(l);if(!i)return null;const r=i[1];return{r:parseInt(r.slice(0,2),16),g:parseInt(r.slice(2,4),16),b:parseInt(r.slice(4,6),16)}}function $S({alert:a}){if(a.kind==="chat"&&a.payload)return o.jsx(Ug,{message:a.payload});if(a.kind==="chat-typing"&&a.payload)return o.jsx(Hg,{message:a.payload});const l=bp(a.color)||bp(VS),i=l?`rgba(${l.r}, ${l.g}, ${l.b}, 0.18)`:"rgba(33, 150, 243, 0.18)",r=l?`rgba(${l.r}, ${l.g}, ${l.b}, 0.45)`:"rgba(33, 150, 243, 0.45)";return o.jsx("div",{className:"pointer-events-auto max-w-[80vw] rounded-full border px-2 py-0.5 text-[0.7rem] leading-tight text-slate-100 shadow-sm shadow-black/30",style:{backgroundColor:i,border:`1px solid ${r}`},children:o.jsxs("p",{className:"truncate text-slate-100",children:[o.jsx("span",{className:"text-slate-300",children:a.title||"Alert"}),o.jsx("span",{className:"text-slate-500",children:" · "}),o.jsx("span",{className:"text-white",children:a.message})]})})}const Il={main:[-127,127],side:[-127,127],vacuum:[0,127]},$u={maxSpeed:500,baseSpeed:250,boostSpeed:400},xf=100,Vf=[31,127],as=60,vf=8,GS=250,XS=4e3,Gu=.4,QS=.8,KS={start:[128],safe:[131],full:[132],passive:[128],dock:[143]},di={driveForward:["w"],driveBackward:["s"],driveLeft:["a"],driveRight:["d"],boostModifier:["\\"],slowModifier:["shift"],auxMainForward:["i"],auxMainReverse:["k"],auxSideForward:["o"],auxSideReverse:["l"],auxVacuumFast:["p"],auxVacuumSlow:[";"],auxAllForward:[","],cameraUp:["u"],cameraDown:["j"],nightVisionToggle:["e"],hornHonk:["h"],driveMacro:["f"],dockMacro:["g"],chatFocus:["enter"],songNoteUp:["ArrowUp"],songNoteDown:["ArrowDown"],homeAssistantOn:["ArrowRight"],homeAssistantOff:["ArrowLeft"]},Vg=[{id:"drive-sequence",label:"Drive",description:"Start, dock, and full command sequence used by the drive button.",steps:[{type:"servo",angle:0},{type:"oi",command:"start"},{type:"pause",duration:xf},{type:"oi",command:"dock"},{type:"pause",duration:xf},{type:"oi",command:"full"},{type:"pause",duration:300},{type:"drive",speeds:{left:-300,right:-300}},{type:"pause",duration:600},{type:"drive",speeds:{left:0,right:0}}]},{id:"seek-dock",label:"Dock",description:"Send the seek dock command.",steps:[{type:"oi",command:"dock"}]}];function yf(){return{vector:{x:0,y:0,boost:!1},speeds:{left:0,right:0},source:null,lastUpdatedAt:0}}function bf(){return{main:0,side:0,vacuum:0}}function FS(){return{enabled:!1,angle:null,config:null}}function to(){return{note:as}}function fi(){return{active:!1,heat:0,overheated:!1}}const Sp={roverId:null,mode:"drive",drive:yf(),aux:bf(),camera:FS(),song:to(),horn:fi(),lastControlIntentAt:0,macros:Vg,keymap:di,inputs:{}};function ZS(a,l){switch(l.type){case"control/set-rover":return{...a,roverId:l.payload??null,drive:l.payload?a.drive:yf(),aux:l.payload?a.aux:bf(),song:l.payload?a.song:to(),horn:l.payload?a.horn:fi(),lastControlIntentAt:l.payload?a.lastControlIntentAt:0};case"control/set-mode":return a.mode===l.payload?a:{...a,mode:l.payload==="dock"?"dock":"drive"};case"control/update-drive":{const{vector:i,speeds:r,source:f}=l.payload;return{...a,drive:{vector:i??a.drive.vector,speeds:r??a.drive.speeds,source:f??a.drive.source,lastUpdatedAt:Date.now()}}}case"control/set-aux-motors":return{...a,aux:{...a.aux,...l.payload}};case"control/set-camera-config":return{...a,camera:{...a.camera,enabled:!!l.payload?.config,config:l.payload?.config??null,angle:typeof l.payload?.angle=="number"?l.payload.angle:l.payload?.config?l.payload.config.homeAngle??a.camera.angle:null}};case"control/set-camera-angle":return{...a,camera:{...a.camera,angle:l.payload}};case"control/register-input-state":{const i=l.payload?.source||"unknown";return{...a,inputs:{...a.inputs,[i]:{...a.inputs[i]??{},...l.payload?.state,updatedAt:Date.now()}}}}case"control/set-keymap":return{...a,keymap:{...a.keymap,...l.payload??{}}};case"control/set-macros":return{...a,macros:Array.isArray(l.payload)?l.payload:a.macros};case"control/reset":return{...a,drive:yf(),aux:bf(),song:to(),horn:fi(),lastControlIntentAt:0};case"control/set-horn-active":return{...a,horn:{...a.horn||fi(),active:!!l.payload}};case"control/set-horn-heat":return{...a,horn:{...a.horn||fi(),heat:typeof l.payload?.heat=="number"?l.payload.heat:0,overheated:!!l.payload?.overheated}};case"control/record-intent":return{...a,lastControlIntentAt:Date.now()};case"control/set-song-note":return{...a,song:{...a.song||to(),note:l.payload??as}};default:return a}}function ls(a,l,i){return typeof a!="number"||Number.isNaN(a)?l:Math.max(l,Math.min(i,a))}function ss(a){return typeof a!="number"||Number.isNaN(a)?0:Math.max(-1,Math.min(1,a))}function rn(a,l){return!Array.isArray(l)||l.length!==2?a:ls(a,l[0],l[1])}function JS(a={}){const l=ss(a.x??0),i=ss(a.y??0);return{x:l,y:i,boost:!!a.boost}}function IS(a={},l={}){const i=JS(a),r=typeof l.maxSpeed=="number"?l.maxSpeed:$u.maxSpeed,f=typeof l.baseSpeed=="number"?l.baseSpeed:$u.baseSpeed,d=typeof l.boostSpeed=="number"?l.boostSpeed:$u.boostSpeed,h=i.boost?d:f,p=i.y*h,x=i.x*h;return{vector:i,speeds:{left:ls(Math.round(p+x),-r,r),right:ls(Math.round(p-x),-r,r)}}}function WS(a){const l=Array.isArray(a)?a:[],i=String.fromCharCode(...l);if(typeof btoa=="function")return btoa(i);if(typeof Buffer<"u")return Buffer.from(l).toString("base64");throw new Error("No base64 encoder available")}function Ap(a){return new Promise(l=>setTimeout(l,a))}function PS(a={}){const{driveTransform:l,auxTransform:i}=a,r=Dn(),{session:f}=Ye(),d=f?.assignment?.roverId,h=m.useMemo(()=>!d||!Array.isArray(f?.roster)?null:f.roster.find(L=>String(L.id)===String(d))||null,[d,f?.roster]),p=m.useMemo(()=>!h?.cameraServo||!h.cameraServo.enabled?null:h.cameraServo,[h]),x=m.useMemo(()=>!h?.nightVision||!h.nightVision.enabled?null:h.nightVision,[h]),v=m.useMemo(()=>!h?.horn||!h.horn.enabled?null:h.horn,[h]),y=m.useMemo(()=>h?.nightVision?.state??null,[h]),b=m.useCallback((L,Z)=>{d&&r.emit("command",{roverId:d,...L},Z)},[r,d]),N=m.useCallback(()=>{d&&b({type:"sensorStream",data:{sensorStream:{enable:!0}}})},[b,d]),M=m.useCallback(L=>{if(!d)return null;const Z={left:rn(L?.left??0,[-500,500]),right:rn(L?.right??0,[-500,500])},D=l?l(Z):Z,G={left:rn(D?.left??0,[-500,500]),right:rn(D?.right??0,[-500,500])};return b({type:"drive",data:{driveDirect:G}}),G},[l,b,d]),C=m.useCallback(({main:L=0,side:Z=0,vacuum:D=0}={})=>{if(!d)return null;const G={main:rn(L,Il.main),side:rn(Z,Il.side),vacuum:rn(D,Il.vacuum)},Y=i?i(G):G,F={main:rn(Y?.main??0,Il.main),side:rn(Y?.side??0,Il.side),vacuum:rn(Y?.vacuum??0,Il.vacuum)};return b({type:"motors",data:{motorPwm:F}}),F},[i,b,d]),E=m.useCallback(L=>!d||!p?null:(b({type:"servo",data:{servo:{angle:L}}}),L),[b,d,p]),j=m.useCallback(L=>{if(!d)return!1;const Z=Array.isArray(L)?L:typeof L=="string"?KS[L]:null;return Z?(b({type:"raw",data:{raw:WS(Z)}}),N(),!0):!1},[b,N,d]),R=m.useCallback(async L=>{if(!(!L||!Array.isArray(L.steps)||!d))for(const Z of L.steps){if(!d)break;switch(Z.type){case"oi":j(Z.command);break;case"drive":M(Z.speeds??{left:0,right:0});break;case"motors":C(Z.values??{});break;case"servo":E(Z.angle);break;case"pause":await Ap(Z.duration??xf);break}if(Z.delay||Z.delayMs){const D=Z.delayMs??Z.delay;typeof D=="number"&&D>0&&await Ap(D)}}},[d,j,M,C,E]),A=m.useCallback((L="toggle")=>!d||!x?null:(b({type:"nightVision",data:{nightVision:{action:L}}}),L),[b,x,d]),T=m.useCallback(L=>d?(b({type:"horn",data:{horn:L}}),L):null,[b,d]),O=m.useCallback((L=[],Z={})=>{if(!d)return null;const G=(Array.isArray(L)&&L.length>0?L:[{note:as,duration:vf}]).slice(0,16).map(Y=>({note:rn(Math.round(Y?.note??as),Vf),duration:rn(Math.round(Y?.duration??vf),[1,255])}));return b({type:"song",data:{song:{notes:G,slot:Z.slot,loop:Z.loop}}}),G},[b,d]);return m.useMemo(()=>({roverId:d,rosterEntry:h,servoConfig:p,nightVision:x,nightVisionState:y,horn:v,emitCommand:b,enableSensorStream:N,sendDriveDirect:M,sendAuxMotors:C,sendServoAngle:E,sendOiCommand:j,sendNightVision:A,sendHorn:T,sendSong:O,runMacroSteps:R}),[d,h,p,x,y,v,b,N,M,C,E,j,A,T,R])}const eA={"{":"[","}":"]",":":";",'"':"'","<":",",">":".","?":"/","|":"\\",_:"-","+":"="},jp={"[":"BracketLeft","]":"BracketRight","\\":"Backslash",";":"Semicolon","'":"Quote",",":"Comma",".":"Period","/":"Slash","-":"Minus","=":"Equal","`":"Backquote"};function Ei(a){if(typeof a!="string")return"";const l=a.toLowerCase();return eA[l]??l}function tA(a){const l=Ei(a);if(!l)return null;if(jp[l])return jp[l];if(l.length===1){if(/[a-z]/.test(l))return`Key${l.toUpperCase()}`;if(/[0-9]/.test(l))return`Digit${l}`}return null}function Yg(a){const l=Ei(a);return l?`key:${l}`:null}function nA(a){const l=tA(a);return l?`code:${l}`:null}function Np(a){const l=new Set,i=Yg(a?.key??"");i&&l.add(i);const r=a?.code?`code:${a.code}`:null;return r&&l.add(r),Array.from(l)}function aA(a={}){return Object.fromEntries(Object.entries(a).map(([l,i])=>{const r=Array.isArray(i)?i:[i],f=new Set;return r.forEach(d=>{const h=Yg(String(d));h&&f.add(h);const p=nA(String(d));p&&f.add(p)}),[l,f]}))}function Rn(a){const l=Ei(a);return l?l===" "?"Space":l==="\\"?"Backslash":l==="`"?"Backtick":l==="["?"[ or {":l==="]"?"] or }":l===";"?"; or :":l==="'"?`' or "`:l===","?", or <":l==="."?". or >":l==="/"?"/ or ?":l==="-"?"- or _":l==="="?"= or +":l==="arrowup"?"Arrow Up":l==="arrowdown"?"Arrow Down":l==="arrowleft"?"Arrow Left":l==="arrowright"?"Arrow Right":l.length===1?l.toUpperCase():l:"—"}const Mn={keyboard:{baseSpeed:250,turboSpeed:400,precisionSpeed:125,tiltSpeed:80,tiltIntervalMs:110}},ia={label:"Default",calibration:{driveDeadzone:.18,cameraDeadzone:.08,auxDeadzone:.05,driveCurve:"linear",cameraCurve:"linear",auxCurve:"linear",cameraMode:"absolute",cameraSensitivity:60,auxSideScale:.55},bindings:{drive:{kind:"axisPair",sources:[{kind:"axisPair",x:0,y:1,invertX:!1,invertY:!0}]},cameraTilt:{kind:"axis",sources:[{kind:"axis",index:3,invert:!0},{kind:"axis",index:1,invert:!0}]},mainBrush:{kind:"axis",sources:[{kind:"buttonAxis",index:6},{kind:"axis",index:2,invert:!1}]},sideBrush:{kind:"axis",sources:[{kind:"buttonAxis",index:7},{kind:"axis",index:5,invert:!1}]},vacuum:{kind:"button",sources:[{kind:"button",index:0}]},allAux:{kind:"button",sources:[{kind:"button",index:1}]},mainReverse:{kind:"button",sources:[{kind:"button",index:4}]},sideReverse:{kind:"button",sources:[{kind:"button",index:5}]},driveMacro:{kind:"button",sources:[{kind:"button",index:2}]},dockMacro:{kind:"button",sources:[{kind:"button",index:3}]},nightVisionToggle:{kind:"button",sources:[{kind:"button",index:9}]}}},La={activeSignature:null,profiles:{},defaults:{profile:ia}},fl={waveform:"saw",freqs:[440,550,660,0]},qt={masterVolume:1,alertVolume:.5,roverVolume:1,autoLevelEnabled:!0,autoLevelMode:"compressor"},ts=[{key:"drive",motors:["leftWheel","rightWheel"]},{key:"aux",motors:["mainBrush","sideBrush"]}],lA={downRatePerSec:.15,upRatePerSec:.7,releaseDelaySec:1,outputRateMs:250};function wp(){return ts.reduce((a,l)=>(a[l.key]={cap:1,clearSec:0},a),{})}function Ep(a){return Number.isFinite(a)?Math.max(0,Math.min(1,a)):0}function sA(a,l={}){const{session:i}=Ye(),d=(cs(a)?.sensors||{})?.wheelOvercurrents||{},h=m.useMemo(()=>({...lA,...l.config||{}}),[l.config]),[p,x]=m.useState(()=>wp()),v=m.useRef(typeof performance<"u"?performance.now():Date.now()),y=m.useRef(d);m.useEffect(()=>{y.current=d||{}},[d]),m.useEffect(()=>{x(wp())},[a]),m.useEffect(()=>{const C=setInterval(()=>{const E=typeof performance<"u"?performance.now():Date.now(),j=Math.max(0,E-v.current);v.current=E;const R=j/1e3;R<=0||x(A=>{let T=!1;const O={},L=Number.isFinite(h.downRatePerSec)?Math.max(0,h.downRatePerSec):0,Z=Number.isFinite(h.upRatePerSec)?Math.max(0,h.upRatePerSec):0,D=Number.isFinite(h.releaseDelaySec)?Math.max(0,h.releaseDelaySec):0;return ts.forEach(G=>{const Y=A[G.key]||{cap:1,clearSec:0},F=Number.isFinite(Y.cap)?Y.cap:1,Q=Number.isFinite(Y.clearSec)?Y.clearSec:0,ne=G.motors.some(q=>!!y.current?.[q]),ce=ne?0:Q+R,pe=!ne&&ce>=D,V=Ep(ne?F-L*R:pe?F+Z*R:F);(Math.abs(V-F)>1e-4||Math.abs(ce-Q)>1e-4)&&(T=!0),O[G.key]={cap:V,clearSec:ce}}),T?O:A})},100);return()=>clearInterval(C)},[h.downRatePerSec,h.releaseDelaySec,h.upRatePerSec]);const b=m.useMemo(()=>{const C=ts.reduce((E,j)=>{const R=p?.[j.key],A=Number.isFinite(R?.cap)?R.cap:1;return E[j.key]=Ep(A),E},{});return{perGroup:C,drive:{left:C.drive??1,right:C.drive??1},aux:{main:C.aux??1,side:C.aux??1,vacuum:1}}},[p]),N=m.useMemo(()=>{const C={};ts.forEach(j=>{j.motors.forEach(R=>{C[R]=!!d?.[R]})});const E=ts.reduce((j,R)=>(j[R.key]=R.motors.some(A=>!!d?.[A]),j),{});return{motors:C,groups:E}},[d]),M=i?.role==="admin"||i?.role==="lockdown"||i?.role==="lockdown-admin";return m.useMemo(()=>({caps:p,overcurrent:N,scales:b,isActive:(b?.drive?.left??1)<1||(b?.drive?.right??1)<1||(b?.aux?.main??1)<1||(b?.aux?.side??1)<1,config:h,adminImmune:M}),[p,N,b,h,M])}function iA(a={},l,i=!1){if(i||!l?.drive)return a;const r=typeof l.drive.left=="number"?l.drive.left:1,f=typeof l.drive.right=="number"?l.drive.right:1;return r>=.999&&f>=.999?a:{left:Math.round((a.left??0)*r),right:Math.round((a.right??0)*f)}}function rA(a={},l,i=!1){if(i||!l?.aux)return a;const r=typeof l.aux.main=="number"?l.aux.main:1,f=typeof l.aux.side=="number"?l.aux.side:1,d=typeof l.aux.vacuum=="number"?l.aux.vacuum:1;return r>=.999&&f>=.999&&d>=.999?a:{main:Math.round((a.main??0)*r),side:Math.round((a.side??0)*f),vacuum:Math.round((a.vacuum??0)*d)}}const $g=m.createContext(null);function Cp(a){return Object.fromEntries(Object.entries(a||{}).map(([l,i])=>[l,Array.isArray(i)?[...i]:[]]))}function oA(a,l){if(!a)return l;const i=typeof a.minAngle=="number"?a.minAngle:-45,r=typeof a.maxAngle=="number"?a.maxAngle:45;return ls(l,i,r)}function cA({children:a}){const[l,i]=m.useReducer(ZS,Sp),r=m.useRef(null),f=m.useRef(!1),d=m.useRef(Sp.camera.angle),h=m.useRef(null),p=m.useRef(0),x=m.useRef(0),{value:v,save:y}=it("controls",{keymap:di,macros:Vg}),{value:b}=it("horn",fl),{session:N,homeAssistantSetState:M}=Ye(),C=N?.assignment?.roverId??null,E=sA(C),j=m.useCallback(te=>iA(te,E.scales,E.adminImmune),[E.adminImmune,E.scales]),R=m.useCallback(te=>rA(te,E.scales,E.adminImmune),[E.adminImmune,E.scales]),A=PS({driveTransform:j,auxTransform:R}),T=m.useCallback(()=>{const ie=(N?.homeAssistant?.entities||[]).filter(Se=>(Se.type==="light"||Se.type==="switch")&&Se.available!==!1&&Se.state!=="on");if(ie.length===0){f.current=!1;return}f.current=!0,ie.forEach(Se=>{M(Se.id,"on").catch(()=>{})}),f.current=!1},[N?.homeAssistant?.entities,M]);m.useEffect(()=>{i({type:"control/set-rover",payload:A.roverId})},[A.roverId]),m.useEffect(()=>{const te=r.current;r.current=l.mode,te!=="drive"&&l.mode==="drive"&&N?.homeAssistant?.entities?T():te!=="drive"&&l.mode==="drive"&&(f.current=!0)},[l.mode,N?.homeAssistant?.entities,T]),m.useEffect(()=>{f.current&&N?.homeAssistant?.entities&&T()},[N?.homeAssistant?.entities,T]),m.useEffect(()=>{const te={...di,...v?.keymap||{}};i({type:"control/set-keymap",payload:te}),v?.macros&&i({type:"control/set-macros",payload:v.macros})},[v?.keymap,v?.macros]),m.useEffect(()=>{const te=A.servoConfig;if(!te){i({type:"control/set-camera-config",payload:{config:null}}),d.current=null;return}const ie=typeof te.minAngle=="number"?te.minAngle:-45,Se=typeof te.maxAngle=="number"?te.maxAngle:45,Be=typeof te.homeAngle=="number"?te.homeAngle:(ie+Se)/2,Te=typeof d.current=="number"?ls(d.current,ie,Se):null,We=Te??ls(Be,ie,Se);i({type:"control/set-camera-config",payload:{config:te,angle:We}}),d.current=We},[A.servoConfig]),m.useEffect(()=>{d.current=typeof l.camera.angle=="number"?l.camera.angle:d.current},[l.camera.angle]),m.useEffect(()=>{A.roverId&&A.enableSensorStream()},[A.roverId,A.enableSensorStream]);const O=m.useCallback(te=>{i({type:"control/set-mode",payload:te})},[]),L=m.useCallback(()=>{i({type:"control/record-intent"})},[]),Z=m.useRef(l.drive.speeds),D=m.useRef(l.aux),G=m.useMemo(()=>JSON.stringify(E.scales),[E.scales]),Y=m.useRef(0),F=m.useRef(0);m.useEffect(()=>{Z.current=l.drive.speeds},[l.drive.speeds]),m.useEffect(()=>{D.current=l.aux},[l.aux]),m.useEffect(()=>{if(!A.roverId||E.adminImmune||!E.isActive)return;const te=Math.max(0,Number(E?.config?.outputRateMs)||0),ie=typeof performance<"u"?performance.now():Date.now(),Se=Z.current||{left:0,right:0},Be=D.current||{main:0,side:0,vacuum:0},Te=!!(Se.left||Se.right),We=!!(Be.main||Be.side||Be.vacuum);!Te&&!We||(Te&&ie-Y.current>=te&&(Y.current=ie,A.sendDriveDirect(Se)),We&&ie-F.current>=te&&(F.current=ie,A.sendAuxMotors(Be)))},[G,E.adminImmune,E.config,E.isActive,A]);const Q=m.useCallback((te,ie={})=>{const Se=IS(te,ie.speedOptions);i({type:"control/update-drive",payload:{...Se,source:ie.source??null}}),L(),A.sendDriveDirect(Se.speeds)},[A,L]),ne=m.useCallback((te={})=>{const ie=A.sendAuxMotors(te)??te;i({type:"control/set-aux-motors",payload:ie}),L()},[A,L]),ce=m.useCallback((te,ie)=>{if(!te)return!1;const Se=Ei(ie);if(!Se)return!1;const Be=Cp(l.keymap);return Be[te]=[Se],i({type:"control/set-keymap",payload:Be}),y(Te=>({...Te??{},keymap:Be})),!0},[l.keymap,y]),pe=m.useCallback(()=>{const te=Cp(di);i({type:"control/set-keymap",payload:te}),y(ie=>({...ie??{},keymap:te}))},[y]),V=m.useCallback(te=>{if(!A.servoConfig)return;const ie=oA(A.servoConfig,te);i({type:"control/set-camera-angle",payload:ie}),A.sendServoAngle(ie),d.current=ie,L()},[A,L]),q=m.useCallback((te=0)=>{const ie=A.servoConfig;if(!ie)return;const Se=typeof te=="number"&&te!==0?te:ie.nudgeDegrees||1,Be=typeof d.current=="number"?d.current:typeof ie.homeAngle=="number"?ie.homeAngle:0;V(Be+Se)},[A.servoConfig,V]),X=m.useCallback(()=>{const te=A.servoConfig;if(!te)return;const ie=typeof te.homeAngle=="number"?te.homeAngle:typeof te.minAngle=="number"&&typeof te.maxAngle=="number"?(te.minAngle+te.maxAngle)/2:0;V(ie)},[A.servoConfig,V]),W=m.useCallback(async te=>{const ie=l.macros.find(Se=>Se.id===te)||null;ie&&(te==="drive-sequence"?(T(),N?.homeAssistant?.entities||(f.current=!0),L()):te==="seek-dock"&&L(),await A.runMacroSteps(ie))},[A,L,N?.homeAssistant?.entities,l.macros,T]),re=m.useCallback(()=>{i({type:"control/update-drive",payload:{vector:{x:0,y:0,boost:!1},speeds:{left:0,right:0},source:"system-stop"}}),A.sendDriveDirect({left:0,right:0}),A.sendAuxMotors({main:0,side:0,vacuum:0})},[A]),de=m.useCallback(te=>{A.sendOiCommand(te)},[A]),w=m.useCallback(te=>{A.roverId&&A.emitCommand({type:"sensorStream",data:{sensorStream:{enable:te}}})},[A]),z=m.useCallback(te=>{if(A.nightVision){if(typeof te=="boolean"){const ie=te?"off":"on";A.sendNightVision(ie)}else A.sendNightVision("toggle");L()}},[A,L]),P=m.useCallback(()=>{z()},[z]),ae=m.useCallback(te=>{const ie=typeof te=="number"?te:as;return i({type:"control/set-song-note",payload:ie}),ie},[]),le=m.useCallback((te,ie)=>A.sendSong(te,ie),[A]),se=m.useMemo(()=>{const te=b??fl,ie=te.waveform==="sine"?"sine":"saw",Be=[...Array.isArray(te.freqs)?te.freqs:fl.freqs,0,0,0,0].slice(0,4).map(Te=>{const We=Number(Te);return Number.isFinite(We)?We<=0?0:Math.min(5e3,Math.round(We)):0});return{waveform:ie,freqs:Be}},[b]),oe=m.useCallback(()=>{if(!A.horn)return;if(l.horn?.overheated||(l.horn?.heat??0)>=1||l.horn?.active)return!1;const te=Date.now();return A.sendHorn({action:"start",...se}),i({type:"control/set-horn-active",payload:!0}),p.current=te,x.current=te,h.current&&(clearTimeout(h.current),h.current=null),h.current=setTimeout(()=>{ve()},XS),L(),!0},[i,se,A,L,l.horn?.active,l.horn?.heat,l.horn?.overheated]),ve=m.useCallback(()=>{if(!A.horn)return;A.sendHorn({action:"stop"}),i({type:"control/set-horn-active",payload:!1}),h.current&&(clearTimeout(h.current),h.current=null);const te=Date.now(),ie=p.current||te,Se=Math.max(0,te-ie);if(p.current=0,Se>0){const Be=l.horn?.heat??0,Te=Se/1e3*Gu;let We=Math.max(0,Math.min(1,Be+Te)),On=l.horn?.overheated??!1;We>=1&&(We=1,On=!0),i({type:"control/set-horn-heat",payload:{heat:We,overheated:On}})}},[i,A,l.horn?.heat,l.horn?.overheated,Gu]);m.useEffect(()=>{const ie=setInterval(()=>{const Se=Date.now(),Be=x.current||Se;x.current=Se;const Te=Math.min(1e3,Math.max(0,Se-Be))/1e3,We=l.horn?.heat??0,On=!!l.horn?.active,Ua=!!l.horn?.overheated,Bn=Te*(On?Gu:-.2);let gt=Math.max(0,Math.min(1,We+Bn)),St=Ua;gt>=1?(gt=1,St=!0,On&&ve()):St&><=QS&&(St=!1),(gt!==We||St!==Ua)&&i({type:"control/set-horn-heat",payload:{heat:gt,overheated:St}})},100);return()=>clearInterval(ie)},[i,l.horn?.active,l.horn?.heat,l.horn?.overheated,ve]);const he=m.useCallback((te,ie)=>{i({type:"control/register-input-state",payload:{source:te,state:ie}})},[]),Oe=m.useMemo(()=>({state:l,dispatch:i,pipeline:A,overcurrentLimiter:E,actions:{setMode:O,setDriveVector:Q,setAuxMotors:ne,setServoAngle:V,nudgeServo:q,goServoHome:X,runMacro:W,stopAllMotion:re,sendOiCommand:de,setSensorStream:w,setNightVision:z,toggleNightVision:P,updateKeyBinding:ce,resetKeyBindings:pe,registerInputState:he,setSongNote:ae,sendSong:le,startHorn:oe,stopHorn:ve}}),[l,A,E,O,Q,ne,V,q,X,W,re,de,w,z,P,ce,pe,he,ae,le,oe,ve]);return o.jsx($g.Provider,{value:Oe,children:a})}function Lt(){const a=m.useContext($g);if(!a)throw new Error("useControlSystem must be used within ControlSystemProvider");return a}const uA="data:audio/mpeg;base64,//uQxAAAAAAAAAAAAAAAAAAAAAAAWGluZwAAAA8AAAANAAAIpQBKSkpKSkpKXFxcXFxcXFxra2tra2tra3p6enp6enqJiYmJiYmJiZiYmJiYmJiYpqampqamprW1tbW1tbW1xMTExMTExMTT09PT09PT4uLi4uLi4uLx8fHx8fHx8f////////8AAABQTEFNRTMuMTAwBLkAAAAAAAAAABUgJAUYQQAB4AAACKVpqtMZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//ugxAAAwqQPR8CIwCh0BCj5jDwlIAAjW87wAACcOsAKPMk8ARj8w9OAWwNlV/gCgQMHEhAOVnFaNzWWAPI2zyjHjd8FAoKqyAa88AAAAABNjEd9CQOglIY9dtC+a51bGZrZgTewD3c+AAYx5hxIMheIcudKAyaykG1/h5EsPB0iTEFNRTMuMTAwqqqqqqrIBZqvAAAAAC9JXFIAHrCgAp0D0hUYOInIluqg1TNdKCzMeAAFQCKKsxUmVfireKILLBgSVgb4qBVtPWpMQU1FMy4xMDCqqqqqqqqqqqqqqqqpApm/AAAAAC7QYaHPHoCjkCysmc+QY9NNWRbKE+mqowNobwAAoSQQMLGChDlOrKMqVMC/6xy/CXbFaL7AZUxBTUUzLjEwMFVVVVVVVVVVVacDqZ8AAAAAMgzaYFBPNgIOnVCQfFfwmBBhLVNJQSdxdQRofwAGxF9xAAYs4AZDuE87li0YCASIBwaCiXUj+2BqTEFNRTMuMTAwqqqqqqqqlwOonwAAAAAtkABQSEZ1INNDgx8HeaaLCXiu5dqSciylQNXjv8GdmACQ5ogYKbnsmxkoChog+w9IhU6GsgzCIQBSxFpMQQAAMBiHjgAAAAv6FQQILmJmGLltnax9HszIVEAoEq1p8olpcPLlGpXFastuWosKNFlmlqADJbwAEFRI4iJJy0oDumUW//sgxOEAw5wfU8fnAGBvg6n5nDxUh7QuwcEzkK5Ztz7AZUxBTUUzLjEwMFVVVVVVVZUAhd8AAAAALZAAamQMWKtC7Avib0WLplt2IAp0SKV0pFFxCADLX6AIPFrWJIBQqPGW/x0QDTRLGaQYCRAZzKeoU6uqTEFN6AB3n/7wAAAxq//7EMT0AMPUHU/MawJgc4PpuYy8VQZjocBw2OgQQyQyECnbABEUC/ZoM0J56Jm0tqzNJaq8KospqUAQ5/QBghnCqQAhR4Mz1D1gJPstYsI1sYIg079I5cYjY6pMQU1FMy4xMDCqqqqq//sQxPUAw+AdT8zvAih6hCk5nWBFqqqWAFOf4AAAAEAIQZPkMcwUzFVE51cSBjIHpJRIEIjWgGar9VhgCUvwAFAUMk0RCpMkwXjPQDcoLBU+n5RuR4ZrPQLPckxBTUUzLjEwMKqqqqr/+xDE9oDEAB1NzG8CKIGEKPmd5EWqxgBWn9AAAAAKIiC5GcLJIczCEvNbWsF31jo4Bw0rXktvJF5YRyABlj+ABIQ2RGsHgdc0XsPntoEDUzaQOjTBqblFPUE1TEFNRckAt68AAAAALv/7EMT4AMQIHU3M7wIojwUo+Y2MZfAgKcwITAQIYN1TosJeLtDA0ubWNrFSADJoln4AC0hVaLiIIUChs+4HST4BgCpQHITPMBQkEnj73ORZfylh+sRLEGUiNIpMQU1FMy4xMDCqqqqq//sQxP6AxlgtK+13Yih3hCj5neBNqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqrIkT7UNAZ7NS7yMqcihSKLMn8DlKYq8ZdPCVEoJBuWqkxBTUUzLjEwMKqqqqr/+xDE+ADEXCVHzGjDIIQEqLm9PIWqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqv/7EMT+AMWoL0XNcwJoiASoeY3gVaqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq//sQxPgAxHAnRcxvAmiBBKj5jehEqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqr/+xDE+IDEmCVDzPMCKH6EqLmNYE2qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqv/7EMT9gEPgI0vMZwQgvYWlPY5gFaqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq//sQxOYDw+gpIIfgwWgAADSAAAAEqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqo=",Gg=m.createContext({messages:[],typing:[],sendMessage:async()=>{},focusChat:()=>{},blurChat:()=>{},registerInputRef:()=>{},onInputFocus:()=>{},onInputBlur:()=>{},setTypingActive:()=>{},isChatFocused:!1});function fA({children:a}){const l=Dn(),{session:i,pushAlert:r}=Ye(),{value:f}=it("audio",qt),[d,h]=m.useState([]),[p,x]=m.useState([]),[v,y]=m.useState(!1),b=m.useRef(null),N=m.useRef(null),M=m.useRef(null),C=m.useRef(new Map),E=m.useRef(new Map),j=m.useRef({isTyping:!1,lastSent:0}),R=Number.isFinite(f?.masterVolume)?f.masterVolume:qt.masterVolume,A=Number.isFinite(f?.alertVolume)?f.alertVolume:qt.alertVolume,T=Math.max(0,Math.min(1,R*A)),O=m.useCallback(()=>{const V=Array.from(C.current.values()).sort((q,X)=>q.lastUpdate-X.lastUpdate).map(q=>q.payload);x(V)},[]),L=m.useCallback(V=>!V||typeof V!="object"?null:V.typingId?V.typingId:V.fromDiscord?`discord:${V.discordUserId||V.discordUserName||V.nickname||"unknown"}`:`socket:${V.socketId||V.nickname||"unknown"}`,[]);m.useEffect(()=>{M.current=new Audio(uA),M.current.volume=T,M.current.load()},[T]);const Z=m.useCallback(()=>{const V=M.current;V&&(V.volume=T,V.currentTime=0,V.play().catch(()=>{}))},[T]);m.useEffect(()=>{function V(q={}){h(X=>[...X.slice(-99),q]),!(q?.socketId&&i?.socketId&&q.socketId===i.socketId)&&(Z(),r?.({kind:"chat",payload:q,id:`chat-${q.id||Math.random().toString(36).slice(2)}`,receivedAt:Date.now()}))}return l.on("chat:message",V),()=>{l.off("chat:message",V)}},[Z,i?.socketId,l]),m.useEffect(()=>{function V(q={}){const X=L(q);if(!X)return;const W=Date.now();if(q?.socketId&&i?.socketId&&q.socketId===i.socketId){q.isTyping||(C.current.delete(X),O());return}if(q.isTyping){C.current.set(X,{payload:q,expiresAt:W+6e3,lastUpdate:W});const re=E.current.get(X)||0;W-re>=2500&&(E.current.set(X,W),r?.({kind:"chat-typing",payload:q,id:`chat-typing-${X}-${q.id||Math.random().toString(36).slice(2)}`,receivedAt:W}))}else C.current.delete(X);O()}return l.on("chat:typing",V),()=>{l.off("chat:typing",V)}},[r,O,L,i?.socketId,l]),m.useEffect(()=>{const V=setInterval(()=>{const q=Date.now();let X=!1;C.current.forEach((W,re)=>{W.expiresAt<=q&&(C.current.delete(re),X=!0)}),X&&O()},2e3);return()=>clearInterval(V)},[O]),m.useEffect(()=>{function V(q=[]){Array.isArray(q)&&h(X=>{if(X.length===0)return q.slice(-100);const W=new Set(q.map(de=>de?.id));return[...q,...X.filter(de=>de?.id&&!W.has(de.id))].slice(-100)})}return l.on("chat:init",V),()=>{l.off("chat:init",V)}},[l]);const D=m.useCallback(V=>{const q=!!V,X=Date.now(),W=j.current,re=!q&&W.isTyping;!(q&&(!W.isTyping||X-W.lastSent>=3500))&&!re||(j.current={isTyping:q,lastSent:X},l.emit("chat:typing",{isTyping:q}))},[l]),G=m.useCallback((V,q=null)=>new Promise((X,W)=>{l.emit("chat:send",{text:V,tts:q},(re={})=>{re.error?W(new Error(re.error)):X(re)})}),[l]),Y=m.useCallback((V,q={})=>{(q?.target==="hud"?"hud":"panel")==="hud"?N.current=V:b.current=V},[]),F=m.useCallback(()=>{y(!0),(N.current||b.current)?.focus()},[]),Q=m.useCallback(()=>{y(!1),N.current?.blur(),b.current?.blur()},[]),ne=m.useCallback(()=>y(!0),[]),ce=m.useCallback(()=>y(!1),[]),pe=m.useMemo(()=>({messages:d,sendMessage:G,focusChat:F,blurChat:Q,registerInputRef:Y,onInputFocus:ne,onInputBlur:ce,setTypingActive:D,typing:p,isChatFocused:v,selfSocketId:i?.socketId||null}),[Q,F,v,d,ce,ne,Y,G,i?.socketId,D,p]);return o.jsx(Gg.Provider,{value:pe,children:a})}function Yf(){const a=m.useContext(Gg);if(!a)throw new Error("useChat must be used inside ChatProvider");return a}const dA=new Set(["","text","search","email","password","url","tel","number","date","datetime-local","month","time","week"]);function Xg(a){if(!a||a.nodeType!==1)return!1;const l=a.tagName;if(l==="TEXTAREA"||a.isContentEditable)return!0;if(l!=="INPUT")return!1;const i=a.type?a.type.toLowerCase():"";return dA.has(i)}function mA(){return typeof document>"u"?!1:Xg(document.activeElement)}const Xu="keyboard",Qu={x:0,y:0,boost:!1},Ku={main:0,side:0,vacuum:0},qp=Vf[0],Mp=Vf[1],$f=5,pi=500,gi=1,Gf=100;function Fu(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(0,Math.min(500,i)):l}function hA(a,l){const i=Number(a);return Number.isFinite(i)?Math.max($f,Math.min(pi,i)):l}function Qg(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(gi,Math.min(Gf,i)):l}function pA(a){const i=(Qg(a,a)-gi)/(Gf-gi),r=pi-i*(pi-$f);return Math.round(r)}function gA(a){const l=hA(a,a),i=(pi-l)/(pi-$f),r=gi+i*(Gf-gi);return Math.round(r)}function xA(a){return Xg(a?.target)}function st(a,l){if(!a||a.size===0)return!1;for(const i of l)if(a.has(i))return!0;return!1}function vA(a,l){const i=st(l.driveForward,a),r=st(l.driveBackward,a),f=st(l.driveLeft,a),d=st(l.driveRight,a),h=st(l.boostModifier,a),p=st(l.slowModifier,a);let x=0;i&&!r?x=1:r&&!i&&(x=-1);let v=0;f&&!d?v=-1:d&&!f&&(v=1);const y=p?.4:1;return{x:v*y,y:x*y,boost:h&&!p}}function yA(a,l){if(st(l.auxAllForward,a))return{main:127,side:127,vacuum:127};const r=st(l.auxMainForward,a)?127:st(l.auxMainReverse,a)?-127:0,f=st(l.auxSideForward,a)?127:st(l.auxSideReverse,a)?-70:0,d=st(l.auxVacuumFast,a)?127:st(l.auxVacuumSlow,a)?50:0;return{main:r,side:f,vacuum:d}}function bA(){const{state:a,actions:{setMode:l,setDriveVector:i,setAuxMotors:r,nudgeServo:f,runMacro:d,stopAllMotion:h,registerInputState:p,toggleNightVision:x,startHorn:v,stopHorn:y,setSongNote:b,sendSong:N}}=Lt(),{session:M,homeAssistantSetState:C}=Ye(),{focusChat:E,blurChat:j,isChatFocused:R}=Yf(),{value:A}=it("inputs",Mn),T=m.useMemo(()=>aA(a.keymap),[a.keymap]),O=m.useMemo(()=>{const le=new Set;return Object.values(T).forEach(se=>{se&&se.forEach(oe=>le.add(oe))}),le},[T]),L=m.useMemo(()=>{const le=Mn.keyboard,se=A?.keyboard??{};return{baseSpeed:Fu(se.baseSpeed,le.baseSpeed),turboSpeed:Fu(se.turboSpeed,le.turboSpeed),precisionSpeed:Fu(se.precisionSpeed,le.precisionSpeed)}},[A?.keyboard]),Z=m.useMemo(()=>{const le=Mn.keyboard,se=A?.keyboard??{},oe=Qg(typeof se.tiltSpeed=="number"?se.tiltSpeed:typeof se.tiltIntervalMs=="number"?gA(se.tiltIntervalMs):le.tiltSpeed,le.tiltSpeed);return pA(oe)},[A?.keyboard]),D=m.useMemo(()=>Math.abs(a.camera?.config?.nudgeDegrees||1),[a.camera?.config?.nudgeDegrees]),G=m.useRef(new Set),Y=m.useRef(Qu),F=m.useRef(Ku),Q=m.useRef(null),ne=m.useRef(null),ce=m.useRef(!1),pe=m.useCallback(()=>{const le=new Set(G.current);st(T.boostModifier,le);const oe=st(T.slowModifier,le)?{baseSpeed:L.precisionSpeed,boostSpeed:L.precisionSpeed}:{baseSpeed:L.baseSpeed,boostSpeed:L.turboSpeed},ve=vA(le,T),he=yA(le,T);(ve.x!==Y.current.x||ve.y!==Y.current.y||ve.boost!==Y.current.boost)&&(Y.current=ve,i(ve,{source:Xu,speedOptions:oe})),(he.main!==F.current.main||he.side!==F.current.side||he.vacuum!==F.current.vacuum)&&(F.current=he,r(he)),p(Xu,{keys:Array.from(le),vector:ve,aux:he})},[T,L,p,r,i]),V=m.useCallback(()=>{Q.current&&(clearTimeout(Q.current),Q.current=null)},[]),q=m.useCallback(()=>{const le=new Set(G.current),se=st(T.cameraUp,le),oe=st(T.cameraDown,le);return(se?1:0)-(oe?1:0)},[T]),X=m.useCallback(()=>{if(q()===0){V();return}if(Q.current)return;const se=()=>{const oe=q();if(oe===0){V();return}f(oe*D),Q.current=setTimeout(se,Z)};Q.current=setTimeout(se,0)},[q,f,Z,D,V]),W=m.useCallback(()=>{ne.current&&(clearTimeout(ne.current),ne.current=null)},[]),re=m.useCallback(()=>{const le=new Set(G.current),se=st(T.songNoteUp,le),oe=st(T.songNoteDown,le);return(se?1:0)-(oe?1:0)},[T]),de=m.useCallback(le=>{if(le===0)return;let oe=(typeof a.song?.note=="number"?a.song.note:as)+le;oe>Mp?oe=qp:oe<qp&&(oe=Mp);const ve=b(oe);N([{note:ve,duration:vf}],{slot:0})},[N,b,a.song?.note]),w=m.useCallback(()=>{if(re()===0){W();return}if(ne.current)return;const se=()=>{const oe=re();if(oe===0){W();return}de(oe),ne.current=setTimeout(se,GS)};ne.current=setTimeout(se,0)},[re,W,de]),z=m.useCallback(()=>{G.current.clear(),Y.current=Qu,F.current=Ku,V(),W(),ce.current&&(ce.current=!1,y()),h(),p(Xu,{keys:[],vector:Qu,aux:Ku})},[p,h,y,V,W]),P=m.useCallback(le=>{const se=M?.homeAssistant;if(!se?.enabled||!se?.connected)return;const ve=(se.entities||[]).filter(he=>(he.type==="light"||he.type==="switch")&&he.available!==!1&&he.state!=="unavailable");if(ve.length!==0){if(le==="on"){const he=ve.find(Oe=>Oe.state!=="on");he&&C(he.id,"on").catch(()=>{});return}if(le==="off")for(let he=ve.length-1;he>=0;he-=1){const Oe=ve[he];if(Oe.state==="on"){C(Oe.id,"off").catch(()=>{});break}}}},[C,M?.homeAssistant]);m.useEffect(()=>{function le(ve){if(xA(ve))return;const he=Np(ve);if(he.length===0)return;const Oe=new Set(he);if(st(T.chatFocus,Oe)){ve.preventDefault(),z(),R||E();return}he.some(ie=>O.has(ie))&&ve.preventDefault();const te=he.filter(ie=>!G.current.has(ie));if(te.forEach(ie=>G.current.add(ie)),te.length>0)if(te.some(ie=>T.driveMacro?.has(ie)))l("drive"),d("drive-sequence");else if(te.some(ie=>T.dockMacro?.has(ie)))l("dock"),d("seek-dock");else if(te.some(ie=>T.nightVisionToggle?.has(ie)))x();else if(te.some(ie=>T.hornHonk?.has(ie))){if(!ce.current){const ie=v();ce.current=!!ie}}else te.some(ie=>T.homeAssistantOn?.has(ie))?P("on"):te.some(ie=>T.homeAssistantOff?.has(ie))&&P("off");X(),w(),pe()}function se(ve){Np(ve).forEach(Oe=>G.current.delete(Oe)),ce.current&&!st(T.hornHonk,G.current)&&(ce.current=!1,y()),X(),w(),pe()}function oe(){z()}return window.addEventListener("keydown",le,{capture:!0}),window.addEventListener("keyup",se,{capture:!0}),window.addEventListener("blur",oe),()=>{window.removeEventListener("keydown",le,{capture:!0}),window.removeEventListener("keyup",se,{capture:!0}),window.removeEventListener("blur",oe)}},[O,j,pe,X,w,E,R,T.chatFocus,T.dockMacro,T.driveMacro,T.hornHonk,z,d,l,h,W,v,y,P]);const ae=m.useRef(z);return m.useEffect(()=>{ae.current=z},[z]),m.useEffect(()=>{ae.current()},[a.roverId]),m.useEffect(()=>{ce.current=!!a.horn?.active},[a.horn?.active]),m.useEffect(()=>()=>{V(),W()},[V,W]),null}const SA=1.6;function Kg(a){if(!a)return"unknown::none::0::0";const l=a.id||"unknown",i=a.mapping||"none",r=Array.isArray(a.axes)?a.axes.length:0,f=Array.isArray(a.buttons)?a.buttons.length:0;return`${l}::${i}::${r}::${f}`}function AA(a){return JSON.parse(JSON.stringify(a??{}))}function Fg(a,l){const i=AA(l);return i.meta={id:a?.id??"Unknown",mapping:a?.mapping??"none",axes:a?.axes?.length??0,buttons:a?.buttons?.length??0},i}function ul(a){return Number.isFinite(a)?Math.max(-1,Math.min(1,a)):0}function oi(a,l){if(!a)return 0;const i=Math.abs(a);return l==="expo"?Math.sign(a)*Math.pow(i,SA):a}function Zu(a,l){const i=Math.abs(a);if(i<=l)return 0;const r=(i-l)/(1-l);return Math.sign(a)*r}function jA(a,l,i){const r=Math.hypot(a,l);if(r<=i)return{x:0,y:0};const d=(r-i)/(1-i)/r;return{x:a*d,y:l*d}}function ro(a,l){if(!a||!Array.isArray(a.axes))return null;const i=a.axes[l];return Number.isFinite(i)?ul(i):null}function Sf(a,l){if(!a||!Array.isArray(a.buttons))return null;const i=a.buttons[l];if(!i)return null;const r=typeof i.value=="number"?i.value:i.pressed?1:0;return{pressed:!!(i.pressed||r>.5),value:Math.max(0,Math.min(1,r))}}function Ju(a,l=[]){for(const i of l)if(i){if(i.kind==="axis"){const r=ro(a,i.index);if(r===null)continue;return{value:i.invert?-r:r,source:i}}if(i.kind==="buttonAxis"){const r=Sf(a,i.index);if(!r)continue;return{value:ul(r.value),source:i}}}return{value:0,source:null}}function NA(a,l=[]){for(const i of l){if(!i||i.kind!=="axisPair")continue;const r=ro(a,i.x),f=ro(a,i.y);if(r===null||f===null)continue;const d=i.invertX?-r:r,h=i.invertY?-f:f;return{x:d,y:h,source:i}}return{x:0,y:0,source:null}}function rl(a,l=[]){for(const i of l)if(i){if(i.kind==="button"){const r=Sf(a,i.index);if(!r)continue;return{pressed:r.pressed,source:i}}if(i.kind==="axisButton"){const r=ro(a,i.index);if(r===null)continue;const f=i.direction||1,d=typeof i.threshold=="number"?i.threshold:.6;return{pressed:r*f>d,source:i}}if(i.kind==="buttonAxis"){const r=Sf(a,i.index);if(!r)continue;return{pressed:r.value>.5,source:i}}}return{pressed:!1,source:null}}function Zg(a,l){const i=l?.bindings??{},r=l?.calibration??{},f=i.drive??{},d=NA(a,f.sources);let h=ul(d.x),p=ul(d.y);const x=Math.min(Math.max(r.driveDeadzone??.18,0),.8),v=jA(h,p,x);h=oi(v.x,r.driveCurve),p=oi(v.y,r.driveCurve);const y=i.cameraTilt??{},b=Ju(a,y.sources),N=Math.min(Math.max(r.cameraDeadzone??.08,0),.8);let M=Zu(ul(b.value),N);M=oi(M,r.cameraCurve);const C=Math.min(Math.max(r.auxDeadzone??.05,0),.6),E=i.mainBrush??{},j=Ju(a,E.sources);let R=Zu(ul(j.value),C);R=oi(R,r.auxCurve);const A=i.sideBrush??{},T=Ju(a,A.sources);let O=Zu(ul(T.value),C);O=oi(O,r.auxCurve);const L=rl(a,i.vacuum?.sources),Z=rl(a,i.allAux?.sources),D=rl(a,i.mainReverse?.sources),G=rl(a,i.sideReverse?.sources),Y=rl(a,i.driveMacro?.sources),F=rl(a,i.dockMacro?.sources),Q=rl(a,i.nightVisionToggle?.sources);return{driveVector:{x:h,y:p,boost:!1},cameraAxis:M,auxAxis:{main:R,side:O},buttons:{vacuum:L.pressed,allAux:Z.pressed,mainReverse:D.pressed,sideReverse:G.pressed,driveMacro:Y.pressed,dockMacro:F.pressed,nightVisionToggle:Q.pressed},sources:{drive:d.source,cameraTilt:b.source,mainBrush:j.source,sideBrush:T.source,vacuum:L.source,allAux:Z.source,mainReverse:D.source,sideReverse:G.source,driveMacro:Y.source,dockMacro:F.source,nightVisionToggle:Q.source}}}const no=new Set;let ns=null,oo={pads:[],timestamp:0};function wA(){if(typeof navigator>"u"||!navigator.getGamepads)return[];const a=navigator.getGamepads();return a?Array.from(a).filter(Boolean):[]}function EA(a){return{index:a.index,id:a.id,mapping:a.mapping,connected:a.connected!==!1,timestamp:a.timestamp,axes:Array.from(a.axes??[]),buttons:(a.buttons??[]).map(l=>({pressed:!!l?.pressed,value:typeof l?.value=="number"?l.value:l?.pressed?1:0})),signature:Kg(a)}}function CA(){oo={pads:wA().map(EA),timestamp:typeof performance<"u"?performance.now():Date.now()},no.forEach(l=>l(oo))}function Jg(){CA(),ns=requestAnimationFrame(Jg)}function qA(){ns||(ns=requestAnimationFrame(Jg))}function MA(){ns&&(cancelAnimationFrame(ns),ns=null)}function Ig(a){return no.add(a),qA(),a(oo),()=>{no.delete(a),no.size===0&&MA()}}function RA(){const[a,l]=m.useState(oo);return m.useEffect(()=>Ig(l),[]),a}const Wl="gamepad",ol={x:0,y:0,boost:!1},cl={main:0,side:0,vacuum:0},kA=100,TA=100;function Iu(a,l){return a&&l&&a.x===l.x&&a.y===l.y&&a.boost===l.boost}function Wu(a,l){return a&&l&&a.main===l.main&&a.side===l.side&&a.vacuum===l.vacuum}function _A(a){return a?Math.hypot(a.x||0,a.y||0):0}function DA(a){return a?!a.main&&!a.side&&!a.vacuum:!0}function OA(a,l){if(!a||a.length===0)return null;if(l){const i=a.find(r=>r.signature===l);if(i)return i}return a[0]}function BA(){const{state:a,actions:{setMode:l,setDriveVector:i,setAuxMotors:r,setServoAngle:f,runMacro:d,toggleNightVision:h,registerInputState:p}}=Lt(),{value:x,save:v}=it("gamepad",La),y=m.useRef(new Set),b=m.useRef(ol),N=m.useRef(cl),M=m.useRef({main:!1,side:!1}),C=m.useRef(new Map),E=m.useRef(0),j=m.useRef(0),R=m.useRef(0),A=m.useRef(null),T=m.useCallback(D=>{const G=D.signature??Kg(D);x?.profiles?.[G]||y.current.has(G)||(y.current.add(G),v(Y=>{const F=Y??La;if(F.profiles?.[G])return F;const Q=F?.defaults?.profile??ia,ne=Fg(D,Q);return{...F,profiles:{...F.profiles??{},[G]:ne}}}))},[x?.profiles,v]),O=m.useCallback((D,G)=>{const Y=C.current.get(D)||!1;return C.current.set(D,G),G&&!Y},[]),L=m.useCallback((D,G)=>{const Y=a.camera?.config;if(!Y)return;const F=typeof performance<"u"?performance.now():Date.now(),Q=G?.cameraMode??"absolute",ne=Math.max(1,Math.min(180,G?.cameraSensitivity??60));if(Q==="velocity"){const X=Math.min(50,F-R.current||16),W=D*ne*(X/1e3);if(Math.abs(W)<.01)return;const de=(typeof A.current=="number"?A.current:typeof a.camera?.angle=="number"?a.camera.angle:typeof Y.homeAngle=="number"?Y.homeAngle:0)+W;f(de),A.current=de,R.current=F;return}const ce=typeof Y.minAngle=="number"?Y.minAngle:-45,pe=typeof Y.maxAngle=="number"?Y.maxAngle:45,V=typeof Y.homeAngle=="number"?Y.homeAngle:(ce+pe)/2,q=D<0?V+D*(V-ce):V+D*(pe-V);typeof A.current=="number"&&Math.abs(A.current-q)<.35&&F-R.current<80||(R.current=F,A.current=q,f(q))},[f,a.camera?.angle,a.camera?.config]),Z=m.useMemo(()=>x?.activeSignature??null,[x?.activeSignature]);return m.useEffect(()=>Ig(D=>{const G=OA(D.pads,Z);if(!G){Iu(b.current,ol)||(b.current=ol,i(ol,{source:Wl})),Wu(N.current,cl)||(N.current=cl,r(cl)),C.current=new Map,M.current={main:!1,side:!1},E.current=0,j.current=0,p(Wl,{connected:!1});return}if(mA()){Iu(b.current,ol)||(b.current=ol,i(ol,{source:Wl})),Wu(N.current,cl)||(N.current=cl,r(cl)),C.current=new Map,M.current={main:!1,side:!1},p(Wl,{connected:!0,blocked:!0});return}T(G);const Y=G.signature,F=x?.profiles?.[Y]??x?.defaults?.profile??ia,Q=Zg(G,F);if(!Iu(Q.driveVector,b.current)){const W=typeof performance<"u"?performance.now():Date.now();(_A(Q.driveVector)<.02||W-E.current>=kA)&&(b.current=Q.driveVector,E.current=W,i(Q.driveVector,{source:Wl}))}const ne=F.calibration?.auxSideScale??.55,ce=Math.round(Math.min(Math.abs(Q.auxAxis.main),1)*127),pe=Math.round(Math.min(Math.abs(Q.auxAxis.side),1)*127),V=M.current.main?-ce:ce,q=M.current.side?-Math.round(pe*ne):Math.round(pe*ne);let X={main:Q.auxAxis.main!==0?V:0,side:Q.auxAxis.side!==0?q:0,vacuum:Q.buttons.vacuum?127:0};if(Q.buttons.allAux&&(X={main:127,side:127,vacuum:127}),!Wu(X,N.current)){const W=typeof performance<"u"?performance.now():Date.now();(DA(X)||W-j.current>=TA)&&(N.current=X,j.current=W,r(X))}Q.buttons.mainReverse&&O("mainReverse",!0)?M.current.main=!M.current.main:Q.buttons.mainReverse||O("mainReverse",!1),Q.buttons.sideReverse&&O("sideReverse",!0)?M.current.side=!M.current.side:Q.buttons.sideReverse||O("sideReverse",!1),Q.buttons.driveMacro&&O("driveMacro",!0)?(l("drive"),d("drive-sequence")):Q.buttons.driveMacro||O("driveMacro",!1),Q.buttons.dockMacro&&O("dockMacro",!0)?(l("dock"),d("seek-dock")):Q.buttons.dockMacro||O("dockMacro",!1),Q.buttons.nightVisionToggle&&O("nightVisionToggle",!0)?h():Q.buttons.nightVisionToggle||O("nightVisionToggle",!1),Math.abs(Q.cameraAxis)>.001&&L(Q.cameraAxis,F.calibration),p(Wl,{connected:!0,signature:Y,id:G.id,index:G.index,axes:G.axes,buttons:G.buttons,drive:Q.driveVector,aux:X,cameraAxis:Q.cameraAxis,bindings:Q.sources})}),[Z,T,x?.defaults?.profile,x?.profiles,O,L,p,d,r,i,l,h]),null}function Wg(a){const l=a?.sensors||{},i=l.oiMode?.label||"Unknown",r=i.toLowerCase(),f=l.chargingState?.label||"",d=!!l.chargingSources?.homeBase,h=d&&f.toLowerCase()!=="not charging"&&f!=="";return{driving:r==="full",docked:d,charging:h,dockedNotCharging:d&&!h,dockingInProgress:!d&&!h&&r==="passive",oiLabel:i,chargingLabel:f}}function Pg(a){const l=cs(a);return m.useMemo(()=>Wg(l),[l])}function Pl({label:a,value:l,tone:i="neutral"}){const r=i==="good"?"border-emerald-200 bg-emerald-600 text-white":i==="warn"?"border-amber-200 bg-amber-600 text-white":i==="bad"?"border-red-200 bg-red-600 text-white":"border-slate-200/30 bg-slate-700 text-slate-100";return o.jsx("div",{className:`flex flex-1 flex-col items-center justify-center rounded-lg border px-0.75 py-0.5 text-center ${r}`,children:o.jsx("span",{className:"text-base font-semibold md:text-lg",children:l})})}function Rp({label:a}){return a?o.jsx("span",{className:"rounded border border-white/40 px-1 text-[0.7rem] text-white",children:a}):null}function Pu({label:a,tone:l}){const i=l==="emerald"?"border-emerald-200/70 bg-emerald-600/70 text-emerald-50":l==="amber"?"border-amber-200/70 bg-amber-600/70 text-amber-50":"border-indigo-200/70 bg-indigo-600/70 text-indigo-50";return o.jsx("span",{className:`rounded-full border px-0.5 py-0.15 text-[0.7rem] font-semibold ${i}`,children:a})}function LA({instructions:a,onConfirm:l,onCancel:i,pending:r}){return o.jsx("div",{className:"fixed inset-0 z-40 flex items-center justify-center bg-black/70 p-1",children:o.jsxs("div",{className:"surface w-full max-w-md space-y-0.5 border border-indigo-700 bg-indigo-950/90 p-1 text-slate-100 shadow-2xl",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("p",{className:"text-lg font-semibold text-indigo-50",children:"Dock Rover"}),o.jsx("p",{className:"text-sm text-slate-200",children:a.summary}),o.jsx(Af,{steps:a.steps,tone:"indigo"})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-0.5 text-sm",children:[o.jsx("button",{type:"button",onClick:i,className:"bg-slate-700 px-0.5 py-1 font-semibold text-slate-100 transition hover:bg-slate-600",children:"Cancel"}),o.jsx("button",{type:"button",disabled:r,onClick:l,className:"bg-indigo-600 px-0.5 py-1 font-semibold text-indigo-50 transition hover:bg-indigo-500 disabled:opacity-50",children:r?"Docking…":"Confirm Dock"})]})]})})}function ex({layout:a="desktop",expand:l=!1,fill:i=!1,driveDockState:r,compactHeightClass:f=""}){const d=a==="mobile",{state:{roverId:h,keymap:p},actions:x}=Lt(),v=cs(h),y=r??Wg(v),{driving:b,docked:N,charging:M,dockingInProgress:C}=y,[E,j]=m.useState(null),[R,A]=m.useState(!1),[T,O]=m.useState(!1),L=!h||E!==null,Z=!h||E!==null,D=Rn(p?.driveMacro?.[0]),G=Rn(p?.dockMacro?.[0]),Y={summary:"You are about to trigger an automatic docking attempt! To have a successful dock:",steps:["Line up the rover straight in front of the dock","Make sure the rover is about one foot or half a meter away from the dock","Press Confirm Dock to begin the docking process"]},F="Click this button to initate auto-dock.",Q={summary:"You must enable driving mode before you can move the rover.",steps:["Press the keybind or tap this button to enable driving mode","Once ready (should be instant), this dialog will change, and you will be able to move"]},ne=N?"Docked":"Undocked",ce=N?"good":"bad",pe=M?"Charging":N?"Charging in 5s":"—",V=M?"good":N?"warn":"bad",q=async()=>{if(!(!h||E)){j("drive");try{x.setMode("drive"),await x.runMacro("drive-sequence")}catch(Te){alert(Te.message)}finally{j(null)}}},X=async()=>{if(!(!h||E)){A(!1),O(!1),j("drive");try{x.setMode("drive"),await x.runMacro("drive-sequence")}catch(Te){alert(Te.message)}finally{j(null)}}},W=async()=>{if(!(!h||E)){j("dock");try{x.setMode("dock"),await x.runMacro("seek-dock")}catch(Te){alert(Te.message)}finally{j(null),A(!1),O(!1)}}},re=()=>{Z||(O(!0),A(!0))},de="flex w-full flex-col gap-0.5 overflow-hidden rounded-xl border-2 px-0.75 py-0.75 text-slate-100 shadow-md transition hover:-translate-y-0.5 hover:shadow-xl focus-visible:outline-none focus-visible:ring-2 disabled:cursor-not-allowed disabled:opacity-60 select-none no-touch-select",w="text-center",z="items-center justify-between",P="items-center justify-center",ae=d?"text-sm font-semibold":"",le="border-emerald-300/70 bg-emerald-800 text-emerald-50 hover:bg-emerald-700 focus-visible:ring-emerald-300",se="border-amber-300/70 bg-amber-900 text-amber-50 hover:bg-amber-800 focus-visible:ring-amber-300",oe="border-indigo-300/70 bg-indigo-900 text-indigo-50 hover:bg-indigo-800 focus-visible:ring-indigo-300",ve="border-amber-300/70 bg-amber-900 text-amber-50 hover:bg-amber-800 focus-visible:ring-amber-300",Oe=l||C,te=Oe?"h-full flex-1":i?"flex-1":"",ie=d&&!Oe?f:"",Se=d&&!Oe?P:z,Be=d&&!Oe&&b&&N;if(!b&&!C)return o.jsxs("button",{type:"button",onClick:X,onContextMenu:Te=>Te.preventDefault(),disabled:L,className:`${de} ${te} ${ie} ${w} ${Se} ${ae} ${le}`,children:[o.jsxs("div",{className:"space-y-0.5 w-full",children:[o.jsxs("div",{className:"flex w-full flex-col items-center gap-0.25",children:[o.jsx("span",{className:"text-base font-semibold text-emerald-50 md:text-lg",children:"Start Driving"}),!d&&Oe?o.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-0.5",children:[D?o.jsx(Rp,{label:D}):null,o.jsx(Pu,{label:"Click to start",tone:"emerald"})]}):null]}),Oe?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"text-sm text-emerald-50/90",children:Q.summary}),o.jsx(Af,{steps:Q.steps,tone:"emerald"})]}):null]}),Oe?o.jsxs("div",{className:"flex w-full flex-1 flex-col gap-0.5 self-stretch",children:[o.jsx(Pl,{label:"Dock",value:ne,tone:ce}),o.jsx(Pl,{label:"Charge",value:pe,tone:V})]}):null]});if(C){const Te={summary:"If the rover is failing to dock, click to drive and try again.",steps:["The rover should be slowly wiggling towards the dock","If it is obviously not working, press this button to enter driving mode and try again"]};return o.jsxs("button",{type:"button",disabled:L,onClick:q,onContextMenu:We=>We.preventDefault(),className:`${de} ${te} ${ie} ${w} ${Se} ${ae} ${se}`,children:[o.jsxs("div",{className:"space-y-0.5 w-full",children:[o.jsxs("div",{className:"flex w-full flex-col items-center gap-0.25",children:[o.jsx("span",{className:"text-base font-semibold text-amber-50 md:text-lg",children:"Docking in Progress"}),Oe?o.jsx("div",{className:"flex flex-wrap items-center justify-center gap-0.5",children:o.jsx(Pu,{label:"Return to driving mode",tone:"emerald"})}):null]}),Oe?o.jsx("p",{className:"text-sm text-amber-50/90",children:Te.summary}):null]}),Oe?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex w-full flex-1 flex-col gap-0.5 self-stretch",children:[o.jsx(Pl,{label:"Dock",value:ne,tone:ce}),o.jsx(Pl,{label:"Charge",value:pe,tone:V})]}),d?null:o.jsx(Af,{steps:Te.steps,tone:"amber"})]}):null]})}return o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",disabled:Z,onClick:re,onContextMenu:Te=>Te.preventDefault(),className:d?`flex w-full ${de} ${ie} ${w} ${Se} ${ae} ${Be?ve:oe}`:`${de} ${te} ${w} ${z} ${ae} ${oe}`,children:[o.jsxs("div",{className:"flex w-full flex-col items-center gap-0.25",children:[o.jsx("span",{className:"text-base font-semibold text-indigo-50 md:text-lg",children:Be?"Docked!":"Dock and Charge"}),!d&&Oe?o.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-0.5",children:[G?o.jsx(Rp,{label:G}):null,o.jsx(Pu,{label:"Click to begin docking",tone:"indigo"})]}):null]}),!d&&Oe&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"text-sm text-indigo-50/90",children:F}),o.jsxs("div",{className:"flex w-full flex-1 flex-col gap-0.5 self-stretch",children:[o.jsx(Pl,{label:"Dock",value:ne,tone:ce}),o.jsx(Pl,{label:"Charge",value:pe,tone:V})]}),o.jsx("div",{className:"text-xs text-indigo-100/80",children:"Line up straight, about 1 foot away, before docking."})]})]}),T||!d&&R?o.jsx(LA,{instructions:Y,pending:E==="dock",onCancel:()=>{O(!1),A(!1)},onConfirm:W}):null]})}function Af({steps:a,tone:l="emerald"}){const i=l==="emerald"?"bg-emerald-900/60 text-emerald-50/90 border-emerald-700/60":l==="amber"?"bg-amber-900/60 text-amber-50/90 border-amber-700/60":"bg-indigo-900/60 text-indigo-50/90 border-indigo-700/60",r=l==="emerald"?"text-emerald-200":l==="amber"?"text-amber-200":"text-indigo-200";return o.jsx("div",{className:`space-y-0.5 rounded border px-0.5 py-0.35 text-left ${i}`,children:a.map((f,d)=>o.jsxs("div",{className:"text-[0.85rem] leading-snug break-words",children:[o.jsxs("div",{className:"flex items-start",children:[o.jsxs("span",{className:`mr-0 align-top text-[0.75rem] font-semibold ${r}`,children:[d+1,"."]}),o.jsx("span",{className:"align-top",children:f})]}),d<a.length-1?o.jsx("div",{className:"mt-0 h-px bg-white/10"}):null]},f))})}function ef(a){return typeof a=="boolean"}function tx({nightVisionOn:a,disabled:l,onToggle:i,keyLabel:r,className:f="",heightClass:d=""}){const[h,p]=m.useState(ef(a)?a:null);m.useEffect(()=>{ef(a)&&p(a)},[a]);const x=ef(h),v=x?h:!1,y=x?v?"On":"Off":"—",b=v?"bg-emerald-500 text-emerald-950":"bg-slate-700 text-slate-200",N=()=>{if(l)return;const C=x?!v:!0;p(C),i?.(C)},M=m.useMemo(()=>["group flex w-full flex-col items-center justify-center gap-0.35 rounded-xl border-2 px-1 py-0.75 text-center select-none no-touch-select",v?"border-emerald-300/70 bg-emerald-800 text-emerald-50 hover:bg-emerald-700":"border-amber-300/70 bg-amber-900 text-amber-50 hover:bg-amber-800","disabled:opacity-50",d,f].filter(Boolean).join(" "),[f,v,d]);return o.jsxs("button",{type:"button",onClick:N,onContextMenu:C=>C.preventDefault(),disabled:l,"aria-pressed":v,className:M,children:[o.jsxs("span",{className:"flex items-center gap-0.5",children:[o.jsx("span",{className:"text-sm font-semibold",children:"Night Vision"}),r?o.jsx("span",{className:"rounded bg-slate-800 px-1 py-0.5 text-[0.6rem] font-semibold text-slate-200",children:r}):null]}),o.jsx("span",{className:`rounded px-1 py-0.5 text-[0.7rem] font-semibold ${b}`,children:y})]})}function tf(a){const l=Number(a);return!Number.isFinite(l)||l<=0?0:Math.min(5e3,Math.round(l))}function nx({disabled:a,onStart:l,onStop:i,keyLabel:r,active:f,heat:d=0,className:h="",defaultShowSettings:p=!0,showSettingsToggle:x=!1,compactSettings:v=!1}){const[y,b]=m.useState(!1),[N,M]=m.useState(p),{value:C,save:E}=it("horn",fl),[j,R]=m.useState(C?.waveform||fl.waveform),[A,T]=m.useState(()=>[...Array.isArray(C?.freqs)?C.freqs:fl.freqs,0,0,0,0].slice(0,4).map(q=>tf(q)));m.useEffect(()=>{R(C?.waveform||fl.waveform),Array.isArray(C?.freqs)&&T([...C.freqs,0,0,0,0].slice(0,4).map(V=>tf(V)))},[C?.freqs,C?.waveform]);const O=!!f,L=Math.max(0,Math.min(1,Number(d)||0)),Z=m.useMemo(()=>["group relative flex w-full flex-col gap-0.5 overflow-hidden rounded-xl border-2 px-1 py-1.5 text-xs font-semibold select-none no-touch-select",O?"border-fuchsia-300/70 bg-fuchsia-700 text-fuchsia-50":"border-cyan-300/70 bg-cyan-900 text-cyan-50 hover:bg-cyan-800","disabled:opacity-50",h].filter(Boolean).join(" "),[h,O]),D=()=>{a||y||(b(!0),l?.())},G=()=>{y&&(b(!1),i?.())};m.useEffect(()=>{!O&&y&&b(!1)},[O,y]);const Y=j==="sine"?"sine":"saw",F=m.useCallback(V=>{const q=V.target.value==="sine"?"sine":"saw";R(q),E(X=>({...X??{},waveform:q}))},[E]),Q=m.useCallback((V,q)=>{T(X=>{const W=[...X];return W[V]=tf(q),E(re=>({...re??{},freqs:W})),W})},[E]),ne=V=>{if(a)return;const q=V.target?.tagName?.toLowerCase();q==="input"||q==="select"||q==="option"||q==="label"||q==="button"||(V.preventDefault(),D())},ce=V=>{const q=V.target?.tagName?.toLowerCase();q==="input"||q==="select"||q==="option"||q==="label"||q==="button"||(V.preventDefault(),G())},pe=x?o.jsx("button",{type:"button",onClick:V=>{V.preventDefault(),M(q=>!q)},className:"rounded bg-black/40 px-1 py-0.5 text-[0.6rem] font-semibold text-white/90 hover:text-white",children:N?"Hide":"Settings"}):null;return o.jsxs("div",{role:"button",tabIndex:0,"aria-pressed":y,onPointerDown:ne,onPointerUp:ce,onPointerLeave:G,onPointerCancel:G,onContextMenu:V=>V.preventDefault(),onBlur:G,className:Z,children:[o.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-70",style:{background:`linear-gradient(90deg, rgba(14,116,144,0.7) ${L*100}%, rgba(0,0,0,0) ${L*100}%)`}}),o.jsx("div",{className:`pointer-events-none absolute inset-0 transition-opacity ${O?"opacity-40":"opacity-0"}`,style:{background:"linear-gradient(90deg, rgba(217,70,239,0.75), rgba(244,114,182,0.35))"}}),o.jsxs("div",{className:"relative z-10 flex items-center justify-between gap-0.5",children:[o.jsxs("span",{className:"flex items-center gap-0.5 text-sm font-semibold",children:[o.jsx("span",{children:"Horn"}),r?o.jsx("span",{className:"rounded bg-black/40 px-1 py-0.5 text-[0.6rem] font-semibold text-white",children:r}):null]}),pe,o.jsx("span",{className:`rounded px-1 py-0.5 text-[0.65rem] font-semibold ${O?"bg-fuchsia-200 text-fuchsia-900":"bg-slate-800 text-slate-200"}`,children:O?"Honk":"Hold"})]}),N?v?o.jsxs("div",{className:"relative z-10 flex flex-col gap-0.5 text-[0.65rem]",children:[o.jsxs("label",{className:"flex items-center justify-between gap-0.5 text-slate-200",children:[o.jsx("span",{className:"text-slate-300",children:"Wave"}),o.jsxs("select",{value:Y,onChange:F,className:"rounded border border-slate-700 bg-slate-900 px-1 py-[2px] text-[0.65rem] text-slate-100",children:[o.jsx("option",{value:"saw",children:"Saw"}),o.jsx("option",{value:"sine",children:"Sine"})]})]}),o.jsx("div",{className:"grid grid-cols-2 gap-0.5",children:A.map((V,q)=>o.jsxs("label",{className:"flex items-center gap-0.5 text-slate-200",children:[o.jsx("span",{className:"text-[0.6rem] text-slate-400",children:q+1}),o.jsx("input",{type:"number",min:0,max:5e3,step:1,value:V,onChange:X=>Q(q,X.target.value),className:"w-full rounded border border-slate-700 bg-slate-900 px-1 py-[2px] text-right text-[0.65rem] font-mono text-slate-100"})]},`horn-freq-${q}`))})]}):o.jsxs("div",{className:"relative z-10 grid grid-cols-[minmax(0,1.2fr)_repeat(4,minmax(0,1fr))] items-center gap-0.5 text-[0.65rem]",children:[o.jsxs("label",{className:"flex items-center gap-0.5 text-slate-200",children:[o.jsx("span",{className:"text-slate-300",children:"Wave"}),o.jsxs("select",{value:Y,onChange:F,className:"rounded border border-slate-700 bg-slate-900 px-1 py-[2px] text-[0.65rem] text-slate-100",children:[o.jsx("option",{value:"saw",children:"Saw"}),o.jsx("option",{value:"sine",children:"Sine"})]})]}),A.map((V,q)=>o.jsxs("label",{className:"flex items-center gap-0.5 text-slate-200",children:[o.jsx("span",{className:"text-[0.6rem] text-slate-400",children:q+1}),o.jsx("input",{type:"number",min:0,max:5e3,step:1,value:V,onChange:X=>Q(q,X.target.value),className:"w-full rounded border border-slate-700 bg-slate-900 px-1 py-[2px] text-right text-[0.65rem] font-mono text-slate-100"})]},`horn-freq-${q}`))]}):null]})}function Xr(a){return typeof a!="number"||Number.isNaN(a)?"—":`${a>0?"+":""}${a.toFixed(1)}°`}function kp({label:a}){return a?o.jsx("span",{className:"rounded border border-white/40 px-1 text-[0.7rem] text-white",children:a}):null}function ax({value:a,min:l,max:i,step:r=.5,label:f="Camera Tilt",orientation:d="horizontal",onChange:h,onCommit:p,throttleMs:x=0,disabled:v=!1,keyDownLabel:y,keyUpLabel:b,className:N="",labelRowClass:M="",labelClass:C="",valueClass:E="",sliderClass:j="",endpointClass:R="",endpointLabelClass:A="",accentClass:T="",showValue:O=!0,showEndpoints:L}){const Z=d==="vertical",G=typeof L=="boolean"?L:!Z,[Y,F]=m.useState(a),Q=m.useRef(!1),ne=m.useRef(null);m.useEffect(()=>{Q.current||F(a)},[a]),m.useEffect(()=>()=>{ne.current&&clearTimeout(ne.current)},[]);const ce=W=>{if(h){if(x>0){ne.current&&clearTimeout(ne.current),ne.current=setTimeout(()=>{h(W)},x);return}h(W)}},pe=W=>{const re=Number.parseFloat(W.target.value);Number.isNaN(re)||(Q.current=!0,F(re),ce(re))},V=()=>{Q.current=!1,ne.current&&(clearTimeout(ne.current),ne.current=null),p?p(Y):x>0&&h?.(Y)};if(typeof l!="number"||typeof i!="number")return null;const q=[Z?"h-28 w-5":"w-full",T,j].filter(Boolean).join(" "),X=o.jsx("input",{type:"range",orient:Z?"vertical":void 0,min:l,max:i,step:r,value:Number.isFinite(Y)?Y:l,onChange:pe,onMouseUp:V,onTouchEnd:V,onPointerUp:V,disabled:v,className:q,style:Z?{writingMode:"bt-lr",WebkitAppearance:"slider-vertical"}:void 0});return Z?o.jsxs("div",{className:`flex h-full flex-col items-center gap-0.5 ${N}`.trim(),children:[O?o.jsx("div",{className:`flex flex-col items-center ${M}`.trim(),children:o.jsx("span",{className:E,children:Xr(a)})}):null,o.jsxs("div",{className:"flex min-h-0 flex-1 items-center gap-0.5",children:[o.jsx("span",{className:C,children:f}),X]})]}):o.jsxs("div",{className:`space-y-0.5 ${N}`.trim(),children:[o.jsxs("div",{className:`flex items-center justify-between ${M}`.trim(),children:[o.jsx("span",{className:C,children:f}),O?o.jsx("span",{className:E,children:Xr(a)}):null]}),o.jsxs("div",{children:[X,G?o.jsxs("div",{className:`mt-0 flex items-center justify-between ${R}`.trim(),children:[o.jsxs("span",{className:`flex items-center gap-0.5 ${A}`.trim(),children:[y?o.jsx(kp,{label:y}):null,Xr(l)]}),o.jsxs("span",{className:`flex items-center gap-0.5 ${A}`.trim(),children:[Xr(i),b?o.jsx(kp,{label:b}):null]})]}):null]})]})}const Qr="mobile-joystick",zA=80,UA=.15,HA={main:0,side:0,vacuum:0},VA={main:127,side:127,vacuum:127},YA={main:-127,side:-127,vacuum:-127};function $A({disabled:a,layout:l,radius:i,onMove:r,onStop:f}){const d=m.useRef(null),h=m.useRef(null),p=m.useRef({x:0,y:0}),[x,v]=m.useState({active:!1,base:{x:0,y:0},knob:{x:0,y:0}}),y=m.useCallback(()=>{h.current=null,v({active:!1,base:{x:0,y:0},knob:{x:0,y:0}}),f?.()},[f]),b=m.useCallback(E=>{if(a||h.current!==null)return;E.preventDefault();const j=d.current;if(!j)return;const R=j.getBoundingClientRect(),A=E.clientX-R.left,T=E.clientY-R.top;p.current={x:A,y:T},h.current=E.pointerId,j.setPointerCapture?.(E.pointerId),v({active:!0,base:{x:A,y:T},knob:{x:0,y:0}})},[a]),N=m.useCallback(E=>{if(a||h.current!==E.pointerId)return;E.preventDefault();const j=d.current;if(!j)return;const R=j.getBoundingClientRect(),A=E.clientX-R.left,T=E.clientY-R.top,O=A-p.current.x,L=T-p.current.y,Z=Math.min(Math.hypot(O,L),i),D=Math.atan2(L,O),G=Math.cos(D)*Z,Y=Math.sin(D)*Z,F={x:ss(G/i),y:ss(-Y/i),boost:!1};v(Q=>({...Q,knob:{x:G,y:Y}})),r?.(F)},[a,r]),M=m.useCallback(E=>{if(h.current!==E.pointerId)return;E.preventDefault(),d.current?.releasePointerCapture?.(E.pointerId),y()},[y]);return m.useEffect(()=>{a&&y()},[a,y]),o.jsxs("div",{ref:d,role:"presentation",className:"relative w-full h-full select-none overflow-hidden rounded-xl border-2 border-slate-700 bg-slate-900/70 text-slate-100 shadow-md",style:{touchAction:"none"},onPointerDown:b,onPointerMove:N,onPointerUp:M,onPointerLeave:M,onPointerCancel:M,onContextMenu:E=>E.preventDefault(),children:[!x.active&&o.jsxs("div",{className:"absolute inset-x-0 top-0 flex flex-col items-center gap-0 text-center pt-0.5",children:[o.jsx("span",{className:"font-semibold text-slate-200",children:"Joystick area"}),o.jsx("span",{className:"text-sm text-slate-300",children:"Touch and hold to use the joystick"})]}),x.active&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"pointer-events-none absolute h-28 w-28 -translate-x-1/2 -translate-y-1/2 bg-cyan-400/10 outline outline-2 outline-cyan-400/60 [clip-path:circle(50%)]",style:{left:x.base.x,top:x.base.y}}),o.jsx("div",{className:"pointer-events-none absolute h-12 w-12 -translate-x-1/2 -translate-y-1/2 bg-cyan-300/80 shadow-lg [clip-path:circle(50%)]",style:{left:x.base.x+x.knob.x,top:x.base.y+x.knob.y}})]})]})}function GA({layout:a}){const{state:{roverId:l},actions:{setDriveVector:i,registerInputState:r}}=Lt(),f=Pg(l),d=f.docked&&!f.driving,h=d||f.dockingInProgress,p=!l,x=zA,v=UA,y=m.useRef({x:0,y:0,boost:!1});m.useEffect(()=>{p&&(y.current={x:0,y:0,boost:!1})},[p]);const b=m.useCallback((E={})=>{if(p)return;const j={x:ss(E.x??0),y:ss(E.y??0),boost:!!E.boost},R={x:y.current.x+(j.x-y.current.x)*(1-v),y:y.current.y+(j.y-y.current.y)*(1-v),boost:j.boost};y.current=R,i(R,{source:Qr}),r(Qr,{vector:R,lastEvent:"move"})},[p,r,i,v]),N=m.useCallback(()=>{if(p)return;const E={x:0,y:0,boost:!1};y.current=E,i(E,{source:Qr}),r(Qr,{vector:E,lastEvent:"stop"})},[p,r,i]),C=`flex h-full flex-col gap-0.5 text-slate-100 ${d?"max-h-screen self-start":""}`;return o.jsxs("div",{className:C,children:[o.jsx(ex,{layout:"mobile",expand:h,driveDockState:f,compactHeightClass:"min-h-[5rem]"}),h?null:o.jsx("div",{className:"flex-1 min-h-0",children:o.jsx($A,{disabled:p,layout:a,radius:x,onMove:b,onStop:N})})]})}function Tp({id:a,label:l,values:i,color:r,disabled:f,onPress:d,onRelease:h}){return o.jsx("button",{type:"button",disabled:f,onPointerDown:p=>{p.preventDefault(),d(a,i)},onPointerUp:()=>h(a),onPointerLeave:()=>h(a),onPointerCancel:()=>h(a),onContextMenu:p=>p.preventDefault(),className:`flex h-full w-full items-center justify-center rounded-xl border-2 px-1 py-0.75 text-center text-sm font-semibold text-white transition select-none no-touch-select ${r} hover:brightness-110 active:brightness-125 active:scale-[0.99] disabled:opacity-30`,children:l})}function XA({layout:a}){const{state:{roverId:l,camera:i,horn:r},pipeline:f,actions:{setServoAngle:d,setNightVision:h,setAuxMotors:p,startHorn:x,stopHorn:v}}=Lt(),y=!l,b=m.useRef(null),N=i?.config,M=!!(l&&i?.enabled&&N),C=!!(l&&f?.nightVision),E=f?.nightVisionState,j=!!(l&&f?.horn),R=r?.overheated,A=typeof N?.minAngle=="number"?N.minAngle:-45,T=typeof N?.maxAngle=="number"?N.maxAngle:45,O=typeof i?.angle=="number"?i.angle:typeof N?.homeAngle=="number"?N.homeAngle:(A+T)/2,L=m.useCallback(G=>{C&&h(G)},[C,h]),Z=m.useCallback((G,Y)=>{y||(b.current=G,p(Y))},[y,p]),D=m.useCallback(G=>{y||b.current===G&&(b.current=null,p(HA))},[y,p]);return o.jsxs("div",{className:"grid h-full min-h-0 w-full grid-rows-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)] gap-0.5 text-slate-100",children:[o.jsxs("div",{className:"grid min-h-0 grid-rows-2 gap-0.5",children:[o.jsx(Tp,{id:"aux-vac-forward",label:"Vacuum Forward",values:VA,color:"bg-fuchsia-600",disabled:y,onPress:Z,onRelease:D}),o.jsx(Tp,{id:"aux-vac-backward",label:"Vacuum Backward",values:YA,color:"bg-fuchsia-800",disabled:y,onPress:Z,onRelease:D})]}),o.jsxs("div",{className:"flex min-h-0 items-stretch gap-0.5",children:[M?o.jsx("div",{className:"flex-1 min-h-0 rounded bg-zinc-950 p-0.25",children:o.jsx(ax,{value:O,min:A,max:T,step:.5,onChange:d,orientation:"vertical",label:"Camera Tilt",labelClass:"text-sm font-semibold text-white [writing-mode:vertical-rl] rotate-180",labelRowClass:"text-[0.7rem] text-slate-300",valueClass:"font-mono text-slate-200",className:"h-full gap-0",sliderClass:"h-full w-7",accentClass:"accent-cyan-400",showEndpoints:!1,showValue:!1})}):null,C?o.jsx(tx,{nightVisionOn:E?.nightVisionOn,disabled:y,onToggle:L,heightClass:"h-full"}):null]}),o.jsx("div",{className:"min-h-0",children:j?o.jsx(nx,{disabled:y||R,onStart:x,onStop:v,active:r?.active,heat:r?.heat,defaultShowSettings:!1,showSettingsToggle:!0,compactSettings:!0,className:"h-full"}):null})]})}function lx({layout:a,className:l=""}){return o.jsx("div",{className:`flex flex-col gap-0.5 ${l}`.trim(),children:o.jsx(XA,{layout:a})})}function sx({layout:a,className:l=""}){return o.jsx("div",{className:`flex flex-col gap-0.5 ${l}`.trim(),children:o.jsx(GA,{layout:a==="landscape"?"landscape":"portrait"})})}function QA(){const a="h-[min(60svh,24rem)]";return o.jsx("section",{className:"panel",children:o.jsxs("div",{className:"grid grid-cols-2 gap-0.5 items-stretch",children:[o.jsx(lx,{layout:"portrait",className:a}),o.jsx(sx,{layout:"portrait",className:a})]})})}function KA(a=[],l={}){const i=Dn(),{enabled:r=!0,version:f=null}=l,[d,h]=m.useState({}),p=m.useRef(new Map),x=m.useMemo(()=>a.map(C=>typeof C=="string"?C:C.id),[a]),v=m.useMemo(()=>{const C=x.join("|");return f?`${C}|v:${f}`:C},[x,f]),y=m.useRef([]),[b,N]=m.useState(0),M=m.useRef(new Map);return m.useEffect(()=>{if(!i)return;const C=()=>N(E=>E+1);return i.on("connect",C),()=>i.off("connect",C)},[i]),m.useEffect(()=>{y.current=x},[v,x]),m.useEffect(()=>{p.current.forEach(C=>URL.revokeObjectURL(C)),p.current.clear(),h({})},[v]),m.useEffect(()=>{if(!r){p.current.forEach(A=>URL.revokeObjectURL(A)),p.current.clear(),h({});return}if(!y.current.length||!i)return;let C=!1;const E=y.current,j=(A={},T)=>{if(C||!A.id||!T)return;const O=T.byteLength??T.length??0,L=Date.now(),Z=M.current.get(A.id)||{count:0,totalBytes:0,lastLogAt:0},D={count:Z.count+1,totalBytes:Z.totalBytes+O,lastLogAt:Z.lastLogAt};if(!D.lastLogAt||L-D.lastLogAt>=1e4){const Q=D.count?D.totalBytes/D.count:0;console.log("[roomCamera]",A.id,`frame=${O}B`,`avg=${Math.round(Q)}B`,`count=${D.count}`),D.lastLogAt=L}M.current.set(A.id,D);const G=new Blob([T],{type:"image/jpeg"}),Y=URL.createObjectURL(G),F=p.current.get(A.id);F&&URL.revokeObjectURL(F),p.current.set(A.id,Y),h(Q=>({...Q,[A.id]:{status:"playing",ts:A.ts||Date.now(),error:null,objectUrl:Y}}))},R=(A={})=>{C||!A.id||h(T=>({...T,[A.id]:{...T[A.id]||{},status:A.error?"error":T[A.id]?.status||"connecting",error:A.error||null,ts:A.ts||T[A.id]?.ts||null,objectUrl:T[A.id]?.objectUrl||null}}))};return i.on("roomCamera:frame",j),i.on("roomCamera:status",R),i.emit("roomCamera:subscribe",{ids:E},(A={})=>{A.error}),()=>{C=!0,i.emit("roomCamera:unsubscribe",{ids:E}),i.off("roomCamera:frame",j),i.off("roomCamera:status",R),p.current.forEach(A=>URL.revokeObjectURL(A)),p.current.clear()}},[i,v,r,b]),d}function FA({feed:a,label:l}){const[i,r]=m.useState(!1);m.useEffect(()=>{a&&(!a.ts&&!a.objectUrl||r(d=>!d))},[a?.ts,a?.objectUrl]);const f=m.useMemo(()=>a?a.error?`Error: ${a.error}`:a.status||"Connecting…":"Connecting…",[a]);return o.jsxs("div",{className:"relative w-full overflow-hidden rounded bg-black",style:{aspectRatio:"4 / 3"},children:[a?.objectUrl?o.jsx("img",{src:a.objectUrl,alt:l,className:"h-full w-full object-cover"}):o.jsx("div",{className:"flex h-full w-full items-center justify-center text-sm text-slate-300",children:"Waiting for frame…"}),o.jsx("div",{className:"pointer-events-none absolute left-0 top-0 bg-black/70 px-0.5 py-0.5 text-xs font-semibold text-white",children:l}),o.jsxs("div",{className:"pointer-events-none absolute bottom-0 left-0 m-0 flex items-center gap-0.5 rounded bg-black/70 px-0.5 py-0.25 text-[0.7rem] text-slate-100",children:[o.jsx("span",{className:`h-2 w-2 rounded-full ${i?"bg-emerald-400":"bg-slate-500"}`}),o.jsx("span",{children:f})]})]})}function ZA(){return o.jsxs("div",{className:"panel-section space-y-0.5 text-sm",children:[o.jsx("p",{className:"text-center text-slate-400",children:"No room cameras configured."}),o.jsx("p",{className:"text-center text-slate-500",children:"Add entries to server config to populate this list."})]})}const ix=["horizontal","vertical"];function nf(a,l){return ix.includes(a)?a:l}function Xf({defaultOrientation:a="horizontal",orientation:l,hideLayoutToggle:i=!1,hideHeader:r=!1,panelId:f=null}){const{session:d}=Ye(),h=d?.roomCameras||[],p=KA(h.map(j=>({id:j.id}))),{value:x,save:v}=it("roomCameraPanels",{}),[y,b]=m.useState(()=>nf(f?x?.[f]:a,"horizontal"));m.useEffect(()=>{if(!f)return;const j=x?.[f];j&&b(nf(j,"horizontal"))},[f,x?.[f]]);const N=l?nf(l,"horizontal"):y,M=N==="vertical"?"flex flex-col gap-0.5":"grid gap-0.5 md:grid-cols-2",C=!i&&!l&&h.length>0,E=j=>{b(j),f&&v(R=>({...R||{},[f]:j}))};return h.length===0?o.jsx(ZA,{}):o.jsxs("section",{className:"panel-section space-y-0.5 text-base",children:[!r&&o.jsxs("header",{className:"flex flex-wrap items-center justify-between gap-0.5 text-sm text-slate-400",children:[o.jsxs("div",{className:"flex items-center gap-0.5",children:[o.jsx("p",{children:"Room cameras"}),o.jsx("span",{className:"text-xs text-slate-500",children:h.length})]}),o.jsx("div",{className:"flex flex-wrap items-center gap-0.5 text-xs",children:C&&o.jsxs("div",{className:"flex items-center gap-0.5",children:[o.jsx("span",{className:"text-slate-500",children:"Layout:"}),o.jsx("div",{className:"inline-flex overflow-hidden rounded border border-slate-700",children:ix.map(j=>o.jsx("button",{type:"button",className:`px-1 py-0.5 ${N===j?"bg-slate-600 text-white":"bg-transparent text-slate-400 hover:text-white"}`,onClick:()=>E(j),children:j==="vertical"?"Vertical":"Grid"},j))})]})})]}),o.jsx("div",{className:M,children:h.map(j=>{const R=p[j.id]||null;return o.jsx("article",{className:"w-full space-y-0.5 rounded bg-zinc-950 p-0.5 shadow-inner shadow-black/40",children:o.jsx(FA,{feed:R,label:j.name||j.id})},j.id)})})]})}function Qf(){const{logs:a}=Ye();return o.jsxs("div",{className:"panel-section space-y-0.5 text-base",children:[o.jsxs("div",{className:"flex items-center justify-between text-sm text-slate-400",children:[o.jsx("span",{children:"Server logs"}),o.jsx("span",{children:a.length})]}),o.jsx("div",{className:"surface h-64 overflow-y-auto font-mono text-xs",children:a.length===0?o.jsx("p",{children:"No logs yet."}):a.slice().reverse().map(l=>o.jsxs("div",{className:"surface",children:[o.jsx("span",{className:"text-amber-400",children:l.timestamp})," ",o.jsxs("span",{className:"text-lime-400",children:["[",l.level,"]"]})," ",l.label&&o.jsxs("span",{className:"text-teal-400",children:["[",l.label,"]"]})," ",o.jsx("span",{children:l.message})]},l.id))})]})}function JA(a){if(!a)return null;if(typeof a=="string"){const l=String(a).trim();return l?{type:"rover",id:l,key:l}:null}if(typeof a=="object"){if(a.type&&a.id){const l=String(a.id);let i=a.key;return i||(i=a.type==="room"?`room:${l}`:l),{type:a.type,id:l,key:i}}if(a.roverId){const l=String(a.roverId);return{type:"rover",id:l,key:a.key||l}}if(a.roomCameraId){const l=String(a.roomCameraId);return{type:"room",id:l,key:a.key||`room:${l}`}}}return null}function IA(a=[]){const l=new Set,i=[];return a.forEach(r=>{!r?.key||l.has(r.key)||(l.add(r.key),i.push(r))}),i.sort((r,f)=>r.key.localeCompare(f.key))}function xi(a=[],l={}){const i=Dn(),{enabled:r=!0,version:f=null}=l,[d,h]=m.useState({}),p=m.useMemo(()=>Array.isArray(a)?IA(a.map(JA).filter(Boolean)):[],[a]),x=m.useMemo(()=>{const M=p.map(C=>`${C.type}:${C.id}:${C.key}`).join("|");return f?`${M}|v:${f}`:M},[p,f]),v=m.useRef([]),[y,b]=m.useState(0);return m.useEffect(()=>{if(!i)return;const M=()=>b(C=>C+1);return i.on("connect",M),()=>{i.off("connect",M)}},[i]),m.useEffect(()=>{v.current=p},[p]),m.useEffect(()=>{if(!x||!r){h({});return}const M=v.current;let C=!1;function E(j){const R=j.type==="room"?{roomCameraId:j.id}:{roverId:j.id};i.emit("video:request",R,(A={})=>{C||h(T=>({...T,[j.key]:A}))})}return M.forEach(j=>{E(j)}),()=>{C=!0}},[i,x,r,y]),m.useMemo(()=>{if(!x||!r)return{};const M={};return p.forEach(C=>{d[C.key]&&(M[C.key]=d[C.key])}),M},[x,d,p])}function Kf(a=[],l={}){const i=Dn(),{enabled:r=!0,version:f=null}=l,[d,h]=m.useState({}),p=m.useRef(new Map),x=m.useMemo(()=>a.map(C=>typeof C=="string"?C:C.id).filter(Boolean),[a]),v=m.useMemo(()=>{const C=x.join("|");return f?`${C}|v:${f}`:C},[x,f]),y=m.useRef([]),[b,N]=m.useState(0),M=m.useRef(new Map);return m.useEffect(()=>{if(!i)return;const C=()=>N(E=>E+1);return i.on("connect",C),()=>i.off("connect",C)},[i]),m.useEffect(()=>{y.current=x},[v,x]),m.useEffect(()=>{p.current.forEach(C=>URL.revokeObjectURL(C)),p.current.clear(),h({})},[v]),m.useEffect(()=>{if(!r){p.current.forEach(A=>URL.revokeObjectURL(A)),p.current.clear(),h({});return}if(!y.current.length||!i)return;let C=!1;const E=y.current,j=(A={},T)=>{if(C||!A.id||!T)return;const O=T.byteLength??T.length??0,L=Date.now(),Z=M.current.get(A.id)||{count:0,totalBytes:0,lastLogAt:0},D={count:Z.count+1,totalBytes:Z.totalBytes+O,lastLogAt:Z.lastLogAt};if(!D.lastLogAt||L-D.lastLogAt>=1e4){const Q=D.count?D.totalBytes/D.count:0;console.log("[roverSnapshot]",A.id,`frame=${O}B`,`avg=${Math.round(Q)}B`,`count=${D.count}`),D.lastLogAt=L}M.current.set(A.id,D);const G=new Blob([T],{type:"image/jpeg"}),Y=URL.createObjectURL(G),F=p.current.get(A.id);F&&URL.revokeObjectURL(F),p.current.set(A.id,Y),h(Q=>({...Q,[A.id]:{status:"playing",ts:A.ts||Date.now(),error:null,objectUrl:Y}}))},R=(A={})=>{C||!A.id||h(T=>({...T,[A.id]:{...T[A.id]||{},status:A.error?"error":T[A.id]?.status||"connecting",error:A.error||null,ts:A.ts||T[A.id]?.ts||null,objectUrl:T[A.id]?.objectUrl||null}}))};return i.on("roverSnapshot:frame",j),i.on("roverSnapshot:status",R),i.emit("roverSnapshot:subscribe",{ids:E},(A={})=>{A.error}),()=>{C=!0,i.emit("roverSnapshot:unsubscribe",{ids:E}),i.off("roverSnapshot:frame",j),i.off("roverSnapshot:status",R),p.current.forEach(A=>URL.revokeObjectURL(A)),p.current.clear()}},[i,v,r,b]),d}const WA={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"turn:your.turn.server:3478",username:"user",credential:"pass"}],bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"};function PA(a){if(typeof btoa=="function")return btoa(a);if(typeof Buffer<"u")return Buffer.from(a).toString("base64");throw new Error("No base64 encoder available")}function ej(a){if(!a)return{};const l=`${a}:${a}`;return{Authorization:`Basic ${PA(l)}`}}class _p{constructor({url:l,token:i,video:r,onStatus:f,audioOnly:d=!1,receiveAudio:h=!0}){this.url=l,this.token=i,this.video=r,this.audioOnly=d,this.receiveAudio=h,this.pc=null,this.abortController=null,this.onStatus=f}notify(l,i){typeof this.onStatus=="function"&&this.onStatus(l,i)}configureVideoElement(){this.video&&(this.video.playsInline=!0,this.video.autoplay=!0,this.video.muted=!this.audioOnly,typeof this.video.disableRemotePlayback<"u"&&(this.video.disableRemotePlayback=!0),"latencyHint"in HTMLMediaElement.prototype&&(this.video.latencyHint="interactive"))}async start(){if(!this.url||!this.video)throw new Error("Media target missing");this.stop(),this.notify("connecting"),this.configureVideoElement(),this.abortController=new AbortController;const l=new RTCPeerConnection(WA);this.pc=l;const i=new MediaStream;l.ontrack=r=>{r.streams[0]?.getTracks().forEach(f=>i.addTrack(f)),this.video.srcObject=i,r.track?.kind==="video"&&"playoutDelayHint"in r.receiver&&(r.receiver.playoutDelayHint=0)},this.audioOnly?l.addTransceiver("audio",{direction:"recvonly"}):(l.addTransceiver("video",{direction:"recvonly"}),this.receiveAudio&&l.addTransceiver("audio",{direction:"recvonly"})),l.onconnectionstatechange=()=>{this.notify(l.connectionState)},l.oniceconnectionstatechange=()=>{const r=l.iceConnectionState;(r==="failed"||r==="disconnected")&&this.notify(r)};try{const r=await l.createOffer({offerToReceiveAudio:this.audioOnly?!0:this.receiveAudio,offerToReceiveVideo:!this.audioOnly});await l.setLocalDescription(r);const f=await fetch(this.url,{method:"POST",headers:{"Content-Type":"application/sdp",...ej(this.token)},body:r.sdp,signal:this.abortController.signal});if(!f.ok)throw new Error(`WHEP request failed: ${f.status}`);const d=await f.text();await l.setRemoteDescription({type:"answer",sdp:d}),l.getReceivers().forEach(h=>{"playoutDelayHint"in h&&(h.playoutDelayHint=0)}),await this.video.play().catch(()=>{}),this.notify("playing")}catch(r){throw this.notify("error",r.message),this.stop(),r}}stop(){this.abortController&&(this.abortController.abort(),this.abortController=null),this.pc&&(this.pc.getSenders().forEach(l=>l.track?.stop()),this.pc.getReceivers().forEach(l=>l.track?.stop()),this.pc.close(),this.pc=null),this.video&&(this.video.srcObject=null),this.notify("stopped")}}function jf({sensors:a={},variant:l="full",size:i,overlay:r=!1}){const f=i||(l==="mini"?190:260),d=f/2,h=f*.07,p=d,x=d+h,v=d*.8,y=v-4,b=v+4,N=v-14,M=v-6,C=v*.65,E=a?.bumpsAndWheelDrops||{},j=a?.wheelOvercurrents||{},R=a?.wheelLeftCurrentMa??0,A=a?.wheelRightCurrentMa??0,T=a?.sideBrushCurrentMa??0,O=a?.mainBrushCurrentMa??0,L=6,Z=E.bumpLeft?L:0,D=E.bumpRight?L:0,G=rj({count:6,totalSpan:140,gap:6,startAngle:-70}),Y=["L","FL","CL","CR","FR","R"],F=[a?.lightBumpLeftSignal,a?.lightBumpFrontLeftSignal,a?.lightBumpCenterLeftSignal,a?.lightBumpCenterRightSignal,a?.lightBumpFrontRightSignal,a?.lightBumpRightSignal],Q=G.map((V,q)=>({label:Y[q],start:V.start,end:V.end,value:F[q]})),ne=[{label:"Cliff L",start:-60,end:-46,value:a?.cliffLeftSignal,active:a?.cliffLeft},{label:"Cliff FL",start:-32,end:-16,value:a?.cliffFrontLeftSignal,active:a?.cliffFrontLeft},{label:"Cliff FR",start:16,end:32,value:a?.cliffFrontRightSignal,active:a?.cliffFrontRight},{label:"Cliff R",start:46,end:60,value:a?.cliffRightSignal,active:a?.cliffRight}],ce=F.filter(V=>V!=null),pe=ce.length?Math.max(...ce,1200):1200;return o.jsxs("div",{className:`${r?"relative":"surface relative p-1"}`,style:r?{width:`${f}px`,height:`${f}px`}:{height:"100%",width:"100%",aspectRatio:"1 / 1"},children:[r?null:o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"absolute left-1 top-1 text-xs text-slate-400",children:"Top-down"}),o.jsxs("div",{className:"absolute right-1 top-1 text-[0.65rem] text-slate-500",children:["0–",pe]})]}),o.jsxs("svg",{width:"100%",height:"100%",viewBox:`0 0 ${f} ${f}`,preserveAspectRatio:"xMidYMid meet",className:"mx-auto block",children:[o.jsx("circle",{cx:p,cy:x,r:v,fill:"#0f172a",stroke:"#334155",strokeWidth:"2"}),o.jsx(Dp,{cx:p-C,cy:x,current:R,drop:E.wheelDropLeft,overcurrent:j.leftWheel,label:"L"}),o.jsx(Dp,{cx:p+C,cy:x,current:A,drop:E.wheelDropRight,overcurrent:j.rightWheel,label:"R"}),o.jsx(aj,{cx:p+v*.65,cy:x-v*.55,current:T,overcurrent:j.sideBrush}),o.jsx(lj,{cx:p,cy:x,current:O,overcurrent:j.mainBrush,variant:l,dirtLeft:a?.dirtDetectLeft,dirtRight:a?.dirtDetect}),Q.map(V=>{const q=sj(V.value,pe),X=b+4,W=X+28;return o.jsx(tj,{cx:p,cy:x,rBase:W,rTip:X,startDeg:V.start,endDeg:V.end,color:q,value:V.value,max:pe},V.label)}),ne.map(V=>{const q=ij(V.value,V.active);return o.jsx(af,{cx:p,cy:x,rInner:N,rOuter:M,startDeg:V.start,endDeg:V.end,color:q,opacity:1,pulse:!!V.active},V.label)}),o.jsx(af,{cx:p,cy:x,rInner:y-Z,rOuter:b-Z,startDeg:-70,endDeg:-6,color:E.bumpLeft?"#ef4444":"#475569",opacity:1,pulse:!!E.bumpLeft}),o.jsx(af,{cx:p,cy:x,rInner:y-D,rOuter:b-D,startDeg:6,endDeg:70,color:E.bumpRight?"#ef4444":"#475569",opacity:1,pulse:!!E.bumpRight})]})]})}function af({cx:a,cy:l,rInner:i,rOuter:r,startDeg:f,endDeg:d,color:h,pulse:p=!1,opacity:x=1}){const v=(i+r)/2,y=r-i,b=nj(a,l,v,f,d);return o.jsxs(o.Fragment,{children:[o.jsx("path",{d:b,stroke:h,strokeWidth:y,strokeLinecap:"round",fill:"none",opacity:x}),p?o.jsx("path",{d:b,stroke:"#ef4444",strokeWidth:y,strokeLinecap:"round",fill:"none",className:"animate-pulse",opacity:1}):null]})}function tj({cx:a,cy:l,rBase:i,rTip:r,startDeg:f,endDeg:d,color:h,value:p,max:x}){const v=(f+d)/2,y=mi(a,l,r,v),b=go(p!=null?p/(x||1):0),N=Math.pow(b,.35),M=i-(i-r)*N,C=mi(a,l,M,f),E=mi(a,l,M,d),j=`M ${y.x} ${y.y} L ${C.x} ${C.y} L ${E.x} ${E.y} Z`;return o.jsx("path",{d:j,fill:h,opacity:1,stroke:"none"})}function nj(a,l,i,r,f){let d=r,h=f;h<=d&&(h+=360);const p=mi(a,l,i,d),x=mi(a,l,i,h);return["M",p.x,p.y,"A",i,i,0,0,1,x.x,x.y].join(" ")}function mi(a,l,i,r){const f=rx(r);return{x:a+i*Math.cos(f),y:l+i*Math.sin(f)}}function rx(a){return(a-90)*Math.PI/180}function Ff(a,l){if(l)return"#ef4444";const i=Math.abs(a);return i>900?"#f59e0b":i>300?"#22c55e":"#64748b"}function go(a){return Math.max(0,Math.min(1,a))}function Dp({cx:a,cy:l,current:i,drop:r,overcurrent:f,label:d}){const h=Math.abs(i),p=go(h/1200),x=Ff(i,f),v=56,y=14,b=9,N=3,M=v*p,C=d==="L"?-1:1,E=C*(-b/2-N/2),j=C*(y/2+N/2),R=y+b+N+2,A=v+4;return o.jsxs("g",{transform:`translate(${a},${l})`,children:[o.jsx("rect",{x:-R/2,y:-A/2,width:R,height:A,rx:"4",fill:"none",stroke:"#64748b",strokeWidth:"1"}),o.jsx("rect",{x:E-y/2,y:-v/2,width:y,height:v,fill:"#0f172a",stroke:"#0f172a",strokeWidth:"1",rx:"2"}),o.jsx("rect",{x:E-y/2,y:v/2-M,width:y,height:M,fill:x,className:f?"animate-pulse":""}),o.jsx("rect",{x:j-b/2,y:-v/2,width:b,height:v,fill:r?"#ef4444":"#475569",className:r?"animate-pulse":"",rx:"2"}),o.jsx("text",{x:0,y:v/2+10,textAnchor:"middle",className:"fill-slate-200 text-[0.7rem]",children:d})]})}function aj({cx:a,cy:l,current:i,overcurrent:r}){var f=Math.abs(i);f<10&&(f=0);const d=Ff(i*3,r),h=43,p=f>0?.65:null;return o.jsxs("g",{style:{transformOrigin:`${a}px ${l}px`,animation:p?`spin ${p}s linear infinite`:"none",animationDirection:p?"reverse":"normal"},children:[o.jsx("circle",{cx:a,cy:l,r:10,fill:"#64748b",stroke:"#64748b",strokeWidth:"1"}),[0,120,240].map(v=>{const y=rx(v),b=a+h*Math.cos(y),N=l+h*Math.sin(y);return o.jsx("line",{x1:a,y1:l,x2:b,y2:N,stroke:d,strokeWidth:"4",strokeLinecap:"round"},v)}),r?o.jsx("circle",{cx:a,cy:l,r:h+8,stroke:"#ef4444",strokeWidth:"3",fill:"none",className:"animate-pulse"}):null]})}function lj({cx:a,cy:l,current:i,overcurrent:r,variant:f,dirtLeft:d,dirtRight:h}){const p=Math.abs(i),x=Ff(i,r),v=1,y=96,b=12,N=`main-brush-pattern-a-${f}`,M=`main-brush-pattern-b-${f}`,C=p>0?.6:null,E=i>=0?1:-1;return o.jsxs("g",{children:[o.jsx("defs",{children:[N,M].map((j,R)=>o.jsxs("pattern",{id:j,patternUnits:"userSpaceOnUse",width:"6",height:"6",children:[o.jsx("rect",{width:"6",height:"6",fill:x,opacity:v}),o.jsx("path",{d:"M0 6 L6 0",stroke:"#0f172a",strokeWidth:"1"}),C?o.jsx("animateTransform",{attributeName:"patternTransform",type:"translate",from:"0 0",to:`0 ${E*(R===0?6:-6)}`,dur:`${C}s`,repeatCount:"indefinite"}):null]},j))}),o.jsx("rect",{x:a-y/2,y:l-14,width:y,height:b,rx:"3",fill:`url(#${N})`,stroke:"#64748b",strokeWidth:"1"}),o.jsx("rect",{x:a-y/2,y:l+4,width:y,height:b,rx:"3",fill:`url(#${M})`,stroke:"#64748b",strokeWidth:"1"}),o.jsx("circle",{cx:a-y/4,cy:l-8,r:3.5,fill:"#fbbf24"}),o.jsx("circle",{cx:a+y/4,cy:l+8,r:3.5,fill:"#fbbf24"}),r?o.jsx("rect",{x:a-y/2-4,y:l-16,width:y+8,height:b*2+16,rx:"6",stroke:"#ef4444",strokeWidth:"3",fill:"none",className:"animate-pulse"}):null]})}function sj(a,l){if(a==null||a<=0)return"hsl(200 60% 18%)";const r=go(a/(l||1));return`hsl(${(200+Math.pow(r,.45)*360)%360} 100% 60%)`}function ij(a,l){if(l)return"#ef4444";const i=go(a==null?0:a/4095),r=[47,55,69],f=[245,158,11],[d,h,p]=r.map((x,v)=>Math.round(x+(f[v]-x)*i));return`rgb(${d}, ${h}, ${p})`}function rj({count:a,totalSpan:l,gap:i,startAngle:r}){const d=(l-i*(a-1))/a,h=[];let p=r;for(let x=0;x<a;x+=1){const v=p+d;h.push({start:p,end:v}),p=v+i}return h}function ox(){const{value:a,save:l}=it("page",{hudMapDesktop:!1});return[!!a?.hudMapDesktop,f=>{l({hudMapDesktop:!!f})}]}const oj={discord:Bg,kofi:vp,"ko-fi":vp,wiki:DS,throne:OS},cj={discord:{backgroundImage:"linear-gradient(270deg,#5865F2,#404EED,#5865F2)",backgroundSize:"600% 600%",animation:"socialGradient 180s ease infinite"},kofi:{backgroundImage:"linear-gradient(270deg,#FF6433,#E04822,#FF6433)",backgroundSize:"600% 600%",animation:"socialGradient 170s ease infinite"},"ko-fi":{backgroundImage:"linear-gradient(270deg,#FF6433,#E04822,#FF6433)",backgroundSize:"600% 600%",animation:"socialGradient 170s ease infinite"},wiki:{backgroundImage:"linear-gradient(270deg,#EE8019,#C65C08,#EE8019)",backgroundSize:"600% 600%",animation:"socialGradient 180s ease infinite"},throne:{backgroundImage:"linear-gradient(270deg,#7C3AED,#5B21B6,#7C3AED)",backgroundSize:"600% 600%",animation:"socialGradient 180s ease infinite"}};function uj(){m.useEffect(()=>{if(typeof document>"u")return;const a="social-button-keyframes";if(document.getElementById(a))return;const l=document.createElement("style");l.id=a,l.textContent=`
|
||
@keyframes socialGradient {
|
||
0% { background-position: 0% 50%; }
|
||
50% { background-position: 100% 50%; }
|
||
100% { background-position: 0% 50%; }
|
||
}
|
||
`,document.head.appendChild(l)},[])}function fj(a,l){return typeof a=="string"&&a.trim()?a.trim().toLowerCase():typeof l=="string"&&l.trim()?l.trim().toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,""):""}function Zf({id:a,label:l,url:i,className:r=""}){if(!i)return null;uj();const f=fj(a,l),d=oj[f]||BS,h=cj[f]||null,p=l||a||"Link";return o.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer","aria-label":p,className:`inline-flex items-center w-full px-0.5 py-0.5 text-sm font-medium text-white transition justify-center gap-1 rounded-md ${h?"":"bg-slate-700 hover:bg-slate-600"} ${r}`,style:h||void 0,children:[o.jsx(d,{className:"mr-0"}),p]})}const vi=10;function cx({batteryState:a=null,charge:l=null,config:i=null}){const r=a?.percentDisplay!=null&&Number.isFinite(a.percentDisplay)?Math.round(a.percentDisplay):null,f=a?.warnActive??null,d=a?.urgentActive??null,h=i?.Full??null,p=i?.Warn??null,x=i?.Urgent??null,v=l??a?.charge??null;let y=r;if(y==null&&(y=dj({charge:v,full:h,warn:p,urgent:x})),y==null)return{available:!1};const b=Math.max(0,Math.min(1,y/100)),N=f??(p!=null&&v!=null&&v<=p),M=d??(x!=null&&v!=null&&v<=x);return{available:!0,percent:b,percentDisplay:y,warnActive:N,urgentActive:M,warnDisplayPercent:vi}}function dj({charge:a,full:l,warn:i,urgent:r}){if(a!=null&&l!=null&&i!=null&&r!=null&&l>i&&i>r){const f=vi/100,d=1-f;if(a<=r)return 0;if(a<=i){const p=(a-r)/(i-r);return Math.round(Math.max(0,Math.min(1,p))*vi)}if(a>=l)return 100;const h=(a-i)/(l-i);return Math.round((f+Math.max(0,Math.min(1,h))*d)*100)}return null}const mj=1600,hj=800;function mn(...a){return a.filter(Boolean).join(" ")}function Nf({visual:a,orientation:l="horizontal",variant:i="inline",compact:r=!1,showLabel:f,className:d=""}){const h=i==="background",p=l==="vertical",x=f??!h;if(!a?.available){if(h){const ne=vi,ce=mn("absolute z-10",p?"left-0 right-0 h-[2px]":"top-0 bottom-0 w-[2px]","bg-black/70",M&&!N&&"battery-tick-warn"),pe=p?{bottom:`${ne}%`}:{left:`${ne}%`},V=mn("absolute inset-0 pointer-events-none",d);return o.jsxs("div",{className:V,children:[o.jsx("div",{className:"absolute inset-0 bg-slate-900/35"}),o.jsx("div",{className:ce,style:pe})]})}return p?null:o.jsx("p",{className:"text-xs text-slate-500",children:"Battery telemetry unavailable"})}const v=a.percentDisplay??0,y=Math.max(0,Math.min(100,v)),b=a.warnDisplayPercent??vi,N=!!a.urgentActive,M=!!a.warnActive,C=N?`${hj}ms`:M?`${mj}ms`:void 0,j=h?N||M?"bg-red-500/45":"bg-emerald-500/45":N||M?"bg-red-500":"bg-emerald-500",R=N||M?"bg-red-900/35":"bg-slate-900/35",A=N||M?"bg-red-900/45":"bg-slate-900/35",T=mn(h?"absolute inset-0 pointer-events-none":"relative pointer-events-auto",p&&!h?"flex flex-col items-center justify-center":"w-full",d);if(h){const ne=p?{height:`${y}%`}:{width:`${y}%`},ce=mn("absolute",p?"bottom-0 left-0 right-0":"left-0 top-0 bottom-0",j,"transition-[width,height]",N&&"battery-urgent-flash"),pe=mn("absolute z-10",p?"left-0 right-0 h-[2px]":"top-0 bottom-0 w-[2px]","bg-black/70",M&&!N&&"battery-tick-warn"),V=p?{bottom:`${b}%`}:{left:`${b}%`};return o.jsxs("div",{className:T,children:[o.jsx("div",{className:mn("absolute inset-0",R,N&&"battery-urgent-flash")}),o.jsx("div",{className:ce,style:{...ne,animationDuration:C}}),o.jsx("div",{className:pe,style:V})]})}const O=mn("relative overflow-hidden rounded-sm border border-slate-800",N||M?A:"bg-zinc-900/90",N&&"battery-urgent-flash",p?"w-full flex-1":r?"h-4":"h-5"),L=p?{height:`${y}%`}:{width:`${y}%`},Z=mn("absolute",p?"bottom-0 left-0 right-0":"left-0 top-0 bottom-0",j,"transition-[width,height]",N&&"battery-urgent-flash"),D=mn("absolute z-10",p?"left-0 right-0 h-[2px]":"top-0 bottom-0 w-[2px]","bg-black/70",M&&!N&&"battery-tick-warn"),G=p?{bottom:`${b}%`}:{left:`${b}%`},Y=`Battery ${v}%`,F=mn("pointer-events-none absolute inset-0 flex items-center justify-center text-center font-semibold",p?r?"text-[0.55rem]":"text-[0.65rem]":"text-xs"),Q=mn("rounded px-1.5 py-0.5",h?"bg-black/30 text-slate-100":"bg-black/50 text-slate-100");return o.jsxs("div",{className:T,children:[o.jsxs("div",{className:O,children:[o.jsx("div",{className:Z,style:{...L,animationDuration:C}}),o.jsx("div",{className:D,style:G})]}),x&&!p?o.jsx("div",{className:F,children:o.jsx("span",{className:Q,children:Y})}):null,x&&p?o.jsx("div",{className:"mt-0.5 text-[0.65rem] font-semibold text-slate-100",children:o.jsxs("span",{className:Q,children:[v,"%"]})}):null]})}const Op=2e3,pj=3e3,gj=3e3,xj=.55,Bp=40,vj=-.75,qn={threshold:-30,knee:10,ratio:8,attack:.002,release:.18},Lp=2.25;function yi({sessionInfo:a,audioSessionInfo:l,videoMode:i="whep",snapshotFeed:r=null,qualityNotice:f=null,label:d,forceMute:h=!1,telemetryFrame:p,batteryConfig:x,layoutFormat:v="desktop",hudVariant:y="default",driverLabel:b=null,hudForceMap:N=!1,hudMapPosition:M="top-center",hudLabelScale:C=1,fitParent:E=!1,overcurrentLimiter:j=null,showTurnCue:R=!1,turnTimerText:A=null,turnSeconds:T=null,isActiveDriver:O=!1,idleSkipSeconds:L=null}){const{session:Z}=Ye(),D=m.useRef(null),G=m.useRef(null),Y=m.useRef(null),F=m.useRef(null),Q=m.useRef(null),ne=m.useRef(null),ce=m.useRef(null),pe=m.useRef(null),V=m.useRef(null),q=m.useRef(null),X=m.useRef(!1),W=m.useRef(null),re=m.useRef(!1),de=m.useRef(!1),w=m.useRef(0),[z,P]=m.useState("idle"),[ae,le]=m.useState(null),[se,oe]=m.useState("idle"),[ve,he]=m.useState(null),[Oe,te]=m.useState(null),[ie,Se]=m.useState(!1),[Be,Te]=m.useState(0),[We,On]=m.useState(0),[Ua,Bn]=m.useState(!0),gt=!!l?.url,St=i==="snapshot",vn=p?.sensors,{value:Ln}=it("audio",qt),wt=Number.isFinite(Ln?.masterVolume)?Ln.masterVolume:qt.masterVolume,So=Number.isFinite(Ln?.roverVolume)?Ln.roverVolume:qt.roverVolume,zt=typeof Ln?.autoLevelEnabled=="boolean"?Ln.autoLevelEnabled:qt.autoLevelEnabled,Ut=Ln?.autoLevelMode==="duck"?"duck":"compressor",ua=Math.max(0,Math.min(1,wt*So)),Ao=vn?.batteryChargeMah??null,us=v==="desktop",Zt=!us,jo=Zt?"top-right":M,[Ha]=ox(),Et=N||Zt?!0:Ha,Mt=cx({charge:Ao,config:x}),ht=vn?.wheelOvercurrents||null,fs=ht==null?[]:Object.entries(ht).filter(([,ue])=>!!ue).map(([ue])=>ue),yn=j?.caps||null,Ci=j?.overcurrent?.groups||null,Va=typeof window<"u"&&new URLSearchParams(window.location.search).has("debugAudio"),fa=typeof window<"u"&&new URLSearchParams(window.location.search).has("debugHud"),hl=m.useMemo(()=>{if(!yn)return null;const ue=Number.isFinite(yn?.drive?.cap)?yn.drive.cap:1,$e=Number.isFinite(yn?.aux?.cap)?yn.aux.cap:1;return Math.max(0,Math.min(1,1-Math.min(ue,$e)))},[yn]),cn=!!j?.isActive,bn=fs.length?fs:cn?["limiter"]:[],Sn=hl??(fs.length?1:0),ds=!!bn.length,Ya=!!((Number(vn?.mainBrushCurrentMa)||0)>Bp||(Number(vn?.sideBrushCurrentMa)||0)>Bp||vn?.wheelOvercurrents?.mainBrush||vn?.wheelOvercurrents?.sideBrush),At=Math.max(0,Math.min(1,ua*(zt&&Ut==="duck"&&Ya?xj:1))),Ne=m.useCallback((ue,$e={})=>{if(!Va)return;const ke=G.current,ye=ce.current,Ge={event:ue,ts:Date.now(),roverLabel:d||null,hasDedicatedAudio:gt,audioUrl:l?.url||null,autoLevelEnabled:zt,autoLevelMode:Ut,baseRoverGain:ua,effectiveRoverGain:At,element:ke?{muted:ke.muted,volume:ke.volume,paused:ke.paused,ended:ke.ended,readyState:ke.readyState,networkState:ke.networkState}:null,context:ye?{state:ye.state,sampleRate:ye.sampleRate}:null,...$e};try{console.log(`[AudioDebug] ${ue} ${JSON.stringify(Ge)}`)}catch{console.log("[AudioDebug]",ue,Ge)}},[Va,d,gt,l?.url,zt,Ut,ua,At]),Mi=Z?.socials?.find(ue=>String(ue?.id||ue?.label||"").toLowerCase()==="discord")?.url||Z?.discord?.invite||null;m.useEffect(()=>{fa&&console.log("[OvercurrentHUD]",{overlayVisible:ds,overlayMotors:bn,overlayFill:Sn,limiterActive:cn,limiterCaps:yn,limiterGroups:Ci,wheelOvercurrents:ht})},[fa,Sn,bn,ds,cn,yn,Ci,ht]),m.useEffect(()=>{Ne("settings/update")},[Ne]);const da=m.useCallback(()=>{clearTimeout(Y.current),Y.current=setTimeout(()=>Te(Date.now()),Op)},[]),pl=m.useCallback(()=>{clearTimeout(F.current),F.current=setTimeout(()=>On(Date.now()),Op)},[]),ma=m.useCallback(()=>{if(re.current)return!1;const ue=G.current;if(!ue||typeof window>"u")return!1;try{const $e=window.AudioContext||window.webkitAudioContext;if(typeof $e!="function")return!1;ce.current||(ce.current=new $e);const ke=ce.current;if(pe.current||(pe.current=ke.createMediaElementSource(ue)),!V.current){const ye=ke.createDynamicsCompressor();ye.threshold.value=qn.threshold,ye.knee.value=qn.knee,ye.ratio.value=qn.ratio,ye.attack.value=qn.attack,ye.release.value=qn.release,V.current=ye,Ne("graph/compressor-created",{threshold:ye.threshold.value,knee:ye.knee.value,ratio:ye.ratio.value,attack:ye.attack.value,release:ye.release.value})}return q.current||(q.current=ke.createGain()),X.current||(pe.current.disconnect(),V.current.disconnect(),q.current.disconnect(),pe.current.connect(V.current),V.current.connect(q.current),q.current.connect(ke.destination),X.current=!0,Ne("graph/connected")),!0}catch{return re.current=!0,Ne("graph/failed"),!1}},[Ne]),An=m.useCallback(async()=>{const ue=ce.current;if(!ue||ue.state!=="suspended")return;if(!de.current){Ne("context/resume-skipped-no-interaction");return}const $e=Date.now();if(!($e-w.current<800)){if(w.current=$e,Ne("context/resume-attempt"),await ue.resume().catch(()=>{}),ue.state==="running"&&zt&&Ut==="compressor"&&q.current){const ke=Math.max(0,Math.min(4,At*Lp));q.current.gain.value=ke,Ne("context/gain-restored",{gain:ke,baseGain:At})}Ne("context/resume-result")}},[Ne,zt,Ut,At]);m.useEffect(()=>{if(!l?.url)return;const ue=()=>{de.current||(de.current=!0,Ne("interaction/first-user-gesture"),An())};return window.addEventListener("pointerdown",ue,{passive:!0,capture:!0}),window.addEventListener("keydown",ue,{capture:!0}),window.addEventListener("touchstart",ue,{passive:!0,capture:!0}),()=>{window.removeEventListener("pointerdown",ue),window.removeEventListener("keydown",ue),window.removeEventListener("touchstart",ue)}},[l?.url,Ne,An]);const $a=m.useCallback(async()=>{const ue=D.current;if(ue)try{ue.muted=!0,await ue.play()}catch{}},[]),ms=m.useCallback((ue=0)=>{if(h||gt)return;clearTimeout(ne.current);const $e=()=>{clearTimeout(ne.current),ne.current=setTimeout(()=>{h||ke()},pj)},ke=async()=>{const ye=D.current;if(ye)try{await $a(),ye.muted=!1,await ye.play(),Bn(!1)}catch{ye.muted=!0,Bn(!0),$e()}};ne.current=setTimeout(ke,ue)},[$a,h,gt]);m.useEffect(()=>()=>{clearTimeout(Y.current),clearTimeout(F.current),clearTimeout(ne.current),clearInterval(Q.current),clearInterval(W.current),X.current=!1,pe.current?.disconnect?.(),V.current?.disconnect?.(),q.current?.disconnect?.(),ce.current?.state&&ce.current.state!=="closed"&&ce.current.close().catch(()=>{})},[]),m.useEffect(()=>{z==="playing"&&ms(0)},[z,ms]),m.useEffect(()=>{St&&(P("snapshot"),le(null))},[St]),m.useEffect(()=>{if(St||!a?.url||!D.current)return;let ue=!0,$e;const ke=setTimeout(()=>Bn(!0),0),ye=(Ge,ze)=>{ue&&(Ne("video/status",{nextStatus:Ge,info:ze||null}),P(Ge),le(ze||null),Ge==="playing"&&$a(),["error","failed","disconnected","closed"].includes(Ge)&&da())};return $e=new _p({url:a.url,token:a.token,video:D.current,receiveAudio:!gt,onStatus:ye}),$e.start().catch(Ge=>{ue&&(P("error"),le(Ge.message),da())}),()=>{ue=!1,clearTimeout(ke),$e?.stop()}},[St,a?.url,a?.token,Be,da,$a,gt,Ne]),m.useEffect(()=>{z==="stopped"&&a?.url&&da()},[z,a?.url,da]),m.useEffect(()=>{const ue=G.current;if(clearInterval(W.current),W.current=null,!ue||!l?.url){Se(!1),te(null),Ne("route/no-audio-url");return}const $e=zt&&Ut==="compressor",ke=zt&&Ut==="duck";if($e?ma():!1){const Ge=V.current,ze=q.current,Rt=ce.current?.state==="running",Vt=!!(Rt&&ie);if(ue.volume=Vt?0:At,Ne("route/graph",{contextRunning:Rt,canActivate:Vt,elementVolume:ue.volume}),ze){const Ue=Vt?Math.max(0,Math.min(4,At*Lp)):0;ze.gain.value=Ue,Ne("route/graph-gain",{graphGain:Ue,baseGain:At})}Ge&&(Ge.threshold.value=qn.threshold,Ge.knee.value=qn.knee,Ge.ratio.value=qn.ratio,Ge.attack.value=qn.attack,Ge.release.value=qn.release),Vt?W.current=setInterval(()=>{if(ce.current?.state!=="running"){te(null);return}const Ue=Ge?.reduction;if(typeof Ue=="number"&&Ue<=vj){const Ze=Math.round(Math.abs(Ue)*10)/10,hs=Number.isInteger(Ze)?Ze.toFixed(0):Ze.toFixed(1);te(`Level: ${hs}dB`),Ne("compressor/reduction",{reduction:Ue,formatted:hs})}else te(null)},180):te(null);return}Se(!1),ue.volume=At,Ne("route/direct",{elementVolume:ue.volume,duckMode:ke,brushOrVacuumActive:Ya}),V.current&&(V.current.threshold.value=0,V.current.knee.value=0,V.current.ratio.value=1,V.current.attack.value=.003,V.current.release.value=.25),q.current&&(q.current.gain.value=0),te(ke&&Ya?"Level: ducking":null)},[l?.url,zt,Ut,Ya,ie,At,ma,Ne]),m.useEffect(()=>{if(!l?.url||!G.current)return;let ue=!0,$e;const ke=(ye,Ge)=>{ue&&(Ne("audio/status",{nextStatus:ye,info:Ge||null}),he(Ge||(ye==="connected"?"connected":null)),oe(ze=>ye==="connected"&&(ze==="playing"||ze==="connecting")||ye==="new"?ze:ye),ye==="playing"&&An(),["error","failed"].includes(ye)&&pl())};return $e=new _p({url:l.url,token:l.token,video:G.current,audioOnly:!0,onStatus:ke}),$e.start().catch(ye=>{ue&&(oe("error"),he(ye.message),pl())}),()=>{ue=!1,$e?.stop()}},[l?.url,l?.token,We,pl,An,Ne]),m.useEffect(()=>{const ue=G.current;if(!l?.url||!ue){clearInterval(Q.current);return}if(!["connecting","connected","playing","paused"].includes(se)){clearInterval(Q.current);return}const ke=async()=>{const ye=G.current;!ye||(ye.muted=!1,zt&&Ut==="compressor"&&(ma(),await An(),ce.current?.state==="running"&&!ie&&(Se(!0),Ne("compressor/activated"))),!ye.paused&&!ye.ended)||(Ne("retry/play-attempt"),ye.play().then(()=>{Ne("retry/play-ok"),oe(ze=>ze==="connected"?"playing":ze),he(ze=>ze==="paused"?null:ze)}).catch(ze=>{Ne("retry/play-fail",{error:ze?.message}),he(Rt=>Rt||ze?.message||"autoplay blocked")}))};return ke(),Q.current=setInterval(ke,gj),()=>clearInterval(Q.current)},[l?.url,se,zt,Ut,ie,ma,An,Ne]),m.useEffect(()=>{const ue=G.current;if(!ue)return;const $e=()=>{Ne("element/play"),oe(Ue=>Ue==="error"?Ue:"playing"),he(null)},ke=()=>{Ne("element/pause"),oe(Ue=>["error","failed","disconnected","closed","stopped"].includes(Ue)?Ue:"paused"),he(Ue=>Ue||"paused")},ye=()=>{Ne("element/ended"),oe(Ue=>Ue==="error"?Ue:"stopped"),he(Ue=>Ue||"ended")},Ge=()=>{const{error:Ue}=ue,Ze=Ue?.message||"audio error";Ne("element/error",{error:Ze}),oe("error"),he(Ze)},ze=()=>Ne("element/waiting"),Rt=()=>Ne("element/canplay"),Vt=()=>Ne("element/stalled");return ue.addEventListener("play",$e),ue.addEventListener("pause",ke),ue.addEventListener("ended",ye),ue.addEventListener("error",Ge),ue.addEventListener("waiting",ze),ue.addEventListener("canplay",Rt),ue.addEventListener("stalled",Vt),()=>{ue.removeEventListener("play",$e),ue.removeEventListener("pause",ke),ue.removeEventListener("ended",ye),ue.removeEventListener("error",Ge),ue.removeEventListener("waiting",ze),ue.removeEventListener("canplay",Rt),ue.removeEventListener("stalled",Vt)}},[l?.url,Ne]);const jn=r?.error?`Error: ${r.error}`:r?.objectUrl?"snapshot":r?.status||"waiting",dt=St?jn:a?.url?z==="error"?`Error: ${ae||"unknown"}`:ae?`${z} (${ae})`:z:"waiting",jt=l?.error?`Error: ${l.error}`:l?.url?se==="error"?`Error: ${ve||"unknown"}`:ve?`${se} (${ve})`:se:null,zn=y==="spectator",Ht=y==="none";return o.jsxs("div",{className:`flex flex-col gap-0.5 ${E?"h-full":""}`,children:[o.jsxs("div",{className:`relative w-full overflow-hidden bg-black ${E?"h-full flex-1":"aspect-[4/3]"}`,children:[St?r?.objectUrl?o.jsx("img",{src:r.objectUrl,alt:d,className:"h-full w-full object-contain",draggable:!1}):o.jsx("div",{className:"flex h-full w-full items-center justify-center text-sm text-slate-300",children:"Waiting for frame…"}):o.jsx("video",{ref:D,muted:h||Ua||gt,playsInline:!0,autoPlay:!0,controls:!1,className:"h-full w-full object-contain"}),o.jsx("audio",{ref:G,autoPlay:!0,hidden:!0}),!Ht&&R?o.jsx(Sj,{mobileHud:Zt,turnSeconds:T,isActiveDriver:O,idleSkipSeconds:L}):null,Ht?null:o.jsx(bj,{frame:p,sensors:vn,label:d,status:dt,audioStatus:jt,levelStatus:Oe,desktopLayout:us,layoutFormat:v,variant:y,driverLabel:b,battery:Mt,showTopDown:Et,mobileHud:Zt,mapPosition:jo,turnTimerText:A,labelScale:C}),Ht?null:o.jsx(wj,{compact:Zt}),!Ht&&fa?o.jsx("div",{className:"pointer-events-none absolute left-1 top-1 z-40 rounded bg-black/80 px-1 py-0.5 text-[0.6rem] text-lime-200",children:`OC vis:${ds?1:0} motors:${bn.length} fill:${Math.round(Sn*100)}%`}):null,Ht?null:o.jsx(jj,{motors:bn,fill:Sn,compact:Zt}),Ht?null:o.jsx(Nj,{battery:Mt,compact:Zt}),!Ht&&zn&&Mt.available?o.jsx("div",{className:"pointer-events-none absolute right-1 top-1/2 flex h-[70%] -translate-y-1/2 flex-col items-center justify-center rounded bg-black/60 px-0.5 pb-1 pt-1",children:o.jsx(Nf,{visual:Mt,orientation:"vertical",variant:"inline",compact:Zt,className:"h-full w-4"})}):null,!Ht&&f?o.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-1/2 -translate-y-1/2",children:o.jsxs("div",{className:`mx-auto w-fit rounded border border-amber-300/80 bg-black/75 text-amber-200 ${Zt?"px-2 py-1 text-[0.6rem]":"px-3 py-1.5 text-sm"}`,children:[o.jsx("div",{className:"text-center",children:f}),o.jsx("div",{className:"pointer-events-auto mt-0",children:o.jsx(Zf,{id:"discord",label:"Join our Discord server while you wait!",url:Mi})})]})}):null]}),!Ht&&!zn&&o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(yj,{sensors:vn}),o.jsx("div",{className:"panel-section space-y-0.5 text-sm",children:o.jsx(Nf,{visual:Mt,compact:Zt})})]})]})}function yj({sensors:a}){const l=[a?.lightBumpLeftSignal,a?.lightBumpFrontLeftSignal,a?.lightBumpCenterLeftSignal,a?.lightBumpCenterRightSignal,a?.lightBumpFrontRightSignal,a?.lightBumpRightSignal],i=l.filter(p=>p!=null).reduce((p,x)=>Math.max(p,x),1200),r=p=>Math.pow(Math.max(0,Math.min(1,(p??0)/i)),.35),f=p=>p==null||p<=0?"hsl(200 60% 18%)":`hsl(${(200+r(p)*360)%360} 100% 60%)`,d=6,h=12;return o.jsx("div",{className:"flex w-full items-center justify-center gap-0.5",children:l.map((p,x)=>{const v=r(p),y=x<d/2?-1:1,b=`${v*100}%`,N=f(p);return o.jsx("div",{className:"relative flex-1 min-w-[0]",style:{height:`${h}px`},children:o.jsx("div",{className:"h-full w-full overflow-hidden bg-slate-800",style:{borderRadius:0},children:o.jsx("div",{className:"h-full",style:{width:b,background:N,float:y===-1?"right":"left"}})})},x)})})}function bj({frame:a,sensors:l,label:i,status:r,audioStatus:f,levelStatus:d,desktopLayout:h=!0,layoutFormat:p="desktop",variant:x="default",driverLabel:v=null,battery:y,showTopDown:b=!1,mobileHud:N=!1,mapPosition:M="top-center",turnTimerText:C=null,labelScale:E=1}){l?.bumpsAndWheelDrops;const[j,R]=m.useState(()=>Date.now());m.useEffect(()=>{const W=setInterval(()=>R(Date.now()),150);return()=>clearInterval(W)},[]),a?.receivedAt&&j-a.receivedAt<200;const A=N,T=p==="mobile-portrait",O=A?"text-[0.45rem]":"text-[0.65rem]",L=A?"px-0.25 py-0.25":"px-1 py-0.5",Z=A?"px-0.25 py-0.25":"px-0.5 py-0.5",D=A?"text-[0.55rem]":"text-[0.8rem]",G=A?"left-0.5 top-0.5":"left-1 top-1",Y=A?"text-[0.5rem]":"text-[0.7rem]",F=A?"px-0.5 py-0.25":"px-1 py-0.5",Q=A?"left-0.5 top-1/2":"left-1 top-1/2",ne="bottom-0.5",ce={transform:`translateX(-50%) scale(${E})`,transformOrigin:"center bottom"},pe="240px",V=T?.3:A?.33:.7,X={width:pe,height:pe,opacity:A?.6:.7,transform:M==="top-center"?`translateX(-50%) scale(${V})`:`scale(${V})`,transformOrigin:M==="bottom-left"?"bottom left":M==="top-center"?"top center":"top right",...M==="bottom-left"?{left:"0.25rem",bottom:"0.25rem"}:M==="top-center"?{left:"50%",top:"0.25rem"}:{right:"0.25rem",top:"0.25rem"}};if(x==="none")return null;if(x==="spectator"){const W=[["Voltage",l?.voltageMv!=null?`${(l.voltageMv/1e3).toFixed(2)} V`:"--"],["Current",l?.currentMa!=null?`${l.currentMa} mA`:"--"],["Charge",l?.batteryChargeMah!=null?`${l.batteryChargeMah}`:"--"],["OI",l?.oiMode?.label||"--"]],re=!!l?.chargingSources?.homeBase,de=l?.chargingState?.label||"",w=!!(de&&de.toLowerCase()!=="not charging"),z=l?.oiMode?.label||"Unknown",P=z.toLowerCase(),ae=P==="full"?"bg-emerald-500/80 text-emerald-50":P==="safe"?"bg-amber-400/80 text-amber-950":P==="passive"?"bg-slate-700/80 text-slate-100":"bg-slate-700/60 text-slate-200",le=re?"bg-emerald-500/80 text-emerald-50":"bg-slate-700/70 text-slate-200",se=w?"bg-emerald-500/80 text-emerald-50":re?"bg-amber-400/80 text-amber-950":"bg-slate-700/70 text-slate-200";return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:[o.jsx("div",{className:`absolute ${G} font-medium text-slate-100 ${O}`,children:o.jsxs("div",{className:"flex flex-col gap-0.5 leading-none",children:[o.jsxs("span",{children:["Status: ",r]}),f?o.jsxs("span",{children:["Audio: ",f]}):null,d?o.jsx("span",{className:"text-cyan-300",children:d}):null]})}),o.jsx("div",{className:`absolute ${Q} flex -translate-y-1/2 flex-col gap-0.5 bg-black/70 text-slate-100 ${O} ${L}`,children:o.jsxs("div",{className:"space-y-0.5 leading-tight",children:[o.jsxs("div",{className:"flex flex-col gap-0.5 text-[0.75rem] font-semibold uppercase tracking-wide",children:[o.jsx("span",{className:`rounded px-1.5 py-0.5 ${le}`,children:re?"Docked":"Undocked"}),o.jsx("span",{className:`rounded px-1.5 py-0.5 ${se}`,children:w?"Charging":"Not charging"}),o.jsxs("span",{className:`rounded px-1.5 py-0.5 ${ae}`,children:["OI: ",z]})]}),W.map(([oe,ve])=>o.jsxs("span",{className:"flex items-center justify-between gap-0.5",children:[o.jsx("span",{className:"text-slate-400",children:oe}),o.jsx("span",{className:"font-semibold text-white",children:ve})]},oe))]})}),o.jsx("div",{className:`absolute ${ne} left-1/2`,style:ce,children:o.jsxs("div",{className:`flex items-center gap-0.5 bg-black/80 text-slate-100 ${Z} ${D}`,children:[o.jsx("span",{className:"font-semibold text-white",children:i||"Unnamed Rover"}),v?o.jsxs("span",{className:"text-slate-300",children:["• ",v]}):null]})})]}),b?o.jsx("div",{className:"pointer-events-none absolute rounded",style:{...X},children:o.jsx(jf,{sensors:l,size:240,overlay:!0})}):null]})}return o.jsxs("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:[o.jsx("div",{className:`absolute ${G} font-medium text-slate-100 ${O}`,children:o.jsxs("div",{className:"flex flex-col gap-0.5 leading-none",children:[o.jsxs("span",{children:["Status: ",r]}),f?o.jsxs("span",{children:["Audio: ",f]}):null,d?o.jsx("span",{className:"text-cyan-300",children:d}):null]})}),C?o.jsx("div",{className:`absolute left-1/2 top-0.5 -translate-x-1/2 rounded bg-black/70 text-slate-100 ${F} ${Y}`,children:C}):null,o.jsx("div",{className:`absolute ${ne} left-1/2`,style:ce,children:o.jsx("div",{className:`flex gap-0.5 bg-black/80 text-slate-100 ${Z} ${D}`,children:o.jsxs("span",{children:['Rover: "',i||"Unnamed Rover",'"']})})}),b&&x!=="spectator"?o.jsx("div",{className:"pointer-events-none absolute rounded",style:{...X},children:o.jsx(jf,{sensors:l,size:240,overlay:!0})}):null]})}function Sj({mobileHud:a=!1,turnSeconds:l=null,isActiveDriver:i=!1,idleSkipSeconds:r=null}){const f=a?"text-3xl":"text-5xl",d=a?"text-xs":"text-sm",h=a?"text-[0.55rem]":"text-[0.75rem]",p=a?"px-4 py-3":"px-6 py-4",x=i&&typeof r=="number";return o.jsx("div",{className:"pointer-events-none absolute inset-0 z-30 flex items-center justify-center bg-black/55",children:o.jsxs("div",{className:`flex flex-col items-center gap-0.5 rounded border border-amber-300/80 bg-black/70 ${p}`,children:[o.jsx("div",{className:`font-semibold text-amber-200 ${f}`,children:"IT IS YOUR TURN!"}),o.jsx("div",{className:`text-amber-200/80 ${d}`,children:"Start driving!"}),x?o.jsxs("div",{className:`text-red-100/90 ${h}`,children:["Idle skip in ",r,"s"]}):null]})})}const Aj={leftWheel:"Left wheel",rightWheel:"Right wheel",mainBrush:"Main brush",sideBrush:"Side brush",limiter:"Overcurrent limit"};function jj({motors:a,fill:l=0,compact:i=!1}){if(!a?.length)return null;const r=a.map(y=>Aj[y]||y),f=i?"w-[12rem] h-[3.5rem]":"w-[20rem] h-[7rem]",d=i?"px-2 py-1":"px-4 py-2",h=i?"text-lg":"text-4xl",p=i?"text-xs":"text-xl",x=Math.max(0,Math.min(1,l)),v=`${Math.round(x*100)}%`;return o.jsx("div",{className:`pointer-events-none absolute flex items-center justify-center bg-red-900/50 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 ${f}`,children:o.jsxs("div",{className:"relative h-full w-full",children:[o.jsx("div",{className:"absolute inset-0 overflow-hidden",children:o.jsx("div",{className:"h-full bg-red-700/60",style:{width:v}})}),o.jsxs("div",{className:`relative z-10 flex h-full w-full flex-col items-center justify-center text-center font-semibold text-white animate-pulse ${h} ${d}`,children:[o.jsx("div",{children:"OVERCURRENT"}),o.jsx("div",{className:`mt-0 font-medium text-white ${p}`,children:r.join(", ")})]})]})})}function Nj({battery:a,compact:l=!1}){if(!a?.available||!a.warnActive&&!a.urgentActive)return null;const i=a.urgentActive?"BATTERY VERY LOW, DOCK THE ROVER AND CHARGE IMMEDIATELY!!":"Battery low! please dock and charge the rover soon.",r=l?"p-2 top-6":"p-4 top-10",f=l?"text-sm":"text-2xl";return o.jsx("div",{className:`pointer-events-none absolute flex items-center justify-center bg-amber-900/60 left-1/2 -translate-x-1/2 ${r}`,children:o.jsx("div",{className:`text-center font-semibold text-white animate-pulse ${f}`,children:o.jsx("div",{children:i})})})}function wj({compact:a=!1}){const{session:l}=Ye(),{sendMessage:i,onInputFocus:r,onInputBlur:f,blurChat:d,registerInputRef:h,setTypingActive:p}=Yf(),{value:x}=it("tts",{engine:"flite",voice:"rms",pitch:50}),[v,y]=m.useState(""),[b,N]=m.useState(!1),M=l?.role!=="spectator",C=l?.role==="spectator",E=l?.assignment?.roverId||null,R=!!m.useMemo(()=>l?.roster?.find(D=>String(D.id)===String(E))||null,[E,l?.roster])?.audio?.ttsEnabled,A=m.useMemo(()=>{if(!R)return null;const D=x?.engine==="espeak"?"espeak":"flite";if(D==="espeak"){let Y=Number.isFinite(x?.pitch)?Math.round(x.pitch):void 0;return typeof Y=="number"&&(Y=Math.max(0,Math.min(99,Y))),{speak:!0,engine:D,pitch:Y}}const G=typeof x?.voice=="string"?x.voice:void 0;return{speak:!0,engine:D,voice:G}},[x?.engine,x?.pitch,x?.voice,R]),T=a?"pointer-events-auto absolute bottom-0.5 right-0.5 flex w-[9rem] max-w-[70vw] items-center gap-0.5 rounded bg-black/70 px-0.4 py-0.2":"pointer-events-auto absolute bottom-1 right-1 flex w-[12rem] max-w-[70vw] items-center gap-0.5 rounded bg-black/70 px-0.5 py-0.25",O=a?"min-w-0 flex-1 bg-transparent text-[0.55rem] text-slate-100 placeholder:text-slate-400 focus:outline-none":"min-w-0 flex-1 bg-transparent text-[0.7rem] text-slate-100 placeholder:text-slate-400 focus:outline-none",L=a?"rounded bg-cyan-500/80 px-0.35 py-0.2 text-[0.55rem] font-semibold text-black disabled:opacity-50":"rounded bg-cyan-500/80 px-0.5 py-0.25 text-[0.7rem] font-semibold text-black disabled:opacity-50";async function Z(D){if(D.preventDefault(),!M)return;const G=v.trim();if(G){N(!0);try{await i(G,A),y(""),d(),p(!1)}catch(Y){alert(Y.message)}finally{N(!1)}}}return C?null:o.jsxs("form",{onSubmit:Z,className:T,children:[o.jsx("input",{className:O,value:v,onChange:D=>{const G=D.target.value;y(G),p(!!G.trim())},onFocus:D=>{r(D),p(!!v.trim())},onBlur:D=>{f(D),p(!1)},onKeyDown:D=>{D.key==="Enter"&&!v.trim()&&(D.preventDefault(),d(),p(!1))},ref:D=>h(D,{target:"hud"}),placeholder:M?"Chat (TTS)":"Spectator",disabled:!M}),o.jsx("button",{type:"submit",disabled:!M||b,className:L,children:"Speak"})]})}function Jf({layoutFormat:a="desktop"}){const{session:l}=Ye(),{state:{song:i,lastControlIntentAt:r},overcurrentLimiter:f}=Lt(),[d,h]=m.useState(()=>Date.now()),[p,x]=m.useState(!1),[v,y]=m.useState(null),b=m.useRef({active:!1,roverId:null});m.useEffect(()=>{if(l?.mode!=="turns")return;const ae=setInterval(()=>h(Date.now()),250);return()=>clearInterval(ae)},[l?.mode]);const N=l?.assignment?.roverId,C=!!(N&&l?.roster?l.roster.find(ae=>String(ae.id)===String(N)):null)?.media?.audioPublishUrl,E=N?l?.turnQueues?.[N]:null,j=l?.socketId||null,R=N?l?.activeDrivers?.[N]:null,A=!!(j&&R===j),T=m.useMemo(()=>{const ae=E?.queue||[];if(!ae.length||!E?.current||ae.length<=1)return null;const le=ae.findIndex(se=>se===E.current);return le===-1?ae[0]||null:ae[(le+1)%ae.length]||null},[E?.queue,E?.current]),O=!!(j&&T===j),L=E?.deadline||null,Z=E?.idleDeadline||null,D=L?L-d:null,G=Z?Z-d:null,Y=l?.mode==="turns"&&O&&D!=null&&D<=5e3&&D>0,F=l?.mode!=="turns"||A||Y,Q=D!=null&&Number.isFinite(D)?Math.max(0,Math.ceil(D/1e3)):null,ne=G!=null&&Number.isFinite(G)?Math.max(0,Math.ceil(G/1e3)):null,ce=A?Q!=null?`${Q}s left`:null:O&&Q!=null?`Your turn in ${Q}s`:null,pe=N?[...F?[{type:"rover",id:N,key:N}]:[],...C?[{type:"rover",id:`${N}-audio`,key:`${N}-audio`}]:[]]:[],V=xi(pe),q=N&&F?V[N]:null,X=N&&C?V[`${N}-audio`]:null,W=Kf(N?[N]:[],{enabled:!!N,version:l?.mode}),re=N&&W[N]||null,de=cs(N),w=N&&l?.roster?l.roster.find(ae=>String(ae.id)===String(N)):null,z=w?.battery??null,P=w?.name||(N?`Rover ${N}`:"");return m.useEffect(()=>{if(l?.mode!=="turns"){x(!1),y(null),b.current={active:!1,roverId:null};return}const ae=b.current,le=A&&!ae.active,se=A&&N&&N!==ae.roverId;le||se?(x(!0),y(Date.now())):!A&&ae.active&&(x(!1),y(null)),b.current={active:A,roverId:N}},[A,N,l?.mode]),m.useEffect(()=>{!p||!v||r>v&&x(!1)},[r,v,p]),o.jsx("section",{className:"panel",children:N?o.jsx(yi,{sessionInfo:q,videoMode:F?"whep":"snapshot",snapshotFeed:re,audioSessionInfo:X,label:P,telemetryFrame:de,batteryConfig:z,layoutFormat:a,overcurrentLimiter:f,songNote:i?.note,qualityNotice:F?null:"Preview feed (low FPS) until your turn.",showTurnCue:p,turnTimerText:ce,turnSeconds:Q,isActiveDriver:A,idleSkipSeconds:ne}):o.jsxs("div",{className:"panel-muted content-center text-center text-sm text-slate-400 aspect-[4/3]",children:[o.jsx("p",{children:"You are not assigned to a rover."}),o.jsx("p",{className:"mt-0",children:o.jsx("a",{href:"/spectate",className:"text-blue-400 underline hover:text-blue-500",children:"Click here to visit the spectator page."})})]})})}function wf({label:a,tone:l="muted"}){const i=l==="success"?"bg-emerald-900 text-emerald-100":l==="warn"?"bg-amber-900 text-amber-100":"bg-slate-800 text-slate-200";return o.jsx("span",{className:`rounded px-1 py-0.5 text-xs font-semibold leading-none ${i}`,children:a})}function xo(a){if(!Number.isFinite(a))return 0;const l=a%360;return l<0?l+360:l}function Ej(a){if(!Array.isArray(a)||a.length<3)return 0;const[l,i,r]=a,f=Math.max(0,Math.min(255,Number(l)))/255,d=Math.max(0,Math.min(255,Number(i)))/255,h=Math.max(0,Math.min(255,Number(r)))/255,p=Math.max(f,d,h),x=Math.min(f,d,h),v=p-x;if(v===0)return 0;let y=0;return p===f?y=(d-h)/v%6:p===d?y=(h-f)/v+2:y=(f-d)/v+4,xo(Math.round(y*60))}function zp(a){const l=xo(a),i=1,r=1-Math.abs(l/60%2-1);let f=0,d=0,h=0;return l<60?(f=i,d=r):l<120?(f=r,d=i):l<180?(d=i,h=r):l<240?(d=r,h=i):l<300?(f=r,h=i):(f=i,h=r),[Math.round(f*255),Math.round(d*255),Math.round(h*255)]}function Up(a){return a?Array.isArray(a.hsColor)?xo(Number(a.hsColor[0])):Array.isArray(a.rgbColor)?Ej(a.rgbColor):0:0}function Cj({entity:a,connected:l,onToggle:i,onSetColor:r}){const f=a.state==="unavailable"||!a.available,d=a.state==="on",h=a.type==="light"&&a.supportsColor,p=f?"warn":d?"success":"muted",x=f?"Unavailable":d?"On":"Off",v=!l||f,y=v||!h,[b,N]=m.useState(()=>Up(a)),M=m.useRef(b),C=m.useRef(!1),E=f?"border-slate-800 bg-slate-900 text-slate-400 cursor-not-allowed":d?"border-emerald-700 bg-emerald-900/80 text-emerald-50 hover:bg-emerald-800":"border-rose-800 bg-rose-900/80 text-rose-50 hover:bg-rose-800";m.useEffect(()=>{if(!h||C.current)return;const L=Up(a);M.current=L,N(L)},[a.rgbColor,a.hsColor,h]);const j=L=>{const Z=xo(Number(L.target.value));M.current=Z,N(Z)},R=()=>{y||!r||r(a.id,zp(M.current))},A=L=>{L.stopPropagation()},O=`rgb(${(h?zp(M.current):[255,255,255]).join(",")})`;return o.jsxs("button",{type:"button",onClick:()=>i(a.id),disabled:v,className:`relative flex min-w-[12rem] flex-[1_1_12rem] items-start justify-between gap-0.5 rounded px-1 py-0.5 text-left transition-colors ${E} disabled:opacity-60 disabled:hover:bg-inherit`,children:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex items-center gap-0.5 text-sm leading-normal",children:[o.jsx("span",{className:"truncate font-semibold text-white",children:a.name||a.id}),h&&o.jsxs(o.Fragment,{children:[o.jsx(wf,{label:x,tone:p}),!l&&o.jsx("span",{className:"text-xs text-amber-200",children:"Offline"})]})]}),h?o.jsx("div",{className:"-mt-0.5 w-full",onClick:A,onPointerDown:L=>{A(L),C.current=!0},onPointerUp:L=>{A(L),C.current=!1,R()},onPointerCancel:L=>{A(L),C.current=!1,R()},onKeyUp:L=>{A(L),R()},onBlur:R,children:o.jsx("div",{className:"relative w-full",children:o.jsx("input",{type:"range",min:"0",max:"360",step:"1",value:b,onChange:j,disabled:y,"aria-label":`Set color for ${a.name||a.id}`,className:"ha-hue-slider w-full"})})}):o.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-slate-400",children:[o.jsx(wf,{label:x,tone:p}),!l&&o.jsx("span",{className:"text-amber-200",children:" · Offline"})]})]}),h&&o.jsx("span",{className:"pointer-events-none absolute right-1 top-1 h-2.5 w-2.5 rounded-full border border-white/60",style:{backgroundColor:O}}),!h&&o.jsx("div",{className:"self-center text-xs font-semibold text-white/90",children:d?"Turn off":"Turn on"})]})}function ux(){const{state:{keymap:a}}=Lt(),{session:l,homeAssistantToggle:i,homeAssistantSetLightColor:r}=Ye(),f=l?.homeAssistant,d=m.useMemo(()=>f?.entities||[],[f?.entities]),h=Rn(a?.homeAssistantOn?.[0]),p=Rn(a?.homeAssistantOff?.[0]);if(!f?.enabled)return o.jsxs("section",{className:"panel-section space-y-0.5 text-sm text-slate-400",children:[o.jsx("p",{className:"text-slate-300",children:"Room Controls"}),o.jsx("p",{className:"text-slate-500",children:"Not configured on the server."})]});if(d.length===0)return o.jsxs("section",{className:"panel-section space-y-0.5 text-sm text-slate-400",children:[o.jsx("p",{className:"text-slate-300",children:"Room Controls"}),o.jsx("p",{className:"text-slate-500",children:"No lights or switches configured."})]});const x=!!f?.connected;return o.jsxs("section",{className:"panel-section space-y-0.5 text-base",children:[o.jsxs("header",{className:"flex items-center justify-between gap-0.5 text-sm text-slate-400",children:[o.jsxs("div",{className:"flex items-center gap-0.5",children:[o.jsx("p",{children:"Room Controls"}),o.jsx("span",{className:"text-xs text-slate-500",children:d.length}),o.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-slate-300 background-black",children:[o.jsxs("span",{className:"flex items-center gap-0.5",children:[o.jsx("span",{children:"On"}),h?o.jsx(Hp,{label:h}):null]}),o.jsxs("span",{className:"flex items-center gap-0.5",children:[o.jsx("span",{children:"Off"}),p?o.jsx(Hp,{label:p}):null]})]})]}),o.jsx(wf,{label:x?"Connected":"Offline",tone:x?"success":"warn"})]}),o.jsx("div",{className:"flex flex-wrap gap-0.5",children:d.map(v=>o.jsx(Cj,{entity:v,connected:x,onToggle:i,onSetColor:r},v.id))})]})}function Hp({label:a}){return a?o.jsx("span",{className:"rounded border border-white/40 px-1 text-[0.7rem] text-white",children:a}):null}function fx(){const{login:a,setRole:l}=Ye(),[i,r]=m.useState(""),[f,d]=m.useState(""),[h,p]=m.useState(!1);async function x(v){v.preventDefault(),p(!0);try{await a(i,f),r(""),d("")}catch(y){alert(y.message)}finally{p(!1)}}return o.jsxs("div",{className:"panel-section space-y-0.5 text-base",children:[o.jsx("p",{className:"text-sm text-slate-400",children:"Admin login"}),o.jsxs("form",{className:"flex flex-col gap-0.5",onSubmit:x,children:[o.jsx("input",{className:"field-input",placeholder:"Username",value:i,onChange:v=>r(v.target.value)}),o.jsx("input",{className:"field-input",placeholder:"Password",type:"password",value:f,onChange:v=>d(v.target.value)}),o.jsx("button",{type:"submit",disabled:h,className:"button-dark w-full disabled:opacity-50",children:h?"Logging in…":"Login"})]})]})}function Vp(...a){return a.filter(Boolean).join(" ")}function qj(a){const l=a?.batteryState?.percentDisplay;return l==null?"--":`${l}%`}function Mj(a){return a?.batteryState?a.batteryState.urgentActive?"text-red-400":a.batteryState.warnActive?"text-amber-300":"text-emerald-300":"text-slate-400"}function Rj({title:a,roster:l=[],emptyText:i="No roster data.",renderActions:r=null}){return o.jsxs("div",{className:"space-y-0.5 text-sm",children:[a&&o.jsx("p",{className:"text-sm text-slate-400",children:a}),l.length===0?o.jsx("p",{className:"text-sm text-slate-500",children:i}):o.jsx("ul",{className:"space-y-0.5 text-sm",children:l.map(f=>o.jsxs("li",{className:Vp("surface flex flex-wrap items-center justify-between gap-0.5",f.locked&&"bg-red-900/40"),children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-slate-200",children:f.name}),o.jsxs("p",{className:"text-xs text-slate-500 flex flex-wrap items-center gap-0.5",children:[o.jsx("span",{children:f.locked?"locked":"free"}),f.lockReason&&o.jsx("span",{className:"rounded bg-black/30 px-1",children:f.lockReason}),o.jsxs("span",{className:Vp("font-semibold",Mj(f)),children:["Battery ",qj(f)]})]})]}),r?r(f):null]},f.id))})]})}const kj=[{key:"open",label:"Open"},{key:"turns",label:"Turns"},{key:"admin",label:"Admin"},{key:"lockdown",label:"Lockdown"}];function Tj(){const{session:a,lockRover:l,setMode:i,requestControl:r,setCommunityGoal:f,setAdminReason:d,rebootRover:h,rebootServer:p,adminLogs:x}=Ye(),v=m.useMemo(()=>a?.roster??[],[a?.roster]),[y,b]=m.useState({}),[N,M]=m.useState({}),[C,E]=m.useState(!1),j=a?.health||null,R=a?.communityGoal?.text||"",A=a?.communityGoal?.updatedAt||null,[T,O]=m.useState(R),L=a?.adminReason?.text||"",Z=a?.adminReason?.updatedAt||null,[D,G]=m.useState(L),Y=a?.role==="admin"||a?.role==="lockdown"||a?.role==="lockdown-admin",F=a?.mode??"open",Q=async(w,z)=>{try{await l(w,z),b(P=>({...P,[w]:z}))}catch(P){alert(P.message)}},ne=async w=>{const z=w.target.value;try{await i(z)}catch(P){alert(P.message)}},ce=async w=>{try{await r(w,{force:!0})}catch(z){alert(z.message)}},pe=async w=>{if(!(!w?.id||!window.confirm(`Reboot rover "${w.name||w.id}" now?`))){M(P=>({...P,[w.id]:!0}));try{await h(w.id)}catch(P){alert(P.message)}finally{M(P=>({...P,[w.id]:!1}))}}},V=async()=>{if(window.confirm("Reboot the server host now? This will disconnect all users.")){E(!0);try{await p()}catch(z){alert(z.message),E(!1)}}},q=async()=>{try{await f(T)}catch(w){alert(w.message)}},X=async()=>{try{await f(null)}catch(w){alert(w.message)}},W=async()=>{try{await d(D)}catch(w){alert(w.message)}},re=async()=>{try{await d(null)}catch(w){alert(w.message)}};m.useEffect(()=>{O(R)},[R]),m.useEffect(()=>{G(L)},[L]);const de=m.useMemo(()=>{const w={};return v.forEach(z=>{w[z.id]=y[z.id]??z.locked}),w},[v,y]);return Y?o.jsxs("section",{className:"panel-section space-y-0.5 text-base",children:[o.jsxs("div",{className:"flex items-center justify-between gap-0.5 text-sm",children:[o.jsx("span",{children:"Admin controls"}),o.jsx("select",{value:F,onChange:ne,className:"field-input text-sm",children:kj.map(w=>o.jsx("option",{value:w.key,children:w.label},w.key))})]}),o.jsx("div",{className:"flex gap-0.5 text-xs",children:o.jsx("button",{type:"button",onClick:V,disabled:C,className:"button-danger disabled:cursor-not-allowed disabled:opacity-60",children:C?"Server rebooting...":"Reboot Server"})}),o.jsxs("div",{className:"space-y-0.5",children:[o.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-400",children:[o.jsx("span",{children:"Community goal"}),A?o.jsxs("span",{children:["Updated ",new Date(A).toLocaleString()]}):null]}),o.jsx("input",{type:"text",value:T,onChange:w=>O(w.target.value),placeholder:"Set a community goal",className:"field-input text-sm"}),o.jsxs("div",{className:"flex gap-0.5 text-xs",children:[o.jsx("button",{type:"button",onClick:q,className:"button-dark",children:"Set goal"}),o.jsx("button",{type:"button",onClick:X,className:"button-danger",children:"Clear"})]})]}),o.jsxs("div",{className:"space-y-0.5",children:[o.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-400",children:[o.jsx("span",{children:"Admin mode reason"}),Z?o.jsxs("span",{children:["Updated ",new Date(Z).toLocaleString()]}):null]}),o.jsx("textarea",{value:D,onChange:w=>G(w.target.value),placeholder:"Set an admin mode reason",className:"field-input text-sm min-h-[3.5rem]"}),o.jsxs("div",{className:"flex gap-0.5 text-xs",children:[o.jsx("button",{type:"button",onClick:W,className:"button-dark",children:"Set reason"}),o.jsx("button",{type:"button",onClick:re,className:"button-danger",children:"Clear"})]})]}),o.jsx(Rj,{roster:v,renderActions:w=>o.jsxs("div",{className:"flex flex-wrap gap-0.5 text-xs",children:[o.jsx("button",{type:"button",onClick:()=>Q(w.id,!de[w.id]),className:"button-dark",children:de[w.id]?"Unlock":"Lock"}),o.jsx("button",{type:"button",onClick:()=>ce(w.id),className:"button-dark",children:"Force"}),o.jsx("button",{type:"button",onClick:()=>pe(w),disabled:!!N[w.id],className:"button-danger disabled:cursor-not-allowed disabled:opacity-60",children:N[w.id]?"Rebooting...":"Reboot"})]})}),o.jsx(_j,{health:j}),o.jsx(Dj,{entries:x})]}):null}function _j({health:a}){if(!a)return null;const l=a.replay||{sources:[],readyCount:0,totalCount:0},i=a.snapshots||{rovers:[],rooms:[]},r=`${l.readyCount}/${l.totalCount} sources ready`,f=i.rovers.filter(h=>h.stale).length,d=i.rooms.filter(h=>h.stale).length;return o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("div",{className:"panel-muted text-xs uppercase",children:"Health"}),o.jsxs("div",{className:"surface space-y-0.5 text-xs text-slate-200",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{children:"Replay segments"}),o.jsx("span",{className:"text-slate-400",children:r})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{children:"Rover snapshots"}),o.jsxs("span",{className:f?"text-amber-300":"text-emerald-300",children:[i.rovers.length-f,"/",i.rovers.length," ok"]})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{children:"Room cameras"}),o.jsxs("span",{className:d?"text-amber-300":"text-emerald-300",children:[i.rooms.length-d,"/",i.rooms.length," ok"]})]})]}),o.jsx("div",{className:"space-y-0.5 text-xs text-slate-300",children:l.sources.map(h=>o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{children:h.label}),o.jsxs("span",{className:h.ready?"text-emerald-300":"text-amber-300",children:[h.recentCount,"/",h.neededCount]})]},`${h.type}:${h.id}`))}),o.jsx("div",{className:"space-y-0.5 text-xs text-slate-300",children:i.rovers.map(h=>o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{children:h.name}),o.jsx("span",{className:h.stale?"text-amber-300":"text-emerald-300",children:h.stale?"stale":"ok"})]},`rover:${h.id}`))}),o.jsx("div",{className:"space-y-0.5 text-xs text-slate-300",children:i.rooms.map(h=>o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{children:h.name}),o.jsx("span",{className:h.stale?"text-amber-300":"text-emerald-300",children:h.error?"error":h.stale?"stale":"ok"})]},`room:${h.id}`))})]})}function Dj({entries:a}){const l=a||[];return o.jsxs("div",{className:"panel-section space-y-0.5 text-base",children:[o.jsxs("div",{className:"flex items-center justify-between text-sm text-slate-400",children:[o.jsx("span",{children:"Admin IP log"}),o.jsx("span",{children:l.length})]}),o.jsx("div",{className:"surface h-64 overflow-y-auto font-mono text-xs",children:l.length===0?o.jsx("p",{children:"No admin log entries yet."}):l.slice().reverse().map(i=>o.jsxs("div",{className:"surface",children:[o.jsx("span",{className:"text-amber-400",children:i.ts?new Date(i.ts).toLocaleTimeString():"--"})," ",i.label&&o.jsxs("span",{className:"text-teal-400",children:["[",i.label,"]"]})," ",o.jsx("span",{className:"text-slate-200",children:i.message})," ",i.ip&&o.jsx("span",{className:"text-cyan-300",children:i.ip})," ",i.meta&&o.jsx("span",{className:"text-slate-500",children:JSON.stringify(i.meta)})]},i.id))}),o.jsx("p",{className:"text-xs text-slate-500",children:"Admin-only log stream; IPs never appear in user data."})]})}const Oj=[{id:"driveForward",label:"Drive Forward",group:"Driving"},{id:"driveBackward",label:"Drive Backward",group:"Driving"},{id:"driveLeft",label:"Turn Left",group:"Driving"},{id:"driveRight",label:"Turn Right",group:"Driving"},{id:"boostModifier",label:"Boost Modifier",group:"Driving"},{id:"slowModifier",label:"Slow Modifier",group:"Driving"},{id:"auxMainForward",label:"Main Brush Forward",group:"Aux Motors"},{id:"auxMainReverse",label:"Main Brush Reverse",group:"Aux Motors"},{id:"auxSideForward",label:"Side Brush Forward",group:"Aux Motors"},{id:"auxSideReverse",label:"Side Brush Reverse",group:"Aux Motors"},{id:"auxVacuumFast",label:"Vacuum Max",group:"Aux Motors"},{id:"auxVacuumSlow",label:"Vacuum Low",group:"Aux Motors"},{id:"auxAllForward",label:"All Aux Forward",group:"Aux Motors"},{id:"cameraUp",label:"Camera Up",group:"Camera"},{id:"cameraDown",label:"Camera Down",group:"Camera"},{id:"nightVisionToggle",label:"Toggle Night Vision",group:"Camera"},{id:"hornHonk",label:"Horn (Hold)",group:"Audio"},{id:"driveMacro",label:"Drive Macro",group:"Macros"},{id:"dockMacro",label:"Dock Macro",group:"Macros"},{id:"chatFocus",label:"Toggle Chat",group:"Chat"},{id:"songNoteUp",label:"Song Note Up",group:"Audio"},{id:"songNoteDown",label:"Song Note Down",group:"Audio"},{id:"homeAssistantOn",label:"Room Controls On (Cycle)",group:"Room Controls"},{id:"homeAssistantOff",label:"Room Controls Off (Cycle)",group:"Room Controls"}];function Bj(a){return a.reduce((l,i)=>((l[i.group]||(l[i.group]=[])).push(i),l),{})}function Lj(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(0,Math.min(500,i)):l}const If=5,bi=500,Si=1,Wf=100;function zj(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(If,Math.min(bi,i)):l}function ao(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(Si,Math.min(Wf,i)):l}function Uj(a){const i=(ao(a,a)-Si)/(Wf-Si),r=bi-i*(bi-If);return Math.round(r)}function Hj(a){const l=zj(a,a),i=(bi-l)/(bi-If),r=Si+i*(Wf-Si);return Math.round(r)}function Vj(a){const[l,i]=m.useState(null);return m.useEffect(()=>{if(!l)return;function r(f){if(f.preventDefault(),f.key==="Escape"){i(null);return}const d=Ei(f.key??"");d&&(a(l,d,f),i(null))}return window.addEventListener("keydown",r,{capture:!0}),()=>window.removeEventListener("keydown",r,{capture:!0})},[l,a]),{active:l,startCapture:i,cancel:()=>i(null)}}function Kr({label:a,description:l,value:i,onChange:r,min:f=0,max:d=500,step:h=5}){return o.jsxs("label",{className:"surface-muted block p-0.5",children:[o.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-300",children:[o.jsx("span",{className:"font-semibold text-slate-100",children:a}),o.jsx("input",{type:"number",min:f,max:d,value:i,onChange:p=>r(p.target.value),className:"w-16 rounded border border-slate-700 bg-slate-900 px-1 py-[2px] text-right text-[0.75rem] font-mono text-slate-100"})]}),l&&o.jsx("p",{className:"text-[0.65rem] text-slate-500",children:l}),o.jsxs("div",{className:"mt-0 flex items-center gap-0.5",children:[o.jsx("input",{type:"range",min:f,max:d,step:h,value:i,onChange:p=>r(p.target.value),className:"h-2 flex-1 accent-emerald-400"}),o.jsx("span",{className:"w-12 text-right text-[0.75rem] font-mono text-slate-400",children:i})]})]})}function Yj(){const{state:{keymap:a},actions:{updateKeyBinding:l,resetKeyBindings:i}}=Lt(),{value:r,save:f}=it("inputs",Mn),d={...Mn.keyboard,...r.keyboard??{}},h=m.useMemo(()=>typeof d.tiltSpeed=="number"?ao(d.tiltSpeed,Mn.keyboard.tiltSpeed):typeof d.tiltIntervalMs=="number"?ao(Hj(d.tiltIntervalMs),Mn.keyboard.tiltSpeed):Mn.keyboard.tiltSpeed,[d.tiltIntervalMs,d.tiltSpeed]),p=m.useMemo(()=>Bj(Oj),[]),{active:x,startCapture:v,cancel:y}=Vj((C,E)=>{l(C,E)}),b=m.useCallback(C=>a?.[C]?.[0]||di[C]?.[0]||"",[a]),N=m.useCallback((C,E)=>{const j=Mn.keyboard,R=Lj(E,j[C]);f(A=>({...A??{},keyboard:{...A?.keyboard??j,[C]:R}}))},[f]),M=m.useCallback(C=>{const E=Mn.keyboard,j=ao(C,E.tiltSpeed),R=Uj(j);f(A=>({...A??{},keyboard:{...A?.keyboard??E,tiltSpeed:j,tiltIntervalMs:R}}))},[f]);return o.jsxs("section",{className:"panel-section space-y-0.5 text-sm",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-xs text-slate-400",children:"Keyboard layout"}),o.jsx("p",{className:"text-[0.7rem] text-slate-500",children:"Per-browser · click to change a binding"})]}),o.jsx("button",{type:"button",onClick:()=>i(),className:"button-dark text-xs",children:"Reset defaults"})]}),o.jsxs("div",{className:"space-y-0.5 surface",children:[o.jsx("p",{className:"text-[0.7rem] text-slate-500",children:"Keyboard speeds"}),o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(Kr,{label:"Base speed",description:"Normal driving speed",value:d.baseSpeed,onChange:C=>N("baseSpeed",C)}),o.jsx(Kr,{label:"Turbo speed",description:"Used when holding the boost modifier",value:d.turboSpeed,onChange:C=>N("turboSpeed",C)}),o.jsx(Kr,{label:"Precision speed",description:"Used when holding the precision modifier",value:d.precisionSpeed,onChange:C=>N("precisionSpeed",C)})]})]}),o.jsxs("div",{className:"space-y-0.5 surface",children:[o.jsx("p",{className:"text-[0.7rem] text-slate-500",children:"Camera tilt"}),o.jsx(Kr,{label:"Tilt speed",description:"Higher = faster when holding tilt keys",value:h,onChange:M,min:1,max:100,step:1})]}),o.jsx("div",{className:"space-y-0.5",children:Object.entries(p).map(([C,E])=>o.jsxs("div",{className:"space-y-0.5 surface",children:[o.jsx("p",{className:"text-[0.75rem] text-slate-400",children:C}),o.jsx("div",{className:"space-y-0.5",children:E.map(j=>{const R=b(j.id),A=x===j.id;return o.jsxs("div",{className:"surface-muted flex items-center justify-between text-xs",children:[o.jsxs("div",{children:[o.jsx("p",{className:"font-semibold text-slate-100",children:j.label}),o.jsx("p",{className:"text-[0.65rem] text-slate-400",children:Rn(R)})]}),o.jsxs("div",{className:"flex items-center gap-0.5",children:[A&&o.jsx("button",{type:"button",onClick:()=>y(),className:"button-danger text-[0.7rem]",children:"Cancel"}),o.jsx("button",{type:"button",onClick:()=>v(j.id),className:`${A?"px-0.5 py-0.5 bg-emerald-500 text-emerald-950 hover:bg-emerald-400":"button-dark"} text-[0.7rem] font-medium transition-colors`,children:A?"Press a key…":"Change"})]})]},j.id)})})]},C))})]})}const sa=new Intl.NumberFormat(void 0,{maximumFractionDigits:2}),$j=[{id:"drive",label:"Drive stick",kind:"axisPair",section:"Driving",invertDefaults:{invertX:!1,invertY:!0}},{id:"cameraTilt",label:"Camera tilt",kind:"axis",section:"Camera",invertDefaults:{invert:!0}},{id:"mainBrush",label:"Main brush",kind:"axis",section:"Brushes",invertDefaults:{invert:!1}},{id:"sideBrush",label:"Side brush",kind:"axis",section:"Brushes",invertDefaults:{invert:!1}},{id:"vacuum",label:"Vacuum",kind:"button",section:"Aux buttons"},{id:"allAux",label:"All aux",kind:"button",section:"Aux buttons"},{id:"mainReverse",label:"Main reverse toggle",kind:"button",section:"Brush toggles"},{id:"sideReverse",label:"Side reverse toggle",kind:"button",section:"Brush toggles"},{id:"driveMacro",label:"Drive macro",kind:"button",section:"Mode macros"},{id:"dockMacro",label:"Dock macro",kind:"button",section:"Mode macros"},{id:"nightVisionToggle",label:"Night vision toggle",kind:"button",section:"Camera"}],Yp=.45,Gj=.6;function ci({label:a,description:l,min:i,max:r,step:f,value:d,onChange:h}){return o.jsxs("label",{className:"surface-muted block p-0.5",children:[o.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-300",children:[o.jsx("span",{className:"font-semibold text-slate-100",children:a}),o.jsx("span",{className:"font-mono text-slate-400",children:sa.format(d)})]}),l&&o.jsx("p",{className:"text-[0.65rem] text-slate-500",children:l}),o.jsx("input",{type:"range",min:i,max:r,step:f,value:d,onChange:p=>h(Number(p.target.value)),className:"mt-0 w-full accent-emerald-400"})]})}function Xj(a){if(!a)return"Unassigned";if(a.kind==="axisPair"){const l=`${a.invertX?"X inv ":""}${a.invertY?"Y inv":""}`.trim();return`Axes ${a.x}/${a.y}${l?` (${l})`:""}`}if(a.kind==="axis")return`Axis ${a.index}${a.invert?" (inv)":""}`;if(a.kind==="button")return`Button ${a.index}`;if(a.kind==="buttonAxis")return`Button ${a.index} (analog)`;if(a.kind==="axisButton"){const l=a.direction<0?"<":">";return`Axis ${a.index} ${l} ${sa.format(a.threshold??.6)}`}return"Unassigned"}function Qj(a){return a.reduce((l,i)=>((l[i.section]||(l[i.section]=[])).push(i),l),{})}function Kj(a,l){if(!a||a.length===0)return null;if(l){const i=a.find(r=>r.signature===l);if(i)return i}return a[0]}function Fj(a){return{axes:Array.from(a.axes??[]),buttons:(a.buttons??[]).map(l=>({pressed:!!l?.pressed,value:typeof l?.value=="number"?l.value:l?.pressed?1:0}))}}function Zj(a,l,i){const r=(a.axes??[]).map((d,h)=>({index:h,delta:Math.abs((d??0)-(l.axes?.[h]??0)),value:d}));if(r.sort((d,h)=>h.delta-d.delta),i.kind==="axisPair"){const d=r.filter(h=>h.delta>Yp).slice(0,2);return d.length<2?null:{kind:"axisPair",x:d[0].index,y:d[1].index,...i.invertDefaults??{}}}const f=r.find(d=>d.delta>Yp);return f?{kind:"axis",index:f.index,...i.invertDefaults??{}}:null}function Jj(a,l,i){const r=a.buttons??[];for(let d=0;d<r.length;d+=1){const h=r[d],p=typeof h?.value=="number"?h.value:h?.pressed?1:0;if(h?.pressed||p>Gj)return i.kind==="axis"?{kind:"buttonAxis",index:d}:{kind:"button",index:d}}const f=a.axes??[];for(let d=0;d<f.length;d+=1){const h=f[d]??0,p=Math.abs(h-(l.axes?.[d]??0));if(Math.abs(h)>.7&&p>.5)return i.kind==="axis"?{kind:"axis",index:d,...i.invertDefaults??{}}:{kind:"axisButton",index:d,direction:h>=0?1:-1,threshold:.6}}return null}function Ij(a,l,i){if(!a)return null;if(i.kind==="axis"||i.kind==="axisPair"){const r=Zj(a,l,i);if(r)return r}return Jj(a,l,i)}function Wj(){const a=RA(),{value:l,save:i}=it("gamepad",La),[r,f]=m.useState(null),d=m.useRef(null),h=m.useMemo(()=>Qj($j),[]),p=m.useMemo(()=>Kj(a.pads,l.activeSignature),[a.pads,l.activeSignature]),x=p?.signature??null,v=m.useMemo(()=>x?l?.profiles?.[x]??l?.defaults?.profile??ia:l?.defaults?.profile??ia,[x,l?.defaults?.profile,l?.profiles]);m.useEffect(()=>{!p||!x||l?.profiles?.[x]||i(j=>{const R=j??La;if(R.profiles?.[x])return R;const A=R?.defaults?.profile??ia,T=Fg(p,A);return{...R,profiles:{...R.profiles??{},[x]:T}}})},[p,x,l?.profiles,i]),m.useEffect(()=>{d.current=null},[r,x]),m.useEffect(()=>{if(!r||!p)return;if(!d.current){d.current=Fj(p);return}const j=Ij(p,d.current,r);j&&(i(R=>{const A=R??La,T=A.profiles?.[x]??A?.defaults?.profile??ia,O={...T,bindings:{...T.bindings??{},[r.id]:{...T.bindings?.[r.id]??{},kind:r.kind,sources:[j]}}};return{...A,profiles:{...A.profiles??{},[x]:O}}}),f(null))},[p,x,r,i]);const y=m.useCallback(j=>{i(R=>({...R??La,activeSignature:j||null}))},[i]),b=m.useCallback(j=>{i(R=>{const A=R??La,T=(x&&A.profiles?.[x])??A?.defaults?.profile??ia,O={...T,calibration:{...T.calibration??{},...j}};return x?{...A,profiles:{...A.profiles??{},[x]:O}}:{...A,defaults:{...A.defaults??{},profile:O}}})},[x,i]),N=m.useCallback((j,R)=>{i(A=>{const T=A??La,O=(x&&T.profiles?.[x])??T?.defaults?.profile??ia,L=R(O.bindings?.[j]??{}),Z={...O,bindings:{...O.bindings??{},[j]:L}};return x?{...T,profiles:{...T.profiles??{},[x]:Z}}:{...T,defaults:{...T.defaults??{},profile:Z}}})},[x,i]),M=m.useCallback(j=>{N(j.id,R=>({...R,sources:[]}))},[N]),C=m.useCallback((j,R)=>{N(j.id,A=>{const T=Array.isArray(A.sources)?[...A.sources]:[];if(!T[0])return A;const O={...T[0]};return R==="invertX"?O.invertX=!O.invertX:R==="invertY"?O.invertY=!O.invertY:O.invert=!O.invert,T[0]=O,{...A,sources:T}})},[N]),E=m.useMemo(()=>p?{outputs:Zg(p,v)}:null,[p,v]);return o.jsxs("section",{className:"panel-section space-y-0.5 text-sm",children:[o.jsx("div",{className:"flex items-center justify-between",children:o.jsxs("div",{children:[o.jsx("p",{className:"text-xs text-slate-400",children:"Controller"}),o.jsx("p",{className:"text-[0.65rem] text-slate-500",children:p?"Move sticks or press buttons to bind":"Connect a controller to configure."}),r&&o.jsxs("p",{className:"mt-0 text-[0.7rem] text-emerald-400",children:["Capturing ",r.label,"…"]})]})}),o.jsxs("div",{className:"space-y-0.5 surface",children:[o.jsx("p",{className:"text-[0.7rem] text-slate-500",children:"Connected controller"}),a.pads.length===0?o.jsx("p",{className:"text-[0.7rem] text-slate-400",children:"No controller detected."}):o.jsxs("div",{className:"flex items-center justify-between gap-0.5 text-xs",children:[o.jsx("select",{value:x??"",onChange:j=>y(j.target.value),className:"flex-1 rounded border border-slate-700 bg-slate-900 px-1 py-[2px] text-[0.75rem] text-slate-100",children:a.pads.map(j=>o.jsx("option",{value:j.signature,children:j.id||"Unknown controller"},j.signature))}),o.jsx("span",{className:"text-[0.7rem] text-slate-400",children:p?.mapping??"unknown"})]})]}),o.jsxs("div",{className:"space-y-0.5 surface",children:[o.jsx("p",{className:"text-[0.7rem] text-slate-500",children:"Calibration"}),o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(ci,{label:"Drive deadzone",description:"Ignore small drive stick drift",min:0,max:.6,step:.01,value:v.calibration?.driveDeadzone??.18,onChange:j=>b({driveDeadzone:j})}),o.jsx(ci,{label:"Camera deadzone",description:"Ignore small camera tilt drift",min:0,max:.4,step:.01,value:v.calibration?.cameraDeadzone??.08,onChange:j=>b({cameraDeadzone:j})}),o.jsx(ci,{label:"Aux deadzone",description:"Ignore small trigger noise",min:0,max:.4,step:.01,value:v.calibration?.auxDeadzone??.05,onChange:j=>b({auxDeadzone:j})}),o.jsx(ci,{label:"Side brush scale",description:"Scale side brush output",min:.3,max:1,step:.05,value:v.calibration?.auxSideScale??.55,onChange:j=>b({auxSideScale:j})}),o.jsxs("label",{className:"surface-muted block p-0.5",children:[o.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-300",children:[o.jsx("span",{className:"font-semibold text-slate-100",children:"Camera mode"}),o.jsxs("select",{value:v.calibration?.cameraMode??"absolute",onChange:j=>b({cameraMode:j.target.value}),className:"rounded border border-slate-700 bg-slate-900 px-1 py-[2px] text-[0.75rem] text-slate-100",children:[o.jsx("option",{value:"absolute",children:"Absolute"}),o.jsx("option",{value:"velocity",children:"Velocity"})]})]}),o.jsx("p",{className:"text-[0.65rem] text-slate-500",children:"Absolute maps stick to angle; velocity moves over time."})]}),o.jsx(ci,{label:"Camera sensitivity",description:"Velocity mode degrees per second",min:10,max:180,step:5,value:v.calibration?.cameraSensitivity??60,onChange:j=>b({cameraSensitivity:j})})]})]}),o.jsx("div",{className:"space-y-0.5",children:Object.entries(h).map(([j,R])=>o.jsxs("div",{className:"space-y-0.5 surface",children:[o.jsx("p",{className:"text-[0.7rem] text-slate-500",children:j}),o.jsx("div",{className:"space-y-0.5",children:R.map(A=>{const O=v.bindings?.[A.id]?.sources?.[0]??null;return o.jsxs("div",{className:"surface-muted flex items-center justify-between text-xs",children:[o.jsxs("div",{children:[o.jsx("p",{className:"font-semibold text-slate-100",children:A.label}),o.jsx("p",{className:"text-[0.65rem] text-slate-400",children:Xj(O)})]}),o.jsxs("div",{className:"flex items-center gap-0.5",children:[A.kind==="axisPair"&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",disabled:!O,onClick:()=>C(A,"invertX"),className:"button-dark text-[0.7rem] font-medium disabled:opacity-50",children:"Invert X"}),o.jsx("button",{type:"button",disabled:!O,onClick:()=>C(A,"invertY"),className:"button-dark text-[0.7rem] font-medium disabled:opacity-50",children:"Invert Y"})]}),A.kind==="axis"&&o.jsx("button",{type:"button",disabled:!O,onClick:()=>C(A),className:"button-dark text-[0.7rem] font-medium disabled:opacity-50",children:"Invert"}),o.jsx("button",{type:"button",onClick:()=>M(A),className:"button-dark text-[0.7rem]",children:"Clear"}),o.jsx("button",{type:"button",onClick:()=>f(A),className:`${r?.id===A.id?"px-0.5 py-0.5 bg-emerald-500 text-emerald-950 hover:bg-emerald-400":"button-dark"} text-[0.7rem] font-medium`,children:r?.id===A.id?"Waiting…":"Capture"})]})]},A.id)})})]},j))}),o.jsxs("div",{className:"space-y-0.5 surface",children:[o.jsx("p",{className:"text-[0.7rem] text-slate-500",children:"Diagnostics"}),p?o.jsxs("div",{className:"space-y-0.5 text-[0.7rem] text-slate-300",children:[o.jsx("p",{className:"text-slate-400",children:"Raw axes"}),o.jsx("div",{className:"grid grid-cols-2 gap-0.5",children:p.axes.map((j,R)=>o.jsxs("span",{className:"font-mono text-slate-300",children:["A",R,": ",sa.format(j)]},`axis-${R}`))}),o.jsx("p",{className:"text-slate-400",children:"Raw buttons"}),o.jsx("div",{className:"grid grid-cols-2 gap-0.5",children:p.buttons.map((j,R)=>o.jsxs("span",{className:"font-mono text-slate-300",children:["B",R,": ",sa.format(j.value)," ",j.pressed?"●":""]},`btn-${R}`))}),E?.outputs&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"text-slate-400",children:"Mapped outputs"}),o.jsxs("div",{className:"grid grid-cols-2 gap-0.5",children:[o.jsxs("span",{className:"font-mono text-slate-300",children:["Drive: ",sa.format(E.outputs.driveVector.x),","," ",sa.format(E.outputs.driveVector.y)]}),o.jsxs("span",{className:"font-mono text-slate-300",children:["Camera: ",sa.format(E.outputs.cameraAxis)]}),o.jsxs("span",{className:"font-mono text-slate-300",children:["Main: ",sa.format(E.outputs.auxAxis.main)]}),o.jsxs("span",{className:"font-mono text-slate-300",children:["Side: ",sa.format(E.outputs.auxAxis.side)]})]})]})]}):o.jsx("p",{className:"text-[0.7rem] text-slate-400",children:"No controller detected."})]})]})}const Pj={drive:"Drive wheels",aux:"Aux motors"};function $p(a){return Number.isFinite(a)?`${Math.round(a*100)}%`:"--"}function e2({value:a,color:l="bg-emerald-500"}){const i=`${Math.round(Math.max(0,Math.min(1,a))*100)}%`;return o.jsx("div",{className:"h-2 w-full overflow-hidden rounded bg-slate-800",children:o.jsx("div",{className:`h-full ${l}`,style:{width:i}})})}function t2(){const{state:{roverId:a},overcurrentLimiter:l}=Lt(),i=m.useMemo(()=>ts.map(r=>r.key),[]);return o.jsxs("section",{className:"panel-section space-y-0.5 text-sm",children:[o.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-400",children:[o.jsx("span",{children:"Overcurrent limiter"}),o.jsx("span",{children:l?.adminImmune?"Admin immune":"Active"})]}),a?o.jsxs("div",{className:"space-y-0.5",children:[i.map(r=>{const f=l?.caps?.[r]?.cap??0,d=l?.overcurrent?.groups?.[r]??!1,h=l?.scales?.perGroup?.[r]??1;return o.jsxs("div",{className:"surface space-y-0.5",children:[o.jsxs("div",{className:"flex items-center justify-between text-xs",children:[o.jsx("span",{className:"text-slate-200",children:Pj[r]||r}),o.jsx("span",{className:d?"text-red-300":"text-slate-400",children:d?"overcurrent":"ok"})]}),o.jsxs("div",{className:"space-y-0.5",children:[o.jsxs("div",{className:"flex items-center justify-between text-[0.7rem] text-slate-400",children:[o.jsx("span",{children:"Cap"}),o.jsx("span",{children:$p(f)})]}),o.jsx(e2,{value:f,color:"bg-amber-500"}),o.jsxs("div",{className:"flex items-center justify-between text-[0.7rem] text-slate-400",children:[o.jsx("span",{children:"Scale"}),o.jsx("span",{children:$p(h)})]})]})]},r)}),o.jsxs("div",{className:"surface text-[0.7rem] text-slate-400",children:[o.jsx("div",{children:`Down rate ${l?.config?.downRatePerSec}/s · Up rate ${l?.config?.upRatePerSec}/s`}),o.jsx("div",{children:`Release delay ${l?.config?.releaseDelaySec}s`}),o.jsx("div",{children:`Output rate ${l?.config?.outputRateMs}ms`})]})]}):o.jsx("p",{className:"text-xs text-slate-500",children:"Assign a rover to view limiter status."})]})}const dx=m.createContext(null);function mx(){const a=m.useContext(dx);if(!a)throw new Error("Tabs components must be used within a <Tabs> provider.");return a}const Gp={primary:{base:"flex-1 px-0.5 py-0.5 text-sm font-medium transition-colors focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-1 focus-visible:outline-slate-500 rounded-md",active:"bg-sky-600 text-white",inactive:"bg-zinc-900 text-slate-300 hover:bg-sky-500 hover:text-white"}},hx="primary";function Pf(...a){return a.filter(Boolean).join(" ")}function ed({children:a,defaultTab:l,currentTab:i,onTabChange:r,variant:f=hx}){const[d,h]=m.useState(l??null),[p,x]=m.useState([]),v=m.useCallback(M=>M?(x(C=>C.includes(M)?C:[...C,M]),()=>x(C=>C.includes(M)?C.filter(E=>E!==M):C)):()=>{},[]),y=i??d??p[0]??null;m.useEffect(()=>{l&&i===void 0&&h(l)},[l,i]);const b=m.useCallback(M=>{M&&(i===void 0&&h(M),r&&r(M))},[i,r]),N=m.useMemo(()=>({activeTab:y,setActiveTab:b,registerTab:v,variant:f}),[y,b,v,f]);return o.jsx(dx.Provider,{value:N,children:a})}function td({children:a,className:l=""}){return o.jsx("div",{className:Pf("flex gap-0.5",l),children:a})}function pn({id:a,children:l,className:i="",disabled:r=!1}){const{activeTab:f,setActiveTab:d,registerTab:h,variant:p}=mx();m.useEffect(()=>h(a),[a,h]);const x=Gp[p]??Gp[hx],v=f===a,y=Pf(x.base,v?x.active:x.inactive,r?"cursor-not-allowed opacity-50":"",i);return o.jsx("button",{type:"button",className:y,onClick:()=>!r&&d(a),"aria-pressed":v,"aria-disabled":r,children:l})}function nd({children:a,className:l=""}){return o.jsx("div",{className:Pf("mt-0 space-y-0.5",l),children:a})}function gn({id:a,children:l,keepMounted:i=!1}){const{activeTab:r}=mx(),f=r===a;return!f&&!i?null:!f&&i?o.jsx("div",{hidden:!0,"aria-hidden":"true",children:l}):o.jsx(o.Fragment,{children:l})}function n2(){const{session:a}=Ye(),l=m.useMemo(()=>JSON.stringify(a??{},null,2),[a]);return o.jsxs("div",{className:"panel-section flex min-h-0 flex-col gap-0.5 text-xs",children:[o.jsx("p",{className:"text-sm text-slate-400",children:"Session snapshot"}),o.jsx("pre",{className:"surface min-h-0 flex-1 overflow-y-auto font-mono text-[0.7rem] text-lime-300",children:l})]})}const Xp=300,Qp=240;function a2(a,l){if(a===void 0)return"undefined";if(a===null)return"null";if(typeof a=="string")return a;if(typeof a=="number"||typeof a=="boolean")return String(a);if(typeof a=="function")return"[Function]";if(a instanceof Error)return`${a.name}: ${a.message}`;if(a instanceof Date)return a.toISOString();if(l||(l=new WeakSet),typeof a=="object"){if(l.has(a))return"[Circular]";l.add(a)}try{return JSON.stringify(a,(i,r)=>typeof r=="function"?"[Function]":r instanceof Error?`${r.name}: ${r.message}`:r,0)}catch{return String(a)}}function l2(a){const i=a.map(r=>a2(r)).join(" ");return i.length>Qp?`${i.slice(0,Qp)}…`:i}function s2(){const a=Dn(),[l,i]=m.useState([]),r=m.useMemo(()=>l.reduce((f,d)=>(d.direction==="in"&&(f.in+=1),d.direction==="out"&&(f.out+=1),f),{in:0,out:0}),[l]);return m.useEffect(()=>{const f=(x,v,y)=>{i(b=>{const N=[...b,{id:`${Date.now()}-${Math.random().toString(16).slice(2)}`,direction:x,event:v,payload:l2(y),timestamp:new Date().toLocaleTimeString()}];return N.length>Xp?N.slice(-Xp):N})},d=(x,...v)=>f("in",x,v),h=(x,...v)=>f("out",x,v);a.onAny(d);let p=null;if(typeof a.onAnyOutgoing=="function")a.onAnyOutgoing(h),p=()=>a.offAnyOutgoing(h);else{const x=a.emit.bind(a);a.emit=(v,...y)=>(h(v,...y),x(v,...y)),p=()=>{a.emit=x}}return()=>{a.offAny(d),p&&p()}},[a]),o.jsxs("section",{className:"panel-section space-y-0.5 text-base",children:[o.jsxs("div",{className:"flex items-center justify-between text-sm text-slate-400",children:[o.jsx("span",{children:"Socket activity"}),o.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-slate-400",children:[o.jsxs("span",{className:"surface-muted",children:["in ",r.in]}),o.jsxs("span",{className:"surface-muted",children:["out ",r.out]}),o.jsx("button",{type:"button",className:"button-dark text-xs",onClick:()=>i([]),children:"Clear"})]})]}),o.jsx("div",{className:"surface h-64 overflow-y-auto font-mono text-xs",children:l.length===0?o.jsx("p",{children:"No socket activity yet."}):l.slice().reverse().map(f=>o.jsxs("div",{className:"surface",children:[o.jsx("span",{className:"text-slate-400",children:f.timestamp})," ",o.jsxs("span",{className:f.direction==="in"?"text-emerald-400":"text-amber-400",children:["[",f.direction.toUpperCase(),"]"]})," ",o.jsx("span",{className:"text-cyan-300",children:f.event})," ",o.jsx("span",{className:"text-slate-200",children:f.payload})]},f.id))}),o.jsx("p",{className:"text-xs text-slate-500",children:"Logs are collected only while this panel is open."})]})}const i2=[{key:"start",label:"Start OI"},{key:"safe",label:"Safe"},{key:"full",label:"Full"},{key:"passive",label:"Passive"},{key:"dock",label:"Dock"}];function px(){const{state:{roverId:a},actions:{sendOiCommand:l,setSensorStream:i}}=Lt(),r=!!a,[f,d]=ox(),h=Dn(),{value:p,save:x}=it("page",{hudMapDesktop:!1,connectionTransport:"websocket"}),{value:v,save:y}=it("audio",qt),b=p?.connectionTransport||"websocket",N=Number.isFinite(v?.masterVolume)?v.masterVolume:qt.masterVolume,M=Number.isFinite(v?.alertVolume)?v.alertVolume:qt.alertVolume,C=Number.isFinite(v?.roverVolume)?v.roverVolume:qt.roverVolume,E=typeof v?.autoLevelEnabled=="boolean"?v.autoLevelEnabled:qt.autoLevelEnabled,j=v?.autoLevelMode==="duck"?"duck":"compressor",R=m.useMemo(()=>[{key:"start",label:"Enable stream",enable:!0},{key:"stop",label:"Disable stream",enable:!1}],[]),A=D=>{a&&i(D)},T=D=>{const G=D.target.value;x(Y=>({...Y??{},connectionTransport:G})),h?.io?.opts&&(h.io.opts.transports=G==="polling"?["polling"]:["websocket","polling"],h.disconnect(),h.connect())},O=D=>G=>{const Y=Number(G.target.value),F=Number.isFinite(Y)?Math.max(0,Math.min(1,Y)):0;y(Q=>({...Q??{},[D]:F}))},L=D=>{const G=!!D.target.checked;y(Y=>({...Y??{},autoLevelEnabled:G}))},Z=D=>{const G=D.target.value==="duck"?"duck":"compressor";y(Y=>({...Y??{},autoLevelMode:G}))};return o.jsxs(ed,{defaultTab:"keybindings",children:[o.jsxs(td,{children:[o.jsx(pn,{id:"keybindings",children:"Keybindings"}),o.jsx(pn,{id:"controller",children:"Controller"}),o.jsx(pn,{id:"page",children:"Page settings"}),o.jsx(pn,{id:"admin",children:"Admin"})]}),o.jsxs(nd,{children:[o.jsx(gn,{id:"keybindings",children:o.jsx("div",{className:"space-y-0.5",children:o.jsx(Yj,{})})}),o.jsx(gn,{id:"controller",children:o.jsx("div",{className:"space-y-0.5",children:o.jsx(Wj,{})})}),o.jsx(gn,{id:"page",children:o.jsxs("div",{className:"space-y-0.5",children:[o.jsxs("section",{className:"panel-section space-y-0.5 text-sm",children:[o.jsx("p",{className:"text-slate-400",children:"HUD"}),o.jsxs("label",{className:"flex items-center gap-0.5 text-slate-200",children:[o.jsx("input",{type:"checkbox",className:"accent-emerald-500",checked:f,onChange:D=>d(D.target.checked)}),o.jsx("span",{children:"Show top-down map in HUD (desktop)"})]}),o.jsx("p",{className:"text-xs text-slate-500",children:"Mobile HUD keeps the map on by default."})]}),o.jsxs("section",{className:"panel-section space-y-0.5 text-sm",children:[o.jsx("p",{className:"text-slate-400",children:"Audio"}),o.jsxs("label",{className:"grid gap-0.5 text-slate-200",children:[o.jsxs("div",{className:"flex items-center justify-between gap-0.5",children:[o.jsx("span",{children:"Master volume"}),o.jsxs("span",{className:"text-xs text-slate-400",children:[Math.round(N*100),"%"]})]}),o.jsx("input",{type:"range",min:"0",max:"1",step:"0.01",value:N,onChange:O("masterVolume"),className:"w-full accent-emerald-500"})]}),o.jsxs("label",{className:"grid gap-0.5 text-slate-200",children:[o.jsxs("div",{className:"flex items-center justify-between gap-0.5",children:[o.jsx("span",{children:"Alert/page sounds"}),o.jsxs("span",{className:"text-xs text-slate-400",children:[Math.round(M*100),"%"]})]}),o.jsx("input",{type:"range",min:"0",max:"1",step:"0.01",value:M,onChange:O("alertVolume"),className:"w-full accent-emerald-500"})]}),o.jsxs("label",{className:"grid gap-0.5 text-slate-200",children:[o.jsxs("div",{className:"flex items-center justify-between gap-0.5",children:[o.jsx("span",{children:"Rover audio"}),o.jsxs("span",{className:"text-xs text-slate-400",children:[Math.round(C*100),"%"]})]}),o.jsx("input",{type:"range",min:"0",max:"1",step:"0.01",value:C,onChange:O("roverVolume"),className:"w-full accent-emerald-500"})]}),o.jsxs("label",{className:"flex items-center justify-between gap-0.5 text-slate-200",children:[o.jsx("span",{children:"Auto-level rover audio"}),o.jsx("input",{type:"checkbox",className:"accent-emerald-500",checked:E,onChange:L})]}),o.jsxs("label",{className:"flex items-center justify-between gap-0.5 text-slate-200",children:[o.jsx("span",{children:"Auto-level mode"}),o.jsxs("select",{value:j,onChange:Z,className:"field-input text-sm",disabled:!E,children:[o.jsx("option",{value:"compressor",children:"Compressor (preferred)"}),o.jsx("option",{value:"duck",children:"Brush/vacuum ducking"})]})]}),o.jsx("p",{className:"text-xs text-slate-500",children:"Compressor evens out incoming audio; ducking lowers volume when cleaning motors are active."})]}),o.jsxs("section",{className:"panel-section space-y-0.5 text-sm",children:[o.jsx("p",{className:"text-slate-400",children:"Connection"}),o.jsxs("label",{className:"flex items-center justify-between gap-0.5 text-slate-200",children:[o.jsx("span",{children:"Transport"}),o.jsxs("select",{value:b,onChange:T,className:"field-input text-sm",children:[o.jsx("option",{value:"websocket",children:"WebSocket"}),o.jsx("option",{value:"polling",children:"Polling"})]})]}),o.jsx("p",{className:"text-xs text-slate-500",children:"Switching reconnects your session."})]})]})}),o.jsx(gn,{id:"admin",children:o.jsxs("div",{className:"space-y-0.5",children:[o.jsxs("section",{className:"panel-section space-y-0.5 text-sm",children:[o.jsx("p",{className:"text-slate-400",children:"Manual OI commands"}),o.jsx("div",{className:"surface flex flex-wrap gap-0.5",children:i2.map(D=>o.jsx("button",{type:"button",onClick:()=>l(D.key),disabled:!r,className:"button-dark text-xs disabled:opacity-30",children:D.label},D.key))})]}),o.jsxs("section",{className:"panel-section space-y-0.5 text-sm",children:[o.jsx("p",{className:"text-slate-400",children:"Sensor stream"}),o.jsx("div",{className:"surface flex gap-0.5",children:R.map(D=>o.jsx("button",{type:"button",onClick:()=>A(D.enable),disabled:!r,className:"flex-1 button-dark text-xs disabled:opacity-30",children:D.label},D.key))}),!r&&o.jsx("p",{className:"text-xs text-slate-500",children:"Assign a rover to toggle streams."})]}),o.jsx(fx,{}),o.jsx(t2,{}),o.jsx(Tj,{}),o.jsx(n2,{}),o.jsx(s2,{})]})})]})]})}const Kp={desktop:{main:[{type:"list",title:"Chat and nicknames",items:["Set a nickname in the user list panel, on the bottom left of the page below the rover video.",{segments:["Toggle chat focus with ",{action:"chatFocus"},". Press ",{action:"chatFocus"}," again to send."]}]},{type:"list",title:"Driving the rover",items:[{segments:['Press the "Start Driving" button onscreen, or press ',{action:"driveMacro"}," on your keyboard to put the rover into driving mode."]},"Refer to the controls for the controls for the rover."]},{type:"list",title:"Docking the rover",items:["Line up the rover to the dock, about a foot away, then:",{segments:['Press the "Dock and Charge" button onscreen, or press ',{action:"dockMacro"}," on your keyboard to start docking."]},"Wait for the rover to confirm it is docked and charging before leaving it unattended."]}],aside:[{type:"keyboard",title:"Keyboard controls",footnote:"Per-browser; adjust bindings and speeds in Settings → Keybindings.",groups:[{id:"movement",title:"Movement",items:[{action:"driveForward",label:"Forward"},{action:"driveBackward",label:"Backward"},{action:"driveLeft",label:"Turn left"},{action:"driveRight",label:"Turn right"},{action:"boostModifier",label:"Boost speed"},{action:"slowModifier",label:"Precision speed"}]},{id:"macros",title:"Rover modes & chat",items:[{action:"driveMacro",label:"Drive macro"},{action:"dockMacro",label:"Dock macro"},{action:"chatFocus",label:"Chat focus"}]},{id:"camera",title:"Camera",items:[{action:"cameraUp",label:"Tilt up"},{action:"cameraDown",label:"Tilt down"},{action:"nightVisionToggle",label:"Toggle night vision"}]},{id:"motors",title:"Rover Aux Motors",items:[{action:"auxMainForward",label:"Main brush forward"},{action:"auxMainReverse",label:"Main brush reverse"},{action:"auxSideForward",label:"Side brush forward"},{action:"auxSideReverse",label:"Side brush reverse"},{action:"auxVacuumFast",label:"Vacuum max"},{action:"auxVacuumSlow",label:"Vacuum low"},{action:"auxAllForward",label:"All motors forward"}]},{id:"audio",title:"Audio / Song",items:[{action:"songNoteUp",label:"Song note up"},{action:"songNoteDown",label:"Song note down"}]},{id:"room-controls",title:"Room Controls",items:[{action:"homeAssistantOn",label:"Next room control on"},{action:"homeAssistantOff",label:"Next room control off (reverse)"}]}]},{type:"gamepad",title:"Gamepad / joystick",items:["Gamepad controls are fully configurable to handle inconsistent browser mappings.","Use Settings → Controller to bind inputs, calibrate deadzones, and view diagnostics.","If inputs behave oddly, the diagnostics panel will show raw axis/button values."]}]},"mobile-portrait":{main:[{type:"list",title:"Chat and nicknames",items:["Set a nickname in the user list panel below.","Tap in the chat box to send messages in the chat."]},{type:"list",title:"Driving the rover",items:[{segments:['Press the "Start Driving" button onscreen to put the rover into driving mode.']},"Look below the rover video. Use the joystick on the right to move the rover, and hold the buttons on the left to run the aux motors."]},{type:"list",title:"Docking the rover",items:["Line up the rover to the dock, about a foot away, then:",{segments:['Press the "Dock and Charge" button onscreen to start docking.']},"Wait for the rover to confirm it is docked and charging before leaving it unattended."]}]},"mobile-landscape":{main:[{type:"list",title:"Chat and nicknames",items:["Scroll down to see more of the page.","Set a nickname in the user list panel below.","Tap in the chat box to send messages in the chat."]},{type:"list",title:"Driving the rover",items:[{segments:['Press the "Start Driving" button, or the "Drive" button to put the rover into driving mode.']},"Use the joystick to the right of the video feed to move the rover, and hold the buttons on the left to run the aux motors."]},{type:"list",title:"Docking the rover",items:["Line up the rover to the dock, about a foot away, then:",{segments:['Press the "Dock and Charge" or the "Dock" button onscreen to start docking.']},"Wait for the rover to confirm it is docked and charging before leaving it unattended."]}]}};function r2(a){return Kp[a]||Kp.desktop}function gx({actionId:a,keymap:l}){const i=l?.[a]?.[0]??"";return o.jsx("span",{className:"rounded border border-slate-600 bg-slate-900/40 px-1 text-[0.7rem] text-slate-200",children:Rn(i)})}function Fp(a,l){return a.map((i,r)=>typeof i=="string"?o.jsx("span",{children:i},`text-${r}`):i?.action?o.jsx(gx,{actionId:i.action,keymap:l},`pill-${i.action}-${r}`):i?.text?o.jsx("span",{children:i.text},`span-${r}`):null)}function vo(a,l,i){if(typeof a=="string")return a;if(Array.isArray(a?.segments))return Fp(a.segments,l);if(a&&typeof a=="object"){if(typeof a.text=="string")return a.text;if(Array.isArray(a))return Fp(a,l)}return String(a??"")}function o2({hero:a,keymap:l}){return a?o.jsxs("div",{className:"surface space-y-0.5 px-0.5 py-0.5",children:[o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-0.5",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-semibold text-white",children:a.title}),a.subtitle&&o.jsx("p",{className:"text-xs text-slate-300",children:a.subtitle})]}),a.chips&&o.jsx("div",{className:"flex flex-wrap gap-0.5 text-[0.7rem] text-slate-200",children:a.chips.map(i=>o.jsx("span",{className:"rounded border border-slate-700 px-1 py-[2px]",children:i},i))})]}),a.bullets&&o.jsx("ul",{className:"space-y-0.5 text-[0.85rem] text-slate-200",children:a.bullets.map((i,r)=>{const f=Array.isArray(i?.segments)?`hero-${r}`:`hero-${r}`;return o.jsx("li",{className:"surface-muted px-0.5 py-0.25",children:vo(i,l)},f)})})]}):null}function c2({block:a,keymap:l}){return o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("p",{className:"text-xs font-semibold text-slate-200",children:a.title}),o.jsx("ul",{className:"space-y-0.5 text-[0.8rem] text-slate-300",children:a.items.map((i,r)=>{const f=`item-${r}`;return o.jsx("li",{className:"surface-muted flex flex-wrap items-center gap-0.5 px-0.5 py-0.25",children:vo(i,l)},f)})})]})}function u2({block:a}){const l=a.tone==="info"?"border-cyan-500/40":"border-slate-700";return o.jsxs("div",{className:`surface space-y-0.5 border ${l} px-0.5 py-0.5`,children:[o.jsx("p",{className:"text-xs font-semibold text-slate-100",children:a.title}),a.body&&o.jsx("ul",{className:"space-y-0.5 text-[0.8rem] text-slate-300",children:a.body.map((i,r)=>o.jsx("li",{className:"surface-muted px-0.5 py-0.25",children:vo(i,{})},`callout-${r}`))})]})}function f2({group:a,keymap:l}){return o.jsxs("div",{className:"space-y-0.5 surface",children:[o.jsx("p",{className:"px-0.5 py-0.25 text-[0.75rem] font-semibold text-slate-200",children:a.title}),o.jsx("div",{className:"space-y-0.5 px-0.5 pb-0.25",children:a.items.map(i=>o.jsxs("div",{className:"surface-muted flex items-center justify-between gap-0.5 px-0.5 py-0.25 text-[0.8rem]",children:[o.jsx("span",{className:"text-slate-200",children:i.label}),o.jsx(gx,{actionId:i.action,keymap:l})]},i.action))})]})}function d2({block:a,keymap:l}){return a?o.jsxs("div",{className:"space-y-0.5",children:[o.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-200",children:[o.jsx("span",{className:"font-semibold",children:a.title}),a.footnote&&o.jsx("span",{className:"text-[0.7rem] text-slate-400",children:a.footnote})]}),o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-0.5",children:a.groups?.map(i=>o.jsx(f2,{group:i,keymap:l},i.id))})]}):null}function m2({block:a}){return a?o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("p",{className:"text-xs font-semibold text-slate-200",children:a.title}),o.jsx("ul",{className:"space-y-0.5 text-[0.8rem] text-slate-300",children:a.items?.map((l,i)=>o.jsx("li",{className:"surface-muted px-0.5 py-0.25",children:vo(l,{})},`gamepad-${i}`))})]}):null}function Zp({block:a,keymap:l}){if(!a)return null;switch(a.type){case"list":return o.jsx(c2,{block:a,keymap:l});case"callout":return o.jsx(u2,{block:a});case"keyboard":return o.jsx(d2,{block:a,keymap:l});case"gamepad":return o.jsx(m2,{block:a});default:return null}}function xx({layout:a,keymap:l}){const i=m.useMemo(()=>r2(a),[a]),r=l||{},f=i.main||[],d=i.aside||[];return o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(o2,{hero:i.hero,keymap:r}),o.jsxs("div",{className:"grid gap-0.5",style:{gridTemplateColumns:"repeat(auto-fit, minmax(360px, 1fr))"},children:[o.jsx("div",{className:"space-y-0.5",children:f.map((h,p)=>o.jsx(Zp,{block:h,keymap:r},h.title||p))}),o.jsx("div",{className:"space-y-0.5",children:d.map((h,p)=>o.jsx(Zp,{block:h,keymap:r},h.title||p))})]})]})}function vx({layout:a,onOpenOverlay:l}){const{state:i}=Lt();return o.jsxs("section",{className:"panel-section space-y-0.5 text-sm",children:[o.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-400",children:[o.jsx("span",{children:"Help"}),o.jsx("button",{type:"button",onClick:l,className:"button-dark px-1 py-0.25 text-[0.75rem]",children:"Open full help"})]}),o.jsx(xx,{layout:a,keymap:i?.keymap||{}})]})}const h2=["kal","rms","slt","ksp","bdl"],p2=Array.from({length:10},(a,l)=>l*10);function yo({hideInput:a=!1,hideSpectatorNotice:l=!1,fillHeight:i=!1,allowSpectatorInput:r=!1}){const{session:f}=Ye(),{messages:d,typing:h,sendMessage:p,registerInputRef:x,onInputFocus:v,onInputBlur:y,blurChat:b,setTypingActive:N}=Yf(),{value:M,save:C}=it("tts",{engine:"flite",voice:"rms",pitch:50}),[E,j]=m.useState(""),[R,A]=m.useState(!1),[T,O]=m.useState(!1),[L,Z]=m.useState(()=>M?.engine||"flite"),[D,G]=m.useState(()=>M?.voice||"rms"),[Y,F]=m.useState(()=>Number.isFinite(M?.pitch)?M.pitch:50),Q=f?.role!=="spectator"||r,ne=m.useRef(null),ce=f?.assignment?.roverId||null,V=!!m.useMemo(()=>f?.roster?.find(w=>String(w.id)===String(ce))||null,[ce,f?.roster])?.audio?.ttsEnabled,q=m.useMemo(()=>d.slice(-200),[d]),X=m.useMemo(()=>h||[],[h]);m.useEffect(()=>{ne.current&&(ne.current.scrollTop=ne.current.scrollHeight)},[q,X]),m.useEffect(()=>{const w=M?.engine||"flite",z=M?.voice||"rms",P=Number.isFinite(M?.pitch)?M.pitch:50;L!==w&&Z(w),D!==z&&G(z),Y!==P&&F(P)},[L,Y,M?.engine,M?.pitch,M?.voice,D]),m.useEffect(()=>{O(!!V)},[V]);const W=m.useMemo(()=>!V||!T?null:L==="espeak"?{speak:!0,engine:L,pitch:Y}:{speak:!0,engine:L,voice:D},[L,Y,T,V,D]);async function re(w){if(w.preventDefault(),!Q||a)return;const P=E.replace(/\\n/g,`
|
||
`).trim();if(P){A(!0);try{await p(P,W),j(""),b(),N(!1)}catch(ae){alert(ae.message)}finally{A(!1)}}}const de=i?"flex-1 min-h-0 overflow-y-auto":"h-48 overflow-y-auto";return o.jsxs("section",{className:`panel-section space-y-0.5 text-base ${i?"flex h-full flex-col overflow-hidden":""}`,children:[o.jsxs("div",{className:`surface overflow-y-auto space-y-0.5 px-0 ${de}`,ref:ne,children:[q.length===0&&X.length===0?o.jsx("p",{className:"text-sm text-slate-500",children:"No messages yet."}):q.map(w=>o.jsx(Ug,{message:w},w.id)),X.map(w=>o.jsx(Hg,{message:w},`typing-${w.typingId||w.id}`))]}),!a&&o.jsxs("form",{className:"flex flex-wrap items-stretch gap-0.5",onSubmit:re,children:[o.jsx("input",{className:"field-input flex-1 min-w-[10rem]",value:E,onChange:w=>{const z=w.target.value;j(z),N(!!z.trim())},onFocus:w=>{v(w),N(!!E.trim())},onBlur:w=>{y(w),N(!1)},onKeyDown:w=>{w.key==="Enter"&&!E.trim()&&(w.preventDefault(),b(),N(!1))},ref:w=>x(w,{target:"panel"}),placeholder:Q?"Type a message…":l?"":"Spectators cannot chat",disabled:!Q}),V&&o.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 basis-full sm:basis-auto",children:[o.jsxs("label",{className:"flex items-center gap-0.5 text-xs text-slate-300",children:[o.jsx("input",{type:"checkbox",checked:T,onChange:w=>O(w.target.checked),className:"accent-cyan-500"}),o.jsx("span",{children:"Speak"})]}),o.jsxs("select",{value:L,onChange:w=>{const z=w.target.value;Z(z),C(P=>({...P||{},engine:z}))},className:"field-input text-xs",children:[o.jsx("option",{value:"flite",children:"flite"}),o.jsx("option",{value:"espeak",children:"espeak"})]}),L==="flite"?o.jsx("select",{value:D,onChange:w=>{const z=w.target.value;G(z),C(P=>({...P||{},voice:z}))},className:"field-input text-xs",children:h2.map(w=>o.jsx("option",{value:w,children:w},w))}):o.jsx("select",{value:Y,onChange:w=>{const z=Number(w.target.value);F(z),C(P=>({...P||{},pitch:z}))},className:"field-input text-xs",children:p2.map(w=>o.jsxs("option",{value:w,children:["pitch ",w]},w))})]}),o.jsx("button",{type:"submit",disabled:!Q||R,className:"button-dark h-full disabled:opacity-50 self-stretch",children:R?"...":"Send"})]})]})}function ad({compact:a=!1}){const{session:l,setNickname:i}=Ye(),{value:r,save:f}=it("profile",{nickname:""}),[d,h]=m.useState(r.nickname||""),[p,x]=m.useState(!1),v=l?.role!=="spectator";m.useEffect(()=>{h(r.nickname||"")},[r.nickname]);async function y(b){if(b.preventDefault(),!v)return;const N=(d||"").trim().slice(0,32);if(N){x(!0);try{await i(N),f({nickname:N})}catch(M){alert(M.message)}finally{x(!1)}}}return o.jsxs("form",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)_auto] items-stretch gap-0.5",onSubmit:y,children:[o.jsx("input",{className:"field-input flex-1 min-w-0",value:d,onChange:b=>h(b.target.value),maxLength:32,placeholder:"Enter a nickname",disabled:!v}),o.jsx("button",{type:"submit",disabled:!v||p,className:"button-dark h-full shrink-0 whitespace-nowrap px-0.5 py-0 disabled:opacity-50",children:p?"Saving…":a?"Set":"Save"})]})}function g2(a){const l=Array.isArray(a?.socials)?a.socials:null;if(l&&l.length)return l;const i=[];return a?.discord?.invite&&i.push({id:"discord",label:"Discord",url:a.discord.invite}),a?.kofi?.link&&i.push({id:"kofi",label:"Ko-fi",url:a.kofi.link}),i}function x2(a){if(!a||typeof a!="object")return null;const l=a.id||a.service||a.key||a.name||null,i=a.label||a.title||a.name||l||"Link",r=a.url||a.link||a.href||null;return r?{id:l,label:i,url:r}:null}function yx({className:a=""}){const{session:l}=Ye(),i=g2(l).map(x2).filter(Boolean).slice(0,4);return i.length?o.jsx("div",{className:`grid grid-cols-2 grid-rows-2 gap-0.5 ${a}`,children:i.map(r=>o.jsx(Zf,{...r},`${r.id||r.label}-${r.url}`))}):null}function v2({compact:a=!1}){return o.jsx("section",{className:"panel-section flex h-full min-h-0 flex-col gap-0.5 text-base",children:o.jsx("div",{className:"surface flex w-full items-center px-0 py-0",children:o.jsx(ad,{compact:a})})})}function y2(){return o.jsx("section",{className:"panel-section flex h-full min-h-0 flex-col gap-0.5 text-base",children:o.jsx(yx,{className:"flex-1 min-h-0"})})}function lf(...a){return a.filter(Boolean).join(" ")}function b2(a){const l=a?.batteryState?.percentDisplay;return l==null?"--":`${l}%`}function S2(a){return a?.batteryState?a.batteryState.urgentActive?"text-red-400":a.batteryState.warnActive?"text-amber-300":"text-emerald-300":"text-slate-400"}function A2(a){switch(a){case"admin":case"lockdown":case"lockdown-admin":return"text-amber-300";case"spectator":return"text-slate-400";default:return"text-sky-300"}}function j2(a,l){if(!a)return"";const i=a.nickname||a.socketId?.slice(0,6)||"unknown";return a.socketId&&a.socketId===l?`${i} (you)`:i}function bo({title:a="Rovers"}){const{session:l,requestControl:i}=Ye(),[r,f]=m.useState({}),[d,h]=m.useState(()=>Date.now()),p=m.useMemo(()=>l?.role&&l.role!=="spectator",[l?.role]),x=l?.roster??[],v=l?.turnQueues??{},y=l?.users??[],b=l?.socketId||null,N=m.useMemo(()=>Object.values(v||{}).some(j=>j?.deadline||j?.idleDeadline),[v]);m.useEffect(()=>{if(!N)return;const j=setInterval(()=>{h(Date.now())},1e3);return()=>clearInterval(j)},[N]);const M=m.useMemo(()=>{const j=new Set(x.map(A=>String(A.id))),R=Object.keys(v||{}).filter(A=>!j.has(String(A))).map(A=>({id:A,name:A,locked:!1,batteryState:null}));return[...x,...R]},[x,v]);async function C(j){if(j){f(R=>({...R,[j]:!0}));try{await i(j)}catch(R){alert(R.message)}finally{f(R=>({...R,[j]:!1}))}}}const E=j=>y.find(R=>R.socketId===j)||{socketId:j,nickname:null,role:null};return o.jsxs("div",{className:"space-y-0.5 text-sm",children:[a&&o.jsx("p",{className:"text-sm text-slate-400",children:a}),M.length===0?o.jsx("p",{className:"text-sm text-slate-500",children:"No rovers registered."}):o.jsx("ul",{className:"space-y-0.5 text-sm",children:M.map(j=>{const R=String(j.id),A=v?.[R]||null,T=A?.queue||[],O=A?.idleDeadline||A?.deadline||null,L=O&&O>d?Math.ceil((O-d)/1e3):O?0:null,Z=A?.current||null,D=Z?T.findIndex(q=>q===Z):-1,G=T.length>1?D>=0?T[(D+1)%T.length]:T[0]:null,Y=!!(b&&Z&&Z===b),F=!!(b&&G&&G===b),Q=L!=null&&(Y||F),ne=!!j.locked,ce=j.lockReason?`locked: ${j.lockReason}`:"locked",pe=ne?ce:r[R]?"...":"request",V=p&&!ne&&!r[R];return o.jsxs("li",{className:lf("surface flex flex-wrap items-start justify-between gap-0.5",V&&"cursor-pointer",ne&&"bg-red-900/40"),onClick:()=>{V&&C(j.id)},children:[o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-0.5",children:[o.jsxs("div",{className:"flex items-center gap-0.5",children:[o.jsx("p",{className:"text-slate-200",children:j.name}),Q?o.jsx("span",{className:"rounded bg-slate-800 px-1 text-[0.7rem] text-slate-200",children:Y?`${L}s left`:`Your turn in ${L}s`}):null]}),o.jsx("span",{className:lf("text-[0.75rem] font-semibold",S2(j)),children:b2(j)})]}),T.length===0?o.jsx("p",{className:"text-[0.7rem] text-slate-500",children:"No queue."}):o.jsx("div",{className:"flex flex-wrap items-center gap-0.5",children:T.map((q,X)=>{const W=E(q),re=q===Z,de=!!(G&&q===G&&!re),w=re?"bg-sky-600 text-white ring-2 ring-amber-300":de?"bg-emerald-700/60 text-emerald-100 ring-1 ring-emerald-300/70":"bg-slate-800 text-slate-200";return o.jsxs("span",{className:`flex items-center gap-0.5 rounded px-1 text-[0.7rem] ${w}`,children:[o.jsx("span",{className:`${A2(W.role)} font-semibold`,children:j2(W,b)}),re&&o.jsx("span",{className:"text-[0.65rem] text-slate-200",children:"now"}),de&&o.jsx("span",{className:"text-[0.65rem] text-emerald-100",children:"next"})]},`${R}-${q}-${X}`)})})]}),p?o.jsx("button",{type:"button",onClick:q=>{q.stopPropagation(),C(j.id)},disabled:r[R]||ne,className:lf("button-dark disabled:opacity-40",ne&&"bg-red-600/70 text-white hover:bg-red-600"),children:pe}):null]},j.id)})})]})}function N2(a){switch(a){case"admin":case"lockdown":case"lockdown-admin":return"text-amber-300";case"spectator":return"text-slate-400";default:return"text-sky-300"}}function w2(a,l){if(!a)return"";const i=a.nickname||a.socketId?.slice(0,6)||"unknown";return a.socketId&&a.socketId===l?`${i} (you)`:i}function co({hideNicknameForm:a=!1,hideHeader:l=!1,className:i="",fillHeight:r=!1,compact:f=!1}){const{session:d,setNickname:h}=Ye(),{value:p}=it("profile",{nickname:""}),x=m.useRef(null),v=Dn(),y=d?.role!=="spectator",b=d?.users??[],N=d?.socketId||null;m.useEffect(()=>{if(!y||!d?.socketId)return;const E=p.nickname||"";if(!E||d.socketId===x.current)return;const j=d.socketId;h(E).then(()=>{x.current=j}).catch(()=>{})},[y,d?.socketId,h,p.nickname]),m.useEffect(()=>{if(!v)return;const E=()=>{if(!y)return;const j=(p.nickname||"").trim();j&&h(j).then(()=>{x.current=d?.socketId||null}).catch(()=>{})};return v.on("connect",E),()=>v.off("connect",E)},[y,h,v,p.nickname,d?.socketId]);const M=m.useMemo(()=>[...b].sort((E,j)=>E.socketId===N?-1:j.socketId===N?1:(E.nickname||"").localeCompare(j.nickname||"")),[N,b]),C=r?"flex-1 min-h-0 overflow-y-auto":f?"h-28 overflow-y-auto":"h-48 overflow-y-auto";return o.jsxs("section",{className:`panel-section space-y-0.5 text-base ${r?"flex h-full min-h-0 flex-col overflow-hidden":""} ${i}`,children:[!a&&o.jsxs("div",{className:"space-y-0.5",children:[o.jsxs("div",{className:"grid gap-0.5 md:grid-cols-[minmax(0,1.4fr)_minmax(0,1fr)]",children:[o.jsx("div",{className:"min-w-0",children:o.jsx("div",{className:"surface flex w-full items-center px-0 py-0",children:o.jsx(ad,{compact:f})})}),o.jsx(yx,{})]}),!y&&o.jsx("p",{className:"text-xs text-slate-500",children:"Spectators cannot set nicknames."})]}),o.jsxs("div",{className:`space-y-0.5 ${r?"flex flex-1 min-h-0 flex-col":""}`,children:[!l&&o.jsxs("div",{className:`flex items-center justify-between text-sm text-slate-400 ${f?"text-xs":""}`,children:[o.jsx("span",{children:"Users"}),o.jsx("span",{className:"text-xs text-slate-500",children:M.length})]}),o.jsx("div",{className:`surface flex flex-wrap content-start items-start gap-0.5 px-0 pb-0 ${C} ${f?"text-[0.8rem]":""}`,children:M.length===0?o.jsx("p",{className:"text-sm text-slate-500",children:"Waiting for users…"}):M.map(E=>o.jsx("span",{className:`rounded bg-slate-800/80 px-1 py-0.25 text-[0.7rem] ${N2(E.role)}`,children:w2(E,N)},E.socketId))})]})]})}function E2(){const{state:{roverId:a}}=Lt(),i=cs(a)?.sensors||{};return o.jsx("section",{className:"panel-section",children:o.jsx("div",{className:"aspect-square w-full",children:o.jsx(jf,{sensors:i})})})}function C2(){const{state:{roverId:a,keymap:l,camera:i,horn:r},pipeline:f,actions:{setServoAngle:d,setNightVision:h,startHorn:p,stopHorn:x}}=Lt(),v=Pg(a),y=v.docked&&!v.driving,b=i?.config,N=!!(a&&i?.enabled&&b),M=!!(a&&f?.nightVision),C=f?.nightVisionState,E=!!(a&&f?.horn),j=r?.overheated,R=typeof b?.minAngle=="number"?b.minAngle:-30,A=typeof b?.maxAngle=="number"?b.maxAngle:30,T=typeof i?.angle=="number"?i.angle:typeof b?.homeAngle=="number"?b.homeAngle:(R+A)/2,O=Rn(l?.nightVisionToggle?.[0]),L=Rn(l?.hornHonk?.[0]),Z=Rn(l?.cameraUp?.[0]),D=Rn(l?.cameraDown?.[0]);return o.jsxs("section",{className:"panel-section grid h-full min-h-0 grid-rows-[minmax(0,1fr)_auto] gap-0.5",children:[o.jsx(ex,{layout:"desktop",expand:!0,driveDockState:v}),y?null:o.jsxs("div",{className:"surface space-y-0.5 p-0 text-sm text-slate-200",children:[M&&o.jsx(tx,{nightVisionOn:C?.nightVisionOn,disabled:!a,onToggle:h,keyLabel:O}),E&&o.jsx(nx,{disabled:!a||j,onStart:p,onStop:x,keyLabel:L,active:r?.active,heat:r?.heat}),N&&o.jsx(ax,{value:T,min:R,max:A,onChange:d,keyDownLabel:D,keyUpLabel:Z,className:"space-y-0.5 px-1 py-1",labelRowClass:"text-xs text-slate-300",labelClass:"",valueClass:"font-mono text-slate-100",sliderClass:"w-full",accentClass:"accent-emerald-400",endpointClass:"text-[0.7rem] text-slate-400"})]})]})}function q2({layout:a,onOpenHelpOverlay:l}){return o.jsx("section",{className:"panel text-base",children:o.jsxs(ed,{defaultTab:"telemetry",children:[o.jsxs(td,{children:[o.jsx(pn,{id:"telemetry",children:"Controls"}),o.jsx(pn,{id:"help",children:"Help"}),o.jsx(pn,{id:"settings",children:"Settings"})]}),o.jsxs(nd,{children:[o.jsx(gn,{id:"telemetry",children:o.jsxs("div",{className:"space-y-0.5",children:[o.jsxs("div",{className:"grid items-stretch gap-0.5 grid-cols-[minmax(0,1.35fr)_minmax(0,0.95fr)]",children:[o.jsx(E2,{}),o.jsx(C2,{})]}),o.jsxs("div",{className:"grid gap-0.5 grid-cols-[minmax(0,1fr)_minmax(0,0.9fr)_minmax(0,0.75fr)]",children:[o.jsx(bo,{}),o.jsx(Uf,{panelId:"replay-sources-desktop",fillHeight:!0}),o.jsx(y2,{})]}),o.jsxs("div",{className:"grid items-stretch gap-0.5 grid-cols-[minmax(0,1.3fr)_minmax(0,0.22fr)] h-[14rem]",children:[o.jsx(yo,{fillHeight:!0}),o.jsxs("div",{className:"grid min-h-0 gap-0.5 grid-rows-[minmax(0,1fr)_auto]",children:[o.jsx(co,{compact:!0,hideNicknameForm:!0,fillHeight:!0}),o.jsx(v2,{compact:!0})]})]}),o.jsx(ux,{}),o.jsx(Xf,{defaultOrientation:"horizontal",panelId:"rightpane-telemetry"})]})}),o.jsx(gn,{id:"help",children:o.jsx(vx,{layout:a,onOpenOverlay:l})}),o.jsx(gn,{id:"settings",children:o.jsx(px,{})})]})]})})}const M2=new Set(["admin","lockdown","lockdown-admin"]),R2=new Set(["lockdown","lockdown-admin"]),k2=new Set(["admin","lockdown"]);function T2(a="admin"){return a==="lockdown"?{title:"Lockdown mode active",description:"Only the server owners can access the interface at this time."}:{title:"Admin mode active"}}function _2(){const{session:a}=Ye(),l=a?.mode,i=a?.role,r=a?.adminReason?.text||"";a?.adminReason?.updatedAt;const f=a?.timezone||"UTC",d=a?.socials?.find(N=>String(N?.id||N?.label||"").toLowerCase()==="discord")?.url||a?.discord?.invite||null,h=k2.has(l),p=l==="lockdown"?R2.has(i):M2.has(i),[x,v]=m.useState(()=>new Date),y=m.useMemo(()=>{try{return new Intl.DateTimeFormat("en-US",{timeZone:f,hour:"numeric",minute:"2-digit",second:"2-digit"}).format(x)}catch{return x.toLocaleTimeString()}},[x,f]);if(m.useEffect(()=>{const N=setInterval(()=>v(new Date),1e3);return()=>clearInterval(N)},[]),!h||p)return null;const b=T2(l);return o.jsx("div",{className:"pointer-events-auto fixed inset-0 z-50 flex items-center justify-center bg-black/85 px-0.5 py-0.5",children:o.jsxs("div",{className:"surface w-full max-w-md space-y-0.5 text-slate-100 shadow-2xl",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("p",{className:"text-lg font-semibold",children:b.title}),o.jsx("p",{className:"text-sm text-slate-300",children:b.description})]}),o.jsxs("div",{className:"surface-muted space-y-0.5",children:[o.jsx("p",{className:"text-[0.7rem] tracking-wide text-slate-400",children:"Reason for locking:"}),o.jsx("p",{className:"text-lg font-semibold text-slate-100",children:r||"No reason set."}),o.jsxs("p",{className:"text-center text-sm text-slate-300",children:["Server time: ",y]})]}),o.jsx("div",{className:"surface-muted",children:o.jsx(fx,{})}),o.jsx("div",{className:"w-full justify-center items-center",children:o.jsx(Zf,{id:"discord",label:"Join our Discord server for updates!",url:d})}),"You can still use the chat while the server is locked:",o.jsxs("div",{className:"max-h-80 overflow-y-auto",children:[o.jsx(yo,{}),o.jsx(ad,{})]})]})})}const D2="/assets/turn_alert-DVO8EZJa.mp3";function O2(a,l=1){const i=m.useRef(null);return m.useEffect(()=>{i.current=new Audio(a),i.current.volume=l,i.current.load()},[a,l]),()=>{i.current&&(i.current.volume=l,i.current.currentTime=0,i.current.play().catch(()=>{}))}}function B2(){const{session:a,pushAlert:l}=Ye(),{value:i}=it("audio",qt),r=Number.isFinite(i?.masterVolume)?i.masterVolume:qt.masterVolume,f=Number.isFinite(i?.alertVolume)?i.alertVolume:qt.alertVolume,d=Math.max(0,Math.min(1,r*f)),h=O2(D2,d),p=m.useRef(new Set),x=m.useMemo(()=>a?.turnQueues||{},[a?.turnQueues]),v=a?.socketId||null;return m.useEffect(()=>{if(!v)return;const y=[];Object.entries(x).forEach(([b,N])=>{!N||!N.current||N.current!==v||p.current.has(b)||(y.push(b),p.current.add(b))}),Object.keys(x).forEach(b=>{(!x[b]||x[b].current!==v)&&p.current.delete(b)}),y.length!==0&&(y.forEach(b=>{const N=a?.roster?.find(M=>String(M.id)===String(b))?.name||b;l({title:"Your turn!",message:`You now control ${N}.`,color:"#ff5722"})}),h())},[x,h,l,a?.roster,v]),null}function L2({visible:a,mode:l,onEnterFullscreen:i,onDismiss:r}){if(!a)return null;const f=l==="pwa-hint";return o.jsx("div",{className:"fixed inset-0 z-40 flex items-end justify-center p-2 pointer-events-none sm:items-center",children:o.jsx("div",{className:"pointer-events-auto w-full max-w-sm rounded-lg border border-cyan-500/40 bg-zinc-950/95 shadow-xl",children:o.jsxs("div",{className:"space-y-0.5 p-4 text-sm text-slate-100",children:[o.jsx("h2",{className:"text-base font-semibold text-white",children:"Better in fullscreen"}),f?o.jsxs("p",{className:"text-slate-300",children:["For fullscreen on iOS, open Safari's share menu and pick ",o.jsx("strong",{children:"Add to Home Screen"}),". Launching from the home screen removes the browser chrome."]}):o.jsx("p",{className:"text-slate-300",children:"Enable fullscreen to free up more space for the video feed and controls. You can exit fullscreen at any time via the system back or home gesture."}),o.jsxs("div",{className:"flex justify-end gap-0.5 pt-1 text-sm",children:[o.jsx("button",{type:"button",className:"rounded border border-slate-600 px-3 py-1 text-slate-200",onClick:r,children:f?"Got it":"Not now"}),!f&&o.jsx("button",{type:"button",className:"rounded bg-cyan-500 px-3 py-1 font-semibold text-black hover:bg-cyan-400",onClick:i,children:"Enter fullscreen"})]})]})})})}const bx="fullscreenPromptDismissed",z2=new Set(["mobile-portrait","mobile-landscape"]),Sx=()=>{if(typeof window>"u")return null;try{return window.sessionStorage}catch{return null}},U2=()=>{const a=Sx();if(!a)return!1;try{return a.getItem(bx)==="1"}catch{return!1}},Jp=()=>{const a=Sx();if(a)try{a.setItem(bx,"1")}catch{}},H2=()=>{if(typeof navigator>"u")return!1;const a=navigator.userAgent||navigator.platform||"";return/iphone|ipad|ipod/i.test(a)},V2=()=>{if(typeof document>"u")return!1;const a=document;return!!(a.fullscreenEnabled||a.webkitFullscreenEnabled||a.mozFullScreenEnabled||a.msFullscreenEnabled)};function Y2(a){const l=z2.has(a),[i,r]=m.useState(!1),[f,d]=m.useState("native"),h=m.useMemo(()=>H2(),[]),p=m.useCallback(()=>{if(!l){r(!1);return}if(U2()){r(!1);return}if(h){d("pwa-hint"),r(!0);return}if(!V2()){r(!1);return}if(typeof document<"u"&&document.fullscreenElement){r(!1);return}d("native"),r(!0)},[h,l]);m.useEffect(()=>{p()},[p]),m.useEffect(()=>{if(typeof document>"u")return;const y=()=>{if(document.fullscreenElement){r(!1);return}p()};return document.addEventListener("fullscreenchange",y),document.addEventListener("webkitfullscreenchange",y),()=>{document.removeEventListener("fullscreenchange",y),document.removeEventListener("webkitfullscreenchange",y)}},[p]);const x=m.useCallback(()=>{Jp(),r(!1)},[]),v=m.useCallback(async()=>{if(!l||h||typeof document>"u")return!1;const y=document.documentElement;if(!y)return!1;const b=y.requestFullscreen||y.webkitRequestFullscreen||y.mozRequestFullScreen||y.msRequestFullscreen;if(!b)return!1;try{const N=b.call(y);return N&&typeof N.then=="function"&&await N,Jp(),r(!1),!0}catch(N){return console.warn("Failed to enter fullscreen",N),!1}},[h,l]);return m.useEffect(()=>{l||r(!1)},[l]),{visible:i,mode:f,enterFullscreen:v,dismiss:x}}function $2({visible:a,layout:l,onClose:i,showOnLoad:r,onToggleShowOnLoad:f}){if(!a)return null;const{state:d}=Lt(),h=p=>{const x=!p.target.checked;f?.(x)};return o.jsx("div",{className:"fixed inset-0 z-30 flex items-center justify-center bg-black/80 px-0.5 py-0.5",children:o.jsxs("div",{className:"pointer-events-auto surface w-full max-w-4xl max-h-[90vh] overflow-hidden shadow-2xl",children:[o.jsxs("div",{className:"flex items-center justify-between border-b border-slate-700 px-0.5 py-0.25 text-sm text-slate-200",children:[o.jsx("span",{className:"font-semibold",children:"Help & controls"}),o.jsxs("div",{className:"flex items-center gap-0.5 text-[0.8rem] text-slate-300",children:[o.jsxs("label",{className:"flex items-center gap-0.5",children:[o.jsx("input",{type:"checkbox",checked:!r,onChange:h,className:"accent-cyan-500"}),o.jsx("span",{children:"Don't show again"})]}),o.jsx("button",{type:"button",onClick:i,className:"button-dark px-2 py-0.25 text-[0.8rem]",children:"Close"})]})]}),o.jsx("div",{className:"max-h-[85vh] overflow-y-auto p-0.5",children:o.jsx(xx,{layout:l,keymap:d?.keymap||{}})})]})})}const G2=`aroma
|
||
bagel
|
||
batter
|
||
beans
|
||
beer
|
||
biscuit
|
||
bread
|
||
broth
|
||
burger
|
||
burrito
|
||
butter
|
||
cake
|
||
candy
|
||
caramel
|
||
caviar
|
||
cheese
|
||
chili
|
||
chimichanga
|
||
chocolate
|
||
cider
|
||
cobbler
|
||
cocoa
|
||
coffee
|
||
cookie
|
||
cream
|
||
croissant
|
||
crumble
|
||
cuisine
|
||
curd
|
||
dessert
|
||
dish
|
||
drink
|
||
eggs
|
||
empanada
|
||
enchilada
|
||
entree
|
||
filet
|
||
fish
|
||
flour
|
||
foie gras
|
||
food
|
||
glaze
|
||
grill
|
||
hamburger
|
||
ice
|
||
juice
|
||
ketchup
|
||
kitchen
|
||
lard
|
||
liquor
|
||
margarine
|
||
marinade
|
||
mayo
|
||
mayonnaise
|
||
meat
|
||
milk
|
||
mousse
|
||
muffin
|
||
mushroom
|
||
noodle
|
||
nut
|
||
oil
|
||
olive
|
||
omelette
|
||
pan
|
||
pasta
|
||
paste
|
||
pastry
|
||
pie
|
||
pizza
|
||
plate
|
||
pot
|
||
poutine
|
||
pudding
|
||
queso
|
||
raclette
|
||
recipe
|
||
rice
|
||
salad
|
||
salsa
|
||
sandwich
|
||
sauce
|
||
seasoning
|
||
skillet
|
||
soda
|
||
sopapillas
|
||
soup
|
||
soy
|
||
spice
|
||
steak
|
||
stew
|
||
syrup
|
||
taco
|
||
taquito
|
||
tartar
|
||
taste
|
||
tea
|
||
toast
|
||
tostada
|
||
vinegar
|
||
waffle
|
||
water
|
||
wheat
|
||
wine
|
||
wok
|
||
yeast
|
||
yogurt
|
||
`;function X2(a){return a?a.charAt(0).toUpperCase()+a.slice(1):""}function Q2(){const a=String(G2).split(/\r?\n/).map(i=>i.trim()).filter(Boolean);return a.length?(a[Math.floor(Math.random()*a.length)]||"").trim():""}function ld(){const{setNickname:a}=Ye(),{value:l,status:i,save:r}=it("profile",{nickname:""}),f=m.useRef(!1);m.useEffect(()=>{if(i!=="ready"||f.current||(l.nickname||"").trim())return;f.current=!0;const h=X2(Q2()).slice(0,32);if(!h)return;(async()=>{try{await a(h)}catch{}finally{r({nickname:h})}})()},[r,a,i,l.nickname])}const sf=1e4,rf=28,K2=14;function uo({layout:a="desktop",className:l="",dismissable:i=!0}){const{session:r}=Ye(),f=r?.communityGoal?.text?String(r.communityGoal.text).trim():"",d=a==="mobile-portrait"||a==="mobile-landscape"||a==="mobile",[h,p]=m.useState(!1),[x,v]=m.useState(rf),[y,b]=m.useState(0),N=m.useRef(null),M=m.useRef(null),C=m.useRef(null);m.useEffect(()=>{if(!f){p(!1);return}if(p(!0),!d||!i)return;const A=Date.now();b(sf);const T=setTimeout(()=>p(!1),sf),O=setInterval(()=>{const L=Date.now()-A;b(Math.max(0,sf-L))},250);return()=>{clearTimeout(T),clearInterval(O)}},[f,d]),m.useEffect(()=>{if(!f)return;v(rf);let A=0;const T=()=>{const L=C.current,Z=M.current;if(!L||!Z)return;const D=L.clientWidth;if(!D)return;const G=Z.scrollWidth;if(!G)return;const Y=Math.min(1,D/G),F=Math.max(K2,Math.floor(rf*Y));v(F)};A=window.requestAnimationFrame(T);const O=new ResizeObserver(()=>{window.cancelAnimationFrame(A),A=window.requestAnimationFrame(T)});return N.current&&O.observe(N.current),()=>{window.cancelAnimationFrame(A),O.disconnect()}},[f]);const E=m.useMemo(()=>["panel-section flex w-full items-center justify-center",d?"rounded-none":"rounded","px-1 py-1 text-center font-semibold tracking-tight",l].filter(Boolean).join(" "),[l,d]);if(!f||!h)return null;const j=d?Math.ceil(y/1e3):null,R=i?{onClick:()=>p(!1),role:"button",tabIndex:0}:{};return o.jsx("div",{ref:N,className:E,style:{fontSize:`${x}px`,lineHeight:1.1},...R,children:o.jsxs("span",{className:"flex w-full items-stretch gap-0.5 whitespace-nowrap rounded-md",children:[o.jsxs("span",{className:"flex flex-col justify-center border-r border-slate-700/60 px-0.5 text-[0.55em] font-semibold leading-tight text-slate-400",children:[o.jsx("span",{children:"Community"}),o.jsx("span",{children:"Goal"})]}),o.jsx("span",{ref:C,className:"flex-1 overflow-hidden text-slate-100",children:o.jsx("span",{ref:M,className:"block",children:f})}),d?o.jsxs("span",{className:"flex items-center border-l border-slate-700/60 px-0.5 text-[0.55em] font-semibold uppercase tracking-wide text-slate-400",children:[j,"s"]}):null]})})}function F2(){const[a,l]=m.useState(()=>typeof window>"u"||window.innerWidth>=1024?"desktop":window.innerWidth>window.innerHeight?"mobile-landscape":"mobile-portrait");return m.useEffect(()=>{function i(){if(typeof window>"u")return;const{innerWidth:r,innerHeight:f}=window;r>=1024?l("desktop"):r>f?l("mobile-landscape"):l("mobile-portrait")}return i(),window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[]),a}function Z2({layout:a,onOpenHelpOverlay:l}){return o.jsxs("div",{className:"flex h-full gap-0.5 overflow-hidden",children:[o.jsxs("div",{className:"flex min-w-0 flex-[1.22] flex-col gap-0.5 overflow-y-auto pr-0",children:[o.jsx(Jf,{}),o.jsx(yS,{}),o.jsx(Qf,{})]}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5 overflow-y-auto",children:[o.jsx(uo,{layout:a}),o.jsx(q2,{layout:a,onOpenHelpOverlay:l})]})]})}function Ax({layout:a,onOpenHelpOverlay:l,roomPanelId:i,showTelemetry:r=!0}){return o.jsx("section",{className:"panel text-base",children:o.jsxs(ed,{defaultTab:"chat",children:[o.jsxs(td,{children:[o.jsx(pn,{id:"chat",children:"Chat"}),o.jsx(pn,{id:"roomcontrols",children:"Room Controls"}),o.jsx(pn,{id:"help",children:"Help"}),o.jsx(pn,{id:"settings",children:"Settings"})]}),o.jsxs(nd,{children:[o.jsx(gn,{id:"chat",children:o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(yo,{}),o.jsx(co,{})]})}),o.jsx(gn,{id:"roomcontrols",children:o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(ux,{}),o.jsx(Xf,{panelId:i})]})}),o.jsx(gn,{id:"help",children:o.jsx(vx,{layout:a,onOpenOverlay:l})}),o.jsx(gn,{id:"settings",children:o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(px,{}),o.jsx(Qf,{})]})})]})]})})}function J2({onOpenHelpOverlay:a}){return o.jsxs("div",{className:"flex flex-col gap-0.5",children:[o.jsx(Jf,{layoutFormat:"mobile-portrait"}),o.jsx(QA,{}),o.jsxs("div",{className:"grid gap-0.5 grid-cols-[minmax(0,1fr)_minmax(0,1.4fr)]",children:[o.jsx(Uf,{panelId:"replay-sources-mobile-portrait"}),o.jsx(bo,{})]}),o.jsx(Ax,{layout:"mobile-portrait",onOpenHelpOverlay:a,roomPanelId:"mobile-portrait-room"})]})}function I2({onOpenHelpOverlay:a}){const l="self-start h-[min(100svh,32rem)]";return o.jsxs("div",{className:"flex flex-col gap-0.5",children:[o.jsxs("section",{className:"grid min-h-screen grid-cols-[minmax(0,0.7fr)_minmax(0,2.1fr)_minmax(0,0.7fr)] gap-0.5",children:[o.jsx(lx,{layout:"landscape",className:l}),o.jsxs("div",{children:[o.jsx(Jf,{layoutFormat:"mobile-landscape"}),o.jsxs("div",{className:"grid gap-0.5 grid-cols-[minmax(0,1fr)_minmax(0,1.4fr)]",children:[o.jsx(Uf,{panelId:"replay-sources-mobile-landscape"}),o.jsx(bo,{})]})]}),o.jsx(sx,{layout:"landscape",className:l})]}),o.jsx("div",{className:"flex flex-col gap-0.5 pb-0",children:o.jsx(Ax,{layout:"mobile-landscape",onOpenHelpOverlay:a,roomPanelId:"mobile-landscape-room",showTelemetry:!1})})]})}function W2(){const a=F2(),l=a==="desktop",i=Y2(a);return o.jsx("div",{className:`bg-black text-slate-100 ${l?"h-screen overflow-hidden":"min-h-screen"}`,children:o.jsx(P2,{layout:a,isDesktop:l,fullscreen:i})})}function P2({layout:a,isDesktop:l,fullscreen:i}){ld();const{visible:r,mode:f,enterFullscreen:d,dismiss:h}=i,{value:p,status:x,save:v}=it("help",{showOnLoad:!0}),[y,b]=m.useState(!1);m.useEffect(()=>{x==="ready"&&b(p?.showOnLoad!==!1)},[x,p?.showOnLoad]);const N=m.useCallback(()=>b(!0),[]),M=m.useCallback(()=>b(!1),[]),C=m.useCallback(j=>{const R=!!j;v(A=>({...A??{},showOnLoad:R})),R||b(!1)},[v]),E=m.useMemo(()=>l?o.jsx(Z2,{layout:a,onOpenHelpOverlay:N}):a==="mobile-landscape"?o.jsx(I2,{onOpenHelpOverlay:N}):o.jsx(J2,{onOpenHelpOverlay:N}),[l,a,N]);return o.jsxs(cA,{children:[o.jsx(bA,{}),o.jsx(BA,{}),o.jsxs("main",{className:`flex w-full flex-col gap-0.5 text-base ${l?"h-full overflow-hidden":""}`,children:[l?null:o.jsx(uo,{layout:a}),E]}),o.jsx(Hf,{}),o.jsx(B2,{}),o.jsx(_2,{}),o.jsx($2,{visible:y,layout:a,onClose:M,showOnLoad:p?.showOnLoad!==!1,onToggleShowOnLoad:C}),o.jsx(L2,{visible:r,mode:f,onEnterFullscreen:d,onDismiss:h})]})}function jx(){const{session:a,setRole:l,subscribeAll:i,connected:r}=Ye(),[f,d]=m.useState(!1);return m.useEffect(()=>{let h=!1;async function p(){if(a?.mode==="lockdown"){d(!1);return}try{a?.role!=="spectator"&&await l("spectator"),await i(),h||d(!0)}catch(x){console.error("Failed to enter spectator mode",x),h||d(!1)}}return p(),()=>{h=!0}},[r,a?.mode,a?.role,l,i]),f}function eN(){const[a,l]=m.useState(()=>typeof window>"u"?!1:window.matchMedia("(max-aspect-ratio: 4/3)").matches);return m.useEffect(()=>{if(typeof window>"u")return;const i=window.matchMedia("(max-aspect-ratio: 4/3)"),r=f=>l(f.matches);return i.addEventListener?i.addEventListener("change",r):i.addListener(r),()=>{i.removeEventListener?i.removeEventListener("change",r):i.removeListener(r)}},[]),a}function tN({roverId:a,session:l}){const i=l?.activeDrivers?.[a]||null,f=(l?.users||[]).find(x=>x.socketId===i)?.nickname||(i?i.slice(0,6):"No driver"),d=l?.mode,h=l?.turnQueues?.[a];return d==="turns"&&h?.current?`${f} (turns)`:f}function nN({rover:a,frame:l,sessionInfo:i,videoMode:r,snapshotFeed:f,audioInfo:d,session:h}){const p=tN({roverId:a.id,session:h});return o.jsx("article",{className:"min-h-[16rem] rounded bg-zinc-900 p-0 sm:min-h-[18rem]",children:o.jsx("div",{className:"min-h-0 overflow-hidden rounded bg-black/20",children:o.jsx(yi,{sessionInfo:i,videoMode:r,snapshotFeed:f,audioSessionInfo:d,label:a.name,telemetryFrame:l,batteryConfig:a.battery,hudVariant:"spectator",driverLabel:p,hudForceMap:!0,hudMapPosition:"top-center"})})})}function aN({roster:a,frames:l,videoSources:i,snapshotFeeds:r,audioSources:f,session:d,canSpectateVideo:h}){return a.length===0?o.jsx("p",{className:"col-span-full text-slate-400",children:"No rovers registered."}):o.jsx("section",{className:"grid grid-cols-1 gap-0.5 md:grid-cols-2",children:a.map(p=>o.jsx(nN,{rover:p,frame:l[p.id],sessionInfo:h&&i[p.id]||null,videoMode:h?"whep":"snapshot",snapshotFeed:h?null:r[p.id],audioInfo:f[`${p.id}-audio`],session:d,showHudMap:!0,hudMapPosition:"bottom-left"},p.id))})}function lN(){return o.jsx("section",{className:"min-h-0",children:o.jsx("div",{className:"surface min-h-[14rem] overflow-hidden",children:o.jsx(Xf,{defaultOrientation:"horizontal",hideLayoutToggle:!0,hideHeader:!0,panelId:"spectator-secondary"})})})}function sN({className:a=""}){return o.jsx("div",{className:`panel ${a}`,children:o.jsx(Qf,{})})}function iN(){const{session:a}=Ye(),l=a?.mode==="lockdown",i=!!a?.isLocalNetwork;ld(),jx();const r=eN(),f=zf(),d=a?.roster??[],h=Kf(d.map(j=>j.id),{enabled:!l&&!i,version:a?.mode}),p=i?d.map(j=>({type:"rover",id:j.id,key:j.id})):[],x=xi(p,{enabled:!l&&i,version:a?.mode}),v=d.flatMap(j=>j.media?.audioPublishUrl?[{type:"rover",id:`${j.id}-audio`,key:`${j.id}-audio`}]:[]),y=xi(v,{enabled:!l,version:a?.mode});if(l)return o.jsx("div",{className:"flex min-h-screen items-center justify-center bg-black text-slate-200",children:o.jsxs("div",{className:"surface max-w-md space-y-0.5 p-1 text-center text-sm",children:[o.jsx("p",{className:"text-lg font-semibold text-white",children:"Spectate disabled during lockdown."}),o.jsx("p",{className:"text-slate-300",children:"Please wait until the server leaves lockdown to view streams."})]})});const b=r?"flex min-h-screen flex-col bg-black text-slate-100 md:h-screen md:overflow-hidden":"grid min-h-screen grid-cols-1 gap-0.5 bg-black text-slate-100 md:h-full md:min-h-0 md:grid-cols-[minmax(0,1fr)_18rem] lg:grid-cols-[minmax(0,1fr)_20rem]",N=r?"order-2 flex min-h-0 min-w-0 flex-1 flex-col gap-0.5 overflow-y-auto":"order-1 flex min-h-0 min-w-0 flex-col gap-0.5 md:overflow-y-auto",M=r?"order-1 grid w-full min-h-0 items-stretch gap-0.5 border-b border-slate-800/60 bg-slate-950/90 p-0.5 grid-cols-[minmax(0,1fr)_minmax(0,0.7fr)_minmax(0,1.9fr)_minmax(0,0.7fr)]":"order-2 flex min-h-0 min-w-0 flex-col gap-0.5 border-l border-slate-800/60 bg-slate-950/90 md:h-full md:overflow-y-auto",C="",E=r?"h-64":"";return o.jsxs("div",{className:"min-h-screen bg-black text-slate-100 md:h-screen md:overflow-hidden",children:[o.jsxs("main",{className:b,children:[o.jsxs("section",{className:M,children:[r?o.jsxs("div",{className:`${C} ${E} flex flex-col gap-0.5`,children:[o.jsx(uo,{layout:"desktop",dismissable:!1,className:"text-sm"}),o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(co,{hideNicknameForm:!0,hideHeader:!0,compact:!0,fillHeight:!0,className:"h-full"})})]}):o.jsx("div",{className:C,children:o.jsx(uo,{layout:"desktop",dismissable:!1,className:"text-sm"})}),o.jsx("div",{className:`${C} ${r?`${E} overflow-y-auto`:""}`,children:o.jsx("div",{className:"panel h-full",children:o.jsx(bo,{title:"Rovers"})})}),r?null:o.jsx("div",{className:`${C} flex-1 min-h-0`,children:o.jsx(co,{hideNicknameForm:!0,hideHeader:!0,compact:!0,fillHeight:!0,className:"h-full"})}),o.jsx("div",{className:`${C} ${r?E:"flex-[1.1] min-h-0"}`,children:o.jsx(yo,{allowSpectatorInput:!0,hideSpectatorNotice:!0,fillHeight:!0})}),o.jsx("div",{className:`${C} ${r?E:""}`,children:o.jsx(sN,{className:`${r?"h-full":"h-40"} overflow-hidden`})})]}),o.jsxs("section",{className:N,children:[o.jsx(aN,{roster:d,frames:f,videoSources:x,snapshotFeeds:h,audioSources:y,session:a,canSpectateVideo:i}),o.jsx(lN,{})]})]}),o.jsx(Hf,{})]})}function rN(){return o.jsx(iN,{})}const oN=2e4,cN=3600*1e3;function uN({roverId:a,session:l}){const i=l?.activeDrivers?.[a]||null,f=(l?.users||[]).find(p=>p.socketId===i)?.nickname||(i?i.slice(0,6):"No driver"),d=l?.mode,h=l?.turnQueues?.[a];return d==="turns"&&h?.current?`${f}`:f}function fN({rover:a,frame:l}){const i=l?.sensors?.batteryChargeMah??null,r=a?.battery??null;return cx({batteryState:a?.batteryState??null,charge:i,config:r})}function Ip({rover:a,frame:l,driverLabel:i,sessionInfo:r,videoMode:f="snapshot",snapshotFeed:d,withDivider:h=!1,showPreview:p=!0,variant:x="stacked"}){const v=fN({rover:a,frame:l}),y=v?.available?v.percentDisplay:null,b=x==="active";return o.jsxs("div",{className:`relative flex min-w-0 flex-1 flex-col gap-4 overflow-hidden bg-black px-0 py-0 ${h?"border-r border-slate-700/60":""}`,children:[o.jsx(Nf,{visual:v,orientation:b?"vertical":"horizontal",variant:"background"}),b?o.jsxs("div",{className:"relative z-10 flex min-w-0 flex-1 flex-col justify-between text-center",children:[o.jsx("div",{className:"min-w-0 bg-transparent px-0 py-0 leading-none",children:o.jsx(es,{className:"font-semibold leading-none text-white",maxSize:1e3,minSize:18,children:a.name||a.id})}),i?o.jsx("div",{className:"min-w-0 bg-transparent px-0 py-0 leading-none",children:o.jsx(es,{className:"font-semibold leading-none text-white",maxSize:1e3,minSize:16,children:i})}):o.jsx("div",{}),o.jsx("div",{className:"relative min-w-0 overflow-hidden bg-transparent px-0 py-0 leading-none",children:o.jsx("div",{className:"relative",children:o.jsx(es,{className:"font-semibold leading-none text-white",maxSize:1e3,minSize:16,children:y==null?"--%":`${y}%`})})})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"relative z-10 flex min-w-0 flex-col gap-1 text-center",children:[o.jsx("div",{className:"min-w-0 bg-transparent px-0 py-0 leading-none",children:o.jsx(es,{className:"font-semibold leading-none text-white",maxSize:1e3,minSize:18,children:a.name||a.id})}),i?o.jsx("div",{className:"min-w-0 bg-transparent px-0 py-0 leading-none",children:o.jsx(es,{className:"font-semibold leading-none text-white",maxSize:1e3,minSize:16,children:i})}):null,o.jsx("div",{className:"relative min-w-0 overflow-hidden bg-transparent px-0 py-0 leading-none",children:o.jsx("div",{className:"relative",children:o.jsx(es,{className:"font-semibold leading-none text-white",maxSize:80,minSize:16,children:y==null?"--%":`${y}%`})})})]}),o.jsx("div",{className:"relative z-10 flex min-w-0 flex-1 flex-col gap-4",children:o.jsx("div",{className:"flex w-full min-w-0 flex-1 flex-col items-center gap-4",children:p?o.jsx("div",{className:"mt-auto w-full",children:o.jsx("div",{className:"w-full aspect-[4/3]",children:o.jsx(yi,{sessionInfo:r,videoMode:f,snapshotFeed:d,audioSessionInfo:null,label:a.name||a.id,telemetryFrame:l,batteryConfig:a.battery,layoutFormat:"mobile",hudVariant:"none",fitParent:!0})})}):null})})]})]})}function es({children:a,className:l="",maxSize:i=1e3,minSize:r=14}){const f=m.useRef(null),d=m.useRef(null),[h,p]=m.useState(i);return m.useLayoutEffect(()=>{const x=f.current,v=d.current;if(!x||!v)return;let y=null;const b=()=>{const C=x.clientWidth;if(!C){N();return}let E=r,j=i,R=r;for(;E<=j;){const A=Math.floor((E+j)/2);v.style.fontSize=`${A}px`,v.scrollWidth<=C?(R=A,E=A+1):j=A-1}p(R)},N=()=>{y&&cancelAnimationFrame(y),y=requestAnimationFrame(b)};N();const M=new ResizeObserver(N);return M.observe(x),()=>{y&&cancelAnimationFrame(y),M.disconnect()}},[a,i,r]),o.jsx("div",{ref:f,className:"w-full min-w-0",children:o.jsx("div",{ref:d,className:`whitespace-nowrap ${l}`,style:{fontSize:`${h}px`,lineHeight:1.1},children:a})})}function dN(){const{session:a}=Ye(),l=jx();ld();const i=a?.mode==="lockdown",r=!!a?.isLocalNetwork,f=zf(),d=a?.roster??[],[h,p]=m.useState(0),x=a?.activeDrivers||{},v=m.useMemo(()=>d.filter(F=>x[F.id]),[d,x]),y=v.length?v:d,b=Kf(y.map(F=>F.id),{enabled:!i&&!r,version:a?.mode}),N=m.useMemo(()=>r?y.map(F=>({type:"rover",id:F.id,key:F.id})):[],[r,y]),M=xi(N,{enabled:!i&&r,version:a?.mode}),C=m.useMemo(()=>v.flatMap(F=>{if(!F?.id||!F.media?.audioPublishUrl)return[];const Q=String(F.id);return[{type:"rover",id:`${Q}-audio`,key:`${Q}-audio`}]}),[v]),E=xi(C,{enabled:!i,version:a?.mode}),j=m.useMemo(()=>{if(!v.length)return[];if(!r){const Q=v.filter(ne=>b[ne.id]?.objectUrl);return Q.length?Q:v}const F=v.filter(Q=>{const ne=M[Q.id];return ne?.url&&!ne?.error});return F.length?F:v},[v,b,M,r]),R=m.useMemo(()=>j.map(F=>({type:"rover",rover:F})),[j]),A=m.useMemo(()=>R.map(F=>`r:${F.rover.id}`).join("|"),[R]);m.useEffect(()=>{p(0)},[A]),m.useEffect(()=>{if(!R.length)return;const F=setInterval(()=>{p(Q=>(Q+1)%R.length)},oN);return()=>clearInterval(F)},[R.length,A]);const T=R.length?R[h%R.length]:null,O=T?.type==="rover"?T.rover:null,L=!r&&O&&b[O.id]||null,Z=r&&O&&M[O.id]||null,D=O&&E[`${O.id}-audio`]||null,G=O&&f[O.id]||null,Y=O?uN({roverId:O.id,session:a}):null;return i?o.jsx("div",{className:"relative flex h-screen w-screen items-center justify-center bg-black text-slate-200",children:o.jsxs("div",{className:"surface max-w-sm space-y-0.5 p-1 text-center text-sm",children:[o.jsx("p",{className:"text-lg font-semibold text-white",children:"Mini spectator is disabled in lockdown."}),o.jsx("p",{className:"text-slate-300",children:"It will automatically resume once lockdown ends."})]})}):v.length?o.jsxs("div",{className:"relative flex h-screen w-screen overflow-hidden bg-black text-slate-100",children:[o.jsx("section",{className:"relative flex h-full shrink-0 items-center justify-start overflow-hidden bg-black",style:{width:"min(100vw, calc(100vh * 4 / 3))"},children:l?O?o.jsx(hN,{children:r?o.jsx("div",{className:"relative h-full w-full",children:R.map(F=>{const Q=F.rover,ne=O?.id===Q.id;return o.jsx("div",{className:`absolute inset-0 ${ne?"opacity-100":"opacity-0 pointer-events-none"}`,children:o.jsx(yi,{sessionInfo:M[Q.id]||null,videoMode:"whep",snapshotFeed:null,audioSessionInfo:ne?D:null,forceMute:!ne,label:Q.name||Q.id,telemetryFrame:f[Q.id]||null,batteryConfig:Q.battery,layoutFormat:"mobile",hudVariant:"none",fitParent:!0})},Q.id)})}):o.jsx(yi,{sessionInfo:null,videoMode:"snapshot",snapshotFeed:L,audioSessionInfo:D,label:O.name||O.id,telemetryFrame:G,batteryConfig:O.battery,layoutFormat:"mobile",hudVariant:"none",fitParent:!0})}):o.jsx("div",{className:"flex h-full w-full items-center justify-center text-sm text-slate-500",children:v.length?"No sources available.":"No active drivers."}):o.jsx("div",{className:"flex h-full w-full items-center justify-center text-sm text-slate-500",children:"Switching to spectator…"})}),o.jsx("aside",{className:"flex h-full min-w-0 flex-1 flex-col border-l border-slate-800/60 bg-black",children:O?o.jsx(Ip,{rover:O,frame:G,driverLabel:Y,sessionInfo:r?Z:null,videoMode:r?"whep":"snapshot",snapshotFeed:r?null:b[O.id]||null,showPreview:!1,variant:"active"}):o.jsx("div",{className:"flex h-full w-full items-center justify-center text-sm text-slate-500",children:"No active rover."})})]}):o.jsx("div",{className:"relative flex h-screen w-screen overflow-hidden bg-black text-slate-100",children:o.jsx("section",{className:"flex h-full w-full gap-x-3 bg-slate-900 px-0",children:d.length?d.map((F,Q)=>o.jsx(Ip,{rover:F,frame:f[F.id]||null,driverLabel:null,sessionInfo:r&&M[F.id]||null,videoMode:r?"whep":"snapshot",snapshotFeed:r?null:b[F.id]||null,showPreview:!0,withDivider:!1},F.id)):o.jsx("div",{className:"flex h-full w-full items-center justify-center text-sm text-slate-500",children:"No rovers available."})})})}function mN(){return m.useEffect(()=>{if(typeof window>"u")return;const a=setTimeout(()=>{const l=new URL(window.location.href);l.searchParams.set("refresh",Date.now().toString()),window.location.replace(l.toString())},cN);return()=>clearTimeout(a)},[]),o.jsxs(o.Fragment,{children:[o.jsx(dN,{}),o.jsx(Hf,{scale:3})]})}function hN({children:a}){return o.jsx("div",{className:"flex h-full w-full items-center justify-start overflow-hidden bg-black",children:o.jsx("div",{className:"relative flex items-center justify-center overflow-hidden bg-black",style:{width:"min(100%, calc(100vh * 4 / 3))",height:"min(100%, calc(100vw * 3 / 4))",maxWidth:"100%",maxHeight:"100%",aspectRatio:"4 / 3"},children:o.jsx("div",{className:"flex h-full w-full items-center justify-center overflow-hidden",children:a})})})}$y.createRoot(document.getElementById("root")).render(o.jsx(m.StrictMode,{children:o.jsx(dS,{children:o.jsx(hS,{children:o.jsx(pS,{children:o.jsx(NS,{children:o.jsx(fA,{children:o.jsx(l1,{children:o.jsxs(Ob,{children:[o.jsx(Fr,{path:"/",element:o.jsx(W2,{})}),o.jsx(Fr,{path:"/spectate",element:o.jsx(rN,{})}),o.jsx(Fr,{path:"/mini",element:o.jsx(mN,{})})]})})})})})})})}));
|