mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 01:21:20 -04:00
120 lines
478 KiB
JavaScript
120 lines
478 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 wy(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var pu={exports:{}},Os={};var Lp;function Cy(){if(Lp)return Os;Lp=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 g in f)g!=="key"&&(d[g]=f[g])}else d=f;return f=d.ref,{$$typeof:a,type:r,key:h,ref:f!==void 0?f:null,props:d}}return Os.Fragment=l,Os.jsx=i,Os.jsxs=i,Os}var Up;function Ey(){return Up||(Up=1,pu.exports=Cy()),pu.exports}var o=Ey(),gu={exports:{}},ye={};var Hp;function qy(){if(Hp)return ye;Hp=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"),g=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"),w=Symbol.iterator;function M(E){return E===null||typeof E!="object"?null:(E=w&&E[w]||E["@@iterator"],typeof E=="function"?E:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,j={};function q(E,Y,te){this.props=E,this.context=Y,this.refs=j,this.updater=te||C}q.prototype.isReactComponent={},q.prototype.setState=function(E,Y){if(typeof E!="object"&&typeof E!="function"&&E!=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,E,Y,"setState")},q.prototype.forceUpdate=function(E){this.updater.enqueueForceUpdate(this,E,"forceUpdate")};function A(){}A.prototype=q.prototype;function k(E,Y,te){this.props=E,this.context=Y,this.refs=j,this.updater=te||C}var B=k.prototype=new A;B.constructor=k,N(B,q.prototype),B.isPureReactComponent=!0;var L=Array.isArray;function Z(){}var O={H:null,A:null,T:null,S:null},X=Object.prototype.hasOwnProperty;function $(E,Y,te){var le=te.ref;return{$$typeof:a,type:E,key:Y,ref:le!==void 0?le:null,props:te}}function Q(E,Y){return $(E.type,Y,E.props)}function z(E){return typeof E=="object"&&E!==null&&E.$$typeof===a}function K(E){var Y={"=":"=0",":":"=2"};return"$"+E.replace(/[=:]/g,function(te){return Y[te]})}var ee=/\/+/g;function oe(E,Y){return typeof E=="object"&&E!==null&&E.key!=null?K(""+E.key):Y.toString(36)}function W(E){switch(E.status){case"fulfilled":return E.value;case"rejected":throw E.reason;default:switch(typeof E.status=="string"?E.then(Z,Z):(E.status="pending",E.then(function(Y){E.status==="pending"&&(E.status="fulfilled",E.value=Y)},function(Y){E.status==="pending"&&(E.status="rejected",E.reason=Y)})),E.status){case"fulfilled":return E.value;case"rejected":throw E.reason}}throw E}function R(E,Y,te,le,se){var ie=typeof E;(ie==="undefined"||ie==="boolean")&&(E=null);var ce=!1;if(E===null)ce=!0;else switch(ie){case"bigint":case"string":case"number":ce=!0;break;case"object":switch(E.$$typeof){case a:case l:ce=!0;break;case y:return ce=E._init,R(ce(E._payload),Y,te,le,se)}}if(ce)return se=se(E),ce=le===""?"."+oe(E,0):le,L(se)?(te="",ce!=null&&(te=ce.replace(ee,"$&/")+"/"),R(se,Y,te,"",function(je){return je})):se!=null&&(z(se)&&(se=Q(se,te+(se.key==null||E&&E.key===se.key?"":(""+se.key).replace(ee,"$&/")+"/")+ce)),Y.push(se)),1;ce=0;var xe=le===""?".":le+":";if(L(E))for(var pe=0;pe<E.length;pe++)le=E[pe],ie=xe+oe(le,pe),ce+=R(le,Y,te,ie,se);else if(pe=M(E),typeof pe=="function")for(E=pe.call(E),pe=0;!(le=E.next()).done;)le=le.value,ie=xe+oe(le,pe++),ce+=R(le,Y,te,ie,se);else if(ie==="object"){if(typeof E.then=="function")return R(W(E),Y,te,le,se);throw Y=String(E),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys(E).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.")}return ce}function F(E,Y,te){if(E==null)return E;var le=[],se=0;return R(E,le,"","",function(ie){return Y.call(te,ie,se++)}),le}function ne(E){if(E._status===-1){var Y=E._result;Y=Y(),Y.then(function(te){(E._status===0||E._status===-1)&&(E._status=1,E._result=te)},function(te){(E._status===0||E._status===-1)&&(E._status=2,E._result=te)}),E._status===-1&&(E._status=0,E._result=Y)}if(E._status===1)return E._result.default;throw E._result}var ue=typeof reportError=="function"?reportError:function(E){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Y=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(Y))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",E);return}console.error(E)},he={map:F,forEach:function(E,Y,te){F(E,function(){Y.apply(this,arguments)},te)},count:function(E){var Y=0;return F(E,function(){Y++}),Y},toArray:function(E){return F(E,function(Y){return Y})||[]},only:function(E){if(!z(E))throw Error("React.Children.only expected to receive a single React element child.");return E}};return ye.Activity=S,ye.Children=he,ye.Component=q,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=O,ye.__COMPILER_RUNTIME={__proto__:null,c:function(E){return O.H.useMemoCache(E)}},ye.cache=function(E){return function(){return E.apply(null,arguments)}},ye.cacheSignal=function(){return null},ye.cloneElement=function(E,Y,te){if(E==null)throw Error("The argument must be a React element, but you passed "+E+".");var le=N({},E.props),se=E.key;if(Y!=null)for(ie in Y.key!==void 0&&(se=""+Y.key),Y)!X.call(Y,ie)||ie==="key"||ie==="__self"||ie==="__source"||ie==="ref"&&Y.ref===void 0||(le[ie]=Y[ie]);var ie=arguments.length-2;if(ie===1)le.children=te;else if(1<ie){for(var ce=Array(ie),xe=0;xe<ie;xe++)ce[xe]=arguments[xe+2];le.children=ce}return $(E.type,se,le)},ye.createContext=function(E){return E={$$typeof:h,_currentValue:E,_currentValue2:E,_threadCount:0,Provider:null,Consumer:null},E.Provider=E,E.Consumer={$$typeof:d,_context:E},E},ye.createElement=function(E,Y,te){var le,se={},ie=null;if(Y!=null)for(le in Y.key!==void 0&&(ie=""+Y.key),Y)X.call(Y,le)&&le!=="key"&&le!=="__self"&&le!=="__source"&&(se[le]=Y[le]);var ce=arguments.length-2;if(ce===1)se.children=te;else if(1<ce){for(var xe=Array(ce),pe=0;pe<ce;pe++)xe[pe]=arguments[pe+2];se.children=xe}if(E&&E.defaultProps)for(le in ce=E.defaultProps,ce)se[le]===void 0&&(se[le]=ce[le]);return $(E,ie,se)},ye.createRef=function(){return{current:null}},ye.forwardRef=function(E){return{$$typeof:g,render:E}},ye.isValidElement=z,ye.lazy=function(E){return{$$typeof:y,_payload:{_status:-1,_result:E},_init:ne}},ye.memo=function(E,Y){return{$$typeof:v,type:E,compare:Y===void 0?null:Y}},ye.startTransition=function(E){var Y=O.T,te={};O.T=te;try{var le=E(),se=O.S;se!==null&&se(te,le),typeof le=="object"&&le!==null&&typeof le.then=="function"&&le.then(Z,ue)}catch(ie){ue(ie)}finally{Y!==null&&te.types!==null&&(Y.types=te.types),O.T=Y}},ye.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()},ye.use=function(E){return O.H.use(E)},ye.useActionState=function(E,Y,te){return O.H.useActionState(E,Y,te)},ye.useCallback=function(E,Y){return O.H.useCallback(E,Y)},ye.useContext=function(E){return O.H.useContext(E)},ye.useDebugValue=function(){},ye.useDeferredValue=function(E,Y){return O.H.useDeferredValue(E,Y)},ye.useEffect=function(E,Y){return O.H.useEffect(E,Y)},ye.useEffectEvent=function(E){return O.H.useEffectEvent(E)},ye.useId=function(){return O.H.useId()},ye.useImperativeHandle=function(E,Y,te){return O.H.useImperativeHandle(E,Y,te)},ye.useInsertionEffect=function(E,Y){return O.H.useInsertionEffect(E,Y)},ye.useLayoutEffect=function(E,Y){return O.H.useLayoutEffect(E,Y)},ye.useMemo=function(E,Y){return O.H.useMemo(E,Y)},ye.useOptimistic=function(E,Y){return O.H.useOptimistic(E,Y)},ye.useReducer=function(E,Y,te){return O.H.useReducer(E,Y,te)},ye.useRef=function(E){return O.H.useRef(E)},ye.useState=function(E){return O.H.useState(E)},ye.useSyncExternalStore=function(E,Y,te){return O.H.useSyncExternalStore(E,Y,te)},ye.useTransition=function(){return O.H.useTransition()},ye.version="19.2.0",ye}var Vp;function cf(){return Vp||(Vp=1,gu.exports=qy()),gu.exports}var m=cf();const Va=wy(m);var xu={exports:{}},Bs={},vu={exports:{}},yu={};var Yp;function My(){return Yp||(Yp=1,(function(a){function l(R,F){var ne=R.length;R.push(F);e:for(;0<ne;){var ue=ne-1>>>1,he=R[ue];if(0<f(he,F))R[ue]=F,R[ne]=he,ne=ue;else break e}}function i(R){return R.length===0?null:R[0]}function r(R){if(R.length===0)return null;var F=R[0],ne=R.pop();if(ne!==F){R[0]=ne;e:for(var ue=0,he=R.length,E=he>>>1;ue<E;){var Y=2*(ue+1)-1,te=R[Y],le=Y+1,se=R[le];if(0>f(te,ne))le<he&&0>f(se,te)?(R[ue]=se,R[le]=ne,ue=le):(R[ue]=te,R[Y]=ne,ue=Y);else if(le<he&&0>f(se,ne))R[ue]=se,R[le]=ne,ue=le;else break e}}return F}function f(R,F){var ne=R.sortIndex-F.sortIndex;return ne!==0?ne:R.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,g=h.now();a.unstable_now=function(){return h.now()-g}}var x=[],v=[],y=1,S=null,w=3,M=!1,C=!1,N=!1,j=!1,q=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function B(R){for(var F=i(v);F!==null;){if(F.callback===null)r(v);else if(F.startTime<=R)r(v),F.sortIndex=F.expirationTime,l(x,F);else break;F=i(v)}}function L(R){if(N=!1,B(R),!C)if(i(x)!==null)C=!0,Z||(Z=!0,K());else{var F=i(v);F!==null&&W(L,F.startTime-R)}}var Z=!1,O=-1,X=5,$=-1;function Q(){return j?!0:!(a.unstable_now()-$<X)}function z(){if(j=!1,Z){var R=a.unstable_now();$=R;var F=!0;try{e:{C=!1,N&&(N=!1,A(O),O=-1),M=!0;var ne=w;try{t:{for(B(R),S=i(x);S!==null&&!(S.expirationTime>R&&Q());){var ue=S.callback;if(typeof ue=="function"){S.callback=null,w=S.priorityLevel;var he=ue(S.expirationTime<=R);if(R=a.unstable_now(),typeof he=="function"){S.callback=he,B(R),F=!0;break t}S===i(x)&&r(x),B(R)}else r(x);S=i(x)}if(S!==null)F=!0;else{var E=i(v);E!==null&&W(L,E.startTime-R),F=!1}}break e}finally{S=null,w=ne,M=!1}F=void 0}}finally{F?K():Z=!1}}}var K;if(typeof k=="function")K=function(){k(z)};else if(typeof MessageChannel<"u"){var ee=new MessageChannel,oe=ee.port2;ee.port1.onmessage=z,K=function(){oe.postMessage(null)}}else K=function(){q(z,0)};function W(R,F){O=q(function(){R(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(R){R.callback=null},a.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):X=0<R?Math.floor(1e3/R):5},a.unstable_getCurrentPriorityLevel=function(){return w},a.unstable_next=function(R){switch(w){case 1:case 2:case 3:var F=3;break;default:F=w}var ne=w;w=F;try{return R()}finally{w=ne}},a.unstable_requestPaint=function(){j=!0},a.unstable_runWithPriority=function(R,F){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var ne=w;w=R;try{return F()}finally{w=ne}},a.unstable_scheduleCallback=function(R,F,ne){var ue=a.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0<ne?ue+ne:ue):ne=ue,R){case 1:var he=-1;break;case 2:he=250;break;case 5:he=1073741823;break;case 4:he=1e4;break;default:he=5e3}return he=ne+he,R={id:y++,callback:F,priorityLevel:R,startTime:ne,expirationTime:he,sortIndex:-1},ne>ue?(R.sortIndex=ne,l(v,R),i(x)===null&&R===i(v)&&(N?(A(O),O=-1):N=!0,W(L,ne-ue))):(R.sortIndex=he,l(x,R),C||M||(C=!0,Z||(Z=!0,K()))),R},a.unstable_shouldYield=Q,a.unstable_wrapCallback=function(R){var F=w;return function(){var ne=w;w=F;try{return R.apply(this,arguments)}finally{w=ne}}}})(yu)),yu}var $p;function Ty(){return $p||($p=1,vu.exports=My()),vu.exports}var bu={exports:{}},yt={};var Gp;function Ry(){if(Gp)return yt;Gp=1;var a=cf();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 g(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=g(y,v.crossOrigin),w=typeof v.integrity=="string"?v.integrity:void 0,M=typeof v.fetchPriority=="string"?v.fetchPriority:void 0;y==="style"?r.d.S(x,typeof v.precedence=="string"?v.precedence:void 0,{crossOrigin:S,integrity:w,fetchPriority:M}):y==="script"&&r.d.X(x,{crossOrigin:S,integrity:w,fetchPriority:M,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=g(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=g(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=g(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 Xp;function ky(){if(Xp)return bu.exports;Xp=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(l){console.error(l)}}return a(),bu.exports=Ry(),bu.exports}var Qp;function _y(){if(Qp)return Bs;Qp=1;var a=Ty(),l=cf(),i=ky();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 g(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 p=!1,b=c.child;b;){if(b===n){p=!0,n=c,s=u;break}if(b===s){p=!0,s=c,n=u;break}b=b.sibling}if(!p){for(b=u.child;b;){if(b===n){p=!0,n=u,s=c;break}if(b===s){p=!0,s=u,n=c;break}b=b.sibling}if(!p)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,w=Symbol.for("react.element"),M=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),N=Symbol.for("react.fragment"),j=Symbol.for("react.strict_mode"),q=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),k=Symbol.for("react.context"),B=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),Z=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),X=Symbol.for("react.lazy"),$=Symbol.for("react.activity"),Q=Symbol.for("react.memo_cache_sentinel"),z=Symbol.iterator;function K(e){return e===null||typeof e!="object"?null:(e=z&&e[z]||e["@@iterator"],typeof e=="function"?e:null)}var ee=Symbol.for("react.client.reference");function oe(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ee?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case N:return"Fragment";case q:return"Profiler";case j:return"StrictMode";case L:return"Suspense";case Z:return"SuspenseList";case $:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case C:return"Portal";case k:return e.displayName||"Context";case A:return(e._context.displayName||"Context")+".Consumer";case B:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case O:return t=e.displayName||null,t!==null?t:oe(e.type)||"Memo";case X:t=e._payload,e=e._init;try{return oe(e(t))}catch{}}return null}var W=Array.isArray,R=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},ue=[],he=-1;function E(e){return{current:e}}function Y(e){0>he||(e.current=ue[he],ue[he]=null,he--)}function te(e,t){he++,ue[he]=e.current,e.current=t}var le=E(null),se=E(null),ie=E(null),ce=E(null);function xe(e,t){switch(te(ie,t),te(se,e),te(le,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?rp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=rp(t),e=op(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Y(le),te(le,e)}function pe(){Y(le),Y(se),Y(ie)}function je(e){e.memoizedState!==null&&te(ce,e);var t=le.current,n=op(t,e.type);t!==n&&(te(se,e),te(le,n))}function ae(e){se.current===e&&(Y(le),Y(se)),ce.current===e&&(Y(ce),Rs._currentValue=ne)}var re,Se;function Re(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 qe=!1;function Ye(e,t){if(!e||qe)return"";qe=!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 V=G}Reflect.construct(e,[],P)}else{try{P.call()}catch(G){V=G}e.call(P.prototype)}}else{try{throw Error()}catch(G){V=G}(P=e())&&typeof P.catch=="function"&&P.catch(function(){})}}catch(G){if(G&&V&&typeof G.stack=="string")return[G.stack,V.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(),p=u[0],b=u[1];if(p&&b){var T=p.split(`
|
||
`),H=b.split(`
|
||
`);for(c=s=0;s<T.length&&!T[s].includes("DetermineComponentFrameRoot");)s++;for(;c<H.length&&!H[c].includes("DetermineComponentFrameRoot");)c++;if(s===T.length||c===H.length)for(s=T.length-1,c=H.length-1;1<=s&&0<=c&&T[s]!==H[c];)c--;for(;1<=s&&0<=c;s--,c--)if(T[s]!==H[c]){if(s!==1||c!==1)do if(s--,c--,0>c||T[s]!==H[c]){var J=`
|
||
`+T[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{qe=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Re(n):""}function vt(e,t){switch(e.tag){case 26:case 27:case 5:return Re(e.type);case 16:return Re("Lazy");case 13:return e.child!==t&&t!==null?Re("Suspense Fallback"):Re("Suspense");case 19:return Re("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 Re("Activity");default:return""}}function Vn(e){try{var t="",n=null;do t+=vt(e,n),n=e,e=e.return;while(e);return t}catch(s){return`
|
||
Error generating stack: `+s.message+`
|
||
`+s.stack}}var pn=Object.prototype.hasOwnProperty,Jt=a.unstable_scheduleCallback,Tt=a.unstable_cancelCallback,ha=a.unstable_shouldYield,$a=a.unstable_requestPaint,ft=a.unstable_now,pa=a.unstable_getCurrentPriorityLevel,Ga=a.unstable_ImmediatePriority,ga=a.unstable_UserBlockingPriority,xa=a.unstable_NormalPriority,eo=a.unstable_LowPriority,li=a.unstable_IdlePriority,to=a.log,si=a.unstable_setDisableYieldValue,bt=null,ve=null;function Ze(e){if(typeof to=="function"&&si(e),ve&&typeof ve.setStrictMode=="function")try{ve.setStrictMode(bt,e)}catch{}}var $e=Math.clz32?Math.clz32:Xe,Ge=Math.log,nt=Math.LN2;function Xe(e){return e>>>=0,e===0?32:31-(Ge(e)/nt|0)|0}var Xa=256,ii=262144,ri=4194304;function va(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 oi(e,t,n){var s=e.pendingLanes;if(s===0)return 0;var c=0,u=e.suspendedLanes,p=e.pingedLanes;e=e.warmLanes;var b=s&134217727;return b!==0?(s=b&~u,s!==0?c=va(s):(p&=b,p!==0?c=va(p):n||(n=b&~e,n!==0&&(c=va(n))))):(b=s&~u,b!==0?c=va(b):p!==0?c=va(p):n||(n=s&~e,n!==0&&(c=va(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 Gl(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function dx(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 Yf(){var e=ri;return ri<<=1,(ri&62914560)===0&&(ri=4194304),e}function no(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Xl(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function mx(e,t,n,s,c,u){var p=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,T=e.expirationTimes,H=e.hiddenUpdates;for(n=p&~n;0<n;){var J=31-$e(n),P=1<<J;b[J]=0,T[J]=-1;var V=H[J];if(V!==null)for(H[J]=null,J=0;J<V.length;J++){var G=V[J];G!==null&&(G.lane&=-536870913)}n&=~P}s!==0&&$f(e,s,0),u!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=u&~(p&~t))}function $f(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-$e(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|n&261930}function Gf(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var s=31-$e(n),c=1<<s;c&t|e[s]&t&&(e[s]|=t),n&=~c}}function Xf(e,t){var n=t&-t;return n=(n&42)!==0?1:ao(n),(n&(e.suspendedLanes|t))!==0?0:n}function ao(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 lo(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Qf(){var e=F.p;return e!==0?e:(e=window.event,e===void 0?32:Rp(e.type))}function Kf(e,t){var n=F.p;try{return F.p=e,t()}finally{F.p=n}}var Yn=Math.random().toString(36).slice(2),dt="__reactFiber$"+Yn,At="__reactProps$"+Yn,Qa="__reactContainer$"+Yn,so="__reactEvents$"+Yn,hx="__reactListeners$"+Yn,px="__reactHandles$"+Yn,Zf="__reactResources$"+Yn,Ql="__reactMarker$"+Yn;function io(e){delete e[dt],delete e[At],delete e[so],delete e[hx],delete e[px]}function Ka(e){var t=e[dt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Qa]||n[dt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=pp(e);e!==null;){if(n=e[dt])return n;e=pp(e)}return t}e=n,n=e.parentNode}return null}function Za(e){if(e=e[dt]||e[Qa]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Kl(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(r(33))}function Fa(e){var t=e[Zf];return t||(t=e[Zf]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function ct(e){e[Ql]=!0}var Ff=new Set,Jf={};function ya(e,t){Ja(e,t),Ja(e+"Capture",t)}function Ja(e,t){for(Jf[e]=t,e=0;e<t.length;e++)Ff.add(t[e])}var gx=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]*$"),If={},Wf={};function xx(e){return pn.call(Wf,e)?!0:pn.call(If,e)?!1:gx.test(e)?Wf[e]=!0:(If[e]=!0,!1)}function ci(e,t,n){if(xx(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 ui(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 gn(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 Lt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Pf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function vx(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(p){n=""+p,u.call(this,p)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return n},setValue:function(p){n=""+p},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ro(e){if(!e._valueTracker){var t=Pf(e)?"checked":"value";e._valueTracker=vx(e,t,""+e[t])}}function ed(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=Pf(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}function fi(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 yx=/[\n"\\]/g;function Ut(e){return e.replace(yx,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function oo(e,t,n,s,c,u,p,b){e.name="",p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"?e.type=p:e.removeAttribute("type"),t!=null?p==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Lt(t)):e.value!==""+Lt(t)&&(e.value=""+Lt(t)):p!=="submit"&&p!=="reset"||e.removeAttribute("value"),t!=null?co(e,p,Lt(t)):n!=null?co(e,p,Lt(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=""+Lt(b):e.removeAttribute("name")}function td(e,t,n,s,c,u,p,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)){ro(e);return}n=n!=null?""+Lt(n):"",t=t!=null?""+Lt(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,p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.name=p),ro(e)}function co(e,t,n){t==="number"&&fi(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Ia(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=""+Lt(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 nd(e,t,n){if(t!=null&&(t=""+Lt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Lt(n):""}function ad(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=Lt(t),e.defaultValue=n,s=e.textContent,s===n&&s!==""&&s!==null&&(e.value=s),ro(e)}function Wa(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var bx=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 ld(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||bx.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function sd(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&&ld(e,c,s)}else for(var u in t)t.hasOwnProperty(u)&&ld(e,u,t[u])}function uo(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 Sx=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"]]),Ax=/^[\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 di(e){return Ax.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function xn(){}var fo=null;function mo(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Pa=null,el=null;function id(e){var t=Za(e);if(t&&(e=t.stateNode)){var n=e[At]||null;e:switch(e=t.stateNode,t.type){case"input":if(oo(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="'+Ut(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var s=n[t];if(s!==e&&s.form===e.form){var c=s[At]||null;if(!c)throw Error(r(90));oo(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&&ed(s)}break e;case"textarea":nd(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Ia(e,!!n.multiple,t,!1)}}}var ho=!1;function rd(e,t,n){if(ho)return e(t,n);ho=!0;try{var s=e(t);return s}finally{if(ho=!1,(Pa!==null||el!==null)&&(Pi(),Pa&&(t=Pa,e=el,el=Pa=null,id(t),e)))for(t=0;t<e.length;t++)id(e[t])}}function Zl(e,t){var n=e.stateNode;if(n===null)return null;var s=n[At]||null;if(s===null)return null;n=s[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(r(231,t,typeof n));return n}var vn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),po=!1;if(vn)try{var Fl={};Object.defineProperty(Fl,"passive",{get:function(){po=!0}}),window.addEventListener("test",Fl,Fl),window.removeEventListener("test",Fl,Fl)}catch{po=!1}var $n=null,go=null,mi=null;function od(){if(mi)return mi;var e,t=go,n=t.length,s,c="value"in $n?$n.value:$n.textContent,u=c.length;for(e=0;e<n&&t[e]===c[e];e++);var p=n-e;for(s=1;s<=p&&t[n-s]===c[u-s];s++);return mi=c.slice(e,1<s?1-s:void 0)}function hi(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 pi(){return!0}function cd(){return!1}function jt(e){function t(n,s,c,u,p){this._reactName=n,this._targetInst=c,this.type=s,this.nativeEvent=u,this.target=p,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)?pi:cd,this.isPropagationStopped=cd,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=pi)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=pi)},persist:function(){},isPersistent:pi}),t}var ba={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},gi=jt(ba),Jl=S({},ba,{view:0,detail:0}),jx=jt(Jl),xo,vo,Il,xi=S({},Jl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:bo,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Il&&(Il&&e.type==="mousemove"?(xo=e.screenX-Il.screenX,vo=e.screenY-Il.screenY):vo=xo=0,Il=e),xo)},movementY:function(e){return"movementY"in e?e.movementY:vo}}),ud=jt(xi),Nx=S({},xi,{dataTransfer:0}),wx=jt(Nx),Cx=S({},Jl,{relatedTarget:0}),yo=jt(Cx),Ex=S({},ba,{animationName:0,elapsedTime:0,pseudoElement:0}),qx=jt(Ex),Mx=S({},ba,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Tx=jt(Mx),Rx=S({},ba,{data:0}),fd=jt(Rx),kx={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},_x={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"},Dx={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ox(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Dx[e])?!!t[e]:!1}function bo(){return Ox}var Bx=S({},Jl,{key:function(e){if(e.key){var t=kx[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=hi(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?_x[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:bo,charCode:function(e){return e.type==="keypress"?hi(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?hi(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),zx=jt(Bx),Lx=S({},xi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),dd=jt(Lx),Ux=S({},Jl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:bo}),Hx=jt(Ux),Vx=S({},ba,{propertyName:0,elapsedTime:0,pseudoElement:0}),Yx=jt(Vx),$x=S({},xi,{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}),Gx=jt($x),Xx=S({},ba,{newState:0,oldState:0}),Qx=jt(Xx),Kx=[9,13,27,32],So=vn&&"CompositionEvent"in window,Wl=null;vn&&"documentMode"in document&&(Wl=document.documentMode);var Zx=vn&&"TextEvent"in window&&!Wl,md=vn&&(!So||Wl&&8<Wl&&11>=Wl),hd=" ",pd=!1;function gd(e,t){switch(e){case"keyup":return Kx.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function xd(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var tl=!1;function Fx(e,t){switch(e){case"compositionend":return xd(t);case"keypress":return t.which!==32?null:(pd=!0,hd);case"textInput":return e=t.data,e===hd&&pd?null:e;default:return null}}function Jx(e,t){if(tl)return e==="compositionend"||!So&&gd(e,t)?(e=od(),mi=go=$n=null,tl=!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 md&&t.locale!=="ko"?null:t.data;default:return null}}var Ix={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 vd(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Ix[e.type]:t==="textarea"}function yd(e,t,n,s){Pa?el?el.push(s):el=[s]:Pa=s,t=ir(t,"onChange"),0<t.length&&(n=new gi("onChange","change",null,n,s),e.push({event:n,listeners:t}))}var Pl=null,es=null;function Wx(e){tp(e,0)}function vi(e){var t=Kl(e);if(ed(t))return e}function bd(e,t){if(e==="change")return t}var Sd=!1;if(vn){var Ao;if(vn){var jo="oninput"in document;if(!jo){var Ad=document.createElement("div");Ad.setAttribute("oninput","return;"),jo=typeof Ad.oninput=="function"}Ao=jo}else Ao=!1;Sd=Ao&&(!document.documentMode||9<document.documentMode)}function jd(){Pl&&(Pl.detachEvent("onpropertychange",Nd),es=Pl=null)}function Nd(e){if(e.propertyName==="value"&&vi(es)){var t=[];yd(t,es,e,mo(e)),rd(Wx,t)}}function Px(e,t,n){e==="focusin"?(jd(),Pl=t,es=n,Pl.attachEvent("onpropertychange",Nd)):e==="focusout"&&jd()}function ev(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return vi(es)}function tv(e,t){if(e==="click")return vi(t)}function nv(e,t){if(e==="input"||e==="change")return vi(t)}function av(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Rt=typeof Object.is=="function"?Object.is:av;function ts(e,t){if(Rt(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(!pn.call(t,c)||!Rt(e[c],t[c]))return!1}return!0}function wd(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Cd(e,t){var n=wd(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=wd(n)}}function Ed(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ed(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function qd(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=fi(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=fi(e.document)}return t}function No(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 lv=vn&&"documentMode"in document&&11>=document.documentMode,nl=null,wo=null,ns=null,Co=!1;function Md(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Co||nl==null||nl!==fi(s)||(s=nl,"selectionStart"in s&&No(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}),ns&&ts(ns,s)||(ns=s,s=ir(wo,"onSelect"),0<s.length&&(t=new gi("onSelect","select",null,t,n),e.push({event:t,listeners:s}),t.target=nl)))}function Sa(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var al={animationend:Sa("Animation","AnimationEnd"),animationiteration:Sa("Animation","AnimationIteration"),animationstart:Sa("Animation","AnimationStart"),transitionrun:Sa("Transition","TransitionRun"),transitionstart:Sa("Transition","TransitionStart"),transitioncancel:Sa("Transition","TransitionCancel"),transitionend:Sa("Transition","TransitionEnd")},Eo={},Td={};vn&&(Td=document.createElement("div").style,"AnimationEvent"in window||(delete al.animationend.animation,delete al.animationiteration.animation,delete al.animationstart.animation),"TransitionEvent"in window||delete al.transitionend.transition);function Aa(e){if(Eo[e])return Eo[e];if(!al[e])return e;var t=al[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Td)return Eo[e]=t[n];return e}var Rd=Aa("animationend"),kd=Aa("animationiteration"),_d=Aa("animationstart"),sv=Aa("transitionrun"),iv=Aa("transitionstart"),rv=Aa("transitioncancel"),Dd=Aa("transitionend"),Od=new Map,qo="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(" ");qo.push("scrollEnd");function It(e,t){Od.set(e,t),ya(t,[e])}var yi=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)},Ht=[],ll=0,Mo=0;function bi(){for(var e=ll,t=Mo=ll=0;t<e;){var n=Ht[t];Ht[t++]=null;var s=Ht[t];Ht[t++]=null;var c=Ht[t];Ht[t++]=null;var u=Ht[t];if(Ht[t++]=null,s!==null&&c!==null){var p=s.pending;p===null?c.next=c:(c.next=p.next,p.next=c),s.pending=c}u!==0&&Bd(n,c,u)}}function Si(e,t,n,s){Ht[ll++]=e,Ht[ll++]=t,Ht[ll++]=n,Ht[ll++]=s,Mo|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function To(e,t,n,s){return Si(e,t,n,s),Ai(e)}function ja(e,t){return Si(e,null,null,t),Ai(e)}function Bd(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-$e(n),e=u.hiddenUpdates,s=e[c],s===null?e[c]=[t]:s.push(t),t.lane=n|536870912),u):null}function Ai(e){if(50<Ns)throw Ns=0,Uc=null,Error(r(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var sl={};function ov(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 kt(e,t,n,s){return new ov(e,t,n,s)}function Ro(e){return e=e.prototype,!(!e||!e.isReactComponent)}function yn(e,t){var n=e.alternate;return n===null?(n=kt(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 zd(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 ji(e,t,n,s,c,u){var p=0;if(s=e,typeof e=="function")Ro(e)&&(p=1);else if(typeof e=="string")p=my(e,n,le.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case $:return e=kt(31,n,t,c),e.elementType=$,e.lanes=u,e;case N:return Na(n.children,c,u,t);case j:p=8,c|=24;break;case q:return e=kt(12,n,t,c|2),e.elementType=q,e.lanes=u,e;case L:return e=kt(13,n,t,c),e.elementType=L,e.lanes=u,e;case Z:return e=kt(19,n,t,c),e.elementType=Z,e.lanes=u,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case k:p=10;break e;case A:p=9;break e;case B:p=11;break e;case O:p=14;break e;case X:p=16,s=null;break e}p=29,n=Error(r(130,e===null?"null":typeof e,"")),s=null}return t=kt(p,n,t,c),t.elementType=e,t.type=s,t.lanes=u,t}function Na(e,t,n,s){return e=kt(7,e,s,t),e.lanes=n,e}function ko(e,t,n){return e=kt(6,e,null,t),e.lanes=n,e}function Ld(e){var t=kt(18,null,null,0);return t.stateNode=e,t}function _o(e,t,n){return t=kt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Ud=new WeakMap;function Vt(e,t){if(typeof e=="object"&&e!==null){var n=Ud.get(e);return n!==void 0?n:(t={value:e,source:t,stack:Vn(t)},Ud.set(e,t),t)}return{value:e,source:t,stack:Vn(t)}}var il=[],rl=0,Ni=null,as=0,Yt=[],$t=0,Gn=null,ln=1,sn="";function bn(e,t){il[rl++]=as,il[rl++]=Ni,Ni=e,as=t}function Hd(e,t,n){Yt[$t++]=ln,Yt[$t++]=sn,Yt[$t++]=Gn,Gn=e;var s=ln;e=sn;var c=32-$e(s)-1;s&=~(1<<c),n+=1;var u=32-$e(t)+c;if(30<u){var p=c-c%5;u=(s&(1<<p)-1).toString(32),s>>=p,c-=p,ln=1<<32-$e(t)+c|n<<c|s,sn=u+e}else ln=1<<u|n<<c|s,sn=e}function Do(e){e.return!==null&&(bn(e,1),Hd(e,1,0))}function Oo(e){for(;e===Ni;)Ni=il[--rl],il[rl]=null,as=il[--rl],il[rl]=null;for(;e===Gn;)Gn=Yt[--$t],Yt[$t]=null,sn=Yt[--$t],Yt[$t]=null,ln=Yt[--$t],Yt[$t]=null}function Vd(e,t){Yt[$t++]=ln,Yt[$t++]=sn,Yt[$t++]=Gn,ln=t.id,sn=t.overflow,Gn=e}var mt=null,Qe=null,Me=!1,Xn=null,Gt=!1,Bo=Error(r(519));function Qn(e){var t=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ls(Vt(t,e)),Bo}function Yd(e){var t=e.stateNode,n=e.type,s=e.memoizedProps;switch(t[dt]=e,t[At]=s,n){case"dialog":we("cancel",t),we("close",t);break;case"iframe":case"object":case"embed":we("load",t);break;case"video":case"audio":for(n=0;n<Cs.length;n++)we(Cs[n],t);break;case"source":we("error",t);break;case"img":case"image":case"link":we("error",t),we("load",t);break;case"details":we("toggle",t);break;case"input":we("invalid",t),td(t,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":we("invalid",t);break;case"textarea":we("invalid",t),ad(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||sp(t.textContent,n)?(s.popover!=null&&(we("beforetoggle",t),we("toggle",t)),s.onScroll!=null&&we("scroll",t),s.onScrollEnd!=null&&we("scrollend",t),s.onClick!=null&&(t.onclick=xn),t=!0):t=!1,t||Qn(e,!0)}function $d(e){for(mt=e.return;mt;)switch(mt.tag){case 5:case 31:case 13:Gt=!1;return;case 27:case 3:Gt=!0;return;default:mt=mt.return}}function ol(e){if(e!==mt)return!1;if(!Me)return $d(e),Me=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||eu(e.type,e.memoizedProps)),n=!n),n&&Qe&&Qn(e),$d(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));Qe=hp(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));Qe=hp(e)}else t===27?(t=Qe,ia(e.type)?(e=su,su=null,Qe=e):Qe=t):Qe=mt?Qt(e.stateNode.nextSibling):null;return!0}function wa(){Qe=mt=null,Me=!1}function zo(){var e=Xn;return e!==null&&(Et===null?Et=e:Et.push.apply(Et,e),Xn=null),e}function ls(e){Xn===null?Xn=[e]:Xn.push(e)}var Lo=E(null),Ca=null,Sn=null;function Kn(e,t,n){te(Lo,t._currentValue),t._currentValue=n}function An(e){e._currentValue=Lo.current,Y(Lo)}function Uo(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 Ho(e,t,n,s){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var u=c.dependencies;if(u!==null){var p=c.child;u=u.firstContext;e:for(;u!==null;){var b=u;u=c;for(var T=0;T<t.length;T++)if(b.context===t[T]){u.lanes|=n,b=u.alternate,b!==null&&(b.lanes|=n),Uo(u.return,n,e),s||(p=null);break e}u=b.next}}else if(c.tag===18){if(p=c.return,p===null)throw Error(r(341));p.lanes|=n,u=p.alternate,u!==null&&(u.lanes|=n),Uo(p,n,e),p=null}else p=c.child;if(p!==null)p.return=c;else for(p=c;p!==null;){if(p===e){p=null;break}if(c=p.sibling,c!==null){c.return=p.return,p=c;break}p=p.return}c=p}}function cl(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 p=c.alternate;if(p===null)throw Error(r(387));if(p=p.memoizedProps,p!==null){var b=c.type;Rt(c.pendingProps.value,p.value)||(e!==null?e.push(b):e=[b])}}else if(c===ce.current){if(p=c.alternate,p===null)throw Error(r(387));p.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(Rs):e=[Rs])}c=c.return}e!==null&&Ho(t,e,n,s),t.flags|=262144}function wi(e){for(e=e.firstContext;e!==null;){if(!Rt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ea(e){Ca=e,Sn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ht(e){return Gd(Ca,e)}function Ci(e,t){return Ca===null&&Ea(e),Gd(e,t)}function Gd(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Sn===null){if(e===null)throw Error(r(308));Sn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Sn=Sn.next=t;return n}var cv=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()})}},uv=a.unstable_scheduleCallback,fv=a.unstable_NormalPriority,at={$$typeof:k,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Vo(){return{controller:new cv,data:new Map,refCount:0}}function ss(e){e.refCount--,e.refCount===0&&uv(fv,function(){e.controller.abort()})}var is=null,Yo=0,ul=0,fl=null;function dv(e,t){if(is===null){var n=is=[];Yo=0,ul=Xc(),fl={status:"pending",value:void 0,then:function(s){n.push(s)}}}return Yo++,t.then(Xd,Xd),t}function Xd(){if(--Yo===0&&is!==null){fl!==null&&(fl.status="fulfilled");var e=is;is=null,ul=0,fl=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function mv(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 Qd=R.S;R.S=function(e,t){Mh=ft(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&dv(e,t),Qd!==null&&Qd(e,t)};var qa=E(null);function $o(){var e=qa.current;return e!==null?e:Ve.pooledCache}function Ei(e,t){t===null?te(qa,qa.current):te(qa,t.pool)}function Kd(){var e=$o();return e===null?null:{parent:at._currentValue,pool:e}}var dl=Error(r(460)),Go=Error(r(474)),qi=Error(r(542)),Mi={then:function(){}};function Zd(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Fd(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(xn,xn),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Id(e),e;default:if(typeof t.status=="string")t.then(xn,xn);else{if(e=Ve,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,Id(e),e}throw Ta=t,dl}}function Ma(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Ta=n,dl):n}}var Ta=null;function Jd(){if(Ta===null)throw Error(r(459));var e=Ta;return Ta=null,e}function Id(e){if(e===dl||e===qi)throw Error(r(483))}var ml=null,rs=0;function Ti(e){var t=rs;return rs+=1,ml===null&&(ml=[]),Fd(ml,e,t)}function os(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Ri(e,t){throw t.$$typeof===w?Error(r(525)):(e=Object.prototype.toString.call(t),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Wd(e){function t(D,_){if(e){var U=D.deletions;U===null?(D.deletions=[_],D.flags|=16):U.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=yn(D,_),D.index=0,D.sibling=null,D}function u(D,_,U){return D.index=U,e?(U=D.alternate,U!==null?(U=U.index,U<_?(D.flags|=67108866,_):U):(D.flags|=67108866,_)):(D.flags|=1048576,_)}function p(D){return e&&D.alternate===null&&(D.flags|=67108866),D}function b(D,_,U,I){return _===null||_.tag!==6?(_=ko(U,D.mode,I),_.return=D,_):(_=c(_,U),_.return=D,_)}function T(D,_,U,I){var me=U.type;return me===N?J(D,_,U.props.children,I,U.key):_!==null&&(_.elementType===me||typeof me=="object"&&me!==null&&me.$$typeof===X&&Ma(me)===_.type)?(_=c(_,U.props),os(_,U),_.return=D,_):(_=ji(U.type,U.key,U.props,null,D.mode,I),os(_,U),_.return=D,_)}function H(D,_,U,I){return _===null||_.tag!==4||_.stateNode.containerInfo!==U.containerInfo||_.stateNode.implementation!==U.implementation?(_=_o(U,D.mode,I),_.return=D,_):(_=c(_,U.children||[]),_.return=D,_)}function J(D,_,U,I,me){return _===null||_.tag!==7?(_=Na(U,D.mode,I,me),_.return=D,_):(_=c(_,U),_.return=D,_)}function P(D,_,U){if(typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint")return _=ko(""+_,D.mode,U),_.return=D,_;if(typeof _=="object"&&_!==null){switch(_.$$typeof){case M:return U=ji(_.type,_.key,_.props,null,D.mode,U),os(U,_),U.return=D,U;case C:return _=_o(_,D.mode,U),_.return=D,_;case X:return _=Ma(_),P(D,_,U)}if(W(_)||K(_))return _=Na(_,D.mode,U,null),_.return=D,_;if(typeof _.then=="function")return P(D,Ti(_),U);if(_.$$typeof===k)return P(D,Ci(D,_),U);Ri(D,_)}return null}function V(D,_,U,I){var me=_!==null?_.key:null;if(typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint")return me!==null?null:b(D,_,""+U,I);if(typeof U=="object"&&U!==null){switch(U.$$typeof){case M:return U.key===me?T(D,_,U,I):null;case C:return U.key===me?H(D,_,U,I):null;case X:return U=Ma(U),V(D,_,U,I)}if(W(U)||K(U))return me!==null?null:J(D,_,U,I,null);if(typeof U.then=="function")return V(D,_,Ti(U),I);if(U.$$typeof===k)return V(D,_,Ci(D,U),I);Ri(D,U)}return null}function G(D,_,U,I,me){if(typeof I=="string"&&I!==""||typeof I=="number"||typeof I=="bigint")return D=D.get(U)||null,b(_,D,""+I,me);if(typeof I=="object"&&I!==null){switch(I.$$typeof){case M:return D=D.get(I.key===null?U:I.key)||null,T(_,D,I,me);case C:return D=D.get(I.key===null?U:I.key)||null,H(_,D,I,me);case X:return I=Ma(I),G(D,_,U,I,me)}if(W(I)||K(I))return D=D.get(U)||null,J(_,D,I,me,null);if(typeof I.then=="function")return G(D,_,U,Ti(I),me);if(I.$$typeof===k)return G(D,_,U,Ci(_,I),me);Ri(_,I)}return null}function fe(D,_,U,I){for(var me=null,ke=null,de=_,Ae=_=0,Ee=null;de!==null&&Ae<U.length;Ae++){de.index>Ae?(Ee=de,de=null):Ee=de.sibling;var _e=V(D,de,U[Ae],I);if(_e===null){de===null&&(de=Ee);break}e&&de&&_e.alternate===null&&t(D,de),_=u(_e,_,Ae),ke===null?me=_e:ke.sibling=_e,ke=_e,de=Ee}if(Ae===U.length)return n(D,de),Me&&bn(D,Ae),me;if(de===null){for(;Ae<U.length;Ae++)de=P(D,U[Ae],I),de!==null&&(_=u(de,_,Ae),ke===null?me=de:ke.sibling=de,ke=de);return Me&&bn(D,Ae),me}for(de=s(de);Ae<U.length;Ae++)Ee=G(de,D,Ae,U[Ae],I),Ee!==null&&(e&&Ee.alternate!==null&&de.delete(Ee.key===null?Ae:Ee.key),_=u(Ee,_,Ae),ke===null?me=Ee:ke.sibling=Ee,ke=Ee);return e&&de.forEach(function(fa){return t(D,fa)}),Me&&bn(D,Ae),me}function ge(D,_,U,I){if(U==null)throw Error(r(151));for(var me=null,ke=null,de=_,Ae=_=0,Ee=null,_e=U.next();de!==null&&!_e.done;Ae++,_e=U.next()){de.index>Ae?(Ee=de,de=null):Ee=de.sibling;var fa=V(D,de,_e.value,I);if(fa===null){de===null&&(de=Ee);break}e&&de&&fa.alternate===null&&t(D,de),_=u(fa,_,Ae),ke===null?me=fa:ke.sibling=fa,ke=fa,de=Ee}if(_e.done)return n(D,de),Me&&bn(D,Ae),me;if(de===null){for(;!_e.done;Ae++,_e=U.next())_e=P(D,_e.value,I),_e!==null&&(_=u(_e,_,Ae),ke===null?me=_e:ke.sibling=_e,ke=_e);return Me&&bn(D,Ae),me}for(de=s(de);!_e.done;Ae++,_e=U.next())_e=G(de,D,Ae,_e.value,I),_e!==null&&(e&&_e.alternate!==null&&de.delete(_e.key===null?Ae:_e.key),_=u(_e,_,Ae),ke===null?me=_e:ke.sibling=_e,ke=_e);return e&&de.forEach(function(Ny){return t(D,Ny)}),Me&&bn(D,Ae),me}function He(D,_,U,I){if(typeof U=="object"&&U!==null&&U.type===N&&U.key===null&&(U=U.props.children),typeof U=="object"&&U!==null){switch(U.$$typeof){case M:e:{for(var me=U.key;_!==null;){if(_.key===me){if(me=U.type,me===N){if(_.tag===7){n(D,_.sibling),I=c(_,U.props.children),I.return=D,D=I;break e}}else if(_.elementType===me||typeof me=="object"&&me!==null&&me.$$typeof===X&&Ma(me)===_.type){n(D,_.sibling),I=c(_,U.props),os(I,U),I.return=D,D=I;break e}n(D,_);break}else t(D,_);_=_.sibling}U.type===N?(I=Na(U.props.children,D.mode,I,U.key),I.return=D,D=I):(I=ji(U.type,U.key,U.props,null,D.mode,I),os(I,U),I.return=D,D=I)}return p(D);case C:e:{for(me=U.key;_!==null;){if(_.key===me)if(_.tag===4&&_.stateNode.containerInfo===U.containerInfo&&_.stateNode.implementation===U.implementation){n(D,_.sibling),I=c(_,U.children||[]),I.return=D,D=I;break e}else{n(D,_);break}else t(D,_);_=_.sibling}I=_o(U,D.mode,I),I.return=D,D=I}return p(D);case X:return U=Ma(U),He(D,_,U,I)}if(W(U))return fe(D,_,U,I);if(K(U)){if(me=K(U),typeof me!="function")throw Error(r(150));return U=me.call(U),ge(D,_,U,I)}if(typeof U.then=="function")return He(D,_,Ti(U),I);if(U.$$typeof===k)return He(D,_,Ci(D,U),I);Ri(D,U)}return typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint"?(U=""+U,_!==null&&_.tag===6?(n(D,_.sibling),I=c(_,U),I.return=D,D=I):(n(D,_),I=ko(U,D.mode,I),I.return=D,D=I),p(D)):n(D,_)}return function(D,_,U,I){try{rs=0;var me=He(D,_,U,I);return ml=null,me}catch(de){if(de===dl||de===qi)throw de;var ke=kt(29,de,null,D.mode);return ke.lanes=I,ke.return=D,ke}finally{}}}var Ra=Wd(!0),Pd=Wd(!1),Zn=!1;function Xo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Qo(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 Fn(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Jn(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=Ai(e),Bd(e,null,n),t}return Si(e,s,t,n),Ai(e)}function cs(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,Gf(e,n)}}function Ko(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 p={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};u===null?c=u=p:u=u.next=p,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 Zo=!1;function us(){if(Zo){var e=fl;if(e!==null)throw e}}function fs(e,t,n,s){Zo=!1;var c=e.updateQueue;Zn=!1;var u=c.firstBaseUpdate,p=c.lastBaseUpdate,b=c.shared.pending;if(b!==null){c.shared.pending=null;var T=b,H=T.next;T.next=null,p===null?u=H:p.next=H,p=T;var J=e.alternate;J!==null&&(J=J.updateQueue,b=J.lastBaseUpdate,b!==p&&(b===null?J.firstBaseUpdate=H:b.next=H,J.lastBaseUpdate=T))}if(u!==null){var P=c.baseState;p=0,J=H=T=null,b=u;do{var V=b.lane&-536870913,G=V!==b.lane;if(G?(Ce&V)===V:(s&V)===V){V!==0&&V===ul&&(Zo=!0),J!==null&&(J=J.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var fe=e,ge=b;V=t;var He=n;switch(ge.tag){case 1:if(fe=ge.payload,typeof fe=="function"){P=fe.call(He,P,V);break e}P=fe;break e;case 3:fe.flags=fe.flags&-65537|128;case 0:if(fe=ge.payload,V=typeof fe=="function"?fe.call(He,P,V):fe,V==null)break e;P=S({},P,V);break e;case 2:Zn=!0}}V=b.callback,V!==null&&(e.flags|=64,G&&(e.flags|=8192),G=c.callbacks,G===null?c.callbacks=[V]:G.push(V))}else G={lane:V,tag:b.tag,payload:b.payload,callback:b.callback,next:null},J===null?(H=J=G,T=P):J=J.next=G,p|=V;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&&(T=P),c.baseState=T,c.firstBaseUpdate=H,c.lastBaseUpdate=J,u===null&&(c.shared.lanes=0),ta|=p,e.lanes=p,e.memoizedState=P}}function em(e,t){if(typeof e!="function")throw Error(r(191,e));e.call(t)}function tm(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)em(n[e],t)}var hl=E(null),ki=E(0);function nm(e,t){e=Rn,te(ki,e),te(hl,t),Rn=e|t.baseLanes}function Fo(){te(ki,Rn),te(hl,hl.current)}function Jo(){Rn=ki.current,Y(hl),Y(ki)}var _t=E(null),Xt=null;function In(e){var t=e.alternate;te(Pe,Pe.current&1),te(_t,e),Xt===null&&(t===null||hl.current!==null||t.memoizedState!==null)&&(Xt=e)}function Io(e){te(Pe,Pe.current),te(_t,e),Xt===null&&(Xt=e)}function am(e){e.tag===22?(te(Pe,Pe.current),te(_t,e),Xt===null&&(Xt=e)):Wn()}function Wn(){te(Pe,Pe.current),te(_t,_t.current)}function Dt(e){Y(_t),Xt===e&&(Xt=null),Y(Pe)}var Pe=E(0);function _i(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||au(n)||lu(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 jn=0,be=null,Le=null,lt=null,Di=!1,pl=!1,ka=!1,Oi=0,ds=0,gl=null,hv=0;function Ie(){throw Error(r(321))}function Wo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Rt(e[n],t[n]))return!1;return!0}function Po(e,t,n,s,c,u){return jn=u,be=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,R.H=e===null||e.memoizedState===null?Hm:hc,ka=!1,u=n(s,c),ka=!1,pl&&(u=sm(t,n,s,c)),lm(e),u}function lm(e){R.H=ps;var t=Le!==null&&Le.next!==null;if(jn=0,lt=Le=be=null,Di=!1,ds=0,gl=null,t)throw Error(r(300));e===null||st||(e=e.dependencies,e!==null&&wi(e)&&(st=!0))}function sm(e,t,n,s){be=e;var c=0;do{if(pl&&(gl=null),ds=0,pl=!1,25<=c)throw Error(r(301));if(c+=1,lt=Le=null,e.updateQueue!=null){var u=e.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}R.H=Vm,u=t(n,s)}while(pl);return u}function pv(){var e=R.H,t=e.useState()[0];return t=typeof t.then=="function"?ms(t):t,e=e.useState()[0],(Le!==null?Le.memoizedState:null)!==e&&(be.flags|=1024),t}function ec(){var e=Oi!==0;return Oi=0,e}function tc(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function nc(e){if(Di){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Di=!1}jn=0,lt=Le=be=null,pl=!1,ds=Oi=0,gl=null}function St(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return lt===null?be.memoizedState=lt=e:lt=lt.next=e,lt}function et(){if(Le===null){var e=be.alternate;e=e!==null?e.memoizedState:null}else e=Le.next;var t=lt===null?be.memoizedState:lt.next;if(t!==null)lt=t,Le=e;else{if(e===null)throw be.alternate===null?Error(r(467)):Error(r(310));Le=e,e={memoizedState:Le.memoizedState,baseState:Le.baseState,baseQueue:Le.baseQueue,queue:Le.queue,next:null},lt===null?be.memoizedState=lt=e:lt=lt.next=e}return lt}function Bi(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ms(e){var t=ds;return ds+=1,gl===null&&(gl=[]),e=Fd(gl,e,t),t=be,(lt===null?t.memoizedState:lt.next)===null&&(t=t.alternate,R.H=t===null||t.memoizedState===null?Hm:hc),e}function zi(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ms(e);if(e.$$typeof===k)return ht(e)}throw Error(r(438,String(e)))}function ac(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=Bi(),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 Nn(e,t){return typeof t=="function"?t(e):t}function Li(e){var t=et();return lc(t,Le,e)}function lc(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 p=c.next;c.next=u.next,u.next=p}t.baseQueue=c=u,s.pending=null}if(u=e.baseState,c===null)e.memoizedState=u;else{t=c.next;var b=p=null,T=null,H=t,J=!1;do{var P=H.lane&-536870913;if(P!==H.lane?(Ce&P)===P:(jn&P)===P){var V=H.revertLane;if(V===0)T!==null&&(T=T.next={lane:0,revertLane:0,gesture:null,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null}),P===ul&&(J=!0);else if((jn&V)===V){H=H.next,V===ul&&(J=!0);continue}else P={lane:0,revertLane:H.revertLane,gesture:null,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null},T===null?(b=T=P,p=u):T=T.next=P,be.lanes|=V,ta|=V;P=H.action,ka&&n(u,P),u=H.hasEagerState?H.eagerState:n(u,P)}else V={lane:P,revertLane:H.revertLane,gesture:H.gesture,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null},T===null?(b=T=V,p=u):T=T.next=V,be.lanes|=P,ta|=P;H=H.next}while(H!==null&&H!==t);if(T===null?p=u:T.next=b,!Rt(u,e.memoizedState)&&(st=!0,J&&(n=fl,n!==null)))throw n;e.memoizedState=u,e.baseState=p,e.baseQueue=T,s.lastRenderedState=u}return c===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function sc(e){var t=et(),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 p=c=c.next;do u=e(u,p.action),p=p.next;while(p!==c);Rt(u,t.memoizedState)||(st=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),n.lastRenderedState=u}return[u,s]}function im(e,t,n){var s=be,c=et(),u=Me;if(u){if(n===void 0)throw Error(r(407));n=n()}else n=t();var p=!Rt((Le||c).memoizedState,n);if(p&&(c.memoizedState=n,st=!0),c=c.queue,oc(cm.bind(null,s,c,e),[e]),c.getSnapshot!==t||p||lt!==null&<.memoizedState.tag&1){if(s.flags|=2048,xl(9,{destroy:void 0},om.bind(null,s,c,n,t),null),Ve===null)throw Error(r(349));u||(jn&127)!==0||rm(s,t,n)}return n}function rm(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=be.updateQueue,t===null?(t=Bi(),be.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function om(e,t,n,s){t.value=n,t.getSnapshot=s,um(t)&&fm(e)}function cm(e,t,n){return n(function(){um(t)&&fm(e)})}function um(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Rt(e,n)}catch{return!0}}function fm(e){var t=ja(e,2);t!==null&&qt(t,e,2)}function ic(e){var t=St();if(typeof e=="function"){var n=e;if(e=n(),ka){Ze(!0);try{n()}finally{Ze(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Nn,lastRenderedState:e},t}function dm(e,t,n,s){return e.baseState=n,lc(e,Le,typeof s=="function"?s:Nn)}function gv(e,t,n,s,c){if(Vi(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(p){u.listeners.push(p)}};R.T!==null?n(!0):u.isTransition=!1,s(u),n=t.pending,n===null?(u.next=t.pending=u,mm(t,u)):(u.next=n.next,t.pending=n.next=u)}}function mm(e,t){var n=t.action,s=t.payload,c=e.state;if(t.isTransition){var u=R.T,p={};R.T=p;try{var b=n(c,s),T=R.S;T!==null&&T(p,b),hm(e,t,b)}catch(H){rc(e,t,H)}finally{u!==null&&p.types!==null&&(u.types=p.types),R.T=u}}else try{u=n(c,s),hm(e,t,u)}catch(H){rc(e,t,H)}}function hm(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(s){pm(e,t,s)},function(s){return rc(e,t,s)}):pm(e,t,n)}function pm(e,t,n){t.status="fulfilled",t.value=n,gm(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,mm(e,n)))}function rc(e,t,n){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=n,gm(t),t=t.next;while(t!==s)}e.action=null}function gm(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function xm(e,t){return t}function vm(e,t){if(Me){var n=Ve.formState;if(n!==null){e:{var s=be;if(Me){if(Qe){t:{for(var c=Qe,u=Gt;c.nodeType!==8;){if(!u){c=null;break t}if(c=Qt(c.nextSibling),c===null){c=null;break t}}u=c.data,c=u==="F!"||u==="F"?c:null}if(c){Qe=Qt(c.nextSibling),s=c.data==="F!";break e}}Qn(s)}s=!1}s&&(t=n[0])}}return n=St(),n.memoizedState=n.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:xm,lastRenderedState:t},n.queue=s,n=zm.bind(null,be,s),s.dispatch=n,s=ic(!1),u=mc.bind(null,be,!1,s.queue),s=St(),c={state:t,dispatch:null,action:e,pending:null},s.queue=c,n=gv.bind(null,be,c,u,n),c.dispatch=n,s.memoizedState=e,[t,n,!1]}function ym(e){var t=et();return bm(t,Le,e)}function bm(e,t,n){if(t=lc(e,t,xm)[0],e=Li(Nn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=ms(t)}catch(p){throw p===dl?qi:p}else s=t;t=et();var c=t.queue,u=c.dispatch;return n!==t.memoizedState&&(be.flags|=2048,xl(9,{destroy:void 0},xv.bind(null,c,n),null)),[s,u,e]}function xv(e,t){e.action=t}function Sm(e){var t=et(),n=Le;if(n!==null)return bm(t,n,e);et(),t=t.memoizedState,n=et();var s=n.queue.dispatch;return n.memoizedState=e,[t,s,!1]}function xl(e,t,n,s){return e={tag:e,create:n,deps:s,inst:t,next:null},t=be.updateQueue,t===null&&(t=Bi(),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 Am(){return et().memoizedState}function Ui(e,t,n,s){var c=St();be.flags|=e,c.memoizedState=xl(1|t,{destroy:void 0},n,s===void 0?null:s)}function Hi(e,t,n,s){var c=et();s=s===void 0?null:s;var u=c.memoizedState.inst;Le!==null&&s!==null&&Wo(s,Le.memoizedState.deps)?c.memoizedState=xl(t,u,n,s):(be.flags|=e,c.memoizedState=xl(1|t,u,n,s))}function jm(e,t){Ui(8390656,8,e,t)}function oc(e,t){Hi(2048,8,e,t)}function vv(e){be.flags|=4;var t=be.updateQueue;if(t===null)t=Bi(),be.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Nm(e){var t=et().memoizedState;return vv({ref:t,nextImpl:e}),function(){if((De&2)!==0)throw Error(r(440));return t.impl.apply(void 0,arguments)}}function wm(e,t){return Hi(4,2,e,t)}function Cm(e,t){return Hi(4,4,e,t)}function Em(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 qm(e,t,n){n=n!=null?n.concat([e]):null,Hi(4,4,Em.bind(null,t,e),n)}function cc(){}function Mm(e,t){var n=et();t=t===void 0?null:t;var s=n.memoizedState;return t!==null&&Wo(t,s[1])?s[0]:(n.memoizedState=[e,t],e)}function Tm(e,t){var n=et();t=t===void 0?null:t;var s=n.memoizedState;if(t!==null&&Wo(t,s[1]))return s[0];if(s=e(),ka){Ze(!0);try{e()}finally{Ze(!1)}}return n.memoizedState=[s,t],s}function uc(e,t,n){return n===void 0||(jn&1073741824)!==0&&(Ce&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=Rh(),be.lanes|=e,ta|=e,n)}function Rm(e,t,n,s){return Rt(n,t)?n:hl.current!==null?(e=uc(e,n,s),Rt(e,t)||(st=!0),e):(jn&42)===0||(jn&1073741824)!==0&&(Ce&261930)===0?(st=!0,e.memoizedState=n):(e=Rh(),be.lanes|=e,ta|=e,t)}function km(e,t,n,s,c){var u=F.p;F.p=u!==0&&8>u?u:8;var p=R.T,b={};R.T=b,mc(e,!1,t,n);try{var T=c(),H=R.S;if(H!==null&&H(b,T),T!==null&&typeof T=="object"&&typeof T.then=="function"){var J=mv(T,s);hs(e,t,J,zt(e))}else hs(e,t,s,zt(e))}catch(P){hs(e,t,{then:function(){},status:"rejected",reason:P},zt())}finally{F.p=u,p!==null&&b.types!==null&&(p.types=b.types),R.T=p}}function yv(){}function fc(e,t,n,s){if(e.tag!==5)throw Error(r(476));var c=_m(e).queue;km(e,c,t,ne,n===null?yv:function(){return Dm(e),n(s)})}function _m(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:Nn,lastRenderedState:ne},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Nn,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Dm(e){var t=_m(e);t.next===null&&(t=e.alternate.memoizedState),hs(e,t.next.queue,{},zt())}function dc(){return ht(Rs)}function Om(){return et().memoizedState}function Bm(){return et().memoizedState}function bv(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=zt();e=Fn(n);var s=Jn(t,e,n);s!==null&&(qt(s,t,n),cs(s,t,n)),t={cache:Vo()},e.payload=t;return}t=t.return}}function Sv(e,t,n){var s=zt();n={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Vi(e)?Lm(t,n):(n=To(e,t,n,s),n!==null&&(qt(n,e,s),Um(n,t,s)))}function zm(e,t,n){var s=zt();hs(e,t,n,s)}function hs(e,t,n,s){var c={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Vi(e))Lm(t,c);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var p=t.lastRenderedState,b=u(p,n);if(c.hasEagerState=!0,c.eagerState=b,Rt(b,p))return Si(e,t,c,0),Ve===null&&bi(),!1}catch{}finally{}if(n=To(e,t,c,s),n!==null)return qt(n,e,s),Um(n,t,s),!0}return!1}function mc(e,t,n,s){if(s={lane:2,revertLane:Xc(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Vi(e)){if(t)throw Error(r(479))}else t=To(e,n,s,2),t!==null&&qt(t,e,2)}function Vi(e){var t=e.alternate;return e===be||t!==null&&t===be}function Lm(e,t){pl=Di=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Um(e,t,n){if((n&4194048)!==0){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,Gf(e,n)}}var ps={readContext:ht,use:zi,useCallback:Ie,useContext:Ie,useEffect:Ie,useImperativeHandle:Ie,useLayoutEffect:Ie,useInsertionEffect:Ie,useMemo:Ie,useReducer:Ie,useRef:Ie,useState:Ie,useDebugValue:Ie,useDeferredValue:Ie,useTransition:Ie,useSyncExternalStore:Ie,useId:Ie,useHostTransitionStatus:Ie,useFormState:Ie,useActionState:Ie,useOptimistic:Ie,useMemoCache:Ie,useCacheRefresh:Ie};ps.useEffectEvent=Ie;var Hm={readContext:ht,use:zi,useCallback:function(e,t){return St().memoizedState=[e,t===void 0?null:t],e},useContext:ht,useEffect:jm,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Ui(4194308,4,Em.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ui(4194308,4,e,t)},useInsertionEffect:function(e,t){Ui(4,2,e,t)},useMemo:function(e,t){var n=St();t=t===void 0?null:t;var s=e();if(ka){Ze(!0);try{e()}finally{Ze(!1)}}return n.memoizedState=[s,t],s},useReducer:function(e,t,n){var s=St();if(n!==void 0){var c=n(t);if(ka){Ze(!0);try{n(t)}finally{Ze(!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=Sv.bind(null,be,e),[s.memoizedState,e]},useRef:function(e){var t=St();return e={current:e},t.memoizedState=e},useState:function(e){e=ic(e);var t=e.queue,n=zm.bind(null,be,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:cc,useDeferredValue:function(e,t){var n=St();return uc(n,e,t)},useTransition:function(){var e=ic(!1);return e=km.bind(null,be,e.queue,!0,!1),St().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var s=be,c=St();if(Me){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),Ve===null)throw Error(r(349));(Ce&127)!==0||rm(s,t,n)}c.memoizedState=n;var u={value:n,getSnapshot:t};return c.queue=u,jm(cm.bind(null,s,u,e),[e]),s.flags|=2048,xl(9,{destroy:void 0},om.bind(null,s,u,n,t),null),n},useId:function(){var e=St(),t=Ve.identifierPrefix;if(Me){var n=sn,s=ln;n=(s&~(1<<32-$e(s)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Oi++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=hv++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:dc,useFormState:vm,useActionState:vm,useOptimistic:function(e){var t=St();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=mc.bind(null,be,!0,n),n.dispatch=t,[e,t]},useMemoCache:ac,useCacheRefresh:function(){return St().memoizedState=bv.bind(null,be)},useEffectEvent:function(e){var t=St(),n={impl:e};return t.memoizedState=n,function(){if((De&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}},hc={readContext:ht,use:zi,useCallback:Mm,useContext:ht,useEffect:oc,useImperativeHandle:qm,useInsertionEffect:wm,useLayoutEffect:Cm,useMemo:Tm,useReducer:Li,useRef:Am,useState:function(){return Li(Nn)},useDebugValue:cc,useDeferredValue:function(e,t){var n=et();return Rm(n,Le.memoizedState,e,t)},useTransition:function(){var e=Li(Nn)[0],t=et().memoizedState;return[typeof e=="boolean"?e:ms(e),t]},useSyncExternalStore:im,useId:Om,useHostTransitionStatus:dc,useFormState:ym,useActionState:ym,useOptimistic:function(e,t){var n=et();return dm(n,Le,e,t)},useMemoCache:ac,useCacheRefresh:Bm};hc.useEffectEvent=Nm;var Vm={readContext:ht,use:zi,useCallback:Mm,useContext:ht,useEffect:oc,useImperativeHandle:qm,useInsertionEffect:wm,useLayoutEffect:Cm,useMemo:Tm,useReducer:sc,useRef:Am,useState:function(){return sc(Nn)},useDebugValue:cc,useDeferredValue:function(e,t){var n=et();return Le===null?uc(n,e,t):Rm(n,Le.memoizedState,e,t)},useTransition:function(){var e=sc(Nn)[0],t=et().memoizedState;return[typeof e=="boolean"?e:ms(e),t]},useSyncExternalStore:im,useId:Om,useHostTransitionStatus:dc,useFormState:Sm,useActionState:Sm,useOptimistic:function(e,t){var n=et();return Le!==null?dm(n,Le,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:ac,useCacheRefresh:Bm};Vm.useEffectEvent=Nm;function pc(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 gc={enqueueSetState:function(e,t,n){e=e._reactInternals;var s=zt(),c=Fn(s);c.payload=t,n!=null&&(c.callback=n),t=Jn(e,c,s),t!==null&&(qt(t,e,s),cs(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var s=zt(),c=Fn(s);c.tag=1,c.payload=t,n!=null&&(c.callback=n),t=Jn(e,c,s),t!==null&&(qt(t,e,s),cs(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=zt(),s=Fn(n);s.tag=2,t!=null&&(s.callback=t),t=Jn(e,s,n),t!==null&&(qt(t,e,n),cs(t,e,n))}};function Ym(e,t,n,s,c,u,p){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,u,p):t.prototype&&t.prototype.isPureReactComponent?!ts(n,s)||!ts(c,u):!0}function $m(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&&gc.enqueueReplaceState(t,t.state,null)}function _a(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 Gm(e){yi(e)}function Xm(e){console.error(e)}function Qm(e){yi(e)}function Yi(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function Km(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 xc(e,t,n){return n=Fn(n),n.tag=3,n.payload={element:null},n.callback=function(){Yi(e,t)},n}function Zm(e){return e=Fn(e),e.tag=3,e}function Fm(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(){Km(t,n,s)}}var p=n.stateNode;p!==null&&typeof p.componentDidCatch=="function"&&(e.callback=function(){Km(t,n,s),typeof c!="function"&&(na===null?na=new Set([this]):na.add(this));var b=s.stack;this.componentDidCatch(s.value,{componentStack:b!==null?b:""})})}function Av(e,t,n,s,c){if(n.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=n.alternate,t!==null&&cl(t,n,c,!0),n=_t.current,n!==null){switch(n.tag){case 31:case 13:return Xt===null?er():n.alternate===null&&We===0&&(We=3),n.flags&=-257,n.flags|=65536,n.lanes=c,s===Mi?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([s]):t.add(s),Yc(e,s,c)),!1;case 22:return n.flags|=65536,s===Mi?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)),Yc(e,s,c)),!1}throw Error(r(435,n.tag))}return Yc(e,s,c),er(),!1}if(Me)return t=_t.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,s!==Bo&&(e=Error(r(422),{cause:s}),ls(Vt(e,n)))):(s!==Bo&&(t=Error(r(423),{cause:s}),ls(Vt(t,n))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,s=Vt(s,n),c=xc(e.stateNode,s,c),Ko(e,c),We!==4&&(We=2)),!1;var u=Error(r(520),{cause:s});if(u=Vt(u,n),js===null?js=[u]:js.push(u),We!==4&&(We=2),t===null)return!0;s=Vt(s,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=c&-c,n.lanes|=e,e=xc(n.stateNode,s,e),Ko(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"&&(na===null||!na.has(u))))return n.flags|=65536,c&=-c,n.lanes|=c,c=Zm(c),Fm(c,e,n,s),Ko(n,c),!1}n=n.return}while(n!==null);return!1}var vc=Error(r(461)),st=!1;function pt(e,t,n,s){t.child=e===null?Pd(t,null,n,s):Ra(t,e.child,n,s)}function Jm(e,t,n,s,c){n=n.render;var u=t.ref;if("ref"in s){var p={};for(var b in s)b!=="ref"&&(p[b]=s[b])}else p=s;return Ea(t),s=Po(e,t,n,p,u,c),b=ec(),e!==null&&!st?(tc(e,t,c),wn(e,t,c)):(Me&&b&&Do(t),t.flags|=1,pt(e,t,s,c),t.child)}function Im(e,t,n,s,c){if(e===null){var u=n.type;return typeof u=="function"&&!Ro(u)&&u.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=u,Wm(e,t,u,s,c)):(e=ji(n.type,null,s,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!Cc(e,c)){var p=u.memoizedProps;if(n=n.compare,n=n!==null?n:ts,n(p,s)&&e.ref===t.ref)return wn(e,t,c)}return t.flags|=1,e=yn(u,s),e.ref=t.ref,e.return=t,t.child=e}function Wm(e,t,n,s,c){if(e!==null){var u=e.memoizedProps;if(ts(u,s)&&e.ref===t.ref)if(st=!1,t.pendingProps=s=u,Cc(e,c))(e.flags&131072)!==0&&(st=!0);else return t.lanes=e.lanes,wn(e,t,c)}return yc(e,t,n,s,c)}function Pm(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 eh(e,t,u,n,s)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ei(t,u!==null?u.cachePool:null),u!==null?nm(t,u):Fo(),am(t);else return s=t.lanes=536870912,eh(e,t,u!==null?u.baseLanes|n:n,n,s)}else u!==null?(Ei(t,u.cachePool),nm(t,u),Wn(),t.memoizedState=null):(e!==null&&Ei(t,null),Fo(),Wn());return pt(e,t,c,n),t.child}function gs(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function eh(e,t,n,s,c){var u=$o();return u=u===null?null:{parent:at._currentValue,pool:u},t.memoizedState={baseLanes:n,cachePool:u},e!==null&&Ei(t,null),Fo(),am(t),e!==null&&cl(e,t,s,!0),t.childLanes=c,null}function $i(e,t){return t=Xi({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function th(e,t,n){return Ra(t,e.child,null,n),e=$i(t,t.pendingProps),e.flags|=2,Dt(t),t.memoizedState=null,e}function jv(e,t,n){var s=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Me){if(s.mode==="hidden")return e=$i(t,s),t.lanes=536870912,gs(null,e);if(Io(t),(e=Qe)?(e=mp(e,Gt),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Gn!==null?{id:ln,overflow:sn}:null,retryLane:536870912,hydrationErrors:null},n=Ld(e),n.return=t,t.child=n,mt=t,Qe=null)):e=null,e===null)throw Qn(t);return t.lanes=536870912,null}return $i(t,s)}var u=e.memoizedState;if(u!==null){var p=u.dehydrated;if(Io(t),c)if(t.flags&256)t.flags&=-257,t=th(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(r(558));else if(st||cl(e,t,n,!1),c=(n&e.childLanes)!==0,st||c){if(s=Ve,s!==null&&(p=Xf(s,n),p!==0&&p!==u.retryLane))throw u.retryLane=p,ja(e,p),qt(s,e,p),vc;er(),t=th(e,t,n)}else e=u.treeContext,Qe=Qt(p.nextSibling),mt=t,Me=!0,Xn=null,Gt=!1,e!==null&&Vd(t,e),t=$i(t,s),t.flags|=4096;return t}return e=yn(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Gi(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 yc(e,t,n,s,c){return Ea(t),n=Po(e,t,n,s,void 0,c),s=ec(),e!==null&&!st?(tc(e,t,c),wn(e,t,c)):(Me&&s&&Do(t),t.flags|=1,pt(e,t,n,c),t.child)}function nh(e,t,n,s,c,u){return Ea(t),t.updateQueue=null,n=sm(t,s,n,c),lm(e),s=ec(),e!==null&&!st?(tc(e,t,u),wn(e,t,u)):(Me&&s&&Do(t),t.flags|=1,pt(e,t,n,u),t.child)}function ah(e,t,n,s,c){if(Ea(t),t.stateNode===null){var u=sl,p=n.contextType;typeof p=="object"&&p!==null&&(u=ht(p)),u=new n(s,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=gc,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=s,u.state=t.memoizedState,u.refs={},Xo(t),p=n.contextType,u.context=typeof p=="object"&&p!==null?ht(p):sl,u.state=t.memoizedState,p=n.getDerivedStateFromProps,typeof p=="function"&&(pc(t,n,p,s),u.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(p=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),p!==u.state&&gc.enqueueReplaceState(u,u.state,null),fs(t,s,u,c),us(),u.state=t.memoizedState),typeof u.componentDidMount=="function"&&(t.flags|=4194308),s=!0}else if(e===null){u=t.stateNode;var b=t.memoizedProps,T=_a(n,b);u.props=T;var H=u.context,J=n.contextType;p=sl,typeof J=="object"&&J!==null&&(p=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||H!==p)&&$m(t,u,s,p),Zn=!1;var V=t.memoizedState;u.state=V,fs(t,s,u,c),us(),H=t.memoizedState,b||V!==H||Zn?(typeof P=="function"&&(pc(t,n,P,s),H=t.memoizedState),(T=Zn||Ym(t,n,T,s,V,H,p))?(J||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(t.flags|=4194308)):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=H),u.props=s,u.state=H,u.context=p,s=T):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{u=t.stateNode,Qo(e,t),p=t.memoizedProps,J=_a(n,p),u.props=J,P=t.pendingProps,V=u.context,H=n.contextType,T=sl,typeof H=="object"&&H!==null&&(T=ht(H)),b=n.getDerivedStateFromProps,(H=typeof b=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(p!==P||V!==T)&&$m(t,u,s,T),Zn=!1,V=t.memoizedState,u.state=V,fs(t,s,u,c),us();var G=t.memoizedState;p!==P||V!==G||Zn||e!==null&&e.dependencies!==null&&wi(e.dependencies)?(typeof b=="function"&&(pc(t,n,b,s),G=t.memoizedState),(J=Zn||Ym(t,n,J,s,V,G,T)||e!==null&&e.dependencies!==null&&wi(e.dependencies))?(H||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(s,G,T),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(s,G,T)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||p===e.memoizedProps&&V===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&V===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=G),u.props=s,u.state=G,u.context=T,s=J):(typeof u.componentDidUpdate!="function"||p===e.memoizedProps&&V===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&V===e.memoizedState||(t.flags|=1024),s=!1)}return u=s,Gi(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=Ra(t,e.child,null,c),t.child=Ra(t,null,n,c)):pt(e,t,n,c),t.memoizedState=u.state,e=t.child):e=wn(e,t,c),e}function lh(e,t,n,s){return wa(),t.flags|=256,pt(e,t,n,s),t.child}var bc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Sc(e){return{baseLanes:e,cachePool:Kd()}}function Ac(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Bt),e}function sh(e,t,n){var s=t.pendingProps,c=!1,u=(t.flags&128)!==0,p;if((p=u)||(p=e!==null&&e.memoizedState===null?!1:(Pe.current&2)!==0),p&&(c=!0,t.flags&=-129),p=(t.flags&32)!==0,t.flags&=-33,e===null){if(Me){if(c?In(t):Wn(),(e=Qe)?(e=mp(e,Gt),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Gn!==null?{id:ln,overflow:sn}:null,retryLane:536870912,hydrationErrors:null},n=Ld(e),n.return=t,t.child=n,mt=t,Qe=null)):e=null,e===null)throw Qn(t);return lu(e)?t.lanes=32:t.lanes=536870912,null}var b=s.children;return s=s.fallback,c?(Wn(),c=t.mode,b=Xi({mode:"hidden",children:b},c),s=Na(s,c,n,null),b.return=t,s.return=t,b.sibling=s,t.child=b,s=t.child,s.memoizedState=Sc(n),s.childLanes=Ac(e,p,n),t.memoizedState=bc,gs(null,s)):(In(t),jc(t,b))}var T=e.memoizedState;if(T!==null&&(b=T.dehydrated,b!==null)){if(u)t.flags&256?(In(t),t.flags&=-257,t=Nc(e,t,n)):t.memoizedState!==null?(Wn(),t.child=e.child,t.flags|=128,t=null):(Wn(),b=s.fallback,c=t.mode,s=Xi({mode:"visible",children:s.children},c),b=Na(b,c,n,null),b.flags|=2,s.return=t,b.return=t,s.sibling=b,t.child=s,Ra(t,e.child,null,n),s=t.child,s.memoizedState=Sc(n),s.childLanes=Ac(e,p,n),t.memoizedState=bc,t=gs(null,s));else if(In(t),lu(b)){if(p=b.nextSibling&&b.nextSibling.dataset,p)var H=p.dgst;p=H,s=Error(r(419)),s.stack="",s.digest=p,ls({value:s,source:null,stack:null}),t=Nc(e,t,n)}else if(st||cl(e,t,n,!1),p=(n&e.childLanes)!==0,st||p){if(p=Ve,p!==null&&(s=Xf(p,n),s!==0&&s!==T.retryLane))throw T.retryLane=s,ja(e,s),qt(p,e,s),vc;au(b)||er(),t=Nc(e,t,n)}else au(b)?(t.flags|=192,t.child=e.child,t=null):(e=T.treeContext,Qe=Qt(b.nextSibling),mt=t,Me=!0,Xn=null,Gt=!1,e!==null&&Vd(t,e),t=jc(t,s.children),t.flags|=4096);return t}return c?(Wn(),b=s.fallback,c=t.mode,T=e.child,H=T.sibling,s=yn(T,{mode:"hidden",children:s.children}),s.subtreeFlags=T.subtreeFlags&65011712,H!==null?b=yn(H,b):(b=Na(b,c,n,null),b.flags|=2),b.return=t,s.return=t,s.sibling=b,t.child=s,gs(null,s),s=t.child,b=e.child.memoizedState,b===null?b=Sc(n):(c=b.cachePool,c!==null?(T=at._currentValue,c=c.parent!==T?{parent:T,pool:T}:c):c=Kd(),b={baseLanes:b.baseLanes|n,cachePool:c}),s.memoizedState=b,s.childLanes=Ac(e,p,n),t.memoizedState=bc,gs(e.child,s)):(In(t),n=e.child,e=n.sibling,n=yn(n,{mode:"visible",children:s.children}),n.return=t,n.sibling=null,e!==null&&(p=t.deletions,p===null?(t.deletions=[e],t.flags|=16):p.push(e)),t.child=n,t.memoizedState=null,n)}function jc(e,t){return t=Xi({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Xi(e,t){return e=kt(22,e,null,t),e.lanes=0,e}function Nc(e,t,n){return Ra(t,e.child,null,n),e=jc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function ih(e,t,n){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),Uo(e.return,t,n)}function wc(e,t,n,s,c,u){var p=e.memoizedState;p===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:n,tailMode:c,treeForkCount:u}:(p.isBackwards=t,p.rendering=null,p.renderingStartTime=0,p.last=s,p.tail=n,p.tailMode=c,p.treeForkCount=u)}function rh(e,t,n){var s=t.pendingProps,c=s.revealOrder,u=s.tail;s=s.children;var p=Pe.current,b=(p&2)!==0;if(b?(p=p&1|2,t.flags|=128):p&=1,te(Pe,p),pt(e,t,s,n),s=Me?as:0,!b&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&ih(e,n,t);else if(e.tag===19)ih(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&&_i(e)===null&&(c=n),n=n.sibling;n=c,n===null?(c=t.child,t.child=null):(c=n.sibling,n.sibling=null),wc(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&&_i(e)===null){t.child=c;break}e=c.sibling,c.sibling=n,n=c,c=e}wc(t,!0,n,null,u,s);break;case"together":wc(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function wn(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),ta|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(cl(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,n=yn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=yn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Cc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&wi(e)))}function Nv(e,t,n){switch(t.tag){case 3:xe(t,t.stateNode.containerInfo),Kn(t,at,e.memoizedState.cache),wa();break;case 27:case 5:je(t);break;case 4:xe(t,t.stateNode.containerInfo);break;case 10:Kn(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Io(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(In(t),t.flags|=128,null):(n&t.child.childLanes)!==0?sh(e,t,n):(In(t),e=wn(e,t,n),e!==null?e.sibling:null);In(t);break;case 19:var c=(e.flags&128)!==0;if(s=(n&t.childLanes)!==0,s||(cl(e,t,n,!1),s=(n&t.childLanes)!==0),c){if(s)return rh(e,t,n);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),te(Pe,Pe.current),s)break;return null;case 22:return t.lanes=0,Pm(e,t,n,t.pendingProps);case 24:Kn(t,at,e.memoizedState.cache)}return wn(e,t,n)}function oh(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)st=!0;else{if(!Cc(e,n)&&(t.flags&128)===0)return st=!1,Nv(e,t,n);st=(e.flags&131072)!==0}else st=!1,Me&&(t.flags&1048576)!==0&&Hd(t,as,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=Ma(t.elementType),t.type=e,typeof e=="function")Ro(e)?(s=_a(e,s),t.tag=1,t=ah(null,t,e,s,n)):(t.tag=0,t=yc(null,t,e,s,n));else{if(e!=null){var c=e.$$typeof;if(c===B){t.tag=11,t=Jm(null,t,e,s,n);break e}else if(c===O){t.tag=14,t=Im(null,t,e,s,n);break e}}throw t=oe(e)||e,Error(r(306,t,""))}}return t;case 0:return yc(e,t,t.type,t.pendingProps,n);case 1:return s=t.type,c=_a(s,t.pendingProps),ah(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,Qo(e,t),fs(t,s,null,n);var p=t.memoizedState;if(s=p.cache,Kn(t,at,s),s!==u.cache&&Ho(t,[at],n,!0),us(),s=p.element,u.isDehydrated)if(u={element:s,isDehydrated:!1,cache:p.cache},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){t=lh(e,t,s,n);break e}else if(s!==c){c=Vt(Error(r(424)),t),ls(c),t=lh(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(Qe=Qt(e.firstChild),mt=t,Me=!0,Xn=null,Gt=!0,n=Pd(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(wa(),s===c){t=wn(e,t,n);break e}pt(e,t,s,n)}t=t.child}return t;case 26:return Gi(e,t),e===null?(n=yp(t.type,null,t.pendingProps,null))?t.memoizedState=n:Me||(n=t.type,e=t.pendingProps,s=rr(ie.current).createElement(n),s[dt]=t,s[At]=e,gt(s,n,e),ct(s),t.stateNode=s):t.memoizedState=yp(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return je(t),e===null&&Me&&(s=t.stateNode=gp(t.type,t.pendingProps,ie.current),mt=t,Gt=!0,c=Qe,ia(t.type)?(su=c,Qe=Qt(s.firstChild)):Qe=c),pt(e,t,t.pendingProps.children,n),Gi(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Me&&((c=s=Qe)&&(s=ey(s,t.type,t.pendingProps,Gt),s!==null?(t.stateNode=s,mt=t,Qe=Qt(s.firstChild),Gt=!1,c=!0):c=!1),c||Qn(t)),je(t),c=t.type,u=t.pendingProps,p=e!==null?e.memoizedProps:null,s=u.children,eu(c,u)?s=null:p!==null&&eu(c,p)&&(t.flags|=32),t.memoizedState!==null&&(c=Po(e,t,pv,null,null,n),Rs._currentValue=c),Gi(e,t),pt(e,t,s,n),t.child;case 6:return e===null&&Me&&((e=n=Qe)&&(n=ty(n,t.pendingProps,Gt),n!==null?(t.stateNode=n,mt=t,Qe=null,e=!0):e=!1),e||Qn(t)),null;case 13:return sh(e,t,n);case 4:return xe(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=Ra(t,null,s,n):pt(e,t,s,n),t.child;case 11:return Jm(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,Kn(t,t.type,s.value),pt(e,t,s.children,n),t.child;case 9:return c=t.type._context,s=t.pendingProps.children,Ea(t),c=ht(c),s=s(c),t.flags|=1,pt(e,t,s,n),t.child;case 14:return Im(e,t,t.type,t.pendingProps,n);case 15:return Wm(e,t,t.type,t.pendingProps,n);case 19:return rh(e,t,n);case 31:return jv(e,t,n);case 22:return Pm(e,t,n,t.pendingProps);case 24:return Ea(t),s=ht(at),e===null?(c=$o(),c===null&&(c=Ve,u=Vo(),c.pooledCache=u,u.refCount++,u!==null&&(c.pooledCacheLanes|=n),c=u),t.memoizedState={parent:s,cache:c},Xo(t),Kn(t,at,c)):((e.lanes&n)!==0&&(Qo(e,t),fs(t,null,null,n),us()),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),Kn(t,at,s)):(s=u.cache,Kn(t,at,s),s!==c.cache&&Ho(t,[at],n,!0))),pt(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(r(156,t.tag))}function Cn(e){e.flags|=4}function Ec(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(Oh())e.flags|=8192;else throw Ta=Mi,Go}else e.flags&=-16777217}function ch(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Np(t))if(Oh())e.flags|=8192;else throw Ta=Mi,Go}function Qi(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Yf():536870912,e.lanes|=t,Sl|=t)}function xs(e,t){if(!Me)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var s=null;n!==null;)n.alternate!==null&&(s=n),n=n.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function Ke(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 wv(e,t,n){var s=t.pendingProps;switch(Oo(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ke(t),null;case 1:return Ke(t),null;case 3:return n=t.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),An(at),pe(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ol(t)?Cn(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,zo())),Ke(t),null;case 26:var c=t.type,u=t.memoizedState;return e===null?(Cn(t),u!==null?(Ke(t),ch(t,u)):(Ke(t),Ec(t,c,null,s,n))):u?u!==e.memoizedState?(Cn(t),Ke(t),ch(t,u)):(Ke(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&Cn(t),Ke(t),Ec(t,c,e,s,n)),null;case 27:if(ae(t),n=ie.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&Cn(t);else{if(!s){if(t.stateNode===null)throw Error(r(166));return Ke(t),null}e=le.current,ol(t)?Yd(t):(e=gp(c,s,n),t.stateNode=e,Cn(t))}return Ke(t),null;case 5:if(ae(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&Cn(t);else{if(!s){if(t.stateNode===null)throw Error(r(166));return Ke(t),null}if(u=le.current,ol(t))Yd(t);else{var p=rr(ie.current);switch(u){case 1:u=p.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:u=p.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":u=p.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":u=p.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":u=p.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof s.is=="string"?p.createElement("select",{is:s.is}):p.createElement("select"),s.multiple?u.multiple=!0:s.size&&(u.size=s.size);break;default:u=typeof s.is=="string"?p.createElement(c,{is:s.is}):p.createElement(c)}}u[dt]=t,u[At]=s;e:for(p=t.child;p!==null;){if(p.tag===5||p.tag===6)u.appendChild(p.stateNode);else if(p.tag!==4&&p.tag!==27&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===t)break e;for(;p.sibling===null;){if(p.return===null||p.return===t)break e;p=p.return}p.sibling.return=p.return,p=p.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&&Cn(t)}}return Ke(t),Ec(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&Cn(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(r(166));if(e=ie.current,ol(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||sp(e.nodeValue,n)),e||Qn(t,!0)}else e=rr(e).createTextNode(s),e[dt]=t,t.stateNode=e}return Ke(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(s=ol(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 wa(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ke(t),e=!1}else n=zo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Dt(t),t):(Dt(t),null);if((t.flags&128)!==0)throw Error(r(558))}return Ke(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=ol(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 wa(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ke(t),c=!1}else c=zo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(Dt(t),t):(Dt(t),null)}return Dt(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),Qi(t,t.updateQueue),Ke(t),null);case 4:return pe(),e===null&&Fc(t.stateNode.containerInfo),Ke(t),null;case 10:return An(t.type),Ke(t),null;case 19:if(Y(Pe),s=t.memoizedState,s===null)return Ke(t),null;if(c=(t.flags&128)!==0,u=s.rendering,u===null)if(c)xs(s,!1);else{if(We!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=_i(e),u!==null){for(t.flags|=128,xs(s,!1),e=u.updateQueue,t.updateQueue=e,Qi(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)zd(n,e),n=n.sibling;return te(Pe,Pe.current&1|2),Me&&bn(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&ft()>Ii&&(t.flags|=128,c=!0,xs(s,!1),t.lanes=4194304)}else{if(!c)if(e=_i(u),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,Qi(t,e),xs(s,!0),s.tail===null&&s.tailMode==="hidden"&&!u.alternate&&!Me)return Ke(t),null}else 2*ft()-s.renderingStartTime>Ii&&n!==536870912&&(t.flags|=128,c=!0,xs(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=ft(),e.sibling=null,n=Pe.current,te(Pe,c?n&1|2:n&1),Me&&bn(t,s.treeForkCount),e):(Ke(t),null);case 22:case 23:return Dt(t),Jo(),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&&(Ke(t),t.subtreeFlags&6&&(t.flags|=8192)):Ke(t),n=t.updateQueue,n!==null&&Qi(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&&Y(qa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),An(at),Ke(t),null;case 25:return null;case 30:return null}throw Error(r(156,t.tag))}function Cv(e,t){switch(Oo(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return An(at),pe(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ae(t),null;case 31:if(t.memoizedState!==null){if(Dt(t),t.alternate===null)throw Error(r(340));wa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Dt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));wa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Y(Pe),null;case 4:return pe(),null;case 10:return An(t.type),null;case 22:case 23:return Dt(t),Jo(),e!==null&&Y(qa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return An(at),null;case 25:return null;default:return null}}function uh(e,t){switch(Oo(t),t.tag){case 3:An(at),pe();break;case 26:case 27:case 5:ae(t);break;case 4:pe();break;case 31:t.memoizedState!==null&&Dt(t);break;case 13:Dt(t);break;case 19:Y(Pe);break;case 10:An(t.type);break;case 22:case 23:Dt(t),Jo(),e!==null&&Y(qa);break;case 24:An(at)}}function vs(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,p=n.inst;s=u(),p.destroy=s}n=n.next}while(n!==c)}}catch(b){Be(t,t.return,b)}}function Pn(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 p=s.inst,b=p.destroy;if(b!==void 0){p.destroy=void 0,c=t;var T=n,H=b;try{H()}catch(J){Be(c,T,J)}}}s=s.next}while(s!==u)}}catch(J){Be(t,t.return,J)}}function fh(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{tm(t,n)}catch(s){Be(e,e.return,s)}}}function dh(e,t,n){n.props=_a(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(s){Be(e,t,s)}}function ys(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 rn(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 mh(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 qc(e,t,n){try{var s=e.stateNode;Zv(s,e.type,n,t),s[At]=t}catch(c){Be(e,e.return,c)}}function hh(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ia(e.type)||e.tag===4}function Mc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||hh(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&&ia(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 Tc(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=xn));else if(s!==4&&(s===27&&ia(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Tc(e,t,n),e=e.sibling;e!==null;)Tc(e,t,n),e=e.sibling}function Ki(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&&ia(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Ki(e,t,n),e=e.sibling;e!==null;)Ki(e,t,n),e=e.sibling}function ph(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[At]=n}catch(u){Be(e,e.return,u)}}var En=!1,it=!1,Rc=!1,gh=typeof WeakSet=="function"?WeakSet:Set,ut=null;function Ev(e,t){if(e=e.containerInfo,Wc=hr,e=qd(e),No(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 p=0,b=-1,T=-1,H=0,J=0,P=e,V=null;t:for(;;){for(var G;P!==n||c!==0&&P.nodeType!==3||(b=p+c),P!==u||s!==0&&P.nodeType!==3||(T=p+s),P.nodeType===3&&(p+=P.nodeValue.length),(G=P.firstChild)!==null;)V=P,P=G;for(;;){if(P===e)break t;if(V===n&&++H===c&&(b=p),V===u&&++J===s&&(T=p),(G=P.nextSibling)!==null)break;P=V,V=P.parentNode}P=G}n=b===-1||T===-1?null:{start:b,end:T}}else n=null}n=n||{start:0,end:0}}else n=null;for(Pc={focusedElem:e,selectionRange:n},hr=!1,ut=t;ut!==null;)if(t=ut,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ut=e;else for(;ut!==null;){switch(t=ut,u=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n<e.length;n++)c=e[n],c.ref.impl=c.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&u!==null){e=void 0,n=t,c=u.memoizedProps,u=u.memoizedState,s=n.stateNode;try{var fe=_a(n.type,c);e=s.getSnapshotBeforeUpdate(fe,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)nu(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":nu(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,ut=e;break}ut=t.return}}function xh(e,t,n){var s=n.flags;switch(n.tag){case 0:case 11:case 15:Mn(e,n),s&4&&vs(5,n);break;case 1:if(Mn(e,n),s&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(p){Be(n,n.return,p)}else{var c=_a(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(p){Be(n,n.return,p)}}s&64&&fh(n),s&512&&ys(n,n.return);break;case 3:if(Mn(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{tm(e,t)}catch(p){Be(n,n.return,p)}}break;case 27:t===null&&s&4&&ph(n);case 26:case 5:Mn(e,n),t===null&&s&4&&mh(n),s&512&&ys(n,n.return);break;case 12:Mn(e,n);break;case 31:Mn(e,n),s&4&&bh(e,n);break;case 13:Mn(e,n),s&4&&Sh(e,n),s&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Bv.bind(null,n),ny(e,n))));break;case 22:if(s=n.memoizedState!==null||En,!s){t=t!==null&&t.memoizedState!==null||it,c=En;var u=it;En=s,(it=t)&&!u?Tn(e,n,(n.subtreeFlags&8772)!==0):Mn(e,n),En=c,it=u}break;case 30:break;default:Mn(e,n)}}function vh(e){var t=e.alternate;t!==null&&(e.alternate=null,vh(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&io(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 Fe=null,Nt=!1;function qn(e,t,n){for(n=n.child;n!==null;)yh(e,t,n),n=n.sibling}function yh(e,t,n){if(ve&&typeof ve.onCommitFiberUnmount=="function")try{ve.onCommitFiberUnmount(bt,n)}catch{}switch(n.tag){case 26:it||rn(n,t),qn(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:it||rn(n,t);var s=Fe,c=Nt;ia(n.type)&&(Fe=n.stateNode,Nt=!1),qn(e,t,n),qs(n.stateNode),Fe=s,Nt=c;break;case 5:it||rn(n,t);case 6:if(s=Fe,c=Nt,Fe=null,qn(e,t,n),Fe=s,Nt=c,Fe!==null)if(Nt)try{(Fe.nodeType===9?Fe.body:Fe.nodeName==="HTML"?Fe.ownerDocument.body:Fe).removeChild(n.stateNode)}catch(u){Be(n,t,u)}else try{Fe.removeChild(n.stateNode)}catch(u){Be(n,t,u)}break;case 18:Fe!==null&&(Nt?(e=Fe,fp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Ml(e)):fp(Fe,n.stateNode));break;case 4:s=Fe,c=Nt,Fe=n.stateNode.containerInfo,Nt=!0,qn(e,t,n),Fe=s,Nt=c;break;case 0:case 11:case 14:case 15:Pn(2,n,t),it||Pn(4,n,t),qn(e,t,n);break;case 1:it||(rn(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"&&dh(n,t,s)),qn(e,t,n);break;case 21:qn(e,t,n);break;case 22:it=(s=it)||n.memoizedState!==null,qn(e,t,n),it=s;break;default:qn(e,t,n)}}function bh(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Ml(e)}catch(n){Be(t,t.return,n)}}}function Sh(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Ml(e)}catch(n){Be(t,t.return,n)}}function qv(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new gh),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new gh),t;default:throw Error(r(435,e.tag))}}function Zi(e,t){var n=qv(e);t.forEach(function(s){if(!n.has(s)){n.add(s);var c=zv.bind(null,e,s);s.then(c,c)}})}function wt(e,t){var n=t.deletions;if(n!==null)for(var s=0;s<n.length;s++){var c=n[s],u=e,p=t,b=p;e:for(;b!==null;){switch(b.tag){case 27:if(ia(b.type)){Fe=b.stateNode,Nt=!1;break e}break;case 5:Fe=b.stateNode,Nt=!1;break e;case 3:case 4:Fe=b.stateNode.containerInfo,Nt=!0;break e}b=b.return}if(Fe===null)throw Error(r(160));yh(u,p,c),Fe=null,Nt=!1,u=c.alternate,u!==null&&(u.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Ah(t,e),t=t.sibling}var Wt=null;function Ah(e,t){var n=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:wt(t,e),Ct(e),s&4&&(Pn(3,e,e.return),vs(3,e),Pn(5,e,e.return));break;case 1:wt(t,e),Ct(e),s&512&&(it||n===null||rn(n,n.return)),s&64&&En&&(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=Wt;if(wt(t,e),Ct(e),s&512&&(it||n===null||rn(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[Ql]||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,ct(u),s=u;break e;case"link":var p=Ap("link","href",c).get(s+(n.href||""));if(p){for(var b=0;b<p.length;b++)if(u=p[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)){p.splice(b,1);break t}}u=c.createElement(s),gt(u,s,n),c.head.appendChild(u);break;case"meta":if(p=Ap("meta","content",c).get(s+(n.content||""))){for(b=0;b<p.length;b++)if(u=p[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)){p.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,ct(u),s=u}e.stateNode=s}else jp(c,e.type,e.stateNode);else e.stateNode=Sp(c,s,e.memoizedProps);else u!==s?(u===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):u.count--,s===null?jp(c,e.type,e.stateNode):Sp(c,s,e.memoizedProps)):s===null&&e.stateNode!==null&&qc(e,e.memoizedProps,n.memoizedProps)}break;case 27:wt(t,e),Ct(e),s&512&&(it||n===null||rn(n,n.return)),n!==null&&s&4&&qc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(wt(t,e),Ct(e),s&512&&(it||n===null||rn(n,n.return)),e.flags&32){c=e.stateNode;try{Wa(c,"")}catch(fe){Be(e,e.return,fe)}}s&4&&e.stateNode!=null&&(c=e.memoizedProps,qc(e,c,n!==null?n.memoizedProps:c)),s&1024&&(Rc=!0);break;case 6:if(wt(t,e),Ct(e),s&4){if(e.stateNode===null)throw Error(r(162));s=e.memoizedProps,n=e.stateNode;try{n.nodeValue=s}catch(fe){Be(e,e.return,fe)}}break;case 3:if(ur=null,c=Wt,Wt=or(t.containerInfo),wt(t,e),Wt=c,Ct(e),s&4&&n!==null&&n.memoizedState.isDehydrated)try{Ml(t.containerInfo)}catch(fe){Be(e,e.return,fe)}Rc&&(Rc=!1,jh(e));break;case 4:s=Wt,Wt=or(e.stateNode.containerInfo),wt(t,e),Ct(e),Wt=s;break;case 12:wt(t,e),Ct(e);break;case 31:wt(t,e),Ct(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Zi(e,s)));break;case 13:wt(t,e),Ct(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Ji=ft()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Zi(e,s)));break;case 22:c=e.memoizedState!==null;var T=n!==null&&n.memoizedState!==null,H=En,J=it;if(En=H||c,it=J||T,wt(t,e),it=J,En=H,Ct(e),s&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(n===null||T||En||it||Da(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){T=n=t;try{if(u=T.stateNode,c)p=u.style,typeof p.setProperty=="function"?p.setProperty("display","none","important"):p.display="none";else{b=T.stateNode;var P=T.memoizedProps.style,V=P!=null&&P.hasOwnProperty("display")?P.display:null;b.style.display=V==null||typeof V=="boolean"?"":(""+V).trim()}}catch(fe){Be(T,T.return,fe)}}}else if(t.tag===6){if(n===null){T=t;try{T.stateNode.nodeValue=c?"":T.memoizedProps}catch(fe){Be(T,T.return,fe)}}}else if(t.tag===18){if(n===null){T=t;try{var G=T.stateNode;c?dp(G,!0):dp(T.stateNode,!1)}catch(fe){Be(T,T.return,fe)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}s&4&&(s=e.updateQueue,s!==null&&(n=s.retryQueue,n!==null&&(s.retryQueue=null,Zi(e,n))));break;case 19:wt(t,e),Ct(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Zi(e,s)));break;case 30:break;case 21:break;default:wt(t,e),Ct(e)}}function Ct(e){var t=e.flags;if(t&2){try{for(var n,s=e.return;s!==null;){if(hh(s)){n=s;break}s=s.return}if(n==null)throw Error(r(160));switch(n.tag){case 27:var c=n.stateNode,u=Mc(e);Ki(e,u,c);break;case 5:var p=n.stateNode;n.flags&32&&(Wa(p,""),n.flags&=-33);var b=Mc(e);Ki(e,b,p);break;case 3:case 4:var T=n.stateNode.containerInfo,H=Mc(e);Tc(e,H,T);break;default:throw Error(r(161))}}catch(J){Be(e,e.return,J)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function jh(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;jh(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Mn(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)xh(e,t.alternate,t),t=t.sibling}function Da(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Pn(4,t,t.return),Da(t);break;case 1:rn(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&dh(t,t.return,n),Da(t);break;case 27:qs(t.stateNode);case 26:case 5:rn(t,t.return),Da(t);break;case 22:t.memoizedState===null&&Da(t);break;case 30:Da(t);break;default:Da(t)}e=e.sibling}}function Tn(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var s=t.alternate,c=e,u=t,p=u.flags;switch(u.tag){case 0:case 11:case 15:Tn(c,u,n),vs(4,u);break;case 1:if(Tn(c,u,n),s=u,c=s.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(H){Be(s,s.return,H)}if(s=u,c=s.updateQueue,c!==null){var b=s.stateNode;try{var T=c.shared.hiddenCallbacks;if(T!==null)for(c.shared.hiddenCallbacks=null,c=0;c<T.length;c++)em(T[c],b)}catch(H){Be(s,s.return,H)}}n&&p&64&&fh(u),ys(u,u.return);break;case 27:ph(u);case 26:case 5:Tn(c,u,n),n&&s===null&&p&4&&mh(u),ys(u,u.return);break;case 12:Tn(c,u,n);break;case 31:Tn(c,u,n),n&&p&4&&bh(c,u);break;case 13:Tn(c,u,n),n&&p&4&&Sh(c,u);break;case 22:u.memoizedState===null&&Tn(c,u,n),ys(u,u.return);break;case 30:break;default:Tn(c,u,n)}t=t.sibling}}function kc(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&&ss(n))}function _c(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ss(e))}function Pt(e,t,n,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Nh(e,t,n,s),t=t.sibling}function Nh(e,t,n,s){var c=t.flags;switch(t.tag){case 0:case 11:case 15:Pt(e,t,n,s),c&2048&&vs(9,t);break;case 1:Pt(e,t,n,s);break;case 3:Pt(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&&ss(e)));break;case 12:if(c&2048){Pt(e,t,n,s),e=t.stateNode;try{var u=t.memoizedProps,p=u.id,b=u.onPostCommit;typeof b=="function"&&b(p,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(T){Be(t,t.return,T)}}else Pt(e,t,n,s);break;case 31:Pt(e,t,n,s);break;case 13:Pt(e,t,n,s);break;case 23:break;case 22:u=t.stateNode,p=t.alternate,t.memoizedState!==null?u._visibility&2?Pt(e,t,n,s):bs(e,t):u._visibility&2?Pt(e,t,n,s):(u._visibility|=2,vl(e,t,n,s,(t.subtreeFlags&10256)!==0||!1)),c&2048&&kc(p,t);break;case 24:Pt(e,t,n,s),c&2048&&_c(t.alternate,t);break;default:Pt(e,t,n,s)}}function vl(e,t,n,s,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var u=e,p=t,b=n,T=s,H=p.flags;switch(p.tag){case 0:case 11:case 15:vl(u,p,b,T,c),vs(8,p);break;case 23:break;case 22:var J=p.stateNode;p.memoizedState!==null?J._visibility&2?vl(u,p,b,T,c):bs(u,p):(J._visibility|=2,vl(u,p,b,T,c)),c&&H&2048&&kc(p.alternate,p);break;case 24:vl(u,p,b,T,c),c&&H&2048&&_c(p.alternate,p);break;default:vl(u,p,b,T,c)}t=t.sibling}}function bs(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:bs(n,s),c&2048&&kc(s.alternate,s);break;case 24:bs(n,s),c&2048&&_c(s.alternate,s);break;default:bs(n,s)}t=t.sibling}}var Ss=8192;function yl(e,t,n){if(e.subtreeFlags&Ss)for(e=e.child;e!==null;)wh(e,t,n),e=e.sibling}function wh(e,t,n){switch(e.tag){case 26:yl(e,t,n),e.flags&Ss&&e.memoizedState!==null&&hy(n,Wt,e.memoizedState,e.memoizedProps);break;case 5:yl(e,t,n);break;case 3:case 4:var s=Wt;Wt=or(e.stateNode.containerInfo),yl(e,t,n),Wt=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=Ss,Ss=16777216,yl(e,t,n),Ss=s):yl(e,t,n));break;default:yl(e,t,n)}}function Ch(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 As(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];ut=s,qh(s,e)}Ch(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Eh(e),e=e.sibling}function Eh(e){switch(e.tag){case 0:case 11:case 15:As(e),e.flags&2048&&Pn(9,e,e.return);break;case 3:As(e);break;case 12:As(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Fi(e)):As(e);break;default:As(e)}}function Fi(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];ut=s,qh(s,e)}Ch(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Pn(8,t,t.return),Fi(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Fi(t));break;default:Fi(t)}e=e.sibling}}function qh(e,t){for(;ut!==null;){var n=ut;switch(n.tag){case 0:case 11:case 15:Pn(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:ss(n.memoizedState.cache)}if(s=n.child,s!==null)s.return=n,ut=s;else e:for(n=e;ut!==null;){s=ut;var c=s.sibling,u=s.return;if(vh(s),s===n){ut=null;break e}if(c!==null){c.return=u,ut=c;break e}ut=u}}}var Mv={getCacheForType:function(e){var t=ht(at),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return ht(at).controller.signal}},Tv=typeof WeakMap=="function"?WeakMap:Map,De=0,Ve=null,Ne=null,Ce=0,Oe=0,Ot=null,ea=!1,bl=!1,Dc=!1,Rn=0,We=0,ta=0,Oa=0,Oc=0,Bt=0,Sl=0,js=null,Et=null,Bc=!1,Ji=0,Mh=0,Ii=1/0,Wi=null,na=null,ot=0,aa=null,Al=null,kn=0,zc=0,Lc=null,Th=null,Ns=0,Uc=null;function zt(){return(De&2)!==0&&Ce!==0?Ce&-Ce:R.T!==null?Xc():Qf()}function Rh(){if(Bt===0)if((Ce&536870912)===0||Me){var e=ii;ii<<=1,(ii&3932160)===0&&(ii=262144),Bt=e}else Bt=536870912;return e=_t.current,e!==null&&(e.flags|=32),Bt}function qt(e,t,n){(e===Ve&&(Oe===2||Oe===9)||e.cancelPendingCommit!==null)&&(jl(e,0),la(e,Ce,Bt,!1)),Xl(e,n),((De&2)===0||e!==Ve)&&(e===Ve&&((De&2)===0&&(Oa|=n),We===4&&la(e,Ce,Bt,!1)),on(e))}function kh(e,t,n){if((De&6)!==0)throw Error(r(327));var s=!n&&(t&127)===0&&(t&e.expiredLanes)===0||Gl(e,t),c=s?_v(e,t):Vc(e,t,!0),u=s;do{if(c===0){bl&&!s&&la(e,t,0,!1);break}else{if(n=e.current.alternate,u&&!Rv(n)){c=Vc(e,t,!1),u=!1;continue}if(c===2){if(u=t,e.errorRecoveryDisabledLanes&u)var p=0;else p=e.pendingLanes&-536870913,p=p!==0?p:p&536870912?536870912:0;if(p!==0){t=p;e:{var b=e;c=js;var T=b.current.memoizedState.isDehydrated;if(T&&(jl(b,p).flags|=256),p=Vc(b,p,!1),p!==2){if(Dc&&!T){b.errorRecoveryDisabledLanes|=u,Oa|=u,c=4;break e}u=Et,Et=c,u!==null&&(Et===null?Et=u:Et.push.apply(Et,u))}c=p}if(u=!1,c!==2)continue}}if(c===1){jl(e,0),la(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:la(s,t,Bt,!ea);break e;case 2:Et=null;break;case 3:case 5:break;default:throw Error(r(329))}if((t&62914560)===t&&(c=Ji+300-ft(),10<c)){if(la(s,t,Bt,!ea),oi(s,0,!0)!==0)break e;kn=t,s.timeoutHandle=cp(_h.bind(null,s,n,Et,Wi,Bc,t,Bt,Oa,Sl,ea,u,"Throttled",-0,0),c);break e}_h(s,n,Et,Wi,Bc,t,Bt,Oa,Sl,ea,u,null,-0,0)}}break}while(!0);on(e)}function _h(e,t,n,s,c,u,p,b,T,H,J,P,V,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:xn},wh(t,u,P);var fe=(u&62914560)===u?Ji-ft():(u&4194048)===u?Mh-ft():0;if(fe=py(P,fe),fe!==null){kn=u,e.cancelPendingCommit=fe(Vh.bind(null,e,t,u,n,s,c,p,b,T,J,P,null,V,G)),la(e,u,p,!H);return}}Vh(e,t,u,n,s,c,p,b,T)}function Rv(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(!Rt(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 la(e,t,n,s){t&=~Oc,t&=~Oa,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var c=t;0<c;){var u=31-$e(c),p=1<<u;s[u]=-1,c&=~p}n!==0&&$f(e,n,t)}function Pi(){return(De&6)===0?(ws(0),!1):!0}function Hc(){if(Ne!==null){if(Oe===0)var e=Ne.return;else e=Ne,Sn=Ca=null,nc(e),ml=null,rs=0,e=Ne;for(;e!==null;)uh(e.alternate,e),e=e.return;Ne=null}}function jl(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Iv(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),kn=0,Hc(),Ve=e,Ne=n=yn(e.current,null),Ce=t,Oe=0,Ot=null,ea=!1,bl=Gl(e,t),Dc=!1,Sl=Bt=Oc=Oa=ta=We=0,Et=js=null,Bc=!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-$e(s),u=1<<c;t|=e[c],s&=~u}return Rn=t,bi(),n}function Dh(e,t){be=null,R.H=ps,t===dl||t===qi?(t=Jd(),Oe=3):t===Go?(t=Jd(),Oe=4):Oe=t===vc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Ot=t,Ne===null&&(We=1,Yi(e,Vt(t,e.current)))}function Oh(){var e=_t.current;return e===null?!0:(Ce&4194048)===Ce?Xt===null:(Ce&62914560)===Ce||(Ce&536870912)!==0?e===Xt:!1}function Bh(){var e=R.H;return R.H=ps,e===null?ps:e}function zh(){var e=R.A;return R.A=Mv,e}function er(){We=4,ea||(Ce&4194048)!==Ce&&_t.current!==null||(bl=!0),(ta&134217727)===0&&(Oa&134217727)===0||Ve===null||la(Ve,Ce,Bt,!1)}function Vc(e,t,n){var s=De;De|=2;var c=Bh(),u=zh();(Ve!==e||Ce!==t)&&(Wi=null,jl(e,t)),t=!1;var p=We;e:do try{if(Oe!==0&&Ne!==null){var b=Ne,T=Ot;switch(Oe){case 8:Hc(),p=6;break e;case 3:case 2:case 9:case 6:_t.current===null&&(t=!0);var H=Oe;if(Oe=0,Ot=null,Nl(e,b,T,H),n&&bl){p=0;break e}break;default:H=Oe,Oe=0,Ot=null,Nl(e,b,T,H)}}kv(),p=We;break}catch(J){Dh(e,J)}while(!0);return t&&e.shellSuspendCounter++,Sn=Ca=null,De=s,R.H=c,R.A=u,Ne===null&&(Ve=null,Ce=0,bi()),p}function kv(){for(;Ne!==null;)Lh(Ne)}function _v(e,t){var n=De;De|=2;var s=Bh(),c=zh();Ve!==e||Ce!==t?(Wi=null,Ii=ft()+500,jl(e,t)):bl=Gl(e,t);e:do try{if(Oe!==0&&Ne!==null){t=Ne;var u=Ot;t:switch(Oe){case 1:Oe=0,Ot=null,Nl(e,t,u,1);break;case 2:case 9:if(Zd(u)){Oe=0,Ot=null,Uh(t);break}t=function(){Oe!==2&&Oe!==9||Ve!==e||(Oe=7),on(e)},u.then(t,t);break e;case 3:Oe=7;break e;case 4:Oe=5;break e;case 7:Zd(u)?(Oe=0,Ot=null,Uh(t)):(Oe=0,Ot=null,Nl(e,t,u,7));break;case 5:var p=null;switch(Ne.tag){case 26:p=Ne.memoizedState;case 5:case 27:var b=Ne;if(p?Np(p):b.stateNode.complete){Oe=0,Ot=null;var T=b.sibling;if(T!==null)Ne=T;else{var H=b.return;H!==null?(Ne=H,tr(H)):Ne=null}break t}}Oe=0,Ot=null,Nl(e,t,u,5);break;case 6:Oe=0,Ot=null,Nl(e,t,u,6);break;case 8:Hc(),We=6;break e;default:throw Error(r(462))}}Dv();break}catch(J){Dh(e,J)}while(!0);return Sn=Ca=null,R.H=s,R.A=c,De=n,Ne!==null?0:(Ve=null,Ce=0,bi(),We)}function Dv(){for(;Ne!==null&&!ha();)Lh(Ne)}function Lh(e){var t=oh(e.alternate,e,Rn);e.memoizedProps=e.pendingProps,t===null?tr(e):Ne=t}function Uh(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=nh(n,t,t.pendingProps,t.type,void 0,Ce);break;case 11:t=nh(n,t,t.pendingProps,t.type.render,t.ref,Ce);break;case 5:nc(t);default:uh(n,t),t=Ne=zd(t,Rn),t=oh(n,t,Rn)}e.memoizedProps=e.pendingProps,t===null?tr(e):Ne=t}function Nl(e,t,n,s){Sn=Ca=null,nc(t),ml=null,rs=0;var c=t.return;try{if(Av(e,c,t,n,Ce)){We=1,Yi(e,Vt(n,e.current)),Ne=null;return}}catch(u){if(c!==null)throw Ne=c,u;We=1,Yi(e,Vt(n,e.current)),Ne=null;return}t.flags&32768?(Me||s===1?e=!0:bl||(Ce&536870912)!==0?e=!1:(ea=e=!0,(s===2||s===9||s===3||s===6)&&(s=_t.current,s!==null&&s.tag===13&&(s.flags|=16384))),Hh(t,e)):tr(t)}function tr(e){var t=e;do{if((t.flags&32768)!==0){Hh(t,ea);return}e=t.return;var n=wv(t.alternate,t,Rn);if(n!==null){Ne=n;return}if(t=t.sibling,t!==null){Ne=t;return}Ne=t=e}while(t!==null);We===0&&(We=5)}function Hh(e,t){do{var n=Cv(e.alternate,e);if(n!==null){n.flags&=32767,Ne=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Ne=e;return}Ne=e=n}while(e!==null);We=6,Ne=null}function Vh(e,t,n,s,c,u,p,b,T){e.cancelPendingCommit=null;do nr();while(ot!==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|=Mo,mx(e,n,u,p,b,T),e===Ve&&(Ne=Ve=null,Ce=0),Al=t,aa=e,kn=n,zc=u,Lc=c,Th=s,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Lv(xa,function(){return Qh(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||s){s=R.T,R.T=null,c=F.p,F.p=2,p=De,De|=4;try{Ev(e,t,n)}finally{De=p,F.p=c,R.T=s}}ot=1,Yh(),$h(),Gh()}}function Yh(){if(ot===1){ot=0;var e=aa,t=Al,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=R.T,R.T=null;var s=F.p;F.p=2;var c=De;De|=4;try{Ah(t,e);var u=Pc,p=qd(e.containerInfo),b=u.focusedElem,T=u.selectionRange;if(p!==b&&b&&b.ownerDocument&&Ed(b.ownerDocument.documentElement,b)){if(T!==null&&No(b)){var H=T.start,J=T.end;if(J===void 0&&(J=H),"selectionStart"in b)b.selectionStart=H,b.selectionEnd=Math.min(J,b.value.length);else{var P=b.ownerDocument||document,V=P&&P.defaultView||window;if(V.getSelection){var G=V.getSelection(),fe=b.textContent.length,ge=Math.min(T.start,fe),He=T.end===void 0?ge:Math.min(T.end,fe);!G.extend&&ge>He&&(p=He,He=ge,ge=p);var D=Cd(b,ge),_=Cd(b,He);if(D&&_&&(G.rangeCount!==1||G.anchorNode!==D.node||G.anchorOffset!==D.offset||G.focusNode!==_.node||G.focusOffset!==_.offset)){var U=P.createRange();U.setStart(D.node,D.offset),G.removeAllRanges(),ge>He?(G.addRange(U),G.extend(_.node,_.offset)):(U.setEnd(_.node,_.offset),G.addRange(U))}}}}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}}hr=!!Wc,Pc=Wc=null}finally{De=c,F.p=s,R.T=n}}e.current=t,ot=2}}function $h(){if(ot===2){ot=0;var e=aa,t=Al,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=R.T,R.T=null;var s=F.p;F.p=2;var c=De;De|=4;try{xh(e,t.alternate,t)}finally{De=c,F.p=s,R.T=n}}ot=3}}function Gh(){if(ot===4||ot===3){ot=0,$a();var e=aa,t=Al,n=kn,s=Th;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?ot=5:(ot=0,Al=aa=null,Xh(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(na=null),lo(n),t=t.stateNode,ve&&typeof ve.onCommitFiberRoot=="function")try{ve.onCommitFiberRoot(bt,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=R.T,c=F.p,F.p=2,R.T=null;try{for(var u=e.onRecoverableError,p=0;p<s.length;p++){var b=s[p];u(b.value,{componentStack:b.stack})}}finally{R.T=t,F.p=c}}(kn&3)!==0&&nr(),on(e),c=e.pendingLanes,(n&261930)!==0&&(c&42)!==0?e===Uc?Ns++:(Ns=0,Uc=e):Ns=0,ws(0)}}function Xh(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ss(t)))}function nr(){return Yh(),$h(),Gh(),Qh()}function Qh(){if(ot!==5)return!1;var e=aa,t=zc;zc=0;var n=lo(kn),s=R.T,c=F.p;try{F.p=32>n?32:n,R.T=null,n=Lc,Lc=null;var u=aa,p=kn;if(ot=0,Al=aa=null,kn=0,(De&6)!==0)throw Error(r(331));var b=De;if(De|=4,Eh(u.current),Nh(u,u.current,p,n),De=b,ws(0,!1),ve&&typeof ve.onPostCommitFiberRoot=="function")try{ve.onPostCommitFiberRoot(bt,u)}catch{}return!0}finally{F.p=c,R.T=s,Xh(e,t)}}function Kh(e,t,n){t=Vt(n,t),t=xc(e.stateNode,t,2),e=Jn(e,t,2),e!==null&&(Xl(e,2),on(e))}function Be(e,t,n){if(e.tag===3)Kh(e,e,n);else for(;t!==null;){if(t.tag===3){Kh(t,e,n);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(na===null||!na.has(s))){e=Vt(n,e),n=Zm(2),s=Jn(t,n,2),s!==null&&(Fm(n,s,t,e),Xl(s,2),on(s));break}}t=t.return}}function Yc(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new Tv;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)||(Dc=!0,c.add(n),e=Ov.bind(null,e,t,n),t.then(e,e))}function Ov(e,t,n){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ve===e&&(Ce&n)===n&&(We===4||We===3&&(Ce&62914560)===Ce&&300>ft()-Ji?(De&2)===0&&jl(e,0):Oc|=n,Sl===Ce&&(Sl=0)),on(e)}function Zh(e,t){t===0&&(t=Yf()),e=ja(e,t),e!==null&&(Xl(e,t),on(e))}function Bv(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Zh(e,n)}function zv(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),Zh(e,n)}function Lv(e,t){return Jt(e,t)}var ar=null,wl=null,$c=!1,lr=!1,Gc=!1,sa=0;function on(e){e!==wl&&e.next===null&&(wl===null?ar=wl=e:wl=wl.next=e),lr=!0,$c||($c=!0,Hv())}function ws(e,t){if(!Gc&&lr){Gc=!0;do for(var n=!1,s=ar;s!==null;){if(e!==0){var c=s.pendingLanes;if(c===0)var u=0;else{var p=s.suspendedLanes,b=s.pingedLanes;u=(1<<31-$e(42|e)+1)-1,u&=c&~(p&~b),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(n=!0,Wh(s,u))}else u=Ce,u=oi(s,s===Ve?u:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(u&3)===0||Gl(s,u)||(n=!0,Wh(s,u));s=s.next}while(n);Gc=!1}}function Uv(){Fh()}function Fh(){lr=$c=!1;var e=0;sa!==0&&Jv()&&(e=sa);for(var t=ft(),n=null,s=ar;s!==null;){var c=s.next,u=Jh(s,t);u===0?(s.next=null,n===null?ar=c:n.next=c,c===null&&(wl=n)):(n=s,(e!==0||(u&3)!==0)&&(lr=!0)),s=c}ot!==0&&ot!==5||ws(e),sa!==0&&(sa=0)}function Jh(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,c=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var p=31-$e(u),b=1<<p,T=c[p];T===-1?((b&n)===0||(b&s)!==0)&&(c[p]=dx(b,t)):T<=t&&(e.expiredLanes|=b),u&=~b}if(t=Ve,n=Ce,n=oi(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&&Tt(s),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||Gl(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(s!==null&&Tt(s),lo(n)){case 2:case 8:n=ga;break;case 32:n=xa;break;case 268435456:n=li;break;default:n=xa}return s=Ih.bind(null,e),n=Jt(n,s),e.callbackPriority=t,e.callbackNode=n,t}return s!==null&&s!==null&&Tt(s),e.callbackPriority=2,e.callbackNode=null,2}function Ih(e,t){if(ot!==0&&ot!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(nr()&&e.callbackNode!==n)return null;var s=Ce;return s=oi(e,e===Ve?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(kh(e,s,t),Jh(e,ft()),e.callbackNode!=null&&e.callbackNode===n?Ih.bind(null,e):null)}function Wh(e,t){if(nr())return null;kh(e,t,!0)}function Hv(){Wv(function(){(De&6)!==0?Jt(Ga,Uv):Fh()})}function Xc(){if(sa===0){var e=ul;e===0&&(e=Xa,Xa<<=1,(Xa&261888)===0&&(Xa=256)),sa=e}return sa}function Ph(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:di(""+e)}function ep(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 Vv(e,t,n,s,c){if(t==="submit"&&n&&n.stateNode===c){var u=Ph((c[At]||null).action),p=s.submitter;p&&(t=(t=p[At]||null)?Ph(t.formAction):p.getAttribute("formAction"),t!==null&&(u=t,p=null));var b=new gi("action","action",null,s,c);e.push({event:b,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(sa!==0){var T=p?ep(c,p):new FormData(c);fc(n,{pending:!0,data:T,method:c.method,action:u},null,T)}}else typeof u=="function"&&(b.preventDefault(),T=p?ep(c,p):new FormData(c),fc(n,{pending:!0,data:T,method:c.method,action:u},u,T))},currentTarget:c}]})}}for(var Qc=0;Qc<qo.length;Qc++){var Kc=qo[Qc],Yv=Kc.toLowerCase(),$v=Kc[0].toUpperCase()+Kc.slice(1);It(Yv,"on"+$v)}It(Rd,"onAnimationEnd"),It(kd,"onAnimationIteration"),It(_d,"onAnimationStart"),It("dblclick","onDoubleClick"),It("focusin","onFocus"),It("focusout","onBlur"),It(sv,"onTransitionRun"),It(iv,"onTransitionStart"),It(rv,"onTransitionCancel"),It(Dd,"onTransitionEnd"),Ja("onMouseEnter",["mouseout","mouseover"]),Ja("onMouseLeave",["mouseout","mouseover"]),Ja("onPointerEnter",["pointerout","pointerover"]),Ja("onPointerLeave",["pointerout","pointerover"]),ya("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ya("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ya("onBeforeInput",["compositionend","keypress","textInput","paste"]),ya("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ya("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ya("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Cs="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(" "),Gv=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Cs));function tp(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 p=s.length-1;0<=p;p--){var b=s[p],T=b.instance,H=b.currentTarget;if(b=b.listener,T!==u&&c.isPropagationStopped())break e;u=b,c.currentTarget=H;try{u(c)}catch(J){yi(J)}c.currentTarget=null,u=T}else for(p=0;p<s.length;p++){if(b=s[p],T=b.instance,H=b.currentTarget,b=b.listener,T!==u&&c.isPropagationStopped())break e;u=b,c.currentTarget=H;try{u(c)}catch(J){yi(J)}c.currentTarget=null,u=T}}}}function we(e,t){var n=t[so];n===void 0&&(n=t[so]=new Set);var s=e+"__bubble";n.has(s)||(np(t,e,2,!1),n.add(s))}function Zc(e,t,n){var s=0;t&&(s|=4),np(n,e,s,t)}var sr="_reactListening"+Math.random().toString(36).slice(2);function Fc(e){if(!e[sr]){e[sr]=!0,Ff.forEach(function(n){n!=="selectionchange"&&(Gv.has(n)||Zc(n,!1,e),Zc(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[sr]||(t[sr]=!0,Zc("selectionchange",!1,t))}}function np(e,t,n,s){switch(Rp(t)){case 2:var c=vy;break;case 8:c=yy;break;default:c=uu}n=c.bind(null,t,n,e),c=void 0,!po||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 Jc(e,t,n,s,c){var u=s;if((t&1)===0&&(t&2)===0&&s!==null)e:for(;;){if(s===null)return;var p=s.tag;if(p===3||p===4){var b=s.stateNode.containerInfo;if(b===c)break;if(p===4)for(p=s.return;p!==null;){var T=p.tag;if((T===3||T===4)&&p.stateNode.containerInfo===c)return;p=p.return}for(;b!==null;){if(p=Ka(b),p===null)return;if(T=p.tag,T===5||T===6||T===26||T===27){s=u=p;continue e}b=b.parentNode}}s=s.return}rd(function(){var H=u,J=mo(n),P=[];e:{var V=Od.get(e);if(V!==void 0){var G=gi,fe=e;switch(e){case"keypress":if(hi(n)===0)break e;case"keydown":case"keyup":G=zx;break;case"focusin":fe="focus",G=yo;break;case"focusout":fe="blur",G=yo;break;case"beforeblur":case"afterblur":G=yo;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=ud;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":G=wx;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":G=Hx;break;case Rd:case kd:case _d:G=qx;break;case Dd:G=Yx;break;case"scroll":case"scrollend":G=jx;break;case"wheel":G=Gx;break;case"copy":case"cut":case"paste":G=Tx;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":G=dd;break;case"toggle":case"beforetoggle":G=Qx}var ge=(t&4)!==0,He=!ge&&(e==="scroll"||e==="scrollend"),D=ge?V!==null?V+"Capture":null:V;ge=[];for(var _=H,U;_!==null;){var I=_;if(U=I.stateNode,I=I.tag,I!==5&&I!==26&&I!==27||U===null||D===null||(I=Zl(_,D),I!=null&&ge.push(Es(_,I,U))),He)break;_=_.return}0<ge.length&&(V=new G(V,fe,null,n,J),P.push({event:V,listeners:ge}))}}if((t&7)===0){e:{if(V=e==="mouseover"||e==="pointerover",G=e==="mouseout"||e==="pointerout",V&&n!==fo&&(fe=n.relatedTarget||n.fromElement)&&(Ka(fe)||fe[Qa]))break e;if((G||V)&&(V=J.window===J?J:(V=J.ownerDocument)?V.defaultView||V.parentWindow:window,G?(fe=n.relatedTarget||n.toElement,G=H,fe=fe?Ka(fe):null,fe!==null&&(He=d(fe),ge=fe.tag,fe!==He||ge!==5&&ge!==27&&ge!==6)&&(fe=null)):(G=null,fe=H),G!==fe)){if(ge=ud,I="onMouseLeave",D="onMouseEnter",_="mouse",(e==="pointerout"||e==="pointerover")&&(ge=dd,I="onPointerLeave",D="onPointerEnter",_="pointer"),He=G==null?V:Kl(G),U=fe==null?V:Kl(fe),V=new ge(I,_+"leave",G,n,J),V.target=He,V.relatedTarget=U,I=null,Ka(J)===H&&(ge=new ge(D,_+"enter",fe,n,J),ge.target=U,ge.relatedTarget=He,I=ge),He=I,G&&fe)t:{for(ge=Xv,D=G,_=fe,U=0,I=D;I;I=ge(I))U++;I=0;for(var me=_;me;me=ge(me))I++;for(;0<U-I;)D=ge(D),U--;for(;0<I-U;)_=ge(_),I--;for(;U--;){if(D===_||_!==null&&D===_.alternate){ge=D;break t}D=ge(D),_=ge(_)}ge=null}else ge=null;G!==null&&ap(P,V,G,ge,!1),fe!==null&&He!==null&&ap(P,He,fe,ge,!0)}}e:{if(V=H?Kl(H):window,G=V.nodeName&&V.nodeName.toLowerCase(),G==="select"||G==="input"&&V.type==="file")var ke=bd;else if(vd(V))if(Sd)ke=nv;else{ke=ev;var de=Px}else G=V.nodeName,!G||G.toLowerCase()!=="input"||V.type!=="checkbox"&&V.type!=="radio"?H&&uo(H.elementType)&&(ke=bd):ke=tv;if(ke&&(ke=ke(e,H))){yd(P,ke,n,J);break e}de&&de(e,V,H),e==="focusout"&&H&&V.type==="number"&&H.memoizedProps.value!=null&&co(V,"number",V.value)}switch(de=H?Kl(H):window,e){case"focusin":(vd(de)||de.contentEditable==="true")&&(nl=de,wo=H,ns=null);break;case"focusout":ns=wo=nl=null;break;case"mousedown":Co=!0;break;case"contextmenu":case"mouseup":case"dragend":Co=!1,Md(P,n,J);break;case"selectionchange":if(lv)break;case"keydown":case"keyup":Md(P,n,J)}var Ae;if(So)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 tl?gd(e,n)&&(Ee="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(Ee="onCompositionStart");Ee&&(md&&n.locale!=="ko"&&(tl||Ee!=="onCompositionStart"?Ee==="onCompositionEnd"&&tl&&(Ae=od()):($n=J,go="value"in $n?$n.value:$n.textContent,tl=!0)),de=ir(H,Ee),0<de.length&&(Ee=new fd(Ee,e,null,n,J),P.push({event:Ee,listeners:de}),Ae?Ee.data=Ae:(Ae=xd(n),Ae!==null&&(Ee.data=Ae)))),(Ae=Zx?Fx(e,n):Jx(e,n))&&(Ee=ir(H,"onBeforeInput"),0<Ee.length&&(de=new fd("onBeforeInput","beforeinput",null,n,J),P.push({event:de,listeners:Ee}),de.data=Ae)),Vv(P,e,H,n,J)}tp(P,t)})}function Es(e,t,n){return{instance:e,listener:t,currentTarget:n}}function ir(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=Zl(e,n),c!=null&&s.unshift(Es(e,c,u)),c=Zl(e,t),c!=null&&s.push(Es(e,c,u))),e.tag===3)return s;e=e.return}return[]}function Xv(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function ap(e,t,n,s,c){for(var u=t._reactName,p=[];n!==null&&n!==s;){var b=n,T=b.alternate,H=b.stateNode;if(b=b.tag,T!==null&&T===s)break;b!==5&&b!==26&&b!==27||H===null||(T=H,c?(H=Zl(n,u),H!=null&&p.unshift(Es(n,H,T))):c||(H=Zl(n,u),H!=null&&p.push(Es(n,H,T)))),n=n.return}p.length!==0&&e.push({event:t,listeners:p})}var Qv=/\r\n?/g,Kv=/\u0000|\uFFFD/g;function lp(e){return(typeof e=="string"?e:""+e).replace(Qv,`
|
||
`).replace(Kv,"")}function sp(e,t){return t=lp(t),lp(e)===t}function Ue(e,t,n,s,c,u){switch(n){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||Wa(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&Wa(e,""+s);break;case"className":ui(e,"class",s);break;case"tabIndex":ui(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":ui(e,n,s);break;case"style":sd(e,s,u);break;case"data":if(t!=="object"){ui(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=di(""+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"&&Ue(e,t,"name",c.name,c,null),Ue(e,t,"formEncType",c.formEncType,c,null),Ue(e,t,"formMethod",c.formMethod,c,null),Ue(e,t,"formTarget",c.formTarget,c,null)):(Ue(e,t,"encType",c.encType,c,null),Ue(e,t,"method",c.method,c,null),Ue(e,t,"target",c.target,c,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(n);break}s=di(""+s),e.setAttribute(n,s);break;case"onClick":s!=null&&(e.onclick=xn);break;case"onScroll":s!=null&&we("scroll",e);break;case"onScrollEnd":s!=null&&we("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=di(""+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":we("beforetoggle",e),we("toggle",e),ci(e,"popover",s);break;case"xlinkActuate":gn(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":gn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":gn(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":gn(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":gn(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":gn(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":gn(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":gn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":gn(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":ci(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=Sx.get(n)||n,ci(e,n,s))}}function Ic(e,t,n,s,c,u){switch(n){case"style":sd(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"?Wa(e,s):(typeof s=="number"||typeof s=="bigint")&&Wa(e,""+s);break;case"onScroll":s!=null&&we("scroll",e);break;case"onScrollEnd":s!=null&&we("scrollend",e);break;case"onClick":s!=null&&(e.onclick=xn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Jf.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[At]||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,""):ci(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":we("error",e),we("load",e);var s=!1,c=!1,u;for(u in n)if(n.hasOwnProperty(u)){var p=n[u];if(p!=null)switch(u){case"src":s=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:Ue(e,t,u,p,n,null)}}c&&Ue(e,t,"srcSet",n.srcSet,n,null),s&&Ue(e,t,"src",n.src,n,null);return;case"input":we("invalid",e);var b=u=p=c=null,T=null,H=null;for(s in n)if(n.hasOwnProperty(s)){var J=n[s];if(J!=null)switch(s){case"name":c=J;break;case"type":p=J;break;case"checked":T=J;break;case"defaultChecked":H=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:Ue(e,t,s,J,n,null)}}td(e,u,b,T,H,p,c,!1);return;case"select":we("invalid",e),s=p=u=null;for(c in n)if(n.hasOwnProperty(c)&&(b=n[c],b!=null))switch(c){case"value":u=b;break;case"defaultValue":p=b;break;case"multiple":s=b;default:Ue(e,t,c,b,n,null)}t=u,n=p,e.multiple=!!s,t!=null?Ia(e,!!s,t,!1):n!=null&&Ia(e,!!s,n,!0);return;case"textarea":we("invalid",e),u=c=s=null;for(p in n)if(n.hasOwnProperty(p)&&(b=n[p],b!=null))switch(p){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:Ue(e,t,p,b,n,null)}ad(e,s,c,u);return;case"option":for(T in n)if(n.hasOwnProperty(T)&&(s=n[T],s!=null))switch(T){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:Ue(e,t,T,s,n,null)}return;case"dialog":we("beforetoggle",e),we("toggle",e),we("cancel",e),we("close",e);break;case"iframe":case"object":we("load",e);break;case"video":case"audio":for(s=0;s<Cs.length;s++)we(Cs[s],e);break;case"image":we("error",e),we("load",e);break;case"details":we("toggle",e);break;case"embed":case"source":case"link":we("error",e),we("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(H in n)if(n.hasOwnProperty(H)&&(s=n[H],s!=null))switch(H){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:Ue(e,t,H,s,n,null)}return;default:if(uo(t)){for(J in n)n.hasOwnProperty(J)&&(s=n[J],s!==void 0&&Ic(e,t,J,s,n,void 0));return}}for(b in n)n.hasOwnProperty(b)&&(s=n[b],s!=null&&Ue(e,t,b,s,n,null))}function Zv(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,p=null,b=null,T=null,H=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":T=P;default:s.hasOwnProperty(G)||Ue(e,t,G,null,s,P)}}for(var V in s){var G=s[V];if(P=n[V],s.hasOwnProperty(V)&&(G!=null||P!=null))switch(V){case"type":u=G;break;case"name":c=G;break;case"checked":H=G;break;case"defaultChecked":J=G;break;case"value":p=G;break;case"defaultValue":b=G;break;case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(r(137,t));break;default:G!==P&&Ue(e,t,V,G,s,P)}}oo(e,p,b,T,H,J,u,c);return;case"select":G=p=b=V=null;for(u in n)if(T=n[u],n.hasOwnProperty(u)&&T!=null)switch(u){case"value":break;case"multiple":G=T;default:s.hasOwnProperty(u)||Ue(e,t,u,null,s,T)}for(c in s)if(u=s[c],T=n[c],s.hasOwnProperty(c)&&(u!=null||T!=null))switch(c){case"value":V=u;break;case"defaultValue":b=u;break;case"multiple":p=u;default:u!==T&&Ue(e,t,c,u,s,T)}t=b,n=p,s=G,V!=null?Ia(e,!!n,V,!1):!!s!=!!n&&(t!=null?Ia(e,!!n,t,!0):Ia(e,!!n,n?[]:"",!1));return;case"textarea":G=V=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:Ue(e,t,b,null,s,c)}for(p in s)if(c=s[p],u=n[p],s.hasOwnProperty(p)&&(c!=null||u!=null))switch(p){case"value":V=c;break;case"defaultValue":G=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(r(91));break;default:c!==u&&Ue(e,t,p,c,s,u)}nd(e,V,G);return;case"option":for(var fe in n)if(V=n[fe],n.hasOwnProperty(fe)&&V!=null&&!s.hasOwnProperty(fe))switch(fe){case"selected":e.selected=!1;break;default:Ue(e,t,fe,null,s,V)}for(T in s)if(V=s[T],G=n[T],s.hasOwnProperty(T)&&V!==G&&(V!=null||G!=null))switch(T){case"selected":e.selected=V&&typeof V!="function"&&typeof V!="symbol";break;default:Ue(e,t,T,V,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)V=n[ge],n.hasOwnProperty(ge)&&V!=null&&!s.hasOwnProperty(ge)&&Ue(e,t,ge,null,s,V);for(H in s)if(V=s[H],G=n[H],s.hasOwnProperty(H)&&V!==G&&(V!=null||G!=null))switch(H){case"children":case"dangerouslySetInnerHTML":if(V!=null)throw Error(r(137,t));break;default:Ue(e,t,H,V,s,G)}return;default:if(uo(t)){for(var He in n)V=n[He],n.hasOwnProperty(He)&&V!==void 0&&!s.hasOwnProperty(He)&&Ic(e,t,He,void 0,s,V);for(J in s)V=s[J],G=n[J],!s.hasOwnProperty(J)||V===G||V===void 0&&G===void 0||Ic(e,t,J,V,s,G);return}}for(var D in n)V=n[D],n.hasOwnProperty(D)&&V!=null&&!s.hasOwnProperty(D)&&Ue(e,t,D,null,s,V);for(P in s)V=s[P],G=n[P],!s.hasOwnProperty(P)||V===G||V==null&&G==null||Ue(e,t,P,V,s,G)}function ip(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Fv(){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,p=c.initiatorType,b=c.duration;if(u&&b&&ip(p)){for(p=0,b=c.responseEnd,s+=1;s<n.length;s++){var T=n[s],H=T.startTime;if(H>b)break;var J=T.transferSize,P=T.initiatorType;J&&ip(P)&&(T=T.responseEnd,p+=J*(T<b?1:(b-H)/(T-H)))}if(--s,t+=8*(u+p)/(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 Wc=null,Pc=null;function rr(e){return e.nodeType===9?e:e.ownerDocument}function rp(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 op(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 eu(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 tu=null;function Jv(){var e=window.event;return e&&e.type==="popstate"?e===tu?!1:(tu=e,!0):(tu=null,!1)}var cp=typeof setTimeout=="function"?setTimeout:void 0,Iv=typeof clearTimeout=="function"?clearTimeout:void 0,up=typeof Promise=="function"?Promise:void 0,Wv=typeof queueMicrotask=="function"?queueMicrotask:typeof up<"u"?function(e){return up.resolve(null).then(e).catch(Pv)}:cp;function Pv(e){setTimeout(function(){throw e})}function ia(e){return e==="head"}function fp(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),Ml(t);return}s--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")s++;else if(n==="html")qs(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,qs(n);for(var u=n.firstChild;u;){var p=u.nextSibling,b=u.nodeName;u[Ql]||b==="SCRIPT"||b==="STYLE"||b==="LINK"&&u.rel.toLowerCase()==="stylesheet"||n.removeChild(u),u=p}}else n==="body"&&qs(e.ownerDocument.body);n=c}while(n);Ml(t)}function dp(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 nu(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":nu(n),io(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function ey(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[Ql])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=Qt(e.nextSibling),e===null)break}return null}function ty(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Qt(e.nextSibling),e===null))return null;return e}function mp(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Qt(e.nextSibling),e===null))return null;return e}function au(e){return e.data==="$?"||e.data==="$~"}function lu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function ny(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 Qt(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var su=null;function hp(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return Qt(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function pp(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 gp(e,t,n){switch(t=rr(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 qs(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);io(e)}var Kt=new Map,xp=new Set;function or(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var _n=F.d;F.d={f:ay,r:ly,D:sy,C:iy,L:ry,m:oy,X:uy,S:cy,M:fy};function ay(){var e=_n.f(),t=Pi();return e||t}function ly(e){var t=Za(e);t!==null&&t.tag===5&&t.type==="form"?Dm(t):_n.r(e)}var Cl=typeof document>"u"?null:document;function vp(e,t,n){var s=Cl;if(s&&typeof t=="string"&&t){var c=Ut(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof n=="string"&&(c+='[crossorigin="'+n+'"]'),xp.has(c)||(xp.add(c),e={rel:e,crossOrigin:n,href:t},s.querySelector(c)===null&&(t=s.createElement("link"),gt(t,"link",e),ct(t),s.head.appendChild(t)))}}function sy(e){_n.D(e),vp("dns-prefetch",e,null)}function iy(e,t){_n.C(e,t),vp("preconnect",e,t)}function ry(e,t,n){_n.L(e,t,n);var s=Cl;if(s&&e&&t){var c='link[rel="preload"][as="'+Ut(t)+'"]';t==="image"&&n&&n.imageSrcSet?(c+='[imagesrcset="'+Ut(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(c+='[imagesizes="'+Ut(n.imageSizes)+'"]')):c+='[href="'+Ut(e)+'"]';var u=c;switch(t){case"style":u=El(e);break;case"script":u=ql(e)}Kt.has(u)||(e=S({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Kt.set(u,e),s.querySelector(c)!==null||t==="style"&&s.querySelector(Ms(u))||t==="script"&&s.querySelector(Ts(u))||(t=s.createElement("link"),gt(t,"link",e),ct(t),s.head.appendChild(t)))}}function oy(e,t){_n.m(e,t);var n=Cl;if(n&&e){var s=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+Ut(s)+'"][href="'+Ut(e)+'"]',u=c;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=ql(e)}if(!Kt.has(u)&&(e=S({rel:"modulepreload",href:e},t),Kt.set(u,e),n.querySelector(c)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Ts(u)))return}s=n.createElement("link"),gt(s,"link",e),ct(s),n.head.appendChild(s)}}}function cy(e,t,n){_n.S(e,t,n);var s=Cl;if(s&&e){var c=Fa(s).hoistableStyles,u=El(e);t=t||"default";var p=c.get(u);if(!p){var b={loading:0,preload:null};if(p=s.querySelector(Ms(u)))b.loading=5;else{e=S({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Kt.get(u))&&iu(e,n);var T=p=s.createElement("link");ct(T),gt(T,"link",e),T._p=new Promise(function(H,J){T.onload=H,T.onerror=J}),T.addEventListener("load",function(){b.loading|=1}),T.addEventListener("error",function(){b.loading|=2}),b.loading|=4,cr(p,t,s)}p={type:"stylesheet",instance:p,count:1,state:b},c.set(u,p)}}}function uy(e,t){_n.X(e,t);var n=Cl;if(n&&e){var s=Fa(n).hoistableScripts,c=ql(e),u=s.get(c);u||(u=n.querySelector(Ts(c)),u||(e=S({src:e,async:!0},t),(t=Kt.get(c))&&ru(e,t),u=n.createElement("script"),ct(u),gt(u,"link",e),n.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},s.set(c,u))}}function fy(e,t){_n.M(e,t);var n=Cl;if(n&&e){var s=Fa(n).hoistableScripts,c=ql(e),u=s.get(c);u||(u=n.querySelector(Ts(c)),u||(e=S({src:e,async:!0,type:"module"},t),(t=Kt.get(c))&&ru(e,t),u=n.createElement("script"),ct(u),gt(u,"link",e),n.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},s.set(c,u))}}function yp(e,t,n,s){var c=(c=ie.current)?or(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=El(n.href),n=Fa(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=El(n.href);var u=Fa(c).hoistableStyles,p=u.get(e);if(p||(c=c.ownerDocument||c,p={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,p),(u=c.querySelector(Ms(e)))&&!u._p&&(p.instance=u,p.state.loading=5),Kt.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},Kt.set(e,n),u||dy(c,e,n,p.state))),t&&s===null)throw Error(r(528,""));return p}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=ql(n),n=Fa(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 El(e){return'href="'+Ut(e)+'"'}function Ms(e){return'link[rel="stylesheet"]['+e+"]"}function bp(e){return S({},e,{"data-precedence":e.precedence,precedence:null})}function dy(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),ct(t),e.head.appendChild(t))}function ql(e){return'[src="'+Ut(e)+'"]'}function Ts(e){return"script[async]"+e}function Sp(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+Ut(n.href)+'"]');if(s)return t.instance=s,ct(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"),ct(s),gt(s,"style",c),cr(s,n.precedence,e),t.instance=s;case"stylesheet":c=El(n.href);var u=e.querySelector(Ms(c));if(u)return t.state.loading|=4,t.instance=u,ct(u),u;s=bp(n),(c=Kt.get(c))&&iu(s,c),u=(e.ownerDocument||e).createElement("link"),ct(u);var p=u;return p._p=new Promise(function(b,T){p.onload=b,p.onerror=T}),gt(u,"link",s),t.state.loading|=4,cr(u,n.precedence,e),t.instance=u;case"script":return u=ql(n.src),(c=e.querySelector(Ts(u)))?(t.instance=c,ct(c),c):(s=n,(c=Kt.get(u))&&(s=S({},n),ru(s,c)),e=e.ownerDocument||e,c=e.createElement("script"),ct(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,cr(s,n.precedence,e));return t.instance}function cr(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,p=0;p<s.length;p++){var b=s[p];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 iu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function ru(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var ur=null;function Ap(e,t,n){if(ur===null){var s=new Map,c=ur=new Map;c.set(n,s)}else c=ur,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[Ql]||u[dt]||e==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var p=u.getAttribute(t)||"";p=e+p;var b=s.get(p);b?b.push(u):s.set(p,[u])}}return s}function jp(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function my(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 Np(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function hy(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=El(s.href),u=t.querySelector(Ms(c));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=fr.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=u,ct(u);return}u=t.ownerDocument||t,s=bp(s),(c=Kt.get(c))&&iu(s,c),u=u.createElement("link"),ct(u);var p=u;p._p=new Promise(function(b,T){p.onload=b,p.onerror=T}),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=fr.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var ou=0;function py(e,t){return e.stylesheets&&e.count===0&&mr(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var s=setTimeout(function(){if(e.stylesheets&&mr(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&ou===0&&(ou=62500*Fv());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&mr(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>ou?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(c)}}:null}function fr(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)mr(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var dr=null;function mr(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,dr=new Map,t.forEach(gy,e),dr=null,fr.call(e))}function gy(e,t){if(!(t.state.loading&4)){var n=dr.get(e);if(n)var s=n.get(null);else{n=new Map,dr.set(e,n);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<c.length;u++){var p=c[u];(p.nodeName==="LINK"||p.getAttribute("media")!=="not all")&&(n.set(p.dataset.precedence,p),s=p)}s&&n.set(null,s)}c=t.instance,p=c.getAttribute("data-precedence"),u=n.get(p)||s,u===s&&n.set(null,c),n.set(p,c),this.count++,s=fr.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 Rs={$$typeof:k,Provider:null,Consumer:null,_currentValue:ne,_currentValue2:ne,_threadCount:0};function xy(e,t,n,s,c,u,p,b,T){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=no(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=no(0),this.hiddenUpdates=no(null),this.identifierPrefix=s,this.onUncaughtError=c,this.onCaughtError=u,this.onRecoverableError=p,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=T,this.incompleteTransitions=new Map}function wp(e,t,n,s,c,u,p,b,T,H,J,P){return e=new xy(e,t,n,p,T,H,J,P,b),t=1,u===!0&&(t|=24),u=kt(3,null,null,t),e.current=u,u.stateNode=e,t=Vo(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:s,isDehydrated:n,cache:t},Xo(u),e}function Cp(e){return e?(e=sl,e):sl}function Ep(e,t,n,s,c,u){c=Cp(c),s.context===null?s.context=c:s.pendingContext=c,s=Fn(t),s.payload={element:n},u=u===void 0?null:u,u!==null&&(s.callback=u),n=Jn(e,s,t),n!==null&&(qt(n,e,t),cs(n,e,t))}function qp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function cu(e,t){qp(e,t),(e=e.alternate)&&qp(e,t)}function Mp(e){if(e.tag===13||e.tag===31){var t=ja(e,67108864);t!==null&&qt(t,e,67108864),cu(e,67108864)}}function Tp(e){if(e.tag===13||e.tag===31){var t=zt();t=ao(t);var n=ja(e,t);n!==null&&qt(n,e,t),cu(e,t)}}var hr=!0;function vy(e,t,n,s){var c=R.T;R.T=null;var u=F.p;try{F.p=2,uu(e,t,n,s)}finally{F.p=u,R.T=c}}function yy(e,t,n,s){var c=R.T;R.T=null;var u=F.p;try{F.p=8,uu(e,t,n,s)}finally{F.p=u,R.T=c}}function uu(e,t,n,s){if(hr){var c=fu(s);if(c===null)Jc(e,t,s,pr,n),kp(e,s);else if(Sy(c,e,t,n,s))s.stopPropagation();else if(kp(e,s),t&4&&-1<by.indexOf(e)){for(;c!==null;){var u=Za(c);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var p=va(u.pendingLanes);if(p!==0){var b=u;for(b.pendingLanes|=2,b.entangledLanes|=2;p;){var T=1<<31-$e(p);b.entanglements[1]|=T,p&=~T}on(u),(De&6)===0&&(Ii=ft()+500,ws(0))}}break;case 31:case 13:b=ja(u,2),b!==null&&qt(b,u,2),Pi(),cu(u,2)}if(u=fu(s),u===null&&Jc(e,t,s,pr,n),u===c)break;c=u}c!==null&&s.stopPropagation()}else Jc(e,t,s,null,n)}}function fu(e){return e=mo(e),du(e)}var pr=null;function du(e){if(pr=null,e=Ka(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=g(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 pr=e,null}function Rp(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(pa()){case Ga:return 2;case ga:return 8;case xa:case eo:return 32;case li:return 268435456;default:return 32}default:return 32}}var mu=!1,ra=null,oa=null,ca=null,ks=new Map,_s=new Map,ua=[],by="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 kp(e,t){switch(e){case"focusin":case"focusout":ra=null;break;case"dragenter":case"dragleave":oa=null;break;case"mouseover":case"mouseout":ca=null;break;case"pointerover":case"pointerout":ks.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":_s.delete(t.pointerId)}}function Ds(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=Za(t),t!==null&&Mp(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function Sy(e,t,n,s,c){switch(t){case"focusin":return ra=Ds(ra,e,t,n,s,c),!0;case"dragenter":return oa=Ds(oa,e,t,n,s,c),!0;case"mouseover":return ca=Ds(ca,e,t,n,s,c),!0;case"pointerover":var u=c.pointerId;return ks.set(u,Ds(ks.get(u)||null,e,t,n,s,c)),!0;case"gotpointercapture":return u=c.pointerId,_s.set(u,Ds(_s.get(u)||null,e,t,n,s,c)),!0}return!1}function _p(e){var t=Ka(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,Kf(e.priority,function(){Tp(n)});return}}else if(t===31){if(t=g(n),t!==null){e.blockedOn=t,Kf(e.priority,function(){Tp(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 gr(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=fu(e.nativeEvent);if(n===null){n=e.nativeEvent;var s=new n.constructor(n.type,n);fo=s,n.target.dispatchEvent(s),fo=null}else return t=Za(n),t!==null&&Mp(t),e.blockedOn=n,!1;t.shift()}return!0}function Dp(e,t,n){gr(e)&&n.delete(t)}function Ay(){mu=!1,ra!==null&&gr(ra)&&(ra=null),oa!==null&&gr(oa)&&(oa=null),ca!==null&&gr(ca)&&(ca=null),ks.forEach(Dp),_s.forEach(Dp)}function xr(e,t){e.blockedOn===t&&(e.blockedOn=null,mu||(mu=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,Ay)))}var vr=null;function Op(e){vr!==e&&(vr=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){vr===e&&(vr=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(du(s||n)===null)continue;break}var u=Za(n);u!==null&&(e.splice(t,3),t-=3,fc(u,{pending:!0,data:c,method:n.method,action:s},s,c))}}))}function Ml(e){function t(T){return xr(T,e)}ra!==null&&xr(ra,e),oa!==null&&xr(oa,e),ca!==null&&xr(ca,e),ks.forEach(t),_s.forEach(t);for(var n=0;n<ua.length;n++){var s=ua[n];s.blockedOn===e&&(s.blockedOn=null)}for(;0<ua.length&&(n=ua[0],n.blockedOn===null);)_p(n),n.blockedOn===null&&ua.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],p=c[At]||null;if(typeof u=="function")p||Op(n);else if(p){var b=null;if(u&&u.hasAttribute("formAction")){if(c=u,p=u[At]||null)b=p.formAction;else if(du(c)!==null)continue}else b=p.action;typeof b=="function"?n[s+1]=b:(n.splice(s,3),s-=3),Op(n)}}}function Bp(){function e(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(p){return c=p})},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 hu(e){this._internalRoot=e}yr.prototype.render=hu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));var n=t.current,s=zt();Ep(n,s,e,t,null,null)},yr.prototype.unmount=hu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Ep(e.current,2,null,e,null,null),Pi(),t[Qa]=null}};function yr(e){this._internalRoot=e}yr.prototype.unstable_scheduleHydration=function(e){if(e){var t=Qf();e={blockedOn:null,target:e,priority:t};for(var n=0;n<ua.length&&t!==0&&t<ua[n].priority;n++);ua.splice(n,0,e),n===0&&_p(e)}};var zp=l.version;if(zp!=="19.2.0")throw Error(r(527,zp,"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 jy={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:R,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var br=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!br.isDisabled&&br.supportsFiber)try{bt=br.inject(jy),ve=br}catch{}}return Bs.createRoot=function(e,t){if(!f(e))throw Error(r(299));var n=!1,s="",c=Gm,u=Xm,p=Qm;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&&(p=t.onRecoverableError)),t=wp(e,1,!1,null,null,n,s,null,c,u,p,Bp),e[Qa]=t.current,Fc(e),new hu(t)},Bs.hydrateRoot=function(e,t,n){if(!f(e))throw Error(r(299));var s=!1,c="",u=Gm,p=Xm,b=Qm,T=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&&(p=n.onCaughtError),n.onRecoverableError!==void 0&&(b=n.onRecoverableError),n.formState!==void 0&&(T=n.formState)),t=wp(e,1,!0,t,n??null,s,c,T,u,p,b,Bp),t.context=Cp(null),n=t.current,s=zt(),s=ao(s),c=Fn(s),c.callback=null,Jn(n,c,s),n=s,t.current.lanes=n,Xl(t,n),on(t),e[Qa]=t.current,Fc(e),new yr(t)},Bs.version="19.2.0",Bs}var Kp;function Dy(){if(Kp)return xu.exports;Kp=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(),xu.exports=_y(),xu.exports}var Oy=Dy();var Zp="popstate";function By(a={}){function l(r,f){let{pathname:d,search:h,hash:g}=r.location;return Xu("",{pathname:d,search:h,hash:g},f.state&&f.state.usr||null,f.state&&f.state.key||"default")}function i(r,f){return typeof f=="string"?f:Ks(f)}return Ly(l,i,null,a)}function Je(a,l){if(a===!1||a===null||typeof a>"u")throw new Error(l)}function an(a,l){if(!a){typeof console<"u"&&console.warn(l);try{throw new Error(l)}catch{}}}function zy(){return Math.random().toString(36).substring(2,10)}function Fp(a,l){return{usr:a.state,key:a.key,idx:l}}function Xu(a,l,i=null,r){return{pathname:typeof a=="string"?a:a.pathname,search:"",hash:"",...typeof l=="string"?Hl(l):l,state:i,key:l&&l.key||r||zy()}}function Ks({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 Hl(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 Ly(a,l,i,r={}){let{window:f=document.defaultView,v5Compat:d=!1}=r,h=f.history,g="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(){g="POP";let j=y(),q=j==null?null:j-v;v=j,x&&x({action:g,location:N.location,delta:q})}function w(j,q){g="PUSH";let A=Xu(N.location,j,q);v=y()+1;let k=Fp(A,v),B=N.createHref(A);try{h.pushState(k,"",B)}catch(L){if(L instanceof DOMException&&L.name==="DataCloneError")throw L;f.location.assign(B)}d&&x&&x({action:g,location:N.location,delta:1})}function M(j,q){g="REPLACE";let A=Xu(N.location,j,q);v=y();let k=Fp(A,v),B=N.createHref(A);h.replaceState(k,"",B),d&&x&&x({action:g,location:N.location,delta:0})}function C(j){return Uy(j)}let N={get action(){return g},get location(){return a(f,h)},listen(j){if(x)throw new Error("A history only accepts one active listener");return f.addEventListener(Zp,S),x=j,()=>{f.removeEventListener(Zp,S),x=null}},createHref(j){return l(f,j)},createURL:C,encodeLocation(j){let q=C(j);return{pathname:q.pathname,search:q.search,hash:q.hash}},push:w,replace:M,go(j){return h.go(j)}};return N}function Uy(a,l=!1){let i="http://localhost";typeof window<"u"&&(i=window.location.origin!=="null"?window.location.origin:window.location.href),Je(i,"No window.location.(origin|href) available to create URL");let r=typeof a=="string"?a:Ks(a);return r=r.replace(/ $/,"%20"),!l&&r.startsWith("//")&&(r=i+r),new URL(r,i)}function H0(a,l,i="/"){return Hy(a,l,i,!1)}function Hy(a,l,i,r){let f=typeof l=="string"?Hl(l):l,d=Un(f.pathname||"/",i);if(d==null)return null;let h=V0(a);Vy(h);let g=null;for(let x=0;g==null&&x<h.length;++x){let v=Wy(d);g=Jy(h[x],v,r)}return g}function V0(a,l=[],i=[],r="",f=!1){let d=(h,g,x=f,v)=>{let y={relativePath:v===void 0?h.path||"":v,caseSensitive:h.caseSensitive===!0,childrenIndex:g,route:h};if(y.relativePath.startsWith("/")){if(!y.relativePath.startsWith(r)&&x)return;Je(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=Ln([r,y.relativePath]),w=i.concat(y);h.children&&h.children.length>0&&(Je(h.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${S}".`),V0(h.children,l,w,S,x)),!(h.path==null&&!h.index)&&l.push({path:S,score:Zy(S,h.index),routesMeta:w})};return a.forEach((h,g)=>{if(h.path===""||!h.path?.includes("?"))d(h,g);else for(let x of Y0(h.path))d(h,g,!0,x)}),l}function Y0(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=Y0(r.join("/")),g=[];return g.push(...h.map(x=>x===""?d:[d,x].join("/"))),f&&g.push(...h),g.map(x=>a.startsWith("/")&&x===""?"/":x)}function Vy(a){a.sort((l,i)=>l.score!==i.score?i.score-l.score:Fy(l.routesMeta.map(r=>r.childrenIndex),i.routesMeta.map(r=>r.childrenIndex)))}var Yy=/^:[\w-]+$/,$y=3,Gy=2,Xy=1,Qy=10,Ky=-2,Jp=a=>a==="*";function Zy(a,l){let i=a.split("/"),r=i.length;return i.some(Jp)&&(r+=Ky),l&&(r+=Gy),i.filter(f=>!Jp(f)).reduce((f,d)=>f+(Yy.test(d)?$y:d===""?Xy:Qy),r)}function Fy(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 Jy(a,l,i=!1){let{routesMeta:r}=a,f={},d="/",h=[];for(let g=0;g<r.length;++g){let x=r[g],v=g===r.length-1,y=d==="/"?l:l.slice(d.length)||"/",S=zr({path:x.relativePath,caseSensitive:x.caseSensitive,end:v},y),w=x.route;if(!S&&v&&i&&!r[r.length-1].route.index&&(S=zr({path:x.relativePath,caseSensitive:x.caseSensitive,end:!1},y)),!S)return null;Object.assign(f,S.params),h.push({params:f,pathname:Ln([d,S.pathname]),pathnameBase:ab(Ln([d,S.pathnameBase])),route:w}),S.pathnameBase!=="/"&&(d=Ln([d,S.pathnameBase]))}return h}function zr(a,l){typeof a=="string"&&(a={path:a,caseSensitive:!1,end:!0});let[i,r]=Iy(a.path,a.caseSensitive,a.end),f=l.match(i);if(!f)return null;let d=f[0],h=d.replace(/(.)\/+$/,"$1"),g=f.slice(1);return{params:r.reduce((v,{paramName:y,isOptional:S},w)=>{if(y==="*"){let C=g[w]||"";h=d.slice(0,d.length-C.length).replace(/(.)\/+$/,"$1")}const M=g[w];return S&&!M?v[y]=void 0:v[y]=(M||"").replace(/%2F/g,"/"),v},{}),pathname:d,pathnameBase:h,pattern:a}}function Iy(a,l=!1,i=!0){an(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,g,x)=>(r.push({paramName:g,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 Wy(a){try{return a.split("/").map(l=>decodeURIComponent(l).replace(/\//g,"%2F")).join("/")}catch(l){return an(!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 Un(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 Py=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,eb=a=>Py.test(a);function tb(a,l="/"){let{pathname:i,search:r="",hash:f=""}=typeof a=="string"?Hl(a):a,d;if(i)if(eb(i))d=i;else{if(i.includes("//")){let h=i;i=i.replace(/\/\/+/g,"/"),an(!1,`Pathnames cannot have embedded double slashes - normalizing ${h} -> ${i}`)}i.startsWith("/")?d=Ip(i.substring(1),"/"):d=Ip(i,l)}else d=l;return{pathname:d,search:lb(r),hash:sb(f)}}function Ip(a,l){let i=l.replace(/\/+$/,"").split("/");return a.split("/").forEach(f=>{f===".."?i.length>1&&i.pop():f!=="."&&i.push(f)}),i.length>1?i.join("/"):"/"}function Su(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 nb(a){return a.filter((l,i)=>i===0||l.route.path&&l.route.path.length>0)}function $0(a){let l=nb(a);return l.map((i,r)=>r===l.length-1?i.pathname:i.pathnameBase)}function G0(a,l,i,r=!1){let f;typeof a=="string"?f=Hl(a):(f={...a},Je(!f.pathname||!f.pathname.includes("?"),Su("?","pathname","search",f)),Je(!f.pathname||!f.pathname.includes("#"),Su("#","pathname","hash",f)),Je(!f.search||!f.search.includes("#"),Su("#","search","hash",f)));let d=a===""||f.pathname==="",h=d?"/":f.pathname,g;if(h==null)g=i;else{let S=l.length-1;if(!r&&h.startsWith("..")){let w=h.split("/");for(;w[0]==="..";)w.shift(),S-=1;f.pathname=w.join("/")}g=S>=0?l[S]:"/"}let x=tb(f,g),v=h&&h!=="/"&&h.endsWith("/"),y=(d||h===".")&&i.endsWith("/");return!x.pathname.endsWith("/")&&(v||y)&&(x.pathname+="/"),x}var Ln=a=>a.join("/").replace(/\/\/+/g,"/"),ab=a=>a.replace(/\/+$/,"").replace(/^\/*/,"/"),lb=a=>!a||a==="?"?"":a.startsWith("?")?a:"?"+a,sb=a=>!a||a==="#"?"":a.startsWith("#")?a:"#"+a;function ib(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 X0=["POST","PUT","PATCH","DELETE"];new Set(X0);var rb=["GET",...X0];new Set(rb);var Vl=m.createContext(null);Vl.displayName="DataRouter";var Gr=m.createContext(null);Gr.displayName="DataRouterState";m.createContext(!1);var Q0=m.createContext({isTransitioning:!1});Q0.displayName="ViewTransition";var ob=m.createContext(new Map);ob.displayName="Fetchers";var cb=m.createContext(null);cb.displayName="Await";var mn=m.createContext(null);mn.displayName="Navigation";var ei=m.createContext(null);ei.displayName="Location";var Hn=m.createContext({outlet:null,matches:[],isDataRoute:!1});Hn.displayName="Route";var uf=m.createContext(null);uf.displayName="RouteError";function ub(a,{relative:l}={}){Je(ti(),"useHref() may be used only in the context of a <Router> component.");let{basename:i,navigator:r}=m.useContext(mn),{hash:f,pathname:d,search:h}=ni(a,{relative:l}),g=d;return i!=="/"&&(g=d==="/"?i:Ln([i,d])),r.createHref({pathname:g,search:h,hash:f})}function ti(){return m.useContext(ei)!=null}function Ya(){return Je(ti(),"useLocation() may be used only in the context of a <Router> component."),m.useContext(ei).location}var K0="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Z0(a){m.useContext(mn).static||m.useLayoutEffect(a)}function fb(){let{isDataRoute:a}=m.useContext(Hn);return a?Nb():db()}function db(){Je(ti(),"useNavigate() may be used only in the context of a <Router> component.");let a=m.useContext(Vl),{basename:l,navigator:i}=m.useContext(mn),{matches:r}=m.useContext(Hn),{pathname:f}=Ya(),d=JSON.stringify($0(r)),h=m.useRef(!1);return Z0(()=>{h.current=!0}),m.useCallback((x,v={})=>{if(an(h.current,K0),!h.current)return;if(typeof x=="number"){i.go(x);return}let y=G0(x,JSON.parse(d),f,v.relative==="path");a==null&&l!=="/"&&(y.pathname=y.pathname==="/"?l:Ln([l,y.pathname])),(v.replace?i.replace:i.push)(y,v.state,v)},[l,i,d,f,a])}m.createContext(null);function ni(a,{relative:l}={}){let{matches:i}=m.useContext(Hn),{pathname:r}=Ya(),f=JSON.stringify($0(i));return m.useMemo(()=>G0(a,JSON.parse(f),r,l==="path"),[a,f,r,l])}function mb(a,l){return F0(a,l)}function F0(a,l,i,r,f){Je(ti(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:d}=m.useContext(mn),{matches:h}=m.useContext(Hn),g=h[h.length-1],x=g?g.params:{},v=g?g.pathname:"/",y=g?g.pathnameBase:"/",S=g&&g.route;{let A=S&&S.path||"";J0(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 w=Ya(),M;if(l){let A=typeof l=="string"?Hl(l):l;Je(y==="/"||A.pathname?.startsWith(y),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${y}" but pathname "${A.pathname}" was given in the \`location\` prop.`),M=A}else M=w;let C=M.pathname||"/",N=C;if(y!=="/"){let A=y.replace(/^\//,"").split("/");N="/"+C.replace(/^\//,"").split("/").slice(A.length).join("/")}let j=H0(a,{pathname:N});an(S||j!=null,`No routes matched location "${M.pathname}${M.search}${M.hash}" `),an(j==null||j[j.length-1].route.element!==void 0||j[j.length-1].route.Component!==void 0||j[j.length-1].route.lazy!==void 0,`Matched leaf route at location "${M.pathname}${M.search}${M.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let q=vb(j&&j.map(A=>Object.assign({},A,{params:Object.assign({},x,A.params),pathname:Ln([y,d.encodeLocation?d.encodeLocation(A.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:A.pathname]),pathnameBase:A.pathnameBase==="/"?y:Ln([y,d.encodeLocation?d.encodeLocation(A.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:A.pathnameBase])})),h,i,r,f);return l&&q?m.createElement(ei.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...M},navigationType:"POP"}},q):q}function hb(){let a=jb(),l=ib(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 pb=m.createElement(hb,null),gb=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(Hn.Provider,{value:this.props.routeContext},m.createElement(uf.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function xb({routeContext:a,match:l,children:i}){let r=m.useContext(Vl);return r&&r.static&&r.staticContext&&(l.route.errorElement||l.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=l.route.id),m.createElement(Hn.Provider,{value:a},i)}function vb(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);Je(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 g=!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:w,errors:M}=i,C=S.route.loader&&!w.hasOwnProperty(S.route.id)&&(!M||M[S.route.id]===void 0);if(S.route.lazy||C){g=!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,w)=>{let M,C=!1,N=null,j=null;i&&(M=h&&S.route.id?h[S.route.id]:void 0,N=S.route.errorElement||pb,g&&(x<0&&w===0?(J0("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),C=!0,j=null):x===w&&(C=!0,j=S.route.hydrateFallbackElement||null)));let q=l.concat(d.slice(0,w+1)),A=()=>{let k;return M?k=N:C?k=j:S.route.Component?k=m.createElement(S.route.Component,null):S.route.element?k=S.route.element:k=y,m.createElement(xb,{match:S,routeContext:{outlet:y,matches:q,isDataRoute:i!=null},children:k})};return i&&(S.route.ErrorBoundary||S.route.errorElement||w===0)?m.createElement(gb,{location:i.location,revalidation:i.revalidation,component:N,error:M,children:A(),routeContext:{outlet:null,matches:q,isDataRoute:!0},onError:v}):A()},null)}function ff(a){return`${a} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function yb(a){let l=m.useContext(Vl);return Je(l,ff(a)),l}function bb(a){let l=m.useContext(Gr);return Je(l,ff(a)),l}function Sb(a){let l=m.useContext(Hn);return Je(l,ff(a)),l}function df(a){let l=Sb(a),i=l.matches[l.matches.length-1];return Je(i.route.id,`${a} can only be used on routes that contain a unique "id"`),i.route.id}function Ab(){return df("useRouteId")}function jb(){let a=m.useContext(uf),l=bb("useRouteError"),i=df("useRouteError");return a!==void 0?a:l.errors?.[i]}function Nb(){let{router:a}=yb("useNavigate"),l=df("useNavigate"),i=m.useRef(!1);return Z0(()=>{i.current=!0}),m.useCallback(async(f,d={})=>{an(i.current,K0),i.current&&(typeof f=="number"?a.navigate(f):await a.navigate(f,{fromRouteId:l,...d}))},[a,l])}var Wp={};function J0(a,l,i){!l&&!Wp[a]&&(Wp[a]=!0,an(!1,i))}m.memo(wb);function wb({routes:a,future:l,state:i,unstable_onError:r}){return F0(a,void 0,i,r,l)}function Er(a){Je(!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 Cb({basename:a="/",children:l=null,location:i,navigationType:r="POP",navigator:f,static:d=!1}){Je(!ti(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let h=a.replace(/^\/*/,"/"),g=m.useMemo(()=>({basename:h,navigator:f,static:d,future:{}}),[h,f,d]);typeof i=="string"&&(i=Hl(i));let{pathname:x="/",search:v="",hash:y="",state:S=null,key:w="default"}=i,M=m.useMemo(()=>{let C=Un(x,h);return C==null?null:{location:{pathname:C,search:v,hash:y,state:S,key:w},navigationType:r}},[h,x,v,y,S,w,r]);return an(M!=null,`<Router basename="${h}"> is not able to match the URL "${x}${v}${y}" because it does not start with the basename, so the <Router> won't render anything.`),M==null?null:m.createElement(mn.Provider,{value:g},m.createElement(ei.Provider,{children:l,value:M}))}function Eb({children:a,location:l}){return mb(Qu(a),l)}function Qu(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,Qu(r.props.children,d));return}Je(r.type===Er,`[${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>`),Je(!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=Qu(r.props.children,d)),i.push(h)}),i}var qr="get",Mr="application/x-www-form-urlencoded";function Xr(a){return a!=null&&typeof a.tagName=="string"}function qb(a){return Xr(a)&&a.tagName.toLowerCase()==="button"}function Mb(a){return Xr(a)&&a.tagName.toLowerCase()==="form"}function Tb(a){return Xr(a)&&a.tagName.toLowerCase()==="input"}function Rb(a){return!!(a.metaKey||a.altKey||a.ctrlKey||a.shiftKey)}function kb(a,l){return a.button===0&&(!l||l==="_self")&&!Rb(a)}var Sr=null;function _b(){if(Sr===null)try{new FormData(document.createElement("form"),0),Sr=!1}catch{Sr=!0}return Sr}var Db=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Au(a){return a!=null&&!Db.has(a)?(an(!1,`"${a}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Mr}"`),null):a}function Ob(a,l){let i,r,f,d,h;if(Mb(a)){let g=a.getAttribute("action");r=g?Un(g,l):null,i=a.getAttribute("method")||qr,f=Au(a.getAttribute("enctype"))||Mr,d=new FormData(a)}else if(qb(a)||Tb(a)&&(a.type==="submit"||a.type==="image")){let g=a.form;if(g==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let x=a.getAttribute("formaction")||g.getAttribute("action");if(r=x?Un(x,l):null,i=a.getAttribute("formmethod")||g.getAttribute("method")||qr,f=Au(a.getAttribute("formenctype"))||Au(g.getAttribute("enctype"))||Mr,d=new FormData(g,a),!_b()){let{name:v,type:y,value:S}=a;if(y==="image"){let w=v?`${v}.`:"";d.append(`${w}x`,"0"),d.append(`${w}y`,"0")}else v&&d.append(v,S)}}else{if(Xr(a))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');i=qr,r=null,f=Mr,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 mf(a,l){if(a===!1||a===null||typeof a>"u")throw new Error(l)}function Bb(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&&Un(r.pathname,l)==="/"?r.pathname=`${l.replace(/\/$/,"")}/_root.${i}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${i}`,r}async function zb(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 Lb(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 Ub(a,l,i){let r=await Promise.all(a.map(async f=>{let d=l.routes[f.route.id];if(d){let h=await zb(d,i);return h.links?h.links():[]}return[]}));return $b(r.flat(1).filter(Lb).filter(f=>f.rel==="stylesheet"||f.rel==="preload").map(f=>f.rel==="stylesheet"?{...f,rel:"prefetch",as:"style"}:{...f,rel:"prefetch"}))}function Pp(a,l,i,r,f,d){let h=(x,v)=>i[v]?x.route.id!==i[v].route.id:!0,g=(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)||g(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)||g(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 Hb(a,l,{includeHydrateFallback:i}={}){return Vb(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 Vb(a){return[...new Set(a)]}function Yb(a){let l={},i=Object.keys(a).sort();for(let r of i)l[r]=a[r];return l}function $b(a,l){let i=new Set;return new Set(l),a.reduce((r,f)=>{let d=JSON.stringify(Yb(f));return i.has(d)||(i.add(d),r.push({key:d,link:f})),r},[])}function I0(){let a=m.useContext(Vl);return mf(a,"You must render this element inside a <DataRouterContext.Provider> element"),a}function Gb(){let a=m.useContext(Gr);return mf(a,"You must render this element inside a <DataRouterStateContext.Provider> element"),a}var hf=m.createContext(void 0);hf.displayName="FrameworkContext";function W0(){let a=m.useContext(hf);return mf(a,"You must render this element inside a <HydratedRouter> element"),a}function Xb(a,l){let i=m.useContext(hf),[r,f]=m.useState(!1),[d,h]=m.useState(!1),{onFocus:g,onBlur:x,onMouseEnter:v,onMouseLeave:y,onTouchStart:S}=l,w=m.useRef(null);m.useEffect(()=>{if(a==="render"&&h(!0),a==="viewport"){let N=q=>{q.forEach(A=>{h(A.isIntersecting)})},j=new IntersectionObserver(N,{threshold:.5});return w.current&&j.observe(w.current),()=>{j.disconnect()}}},[a]),m.useEffect(()=>{if(r){let N=setTimeout(()=>{h(!0)},100);return()=>{clearTimeout(N)}}},[r]);let M=()=>{f(!0)},C=()=>{f(!1),h(!1)};return i?a!=="intent"?[d,w,{}]:[d,w,{onFocus:zs(g,M),onBlur:zs(x,C),onMouseEnter:zs(v,M),onMouseLeave:zs(y,C),onTouchStart:zs(S,M)}]:[!1,w,{}]}function zs(a,l){return i=>{a&&a(i),i.defaultPrevented||l(i)}}function Qb({page:a,...l}){let{router:i}=I0(),r=m.useMemo(()=>H0(i.routes,a,i.basename),[i.routes,a,i.basename]);return r?m.createElement(Zb,{page:a,matches:r,...l}):null}function Kb(a){let{manifest:l,routeModules:i}=W0(),[r,f]=m.useState([]);return m.useEffect(()=>{let d=!1;return Ub(a,l,i).then(h=>{d||f(h)}),()=>{d=!0}},[a,l,i]),r}function Zb({page:a,matches:l,...i}){let r=Ya(),{manifest:f,routeModules:d}=W0(),{basename:h}=I0(),{loaderData:g,matches:x}=Gb(),v=m.useMemo(()=>Pp(a,l,x,f,r,"data"),[a,l,x,f,r]),y=m.useMemo(()=>Pp(a,l,x,f,r,"assets"),[a,l,x,f,r]),S=m.useMemo(()=>{if(a===r.pathname+r.search+r.hash)return[];let C=new Set,N=!1;if(l.forEach(q=>{let A=f.routes[q.route.id];!A||!A.hasLoader||(!v.some(k=>k.route.id===q.route.id)&&q.route.id in g&&d[q.route.id]?.shouldRevalidate||A.hasClientLoader?N=!0:C.add(q.route.id))}),C.size===0)return[];let j=Bb(a,h,"data");return N&&C.size>0&&j.searchParams.set("_routes",l.filter(q=>C.has(q.route.id)).map(q=>q.route.id).join(",")),[j.pathname+j.search]},[h,g,r,f,v,l,a,d]),w=m.useMemo(()=>Hb(y,f),[y,f]),M=Kb(y);return m.createElement(m.Fragment,null,S.map(C=>m.createElement("link",{key:C,rel:"prefetch",as:"fetch",href:C,...i})),w.map(C=>m.createElement("link",{key:C,rel:"modulepreload",href:C,...i})),M.map(({key:C,link:N})=>m.createElement("link",{key:C,nonce:i.nonce,...N})))}function Fb(...a){return l=>{a.forEach(i=>{typeof i=="function"?i(l):i!=null&&(i.current=l)})}}var P0=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{P0&&(window.__reactRouterVersion="7.9.6")}catch{}function Jb({basename:a,children:l,window:i}){let r=m.useRef();r.current==null&&(r.current=By({window:i,v5Compat:!0}));let f=r.current,[d,h]=m.useState({action:f.action,location:f.location}),g=m.useCallback(x=>{m.startTransition(()=>h(x))},[h]);return m.useLayoutEffect(()=>f.listen(g),[f,g]),m.createElement(Cb,{basename:a,children:l,location:d.location,navigationType:d.action,navigator:f})}var eg=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,tg=m.forwardRef(function({onClick:l,discover:i="render",prefetch:r="none",relative:f,reloadDocument:d,replace:h,state:g,target:x,to:v,preventScrollReset:y,viewTransition:S,...w},M){let{basename:C}=m.useContext(mn),N=typeof v=="string"&&eg.test(v),j,q=!1;if(typeof v=="string"&&N&&(j=v,P0))try{let $=new URL(window.location.href),Q=v.startsWith("//")?new URL($.protocol+v):new URL(v),z=Un(Q.pathname,C);Q.origin===$.origin&&z!=null?v=z+Q.search+Q.hash:q=!0}catch{an(!1,`<Link to="${v}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let A=ub(v,{relative:f}),[k,B,L]=Xb(r,w),Z=e1(v,{replace:h,state:g,target:x,preventScrollReset:y,relative:f,viewTransition:S});function O($){l&&l($),$.defaultPrevented||Z($)}let X=m.createElement("a",{...w,...L,href:j||A,onClick:q||d?l:O,ref:Fb(M,B),target:x,"data-discover":!N&&i==="render"?"true":void 0});return k&&!N?m.createElement(m.Fragment,null,X,m.createElement(Qb,{page:A})):X});tg.displayName="Link";var Ib=m.forwardRef(function({"aria-current":l="page",caseSensitive:i=!1,className:r="",end:f=!1,style:d,to:h,viewTransition:g,children:x,...v},y){let S=ni(h,{relative:v.relative}),w=Ya(),M=m.useContext(Gr),{navigator:C,basename:N}=m.useContext(mn),j=M!=null&&s1(S)&&g===!0,q=C.encodeLocation?C.encodeLocation(S).pathname:S.pathname,A=w.pathname,k=M&&M.navigation&&M.navigation.location?M.navigation.location.pathname:null;i||(A=A.toLowerCase(),k=k?k.toLowerCase():null,q=q.toLowerCase()),k&&N&&(k=Un(k,N)||k);const B=q!=="/"&&q.endsWith("/")?q.length-1:q.length;let L=A===q||!f&&A.startsWith(q)&&A.charAt(B)==="/",Z=k!=null&&(k===q||!f&&k.startsWith(q)&&k.charAt(q.length)==="/"),O={isActive:L,isPending:Z,isTransitioning:j},X=L?l:void 0,$;typeof r=="function"?$=r(O):$=[r,L?"active":null,Z?"pending":null,j?"transitioning":null].filter(Boolean).join(" ");let Q=typeof d=="function"?d(O):d;return m.createElement(tg,{...v,"aria-current":X,className:$,ref:y,style:Q,to:h,viewTransition:g},typeof x=="function"?x(O):x)});Ib.displayName="NavLink";var Wb=m.forwardRef(({discover:a="render",fetcherKey:l,navigate:i,reloadDocument:r,replace:f,state:d,method:h=qr,action:g,onSubmit:x,relative:v,preventScrollReset:y,viewTransition:S,...w},M)=>{let C=a1(),N=l1(g,{relative:v}),j=h.toLowerCase()==="get"?"get":"post",q=typeof g=="string"&&eg.test(g),A=k=>{if(x&&x(k),k.defaultPrevented)return;k.preventDefault();let B=k.nativeEvent.submitter,L=B?.getAttribute("formmethod")||h;C(B||k.currentTarget,{fetcherKey:l,method:L,navigate:i,replace:f,state:d,relative:v,preventScrollReset:y,viewTransition:S})};return m.createElement("form",{ref:M,method:j,action:N,onSubmit:r?x:A,...w,"data-discover":!q&&a==="render"?"true":void 0})});Wb.displayName="Form";function Pb(a){return`${a} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ng(a){let l=m.useContext(Vl);return Je(l,Pb(a)),l}function e1(a,{target:l,replace:i,state:r,preventScrollReset:f,relative:d,viewTransition:h}={}){let g=fb(),x=Ya(),v=ni(a,{relative:d});return m.useCallback(y=>{if(kb(y,l)){y.preventDefault();let S=i!==void 0?i:Ks(x)===Ks(v);g(a,{replace:S,state:r,preventScrollReset:f,relative:d,viewTransition:h})}},[x,g,v,i,r,l,a,f,d,h])}var t1=0,n1=()=>`__${String(++t1)}__`;function a1(){let{router:a}=ng("useSubmit"),{basename:l}=m.useContext(mn),i=Ab();return m.useCallback(async(r,f={})=>{let{action:d,method:h,encType:g,formData:x,body:v}=Ob(r,l);if(f.navigate===!1){let y=f.fetcherKey||n1();await a.fetch(y,i,f.action||d,{preventScrollReset:f.preventScrollReset,formData:x,body:v,formMethod:f.method||h,formEncType:f.encType||g,flushSync:f.flushSync})}else await a.navigate(f.action||d,{preventScrollReset:f.preventScrollReset,formData:x,body:v,formMethod:f.method||h,formEncType:f.encType||g,replace:f.replace,state:f.state,fromRouteId:i,flushSync:f.flushSync,viewTransition:f.viewTransition})},[a,l,i])}function l1(a,{relative:l}={}){let{basename:i}=m.useContext(mn),r=m.useContext(Hn);Je(r,"useFormAction must be used inside a RouteContext");let[f]=r.matches.slice(-1),d={...ni(a||".",{relative:l})},h=Ya();if(a==null){d.search=h.search;let g=new URLSearchParams(d.search),x=g.getAll("index");if(x.some(y=>y==="")){g.delete("index"),x.filter(S=>S).forEach(S=>g.append("index",S));let y=g.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:Ln([i,d.pathname])),Ks(d)}function s1(a,{relative:l}={}){let i=m.useContext(Q0);Je(i!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=ng("useViewTransitionState"),f=ni(a,{relative:l});if(!i.isTransitioning)return!1;let d=Un(i.currentLocation.pathname,r)||i.currentLocation.pathname,h=Un(i.nextLocation.pathname,r)||i.nextLocation.pathname;return zr(f.pathname,h)!=null||zr(f.pathname,d)!=null}const dn=Object.create(null);dn.open="0";dn.close="1";dn.ping="2";dn.pong="3";dn.message="4";dn.upgrade="5";dn.noop="6";const Tr=Object.create(null);Object.keys(dn).forEach(a=>{Tr[dn[a]]=a});const Ku={type:"error",data:"parser error"},ag=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",lg=typeof ArrayBuffer=="function",sg=a=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(a):a&&a.buffer instanceof ArrayBuffer,pf=({type:a,data:l},i,r)=>ag&&l instanceof Blob?i?r(l):e0(l,r):lg&&(l instanceof ArrayBuffer||sg(l))?i?r(l):e0(new Blob([l]),r):r(dn[a]+(l||"")),e0=(a,l)=>{const i=new FileReader;return i.onload=function(){const r=i.result.split(",")[1];l("b"+(r||""))},i.readAsDataURL(a)};function t0(a){return a instanceof Uint8Array?a:a instanceof ArrayBuffer?new Uint8Array(a):new Uint8Array(a.buffer,a.byteOffset,a.byteLength)}let ju;function i1(a,l){if(ag&&a.data instanceof Blob)return a.data.arrayBuffer().then(t0).then(l);if(lg&&(a.data instanceof ArrayBuffer||sg(a.data)))return l(t0(a.data));pf(a,!1,i=>{ju||(ju=new TextEncoder),l(ju.encode(i))})}const n0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",$s=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let a=0;a<n0.length;a++)$s[n0.charCodeAt(a)]=a;const r1=a=>{let l=a.length*.75,i=a.length,r,f=0,d,h,g,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=$s[a.charCodeAt(r)],h=$s[a.charCodeAt(r+1)],g=$s[a.charCodeAt(r+2)],x=$s[a.charCodeAt(r+3)],y[f++]=d<<2|h>>4,y[f++]=(h&15)<<4|g>>2,y[f++]=(g&3)<<6|x&63;return v},o1=typeof ArrayBuffer=="function",gf=(a,l)=>{if(typeof a!="string")return{type:"message",data:ig(a,l)};const i=a.charAt(0);return i==="b"?{type:"message",data:c1(a.substring(1),l)}:Tr[i]?a.length>1?{type:Tr[i],data:a.substring(1)}:{type:Tr[i]}:Ku},c1=(a,l)=>{if(o1){const i=r1(a);return ig(i,l)}else return{base64:!0,data:a}},ig=(a,l)=>{switch(l){case"blob":return a instanceof Blob?a:new Blob([a]);case"arraybuffer":default:return a instanceof ArrayBuffer?a:a.buffer}},rg="",u1=(a,l)=>{const i=a.length,r=new Array(i);let f=0;a.forEach((d,h)=>{pf(d,!1,g=>{r[h]=g,++f===i&&l(r.join(rg))})})},f1=(a,l)=>{const i=a.split(rg),r=[];for(let f=0;f<i.length;f++){const d=gf(i[f],l);if(r.push(d),d.type==="error")break}return r};function d1(){return new TransformStream({transform(a,l){i1(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 Nu;function Ar(a){return a.reduce((l,i)=>l+i.length,0)}function jr(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 m1(a,l){Nu||(Nu=new TextDecoder);const i=[];let r=0,f=-1,d=!1;return new TransformStream({transform(h,g){for(i.push(h);;){if(r===0){if(Ar(i)<1)break;const x=jr(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(Ar(i)<2)break;const x=jr(i,2);f=new DataView(x.buffer,x.byteOffset,x.length).getUint16(0),r=3}else if(r===2){if(Ar(i)<8)break;const x=jr(i,8),v=new DataView(x.buffer,x.byteOffset,x.length),y=v.getUint32(0);if(y>Math.pow(2,21)-1){g.enqueue(Ku);break}f=y*Math.pow(2,32)+v.getUint32(4),r=3}else{if(Ar(i)<f)break;const x=jr(i,f);g.enqueue(gf(d?x:Nu.decode(x),l)),r=0}if(f===0||f>a){g.enqueue(Ku);break}}}})}const og=4;function rt(a){if(a)return h1(a)}function h1(a){for(var l in rt.prototype)a[l]=rt.prototype[l];return a}rt.prototype.on=rt.prototype.addEventListener=function(a,l){return this._callbacks=this._callbacks||{},(this._callbacks["$"+a]=this._callbacks["$"+a]||[]).push(l),this};rt.prototype.once=function(a,l){function i(){this.off(a,i),l.apply(this,arguments)}return i.fn=l,this.on(a,i),this};rt.prototype.off=rt.prototype.removeListener=rt.prototype.removeAllListeners=rt.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};rt.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};rt.prototype.emitReserved=rt.prototype.emit;rt.prototype.listeners=function(a){return this._callbacks=this._callbacks||{},this._callbacks["$"+a]||[]};rt.prototype.hasListeners=function(a){return!!this.listeners(a).length};const Qr=typeof Promise=="function"&&typeof Promise.resolve=="function"?l=>Promise.resolve().then(l):(l,i)=>i(l,0),Ft=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),p1="arraybuffer";function cg(a,...l){return l.reduce((i,r)=>(a.hasOwnProperty(r)&&(i[r]=a[r]),i),{})}const g1=Ft.setTimeout,x1=Ft.clearTimeout;function Kr(a,l){l.useNativeTimers?(a.setTimeoutFn=g1.bind(Ft),a.clearTimeoutFn=x1.bind(Ft)):(a.setTimeoutFn=Ft.setTimeout.bind(Ft),a.clearTimeoutFn=Ft.clearTimeout.bind(Ft))}const v1=1.33;function y1(a){return typeof a=="string"?b1(a):Math.ceil((a.byteLength||a.size)*v1)}function b1(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 ug(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function S1(a){let l="";for(let i in a)a.hasOwnProperty(i)&&(l.length&&(l+="&"),l+=encodeURIComponent(i)+"="+encodeURIComponent(a[i]));return l}function A1(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 j1 extends Error{constructor(l,i,r){super(l),this.description=i,this.context=r,this.type="TransportError"}}class xf extends rt{constructor(l){super(),this.writable=!1,Kr(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 j1(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=gf(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=S1(l);return i.length?"?"+i:""}}class N1 extends xf{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)};f1(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,u1(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]=ug()),!this.supportsBinary&&!i.sid&&(i.b64=1),this.createUri(l,i)}}let fg=!1;try{fg=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const w1=fg;function C1(){}class E1 extends N1{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 fn extends rt{constructor(l,i,r){super(),this.createRequest=l,Kr(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=cg(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=fn.requestsCount++,fn.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=C1,l)try{this._xhr.abort()}catch{}typeof document<"u"&&delete fn.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()}}fn.requestsCount=0;fn.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",a0);else if(typeof addEventListener=="function"){const a="onpagehide"in Ft?"pagehide":"unload";addEventListener(a,a0,!1)}}function a0(){for(let a in fn.requests)fn.requests.hasOwnProperty(a)&&fn.requests[a].abort()}const q1=(function(){const a=dg({xdomain:!1});return a&&a.responseType!==null})();class M1 extends E1{constructor(l){super(l);const i=l&&l.forceBase64;this.supportsBinary=q1&&!i}request(l={}){return Object.assign(l,{xd:this.xd},this.opts),new fn(dg,this.uri(),l)}}function dg(a){const l=a.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!l||w1))return new XMLHttpRequest}catch{}if(!l)try{return new Ft[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const mg=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class T1 extends xf{get name(){return"websocket"}doOpen(){const l=this.uri(),i=this.opts.protocols,r=mg?{}:cg(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;pf(r,this.supportsBinary,d=>{try{this.doWrite(r,d)}catch{}f&&Qr(()=>{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]=ug()),this.supportsBinary||(i.b64=1),this.createUri(l,i)}}const wu=Ft.WebSocket||Ft.MozWebSocket;class R1 extends T1{createSocket(l,i,r){return mg?new wu(l,i,r):i?new wu(l,i):new wu(l)}doWrite(l,i){this.ws.send(i)}}class k1 extends xf{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=m1(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=l.readable.pipeThrough(i).getReader(),f=d1();f.readable.pipeTo(l.writable),this._writer=f.writable.getWriter();const d=()=>{r.read().then(({done:g,value:x})=>{g||(this.onPacket(x),d())}).catch(g=>{})};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&&Qr(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var l;(l=this._transport)===null||l===void 0||l.close()}}const _1={websocket:R1,webtransport:k1,polling:M1},D1=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,O1=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Zu(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=D1.exec(a||""),d={},h=14;for(;h--;)d[O1[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=B1(d,d.path),d.queryKey=z1(d,d.query),d}function B1(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 z1(a,l){const i={};return l.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,f,d){f&&(i[f]=d)}),i}const Fu=typeof addEventListener=="function"&&typeof removeEventListener=="function",Rr=[];Fu&&addEventListener("offline",()=>{Rr.forEach(a=>a())},!1);class ma extends rt{constructor(l,i){if(super(),this.binaryType=p1,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=Zu(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=Zu(i.host).host);Kr(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=A1(this.opts.query)),Fu&&(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"})},Rr.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(l){const i=Object.assign({},this.opts.query);i.EIO=og,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&&ma.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",ma.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+=y1(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,Qr(()=>{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(ma.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(),Fu&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=Rr.indexOf(this._offlineEventListener);r!==-1&&Rr.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",l,i),this.writeBuffer=[],this._prevBufferLen=0}}}ma.protocol=og;class L1 extends ma{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;ma.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;ma.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 w=new Error("probe error");w.transport=i.name,this.emitReserved("upgradeError",w)}}))};function d(){r||(r=!0,y(),i.close(),i=null)}const h=S=>{const w=new Error("probe error: "+S);w.transport=i.name,d(),this.emitReserved("upgradeError",w)};function g(){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",g),this.off("close",x),this.off("upgrading",v)};i.once("open",f),i.once("error",h),i.once("close",g),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 U1=class extends L1{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=>_1[f]).filter(f=>!!f)),super(l,r)}};function H1(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=Zu(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 V1=typeof ArrayBuffer=="function",Y1=a=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(a):a.buffer instanceof ArrayBuffer,hg=Object.prototype.toString,$1=typeof Blob=="function"||typeof Blob<"u"&&hg.call(Blob)==="[object BlobConstructor]",G1=typeof File=="function"||typeof File<"u"&&hg.call(File)==="[object FileConstructor]";function vf(a){return V1&&(a instanceof ArrayBuffer||Y1(a))||$1&&a instanceof Blob||G1&&a instanceof File}function kr(a,l){if(!a||typeof a!="object")return!1;if(Array.isArray(a)){for(let i=0,r=a.length;i<r;i++)if(kr(a[i]))return!0;return!1}if(vf(a))return!0;if(a.toJSON&&typeof a.toJSON=="function"&&arguments.length===1)return kr(a.toJSON(),!0);for(const i in a)if(Object.prototype.hasOwnProperty.call(a,i)&&kr(a[i]))return!0;return!1}function X1(a){const l=[],i=a.data,r=a;return r.data=Ju(i,l),r.attachments=l.length,{packet:r,buffers:l}}function Ju(a,l){if(!a)return a;if(vf(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]=Ju(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]=Ju(a[r],l));return i}return a}function Q1(a,l){return a.data=Iu(a.data,l),delete a.attachments,a}function Iu(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]=Iu(a[i],l);else if(typeof a=="object")for(const i in a)Object.prototype.hasOwnProperty.call(a,i)&&(a[i]=Iu(a[i],l));return a}const K1=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],Z1=5;var Te;(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"})(Te||(Te={}));class F1{constructor(l){this.replacer=l}encode(l){return(l.type===Te.EVENT||l.type===Te.ACK)&&kr(l)?this.encodeAsBinary({type:l.type===Te.EVENT?Te.BINARY_EVENT:Te.BINARY_ACK,nsp:l.nsp,data:l.data,id:l.id}):[this.encodeAsString(l)]}encodeAsString(l){let i=""+l.type;return(l.type===Te.BINARY_EVENT||l.type===Te.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=X1(l),r=this.encodeAsString(i.packet),f=i.buffers;return f.unshift(r),f}}function l0(a){return Object.prototype.toString.call(a)==="[object Object]"}class yf extends rt{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===Te.BINARY_EVENT;r||i.type===Te.BINARY_ACK?(i.type=r?Te.EVENT:Te.ACK,this.reconstructor=new J1(i),i.attachments===0&&super.emitReserved("decoded",i)):super.emitReserved("decoded",i)}else if(vf(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(Te[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===Te.BINARY_EVENT||r.type===Te.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(yf.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 Te.CONNECT:return l0(i);case Te.DISCONNECT:return i===void 0;case Te.CONNECT_ERROR:return typeof i=="string"||l0(i);case Te.EVENT:case Te.BINARY_EVENT:return Array.isArray(i)&&(typeof i[0]=="number"||typeof i[0]=="string"&&K1.indexOf(i[0])===-1);case Te.ACK:case Te.BINARY_ACK:return Array.isArray(i)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class J1{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=Q1(this.reconPack,this.buffers);return this.finishedReconstruction(),i}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const I1=Object.freeze(Object.defineProperty({__proto__:null,Decoder:yf,Encoder:F1,get PacketType(){return Te},protocol:Z1},Symbol.toStringTag,{value:"Module"}));function en(a,l,i){return a.on(l,i),function(){a.off(l,i)}}const W1=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class pg extends rt{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=[en(l,"open",this.onopen.bind(this)),en(l,"packet",this.onpacket.bind(this)),en(l,"error",this.onerror.bind(this)),en(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(W1.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:Te.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 g=(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&&!g||(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 g=0;g<this.sendBuffer.length;g++)this.sendBuffer[g].id===l&&this.sendBuffer.splice(g,1);i.call(this,new Error("operation has timed out"))},f),h=(...g)=>{this.io.clearTimeoutFn(d),i.apply(this,g)};h.withError=!0,this.acks[l]=h}emitWithAck(l,...i){return new Promise((r,f)=>{const d=(h,g)=>h?f(h):r(g);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:Te.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 Te.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 Te.EVENT:case Te.BINARY_EVENT:this.onevent(l);break;case Te.ACK:case Te.BINARY_ACK:this.onack(l);break;case Te.DISCONNECT:this.ondisconnect();break;case Te.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:Te.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:Te.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 Yl(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}Yl.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};Yl.prototype.reset=function(){this.attempts=0};Yl.prototype.setMin=function(a){this.ms=a};Yl.prototype.setMax=function(a){this.max=a};Yl.prototype.setJitter=function(a){this.jitter=a};class Wu extends rt{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,Kr(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 Yl({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||I1;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 U1(this.uri,this.opts);const i=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const f=en(i,"open",function(){r.onopen(),l&&l()}),d=g=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",g),l?l(g):this.maybeReconnectOnOpen()},h=en(i,"error",d);if(this._timeout!==!1){const g=this._timeout,x=this.setTimeoutFn(()=>{f(),d(new Error("timeout")),i.close()},g);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(en(l,"ping",this.onping.bind(this)),en(l,"data",this.ondata.bind(this)),en(l,"error",this.onerror.bind(this)),en(l,"close",this.onclose.bind(this)),en(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){Qr(()=>{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 pg(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 Ls={};function _r(a,l){typeof a=="object"&&(l=a,a=void 0),l=l||{};const i=H1(a,l.path||"/socket.io"),r=i.source,f=i.id,d=i.path,h=Ls[f]&&d in Ls[f].nsps,g=l.forceNew||l["force new connection"]||l.multiplex===!1||h;let x;return g?x=new Wu(r,l):(Ls[f]||(Ls[f]=new Wu(r,l)),x=Ls[f]),i.query&&!l.query&&(l.query=i.queryKey),x.socket(i.path,l)}Object.assign(_r,{Manager:Wu,Socket:pg,io:_r,connect:_r});const gg="roverSettings",P1=3600*24*365;function eS(a){try{const l=decodeURIComponent(a??"");return JSON.parse(l)}catch(l){return console.warn("Failed to parse settings cookie",l),null}}function Pu(){if(typeof document>"u")return{};const a=`${gg}=`,l=document.cookie.split(";").map(r=>r.trim()).find(r=>r.startsWith(a));if(!l)return{};const i=l.substring(a.length);return eS(i)??{}}function s0(a){if(typeof document>"u")return!1;try{const l=encodeURIComponent(JSON.stringify(a??{})),i=`${gg}=${l}; path=/; max-age=${P1}; samesite=strict`;return document.cookie=i,!0}catch(l){return console.warn("Failed to write settings cookie",l),!1}}const xg=window.location.origin;console.info("[socket] connecting to",xg);const tS=Pu(),nS=tS?.page?.connectionTransport||"websocket",aS=nS==="polling"?["polling"]:["websocket","polling"],bf=_r(xg,{transports:aS,timeout:15e3});bf.on("connect_error",a=>console.error("connect_error",a.code,a.message,a.data));const vg=m.createContext(bf),lS=({children:a})=>o.jsx(vg.Provider,{value:bf,children:a}),hn=()=>m.useContext(vg),yg=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()=>{}});function sS(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 iS({children:a}){const l=hn(),i=sS(l),[r,f]=m.useState(null),[d,h]=m.useState([]),[g,x]=m.useState([]),[v,y]=m.useState([]),[S,w]=m.useState(l.connected);m.useEffect(()=>{const N=()=>w(!0),j=()=>w(!1);return l.on("connect",N),l.on("disconnect",j),()=>{l.off("connect",N),l.off("disconnect",j)}},[l]),m.useEffect(()=>{function N(B){f(B)}function j(B=[]){h(B)}function q(B){h(L=>[...L.slice(-199),B])}function A(B=[]){x(B)}function k(B){x(L=>[...L.slice(-199),B])}return l.on("session:sync",N),l.on("log:init",j),l.on("log:entry",q),l.on("adminlog:init",A),l.on("adminlog:entry",k),l.on("alert:new",(B={})=>{y(L=>[...L.slice(-49),{...B,receivedAt:Date.now()}])}),()=>{l.off("session:sync",N),l.off("log:init",j),l.off("log:entry",q),l.off("adminlog:init",A),l.off("adminlog:entry",k),l.off("alert:new")}},[l]);const M=m.useMemo(()=>({login:(N,j)=>i("auth:login",{username:N,password:j}),setRole:N=>i("session:setRole",{role:N}),requestControl:(N,j={})=>i("session:requestControl",{roverId:N,...j}),releaseControl:N=>i("session:releaseControl",{roverId:N}),subscribeAll:()=>i("session:subscribeAll"),lockRover:(N,j)=>i("session:lockRover",{roverId:N,locked:j}),setMode:N=>i("setMode",{mode:N}),homeAssistantToggle:N=>i("homeAssistant:toggle",{entityId:N}),homeAssistantSetState:(N,j)=>i("homeAssistant:setState",{entityId:N,state:j}),homeAssistantSetLightColor:(N,j)=>i("homeAssistant:lightColor",{entityId:N,rgbColor:j}),setNickname:N=>i("nickname:set",{nickname:N}),triggerReplay:(N=[])=>i("replay:trigger",{sources:N}),setCommunityGoal:N=>i("communityGoal:set",{text:N}),setAdminReason:N=>i("adminReason:set",{text:N}),pushAlert:N=>y(j=>[...j.slice(-49),{...N,receivedAt:Date.now(),id:N.id||Math.random().toString(36).slice(2)}])}),[i]),C=m.useMemo(()=>({connected:S,session:r,logs:d,adminLogs:g,alerts:v,...M}),[M,g,v,S,d,r]);return o.jsx(yg.Provider,{value:C,children:a})}function ze(){return m.useContext(yg)}const bg=m.createContext({frames:{}});function rS({children:a}){const l=hn(),[i,r]=m.useState({});m.useEffect(()=>{function d({roverId:h,sensors:g={},frame:x={}}){h&&r(v=>({...v,[h]:{roverId:h,sensors:g,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(bg.Provider,{value:f,children:a})}function Sf(){return m.useContext(bg).frames}function $l(a){const l=Sf();return a?l[a]??null:null}const oS=650,cS={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 Cu(a){if(typeof a!="number"||a<=0)return null;const l=cS[a];return l?{code:a,...l}:null}function uS(a,l={}){const i=l.holdMs||oS,[r,f]=m.useState({left:null,right:null,omni:null}),[d,h]=m.useState(0);return m.useEffect(()=>{const g=setInterval(()=>h(Date.now()),Math.max(i/2,100));return()=>clearInterval(g)},[i]),m.useEffect(()=>{const g=Date.now(),x=Cu(a?.infraredCharacterLeft),v=Cu(a?.infraredCharacterRight),y=Cu(a?.infraredCharacterOmni);!x&&!v&&!y||f(S=>({left:x?{...x,ts:g}:S.left,right:v?{...v,ts:g}:S.right,omni:y?{...y,ts:g}:S.omni}))},[a?.infraredCharacterLeft,a?.infraredCharacterRight,a?.infraredCharacterOmni]),m.useEffect(()=>{const{left:g,right:x,omni:v}=r;if(!(g?.ts||x?.ts||v?.ts))return;const S=new Date().toISOString();console.debug("[DockIR]",S,{left:g?.code??0,omni:v?.code??0,right:x?.code??0})},[r.left?.code,r.right?.code,r.omni?.code]),m.useMemo(()=>{const g=Date.now(),x=j=>{if(!j)return{active:!1,red:!1,green:!1,force:!1,age:null,code:null};const q=g-j.ts,A=q<=i;return{active:A,age:q,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),w=v.force||y.force||S.force,M=v.active||y.active||S.active,C=v.active&&!y.active?"right":y.active&&!v.active?"left":"center",N=(y.active?1:0)-(v.active?1:0);return{visible:M,forceDetected:w,left:v,right:y,omni:S,bias:C,balance:Math.max(-1,Math.min(1,N))}},[r.left,r.right,r.omni,i,d])}function fS(){const{connected:a,session:l}=ze(),i=l?.assignment?.roverId,r=$l(i),f=r?.sensors||{},d=uS(f),h=f.voltageMv!=null?`${(f.voltageMv/1e3).toFixed(2)} V`:null,g=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,w=i?l?.activeDrivers?.[i]:null;return m.useMemo(()=>i?w?w===l?.socketId?"You":(l?.users||[]).find(C=>C.socketId===w)?.nickname||w.slice(0,6):"Available":"n/a",[w,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(dS,{sensors:f,voltage:h,current:g,batteryTemp:x,charge:v,capacity:y}),o.jsx(mS,{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 dS({sensors:a,voltage:l,current:i,batteryTemp:r,charge:f,capacity:d}){const h=f!=null&&d?`${Math.round(f/d*100)}`:"--",g=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(Dn,{label:"Voltage",value:l??"--"}),o.jsx(Dn,{label:"Current",value:i??"--"}),o.jsx(Dn,{label:"Battery temp",value:r??"--"}),o.jsx(Dn,{label:"Charge",value:f!=null?`${f} mAh`:"--"}),o.jsx(Dn,{label:"Capacity",value:d!=null?`${d} mAh`:"--"}),o.jsx(Dn,{label:"Charge",value:h}),o.jsx(Dn,{label:"OI mode",value:g}),o.jsx(Dn,{label:"Docked",value:x}),o.jsx(Dn,{label:"Charging state",value:v})]})}function Dn({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 mS({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(hS,{sensors:a}),o.jsx(pS,{state:l})]}),o.jsxs(Tl,{title:"Bumps & drops",children:[o.jsx(On,{label:"Bump L",value:o.jsx(Us,{active:i.bumpLeft})}),o.jsx(On,{label:"Bump R",value:o.jsx(Us,{active:i.bumpRight})}),o.jsx(On,{label:"Wheel drop L",value:o.jsx(Us,{active:i.wheelDropLeft,tone:"amber"})}),o.jsx(On,{label:"Wheel drop R",value:o.jsx(Us,{active:i.wheelDropRight,tone:"amber"})})]}),o.jsx(Tl,{title:"Light bumps (raw)",children:f.map(g=>o.jsx(On,{label:g.label,value:Hs(g.value)},g.label))}),o.jsx(Tl,{title:"Cliff sensors",children:d.map(g=>o.jsx(On,{label:g.label,value:`${Hs(g.value)} · ${g.active?"bool: true":"bool: false"}`},g.label))}),o.jsx(Tl,{title:"Currents",children:h.map(g=>o.jsx(On,{label:g.label,value:o.jsxs("span",{className:"flex items-center gap-0.5",children:[o.jsx("span",{children:Hs(g.value,"mA")}),g.over?o.jsx(Us,{active:!0,tone:"red",label:"over"}):null]})},g.label))}),o.jsxs(Tl,{title:"Dirt detect",children:[o.jsx(On,{label:"Left",value:Hs(a?.dirtDetectLeft)}),o.jsx(On,{label:"Right",value:Hs(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 On({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 Us({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 Hs(a,l){return a==null||Number.isNaN(a)?"--":l?`${a} ${l}`:a}function hS({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 pS({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 Sg=m.createContext(null);function Af({children:a}){const[l,i]=m.useState(()=>({status:"loading",data:{}}));m.useEffect(()=>{const g=Pu();i({status:"ready",data:g??{}})},[]);const r=m.useCallback(()=>{const g=Pu();i({status:"ready",data:g??{}})},[]),f=m.useCallback(g=>{const x=s0(g??{});return i(x?{status:"ready",data:g??{}}:v=>({...v,status:"error"})),x},[]),d=m.useCallback((g,x)=>{i(v=>{const y=v.data[g]||{},S=typeof x=="function"?x(y):{...y,...x??{}},w={...v.data,[g]:S};return s0(w)?{status:"ready",data:w}:{...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(Sg.Provider,{value:h,children:a})}function gS(){const a=m.useContext(Sg);if(!a)throw new Error("useSettings must be used within SettingsProvider");return a}function xt(a,l={}){const{data:i,status:r,setNamespace:f}=gS(),d=i[a]??l??{},h=m.useCallback(v=>{f(a,y=>{const S=y??{};return typeof v=="function"?v(S):{...S,...v??{}}})},[a,f]),g=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:g,reset:x}}function xS(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 jf({panelId:a="replay-sources",fillHeight:l=!1}){const{session:i,triggerReplay:r}=ze(),f=xS(i?.replaySources||[]),{value:d,save:h}=xt("replaySources",{}),[g,x]=m.useState([]),[v,y]=m.useState(!1),[S,w]=m.useState(null),[M,C]=m.useState(null),N=i?.replay||null,[j,q]=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(z=>$.has(z)))},[f]);const k=m.useMemo(()=>({rovers:f.filter($=>$.type==="rover"),rooms:f.filter($=>$.type==="room")}),[f]);m.useEffect(()=>{if(!N?.lastTriggeredAt||!N?.cooldownMs){q(0);return}const $=()=>{const z=N.lastTriggeredAt+N.cooldownMs-Date.now();q(Math.max(0,z))};$();const Q=setInterval($,250);return()=>clearInterval(Q)},[N?.lastTriggeredAt,N?.cooldownMs,N?.remainingMs]);const B=v||i?.mode==="lockdown"||j>0||!g.length,L=$=>{x(Q=>{const z=Q.includes($)?Q.filter(K=>K!==$):[...Q,$];return h(K=>({...K||{},[a]:z})),z}),C(null)},Z=async()=>{if(!B){y(!0),w(null),C(null);try{const $=g.map(Q=>{const[z,K]=Q.split(":");return{type:z,id:K}});await r($),C("Replay sent. Check the Discord replay channel.")}catch($){w($.message)}finally{y(!1)}}},O=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 ${O}`,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(i0,{title:"Rovers",items:k.rovers,selected:g,onToggle:L}),o.jsx(i0,{title:"Room Cams",items:k.rooms,selected:g,onToggle:L})]}),o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("button",{type:"button",className:"button-dark w-full text-xs disabled:opacity-40",onClick:Z,disabled:B,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,M?o.jsx("div",{className:"text-xs text-emerald-300",children:M}):null]})]})}function i0({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 Ag={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},r0=Va.createContext&&Va.createContext(Ag),vS=["attr","size","title"];function yS(a,l){if(a==null)return{};var i=bS(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 bS(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 Lr(){return Lr=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},Lr.apply(this,arguments)}function o0(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 Ur(a){for(var l=1;l<arguments.length;l++){var i=arguments[l]!=null?arguments[l]:{};l%2?o0(Object(i),!0).forEach(function(r){SS(a,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(i)):o0(Object(i)).forEach(function(r){Object.defineProperty(a,r,Object.getOwnPropertyDescriptor(i,r))})}return a}function SS(a,l,i){return l=AS(l),l in a?Object.defineProperty(a,l,{value:i,enumerable:!0,configurable:!0,writable:!0}):a[l]=i,a}function AS(a){var l=jS(a,"string");return typeof l=="symbol"?l:l+""}function jS(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 jg(a){return a&&a.map((l,i)=>Va.createElement(l.tag,Ur({key:i},l.attr),jg(l.child)))}function Ng(a){return l=>Va.createElement(NS,Lr({attr:Ur({},a.attr)},l),jg(a.child))}function NS(a){var l=i=>{var{attr:r,size:f,title:d}=a,h=yS(a,vS),g=f||i.size||"1em",x;return i.className&&(x=i.className),a.className&&(x=(x?x+" ":"")+a.className),Va.createElement("svg",Lr({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},i.attr,r,h,{className:x,style:Ur(Ur({color:a.color||i.color},i.style),a.style),height:g,width:g,xmlns:"http://www.w3.org/2000/svg"}),d&&Va.createElement("title",null,d),a.children)};return r0!==void 0?Va.createElement(r0.Consumer,null,i=>l(i)):l(Ag)}function wg(a){return Ng({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 wS(a){return Ng({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 CS(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 ES(a){const l=new Date(a);return`${l.getHours().toString().padStart(2,"0")}:${l.getMinutes().toString().padStart(2,"0")}`}function c0(a){return a.nickname||a.socketId?.slice(0,6)||"unknown"}function qS({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 Cg({message:a}){const l=a.fromDiscord?`${a.discordGuildName||"Discord"} · ${c0(a)}`:null;return o.jsxs(o.Fragment,{children:[a.fromDiscord?o.jsxs(o.Fragment,{children:[o.jsx(wg,{className:"h-3.5 w-3.5 text-indigo-200"}),o.jsx(qS,{guildIconUrl:a.discordGuildIconUrl,userAvatarUrl:a.discordUserAvatarUrl,label:l})]}):null,o.jsx("span",{className:`font-semibold text-[0.85rem] ${CS(a.role)}`,children:c0(a)}),a.roverId&&o.jsx("span",{className:"rounded bg-slate-800 px-1 text-[0.7rem]",children:a.roverId})]})}function Eg(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 qg({message:a}){return o.jsxs("div",{className:Eg(a),children:[o.jsx(Cg,{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:ES(a.ts)})]})}function Mg({message:a}){return o.jsxs("div",{className:`${Eg(a)} italic opacity-80 border-slate-600/40 bg-slate-900/40`,children:[o.jsx(Cg,{message:a}),o.jsx("span",{className:"text-slate-300",children:"typing..."})]})}const MS=3e3,TS="#2196f3";function RS(a){return a.id?a.id:a.timestamp?`${a.timestamp}-${a.message}`:`${a.title||"alert"}-${a.message}`}function Nf({scale:a=1}){const{alerts:l}=ze(),[i,r]=m.useState(()=>Date.now()),f=m.useMemo(()=>l.slice(-3).map(x=>({alert:x,key:RS(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<=MS);if(!d.length)return null;const h=a===1?void 0:{transform:`translateX(-50%) scale(${a})`,transformOrigin:"top center"},g=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:g,style:h,children:d.map(x=>o.jsx(kS,{alert:x.alert},x.key))})}function u0(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 kS({alert:a}){if(a.kind==="chat"&&a.payload)return o.jsx(qg,{message:a.payload});if(a.kind==="chat-typing"&&a.payload)return o.jsx(Mg,{message:a.payload});const l=u0(a.color)||u0(TS),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 Rl={main:[-127,127],side:[-127,127],vacuum:[0,127]},Eu={maxSpeed:500,baseSpeed:250,boostSpeed:400},ef=100,wf=[31,127],zl=60,tf=8,_S=250,DS=4e3,qu=.4,OS=.8,BS={start:[128],safe:[131],full:[132],passive:[128],dock:[143]},Xs={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"]},Tg=[{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:ef},{type:"oi",command:"dock"},{type:"pause",duration:ef},{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 nf(){return{vector:{x:0,y:0,boost:!1},speeds:{left:0,right:0},source:null,lastUpdatedAt:0}}function af(){return{main:0,side:0,vacuum:0}}function zS(){return{enabled:!1,angle:null,config:null}}function Dr(){return{note:zl}}function Gs(){return{active:!1,heat:0,overheated:!1}}const f0={roverId:null,mode:"drive",drive:nf(),aux:af(),camera:zS(),song:Dr(),horn:Gs(),lastControlIntentAt:0,macros:Tg,keymap:Xs,inputs:{}};function LS(a,l){switch(l.type){case"control/set-rover":return{...a,roverId:l.payload??null,drive:l.payload?a.drive:nf(),aux:l.payload?a.aux:af(),song:l.payload?a.song:Dr(),horn:l.payload?a.horn:Gs(),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:nf(),aux:af(),song:Dr(),horn:Gs(),lastControlIntentAt:0};case"control/set-horn-active":return{...a,horn:{...a.horn||Gs(),active:!!l.payload}};case"control/set-horn-heat":return{...a,horn:{...a.horn||Gs(),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||Dr(),note:l.payload??zl}};default:return a}}function Ll(a,l,i){return typeof a!="number"||Number.isNaN(a)?l:Math.max(l,Math.min(i,a))}function Ul(a){return typeof a!="number"||Number.isNaN(a)?0:Math.max(-1,Math.min(1,a))}function Zt(a,l){return!Array.isArray(l)||l.length!==2?a:Ll(a,l[0],l[1])}function US(a={}){const l=Ul(a.x??0),i=Ul(a.y??0);return{x:l,y:i,boost:!!a.boost}}function HS(a={},l={}){const i=US(a),r=typeof l.maxSpeed=="number"?l.maxSpeed:Eu.maxSpeed,f=typeof l.baseSpeed=="number"?l.baseSpeed:Eu.baseSpeed,d=typeof l.boostSpeed=="number"?l.boostSpeed:Eu.boostSpeed,h=i.boost?d:f,g=i.y*h,x=i.x*h;return{vector:i,speeds:{left:Ll(Math.round(g+x),-r,r),right:Ll(Math.round(g-x),-r,r)}}}function VS(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 d0(a){return new Promise(l=>setTimeout(l,a))}function YS(a={}){const{driveTransform:l,auxTransform:i}=a,r=hn(),{session:f}=ze(),d=f?.assignment?.roverId,h=m.useMemo(()=>!d||!Array.isArray(f?.roster)?null:f.roster.find(L=>String(L.id)===String(d))||null,[d,f?.roster]),g=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((L,Z)=>{d&&r.emit("command",{roverId:d,...L},Z)},[r,d]),w=m.useCallback(()=>{d&&S({type:"sensorStream",data:{sensorStream:{enable:!0}}})},[S,d]),M=m.useCallback(L=>{if(!d)return null;const Z={left:Zt(L?.left??0,[-500,500]),right:Zt(L?.right??0,[-500,500])},O=l?l(Z):Z,X={left:Zt(O?.left??0,[-500,500]),right:Zt(O?.right??0,[-500,500])};return S({type:"drive",data:{driveDirect:X}}),X},[l,S,d]),C=m.useCallback(({main:L=0,side:Z=0,vacuum:O=0}={})=>{if(!d)return null;const X={main:Zt(L,Rl.main),side:Zt(Z,Rl.side),vacuum:Zt(O,Rl.vacuum)},$=i?i(X):X,Q={main:Zt($?.main??0,Rl.main),side:Zt($?.side??0,Rl.side),vacuum:Zt($?.vacuum??0,Rl.vacuum)};return S({type:"motors",data:{motorPwm:Q}}),Q},[i,S,d]),N=m.useCallback(L=>!d||!g?null:(S({type:"servo",data:{servo:{angle:L}}}),L),[S,d,g]),j=m.useCallback(L=>{if(!d)return!1;const Z=Array.isArray(L)?L:typeof L=="string"?BS[L]:null;return Z?(S({type:"raw",data:{raw:VS(Z)}}),w(),!0):!1},[S,w,d]),q=m.useCallback(async L=>{if(!(!L||!Array.isArray(L.steps)||!d))for(const Z of L.steps){if(!d)break;switch(Z.type){case"oi":j(Z.command);break;case"drive":M(Z.speeds??{left:0,right:0});break;case"motors":C(Z.values??{});break;case"servo":N(Z.angle);break;case"pause":await d0(Z.duration??ef);break}if(Z.delay||Z.delayMs){const O=Z.delayMs??Z.delay;typeof O=="number"&&O>0&&await d0(O)}}},[d,j,M,C,N]),A=m.useCallback((L="toggle")=>!d||!x?null:(S({type:"nightVision",data:{nightVision:{action:L}}}),L),[S,x,d]),k=m.useCallback(L=>d?(S({type:"horn",data:{horn:L}}),L):null,[S,d]),B=m.useCallback((L=[],Z={})=>{if(!d)return null;const X=(Array.isArray(L)&&L.length>0?L:[{note:zl,duration:tf}]).slice(0,16).map($=>({note:Zt(Math.round($?.note??zl),wf),duration:Zt(Math.round($?.duration??tf),[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:g,nightVision:x,nightVisionState:y,horn:v,emitCommand:S,enableSensorStream:w,sendDriveDirect:M,sendAuxMotors:C,sendServoAngle:N,sendOiCommand:j,sendNightVision:A,sendHorn:k,sendSong:B,runMacroSteps:q}),[d,h,g,x,y,v,S,w,M,C,N,j,A,k,q])}const $S={"{":"[","}":"]",":":";",'"':"'","<":",",">":".","?":"/","|":"\\",_:"-","+":"="},m0={"[":"BracketLeft","]":"BracketRight","\\":"Backslash",";":"Semicolon","'":"Quote",",":"Comma",".":"Period","/":"Slash","-":"Minus","=":"Equal","`":"Backquote"};function ai(a){if(typeof a!="string")return"";const l=a.toLowerCase();return $S[l]??l}function GS(a){const l=ai(a);if(!l)return null;if(m0[l])return m0[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 Rg(a){const l=ai(a);return l?`key:${l}`:null}function XS(a){const l=GS(a);return l?`code:${l}`:null}function h0(a){const l=new Set,i=Rg(a?.key??"");i&&l.add(i);const r=a?.code?`code:${a.code}`:null;return r&&l.add(r),Array.from(l)}function QS(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=Rg(String(d));h&&f.add(h);const g=XS(String(d));g&&f.add(g)}),[l,f]}))}function un(a){const l=ai(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 cn={keyboard:{baseSpeed:250,turboSpeed:400,precisionSpeed:125,tiltSpeed:80,tiltIntervalMs:110}},zn={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}]}}},da={activeSignature:null,profiles:{},defaults:{profile:zn}},Ha={waveform:"saw",freqs:[440,550,660,0]},Ol=[{key:"drive",motors:["leftWheel","rightWheel"]},{key:"aux",motors:["mainBrush","sideBrush"]}],KS={downRatePerSec:.15,upRatePerSec:.7,releaseDelaySec:1,outputRateMs:250};function p0(){return Ol.reduce((a,l)=>(a[l.key]={cap:1,clearSec:0},a),{})}function g0(a){return Number.isFinite(a)?Math.max(0,Math.min(1,a)):0}function ZS(a,l={}){const{session:i}=ze(),d=($l(a)?.sensors||{})?.wheelOvercurrents||{},h=m.useMemo(()=>({...KS,...l.config||{}}),[l.config]),[g,x]=m.useState(()=>p0()),v=m.useRef(typeof performance<"u"?performance.now():Date.now()),y=m.useRef(d);m.useEffect(()=>{y.current=d||{}},[d]),m.useEffect(()=>{x(p0())},[a]),m.useEffect(()=>{const C=setInterval(()=>{const N=typeof performance<"u"?performance.now():Date.now(),j=Math.max(0,N-v.current);v.current=N;const q=j/1e3;q<=0||x(A=>{let k=!1;const B={},L=Number.isFinite(h.downRatePerSec)?Math.max(0,h.downRatePerSec):0,Z=Number.isFinite(h.upRatePerSec)?Math.max(0,h.upRatePerSec):0,O=Number.isFinite(h.releaseDelaySec)?Math.max(0,h.releaseDelaySec):0;return Ol.forEach(X=>{const $=A[X.key]||{cap:1,clearSec:0},Q=Number.isFinite($.cap)?$.cap:1,z=Number.isFinite($.clearSec)?$.clearSec:0,K=X.motors.some(R=>!!y.current?.[R]),ee=K?0:z+q,oe=!K&&ee>=O,W=g0(K?Q-L*q:oe?Q+Z*q:Q);(Math.abs(W-Q)>1e-4||Math.abs(ee-z)>1e-4)&&(k=!0),B[X.key]={cap:W,clearSec:ee}}),k?B:A})},100);return()=>clearInterval(C)},[h.downRatePerSec,h.releaseDelaySec,h.upRatePerSec]);const S=m.useMemo(()=>{const C=Ol.reduce((N,j)=>{const q=g?.[j.key],A=Number.isFinite(q?.cap)?q.cap:1;return N[j.key]=g0(A),N},{});return{perGroup:C,drive:{left:C.drive??1,right:C.drive??1},aux:{main:C.aux??1,side:C.aux??1,vacuum:1}}},[g]),w=m.useMemo(()=>{const C={};Ol.forEach(j=>{j.motors.forEach(q=>{C[q]=!!d?.[q]})});const N=Ol.reduce((j,q)=>(j[q.key]=q.motors.some(A=>!!d?.[A]),j),{});return{motors:C,groups:N}},[d]),M=i?.role==="admin"||i?.role==="lockdown"||i?.role==="lockdown-admin";return m.useMemo(()=>({caps:g,overcurrent:w,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:M}),[g,w,S,h,M])}function FS(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 JS(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 kg=m.createContext(null);function x0(a){return Object.fromEntries(Object.entries(a||{}).map(([l,i])=>[l,Array.isArray(i)?[...i]:[]]))}function IS(a,l){if(!a)return l;const i=typeof a.minAngle=="number"?a.minAngle:-45,r=typeof a.maxAngle=="number"?a.maxAngle:45;return Ll(l,i,r)}function WS({children:a}){const[l,i]=m.useReducer(LS,f0),r=m.useRef(null),f=m.useRef(!1),d=m.useRef(f0.camera.angle),h=m.useRef(null),g=m.useRef(0),x=m.useRef(0),{value:v,save:y}=xt("controls",{keymap:Xs,macros:Tg}),{value:S}=xt("horn",Ha),{session:w,homeAssistantSetState:M}=ze(),C=w?.assignment?.roverId??null,N=ZS(C),j=m.useCallback(ae=>FS(ae,N.scales,N.adminImmune),[N.adminImmune,N.scales]),q=m.useCallback(ae=>JS(ae,N.scales,N.adminImmune),[N.adminImmune,N.scales]),A=YS({driveTransform:j,auxTransform:q}),k=m.useCallback(()=>{const re=(w?.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=>{M(Se.id,"on").catch(()=>{})}),f.current=!1},[w?.homeAssistant?.entities,M]);m.useEffect(()=>{i({type:"control/set-rover",payload:A.roverId})},[A.roverId]),m.useEffect(()=>{const ae=r.current;r.current=l.mode,ae!=="drive"&&l.mode==="drive"&&w?.homeAssistant?.entities?k():ae!=="drive"&&l.mode==="drive"&&(f.current=!0)},[l.mode,w?.homeAssistant?.entities,k]),m.useEffect(()=>{f.current&&w?.homeAssistant?.entities&&k()},[w?.homeAssistant?.entities,k]),m.useEffect(()=>{const ae={...Xs,...v?.keymap||{}};i({type:"control/set-keymap",payload:ae}),v?.macros&&i({type:"control/set-macros",payload:v.macros})},[v?.keymap,v?.macros]),m.useEffect(()=>{const ae=A.servoConfig;if(!ae){i({type:"control/set-camera-config",payload:{config:null}}),d.current=null;return}const re=typeof ae.minAngle=="number"?ae.minAngle:-45,Se=typeof ae.maxAngle=="number"?ae.maxAngle:45,Re=typeof ae.homeAngle=="number"?ae.homeAngle:(re+Se)/2,qe=typeof d.current=="number"?Ll(d.current,re,Se):null,Ye=qe??Ll(Re,re,Se);i({type:"control/set-camera-config",payload:{config:ae,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 B=m.useCallback(ae=>{i({type:"control/set-mode",payload:ae})},[]),L=m.useCallback(()=>{i({type:"control/record-intent"})},[]),Z=m.useRef(l.drive.speeds),O=m.useRef(l.aux),X=m.useMemo(()=>JSON.stringify(N.scales),[N.scales]),$=m.useRef(0),Q=m.useRef(0);m.useEffect(()=>{Z.current=l.drive.speeds},[l.drive.speeds]),m.useEffect(()=>{O.current=l.aux},[l.aux]),m.useEffect(()=>{if(!A.roverId||N.adminImmune||!N.isActive)return;const ae=Math.max(0,Number(N?.config?.outputRateMs)||0),re=typeof performance<"u"?performance.now():Date.now(),Se=Z.current||{left:0,right:0},Re=O.current||{main:0,side:0,vacuum:0},qe=!!(Se.left||Se.right),Ye=!!(Re.main||Re.side||Re.vacuum);!qe&&!Ye||(qe&&re-$.current>=ae&&($.current=re,A.sendDriveDirect(Se)),Ye&&re-Q.current>=ae&&(Q.current=re,A.sendAuxMotors(Re)))},[X,N.adminImmune,N.config,N.isActive,A]);const z=m.useCallback((ae,re={})=>{const Se=HS(ae,re.speedOptions);i({type:"control/update-drive",payload:{...Se,source:re.source??null}}),L(),A.sendDriveDirect(Se.speeds)},[A,L]),K=m.useCallback((ae={})=>{const re=A.sendAuxMotors(ae)??ae;i({type:"control/set-aux-motors",payload:re}),L()},[A,L]),ee=m.useCallback((ae,re)=>{if(!ae)return!1;const Se=ai(re);if(!Se)return!1;const Re=x0(l.keymap);return Re[ae]=[Se],i({type:"control/set-keymap",payload:Re}),y(qe=>({...qe??{},keymap:Re})),!0},[l.keymap,y]),oe=m.useCallback(()=>{const ae=x0(Xs);i({type:"control/set-keymap",payload:ae}),y(re=>({...re??{},keymap:ae}))},[y]),W=m.useCallback(ae=>{if(!A.servoConfig)return;const re=IS(A.servoConfig,ae);i({type:"control/set-camera-angle",payload:re}),A.sendServoAngle(re),d.current=re,L()},[A,L]),R=m.useCallback((ae=0)=>{const re=A.servoConfig;if(!re)return;const Se=typeof ae=="number"&&ae!==0?ae:re.nudgeDegrees||1,Re=typeof d.current=="number"?d.current:typeof re.homeAngle=="number"?re.homeAngle:0;W(Re+Se)},[A.servoConfig,W]),F=m.useCallback(()=>{const ae=A.servoConfig;if(!ae)return;const re=typeof ae.homeAngle=="number"?ae.homeAngle:typeof ae.minAngle=="number"&&typeof ae.maxAngle=="number"?(ae.minAngle+ae.maxAngle)/2:0;W(re)},[A.servoConfig,W]),ne=m.useCallback(async ae=>{const re=l.macros.find(Se=>Se.id===ae)||null;re&&(ae==="drive-sequence"?(k(),w?.homeAssistant?.entities||(f.current=!0),L()):ae==="seek-dock"&&L(),await A.runMacroSteps(re))},[A,L,w?.homeAssistant?.entities,l.macros,k]),ue=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]),he=m.useCallback(ae=>{A.sendOiCommand(ae)},[A]),E=m.useCallback(ae=>{A.roverId&&A.emitCommand({type:"sensorStream",data:{sensorStream:{enable:ae}}})},[A]),Y=m.useCallback(ae=>{if(A.nightVision){if(typeof ae=="boolean"){const re=ae?"off":"on";A.sendNightVision(re)}else A.sendNightVision("toggle");L()}},[A,L]),te=m.useCallback(()=>{Y()},[Y]),le=m.useCallback(ae=>{const re=typeof ae=="number"?ae:zl;return i({type:"control/set-song-note",payload:re}),re},[]),se=m.useCallback((ae,re)=>A.sendSong(ae,re),[A]),ie=m.useMemo(()=>{const ae=S??Ha,re=ae.waveform==="sine"?"sine":"saw",Re=[...Array.isArray(ae.freqs)?ae.freqs:Ha.freqs,0,0,0,0].slice(0,4).map(qe=>{const Ye=Number(qe);return Number.isFinite(Ye)?Ye<=0?0:Math.min(5e3,Math.round(Ye)):0});return{waveform:re,freqs:Re}},[S]),ce=m.useCallback(()=>{if(!A.horn)return;if(l.horn?.overheated||(l.horn?.heat??0)>=1||l.horn?.active)return!1;const ae=Date.now();return A.sendHorn({action:"start",...ie}),i({type:"control/set-horn-active",payload:!0}),g.current=ae,x.current=ae,h.current&&(clearTimeout(h.current),h.current=null),h.current=setTimeout(()=>{xe()},DS),L(),!0},[i,ie,A,L,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 ae=Date.now(),re=g.current||ae,Se=Math.max(0,ae-re);if(g.current=0,Se>0){const Re=l.horn?.heat??0,qe=Se/1e3*qu;let Ye=Math.max(0,Math.min(1,Re+qe)),vt=l.horn?.overheated??!1;Ye>=1&&(Ye=1,vt=!0),i({type:"control/set-horn-heat",payload:{heat:Ye,overheated:vt}})}},[i,A,l.horn?.heat,l.horn?.overheated,qu]);m.useEffect(()=>{const re=setInterval(()=>{const Se=Date.now(),Re=x.current||Se;x.current=Se;const qe=Math.min(1e3,Math.max(0,Se-Re))/1e3,Ye=l.horn?.heat??0,vt=!!l.horn?.active,Vn=!!l.horn?.overheated,pn=qe*(vt?qu:-.2);let Jt=Math.max(0,Math.min(1,Ye+pn)),Tt=Vn;Jt>=1?(Jt=1,Tt=!0,vt&&xe()):Tt&&Jt<=OS&&(Tt=!1),(Jt!==Ye||Tt!==Vn)&&i({type:"control/set-horn-heat",payload:{heat:Jt,overheated:Tt}})},100);return()=>clearInterval(re)},[i,l.horn?.active,l.horn?.heat,l.horn?.overheated,xe]);const pe=m.useCallback((ae,re)=>{i({type:"control/register-input-state",payload:{source:ae,state:re}})},[]),je=m.useMemo(()=>({state:l,dispatch:i,pipeline:A,overcurrentLimiter:N,actions:{setMode:B,setDriveVector:z,setAuxMotors:K,setServoAngle:W,nudgeServo:R,goServoHome:F,runMacro:ne,stopAllMotion:ue,sendOiCommand:he,setSensorStream:E,setNightVision:Y,toggleNightVision:te,updateKeyBinding:ee,resetKeyBindings:oe,registerInputState:pe,setSongNote:le,sendSong:se,startHorn:ce,stopHorn:xe}}),[l,A,N,B,z,K,W,R,F,ne,ue,he,E,Y,te,ee,oe,pe,le,se,ce,xe]);return o.jsx(kg.Provider,{value:je,children:a})}function Mt(){const a=m.useContext(kg);if(!a)throw new Error("useControlSystem must be used within ControlSystemProvider");return a}const PS="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=",_g=m.createContext({messages:[],typing:[],sendMessage:async()=>{},focusChat:()=>{},blurChat:()=>{},registerInputRef:()=>{},onInputFocus:()=>{},onInputBlur:()=>{},setTypingActive:()=>{},isChatFocused:!1});function eA({children:a}){const l=hn(),{session:i,pushAlert:r}=ze(),[f,d]=m.useState([]),[h,g]=m.useState([]),[x,v]=m.useState(!1),y=m.useRef(null),S=m.useRef(null),w=m.useRef(null),M=m.useRef(new Map),C=m.useRef(new Map),N=m.useRef({isTyping:!1,lastSent:0}),j=m.useCallback(()=>{const z=Array.from(M.current.values()).sort((K,ee)=>K.lastUpdate-ee.lastUpdate).map(K=>K.payload);g(z)},[]),q=m.useCallback(z=>!z||typeof z!="object"?null:z.typingId?z.typingId:z.fromDiscord?`discord:${z.discordUserId||z.discordUserName||z.nickname||"unknown"}`:`socket:${z.socketId||z.nickname||"unknown"}`,[]);m.useEffect(()=>{w.current=new Audio(PS),w.current.load()},[]);const A=m.useCallback(()=>{const z=w.current;z&&(z.currentTime=0,z.play().catch(()=>{}))},[]);m.useEffect(()=>{function z(K={}){d(ee=>[...ee.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",z),()=>{l.off("chat:message",z)}},[A,i?.socketId,l]),m.useEffect(()=>{function z(K={}){const ee=q(K);if(!ee)return;const oe=Date.now();if(K?.socketId&&i?.socketId&&K.socketId===i.socketId){K.isTyping||(M.current.delete(ee),j());return}if(K.isTyping){M.current.set(ee,{payload:K,expiresAt:oe+6e3,lastUpdate:oe});const W=C.current.get(ee)||0;oe-W>=2500&&(C.current.set(ee,oe),r?.({kind:"chat-typing",payload:K,id:`chat-typing-${ee}-${K.id||Math.random().toString(36).slice(2)}`,receivedAt:oe}))}else M.current.delete(ee);j()}return l.on("chat:typing",z),()=>{l.off("chat:typing",z)}},[r,j,q,i?.socketId,l]),m.useEffect(()=>{const z=setInterval(()=>{const K=Date.now();let ee=!1;M.current.forEach((oe,W)=>{oe.expiresAt<=K&&(M.current.delete(W),ee=!0)}),ee&&j()},2e3);return()=>clearInterval(z)},[j]),m.useEffect(()=>{function z(K=[]){Array.isArray(K)&&d(ee=>{if(ee.length===0)return K.slice(-100);const oe=new Set(K.map(R=>R?.id));return[...K,...ee.filter(R=>R?.id&&!oe.has(R.id))].slice(-100)})}return l.on("chat:init",z),()=>{l.off("chat:init",z)}},[l]);const k=m.useCallback(z=>{const K=!!z,ee=Date.now(),oe=N.current,W=!K&&oe.isTyping;!(K&&(!oe.isTyping||ee-oe.lastSent>=3500))&&!W||(N.current={isTyping:K,lastSent:ee},l.emit("chat:typing",{isTyping:K}))},[l]),B=m.useCallback((z,K=null)=>new Promise((ee,oe)=>{l.emit("chat:send",{text:z,tts:K},(W={})=>{W.error?oe(new Error(W.error)):ee(W)})}),[l]),L=m.useCallback((z,K={})=>{(K?.target==="hud"?"hud":"panel")==="hud"?S.current=z:y.current=z},[]),Z=m.useCallback(()=>{v(!0),(S.current||y.current)?.focus()},[]),O=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:B,focusChat:Z,blurChat:O,registerInputRef:L,onInputFocus:X,onInputBlur:$,setTypingActive:k,typing:h,isChatFocused:x,selfSocketId:i?.socketId||null}),[O,Z,x,f,$,X,L,B,i?.socketId,k,h]);return o.jsx(_g.Provider,{value:Q,children:a})}function Cf(){const a=m.useContext(_g);if(!a)throw new Error("useChat must be used inside ChatProvider");return a}const tA=new Set(["","text","search","email","password","url","tel","number","date","datetime-local","month","time","week"]);function Dg(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 tA.has(i)}function nA(){return typeof document>"u"?!1:Dg(document.activeElement)}const Mu="keyboard",Tu={x:0,y:0,boost:!1},Ru={main:0,side:0,vacuum:0},v0=wf[0],y0=wf[1],Ef=5,Zs=500,Fs=1,qf=100;function ku(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(0,Math.min(500,i)):l}function aA(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(Ef,Math.min(Zs,i)):l}function Og(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(Fs,Math.min(qf,i)):l}function lA(a){const i=(Og(a,a)-Fs)/(qf-Fs),r=Zs-i*(Zs-Ef);return Math.round(r)}function sA(a){const l=aA(a,a),i=(Zs-l)/(Zs-Ef),r=Fs+i*(qf-Fs);return Math.round(r)}function iA(a){return Dg(a?.target)}function tt(a,l){if(!a||a.size===0)return!1;for(const i of l)if(a.has(i))return!0;return!1}function rA(a,l){const i=tt(l.driveForward,a),r=tt(l.driveBackward,a),f=tt(l.driveLeft,a),d=tt(l.driveRight,a),h=tt(l.boostModifier,a),g=tt(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=g?.4:1;return{x:v*y,y:x*y,boost:h&&!g}}function oA(a,l){if(tt(l.auxAllForward,a))return{main:127,side:127,vacuum:127};const r=tt(l.auxMainForward,a)?127:tt(l.auxMainReverse,a)?-127:0,f=tt(l.auxSideForward,a)?127:tt(l.auxSideReverse,a)?-70:0,d=tt(l.auxVacuumFast,a)?127:tt(l.auxVacuumSlow,a)?50:0;return{main:r,side:f,vacuum:d}}function cA(){const{state:a,actions:{setMode:l,setDriveVector:i,setAuxMotors:r,nudgeServo:f,runMacro:d,stopAllMotion:h,registerInputState:g,toggleNightVision:x,startHorn:v,stopHorn:y,setSongNote:S,sendSong:w}}=Mt(),{session:M,homeAssistantSetState:C}=ze(),{focusChat:N,blurChat:j,isChatFocused:q}=Cf(),{value:A}=xt("inputs",cn),k=m.useMemo(()=>QS(a.keymap),[a.keymap]),B=m.useMemo(()=>{const se=new Set;return Object.values(k).forEach(ie=>{ie&&ie.forEach(ce=>se.add(ce))}),se},[k]),L=m.useMemo(()=>{const se=cn.keyboard,ie=A?.keyboard??{};return{baseSpeed:ku(ie.baseSpeed,se.baseSpeed),turboSpeed:ku(ie.turboSpeed,se.turboSpeed),precisionSpeed:ku(ie.precisionSpeed,se.precisionSpeed)}},[A?.keyboard]),Z=m.useMemo(()=>{const se=cn.keyboard,ie=A?.keyboard??{},ce=Og(typeof ie.tiltSpeed=="number"?ie.tiltSpeed:typeof ie.tiltIntervalMs=="number"?sA(ie.tiltIntervalMs):se.tiltSpeed,se.tiltSpeed);return lA(ce)},[A?.keyboard]),O=m.useMemo(()=>Math.abs(a.camera?.config?.nudgeDegrees||1),[a.camera?.config?.nudgeDegrees]),X=m.useRef(new Set),$=m.useRef(Tu),Q=m.useRef(Ru),z=m.useRef(null),K=m.useRef(null),ee=m.useRef(!1),oe=m.useCallback(()=>{const se=new Set(X.current);tt(k.boostModifier,se);const ce=tt(k.slowModifier,se)?{baseSpeed:L.precisionSpeed,boostSpeed:L.precisionSpeed}:{baseSpeed:L.baseSpeed,boostSpeed:L.turboSpeed},xe=rA(se,k),pe=oA(se,k);(xe.x!==$.current.x||xe.y!==$.current.y||xe.boost!==$.current.boost)&&($.current=xe,i(xe,{source:Mu,speedOptions:ce})),(pe.main!==Q.current.main||pe.side!==Q.current.side||pe.vacuum!==Q.current.vacuum)&&(Q.current=pe,r(pe)),g(Mu,{keys:Array.from(se),vector:xe,aux:pe})},[k,L,g,r,i]),W=m.useCallback(()=>{z.current&&(clearTimeout(z.current),z.current=null)},[]),R=m.useCallback(()=>{const se=new Set(X.current),ie=tt(k.cameraUp,se),ce=tt(k.cameraDown,se);return(ie?1:0)-(ce?1:0)},[k]),F=m.useCallback(()=>{if(R()===0){W();return}if(z.current)return;const ie=()=>{const ce=R();if(ce===0){W();return}f(ce*O),z.current=setTimeout(ie,Z)};z.current=setTimeout(ie,0)},[R,f,Z,O,W]),ne=m.useCallback(()=>{K.current&&(clearTimeout(K.current),K.current=null)},[]),ue=m.useCallback(()=>{const se=new Set(X.current),ie=tt(k.songNoteUp,se),ce=tt(k.songNoteDown,se);return(ie?1:0)-(ce?1:0)},[k]),he=m.useCallback(se=>{if(se===0)return;let ce=(typeof a.song?.note=="number"?a.song.note:zl)+se;ce>y0?ce=v0:ce<v0&&(ce=y0);const xe=S(ce);w([{note:xe,duration:tf}],{slot:0})},[w,S,a.song?.note]),E=m.useCallback(()=>{if(ue()===0){ne();return}if(K.current)return;const ie=()=>{const ce=ue();if(ce===0){ne();return}he(ce),K.current=setTimeout(ie,_S)};K.current=setTimeout(ie,0)},[ue,ne,he]),Y=m.useCallback(()=>{X.current.clear(),$.current=Tu,Q.current=Ru,W(),ne(),ee.current&&(ee.current=!1,y()),h(),g(Mu,{keys:[],vector:Tu,aux:Ru})},[g,h,y,W,ne]),te=m.useCallback(se=>{const ie=M?.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(se==="on"){const pe=xe.find(je=>je.state!=="on");pe&&C(pe.id,"on").catch(()=>{});return}if(se==="off")for(let pe=xe.length-1;pe>=0;pe-=1){const je=xe[pe];if(je.state==="on"){C(je.id,"off").catch(()=>{});break}}}},[C,M?.homeAssistant]);m.useEffect(()=>{function se(xe){if(iA(xe))return;const pe=h0(xe);if(pe.length===0)return;const je=new Set(pe);if(tt(k.chatFocus,je)){xe.preventDefault(),Y(),q||N();return}pe.some(re=>B.has(re))&&xe.preventDefault();const ae=pe.filter(re=>!X.current.has(re));if(ae.forEach(re=>X.current.add(re)),ae.length>0)if(ae.some(re=>k.driveMacro?.has(re)))l("drive"),d("drive-sequence");else if(ae.some(re=>k.dockMacro?.has(re)))l("dock"),d("seek-dock");else if(ae.some(re=>k.nightVisionToggle?.has(re)))x();else if(ae.some(re=>k.hornHonk?.has(re))){if(!ee.current){const re=v();ee.current=!!re}}else ae.some(re=>k.homeAssistantOn?.has(re))?te("on"):ae.some(re=>k.homeAssistantOff?.has(re))&&te("off");F(),E(),oe()}function ie(xe){h0(xe).forEach(je=>X.current.delete(je)),ee.current&&!tt(k.hornHonk,X.current)&&(ee.current=!1,y()),F(),E(),oe()}function ce(){Y()}return window.addEventListener("keydown",se,{capture:!0}),window.addEventListener("keyup",ie,{capture:!0}),window.addEventListener("blur",ce),()=>{window.removeEventListener("keydown",se,{capture:!0}),window.removeEventListener("keyup",ie,{capture:!0}),window.removeEventListener("blur",ce)}},[B,j,oe,F,E,N,q,k.chatFocus,k.dockMacro,k.driveMacro,k.hornHonk,Y,d,l,h,ne,v,y,te]);const le=m.useRef(Y);return m.useEffect(()=>{le.current=Y},[Y]),m.useEffect(()=>{le.current()},[a.roverId]),m.useEffect(()=>{ee.current=!!a.horn?.active},[a.horn?.active]),m.useEffect(()=>()=>{W(),ne()},[W,ne]),null}const uA=1.6;function Bg(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 fA(a){return JSON.parse(JSON.stringify(a??{}))}function zg(a,l){const i=fA(l);return i.meta={id:a?.id??"Unknown",mapping:a?.mapping??"none",axes:a?.axes?.length??0,buttons:a?.buttons?.length??0},i}function Ua(a){return Number.isFinite(a)?Math.max(-1,Math.min(1,a)):0}function Vs(a,l){if(!a)return 0;const i=Math.abs(a);return l==="expo"?Math.sign(a)*Math.pow(i,uA):a}function _u(a,l){const i=Math.abs(a);if(i<=l)return 0;const r=(i-l)/(1-l);return Math.sign(a)*r}function dA(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 Hr(a,l){if(!a||!Array.isArray(a.axes))return null;const i=a.axes[l];return Number.isFinite(i)?Ua(i):null}function lf(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 Du(a,l=[]){for(const i of l)if(i){if(i.kind==="axis"){const r=Hr(a,i.index);if(r===null)continue;return{value:i.invert?-r:r,source:i}}if(i.kind==="buttonAxis"){const r=lf(a,i.index);if(!r)continue;return{value:Ua(r.value),source:i}}}return{value:0,source:null}}function mA(a,l=[]){for(const i of l){if(!i||i.kind!=="axisPair")continue;const r=Hr(a,i.x),f=Hr(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 Ba(a,l=[]){for(const i of l)if(i){if(i.kind==="button"){const r=lf(a,i.index);if(!r)continue;return{pressed:r.pressed,source:i}}if(i.kind==="axisButton"){const r=Hr(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=lf(a,i.index);if(!r)continue;return{pressed:r.value>.5,source:i}}}return{pressed:!1,source:null}}function Lg(a,l){const i=l?.bindings??{},r=l?.calibration??{},f=i.drive??{},d=mA(a,f.sources);let h=Ua(d.x),g=Ua(d.y);const x=Math.min(Math.max(r.driveDeadzone??.18,0),.8),v=dA(h,g,x);h=Vs(v.x,r.driveCurve),g=Vs(v.y,r.driveCurve);const y=i.cameraTilt??{},S=Du(a,y.sources),w=Math.min(Math.max(r.cameraDeadzone??.08,0),.8);let M=_u(Ua(S.value),w);M=Vs(M,r.cameraCurve);const C=Math.min(Math.max(r.auxDeadzone??.05,0),.6),N=i.mainBrush??{},j=Du(a,N.sources);let q=_u(Ua(j.value),C);q=Vs(q,r.auxCurve);const A=i.sideBrush??{},k=Du(a,A.sources);let B=_u(Ua(k.value),C);B=Vs(B,r.auxCurve);const L=Ba(a,i.vacuum?.sources),Z=Ba(a,i.allAux?.sources),O=Ba(a,i.mainReverse?.sources),X=Ba(a,i.sideReverse?.sources),$=Ba(a,i.driveMacro?.sources),Q=Ba(a,i.dockMacro?.sources),z=Ba(a,i.nightVisionToggle?.sources);return{driveVector:{x:h,y:g,boost:!1},cameraAxis:M,auxAxis:{main:q,side:B},buttons:{vacuum:L.pressed,allAux:Z.pressed,mainReverse:O.pressed,sideReverse:X.pressed,driveMacro:$.pressed,dockMacro:Q.pressed,nightVisionToggle:z.pressed},sources:{drive:d.source,cameraTilt:S.source,mainBrush:j.source,sideBrush:k.source,vacuum:L.source,allAux:Z.source,mainReverse:O.source,sideReverse:X.source,driveMacro:$.source,dockMacro:Q.source,nightVisionToggle:z.source}}}const Or=new Set;let Bl=null,Vr={pads:[],timestamp:0};function hA(){if(typeof navigator>"u"||!navigator.getGamepads)return[];const a=navigator.getGamepads();return a?Array.from(a).filter(Boolean):[]}function pA(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:Bg(a)}}function gA(){Vr={pads:hA().map(pA),timestamp:typeof performance<"u"?performance.now():Date.now()},Or.forEach(l=>l(Vr))}function Ug(){gA(),Bl=requestAnimationFrame(Ug)}function xA(){Bl||(Bl=requestAnimationFrame(Ug))}function vA(){Bl&&(cancelAnimationFrame(Bl),Bl=null)}function Hg(a){return Or.add(a),xA(),a(Vr),()=>{Or.delete(a),Or.size===0&&vA()}}function yA(){const[a,l]=m.useState(Vr);return m.useEffect(()=>Hg(l),[]),a}const kl="gamepad",za={x:0,y:0,boost:!1},La={main:0,side:0,vacuum:0},bA=100,SA=100;function Ou(a,l){return a&&l&&a.x===l.x&&a.y===l.y&&a.boost===l.boost}function Bu(a,l){return a&&l&&a.main===l.main&&a.side===l.side&&a.vacuum===l.vacuum}function AA(a){return a?Math.hypot(a.x||0,a.y||0):0}function jA(a){return a?!a.main&&!a.side&&!a.vacuum:!0}function NA(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 wA(){const{state:a,actions:{setMode:l,setDriveVector:i,setAuxMotors:r,setServoAngle:f,runMacro:d,toggleNightVision:h,registerInputState:g}}=Mt(),{value:x,save:v}=xt("gamepad",da),y=m.useRef(new Set),S=m.useRef(za),w=m.useRef(La),M=m.useRef({main:!1,side:!1}),C=m.useRef(new Map),N=m.useRef(0),j=m.useRef(0),q=m.useRef(0),A=m.useRef(null),k=m.useCallback(O=>{const X=O.signature??Bg(O);x?.profiles?.[X]||y.current.has(X)||(y.current.add(X),v($=>{const Q=$??da;if(Q.profiles?.[X])return Q;const z=Q?.defaults?.profile??zn,K=zg(O,z);return{...Q,profiles:{...Q.profiles??{},[X]:K}}}))},[x?.profiles,v]),B=m.useCallback((O,X)=>{const $=C.current.get(O)||!1;return C.current.set(O,X),X&&!$},[]),L=m.useCallback((O,X)=>{const $=a.camera?.config;if(!$)return;const Q=typeof performance<"u"?performance.now():Date.now(),z=X?.cameraMode??"absolute",K=Math.max(1,Math.min(180,X?.cameraSensitivity??60));if(z==="velocity"){const F=Math.min(50,Q-q.current||16),ne=O*K*(F/1e3);if(Math.abs(ne)<.01)return;const he=(typeof A.current=="number"?A.current:typeof a.camera?.angle=="number"?a.camera.angle:typeof $.homeAngle=="number"?$.homeAngle:0)+ne;f(he),A.current=he,q.current=Q;return}const ee=typeof $.minAngle=="number"?$.minAngle:-45,oe=typeof $.maxAngle=="number"?$.maxAngle:45,W=typeof $.homeAngle=="number"?$.homeAngle:(ee+oe)/2,R=O<0?W+O*(W-ee):W+O*(oe-W);typeof A.current=="number"&&Math.abs(A.current-R)<.35&&Q-q.current<80||(q.current=Q,A.current=R,f(R))},[f,a.camera?.angle,a.camera?.config]),Z=m.useMemo(()=>x?.activeSignature??null,[x?.activeSignature]);return m.useEffect(()=>Hg(O=>{const X=NA(O.pads,Z);if(!X){Ou(S.current,za)||(S.current=za,i(za,{source:kl})),Bu(w.current,La)||(w.current=La,r(La)),C.current=new Map,M.current={main:!1,side:!1},N.current=0,j.current=0,g(kl,{connected:!1});return}if(nA()){Ou(S.current,za)||(S.current=za,i(za,{source:kl})),Bu(w.current,La)||(w.current=La,r(La)),C.current=new Map,M.current={main:!1,side:!1},g(kl,{connected:!0,blocked:!0});return}k(X);const $=X.signature,Q=x?.profiles?.[$]??x?.defaults?.profile??zn,z=Lg(X,Q);if(!Ou(z.driveVector,S.current)){const ne=typeof performance<"u"?performance.now():Date.now();(AA(z.driveVector)<.02||ne-N.current>=bA)&&(S.current=z.driveVector,N.current=ne,i(z.driveVector,{source:kl}))}const K=Q.calibration?.auxSideScale??.55,ee=Math.round(Math.min(Math.abs(z.auxAxis.main),1)*127),oe=Math.round(Math.min(Math.abs(z.auxAxis.side),1)*127),W=M.current.main?-ee:ee,R=M.current.side?-Math.round(oe*K):Math.round(oe*K);let F={main:z.auxAxis.main!==0?W:0,side:z.auxAxis.side!==0?R:0,vacuum:z.buttons.vacuum?127:0};if(z.buttons.allAux&&(F={main:127,side:127,vacuum:127}),!Bu(F,w.current)){const ne=typeof performance<"u"?performance.now():Date.now();(jA(F)||ne-j.current>=SA)&&(w.current=F,j.current=ne,r(F))}z.buttons.mainReverse&&B("mainReverse",!0)?M.current.main=!M.current.main:z.buttons.mainReverse||B("mainReverse",!1),z.buttons.sideReverse&&B("sideReverse",!0)?M.current.side=!M.current.side:z.buttons.sideReverse||B("sideReverse",!1),z.buttons.driveMacro&&B("driveMacro",!0)?(l("drive"),d("drive-sequence")):z.buttons.driveMacro||B("driveMacro",!1),z.buttons.dockMacro&&B("dockMacro",!0)?(l("dock"),d("seek-dock")):z.buttons.dockMacro||B("dockMacro",!1),z.buttons.nightVisionToggle&&B("nightVisionToggle",!0)?h():z.buttons.nightVisionToggle||B("nightVisionToggle",!1),Math.abs(z.cameraAxis)>.001&&L(z.cameraAxis,Q.calibration),g(kl,{connected:!0,signature:$,id:X.id,index:X.index,axes:X.axes,buttons:X.buttons,drive:z.driveVector,aux:F,cameraAxis:z.cameraAxis,bindings:z.sources})}),[Z,k,x?.defaults?.profile,x?.profiles,B,L,g,d,r,i,l,h]),null}function Vg(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 Yg(a){const l=$l(a);return m.useMemo(()=>Vg(l),[l])}function _l({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 b0({label:a}){return a?o.jsx("span",{className:"rounded border border-white/40 px-1 text-[0.7rem] text-white",children:a}):null}function zu({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 CA({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(sf,{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 $g({layout:a="desktop",expand:l=!1,fill:i=!1,driveDockState:r,compactHeightClass:f=""}){const d=a==="mobile",{state:{roverId:h,keymap:g},actions:x}=Mt(),v=$l(h),y=r??Vg(v),{driving:S,docked:w,charging:M,dockingInProgress:C}=y,[N,j]=m.useState(null),[q,A]=m.useState(!1),[k,B]=m.useState(!1),L=!h||N!==null,Z=!h||N!==null,O=un(g?.driveMacro?.[0]),X=un(g?.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.",z={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=w?"Docked":"Undocked",ee=w?"good":"bad",oe=M?"Charging":w?"Charging in 5s":"—",W=M?"good":w?"warn":"bad",R=async()=>{if(!(!h||N)){j("drive");try{x.setMode("drive"),await x.runMacro("drive-sequence")}catch(qe){alert(qe.message)}finally{j(null)}}},F=async()=>{if(!(!h||N)){A(!1),B(!1),j("drive");try{x.setMode("drive"),await x.runMacro("drive-sequence")}catch(qe){alert(qe.message)}finally{j(null)}}},ne=async()=>{if(!(!h||N)){j("dock");try{x.setMode("dock"),await x.runMacro("seek-dock")}catch(qe){alert(qe.message)}finally{j(null),A(!1),B(!1)}}},ue=()=>{Z||(B(!0),A(!0))},he="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",E="text-center",Y="items-center justify-between",te="items-center justify-center",le=d?"text-sm font-semibold":"",se="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",ce="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",je=l||C,ae=je?"h-full flex-1":i?"flex-1":"",re=d&&!je?f:"",Se=d&&!je?te:Y,Re=d&&!je&&S&&w;if(!S&&!C)return o.jsxs("button",{type:"button",onClick:F,onContextMenu:qe=>qe.preventDefault(),disabled:L,className:`${he} ${ae} ${re} ${E} ${Se} ${le} ${se}`,children:[o.jsxs("div",{className:"space-y-0.5 w-full",children:[o.jsxs("div",{className:"flex w-full flex-col items-center gap-0.25",children:[o.jsx("span",{className:"text-base font-semibold text-emerald-50 md:text-lg",children:"Start Driving"}),!d&&je?o.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-0.5",children:[O?o.jsx(b0,{label:O}):null,o.jsx(zu,{label:"Click to start",tone:"emerald"})]}):null]}),je?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"text-sm text-emerald-50/90",children:z.summary}),o.jsx(sf,{steps:z.steps,tone:"emerald"})]}):null]}),je?o.jsxs("div",{className:"flex w-full flex-1 flex-col gap-0.5 self-stretch",children:[o.jsx(_l,{label:"Dock",value:K,tone:ee}),o.jsx(_l,{label:"Charge",value:oe,tone:W})]}):null]});if(C){const qe={summary:"If the rover is failing to dock, click to drive and try again.",steps:["The rover should be slowly wiggling towards the dock","If it is obviously not working, press this button to enter driving mode and try again"]};return o.jsxs("button",{type:"button",disabled:L,onClick:R,onContextMenu:Ye=>Ye.preventDefault(),className:`${he} ${ae} ${re} ${E} ${Se} ${le} ${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"}),je?o.jsx("div",{className:"flex flex-wrap items-center justify-center gap-0.5",children:o.jsx(zu,{label:"Return to driving mode",tone:"emerald"})}):null]}),je?o.jsx("p",{className:"text-sm text-amber-50/90",children:qe.summary}):null]}),je?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex w-full flex-1 flex-col gap-0.5 self-stretch",children:[o.jsx(_l,{label:"Dock",value:K,tone:ee}),o.jsx(_l,{label:"Charge",value:oe,tone:W})]}),d?null:o.jsx(sf,{steps:qe.steps,tone:"amber"})]}):null]})}return o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",disabled:Z,onClick:ue,onContextMenu:qe=>qe.preventDefault(),className:d?`flex w-full ${he} ${re} ${E} ${Se} ${le} ${Re?xe:ce}`:`${he} ${ae} ${E} ${Y} ${le} ${ce}`,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:Re?"Docked!":"Dock and Charge"}),!d&&je?o.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-0.5",children:[X?o.jsx(b0,{label:X}):null,o.jsx(zu,{label:"Click to begin docking",tone:"indigo"})]}):null]}),!d&&je&&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(_l,{label:"Dock",value:K,tone:ee}),o.jsx(_l,{label:"Charge",value:oe,tone:W})]}),o.jsx("div",{className:"text-xs text-indigo-100/80",children:"Line up straight, about 1 foot away, before docking."})]})]}),k||!d&&q?o.jsx(CA,{instructions:$,pending:N==="dock",onCancel:()=>{B(!1),A(!1)},onConfirm:ne}):null]})}function sf({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 Lu(a){return typeof a=="boolean"}function Gg({nightVisionOn:a,disabled:l,onToggle:i,keyLabel:r,className:f="",heightClass:d=""}){const[h,g]=m.useState(Lu(a)?a:null);m.useEffect(()=>{Lu(a)&&g(a)},[a]);const x=Lu(h),v=x?h:!1,y=x?v?"On":"Off":"—",S=v?"bg-emerald-500 text-emerald-950":"bg-slate-700 text-slate-200",w=()=>{if(l)return;const C=x?!v:!0;g(C),i?.(C)},M=m.useMemo(()=>["group flex w-full flex-col items-center justify-center gap-0.35 rounded-xl border-2 px-1 py-0.75 text-center select-none no-touch-select",v?"border-emerald-300/70 bg-emerald-800 text-emerald-50 hover:bg-emerald-700":"border-amber-300/70 bg-amber-900 text-amber-50 hover:bg-amber-800","disabled:opacity-50",d,f].filter(Boolean).join(" "),[f,v,d]);return o.jsxs("button",{type:"button",onClick:w,onContextMenu:C=>C.preventDefault(),disabled:l,"aria-pressed":v,className:M,children:[o.jsxs("span",{className:"flex items-center gap-0.5",children:[o.jsx("span",{className:"text-sm font-semibold",children:"Night Vision"}),r?o.jsx("span",{className:"rounded bg-slate-800 px-1 py-0.5 text-[0.6rem] font-semibold text-slate-200",children:r}):null]}),o.jsx("span",{className:`rounded px-1 py-0.5 text-[0.7rem] font-semibold ${S}`,children:y})]})}function Uu(a){const l=Number(a);return!Number.isFinite(l)||l<=0?0:Math.min(5e3,Math.round(l))}function Xg({disabled:a,onStart:l,onStop:i,keyLabel:r,active:f,heat:d=0,className:h="",defaultShowSettings:g=!0,showSettingsToggle:x=!1,compactSettings:v=!1}){const[y,S]=m.useState(!1),[w,M]=m.useState(g),{value:C,save:N}=xt("horn",Ha),[j,q]=m.useState(C?.waveform||Ha.waveform),[A,k]=m.useState(()=>[...Array.isArray(C?.freqs)?C.freqs:Ha.freqs,0,0,0,0].slice(0,4).map(R=>Uu(R)));m.useEffect(()=>{q(C?.waveform||Ha.waveform),Array.isArray(C?.freqs)&&k([...C.freqs,0,0,0,0].slice(0,4).map(W=>Uu(W)))},[C?.freqs,C?.waveform]);const B=!!f,L=Math.max(0,Math.min(1,Number(d)||0)),Z=m.useMemo(()=>["group relative flex w-full flex-col gap-0.5 overflow-hidden rounded-xl border-2 px-1 py-1.5 text-xs font-semibold select-none no-touch-select",B?"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,B]),O=()=>{a||y||(S(!0),l?.())},X=()=>{y&&(S(!1),i?.())};m.useEffect(()=>{!B&&y&&S(!1)},[B,y]);const $=j==="sine"?"sine":"saw",Q=m.useCallback(W=>{const R=W.target.value==="sine"?"sine":"saw";q(R),N(F=>({...F??{},waveform:R}))},[N]),z=m.useCallback((W,R)=>{k(F=>{const ne=[...F];return ne[W]=Uu(R),N(ue=>({...ue??{},freqs:ne})),ne})},[N]),K=W=>{if(a)return;const R=W.target?.tagName?.toLowerCase();R==="input"||R==="select"||R==="option"||R==="label"||R==="button"||(W.preventDefault(),O())},ee=W=>{const R=W.target?.tagName?.toLowerCase();R==="input"||R==="select"||R==="option"||R==="label"||R==="button"||(W.preventDefault(),X())},oe=x?o.jsx("button",{type:"button",onClick:W=>{W.preventDefault(),M(R=>!R)},className:"rounded bg-black/40 px-1 py-0.5 text-[0.6rem] font-semibold text-white/90 hover:text-white",children:w?"Hide":"Settings"}):null;return o.jsxs("div",{role:"button",tabIndex:0,"aria-pressed":y,onPointerDown:K,onPointerUp:ee,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) ${L*100}%, rgba(0,0,0,0) ${L*100}%)`}}),o.jsx("div",{className:`pointer-events-none absolute inset-0 transition-opacity ${B?"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]}),oe,o.jsx("span",{className:`rounded px-1 py-0.5 text-[0.65rem] font-semibold ${B?"bg-fuchsia-200 text-fuchsia-900":"bg-slate-800 text-slate-200"}`,children:B?"Honk":"Hold"})]}),w?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,R)=>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:R+1}),o.jsx("input",{type:"number",min:0,max:5e3,step:1,value:W,onChange:F=>z(R,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-${R}`))})]}):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,R)=>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:R+1}),o.jsx("input",{type:"number",min:0,max:5e3,step:1,value:W,onChange:F=>z(R,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-${R}`))]}):null]})}function Nr(a){return typeof a!="number"||Number.isNaN(a)?"—":`${a>0?"+":""}${a.toFixed(1)}°`}function S0({label:a}){return a?o.jsx("span",{className:"rounded border border-white/40 px-1 text-[0.7rem] text-white",children:a}):null}function Qg({value:a,min:l,max:i,step:r=.5,label:f="Camera Tilt",orientation:d="horizontal",onChange:h,onCommit:g,throttleMs:x=0,disabled:v=!1,keyDownLabel:y,keyUpLabel:S,className:w="",labelRowClass:M="",labelClass:C="",valueClass:N="",sliderClass:j="",endpointClass:q="",endpointLabelClass:A="",accentClass:k="",showValue:B=!0,showEndpoints:L}){const Z=d==="vertical",X=typeof L=="boolean"?L:!Z,[$,Q]=m.useState(a),z=m.useRef(!1),K=m.useRef(null);m.useEffect(()=>{z.current||Q(a)},[a]),m.useEffect(()=>()=>{K.current&&clearTimeout(K.current)},[]);const ee=ne=>{if(h){if(x>0){K.current&&clearTimeout(K.current),K.current=setTimeout(()=>{h(ne)},x);return}h(ne)}},oe=ne=>{const ue=Number.parseFloat(ne.target.value);Number.isNaN(ue)||(z.current=!0,Q(ue),ee(ue))},W=()=>{z.current=!1,K.current&&(clearTimeout(K.current),K.current=null),g?g($):x>0&&h?.($)};if(typeof l!="number"||typeof i!="number")return null;const R=[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:oe,onMouseUp:W,onTouchEnd:W,onPointerUp:W,disabled:v,className:R,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 ${w}`.trim(),children:[B?o.jsx("div",{className:`flex flex-col items-center ${M}`.trim(),children:o.jsx("span",{className:N,children:Nr(a)})}):null,o.jsxs("div",{className:"flex min-h-0 flex-1 items-center gap-0.5",children:[o.jsx("span",{className:C,children:f}),F]})]}):o.jsxs("div",{className:`space-y-0.5 ${w}`.trim(),children:[o.jsxs("div",{className:`flex items-center justify-between ${M}`.trim(),children:[o.jsx("span",{className:C,children:f}),B?o.jsx("span",{className:N,children:Nr(a)}):null]}),o.jsxs("div",{children:[F,X?o.jsxs("div",{className:`mt-0 flex items-center justify-between ${q}`.trim(),children:[o.jsxs("span",{className:`flex items-center gap-0.5 ${A}`.trim(),children:[y?o.jsx(S0,{label:y}):null,Nr(l)]}),o.jsxs("span",{className:`flex items-center gap-0.5 ${A}`.trim(),children:[Nr(i),S?o.jsx(S0,{label:S}):null]})]}):null]})]})}const wr="mobile-joystick",EA=80,qA=.15,MA={main:0,side:0,vacuum:0},TA={main:127,side:127,vacuum:127},RA={main:-127,side:-127,vacuum:-127};function kA({disabled:a,layout:l,radius:i,onMove:r,onStop:f}){const d=m.useRef(null),h=m.useRef(null),g=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(N=>{if(a||h.current!==null)return;N.preventDefault();const j=d.current;if(!j)return;const q=j.getBoundingClientRect(),A=N.clientX-q.left,k=N.clientY-q.top;g.current={x:A,y:k},h.current=N.pointerId,j.setPointerCapture?.(N.pointerId),v({active:!0,base:{x:A,y:k},knob:{x:0,y:0}})},[a]),w=m.useCallback(N=>{if(a||h.current!==N.pointerId)return;N.preventDefault();const j=d.current;if(!j)return;const q=j.getBoundingClientRect(),A=N.clientX-q.left,k=N.clientY-q.top,B=A-g.current.x,L=k-g.current.y,Z=Math.min(Math.hypot(B,L),i),O=Math.atan2(L,B),X=Math.cos(O)*Z,$=Math.sin(O)*Z,Q={x:Ul(X/i),y:Ul(-$/i),boost:!1};v(z=>({...z,knob:{x:X,y:$}})),r?.(Q)},[a,r]),M=m.useCallback(N=>{if(h.current!==N.pointerId)return;N.preventDefault(),d.current?.releasePointerCapture?.(N.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:w,onPointerUp:M,onPointerLeave:M,onPointerCancel:M,onContextMenu:N=>N.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 _A({layout:a}){const{state:{roverId:l},actions:{setDriveVector:i,registerInputState:r}}=Mt(),f=Yg(l),d=f.docked&&!f.driving,h=d||f.dockingInProgress,g=!l,x=EA,v=qA,y=m.useRef({x:0,y:0,boost:!1});m.useEffect(()=>{g&&(y.current={x:0,y:0,boost:!1})},[g]);const S=m.useCallback((N={})=>{if(g)return;const j={x:Ul(N.x??0),y:Ul(N.y??0),boost:!!N.boost},q={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=q,i(q,{source:wr}),r(wr,{vector:q,lastEvent:"move"})},[g,r,i,v]),w=m.useCallback(()=>{if(g)return;const N={x:0,y:0,boost:!1};y.current=N,i(N,{source:wr}),r(wr,{vector:N,lastEvent:"stop"})},[g,r,i]),C=`flex h-full flex-col gap-0.5 text-slate-100 ${d?"max-h-screen self-start":""}`;return o.jsxs("div",{className:C,children:[o.jsx($g,{layout:"mobile",expand:h,driveDockState:f,compactHeightClass:"min-h-[5rem]"}),h?null:o.jsx("div",{className:"flex-1 min-h-0",children:o.jsx(kA,{disabled:g,layout:a,radius:x,onMove:S,onStop:w})})]})}function A0({id:a,label:l,values:i,color:r,disabled:f,onPress:d,onRelease:h}){return o.jsx("button",{type:"button",disabled:f,onPointerDown:g=>{g.preventDefault(),d(a,i)},onPointerUp:()=>h(a),onPointerLeave:()=>h(a),onPointerCancel:()=>h(a),onContextMenu:g=>g.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 DA({layout:a}){const{state:{roverId:l,camera:i,horn:r},pipeline:f,actions:{setServoAngle:d,setNightVision:h,setAuxMotors:g,startHorn:x,stopHorn:v}}=Mt(),y=!l,S=m.useRef(null),w=i?.config,M=!!(l&&i?.enabled&&w),C=!!(l&&f?.nightVision),N=f?.nightVisionState,j=!!(l&&f?.horn),q=r?.overheated,A=typeof w?.minAngle=="number"?w.minAngle:-45,k=typeof w?.maxAngle=="number"?w.maxAngle:45,B=typeof i?.angle=="number"?i.angle:typeof w?.homeAngle=="number"?w.homeAngle:(A+k)/2,L=m.useCallback(X=>{C&&h(X)},[C,h]),Z=m.useCallback((X,$)=>{y||(S.current=X,g($))},[y,g]),O=m.useCallback(X=>{y||S.current===X&&(S.current=null,g(MA))},[y,g]);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(A0,{id:"aux-vac-forward",label:"Vacuum Forward",values:TA,color:"bg-fuchsia-600",disabled:y,onPress:Z,onRelease:O}),o.jsx(A0,{id:"aux-vac-backward",label:"Vacuum Backward",values:RA,color:"bg-fuchsia-800",disabled:y,onPress:Z,onRelease:O})]}),o.jsxs("div",{className:"flex min-h-0 items-stretch gap-0.5",children:[M?o.jsx("div",{className:"flex-1 min-h-0 rounded bg-zinc-950 p-0.25",children:o.jsx(Qg,{value:B,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,C?o.jsx(Gg,{nightVisionOn:N?.nightVisionOn,disabled:y,onToggle:L,heightClass:"h-full"}):null]}),o.jsx("div",{className:"min-h-0",children:j?o.jsx(Xg,{disabled:y||q,onStart:x,onStop:v,active:r?.active,heat:r?.heat,defaultShowSettings:!1,showSettingsToggle:!0,compactSettings:!0,className:"h-full"}):null})]})}function Kg({layout:a,className:l=""}){return o.jsx("div",{className:`flex flex-col gap-0.5 ${l}`.trim(),children:o.jsx(DA,{layout:a})})}function Zg({layout:a,className:l=""}){return o.jsx("div",{className:`flex flex-col gap-0.5 ${l}`.trim(),children:o.jsx(_A,{layout:a==="landscape"?"landscape":"portrait"})})}function OA(){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(Kg,{layout:"portrait",className:a}),o.jsx(Zg,{layout:"portrait",className:a})]})})}function BA(a=[],l={}){const i=hn(),{enabled:r=!0,version:f=null}=l,[d,h]=m.useState({}),g=m.useRef(new Map),x=m.useMemo(()=>a.map(C=>typeof C=="string"?C:C.id),[a]),v=m.useMemo(()=>{const C=x.join("|");return f?`${C}|v:${f}`:C},[x,f]),y=m.useRef([]),[S,w]=m.useState(0),M=m.useRef(new Map);return m.useEffect(()=>{if(!i)return;const C=()=>w(N=>N+1);return i.on("connect",C),()=>i.off("connect",C)},[i]),m.useEffect(()=>{y.current=x},[v,x]),m.useEffect(()=>{g.current.forEach(C=>URL.revokeObjectURL(C)),g.current.clear(),h({})},[v]),m.useEffect(()=>{if(!r){g.current.forEach(A=>URL.revokeObjectURL(A)),g.current.clear(),h({});return}if(!y.current.length||!i)return;let C=!1;const N=y.current,j=(A={},k)=>{if(C||!A.id||!k)return;const B=k.byteLength??k.length??0,L=Date.now(),Z=M.current.get(A.id)||{count:0,totalBytes:0,lastLogAt:0},O={count:Z.count+1,totalBytes:Z.totalBytes+B,lastLogAt:Z.lastLogAt};if(!O.lastLogAt||L-O.lastLogAt>=1e4){const z=O.count?O.totalBytes/O.count:0;console.log("[roomCamera]",A.id,`frame=${B}B`,`avg=${Math.round(z)}B`,`count=${O.count}`),O.lastLogAt=L}M.current.set(A.id,O);const X=new Blob([k],{type:"image/jpeg"}),$=URL.createObjectURL(X),Q=g.current.get(A.id);Q&&URL.revokeObjectURL(Q),g.current.set(A.id,$),h(z=>({...z,[A.id]:{status:"playing",ts:A.ts||Date.now(),error:null,objectUrl:$}}))},q=(A={})=>{C||!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",q),i.emit("roomCamera:subscribe",{ids:N},(A={})=>{A.error}),()=>{C=!0,i.emit("roomCamera:unsubscribe",{ids:N}),i.off("roomCamera:frame",j),i.off("roomCamera:status",q),g.current.forEach(A=>URL.revokeObjectURL(A)),g.current.clear()}},[i,v,r,S]),d}function zA({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 LA(){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 Fg=["horizontal","vertical"];function Hu(a,l){return Fg.includes(a)?a:l}function Mf({defaultOrientation:a="horizontal",orientation:l,hideLayoutToggle:i=!1,hideHeader:r=!1,panelId:f=null}){const{session:d}=ze(),h=d?.roomCameras||[],g=BA(h.map(j=>({id:j.id}))),{value:x,save:v}=xt("roomCameraPanels",{}),[y,S]=m.useState(()=>Hu(f?x?.[f]:a,"horizontal"));m.useEffect(()=>{if(!f)return;const j=x?.[f];j&&S(Hu(j,"horizontal"))},[f,x?.[f]]);const w=l?Hu(l,"horizontal"):y,M=w==="vertical"?"flex flex-col gap-0.5":"grid gap-0.5 md:grid-cols-2",C=!i&&!l&&h.length>0,N=j=>{S(j),f&&v(q=>({...q||{},[f]:j}))};return h.length===0?o.jsx(LA,{}):o.jsxs("section",{className:"panel-section space-y-0.5 text-base",children:[!r&&o.jsxs("header",{className:"flex flex-wrap items-center justify-between gap-0.5 text-sm text-slate-400",children:[o.jsxs("div",{className:"flex items-center gap-0.5",children:[o.jsx("p",{children:"Room cameras"}),o.jsx("span",{className:"text-xs text-slate-500",children:h.length})]}),o.jsx("div",{className:"flex flex-wrap items-center gap-0.5 text-xs",children:C&&o.jsxs("div",{className:"flex items-center gap-0.5",children:[o.jsx("span",{className:"text-slate-500",children:"Layout:"}),o.jsx("div",{className:"inline-flex overflow-hidden rounded border border-slate-700",children:Fg.map(j=>o.jsx("button",{type:"button",className:`px-1 py-0.5 ${w===j?"bg-slate-600 text-white":"bg-transparent text-slate-400 hover:text-white"}`,onClick:()=>N(j),children:j==="vertical"?"Vertical":"Grid"},j))})]})})]}),o.jsx("div",{className:M,children:h.map(j=>{const q=g[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(zA,{feed:q,label:j.name||j.id})},j.id)})})]})}function Tf(){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 UA(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 HA(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 Js(a=[],l={}){const i=hn(),{enabled:r=!0,version:f=null}=l,[d,h]=m.useState({}),g=m.useMemo(()=>Array.isArray(a)?HA(a.map(UA).filter(Boolean)):[],[a]),x=m.useMemo(()=>{const M=g.map(C=>`${C.type}:${C.id}:${C.key}`).join("|");return f?`${M}|v:${f}`:M},[g,f]),v=m.useRef([]),[y,S]=m.useState(0);return m.useEffect(()=>{if(!i)return;const M=()=>S(C=>C+1);return i.on("connect",M),()=>{i.off("connect",M)}},[i]),m.useEffect(()=>{v.current=g},[g]),m.useEffect(()=>{if(!x||!r){h({});return}const M=v.current;let C=!1;function N(j){const q=j.type==="room"?{roomCameraId:j.id}:{roverId:j.id};i.emit("video:request",q,(A={})=>{C||h(k=>({...k,[j.key]:A}))})}return M.forEach(j=>{N(j)}),()=>{C=!0}},[i,x,r,y]),m.useMemo(()=>{if(!x||!r)return{};const M={};return g.forEach(C=>{d[C.key]&&(M[C.key]=d[C.key])}),M},[x,d,g])}function Rf(a=[],l={}){const i=hn(),{enabled:r=!0,version:f=null}=l,[d,h]=m.useState({}),g=m.useRef(new Map),x=m.useMemo(()=>a.map(C=>typeof C=="string"?C:C.id).filter(Boolean),[a]),v=m.useMemo(()=>{const C=x.join("|");return f?`${C}|v:${f}`:C},[x,f]),y=m.useRef([]),[S,w]=m.useState(0),M=m.useRef(new Map);return m.useEffect(()=>{if(!i)return;const C=()=>w(N=>N+1);return i.on("connect",C),()=>i.off("connect",C)},[i]),m.useEffect(()=>{y.current=x},[v,x]),m.useEffect(()=>{g.current.forEach(C=>URL.revokeObjectURL(C)),g.current.clear(),h({})},[v]),m.useEffect(()=>{if(!r){g.current.forEach(A=>URL.revokeObjectURL(A)),g.current.clear(),h({});return}if(!y.current.length||!i)return;let C=!1;const N=y.current,j=(A={},k)=>{if(C||!A.id||!k)return;const B=k.byteLength??k.length??0,L=Date.now(),Z=M.current.get(A.id)||{count:0,totalBytes:0,lastLogAt:0},O={count:Z.count+1,totalBytes:Z.totalBytes+B,lastLogAt:Z.lastLogAt};if(!O.lastLogAt||L-O.lastLogAt>=1e4){const z=O.count?O.totalBytes/O.count:0;console.log("[roverSnapshot]",A.id,`frame=${B}B`,`avg=${Math.round(z)}B`,`count=${O.count}`),O.lastLogAt=L}M.current.set(A.id,O);const X=new Blob([k],{type:"image/jpeg"}),$=URL.createObjectURL(X),Q=g.current.get(A.id);Q&&URL.revokeObjectURL(Q),g.current.set(A.id,$),h(z=>({...z,[A.id]:{status:"playing",ts:A.ts||Date.now(),error:null,objectUrl:$}}))},q=(A={})=>{C||!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",q),i.emit("roverSnapshot:subscribe",{ids:N},(A={})=>{A.error}),()=>{C=!0,i.emit("roverSnapshot:unsubscribe",{ids:N}),i.off("roverSnapshot:frame",j),i.off("roverSnapshot:status",q),g.current.forEach(A=>URL.revokeObjectURL(A)),g.current.clear()}},[i,v,r,S]),d}const VA={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"turn:your.turn.server:3478",username:"user",credential:"pass"}],bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"};function YA(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 $A(a){if(!a)return{};const l=`${a}:${a}`;return{Authorization:`Basic ${YA(l)}`}}class j0{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(VA);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",...$A(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 rf({sensors:a={},variant:l="full",size:i,overlay:r=!1}){const f=i||(l==="mini"?190:260),d=f/2,h=f*.07,g=d,x=d+h,v=d*.8,y=v-4,S=v+4,w=v-14,M=v-6,C=v*.65,N=a?.bumpsAndWheelDrops||{},j=a?.wheelOvercurrents||{},q=a?.wheelLeftCurrentMa??0,A=a?.wheelRightCurrentMa??0,k=a?.sideBrushCurrentMa??0,B=a?.mainBrushCurrentMa??0,L=6,Z=N.bumpLeft?L:0,O=N.bumpRight?L:0,X=JA({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],z=X.map((W,R)=>({label:$[R],start:W.start,end:W.end,value:Q[R]})),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}],ee=Q.filter(W=>W!=null),oe=ee.length?Math.max(...ee,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–",oe]})]}),o.jsxs("svg",{width:"100%",height:"100%",viewBox:`0 0 ${f} ${f}`,preserveAspectRatio:"xMidYMid meet",className:"mx-auto block",children:[o.jsx("circle",{cx:g,cy:x,r:v,fill:"#0f172a",stroke:"#334155",strokeWidth:"2"}),o.jsx(N0,{cx:g-C,cy:x,current:q,drop:N.wheelDropLeft,overcurrent:j.leftWheel,label:"L"}),o.jsx(N0,{cx:g+C,cy:x,current:A,drop:N.wheelDropRight,overcurrent:j.rightWheel,label:"R"}),o.jsx(QA,{cx:g+v*.65,cy:x-v*.55,current:k,overcurrent:j.sideBrush}),o.jsx(KA,{cx:g,cy:x,current:B,overcurrent:j.mainBrush,variant:l,dirtLeft:a?.dirtDetectLeft,dirtRight:a?.dirtDetect}),z.map(W=>{const R=ZA(W.value,oe),F=S+4,ne=F+28;return o.jsx(GA,{cx:g,cy:x,rBase:ne,rTip:F,startDeg:W.start,endDeg:W.end,color:R,value:W.value,max:oe},W.label)}),K.map(W=>{const R=FA(W.value,W.active);return o.jsx(Vu,{cx:g,cy:x,rInner:w,rOuter:M,startDeg:W.start,endDeg:W.end,color:R,opacity:1,pulse:!!W.active},W.label)}),o.jsx(Vu,{cx:g,cy:x,rInner:y-Z,rOuter:S-Z,startDeg:-70,endDeg:-6,color:N.bumpLeft?"#ef4444":"#475569",opacity:1,pulse:!!N.bumpLeft}),o.jsx(Vu,{cx:g,cy:x,rInner:y-O,rOuter:S-O,startDeg:6,endDeg:70,color:N.bumpRight?"#ef4444":"#475569",opacity:1,pulse:!!N.bumpRight})]})]})}function Vu({cx:a,cy:l,rInner:i,rOuter:r,startDeg:f,endDeg:d,color:h,pulse:g=!1,opacity:x=1}){const v=(i+r)/2,y=r-i,S=XA(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}),g?o.jsx("path",{d:S,stroke:"#ef4444",strokeWidth:y,strokeLinecap:"round",fill:"none",className:"animate-pulse",opacity:1}):null]})}function GA({cx:a,cy:l,rBase:i,rTip:r,startDeg:f,endDeg:d,color:h,value:g,max:x}){const v=(f+d)/2,y=Qs(a,l,r,v),S=Zr(g!=null?g/(x||1):0),w=Math.pow(S,.35),M=i-(i-r)*w,C=Qs(a,l,M,f),N=Qs(a,l,M,d),j=`M ${y.x} ${y.y} L ${C.x} ${C.y} L ${N.x} ${N.y} Z`;return o.jsx("path",{d:j,fill:h,opacity:1,stroke:"none"})}function XA(a,l,i,r,f){let d=r,h=f;h<=d&&(h+=360);const g=Qs(a,l,i,d),x=Qs(a,l,i,h);return["M",g.x,g.y,"A",i,i,0,0,1,x.x,x.y].join(" ")}function Qs(a,l,i,r){const f=Jg(r);return{x:a+i*Math.cos(f),y:l+i*Math.sin(f)}}function Jg(a){return(a-90)*Math.PI/180}function kf(a,l){if(l)return"#ef4444";const i=Math.abs(a);return i>900?"#f59e0b":i>300?"#22c55e":"#64748b"}function Zr(a){return Math.max(0,Math.min(1,a))}function N0({cx:a,cy:l,current:i,drop:r,overcurrent:f,label:d}){const h=Math.abs(i),g=Zr(h/1200),x=kf(i,f),v=56,y=14,S=9,w=3,M=v*g,C=d==="L"?-1:1,N=C*(-S/2-w/2),j=C*(y/2+w/2),q=y+S+w+2,A=v+4;return o.jsxs("g",{transform:`translate(${a},${l})`,children:[o.jsx("rect",{x:-q/2,y:-A/2,width:q,height:A,rx:"4",fill:"none",stroke:"#64748b",strokeWidth:"1"}),o.jsx("rect",{x:N-y/2,y:-v/2,width:y,height:v,fill:"#0f172a",stroke:"#0f172a",strokeWidth:"1",rx:"2"}),o.jsx("rect",{x:N-y/2,y:v/2-M,width:y,height:M,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 QA({cx:a,cy:l,current:i,overcurrent:r}){var f=Math.abs(i);f<10&&(f=0);const d=kf(i*3,r),h=43,g=f>0?.65:null;return o.jsxs("g",{style:{transformOrigin:`${a}px ${l}px`,animation:g?`spin ${g}s linear infinite`:"none",animationDirection:g?"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=Jg(v),S=a+h*Math.cos(y),w=l+h*Math.sin(y);return o.jsx("line",{x1:a,y1:l,x2:S,y2:w,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 KA({cx:a,cy:l,current:i,overcurrent:r,variant:f,dirtLeft:d,dirtRight:h}){const g=Math.abs(i),x=kf(i,r),v=1,y=96,S=12,w=`main-brush-pattern-a-${f}`,M=`main-brush-pattern-b-${f}`,C=g>0?.6:null,N=i>=0?1:-1;return o.jsxs("g",{children:[o.jsx("defs",{children:[w,M].map((j,q)=>o.jsxs("pattern",{id:j,patternUnits:"userSpaceOnUse",width:"6",height:"6",children:[o.jsx("rect",{width:"6",height:"6",fill:x,opacity:v}),o.jsx("path",{d:"M0 6 L6 0",stroke:"#0f172a",strokeWidth:"1"}),C?o.jsx("animateTransform",{attributeName:"patternTransform",type:"translate",from:"0 0",to:`0 ${N*(q===0?6:-6)}`,dur:`${C}s`,repeatCount:"indefinite"}):null]},j))}),o.jsx("rect",{x:a-y/2,y:l-14,width:y,height:S,rx:"3",fill:`url(#${w})`,stroke:"#64748b",strokeWidth:"1"}),o.jsx("rect",{x:a-y/2,y:l+4,width:y,height:S,rx:"3",fill:`url(#${M})`,stroke:"#64748b",strokeWidth:"1"}),o.jsx("circle",{cx:a-y/4,cy:l-8,r:3.5,fill:"#fbbf24"}),o.jsx("circle",{cx:a+y/4,cy:l+8,r:3.5,fill:"#fbbf24"}),r?o.jsx("rect",{x:a-y/2-4,y:l-16,width:y+8,height:S*2+16,rx:"6",stroke:"#ef4444",strokeWidth:"3",fill:"none",className:"animate-pulse"}):null]})}function ZA(a,l){if(a==null||a<=0)return"hsl(200 60% 18%)";const r=Zr(a/(l||1));return`hsl(${(200+Math.pow(r,.45)*360)%360} 100% 60%)`}function FA(a,l){if(l)return"#ef4444";const i=Zr(a==null?0:a/4095),r=[47,55,69],f=[245,158,11],[d,h,g]=r.map((x,v)=>Math.round(x+(f[v]-x)*i));return`rgb(${d}, ${h}, ${g})`}function JA({count:a,totalSpan:l,gap:i,startAngle:r}){const d=(l-i*(a-1))/a,h=[];let g=r;for(let x=0;x<a;x+=1){const v=g+d;h.push({start:g,end:v}),g=v+i}return h}function Ig(){const{value:a,save:l}=xt("page",{hudMapDesktop:!1});return[!!a?.hudMapDesktop,f=>{l({hudMapDesktop:!!f})}]}function Fr({text:a="Join our Discord!",className:l=""}){const{session:i}=ze(),r=i?.discord?.invite||null;return r?o.jsxs("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:`inline-flex items-center w-full px-0.5 py-0.5 text-sm font-medium text-white rainbow-animate-bg transition justify-center gap-1 rounded-md ${l}`,children:[o.jsx(wg,{className:"mr-0"}),a]}):null}const w0=2e3,IA=3e3,WA=3e3;function PA(a,l){const i=l?.Full,r=l?.Warn,f=l?.Urgent??null;if(a==null||i==null||r==null)return{available:!1};const d=i-r;if(d<=0)return{available:!1};const h=(a-r)/d,g=Math.min(1,Math.max(0,h)),x=Math.round(g*100),v=h<=0,y=f!=null&&a<=f;return{available:!0,percentDisplay:x,depleted:v,warnTriggered:y,barClass:v?"bg-red-500 animate-pulse":y?"bg-amber-400":"bg-emerald-500"}}function Is({sessionInfo:a,audioSessionInfo:l,videoMode:i="whep",snapshotFeed:r=null,qualityNotice:f=null,label:d,forceMute:h=!1,telemetryFrame:g,batteryConfig:x,layoutFormat:v="desktop",hudVariant:y="default",driverLabel:S=null,hudForceMap:w=!1,hudMapPosition:M="top-center",hudLabelScale:C=1,fitParent:N=!1,overcurrentLimiter:j=null,showTurnCue:q=!1,turnTimerText:A=null,turnSeconds:k=null,isActiveDriver:B=!1,idleSkipSeconds:L=null}){const Z=m.useRef(null),O=m.useRef(null),X=m.useRef(null),$=m.useRef(null),Q=m.useRef(null),z=m.useRef(null),[K,ee]=m.useState("idle"),[oe,W]=m.useState(null),[R,F]=m.useState("idle"),[ne,ue]=m.useState(null),[he,E]=m.useState(0),[Y,te]=m.useState(0),[le,se]=m.useState(!0),ie=i==="snapshot",ce=g?.sensors,xe=ce?.batteryChargeMah??null,pe=v==="desktop",je=!pe,ae=je?"top-right":M,[re]=Ig(),Se=w||je?!0:re,Re=PA(xe,x),qe=ce?.wheelOvercurrents||null,Ye=qe==null?[]:Object.entries(qe).filter(([,ve])=>!!ve).map(([ve])=>ve),vt=j?.caps||null,Vn=j?.overcurrent?.groups||null,pn=typeof window<"u"&&new URLSearchParams(window.location.search).has("debugHud"),Jt=m.useMemo(()=>{if(!vt)return null;const ve=Number.isFinite(vt?.drive?.cap)?vt.drive.cap:1,Ze=Number.isFinite(vt?.aux?.cap)?vt.aux.cap:1;return Math.max(0,Math.min(1,1-Math.min(ve,Ze)))},[vt]),Tt=!!j?.isActive,ha=Ye.length?Ye:Tt?["limiter"]:[],$a=Jt??(Ye.length?1:0),ft=!!ha.length;m.useEffect(()=>{pn&&console.log("[OvercurrentHUD]",{overlayVisible:ft,overlayMotors:ha,overlayFill:$a,limiterActive:Tt,limiterCaps:vt,limiterGroups:Vn,wheelOvercurrents:qe})},[pn,$a,ha,ft,Tt,vt,Vn,qe]);const pa=m.useCallback(()=>{clearTimeout(X.current),X.current=setTimeout(()=>E(Date.now()),w0)},[]),Ga=m.useCallback(()=>{clearTimeout($.current),$.current=setTimeout(()=>te(Date.now()),w0)},[]),ga=m.useCallback(async()=>{const ve=Z.current;if(ve)try{ve.muted=!0,await ve.play()}catch{}},[]),xa=m.useCallback((ve=0)=>{if(h)return;clearTimeout(z.current);const Ze=()=>{clearTimeout(z.current),z.current=setTimeout(()=>{h||$e()},IA)},$e=async()=>{const Ge=Z.current;if(Ge)try{await ga(),Ge.muted=!1,await Ge.play(),se(!1)}catch{Ge.muted=!0,se(!0),Ze()}};z.current=setTimeout($e,ve)},[ga,h]);m.useEffect(()=>()=>{clearTimeout(X.current),clearTimeout($.current),clearTimeout(z.current),clearInterval(Q.current)},[]),m.useEffect(()=>{K==="playing"&&xa(0)},[K,xa]),m.useEffect(()=>{ie&&(ee("snapshot"),W(null))},[ie]),m.useEffect(()=>{if(ie||!a?.url||!Z.current)return;let ve=!0,Ze;const $e=setTimeout(()=>se(!0),0),Ge=(nt,Xe)=>{ve&&(ee(nt),W(Xe||null),nt==="playing"&&ga(),["error","failed","disconnected","closed"].includes(nt)&&pa())};return Ze=new j0({url:a.url,token:a.token,video:Z.current,onStatus:Ge}),Ze.start().catch(nt=>{ve&&(ee("error"),W(nt.message),pa())}),()=>{ve=!1,clearTimeout($e),Ze?.stop()}},[ie,a?.url,a?.token,he,pa,ga]),m.useEffect(()=>{K==="stopped"&&a?.url&&pa()},[K,a?.url,pa]),m.useEffect(()=>{if(!l?.url||!O.current)return;let ve=!0,Ze;const $e=(Ge,nt)=>{ve&&(ue(nt||(Ge==="connected"?"connected":null)),F(Xe=>Ge==="connected"&&(Xe==="playing"||Xe==="connecting")||Ge==="new"?Xe:Ge),Ge==="playing"&&O.current?.play().catch(()=>{}),["error","failed","disconnected","closed"].includes(Ge)&&Ga())};return Ze=new j0({url:l.url,token:l.token,video:O.current,audioOnly:!0,onStatus:$e}),Ze.start().catch(Ge=>{ve&&(F("error"),ue(Ge.message),Ga())}),()=>{ve=!1,Ze?.stop()}},[l?.url,l?.token,Y,Ga]),m.useEffect(()=>{const ve=O.current;if(!l?.url||!ve){clearInterval(Q.current);return}if(!["connecting","connected","playing","paused"].includes(R)){clearInterval(Q.current);return}const $e=()=>{const Ge=O.current;Ge&&(!Ge.paused&&!Ge.ended||Ge.play().then(()=>{F(nt=>nt==="connected"?"playing":nt),ue(nt=>nt==="paused"?null:nt)}).catch(nt=>{ue(Xe=>Xe||nt?.message||"autoplay blocked")}))};return $e(),Q.current=setInterval($e,WA),()=>clearInterval(Q.current)},[l?.url,R]),m.useEffect(()=>{const ve=O.current;if(!ve)return;const Ze=()=>{F(Xe=>Xe==="error"?Xe:"playing"),ue(null)},$e=()=>{F(Xe=>["error","failed","disconnected","closed","stopped"].includes(Xe)?Xe:"paused"),ue(Xe=>Xe||"paused")},Ge=()=>{F(Xe=>Xe==="error"?Xe:"stopped"),ue(Xe=>Xe||"ended")},nt=()=>{const{error:Xe}=ve,Xa=Xe?.message||"audio error";F("error"),ue(Xa)};return ve.addEventListener("play",Ze),ve.addEventListener("pause",$e),ve.addEventListener("ended",Ge),ve.addEventListener("error",nt),()=>{ve.removeEventListener("play",Ze),ve.removeEventListener("pause",$e),ve.removeEventListener("ended",Ge),ve.removeEventListener("error",nt)}},[l?.url]);const eo=r?.error?`Error: ${r.error}`:r?.objectUrl?"snapshot":r?.status||"waiting",li=ie?eo:a?.url?K==="error"?`Error: ${oe||"unknown"}`:oe?`${K} (${oe})`:K:"waiting",to=l?.error?`Error: ${l.error}`:l?.url?R==="error"?`Error: ${ne||"unknown"}`:ne?`${R} (${ne})`:R:null,si=y==="spectator",bt=y==="none";return o.jsxs("div",{className:`flex flex-col gap-0.5 ${N?"h-full":""}`,children:[o.jsxs("div",{className:`relative w-full overflow-hidden bg-black ${N?"h-full flex-1":"aspect-[4/3]"}`,children:[ie?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:O,autoPlay:!0,hidden:!0}),!bt&&q?o.jsx(lj,{mobileHud:je,turnSeconds:k,isActiveDriver:B,idleSkipSeconds:L}):null,bt?null:o.jsx(aj,{frame:g,sensors:ce,label:d,status:li,audioStatus:to,desktopLayout:pe,layoutFormat:v,variant:y,driverLabel:S,battery:Re,showTopDown:Se,mobileHud:je,mapPosition:ae,turnTimerText:A,labelScale:C}),bt?null:o.jsx(oj,{compact:je}),!bt&&pn?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:${ft?1:0} motors:${ha.length} fill:${Math.round($a*100)}%`}):null,bt?null:o.jsx(ij,{motors:ha,fill:$a,compact:je}),bt?null:o.jsx(rj,{charge:xe,config:x,compact:je}),!bt&&si&&Re.available?o.jsx(tj,{visual:Re}):null,!bt&&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 ${je?"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(Fr,{text:"Join our Discord server while you wait!"})})]})}):null]}),!bt&&!si&&o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(nj,{sensors:ce}),o.jsx(ej,{visual:Re})]})]})}function ej({visual:a}){if(!a?.available)return o.jsx("div",{className:"panel-section space-y-0.5 text-sm",children:o.jsx("p",{className:"text-xs text-slate-500",children:"Battery telemetry unavailable"})});const l=`${a.percentDisplay}%`,i=a.barClass;return o.jsx("div",{className:"panel-section space-y-0.5 text-sm",children:o.jsx("div",{className:"relative h-4 w-full bg-zinc-900 flex",children:o.jsx("div",{className:`h-full transition-[width] ${i}`,style:{width:`${a.percentDisplay}%`},children:o.jsxs("span",{className:"inset-0 flex items-center justify-center text-xs font-semibold text-black/80",children:["Battery ",l]})})})})}function tj({visual:a}){if(!a?.available)return null;const l=`${a.percentDisplay}%`;return o.jsxs("div",{className:"pointer-events-none absolute right-1 top-1/2 flex h-[70%] -translate-y-1/2 flex-col items-center justify-end rounded bg-black/60 px-0.5 pb-1 pt-1",children:[o.jsx("div",{className:"flex h-full w-4 items-end overflow-hidden rounded bg-zinc-900",children:o.jsx("div",{className:`${a.barClass} w-full transition-[height]`,style:{height:`${a.percentDisplay}%`}})}),o.jsx("span",{className:"mt-0 text-[0.65rem] font-semibold text-slate-100",children:l})]})}function nj({sensors:a}){const l=[a?.lightBumpLeftSignal,a?.lightBumpFrontLeftSignal,a?.lightBumpCenterLeftSignal,a?.lightBumpCenterRightSignal,a?.lightBumpFrontRightSignal,a?.lightBumpRightSignal],i=l.filter(g=>g!=null).reduce((g,x)=>Math.max(g,x),1200),r=g=>Math.pow(Math.max(0,Math.min(1,(g??0)/i)),.35),f=g=>g==null||g<=0?"hsl(200 60% 18%)":`hsl(${(200+r(g)*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((g,x)=>{const v=r(g),y=x<d/2?-1:1,S=`${v*100}%`,w=f(g);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:w,float:y===-1?"right":"left"}})})},x)})})}function aj({frame:a,sensors:l,label:i,status:r,audioStatus:f,desktopLayout:d=!0,layoutFormat:h="desktop",variant:g="default",driverLabel:x=null,battery:v,showTopDown:y=!1,mobileHud:S=!1,mapPosition:w="top-center",turnTimerText:M=null,labelScale:C=1}){l?.bumpsAndWheelDrops;const[N,j]=m.useState(()=>Date.now());m.useEffect(()=>{const F=setInterval(()=>j(Date.now()),150);return()=>clearInterval(F)},[]),a?.receivedAt&&N-a.receivedAt<200;const q=S,A=h==="mobile-portrait",k=q?"text-[0.45rem]":"text-[0.65rem]",B=q?"px-0.25 py-0.25":"px-1 py-0.5",L=q?"px-0.25 py-0.25":"px-0.5 py-0.5",Z=q?"text-[0.55rem]":"text-[0.8rem]",O=q?"left-0.5 top-0.5":"left-1 top-1",X=q?"text-[0.5rem]":"text-[0.7rem]",$=q?"px-0.5 py-0.25":"px-1 py-0.5",Q=q?"left-0.5 top-1/2":"left-1 top-1/2",z="bottom-0.5",K={transform:`translateX(-50%) scale(${C})`,transformOrigin:"center bottom"},ee="240px",oe=A?.3:q?.33:.7,R={width:ee,height:ee,opacity:q?.6:.7,transform:w==="top-center"?`translateX(-50%) scale(${oe})`:`scale(${oe})`,transformOrigin:w==="bottom-left"?"bottom left":w==="top-center"?"top center":"top right",...w==="bottom-left"?{left:"0.25rem",bottom:"0.25rem"}:w==="top-center"?{left:"50%",top:"0.25rem"}:{right:"0.25rem",top:"0.25rem"}};if(g==="none")return null;if(g==="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,ue=l?.chargingState?.label||"",he=!!(ue&&ue.toLowerCase()!=="not charging"),E=l?.oiMode?.label||"Unknown",Y=E.toLowerCase(),te=Y==="full"?"bg-emerald-500/80 text-emerald-50":Y==="safe"?"bg-amber-400/80 text-amber-950":Y==="passive"?"bg-slate-700/80 text-slate-100":"bg-slate-700/60 text-slate-200",le=ne?"bg-emerald-500/80 text-emerald-50":"bg-slate-700/70 text-slate-200",se=he?"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 ${O} 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} ${B}`,children:o.jsxs("div",{className:"space-y-0.5 leading-tight",children:[o.jsxs("div",{className:"flex flex-col gap-0.5 text-[0.75rem] font-semibold uppercase tracking-wide",children:[o.jsx("span",{className:`rounded px-1.5 py-0.5 ${le}`,children:ne?"Docked":"Undocked"}),o.jsx("span",{className:`rounded px-1.5 py-0.5 ${se}`,children:he?"Charging":"Not charging"}),o.jsxs("span",{className:`rounded px-1.5 py-0.5 ${te}`,children:["OI: ",E]})]}),F.map(([ie,ce])=>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:ce})]},ie))]})}),o.jsx("div",{className:`absolute ${z} left-1/2`,style:K,children:o.jsxs("div",{className:`flex items-center gap-0.5 bg-black/80 text-slate-100 ${L} ${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:{...R},children:o.jsx(rf,{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 ${O} 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]})}),M?o.jsx("div",{className:`absolute left-1/2 top-0.5 -translate-x-1/2 rounded bg-black/70 text-slate-100 ${$} ${X}`,children:M}):null,o.jsx("div",{className:`absolute ${z} left-1/2`,style:K,children:o.jsx("div",{className:`flex gap-0.5 bg-black/80 text-slate-100 ${L} ${Z}`,children:o.jsxs("span",{children:['Rover: "',i||"Unnamed Rover",'"']})})}),y&&g!=="spectator"?o.jsx("div",{className:"pointer-events-none absolute rounded",style:{...R},children:o.jsx(rf,{sensors:l,size:240,overlay:!0})}):null]})}function lj({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]",g=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 ${g}`,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 sj={leftWheel:"Left wheel",rightWheel:"Right wheel",mainBrush:"Main brush",sideBrush:"Side brush",limiter:"Overcurrent limit"};function ij({motors:a,fill:l=0,compact:i=!1}){if(!a?.length)return null;const r=a.map(y=>sj[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",g=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 ${g}`,children:r.join(", ")})]})]})})}function rj({charge:a,config:l,compact:i=!1}){if(a==null||l==null)return null;const r=l.Full,f=l.Warn,d=l.Urgent??null,h=r-f;if(h<=0)return null;const x=(a-f)/h<=0;if(!(d!=null&&a<=d)&&!x)return null;const y=x?"Battery low! please dock and charge the rover soon.":"BATTERY VERY LOW, PLEASE DOCK THE ROVER AND CHARGE IMMEDIATELY!!",S=i?"p-2 top-6":"p-4 top-10",w=i?"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 ${S}`,children:o.jsx("div",{className:`text-center font-semibold text-white animate-pulse ${w}`,children:o.jsx("div",{children:y})})})}function oj({compact:a=!1}){const{session:l}=ze(),{sendMessage:i,onInputFocus:r,onInputBlur:f,blurChat:d,registerInputRef:h,setTypingActive:g}=Cf(),{value:x}=xt("tts",{engine:"flite",voice:"rms",pitch:50}),[v,y]=m.useState(""),[S,w]=m.useState(!1),M=l?.role!=="spectator",C=l?.role==="spectator",N=l?.assignment?.roverId||null,q=!!m.useMemo(()=>l?.roster?.find(O=>String(O.id)===String(N))||null,[N,l?.roster])?.audio?.ttsEnabled,A=m.useMemo(()=>{if(!q)return null;const O=x?.engine==="espeak"?"espeak":"flite";if(O==="espeak"){let $=Number.isFinite(x?.pitch)?Math.round(x.pitch):void 0;return typeof $=="number"&&($=Math.max(0,Math.min(99,$))),{speak:!0,engine:O,pitch:$}}const X=typeof x?.voice=="string"?x.voice:void 0;return{speak:!0,engine:O,voice:X}},[x?.engine,x?.pitch,x?.voice,q]),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",B=a?"min-w-0 flex-1 bg-transparent text-[0.55rem] text-slate-100 placeholder:text-slate-400 focus:outline-none":"min-w-0 flex-1 bg-transparent text-[0.7rem] text-slate-100 placeholder:text-slate-400 focus:outline-none",L=a?"rounded bg-cyan-500/80 px-0.35 py-0.2 text-[0.55rem] font-semibold text-black disabled:opacity-50":"rounded bg-cyan-500/80 px-0.5 py-0.25 text-[0.7rem] font-semibold text-black disabled:opacity-50";async function Z(O){if(O.preventDefault(),!M)return;const X=v.trim();if(X){w(!0);try{await i(X,A),y(""),d(),g(!1)}catch($){alert($.message)}finally{w(!1)}}}return C?null:o.jsxs("form",{onSubmit:Z,className:k,children:[o.jsx("input",{className:B,value:v,onChange:O=>{const X=O.target.value;y(X),g(!!X.trim())},onFocus:O=>{r(O),g(!!v.trim())},onBlur:O=>{f(O),g(!1)},onKeyDown:O=>{O.key==="Enter"&&!v.trim()&&(O.preventDefault(),d(),g(!1))},ref:O=>h(O,{target:"hud"}),placeholder:M?"Chat (TTS)":"Spectator",disabled:!M}),o.jsx("button",{type:"submit",disabled:!M||S,className:L,children:"Speak"})]})}function _f({layoutFormat:a="desktop"}){const{session:l}=ze(),{state:{song:i,lastControlIntentAt:r},overcurrentLimiter:f}=Mt(),[d,h]=m.useState(()=>Date.now()),[g,x]=m.useState(!1),[v,y]=m.useState(null),S=m.useRef({active:!1,roverId:null});m.useEffect(()=>{if(l?.mode!=="turns")return;const le=setInterval(()=>h(Date.now()),250);return()=>clearInterval(le)},[l?.mode]);const w=l?.assignment?.roverId,C=!!(w&&l?.roster?l.roster.find(le=>String(le.id)===String(w)):null)?.media?.audioPublishUrl,N=w?l?.turnQueues?.[w]:null,j=l?.socketId||null,q=w?l?.activeDrivers?.[w]:null,A=!!(j&&q===j),k=m.useMemo(()=>{const le=N?.queue||[];if(!le.length||!N?.current||le.length<=1)return null;const se=le.findIndex(ie=>ie===N.current);return se===-1?le[0]||null:le[(se+1)%le.length]||null},[N?.queue,N?.current]),B=!!(j&&k===j),L=N?.deadline||null,Z=N?.idleDeadline||null,O=L?L-d:null,X=Z?Z-d:null,$=l?.mode==="turns"&&B&&O!=null&&O<=5e3&&O>0,Q=l?.mode!=="turns"||A||$,z=O!=null&&Number.isFinite(O)?Math.max(0,Math.ceil(O/1e3)):null,K=X!=null&&Number.isFinite(X)?Math.max(0,Math.ceil(X/1e3)):null,ee=A?z!=null?`${z}s left`:null:B&&z!=null?`Your turn in ${z}s`:null,oe=w?[...Q?[{type:"rover",id:w,key:w}]:[],...C?[{type:"rover",id:`${w}-audio`,key:`${w}-audio`}]:[]]:[],W=Js(oe),R=w&&Q?W[w]:null,F=w&&C?W[`${w}-audio`]:null,ne=Rf(w?[w]:[],{enabled:!!w,version:l?.mode}),ue=w&&ne[w]||null,he=$l(w),E=w&&l?.roster?l.roster.find(le=>String(le.id)===String(w)):null,Y=E?.battery??null,te=E?.name||(w?`Rover ${w}`:"");return m.useEffect(()=>{if(l?.mode!=="turns"){x(!1),y(null),S.current={active:!1,roverId:null};return}const le=S.current,se=A&&!le.active,ie=A&&w&&w!==le.roverId;se||ie?(x(!0),y(Date.now())):!A&&le.active&&(x(!1),y(null)),S.current={active:A,roverId:w}},[A,w,l?.mode]),m.useEffect(()=>{!g||!v||r>v&&x(!1)},[r,v,g]),o.jsx("section",{className:"panel",children:w?o.jsx(Is,{sessionInfo:R,videoMode:Q?"whep":"snapshot",snapshotFeed:ue,audioSessionInfo:F,label:te,telemetryFrame:he,batteryConfig:Y,layoutFormat:a,overcurrentLimiter:f,songNote:i?.note,qualityNotice:Q?null:"Preview feed (low FPS) until your turn.",showTurnCue:g,turnTimerText:ee,turnSeconds:z,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 of({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 Jr(a){if(!Number.isFinite(a))return 0;const l=a%360;return l<0?l+360:l}function cj(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,g=Math.max(f,d,h),x=Math.min(f,d,h),v=g-x;if(v===0)return 0;let y=0;return g===f?y=(d-h)/v%6:g===d?y=(h-f)/v+2:y=(f-d)/v+4,Jr(Math.round(y*60))}function C0(a){const l=Jr(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 E0(a){return a?Array.isArray(a.hsColor)?Jr(Number(a.hsColor[0])):Array.isArray(a.rgbColor)?cj(a.rgbColor):0:0}function uj({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,g=f?"warn":d?"success":"muted",x=f?"Unavailable":d?"On":"Off",v=!l||f,y=v||!h,[S,w]=m.useState(()=>E0(a)),M=m.useRef(S),C=m.useRef(!1),N=f?"border-slate-800 bg-slate-900 text-slate-400 cursor-not-allowed":d?"border-emerald-700 bg-emerald-900/80 text-emerald-50 hover:bg-emerald-800":"border-rose-800 bg-rose-900/80 text-rose-50 hover:bg-rose-800";m.useEffect(()=>{if(!h||C.current)return;const L=E0(a);M.current=L,w(L)},[a.rgbColor,a.hsColor,h]);const j=L=>{const Z=Jr(Number(L.target.value));M.current=Z,w(Z)},q=()=>{y||!r||r(a.id,C0(M.current))},A=L=>{L.stopPropagation()},B=`rgb(${(h?C0(M.current):[255,255,255]).join(",")})`;return o.jsxs("button",{type:"button",onClick:()=>i(a.id),disabled:v,className:`relative flex min-w-[12rem] flex-[1_1_12rem] items-start justify-between gap-0.5 rounded px-1 py-0.5 text-left transition-colors ${N} 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(of,{label:x,tone:g}),!l&&o.jsx("span",{className:"text-xs text-amber-200",children:"Offline"})]})]}),h?o.jsx("div",{className:"-mt-0.5 w-full",onClick:A,onPointerDown:L=>{A(L),C.current=!0},onPointerUp:L=>{A(L),C.current=!1,q()},onPointerCancel:L=>{A(L),C.current=!1,q()},onKeyUp:L=>{A(L),q()},onBlur:q,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(of,{label:x,tone:g}),!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:B}}),!h&&o.jsx("div",{className:"self-center text-xs font-semibold text-white/90",children:d?"Turn off":"Turn on"})]})}function Wg(){const{state:{keymap:a}}=Mt(),{session:l,homeAssistantToggle:i,homeAssistantSetLightColor:r}=ze(),f=l?.homeAssistant,d=m.useMemo(()=>f?.entities||[],[f?.entities]),h=un(a?.homeAssistantOn?.[0]),g=un(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(q0,{label:h}):null]}),o.jsxs("span",{className:"flex items-center gap-0.5",children:[o.jsx("span",{children:"Off"}),g?o.jsx(q0,{label:g}):null]})]})]}),o.jsx(of,{label:x?"Connected":"Offline",tone:x?"success":"warn"})]}),o.jsx("div",{className:"flex flex-wrap gap-0.5",children:d.map(v=>o.jsx(uj,{entity:v,connected:x,onToggle:i,onSetColor:r},v.id))})]})}function q0({label:a}){return a?o.jsx("span",{className:"rounded border border-white/40 px-1 text-[0.7rem] text-white",children:a}):null}function Pg(){const{login:a,setRole:l}=ze(),[i,r]=m.useState(""),[f,d]=m.useState(""),[h,g]=m.useState(!1);async function x(v){v.preventDefault(),g(!0);try{await a(i,f),r(""),d("")}catch(y){alert(y.message)}finally{g(!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 M0(...a){return a.filter(Boolean).join(" ")}function fj(a){const l=a?.batteryState?.percentDisplay;return l==null?"--":`${l}%`}function dj(a){return a?.batteryState?a.batteryState.urgentActive?"text-red-400":a.batteryState.warnActive?"text-amber-300":"text-emerald-300":"text-slate-400"}function mj({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:M0("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:M0("font-semibold",dj(f)),children:["Battery ",fj(f)]})]})]}),r?r(f):null]},f.id))})]})}const hj=[{key:"open",label:"Open"},{key:"turns",label:"Turns"},{key:"admin",label:"Admin"},{key:"lockdown",label:"Lockdown"}];function pj(){const{session:a,lockRover:l,setMode:i,requestControl:r,setCommunityGoal:f,setAdminReason:d,adminLogs:h}=ze(),g=m.useMemo(()=>a?.roster??[],[a?.roster]),[x,v]=m.useState({}),y=a?.health||null,S=a?.communityGoal?.text||"",w=a?.communityGoal?.updatedAt||null,[M,C]=m.useState(S),N=a?.adminReason?.text||"",j=a?.adminReason?.updatedAt||null,[q,A]=m.useState(N),k=a?.role==="admin"||a?.role==="lockdown"||a?.role==="lockdown-admin",B=a?.mode??"open",L=async(ee,oe)=>{try{await l(ee,oe),v(W=>({...W,[ee]:oe}))}catch(W){alert(W.message)}},Z=async ee=>{const oe=ee.target.value;try{await i(oe)}catch(W){alert(W.message)}},O=async ee=>{try{await r(ee,{force:!0})}catch(oe){alert(oe.message)}},X=async()=>{try{await f(M)}catch(ee){alert(ee.message)}},$=async()=>{try{await f(null)}catch(ee){alert(ee.message)}},Q=async()=>{try{await d(q)}catch(ee){alert(ee.message)}},z=async()=>{try{await d(null)}catch(ee){alert(ee.message)}};m.useEffect(()=>{C(S)},[S]),m.useEffect(()=>{A(N)},[N]);const K=m.useMemo(()=>{const ee={};return g.forEach(oe=>{ee[oe.id]=x[oe.id]??oe.locked}),ee},[g,x]);return k?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:B,onChange:Z,className:"field-input text-sm",children:hj.map(ee=>o.jsx("option",{value:ee.key,children:ee.label},ee.key))})]}),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"}),w?o.jsxs("span",{children:["Updated ",new Date(w).toLocaleString()]}):null]}),o.jsx("input",{type:"text",value:M,onChange:ee=>C(ee.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:X,className:"button-dark",children:"Set goal"}),o.jsx("button",{type:"button",onClick:$,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"}),j?o.jsxs("span",{children:["Updated ",new Date(j).toLocaleString()]}):null]}),o.jsx("textarea",{value:q,onChange:ee=>A(ee.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:Q,className:"button-dark",children:"Set reason"}),o.jsx("button",{type:"button",onClick:z,className:"button-danger",children:"Clear"})]})]}),o.jsx(mj,{roster:g,renderActions:ee=>o.jsxs("div",{className:"flex flex-wrap gap-0.5 text-xs",children:[o.jsx("button",{type:"button",onClick:()=>L(ee.id,!K[ee.id]),className:"button-dark",children:K[ee.id]?"Unlock":"Lock"}),o.jsx("button",{type:"button",onClick:()=>O(ee.id),className:"button-dark",children:"Force"})]})}),o.jsx(gj,{health:y}),o.jsx(xj,{entries:h})]}):null}function gj({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 xj({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 vj=[{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 yj(a){return a.reduce((l,i)=>((l[i.group]||(l[i.group]=[])).push(i),l),{})}function bj(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(0,Math.min(500,i)):l}const Df=5,Ws=500,Ps=1,Of=100;function Sj(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(Df,Math.min(Ws,i)):l}function Br(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(Ps,Math.min(Of,i)):l}function Aj(a){const i=(Br(a,a)-Ps)/(Of-Ps),r=Ws-i*(Ws-Df);return Math.round(r)}function jj(a){const l=Sj(a,a),i=(Ws-l)/(Ws-Df),r=Ps+i*(Of-Ps);return Math.round(r)}function Nj(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=ai(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 Cr({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:g=>r(g.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:g=>r(g.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 wj(){const{state:{keymap:a},actions:{updateKeyBinding:l,resetKeyBindings:i}}=Mt(),{value:r,save:f}=xt("inputs",cn),d={...cn.keyboard,...r.keyboard??{}},h=m.useMemo(()=>typeof d.tiltSpeed=="number"?Br(d.tiltSpeed,cn.keyboard.tiltSpeed):typeof d.tiltIntervalMs=="number"?Br(jj(d.tiltIntervalMs),cn.keyboard.tiltSpeed):cn.keyboard.tiltSpeed,[d.tiltIntervalMs,d.tiltSpeed]),g=m.useMemo(()=>yj(vj),[]),{active:x,startCapture:v,cancel:y}=Nj((C,N)=>{l(C,N)}),S=m.useCallback(C=>a?.[C]?.[0]||Xs[C]?.[0]||"",[a]),w=m.useCallback((C,N)=>{const j=cn.keyboard,q=bj(N,j[C]);f(A=>({...A??{},keyboard:{...A?.keyboard??j,[C]:q}}))},[f]),M=m.useCallback(C=>{const N=cn.keyboard,j=Br(C,N.tiltSpeed),q=Aj(j);f(A=>({...A??{},keyboard:{...A?.keyboard??N,tiltSpeed:j,tiltIntervalMs:q}}))},[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(Cr,{label:"Base speed",description:"Normal driving speed",value:d.baseSpeed,onChange:C=>w("baseSpeed",C)}),o.jsx(Cr,{label:"Turbo speed",description:"Used when holding the boost modifier",value:d.turboSpeed,onChange:C=>w("turboSpeed",C)}),o.jsx(Cr,{label:"Precision speed",description:"Used when holding the precision modifier",value:d.precisionSpeed,onChange:C=>w("precisionSpeed",C)})]})]}),o.jsxs("div",{className:"space-y-0.5 surface",children:[o.jsx("p",{className:"text-[0.7rem] text-slate-500",children:"Camera tilt"}),o.jsx(Cr,{label:"Tilt speed",description:"Higher = faster when holding tilt keys",value:h,onChange:M,min:1,max:100,step:1})]}),o.jsx("div",{className:"space-y-0.5",children:Object.entries(g).map(([C,N])=>o.jsxs("div",{className:"space-y-0.5 surface",children:[o.jsx("p",{className:"text-[0.75rem] text-slate-400",children:C}),o.jsx("div",{className:"space-y-0.5",children:N.map(j=>{const q=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:un(q)})]}),o.jsxs("div",{className:"flex items-center gap-0.5",children:[A&&o.jsx("button",{type:"button",onClick:()=>y(),className:"button-danger text-[0.7rem]",children:"Cancel"}),o.jsx("button",{type:"button",onClick:()=>v(j.id),className:`${A?"px-0.5 py-0.5 bg-emerald-500 text-emerald-950 hover:bg-emerald-400":"button-dark"} text-[0.7rem] font-medium transition-colors`,children:A?"Press a key…":"Change"})]})]},j.id)})})]},C))})]})}const Bn=new Intl.NumberFormat(void 0,{maximumFractionDigits:2}),Cj=[{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"}],T0=.45,Ej=.6;function Ys({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:Bn.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:g=>h(Number(g.target.value)),className:"mt-0 w-full accent-emerald-400"})]})}function qj(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} ${Bn.format(a.threshold??.6)}`}return"Unassigned"}function Mj(a){return a.reduce((l,i)=>((l[i.section]||(l[i.section]=[])).push(i),l),{})}function Tj(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 Rj(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 kj(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>T0).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>T0);return f?{kind:"axis",index:f.index,...i.invertDefaults??{}}:null}function _j(a,l,i){const r=a.buttons??[];for(let d=0;d<r.length;d+=1){const h=r[d],g=typeof h?.value=="number"?h.value:h?.pressed?1:0;if(h?.pressed||g>Ej)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,g=Math.abs(h-(l.axes?.[d]??0));if(Math.abs(h)>.7&&g>.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 Dj(a,l,i){if(!a)return null;if(i.kind==="axis"||i.kind==="axisPair"){const r=kj(a,l,i);if(r)return r}return _j(a,l,i)}function Oj(){const a=yA(),{value:l,save:i}=xt("gamepad",da),[r,f]=m.useState(null),d=m.useRef(null),h=m.useMemo(()=>Mj(Cj),[]),g=m.useMemo(()=>Tj(a.pads,l.activeSignature),[a.pads,l.activeSignature]),x=g?.signature??null,v=m.useMemo(()=>x?l?.profiles?.[x]??l?.defaults?.profile??zn:l?.defaults?.profile??zn,[x,l?.defaults?.profile,l?.profiles]);m.useEffect(()=>{!g||!x||l?.profiles?.[x]||i(j=>{const q=j??da;if(q.profiles?.[x])return q;const A=q?.defaults?.profile??zn,k=zg(g,A);return{...q,profiles:{...q.profiles??{},[x]:k}}})},[g,x,l?.profiles,i]),m.useEffect(()=>{d.current=null},[r,x]),m.useEffect(()=>{if(!r||!g)return;if(!d.current){d.current=Rj(g);return}const j=Dj(g,d.current,r);j&&(i(q=>{const A=q??da,k=A.profiles?.[x]??A?.defaults?.profile??zn,B={...k,bindings:{...k.bindings??{},[r.id]:{...k.bindings?.[r.id]??{},kind:r.kind,sources:[j]}}};return{...A,profiles:{...A.profiles??{},[x]:B}}}),f(null))},[g,x,r,i]);const y=m.useCallback(j=>{i(q=>({...q??da,activeSignature:j||null}))},[i]),S=m.useCallback(j=>{i(q=>{const A=q??da,k=(x&&A.profiles?.[x])??A?.defaults?.profile??zn,B={...k,calibration:{...k.calibration??{},...j}};return x?{...A,profiles:{...A.profiles??{},[x]:B}}:{...A,defaults:{...A.defaults??{},profile:B}}})},[x,i]),w=m.useCallback((j,q)=>{i(A=>{const k=A??da,B=(x&&k.profiles?.[x])??k?.defaults?.profile??zn,L=q(B.bindings?.[j]??{}),Z={...B,bindings:{...B.bindings??{},[j]:L}};return x?{...k,profiles:{...k.profiles??{},[x]:Z}}:{...k,defaults:{...k.defaults??{},profile:Z}}})},[x,i]),M=m.useCallback(j=>{w(j.id,q=>({...q,sources:[]}))},[w]),C=m.useCallback((j,q)=>{w(j.id,A=>{const k=Array.isArray(A.sources)?[...A.sources]:[];if(!k[0])return A;const B={...k[0]};return q==="invertX"?B.invertX=!B.invertX:q==="invertY"?B.invertY=!B.invertY:B.invert=!B.invert,k[0]=B,{...A,sources:k}})},[w]),N=m.useMemo(()=>g?{outputs:Lg(g,v)}:null,[g,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:g?"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:g?.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(Ys,{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(Ys,{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(Ys,{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(Ys,{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(Ys,{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,q])=>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:q.map(A=>{const B=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:qj(B)})]}),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:!B,onClick:()=>C(A,"invertX"),className:"button-dark text-[0.7rem] font-medium disabled:opacity-50",children:"Invert X"}),o.jsx("button",{type:"button",disabled:!B,onClick:()=>C(A,"invertY"),className:"button-dark text-[0.7rem] font-medium disabled:opacity-50",children:"Invert Y"})]}),A.kind==="axis"&&o.jsx("button",{type:"button",disabled:!B,onClick:()=>C(A),className:"button-dark text-[0.7rem] font-medium disabled:opacity-50",children:"Invert"}),o.jsx("button",{type:"button",onClick:()=>M(A),className:"button-dark text-[0.7rem]",children:"Clear"}),o.jsx("button",{type:"button",onClick:()=>f(A),className:`${r?.id===A.id?"px-0.5 py-0.5 bg-emerald-500 text-emerald-950 hover:bg-emerald-400":"button-dark"} text-[0.7rem] font-medium`,children:r?.id===A.id?"Waiting…":"Capture"})]})]},A.id)})})]},j))}),o.jsxs("div",{className:"space-y-0.5 surface",children:[o.jsx("p",{className:"text-[0.7rem] text-slate-500",children:"Diagnostics"}),g?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:g.axes.map((j,q)=>o.jsxs("span",{className:"font-mono text-slate-300",children:["A",q,": ",Bn.format(j)]},`axis-${q}`))}),o.jsx("p",{className:"text-slate-400",children:"Raw buttons"}),o.jsx("div",{className:"grid grid-cols-2 gap-0.5",children:g.buttons.map((j,q)=>o.jsxs("span",{className:"font-mono text-slate-300",children:["B",q,": ",Bn.format(j.value)," ",j.pressed?"●":""]},`btn-${q}`))}),N?.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: ",Bn.format(N.outputs.driveVector.x),","," ",Bn.format(N.outputs.driveVector.y)]}),o.jsxs("span",{className:"font-mono text-slate-300",children:["Camera: ",Bn.format(N.outputs.cameraAxis)]}),o.jsxs("span",{className:"font-mono text-slate-300",children:["Main: ",Bn.format(N.outputs.auxAxis.main)]}),o.jsxs("span",{className:"font-mono text-slate-300",children:["Side: ",Bn.format(N.outputs.auxAxis.side)]})]})]})]}):o.jsx("p",{className:"text-[0.7rem] text-slate-400",children:"No controller detected."})]})]})}const Bj={drive:"Drive wheels",aux:"Aux motors"};function R0(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 Lj(){const{state:{roverId:a},overcurrentLimiter:l}=Mt(),i=m.useMemo(()=>Ol.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:Bj[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:R0(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:R0(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 ex=m.createContext(null);function tx(){const a=m.useContext(ex);if(!a)throw new Error("Tabs components must be used within a <Tabs> provider.");return a}const k0={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"}},nx="primary";function Bf(...a){return a.filter(Boolean).join(" ")}function zf({children:a,defaultTab:l,currentTab:i,onTabChange:r,variant:f=nx}){const[d,h]=m.useState(l??null),[g,x]=m.useState([]),v=m.useCallback(M=>M?(x(C=>C.includes(M)?C:[...C,M]),()=>x(C=>C.includes(M)?C.filter(N=>N!==M):C)):()=>{},[]),y=i??d??g[0]??null;m.useEffect(()=>{l&&i===void 0&&h(l)},[l,i]);const S=m.useCallback(M=>{M&&(i===void 0&&h(M),r&&r(M))},[i,r]),w=m.useMemo(()=>({activeTab:y,setActiveTab:S,registerTab:v,variant:f}),[y,S,v,f]);return o.jsx(ex.Provider,{value:w,children:a})}function Lf({children:a,className:l=""}){return o.jsx("div",{className:Bf("flex gap-0.5",l),children:a})}function tn({id:a,children:l,className:i="",disabled:r=!1}){const{activeTab:f,setActiveTab:d,registerTab:h,variant:g}=tx();m.useEffect(()=>h(a),[a,h]);const x=k0[g]??k0[nx],v=f===a,y=Bf(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 Uf({children:a,className:l=""}){return o.jsx("div",{className:Bf("mt-0 space-y-0.5",l),children:a})}function nn({id:a,children:l,keepMounted:i=!1}){const{activeTab:r}=tx(),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 Uj(){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 _0=300,D0=240;function Hj(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 Vj(a){const i=a.map(r=>Hj(r)).join(" ");return i.length>D0?`${i.slice(0,D0)}…`:i}function Yj(){const a=hn(),[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 w=[...S,{id:`${Date.now()}-${Math.random().toString(16).slice(2)}`,direction:x,event:v,payload:Vj(y),timestamp:new Date().toLocaleTimeString()}];return w.length>_0?w.slice(-_0):w})},d=(x,...v)=>f("in",x,v),h=(x,...v)=>f("out",x,v);a.onAny(d);let g=null;if(typeof a.onAnyOutgoing=="function")a.onAnyOutgoing(h),g=()=>a.offAnyOutgoing(h);else{const x=a.emit.bind(a);a.emit=(v,...y)=>(h(v,...y),x(v,...y)),g=()=>{a.emit=x}}return()=>{a.offAny(d),g&&g()}},[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 $j=[{key:"start",label:"Start OI"},{key:"safe",label:"Safe"},{key:"full",label:"Full"},{key:"passive",label:"Passive"},{key:"dock",label:"Dock"}];function ax(){const{state:{roverId:a},actions:{sendOiCommand:l,setSensorStream:i}}=Mt(),r=!!a,[f,d]=Ig(),h=hn(),{value:g,save:x}=xt("page",{hudMapDesktop:!1,connectionTransport:"websocket"}),v=g?.connectionTransport||"websocket",y=m.useMemo(()=>[{key:"start",label:"Enable stream",enable:!0},{key:"stop",label:"Disable stream",enable:!1}],[]),S=M=>{a&&i(M)},w=M=>{const C=M.target.value;x(N=>({...N??{},connectionTransport:C})),h?.io?.opts&&(h.io.opts.transports=C==="polling"?["polling"]:["websocket","polling"],h.disconnect(),h.connect())};return o.jsxs(zf,{defaultTab:"keybindings",children:[o.jsxs(Lf,{children:[o.jsx(tn,{id:"keybindings",children:"Keybindings"}),o.jsx(tn,{id:"controller",children:"Controller"}),o.jsx(tn,{id:"page",children:"Page settings"}),o.jsx(tn,{id:"admin",children:"Admin"})]}),o.jsxs(Uf,{children:[o.jsx(nn,{id:"keybindings",children:o.jsx("div",{className:"space-y-0.5",children:o.jsx(wj,{})})}),o.jsx(nn,{id:"controller",children:o.jsx("div",{className:"space-y-0.5",children:o.jsx(Oj,{})})}),o.jsx(nn,{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:M=>d(M.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:w,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(nn,{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:$j.map(M=>o.jsx("button",{type:"button",onClick:()=>l(M.key),disabled:!r,className:"button-dark text-xs disabled:opacity-30",children:M.label},M.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(M=>o.jsx("button",{type:"button",onClick:()=>S(M.enable),disabled:!r,className:"flex-1 button-dark text-xs disabled:opacity-30",children:M.label},M.key))}),!r&&o.jsx("p",{className:"text-xs text-slate-500",children:"Assign a rover to toggle streams."})]}),o.jsx(Pg,{}),o.jsx(Lj,{}),o.jsx(pj,{}),o.jsx(Uj,{}),o.jsx(Yj,{})]})})]})]})}const O0={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 Gj(a){return O0[a]||O0.desktop}function lx({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:un(i)})}function B0(a,l){return a.map((i,r)=>typeof i=="string"?o.jsx("span",{children:i},`text-${r}`):i?.action?o.jsx(lx,{actionId:i.action,keymap:l},`pill-${i.action}-${r}`):i?.text?o.jsx("span",{children:i.text},`span-${r}`):null)}function Ir(a,l,i){if(typeof a=="string")return a;if(Array.isArray(a?.segments))return B0(a.segments,l);if(a&&typeof a=="object"){if(typeof a.text=="string")return a.text;if(Array.isArray(a))return B0(a,l)}return String(a??"")}function Xj({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:Ir(i,l)},f)})})]}):null}function Qj({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:Ir(i,l)},f)})})]})}function Kj({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:Ir(i,{})},`callout-${r}`))})]})}function Zj({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(lx,{actionId:i.action,keymap:l})]},i.action))})]})}function Fj({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(Zj,{group:i,keymap:l},i.id))})]}):null}function Jj({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:Ir(l,{})},`gamepad-${i}`))})]}):null}function z0({block:a,keymap:l}){if(!a)return null;switch(a.type){case"list":return o.jsx(Qj,{block:a,keymap:l});case"callout":return o.jsx(Kj,{block:a});case"keyboard":return o.jsx(Fj,{block:a,keymap:l});case"gamepad":return o.jsx(Jj,{block:a});default:return null}}function sx({layout:a,keymap:l}){const i=m.useMemo(()=>Gj(a),[a]),r=l||{},f=i.main||[],d=i.aside||[];return o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(Xj,{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,g)=>o.jsx(z0,{block:h,keymap:r},h.title||g))}),o.jsx("div",{className:"space-y-0.5",children:d.map((h,g)=>o.jsx(z0,{block:h,keymap:r},h.title||g))})]})]})}function ix({layout:a,onOpenOverlay:l}){const{state:i}=Mt();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(sx,{layout:a,keymap:i?.keymap||{}})]})}const Ij=["kal","rms","slt","ksp","bdl"],Wj=Array.from({length:10},(a,l)=>l*10);function Wr({hideInput:a=!1,hideSpectatorNotice:l=!1,fillHeight:i=!1,allowSpectatorInput:r=!1}){const{session:f}=ze(),{messages:d,typing:h,sendMessage:g,registerInputRef:x,onInputFocus:v,onInputBlur:y,blurChat:S,setTypingActive:w}=Cf(),{value:M,save:C}=xt("tts",{engine:"flite",voice:"rms",pitch:50}),[N,j]=m.useState(""),[q,A]=m.useState(!1),[k,B]=m.useState(!1),[L,Z]=m.useState(()=>M?.engine||"flite"),[O,X]=m.useState(()=>M?.voice||"rms"),[$,Q]=m.useState(()=>Number.isFinite(M?.pitch)?M.pitch:50),z=f?.role!=="spectator"||r,K=m.useRef(null),ee=f?.assignment?.roverId||null,W=!!m.useMemo(()=>f?.roster?.find(E=>String(E.id)===String(ee))||null,[ee,f?.roster])?.audio?.ttsEnabled,R=m.useMemo(()=>d.slice(-200),[d]),F=m.useMemo(()=>h||[],[h]);m.useEffect(()=>{K.current&&(K.current.scrollTop=K.current.scrollHeight)},[R,F]),m.useEffect(()=>{const E=M?.engine||"flite",Y=M?.voice||"rms",te=Number.isFinite(M?.pitch)?M.pitch:50;L!==E&&Z(E),O!==Y&&X(Y),$!==te&&Q(te)},[L,$,M?.engine,M?.pitch,M?.voice,O]),m.useEffect(()=>{B(!!W)},[W]);const ne=m.useMemo(()=>!W||!k?null:L==="espeak"?{speak:!0,engine:L,pitch:$}:{speak:!0,engine:L,voice:O},[L,$,k,W,O]);async function ue(E){if(E.preventDefault(),!z||a)return;const te=N.replace(/\\n/g,`
|
||
`).trim();if(te){A(!0);try{await g(te,ne),j(""),S(),w(!1)}catch(le){alert(le.message)}finally{A(!1)}}}const he=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 ${he}`,ref:K,children:[R.length===0&&F.length===0?o.jsx("p",{className:"text-sm text-slate-500",children:"No messages yet."}):R.map(E=>o.jsx(qg,{message:E},E.id)),F.map(E=>o.jsx(Mg,{message:E},`typing-${E.typingId||E.id}`))]}),!a&&o.jsxs("form",{className:"flex flex-wrap items-stretch gap-0.5",onSubmit:ue,children:[o.jsx("input",{className:"field-input flex-1 min-w-[10rem]",value:N,onChange:E=>{const Y=E.target.value;j(Y),w(!!Y.trim())},onFocus:E=>{v(E),w(!!N.trim())},onBlur:E=>{y(E),w(!1)},onKeyDown:E=>{E.key==="Enter"&&!N.trim()&&(E.preventDefault(),S(),w(!1))},ref:E=>x(E,{target:"panel"}),placeholder:z?"Type a message…":l?"":"Spectators cannot chat",disabled:!z}),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:E=>B(E.target.checked),className:"accent-cyan-500"}),o.jsx("span",{children:"Speak"})]}),o.jsxs("select",{value:L,onChange:E=>{const Y=E.target.value;Z(Y),C(te=>({...te||{},engine:Y}))},className:"field-input text-xs",children:[o.jsx("option",{value:"flite",children:"flite"}),o.jsx("option",{value:"espeak",children:"espeak"})]}),L==="flite"?o.jsx("select",{value:O,onChange:E=>{const Y=E.target.value;X(Y),C(te=>({...te||{},voice:Y}))},className:"field-input text-xs",children:Ij.map(E=>o.jsx("option",{value:E,children:E},E))}):o.jsx("select",{value:$,onChange:E=>{const Y=Number(E.target.value);Q(Y),C(te=>({...te||{},pitch:Y}))},className:"field-input text-xs",children:Wj.map(E=>o.jsxs("option",{value:E,children:["pitch ",E]},E))})]}),o.jsx("button",{type:"submit",disabled:!z||q,className:"button-dark h-full disabled:opacity-50 self-stretch",children:q?"...":"Send"})]})]})}function Hf({compact:a=!1}){const{session:l,setNickname:i}=ze(),{value:r,save:f}=xt("profile",{nickname:""}),[d,h]=m.useState(r.nickname||""),[g,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 w=(d||"").trim().slice(0,32);if(w){x(!0);try{await i(w),f({nickname:w})}catch(M){alert(M.message)}finally{x(!1)}}}return o.jsxs("form",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)_auto] items-stretch gap-0.5",onSubmit:y,children:[o.jsx("input",{className:"field-input flex-1 min-w-0",value:d,onChange:S=>h(S.target.value),maxLength:32,placeholder:"Enter a nickname",disabled:!v}),o.jsx("button",{type:"submit",disabled:!v||g,className:"button-dark h-full shrink-0 whitespace-nowrap px-0.5 py-0 disabled:opacity-50",children:g?"Saving…":a?"Set":"Save"})]})}function rx({text:a="Support me on Ko-fi!",className:l=""}){const{session:i}=ze(),r=i?.kofi?.link||null;return r?o.jsxs("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:`inline-flex items-center w-full px-0.5 py-0.5 text-sm font-medium text-white kofi-animate-bg transition justify-center gap-1 rounded-md ${l}`,children:[o.jsx(wS,{className:"mr-0"}),a]}):null}function Pj({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(Hf,{compact:a})})})}function eN(){return o.jsx("section",{className:"panel-section flex h-full min-h-0 flex-col gap-0.5 text-base",children:o.jsxs("div",{className:"grid flex-1 min-h-0 gap-0.5 grid-rows-2",children:[o.jsx(Fr,{className:"h-full"}),o.jsx(rx,{className:"h-full"})]})})}function Yu(...a){return a.filter(Boolean).join(" ")}function tN(a){const l=a?.batteryState?.percentDisplay;return l==null?"--":`${l}%`}function nN(a){return a?.batteryState?a.batteryState.urgentActive?"text-red-400":a.batteryState.warnActive?"text-amber-300":"text-emerald-300":"text-slate-400"}function aN(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 lN(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 Pr({title:a="Rovers"}){const{session:l,requestControl:i}=ze(),[r,f]=m.useState({}),[d,h]=m.useState(()=>Date.now()),g=m.useMemo(()=>l?.role&&l.role!=="spectator",[l?.role]),x=l?.roster??[],v=l?.turnQueues??{},y=l?.users??[],S=l?.socketId||null,w=m.useMemo(()=>Object.values(v||{}).some(j=>j?.deadline||j?.idleDeadline),[v]);m.useEffect(()=>{if(!w)return;const j=setInterval(()=>{h(Date.now())},1e3);return()=>clearInterval(j)},[w]);const M=m.useMemo(()=>{const j=new Set(x.map(A=>String(A.id))),q=Object.keys(v||{}).filter(A=>!j.has(String(A))).map(A=>({id:A,name:A,locked:!1,batteryState:null}));return[...x,...q]},[x,v]);async function C(j){if(j){f(q=>({...q,[j]:!0}));try{await i(j)}catch(q){alert(q.message)}finally{f(q=>({...q,[j]:!1}))}}}const N=j=>y.find(q=>q.socketId===j)||{socketId:j,nickname:null,role:null};return o.jsxs("div",{className:"space-y-0.5 text-sm",children:[a&&o.jsx("p",{className:"text-sm text-slate-400",children:a}),M.length===0?o.jsx("p",{className:"text-sm text-slate-500",children:"No rovers registered."}):o.jsx("ul",{className:"space-y-0.5 text-sm",children:M.map(j=>{const q=String(j.id),A=v?.[q]||null,k=A?.queue||[],B=A?.idleDeadline||A?.deadline||null,L=B&&B>d?Math.ceil((B-d)/1e3):B?0:null,Z=A?.current||null,O=Z?k.findIndex(R=>R===Z):-1,X=k.length>1?O>=0?k[(O+1)%k.length]:k[0]:null,$=!!(S&&Z&&Z===S),Q=!!(S&&X&&X===S),z=L!=null&&($||Q),K=!!j.locked,ee=j.lockReason?`locked: ${j.lockReason}`:"locked",oe=K?ee:r[q]?"...":"request",W=g&&!K&&!r[q];return o.jsxs("li",{className:Yu("surface flex flex-wrap items-start justify-between gap-0.5",W&&"cursor-pointer",K&&"bg-red-900/40"),onClick:()=>{W&&C(j.id)},children:[o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-0.5",children:[o.jsxs("div",{className:"flex items-center gap-0.5",children:[o.jsx("p",{className:"text-slate-200",children:j.name}),z?o.jsx("span",{className:"rounded bg-slate-800 px-1 text-[0.7rem] text-slate-200",children:$?`${L}s left`:`Your turn in ${L}s`}):null]}),o.jsx("span",{className:Yu("text-[0.75rem] font-semibold",nN(j)),children:tN(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((R,F)=>{const ne=N(R),ue=R===Z,he=!!(X&&R===X&&!ue),E=ue?"bg-sky-600 text-white ring-2 ring-amber-300":he?"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] ${E}`,children:[o.jsx("span",{className:`${aN(ne.role)} font-semibold`,children:lN(ne,S)}),ue&&o.jsx("span",{className:"text-[0.65rem] text-slate-200",children:"now"}),he&&o.jsx("span",{className:"text-[0.65rem] text-emerald-100",children:"next"})]},`${q}-${R}-${F}`)})})]}),g?o.jsx("button",{type:"button",onClick:R=>{R.stopPropagation(),C(j.id)},disabled:r[q]||K,className:Yu("button-dark disabled:opacity-40",K&&"bg-red-600/70 text-white hover:bg-red-600"),children:oe}):null]},j.id)})})]})}function sN(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 iN(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 Yr({hideNicknameForm:a=!1,hideHeader:l=!1,className:i="",fillHeight:r=!1,compact:f=!1}){const{session:d,setNickname:h}=ze(),{value:g}=xt("profile",{nickname:""}),x=m.useRef(null),v=hn(),y=d?.role!=="spectator",S=d?.users??[],w=d?.socketId||null;m.useEffect(()=>{if(!y||!d?.socketId)return;const N=g.nickname||"";if(!N||d.socketId===x.current)return;const j=d.socketId;h(N).then(()=>{x.current=j}).catch(()=>{})},[y,d?.socketId,h,g.nickname]),m.useEffect(()=>{if(!v)return;const N=()=>{if(!y)return;const j=(g.nickname||"").trim();j&&h(j).then(()=>{x.current=d?.socketId||null}).catch(()=>{})};return v.on("connect",N),()=>v.off("connect",N)},[y,h,v,g.nickname,d?.socketId]);const M=m.useMemo(()=>[...S].sort((N,j)=>N.socketId===w?-1:j.socketId===w?1:(N.nickname||"").localeCompare(j.nickname||"")),[w,S]),C=r?"flex-1 min-h-0 overflow-y-auto":f?"h-28 overflow-y-auto":"h-48 overflow-y-auto";return o.jsxs("section",{className:`panel-section space-y-0.5 text-base ${r?"flex h-full min-h-0 flex-col overflow-hidden":""} ${i}`,children:[!a&&o.jsxs("div",{className:"space-y-0.5",children:[o.jsxs("div",{className:"grid gap-0.5 md:grid-cols-[minmax(0,1.4fr)_minmax(0,1fr)]",children:[o.jsx("div",{className:"min-w-0",children:o.jsx("div",{className:"surface flex w-full items-center px-0 py-0",children:o.jsx(Hf,{compact:f})})}),o.jsxs("div",{className:"grid gap-0.5 sm:grid-cols-2 md:grid-cols-1",children:[o.jsx(Fr,{}),o.jsx(rx,{})]})]}),!y&&o.jsx("p",{className:"text-xs text-slate-500",children:"Spectators cannot set nicknames."})]}),o.jsxs("div",{className:`space-y-0.5 ${r?"flex flex-1 min-h-0 flex-col":""}`,children:[!l&&o.jsxs("div",{className:`flex items-center justify-between text-sm text-slate-400 ${f?"text-xs":""}`,children:[o.jsx("span",{children:"Users"}),o.jsx("span",{className:"text-xs text-slate-500",children:M.length})]}),o.jsx("div",{className:`surface flex flex-wrap content-start items-start gap-0.5 px-0 pb-0 ${C} ${f?"text-[0.8rem]":""}`,children:M.length===0?o.jsx("p",{className:"text-sm text-slate-500",children:"Waiting for users…"}):M.map(N=>o.jsx("span",{className:`rounded bg-slate-800/80 px-1 py-0.25 text-[0.7rem] ${sN(N.role)}`,children:iN(N,w)},N.socketId))})]})]})}function rN(){const{state:{roverId:a}}=Mt(),i=$l(a)?.sensors||{};return o.jsx("section",{className:"panel-section",children:o.jsx("div",{className:"aspect-square w-full",children:o.jsx(rf,{sensors:i})})})}function oN(){const{state:{roverId:a,keymap:l,camera:i,horn:r},pipeline:f,actions:{setServoAngle:d,setNightVision:h,startHorn:g,stopHorn:x}}=Mt(),v=Yg(a),y=v.docked&&!v.driving,S=i?.config,w=!!(a&&i?.enabled&&S),M=!!(a&&f?.nightVision),C=f?.nightVisionState,N=!!(a&&f?.horn),j=r?.overheated,q=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:(q+A)/2,B=un(l?.nightVisionToggle?.[0]),L=un(l?.hornHonk?.[0]),Z=un(l?.cameraUp?.[0]),O=un(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($g,{layout:"desktop",expand:!0,driveDockState:v}),y?null:o.jsxs("div",{className:"surface space-y-0.5 p-0 text-sm text-slate-200",children:[M&&o.jsx(Gg,{nightVisionOn:C?.nightVisionOn,disabled:!a,onToggle:h,keyLabel:B}),N&&o.jsx(Xg,{disabled:!a||j,onStart:g,onStop:x,keyLabel:L,active:r?.active,heat:r?.heat}),w&&o.jsx(Qg,{value:k,min:q,max:A,onChange:d,keyDownLabel:O,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 cN({layout:a,onOpenHelpOverlay:l}){return o.jsx("section",{className:"panel text-base",children:o.jsxs(zf,{defaultTab:"telemetry",children:[o.jsxs(Lf,{children:[o.jsx(tn,{id:"telemetry",children:"Controls"}),o.jsx(tn,{id:"help",children:"Help"}),o.jsx(tn,{id:"settings",children:"Settings"})]}),o.jsxs(Uf,{children:[o.jsx(nn,{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(rN,{}),o.jsx(oN,{})]}),o.jsxs("div",{className:"grid gap-0.5 grid-cols-[minmax(0,1fr)_minmax(0,0.9fr)_minmax(0,0.75fr)]",children:[o.jsx(Pr,{}),o.jsx(jf,{panelId:"replay-sources-desktop",fillHeight:!0}),o.jsx(eN,{})]}),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(Wr,{fillHeight:!0}),o.jsxs("div",{className:"grid min-h-0 gap-0.5 grid-rows-[minmax(0,1fr)_auto]",children:[o.jsx(Yr,{compact:!0,hideNicknameForm:!0,fillHeight:!0}),o.jsx(Pj,{compact:!0})]})]}),o.jsx(Wg,{}),o.jsx(Mf,{defaultOrientation:"horizontal",panelId:"rightpane-telemetry"})]})}),o.jsx(nn,{id:"help",children:o.jsx(ix,{layout:a,onOpenOverlay:l})}),o.jsx(nn,{id:"settings",children:o.jsx(ax,{})})]})]})})}const uN=new Set(["admin","lockdown","lockdown-admin"]),fN=new Set(["lockdown","lockdown-admin"]),dN=new Set(["admin","lockdown"]);function mN(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 hN(){const{session:a}=ze(),l=a?.mode,i=a?.role,r=a?.adminReason?.text||"";a?.adminReason?.updatedAt;const f=a?.timezone||"UTC",d=dN.has(l),h=l==="lockdown"?fN.has(i):uN.has(i),[g,x]=m.useState(()=>new Date),v=m.useMemo(()=>{try{return new Intl.DateTimeFormat("en-US",{timeZone:f,hour:"numeric",minute:"2-digit",second:"2-digit"}).format(g)}catch{return g.toLocaleTimeString()}},[g,f]);if(m.useEffect(()=>{const S=setInterval(()=>x(new Date),1e3);return()=>clearInterval(S)},[]),!d||h)return null;const y=mN(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:y.title}),o.jsx("p",{className:"text-sm text-slate-300",children:y.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: ",v]})]}),o.jsx("div",{className:"surface-muted",children:o.jsx(Pg,{})}),o.jsx("div",{className:"w-full justify-center items-center",children:o.jsx(Fr,{text:"Join our Discord server for updates!"})}),"You can still use the chat while the server is locked:",o.jsxs("div",{className:"max-h-80 overflow-y-auto",children:[o.jsx(Wr,{}),o.jsx(Hf,{})]})]})})}const pN="/assets/turn_alert-DVO8EZJa.mp3";function gN(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 xN(){const{session:a,pushAlert:l}=ze(),i=gN(pN),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(([g,x])=>{!x||!x.current||x.current!==d||r.current.has(g)||(h.push(g),r.current.add(g))}),Object.keys(f).forEach(g=>{(!f[g]||f[g].current!==d)&&r.current.delete(g)}),h.length!==0&&(h.forEach(g=>{const x=a?.roster?.find(v=>String(v.id)===String(g))?.name||g;l({title:"Your turn!",message:`You now control ${x}.`,color:"#ff5722"})}),i())},[f,i,l,a?.roster,d]),null}function vN({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 ox="fullscreenPromptDismissed",yN=new Set(["mobile-portrait","mobile-landscape"]),cx=()=>{if(typeof window>"u")return null;try{return window.sessionStorage}catch{return null}},bN=()=>{const a=cx();if(!a)return!1;try{return a.getItem(ox)==="1"}catch{return!1}},L0=()=>{const a=cx();if(a)try{a.setItem(ox,"1")}catch{}},SN=()=>{if(typeof navigator>"u")return!1;const a=navigator.userAgent||navigator.platform||"";return/iphone|ipad|ipod/i.test(a)},AN=()=>{if(typeof document>"u")return!1;const a=document;return!!(a.fullscreenEnabled||a.webkitFullscreenEnabled||a.mozFullScreenEnabled||a.msFullscreenEnabled)};function jN(a){const l=yN.has(a),[i,r]=m.useState(!1),[f,d]=m.useState("native"),h=m.useMemo(()=>SN(),[]),g=m.useCallback(()=>{if(!l){r(!1);return}if(bN()){r(!1);return}if(h){d("pwa-hint"),r(!0);return}if(!AN()){r(!1);return}if(typeof document<"u"&&document.fullscreenElement){r(!1);return}d("native"),r(!0)},[h,l]);m.useEffect(()=>{g()},[g]),m.useEffect(()=>{if(typeof document>"u")return;const y=()=>{if(document.fullscreenElement){r(!1);return}g()};return document.addEventListener("fullscreenchange",y),document.addEventListener("webkitfullscreenchange",y),()=>{document.removeEventListener("fullscreenchange",y),document.removeEventListener("webkitfullscreenchange",y)}},[g]);const x=m.useCallback(()=>{L0(),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 w=S.call(y);return w&&typeof w.then=="function"&&await w,L0(),r(!1),!0}catch(w){return console.warn("Failed to enter fullscreen",w),!1}},[h,l]);return m.useEffect(()=>{l||r(!1)},[l]),{visible:i,mode:f,enterFullscreen:v,dismiss:x}}function NN({visible:a,layout:l,onClose:i,showOnLoad:r,onToggleShowOnLoad:f}){if(!a)return null;const{state:d}=Mt(),h=g=>{const x=!g.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(sx,{layout:l,keymap:d?.keymap||{}})})]})})}const wN=`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 CN(a){return a?a.charAt(0).toUpperCase()+a.slice(1):""}function EN(){const a=String(wN).split(/\r?\n/).map(i=>i.trim()).filter(Boolean);return a.length?(a[Math.floor(Math.random()*a.length)]||"").trim():""}function Vf(){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=CN(EN()).slice(0,32);if(!h)return;(async()=>{try{await a(h)}catch{}finally{r({nickname:h})}})()},[r,a,i,l.nickname])}const $u=1e4,Gu=28,qN=14;function $r({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,g]=m.useState(!1),[x,v]=m.useState(Gu),[y,S]=m.useState(0),w=m.useRef(null),M=m.useRef(null),C=m.useRef(null);m.useEffect(()=>{if(!f){g(!1);return}if(g(!0),!d||!i)return;const A=Date.now();S($u);const k=setTimeout(()=>g(!1),$u),B=setInterval(()=>{const L=Date.now()-A;S(Math.max(0,$u-L))},250);return()=>{clearTimeout(k),clearInterval(B)}},[f,d]),m.useEffect(()=>{if(!f)return;v(Gu);let A=0;const k=()=>{const L=C.current,Z=M.current;if(!L||!Z)return;const O=L.clientWidth;if(!O)return;const X=Z.scrollWidth;if(!X)return;const $=Math.min(1,O/X),Q=Math.max(qN,Math.floor(Gu*$));v(Q)};A=window.requestAnimationFrame(k);const B=new ResizeObserver(()=>{window.cancelAnimationFrame(A),A=window.requestAnimationFrame(k)});return w.current&&B.observe(w.current),()=>{window.cancelAnimationFrame(A),B.disconnect()}},[f]);const N=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,q=i?{onClick:()=>g(!1),role:"button",tabIndex:0}:{};return o.jsx("div",{ref:w,className:N,style:{fontSize:`${x}px`,lineHeight:1.1},...q,children:o.jsxs("span",{className:"flex w-full items-stretch gap-0.5 whitespace-nowrap rounded-md",children:[o.jsxs("span",{className:"flex flex-col justify-center border-r border-slate-700/60 px-0.5 text-[0.55em] font-semibold leading-tight text-slate-400",children:[o.jsx("span",{children:"Community"}),o.jsx("span",{children:"Goal"})]}),o.jsx("span",{ref:C,className:"flex-1 overflow-hidden text-slate-100",children:o.jsx("span",{ref:M,className:"block",children:f})}),d?o.jsxs("span",{className:"flex items-center border-l border-slate-700/60 px-0.5 text-[0.55em] font-semibold uppercase tracking-wide text-slate-400",children:[j,"s"]}):null]})})}function MN(){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 TN({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(_f,{}),o.jsx(fS,{}),o.jsx(Tf,{})]}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5 overflow-y-auto",children:[o.jsx($r,{layout:a}),o.jsx(cN,{layout:a,onOpenHelpOverlay:l})]})]})}function ux({layout:a,onOpenHelpOverlay:l,roomPanelId:i,showTelemetry:r=!0}){return o.jsx("section",{className:"panel text-base",children:o.jsxs(zf,{defaultTab:"chat",children:[o.jsxs(Lf,{children:[o.jsx(tn,{id:"chat",children:"Chat"}),o.jsx(tn,{id:"roomcontrols",children:"Room Controls"}),o.jsx(tn,{id:"help",children:"Help"}),o.jsx(tn,{id:"settings",children:"Settings"})]}),o.jsxs(Uf,{children:[o.jsx(nn,{id:"chat",children:o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(Wr,{}),o.jsx(Yr,{})]})}),o.jsx(nn,{id:"roomcontrols",children:o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(Wg,{}),o.jsx(Mf,{panelId:i})]})}),o.jsx(nn,{id:"help",children:o.jsx(ix,{layout:a,onOpenOverlay:l})}),o.jsx(nn,{id:"settings",children:o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(ax,{}),o.jsx(Tf,{})]})})]})]})})}function RN({onOpenHelpOverlay:a}){return o.jsxs("div",{className:"flex flex-col gap-0.5",children:[o.jsx(_f,{layoutFormat:"mobile-portrait"}),o.jsx(OA,{}),o.jsxs("div",{className:"grid gap-0.5 grid-cols-[minmax(0,1fr)_minmax(0,1.4fr)]",children:[o.jsx(jf,{panelId:"replay-sources-mobile-portrait"}),o.jsx(Pr,{})]}),o.jsx(ux,{layout:"mobile-portrait",onOpenHelpOverlay:a,roomPanelId:"mobile-portrait-room"})]})}function kN({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(Kg,{layout:"landscape",className:l}),o.jsxs("div",{children:[o.jsx(_f,{layoutFormat:"mobile-landscape"}),o.jsxs("div",{className:"grid gap-0.5 grid-cols-[minmax(0,1fr)_minmax(0,1.4fr)]",children:[o.jsx(jf,{panelId:"replay-sources-mobile-landscape"}),o.jsx(Pr,{})]})]}),o.jsx(Zg,{layout:"landscape",className:l})]}),o.jsx("div",{className:"flex flex-col gap-0.5 pb-0",children:o.jsx(ux,{layout:"mobile-landscape",onOpenHelpOverlay:a,roomPanelId:"mobile-landscape-room",showTelemetry:!1})})]})}function _N(){const a=MN(),l=a==="desktop",i=jN(a);return o.jsx("div",{className:`bg-black text-slate-100 ${l?"h-screen overflow-hidden":"min-h-screen"}`,children:o.jsx(Af,{children:o.jsx(DN,{layout:a,isDesktop:l,fullscreen:i})})})}function DN({layout:a,isDesktop:l,fullscreen:i}){Vf();const{visible:r,mode:f,enterFullscreen:d,dismiss:h}=i,{value:g,status:x,save:v}=xt("help",{showOnLoad:!0}),[y,S]=m.useState(!1);m.useEffect(()=>{x==="ready"&&S(g?.showOnLoad!==!1)},[x,g?.showOnLoad]);const w=m.useCallback(()=>S(!0),[]),M=m.useCallback(()=>S(!1),[]),C=m.useCallback(j=>{const q=!!j;v(A=>({...A??{},showOnLoad:q})),q||S(!1)},[v]),N=m.useMemo(()=>l?o.jsx(TN,{layout:a,onOpenHelpOverlay:w}):a==="mobile-landscape"?o.jsx(kN,{onOpenHelpOverlay:w}):o.jsx(RN,{onOpenHelpOverlay:w}),[l,a,w]);return o.jsxs(WS,{children:[o.jsx(cA,{}),o.jsx(wA,{}),o.jsxs("main",{className:`flex w-full flex-col gap-0.5 text-base ${l?"h-full overflow-hidden":""}`,children:[l?null:o.jsx($r,{layout:a}),N]}),o.jsx(Nf,{}),o.jsx(xN,{}),o.jsx(hN,{}),o.jsx(NN,{visible:y,layout:a,onClose:M,showOnLoad:g?.showOnLoad!==!1,onToggleShowOnLoad:C}),o.jsx(vN,{visible:r,mode:f,onEnterFullscreen:d,onDismiss:h})]})}function fx(){const{session:a,setRole:l,subscribeAll:i,connected:r}=ze(),[f,d]=m.useState(!1);return m.useEffect(()=>{let h=!1;async function g(){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 g(),()=>{h=!0}},[r,a?.mode,a?.role,l,i]),f}function ON(){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 BN({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 zN({rover:a,frame:l,sessionInfo:i,videoMode:r,snapshotFeed:f,audioInfo:d,session:h}){const g=BN({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(Is,{sessionInfo:i,videoMode:r,snapshotFeed:f,audioSessionInfo:d,label:a.name,telemetryFrame:l,batteryConfig:a.battery,hudVariant:"spectator",driverLabel:g,hudForceMap:!0,hudMapPosition:"top-center"})})})}function LN({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(g=>o.jsx(zN,{rover:g,frame:l[g.id],sessionInfo:h&&i[g.id]||null,videoMode:h?"whep":"snapshot",snapshotFeed:h?null:r[g.id],audioInfo:f[`${g.id}-audio`],session:d,showHudMap:!0,hudMapPosition:"bottom-left"},g.id))})}function UN(){return o.jsx("section",{className:"min-h-0",children:o.jsx("div",{className:"surface min-h-[14rem] overflow-hidden",children:o.jsx(Mf,{defaultOrientation:"horizontal",hideLayoutToggle:!0,hideHeader:!0,panelId:"spectator-secondary"})})})}function HN({className:a=""}){return o.jsx("div",{className:`panel ${a}`,children:o.jsx(Tf,{})})}function VN(){const{session:a}=ze(),l=a?.mode==="lockdown",i=!!a?.isLocalNetwork;Vf(),fx();const r=ON(),f=Sf(),d=a?.roster??[],h=Rf(d.map(j=>j.id),{enabled:!l&&!i,version:a?.mode}),g=i?d.map(j=>({type:"rover",id:j.id,key:j.id})):[],x=Js(g,{enabled:!l&&i,version:a?.mode}),v=d.flatMap(j=>j.media?.audioPublishUrl?[{type:"rover",id:`${j.id}-audio`,key:`${j.id}-audio`}]:[]),y=Js(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]",w=r?"order-2 flex min-h-0 min-w-0 flex-1 flex-col gap-0.5 overflow-y-auto":"order-1 flex min-h-0 min-w-0 flex-col gap-0.5 md:overflow-y-auto",M=r?"order-1 grid w-full min-h-0 items-stretch gap-0.5 border-b border-slate-800/60 bg-slate-950/90 p-0.5 grid-cols-[minmax(0,1fr)_minmax(0,0.7fr)_minmax(0,1.9fr)_minmax(0,0.7fr)]":"order-2 flex min-h-0 min-w-0 flex-col gap-0.5 border-l border-slate-800/60 bg-slate-950/90 md:h-full md:overflow-y-auto",C="",N=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:M,children:[r?o.jsxs("div",{className:`${C} ${N} flex flex-col gap-0.5`,children:[o.jsx($r,{layout:"desktop",dismissable:!1,className:"text-sm"}),o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(Yr,{hideNicknameForm:!0,hideHeader:!0,compact:!0,fillHeight:!0,className:"h-full"})})]}):o.jsx("div",{className:C,children:o.jsx($r,{layout:"desktop",dismissable:!1,className:"text-sm"})}),o.jsx("div",{className:`${C} ${r?`${N} overflow-y-auto`:""}`,children:o.jsx("div",{className:"panel h-full",children:o.jsx(Pr,{title:"Rovers"})})}),r?null:o.jsx("div",{className:`${C} flex-1 min-h-0`,children:o.jsx(Yr,{hideNicknameForm:!0,hideHeader:!0,compact:!0,fillHeight:!0,className:"h-full"})}),o.jsx("div",{className:`${C} ${r?N:"flex-[1.1] min-h-0"}`,children:o.jsx(Wr,{allowSpectatorInput:!0,hideSpectatorNotice:!0,fillHeight:!0})}),o.jsx("div",{className:`${C} ${r?N:""}`,children:o.jsx(HN,{className:`${r?"h-full":"h-40"} overflow-hidden`})})]}),o.jsxs("section",{className:w,children:[o.jsx(LN,{roster:d,frames:f,videoSources:x,snapshotFeeds:h,audioSources:y,session:a,canSpectateVideo:i}),o.jsx(UN,{})]})]}),o.jsx(Nf,{})]})}function YN(){return o.jsx(Af,{children:o.jsx(VN,{})})}const $N=2e4,GN=3600*1e3;function XN({roverId:a,session:l}){const i=l?.activeDrivers?.[a]||null,f=(l?.users||[]).find(g=>g.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 QN({rover:a,frame:l}){const i=a?.batteryState?.percentDisplay;if(i!=null&&Number.isFinite(i))return Math.round(i);const r=a?.battery??null,f=l?.sensors?.batteryChargeMah??null,d=r?.Full??null,h=r?.Warn??null;if(f==null||d==null||h==null)return null;const g=d-h;if(g<=0)return null;const x=(f-h)/g;return Math.round(Math.max(0,Math.min(1,x))*100)}function KN({rover:a}){const l=a?.batteryState?.urgentActive??!1,i=a?.batteryState?.warnActive??!1;return l?"bg-red-500/40":i?"bg-amber-400/40":"bg-emerald-400/40"}function U0({rover:a,frame:l,driverLabel:i,sessionInfo:r,videoMode:f="snapshot",snapshotFeed:d,withDivider:h=!1,showPreview:g=!0,variant:x="stacked"}){const v=QN({rover:a,frame:l}),y=KN({rover:a}),S=x==="active",w=S?{height:`${v??0}%`,bottom:0,top:"auto"}:{width:`${v??0}%`},M=S?`pointer-events-none absolute bottom-0 left-0 right-0 ${y}`:`pointer-events-none absolute left-0 top-0 bottom-0 ${y}`;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("div",{className:M,style:w}),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(Dl,{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(Dl,{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(Dl,{className:"font-semibold leading-none text-white",maxSize:1e3,minSize:16,children:v==null?"--%":`${v}%`})})})]}):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(Dl,{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(Dl,{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(Dl,{className:"font-semibold leading-none text-white",maxSize:80,minSize:16,children:v==null?"--%":`${v}%`})})})]}),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:g?o.jsx("div",{className:"mt-auto w-full",children:o.jsx("div",{className:"w-full aspect-[4/3]",children:o.jsx(Is,{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 Dl({children:a,className:l="",maxSize:i=1e3,minSize:r=14}){const f=m.useRef(null),d=m.useRef(null),[h,g]=m.useState(i);return m.useLayoutEffect(()=>{const x=f.current,v=d.current;if(!x||!v)return;let y=null;const S=()=>{const C=x.clientWidth;if(!C){w();return}let N=r,j=i,q=r;for(;N<=j;){const A=Math.floor((N+j)/2);v.style.fontSize=`${A}px`,v.scrollWidth<=C?(q=A,N=A+1):j=A-1}g(q)},w=()=>{y&&cancelAnimationFrame(y),y=requestAnimationFrame(S)};w();const M=new ResizeObserver(w);return M.observe(x),()=>{y&&cancelAnimationFrame(y),M.disconnect()}},[a,i,r]),o.jsx("div",{ref:f,className:"w-full min-w-0",children:o.jsx("div",{ref:d,className:`whitespace-nowrap ${l}`,style:{fontSize:`${h}px`,lineHeight:1.1},children:a})})}function ZN(){const{session:a}=ze(),l=fx();Vf();const i=a?.mode==="lockdown",r=!!a?.isLocalNetwork,f=Sf(),d=a?.roster??[],[h,g]=m.useState(0),x=a?.activeDrivers||{},v=m.useMemo(()=>d.filter(Q=>x[Q.id]),[d,x]),y=v.length?v:d,S=Rf(y.map(Q=>Q.id),{enabled:!i&&!r,version:a?.mode}),w=m.useMemo(()=>r?y.map(Q=>({type:"rover",id:Q.id,key:Q.id})):[],[r,y]),M=Js(w,{enabled:!i&&r,version:a?.mode}),C=m.useMemo(()=>v.flatMap(Q=>{if(!Q?.id||!Q.media?.audioPublishUrl)return[];const z=String(Q.id);return[{type:"rover",id:`${z}-audio`,key:`${z}-audio`}]}),[v]),N=Js(C,{enabled:!i,version:a?.mode}),j=m.useMemo(()=>{if(!v.length)return[];if(!r){const z=v.filter(K=>S[K.id]?.objectUrl);return z.length?z:v}const Q=v.filter(z=>{const K=M[z.id];return K?.url&&!K?.error});return Q.length?Q:v},[v,S,M,r]),q=m.useMemo(()=>j.map(Q=>({type:"rover",rover:Q})),[j]),A=m.useMemo(()=>q.map(Q=>`r:${Q.rover.id}`).join("|"),[q]);m.useEffect(()=>{g(0)},[A]),m.useEffect(()=>{if(!q.length)return;const Q=setInterval(()=>{g(z=>(z+1)%q.length)},$N);return()=>clearInterval(Q)},[q.length,A]);const k=q.length?q[h%q.length]:null,B=k?.type==="rover"?k.rover:null,L=!r&&B&&S[B.id]||null,Z=r&&B&&M[B.id]||null,O=B&&N[`${B.id}-audio`]||null,X=B&&f[B.id]||null,$=B?XN({roverId:B.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?B?o.jsx(JN,{children:r?o.jsx("div",{className:"relative h-full w-full",children:q.map(Q=>{const z=Q.rover,K=B?.id===z.id;return o.jsx("div",{className:`absolute inset-0 ${K?"opacity-100":"opacity-0 pointer-events-none"}`,children:o.jsx(Is,{sessionInfo:M[z.id]||null,videoMode:"whep",snapshotFeed:null,audioSessionInfo:K?O:null,forceMute:!K,label:z.name||z.id,telemetryFrame:f[z.id]||null,batteryConfig:z.battery,layoutFormat:"mobile",hudVariant:"none",fitParent:!0})},z.id)})}):o.jsx(Is,{sessionInfo:null,videoMode:"snapshot",snapshotFeed:L,audioSessionInfo:O,label:B.name||B.id,telemetryFrame:X,batteryConfig:B.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:B?o.jsx(U0,{rover:B,frame:X,driverLabel:$,sessionInfo:r?Z:null,videoMode:r?"whep":"snapshot",snapshotFeed:r?null:S[B.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,z)=>o.jsx(U0,{rover:Q,frame:f[Q.id]||null,driverLabel:null,sessionInfo:r&&M[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 FN(){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())},GN);return()=>clearTimeout(a)},[]),o.jsx(Af,{children:o.jsxs(o.Fragment,{children:[o.jsx(ZN,{}),o.jsx(Nf,{scale:3})]})})}function JN({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})})})}Oy.createRoot(document.getElementById("root")).render(o.jsx(m.StrictMode,{children:o.jsx(lS,{children:o.jsx(iS,{children:o.jsx(rS,{children:o.jsx(eA,{children:o.jsx(Jb,{children:o.jsxs(Eb,{children:[o.jsx(Er,{path:"/",element:o.jsx(_N,{})}),o.jsx(Er,{path:"/spectate",element:o.jsx(YN,{})}),o.jsx(Er,{path:"/mini",element:o.jsx(FN,{})})]})})})})})})}));
|