mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 01:21:20 -04:00
120 lines
461 KiB
JavaScript
120 lines
461 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 m of d.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&r(m)}).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 xv(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var ou={exports:{}},Ts={};var kp;function yv(){if(kp)return Ts;kp=1;var a=Symbol.for("react.transitional.element"),l=Symbol.for("react.fragment");function i(r,f,d){var m=null;if(d!==void 0&&(m=""+d),f.key!==void 0&&(m=""+f.key),"key"in f){d={};for(var x in f)x!=="key"&&(d[x]=f[x])}else d=f;return f=d.ref,{$$typeof:a,type:r,key:m,ref:f!==void 0?f:null,props:d}}return Ts.Fragment=l,Ts.jsx=i,Ts.jsxs=i,Ts}var _p;function vv(){return _p||(_p=1,ou.exports=yv()),ou.exports}var o=vv(),cu={exports:{}},pe={};var Dp;function bv(){if(Dp)return pe;Dp=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"),m=Symbol.for("react.context"),x=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),y=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),S=Symbol.for("react.activity"),N=Symbol.iterator;function M(E){return E===null||typeof E!="object"?null:(E=N&&E[N]||E["@@iterator"],typeof E=="function"?E:null)}var j={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,A={};function q(E,O,K){this.props=E,this.context=O,this.refs=A,this.updater=K||j}q.prototype.isReactComponent={},q.prototype.setState=function(E,O){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,O,"setState")},q.prototype.forceUpdate=function(E){this.updater.enqueueForceUpdate(this,E,"forceUpdate")};function w(){}w.prototype=q.prototype;function k(E,O,K){this.props=E,this.context=O,this.refs=A,this.updater=K||j}var Y=k.prototype=new w;Y.constructor=k,C(Y,q.prototype),Y.isPureReactComponent=!0;var L=Array.isArray;function U(){}var B={H:null,A:null,T:null,S:null},P=Object.prototype.hasOwnProperty;function G(E,O,K){var _=K.ref;return{$$typeof:a,type:E,key:O,ref:_!==void 0?_:null,props:K}}function ne(E,O){return G(E.type,O,E.props)}function Q(E){return typeof E=="object"&&E!==null&&E.$$typeof===a}function W(E){var O={"=":"=0",":":"=2"};return"$"+E.replace(/[=:]/g,function(K){return O[K]})}var se=/\/+/g;function ue(E,O){return typeof E=="object"&&E!==null&&E.key!=null?W(""+E.key):O.toString(36)}function le(E){switch(E.status){case"fulfilled":return E.value;case"rejected":throw E.reason;default:switch(typeof E.status=="string"?E.then(U,U):(E.status="pending",E.then(function(O){E.status==="pending"&&(E.status="fulfilled",E.value=O)},function(O){E.status==="pending"&&(E.status="rejected",E.reason=O)})),E.status){case"fulfilled":return E.value;case"rejected":throw E.reason}}throw E}function z(E,O,K,_,F){var te=typeof E;(te==="undefined"||te==="boolean")&&(E=null);var ie=!1;if(E===null)ie=!0;else switch(te){case"bigint":case"string":case"number":ie=!0;break;case"object":switch(E.$$typeof){case a:case l:ie=!0;break;case b:return ie=E._init,z(ie(E._payload),O,K,_,F)}}if(ie)return F=F(E),ie=_===""?"."+ue(E,0):_,L(F)?(K="",ie!=null&&(K=ie.replace(se,"$&/")+"/"),z(F,O,K,"",function(St){return St})):F!=null&&(Q(F)&&(F=ne(F,K+(F.key==null||E&&E.key===F.key?"":(""+F.key).replace(se,"$&/")+"/")+ie)),O.push(F)),1;ie=0;var Ne=_===""?".":_+":";if(L(E))for(var me=0;me<E.length;me++)_=E[me],te=Ne+ue(_,me),ie+=z(_,O,K,te,F);else if(me=M(E),typeof me=="function")for(E=me.call(E),me=0;!(_=E.next()).done;)_=_.value,te=Ne+ue(_,me++),ie+=z(_,O,K,te,F);else if(te==="object"){if(typeof E.then=="function")return z(le(E),O,K,_,F);throw O=String(E),Error("Objects are not valid as a React child (found: "+(O==="[object Object]"?"object with keys {"+Object.keys(E).join(", ")+"}":O)+"). If you meant to render a collection of children, use an array instead.")}return ie}function ee(E,O,K){if(E==null)return E;var _=[],F=0;return z(E,_,"","",function(te){return O.call(K,te,F++)}),_}function ae(E){if(E._status===-1){var O=E._result;O=O(),O.then(function(K){(E._status===0||E._status===-1)&&(E._status=1,E._result=K)},function(K){(E._status===0||E._status===-1)&&(E._status=2,E._result=K)}),E._status===-1&&(E._status=0,E._result=O)}if(E._status===1)return E._result.default;throw E._result}var ce=typeof reportError=="function"?reportError:function(E){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var O=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(O))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",E);return}console.error(E)},he={map:ee,forEach:function(E,O,K){ee(E,function(){O.apply(this,arguments)},K)},count:function(E){var O=0;return ee(E,function(){O++}),O},toArray:function(E){return ee(E,function(O){return O})||[]},only:function(E){if(!Q(E))throw Error("React.Children.only expected to receive a single React element child.");return E}};return pe.Activity=S,pe.Children=he,pe.Component=q,pe.Fragment=i,pe.Profiler=f,pe.PureComponent=k,pe.StrictMode=r,pe.Suspense=p,pe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=B,pe.__COMPILER_RUNTIME={__proto__:null,c:function(E){return B.H.useMemoCache(E)}},pe.cache=function(E){return function(){return E.apply(null,arguments)}},pe.cacheSignal=function(){return null},pe.cloneElement=function(E,O,K){if(E==null)throw Error("The argument must be a React element, but you passed "+E+".");var _=C({},E.props),F=E.key;if(O!=null)for(te in O.key!==void 0&&(F=""+O.key),O)!P.call(O,te)||te==="key"||te==="__self"||te==="__source"||te==="ref"&&O.ref===void 0||(_[te]=O[te]);var te=arguments.length-2;if(te===1)_.children=K;else if(1<te){for(var ie=Array(te),Ne=0;Ne<te;Ne++)ie[Ne]=arguments[Ne+2];_.children=ie}return G(E.type,F,_)},pe.createContext=function(E){return E={$$typeof:m,_currentValue:E,_currentValue2:E,_threadCount:0,Provider:null,Consumer:null},E.Provider=E,E.Consumer={$$typeof:d,_context:E},E},pe.createElement=function(E,O,K){var _,F={},te=null;if(O!=null)for(_ in O.key!==void 0&&(te=""+O.key),O)P.call(O,_)&&_!=="key"&&_!=="__self"&&_!=="__source"&&(F[_]=O[_]);var ie=arguments.length-2;if(ie===1)F.children=K;else if(1<ie){for(var Ne=Array(ie),me=0;me<ie;me++)Ne[me]=arguments[me+2];F.children=Ne}if(E&&E.defaultProps)for(_ in ie=E.defaultProps,ie)F[_]===void 0&&(F[_]=ie[_]);return G(E,te,F)},pe.createRef=function(){return{current:null}},pe.forwardRef=function(E){return{$$typeof:x,render:E}},pe.isValidElement=Q,pe.lazy=function(E){return{$$typeof:b,_payload:{_status:-1,_result:E},_init:ae}},pe.memo=function(E,O){return{$$typeof:y,type:E,compare:O===void 0?null:O}},pe.startTransition=function(E){var O=B.T,K={};B.T=K;try{var _=E(),F=B.S;F!==null&&F(K,_),typeof _=="object"&&_!==null&&typeof _.then=="function"&&_.then(U,ce)}catch(te){ce(te)}finally{O!==null&&K.types!==null&&(O.types=K.types),B.T=O}},pe.unstable_useCacheRefresh=function(){return B.H.useCacheRefresh()},pe.use=function(E){return B.H.use(E)},pe.useActionState=function(E,O,K){return B.H.useActionState(E,O,K)},pe.useCallback=function(E,O){return B.H.useCallback(E,O)},pe.useContext=function(E){return B.H.useContext(E)},pe.useDebugValue=function(){},pe.useDeferredValue=function(E,O){return B.H.useDeferredValue(E,O)},pe.useEffect=function(E,O){return B.H.useEffect(E,O)},pe.useEffectEvent=function(E){return B.H.useEffectEvent(E)},pe.useId=function(){return B.H.useId()},pe.useImperativeHandle=function(E,O,K){return B.H.useImperativeHandle(E,O,K)},pe.useInsertionEffect=function(E,O){return B.H.useInsertionEffect(E,O)},pe.useLayoutEffect=function(E,O){return B.H.useLayoutEffect(E,O)},pe.useMemo=function(E,O){return B.H.useMemo(E,O)},pe.useOptimistic=function(E,O){return B.H.useOptimistic(E,O)},pe.useReducer=function(E,O,K){return B.H.useReducer(E,O,K)},pe.useRef=function(E){return B.H.useRef(E)},pe.useState=function(E){return B.H.useState(E)},pe.useSyncExternalStore=function(E,O,K){return B.H.useSyncExternalStore(E,O,K)},pe.useTransition=function(){return B.H.useTransition()},pe.version="19.2.0",pe}var Op;function ef(){return Op||(Op=1,cu.exports=bv()),cu.exports}var h=ef();const Ra=xv(h);var uu={exports:{}},Rs={},fu={exports:{}},du={};var Bp;function Sv(){return Bp||(Bp=1,(function(a){function l(z,ee){var ae=z.length;z.push(ee);e:for(;0<ae;){var ce=ae-1>>>1,he=z[ce];if(0<f(he,ee))z[ce]=ee,z[ae]=he,ae=ce;else break e}}function i(z){return z.length===0?null:z[0]}function r(z){if(z.length===0)return null;var ee=z[0],ae=z.pop();if(ae!==ee){z[0]=ae;e:for(var ce=0,he=z.length,E=he>>>1;ce<E;){var O=2*(ce+1)-1,K=z[O],_=O+1,F=z[_];if(0>f(K,ae))_<he&&0>f(F,K)?(z[ce]=F,z[_]=ae,ce=_):(z[ce]=K,z[O]=ae,ce=O);else if(_<he&&0>f(F,ae))z[ce]=F,z[_]=ae,ce=_;else break e}}return ee}function f(z,ee){var ae=z.sortIndex-ee.sortIndex;return ae!==0?ae:z.id-ee.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 m=Date,x=m.now();a.unstable_now=function(){return m.now()-x}}var p=[],y=[],b=1,S=null,N=3,M=!1,j=!1,C=!1,A=!1,q=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function Y(z){for(var ee=i(y);ee!==null;){if(ee.callback===null)r(y);else if(ee.startTime<=z)r(y),ee.sortIndex=ee.expirationTime,l(p,ee);else break;ee=i(y)}}function L(z){if(C=!1,Y(z),!j)if(i(p)!==null)j=!0,U||(U=!0,W());else{var ee=i(y);ee!==null&&le(L,ee.startTime-z)}}var U=!1,B=-1,P=5,G=-1;function ne(){return A?!0:!(a.unstable_now()-G<P)}function Q(){if(A=!1,U){var z=a.unstable_now();G=z;var ee=!0;try{e:{j=!1,C&&(C=!1,w(B),B=-1),M=!0;var ae=N;try{t:{for(Y(z),S=i(p);S!==null&&!(S.expirationTime>z&&ne());){var ce=S.callback;if(typeof ce=="function"){S.callback=null,N=S.priorityLevel;var he=ce(S.expirationTime<=z);if(z=a.unstable_now(),typeof he=="function"){S.callback=he,Y(z),ee=!0;break t}S===i(p)&&r(p),Y(z)}else r(p);S=i(p)}if(S!==null)ee=!0;else{var E=i(y);E!==null&&le(L,E.startTime-z),ee=!1}}break e}finally{S=null,N=ae,M=!1}ee=void 0}}finally{ee?W():U=!1}}}var W;if(typeof k=="function")W=function(){k(Q)};else if(typeof MessageChannel<"u"){var se=new MessageChannel,ue=se.port2;se.port1.onmessage=Q,W=function(){ue.postMessage(null)}}else W=function(){q(Q,0)};function le(z,ee){B=q(function(){z(a.unstable_now())},ee)}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(z){z.callback=null},a.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<z?Math.floor(1e3/z):5},a.unstable_getCurrentPriorityLevel=function(){return N},a.unstable_next=function(z){switch(N){case 1:case 2:case 3:var ee=3;break;default:ee=N}var ae=N;N=ee;try{return z()}finally{N=ae}},a.unstable_requestPaint=function(){A=!0},a.unstable_runWithPriority=function(z,ee){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var ae=N;N=z;try{return ee()}finally{N=ae}},a.unstable_scheduleCallback=function(z,ee,ae){var ce=a.unstable_now();switch(typeof ae=="object"&&ae!==null?(ae=ae.delay,ae=typeof ae=="number"&&0<ae?ce+ae:ce):ae=ce,z){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=ae+he,z={id:b++,callback:ee,priorityLevel:z,startTime:ae,expirationTime:he,sortIndex:-1},ae>ce?(z.sortIndex=ae,l(y,z),i(p)===null&&z===i(y)&&(C?(w(B),B=-1):C=!0,le(L,ae-ce))):(z.sortIndex=he,l(p,z),j||M||(j=!0,U||(U=!0,W()))),z},a.unstable_shouldYield=ne,a.unstable_wrapCallback=function(z){var ee=N;return function(){var ae=N;N=ee;try{return z.apply(this,arguments)}finally{N=ae}}}})(du)),du}var zp;function Av(){return zp||(zp=1,fu.exports=Sv()),fu.exports}var hu={exports:{}},ut={};var Lp;function jv(){if(Lp)return ut;Lp=1;var a=ef();function l(p){var y="https://react.dev/errors/"+p;if(1<arguments.length){y+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)y+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+p+"; visit "+y+" 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(p,y,b){var S=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:f,key:S==null?null:""+S,children:p,containerInfo:y,implementation:b}}var m=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function x(p,y){if(p==="font")return"";if(typeof y=="string")return y==="use-credentials"?y:""}return ut.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,ut.createPortal=function(p,y){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!y||y.nodeType!==1&&y.nodeType!==9&&y.nodeType!==11)throw Error(l(299));return d(p,y,null,b)},ut.flushSync=function(p){var y=m.T,b=r.p;try{if(m.T=null,r.p=2,p)return p()}finally{m.T=y,r.p=b,r.d.f()}},ut.preconnect=function(p,y){typeof p=="string"&&(y?(y=y.crossOrigin,y=typeof y=="string"?y==="use-credentials"?y:"":void 0):y=null,r.d.C(p,y))},ut.prefetchDNS=function(p){typeof p=="string"&&r.d.D(p)},ut.preinit=function(p,y){if(typeof p=="string"&&y&&typeof y.as=="string"){var b=y.as,S=x(b,y.crossOrigin),N=typeof y.integrity=="string"?y.integrity:void 0,M=typeof y.fetchPriority=="string"?y.fetchPriority:void 0;b==="style"?r.d.S(p,typeof y.precedence=="string"?y.precedence:void 0,{crossOrigin:S,integrity:N,fetchPriority:M}):b==="script"&&r.d.X(p,{crossOrigin:S,integrity:N,fetchPriority:M,nonce:typeof y.nonce=="string"?y.nonce:void 0})}},ut.preinitModule=function(p,y){if(typeof p=="string")if(typeof y=="object"&&y!==null){if(y.as==null||y.as==="script"){var b=x(y.as,y.crossOrigin);r.d.M(p,{crossOrigin:b,integrity:typeof y.integrity=="string"?y.integrity:void 0,nonce:typeof y.nonce=="string"?y.nonce:void 0})}}else y==null&&r.d.M(p)},ut.preload=function(p,y){if(typeof p=="string"&&typeof y=="object"&&y!==null&&typeof y.as=="string"){var b=y.as,S=x(b,y.crossOrigin);r.d.L(p,b,{crossOrigin:S,integrity:typeof y.integrity=="string"?y.integrity:void 0,nonce:typeof y.nonce=="string"?y.nonce:void 0,type:typeof y.type=="string"?y.type:void 0,fetchPriority:typeof y.fetchPriority=="string"?y.fetchPriority:void 0,referrerPolicy:typeof y.referrerPolicy=="string"?y.referrerPolicy:void 0,imageSrcSet:typeof y.imageSrcSet=="string"?y.imageSrcSet:void 0,imageSizes:typeof y.imageSizes=="string"?y.imageSizes:void 0,media:typeof y.media=="string"?y.media:void 0})}},ut.preloadModule=function(p,y){if(typeof p=="string")if(y){var b=x(y.as,y.crossOrigin);r.d.m(p,{as:typeof y.as=="string"&&y.as!=="script"?y.as:void 0,crossOrigin:b,integrity:typeof y.integrity=="string"?y.integrity:void 0})}else r.d.m(p)},ut.requestFormReset=function(p){r.d.r(p)},ut.unstable_batchedUpdates=function(p,y){return p(y)},ut.useFormState=function(p,y,b){return m.H.useFormState(p,y,b)},ut.useFormStatus=function(){return m.H.useHostTransitionStatus()},ut.version="19.2.0",ut}var Up;function Nv(){if(Up)return hu.exports;Up=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(),hu.exports=jv(),hu.exports}var Hp;function wv(){if(Hp)return Rs;Hp=1;var a=Av(),l=ef(),i=Nv();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 m(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 x(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 p(e){if(d(e)!==e)throw Error(r(188))}function y(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 p(c),e;if(u===s)return p(c),t;u=u.sibling}throw Error(r(188))}if(n.return!==s.return)n=c,s=u;else{for(var g=!1,v=c.child;v;){if(v===n){g=!0,n=c,s=u;break}if(v===s){g=!0,s=c,n=u;break}v=v.sibling}if(!g){for(v=u.child;v;){if(v===n){g=!0,n=u,s=c;break}if(v===s){g=!0,s=u,n=c;break}v=v.sibling}if(!g)throw Error(r(189))}}if(n.alternate!==s)throw Error(r(190))}if(n.tag!==3)throw Error(r(188));return n.stateNode.current===n?e:t}function b(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=b(e),t!==null)return t;e=e.sibling}return null}var S=Object.assign,N=Symbol.for("react.element"),M=Symbol.for("react.transitional.element"),j=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),q=Symbol.for("react.profiler"),w=Symbol.for("react.consumer"),k=Symbol.for("react.context"),Y=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),U=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),G=Symbol.for("react.activity"),ne=Symbol.for("react.memo_cache_sentinel"),Q=Symbol.iterator;function W(e){return e===null||typeof e!="object"?null:(e=Q&&e[Q]||e["@@iterator"],typeof e=="function"?e:null)}var se=Symbol.for("react.client.reference");function ue(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===se?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case C:return"Fragment";case q:return"Profiler";case A:return"StrictMode";case L:return"Suspense";case U:return"SuspenseList";case G:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case j:return"Portal";case k:return e.displayName||"Context";case w:return(e._context.displayName||"Context")+".Consumer";case Y:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case B:return t=e.displayName||null,t!==null?t:ue(e.type)||"Memo";case P:t=e._payload,e=e._init;try{return ue(e(t))}catch{}}return null}var le=Array.isArray,z=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae={pending:!1,data:null,method:null,action:null},ce=[],he=-1;function E(e){return{current:e}}function O(e){0>he||(e.current=ce[he],ce[he]=null,he--)}function K(e,t){he++,ce[he]=e.current,e.current=t}var _=E(null),F=E(null),te=E(null),ie=E(null);function Ne(e,t){switch(K(te,t),K(F,e),K(_,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?tp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=tp(t),e=np(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}O(_),K(_,e)}function me(){O(_),O(F),O(te)}function St(e){e.memoizedState!==null&&K(ie,e);var t=_.current,n=np(t,e.type);t!==n&&(K(F,e),K(_,n))}function _a(e){F.current===e&&(O(_),O(F)),ie.current===e&&(O(ie),Es._currentValue=ae)}var Dl,sa;function Mt(e){if(Dl===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Dl=t&&t[1]||"",sa=-1<n.stack.indexOf(`
|
||
at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
|
||
`+Dl+e+sa}var ia=!1;function Tt(e,t){if(!e||ia)return"";ia=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(t){var I=function(){throw Error()};if(Object.defineProperty(I.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(I,[])}catch(X){var $=X}Reflect.construct(e,[],I)}else{try{I.call()}catch(X){$=X}e.call(I.prototype)}}else{try{throw Error()}catch(X){$=X}(I=e())&&typeof I.catch=="function"&&I.catch(function(){})}}catch(X){if(X&&$&&typeof X.stack=="string")return[X.stack,$.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var c=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");c&&c.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var u=s.DetermineComponentFrameRoot(),g=u[0],v=u[1];if(g&&v){var T=g.split(`
|
||
`),V=v.split(`
|
||
`);for(c=s=0;s<T.length&&!T[s].includes("DetermineComponentFrameRoot");)s++;for(;c<V.length&&!V[c].includes("DetermineComponentFrameRoot");)c++;if(s===T.length||c===V.length)for(s=T.length-1,c=V.length-1;1<=s&&0<=c&&T[s]!==V[c];)c--;for(;1<=s&&0<=c;s--,c--)if(T[s]!==V[c]){if(s!==1||c!==1)do if(s--,c--,0>c||T[s]!==V[c]){var Z=`
|
||
`+T[s].replace(" at new "," at ");return e.displayName&&Z.includes("<anonymous>")&&(Z=Z.replace("<anonymous>",e.displayName)),Z}while(1<=s&&0<=c);break}}}finally{ia=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Mt(n):""}function Js(e,t){switch(e.tag){case 26:case 27:case 5:return Mt(e.type);case 16:return Mt("Lazy");case 13:return e.child!==t&&t!==null?Mt("Suspense Fallback"):Mt("Suspense");case 19:return Mt("SuspenseList");case 0:case 15:return Tt(e.type,!1);case 11:return Tt(e.type.render,!1);case 1:return Tt(e.type,!0);case 31:return Mt("Activity");default:return""}}function Da(e){try{var t="",n=null;do t+=Js(e,n),n=e,e=e.return;while(e);return t}catch(s){return`
|
||
Error generating stack: `+s.message+`
|
||
`+s.stack}}var Ol=Object.prototype.hasOwnProperty,ra=a.unstable_scheduleCallback,sn=a.unstable_cancelCallback,Oa=a.unstable_shouldYield,Bl=a.unstable_requestPaint,tt=a.unstable_now,zl=a.unstable_getCurrentPriorityLevel,oa=a.unstable_ImmediatePriority,Ll=a.unstable_UserBlockingPriority,Ba=a.unstable_NormalPriority,Kr=a.unstable_LowPriority,Is=a.unstable_IdlePriority,Ws=a.log,we=a.unstable_setDisableYieldValue,Qe=null,Le=null;function Ee(e){if(typeof Ws=="function"&&we(e),Le&&typeof Le.setStrictMode=="function")try{Le.setStrictMode(Qe,e)}catch{}}var Ce=Math.clz32?Math.clz32:ax,Ue=Math.log,Zr=Math.LN2;function ax(e){return e>>>=0,e===0?32:31-(Ue(e)/Zr|0)|0}var Ps=256,ei=262144,ti=4194304;function ca(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 ni(e,t,n){var s=e.pendingLanes;if(s===0)return 0;var c=0,u=e.suspendedLanes,g=e.pingedLanes;e=e.warmLanes;var v=s&134217727;return v!==0?(s=v&~u,s!==0?c=ca(s):(g&=v,g!==0?c=ca(g):n||(n=v&~e,n!==0&&(c=ca(n))))):(v=s&~u,v!==0?c=ca(v):g!==0?c=ca(g):n||(n=s&~e,n!==0&&(c=ca(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 Ul(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function lx(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 Bf(){var e=ti;return ti<<=1,(ti&62914560)===0&&(ti=4194304),e}function Fr(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Hl(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function sx(e,t,n,s,c,u){var g=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var v=e.entanglements,T=e.expirationTimes,V=e.hiddenUpdates;for(n=g&~n;0<n;){var Z=31-Ce(n),I=1<<Z;v[Z]=0,T[Z]=-1;var $=V[Z];if($!==null)for(V[Z]=null,Z=0;Z<$.length;Z++){var X=$[Z];X!==null&&(X.lane&=-536870913)}n&=~I}s!==0&&zf(e,s,0),u!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=u&~(g&~t))}function zf(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-Ce(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|n&261930}function Lf(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var s=31-Ce(n),c=1<<s;c&t|e[s]&t&&(e[s]|=t),n&=~c}}function Uf(e,t){var n=t&-t;return n=(n&42)!==0?1:Jr(n),(n&(e.suspendedLanes|t))!==0?0:n}function Jr(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 Ir(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Hf(){var e=ee.p;return e!==0?e:(e=window.event,e===void 0?32:wp(e.type))}function Vf(e,t){var n=ee.p;try{return ee.p=e,t()}finally{ee.p=n}}var _n=Math.random().toString(36).slice(2),st="__reactFiber$"+_n,mt="__reactProps$"+_n,za="__reactContainer$"+_n,Wr="__reactEvents$"+_n,ix="__reactListeners$"+_n,rx="__reactHandles$"+_n,Yf="__reactResources$"+_n,Vl="__reactMarker$"+_n;function Pr(e){delete e[st],delete e[mt],delete e[Wr],delete e[ix],delete e[rx]}function La(e){var t=e[st];if(t)return t;for(var n=e.parentNode;n;){if(t=n[za]||n[st]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=cp(e);e!==null;){if(n=e[st])return n;e=cp(e)}return t}e=n,n=e.parentNode}return null}function Ua(e){if(e=e[st]||e[za]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Yl(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(r(33))}function Ha(e){var t=e[Yf];return t||(t=e[Yf]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function at(e){e[Vl]=!0}var $f=new Set,Gf={};function ua(e,t){Va(e,t),Va(e+"Capture",t)}function Va(e,t){for(Gf[e]=t,e=0;e<t.length;e++)$f.add(t[e])}var ox=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]*$"),Xf={},Qf={};function cx(e){return Ol.call(Qf,e)?!0:Ol.call(Xf,e)?!1:ox.test(e)?Qf[e]=!0:(Xf[e]=!0,!1)}function ai(e,t,n){if(cx(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 li(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 rn(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 Rt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Kf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ux(e,t,n){var s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var c=s.get,u=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(g){n=""+g,u.call(this,g)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return n},setValue:function(g){n=""+g},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function eo(e){if(!e._valueTracker){var t=Kf(e)?"checked":"value";e._valueTracker=ux(e,t,""+e[t])}}function Zf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=Kf(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}function si(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 fx=/[\n"\\]/g;function kt(e){return e.replace(fx,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function to(e,t,n,s,c,u,g,v){e.name="",g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"?e.type=g:e.removeAttribute("type"),t!=null?g==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Rt(t)):e.value!==""+Rt(t)&&(e.value=""+Rt(t)):g!=="submit"&&g!=="reset"||e.removeAttribute("value"),t!=null?no(e,g,Rt(t)):n!=null?no(e,g,Rt(n)):s!=null&&e.removeAttribute("value"),c==null&&u!=null&&(e.defaultChecked=!!u),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?e.name=""+Rt(v):e.removeAttribute("name")}function Ff(e,t,n,s,c,u,g,v){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)){eo(e);return}n=n!=null?""+Rt(n):"",t=t!=null?""+Rt(t):n,v||t===e.value||(e.value=t),e.defaultValue=t}s=s??c,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=v?e.checked:!!s,e.defaultChecked=!!s,g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(e.name=g),eo(e)}function no(e,t,n){t==="number"&&si(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Ya(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=""+Rt(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 Jf(e,t,n){if(t!=null&&(t=""+Rt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Rt(n):""}function If(e,t,n,s){if(t==null){if(s!=null){if(n!=null)throw Error(r(92));if(le(s)){if(1<s.length)throw Error(r(93));s=s[0]}n=s}n==null&&(n=""),t=n}n=Rt(t),e.defaultValue=n,s=e.textContent,s===n&&s!==""&&s!==null&&(e.value=s),eo(e)}function $a(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var dx=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 Wf(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||dx.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function Pf(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&&Wf(e,c,s)}else for(var u in t)t.hasOwnProperty(u)&&Wf(e,u,t[u])}function ao(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 hx=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"]]),mx=/^[\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 ii(e){return mx.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function on(){}var lo=null;function so(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ga=null,Xa=null;function ed(e){var t=Ua(e);if(t&&(e=t.stateNode)){var n=e[mt]||null;e:switch(e=t.stateNode,t.type){case"input":if(to(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="'+kt(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var s=n[t];if(s!==e&&s.form===e.form){var c=s[mt]||null;if(!c)throw Error(r(90));to(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&&Zf(s)}break e;case"textarea":Jf(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Ya(e,!!n.multiple,t,!1)}}}var io=!1;function td(e,t,n){if(io)return e(t,n);io=!0;try{var s=e(t);return s}finally{if(io=!1,(Ga!==null||Xa!==null)&&(Ki(),Ga&&(t=Ga,e=Xa,Xa=Ga=null,ed(t),e)))for(t=0;t<e.length;t++)ed(e[t])}}function $l(e,t){var n=e.stateNode;if(n===null)return null;var s=n[mt]||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 cn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ro=!1;if(cn)try{var Gl={};Object.defineProperty(Gl,"passive",{get:function(){ro=!0}}),window.addEventListener("test",Gl,Gl),window.removeEventListener("test",Gl,Gl)}catch{ro=!1}var Dn=null,oo=null,ri=null;function nd(){if(ri)return ri;var e,t=oo,n=t.length,s,c="value"in Dn?Dn.value:Dn.textContent,u=c.length;for(e=0;e<n&&t[e]===c[e];e++);var g=n-e;for(s=1;s<=g&&t[n-s]===c[u-s];s++);return ri=c.slice(e,1<s?1-s:void 0)}function oi(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function ci(){return!0}function ad(){return!1}function pt(e){function t(n,s,c,u,g){this._reactName=n,this._targetInst=c,this.type=s,this.nativeEvent=u,this.target=g,this.currentTarget=null;for(var v in e)e.hasOwnProperty(v)&&(n=e[v],this[v]=n?n(u):u[v]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?ci:ad,this.isPropagationStopped=ad,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=ci)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=ci)},persist:function(){},isPersistent:ci}),t}var fa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ui=pt(fa),Xl=S({},fa,{view:0,detail:0}),px=pt(Xl),co,uo,Ql,fi=S({},Xl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ho,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!==Ql&&(Ql&&e.type==="mousemove"?(co=e.screenX-Ql.screenX,uo=e.screenY-Ql.screenY):uo=co=0,Ql=e),co)},movementY:function(e){return"movementY"in e?e.movementY:uo}}),ld=pt(fi),gx=S({},fi,{dataTransfer:0}),xx=pt(gx),yx=S({},Xl,{relatedTarget:0}),fo=pt(yx),vx=S({},fa,{animationName:0,elapsedTime:0,pseudoElement:0}),bx=pt(vx),Sx=S({},fa,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Ax=pt(Sx),jx=S({},fa,{data:0}),sd=pt(jx),Nx={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},wx={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"},Ex={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Cx(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Ex[e])?!!t[e]:!1}function ho(){return Cx}var qx=S({},Xl,{key:function(e){if(e.key){var t=Nx[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=oi(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?wx[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ho,charCode:function(e){return e.type==="keypress"?oi(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?oi(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Mx=pt(qx),Tx=S({},fi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),id=pt(Tx),Rx=S({},Xl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ho}),kx=pt(Rx),_x=S({},fa,{propertyName:0,elapsedTime:0,pseudoElement:0}),Dx=pt(_x),Ox=S({},fi,{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}),Bx=pt(Ox),zx=S({},fa,{newState:0,oldState:0}),Lx=pt(zx),Ux=[9,13,27,32],mo=cn&&"CompositionEvent"in window,Kl=null;cn&&"documentMode"in document&&(Kl=document.documentMode);var Hx=cn&&"TextEvent"in window&&!Kl,rd=cn&&(!mo||Kl&&8<Kl&&11>=Kl),od=" ",cd=!1;function ud(e,t){switch(e){case"keyup":return Ux.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function fd(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Qa=!1;function Vx(e,t){switch(e){case"compositionend":return fd(t);case"keypress":return t.which!==32?null:(cd=!0,od);case"textInput":return e=t.data,e===od&&cd?null:e;default:return null}}function Yx(e,t){if(Qa)return e==="compositionend"||!mo&&ud(e,t)?(e=nd(),ri=oo=Dn=null,Qa=!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 rd&&t.locale!=="ko"?null:t.data;default:return null}}var $x={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 dd(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!$x[e.type]:t==="textarea"}function hd(e,t,n,s){Ga?Xa?Xa.push(s):Xa=[s]:Ga=s,t=er(t,"onChange"),0<t.length&&(n=new ui("onChange","change",null,n,s),e.push({event:n,listeners:t}))}var Zl=null,Fl=null;function Gx(e){Fm(e,0)}function di(e){var t=Yl(e);if(Zf(t))return e}function md(e,t){if(e==="change")return t}var pd=!1;if(cn){var po;if(cn){var go="oninput"in document;if(!go){var gd=document.createElement("div");gd.setAttribute("oninput","return;"),go=typeof gd.oninput=="function"}po=go}else po=!1;pd=po&&(!document.documentMode||9<document.documentMode)}function xd(){Zl&&(Zl.detachEvent("onpropertychange",yd),Fl=Zl=null)}function yd(e){if(e.propertyName==="value"&&di(Fl)){var t=[];hd(t,Fl,e,so(e)),td(Gx,t)}}function Xx(e,t,n){e==="focusin"?(xd(),Zl=t,Fl=n,Zl.attachEvent("onpropertychange",yd)):e==="focusout"&&xd()}function Qx(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return di(Fl)}function Kx(e,t){if(e==="click")return di(t)}function Zx(e,t){if(e==="input"||e==="change")return di(t)}function Fx(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var At=typeof Object.is=="function"?Object.is:Fx;function Jl(e,t){if(At(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(!Ol.call(t,c)||!At(e[c],t[c]))return!1}return!0}function vd(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function bd(e,t){var n=vd(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=vd(n)}}function Sd(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Sd(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ad(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=si(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=si(e.document)}return t}function xo(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 Jx=cn&&"documentMode"in document&&11>=document.documentMode,Ka=null,yo=null,Il=null,vo=!1;function jd(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;vo||Ka==null||Ka!==si(s)||(s=Ka,"selectionStart"in s&&xo(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}),Il&&Jl(Il,s)||(Il=s,s=er(yo,"onSelect"),0<s.length&&(t=new ui("onSelect","select",null,t,n),e.push({event:t,listeners:s}),t.target=Ka)))}function da(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Za={animationend:da("Animation","AnimationEnd"),animationiteration:da("Animation","AnimationIteration"),animationstart:da("Animation","AnimationStart"),transitionrun:da("Transition","TransitionRun"),transitionstart:da("Transition","TransitionStart"),transitioncancel:da("Transition","TransitionCancel"),transitionend:da("Transition","TransitionEnd")},bo={},Nd={};cn&&(Nd=document.createElement("div").style,"AnimationEvent"in window||(delete Za.animationend.animation,delete Za.animationiteration.animation,delete Za.animationstart.animation),"TransitionEvent"in window||delete Za.transitionend.transition);function ha(e){if(bo[e])return bo[e];if(!Za[e])return e;var t=Za[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Nd)return bo[e]=t[n];return e}var wd=ha("animationend"),Ed=ha("animationiteration"),Cd=ha("animationstart"),Ix=ha("transitionrun"),Wx=ha("transitionstart"),Px=ha("transitioncancel"),qd=ha("transitionend"),Md=new Map,So="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(" ");So.push("scrollEnd");function $t(e,t){Md.set(e,t),ua(t,[e])}var hi=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},_t=[],Fa=0,Ao=0;function mi(){for(var e=Fa,t=Ao=Fa=0;t<e;){var n=_t[t];_t[t++]=null;var s=_t[t];_t[t++]=null;var c=_t[t];_t[t++]=null;var u=_t[t];if(_t[t++]=null,s!==null&&c!==null){var g=s.pending;g===null?c.next=c:(c.next=g.next,g.next=c),s.pending=c}u!==0&&Td(n,c,u)}}function pi(e,t,n,s){_t[Fa++]=e,_t[Fa++]=t,_t[Fa++]=n,_t[Fa++]=s,Ao|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function jo(e,t,n,s){return pi(e,t,n,s),gi(e)}function ma(e,t){return pi(e,null,null,t),gi(e)}function Td(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-Ce(n),e=u.hiddenUpdates,s=e[c],s===null?e[c]=[t]:s.push(t),t.lane=n|536870912),u):null}function gi(e){if(50<vs)throw vs=0,kc=null,Error(r(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ja={};function ey(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 jt(e,t,n,s){return new ey(e,t,n,s)}function No(e){return e=e.prototype,!(!e||!e.isReactComponent)}function un(e,t){var n=e.alternate;return n===null?(n=jt(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 Rd(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 xi(e,t,n,s,c,u){var g=0;if(s=e,typeof e=="function")No(e)&&(g=1);else if(typeof e=="string")g=sv(e,n,_.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case G:return e=jt(31,n,t,c),e.elementType=G,e.lanes=u,e;case C:return pa(n.children,c,u,t);case A:g=8,c|=24;break;case q:return e=jt(12,n,t,c|2),e.elementType=q,e.lanes=u,e;case L:return e=jt(13,n,t,c),e.elementType=L,e.lanes=u,e;case U:return e=jt(19,n,t,c),e.elementType=U,e.lanes=u,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case k:g=10;break e;case w:g=9;break e;case Y:g=11;break e;case B:g=14;break e;case P:g=16,s=null;break e}g=29,n=Error(r(130,e===null?"null":typeof e,"")),s=null}return t=jt(g,n,t,c),t.elementType=e,t.type=s,t.lanes=u,t}function pa(e,t,n,s){return e=jt(7,e,s,t),e.lanes=n,e}function wo(e,t,n){return e=jt(6,e,null,t),e.lanes=n,e}function kd(e){var t=jt(18,null,null,0);return t.stateNode=e,t}function Eo(e,t,n){return t=jt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var _d=new WeakMap;function Dt(e,t){if(typeof e=="object"&&e!==null){var n=_d.get(e);return n!==void 0?n:(t={value:e,source:t,stack:Da(t)},_d.set(e,t),t)}return{value:e,source:t,stack:Da(t)}}var Ia=[],Wa=0,yi=null,Wl=0,Ot=[],Bt=0,On=null,Jt=1,It="";function fn(e,t){Ia[Wa++]=Wl,Ia[Wa++]=yi,yi=e,Wl=t}function Dd(e,t,n){Ot[Bt++]=Jt,Ot[Bt++]=It,Ot[Bt++]=On,On=e;var s=Jt;e=It;var c=32-Ce(s)-1;s&=~(1<<c),n+=1;var u=32-Ce(t)+c;if(30<u){var g=c-c%5;u=(s&(1<<g)-1).toString(32),s>>=g,c-=g,Jt=1<<32-Ce(t)+c|n<<c|s,It=u+e}else Jt=1<<u|n<<c|s,It=e}function Co(e){e.return!==null&&(fn(e,1),Dd(e,1,0))}function qo(e){for(;e===yi;)yi=Ia[--Wa],Ia[Wa]=null,Wl=Ia[--Wa],Ia[Wa]=null;for(;e===On;)On=Ot[--Bt],Ot[Bt]=null,It=Ot[--Bt],Ot[Bt]=null,Jt=Ot[--Bt],Ot[Bt]=null}function Od(e,t){Ot[Bt++]=Jt,Ot[Bt++]=It,Ot[Bt++]=On,Jt=t.id,It=t.overflow,On=e}var it=null,He=null,Ae=!1,Bn=null,zt=!1,Mo=Error(r(519));function zn(e){var t=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Pl(Dt(t,e)),Mo}function Bd(e){var t=e.stateNode,n=e.type,s=e.memoizedProps;switch(t[st]=e,t[mt]=s,n){case"dialog":ve("cancel",t),ve("close",t);break;case"iframe":case"object":case"embed":ve("load",t);break;case"video":case"audio":for(n=0;n<Ss.length;n++)ve(Ss[n],t);break;case"source":ve("error",t);break;case"img":case"image":case"link":ve("error",t),ve("load",t);break;case"details":ve("toggle",t);break;case"input":ve("invalid",t),Ff(t,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":ve("invalid",t);break;case"textarea":ve("invalid",t),If(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||Pm(t.textContent,n)?(s.popover!=null&&(ve("beforetoggle",t),ve("toggle",t)),s.onScroll!=null&&ve("scroll",t),s.onScrollEnd!=null&&ve("scrollend",t),s.onClick!=null&&(t.onclick=on),t=!0):t=!1,t||zn(e,!0)}function zd(e){for(it=e.return;it;)switch(it.tag){case 5:case 31:case 13:zt=!1;return;case 27:case 3:zt=!0;return;default:it=it.return}}function Pa(e){if(e!==it)return!1;if(!Ae)return zd(e),Ae=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||Kc(e.type,e.memoizedProps)),n=!n),n&&He&&zn(e),zd(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));He=op(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));He=op(e)}else t===27?(t=He,In(e.type)?(e=Wc,Wc=null,He=e):He=t):He=it?Ut(e.stateNode.nextSibling):null;return!0}function ga(){He=it=null,Ae=!1}function To(){var e=Bn;return e!==null&&(vt===null?vt=e:vt.push.apply(vt,e),Bn=null),e}function Pl(e){Bn===null?Bn=[e]:Bn.push(e)}var Ro=E(null),xa=null,dn=null;function Ln(e,t,n){K(Ro,t._currentValue),t._currentValue=n}function hn(e){e._currentValue=Ro.current,O(Ro)}function ko(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 _o(e,t,n,s){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var u=c.dependencies;if(u!==null){var g=c.child;u=u.firstContext;e:for(;u!==null;){var v=u;u=c;for(var T=0;T<t.length;T++)if(v.context===t[T]){u.lanes|=n,v=u.alternate,v!==null&&(v.lanes|=n),ko(u.return,n,e),s||(g=null);break e}u=v.next}}else if(c.tag===18){if(g=c.return,g===null)throw Error(r(341));g.lanes|=n,u=g.alternate,u!==null&&(u.lanes|=n),ko(g,n,e),g=null}else g=c.child;if(g!==null)g.return=c;else for(g=c;g!==null;){if(g===e){g=null;break}if(c=g.sibling,c!==null){c.return=g.return,g=c;break}g=g.return}c=g}}function el(e,t,n,s){e=null;for(var c=t,u=!1;c!==null;){if(!u){if((c.flags&524288)!==0)u=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var g=c.alternate;if(g===null)throw Error(r(387));if(g=g.memoizedProps,g!==null){var v=c.type;At(c.pendingProps.value,g.value)||(e!==null?e.push(v):e=[v])}}else if(c===ie.current){if(g=c.alternate,g===null)throw Error(r(387));g.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(Es):e=[Es])}c=c.return}e!==null&&_o(t,e,n,s),t.flags|=262144}function vi(e){for(e=e.firstContext;e!==null;){if(!At(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ya(e){xa=e,dn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function rt(e){return Ld(xa,e)}function bi(e,t){return xa===null&&ya(e),Ld(e,t)}function Ld(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},dn===null){if(e===null)throw Error(r(308));dn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else dn=dn.next=t;return n}var ty=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()})}},ny=a.unstable_scheduleCallback,ay=a.unstable_NormalPriority,Fe={$$typeof:k,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Do(){return{controller:new ty,data:new Map,refCount:0}}function es(e){e.refCount--,e.refCount===0&&ny(ay,function(){e.controller.abort()})}var ts=null,Oo=0,tl=0,nl=null;function ly(e,t){if(ts===null){var n=ts=[];Oo=0,tl=Lc(),nl={status:"pending",value:void 0,then:function(s){n.push(s)}}}return Oo++,t.then(Ud,Ud),t}function Ud(){if(--Oo===0&&ts!==null){nl!==null&&(nl.status="fulfilled");var e=ts;ts=null,tl=0,nl=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function sy(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 Hd=z.S;z.S=function(e,t){jm=tt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&ly(e,t),Hd!==null&&Hd(e,t)};var va=E(null);function Bo(){var e=va.current;return e!==null?e:ze.pooledCache}function Si(e,t){t===null?K(va,va.current):K(va,t.pool)}function Vd(){var e=Bo();return e===null?null:{parent:Fe._currentValue,pool:e}}var al=Error(r(460)),zo=Error(r(474)),Ai=Error(r(542)),ji={then:function(){}};function Yd(e){return e=e.status,e==="fulfilled"||e==="rejected"}function $d(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(on,on),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Xd(e),e;default:if(typeof t.status=="string")t.then(on,on);else{if(e=ze,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,Xd(e),e}throw Sa=t,al}}function ba(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Sa=n,al):n}}var Sa=null;function Gd(){if(Sa===null)throw Error(r(459));var e=Sa;return Sa=null,e}function Xd(e){if(e===al||e===Ai)throw Error(r(483))}var ll=null,ns=0;function Ni(e){var t=ns;return ns+=1,ll===null&&(ll=[]),$d(ll,e,t)}function as(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function wi(e,t){throw t.$$typeof===N?Error(r(525)):(e=Object.prototype.toString.call(t),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Qd(e){function t(D,R){if(e){var H=D.deletions;H===null?(D.deletions=[R],D.flags|=16):H.push(R)}}function n(D,R){if(!e)return null;for(;R!==null;)t(D,R),R=R.sibling;return null}function s(D){for(var R=new Map;D!==null;)D.key!==null?R.set(D.key,D):R.set(D.index,D),D=D.sibling;return R}function c(D,R){return D=un(D,R),D.index=0,D.sibling=null,D}function u(D,R,H){return D.index=H,e?(H=D.alternate,H!==null?(H=H.index,H<R?(D.flags|=67108866,R):H):(D.flags|=67108866,R)):(D.flags|=1048576,R)}function g(D){return e&&D.alternate===null&&(D.flags|=67108866),D}function v(D,R,H,J){return R===null||R.tag!==6?(R=wo(H,D.mode,J),R.return=D,R):(R=c(R,H),R.return=D,R)}function T(D,R,H,J){var fe=H.type;return fe===C?Z(D,R,H.props.children,J,H.key):R!==null&&(R.elementType===fe||typeof fe=="object"&&fe!==null&&fe.$$typeof===P&&ba(fe)===R.type)?(R=c(R,H.props),as(R,H),R.return=D,R):(R=xi(H.type,H.key,H.props,null,D.mode,J),as(R,H),R.return=D,R)}function V(D,R,H,J){return R===null||R.tag!==4||R.stateNode.containerInfo!==H.containerInfo||R.stateNode.implementation!==H.implementation?(R=Eo(H,D.mode,J),R.return=D,R):(R=c(R,H.children||[]),R.return=D,R)}function Z(D,R,H,J,fe){return R===null||R.tag!==7?(R=pa(H,D.mode,J,fe),R.return=D,R):(R=c(R,H),R.return=D,R)}function I(D,R,H){if(typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint")return R=wo(""+R,D.mode,H),R.return=D,R;if(typeof R=="object"&&R!==null){switch(R.$$typeof){case M:return H=xi(R.type,R.key,R.props,null,D.mode,H),as(H,R),H.return=D,H;case j:return R=Eo(R,D.mode,H),R.return=D,R;case P:return R=ba(R),I(D,R,H)}if(le(R)||W(R))return R=pa(R,D.mode,H,null),R.return=D,R;if(typeof R.then=="function")return I(D,Ni(R),H);if(R.$$typeof===k)return I(D,bi(D,R),H);wi(D,R)}return null}function $(D,R,H,J){var fe=R!==null?R.key:null;if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return fe!==null?null:v(D,R,""+H,J);if(typeof H=="object"&&H!==null){switch(H.$$typeof){case M:return H.key===fe?T(D,R,H,J):null;case j:return H.key===fe?V(D,R,H,J):null;case P:return H=ba(H),$(D,R,H,J)}if(le(H)||W(H))return fe!==null?null:Z(D,R,H,J,null);if(typeof H.then=="function")return $(D,R,Ni(H),J);if(H.$$typeof===k)return $(D,R,bi(D,H),J);wi(D,H)}return null}function X(D,R,H,J,fe){if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return D=D.get(H)||null,v(R,D,""+J,fe);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case M:return D=D.get(J.key===null?H:J.key)||null,T(R,D,J,fe);case j:return D=D.get(J.key===null?H:J.key)||null,V(R,D,J,fe);case P:return J=ba(J),X(D,R,H,J,fe)}if(le(J)||W(J))return D=D.get(H)||null,Z(R,D,J,fe,null);if(typeof J.then=="function")return X(D,R,H,Ni(J),fe);if(J.$$typeof===k)return X(D,R,H,bi(R,J),fe);wi(R,J)}return null}function re(D,R,H,J){for(var fe=null,qe=null,oe=R,xe=R=0,Se=null;oe!==null&&xe<H.length;xe++){oe.index>xe?(Se=oe,oe=null):Se=oe.sibling;var Me=$(D,oe,H[xe],J);if(Me===null){oe===null&&(oe=Se);break}e&&oe&&Me.alternate===null&&t(D,oe),R=u(Me,R,xe),qe===null?fe=Me:qe.sibling=Me,qe=Me,oe=Se}if(xe===H.length)return n(D,oe),Ae&&fn(D,xe),fe;if(oe===null){for(;xe<H.length;xe++)oe=I(D,H[xe],J),oe!==null&&(R=u(oe,R,xe),qe===null?fe=oe:qe.sibling=oe,qe=oe);return Ae&&fn(D,xe),fe}for(oe=s(oe);xe<H.length;xe++)Se=X(oe,D,xe,H[xe],J),Se!==null&&(e&&Se.alternate!==null&&oe.delete(Se.key===null?xe:Se.key),R=u(Se,R,xe),qe===null?fe=Se:qe.sibling=Se,qe=Se);return e&&oe.forEach(function(na){return t(D,na)}),Ae&&fn(D,xe),fe}function de(D,R,H,J){if(H==null)throw Error(r(151));for(var fe=null,qe=null,oe=R,xe=R=0,Se=null,Me=H.next();oe!==null&&!Me.done;xe++,Me=H.next()){oe.index>xe?(Se=oe,oe=null):Se=oe.sibling;var na=$(D,oe,Me.value,J);if(na===null){oe===null&&(oe=Se);break}e&&oe&&na.alternate===null&&t(D,oe),R=u(na,R,xe),qe===null?fe=na:qe.sibling=na,qe=na,oe=Se}if(Me.done)return n(D,oe),Ae&&fn(D,xe),fe;if(oe===null){for(;!Me.done;xe++,Me=H.next())Me=I(D,Me.value,J),Me!==null&&(R=u(Me,R,xe),qe===null?fe=Me:qe.sibling=Me,qe=Me);return Ae&&fn(D,xe),fe}for(oe=s(oe);!Me.done;xe++,Me=H.next())Me=X(oe,D,xe,Me.value,J),Me!==null&&(e&&Me.alternate!==null&&oe.delete(Me.key===null?xe:Me.key),R=u(Me,R,xe),qe===null?fe=Me:qe.sibling=Me,qe=Me);return e&&oe.forEach(function(gv){return t(D,gv)}),Ae&&fn(D,xe),fe}function Be(D,R,H,J){if(typeof H=="object"&&H!==null&&H.type===C&&H.key===null&&(H=H.props.children),typeof H=="object"&&H!==null){switch(H.$$typeof){case M:e:{for(var fe=H.key;R!==null;){if(R.key===fe){if(fe=H.type,fe===C){if(R.tag===7){n(D,R.sibling),J=c(R,H.props.children),J.return=D,D=J;break e}}else if(R.elementType===fe||typeof fe=="object"&&fe!==null&&fe.$$typeof===P&&ba(fe)===R.type){n(D,R.sibling),J=c(R,H.props),as(J,H),J.return=D,D=J;break e}n(D,R);break}else t(D,R);R=R.sibling}H.type===C?(J=pa(H.props.children,D.mode,J,H.key),J.return=D,D=J):(J=xi(H.type,H.key,H.props,null,D.mode,J),as(J,H),J.return=D,D=J)}return g(D);case j:e:{for(fe=H.key;R!==null;){if(R.key===fe)if(R.tag===4&&R.stateNode.containerInfo===H.containerInfo&&R.stateNode.implementation===H.implementation){n(D,R.sibling),J=c(R,H.children||[]),J.return=D,D=J;break e}else{n(D,R);break}else t(D,R);R=R.sibling}J=Eo(H,D.mode,J),J.return=D,D=J}return g(D);case P:return H=ba(H),Be(D,R,H,J)}if(le(H))return re(D,R,H,J);if(W(H)){if(fe=W(H),typeof fe!="function")throw Error(r(150));return H=fe.call(H),de(D,R,H,J)}if(typeof H.then=="function")return Be(D,R,Ni(H),J);if(H.$$typeof===k)return Be(D,R,bi(D,H),J);wi(D,H)}return typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint"?(H=""+H,R!==null&&R.tag===6?(n(D,R.sibling),J=c(R,H),J.return=D,D=J):(n(D,R),J=wo(H,D.mode,J),J.return=D,D=J),g(D)):n(D,R)}return function(D,R,H,J){try{ns=0;var fe=Be(D,R,H,J);return ll=null,fe}catch(oe){if(oe===al||oe===Ai)throw oe;var qe=jt(29,oe,null,D.mode);return qe.lanes=J,qe.return=D,qe}finally{}}}var Aa=Qd(!0),Kd=Qd(!1),Un=!1;function Lo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Uo(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 Hn(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Vn(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Te&2)!==0){var c=s.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),s.pending=t,t=gi(e),Td(e,null,n),t}return pi(e,s,t,n),gi(e)}function ls(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,Lf(e,n)}}function Ho(e,t){var n=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,n===s)){var c=null,u=null;if(n=n.firstBaseUpdate,n!==null){do{var g={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};u===null?c=u=g:u=u.next=g,n=n.next}while(n!==null);u===null?c=u=t:u=u.next=t}else c=u=t;n={baseState:s.baseState,firstBaseUpdate:c,lastBaseUpdate:u,shared:s.shared,callbacks:s.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Vo=!1;function ss(){if(Vo){var e=nl;if(e!==null)throw e}}function is(e,t,n,s){Vo=!1;var c=e.updateQueue;Un=!1;var u=c.firstBaseUpdate,g=c.lastBaseUpdate,v=c.shared.pending;if(v!==null){c.shared.pending=null;var T=v,V=T.next;T.next=null,g===null?u=V:g.next=V,g=T;var Z=e.alternate;Z!==null&&(Z=Z.updateQueue,v=Z.lastBaseUpdate,v!==g&&(v===null?Z.firstBaseUpdate=V:v.next=V,Z.lastBaseUpdate=T))}if(u!==null){var I=c.baseState;g=0,Z=V=T=null,v=u;do{var $=v.lane&-536870913,X=$!==v.lane;if(X?(be&$)===$:(s&$)===$){$!==0&&$===tl&&(Vo=!0),Z!==null&&(Z=Z.next={lane:0,tag:v.tag,payload:v.payload,callback:null,next:null});e:{var re=e,de=v;$=t;var Be=n;switch(de.tag){case 1:if(re=de.payload,typeof re=="function"){I=re.call(Be,I,$);break e}I=re;break e;case 3:re.flags=re.flags&-65537|128;case 0:if(re=de.payload,$=typeof re=="function"?re.call(Be,I,$):re,$==null)break e;I=S({},I,$);break e;case 2:Un=!0}}$=v.callback,$!==null&&(e.flags|=64,X&&(e.flags|=8192),X=c.callbacks,X===null?c.callbacks=[$]:X.push($))}else X={lane:$,tag:v.tag,payload:v.payload,callback:v.callback,next:null},Z===null?(V=Z=X,T=I):Z=Z.next=X,g|=$;if(v=v.next,v===null){if(v=c.shared.pending,v===null)break;X=v,v=X.next,X.next=null,c.lastBaseUpdate=X,c.shared.pending=null}}while(!0);Z===null&&(T=I),c.baseState=T,c.firstBaseUpdate=V,c.lastBaseUpdate=Z,u===null&&(c.shared.lanes=0),Qn|=g,e.lanes=g,e.memoizedState=I}}function Zd(e,t){if(typeof e!="function")throw Error(r(191,e));e.call(t)}function Fd(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Zd(n[e],t)}var sl=E(null),Ei=E(0);function Jd(e,t){e=An,K(Ei,e),K(sl,t),An=e|t.baseLanes}function Yo(){K(Ei,An),K(sl,sl.current)}function $o(){An=Ei.current,O(sl),O(Ei)}var Nt=E(null),Lt=null;function Yn(e){var t=e.alternate;K(Ke,Ke.current&1),K(Nt,e),Lt===null&&(t===null||sl.current!==null||t.memoizedState!==null)&&(Lt=e)}function Go(e){K(Ke,Ke.current),K(Nt,e),Lt===null&&(Lt=e)}function Id(e){e.tag===22?(K(Ke,Ke.current),K(Nt,e),Lt===null&&(Lt=e)):$n()}function $n(){K(Ke,Ke.current),K(Nt,Nt.current)}function wt(e){O(Nt),Lt===e&&(Lt=null),O(Ke)}var Ke=E(0);function Ci(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||Jc(n)||Ic(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 mn=0,ge=null,De=null,Je=null,qi=!1,il=!1,ja=!1,Mi=0,rs=0,rl=null,iy=0;function Ge(){throw Error(r(321))}function Xo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!At(e[n],t[n]))return!1;return!0}function Qo(e,t,n,s,c,u){return mn=u,ge=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,z.H=e===null||e.memoizedState===null?Dh:rc,ja=!1,u=n(s,c),ja=!1,il&&(u=Pd(t,n,s,c)),Wd(e),u}function Wd(e){z.H=us;var t=De!==null&&De.next!==null;if(mn=0,Je=De=ge=null,qi=!1,rs=0,rl=null,t)throw Error(r(300));e===null||Ie||(e=e.dependencies,e!==null&&vi(e)&&(Ie=!0))}function Pd(e,t,n,s){ge=e;var c=0;do{if(il&&(rl=null),rs=0,il=!1,25<=c)throw Error(r(301));if(c+=1,Je=De=null,e.updateQueue!=null){var u=e.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}z.H=Oh,u=t(n,s)}while(il);return u}function ry(){var e=z.H,t=e.useState()[0];return t=typeof t.then=="function"?os(t):t,e=e.useState()[0],(De!==null?De.memoizedState:null)!==e&&(ge.flags|=1024),t}function Ko(){var e=Mi!==0;return Mi=0,e}function Zo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Fo(e){if(qi){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}qi=!1}mn=0,Je=De=ge=null,il=!1,rs=Mi=0,rl=null}function ft(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Je===null?ge.memoizedState=Je=e:Je=Je.next=e,Je}function Ze(){if(De===null){var e=ge.alternate;e=e!==null?e.memoizedState:null}else e=De.next;var t=Je===null?ge.memoizedState:Je.next;if(t!==null)Je=t,De=e;else{if(e===null)throw ge.alternate===null?Error(r(467)):Error(r(310));De=e,e={memoizedState:De.memoizedState,baseState:De.baseState,baseQueue:De.baseQueue,queue:De.queue,next:null},Je===null?ge.memoizedState=Je=e:Je=Je.next=e}return Je}function Ti(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function os(e){var t=rs;return rs+=1,rl===null&&(rl=[]),e=$d(rl,e,t),t=ge,(Je===null?t.memoizedState:Je.next)===null&&(t=t.alternate,z.H=t===null||t.memoizedState===null?Dh:rc),e}function Ri(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return os(e);if(e.$$typeof===k)return rt(e)}throw Error(r(438,String(e)))}function Jo(e){var t=null,n=ge.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var s=ge.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=Ti(),ge.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]=ne;return t.index++,n}function pn(e,t){return typeof t=="function"?t(e):t}function ki(e){var t=Ze();return Io(t,De,e)}function Io(e,t,n){var s=e.queue;if(s===null)throw Error(r(311));s.lastRenderedReducer=n;var c=e.baseQueue,u=s.pending;if(u!==null){if(c!==null){var g=c.next;c.next=u.next,u.next=g}t.baseQueue=c=u,s.pending=null}if(u=e.baseState,c===null)e.memoizedState=u;else{t=c.next;var v=g=null,T=null,V=t,Z=!1;do{var I=V.lane&-536870913;if(I!==V.lane?(be&I)===I:(mn&I)===I){var $=V.revertLane;if($===0)T!==null&&(T=T.next={lane:0,revertLane:0,gesture:null,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null}),I===tl&&(Z=!0);else if((mn&$)===$){V=V.next,$===tl&&(Z=!0);continue}else I={lane:0,revertLane:V.revertLane,gesture:null,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null},T===null?(v=T=I,g=u):T=T.next=I,ge.lanes|=$,Qn|=$;I=V.action,ja&&n(u,I),u=V.hasEagerState?V.eagerState:n(u,I)}else $={lane:I,revertLane:V.revertLane,gesture:V.gesture,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null},T===null?(v=T=$,g=u):T=T.next=$,ge.lanes|=I,Qn|=I;V=V.next}while(V!==null&&V!==t);if(T===null?g=u:T.next=v,!At(u,e.memoizedState)&&(Ie=!0,Z&&(n=nl,n!==null)))throw n;e.memoizedState=u,e.baseState=g,e.baseQueue=T,s.lastRenderedState=u}return c===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function Wo(e){var t=Ze(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var s=n.dispatch,c=n.pending,u=t.memoizedState;if(c!==null){n.pending=null;var g=c=c.next;do u=e(u,g.action),g=g.next;while(g!==c);At(u,t.memoizedState)||(Ie=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),n.lastRenderedState=u}return[u,s]}function eh(e,t,n){var s=ge,c=Ze(),u=Ae;if(u){if(n===void 0)throw Error(r(407));n=n()}else n=t();var g=!At((De||c).memoizedState,n);if(g&&(c.memoizedState=n,Ie=!0),c=c.queue,tc(ah.bind(null,s,c,e),[e]),c.getSnapshot!==t||g||Je!==null&&Je.memoizedState.tag&1){if(s.flags|=2048,ol(9,{destroy:void 0},nh.bind(null,s,c,n,t),null),ze===null)throw Error(r(349));u||(mn&127)!==0||th(s,t,n)}return n}function th(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=ge.updateQueue,t===null?(t=Ti(),ge.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function nh(e,t,n,s){t.value=n,t.getSnapshot=s,lh(t)&&sh(e)}function ah(e,t,n){return n(function(){lh(t)&&sh(e)})}function lh(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!At(e,n)}catch{return!0}}function sh(e){var t=ma(e,2);t!==null&&bt(t,e,2)}function Po(e){var t=ft();if(typeof e=="function"){var n=e;if(e=n(),ja){Ee(!0);try{n()}finally{Ee(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:pn,lastRenderedState:e},t}function ih(e,t,n,s){return e.baseState=n,Io(e,De,typeof s=="function"?s:pn)}function oy(e,t,n,s,c){if(Oi(e))throw Error(r(485));if(e=t.action,e!==null){var u={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(g){u.listeners.push(g)}};z.T!==null?n(!0):u.isTransition=!1,s(u),n=t.pending,n===null?(u.next=t.pending=u,rh(t,u)):(u.next=n.next,t.pending=n.next=u)}}function rh(e,t){var n=t.action,s=t.payload,c=e.state;if(t.isTransition){var u=z.T,g={};z.T=g;try{var v=n(c,s),T=z.S;T!==null&&T(g,v),oh(e,t,v)}catch(V){ec(e,t,V)}finally{u!==null&&g.types!==null&&(u.types=g.types),z.T=u}}else try{u=n(c,s),oh(e,t,u)}catch(V){ec(e,t,V)}}function oh(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(s){ch(e,t,s)},function(s){return ec(e,t,s)}):ch(e,t,n)}function ch(e,t,n){t.status="fulfilled",t.value=n,uh(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,rh(e,n)))}function ec(e,t,n){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=n,uh(t),t=t.next;while(t!==s)}e.action=null}function uh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function fh(e,t){return t}function dh(e,t){if(Ae){var n=ze.formState;if(n!==null){e:{var s=ge;if(Ae){if(He){t:{for(var c=He,u=zt;c.nodeType!==8;){if(!u){c=null;break t}if(c=Ut(c.nextSibling),c===null){c=null;break t}}u=c.data,c=u==="F!"||u==="F"?c:null}if(c){He=Ut(c.nextSibling),s=c.data==="F!";break e}}zn(s)}s=!1}s&&(t=n[0])}}return n=ft(),n.memoizedState=n.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:fh,lastRenderedState:t},n.queue=s,n=Rh.bind(null,ge,s),s.dispatch=n,s=Po(!1),u=ic.bind(null,ge,!1,s.queue),s=ft(),c={state:t,dispatch:null,action:e,pending:null},s.queue=c,n=oy.bind(null,ge,c,u,n),c.dispatch=n,s.memoizedState=e,[t,n,!1]}function hh(e){var t=Ze();return mh(t,De,e)}function mh(e,t,n){if(t=Io(e,t,fh)[0],e=ki(pn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=os(t)}catch(g){throw g===al?Ai:g}else s=t;t=Ze();var c=t.queue,u=c.dispatch;return n!==t.memoizedState&&(ge.flags|=2048,ol(9,{destroy:void 0},cy.bind(null,c,n),null)),[s,u,e]}function cy(e,t){e.action=t}function ph(e){var t=Ze(),n=De;if(n!==null)return mh(t,n,e);Ze(),t=t.memoizedState,n=Ze();var s=n.queue.dispatch;return n.memoizedState=e,[t,s,!1]}function ol(e,t,n,s){return e={tag:e,create:n,deps:s,inst:t,next:null},t=ge.updateQueue,t===null&&(t=Ti(),ge.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 gh(){return Ze().memoizedState}function _i(e,t,n,s){var c=ft();ge.flags|=e,c.memoizedState=ol(1|t,{destroy:void 0},n,s===void 0?null:s)}function Di(e,t,n,s){var c=Ze();s=s===void 0?null:s;var u=c.memoizedState.inst;De!==null&&s!==null&&Xo(s,De.memoizedState.deps)?c.memoizedState=ol(t,u,n,s):(ge.flags|=e,c.memoizedState=ol(1|t,u,n,s))}function xh(e,t){_i(8390656,8,e,t)}function tc(e,t){Di(2048,8,e,t)}function uy(e){ge.flags|=4;var t=ge.updateQueue;if(t===null)t=Ti(),ge.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function yh(e){var t=Ze().memoizedState;return uy({ref:t,nextImpl:e}),function(){if((Te&2)!==0)throw Error(r(440));return t.impl.apply(void 0,arguments)}}function vh(e,t){return Di(4,2,e,t)}function bh(e,t){return Di(4,4,e,t)}function Sh(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 Ah(e,t,n){n=n!=null?n.concat([e]):null,Di(4,4,Sh.bind(null,t,e),n)}function nc(){}function jh(e,t){var n=Ze();t=t===void 0?null:t;var s=n.memoizedState;return t!==null&&Xo(t,s[1])?s[0]:(n.memoizedState=[e,t],e)}function Nh(e,t){var n=Ze();t=t===void 0?null:t;var s=n.memoizedState;if(t!==null&&Xo(t,s[1]))return s[0];if(s=e(),ja){Ee(!0);try{e()}finally{Ee(!1)}}return n.memoizedState=[s,t],s}function ac(e,t,n){return n===void 0||(mn&1073741824)!==0&&(be&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=wm(),ge.lanes|=e,Qn|=e,n)}function wh(e,t,n,s){return At(n,t)?n:sl.current!==null?(e=ac(e,n,s),At(e,t)||(Ie=!0),e):(mn&42)===0||(mn&1073741824)!==0&&(be&261930)===0?(Ie=!0,e.memoizedState=n):(e=wm(),ge.lanes|=e,Qn|=e,t)}function Eh(e,t,n,s,c){var u=ee.p;ee.p=u!==0&&8>u?u:8;var g=z.T,v={};z.T=v,ic(e,!1,t,n);try{var T=c(),V=z.S;if(V!==null&&V(v,T),T!==null&&typeof T=="object"&&typeof T.then=="function"){var Z=sy(T,s);cs(e,t,Z,qt(e))}else cs(e,t,s,qt(e))}catch(I){cs(e,t,{then:function(){},status:"rejected",reason:I},qt())}finally{ee.p=u,g!==null&&v.types!==null&&(g.types=v.types),z.T=g}}function fy(){}function lc(e,t,n,s){if(e.tag!==5)throw Error(r(476));var c=Ch(e).queue;Eh(e,c,t,ae,n===null?fy:function(){return qh(e),n(s)})}function Ch(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ae,baseState:ae,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:pn,lastRenderedState:ae},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:pn,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function qh(e){var t=Ch(e);t.next===null&&(t=e.alternate.memoizedState),cs(e,t.next.queue,{},qt())}function sc(){return rt(Es)}function Mh(){return Ze().memoizedState}function Th(){return Ze().memoizedState}function dy(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=qt();e=Hn(n);var s=Vn(t,e,n);s!==null&&(bt(s,t,n),ls(s,t,n)),t={cache:Do()},e.payload=t;return}t=t.return}}function hy(e,t,n){var s=qt();n={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Oi(e)?kh(t,n):(n=jo(e,t,n,s),n!==null&&(bt(n,e,s),_h(n,t,s)))}function Rh(e,t,n){var s=qt();cs(e,t,n,s)}function cs(e,t,n,s){var c={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Oi(e))kh(t,c);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var g=t.lastRenderedState,v=u(g,n);if(c.hasEagerState=!0,c.eagerState=v,At(v,g))return pi(e,t,c,0),ze===null&&mi(),!1}catch{}finally{}if(n=jo(e,t,c,s),n!==null)return bt(n,e,s),_h(n,t,s),!0}return!1}function ic(e,t,n,s){if(s={lane:2,revertLane:Lc(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Oi(e)){if(t)throw Error(r(479))}else t=jo(e,n,s,2),t!==null&&bt(t,e,2)}function Oi(e){var t=e.alternate;return e===ge||t!==null&&t===ge}function kh(e,t){il=qi=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function _h(e,t,n){if((n&4194048)!==0){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,Lf(e,n)}}var us={readContext:rt,use:Ri,useCallback:Ge,useContext:Ge,useEffect:Ge,useImperativeHandle:Ge,useLayoutEffect:Ge,useInsertionEffect:Ge,useMemo:Ge,useReducer:Ge,useRef:Ge,useState:Ge,useDebugValue:Ge,useDeferredValue:Ge,useTransition:Ge,useSyncExternalStore:Ge,useId:Ge,useHostTransitionStatus:Ge,useFormState:Ge,useActionState:Ge,useOptimistic:Ge,useMemoCache:Ge,useCacheRefresh:Ge};us.useEffectEvent=Ge;var Dh={readContext:rt,use:Ri,useCallback:function(e,t){return ft().memoizedState=[e,t===void 0?null:t],e},useContext:rt,useEffect:xh,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,_i(4194308,4,Sh.bind(null,t,e),n)},useLayoutEffect:function(e,t){return _i(4194308,4,e,t)},useInsertionEffect:function(e,t){_i(4,2,e,t)},useMemo:function(e,t){var n=ft();t=t===void 0?null:t;var s=e();if(ja){Ee(!0);try{e()}finally{Ee(!1)}}return n.memoizedState=[s,t],s},useReducer:function(e,t,n){var s=ft();if(n!==void 0){var c=n(t);if(ja){Ee(!0);try{n(t)}finally{Ee(!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=hy.bind(null,ge,e),[s.memoizedState,e]},useRef:function(e){var t=ft();return e={current:e},t.memoizedState=e},useState:function(e){e=Po(e);var t=e.queue,n=Rh.bind(null,ge,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:nc,useDeferredValue:function(e,t){var n=ft();return ac(n,e,t)},useTransition:function(){var e=Po(!1);return e=Eh.bind(null,ge,e.queue,!0,!1),ft().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var s=ge,c=ft();if(Ae){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),ze===null)throw Error(r(349));(be&127)!==0||th(s,t,n)}c.memoizedState=n;var u={value:n,getSnapshot:t};return c.queue=u,xh(ah.bind(null,s,u,e),[e]),s.flags|=2048,ol(9,{destroy:void 0},nh.bind(null,s,u,n,t),null),n},useId:function(){var e=ft(),t=ze.identifierPrefix;if(Ae){var n=It,s=Jt;n=(s&~(1<<32-Ce(s)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Mi++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=iy++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:sc,useFormState:dh,useActionState:dh,useOptimistic:function(e){var t=ft();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=ic.bind(null,ge,!0,n),n.dispatch=t,[e,t]},useMemoCache:Jo,useCacheRefresh:function(){return ft().memoizedState=dy.bind(null,ge)},useEffectEvent:function(e){var t=ft(),n={impl:e};return t.memoizedState=n,function(){if((Te&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}},rc={readContext:rt,use:Ri,useCallback:jh,useContext:rt,useEffect:tc,useImperativeHandle:Ah,useInsertionEffect:vh,useLayoutEffect:bh,useMemo:Nh,useReducer:ki,useRef:gh,useState:function(){return ki(pn)},useDebugValue:nc,useDeferredValue:function(e,t){var n=Ze();return wh(n,De.memoizedState,e,t)},useTransition:function(){var e=ki(pn)[0],t=Ze().memoizedState;return[typeof e=="boolean"?e:os(e),t]},useSyncExternalStore:eh,useId:Mh,useHostTransitionStatus:sc,useFormState:hh,useActionState:hh,useOptimistic:function(e,t){var n=Ze();return ih(n,De,e,t)},useMemoCache:Jo,useCacheRefresh:Th};rc.useEffectEvent=yh;var Oh={readContext:rt,use:Ri,useCallback:jh,useContext:rt,useEffect:tc,useImperativeHandle:Ah,useInsertionEffect:vh,useLayoutEffect:bh,useMemo:Nh,useReducer:Wo,useRef:gh,useState:function(){return Wo(pn)},useDebugValue:nc,useDeferredValue:function(e,t){var n=Ze();return De===null?ac(n,e,t):wh(n,De.memoizedState,e,t)},useTransition:function(){var e=Wo(pn)[0],t=Ze().memoizedState;return[typeof e=="boolean"?e:os(e),t]},useSyncExternalStore:eh,useId:Mh,useHostTransitionStatus:sc,useFormState:ph,useActionState:ph,useOptimistic:function(e,t){var n=Ze();return De!==null?ih(n,De,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:Jo,useCacheRefresh:Th};Oh.useEffectEvent=yh;function oc(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 cc={enqueueSetState:function(e,t,n){e=e._reactInternals;var s=qt(),c=Hn(s);c.payload=t,n!=null&&(c.callback=n),t=Vn(e,c,s),t!==null&&(bt(t,e,s),ls(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var s=qt(),c=Hn(s);c.tag=1,c.payload=t,n!=null&&(c.callback=n),t=Vn(e,c,s),t!==null&&(bt(t,e,s),ls(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=qt(),s=Hn(n);s.tag=2,t!=null&&(s.callback=t),t=Vn(e,s,n),t!==null&&(bt(t,e,n),ls(t,e,n))}};function Bh(e,t,n,s,c,u,g){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,u,g):t.prototype&&t.prototype.isPureReactComponent?!Jl(n,s)||!Jl(c,u):!0}function zh(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&&cc.enqueueReplaceState(t,t.state,null)}function Na(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 Lh(e){hi(e)}function Uh(e){console.error(e)}function Hh(e){hi(e)}function Bi(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function Vh(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 uc(e,t,n){return n=Hn(n),n.tag=3,n.payload={element:null},n.callback=function(){Bi(e,t)},n}function Yh(e){return e=Hn(e),e.tag=3,e}function $h(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(){Vh(t,n,s)}}var g=n.stateNode;g!==null&&typeof g.componentDidCatch=="function"&&(e.callback=function(){Vh(t,n,s),typeof c!="function"&&(Kn===null?Kn=new Set([this]):Kn.add(this));var v=s.stack;this.componentDidCatch(s.value,{componentStack:v!==null?v:""})})}function my(e,t,n,s,c){if(n.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=n.alternate,t!==null&&el(t,n,c,!0),n=Nt.current,n!==null){switch(n.tag){case 31:case 13:return Lt===null?Zi():n.alternate===null&&Xe===0&&(Xe=3),n.flags&=-257,n.flags|=65536,n.lanes=c,s===ji?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([s]):t.add(s),Oc(e,s,c)),!1;case 22:return n.flags|=65536,s===ji?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([s])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([s]):n.add(s)),Oc(e,s,c)),!1}throw Error(r(435,n.tag))}return Oc(e,s,c),Zi(),!1}if(Ae)return t=Nt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,s!==Mo&&(e=Error(r(422),{cause:s}),Pl(Dt(e,n)))):(s!==Mo&&(t=Error(r(423),{cause:s}),Pl(Dt(t,n))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,s=Dt(s,n),c=uc(e.stateNode,s,c),Ho(e,c),Xe!==4&&(Xe=2)),!1;var u=Error(r(520),{cause:s});if(u=Dt(u,n),ys===null?ys=[u]:ys.push(u),Xe!==4&&(Xe=2),t===null)return!0;s=Dt(s,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=c&-c,n.lanes|=e,e=uc(n.stateNode,s,e),Ho(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"&&(Kn===null||!Kn.has(u))))return n.flags|=65536,c&=-c,n.lanes|=c,c=Yh(c),$h(c,e,n,s),Ho(n,c),!1}n=n.return}while(n!==null);return!1}var fc=Error(r(461)),Ie=!1;function ot(e,t,n,s){t.child=e===null?Kd(t,null,n,s):Aa(t,e.child,n,s)}function Gh(e,t,n,s,c){n=n.render;var u=t.ref;if("ref"in s){var g={};for(var v in s)v!=="ref"&&(g[v]=s[v])}else g=s;return ya(t),s=Qo(e,t,n,g,u,c),v=Ko(),e!==null&&!Ie?(Zo(e,t,c),gn(e,t,c)):(Ae&&v&&Co(t),t.flags|=1,ot(e,t,s,c),t.child)}function Xh(e,t,n,s,c){if(e===null){var u=n.type;return typeof u=="function"&&!No(u)&&u.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=u,Qh(e,t,u,s,c)):(e=xi(n.type,null,s,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!vc(e,c)){var g=u.memoizedProps;if(n=n.compare,n=n!==null?n:Jl,n(g,s)&&e.ref===t.ref)return gn(e,t,c)}return t.flags|=1,e=un(u,s),e.ref=t.ref,e.return=t,t.child=e}function Qh(e,t,n,s,c){if(e!==null){var u=e.memoizedProps;if(Jl(u,s)&&e.ref===t.ref)if(Ie=!1,t.pendingProps=s=u,vc(e,c))(e.flags&131072)!==0&&(Ie=!0);else return t.lanes=e.lanes,gn(e,t,c)}return dc(e,t,n,s,c)}function Kh(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 Zh(e,t,u,n,s)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Si(t,u!==null?u.cachePool:null),u!==null?Jd(t,u):Yo(),Id(t);else return s=t.lanes=536870912,Zh(e,t,u!==null?u.baseLanes|n:n,n,s)}else u!==null?(Si(t,u.cachePool),Jd(t,u),$n(),t.memoizedState=null):(e!==null&&Si(t,null),Yo(),$n());return ot(e,t,c,n),t.child}function fs(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Zh(e,t,n,s,c){var u=Bo();return u=u===null?null:{parent:Fe._currentValue,pool:u},t.memoizedState={baseLanes:n,cachePool:u},e!==null&&Si(t,null),Yo(),Id(t),e!==null&&el(e,t,s,!0),t.childLanes=c,null}function zi(e,t){return t=Ui({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Fh(e,t,n){return Aa(t,e.child,null,n),e=zi(t,t.pendingProps),e.flags|=2,wt(t),t.memoizedState=null,e}function py(e,t,n){var s=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Ae){if(s.mode==="hidden")return e=zi(t,s),t.lanes=536870912,fs(null,e);if(Go(t),(e=He)?(e=rp(e,zt),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:On!==null?{id:Jt,overflow:It}:null,retryLane:536870912,hydrationErrors:null},n=kd(e),n.return=t,t.child=n,it=t,He=null)):e=null,e===null)throw zn(t);return t.lanes=536870912,null}return zi(t,s)}var u=e.memoizedState;if(u!==null){var g=u.dehydrated;if(Go(t),c)if(t.flags&256)t.flags&=-257,t=Fh(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(r(558));else if(Ie||el(e,t,n,!1),c=(n&e.childLanes)!==0,Ie||c){if(s=ze,s!==null&&(g=Uf(s,n),g!==0&&g!==u.retryLane))throw u.retryLane=g,ma(e,g),bt(s,e,g),fc;Zi(),t=Fh(e,t,n)}else e=u.treeContext,He=Ut(g.nextSibling),it=t,Ae=!0,Bn=null,zt=!1,e!==null&&Od(t,e),t=zi(t,s),t.flags|=4096;return t}return e=un(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Li(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 dc(e,t,n,s,c){return ya(t),n=Qo(e,t,n,s,void 0,c),s=Ko(),e!==null&&!Ie?(Zo(e,t,c),gn(e,t,c)):(Ae&&s&&Co(t),t.flags|=1,ot(e,t,n,c),t.child)}function Jh(e,t,n,s,c,u){return ya(t),t.updateQueue=null,n=Pd(t,s,n,c),Wd(e),s=Ko(),e!==null&&!Ie?(Zo(e,t,u),gn(e,t,u)):(Ae&&s&&Co(t),t.flags|=1,ot(e,t,n,u),t.child)}function Ih(e,t,n,s,c){if(ya(t),t.stateNode===null){var u=Ja,g=n.contextType;typeof g=="object"&&g!==null&&(u=rt(g)),u=new n(s,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=cc,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=s,u.state=t.memoizedState,u.refs={},Lo(t),g=n.contextType,u.context=typeof g=="object"&&g!==null?rt(g):Ja,u.state=t.memoizedState,g=n.getDerivedStateFromProps,typeof g=="function"&&(oc(t,n,g,s),u.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(g=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),g!==u.state&&cc.enqueueReplaceState(u,u.state,null),is(t,s,u,c),ss(),u.state=t.memoizedState),typeof u.componentDidMount=="function"&&(t.flags|=4194308),s=!0}else if(e===null){u=t.stateNode;var v=t.memoizedProps,T=Na(n,v);u.props=T;var V=u.context,Z=n.contextType;g=Ja,typeof Z=="object"&&Z!==null&&(g=rt(Z));var I=n.getDerivedStateFromProps;Z=typeof I=="function"||typeof u.getSnapshotBeforeUpdate=="function",v=t.pendingProps!==v,Z||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(v||V!==g)&&zh(t,u,s,g),Un=!1;var $=t.memoizedState;u.state=$,is(t,s,u,c),ss(),V=t.memoizedState,v||$!==V||Un?(typeof I=="function"&&(oc(t,n,I,s),V=t.memoizedState),(T=Un||Bh(t,n,T,s,$,V,g))?(Z||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(t.flags|=4194308)):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=V),u.props=s,u.state=V,u.context=g,s=T):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{u=t.stateNode,Uo(e,t),g=t.memoizedProps,Z=Na(n,g),u.props=Z,I=t.pendingProps,$=u.context,V=n.contextType,T=Ja,typeof V=="object"&&V!==null&&(T=rt(V)),v=n.getDerivedStateFromProps,(V=typeof v=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(g!==I||$!==T)&&zh(t,u,s,T),Un=!1,$=t.memoizedState,u.state=$,is(t,s,u,c),ss();var X=t.memoizedState;g!==I||$!==X||Un||e!==null&&e.dependencies!==null&&vi(e.dependencies)?(typeof v=="function"&&(oc(t,n,v,s),X=t.memoizedState),(Z=Un||Bh(t,n,Z,s,$,X,T)||e!==null&&e.dependencies!==null&&vi(e.dependencies))?(V||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(s,X,T),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(s,X,T)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||g===e.memoizedProps&&$===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||g===e.memoizedProps&&$===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=X),u.props=s,u.state=X,u.context=T,s=Z):(typeof u.componentDidUpdate!="function"||g===e.memoizedProps&&$===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||g===e.memoizedProps&&$===e.memoizedState||(t.flags|=1024),s=!1)}return u=s,Li(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=Aa(t,e.child,null,c),t.child=Aa(t,null,n,c)):ot(e,t,n,c),t.memoizedState=u.state,e=t.child):e=gn(e,t,c),e}function Wh(e,t,n,s){return ga(),t.flags|=256,ot(e,t,n,s),t.child}var hc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function mc(e){return{baseLanes:e,cachePool:Vd()}}function pc(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Ct),e}function Ph(e,t,n){var s=t.pendingProps,c=!1,u=(t.flags&128)!==0,g;if((g=u)||(g=e!==null&&e.memoizedState===null?!1:(Ke.current&2)!==0),g&&(c=!0,t.flags&=-129),g=(t.flags&32)!==0,t.flags&=-33,e===null){if(Ae){if(c?Yn(t):$n(),(e=He)?(e=rp(e,zt),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:On!==null?{id:Jt,overflow:It}:null,retryLane:536870912,hydrationErrors:null},n=kd(e),n.return=t,t.child=n,it=t,He=null)):e=null,e===null)throw zn(t);return Ic(e)?t.lanes=32:t.lanes=536870912,null}var v=s.children;return s=s.fallback,c?($n(),c=t.mode,v=Ui({mode:"hidden",children:v},c),s=pa(s,c,n,null),v.return=t,s.return=t,v.sibling=s,t.child=v,s=t.child,s.memoizedState=mc(n),s.childLanes=pc(e,g,n),t.memoizedState=hc,fs(null,s)):(Yn(t),gc(t,v))}var T=e.memoizedState;if(T!==null&&(v=T.dehydrated,v!==null)){if(u)t.flags&256?(Yn(t),t.flags&=-257,t=xc(e,t,n)):t.memoizedState!==null?($n(),t.child=e.child,t.flags|=128,t=null):($n(),v=s.fallback,c=t.mode,s=Ui({mode:"visible",children:s.children},c),v=pa(v,c,n,null),v.flags|=2,s.return=t,v.return=t,s.sibling=v,t.child=s,Aa(t,e.child,null,n),s=t.child,s.memoizedState=mc(n),s.childLanes=pc(e,g,n),t.memoizedState=hc,t=fs(null,s));else if(Yn(t),Ic(v)){if(g=v.nextSibling&&v.nextSibling.dataset,g)var V=g.dgst;g=V,s=Error(r(419)),s.stack="",s.digest=g,Pl({value:s,source:null,stack:null}),t=xc(e,t,n)}else if(Ie||el(e,t,n,!1),g=(n&e.childLanes)!==0,Ie||g){if(g=ze,g!==null&&(s=Uf(g,n),s!==0&&s!==T.retryLane))throw T.retryLane=s,ma(e,s),bt(g,e,s),fc;Jc(v)||Zi(),t=xc(e,t,n)}else Jc(v)?(t.flags|=192,t.child=e.child,t=null):(e=T.treeContext,He=Ut(v.nextSibling),it=t,Ae=!0,Bn=null,zt=!1,e!==null&&Od(t,e),t=gc(t,s.children),t.flags|=4096);return t}return c?($n(),v=s.fallback,c=t.mode,T=e.child,V=T.sibling,s=un(T,{mode:"hidden",children:s.children}),s.subtreeFlags=T.subtreeFlags&65011712,V!==null?v=un(V,v):(v=pa(v,c,n,null),v.flags|=2),v.return=t,s.return=t,s.sibling=v,t.child=s,fs(null,s),s=t.child,v=e.child.memoizedState,v===null?v=mc(n):(c=v.cachePool,c!==null?(T=Fe._currentValue,c=c.parent!==T?{parent:T,pool:T}:c):c=Vd(),v={baseLanes:v.baseLanes|n,cachePool:c}),s.memoizedState=v,s.childLanes=pc(e,g,n),t.memoizedState=hc,fs(e.child,s)):(Yn(t),n=e.child,e=n.sibling,n=un(n,{mode:"visible",children:s.children}),n.return=t,n.sibling=null,e!==null&&(g=t.deletions,g===null?(t.deletions=[e],t.flags|=16):g.push(e)),t.child=n,t.memoizedState=null,n)}function gc(e,t){return t=Ui({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Ui(e,t){return e=jt(22,e,null,t),e.lanes=0,e}function xc(e,t,n){return Aa(t,e.child,null,n),e=gc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function em(e,t,n){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),ko(e.return,t,n)}function yc(e,t,n,s,c,u){var g=e.memoizedState;g===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:n,tailMode:c,treeForkCount:u}:(g.isBackwards=t,g.rendering=null,g.renderingStartTime=0,g.last=s,g.tail=n,g.tailMode=c,g.treeForkCount=u)}function tm(e,t,n){var s=t.pendingProps,c=s.revealOrder,u=s.tail;s=s.children;var g=Ke.current,v=(g&2)!==0;if(v?(g=g&1|2,t.flags|=128):g&=1,K(Ke,g),ot(e,t,s,n),s=Ae?Wl:0,!v&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&em(e,n,t);else if(e.tag===19)em(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&&Ci(e)===null&&(c=n),n=n.sibling;n=c,n===null?(c=t.child,t.child=null):(c=n.sibling,n.sibling=null),yc(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&&Ci(e)===null){t.child=c;break}e=c.sibling,c.sibling=n,n=c,c=e}yc(t,!0,n,null,u,s);break;case"together":yc(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function gn(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Qn|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(el(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=un(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=un(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function vc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&vi(e)))}function gy(e,t,n){switch(t.tag){case 3:Ne(t,t.stateNode.containerInfo),Ln(t,Fe,e.memoizedState.cache),ga();break;case 27:case 5:St(t);break;case 4:Ne(t,t.stateNode.containerInfo);break;case 10:Ln(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Go(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(Yn(t),t.flags|=128,null):(n&t.child.childLanes)!==0?Ph(e,t,n):(Yn(t),e=gn(e,t,n),e!==null?e.sibling:null);Yn(t);break;case 19:var c=(e.flags&128)!==0;if(s=(n&t.childLanes)!==0,s||(el(e,t,n,!1),s=(n&t.childLanes)!==0),c){if(s)return tm(e,t,n);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),K(Ke,Ke.current),s)break;return null;case 22:return t.lanes=0,Kh(e,t,n,t.pendingProps);case 24:Ln(t,Fe,e.memoizedState.cache)}return gn(e,t,n)}function nm(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Ie=!0;else{if(!vc(e,n)&&(t.flags&128)===0)return Ie=!1,gy(e,t,n);Ie=(e.flags&131072)!==0}else Ie=!1,Ae&&(t.flags&1048576)!==0&&Dd(t,Wl,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=ba(t.elementType),t.type=e,typeof e=="function")No(e)?(s=Na(e,s),t.tag=1,t=Ih(null,t,e,s,n)):(t.tag=0,t=dc(null,t,e,s,n));else{if(e!=null){var c=e.$$typeof;if(c===Y){t.tag=11,t=Gh(null,t,e,s,n);break e}else if(c===B){t.tag=14,t=Xh(null,t,e,s,n);break e}}throw t=ue(e)||e,Error(r(306,t,""))}}return t;case 0:return dc(e,t,t.type,t.pendingProps,n);case 1:return s=t.type,c=Na(s,t.pendingProps),Ih(e,t,s,c,n);case 3:e:{if(Ne(t,t.stateNode.containerInfo),e===null)throw Error(r(387));s=t.pendingProps;var u=t.memoizedState;c=u.element,Uo(e,t),is(t,s,null,n);var g=t.memoizedState;if(s=g.cache,Ln(t,Fe,s),s!==u.cache&&_o(t,[Fe],n,!0),ss(),s=g.element,u.isDehydrated)if(u={element:s,isDehydrated:!1,cache:g.cache},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){t=Wh(e,t,s,n);break e}else if(s!==c){c=Dt(Error(r(424)),t),Pl(c),t=Wh(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(He=Ut(e.firstChild),it=t,Ae=!0,Bn=null,zt=!0,n=Kd(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(ga(),s===c){t=gn(e,t,n);break e}ot(e,t,s,n)}t=t.child}return t;case 26:return Li(e,t),e===null?(n=hp(t.type,null,t.pendingProps,null))?t.memoizedState=n:Ae||(n=t.type,e=t.pendingProps,s=tr(te.current).createElement(n),s[st]=t,s[mt]=e,ct(s,n,e),at(s),t.stateNode=s):t.memoizedState=hp(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return St(t),e===null&&Ae&&(s=t.stateNode=up(t.type,t.pendingProps,te.current),it=t,zt=!0,c=He,In(t.type)?(Wc=c,He=Ut(s.firstChild)):He=c),ot(e,t,t.pendingProps.children,n),Li(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ae&&((c=s=He)&&(s=Qy(s,t.type,t.pendingProps,zt),s!==null?(t.stateNode=s,it=t,He=Ut(s.firstChild),zt=!1,c=!0):c=!1),c||zn(t)),St(t),c=t.type,u=t.pendingProps,g=e!==null?e.memoizedProps:null,s=u.children,Kc(c,u)?s=null:g!==null&&Kc(c,g)&&(t.flags|=32),t.memoizedState!==null&&(c=Qo(e,t,ry,null,null,n),Es._currentValue=c),Li(e,t),ot(e,t,s,n),t.child;case 6:return e===null&&Ae&&((e=n=He)&&(n=Ky(n,t.pendingProps,zt),n!==null?(t.stateNode=n,it=t,He=null,e=!0):e=!1),e||zn(t)),null;case 13:return Ph(e,t,n);case 4:return Ne(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=Aa(t,null,s,n):ot(e,t,s,n),t.child;case 11:return Gh(e,t,t.type,t.pendingProps,n);case 7:return ot(e,t,t.pendingProps,n),t.child;case 8:return ot(e,t,t.pendingProps.children,n),t.child;case 12:return ot(e,t,t.pendingProps.children,n),t.child;case 10:return s=t.pendingProps,Ln(t,t.type,s.value),ot(e,t,s.children,n),t.child;case 9:return c=t.type._context,s=t.pendingProps.children,ya(t),c=rt(c),s=s(c),t.flags|=1,ot(e,t,s,n),t.child;case 14:return Xh(e,t,t.type,t.pendingProps,n);case 15:return Qh(e,t,t.type,t.pendingProps,n);case 19:return tm(e,t,n);case 31:return py(e,t,n);case 22:return Kh(e,t,n,t.pendingProps);case 24:return ya(t),s=rt(Fe),e===null?(c=Bo(),c===null&&(c=ze,u=Do(),c.pooledCache=u,u.refCount++,u!==null&&(c.pooledCacheLanes|=n),c=u),t.memoizedState={parent:s,cache:c},Lo(t),Ln(t,Fe,c)):((e.lanes&n)!==0&&(Uo(e,t),is(t,null,null,n),ss()),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),Ln(t,Fe,s)):(s=u.cache,Ln(t,Fe,s),s!==c.cache&&_o(t,[Fe],n,!0))),ot(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(r(156,t.tag))}function xn(e){e.flags|=4}function bc(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(Mm())e.flags|=8192;else throw Sa=ji,zo}else e.flags&=-16777217}function am(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!yp(t))if(Mm())e.flags|=8192;else throw Sa=ji,zo}function Hi(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Bf():536870912,e.lanes|=t,dl|=t)}function ds(e,t){if(!Ae)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 Ve(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 xy(e,t,n){var s=t.pendingProps;switch(qo(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ve(t),null;case 1:return Ve(t),null;case 3:return n=t.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),hn(Fe),me(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Pa(t)?xn(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,To())),Ve(t),null;case 26:var c=t.type,u=t.memoizedState;return e===null?(xn(t),u!==null?(Ve(t),am(t,u)):(Ve(t),bc(t,c,null,s,n))):u?u!==e.memoizedState?(xn(t),Ve(t),am(t,u)):(Ve(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&xn(t),Ve(t),bc(t,c,e,s,n)),null;case 27:if(_a(t),n=te.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&xn(t);else{if(!s){if(t.stateNode===null)throw Error(r(166));return Ve(t),null}e=_.current,Pa(t)?Bd(t):(e=up(c,s,n),t.stateNode=e,xn(t))}return Ve(t),null;case 5:if(_a(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&xn(t);else{if(!s){if(t.stateNode===null)throw Error(r(166));return Ve(t),null}if(u=_.current,Pa(t))Bd(t);else{var g=tr(te.current);switch(u){case 1:u=g.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:u=g.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":u=g.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":u=g.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":u=g.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof s.is=="string"?g.createElement("select",{is:s.is}):g.createElement("select"),s.multiple?u.multiple=!0:s.size&&(u.size=s.size);break;default:u=typeof s.is=="string"?g.createElement(c,{is:s.is}):g.createElement(c)}}u[st]=t,u[mt]=s;e:for(g=t.child;g!==null;){if(g.tag===5||g.tag===6)u.appendChild(g.stateNode);else if(g.tag!==4&&g.tag!==27&&g.child!==null){g.child.return=g,g=g.child;continue}if(g===t)break e;for(;g.sibling===null;){if(g.return===null||g.return===t)break e;g=g.return}g.sibling.return=g.return,g=g.sibling}t.stateNode=u;e:switch(ct(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&&xn(t)}}return Ve(t),bc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&xn(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(r(166));if(e=te.current,Pa(t)){if(e=t.stateNode,n=t.memoizedProps,s=null,c=it,c!==null)switch(c.tag){case 27:case 5:s=c.memoizedProps}e[st]=t,e=!!(e.nodeValue===n||s!==null&&s.suppressHydrationWarning===!0||Pm(e.nodeValue,n)),e||zn(t,!0)}else e=tr(e).createTextNode(s),e[st]=t,t.stateNode=e}return Ve(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(s=Pa(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[st]=t}else ga(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ve(t),e=!1}else n=To(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(wt(t),t):(wt(t),null);if((t.flags&128)!==0)throw Error(r(558))}return Ve(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=Pa(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[st]=t}else ga(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ve(t),c=!1}else c=To(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(wt(t),t):(wt(t),null)}return wt(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),Hi(t,t.updateQueue),Ve(t),null);case 4:return me(),e===null&&Yc(t.stateNode.containerInfo),Ve(t),null;case 10:return hn(t.type),Ve(t),null;case 19:if(O(Ke),s=t.memoizedState,s===null)return Ve(t),null;if(c=(t.flags&128)!==0,u=s.rendering,u===null)if(c)ds(s,!1);else{if(Xe!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=Ci(e),u!==null){for(t.flags|=128,ds(s,!1),e=u.updateQueue,t.updateQueue=e,Hi(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Rd(n,e),n=n.sibling;return K(Ke,Ke.current&1|2),Ae&&fn(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&tt()>Xi&&(t.flags|=128,c=!0,ds(s,!1),t.lanes=4194304)}else{if(!c)if(e=Ci(u),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,Hi(t,e),ds(s,!0),s.tail===null&&s.tailMode==="hidden"&&!u.alternate&&!Ae)return Ve(t),null}else 2*tt()-s.renderingStartTime>Xi&&n!==536870912&&(t.flags|=128,c=!0,ds(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=tt(),e.sibling=null,n=Ke.current,K(Ke,c?n&1|2:n&1),Ae&&fn(t,s.treeForkCount),e):(Ve(t),null);case 22:case 23:return wt(t),$o(),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&&(Ve(t),t.subtreeFlags&6&&(t.flags|=8192)):Ve(t),n=t.updateQueue,n!==null&&Hi(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&&O(va),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),hn(Fe),Ve(t),null;case 25:return null;case 30:return null}throw Error(r(156,t.tag))}function yy(e,t){switch(qo(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return hn(Fe),me(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return _a(t),null;case 31:if(t.memoizedState!==null){if(wt(t),t.alternate===null)throw Error(r(340));ga()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(wt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));ga()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return O(Ke),null;case 4:return me(),null;case 10:return hn(t.type),null;case 22:case 23:return wt(t),$o(),e!==null&&O(va),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return hn(Fe),null;case 25:return null;default:return null}}function lm(e,t){switch(qo(t),t.tag){case 3:hn(Fe),me();break;case 26:case 27:case 5:_a(t);break;case 4:me();break;case 31:t.memoizedState!==null&&wt(t);break;case 13:wt(t);break;case 19:O(Ke);break;case 10:hn(t.type);break;case 22:case 23:wt(t),$o(),e!==null&&O(va);break;case 24:hn(Fe)}}function hs(e,t){try{var n=t.updateQueue,s=n!==null?n.lastEffect:null;if(s!==null){var c=s.next;n=c;do{if((n.tag&e)===e){s=void 0;var u=n.create,g=n.inst;s=u(),g.destroy=s}n=n.next}while(n!==c)}}catch(v){ke(t,t.return,v)}}function Gn(e,t,n){try{var s=t.updateQueue,c=s!==null?s.lastEffect:null;if(c!==null){var u=c.next;s=u;do{if((s.tag&e)===e){var g=s.inst,v=g.destroy;if(v!==void 0){g.destroy=void 0,c=t;var T=n,V=v;try{V()}catch(Z){ke(c,T,Z)}}}s=s.next}while(s!==u)}}catch(Z){ke(t,t.return,Z)}}function sm(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Fd(t,n)}catch(s){ke(e,e.return,s)}}}function im(e,t,n){n.props=Na(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(s){ke(e,t,s)}}function ms(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){ke(e,t,c)}}function Wt(e,t){var n=e.ref,s=e.refCleanup;if(n!==null)if(typeof s=="function")try{s()}catch(c){ke(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){ke(e,t,c)}else n.current=null}function rm(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){ke(e,e.return,c)}}function Sc(e,t,n){try{var s=e.stateNode;Hy(s,e.type,n,t),s[mt]=t}catch(c){ke(e,e.return,c)}}function om(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&In(e.type)||e.tag===4}function Ac(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||om(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&&In(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 jc(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=on));else if(s!==4&&(s===27&&In(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(jc(e,t,n),e=e.sibling;e!==null;)jc(e,t,n),e=e.sibling}function Vi(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&&In(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Vi(e,t,n),e=e.sibling;e!==null;)Vi(e,t,n),e=e.sibling}function cm(e){var t=e.stateNode,n=e.memoizedProps;try{for(var s=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);ct(t,s,n),t[st]=e,t[mt]=n}catch(u){ke(e,e.return,u)}}var yn=!1,We=!1,Nc=!1,um=typeof WeakSet=="function"?WeakSet:Set,lt=null;function vy(e,t){if(e=e.containerInfo,Xc=or,e=Ad(e),xo(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var s=n.getSelection&&n.getSelection();if(s&&s.rangeCount!==0){n=s.anchorNode;var c=s.anchorOffset,u=s.focusNode;s=s.focusOffset;try{n.nodeType,u.nodeType}catch{n=null;break e}var g=0,v=-1,T=-1,V=0,Z=0,I=e,$=null;t:for(;;){for(var X;I!==n||c!==0&&I.nodeType!==3||(v=g+c),I!==u||s!==0&&I.nodeType!==3||(T=g+s),I.nodeType===3&&(g+=I.nodeValue.length),(X=I.firstChild)!==null;)$=I,I=X;for(;;){if(I===e)break t;if($===n&&++V===c&&(v=g),$===u&&++Z===s&&(T=g),(X=I.nextSibling)!==null)break;I=$,$=I.parentNode}I=X}n=v===-1||T===-1?null:{start:v,end:T}}else n=null}n=n||{start:0,end:0}}else n=null;for(Qc={focusedElem:e,selectionRange:n},or=!1,lt=t;lt!==null;)if(t=lt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,lt=e;else for(;lt!==null;){switch(t=lt,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 re=Na(n.type,c);e=s.getSnapshotBeforeUpdate(re,u),s.__reactInternalSnapshotBeforeUpdate=e}catch(de){ke(n,n.return,de)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)Fc(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Fc(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,lt=e;break}lt=t.return}}function fm(e,t,n){var s=n.flags;switch(n.tag){case 0:case 11:case 15:bn(e,n),s&4&&hs(5,n);break;case 1:if(bn(e,n),s&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(g){ke(n,n.return,g)}else{var c=Na(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(g){ke(n,n.return,g)}}s&64&&sm(n),s&512&&ms(n,n.return);break;case 3:if(bn(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{Fd(e,t)}catch(g){ke(n,n.return,g)}}break;case 27:t===null&&s&4&&cm(n);case 26:case 5:bn(e,n),t===null&&s&4&&rm(n),s&512&&ms(n,n.return);break;case 12:bn(e,n);break;case 31:bn(e,n),s&4&&mm(e,n);break;case 13:bn(e,n),s&4&&pm(e,n),s&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=qy.bind(null,n),Zy(e,n))));break;case 22:if(s=n.memoizedState!==null||yn,!s){t=t!==null&&t.memoizedState!==null||We,c=yn;var u=We;yn=s,(We=t)&&!u?Sn(e,n,(n.subtreeFlags&8772)!==0):bn(e,n),yn=c,We=u}break;case 30:break;default:bn(e,n)}}function dm(e){var t=e.alternate;t!==null&&(e.alternate=null,dm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Pr(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 Ye=null,gt=!1;function vn(e,t,n){for(n=n.child;n!==null;)hm(e,t,n),n=n.sibling}function hm(e,t,n){if(Le&&typeof Le.onCommitFiberUnmount=="function")try{Le.onCommitFiberUnmount(Qe,n)}catch{}switch(n.tag){case 26:We||Wt(n,t),vn(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:We||Wt(n,t);var s=Ye,c=gt;In(n.type)&&(Ye=n.stateNode,gt=!1),vn(e,t,n),js(n.stateNode),Ye=s,gt=c;break;case 5:We||Wt(n,t);case 6:if(s=Ye,c=gt,Ye=null,vn(e,t,n),Ye=s,gt=c,Ye!==null)if(gt)try{(Ye.nodeType===9?Ye.body:Ye.nodeName==="HTML"?Ye.ownerDocument.body:Ye).removeChild(n.stateNode)}catch(u){ke(n,t,u)}else try{Ye.removeChild(n.stateNode)}catch(u){ke(n,t,u)}break;case 18:Ye!==null&&(gt?(e=Ye,sp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),bl(e)):sp(Ye,n.stateNode));break;case 4:s=Ye,c=gt,Ye=n.stateNode.containerInfo,gt=!0,vn(e,t,n),Ye=s,gt=c;break;case 0:case 11:case 14:case 15:Gn(2,n,t),We||Gn(4,n,t),vn(e,t,n);break;case 1:We||(Wt(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"&&im(n,t,s)),vn(e,t,n);break;case 21:vn(e,t,n);break;case 22:We=(s=We)||n.memoizedState!==null,vn(e,t,n),We=s;break;default:vn(e,t,n)}}function mm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{bl(e)}catch(n){ke(t,t.return,n)}}}function pm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{bl(e)}catch(n){ke(t,t.return,n)}}function by(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new um),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new um),t;default:throw Error(r(435,e.tag))}}function Yi(e,t){var n=by(e);t.forEach(function(s){if(!n.has(s)){n.add(s);var c=My.bind(null,e,s);s.then(c,c)}})}function xt(e,t){var n=t.deletions;if(n!==null)for(var s=0;s<n.length;s++){var c=n[s],u=e,g=t,v=g;e:for(;v!==null;){switch(v.tag){case 27:if(In(v.type)){Ye=v.stateNode,gt=!1;break e}break;case 5:Ye=v.stateNode,gt=!1;break e;case 3:case 4:Ye=v.stateNode.containerInfo,gt=!0;break e}v=v.return}if(Ye===null)throw Error(r(160));hm(u,g,c),Ye=null,gt=!1,u=c.alternate,u!==null&&(u.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)gm(t,e),t=t.sibling}var Gt=null;function gm(e,t){var n=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:xt(t,e),yt(e),s&4&&(Gn(3,e,e.return),hs(3,e),Gn(5,e,e.return));break;case 1:xt(t,e),yt(e),s&512&&(We||n===null||Wt(n,n.return)),s&64&&yn&&(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=Gt;if(xt(t,e),yt(e),s&512&&(We||n===null||Wt(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[Vl]||u[st]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=c.createElement(s),c.head.insertBefore(u,c.querySelector("head > title"))),ct(u,s,n),u[st]=e,at(u),s=u;break e;case"link":var g=gp("link","href",c).get(s+(n.href||""));if(g){for(var v=0;v<g.length;v++)if(u=g[v],u.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&u.getAttribute("rel")===(n.rel==null?null:n.rel)&&u.getAttribute("title")===(n.title==null?null:n.title)&&u.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){g.splice(v,1);break t}}u=c.createElement(s),ct(u,s,n),c.head.appendChild(u);break;case"meta":if(g=gp("meta","content",c).get(s+(n.content||""))){for(v=0;v<g.length;v++)if(u=g[v],u.getAttribute("content")===(n.content==null?null:""+n.content)&&u.getAttribute("name")===(n.name==null?null:n.name)&&u.getAttribute("property")===(n.property==null?null:n.property)&&u.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&u.getAttribute("charset")===(n.charSet==null?null:n.charSet)){g.splice(v,1);break t}}u=c.createElement(s),ct(u,s,n),c.head.appendChild(u);break;default:throw Error(r(468,s))}u[st]=e,at(u),s=u}e.stateNode=s}else xp(c,e.type,e.stateNode);else e.stateNode=pp(c,s,e.memoizedProps);else u!==s?(u===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):u.count--,s===null?xp(c,e.type,e.stateNode):pp(c,s,e.memoizedProps)):s===null&&e.stateNode!==null&&Sc(e,e.memoizedProps,n.memoizedProps)}break;case 27:xt(t,e),yt(e),s&512&&(We||n===null||Wt(n,n.return)),n!==null&&s&4&&Sc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(xt(t,e),yt(e),s&512&&(We||n===null||Wt(n,n.return)),e.flags&32){c=e.stateNode;try{$a(c,"")}catch(re){ke(e,e.return,re)}}s&4&&e.stateNode!=null&&(c=e.memoizedProps,Sc(e,c,n!==null?n.memoizedProps:c)),s&1024&&(Nc=!0);break;case 6:if(xt(t,e),yt(e),s&4){if(e.stateNode===null)throw Error(r(162));s=e.memoizedProps,n=e.stateNode;try{n.nodeValue=s}catch(re){ke(e,e.return,re)}}break;case 3:if(lr=null,c=Gt,Gt=nr(t.containerInfo),xt(t,e),Gt=c,yt(e),s&4&&n!==null&&n.memoizedState.isDehydrated)try{bl(t.containerInfo)}catch(re){ke(e,e.return,re)}Nc&&(Nc=!1,xm(e));break;case 4:s=Gt,Gt=nr(e.stateNode.containerInfo),xt(t,e),yt(e),Gt=s;break;case 12:xt(t,e),yt(e);break;case 31:xt(t,e),yt(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Yi(e,s)));break;case 13:xt(t,e),yt(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Gi=tt()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Yi(e,s)));break;case 22:c=e.memoizedState!==null;var T=n!==null&&n.memoizedState!==null,V=yn,Z=We;if(yn=V||c,We=Z||T,xt(t,e),We=Z,yn=V,yt(e),s&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(n===null||T||yn||We||wa(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){T=n=t;try{if(u=T.stateNode,c)g=u.style,typeof g.setProperty=="function"?g.setProperty("display","none","important"):g.display="none";else{v=T.stateNode;var I=T.memoizedProps.style,$=I!=null&&I.hasOwnProperty("display")?I.display:null;v.style.display=$==null||typeof $=="boolean"?"":(""+$).trim()}}catch(re){ke(T,T.return,re)}}}else if(t.tag===6){if(n===null){T=t;try{T.stateNode.nodeValue=c?"":T.memoizedProps}catch(re){ke(T,T.return,re)}}}else if(t.tag===18){if(n===null){T=t;try{var X=T.stateNode;c?ip(X,!0):ip(T.stateNode,!1)}catch(re){ke(T,T.return,re)}}}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,Yi(e,n))));break;case 19:xt(t,e),yt(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Yi(e,s)));break;case 30:break;case 21:break;default:xt(t,e),yt(e)}}function yt(e){var t=e.flags;if(t&2){try{for(var n,s=e.return;s!==null;){if(om(s)){n=s;break}s=s.return}if(n==null)throw Error(r(160));switch(n.tag){case 27:var c=n.stateNode,u=Ac(e);Vi(e,u,c);break;case 5:var g=n.stateNode;n.flags&32&&($a(g,""),n.flags&=-33);var v=Ac(e);Vi(e,v,g);break;case 3:case 4:var T=n.stateNode.containerInfo,V=Ac(e);jc(e,V,T);break;default:throw Error(r(161))}}catch(Z){ke(e,e.return,Z)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function xm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;xm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function bn(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)fm(e,t.alternate,t),t=t.sibling}function wa(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Gn(4,t,t.return),wa(t);break;case 1:Wt(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&im(t,t.return,n),wa(t);break;case 27:js(t.stateNode);case 26:case 5:Wt(t,t.return),wa(t);break;case 22:t.memoizedState===null&&wa(t);break;case 30:wa(t);break;default:wa(t)}e=e.sibling}}function Sn(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var s=t.alternate,c=e,u=t,g=u.flags;switch(u.tag){case 0:case 11:case 15:Sn(c,u,n),hs(4,u);break;case 1:if(Sn(c,u,n),s=u,c=s.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(V){ke(s,s.return,V)}if(s=u,c=s.updateQueue,c!==null){var v=s.stateNode;try{var T=c.shared.hiddenCallbacks;if(T!==null)for(c.shared.hiddenCallbacks=null,c=0;c<T.length;c++)Zd(T[c],v)}catch(V){ke(s,s.return,V)}}n&&g&64&&sm(u),ms(u,u.return);break;case 27:cm(u);case 26:case 5:Sn(c,u,n),n&&s===null&&g&4&&rm(u),ms(u,u.return);break;case 12:Sn(c,u,n);break;case 31:Sn(c,u,n),n&&g&4&&mm(c,u);break;case 13:Sn(c,u,n),n&&g&4&&pm(c,u);break;case 22:u.memoizedState===null&&Sn(c,u,n),ms(u,u.return);break;case 30:break;default:Sn(c,u,n)}t=t.sibling}}function wc(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&es(n))}function Ec(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&es(e))}function Xt(e,t,n,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)ym(e,t,n,s),t=t.sibling}function ym(e,t,n,s){var c=t.flags;switch(t.tag){case 0:case 11:case 15:Xt(e,t,n,s),c&2048&&hs(9,t);break;case 1:Xt(e,t,n,s);break;case 3:Xt(e,t,n,s),c&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&es(e)));break;case 12:if(c&2048){Xt(e,t,n,s),e=t.stateNode;try{var u=t.memoizedProps,g=u.id,v=u.onPostCommit;typeof v=="function"&&v(g,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(T){ke(t,t.return,T)}}else Xt(e,t,n,s);break;case 31:Xt(e,t,n,s);break;case 13:Xt(e,t,n,s);break;case 23:break;case 22:u=t.stateNode,g=t.alternate,t.memoizedState!==null?u._visibility&2?Xt(e,t,n,s):ps(e,t):u._visibility&2?Xt(e,t,n,s):(u._visibility|=2,cl(e,t,n,s,(t.subtreeFlags&10256)!==0||!1)),c&2048&&wc(g,t);break;case 24:Xt(e,t,n,s),c&2048&&Ec(t.alternate,t);break;default:Xt(e,t,n,s)}}function cl(e,t,n,s,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var u=e,g=t,v=n,T=s,V=g.flags;switch(g.tag){case 0:case 11:case 15:cl(u,g,v,T,c),hs(8,g);break;case 23:break;case 22:var Z=g.stateNode;g.memoizedState!==null?Z._visibility&2?cl(u,g,v,T,c):ps(u,g):(Z._visibility|=2,cl(u,g,v,T,c)),c&&V&2048&&wc(g.alternate,g);break;case 24:cl(u,g,v,T,c),c&&V&2048&&Ec(g.alternate,g);break;default:cl(u,g,v,T,c)}t=t.sibling}}function ps(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:ps(n,s),c&2048&&wc(s.alternate,s);break;case 24:ps(n,s),c&2048&&Ec(s.alternate,s);break;default:ps(n,s)}t=t.sibling}}var gs=8192;function ul(e,t,n){if(e.subtreeFlags&gs)for(e=e.child;e!==null;)vm(e,t,n),e=e.sibling}function vm(e,t,n){switch(e.tag){case 26:ul(e,t,n),e.flags&gs&&e.memoizedState!==null&&iv(n,Gt,e.memoizedState,e.memoizedProps);break;case 5:ul(e,t,n);break;case 3:case 4:var s=Gt;Gt=nr(e.stateNode.containerInfo),ul(e,t,n),Gt=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=gs,gs=16777216,ul(e,t,n),gs=s):ul(e,t,n));break;default:ul(e,t,n)}}function bm(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 xs(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];lt=s,Am(s,e)}bm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Sm(e),e=e.sibling}function Sm(e){switch(e.tag){case 0:case 11:case 15:xs(e),e.flags&2048&&Gn(9,e,e.return);break;case 3:xs(e);break;case 12:xs(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,$i(e)):xs(e);break;default:xs(e)}}function $i(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];lt=s,Am(s,e)}bm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Gn(8,t,t.return),$i(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,$i(t));break;default:$i(t)}e=e.sibling}}function Am(e,t){for(;lt!==null;){var n=lt;switch(n.tag){case 0:case 11:case 15:Gn(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var s=n.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:es(n.memoizedState.cache)}if(s=n.child,s!==null)s.return=n,lt=s;else e:for(n=e;lt!==null;){s=lt;var c=s.sibling,u=s.return;if(dm(s),s===n){lt=null;break e}if(c!==null){c.return=u,lt=c;break e}lt=u}}}var Sy={getCacheForType:function(e){var t=rt(Fe),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return rt(Fe).controller.signal}},Ay=typeof WeakMap=="function"?WeakMap:Map,Te=0,ze=null,ye=null,be=0,Re=0,Et=null,Xn=!1,fl=!1,Cc=!1,An=0,Xe=0,Qn=0,Ea=0,qc=0,Ct=0,dl=0,ys=null,vt=null,Mc=!1,Gi=0,jm=0,Xi=1/0,Qi=null,Kn=null,nt=0,Zn=null,hl=null,jn=0,Tc=0,Rc=null,Nm=null,vs=0,kc=null;function qt(){return(Te&2)!==0&&be!==0?be&-be:z.T!==null?Lc():Hf()}function wm(){if(Ct===0)if((be&536870912)===0||Ae){var e=ei;ei<<=1,(ei&3932160)===0&&(ei=262144),Ct=e}else Ct=536870912;return e=Nt.current,e!==null&&(e.flags|=32),Ct}function bt(e,t,n){(e===ze&&(Re===2||Re===9)||e.cancelPendingCommit!==null)&&(ml(e,0),Fn(e,be,Ct,!1)),Hl(e,n),((Te&2)===0||e!==ze)&&(e===ze&&((Te&2)===0&&(Ea|=n),Xe===4&&Fn(e,be,Ct,!1)),Pt(e))}function Em(e,t,n){if((Te&6)!==0)throw Error(r(327));var s=!n&&(t&127)===0&&(t&e.expiredLanes)===0||Ul(e,t),c=s?wy(e,t):Dc(e,t,!0),u=s;do{if(c===0){fl&&!s&&Fn(e,t,0,!1);break}else{if(n=e.current.alternate,u&&!jy(n)){c=Dc(e,t,!1),u=!1;continue}if(c===2){if(u=t,e.errorRecoveryDisabledLanes&u)var g=0;else g=e.pendingLanes&-536870913,g=g!==0?g:g&536870912?536870912:0;if(g!==0){t=g;e:{var v=e;c=ys;var T=v.current.memoizedState.isDehydrated;if(T&&(ml(v,g).flags|=256),g=Dc(v,g,!1),g!==2){if(Cc&&!T){v.errorRecoveryDisabledLanes|=u,Ea|=u,c=4;break e}u=vt,vt=c,u!==null&&(vt===null?vt=u:vt.push.apply(vt,u))}c=g}if(u=!1,c!==2)continue}}if(c===1){ml(e,0),Fn(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:Fn(s,t,Ct,!Xn);break e;case 2:vt=null;break;case 3:case 5:break;default:throw Error(r(329))}if((t&62914560)===t&&(c=Gi+300-tt(),10<c)){if(Fn(s,t,Ct,!Xn),ni(s,0,!0)!==0)break e;jn=t,s.timeoutHandle=ap(Cm.bind(null,s,n,vt,Qi,Mc,t,Ct,Ea,dl,Xn,u,"Throttled",-0,0),c);break e}Cm(s,n,vt,Qi,Mc,t,Ct,Ea,dl,Xn,u,null,-0,0)}}break}while(!0);Pt(e)}function Cm(e,t,n,s,c,u,g,v,T,V,Z,I,$,X){if(e.timeoutHandle=-1,I=t.subtreeFlags,I&8192||(I&16785408)===16785408){I={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:on},vm(t,u,I);var re=(u&62914560)===u?Gi-tt():(u&4194048)===u?jm-tt():0;if(re=rv(I,re),re!==null){jn=u,e.cancelPendingCommit=re(Om.bind(null,e,t,u,n,s,c,g,v,T,Z,I,null,$,X)),Fn(e,u,g,!V);return}}Om(e,t,u,n,s,c,g,v,T)}function jy(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(!At(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 Fn(e,t,n,s){t&=~qc,t&=~Ea,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var c=t;0<c;){var u=31-Ce(c),g=1<<u;s[u]=-1,c&=~g}n!==0&&zf(e,n,t)}function Ki(){return(Te&6)===0?(bs(0),!1):!0}function _c(){if(ye!==null){if(Re===0)var e=ye.return;else e=ye,dn=xa=null,Fo(e),ll=null,ns=0,e=ye;for(;e!==null;)lm(e.alternate,e),e=e.return;ye=null}}function ml(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,$y(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),jn=0,_c(),ze=e,ye=n=un(e.current,null),be=t,Re=0,Et=null,Xn=!1,fl=Ul(e,t),Cc=!1,dl=Ct=qc=Ea=Qn=Xe=0,vt=ys=null,Mc=!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-Ce(s),u=1<<c;t|=e[c],s&=~u}return An=t,mi(),n}function qm(e,t){ge=null,z.H=us,t===al||t===Ai?(t=Gd(),Re=3):t===zo?(t=Gd(),Re=4):Re=t===fc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Et=t,ye===null&&(Xe=1,Bi(e,Dt(t,e.current)))}function Mm(){var e=Nt.current;return e===null?!0:(be&4194048)===be?Lt===null:(be&62914560)===be||(be&536870912)!==0?e===Lt:!1}function Tm(){var e=z.H;return z.H=us,e===null?us:e}function Rm(){var e=z.A;return z.A=Sy,e}function Zi(){Xe=4,Xn||(be&4194048)!==be&&Nt.current!==null||(fl=!0),(Qn&134217727)===0&&(Ea&134217727)===0||ze===null||Fn(ze,be,Ct,!1)}function Dc(e,t,n){var s=Te;Te|=2;var c=Tm(),u=Rm();(ze!==e||be!==t)&&(Qi=null,ml(e,t)),t=!1;var g=Xe;e:do try{if(Re!==0&&ye!==null){var v=ye,T=Et;switch(Re){case 8:_c(),g=6;break e;case 3:case 2:case 9:case 6:Nt.current===null&&(t=!0);var V=Re;if(Re=0,Et=null,pl(e,v,T,V),n&&fl){g=0;break e}break;default:V=Re,Re=0,Et=null,pl(e,v,T,V)}}Ny(),g=Xe;break}catch(Z){qm(e,Z)}while(!0);return t&&e.shellSuspendCounter++,dn=xa=null,Te=s,z.H=c,z.A=u,ye===null&&(ze=null,be=0,mi()),g}function Ny(){for(;ye!==null;)km(ye)}function wy(e,t){var n=Te;Te|=2;var s=Tm(),c=Rm();ze!==e||be!==t?(Qi=null,Xi=tt()+500,ml(e,t)):fl=Ul(e,t);e:do try{if(Re!==0&&ye!==null){t=ye;var u=Et;t:switch(Re){case 1:Re=0,Et=null,pl(e,t,u,1);break;case 2:case 9:if(Yd(u)){Re=0,Et=null,_m(t);break}t=function(){Re!==2&&Re!==9||ze!==e||(Re=7),Pt(e)},u.then(t,t);break e;case 3:Re=7;break e;case 4:Re=5;break e;case 7:Yd(u)?(Re=0,Et=null,_m(t)):(Re=0,Et=null,pl(e,t,u,7));break;case 5:var g=null;switch(ye.tag){case 26:g=ye.memoizedState;case 5:case 27:var v=ye;if(g?yp(g):v.stateNode.complete){Re=0,Et=null;var T=v.sibling;if(T!==null)ye=T;else{var V=v.return;V!==null?(ye=V,Fi(V)):ye=null}break t}}Re=0,Et=null,pl(e,t,u,5);break;case 6:Re=0,Et=null,pl(e,t,u,6);break;case 8:_c(),Xe=6;break e;default:throw Error(r(462))}}Ey();break}catch(Z){qm(e,Z)}while(!0);return dn=xa=null,z.H=s,z.A=c,Te=n,ye!==null?0:(ze=null,be=0,mi(),Xe)}function Ey(){for(;ye!==null&&!Oa();)km(ye)}function km(e){var t=nm(e.alternate,e,An);e.memoizedProps=e.pendingProps,t===null?Fi(e):ye=t}function _m(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Jh(n,t,t.pendingProps,t.type,void 0,be);break;case 11:t=Jh(n,t,t.pendingProps,t.type.render,t.ref,be);break;case 5:Fo(t);default:lm(n,t),t=ye=Rd(t,An),t=nm(n,t,An)}e.memoizedProps=e.pendingProps,t===null?Fi(e):ye=t}function pl(e,t,n,s){dn=xa=null,Fo(t),ll=null,ns=0;var c=t.return;try{if(my(e,c,t,n,be)){Xe=1,Bi(e,Dt(n,e.current)),ye=null;return}}catch(u){if(c!==null)throw ye=c,u;Xe=1,Bi(e,Dt(n,e.current)),ye=null;return}t.flags&32768?(Ae||s===1?e=!0:fl||(be&536870912)!==0?e=!1:(Xn=e=!0,(s===2||s===9||s===3||s===6)&&(s=Nt.current,s!==null&&s.tag===13&&(s.flags|=16384))),Dm(t,e)):Fi(t)}function Fi(e){var t=e;do{if((t.flags&32768)!==0){Dm(t,Xn);return}e=t.return;var n=xy(t.alternate,t,An);if(n!==null){ye=n;return}if(t=t.sibling,t!==null){ye=t;return}ye=t=e}while(t!==null);Xe===0&&(Xe=5)}function Dm(e,t){do{var n=yy(e.alternate,e);if(n!==null){n.flags&=32767,ye=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){ye=e;return}ye=e=n}while(e!==null);Xe=6,ye=null}function Om(e,t,n,s,c,u,g,v,T){e.cancelPendingCommit=null;do Ji();while(nt!==0);if((Te&6)!==0)throw Error(r(327));if(t!==null){if(t===e.current)throw Error(r(177));if(u=t.lanes|t.childLanes,u|=Ao,sx(e,n,u,g,v,T),e===ze&&(ye=ze=null,be=0),hl=t,Zn=e,jn=n,Tc=u,Rc=c,Nm=s,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Ty(Ba,function(){return Hm(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||s){s=z.T,z.T=null,c=ee.p,ee.p=2,g=Te,Te|=4;try{vy(e,t,n)}finally{Te=g,ee.p=c,z.T=s}}nt=1,Bm(),zm(),Lm()}}function Bm(){if(nt===1){nt=0;var e=Zn,t=hl,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=z.T,z.T=null;var s=ee.p;ee.p=2;var c=Te;Te|=4;try{gm(t,e);var u=Qc,g=Ad(e.containerInfo),v=u.focusedElem,T=u.selectionRange;if(g!==v&&v&&v.ownerDocument&&Sd(v.ownerDocument.documentElement,v)){if(T!==null&&xo(v)){var V=T.start,Z=T.end;if(Z===void 0&&(Z=V),"selectionStart"in v)v.selectionStart=V,v.selectionEnd=Math.min(Z,v.value.length);else{var I=v.ownerDocument||document,$=I&&I.defaultView||window;if($.getSelection){var X=$.getSelection(),re=v.textContent.length,de=Math.min(T.start,re),Be=T.end===void 0?de:Math.min(T.end,re);!X.extend&&de>Be&&(g=Be,Be=de,de=g);var D=bd(v,de),R=bd(v,Be);if(D&&R&&(X.rangeCount!==1||X.anchorNode!==D.node||X.anchorOffset!==D.offset||X.focusNode!==R.node||X.focusOffset!==R.offset)){var H=I.createRange();H.setStart(D.node,D.offset),X.removeAllRanges(),de>Be?(X.addRange(H),X.extend(R.node,R.offset)):(H.setEnd(R.node,R.offset),X.addRange(H))}}}}for(I=[],X=v;X=X.parentNode;)X.nodeType===1&&I.push({element:X,left:X.scrollLeft,top:X.scrollTop});for(typeof v.focus=="function"&&v.focus(),v=0;v<I.length;v++){var J=I[v];J.element.scrollLeft=J.left,J.element.scrollTop=J.top}}or=!!Xc,Qc=Xc=null}finally{Te=c,ee.p=s,z.T=n}}e.current=t,nt=2}}function zm(){if(nt===2){nt=0;var e=Zn,t=hl,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=z.T,z.T=null;var s=ee.p;ee.p=2;var c=Te;Te|=4;try{fm(e,t.alternate,t)}finally{Te=c,ee.p=s,z.T=n}}nt=3}}function Lm(){if(nt===4||nt===3){nt=0,Bl();var e=Zn,t=hl,n=jn,s=Nm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?nt=5:(nt=0,hl=Zn=null,Um(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(Kn=null),Ir(n),t=t.stateNode,Le&&typeof Le.onCommitFiberRoot=="function")try{Le.onCommitFiberRoot(Qe,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=z.T,c=ee.p,ee.p=2,z.T=null;try{for(var u=e.onRecoverableError,g=0;g<s.length;g++){var v=s[g];u(v.value,{componentStack:v.stack})}}finally{z.T=t,ee.p=c}}(jn&3)!==0&&Ji(),Pt(e),c=e.pendingLanes,(n&261930)!==0&&(c&42)!==0?e===kc?vs++:(vs=0,kc=e):vs=0,bs(0)}}function Um(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,es(t)))}function Ji(){return Bm(),zm(),Lm(),Hm()}function Hm(){if(nt!==5)return!1;var e=Zn,t=Tc;Tc=0;var n=Ir(jn),s=z.T,c=ee.p;try{ee.p=32>n?32:n,z.T=null,n=Rc,Rc=null;var u=Zn,g=jn;if(nt=0,hl=Zn=null,jn=0,(Te&6)!==0)throw Error(r(331));var v=Te;if(Te|=4,Sm(u.current),ym(u,u.current,g,n),Te=v,bs(0,!1),Le&&typeof Le.onPostCommitFiberRoot=="function")try{Le.onPostCommitFiberRoot(Qe,u)}catch{}return!0}finally{ee.p=c,z.T=s,Um(e,t)}}function Vm(e,t,n){t=Dt(n,t),t=uc(e.stateNode,t,2),e=Vn(e,t,2),e!==null&&(Hl(e,2),Pt(e))}function ke(e,t,n){if(e.tag===3)Vm(e,e,n);else for(;t!==null;){if(t.tag===3){Vm(t,e,n);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Kn===null||!Kn.has(s))){e=Dt(n,e),n=Yh(2),s=Vn(t,n,2),s!==null&&($h(n,s,t,e),Hl(s,2),Pt(s));break}}t=t.return}}function Oc(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new Ay;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)||(Cc=!0,c.add(n),e=Cy.bind(null,e,t,n),t.then(e,e))}function Cy(e,t,n){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,ze===e&&(be&n)===n&&(Xe===4||Xe===3&&(be&62914560)===be&&300>tt()-Gi?(Te&2)===0&&ml(e,0):qc|=n,dl===be&&(dl=0)),Pt(e)}function Ym(e,t){t===0&&(t=Bf()),e=ma(e,t),e!==null&&(Hl(e,t),Pt(e))}function qy(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Ym(e,n)}function My(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),Ym(e,n)}function Ty(e,t){return ra(e,t)}var Ii=null,gl=null,Bc=!1,Wi=!1,zc=!1,Jn=0;function Pt(e){e!==gl&&e.next===null&&(gl===null?Ii=gl=e:gl=gl.next=e),Wi=!0,Bc||(Bc=!0,ky())}function bs(e,t){if(!zc&&Wi){zc=!0;do for(var n=!1,s=Ii;s!==null;){if(e!==0){var c=s.pendingLanes;if(c===0)var u=0;else{var g=s.suspendedLanes,v=s.pingedLanes;u=(1<<31-Ce(42|e)+1)-1,u&=c&~(g&~v),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(n=!0,Qm(s,u))}else u=be,u=ni(s,s===ze?u:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(u&3)===0||Ul(s,u)||(n=!0,Qm(s,u));s=s.next}while(n);zc=!1}}function Ry(){$m()}function $m(){Wi=Bc=!1;var e=0;Jn!==0&&Yy()&&(e=Jn);for(var t=tt(),n=null,s=Ii;s!==null;){var c=s.next,u=Gm(s,t);u===0?(s.next=null,n===null?Ii=c:n.next=c,c===null&&(gl=n)):(n=s,(e!==0||(u&3)!==0)&&(Wi=!0)),s=c}nt!==0&&nt!==5||bs(e),Jn!==0&&(Jn=0)}function Gm(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,c=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var g=31-Ce(u),v=1<<g,T=c[g];T===-1?((v&n)===0||(v&s)!==0)&&(c[g]=lx(v,t)):T<=t&&(e.expiredLanes|=v),u&=~v}if(t=ze,n=be,n=ni(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,n===0||e===t&&(Re===2||Re===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&sn(s),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||Ul(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(s!==null&&sn(s),Ir(n)){case 2:case 8:n=Ll;break;case 32:n=Ba;break;case 268435456:n=Is;break;default:n=Ba}return s=Xm.bind(null,e),n=ra(n,s),e.callbackPriority=t,e.callbackNode=n,t}return s!==null&&s!==null&&sn(s),e.callbackPriority=2,e.callbackNode=null,2}function Xm(e,t){if(nt!==0&&nt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Ji()&&e.callbackNode!==n)return null;var s=be;return s=ni(e,e===ze?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(Em(e,s,t),Gm(e,tt()),e.callbackNode!=null&&e.callbackNode===n?Xm.bind(null,e):null)}function Qm(e,t){if(Ji())return null;Em(e,t,!0)}function ky(){Gy(function(){(Te&6)!==0?ra(oa,Ry):$m()})}function Lc(){if(Jn===0){var e=tl;e===0&&(e=Ps,Ps<<=1,(Ps&261888)===0&&(Ps=256)),Jn=e}return Jn}function Km(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:ii(""+e)}function Zm(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 _y(e,t,n,s,c){if(t==="submit"&&n&&n.stateNode===c){var u=Km((c[mt]||null).action),g=s.submitter;g&&(t=(t=g[mt]||null)?Km(t.formAction):g.getAttribute("formAction"),t!==null&&(u=t,g=null));var v=new ui("action","action",null,s,c);e.push({event:v,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(Jn!==0){var T=g?Zm(c,g):new FormData(c);lc(n,{pending:!0,data:T,method:c.method,action:u},null,T)}}else typeof u=="function"&&(v.preventDefault(),T=g?Zm(c,g):new FormData(c),lc(n,{pending:!0,data:T,method:c.method,action:u},u,T))},currentTarget:c}]})}}for(var Uc=0;Uc<So.length;Uc++){var Hc=So[Uc],Dy=Hc.toLowerCase(),Oy=Hc[0].toUpperCase()+Hc.slice(1);$t(Dy,"on"+Oy)}$t(wd,"onAnimationEnd"),$t(Ed,"onAnimationIteration"),$t(Cd,"onAnimationStart"),$t("dblclick","onDoubleClick"),$t("focusin","onFocus"),$t("focusout","onBlur"),$t(Ix,"onTransitionRun"),$t(Wx,"onTransitionStart"),$t(Px,"onTransitionCancel"),$t(qd,"onTransitionEnd"),Va("onMouseEnter",["mouseout","mouseover"]),Va("onMouseLeave",["mouseout","mouseover"]),Va("onPointerEnter",["pointerout","pointerover"]),Va("onPointerLeave",["pointerout","pointerover"]),ua("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ua("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ua("onBeforeInput",["compositionend","keypress","textInput","paste"]),ua("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ua("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ua("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ss="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(" "),By=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ss));function Fm(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var s=e[n],c=s.event;s=s.listeners;e:{var u=void 0;if(t)for(var g=s.length-1;0<=g;g--){var v=s[g],T=v.instance,V=v.currentTarget;if(v=v.listener,T!==u&&c.isPropagationStopped())break e;u=v,c.currentTarget=V;try{u(c)}catch(Z){hi(Z)}c.currentTarget=null,u=T}else for(g=0;g<s.length;g++){if(v=s[g],T=v.instance,V=v.currentTarget,v=v.listener,T!==u&&c.isPropagationStopped())break e;u=v,c.currentTarget=V;try{u(c)}catch(Z){hi(Z)}c.currentTarget=null,u=T}}}}function ve(e,t){var n=t[Wr];n===void 0&&(n=t[Wr]=new Set);var s=e+"__bubble";n.has(s)||(Jm(t,e,2,!1),n.add(s))}function Vc(e,t,n){var s=0;t&&(s|=4),Jm(n,e,s,t)}var Pi="_reactListening"+Math.random().toString(36).slice(2);function Yc(e){if(!e[Pi]){e[Pi]=!0,$f.forEach(function(n){n!=="selectionchange"&&(By.has(n)||Vc(n,!1,e),Vc(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Pi]||(t[Pi]=!0,Vc("selectionchange",!1,t))}}function Jm(e,t,n,s){switch(wp(t)){case 2:var c=uv;break;case 8:c=fv;break;default:c=au}n=c.bind(null,t,n,e),c=void 0,!ro||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 $c(e,t,n,s,c){var u=s;if((t&1)===0&&(t&2)===0&&s!==null)e:for(;;){if(s===null)return;var g=s.tag;if(g===3||g===4){var v=s.stateNode.containerInfo;if(v===c)break;if(g===4)for(g=s.return;g!==null;){var T=g.tag;if((T===3||T===4)&&g.stateNode.containerInfo===c)return;g=g.return}for(;v!==null;){if(g=La(v),g===null)return;if(T=g.tag,T===5||T===6||T===26||T===27){s=u=g;continue e}v=v.parentNode}}s=s.return}td(function(){var V=u,Z=so(n),I=[];e:{var $=Md.get(e);if($!==void 0){var X=ui,re=e;switch(e){case"keypress":if(oi(n)===0)break e;case"keydown":case"keyup":X=Mx;break;case"focusin":re="focus",X=fo;break;case"focusout":re="blur",X=fo;break;case"beforeblur":case"afterblur":X=fo;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":X=ld;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":X=xx;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":X=kx;break;case wd:case Ed:case Cd:X=bx;break;case qd:X=Dx;break;case"scroll":case"scrollend":X=px;break;case"wheel":X=Bx;break;case"copy":case"cut":case"paste":X=Ax;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":X=id;break;case"toggle":case"beforetoggle":X=Lx}var de=(t&4)!==0,Be=!de&&(e==="scroll"||e==="scrollend"),D=de?$!==null?$+"Capture":null:$;de=[];for(var R=V,H;R!==null;){var J=R;if(H=J.stateNode,J=J.tag,J!==5&&J!==26&&J!==27||H===null||D===null||(J=$l(R,D),J!=null&&de.push(As(R,J,H))),Be)break;R=R.return}0<de.length&&($=new X($,re,null,n,Z),I.push({event:$,listeners:de}))}}if((t&7)===0){e:{if($=e==="mouseover"||e==="pointerover",X=e==="mouseout"||e==="pointerout",$&&n!==lo&&(re=n.relatedTarget||n.fromElement)&&(La(re)||re[za]))break e;if((X||$)&&($=Z.window===Z?Z:($=Z.ownerDocument)?$.defaultView||$.parentWindow:window,X?(re=n.relatedTarget||n.toElement,X=V,re=re?La(re):null,re!==null&&(Be=d(re),de=re.tag,re!==Be||de!==5&&de!==27&&de!==6)&&(re=null)):(X=null,re=V),X!==re)){if(de=ld,J="onMouseLeave",D="onMouseEnter",R="mouse",(e==="pointerout"||e==="pointerover")&&(de=id,J="onPointerLeave",D="onPointerEnter",R="pointer"),Be=X==null?$:Yl(X),H=re==null?$:Yl(re),$=new de(J,R+"leave",X,n,Z),$.target=Be,$.relatedTarget=H,J=null,La(Z)===V&&(de=new de(D,R+"enter",re,n,Z),de.target=H,de.relatedTarget=Be,J=de),Be=J,X&&re)t:{for(de=zy,D=X,R=re,H=0,J=D;J;J=de(J))H++;J=0;for(var fe=R;fe;fe=de(fe))J++;for(;0<H-J;)D=de(D),H--;for(;0<J-H;)R=de(R),J--;for(;H--;){if(D===R||R!==null&&D===R.alternate){de=D;break t}D=de(D),R=de(R)}de=null}else de=null;X!==null&&Im(I,$,X,de,!1),re!==null&&Be!==null&&Im(I,Be,re,de,!0)}}e:{if($=V?Yl(V):window,X=$.nodeName&&$.nodeName.toLowerCase(),X==="select"||X==="input"&&$.type==="file")var qe=md;else if(dd($))if(pd)qe=Zx;else{qe=Qx;var oe=Xx}else X=$.nodeName,!X||X.toLowerCase()!=="input"||$.type!=="checkbox"&&$.type!=="radio"?V&&ao(V.elementType)&&(qe=md):qe=Kx;if(qe&&(qe=qe(e,V))){hd(I,qe,n,Z);break e}oe&&oe(e,$,V),e==="focusout"&&V&&$.type==="number"&&V.memoizedProps.value!=null&&no($,"number",$.value)}switch(oe=V?Yl(V):window,e){case"focusin":(dd(oe)||oe.contentEditable==="true")&&(Ka=oe,yo=V,Il=null);break;case"focusout":Il=yo=Ka=null;break;case"mousedown":vo=!0;break;case"contextmenu":case"mouseup":case"dragend":vo=!1,jd(I,n,Z);break;case"selectionchange":if(Jx)break;case"keydown":case"keyup":jd(I,n,Z)}var xe;if(mo)e:{switch(e){case"compositionstart":var Se="onCompositionStart";break e;case"compositionend":Se="onCompositionEnd";break e;case"compositionupdate":Se="onCompositionUpdate";break e}Se=void 0}else Qa?ud(e,n)&&(Se="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(Se="onCompositionStart");Se&&(rd&&n.locale!=="ko"&&(Qa||Se!=="onCompositionStart"?Se==="onCompositionEnd"&&Qa&&(xe=nd()):(Dn=Z,oo="value"in Dn?Dn.value:Dn.textContent,Qa=!0)),oe=er(V,Se),0<oe.length&&(Se=new sd(Se,e,null,n,Z),I.push({event:Se,listeners:oe}),xe?Se.data=xe:(xe=fd(n),xe!==null&&(Se.data=xe)))),(xe=Hx?Vx(e,n):Yx(e,n))&&(Se=er(V,"onBeforeInput"),0<Se.length&&(oe=new sd("onBeforeInput","beforeinput",null,n,Z),I.push({event:oe,listeners:Se}),oe.data=xe)),_y(I,e,V,n,Z)}Fm(I,t)})}function As(e,t,n){return{instance:e,listener:t,currentTarget:n}}function er(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=$l(e,n),c!=null&&s.unshift(As(e,c,u)),c=$l(e,t),c!=null&&s.push(As(e,c,u))),e.tag===3)return s;e=e.return}return[]}function zy(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Im(e,t,n,s,c){for(var u=t._reactName,g=[];n!==null&&n!==s;){var v=n,T=v.alternate,V=v.stateNode;if(v=v.tag,T!==null&&T===s)break;v!==5&&v!==26&&v!==27||V===null||(T=V,c?(V=$l(n,u),V!=null&&g.unshift(As(n,V,T))):c||(V=$l(n,u),V!=null&&g.push(As(n,V,T)))),n=n.return}g.length!==0&&e.push({event:t,listeners:g})}var Ly=/\r\n?/g,Uy=/\u0000|\uFFFD/g;function Wm(e){return(typeof e=="string"?e:""+e).replace(Ly,`
|
||
`).replace(Uy,"")}function Pm(e,t){return t=Wm(t),Wm(e)===t}function Oe(e,t,n,s,c,u){switch(n){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||$a(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&$a(e,""+s);break;case"className":li(e,"class",s);break;case"tabIndex":li(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":li(e,n,s);break;case"style":Pf(e,s,u);break;case"data":if(t!=="object"){li(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=ii(""+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"&&Oe(e,t,"name",c.name,c,null),Oe(e,t,"formEncType",c.formEncType,c,null),Oe(e,t,"formMethod",c.formMethod,c,null),Oe(e,t,"formTarget",c.formTarget,c,null)):(Oe(e,t,"encType",c.encType,c,null),Oe(e,t,"method",c.method,c,null),Oe(e,t,"target",c.target,c,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(n);break}s=ii(""+s),e.setAttribute(n,s);break;case"onClick":s!=null&&(e.onclick=on);break;case"onScroll":s!=null&&ve("scroll",e);break;case"onScrollEnd":s!=null&&ve("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=ii(""+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":ve("beforetoggle",e),ve("toggle",e),ai(e,"popover",s);break;case"xlinkActuate":rn(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":rn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":rn(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":rn(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":rn(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":rn(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":rn(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":rn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":rn(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":ai(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=hx.get(n)||n,ai(e,n,s))}}function Gc(e,t,n,s,c,u){switch(n){case"style":Pf(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"?$a(e,s):(typeof s=="number"||typeof s=="bigint")&&$a(e,""+s);break;case"onScroll":s!=null&&ve("scroll",e);break;case"onScrollEnd":s!=null&&ve("scrollend",e);break;case"onClick":s!=null&&(e.onclick=on);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Gf.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[mt]||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,""):ai(e,n,s)}}}function ct(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ve("error",e),ve("load",e);var s=!1,c=!1,u;for(u in n)if(n.hasOwnProperty(u)){var g=n[u];if(g!=null)switch(u){case"src":s=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:Oe(e,t,u,g,n,null)}}c&&Oe(e,t,"srcSet",n.srcSet,n,null),s&&Oe(e,t,"src",n.src,n,null);return;case"input":ve("invalid",e);var v=u=g=c=null,T=null,V=null;for(s in n)if(n.hasOwnProperty(s)){var Z=n[s];if(Z!=null)switch(s){case"name":c=Z;break;case"type":g=Z;break;case"checked":T=Z;break;case"defaultChecked":V=Z;break;case"value":u=Z;break;case"defaultValue":v=Z;break;case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(r(137,t));break;default:Oe(e,t,s,Z,n,null)}}Ff(e,u,v,T,V,g,c,!1);return;case"select":ve("invalid",e),s=g=u=null;for(c in n)if(n.hasOwnProperty(c)&&(v=n[c],v!=null))switch(c){case"value":u=v;break;case"defaultValue":g=v;break;case"multiple":s=v;default:Oe(e,t,c,v,n,null)}t=u,n=g,e.multiple=!!s,t!=null?Ya(e,!!s,t,!1):n!=null&&Ya(e,!!s,n,!0);return;case"textarea":ve("invalid",e),u=c=s=null;for(g in n)if(n.hasOwnProperty(g)&&(v=n[g],v!=null))switch(g){case"value":s=v;break;case"defaultValue":c=v;break;case"children":u=v;break;case"dangerouslySetInnerHTML":if(v!=null)throw Error(r(91));break;default:Oe(e,t,g,v,n,null)}If(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:Oe(e,t,T,s,n,null)}return;case"dialog":ve("beforetoggle",e),ve("toggle",e),ve("cancel",e),ve("close",e);break;case"iframe":case"object":ve("load",e);break;case"video":case"audio":for(s=0;s<Ss.length;s++)ve(Ss[s],e);break;case"image":ve("error",e),ve("load",e);break;case"details":ve("toggle",e);break;case"embed":case"source":case"link":ve("error",e),ve("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(V in n)if(n.hasOwnProperty(V)&&(s=n[V],s!=null))switch(V){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:Oe(e,t,V,s,n,null)}return;default:if(ao(t)){for(Z in n)n.hasOwnProperty(Z)&&(s=n[Z],s!==void 0&&Gc(e,t,Z,s,n,void 0));return}}for(v in n)n.hasOwnProperty(v)&&(s=n[v],s!=null&&Oe(e,t,v,s,n,null))}function Hy(e,t,n,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,u=null,g=null,v=null,T=null,V=null,Z=null;for(X in n){var I=n[X];if(n.hasOwnProperty(X)&&I!=null)switch(X){case"checked":break;case"value":break;case"defaultValue":T=I;default:s.hasOwnProperty(X)||Oe(e,t,X,null,s,I)}}for(var $ in s){var X=s[$];if(I=n[$],s.hasOwnProperty($)&&(X!=null||I!=null))switch($){case"type":u=X;break;case"name":c=X;break;case"checked":V=X;break;case"defaultChecked":Z=X;break;case"value":g=X;break;case"defaultValue":v=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(r(137,t));break;default:X!==I&&Oe(e,t,$,X,s,I)}}to(e,g,v,T,V,Z,u,c);return;case"select":X=g=v=$=null;for(u in n)if(T=n[u],n.hasOwnProperty(u)&&T!=null)switch(u){case"value":break;case"multiple":X=T;default:s.hasOwnProperty(u)||Oe(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":$=u;break;case"defaultValue":v=u;break;case"multiple":g=u;default:u!==T&&Oe(e,t,c,u,s,T)}t=v,n=g,s=X,$!=null?Ya(e,!!n,$,!1):!!s!=!!n&&(t!=null?Ya(e,!!n,t,!0):Ya(e,!!n,n?[]:"",!1));return;case"textarea":X=$=null;for(v in n)if(c=n[v],n.hasOwnProperty(v)&&c!=null&&!s.hasOwnProperty(v))switch(v){case"value":break;case"children":break;default:Oe(e,t,v,null,s,c)}for(g in s)if(c=s[g],u=n[g],s.hasOwnProperty(g)&&(c!=null||u!=null))switch(g){case"value":$=c;break;case"defaultValue":X=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(r(91));break;default:c!==u&&Oe(e,t,g,c,s,u)}Jf(e,$,X);return;case"option":for(var re in n)if($=n[re],n.hasOwnProperty(re)&&$!=null&&!s.hasOwnProperty(re))switch(re){case"selected":e.selected=!1;break;default:Oe(e,t,re,null,s,$)}for(T in s)if($=s[T],X=n[T],s.hasOwnProperty(T)&&$!==X&&($!=null||X!=null))switch(T){case"selected":e.selected=$&&typeof $!="function"&&typeof $!="symbol";break;default:Oe(e,t,T,$,s,X)}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 de in n)$=n[de],n.hasOwnProperty(de)&&$!=null&&!s.hasOwnProperty(de)&&Oe(e,t,de,null,s,$);for(V in s)if($=s[V],X=n[V],s.hasOwnProperty(V)&&$!==X&&($!=null||X!=null))switch(V){case"children":case"dangerouslySetInnerHTML":if($!=null)throw Error(r(137,t));break;default:Oe(e,t,V,$,s,X)}return;default:if(ao(t)){for(var Be in n)$=n[Be],n.hasOwnProperty(Be)&&$!==void 0&&!s.hasOwnProperty(Be)&&Gc(e,t,Be,void 0,s,$);for(Z in s)$=s[Z],X=n[Z],!s.hasOwnProperty(Z)||$===X||$===void 0&&X===void 0||Gc(e,t,Z,$,s,X);return}}for(var D in n)$=n[D],n.hasOwnProperty(D)&&$!=null&&!s.hasOwnProperty(D)&&Oe(e,t,D,null,s,$);for(I in s)$=s[I],X=n[I],!s.hasOwnProperty(I)||$===X||$==null&&X==null||Oe(e,t,I,$,s,X)}function ep(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Vy(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),s=0;s<n.length;s++){var c=n[s],u=c.transferSize,g=c.initiatorType,v=c.duration;if(u&&v&&ep(g)){for(g=0,v=c.responseEnd,s+=1;s<n.length;s++){var T=n[s],V=T.startTime;if(V>v)break;var Z=T.transferSize,I=T.initiatorType;Z&&ep(I)&&(T=T.responseEnd,g+=Z*(T<v?1:(v-V)/(T-V)))}if(--s,t+=8*(u+g)/(c.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Xc=null,Qc=null;function tr(e){return e.nodeType===9?e:e.ownerDocument}function tp(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 np(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 Kc(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 Zc=null;function Yy(){var e=window.event;return e&&e.type==="popstate"?e===Zc?!1:(Zc=e,!0):(Zc=null,!1)}var ap=typeof setTimeout=="function"?setTimeout:void 0,$y=typeof clearTimeout=="function"?clearTimeout:void 0,lp=typeof Promise=="function"?Promise:void 0,Gy=typeof queueMicrotask=="function"?queueMicrotask:typeof lp<"u"?function(e){return lp.resolve(null).then(e).catch(Xy)}:ap;function Xy(e){setTimeout(function(){throw e})}function In(e){return e==="head"}function sp(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),bl(t);return}s--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")s++;else if(n==="html")js(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,js(n);for(var u=n.firstChild;u;){var g=u.nextSibling,v=u.nodeName;u[Vl]||v==="SCRIPT"||v==="STYLE"||v==="LINK"&&u.rel.toLowerCase()==="stylesheet"||n.removeChild(u),u=g}}else n==="body"&&js(e.ownerDocument.body);n=c}while(n);bl(t)}function ip(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 Fc(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":Fc(n),Pr(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function Qy(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[Vl])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=Ut(e.nextSibling),e===null)break}return null}function Ky(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Ut(e.nextSibling),e===null))return null;return e}function rp(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Ut(e.nextSibling),e===null))return null;return e}function Jc(e){return e.data==="$?"||e.data==="$~"}function Ic(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Zy(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 Ut(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 Wc=null;function op(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return Ut(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function cp(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 up(e,t,n){switch(t=tr(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 js(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Pr(e)}var Ht=new Map,fp=new Set;function nr(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Nn=ee.d;ee.d={f:Fy,r:Jy,D:Iy,C:Wy,L:Py,m:ev,X:nv,S:tv,M:av};function Fy(){var e=Nn.f(),t=Ki();return e||t}function Jy(e){var t=Ua(e);t!==null&&t.tag===5&&t.type==="form"?qh(t):Nn.r(e)}var xl=typeof document>"u"?null:document;function dp(e,t,n){var s=xl;if(s&&typeof t=="string"&&t){var c=kt(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof n=="string"&&(c+='[crossorigin="'+n+'"]'),fp.has(c)||(fp.add(c),e={rel:e,crossOrigin:n,href:t},s.querySelector(c)===null&&(t=s.createElement("link"),ct(t,"link",e),at(t),s.head.appendChild(t)))}}function Iy(e){Nn.D(e),dp("dns-prefetch",e,null)}function Wy(e,t){Nn.C(e,t),dp("preconnect",e,t)}function Py(e,t,n){Nn.L(e,t,n);var s=xl;if(s&&e&&t){var c='link[rel="preload"][as="'+kt(t)+'"]';t==="image"&&n&&n.imageSrcSet?(c+='[imagesrcset="'+kt(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(c+='[imagesizes="'+kt(n.imageSizes)+'"]')):c+='[href="'+kt(e)+'"]';var u=c;switch(t){case"style":u=yl(e);break;case"script":u=vl(e)}Ht.has(u)||(e=S({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Ht.set(u,e),s.querySelector(c)!==null||t==="style"&&s.querySelector(Ns(u))||t==="script"&&s.querySelector(ws(u))||(t=s.createElement("link"),ct(t,"link",e),at(t),s.head.appendChild(t)))}}function ev(e,t){Nn.m(e,t);var n=xl;if(n&&e){var s=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+kt(s)+'"][href="'+kt(e)+'"]',u=c;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=vl(e)}if(!Ht.has(u)&&(e=S({rel:"modulepreload",href:e},t),Ht.set(u,e),n.querySelector(c)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(ws(u)))return}s=n.createElement("link"),ct(s,"link",e),at(s),n.head.appendChild(s)}}}function tv(e,t,n){Nn.S(e,t,n);var s=xl;if(s&&e){var c=Ha(s).hoistableStyles,u=yl(e);t=t||"default";var g=c.get(u);if(!g){var v={loading:0,preload:null};if(g=s.querySelector(Ns(u)))v.loading=5;else{e=S({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Ht.get(u))&&Pc(e,n);var T=g=s.createElement("link");at(T),ct(T,"link",e),T._p=new Promise(function(V,Z){T.onload=V,T.onerror=Z}),T.addEventListener("load",function(){v.loading|=1}),T.addEventListener("error",function(){v.loading|=2}),v.loading|=4,ar(g,t,s)}g={type:"stylesheet",instance:g,count:1,state:v},c.set(u,g)}}}function nv(e,t){Nn.X(e,t);var n=xl;if(n&&e){var s=Ha(n).hoistableScripts,c=vl(e),u=s.get(c);u||(u=n.querySelector(ws(c)),u||(e=S({src:e,async:!0},t),(t=Ht.get(c))&&eu(e,t),u=n.createElement("script"),at(u),ct(u,"link",e),n.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},s.set(c,u))}}function av(e,t){Nn.M(e,t);var n=xl;if(n&&e){var s=Ha(n).hoistableScripts,c=vl(e),u=s.get(c);u||(u=n.querySelector(ws(c)),u||(e=S({src:e,async:!0,type:"module"},t),(t=Ht.get(c))&&eu(e,t),u=n.createElement("script"),at(u),ct(u,"link",e),n.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},s.set(c,u))}}function hp(e,t,n,s){var c=(c=te.current)?nr(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=yl(n.href),n=Ha(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=yl(n.href);var u=Ha(c).hoistableStyles,g=u.get(e);if(g||(c=c.ownerDocument||c,g={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,g),(u=c.querySelector(Ns(e)))&&!u._p&&(g.instance=u,g.state.loading=5),Ht.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},Ht.set(e,n),u||lv(c,e,n,g.state))),t&&s===null)throw Error(r(528,""));return g}if(t&&s!==null)throw Error(r(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=vl(n),n=Ha(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 yl(e){return'href="'+kt(e)+'"'}function Ns(e){return'link[rel="stylesheet"]['+e+"]"}function mp(e){return S({},e,{"data-precedence":e.precedence,precedence:null})}function lv(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}),ct(t,"link",n),at(t),e.head.appendChild(t))}function vl(e){return'[src="'+kt(e)+'"]'}function ws(e){return"script[async]"+e}function pp(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+kt(n.href)+'"]');if(s)return t.instance=s,at(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"),at(s),ct(s,"style",c),ar(s,n.precedence,e),t.instance=s;case"stylesheet":c=yl(n.href);var u=e.querySelector(Ns(c));if(u)return t.state.loading|=4,t.instance=u,at(u),u;s=mp(n),(c=Ht.get(c))&&Pc(s,c),u=(e.ownerDocument||e).createElement("link"),at(u);var g=u;return g._p=new Promise(function(v,T){g.onload=v,g.onerror=T}),ct(u,"link",s),t.state.loading|=4,ar(u,n.precedence,e),t.instance=u;case"script":return u=vl(n.src),(c=e.querySelector(ws(u)))?(t.instance=c,at(c),c):(s=n,(c=Ht.get(u))&&(s=S({},n),eu(s,c)),e=e.ownerDocument||e,c=e.createElement("script"),at(c),ct(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,ar(s,n.precedence,e));return t.instance}function ar(e,t,n){for(var s=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=s.length?s[s.length-1]:null,u=c,g=0;g<s.length;g++){var v=s[g];if(v.dataset.precedence===t)u=v;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 Pc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function eu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var lr=null;function gp(e,t,n){if(lr===null){var s=new Map,c=lr=new Map;c.set(n,s)}else c=lr,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[Vl]||u[st]||e==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var g=u.getAttribute(t)||"";g=e+g;var v=s.get(g);v?v.push(u):s.set(g,[u])}}return s}function xp(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function sv(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 yp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function iv(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=yl(s.href),u=t.querySelector(Ns(c));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=sr.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=u,at(u);return}u=t.ownerDocument||t,s=mp(s),(c=Ht.get(c))&&Pc(s,c),u=u.createElement("link"),at(u);var g=u;g._p=new Promise(function(v,T){g.onload=v,g.onerror=T}),ct(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=sr.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var tu=0;function rv(e,t){return e.stylesheets&&e.count===0&&rr(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var s=setTimeout(function(){if(e.stylesheets&&rr(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&tu===0&&(tu=62500*Vy());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&rr(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>tu?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(c)}}:null}function sr(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)rr(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var ir=null;function rr(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ir=new Map,t.forEach(ov,e),ir=null,sr.call(e))}function ov(e,t){if(!(t.state.loading&4)){var n=ir.get(e);if(n)var s=n.get(null);else{n=new Map,ir.set(e,n);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<c.length;u++){var g=c[u];(g.nodeName==="LINK"||g.getAttribute("media")!=="not all")&&(n.set(g.dataset.precedence,g),s=g)}s&&n.set(null,s)}c=t.instance,g=c.getAttribute("data-precedence"),u=n.get(g)||s,u===s&&n.set(null,c),n.set(g,c),this.count++,s=sr.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 Es={$$typeof:k,Provider:null,Consumer:null,_currentValue:ae,_currentValue2:ae,_threadCount:0};function cv(e,t,n,s,c,u,g,v,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=Fr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Fr(0),this.hiddenUpdates=Fr(null),this.identifierPrefix=s,this.onUncaughtError=c,this.onCaughtError=u,this.onRecoverableError=g,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=T,this.incompleteTransitions=new Map}function vp(e,t,n,s,c,u,g,v,T,V,Z,I){return e=new cv(e,t,n,g,T,V,Z,I,v),t=1,u===!0&&(t|=24),u=jt(3,null,null,t),e.current=u,u.stateNode=e,t=Do(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:s,isDehydrated:n,cache:t},Lo(u),e}function bp(e){return e?(e=Ja,e):Ja}function Sp(e,t,n,s,c,u){c=bp(c),s.context===null?s.context=c:s.pendingContext=c,s=Hn(t),s.payload={element:n},u=u===void 0?null:u,u!==null&&(s.callback=u),n=Vn(e,s,t),n!==null&&(bt(n,e,t),ls(n,e,t))}function Ap(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function nu(e,t){Ap(e,t),(e=e.alternate)&&Ap(e,t)}function jp(e){if(e.tag===13||e.tag===31){var t=ma(e,67108864);t!==null&&bt(t,e,67108864),nu(e,67108864)}}function Np(e){if(e.tag===13||e.tag===31){var t=qt();t=Jr(t);var n=ma(e,t);n!==null&&bt(n,e,t),nu(e,t)}}var or=!0;function uv(e,t,n,s){var c=z.T;z.T=null;var u=ee.p;try{ee.p=2,au(e,t,n,s)}finally{ee.p=u,z.T=c}}function fv(e,t,n,s){var c=z.T;z.T=null;var u=ee.p;try{ee.p=8,au(e,t,n,s)}finally{ee.p=u,z.T=c}}function au(e,t,n,s){if(or){var c=lu(s);if(c===null)$c(e,t,s,cr,n),Ep(e,s);else if(hv(c,e,t,n,s))s.stopPropagation();else if(Ep(e,s),t&4&&-1<dv.indexOf(e)){for(;c!==null;){var u=Ua(c);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var g=ca(u.pendingLanes);if(g!==0){var v=u;for(v.pendingLanes|=2,v.entangledLanes|=2;g;){var T=1<<31-Ce(g);v.entanglements[1]|=T,g&=~T}Pt(u),(Te&6)===0&&(Xi=tt()+500,bs(0))}}break;case 31:case 13:v=ma(u,2),v!==null&&bt(v,u,2),Ki(),nu(u,2)}if(u=lu(s),u===null&&$c(e,t,s,cr,n),u===c)break;c=u}c!==null&&s.stopPropagation()}else $c(e,t,s,null,n)}}function lu(e){return e=so(e),su(e)}var cr=null;function su(e){if(cr=null,e=La(e),e!==null){var t=d(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=m(t),e!==null)return e;e=null}else if(n===31){if(e=x(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 cr=e,null}function wp(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(zl()){case oa:return 2;case Ll:return 8;case Ba:case Kr:return 32;case Is:return 268435456;default:return 32}default:return 32}}var iu=!1,Wn=null,Pn=null,ea=null,Cs=new Map,qs=new Map,ta=[],dv="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 Ep(e,t){switch(e){case"focusin":case"focusout":Wn=null;break;case"dragenter":case"dragleave":Pn=null;break;case"mouseover":case"mouseout":ea=null;break;case"pointerover":case"pointerout":Cs.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":qs.delete(t.pointerId)}}function Ms(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=Ua(t),t!==null&&jp(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function hv(e,t,n,s,c){switch(t){case"focusin":return Wn=Ms(Wn,e,t,n,s,c),!0;case"dragenter":return Pn=Ms(Pn,e,t,n,s,c),!0;case"mouseover":return ea=Ms(ea,e,t,n,s,c),!0;case"pointerover":var u=c.pointerId;return Cs.set(u,Ms(Cs.get(u)||null,e,t,n,s,c)),!0;case"gotpointercapture":return u=c.pointerId,qs.set(u,Ms(qs.get(u)||null,e,t,n,s,c)),!0}return!1}function Cp(e){var t=La(e.target);if(t!==null){var n=d(t);if(n!==null){if(t=n.tag,t===13){if(t=m(n),t!==null){e.blockedOn=t,Vf(e.priority,function(){Np(n)});return}}else if(t===31){if(t=x(n),t!==null){e.blockedOn=t,Vf(e.priority,function(){Np(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 ur(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=lu(e.nativeEvent);if(n===null){n=e.nativeEvent;var s=new n.constructor(n.type,n);lo=s,n.target.dispatchEvent(s),lo=null}else return t=Ua(n),t!==null&&jp(t),e.blockedOn=n,!1;t.shift()}return!0}function qp(e,t,n){ur(e)&&n.delete(t)}function mv(){iu=!1,Wn!==null&&ur(Wn)&&(Wn=null),Pn!==null&&ur(Pn)&&(Pn=null),ea!==null&&ur(ea)&&(ea=null),Cs.forEach(qp),qs.forEach(qp)}function fr(e,t){e.blockedOn===t&&(e.blockedOn=null,iu||(iu=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,mv)))}var dr=null;function Mp(e){dr!==e&&(dr=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){dr===e&&(dr=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(su(s||n)===null)continue;break}var u=Ua(n);u!==null&&(e.splice(t,3),t-=3,lc(u,{pending:!0,data:c,method:n.method,action:s},s,c))}}))}function bl(e){function t(T){return fr(T,e)}Wn!==null&&fr(Wn,e),Pn!==null&&fr(Pn,e),ea!==null&&fr(ea,e),Cs.forEach(t),qs.forEach(t);for(var n=0;n<ta.length;n++){var s=ta[n];s.blockedOn===e&&(s.blockedOn=null)}for(;0<ta.length&&(n=ta[0],n.blockedOn===null);)Cp(n),n.blockedOn===null&&ta.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(s=0;s<n.length;s+=3){var c=n[s],u=n[s+1],g=c[mt]||null;if(typeof u=="function")g||Mp(n);else if(g){var v=null;if(u&&u.hasAttribute("formAction")){if(c=u,g=u[mt]||null)v=g.formAction;else if(su(c)!==null)continue}else v=g.action;typeof v=="function"?n[s+1]=v:(n.splice(s,3),s-=3),Mp(n)}}}function Tp(){function e(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(g){return c=g})},focusReset:"manual",scroll:"manual"})}function t(){c!==null&&(c(),c=null),s||setTimeout(n,20)}function n(){if(!s&&!navigation.transition){var u=navigation.currentEntry;u&&u.url!=null&&navigation.navigate(u.url,{state:u.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var s=!1,c=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),c!==null&&(c(),c=null)}}}function ru(e){this._internalRoot=e}hr.prototype.render=ru.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));var n=t.current,s=qt();Sp(n,s,e,t,null,null)},hr.prototype.unmount=ru.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Sp(e.current,2,null,e,null,null),Ki(),t[za]=null}};function hr(e){this._internalRoot=e}hr.prototype.unstable_scheduleHydration=function(e){if(e){var t=Hf();e={blockedOn:null,target:e,priority:t};for(var n=0;n<ta.length&&t!==0&&t<ta[n].priority;n++);ta.splice(n,0,e),n===0&&Cp(e)}};var Rp=l.version;if(Rp!=="19.2.0")throw Error(r(527,Rp,"19.2.0"));ee.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=y(t),e=e!==null?b(e):null,e=e===null?null:e.stateNode,e};var pv={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:z,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var mr=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!mr.isDisabled&&mr.supportsFiber)try{Qe=mr.inject(pv),Le=mr}catch{}}return Rs.createRoot=function(e,t){if(!f(e))throw Error(r(299));var n=!1,s="",c=Lh,u=Uh,g=Hh;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onUncaughtError!==void 0&&(c=t.onUncaughtError),t.onCaughtError!==void 0&&(u=t.onCaughtError),t.onRecoverableError!==void 0&&(g=t.onRecoverableError)),t=vp(e,1,!1,null,null,n,s,null,c,u,g,Tp),e[za]=t.current,Yc(e),new ru(t)},Rs.hydrateRoot=function(e,t,n){if(!f(e))throw Error(r(299));var s=!1,c="",u=Lh,g=Uh,v=Hh,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&&(g=n.onCaughtError),n.onRecoverableError!==void 0&&(v=n.onRecoverableError),n.formState!==void 0&&(T=n.formState)),t=vp(e,1,!0,t,n??null,s,c,T,u,g,v,Tp),t.context=bp(null),n=t.current,s=qt(),s=Jr(s),c=Hn(s),c.callback=null,Vn(n,c,s),n=s,t.current.lanes=n,Hl(t,n),Pt(t),e[za]=t.current,Yc(e),new hr(t)},Rs.version="19.2.0",Rs}var Vp;function Ev(){if(Vp)return uu.exports;Vp=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(),uu.exports=wv(),uu.exports}var Cv=Ev();var Yp="popstate";function qv(a={}){function l(r,f){let{pathname:d,search:m,hash:x}=r.location;return zu("",{pathname:d,search:m,hash:x},f.state&&f.state.usr||null,f.state&&f.state.key||"default")}function i(r,f){return typeof f=="string"?f:Vs(f)}return Tv(l,i,null,a)}function $e(a,l){if(a===!1||a===null||typeof a>"u")throw new Error(l)}function Ft(a,l){if(!a){typeof console<"u"&&console.warn(l);try{throw new Error(l)}catch{}}}function Mv(){return Math.random().toString(36).substring(2,10)}function $p(a,l){return{usr:a.state,key:a.key,idx:l}}function zu(a,l,i=null,r){return{pathname:typeof a=="string"?a:a.pathname,search:"",hash:"",...typeof l=="string"?Tl(l):l,state:i,key:l&&l.key||r||Mv()}}function Vs({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 Tl(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 Tv(a,l,i,r={}){let{window:f=document.defaultView,v5Compat:d=!1}=r,m=f.history,x="POP",p=null,y=b();y==null&&(y=0,m.replaceState({...m.state,idx:y},""));function b(){return(m.state||{idx:null}).idx}function S(){x="POP";let A=b(),q=A==null?null:A-y;y=A,p&&p({action:x,location:C.location,delta:q})}function N(A,q){x="PUSH";let w=zu(C.location,A,q);y=b()+1;let k=$p(w,y),Y=C.createHref(w);try{m.pushState(k,"",Y)}catch(L){if(L instanceof DOMException&&L.name==="DataCloneError")throw L;f.location.assign(Y)}d&&p&&p({action:x,location:C.location,delta:1})}function M(A,q){x="REPLACE";let w=zu(C.location,A,q);y=b();let k=$p(w,y),Y=C.createHref(w);m.replaceState(k,"",Y),d&&p&&p({action:x,location:C.location,delta:0})}function j(A){return Rv(A)}let C={get action(){return x},get location(){return a(f,m)},listen(A){if(p)throw new Error("A history only accepts one active listener");return f.addEventListener(Yp,S),p=A,()=>{f.removeEventListener(Yp,S),p=null}},createHref(A){return l(f,A)},createURL:j,encodeLocation(A){let q=j(A);return{pathname:q.pathname,search:q.search,hash:q.hash}},push:N,replace:M,go(A){return m.go(A)}};return C}function Rv(a,l=!1){let i="http://localhost";typeof window<"u"&&(i=window.location.origin!=="null"?window.location.origin:window.location.href),$e(i,"No window.location.(origin|href) available to create URL");let r=typeof a=="string"?a:Vs(a);return r=r.replace(/ $/,"%20"),!l&&r.startsWith("//")&&(r=i+r),new URL(r,i)}function _0(a,l,i="/"){return kv(a,l,i,!1)}function kv(a,l,i,r){let f=typeof l=="string"?Tl(l):l,d=Rn(f.pathname||"/",i);if(d==null)return null;let m=D0(a);_v(m);let x=null;for(let p=0;x==null&&p<m.length;++p){let y=Gv(d);x=Yv(m[p],y,r)}return x}function D0(a,l=[],i=[],r="",f=!1){let d=(m,x,p=f,y)=>{let b={relativePath:y===void 0?m.path||"":y,caseSensitive:m.caseSensitive===!0,childrenIndex:x,route:m};if(b.relativePath.startsWith("/")){if(!b.relativePath.startsWith(r)&&p)return;$e(b.relativePath.startsWith(r),`Absolute route path "${b.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),b.relativePath=b.relativePath.slice(r.length)}let S=Mn([r,b.relativePath]),N=i.concat(b);m.children&&m.children.length>0&&($e(m.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${S}".`),D0(m.children,l,N,S,p)),!(m.path==null&&!m.index)&&l.push({path:S,score:Hv(S,m.index),routesMeta:N})};return a.forEach((m,x)=>{if(m.path===""||!m.path?.includes("?"))d(m,x);else for(let p of O0(m.path))d(m,x,!0,p)}),l}function O0(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 m=O0(r.join("/")),x=[];return x.push(...m.map(p=>p===""?d:[d,p].join("/"))),f&&x.push(...m),x.map(p=>a.startsWith("/")&&p===""?"/":p)}function _v(a){a.sort((l,i)=>l.score!==i.score?i.score-l.score:Vv(l.routesMeta.map(r=>r.childrenIndex),i.routesMeta.map(r=>r.childrenIndex)))}var Dv=/^:[\w-]+$/,Ov=3,Bv=2,zv=1,Lv=10,Uv=-2,Gp=a=>a==="*";function Hv(a,l){let i=a.split("/"),r=i.length;return i.some(Gp)&&(r+=Uv),l&&(r+=Bv),i.filter(f=>!Gp(f)).reduce((f,d)=>f+(Dv.test(d)?Ov:d===""?zv:Lv),r)}function Vv(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 Yv(a,l,i=!1){let{routesMeta:r}=a,f={},d="/",m=[];for(let x=0;x<r.length;++x){let p=r[x],y=x===r.length-1,b=d==="/"?l:l.slice(d.length)||"/",S=Tr({path:p.relativePath,caseSensitive:p.caseSensitive,end:y},b),N=p.route;if(!S&&y&&i&&!r[r.length-1].route.index&&(S=Tr({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},b)),!S)return null;Object.assign(f,S.params),m.push({params:f,pathname:Mn([d,S.pathname]),pathnameBase:Fv(Mn([d,S.pathnameBase])),route:N}),S.pathnameBase!=="/"&&(d=Mn([d,S.pathnameBase]))}return m}function Tr(a,l){typeof a=="string"&&(a={path:a,caseSensitive:!1,end:!0});let[i,r]=$v(a.path,a.caseSensitive,a.end),f=l.match(i);if(!f)return null;let d=f[0],m=d.replace(/(.)\/+$/,"$1"),x=f.slice(1);return{params:r.reduce((y,{paramName:b,isOptional:S},N)=>{if(b==="*"){let j=x[N]||"";m=d.slice(0,d.length-j.length).replace(/(.)\/+$/,"$1")}const M=x[N];return S&&!M?y[b]=void 0:y[b]=(M||"").replace(/%2F/g,"/"),y},{}),pathname:d,pathnameBase:m,pattern:a}}function $v(a,l=!1,i=!0){Ft(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,(m,x,p)=>(r.push({paramName:x,isOptional:p!=null}),p?"/?([^\\/]+)?":"/([^\\/]+)")).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 Gv(a){try{return a.split("/").map(l=>decodeURIComponent(l).replace(/\//g,"%2F")).join("/")}catch(l){return Ft(!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 Rn(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 Xv=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Qv=a=>Xv.test(a);function Kv(a,l="/"){let{pathname:i,search:r="",hash:f=""}=typeof a=="string"?Tl(a):a,d;if(i)if(Qv(i))d=i;else{if(i.includes("//")){let m=i;i=i.replace(/\/\/+/g,"/"),Ft(!1,`Pathnames cannot have embedded double slashes - normalizing ${m} -> ${i}`)}i.startsWith("/")?d=Xp(i.substring(1),"/"):d=Xp(i,l)}else d=l;return{pathname:d,search:Jv(r),hash:Iv(f)}}function Xp(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 mu(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 Zv(a){return a.filter((l,i)=>i===0||l.route.path&&l.route.path.length>0)}function B0(a){let l=Zv(a);return l.map((i,r)=>r===l.length-1?i.pathname:i.pathnameBase)}function z0(a,l,i,r=!1){let f;typeof a=="string"?f=Tl(a):(f={...a},$e(!f.pathname||!f.pathname.includes("?"),mu("?","pathname","search",f)),$e(!f.pathname||!f.pathname.includes("#"),mu("#","pathname","hash",f)),$e(!f.search||!f.search.includes("#"),mu("#","search","hash",f)));let d=a===""||f.pathname==="",m=d?"/":f.pathname,x;if(m==null)x=i;else{let S=l.length-1;if(!r&&m.startsWith("..")){let N=m.split("/");for(;N[0]==="..";)N.shift(),S-=1;f.pathname=N.join("/")}x=S>=0?l[S]:"/"}let p=Kv(f,x),y=m&&m!=="/"&&m.endsWith("/"),b=(d||m===".")&&i.endsWith("/");return!p.pathname.endsWith("/")&&(y||b)&&(p.pathname+="/"),p}var Mn=a=>a.join("/").replace(/\/\/+/g,"/"),Fv=a=>a.replace(/\/+$/,"").replace(/^\/*/,"/"),Jv=a=>!a||a==="?"?"":a.startsWith("?")?a:"?"+a,Iv=a=>!a||a==="#"?"":a.startsWith("#")?a:"#"+a;function Wv(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 L0=["POST","PUT","PATCH","DELETE"];new Set(L0);var Pv=["GET",...L0];new Set(Pv);var Rl=h.createContext(null);Rl.displayName="DataRouter";var zr=h.createContext(null);zr.displayName="DataRouterState";h.createContext(!1);var U0=h.createContext({isTransitioning:!1});U0.displayName="ViewTransition";var eb=h.createContext(new Map);eb.displayName="Fetchers";var tb=h.createContext(null);tb.displayName="Await";var an=h.createContext(null);an.displayName="Navigation";var Qs=h.createContext(null);Qs.displayName="Location";var kn=h.createContext({outlet:null,matches:[],isDataRoute:!1});kn.displayName="Route";var tf=h.createContext(null);tf.displayName="RouteError";function nb(a,{relative:l}={}){$e(Ks(),"useHref() may be used only in the context of a <Router> component.");let{basename:i,navigator:r}=h.useContext(an),{hash:f,pathname:d,search:m}=Zs(a,{relative:l}),x=d;return i!=="/"&&(x=d==="/"?i:Mn([i,d])),r.createHref({pathname:x,search:m,hash:f})}function Ks(){return h.useContext(Qs)!=null}function ka(){return $e(Ks(),"useLocation() may be used only in the context of a <Router> component."),h.useContext(Qs).location}var H0="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function V0(a){h.useContext(an).static||h.useLayoutEffect(a)}function ab(){let{isDataRoute:a}=h.useContext(kn);return a?gb():lb()}function lb(){$e(Ks(),"useNavigate() may be used only in the context of a <Router> component.");let a=h.useContext(Rl),{basename:l,navigator:i}=h.useContext(an),{matches:r}=h.useContext(kn),{pathname:f}=ka(),d=JSON.stringify(B0(r)),m=h.useRef(!1);return V0(()=>{m.current=!0}),h.useCallback((p,y={})=>{if(Ft(m.current,H0),!m.current)return;if(typeof p=="number"){i.go(p);return}let b=z0(p,JSON.parse(d),f,y.relative==="path");a==null&&l!=="/"&&(b.pathname=b.pathname==="/"?l:Mn([l,b.pathname])),(y.replace?i.replace:i.push)(b,y.state,y)},[l,i,d,f,a])}h.createContext(null);function Zs(a,{relative:l}={}){let{matches:i}=h.useContext(kn),{pathname:r}=ka(),f=JSON.stringify(B0(i));return h.useMemo(()=>z0(a,JSON.parse(f),r,l==="path"),[a,f,r,l])}function sb(a,l){return Y0(a,l)}function Y0(a,l,i,r,f){$e(Ks(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:d}=h.useContext(an),{matches:m}=h.useContext(kn),x=m[m.length-1],p=x?x.params:{},y=x?x.pathname:"/",b=x?x.pathnameBase:"/",S=x&&x.route;{let w=S&&S.path||"";$0(y,!S||w.endsWith("*")||w.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${y}" (under <Route path="${w}">) 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="${w}"> to <Route path="${w==="/"?"*":`${w}/*`}">.`)}let N=ka(),M;if(l){let w=typeof l=="string"?Tl(l):l;$e(b==="/"||w.pathname?.startsWith(b),`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 "${b}" but pathname "${w.pathname}" was given in the \`location\` prop.`),M=w}else M=N;let j=M.pathname||"/",C=j;if(b!=="/"){let w=b.replace(/^\//,"").split("/");C="/"+j.replace(/^\//,"").split("/").slice(w.length).join("/")}let A=_0(a,{pathname:C});Ft(S||A!=null,`No routes matched location "${M.pathname}${M.search}${M.hash}" `),Ft(A==null||A[A.length-1].route.element!==void 0||A[A.length-1].route.Component!==void 0||A[A.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=ub(A&&A.map(w=>Object.assign({},w,{params:Object.assign({},p,w.params),pathname:Mn([b,d.encodeLocation?d.encodeLocation(w.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?b:Mn([b,d.encodeLocation?d.encodeLocation(w.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathnameBase])})),m,i,r,f);return l&&q?h.createElement(Qs.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...M},navigationType:"POP"}},q):q}function ib(){let a=pb(),l=Wv(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},m=null;return console.error("Error handled by React Router default ErrorBoundary:",a),m=h.createElement(h.Fragment,null,h.createElement("p",null,"💿 Hey developer 👋"),h.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",h.createElement("code",{style:d},"ErrorBoundary")," or"," ",h.createElement("code",{style:d},"errorElement")," prop on your route.")),h.createElement(h.Fragment,null,h.createElement("h2",null,"Unexpected Application Error!"),h.createElement("h3",{style:{fontStyle:"italic"}},l),i?h.createElement("pre",{style:f},i):null,m)}var rb=h.createElement(ib,null),ob=class extends h.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?h.createElement(kn.Provider,{value:this.props.routeContext},h.createElement(tf.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function cb({routeContext:a,match:l,children:i}){let r=h.useContext(Rl);return r&&r.static&&r.staticContext&&(l.route.errorElement||l.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=l.route.id),h.createElement(kn.Provider,{value:a},i)}function ub(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,m=i?.errors;if(m!=null){let b=d.findIndex(S=>S.route.id&&m?.[S.route.id]!==void 0);$e(b>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(m).join(",")}`),d=d.slice(0,Math.min(d.length,b+1))}let x=!1,p=-1;if(i)for(let b=0;b<d.length;b++){let S=d[b];if((S.route.HydrateFallback||S.route.hydrateFallbackElement)&&(p=b),S.route.id){let{loaderData:N,errors:M}=i,j=S.route.loader&&!N.hasOwnProperty(S.route.id)&&(!M||M[S.route.id]===void 0);if(S.route.lazy||j){x=!0,p>=0?d=d.slice(0,p+1):d=[d[0]];break}}}let y=i&&r?(b,S)=>{r(b,{location:i.location,params:i.matches?.[0]?.params??{},errorInfo:S})}:void 0;return d.reduceRight((b,S,N)=>{let M,j=!1,C=null,A=null;i&&(M=m&&S.route.id?m[S.route.id]:void 0,C=S.route.errorElement||rb,x&&(p<0&&N===0?($0("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),j=!0,A=null):p===N&&(j=!0,A=S.route.hydrateFallbackElement||null)));let q=l.concat(d.slice(0,N+1)),w=()=>{let k;return M?k=C:j?k=A:S.route.Component?k=h.createElement(S.route.Component,null):S.route.element?k=S.route.element:k=b,h.createElement(cb,{match:S,routeContext:{outlet:b,matches:q,isDataRoute:i!=null},children:k})};return i&&(S.route.ErrorBoundary||S.route.errorElement||N===0)?h.createElement(ob,{location:i.location,revalidation:i.revalidation,component:C,error:M,children:w(),routeContext:{outlet:null,matches:q,isDataRoute:!0},onError:y}):w()},null)}function nf(a){return`${a} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function fb(a){let l=h.useContext(Rl);return $e(l,nf(a)),l}function db(a){let l=h.useContext(zr);return $e(l,nf(a)),l}function hb(a){let l=h.useContext(kn);return $e(l,nf(a)),l}function af(a){let l=hb(a),i=l.matches[l.matches.length-1];return $e(i.route.id,`${a} can only be used on routes that contain a unique "id"`),i.route.id}function mb(){return af("useRouteId")}function pb(){let a=h.useContext(tf),l=db("useRouteError"),i=af("useRouteError");return a!==void 0?a:l.errors?.[i]}function gb(){let{router:a}=fb("useNavigate"),l=af("useNavigate"),i=h.useRef(!1);return V0(()=>{i.current=!0}),h.useCallback(async(f,d={})=>{Ft(i.current,H0),i.current&&(typeof f=="number"?a.navigate(f):await a.navigate(f,{fromRouteId:l,...d}))},[a,l])}var Qp={};function $0(a,l,i){!l&&!Qp[a]&&(Qp[a]=!0,Ft(!1,i))}h.memo(xb);function xb({routes:a,future:l,state:i,unstable_onError:r}){return Y0(a,void 0,i,r,l)}function br(a){$e(!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 yb({basename:a="/",children:l=null,location:i,navigationType:r="POP",navigator:f,static:d=!1}){$e(!Ks(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let m=a.replace(/^\/*/,"/"),x=h.useMemo(()=>({basename:m,navigator:f,static:d,future:{}}),[m,f,d]);typeof i=="string"&&(i=Tl(i));let{pathname:p="/",search:y="",hash:b="",state:S=null,key:N="default"}=i,M=h.useMemo(()=>{let j=Rn(p,m);return j==null?null:{location:{pathname:j,search:y,hash:b,state:S,key:N},navigationType:r}},[m,p,y,b,S,N,r]);return Ft(M!=null,`<Router basename="${m}"> is not able to match the URL "${p}${y}${b}" because it does not start with the basename, so the <Router> won't render anything.`),M==null?null:h.createElement(an.Provider,{value:x},h.createElement(Qs.Provider,{children:l,value:M}))}function vb({children:a,location:l}){return sb(Lu(a),l)}function Lu(a,l=[]){let i=[];return h.Children.forEach(a,(r,f)=>{if(!h.isValidElement(r))return;let d=[...l,f];if(r.type===h.Fragment){i.push.apply(i,Lu(r.props.children,d));return}$e(r.type===br,`[${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>`),$e(!r.props.index||!r.props.children,"An index route cannot have child routes.");let m={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&&(m.children=Lu(r.props.children,d)),i.push(m)}),i}var Sr="get",Ar="application/x-www-form-urlencoded";function Lr(a){return a!=null&&typeof a.tagName=="string"}function bb(a){return Lr(a)&&a.tagName.toLowerCase()==="button"}function Sb(a){return Lr(a)&&a.tagName.toLowerCase()==="form"}function Ab(a){return Lr(a)&&a.tagName.toLowerCase()==="input"}function jb(a){return!!(a.metaKey||a.altKey||a.ctrlKey||a.shiftKey)}function Nb(a,l){return a.button===0&&(!l||l==="_self")&&!jb(a)}var pr=null;function wb(){if(pr===null)try{new FormData(document.createElement("form"),0),pr=!1}catch{pr=!0}return pr}var Eb=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function pu(a){return a!=null&&!Eb.has(a)?(Ft(!1,`"${a}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Ar}"`),null):a}function Cb(a,l){let i,r,f,d,m;if(Sb(a)){let x=a.getAttribute("action");r=x?Rn(x,l):null,i=a.getAttribute("method")||Sr,f=pu(a.getAttribute("enctype"))||Ar,d=new FormData(a)}else if(bb(a)||Ab(a)&&(a.type==="submit"||a.type==="image")){let x=a.form;if(x==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let p=a.getAttribute("formaction")||x.getAttribute("action");if(r=p?Rn(p,l):null,i=a.getAttribute("formmethod")||x.getAttribute("method")||Sr,f=pu(a.getAttribute("formenctype"))||pu(x.getAttribute("enctype"))||Ar,d=new FormData(x,a),!wb()){let{name:y,type:b,value:S}=a;if(b==="image"){let N=y?`${y}.`:"";d.append(`${N}x`,"0"),d.append(`${N}y`,"0")}else y&&d.append(y,S)}}else{if(Lr(a))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');i=Sr,r=null,f=Ar,m=a}return d&&f==="text/plain"&&(m=d,d=void 0),{action:r,method:i.toLowerCase(),encType:f,formData:d,body:m}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function lf(a,l){if(a===!1||a===null||typeof a>"u")throw new Error(l)}function qb(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&&Rn(r.pathname,l)==="/"?r.pathname=`${l.replace(/\/$/,"")}/_root.${i}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${i}`,r}async function Mb(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 Tb(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 Rb(a,l,i){let r=await Promise.all(a.map(async f=>{let d=l.routes[f.route.id];if(d){let m=await Mb(d,i);return m.links?m.links():[]}return[]}));return Ob(r.flat(1).filter(Tb).filter(f=>f.rel==="stylesheet"||f.rel==="preload").map(f=>f.rel==="stylesheet"?{...f,rel:"prefetch",as:"style"}:{...f,rel:"prefetch"}))}function Kp(a,l,i,r,f,d){let m=(p,y)=>i[y]?p.route.id!==i[y].route.id:!0,x=(p,y)=>i[y].pathname!==p.pathname||i[y].route.path?.endsWith("*")&&i[y].params["*"]!==p.params["*"];return d==="assets"?l.filter((p,y)=>m(p,y)||x(p,y)):d==="data"?l.filter((p,y)=>{let b=r.routes[p.route.id];if(!b||!b.hasLoader)return!1;if(m(p,y)||x(p,y))return!0;if(p.route.shouldRevalidate){let S=p.route.shouldRevalidate({currentUrl:new URL(f.pathname+f.search+f.hash,window.origin),currentParams:i[0]?.params||{},nextUrl:new URL(a,window.origin),nextParams:p.params,defaultShouldRevalidate:!0});if(typeof S=="boolean")return S}return!0}):[]}function kb(a,l,{includeHydrateFallback:i}={}){return _b(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 _b(a){return[...new Set(a)]}function Db(a){let l={},i=Object.keys(a).sort();for(let r of i)l[r]=a[r];return l}function Ob(a,l){let i=new Set;return new Set(l),a.reduce((r,f)=>{let d=JSON.stringify(Db(f));return i.has(d)||(i.add(d),r.push({key:d,link:f})),r},[])}function G0(){let a=h.useContext(Rl);return lf(a,"You must render this element inside a <DataRouterContext.Provider> element"),a}function Bb(){let a=h.useContext(zr);return lf(a,"You must render this element inside a <DataRouterStateContext.Provider> element"),a}var sf=h.createContext(void 0);sf.displayName="FrameworkContext";function X0(){let a=h.useContext(sf);return lf(a,"You must render this element inside a <HydratedRouter> element"),a}function zb(a,l){let i=h.useContext(sf),[r,f]=h.useState(!1),[d,m]=h.useState(!1),{onFocus:x,onBlur:p,onMouseEnter:y,onMouseLeave:b,onTouchStart:S}=l,N=h.useRef(null);h.useEffect(()=>{if(a==="render"&&m(!0),a==="viewport"){let C=q=>{q.forEach(w=>{m(w.isIntersecting)})},A=new IntersectionObserver(C,{threshold:.5});return N.current&&A.observe(N.current),()=>{A.disconnect()}}},[a]),h.useEffect(()=>{if(r){let C=setTimeout(()=>{m(!0)},100);return()=>{clearTimeout(C)}}},[r]);let M=()=>{f(!0)},j=()=>{f(!1),m(!1)};return i?a!=="intent"?[d,N,{}]:[d,N,{onFocus:ks(x,M),onBlur:ks(p,j),onMouseEnter:ks(y,M),onMouseLeave:ks(b,j),onTouchStart:ks(S,M)}]:[!1,N,{}]}function ks(a,l){return i=>{a&&a(i),i.defaultPrevented||l(i)}}function Lb({page:a,...l}){let{router:i}=G0(),r=h.useMemo(()=>_0(i.routes,a,i.basename),[i.routes,a,i.basename]);return r?h.createElement(Hb,{page:a,matches:r,...l}):null}function Ub(a){let{manifest:l,routeModules:i}=X0(),[r,f]=h.useState([]);return h.useEffect(()=>{let d=!1;return Rb(a,l,i).then(m=>{d||f(m)}),()=>{d=!0}},[a,l,i]),r}function Hb({page:a,matches:l,...i}){let r=ka(),{manifest:f,routeModules:d}=X0(),{basename:m}=G0(),{loaderData:x,matches:p}=Bb(),y=h.useMemo(()=>Kp(a,l,p,f,r,"data"),[a,l,p,f,r]),b=h.useMemo(()=>Kp(a,l,p,f,r,"assets"),[a,l,p,f,r]),S=h.useMemo(()=>{if(a===r.pathname+r.search+r.hash)return[];let j=new Set,C=!1;if(l.forEach(q=>{let w=f.routes[q.route.id];!w||!w.hasLoader||(!y.some(k=>k.route.id===q.route.id)&&q.route.id in x&&d[q.route.id]?.shouldRevalidate||w.hasClientLoader?C=!0:j.add(q.route.id))}),j.size===0)return[];let A=qb(a,m,"data");return C&&j.size>0&&A.searchParams.set("_routes",l.filter(q=>j.has(q.route.id)).map(q=>q.route.id).join(",")),[A.pathname+A.search]},[m,x,r,f,y,l,a,d]),N=h.useMemo(()=>kb(b,f),[b,f]),M=Ub(b);return h.createElement(h.Fragment,null,S.map(j=>h.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...i})),N.map(j=>h.createElement("link",{key:j,rel:"modulepreload",href:j,...i})),M.map(({key:j,link:C})=>h.createElement("link",{key:j,nonce:i.nonce,...C})))}function Vb(...a){return l=>{a.forEach(i=>{typeof i=="function"?i(l):i!=null&&(i.current=l)})}}var Q0=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Q0&&(window.__reactRouterVersion="7.9.6")}catch{}function Yb({basename:a,children:l,window:i}){let r=h.useRef();r.current==null&&(r.current=qv({window:i,v5Compat:!0}));let f=r.current,[d,m]=h.useState({action:f.action,location:f.location}),x=h.useCallback(p=>{h.startTransition(()=>m(p))},[m]);return h.useLayoutEffect(()=>f.listen(x),[f,x]),h.createElement(yb,{basename:a,children:l,location:d.location,navigationType:d.action,navigator:f})}var K0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Z0=h.forwardRef(function({onClick:l,discover:i="render",prefetch:r="none",relative:f,reloadDocument:d,replace:m,state:x,target:p,to:y,preventScrollReset:b,viewTransition:S,...N},M){let{basename:j}=h.useContext(an),C=typeof y=="string"&&K0.test(y),A,q=!1;if(typeof y=="string"&&C&&(A=y,Q0))try{let G=new URL(window.location.href),ne=y.startsWith("//")?new URL(G.protocol+y):new URL(y),Q=Rn(ne.pathname,j);ne.origin===G.origin&&Q!=null?y=Q+ne.search+ne.hash:q=!0}catch{Ft(!1,`<Link to="${y}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let w=nb(y,{relative:f}),[k,Y,L]=zb(r,N),U=Qb(y,{replace:m,state:x,target:p,preventScrollReset:b,relative:f,viewTransition:S});function B(G){l&&l(G),G.defaultPrevented||U(G)}let P=h.createElement("a",{...N,...L,href:A||w,onClick:q||d?l:B,ref:Vb(M,Y),target:p,"data-discover":!C&&i==="render"?"true":void 0});return k&&!C?h.createElement(h.Fragment,null,P,h.createElement(Lb,{page:w})):P});Z0.displayName="Link";var $b=h.forwardRef(function({"aria-current":l="page",caseSensitive:i=!1,className:r="",end:f=!1,style:d,to:m,viewTransition:x,children:p,...y},b){let S=Zs(m,{relative:y.relative}),N=ka(),M=h.useContext(zr),{navigator:j,basename:C}=h.useContext(an),A=M!=null&&Ib(S)&&x===!0,q=j.encodeLocation?j.encodeLocation(S).pathname:S.pathname,w=N.pathname,k=M&&M.navigation&&M.navigation.location?M.navigation.location.pathname:null;i||(w=w.toLowerCase(),k=k?k.toLowerCase():null,q=q.toLowerCase()),k&&C&&(k=Rn(k,C)||k);const Y=q!=="/"&&q.endsWith("/")?q.length-1:q.length;let L=w===q||!f&&w.startsWith(q)&&w.charAt(Y)==="/",U=k!=null&&(k===q||!f&&k.startsWith(q)&&k.charAt(q.length)==="/"),B={isActive:L,isPending:U,isTransitioning:A},P=L?l:void 0,G;typeof r=="function"?G=r(B):G=[r,L?"active":null,U?"pending":null,A?"transitioning":null].filter(Boolean).join(" ");let ne=typeof d=="function"?d(B):d;return h.createElement(Z0,{...y,"aria-current":P,className:G,ref:b,style:ne,to:m,viewTransition:x},typeof p=="function"?p(B):p)});$b.displayName="NavLink";var Gb=h.forwardRef(({discover:a="render",fetcherKey:l,navigate:i,reloadDocument:r,replace:f,state:d,method:m=Sr,action:x,onSubmit:p,relative:y,preventScrollReset:b,viewTransition:S,...N},M)=>{let j=Fb(),C=Jb(x,{relative:y}),A=m.toLowerCase()==="get"?"get":"post",q=typeof x=="string"&&K0.test(x),w=k=>{if(p&&p(k),k.defaultPrevented)return;k.preventDefault();let Y=k.nativeEvent.submitter,L=Y?.getAttribute("formmethod")||m;j(Y||k.currentTarget,{fetcherKey:l,method:L,navigate:i,replace:f,state:d,relative:y,preventScrollReset:b,viewTransition:S})};return h.createElement("form",{ref:M,method:A,action:C,onSubmit:r?p:w,...N,"data-discover":!q&&a==="render"?"true":void 0})});Gb.displayName="Form";function Xb(a){return`${a} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function F0(a){let l=h.useContext(Rl);return $e(l,Xb(a)),l}function Qb(a,{target:l,replace:i,state:r,preventScrollReset:f,relative:d,viewTransition:m}={}){let x=ab(),p=ka(),y=Zs(a,{relative:d});return h.useCallback(b=>{if(Nb(b,l)){b.preventDefault();let S=i!==void 0?i:Vs(p)===Vs(y);x(a,{replace:S,state:r,preventScrollReset:f,relative:d,viewTransition:m})}},[p,x,y,i,r,l,a,f,d,m])}var Kb=0,Zb=()=>`__${String(++Kb)}__`;function Fb(){let{router:a}=F0("useSubmit"),{basename:l}=h.useContext(an),i=mb();return h.useCallback(async(r,f={})=>{let{action:d,method:m,encType:x,formData:p,body:y}=Cb(r,l);if(f.navigate===!1){let b=f.fetcherKey||Zb();await a.fetch(b,i,f.action||d,{preventScrollReset:f.preventScrollReset,formData:p,body:y,formMethod:f.method||m,formEncType:f.encType||x,flushSync:f.flushSync})}else await a.navigate(f.action||d,{preventScrollReset:f.preventScrollReset,formData:p,body:y,formMethod:f.method||m,formEncType:f.encType||x,replace:f.replace,state:f.state,fromRouteId:i,flushSync:f.flushSync,viewTransition:f.viewTransition})},[a,l,i])}function Jb(a,{relative:l}={}){let{basename:i}=h.useContext(an),r=h.useContext(kn);$e(r,"useFormAction must be used inside a RouteContext");let[f]=r.matches.slice(-1),d={...Zs(a||".",{relative:l})},m=ka();if(a==null){d.search=m.search;let x=new URLSearchParams(d.search),p=x.getAll("index");if(p.some(b=>b==="")){x.delete("index"),p.filter(S=>S).forEach(S=>x.append("index",S));let b=x.toString();d.search=b?`?${b}`:""}}return(!a||a===".")&&f.route.index&&(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),i!=="/"&&(d.pathname=d.pathname==="/"?i:Mn([i,d.pathname])),Vs(d)}function Ib(a,{relative:l}={}){let i=h.useContext(U0);$e(i!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=F0("useViewTransitionState"),f=Zs(a,{relative:l});if(!i.isTransitioning)return!1;let d=Rn(i.currentLocation.pathname,r)||i.currentLocation.pathname,m=Rn(i.nextLocation.pathname,r)||i.nextLocation.pathname;return Tr(f.pathname,m)!=null||Tr(f.pathname,d)!=null}const nn=Object.create(null);nn.open="0";nn.close="1";nn.ping="2";nn.pong="3";nn.message="4";nn.upgrade="5";nn.noop="6";const jr=Object.create(null);Object.keys(nn).forEach(a=>{jr[nn[a]]=a});const Uu={type:"error",data:"parser error"},J0=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",I0=typeof ArrayBuffer=="function",W0=a=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(a):a&&a.buffer instanceof ArrayBuffer,rf=({type:a,data:l},i,r)=>J0&&l instanceof Blob?i?r(l):Zp(l,r):I0&&(l instanceof ArrayBuffer||W0(l))?i?r(l):Zp(new Blob([l]),r):r(nn[a]+(l||"")),Zp=(a,l)=>{const i=new FileReader;return i.onload=function(){const r=i.result.split(",")[1];l("b"+(r||""))},i.readAsDataURL(a)};function Fp(a){return a instanceof Uint8Array?a:a instanceof ArrayBuffer?new Uint8Array(a):new Uint8Array(a.buffer,a.byteOffset,a.byteLength)}let gu;function Wb(a,l){if(J0&&a.data instanceof Blob)return a.data.arrayBuffer().then(Fp).then(l);if(I0&&(a.data instanceof ArrayBuffer||W0(a.data)))return l(Fp(a.data));rf(a,!1,i=>{gu||(gu=new TextEncoder),l(gu.encode(i))})}const Jp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ls=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let a=0;a<Jp.length;a++)Ls[Jp.charCodeAt(a)]=a;const Pb=a=>{let l=a.length*.75,i=a.length,r,f=0,d,m,x,p;a[a.length-1]==="="&&(l--,a[a.length-2]==="="&&l--);const y=new ArrayBuffer(l),b=new Uint8Array(y);for(r=0;r<i;r+=4)d=Ls[a.charCodeAt(r)],m=Ls[a.charCodeAt(r+1)],x=Ls[a.charCodeAt(r+2)],p=Ls[a.charCodeAt(r+3)],b[f++]=d<<2|m>>4,b[f++]=(m&15)<<4|x>>2,b[f++]=(x&3)<<6|p&63;return y},e1=typeof ArrayBuffer=="function",of=(a,l)=>{if(typeof a!="string")return{type:"message",data:P0(a,l)};const i=a.charAt(0);return i==="b"?{type:"message",data:t1(a.substring(1),l)}:jr[i]?a.length>1?{type:jr[i],data:a.substring(1)}:{type:jr[i]}:Uu},t1=(a,l)=>{if(e1){const i=Pb(a);return P0(i,l)}else return{base64:!0,data:a}},P0=(a,l)=>{switch(l){case"blob":return a instanceof Blob?a:new Blob([a]);case"arraybuffer":default:return a instanceof ArrayBuffer?a:a.buffer}},eg="",n1=(a,l)=>{const i=a.length,r=new Array(i);let f=0;a.forEach((d,m)=>{rf(d,!1,x=>{r[m]=x,++f===i&&l(r.join(eg))})})},a1=(a,l)=>{const i=a.split(eg),r=[];for(let f=0;f<i.length;f++){const d=of(i[f],l);if(r.push(d),d.type==="error")break}return r};function l1(){return new TransformStream({transform(a,l){Wb(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 xu;function gr(a){return a.reduce((l,i)=>l+i.length,0)}function xr(a,l){if(a[0].length===l)return a.shift();const i=new Uint8Array(l);let r=0;for(let f=0;f<l;f++)i[f]=a[0][r++],r===a[0].length&&(a.shift(),r=0);return a.length&&r<a[0].length&&(a[0]=a[0].slice(r)),i}function s1(a,l){xu||(xu=new TextDecoder);const i=[];let r=0,f=-1,d=!1;return new TransformStream({transform(m,x){for(i.push(m);;){if(r===0){if(gr(i)<1)break;const p=xr(i,1);d=(p[0]&128)===128,f=p[0]&127,f<126?r=3:f===126?r=1:r=2}else if(r===1){if(gr(i)<2)break;const p=xr(i,2);f=new DataView(p.buffer,p.byteOffset,p.length).getUint16(0),r=3}else if(r===2){if(gr(i)<8)break;const p=xr(i,8),y=new DataView(p.buffer,p.byteOffset,p.length),b=y.getUint32(0);if(b>Math.pow(2,21)-1){x.enqueue(Uu);break}f=b*Math.pow(2,32)+y.getUint32(4),r=3}else{if(gr(i)<f)break;const p=xr(i,f);x.enqueue(of(d?p:xu.decode(p),l)),r=0}if(f===0||f>a){x.enqueue(Uu);break}}}})}const tg=4;function et(a){if(a)return i1(a)}function i1(a){for(var l in et.prototype)a[l]=et.prototype[l];return a}et.prototype.on=et.prototype.addEventListener=function(a,l){return this._callbacks=this._callbacks||{},(this._callbacks["$"+a]=this._callbacks["$"+a]||[]).push(l),this};et.prototype.once=function(a,l){function i(){this.off(a,i),l.apply(this,arguments)}return i.fn=l,this.on(a,i),this};et.prototype.off=et.prototype.removeListener=et.prototype.removeAllListeners=et.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};et.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};et.prototype.emitReserved=et.prototype.emit;et.prototype.listeners=function(a){return this._callbacks=this._callbacks||{},this._callbacks["$"+a]||[]};et.prototype.hasListeners=function(a){return!!this.listeners(a).length};const Ur=typeof Promise=="function"&&typeof Promise.resolve=="function"?l=>Promise.resolve().then(l):(l,i)=>i(l,0),Yt=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),r1="arraybuffer";function ng(a,...l){return l.reduce((i,r)=>(a.hasOwnProperty(r)&&(i[r]=a[r]),i),{})}const o1=Yt.setTimeout,c1=Yt.clearTimeout;function Hr(a,l){l.useNativeTimers?(a.setTimeoutFn=o1.bind(Yt),a.clearTimeoutFn=c1.bind(Yt)):(a.setTimeoutFn=Yt.setTimeout.bind(Yt),a.clearTimeoutFn=Yt.clearTimeout.bind(Yt))}const u1=1.33;function f1(a){return typeof a=="string"?d1(a):Math.ceil((a.byteLength||a.size)*u1)}function d1(a){let l=0,i=0;for(let r=0,f=a.length;r<f;r++)l=a.charCodeAt(r),l<128?i+=1:l<2048?i+=2:l<55296||l>=57344?i+=3:(r++,i+=4);return i}function ag(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function h1(a){let l="";for(let i in a)a.hasOwnProperty(i)&&(l.length&&(l+="&"),l+=encodeURIComponent(i)+"="+encodeURIComponent(a[i]));return l}function m1(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 p1 extends Error{constructor(l,i,r){super(l),this.description=i,this.context=r,this.type="TransportError"}}class cf extends et{constructor(l){super(),this.writable=!1,Hr(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 p1(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=of(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=h1(l);return i.length?"?"+i:""}}class g1 extends cf{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)};a1(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,n1(l,i=>{this.doWrite(i,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const l=this.opts.secure?"https":"http",i=this.query||{};return this.opts.timestampRequests!==!1&&(i[this.opts.timestampParam]=ag()),!this.supportsBinary&&!i.sid&&(i.b64=1),this.createUri(l,i)}}let lg=!1;try{lg=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const x1=lg;function y1(){}class v1 extends g1{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 tn extends et{constructor(l,i,r){super(),this.createRequest=l,Hr(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=ng(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=tn.requestsCount++,tn.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=y1,l)try{this._xhr.abort()}catch{}typeof document<"u"&&delete tn.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()}}tn.requestsCount=0;tn.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Ip);else if(typeof addEventListener=="function"){const a="onpagehide"in Yt?"pagehide":"unload";addEventListener(a,Ip,!1)}}function Ip(){for(let a in tn.requests)tn.requests.hasOwnProperty(a)&&tn.requests[a].abort()}const b1=(function(){const a=sg({xdomain:!1});return a&&a.responseType!==null})();class S1 extends v1{constructor(l){super(l);const i=l&&l.forceBase64;this.supportsBinary=b1&&!i}request(l={}){return Object.assign(l,{xd:this.xd},this.opts),new tn(sg,this.uri(),l)}}function sg(a){const l=a.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!l||x1))return new XMLHttpRequest}catch{}if(!l)try{return new Yt[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const ig=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class A1 extends cf{get name(){return"websocket"}doOpen(){const l=this.uri(),i=this.opts.protocols,r=ig?{}:ng(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;rf(r,this.supportsBinary,d=>{try{this.doWrite(r,d)}catch{}f&&Ur(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const l=this.opts.secure?"wss":"ws",i=this.query||{};return this.opts.timestampRequests&&(i[this.opts.timestampParam]=ag()),this.supportsBinary||(i.b64=1),this.createUri(l,i)}}const yu=Yt.WebSocket||Yt.MozWebSocket;class j1 extends A1{createSocket(l,i,r){return ig?new yu(l,i,r):i?new yu(l,i):new yu(l)}doWrite(l,i){this.ws.send(i)}}class N1 extends cf{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(l){return this.emitReserved("error",l)}this._transport.closed.then(()=>{this.onClose()}).catch(l=>{this.onError("webtransport error",l)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(l=>{const i=s1(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=l.readable.pipeThrough(i).getReader(),f=l1();f.readable.pipeTo(l.writable),this._writer=f.writable.getWriter();const d=()=>{r.read().then(({done:x,value:p})=>{x||(this.onPacket(p),d())}).catch(x=>{})};d();const m={type:"open"};this.query.sid&&(m.data=`{"sid":"${this.query.sid}"}`),this._writer.write(m).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&&Ur(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var l;(l=this._transport)===null||l===void 0||l.close()}}const w1={websocket:j1,webtransport:N1,polling:S1},E1=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,C1=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Hu(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=E1.exec(a||""),d={},m=14;for(;m--;)d[C1[m]]=f[m]||"";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=q1(d,d.path),d.queryKey=M1(d,d.query),d}function q1(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 M1(a,l){const i={};return l.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,f,d){f&&(i[f]=d)}),i}const Vu=typeof addEventListener=="function"&&typeof removeEventListener=="function",Nr=[];Vu&&addEventListener("offline",()=>{Nr.forEach(a=>a())},!1);class la extends et{constructor(l,i){if(super(),this.binaryType=r1,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=Hu(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=Hu(i.host).host);Hr(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=m1(this.opts.query)),Vu&&(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"})},Nr.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(l){const i=Object.assign({},this.opts.query);i.EIO=tg,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&&la.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",la.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+=f1(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,Ur(()=>{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(la.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(),Vu&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=Nr.indexOf(this._offlineEventListener);r!==-1&&Nr.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",l,i),this.writeBuffer=[],this._prevBufferLen=0}}}la.protocol=tg;class T1 extends la{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;la.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;la.priorWebsocketSuccess=i.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(b(),this.setTransport(i),i.send([{type:"upgrade"}]),this.emitReserved("upgrade",i),i=null,this.upgrading=!1,this.flush())})}else{const N=new Error("probe error");N.transport=i.name,this.emitReserved("upgradeError",N)}}))};function d(){r||(r=!0,b(),i.close(),i=null)}const m=S=>{const N=new Error("probe error: "+S);N.transport=i.name,d(),this.emitReserved("upgradeError",N)};function x(){m("transport closed")}function p(){m("socket closed")}function y(S){i&&S.name!==i.name&&d()}const b=()=>{i.removeListener("open",f),i.removeListener("error",m),i.removeListener("close",x),this.off("close",p),this.off("upgrading",y)};i.once("open",f),i.once("error",m),i.once("close",x),this.once("close",p),this.once("upgrading",y),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 R1=class extends T1{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=>w1[f]).filter(f=>!!f)),super(l,r)}};function k1(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=Hu(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 _1=typeof ArrayBuffer=="function",D1=a=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(a):a.buffer instanceof ArrayBuffer,rg=Object.prototype.toString,O1=typeof Blob=="function"||typeof Blob<"u"&&rg.call(Blob)==="[object BlobConstructor]",B1=typeof File=="function"||typeof File<"u"&&rg.call(File)==="[object FileConstructor]";function uf(a){return _1&&(a instanceof ArrayBuffer||D1(a))||O1&&a instanceof Blob||B1&&a instanceof File}function wr(a,l){if(!a||typeof a!="object")return!1;if(Array.isArray(a)){for(let i=0,r=a.length;i<r;i++)if(wr(a[i]))return!0;return!1}if(uf(a))return!0;if(a.toJSON&&typeof a.toJSON=="function"&&arguments.length===1)return wr(a.toJSON(),!0);for(const i in a)if(Object.prototype.hasOwnProperty.call(a,i)&&wr(a[i]))return!0;return!1}function z1(a){const l=[],i=a.data,r=a;return r.data=Yu(i,l),r.attachments=l.length,{packet:r,buffers:l}}function Yu(a,l){if(!a)return a;if(uf(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]=Yu(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]=Yu(a[r],l));return i}return a}function L1(a,l){return a.data=$u(a.data,l),delete a.attachments,a}function $u(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]=$u(a[i],l);else if(typeof a=="object")for(const i in a)Object.prototype.hasOwnProperty.call(a,i)&&(a[i]=$u(a[i],l));return a}const U1=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],H1=5;var je;(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"})(je||(je={}));class V1{constructor(l){this.replacer=l}encode(l){return(l.type===je.EVENT||l.type===je.ACK)&&wr(l)?this.encodeAsBinary({type:l.type===je.EVENT?je.BINARY_EVENT:je.BINARY_ACK,nsp:l.nsp,data:l.data,id:l.id}):[this.encodeAsString(l)]}encodeAsString(l){let i=""+l.type;return(l.type===je.BINARY_EVENT||l.type===je.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=z1(l),r=this.encodeAsString(i.packet),f=i.buffers;return f.unshift(r),f}}function Wp(a){return Object.prototype.toString.call(a)==="[object Object]"}class ff extends et{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===je.BINARY_EVENT;r||i.type===je.BINARY_ACK?(i.type=r?je.EVENT:je.ACK,this.reconstructor=new Y1(i),i.attachments===0&&super.emitReserved("decoded",i)):super.emitReserved("decoded",i)}else if(uf(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(je[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===je.BINARY_EVENT||r.type===je.BINARY_ACK){const d=i+1;for(;l.charAt(++i)!=="-"&&i!=l.length;);const m=l.substring(d,i);if(m!=Number(m)||l.charAt(i)!=="-")throw new Error("Illegal attachments");r.attachments=Number(m)}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 m=l.charAt(i);if(m==null||Number(m)!=m){--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(ff.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 je.CONNECT:return Wp(i);case je.DISCONNECT:return i===void 0;case je.CONNECT_ERROR:return typeof i=="string"||Wp(i);case je.EVENT:case je.BINARY_EVENT:return Array.isArray(i)&&(typeof i[0]=="number"||typeof i[0]=="string"&&U1.indexOf(i[0])===-1);case je.ACK:case je.BINARY_ACK:return Array.isArray(i)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Y1{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=L1(this.reconPack,this.buffers);return this.finishedReconstruction(),i}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const $1=Object.freeze(Object.defineProperty({__proto__:null,Decoder:ff,Encoder:V1,get PacketType(){return je},protocol:H1},Symbol.toStringTag,{value:"Module"}));function Qt(a,l,i){return a.on(l,i),function(){a.off(l,i)}}const G1=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class og extends et{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=[Qt(l,"open",this.onopen.bind(this)),Qt(l,"packet",this.onpacket.bind(this)),Qt(l,"error",this.onerror.bind(this)),Qt(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(G1.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 m={type:je.EVENT,data:i};if(m.options={},m.options.compress=this.flags.compress!==!1,typeof i[i.length-1]=="function"){const b=this.ids++,S=i.pop();this._registerAckCallback(b,S),m.id=b}const x=(f=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||f===void 0?void 0:f.writable,p=this.connected&&!(!((d=this.io.engine)===null||d===void 0)&&d._hasPingExpired());return this.flags.volatile&&!x||(p?(this.notifyOutgoingListeners(m),this.packet(m)):this.sendBuffer.push(m)),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 x=0;x<this.sendBuffer.length;x++)this.sendBuffer[x].id===l&&this.sendBuffer.splice(x,1);i.call(this,new Error("operation has timed out"))},f),m=(...x)=>{this.io.clearTimeoutFn(d),i.apply(this,x)};m.withError=!0,this.acks[l]=m}emitWithAck(l,...i){return new Promise((r,f)=>{const d=(m,x)=>m?f(m):r(x);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:je.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 je.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 je.EVENT:case je.BINARY_EVENT:this.onevent(l);break;case je.ACK:case je.BINARY_ACK:this.onack(l);break;case je.DISCONNECT:this.ondisconnect();break;case je.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:je.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:je.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 kl(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}kl.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};kl.prototype.reset=function(){this.attempts=0};kl.prototype.setMin=function(a){this.ms=a};kl.prototype.setMax=function(a){this.max=a};kl.prototype.setJitter=function(a){this.jitter=a};class Gu extends et{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,Hr(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 kl({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||$1;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 R1(this.uri,this.opts);const i=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const f=Qt(i,"open",function(){r.onopen(),l&&l()}),d=x=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",x),l?l(x):this.maybeReconnectOnOpen()},m=Qt(i,"error",d);if(this._timeout!==!1){const x=this._timeout,p=this.setTimeoutFn(()=>{f(),d(new Error("timeout")),i.close()},x);this.opts.autoUnref&&p.unref(),this.subs.push(()=>{this.clearTimeoutFn(p)})}return this.subs.push(f),this.subs.push(m),this}connect(l){return this.open(l)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const l=this.engine;this.subs.push(Qt(l,"ping",this.onping.bind(this)),Qt(l,"data",this.ondata.bind(this)),Qt(l,"error",this.onerror.bind(this)),Qt(l,"close",this.onclose.bind(this)),Qt(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){Ur(()=>{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 og(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 _s={};function Er(a,l){typeof a=="object"&&(l=a,a=void 0),l=l||{};const i=k1(a,l.path||"/socket.io"),r=i.source,f=i.id,d=i.path,m=_s[f]&&d in _s[f].nsps,x=l.forceNew||l["force new connection"]||l.multiplex===!1||m;let p;return x?p=new Gu(r,l):(_s[f]||(_s[f]=new Gu(r,l)),p=_s[f]),i.query&&!l.query&&(l.query=i.queryKey),p.socket(i.path,l)}Object.assign(Er,{Manager:Gu,Socket:og,io:Er,connect:Er});const cg="roverSettings",X1=3600*24*365;function Q1(a){try{const l=decodeURIComponent(a??"");return JSON.parse(l)}catch(l){return console.warn("Failed to parse settings cookie",l),null}}function Xu(){if(typeof document>"u")return{};const a=`${cg}=`,l=document.cookie.split(";").map(r=>r.trim()).find(r=>r.startsWith(a));if(!l)return{};const i=l.substring(a.length);return Q1(i)??{}}function Pp(a){if(typeof document>"u")return!1;try{const l=encodeURIComponent(JSON.stringify(a??{})),i=`${cg}=${l}; path=/; max-age=${X1}; samesite=strict`;return document.cookie=i,!0}catch(l){return console.warn("Failed to write settings cookie",l),!1}}const ug=window.location.origin;console.info("[socket] connecting to",ug);const K1=Xu(),Z1=K1?.page?.connectionTransport||"websocket",F1=Z1==="polling"?["polling"]:["websocket","polling"],df=Er(ug,{transports:F1,timeout:15e3});df.on("connect_error",a=>console.error("connect_error",a.code,a.message,a.data));const fg=h.createContext(df),J1=({children:a})=>o.jsx(fg.Provider,{value:df,children:a}),ln=()=>h.useContext(fg),dg=h.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()=>{}});function I1(a){return h.useCallback((l,i={})=>new Promise((r,f)=>{a.emit(l,i,(d={})=>{d.error?f(new Error(d.error)):r(d)})}),[a])}function W1({children:a}){const l=ln(),i=I1(l),[r,f]=h.useState(null),[d,m]=h.useState([]),[x,p]=h.useState([]),[y,b]=h.useState([]),[S,N]=h.useState(l.connected);h.useEffect(()=>{const C=()=>N(!0),A=()=>N(!1);return l.on("connect",C),l.on("disconnect",A),()=>{l.off("connect",C),l.off("disconnect",A)}},[l]),h.useEffect(()=>{function C(Y){f(Y)}function A(Y=[]){m(Y)}function q(Y){m(L=>[...L.slice(-199),Y])}function w(Y=[]){p(Y)}function k(Y){p(L=>[...L.slice(-199),Y])}return l.on("session:sync",C),l.on("log:init",A),l.on("log:entry",q),l.on("adminlog:init",w),l.on("adminlog:entry",k),l.on("alert:new",(Y={})=>{b(L=>[...L.slice(-49),{...Y,receivedAt:Date.now()}])}),()=>{l.off("session:sync",C),l.off("log:init",A),l.off("log:entry",q),l.off("adminlog:init",w),l.off("adminlog:entry",k),l.off("alert:new")}},[l]);const M=h.useMemo(()=>({login:(C,A)=>i("auth:login",{username:C,password:A}),setRole:C=>i("session:setRole",{role:C}),requestControl:(C,A={})=>i("session:requestControl",{roverId:C,...A}),releaseControl:C=>i("session:releaseControl",{roverId:C}),subscribeAll:()=>i("session:subscribeAll"),lockRover:(C,A)=>i("session:lockRover",{roverId:C,locked:A}),setMode:C=>i("setMode",{mode:C}),homeAssistantToggle:C=>i("homeAssistant:toggle",{entityId:C}),homeAssistantSetState:(C,A)=>i("homeAssistant:setState",{entityId:C,state:A}),homeAssistantSetLightColor:(C,A)=>i("homeAssistant:lightColor",{entityId:C,rgbColor:A}),setNickname:C=>i("nickname:set",{nickname:C}),triggerReplay:(C=[])=>i("replay:trigger",{sources:C}),setCommunityGoal:C=>i("communityGoal:set",{text:C}),pushAlert:C=>b(A=>[...A.slice(-49),{...C,receivedAt:Date.now(),id:C.id||Math.random().toString(36).slice(2)}])}),[i]),j=h.useMemo(()=>({connected:S,session:r,logs:d,adminLogs:x,alerts:y,...M}),[M,x,y,S,d,r]);return o.jsx(dg.Provider,{value:j,children:a})}function _e(){return h.useContext(dg)}const hg=h.createContext({frames:{}});function P1({children:a}){const l=ln(),[i,r]=h.useState({});h.useEffect(()=>{function d({roverId:m,sensors:x={},frame:p={}}){m&&r(y=>({...y,[m]:{roverId:m,sensors:x,raw:p?.data||null,receivedAt:Date.now()}}))}return l.on("sensorFrame",d),()=>{l.off("sensorFrame",d)}},[l]);const f=h.useMemo(()=>({frames:i}),[i]);return o.jsx(hg.Provider,{value:f,children:a})}function hf(){return h.useContext(hg).frames}function _l(a){const l=hf();return a?l[a]??null:null}const eS=650,tS={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 vu(a){if(typeof a!="number"||a<=0)return null;const l=tS[a];return l?{code:a,...l}:null}function nS(a,l={}){const i=l.holdMs||eS,[r,f]=h.useState({left:null,right:null,omni:null}),[d,m]=h.useState(0);return h.useEffect(()=>{const x=setInterval(()=>m(Date.now()),Math.max(i/2,100));return()=>clearInterval(x)},[i]),h.useEffect(()=>{const x=Date.now(),p=vu(a?.infraredCharacterLeft),y=vu(a?.infraredCharacterRight),b=vu(a?.infraredCharacterOmni);!p&&!y&&!b||f(S=>({left:p?{...p,ts:x}:S.left,right:y?{...y,ts:x}:S.right,omni:b?{...b,ts:x}:S.omni}))},[a?.infraredCharacterLeft,a?.infraredCharacterRight,a?.infraredCharacterOmni]),h.useEffect(()=>{const{left:x,right:p,omni:y}=r;if(!(x?.ts||p?.ts||y?.ts))return;const S=new Date().toISOString();console.debug("[DockIR]",S,{left:x?.code??0,omni:y?.code??0,right:p?.code??0})},[r.left?.code,r.right?.code,r.omni?.code]),h.useMemo(()=>{const x=Date.now(),p=A=>{if(!A)return{active:!1,red:!1,green:!1,force:!1,age:null,code:null};const q=x-A.ts,w=q<=i;return{active:w,age:q,code:A.code,red:!!(A.red&&w),green:!!(A.green&&w),force:!!(A.force&&w)}},y=p(r.left),b=p(r.right),S=p(r.omni),N=y.force||b.force||S.force,M=y.active||b.active||S.active,j=y.active&&!b.active?"right":b.active&&!y.active?"left":"center",C=(b.active?1:0)-(y.active?1:0);return{visible:M,forceDetected:N,left:y,right:b,omni:S,bias:j,balance:Math.max(-1,Math.min(1,C))}},[r.left,r.right,r.omni,i,d])}function aS(){const{connected:a,session:l}=_e(),i=l?.assignment?.roverId,r=_l(i),f=r?.sensors||{},d=nS(f),m=f.voltageMv!=null?`${(f.voltageMv/1e3).toFixed(2)} V`:null,x=f.currentMa!=null?`${f.currentMa} mA`:null,p=f.batteryTemperatureC!=null?`${f.batteryTemperatureC} °C`:null,y=f.batteryChargeMah,b=f.batteryCapacityMah;r?.receivedAt&&new Date(r.receivedAt).toLocaleTimeString();const S=r?.raw?r.raw:null,N=i?l?.activeDrivers?.[i]:null;return h.useMemo(()=>i?N?N===l?.socketId?"You":(l?.users||[]).find(j=>j.socketId===N)?.nickname||N.slice(0,6):"Available":"n/a",[N,i,l?.socketId,l?.users]),o.jsxs("section",{className:"panel-section space-y-0.5 text-base text-slate-100",children:[i?r?o.jsxs(o.Fragment,{children:[o.jsx(lS,{sensors:f,voltage:m,current:x,batteryTemp:p,charge:y,capacity:b}),o.jsx(sS,{sensors:f,dockState:d})]}):o.jsx("p",{className:"text-sm text-slate-500",children:"Waiting for sensor frames…"}):o.jsx("p",{className:"text-sm text-slate-500",children:"Assign a rover to view sensors."}),S&&o.jsx("pre",{className:"surface whitespace-pre-wrap break-words text-xs text-lime-300",children:S})]})}function lS({sensors:a,voltage:l,current:i,batteryTemp:r,charge:f,capacity:d}){const m=f!=null&&d?`${Math.round(f/d*100)}`:"--",x=a?.oiMode?.label||"--",p=a?.chargingSources?.homeBase?"Yes":"No",y=a?.chargingState?.label||"--";return o.jsxs("div",{className:"grid grid-cols-2 gap-0.5 md:grid-cols-3",children:[o.jsx(wn,{label:"Voltage",value:l??"--"}),o.jsx(wn,{label:"Current",value:i??"--"}),o.jsx(wn,{label:"Battery temp",value:r??"--"}),o.jsx(wn,{label:"Charge",value:f!=null?`${f} mAh`:"--"}),o.jsx(wn,{label:"Capacity",value:d!=null?`${d} mAh`:"--"}),o.jsx(wn,{label:"Charge",value:m}),o.jsx(wn,{label:"OI mode",value:x}),o.jsx(wn,{label:"Docked",value:p}),o.jsx(wn,{label:"Charging state",value:y})]})}function wn({label:a,value:l}){return o.jsxs("div",{className:"surface flex items-center justify-between gap-0.5 px-1 py-0.5 text-sm",children:[o.jsx("span",{className:"text-slate-400",children:a}),o.jsx("span",{className:"text-slate-100",children:l})]})}function sS({sensors:a,dockState:l}){const i=a?.bumpsAndWheelDrops||{},r=a?.wheelOvercurrents||{},f=[{label:"Left",value:a?.lightBumpLeftSignal},{label:"Front Left",value:a?.lightBumpFrontLeftSignal},{label:"Center Left",value:a?.lightBumpCenterLeftSignal},{label:"Center Right",value:a?.lightBumpCenterRightSignal},{label:"Front Right",value:a?.lightBumpFrontRightSignal},{label:"Right",value:a?.lightBumpRightSignal}],d=[{label:"Left",value:a?.cliffLeftSignal,active:a?.cliffLeft},{label:"Front Left",value:a?.cliffFrontLeftSignal,active:a?.cliffFrontLeft},{label:"Front Right",value:a?.cliffFrontRightSignal,active:a?.cliffFrontRight},{label:"Right",value:a?.cliffRightSignal,active:a?.cliffRight}],m=[{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(Sl,{title:"Dock IR",children:[o.jsx(iS,{sensors:a}),o.jsx(rS,{state:l})]}),o.jsxs(Sl,{title:"Bumps & drops",children:[o.jsx(En,{label:"Bump L",value:o.jsx(Ds,{active:i.bumpLeft})}),o.jsx(En,{label:"Bump R",value:o.jsx(Ds,{active:i.bumpRight})}),o.jsx(En,{label:"Wheel drop L",value:o.jsx(Ds,{active:i.wheelDropLeft,tone:"amber"})}),o.jsx(En,{label:"Wheel drop R",value:o.jsx(Ds,{active:i.wheelDropRight,tone:"amber"})})]}),o.jsx(Sl,{title:"Light bumps (raw)",children:f.map(x=>o.jsx(En,{label:x.label,value:Os(x.value)},x.label))}),o.jsx(Sl,{title:"Cliff sensors",children:d.map(x=>o.jsx(En,{label:x.label,value:`${Os(x.value)} · ${x.active?"bool: true":"bool: false"}`},x.label))}),o.jsx(Sl,{title:"Currents",children:m.map(x=>o.jsx(En,{label:x.label,value:o.jsxs("span",{className:"flex items-center gap-0.5",children:[o.jsx("span",{children:Os(x.value,"mA")}),x.over?o.jsx(Ds,{active:!0,tone:"red",label:"over"}):null]})},x.label))}),o.jsxs(Sl,{title:"Dirt detect",children:[o.jsx(En,{label:"Left",value:Os(a?.dirtDetectLeft)}),o.jsx(En,{label:"Right",value:Os(a?.dirtDetect)})]})]})}function Sl({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 En({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 Ds({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 Os(a,l){return a==null||Number.isNaN(a)?"--":l?`${a} ${l}`:a}function iS({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 rS({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 mg=h.createContext(null);function mf({children:a}){const[l,i]=h.useState(()=>({status:"loading",data:{}}));h.useEffect(()=>{const x=Xu();i({status:"ready",data:x??{}})},[]);const r=h.useCallback(()=>{const x=Xu();i({status:"ready",data:x??{}})},[]),f=h.useCallback(x=>{const p=Pp(x??{});return i(p?{status:"ready",data:x??{}}:y=>({...y,status:"error"})),p},[]),d=h.useCallback((x,p)=>{i(y=>{const b=y.data[x]||{},S=typeof p=="function"?p(b):{...b,...p??{}},N={...y.data,[x]:S};return Pp(N)?{status:"ready",data:N}:{...y,status:"error"}})},[]),m=h.useMemo(()=>({data:l.data,status:l.status,reload:r,saveAll:f,setNamespace:d}),[l,r,f,d]);return o.jsx(mg.Provider,{value:m,children:a})}function oS(){const a=h.useContext(mg);if(!a)throw new Error("useSettings must be used within SettingsProvider");return a}function dt(a,l={}){const{data:i,status:r,setNamespace:f}=oS(),d=i[a]??l??{},m=h.useCallback(y=>{f(a,b=>{const S=b??{};return typeof y=="function"?y(S):{...S,...y??{}}})},[a,f]),x=h.useCallback(y=>{f(a,()=>y??{})},[a,f]),p=h.useCallback(()=>{const y=typeof l=="object"?{...l}:l;f(a,()=>y??{})},[l,a,f]);return{value:d,status:r,save:m,replace:x,reset:p}}function cS(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 pf({panelId:a="replay-sources",fillHeight:l=!1}){const{session:i,triggerReplay:r}=_e(),f=cS(i?.replaySources||[]),{value:d,save:m}=dt("replaySources",{}),[x,p]=h.useState([]),[y,b]=h.useState(!1),[S,N]=h.useState(null),[M,j]=h.useState(null),C=i?.replay||null,[A,q]=h.useState(0),w=h.useMemo(()=>{const G=i?.assignment?.roverId;return G?[`rover:${G}`]:[]},[i?.assignment?.roverId]);h.useEffect(()=>{const G=d?.[a];if(Array.isArray(G)&&G.length){p(G);return}p(w)},[d?.[a],w,a]),h.useEffect(()=>{const G=new Set(f.map(ne=>ne.key));p(ne=>ne.filter(Q=>G.has(Q)))},[f]);const k=h.useMemo(()=>({rovers:f.filter(G=>G.type==="rover"),rooms:f.filter(G=>G.type==="room")}),[f]);h.useEffect(()=>{if(!C?.lastTriggeredAt||!C?.cooldownMs){q(0);return}const G=()=>{const Q=C.lastTriggeredAt+C.cooldownMs-Date.now();q(Math.max(0,Q))};G();const ne=setInterval(G,250);return()=>clearInterval(ne)},[C?.lastTriggeredAt,C?.cooldownMs,C?.remainingMs]);const Y=y||i?.mode==="lockdown"||A>0||!x.length,L=G=>{p(ne=>{const Q=ne.includes(G)?ne.filter(W=>W!==G):[...ne,G];return m(W=>({...W||{},[a]:Q})),Q}),j(null)},U=async()=>{if(!Y){b(!0),N(null),j(null);try{const G=x.map(ne=>{const[Q,W]=ne.split(":");return{type:Q,id:W}});await r(G),j("Replay sent. Check the Discord replay channel.")}catch(G){N(G.message)}finally{b(!1)}}},B=l?"h-full flex flex-col":"",P=l?"flex-1 min-h-0 overflow-y-auto":"";return o.jsxs("section",{className:`panel-section p-0.75 text-sm ${B}`,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 ${P}`,children:[o.jsx(e0,{title:"Rovers",items:k.rovers,selected:x,onToggle:L}),o.jsx(e0,{title:"Room Cams",items:k.rooms,selected:x,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:U,disabled:Y,children:A>0?`Replay (${Math.ceil(A/1e3)}s)`:y?"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 e0({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 pg={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},t0=Ra.createContext&&Ra.createContext(pg),uS=["attr","size","title"];function fS(a,l){if(a==null)return{};var i=dS(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 dS(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 Rr(){return Rr=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},Rr.apply(this,arguments)}function n0(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 kr(a){for(var l=1;l<arguments.length;l++){var i=arguments[l]!=null?arguments[l]:{};l%2?n0(Object(i),!0).forEach(function(r){hS(a,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(i)):n0(Object(i)).forEach(function(r){Object.defineProperty(a,r,Object.getOwnPropertyDescriptor(i,r))})}return a}function hS(a,l,i){return l=mS(l),l in a?Object.defineProperty(a,l,{value:i,enumerable:!0,configurable:!0,writable:!0}):a[l]=i,a}function mS(a){var l=pS(a,"string");return typeof l=="symbol"?l:l+""}function pS(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 gg(a){return a&&a.map((l,i)=>Ra.createElement(l.tag,kr({key:i},l.attr),gg(l.child)))}function xg(a){return l=>Ra.createElement(gS,Rr({attr:kr({},a.attr)},l),gg(a.child))}function gS(a){var l=i=>{var{attr:r,size:f,title:d}=a,m=fS(a,uS),x=f||i.size||"1em",p;return i.className&&(p=i.className),a.className&&(p=(p?p+" ":"")+a.className),Ra.createElement("svg",Rr({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},i.attr,r,m,{className:p,style:kr(kr({color:a.color||i.color},i.style),a.style),height:x,width:x,xmlns:"http://www.w3.org/2000/svg"}),d&&Ra.createElement("title",null,d),a.children)};return t0!==void 0?Ra.createElement(t0.Consumer,null,i=>l(i)):l(pg)}function yg(a){return xg({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 xS(a){return xg({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 yS(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 vS(a){const l=new Date(a);return`${l.getHours().toString().padStart(2,"0")}:${l.getMinutes().toString().padStart(2,"0")}`}function a0(a){return a.nickname||a.socketId?.slice(0,6)||"unknown"}function bS({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 vg({message:a}){const l=a.fromDiscord?`${a.discordGuildName||"Discord"} · ${a0(a)}`:null;return o.jsxs(o.Fragment,{children:[a.fromDiscord?o.jsxs(o.Fragment,{children:[o.jsx(yg,{className:"h-3.5 w-3.5 text-indigo-200"}),o.jsx(bS,{guildIconUrl:a.discordGuildIconUrl,userAvatarUrl:a.discordUserAvatarUrl,label:l})]}):null,o.jsx("span",{className:`font-semibold text-[0.85rem] ${yS(a.role)}`,children:a0(a)}),a.roverId&&o.jsx("span",{className:"rounded bg-slate-800 px-1 text-[0.7rem]",children:a.roverId})]})}function bg(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 Sg({message:a}){return o.jsxs("div",{className:bg(a),children:[o.jsx(vg,{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:vS(a.ts)})]})}function Ag({message:a}){return o.jsxs("div",{className:`${bg(a)} italic opacity-80 border-slate-600/40 bg-slate-900/40`,children:[o.jsx(vg,{message:a}),o.jsx("span",{className:"text-slate-300",children:"typing..."})]})}const SS=3e3,AS="#2196f3";function jS(a){return a.id?a.id:a.timestamp?`${a.timestamp}-${a.message}`:`${a.title||"alert"}-${a.message}`}function gf({scale:a=1}){const{alerts:l}=_e(),[i,r]=h.useState(()=>Date.now()),f=h.useMemo(()=>l.slice(-3).map(p=>({alert:p,key:jS(p)})),[l]);h.useEffect(()=>{if(!f.length)return;const p=setInterval(()=>r(Date.now()),200);return()=>clearInterval(p)},[f.length]);const d=f.map(p=>({...p,age:i-(p.alert.receivedAt??p.alert.timestamp??0)})).filter(p=>p.age<=SS);if(!d.length)return null;const m=a===1?void 0:{transform:`translateX(-50%) scale(${a})`,transformOrigin:"top center"},x=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:x,style:m,children:d.map(p=>o.jsx(NS,{alert:p.alert},p.key))})}function l0(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 NS({alert:a}){if(a.kind==="chat"&&a.payload)return o.jsx(Sg,{message:a.payload});if(a.kind==="chat-typing"&&a.payload)return o.jsx(Ag,{message:a.payload});const l=l0(a.color)||l0(AS),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 Al={main:[-127,127],side:[-127,127],vacuum:[0,127]},bu={maxSpeed:500,baseSpeed:250,boostSpeed:400},Qu=100,xf=[31,127],Cl=60,Ku=8,wS=250,ES={start:[128],safe:[131],full:[132],passive:[128],dock:[143]},Us={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"],driveMacro:["f"],dockMacro:["g"],chatFocus:["enter"],songNoteUp:["ArrowUp"],songNoteDown:["ArrowDown"],homeAssistantOn:["ArrowRight"],homeAssistantOff:["ArrowLeft"]},jg=[{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:Qu},{type:"oi",command:"dock"},{type:"pause",duration:Qu},{type:"oi",command:"full"}]},{id:"seek-dock",label:"Dock",description:"Send the seek dock command.",steps:[{type:"oi",command:"dock"}]}];function Zu(){return{vector:{x:0,y:0,boost:!1},speeds:{left:0,right:0},source:null,lastUpdatedAt:0}}function Fu(){return{main:0,side:0,vacuum:0}}function CS(){return{enabled:!1,angle:null,config:null}}function Cr(){return{note:Cl}}const s0={roverId:null,mode:"drive",drive:Zu(),aux:Fu(),camera:CS(),song:Cr(),lastControlIntentAt:0,macros:jg,keymap:Us,inputs:{}};function qS(a,l){switch(l.type){case"control/set-rover":return{...a,roverId:l.payload??null,drive:l.payload?a.drive:Zu(),aux:l.payload?a.aux:Fu(),song:l.payload?a.song:Cr(),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:Zu(),aux:Fu(),song:Cr(),lastControlIntentAt:0};case"control/record-intent":return{...a,lastControlIntentAt:Date.now()};case"control/set-song-note":return{...a,song:{...a.song||Cr(),note:l.payload??Cl}};default:return a}}function ql(a,l,i){return typeof a!="number"||Number.isNaN(a)?l:Math.max(l,Math.min(i,a))}function Ml(a){return typeof a!="number"||Number.isNaN(a)?0:Math.max(-1,Math.min(1,a))}function Vt(a,l){return!Array.isArray(l)||l.length!==2?a:ql(a,l[0],l[1])}function MS(a={}){const l=Ml(a.x??0),i=Ml(a.y??0);return{x:l,y:i,boost:!!a.boost}}function TS(a={},l={}){const i=MS(a),r=typeof l.maxSpeed=="number"?l.maxSpeed:bu.maxSpeed,f=typeof l.baseSpeed=="number"?l.baseSpeed:bu.baseSpeed,d=typeof l.boostSpeed=="number"?l.boostSpeed:bu.boostSpeed,m=i.boost?d:f,x=i.y*m,p=i.x*m;return{vector:i,speeds:{left:ql(Math.round(x+p),-r,r),right:ql(Math.round(x-p),-r,r)}}}function RS(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 i0(a){return new Promise(l=>setTimeout(l,a))}function kS(a={}){const{driveTransform:l,auxTransform:i}=a,r=ln(),{session:f}=_e(),d=f?.assignment?.roverId,m=h.useMemo(()=>!d||!Array.isArray(f?.roster)?null:f.roster.find(k=>String(k.id)===String(d))||null,[d,f?.roster]),x=h.useMemo(()=>!m?.cameraServo||!m.cameraServo.enabled?null:m.cameraServo,[m]),p=h.useMemo(()=>!m?.nightVision||!m.nightVision.enabled?null:m.nightVision,[m]),y=h.useMemo(()=>m?.nightVision?.state??null,[m]),b=h.useCallback((k,Y)=>{d&&r.emit("command",{roverId:d,...k},Y)},[r,d]),S=h.useCallback(()=>{d&&b({type:"sensorStream",data:{sensorStream:{enable:!0}}})},[b,d]),N=h.useCallback(k=>{if(!d)return null;const Y={left:Vt(k?.left??0,[-500,500]),right:Vt(k?.right??0,[-500,500])},L=l?l(Y):Y,U={left:Vt(L?.left??0,[-500,500]),right:Vt(L?.right??0,[-500,500])};return b({type:"drive",data:{driveDirect:U}}),U},[l,b,d]),M=h.useCallback(({main:k=0,side:Y=0,vacuum:L=0}={})=>{if(!d)return null;const U={main:Vt(k,Al.main),side:Vt(Y,Al.side),vacuum:Vt(L,Al.vacuum)},B=i?i(U):U,P={main:Vt(B?.main??0,Al.main),side:Vt(B?.side??0,Al.side),vacuum:Vt(B?.vacuum??0,Al.vacuum)};return b({type:"motors",data:{motorPwm:P}}),P},[i,b,d]),j=h.useCallback(k=>!d||!x?null:(b({type:"servo",data:{servo:{angle:k}}}),k),[b,d,x]),C=h.useCallback(k=>{if(!d)return!1;const Y=Array.isArray(k)?k:typeof k=="string"?ES[k]:null;return Y?(b({type:"raw",data:{raw:RS(Y)}}),S(),!0):!1},[b,S,d]),A=h.useCallback(async k=>{if(!(!k||!Array.isArray(k.steps)||!d))for(const Y of k.steps){if(!d)break;switch(Y.type){case"oi":C(Y.command);break;case"drive":N(Y.speeds??{left:0,right:0});break;case"motors":M(Y.values??{});break;case"servo":j(Y.angle);break;case"pause":await i0(Y.duration??Qu);break}if(Y.delay||Y.delayMs){const L=Y.delayMs??Y.delay;typeof L=="number"&&L>0&&await i0(L)}}},[d,C,N,M,j]),q=h.useCallback((k="toggle")=>!d||!p?null:(b({type:"nightVision",data:{nightVision:{action:k}}}),k),[b,p,d]),w=h.useCallback((k=[],Y={})=>{if(!d)return null;const U=(Array.isArray(k)&&k.length>0?k:[{note:Cl,duration:Ku}]).slice(0,16).map(B=>({note:Vt(Math.round(B?.note??Cl),xf),duration:Vt(Math.round(B?.duration??Ku),[1,255])}));return b({type:"song",data:{song:{notes:U,slot:Y.slot,loop:Y.loop}}}),U},[b,d]);return h.useMemo(()=>({roverId:d,rosterEntry:m,servoConfig:x,nightVision:p,nightVisionState:y,emitCommand:b,enableSensorStream:S,sendDriveDirect:N,sendAuxMotors:M,sendServoAngle:j,sendOiCommand:C,sendNightVision:q,sendSong:w,runMacroSteps:A}),[d,m,x,p,y,b,S,N,M,j,C,q,A])}const _S={"{":"[","}":"]",":":";",'"':"'","<":",",">":".","?":"/","|":"\\",_:"-","+":"="},r0={"[":"BracketLeft","]":"BracketRight","\\":"Backslash",";":"Semicolon","'":"Quote",",":"Comma",".":"Period","/":"Slash","-":"Minus","=":"Equal","`":"Backquote"};function Fs(a){if(typeof a!="string")return"";const l=a.toLowerCase();return _S[l]??l}function DS(a){const l=Fs(a);if(!l)return null;if(r0[l])return r0[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 Ng(a){const l=Fs(a);return l?`key:${l}`:null}function OS(a){const l=DS(a);return l?`code:${l}`:null}function o0(a){const l=new Set,i=Ng(a?.key??"");i&&l.add(i);const r=a?.code?`code:${a.code}`:null;return r&&l.add(r),Array.from(l)}function BS(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 m=Ng(String(d));m&&f.add(m);const x=OS(String(d));x&&f.add(x)}),[l,f]}))}function Tn(a){const l=Fs(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 wl=[{key:"drive",motors:["leftWheel","rightWheel"]},{key:"aux",motors:["mainBrush","sideBrush"]}],zS={downRatePerSec:.15,upRatePerSec:.7,releaseDelaySec:1,outputRateMs:250};function c0(){return wl.reduce((a,l)=>(a[l.key]={cap:1,clearSec:0},a),{})}function u0(a){return Number.isFinite(a)?Math.max(0,Math.min(1,a)):0}function LS(a,l={}){const{session:i}=_e(),d=(_l(a)?.sensors||{})?.wheelOvercurrents||{},m=h.useMemo(()=>({...zS,...l.config||{}}),[l.config]),[x,p]=h.useState(()=>c0()),y=h.useRef(typeof performance<"u"?performance.now():Date.now()),b=h.useRef(d);h.useEffect(()=>{b.current=d||{}},[d]),h.useEffect(()=>{p(c0())},[a]),h.useEffect(()=>{const j=setInterval(()=>{const C=typeof performance<"u"?performance.now():Date.now(),A=Math.max(0,C-y.current);y.current=C;const q=A/1e3;q<=0||p(w=>{let k=!1;const Y={},L=Number.isFinite(m.downRatePerSec)?Math.max(0,m.downRatePerSec):0,U=Number.isFinite(m.upRatePerSec)?Math.max(0,m.upRatePerSec):0,B=Number.isFinite(m.releaseDelaySec)?Math.max(0,m.releaseDelaySec):0;return wl.forEach(P=>{const G=w[P.key]||{cap:1,clearSec:0},ne=Number.isFinite(G.cap)?G.cap:1,Q=Number.isFinite(G.clearSec)?G.clearSec:0,W=P.motors.some(z=>!!b.current?.[z]),se=W?0:Q+q,ue=!W&&se>=B,le=u0(W?ne-L*q:ue?ne+U*q:ne);(Math.abs(le-ne)>1e-4||Math.abs(se-Q)>1e-4)&&(k=!0),Y[P.key]={cap:le,clearSec:se}}),k?Y:w})},100);return()=>clearInterval(j)},[m.downRatePerSec,m.releaseDelaySec,m.upRatePerSec]);const S=h.useMemo(()=>{const j=wl.reduce((C,A)=>{const q=x?.[A.key],w=Number.isFinite(q?.cap)?q.cap:1;return C[A.key]=u0(w),C},{});return{perGroup:j,drive:{left:j.drive??1,right:j.drive??1},aux:{main:j.aux??1,side:j.aux??1,vacuum:1}}},[x]),N=h.useMemo(()=>{const j={};wl.forEach(A=>{A.motors.forEach(q=>{j[q]=!!d?.[q]})});const C=wl.reduce((A,q)=>(A[q.key]=q.motors.some(w=>!!d?.[w]),A),{});return{motors:j,groups:C}},[d]),M=i?.role==="admin"||i?.role==="lockdown"||i?.role==="lockdown-admin";return h.useMemo(()=>({caps:x,overcurrent:N,scales:S,isActive:(S?.drive?.left??1)<1||(S?.drive?.right??1)<1||(S?.aux?.main??1)<1||(S?.aux?.side??1)<1,config:m,adminImmune:M}),[x,N,S,m,M])}function US(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 HS(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 wg=h.createContext(null);function f0(a){return Object.fromEntries(Object.entries(a||{}).map(([l,i])=>[l,Array.isArray(i)?[...i]:[]]))}function VS(a,l){if(!a)return l;const i=typeof a.minAngle=="number"?a.minAngle:-45,r=typeof a.maxAngle=="number"?a.maxAngle:45;return ql(l,i,r)}function YS({children:a}){const[l,i]=h.useReducer(qS,s0),r=h.useRef(null),f=h.useRef(!1),d=h.useRef(s0.camera.angle),{value:m,save:x}=dt("controls",{keymap:Us,macros:jg}),{session:p,homeAssistantSetState:y}=_e(),b=p?.assignment?.roverId??null,S=LS(b),N=h.useCallback(_=>US(_,S.scales,S.adminImmune),[S.adminImmune,S.scales]),M=h.useCallback(_=>HS(_,S.scales,S.adminImmune),[S.adminImmune,S.scales]),j=kS({driveTransform:N,auxTransform:M}),C=h.useCallback(()=>{const F=(p?.homeAssistant?.entities||[]).filter(te=>(te.type==="light"||te.type==="switch")&&te.available!==!1&&te.state!=="on");if(F.length===0){f.current=!1;return}f.current=!0,F.forEach(te=>{y(te.id,"on").catch(()=>{})}),f.current=!1},[p?.homeAssistant?.entities,y]);h.useEffect(()=>{i({type:"control/set-rover",payload:j.roverId})},[j.roverId]),h.useEffect(()=>{const _=r.current;r.current=l.mode,_!=="drive"&&l.mode==="drive"&&p?.homeAssistant?.entities?C():_!=="drive"&&l.mode==="drive"&&(f.current=!0)},[l.mode,p?.homeAssistant?.entities,C]),h.useEffect(()=>{f.current&&p?.homeAssistant?.entities&&C()},[p?.homeAssistant?.entities,C]),h.useEffect(()=>{const _={...Us,...m?.keymap||{}};i({type:"control/set-keymap",payload:_}),m?.macros&&i({type:"control/set-macros",payload:m.macros})},[m?.keymap,m?.macros]),h.useEffect(()=>{const _=j.servoConfig;if(!_){i({type:"control/set-camera-config",payload:{config:null}}),d.current=null;return}const F=typeof _.minAngle=="number"?_.minAngle:-45,te=typeof _.maxAngle=="number"?_.maxAngle:45,ie=typeof _.homeAngle=="number"?_.homeAngle:(F+te)/2,Ne=typeof d.current=="number"?ql(d.current,F,te):null,me=Ne??ql(ie,F,te);i({type:"control/set-camera-config",payload:{config:_,angle:me}}),d.current=me},[j.servoConfig]),h.useEffect(()=>{d.current=typeof l.camera.angle=="number"?l.camera.angle:d.current},[l.camera.angle]),h.useEffect(()=>{j.roverId&&j.enableSensorStream()},[j.roverId,j.enableSensorStream]);const A=h.useCallback(_=>{i({type:"control/set-mode",payload:_})},[]),q=h.useCallback(()=>{i({type:"control/record-intent"})},[]),w=h.useRef(l.drive.speeds),k=h.useRef(l.aux),Y=h.useMemo(()=>JSON.stringify(S.scales),[S.scales]),L=h.useRef(0),U=h.useRef(0);h.useEffect(()=>{w.current=l.drive.speeds},[l.drive.speeds]),h.useEffect(()=>{k.current=l.aux},[l.aux]),h.useEffect(()=>{if(!j.roverId||S.adminImmune||!S.isActive)return;const _=Math.max(0,Number(S?.config?.outputRateMs)||0),F=typeof performance<"u"?performance.now():Date.now(),te=w.current||{left:0,right:0},ie=k.current||{main:0,side:0,vacuum:0},Ne=!!(te.left||te.right),me=!!(ie.main||ie.side||ie.vacuum);!Ne&&!me||(Ne&&F-L.current>=_&&(L.current=F,j.sendDriveDirect(te)),me&&F-U.current>=_&&(U.current=F,j.sendAuxMotors(ie)))},[Y,S.adminImmune,S.config,S.isActive,j]);const B=h.useCallback((_,F={})=>{const te=TS(_,F.speedOptions);i({type:"control/update-drive",payload:{...te,source:F.source??null}}),q(),j.sendDriveDirect(te.speeds)},[j,q]),P=h.useCallback((_={})=>{const F=j.sendAuxMotors(_)??_;i({type:"control/set-aux-motors",payload:F}),q()},[j,q]),G=h.useCallback((_,F)=>{if(!_)return!1;const te=Fs(F);if(!te)return!1;const ie=f0(l.keymap);return ie[_]=[te],i({type:"control/set-keymap",payload:ie}),x(Ne=>({...Ne??{},keymap:ie})),!0},[l.keymap,x]),ne=h.useCallback(()=>{const _=f0(Us);i({type:"control/set-keymap",payload:_}),x(F=>({...F??{},keymap:_}))},[x]),Q=h.useCallback(_=>{if(!j.servoConfig)return;const F=VS(j.servoConfig,_);i({type:"control/set-camera-angle",payload:F}),j.sendServoAngle(F),d.current=F,q()},[j,q]),W=h.useCallback((_=0)=>{const F=j.servoConfig;if(!F)return;const te=typeof _=="number"&&_!==0?_:F.nudgeDegrees||1,ie=typeof d.current=="number"?d.current:typeof F.homeAngle=="number"?F.homeAngle:0;Q(ie+te)},[j.servoConfig,Q]),se=h.useCallback(()=>{const _=j.servoConfig;if(!_)return;const F=typeof _.homeAngle=="number"?_.homeAngle:typeof _.minAngle=="number"&&typeof _.maxAngle=="number"?(_.minAngle+_.maxAngle)/2:0;Q(F)},[j.servoConfig,Q]),ue=h.useCallback(async _=>{const F=l.macros.find(te=>te.id===_)||null;F&&(_==="drive-sequence"?(C(),p?.homeAssistant?.entities||(f.current=!0),q()):_==="seek-dock"&&q(),await j.runMacroSteps(F))},[j,q,p?.homeAssistant?.entities,l.macros,C]),le=h.useCallback(()=>{i({type:"control/update-drive",payload:{vector:{x:0,y:0,boost:!1},speeds:{left:0,right:0},source:"system-stop"}}),j.sendDriveDirect({left:0,right:0}),j.sendAuxMotors({main:0,side:0,vacuum:0})},[j]),z=h.useCallback(_=>{j.sendOiCommand(_)},[j]),ee=h.useCallback(_=>{j.roverId&&j.emitCommand({type:"sensorStream",data:{sensorStream:{enable:_}}})},[j]),ae=h.useCallback(_=>{if(j.nightVision){if(typeof _=="boolean"){const F=_?"off":"on";j.sendNightVision(F)}else j.sendNightVision("toggle");q()}},[j,q]),ce=h.useCallback(()=>{ae()},[ae]),he=h.useCallback(_=>{const F=typeof _=="number"?_:Cl;return i({type:"control/set-song-note",payload:F}),F},[]),E=h.useCallback((_,F)=>j.sendSong(_,F),[j]),O=h.useCallback((_,F)=>{i({type:"control/register-input-state",payload:{source:_,state:F}})},[]),K=h.useMemo(()=>({state:l,dispatch:i,pipeline:j,overcurrentLimiter:S,actions:{setMode:A,setDriveVector:B,setAuxMotors:P,setServoAngle:Q,nudgeServo:W,goServoHome:se,runMacro:ue,stopAllMotion:le,sendOiCommand:z,setSensorStream:ee,setNightVision:ae,toggleNightVision:ce,updateKeyBinding:G,resetKeyBindings:ne,registerInputState:O,setSongNote:he,sendSong:E}}),[l,j,S,A,B,P,Q,W,se,ue,le,z,ee,ae,ce,G,ne,O,he,E]);return o.jsx(wg.Provider,{value:K,children:a})}function ht(){const a=h.useContext(wg);if(!a)throw new Error("useControlSystem must be used within ControlSystemProvider");return a}const $S="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=",Eg=h.createContext({messages:[],typing:[],sendMessage:async()=>{},focusChat:()=>{},blurChat:()=>{},registerInputRef:()=>{},onInputFocus:()=>{},onInputBlur:()=>{},setTypingActive:()=>{},isChatFocused:!1});function GS({children:a}){const l=ln(),{session:i,pushAlert:r}=_e(),[f,d]=h.useState([]),[m,x]=h.useState([]),[p,y]=h.useState(!1),b=h.useRef(null),S=h.useRef(null),N=h.useRef(null),M=h.useRef(new Map),j=h.useRef(new Map),C=h.useRef({isTyping:!1,lastSent:0}),A=h.useCallback(()=>{const Q=Array.from(M.current.values()).sort((W,se)=>W.lastUpdate-se.lastUpdate).map(W=>W.payload);x(Q)},[]),q=h.useCallback(Q=>!Q||typeof Q!="object"?null:Q.typingId?Q.typingId:Q.fromDiscord?`discord:${Q.discordUserId||Q.discordUserName||Q.nickname||"unknown"}`:`socket:${Q.socketId||Q.nickname||"unknown"}`,[]);h.useEffect(()=>{N.current=new Audio($S),N.current.load()},[]);const w=h.useCallback(()=>{const Q=N.current;Q&&(Q.currentTime=0,Q.play().catch(()=>{}))},[]);h.useEffect(()=>{function Q(W={}){d(se=>[...se.slice(-99),W]),!(W?.socketId&&i?.socketId&&W.socketId===i.socketId)&&(w(),r?.({kind:"chat",payload:W,id:`chat-${W.id||Math.random().toString(36).slice(2)}`,receivedAt:Date.now()}))}return l.on("chat:message",Q),()=>{l.off("chat:message",Q)}},[w,i?.socketId,l]),h.useEffect(()=>{function Q(W={}){const se=q(W);if(!se)return;const ue=Date.now();if(W?.socketId&&i?.socketId&&W.socketId===i.socketId){W.isTyping||(M.current.delete(se),A());return}if(W.isTyping){M.current.set(se,{payload:W,expiresAt:ue+6e3,lastUpdate:ue});const le=j.current.get(se)||0;ue-le>=2500&&(j.current.set(se,ue),r?.({kind:"chat-typing",payload:W,id:`chat-typing-${se}-${W.id||Math.random().toString(36).slice(2)}`,receivedAt:ue}))}else M.current.delete(se);A()}return l.on("chat:typing",Q),()=>{l.off("chat:typing",Q)}},[r,A,q,i?.socketId,l]),h.useEffect(()=>{const Q=setInterval(()=>{const W=Date.now();let se=!1;M.current.forEach((ue,le)=>{ue.expiresAt<=W&&(M.current.delete(le),se=!0)}),se&&A()},2e3);return()=>clearInterval(Q)},[A]),h.useEffect(()=>{function Q(W=[]){Array.isArray(W)&&d(se=>{if(se.length===0)return W.slice(-100);const ue=new Set(W.map(z=>z?.id));return[...W,...se.filter(z=>z?.id&&!ue.has(z.id))].slice(-100)})}return l.on("chat:init",Q),()=>{l.off("chat:init",Q)}},[l]);const k=h.useCallback(Q=>{const W=!!Q,se=Date.now(),ue=C.current,le=!W&&ue.isTyping;!(W&&(!ue.isTyping||se-ue.lastSent>=3500))&&!le||(C.current={isTyping:W,lastSent:se},l.emit("chat:typing",{isTyping:W}))},[l]),Y=h.useCallback((Q,W=null)=>new Promise((se,ue)=>{l.emit("chat:send",{text:Q,tts:W},(le={})=>{le.error?ue(new Error(le.error)):se(le)})}),[l]),L=h.useCallback((Q,W={})=>{(W?.target==="hud"?"hud":"panel")==="hud"?S.current=Q:b.current=Q},[]),U=h.useCallback(()=>{y(!0),(S.current||b.current)?.focus()},[]),B=h.useCallback(()=>{y(!1),S.current?.blur(),b.current?.blur()},[]),P=h.useCallback(()=>y(!0),[]),G=h.useCallback(()=>y(!1),[]),ne=h.useMemo(()=>({messages:f,sendMessage:Y,focusChat:U,blurChat:B,registerInputRef:L,onInputFocus:P,onInputBlur:G,setTypingActive:k,typing:m,isChatFocused:p,selfSocketId:i?.socketId||null}),[B,U,p,f,G,P,L,Y,i?.socketId,k,m]);return o.jsx(Eg.Provider,{value:ne,children:a})}function yf(){const a=h.useContext(Eg);if(!a)throw new Error("useChat must be used inside ChatProvider");return a}const XS=new Set(["","text","search","email","password","url","tel","number","date","datetime-local","month","time","week"]);function Cg(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 XS.has(i)}function QS(){return typeof document>"u"?!1:Cg(document.activeElement)}const en={keyboard:{baseSpeed:250,turboSpeed:400,precisionSpeed:125,tiltSpeed:80,tiltIntervalMs:110}},qn={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}]}}},aa={activeSignature:null,profiles:{},defaults:{profile:qn}},Su="keyboard",Au={x:0,y:0,boost:!1},ju={main:0,side:0,vacuum:0},d0=xf[0],h0=xf[1],vf=5,Ys=500,$s=1,bf=100;function Nu(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(0,Math.min(500,i)):l}function KS(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(vf,Math.min(Ys,i)):l}function qg(a,l){const i=Number(a);return Number.isFinite(i)?Math.max($s,Math.min(bf,i)):l}function ZS(a){const i=(qg(a,a)-$s)/(bf-$s),r=Ys-i*(Ys-vf);return Math.round(r)}function FS(a){const l=KS(a,a),i=(Ys-l)/(Ys-vf),r=$s+i*(bf-$s);return Math.round(r)}function JS(a){return Cg(a?.target)}function Pe(a,l){if(!a||a.size===0)return!1;for(const i of l)if(a.has(i))return!0;return!1}function IS(a,l){const i=Pe(l.driveForward,a),r=Pe(l.driveBackward,a),f=Pe(l.driveLeft,a),d=Pe(l.driveRight,a),m=Pe(l.boostModifier,a),x=Pe(l.slowModifier,a);let p=0;i&&!r?p=1:r&&!i&&(p=-1);let y=0;f&&!d?y=-1:d&&!f&&(y=1);const b=x?.4:1;return{x:y*b,y:p*b,boost:m&&!x}}function WS(a,l){if(Pe(l.auxAllForward,a))return{main:127,side:127,vacuum:127};const r=Pe(l.auxMainForward,a)?127:Pe(l.auxMainReverse,a)?-127:0,f=Pe(l.auxSideForward,a)?127:Pe(l.auxSideReverse,a)?-70:0,d=Pe(l.auxVacuumFast,a)?127:Pe(l.auxVacuumSlow,a)?50:0;return{main:r,side:f,vacuum:d}}function PS(){const{state:a,actions:{setMode:l,setDriveVector:i,setAuxMotors:r,nudgeServo:f,runMacro:d,stopAllMotion:m,registerInputState:x,toggleNightVision:p,setSongNote:y,sendSong:b}}=ht(),{session:S,homeAssistantSetState:N}=_e(),{focusChat:M,blurChat:j,isChatFocused:C}=yf(),{value:A}=dt("inputs",en),q=h.useMemo(()=>BS(a.keymap),[a.keymap]),w=h.useMemo(()=>{const O=new Set;return Object.values(q).forEach(K=>{K&&K.forEach(_=>O.add(_))}),O},[q]),k=h.useMemo(()=>{const O=en.keyboard,K=A?.keyboard??{};return{baseSpeed:Nu(K.baseSpeed,O.baseSpeed),turboSpeed:Nu(K.turboSpeed,O.turboSpeed),precisionSpeed:Nu(K.precisionSpeed,O.precisionSpeed)}},[A?.keyboard]),Y=h.useMemo(()=>{const O=en.keyboard,K=A?.keyboard??{},_=qg(typeof K.tiltSpeed=="number"?K.tiltSpeed:typeof K.tiltIntervalMs=="number"?FS(K.tiltIntervalMs):O.tiltSpeed,O.tiltSpeed);return ZS(_)},[A?.keyboard]),L=h.useMemo(()=>Math.abs(a.camera?.config?.nudgeDegrees||1),[a.camera?.config?.nudgeDegrees]),U=h.useRef(new Set),B=h.useRef(Au),P=h.useRef(ju),G=h.useRef(null),ne=h.useRef(null),Q=h.useCallback(()=>{const O=new Set(U.current);Pe(q.boostModifier,O);const _=Pe(q.slowModifier,O)?{baseSpeed:k.precisionSpeed,boostSpeed:k.precisionSpeed}:{baseSpeed:k.baseSpeed,boostSpeed:k.turboSpeed},F=IS(O,q),te=WS(O,q);(F.x!==B.current.x||F.y!==B.current.y||F.boost!==B.current.boost)&&(B.current=F,i(F,{source:Su,speedOptions:_})),(te.main!==P.current.main||te.side!==P.current.side||te.vacuum!==P.current.vacuum)&&(P.current=te,r(te)),x(Su,{keys:Array.from(O),vector:F,aux:te})},[q,k,x,r,i]),W=h.useCallback(()=>{G.current&&(clearTimeout(G.current),G.current=null)},[]),se=h.useCallback(()=>{const O=new Set(U.current),K=Pe(q.cameraUp,O),_=Pe(q.cameraDown,O);return(K?1:0)-(_?1:0)},[q]),ue=h.useCallback(()=>{if(se()===0){W();return}if(G.current)return;const K=()=>{const _=se();if(_===0){W();return}f(_*L),G.current=setTimeout(K,Y)};G.current=setTimeout(K,0)},[se,f,Y,L,W]),le=h.useCallback(()=>{ne.current&&(clearTimeout(ne.current),ne.current=null)},[]),z=h.useCallback(()=>{const O=new Set(U.current),K=Pe(q.songNoteUp,O),_=Pe(q.songNoteDown,O);return(K?1:0)-(_?1:0)},[q]),ee=h.useCallback(O=>{if(O===0)return;let _=(typeof a.song?.note=="number"?a.song.note:Cl)+O;_>h0?_=d0:_<d0&&(_=h0);const F=y(_);b([{note:F,duration:Ku}],{slot:0})},[b,y,a.song?.note]),ae=h.useCallback(()=>{if(z()===0){le();return}if(ne.current)return;const K=()=>{const _=z();if(_===0){le();return}ee(_),ne.current=setTimeout(K,wS)};ne.current=setTimeout(K,0)},[z,le,ee]),ce=h.useCallback(()=>{U.current.clear(),B.current=Au,P.current=ju,W(),le(),m(),x(Su,{keys:[],vector:Au,aux:ju})},[x,m,W,le]),he=h.useCallback(O=>{const K=S?.homeAssistant;if(!K?.enabled||!K?.connected)return;const F=(K.entities||[]).filter(te=>(te.type==="light"||te.type==="switch")&&te.available!==!1&&te.state!=="unavailable");if(F.length!==0){if(O==="on"){const te=F.find(ie=>ie.state!=="on");te&&N(te.id,"on").catch(()=>{});return}if(O==="off")for(let te=F.length-1;te>=0;te-=1){const ie=F[te];if(ie.state==="on"){N(ie.id,"off").catch(()=>{});break}}}},[N,S?.homeAssistant]);h.useEffect(()=>{function O(F){if(JS(F))return;const te=o0(F);if(te.length===0)return;const ie=new Set(te);if(Pe(q.chatFocus,ie)){F.preventDefault(),ce(),C||M();return}te.some(me=>w.has(me))&&F.preventDefault();const Ne=te.filter(me=>!U.current.has(me));Ne.forEach(me=>U.current.add(me)),Ne.length>0&&(Ne.some(me=>q.driveMacro?.has(me))?(l("drive"),d("drive-sequence")):Ne.some(me=>q.dockMacro?.has(me))?(l("dock"),d("seek-dock")):Ne.some(me=>q.nightVisionToggle?.has(me))?p():Ne.some(me=>q.homeAssistantOn?.has(me))?he("on"):Ne.some(me=>q.homeAssistantOff?.has(me))&&he("off")),ue(),ae(),Q()}function K(F){o0(F).forEach(ie=>U.current.delete(ie)),ue(),ae(),Q()}function _(){ce()}return window.addEventListener("keydown",O,{capture:!0}),window.addEventListener("keyup",K,{capture:!0}),window.addEventListener("blur",_),()=>{window.removeEventListener("keydown",O,{capture:!0}),window.removeEventListener("keyup",K,{capture:!0}),window.removeEventListener("blur",_)}},[w,j,Q,ue,ae,M,C,q.chatFocus,q.dockMacro,q.driveMacro,ce,d,l,m,le,he]);const E=h.useRef(ce);return h.useEffect(()=>{E.current=ce},[ce]),h.useEffect(()=>{E.current()},[a.roverId]),h.useEffect(()=>()=>{W(),le()},[W,le]),null}const eA=1.6;function Mg(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 tA(a){return JSON.parse(JSON.stringify(a??{}))}function Tg(a,l){const i=tA(l);return i.meta={id:a?.id??"Unknown",mapping:a?.mapping??"none",axes:a?.axes?.length??0,buttons:a?.buttons?.length??0},i}function Ta(a){return Number.isFinite(a)?Math.max(-1,Math.min(1,a)):0}function Bs(a,l){if(!a)return 0;const i=Math.abs(a);return l==="expo"?Math.sign(a)*Math.pow(i,eA):a}function wu(a,l){const i=Math.abs(a);if(i<=l)return 0;const r=(i-l)/(1-l);return Math.sign(a)*r}function nA(a,l,i){const r=Math.hypot(a,l);if(r<=i)return{x:0,y:0};const d=(r-i)/(1-i)/r;return{x:a*d,y:l*d}}function _r(a,l){if(!a||!Array.isArray(a.axes))return null;const i=a.axes[l];return Number.isFinite(i)?Ta(i):null}function Ju(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 Eu(a,l=[]){for(const i of l)if(i){if(i.kind==="axis"){const r=_r(a,i.index);if(r===null)continue;return{value:i.invert?-r:r,source:i}}if(i.kind==="buttonAxis"){const r=Ju(a,i.index);if(!r)continue;return{value:Ta(r.value),source:i}}}return{value:0,source:null}}function aA(a,l=[]){for(const i of l){if(!i||i.kind!=="axisPair")continue;const r=_r(a,i.x),f=_r(a,i.y);if(r===null||f===null)continue;const d=i.invertX?-r:r,m=i.invertY?-f:f;return{x:d,y:m,source:i}}return{x:0,y:0,source:null}}function Ca(a,l=[]){for(const i of l)if(i){if(i.kind==="button"){const r=Ju(a,i.index);if(!r)continue;return{pressed:r.pressed,source:i}}if(i.kind==="axisButton"){const r=_r(a,i.index);if(r===null)continue;const f=i.direction||1,d=typeof i.threshold=="number"?i.threshold:.6;return{pressed:r*f>d,source:i}}if(i.kind==="buttonAxis"){const r=Ju(a,i.index);if(!r)continue;return{pressed:r.value>.5,source:i}}}return{pressed:!1,source:null}}function Rg(a,l){const i=l?.bindings??{},r=l?.calibration??{},f=i.drive??{},d=aA(a,f.sources);let m=Ta(d.x),x=Ta(d.y);const p=Math.min(Math.max(r.driveDeadzone??.18,0),.8),y=nA(m,x,p);m=Bs(y.x,r.driveCurve),x=Bs(y.y,r.driveCurve);const b=i.cameraTilt??{},S=Eu(a,b.sources),N=Math.min(Math.max(r.cameraDeadzone??.08,0),.8);let M=wu(Ta(S.value),N);M=Bs(M,r.cameraCurve);const j=Math.min(Math.max(r.auxDeadzone??.05,0),.6),C=i.mainBrush??{},A=Eu(a,C.sources);let q=wu(Ta(A.value),j);q=Bs(q,r.auxCurve);const w=i.sideBrush??{},k=Eu(a,w.sources);let Y=wu(Ta(k.value),j);Y=Bs(Y,r.auxCurve);const L=Ca(a,i.vacuum?.sources),U=Ca(a,i.allAux?.sources),B=Ca(a,i.mainReverse?.sources),P=Ca(a,i.sideReverse?.sources),G=Ca(a,i.driveMacro?.sources),ne=Ca(a,i.dockMacro?.sources),Q=Ca(a,i.nightVisionToggle?.sources);return{driveVector:{x:m,y:x,boost:!1},cameraAxis:M,auxAxis:{main:q,side:Y},buttons:{vacuum:L.pressed,allAux:U.pressed,mainReverse:B.pressed,sideReverse:P.pressed,driveMacro:G.pressed,dockMacro:ne.pressed,nightVisionToggle:Q.pressed},sources:{drive:d.source,cameraTilt:S.source,mainBrush:A.source,sideBrush:k.source,vacuum:L.source,allAux:U.source,mainReverse:B.source,sideReverse:P.source,driveMacro:G.source,dockMacro:ne.source,nightVisionToggle:Q.source}}}const qr=new Set;let El=null,Dr={pads:[],timestamp:0};function lA(){if(typeof navigator>"u"||!navigator.getGamepads)return[];const a=navigator.getGamepads();return a?Array.from(a).filter(Boolean):[]}function sA(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:Mg(a)}}function iA(){Dr={pads:lA().map(sA),timestamp:typeof performance<"u"?performance.now():Date.now()},qr.forEach(l=>l(Dr))}function kg(){iA(),El=requestAnimationFrame(kg)}function rA(){El||(El=requestAnimationFrame(kg))}function oA(){El&&(cancelAnimationFrame(El),El=null)}function _g(a){return qr.add(a),rA(),a(Dr),()=>{qr.delete(a),qr.size===0&&oA()}}function cA(){const[a,l]=h.useState(Dr);return h.useEffect(()=>_g(l),[]),a}const jl="gamepad",qa={x:0,y:0,boost:!1},Ma={main:0,side:0,vacuum:0};function Cu(a,l){return a&&l&&a.x===l.x&&a.y===l.y&&a.boost===l.boost}function qu(a,l){return a&&l&&a.main===l.main&&a.side===l.side&&a.vacuum===l.vacuum}function uA(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 fA(){const{state:a,actions:{setMode:l,setDriveVector:i,setAuxMotors:r,setServoAngle:f,runMacro:d,toggleNightVision:m,registerInputState:x}}=ht(),{value:p,save:y}=dt("gamepad",aa),b=h.useRef(new Set),S=h.useRef(qa),N=h.useRef(Ma),M=h.useRef({main:!1,side:!1}),j=h.useRef(new Map),C=h.useRef(0),A=h.useRef(null),q=h.useCallback(L=>{const U=L.signature??Mg(L);p?.profiles?.[U]||b.current.has(U)||(b.current.add(U),y(B=>{const P=B??aa;if(P.profiles?.[U])return P;const G=P?.defaults?.profile??qn,ne=Tg(L,G);return{...P,profiles:{...P.profiles??{},[U]:ne}}}))},[p?.profiles,y]),w=h.useCallback((L,U)=>{const B=j.current.get(L)||!1;return j.current.set(L,U),U&&!B},[]),k=h.useCallback((L,U)=>{const B=a.camera?.config;if(!B)return;const P=typeof performance<"u"?performance.now():Date.now(),G=U?.cameraMode??"absolute",ne=Math.max(1,Math.min(180,U?.cameraSensitivity??60));if(G==="velocity"){const le=Math.min(50,P-C.current||16),z=L*ne*(le/1e3);if(Math.abs(z)<.01)return;const ae=(typeof A.current=="number"?A.current:typeof a.camera?.angle=="number"?a.camera.angle:typeof B.homeAngle=="number"?B.homeAngle:0)+z;f(ae),A.current=ae,C.current=P;return}const Q=typeof B.minAngle=="number"?B.minAngle:-45,W=typeof B.maxAngle=="number"?B.maxAngle:45,se=typeof B.homeAngle=="number"?B.homeAngle:(Q+W)/2,ue=L<0?se+L*(se-Q):se+L*(W-se);typeof A.current=="number"&&Math.abs(A.current-ue)<.35&&P-C.current<80||(C.current=P,A.current=ue,f(ue))},[f,a.camera?.angle,a.camera?.config]),Y=h.useMemo(()=>p?.activeSignature??null,[p?.activeSignature]);return h.useEffect(()=>_g(L=>{const U=uA(L.pads,Y);if(!U){Cu(S.current,qa)||(S.current=qa,i(qa,{source:jl})),qu(N.current,Ma)||(N.current=Ma,r(Ma)),j.current=new Map,M.current={main:!1,side:!1},x(jl,{connected:!1});return}if(QS()){Cu(S.current,qa)||(S.current=qa,i(qa,{source:jl})),qu(N.current,Ma)||(N.current=Ma,r(Ma)),j.current=new Map,M.current={main:!1,side:!1},x(jl,{connected:!0,blocked:!0});return}q(U);const B=U.signature,P=p?.profiles?.[B]??p?.defaults?.profile??qn,G=Rg(U,P);Cu(G.driveVector,S.current)||(S.current=G.driveVector,i(G.driveVector,{source:jl}));const ne=P.calibration?.auxSideScale??.55,Q=Math.round(Math.min(Math.abs(G.auxAxis.main),1)*127),W=Math.round(Math.min(Math.abs(G.auxAxis.side),1)*127),se=M.current.main?-Q:Q,ue=M.current.side?-Math.round(W*ne):Math.round(W*ne);let le={main:G.auxAxis.main!==0?se:0,side:G.auxAxis.side!==0?ue:0,vacuum:G.buttons.vacuum?127:0};G.buttons.allAux&&(le={main:127,side:127,vacuum:127}),qu(le,N.current)||(N.current=le,r(le)),G.buttons.mainReverse&&w("mainReverse",!0)?M.current.main=!M.current.main:G.buttons.mainReverse||w("mainReverse",!1),G.buttons.sideReverse&&w("sideReverse",!0)?M.current.side=!M.current.side:G.buttons.sideReverse||w("sideReverse",!1),G.buttons.driveMacro&&w("driveMacro",!0)?(l("drive"),d("drive-sequence")):G.buttons.driveMacro||w("driveMacro",!1),G.buttons.dockMacro&&w("dockMacro",!0)?(l("dock"),d("seek-dock")):G.buttons.dockMacro||w("dockMacro",!1),G.buttons.nightVisionToggle&&w("nightVisionToggle",!0)?m():G.buttons.nightVisionToggle||w("nightVisionToggle",!1),Math.abs(G.cameraAxis)>.001&&k(G.cameraAxis,P.calibration),x(jl,{connected:!0,signature:B,id:U.id,index:U.index,axes:U.axes,buttons:U.buttons,drive:G.driveVector,aux:le,cameraAxis:G.cameraAxis,bindings:G.sources})}),[Y,q,p?.defaults?.profile,p?.profiles,w,k,x,d,r,i,l,m]),null}function Dg(a){const l=a?.sensors||{},i=l.oiMode?.label||"Unknown",r=i.toLowerCase(),f=l.chargingState?.label||"",d=!!l.chargingSources?.homeBase,m=d&&f.toLowerCase()!=="not charging"&&f!=="";return{driving:r==="full",docked:d,charging:m,dockedNotCharging:d&&!m,dockingInProgress:!d&&!m&&r==="passive",oiLabel:i,chargingLabel:f}}function Og(a){const l=_l(a);return h.useMemo(()=>Dg(l),[l])}function Nl({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 m0({label:a}){return a?o.jsx("span",{className:"rounded border border-white/40 px-1 text-[0.7rem] text-white",children:a}):null}function Mu({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 dA({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(Iu,{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 Bg({layout:a="desktop",expand:l=!1,driveDockState:i}){const r=a==="mobile",{state:{roverId:f,keymap:d},actions:m}=ht(),x=_l(f),p=i??Dg(x),{driving:y,docked:b,charging:S,dockingInProgress:N}=p,[M,j]=h.useState(null),[C,A]=h.useState(!1),[q,w]=h.useState(!1),k=!f||M!==null,Y=!f||M!==null,L=Tn(d?.driveMacro?.[0]),U=Tn(d?.dockMacro?.[0]),B={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"]},P="Click this button to initate auto-dock.",G={summary:"You must enable driving mode before you can move the rover.",steps:["Press the keybind or tap this button to enable driving mode","Once ready (should be instant), this dialog will change, and you will be able to move"]},ne=b?"Docked":"Undocked",Q=b?"good":"bad",W=S?"Charging":b?"Charging in 5s":"—",se=S?"good":b?"warn":"bad",ue=async()=>{if(!(!f||M)){j("drive");try{m.setMode("drive"),await m.runMacro("drive-sequence")}catch(ie){alert(ie.message)}finally{j(null)}}},le=async()=>{if(!(!f||M)){A(!1),w(!1),j("drive");try{m.setMode("drive"),await m.runMacro("drive-sequence")}catch(ie){alert(ie.message)}finally{j(null)}}},z=async()=>{if(!(!f||M)){j("dock");try{m.setMode("dock"),await m.runMacro("seek-dock")}catch(ie){alert(ie.message)}finally{j(null),A(!1),w(!1)}}},ee=()=>{Y||(w(!0),A(!0))},ae="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",E="text-center items-center justify-between",O=r?"text-sm font-semibold":"",K="border-emerald-300/70 bg-emerald-800 text-emerald-50 hover:bg-emerald-700 focus-visible:ring-emerald-300",_="border-amber-300/70 bg-amber-900 text-amber-50 hover:bg-amber-800 focus-visible:ring-amber-300",F="border-indigo-300/70 bg-indigo-900 text-indigo-50 hover:bg-indigo-800 focus-visible:ring-indigo-300",te=l?"h-full flex-1":"";if(!y&&!N)return o.jsxs("button",{type:"button",onClick:le,disabled:k,className:`${ae} ${te} ${E} ${O} ${K}`,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"}),r?null:o.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-0.5",children:[L?o.jsx(m0,{label:L}):null,o.jsx(Mu,{label:"Click to start",tone:"emerald"})]})]}),o.jsx("p",{className:"text-sm text-emerald-50/90",children:G.summary}),o.jsx(Iu,{steps:G.steps,tone:"emerald"})]}),o.jsxs("div",{className:"flex w-full flex-1 flex-col gap-0.5 self-stretch",children:[o.jsx(Nl,{label:"Dock",value:ne,tone:Q}),o.jsx(Nl,{label:"Charge",value:W,tone:se})]})]});if(N){const ie={summary:"Docking attempt in progress.",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:k,onClick:ue,className:`${ae} ${te} ${E} ${O} ${_}`,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"}),r?null:o.jsx("div",{className:"flex flex-wrap items-center justify-center gap-0.5",children:o.jsx(Mu,{label:"Click to return to driving mode",tone:"amber"})})]}),o.jsx("p",{className:"text-sm text-amber-50/90",children:ie.summary})]}),o.jsxs("div",{className:"flex w-full flex-1 flex-col gap-0.5 self-stretch",children:[o.jsx(Nl,{label:"Dock",value:ne,tone:Q}),o.jsx(Nl,{label:"Charge",value:W,tone:se})]}),o.jsx(Iu,{steps:ie.steps,tone:"amber"})]})}return o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",disabled:Y,onClick:ee,className:r?`flex w-full items-center justify-center ${ae} ${E} ${O} ${F}`:`${ae} ${te} ${E} ${O} ${F}`,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:"Dock and Charge"}),r?null:o.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-0.5",children:[U?o.jsx(m0,{label:U}):null,o.jsx(Mu,{label:"Click to begin docking",tone:"indigo"})]})]}),!r&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"text-sm text-indigo-50/90",children:P}),o.jsxs("div",{className:"flex w-full flex-1 flex-col gap-0.5 self-stretch",children:[o.jsx(Nl,{label:"Dock",value:ne,tone:Q}),o.jsx(Nl,{label:"Charge",value:W,tone:se})]}),o.jsx("div",{className:"text-xs text-indigo-100/80",children:"Line up straight, about 1 foot away, before docking."})]})]}),q||!r&&C?o.jsx(dA,{instructions:B,pending:M==="dock",onCancel:()=>{w(!1),A(!1)},onConfirm:z}):null]})}function Iu({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 Tu(a){return typeof a=="boolean"}function zg({nightVisionOn:a,disabled:l,onToggle:i,keyLabel:r,className:f=""}){const[d,m]=h.useState(Tu(a)?a:null);h.useEffect(()=>{Tu(a)&&m(a)},[a]);const x=Tu(d),p=x?d:!1,y=x?p?"On":"Off":"—",b=p?"bg-emerald-600 text-emerald-50":"bg-slate-700 text-slate-200",S=()=>{if(l)return;const M=x?!p:!0;m(M),i?.(M)},N=h.useMemo(()=>["flex w-full items-center justify-between rounded bg-zinc-950 px-1 py-0.5 text-xs text-slate-300","transition hover:bg-zinc-900 disabled:opacity-50",f].filter(Boolean).join(" "),[f]);return o.jsxs("button",{type:"button",onClick:S,disabled:l,"aria-pressed":p,className:N,children:[o.jsx("span",{className:"text-slate-400",children:"Night Vision"}),o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx("span",{className:`rounded px-1 py-0.5 text-[0.65rem] font-semibold ${b}`,children:y}),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]})]})}const yr="mobile-joystick",hA=80,mA=.15,pA=[{id:"main-forward",label:"Main Brush +",values:{main:127},hold:!0,color:"bg-emerald-600"},{id:"main-reverse",label:"Main Brush -",values:{main:-127},hold:!0,color:"bg-emerald-800"},{id:"all-forward",label:"All Motors +",values:{main:127,side:127,vacuum:127},hold:!0,color:"bg-fuchsia-600"},{id:"side-forward",label:"Side Brush +",values:{side:127},hold:!0,color:"bg-cyan-600"},{id:"side-reverse",label:"Side Brush -",values:{side:-70},hold:!0,color:"bg-cyan-800"},{id:"vacuum-fast",label:"Vacuum Max",values:{vacuum:127},hold:!0,color:"bg-amber-500 text-amber-950"},{id:"vacuum-slow",label:"Vacuum Low",values:{vacuum:50},hold:!0,color:"bg-amber-700"},{id:"stop-all",label:"Stop",values:{main:0,side:0,vacuum:0},hold:!1,color:"bg-slate-900"}];function gA({disabled:a,layout:l,radius:i,onMove:r,onStop:f}){const d=h.useRef(null),m=h.useRef(null),x=h.useRef({x:0,y:0}),[p,y]=h.useState({active:!1,base:{x:0,y:0},knob:{x:0,y:0}}),b=h.useCallback(()=>{m.current=null,y({active:!1,base:{x:0,y:0},knob:{x:0,y:0}}),f?.()},[f]),S=h.useCallback(C=>{if(a||m.current!==null)return;C.preventDefault();const A=d.current;if(!A)return;const q=A.getBoundingClientRect(),w=C.clientX-q.left,k=C.clientY-q.top;x.current={x:w,y:k},m.current=C.pointerId,A.setPointerCapture?.(C.pointerId),y({active:!0,base:{x:w,y:k},knob:{x:0,y:0}})},[a]),N=h.useCallback(C=>{if(a||m.current!==C.pointerId)return;C.preventDefault();const A=d.current;if(!A)return;const q=A.getBoundingClientRect(),w=C.clientX-q.left,k=C.clientY-q.top,Y=w-x.current.x,L=k-x.current.y,U=Math.min(Math.hypot(Y,L),i),B=Math.atan2(L,Y),P=Math.cos(B)*U,G=Math.sin(B)*U,ne={x:Ml(P/i),y:Ml(-G/i),boost:!1};y(Q=>({...Q,knob:{x:P,y:G}})),r?.(ne)},[a,r]),M=h.useCallback(C=>{if(m.current!==C.pointerId)return;C.preventDefault(),d.current?.releasePointerCapture?.(C.pointerId),b()},[b]);h.useEffect(()=>{a&&b()},[a,b]);const j=l==="landscape"?"h-[260px]":"h-[220px]";return o.jsxs("div",{ref:d,role:"presentation",className:`relative w-full ${j} select-none overflow-hidden bg-zinc-950`,style:{touchAction:"none"},onPointerDown:S,onPointerMove:N,onPointerUp:M,onPointerLeave:M,onPointerCancel:M,onContextMenu:C=>C.preventDefault(),children:[!p.active&&o.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-center text-xs text-slate-400",children:[o.jsx("p",{children:"Touch and hold anywhere"}),o.jsx("p",{children:"Joystick will follow your thumb"})]}),p.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:p.base.x,top:p.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:p.base.x+p.knob.x,top:p.base.y+p.knob.y}})]})]})}function Lg({layout:a}){const{state:{roverId:l,camera:i},pipeline:r,actions:{setDriveVector:f,registerInputState:d,setServoAngle:m,setNightVision:x}}=ht(),p=Og(l),y=p.docked&&!p.driving,b=!l,S=i?.config,N=!!(l&&i?.enabled&&S),M=!!(l&&r?.nightVision),j=r?.nightVisionState,C=typeof S?.minAngle=="number"?S.minAngle:-45,A=typeof S?.maxAngle=="number"?S.maxAngle:45,q=typeof i?.angle=="number"?i.angle:typeof S?.homeAngle=="number"?S.homeAngle:(C+A)/2,w=hA,k=mA,Y=h.useRef({x:0,y:0,boost:!1});h.useEffect(()=>{b&&(Y.current={x:0,y:0,boost:!1})},[b]);const L=h.useCallback((Q={})=>{if(b)return;const W={x:Ml(Q.x??0),y:Ml(Q.y??0),boost:!!Q.boost},se={x:Y.current.x+(W.x-Y.current.x)*(1-k),y:Y.current.y+(W.y-Y.current.y)*(1-k),boost:W.boost};Y.current=se,f(se,{source:yr}),d(yr,{vector:se,lastEvent:"move"})},[b,d,f,k]),U=h.useCallback(()=>{if(b)return;const Q={x:0,y:0,boost:!1};Y.current=Q,f(Q,{source:yr}),d(yr,{vector:Q,lastEvent:"stop"})},[b,d,f]),B=Q=>{if(!N)return;const W=Number(Q.target.value);Number.isNaN(W)||m(W)},P=h.useCallback(Q=>{M&&x(Q)},[M,x]),ne=`flex h-full flex-col gap-0.5 text-slate-100 ${y?"max-h-screen self-start":""}`;return o.jsxs("div",{className:ne,children:[o.jsx(Bg,{layout:"mobile",expand:y,driveDockState:p}),y?null:o.jsxs(o.Fragment,{children:[N&&o.jsxs("div",{className:"bg-zinc-950 p-0.5 text-xs",children:[o.jsxs("div",{className:"flex items-center justify-between text-[0.75rem] text-slate-400",children:[o.jsx("span",{children:"Camera Tilt"}),o.jsxs("span",{className:"font-mono text-slate-200",children:[q.toFixed(1),"°"]})]}),o.jsx("input",{type:"range",min:C,max:A,step:.5,value:q,onChange:B,className:"mt-0 w-full accent-cyan-400"})]}),M&&o.jsx(zg,{nightVisionOn:j?.nightVisionOn,disabled:b,onToggle:P,className:"mt-0.5"}),o.jsx(gA,{disabled:b,layout:a,radius:w,onMove:L,onStop:U})]})]})}function Ug({orientation:a}){const{state:{roverId:l},actions:{setAuxMotors:i}}=ht(),r=h.useRef(null),f=!l,d=h.useCallback(p=>{if(!f){if(p.hold===!1){i(p.values),r.current=null;return}r.current=p.id,i(p.values)}},[f,i]),m=h.useCallback(p=>{f||p.hold===!1||r.current===p.id&&(r.current=null,i({main:0,side:0,vacuum:0}))},[f,i]),x=a==="landscape"?"grid-cols-1":"grid-cols-1 sm:grid-cols-2";return o.jsxs("div",{className:"flex h-full flex-col gap-0.5 text-slate-100",children:[o.jsx("p",{className:"text-xs text-slate-400",children:"Aux controls"}),o.jsx("div",{className:`grid ${x} gap-0.5`,children:pA.map(p=>o.jsx("button",{type:"button",disabled:f,onPointerDown:y=>{y.preventDefault(),d(p)},onPointerUp:()=>m(p),onPointerLeave:()=>m(p),onPointerCancel:()=>m(p),onContextMenu:y=>y.preventDefault(),className:`px-0.5 py-0.5 text-left text-sm font-semibold text-white transition select-none no-touch-select ${p.color} hover:brightness-110 disabled:opacity-30 h-10`,children:p.label},p.id))})]})}function xA(){return o.jsx("div",{className:"flex h-full flex-col gap-0.5",children:o.jsx(Ug,{orientation:"landscape"})})}function yA(){return o.jsx("div",{className:"flex h-full flex-col gap-0.5",children:o.jsx(Lg,{layout:"landscape"})})}function vA(){return o.jsx("section",{className:"panel",children:o.jsxs("div",{className:"grid grid-cols-2 gap-0.5 items-stretch",children:[o.jsx(Ug,{orientation:"portrait"}),o.jsx(Lg,{layout:"portrait"})]})})}function bA(a=[],l={}){const i=ln(),{enabled:r=!0,version:f=null}=l,[d,m]=h.useState({}),x=h.useRef(new Map),p=h.useMemo(()=>a.map(j=>typeof j=="string"?j:j.id),[a]),y=h.useMemo(()=>{const j=p.join("|");return f?`${j}|v:${f}`:j},[p,f]),b=h.useRef([]),[S,N]=h.useState(0),M=h.useRef(new Map);return h.useEffect(()=>{if(!i)return;const j=()=>N(C=>C+1);return i.on("connect",j),()=>i.off("connect",j)},[i]),h.useEffect(()=>{b.current=p},[y,p]),h.useEffect(()=>{x.current.forEach(j=>URL.revokeObjectURL(j)),x.current.clear(),m({})},[y]),h.useEffect(()=>{if(!r){x.current.forEach(w=>URL.revokeObjectURL(w)),x.current.clear(),m({});return}if(!b.current.length||!i)return;let j=!1;const C=b.current,A=(w={},k)=>{if(j||!w.id||!k)return;const Y=k.byteLength??k.length??0,L=Date.now(),U=M.current.get(w.id)||{count:0,totalBytes:0,lastLogAt:0},B={count:U.count+1,totalBytes:U.totalBytes+Y,lastLogAt:U.lastLogAt};if(!B.lastLogAt||L-B.lastLogAt>=1e4){const Q=B.count?B.totalBytes/B.count:0;console.log("[roomCamera]",w.id,`frame=${Y}B`,`avg=${Math.round(Q)}B`,`count=${B.count}`),B.lastLogAt=L}M.current.set(w.id,B);const P=new Blob([k],{type:"image/jpeg"}),G=URL.createObjectURL(P),ne=x.current.get(w.id);ne&&URL.revokeObjectURL(ne),x.current.set(w.id,G),m(Q=>({...Q,[w.id]:{status:"playing",ts:w.ts||Date.now(),error:null,objectUrl:G}}))},q=(w={})=>{j||!w.id||m(k=>({...k,[w.id]:{...k[w.id]||{},status:w.error?"error":k[w.id]?.status||"connecting",error:w.error||null,ts:w.ts||k[w.id]?.ts||null,objectUrl:k[w.id]?.objectUrl||null}}))};return i.on("roomCamera:frame",A),i.on("roomCamera:status",q),i.emit("roomCamera:subscribe",{ids:C},(w={})=>{w.error}),()=>{j=!0,i.emit("roomCamera:unsubscribe",{ids:C}),i.off("roomCamera:frame",A),i.off("roomCamera:status",q),x.current.forEach(w=>URL.revokeObjectURL(w)),x.current.clear()}},[i,y,r,S]),d}function SA({feed:a,label:l}){const[i,r]=h.useState(!1);h.useEffect(()=>{a&&(!a.ts&&!a.objectUrl||r(d=>!d))},[a?.ts,a?.objectUrl]);const f=h.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 AA(){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 Hg=["horizontal","vertical"];function Ru(a,l){return Hg.includes(a)?a:l}function Sf({defaultOrientation:a="horizontal",orientation:l,hideLayoutToggle:i=!1,hideHeader:r=!1,panelId:f=null}){const{session:d}=_e(),m=d?.roomCameras||[],x=bA(m.map(A=>({id:A.id}))),{value:p,save:y}=dt("roomCameraPanels",{}),[b,S]=h.useState(()=>Ru(f?p?.[f]:a,"horizontal"));h.useEffect(()=>{if(!f)return;const A=p?.[f];A&&S(Ru(A,"horizontal"))},[f,p?.[f]]);const N=l?Ru(l,"horizontal"):b,M=N==="vertical"?"flex flex-col gap-0.5":"grid gap-0.5 md:grid-cols-2",j=!i&&!l&&m.length>0,C=A=>{S(A),f&&y(q=>({...q||{},[f]:A}))};return m.length===0?o.jsx(AA,{}):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:m.length})]}),o.jsx("div",{className:"flex flex-wrap items-center gap-0.5 text-xs",children:j&&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:Hg.map(A=>o.jsx("button",{type:"button",className:`px-1 py-0.5 ${N===A?"bg-slate-600 text-white":"bg-transparent text-slate-400 hover:text-white"}`,onClick:()=>C(A),children:A==="vertical"?"Vertical":"Grid"},A))})]})})]}),o.jsx("div",{className:M,children:m.map(A=>{const q=x[A.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(SA,{feed:q,label:A.name||A.id})},A.id)})})]})}function Af(){const{logs:a}=_e();return o.jsxs("div",{className:"panel-section space-y-0.5 text-base",children:[o.jsxs("div",{className:"flex items-center justify-between text-sm text-slate-400",children:[o.jsx("span",{children:"Server logs"}),o.jsx("span",{children:a.length})]}),o.jsx("div",{className:"surface h-64 overflow-y-auto font-mono text-xs",children:a.length===0?o.jsx("p",{children:"No logs yet."}):a.slice().reverse().map(l=>o.jsxs("div",{className:"surface",children:[o.jsx("span",{className:"text-amber-400",children:l.timestamp})," ",o.jsxs("span",{className:"text-lime-400",children:["[",l.level,"]"]})," ",l.label&&o.jsxs("span",{className:"text-teal-400",children:["[",l.label,"]"]})," ",o.jsx("span",{children:l.message})]},l.id))})]})}function jA(a){if(!a)return null;if(typeof a=="string"){const l=String(a).trim();return l?{type:"rover",id:l,key:l}:null}if(typeof a=="object"){if(a.type&&a.id){const l=String(a.id);let i=a.key;return i||(i=a.type==="room"?`room:${l}`:l),{type:a.type,id:l,key:i}}if(a.roverId){const l=String(a.roverId);return{type:"rover",id:l,key:a.key||l}}if(a.roomCameraId){const l=String(a.roomCameraId);return{type:"room",id:l,key:a.key||`room:${l}`}}}return null}function NA(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 jf(a=[],l={}){const i=ln(),{enabled:r=!0,version:f=null}=l,[d,m]=h.useState({}),x=h.useMemo(()=>Array.isArray(a)?NA(a.map(jA).filter(Boolean)):[],[a]),p=h.useMemo(()=>{const M=x.map(j=>`${j.type}:${j.id}:${j.key}`).join("|");return f?`${M}|v:${f}`:M},[x,f]),y=h.useRef([]),[b,S]=h.useState(0);return h.useEffect(()=>{if(!i)return;const M=()=>S(j=>j+1);return i.on("connect",M),()=>{i.off("connect",M)}},[i]),h.useEffect(()=>{y.current=x},[x]),h.useEffect(()=>{if(!p||!r){m({});return}const M=y.current;let j=!1;function C(A){const q=A.type==="room"?{roomCameraId:A.id}:{roverId:A.id};i.emit("video:request",q,(w={})=>{j||m(k=>({...k,[A.key]:w}))})}return M.forEach(A=>{C(A)}),()=>{j=!0}},[i,p,r,b]),h.useMemo(()=>{if(!p||!r)return{};const M={};return x.forEach(j=>{d[j.key]&&(M[j.key]=d[j.key])}),M},[p,d,x])}function Nf(a=[],l={}){const i=ln(),{enabled:r=!0,version:f=null}=l,[d,m]=h.useState({}),x=h.useRef(new Map),p=h.useMemo(()=>a.map(j=>typeof j=="string"?j:j.id).filter(Boolean),[a]),y=h.useMemo(()=>{const j=p.join("|");return f?`${j}|v:${f}`:j},[p,f]),b=h.useRef([]),[S,N]=h.useState(0),M=h.useRef(new Map);return h.useEffect(()=>{if(!i)return;const j=()=>N(C=>C+1);return i.on("connect",j),()=>i.off("connect",j)},[i]),h.useEffect(()=>{b.current=p},[y,p]),h.useEffect(()=>{x.current.forEach(j=>URL.revokeObjectURL(j)),x.current.clear(),m({})},[y]),h.useEffect(()=>{if(!r){x.current.forEach(w=>URL.revokeObjectURL(w)),x.current.clear(),m({});return}if(!b.current.length||!i)return;let j=!1;const C=b.current,A=(w={},k)=>{if(j||!w.id||!k)return;const Y=k.byteLength??k.length??0,L=Date.now(),U=M.current.get(w.id)||{count:0,totalBytes:0,lastLogAt:0},B={count:U.count+1,totalBytes:U.totalBytes+Y,lastLogAt:U.lastLogAt};if(!B.lastLogAt||L-B.lastLogAt>=1e4){const Q=B.count?B.totalBytes/B.count:0;console.log("[roverSnapshot]",w.id,`frame=${Y}B`,`avg=${Math.round(Q)}B`,`count=${B.count}`),B.lastLogAt=L}M.current.set(w.id,B);const P=new Blob([k],{type:"image/jpeg"}),G=URL.createObjectURL(P),ne=x.current.get(w.id);ne&&URL.revokeObjectURL(ne),x.current.set(w.id,G),m(Q=>({...Q,[w.id]:{status:"playing",ts:w.ts||Date.now(),error:null,objectUrl:G}}))},q=(w={})=>{j||!w.id||m(k=>({...k,[w.id]:{...k[w.id]||{},status:w.error?"error":k[w.id]?.status||"connecting",error:w.error||null,ts:w.ts||k[w.id]?.ts||null,objectUrl:k[w.id]?.objectUrl||null}}))};return i.on("roverSnapshot:frame",A),i.on("roverSnapshot:status",q),i.emit("roverSnapshot:subscribe",{ids:C},(w={})=>{w.error}),()=>{j=!0,i.emit("roverSnapshot:unsubscribe",{ids:C}),i.off("roverSnapshot:frame",A),i.off("roverSnapshot:status",q),x.current.forEach(w=>URL.revokeObjectURL(w)),x.current.clear()}},[i,y,r,S]),d}const wA={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"turn:your.turn.server:3478",username:"user",credential:"pass"}],bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"};function EA(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 CA(a){if(!a)return{};const l=`${a}:${a}`;return{Authorization:`Basic ${EA(l)}`}}class p0{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(wA);this.pc=l;const i=new MediaStream;l.ontrack=r=>{r.streams[0]?.getTracks().forEach(f=>i.addTrack(f)),this.video.srcObject=i,r.track?.kind==="video"&&"playoutDelayHint"in r.receiver&&(r.receiver.playoutDelayHint=0)},this.audioOnly?l.addTransceiver("audio",{direction:"recvonly"}):(l.addTransceiver("video",{direction:"recvonly"}),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",...CA(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(m=>{"playoutDelayHint"in m&&(m.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 Wu({sensors:a={},variant:l="full",size:i,overlay:r=!1}){const f=i||(l==="mini"?190:260),d=f/2,m=f*.07,x=d,p=d+m,y=d*.8,b=y-4,S=y+4,N=y-14,M=y-6,j=y*.65,C=a?.bumpsAndWheelDrops||{},A=a?.wheelOvercurrents||{},q=a?.wheelLeftCurrentMa??0,w=a?.wheelRightCurrentMa??0,k=a?.sideBrushCurrentMa??0,Y=a?.mainBrushCurrentMa??0,L=6,U=C.bumpLeft?L:0,B=C.bumpRight?L:0,P=DA({count:6,totalSpan:140,gap:6,startAngle:-70}),G=["L","FL","CL","CR","FR","R"],ne=[a?.lightBumpLeftSignal,a?.lightBumpFrontLeftSignal,a?.lightBumpCenterLeftSignal,a?.lightBumpCenterRightSignal,a?.lightBumpFrontRightSignal,a?.lightBumpRightSignal],Q=P.map((le,z)=>({label:G[z],start:le.start,end:le.end,value:ne[z]})),W=[{label:"Cliff L",start:-60,end:-46,value:a?.cliffLeftSignal,active:a?.cliffLeft},{label:"Cliff FL",start:-32,end:-16,value:a?.cliffFrontLeftSignal,active:a?.cliffFrontLeft},{label:"Cliff FR",start:16,end:32,value:a?.cliffFrontRightSignal,active:a?.cliffFrontRight},{label:"Cliff R",start:46,end:60,value:a?.cliffRightSignal,active:a?.cliffRight}],se=ne.filter(le=>le!=null),ue=se.length?Math.max(...se,1200):1200;return o.jsxs("div",{className:`${r?"relative":"surface relative p-1"}`,style:r?{width:`${f}px`,height:`${f}px`}:{height:"100%",width:"100%",aspectRatio:"1 / 1"},children:[r?null:o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"absolute left-1 top-1 text-xs text-slate-400",children:"Top-down"}),o.jsxs("div",{className:"absolute right-1 top-1 text-[0.65rem] text-slate-500",children:["0–",ue]})]}),o.jsxs("svg",{width:"100%",height:"100%",viewBox:`0 0 ${f} ${f}`,preserveAspectRatio:"xMidYMid meet",className:"mx-auto block",children:[o.jsx("circle",{cx:x,cy:p,r:y,fill:"#0f172a",stroke:"#334155",strokeWidth:"2"}),o.jsx(g0,{cx:x-j,cy:p,current:q,drop:C.wheelDropLeft,overcurrent:A.leftWheel,label:"L"}),o.jsx(g0,{cx:x+j,cy:p,current:w,drop:C.wheelDropRight,overcurrent:A.rightWheel,label:"R"}),o.jsx(TA,{cx:x+y*.65,cy:p-y*.55,current:k,overcurrent:A.sideBrush}),o.jsx(RA,{cx:x,cy:p,current:Y,overcurrent:A.mainBrush,variant:l,dirtLeft:a?.dirtDetectLeft,dirtRight:a?.dirtDetect}),Q.map(le=>{const z=kA(le.value,ue),ee=S+4,ae=ee+28;return o.jsx(qA,{cx:x,cy:p,rBase:ae,rTip:ee,startDeg:le.start,endDeg:le.end,color:z,value:le.value,max:ue},le.label)}),W.map(le=>{const z=_A(le.value,le.active);return o.jsx(ku,{cx:x,cy:p,rInner:N,rOuter:M,startDeg:le.start,endDeg:le.end,color:z,opacity:1,pulse:!!le.active},le.label)}),o.jsx(ku,{cx:x,cy:p,rInner:b-U,rOuter:S-U,startDeg:-70,endDeg:-6,color:C.bumpLeft?"#ef4444":"#475569",opacity:1,pulse:!!C.bumpLeft}),o.jsx(ku,{cx:x,cy:p,rInner:b-B,rOuter:S-B,startDeg:6,endDeg:70,color:C.bumpRight?"#ef4444":"#475569",opacity:1,pulse:!!C.bumpRight})]})]})}function ku({cx:a,cy:l,rInner:i,rOuter:r,startDeg:f,endDeg:d,color:m,pulse:x=!1,opacity:p=1}){const y=(i+r)/2,b=r-i,S=MA(a,l,y,f,d);return o.jsxs(o.Fragment,{children:[o.jsx("path",{d:S,stroke:m,strokeWidth:b,strokeLinecap:"round",fill:"none",opacity:p}),x?o.jsx("path",{d:S,stroke:"#ef4444",strokeWidth:b,strokeLinecap:"round",fill:"none",className:"animate-pulse",opacity:1}):null]})}function qA({cx:a,cy:l,rBase:i,rTip:r,startDeg:f,endDeg:d,color:m,value:x,max:p}){const y=(f+d)/2,b=Hs(a,l,r,y),S=Vr(x!=null?x/(p||1):0),N=Math.pow(S,.35),M=i-(i-r)*N,j=Hs(a,l,M,f),C=Hs(a,l,M,d),A=`M ${b.x} ${b.y} L ${j.x} ${j.y} L ${C.x} ${C.y} Z`;return o.jsx("path",{d:A,fill:m,opacity:1,stroke:"none"})}function MA(a,l,i,r,f){let d=r,m=f;m<=d&&(m+=360);const x=Hs(a,l,i,d),p=Hs(a,l,i,m);return["M",x.x,x.y,"A",i,i,0,0,1,p.x,p.y].join(" ")}function Hs(a,l,i,r){const f=Vg(r);return{x:a+i*Math.cos(f),y:l+i*Math.sin(f)}}function Vg(a){return(a-90)*Math.PI/180}function wf(a,l){if(l)return"#ef4444";const i=Math.abs(a);return i>900?"#f59e0b":i>300?"#22c55e":"#64748b"}function Vr(a){return Math.max(0,Math.min(1,a))}function g0({cx:a,cy:l,current:i,drop:r,overcurrent:f,label:d}){const m=Math.abs(i),x=Vr(m/1200),p=wf(i,f),y=56,b=14,S=9,N=3,M=y*x,j=d==="L"?-1:1,C=j*(-S/2-N/2),A=j*(b/2+N/2),q=b+S+N+2,w=y+4;return o.jsxs("g",{transform:`translate(${a},${l})`,children:[o.jsx("rect",{x:-q/2,y:-w/2,width:q,height:w,rx:"4",fill:"none",stroke:"#64748b",strokeWidth:"1"}),o.jsx("rect",{x:C-b/2,y:-y/2,width:b,height:y,fill:"#0f172a",stroke:"#0f172a",strokeWidth:"1",rx:"2"}),o.jsx("rect",{x:C-b/2,y:y/2-M,width:b,height:M,fill:p,className:f?"animate-pulse":""}),o.jsx("rect",{x:A-S/2,y:-y/2,width:S,height:y,fill:r?"#ef4444":"#475569",className:r?"animate-pulse":"",rx:"2"}),o.jsx("text",{x:0,y:y/2+10,textAnchor:"middle",className:"fill-slate-200 text-[0.7rem]",children:d})]})}function TA({cx:a,cy:l,current:i,overcurrent:r}){const f=Math.abs(i),d=wf(i*3,r),m=42,x=f>0?.65:null;return o.jsxs("g",{style:{transformOrigin:`${a}px ${l}px`,animation:x?`spin ${x}s linear infinite`:"none"},children:[o.jsx("circle",{cx:a,cy:l,r:10,fill:"#64748b",stroke:"#64748b",strokeWidth:"1"}),[0,120,240].map(p=>{const y=Vg(p),b=a+m*Math.cos(y),S=l+m*Math.sin(y);return o.jsx("line",{x1:a,y1:l,x2:b,y2:S,stroke:d,strokeWidth:"4",strokeLinecap:"round"},p)}),r?o.jsx("circle",{cx:a,cy:l,r:m+8,stroke:"#ef4444",strokeWidth:"3",fill:"none",className:"animate-pulse"}):null]})}function RA({cx:a,cy:l,current:i,overcurrent:r,variant:f,dirtLeft:d,dirtRight:m}){const x=Math.abs(i),p=wf(i,r),y=1,b=96,S=12,N=`main-brush-pattern-a-${f}`,M=`main-brush-pattern-b-${f}`,j=x>0?.6:null,C=i>=0?1:-1;return o.jsxs("g",{children:[o.jsx("defs",{children:[N,M].map((A,q)=>o.jsxs("pattern",{id:A,patternUnits:"userSpaceOnUse",width:"6",height:"6",children:[o.jsx("rect",{width:"6",height:"6",fill:p,opacity:y}),o.jsx("path",{d:"M0 6 L6 0",stroke:"#0f172a",strokeWidth:"1"}),j?o.jsx("animateTransform",{attributeName:"patternTransform",type:"translate",from:"0 0",to:`0 ${C*(q===0?6:-6)}`,dur:`${j}s`,repeatCount:"indefinite"}):null]},A))}),o.jsx("rect",{x:a-b/2,y:l-14,width:b,height:S,rx:"3",fill:`url(#${N})`,stroke:"#64748b",strokeWidth:"1"}),o.jsx("rect",{x:a-b/2,y:l+4,width:b,height:S,rx:"3",fill:`url(#${M})`,stroke:"#64748b",strokeWidth:"1"}),o.jsx("circle",{cx:a-b/4,cy:l-8,r:3.5,fill:"#fbbf24"}),o.jsx("circle",{cx:a+b/4,cy:l+8,r:3.5,fill:"#fbbf24"}),r?o.jsx("rect",{x:a-b/2-4,y:l-16,width:b+8,height:S*2+16,rx:"6",stroke:"#ef4444",strokeWidth:"3",fill:"none",className:"animate-pulse"}):null]})}function kA(a,l){if(a==null||a<=0)return"hsl(200 60% 18%)";const r=Vr(a/(l||1));return`hsl(${(200+Math.pow(r,.45)*360)%360} 100% 60%)`}function _A(a,l){if(l)return"#ef4444";const i=Vr(a==null?0:a/4095),r=[47,55,69],f=[245,158,11],[d,m,x]=r.map((p,y)=>Math.round(p+(f[y]-p)*i));return`rgb(${d}, ${m}, ${x})`}function DA({count:a,totalSpan:l,gap:i,startAngle:r}){const d=(l-i*(a-1))/a,m=[];let x=r;for(let p=0;p<a;p+=1){const y=x+d;m.push({start:x,end:y}),x=y+i}return m}function Yg(){const{value:a,save:l}=dt("page",{hudMapDesktop:!1});return[!!a?.hudMapDesktop,f=>{l({hudMapDesktop:!!f})}]}function Yr({text:a="Join our Discord!",className:l=""}){const{session:i}=_e(),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(yg,{className:"mr-0"}),a]}):null}const x0=2e3,OA=3e3,BA=3e3;function zA(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 m=(a-r)/d,x=Math.min(1,Math.max(0,m)),p=Math.round(x*100),y=m<=0,b=f!=null&&a<=f;return{available:!0,percentDisplay:p,depleted:y,warnTriggered:b,barClass:y?"bg-red-500 animate-pulse":b?"bg-amber-400":"bg-emerald-500"}}function Ef({sessionInfo:a,audioSessionInfo:l,videoMode:i="whep",snapshotFeed:r=null,qualityNotice:f=null,label:d,forceMute:m=!1,telemetryFrame:x,batteryConfig:p,layoutFormat:y="desktop",hudVariant:b="default",driverLabel:S=null,hudForceMap:N=!1,hudMapPosition:M="top-center",hudLabelScale:j=1,fitParent:C=!1,overcurrentLimiter:A=null,showTurnCue:q=!1,turnTimerText:w=null,turnSeconds:k=null,isActiveDriver:Y=!1,idleSkipSeconds:L=null}){const U=h.useRef(null),B=h.useRef(null),P=h.useRef(null),G=h.useRef(null),ne=h.useRef(null),Q=h.useRef(null),[W,se]=h.useState("idle"),[ue,le]=h.useState(null),[z,ee]=h.useState("idle"),[ae,ce]=h.useState(null),[he,E]=h.useState(0),[O,K]=h.useState(0),[_,F]=h.useState(!0),te=i==="snapshot",ie=x?.sensors,Ne=ie?.batteryChargeMah??null,me=y==="desktop",St=!me,[_a]=Yg(),Dl=N||St?!0:_a,sa=zA(Ne,p),Mt=ie?.wheelOvercurrents||null,ia=Mt==null?[]:Object.entries(Mt).filter(([,we])=>!!we).map(([we])=>we),Tt=A?.caps||null,Js=A?.overcurrent?.groups||null,Da=typeof window<"u"&&new URLSearchParams(window.location.search).has("debugHud"),Ol=h.useMemo(()=>{if(!Tt)return null;const we=Number.isFinite(Tt?.drive?.cap)?Tt.drive.cap:1,Qe=Number.isFinite(Tt?.aux?.cap)?Tt.aux.cap:1;return Math.max(0,Math.min(1,1-Math.min(we,Qe)))},[Tt]),ra=!!A?.isActive,sn=ia.length?ia:ra?["limiter"]:[],Oa=Ol??(ia.length?1:0),Bl=!!sn.length;h.useEffect(()=>{Da&&console.log("[OvercurrentHUD]",{overlayVisible:Bl,overlayMotors:sn,overlayFill:Oa,limiterActive:ra,limiterCaps:Tt,limiterGroups:Js,wheelOvercurrents:Mt})},[Da,Oa,sn,Bl,ra,Tt,Js,Mt]);const tt=h.useCallback(()=>{clearTimeout(P.current),P.current=setTimeout(()=>E(Date.now()),x0)},[]),zl=h.useCallback(()=>{clearTimeout(G.current),G.current=setTimeout(()=>K(Date.now()),x0)},[]),oa=h.useCallback(async()=>{const we=U.current;if(we)try{we.muted=!0,await we.play()}catch{}},[]),Ll=h.useCallback((we=0)=>{if(m)return;clearTimeout(Q.current);const Qe=()=>{clearTimeout(Q.current),Q.current=setTimeout(()=>{m||Le()},OA)},Le=async()=>{const Ee=U.current;if(Ee)try{await oa(),Ee.muted=!1,await Ee.play(),F(!1)}catch{Ee.muted=!0,F(!0),Qe()}};Q.current=setTimeout(Le,we)},[oa,m]);h.useEffect(()=>()=>{clearTimeout(P.current),clearTimeout(G.current),clearTimeout(Q.current),clearInterval(ne.current)},[]),h.useEffect(()=>{W==="playing"&&Ll(0)},[W,Ll]),h.useEffect(()=>{te&&(se("snapshot"),le(null))},[te]),h.useEffect(()=>{if(te||!a?.url||!U.current)return;let we=!0,Qe;const Le=setTimeout(()=>F(!0),0),Ee=(Ce,Ue)=>{we&&(se(Ce),le(Ue||null),Ce==="playing"&&oa(),["error","failed","disconnected","closed"].includes(Ce)&&tt())};return Qe=new p0({url:a.url,token:a.token,video:U.current,onStatus:Ee}),Qe.start().catch(Ce=>{we&&(se("error"),le(Ce.message),tt())}),()=>{we=!1,clearTimeout(Le),Qe?.stop()}},[te,a?.url,a?.token,he,tt,oa]),h.useEffect(()=>{W==="stopped"&&a?.url&&tt()},[W,a?.url,tt]),h.useEffect(()=>{if(!l?.url||!B.current)return;let we=!0,Qe;const Le=(Ee,Ce)=>{we&&(ce(Ce||(Ee==="connected"?"connected":null)),ee(Ue=>Ee==="connected"&&(Ue==="playing"||Ue==="connecting")||Ee==="new"?Ue:Ee),Ee==="playing"&&B.current?.play().catch(()=>{}),["error","failed","disconnected","closed"].includes(Ee)&&zl())};return Qe=new p0({url:l.url,token:l.token,video:B.current,audioOnly:!0,onStatus:Le}),Qe.start().catch(Ee=>{we&&(ee("error"),ce(Ee.message),zl())}),()=>{we=!1,Qe?.stop()}},[l?.url,l?.token,O,zl]),h.useEffect(()=>{const we=B.current;if(!l?.url||!we){clearInterval(ne.current);return}if(!["connecting","connected","playing","paused"].includes(z)){clearInterval(ne.current);return}const Le=()=>{const Ee=B.current;Ee&&(!Ee.paused&&!Ee.ended||Ee.play().then(()=>{ee(Ce=>Ce==="connected"?"playing":Ce),ce(Ce=>Ce==="paused"?null:Ce)}).catch(Ce=>{ce(Ue=>Ue||Ce?.message||"autoplay blocked")}))};return Le(),ne.current=setInterval(Le,BA),()=>clearInterval(ne.current)},[l?.url,z]),h.useEffect(()=>{const we=B.current;if(!we)return;const Qe=()=>{ee(Ue=>Ue==="error"?Ue:"playing"),ce(null)},Le=()=>{ee(Ue=>["error","failed","disconnected","closed","stopped"].includes(Ue)?Ue:"paused"),ce(Ue=>Ue||"paused")},Ee=()=>{ee(Ue=>Ue==="error"?Ue:"stopped"),ce(Ue=>Ue||"ended")},Ce=()=>{const{error:Ue}=we,Zr=Ue?.message||"audio error";ee("error"),ce(Zr)};return we.addEventListener("play",Qe),we.addEventListener("pause",Le),we.addEventListener("ended",Ee),we.addEventListener("error",Ce),()=>{we.removeEventListener("play",Qe),we.removeEventListener("pause",Le),we.removeEventListener("ended",Ee),we.removeEventListener("error",Ce)}},[l?.url]);const Ba=r?.error?`Error: ${r.error}`:r?.objectUrl?"snapshot":r?.status||"waiting",Kr=te?Ba:a?.url?W==="error"?`Error: ${ue||"unknown"}`:ue?`${W} (${ue})`:W:"waiting",Is=l?.error?`Error: ${l.error}`:l?.url?z==="error"?`Error: ${ae||"unknown"}`:ae?`${z} (${ae})`:z:null,Ws=b==="spectator";return o.jsxs("div",{className:`flex flex-col gap-0.5 ${C?"h-full":""}`,children:[o.jsxs("div",{className:`relative w-full overflow-hidden bg-black ${C?"h-full flex-1":"aspect-[4/3]"}`,children:[te?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:U,muted:m||_,playsInline:!0,autoPlay:!0,controls:!1,className:"h-full w-full object-contain"}),o.jsx("audio",{ref:B,autoPlay:!0,hidden:!0}),q?o.jsx(YA,{mobileHud:St,turnSeconds:k,isActiveDriver:Y,idleSkipSeconds:L}):null,o.jsx(VA,{frame:x,sensors:ie,label:d,status:Kr,audioStatus:Is,desktopLayout:me,layoutFormat:y,variant:b,driverLabel:S,battery:sa,showTopDown:Dl,mobileHud:St,mapPosition:M,turnTimerText:w,labelScale:j}),o.jsx(QA,{compact:St}),Da?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:${Bl?1:0} motors:${sn.length} fill:${Math.round(Oa*100)}%`}):null,o.jsx(GA,{motors:sn,fill:Oa,compact:St}),o.jsx(XA,{charge:Ne,config:p,compact:St}),Ws&&sa.available?o.jsx(UA,{visual:sa}):null,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 ${St?"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(Yr,{text:"Join our Discord server while you wait!"})})]})}):null]}),!Ws&&o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(HA,{sensors:ie}),o.jsx(LA,{visual:sa})]})]})}function LA({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 UA({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 HA({sensors:a}){const l=[a?.lightBumpLeftSignal,a?.lightBumpFrontLeftSignal,a?.lightBumpCenterLeftSignal,a?.lightBumpCenterRightSignal,a?.lightBumpFrontRightSignal,a?.lightBumpRightSignal],i=l.filter(x=>x!=null).reduce((x,p)=>Math.max(x,p),1200),r=x=>Math.pow(Math.max(0,Math.min(1,(x??0)/i)),.35),f=x=>x==null||x<=0?"hsl(200 60% 18%)":`hsl(${(200+r(x)*360)%360} 100% 60%)`,d=6,m=12;return o.jsx("div",{className:"flex w-full items-center justify-center gap-0.5",children:l.map((x,p)=>{const y=r(x),b=p<d/2?-1:1,S=`${y*100}%`,N=f(x);return o.jsx("div",{className:"relative flex-1 min-w-[0]",style:{height:`${m}px`},children:o.jsx("div",{className:"h-full w-full overflow-hidden bg-slate-800",style:{borderRadius:0},children:o.jsx("div",{className:"h-full",style:{width:S,background:N,float:b===-1?"right":"left"}})})},p)})})}function VA({frame:a,sensors:l,label:i,status:r,audioStatus:f,desktopLayout:d=!0,layoutFormat:m="desktop",variant:x="default",driverLabel:p=null,battery:y,showTopDown:b=!1,mobileHud:S=!1,mapPosition:N="top-center",turnTimerText:M=null,labelScale:j=1}){l?.bumpsAndWheelDrops;const[C,A]=h.useState(()=>Date.now());h.useEffect(()=>{const ee=setInterval(()=>A(Date.now()),150);return()=>clearInterval(ee)},[]),a?.receivedAt&&C-a.receivedAt<200;const q=S,w=m==="mobile-portrait",k=q?"text-[0.45rem]":"text-[0.65rem]",Y=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",U=q?"text-[0.55rem]":"text-[0.8rem]",B=q?"left-0.5 top-0.5":"left-1 top-1",P=q?"text-[0.5rem]":"text-[0.7rem]",G=q?"px-0.5 py-0.25":"px-1 py-0.5",ne=q?"left-0.5 top-1/2":"left-1 top-1/2",Q="bottom-0.5",W={transform:`translateX(-50%) scale(${j})`,transformOrigin:"center bottom"},se="240px",ue=w?.36:q?.45:.7,z={width:se,height:se,opacity:q?.85:.7,transform:N==="top-center"?`translateX(-50%) scale(${ue})`:`scale(${ue})`,transformOrigin:N==="bottom-left"?"bottom left":N==="top-center"?"top center":"top right",...N==="bottom-left"?{left:"0.25rem",bottom:"0.25rem"}:N==="top-center"?{left:"50%",top:"0.25rem"}:{right:"0.25rem",top:"0.25rem"}};if(x==="spectator"){const ee=[["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||"--"]],ae=!!l?.chargingSources?.homeBase,ce=l?.chargingState?.label||"",he=!!(ce&&ce.toLowerCase()!=="not charging"),E=l?.oiMode?.label||"Unknown",O=E.toLowerCase(),K=O==="full"?"bg-emerald-500/80 text-emerald-50":O==="safe"?"bg-amber-400/80 text-amber-950":O==="passive"?"bg-slate-700/80 text-slate-100":"bg-slate-700/60 text-slate-200",_=ae?"bg-emerald-500/80 text-emerald-50":"bg-slate-700/70 text-slate-200",F=he?"bg-emerald-500/80 text-emerald-50":ae?"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 ${B} 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 ${ne} flex -translate-y-1/2 flex-col gap-0.5 bg-black/70 text-slate-100 ${k} ${Y}`,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 ${_}`,children:ae?"Docked":"Undocked"}),o.jsx("span",{className:`rounded px-1.5 py-0.5 ${F}`,children:he?"Charging":"Not charging"}),o.jsxs("span",{className:`rounded px-1.5 py-0.5 ${K}`,children:["OI: ",E]})]}),ee.map(([te,ie])=>o.jsxs("span",{className:"flex items-center justify-between gap-0.5",children:[o.jsx("span",{className:"text-slate-400",children:te}),o.jsx("span",{className:"font-semibold text-white",children:ie})]},te))]})}),o.jsx("div",{className:`absolute ${Q} left-1/2`,style:W,children:o.jsxs("div",{className:`flex items-center gap-0.5 bg-black/80 text-slate-100 ${L} ${U}`,children:[o.jsx("span",{className:"font-semibold text-white",children:i||"Unnamed Rover"}),p?o.jsxs("span",{className:"text-slate-300",children:["• ",p]}):null]})})]}),b?o.jsx("div",{className:"pointer-events-none absolute rounded",style:{...z},children:o.jsx(Wu,{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 ${B} 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 ${G} ${P}`,children:M}):null,o.jsx("div",{className:`absolute ${Q} left-1/2`,style:W,children:o.jsx("div",{className:`flex gap-0.5 bg-black/80 text-slate-100 ${L} ${U}`,children:o.jsxs("span",{children:['Rover: "',i||"Unnamed Rover",'"']})})}),b&&x!=="spectator"?o.jsx("div",{className:"pointer-events-none absolute rounded",style:{...z},children:o.jsx(Wu,{sensors:l,size:240,overlay:!0})}):null]})}function YA({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",m=a?"text-[0.55rem]":"text-[0.75rem]",x=a?"px-4 py-3":"px-6 py-4",p=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 ${x}`,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!"}),p?o.jsxs("div",{className:`text-red-100/90 ${m}`,children:["Idle skip in ",r,"s"]}):null]})})}const $A={leftWheel:"Left wheel",rightWheel:"Right wheel",mainBrush:"Main brush",sideBrush:"Side brush",limiter:"Overcurrent limit"};function GA({motors:a,fill:l=0,compact:i=!1}){if(!a?.length)return null;const r=a.map(b=>$A[b]||b),f=i?"w-[12rem] h-[3.5rem]":"w-[20rem] h-[7rem]",d=i?"px-2 py-1":"px-4 py-2",m=i?"text-lg":"text-4xl",x=i?"text-xs":"text-xl",p=Math.max(0,Math.min(1,l)),y=`${Math.round(p*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:y}})}),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 ${m} ${d}`,children:[o.jsx("div",{children:"OVERCURRENT"}),o.jsx("div",{className:`mt-0 font-medium text-white ${x}`,children:r.join(", ")})]})]})})}function XA({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,m=r-f;if(m<=0)return null;const p=(a-f)/m<=0;if(!(d!=null&&a<=d)&&!p)return null;const b=p?"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",N=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 ${N}`,children:o.jsx("div",{children:b})})})}function QA({compact:a=!1}){const{session:l}=_e(),{sendMessage:i,onInputFocus:r,onInputBlur:f,blurChat:d,registerInputRef:m,setTypingActive:x}=yf(),{value:p}=dt("tts",{engine:"flite",voice:"rms",pitch:50}),[y,b]=h.useState(""),[S,N]=h.useState(!1),M=l?.role!=="spectator",j=l?.role==="spectator",C=l?.assignment?.roverId||null,q=!!h.useMemo(()=>l?.roster?.find(B=>String(B.id)===String(C))||null,[C,l?.roster])?.audio?.ttsEnabled,w=h.useMemo(()=>{if(!q)return null;const B=p?.engine==="espeak"?"espeak":"flite";if(B==="espeak"){let G=Number.isFinite(p?.pitch)?Math.round(p.pitch):void 0;return typeof G=="number"&&(G=Math.max(0,Math.min(99,G))),{speak:!0,engine:B,pitch:G}}const P=typeof p?.voice=="string"?p.voice:void 0;return{speak:!0,engine:B,voice:P}},[p?.engine,p?.pitch,p?.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",Y=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 U(B){if(B.preventDefault(),!M)return;const P=y.trim();if(P){N(!0);try{await i(P,w),b(""),d(),x(!1)}catch(G){alert(G.message)}finally{N(!1)}}}return j?null:o.jsxs("form",{onSubmit:U,className:k,children:[o.jsx("input",{className:Y,value:y,onChange:B=>{const P=B.target.value;b(P),x(!!P.trim())},onFocus:B=>{r(B),x(!!y.trim())},onBlur:B=>{f(B),x(!1)},onKeyDown:B=>{B.key==="Enter"&&!y.trim()&&(B.preventDefault(),d(),x(!1))},ref:B=>m(B,{target:"hud"}),placeholder:M?"Chat (TTS)":"Spectator",disabled:!M}),o.jsx("button",{type:"submit",disabled:!M||S,className:L,children:"Speak"})]})}function Cf({layoutFormat:a="desktop"}){const{session:l}=_e(),{state:{song:i,lastControlIntentAt:r},overcurrentLimiter:f}=ht(),[d,m]=h.useState(()=>Date.now()),[x,p]=h.useState(!1),[y,b]=h.useState(null),S=h.useRef({active:!1,roverId:null});h.useEffect(()=>{if(l?.mode!=="turns")return;const _=setInterval(()=>m(Date.now()),250);return()=>clearInterval(_)},[l?.mode]);const N=l?.assignment?.roverId,j=!!(N&&l?.roster?l.roster.find(_=>String(_.id)===String(N)):null)?.media?.audioPublishUrl,C=N?l?.turnQueues?.[N]:null,A=l?.socketId||null,q=N?l?.activeDrivers?.[N]:null,w=!!(A&&q===A),k=h.useMemo(()=>{const _=C?.queue||[];if(!_.length||!C?.current||_.length<=1)return null;const F=_.findIndex(te=>te===C.current);return F===-1?_[0]||null:_[(F+1)%_.length]||null},[C?.queue,C?.current]),Y=!!(A&&k===A),L=C?.deadline||null,U=C?.idleDeadline||null,B=L?L-d:null,P=U?U-d:null,G=l?.mode==="turns"&&Y&&B!=null&&B<=5e3&&B>0,ne=l?.mode!=="turns"||w||G,Q=B!=null&&Number.isFinite(B)?Math.max(0,Math.ceil(B/1e3)):null,W=P!=null&&Number.isFinite(P)?Math.max(0,Math.ceil(P/1e3)):null,se=w?Q!=null?`${Q}s left`:null:Y&&Q!=null?`Your turn in ${Q}s`:null,ue=N?[...ne?[{type:"rover",id:N,key:N}]:[],...j?[{type:"rover",id:`${N}-audio`,key:`${N}-audio`}]:[]]:[],le=jf(ue),z=N&&ne?le[N]:null,ee=N&&j?le[`${N}-audio`]:null,ae=Nf(N?[N]:[],{enabled:!!N,version:l?.mode}),ce=N&&ae[N]||null,he=_l(N),E=N&&l?.roster?l.roster.find(_=>String(_.id)===String(N)):null,O=E?.battery??null,K=E?.name||(N?`Rover ${N}`:"");return h.useEffect(()=>{if(l?.mode!=="turns"){p(!1),b(null),S.current={active:!1,roverId:null};return}const _=S.current,F=w&&!_.active,te=w&&N&&N!==_.roverId;F||te?(p(!0),b(Date.now())):!w&&_.active&&(p(!1),b(null)),S.current={active:w,roverId:N}},[w,N,l?.mode]),h.useEffect(()=>{!x||!y||r>y&&p(!1)},[r,y,x]),o.jsx("section",{className:"panel",children:N?o.jsx(Ef,{sessionInfo:z,videoMode:ne?"whep":"snapshot",snapshotFeed:ce,audioSessionInfo:ee,label:K,telemetryFrame:he,batteryConfig:O,layoutFormat:a,overcurrentLimiter:f,songNote:i?.note,qualityNotice:ne?null:"Preview feed (low FPS) until your turn.",showTurnCue:x,turnTimerText:se,turnSeconds:Q,isActiveDriver:w,idleSkipSeconds:W}):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 y0(...a){return a.filter(Boolean).join(" ")}function KA(a){const l=a?.batteryState?.percentDisplay;return l==null?"--":`${l}%`}function ZA(a){return a?.batteryState?a.batteryState.urgentActive?"text-red-400":a.batteryState.warnActive?"text-amber-300":"text-emerald-300":"text-slate-400"}function FA({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:y0("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:y0("font-semibold",ZA(f)),children:["Battery ",KA(f)]})]})]}),r?r(f):null]},f.id))})]})}function JA({keymap:a}){const{state:{roverId:l,camera:i},pipeline:r,actions:{setServoAngle:f,setNightVision:d}}=ht(),m=i?.config,x=!!(l&&i?.enabled&&m),p=!!(l&&r?.nightVision),y=r?.nightVisionState,b=typeof m?.minAngle=="number"?m.minAngle:-30,S=typeof m?.maxAngle=="number"?m.maxAngle:30,N=typeof i?.angle=="number"?i.angle:typeof m?.homeAngle=="number"?m.homeAngle:(b+S)/2,[M,j]=h.useState(N),C=h.useRef(!1);h.useEffect(()=>{C.current||j(N)},[N]);const A=L=>{const U=Number.parseFloat(L.target.value);Number.isNaN(U)||(C.current=!0,j(U),f(U))},q=()=>{C.current=!1};if(!x&&!p)return null;const w=Tn(a?.cameraUp?.[0]),k=Tn(a?.cameraDown?.[0]),Y=Tn(a?.nightVisionToggle?.[0]);return o.jsxs("div",{className:"surface space-y-0.5 px-1 py-1 text-sm text-slate-200",children:[x&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-300",children:[o.jsx("span",{children:"Camera tilt"}),o.jsx("span",{className:"font-mono text-slate-100",children:_u(N)})]}),o.jsxs("div",{children:[o.jsx("input",{type:"range",className:"w-full accent-emerald-400",min:b,max:S,step:.5,value:M,onChange:A,onMouseUp:q,onTouchEnd:q,onPointerUp:q}),o.jsxs("div",{className:"mt-0 flex items-center justify-between text-[0.7rem] text-slate-400",children:[o.jsxs("span",{className:"flex items-center gap-0.5",children:[k?o.jsx(v0,{label:k}):null,_u(b)]}),o.jsxs("span",{className:"flex items-center gap-0.5",children:[_u(S),w?o.jsx(v0,{label:w}):null]})]})]})]}),p&&o.jsx(zg,{nightVisionOn:y?.nightVisionOn,disabled:!l,onToggle:d,keyLabel:Y,className:x?"mt-1":""})]})}function v0({label:a}){return o.jsx("span",{className:"rounded border border-white/40 px-1 text-[0.7rem] text-white",children:a})}function _u(a){return typeof a!="number"||Number.isNaN(a)?"—":`${a>0?"+":""}${a.toFixed(1)}°`}function Pu({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 $r(a){if(!Number.isFinite(a))return 0;const l=a%360;return l<0?l+360:l}function IA(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,m=Math.max(0,Math.min(255,Number(r)))/255,x=Math.max(f,d,m),p=Math.min(f,d,m),y=x-p;if(y===0)return 0;let b=0;return x===f?b=(d-m)/y%6:x===d?b=(m-f)/y+2:b=(f-d)/y+4,$r(Math.round(b*60))}function b0(a){const l=$r(a),i=1,r=1-Math.abs(l/60%2-1);let f=0,d=0,m=0;return l<60?(f=i,d=r):l<120?(f=r,d=i):l<180?(d=i,m=r):l<240?(d=r,m=i):l<300?(f=r,m=i):(f=i,m=r),[Math.round(f*255),Math.round(d*255),Math.round(m*255)]}function S0(a){return a?Array.isArray(a.hsColor)?$r(Number(a.hsColor[0])):Array.isArray(a.rgbColor)?IA(a.rgbColor):0:0}function WA({entity:a,connected:l,onToggle:i,onSetColor:r}){const f=a.state==="unavailable"||!a.available,d=a.state==="on",m=a.type==="light"&&a.supportsColor,x=f?"warn":d?"success":"muted",p=f?"Unavailable":d?"On":"Off",y=!l||f,b=y||!m,[S,N]=h.useState(()=>S0(a)),M=h.useRef(S),j=h.useRef(!1),C=f?"border-slate-800 bg-slate-900 text-slate-400 cursor-not-allowed":d?"border-emerald-700 bg-emerald-900/80 text-emerald-50 hover:bg-emerald-800":"border-rose-800 bg-rose-900/80 text-rose-50 hover:bg-rose-800";h.useEffect(()=>{if(!m||j.current)return;const L=S0(a);M.current=L,N(L)},[a.rgbColor,a.hsColor,m]);const A=L=>{const U=$r(Number(L.target.value));M.current=U,N(U)},q=()=>{b||!r||r(a.id,b0(M.current))},w=L=>{L.stopPropagation()},Y=`rgb(${(m?b0(M.current):[255,255,255]).join(",")})`;return o.jsxs("button",{type:"button",onClick:()=>i(a.id),disabled:y,className:`relative flex min-w-[12rem] flex-[1_1_12rem] items-start justify-between gap-0.5 rounded px-1 py-0.5 text-left transition-colors ${C} disabled:opacity-60 disabled:hover:bg-inherit`,children:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex items-center gap-0.5 text-sm leading-normal",children:[o.jsx("span",{className:"truncate font-semibold text-white",children:a.name||a.id}),m&&o.jsxs(o.Fragment,{children:[o.jsx(Pu,{label:p,tone:x}),!l&&o.jsx("span",{className:"text-xs text-amber-200",children:"Offline"})]})]}),m?o.jsx("div",{className:"-mt-0.5 w-full",onClick:w,onPointerDown:L=>{w(L),j.current=!0},onPointerUp:L=>{w(L),j.current=!1,q()},onPointerCancel:L=>{w(L),j.current=!1,q()},onKeyUp:L=>{w(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:A,disabled:b,"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(Pu,{label:p,tone:x}),!l&&o.jsx("span",{className:"text-amber-200",children:" · Offline"})]})]}),m&&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:Y}}),!m&&o.jsx("div",{className:"self-center text-xs font-semibold text-white/90",children:d?"Turn off":"Turn on"})]})}function $g(){const{state:{keymap:a}}=ht(),{session:l,homeAssistantToggle:i,homeAssistantSetLightColor:r}=_e(),f=l?.homeAssistant,d=h.useMemo(()=>f?.entities||[],[f?.entities]),m=Tn(a?.homeAssistantOn?.[0]),x=Tn(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 p=!!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"}),m?o.jsx(A0,{label:m}):null]}),o.jsxs("span",{className:"flex items-center gap-0.5",children:[o.jsx("span",{children:"Off"}),x?o.jsx(A0,{label:x}):null]})]})]}),o.jsx(Pu,{label:p?"Connected":"Offline",tone:p?"success":"warn"})]}),o.jsx("div",{className:"flex flex-wrap gap-0.5",children:d.map(y=>o.jsx(WA,{entity:y,connected:p,onToggle:i,onSetColor:r},y.id))})]})}function A0({label:a}){return a?o.jsx("span",{className:"rounded border border-white/40 px-1 text-[0.7rem] text-white",children:a}):null}function Gg(){const{login:a,setRole:l}=_e(),[i,r]=h.useState(""),[f,d]=h.useState(""),[m,x]=h.useState(!1);async function p(y){y.preventDefault(),x(!0);try{await a(i,f),r(""),d("")}catch(b){alert(b.message)}finally{x(!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:p,children:[o.jsx("input",{className:"field-input",placeholder:"Username",value:i,onChange:y=>r(y.target.value)}),o.jsx("input",{className:"field-input",placeholder:"Password",type:"password",value:f,onChange:y=>d(y.target.value)}),o.jsx("button",{type:"submit",disabled:m,className:"button-dark w-full disabled:opacity-50",children:m?"Logging in…":"Login"})]})]})}const PA=[{key:"open",label:"Open"},{key:"turns",label:"Turns"},{key:"admin",label:"Admin"},{key:"lockdown",label:"Lockdown"}];function ej(){const{session:a,lockRover:l,setMode:i,requestControl:r,setCommunityGoal:f,adminLogs:d}=_e(),m=h.useMemo(()=>a?.roster??[],[a?.roster]),[x,p]=h.useState({}),y=a?.health||null,b=a?.communityGoal?.text||"",S=a?.communityGoal?.updatedAt||null,[N,M]=h.useState(b),j=a?.role==="admin"||a?.role==="lockdown"||a?.role==="lockdown-admin",C=a?.mode??"open",A=async(U,B)=>{try{await l(U,B),p(P=>({...P,[U]:B}))}catch(P){alert(P.message)}},q=async U=>{const B=U.target.value;try{await i(B)}catch(P){alert(P.message)}},w=async U=>{try{await r(U,{force:!0})}catch(B){alert(B.message)}},k=async()=>{try{await f(N)}catch(U){alert(U.message)}},Y=async()=>{try{await f(null)}catch(U){alert(U.message)}};h.useEffect(()=>{M(b)},[b]);const L=h.useMemo(()=>{const U={};return m.forEach(B=>{U[B.id]=x[B.id]??B.locked}),U},[m,x]);return j?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:C,onChange:q,className:"field-input text-sm",children:PA.map(U=>o.jsx("option",{value:U.key,children:U.label},U.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"}),S?o.jsxs("span",{children:["Updated ",new Date(S).toLocaleString()]}):null]}),o.jsx("input",{type:"text",value:N,onChange:U=>M(U.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:k,className:"button-dark",children:"Set goal"}),o.jsx("button",{type:"button",onClick:Y,className:"button-danger",children:"Clear"})]})]}),o.jsx(FA,{roster:m,renderActions:U=>o.jsxs("div",{className:"flex flex-wrap gap-0.5 text-xs",children:[o.jsx("button",{type:"button",onClick:()=>A(U.id,!L[U.id]),className:"button-dark",children:L[U.id]?"Unlock":"Lock"}),o.jsx("button",{type:"button",onClick:()=>w(U.id),className:"button-dark",children:"Force"})]})}),o.jsx(tj,{health:y}),o.jsx(nj,{entries:d})]}):null}function tj({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(m=>m.stale).length,d=i.rooms.filter(m=>m.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(m=>o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{children:m.label}),o.jsxs("span",{className:m.ready?"text-emerald-300":"text-amber-300",children:[m.recentCount,"/",m.neededCount]})]},`${m.type}:${m.id}`))}),o.jsx("div",{className:"space-y-0.5 text-xs text-slate-300",children:i.rovers.map(m=>o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{children:m.name}),o.jsx("span",{className:m.stale?"text-amber-300":"text-emerald-300",children:m.stale?"stale":"ok"})]},`rover:${m.id}`))}),o.jsx("div",{className:"space-y-0.5 text-xs text-slate-300",children:i.rooms.map(m=>o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{children:m.name}),o.jsx("span",{className:m.stale?"text-amber-300":"text-emerald-300",children:m.error?"error":m.stale?"stale":"ok"})]},`room:${m.id}`))})]})}function nj({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 aj=[{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:"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 lj(a){return a.reduce((l,i)=>((l[i.group]||(l[i.group]=[])).push(i),l),{})}function sj(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(0,Math.min(500,i)):l}const qf=5,Gs=500,Xs=1,Mf=100;function ij(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(qf,Math.min(Gs,i)):l}function Mr(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(Xs,Math.min(Mf,i)):l}function rj(a){const i=(Mr(a,a)-Xs)/(Mf-Xs),r=Gs-i*(Gs-qf);return Math.round(r)}function oj(a){const l=ij(a,a),i=(Gs-l)/(Gs-qf),r=Xs+i*(Mf-Xs);return Math.round(r)}function cj(a){const[l,i]=h.useState(null);return h.useEffect(()=>{if(!l)return;function r(f){if(f.preventDefault(),f.key==="Escape"){i(null);return}const d=Fs(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 vr({label:a,description:l,value:i,onChange:r,min:f=0,max:d=500,step:m=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:x=>r(x.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:m,value:i,onChange:x=>r(x.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 uj(){const{state:{keymap:a},actions:{updateKeyBinding:l,resetKeyBindings:i}}=ht(),{value:r,save:f}=dt("inputs",en),d={...en.keyboard,...r.keyboard??{}},m=h.useMemo(()=>typeof d.tiltSpeed=="number"?Mr(d.tiltSpeed,en.keyboard.tiltSpeed):typeof d.tiltIntervalMs=="number"?Mr(oj(d.tiltIntervalMs),en.keyboard.tiltSpeed):en.keyboard.tiltSpeed,[d.tiltIntervalMs,d.tiltSpeed]),x=h.useMemo(()=>lj(aj),[]),{active:p,startCapture:y,cancel:b}=cj((j,C)=>{l(j,C)}),S=h.useCallback(j=>a?.[j]?.[0]||Us[j]?.[0]||"",[a]),N=h.useCallback((j,C)=>{const A=en.keyboard,q=sj(C,A[j]);f(w=>({...w??{},keyboard:{...w?.keyboard??A,[j]:q}}))},[f]),M=h.useCallback(j=>{const C=en.keyboard,A=Mr(j,C.tiltSpeed),q=rj(A);f(w=>({...w??{},keyboard:{...w?.keyboard??C,tiltSpeed:A,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(vr,{label:"Base speed",description:"Normal driving speed",value:d.baseSpeed,onChange:j=>N("baseSpeed",j)}),o.jsx(vr,{label:"Turbo speed",description:"Used when holding the boost modifier",value:d.turboSpeed,onChange:j=>N("turboSpeed",j)}),o.jsx(vr,{label:"Precision speed",description:"Used when holding the precision modifier",value:d.precisionSpeed,onChange:j=>N("precisionSpeed",j)})]})]}),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(vr,{label:"Tilt speed",description:"Higher = faster when holding tilt keys",value:m,onChange:M,min:1,max:100,step:1})]}),o.jsx("div",{className:"space-y-0.5",children:Object.entries(x).map(([j,C])=>o.jsxs("div",{className:"space-y-0.5 surface",children:[o.jsx("p",{className:"text-[0.75rem] text-slate-400",children:j}),o.jsx("div",{className:"space-y-0.5",children:C.map(A=>{const q=S(A.id),w=p===A.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:A.label}),o.jsx("p",{className:"text-[0.65rem] text-slate-400",children:Tn(q)})]}),o.jsxs("div",{className:"flex items-center gap-0.5",children:[w&&o.jsx("button",{type:"button",onClick:()=>b(),className:"button-danger text-[0.7rem]",children:"Cancel"}),o.jsx("button",{type:"button",onClick:()=>y(A.id),className:`${w?"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:w?"Press a key…":"Change"})]})]},A.id)})})]},j))})]})}const Cn=new Intl.NumberFormat(void 0,{maximumFractionDigits:2}),fj=[{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"}],j0=.45,dj=.6;function zs({label:a,description:l,min:i,max:r,step:f,value:d,onChange:m}){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:Cn.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:x=>m(Number(x.target.value)),className:"mt-0 w-full accent-emerald-400"})]})}function hj(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} ${Cn.format(a.threshold??.6)}`}return"Unassigned"}function mj(a){return a.reduce((l,i)=>((l[i.section]||(l[i.section]=[])).push(i),l),{})}function pj(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 gj(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 xj(a,l,i){const r=(a.axes??[]).map((d,m)=>({index:m,delta:Math.abs((d??0)-(l.axes?.[m]??0)),value:d}));if(r.sort((d,m)=>m.delta-d.delta),i.kind==="axisPair"){const d=r.filter(m=>m.delta>j0).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>j0);return f?{kind:"axis",index:f.index,...i.invertDefaults??{}}:null}function yj(a,l,i){const r=a.buttons??[];for(let d=0;d<r.length;d+=1){const m=r[d],x=typeof m?.value=="number"?m.value:m?.pressed?1:0;if(m?.pressed||x>dj)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 m=f[d]??0,x=Math.abs(m-(l.axes?.[d]??0));if(Math.abs(m)>.7&&x>.5)return i.kind==="axis"?{kind:"axis",index:d,...i.invertDefaults??{}}:{kind:"axisButton",index:d,direction:m>=0?1:-1,threshold:.6}}return null}function vj(a,l,i){if(!a)return null;if(i.kind==="axis"||i.kind==="axisPair"){const r=xj(a,l,i);if(r)return r}return yj(a,l,i)}function bj(){const a=cA(),{value:l,save:i}=dt("gamepad",aa),[r,f]=h.useState(null),d=h.useRef(null),m=h.useMemo(()=>mj(fj),[]),x=h.useMemo(()=>pj(a.pads,l.activeSignature),[a.pads,l.activeSignature]),p=x?.signature??null,y=h.useMemo(()=>p?l?.profiles?.[p]??l?.defaults?.profile??qn:l?.defaults?.profile??qn,[p,l?.defaults?.profile,l?.profiles]);h.useEffect(()=>{!x||!p||l?.profiles?.[p]||i(A=>{const q=A??aa;if(q.profiles?.[p])return q;const w=q?.defaults?.profile??qn,k=Tg(x,w);return{...q,profiles:{...q.profiles??{},[p]:k}}})},[x,p,l?.profiles,i]),h.useEffect(()=>{d.current=null},[r,p]),h.useEffect(()=>{if(!r||!x)return;if(!d.current){d.current=gj(x);return}const A=vj(x,d.current,r);A&&(i(q=>{const w=q??aa,k=w.profiles?.[p]??w?.defaults?.profile??qn,Y={...k,bindings:{...k.bindings??{},[r.id]:{...k.bindings?.[r.id]??{},kind:r.kind,sources:[A]}}};return{...w,profiles:{...w.profiles??{},[p]:Y}}}),f(null))},[x,p,r,i]);const b=h.useCallback(A=>{i(q=>({...q??aa,activeSignature:A||null}))},[i]),S=h.useCallback(A=>{i(q=>{const w=q??aa,k=(p&&w.profiles?.[p])??w?.defaults?.profile??qn,Y={...k,calibration:{...k.calibration??{},...A}};return p?{...w,profiles:{...w.profiles??{},[p]:Y}}:{...w,defaults:{...w.defaults??{},profile:Y}}})},[p,i]),N=h.useCallback((A,q)=>{i(w=>{const k=w??aa,Y=(p&&k.profiles?.[p])??k?.defaults?.profile??qn,L=q(Y.bindings?.[A]??{}),U={...Y,bindings:{...Y.bindings??{},[A]:L}};return p?{...k,profiles:{...k.profiles??{},[p]:U}}:{...k,defaults:{...k.defaults??{},profile:U}}})},[p,i]),M=h.useCallback(A=>{N(A.id,q=>({...q,sources:[]}))},[N]),j=h.useCallback((A,q)=>{N(A.id,w=>{const k=Array.isArray(w.sources)?[...w.sources]:[];if(!k[0])return w;const Y={...k[0]};return q==="invertX"?Y.invertX=!Y.invertX:q==="invertY"?Y.invertY=!Y.invertY:Y.invert=!Y.invert,k[0]=Y,{...w,sources:k}})},[N]),C=h.useMemo(()=>x?{outputs:Rg(x,y)}:null,[x,y]);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:x?"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:p??"",onChange:A=>b(A.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(A=>o.jsx("option",{value:A.signature,children:A.id||"Unknown controller"},A.signature))}),o.jsx("span",{className:"text-[0.7rem] text-slate-400",children:x?.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(zs,{label:"Drive deadzone",description:"Ignore small drive stick drift",min:0,max:.6,step:.01,value:y.calibration?.driveDeadzone??.18,onChange:A=>S({driveDeadzone:A})}),o.jsx(zs,{label:"Camera deadzone",description:"Ignore small camera tilt drift",min:0,max:.4,step:.01,value:y.calibration?.cameraDeadzone??.08,onChange:A=>S({cameraDeadzone:A})}),o.jsx(zs,{label:"Aux deadzone",description:"Ignore small trigger noise",min:0,max:.4,step:.01,value:y.calibration?.auxDeadzone??.05,onChange:A=>S({auxDeadzone:A})}),o.jsx(zs,{label:"Side brush scale",description:"Scale side brush output",min:.3,max:1,step:.05,value:y.calibration?.auxSideScale??.55,onChange:A=>S({auxSideScale:A})}),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:y.calibration?.cameraMode??"absolute",onChange:A=>S({cameraMode:A.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(zs,{label:"Camera sensitivity",description:"Velocity mode degrees per second",min:10,max:180,step:5,value:y.calibration?.cameraSensitivity??60,onChange:A=>S({cameraSensitivity:A})})]})]}),o.jsx("div",{className:"space-y-0.5",children:Object.entries(m).map(([A,q])=>o.jsxs("div",{className:"space-y-0.5 surface",children:[o.jsx("p",{className:"text-[0.7rem] text-slate-500",children:A}),o.jsx("div",{className:"space-y-0.5",children:q.map(w=>{const Y=y.bindings?.[w.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:w.label}),o.jsx("p",{className:"text-[0.65rem] text-slate-400",children:hj(Y)})]}),o.jsxs("div",{className:"flex items-center gap-0.5",children:[w.kind==="axisPair"&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",disabled:!Y,onClick:()=>j(w,"invertX"),className:"button-dark text-[0.7rem] font-medium disabled:opacity-50",children:"Invert X"}),o.jsx("button",{type:"button",disabled:!Y,onClick:()=>j(w,"invertY"),className:"button-dark text-[0.7rem] font-medium disabled:opacity-50",children:"Invert Y"})]}),w.kind==="axis"&&o.jsx("button",{type:"button",disabled:!Y,onClick:()=>j(w),className:"button-dark text-[0.7rem] font-medium disabled:opacity-50",children:"Invert"}),o.jsx("button",{type:"button",onClick:()=>M(w),className:"button-dark text-[0.7rem]",children:"Clear"}),o.jsx("button",{type:"button",onClick:()=>f(w),className:`${r?.id===w.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===w.id?"Waiting…":"Capture"})]})]},w.id)})})]},A))}),o.jsxs("div",{className:"space-y-0.5 surface",children:[o.jsx("p",{className:"text-[0.7rem] text-slate-500",children:"Diagnostics"}),x?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:x.axes.map((A,q)=>o.jsxs("span",{className:"font-mono text-slate-300",children:["A",q,": ",Cn.format(A)]},`axis-${q}`))}),o.jsx("p",{className:"text-slate-400",children:"Raw buttons"}),o.jsx("div",{className:"grid grid-cols-2 gap-0.5",children:x.buttons.map((A,q)=>o.jsxs("span",{className:"font-mono text-slate-300",children:["B",q,": ",Cn.format(A.value)," ",A.pressed?"●":""]},`btn-${q}`))}),C?.outputs&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"text-slate-400",children:"Mapped outputs"}),o.jsxs("div",{className:"grid grid-cols-2 gap-0.5",children:[o.jsxs("span",{className:"font-mono text-slate-300",children:["Drive: ",Cn.format(C.outputs.driveVector.x),","," ",Cn.format(C.outputs.driveVector.y)]}),o.jsxs("span",{className:"font-mono text-slate-300",children:["Camera: ",Cn.format(C.outputs.cameraAxis)]}),o.jsxs("span",{className:"font-mono text-slate-300",children:["Main: ",Cn.format(C.outputs.auxAxis.main)]}),o.jsxs("span",{className:"font-mono text-slate-300",children:["Side: ",Cn.format(C.outputs.auxAxis.side)]})]})]})]}):o.jsx("p",{className:"text-[0.7rem] text-slate-400",children:"No controller detected."})]})]})}const Sj={drive:"Drive wheels",aux:"Aux motors"};function N0(a){return Number.isFinite(a)?`${Math.round(a*100)}%`:"--"}function Aj({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 jj(){const{state:{roverId:a},overcurrentLimiter:l}=ht(),i=h.useMemo(()=>wl.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,m=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:Sj[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:N0(f)})]}),o.jsx(Aj,{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:N0(m)})]})]})]},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 Xg=h.createContext(null);function Qg(){const a=h.useContext(Xg);if(!a)throw new Error("Tabs components must be used within a <Tabs> provider.");return a}const w0={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"}},Kg="primary";function Tf(...a){return a.filter(Boolean).join(" ")}function Rf({children:a,defaultTab:l,currentTab:i,onTabChange:r,variant:f=Kg}){const[d,m]=h.useState(l??null),[x,p]=h.useState([]),y=h.useCallback(M=>M?(p(j=>j.includes(M)?j:[...j,M]),()=>p(j=>j.includes(M)?j.filter(C=>C!==M):j)):()=>{},[]),b=i??d??x[0]??null;h.useEffect(()=>{l&&i===void 0&&m(l)},[l,i]);const S=h.useCallback(M=>{M&&(i===void 0&&m(M),r&&r(M))},[i,r]),N=h.useMemo(()=>({activeTab:b,setActiveTab:S,registerTab:y,variant:f}),[b,S,y,f]);return o.jsx(Xg.Provider,{value:N,children:a})}function kf({children:a,className:l=""}){return o.jsx("div",{className:Tf("flex gap-0.5",l),children:a})}function Kt({id:a,children:l,className:i="",disabled:r=!1}){const{activeTab:f,setActiveTab:d,registerTab:m,variant:x}=Qg();h.useEffect(()=>m(a),[a,m]);const p=w0[x]??w0[Kg],y=f===a,b=Tf(p.base,y?p.active:p.inactive,r?"cursor-not-allowed opacity-50":"",i);return o.jsx("button",{type:"button",className:b,onClick:()=>!r&&d(a),"aria-pressed":y,"aria-disabled":r,children:l})}function _f({children:a,className:l=""}){return o.jsx("div",{className:Tf("mt-0 space-y-0.5",l),children:a})}function Zt({id:a,children:l,keepMounted:i=!1}){const{activeTab:r}=Qg(),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 Nj(){const{session:a}=_e(),l=h.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 E0=300,C0=240;function wj(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 Ej(a){const i=a.map(r=>wj(r)).join(" ");return i.length>C0?`${i.slice(0,C0)}…`:i}function Cj(){const a=ln(),[l,i]=h.useState([]),r=h.useMemo(()=>l.reduce((f,d)=>(d.direction==="in"&&(f.in+=1),d.direction==="out"&&(f.out+=1),f),{in:0,out:0}),[l]);return h.useEffect(()=>{const f=(p,y,b)=>{i(S=>{const N=[...S,{id:`${Date.now()}-${Math.random().toString(16).slice(2)}`,direction:p,event:y,payload:Ej(b),timestamp:new Date().toLocaleTimeString()}];return N.length>E0?N.slice(-E0):N})},d=(p,...y)=>f("in",p,y),m=(p,...y)=>f("out",p,y);a.onAny(d);let x=null;if(typeof a.onAnyOutgoing=="function")a.onAnyOutgoing(m),x=()=>a.offAnyOutgoing(m);else{const p=a.emit.bind(a);a.emit=(y,...b)=>(m(y,...b),p(y,...b)),x=()=>{a.emit=p}}return()=>{a.offAny(d),x&&x()}},[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 qj=[{key:"start",label:"Start OI"},{key:"safe",label:"Safe"},{key:"full",label:"Full"},{key:"passive",label:"Passive"},{key:"dock",label:"Dock"}];function Zg(){const{state:{roverId:a},actions:{sendOiCommand:l,setSensorStream:i}}=ht(),r=!!a,[f,d]=Yg(),m=ln(),{value:x,save:p}=dt("page",{hudMapDesktop:!1,connectionTransport:"websocket"}),y=x?.connectionTransport||"websocket",b=h.useMemo(()=>[{key:"start",label:"Enable stream",enable:!0},{key:"stop",label:"Disable stream",enable:!1}],[]),S=M=>{a&&i(M)},N=M=>{const j=M.target.value;p(C=>({...C??{},connectionTransport:j})),m?.io?.opts&&(m.io.opts.transports=j==="polling"?["polling"]:["websocket","polling"],m.disconnect(),m.connect())};return o.jsxs(Rf,{defaultTab:"keybindings",children:[o.jsxs(kf,{children:[o.jsx(Kt,{id:"keybindings",children:"Keybindings"}),o.jsx(Kt,{id:"controller",children:"Controller"}),o.jsx(Kt,{id:"page",children:"Page settings"}),o.jsx(Kt,{id:"admin",children:"Admin"})]}),o.jsxs(_f,{children:[o.jsx(Zt,{id:"keybindings",children:o.jsx("div",{className:"space-y-0.5",children:o.jsx(uj,{})})}),o.jsx(Zt,{id:"controller",children:o.jsx("div",{className:"space-y-0.5",children:o.jsx(bj,{})})}),o.jsx(Zt,{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:y,onChange:N,className:"field-input text-sm",children:[o.jsx("option",{value:"websocket",children:"WebSocket"}),o.jsx("option",{value:"polling",children:"Polling"})]})]}),o.jsx("p",{className:"text-xs text-slate-500",children:"Switching reconnects your session."})]})]})}),o.jsx(Zt,{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:qj.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:b.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(Gg,{}),o.jsx(jj,{}),o.jsx(ej,{}),o.jsx(Nj,{}),o.jsx(Cj,{})]})})]})]})}const q0={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 Mj(a){return q0[a]||q0.desktop}function Fg({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:Tn(i)})}function M0(a,l){return a.map((i,r)=>typeof i=="string"?o.jsx("span",{children:i},`text-${r}`):i?.action?o.jsx(Fg,{actionId:i.action,keymap:l},`pill-${i.action}-${r}`):i?.text?o.jsx("span",{children:i.text},`span-${r}`):null)}function Gr(a,l,i){if(typeof a=="string")return a;if(Array.isArray(a?.segments))return M0(a.segments,l);if(a&&typeof a=="object"){if(typeof a.text=="string")return a.text;if(Array.isArray(a))return M0(a,l)}return String(a??"")}function Tj({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:Gr(i,l)},f)})})]}):null}function Rj({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:Gr(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:Gr(i,{})},`callout-${r}`))})]})}function _j({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(Fg,{actionId:i.action,keymap:l})]},i.action))})]})}function Dj({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(_j,{group:i,keymap:l},i.id))})]}):null}function Oj({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:Gr(l,{})},`gamepad-${i}`))})]}):null}function T0({block:a,keymap:l}){if(!a)return null;switch(a.type){case"list":return o.jsx(Rj,{block:a,keymap:l});case"callout":return o.jsx(kj,{block:a});case"keyboard":return o.jsx(Dj,{block:a,keymap:l});case"gamepad":return o.jsx(Oj,{block:a});default:return null}}function Jg({layout:a,keymap:l}){const i=h.useMemo(()=>Mj(a),[a]),r=l||{},f=i.main||[],d=i.aside||[];return o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(Tj,{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((m,x)=>o.jsx(T0,{block:m,keymap:r},m.title||x))}),o.jsx("div",{className:"space-y-0.5",children:d.map((m,x)=>o.jsx(T0,{block:m,keymap:r},m.title||x))})]})]})}function Ig({layout:a,onOpenOverlay:l}){const{state:i}=ht();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(Jg,{layout:a,keymap:i?.keymap||{}})]})}const Bj=["kal","rms","slt","ksp","bdl"],zj=Array.from({length:10},(a,l)=>l*10);function Xr({hideInput:a=!1,hideSpectatorNotice:l=!1,fillHeight:i=!1,allowSpectatorInput:r=!1}){const{session:f}=_e(),{messages:d,typing:m,sendMessage:x,registerInputRef:p,onInputFocus:y,onInputBlur:b,blurChat:S,setTypingActive:N}=yf(),{value:M,save:j}=dt("tts",{engine:"flite",voice:"rms",pitch:50}),[C,A]=h.useState(""),[q,w]=h.useState(!1),[k,Y]=h.useState(!1),[L,U]=h.useState(()=>M?.engine||"flite"),[B,P]=h.useState(()=>M?.voice||"rms"),[G,ne]=h.useState(()=>Number.isFinite(M?.pitch)?M.pitch:50),Q=f?.role!=="spectator"||r,W=h.useRef(null),se=f?.assignment?.roverId||null,le=!!h.useMemo(()=>f?.roster?.find(E=>String(E.id)===String(se))||null,[se,f?.roster])?.audio?.ttsEnabled,z=h.useMemo(()=>d.slice(-200),[d]),ee=h.useMemo(()=>m||[],[m]);h.useEffect(()=>{W.current&&(W.current.scrollTop=W.current.scrollHeight)},[z,ee]),h.useEffect(()=>{const E=M?.engine||"flite",O=M?.voice||"rms",K=Number.isFinite(M?.pitch)?M.pitch:50;L!==E&&U(E),B!==O&&P(O),G!==K&&ne(K)},[L,G,M?.engine,M?.pitch,M?.voice,B]),h.useEffect(()=>{Y(!!le)},[le]);const ae=h.useMemo(()=>!le||!k?null:L==="espeak"?{speak:!0,engine:L,pitch:G}:{speak:!0,engine:L,voice:B},[L,G,k,le,B]);async function ce(E){if(E.preventDefault(),!Q||a)return;const K=C.replace(/\\n/g,`
|
||
`).trim();if(K){w(!0);try{await x(K,ae),A(""),S(),N(!1)}catch(_){alert(_.message)}finally{w(!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:W,children:[z.length===0&&ee.length===0?o.jsx("p",{className:"text-sm text-slate-500",children:"No messages yet."}):z.map(E=>o.jsx(Sg,{message:E},E.id)),ee.map(E=>o.jsx(Ag,{message:E},`typing-${E.typingId||E.id}`))]}),!a&&o.jsxs("form",{className:"flex flex-wrap items-stretch gap-0.5",onSubmit:ce,children:[o.jsx("input",{className:"field-input flex-1 min-w-[10rem]",value:C,onChange:E=>{const O=E.target.value;A(O),N(!!O.trim())},onFocus:E=>{y(E),N(!!C.trim())},onBlur:E=>{b(E),N(!1)},onKeyDown:E=>{E.key==="Enter"&&!C.trim()&&(E.preventDefault(),S(),N(!1))},ref:E=>p(E,{target:"panel"}),placeholder:Q?"Type a message…":l?"":"Spectators cannot chat",disabled:!Q}),le&&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=>Y(E.target.checked),className:"accent-cyan-500"}),o.jsx("span",{children:"Speak"})]}),o.jsxs("select",{value:L,onChange:E=>{const O=E.target.value;U(O),j(K=>({...K||{},engine:O}))},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:B,onChange:E=>{const O=E.target.value;P(O),j(K=>({...K||{},voice:O}))},className:"field-input text-xs",children:Bj.map(E=>o.jsx("option",{value:E,children:E},E))}):o.jsx("select",{value:G,onChange:E=>{const O=Number(E.target.value);ne(O),j(K=>({...K||{},pitch:O}))},className:"field-input text-xs",children:zj.map(E=>o.jsxs("option",{value:E,children:["pitch ",E]},E))})]}),o.jsx("button",{type:"submit",disabled:!Q||q,className:"button-dark h-full disabled:opacity-50 self-stretch",children:q?"...":"Send"})]})]})}function Df({compact:a=!1}){const{session:l,setNickname:i}=_e(),{value:r,save:f}=dt("profile",{nickname:""}),[d,m]=h.useState(r.nickname||""),[x,p]=h.useState(!1),y=l?.role!=="spectator";h.useEffect(()=>{m(r.nickname||"")},[r.nickname]);async function b(S){if(S.preventDefault(),!y)return;const N=(d||"").trim().slice(0,32);if(N){p(!0);try{await i(N),f({nickname:N})}catch(M){alert(M.message)}finally{p(!1)}}}return o.jsxs("form",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)_auto] items-stretch gap-0.5",onSubmit:b,children:[o.jsx("input",{className:"field-input flex-1 min-w-0",value:d,onChange:S=>m(S.target.value),maxLength:32,placeholder:"Enter a nickname",disabled:!y}),o.jsx("button",{type:"submit",disabled:!y||x,className:"button-dark h-full shrink-0 whitespace-nowrap px-0.5 py-0 disabled:opacity-50",children:x?"Saving…":a?"Set":"Save"})]})}function Wg({text:a="Support me on Ko-fi!",className:l=""}){const{session:i}=_e(),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(xS,{className:"mr-0"}),a]}):null}function Lj({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(Df,{compact:a})})})}function Uj(){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(Yr,{className:"h-full"}),o.jsx(Wg,{className:"h-full"})]})})}function Du(...a){return a.filter(Boolean).join(" ")}function Hj(a){const l=a?.batteryState?.percentDisplay;return l==null?"--":`${l}%`}function Vj(a){return a?.batteryState?a.batteryState.urgentActive?"text-red-400":a.batteryState.warnActive?"text-amber-300":"text-emerald-300":"text-slate-400"}function Yj(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 $j(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 Qr({title:a="Rovers"}){const{session:l,requestControl:i}=_e(),[r,f]=h.useState({}),[d,m]=h.useState(()=>Date.now()),x=h.useMemo(()=>l?.role&&l.role!=="spectator",[l?.role]),p=l?.roster??[],y=l?.turnQueues??{},b=l?.users??[],S=l?.socketId||null,N=h.useMemo(()=>Object.values(y||{}).some(A=>A?.deadline||A?.idleDeadline),[y]);h.useEffect(()=>{if(!N)return;const A=setInterval(()=>{m(Date.now())},1e3);return()=>clearInterval(A)},[N]);const M=h.useMemo(()=>{const A=new Set(p.map(w=>String(w.id))),q=Object.keys(y||{}).filter(w=>!A.has(String(w))).map(w=>({id:w,name:w,locked:!1,batteryState:null}));return[...p,...q]},[p,y]);async function j(A){if(A){f(q=>({...q,[A]:!0}));try{await i(A)}catch(q){alert(q.message)}finally{f(q=>({...q,[A]:!1}))}}}const C=A=>b.find(q=>q.socketId===A)||{socketId:A,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(A=>{const q=String(A.id),w=y?.[q]||null,k=w?.queue||[],Y=w?.idleDeadline||w?.deadline||null,L=Y&&Y>d?Math.ceil((Y-d)/1e3):Y?0:null,U=w?.current||null,B=U?k.findIndex(z=>z===U):-1,P=k.length>1?B>=0?k[(B+1)%k.length]:k[0]:null,G=!!(S&&U&&U===S),ne=!!(S&&P&&P===S),Q=L!=null&&(G||ne),W=!!A.locked,se=A.lockReason?`locked: ${A.lockReason}`:"locked",ue=W?se:r[q]?"...":"request",le=x&&!W&&!r[q];return o.jsxs("li",{className:Du("surface flex flex-wrap items-start justify-between gap-0.5",le&&"cursor-pointer",W&&"bg-red-900/40"),onClick:()=>{le&&j(A.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:A.name}),Q?o.jsx("span",{className:"rounded bg-slate-800 px-1 text-[0.7rem] text-slate-200",children:G?`${L}s left`:`Your turn in ${L}s`}):null]}),o.jsx("span",{className:Du("text-[0.75rem] font-semibold",Vj(A)),children:Hj(A)})]}),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((z,ee)=>{const ae=C(z),ce=z===U,he=!!(P&&z===P&&!ce),E=ce?"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:`${Yj(ae.role)} font-semibold`,children:$j(ae,S)}),ce&&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}-${z}-${ee}`)})})]}),x?o.jsx("button",{type:"button",onClick:z=>{z.stopPropagation(),j(A.id)},disabled:r[q]||W,className:Du("button-dark disabled:opacity-40",W&&"bg-red-600/70 text-white hover:bg-red-600"),children:ue}):null]},A.id)})})]})}function Gj(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 Xj(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 Or({hideNicknameForm:a=!1,hideHeader:l=!1,className:i="",fillHeight:r=!1,compact:f=!1}){const{session:d,setNickname:m}=_e(),{value:x}=dt("profile",{nickname:""}),p=h.useRef(null),y=ln(),b=d?.role!=="spectator",S=d?.users??[],N=d?.socketId||null;h.useEffect(()=>{if(!b||!d?.socketId)return;const C=x.nickname||"";if(!C||d.socketId===p.current)return;const A=d.socketId;m(C).then(()=>{p.current=A}).catch(()=>{})},[b,d?.socketId,m,x.nickname]),h.useEffect(()=>{if(!y)return;const C=()=>{if(!b)return;const A=(x.nickname||"").trim();A&&m(A).then(()=>{p.current=d?.socketId||null}).catch(()=>{})};return y.on("connect",C),()=>y.off("connect",C)},[b,m,y,x.nickname,d?.socketId]);const M=h.useMemo(()=>[...S].sort((C,A)=>C.socketId===N?-1:A.socketId===N?1:(C.nickname||"").localeCompare(A.nickname||"")),[N,S]),j=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(Df,{compact:f})})}),o.jsxs("div",{className:"grid gap-0.5 sm:grid-cols-2 md:grid-cols-1",children:[o.jsx(Yr,{}),o.jsx(Wg,{})]})]}),!b&&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 ${j} ${f?"text-[0.8rem]":""}`,children:M.length===0?o.jsx("p",{className:"text-sm text-slate-500",children:"Waiting for users…"}):M.map(C=>o.jsx("span",{className:`rounded bg-slate-800/80 px-1 py-0.25 text-[0.7rem] ${Gj(C.role)}`,children:Xj(C,N)},C.socketId))})]})]})}function Qj(){const{state:{roverId:a}}=ht(),i=_l(a)?.sensors||{};return o.jsx("section",{className:"panel-section",children:o.jsx("div",{className:"aspect-square w-full",children:o.jsx(Wu,{sensors:i})})})}function Kj(){const{state:{roverId:a,keymap:l}}=ht(),i=Og(a),r=i.docked&&!i.driving;return o.jsxs("section",{className:"panel-section flex h-full flex-col gap-0.5",children:[o.jsx(Bg,{layout:"desktop",expand:r,driveDockState:i}),r?null:o.jsx(JA,{keymap:l})]})}function Zj({layout:a,onOpenHelpOverlay:l}){return o.jsx("section",{className:"panel text-base",children:o.jsxs(Rf,{defaultTab:"telemetry",children:[o.jsxs(kf,{children:[o.jsx(Kt,{id:"telemetry",children:"Controls"}),o.jsx(Kt,{id:"help",children:"Help"}),o.jsx(Kt,{id:"settings",children:"Settings"})]}),o.jsxs(_f,{children:[o.jsx(Zt,{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(Qj,{}),o.jsx(Kj,{})]}),o.jsxs("div",{className:"grid gap-0.5 grid-cols-[minmax(0,1fr)_minmax(0,0.9fr)_minmax(0,0.75fr)]",children:[o.jsx(Qr,{}),o.jsx(pf,{panelId:"replay-sources-desktop",fillHeight:!0}),o.jsx(Uj,{})]}),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(Xr,{fillHeight:!0}),o.jsxs("div",{className:"grid min-h-0 gap-0.5 grid-rows-[minmax(0,1fr)_auto]",children:[o.jsx(Or,{compact:!0,hideNicknameForm:!0,fillHeight:!0}),o.jsx(Lj,{compact:!0})]})]}),o.jsx($g,{}),o.jsx(Sf,{defaultOrientation:"horizontal",panelId:"rightpane-telemetry"})]})}),o.jsx(Zt,{id:"help",children:o.jsx(Ig,{layout:a,onOpenOverlay:l})}),o.jsx(Zt,{id:"settings",children:o.jsx(Zg,{})})]})]})})}const Fj=new Set(["admin","lockdown","lockdown-admin"]),Jj=new Set(["lockdown","lockdown-admin"]),Ij=new Set(["admin","lockdown"]);function Wj(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",description:"The server is currently in admin mode. Only admins can access the interface."}}function Pj(){const{session:a}=_e(),l=a?.mode,i=a?.role,r=Ij.has(l),f=l==="lockdown"?Jj.has(i):Fj.has(i);if(!r||f)return null;const d=Wj(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:d.title}),o.jsx("p",{className:"text-sm text-slate-300",children:d.description})]}),o.jsx("div",{className:"surface-muted",children:o.jsx(Gg,{})}),o.jsx("div",{className:"w-full justify-center items-center",children:o.jsx(Yr,{text:"Join our Discord server for updates!"})}),"You can use the chat from here though :3",o.jsxs("div",{className:"max-h-80 overflow-y-auto",children:[o.jsx(Xr,{}),o.jsx(Df,{})]})]})})}const eN="/assets/turn_alert-DVO8EZJa.mp3";function tN(a){const l=h.useRef(null);return h.useEffect(()=>{l.current=new Audio(a),l.current.load()},[a]),()=>{l.current&&(l.current.currentTime=0,l.current.play().catch(()=>{}))}}function nN(){const{session:a,pushAlert:l}=_e(),i=tN(eN),r=h.useRef(new Set),f=h.useMemo(()=>a?.turnQueues||{},[a?.turnQueues]),d=a?.socketId||null;return h.useEffect(()=>{if(!d)return;const m=[];Object.entries(f).forEach(([x,p])=>{!p||!p.current||p.current!==d||r.current.has(x)||(m.push(x),r.current.add(x))}),Object.keys(f).forEach(x=>{(!f[x]||f[x].current!==d)&&r.current.delete(x)}),m.length!==0&&(m.forEach(x=>{const p=a?.roster?.find(y=>String(y.id)===String(x))?.name||x;l({title:"Your turn!",message:`You now control ${p}.`,color:"#ff5722"})}),i())},[f,i,l,a?.roster,d]),null}function aN({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 Pg="fullscreenPromptDismissed",lN=new Set(["mobile-portrait","mobile-landscape"]),ex=()=>{if(typeof window>"u")return null;try{return window.sessionStorage}catch{return null}},sN=()=>{const a=ex();if(!a)return!1;try{return a.getItem(Pg)==="1"}catch{return!1}},R0=()=>{const a=ex();if(a)try{a.setItem(Pg,"1")}catch{}},iN=()=>{if(typeof navigator>"u")return!1;const a=navigator.userAgent||navigator.platform||"";return/iphone|ipad|ipod/i.test(a)},rN=()=>{if(typeof document>"u")return!1;const a=document;return!!(a.fullscreenEnabled||a.webkitFullscreenEnabled||a.mozFullScreenEnabled||a.msFullscreenEnabled)};function oN(a){const l=lN.has(a),[i,r]=h.useState(!1),[f,d]=h.useState("native"),m=h.useMemo(()=>iN(),[]),x=h.useCallback(()=>{if(!l){r(!1);return}if(sN()){r(!1);return}if(m){d("pwa-hint"),r(!0);return}if(!rN()){r(!1);return}if(typeof document<"u"&&document.fullscreenElement){r(!1);return}d("native"),r(!0)},[m,l]);h.useEffect(()=>{x()},[x]),h.useEffect(()=>{if(typeof document>"u")return;const b=()=>{if(document.fullscreenElement){r(!1);return}x()};return document.addEventListener("fullscreenchange",b),document.addEventListener("webkitfullscreenchange",b),()=>{document.removeEventListener("fullscreenchange",b),document.removeEventListener("webkitfullscreenchange",b)}},[x]);const p=h.useCallback(()=>{R0(),r(!1)},[]),y=h.useCallback(async()=>{if(!l||m||typeof document>"u")return!1;const b=document.documentElement;if(!b)return!1;const S=b.requestFullscreen||b.webkitRequestFullscreen||b.mozRequestFullScreen||b.msRequestFullscreen;if(!S)return!1;try{const N=S.call(b);return N&&typeof N.then=="function"&&await N,R0(),r(!1),!0}catch(N){return console.warn("Failed to enter fullscreen",N),!1}},[m,l]);return h.useEffect(()=>{l||r(!1)},[l]),{visible:i,mode:f,enterFullscreen:y,dismiss:p}}function cN({visible:a,layout:l,onClose:i,showOnLoad:r,onToggleShowOnLoad:f}){if(!a)return null;const{state:d}=ht(),m=x=>{const p=!x.target.checked;f?.(p)};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:m,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(Jg,{layout:l,keymap:d?.keymap||{}})})]})})}const uN=`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 fN(a){return a?a.charAt(0).toUpperCase()+a.slice(1):""}function dN(){const a=String(uN).split(/\r?\n/).map(i=>i.trim()).filter(Boolean);return a.length?(a[Math.floor(Math.random()*a.length)]||"").trim():""}function Of(){const{setNickname:a}=_e(),{value:l,status:i,save:r}=dt("profile",{nickname:""}),f=h.useRef(!1);h.useEffect(()=>{if(i!=="ready"||f.current||(l.nickname||"").trim())return;f.current=!0;const m=fN(dN()).slice(0,32);if(!m)return;(async()=>{try{await a(m)}catch{}finally{r({nickname:m})}})()},[r,a,i,l.nickname])}const Ou=1e4,Bu=28,hN=14;function Br({layout:a="desktop",className:l="",dismissable:i=!0}){const{session:r}=_e(),f=r?.communityGoal?.text?String(r.communityGoal.text).trim():"",d=a==="mobile-portrait"||a==="mobile-landscape"||a==="mobile",[m,x]=h.useState(!1),[p,y]=h.useState(Bu),[b,S]=h.useState(0),N=h.useRef(null),M=h.useRef(null),j=h.useRef(null);h.useEffect(()=>{if(!f){x(!1);return}if(x(!0),!d||!i)return;const w=Date.now();S(Ou);const k=setTimeout(()=>x(!1),Ou),Y=setInterval(()=>{const L=Date.now()-w;S(Math.max(0,Ou-L))},250);return()=>{clearTimeout(k),clearInterval(Y)}},[f,d]),h.useEffect(()=>{if(!f)return;y(Bu);let w=0;const k=()=>{const L=j.current,U=M.current;if(!L||!U)return;const B=L.clientWidth;if(!B)return;const P=U.scrollWidth;if(!P)return;const G=Math.min(1,B/P),ne=Math.max(hN,Math.floor(Bu*G));y(ne)};w=window.requestAnimationFrame(k);const Y=new ResizeObserver(()=>{window.cancelAnimationFrame(w),w=window.requestAnimationFrame(k)});return N.current&&Y.observe(N.current),()=>{window.cancelAnimationFrame(w),Y.disconnect()}},[f]);const C=h.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||!m)return null;const A=d?Math.ceil(b/1e3):null,q=i?{onClick:()=>x(!1),role:"button",tabIndex:0}:{};return o.jsx("div",{ref:N,className:C,style:{fontSize:`${p}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:j,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:[A,"s"]}):null]})})}function mN(){const[a,l]=h.useState(()=>typeof window>"u"||window.innerWidth>=1024?"desktop":window.innerWidth>window.innerHeight?"mobile-landscape":"mobile-portrait");return h.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 pN({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(Cf,{}),o.jsx(aS,{}),o.jsx(Af,{})]}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5 overflow-y-auto",children:[o.jsx(Br,{layout:a}),o.jsx(Zj,{layout:a,onOpenHelpOverlay:l})]})]})}function tx({layout:a,onOpenHelpOverlay:l,roomPanelId:i,showTelemetry:r=!0}){return o.jsx("section",{className:"panel text-base",children:o.jsxs(Rf,{defaultTab:"chat",children:[o.jsxs(kf,{children:[o.jsx(Kt,{id:"chat",children:"Chat"}),o.jsx(Kt,{id:"roomcontrols",children:"Room Controls"}),o.jsx(Kt,{id:"help",children:"Help"}),o.jsx(Kt,{id:"settings",children:"Settings"})]}),o.jsxs(_f,{children:[o.jsx(Zt,{id:"chat",children:o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(Xr,{}),o.jsx(Or,{})]})}),o.jsx(Zt,{id:"roomcontrols",children:o.jsxs("div",{className:"space-y-0.5",children:[o.jsx($g,{}),o.jsx(Sf,{panelId:i})]})}),o.jsx(Zt,{id:"help",children:o.jsx(Ig,{layout:a,onOpenOverlay:l})}),o.jsx(Zt,{id:"settings",children:o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(Zg,{}),o.jsx(Af,{})]})})]})]})})}function gN({onOpenHelpOverlay:a}){return o.jsxs("div",{className:"flex flex-col gap-0.5",children:[o.jsx(Cf,{layoutFormat:"mobile-portrait"}),o.jsx(vA,{}),o.jsxs("div",{className:"grid gap-0.5 grid-cols-[minmax(0,1fr)_minmax(0,1.4fr)]",children:[o.jsx(pf,{panelId:"replay-sources-mobile-portrait"}),o.jsx(Qr,{})]}),o.jsx(tx,{layout:"mobile-portrait",onOpenHelpOverlay:a,roomPanelId:"mobile-portrait-room"})]})}function xN({onOpenHelpOverlay:a}){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(xA,{}),o.jsxs("div",{children:[o.jsx(Cf,{layoutFormat:"mobile-landscape"}),o.jsxs("div",{className:"grid gap-0.5 grid-cols-[minmax(0,1fr)_minmax(0,1.4fr)]",children:[o.jsx(pf,{panelId:"replay-sources-mobile-landscape"}),o.jsx(Qr,{})]})]}),o.jsx(yA,{})]}),o.jsx("div",{className:"flex flex-col gap-0.5 pb-0",children:o.jsx(tx,{layout:"mobile-landscape",onOpenHelpOverlay:a,roomPanelId:"mobile-landscape-room",showTelemetry:!1})})]})}function yN(){const a=mN(),l=a==="desktop",i=oN(a);return o.jsx("div",{className:`bg-black text-slate-100 ${l?"h-screen overflow-hidden":"min-h-screen"}`,children:o.jsx(mf,{children:o.jsx(vN,{layout:a,isDesktop:l,fullscreen:i})})})}function vN({layout:a,isDesktop:l,fullscreen:i}){Of();const{visible:r,mode:f,enterFullscreen:d,dismiss:m}=i,{value:x,status:p,save:y}=dt("help",{showOnLoad:!0}),[b,S]=h.useState(!1);h.useEffect(()=>{p==="ready"&&S(x?.showOnLoad!==!1)},[p,x?.showOnLoad]);const N=h.useCallback(()=>S(!0),[]),M=h.useCallback(()=>S(!1),[]),j=h.useCallback(A=>{const q=!!A;y(w=>({...w??{},showOnLoad:q})),q||S(!1)},[y]),C=h.useMemo(()=>l?o.jsx(pN,{layout:a,onOpenHelpOverlay:N}):a==="mobile-landscape"?o.jsx(xN,{onOpenHelpOverlay:N}):o.jsx(gN,{onOpenHelpOverlay:N}),[l,a,N]);return o.jsxs(YS,{children:[o.jsx(PS,{}),o.jsx(fA,{}),o.jsxs("main",{className:`flex w-full flex-col gap-0.5 text-base ${l?"h-full overflow-hidden":""}`,children:[l?null:o.jsx(Br,{layout:a}),C]}),o.jsx(gf,{}),o.jsx(nN,{}),o.jsx(Pj,{}),o.jsx(cN,{visible:b,layout:a,onClose:M,showOnLoad:x?.showOnLoad!==!1,onToggleShowOnLoad:j}),o.jsx(aN,{visible:r,mode:f,onEnterFullscreen:d,onDismiss:m})]})}function nx(){const{session:a,setRole:l,subscribeAll:i,connected:r}=_e(),[f,d]=h.useState(!1);return h.useEffect(()=>{let m=!1;async function x(){if(a?.mode==="lockdown"){d(!1);return}try{a?.role!=="spectator"&&await l("spectator"),await i(),m||d(!0)}catch(p){console.error("Failed to enter spectator mode",p),m||d(!1)}}return x(),()=>{m=!0}},[r,a?.mode,a?.role,l,i]),f}function bN(){const[a,l]=h.useState(()=>typeof window>"u"?!1:window.matchMedia("(max-aspect-ratio: 4/3)").matches);return h.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 SN({roverId:a,session:l}){const i=l?.activeDrivers?.[a]||null,f=(l?.users||[]).find(p=>p.socketId===i)?.nickname||(i?i.slice(0,6):"No driver"),d=l?.mode,m=l?.turnQueues?.[a];return d==="turns"&&m?.current?`${f} (turns)`:f}function AN({rover:a,frame:l,snapshotFeed:i,audioInfo:r,session:f}){const d=SN({roverId:a.id,session:f});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(Ef,{sessionInfo:null,videoMode:"snapshot",snapshotFeed:i,audioSessionInfo:r,label:a.name,telemetryFrame:l,batteryConfig:a.battery,hudVariant:"spectator",driverLabel:d,hudForceMap:!0,hudMapPosition:"top-center"})})})}function jN({roster:a,frames:l,snapshotFeeds:i,audioSources:r,session:f}){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(d=>o.jsx(AN,{rover:d,frame:l[d.id],snapshotFeed:i[d.id],audioInfo:r[`${d.id}-audio`],session:f,showHudMap:!0,hudMapPosition:"bottom-left"},d.id))})}function NN(){return o.jsx("section",{className:"min-h-0",children:o.jsx("div",{className:"surface min-h-[14rem] overflow-hidden",children:o.jsx(Sf,{defaultOrientation:"horizontal",hideLayoutToggle:!0,hideHeader:!0,panelId:"spectator-secondary"})})})}function wN({className:a=""}){return o.jsx("div",{className:`panel ${a}`,children:o.jsx(Af,{})})}function EN(){const{session:a}=_e(),l=a?.mode==="lockdown";Of(),nx();const i=bN(),r=hf(),f=a?.roster??[],d=Nf(f.map(M=>M.id),{enabled:!l,version:a?.mode}),m=f.flatMap(M=>M.media?.audioPublishUrl?[{type:"rover",id:`${M.id}-audio`,key:`${M.id}-audio`}]:[]),x=jf(m,{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 p=i?"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]",y=i?"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",b=i?"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",S="",N=i?"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:p,children:[o.jsxs("section",{className:b,children:[i?o.jsxs("div",{className:`${S} ${N} flex flex-col gap-0.5`,children:[o.jsx(Br,{layout:"desktop",dismissable:!1,className:"text-sm"}),o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(Or,{hideNicknameForm:!0,hideHeader:!0,compact:!0,fillHeight:!0,className:"h-full"})})]}):o.jsx("div",{className:S,children:o.jsx(Br,{layout:"desktop",dismissable:!1,className:"text-sm"})}),o.jsx("div",{className:`${S} ${i?`${N} overflow-y-auto`:""}`,children:o.jsx("div",{className:"panel h-full",children:o.jsx(Qr,{title:"Rovers"})})}),i?null:o.jsx("div",{className:`${S} flex-1 min-h-0`,children:o.jsx(Or,{hideNicknameForm:!0,hideHeader:!0,compact:!0,fillHeight:!0,className:"h-full"})}),o.jsx("div",{className:`${S} ${i?N:"flex-[1.1] min-h-0"}`,children:o.jsx(Xr,{allowSpectatorInput:!0,hideSpectatorNotice:!0,fillHeight:!0})}),o.jsx("div",{className:`${S} ${i?N:""}`,children:o.jsx(wN,{className:`${i?"h-full":"h-40"} overflow-hidden`})})]}),o.jsxs("section",{className:y,children:[o.jsx(jN,{roster:f,frames:r,snapshotFeeds:d,audioSources:x,session:a}),o.jsx(NN,{})]})]}),o.jsx(gf,{})]})}function CN(){return o.jsx(mf,{children:o.jsx(EN,{})})}const qN=2e4,MN=10800*1e3;function k0({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,m=l?.turnQueues?.[a];return d==="turns"&&m?.current?`${f}`:f}function TN({rover:a,frame:l}){const i=a?.batteryState?.percentDisplay,r=a?.batteryState?.urgentActive??!1,f=a?.batteryState?.warnActive??!1,d=a?.battery??null,m=l?.sensors?.batteryChargeMah??null,x=d?.Full??null,p=d?.Warn??null,y=d?.Urgent??null;if(i!=null&&Number.isFinite(i))return{percent:Math.max(0,Math.min(1,i/100)),barClass:r?"bg-red-500/40":f?"bg-amber-400/40":"bg-emerald-400/40"};if(m==null||x==null||p==null)return{percent:0,barClass:"bg-slate-700/40"};const b=x-p;if(b<=0)return{percent:0,barClass:"bg-slate-700/40"};const S=(m-p)/b,N=Math.max(0,Math.min(1,S)),M=S<=0,j=y!=null&&m<=y;return{percent:N,barClass:M?"bg-red-500/40":j?"bg-amber-400/40":"bg-emerald-400/40"}}function RN(){const{session:a}=_e(),l=nx();Of();const i=a?.mode==="lockdown",r=hf(),f=a?.roster??[],[d,m]=h.useState(0),x=a?.activeDrivers||{},p=h.useMemo(()=>f.filter(L=>x[L.id]),[f,x]),y=Nf(p.map(L=>L.id),{enabled:!i,version:a?.mode}),b=h.useMemo(()=>p.flatMap(L=>{if(!L?.id||!L.media?.audioPublishUrl)return[];const U=String(L.id);return[{type:"rover",id:`${U}-audio`,key:`${U}-audio`}]}),[p]),S=jf(b,{enabled:!i,version:a?.mode}),N=h.useMemo(()=>{if(!p.length)return[];const L=p.filter(U=>y[U.id]?.objectUrl);return L.length?L:p},[p,y]),M=h.useMemo(()=>N.map(L=>({type:"rover",rover:L})),[N]),j=h.useMemo(()=>M.map(L=>`r:${L.rover.id}`).join("|"),[M]);h.useEffect(()=>{m(0)},[j]),h.useEffect(()=>{if(!M.length)return;const L=setInterval(()=>{m(U=>(U+1)%M.length)},qN);return()=>clearInterval(L)},[M.length,j]);const C=M.length?M[d%M.length]:null,A=C?.type==="rover"?C.rover:null,q=A&&y[A.id]||null,w=A&&S[`${A.id}-audio`]||null,k=A&&r[A.id]||null,Y=A?k0({roverId:A.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."})]})}):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?A?o.jsx(_N,{children:o.jsx(Ef,{sessionInfo:null,videoMode:"snapshot",snapshotFeed:q,audioSessionInfo:w,label:A.name||A.id,telemetryFrame:k,batteryConfig:A.battery,layoutFormat:"mobile",hudVariant:"spectator",driverLabel:Y,hudLabelScale:7,hudForceMap:!0,hudMapPosition:"bottom-left",fitParent:!0})}):o.jsx("div",{className:"flex h-full w-full items-center justify-center text-sm text-slate-500",children:p.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-slate-950/90",children:f.length?f.map(L=>{const U=r[L.id]||null,B=k0({roverId:L.id,session:a}),P=TN({rover:L,frame:U}),G=A?.id===L.id;return o.jsxs("div",{className:`relative flex min-h-0 flex-1 flex-col justify-center gap-2 overflow-hidden px-6 py-4 ${G?"border-4 border-emerald-300/90 bg-emerald-300/10":"opacity-60"}`,children:[o.jsx("div",{className:`absolute inset-y-0 left-0 ${P.barClass}`,style:{width:`${P.percent*100}%`}}),o.jsxs("div",{className:"relative flex flex-col gap-1",children:[o.jsx("div",{className:`text-6xl font-semibold tracking-wide ${G?"text-white":"text-slate-200"}`,children:L.name||L.id}),o.jsx("div",{className:`text-5xl font-semibold ${G?"text-white":"text-slate-300"}`,children:B})]})]},L.id)}):o.jsx("div",{className:"flex h-full w-full items-center justify-center text-sm text-slate-500",children:"No rovers available."})})]})}function kN(){return h.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())},MN);return()=>clearTimeout(a)},[]),o.jsx(mf,{children:o.jsxs(o.Fragment,{children:[o.jsx(RN,{}),o.jsx(gf,{scale:3})]})})}function _N({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})})})}Cv.createRoot(document.getElementById("root")).render(o.jsx(h.StrictMode,{children:o.jsx(J1,{children:o.jsx(W1,{children:o.jsx(P1,{children:o.jsx(GS,{children:o.jsx(Yb,{children:o.jsxs(vb,{children:[o.jsx(br,{path:"/",element:o.jsx(yN,{})}),o.jsx(br,{path:"/spectate",element:o.jsx(CN,{})}),o.jsx(br,{path:"/mini",element:o.jsx(kN,{})})]})})})})})})}));
|