mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 01:21:20 -04:00
126 lines
485 KiB
JavaScript
126 lines
485 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 Ry(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var xu={exports:{}},Us={};var Y0;function Ty(){if(Y0)return Us;Y0=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 Us.Fragment=l,Us.jsx=i,Us.jsxs=i,Us}var $0;function ky(){return $0||($0=1,xu.exports=Ty()),xu.exports}var o=ky(),vu={exports:{}},ye={};var G0;function _y(){if(G0)return ye;G0=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"),S=Symbol.for("react.activity"),N=Symbol.iterator;function q(w){return w===null||typeof w!="object"?null:(w=N&&w[N]||w["@@iterator"],typeof w=="function"?w:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,j={};function M(w,U,ee){this.props=w,this.context=U,this.refs=j,this.updater=ee||E}M.prototype.isReactComponent={},M.prototype.setState=function(w,U){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,U,"setState")},M.prototype.forceUpdate=function(w){this.updater.enqueueForceUpdate(this,w,"forceUpdate")};function A(){}A.prototype=M.prototype;function k(w,U,ee){this.props=w,this.context=U,this.refs=j,this.updater=ee||E}var O=k.prototype=new A;O.constructor=k,C(O,M.prototype),O.isPureReactComponent=!0;var B=Array.isArray;function Z(){}var z={H:null,A:null,T:null,S:null},X=Object.prototype.hasOwnProperty;function $(w,U,ee){var ae=ee.ref;return{$$typeof:a,type:w,key:U,ref:ae!==void 0?ae:null,props:ee}}function Q(w,U){return $(w.type,U,w.props)}function L(w){return typeof w=="object"&&w!==null&&w.$$typeof===a}function K(w){var U={"=":"=0",":":"=2"};return"$"+w.replace(/[=:]/g,function(ee){return U[ee]})}var se=/\/+/g;function ce(w,U){return typeof w=="object"&&w!==null&&w.key!=null?K(""+w.key):U.toString(36)}function W(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(U){w.status==="pending"&&(w.status="fulfilled",w.value=U)},function(U){w.status==="pending"&&(w.status="rejected",w.reason=U)})),w.status){case"fulfilled":return w.value;case"rejected":throw w.reason}}throw w}function T(w,U,ee,ae,le){var ie=typeof w;(ie==="undefined"||ie==="boolean")&&(w=null);var oe=!1;if(w===null)oe=!0;else switch(ie){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,T(oe(w._payload),U,ee,ae,le)}}if(oe)return le=le(w),oe=ae===""?"."+ce(w,0):ae,B(le)?(ee="",oe!=null&&(ee=oe.replace(se,"$&/")+"/"),T(le,U,ee,"",function(Re){return Re})):le!=null&&(L(le)&&(le=Q(le,ee+(le.key==null||w&&w.key===le.key?"":(""+le.key).replace(se,"$&/")+"/")+oe)),U.push(le)),1;oe=0;var xe=ae===""?".":ae+":";if(B(w))for(var pe=0;pe<w.length;pe++)ae=w[pe],ie=xe+ce(ae,pe),oe+=T(ae,U,ee,ie,le);else if(pe=q(w),typeof pe=="function")for(w=pe.call(w),pe=0;!(ae=w.next()).done;)ae=ae.value,ie=xe+ce(ae,pe++),oe+=T(ae,U,ee,ie,le);else if(ie==="object"){if(typeof w.then=="function")return T(W(w),U,ee,ae,le);throw U=String(w),Error("Objects are not valid as a React child (found: "+(U==="[object Object]"?"object with keys {"+Object.keys(w).join(", ")+"}":U)+"). If you meant to render a collection of children, use an array instead.")}return oe}function F(w,U,ee){if(w==null)return w;var ae=[],le=0;return T(w,ae,"","",function(ie){return U.call(ee,ie,le++)}),ae}function ne(w){if(w._status===-1){var U=w._result;U=U(),U.then(function(ee){(w._status===0||w._status===-1)&&(w._status=1,w._result=ee)},function(ee){(w._status===0||w._status===-1)&&(w._status=2,w._result=ee)}),w._status===-1&&(w._status=0,w._result=U)}if(w._status===1)return w._result.default;throw w._result}var de=typeof reportError=="function"?reportError:function(w){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var U=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(U))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",w);return}console.error(w)},fe={map:F,forEach:function(w,U,ee){F(w,function(){U.apply(this,arguments)},ee)},count:function(w){var U=0;return F(w,function(){U++}),U},toArray:function(w){return F(w,function(U){return U})||[]},only:function(w){if(!L(w))throw Error("React.Children.only expected to receive a single React element child.");return w}};return ye.Activity=S,ye.Children=fe,ye.Component=M,ye.Fragment=i,ye.Profiler=f,ye.PureComponent=k,ye.StrictMode=r,ye.Suspense=x,ye.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=z,ye.__COMPILER_RUNTIME={__proto__:null,c:function(w){return z.H.useMemoCache(w)}},ye.cache=function(w){return function(){return w.apply(null,arguments)}},ye.cacheSignal=function(){return null},ye.cloneElement=function(w,U,ee){if(w==null)throw Error("The argument must be a React element, but you passed "+w+".");var ae=C({},w.props),le=w.key;if(U!=null)for(ie in U.key!==void 0&&(le=""+U.key),U)!X.call(U,ie)||ie==="key"||ie==="__self"||ie==="__source"||ie==="ref"&&U.ref===void 0||(ae[ie]=U[ie]);var ie=arguments.length-2;if(ie===1)ae.children=ee;else if(1<ie){for(var oe=Array(ie),xe=0;xe<ie;xe++)oe[xe]=arguments[xe+2];ae.children=oe}return $(w.type,le,ae)},ye.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},ye.createElement=function(w,U,ee){var ae,le={},ie=null;if(U!=null)for(ae in U.key!==void 0&&(ie=""+U.key),U)X.call(U,ae)&&ae!=="key"&&ae!=="__self"&&ae!=="__source"&&(le[ae]=U[ae]);var oe=arguments.length-2;if(oe===1)le.children=ee;else if(1<oe){for(var xe=Array(oe),pe=0;pe<oe;pe++)xe[pe]=arguments[pe+2];le.children=xe}if(w&&w.defaultProps)for(ae in oe=w.defaultProps,oe)le[ae]===void 0&&(le[ae]=oe[ae]);return $(w,ie,le)},ye.createRef=function(){return{current:null}},ye.forwardRef=function(w){return{$$typeof:p,render:w}},ye.isValidElement=L,ye.lazy=function(w){return{$$typeof:y,_payload:{_status:-1,_result:w},_init:ne}},ye.memo=function(w,U){return{$$typeof:v,type:w,compare:U===void 0?null:U}},ye.startTransition=function(w){var U=z.T,ee={};z.T=ee;try{var ae=w(),le=z.S;le!==null&&le(ee,ae),typeof ae=="object"&&ae!==null&&typeof ae.then=="function"&&ae.then(Z,de)}catch(ie){de(ie)}finally{U!==null&&ee.types!==null&&(U.types=ee.types),z.T=U}},ye.unstable_useCacheRefresh=function(){return z.H.useCacheRefresh()},ye.use=function(w){return z.H.use(w)},ye.useActionState=function(w,U,ee){return z.H.useActionState(w,U,ee)},ye.useCallback=function(w,U){return z.H.useCallback(w,U)},ye.useContext=function(w){return z.H.useContext(w)},ye.useDebugValue=function(){},ye.useDeferredValue=function(w,U){return z.H.useDeferredValue(w,U)},ye.useEffect=function(w,U){return z.H.useEffect(w,U)},ye.useEffectEvent=function(w){return z.H.useEffectEvent(w)},ye.useId=function(){return z.H.useId()},ye.useImperativeHandle=function(w,U,ee){return z.H.useImperativeHandle(w,U,ee)},ye.useInsertionEffect=function(w,U){return z.H.useInsertionEffect(w,U)},ye.useLayoutEffect=function(w,U){return z.H.useLayoutEffect(w,U)},ye.useMemo=function(w,U){return z.H.useMemo(w,U)},ye.useOptimistic=function(w,U){return z.H.useOptimistic(w,U)},ye.useReducer=function(w,U,ee){return z.H.useReducer(w,U,ee)},ye.useRef=function(w){return z.H.useRef(w)},ye.useState=function(w){return z.H.useState(w)},ye.useSyncExternalStore=function(w,U,ee){return z.H.useSyncExternalStore(w,U,ee)},ye.useTransition=function(){return z.H.useTransition()},ye.version="19.2.0",ye}var X0;function df(){return X0||(X0=1,vu.exports=_y()),vu.exports}var m=df();const $a=Ry(m);var yu={exports:{}},Hs={},bu={exports:{}},Su={};var Q0;function Dy(){return Q0||(Q0=1,(function(a){function l(T,F){var ne=T.length;T.push(F);e:for(;0<ne;){var de=ne-1>>>1,fe=T[de];if(0<f(fe,F))T[de]=F,T[ne]=fe,ne=de;else break e}}function i(T){return T.length===0?null:T[0]}function r(T){if(T.length===0)return null;var F=T[0],ne=T.pop();if(ne!==F){T[0]=ne;e:for(var de=0,fe=T.length,w=fe>>>1;de<w;){var U=2*(de+1)-1,ee=T[U],ae=U+1,le=T[ae];if(0>f(ee,ne))ae<fe&&0>f(le,ee)?(T[de]=le,T[ae]=ne,de=ae):(T[de]=ee,T[U]=ne,de=U);else if(ae<fe&&0>f(le,ne))T[de]=le,T[ae]=ne,de=ae;else break e}}return F}function f(T,F){var ne=T.sortIndex-F.sortIndex;return ne!==0?ne:T.id-F.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,S=null,N=3,q=!1,E=!1,C=!1,j=!1,M=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function O(T){for(var F=i(v);F!==null;){if(F.callback===null)r(v);else if(F.startTime<=T)r(v),F.sortIndex=F.expirationTime,l(x,F);else break;F=i(v)}}function B(T){if(C=!1,O(T),!E)if(i(x)!==null)E=!0,Z||(Z=!0,K());else{var F=i(v);F!==null&&W(B,F.startTime-T)}}var Z=!1,z=-1,X=5,$=-1;function Q(){return j?!0:!(a.unstable_now()-$<X)}function L(){if(j=!1,Z){var T=a.unstable_now();$=T;var F=!0;try{e:{E=!1,C&&(C=!1,A(z),z=-1),q=!0;var ne=N;try{t:{for(O(T),S=i(x);S!==null&&!(S.expirationTime>T&&Q());){var de=S.callback;if(typeof de=="function"){S.callback=null,N=S.priorityLevel;var fe=de(S.expirationTime<=T);if(T=a.unstable_now(),typeof fe=="function"){S.callback=fe,O(T),F=!0;break t}S===i(x)&&r(x),O(T)}else r(x);S=i(x)}if(S!==null)F=!0;else{var w=i(v);w!==null&&W(B,w.startTime-T),F=!1}}break e}finally{S=null,N=ne,q=!1}F=void 0}}finally{F?K():Z=!1}}}var K;if(typeof k=="function")K=function(){k(L)};else if(typeof MessageChannel<"u"){var se=new MessageChannel,ce=se.port2;se.port1.onmessage=L,K=function(){ce.postMessage(null)}}else K=function(){M(L,0)};function W(T,F){z=M(function(){T(a.unstable_now())},F)}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(T){T.callback=null},a.unstable_forceFrameRate=function(T){0>T||125<T?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):X=0<T?Math.floor(1e3/T):5},a.unstable_getCurrentPriorityLevel=function(){return N},a.unstable_next=function(T){switch(N){case 1:case 2:case 3:var F=3;break;default:F=N}var ne=N;N=F;try{return T()}finally{N=ne}},a.unstable_requestPaint=function(){j=!0},a.unstable_runWithPriority=function(T,F){switch(T){case 1:case 2:case 3:case 4:case 5:break;default:T=3}var ne=N;N=T;try{return F()}finally{N=ne}},a.unstable_scheduleCallback=function(T,F,ne){var de=a.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0<ne?de+ne:de):ne=de,T){case 1:var fe=-1;break;case 2:fe=250;break;case 5:fe=1073741823;break;case 4:fe=1e4;break;default:fe=5e3}return fe=ne+fe,T={id:y++,callback:F,priorityLevel:T,startTime:ne,expirationTime:fe,sortIndex:-1},ne>de?(T.sortIndex=ne,l(v,T),i(x)===null&&T===i(v)&&(C?(A(z),z=-1):C=!0,W(B,ne-de))):(T.sortIndex=fe,l(x,T),E||q||(E=!0,Z||(Z=!0,K()))),T},a.unstable_shouldYield=Q,a.unstable_wrapCallback=function(T){var F=N;return function(){var ne=N;N=F;try{return T.apply(this,arguments)}finally{N=ne}}}})(Su)),Su}var K0;function Oy(){return K0||(K0=1,bu.exports=Dy()),bu.exports}var Au={exports:{}},yt={};var Z0;function By(){if(Z0)return yt;Z0=1;var a=df();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 S=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:f,key:S==null?null:""+S,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 yt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,yt.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)},yt.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()}},yt.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))},yt.prefetchDNS=function(x){typeof x=="string"&&r.d.D(x)},yt.preinit=function(x,v){if(typeof x=="string"&&v&&typeof v.as=="string"){var y=v.as,S=p(y,v.crossOrigin),N=typeof v.integrity=="string"?v.integrity:void 0,q=typeof v.fetchPriority=="string"?v.fetchPriority:void 0;y==="style"?r.d.S(x,typeof v.precedence=="string"?v.precedence:void 0,{crossOrigin:S,integrity:N,fetchPriority:q}):y==="script"&&r.d.X(x,{crossOrigin:S,integrity:N,fetchPriority:q,nonce:typeof v.nonce=="string"?v.nonce:void 0})}},yt.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)},yt.preload=function(x,v){if(typeof x=="string"&&typeof v=="object"&&v!==null&&typeof v.as=="string"){var y=v.as,S=p(y,v.crossOrigin);r.d.L(x,y,{crossOrigin:S,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})}},yt.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)},yt.requestFormReset=function(x){r.d.r(x)},yt.unstable_batchedUpdates=function(x,v){return x(v)},yt.useFormState=function(x,v,y){return h.H.useFormState(x,v,y)},yt.useFormStatus=function(){return h.H.useHostTransitionStatus()},yt.version="19.2.0",yt}var F0;function zy(){if(F0)return Au.exports;F0=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(),Au.exports=By(),Au.exports}var J0;function Ly(){if(J0)return Hs;J0=1;var a=Oy(),l=df(),i=zy();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,b=c.child;b;){if(b===n){g=!0,n=c,s=u;break}if(b===s){g=!0,s=c,n=u;break}b=b.sibling}if(!g){for(b=u.child;b;){if(b===n){g=!0,n=u,s=c;break}if(b===s){g=!0,s=u,n=c;break}b=b.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 S=Object.assign,N=Symbol.for("react.element"),q=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),j=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),k=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),Z=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),X=Symbol.for("react.lazy"),$=Symbol.for("react.activity"),Q=Symbol.for("react.memo_cache_sentinel"),L=Symbol.iterator;function K(e){return e===null||typeof e!="object"?null:(e=L&&e[L]||e["@@iterator"],typeof e=="function"?e:null)}var se=Symbol.for("react.client.reference");function ce(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===se?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case C:return"Fragment";case M:return"Profiler";case j:return"StrictMode";case B:return"Suspense";case Z:return"SuspenseList";case $:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case E:return"Portal";case k: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 z:return t=e.displayName||null,t!==null?t:ce(e.type)||"Memo";case X:t=e._payload,e=e._init;try{return ce(e(t))}catch{}}return null}var W=Array.isArray,T=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne={pending:!1,data:null,method:null,action:null},de=[],fe=-1;function w(e){return{current:e}}function U(e){0>fe||(e.current=de[fe],de[fe]=null,fe--)}function ee(e,t){fe++,de[fe]=e.current,e.current=t}var ae=w(null),le=w(null),ie=w(null),oe=w(null);function xe(e,t){switch(ee(ie,t),ee(le,e),ee(ae,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?f0(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=f0(t),e=d0(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}U(ae),ee(ae,e)}function pe(){U(ae),U(le),U(ie)}function Re(e){e.memoizedState!==null&&ee(oe,e);var t=ae.current,n=d0(t,e.type);t!==n&&(ee(le,e),ee(ae,n))}function te(e){le.current===e&&(U(ae),U(le)),oe.current===e&&(U(oe),Os._currentValue=ne)}var re,Se;function _e(e){if(re===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);re=t&&t[1]||"",Se=-1<n.stack.indexOf(`
|
||
at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
|
||
`+re+e+Se}var we=!1;function Ye(e,t){if(!e||we)return"";we=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(t){var P=function(){throw Error()};if(Object.defineProperty(P.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(P,[])}catch(G){var Y=G}Reflect.construct(e,[],P)}else{try{P.call()}catch(G){Y=G}e.call(P.prototype)}}else{try{throw Error()}catch(G){Y=G}(P=e())&&typeof P.catch=="function"&&P.catch(function(){})}}catch(G){if(G&&Y&&typeof G.stack=="string")return[G.stack,Y.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],b=u[1];if(g&&b){var R=g.split(`
|
||
`),V=b.split(`
|
||
`);for(c=s=0;s<R.length&&!R[s].includes("DetermineComponentFrameRoot");)s++;for(;c<V.length&&!V[c].includes("DetermineComponentFrameRoot");)c++;if(s===R.length||c===V.length)for(s=R.length-1,c=V.length-1;1<=s&&0<=c&&R[s]!==V[c];)c--;for(;1<=s&&0<=c;s--,c--)if(R[s]!==V[c]){if(s!==1||c!==1)do if(s--,c--,0>c||R[s]!==V[c]){var J=`
|
||
`+R[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{we=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?_e(n):""}function It(e,t){switch(e.tag){case 26:case 27:case 5:return _e(e.type);case 16:return _e("Lazy");case 13:return e.child!==t&&t!==null?_e("Suspense Fallback"):_e("Suspense");case 19:return _e("SuspenseList");case 0:case 15:return Ye(e.type,!1);case 11:return Ye(e.type.render,!1);case 1:return Ye(e.type,!0);case 31:return _e("Activity");default:return""}}function St(e){try{var t="",n=null;do t+=It(e,n),n=e,e=e.return;while(e);return t}catch(s){return`
|
||
Error generating stack: `+s.message+`
|
||
`+s.stack}}var $n=Object.prototype.hasOwnProperty,Tt=a.unstable_scheduleCallback,Wt=a.unstable_cancelCallback,Xl=a.unstable_shouldYield,va=a.unstable_requestPaint,rt=a.unstable_now,Ql=a.unstable_getCurrentPriorityLevel,ui=a.unstable_ImmediatePriority,Gn=a.unstable_UserBlockingPriority,Xn=a.unstable_NormalPriority,Xa=a.unstable_LowPriority,Kl=a.unstable_IdlePriority,no=a.log,ao=a.unstable_setDisableYieldValue,ya=null,vt=null;function ot(e){if(typeof no=="function"&&ao(e),vt&&typeof vt.setStrictMode=="function")try{vt.setStrictMode(ya,e)}catch{}}var ve=Math.clz32?Math.clz32:Ge,ct=Math.log,At=Math.LN2;function Ge(e){return e>>>=0,e===0?32:31-(ct(e)/At|0)|0}var Ze=256,Le=262144,Qa=4194304;function ba(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 fi(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 b=s&134217727;return b!==0?(s=b&~u,s!==0?c=ba(s):(g&=b,g!==0?c=ba(g):n||(n=b&~e,n!==0&&(c=ba(n))))):(b=s&~u,b!==0?c=ba(b):g!==0?c=ba(g):n||(n=s&~e,n!==0&&(c=ba(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 Zl(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function xx(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 Qf(){var e=Qa;return Qa<<=1,(Qa&62914560)===0&&(Qa=4194304),e}function lo(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Fl(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function vx(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 b=e.entanglements,R=e.expirationTimes,V=e.hiddenUpdates;for(n=g&~n;0<n;){var J=31-ve(n),P=1<<J;b[J]=0,R[J]=-1;var Y=V[J];if(Y!==null)for(V[J]=null,J=0;J<Y.length;J++){var G=Y[J];G!==null&&(G.lane&=-536870913)}n&=~P}s!==0&&Kf(e,s,0),u!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=u&~(g&~t))}function Kf(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-ve(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|n&261930}function Zf(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var s=31-ve(n),c=1<<s;c&t|e[s]&t&&(e[s]|=t),n&=~c}}function Ff(e,t){var n=t&-t;return n=(n&42)!==0?1:so(n),(n&(e.suspendedLanes|t))!==0?0:n}function so(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 io(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Jf(){var e=F.p;return e!==0?e:(e=window.event,e===void 0?32:O0(e.type))}function If(e,t){var n=F.p;try{return F.p=e,t()}finally{F.p=n}}var Qn=Math.random().toString(36).slice(2),dt="__reactFiber$"+Qn,jt="__reactProps$"+Qn,Ka="__reactContainer$"+Qn,ro="__reactEvents$"+Qn,yx="__reactListeners$"+Qn,bx="__reactHandles$"+Qn,Wf="__reactResources$"+Qn,Jl="__reactMarker$"+Qn;function oo(e){delete e[dt],delete e[jt],delete e[ro],delete e[yx],delete e[bx]}function Za(e){var t=e[dt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Ka]||n[dt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=y0(e);e!==null;){if(n=e[dt])return n;e=y0(e)}return t}e=n,n=e.parentNode}return null}function Fa(e){if(e=e[dt]||e[Ka]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Il(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(r(33))}function Ja(e){var t=e[Wf];return t||(t=e[Wf]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function ut(e){e[Jl]=!0}var Pf=new Set,ed={};function Sa(e,t){Ia(e,t),Ia(e+"Capture",t)}function Ia(e,t){for(ed[e]=t,e=0;e<t.length;e++)Pf.add(t[e])}var Sx=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]*$"),td={},nd={};function Ax(e){return $n.call(nd,e)?!0:$n.call(td,e)?!1:Sx.test(e)?nd[e]=!0:(td[e]=!0,!1)}function di(e,t,n){if(Ax(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 mi(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 vn(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 Ut(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ad(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function jx(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 co(e){if(!e._valueTracker){var t=ad(e)?"checked":"value";e._valueTracker=jx(e,t,""+e[t])}}function ld(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=ad(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}function hi(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 Nx=/[\n"\\]/g;function Ht(e){return e.replace(Nx,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function uo(e,t,n,s,c,u,g,b){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=""+Ut(t)):e.value!==""+Ut(t)&&(e.value=""+Ut(t)):g!=="submit"&&g!=="reset"||e.removeAttribute("value"),t!=null?fo(e,g,Ut(t)):n!=null?fo(e,g,Ut(n)):s!=null&&e.removeAttribute("value"),c==null&&u!=null&&(e.defaultChecked=!!u),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.name=""+Ut(b):e.removeAttribute("name")}function sd(e,t,n,s,c,u,g,b){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)){co(e);return}n=n!=null?""+Ut(n):"",t=t!=null?""+Ut(t):n,b||t===e.value||(e.value=t),e.defaultValue=t}s=s??c,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=b?e.checked:!!s,e.defaultChecked=!!s,g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(e.name=g),co(e)}function fo(e,t,n){t==="number"&&hi(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Wa(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=""+Ut(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 id(e,t,n){if(t!=null&&(t=""+Ut(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Ut(n):""}function rd(e,t,n,s){if(t==null){if(s!=null){if(n!=null)throw Error(r(92));if(W(s)){if(1<s.length)throw Error(r(93));s=s[0]}n=s}n==null&&(n=""),t=n}n=Ut(t),e.defaultValue=n,s=e.textContent,s===n&&s!==""&&s!==null&&(e.value=s),co(e)}function Pa(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var wx=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 od(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||wx.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function cd(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&&od(e,c,s)}else for(var u in t)t.hasOwnProperty(u)&&od(e,u,t[u])}function mo(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 Cx=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"]]),Ex=/^[\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 pi(e){return Ex.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function yn(){}var ho=null;function po(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var el=null,tl=null;function ud(e){var t=Fa(e);if(t&&(e=t.stateNode)){var n=e[jt]||null;e:switch(e=t.stateNode,t.type){case"input":if(uo(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="'+Ht(""+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));uo(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&&ld(s)}break e;case"textarea":id(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Wa(e,!!n.multiple,t,!1)}}}var go=!1;function fd(e,t,n){if(go)return e(t,n);go=!0;try{var s=e(t);return s}finally{if(go=!1,(el!==null||tl!==null)&&(nr(),el&&(t=el,e=tl,tl=el=null,ud(t),e)))for(t=0;t<e.length;t++)ud(e[t])}}function Wl(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 bn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),xo=!1;if(bn)try{var Pl={};Object.defineProperty(Pl,"passive",{get:function(){xo=!0}}),window.addEventListener("test",Pl,Pl),window.removeEventListener("test",Pl,Pl)}catch{xo=!1}var Kn=null,vo=null,gi=null;function dd(){if(gi)return gi;var e,t=vo,n=t.length,s,c="value"in Kn?Kn.value:Kn.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 gi=c.slice(e,1<s?1-s:void 0)}function xi(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 vi(){return!0}function md(){return!1}function Nt(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 b in e)e.hasOwnProperty(b)&&(n=e[b],this[b]=n?n(u):u[b]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?vi:md,this.isPropagationStopped=md,this}return S(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=vi)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=vi)},persist:function(){},isPersistent:vi}),t}var Aa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},yi=Nt(Aa),es=S({},Aa,{view:0,detail:0}),qx=Nt(es),yo,bo,ts,bi=S({},es,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ao,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!==ts&&(ts&&e.type==="mousemove"?(yo=e.screenX-ts.screenX,bo=e.screenY-ts.screenY):bo=yo=0,ts=e),yo)},movementY:function(e){return"movementY"in e?e.movementY:bo}}),hd=Nt(bi),Mx=S({},bi,{dataTransfer:0}),Rx=Nt(Mx),Tx=S({},es,{relatedTarget:0}),So=Nt(Tx),kx=S({},Aa,{animationName:0,elapsedTime:0,pseudoElement:0}),_x=Nt(kx),Dx=S({},Aa,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Ox=Nt(Dx),Bx=S({},Aa,{data:0}),pd=Nt(Bx),zx={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Lx={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"},Ux={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Hx(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Ux[e])?!!t[e]:!1}function Ao(){return Hx}var Vx=S({},es,{key:function(e){if(e.key){var t=zx[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=xi(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Lx[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ao,charCode:function(e){return e.type==="keypress"?xi(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?xi(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Yx=Nt(Vx),$x=S({},bi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),gd=Nt($x),Gx=S({},es,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ao}),Xx=Nt(Gx),Qx=S({},Aa,{propertyName:0,elapsedTime:0,pseudoElement:0}),Kx=Nt(Qx),Zx=S({},bi,{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}),Fx=Nt(Zx),Jx=S({},Aa,{newState:0,oldState:0}),Ix=Nt(Jx),Wx=[9,13,27,32],jo=bn&&"CompositionEvent"in window,ns=null;bn&&"documentMode"in document&&(ns=document.documentMode);var Px=bn&&"TextEvent"in window&&!ns,xd=bn&&(!jo||ns&&8<ns&&11>=ns),vd=" ",yd=!1;function bd(e,t){switch(e){case"keyup":return Wx.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Sd(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var nl=!1;function ev(e,t){switch(e){case"compositionend":return Sd(t);case"keypress":return t.which!==32?null:(yd=!0,vd);case"textInput":return e=t.data,e===vd&&yd?null:e;default:return null}}function tv(e,t){if(nl)return e==="compositionend"||!jo&&bd(e,t)?(e=dd(),gi=vo=Kn=null,nl=!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 xd&&t.locale!=="ko"?null:t.data;default:return null}}var nv={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 Ad(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!nv[e.type]:t==="textarea"}function jd(e,t,n,s){el?tl?tl.push(s):tl=[s]:el=s,t=cr(t,"onChange"),0<t.length&&(n=new yi("onChange","change",null,n,s),e.push({event:n,listeners:t}))}var as=null,ls=null;function av(e){s0(e,0)}function Si(e){var t=Il(e);if(ld(t))return e}function Nd(e,t){if(e==="change")return t}var wd=!1;if(bn){var No;if(bn){var wo="oninput"in document;if(!wo){var Cd=document.createElement("div");Cd.setAttribute("oninput","return;"),wo=typeof Cd.oninput=="function"}No=wo}else No=!1;wd=No&&(!document.documentMode||9<document.documentMode)}function Ed(){as&&(as.detachEvent("onpropertychange",qd),ls=as=null)}function qd(e){if(e.propertyName==="value"&&Si(ls)){var t=[];jd(t,ls,e,po(e)),fd(av,t)}}function lv(e,t,n){e==="focusin"?(Ed(),as=t,ls=n,as.attachEvent("onpropertychange",qd)):e==="focusout"&&Ed()}function sv(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Si(ls)}function iv(e,t){if(e==="click")return Si(t)}function rv(e,t){if(e==="input"||e==="change")return Si(t)}function ov(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var kt=typeof Object.is=="function"?Object.is:ov;function ss(e,t){if(kt(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(!$n.call(t,c)||!kt(e[c],t[c]))return!1}return!0}function Md(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Rd(e,t){var n=Md(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=Md(n)}}function Td(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Td(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function kd(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=hi(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=hi(e.document)}return t}function Co(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 cv=bn&&"documentMode"in document&&11>=document.documentMode,al=null,Eo=null,is=null,qo=!1;function _d(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;qo||al==null||al!==hi(s)||(s=al,"selectionStart"in s&&Co(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}),is&&ss(is,s)||(is=s,s=cr(Eo,"onSelect"),0<s.length&&(t=new yi("onSelect","select",null,t,n),e.push({event:t,listeners:s}),t.target=al)))}function ja(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var ll={animationend:ja("Animation","AnimationEnd"),animationiteration:ja("Animation","AnimationIteration"),animationstart:ja("Animation","AnimationStart"),transitionrun:ja("Transition","TransitionRun"),transitionstart:ja("Transition","TransitionStart"),transitioncancel:ja("Transition","TransitionCancel"),transitionend:ja("Transition","TransitionEnd")},Mo={},Dd={};bn&&(Dd=document.createElement("div").style,"AnimationEvent"in window||(delete ll.animationend.animation,delete ll.animationiteration.animation,delete ll.animationstart.animation),"TransitionEvent"in window||delete ll.transitionend.transition);function Na(e){if(Mo[e])return Mo[e];if(!ll[e])return e;var t=ll[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Dd)return Mo[e]=t[n];return e}var Od=Na("animationend"),Bd=Na("animationiteration"),zd=Na("animationstart"),uv=Na("transitionrun"),fv=Na("transitionstart"),dv=Na("transitioncancel"),Ld=Na("transitionend"),Ud=new Map,Ro="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(" ");Ro.push("scrollEnd");function Pt(e,t){Ud.set(e,t),Sa(t,[e])}var Ai=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)},Vt=[],sl=0,To=0;function ji(){for(var e=sl,t=To=sl=0;t<e;){var n=Vt[t];Vt[t++]=null;var s=Vt[t];Vt[t++]=null;var c=Vt[t];Vt[t++]=null;var u=Vt[t];if(Vt[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&&Hd(n,c,u)}}function Ni(e,t,n,s){Vt[sl++]=e,Vt[sl++]=t,Vt[sl++]=n,Vt[sl++]=s,To|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function ko(e,t,n,s){return Ni(e,t,n,s),wi(e)}function wa(e,t){return Ni(e,null,null,t),wi(e)}function Hd(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-ve(n),e=u.hiddenUpdates,s=e[c],s===null?e[c]=[t]:s.push(t),t.lane=n|536870912),u):null}function wi(e){if(50<qs)throw qs=0,Vc=null,Error(r(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var il={};function mv(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 mv(e,t,n,s)}function _o(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Sn(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 Vd(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 Ci(e,t,n,s,c,u){var g=0;if(s=e,typeof e=="function")_o(e)&&(g=1);else if(typeof e=="string")g=vy(e,n,ae.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case $:return e=_t(31,n,t,c),e.elementType=$,e.lanes=u,e;case C:return Ca(n.children,c,u,t);case j:g=8,c|=24;break;case M:return e=_t(12,n,t,c|2),e.elementType=M,e.lanes=u,e;case B:return e=_t(13,n,t,c),e.elementType=B,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 k:g=10;break e;case A:g=9;break e;case O:g=11;break e;case z:g=14;break e;case X: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 Ca(e,t,n,s){return e=_t(7,e,s,t),e.lanes=n,e}function Do(e,t,n){return e=_t(6,e,null,t),e.lanes=n,e}function Yd(e){var t=_t(18,null,null,0);return t.stateNode=e,t}function Oo(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 $d=new WeakMap;function Yt(e,t){if(typeof e=="object"&&e!==null){var n=$d.get(e);return n!==void 0?n:(t={value:e,source:t,stack:St(t)},$d.set(e,t),t)}return{value:e,source:t,stack:St(t)}}var rl=[],ol=0,Ei=null,rs=0,$t=[],Gt=0,Zn=null,on=1,cn="";function An(e,t){rl[ol++]=rs,rl[ol++]=Ei,Ei=e,rs=t}function Gd(e,t,n){$t[Gt++]=on,$t[Gt++]=cn,$t[Gt++]=Zn,Zn=e;var s=on;e=cn;var c=32-ve(s)-1;s&=~(1<<c),n+=1;var u=32-ve(t)+c;if(30<u){var g=c-c%5;u=(s&(1<<g)-1).toString(32),s>>=g,c-=g,on=1<<32-ve(t)+c|n<<c|s,cn=u+e}else on=1<<u|n<<c|s,cn=e}function Bo(e){e.return!==null&&(An(e,1),Gd(e,1,0))}function zo(e){for(;e===Ei;)Ei=rl[--ol],rl[ol]=null,rs=rl[--ol],rl[ol]=null;for(;e===Zn;)Zn=$t[--Gt],$t[Gt]=null,cn=$t[--Gt],$t[Gt]=null,on=$t[--Gt],$t[Gt]=null}function Xd(e,t){$t[Gt++]=on,$t[Gt++]=cn,$t[Gt++]=Zn,on=t.id,cn=t.overflow,Zn=e}var mt=null,Xe=null,qe=!1,Fn=null,Xt=!1,Lo=Error(r(519));function Jn(e){var t=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw os(Yt(t,e)),Lo}function Qd(e){var t=e.stateNode,n=e.type,s=e.memoizedProps;switch(t[dt]=e,t[jt]=s,n){case"dialog":Ne("cancel",t),Ne("close",t);break;case"iframe":case"object":case"embed":Ne("load",t);break;case"video":case"audio":for(n=0;n<Rs.length;n++)Ne(Rs[n],t);break;case"source":Ne("error",t);break;case"img":case"image":case"link":Ne("error",t),Ne("load",t);break;case"details":Ne("toggle",t);break;case"input":Ne("invalid",t),sd(t,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":Ne("invalid",t);break;case"textarea":Ne("invalid",t),rd(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||c0(t.textContent,n)?(s.popover!=null&&(Ne("beforetoggle",t),Ne("toggle",t)),s.onScroll!=null&&Ne("scroll",t),s.onScrollEnd!=null&&Ne("scrollend",t),s.onClick!=null&&(t.onclick=yn),t=!0):t=!1,t||Jn(e,!0)}function Kd(e){for(mt=e.return;mt;)switch(mt.tag){case 5:case 31:case 13:Xt=!1;return;case 27:case 3:Xt=!0;return;default:mt=mt.return}}function cl(e){if(e!==mt)return!1;if(!qe)return Kd(e),qe=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||nu(e.type,e.memoizedProps)),n=!n),n&&Xe&&Jn(e),Kd(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));Xe=v0(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));Xe=v0(e)}else t===27?(t=Xe,ua(e.type)?(e=ru,ru=null,Xe=e):Xe=t):Xe=mt?Kt(e.stateNode.nextSibling):null;return!0}function Ea(){Xe=mt=null,qe=!1}function Uo(){var e=Fn;return e!==null&&(qt===null?qt=e:qt.push.apply(qt,e),Fn=null),e}function os(e){Fn===null?Fn=[e]:Fn.push(e)}var Ho=w(null),qa=null,jn=null;function In(e,t,n){ee(Ho,t._currentValue),t._currentValue=n}function Nn(e){e._currentValue=Ho.current,U(Ho)}function Vo(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 Yo(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 b=u;u=c;for(var R=0;R<t.length;R++)if(b.context===t[R]){u.lanes|=n,b=u.alternate,b!==null&&(b.lanes|=n),Vo(u.return,n,e),s||(g=null);break e}u=b.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),Vo(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 ul(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 b=c.type;kt(c.pendingProps.value,g.value)||(e!==null?e.push(b):e=[b])}}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(Os):e=[Os])}c=c.return}e!==null&&Yo(t,e,n,s),t.flags|=262144}function qi(e){for(e=e.firstContext;e!==null;){if(!kt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ma(e){qa=e,jn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ht(e){return Zd(qa,e)}function Mi(e,t){return qa===null&&Ma(e),Zd(e,t)}function Zd(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},jn===null){if(e===null)throw Error(r(308));jn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else jn=jn.next=t;return n}var hv=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()})}},pv=a.unstable_scheduleCallback,gv=a.unstable_NormalPriority,tt={$$typeof:k,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function $o(){return{controller:new hv,data:new Map,refCount:0}}function cs(e){e.refCount--,e.refCount===0&&pv(gv,function(){e.controller.abort()})}var us=null,Go=0,fl=0,dl=null;function xv(e,t){if(us===null){var n=us=[];Go=0,fl=Kc(),dl={status:"pending",value:void 0,then:function(s){n.push(s)}}}return Go++,t.then(Fd,Fd),t}function Fd(){if(--Go===0&&us!==null){dl!==null&&(dl.status="fulfilled");var e=us;us=null,fl=0,dl=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function vv(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 Jd=T.S;T.S=function(e,t){_h=rt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&xv(e,t),Jd!==null&&Jd(e,t)};var Ra=w(null);function Xo(){var e=Ra.current;return e!==null?e:$e.pooledCache}function Ri(e,t){t===null?ee(Ra,Ra.current):ee(Ra,t.pool)}function Id(){var e=Xo();return e===null?null:{parent:tt._currentValue,pool:e}}var ml=Error(r(460)),Qo=Error(r(474)),Ti=Error(r(542)),ki={then:function(){}};function Wd(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Pd(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(yn,yn),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,tm(e),e;default:if(typeof t.status=="string")t.then(yn,yn);else{if(e=$e,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,tm(e),e}throw ka=t,ml}}function Ta(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(ka=n,ml):n}}var ka=null;function em(){if(ka===null)throw Error(r(459));var e=ka;return ka=null,e}function tm(e){if(e===ml||e===Ti)throw Error(r(483))}var hl=null,fs=0;function _i(e){var t=fs;return fs+=1,hl===null&&(hl=[]),Pd(hl,e,t)}function ds(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Di(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 nm(e){function t(D,_){if(e){var H=D.deletions;H===null?(D.deletions=[_],D.flags|=16):H.push(_)}}function n(D,_){if(!e)return null;for(;_!==null;)t(D,_),_=_.sibling;return null}function s(D){for(var _=new Map;D!==null;)D.key!==null?_.set(D.key,D):_.set(D.index,D),D=D.sibling;return _}function c(D,_){return D=Sn(D,_),D.index=0,D.sibling=null,D}function u(D,_,H){return D.index=H,e?(H=D.alternate,H!==null?(H=H.index,H<_?(D.flags|=67108866,_):H):(D.flags|=67108866,_)):(D.flags|=1048576,_)}function g(D){return e&&D.alternate===null&&(D.flags|=67108866),D}function b(D,_,H,I){return _===null||_.tag!==6?(_=Do(H,D.mode,I),_.return=D,_):(_=c(_,H),_.return=D,_)}function R(D,_,H,I){var he=H.type;return he===C?J(D,_,H.props.children,I,H.key):_!==null&&(_.elementType===he||typeof he=="object"&&he!==null&&he.$$typeof===X&&Ta(he)===_.type)?(_=c(_,H.props),ds(_,H),_.return=D,_):(_=Ci(H.type,H.key,H.props,null,D.mode,I),ds(_,H),_.return=D,_)}function V(D,_,H,I){return _===null||_.tag!==4||_.stateNode.containerInfo!==H.containerInfo||_.stateNode.implementation!==H.implementation?(_=Oo(H,D.mode,I),_.return=D,_):(_=c(_,H.children||[]),_.return=D,_)}function J(D,_,H,I,he){return _===null||_.tag!==7?(_=Ca(H,D.mode,I,he),_.return=D,_):(_=c(_,H),_.return=D,_)}function P(D,_,H){if(typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint")return _=Do(""+_,D.mode,H),_.return=D,_;if(typeof _=="object"&&_!==null){switch(_.$$typeof){case q:return H=Ci(_.type,_.key,_.props,null,D.mode,H),ds(H,_),H.return=D,H;case E:return _=Oo(_,D.mode,H),_.return=D,_;case X:return _=Ta(_),P(D,_,H)}if(W(_)||K(_))return _=Ca(_,D.mode,H,null),_.return=D,_;if(typeof _.then=="function")return P(D,_i(_),H);if(_.$$typeof===k)return P(D,Mi(D,_),H);Di(D,_)}return null}function Y(D,_,H,I){var he=_!==null?_.key:null;if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return he!==null?null:b(D,_,""+H,I);if(typeof H=="object"&&H!==null){switch(H.$$typeof){case q:return H.key===he?R(D,_,H,I):null;case E:return H.key===he?V(D,_,H,I):null;case X:return H=Ta(H),Y(D,_,H,I)}if(W(H)||K(H))return he!==null?null:J(D,_,H,I,null);if(typeof H.then=="function")return Y(D,_,_i(H),I);if(H.$$typeof===k)return Y(D,_,Mi(D,H),I);Di(D,H)}return null}function G(D,_,H,I,he){if(typeof I=="string"&&I!==""||typeof I=="number"||typeof I=="bigint")return D=D.get(H)||null,b(_,D,""+I,he);if(typeof I=="object"&&I!==null){switch(I.$$typeof){case q:return D=D.get(I.key===null?H:I.key)||null,R(_,D,I,he);case E:return D=D.get(I.key===null?H:I.key)||null,V(_,D,I,he);case X:return I=Ta(I),G(D,_,H,I,he)}if(W(I)||K(I))return D=D.get(H)||null,J(_,D,I,he,null);if(typeof I.then=="function")return G(D,_,H,_i(I),he);if(I.$$typeof===k)return G(D,_,H,Mi(_,I),he);Di(_,I)}return null}function ue(D,_,H,I){for(var he=null,Te=null,me=_,Ae=_=0,Ee=null;me!==null&&Ae<H.length;Ae++){me.index>Ae?(Ee=me,me=null):Ee=me.sibling;var ke=Y(D,me,H[Ae],I);if(ke===null){me===null&&(me=Ee);break}e&&me&&ke.alternate===null&&t(D,me),_=u(ke,_,Ae),Te===null?he=ke:Te.sibling=ke,Te=ke,me=Ee}if(Ae===H.length)return n(D,me),qe&&An(D,Ae),he;if(me===null){for(;Ae<H.length;Ae++)me=P(D,H[Ae],I),me!==null&&(_=u(me,_,Ae),Te===null?he=me:Te.sibling=me,Te=me);return qe&&An(D,Ae),he}for(me=s(me);Ae<H.length;Ae++)Ee=G(me,D,Ae,H[Ae],I),Ee!==null&&(e&&Ee.alternate!==null&&me.delete(Ee.key===null?Ae:Ee.key),_=u(Ee,_,Ae),Te===null?he=Ee:Te.sibling=Ee,Te=Ee);return e&&me.forEach(function(pa){return t(D,pa)}),qe&&An(D,Ae),he}function ge(D,_,H,I){if(H==null)throw Error(r(151));for(var he=null,Te=null,me=_,Ae=_=0,Ee=null,ke=H.next();me!==null&&!ke.done;Ae++,ke=H.next()){me.index>Ae?(Ee=me,me=null):Ee=me.sibling;var pa=Y(D,me,ke.value,I);if(pa===null){me===null&&(me=Ee);break}e&&me&&pa.alternate===null&&t(D,me),_=u(pa,_,Ae),Te===null?he=pa:Te.sibling=pa,Te=pa,me=Ee}if(ke.done)return n(D,me),qe&&An(D,Ae),he;if(me===null){for(;!ke.done;Ae++,ke=H.next())ke=P(D,ke.value,I),ke!==null&&(_=u(ke,_,Ae),Te===null?he=ke:Te.sibling=ke,Te=ke);return qe&&An(D,Ae),he}for(me=s(me);!ke.done;Ae++,ke=H.next())ke=G(me,D,Ae,ke.value,I),ke!==null&&(e&&ke.alternate!==null&&me.delete(ke.key===null?Ae:ke.key),_=u(ke,_,Ae),Te===null?he=ke:Te.sibling=ke,Te=ke);return e&&me.forEach(function(My){return t(D,My)}),qe&&An(D,Ae),he}function Ve(D,_,H,I){if(typeof H=="object"&&H!==null&&H.type===C&&H.key===null&&(H=H.props.children),typeof H=="object"&&H!==null){switch(H.$$typeof){case q:e:{for(var he=H.key;_!==null;){if(_.key===he){if(he=H.type,he===C){if(_.tag===7){n(D,_.sibling),I=c(_,H.props.children),I.return=D,D=I;break e}}else if(_.elementType===he||typeof he=="object"&&he!==null&&he.$$typeof===X&&Ta(he)===_.type){n(D,_.sibling),I=c(_,H.props),ds(I,H),I.return=D,D=I;break e}n(D,_);break}else t(D,_);_=_.sibling}H.type===C?(I=Ca(H.props.children,D.mode,I,H.key),I.return=D,D=I):(I=Ci(H.type,H.key,H.props,null,D.mode,I),ds(I,H),I.return=D,D=I)}return g(D);case E:e:{for(he=H.key;_!==null;){if(_.key===he)if(_.tag===4&&_.stateNode.containerInfo===H.containerInfo&&_.stateNode.implementation===H.implementation){n(D,_.sibling),I=c(_,H.children||[]),I.return=D,D=I;break e}else{n(D,_);break}else t(D,_);_=_.sibling}I=Oo(H,D.mode,I),I.return=D,D=I}return g(D);case X:return H=Ta(H),Ve(D,_,H,I)}if(W(H))return ue(D,_,H,I);if(K(H)){if(he=K(H),typeof he!="function")throw Error(r(150));return H=he.call(H),ge(D,_,H,I)}if(typeof H.then=="function")return Ve(D,_,_i(H),I);if(H.$$typeof===k)return Ve(D,_,Mi(D,H),I);Di(D,H)}return typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint"?(H=""+H,_!==null&&_.tag===6?(n(D,_.sibling),I=c(_,H),I.return=D,D=I):(n(D,_),I=Do(H,D.mode,I),I.return=D,D=I),g(D)):n(D,_)}return function(D,_,H,I){try{fs=0;var he=Ve(D,_,H,I);return hl=null,he}catch(me){if(me===ml||me===Ti)throw me;var Te=_t(29,me,null,D.mode);return Te.lanes=I,Te.return=D,Te}finally{}}}var _a=nm(!0),am=nm(!1),Wn=!1;function Ko(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Zo(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 Pn(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ea(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(De&2)!==0){var c=s.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),s.pending=t,t=wi(e),Hd(e,null,n),t}return Ni(e,s,t,n),wi(e)}function ms(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,Zf(e,n)}}function Fo(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 Jo=!1;function hs(){if(Jo){var e=dl;if(e!==null)throw e}}function ps(e,t,n,s){Jo=!1;var c=e.updateQueue;Wn=!1;var u=c.firstBaseUpdate,g=c.lastBaseUpdate,b=c.shared.pending;if(b!==null){c.shared.pending=null;var R=b,V=R.next;R.next=null,g===null?u=V:g.next=V,g=R;var J=e.alternate;J!==null&&(J=J.updateQueue,b=J.lastBaseUpdate,b!==g&&(b===null?J.firstBaseUpdate=V:b.next=V,J.lastBaseUpdate=R))}if(u!==null){var P=c.baseState;g=0,J=V=R=null,b=u;do{var Y=b.lane&-536870913,G=Y!==b.lane;if(G?(Ce&Y)===Y:(s&Y)===Y){Y!==0&&Y===fl&&(Jo=!0),J!==null&&(J=J.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var ue=e,ge=b;Y=t;var Ve=n;switch(ge.tag){case 1:if(ue=ge.payload,typeof ue=="function"){P=ue.call(Ve,P,Y);break e}P=ue;break e;case 3:ue.flags=ue.flags&-65537|128;case 0:if(ue=ge.payload,Y=typeof ue=="function"?ue.call(Ve,P,Y):ue,Y==null)break e;P=S({},P,Y);break e;case 2:Wn=!0}}Y=b.callback,Y!==null&&(e.flags|=64,G&&(e.flags|=8192),G=c.callbacks,G===null?c.callbacks=[Y]:G.push(Y))}else G={lane:Y,tag:b.tag,payload:b.payload,callback:b.callback,next:null},J===null?(V=J=G,R=P):J=J.next=G,g|=Y;if(b=b.next,b===null){if(b=c.shared.pending,b===null)break;G=b,b=G.next,G.next=null,c.lastBaseUpdate=G,c.shared.pending=null}}while(!0);J===null&&(R=P),c.baseState=R,c.firstBaseUpdate=V,c.lastBaseUpdate=J,u===null&&(c.shared.lanes=0),sa|=g,e.lanes=g,e.memoizedState=P}}function lm(e,t){if(typeof e!="function")throw Error(r(191,e));e.call(t)}function sm(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)lm(n[e],t)}var pl=w(null),Oi=w(0);function im(e,t){e=_n,ee(Oi,e),ee(pl,t),_n=e|t.baseLanes}function Io(){ee(Oi,_n),ee(pl,pl.current)}function Wo(){_n=Oi.current,U(pl),U(Oi)}var Dt=w(null),Qt=null;function ta(e){var t=e.alternate;ee(We,We.current&1),ee(Dt,e),Qt===null&&(t===null||pl.current!==null||t.memoizedState!==null)&&(Qt=e)}function Po(e){ee(We,We.current),ee(Dt,e),Qt===null&&(Qt=e)}function rm(e){e.tag===22?(ee(We,We.current),ee(Dt,e),Qt===null&&(Qt=e)):na()}function na(){ee(We,We.current),ee(Dt,Dt.current)}function Ot(e){U(Dt),Qt===e&&(Qt=null),U(We)}var We=w(0);function Bi(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||su(n)||iu(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 wn=0,be=null,Ue=null,nt=null,zi=!1,gl=!1,Da=!1,Li=0,gs=0,xl=null,yv=0;function Je(){throw Error(r(321))}function ec(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!kt(e[n],t[n]))return!1;return!0}function tc(e,t,n,s,c,u){return wn=u,be=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,T.H=e===null||e.memoizedState===null?Gm:gc,Da=!1,u=n(s,c),Da=!1,gl&&(u=cm(t,n,s,c)),om(e),u}function om(e){T.H=ys;var t=Ue!==null&&Ue.next!==null;if(wn=0,nt=Ue=be=null,zi=!1,gs=0,xl=null,t)throw Error(r(300));e===null||at||(e=e.dependencies,e!==null&&qi(e)&&(at=!0))}function cm(e,t,n,s){be=e;var c=0;do{if(gl&&(xl=null),gs=0,gl=!1,25<=c)throw Error(r(301));if(c+=1,nt=Ue=null,e.updateQueue!=null){var u=e.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}T.H=Xm,u=t(n,s)}while(gl);return u}function bv(){var e=T.H,t=e.useState()[0];return t=typeof t.then=="function"?xs(t):t,e=e.useState()[0],(Ue!==null?Ue.memoizedState:null)!==e&&(be.flags|=1024),t}function nc(){var e=Li!==0;return Li=0,e}function ac(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function lc(e){if(zi){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}zi=!1}wn=0,nt=Ue=be=null,gl=!1,gs=Li=0,xl=null}function bt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return nt===null?be.memoizedState=nt=e:nt=nt.next=e,nt}function Pe(){if(Ue===null){var e=be.alternate;e=e!==null?e.memoizedState:null}else e=Ue.next;var t=nt===null?be.memoizedState:nt.next;if(t!==null)nt=t,Ue=e;else{if(e===null)throw be.alternate===null?Error(r(467)):Error(r(310));Ue=e,e={memoizedState:Ue.memoizedState,baseState:Ue.baseState,baseQueue:Ue.baseQueue,queue:Ue.queue,next:null},nt===null?be.memoizedState=nt=e:nt=nt.next=e}return nt}function Ui(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function xs(e){var t=gs;return gs+=1,xl===null&&(xl=[]),e=Pd(xl,e,t),t=be,(nt===null?t.memoizedState:nt.next)===null&&(t=t.alternate,T.H=t===null||t.memoizedState===null?Gm:gc),e}function Hi(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return xs(e);if(e.$$typeof===k)return ht(e)}throw Error(r(438,String(e)))}function sc(e){var t=null,n=be.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var s=be.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=Ui(),be.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]=Q;return t.index++,n}function Cn(e,t){return typeof t=="function"?t(e):t}function Vi(e){var t=Pe();return ic(t,Ue,e)}function ic(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 b=g=null,R=null,V=t,J=!1;do{var P=V.lane&-536870913;if(P!==V.lane?(Ce&P)===P:(wn&P)===P){var Y=V.revertLane;if(Y===0)R!==null&&(R=R.next={lane:0,revertLane:0,gesture:null,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null}),P===fl&&(J=!0);else if((wn&Y)===Y){V=V.next,Y===fl&&(J=!0);continue}else P={lane:0,revertLane:V.revertLane,gesture:null,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null},R===null?(b=R=P,g=u):R=R.next=P,be.lanes|=Y,sa|=Y;P=V.action,Da&&n(u,P),u=V.hasEagerState?V.eagerState:n(u,P)}else Y={lane:P,revertLane:V.revertLane,gesture:V.gesture,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null},R===null?(b=R=Y,g=u):R=R.next=Y,be.lanes|=P,sa|=P;V=V.next}while(V!==null&&V!==t);if(R===null?g=u:R.next=b,!kt(u,e.memoizedState)&&(at=!0,J&&(n=dl,n!==null)))throw n;e.memoizedState=u,e.baseState=g,e.baseQueue=R,s.lastRenderedState=u}return c===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function rc(e){var t=Pe(),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);kt(u,t.memoizedState)||(at=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),n.lastRenderedState=u}return[u,s]}function um(e,t,n){var s=be,c=Pe(),u=qe;if(u){if(n===void 0)throw Error(r(407));n=n()}else n=t();var g=!kt((Ue||c).memoizedState,n);if(g&&(c.memoizedState=n,at=!0),c=c.queue,uc(mm.bind(null,s,c,e),[e]),c.getSnapshot!==t||g||nt!==null&&nt.memoizedState.tag&1){if(s.flags|=2048,vl(9,{destroy:void 0},dm.bind(null,s,c,n,t),null),$e===null)throw Error(r(349));u||(wn&127)!==0||fm(s,t,n)}return n}function fm(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=be.updateQueue,t===null?(t=Ui(),be.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function dm(e,t,n,s){t.value=n,t.getSnapshot=s,hm(t)&&pm(e)}function mm(e,t,n){return n(function(){hm(t)&&pm(e)})}function hm(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!kt(e,n)}catch{return!0}}function pm(e){var t=wa(e,2);t!==null&&Mt(t,e,2)}function oc(e){var t=bt();if(typeof e=="function"){var n=e;if(e=n(),Da){ot(!0);try{n()}finally{ot(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Cn,lastRenderedState:e},t}function gm(e,t,n,s){return e.baseState=n,ic(e,Ue,typeof s=="function"?s:Cn)}function Sv(e,t,n,s,c){if(Gi(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)}};T.T!==null?n(!0):u.isTransition=!1,s(u),n=t.pending,n===null?(u.next=t.pending=u,xm(t,u)):(u.next=n.next,t.pending=n.next=u)}}function xm(e,t){var n=t.action,s=t.payload,c=e.state;if(t.isTransition){var u=T.T,g={};T.T=g;try{var b=n(c,s),R=T.S;R!==null&&R(g,b),vm(e,t,b)}catch(V){cc(e,t,V)}finally{u!==null&&g.types!==null&&(u.types=g.types),T.T=u}}else try{u=n(c,s),vm(e,t,u)}catch(V){cc(e,t,V)}}function vm(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(s){ym(e,t,s)},function(s){return cc(e,t,s)}):ym(e,t,n)}function ym(e,t,n){t.status="fulfilled",t.value=n,bm(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,xm(e,n)))}function cc(e,t,n){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=n,bm(t),t=t.next;while(t!==s)}e.action=null}function bm(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Sm(e,t){return t}function Am(e,t){if(qe){var n=$e.formState;if(n!==null){e:{var s=be;if(qe){if(Xe){t:{for(var c=Xe,u=Xt;c.nodeType!==8;){if(!u){c=null;break t}if(c=Kt(c.nextSibling),c===null){c=null;break t}}u=c.data,c=u==="F!"||u==="F"?c:null}if(c){Xe=Kt(c.nextSibling),s=c.data==="F!";break e}}Jn(s)}s=!1}s&&(t=n[0])}}return n=bt(),n.memoizedState=n.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sm,lastRenderedState:t},n.queue=s,n=Vm.bind(null,be,s),s.dispatch=n,s=oc(!1),u=pc.bind(null,be,!1,s.queue),s=bt(),c={state:t,dispatch:null,action:e,pending:null},s.queue=c,n=Sv.bind(null,be,c,u,n),c.dispatch=n,s.memoizedState=e,[t,n,!1]}function jm(e){var t=Pe();return Nm(t,Ue,e)}function Nm(e,t,n){if(t=ic(e,t,Sm)[0],e=Vi(Cn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=xs(t)}catch(g){throw g===ml?Ti:g}else s=t;t=Pe();var c=t.queue,u=c.dispatch;return n!==t.memoizedState&&(be.flags|=2048,vl(9,{destroy:void 0},Av.bind(null,c,n),null)),[s,u,e]}function Av(e,t){e.action=t}function wm(e){var t=Pe(),n=Ue;if(n!==null)return Nm(t,n,e);Pe(),t=t.memoizedState,n=Pe();var s=n.queue.dispatch;return n.memoizedState=e,[t,s,!1]}function vl(e,t,n,s){return e={tag:e,create:n,deps:s,inst:t,next:null},t=be.updateQueue,t===null&&(t=Ui(),be.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 Cm(){return Pe().memoizedState}function Yi(e,t,n,s){var c=bt();be.flags|=e,c.memoizedState=vl(1|t,{destroy:void 0},n,s===void 0?null:s)}function $i(e,t,n,s){var c=Pe();s=s===void 0?null:s;var u=c.memoizedState.inst;Ue!==null&&s!==null&&ec(s,Ue.memoizedState.deps)?c.memoizedState=vl(t,u,n,s):(be.flags|=e,c.memoizedState=vl(1|t,u,n,s))}function Em(e,t){Yi(8390656,8,e,t)}function uc(e,t){$i(2048,8,e,t)}function jv(e){be.flags|=4;var t=be.updateQueue;if(t===null)t=Ui(),be.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function qm(e){var t=Pe().memoizedState;return jv({ref:t,nextImpl:e}),function(){if((De&2)!==0)throw Error(r(440));return t.impl.apply(void 0,arguments)}}function Mm(e,t){return $i(4,2,e,t)}function Rm(e,t){return $i(4,4,e,t)}function Tm(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 km(e,t,n){n=n!=null?n.concat([e]):null,$i(4,4,Tm.bind(null,t,e),n)}function fc(){}function _m(e,t){var n=Pe();t=t===void 0?null:t;var s=n.memoizedState;return t!==null&&ec(t,s[1])?s[0]:(n.memoizedState=[e,t],e)}function Dm(e,t){var n=Pe();t=t===void 0?null:t;var s=n.memoizedState;if(t!==null&&ec(t,s[1]))return s[0];if(s=e(),Da){ot(!0);try{e()}finally{ot(!1)}}return n.memoizedState=[s,t],s}function dc(e,t,n){return n===void 0||(wn&1073741824)!==0&&(Ce&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=Oh(),be.lanes|=e,sa|=e,n)}function Om(e,t,n,s){return kt(n,t)?n:pl.current!==null?(e=dc(e,n,s),kt(e,t)||(at=!0),e):(wn&42)===0||(wn&1073741824)!==0&&(Ce&261930)===0?(at=!0,e.memoizedState=n):(e=Oh(),be.lanes|=e,sa|=e,t)}function Bm(e,t,n,s,c){var u=F.p;F.p=u!==0&&8>u?u:8;var g=T.T,b={};T.T=b,pc(e,!1,t,n);try{var R=c(),V=T.S;if(V!==null&&V(b,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var J=vv(R,s);vs(e,t,J,Lt(e))}else vs(e,t,s,Lt(e))}catch(P){vs(e,t,{then:function(){},status:"rejected",reason:P},Lt())}finally{F.p=u,g!==null&&b.types!==null&&(g.types=b.types),T.T=g}}function Nv(){}function mc(e,t,n,s){if(e.tag!==5)throw Error(r(476));var c=zm(e).queue;Bm(e,c,t,ne,n===null?Nv:function(){return Lm(e),n(s)})}function zm(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Cn,lastRenderedState:ne},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Cn,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Lm(e){var t=zm(e);t.next===null&&(t=e.alternate.memoizedState),vs(e,t.next.queue,{},Lt())}function hc(){return ht(Os)}function Um(){return Pe().memoizedState}function Hm(){return Pe().memoizedState}function wv(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Lt();e=Pn(n);var s=ea(t,e,n);s!==null&&(Mt(s,t,n),ms(s,t,n)),t={cache:$o()},e.payload=t;return}t=t.return}}function Cv(e,t,n){var s=Lt();n={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Gi(e)?Ym(t,n):(n=ko(e,t,n,s),n!==null&&(Mt(n,e,s),$m(n,t,s)))}function Vm(e,t,n){var s=Lt();vs(e,t,n,s)}function vs(e,t,n,s){var c={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Gi(e))Ym(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,b=u(g,n);if(c.hasEagerState=!0,c.eagerState=b,kt(b,g))return Ni(e,t,c,0),$e===null&&ji(),!1}catch{}finally{}if(n=ko(e,t,c,s),n!==null)return Mt(n,e,s),$m(n,t,s),!0}return!1}function pc(e,t,n,s){if(s={lane:2,revertLane:Kc(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Gi(e)){if(t)throw Error(r(479))}else t=ko(e,n,s,2),t!==null&&Mt(t,e,2)}function Gi(e){var t=e.alternate;return e===be||t!==null&&t===be}function Ym(e,t){gl=zi=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function $m(e,t,n){if((n&4194048)!==0){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,Zf(e,n)}}var ys={readContext:ht,use:Hi,useCallback:Je,useContext:Je,useEffect:Je,useImperativeHandle:Je,useLayoutEffect:Je,useInsertionEffect:Je,useMemo:Je,useReducer:Je,useRef:Je,useState:Je,useDebugValue:Je,useDeferredValue:Je,useTransition:Je,useSyncExternalStore:Je,useId:Je,useHostTransitionStatus:Je,useFormState:Je,useActionState:Je,useOptimistic:Je,useMemoCache:Je,useCacheRefresh:Je};ys.useEffectEvent=Je;var Gm={readContext:ht,use:Hi,useCallback:function(e,t){return bt().memoizedState=[e,t===void 0?null:t],e},useContext:ht,useEffect:Em,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Yi(4194308,4,Tm.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Yi(4194308,4,e,t)},useInsertionEffect:function(e,t){Yi(4,2,e,t)},useMemo:function(e,t){var n=bt();t=t===void 0?null:t;var s=e();if(Da){ot(!0);try{e()}finally{ot(!1)}}return n.memoizedState=[s,t],s},useReducer:function(e,t,n){var s=bt();if(n!==void 0){var c=n(t);if(Da){ot(!0);try{n(t)}finally{ot(!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=Cv.bind(null,be,e),[s.memoizedState,e]},useRef:function(e){var t=bt();return e={current:e},t.memoizedState=e},useState:function(e){e=oc(e);var t=e.queue,n=Vm.bind(null,be,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:fc,useDeferredValue:function(e,t){var n=bt();return dc(n,e,t)},useTransition:function(){var e=oc(!1);return e=Bm.bind(null,be,e.queue,!0,!1),bt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var s=be,c=bt();if(qe){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),$e===null)throw Error(r(349));(Ce&127)!==0||fm(s,t,n)}c.memoizedState=n;var u={value:n,getSnapshot:t};return c.queue=u,Em(mm.bind(null,s,u,e),[e]),s.flags|=2048,vl(9,{destroy:void 0},dm.bind(null,s,u,n,t),null),n},useId:function(){var e=bt(),t=$e.identifierPrefix;if(qe){var n=cn,s=on;n=(s&~(1<<32-ve(s)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Li++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=yv++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:hc,useFormState:Am,useActionState:Am,useOptimistic:function(e){var t=bt();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=pc.bind(null,be,!0,n),n.dispatch=t,[e,t]},useMemoCache:sc,useCacheRefresh:function(){return bt().memoizedState=wv.bind(null,be)},useEffectEvent:function(e){var t=bt(),n={impl:e};return t.memoizedState=n,function(){if((De&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}},gc={readContext:ht,use:Hi,useCallback:_m,useContext:ht,useEffect:uc,useImperativeHandle:km,useInsertionEffect:Mm,useLayoutEffect:Rm,useMemo:Dm,useReducer:Vi,useRef:Cm,useState:function(){return Vi(Cn)},useDebugValue:fc,useDeferredValue:function(e,t){var n=Pe();return Om(n,Ue.memoizedState,e,t)},useTransition:function(){var e=Vi(Cn)[0],t=Pe().memoizedState;return[typeof e=="boolean"?e:xs(e),t]},useSyncExternalStore:um,useId:Um,useHostTransitionStatus:hc,useFormState:jm,useActionState:jm,useOptimistic:function(e,t){var n=Pe();return gm(n,Ue,e,t)},useMemoCache:sc,useCacheRefresh:Hm};gc.useEffectEvent=qm;var Xm={readContext:ht,use:Hi,useCallback:_m,useContext:ht,useEffect:uc,useImperativeHandle:km,useInsertionEffect:Mm,useLayoutEffect:Rm,useMemo:Dm,useReducer:rc,useRef:Cm,useState:function(){return rc(Cn)},useDebugValue:fc,useDeferredValue:function(e,t){var n=Pe();return Ue===null?dc(n,e,t):Om(n,Ue.memoizedState,e,t)},useTransition:function(){var e=rc(Cn)[0],t=Pe().memoizedState;return[typeof e=="boolean"?e:xs(e),t]},useSyncExternalStore:um,useId:Um,useHostTransitionStatus:hc,useFormState:wm,useActionState:wm,useOptimistic:function(e,t){var n=Pe();return Ue!==null?gm(n,Ue,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:sc,useCacheRefresh:Hm};Xm.useEffectEvent=qm;function xc(e,t,n,s){t=e.memoizedState,n=n(s,t),n=n==null?t:S({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var vc={enqueueSetState:function(e,t,n){e=e._reactInternals;var s=Lt(),c=Pn(s);c.payload=t,n!=null&&(c.callback=n),t=ea(e,c,s),t!==null&&(Mt(t,e,s),ms(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var s=Lt(),c=Pn(s);c.tag=1,c.payload=t,n!=null&&(c.callback=n),t=ea(e,c,s),t!==null&&(Mt(t,e,s),ms(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Lt(),s=Pn(n);s.tag=2,t!=null&&(s.callback=t),t=ea(e,s,n),t!==null&&(Mt(t,e,n),ms(t,e,n))}};function Qm(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?!ss(n,s)||!ss(c,u):!0}function Km(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&&vc.enqueueReplaceState(t,t.state,null)}function Oa(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=S({},n));for(var c in e)n[c]===void 0&&(n[c]=e[c])}return n}function Zm(e){Ai(e)}function Fm(e){console.error(e)}function Jm(e){Ai(e)}function Xi(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function Im(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 yc(e,t,n){return n=Pn(n),n.tag=3,n.payload={element:null},n.callback=function(){Xi(e,t)},n}function Wm(e){return e=Pn(e),e.tag=3,e}function Pm(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(){Im(t,n,s)}}var g=n.stateNode;g!==null&&typeof g.componentDidCatch=="function"&&(e.callback=function(){Im(t,n,s),typeof c!="function"&&(ia===null?ia=new Set([this]):ia.add(this));var b=s.stack;this.componentDidCatch(s.value,{componentStack:b!==null?b:""})})}function Ev(e,t,n,s,c){if(n.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=n.alternate,t!==null&&ul(t,n,c,!0),n=Dt.current,n!==null){switch(n.tag){case 31:case 13:return Qt===null?ar():n.alternate===null&&Ie===0&&(Ie=3),n.flags&=-257,n.flags|=65536,n.lanes=c,s===ki?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([s]):t.add(s),Gc(e,s,c)),!1;case 22:return n.flags|=65536,s===ki?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)),Gc(e,s,c)),!1}throw Error(r(435,n.tag))}return Gc(e,s,c),ar(),!1}if(qe)return t=Dt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,s!==Lo&&(e=Error(r(422),{cause:s}),os(Yt(e,n)))):(s!==Lo&&(t=Error(r(423),{cause:s}),os(Yt(t,n))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,s=Yt(s,n),c=yc(e.stateNode,s,c),Fo(e,c),Ie!==4&&(Ie=2)),!1;var u=Error(r(520),{cause:s});if(u=Yt(u,n),Es===null?Es=[u]:Es.push(u),Ie!==4&&(Ie=2),t===null)return!0;s=Yt(s,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=c&-c,n.lanes|=e,e=yc(n.stateNode,s,e),Fo(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"&&(ia===null||!ia.has(u))))return n.flags|=65536,c&=-c,n.lanes|=c,c=Wm(c),Pm(c,e,n,s),Fo(n,c),!1}n=n.return}while(n!==null);return!1}var bc=Error(r(461)),at=!1;function pt(e,t,n,s){t.child=e===null?am(t,null,n,s):_a(t,e.child,n,s)}function eh(e,t,n,s,c){n=n.render;var u=t.ref;if("ref"in s){var g={};for(var b in s)b!=="ref"&&(g[b]=s[b])}else g=s;return Ma(t),s=tc(e,t,n,g,u,c),b=nc(),e!==null&&!at?(ac(e,t,c),En(e,t,c)):(qe&&b&&Bo(t),t.flags|=1,pt(e,t,s,c),t.child)}function th(e,t,n,s,c){if(e===null){var u=n.type;return typeof u=="function"&&!_o(u)&&u.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=u,nh(e,t,u,s,c)):(e=Ci(n.type,null,s,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!qc(e,c)){var g=u.memoizedProps;if(n=n.compare,n=n!==null?n:ss,n(g,s)&&e.ref===t.ref)return En(e,t,c)}return t.flags|=1,e=Sn(u,s),e.ref=t.ref,e.return=t,t.child=e}function nh(e,t,n,s,c){if(e!==null){var u=e.memoizedProps;if(ss(u,s)&&e.ref===t.ref)if(at=!1,t.pendingProps=s=u,qc(e,c))(e.flags&131072)!==0&&(at=!0);else return t.lanes=e.lanes,En(e,t,c)}return Sc(e,t,n,s,c)}function ah(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 lh(e,t,u,n,s)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ri(t,u!==null?u.cachePool:null),u!==null?im(t,u):Io(),rm(t);else return s=t.lanes=536870912,lh(e,t,u!==null?u.baseLanes|n:n,n,s)}else u!==null?(Ri(t,u.cachePool),im(t,u),na(),t.memoizedState=null):(e!==null&&Ri(t,null),Io(),na());return pt(e,t,c,n),t.child}function bs(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function lh(e,t,n,s,c){var u=Xo();return u=u===null?null:{parent:tt._currentValue,pool:u},t.memoizedState={baseLanes:n,cachePool:u},e!==null&&Ri(t,null),Io(),rm(t),e!==null&&ul(e,t,s,!0),t.childLanes=c,null}function Qi(e,t){return t=Zi({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function sh(e,t,n){return _a(t,e.child,null,n),e=Qi(t,t.pendingProps),e.flags|=2,Ot(t),t.memoizedState=null,e}function qv(e,t,n){var s=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(qe){if(s.mode==="hidden")return e=Qi(t,s),t.lanes=536870912,bs(null,e);if(Po(t),(e=Xe)?(e=x0(e,Xt),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Zn!==null?{id:on,overflow:cn}:null,retryLane:536870912,hydrationErrors:null},n=Yd(e),n.return=t,t.child=n,mt=t,Xe=null)):e=null,e===null)throw Jn(t);return t.lanes=536870912,null}return Qi(t,s)}var u=e.memoizedState;if(u!==null){var g=u.dehydrated;if(Po(t),c)if(t.flags&256)t.flags&=-257,t=sh(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(r(558));else if(at||ul(e,t,n,!1),c=(n&e.childLanes)!==0,at||c){if(s=$e,s!==null&&(g=Ff(s,n),g!==0&&g!==u.retryLane))throw u.retryLane=g,wa(e,g),Mt(s,e,g),bc;ar(),t=sh(e,t,n)}else e=u.treeContext,Xe=Kt(g.nextSibling),mt=t,qe=!0,Fn=null,Xt=!1,e!==null&&Xd(t,e),t=Qi(t,s),t.flags|=4096;return t}return e=Sn(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Ki(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 Sc(e,t,n,s,c){return Ma(t),n=tc(e,t,n,s,void 0,c),s=nc(),e!==null&&!at?(ac(e,t,c),En(e,t,c)):(qe&&s&&Bo(t),t.flags|=1,pt(e,t,n,c),t.child)}function ih(e,t,n,s,c,u){return Ma(t),t.updateQueue=null,n=cm(t,s,n,c),om(e),s=nc(),e!==null&&!at?(ac(e,t,u),En(e,t,u)):(qe&&s&&Bo(t),t.flags|=1,pt(e,t,n,u),t.child)}function rh(e,t,n,s,c){if(Ma(t),t.stateNode===null){var u=il,g=n.contextType;typeof g=="object"&&g!==null&&(u=ht(g)),u=new n(s,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=vc,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=s,u.state=t.memoizedState,u.refs={},Ko(t),g=n.contextType,u.context=typeof g=="object"&&g!==null?ht(g):il,u.state=t.memoizedState,g=n.getDerivedStateFromProps,typeof g=="function"&&(xc(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&&vc.enqueueReplaceState(u,u.state,null),ps(t,s,u,c),hs(),u.state=t.memoizedState),typeof u.componentDidMount=="function"&&(t.flags|=4194308),s=!0}else if(e===null){u=t.stateNode;var b=t.memoizedProps,R=Oa(n,b);u.props=R;var V=u.context,J=n.contextType;g=il,typeof J=="object"&&J!==null&&(g=ht(J));var P=n.getDerivedStateFromProps;J=typeof P=="function"||typeof u.getSnapshotBeforeUpdate=="function",b=t.pendingProps!==b,J||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(b||V!==g)&&Km(t,u,s,g),Wn=!1;var Y=t.memoizedState;u.state=Y,ps(t,s,u,c),hs(),V=t.memoizedState,b||Y!==V||Wn?(typeof P=="function"&&(xc(t,n,P,s),V=t.memoizedState),(R=Wn||Qm(t,n,R,s,Y,V,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=V),u.props=s,u.state=V,u.context=g,s=R):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{u=t.stateNode,Zo(e,t),g=t.memoizedProps,J=Oa(n,g),u.props=J,P=t.pendingProps,Y=u.context,V=n.contextType,R=il,typeof V=="object"&&V!==null&&(R=ht(V)),b=n.getDerivedStateFromProps,(V=typeof b=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(g!==P||Y!==R)&&Km(t,u,s,R),Wn=!1,Y=t.memoizedState,u.state=Y,ps(t,s,u,c),hs();var G=t.memoizedState;g!==P||Y!==G||Wn||e!==null&&e.dependencies!==null&&qi(e.dependencies)?(typeof b=="function"&&(xc(t,n,b,s),G=t.memoizedState),(J=Wn||Qm(t,n,J,s,Y,G,R)||e!==null&&e.dependencies!==null&&qi(e.dependencies))?(V||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(s,G,R),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(s,G,R)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||g===e.memoizedProps&&Y===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||g===e.memoizedProps&&Y===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=G),u.props=s,u.state=G,u.context=R,s=J):(typeof u.componentDidUpdate!="function"||g===e.memoizedProps&&Y===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||g===e.memoizedProps&&Y===e.memoizedState||(t.flags|=1024),s=!1)}return u=s,Ki(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=_a(t,e.child,null,c),t.child=_a(t,null,n,c)):pt(e,t,n,c),t.memoizedState=u.state,e=t.child):e=En(e,t,c),e}function oh(e,t,n,s){return Ea(),t.flags|=256,pt(e,t,n,s),t.child}var Ac={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function jc(e){return{baseLanes:e,cachePool:Id()}}function Nc(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=zt),e}function ch(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:(We.current&2)!==0),g&&(c=!0,t.flags&=-129),g=(t.flags&32)!==0,t.flags&=-33,e===null){if(qe){if(c?ta(t):na(),(e=Xe)?(e=x0(e,Xt),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Zn!==null?{id:on,overflow:cn}:null,retryLane:536870912,hydrationErrors:null},n=Yd(e),n.return=t,t.child=n,mt=t,Xe=null)):e=null,e===null)throw Jn(t);return iu(e)?t.lanes=32:t.lanes=536870912,null}var b=s.children;return s=s.fallback,c?(na(),c=t.mode,b=Zi({mode:"hidden",children:b},c),s=Ca(s,c,n,null),b.return=t,s.return=t,b.sibling=s,t.child=b,s=t.child,s.memoizedState=jc(n),s.childLanes=Nc(e,g,n),t.memoizedState=Ac,bs(null,s)):(ta(t),wc(t,b))}var R=e.memoizedState;if(R!==null&&(b=R.dehydrated,b!==null)){if(u)t.flags&256?(ta(t),t.flags&=-257,t=Cc(e,t,n)):t.memoizedState!==null?(na(),t.child=e.child,t.flags|=128,t=null):(na(),b=s.fallback,c=t.mode,s=Zi({mode:"visible",children:s.children},c),b=Ca(b,c,n,null),b.flags|=2,s.return=t,b.return=t,s.sibling=b,t.child=s,_a(t,e.child,null,n),s=t.child,s.memoizedState=jc(n),s.childLanes=Nc(e,g,n),t.memoizedState=Ac,t=bs(null,s));else if(ta(t),iu(b)){if(g=b.nextSibling&&b.nextSibling.dataset,g)var V=g.dgst;g=V,s=Error(r(419)),s.stack="",s.digest=g,os({value:s,source:null,stack:null}),t=Cc(e,t,n)}else if(at||ul(e,t,n,!1),g=(n&e.childLanes)!==0,at||g){if(g=$e,g!==null&&(s=Ff(g,n),s!==0&&s!==R.retryLane))throw R.retryLane=s,wa(e,s),Mt(g,e,s),bc;su(b)||ar(),t=Cc(e,t,n)}else su(b)?(t.flags|=192,t.child=e.child,t=null):(e=R.treeContext,Xe=Kt(b.nextSibling),mt=t,qe=!0,Fn=null,Xt=!1,e!==null&&Xd(t,e),t=wc(t,s.children),t.flags|=4096);return t}return c?(na(),b=s.fallback,c=t.mode,R=e.child,V=R.sibling,s=Sn(R,{mode:"hidden",children:s.children}),s.subtreeFlags=R.subtreeFlags&65011712,V!==null?b=Sn(V,b):(b=Ca(b,c,n,null),b.flags|=2),b.return=t,s.return=t,s.sibling=b,t.child=s,bs(null,s),s=t.child,b=e.child.memoizedState,b===null?b=jc(n):(c=b.cachePool,c!==null?(R=tt._currentValue,c=c.parent!==R?{parent:R,pool:R}:c):c=Id(),b={baseLanes:b.baseLanes|n,cachePool:c}),s.memoizedState=b,s.childLanes=Nc(e,g,n),t.memoizedState=Ac,bs(e.child,s)):(ta(t),n=e.child,e=n.sibling,n=Sn(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 wc(e,t){return t=Zi({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Zi(e,t){return e=_t(22,e,null,t),e.lanes=0,e}function Cc(e,t,n){return _a(t,e.child,null,n),e=wc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function uh(e,t,n){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),Vo(e.return,t,n)}function Ec(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 fh(e,t,n){var s=t.pendingProps,c=s.revealOrder,u=s.tail;s=s.children;var g=We.current,b=(g&2)!==0;if(b?(g=g&1|2,t.flags|=128):g&=1,ee(We,g),pt(e,t,s,n),s=qe?rs:0,!b&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&uh(e,n,t);else if(e.tag===19)uh(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&&Bi(e)===null&&(c=n),n=n.sibling;n=c,n===null?(c=t.child,t.child=null):(c=n.sibling,n.sibling=null),Ec(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&&Bi(e)===null){t.child=c;break}e=c.sibling,c.sibling=n,n=c,c=e}Ec(t,!0,n,null,u,s);break;case"together":Ec(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function En(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),sa|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(ul(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=Sn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Sn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function qc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&qi(e)))}function Mv(e,t,n){switch(t.tag){case 3:xe(t,t.stateNode.containerInfo),In(t,tt,e.memoizedState.cache),Ea();break;case 27:case 5:Re(t);break;case 4:xe(t,t.stateNode.containerInfo);break;case 10:In(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Po(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(ta(t),t.flags|=128,null):(n&t.child.childLanes)!==0?ch(e,t,n):(ta(t),e=En(e,t,n),e!==null?e.sibling:null);ta(t);break;case 19:var c=(e.flags&128)!==0;if(s=(n&t.childLanes)!==0,s||(ul(e,t,n,!1),s=(n&t.childLanes)!==0),c){if(s)return fh(e,t,n);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),ee(We,We.current),s)break;return null;case 22:return t.lanes=0,ah(e,t,n,t.pendingProps);case 24:In(t,tt,e.memoizedState.cache)}return En(e,t,n)}function dh(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)at=!0;else{if(!qc(e,n)&&(t.flags&128)===0)return at=!1,Mv(e,t,n);at=(e.flags&131072)!==0}else at=!1,qe&&(t.flags&1048576)!==0&&Gd(t,rs,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=Ta(t.elementType),t.type=e,typeof e=="function")_o(e)?(s=Oa(e,s),t.tag=1,t=rh(null,t,e,s,n)):(t.tag=0,t=Sc(null,t,e,s,n));else{if(e!=null){var c=e.$$typeof;if(c===O){t.tag=11,t=eh(null,t,e,s,n);break e}else if(c===z){t.tag=14,t=th(null,t,e,s,n);break e}}throw t=ce(e)||e,Error(r(306,t,""))}}return t;case 0:return Sc(e,t,t.type,t.pendingProps,n);case 1:return s=t.type,c=Oa(s,t.pendingProps),rh(e,t,s,c,n);case 3:e:{if(xe(t,t.stateNode.containerInfo),e===null)throw Error(r(387));s=t.pendingProps;var u=t.memoizedState;c=u.element,Zo(e,t),ps(t,s,null,n);var g=t.memoizedState;if(s=g.cache,In(t,tt,s),s!==u.cache&&Yo(t,[tt],n,!0),hs(),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=oh(e,t,s,n);break e}else if(s!==c){c=Yt(Error(r(424)),t),os(c),t=oh(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(Xe=Kt(e.firstChild),mt=t,qe=!0,Fn=null,Xt=!0,n=am(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ea(),s===c){t=En(e,t,n);break e}pt(e,t,s,n)}t=t.child}return t;case 26:return Ki(e,t),e===null?(n=j0(t.type,null,t.pendingProps,null))?t.memoizedState=n:qe||(n=t.type,e=t.pendingProps,s=ur(ie.current).createElement(n),s[dt]=t,s[jt]=e,gt(s,n,e),ut(s),t.stateNode=s):t.memoizedState=j0(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Re(t),e===null&&qe&&(s=t.stateNode=b0(t.type,t.pendingProps,ie.current),mt=t,Xt=!0,c=Xe,ua(t.type)?(ru=c,Xe=Kt(s.firstChild)):Xe=c),pt(e,t,t.pendingProps.children,n),Ki(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&qe&&((c=s=Xe)&&(s=sy(s,t.type,t.pendingProps,Xt),s!==null?(t.stateNode=s,mt=t,Xe=Kt(s.firstChild),Xt=!1,c=!0):c=!1),c||Jn(t)),Re(t),c=t.type,u=t.pendingProps,g=e!==null?e.memoizedProps:null,s=u.children,nu(c,u)?s=null:g!==null&&nu(c,g)&&(t.flags|=32),t.memoizedState!==null&&(c=tc(e,t,bv,null,null,n),Os._currentValue=c),Ki(e,t),pt(e,t,s,n),t.child;case 6:return e===null&&qe&&((e=n=Xe)&&(n=iy(n,t.pendingProps,Xt),n!==null?(t.stateNode=n,mt=t,Xe=null,e=!0):e=!1),e||Jn(t)),null;case 13:return ch(e,t,n);case 4:return xe(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=_a(t,null,s,n):pt(e,t,s,n),t.child;case 11:return eh(e,t,t.type,t.pendingProps,n);case 7:return pt(e,t,t.pendingProps,n),t.child;case 8:return pt(e,t,t.pendingProps.children,n),t.child;case 12:return pt(e,t,t.pendingProps.children,n),t.child;case 10:return s=t.pendingProps,In(t,t.type,s.value),pt(e,t,s.children,n),t.child;case 9:return c=t.type._context,s=t.pendingProps.children,Ma(t),c=ht(c),s=s(c),t.flags|=1,pt(e,t,s,n),t.child;case 14:return th(e,t,t.type,t.pendingProps,n);case 15:return nh(e,t,t.type,t.pendingProps,n);case 19:return fh(e,t,n);case 31:return qv(e,t,n);case 22:return ah(e,t,n,t.pendingProps);case 24:return Ma(t),s=ht(tt),e===null?(c=Xo(),c===null&&(c=$e,u=$o(),c.pooledCache=u,u.refCount++,u!==null&&(c.pooledCacheLanes|=n),c=u),t.memoizedState={parent:s,cache:c},Ko(t),In(t,tt,c)):((e.lanes&n)!==0&&(Zo(e,t),ps(t,null,null,n),hs()),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),In(t,tt,s)):(s=u.cache,In(t,tt,s),s!==c.cache&&Yo(t,[tt],n,!0))),pt(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(r(156,t.tag))}function qn(e){e.flags|=4}function Mc(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(Uh())e.flags|=8192;else throw ka=ki,Qo}else e.flags&=-16777217}function mh(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!q0(t))if(Uh())e.flags|=8192;else throw ka=ki,Qo}function Fi(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Qf():536870912,e.lanes|=t,Al|=t)}function Ss(e,t){if(!qe)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 Qe(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 Rv(e,t,n){var s=t.pendingProps;switch(zo(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Qe(t),null;case 1:return Qe(t),null;case 3:return n=t.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),Nn(tt),pe(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(cl(t)?qn(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Uo())),Qe(t),null;case 26:var c=t.type,u=t.memoizedState;return e===null?(qn(t),u!==null?(Qe(t),mh(t,u)):(Qe(t),Mc(t,c,null,s,n))):u?u!==e.memoizedState?(qn(t),Qe(t),mh(t,u)):(Qe(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&qn(t),Qe(t),Mc(t,c,e,s,n)),null;case 27:if(te(t),n=ie.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&qn(t);else{if(!s){if(t.stateNode===null)throw Error(r(166));return Qe(t),null}e=ae.current,cl(t)?Qd(t):(e=b0(c,s,n),t.stateNode=e,qn(t))}return Qe(t),null;case 5:if(te(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&qn(t);else{if(!s){if(t.stateNode===null)throw Error(r(166));return Qe(t),null}if(u=ae.current,cl(t))Qd(t);else{var g=ur(ie.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(gt(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&&qn(t)}}return Qe(t),Mc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&qn(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(r(166));if(e=ie.current,cl(t)){if(e=t.stateNode,n=t.memoizedProps,s=null,c=mt,c!==null)switch(c.tag){case 27:case 5:s=c.memoizedProps}e[dt]=t,e=!!(e.nodeValue===n||s!==null&&s.suppressHydrationWarning===!0||c0(e.nodeValue,n)),e||Jn(t,!0)}else e=ur(e).createTextNode(s),e[dt]=t,t.stateNode=e}return Qe(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(s=cl(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 Ea(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Qe(t),e=!1}else n=Uo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Ot(t),t):(Ot(t),null);if((t.flags&128)!==0)throw Error(r(558))}return Qe(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=cl(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 Ea(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Qe(t),c=!1}else c=Uo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(Ot(t),t):(Ot(t),null)}return Ot(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),Fi(t,t.updateQueue),Qe(t),null);case 4:return pe(),e===null&&Ic(t.stateNode.containerInfo),Qe(t),null;case 10:return Nn(t.type),Qe(t),null;case 19:if(U(We),s=t.memoizedState,s===null)return Qe(t),null;if(c=(t.flags&128)!==0,u=s.rendering,u===null)if(c)Ss(s,!1);else{if(Ie!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=Bi(e),u!==null){for(t.flags|=128,Ss(s,!1),e=u.updateQueue,t.updateQueue=e,Fi(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Vd(n,e),n=n.sibling;return ee(We,We.current&1|2),qe&&An(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&rt()>er&&(t.flags|=128,c=!0,Ss(s,!1),t.lanes=4194304)}else{if(!c)if(e=Bi(u),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,Fi(t,e),Ss(s,!0),s.tail===null&&s.tailMode==="hidden"&&!u.alternate&&!qe)return Qe(t),null}else 2*rt()-s.renderingStartTime>er&&n!==536870912&&(t.flags|=128,c=!0,Ss(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=rt(),e.sibling=null,n=We.current,ee(We,c?n&1|2:n&1),qe&&An(t,s.treeForkCount),e):(Qe(t),null);case 22:case 23:return Ot(t),Wo(),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&&(Qe(t),t.subtreeFlags&6&&(t.flags|=8192)):Qe(t),n=t.updateQueue,n!==null&&Fi(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&&U(Ra),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Nn(tt),Qe(t),null;case 25:return null;case 30:return null}throw Error(r(156,t.tag))}function Tv(e,t){switch(zo(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Nn(tt),pe(),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(Ot(t),t.alternate===null)throw Error(r(340));Ea()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Ot(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Ea()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return U(We),null;case 4:return pe(),null;case 10:return Nn(t.type),null;case 22:case 23:return Ot(t),Wo(),e!==null&&U(Ra),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Nn(tt),null;case 25:return null;default:return null}}function hh(e,t){switch(zo(t),t.tag){case 3:Nn(tt),pe();break;case 26:case 27:case 5:te(t);break;case 4:pe();break;case 31:t.memoizedState!==null&&Ot(t);break;case 13:Ot(t);break;case 19:U(We);break;case 10:Nn(t.type);break;case 22:case 23:Ot(t),Wo(),e!==null&&U(Ra);break;case 24:Nn(tt)}}function As(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(b){Be(t,t.return,b)}}function aa(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,b=g.destroy;if(b!==void 0){g.destroy=void 0,c=t;var R=n,V=b;try{V()}catch(J){Be(c,R,J)}}}s=s.next}while(s!==u)}}catch(J){Be(t,t.return,J)}}function ph(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{sm(t,n)}catch(s){Be(e,e.return,s)}}}function gh(e,t,n){n.props=Oa(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(s){Be(e,t,s)}}function js(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){Be(e,t,c)}}function un(e,t){var n=e.ref,s=e.refCleanup;if(n!==null)if(typeof s=="function")try{s()}catch(c){Be(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){Be(e,t,c)}else n.current=null}function xh(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){Be(e,e.return,c)}}function Rc(e,t,n){try{var s=e.stateNode;Pv(s,e.type,n,t),s[jt]=t}catch(c){Be(e,e.return,c)}}function vh(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ua(e.type)||e.tag===4}function Tc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||vh(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&&ua(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 kc(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=yn));else if(s!==4&&(s===27&&ua(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(kc(e,t,n),e=e.sibling;e!==null;)kc(e,t,n),e=e.sibling}function Ji(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&&ua(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Ji(e,t,n),e=e.sibling;e!==null;)Ji(e,t,n),e=e.sibling}function yh(e){var t=e.stateNode,n=e.memoizedProps;try{for(var s=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);gt(t,s,n),t[dt]=e,t[jt]=n}catch(u){Be(e,e.return,u)}}var Mn=!1,lt=!1,_c=!1,bh=typeof WeakSet=="function"?WeakSet:Set,ft=null;function kv(e,t){if(e=e.containerInfo,eu=xr,e=kd(e),Co(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,b=-1,R=-1,V=0,J=0,P=e,Y=null;t:for(;;){for(var G;P!==n||c!==0&&P.nodeType!==3||(b=g+c),P!==u||s!==0&&P.nodeType!==3||(R=g+s),P.nodeType===3&&(g+=P.nodeValue.length),(G=P.firstChild)!==null;)Y=P,P=G;for(;;){if(P===e)break t;if(Y===n&&++V===c&&(b=g),Y===u&&++J===s&&(R=g),(G=P.nextSibling)!==null)break;P=Y,Y=P.parentNode}P=G}n=b===-1||R===-1?null:{start:b,end:R}}else n=null}n=n||{start:0,end:0}}else n=null;for(tu={focusedElem:e,selectionRange:n},xr=!1,ft=t;ft!==null;)if(t=ft,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ft=e;else for(;ft!==null;){switch(t=ft,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 ue=Oa(n.type,c);e=s.getSnapshotBeforeUpdate(ue,u),s.__reactInternalSnapshotBeforeUpdate=e}catch(ge){Be(n,n.return,ge)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)lu(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":lu(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,ft=e;break}ft=t.return}}function Sh(e,t,n){var s=n.flags;switch(n.tag){case 0:case 11:case 15:Tn(e,n),s&4&&As(5,n);break;case 1:if(Tn(e,n),s&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(g){Be(n,n.return,g)}else{var c=Oa(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(g){Be(n,n.return,g)}}s&64&&ph(n),s&512&&js(n,n.return);break;case 3:if(Tn(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{sm(e,t)}catch(g){Be(n,n.return,g)}}break;case 27:t===null&&s&4&&yh(n);case 26:case 5:Tn(e,n),t===null&&s&4&&xh(n),s&512&&js(n,n.return);break;case 12:Tn(e,n);break;case 31:Tn(e,n),s&4&&Nh(e,n);break;case 13:Tn(e,n),s&4&&wh(e,n),s&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Vv.bind(null,n),ry(e,n))));break;case 22:if(s=n.memoizedState!==null||Mn,!s){t=t!==null&&t.memoizedState!==null||lt,c=Mn;var u=lt;Mn=s,(lt=t)&&!u?kn(e,n,(n.subtreeFlags&8772)!==0):Tn(e,n),Mn=c,lt=u}break;case 30:break;default:Tn(e,n)}}function Ah(e){var t=e.alternate;t!==null&&(e.alternate=null,Ah(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&oo(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 Ke=null,wt=!1;function Rn(e,t,n){for(n=n.child;n!==null;)jh(e,t,n),n=n.sibling}function jh(e,t,n){if(vt&&typeof vt.onCommitFiberUnmount=="function")try{vt.onCommitFiberUnmount(ya,n)}catch{}switch(n.tag){case 26:lt||un(n,t),Rn(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:lt||un(n,t);var s=Ke,c=wt;ua(n.type)&&(Ke=n.stateNode,wt=!1),Rn(e,t,n),ks(n.stateNode),Ke=s,wt=c;break;case 5:lt||un(n,t);case 6:if(s=Ke,c=wt,Ke=null,Rn(e,t,n),Ke=s,wt=c,Ke!==null)if(wt)try{(Ke.nodeType===9?Ke.body:Ke.nodeName==="HTML"?Ke.ownerDocument.body:Ke).removeChild(n.stateNode)}catch(u){Be(n,t,u)}else try{Ke.removeChild(n.stateNode)}catch(u){Be(n,t,u)}break;case 18:Ke!==null&&(wt?(e=Ke,p0(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Rl(e)):p0(Ke,n.stateNode));break;case 4:s=Ke,c=wt,Ke=n.stateNode.containerInfo,wt=!0,Rn(e,t,n),Ke=s,wt=c;break;case 0:case 11:case 14:case 15:aa(2,n,t),lt||aa(4,n,t),Rn(e,t,n);break;case 1:lt||(un(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"&&gh(n,t,s)),Rn(e,t,n);break;case 21:Rn(e,t,n);break;case 22:lt=(s=lt)||n.memoizedState!==null,Rn(e,t,n),lt=s;break;default:Rn(e,t,n)}}function Nh(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Rl(e)}catch(n){Be(t,t.return,n)}}}function wh(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Rl(e)}catch(n){Be(t,t.return,n)}}function _v(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new bh),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new bh),t;default:throw Error(r(435,e.tag))}}function Ii(e,t){var n=_v(e);t.forEach(function(s){if(!n.has(s)){n.add(s);var c=Yv.bind(null,e,s);s.then(c,c)}})}function Ct(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,b=g;e:for(;b!==null;){switch(b.tag){case 27:if(ua(b.type)){Ke=b.stateNode,wt=!1;break e}break;case 5:Ke=b.stateNode,wt=!1;break e;case 3:case 4:Ke=b.stateNode.containerInfo,wt=!0;break e}b=b.return}if(Ke===null)throw Error(r(160));jh(u,g,c),Ke=null,wt=!1,u=c.alternate,u!==null&&(u.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Ch(t,e),t=t.sibling}var en=null;function Ch(e,t){var n=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ct(t,e),Et(e),s&4&&(aa(3,e,e.return),As(3,e),aa(5,e,e.return));break;case 1:Ct(t,e),Et(e),s&512&&(lt||n===null||un(n,n.return)),s&64&&Mn&&(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=en;if(Ct(t,e),Et(e),s&512&&(lt||n===null||un(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[Jl]||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"))),gt(u,s,n),u[dt]=e,ut(u),s=u;break e;case"link":var g=C0("link","href",c).get(s+(n.href||""));if(g){for(var b=0;b<g.length;b++)if(u=g[b],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(b,1);break t}}u=c.createElement(s),gt(u,s,n),c.head.appendChild(u);break;case"meta":if(g=C0("meta","content",c).get(s+(n.content||""))){for(b=0;b<g.length;b++)if(u=g[b],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(b,1);break t}}u=c.createElement(s),gt(u,s,n),c.head.appendChild(u);break;default:throw Error(r(468,s))}u[dt]=e,ut(u),s=u}e.stateNode=s}else E0(c,e.type,e.stateNode);else e.stateNode=w0(c,s,e.memoizedProps);else u!==s?(u===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):u.count--,s===null?E0(c,e.type,e.stateNode):w0(c,s,e.memoizedProps)):s===null&&e.stateNode!==null&&Rc(e,e.memoizedProps,n.memoizedProps)}break;case 27:Ct(t,e),Et(e),s&512&&(lt||n===null||un(n,n.return)),n!==null&&s&4&&Rc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Ct(t,e),Et(e),s&512&&(lt||n===null||un(n,n.return)),e.flags&32){c=e.stateNode;try{Pa(c,"")}catch(ue){Be(e,e.return,ue)}}s&4&&e.stateNode!=null&&(c=e.memoizedProps,Rc(e,c,n!==null?n.memoizedProps:c)),s&1024&&(_c=!0);break;case 6:if(Ct(t,e),Et(e),s&4){if(e.stateNode===null)throw Error(r(162));s=e.memoizedProps,n=e.stateNode;try{n.nodeValue=s}catch(ue){Be(e,e.return,ue)}}break;case 3:if(mr=null,c=en,en=fr(t.containerInfo),Ct(t,e),en=c,Et(e),s&4&&n!==null&&n.memoizedState.isDehydrated)try{Rl(t.containerInfo)}catch(ue){Be(e,e.return,ue)}_c&&(_c=!1,Eh(e));break;case 4:s=en,en=fr(e.stateNode.containerInfo),Ct(t,e),Et(e),en=s;break;case 12:Ct(t,e),Et(e);break;case 31:Ct(t,e),Et(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Ii(e,s)));break;case 13:Ct(t,e),Et(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Pi=rt()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Ii(e,s)));break;case 22:c=e.memoizedState!==null;var R=n!==null&&n.memoizedState!==null,V=Mn,J=lt;if(Mn=V||c,lt=J||R,Ct(t,e),lt=J,Mn=V,Et(e),s&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(n===null||R||Mn||lt||Ba(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){R=n=t;try{if(u=R.stateNode,c)g=u.style,typeof g.setProperty=="function"?g.setProperty("display","none","important"):g.display="none";else{b=R.stateNode;var P=R.memoizedProps.style,Y=P!=null&&P.hasOwnProperty("display")?P.display:null;b.style.display=Y==null||typeof Y=="boolean"?"":(""+Y).trim()}}catch(ue){Be(R,R.return,ue)}}}else if(t.tag===6){if(n===null){R=t;try{R.stateNode.nodeValue=c?"":R.memoizedProps}catch(ue){Be(R,R.return,ue)}}}else if(t.tag===18){if(n===null){R=t;try{var G=R.stateNode;c?g0(G,!0):g0(R.stateNode,!1)}catch(ue){Be(R,R.return,ue)}}}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,Ii(e,n))));break;case 19:Ct(t,e),Et(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Ii(e,s)));break;case 30:break;case 21:break;default:Ct(t,e),Et(e)}}function Et(e){var t=e.flags;if(t&2){try{for(var n,s=e.return;s!==null;){if(vh(s)){n=s;break}s=s.return}if(n==null)throw Error(r(160));switch(n.tag){case 27:var c=n.stateNode,u=Tc(e);Ji(e,u,c);break;case 5:var g=n.stateNode;n.flags&32&&(Pa(g,""),n.flags&=-33);var b=Tc(e);Ji(e,b,g);break;case 3:case 4:var R=n.stateNode.containerInfo,V=Tc(e);kc(e,V,R);break;default:throw Error(r(161))}}catch(J){Be(e,e.return,J)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Eh(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Eh(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Tn(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Sh(e,t.alternate,t),t=t.sibling}function Ba(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:aa(4,t,t.return),Ba(t);break;case 1:un(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&gh(t,t.return,n),Ba(t);break;case 27:ks(t.stateNode);case 26:case 5:un(t,t.return),Ba(t);break;case 22:t.memoizedState===null&&Ba(t);break;case 30:Ba(t);break;default:Ba(t)}e=e.sibling}}function kn(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:kn(c,u,n),As(4,u);break;case 1:if(kn(c,u,n),s=u,c=s.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(V){Be(s,s.return,V)}if(s=u,c=s.updateQueue,c!==null){var b=s.stateNode;try{var R=c.shared.hiddenCallbacks;if(R!==null)for(c.shared.hiddenCallbacks=null,c=0;c<R.length;c++)lm(R[c],b)}catch(V){Be(s,s.return,V)}}n&&g&64&&ph(u),js(u,u.return);break;case 27:yh(u);case 26:case 5:kn(c,u,n),n&&s===null&&g&4&&xh(u),js(u,u.return);break;case 12:kn(c,u,n);break;case 31:kn(c,u,n),n&&g&4&&Nh(c,u);break;case 13:kn(c,u,n),n&&g&4&&wh(c,u);break;case 22:u.memoizedState===null&&kn(c,u,n),js(u,u.return);break;case 30:break;default:kn(c,u,n)}t=t.sibling}}function Dc(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&&cs(n))}function Oc(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&cs(e))}function tn(e,t,n,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)qh(e,t,n,s),t=t.sibling}function qh(e,t,n,s){var c=t.flags;switch(t.tag){case 0:case 11:case 15:tn(e,t,n,s),c&2048&&As(9,t);break;case 1:tn(e,t,n,s);break;case 3:tn(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&&cs(e)));break;case 12:if(c&2048){tn(e,t,n,s),e=t.stateNode;try{var u=t.memoizedProps,g=u.id,b=u.onPostCommit;typeof b=="function"&&b(g,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(R){Be(t,t.return,R)}}else tn(e,t,n,s);break;case 31:tn(e,t,n,s);break;case 13:tn(e,t,n,s);break;case 23:break;case 22:u=t.stateNode,g=t.alternate,t.memoizedState!==null?u._visibility&2?tn(e,t,n,s):Ns(e,t):u._visibility&2?tn(e,t,n,s):(u._visibility|=2,yl(e,t,n,s,(t.subtreeFlags&10256)!==0||!1)),c&2048&&Dc(g,t);break;case 24:tn(e,t,n,s),c&2048&&Oc(t.alternate,t);break;default:tn(e,t,n,s)}}function yl(e,t,n,s,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var u=e,g=t,b=n,R=s,V=g.flags;switch(g.tag){case 0:case 11:case 15:yl(u,g,b,R,c),As(8,g);break;case 23:break;case 22:var J=g.stateNode;g.memoizedState!==null?J._visibility&2?yl(u,g,b,R,c):Ns(u,g):(J._visibility|=2,yl(u,g,b,R,c)),c&&V&2048&&Dc(g.alternate,g);break;case 24:yl(u,g,b,R,c),c&&V&2048&&Oc(g.alternate,g);break;default:yl(u,g,b,R,c)}t=t.sibling}}function Ns(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:Ns(n,s),c&2048&&Dc(s.alternate,s);break;case 24:Ns(n,s),c&2048&&Oc(s.alternate,s);break;default:Ns(n,s)}t=t.sibling}}var ws=8192;function bl(e,t,n){if(e.subtreeFlags&ws)for(e=e.child;e!==null;)Mh(e,t,n),e=e.sibling}function Mh(e,t,n){switch(e.tag){case 26:bl(e,t,n),e.flags&ws&&e.memoizedState!==null&&yy(n,en,e.memoizedState,e.memoizedProps);break;case 5:bl(e,t,n);break;case 3:case 4:var s=en;en=fr(e.stateNode.containerInfo),bl(e,t,n),en=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=ws,ws=16777216,bl(e,t,n),ws=s):bl(e,t,n));break;default:bl(e,t,n)}}function Rh(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 Cs(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];ft=s,kh(s,e)}Rh(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Th(e),e=e.sibling}function Th(e){switch(e.tag){case 0:case 11:case 15:Cs(e),e.flags&2048&&aa(9,e,e.return);break;case 3:Cs(e);break;case 12:Cs(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Wi(e)):Cs(e);break;default:Cs(e)}}function Wi(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];ft=s,kh(s,e)}Rh(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:aa(8,t,t.return),Wi(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Wi(t));break;default:Wi(t)}e=e.sibling}}function kh(e,t){for(;ft!==null;){var n=ft;switch(n.tag){case 0:case 11:case 15:aa(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:cs(n.memoizedState.cache)}if(s=n.child,s!==null)s.return=n,ft=s;else e:for(n=e;ft!==null;){s=ft;var c=s.sibling,u=s.return;if(Ah(s),s===n){ft=null;break e}if(c!==null){c.return=u,ft=c;break e}ft=u}}}var Dv={getCacheForType:function(e){var t=ht(tt),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return ht(tt).controller.signal}},Ov=typeof WeakMap=="function"?WeakMap:Map,De=0,$e=null,je=null,Ce=0,Oe=0,Bt=null,la=!1,Sl=!1,Bc=!1,_n=0,Ie=0,sa=0,za=0,zc=0,zt=0,Al=0,Es=null,qt=null,Lc=!1,Pi=0,_h=0,er=1/0,tr=null,ia=null,it=0,ra=null,jl=null,Dn=0,Uc=0,Hc=null,Dh=null,qs=0,Vc=null;function Lt(){return(De&2)!==0&&Ce!==0?Ce&-Ce:T.T!==null?Kc():Jf()}function Oh(){if(zt===0)if((Ce&536870912)===0||qe){var e=Le;Le<<=1,(Le&3932160)===0&&(Le=262144),zt=e}else zt=536870912;return e=Dt.current,e!==null&&(e.flags|=32),zt}function Mt(e,t,n){(e===$e&&(Oe===2||Oe===9)||e.cancelPendingCommit!==null)&&(Nl(e,0),oa(e,Ce,zt,!1)),Fl(e,n),((De&2)===0||e!==$e)&&(e===$e&&((De&2)===0&&(za|=n),Ie===4&&oa(e,Ce,zt,!1)),fn(e))}function Bh(e,t,n){if((De&6)!==0)throw Error(r(327));var s=!n&&(t&127)===0&&(t&e.expiredLanes)===0||Zl(e,t),c=s?Lv(e,t):$c(e,t,!0),u=s;do{if(c===0){Sl&&!s&&oa(e,t,0,!1);break}else{if(n=e.current.alternate,u&&!Bv(n)){c=$c(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 b=e;c=Es;var R=b.current.memoizedState.isDehydrated;if(R&&(Nl(b,g).flags|=256),g=$c(b,g,!1),g!==2){if(Bc&&!R){b.errorRecoveryDisabledLanes|=u,za|=u,c=4;break e}u=qt,qt=c,u!==null&&(qt===null?qt=u:qt.push.apply(qt,u))}c=g}if(u=!1,c!==2)continue}}if(c===1){Nl(e,0),oa(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:oa(s,t,zt,!la);break e;case 2:qt=null;break;case 3:case 5:break;default:throw Error(r(329))}if((t&62914560)===t&&(c=Pi+300-rt(),10<c)){if(oa(s,t,zt,!la),fi(s,0,!0)!==0)break e;Dn=t,s.timeoutHandle=m0(zh.bind(null,s,n,qt,tr,Lc,t,zt,za,Al,la,u,"Throttled",-0,0),c);break e}zh(s,n,qt,tr,Lc,t,zt,za,Al,la,u,null,-0,0)}}break}while(!0);fn(e)}function zh(e,t,n,s,c,u,g,b,R,V,J,P,Y,G){if(e.timeoutHandle=-1,P=t.subtreeFlags,P&8192||(P&16785408)===16785408){P={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:yn},Mh(t,u,P);var ue=(u&62914560)===u?Pi-rt():(u&4194048)===u?_h-rt():0;if(ue=by(P,ue),ue!==null){Dn=u,e.cancelPendingCommit=ue(Xh.bind(null,e,t,u,n,s,c,g,b,R,J,P,null,Y,G)),oa(e,u,g,!V);return}}Xh(e,t,u,n,s,c,g,b,R)}function Bv(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(!kt(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 oa(e,t,n,s){t&=~zc,t&=~za,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var c=t;0<c;){var u=31-ve(c),g=1<<u;s[u]=-1,c&=~g}n!==0&&Kf(e,n,t)}function nr(){return(De&6)===0?(Ms(0),!1):!0}function Yc(){if(je!==null){if(Oe===0)var e=je.return;else e=je,jn=qa=null,lc(e),hl=null,fs=0,e=je;for(;e!==null;)hh(e.alternate,e),e=e.return;je=null}}function Nl(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,ny(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Dn=0,Yc(),$e=e,je=n=Sn(e.current,null),Ce=t,Oe=0,Bt=null,la=!1,Sl=Zl(e,t),Bc=!1,Al=zt=zc=za=sa=Ie=0,qt=Es=null,Lc=!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-ve(s),u=1<<c;t|=e[c],s&=~u}return _n=t,ji(),n}function Lh(e,t){be=null,T.H=ys,t===ml||t===Ti?(t=em(),Oe=3):t===Qo?(t=em(),Oe=4):Oe=t===bc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Bt=t,je===null&&(Ie=1,Xi(e,Yt(t,e.current)))}function Uh(){var e=Dt.current;return e===null?!0:(Ce&4194048)===Ce?Qt===null:(Ce&62914560)===Ce||(Ce&536870912)!==0?e===Qt:!1}function Hh(){var e=T.H;return T.H=ys,e===null?ys:e}function Vh(){var e=T.A;return T.A=Dv,e}function ar(){Ie=4,la||(Ce&4194048)!==Ce&&Dt.current!==null||(Sl=!0),(sa&134217727)===0&&(za&134217727)===0||$e===null||oa($e,Ce,zt,!1)}function $c(e,t,n){var s=De;De|=2;var c=Hh(),u=Vh();($e!==e||Ce!==t)&&(tr=null,Nl(e,t)),t=!1;var g=Ie;e:do try{if(Oe!==0&&je!==null){var b=je,R=Bt;switch(Oe){case 8:Yc(),g=6;break e;case 3:case 2:case 9:case 6:Dt.current===null&&(t=!0);var V=Oe;if(Oe=0,Bt=null,wl(e,b,R,V),n&&Sl){g=0;break e}break;default:V=Oe,Oe=0,Bt=null,wl(e,b,R,V)}}zv(),g=Ie;break}catch(J){Lh(e,J)}while(!0);return t&&e.shellSuspendCounter++,jn=qa=null,De=s,T.H=c,T.A=u,je===null&&($e=null,Ce=0,ji()),g}function zv(){for(;je!==null;)Yh(je)}function Lv(e,t){var n=De;De|=2;var s=Hh(),c=Vh();$e!==e||Ce!==t?(tr=null,er=rt()+500,Nl(e,t)):Sl=Zl(e,t);e:do try{if(Oe!==0&&je!==null){t=je;var u=Bt;t:switch(Oe){case 1:Oe=0,Bt=null,wl(e,t,u,1);break;case 2:case 9:if(Wd(u)){Oe=0,Bt=null,$h(t);break}t=function(){Oe!==2&&Oe!==9||$e!==e||(Oe=7),fn(e)},u.then(t,t);break e;case 3:Oe=7;break e;case 4:Oe=5;break e;case 7:Wd(u)?(Oe=0,Bt=null,$h(t)):(Oe=0,Bt=null,wl(e,t,u,7));break;case 5:var g=null;switch(je.tag){case 26:g=je.memoizedState;case 5:case 27:var b=je;if(g?q0(g):b.stateNode.complete){Oe=0,Bt=null;var R=b.sibling;if(R!==null)je=R;else{var V=b.return;V!==null?(je=V,lr(V)):je=null}break t}}Oe=0,Bt=null,wl(e,t,u,5);break;case 6:Oe=0,Bt=null,wl(e,t,u,6);break;case 8:Yc(),Ie=6;break e;default:throw Error(r(462))}}Uv();break}catch(J){Lh(e,J)}while(!0);return jn=qa=null,T.H=s,T.A=c,De=n,je!==null?0:($e=null,Ce=0,ji(),Ie)}function Uv(){for(;je!==null&&!Xl();)Yh(je)}function Yh(e){var t=dh(e.alternate,e,_n);e.memoizedProps=e.pendingProps,t===null?lr(e):je=t}function $h(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=ih(n,t,t.pendingProps,t.type,void 0,Ce);break;case 11:t=ih(n,t,t.pendingProps,t.type.render,t.ref,Ce);break;case 5:lc(t);default:hh(n,t),t=je=Vd(t,_n),t=dh(n,t,_n)}e.memoizedProps=e.pendingProps,t===null?lr(e):je=t}function wl(e,t,n,s){jn=qa=null,lc(t),hl=null,fs=0;var c=t.return;try{if(Ev(e,c,t,n,Ce)){Ie=1,Xi(e,Yt(n,e.current)),je=null;return}}catch(u){if(c!==null)throw je=c,u;Ie=1,Xi(e,Yt(n,e.current)),je=null;return}t.flags&32768?(qe||s===1?e=!0:Sl||(Ce&536870912)!==0?e=!1:(la=e=!0,(s===2||s===9||s===3||s===6)&&(s=Dt.current,s!==null&&s.tag===13&&(s.flags|=16384))),Gh(t,e)):lr(t)}function lr(e){var t=e;do{if((t.flags&32768)!==0){Gh(t,la);return}e=t.return;var n=Rv(t.alternate,t,_n);if(n!==null){je=n;return}if(t=t.sibling,t!==null){je=t;return}je=t=e}while(t!==null);Ie===0&&(Ie=5)}function Gh(e,t){do{var n=Tv(e.alternate,e);if(n!==null){n.flags&=32767,je=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){je=e;return}je=e=n}while(e!==null);Ie=6,je=null}function Xh(e,t,n,s,c,u,g,b,R){e.cancelPendingCommit=null;do sr();while(it!==0);if((De&6)!==0)throw Error(r(327));if(t!==null){if(t===e.current)throw Error(r(177));if(u=t.lanes|t.childLanes,u|=To,vx(e,n,u,g,b,R),e===$e&&(je=$e=null,Ce=0),jl=t,ra=e,Dn=n,Uc=u,Hc=c,Dh=s,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,$v(Xn,function(){return Jh(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||s){s=T.T,T.T=null,c=F.p,F.p=2,g=De,De|=4;try{kv(e,t,n)}finally{De=g,F.p=c,T.T=s}}it=1,Qh(),Kh(),Zh()}}function Qh(){if(it===1){it=0;var e=ra,t=jl,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=T.T,T.T=null;var s=F.p;F.p=2;var c=De;De|=4;try{Ch(t,e);var u=tu,g=kd(e.containerInfo),b=u.focusedElem,R=u.selectionRange;if(g!==b&&b&&b.ownerDocument&&Td(b.ownerDocument.documentElement,b)){if(R!==null&&Co(b)){var V=R.start,J=R.end;if(J===void 0&&(J=V),"selectionStart"in b)b.selectionStart=V,b.selectionEnd=Math.min(J,b.value.length);else{var P=b.ownerDocument||document,Y=P&&P.defaultView||window;if(Y.getSelection){var G=Y.getSelection(),ue=b.textContent.length,ge=Math.min(R.start,ue),Ve=R.end===void 0?ge:Math.min(R.end,ue);!G.extend&&ge>Ve&&(g=Ve,Ve=ge,ge=g);var D=Rd(b,ge),_=Rd(b,Ve);if(D&&_&&(G.rangeCount!==1||G.anchorNode!==D.node||G.anchorOffset!==D.offset||G.focusNode!==_.node||G.focusOffset!==_.offset)){var H=P.createRange();H.setStart(D.node,D.offset),G.removeAllRanges(),ge>Ve?(G.addRange(H),G.extend(_.node,_.offset)):(H.setEnd(_.node,_.offset),G.addRange(H))}}}}for(P=[],G=b;G=G.parentNode;)G.nodeType===1&&P.push({element:G,left:G.scrollLeft,top:G.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<P.length;b++){var I=P[b];I.element.scrollLeft=I.left,I.element.scrollTop=I.top}}xr=!!eu,tu=eu=null}finally{De=c,F.p=s,T.T=n}}e.current=t,it=2}}function Kh(){if(it===2){it=0;var e=ra,t=jl,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=T.T,T.T=null;var s=F.p;F.p=2;var c=De;De|=4;try{Sh(e,t.alternate,t)}finally{De=c,F.p=s,T.T=n}}it=3}}function Zh(){if(it===4||it===3){it=0,va();var e=ra,t=jl,n=Dn,s=Dh;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?it=5:(it=0,jl=ra=null,Fh(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(ia=null),io(n),t=t.stateNode,vt&&typeof vt.onCommitFiberRoot=="function")try{vt.onCommitFiberRoot(ya,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=T.T,c=F.p,F.p=2,T.T=null;try{for(var u=e.onRecoverableError,g=0;g<s.length;g++){var b=s[g];u(b.value,{componentStack:b.stack})}}finally{T.T=t,F.p=c}}(Dn&3)!==0&&sr(),fn(e),c=e.pendingLanes,(n&261930)!==0&&(c&42)!==0?e===Vc?qs++:(qs=0,Vc=e):qs=0,Ms(0)}}function Fh(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,cs(t)))}function sr(){return Qh(),Kh(),Zh(),Jh()}function Jh(){if(it!==5)return!1;var e=ra,t=Uc;Uc=0;var n=io(Dn),s=T.T,c=F.p;try{F.p=32>n?32:n,T.T=null,n=Hc,Hc=null;var u=ra,g=Dn;if(it=0,jl=ra=null,Dn=0,(De&6)!==0)throw Error(r(331));var b=De;if(De|=4,Th(u.current),qh(u,u.current,g,n),De=b,Ms(0,!1),vt&&typeof vt.onPostCommitFiberRoot=="function")try{vt.onPostCommitFiberRoot(ya,u)}catch{}return!0}finally{F.p=c,T.T=s,Fh(e,t)}}function Ih(e,t,n){t=Yt(n,t),t=yc(e.stateNode,t,2),e=ea(e,t,2),e!==null&&(Fl(e,2),fn(e))}function Be(e,t,n){if(e.tag===3)Ih(e,e,n);else for(;t!==null;){if(t.tag===3){Ih(t,e,n);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(ia===null||!ia.has(s))){e=Yt(n,e),n=Wm(2),s=ea(t,n,2),s!==null&&(Pm(n,s,t,e),Fl(s,2),fn(s));break}}t=t.return}}function Gc(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new Ov;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)||(Bc=!0,c.add(n),e=Hv.bind(null,e,t,n),t.then(e,e))}function Hv(e,t,n){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,$e===e&&(Ce&n)===n&&(Ie===4||Ie===3&&(Ce&62914560)===Ce&&300>rt()-Pi?(De&2)===0&&Nl(e,0):zc|=n,Al===Ce&&(Al=0)),fn(e)}function Wh(e,t){t===0&&(t=Qf()),e=wa(e,t),e!==null&&(Fl(e,t),fn(e))}function Vv(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Wh(e,n)}function Yv(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),Wh(e,n)}function $v(e,t){return Tt(e,t)}var ir=null,Cl=null,Xc=!1,rr=!1,Qc=!1,ca=0;function fn(e){e!==Cl&&e.next===null&&(Cl===null?ir=Cl=e:Cl=Cl.next=e),rr=!0,Xc||(Xc=!0,Xv())}function Ms(e,t){if(!Qc&&rr){Qc=!0;do for(var n=!1,s=ir;s!==null;){if(e!==0){var c=s.pendingLanes;if(c===0)var u=0;else{var g=s.suspendedLanes,b=s.pingedLanes;u=(1<<31-ve(42|e)+1)-1,u&=c&~(g&~b),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(n=!0,n0(s,u))}else u=Ce,u=fi(s,s===$e?u:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(u&3)===0||Zl(s,u)||(n=!0,n0(s,u));s=s.next}while(n);Qc=!1}}function Gv(){Ph()}function Ph(){rr=Xc=!1;var e=0;ca!==0&&ty()&&(e=ca);for(var t=rt(),n=null,s=ir;s!==null;){var c=s.next,u=e0(s,t);u===0?(s.next=null,n===null?ir=c:n.next=c,c===null&&(Cl=n)):(n=s,(e!==0||(u&3)!==0)&&(rr=!0)),s=c}it!==0&&it!==5||Ms(e),ca!==0&&(ca=0)}function e0(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,c=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var g=31-ve(u),b=1<<g,R=c[g];R===-1?((b&n)===0||(b&s)!==0)&&(c[g]=xx(b,t)):R<=t&&(e.expiredLanes|=b),u&=~b}if(t=$e,n=Ce,n=fi(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,n===0||e===t&&(Oe===2||Oe===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&Wt(s),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||Zl(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(s!==null&&Wt(s),io(n)){case 2:case 8:n=Gn;break;case 32:n=Xn;break;case 268435456:n=Kl;break;default:n=Xn}return s=t0.bind(null,e),n=Tt(n,s),e.callbackPriority=t,e.callbackNode=n,t}return s!==null&&s!==null&&Wt(s),e.callbackPriority=2,e.callbackNode=null,2}function t0(e,t){if(it!==0&&it!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(sr()&&e.callbackNode!==n)return null;var s=Ce;return s=fi(e,e===$e?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(Bh(e,s,t),e0(e,rt()),e.callbackNode!=null&&e.callbackNode===n?t0.bind(null,e):null)}function n0(e,t){if(sr())return null;Bh(e,t,!0)}function Xv(){ay(function(){(De&6)!==0?Tt(ui,Gv):Ph()})}function Kc(){if(ca===0){var e=fl;e===0&&(e=Ze,Ze<<=1,(Ze&261888)===0&&(Ze=256)),ca=e}return ca}function a0(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:pi(""+e)}function l0(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 Qv(e,t,n,s,c){if(t==="submit"&&n&&n.stateNode===c){var u=a0((c[jt]||null).action),g=s.submitter;g&&(t=(t=g[jt]||null)?a0(t.formAction):g.getAttribute("formAction"),t!==null&&(u=t,g=null));var b=new yi("action","action",null,s,c);e.push({event:b,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(ca!==0){var R=g?l0(c,g):new FormData(c);mc(n,{pending:!0,data:R,method:c.method,action:u},null,R)}}else typeof u=="function"&&(b.preventDefault(),R=g?l0(c,g):new FormData(c),mc(n,{pending:!0,data:R,method:c.method,action:u},u,R))},currentTarget:c}]})}}for(var Zc=0;Zc<Ro.length;Zc++){var Fc=Ro[Zc],Kv=Fc.toLowerCase(),Zv=Fc[0].toUpperCase()+Fc.slice(1);Pt(Kv,"on"+Zv)}Pt(Od,"onAnimationEnd"),Pt(Bd,"onAnimationIteration"),Pt(zd,"onAnimationStart"),Pt("dblclick","onDoubleClick"),Pt("focusin","onFocus"),Pt("focusout","onBlur"),Pt(uv,"onTransitionRun"),Pt(fv,"onTransitionStart"),Pt(dv,"onTransitionCancel"),Pt(Ld,"onTransitionEnd"),Ia("onMouseEnter",["mouseout","mouseover"]),Ia("onMouseLeave",["mouseout","mouseover"]),Ia("onPointerEnter",["pointerout","pointerover"]),Ia("onPointerLeave",["pointerout","pointerover"]),Sa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Sa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Sa("onBeforeInput",["compositionend","keypress","textInput","paste"]),Sa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Sa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Sa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Rs="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(" "),Fv=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Rs));function s0(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 b=s[g],R=b.instance,V=b.currentTarget;if(b=b.listener,R!==u&&c.isPropagationStopped())break e;u=b,c.currentTarget=V;try{u(c)}catch(J){Ai(J)}c.currentTarget=null,u=R}else for(g=0;g<s.length;g++){if(b=s[g],R=b.instance,V=b.currentTarget,b=b.listener,R!==u&&c.isPropagationStopped())break e;u=b,c.currentTarget=V;try{u(c)}catch(J){Ai(J)}c.currentTarget=null,u=R}}}}function Ne(e,t){var n=t[ro];n===void 0&&(n=t[ro]=new Set);var s=e+"__bubble";n.has(s)||(i0(t,e,2,!1),n.add(s))}function Jc(e,t,n){var s=0;t&&(s|=4),i0(n,e,s,t)}var or="_reactListening"+Math.random().toString(36).slice(2);function Ic(e){if(!e[or]){e[or]=!0,Pf.forEach(function(n){n!=="selectionchange"&&(Fv.has(n)||Jc(n,!1,e),Jc(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[or]||(t[or]=!0,Jc("selectionchange",!1,t))}}function i0(e,t,n,s){switch(O0(t)){case 2:var c=jy;break;case 8:c=Ny;break;default:c=du}n=c.bind(null,t,n,e),c=void 0,!xo||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 Wc(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 b=s.stateNode.containerInfo;if(b===c)break;if(g===4)for(g=s.return;g!==null;){var R=g.tag;if((R===3||R===4)&&g.stateNode.containerInfo===c)return;g=g.return}for(;b!==null;){if(g=Za(b),g===null)return;if(R=g.tag,R===5||R===6||R===26||R===27){s=u=g;continue e}b=b.parentNode}}s=s.return}fd(function(){var V=u,J=po(n),P=[];e:{var Y=Ud.get(e);if(Y!==void 0){var G=yi,ue=e;switch(e){case"keypress":if(xi(n)===0)break e;case"keydown":case"keyup":G=Yx;break;case"focusin":ue="focus",G=So;break;case"focusout":ue="blur",G=So;break;case"beforeblur":case"afterblur":G=So;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":G=hd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":G=Rx;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":G=Xx;break;case Od:case Bd:case zd:G=_x;break;case Ld:G=Kx;break;case"scroll":case"scrollend":G=qx;break;case"wheel":G=Fx;break;case"copy":case"cut":case"paste":G=Ox;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":G=gd;break;case"toggle":case"beforetoggle":G=Ix}var ge=(t&4)!==0,Ve=!ge&&(e==="scroll"||e==="scrollend"),D=ge?Y!==null?Y+"Capture":null:Y;ge=[];for(var _=V,H;_!==null;){var I=_;if(H=I.stateNode,I=I.tag,I!==5&&I!==26&&I!==27||H===null||D===null||(I=Wl(_,D),I!=null&&ge.push(Ts(_,I,H))),Ve)break;_=_.return}0<ge.length&&(Y=new G(Y,ue,null,n,J),P.push({event:Y,listeners:ge}))}}if((t&7)===0){e:{if(Y=e==="mouseover"||e==="pointerover",G=e==="mouseout"||e==="pointerout",Y&&n!==ho&&(ue=n.relatedTarget||n.fromElement)&&(Za(ue)||ue[Ka]))break e;if((G||Y)&&(Y=J.window===J?J:(Y=J.ownerDocument)?Y.defaultView||Y.parentWindow:window,G?(ue=n.relatedTarget||n.toElement,G=V,ue=ue?Za(ue):null,ue!==null&&(Ve=d(ue),ge=ue.tag,ue!==Ve||ge!==5&&ge!==27&&ge!==6)&&(ue=null)):(G=null,ue=V),G!==ue)){if(ge=hd,I="onMouseLeave",D="onMouseEnter",_="mouse",(e==="pointerout"||e==="pointerover")&&(ge=gd,I="onPointerLeave",D="onPointerEnter",_="pointer"),Ve=G==null?Y:Il(G),H=ue==null?Y:Il(ue),Y=new ge(I,_+"leave",G,n,J),Y.target=Ve,Y.relatedTarget=H,I=null,Za(J)===V&&(ge=new ge(D,_+"enter",ue,n,J),ge.target=H,ge.relatedTarget=Ve,I=ge),Ve=I,G&&ue)t:{for(ge=Jv,D=G,_=ue,H=0,I=D;I;I=ge(I))H++;I=0;for(var he=_;he;he=ge(he))I++;for(;0<H-I;)D=ge(D),H--;for(;0<I-H;)_=ge(_),I--;for(;H--;){if(D===_||_!==null&&D===_.alternate){ge=D;break t}D=ge(D),_=ge(_)}ge=null}else ge=null;G!==null&&r0(P,Y,G,ge,!1),ue!==null&&Ve!==null&&r0(P,Ve,ue,ge,!0)}}e:{if(Y=V?Il(V):window,G=Y.nodeName&&Y.nodeName.toLowerCase(),G==="select"||G==="input"&&Y.type==="file")var Te=Nd;else if(Ad(Y))if(wd)Te=rv;else{Te=sv;var me=lv}else G=Y.nodeName,!G||G.toLowerCase()!=="input"||Y.type!=="checkbox"&&Y.type!=="radio"?V&&mo(V.elementType)&&(Te=Nd):Te=iv;if(Te&&(Te=Te(e,V))){jd(P,Te,n,J);break e}me&&me(e,Y,V),e==="focusout"&&V&&Y.type==="number"&&V.memoizedProps.value!=null&&fo(Y,"number",Y.value)}switch(me=V?Il(V):window,e){case"focusin":(Ad(me)||me.contentEditable==="true")&&(al=me,Eo=V,is=null);break;case"focusout":is=Eo=al=null;break;case"mousedown":qo=!0;break;case"contextmenu":case"mouseup":case"dragend":qo=!1,_d(P,n,J);break;case"selectionchange":if(cv)break;case"keydown":case"keyup":_d(P,n,J)}var Ae;if(jo)e:{switch(e){case"compositionstart":var Ee="onCompositionStart";break e;case"compositionend":Ee="onCompositionEnd";break e;case"compositionupdate":Ee="onCompositionUpdate";break e}Ee=void 0}else nl?bd(e,n)&&(Ee="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(Ee="onCompositionStart");Ee&&(xd&&n.locale!=="ko"&&(nl||Ee!=="onCompositionStart"?Ee==="onCompositionEnd"&&nl&&(Ae=dd()):(Kn=J,vo="value"in Kn?Kn.value:Kn.textContent,nl=!0)),me=cr(V,Ee),0<me.length&&(Ee=new pd(Ee,e,null,n,J),P.push({event:Ee,listeners:me}),Ae?Ee.data=Ae:(Ae=Sd(n),Ae!==null&&(Ee.data=Ae)))),(Ae=Px?ev(e,n):tv(e,n))&&(Ee=cr(V,"onBeforeInput"),0<Ee.length&&(me=new pd("onBeforeInput","beforeinput",null,n,J),P.push({event:me,listeners:Ee}),me.data=Ae)),Qv(P,e,V,n,J)}s0(P,t)})}function Ts(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=Wl(e,n),c!=null&&s.unshift(Ts(e,c,u)),c=Wl(e,t),c!=null&&s.push(Ts(e,c,u))),e.tag===3)return s;e=e.return}return[]}function Jv(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function r0(e,t,n,s,c){for(var u=t._reactName,g=[];n!==null&&n!==s;){var b=n,R=b.alternate,V=b.stateNode;if(b=b.tag,R!==null&&R===s)break;b!==5&&b!==26&&b!==27||V===null||(R=V,c?(V=Wl(n,u),V!=null&&g.unshift(Ts(n,V,R))):c||(V=Wl(n,u),V!=null&&g.push(Ts(n,V,R)))),n=n.return}g.length!==0&&e.push({event:t,listeners:g})}var Iv=/\r\n?/g,Wv=/\u0000|\uFFFD/g;function o0(e){return(typeof e=="string"?e:""+e).replace(Iv,`
|
||
`).replace(Wv,"")}function c0(e,t){return t=o0(t),o0(e)===t}function He(e,t,n,s,c,u){switch(n){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||Pa(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&Pa(e,""+s);break;case"className":mi(e,"class",s);break;case"tabIndex":mi(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":mi(e,n,s);break;case"style":cd(e,s,u);break;case"data":if(t!=="object"){mi(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=pi(""+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"&&He(e,t,"name",c.name,c,null),He(e,t,"formEncType",c.formEncType,c,null),He(e,t,"formMethod",c.formMethod,c,null),He(e,t,"formTarget",c.formTarget,c,null)):(He(e,t,"encType",c.encType,c,null),He(e,t,"method",c.method,c,null),He(e,t,"target",c.target,c,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(n);break}s=pi(""+s),e.setAttribute(n,s);break;case"onClick":s!=null&&(e.onclick=yn);break;case"onScroll":s!=null&&Ne("scroll",e);break;case"onScrollEnd":s!=null&&Ne("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=pi(""+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":Ne("beforetoggle",e),Ne("toggle",e),di(e,"popover",s);break;case"xlinkActuate":vn(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":vn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":vn(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":vn(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":vn(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":vn(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":vn(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":vn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":vn(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":di(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=Cx.get(n)||n,di(e,n,s))}}function Pc(e,t,n,s,c,u){switch(n){case"style":cd(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"?Pa(e,s):(typeof s=="number"||typeof s=="bigint")&&Pa(e,""+s);break;case"onScroll":s!=null&&Ne("scroll",e);break;case"onScrollEnd":s!=null&&Ne("scrollend",e);break;case"onClick":s!=null&&(e.onclick=yn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ed.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,""):di(e,n,s)}}}function gt(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ne("error",e),Ne("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:He(e,t,u,g,n,null)}}c&&He(e,t,"srcSet",n.srcSet,n,null),s&&He(e,t,"src",n.src,n,null);return;case"input":Ne("invalid",e);var b=u=g=c=null,R=null,V=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":R=J;break;case"defaultChecked":V=J;break;case"value":u=J;break;case"defaultValue":b=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(r(137,t));break;default:He(e,t,s,J,n,null)}}sd(e,u,b,R,V,g,c,!1);return;case"select":Ne("invalid",e),s=g=u=null;for(c in n)if(n.hasOwnProperty(c)&&(b=n[c],b!=null))switch(c){case"value":u=b;break;case"defaultValue":g=b;break;case"multiple":s=b;default:He(e,t,c,b,n,null)}t=u,n=g,e.multiple=!!s,t!=null?Wa(e,!!s,t,!1):n!=null&&Wa(e,!!s,n,!0);return;case"textarea":Ne("invalid",e),u=c=s=null;for(g in n)if(n.hasOwnProperty(g)&&(b=n[g],b!=null))switch(g){case"value":s=b;break;case"defaultValue":c=b;break;case"children":u=b;break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(r(91));break;default:He(e,t,g,b,n,null)}rd(e,s,c,u);return;case"option":for(R in n)if(n.hasOwnProperty(R)&&(s=n[R],s!=null))switch(R){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:He(e,t,R,s,n,null)}return;case"dialog":Ne("beforetoggle",e),Ne("toggle",e),Ne("cancel",e),Ne("close",e);break;case"iframe":case"object":Ne("load",e);break;case"video":case"audio":for(s=0;s<Rs.length;s++)Ne(Rs[s],e);break;case"image":Ne("error",e),Ne("load",e);break;case"details":Ne("toggle",e);break;case"embed":case"source":case"link":Ne("error",e),Ne("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(V in n)if(n.hasOwnProperty(V)&&(s=n[V],s!=null))switch(V){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:He(e,t,V,s,n,null)}return;default:if(mo(t)){for(J in n)n.hasOwnProperty(J)&&(s=n[J],s!==void 0&&Pc(e,t,J,s,n,void 0));return}}for(b in n)n.hasOwnProperty(b)&&(s=n[b],s!=null&&He(e,t,b,s,n,null))}function Pv(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,b=null,R=null,V=null,J=null;for(G in n){var P=n[G];if(n.hasOwnProperty(G)&&P!=null)switch(G){case"checked":break;case"value":break;case"defaultValue":R=P;default:s.hasOwnProperty(G)||He(e,t,G,null,s,P)}}for(var Y in s){var G=s[Y];if(P=n[Y],s.hasOwnProperty(Y)&&(G!=null||P!=null))switch(Y){case"type":u=G;break;case"name":c=G;break;case"checked":V=G;break;case"defaultChecked":J=G;break;case"value":g=G;break;case"defaultValue":b=G;break;case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(r(137,t));break;default:G!==P&&He(e,t,Y,G,s,P)}}uo(e,g,b,R,V,J,u,c);return;case"select":G=g=b=Y=null;for(u in n)if(R=n[u],n.hasOwnProperty(u)&&R!=null)switch(u){case"value":break;case"multiple":G=R;default:s.hasOwnProperty(u)||He(e,t,u,null,s,R)}for(c in s)if(u=s[c],R=n[c],s.hasOwnProperty(c)&&(u!=null||R!=null))switch(c){case"value":Y=u;break;case"defaultValue":b=u;break;case"multiple":g=u;default:u!==R&&He(e,t,c,u,s,R)}t=b,n=g,s=G,Y!=null?Wa(e,!!n,Y,!1):!!s!=!!n&&(t!=null?Wa(e,!!n,t,!0):Wa(e,!!n,n?[]:"",!1));return;case"textarea":G=Y=null;for(b in n)if(c=n[b],n.hasOwnProperty(b)&&c!=null&&!s.hasOwnProperty(b))switch(b){case"value":break;case"children":break;default:He(e,t,b,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":Y=c;break;case"defaultValue":G=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(r(91));break;default:c!==u&&He(e,t,g,c,s,u)}id(e,Y,G);return;case"option":for(var ue in n)if(Y=n[ue],n.hasOwnProperty(ue)&&Y!=null&&!s.hasOwnProperty(ue))switch(ue){case"selected":e.selected=!1;break;default:He(e,t,ue,null,s,Y)}for(R in s)if(Y=s[R],G=n[R],s.hasOwnProperty(R)&&Y!==G&&(Y!=null||G!=null))switch(R){case"selected":e.selected=Y&&typeof Y!="function"&&typeof Y!="symbol";break;default:He(e,t,R,Y,s,G)}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 ge in n)Y=n[ge],n.hasOwnProperty(ge)&&Y!=null&&!s.hasOwnProperty(ge)&&He(e,t,ge,null,s,Y);for(V in s)if(Y=s[V],G=n[V],s.hasOwnProperty(V)&&Y!==G&&(Y!=null||G!=null))switch(V){case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(r(137,t));break;default:He(e,t,V,Y,s,G)}return;default:if(mo(t)){for(var Ve in n)Y=n[Ve],n.hasOwnProperty(Ve)&&Y!==void 0&&!s.hasOwnProperty(Ve)&&Pc(e,t,Ve,void 0,s,Y);for(J in s)Y=s[J],G=n[J],!s.hasOwnProperty(J)||Y===G||Y===void 0&&G===void 0||Pc(e,t,J,Y,s,G);return}}for(var D in n)Y=n[D],n.hasOwnProperty(D)&&Y!=null&&!s.hasOwnProperty(D)&&He(e,t,D,null,s,Y);for(P in s)Y=s[P],G=n[P],!s.hasOwnProperty(P)||Y===G||Y==null&&G==null||He(e,t,P,Y,s,G)}function u0(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function ey(){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,b=c.duration;if(u&&b&&u0(g)){for(g=0,b=c.responseEnd,s+=1;s<n.length;s++){var R=n[s],V=R.startTime;if(V>b)break;var J=R.transferSize,P=R.initiatorType;J&&u0(P)&&(R=R.responseEnd,g+=J*(R<b?1:(b-V)/(R-V)))}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 eu=null,tu=null;function ur(e){return e.nodeType===9?e:e.ownerDocument}function f0(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 d0(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 nu(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 au=null;function ty(){var e=window.event;return e&&e.type==="popstate"?e===au?!1:(au=e,!0):(au=null,!1)}var m0=typeof setTimeout=="function"?setTimeout:void 0,ny=typeof clearTimeout=="function"?clearTimeout:void 0,h0=typeof Promise=="function"?Promise:void 0,ay=typeof queueMicrotask=="function"?queueMicrotask:typeof h0<"u"?function(e){return h0.resolve(null).then(e).catch(ly)}:m0;function ly(e){setTimeout(function(){throw e})}function ua(e){return e==="head"}function p0(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),Rl(t);return}s--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")s++;else if(n==="html")ks(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,ks(n);for(var u=n.firstChild;u;){var g=u.nextSibling,b=u.nodeName;u[Jl]||b==="SCRIPT"||b==="STYLE"||b==="LINK"&&u.rel.toLowerCase()==="stylesheet"||n.removeChild(u),u=g}}else n==="body"&&ks(e.ownerDocument.body);n=c}while(n);Rl(t)}function g0(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 lu(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":lu(n),oo(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function sy(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[Jl])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=Kt(e.nextSibling),e===null)break}return null}function iy(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Kt(e.nextSibling),e===null))return null;return e}function x0(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Kt(e.nextSibling),e===null))return null;return e}function su(e){return e.data==="$?"||e.data==="$~"}function iu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function ry(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 Kt(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 ru=null;function v0(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return Kt(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function y0(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 b0(e,t,n){switch(t=ur(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 ks(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);oo(e)}var Zt=new Map,S0=new Set;function fr(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var On=F.d;F.d={f:oy,r:cy,D:uy,C:fy,L:dy,m:my,X:py,S:hy,M:gy};function oy(){var e=On.f(),t=nr();return e||t}function cy(e){var t=Fa(e);t!==null&&t.tag===5&&t.type==="form"?Lm(t):On.r(e)}var El=typeof document>"u"?null:document;function A0(e,t,n){var s=El;if(s&&typeof t=="string"&&t){var c=Ht(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof n=="string"&&(c+='[crossorigin="'+n+'"]'),S0.has(c)||(S0.add(c),e={rel:e,crossOrigin:n,href:t},s.querySelector(c)===null&&(t=s.createElement("link"),gt(t,"link",e),ut(t),s.head.appendChild(t)))}}function uy(e){On.D(e),A0("dns-prefetch",e,null)}function fy(e,t){On.C(e,t),A0("preconnect",e,t)}function dy(e,t,n){On.L(e,t,n);var s=El;if(s&&e&&t){var c='link[rel="preload"][as="'+Ht(t)+'"]';t==="image"&&n&&n.imageSrcSet?(c+='[imagesrcset="'+Ht(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(c+='[imagesizes="'+Ht(n.imageSizes)+'"]')):c+='[href="'+Ht(e)+'"]';var u=c;switch(t){case"style":u=ql(e);break;case"script":u=Ml(e)}Zt.has(u)||(e=S({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Zt.set(u,e),s.querySelector(c)!==null||t==="style"&&s.querySelector(_s(u))||t==="script"&&s.querySelector(Ds(u))||(t=s.createElement("link"),gt(t,"link",e),ut(t),s.head.appendChild(t)))}}function my(e,t){On.m(e,t);var n=El;if(n&&e){var s=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+Ht(s)+'"][href="'+Ht(e)+'"]',u=c;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=Ml(e)}if(!Zt.has(u)&&(e=S({rel:"modulepreload",href:e},t),Zt.set(u,e),n.querySelector(c)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Ds(u)))return}s=n.createElement("link"),gt(s,"link",e),ut(s),n.head.appendChild(s)}}}function hy(e,t,n){On.S(e,t,n);var s=El;if(s&&e){var c=Ja(s).hoistableStyles,u=ql(e);t=t||"default";var g=c.get(u);if(!g){var b={loading:0,preload:null};if(g=s.querySelector(_s(u)))b.loading=5;else{e=S({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Zt.get(u))&&ou(e,n);var R=g=s.createElement("link");ut(R),gt(R,"link",e),R._p=new Promise(function(V,J){R.onload=V,R.onerror=J}),R.addEventListener("load",function(){b.loading|=1}),R.addEventListener("error",function(){b.loading|=2}),b.loading|=4,dr(g,t,s)}g={type:"stylesheet",instance:g,count:1,state:b},c.set(u,g)}}}function py(e,t){On.X(e,t);var n=El;if(n&&e){var s=Ja(n).hoistableScripts,c=Ml(e),u=s.get(c);u||(u=n.querySelector(Ds(c)),u||(e=S({src:e,async:!0},t),(t=Zt.get(c))&&cu(e,t),u=n.createElement("script"),ut(u),gt(u,"link",e),n.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},s.set(c,u))}}function gy(e,t){On.M(e,t);var n=El;if(n&&e){var s=Ja(n).hoistableScripts,c=Ml(e),u=s.get(c);u||(u=n.querySelector(Ds(c)),u||(e=S({src:e,async:!0,type:"module"},t),(t=Zt.get(c))&&cu(e,t),u=n.createElement("script"),ut(u),gt(u,"link",e),n.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},s.set(c,u))}}function j0(e,t,n,s){var c=(c=ie.current)?fr(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=ql(n.href),n=Ja(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=ql(n.href);var u=Ja(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(_s(e)))&&!u._p&&(g.instance=u,g.state.loading=5),Zt.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},Zt.set(e,n),u||xy(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=Ml(n),n=Ja(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 ql(e){return'href="'+Ht(e)+'"'}function _s(e){return'link[rel="stylesheet"]['+e+"]"}function N0(e){return S({},e,{"data-precedence":e.precedence,precedence:null})}function xy(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}),gt(t,"link",n),ut(t),e.head.appendChild(t))}function Ml(e){return'[src="'+Ht(e)+'"]'}function Ds(e){return"script[async]"+e}function w0(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+Ht(n.href)+'"]');if(s)return t.instance=s,ut(s),s;var c=S({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),ut(s),gt(s,"style",c),dr(s,n.precedence,e),t.instance=s;case"stylesheet":c=ql(n.href);var u=e.querySelector(_s(c));if(u)return t.state.loading|=4,t.instance=u,ut(u),u;s=N0(n),(c=Zt.get(c))&&ou(s,c),u=(e.ownerDocument||e).createElement("link"),ut(u);var g=u;return g._p=new Promise(function(b,R){g.onload=b,g.onerror=R}),gt(u,"link",s),t.state.loading|=4,dr(u,n.precedence,e),t.instance=u;case"script":return u=Ml(n.src),(c=e.querySelector(Ds(u)))?(t.instance=c,ut(c),c):(s=n,(c=Zt.get(u))&&(s=S({},n),cu(s,c)),e=e.ownerDocument||e,c=e.createElement("script"),ut(c),gt(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,dr(s,n.precedence,e));return t.instance}function dr(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 b=s[g];if(b.dataset.precedence===t)u=b;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 ou(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function cu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var mr=null;function C0(e,t,n){if(mr===null){var s=new Map,c=mr=new Map;c.set(n,s)}else c=mr,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[Jl]||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 b=s.get(g);b?b.push(u):s.set(g,[u])}}return s}function E0(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function vy(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 q0(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function yy(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=ql(s.href),u=t.querySelector(_s(c));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=hr.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=u,ut(u);return}u=t.ownerDocument||t,s=N0(s),(c=Zt.get(c))&&ou(s,c),u=u.createElement("link"),ut(u);var g=u;g._p=new Promise(function(b,R){g.onload=b,g.onerror=R}),gt(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=hr.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var uu=0;function by(e,t){return e.stylesheets&&e.count===0&&gr(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var s=setTimeout(function(){if(e.stylesheets&&gr(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&uu===0&&(uu=62500*ey());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&gr(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>uu?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(c)}}:null}function hr(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)gr(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var pr=null;function gr(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,pr=new Map,t.forEach(Sy,e),pr=null,hr.call(e))}function Sy(e,t){if(!(t.state.loading&4)){var n=pr.get(e);if(n)var s=n.get(null);else{n=new Map,pr.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=hr.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 Os={$$typeof:k,Provider:null,Consumer:null,_currentValue:ne,_currentValue2:ne,_threadCount:0};function Ay(e,t,n,s,c,u,g,b,R){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=lo(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=lo(0),this.hiddenUpdates=lo(null),this.identifierPrefix=s,this.onUncaughtError=c,this.onCaughtError=u,this.onRecoverableError=g,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=R,this.incompleteTransitions=new Map}function M0(e,t,n,s,c,u,g,b,R,V,J,P){return e=new Ay(e,t,n,g,R,V,J,P,b),t=1,u===!0&&(t|=24),u=_t(3,null,null,t),e.current=u,u.stateNode=e,t=$o(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:s,isDehydrated:n,cache:t},Ko(u),e}function R0(e){return e?(e=il,e):il}function T0(e,t,n,s,c,u){c=R0(c),s.context===null?s.context=c:s.pendingContext=c,s=Pn(t),s.payload={element:n},u=u===void 0?null:u,u!==null&&(s.callback=u),n=ea(e,s,t),n!==null&&(Mt(n,e,t),ms(n,e,t))}function k0(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function fu(e,t){k0(e,t),(e=e.alternate)&&k0(e,t)}function _0(e){if(e.tag===13||e.tag===31){var t=wa(e,67108864);t!==null&&Mt(t,e,67108864),fu(e,67108864)}}function D0(e){if(e.tag===13||e.tag===31){var t=Lt();t=so(t);var n=wa(e,t);n!==null&&Mt(n,e,t),fu(e,t)}}var xr=!0;function jy(e,t,n,s){var c=T.T;T.T=null;var u=F.p;try{F.p=2,du(e,t,n,s)}finally{F.p=u,T.T=c}}function Ny(e,t,n,s){var c=T.T;T.T=null;var u=F.p;try{F.p=8,du(e,t,n,s)}finally{F.p=u,T.T=c}}function du(e,t,n,s){if(xr){var c=mu(s);if(c===null)Wc(e,t,s,vr,n),B0(e,s);else if(Cy(c,e,t,n,s))s.stopPropagation();else if(B0(e,s),t&4&&-1<wy.indexOf(e)){for(;c!==null;){var u=Fa(c);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var g=ba(u.pendingLanes);if(g!==0){var b=u;for(b.pendingLanes|=2,b.entangledLanes|=2;g;){var R=1<<31-ve(g);b.entanglements[1]|=R,g&=~R}fn(u),(De&6)===0&&(er=rt()+500,Ms(0))}}break;case 31:case 13:b=wa(u,2),b!==null&&Mt(b,u,2),nr(),fu(u,2)}if(u=mu(s),u===null&&Wc(e,t,s,vr,n),u===c)break;c=u}c!==null&&s.stopPropagation()}else Wc(e,t,s,null,n)}}function mu(e){return e=po(e),hu(e)}var vr=null;function hu(e){if(vr=null,e=Za(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 vr=e,null}function O0(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(Ql()){case ui:return 2;case Gn:return 8;case Xn:case Xa:return 32;case Kl:return 268435456;default:return 32}default:return 32}}var pu=!1,fa=null,da=null,ma=null,Bs=new Map,zs=new Map,ha=[],wy="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 B0(e,t){switch(e){case"focusin":case"focusout":fa=null;break;case"dragenter":case"dragleave":da=null;break;case"mouseover":case"mouseout":ma=null;break;case"pointerover":case"pointerout":Bs.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":zs.delete(t.pointerId)}}function Ls(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=Fa(t),t!==null&&_0(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function Cy(e,t,n,s,c){switch(t){case"focusin":return fa=Ls(fa,e,t,n,s,c),!0;case"dragenter":return da=Ls(da,e,t,n,s,c),!0;case"mouseover":return ma=Ls(ma,e,t,n,s,c),!0;case"pointerover":var u=c.pointerId;return Bs.set(u,Ls(Bs.get(u)||null,e,t,n,s,c)),!0;case"gotpointercapture":return u=c.pointerId,zs.set(u,Ls(zs.get(u)||null,e,t,n,s,c)),!0}return!1}function z0(e){var t=Za(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,If(e.priority,function(){D0(n)});return}}else if(t===31){if(t=p(n),t!==null){e.blockedOn=t,If(e.priority,function(){D0(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 yr(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=mu(e.nativeEvent);if(n===null){n=e.nativeEvent;var s=new n.constructor(n.type,n);ho=s,n.target.dispatchEvent(s),ho=null}else return t=Fa(n),t!==null&&_0(t),e.blockedOn=n,!1;t.shift()}return!0}function L0(e,t,n){yr(e)&&n.delete(t)}function Ey(){pu=!1,fa!==null&&yr(fa)&&(fa=null),da!==null&&yr(da)&&(da=null),ma!==null&&yr(ma)&&(ma=null),Bs.forEach(L0),zs.forEach(L0)}function br(e,t){e.blockedOn===t&&(e.blockedOn=null,pu||(pu=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,Ey)))}var Sr=null;function U0(e){Sr!==e&&(Sr=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){Sr===e&&(Sr=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(hu(s||n)===null)continue;break}var u=Fa(n);u!==null&&(e.splice(t,3),t-=3,mc(u,{pending:!0,data:c,method:n.method,action:s},s,c))}}))}function Rl(e){function t(R){return br(R,e)}fa!==null&&br(fa,e),da!==null&&br(da,e),ma!==null&&br(ma,e),Bs.forEach(t),zs.forEach(t);for(var n=0;n<ha.length;n++){var s=ha[n];s.blockedOn===e&&(s.blockedOn=null)}for(;0<ha.length&&(n=ha[0],n.blockedOn===null);)z0(n),n.blockedOn===null&&ha.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||U0(n);else if(g){var b=null;if(u&&u.hasAttribute("formAction")){if(c=u,g=u[jt]||null)b=g.formAction;else if(hu(c)!==null)continue}else b=g.action;typeof b=="function"?n[s+1]=b:(n.splice(s,3),s-=3),U0(n)}}}function H0(){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 gu(e){this._internalRoot=e}Ar.prototype.render=gu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));var n=t.current,s=Lt();T0(n,s,e,t,null,null)},Ar.prototype.unmount=gu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;T0(e.current,2,null,e,null,null),nr(),t[Ka]=null}};function Ar(e){this._internalRoot=e}Ar.prototype.unstable_scheduleHydration=function(e){if(e){var t=Jf();e={blockedOn:null,target:e,priority:t};for(var n=0;n<ha.length&&t!==0&&t<ha[n].priority;n++);ha.splice(n,0,e),n===0&&z0(e)}};var V0=l.version;if(V0!=="19.2.0")throw Error(r(527,V0,"19.2.0"));F.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 qy={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:T,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var jr=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!jr.isDisabled&&jr.supportsFiber)try{ya=jr.inject(qy),vt=jr}catch{}}return Hs.createRoot=function(e,t){if(!f(e))throw Error(r(299));var n=!1,s="",c=Zm,u=Fm,g=Jm;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=M0(e,1,!1,null,null,n,s,null,c,u,g,H0),e[Ka]=t.current,Ic(e),new gu(t)},Hs.hydrateRoot=function(e,t,n){if(!f(e))throw Error(r(299));var s=!1,c="",u=Zm,g=Fm,b=Jm,R=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&&(b=n.onRecoverableError),n.formState!==void 0&&(R=n.formState)),t=M0(e,1,!0,t,n??null,s,c,R,u,g,b,H0),t.context=R0(null),n=t.current,s=Lt(),s=so(s),c=Pn(s),c.callback=null,ea(n,c,s),n=s,t.current.lanes=n,Fl(t,n),fn(t),e[Ka]=t.current,Ic(e),new Ar(t)},Hs.version="19.2.0",Hs}var I0;function Uy(){if(I0)return yu.exports;I0=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(),yu.exports=Ly(),yu.exports}var Hy=Uy();var W0="popstate";function Vy(a={}){function l(r,f){let{pathname:d,search:h,hash:p}=r.location;return Ku("",{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:Is(f)}return $y(l,i,null,a)}function Fe(a,l){if(a===!1||a===null||typeof a>"u")throw new Error(l)}function rn(a,l){if(!a){typeof console<"u"&&console.warn(l);try{throw new Error(l)}catch{}}}function Yy(){return Math.random().toString(36).substring(2,10)}function P0(a,l){return{usr:a.state,key:a.key,idx:l}}function Ku(a,l,i=null,r){return{pathname:typeof a=="string"?a:a.pathname,search:"",hash:"",...typeof l=="string"?Vl(l):l,state:i,key:l&&l.key||r||Yy()}}function Is({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 Vl(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 $y(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 S(){p="POP";let j=y(),M=j==null?null:j-v;v=j,x&&x({action:p,location:C.location,delta:M})}function N(j,M){p="PUSH";let A=Ku(C.location,j,M);v=y()+1;let k=P0(A,v),O=C.createHref(A);try{h.pushState(k,"",O)}catch(B){if(B instanceof DOMException&&B.name==="DataCloneError")throw B;f.location.assign(O)}d&&x&&x({action:p,location:C.location,delta:1})}function q(j,M){p="REPLACE";let A=Ku(C.location,j,M);v=y();let k=P0(A,v),O=C.createHref(A);h.replaceState(k,"",O),d&&x&&x({action:p,location:C.location,delta:0})}function E(j){return Gy(j)}let C={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(W0,S),x=j,()=>{f.removeEventListener(W0,S),x=null}},createHref(j){return l(f,j)},createURL:E,encodeLocation(j){let M=E(j);return{pathname:M.pathname,search:M.search,hash:M.hash}},push:N,replace:q,go(j){return h.go(j)}};return C}function Gy(a,l=!1){let i="http://localhost";typeof window<"u"&&(i=window.location.origin!=="null"?window.location.origin:window.location.href),Fe(i,"No window.location.(origin|href) available to create URL");let r=typeof a=="string"?a:Is(a);return r=r.replace(/ $/,"%20"),!l&&r.startsWith("//")&&(r=i+r),new URL(r,i)}function Xp(a,l,i="/"){return Xy(a,l,i,!1)}function Xy(a,l,i,r){let f=typeof l=="string"?Vl(l):l,d=Vn(f.pathname||"/",i);if(d==null)return null;let h=Qp(a);Qy(h);let p=null;for(let x=0;p==null&&x<h.length;++x){let v=ab(d);p=tb(h[x],v,r)}return p}function Qp(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;Fe(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 S=Hn([r,y.relativePath]),N=i.concat(y);h.children&&h.children.length>0&&(Fe(h.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${S}".`),Qp(h.children,l,N,S,x)),!(h.path==null&&!h.index)&&l.push({path:S,score:Py(S,h.index),routesMeta:N})};return a.forEach((h,p)=>{if(h.path===""||!h.path?.includes("?"))d(h,p);else for(let x of Kp(h.path))d(h,p,!0,x)}),l}function Kp(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=Kp(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 Qy(a){a.sort((l,i)=>l.score!==i.score?i.score-l.score:eb(l.routesMeta.map(r=>r.childrenIndex),i.routesMeta.map(r=>r.childrenIndex)))}var Ky=/^:[\w-]+$/,Zy=3,Fy=2,Jy=1,Iy=10,Wy=-2,ep=a=>a==="*";function Py(a,l){let i=a.split("/"),r=i.length;return i.some(ep)&&(r+=Wy),l&&(r+=Fy),i.filter(f=>!ep(f)).reduce((f,d)=>f+(Ky.test(d)?Zy:d===""?Jy:Iy),r)}function eb(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 tb(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)||"/",S=Hr({path:x.relativePath,caseSensitive:x.caseSensitive,end:v},y),N=x.route;if(!S&&v&&i&&!r[r.length-1].route.index&&(S=Hr({path:x.relativePath,caseSensitive:x.caseSensitive,end:!1},y)),!S)return null;Object.assign(f,S.params),h.push({params:f,pathname:Hn([d,S.pathname]),pathnameBase:ob(Hn([d,S.pathnameBase])),route:N}),S.pathnameBase!=="/"&&(d=Hn([d,S.pathnameBase]))}return h}function Hr(a,l){typeof a=="string"&&(a={path:a,caseSensitive:!1,end:!0});let[i,r]=nb(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:S},N)=>{if(y==="*"){let E=p[N]||"";h=d.slice(0,d.length-E.length).replace(/(.)\/+$/,"$1")}const q=p[N];return S&&!q?v[y]=void 0:v[y]=(q||"").replace(/%2F/g,"/"),v},{}),pathname:d,pathnameBase:h,pattern:a}}function nb(a,l=!1,i=!0){rn(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 ab(a){try{return a.split("/").map(l=>decodeURIComponent(l).replace(/\//g,"%2F")).join("/")}catch(l){return rn(!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 Vn(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 lb=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,sb=a=>lb.test(a);function ib(a,l="/"){let{pathname:i,search:r="",hash:f=""}=typeof a=="string"?Vl(a):a,d;if(i)if(sb(i))d=i;else{if(i.includes("//")){let h=i;i=i.replace(/\/\/+/g,"/"),rn(!1,`Pathnames cannot have embedded double slashes - normalizing ${h} -> ${i}`)}i.startsWith("/")?d=tp(i.substring(1),"/"):d=tp(i,l)}else d=l;return{pathname:d,search:cb(r),hash:ub(f)}}function tp(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 ju(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 rb(a){return a.filter((l,i)=>i===0||l.route.path&&l.route.path.length>0)}function Zp(a){let l=rb(a);return l.map((i,r)=>r===l.length-1?i.pathname:i.pathnameBase)}function Fp(a,l,i,r=!1){let f;typeof a=="string"?f=Vl(a):(f={...a},Fe(!f.pathname||!f.pathname.includes("?"),ju("?","pathname","search",f)),Fe(!f.pathname||!f.pathname.includes("#"),ju("#","pathname","hash",f)),Fe(!f.search||!f.search.includes("#"),ju("#","search","hash",f)));let d=a===""||f.pathname==="",h=d?"/":f.pathname,p;if(h==null)p=i;else{let S=l.length-1;if(!r&&h.startsWith("..")){let N=h.split("/");for(;N[0]==="..";)N.shift(),S-=1;f.pathname=N.join("/")}p=S>=0?l[S]:"/"}let x=ib(f,p),v=h&&h!=="/"&&h.endsWith("/"),y=(d||h===".")&&i.endsWith("/");return!x.pathname.endsWith("/")&&(v||y)&&(x.pathname+="/"),x}var Hn=a=>a.join("/").replace(/\/\/+/g,"/"),ob=a=>a.replace(/\/+$/,"").replace(/^\/*/,"/"),cb=a=>!a||a==="?"?"":a.startsWith("?")?a:"?"+a,ub=a=>!a||a==="#"?"":a.startsWith("#")?a:"#"+a;function fb(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 Jp=["POST","PUT","PATCH","DELETE"];new Set(Jp);var db=["GET",...Jp];new Set(db);var Yl=m.createContext(null);Yl.displayName="DataRouter";var Kr=m.createContext(null);Kr.displayName="DataRouterState";m.createContext(!1);var Ip=m.createContext({isTransitioning:!1});Ip.displayName="ViewTransition";var mb=m.createContext(new Map);mb.displayName="Fetchers";var hb=m.createContext(null);hb.displayName="Await";var gn=m.createContext(null);gn.displayName="Navigation";var si=m.createContext(null);si.displayName="Location";var Yn=m.createContext({outlet:null,matches:[],isDataRoute:!1});Yn.displayName="Route";var mf=m.createContext(null);mf.displayName="RouteError";function pb(a,{relative:l}={}){Fe(ii(),"useHref() may be used only in the context of a <Router> component.");let{basename:i,navigator:r}=m.useContext(gn),{hash:f,pathname:d,search:h}=ri(a,{relative:l}),p=d;return i!=="/"&&(p=d==="/"?i:Hn([i,d])),r.createHref({pathname:p,search:h,hash:f})}function ii(){return m.useContext(si)!=null}function Ga(){return Fe(ii(),"useLocation() may be used only in the context of a <Router> component."),m.useContext(si).location}var Wp="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Pp(a){m.useContext(gn).static||m.useLayoutEffect(a)}function gb(){let{isDataRoute:a}=m.useContext(Yn);return a?Mb():xb()}function xb(){Fe(ii(),"useNavigate() may be used only in the context of a <Router> component.");let a=m.useContext(Yl),{basename:l,navigator:i}=m.useContext(gn),{matches:r}=m.useContext(Yn),{pathname:f}=Ga(),d=JSON.stringify(Zp(r)),h=m.useRef(!1);return Pp(()=>{h.current=!0}),m.useCallback((x,v={})=>{if(rn(h.current,Wp),!h.current)return;if(typeof x=="number"){i.go(x);return}let y=Fp(x,JSON.parse(d),f,v.relative==="path");a==null&&l!=="/"&&(y.pathname=y.pathname==="/"?l:Hn([l,y.pathname])),(v.replace?i.replace:i.push)(y,v.state,v)},[l,i,d,f,a])}m.createContext(null);function ri(a,{relative:l}={}){let{matches:i}=m.useContext(Yn),{pathname:r}=Ga(),f=JSON.stringify(Zp(i));return m.useMemo(()=>Fp(a,JSON.parse(f),r,l==="path"),[a,f,r,l])}function vb(a,l){return eg(a,l)}function eg(a,l,i,r,f){Fe(ii(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:d}=m.useContext(gn),{matches:h}=m.useContext(Yn),p=h[h.length-1],x=p?p.params:{},v=p?p.pathname:"/",y=p?p.pathnameBase:"/",S=p&&p.route;{let A=S&&S.path||"";tg(v,!S||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=Ga(),q;if(l){let A=typeof l=="string"?Vl(l):l;Fe(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.`),q=A}else q=N;let E=q.pathname||"/",C=E;if(y!=="/"){let A=y.replace(/^\//,"").split("/");C="/"+E.replace(/^\//,"").split("/").slice(A.length).join("/")}let j=Xp(a,{pathname:C});rn(S||j!=null,`No routes matched location "${q.pathname}${q.search}${q.hash}" `),rn(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 "${q.pathname}${q.search}${q.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 M=jb(j&&j.map(A=>Object.assign({},A,{params:Object.assign({},x,A.params),pathname:Hn([y,d.encodeLocation?d.encodeLocation(A.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:A.pathname]),pathnameBase:A.pathnameBase==="/"?y:Hn([y,d.encodeLocation?d.encodeLocation(A.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:A.pathnameBase])})),h,i,r,f);return l&&M?m.createElement(si.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...q},navigationType:"POP"}},M):M}function yb(){let a=qb(),l=fb(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 bb=m.createElement(yb,null),Sb=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(Yn.Provider,{value:this.props.routeContext},m.createElement(mf.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function Ab({routeContext:a,match:l,children:i}){let r=m.useContext(Yl);return r&&r.static&&r.staticContext&&(l.route.errorElement||l.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=l.route.id),m.createElement(Yn.Provider,{value:a},i)}function jb(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(S=>S.route.id&&h?.[S.route.id]!==void 0);Fe(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 S=d[y];if((S.route.HydrateFallback||S.route.hydrateFallbackElement)&&(x=y),S.route.id){let{loaderData:N,errors:q}=i,E=S.route.loader&&!N.hasOwnProperty(S.route.id)&&(!q||q[S.route.id]===void 0);if(S.route.lazy||E){p=!0,x>=0?d=d.slice(0,x+1):d=[d[0]];break}}}let v=i&&r?(y,S)=>{r(y,{location:i.location,params:i.matches?.[0]?.params??{},errorInfo:S})}:void 0;return d.reduceRight((y,S,N)=>{let q,E=!1,C=null,j=null;i&&(q=h&&S.route.id?h[S.route.id]:void 0,C=S.route.errorElement||bb,p&&(x<0&&N===0?(tg("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),E=!0,j=null):x===N&&(E=!0,j=S.route.hydrateFallbackElement||null)));let M=l.concat(d.slice(0,N+1)),A=()=>{let k;return q?k=C:E?k=j:S.route.Component?k=m.createElement(S.route.Component,null):S.route.element?k=S.route.element:k=y,m.createElement(Ab,{match:S,routeContext:{outlet:y,matches:M,isDataRoute:i!=null},children:k})};return i&&(S.route.ErrorBoundary||S.route.errorElement||N===0)?m.createElement(Sb,{location:i.location,revalidation:i.revalidation,component:C,error:q,children:A(),routeContext:{outlet:null,matches:M,isDataRoute:!0},onError:v}):A()},null)}function hf(a){return`${a} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Nb(a){let l=m.useContext(Yl);return Fe(l,hf(a)),l}function wb(a){let l=m.useContext(Kr);return Fe(l,hf(a)),l}function Cb(a){let l=m.useContext(Yn);return Fe(l,hf(a)),l}function pf(a){let l=Cb(a),i=l.matches[l.matches.length-1];return Fe(i.route.id,`${a} can only be used on routes that contain a unique "id"`),i.route.id}function Eb(){return pf("useRouteId")}function qb(){let a=m.useContext(mf),l=wb("useRouteError"),i=pf("useRouteError");return a!==void 0?a:l.errors?.[i]}function Mb(){let{router:a}=Nb("useNavigate"),l=pf("useNavigate"),i=m.useRef(!1);return Pp(()=>{i.current=!0}),m.useCallback(async(f,d={})=>{rn(i.current,Wp),i.current&&(typeof f=="number"?a.navigate(f):await a.navigate(f,{fromRouteId:l,...d}))},[a,l])}var np={};function tg(a,l,i){!l&&!np[a]&&(np[a]=!0,rn(!1,i))}m.memo(Rb);function Rb({routes:a,future:l,state:i,unstable_onError:r}){return eg(a,void 0,i,r,l)}function Rr(a){Fe(!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 Tb({basename:a="/",children:l=null,location:i,navigationType:r="POP",navigator:f,static:d=!1}){Fe(!ii(),"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=Vl(i));let{pathname:x="/",search:v="",hash:y="",state:S=null,key:N="default"}=i,q=m.useMemo(()=>{let E=Vn(x,h);return E==null?null:{location:{pathname:E,search:v,hash:y,state:S,key:N},navigationType:r}},[h,x,v,y,S,N,r]);return rn(q!=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.`),q==null?null:m.createElement(gn.Provider,{value:p},m.createElement(si.Provider,{children:l,value:q}))}function kb({children:a,location:l}){return vb(Zu(a),l)}function Zu(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,Zu(r.props.children,d));return}Fe(r.type===Rr,`[${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>`),Fe(!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=Zu(r.props.children,d)),i.push(h)}),i}var Tr="get",kr="application/x-www-form-urlencoded";function Zr(a){return a!=null&&typeof a.tagName=="string"}function _b(a){return Zr(a)&&a.tagName.toLowerCase()==="button"}function Db(a){return Zr(a)&&a.tagName.toLowerCase()==="form"}function Ob(a){return Zr(a)&&a.tagName.toLowerCase()==="input"}function Bb(a){return!!(a.metaKey||a.altKey||a.ctrlKey||a.shiftKey)}function zb(a,l){return a.button===0&&(!l||l==="_self")&&!Bb(a)}var Nr=null;function Lb(){if(Nr===null)try{new FormData(document.createElement("form"),0),Nr=!1}catch{Nr=!0}return Nr}var Ub=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Nu(a){return a!=null&&!Ub.has(a)?(rn(!1,`"${a}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${kr}"`),null):a}function Hb(a,l){let i,r,f,d,h;if(Db(a)){let p=a.getAttribute("action");r=p?Vn(p,l):null,i=a.getAttribute("method")||Tr,f=Nu(a.getAttribute("enctype"))||kr,d=new FormData(a)}else if(_b(a)||Ob(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?Vn(x,l):null,i=a.getAttribute("formmethod")||p.getAttribute("method")||Tr,f=Nu(a.getAttribute("formenctype"))||Nu(p.getAttribute("enctype"))||kr,d=new FormData(p,a),!Lb()){let{name:v,type:y,value:S}=a;if(y==="image"){let N=v?`${v}.`:"";d.append(`${N}x`,"0"),d.append(`${N}y`,"0")}else v&&d.append(v,S)}}else{if(Zr(a))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');i=Tr,r=null,f=kr,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 gf(a,l){if(a===!1||a===null||typeof a>"u")throw new Error(l)}function Vb(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&&Vn(r.pathname,l)==="/"?r.pathname=`${l.replace(/\/$/,"")}/_root.${i}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${i}`,r}async function Yb(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 $b(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 Gb(a,l,i){let r=await Promise.all(a.map(async f=>{let d=l.routes[f.route.id];if(d){let h=await Yb(d,i);return h.links?h.links():[]}return[]}));return Zb(r.flat(1).filter($b).filter(f=>f.rel==="stylesheet"||f.rel==="preload").map(f=>f.rel==="stylesheet"?{...f,rel:"prefetch",as:"style"}:{...f,rel:"prefetch"}))}function ap(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 S=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 S=="boolean")return S}return!0}):[]}function Xb(a,l,{includeHydrateFallback:i}={}){return Qb(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 Qb(a){return[...new Set(a)]}function Kb(a){let l={},i=Object.keys(a).sort();for(let r of i)l[r]=a[r];return l}function Zb(a,l){let i=new Set;return new Set(l),a.reduce((r,f)=>{let d=JSON.stringify(Kb(f));return i.has(d)||(i.add(d),r.push({key:d,link:f})),r},[])}function ng(){let a=m.useContext(Yl);return gf(a,"You must render this element inside a <DataRouterContext.Provider> element"),a}function Fb(){let a=m.useContext(Kr);return gf(a,"You must render this element inside a <DataRouterStateContext.Provider> element"),a}var xf=m.createContext(void 0);xf.displayName="FrameworkContext";function ag(){let a=m.useContext(xf);return gf(a,"You must render this element inside a <HydratedRouter> element"),a}function Jb(a,l){let i=m.useContext(xf),[r,f]=m.useState(!1),[d,h]=m.useState(!1),{onFocus:p,onBlur:x,onMouseEnter:v,onMouseLeave:y,onTouchStart:S}=l,N=m.useRef(null);m.useEffect(()=>{if(a==="render"&&h(!0),a==="viewport"){let C=M=>{M.forEach(A=>{h(A.isIntersecting)})},j=new IntersectionObserver(C,{threshold:.5});return N.current&&j.observe(N.current),()=>{j.disconnect()}}},[a]),m.useEffect(()=>{if(r){let C=setTimeout(()=>{h(!0)},100);return()=>{clearTimeout(C)}}},[r]);let q=()=>{f(!0)},E=()=>{f(!1),h(!1)};return i?a!=="intent"?[d,N,{}]:[d,N,{onFocus:Vs(p,q),onBlur:Vs(x,E),onMouseEnter:Vs(v,q),onMouseLeave:Vs(y,E),onTouchStart:Vs(S,q)}]:[!1,N,{}]}function Vs(a,l){return i=>{a&&a(i),i.defaultPrevented||l(i)}}function Ib({page:a,...l}){let{router:i}=ng(),r=m.useMemo(()=>Xp(i.routes,a,i.basename),[i.routes,a,i.basename]);return r?m.createElement(Pb,{page:a,matches:r,...l}):null}function Wb(a){let{manifest:l,routeModules:i}=ag(),[r,f]=m.useState([]);return m.useEffect(()=>{let d=!1;return Gb(a,l,i).then(h=>{d||f(h)}),()=>{d=!0}},[a,l,i]),r}function Pb({page:a,matches:l,...i}){let r=Ga(),{manifest:f,routeModules:d}=ag(),{basename:h}=ng(),{loaderData:p,matches:x}=Fb(),v=m.useMemo(()=>ap(a,l,x,f,r,"data"),[a,l,x,f,r]),y=m.useMemo(()=>ap(a,l,x,f,r,"assets"),[a,l,x,f,r]),S=m.useMemo(()=>{if(a===r.pathname+r.search+r.hash)return[];let E=new Set,C=!1;if(l.forEach(M=>{let A=f.routes[M.route.id];!A||!A.hasLoader||(!v.some(k=>k.route.id===M.route.id)&&M.route.id in p&&d[M.route.id]?.shouldRevalidate||A.hasClientLoader?C=!0:E.add(M.route.id))}),E.size===0)return[];let j=Vb(a,h,"data");return C&&E.size>0&&j.searchParams.set("_routes",l.filter(M=>E.has(M.route.id)).map(M=>M.route.id).join(",")),[j.pathname+j.search]},[h,p,r,f,v,l,a,d]),N=m.useMemo(()=>Xb(y,f),[y,f]),q=Wb(y);return m.createElement(m.Fragment,null,S.map(E=>m.createElement("link",{key:E,rel:"prefetch",as:"fetch",href:E,...i})),N.map(E=>m.createElement("link",{key:E,rel:"modulepreload",href:E,...i})),q.map(({key:E,link:C})=>m.createElement("link",{key:E,nonce:i.nonce,...C})))}function e1(...a){return l=>{a.forEach(i=>{typeof i=="function"?i(l):i!=null&&(i.current=l)})}}var lg=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{lg&&(window.__reactRouterVersion="7.9.6")}catch{}function t1({basename:a,children:l,window:i}){let r=m.useRef();r.current==null&&(r.current=Vy({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(Tb,{basename:a,children:l,location:d.location,navigationType:d.action,navigator:f})}var sg=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ig=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:S,...N},q){let{basename:E}=m.useContext(gn),C=typeof v=="string"&&sg.test(v),j,M=!1;if(typeof v=="string"&&C&&(j=v,lg))try{let $=new URL(window.location.href),Q=v.startsWith("//")?new URL($.protocol+v):new URL(v),L=Vn(Q.pathname,E);Q.origin===$.origin&&L!=null?v=L+Q.search+Q.hash:M=!0}catch{rn(!1,`<Link to="${v}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let A=pb(v,{relative:f}),[k,O,B]=Jb(r,N),Z=s1(v,{replace:h,state:p,target:x,preventScrollReset:y,relative:f,viewTransition:S});function z($){l&&l($),$.defaultPrevented||Z($)}let X=m.createElement("a",{...N,...B,href:j||A,onClick:M||d?l:z,ref:e1(q,O),target:x,"data-discover":!C&&i==="render"?"true":void 0});return k&&!C?m.createElement(m.Fragment,null,X,m.createElement(Ib,{page:A})):X});ig.displayName="Link";var n1=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 S=ri(h,{relative:v.relative}),N=Ga(),q=m.useContext(Kr),{navigator:E,basename:C}=m.useContext(gn),j=q!=null&&u1(S)&&p===!0,M=E.encodeLocation?E.encodeLocation(S).pathname:S.pathname,A=N.pathname,k=q&&q.navigation&&q.navigation.location?q.navigation.location.pathname:null;i||(A=A.toLowerCase(),k=k?k.toLowerCase():null,M=M.toLowerCase()),k&&C&&(k=Vn(k,C)||k);const O=M!=="/"&&M.endsWith("/")?M.length-1:M.length;let B=A===M||!f&&A.startsWith(M)&&A.charAt(O)==="/",Z=k!=null&&(k===M||!f&&k.startsWith(M)&&k.charAt(M.length)==="/"),z={isActive:B,isPending:Z,isTransitioning:j},X=B?l:void 0,$;typeof r=="function"?$=r(z):$=[r,B?"active":null,Z?"pending":null,j?"transitioning":null].filter(Boolean).join(" ");let Q=typeof d=="function"?d(z):d;return m.createElement(ig,{...v,"aria-current":X,className:$,ref:y,style:Q,to:h,viewTransition:p},typeof x=="function"?x(z):x)});n1.displayName="NavLink";var a1=m.forwardRef(({discover:a="render",fetcherKey:l,navigate:i,reloadDocument:r,replace:f,state:d,method:h=Tr,action:p,onSubmit:x,relative:v,preventScrollReset:y,viewTransition:S,...N},q)=>{let E=o1(),C=c1(p,{relative:v}),j=h.toLowerCase()==="get"?"get":"post",M=typeof p=="string"&&sg.test(p),A=k=>{if(x&&x(k),k.defaultPrevented)return;k.preventDefault();let O=k.nativeEvent.submitter,B=O?.getAttribute("formmethod")||h;E(O||k.currentTarget,{fetcherKey:l,method:B,navigate:i,replace:f,state:d,relative:v,preventScrollReset:y,viewTransition:S})};return m.createElement("form",{ref:q,method:j,action:C,onSubmit:r?x:A,...N,"data-discover":!M&&a==="render"?"true":void 0})});a1.displayName="Form";function l1(a){return`${a} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function rg(a){let l=m.useContext(Yl);return Fe(l,l1(a)),l}function s1(a,{target:l,replace:i,state:r,preventScrollReset:f,relative:d,viewTransition:h}={}){let p=gb(),x=Ga(),v=ri(a,{relative:d});return m.useCallback(y=>{if(zb(y,l)){y.preventDefault();let S=i!==void 0?i:Is(x)===Is(v);p(a,{replace:S,state:r,preventScrollReset:f,relative:d,viewTransition:h})}},[x,p,v,i,r,l,a,f,d,h])}var i1=0,r1=()=>`__${String(++i1)}__`;function o1(){let{router:a}=rg("useSubmit"),{basename:l}=m.useContext(gn),i=Eb();return m.useCallback(async(r,f={})=>{let{action:d,method:h,encType:p,formData:x,body:v}=Hb(r,l);if(f.navigate===!1){let y=f.fetcherKey||r1();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 c1(a,{relative:l}={}){let{basename:i}=m.useContext(gn),r=m.useContext(Yn);Fe(r,"useFormAction must be used inside a RouteContext");let[f]=r.matches.slice(-1),d={...ri(a||".",{relative:l})},h=Ga();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(S=>S).forEach(S=>p.append("index",S));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:Hn([i,d.pathname])),Is(d)}function u1(a,{relative:l}={}){let i=m.useContext(Ip);Fe(i!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=rg("useViewTransitionState"),f=ri(a,{relative:l});if(!i.isTransitioning)return!1;let d=Vn(i.currentLocation.pathname,r)||i.currentLocation.pathname,h=Vn(i.nextLocation.pathname,r)||i.nextLocation.pathname;return Hr(f.pathname,h)!=null||Hr(f.pathname,d)!=null}const pn=Object.create(null);pn.open="0";pn.close="1";pn.ping="2";pn.pong="3";pn.message="4";pn.upgrade="5";pn.noop="6";const _r=Object.create(null);Object.keys(pn).forEach(a=>{_r[pn[a]]=a});const Fu={type:"error",data:"parser error"},og=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",cg=typeof ArrayBuffer=="function",ug=a=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(a):a&&a.buffer instanceof ArrayBuffer,vf=({type:a,data:l},i,r)=>og&&l instanceof Blob?i?r(l):lp(l,r):cg&&(l instanceof ArrayBuffer||ug(l))?i?r(l):lp(new Blob([l]),r):r(pn[a]+(l||"")),lp=(a,l)=>{const i=new FileReader;return i.onload=function(){const r=i.result.split(",")[1];l("b"+(r||""))},i.readAsDataURL(a)};function sp(a){return a instanceof Uint8Array?a:a instanceof ArrayBuffer?new Uint8Array(a):new Uint8Array(a.buffer,a.byteOffset,a.byteLength)}let wu;function f1(a,l){if(og&&a.data instanceof Blob)return a.data.arrayBuffer().then(sp).then(l);if(cg&&(a.data instanceof ArrayBuffer||ug(a.data)))return l(sp(a.data));vf(a,!1,i=>{wu||(wu=new TextEncoder),l(wu.encode(i))})}const ip="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ks=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let a=0;a<ip.length;a++)Ks[ip.charCodeAt(a)]=a;const d1=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=Ks[a.charCodeAt(r)],h=Ks[a.charCodeAt(r+1)],p=Ks[a.charCodeAt(r+2)],x=Ks[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},m1=typeof ArrayBuffer=="function",yf=(a,l)=>{if(typeof a!="string")return{type:"message",data:fg(a,l)};const i=a.charAt(0);return i==="b"?{type:"message",data:h1(a.substring(1),l)}:_r[i]?a.length>1?{type:_r[i],data:a.substring(1)}:{type:_r[i]}:Fu},h1=(a,l)=>{if(m1){const i=d1(a);return fg(i,l)}else return{base64:!0,data:a}},fg=(a,l)=>{switch(l){case"blob":return a instanceof Blob?a:new Blob([a]);case"arraybuffer":default:return a instanceof ArrayBuffer?a:a.buffer}},dg="",p1=(a,l)=>{const i=a.length,r=new Array(i);let f=0;a.forEach((d,h)=>{vf(d,!1,p=>{r[h]=p,++f===i&&l(r.join(dg))})})},g1=(a,l)=>{const i=a.split(dg),r=[];for(let f=0;f<i.length;f++){const d=yf(i[f],l);if(r.push(d),d.type==="error")break}return r};function x1(){return new TransformStream({transform(a,l){f1(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 Cu;function wr(a){return a.reduce((l,i)=>l+i.length,0)}function Cr(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 v1(a,l){Cu||(Cu=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(wr(i)<1)break;const x=Cr(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(wr(i)<2)break;const x=Cr(i,2);f=new DataView(x.buffer,x.byteOffset,x.length).getUint16(0),r=3}else if(r===2){if(wr(i)<8)break;const x=Cr(i,8),v=new DataView(x.buffer,x.byteOffset,x.length),y=v.getUint32(0);if(y>Math.pow(2,21)-1){p.enqueue(Fu);break}f=y*Math.pow(2,32)+v.getUint32(4),r=3}else{if(wr(i)<f)break;const x=Cr(i,f);p.enqueue(yf(d?x:Cu.decode(x),l)),r=0}if(f===0||f>a){p.enqueue(Fu);break}}}})}const mg=4;function st(a){if(a)return y1(a)}function y1(a){for(var l in st.prototype)a[l]=st.prototype[l];return a}st.prototype.on=st.prototype.addEventListener=function(a,l){return this._callbacks=this._callbacks||{},(this._callbacks["$"+a]=this._callbacks["$"+a]||[]).push(l),this};st.prototype.once=function(a,l){function i(){this.off(a,i),l.apply(this,arguments)}return i.fn=l,this.on(a,i),this};st.prototype.off=st.prototype.removeListener=st.prototype.removeAllListeners=st.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};st.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};st.prototype.emitReserved=st.prototype.emit;st.prototype.listeners=function(a){return this._callbacks=this._callbacks||{},this._callbacks["$"+a]||[]};st.prototype.hasListeners=function(a){return!!this.listeners(a).length};const Fr=typeof Promise=="function"&&typeof Promise.resolve=="function"?l=>Promise.resolve().then(l):(l,i)=>i(l,0),Jt=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),b1="arraybuffer";function hg(a,...l){return l.reduce((i,r)=>(a.hasOwnProperty(r)&&(i[r]=a[r]),i),{})}const S1=Jt.setTimeout,A1=Jt.clearTimeout;function Jr(a,l){l.useNativeTimers?(a.setTimeoutFn=S1.bind(Jt),a.clearTimeoutFn=A1.bind(Jt)):(a.setTimeoutFn=Jt.setTimeout.bind(Jt),a.clearTimeoutFn=Jt.clearTimeout.bind(Jt))}const j1=1.33;function N1(a){return typeof a=="string"?w1(a):Math.ceil((a.byteLength||a.size)*j1)}function w1(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 pg(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function C1(a){let l="";for(let i in a)a.hasOwnProperty(i)&&(l.length&&(l+="&"),l+=encodeURIComponent(i)+"="+encodeURIComponent(a[i]));return l}function E1(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 q1 extends Error{constructor(l,i,r){super(l),this.description=i,this.context=r,this.type="TransportError"}}class bf extends st{constructor(l){super(),this.writable=!1,Jr(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 q1(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=yf(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=C1(l);return i.length?"?"+i:""}}class M1 extends bf{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)};g1(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,p1(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]=pg()),!this.supportsBinary&&!i.sid&&(i.b64=1),this.createUri(l,i)}}let gg=!1;try{gg=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const R1=gg;function T1(){}class k1 extends M1{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 hn extends st{constructor(l,i,r){super(),this.createRequest=l,Jr(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=hg(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=hn.requestsCount++,hn.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=T1,l)try{this._xhr.abort()}catch{}typeof document<"u"&&delete hn.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()}}hn.requestsCount=0;hn.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",rp);else if(typeof addEventListener=="function"){const a="onpagehide"in Jt?"pagehide":"unload";addEventListener(a,rp,!1)}}function rp(){for(let a in hn.requests)hn.requests.hasOwnProperty(a)&&hn.requests[a].abort()}const _1=(function(){const a=xg({xdomain:!1});return a&&a.responseType!==null})();class D1 extends k1{constructor(l){super(l);const i=l&&l.forceBase64;this.supportsBinary=_1&&!i}request(l={}){return Object.assign(l,{xd:this.xd},this.opts),new hn(xg,this.uri(),l)}}function xg(a){const l=a.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!l||R1))return new XMLHttpRequest}catch{}if(!l)try{return new Jt[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const vg=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class O1 extends bf{get name(){return"websocket"}doOpen(){const l=this.uri(),i=this.opts.protocols,r=vg?{}:hg(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;vf(r,this.supportsBinary,d=>{try{this.doWrite(r,d)}catch{}f&&Fr(()=>{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]=pg()),this.supportsBinary||(i.b64=1),this.createUri(l,i)}}const Eu=Jt.WebSocket||Jt.MozWebSocket;class B1 extends O1{createSocket(l,i,r){return vg?new Eu(l,i,r):i?new Eu(l,i):new Eu(l)}doWrite(l,i){this.ws.send(i)}}class z1 extends bf{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=v1(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=l.readable.pipeThrough(i).getReader(),f=x1();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&&Fr(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var l;(l=this._transport)===null||l===void 0||l.close()}}const L1={websocket:B1,webtransport:z1,polling:D1},U1=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,H1=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Ju(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=U1.exec(a||""),d={},h=14;for(;h--;)d[H1[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=V1(d,d.path),d.queryKey=Y1(d,d.query),d}function V1(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 Y1(a,l){const i={};return l.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,f,d){f&&(i[f]=d)}),i}const Iu=typeof addEventListener=="function"&&typeof removeEventListener=="function",Dr=[];Iu&&addEventListener("offline",()=>{Dr.forEach(a=>a())},!1);class xa extends st{constructor(l,i){if(super(),this.binaryType=b1,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=Ju(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=Ju(i.host).host);Jr(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=E1(this.opts.query)),Iu&&(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"})},Dr.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(l){const i=Object.assign({},this.opts.query);i.EIO=mg,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&&xa.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",xa.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+=N1(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,Fr(()=>{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(xa.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(),Iu&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=Dr.indexOf(this._offlineEventListener);r!==-1&&Dr.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",l,i),this.writeBuffer=[],this._prevBufferLen=0}}}xa.protocol=mg;class $1 extends xa{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;xa.priorWebsocketSuccess=!1;const f=()=>{r||(i.send([{type:"ping",data:"probe"}]),i.once("packet",S=>{if(!r)if(S.type==="pong"&&S.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",i),!i)return;xa.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=S=>{const N=new Error("probe error: "+S);N.transport=i.name,d(),this.emitReserved("upgradeError",N)};function p(){h("transport closed")}function x(){h("socket closed")}function v(S){i&&S.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 G1=class extends $1{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=>L1[f]).filter(f=>!!f)),super(l,r)}};function X1(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=Ju(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 Q1=typeof ArrayBuffer=="function",K1=a=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(a):a.buffer instanceof ArrayBuffer,yg=Object.prototype.toString,Z1=typeof Blob=="function"||typeof Blob<"u"&&yg.call(Blob)==="[object BlobConstructor]",F1=typeof File=="function"||typeof File<"u"&&yg.call(File)==="[object FileConstructor]";function Sf(a){return Q1&&(a instanceof ArrayBuffer||K1(a))||Z1&&a instanceof Blob||F1&&a instanceof File}function Or(a,l){if(!a||typeof a!="object")return!1;if(Array.isArray(a)){for(let i=0,r=a.length;i<r;i++)if(Or(a[i]))return!0;return!1}if(Sf(a))return!0;if(a.toJSON&&typeof a.toJSON=="function"&&arguments.length===1)return Or(a.toJSON(),!0);for(const i in a)if(Object.prototype.hasOwnProperty.call(a,i)&&Or(a[i]))return!0;return!1}function J1(a){const l=[],i=a.data,r=a;return r.data=Wu(i,l),r.attachments=l.length,{packet:r,buffers:l}}function Wu(a,l){if(!a)return a;if(Sf(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]=Wu(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]=Wu(a[r],l));return i}return a}function I1(a,l){return a.data=Pu(a.data,l),delete a.attachments,a}function Pu(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]=Pu(a[i],l);else if(typeof a=="object")for(const i in a)Object.prototype.hasOwnProperty.call(a,i)&&(a[i]=Pu(a[i],l));return a}const W1=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],P1=5;var Me;(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"})(Me||(Me={}));class eS{constructor(l){this.replacer=l}encode(l){return(l.type===Me.EVENT||l.type===Me.ACK)&&Or(l)?this.encodeAsBinary({type:l.type===Me.EVENT?Me.BINARY_EVENT:Me.BINARY_ACK,nsp:l.nsp,data:l.data,id:l.id}):[this.encodeAsString(l)]}encodeAsString(l){let i=""+l.type;return(l.type===Me.BINARY_EVENT||l.type===Me.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=J1(l),r=this.encodeAsString(i.packet),f=i.buffers;return f.unshift(r),f}}function op(a){return Object.prototype.toString.call(a)==="[object Object]"}class Af extends st{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===Me.BINARY_EVENT;r||i.type===Me.BINARY_ACK?(i.type=r?Me.EVENT:Me.ACK,this.reconstructor=new tS(i),i.attachments===0&&super.emitReserved("decoded",i)):super.emitReserved("decoded",i)}else if(Sf(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(Me[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===Me.BINARY_EVENT||r.type===Me.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(Af.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 Me.CONNECT:return op(i);case Me.DISCONNECT:return i===void 0;case Me.CONNECT_ERROR:return typeof i=="string"||op(i);case Me.EVENT:case Me.BINARY_EVENT:return Array.isArray(i)&&(typeof i[0]=="number"||typeof i[0]=="string"&&W1.indexOf(i[0])===-1);case Me.ACK:case Me.BINARY_ACK:return Array.isArray(i)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class tS{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=I1(this.reconPack,this.buffers);return this.finishedReconstruction(),i}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const nS=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Af,Encoder:eS,get PacketType(){return Me},protocol:P1},Symbol.toStringTag,{value:"Module"}));function an(a,l,i){return a.on(l,i),function(){a.off(l,i)}}const aS=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class bg extends st{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=[an(l,"open",this.onopen.bind(this)),an(l,"packet",this.onpacket.bind(this)),an(l,"error",this.onerror.bind(this)),an(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(aS.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:Me.EVENT,data:i};if(h.options={},h.options.compress=this.flags.compress!==!1,typeof i[i.length-1]=="function"){const y=this.ids++,S=i.pop();this._registerAckCallback(y,S),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:Me.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 Me.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 Me.EVENT:case Me.BINARY_EVENT:this.onevent(l);break;case Me.ACK:case Me.BINARY_ACK:this.onack(l);break;case Me.DISCONNECT:this.ondisconnect();break;case Me.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:Me.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:Me.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 $l(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}$l.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};$l.prototype.reset=function(){this.attempts=0};$l.prototype.setMin=function(a){this.ms=a};$l.prototype.setMax=function(a){this.max=a};$l.prototype.setJitter=function(a){this.jitter=a};class ef extends st{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,Jr(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 $l({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||nS;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 G1(this.uri,this.opts);const i=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const f=an(i,"open",function(){r.onopen(),l&&l()}),d=p=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",p),l?l(p):this.maybeReconnectOnOpen()},h=an(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(an(l,"ping",this.onping.bind(this)),an(l,"data",this.ondata.bind(this)),an(l,"error",this.onerror.bind(this)),an(l,"close",this.onclose.bind(this)),an(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){Fr(()=>{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 bg(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 Ys={};function Br(a,l){typeof a=="object"&&(l=a,a=void 0),l=l||{};const i=X1(a,l.path||"/socket.io"),r=i.source,f=i.id,d=i.path,h=Ys[f]&&d in Ys[f].nsps,p=l.forceNew||l["force new connection"]||l.multiplex===!1||h;let x;return p?x=new ef(r,l):(Ys[f]||(Ys[f]=new ef(r,l)),x=Ys[f]),i.query&&!l.query&&(l.query=i.queryKey),x.socket(i.path,l)}Object.assign(Br,{Manager:ef,Socket:bg,io:Br,connect:Br});const Sg="roverSettings",lS=3600*24*365;function sS(a){try{const l=decodeURIComponent(a??"");return JSON.parse(l)}catch(l){return console.warn("Failed to parse settings cookie",l),null}}function tf(){if(typeof document>"u")return{};const a=`${Sg}=`,l=document.cookie.split(";").map(r=>r.trim()).find(r=>r.startsWith(a));if(!l)return{};const i=l.substring(a.length);return sS(i)??{}}function cp(a){if(typeof document>"u")return!1;try{const l=encodeURIComponent(JSON.stringify(a??{})),i=`${Sg}=${l}; path=/; max-age=${lS}; samesite=strict`;return document.cookie=i,!0}catch(l){return console.warn("Failed to write settings cookie",l),!1}}const Ag=window.location.origin;console.info("[socket] connecting to",Ag);const iS=tf(),rS=iS?.page?.connectionTransport||"websocket",oS=rS==="polling"?["polling"]:["websocket","polling"],jf=Br(Ag,{transports:oS,timeout:15e3});jf.on("connect_error",a=>console.error("connect_error",a.code,a.message,a.data));const jg=m.createContext(jf),cS=({children:a})=>o.jsx(jg.Provider,{value:jf,children:a}),xn=()=>m.useContext(jg),Ng=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 uS(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 fS({children:a}){const l=xn(),i=uS(l),[r,f]=m.useState(null),[d,h]=m.useState([]),[p,x]=m.useState([]),[v,y]=m.useState([]),[S,N]=m.useState(l.connected);m.useEffect(()=>{const C=()=>N(!0),j=()=>N(!1);return l.on("connect",C),l.on("disconnect",j),()=>{l.off("connect",C),l.off("disconnect",j)}},[l]),m.useEffect(()=>{function C(O){f(O)}function j(O=[]){h(O)}function M(O){h(B=>[...B.slice(-199),O])}function A(O=[]){x(O)}function k(O){x(B=>[...B.slice(-199),O])}return l.on("session:sync",C),l.on("log:init",j),l.on("log:entry",M),l.on("adminlog:init",A),l.on("adminlog:entry",k),l.on("alert:new",(O={})=>{y(B=>[...B.slice(-49),{...O,receivedAt:Date.now()}])}),()=>{l.off("session:sync",C),l.off("log:init",j),l.off("log:entry",M),l.off("adminlog:init",A),l.off("adminlog:entry",k),l.off("alert:new")}},[l]);const q=m.useMemo(()=>({login:(C,j)=>i("auth:login",{username:C,password:j}),setRole:C=>i("session:setRole",{role:C}),requestControl:(C,j={})=>i("session:requestControl",{roverId:C,...j}),releaseControl:C=>i("session:releaseControl",{roverId:C}),subscribeAll:()=>i("session:subscribeAll"),lockRover:(C,j)=>i("session:lockRover",{roverId:C,locked:j}),setMode:C=>i("setMode",{mode:C}),homeAssistantToggle:C=>i("homeAssistant:toggle",{entityId:C}),homeAssistantSetState:(C,j)=>i("homeAssistant:setState",{entityId:C,state:j}),homeAssistantSetLightColor:(C,j)=>i("homeAssistant:lightColor",{entityId:C,rgbColor:j}),setNickname:C=>i("nickname:set",{nickname:C}),triggerReplay:(C=[])=>i("replay:trigger",{sources:C}),setCommunityGoal:C=>i("communityGoal:set",{text:C}),setAdminReason:C=>i("adminReason:set",{text:C}),rebootRover:C=>i("command",{roverId:C,type:"reboot",data:{reboot:{}}}),rebootServer:()=>i("server:reboot"),pushAlert:C=>y(j=>[...j.slice(-49),{...C,receivedAt:Date.now(),id:C.id||Math.random().toString(36).slice(2)}])}),[i]),E=m.useMemo(()=>({connected:S,session:r,logs:d,adminLogs:p,alerts:v,...q}),[q,p,v,S,d,r]);return o.jsx(Ng.Provider,{value:E,children:a})}function ze(){return m.useContext(Ng)}const wg=m.createContext({frames:{}});function dS({children:a}){const l=xn(),[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(wg.Provider,{value:f,children:a})}function Nf(){return m.useContext(wg).frames}function Gl(a){const l=Nf();return a?l[a]??null:null}const mS=650,hS={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 qu(a){if(typeof a!="number"||a<=0)return null;const l=hS[a];return l?{code:a,...l}:null}function pS(a,l={}){const i=l.holdMs||mS,[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=qu(a?.infraredCharacterLeft),v=qu(a?.infraredCharacterRight),y=qu(a?.infraredCharacterOmni);!x&&!v&&!y||f(S=>({left:x?{...x,ts:p}:S.left,right:v?{...v,ts:p}:S.right,omni:y?{...y,ts:p}:S.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 S=new Date().toISOString();console.debug("[DockIR]",S,{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 M=p-j.ts,A=M<=i;return{active:A,age:M,code:j.code,red:!!(j.red&&A),green:!!(j.green&&A),force:!!(j.force&&A)}},v=x(r.left),y=x(r.right),S=x(r.omni),N=v.force||y.force||S.force,q=v.active||y.active||S.active,E=v.active&&!y.active?"right":y.active&&!v.active?"left":"center",C=(y.active?1:0)-(v.active?1:0);return{visible:q,forceDetected:N,left:v,right:y,omni:S,bias:E,balance:Math.max(-1,Math.min(1,C))}},[r.left,r.right,r.omni,i,d])}function gS(){const{connected:a,session:l}=ze(),i=l?.assignment?.roverId,r=Gl(i),f=r?.sensors||{},d=pS(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 S=r?.raw?r.raw:null,N=i?l?.activeDrivers?.[i]:null;return m.useMemo(()=>i?N?N===l?.socketId?"You":(l?.users||[]).find(E=>E.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(xS,{sensors:f,voltage:h,current:p,batteryTemp:x,charge:v,capacity:y}),o.jsx(vS,{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."}),S&&o.jsx("pre",{className:"surface whitespace-pre-wrap break-words text-xs text-lime-300",children:S})]})}function xS({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(Bn,{label:"Voltage",value:l??"--"}),o.jsx(Bn,{label:"Current",value:i??"--"}),o.jsx(Bn,{label:"Battery temp",value:r??"--"}),o.jsx(Bn,{label:"Charge",value:f!=null?`${f} mAh`:"--"}),o.jsx(Bn,{label:"Capacity",value:d!=null?`${d} mAh`:"--"}),o.jsx(Bn,{label:"Charge",value:h}),o.jsx(Bn,{label:"OI mode",value:p}),o.jsx(Bn,{label:"Docked",value:x}),o.jsx(Bn,{label:"Charging state",value:v})]})}function Bn({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 vS({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(Tl,{title:"Dock IR",children:[o.jsx(yS,{sensors:a}),o.jsx(bS,{state:l})]}),o.jsxs(Tl,{title:"Bumps & drops",children:[o.jsx(zn,{label:"Bump L",value:o.jsx($s,{active:i.bumpLeft})}),o.jsx(zn,{label:"Bump R",value:o.jsx($s,{active:i.bumpRight})}),o.jsx(zn,{label:"Wheel drop L",value:o.jsx($s,{active:i.wheelDropLeft,tone:"amber"})}),o.jsx(zn,{label:"Wheel drop R",value:o.jsx($s,{active:i.wheelDropRight,tone:"amber"})})]}),o.jsx(Tl,{title:"Light bumps (raw)",children:f.map(p=>o.jsx(zn,{label:p.label,value:Gs(p.value)},p.label))}),o.jsx(Tl,{title:"Cliff sensors",children:d.map(p=>o.jsx(zn,{label:p.label,value:`${Gs(p.value)} · ${p.active?"bool: true":"bool: false"}`},p.label))}),o.jsx(Tl,{title:"Currents",children:h.map(p=>o.jsx(zn,{label:p.label,value:o.jsxs("span",{className:"flex items-center gap-0.5",children:[o.jsx("span",{children:Gs(p.value,"mA")}),p.over?o.jsx($s,{active:!0,tone:"red",label:"over"}):null]})},p.label))}),o.jsxs(Tl,{title:"Dirt detect",children:[o.jsx(zn,{label:"Left",value:Gs(a?.dirtDetectLeft)}),o.jsx(zn,{label:"Right",value:Gs(a?.dirtDetect)})]})]})}function Tl({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 zn({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 $s({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 Gs(a,l){return a==null||Number.isNaN(a)?"--":l?`${a} ${l}`:a}function yS({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 bS({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 Cg=m.createContext(null);function wf({children:a}){const[l,i]=m.useState(()=>({status:"loading",data:{}}));m.useEffect(()=>{const p=tf();i({status:"ready",data:p??{}})},[]);const r=m.useCallback(()=>{const p=tf();i({status:"ready",data:p??{}})},[]),f=m.useCallback(p=>{const x=cp(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]||{},S=typeof x=="function"?x(y):{...y,...x??{}},N={...v.data,[p]:S};return cp(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(Cg.Provider,{value:h,children:a})}function SS(){const a=m.useContext(Cg);if(!a)throw new Error("useSettings must be used within SettingsProvider");return a}function xt(a,l={}){const{data:i,status:r,setNamespace:f}=SS(),d=i[a]??l??{},h=m.useCallback(v=>{f(a,y=>{const S=y??{};return typeof v=="function"?v(S):{...S,...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 AS(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 Cf({panelId:a="replay-sources",fillHeight:l=!1}){const{session:i,triggerReplay:r}=ze(),f=AS(i?.replaySources||[]),{value:d,save:h}=xt("replaySources",{}),[p,x]=m.useState([]),[v,y]=m.useState(!1),[S,N]=m.useState(null),[q,E]=m.useState(null),C=i?.replay||null,[j,M]=m.useState(0),A=m.useMemo(()=>{const $=i?.assignment?.roverId;return $?[`rover:${$}`]:[]},[i?.assignment?.roverId]);m.useEffect(()=>{const $=d?.[a];if(Array.isArray($)&&$.length){x($);return}x(A)},[d?.[a],A,a]),m.useEffect(()=>{const $=new Set(f.map(Q=>Q.key));x(Q=>Q.filter(L=>$.has(L)))},[f]);const k=m.useMemo(()=>({rovers:f.filter($=>$.type==="rover"),rooms:f.filter($=>$.type==="room")}),[f]);m.useEffect(()=>{if(!C?.lastTriggeredAt||!C?.cooldownMs){M(0);return}const $=()=>{const L=C.lastTriggeredAt+C.cooldownMs-Date.now();M(Math.max(0,L))};$();const Q=setInterval($,250);return()=>clearInterval(Q)},[C?.lastTriggeredAt,C?.cooldownMs,C?.remainingMs]);const O=v||i?.mode==="lockdown"||j>0||!p.length,B=$=>{x(Q=>{const L=Q.includes($)?Q.filter(K=>K!==$):[...Q,$];return h(K=>({...K||{},[a]:L})),L}),E(null)},Z=async()=>{if(!O){y(!0),N(null),E(null);try{const $=p.map(Q=>{const[L,K]=Q.split(":");return{type:L,id:K}});await r($),E("Replay sent. Check the Discord replay channel.")}catch($){N($.message)}finally{y(!1)}}},z=l?"h-full flex flex-col":"",X=l?"flex-1 min-h-0 overflow-y-auto":"";return o.jsxs("section",{className:`panel-section p-0.75 text-sm ${z}`,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 ${X}`,children:[o.jsx(up,{title:"Rovers",items:k.rovers,selected:p,onToggle:B}),o.jsx(up,{title:"Room Cams",items:k.rooms,selected:p,onToggle:B})]}),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"}),S?o.jsx("div",{className:"text-xs text-amber-400",children:S}):null,q?o.jsx("div",{className:"text-xs text-emerald-300",children:q}):null]})]})}function up({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 Eg={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},fp=$a.createContext&&$a.createContext(Eg),jS=["attr","size","title"];function NS(a,l){if(a==null)return{};var i=wS(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 wS(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 Vr(){return Vr=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},Vr.apply(this,arguments)}function dp(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 Yr(a){for(var l=1;l<arguments.length;l++){var i=arguments[l]!=null?arguments[l]:{};l%2?dp(Object(i),!0).forEach(function(r){CS(a,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(i)):dp(Object(i)).forEach(function(r){Object.defineProperty(a,r,Object.getOwnPropertyDescriptor(i,r))})}return a}function CS(a,l,i){return l=ES(l),l in a?Object.defineProperty(a,l,{value:i,enumerable:!0,configurable:!0,writable:!0}):a[l]=i,a}function ES(a){var l=qS(a,"string");return typeof l=="symbol"?l:l+""}function qS(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 qg(a){return a&&a.map((l,i)=>$a.createElement(l.tag,Yr({key:i},l.attr),qg(l.child)))}function oi(a){return l=>$a.createElement(MS,Vr({attr:Yr({},a.attr)},l),qg(a.child))}function MS(a){var l=i=>{var{attr:r,size:f,title:d}=a,h=NS(a,jS),p=f||i.size||"1em",x;return i.className&&(x=i.className),a.className&&(x=(x?x+" ":"")+a.className),$a.createElement("svg",Vr({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},i.attr,r,h,{className:x,style:Yr(Yr({color:a.color||i.color},i.style),a.style),height:p,width:p,xmlns:"http://www.w3.org/2000/svg"}),d&&$a.createElement("title",null,d),a.children)};return fp!==void 0?$a.createElement(fp.Consumer,null,i=>l(i)):l(Eg)}function Mg(a){return oi({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 RS(a){return oi({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 mp(a){return oi({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 TS(a){return oi({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 kS(a){return oi({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 _S(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 DS(a){const l=new Date(a);return`${l.getHours().toString().padStart(2,"0")}:${l.getMinutes().toString().padStart(2,"0")}`}function hp(a){return a.nickname||a.socketId?.slice(0,6)||"unknown"}function OS({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 Rg({message:a}){const l=a.fromDiscord?`${a.discordGuildName||"Discord"} · ${hp(a)}`:null;return o.jsxs(o.Fragment,{children:[a.fromDiscord?o.jsxs(o.Fragment,{children:[o.jsx(Mg,{className:"h-3.5 w-3.5 text-indigo-200"}),o.jsx(OS,{guildIconUrl:a.discordGuildIconUrl,userAvatarUrl:a.discordUserAvatarUrl,label:l})]}):null,o.jsx("span",{className:`font-semibold text-[0.85rem] ${_S(a.role)}`,children:hp(a)}),a.roverId&&o.jsx("span",{className:"rounded bg-slate-800 px-1 text-[0.7rem]",children:a.roverId})]})}function Tg(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 kg({message:a}){return o.jsxs("div",{className:Tg(a),children:[o.jsx(Rg,{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:DS(a.ts)})]})}function _g({message:a}){return o.jsxs("div",{className:`${Tg(a)} italic opacity-80 border-slate-600/40 bg-slate-900/40`,children:[o.jsx(Rg,{message:a}),o.jsx("span",{className:"text-slate-300",children:"typing..."})]})}const BS=3e3,zS="#2196f3";function LS(a){return a.id?a.id:a.timestamp?`${a.timestamp}-${a.message}`:`${a.title||"alert"}-${a.message}`}function Ef({scale:a=1}){const{alerts:l}=ze(),[i,r]=m.useState(()=>Date.now()),f=m.useMemo(()=>l.slice(-3).map(x=>({alert:x,key:LS(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<=BS);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(US,{alert:x.alert},x.key))})}function pp(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 US({alert:a}){if(a.kind==="chat"&&a.payload)return o.jsx(kg,{message:a.payload});if(a.kind==="chat-typing"&&a.payload)return o.jsx(_g,{message:a.payload});const l=pp(a.color)||pp(zS),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 kl={main:[-127,127],side:[-127,127],vacuum:[0,127]},Mu={maxSpeed:500,baseSpeed:250,boostSpeed:400},nf=100,qf=[31,127],Ll=60,af=8,HS=250,VS=4e3,Ru=.4,YS=.8,$S={start:[128],safe:[131],full:[132],passive:[128],dock:[143]},Fs={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"]},Dg=[{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:nf},{type:"oi",command:"dock"},{type:"pause",duration:nf},{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 lf(){return{vector:{x:0,y:0,boost:!1},speeds:{left:0,right:0},source:null,lastUpdatedAt:0}}function sf(){return{main:0,side:0,vacuum:0}}function GS(){return{enabled:!1,angle:null,config:null}}function zr(){return{note:Ll}}function Zs(){return{active:!1,heat:0,overheated:!1}}const gp={roverId:null,mode:"drive",drive:lf(),aux:sf(),camera:GS(),song:zr(),horn:Zs(),lastControlIntentAt:0,macros:Dg,keymap:Fs,inputs:{}};function XS(a,l){switch(l.type){case"control/set-rover":return{...a,roverId:l.payload??null,drive:l.payload?a.drive:lf(),aux:l.payload?a.aux:sf(),song:l.payload?a.song:zr(),horn:l.payload?a.horn:Zs(),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:lf(),aux:sf(),song:zr(),horn:Zs(),lastControlIntentAt:0};case"control/set-horn-active":return{...a,horn:{...a.horn||Zs(),active:!!l.payload}};case"control/set-horn-heat":return{...a,horn:{...a.horn||Zs(),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||zr(),note:l.payload??Ll}};default:return a}}function Ul(a,l,i){return typeof a!="number"||Number.isNaN(a)?l:Math.max(l,Math.min(i,a))}function Hl(a){return typeof a!="number"||Number.isNaN(a)?0:Math.max(-1,Math.min(1,a))}function Ft(a,l){return!Array.isArray(l)||l.length!==2?a:Ul(a,l[0],l[1])}function QS(a={}){const l=Hl(a.x??0),i=Hl(a.y??0);return{x:l,y:i,boost:!!a.boost}}function KS(a={},l={}){const i=QS(a),r=typeof l.maxSpeed=="number"?l.maxSpeed:Mu.maxSpeed,f=typeof l.baseSpeed=="number"?l.baseSpeed:Mu.baseSpeed,d=typeof l.boostSpeed=="number"?l.boostSpeed:Mu.boostSpeed,h=i.boost?d:f,p=i.y*h,x=i.x*h;return{vector:i,speeds:{left:Ul(Math.round(p+x),-r,r),right:Ul(Math.round(p-x),-r,r)}}}function ZS(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 xp(a){return new Promise(l=>setTimeout(l,a))}function FS(a={}){const{driveTransform:l,auxTransform:i}=a,r=xn(),{session:f}=ze(),d=f?.assignment?.roverId,h=m.useMemo(()=>!d||!Array.isArray(f?.roster)?null:f.roster.find(B=>String(B.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]),S=m.useCallback((B,Z)=>{d&&r.emit("command",{roverId:d,...B},Z)},[r,d]),N=m.useCallback(()=>{d&&S({type:"sensorStream",data:{sensorStream:{enable:!0}}})},[S,d]),q=m.useCallback(B=>{if(!d)return null;const Z={left:Ft(B?.left??0,[-500,500]),right:Ft(B?.right??0,[-500,500])},z=l?l(Z):Z,X={left:Ft(z?.left??0,[-500,500]),right:Ft(z?.right??0,[-500,500])};return S({type:"drive",data:{driveDirect:X}}),X},[l,S,d]),E=m.useCallback(({main:B=0,side:Z=0,vacuum:z=0}={})=>{if(!d)return null;const X={main:Ft(B,kl.main),side:Ft(Z,kl.side),vacuum:Ft(z,kl.vacuum)},$=i?i(X):X,Q={main:Ft($?.main??0,kl.main),side:Ft($?.side??0,kl.side),vacuum:Ft($?.vacuum??0,kl.vacuum)};return S({type:"motors",data:{motorPwm:Q}}),Q},[i,S,d]),C=m.useCallback(B=>!d||!p?null:(S({type:"servo",data:{servo:{angle:B}}}),B),[S,d,p]),j=m.useCallback(B=>{if(!d)return!1;const Z=Array.isArray(B)?B:typeof B=="string"?$S[B]:null;return Z?(S({type:"raw",data:{raw:ZS(Z)}}),N(),!0):!1},[S,N,d]),M=m.useCallback(async B=>{if(!(!B||!Array.isArray(B.steps)||!d))for(const Z of B.steps){if(!d)break;switch(Z.type){case"oi":j(Z.command);break;case"drive":q(Z.speeds??{left:0,right:0});break;case"motors":E(Z.values??{});break;case"servo":C(Z.angle);break;case"pause":await xp(Z.duration??nf);break}if(Z.delay||Z.delayMs){const z=Z.delayMs??Z.delay;typeof z=="number"&&z>0&&await xp(z)}}},[d,j,q,E,C]),A=m.useCallback((B="toggle")=>!d||!x?null:(S({type:"nightVision",data:{nightVision:{action:B}}}),B),[S,x,d]),k=m.useCallback(B=>d?(S({type:"horn",data:{horn:B}}),B):null,[S,d]),O=m.useCallback((B=[],Z={})=>{if(!d)return null;const X=(Array.isArray(B)&&B.length>0?B:[{note:Ll,duration:af}]).slice(0,16).map($=>({note:Ft(Math.round($?.note??Ll),qf),duration:Ft(Math.round($?.duration??af),[1,255])}));return S({type:"song",data:{song:{notes:X,slot:Z.slot,loop:Z.loop}}}),X},[S,d]);return m.useMemo(()=>({roverId:d,rosterEntry:h,servoConfig:p,nightVision:x,nightVisionState:y,horn:v,emitCommand:S,enableSensorStream:N,sendDriveDirect:q,sendAuxMotors:E,sendServoAngle:C,sendOiCommand:j,sendNightVision:A,sendHorn:k,sendSong:O,runMacroSteps:M}),[d,h,p,x,y,v,S,N,q,E,C,j,A,k,M])}const JS={"{":"[","}":"]",":":";",'"':"'","<":",",">":".","?":"/","|":"\\",_:"-","+":"="},vp={"[":"BracketLeft","]":"BracketRight","\\":"Backslash",";":"Semicolon","'":"Quote",",":"Comma",".":"Period","/":"Slash","-":"Minus","=":"Equal","`":"Backquote"};function ci(a){if(typeof a!="string")return"";const l=a.toLowerCase();return JS[l]??l}function IS(a){const l=ci(a);if(!l)return null;if(vp[l])return vp[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 Og(a){const l=ci(a);return l?`key:${l}`:null}function WS(a){const l=IS(a);return l?`code:${l}`:null}function yp(a){const l=new Set,i=Og(a?.key??"");i&&l.add(i);const r=a?.code?`code:${a.code}`:null;return r&&l.add(r),Array.from(l)}function PS(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=Og(String(d));h&&f.add(h);const p=WS(String(d));p&&f.add(p)}),[l,f]}))}function mn(a){const l=ci(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 dn={keyboard:{baseSpeed:250,turboSpeed:400,precisionSpeed:125,tiltSpeed:80,tiltIntervalMs:110}},Un={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}]}}},ga={activeSignature:null,profiles:{},defaults:{profile:Un}},Ya={waveform:"saw",freqs:[440,550,660,0]},Bl=[{key:"drive",motors:["leftWheel","rightWheel"]},{key:"aux",motors:["mainBrush","sideBrush"]}],eA={downRatePerSec:.15,upRatePerSec:.7,releaseDelaySec:1,outputRateMs:250};function bp(){return Bl.reduce((a,l)=>(a[l.key]={cap:1,clearSec:0},a),{})}function Sp(a){return Number.isFinite(a)?Math.max(0,Math.min(1,a)):0}function tA(a,l={}){const{session:i}=ze(),d=(Gl(a)?.sensors||{})?.wheelOvercurrents||{},h=m.useMemo(()=>({...eA,...l.config||{}}),[l.config]),[p,x]=m.useState(()=>bp()),v=m.useRef(typeof performance<"u"?performance.now():Date.now()),y=m.useRef(d);m.useEffect(()=>{y.current=d||{}},[d]),m.useEffect(()=>{x(bp())},[a]),m.useEffect(()=>{const E=setInterval(()=>{const C=typeof performance<"u"?performance.now():Date.now(),j=Math.max(0,C-v.current);v.current=C;const M=j/1e3;M<=0||x(A=>{let k=!1;const O={},B=Number.isFinite(h.downRatePerSec)?Math.max(0,h.downRatePerSec):0,Z=Number.isFinite(h.upRatePerSec)?Math.max(0,h.upRatePerSec):0,z=Number.isFinite(h.releaseDelaySec)?Math.max(0,h.releaseDelaySec):0;return Bl.forEach(X=>{const $=A[X.key]||{cap:1,clearSec:0},Q=Number.isFinite($.cap)?$.cap:1,L=Number.isFinite($.clearSec)?$.clearSec:0,K=X.motors.some(T=>!!y.current?.[T]),se=K?0:L+M,ce=!K&&se>=z,W=Sp(K?Q-B*M:ce?Q+Z*M:Q);(Math.abs(W-Q)>1e-4||Math.abs(se-L)>1e-4)&&(k=!0),O[X.key]={cap:W,clearSec:se}}),k?O:A})},100);return()=>clearInterval(E)},[h.downRatePerSec,h.releaseDelaySec,h.upRatePerSec]);const S=m.useMemo(()=>{const E=Bl.reduce((C,j)=>{const M=p?.[j.key],A=Number.isFinite(M?.cap)?M.cap:1;return C[j.key]=Sp(A),C},{});return{perGroup:E,drive:{left:E.drive??1,right:E.drive??1},aux:{main:E.aux??1,side:E.aux??1,vacuum:1}}},[p]),N=m.useMemo(()=>{const E={};Bl.forEach(j=>{j.motors.forEach(M=>{E[M]=!!d?.[M]})});const C=Bl.reduce((j,M)=>(j[M.key]=M.motors.some(A=>!!d?.[A]),j),{});return{motors:E,groups:C}},[d]),q=i?.role==="admin"||i?.role==="lockdown"||i?.role==="lockdown-admin";return m.useMemo(()=>({caps:p,overcurrent:N,scales:S,isActive:(S?.drive?.left??1)<1||(S?.drive?.right??1)<1||(S?.aux?.main??1)<1||(S?.aux?.side??1)<1,config:h,adminImmune:q}),[p,N,S,h,q])}function nA(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 aA(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 Bg=m.createContext(null);function Ap(a){return Object.fromEntries(Object.entries(a||{}).map(([l,i])=>[l,Array.isArray(i)?[...i]:[]]))}function lA(a,l){if(!a)return l;const i=typeof a.minAngle=="number"?a.minAngle:-45,r=typeof a.maxAngle=="number"?a.maxAngle:45;return Ul(l,i,r)}function sA({children:a}){const[l,i]=m.useReducer(XS,gp),r=m.useRef(null),f=m.useRef(!1),d=m.useRef(gp.camera.angle),h=m.useRef(null),p=m.useRef(0),x=m.useRef(0),{value:v,save:y}=xt("controls",{keymap:Fs,macros:Dg}),{value:S}=xt("horn",Ya),{session:N,homeAssistantSetState:q}=ze(),E=N?.assignment?.roverId??null,C=tA(E),j=m.useCallback(te=>nA(te,C.scales,C.adminImmune),[C.adminImmune,C.scales]),M=m.useCallback(te=>aA(te,C.scales,C.adminImmune),[C.adminImmune,C.scales]),A=FS({driveTransform:j,auxTransform:M}),k=m.useCallback(()=>{const re=(N?.homeAssistant?.entities||[]).filter(Se=>(Se.type==="light"||Se.type==="switch")&&Se.available!==!1&&Se.state!=="on");if(re.length===0){f.current=!1;return}f.current=!0,re.forEach(Se=>{q(Se.id,"on").catch(()=>{})}),f.current=!1},[N?.homeAssistant?.entities,q]);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?k():te!=="drive"&&l.mode==="drive"&&(f.current=!0)},[l.mode,N?.homeAssistant?.entities,k]),m.useEffect(()=>{f.current&&N?.homeAssistant?.entities&&k()},[N?.homeAssistant?.entities,k]),m.useEffect(()=>{const te={...Fs,...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 re=typeof te.minAngle=="number"?te.minAngle:-45,Se=typeof te.maxAngle=="number"?te.maxAngle:45,_e=typeof te.homeAngle=="number"?te.homeAngle:(re+Se)/2,we=typeof d.current=="number"?Ul(d.current,re,Se):null,Ye=we??Ul(_e,re,Se);i({type:"control/set-camera-config",payload:{config:te,angle:Ye}}),d.current=Ye},[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})},[]),B=m.useCallback(()=>{i({type:"control/record-intent"})},[]),Z=m.useRef(l.drive.speeds),z=m.useRef(l.aux),X=m.useMemo(()=>JSON.stringify(C.scales),[C.scales]),$=m.useRef(0),Q=m.useRef(0);m.useEffect(()=>{Z.current=l.drive.speeds},[l.drive.speeds]),m.useEffect(()=>{z.current=l.aux},[l.aux]),m.useEffect(()=>{if(!A.roverId||C.adminImmune||!C.isActive)return;const te=Math.max(0,Number(C?.config?.outputRateMs)||0),re=typeof performance<"u"?performance.now():Date.now(),Se=Z.current||{left:0,right:0},_e=z.current||{main:0,side:0,vacuum:0},we=!!(Se.left||Se.right),Ye=!!(_e.main||_e.side||_e.vacuum);!we&&!Ye||(we&&re-$.current>=te&&($.current=re,A.sendDriveDirect(Se)),Ye&&re-Q.current>=te&&(Q.current=re,A.sendAuxMotors(_e)))},[X,C.adminImmune,C.config,C.isActive,A]);const L=m.useCallback((te,re={})=>{const Se=KS(te,re.speedOptions);i({type:"control/update-drive",payload:{...Se,source:re.source??null}}),B(),A.sendDriveDirect(Se.speeds)},[A,B]),K=m.useCallback((te={})=>{const re=A.sendAuxMotors(te)??te;i({type:"control/set-aux-motors",payload:re}),B()},[A,B]),se=m.useCallback((te,re)=>{if(!te)return!1;const Se=ci(re);if(!Se)return!1;const _e=Ap(l.keymap);return _e[te]=[Se],i({type:"control/set-keymap",payload:_e}),y(we=>({...we??{},keymap:_e})),!0},[l.keymap,y]),ce=m.useCallback(()=>{const te=Ap(Fs);i({type:"control/set-keymap",payload:te}),y(re=>({...re??{},keymap:te}))},[y]),W=m.useCallback(te=>{if(!A.servoConfig)return;const re=lA(A.servoConfig,te);i({type:"control/set-camera-angle",payload:re}),A.sendServoAngle(re),d.current=re,B()},[A,B]),T=m.useCallback((te=0)=>{const re=A.servoConfig;if(!re)return;const Se=typeof te=="number"&&te!==0?te:re.nudgeDegrees||1,_e=typeof d.current=="number"?d.current:typeof re.homeAngle=="number"?re.homeAngle:0;W(_e+Se)},[A.servoConfig,W]),F=m.useCallback(()=>{const te=A.servoConfig;if(!te)return;const re=typeof te.homeAngle=="number"?te.homeAngle:typeof te.minAngle=="number"&&typeof te.maxAngle=="number"?(te.minAngle+te.maxAngle)/2:0;W(re)},[A.servoConfig,W]),ne=m.useCallback(async te=>{const re=l.macros.find(Se=>Se.id===te)||null;re&&(te==="drive-sequence"?(k(),N?.homeAssistant?.entities||(f.current=!0),B()):te==="seek-dock"&&B(),await A.runMacroSteps(re))},[A,B,N?.homeAssistant?.entities,l.macros,k]),de=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]),fe=m.useCallback(te=>{A.sendOiCommand(te)},[A]),w=m.useCallback(te=>{A.roverId&&A.emitCommand({type:"sensorStream",data:{sensorStream:{enable:te}}})},[A]),U=m.useCallback(te=>{if(A.nightVision){if(typeof te=="boolean"){const re=te?"off":"on";A.sendNightVision(re)}else A.sendNightVision("toggle");B()}},[A,B]),ee=m.useCallback(()=>{U()},[U]),ae=m.useCallback(te=>{const re=typeof te=="number"?te:Ll;return i({type:"control/set-song-note",payload:re}),re},[]),le=m.useCallback((te,re)=>A.sendSong(te,re),[A]),ie=m.useMemo(()=>{const te=S??Ya,re=te.waveform==="sine"?"sine":"saw",_e=[...Array.isArray(te.freqs)?te.freqs:Ya.freqs,0,0,0,0].slice(0,4).map(we=>{const Ye=Number(we);return Number.isFinite(Ye)?Ye<=0?0:Math.min(5e3,Math.round(Ye)):0});return{waveform:re,freqs:_e}},[S]),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",...ie}),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(()=>{xe()},VS),B(),!0},[i,ie,A,B,l.horn?.active,l.horn?.heat,l.horn?.overheated]),xe=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(),re=p.current||te,Se=Math.max(0,te-re);if(p.current=0,Se>0){const _e=l.horn?.heat??0,we=Se/1e3*Ru;let Ye=Math.max(0,Math.min(1,_e+we)),It=l.horn?.overheated??!1;Ye>=1&&(Ye=1,It=!0),i({type:"control/set-horn-heat",payload:{heat:Ye,overheated:It}})}},[i,A,l.horn?.heat,l.horn?.overheated,Ru]);m.useEffect(()=>{const re=setInterval(()=>{const Se=Date.now(),_e=x.current||Se;x.current=Se;const we=Math.min(1e3,Math.max(0,Se-_e))/1e3,Ye=l.horn?.heat??0,It=!!l.horn?.active,St=!!l.horn?.overheated,$n=we*(It?Ru:-.2);let Tt=Math.max(0,Math.min(1,Ye+$n)),Wt=St;Tt>=1?(Tt=1,Wt=!0,It&&xe()):Wt&&Tt<=YS&&(Wt=!1),(Tt!==Ye||Wt!==St)&&i({type:"control/set-horn-heat",payload:{heat:Tt,overheated:Wt}})},100);return()=>clearInterval(re)},[i,l.horn?.active,l.horn?.heat,l.horn?.overheated,xe]);const pe=m.useCallback((te,re)=>{i({type:"control/register-input-state",payload:{source:te,state:re}})},[]),Re=m.useMemo(()=>({state:l,dispatch:i,pipeline:A,overcurrentLimiter:C,actions:{setMode:O,setDriveVector:L,setAuxMotors:K,setServoAngle:W,nudgeServo:T,goServoHome:F,runMacro:ne,stopAllMotion:de,sendOiCommand:fe,setSensorStream:w,setNightVision:U,toggleNightVision:ee,updateKeyBinding:se,resetKeyBindings:ce,registerInputState:pe,setSongNote:ae,sendSong:le,startHorn:oe,stopHorn:xe}}),[l,A,C,O,L,K,W,T,F,ne,de,fe,w,U,ee,se,ce,pe,ae,le,oe,xe]);return o.jsx(Bg.Provider,{value:Re,children:a})}function Rt(){const a=m.useContext(Bg);if(!a)throw new Error("useControlSystem must be used within ControlSystemProvider");return a}const iA="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=",zg=m.createContext({messages:[],typing:[],sendMessage:async()=>{},focusChat:()=>{},blurChat:()=>{},registerInputRef:()=>{},onInputFocus:()=>{},onInputBlur:()=>{},setTypingActive:()=>{},isChatFocused:!1});function rA({children:a}){const l=xn(),{session:i,pushAlert:r}=ze(),[f,d]=m.useState([]),[h,p]=m.useState([]),[x,v]=m.useState(!1),y=m.useRef(null),S=m.useRef(null),N=m.useRef(null),q=m.useRef(new Map),E=m.useRef(new Map),C=m.useRef({isTyping:!1,lastSent:0}),j=m.useCallback(()=>{const L=Array.from(q.current.values()).sort((K,se)=>K.lastUpdate-se.lastUpdate).map(K=>K.payload);p(L)},[]),M=m.useCallback(L=>!L||typeof L!="object"?null:L.typingId?L.typingId:L.fromDiscord?`discord:${L.discordUserId||L.discordUserName||L.nickname||"unknown"}`:`socket:${L.socketId||L.nickname||"unknown"}`,[]);m.useEffect(()=>{N.current=new Audio(iA),N.current.load()},[]);const A=m.useCallback(()=>{const L=N.current;L&&(L.currentTime=0,L.play().catch(()=>{}))},[]);m.useEffect(()=>{function L(K={}){d(se=>[...se.slice(-99),K]),!(K?.socketId&&i?.socketId&&K.socketId===i.socketId)&&(A(),r?.({kind:"chat",payload:K,id:`chat-${K.id||Math.random().toString(36).slice(2)}`,receivedAt:Date.now()}))}return l.on("chat:message",L),()=>{l.off("chat:message",L)}},[A,i?.socketId,l]),m.useEffect(()=>{function L(K={}){const se=M(K);if(!se)return;const ce=Date.now();if(K?.socketId&&i?.socketId&&K.socketId===i.socketId){K.isTyping||(q.current.delete(se),j());return}if(K.isTyping){q.current.set(se,{payload:K,expiresAt:ce+6e3,lastUpdate:ce});const W=E.current.get(se)||0;ce-W>=2500&&(E.current.set(se,ce),r?.({kind:"chat-typing",payload:K,id:`chat-typing-${se}-${K.id||Math.random().toString(36).slice(2)}`,receivedAt:ce}))}else q.current.delete(se);j()}return l.on("chat:typing",L),()=>{l.off("chat:typing",L)}},[r,j,M,i?.socketId,l]),m.useEffect(()=>{const L=setInterval(()=>{const K=Date.now();let se=!1;q.current.forEach((ce,W)=>{ce.expiresAt<=K&&(q.current.delete(W),se=!0)}),se&&j()},2e3);return()=>clearInterval(L)},[j]),m.useEffect(()=>{function L(K=[]){Array.isArray(K)&&d(se=>{if(se.length===0)return K.slice(-100);const ce=new Set(K.map(T=>T?.id));return[...K,...se.filter(T=>T?.id&&!ce.has(T.id))].slice(-100)})}return l.on("chat:init",L),()=>{l.off("chat:init",L)}},[l]);const k=m.useCallback(L=>{const K=!!L,se=Date.now(),ce=C.current,W=!K&&ce.isTyping;!(K&&(!ce.isTyping||se-ce.lastSent>=3500))&&!W||(C.current={isTyping:K,lastSent:se},l.emit("chat:typing",{isTyping:K}))},[l]),O=m.useCallback((L,K=null)=>new Promise((se,ce)=>{l.emit("chat:send",{text:L,tts:K},(W={})=>{W.error?ce(new Error(W.error)):se(W)})}),[l]),B=m.useCallback((L,K={})=>{(K?.target==="hud"?"hud":"panel")==="hud"?S.current=L:y.current=L},[]),Z=m.useCallback(()=>{v(!0),(S.current||y.current)?.focus()},[]),z=m.useCallback(()=>{v(!1),S.current?.blur(),y.current?.blur()},[]),X=m.useCallback(()=>v(!0),[]),$=m.useCallback(()=>v(!1),[]),Q=m.useMemo(()=>({messages:f,sendMessage:O,focusChat:Z,blurChat:z,registerInputRef:B,onInputFocus:X,onInputBlur:$,setTypingActive:k,typing:h,isChatFocused:x,selfSocketId:i?.socketId||null}),[z,Z,x,f,$,X,B,O,i?.socketId,k,h]);return o.jsx(zg.Provider,{value:Q,children:a})}function Mf(){const a=m.useContext(zg);if(!a)throw new Error("useChat must be used inside ChatProvider");return a}const oA=new Set(["","text","search","email","password","url","tel","number","date","datetime-local","month","time","week"]);function Lg(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 oA.has(i)}function cA(){return typeof document>"u"?!1:Lg(document.activeElement)}const Tu="keyboard",ku={x:0,y:0,boost:!1},_u={main:0,side:0,vacuum:0},jp=qf[0],Np=qf[1],Rf=5,Ws=500,Ps=1,Tf=100;function Du(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(0,Math.min(500,i)):l}function uA(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(Rf,Math.min(Ws,i)):l}function Ug(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(Ps,Math.min(Tf,i)):l}function fA(a){const i=(Ug(a,a)-Ps)/(Tf-Ps),r=Ws-i*(Ws-Rf);return Math.round(r)}function dA(a){const l=uA(a,a),i=(Ws-l)/(Ws-Rf),r=Ps+i*(Tf-Ps);return Math.round(r)}function mA(a){return Lg(a?.target)}function et(a,l){if(!a||a.size===0)return!1;for(const i of l)if(a.has(i))return!0;return!1}function hA(a,l){const i=et(l.driveForward,a),r=et(l.driveBackward,a),f=et(l.driveLeft,a),d=et(l.driveRight,a),h=et(l.boostModifier,a),p=et(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 pA(a,l){if(et(l.auxAllForward,a))return{main:127,side:127,vacuum:127};const r=et(l.auxMainForward,a)?127:et(l.auxMainReverse,a)?-127:0,f=et(l.auxSideForward,a)?127:et(l.auxSideReverse,a)?-70:0,d=et(l.auxVacuumFast,a)?127:et(l.auxVacuumSlow,a)?50:0;return{main:r,side:f,vacuum:d}}function gA(){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:S,sendSong:N}}=Rt(),{session:q,homeAssistantSetState:E}=ze(),{focusChat:C,blurChat:j,isChatFocused:M}=Mf(),{value:A}=xt("inputs",dn),k=m.useMemo(()=>PS(a.keymap),[a.keymap]),O=m.useMemo(()=>{const le=new Set;return Object.values(k).forEach(ie=>{ie&&ie.forEach(oe=>le.add(oe))}),le},[k]),B=m.useMemo(()=>{const le=dn.keyboard,ie=A?.keyboard??{};return{baseSpeed:Du(ie.baseSpeed,le.baseSpeed),turboSpeed:Du(ie.turboSpeed,le.turboSpeed),precisionSpeed:Du(ie.precisionSpeed,le.precisionSpeed)}},[A?.keyboard]),Z=m.useMemo(()=>{const le=dn.keyboard,ie=A?.keyboard??{},oe=Ug(typeof ie.tiltSpeed=="number"?ie.tiltSpeed:typeof ie.tiltIntervalMs=="number"?dA(ie.tiltIntervalMs):le.tiltSpeed,le.tiltSpeed);return fA(oe)},[A?.keyboard]),z=m.useMemo(()=>Math.abs(a.camera?.config?.nudgeDegrees||1),[a.camera?.config?.nudgeDegrees]),X=m.useRef(new Set),$=m.useRef(ku),Q=m.useRef(_u),L=m.useRef(null),K=m.useRef(null),se=m.useRef(!1),ce=m.useCallback(()=>{const le=new Set(X.current);et(k.boostModifier,le);const oe=et(k.slowModifier,le)?{baseSpeed:B.precisionSpeed,boostSpeed:B.precisionSpeed}:{baseSpeed:B.baseSpeed,boostSpeed:B.turboSpeed},xe=hA(le,k),pe=pA(le,k);(xe.x!==$.current.x||xe.y!==$.current.y||xe.boost!==$.current.boost)&&($.current=xe,i(xe,{source:Tu,speedOptions:oe})),(pe.main!==Q.current.main||pe.side!==Q.current.side||pe.vacuum!==Q.current.vacuum)&&(Q.current=pe,r(pe)),p(Tu,{keys:Array.from(le),vector:xe,aux:pe})},[k,B,p,r,i]),W=m.useCallback(()=>{L.current&&(clearTimeout(L.current),L.current=null)},[]),T=m.useCallback(()=>{const le=new Set(X.current),ie=et(k.cameraUp,le),oe=et(k.cameraDown,le);return(ie?1:0)-(oe?1:0)},[k]),F=m.useCallback(()=>{if(T()===0){W();return}if(L.current)return;const ie=()=>{const oe=T();if(oe===0){W();return}f(oe*z),L.current=setTimeout(ie,Z)};L.current=setTimeout(ie,0)},[T,f,Z,z,W]),ne=m.useCallback(()=>{K.current&&(clearTimeout(K.current),K.current=null)},[]),de=m.useCallback(()=>{const le=new Set(X.current),ie=et(k.songNoteUp,le),oe=et(k.songNoteDown,le);return(ie?1:0)-(oe?1:0)},[k]),fe=m.useCallback(le=>{if(le===0)return;let oe=(typeof a.song?.note=="number"?a.song.note:Ll)+le;oe>Np?oe=jp:oe<jp&&(oe=Np);const xe=S(oe);N([{note:xe,duration:af}],{slot:0})},[N,S,a.song?.note]),w=m.useCallback(()=>{if(de()===0){ne();return}if(K.current)return;const ie=()=>{const oe=de();if(oe===0){ne();return}fe(oe),K.current=setTimeout(ie,HS)};K.current=setTimeout(ie,0)},[de,ne,fe]),U=m.useCallback(()=>{X.current.clear(),$.current=ku,Q.current=_u,W(),ne(),se.current&&(se.current=!1,y()),h(),p(Tu,{keys:[],vector:ku,aux:_u})},[p,h,y,W,ne]),ee=m.useCallback(le=>{const ie=q?.homeAssistant;if(!ie?.enabled||!ie?.connected)return;const xe=(ie.entities||[]).filter(pe=>(pe.type==="light"||pe.type==="switch")&&pe.available!==!1&&pe.state!=="unavailable");if(xe.length!==0){if(le==="on"){const pe=xe.find(Re=>Re.state!=="on");pe&&E(pe.id,"on").catch(()=>{});return}if(le==="off")for(let pe=xe.length-1;pe>=0;pe-=1){const Re=xe[pe];if(Re.state==="on"){E(Re.id,"off").catch(()=>{});break}}}},[E,q?.homeAssistant]);m.useEffect(()=>{function le(xe){if(mA(xe))return;const pe=yp(xe);if(pe.length===0)return;const Re=new Set(pe);if(et(k.chatFocus,Re)){xe.preventDefault(),U(),M||C();return}pe.some(re=>O.has(re))&&xe.preventDefault();const te=pe.filter(re=>!X.current.has(re));if(te.forEach(re=>X.current.add(re)),te.length>0)if(te.some(re=>k.driveMacro?.has(re)))l("drive"),d("drive-sequence");else if(te.some(re=>k.dockMacro?.has(re)))l("dock"),d("seek-dock");else if(te.some(re=>k.nightVisionToggle?.has(re)))x();else if(te.some(re=>k.hornHonk?.has(re))){if(!se.current){const re=v();se.current=!!re}}else te.some(re=>k.homeAssistantOn?.has(re))?ee("on"):te.some(re=>k.homeAssistantOff?.has(re))&&ee("off");F(),w(),ce()}function ie(xe){yp(xe).forEach(Re=>X.current.delete(Re)),se.current&&!et(k.hornHonk,X.current)&&(se.current=!1,y()),F(),w(),ce()}function oe(){U()}return window.addEventListener("keydown",le,{capture:!0}),window.addEventListener("keyup",ie,{capture:!0}),window.addEventListener("blur",oe),()=>{window.removeEventListener("keydown",le,{capture:!0}),window.removeEventListener("keyup",ie,{capture:!0}),window.removeEventListener("blur",oe)}},[O,j,ce,F,w,C,M,k.chatFocus,k.dockMacro,k.driveMacro,k.hornHonk,U,d,l,h,ne,v,y,ee]);const ae=m.useRef(U);return m.useEffect(()=>{ae.current=U},[U]),m.useEffect(()=>{ae.current()},[a.roverId]),m.useEffect(()=>{se.current=!!a.horn?.active},[a.horn?.active]),m.useEffect(()=>()=>{W(),ne()},[W,ne]),null}const xA=1.6;function Hg(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 vA(a){return JSON.parse(JSON.stringify(a??{}))}function Vg(a,l){const i=vA(l);return i.meta={id:a?.id??"Unknown",mapping:a?.mapping??"none",axes:a?.axes?.length??0,buttons:a?.buttons?.length??0},i}function Va(a){return Number.isFinite(a)?Math.max(-1,Math.min(1,a)):0}function Xs(a,l){if(!a)return 0;const i=Math.abs(a);return l==="expo"?Math.sign(a)*Math.pow(i,xA):a}function Ou(a,l){const i=Math.abs(a);if(i<=l)return 0;const r=(i-l)/(1-l);return Math.sign(a)*r}function yA(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 $r(a,l){if(!a||!Array.isArray(a.axes))return null;const i=a.axes[l];return Number.isFinite(i)?Va(i):null}function rf(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 Bu(a,l=[]){for(const i of l)if(i){if(i.kind==="axis"){const r=$r(a,i.index);if(r===null)continue;return{value:i.invert?-r:r,source:i}}if(i.kind==="buttonAxis"){const r=rf(a,i.index);if(!r)continue;return{value:Va(r.value),source:i}}}return{value:0,source:null}}function bA(a,l=[]){for(const i of l){if(!i||i.kind!=="axisPair")continue;const r=$r(a,i.x),f=$r(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 La(a,l=[]){for(const i of l)if(i){if(i.kind==="button"){const r=rf(a,i.index);if(!r)continue;return{pressed:r.pressed,source:i}}if(i.kind==="axisButton"){const r=$r(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=rf(a,i.index);if(!r)continue;return{pressed:r.value>.5,source:i}}}return{pressed:!1,source:null}}function Yg(a,l){const i=l?.bindings??{},r=l?.calibration??{},f=i.drive??{},d=bA(a,f.sources);let h=Va(d.x),p=Va(d.y);const x=Math.min(Math.max(r.driveDeadzone??.18,0),.8),v=yA(h,p,x);h=Xs(v.x,r.driveCurve),p=Xs(v.y,r.driveCurve);const y=i.cameraTilt??{},S=Bu(a,y.sources),N=Math.min(Math.max(r.cameraDeadzone??.08,0),.8);let q=Ou(Va(S.value),N);q=Xs(q,r.cameraCurve);const E=Math.min(Math.max(r.auxDeadzone??.05,0),.6),C=i.mainBrush??{},j=Bu(a,C.sources);let M=Ou(Va(j.value),E);M=Xs(M,r.auxCurve);const A=i.sideBrush??{},k=Bu(a,A.sources);let O=Ou(Va(k.value),E);O=Xs(O,r.auxCurve);const B=La(a,i.vacuum?.sources),Z=La(a,i.allAux?.sources),z=La(a,i.mainReverse?.sources),X=La(a,i.sideReverse?.sources),$=La(a,i.driveMacro?.sources),Q=La(a,i.dockMacro?.sources),L=La(a,i.nightVisionToggle?.sources);return{driveVector:{x:h,y:p,boost:!1},cameraAxis:q,auxAxis:{main:M,side:O},buttons:{vacuum:B.pressed,allAux:Z.pressed,mainReverse:z.pressed,sideReverse:X.pressed,driveMacro:$.pressed,dockMacro:Q.pressed,nightVisionToggle:L.pressed},sources:{drive:d.source,cameraTilt:S.source,mainBrush:j.source,sideBrush:k.source,vacuum:B.source,allAux:Z.source,mainReverse:z.source,sideReverse:X.source,driveMacro:$.source,dockMacro:Q.source,nightVisionToggle:L.source}}}const Lr=new Set;let zl=null,Gr={pads:[],timestamp:0};function SA(){if(typeof navigator>"u"||!navigator.getGamepads)return[];const a=navigator.getGamepads();return a?Array.from(a).filter(Boolean):[]}function AA(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:Hg(a)}}function jA(){Gr={pads:SA().map(AA),timestamp:typeof performance<"u"?performance.now():Date.now()},Lr.forEach(l=>l(Gr))}function $g(){jA(),zl=requestAnimationFrame($g)}function NA(){zl||(zl=requestAnimationFrame($g))}function wA(){zl&&(cancelAnimationFrame(zl),zl=null)}function Gg(a){return Lr.add(a),NA(),a(Gr),()=>{Lr.delete(a),Lr.size===0&&wA()}}function CA(){const[a,l]=m.useState(Gr);return m.useEffect(()=>Gg(l),[]),a}const _l="gamepad",Ua={x:0,y:0,boost:!1},Ha={main:0,side:0,vacuum:0},EA=100,qA=100;function zu(a,l){return a&&l&&a.x===l.x&&a.y===l.y&&a.boost===l.boost}function Lu(a,l){return a&&l&&a.main===l.main&&a.side===l.side&&a.vacuum===l.vacuum}function MA(a){return a?Math.hypot(a.x||0,a.y||0):0}function RA(a){return a?!a.main&&!a.side&&!a.vacuum:!0}function TA(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 kA(){const{state:a,actions:{setMode:l,setDriveVector:i,setAuxMotors:r,setServoAngle:f,runMacro:d,toggleNightVision:h,registerInputState:p}}=Rt(),{value:x,save:v}=xt("gamepad",ga),y=m.useRef(new Set),S=m.useRef(Ua),N=m.useRef(Ha),q=m.useRef({main:!1,side:!1}),E=m.useRef(new Map),C=m.useRef(0),j=m.useRef(0),M=m.useRef(0),A=m.useRef(null),k=m.useCallback(z=>{const X=z.signature??Hg(z);x?.profiles?.[X]||y.current.has(X)||(y.current.add(X),v($=>{const Q=$??ga;if(Q.profiles?.[X])return Q;const L=Q?.defaults?.profile??Un,K=Vg(z,L);return{...Q,profiles:{...Q.profiles??{},[X]:K}}}))},[x?.profiles,v]),O=m.useCallback((z,X)=>{const $=E.current.get(z)||!1;return E.current.set(z,X),X&&!$},[]),B=m.useCallback((z,X)=>{const $=a.camera?.config;if(!$)return;const Q=typeof performance<"u"?performance.now():Date.now(),L=X?.cameraMode??"absolute",K=Math.max(1,Math.min(180,X?.cameraSensitivity??60));if(L==="velocity"){const F=Math.min(50,Q-M.current||16),ne=z*K*(F/1e3);if(Math.abs(ne)<.01)return;const fe=(typeof A.current=="number"?A.current:typeof a.camera?.angle=="number"?a.camera.angle:typeof $.homeAngle=="number"?$.homeAngle:0)+ne;f(fe),A.current=fe,M.current=Q;return}const se=typeof $.minAngle=="number"?$.minAngle:-45,ce=typeof $.maxAngle=="number"?$.maxAngle:45,W=typeof $.homeAngle=="number"?$.homeAngle:(se+ce)/2,T=z<0?W+z*(W-se):W+z*(ce-W);typeof A.current=="number"&&Math.abs(A.current-T)<.35&&Q-M.current<80||(M.current=Q,A.current=T,f(T))},[f,a.camera?.angle,a.camera?.config]),Z=m.useMemo(()=>x?.activeSignature??null,[x?.activeSignature]);return m.useEffect(()=>Gg(z=>{const X=TA(z.pads,Z);if(!X){zu(S.current,Ua)||(S.current=Ua,i(Ua,{source:_l})),Lu(N.current,Ha)||(N.current=Ha,r(Ha)),E.current=new Map,q.current={main:!1,side:!1},C.current=0,j.current=0,p(_l,{connected:!1});return}if(cA()){zu(S.current,Ua)||(S.current=Ua,i(Ua,{source:_l})),Lu(N.current,Ha)||(N.current=Ha,r(Ha)),E.current=new Map,q.current={main:!1,side:!1},p(_l,{connected:!0,blocked:!0});return}k(X);const $=X.signature,Q=x?.profiles?.[$]??x?.defaults?.profile??Un,L=Yg(X,Q);if(!zu(L.driveVector,S.current)){const ne=typeof performance<"u"?performance.now():Date.now();(MA(L.driveVector)<.02||ne-C.current>=EA)&&(S.current=L.driveVector,C.current=ne,i(L.driveVector,{source:_l}))}const K=Q.calibration?.auxSideScale??.55,se=Math.round(Math.min(Math.abs(L.auxAxis.main),1)*127),ce=Math.round(Math.min(Math.abs(L.auxAxis.side),1)*127),W=q.current.main?-se:se,T=q.current.side?-Math.round(ce*K):Math.round(ce*K);let F={main:L.auxAxis.main!==0?W:0,side:L.auxAxis.side!==0?T:0,vacuum:L.buttons.vacuum?127:0};if(L.buttons.allAux&&(F={main:127,side:127,vacuum:127}),!Lu(F,N.current)){const ne=typeof performance<"u"?performance.now():Date.now();(RA(F)||ne-j.current>=qA)&&(N.current=F,j.current=ne,r(F))}L.buttons.mainReverse&&O("mainReverse",!0)?q.current.main=!q.current.main:L.buttons.mainReverse||O("mainReverse",!1),L.buttons.sideReverse&&O("sideReverse",!0)?q.current.side=!q.current.side:L.buttons.sideReverse||O("sideReverse",!1),L.buttons.driveMacro&&O("driveMacro",!0)?(l("drive"),d("drive-sequence")):L.buttons.driveMacro||O("driveMacro",!1),L.buttons.dockMacro&&O("dockMacro",!0)?(l("dock"),d("seek-dock")):L.buttons.dockMacro||O("dockMacro",!1),L.buttons.nightVisionToggle&&O("nightVisionToggle",!0)?h():L.buttons.nightVisionToggle||O("nightVisionToggle",!1),Math.abs(L.cameraAxis)>.001&&B(L.cameraAxis,Q.calibration),p(_l,{connected:!0,signature:$,id:X.id,index:X.index,axes:X.axes,buttons:X.buttons,drive:L.driveVector,aux:F,cameraAxis:L.cameraAxis,bindings:L.sources})}),[Z,k,x?.defaults?.profile,x?.profiles,O,B,p,d,r,i,l,h]),null}function Xg(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 Qg(a){const l=Gl(a);return m.useMemo(()=>Xg(l),[l])}function Dl({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 wp({label:a}){return a?o.jsx("span",{className:"rounded border border-white/40 px-1 text-[0.7rem] text-white",children:a}):null}function Uu({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 _A({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(of,{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 Kg({layout:a="desktop",expand:l=!1,fill:i=!1,driveDockState:r,compactHeightClass:f=""}){const d=a==="mobile",{state:{roverId:h,keymap:p},actions:x}=Rt(),v=Gl(h),y=r??Xg(v),{driving:S,docked:N,charging:q,dockingInProgress:E}=y,[C,j]=m.useState(null),[M,A]=m.useState(!1),[k,O]=m.useState(!1),B=!h||C!==null,Z=!h||C!==null,z=mn(p?.driveMacro?.[0]),X=mn(p?.dockMacro?.[0]),$={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"]},Q="Click this button to initate auto-dock.",L={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"]},K=N?"Docked":"Undocked",se=N?"good":"bad",ce=q?"Charging":N?"Charging in 5s":"—",W=q?"good":N?"warn":"bad",T=async()=>{if(!(!h||C)){j("drive");try{x.setMode("drive"),await x.runMacro("drive-sequence")}catch(we){alert(we.message)}finally{j(null)}}},F=async()=>{if(!(!h||C)){A(!1),O(!1),j("drive");try{x.setMode("drive"),await x.runMacro("drive-sequence")}catch(we){alert(we.message)}finally{j(null)}}},ne=async()=>{if(!(!h||C)){j("dock");try{x.setMode("dock"),await x.runMacro("seek-dock")}catch(we){alert(we.message)}finally{j(null),A(!1),O(!1)}}},de=()=>{Z||(O(!0),A(!0))},fe="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",U="items-center justify-between",ee="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",ie="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",xe="border-amber-300/70 bg-amber-900 text-amber-50 hover:bg-amber-800 focus-visible:ring-amber-300",Re=l||E,te=Re?"h-full flex-1":i?"flex-1":"",re=d&&!Re?f:"",Se=d&&!Re?ee:U,_e=d&&!Re&&S&&N;if(!S&&!E)return o.jsxs("button",{type:"button",onClick:F,onContextMenu:we=>we.preventDefault(),disabled:B,className:`${fe} ${te} ${re} ${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&&Re?o.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-0.5",children:[z?o.jsx(wp,{label:z}):null,o.jsx(Uu,{label:"Click to start",tone:"emerald"})]}):null]}),Re?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"text-sm text-emerald-50/90",children:L.summary}),o.jsx(of,{steps:L.steps,tone:"emerald"})]}):null]}),Re?o.jsxs("div",{className:"flex w-full flex-1 flex-col gap-0.5 self-stretch",children:[o.jsx(Dl,{label:"Dock",value:K,tone:se}),o.jsx(Dl,{label:"Charge",value:ce,tone:W})]}):null]});if(E){const we={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:B,onClick:T,onContextMenu:Ye=>Ye.preventDefault(),className:`${fe} ${te} ${re} ${w} ${Se} ${ae} ${ie}`,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"}),Re?o.jsx("div",{className:"flex flex-wrap items-center justify-center gap-0.5",children:o.jsx(Uu,{label:"Return to driving mode",tone:"emerald"})}):null]}),Re?o.jsx("p",{className:"text-sm text-amber-50/90",children:we.summary}):null]}),Re?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex w-full flex-1 flex-col gap-0.5 self-stretch",children:[o.jsx(Dl,{label:"Dock",value:K,tone:se}),o.jsx(Dl,{label:"Charge",value:ce,tone:W})]}),d?null:o.jsx(of,{steps:we.steps,tone:"amber"})]}):null]})}return o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",disabled:Z,onClick:de,onContextMenu:we=>we.preventDefault(),className:d?`flex w-full ${fe} ${re} ${w} ${Se} ${ae} ${_e?xe:oe}`:`${fe} ${te} ${w} ${U} ${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:_e?"Docked!":"Dock and Charge"}),!d&&Re?o.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-0.5",children:[X?o.jsx(wp,{label:X}):null,o.jsx(Uu,{label:"Click to begin docking",tone:"indigo"})]}):null]}),!d&&Re&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"text-sm text-indigo-50/90",children:Q}),o.jsxs("div",{className:"flex w-full flex-1 flex-col gap-0.5 self-stretch",children:[o.jsx(Dl,{label:"Dock",value:K,tone:se}),o.jsx(Dl,{label:"Charge",value:ce,tone:W})]}),o.jsx("div",{className:"text-xs text-indigo-100/80",children:"Line up straight, about 1 foot away, before docking."})]})]}),k||!d&&M?o.jsx(_A,{instructions:$,pending:C==="dock",onCancel:()=>{O(!1),A(!1)},onConfirm:ne}):null]})}function of({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 Hu(a){return typeof a=="boolean"}function Zg({nightVisionOn:a,disabled:l,onToggle:i,keyLabel:r,className:f="",heightClass:d=""}){const[h,p]=m.useState(Hu(a)?a:null);m.useEffect(()=>{Hu(a)&&p(a)},[a]);const x=Hu(h),v=x?h:!1,y=x?v?"On":"Off":"—",S=v?"bg-emerald-500 text-emerald-950":"bg-slate-700 text-slate-200",N=()=>{if(l)return;const E=x?!v:!0;p(E),i?.(E)},q=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:E=>E.preventDefault(),disabled:l,"aria-pressed":v,className:q,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 ${S}`,children:y})]})}function Vu(a){const l=Number(a);return!Number.isFinite(l)||l<=0?0:Math.min(5e3,Math.round(l))}function Fg({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,S]=m.useState(!1),[N,q]=m.useState(p),{value:E,save:C}=xt("horn",Ya),[j,M]=m.useState(E?.waveform||Ya.waveform),[A,k]=m.useState(()=>[...Array.isArray(E?.freqs)?E.freqs:Ya.freqs,0,0,0,0].slice(0,4).map(T=>Vu(T)));m.useEffect(()=>{M(E?.waveform||Ya.waveform),Array.isArray(E?.freqs)&&k([...E.freqs,0,0,0,0].slice(0,4).map(W=>Vu(W)))},[E?.freqs,E?.waveform]);const O=!!f,B=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]),z=()=>{a||y||(S(!0),l?.())},X=()=>{y&&(S(!1),i?.())};m.useEffect(()=>{!O&&y&&S(!1)},[O,y]);const $=j==="sine"?"sine":"saw",Q=m.useCallback(W=>{const T=W.target.value==="sine"?"sine":"saw";M(T),C(F=>({...F??{},waveform:T}))},[C]),L=m.useCallback((W,T)=>{k(F=>{const ne=[...F];return ne[W]=Vu(T),C(de=>({...de??{},freqs:ne})),ne})},[C]),K=W=>{if(a)return;const T=W.target?.tagName?.toLowerCase();T==="input"||T==="select"||T==="option"||T==="label"||T==="button"||(W.preventDefault(),z())},se=W=>{const T=W.target?.tagName?.toLowerCase();T==="input"||T==="select"||T==="option"||T==="label"||T==="button"||(W.preventDefault(),X())},ce=x?o.jsx("button",{type:"button",onClick:W=>{W.preventDefault(),q(T=>!T)},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:K,onPointerUp:se,onPointerLeave:X,onPointerCancel:X,onContextMenu:W=>W.preventDefault(),onBlur:X,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) ${B*100}%, rgba(0,0,0,0) ${B*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]}),ce,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:$,onChange:Q,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((W,T)=>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:T+1}),o.jsx("input",{type:"number",min:0,max:5e3,step:1,value:W,onChange:F=>L(T,F.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-${T}`))})]}):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:$,onChange:Q,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((W,T)=>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:T+1}),o.jsx("input",{type:"number",min:0,max:5e3,step:1,value:W,onChange:F=>L(T,F.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-${T}`))]}):null]})}function Er(a){return typeof a!="number"||Number.isNaN(a)?"—":`${a>0?"+":""}${a.toFixed(1)}°`}function Cp({label:a}){return a?o.jsx("span",{className:"rounded border border-white/40 px-1 text-[0.7rem] text-white",children:a}):null}function Jg({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:S,className:N="",labelRowClass:q="",labelClass:E="",valueClass:C="",sliderClass:j="",endpointClass:M="",endpointLabelClass:A="",accentClass:k="",showValue:O=!0,showEndpoints:B}){const Z=d==="vertical",X=typeof B=="boolean"?B:!Z,[$,Q]=m.useState(a),L=m.useRef(!1),K=m.useRef(null);m.useEffect(()=>{L.current||Q(a)},[a]),m.useEffect(()=>()=>{K.current&&clearTimeout(K.current)},[]);const se=ne=>{if(h){if(x>0){K.current&&clearTimeout(K.current),K.current=setTimeout(()=>{h(ne)},x);return}h(ne)}},ce=ne=>{const de=Number.parseFloat(ne.target.value);Number.isNaN(de)||(L.current=!0,Q(de),se(de))},W=()=>{L.current=!1,K.current&&(clearTimeout(K.current),K.current=null),p?p($):x>0&&h?.($)};if(typeof l!="number"||typeof i!="number")return null;const T=[Z?"h-28 w-5":"w-full",k,j].filter(Boolean).join(" "),F=o.jsx("input",{type:"range",orient:Z?"vertical":void 0,min:l,max:i,step:r,value:Number.isFinite($)?$:l,onChange:ce,onMouseUp:W,onTouchEnd:W,onPointerUp:W,disabled:v,className:T,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 ${q}`.trim(),children:o.jsx("span",{className:C,children:Er(a)})}):null,o.jsxs("div",{className:"flex min-h-0 flex-1 items-center gap-0.5",children:[o.jsx("span",{className:E,children:f}),F]})]}):o.jsxs("div",{className:`space-y-0.5 ${N}`.trim(),children:[o.jsxs("div",{className:`flex items-center justify-between ${q}`.trim(),children:[o.jsx("span",{className:E,children:f}),O?o.jsx("span",{className:C,children:Er(a)}):null]}),o.jsxs("div",{children:[F,X?o.jsxs("div",{className:`mt-0 flex items-center justify-between ${M}`.trim(),children:[o.jsxs("span",{className:`flex items-center gap-0.5 ${A}`.trim(),children:[y?o.jsx(Cp,{label:y}):null,Er(l)]}),o.jsxs("span",{className:`flex items-center gap-0.5 ${A}`.trim(),children:[Er(i),S?o.jsx(Cp,{label:S}):null]})]}):null]})]})}const qr="mobile-joystick",DA=80,OA=.15,BA={main:0,side:0,vacuum:0},zA={main:127,side:127,vacuum:127},LA={main:-127,side:-127,vacuum:-127};function UA({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]),S=m.useCallback(C=>{if(a||h.current!==null)return;C.preventDefault();const j=d.current;if(!j)return;const M=j.getBoundingClientRect(),A=C.clientX-M.left,k=C.clientY-M.top;p.current={x:A,y:k},h.current=C.pointerId,j.setPointerCapture?.(C.pointerId),v({active:!0,base:{x:A,y:k},knob:{x:0,y:0}})},[a]),N=m.useCallback(C=>{if(a||h.current!==C.pointerId)return;C.preventDefault();const j=d.current;if(!j)return;const M=j.getBoundingClientRect(),A=C.clientX-M.left,k=C.clientY-M.top,O=A-p.current.x,B=k-p.current.y,Z=Math.min(Math.hypot(O,B),i),z=Math.atan2(B,O),X=Math.cos(z)*Z,$=Math.sin(z)*Z,Q={x:Hl(X/i),y:Hl(-$/i),boost:!1};v(L=>({...L,knob:{x:X,y:$}})),r?.(Q)},[a,r]),q=m.useCallback(C=>{if(h.current!==C.pointerId)return;C.preventDefault(),d.current?.releasePointerCapture?.(C.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:S,onPointerMove:N,onPointerUp:q,onPointerLeave:q,onPointerCancel:q,onContextMenu:C=>C.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 HA({layout:a}){const{state:{roverId:l},actions:{setDriveVector:i,registerInputState:r}}=Rt(),f=Qg(l),d=f.docked&&!f.driving,h=d||f.dockingInProgress,p=!l,x=DA,v=OA,y=m.useRef({x:0,y:0,boost:!1});m.useEffect(()=>{p&&(y.current={x:0,y:0,boost:!1})},[p]);const S=m.useCallback((C={})=>{if(p)return;const j={x:Hl(C.x??0),y:Hl(C.y??0),boost:!!C.boost},M={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=M,i(M,{source:qr}),r(qr,{vector:M,lastEvent:"move"})},[p,r,i,v]),N=m.useCallback(()=>{if(p)return;const C={x:0,y:0,boost:!1};y.current=C,i(C,{source:qr}),r(qr,{vector:C,lastEvent:"stop"})},[p,r,i]),E=`flex h-full flex-col gap-0.5 text-slate-100 ${d?"max-h-screen self-start":""}`;return o.jsxs("div",{className:E,children:[o.jsx(Kg,{layout:"mobile",expand:h,driveDockState:f,compactHeightClass:"min-h-[5rem]"}),h?null:o.jsx("div",{className:"flex-1 min-h-0",children:o.jsx(UA,{disabled:p,layout:a,radius:x,onMove:S,onStop:N})})]})}function Ep({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 VA({layout:a}){const{state:{roverId:l,camera:i,horn:r},pipeline:f,actions:{setServoAngle:d,setNightVision:h,setAuxMotors:p,startHorn:x,stopHorn:v}}=Rt(),y=!l,S=m.useRef(null),N=i?.config,q=!!(l&&i?.enabled&&N),E=!!(l&&f?.nightVision),C=f?.nightVisionState,j=!!(l&&f?.horn),M=r?.overheated,A=typeof N?.minAngle=="number"?N.minAngle:-45,k=typeof N?.maxAngle=="number"?N.maxAngle:45,O=typeof i?.angle=="number"?i.angle:typeof N?.homeAngle=="number"?N.homeAngle:(A+k)/2,B=m.useCallback(X=>{E&&h(X)},[E,h]),Z=m.useCallback((X,$)=>{y||(S.current=X,p($))},[y,p]),z=m.useCallback(X=>{y||S.current===X&&(S.current=null,p(BA))},[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(Ep,{id:"aux-vac-forward",label:"Vacuum Forward",values:zA,color:"bg-fuchsia-600",disabled:y,onPress:Z,onRelease:z}),o.jsx(Ep,{id:"aux-vac-backward",label:"Vacuum Backward",values:LA,color:"bg-fuchsia-800",disabled:y,onPress:Z,onRelease:z})]}),o.jsxs("div",{className:"flex min-h-0 items-stretch gap-0.5",children:[q?o.jsx("div",{className:"flex-1 min-h-0 rounded bg-zinc-950 p-0.25",children:o.jsx(Jg,{value:O,min:A,max:k,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,E?o.jsx(Zg,{nightVisionOn:C?.nightVisionOn,disabled:y,onToggle:B,heightClass:"h-full"}):null]}),o.jsx("div",{className:"min-h-0",children:j?o.jsx(Fg,{disabled:y||M,onStart:x,onStop:v,active:r?.active,heat:r?.heat,defaultShowSettings:!1,showSettingsToggle:!0,compactSettings:!0,className:"h-full"}):null})]})}function Ig({layout:a,className:l=""}){return o.jsx("div",{className:`flex flex-col gap-0.5 ${l}`.trim(),children:o.jsx(VA,{layout:a})})}function Wg({layout:a,className:l=""}){return o.jsx("div",{className:`flex flex-col gap-0.5 ${l}`.trim(),children:o.jsx(HA,{layout:a==="landscape"?"landscape":"portrait"})})}function YA(){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(Ig,{layout:"portrait",className:a}),o.jsx(Wg,{layout:"portrait",className:a})]})})}function $A(a=[],l={}){const i=xn(),{enabled:r=!0,version:f=null}=l,[d,h]=m.useState({}),p=m.useRef(new Map),x=m.useMemo(()=>a.map(E=>typeof E=="string"?E:E.id),[a]),v=m.useMemo(()=>{const E=x.join("|");return f?`${E}|v:${f}`:E},[x,f]),y=m.useRef([]),[S,N]=m.useState(0),q=m.useRef(new Map);return m.useEffect(()=>{if(!i)return;const E=()=>N(C=>C+1);return i.on("connect",E),()=>i.off("connect",E)},[i]),m.useEffect(()=>{y.current=x},[v,x]),m.useEffect(()=>{p.current.forEach(E=>URL.revokeObjectURL(E)),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 E=!1;const C=y.current,j=(A={},k)=>{if(E||!A.id||!k)return;const O=k.byteLength??k.length??0,B=Date.now(),Z=q.current.get(A.id)||{count:0,totalBytes:0,lastLogAt:0},z={count:Z.count+1,totalBytes:Z.totalBytes+O,lastLogAt:Z.lastLogAt};if(!z.lastLogAt||B-z.lastLogAt>=1e4){const L=z.count?z.totalBytes/z.count:0;console.log("[roomCamera]",A.id,`frame=${O}B`,`avg=${Math.round(L)}B`,`count=${z.count}`),z.lastLogAt=B}q.current.set(A.id,z);const X=new Blob([k],{type:"image/jpeg"}),$=URL.createObjectURL(X),Q=p.current.get(A.id);Q&&URL.revokeObjectURL(Q),p.current.set(A.id,$),h(L=>({...L,[A.id]:{status:"playing",ts:A.ts||Date.now(),error:null,objectUrl:$}}))},M=(A={})=>{E||!A.id||h(k=>({...k,[A.id]:{...k[A.id]||{},status:A.error?"error":k[A.id]?.status||"connecting",error:A.error||null,ts:A.ts||k[A.id]?.ts||null,objectUrl:k[A.id]?.objectUrl||null}}))};return i.on("roomCamera:frame",j),i.on("roomCamera:status",M),i.emit("roomCamera:subscribe",{ids:C},(A={})=>{A.error}),()=>{E=!0,i.emit("roomCamera:unsubscribe",{ids:C}),i.off("roomCamera:frame",j),i.off("roomCamera:status",M),p.current.forEach(A=>URL.revokeObjectURL(A)),p.current.clear()}},[i,v,r,S]),d}function GA({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 XA(){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 Pg=["horizontal","vertical"];function Yu(a,l){return Pg.includes(a)?a:l}function kf({defaultOrientation:a="horizontal",orientation:l,hideLayoutToggle:i=!1,hideHeader:r=!1,panelId:f=null}){const{session:d}=ze(),h=d?.roomCameras||[],p=$A(h.map(j=>({id:j.id}))),{value:x,save:v}=xt("roomCameraPanels",{}),[y,S]=m.useState(()=>Yu(f?x?.[f]:a,"horizontal"));m.useEffect(()=>{if(!f)return;const j=x?.[f];j&&S(Yu(j,"horizontal"))},[f,x?.[f]]);const N=l?Yu(l,"horizontal"):y,q=N==="vertical"?"flex flex-col gap-0.5":"grid gap-0.5 md:grid-cols-2",E=!i&&!l&&h.length>0,C=j=>{S(j),f&&v(M=>({...M||{},[f]:j}))};return h.length===0?o.jsx(XA,{}):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:E&&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:Pg.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:()=>C(j),children:j==="vertical"?"Vertical":"Grid"},j))})]})})]}),o.jsx("div",{className:q,children:h.map(j=>{const M=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(GA,{feed:M,label:j.name||j.id})},j.id)})})]})}function _f(){const{logs:a}=ze();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 QA(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 KA(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 ei(a=[],l={}){const i=xn(),{enabled:r=!0,version:f=null}=l,[d,h]=m.useState({}),p=m.useMemo(()=>Array.isArray(a)?KA(a.map(QA).filter(Boolean)):[],[a]),x=m.useMemo(()=>{const q=p.map(E=>`${E.type}:${E.id}:${E.key}`).join("|");return f?`${q}|v:${f}`:q},[p,f]),v=m.useRef([]),[y,S]=m.useState(0);return m.useEffect(()=>{if(!i)return;const q=()=>S(E=>E+1);return i.on("connect",q),()=>{i.off("connect",q)}},[i]),m.useEffect(()=>{v.current=p},[p]),m.useEffect(()=>{if(!x||!r){h({});return}const q=v.current;let E=!1;function C(j){const M=j.type==="room"?{roomCameraId:j.id}:{roverId:j.id};i.emit("video:request",M,(A={})=>{E||h(k=>({...k,[j.key]:A}))})}return q.forEach(j=>{C(j)}),()=>{E=!0}},[i,x,r,y]),m.useMemo(()=>{if(!x||!r)return{};const q={};return p.forEach(E=>{d[E.key]&&(q[E.key]=d[E.key])}),q},[x,d,p])}function Df(a=[],l={}){const i=xn(),{enabled:r=!0,version:f=null}=l,[d,h]=m.useState({}),p=m.useRef(new Map),x=m.useMemo(()=>a.map(E=>typeof E=="string"?E:E.id).filter(Boolean),[a]),v=m.useMemo(()=>{const E=x.join("|");return f?`${E}|v:${f}`:E},[x,f]),y=m.useRef([]),[S,N]=m.useState(0),q=m.useRef(new Map);return m.useEffect(()=>{if(!i)return;const E=()=>N(C=>C+1);return i.on("connect",E),()=>i.off("connect",E)},[i]),m.useEffect(()=>{y.current=x},[v,x]),m.useEffect(()=>{p.current.forEach(E=>URL.revokeObjectURL(E)),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 E=!1;const C=y.current,j=(A={},k)=>{if(E||!A.id||!k)return;const O=k.byteLength??k.length??0,B=Date.now(),Z=q.current.get(A.id)||{count:0,totalBytes:0,lastLogAt:0},z={count:Z.count+1,totalBytes:Z.totalBytes+O,lastLogAt:Z.lastLogAt};if(!z.lastLogAt||B-z.lastLogAt>=1e4){const L=z.count?z.totalBytes/z.count:0;console.log("[roverSnapshot]",A.id,`frame=${O}B`,`avg=${Math.round(L)}B`,`count=${z.count}`),z.lastLogAt=B}q.current.set(A.id,z);const X=new Blob([k],{type:"image/jpeg"}),$=URL.createObjectURL(X),Q=p.current.get(A.id);Q&&URL.revokeObjectURL(Q),p.current.set(A.id,$),h(L=>({...L,[A.id]:{status:"playing",ts:A.ts||Date.now(),error:null,objectUrl:$}}))},M=(A={})=>{E||!A.id||h(k=>({...k,[A.id]:{...k[A.id]||{},status:A.error?"error":k[A.id]?.status||"connecting",error:A.error||null,ts:A.ts||k[A.id]?.ts||null,objectUrl:k[A.id]?.objectUrl||null}}))};return i.on("roverSnapshot:frame",j),i.on("roverSnapshot:status",M),i.emit("roverSnapshot:subscribe",{ids:C},(A={})=>{A.error}),()=>{E=!0,i.emit("roverSnapshot:unsubscribe",{ids:C}),i.off("roverSnapshot:frame",j),i.off("roverSnapshot:status",M),p.current.forEach(A=>URL.revokeObjectURL(A)),p.current.clear()}},[i,v,r,S]),d}const ZA={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"turn:your.turn.server:3478",username:"user",credential:"pass"}],bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"};function FA(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 JA(a){if(!a)return{};const l=`${a}:${a}`;return{Authorization:`Basic ${FA(l)}`}}class qp{constructor({url:l,token:i,video:r,onStatus:f,audioOnly:d=!1}){this.url=l,this.token=i,this.video=r,this.audioOnly=d,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(ZA);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"}),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:!0,offerToReceiveVideo:!this.audioOnly});await l.setLocalDescription(r);const f=await fetch(this.url,{method:"POST",headers:{"Content-Type":"application/sdp",...JA(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 cf({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,S=v+4,N=v-14,q=v-6,E=v*.65,C=a?.bumpsAndWheelDrops||{},j=a?.wheelOvercurrents||{},M=a?.wheelLeftCurrentMa??0,A=a?.wheelRightCurrentMa??0,k=a?.sideBrushCurrentMa??0,O=a?.mainBrushCurrentMa??0,B=6,Z=C.bumpLeft?B:0,z=C.bumpRight?B:0,X=aj({count:6,totalSpan:140,gap:6,startAngle:-70}),$=["L","FL","CL","CR","FR","R"],Q=[a?.lightBumpLeftSignal,a?.lightBumpFrontLeftSignal,a?.lightBumpCenterLeftSignal,a?.lightBumpCenterRightSignal,a?.lightBumpFrontRightSignal,a?.lightBumpRightSignal],L=X.map((W,T)=>({label:$[T],start:W.start,end:W.end,value:Q[T]})),K=[{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}],se=Q.filter(W=>W!=null),ce=se.length?Math.max(...se,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–",ce]})]}),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(Mp,{cx:p-E,cy:x,current:M,drop:C.wheelDropLeft,overcurrent:j.leftWheel,label:"L"}),o.jsx(Mp,{cx:p+E,cy:x,current:A,drop:C.wheelDropRight,overcurrent:j.rightWheel,label:"R"}),o.jsx(PA,{cx:p+v*.65,cy:x-v*.55,current:k,overcurrent:j.sideBrush}),o.jsx(ej,{cx:p,cy:x,current:O,overcurrent:j.mainBrush,variant:l,dirtLeft:a?.dirtDetectLeft,dirtRight:a?.dirtDetect}),L.map(W=>{const T=tj(W.value,ce),F=S+4,ne=F+28;return o.jsx(IA,{cx:p,cy:x,rBase:ne,rTip:F,startDeg:W.start,endDeg:W.end,color:T,value:W.value,max:ce},W.label)}),K.map(W=>{const T=nj(W.value,W.active);return o.jsx($u,{cx:p,cy:x,rInner:N,rOuter:q,startDeg:W.start,endDeg:W.end,color:T,opacity:1,pulse:!!W.active},W.label)}),o.jsx($u,{cx:p,cy:x,rInner:y-Z,rOuter:S-Z,startDeg:-70,endDeg:-6,color:C.bumpLeft?"#ef4444":"#475569",opacity:1,pulse:!!C.bumpLeft}),o.jsx($u,{cx:p,cy:x,rInner:y-z,rOuter:S-z,startDeg:6,endDeg:70,color:C.bumpRight?"#ef4444":"#475569",opacity:1,pulse:!!C.bumpRight})]})]})}function $u({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,S=WA(a,l,v,f,d);return o.jsxs(o.Fragment,{children:[o.jsx("path",{d:S,stroke:h,strokeWidth:y,strokeLinecap:"round",fill:"none",opacity:x}),p?o.jsx("path",{d:S,stroke:"#ef4444",strokeWidth:y,strokeLinecap:"round",fill:"none",className:"animate-pulse",opacity:1}):null]})}function IA({cx:a,cy:l,rBase:i,rTip:r,startDeg:f,endDeg:d,color:h,value:p,max:x}){const v=(f+d)/2,y=Js(a,l,r,v),S=Ir(p!=null?p/(x||1):0),N=Math.pow(S,.35),q=i-(i-r)*N,E=Js(a,l,q,f),C=Js(a,l,q,d),j=`M ${y.x} ${y.y} L ${E.x} ${E.y} L ${C.x} ${C.y} Z`;return o.jsx("path",{d:j,fill:h,opacity:1,stroke:"none"})}function WA(a,l,i,r,f){let d=r,h=f;h<=d&&(h+=360);const p=Js(a,l,i,d),x=Js(a,l,i,h);return["M",p.x,p.y,"A",i,i,0,0,1,x.x,x.y].join(" ")}function Js(a,l,i,r){const f=ex(r);return{x:a+i*Math.cos(f),y:l+i*Math.sin(f)}}function ex(a){return(a-90)*Math.PI/180}function Of(a,l){if(l)return"#ef4444";const i=Math.abs(a);return i>900?"#f59e0b":i>300?"#22c55e":"#64748b"}function Ir(a){return Math.max(0,Math.min(1,a))}function Mp({cx:a,cy:l,current:i,drop:r,overcurrent:f,label:d}){const h=Math.abs(i),p=Ir(h/1200),x=Of(i,f),v=56,y=14,S=9,N=3,q=v*p,E=d==="L"?-1:1,C=E*(-S/2-N/2),j=E*(y/2+N/2),M=y+S+N+2,A=v+4;return o.jsxs("g",{transform:`translate(${a},${l})`,children:[o.jsx("rect",{x:-M/2,y:-A/2,width:M,height:A,rx:"4",fill:"none",stroke:"#64748b",strokeWidth:"1"}),o.jsx("rect",{x:C-y/2,y:-v/2,width:y,height:v,fill:"#0f172a",stroke:"#0f172a",strokeWidth:"1",rx:"2"}),o.jsx("rect",{x:C-y/2,y:v/2-q,width:y,height:q,fill:x,className:f?"animate-pulse":""}),o.jsx("rect",{x:j-S/2,y:-v/2,width:S,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 PA({cx:a,cy:l,current:i,overcurrent:r}){var f=Math.abs(i);f<10&&(f=0);const d=Of(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=ex(v),S=a+h*Math.cos(y),N=l+h*Math.sin(y);return o.jsx("line",{x1:a,y1:l,x2:S,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 ej({cx:a,cy:l,current:i,overcurrent:r,variant:f,dirtLeft:d,dirtRight:h}){const p=Math.abs(i),x=Of(i,r),v=1,y=96,S=12,N=`main-brush-pattern-a-${f}`,q=`main-brush-pattern-b-${f}`,E=p>0?.6:null,C=i>=0?1:-1;return o.jsxs("g",{children:[o.jsx("defs",{children:[N,q].map((j,M)=>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"}),E?o.jsx("animateTransform",{attributeName:"patternTransform",type:"translate",from:"0 0",to:`0 ${C*(M===0?6:-6)}`,dur:`${E}s`,repeatCount:"indefinite"}):null]},j))}),o.jsx("rect",{x:a-y/2,y:l-14,width:y,height:S,rx:"3",fill:`url(#${N})`,stroke:"#64748b",strokeWidth:"1"}),o.jsx("rect",{x:a-y/2,y:l+4,width:y,height:S,rx:"3",fill:`url(#${q})`,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:S*2+16,rx:"6",stroke:"#ef4444",strokeWidth:"3",fill:"none",className:"animate-pulse"}):null]})}function tj(a,l){if(a==null||a<=0)return"hsl(200 60% 18%)";const r=Ir(a/(l||1));return`hsl(${(200+Math.pow(r,.45)*360)%360} 100% 60%)`}function nj(a,l){if(l)return"#ef4444";const i=Ir(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 aj({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 tx(){const{value:a,save:l}=xt("page",{hudMapDesktop:!1});return[!!a?.hudMapDesktop,f=>{l({hudMapDesktop:!!f})}]}const lj={discord:Mg,kofi:mp,"ko-fi":mp,wiki:RS,throne:TS},sj={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 ij(){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 rj(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 Bf({id:a,label:l,url:i,className:r=""}){if(!i)return null;ij();const f=rj(a,l),d=lj[f]||kS,h=sj[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 ti=10;function nx({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=oj({charge:v,full:h,warn:p,urgent:x})),y==null)return{available:!1};const S=Math.max(0,Math.min(1,y/100)),N=f??(p!=null&&v!=null&&v<=p),q=d??(x!=null&&v!=null&&v<=x);return{available:!0,percent:S,percentDisplay:y,warnActive:N,urgentActive:q,warnDisplayPercent:ti}}function oj({charge:a,full:l,warn:i,urgent:r}){if(a!=null&&l!=null&&i!=null&&r!=null&&l>i&&i>r){const f=ti/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))*ti)}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 cj=1600,uj=800;function nn(...a){return a.filter(Boolean).join(" ")}function uf({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 K=ti,se=nn("absolute z-10",p?"left-0 right-0 h-[2px]":"top-0 bottom-0 w-[2px]","bg-black/70",q&&!N&&"battery-tick-warn"),ce=p?{bottom:`${K}%`}:{left:`${K}%`},W=nn("absolute inset-0 pointer-events-none",d);return o.jsxs("div",{className:W,children:[o.jsx("div",{className:"absolute inset-0 bg-slate-900/35"}),o.jsx("div",{className:se,style:ce})]})}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)),S=a.warnDisplayPercent??ti,N=!!a.urgentActive,q=!!a.warnActive,E=N?`${uj}ms`:q?`${cj}ms`:void 0,j=h?N||q?"bg-red-500/45":"bg-emerald-500/45":N||q?"bg-red-500":"bg-emerald-500",M=N||q?"bg-red-900/35":"bg-slate-900/35",A=N||q?"bg-red-900/45":"bg-slate-900/35",k=nn(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 K=p?{height:`${y}%`}:{width:`${y}%`},se=nn("absolute",p?"bottom-0 left-0 right-0":"left-0 top-0 bottom-0",j,"transition-[width,height]",N&&"battery-urgent-flash"),ce=nn("absolute z-10",p?"left-0 right-0 h-[2px]":"top-0 bottom-0 w-[2px]","bg-black/70",q&&!N&&"battery-tick-warn"),W=p?{bottom:`${S}%`}:{left:`${S}%`};return o.jsxs("div",{className:k,children:[o.jsx("div",{className:nn("absolute inset-0",M,N&&"battery-urgent-flash")}),o.jsx("div",{className:se,style:{...K,animationDuration:E}}),o.jsx("div",{className:ce,style:W})]})}const O=nn("relative overflow-hidden rounded-sm border border-slate-800",N||q?A:"bg-zinc-900/90",N&&"battery-urgent-flash",p?"w-full flex-1":r?"h-4":"h-5"),B=p?{height:`${y}%`}:{width:`${y}%`},Z=nn("absolute",p?"bottom-0 left-0 right-0":"left-0 top-0 bottom-0",j,"transition-[width,height]",N&&"battery-urgent-flash"),z=nn("absolute z-10",p?"left-0 right-0 h-[2px]":"top-0 bottom-0 w-[2px]","bg-black/70",q&&!N&&"battery-tick-warn"),X=p?{bottom:`${S}%`}:{left:`${S}%`},$=`Battery ${v}%`,Q=nn("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"),L=nn("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:k,children:[o.jsxs("div",{className:O,children:[o.jsx("div",{className:Z,style:{...B,animationDuration:E}}),o.jsx("div",{className:z,style:X})]}),x&&!p?o.jsx("div",{className:Q,children:o.jsx("span",{className:L,children:$})}):null,x&&p?o.jsx("div",{className:"mt-0.5 text-[0.65rem] font-semibold text-slate-100",children:o.jsxs("span",{className:L,children:[v,"%"]})}):null]})}const Rp=2e3,fj=3e3,dj=3e3;function ni({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:S=null,hudForceMap:N=!1,hudMapPosition:q="top-center",hudLabelScale:E=1,fitParent:C=!1,overcurrentLimiter:j=null,showTurnCue:M=!1,turnTimerText:A=null,turnSeconds:k=null,isActiveDriver:O=!1,idleSkipSeconds:B=null}){const{session:Z}=ze(),z=m.useRef(null),X=m.useRef(null),$=m.useRef(null),Q=m.useRef(null),L=m.useRef(null),K=m.useRef(null),[se,ce]=m.useState("idle"),[W,T]=m.useState(null),[F,ne]=m.useState("idle"),[de,fe]=m.useState(null),[w,U]=m.useState(0),[ee,ae]=m.useState(0),[le,ie]=m.useState(!0),oe=i==="snapshot",xe=p?.sensors,pe=xe?.batteryChargeMah??null,Re=v==="desktop",te=!Re,re=te?"top-right":q,[Se]=tx(),_e=N||te?!0:Se,we=nx({charge:pe,config:x}),Ye=xe?.wheelOvercurrents||null,It=Ye==null?[]:Object.entries(Ye).filter(([,ve])=>!!ve).map(([ve])=>ve),St=j?.caps||null,$n=j?.overcurrent?.groups||null,Tt=typeof window<"u"&&new URLSearchParams(window.location.search).has("debugHud"),Wt=m.useMemo(()=>{if(!St)return null;const ve=Number.isFinite(St?.drive?.cap)?St.drive.cap:1,ct=Number.isFinite(St?.aux?.cap)?St.aux.cap:1;return Math.max(0,Math.min(1,1-Math.min(ve,ct)))},[St]),Xl=!!j?.isActive,va=It.length?It:Xl?["limiter"]:[],rt=Wt??(It.length?1:0),Ql=!!va.length,ui=Z?.socials?.find(ve=>String(ve?.id||ve?.label||"").toLowerCase()==="discord")?.url||Z?.discord?.invite||null;m.useEffect(()=>{Tt&&console.log("[OvercurrentHUD]",{overlayVisible:Ql,overlayMotors:va,overlayFill:rt,limiterActive:Xl,limiterCaps:St,limiterGroups:$n,wheelOvercurrents:Ye})},[Tt,rt,va,Ql,Xl,St,$n,Ye]);const Gn=m.useCallback(()=>{clearTimeout($.current),$.current=setTimeout(()=>U(Date.now()),Rp)},[]),Xn=m.useCallback(()=>{clearTimeout(Q.current),Q.current=setTimeout(()=>ae(Date.now()),Rp)},[]),Xa=m.useCallback(async()=>{const ve=z.current;if(ve)try{ve.muted=!0,await ve.play()}catch{}},[]),Kl=m.useCallback((ve=0)=>{if(h)return;clearTimeout(K.current);const ct=()=>{clearTimeout(K.current),K.current=setTimeout(()=>{h||At()},fj)},At=async()=>{const Ge=z.current;if(Ge)try{await Xa(),Ge.muted=!1,await Ge.play(),ie(!1)}catch{Ge.muted=!0,ie(!0),ct()}};K.current=setTimeout(At,ve)},[Xa,h]);m.useEffect(()=>()=>{clearTimeout($.current),clearTimeout(Q.current),clearTimeout(K.current),clearInterval(L.current)},[]),m.useEffect(()=>{se==="playing"&&Kl(0)},[se,Kl]),m.useEffect(()=>{oe&&(ce("snapshot"),T(null))},[oe]),m.useEffect(()=>{if(oe||!a?.url||!z.current)return;let ve=!0,ct;const At=setTimeout(()=>ie(!0),0),Ge=(Ze,Le)=>{ve&&(ce(Ze),T(Le||null),Ze==="playing"&&Xa(),["error","failed","disconnected","closed"].includes(Ze)&&Gn())};return ct=new qp({url:a.url,token:a.token,video:z.current,onStatus:Ge}),ct.start().catch(Ze=>{ve&&(ce("error"),T(Ze.message),Gn())}),()=>{ve=!1,clearTimeout(At),ct?.stop()}},[oe,a?.url,a?.token,w,Gn,Xa]),m.useEffect(()=>{se==="stopped"&&a?.url&&Gn()},[se,a?.url,Gn]),m.useEffect(()=>{if(!l?.url||!X.current)return;let ve=!0,ct;const At=(Ge,Ze)=>{ve&&(fe(Ze||(Ge==="connected"?"connected":null)),ne(Le=>Ge==="connected"&&(Le==="playing"||Le==="connecting")||Ge==="new"?Le:Ge),Ge==="playing"&&X.current?.play().catch(()=>{}),["error","failed","disconnected","closed"].includes(Ge)&&Xn())};return ct=new qp({url:l.url,token:l.token,video:X.current,audioOnly:!0,onStatus:At}),ct.start().catch(Ge=>{ve&&(ne("error"),fe(Ge.message),Xn())}),()=>{ve=!1,ct?.stop()}},[l?.url,l?.token,ee,Xn]),m.useEffect(()=>{const ve=X.current;if(!l?.url||!ve){clearInterval(L.current);return}if(!["connecting","connected","playing","paused"].includes(F)){clearInterval(L.current);return}const At=()=>{const Ge=X.current;Ge&&(!Ge.paused&&!Ge.ended||Ge.play().then(()=>{ne(Ze=>Ze==="connected"?"playing":Ze),fe(Ze=>Ze==="paused"?null:Ze)}).catch(Ze=>{fe(Le=>Le||Ze?.message||"autoplay blocked")}))};return At(),L.current=setInterval(At,dj),()=>clearInterval(L.current)},[l?.url,F]),m.useEffect(()=>{const ve=X.current;if(!ve)return;const ct=()=>{ne(Le=>Le==="error"?Le:"playing"),fe(null)},At=()=>{ne(Le=>["error","failed","disconnected","closed","stopped"].includes(Le)?Le:"paused"),fe(Le=>Le||"paused")},Ge=()=>{ne(Le=>Le==="error"?Le:"stopped"),fe(Le=>Le||"ended")},Ze=()=>{const{error:Le}=ve,Qa=Le?.message||"audio error";ne("error"),fe(Qa)};return ve.addEventListener("play",ct),ve.addEventListener("pause",At),ve.addEventListener("ended",Ge),ve.addEventListener("error",Ze),()=>{ve.removeEventListener("play",ct),ve.removeEventListener("pause",At),ve.removeEventListener("ended",Ge),ve.removeEventListener("error",Ze)}},[l?.url]);const no=r?.error?`Error: ${r.error}`:r?.objectUrl?"snapshot":r?.status||"waiting",ao=oe?no:a?.url?se==="error"?`Error: ${W||"unknown"}`:W?`${se} (${W})`:se:"waiting",ya=l?.error?`Error: ${l.error}`:l?.url?F==="error"?`Error: ${de||"unknown"}`:de?`${F} (${de})`:F:null,vt=y==="spectator",ot=y==="none";return o.jsxs("div",{className:`flex flex-col gap-0.5 ${C?"h-full":""}`,children:[o.jsxs("div",{className:`relative w-full overflow-hidden bg-black ${C?"h-full flex-1":"aspect-[4/3]"}`,children:[oe?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:z,muted:h||le,playsInline:!0,autoPlay:!0,controls:!1,className:"h-full w-full object-contain"}),o.jsx("audio",{ref:X,autoPlay:!0,hidden:!0}),!ot&&M?o.jsx(pj,{mobileHud:te,turnSeconds:k,isActiveDriver:O,idleSkipSeconds:B}):null,ot?null:o.jsx(hj,{frame:p,sensors:xe,label:d,status:ao,audioStatus:ya,desktopLayout:Re,layoutFormat:v,variant:y,driverLabel:S,battery:we,showTopDown:_e,mobileHud:te,mapPosition:re,turnTimerText:A,labelScale:E}),ot?null:o.jsx(yj,{compact:te}),!ot&&Tt?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:${Ql?1:0} motors:${va.length} fill:${Math.round(rt*100)}%`}):null,ot?null:o.jsx(xj,{motors:va,fill:rt,compact:te}),ot?null:o.jsx(vj,{battery:we,compact:te}),!ot&&vt&&we.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(uf,{visual:we,orientation:"vertical",variant:"inline",compact:te,className:"h-full w-4"})}):null,!ot&&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 ${te?"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(Bf,{id:"discord",label:"Join our Discord server while you wait!",url:ui})})]})}):null]}),!ot&&!vt&&o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(mj,{sensors:xe}),o.jsx("div",{className:"panel-section space-y-0.5 text-sm",children:o.jsx(uf,{visual:we,compact:te})})]})]})}function mj({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,S=`${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:S,background:N,float:y===-1?"right":"left"}})})},x)})})}function hj({frame:a,sensors:l,label:i,status:r,audioStatus:f,desktopLayout:d=!0,layoutFormat:h="desktop",variant:p="default",driverLabel:x=null,battery:v,showTopDown:y=!1,mobileHud:S=!1,mapPosition:N="top-center",turnTimerText:q=null,labelScale:E=1}){l?.bumpsAndWheelDrops;const[C,j]=m.useState(()=>Date.now());m.useEffect(()=>{const F=setInterval(()=>j(Date.now()),150);return()=>clearInterval(F)},[]),a?.receivedAt&&C-a.receivedAt<200;const M=S,A=h==="mobile-portrait",k=M?"text-[0.45rem]":"text-[0.65rem]",O=M?"px-0.25 py-0.25":"px-1 py-0.5",B=M?"px-0.25 py-0.25":"px-0.5 py-0.5",Z=M?"text-[0.55rem]":"text-[0.8rem]",z=M?"left-0.5 top-0.5":"left-1 top-1",X=M?"text-[0.5rem]":"text-[0.7rem]",$=M?"px-0.5 py-0.25":"px-1 py-0.5",Q=M?"left-0.5 top-1/2":"left-1 top-1/2",L="bottom-0.5",K={transform:`translateX(-50%) scale(${E})`,transformOrigin:"center bottom"},se="240px",ce=A?.3:M?.33:.7,T={width:se,height:se,opacity:M?.6:.7,transform:N==="top-center"?`translateX(-50%) scale(${ce})`:`scale(${ce})`,transformOrigin:N==="bottom-left"?"bottom left":N==="top-center"?"top center":"top right",...N==="bottom-left"?{left:"0.25rem",bottom:"0.25rem"}:N==="top-center"?{left:"50%",top:"0.25rem"}:{right:"0.25rem",top:"0.25rem"}};if(p==="none")return null;if(p==="spectator"){const F=[["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||"--"]],ne=!!l?.chargingSources?.homeBase,de=l?.chargingState?.label||"",fe=!!(de&&de.toLowerCase()!=="not charging"),w=l?.oiMode?.label||"Unknown",U=w.toLowerCase(),ee=U==="full"?"bg-emerald-500/80 text-emerald-50":U==="safe"?"bg-amber-400/80 text-amber-950":U==="passive"?"bg-slate-700/80 text-slate-100":"bg-slate-700/60 text-slate-200",ae=ne?"bg-emerald-500/80 text-emerald-50":"bg-slate-700/70 text-slate-200",le=fe?"bg-emerald-500/80 text-emerald-50":ne?"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 ${z} font-medium text-slate-100 ${k}`,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]})}),o.jsx("div",{className:`absolute ${Q} flex -translate-y-1/2 flex-col gap-0.5 bg-black/70 text-slate-100 ${k} ${O}`,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 ${ae}`,children:ne?"Docked":"Undocked"}),o.jsx("span",{className:`rounded px-1.5 py-0.5 ${le}`,children:fe?"Charging":"Not charging"}),o.jsxs("span",{className:`rounded px-1.5 py-0.5 ${ee}`,children:["OI: ",w]})]}),F.map(([ie,oe])=>o.jsxs("span",{className:"flex items-center justify-between gap-0.5",children:[o.jsx("span",{className:"text-slate-400",children:ie}),o.jsx("span",{className:"font-semibold text-white",children:oe})]},ie))]})}),o.jsx("div",{className:`absolute ${L} left-1/2`,style:K,children:o.jsxs("div",{className:`flex items-center gap-0.5 bg-black/80 text-slate-100 ${B} ${Z}`,children:[o.jsx("span",{className:"font-semibold text-white",children:i||"Unnamed Rover"}),x?o.jsxs("span",{className:"text-slate-300",children:["• ",x]}):null]})})]}),y?o.jsx("div",{className:"pointer-events-none absolute rounded",style:{...T},children:o.jsx(cf,{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 ${z} font-medium text-slate-100 ${k}`,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]})}),q?o.jsx("div",{className:`absolute left-1/2 top-0.5 -translate-x-1/2 rounded bg-black/70 text-slate-100 ${$} ${X}`,children:q}):null,o.jsx("div",{className:`absolute ${L} left-1/2`,style:K,children:o.jsx("div",{className:`flex gap-0.5 bg-black/80 text-slate-100 ${B} ${Z}`,children:o.jsxs("span",{children:['Rover: "',i||"Unnamed Rover",'"']})})}),y&&p!=="spectator"?o.jsx("div",{className:"pointer-events-none absolute rounded",style:{...T},children:o.jsx(cf,{sensors:l,size:240,overlay:!0})}):null]})}function pj({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 gj={leftWheel:"Left wheel",rightWheel:"Right wheel",mainBrush:"Main brush",sideBrush:"Side brush",limiter:"Overcurrent limit"};function xj({motors:a,fill:l=0,compact:i=!1}){if(!a?.length)return null;const r=a.map(y=>gj[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 vj({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 yj({compact:a=!1}){const{session:l}=ze(),{sendMessage:i,onInputFocus:r,onInputBlur:f,blurChat:d,registerInputRef:h,setTypingActive:p}=Mf(),{value:x}=xt("tts",{engine:"flite",voice:"rms",pitch:50}),[v,y]=m.useState(""),[S,N]=m.useState(!1),q=l?.role!=="spectator",E=l?.role==="spectator",C=l?.assignment?.roverId||null,M=!!m.useMemo(()=>l?.roster?.find(z=>String(z.id)===String(C))||null,[C,l?.roster])?.audio?.ttsEnabled,A=m.useMemo(()=>{if(!M)return null;const z=x?.engine==="espeak"?"espeak":"flite";if(z==="espeak"){let $=Number.isFinite(x?.pitch)?Math.round(x.pitch):void 0;return typeof $=="number"&&($=Math.max(0,Math.min(99,$))),{speak:!0,engine:z,pitch:$}}const X=typeof x?.voice=="string"?x.voice:void 0;return{speak:!0,engine:z,voice:X}},[x?.engine,x?.pitch,x?.voice,M]),k=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",B=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(z){if(z.preventDefault(),!q)return;const X=v.trim();if(X){N(!0);try{await i(X,A),y(""),d(),p(!1)}catch($){alert($.message)}finally{N(!1)}}}return E?null:o.jsxs("form",{onSubmit:Z,className:k,children:[o.jsx("input",{className:O,value:v,onChange:z=>{const X=z.target.value;y(X),p(!!X.trim())},onFocus:z=>{r(z),p(!!v.trim())},onBlur:z=>{f(z),p(!1)},onKeyDown:z=>{z.key==="Enter"&&!v.trim()&&(z.preventDefault(),d(),p(!1))},ref:z=>h(z,{target:"hud"}),placeholder:q?"Chat (TTS)":"Spectator",disabled:!q}),o.jsx("button",{type:"submit",disabled:!q||S,className:B,children:"Speak"})]})}function zf({layoutFormat:a="desktop"}){const{session:l}=ze(),{state:{song:i,lastControlIntentAt:r},overcurrentLimiter:f}=Rt(),[d,h]=m.useState(()=>Date.now()),[p,x]=m.useState(!1),[v,y]=m.useState(null),S=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,E=!!(N&&l?.roster?l.roster.find(ae=>String(ae.id)===String(N)):null)?.media?.audioPublishUrl,C=N?l?.turnQueues?.[N]:null,j=l?.socketId||null,M=N?l?.activeDrivers?.[N]:null,A=!!(j&&M===j),k=m.useMemo(()=>{const ae=C?.queue||[];if(!ae.length||!C?.current||ae.length<=1)return null;const le=ae.findIndex(ie=>ie===C.current);return le===-1?ae[0]||null:ae[(le+1)%ae.length]||null},[C?.queue,C?.current]),O=!!(j&&k===j),B=C?.deadline||null,Z=C?.idleDeadline||null,z=B?B-d:null,X=Z?Z-d:null,$=l?.mode==="turns"&&O&&z!=null&&z<=5e3&&z>0,Q=l?.mode!=="turns"||A||$,L=z!=null&&Number.isFinite(z)?Math.max(0,Math.ceil(z/1e3)):null,K=X!=null&&Number.isFinite(X)?Math.max(0,Math.ceil(X/1e3)):null,se=A?L!=null?`${L}s left`:null:O&&L!=null?`Your turn in ${L}s`:null,ce=N?[...Q?[{type:"rover",id:N,key:N}]:[],...E?[{type:"rover",id:`${N}-audio`,key:`${N}-audio`}]:[]]:[],W=ei(ce),T=N&&Q?W[N]:null,F=N&&E?W[`${N}-audio`]:null,ne=Df(N?[N]:[],{enabled:!!N,version:l?.mode}),de=N&&ne[N]||null,fe=Gl(N),w=N&&l?.roster?l.roster.find(ae=>String(ae.id)===String(N)):null,U=w?.battery??null,ee=w?.name||(N?`Rover ${N}`:"");return m.useEffect(()=>{if(l?.mode!=="turns"){x(!1),y(null),S.current={active:!1,roverId:null};return}const ae=S.current,le=A&&!ae.active,ie=A&&N&&N!==ae.roverId;le||ie?(x(!0),y(Date.now())):!A&&ae.active&&(x(!1),y(null)),S.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(ni,{sessionInfo:T,videoMode:Q?"whep":"snapshot",snapshotFeed:de,audioSessionInfo:F,label:ee,telemetryFrame:fe,batteryConfig:U,layoutFormat:a,overcurrentLimiter:f,songNote:i?.note,qualityNotice:Q?null:"Preview feed (low FPS) until your turn.",showTurnCue:p,turnTimerText:se,turnSeconds:L,isActiveDriver:A,idleSkipSeconds:K}):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 ff({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 Wr(a){if(!Number.isFinite(a))return 0;const l=a%360;return l<0?l+360:l}function bj(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,Wr(Math.round(y*60))}function Tp(a){const l=Wr(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 kp(a){return a?Array.isArray(a.hsColor)?Wr(Number(a.hsColor[0])):Array.isArray(a.rgbColor)?bj(a.rgbColor):0:0}function Sj({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,[S,N]=m.useState(()=>kp(a)),q=m.useRef(S),E=m.useRef(!1),C=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||E.current)return;const B=kp(a);q.current=B,N(B)},[a.rgbColor,a.hsColor,h]);const j=B=>{const Z=Wr(Number(B.target.value));q.current=Z,N(Z)},M=()=>{y||!r||r(a.id,Tp(q.current))},A=B=>{B.stopPropagation()},O=`rgb(${(h?Tp(q.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 ${C} 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(ff,{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:B=>{A(B),E.current=!0},onPointerUp:B=>{A(B),E.current=!1,M()},onPointerCancel:B=>{A(B),E.current=!1,M()},onKeyUp:B=>{A(B),M()},onBlur:M,children:o.jsx("div",{className:"relative w-full",children:o.jsx("input",{type:"range",min:"0",max:"360",step:"1",value:S,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(ff,{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 ax(){const{state:{keymap:a}}=Rt(),{session:l,homeAssistantToggle:i,homeAssistantSetLightColor:r}=ze(),f=l?.homeAssistant,d=m.useMemo(()=>f?.entities||[],[f?.entities]),h=mn(a?.homeAssistantOn?.[0]),p=mn(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(_p,{label:h}):null]}),o.jsxs("span",{className:"flex items-center gap-0.5",children:[o.jsx("span",{children:"Off"}),p?o.jsx(_p,{label:p}):null]})]})]}),o.jsx(ff,{label:x?"Connected":"Offline",tone:x?"success":"warn"})]}),o.jsx("div",{className:"flex flex-wrap gap-0.5",children:d.map(v=>o.jsx(Sj,{entity:v,connected:x,onToggle:i,onSetColor:r},v.id))})]})}function _p({label:a}){return a?o.jsx("span",{className:"rounded border border-white/40 px-1 text-[0.7rem] text-white",children:a}):null}function lx(){const{login:a,setRole:l}=ze(),[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 Dp(...a){return a.filter(Boolean).join(" ")}function Aj(a){const l=a?.batteryState?.percentDisplay;return l==null?"--":`${l}%`}function jj(a){return a?.batteryState?a.batteryState.urgentActive?"text-red-400":a.batteryState.warnActive?"text-amber-300":"text-emerald-300":"text-slate-400"}function Nj({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:Dp("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:Dp("font-semibold",jj(f)),children:["Battery ",Aj(f)]})]})]}),r?r(f):null]},f.id))})]})}const wj=[{key:"open",label:"Open"},{key:"turns",label:"Turns"},{key:"admin",label:"Admin"},{key:"lockdown",label:"Lockdown"}];function Cj(){const{session:a,lockRover:l,setMode:i,requestControl:r,setCommunityGoal:f,setAdminReason:d,rebootRover:h,rebootServer:p,adminLogs:x}=ze(),v=m.useMemo(()=>a?.roster??[],[a?.roster]),[y,S]=m.useState({}),[N,q]=m.useState({}),[E,C]=m.useState(!1),j=a?.health||null,M=a?.communityGoal?.text||"",A=a?.communityGoal?.updatedAt||null,[k,O]=m.useState(M),B=a?.adminReason?.text||"",Z=a?.adminReason?.updatedAt||null,[z,X]=m.useState(B),$=a?.role==="admin"||a?.role==="lockdown"||a?.role==="lockdown-admin",Q=a?.mode??"open",L=async(w,U)=>{try{await l(w,U),S(ee=>({...ee,[w]:U}))}catch(ee){alert(ee.message)}},K=async w=>{const U=w.target.value;try{await i(U)}catch(ee){alert(ee.message)}},se=async w=>{try{await r(w,{force:!0})}catch(U){alert(U.message)}},ce=async w=>{if(!(!w?.id||!window.confirm(`Reboot rover "${w.name||w.id}" now?`))){q(ee=>({...ee,[w.id]:!0}));try{await h(w.id)}catch(ee){alert(ee.message)}finally{q(ee=>({...ee,[w.id]:!1}))}}},W=async()=>{if(window.confirm("Reboot the server host now? This will disconnect all users.")){C(!0);try{await p()}catch(U){alert(U.message),C(!1)}}},T=async()=>{try{await f(k)}catch(w){alert(w.message)}},F=async()=>{try{await f(null)}catch(w){alert(w.message)}},ne=async()=>{try{await d(z)}catch(w){alert(w.message)}},de=async()=>{try{await d(null)}catch(w){alert(w.message)}};m.useEffect(()=>{O(M)},[M]),m.useEffect(()=>{X(B)},[B]);const fe=m.useMemo(()=>{const w={};return v.forEach(U=>{w[U.id]=y[U.id]??U.locked}),w},[v,y]);return $?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:Q,onChange:K,className:"field-input text-sm",children:wj.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:W,disabled:E,className:"button-danger disabled:cursor-not-allowed disabled:opacity-60",children:E?"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:k,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:T,className:"button-dark",children:"Set goal"}),o.jsx("button",{type:"button",onClick:F,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:z,onChange:w=>X(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:ne,className:"button-dark",children:"Set reason"}),o.jsx("button",{type:"button",onClick:de,className:"button-danger",children:"Clear"})]})]}),o.jsx(Nj,{roster:v,renderActions:w=>o.jsxs("div",{className:"flex flex-wrap gap-0.5 text-xs",children:[o.jsx("button",{type:"button",onClick:()=>L(w.id,!fe[w.id]),className:"button-dark",children:fe[w.id]?"Unlock":"Lock"}),o.jsx("button",{type:"button",onClick:()=>se(w.id),className:"button-dark",children:"Force"}),o.jsx("button",{type:"button",onClick:()=>ce(w),disabled:!!N[w.id],className:"button-danger disabled:cursor-not-allowed disabled:opacity-60",children:N[w.id]?"Rebooting...":"Reboot"})]})}),o.jsx(Ej,{health:j}),o.jsx(qj,{entries:x})]}):null}function Ej({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 qj({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 Mj=[{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 Rj(a){return a.reduce((l,i)=>((l[i.group]||(l[i.group]=[])).push(i),l),{})}function Tj(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(0,Math.min(500,i)):l}const Lf=5,ai=500,li=1,Uf=100;function kj(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(Lf,Math.min(ai,i)):l}function Ur(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(li,Math.min(Uf,i)):l}function _j(a){const i=(Ur(a,a)-li)/(Uf-li),r=ai-i*(ai-Lf);return Math.round(r)}function Dj(a){const l=kj(a,a),i=(ai-l)/(ai-Lf),r=li+i*(Uf-li);return Math.round(r)}function Oj(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=ci(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 Mr({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 Bj(){const{state:{keymap:a},actions:{updateKeyBinding:l,resetKeyBindings:i}}=Rt(),{value:r,save:f}=xt("inputs",dn),d={...dn.keyboard,...r.keyboard??{}},h=m.useMemo(()=>typeof d.tiltSpeed=="number"?Ur(d.tiltSpeed,dn.keyboard.tiltSpeed):typeof d.tiltIntervalMs=="number"?Ur(Dj(d.tiltIntervalMs),dn.keyboard.tiltSpeed):dn.keyboard.tiltSpeed,[d.tiltIntervalMs,d.tiltSpeed]),p=m.useMemo(()=>Rj(Mj),[]),{active:x,startCapture:v,cancel:y}=Oj((E,C)=>{l(E,C)}),S=m.useCallback(E=>a?.[E]?.[0]||Fs[E]?.[0]||"",[a]),N=m.useCallback((E,C)=>{const j=dn.keyboard,M=Tj(C,j[E]);f(A=>({...A??{},keyboard:{...A?.keyboard??j,[E]:M}}))},[f]),q=m.useCallback(E=>{const C=dn.keyboard,j=Ur(E,C.tiltSpeed),M=_j(j);f(A=>({...A??{},keyboard:{...A?.keyboard??C,tiltSpeed:j,tiltIntervalMs:M}}))},[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(Mr,{label:"Base speed",description:"Normal driving speed",value:d.baseSpeed,onChange:E=>N("baseSpeed",E)}),o.jsx(Mr,{label:"Turbo speed",description:"Used when holding the boost modifier",value:d.turboSpeed,onChange:E=>N("turboSpeed",E)}),o.jsx(Mr,{label:"Precision speed",description:"Used when holding the precision modifier",value:d.precisionSpeed,onChange:E=>N("precisionSpeed",E)})]})]}),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(Mr,{label:"Tilt speed",description:"Higher = faster when holding tilt keys",value:h,onChange:q,min:1,max:100,step:1})]}),o.jsx("div",{className:"space-y-0.5",children:Object.entries(p).map(([E,C])=>o.jsxs("div",{className:"space-y-0.5 surface",children:[o.jsx("p",{className:"text-[0.75rem] text-slate-400",children:E}),o.jsx("div",{className:"space-y-0.5",children:C.map(j=>{const M=S(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:mn(M)})]}),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)})})]},E))})]})}const Ln=new Intl.NumberFormat(void 0,{maximumFractionDigits:2}),zj=[{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"}],Op=.45,Lj=.6;function Qs({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:Ln.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 Uj(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} ${Ln.format(a.threshold??.6)}`}return"Unassigned"}function Hj(a){return a.reduce((l,i)=>((l[i.section]||(l[i.section]=[])).push(i),l),{})}function Vj(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 Yj(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 $j(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>Op).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>Op);return f?{kind:"axis",index:f.index,...i.invertDefaults??{}}:null}function Gj(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>Lj)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 Xj(a,l,i){if(!a)return null;if(i.kind==="axis"||i.kind==="axisPair"){const r=$j(a,l,i);if(r)return r}return Gj(a,l,i)}function Qj(){const a=CA(),{value:l,save:i}=xt("gamepad",ga),[r,f]=m.useState(null),d=m.useRef(null),h=m.useMemo(()=>Hj(zj),[]),p=m.useMemo(()=>Vj(a.pads,l.activeSignature),[a.pads,l.activeSignature]),x=p?.signature??null,v=m.useMemo(()=>x?l?.profiles?.[x]??l?.defaults?.profile??Un:l?.defaults?.profile??Un,[x,l?.defaults?.profile,l?.profiles]);m.useEffect(()=>{!p||!x||l?.profiles?.[x]||i(j=>{const M=j??ga;if(M.profiles?.[x])return M;const A=M?.defaults?.profile??Un,k=Vg(p,A);return{...M,profiles:{...M.profiles??{},[x]:k}}})},[p,x,l?.profiles,i]),m.useEffect(()=>{d.current=null},[r,x]),m.useEffect(()=>{if(!r||!p)return;if(!d.current){d.current=Yj(p);return}const j=Xj(p,d.current,r);j&&(i(M=>{const A=M??ga,k=A.profiles?.[x]??A?.defaults?.profile??Un,O={...k,bindings:{...k.bindings??{},[r.id]:{...k.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(M=>({...M??ga,activeSignature:j||null}))},[i]),S=m.useCallback(j=>{i(M=>{const A=M??ga,k=(x&&A.profiles?.[x])??A?.defaults?.profile??Un,O={...k,calibration:{...k.calibration??{},...j}};return x?{...A,profiles:{...A.profiles??{},[x]:O}}:{...A,defaults:{...A.defaults??{},profile:O}}})},[x,i]),N=m.useCallback((j,M)=>{i(A=>{const k=A??ga,O=(x&&k.profiles?.[x])??k?.defaults?.profile??Un,B=M(O.bindings?.[j]??{}),Z={...O,bindings:{...O.bindings??{},[j]:B}};return x?{...k,profiles:{...k.profiles??{},[x]:Z}}:{...k,defaults:{...k.defaults??{},profile:Z}}})},[x,i]),q=m.useCallback(j=>{N(j.id,M=>({...M,sources:[]}))},[N]),E=m.useCallback((j,M)=>{N(j.id,A=>{const k=Array.isArray(A.sources)?[...A.sources]:[];if(!k[0])return A;const O={...k[0]};return M==="invertX"?O.invertX=!O.invertX:M==="invertY"?O.invertY=!O.invertY:O.invert=!O.invert,k[0]=O,{...A,sources:k}})},[N]),C=m.useMemo(()=>p?{outputs:Yg(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(Qs,{label:"Drive deadzone",description:"Ignore small drive stick drift",min:0,max:.6,step:.01,value:v.calibration?.driveDeadzone??.18,onChange:j=>S({driveDeadzone:j})}),o.jsx(Qs,{label:"Camera deadzone",description:"Ignore small camera tilt drift",min:0,max:.4,step:.01,value:v.calibration?.cameraDeadzone??.08,onChange:j=>S({cameraDeadzone:j})}),o.jsx(Qs,{label:"Aux deadzone",description:"Ignore small trigger noise",min:0,max:.4,step:.01,value:v.calibration?.auxDeadzone??.05,onChange:j=>S({auxDeadzone:j})}),o.jsx(Qs,{label:"Side brush scale",description:"Scale side brush output",min:.3,max:1,step:.05,value:v.calibration?.auxSideScale??.55,onChange:j=>S({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=>S({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(Qs,{label:"Camera sensitivity",description:"Velocity mode degrees per second",min:10,max:180,step:5,value:v.calibration?.cameraSensitivity??60,onChange:j=>S({cameraSensitivity:j})})]})]}),o.jsx("div",{className:"space-y-0.5",children:Object.entries(h).map(([j,M])=>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:M.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:Uj(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:()=>E(A,"invertX"),className:"button-dark text-[0.7rem] font-medium disabled:opacity-50",children:"Invert X"}),o.jsx("button",{type:"button",disabled:!O,onClick:()=>E(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:()=>E(A),className:"button-dark text-[0.7rem] font-medium disabled:opacity-50",children:"Invert"}),o.jsx("button",{type:"button",onClick:()=>q(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,M)=>o.jsxs("span",{className:"font-mono text-slate-300",children:["A",M,": ",Ln.format(j)]},`axis-${M}`))}),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,M)=>o.jsxs("span",{className:"font-mono text-slate-300",children:["B",M,": ",Ln.format(j.value)," ",j.pressed?"●":""]},`btn-${M}`))}),C?.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: ",Ln.format(C.outputs.driveVector.x),","," ",Ln.format(C.outputs.driveVector.y)]}),o.jsxs("span",{className:"font-mono text-slate-300",children:["Camera: ",Ln.format(C.outputs.cameraAxis)]}),o.jsxs("span",{className:"font-mono text-slate-300",children:["Main: ",Ln.format(C.outputs.auxAxis.main)]}),o.jsxs("span",{className:"font-mono text-slate-300",children:["Side: ",Ln.format(C.outputs.auxAxis.side)]})]})]})]}):o.jsx("p",{className:"text-[0.7rem] text-slate-400",children:"No controller detected."})]})]})}const Kj={drive:"Drive wheels",aux:"Aux motors"};function Bp(a){return Number.isFinite(a)?`${Math.round(a*100)}%`:"--"}function Zj({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 Fj(){const{state:{roverId:a},overcurrentLimiter:l}=Rt(),i=m.useMemo(()=>Bl.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:Kj[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:Bp(f)})]}),o.jsx(Zj,{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:Bp(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 sx=m.createContext(null);function ix(){const a=m.useContext(sx);if(!a)throw new Error("Tabs components must be used within a <Tabs> provider.");return a}const zp={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"}},rx="primary";function Hf(...a){return a.filter(Boolean).join(" ")}function Vf({children:a,defaultTab:l,currentTab:i,onTabChange:r,variant:f=rx}){const[d,h]=m.useState(l??null),[p,x]=m.useState([]),v=m.useCallback(q=>q?(x(E=>E.includes(q)?E:[...E,q]),()=>x(E=>E.includes(q)?E.filter(C=>C!==q):E)):()=>{},[]),y=i??d??p[0]??null;m.useEffect(()=>{l&&i===void 0&&h(l)},[l,i]);const S=m.useCallback(q=>{q&&(i===void 0&&h(q),r&&r(q))},[i,r]),N=m.useMemo(()=>({activeTab:y,setActiveTab:S,registerTab:v,variant:f}),[y,S,v,f]);return o.jsx(sx.Provider,{value:N,children:a})}function Yf({children:a,className:l=""}){return o.jsx("div",{className:Hf("flex gap-0.5",l),children:a})}function ln({id:a,children:l,className:i="",disabled:r=!1}){const{activeTab:f,setActiveTab:d,registerTab:h,variant:p}=ix();m.useEffect(()=>h(a),[a,h]);const x=zp[p]??zp[rx],v=f===a,y=Hf(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 $f({children:a,className:l=""}){return o.jsx("div",{className:Hf("mt-0 space-y-0.5",l),children:a})}function sn({id:a,children:l,keepMounted:i=!1}){const{activeTab:r}=ix(),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 Jj(){const{session:a}=ze(),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 Lp=300,Up=240;function Ij(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 Wj(a){const i=a.map(r=>Ij(r)).join(" ");return i.length>Up?`${i.slice(0,Up)}…`:i}function Pj(){const a=xn(),[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(S=>{const N=[...S,{id:`${Date.now()}-${Math.random().toString(16).slice(2)}`,direction:x,event:v,payload:Wj(y),timestamp:new Date().toLocaleTimeString()}];return N.length>Lp?N.slice(-Lp):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 e2=[{key:"start",label:"Start OI"},{key:"safe",label:"Safe"},{key:"full",label:"Full"},{key:"passive",label:"Passive"},{key:"dock",label:"Dock"}];function ox(){const{state:{roverId:a},actions:{sendOiCommand:l,setSensorStream:i}}=Rt(),r=!!a,[f,d]=tx(),h=xn(),{value:p,save:x}=xt("page",{hudMapDesktop:!1,connectionTransport:"websocket"}),v=p?.connectionTransport||"websocket",y=m.useMemo(()=>[{key:"start",label:"Enable stream",enable:!0},{key:"stop",label:"Disable stream",enable:!1}],[]),S=q=>{a&&i(q)},N=q=>{const E=q.target.value;x(C=>({...C??{},connectionTransport:E})),h?.io?.opts&&(h.io.opts.transports=E==="polling"?["polling"]:["websocket","polling"],h.disconnect(),h.connect())};return o.jsxs(Vf,{defaultTab:"keybindings",children:[o.jsxs(Yf,{children:[o.jsx(ln,{id:"keybindings",children:"Keybindings"}),o.jsx(ln,{id:"controller",children:"Controller"}),o.jsx(ln,{id:"page",children:"Page settings"}),o.jsx(ln,{id:"admin",children:"Admin"})]}),o.jsxs($f,{children:[o.jsx(sn,{id:"keybindings",children:o.jsx("div",{className:"space-y-0.5",children:o.jsx(Bj,{})})}),o.jsx(sn,{id:"controller",children:o.jsx("div",{className:"space-y-0.5",children:o.jsx(Qj,{})})}),o.jsx(sn,{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:q=>d(q.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:"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:v,onChange:N,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(sn,{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:e2.map(q=>o.jsx("button",{type:"button",onClick:()=>l(q.key),disabled:!r,className:"button-dark text-xs disabled:opacity-30",children:q.label},q.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:y.map(q=>o.jsx("button",{type:"button",onClick:()=>S(q.enable),disabled:!r,className:"flex-1 button-dark text-xs disabled:opacity-30",children:q.label},q.key))}),!r&&o.jsx("p",{className:"text-xs text-slate-500",children:"Assign a rover to toggle streams."})]}),o.jsx(lx,{}),o.jsx(Fj,{}),o.jsx(Cj,{}),o.jsx(Jj,{}),o.jsx(Pj,{})]})})]})]})}const Hp={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 t2(a){return Hp[a]||Hp.desktop}function cx({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:mn(i)})}function Vp(a,l){return a.map((i,r)=>typeof i=="string"?o.jsx("span",{children:i},`text-${r}`):i?.action?o.jsx(cx,{actionId:i.action,keymap:l},`pill-${i.action}-${r}`):i?.text?o.jsx("span",{children:i.text},`span-${r}`):null)}function Pr(a,l,i){if(typeof a=="string")return a;if(Array.isArray(a?.segments))return Vp(a.segments,l);if(a&&typeof a=="object"){if(typeof a.text=="string")return a.text;if(Array.isArray(a))return Vp(a,l)}return String(a??"")}function n2({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:Pr(i,l)},f)})})]}):null}function a2({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:Pr(i,l)},f)})})]})}function l2({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:Pr(i,{})},`callout-${r}`))})]})}function s2({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(cx,{actionId:i.action,keymap:l})]},i.action))})]})}function i2({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(s2,{group:i,keymap:l},i.id))})]}):null}function r2({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:Pr(l,{})},`gamepad-${i}`))})]}):null}function Yp({block:a,keymap:l}){if(!a)return null;switch(a.type){case"list":return o.jsx(a2,{block:a,keymap:l});case"callout":return o.jsx(l2,{block:a});case"keyboard":return o.jsx(i2,{block:a,keymap:l});case"gamepad":return o.jsx(r2,{block:a});default:return null}}function ux({layout:a,keymap:l}){const i=m.useMemo(()=>t2(a),[a]),r=l||{},f=i.main||[],d=i.aside||[];return o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(n2,{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(Yp,{block:h,keymap:r},h.title||p))}),o.jsx("div",{className:"space-y-0.5",children:d.map((h,p)=>o.jsx(Yp,{block:h,keymap:r},h.title||p))})]})]})}function fx({layout:a,onOpenOverlay:l}){const{state:i}=Rt();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(ux,{layout:a,keymap:i?.keymap||{}})]})}const o2=["kal","rms","slt","ksp","bdl"],c2=Array.from({length:10},(a,l)=>l*10);function eo({hideInput:a=!1,hideSpectatorNotice:l=!1,fillHeight:i=!1,allowSpectatorInput:r=!1}){const{session:f}=ze(),{messages:d,typing:h,sendMessage:p,registerInputRef:x,onInputFocus:v,onInputBlur:y,blurChat:S,setTypingActive:N}=Mf(),{value:q,save:E}=xt("tts",{engine:"flite",voice:"rms",pitch:50}),[C,j]=m.useState(""),[M,A]=m.useState(!1),[k,O]=m.useState(!1),[B,Z]=m.useState(()=>q?.engine||"flite"),[z,X]=m.useState(()=>q?.voice||"rms"),[$,Q]=m.useState(()=>Number.isFinite(q?.pitch)?q.pitch:50),L=f?.role!=="spectator"||r,K=m.useRef(null),se=f?.assignment?.roverId||null,W=!!m.useMemo(()=>f?.roster?.find(w=>String(w.id)===String(se))||null,[se,f?.roster])?.audio?.ttsEnabled,T=m.useMemo(()=>d.slice(-200),[d]),F=m.useMemo(()=>h||[],[h]);m.useEffect(()=>{K.current&&(K.current.scrollTop=K.current.scrollHeight)},[T,F]),m.useEffect(()=>{const w=q?.engine||"flite",U=q?.voice||"rms",ee=Number.isFinite(q?.pitch)?q.pitch:50;B!==w&&Z(w),z!==U&&X(U),$!==ee&&Q(ee)},[B,$,q?.engine,q?.pitch,q?.voice,z]),m.useEffect(()=>{O(!!W)},[W]);const ne=m.useMemo(()=>!W||!k?null:B==="espeak"?{speak:!0,engine:B,pitch:$}:{speak:!0,engine:B,voice:z},[B,$,k,W,z]);async function de(w){if(w.preventDefault(),!L||a)return;const ee=C.replace(/\\n/g,`
|
||
`).trim();if(ee){A(!0);try{await p(ee,ne),j(""),S(),N(!1)}catch(ae){alert(ae.message)}finally{A(!1)}}}const fe=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 ${fe}`,ref:K,children:[T.length===0&&F.length===0?o.jsx("p",{className:"text-sm text-slate-500",children:"No messages yet."}):T.map(w=>o.jsx(kg,{message:w},w.id)),F.map(w=>o.jsx(_g,{message:w},`typing-${w.typingId||w.id}`))]}),!a&&o.jsxs("form",{className:"flex flex-wrap items-stretch gap-0.5",onSubmit:de,children:[o.jsx("input",{className:"field-input flex-1 min-w-[10rem]",value:C,onChange:w=>{const U=w.target.value;j(U),N(!!U.trim())},onFocus:w=>{v(w),N(!!C.trim())},onBlur:w=>{y(w),N(!1)},onKeyDown:w=>{w.key==="Enter"&&!C.trim()&&(w.preventDefault(),S(),N(!1))},ref:w=>x(w,{target:"panel"}),placeholder:L?"Type a message…":l?"":"Spectators cannot chat",disabled:!L}),W&&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:k,onChange:w=>O(w.target.checked),className:"accent-cyan-500"}),o.jsx("span",{children:"Speak"})]}),o.jsxs("select",{value:B,onChange:w=>{const U=w.target.value;Z(U),E(ee=>({...ee||{},engine:U}))},className:"field-input text-xs",children:[o.jsx("option",{value:"flite",children:"flite"}),o.jsx("option",{value:"espeak",children:"espeak"})]}),B==="flite"?o.jsx("select",{value:z,onChange:w=>{const U=w.target.value;X(U),E(ee=>({...ee||{},voice:U}))},className:"field-input text-xs",children:o2.map(w=>o.jsx("option",{value:w,children:w},w))}):o.jsx("select",{value:$,onChange:w=>{const U=Number(w.target.value);Q(U),E(ee=>({...ee||{},pitch:U}))},className:"field-input text-xs",children:c2.map(w=>o.jsxs("option",{value:w,children:["pitch ",w]},w))})]}),o.jsx("button",{type:"submit",disabled:!L||M,className:"button-dark h-full disabled:opacity-50 self-stretch",children:M?"...":"Send"})]})]})}function Gf({compact:a=!1}){const{session:l,setNickname:i}=ze(),{value:r,save:f}=xt("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(S){if(S.preventDefault(),!v)return;const N=(d||"").trim().slice(0,32);if(N){x(!0);try{await i(N),f({nickname:N})}catch(q){alert(q.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:S=>h(S.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 u2(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 f2(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 dx({className:a=""}){const{session:l}=ze(),i=u2(l).map(f2).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(Bf,{...r},`${r.id||r.label}-${r.url}`))}):null}function d2({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(Gf,{compact:a})})})}function m2(){return o.jsx("section",{className:"panel-section flex h-full min-h-0 flex-col gap-0.5 text-base",children:o.jsx(dx,{className:"flex-1 min-h-0"})})}function Gu(...a){return a.filter(Boolean).join(" ")}function h2(a){const l=a?.batteryState?.percentDisplay;return l==null?"--":`${l}%`}function p2(a){return a?.batteryState?a.batteryState.urgentActive?"text-red-400":a.batteryState.warnActive?"text-amber-300":"text-emerald-300":"text-slate-400"}function g2(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 x2(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 to({title:a="Rovers"}){const{session:l,requestControl:i}=ze(),[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??[],S=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 q=m.useMemo(()=>{const j=new Set(x.map(A=>String(A.id))),M=Object.keys(v||{}).filter(A=>!j.has(String(A))).map(A=>({id:A,name:A,locked:!1,batteryState:null}));return[...x,...M]},[x,v]);async function E(j){if(j){f(M=>({...M,[j]:!0}));try{await i(j)}catch(M){alert(M.message)}finally{f(M=>({...M,[j]:!1}))}}}const C=j=>y.find(M=>M.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}),q.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:q.map(j=>{const M=String(j.id),A=v?.[M]||null,k=A?.queue||[],O=A?.idleDeadline||A?.deadline||null,B=O&&O>d?Math.ceil((O-d)/1e3):O?0:null,Z=A?.current||null,z=Z?k.findIndex(T=>T===Z):-1,X=k.length>1?z>=0?k[(z+1)%k.length]:k[0]:null,$=!!(S&&Z&&Z===S),Q=!!(S&&X&&X===S),L=B!=null&&($||Q),K=!!j.locked,se=j.lockReason?`locked: ${j.lockReason}`:"locked",ce=K?se:r[M]?"...":"request",W=p&&!K&&!r[M];return o.jsxs("li",{className:Gu("surface flex flex-wrap items-start justify-between gap-0.5",W&&"cursor-pointer",K&&"bg-red-900/40"),onClick:()=>{W&&E(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}),L?o.jsx("span",{className:"rounded bg-slate-800 px-1 text-[0.7rem] text-slate-200",children:$?`${B}s left`:`Your turn in ${B}s`}):null]}),o.jsx("span",{className:Gu("text-[0.75rem] font-semibold",p2(j)),children:h2(j)})]}),k.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:k.map((T,F)=>{const ne=C(T),de=T===Z,fe=!!(X&&T===X&&!de),w=de?"bg-sky-600 text-white ring-2 ring-amber-300":fe?"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:`${g2(ne.role)} font-semibold`,children:x2(ne,S)}),de&&o.jsx("span",{className:"text-[0.65rem] text-slate-200",children:"now"}),fe&&o.jsx("span",{className:"text-[0.65rem] text-emerald-100",children:"next"})]},`${M}-${T}-${F}`)})})]}),p?o.jsx("button",{type:"button",onClick:T=>{T.stopPropagation(),E(j.id)},disabled:r[M]||K,className:Gu("button-dark disabled:opacity-40",K&&"bg-red-600/70 text-white hover:bg-red-600"),children:ce}):null]},j.id)})})]})}function v2(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 y2(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 Xr({hideNicknameForm:a=!1,hideHeader:l=!1,className:i="",fillHeight:r=!1,compact:f=!1}){const{session:d,setNickname:h}=ze(),{value:p}=xt("profile",{nickname:""}),x=m.useRef(null),v=xn(),y=d?.role!=="spectator",S=d?.users??[],N=d?.socketId||null;m.useEffect(()=>{if(!y||!d?.socketId)return;const C=p.nickname||"";if(!C||d.socketId===x.current)return;const j=d.socketId;h(C).then(()=>{x.current=j}).catch(()=>{})},[y,d?.socketId,h,p.nickname]),m.useEffect(()=>{if(!v)return;const C=()=>{if(!y)return;const j=(p.nickname||"").trim();j&&h(j).then(()=>{x.current=d?.socketId||null}).catch(()=>{})};return v.on("connect",C),()=>v.off("connect",C)},[y,h,v,p.nickname,d?.socketId]);const q=m.useMemo(()=>[...S].sort((C,j)=>C.socketId===N?-1:j.socketId===N?1:(C.nickname||"").localeCompare(j.nickname||"")),[N,S]),E=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(Gf,{compact:f})})}),o.jsx(dx,{})]}),!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:q.length})]}),o.jsx("div",{className:`surface flex flex-wrap content-start items-start gap-0.5 px-0 pb-0 ${E} ${f?"text-[0.8rem]":""}`,children:q.length===0?o.jsx("p",{className:"text-sm text-slate-500",children:"Waiting for users…"}):q.map(C=>o.jsx("span",{className:`rounded bg-slate-800/80 px-1 py-0.25 text-[0.7rem] ${v2(C.role)}`,children:y2(C,N)},C.socketId))})]})]})}function b2(){const{state:{roverId:a}}=Rt(),i=Gl(a)?.sensors||{};return o.jsx("section",{className:"panel-section",children:o.jsx("div",{className:"aspect-square w-full",children:o.jsx(cf,{sensors:i})})})}function S2(){const{state:{roverId:a,keymap:l,camera:i,horn:r},pipeline:f,actions:{setServoAngle:d,setNightVision:h,startHorn:p,stopHorn:x}}=Rt(),v=Qg(a),y=v.docked&&!v.driving,S=i?.config,N=!!(a&&i?.enabled&&S),q=!!(a&&f?.nightVision),E=f?.nightVisionState,C=!!(a&&f?.horn),j=r?.overheated,M=typeof S?.minAngle=="number"?S.minAngle:-30,A=typeof S?.maxAngle=="number"?S.maxAngle:30,k=typeof i?.angle=="number"?i.angle:typeof S?.homeAngle=="number"?S.homeAngle:(M+A)/2,O=mn(l?.nightVisionToggle?.[0]),B=mn(l?.hornHonk?.[0]),Z=mn(l?.cameraUp?.[0]),z=mn(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(Kg,{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:[q&&o.jsx(Zg,{nightVisionOn:E?.nightVisionOn,disabled:!a,onToggle:h,keyLabel:O}),C&&o.jsx(Fg,{disabled:!a||j,onStart:p,onStop:x,keyLabel:B,active:r?.active,heat:r?.heat}),N&&o.jsx(Jg,{value:k,min:M,max:A,onChange:d,keyDownLabel:z,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 A2({layout:a,onOpenHelpOverlay:l}){return o.jsx("section",{className:"panel text-base",children:o.jsxs(Vf,{defaultTab:"telemetry",children:[o.jsxs(Yf,{children:[o.jsx(ln,{id:"telemetry",children:"Controls"}),o.jsx(ln,{id:"help",children:"Help"}),o.jsx(ln,{id:"settings",children:"Settings"})]}),o.jsxs($f,{children:[o.jsx(sn,{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(b2,{}),o.jsx(S2,{})]}),o.jsxs("div",{className:"grid gap-0.5 grid-cols-[minmax(0,1fr)_minmax(0,0.9fr)_minmax(0,0.75fr)]",children:[o.jsx(to,{}),o.jsx(Cf,{panelId:"replay-sources-desktop",fillHeight:!0}),o.jsx(m2,{})]}),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(eo,{fillHeight:!0}),o.jsxs("div",{className:"grid min-h-0 gap-0.5 grid-rows-[minmax(0,1fr)_auto]",children:[o.jsx(Xr,{compact:!0,hideNicknameForm:!0,fillHeight:!0}),o.jsx(d2,{compact:!0})]})]}),o.jsx(ax,{}),o.jsx(kf,{defaultOrientation:"horizontal",panelId:"rightpane-telemetry"})]})}),o.jsx(sn,{id:"help",children:o.jsx(fx,{layout:a,onOpenOverlay:l})}),o.jsx(sn,{id:"settings",children:o.jsx(ox,{})})]})]})})}const j2=new Set(["admin","lockdown","lockdown-admin"]),N2=new Set(["lockdown","lockdown-admin"]),w2=new Set(["admin","lockdown"]);function C2(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 E2(){const{session:a}=ze(),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=w2.has(l),p=l==="lockdown"?N2.has(i):j2.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 S=C2(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:S.title}),o.jsx("p",{className:"text-sm text-slate-300",children:S.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(lx,{})}),o.jsx("div",{className:"w-full justify-center items-center",children:o.jsx(Bf,{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(eo,{}),o.jsx(Gf,{})]})]})})}const q2="/assets/turn_alert-DVO8EZJa.mp3";function M2(a){const l=m.useRef(null);return m.useEffect(()=>{l.current=new Audio(a),l.current.load()},[a]),()=>{l.current&&(l.current.currentTime=0,l.current.play().catch(()=>{}))}}function R2(){const{session:a,pushAlert:l}=ze(),i=M2(q2),r=m.useRef(new Set),f=m.useMemo(()=>a?.turnQueues||{},[a?.turnQueues]),d=a?.socketId||null;return m.useEffect(()=>{if(!d)return;const h=[];Object.entries(f).forEach(([p,x])=>{!x||!x.current||x.current!==d||r.current.has(p)||(h.push(p),r.current.add(p))}),Object.keys(f).forEach(p=>{(!f[p]||f[p].current!==d)&&r.current.delete(p)}),h.length!==0&&(h.forEach(p=>{const x=a?.roster?.find(v=>String(v.id)===String(p))?.name||p;l({title:"Your turn!",message:`You now control ${x}.`,color:"#ff5722"})}),i())},[f,i,l,a?.roster,d]),null}function T2({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 mx="fullscreenPromptDismissed",k2=new Set(["mobile-portrait","mobile-landscape"]),hx=()=>{if(typeof window>"u")return null;try{return window.sessionStorage}catch{return null}},_2=()=>{const a=hx();if(!a)return!1;try{return a.getItem(mx)==="1"}catch{return!1}},$p=()=>{const a=hx();if(a)try{a.setItem(mx,"1")}catch{}},D2=()=>{if(typeof navigator>"u")return!1;const a=navigator.userAgent||navigator.platform||"";return/iphone|ipad|ipod/i.test(a)},O2=()=>{if(typeof document>"u")return!1;const a=document;return!!(a.fullscreenEnabled||a.webkitFullscreenEnabled||a.mozFullScreenEnabled||a.msFullscreenEnabled)};function B2(a){const l=k2.has(a),[i,r]=m.useState(!1),[f,d]=m.useState("native"),h=m.useMemo(()=>D2(),[]),p=m.useCallback(()=>{if(!l){r(!1);return}if(_2()){r(!1);return}if(h){d("pwa-hint"),r(!0);return}if(!O2()){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(()=>{$p(),r(!1)},[]),v=m.useCallback(async()=>{if(!l||h||typeof document>"u")return!1;const y=document.documentElement;if(!y)return!1;const S=y.requestFullscreen||y.webkitRequestFullscreen||y.mozRequestFullScreen||y.msRequestFullscreen;if(!S)return!1;try{const N=S.call(y);return N&&typeof N.then=="function"&&await N,$p(),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 z2({visible:a,layout:l,onClose:i,showOnLoad:r,onToggleShowOnLoad:f}){if(!a)return null;const{state:d}=Rt(),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(ux,{layout:l,keymap:d?.keymap||{}})})]})})}const L2=`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 U2(a){return a?a.charAt(0).toUpperCase()+a.slice(1):""}function H2(){const a=String(L2).split(/\r?\n/).map(i=>i.trim()).filter(Boolean);return a.length?(a[Math.floor(Math.random()*a.length)]||"").trim():""}function Xf(){const{setNickname:a}=ze(),{value:l,status:i,save:r}=xt("profile",{nickname:""}),f=m.useRef(!1);m.useEffect(()=>{if(i!=="ready"||f.current||(l.nickname||"").trim())return;f.current=!0;const h=U2(H2()).slice(0,32);if(!h)return;(async()=>{try{await a(h)}catch{}finally{r({nickname:h})}})()},[r,a,i,l.nickname])}const Xu=1e4,Qu=28,V2=14;function Qr({layout:a="desktop",className:l="",dismissable:i=!0}){const{session:r}=ze(),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(Qu),[y,S]=m.useState(0),N=m.useRef(null),q=m.useRef(null),E=m.useRef(null);m.useEffect(()=>{if(!f){p(!1);return}if(p(!0),!d||!i)return;const A=Date.now();S(Xu);const k=setTimeout(()=>p(!1),Xu),O=setInterval(()=>{const B=Date.now()-A;S(Math.max(0,Xu-B))},250);return()=>{clearTimeout(k),clearInterval(O)}},[f,d]),m.useEffect(()=>{if(!f)return;v(Qu);let A=0;const k=()=>{const B=E.current,Z=q.current;if(!B||!Z)return;const z=B.clientWidth;if(!z)return;const X=Z.scrollWidth;if(!X)return;const $=Math.min(1,z/X),Q=Math.max(V2,Math.floor(Qu*$));v(Q)};A=window.requestAnimationFrame(k);const O=new ResizeObserver(()=>{window.cancelAnimationFrame(A),A=window.requestAnimationFrame(k)});return N.current&&O.observe(N.current),()=>{window.cancelAnimationFrame(A),O.disconnect()}},[f]);const C=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,M=i?{onClick:()=>p(!1),role:"button",tabIndex:0}:{};return o.jsx("div",{ref:N,className:C,style:{fontSize:`${x}px`,lineHeight:1.1},...M,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:E,className:"flex-1 overflow-hidden text-slate-100",children:o.jsx("span",{ref:q,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 Y2(){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 $2({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(zf,{}),o.jsx(gS,{}),o.jsx(_f,{})]}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5 overflow-y-auto",children:[o.jsx(Qr,{layout:a}),o.jsx(A2,{layout:a,onOpenHelpOverlay:l})]})]})}function px({layout:a,onOpenHelpOverlay:l,roomPanelId:i,showTelemetry:r=!0}){return o.jsx("section",{className:"panel text-base",children:o.jsxs(Vf,{defaultTab:"chat",children:[o.jsxs(Yf,{children:[o.jsx(ln,{id:"chat",children:"Chat"}),o.jsx(ln,{id:"roomcontrols",children:"Room Controls"}),o.jsx(ln,{id:"help",children:"Help"}),o.jsx(ln,{id:"settings",children:"Settings"})]}),o.jsxs($f,{children:[o.jsx(sn,{id:"chat",children:o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(eo,{}),o.jsx(Xr,{})]})}),o.jsx(sn,{id:"roomcontrols",children:o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(ax,{}),o.jsx(kf,{panelId:i})]})}),o.jsx(sn,{id:"help",children:o.jsx(fx,{layout:a,onOpenOverlay:l})}),o.jsx(sn,{id:"settings",children:o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(ox,{}),o.jsx(_f,{})]})})]})]})})}function G2({onOpenHelpOverlay:a}){return o.jsxs("div",{className:"flex flex-col gap-0.5",children:[o.jsx(zf,{layoutFormat:"mobile-portrait"}),o.jsx(YA,{}),o.jsxs("div",{className:"grid gap-0.5 grid-cols-[minmax(0,1fr)_minmax(0,1.4fr)]",children:[o.jsx(Cf,{panelId:"replay-sources-mobile-portrait"}),o.jsx(to,{})]}),o.jsx(px,{layout:"mobile-portrait",onOpenHelpOverlay:a,roomPanelId:"mobile-portrait-room"})]})}function X2({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(Ig,{layout:"landscape",className:l}),o.jsxs("div",{children:[o.jsx(zf,{layoutFormat:"mobile-landscape"}),o.jsxs("div",{className:"grid gap-0.5 grid-cols-[minmax(0,1fr)_minmax(0,1.4fr)]",children:[o.jsx(Cf,{panelId:"replay-sources-mobile-landscape"}),o.jsx(to,{})]})]}),o.jsx(Wg,{layout:"landscape",className:l})]}),o.jsx("div",{className:"flex flex-col gap-0.5 pb-0",children:o.jsx(px,{layout:"mobile-landscape",onOpenHelpOverlay:a,roomPanelId:"mobile-landscape-room",showTelemetry:!1})})]})}function Q2(){const a=Y2(),l=a==="desktop",i=B2(a);return o.jsx("div",{className:`bg-black text-slate-100 ${l?"h-screen overflow-hidden":"min-h-screen"}`,children:o.jsx(wf,{children:o.jsx(K2,{layout:a,isDesktop:l,fullscreen:i})})})}function K2({layout:a,isDesktop:l,fullscreen:i}){Xf();const{visible:r,mode:f,enterFullscreen:d,dismiss:h}=i,{value:p,status:x,save:v}=xt("help",{showOnLoad:!0}),[y,S]=m.useState(!1);m.useEffect(()=>{x==="ready"&&S(p?.showOnLoad!==!1)},[x,p?.showOnLoad]);const N=m.useCallback(()=>S(!0),[]),q=m.useCallback(()=>S(!1),[]),E=m.useCallback(j=>{const M=!!j;v(A=>({...A??{},showOnLoad:M})),M||S(!1)},[v]),C=m.useMemo(()=>l?o.jsx($2,{layout:a,onOpenHelpOverlay:N}):a==="mobile-landscape"?o.jsx(X2,{onOpenHelpOverlay:N}):o.jsx(G2,{onOpenHelpOverlay:N}),[l,a,N]);return o.jsxs(sA,{children:[o.jsx(gA,{}),o.jsx(kA,{}),o.jsxs("main",{className:`flex w-full flex-col gap-0.5 text-base ${l?"h-full overflow-hidden":""}`,children:[l?null:o.jsx(Qr,{layout:a}),C]}),o.jsx(Ef,{}),o.jsx(R2,{}),o.jsx(E2,{}),o.jsx(z2,{visible:y,layout:a,onClose:q,showOnLoad:p?.showOnLoad!==!1,onToggleShowOnLoad:E}),o.jsx(T2,{visible:r,mode:f,onEnterFullscreen:d,onDismiss:h})]})}function gx(){const{session:a,setRole:l,subscribeAll:i,connected:r}=ze(),[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 Z2(){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 F2({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 J2({rover:a,frame:l,sessionInfo:i,videoMode:r,snapshotFeed:f,audioInfo:d,session:h}){const p=F2({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(ni,{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 I2({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(J2,{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 W2(){return o.jsx("section",{className:"min-h-0",children:o.jsx("div",{className:"surface min-h-[14rem] overflow-hidden",children:o.jsx(kf,{defaultOrientation:"horizontal",hideLayoutToggle:!0,hideHeader:!0,panelId:"spectator-secondary"})})})}function P2({className:a=""}){return o.jsx("div",{className:`panel ${a}`,children:o.jsx(_f,{})})}function eN(){const{session:a}=ze(),l=a?.mode==="lockdown",i=!!a?.isLocalNetwork;Xf(),gx();const r=Z2(),f=Nf(),d=a?.roster??[],h=Df(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=ei(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=ei(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 S=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",q=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",E="",C=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:S,children:[o.jsxs("section",{className:q,children:[r?o.jsxs("div",{className:`${E} ${C} flex flex-col gap-0.5`,children:[o.jsx(Qr,{layout:"desktop",dismissable:!1,className:"text-sm"}),o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(Xr,{hideNicknameForm:!0,hideHeader:!0,compact:!0,fillHeight:!0,className:"h-full"})})]}):o.jsx("div",{className:E,children:o.jsx(Qr,{layout:"desktop",dismissable:!1,className:"text-sm"})}),o.jsx("div",{className:`${E} ${r?`${C} overflow-y-auto`:""}`,children:o.jsx("div",{className:"panel h-full",children:o.jsx(to,{title:"Rovers"})})}),r?null:o.jsx("div",{className:`${E} flex-1 min-h-0`,children:o.jsx(Xr,{hideNicknameForm:!0,hideHeader:!0,compact:!0,fillHeight:!0,className:"h-full"})}),o.jsx("div",{className:`${E} ${r?C:"flex-[1.1] min-h-0"}`,children:o.jsx(eo,{allowSpectatorInput:!0,hideSpectatorNotice:!0,fillHeight:!0})}),o.jsx("div",{className:`${E} ${r?C:""}`,children:o.jsx(P2,{className:`${r?"h-full":"h-40"} overflow-hidden`})})]}),o.jsxs("section",{className:N,children:[o.jsx(I2,{roster:d,frames:f,videoSources:x,snapshotFeeds:h,audioSources:y,session:a,canSpectateVideo:i}),o.jsx(W2,{})]})]}),o.jsx(Ef,{})]})}function tN(){return o.jsx(wf,{children:o.jsx(eN,{})})}const nN=2e4,aN=3600*1e3;function lN({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 sN({rover:a,frame:l}){const i=l?.sensors?.batteryChargeMah??null,r=a?.battery??null;return nx({batteryState:a?.batteryState??null,charge:i,config:r})}function Gp({rover:a,frame:l,driverLabel:i,sessionInfo:r,videoMode:f="snapshot",snapshotFeed:d,withDivider:h=!1,showPreview:p=!0,variant:x="stacked"}){const v=sN({rover:a,frame:l}),y=v?.available?v.percentDisplay:null,S=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(uf,{visual:v,orientation:S?"vertical":"horizontal",variant:"background"}),S?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(Ol,{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(Ol,{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(Ol,{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(Ol,{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(Ol,{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(Ol,{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(ni,{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 Ol({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 S=()=>{const E=x.clientWidth;if(!E){N();return}let C=r,j=i,M=r;for(;C<=j;){const A=Math.floor((C+j)/2);v.style.fontSize=`${A}px`,v.scrollWidth<=E?(M=A,C=A+1):j=A-1}p(M)},N=()=>{y&&cancelAnimationFrame(y),y=requestAnimationFrame(S)};N();const q=new ResizeObserver(N);return q.observe(x),()=>{y&&cancelAnimationFrame(y),q.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 iN(){const{session:a}=ze(),l=gx();Xf();const i=a?.mode==="lockdown",r=!!a?.isLocalNetwork,f=Nf(),d=a?.roster??[],[h,p]=m.useState(0),x=a?.activeDrivers||{},v=m.useMemo(()=>d.filter(Q=>x[Q.id]),[d,x]),y=v.length?v:d,S=Df(y.map(Q=>Q.id),{enabled:!i&&!r,version:a?.mode}),N=m.useMemo(()=>r?y.map(Q=>({type:"rover",id:Q.id,key:Q.id})):[],[r,y]),q=ei(N,{enabled:!i&&r,version:a?.mode}),E=m.useMemo(()=>v.flatMap(Q=>{if(!Q?.id||!Q.media?.audioPublishUrl)return[];const L=String(Q.id);return[{type:"rover",id:`${L}-audio`,key:`${L}-audio`}]}),[v]),C=ei(E,{enabled:!i,version:a?.mode}),j=m.useMemo(()=>{if(!v.length)return[];if(!r){const L=v.filter(K=>S[K.id]?.objectUrl);return L.length?L:v}const Q=v.filter(L=>{const K=q[L.id];return K?.url&&!K?.error});return Q.length?Q:v},[v,S,q,r]),M=m.useMemo(()=>j.map(Q=>({type:"rover",rover:Q})),[j]),A=m.useMemo(()=>M.map(Q=>`r:${Q.rover.id}`).join("|"),[M]);m.useEffect(()=>{p(0)},[A]),m.useEffect(()=>{if(!M.length)return;const Q=setInterval(()=>{p(L=>(L+1)%M.length)},nN);return()=>clearInterval(Q)},[M.length,A]);const k=M.length?M[h%M.length]:null,O=k?.type==="rover"?k.rover:null,B=!r&&O&&S[O.id]||null,Z=r&&O&&q[O.id]||null,z=O&&C[`${O.id}-audio`]||null,X=O&&f[O.id]||null,$=O?lN({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(oN,{children:r?o.jsx("div",{className:"relative h-full w-full",children:M.map(Q=>{const L=Q.rover,K=O?.id===L.id;return o.jsx("div",{className:`absolute inset-0 ${K?"opacity-100":"opacity-0 pointer-events-none"}`,children:o.jsx(ni,{sessionInfo:q[L.id]||null,videoMode:"whep",snapshotFeed:null,audioSessionInfo:K?z:null,forceMute:!K,label:L.name||L.id,telemetryFrame:f[L.id]||null,batteryConfig:L.battery,layoutFormat:"mobile",hudVariant:"none",fitParent:!0})},L.id)})}):o.jsx(ni,{sessionInfo:null,videoMode:"snapshot",snapshotFeed:B,audioSessionInfo:z,label:O.name||O.id,telemetryFrame:X,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(Gp,{rover:O,frame:X,driverLabel:$,sessionInfo:r?Z:null,videoMode:r?"whep":"snapshot",snapshotFeed:r?null:S[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((Q,L)=>o.jsx(Gp,{rover:Q,frame:f[Q.id]||null,driverLabel:null,sessionInfo:r&&q[Q.id]||null,videoMode:r?"whep":"snapshot",snapshotFeed:r?null:S[Q.id]||null,showPreview:!0,withDivider:!1},Q.id)):o.jsx("div",{className:"flex h-full w-full items-center justify-center text-sm text-slate-500",children:"No rovers available."})})})}function rN(){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())},aN);return()=>clearTimeout(a)},[]),o.jsx(wf,{children:o.jsxs(o.Fragment,{children:[o.jsx(iN,{}),o.jsx(Ef,{scale:3})]})})}function oN({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})})})}Hy.createRoot(document.getElementById("root")).render(o.jsx(m.StrictMode,{children:o.jsx(cS,{children:o.jsx(fS,{children:o.jsx(dS,{children:o.jsx(rA,{children:o.jsx(t1,{children:o.jsxs(kb,{children:[o.jsx(Rr,{path:"/",element:o.jsx(Q2,{})}),o.jsx(Rr,{path:"/spectate",element:o.jsx(tN,{})}),o.jsx(Rr,{path:"/mini",element:o.jsx(rN,{})})]})})})})})})}));
|