Files
MultiRoombaRover/server/public/assets/index-U-JdJMLL.js
T

120 lines
460 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
(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 mv(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var ou={exports:{}},Cs={};var Mp;function pv(){if(Mp)return Cs;Mp=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 Cs.Fragment=l,Cs.jsx=i,Cs.jsxs=i,Cs}var Tp;function gv(){return Tp||(Tp=1,ou.exports=pv()),ou.exports}var o=gv(),cu={exports:{}},me={};var Rp;function xv(){if(Rp)return me;Rp=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"),S=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),w=Symbol.iterator;function M(E){return E===null||typeof E!="object"?null:(E=w&&E[w]||E["@@iterator"],typeof E=="function"?E:null)}var N={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,A={};function q(E,O,_){this.props=E,this.context=O,this.refs=A,this.updater=_||N}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 j(){}j.prototype=q.prototype;function k(E,O,_){this.props=E,this.context=O,this.refs=A,this.updater=_||N}var X=k.prototype=new j;X.constructor=k,C(X,q.prototype),X.isPureReactComponent=!0;var U=Array.isArray;function Y(){}var z={H:null,A:null,T:null,S:null},I=Object.prototype.hasOwnProperty;function G(E,O,_){var V=_.ref;return{$$typeof:a,type:E,key:O,ref:V!==void 0?V:null,props:_}}function te(E,O){return G(E.type,O,E.props)}function Z(E){return typeof E=="object"&&E!==null&&E.$$typeof===a}function W(E){var O={"=":"=0",":":"=2"};return"$"+E.replace(/[=:]/g,function(_){return O[_]})}var se=/\/+/g;function ue(E,O){return typeof E=="object"&&E!==null&&E.key!=null?W(""+E.key):O.toString(36)}function ae(E){switch(E.status){case"fulfilled":return E.value;case"rejected":throw E.reason;default:switch(typeof E.status=="string"?E.then(Y,Y):(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 B(E,O,_,V,ee){var ne=typeof E;(ne==="undefined"||ne==="boolean")&&(E=null);var re=!1;if(E===null)re=!0;else switch(ne){case"bigint":case"string":case"number":re=!0;break;case"object":switch(E.$$typeof){case a:case l:re=!0;break;case S:return re=E._init,B(re(E._payload),O,_,V,ee)}}if(re)return ee=ee(E),re=V===""?"."+ue(E,0):V,U(ee)?(_="",re!=null&&(_=re.replace(se,"$&/")+"/"),B(ee,O,_,"",function(St){return St})):ee!=null&&(Z(ee)&&(ee=te(ee,_+(ee.key==null||E&&E.key===ee.key?"":(""+ee.key).replace(se,"$&/")+"/")+re)),O.push(ee)),1;re=0;var we=V===""?".":V+":";if(U(E))for(var xe=0;xe<E.length;xe++)V=E[xe],ne=we+ue(V,xe),re+=B(V,O,_,ne,ee);else if(xe=M(E),typeof xe=="function")for(E=xe.call(E),xe=0;!(V=E.next()).done;)V=V.value,ne=we+ue(V,xe++),re+=B(V,O,_,ne,ee);else if(ne==="object"){if(typeof E.then=="function")return B(ae(E),O,_,V,ee);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 re}function P(E,O,_){if(E==null)return E;var V=[],ee=0;return B(E,V,"","",function(ne){return O.call(_,ne,ee++)}),V}function le(E){if(E._status===-1){var O=E._result;O=O(),O.then(function(_){(E._status===0||E._status===-1)&&(E._status=1,E._result=_)},function(_){(E._status===0||E._status===-1)&&(E._status=2,E._result=_)}),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:P,forEach:function(E,O,_){P(E,function(){O.apply(this,arguments)},_)},count:function(E){var O=0;return P(E,function(){O++}),O},toArray:function(E){return P(E,function(O){return O})||[]},only:function(E){if(!Z(E))throw Error("React.Children.only expected to receive a single React element child.");return E}};return me.Activity=b,me.Children=he,me.Component=q,me.Fragment=i,me.Profiler=f,me.PureComponent=k,me.StrictMode=r,me.Suspense=p,me.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=z,me.__COMPILER_RUNTIME={__proto__:null,c:function(E){return z.H.useMemoCache(E)}},me.cache=function(E){return function(){return E.apply(null,arguments)}},me.cacheSignal=function(){return null},me.cloneElement=function(E,O,_){if(E==null)throw Error("The argument must be a React element, but you passed "+E+".");var V=C({},E.props),ee=E.key;if(O!=null)for(ne in O.key!==void 0&&(ee=""+O.key),O)!I.call(O,ne)||ne==="key"||ne==="__self"||ne==="__source"||ne==="ref"&&O.ref===void 0||(V[ne]=O[ne]);var ne=arguments.length-2;if(ne===1)V.children=_;else if(1<ne){for(var re=Array(ne),we=0;we<ne;we++)re[we]=arguments[we+2];V.children=re}return G(E.type,ee,V)},me.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},me.createElement=function(E,O,_){var V,ee={},ne=null;if(O!=null)for(V in O.key!==void 0&&(ne=""+O.key),O)I.call(O,V)&&V!=="key"&&V!=="__self"&&V!=="__source"&&(ee[V]=O[V]);var re=arguments.length-2;if(re===1)ee.children=_;else if(1<re){for(var we=Array(re),xe=0;xe<re;xe++)we[xe]=arguments[xe+2];ee.children=we}if(E&&E.defaultProps)for(V in re=E.defaultProps,re)ee[V]===void 0&&(ee[V]=re[V]);return G(E,ne,ee)},me.createRef=function(){return{current:null}},me.forwardRef=function(E){return{$$typeof:x,render:E}},me.isValidElement=Z,me.lazy=function(E){return{$$typeof:S,_payload:{_status:-1,_result:E},_init:le}},me.memo=function(E,O){return{$$typeof:y,type:E,compare:O===void 0?null:O}},me.startTransition=function(E){var O=z.T,_={};z.T=_;try{var V=E(),ee=z.S;ee!==null&&ee(_,V),typeof V=="object"&&V!==null&&typeof V.then=="function"&&V.then(Y,ce)}catch(ne){ce(ne)}finally{O!==null&&_.types!==null&&(O.types=_.types),z.T=O}},me.unstable_useCacheRefresh=function(){return z.H.useCacheRefresh()},me.use=function(E){return z.H.use(E)},me.useActionState=function(E,O,_){return z.H.useActionState(E,O,_)},me.useCallback=function(E,O){return z.H.useCallback(E,O)},me.useContext=function(E){return z.H.useContext(E)},me.useDebugValue=function(){},me.useDeferredValue=function(E,O){return z.H.useDeferredValue(E,O)},me.useEffect=function(E,O){return z.H.useEffect(E,O)},me.useEffectEvent=function(E){return z.H.useEffectEvent(E)},me.useId=function(){return z.H.useId()},me.useImperativeHandle=function(E,O,_){return z.H.useImperativeHandle(E,O,_)},me.useInsertionEffect=function(E,O){return z.H.useInsertionEffect(E,O)},me.useLayoutEffect=function(E,O){return z.H.useLayoutEffect(E,O)},me.useMemo=function(E,O){return z.H.useMemo(E,O)},me.useOptimistic=function(E,O){return z.H.useOptimistic(E,O)},me.useReducer=function(E,O,_){return z.H.useReducer(E,O,_)},me.useRef=function(E){return z.H.useRef(E)},me.useState=function(E){return z.H.useState(E)},me.useSyncExternalStore=function(E,O,_){return z.H.useSyncExternalStore(E,O,_)},me.useTransition=function(){return z.H.useTransition()},me.version="19.2.0",me}var kp;function Iu(){return kp||(kp=1,cu.exports=xv()),cu.exports}var h=Iu();const Ma=mv(h);var uu={exports:{}},qs={},fu={exports:{}},du={};var _p;function yv(){return _p||(_p=1,(function(a){function l(B,P){var le=B.length;B.push(P);e:for(;0<le;){var ce=le-1>>>1,he=B[ce];if(0<f(he,P))B[ce]=P,B[le]=he,le=ce;else break e}}function i(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var P=B[0],le=B.pop();if(le!==P){B[0]=le;e:for(var ce=0,he=B.length,E=he>>>1;ce<E;){var O=2*(ce+1)-1,_=B[O],V=O+1,ee=B[V];if(0>f(_,le))V<he&&0>f(ee,_)?(B[ce]=ee,B[V]=le,ce=V):(B[ce]=_,B[O]=le,ce=O);else if(V<he&&0>f(ee,le))B[ce]=ee,B[V]=le,ce=V;else break e}}return P}function f(B,P){var le=B.sortIndex-P.sortIndex;return le!==0?le:B.id-P.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=[],S=1,b=null,w=3,M=!1,N=!1,C=!1,A=!1,q=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function X(B){for(var P=i(y);P!==null;){if(P.callback===null)r(y);else if(P.startTime<=B)r(y),P.sortIndex=P.expirationTime,l(p,P);else break;P=i(y)}}function U(B){if(C=!1,X(B),!N)if(i(p)!==null)N=!0,Y||(Y=!0,W());else{var P=i(y);P!==null&&ae(U,P.startTime-B)}}var Y=!1,z=-1,I=5,G=-1;function te(){return A?!0:!(a.unstable_now()-G<I)}function Z(){if(A=!1,Y){var B=a.unstable_now();G=B;var P=!0;try{e:{N=!1,C&&(C=!1,j(z),z=-1),M=!0;var le=w;try{t:{for(X(B),b=i(p);b!==null&&!(b.expirationTime>B&&te());){var ce=b.callback;if(typeof ce=="function"){b.callback=null,w=b.priorityLevel;var he=ce(b.expirationTime<=B);if(B=a.unstable_now(),typeof he=="function"){b.callback=he,X(B),P=!0;break t}b===i(p)&&r(p),X(B)}else r(p);b=i(p)}if(b!==null)P=!0;else{var E=i(y);E!==null&&ae(U,E.startTime-B),P=!1}}break e}finally{b=null,w=le,M=!1}P=void 0}}finally{P?W():Y=!1}}}var W;if(typeof k=="function")W=function(){k(Z)};else if(typeof MessageChannel<"u"){var se=new MessageChannel,ue=se.port2;se.port1.onmessage=Z,W=function(){ue.postMessage(null)}}else W=function(){q(Z,0)};function ae(B,P){z=q(function(){B(a.unstable_now())},P)}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(B){B.callback=null},a.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<B?Math.floor(1e3/B):5},a.unstable_getCurrentPriorityLevel=function(){return w},a.unstable_next=function(B){switch(w){case 1:case 2:case 3:var P=3;break;default:P=w}var le=w;w=P;try{return B()}finally{w=le}},a.unstable_requestPaint=function(){A=!0},a.unstable_runWithPriority=function(B,P){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var le=w;w=B;try{return P()}finally{w=le}},a.unstable_scheduleCallback=function(B,P,le){var ce=a.unstable_now();switch(typeof le=="object"&&le!==null?(le=le.delay,le=typeof le=="number"&&0<le?ce+le:ce):le=ce,B){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=le+he,B={id:S++,callback:P,priorityLevel:B,startTime:le,expirationTime:he,sortIndex:-1},le>ce?(B.sortIndex=le,l(y,B),i(p)===null&&B===i(y)&&(C?(j(z),z=-1):C=!0,ae(U,le-ce))):(B.sortIndex=he,l(p,B),N||M||(N=!0,Y||(Y=!0,W()))),B},a.unstable_shouldYield=te,a.unstable_wrapCallback=function(B){var P=w;return function(){var le=w;w=P;try{return B.apply(this,arguments)}finally{w=le}}}})(du)),du}var Dp;function vv(){return Dp||(Dp=1,fu.exports=yv()),fu.exports}var hu={exports:{}},ut={};var Op;function bv(){if(Op)return ut;Op=1;var a=Iu();function l(p){var y="https://react.dev/errors/"+p;if(1<arguments.length){y+="?args[]="+encodeURIComponent(arguments[1]);for(var S=2;S<arguments.length;S++)y+="&args[]="+encodeURIComponent(arguments[S])}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,S){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:f,key:b==null?null:""+b,children:p,containerInfo:y,implementation:S}}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 S=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,S)},ut.flushSync=function(p){var y=m.T,S=r.p;try{if(m.T=null,r.p=2,p)return p()}finally{m.T=y,r.p=S,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 S=y.as,b=x(S,y.crossOrigin),w=typeof y.integrity=="string"?y.integrity:void 0,M=typeof y.fetchPriority=="string"?y.fetchPriority:void 0;S==="style"?r.d.S(p,typeof y.precedence=="string"?y.precedence:void 0,{crossOrigin:b,integrity:w,fetchPriority:M}):S==="script"&&r.d.X(p,{crossOrigin:b,integrity:w,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 S=x(y.as,y.crossOrigin);r.d.M(p,{crossOrigin:S,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 S=y.as,b=x(S,y.crossOrigin);r.d.L(p,S,{crossOrigin:b,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 S=x(y.as,y.crossOrigin);r.d.m(p,{as:typeof y.as=="string"&&y.as!=="script"?y.as:void 0,crossOrigin:S,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,S){return m.H.useFormState(p,y,S)},ut.useFormStatus=function(){return m.H.useHostTransitionStatus()},ut.version="19.2.0",ut}var Bp;function Sv(){if(Bp)return hu.exports;Bp=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=bv(),hu.exports}var zp;function Av(){if(zp)return qs;zp=1;var a=vv(),l=Iu(),i=Sv();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 S(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=S(e),t!==null)return t;e=e.sibling}return null}var b=Object.assign,w=Symbol.for("react.element"),M=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),q=Symbol.for("react.profiler"),j=Symbol.for("react.consumer"),k=Symbol.for("react.context"),X=Symbol.for("react.forward_ref"),U=Symbol.for("react.suspense"),Y=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),G=Symbol.for("react.activity"),te=Symbol.for("react.memo_cache_sentinel"),Z=Symbol.iterator;function W(e){return e===null||typeof e!="object"?null:(e=Z&&e[Z]||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 U:return"Suspense";case Y:return"SuspenseList";case G:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case N:return"Portal";case k:return e.displayName||"Context";case j:return(e._context.displayName||"Context")+".Consumer";case X:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case z:return t=e.displayName||null,t!==null?t:ue(e.type)||"Memo";case I:t=e._payload,e=e._init;try{return ue(e(t))}catch{}}return null}var ae=Array.isArray,B=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,le={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 _(e,t){he++,ce[he]=e.current,e.current=t}var V=E(null),ee=E(null),ne=E(null),re=E(null);function we(e,t){switch(_(ne,t),_(ee,e),_(V,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Wm(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Wm(t),e=Pm(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}O(V),_(V,e)}function xe(){O(V),O(ee),O(ne)}function St(e){e.memoizedState!==null&&_(re,e);var t=V.current,n=Pm(t,e.type);t!==n&&(_(ee,e),_(V,n))}function Ra(e){ee.current===e&&(O(V),O(ee)),re.current===e&&(O(re),js._currentValue=le)}var Rl,sa;function Mt(e){if(Rl===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Rl=t&&t[1]||"",sa=-1<n.stack.indexOf(`
at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
`+Rl+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 J=function(){throw Error()};if(Object.defineProperty(J.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(J,[])}catch(Q){var $=Q}Reflect.construct(e,[],J)}else{try{J.call()}catch(Q){$=Q}e.call(J.prototype)}}else{try{throw Error()}catch(Q){$=Q}(J=e())&&typeof J.catch=="function"&&J.catch(function(){})}}catch(Q){if(Q&&$&&typeof Q.stack=="string")return[Q.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(`
`),H=v.split(`
`);for(c=s=0;s<T.length&&!T[s].includes("DetermineComponentFrameRoot");)s++;for(;c<H.length&&!H[c].includes("DetermineComponentFrameRoot");)c++;if(s===T.length||c===H.length)for(s=T.length-1,c=H.length-1;1<=s&&0<=c&&T[s]!==H[c];)c--;for(;1<=s&&0<=c;s--,c--)if(T[s]!==H[c]){if(s!==1||c!==1)do if(s--,c--,0>c||T[s]!==H[c]){var K=`
`+T[s].replace(" at new "," at ");return e.displayName&&K.includes("<anonymous>")&&(K=K.replace("<anonymous>",e.displayName)),K}while(1<=s&&0<=c);break}}}finally{ia=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Mt(n):""}function Ks(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 ka(e){try{var t="",n=null;do t+=Ks(e,n),n=e,e=e.return;while(e);return t}catch(s){return`
Error generating stack: `+s.message+`
`+s.stack}}var kl=Object.prototype.hasOwnProperty,ra=a.unstable_scheduleCallback,sn=a.unstable_cancelCallback,_a=a.unstable_shouldYield,_l=a.unstable_requestPaint,tt=a.unstable_now,Dl=a.unstable_getCurrentPriorityLevel,oa=a.unstable_ImmediatePriority,Ol=a.unstable_UserBlockingPriority,Da=a.unstable_NormalPriority,Kr=a.unstable_LowPriority,Zs=a.unstable_IdlePriority,Fs=a.log,Ne=a.unstable_setDisableYieldValue,Xe=null,Le=null;function Ee(e){if(typeof Fs=="function"&&Ne(e),Le&&typeof Le.setStrictMode=="function")try{Le.setStrictMode(Xe,e)}catch{}}var Ce=Math.clz32?Math.clz32:ex,Ue=Math.log,Zr=Math.LN2;function ex(e){return e>>>=0,e===0?32:31-(Ue(e)/Zr|0)|0}var Js=256,Is=262144,Ws=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 Ps(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 Bl(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function tx(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 _f(){var e=Ws;return Ws<<=1,(Ws&62914560)===0&&(Ws=4194304),e}function Fr(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function zl(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function nx(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,H=e.hiddenUpdates;for(n=g&~n;0<n;){var K=31-Ce(n),J=1<<K;v[K]=0,T[K]=-1;var $=H[K];if($!==null)for(H[K]=null,K=0;K<$.length;K++){var Q=$[K];Q!==null&&(Q.lane&=-536870913)}n&=~J}s!==0&&Df(e,s,0),u!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=u&~(g&~t))}function Df(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 Of(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 Bf(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 zf(){var e=P.p;return e!==0?e:(e=window.event,e===void 0?32:Ap(e.type))}function Lf(e,t){var n=P.p;try{return P.p=e,t()}finally{P.p=n}}var kn=Math.random().toString(36).slice(2),st="__reactFiber$"+kn,mt="__reactProps$"+kn,Oa="__reactContainer$"+kn,Wr="__reactEvents$"+kn,ax="__reactListeners$"+kn,lx="__reactHandles$"+kn,Uf="__reactResources$"+kn,Ll="__reactMarker$"+kn;function Pr(e){delete e[st],delete e[mt],delete e[Wr],delete e[ax],delete e[lx]}function Ba(e){var t=e[st];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Oa]||n[st]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=ip(e);e!==null;){if(n=e[st])return n;e=ip(e)}return t}e=n,n=e.parentNode}return null}function za(e){if(e=e[st]||e[Oa]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Ul(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(r(33))}function La(e){var t=e[Uf];return t||(t=e[Uf]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function at(e){e[Ll]=!0}var Hf=new Set,Vf={};function ua(e,t){Ua(e,t),Ua(e+"Capture",t)}function Ua(e,t){for(Vf[e]=t,e=0;e<t.length;e++)Hf.add(t[e])}var sx=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Yf={},$f={};function ix(e){return kl.call($f,e)?!0:kl.call(Yf,e)?!1:sx.test(e)?$f[e]=!0:(Yf[e]=!0,!1)}function ei(e,t,n){if(ix(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 ti(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 Gf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function rx(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=Gf(e)?"checked":"value";e._valueTracker=rx(e,t,""+e[t])}}function Qf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=Gf(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}function ni(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 ox=/[\n"\\]/g;function kt(e){return e.replace(ox,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 Xf(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"&&ni(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Ha(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 Kf(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 Zf(e,t,n,s){if(t==null){if(s!=null){if(n!=null)throw Error(r(92));if(ae(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 Va(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var cx=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 Ff(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||cx.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function Jf(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&&Ff(e,c,s)}else for(var u in t)t.hasOwnProperty(u)&&Ff(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 ux=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"]]),fx=/^[\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 ai(e){return fx.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 Ya=null,$a=null;function If(e){var t=za(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&&Qf(s)}break e;case"textarea":Kf(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Ha(e,!!n.multiple,t,!1)}}}var io=!1;function Wf(e,t,n){if(io)return e(t,n);io=!0;try{var s=e(t);return s}finally{if(io=!1,(Ya!==null||$a!==null)&&(Gi(),Ya&&(t=Ya,e=$a,$a=Ya=null,If(t),e)))for(t=0;t<e.length;t++)If(e[t])}}function Hl(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 Vl={};Object.defineProperty(Vl,"passive",{get:function(){ro=!0}}),window.addEventListener("test",Vl,Vl),window.removeEventListener("test",Vl,Vl)}catch{ro=!1}var _n=null,oo=null,li=null;function Pf(){if(li)return li;var e,t=oo,n=t.length,s,c="value"in _n?_n.value:_n.textContent,u=c.length;for(e=0;e<n&&t[e]===c[e];e++);var g=n-e;for(s=1;s<=g&&t[n-s]===c[u-s];s++);return li=c.slice(e,1<s?1-s:void 0)}function si(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 ii(){return!0}function ed(){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)?ii:ed,this.isPropagationStopped=ed,this}return b(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=ii)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=ii)},persist:function(){},isPersistent:ii}),t}var fa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ri=pt(fa),Yl=b({},fa,{view:0,detail:0}),dx=pt(Yl),co,uo,$l,oi=b({},Yl,{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!==$l&&($l&&e.type==="mousemove"?(co=e.screenX-$l.screenX,uo=e.screenY-$l.screenY):uo=co=0,$l=e),co)},movementY:function(e){return"movementY"in e?e.movementY:uo}}),td=pt(oi),hx=b({},oi,{dataTransfer:0}),mx=pt(hx),px=b({},Yl,{relatedTarget:0}),fo=pt(px),gx=b({},fa,{animationName:0,elapsedTime:0,pseudoElement:0}),xx=pt(gx),yx=b({},fa,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),vx=pt(yx),bx=b({},fa,{data:0}),nd=pt(bx),Sx={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ax={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"},jx={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Nx(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=jx[e])?!!t[e]:!1}function ho(){return Nx}var wx=b({},Yl,{key:function(e){if(e.key){var t=Sx[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=si(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Ax[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"?si(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?si(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Ex=pt(wx),Cx=b({},oi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ad=pt(Cx),qx=b({},Yl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ho}),Mx=pt(qx),Tx=b({},fa,{propertyName:0,elapsedTime:0,pseudoElement:0}),Rx=pt(Tx),kx=b({},oi,{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}),_x=pt(kx),Dx=b({},fa,{newState:0,oldState:0}),Ox=pt(Dx),Bx=[9,13,27,32],mo=cn&&"CompositionEvent"in window,Gl=null;cn&&"documentMode"in document&&(Gl=document.documentMode);var zx=cn&&"TextEvent"in window&&!Gl,ld=cn&&(!mo||Gl&&8<Gl&&11>=Gl),sd=" ",id=!1;function rd(e,t){switch(e){case"keyup":return Bx.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function od(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ga=!1;function Lx(e,t){switch(e){case"compositionend":return od(t);case"keypress":return t.which!==32?null:(id=!0,sd);case"textInput":return e=t.data,e===sd&&id?null:e;default:return null}}function Ux(e,t){if(Ga)return e==="compositionend"||!mo&&rd(e,t)?(e=Pf(),li=oo=_n=null,Ga=!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 ld&&t.locale!=="ko"?null:t.data;default:return null}}var Hx={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function cd(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Hx[e.type]:t==="textarea"}function ud(e,t,n,s){Ya?$a?$a.push(s):$a=[s]:Ya=s,t=Ii(t,"onChange"),0<t.length&&(n=new ri("onChange","change",null,n,s),e.push({event:n,listeners:t}))}var Ql=null,Xl=null;function Vx(e){Xm(e,0)}function ci(e){var t=Ul(e);if(Qf(t))return e}function fd(e,t){if(e==="change")return t}var dd=!1;if(cn){var po;if(cn){var go="oninput"in document;if(!go){var hd=document.createElement("div");hd.setAttribute("oninput","return;"),go=typeof hd.oninput=="function"}po=go}else po=!1;dd=po&&(!document.documentMode||9<document.documentMode)}function md(){Ql&&(Ql.detachEvent("onpropertychange",pd),Xl=Ql=null)}function pd(e){if(e.propertyName==="value"&&ci(Xl)){var t=[];ud(t,Xl,e,so(e)),Wf(Vx,t)}}function Yx(e,t,n){e==="focusin"?(md(),Ql=t,Xl=n,Ql.attachEvent("onpropertychange",pd)):e==="focusout"&&md()}function $x(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ci(Xl)}function Gx(e,t){if(e==="click")return ci(t)}function Qx(e,t){if(e==="input"||e==="change")return ci(t)}function Xx(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var At=typeof Object.is=="function"?Object.is:Xx;function Kl(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(!kl.call(t,c)||!At(e[c],t[c]))return!1}return!0}function gd(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function xd(e,t){var n=gd(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=gd(n)}}function yd(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?yd(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function vd(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=ni(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=ni(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 Kx=cn&&"documentMode"in document&&11>=document.documentMode,Qa=null,yo=null,Zl=null,vo=!1;function bd(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;vo||Qa==null||Qa!==ni(s)||(s=Qa,"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}),Zl&&Kl(Zl,s)||(Zl=s,s=Ii(yo,"onSelect"),0<s.length&&(t=new ri("onSelect","select",null,t,n),e.push({event:t,listeners:s}),t.target=Qa)))}function da(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Xa={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={},Sd={};cn&&(Sd=document.createElement("div").style,"AnimationEvent"in window||(delete Xa.animationend.animation,delete Xa.animationiteration.animation,delete Xa.animationstart.animation),"TransitionEvent"in window||delete Xa.transitionend.transition);function ha(e){if(bo[e])return bo[e];if(!Xa[e])return e;var t=Xa[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Sd)return bo[e]=t[n];return e}var Ad=ha("animationend"),jd=ha("animationiteration"),Nd=ha("animationstart"),Zx=ha("transitionrun"),Fx=ha("transitionstart"),Jx=ha("transitioncancel"),wd=ha("transitionend"),Ed=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){Ed.set(e,t),ua(t,[e])}var ui=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=[],Ka=0,Ao=0;function fi(){for(var e=Ka,t=Ao=Ka=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&&Cd(n,c,u)}}function di(e,t,n,s){_t[Ka++]=e,_t[Ka++]=t,_t[Ka++]=n,_t[Ka++]=s,Ao|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function jo(e,t,n,s){return di(e,t,n,s),hi(e)}function ma(e,t){return di(e,null,null,t),hi(e)}function Cd(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 hi(e){if(50<gs)throw gs=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 Za={};function Ix(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 Ix(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 qd(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function mi(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=nv(e,n,V.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 U:return e=jt(13,n,t,c),e.elementType=U,e.lanes=u,e;case Y:return e=jt(19,n,t,c),e.elementType=Y,e.lanes=u,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case k:g=10;break e;case j:g=9;break e;case X:g=11;break e;case z:g=14;break e;case I: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 Md(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 Td=new WeakMap;function Dt(e,t){if(typeof e=="object"&&e!==null){var n=Td.get(e);return n!==void 0?n:(t={value:e,source:t,stack:ka(t)},Td.set(e,t),t)}return{value:e,source:t,stack:ka(t)}}var Fa=[],Ja=0,pi=null,Fl=0,Ot=[],Bt=0,Dn=null,Jt=1,It="";function fn(e,t){Fa[Ja++]=Fl,Fa[Ja++]=pi,pi=e,Fl=t}function Rd(e,t,n){Ot[Bt++]=Jt,Ot[Bt++]=It,Ot[Bt++]=Dn,Dn=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),Rd(e,1,0))}function qo(e){for(;e===pi;)pi=Fa[--Ja],Fa[Ja]=null,Fl=Fa[--Ja],Fa[Ja]=null;for(;e===Dn;)Dn=Ot[--Bt],Ot[Bt]=null,It=Ot[--Bt],Ot[Bt]=null,Jt=Ot[--Bt],Ot[Bt]=null}function kd(e,t){Ot[Bt++]=Jt,Ot[Bt++]=It,Ot[Bt++]=Dn,Jt=t.id,It=t.overflow,Dn=e}var it=null,He=null,Ae=!1,On=null,zt=!1,Mo=Error(r(519));function Bn(e){var t=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Jl(Dt(t,e)),Mo}function _d(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<ys.length;n++)ve(ys[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),Xf(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),Zf(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||Jm(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||Bn(e,!0)}function Dd(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 Ia(e){if(e!==it)return!1;if(!Ae)return Dd(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&&Bn(e),Dd(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));He=sp(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));He=sp(e)}else t===27?(t=He,Jn(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=On;return e!==null&&(vt===null?vt=e:vt.push.apply(vt,e),On=null),e}function Jl(e){On===null?On=[e]:On.push(e)}var Ro=E(null),xa=null,dn=null;function zn(e,t,n){_(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 Wa(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===re.current){if(g=c.alternate,g===null)throw Error(r(387));g.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(js):e=[js])}c=c.return}e!==null&&_o(t,e,n,s),t.flags|=262144}function gi(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 Od(xa,e)}function xi(e,t){return xa===null&&ya(e),Od(e,t)}function Od(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 Wx=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()})}},Px=a.unstable_scheduleCallback,ey=a.unstable_NormalPriority,Fe={$$typeof:k,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Do(){return{controller:new Wx,data:new Map,refCount:0}}function Il(e){e.refCount--,e.refCount===0&&Px(ey,function(){e.controller.abort()})}var Wl=null,Oo=0,Pa=0,el=null;function ty(e,t){if(Wl===null){var n=Wl=[];Oo=0,Pa=Lc(),el={status:"pending",value:void 0,then:function(s){n.push(s)}}}return Oo++,t.then(Bd,Bd),t}function Bd(){if(--Oo===0&&Wl!==null){el!==null&&(el.status="fulfilled");var e=Wl;Wl=null,Pa=0,el=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ny(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 zd=B.S;B.S=function(e,t){bm=tt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&ty(e,t),zd!==null&&zd(e,t)};var va=E(null);function Bo(){var e=va.current;return e!==null?e:ze.pooledCache}function yi(e,t){t===null?_(va,va.current):_(va,t.pool)}function Ld(){var e=Bo();return e===null?null:{parent:Fe._currentValue,pool:e}}var tl=Error(r(460)),zo=Error(r(474)),vi=Error(r(542)),bi={then:function(){}};function Ud(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Hd(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,Yd(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,Yd(e),e}throw Sa=t,tl}}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,tl):n}}var Sa=null;function Vd(){if(Sa===null)throw Error(r(459));var e=Sa;return Sa=null,e}function Yd(e){if(e===tl||e===vi)throw Error(r(483))}var nl=null,Pl=0;function Si(e){var t=Pl;return Pl+=1,nl===null&&(nl=[]),Hd(nl,e,t)}function es(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Ai(e,t){throw t.$$typeof===w?Error(r(525)):(e=Object.prototype.toString.call(t),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function $d(e){function t(D,R){if(e){var L=D.deletions;L===null?(D.deletions=[R],D.flags|=16):L.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,L){return D.index=L,e?(L=D.alternate,L!==null?(L=L.index,L<R?(D.flags|=67108866,R):L):(D.flags|=67108866,R)):(D.flags|=1048576,R)}function g(D){return e&&D.alternate===null&&(D.flags|=67108866),D}function v(D,R,L,F){return R===null||R.tag!==6?(R=wo(L,D.mode,F),R.return=D,R):(R=c(R,L),R.return=D,R)}function T(D,R,L,F){var fe=L.type;return fe===C?K(D,R,L.props.children,F,L.key):R!==null&&(R.elementType===fe||typeof fe=="object"&&fe!==null&&fe.$$typeof===I&&ba(fe)===R.type)?(R=c(R,L.props),es(R,L),R.return=D,R):(R=mi(L.type,L.key,L.props,null,D.mode,F),es(R,L),R.return=D,R)}function H(D,R,L,F){return R===null||R.tag!==4||R.stateNode.containerInfo!==L.containerInfo||R.stateNode.implementation!==L.implementation?(R=Eo(L,D.mode,F),R.return=D,R):(R=c(R,L.children||[]),R.return=D,R)}function K(D,R,L,F,fe){return R===null||R.tag!==7?(R=pa(L,D.mode,F,fe),R.return=D,R):(R=c(R,L),R.return=D,R)}function J(D,R,L){if(typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint")return R=wo(""+R,D.mode,L),R.return=D,R;if(typeof R=="object"&&R!==null){switch(R.$$typeof){case M:return L=mi(R.type,R.key,R.props,null,D.mode,L),es(L,R),L.return=D,L;case N:return R=Eo(R,D.mode,L),R.return=D,R;case I:return R=ba(R),J(D,R,L)}if(ae(R)||W(R))return R=pa(R,D.mode,L,null),R.return=D,R;if(typeof R.then=="function")return J(D,Si(R),L);if(R.$$typeof===k)return J(D,xi(D,R),L);Ai(D,R)}return null}function $(D,R,L,F){var fe=R!==null?R.key:null;if(typeof L=="string"&&L!==""||typeof L=="number"||typeof L=="bigint")return fe!==null?null:v(D,R,""+L,F);if(typeof L=="object"&&L!==null){switch(L.$$typeof){case M:return L.key===fe?T(D,R,L,F):null;case N:return L.key===fe?H(D,R,L,F):null;case I:return L=ba(L),$(D,R,L,F)}if(ae(L)||W(L))return fe!==null?null:K(D,R,L,F,null);if(typeof L.then=="function")return $(D,R,Si(L),F);if(L.$$typeof===k)return $(D,R,xi(D,L),F);Ai(D,L)}return null}function Q(D,R,L,F,fe){if(typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint")return D=D.get(L)||null,v(R,D,""+F,fe);if(typeof F=="object"&&F!==null){switch(F.$$typeof){case M:return D=D.get(F.key===null?L:F.key)||null,T(R,D,F,fe);case N:return D=D.get(F.key===null?L:F.key)||null,H(R,D,F,fe);case I:return F=ba(F),Q(D,R,L,F,fe)}if(ae(F)||W(F))return D=D.get(L)||null,K(R,D,F,fe,null);if(typeof F.then=="function")return Q(D,R,L,Si(F),fe);if(F.$$typeof===k)return Q(D,R,L,xi(R,F),fe);Ai(R,F)}return null}function ie(D,R,L,F){for(var fe=null,qe=null,oe=R,ge=R=0,Se=null;oe!==null&&ge<L.length;ge++){oe.index>ge?(Se=oe,oe=null):Se=oe.sibling;var Me=$(D,oe,L[ge],F);if(Me===null){oe===null&&(oe=Se);break}e&&oe&&Me.alternate===null&&t(D,oe),R=u(Me,R,ge),qe===null?fe=Me:qe.sibling=Me,qe=Me,oe=Se}if(ge===L.length)return n(D,oe),Ae&&fn(D,ge),fe;if(oe===null){for(;ge<L.length;ge++)oe=J(D,L[ge],F),oe!==null&&(R=u(oe,R,ge),qe===null?fe=oe:qe.sibling=oe,qe=oe);return Ae&&fn(D,ge),fe}for(oe=s(oe);ge<L.length;ge++)Se=Q(oe,D,ge,L[ge],F),Se!==null&&(e&&Se.alternate!==null&&oe.delete(Se.key===null?ge:Se.key),R=u(Se,R,ge),qe===null?fe=Se:qe.sibling=Se,qe=Se);return e&&oe.forEach(function(ta){return t(D,ta)}),Ae&&fn(D,ge),fe}function de(D,R,L,F){if(L==null)throw Error(r(151));for(var fe=null,qe=null,oe=R,ge=R=0,Se=null,Me=L.next();oe!==null&&!Me.done;ge++,Me=L.next()){oe.index>ge?(Se=oe,oe=null):Se=oe.sibling;var ta=$(D,oe,Me.value,F);if(ta===null){oe===null&&(oe=Se);break}e&&oe&&ta.alternate===null&&t(D,oe),R=u(ta,R,ge),qe===null?fe=ta:qe.sibling=ta,qe=ta,oe=Se}if(Me.done)return n(D,oe),Ae&&fn(D,ge),fe;if(oe===null){for(;!Me.done;ge++,Me=L.next())Me=J(D,Me.value,F),Me!==null&&(R=u(Me,R,ge),qe===null?fe=Me:qe.sibling=Me,qe=Me);return Ae&&fn(D,ge),fe}for(oe=s(oe);!Me.done;ge++,Me=L.next())Me=Q(oe,D,ge,Me.value,F),Me!==null&&(e&&Me.alternate!==null&&oe.delete(Me.key===null?ge:Me.key),R=u(Me,R,ge),qe===null?fe=Me:qe.sibling=Me,qe=Me);return e&&oe.forEach(function(hv){return t(D,hv)}),Ae&&fn(D,ge),fe}function Be(D,R,L,F){if(typeof L=="object"&&L!==null&&L.type===C&&L.key===null&&(L=L.props.children),typeof L=="object"&&L!==null){switch(L.$$typeof){case M:e:{for(var fe=L.key;R!==null;){if(R.key===fe){if(fe=L.type,fe===C){if(R.tag===7){n(D,R.sibling),F=c(R,L.props.children),F.return=D,D=F;break e}}else if(R.elementType===fe||typeof fe=="object"&&fe!==null&&fe.$$typeof===I&&ba(fe)===R.type){n(D,R.sibling),F=c(R,L.props),es(F,L),F.return=D,D=F;break e}n(D,R);break}else t(D,R);R=R.sibling}L.type===C?(F=pa(L.props.children,D.mode,F,L.key),F.return=D,D=F):(F=mi(L.type,L.key,L.props,null,D.mode,F),es(F,L),F.return=D,D=F)}return g(D);case N:e:{for(fe=L.key;R!==null;){if(R.key===fe)if(R.tag===4&&R.stateNode.containerInfo===L.containerInfo&&R.stateNode.implementation===L.implementation){n(D,R.sibling),F=c(R,L.children||[]),F.return=D,D=F;break e}else{n(D,R);break}else t(D,R);R=R.sibling}F=Eo(L,D.mode,F),F.return=D,D=F}return g(D);case I:return L=ba(L),Be(D,R,L,F)}if(ae(L))return ie(D,R,L,F);if(W(L)){if(fe=W(L),typeof fe!="function")throw Error(r(150));return L=fe.call(L),de(D,R,L,F)}if(typeof L.then=="function")return Be(D,R,Si(L),F);if(L.$$typeof===k)return Be(D,R,xi(D,L),F);Ai(D,L)}return typeof L=="string"&&L!==""||typeof L=="number"||typeof L=="bigint"?(L=""+L,R!==null&&R.tag===6?(n(D,R.sibling),F=c(R,L),F.return=D,D=F):(n(D,R),F=wo(L,D.mode,F),F.return=D,D=F),g(D)):n(D,R)}return function(D,R,L,F){try{Pl=0;var fe=Be(D,R,L,F);return nl=null,fe}catch(oe){if(oe===tl||oe===vi)throw oe;var qe=jt(29,oe,null,D.mode);return qe.lanes=F,qe.return=D,qe}finally{}}}var Aa=$d(!0),Gd=$d(!1),Ln=!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 Un(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Hn(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=hi(e),Cd(e,null,n),t}return di(e,s,t,n),hi(e)}function ts(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,Of(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 ns(){if(Vo){var e=el;if(e!==null)throw e}}function as(e,t,n,s){Vo=!1;var c=e.updateQueue;Ln=!1;var u=c.firstBaseUpdate,g=c.lastBaseUpdate,v=c.shared.pending;if(v!==null){c.shared.pending=null;var T=v,H=T.next;T.next=null,g===null?u=H:g.next=H,g=T;var K=e.alternate;K!==null&&(K=K.updateQueue,v=K.lastBaseUpdate,v!==g&&(v===null?K.firstBaseUpdate=H:v.next=H,K.lastBaseUpdate=T))}if(u!==null){var J=c.baseState;g=0,K=H=T=null,v=u;do{var $=v.lane&-536870913,Q=$!==v.lane;if(Q?(be&$)===$:(s&$)===$){$!==0&&$===Pa&&(Vo=!0),K!==null&&(K=K.next={lane:0,tag:v.tag,payload:v.payload,callback:null,next:null});e:{var ie=e,de=v;$=t;var Be=n;switch(de.tag){case 1:if(ie=de.payload,typeof ie=="function"){J=ie.call(Be,J,$);break e}J=ie;break e;case 3:ie.flags=ie.flags&-65537|128;case 0:if(ie=de.payload,$=typeof ie=="function"?ie.call(Be,J,$):ie,$==null)break e;J=b({},J,$);break e;case 2:Ln=!0}}$=v.callback,$!==null&&(e.flags|=64,Q&&(e.flags|=8192),Q=c.callbacks,Q===null?c.callbacks=[$]:Q.push($))}else Q={lane:$,tag:v.tag,payload:v.payload,callback:v.callback,next:null},K===null?(H=K=Q,T=J):K=K.next=Q,g|=$;if(v=v.next,v===null){if(v=c.shared.pending,v===null)break;Q=v,v=Q.next,Q.next=null,c.lastBaseUpdate=Q,c.shared.pending=null}}while(!0);K===null&&(T=J),c.baseState=T,c.firstBaseUpdate=H,c.lastBaseUpdate=K,u===null&&(c.shared.lanes=0),Qn|=g,e.lanes=g,e.memoizedState=J}}function Qd(e,t){if(typeof e!="function")throw Error(r(191,e));e.call(t)}function Xd(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Qd(n[e],t)}var al=E(null),ji=E(0);function Kd(e,t){e=An,_(ji,e),_(al,t),An=e|t.baseLanes}function Yo(){_(ji,An),_(al,al.current)}function $o(){An=ji.current,O(al),O(ji)}var Nt=E(null),Lt=null;function Vn(e){var t=e.alternate;_(Ke,Ke.current&1),_(Nt,e),Lt===null&&(t===null||al.current!==null||t.memoizedState!==null)&&(Lt=e)}function Go(e){_(Ke,Ke.current),_(Nt,e),Lt===null&&(Lt=e)}function Zd(e){e.tag===22?(_(Ke,Ke.current),_(Nt,e),Lt===null&&(Lt=e)):Yn()}function Yn(){_(Ke,Ke.current),_(Nt,Nt.current)}function wt(e){O(Nt),Lt===e&&(Lt=null),O(Ke)}var Ke=E(0);function Ni(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,pe=null,De=null,Je=null,wi=!1,ll=!1,ja=!1,Ei=0,ls=0,sl=null,ay=0;function Ge(){throw Error(r(321))}function Qo(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 Xo(e,t,n,s,c,u){return mn=u,pe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,B.H=e===null||e.memoizedState===null?Rh:rc,ja=!1,u=n(s,c),ja=!1,ll&&(u=Jd(t,n,s,c)),Fd(e),u}function Fd(e){B.H=rs;var t=De!==null&&De.next!==null;if(mn=0,Je=De=pe=null,wi=!1,ls=0,sl=null,t)throw Error(r(300));e===null||Ie||(e=e.dependencies,e!==null&&gi(e)&&(Ie=!0))}function Jd(e,t,n,s){pe=e;var c=0;do{if(ll&&(sl=null),ls=0,ll=!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)}B.H=kh,u=t(n,s)}while(ll);return u}function ly(){var e=B.H,t=e.useState()[0];return t=typeof t.then=="function"?ss(t):t,e=e.useState()[0],(De!==null?De.memoizedState:null)!==e&&(pe.flags|=1024),t}function Ko(){var e=Ei!==0;return Ei=0,e}function Zo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Fo(e){if(wi){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}wi=!1}mn=0,Je=De=pe=null,ll=!1,ls=Ei=0,sl=null}function ft(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Je===null?pe.memoizedState=Je=e:Je=Je.next=e,Je}function Ze(){if(De===null){var e=pe.alternate;e=e!==null?e.memoizedState:null}else e=De.next;var t=Je===null?pe.memoizedState:Je.next;if(t!==null)Je=t,De=e;else{if(e===null)throw pe.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?pe.memoizedState=Je=e:Je=Je.next=e}return Je}function Ci(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ss(e){var t=ls;return ls+=1,sl===null&&(sl=[]),e=Hd(sl,e,t),t=pe,(Je===null?t.memoizedState:Je.next)===null&&(t=t.alternate,B.H=t===null||t.memoizedState===null?Rh:rc),e}function qi(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ss(e);if(e.$$typeof===k)return rt(e)}throw Error(r(438,String(e)))}function Jo(e){var t=null,n=pe.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var s=pe.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=Ci(),pe.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]=te;return t.index++,n}function pn(e,t){return typeof t=="function"?t(e):t}function Mi(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,H=t,K=!1;do{var J=H.lane&-536870913;if(J!==H.lane?(be&J)===J:(mn&J)===J){var $=H.revertLane;if($===0)T!==null&&(T=T.next={lane:0,revertLane:0,gesture:null,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null}),J===Pa&&(K=!0);else if((mn&$)===$){H=H.next,$===Pa&&(K=!0);continue}else J={lane:0,revertLane:H.revertLane,gesture:null,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null},T===null?(v=T=J,g=u):T=T.next=J,pe.lanes|=$,Qn|=$;J=H.action,ja&&n(u,J),u=H.hasEagerState?H.eagerState:n(u,J)}else $={lane:J,revertLane:H.revertLane,gesture:H.gesture,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null},T===null?(v=T=$,g=u):T=T.next=$,pe.lanes|=J,Qn|=J;H=H.next}while(H!==null&&H!==t);if(T===null?g=u:T.next=v,!At(u,e.memoizedState)&&(Ie=!0,K&&(n=el,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 Id(e,t,n){var s=pe,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(eh.bind(null,s,c,e),[e]),c.getSnapshot!==t||g||Je!==null&&Je.memoizedState.tag&1){if(s.flags|=2048,il(9,{destroy:void 0},Pd.bind(null,s,c,n,t),null),ze===null)throw Error(r(349));u||(mn&127)!==0||Wd(s,t,n)}return n}function Wd(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=pe.updateQueue,t===null?(t=Ci(),pe.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Pd(e,t,n,s){t.value=n,t.getSnapshot=s,th(t)&&nh(e)}function eh(e,t,n){return n(function(){th(t)&&nh(e)})}function th(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!At(e,n)}catch{return!0}}function nh(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 ah(e,t,n,s){return e.baseState=n,Io(e,De,typeof s=="function"?s:pn)}function sy(e,t,n,s,c){if(ki(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)}};B.T!==null?n(!0):u.isTransition=!1,s(u),n=t.pending,n===null?(u.next=t.pending=u,lh(t,u)):(u.next=n.next,t.pending=n.next=u)}}function lh(e,t){var n=t.action,s=t.payload,c=e.state;if(t.isTransition){var u=B.T,g={};B.T=g;try{var v=n(c,s),T=B.S;T!==null&&T(g,v),sh(e,t,v)}catch(H){ec(e,t,H)}finally{u!==null&&g.types!==null&&(u.types=g.types),B.T=u}}else try{u=n(c,s),sh(e,t,u)}catch(H){ec(e,t,H)}}function sh(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(s){ih(e,t,s)},function(s){return ec(e,t,s)}):ih(e,t,n)}function ih(e,t,n){t.status="fulfilled",t.value=n,rh(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,lh(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,rh(t),t=t.next;while(t!==s)}e.action=null}function rh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function oh(e,t){return t}function ch(e,t){if(Ae){var n=ze.formState;if(n!==null){e:{var s=pe;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}}Bn(s)}s=!1}s&&(t=n[0])}}return n=ft(),n.memoizedState=n.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:oh,lastRenderedState:t},n.queue=s,n=qh.bind(null,pe,s),s.dispatch=n,s=Po(!1),u=ic.bind(null,pe,!1,s.queue),s=ft(),c={state:t,dispatch:null,action:e,pending:null},s.queue=c,n=sy.bind(null,pe,c,u,n),c.dispatch=n,s.memoizedState=e,[t,n,!1]}function uh(e){var t=Ze();return fh(t,De,e)}function fh(e,t,n){if(t=Io(e,t,oh)[0],e=Mi(pn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=ss(t)}catch(g){throw g===tl?vi:g}else s=t;t=Ze();var c=t.queue,u=c.dispatch;return n!==t.memoizedState&&(pe.flags|=2048,il(9,{destroy:void 0},iy.bind(null,c,n),null)),[s,u,e]}function iy(e,t){e.action=t}function dh(e){var t=Ze(),n=De;if(n!==null)return fh(t,n,e);Ze(),t=t.memoizedState,n=Ze();var s=n.queue.dispatch;return n.memoizedState=e,[t,s,!1]}function il(e,t,n,s){return e={tag:e,create:n,deps:s,inst:t,next:null},t=pe.updateQueue,t===null&&(t=Ci(),pe.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 hh(){return Ze().memoizedState}function Ti(e,t,n,s){var c=ft();pe.flags|=e,c.memoizedState=il(1|t,{destroy:void 0},n,s===void 0?null:s)}function Ri(e,t,n,s){var c=Ze();s=s===void 0?null:s;var u=c.memoizedState.inst;De!==null&&s!==null&&Qo(s,De.memoizedState.deps)?c.memoizedState=il(t,u,n,s):(pe.flags|=e,c.memoizedState=il(1|t,u,n,s))}function mh(e,t){Ti(8390656,8,e,t)}function tc(e,t){Ri(2048,8,e,t)}function ry(e){pe.flags|=4;var t=pe.updateQueue;if(t===null)t=Ci(),pe.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function ph(e){var t=Ze().memoizedState;return ry({ref:t,nextImpl:e}),function(){if((Te&2)!==0)throw Error(r(440));return t.impl.apply(void 0,arguments)}}function gh(e,t){return Ri(4,2,e,t)}function xh(e,t){return Ri(4,4,e,t)}function yh(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 vh(e,t,n){n=n!=null?n.concat([e]):null,Ri(4,4,yh.bind(null,t,e),n)}function nc(){}function bh(e,t){var n=Ze();t=t===void 0?null:t;var s=n.memoizedState;return t!==null&&Qo(t,s[1])?s[0]:(n.memoizedState=[e,t],e)}function Sh(e,t){var n=Ze();t=t===void 0?null:t;var s=n.memoizedState;if(t!==null&&Qo(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=Am(),pe.lanes|=e,Qn|=e,n)}function Ah(e,t,n,s){return At(n,t)?n:al.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=Am(),pe.lanes|=e,Qn|=e,t)}function jh(e,t,n,s,c){var u=P.p;P.p=u!==0&&8>u?u:8;var g=B.T,v={};B.T=v,ic(e,!1,t,n);try{var T=c(),H=B.S;if(H!==null&&H(v,T),T!==null&&typeof T=="object"&&typeof T.then=="function"){var K=ny(T,s);is(e,t,K,qt(e))}else is(e,t,s,qt(e))}catch(J){is(e,t,{then:function(){},status:"rejected",reason:J},qt())}finally{P.p=u,g!==null&&v.types!==null&&(g.types=v.types),B.T=g}}function oy(){}function lc(e,t,n,s){if(e.tag!==5)throw Error(r(476));var c=Nh(e).queue;jh(e,c,t,le,n===null?oy:function(){return wh(e),n(s)})}function Nh(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:le,baseState:le,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:pn,lastRenderedState:le},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 wh(e){var t=Nh(e);t.next===null&&(t=e.alternate.memoizedState),is(e,t.next.queue,{},qt())}function sc(){return rt(js)}function Eh(){return Ze().memoizedState}function Ch(){return Ze().memoizedState}function cy(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=qt();e=Un(n);var s=Hn(t,e,n);s!==null&&(bt(s,t,n),ts(s,t,n)),t={cache:Do()},e.payload=t;return}t=t.return}}function uy(e,t,n){var s=qt();n={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},ki(e)?Mh(t,n):(n=jo(e,t,n,s),n!==null&&(bt(n,e,s),Th(n,t,s)))}function qh(e,t,n){var s=qt();is(e,t,n,s)}function is(e,t,n,s){var c={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(ki(e))Mh(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 di(e,t,c,0),ze===null&&fi(),!1}catch{}finally{}if(n=jo(e,t,c,s),n!==null)return bt(n,e,s),Th(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},ki(e)){if(t)throw Error(r(479))}else t=jo(e,n,s,2),t!==null&&bt(t,e,2)}function ki(e){var t=e.alternate;return e===pe||t!==null&&t===pe}function Mh(e,t){ll=wi=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Th(e,t,n){if((n&4194048)!==0){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,Of(e,n)}}var rs={readContext:rt,use:qi,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};rs.useEffectEvent=Ge;var Rh={readContext:rt,use:qi,useCallback:function(e,t){return ft().memoizedState=[e,t===void 0?null:t],e},useContext:rt,useEffect:mh,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Ti(4194308,4,yh.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ti(4194308,4,e,t)},useInsertionEffect:function(e,t){Ti(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=uy.bind(null,pe,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=qh.bind(null,pe,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=jh.bind(null,pe,e.queue,!0,!1),ft().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var s=pe,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||Wd(s,t,n)}c.memoizedState=n;var u={value:n,getSnapshot:t};return c.queue=u,mh(eh.bind(null,s,u,e),[e]),s.flags|=2048,il(9,{destroy:void 0},Pd.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=Ei++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=ay++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:sc,useFormState:ch,useActionState:ch,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,pe,!0,n),n.dispatch=t,[e,t]},useMemoCache:Jo,useCacheRefresh:function(){return ft().memoizedState=cy.bind(null,pe)},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:qi,useCallback:bh,useContext:rt,useEffect:tc,useImperativeHandle:vh,useInsertionEffect:gh,useLayoutEffect:xh,useMemo:Sh,useReducer:Mi,useRef:hh,useState:function(){return Mi(pn)},useDebugValue:nc,useDeferredValue:function(e,t){var n=Ze();return Ah(n,De.memoizedState,e,t)},useTransition:function(){var e=Mi(pn)[0],t=Ze().memoizedState;return[typeof e=="boolean"?e:ss(e),t]},useSyncExternalStore:Id,useId:Eh,useHostTransitionStatus:sc,useFormState:uh,useActionState:uh,useOptimistic:function(e,t){var n=Ze();return ah(n,De,e,t)},useMemoCache:Jo,useCacheRefresh:Ch};rc.useEffectEvent=ph;var kh={readContext:rt,use:qi,useCallback:bh,useContext:rt,useEffect:tc,useImperativeHandle:vh,useInsertionEffect:gh,useLayoutEffect:xh,useMemo:Sh,useReducer:Wo,useRef:hh,useState:function(){return Wo(pn)},useDebugValue:nc,useDeferredValue:function(e,t){var n=Ze();return De===null?ac(n,e,t):Ah(n,De.memoizedState,e,t)},useTransition:function(){var e=Wo(pn)[0],t=Ze().memoizedState;return[typeof e=="boolean"?e:ss(e),t]},useSyncExternalStore:Id,useId:Eh,useHostTransitionStatus:sc,useFormState:dh,useActionState:dh,useOptimistic:function(e,t){var n=Ze();return De!==null?ah(n,De,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:Jo,useCacheRefresh:Ch};kh.useEffectEvent=ph;function oc(e,t,n,s){t=e.memoizedState,n=n(s,t),n=n==null?t:b({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var cc={enqueueSetState:function(e,t,n){e=e._reactInternals;var s=qt(),c=Un(s);c.payload=t,n!=null&&(c.callback=n),t=Hn(e,c,s),t!==null&&(bt(t,e,s),ts(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var s=qt(),c=Un(s);c.tag=1,c.payload=t,n!=null&&(c.callback=n),t=Hn(e,c,s),t!==null&&(bt(t,e,s),ts(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=qt(),s=Un(n);s.tag=2,t!=null&&(s.callback=t),t=Hn(e,s,n),t!==null&&(bt(t,e,n),ts(t,e,n))}};function _h(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?!Kl(n,s)||!Kl(c,u):!0}function Dh(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=b({},n));for(var c in e)n[c]===void 0&&(n[c]=e[c])}return n}function Oh(e){ui(e)}function Bh(e){console.error(e)}function zh(e){ui(e)}function _i(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function Lh(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=Un(n),n.tag=3,n.payload={element:null},n.callback=function(){_i(e,t)},n}function Uh(e){return e=Un(e),e.tag=3,e}function Hh(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(){Lh(t,n,s)}}var g=n.stateNode;g!==null&&typeof g.componentDidCatch=="function"&&(e.callback=function(){Lh(t,n,s),typeof c!="function"&&(Xn===null?Xn=new Set([this]):Xn.add(this));var v=s.stack;this.componentDidCatch(s.value,{componentStack:v!==null?v:""})})}function fy(e,t,n,s,c){if(n.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=n.alternate,t!==null&&Wa(t,n,c,!0),n=Nt.current,n!==null){switch(n.tag){case 31:case 13:return Lt===null?Qi():n.alternate===null&&Qe===0&&(Qe=3),n.flags&=-257,n.flags|=65536,n.lanes=c,s===bi?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===bi?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),Qi(),!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}),Jl(Dt(e,n)))):(s!==Mo&&(t=Error(r(423),{cause:s}),Jl(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),Qe!==4&&(Qe=2)),!1;var u=Error(r(520),{cause:s});if(u=Dt(u,n),ps===null?ps=[u]:ps.push(u),Qe!==4&&(Qe=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"&&(Xn===null||!Xn.has(u))))return n.flags|=65536,c&=-c,n.lanes|=c,c=Uh(c),Hh(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?Gd(t,null,n,s):Aa(t,e.child,n,s)}function Vh(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=Xo(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 Yh(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,$h(e,t,u,s,c)):(e=mi(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:Kl,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 $h(e,t,n,s,c){if(e!==null){var u=e.memoizedProps;if(Kl(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 Gh(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 Qh(e,t,u,n,s)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&yi(t,u!==null?u.cachePool:null),u!==null?Kd(t,u):Yo(),Zd(t);else return s=t.lanes=536870912,Qh(e,t,u!==null?u.baseLanes|n:n,n,s)}else u!==null?(yi(t,u.cachePool),Kd(t,u),Yn(),t.memoizedState=null):(e!==null&&yi(t,null),Yo(),Yn());return ot(e,t,c,n),t.child}function os(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Qh(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&&yi(t,null),Yo(),Zd(t),e!==null&&Wa(e,t,s,!0),t.childLanes=c,null}function Di(e,t){return t=Bi({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Xh(e,t,n){return Aa(t,e.child,null,n),e=Di(t,t.pendingProps),e.flags|=2,wt(t),t.memoizedState=null,e}function dy(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=Di(t,s),t.lanes=536870912,os(null,e);if(Go(t),(e=He)?(e=lp(e,zt),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Dn!==null?{id:Jt,overflow:It}:null,retryLane:536870912,hydrationErrors:null},n=Md(e),n.return=t,t.child=n,it=t,He=null)):e=null,e===null)throw Bn(t);return t.lanes=536870912,null}return Di(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=Xh(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||Wa(e,t,n,!1),c=(n&e.childLanes)!==0,Ie||c){if(s=ze,s!==null&&(g=Bf(s,n),g!==0&&g!==u.retryLane))throw u.retryLane=g,ma(e,g),bt(s,e,g),fc;Qi(),t=Xh(e,t,n)}else e=u.treeContext,He=Ut(g.nextSibling),it=t,Ae=!0,On=null,zt=!1,e!==null&&kd(t,e),t=Di(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 Oi(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=Xo(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 Kh(e,t,n,s,c,u){return ya(t),t.updateQueue=null,n=Jd(t,s,n,c),Fd(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 Zh(e,t,n,s,c){if(ya(t),t.stateNode===null){var u=Za,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):Za,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),as(t,s,u,c),ns(),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 H=u.context,K=n.contextType;g=Za,typeof K=="object"&&K!==null&&(g=rt(K));var J=n.getDerivedStateFromProps;K=typeof J=="function"||typeof u.getSnapshotBeforeUpdate=="function",v=t.pendingProps!==v,K||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(v||H!==g)&&Dh(t,u,s,g),Ln=!1;var $=t.memoizedState;u.state=$,as(t,s,u,c),ns(),H=t.memoizedState,v||$!==H||Ln?(typeof J=="function"&&(oc(t,n,J,s),H=t.memoizedState),(T=Ln||_h(t,n,T,s,$,H,g))?(K||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(t.flags|=4194308)):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=H),u.props=s,u.state=H,u.context=g,s=T):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{u=t.stateNode,Uo(e,t),g=t.memoizedProps,K=Na(n,g),u.props=K,J=t.pendingProps,$=u.context,H=n.contextType,T=Za,typeof H=="object"&&H!==null&&(T=rt(H)),v=n.getDerivedStateFromProps,(H=typeof v=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(g!==J||$!==T)&&Dh(t,u,s,T),Ln=!1,$=t.memoizedState,u.state=$,as(t,s,u,c),ns();var Q=t.memoizedState;g!==J||$!==Q||Ln||e!==null&&e.dependencies!==null&&gi(e.dependencies)?(typeof v=="function"&&(oc(t,n,v,s),Q=t.memoizedState),(K=Ln||_h(t,n,K,s,$,Q,T)||e!==null&&e.dependencies!==null&&gi(e.dependencies))?(H||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(s,Q,T),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(s,Q,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=Q),u.props=s,u.state=Q,u.context=T,s=K):(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,Oi(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 Fh(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:Ld()}}function pc(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Ct),e}function Jh(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?Vn(t):Yn(),(e=He)?(e=lp(e,zt),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Dn!==null?{id:Jt,overflow:It}:null,retryLane:536870912,hydrationErrors:null},n=Md(e),n.return=t,t.child=n,it=t,He=null)):e=null,e===null)throw Bn(t);return Ic(e)?t.lanes=32:t.lanes=536870912,null}var v=s.children;return s=s.fallback,c?(Yn(),c=t.mode,v=Bi({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,os(null,s)):(Vn(t),gc(t,v))}var T=e.memoizedState;if(T!==null&&(v=T.dehydrated,v!==null)){if(u)t.flags&256?(Vn(t),t.flags&=-257,t=xc(e,t,n)):t.memoizedState!==null?(Yn(),t.child=e.child,t.flags|=128,t=null):(Yn(),v=s.fallback,c=t.mode,s=Bi({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=os(null,s));else if(Vn(t),Ic(v)){if(g=v.nextSibling&&v.nextSibling.dataset,g)var H=g.dgst;g=H,s=Error(r(419)),s.stack="",s.digest=g,Jl({value:s,source:null,stack:null}),t=xc(e,t,n)}else if(Ie||Wa(e,t,n,!1),g=(n&e.childLanes)!==0,Ie||g){if(g=ze,g!==null&&(s=Bf(g,n),s!==0&&s!==T.retryLane))throw T.retryLane=s,ma(e,s),bt(g,e,s),fc;Jc(v)||Qi(),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,On=null,zt=!1,e!==null&&kd(t,e),t=gc(t,s.children),t.flags|=4096);return t}return c?(Yn(),v=s.fallback,c=t.mode,T=e.child,H=T.sibling,s=un(T,{mode:"hidden",children:s.children}),s.subtreeFlags=T.subtreeFlags&65011712,H!==null?v=un(H,v):(v=pa(v,c,n,null),v.flags|=2),v.return=t,s.return=t,s.sibling=v,t.child=s,os(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=Ld(),v={baseLanes:v.baseLanes|n,cachePool:c}),s.memoizedState=v,s.childLanes=pc(e,g,n),t.memoizedState=hc,os(e.child,s)):(Vn(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=Bi({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Bi(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 Ih(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 Wh(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,_(Ke,g),ot(e,t,s,n),s=Ae?Fl:0,!v&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Ih(e,n,t);else if(e.tag===19)Ih(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(c){case"forwards":for(n=t.child,c=null;n!==null;)e=n.alternate,e!==null&&Ni(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&&Ni(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(Wa(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&&gi(e)))}function hy(e,t,n){switch(t.tag){case 3:we(t,t.stateNode.containerInfo),zn(t,Fe,e.memoizedState.cache),ga();break;case 27:case 5:St(t);break;case 4:we(t,t.stateNode.containerInfo);break;case 10:zn(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?(Vn(t),t.flags|=128,null):(n&t.child.childLanes)!==0?Jh(e,t,n):(Vn(t),e=gn(e,t,n),e!==null?e.sibling:null);Vn(t);break;case 19:var c=(e.flags&128)!==0;if(s=(n&t.childLanes)!==0,s||(Wa(e,t,n,!1),s=(n&t.childLanes)!==0),c){if(s)return Wh(e,t,n);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),_(Ke,Ke.current),s)break;return null;case 22:return t.lanes=0,Gh(e,t,n,t.pendingProps);case 24:zn(t,Fe,e.memoizedState.cache)}return gn(e,t,n)}function Ph(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,hy(e,t,n);Ie=(e.flags&131072)!==0}else Ie=!1,Ae&&(t.flags&1048576)!==0&&Rd(t,Fl,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=Zh(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===X){t.tag=11,t=Vh(null,t,e,s,n);break e}else if(c===z){t.tag=14,t=Yh(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),Zh(e,t,s,c,n);case 3:e:{if(we(t,t.stateNode.containerInfo),e===null)throw Error(r(387));s=t.pendingProps;var u=t.memoizedState;c=u.element,Uo(e,t),as(t,s,null,n);var g=t.memoizedState;if(s=g.cache,zn(t,Fe,s),s!==u.cache&&_o(t,[Fe],n,!0),ns(),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=Fh(e,t,s,n);break e}else if(s!==c){c=Dt(Error(r(424)),t),Jl(c),t=Fh(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,On=null,zt=!0,n=Gd(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 Oi(e,t),e===null?(n=up(t.type,null,t.pendingProps,null))?t.memoizedState=n:Ae||(n=t.type,e=t.pendingProps,s=Wi(ne.current).createElement(n),s[st]=t,s[mt]=e,ct(s,n,e),at(s),t.stateNode=s):t.memoizedState=up(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return St(t),e===null&&Ae&&(s=t.stateNode=rp(t.type,t.pendingProps,ne.current),it=t,zt=!0,c=He,Jn(t.type)?(Wc=c,He=Ut(s.firstChild)):He=c),ot(e,t,t.pendingProps.children,n),Oi(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ae&&((c=s=He)&&(s=$y(s,t.type,t.pendingProps,zt),s!==null?(t.stateNode=s,it=t,He=Ut(s.firstChild),zt=!1,c=!0):c=!1),c||Bn(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=Xo(e,t,ly,null,null,n),js._currentValue=c),Oi(e,t),ot(e,t,s,n),t.child;case 6:return e===null&&Ae&&((e=n=He)&&(n=Gy(n,t.pendingProps,zt),n!==null?(t.stateNode=n,it=t,He=null,e=!0):e=!1),e||Bn(t)),null;case 13:return Jh(e,t,n);case 4:return we(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 Vh(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,zn(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 Yh(e,t,t.type,t.pendingProps,n);case 15:return $h(e,t,t.type,t.pendingProps,n);case 19:return Wh(e,t,n);case 31:return dy(e,t,n);case 22:return Gh(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),zn(t,Fe,c)):((e.lanes&n)!==0&&(Uo(e,t),as(t,null,null,n),ns()),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),zn(t,Fe,s)):(s=u.cache,zn(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(Em())e.flags|=8192;else throw Sa=bi,zo}else e.flags&=-16777217}function em(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!pp(t))if(Em())e.flags|=8192;else throw Sa=bi,zo}function zi(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?_f():536870912,e.lanes|=t,ul|=t)}function cs(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 my(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),xe(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Ia(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),em(t,u)):(Ve(t),bc(t,c,null,s,n))):u?u!==e.memoizedState?(xn(t),Ve(t),em(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(Ra(t),n=ne.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=V.current,Ia(t)?_d(t):(e=rp(c,s,n),t.stateNode=e,xn(t))}return Ve(t),null;case 5:if(Ra(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=V.current,Ia(t))_d(t);else{var g=Wi(ne.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=ne.current,Ia(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||Jm(e.nodeValue,n)),e||Bn(t,!0)}else e=Wi(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=Ia(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=Ia(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),zi(t,t.updateQueue),Ve(t),null);case 4:return xe(),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)cs(s,!1);else{if(Qe!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=Ni(e),u!==null){for(t.flags|=128,cs(s,!1),e=u.updateQueue,t.updateQueue=e,zi(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)qd(n,e),n=n.sibling;return _(Ke,Ke.current&1|2),Ae&&fn(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&tt()>Yi&&(t.flags|=128,c=!0,cs(s,!1),t.lanes=4194304)}else{if(!c)if(e=Ni(u),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,zi(t,e),cs(s,!0),s.tail===null&&s.tailMode==="hidden"&&!u.alternate&&!Ae)return Ve(t),null}else 2*tt()-s.renderingStartTime>Yi&&n!==536870912&&(t.flags|=128,c=!0,cs(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,_(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&&zi(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 py(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),xe(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ra(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 xe(),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 tm(e,t){switch(qo(t),t.tag){case 3:hn(Fe),xe();break;case 26:case 27:case 5:Ra(t);break;case 4:xe();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 us(e,t){try{var n=t.updateQueue,s=n!==null?n.lastEffect:null;if(s!==null){var c=s.next;n=c;do{if((n.tag&e)===e){s=void 0;var u=n.create,g=n.inst;s=u(),g.destroy=s}n=n.next}while(n!==c)}}catch(v){ke(t,t.return,v)}}function $n(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,H=v;try{H()}catch(K){ke(c,T,K)}}}s=s.next}while(s!==u)}}catch(K){ke(t,t.return,K)}}function nm(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Xd(t,n)}catch(s){ke(e,e.return,s)}}}function am(e,t,n){n.props=Na(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(s){ke(e,t,s)}}function fs(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 lm(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;zy(s,e.type,n,t),s[mt]=t}catch(c){ke(e,e.return,c)}}function sm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Jn(e.type)||e.tag===4}function Ac(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||sm(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&&Jn(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&&Jn(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 Li(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&&Jn(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Li(e,t,n),e=e.sibling;e!==null;)Li(e,t,n),e=e.sibling}function im(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,rm=typeof WeakSet=="function"?WeakSet:Set,lt=null;function gy(e,t){if(e=e.containerInfo,Qc=sr,e=vd(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,H=0,K=0,J=e,$=null;t:for(;;){for(var Q;J!==n||c!==0&&J.nodeType!==3||(v=g+c),J!==u||s!==0&&J.nodeType!==3||(T=g+s),J.nodeType===3&&(g+=J.nodeValue.length),(Q=J.firstChild)!==null;)$=J,J=Q;for(;;){if(J===e)break t;if($===n&&++H===c&&(v=g),$===u&&++K===s&&(T=g),(Q=J.nextSibling)!==null)break;J=$,$=J.parentNode}J=Q}n=v===-1||T===-1?null:{start:v,end:T}}else n=null}n=n||{start:0,end:0}}else n=null;for(Xc={focusedElem:e,selectionRange:n},sr=!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 ie=Na(n.type,c);e=s.getSnapshotBeforeUpdate(ie,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 om(e,t,n){var s=n.flags;switch(n.tag){case 0:case 11:case 15:bn(e,n),s&4&&us(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&&nm(n),s&512&&fs(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{Xd(e,t)}catch(g){ke(n,n.return,g)}}break;case 27:t===null&&s&4&&im(n);case 26:case 5:bn(e,n),t===null&&s&4&&lm(n),s&512&&fs(n,n.return);break;case 12:bn(e,n);break;case 31:bn(e,n),s&4&&fm(e,n);break;case 13:bn(e,n),s&4&&dm(e,n),s&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=wy.bind(null,n),Qy(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 cm(e){var t=e.alternate;t!==null&&(e.alternate=null,cm(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;)um(e,t,n),n=n.sibling}function um(e,t,n){if(Le&&typeof Le.onCommitFiberUnmount=="function")try{Le.onCommitFiberUnmount(Xe,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;Jn(n.type)&&(Ye=n.stateNode,gt=!1),vn(e,t,n),bs(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,np(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),yl(e)):np(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:$n(2,n,t),We||$n(4,n,t),vn(e,t,n);break;case 1:We||(Wt(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"&&am(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 fm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{yl(e)}catch(n){ke(t,t.return,n)}}}function dm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{yl(e)}catch(n){ke(t,t.return,n)}}function xy(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new rm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new rm),t;default:throw Error(r(435,e.tag))}}function Ui(e,t){var n=xy(e);t.forEach(function(s){if(!n.has(s)){n.add(s);var c=Ey.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(Jn(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));um(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;)hm(t,e),t=t.sibling}var Gt=null;function hm(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&&($n(3,e,e.return),us(3,e),$n(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[Ll]||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=hp("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=hp("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 mp(c,e.type,e.stateNode);else e.stateNode=dp(c,s,e.memoizedProps);else u!==s?(u===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):u.count--,s===null?mp(c,e.type,e.stateNode):dp(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{Va(c,"")}catch(ie){ke(e,e.return,ie)}}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(ie){ke(e,e.return,ie)}}break;case 3:if(tr=null,c=Gt,Gt=Pi(t.containerInfo),xt(t,e),Gt=c,yt(e),s&4&&n!==null&&n.memoizedState.isDehydrated)try{yl(t.containerInfo)}catch(ie){ke(e,e.return,ie)}Nc&&(Nc=!1,mm(e));break;case 4:s=Gt,Gt=Pi(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,Ui(e,s)));break;case 13:xt(t,e),yt(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Vi=tt()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Ui(e,s)));break;case 22:c=e.memoizedState!==null;var T=n!==null&&n.memoizedState!==null,H=yn,K=We;if(yn=H||c,We=K||T,xt(t,e),We=K,yn=H,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 J=T.memoizedProps.style,$=J!=null&&J.hasOwnProperty("display")?J.display:null;v.style.display=$==null||typeof $=="boolean"?"":(""+$).trim()}}catch(ie){ke(T,T.return,ie)}}}else if(t.tag===6){if(n===null){T=t;try{T.stateNode.nodeValue=c?"":T.memoizedProps}catch(ie){ke(T,T.return,ie)}}}else if(t.tag===18){if(n===null){T=t;try{var Q=T.stateNode;c?ap(Q,!0):ap(T.stateNode,!1)}catch(ie){ke(T,T.return,ie)}}}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,Ui(e,n))));break;case 19:xt(t,e),yt(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Ui(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(sm(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);Li(e,u,c);break;case 5:var g=n.stateNode;n.flags&32&&(Va(g,""),n.flags&=-33);var v=Ac(e);Li(e,v,g);break;case 3:case 4:var T=n.stateNode.containerInfo,H=Ac(e);jc(e,H,T);break;default:throw Error(r(161))}}catch(K){ke(e,e.return,K)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function mm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;mm(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;)om(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:$n(4,t,t.return),wa(t);break;case 1:Wt(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&am(t,t.return,n),wa(t);break;case 27:bs(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),us(4,u);break;case 1:if(Sn(c,u,n),s=u,c=s.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(H){ke(s,s.return,H)}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++)Qd(T[c],v)}catch(H){ke(s,s.return,H)}}n&&g&64&&nm(u),fs(u,u.return);break;case 27:im(u);case 26:case 5:Sn(c,u,n),n&&s===null&&g&4&&lm(u),fs(u,u.return);break;case 12:Sn(c,u,n);break;case 31:Sn(c,u,n),n&&g&4&&fm(c,u);break;case 13:Sn(c,u,n),n&&g&4&&dm(c,u);break;case 22:u.memoizedState===null&&Sn(c,u,n),fs(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&&Il(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&&Il(e))}function Qt(e,t,n,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)pm(e,t,n,s),t=t.sibling}function pm(e,t,n,s){var c=t.flags;switch(t.tag){case 0:case 11:case 15:Qt(e,t,n,s),c&2048&&us(9,t);break;case 1:Qt(e,t,n,s);break;case 3:Qt(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&&Il(e)));break;case 12:if(c&2048){Qt(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 Qt(e,t,n,s);break;case 31:Qt(e,t,n,s);break;case 13:Qt(e,t,n,s);break;case 23:break;case 22:u=t.stateNode,g=t.alternate,t.memoizedState!==null?u._visibility&2?Qt(e,t,n,s):ds(e,t):u._visibility&2?Qt(e,t,n,s):(u._visibility|=2,rl(e,t,n,s,(t.subtreeFlags&10256)!==0||!1)),c&2048&&wc(g,t);break;case 24:Qt(e,t,n,s),c&2048&&Ec(t.alternate,t);break;default:Qt(e,t,n,s)}}function rl(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,H=g.flags;switch(g.tag){case 0:case 11:case 15:rl(u,g,v,T,c),us(8,g);break;case 23:break;case 22:var K=g.stateNode;g.memoizedState!==null?K._visibility&2?rl(u,g,v,T,c):ds(u,g):(K._visibility|=2,rl(u,g,v,T,c)),c&&H&2048&&wc(g.alternate,g);break;case 24:rl(u,g,v,T,c),c&&H&2048&&Ec(g.alternate,g);break;default:rl(u,g,v,T,c)}t=t.sibling}}function ds(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:ds(n,s),c&2048&&wc(s.alternate,s);break;case 24:ds(n,s),c&2048&&Ec(s.alternate,s);break;default:ds(n,s)}t=t.sibling}}var hs=8192;function ol(e,t,n){if(e.subtreeFlags&hs)for(e=e.child;e!==null;)gm(e,t,n),e=e.sibling}function gm(e,t,n){switch(e.tag){case 26:ol(e,t,n),e.flags&hs&&e.memoizedState!==null&&av(n,Gt,e.memoizedState,e.memoizedProps);break;case 5:ol(e,t,n);break;case 3:case 4:var s=Gt;Gt=Pi(e.stateNode.containerInfo),ol(e,t,n),Gt=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=hs,hs=16777216,ol(e,t,n),hs=s):ol(e,t,n));break;default:ol(e,t,n)}}function xm(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 ms(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,vm(s,e)}xm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)ym(e),e=e.sibling}function ym(e){switch(e.tag){case 0:case 11:case 15:ms(e),e.flags&2048&&$n(9,e,e.return);break;case 3:ms(e);break;case 12:ms(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Hi(e)):ms(e);break;default:ms(e)}}function Hi(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,vm(s,e)}xm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:$n(8,t,t.return),Hi(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Hi(t));break;default:Hi(t)}e=e.sibling}}function vm(e,t){for(;lt!==null;){var n=lt;switch(n.tag){case 0:case 11:case 15:$n(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:Il(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(cm(s),s===n){lt=null;break e}if(c!==null){c.return=u,lt=c;break e}lt=u}}}var yy={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}},vy=typeof WeakMap=="function"?WeakMap:Map,Te=0,ze=null,ye=null,be=0,Re=0,Et=null,Gn=!1,cl=!1,Cc=!1,An=0,Qe=0,Qn=0,Ea=0,qc=0,Ct=0,ul=0,ps=null,vt=null,Mc=!1,Vi=0,bm=0,Yi=1/0,$i=null,Xn=null,nt=0,Kn=null,fl=null,jn=0,Tc=0,Rc=null,Sm=null,gs=0,kc=null;function qt(){return(Te&2)!==0&&be!==0?be&-be:B.T!==null?Lc():zf()}function Am(){if(Ct===0)if((be&536870912)===0||Ae){var e=Is;Is<<=1,(Is&3932160)===0&&(Is=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)&&(dl(e,0),Zn(e,be,Ct,!1)),zl(e,n),((Te&2)===0||e!==ze)&&(e===ze&&((Te&2)===0&&(Ea|=n),Qe===4&&Zn(e,be,Ct,!1)),Pt(e))}function jm(e,t,n){if((Te&6)!==0)throw Error(r(327));var s=!n&&(t&127)===0&&(t&e.expiredLanes)===0||Bl(e,t),c=s?Ay(e,t):Dc(e,t,!0),u=s;do{if(c===0){cl&&!s&&Zn(e,t,0,!1);break}else{if(n=e.current.alternate,u&&!by(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=ps;var T=v.current.memoizedState.isDehydrated;if(T&&(dl(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){dl(e,0),Zn(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:Zn(s,t,Ct,!Gn);break e;case 2:vt=null;break;case 3:case 5:break;default:throw Error(r(329))}if((t&62914560)===t&&(c=Vi+300-tt(),10<c)){if(Zn(s,t,Ct,!Gn),Ps(s,0,!0)!==0)break e;jn=t,s.timeoutHandle=ep(Nm.bind(null,s,n,vt,$i,Mc,t,Ct,Ea,ul,Gn,u,"Throttled",-0,0),c);break e}Nm(s,n,vt,$i,Mc,t,Ct,Ea,ul,Gn,u,null,-0,0)}}break}while(!0);Pt(e)}function Nm(e,t,n,s,c,u,g,v,T,H,K,J,$,Q){if(e.timeoutHandle=-1,J=t.subtreeFlags,J&8192||(J&16785408)===16785408){J={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:on},gm(t,u,J);var ie=(u&62914560)===u?Vi-tt():(u&4194048)===u?bm-tt():0;if(ie=lv(J,ie),ie!==null){jn=u,e.cancelPendingCommit=ie(km.bind(null,e,t,u,n,s,c,g,v,T,K,J,null,$,Q)),Zn(e,u,g,!H);return}}km(e,t,u,n,s,c,g,v,T)}function by(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 Zn(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&&Df(e,n,t)}function Gi(){return(Te&6)===0?(xs(0),!1):!0}function _c(){if(ye!==null){if(Re===0)var e=ye.return;else e=ye,dn=xa=null,Fo(e),nl=null,Pl=0,e=ye;for(;e!==null;)tm(e.alternate,e),e=e.return;ye=null}}function dl(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Hy(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,Gn=!1,cl=Bl(e,t),Cc=!1,ul=Ct=qc=Ea=Qn=Qe=0,vt=ps=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,fi(),n}function wm(e,t){pe=null,B.H=rs,t===tl||t===vi?(t=Vd(),Re=3):t===zo?(t=Vd(),Re=4):Re=t===fc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Et=t,ye===null&&(Qe=1,_i(e,Dt(t,e.current)))}function Em(){var e=Nt.current;return e===null?!0:(be&4194048)===be?Lt===null:(be&62914560)===be||(be&536870912)!==0?e===Lt:!1}function Cm(){var e=B.H;return B.H=rs,e===null?rs:e}function qm(){var e=B.A;return B.A=yy,e}function Qi(){Qe=4,Gn||(be&4194048)!==be&&Nt.current!==null||(cl=!0),(Qn&134217727)===0&&(Ea&134217727)===0||ze===null||Zn(ze,be,Ct,!1)}function Dc(e,t,n){var s=Te;Te|=2;var c=Cm(),u=qm();(ze!==e||be!==t)&&($i=null,dl(e,t)),t=!1;var g=Qe;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 H=Re;if(Re=0,Et=null,hl(e,v,T,H),n&&cl){g=0;break e}break;default:H=Re,Re=0,Et=null,hl(e,v,T,H)}}Sy(),g=Qe;break}catch(K){wm(e,K)}while(!0);return t&&e.shellSuspendCounter++,dn=xa=null,Te=s,B.H=c,B.A=u,ye===null&&(ze=null,be=0,fi()),g}function Sy(){for(;ye!==null;)Mm(ye)}function Ay(e,t){var n=Te;Te|=2;var s=Cm(),c=qm();ze!==e||be!==t?($i=null,Yi=tt()+500,dl(e,t)):cl=Bl(e,t);e:do try{if(Re!==0&&ye!==null){t=ye;var u=Et;t:switch(Re){case 1:Re=0,Et=null,hl(e,t,u,1);break;case 2:case 9:if(Ud(u)){Re=0,Et=null,Tm(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:Ud(u)?(Re=0,Et=null,Tm(t)):(Re=0,Et=null,hl(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?pp(g):v.stateNode.complete){Re=0,Et=null;var T=v.sibling;if(T!==null)ye=T;else{var H=v.return;H!==null?(ye=H,Xi(H)):ye=null}break t}}Re=0,Et=null,hl(e,t,u,5);break;case 6:Re=0,Et=null,hl(e,t,u,6);break;case 8:_c(),Qe=6;break e;default:throw Error(r(462))}}jy();break}catch(K){wm(e,K)}while(!0);return dn=xa=null,B.H=s,B.A=c,Te=n,ye!==null?0:(ze=null,be=0,fi(),Qe)}function jy(){for(;ye!==null&&!_a();)Mm(ye)}function Mm(e){var t=Ph(e.alternate,e,An);e.memoizedProps=e.pendingProps,t===null?Xi(e):ye=t}function Tm(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Kh(n,t,t.pendingProps,t.type,void 0,be);break;case 11:t=Kh(n,t,t.pendingProps,t.type.render,t.ref,be);break;case 5:Fo(t);default:tm(n,t),t=ye=qd(t,An),t=Ph(n,t,An)}e.memoizedProps=e.pendingProps,t===null?Xi(e):ye=t}function hl(e,t,n,s){dn=xa=null,Fo(t),nl=null,Pl=0;var c=t.return;try{if(fy(e,c,t,n,be)){Qe=1,_i(e,Dt(n,e.current)),ye=null;return}}catch(u){if(c!==null)throw ye=c,u;Qe=1,_i(e,Dt(n,e.current)),ye=null;return}t.flags&32768?(Ae||s===1?e=!0:cl||(be&536870912)!==0?e=!1:(Gn=e=!0,(s===2||s===9||s===3||s===6)&&(s=Nt.current,s!==null&&s.tag===13&&(s.flags|=16384))),Rm(t,e)):Xi(t)}function Xi(e){var t=e;do{if((t.flags&32768)!==0){Rm(t,Gn);return}e=t.return;var n=my(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);Qe===0&&(Qe=5)}function Rm(e,t){do{var n=py(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);Qe=6,ye=null}function km(e,t,n,s,c,u,g,v,T){e.cancelPendingCommit=null;do Ki();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,nx(e,n,u,g,v,T),e===ze&&(ye=ze=null,be=0),fl=t,Kn=e,jn=n,Tc=u,Rc=c,Sm=s,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Cy(Da,function(){return zm(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||s){s=B.T,B.T=null,c=P.p,P.p=2,g=Te,Te|=4;try{gy(e,t,n)}finally{Te=g,P.p=c,B.T=s}}nt=1,_m(),Dm(),Om()}}function _m(){if(nt===1){nt=0;var e=Kn,t=fl,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=B.T,B.T=null;var s=P.p;P.p=2;var c=Te;Te|=4;try{hm(t,e);var u=Xc,g=vd(e.containerInfo),v=u.focusedElem,T=u.selectionRange;if(g!==v&&v&&v.ownerDocument&&yd(v.ownerDocument.documentElement,v)){if(T!==null&&xo(v)){var H=T.start,K=T.end;if(K===void 0&&(K=H),"selectionStart"in v)v.selectionStart=H,v.selectionEnd=Math.min(K,v.value.length);else{var J=v.ownerDocument||document,$=J&&J.defaultView||window;if($.getSelection){var Q=$.getSelection(),ie=v.textContent.length,de=Math.min(T.start,ie),Be=T.end===void 0?de:Math.min(T.end,ie);!Q.extend&&de>Be&&(g=Be,Be=de,de=g);var D=xd(v,de),R=xd(v,Be);if(D&&R&&(Q.rangeCount!==1||Q.anchorNode!==D.node||Q.anchorOffset!==D.offset||Q.focusNode!==R.node||Q.focusOffset!==R.offset)){var L=J.createRange();L.setStart(D.node,D.offset),Q.removeAllRanges(),de>Be?(Q.addRange(L),Q.extend(R.node,R.offset)):(L.setEnd(R.node,R.offset),Q.addRange(L))}}}}for(J=[],Q=v;Q=Q.parentNode;)Q.nodeType===1&&J.push({element:Q,left:Q.scrollLeft,top:Q.scrollTop});for(typeof v.focus=="function"&&v.focus(),v=0;v<J.length;v++){var F=J[v];F.element.scrollLeft=F.left,F.element.scrollTop=F.top}}sr=!!Qc,Xc=Qc=null}finally{Te=c,P.p=s,B.T=n}}e.current=t,nt=2}}function Dm(){if(nt===2){nt=0;var e=Kn,t=fl,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=B.T,B.T=null;var s=P.p;P.p=2;var c=Te;Te|=4;try{om(e,t.alternate,t)}finally{Te=c,P.p=s,B.T=n}}nt=3}}function Om(){if(nt===4||nt===3){nt=0,_l();var e=Kn,t=fl,n=jn,s=Sm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?nt=5:(nt=0,fl=Kn=null,Bm(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(Xn=null),Ir(n),t=t.stateNode,Le&&typeof Le.onCommitFiberRoot=="function")try{Le.onCommitFiberRoot(Xe,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=B.T,c=P.p,P.p=2,B.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{B.T=t,P.p=c}}(jn&3)!==0&&Ki(),Pt(e),c=e.pendingLanes,(n&261930)!==0&&(c&42)!==0?e===kc?gs++:(gs=0,kc=e):gs=0,xs(0)}}function Bm(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Il(t)))}function Ki(){return _m(),Dm(),Om(),zm()}function zm(){if(nt!==5)return!1;var e=Kn,t=Tc;Tc=0;var n=Ir(jn),s=B.T,c=P.p;try{P.p=32>n?32:n,B.T=null,n=Rc,Rc=null;var u=Kn,g=jn;if(nt=0,fl=Kn=null,jn=0,(Te&6)!==0)throw Error(r(331));var v=Te;if(Te|=4,ym(u.current),pm(u,u.current,g,n),Te=v,xs(0,!1),Le&&typeof Le.onPostCommitFiberRoot=="function")try{Le.onPostCommitFiberRoot(Xe,u)}catch{}return!0}finally{P.p=c,B.T=s,Bm(e,t)}}function Lm(e,t,n){t=Dt(n,t),t=uc(e.stateNode,t,2),e=Hn(e,t,2),e!==null&&(zl(e,2),Pt(e))}function ke(e,t,n){if(e.tag===3)Lm(e,e,n);else for(;t!==null;){if(t.tag===3){Lm(t,e,n);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Xn===null||!Xn.has(s))){e=Dt(n,e),n=Uh(2),s=Hn(t,n,2),s!==null&&(Hh(n,s,t,e),zl(s,2),Pt(s));break}}t=t.return}}function Oc(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new vy;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=Ny.bind(null,e,t,n),t.then(e,e))}function Ny(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&&(Qe===4||Qe===3&&(be&62914560)===be&&300>tt()-Vi?(Te&2)===0&&dl(e,0):qc|=n,ul===be&&(ul=0)),Pt(e)}function Um(e,t){t===0&&(t=_f()),e=ma(e,t),e!==null&&(zl(e,t),Pt(e))}function wy(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Um(e,n)}function Ey(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),Um(e,n)}function Cy(e,t){return ra(e,t)}var Zi=null,ml=null,Bc=!1,Fi=!1,zc=!1,Fn=0;function Pt(e){e!==ml&&e.next===null&&(ml===null?Zi=ml=e:ml=ml.next=e),Fi=!0,Bc||(Bc=!0,My())}function xs(e,t){if(!zc&&Fi){zc=!0;do for(var n=!1,s=Zi;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,$m(s,u))}else u=be,u=Ps(s,s===ze?u:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(u&3)===0||Bl(s,u)||(n=!0,$m(s,u));s=s.next}while(n);zc=!1}}function qy(){Hm()}function Hm(){Fi=Bc=!1;var e=0;Fn!==0&&Uy()&&(e=Fn);for(var t=tt(),n=null,s=Zi;s!==null;){var c=s.next,u=Vm(s,t);u===0?(s.next=null,n===null?Zi=c:n.next=c,c===null&&(ml=n)):(n=s,(e!==0||(u&3)!==0)&&(Fi=!0)),s=c}nt!==0&&nt!==5||xs(e),Fn!==0&&(Fn=0)}function Vm(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]=tx(v,t)):T<=t&&(e.expiredLanes|=v),u&=~v}if(t=ze,n=be,n=Ps(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||Bl(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(s!==null&&sn(s),Ir(n)){case 2:case 8:n=Ol;break;case 32:n=Da;break;case 268435456:n=Zs;break;default:n=Da}return s=Ym.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 Ym(e,t){if(nt!==0&&nt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Ki()&&e.callbackNode!==n)return null;var s=be;return s=Ps(e,e===ze?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(jm(e,s,t),Vm(e,tt()),e.callbackNode!=null&&e.callbackNode===n?Ym.bind(null,e):null)}function $m(e,t){if(Ki())return null;jm(e,t,!0)}function My(){Vy(function(){(Te&6)!==0?ra(oa,qy):Hm()})}function Lc(){if(Fn===0){var e=Pa;e===0&&(e=Js,Js<<=1,(Js&261888)===0&&(Js=256)),Fn=e}return Fn}function Gm(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:ai(""+e)}function Qm(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 Ty(e,t,n,s,c){if(t==="submit"&&n&&n.stateNode===c){var u=Gm((c[mt]||null).action),g=s.submitter;g&&(t=(t=g[mt]||null)?Gm(t.formAction):g.getAttribute("formAction"),t!==null&&(u=t,g=null));var v=new ri("action","action",null,s,c);e.push({event:v,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(Fn!==0){var T=g?Qm(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?Qm(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],Ry=Hc.toLowerCase(),ky=Hc[0].toUpperCase()+Hc.slice(1);$t(Ry,"on"+ky)}$t(Ad,"onAnimationEnd"),$t(jd,"onAnimationIteration"),$t(Nd,"onAnimationStart"),$t("dblclick","onDoubleClick"),$t("focusin","onFocus"),$t("focusout","onBlur"),$t(Zx,"onTransitionRun"),$t(Fx,"onTransitionStart"),$t(Jx,"onTransitionCancel"),$t(wd,"onTransitionEnd"),Ua("onMouseEnter",["mouseout","mouseover"]),Ua("onMouseLeave",["mouseout","mouseover"]),Ua("onPointerEnter",["pointerout","pointerover"]),Ua("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 ys="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(" "),_y=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ys));function Xm(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,H=v.currentTarget;if(v=v.listener,T!==u&&c.isPropagationStopped())break e;u=v,c.currentTarget=H;try{u(c)}catch(K){ui(K)}c.currentTarget=null,u=T}else for(g=0;g<s.length;g++){if(v=s[g],T=v.instance,H=v.currentTarget,v=v.listener,T!==u&&c.isPropagationStopped())break e;u=v,c.currentTarget=H;try{u(c)}catch(K){ui(K)}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)||(Km(t,e,2,!1),n.add(s))}function Vc(e,t,n){var s=0;t&&(s|=4),Km(n,e,s,t)}var Ji="_reactListening"+Math.random().toString(36).slice(2);function Yc(e){if(!e[Ji]){e[Ji]=!0,Hf.forEach(function(n){n!=="selectionchange"&&(_y.has(n)||Vc(n,!1,e),Vc(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ji]||(t[Ji]=!0,Vc("selectionchange",!1,t))}}function Km(e,t,n,s){switch(Ap(t)){case 2:var c=rv;break;case 8:c=ov;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=Ba(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}Wf(function(){var H=u,K=so(n),J=[];e:{var $=Ed.get(e);if($!==void 0){var Q=ri,ie=e;switch(e){case"keypress":if(si(n)===0)break e;case"keydown":case"keyup":Q=Ex;break;case"focusin":ie="focus",Q=fo;break;case"focusout":ie="blur",Q=fo;break;case"beforeblur":case"afterblur":Q=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":Q=td;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Q=mx;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Q=Mx;break;case Ad:case jd:case Nd:Q=xx;break;case wd:Q=Rx;break;case"scroll":case"scrollend":Q=dx;break;case"wheel":Q=_x;break;case"copy":case"cut":case"paste":Q=vx;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Q=ad;break;case"toggle":case"beforetoggle":Q=Ox}var de=(t&4)!==0,Be=!de&&(e==="scroll"||e==="scrollend"),D=de?$!==null?$+"Capture":null:$;de=[];for(var R=H,L;R!==null;){var F=R;if(L=F.stateNode,F=F.tag,F!==5&&F!==26&&F!==27||L===null||D===null||(F=Hl(R,D),F!=null&&de.push(vs(R,F,L))),Be)break;R=R.return}0<de.length&&($=new Q($,ie,null,n,K),J.push({event:$,listeners:de}))}}if((t&7)===0){e:{if($=e==="mouseover"||e==="pointerover",Q=e==="mouseout"||e==="pointerout",$&&n!==lo&&(ie=n.relatedTarget||n.fromElement)&&(Ba(ie)||ie[Oa]))break e;if((Q||$)&&($=K.window===K?K:($=K.ownerDocument)?$.defaultView||$.parentWindow:window,Q?(ie=n.relatedTarget||n.toElement,Q=H,ie=ie?Ba(ie):null,ie!==null&&(Be=d(ie),de=ie.tag,ie!==Be||de!==5&&de!==27&&de!==6)&&(ie=null)):(Q=null,ie=H),Q!==ie)){if(de=td,F="onMouseLeave",D="onMouseEnter",R="mouse",(e==="pointerout"||e==="pointerover")&&(de=ad,F="onPointerLeave",D="onPointerEnter",R="pointer"),Be=Q==null?$:Ul(Q),L=ie==null?$:Ul(ie),$=new de(F,R+"leave",Q,n,K),$.target=Be,$.relatedTarget=L,F=null,Ba(K)===H&&(de=new de(D,R+"enter",ie,n,K),de.target=L,de.relatedTarget=Be,F=de),Be=F,Q&&ie)t:{for(de=Dy,D=Q,R=ie,L=0,F=D;F;F=de(F))L++;F=0;for(var fe=R;fe;fe=de(fe))F++;for(;0<L-F;)D=de(D),L--;for(;0<F-L;)R=de(R),F--;for(;L--;){if(D===R||R!==null&&D===R.alternate){de=D;break t}D=de(D),R=de(R)}de=null}else de=null;Q!==null&&Zm(J,$,Q,de,!1),ie!==null&&Be!==null&&Zm(J,Be,ie,de,!0)}}e:{if($=H?Ul(H):window,Q=$.nodeName&&$.nodeName.toLowerCase(),Q==="select"||Q==="input"&&$.type==="file")var qe=fd;else if(cd($))if(dd)qe=Qx;else{qe=$x;var oe=Yx}else Q=$.nodeName,!Q||Q.toLowerCase()!=="input"||$.type!=="checkbox"&&$.type!=="radio"?H&&ao(H.elementType)&&(qe=fd):qe=Gx;if(qe&&(qe=qe(e,H))){ud(J,qe,n,K);break e}oe&&oe(e,$,H),e==="focusout"&&H&&$.type==="number"&&H.memoizedProps.value!=null&&no($,"number",$.value)}switch(oe=H?Ul(H):window,e){case"focusin":(cd(oe)||oe.contentEditable==="true")&&(Qa=oe,yo=H,Zl=null);break;case"focusout":Zl=yo=Qa=null;break;case"mousedown":vo=!0;break;case"contextmenu":case"mouseup":case"dragend":vo=!1,bd(J,n,K);break;case"selectionchange":if(Kx)break;case"keydown":case"keyup":bd(J,n,K)}var ge;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 Ga?rd(e,n)&&(Se="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(Se="onCompositionStart");Se&&(ld&&n.locale!=="ko"&&(Ga||Se!=="onCompositionStart"?Se==="onCompositionEnd"&&Ga&&(ge=Pf()):(_n=K,oo="value"in _n?_n.value:_n.textContent,Ga=!0)),oe=Ii(H,Se),0<oe.length&&(Se=new nd(Se,e,null,n,K),J.push({event:Se,listeners:oe}),ge?Se.data=ge:(ge=od(n),ge!==null&&(Se.data=ge)))),(ge=zx?Lx(e,n):Ux(e,n))&&(Se=Ii(H,"onBeforeInput"),0<Se.length&&(oe=new nd("onBeforeInput","beforeinput",null,n,K),J.push({event:oe,listeners:Se}),oe.data=ge)),Ty(J,e,H,n,K)}Xm(J,t)})}function vs(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ii(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=Hl(e,n),c!=null&&s.unshift(vs(e,c,u)),c=Hl(e,t),c!=null&&s.push(vs(e,c,u))),e.tag===3)return s;e=e.return}return[]}function Dy(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Zm(e,t,n,s,c){for(var u=t._reactName,g=[];n!==null&&n!==s;){var v=n,T=v.alternate,H=v.stateNode;if(v=v.tag,T!==null&&T===s)break;v!==5&&v!==26&&v!==27||H===null||(T=H,c?(H=Hl(n,u),H!=null&&g.unshift(vs(n,H,T))):c||(H=Hl(n,u),H!=null&&g.push(vs(n,H,T)))),n=n.return}g.length!==0&&e.push({event:t,listeners:g})}var Oy=/\r\n?/g,By=/\u0000|\uFFFD/g;function Fm(e){return(typeof e=="string"?e:""+e).replace(Oy,`
`).replace(By,"")}function Jm(e,t){return t=Fm(t),Fm(e)===t}function Oe(e,t,n,s,c,u){switch(n){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||Va(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&Va(e,""+s);break;case"className":ti(e,"class",s);break;case"tabIndex":ti(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":ti(e,n,s);break;case"style":Jf(e,s,u);break;case"data":if(t!=="object"){ti(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=ai(""+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=ai(""+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=ai(""+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),ei(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":ei(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=ux.get(n)||n,ei(e,n,s))}}function Gc(e,t,n,s,c,u){switch(n){case"style":Jf(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"?Va(e,s):(typeof s=="number"||typeof s=="bigint")&&Va(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(!Vf.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,""):ei(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,H=null;for(s in n)if(n.hasOwnProperty(s)){var K=n[s];if(K!=null)switch(s){case"name":c=K;break;case"type":g=K;break;case"checked":T=K;break;case"defaultChecked":H=K;break;case"value":u=K;break;case"defaultValue":v=K;break;case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(r(137,t));break;default:Oe(e,t,s,K,n,null)}}Xf(e,u,v,T,H,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?Ha(e,!!s,t,!1):n!=null&&Ha(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)}Zf(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<ys.length;s++)ve(ys[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(H in n)if(n.hasOwnProperty(H)&&(s=n[H],s!=null))switch(H){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:Oe(e,t,H,s,n,null)}return;default:if(ao(t)){for(K in n)n.hasOwnProperty(K)&&(s=n[K],s!==void 0&&Gc(e,t,K,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 zy(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,H=null,K=null;for(Q in n){var J=n[Q];if(n.hasOwnProperty(Q)&&J!=null)switch(Q){case"checked":break;case"value":break;case"defaultValue":T=J;default:s.hasOwnProperty(Q)||Oe(e,t,Q,null,s,J)}}for(var $ in s){var Q=s[$];if(J=n[$],s.hasOwnProperty($)&&(Q!=null||J!=null))switch($){case"type":u=Q;break;case"name":c=Q;break;case"checked":H=Q;break;case"defaultChecked":K=Q;break;case"value":g=Q;break;case"defaultValue":v=Q;break;case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(r(137,t));break;default:Q!==J&&Oe(e,t,$,Q,s,J)}}to(e,g,v,T,H,K,u,c);return;case"select":Q=g=v=$=null;for(u in n)if(T=n[u],n.hasOwnProperty(u)&&T!=null)switch(u){case"value":break;case"multiple":Q=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=Q,$!=null?Ha(e,!!n,$,!1):!!s!=!!n&&(t!=null?Ha(e,!!n,t,!0):Ha(e,!!n,n?[]:"",!1));return;case"textarea":Q=$=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":Q=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)}Kf(e,$,Q);return;case"option":for(var ie in n)if($=n[ie],n.hasOwnProperty(ie)&&$!=null&&!s.hasOwnProperty(ie))switch(ie){case"selected":e.selected=!1;break;default:Oe(e,t,ie,null,s,$)}for(T in s)if($=s[T],Q=n[T],s.hasOwnProperty(T)&&$!==Q&&($!=null||Q!=null))switch(T){case"selected":e.selected=$&&typeof $!="function"&&typeof $!="symbol";break;default:Oe(e,t,T,$,s,Q)}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(H in s)if($=s[H],Q=n[H],s.hasOwnProperty(H)&&$!==Q&&($!=null||Q!=null))switch(H){case"children":case"dangerouslySetInnerHTML":if($!=null)throw Error(r(137,t));break;default:Oe(e,t,H,$,s,Q)}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(K in s)$=s[K],Q=n[K],!s.hasOwnProperty(K)||$===Q||$===void 0&&Q===void 0||Gc(e,t,K,$,s,Q);return}}for(var D in n)$=n[D],n.hasOwnProperty(D)&&$!=null&&!s.hasOwnProperty(D)&&Oe(e,t,D,null,s,$);for(J in s)$=s[J],Q=n[J],!s.hasOwnProperty(J)||$===Q||$==null&&Q==null||Oe(e,t,J,$,s,Q)}function Im(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Ly(){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&&Im(g)){for(g=0,v=c.responseEnd,s+=1;s<n.length;s++){var T=n[s],H=T.startTime;if(H>v)break;var K=T.transferSize,J=T.initiatorType;K&&Im(J)&&(T=T.responseEnd,g+=K*(T<v?1:(v-H)/(T-H)))}if(--s,t+=8*(u+g)/(c.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Qc=null,Xc=null;function Wi(e){return e.nodeType===9?e:e.ownerDocument}function Wm(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 Pm(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 Uy(){var e=window.event;return e&&e.type==="popstate"?e===Zc?!1:(Zc=e,!0):(Zc=null,!1)}var ep=typeof setTimeout=="function"?setTimeout:void 0,Hy=typeof clearTimeout=="function"?clearTimeout:void 0,tp=typeof Promise=="function"?Promise:void 0,Vy=typeof queueMicrotask=="function"?queueMicrotask:typeof tp<"u"?function(e){return tp.resolve(null).then(e).catch(Yy)}:ep;function Yy(e){setTimeout(function(){throw e})}function Jn(e){return e==="head"}function np(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),yl(t);return}s--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")s++;else if(n==="html")bs(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,bs(n);for(var u=n.firstChild;u;){var g=u.nextSibling,v=u.nodeName;u[Ll]||v==="SCRIPT"||v==="STYLE"||v==="LINK"&&u.rel.toLowerCase()==="stylesheet"||n.removeChild(u),u=g}}else n==="body"&&bs(e.ownerDocument.body);n=c}while(n);yl(t)}function ap(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 $y(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[Ll])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 Gy(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 lp(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 Qy(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 sp(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 ip(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 rp(e,t,n){switch(t=Wi(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 bs(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Pr(e)}var Ht=new Map,op=new Set;function Pi(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Nn=P.d;P.d={f:Xy,r:Ky,D:Zy,C:Fy,L:Jy,m:Iy,X:Py,S:Wy,M:ev};function Xy(){var e=Nn.f(),t=Gi();return e||t}function Ky(e){var t=za(e);t!==null&&t.tag===5&&t.type==="form"?wh(t):Nn.r(e)}var pl=typeof document>"u"?null:document;function cp(e,t,n){var s=pl;if(s&&typeof t=="string"&&t){var c=kt(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof n=="string"&&(c+='[crossorigin="'+n+'"]'),op.has(c)||(op.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 Zy(e){Nn.D(e),cp("dns-prefetch",e,null)}function Fy(e,t){Nn.C(e,t),cp("preconnect",e,t)}function Jy(e,t,n){Nn.L(e,t,n);var s=pl;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=gl(e);break;case"script":u=xl(e)}Ht.has(u)||(e=b({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(Ss(u))||t==="script"&&s.querySelector(As(u))||(t=s.createElement("link"),ct(t,"link",e),at(t),s.head.appendChild(t)))}}function Iy(e,t){Nn.m(e,t);var n=pl;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=xl(e)}if(!Ht.has(u)&&(e=b({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(As(u)))return}s=n.createElement("link"),ct(s,"link",e),at(s),n.head.appendChild(s)}}}function Wy(e,t,n){Nn.S(e,t,n);var s=pl;if(s&&e){var c=La(s).hoistableStyles,u=gl(e);t=t||"default";var g=c.get(u);if(!g){var v={loading:0,preload:null};if(g=s.querySelector(Ss(u)))v.loading=5;else{e=b({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(H,K){T.onload=H,T.onerror=K}),T.addEventListener("load",function(){v.loading|=1}),T.addEventListener("error",function(){v.loading|=2}),v.loading|=4,er(g,t,s)}g={type:"stylesheet",instance:g,count:1,state:v},c.set(u,g)}}}function Py(e,t){Nn.X(e,t);var n=pl;if(n&&e){var s=La(n).hoistableScripts,c=xl(e),u=s.get(c);u||(u=n.querySelector(As(c)),u||(e=b({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 ev(e,t){Nn.M(e,t);var n=pl;if(n&&e){var s=La(n).hoistableScripts,c=xl(e),u=s.get(c);u||(u=n.querySelector(As(c)),u||(e=b({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 up(e,t,n,s){var c=(c=ne.current)?Pi(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=gl(n.href),n=La(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=gl(n.href);var u=La(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(Ss(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||tv(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=xl(n),n=La(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 gl(e){return'href="'+kt(e)+'"'}function Ss(e){return'link[rel="stylesheet"]['+e+"]"}function fp(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function tv(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 xl(e){return'[src="'+kt(e)+'"]'}function As(e){return"script[async]"+e}function dp(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=b({},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),er(s,n.precedence,e),t.instance=s;case"stylesheet":c=gl(n.href);var u=e.querySelector(Ss(c));if(u)return t.state.loading|=4,t.instance=u,at(u),u;s=fp(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,er(u,n.precedence,e),t.instance=u;case"script":return u=xl(n.src),(c=e.querySelector(As(u)))?(t.instance=c,at(c),c):(s=n,(c=Ht.get(u))&&(s=b({},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,er(s,n.precedence,e));return t.instance}function er(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 tr=null;function hp(e,t,n){if(tr===null){var s=new Map,c=tr=new Map;c.set(n,s)}else c=tr,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[Ll]||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 mp(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function nv(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 pp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function av(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=gl(s.href),u=t.querySelector(Ss(c));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=nr.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=u,at(u);return}u=t.ownerDocument||t,s=fp(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=nr.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var tu=0;function lv(e,t){return e.stylesheets&&e.count===0&&lr(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var s=setTimeout(function(){if(e.stylesheets&&lr(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&tu===0&&(tu=62500*Ly());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&lr(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 nr(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)lr(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var ar=null;function lr(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ar=new Map,t.forEach(sv,e),ar=null,nr.call(e))}function sv(e,t){if(!(t.state.loading&4)){var n=ar.get(e);if(n)var s=n.get(null);else{n=new Map,ar.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=nr.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 js={$$typeof:k,Provider:null,Consumer:null,_currentValue:le,_currentValue2:le,_threadCount:0};function iv(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 gp(e,t,n,s,c,u,g,v,T,H,K,J){return e=new iv(e,t,n,g,T,H,K,J,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 xp(e){return e?(e=Za,e):Za}function yp(e,t,n,s,c,u){c=xp(c),s.context===null?s.context=c:s.pendingContext=c,s=Un(t),s.payload={element:n},u=u===void 0?null:u,u!==null&&(s.callback=u),n=Hn(e,s,t),n!==null&&(bt(n,e,t),ts(n,e,t))}function vp(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){vp(e,t),(e=e.alternate)&&vp(e,t)}function bp(e){if(e.tag===13||e.tag===31){var t=ma(e,67108864);t!==null&&bt(t,e,67108864),nu(e,67108864)}}function Sp(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 sr=!0;function rv(e,t,n,s){var c=B.T;B.T=null;var u=P.p;try{P.p=2,au(e,t,n,s)}finally{P.p=u,B.T=c}}function ov(e,t,n,s){var c=B.T;B.T=null;var u=P.p;try{P.p=8,au(e,t,n,s)}finally{P.p=u,B.T=c}}function au(e,t,n,s){if(sr){var c=lu(s);if(c===null)$c(e,t,s,ir,n),jp(e,s);else if(uv(c,e,t,n,s))s.stopPropagation();else if(jp(e,s),t&4&&-1<cv.indexOf(e)){for(;c!==null;){var u=za(c);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var 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&&(Yi=tt()+500,xs(0))}}break;case 31:case 13:v=ma(u,2),v!==null&&bt(v,u,2),Gi(),nu(u,2)}if(u=lu(s),u===null&&$c(e,t,s,ir,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 ir=null;function su(e){if(ir=null,e=Ba(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 ir=e,null}function Ap(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(Dl()){case oa:return 2;case Ol:return 8;case Da:case Kr:return 32;case Zs:return 268435456;default:return 32}default:return 32}}var iu=!1,In=null,Wn=null,Pn=null,Ns=new Map,ws=new Map,ea=[],cv="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 jp(e,t){switch(e){case"focusin":case"focusout":In=null;break;case"dragenter":case"dragleave":Wn=null;break;case"mouseover":case"mouseout":Pn=null;break;case"pointerover":case"pointerout":Ns.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ws.delete(t.pointerId)}}function Es(e,t,n,s,c,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:n,eventSystemFlags:s,nativeEvent:u,targetContainers:[c]},t!==null&&(t=za(t),t!==null&&bp(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function uv(e,t,n,s,c){switch(t){case"focusin":return In=Es(In,e,t,n,s,c),!0;case"dragenter":return Wn=Es(Wn,e,t,n,s,c),!0;case"mouseover":return Pn=Es(Pn,e,t,n,s,c),!0;case"pointerover":var u=c.pointerId;return Ns.set(u,Es(Ns.get(u)||null,e,t,n,s,c)),!0;case"gotpointercapture":return u=c.pointerId,ws.set(u,Es(ws.get(u)||null,e,t,n,s,c)),!0}return!1}function Np(e){var t=Ba(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,Lf(e.priority,function(){Sp(n)});return}}else if(t===31){if(t=x(n),t!==null){e.blockedOn=t,Lf(e.priority,function(){Sp(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 rr(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=za(n),t!==null&&bp(t),e.blockedOn=n,!1;t.shift()}return!0}function wp(e,t,n){rr(e)&&n.delete(t)}function fv(){iu=!1,In!==null&&rr(In)&&(In=null),Wn!==null&&rr(Wn)&&(Wn=null),Pn!==null&&rr(Pn)&&(Pn=null),Ns.forEach(wp),ws.forEach(wp)}function or(e,t){e.blockedOn===t&&(e.blockedOn=null,iu||(iu=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,fv)))}var cr=null;function Ep(e){cr!==e&&(cr=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){cr===e&&(cr=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=za(n);u!==null&&(e.splice(t,3),t-=3,lc(u,{pending:!0,data:c,method:n.method,action:s},s,c))}}))}function yl(e){function t(T){return or(T,e)}In!==null&&or(In,e),Wn!==null&&or(Wn,e),Pn!==null&&or(Pn,e),Ns.forEach(t),ws.forEach(t);for(var n=0;n<ea.length;n++){var s=ea[n];s.blockedOn===e&&(s.blockedOn=null)}for(;0<ea.length&&(n=ea[0],n.blockedOn===null);)Np(n),n.blockedOn===null&&ea.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||Ep(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),Ep(n)}}}function Cp(){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}ur.prototype.render=ru.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));var n=t.current,s=qt();yp(n,s,e,t,null,null)},ur.prototype.unmount=ru.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;yp(e.current,2,null,e,null,null),Gi(),t[Oa]=null}};function ur(e){this._internalRoot=e}ur.prototype.unstable_scheduleHydration=function(e){if(e){var t=zf();e={blockedOn:null,target:e,priority:t};for(var n=0;n<ea.length&&t!==0&&t<ea[n].priority;n++);ea.splice(n,0,e),n===0&&Np(e)}};var qp=l.version;if(qp!=="19.2.0")throw Error(r(527,qp,"19.2.0"));P.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?S(e):null,e=e===null?null:e.stateNode,e};var dv={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:B,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var fr=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!fr.isDisabled&&fr.supportsFiber)try{Xe=fr.inject(dv),Le=fr}catch{}}return qs.createRoot=function(e,t){if(!f(e))throw Error(r(299));var n=!1,s="",c=Oh,u=Bh,g=zh;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=gp(e,1,!1,null,null,n,s,null,c,u,g,Cp),e[Oa]=t.current,Yc(e),new ru(t)},qs.hydrateRoot=function(e,t,n){if(!f(e))throw Error(r(299));var s=!1,c="",u=Oh,g=Bh,v=zh,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=gp(e,1,!0,t,n??null,s,c,T,u,g,v,Cp),t.context=xp(null),n=t.current,s=qt(),s=Jr(s),c=Un(s),c.callback=null,Hn(n,c,s),n=s,t.current.lanes=n,zl(t,n),Pt(t),e[Oa]=t.current,Yc(e),new ur(t)},qs.version="19.2.0",qs}var Lp;function jv(){if(Lp)return uu.exports;Lp=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=Av(),uu.exports}var Nv=jv();var Up="popstate";function wv(a={}){function l(r,f){let{pathname:d,search:m,hash:x}=r.location;return Du("",{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:Ls(f)}return Cv(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 Ev(){return Math.random().toString(36).substring(2,10)}function Hp(a,l){return{usr:a.state,key:a.key,idx:l}}function Du(a,l,i=null,r){return{pathname:typeof a=="string"?a:a.pathname,search:"",hash:"",...typeof l=="string"?Cl(l):l,state:i,key:l&&l.key||r||Ev()}}function Ls({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 Cl(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 Cv(a,l,i,r={}){let{window:f=document.defaultView,v5Compat:d=!1}=r,m=f.history,x="POP",p=null,y=S();y==null&&(y=0,m.replaceState({...m.state,idx:y},""));function S(){return(m.state||{idx:null}).idx}function b(){x="POP";let A=S(),q=A==null?null:A-y;y=A,p&&p({action:x,location:C.location,delta:q})}function w(A,q){x="PUSH";let j=Du(C.location,A,q);y=S()+1;let k=Hp(j,y),X=C.createHref(j);try{m.pushState(k,"",X)}catch(U){if(U instanceof DOMException&&U.name==="DataCloneError")throw U;f.location.assign(X)}d&&p&&p({action:x,location:C.location,delta:1})}function M(A,q){x="REPLACE";let j=Du(C.location,A,q);y=S();let k=Hp(j,y),X=C.createHref(j);m.replaceState(k,"",X),d&&p&&p({action:x,location:C.location,delta:0})}function N(A){return qv(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(Up,b),p=A,()=>{f.removeEventListener(Up,b),p=null}},createHref(A){return l(f,A)},createURL:N,encodeLocation(A){let q=N(A);return{pathname:q.pathname,search:q.search,hash:q.hash}},push:w,replace:M,go(A){return m.go(A)}};return C}function qv(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:Ls(a);return r=r.replace(/ $/,"%20"),!l&&r.startsWith("//")&&(r=i+r),new URL(r,i)}function k0(a,l,i="/"){return Mv(a,l,i,!1)}function Mv(a,l,i,r){let f=typeof l=="string"?Cl(l):l,d=Tn(f.pathname||"/",i);if(d==null)return null;let m=_0(a);Tv(m);let x=null;for(let p=0;x==null&&p<m.length;++p){let y=Vv(d);x=Uv(m[p],y,r)}return x}function _0(a,l=[],i=[],r="",f=!1){let d=(m,x,p=f,y)=>{let S={relativePath:y===void 0?m.path||"":y,caseSensitive:m.caseSensitive===!0,childrenIndex:x,route:m};if(S.relativePath.startsWith("/")){if(!S.relativePath.startsWith(r)&&p)return;$e(S.relativePath.startsWith(r),`Absolute route path "${S.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),S.relativePath=S.relativePath.slice(r.length)}let b=Mn([r,S.relativePath]),w=i.concat(S);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 "${b}".`),_0(m.children,l,w,b,p)),!(m.path==null&&!m.index)&&l.push({path:b,score:zv(b,m.index),routesMeta:w})};return a.forEach((m,x)=>{if(m.path===""||!m.path?.includes("?"))d(m,x);else for(let p of D0(m.path))d(m,x,!0,p)}),l}function D0(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=D0(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 Tv(a){a.sort((l,i)=>l.score!==i.score?i.score-l.score:Lv(l.routesMeta.map(r=>r.childrenIndex),i.routesMeta.map(r=>r.childrenIndex)))}var Rv=/^:[\w-]+$/,kv=3,_v=2,Dv=1,Ov=10,Bv=-2,Vp=a=>a==="*";function zv(a,l){let i=a.split("/"),r=i.length;return i.some(Vp)&&(r+=Bv),l&&(r+=_v),i.filter(f=>!Vp(f)).reduce((f,d)=>f+(Rv.test(d)?kv:d===""?Dv:Ov),r)}function Lv(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 Uv(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,S=d==="/"?l:l.slice(d.length)||"/",b=Tr({path:p.relativePath,caseSensitive:p.caseSensitive,end:y},S),w=p.route;if(!b&&y&&i&&!r[r.length-1].route.index&&(b=Tr({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},S)),!b)return null;Object.assign(f,b.params),m.push({params:f,pathname:Mn([d,b.pathname]),pathnameBase:Xv(Mn([d,b.pathnameBase])),route:w}),b.pathnameBase!=="/"&&(d=Mn([d,b.pathnameBase]))}return m}function Tr(a,l){typeof a=="string"&&(a={path:a,caseSensitive:!1,end:!0});let[i,r]=Hv(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:S,isOptional:b},w)=>{if(S==="*"){let N=x[w]||"";m=d.slice(0,d.length-N.length).replace(/(.)\/+$/,"$1")}const M=x[w];return b&&!M?y[S]=void 0:y[S]=(M||"").replace(/%2F/g,"/"),y},{}),pathname:d,pathnameBase:m,pattern:a}}function Hv(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 Vv(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 Tn(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 Yv=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,$v=a=>Yv.test(a);function Gv(a,l="/"){let{pathname:i,search:r="",hash:f=""}=typeof a=="string"?Cl(a):a,d;if(i)if($v(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=Yp(i.substring(1),"/"):d=Yp(i,l)}else d=l;return{pathname:d,search:Kv(r),hash:Zv(f)}}function Yp(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 Qv(a){return a.filter((l,i)=>i===0||l.route.path&&l.route.path.length>0)}function O0(a){let l=Qv(a);return l.map((i,r)=>r===l.length-1?i.pathname:i.pathnameBase)}function B0(a,l,i,r=!1){let f;typeof a=="string"?f=Cl(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 b=l.length-1;if(!r&&m.startsWith("..")){let w=m.split("/");for(;w[0]==="..";)w.shift(),b-=1;f.pathname=w.join("/")}x=b>=0?l[b]:"/"}let p=Gv(f,x),y=m&&m!=="/"&&m.endsWith("/"),S=(d||m===".")&&i.endsWith("/");return!p.pathname.endsWith("/")&&(y||S)&&(p.pathname+="/"),p}var Mn=a=>a.join("/").replace(/\/\/+/g,"/"),Xv=a=>a.replace(/\/+$/,"").replace(/^\/*/,"/"),Kv=a=>!a||a==="?"?"":a.startsWith("?")?a:"?"+a,Zv=a=>!a||a==="#"?"":a.startsWith("#")?a:"#"+a;function Fv(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 z0=["POST","PUT","PATCH","DELETE"];new Set(z0);var Jv=["GET",...z0];new Set(Jv);var ql=h.createContext(null);ql.displayName="DataRouter";var zr=h.createContext(null);zr.displayName="DataRouterState";h.createContext(!1);var L0=h.createContext({isTransitioning:!1});L0.displayName="ViewTransition";var Iv=h.createContext(new Map);Iv.displayName="Fetchers";var Wv=h.createContext(null);Wv.displayName="Await";var an=h.createContext(null);an.displayName="Navigation";var $s=h.createContext(null);$s.displayName="Location";var Rn=h.createContext({outlet:null,matches:[],isDataRoute:!1});Rn.displayName="Route";var Wu=h.createContext(null);Wu.displayName="RouteError";function Pv(a,{relative:l}={}){$e(Gs(),"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}=Qs(a,{relative:l}),x=d;return i!=="/"&&(x=d==="/"?i:Mn([i,d])),r.createHref({pathname:x,search:m,hash:f})}function Gs(){return h.useContext($s)!=null}function Ta(){return $e(Gs(),"useLocation() may be used only in the context of a <Router> component."),h.useContext($s).location}var U0="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function H0(a){h.useContext(an).static||h.useLayoutEffect(a)}function eb(){let{isDataRoute:a}=h.useContext(Rn);return a?hb():tb()}function tb(){$e(Gs(),"useNavigate() may be used only in the context of a <Router> component.");let a=h.useContext(ql),{basename:l,navigator:i}=h.useContext(an),{matches:r}=h.useContext(Rn),{pathname:f}=Ta(),d=JSON.stringify(O0(r)),m=h.useRef(!1);return H0(()=>{m.current=!0}),h.useCallback((p,y={})=>{if(Ft(m.current,U0),!m.current)return;if(typeof p=="number"){i.go(p);return}let S=B0(p,JSON.parse(d),f,y.relative==="path");a==null&&l!=="/"&&(S.pathname=S.pathname==="/"?l:Mn([l,S.pathname])),(y.replace?i.replace:i.push)(S,y.state,y)},[l,i,d,f,a])}h.createContext(null);function Qs(a,{relative:l}={}){let{matches:i}=h.useContext(Rn),{pathname:r}=Ta(),f=JSON.stringify(O0(i));return h.useMemo(()=>B0(a,JSON.parse(f),r,l==="path"),[a,f,r,l])}function nb(a,l){return V0(a,l)}function V0(a,l,i,r,f){$e(Gs(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:d}=h.useContext(an),{matches:m}=h.useContext(Rn),x=m[m.length-1],p=x?x.params:{},y=x?x.pathname:"/",S=x?x.pathnameBase:"/",b=x&&x.route;{let j=b&&b.path||"";Y0(y,!b||j.endsWith("*")||j.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${y}" (under <Route path="${j}">) 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="${j}"> to <Route path="${j==="/"?"*":`${j}/*`}">.`)}let w=Ta(),M;if(l){let j=typeof l=="string"?Cl(l):l;$e(S==="/"||j.pathname?.startsWith(S),`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 "${S}" but pathname "${j.pathname}" was given in the \`location\` prop.`),M=j}else M=w;let N=M.pathname||"/",C=N;if(S!=="/"){let j=S.replace(/^\//,"").split("/");C="/"+N.replace(/^\//,"").split("/").slice(j.length).join("/")}let A=k0(a,{pathname:C});Ft(b||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=rb(A&&A.map(j=>Object.assign({},j,{params:Object.assign({},p,j.params),pathname:Mn([S,d.encodeLocation?d.encodeLocation(j.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:j.pathname]),pathnameBase:j.pathnameBase==="/"?S:Mn([S,d.encodeLocation?d.encodeLocation(j.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:j.pathnameBase])})),m,i,r,f);return l&&q?h.createElement($s.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...M},navigationType:"POP"}},q):q}function ab(){let a=db(),l=Fv(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 lb=h.createElement(ab,null),sb=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(Rn.Provider,{value:this.props.routeContext},h.createElement(Wu.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function ib({routeContext:a,match:l,children:i}){let r=h.useContext(ql);return r&&r.static&&r.staticContext&&(l.route.errorElement||l.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=l.route.id),h.createElement(Rn.Provider,{value:a},i)}function rb(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 S=d.findIndex(b=>b.route.id&&m?.[b.route.id]!==void 0);$e(S>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(m).join(",")}`),d=d.slice(0,Math.min(d.length,S+1))}let x=!1,p=-1;if(i)for(let S=0;S<d.length;S++){let b=d[S];if((b.route.HydrateFallback||b.route.hydrateFallbackElement)&&(p=S),b.route.id){let{loaderData:w,errors:M}=i,N=b.route.loader&&!w.hasOwnProperty(b.route.id)&&(!M||M[b.route.id]===void 0);if(b.route.lazy||N){x=!0,p>=0?d=d.slice(0,p+1):d=[d[0]];break}}}let y=i&&r?(S,b)=>{r(S,{location:i.location,params:i.matches?.[0]?.params??{},errorInfo:b})}:void 0;return d.reduceRight((S,b,w)=>{let M,N=!1,C=null,A=null;i&&(M=m&&b.route.id?m[b.route.id]:void 0,C=b.route.errorElement||lb,x&&(p<0&&w===0?(Y0("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),N=!0,A=null):p===w&&(N=!0,A=b.route.hydrateFallbackElement||null)));let q=l.concat(d.slice(0,w+1)),j=()=>{let k;return M?k=C:N?k=A:b.route.Component?k=h.createElement(b.route.Component,null):b.route.element?k=b.route.element:k=S,h.createElement(ib,{match:b,routeContext:{outlet:S,matches:q,isDataRoute:i!=null},children:k})};return i&&(b.route.ErrorBoundary||b.route.errorElement||w===0)?h.createElement(sb,{location:i.location,revalidation:i.revalidation,component:C,error:M,children:j(),routeContext:{outlet:null,matches:q,isDataRoute:!0},onError:y}):j()},null)}function Pu(a){return`${a} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ob(a){let l=h.useContext(ql);return $e(l,Pu(a)),l}function cb(a){let l=h.useContext(zr);return $e(l,Pu(a)),l}function ub(a){let l=h.useContext(Rn);return $e(l,Pu(a)),l}function ef(a){let l=ub(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 fb(){return ef("useRouteId")}function db(){let a=h.useContext(Wu),l=cb("useRouteError"),i=ef("useRouteError");return a!==void 0?a:l.errors?.[i]}function hb(){let{router:a}=ob("useNavigate"),l=ef("useNavigate"),i=h.useRef(!1);return H0(()=>{i.current=!0}),h.useCallback(async(f,d={})=>{Ft(i.current,U0),i.current&&(typeof f=="number"?a.navigate(f):await a.navigate(f,{fromRouteId:l,...d}))},[a,l])}var $p={};function Y0(a,l,i){!l&&!$p[a]&&($p[a]=!0,Ft(!1,i))}h.memo(mb);function mb({routes:a,future:l,state:i,unstable_onError:r}){return V0(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 pb({basename:a="/",children:l=null,location:i,navigationType:r="POP",navigator:f,static:d=!1}){$e(!Gs(),"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=Cl(i));let{pathname:p="/",search:y="",hash:S="",state:b=null,key:w="default"}=i,M=h.useMemo(()=>{let N=Tn(p,m);return N==null?null:{location:{pathname:N,search:y,hash:S,state:b,key:w},navigationType:r}},[m,p,y,S,b,w,r]);return Ft(M!=null,`<Router basename="${m}"> is not able to match the URL "${p}${y}${S}" 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($s.Provider,{children:l,value:M}))}function gb({children:a,location:l}){return nb(Ou(a),l)}function Ou(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,Ou(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=Ou(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 xb(a){return Lr(a)&&a.tagName.toLowerCase()==="button"}function yb(a){return Lr(a)&&a.tagName.toLowerCase()==="form"}function vb(a){return Lr(a)&&a.tagName.toLowerCase()==="input"}function bb(a){return!!(a.metaKey||a.altKey||a.ctrlKey||a.shiftKey)}function Sb(a,l){return a.button===0&&(!l||l==="_self")&&!bb(a)}var dr=null;function Ab(){if(dr===null)try{new FormData(document.createElement("form"),0),dr=!1}catch{dr=!0}return dr}var jb=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function pu(a){return a!=null&&!jb.has(a)?(Ft(!1,`"${a}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Ar}"`),null):a}function Nb(a,l){let i,r,f,d,m;if(yb(a)){let x=a.getAttribute("action");r=x?Tn(x,l):null,i=a.getAttribute("method")||Sr,f=pu(a.getAttribute("enctype"))||Ar,d=new FormData(a)}else if(xb(a)||vb(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?Tn(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),!Ab()){let{name:y,type:S,value:b}=a;if(S==="image"){let w=y?`${y}.`:"";d.append(`${w}x`,"0"),d.append(`${w}y`,"0")}else y&&d.append(y,b)}}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 tf(a,l){if(a===!1||a===null||typeof a>"u")throw new Error(l)}function wb(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&&Tn(r.pathname,l)==="/"?r.pathname=`${l.replace(/\/$/,"")}/_root.${i}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${i}`,r}async function Eb(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 Cb(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 qb(a,l,i){let r=await Promise.all(a.map(async f=>{let d=l.routes[f.route.id];if(d){let m=await Eb(d,i);return m.links?m.links():[]}return[]}));return kb(r.flat(1).filter(Cb).filter(f=>f.rel==="stylesheet"||f.rel==="preload").map(f=>f.rel==="stylesheet"?{...f,rel:"prefetch",as:"style"}:{...f,rel:"prefetch"}))}function Gp(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 S=r.routes[p.route.id];if(!S||!S.hasLoader)return!1;if(m(p,y)||x(p,y))return!0;if(p.route.shouldRevalidate){let b=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 b=="boolean")return b}return!0}):[]}function Mb(a,l,{includeHydrateFallback:i}={}){return Tb(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 Tb(a){return[...new Set(a)]}function Rb(a){let l={},i=Object.keys(a).sort();for(let r of i)l[r]=a[r];return l}function kb(a,l){let i=new Set;return new Set(l),a.reduce((r,f)=>{let d=JSON.stringify(Rb(f));return i.has(d)||(i.add(d),r.push({key:d,link:f})),r},[])}function $0(){let a=h.useContext(ql);return tf(a,"You must render this element inside a <DataRouterContext.Provider> element"),a}function _b(){let a=h.useContext(zr);return tf(a,"You must render this element inside a <DataRouterStateContext.Provider> element"),a}var nf=h.createContext(void 0);nf.displayName="FrameworkContext";function G0(){let a=h.useContext(nf);return tf(a,"You must render this element inside a <HydratedRouter> element"),a}function Db(a,l){let i=h.useContext(nf),[r,f]=h.useState(!1),[d,m]=h.useState(!1),{onFocus:x,onBlur:p,onMouseEnter:y,onMouseLeave:S,onTouchStart:b}=l,w=h.useRef(null);h.useEffect(()=>{if(a==="render"&&m(!0),a==="viewport"){let C=q=>{q.forEach(j=>{m(j.isIntersecting)})},A=new IntersectionObserver(C,{threshold:.5});return w.current&&A.observe(w.current),()=>{A.disconnect()}}},[a]),h.useEffect(()=>{if(r){let C=setTimeout(()=>{m(!0)},100);return()=>{clearTimeout(C)}}},[r]);let M=()=>{f(!0)},N=()=>{f(!1),m(!1)};return i?a!=="intent"?[d,w,{}]:[d,w,{onFocus:Ms(x,M),onBlur:Ms(p,N),onMouseEnter:Ms(y,M),onMouseLeave:Ms(S,N),onTouchStart:Ms(b,M)}]:[!1,w,{}]}function Ms(a,l){return i=>{a&&a(i),i.defaultPrevented||l(i)}}function Ob({page:a,...l}){let{router:i}=$0(),r=h.useMemo(()=>k0(i.routes,a,i.basename),[i.routes,a,i.basename]);return r?h.createElement(zb,{page:a,matches:r,...l}):null}function Bb(a){let{manifest:l,routeModules:i}=G0(),[r,f]=h.useState([]);return h.useEffect(()=>{let d=!1;return qb(a,l,i).then(m=>{d||f(m)}),()=>{d=!0}},[a,l,i]),r}function zb({page:a,matches:l,...i}){let r=Ta(),{manifest:f,routeModules:d}=G0(),{basename:m}=$0(),{loaderData:x,matches:p}=_b(),y=h.useMemo(()=>Gp(a,l,p,f,r,"data"),[a,l,p,f,r]),S=h.useMemo(()=>Gp(a,l,p,f,r,"assets"),[a,l,p,f,r]),b=h.useMemo(()=>{if(a===r.pathname+r.search+r.hash)return[];let N=new Set,C=!1;if(l.forEach(q=>{let j=f.routes[q.route.id];!j||!j.hasLoader||(!y.some(k=>k.route.id===q.route.id)&&q.route.id in x&&d[q.route.id]?.shouldRevalidate||j.hasClientLoader?C=!0:N.add(q.route.id))}),N.size===0)return[];let A=wb(a,m,"data");return C&&N.size>0&&A.searchParams.set("_routes",l.filter(q=>N.has(q.route.id)).map(q=>q.route.id).join(",")),[A.pathname+A.search]},[m,x,r,f,y,l,a,d]),w=h.useMemo(()=>Mb(S,f),[S,f]),M=Bb(S);return h.createElement(h.Fragment,null,b.map(N=>h.createElement("link",{key:N,rel:"prefetch",as:"fetch",href:N,...i})),w.map(N=>h.createElement("link",{key:N,rel:"modulepreload",href:N,...i})),M.map(({key:N,link:C})=>h.createElement("link",{key:N,nonce:i.nonce,...C})))}function Lb(...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 Ub({basename:a,children:l,window:i}){let r=h.useRef();r.current==null&&(r.current=wv({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(pb,{basename:a,children:l,location:d.location,navigationType:d.action,navigator:f})}var X0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,K0=h.forwardRef(function({onClick:l,discover:i="render",prefetch:r="none",relative:f,reloadDocument:d,replace:m,state:x,target:p,to:y,preventScrollReset:S,viewTransition:b,...w},M){let{basename:N}=h.useContext(an),C=typeof y=="string"&&X0.test(y),A,q=!1;if(typeof y=="string"&&C&&(A=y,Q0))try{let G=new URL(window.location.href),te=y.startsWith("//")?new URL(G.protocol+y):new URL(y),Z=Tn(te.pathname,N);te.origin===G.origin&&Z!=null?y=Z+te.search+te.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 j=Pv(y,{relative:f}),[k,X,U]=Db(r,w),Y=$b(y,{replace:m,state:x,target:p,preventScrollReset:S,relative:f,viewTransition:b});function z(G){l&&l(G),G.defaultPrevented||Y(G)}let I=h.createElement("a",{...w,...U,href:A||j,onClick:q||d?l:z,ref:Lb(M,X),target:p,"data-discover":!C&&i==="render"?"true":void 0});return k&&!C?h.createElement(h.Fragment,null,I,h.createElement(Ob,{page:j})):I});K0.displayName="Link";var Hb=h.forwardRef(function({"aria-current":l="page",caseSensitive:i=!1,className:r="",end:f=!1,style:d,to:m,viewTransition:x,children:p,...y},S){let b=Qs(m,{relative:y.relative}),w=Ta(),M=h.useContext(zr),{navigator:N,basename:C}=h.useContext(an),A=M!=null&&Zb(b)&&x===!0,q=N.encodeLocation?N.encodeLocation(b).pathname:b.pathname,j=w.pathname,k=M&&M.navigation&&M.navigation.location?M.navigation.location.pathname:null;i||(j=j.toLowerCase(),k=k?k.toLowerCase():null,q=q.toLowerCase()),k&&C&&(k=Tn(k,C)||k);const X=q!=="/"&&q.endsWith("/")?q.length-1:q.length;let U=j===q||!f&&j.startsWith(q)&&j.charAt(X)==="/",Y=k!=null&&(k===q||!f&&k.startsWith(q)&&k.charAt(q.length)==="/"),z={isActive:U,isPending:Y,isTransitioning:A},I=U?l:void 0,G;typeof r=="function"?G=r(z):G=[r,U?"active":null,Y?"pending":null,A?"transitioning":null].filter(Boolean).join(" ");let te=typeof d=="function"?d(z):d;return h.createElement(K0,{...y,"aria-current":I,className:G,ref:S,style:te,to:m,viewTransition:x},typeof p=="function"?p(z):p)});Hb.displayName="NavLink";var Vb=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:S,viewTransition:b,...w},M)=>{let N=Xb(),C=Kb(x,{relative:y}),A=m.toLowerCase()==="get"?"get":"post",q=typeof x=="string"&&X0.test(x),j=k=>{if(p&&p(k),k.defaultPrevented)return;k.preventDefault();let X=k.nativeEvent.submitter,U=X?.getAttribute("formmethod")||m;N(X||k.currentTarget,{fetcherKey:l,method:U,navigate:i,replace:f,state:d,relative:y,preventScrollReset:S,viewTransition:b})};return h.createElement("form",{ref:M,method:A,action:C,onSubmit:r?p:j,...w,"data-discover":!q&&a==="render"?"true":void 0})});Vb.displayName="Form";function Yb(a){return`${a} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Z0(a){let l=h.useContext(ql);return $e(l,Yb(a)),l}function $b(a,{target:l,replace:i,state:r,preventScrollReset:f,relative:d,viewTransition:m}={}){let x=eb(),p=Ta(),y=Qs(a,{relative:d});return h.useCallback(S=>{if(Sb(S,l)){S.preventDefault();let b=i!==void 0?i:Ls(p)===Ls(y);x(a,{replace:b,state:r,preventScrollReset:f,relative:d,viewTransition:m})}},[p,x,y,i,r,l,a,f,d,m])}var Gb=0,Qb=()=>`__${String(++Gb)}__`;function Xb(){let{router:a}=Z0("useSubmit"),{basename:l}=h.useContext(an),i=fb();return h.useCallback(async(r,f={})=>{let{action:d,method:m,encType:x,formData:p,body:y}=Nb(r,l);if(f.navigate===!1){let S=f.fetcherKey||Qb();await a.fetch(S,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 Kb(a,{relative:l}={}){let{basename:i}=h.useContext(an),r=h.useContext(Rn);$e(r,"useFormAction must be used inside a RouteContext");let[f]=r.matches.slice(-1),d={...Qs(a||".",{relative:l})},m=Ta();if(a==null){d.search=m.search;let x=new URLSearchParams(d.search),p=x.getAll("index");if(p.some(S=>S==="")){x.delete("index"),p.filter(b=>b).forEach(b=>x.append("index",b));let S=x.toString();d.search=S?`?${S}`:""}}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])),Ls(d)}function Zb(a,{relative:l}={}){let i=h.useContext(L0);$e(i!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Z0("useViewTransitionState"),f=Qs(a,{relative:l});if(!i.isTransitioning)return!1;let d=Tn(i.currentLocation.pathname,r)||i.currentLocation.pathname,m=Tn(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 Bu={type:"error",data:"parser error"},F0=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",J0=typeof ArrayBuffer=="function",I0=a=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(a):a&&a.buffer instanceof ArrayBuffer,af=({type:a,data:l},i,r)=>F0&&l instanceof Blob?i?r(l):Qp(l,r):J0&&(l instanceof ArrayBuffer||I0(l))?i?r(l):Qp(new Blob([l]),r):r(nn[a]+(l||"")),Qp=(a,l)=>{const i=new FileReader;return i.onload=function(){const r=i.result.split(",")[1];l("b"+(r||""))},i.readAsDataURL(a)};function Xp(a){return a instanceof Uint8Array?a:a instanceof ArrayBuffer?new Uint8Array(a):new Uint8Array(a.buffer,a.byteOffset,a.byteLength)}let gu;function Fb(a,l){if(F0&&a.data instanceof Blob)return a.data.arrayBuffer().then(Xp).then(l);if(J0&&(a.data instanceof ArrayBuffer||I0(a.data)))return l(Xp(a.data));af(a,!1,i=>{gu||(gu=new TextEncoder),l(gu.encode(i))})}const Kp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Os=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let a=0;a<Kp.length;a++)Os[Kp.charCodeAt(a)]=a;const Jb=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),S=new Uint8Array(y);for(r=0;r<i;r+=4)d=Os[a.charCodeAt(r)],m=Os[a.charCodeAt(r+1)],x=Os[a.charCodeAt(r+2)],p=Os[a.charCodeAt(r+3)],S[f++]=d<<2|m>>4,S[f++]=(m&15)<<4|x>>2,S[f++]=(x&3)<<6|p&63;return y},Ib=typeof ArrayBuffer=="function",lf=(a,l)=>{if(typeof a!="string")return{type:"message",data:W0(a,l)};const i=a.charAt(0);return i==="b"?{type:"message",data:Wb(a.substring(1),l)}:jr[i]?a.length>1?{type:jr[i],data:a.substring(1)}:{type:jr[i]}:Bu},Wb=(a,l)=>{if(Ib){const i=Jb(a);return W0(i,l)}else return{base64:!0,data:a}},W0=(a,l)=>{switch(l){case"blob":return a instanceof Blob?a:new Blob([a]);case"arraybuffer":default:return a instanceof ArrayBuffer?a:a.buffer}},P0="",Pb=(a,l)=>{const i=a.length,r=new Array(i);let f=0;a.forEach((d,m)=>{af(d,!1,x=>{r[m]=x,++f===i&&l(r.join(P0))})})},e1=(a,l)=>{const i=a.split(P0),r=[];for(let f=0;f<i.length;f++){const d=lf(i[f],l);if(r.push(d),d.type==="error")break}return r};function t1(){return new TransformStream({transform(a,l){Fb(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 hr(a){return a.reduce((l,i)=>l+i.length,0)}function mr(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 n1(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(hr(i)<1)break;const p=mr(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(hr(i)<2)break;const p=mr(i,2);f=new DataView(p.buffer,p.byteOffset,p.length).getUint16(0),r=3}else if(r===2){if(hr(i)<8)break;const p=mr(i,8),y=new DataView(p.buffer,p.byteOffset,p.length),S=y.getUint32(0);if(S>Math.pow(2,21)-1){x.enqueue(Bu);break}f=S*Math.pow(2,32)+y.getUint32(4),r=3}else{if(hr(i)<f)break;const p=mr(i,f);x.enqueue(lf(d?p:xu.decode(p),l)),r=0}if(f===0||f>a){x.enqueue(Bu);break}}}})}const eg=4;function et(a){if(a)return a1(a)}function a1(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")(),l1="arraybuffer";function tg(a,...l){return l.reduce((i,r)=>(a.hasOwnProperty(r)&&(i[r]=a[r]),i),{})}const s1=Yt.setTimeout,i1=Yt.clearTimeout;function Hr(a,l){l.useNativeTimers?(a.setTimeoutFn=s1.bind(Yt),a.clearTimeoutFn=i1.bind(Yt)):(a.setTimeoutFn=Yt.setTimeout.bind(Yt),a.clearTimeoutFn=Yt.clearTimeout.bind(Yt))}const r1=1.33;function o1(a){return typeof a=="string"?c1(a):Math.ceil((a.byteLength||a.size)*r1)}function c1(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 ng(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function u1(a){let l="";for(let i in a)a.hasOwnProperty(i)&&(l.length&&(l+="&"),l+=encodeURIComponent(i)+"="+encodeURIComponent(a[i]));return l}function f1(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 d1 extends Error{constructor(l,i,r){super(l),this.description=i,this.context=r,this.type="TransportError"}}class sf 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 d1(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=lf(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=u1(l);return i.length?"?"+i:""}}class h1 extends sf{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)};e1(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,Pb(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]=ng()),!this.supportsBinary&&!i.sid&&(i.b64=1),this.createUri(l,i)}}let ag=!1;try{ag=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const m1=ag;function p1(){}class g1 extends h1{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=tg(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=p1,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",Zp);else if(typeof addEventListener=="function"){const a="onpagehide"in Yt?"pagehide":"unload";addEventListener(a,Zp,!1)}}function Zp(){for(let a in tn.requests)tn.requests.hasOwnProperty(a)&&tn.requests[a].abort()}const x1=(function(){const a=lg({xdomain:!1});return a&&a.responseType!==null})();class y1 extends g1{constructor(l){super(l);const i=l&&l.forceBase64;this.supportsBinary=x1&&!i}request(l={}){return Object.assign(l,{xd:this.xd},this.opts),new tn(lg,this.uri(),l)}}function lg(a){const l=a.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!l||m1))return new XMLHttpRequest}catch{}if(!l)try{return new Yt[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const sg=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class v1 extends sf{get name(){return"websocket"}doOpen(){const l=this.uri(),i=this.opts.protocols,r=sg?{}:tg(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;af(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]=ng()),this.supportsBinary||(i.b64=1),this.createUri(l,i)}}const yu=Yt.WebSocket||Yt.MozWebSocket;class b1 extends v1{createSocket(l,i,r){return sg?new yu(l,i,r):i?new yu(l,i):new yu(l)}doWrite(l,i){this.ws.send(i)}}class S1 extends sf{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=n1(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=l.readable.pipeThrough(i).getReader(),f=t1();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 A1={websocket:b1,webtransport:S1,polling:y1},j1=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,N1=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function zu(a){if(a.length>8e3)throw"URI too long";const l=a,i=a.indexOf("["),r=a.indexOf("]");i!=-1&&r!=-1&&(a=a.substring(0,i)+a.substring(i,r).replace(/:/g,";")+a.substring(r,a.length));let f=j1.exec(a||""),d={},m=14;for(;m--;)d[N1[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=w1(d,d.path),d.queryKey=E1(d,d.query),d}function w1(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 E1(a,l){const i={};return l.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,f,d){f&&(i[f]=d)}),i}const Lu=typeof addEventListener=="function"&&typeof removeEventListener=="function",Nr=[];Lu&&addEventListener("offline",()=>{Nr.forEach(a=>a())},!1);class aa extends et{constructor(l,i){if(super(),this.binaryType=l1,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,l&&typeof l=="object"&&(i=l,l=null),l){const r=zu(l);i.hostname=r.host,i.secure=r.protocol==="https"||r.protocol==="wss",i.port=r.port,r.query&&(i.query=r.query)}else i.host&&(i.hostname=zu(i.host).host);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=f1(this.opts.query)),Lu&&(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=eg,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&&aa.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",aa.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+=o1(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(aa.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(),Lu&&(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}}}aa.protocol=eg;class C1 extends aa{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;aa.priorWebsocketSuccess=!1;const f=()=>{r||(i.send([{type:"ping",data:"probe"}]),i.once("packet",b=>{if(!r)if(b.type==="pong"&&b.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",i),!i)return;aa.priorWebsocketSuccess=i.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(S(),this.setTransport(i),i.send([{type:"upgrade"}]),this.emitReserved("upgrade",i),i=null,this.upgrading=!1,this.flush())})}else{const w=new Error("probe error");w.transport=i.name,this.emitReserved("upgradeError",w)}}))};function d(){r||(r=!0,S(),i.close(),i=null)}const m=b=>{const w=new Error("probe error: "+b);w.transport=i.name,d(),this.emitReserved("upgradeError",w)};function x(){m("transport closed")}function p(){m("socket closed")}function y(b){i&&b.name!==i.name&&d()}const S=()=>{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 q1=class extends C1{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=>A1[f]).filter(f=>!!f)),super(l,r)}};function M1(a,l="",i){let r=a;i=i||typeof location<"u"&&location,a==null&&(a=i.protocol+"//"+i.host),typeof a=="string"&&(a.charAt(0)==="/"&&(a.charAt(1)==="/"?a=i.protocol+a:a=i.host+a),/^(https?|wss?):\/\//.test(a)||(typeof i<"u"?a=i.protocol+"//"+a:a="https://"+a),r=zu(a)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const d=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+d+":"+r.port+l,r.href=r.protocol+"://"+d+(i&&i.port===r.port?"":":"+r.port),r}const T1=typeof ArrayBuffer=="function",R1=a=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(a):a.buffer instanceof ArrayBuffer,ig=Object.prototype.toString,k1=typeof Blob=="function"||typeof Blob<"u"&&ig.call(Blob)==="[object BlobConstructor]",_1=typeof File=="function"||typeof File<"u"&&ig.call(File)==="[object FileConstructor]";function rf(a){return T1&&(a instanceof ArrayBuffer||R1(a))||k1&&a instanceof Blob||_1&&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(rf(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 D1(a){const l=[],i=a.data,r=a;return r.data=Uu(i,l),r.attachments=l.length,{packet:r,buffers:l}}function Uu(a,l){if(!a)return a;if(rf(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]=Uu(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]=Uu(a[r],l));return i}return a}function O1(a,l){return a.data=Hu(a.data,l),delete a.attachments,a}function Hu(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]=Hu(a[i],l);else if(typeof a=="object")for(const i in a)Object.prototype.hasOwnProperty.call(a,i)&&(a[i]=Hu(a[i],l));return a}const B1=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],z1=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 L1{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=D1(l),r=this.encodeAsString(i.packet),f=i.buffers;return f.unshift(r),f}}function Fp(a){return Object.prototype.toString.call(a)==="[object Object]"}class of 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 U1(i),i.attachments===0&&super.emitReserved("decoded",i)):super.emitReserved("decoded",i)}else if(rf(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(of.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 Fp(i);case je.DISCONNECT:return i===void 0;case je.CONNECT_ERROR:return typeof i=="string"||Fp(i);case je.EVENT:case je.BINARY_EVENT:return Array.isArray(i)&&(typeof i[0]=="number"||typeof i[0]=="string"&&B1.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 U1{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=O1(this.reconPack,this.buffers);return this.finishedReconstruction(),i}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const H1=Object.freeze(Object.defineProperty({__proto__:null,Decoder:of,Encoder:L1,get PacketType(){return je},protocol:z1},Symbol.toStringTag,{value:"Module"}));function Xt(a,l,i){return a.on(l,i),function(){a.off(l,i)}}const V1=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class rg 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=[Xt(l,"open",this.onopen.bind(this)),Xt(l,"packet",this.onpacket.bind(this)),Xt(l,"error",this.onerror.bind(this)),Xt(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(V1.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 S=this.ids++,b=i.pop();this._registerAckCallback(S,b),m.id=S}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 Ml(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}Ml.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};Ml.prototype.reset=function(){this.attempts=0};Ml.prototype.setMin=function(a){this.ms=a};Ml.prototype.setMax=function(a){this.max=a};Ml.prototype.setJitter=function(a){this.jitter=a};class Vu 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 Ml({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||H1;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 q1(this.uri,this.opts);const i=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const f=Xt(i,"open",function(){r.onopen(),l&&l()}),d=x=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",x),l?l(x):this.maybeReconnectOnOpen()},m=Xt(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(Xt(l,"ping",this.onping.bind(this)),Xt(l,"data",this.ondata.bind(this)),Xt(l,"error",this.onerror.bind(this)),Xt(l,"close",this.onclose.bind(this)),Xt(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 rg(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 Ts={};function Er(a,l){typeof a=="object"&&(l=a,a=void 0),l=l||{};const i=M1(a,l.path||"/socket.io"),r=i.source,f=i.id,d=i.path,m=Ts[f]&&d in Ts[f].nsps,x=l.forceNew||l["force new connection"]||l.multiplex===!1||m;let p;return x?p=new Vu(r,l):(Ts[f]||(Ts[f]=new Vu(r,l)),p=Ts[f]),i.query&&!l.query&&(l.query=i.queryKey),p.socket(i.path,l)}Object.assign(Er,{Manager:Vu,Socket:rg,io:Er,connect:Er});const og="roverSettings",Y1=3600*24*365;function $1(a){try{const l=decodeURIComponent(a??"");return JSON.parse(l)}catch(l){return console.warn("Failed to parse settings cookie",l),null}}function Yu(){if(typeof document>"u")return{};const a=`${og}=`,l=document.cookie.split(";").map(r=>r.trim()).find(r=>r.startsWith(a));if(!l)return{};const i=l.substring(a.length);return $1(i)??{}}function Jp(a){if(typeof document>"u")return!1;try{const l=encodeURIComponent(JSON.stringify(a??{})),i=`${og}=${l}; path=/; max-age=${Y1}; samesite=strict`;return document.cookie=i,!0}catch(l){return console.warn("Failed to write settings cookie",l),!1}}const cg=window.location.origin;console.info("[socket] connecting to",cg);const G1=Yu(),Q1=G1?.page?.connectionTransport||"websocket",X1=Q1==="polling"?["polling"]:["websocket","polling"],cf=Er(cg,{transports:X1,timeout:15e3});cf.on("connect_error",a=>console.error("connect_error",a.code,a.message,a.data));const ug=h.createContext(cf),K1=({children:a})=>o.jsx(ug.Provider,{value:cf,children:a}),ln=()=>h.useContext(ug),fg=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 Z1(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 F1({children:a}){const l=ln(),i=Z1(l),[r,f]=h.useState(null),[d,m]=h.useState([]),[x,p]=h.useState([]),[y,S]=h.useState([]),[b,w]=h.useState(l.connected);h.useEffect(()=>{const C=()=>w(!0),A=()=>w(!1);return l.on("connect",C),l.on("disconnect",A),()=>{l.off("connect",C),l.off("disconnect",A)}},[l]),h.useEffect(()=>{function C(X){f(X)}function A(X=[]){m(X)}function q(X){m(U=>[...U.slice(-199),X])}function j(X=[]){p(X)}function k(X){p(U=>[...U.slice(-199),X])}return l.on("session:sync",C),l.on("log:init",A),l.on("log:entry",q),l.on("adminlog:init",j),l.on("adminlog:entry",k),l.on("alert:new",(X={})=>{S(U=>[...U.slice(-49),{...X,receivedAt:Date.now()}])}),()=>{l.off("session:sync",C),l.off("log:init",A),l.off("log:entry",q),l.off("adminlog:init",j),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=>S(A=>[...A.slice(-49),{...C,receivedAt:Date.now(),id:C.id||Math.random().toString(36).slice(2)}])}),[i]),N=h.useMemo(()=>({connected:b,session:r,logs:d,adminLogs:x,alerts:y,...M}),[M,x,y,b,d,r]);return o.jsx(fg.Provider,{value:N,children:a})}function _e(){return h.useContext(fg)}const dg=h.createContext({frames:{}});function J1({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(dg.Provider,{value:f,children:a})}function uf(){return h.useContext(dg).frames}function Tl(a){const l=uf();return a?l[a]??null:null}const I1=650,W1={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=W1[a];return l?{code:a,...l}:null}function P1(a,l={}){const i=l.holdMs||I1,[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),S=vu(a?.infraredCharacterOmni);!p&&!y&&!S||f(b=>({left:p?{...p,ts:x}:b.left,right:y?{...y,ts:x}:b.right,omni:S?{...S,ts:x}:b.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 b=new Date().toISOString();console.debug("[DockIR]",b,{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,j=q<=i;return{active:j,age:q,code:A.code,red:!!(A.red&&j),green:!!(A.green&&j),force:!!(A.force&&j)}},y=p(r.left),S=p(r.right),b=p(r.omni),w=y.force||S.force||b.force,M=y.active||S.active||b.active,N=y.active&&!S.active?"right":S.active&&!y.active?"left":"center",C=(S.active?1:0)-(y.active?1:0);return{visible:M,forceDetected:w,left:y,right:S,omni:b,bias:N,balance:Math.max(-1,Math.min(1,C))}},[r.left,r.right,r.omni,i,d])}function eS(){const{connected:a,session:l}=_e(),i=l?.assignment?.roverId,r=Tl(i),f=r?.sensors||{},d=P1(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,S=f.batteryCapacityMah;r?.receivedAt&&new Date(r.receivedAt).toLocaleTimeString();const b=r?.raw?r.raw:null,w=i?l?.activeDrivers?.[i]:null;return h.useMemo(()=>i?w?w===l?.socketId?"You":(l?.users||[]).find(N=>N.socketId===w)?.nickname||w.slice(0,6):"Available":"n/a",[w,i,l?.socketId,l?.users]),o.jsxs("section",{className:"panel-section space-y-0.5 text-base text-slate-100",children:[i?r?o.jsxs(o.Fragment,{children:[o.jsx(tS,{sensors:f,voltage:m,current:x,batteryTemp:p,charge:y,capacity:S}),o.jsx(nS,{sensors:f,dockState:d})]}):o.jsx("p",{className:"text-sm text-slate-500",children:"Waiting for sensor frames…"}):o.jsx("p",{className:"text-sm text-slate-500",children:"Assign a rover to view sensors."}),b&&o.jsx("pre",{className:"surface whitespace-pre-wrap break-words text-xs text-lime-300",children:b})]})}function tS({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 nS({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(vl,{title:"Dock IR",children:[o.jsx(aS,{sensors:a}),o.jsx(lS,{state:l})]}),o.jsxs(vl,{title:"Bumps & drops",children:[o.jsx(En,{label:"Bump L",value:o.jsx(Rs,{active:i.bumpLeft})}),o.jsx(En,{label:"Bump R",value:o.jsx(Rs,{active:i.bumpRight})}),o.jsx(En,{label:"Wheel drop L",value:o.jsx(Rs,{active:i.wheelDropLeft,tone:"amber"})}),o.jsx(En,{label:"Wheel drop R",value:o.jsx(Rs,{active:i.wheelDropRight,tone:"amber"})})]}),o.jsx(vl,{title:"Light bumps (raw)",children:f.map(x=>o.jsx(En,{label:x.label,value:ks(x.value)},x.label))}),o.jsx(vl,{title:"Cliff sensors",children:d.map(x=>o.jsx(En,{label:x.label,value:`${ks(x.value)} · ${x.active?"bool: true":"bool: false"}`},x.label))}),o.jsx(vl,{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:ks(x.value,"mA")}),x.over?o.jsx(Rs,{active:!0,tone:"red",label:"over"}):null]})},x.label))}),o.jsxs(vl,{title:"Dirt detect",children:[o.jsx(En,{label:"Left",value:ks(a?.dirtDetectLeft)}),o.jsx(En,{label:"Right",value:ks(a?.dirtDetect)})]})]})}function vl({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 Rs({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 ks(a,l){return a==null||Number.isNaN(a)?"--":l?`${a} ${l}`:a}function aS({sensors:a}){const l=a?.infraredCharacterLeft,i=a?.infraredCharacterRight,r=a?.infraredCharacterOmni,f=d=>o.jsx("span",{className:`rounded px-1 py-0.25 text-[0.7rem] font-semibold ${d?"bg-emerald-600 text-white":"bg-slate-700 text-slate-300"}`,children:d||"--"});return o.jsxs("div",{className:"flex items-center justify-between gap-0.5 text-xs text-slate-200",children:[o.jsxs("div",{className:"flex items-center gap-0.5",children:[o.jsx("span",{className:"text-slate-400",children:"L"}),f(l)]}),o.jsxs("div",{className:"flex items-center gap-0.5",children:[o.jsx("span",{className:"text-slate-400",children:"O"}),f(r)]}),o.jsxs("div",{className:"flex items-center gap-0.5",children:[o.jsx("span",{className:"text-slate-400",children:"R"}),f(i)]})]})}function lS({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 hg=h.createContext(null);function ff({children:a}){const[l,i]=h.useState(()=>({status:"loading",data:{}}));h.useEffect(()=>{const x=Yu();i({status:"ready",data:x??{}})},[]);const r=h.useCallback(()=>{const x=Yu();i({status:"ready",data:x??{}})},[]),f=h.useCallback(x=>{const p=Jp(x??{});return i(p?{status:"ready",data:x??{}}:y=>({...y,status:"error"})),p},[]),d=h.useCallback((x,p)=>{i(y=>{const S=y.data[x]||{},b=typeof p=="function"?p(S):{...S,...p??{}},w={...y.data,[x]:b};return Jp(w)?{status:"ready",data:w}:{...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(hg.Provider,{value:m,children:a})}function sS(){const a=h.useContext(hg);if(!a)throw new Error("useSettings must be used within SettingsProvider");return a}function dt(a,l={}){const{data:i,status:r,setNamespace:f}=sS(),d=i[a]??l??{},m=h.useCallback(y=>{f(a,S=>{const b=S??{};return typeof y=="function"?y(b):{...b,...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 iS(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 df({panelId:a="replay-sources",fillHeight:l=!1}){const{session:i,triggerReplay:r}=_e(),f=iS(i?.replaySources||[]),{value:d,save:m}=dt("replaySources",{}),[x,p]=h.useState([]),[y,S]=h.useState(!1),[b,w]=h.useState(null),[M,N]=h.useState(null),C=i?.replay||null,[A,q]=h.useState(0),j=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(j)},[d?.[a],j,a]),h.useEffect(()=>{const G=new Set(f.map(te=>te.key));p(te=>te.filter(Z=>G.has(Z)))},[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 Z=C.lastTriggeredAt+C.cooldownMs-Date.now();q(Math.max(0,Z))};G();const te=setInterval(G,250);return()=>clearInterval(te)},[C?.lastTriggeredAt,C?.cooldownMs,C?.remainingMs]);const X=y||i?.mode==="lockdown"||A>0||!x.length,U=G=>{p(te=>{const Z=te.includes(G)?te.filter(W=>W!==G):[...te,G];return m(W=>({...W||{},[a]:Z})),Z}),N(null)},Y=async()=>{if(!X){S(!0),w(null),N(null);try{const G=x.map(te=>{const[Z,W]=te.split(":");return{type:Z,id:W}});await r(G),N("Replay sent. Check the Discord replay channel.")}catch(G){w(G.message)}finally{S(!1)}}},z=l?"h-full flex flex-col":"",I=l?"flex-1 min-h-0 overflow-y-auto":"";return o.jsxs("section",{className:`panel-section p-0.75 text-sm ${z}`,children:[o.jsxs("header",{className:"panel-muted flex items-center justify-between text-xs",children:[o.jsx("span",{children:"Replay Sources"}),o.jsx("span",{children:f.length})]}),o.jsxs("div",{className:`grid gap-0.5 md:grid-cols-2 ${I}`,children:[o.jsx(Ip,{title:"Rovers",items:k.rovers,selected:x,onToggle:U}),o.jsx(Ip,{title:"Room Cams",items:k.rooms,selected:x,onToggle:U})]}),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:Y,disabled:X,children:A>0?`Replay (${Math.ceil(A/1e3)}s)`:y?"Replay…":"Replay"}),b?o.jsx("div",{className:"text-xs text-amber-400",children:b}):null,M?o.jsx("div",{className:"text-xs text-emerald-300",children:M}):null]})]})}function Ip({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 mg={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Wp=Ma.createContext&&Ma.createContext(mg),rS=["attr","size","title"];function oS(a,l){if(a==null)return{};var i=cS(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 cS(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 Pp(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?Pp(Object(i),!0).forEach(function(r){uS(a,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(i)):Pp(Object(i)).forEach(function(r){Object.defineProperty(a,r,Object.getOwnPropertyDescriptor(i,r))})}return a}function uS(a,l,i){return l=fS(l),l in a?Object.defineProperty(a,l,{value:i,enumerable:!0,configurable:!0,writable:!0}):a[l]=i,a}function fS(a){var l=dS(a,"string");return typeof l=="symbol"?l:l+""}function dS(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 pg(a){return a&&a.map((l,i)=>Ma.createElement(l.tag,kr({key:i},l.attr),pg(l.child)))}function gg(a){return l=>Ma.createElement(hS,Rr({attr:kr({},a.attr)},l),pg(a.child))}function hS(a){var l=i=>{var{attr:r,size:f,title:d}=a,m=oS(a,rS),x=f||i.size||"1em",p;return i.className&&(p=i.className),a.className&&(p=(p?p+" ":"")+a.className),Ma.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&&Ma.createElement("title",null,d),a.children)};return Wp!==void 0?Ma.createElement(Wp.Consumer,null,i=>l(i)):l(mg)}function xg(a){return gg({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 mS(a){return gg({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 pS(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 gS(a){const l=new Date(a);return`${l.getHours().toString().padStart(2,"0")}:${l.getMinutes().toString().padStart(2,"0")}`}function e0(a){return a.nickname||a.socketId?.slice(0,6)||"unknown"}function xS({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 yg({message:a}){const l=a.fromDiscord?`${a.discordGuildName||"Discord"} · ${e0(a)}`:null;return o.jsxs(o.Fragment,{children:[a.fromDiscord?o.jsxs(o.Fragment,{children:[o.jsx(xg,{className:"h-3.5 w-3.5 text-indigo-200"}),o.jsx(xS,{guildIconUrl:a.discordGuildIconUrl,userAvatarUrl:a.discordUserAvatarUrl,label:l})]}):null,o.jsx("span",{className:`font-semibold text-[0.85rem] ${pS(a.role)}`,children:e0(a)}),a.roverId&&o.jsx("span",{className:"rounded bg-slate-800 px-1 text-[0.7rem]",children:a.roverId})]})}function vg(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 bg({message:a}){return o.jsxs("div",{className:vg(a),children:[o.jsx(yg,{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:gS(a.ts)})]})}function Sg({message:a}){return o.jsxs("div",{className:`${vg(a)} italic opacity-80 border-slate-600/40 bg-slate-900/40`,children:[o.jsx(yg,{message:a}),o.jsx("span",{className:"text-slate-300",children:"typing..."})]})}const yS=3e3,vS="#2196f3";function bS(a){return a.id?a.id:a.timestamp?`${a.timestamp}-${a.message}`:`${a.title||"alert"}-${a.message}`}function hf({scale:a=1}){const{alerts:l}=_e(),[i,r]=h.useState(()=>Date.now()),f=h.useMemo(()=>l.slice(-3).map(p=>({alert:p,key:bS(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<=yS);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(SS,{alert:p.alert},p.key))})}function t0(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 SS({alert:a}){if(a.kind==="chat"&&a.payload)return o.jsx(bg,{message:a.payload});if(a.kind==="chat-typing"&&a.payload)return o.jsx(Sg,{message:a.payload});const l=t0(a.color)||t0(vS),i=l?`rgba(${l.r}, ${l.g}, ${l.b}, 0.18)`:"rgba(33, 150, 243, 0.18)",r=l?`rgba(${l.r}, ${l.g}, ${l.b}, 0.45)`:"rgba(33, 150, 243, 0.45)";return o.jsx("div",{className:"pointer-events-auto max-w-[80vw] rounded-full border px-2 py-0.5 text-[0.7rem] leading-tight text-slate-100 shadow-sm shadow-black/30",style:{backgroundColor:i,border:`1px solid ${r}`},children:o.jsxs("p",{className:"truncate text-slate-100",children:[o.jsx("span",{className:"text-slate-300",children:a.title||"Alert"}),o.jsx("span",{className:"text-slate-500",children:" · "}),o.jsx("span",{className:"text-white",children:a.message})]})})}const bl={main:[-127,127],side:[-127,127],vacuum:[0,127]},bu={maxSpeed:500,baseSpeed:250,boostSpeed:400},$u=100,mf=[31,127],Nl=60,Gu=8,AS=250,jS={start:[128],safe:[131],full:[132],passive:[128],dock:[143]},Bs={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"]},Ag=[{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:$u},{type:"oi",command:"dock"},{type:"pause",duration:$u},{type:"oi",command:"full"}]},{id:"seek-dock",label:"Dock",description:"Send the seek dock command.",steps:[{type:"oi",command:"dock"}]}];function Qu(){return{vector:{x:0,y:0,boost:!1},speeds:{left:0,right:0},source:null,lastUpdatedAt:0}}function Xu(){return{main:0,side:0,vacuum:0}}function NS(){return{enabled:!1,angle:null,config:null}}function Cr(){return{note:Nl}}const n0={roverId:null,mode:"drive",drive:Qu(),aux:Xu(),camera:NS(),song:Cr(),lastControlIntentAt:0,macros:Ag,keymap:Bs,inputs:{}};function wS(a,l){switch(l.type){case"control/set-rover":return{...a,roverId:l.payload??null,drive:l.payload?a.drive:Qu(),aux:l.payload?a.aux:Xu(),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:Qu(),aux:Xu(),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??Nl}};default:return a}}function wl(a,l,i){return typeof a!="number"||Number.isNaN(a)?l:Math.max(l,Math.min(i,a))}function El(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:wl(a,l[0],l[1])}function ES(a={}){const l=El(a.x??0),i=El(a.y??0);return{x:l,y:i,boost:!!a.boost}}function CS(a={},l={}){const i=ES(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:wl(Math.round(x+p),-r,r),right:wl(Math.round(x-p),-r,r)}}}function qS(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 a0(a){return new Promise(l=>setTimeout(l,a))}function MS(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(j=>String(j.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.useCallback((j,k)=>{d&&r.emit("command",{roverId:d,...j},k)},[r,d]),S=h.useCallback(()=>{d&&y({type:"sensorStream",data:{sensorStream:{enable:!0}}})},[y,d]),b=h.useCallback(j=>{if(!d)return null;const k={left:Vt(j?.left??0,[-500,500]),right:Vt(j?.right??0,[-500,500])},X=l?l(k):k,U={left:Vt(X?.left??0,[-500,500]),right:Vt(X?.right??0,[-500,500])};return y({type:"drive",data:{driveDirect:U}}),U},[l,y,d]),w=h.useCallback(({main:j=0,side:k=0,vacuum:X=0}={})=>{if(!d)return null;const U={main:Vt(j,bl.main),side:Vt(k,bl.side),vacuum:Vt(X,bl.vacuum)},Y=i?i(U):U,z={main:Vt(Y?.main??0,bl.main),side:Vt(Y?.side??0,bl.side),vacuum:Vt(Y?.vacuum??0,bl.vacuum)};return y({type:"motors",data:{motorPwm:z}}),z},[i,y,d]),M=h.useCallback(j=>!d||!x?null:(y({type:"servo",data:{servo:{angle:j}}}),j),[y,d,x]),N=h.useCallback(j=>{if(!d)return!1;const k=Array.isArray(j)?j:typeof j=="string"?jS[j]:null;return k?(y({type:"raw",data:{raw:qS(k)}}),S(),!0):!1},[y,S,d]),C=h.useCallback(async j=>{if(!(!j||!Array.isArray(j.steps)||!d))for(const k of j.steps){if(!d)break;switch(k.type){case"oi":N(k.command);break;case"drive":b(k.speeds??{left:0,right:0});break;case"motors":w(k.values??{});break;case"servo":M(k.angle);break;case"pause":await a0(k.duration??$u);break}if(k.delay||k.delayMs){const X=k.delayMs??k.delay;typeof X=="number"&&X>0&&await a0(X)}}},[d,N,b,w,M]),A=h.useCallback((j="toggle")=>!d||!p?null:(y({type:"nightVision",data:{nightVision:{action:j}}}),j),[y,p,d]),q=h.useCallback((j=[],k={})=>{if(!d)return null;const U=(Array.isArray(j)&&j.length>0?j:[{note:Nl,duration:Gu}]).slice(0,16).map(Y=>({note:Vt(Math.round(Y?.note??Nl),mf),duration:Vt(Math.round(Y?.duration??Gu),[1,255])}));return y({type:"song",data:{song:{notes:U,slot:k.slot,loop:k.loop}}}),U},[y,d]);return h.useMemo(()=>({roverId:d,rosterEntry:m,servoConfig:x,nightVision:p,emitCommand:y,enableSensorStream:S,sendDriveDirect:b,sendAuxMotors:w,sendServoAngle:M,sendOiCommand:N,sendNightVision:A,sendSong:q,runMacroSteps:C}),[d,m,x,p,y,S,b,w,M,N,A,C])}const TS={"{":"[","}":"]",":":";",'"':"'","<":",",">":".","?":"/","|":"\\",_:"-","+":"="},l0={"[":"BracketLeft","]":"BracketRight","\\":"Backslash",";":"Semicolon","'":"Quote",",":"Comma",".":"Period","/":"Slash","-":"Minus","=":"Equal","`":"Backquote"};function Xs(a){if(typeof a!="string")return"";const l=a.toLowerCase();return TS[l]??l}function RS(a){const l=Xs(a);if(!l)return null;if(l0[l])return l0[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 jg(a){const l=Xs(a);return l?`key:${l}`:null}function kS(a){const l=RS(a);return l?`code:${l}`:null}function s0(a){const l=new Set,i=jg(a?.key??"");i&&l.add(i);const r=a?.code?`code:${a.code}`:null;return r&&l.add(r),Array.from(l)}function _S(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=jg(String(d));m&&f.add(m);const x=kS(String(d));x&&f.add(x)}),[l,f]}))}function la(a){const l=Xs(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 Al=[{key:"drive",motors:["leftWheel","rightWheel"]},{key:"aux",motors:["mainBrush","sideBrush"]}],DS={downRatePerSec:.15,upRatePerSec:.7,releaseDelaySec:1,outputRateMs:250};function i0(){return Al.reduce((a,l)=>(a[l.key]={cap:1,clearSec:0},a),{})}function r0(a){return Number.isFinite(a)?Math.max(0,Math.min(1,a)):0}function OS(a,l={}){const{session:i}=_e(),d=(Tl(a)?.sensors||{})?.wheelOvercurrents||{},m=h.useMemo(()=>({...DS,...l.config||{}}),[l.config]),[x,p]=h.useState(()=>i0()),y=h.useRef(typeof performance<"u"?performance.now():Date.now()),S=h.useRef(d);h.useEffect(()=>{S.current=d||{}},[d]),h.useEffect(()=>{p(i0())},[a]),h.useEffect(()=>{const N=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(j=>{let k=!1;const X={},U=Number.isFinite(m.downRatePerSec)?Math.max(0,m.downRatePerSec):0,Y=Number.isFinite(m.upRatePerSec)?Math.max(0,m.upRatePerSec):0,z=Number.isFinite(m.releaseDelaySec)?Math.max(0,m.releaseDelaySec):0;return Al.forEach(I=>{const G=j[I.key]||{cap:1,clearSec:0},te=Number.isFinite(G.cap)?G.cap:1,Z=Number.isFinite(G.clearSec)?G.clearSec:0,W=I.motors.some(B=>!!S.current?.[B]),se=W?0:Z+q,ue=!W&&se>=z,ae=r0(W?te-U*q:ue?te+Y*q:te);(Math.abs(ae-te)>1e-4||Math.abs(se-Z)>1e-4)&&(k=!0),X[I.key]={cap:ae,clearSec:se}}),k?X:j})},100);return()=>clearInterval(N)},[m.downRatePerSec,m.releaseDelaySec,m.upRatePerSec]);const b=h.useMemo(()=>{const N=Al.reduce((C,A)=>{const q=x?.[A.key],j=Number.isFinite(q?.cap)?q.cap:1;return C[A.key]=r0(j),C},{});return{perGroup:N,drive:{left:N.drive??1,right:N.drive??1},aux:{main:N.aux??1,side:N.aux??1,vacuum:1}}},[x]),w=h.useMemo(()=>{const N={};Al.forEach(A=>{A.motors.forEach(q=>{N[q]=!!d?.[q]})});const C=Al.reduce((A,q)=>(A[q.key]=q.motors.some(j=>!!d?.[j]),A),{});return{motors:N,groups:C}},[d]),M=i?.role==="admin"||i?.role==="lockdown"||i?.role==="lockdown-admin";return h.useMemo(()=>({caps:x,overcurrent:w,scales:b,isActive:(b?.drive?.left??1)<1||(b?.drive?.right??1)<1||(b?.aux?.main??1)<1||(b?.aux?.side??1)<1,config:m,adminImmune:M}),[x,w,b,m,M])}function BS(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 zS(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 Ng=h.createContext(null);function o0(a){return Object.fromEntries(Object.entries(a||{}).map(([l,i])=>[l,Array.isArray(i)?[...i]:[]]))}function LS(a,l){if(!a)return l;const i=typeof a.minAngle=="number"?a.minAngle:-45,r=typeof a.maxAngle=="number"?a.maxAngle:45;return wl(l,i,r)}function US({children:a}){const[l,i]=h.useReducer(wS,n0),r=h.useRef(null),f=h.useRef(!1),d=h.useRef(n0.camera.angle),{value:m,save:x}=dt("controls",{keymap:Bs,macros:Ag}),{session:p,homeAssistantSetState:y}=_e(),S=p?.assignment?.roverId??null,b=OS(S),w=h.useCallback(_=>BS(_,b.scales,b.adminImmune),[b.adminImmune,b.scales]),M=h.useCallback(_=>zS(_,b.scales,b.adminImmune),[b.adminImmune,b.scales]),N=MS({driveTransform:w,auxTransform:M}),C=h.useCallback(()=>{const V=(p?.homeAssistant?.entities||[]).filter(ee=>(ee.type==="light"||ee.type==="switch")&&ee.available!==!1&&ee.state!=="on");if(V.length===0){f.current=!1;return}f.current=!0,V.forEach(ee=>{y(ee.id,"on").catch(()=>{})}),f.current=!1},[p?.homeAssistant?.entities,y]);h.useEffect(()=>{i({type:"control/set-rover",payload:N.roverId})},[N.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 _={...Bs,...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 _=N.servoConfig;if(!_){i({type:"control/set-camera-config",payload:{config:null}}),d.current=null;return}const V=typeof _.minAngle=="number"?_.minAngle:-45,ee=typeof _.maxAngle=="number"?_.maxAngle:45,ne=typeof _.homeAngle=="number"?_.homeAngle:(V+ee)/2,re=typeof d.current=="number"?wl(d.current,V,ee):null,we=re??wl(ne,V,ee);i({type:"control/set-camera-config",payload:{config:_,angle:we}}),d.current=we},[N.servoConfig]),h.useEffect(()=>{d.current=typeof l.camera.angle=="number"?l.camera.angle:d.current},[l.camera.angle]),h.useEffect(()=>{N.roverId&&N.enableSensorStream()},[N.roverId,N.enableSensorStream]);const A=h.useCallback(_=>{i({type:"control/set-mode",payload:_})},[]),q=h.useCallback(()=>{i({type:"control/record-intent"})},[]),j=h.useRef(l.drive.speeds),k=h.useRef(l.aux),X=h.useMemo(()=>JSON.stringify(b.scales),[b.scales]),U=h.useRef(0),Y=h.useRef(0);h.useEffect(()=>{j.current=l.drive.speeds},[l.drive.speeds]),h.useEffect(()=>{k.current=l.aux},[l.aux]),h.useEffect(()=>{if(!N.roverId||b.adminImmune||!b.isActive)return;const _=Math.max(0,Number(b?.config?.outputRateMs)||0),V=typeof performance<"u"?performance.now():Date.now(),ee=j.current||{left:0,right:0},ne=k.current||{main:0,side:0,vacuum:0},re=!!(ee.left||ee.right),we=!!(ne.main||ne.side||ne.vacuum);!re&&!we||(re&&V-U.current>=_&&(U.current=V,N.sendDriveDirect(ee)),we&&V-Y.current>=_&&(Y.current=V,N.sendAuxMotors(ne)))},[X,b.adminImmune,b.config,b.isActive,N]);const z=h.useCallback((_,V={})=>{const ee=CS(_,V.speedOptions);i({type:"control/update-drive",payload:{...ee,source:V.source??null}}),q(),N.sendDriveDirect(ee.speeds)},[N,q]),I=h.useCallback((_={})=>{const V=N.sendAuxMotors(_)??_;i({type:"control/set-aux-motors",payload:V}),q()},[N,q]),G=h.useCallback((_,V)=>{if(!_)return!1;const ee=Xs(V);if(!ee)return!1;const ne=o0(l.keymap);return ne[_]=[ee],i({type:"control/set-keymap",payload:ne}),x(re=>({...re??{},keymap:ne})),!0},[l.keymap,x]),te=h.useCallback(()=>{const _=o0(Bs);i({type:"control/set-keymap",payload:_}),x(V=>({...V??{},keymap:_}))},[x]),Z=h.useCallback(_=>{if(!N.servoConfig)return;const V=LS(N.servoConfig,_);i({type:"control/set-camera-angle",payload:V}),N.sendServoAngle(V),d.current=V,q()},[N,q]),W=h.useCallback((_=0)=>{const V=N.servoConfig;if(!V)return;const ee=typeof _=="number"&&_!==0?_:V.nudgeDegrees||1,ne=typeof d.current=="number"?d.current:typeof V.homeAngle=="number"?V.homeAngle:0;Z(ne+ee)},[N.servoConfig,Z]),se=h.useCallback(()=>{const _=N.servoConfig;if(!_)return;const V=typeof _.homeAngle=="number"?_.homeAngle:typeof _.minAngle=="number"&&typeof _.maxAngle=="number"?(_.minAngle+_.maxAngle)/2:0;Z(V)},[N.servoConfig,Z]),ue=h.useCallback(async _=>{const V=l.macros.find(ee=>ee.id===_)||null;V&&(_==="drive-sequence"?(C(),p?.homeAssistant?.entities||(f.current=!0),q()):_==="seek-dock"&&q(),await N.runMacroSteps(V))},[N,q,p?.homeAssistant?.entities,l.macros,C]),ae=h.useCallback(()=>{i({type:"control/update-drive",payload:{vector:{x:0,y:0,boost:!1},speeds:{left:0,right:0},source:"system-stop"}}),N.sendDriveDirect({left:0,right:0}),N.sendAuxMotors({main:0,side:0,vacuum:0})},[N]),B=h.useCallback(_=>{N.sendOiCommand(_)},[N]),P=h.useCallback(_=>{N.roverId&&N.emitCommand({type:"sensorStream",data:{sensorStream:{enable:_}}})},[N]),le=h.useCallback(()=>{N.sendNightVision("toggle"),q()},[N,q]),ce=h.useCallback(_=>{const V=typeof _=="number"?_:Nl;return i({type:"control/set-song-note",payload:V}),V},[]),he=h.useCallback((_,V)=>N.sendSong(_,V),[N]),E=h.useCallback((_,V)=>{i({type:"control/register-input-state",payload:{source:_,state:V}})},[]),O=h.useMemo(()=>({state:l,dispatch:i,pipeline:N,overcurrentLimiter:b,actions:{setMode:A,setDriveVector:z,setAuxMotors:I,setServoAngle:Z,nudgeServo:W,goServoHome:se,runMacro:ue,stopAllMotion:ae,sendOiCommand:B,setSensorStream:P,toggleNightVision:le,updateKeyBinding:G,resetKeyBindings:te,registerInputState:E,setSongNote:ce,sendSong:he}}),[l,N,b,A,z,I,Z,W,se,ue,ae,B,P,le,G,te,E,ce,he]);return o.jsx(Ng.Provider,{value:O,children:a})}function ht(){const a=h.useContext(Ng);if(!a)throw new Error("useControlSystem must be used within ControlSystemProvider");return a}const HS="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=",wg=h.createContext({messages:[],typing:[],sendMessage:async()=>{},focusChat:()=>{},blurChat:()=>{},registerInputRef:()=>{},onInputFocus:()=>{},onInputBlur:()=>{},setTypingActive:()=>{},isChatFocused:!1});function VS({children:a}){const l=ln(),{session:i,pushAlert:r}=_e(),[f,d]=h.useState([]),[m,x]=h.useState([]),[p,y]=h.useState(!1),S=h.useRef(null),b=h.useRef(null),w=h.useRef(null),M=h.useRef(new Map),N=h.useRef(new Map),C=h.useRef({isTyping:!1,lastSent:0}),A=h.useCallback(()=>{const Z=Array.from(M.current.values()).sort((W,se)=>W.lastUpdate-se.lastUpdate).map(W=>W.payload);x(Z)},[]),q=h.useCallback(Z=>!Z||typeof Z!="object"?null:Z.typingId?Z.typingId:Z.fromDiscord?`discord:${Z.discordUserId||Z.discordUserName||Z.nickname||"unknown"}`:`socket:${Z.socketId||Z.nickname||"unknown"}`,[]);h.useEffect(()=>{w.current=new Audio(HS),w.current.load()},[]);const j=h.useCallback(()=>{const Z=w.current;Z&&(Z.currentTime=0,Z.play().catch(()=>{}))},[]);h.useEffect(()=>{function Z(W={}){d(se=>[...se.slice(-99),W]),!(W?.socketId&&i?.socketId&&W.socketId===i.socketId)&&(j(),r?.({kind:"chat",payload:W,id:`chat-${W.id||Math.random().toString(36).slice(2)}`,receivedAt:Date.now()}))}return l.on("chat:message",Z),()=>{l.off("chat:message",Z)}},[j,i?.socketId,l]),h.useEffect(()=>{function Z(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 ae=N.current.get(se)||0;ue-ae>=2500&&(N.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",Z),()=>{l.off("chat:typing",Z)}},[r,A,q,i?.socketId,l]),h.useEffect(()=>{const Z=setInterval(()=>{const W=Date.now();let se=!1;M.current.forEach((ue,ae)=>{ue.expiresAt<=W&&(M.current.delete(ae),se=!0)}),se&&A()},2e3);return()=>clearInterval(Z)},[A]),h.useEffect(()=>{function Z(W=[]){Array.isArray(W)&&d(se=>{if(se.length===0)return W.slice(-100);const ue=new Set(W.map(B=>B?.id));return[...W,...se.filter(B=>B?.id&&!ue.has(B.id))].slice(-100)})}return l.on("chat:init",Z),()=>{l.off("chat:init",Z)}},[l]);const k=h.useCallback(Z=>{const W=!!Z,se=Date.now(),ue=C.current,ae=!W&&ue.isTyping;!(W&&(!ue.isTyping||se-ue.lastSent>=3500))&&!ae||(C.current={isTyping:W,lastSent:se},l.emit("chat:typing",{isTyping:W}))},[l]),X=h.useCallback((Z,W=null)=>new Promise((se,ue)=>{l.emit("chat:send",{text:Z,tts:W},(ae={})=>{ae.error?ue(new Error(ae.error)):se(ae)})}),[l]),U=h.useCallback((Z,W={})=>{(W?.target==="hud"?"hud":"panel")==="hud"?b.current=Z:S.current=Z},[]),Y=h.useCallback(()=>{y(!0),(b.current||S.current)?.focus()},[]),z=h.useCallback(()=>{y(!1),b.current?.blur(),S.current?.blur()},[]),I=h.useCallback(()=>y(!0),[]),G=h.useCallback(()=>y(!1),[]),te=h.useMemo(()=>({messages:f,sendMessage:X,focusChat:Y,blurChat:z,registerInputRef:U,onInputFocus:I,onInputBlur:G,setTypingActive:k,typing:m,isChatFocused:p,selfSocketId:i?.socketId||null}),[z,Y,p,f,G,I,U,X,i?.socketId,k,m]);return o.jsx(wg.Provider,{value:te,children:a})}function pf(){const a=h.useContext(wg);if(!a)throw new Error("useChat must be used inside ChatProvider");return a}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}]}}},na={activeSignature:null,profiles:{},defaults:{profile:qn}},Su="keyboard",Au={x:0,y:0,boost:!1},ju={main:0,side:0,vacuum:0},c0=mf[0],u0=mf[1],gf=5,Us=500,Hs=1,xf=100;function Nu(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(0,Math.min(500,i)):l}function YS(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(gf,Math.min(Us,i)):l}function Eg(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(Hs,Math.min(xf,i)):l}function $S(a){const i=(Eg(a,a)-Hs)/(xf-Hs),r=Us-i*(Us-gf);return Math.round(r)}function GS(a){const l=YS(a,a),i=(Us-l)/(Us-gf),r=Hs+i*(xf-Hs);return Math.round(r)}function QS(a){const l=a.target;if(!l)return!1;const i=l.tagName;return i==="INPUT"||i==="TEXTAREA"||l.isContentEditable||i==="SELECT"}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 XS(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 S=x?.4:1;return{x:y*S,y:p*S,boost:m&&!x}}function KS(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 ZS(){const{state:a,actions:{setMode:l,setDriveVector:i,setAuxMotors:r,nudgeServo:f,runMacro:d,stopAllMotion:m,registerInputState:x,toggleNightVision:p,setSongNote:y,sendSong:S}}=ht(),{session:b,homeAssistantSetState:w}=_e(),{focusChat:M,blurChat:N,isChatFocused:C}=pf(),{value:A}=dt("inputs",en),q=h.useMemo(()=>_S(a.keymap),[a.keymap]),j=h.useMemo(()=>{const O=new Set;return Object.values(q).forEach(_=>{_&&_.forEach(V=>O.add(V))}),O},[q]),k=h.useMemo(()=>{const O=en.keyboard,_=A?.keyboard??{};return{baseSpeed:Nu(_.baseSpeed,O.baseSpeed),turboSpeed:Nu(_.turboSpeed,O.turboSpeed),precisionSpeed:Nu(_.precisionSpeed,O.precisionSpeed)}},[A?.keyboard]),X=h.useMemo(()=>{const O=en.keyboard,_=A?.keyboard??{},V=Eg(typeof _.tiltSpeed=="number"?_.tiltSpeed:typeof _.tiltIntervalMs=="number"?GS(_.tiltIntervalMs):O.tiltSpeed,O.tiltSpeed);return $S(V)},[A?.keyboard]),U=h.useMemo(()=>Math.abs(a.camera?.config?.nudgeDegrees||1),[a.camera?.config?.nudgeDegrees]),Y=h.useRef(new Set),z=h.useRef(Au),I=h.useRef(ju),G=h.useRef(null),te=h.useRef(null),Z=h.useCallback(()=>{const O=new Set(Y.current);Pe(q.boostModifier,O);const V=Pe(q.slowModifier,O)?{baseSpeed:k.precisionSpeed,boostSpeed:k.precisionSpeed}:{baseSpeed:k.baseSpeed,boostSpeed:k.turboSpeed},ee=XS(O,q),ne=KS(O,q);(ee.x!==z.current.x||ee.y!==z.current.y||ee.boost!==z.current.boost)&&(z.current=ee,i(ee,{source:Su,speedOptions:V})),(ne.main!==I.current.main||ne.side!==I.current.side||ne.vacuum!==I.current.vacuum)&&(I.current=ne,r(ne)),x(Su,{keys:Array.from(O),vector:ee,aux:ne})},[q,k,x,r,i]),W=h.useCallback(()=>{G.current&&(clearTimeout(G.current),G.current=null)},[]),se=h.useCallback(()=>{const O=new Set(Y.current),_=Pe(q.cameraUp,O),V=Pe(q.cameraDown,O);return(_?1:0)-(V?1:0)},[q]),ue=h.useCallback(()=>{if(se()===0){W();return}if(G.current)return;const _=()=>{const V=se();if(V===0){W();return}f(V*U),G.current=setTimeout(_,X)};G.current=setTimeout(_,0)},[se,f,X,U,W]),ae=h.useCallback(()=>{te.current&&(clearTimeout(te.current),te.current=null)},[]),B=h.useCallback(()=>{const O=new Set(Y.current),_=Pe(q.songNoteUp,O),V=Pe(q.songNoteDown,O);return(_?1:0)-(V?1:0)},[q]),P=h.useCallback(O=>{if(O===0)return;let V=(typeof a.song?.note=="number"?a.song.note:Nl)+O;V>u0?V=c0:V<c0&&(V=u0);const ee=y(V);S([{note:ee,duration:Gu}],{slot:0})},[S,y,a.song?.note]),le=h.useCallback(()=>{if(B()===0){ae();return}if(te.current)return;const _=()=>{const V=B();if(V===0){ae();return}P(V),te.current=setTimeout(_,AS)};te.current=setTimeout(_,0)},[B,ae,P]),ce=h.useCallback(()=>{Y.current.clear(),z.current=Au,I.current=ju,W(),ae(),m(),x(Su,{keys:[],vector:Au,aux:ju})},[x,m,W,ae]),he=h.useCallback(O=>{const _=b?.homeAssistant;if(!_?.enabled||!_?.connected)return;const ee=(_.entities||[]).filter(ne=>(ne.type==="light"||ne.type==="switch")&&ne.available!==!1&&ne.state!=="unavailable");if(ee.length!==0){if(O==="on"){const ne=ee.find(re=>re.state!=="on");ne&&w(ne.id,"on").catch(()=>{});return}if(O==="off")for(let ne=ee.length-1;ne>=0;ne-=1){const re=ee[ne];if(re.state==="on"){w(re.id,"off").catch(()=>{});break}}}},[w,b?.homeAssistant]);h.useEffect(()=>{function O(ee){if(QS(ee))return;const ne=s0(ee);if(ne.length===0)return;const re=new Set(ne);if(Pe(q.chatFocus,re)){ee.preventDefault(),ce(),C||M();return}ne.some(xe=>j.has(xe))&&ee.preventDefault();const we=ne.filter(xe=>!Y.current.has(xe));we.forEach(xe=>Y.current.add(xe)),we.length>0&&(we.some(xe=>q.driveMacro?.has(xe))?(l("drive"),d("drive-sequence")):we.some(xe=>q.dockMacro?.has(xe))?(l("dock"),d("seek-dock")):we.some(xe=>q.nightVisionToggle?.has(xe))?p():we.some(xe=>q.homeAssistantOn?.has(xe))?he("on"):we.some(xe=>q.homeAssistantOff?.has(xe))&&he("off")),ue(),le(),Z()}function _(ee){s0(ee).forEach(re=>Y.current.delete(re)),ue(),le(),Z()}function V(){ce()}return window.addEventListener("keydown",O),window.addEventListener("keyup",_),window.addEventListener("blur",V),()=>{window.removeEventListener("keydown",O),window.removeEventListener("keyup",_),window.removeEventListener("blur",V)}},[j,N,Z,ue,le,M,C,q.chatFocus,q.dockMacro,q.driveMacro,ce,d,l,m,ae,he]);const E=h.useRef(ce);return h.useEffect(()=>{E.current=ce},[ce]),h.useEffect(()=>{E.current()},[a.roverId]),h.useEffect(()=>()=>{W(),ae()},[W,ae]),null}const FS=1.6;function Cg(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 JS(a){return JSON.parse(JSON.stringify(a??{}))}function qg(a,l){const i=JS(l);return i.meta={id:a?.id??"Unknown",mapping:a?.mapping??"none",axes:a?.axes?.length??0,buttons:a?.buttons?.length??0},i}function qa(a){return Number.isFinite(a)?Math.max(-1,Math.min(1,a)):0}function _s(a,l){if(!a)return 0;const i=Math.abs(a);return l==="expo"?Math.sign(a)*Math.pow(i,FS):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 IS(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)?qa(i):null}function Ku(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=Ku(a,i.index);if(!r)continue;return{value:qa(r.value),source:i}}}return{value:0,source:null}}function WS(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=Ku(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=Ku(a,i.index);if(!r)continue;return{pressed:r.value>.5,source:i}}}return{pressed:!1,source:null}}function Mg(a,l){const i=l?.bindings??{},r=l?.calibration??{},f=i.drive??{},d=WS(a,f.sources);let m=qa(d.x),x=qa(d.y);const p=Math.min(Math.max(r.driveDeadzone??.18,0),.8),y=IS(m,x,p);m=_s(y.x,r.driveCurve),x=_s(y.y,r.driveCurve);const S=i.cameraTilt??{},b=Eu(a,S.sources),w=Math.min(Math.max(r.cameraDeadzone??.08,0),.8);let M=wu(qa(b.value),w);M=_s(M,r.cameraCurve);const N=Math.min(Math.max(r.auxDeadzone??.05,0),.6),C=i.mainBrush??{},A=Eu(a,C.sources);let q=wu(qa(A.value),N);q=_s(q,r.auxCurve);const j=i.sideBrush??{},k=Eu(a,j.sources);let X=wu(qa(k.value),N);X=_s(X,r.auxCurve);const U=Ca(a,i.vacuum?.sources),Y=Ca(a,i.allAux?.sources),z=Ca(a,i.mainReverse?.sources),I=Ca(a,i.sideReverse?.sources),G=Ca(a,i.driveMacro?.sources),te=Ca(a,i.dockMacro?.sources),Z=Ca(a,i.nightVisionToggle?.sources);return{driveVector:{x:m,y:x,boost:!1},cameraAxis:M,auxAxis:{main:q,side:X},buttons:{vacuum:U.pressed,allAux:Y.pressed,mainReverse:z.pressed,sideReverse:I.pressed,driveMacro:G.pressed,dockMacro:te.pressed,nightVisionToggle:Z.pressed},sources:{drive:d.source,cameraTilt:b.source,mainBrush:A.source,sideBrush:k.source,vacuum:U.source,allAux:Y.source,mainReverse:z.source,sideReverse:I.source,driveMacro:G.source,dockMacro:te.source,nightVisionToggle:Z.source}}}const qr=new Set;let jl=null,Dr={pads:[],timestamp:0};function PS(){if(typeof navigator>"u"||!navigator.getGamepads)return[];const a=navigator.getGamepads();return a?Array.from(a).filter(Boolean):[]}function eA(a){return{index:a.index,id:a.id,mapping:a.mapping,connected:a.connected!==!1,timestamp:a.timestamp,axes:Array.from(a.axes??[]),buttons:(a.buttons??[]).map(l=>({pressed:!!l?.pressed,value:typeof l?.value=="number"?l.value:l?.pressed?1:0})),signature:Cg(a)}}function tA(){Dr={pads:PS().map(eA),timestamp:typeof performance<"u"?performance.now():Date.now()},qr.forEach(l=>l(Dr))}function Tg(){tA(),jl=requestAnimationFrame(Tg)}function nA(){jl||(jl=requestAnimationFrame(Tg))}function aA(){jl&&(cancelAnimationFrame(jl),jl=null)}function Rg(a){return qr.add(a),nA(),a(Dr),()=>{qr.delete(a),qr.size===0&&aA()}}function lA(){const[a,l]=h.useState(Dr);return h.useEffect(()=>Rg(l),[]),a}const pr="gamepad",gr={x:0,y:0,boost:!1},xr={main:0,side:0,vacuum:0};function f0(a,l){return a&&l&&a.x===l.x&&a.y===l.y&&a.boost===l.boost}function d0(a,l){return a&&l&&a.main===l.main&&a.side===l.side&&a.vacuum===l.vacuum}function sA(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 iA(){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",na),S=h.useRef(new Set),b=h.useRef(gr),w=h.useRef(xr),M=h.useRef({main:!1,side:!1}),N=h.useRef(new Map),C=h.useRef(0),A=h.useRef(null),q=h.useCallback(U=>{const Y=U.signature??Cg(U);p?.profiles?.[Y]||S.current.has(Y)||(S.current.add(Y),y(z=>{const I=z??na;if(I.profiles?.[Y])return I;const G=I?.defaults?.profile??qn,te=qg(U,G);return{...I,profiles:{...I.profiles??{},[Y]:te}}}))},[p?.profiles,y]),j=h.useCallback((U,Y)=>{const z=N.current.get(U)||!1;return N.current.set(U,Y),Y&&!z},[]),k=h.useCallback((U,Y)=>{const z=a.camera?.config;if(!z)return;const I=typeof performance<"u"?performance.now():Date.now(),G=Y?.cameraMode??"absolute",te=Math.max(1,Math.min(180,Y?.cameraSensitivity??60));if(G==="velocity"){const ae=Math.min(50,I-C.current||16),B=U*te*(ae/1e3);if(Math.abs(B)<.01)return;const le=(typeof A.current=="number"?A.current:typeof a.camera?.angle=="number"?a.camera.angle:typeof z.homeAngle=="number"?z.homeAngle:0)+B;f(le),A.current=le,C.current=I;return}const Z=typeof z.minAngle=="number"?z.minAngle:-45,W=typeof z.maxAngle=="number"?z.maxAngle:45,se=typeof z.homeAngle=="number"?z.homeAngle:(Z+W)/2,ue=U<0?se+U*(se-Z):se+U*(W-se);typeof A.current=="number"&&Math.abs(A.current-ue)<.35&&I-C.current<80||(C.current=I,A.current=ue,f(ue))},[f,a.camera?.angle,a.camera?.config]),X=h.useMemo(()=>p?.activeSignature??null,[p?.activeSignature]);return h.useEffect(()=>Rg(U=>{const Y=sA(U.pads,X);if(!Y){f0(b.current,gr)||(b.current=gr,i(gr,{source:pr})),d0(w.current,xr)||(w.current=xr,r(xr)),N.current=new Map,M.current={main:!1,side:!1},x(pr,{connected:!1});return}q(Y);const z=Y.signature,I=p?.profiles?.[z]??p?.defaults?.profile??qn,G=Mg(Y,I);f0(G.driveVector,b.current)||(b.current=G.driveVector,i(G.driveVector,{source:pr}));const te=I.calibration?.auxSideScale??.55,Z=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?-Z:Z,ue=M.current.side?-Math.round(W*te):Math.round(W*te);let ae={main:G.auxAxis.main!==0?se:0,side:G.auxAxis.side!==0?ue:0,vacuum:G.buttons.vacuum?127:0};G.buttons.allAux&&(ae={main:127,side:127,vacuum:127}),d0(ae,w.current)||(w.current=ae,r(ae)),G.buttons.mainReverse&&j("mainReverse",!0)?M.current.main=!M.current.main:G.buttons.mainReverse||j("mainReverse",!1),G.buttons.sideReverse&&j("sideReverse",!0)?M.current.side=!M.current.side:G.buttons.sideReverse||j("sideReverse",!1),G.buttons.driveMacro&&j("driveMacro",!0)?(l("drive"),d("drive-sequence")):G.buttons.driveMacro||j("driveMacro",!1),G.buttons.dockMacro&&j("dockMacro",!0)?(l("dock"),d("seek-dock")):G.buttons.dockMacro||j("dockMacro",!1),G.buttons.nightVisionToggle&&j("nightVisionToggle",!0)?m():G.buttons.nightVisionToggle||j("nightVisionToggle",!1),Math.abs(G.cameraAxis)>.001&&k(G.cameraAxis,I.calibration),x(pr,{connected:!0,signature:z,id:Y.id,index:Y.index,axes:Y.axes,buttons:Y.buttons,drive:G.driveVector,aux:ae,cameraAxis:G.cameraAxis,bindings:G.sources})}),[X,q,p?.defaults?.profile,p?.profiles,j,k,x,d,r,i,l,m]),null}function kg(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 _g(a){const l=Tl(a);return h.useMemo(()=>kg(l),[l])}function Sl({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 h0({label:a}){return a?o.jsx("span",{className:"rounded border border-white/40 px-1 text-[0.7rem] text-white",children:a}):null}function Cu({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 rA({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(Zu,{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 Dg({layout:a="desktop",expand:l=!1,driveDockState:i}){const r=a==="mobile",{state:{roverId:f,keymap:d},actions:m}=ht(),x=Tl(f),p=i??kg(x),{driving:y,docked:S,charging:b,dockingInProgress:w}=p,[M,N]=h.useState(null),[C,A]=h.useState(!1),[q,j]=h.useState(!1),k=!f||M!==null,X=!f||M!==null,U=la(d?.driveMacro?.[0]),Y=la(d?.dockMacro?.[0]),z={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"]},I="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"]},te=S?"Docked":"Undocked",Z=S?"good":"bad",W=b?"Charging":S?"Charging in 5s":"—",se=b?"good":S?"warn":"bad",ue=async()=>{if(!(!f||M)){N("drive");try{m.setMode("drive"),await m.runMacro("drive-sequence")}catch(re){alert(re.message)}finally{N(null)}}},ae=async()=>{if(!(!f||M)){A(!1),j(!1),N("drive");try{m.setMode("drive"),await m.runMacro("drive-sequence")}catch(re){alert(re.message)}finally{N(null)}}},B=async()=>{if(!(!f||M)){N("dock");try{m.setMode("dock"),await m.runMacro("seek-dock")}catch(re){alert(re.message)}finally{N(null),A(!1),j(!1)}}},P=()=>{X||(j(!0),A(!0))},le="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":"",_="border-emerald-300/70 bg-emerald-800 text-emerald-50 hover:bg-emerald-700 focus-visible:ring-emerald-300",V="border-amber-300/70 bg-amber-900 text-amber-50 hover:bg-amber-800 focus-visible:ring-amber-300",ee="border-indigo-300/70 bg-indigo-900 text-indigo-50 hover:bg-indigo-800 focus-visible:ring-indigo-300",ne=l?"h-full flex-1":"";if(!y&&!w)return o.jsxs("button",{type:"button",onClick:ae,disabled:k,className:`${le} ${ne} ${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-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:[U?o.jsx(h0,{label:U}):null,o.jsx(Cu,{label:"Click to start",tone:"emerald"})]})]}),o.jsx("p",{className:"text-sm text-emerald-50/90",children:G.summary}),o.jsx(Zu,{steps:G.steps,tone:"emerald"})]}),o.jsxs("div",{className:"flex w-full flex-1 flex-col gap-0.5 self-stretch",children:[o.jsx(Sl,{label:"Dock",value:te,tone:Z}),o.jsx(Sl,{label:"Charge",value:W,tone:se})]})]});if(w){const re={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:`${le} ${ne} ${E} ${O} ${V}`,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(Cu,{label:"Click to return to driving mode",tone:"amber"})})]}),o.jsx("p",{className:"text-sm text-amber-50/90",children:re.summary})]}),o.jsxs("div",{className:"flex w-full flex-1 flex-col gap-0.5 self-stretch",children:[o.jsx(Sl,{label:"Dock",value:te,tone:Z}),o.jsx(Sl,{label:"Charge",value:W,tone:se})]}),o.jsx(Zu,{steps:re.steps,tone:"amber"})]})}return o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",disabled:X,onClick:P,className:r?`flex w-full items-center justify-center ${le} ${E} ${O} ${ee}`:`${le} ${ne} ${E} ${O} ${ee}`,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:[Y?o.jsx(h0,{label:Y}):null,o.jsx(Cu,{label:"Click to begin docking",tone:"indigo"})]})]}),!r&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"text-sm text-indigo-50/90",children:I}),o.jsxs("div",{className:"flex w-full flex-1 flex-col gap-0.5 self-stretch",children:[o.jsx(Sl,{label:"Dock",value:te,tone:Z}),o.jsx(Sl,{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(rA,{instructions:z,pending:M==="dock",onCancel:()=>{j(!1),A(!1)},onConfirm:B}):null]})}function Zu({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))})}const yr="mobile-joystick",oA=80,cA=.15,uA=[{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 fA({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}}),S=h.useCallback(()=>{m.current=null,y({active:!1,base:{x:0,y:0},knob:{x:0,y:0}}),f?.()},[f]),b=h.useCallback(C=>{if(a||m.current!==null)return;C.preventDefault();const A=d.current;if(!A)return;const q=A.getBoundingClientRect(),j=C.clientX-q.left,k=C.clientY-q.top;x.current={x:j,y:k},m.current=C.pointerId,A.setPointerCapture?.(C.pointerId),y({active:!0,base:{x:j,y:k},knob:{x:0,y:0}})},[a]),w=h.useCallback(C=>{if(a||m.current!==C.pointerId)return;C.preventDefault();const A=d.current;if(!A)return;const q=A.getBoundingClientRect(),j=C.clientX-q.left,k=C.clientY-q.top,X=j-x.current.x,U=k-x.current.y,Y=Math.min(Math.hypot(X,U),i),z=Math.atan2(U,X),I=Math.cos(z)*Y,G=Math.sin(z)*Y,te={x:El(I/i),y:El(-G/i),boost:!1};y(Z=>({...Z,knob:{x:I,y:G}})),r?.(te)},[a,r]),M=h.useCallback(C=>{if(m.current!==C.pointerId)return;C.preventDefault(),d.current?.releasePointerCapture?.(C.pointerId),S()},[S]);h.useEffect(()=>{a&&S()},[a,S]);const N=l==="landscape"?"h-[260px]":"h-[220px]";return o.jsxs("div",{ref:d,role:"presentation",className:`relative w-full ${N} select-none overflow-hidden bg-zinc-950`,style:{touchAction:"none"},onPointerDown:b,onPointerMove:w,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 Og({layout:a}){const{state:{roverId:l,camera:i},pipeline:r,actions:{setDriveVector:f,registerInputState:d,setServoAngle:m,toggleNightVision:x}}=ht(),p=_g(l),y=p.docked&&!p.driving,S=!l,b=i?.config,w=!!(l&&i?.enabled&&b),M=!!(l&&r?.nightVision),N=typeof b?.minAngle=="number"?b.minAngle:-45,C=typeof b?.maxAngle=="number"?b.maxAngle:45,A=typeof i?.angle=="number"?i.angle:typeof b?.homeAngle=="number"?b.homeAngle:(N+C)/2,q=oA,j=cA,k=h.useRef({x:0,y:0,boost:!1});h.useEffect(()=>{S&&(k.current={x:0,y:0,boost:!1})},[S]);const X=h.useCallback((G={})=>{if(S)return;const te={x:El(G.x??0),y:El(G.y??0),boost:!!G.boost},Z={x:k.current.x+(te.x-k.current.x)*(1-j),y:k.current.y+(te.y-k.current.y)*(1-j),boost:te.boost};k.current=Z,f(Z,{source:yr}),d(yr,{vector:Z,lastEvent:"move"})},[S,d,f,j]),U=h.useCallback(()=>{if(S)return;const G={x:0,y:0,boost:!1};k.current=G,f(G,{source:yr}),d(yr,{vector:G,lastEvent:"stop"})},[S,d,f]),Y=G=>{if(!w)return;const te=Number(G.target.value);Number.isNaN(te)||m(te)},I=`flex h-full flex-col gap-0.5 text-slate-100 ${y?"max-h-screen self-start":""}`;return o.jsxs("div",{className:I,children:[o.jsx(Dg,{layout:"mobile",expand:y,driveDockState:p}),y?null:o.jsxs(o.Fragment,{children:[M&&o.jsx("button",{type:"button",onClick:()=>x(),disabled:S,className:"bg-amber-600 px-0.5 py-1 text-sm font-semibold text-amber-50 transition hover:bg-amber-500 disabled:opacity-40",children:"Toggle Night Vision"}),w&&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:[A.toFixed(1),"°"]})]}),o.jsx("input",{type:"range",min:N,max:C,step:.5,value:A,onChange:Y,className:"mt-0 w-full accent-cyan-400"})]}),o.jsx(fA,{disabled:S,layout:a,radius:q,onMove:X,onStop:U})]})]})}function Bg({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:uA.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 dA(){return o.jsx("div",{className:"flex h-full flex-col gap-0.5",children:o.jsx(Bg,{orientation:"landscape"})})}function hA(){return o.jsx("div",{className:"flex h-full flex-col gap-0.5",children:o.jsx(Og,{layout:"landscape"})})}function mA(){return o.jsx("section",{className:"panel",children:o.jsxs("div",{className:"grid grid-cols-2 gap-0.5 items-stretch",children:[o.jsx(Bg,{orientation:"portrait"}),o.jsx(Og,{layout:"portrait"})]})})}function pA(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(N=>typeof N=="string"?N:N.id),[a]),y=h.useMemo(()=>{const N=p.join("|");return f?`${N}|v:${f}`:N},[p,f]),S=h.useRef([]),[b,w]=h.useState(0),M=h.useRef(new Map);return h.useEffect(()=>{if(!i)return;const N=()=>w(C=>C+1);return i.on("connect",N),()=>i.off("connect",N)},[i]),h.useEffect(()=>{S.current=p},[y,p]),h.useEffect(()=>{x.current.forEach(N=>URL.revokeObjectURL(N)),x.current.clear(),m({})},[y]),h.useEffect(()=>{if(!r){x.current.forEach(j=>URL.revokeObjectURL(j)),x.current.clear(),m({});return}if(!S.current.length||!i)return;let N=!1;const C=S.current,A=(j={},k)=>{if(N||!j.id||!k)return;const X=k.byteLength??k.length??0,U=Date.now(),Y=M.current.get(j.id)||{count:0,totalBytes:0,lastLogAt:0},z={count:Y.count+1,totalBytes:Y.totalBytes+X,lastLogAt:Y.lastLogAt};if(!z.lastLogAt||U-z.lastLogAt>=1e4){const Z=z.count?z.totalBytes/z.count:0;console.log("[roomCamera]",j.id,`frame=${X}B`,`avg=${Math.round(Z)}B`,`count=${z.count}`),z.lastLogAt=U}M.current.set(j.id,z);const I=new Blob([k],{type:"image/jpeg"}),G=URL.createObjectURL(I),te=x.current.get(j.id);te&&URL.revokeObjectURL(te),x.current.set(j.id,G),m(Z=>({...Z,[j.id]:{status:"playing",ts:j.ts||Date.now(),error:null,objectUrl:G}}))},q=(j={})=>{N||!j.id||m(k=>({...k,[j.id]:{...k[j.id]||{},status:j.error?"error":k[j.id]?.status||"connecting",error:j.error||null,ts:j.ts||k[j.id]?.ts||null,objectUrl:k[j.id]?.objectUrl||null}}))};return i.on("roomCamera:frame",A),i.on("roomCamera:status",q),i.emit("roomCamera:subscribe",{ids:C},(j={})=>{j.error}),()=>{N=!0,i.emit("roomCamera:unsubscribe",{ids:C}),i.off("roomCamera:frame",A),i.off("roomCamera:status",q),x.current.forEach(j=>URL.revokeObjectURL(j)),x.current.clear()}},[i,y,r,b]),d}function gA({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 xA(){return o.jsxs("div",{className:"panel-section space-y-0.5 text-sm",children:[o.jsx("p",{className:"text-center text-slate-400",children:"No room cameras configured."}),o.jsx("p",{className:"text-center text-slate-500",children:"Add entries to server config to populate this list."})]})}const zg=["horizontal","vertical"];function qu(a,l){return zg.includes(a)?a:l}function yf({defaultOrientation:a="horizontal",orientation:l,hideLayoutToggle:i=!1,hideHeader:r=!1,panelId:f=null}){const{session:d}=_e(),m=d?.roomCameras||[],x=pA(m.map(A=>({id:A.id}))),{value:p,save:y}=dt("roomCameraPanels",{}),[S,b]=h.useState(()=>qu(f?p?.[f]:a,"horizontal"));h.useEffect(()=>{if(!f)return;const A=p?.[f];A&&b(qu(A,"horizontal"))},[f,p?.[f]]);const w=l?qu(l,"horizontal"):S,M=w==="vertical"?"flex flex-col gap-0.5":"grid gap-0.5 md:grid-cols-2",N=!i&&!l&&m.length>0,C=A=>{b(A),f&&y(q=>({...q||{},[f]:A}))};return m.length===0?o.jsx(xA,{}):o.jsxs("section",{className:"panel-section space-y-0.5 text-base",children:[!r&&o.jsxs("header",{className:"flex flex-wrap items-center justify-between gap-0.5 text-sm text-slate-400",children:[o.jsxs("div",{className:"flex items-center gap-0.5",children:[o.jsx("p",{children:"Room cameras"}),o.jsx("span",{className:"text-xs text-slate-500",children:m.length})]}),o.jsx("div",{className:"flex flex-wrap items-center gap-0.5 text-xs",children:N&&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:zg.map(A=>o.jsx("button",{type:"button",className:`px-1 py-0.5 ${w===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(gA,{feed:q,label:A.name||A.id})},A.id)})})]})}function vf(){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 yA(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 vA(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 bf(a=[],l={}){const i=ln(),{enabled:r=!0,version:f=null}=l,[d,m]=h.useState({}),x=h.useMemo(()=>Array.isArray(a)?vA(a.map(yA).filter(Boolean)):[],[a]),p=h.useMemo(()=>{const M=x.map(N=>`${N.type}:${N.id}:${N.key}`).join("|");return f?`${M}|v:${f}`:M},[x,f]),y=h.useRef([]),[S,b]=h.useState(0);return h.useEffect(()=>{if(!i)return;const M=()=>b(N=>N+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 N=!1;function C(A){const q=A.type==="room"?{roomCameraId:A.id}:{roverId:A.id};i.emit("video:request",q,(j={})=>{N||m(k=>({...k,[A.key]:j}))})}return M.forEach(A=>{C(A)}),()=>{N=!0}},[i,p,r,S]),h.useMemo(()=>{if(!p||!r)return{};const M={};return x.forEach(N=>{d[N.key]&&(M[N.key]=d[N.key])}),M},[p,d,x])}function Sf(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(N=>typeof N=="string"?N:N.id).filter(Boolean),[a]),y=h.useMemo(()=>{const N=p.join("|");return f?`${N}|v:${f}`:N},[p,f]),S=h.useRef([]),[b,w]=h.useState(0),M=h.useRef(new Map);return h.useEffect(()=>{if(!i)return;const N=()=>w(C=>C+1);return i.on("connect",N),()=>i.off("connect",N)},[i]),h.useEffect(()=>{S.current=p},[y,p]),h.useEffect(()=>{x.current.forEach(N=>URL.revokeObjectURL(N)),x.current.clear(),m({})},[y]),h.useEffect(()=>{if(!r){x.current.forEach(j=>URL.revokeObjectURL(j)),x.current.clear(),m({});return}if(!S.current.length||!i)return;let N=!1;const C=S.current,A=(j={},k)=>{if(N||!j.id||!k)return;const X=k.byteLength??k.length??0,U=Date.now(),Y=M.current.get(j.id)||{count:0,totalBytes:0,lastLogAt:0},z={count:Y.count+1,totalBytes:Y.totalBytes+X,lastLogAt:Y.lastLogAt};if(!z.lastLogAt||U-z.lastLogAt>=1e4){const Z=z.count?z.totalBytes/z.count:0;console.log("[roverSnapshot]",j.id,`frame=${X}B`,`avg=${Math.round(Z)}B`,`count=${z.count}`),z.lastLogAt=U}M.current.set(j.id,z);const I=new Blob([k],{type:"image/jpeg"}),G=URL.createObjectURL(I),te=x.current.get(j.id);te&&URL.revokeObjectURL(te),x.current.set(j.id,G),m(Z=>({...Z,[j.id]:{status:"playing",ts:j.ts||Date.now(),error:null,objectUrl:G}}))},q=(j={})=>{N||!j.id||m(k=>({...k,[j.id]:{...k[j.id]||{},status:j.error?"error":k[j.id]?.status||"connecting",error:j.error||null,ts:j.ts||k[j.id]?.ts||null,objectUrl:k[j.id]?.objectUrl||null}}))};return i.on("roverSnapshot:frame",A),i.on("roverSnapshot:status",q),i.emit("roverSnapshot:subscribe",{ids:C},(j={})=>{j.error}),()=>{N=!0,i.emit("roverSnapshot:unsubscribe",{ids:C}),i.off("roverSnapshot:frame",A),i.off("roverSnapshot:status",q),x.current.forEach(j=>URL.revokeObjectURL(j)),x.current.clear()}},[i,y,r,b]),d}const bA={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"turn:your.turn.server:3478",username:"user",credential:"pass"}],bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"};function SA(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 AA(a){if(!a)return{};const l=`${a}:${a}`;return{Authorization:`Basic ${SA(l)}`}}class m0{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(bA);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",...AA(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 Fu({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,S=y-4,b=y+4,w=y-14,M=y-6,N=y*.65,C=a?.bumpsAndWheelDrops||{},A=a?.wheelOvercurrents||{},q=a?.wheelLeftCurrentMa??0,j=a?.wheelRightCurrentMa??0,k=a?.sideBrushCurrentMa??0,X=a?.mainBrushCurrentMa??0,U=6,Y=C.bumpLeft?U:0,z=C.bumpRight?U:0,I=MA({count:6,totalSpan:140,gap:6,startAngle:-70}),G=["L","FL","CL","CR","FR","R"],te=[a?.lightBumpLeftSignal,a?.lightBumpFrontLeftSignal,a?.lightBumpCenterLeftSignal,a?.lightBumpCenterRightSignal,a?.lightBumpFrontRightSignal,a?.lightBumpRightSignal],Z=I.map((ae,B)=>({label:G[B],start:ae.start,end:ae.end,value:te[B]})),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=te.filter(ae=>ae!=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(p0,{cx:x-N,cy:p,current:q,drop:C.wheelDropLeft,overcurrent:A.leftWheel,label:"L"}),o.jsx(p0,{cx:x+N,cy:p,current:j,drop:C.wheelDropRight,overcurrent:A.rightWheel,label:"R"}),o.jsx(wA,{cx:x+y*.65,cy:p-y*.55,current:k,overcurrent:A.sideBrush}),o.jsx(EA,{cx:x,cy:p,current:X,overcurrent:A.mainBrush,variant:l,dirtLeft:a?.dirtDetectLeft,dirtRight:a?.dirtDetect}),Z.map(ae=>{const B=CA(ae.value,ue),P=b+4,le=P+28;return o.jsx(jA,{cx:x,cy:p,rBase:le,rTip:P,startDeg:ae.start,endDeg:ae.end,color:B,value:ae.value,max:ue},ae.label)}),W.map(ae=>{const B=qA(ae.value,ae.active);return o.jsx(Mu,{cx:x,cy:p,rInner:w,rOuter:M,startDeg:ae.start,endDeg:ae.end,color:B,opacity:1,pulse:!!ae.active},ae.label)}),o.jsx(Mu,{cx:x,cy:p,rInner:S-Y,rOuter:b-Y,startDeg:-70,endDeg:-6,color:C.bumpLeft?"#ef4444":"#475569",opacity:1,pulse:!!C.bumpLeft}),o.jsx(Mu,{cx:x,cy:p,rInner:S-z,rOuter:b-z,startDeg:6,endDeg:70,color:C.bumpRight?"#ef4444":"#475569",opacity:1,pulse:!!C.bumpRight})]})]})}function Mu({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,S=r-i,b=NA(a,l,y,f,d);return o.jsxs(o.Fragment,{children:[o.jsx("path",{d:b,stroke:m,strokeWidth:S,strokeLinecap:"round",fill:"none",opacity:p}),x?o.jsx("path",{d:b,stroke:"#ef4444",strokeWidth:S,strokeLinecap:"round",fill:"none",className:"animate-pulse",opacity:1}):null]})}function jA({cx:a,cy:l,rBase:i,rTip:r,startDeg:f,endDeg:d,color:m,value:x,max:p}){const y=(f+d)/2,S=zs(a,l,r,y),b=Vr(x!=null?x/(p||1):0),w=Math.pow(b,.35),M=i-(i-r)*w,N=zs(a,l,M,f),C=zs(a,l,M,d),A=`M ${S.x} ${S.y} L ${N.x} ${N.y} L ${C.x} ${C.y} Z`;return o.jsx("path",{d:A,fill:m,opacity:1,stroke:"none"})}function NA(a,l,i,r,f){let d=r,m=f;m<=d&&(m+=360);const x=zs(a,l,i,d),p=zs(a,l,i,m);return["M",x.x,x.y,"A",i,i,0,0,1,p.x,p.y].join(" ")}function zs(a,l,i,r){const f=Lg(r);return{x:a+i*Math.cos(f),y:l+i*Math.sin(f)}}function Lg(a){return(a-90)*Math.PI/180}function Af(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 p0({cx:a,cy:l,current:i,drop:r,overcurrent:f,label:d}){const m=Math.abs(i),x=Vr(m/1200),p=Af(i,f),y=56,S=14,b=9,w=3,M=y*x,N=d==="L"?-1:1,C=N*(-b/2-w/2),A=N*(S/2+w/2),q=S+b+w+2,j=y+4;return o.jsxs("g",{transform:`translate(${a},${l})`,children:[o.jsx("rect",{x:-q/2,y:-j/2,width:q,height:j,rx:"4",fill:"none",stroke:"#64748b",strokeWidth:"1"}),o.jsx("rect",{x:C-S/2,y:-y/2,width:S,height:y,fill:"#0f172a",stroke:"#0f172a",strokeWidth:"1",rx:"2"}),o.jsx("rect",{x:C-S/2,y:y/2-M,width:S,height:M,fill:p,className:f?"animate-pulse":""}),o.jsx("rect",{x:A-b/2,y:-y/2,width:b,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 wA({cx:a,cy:l,current:i,overcurrent:r}){const f=Math.abs(i),d=Af(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=Lg(p),S=a+m*Math.cos(y),b=l+m*Math.sin(y);return o.jsx("line",{x1:a,y1:l,x2:S,y2:b,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 EA({cx:a,cy:l,current:i,overcurrent:r,variant:f,dirtLeft:d,dirtRight:m}){const x=Math.abs(i),p=Af(i,r),y=1,S=96,b=12,w=`main-brush-pattern-a-${f}`,M=`main-brush-pattern-b-${f}`,N=x>0?.6:null,C=i>=0?1:-1;return o.jsxs("g",{children:[o.jsx("defs",{children:[w,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"}),N?o.jsx("animateTransform",{attributeName:"patternTransform",type:"translate",from:"0 0",to:`0 ${C*(q===0?6:-6)}`,dur:`${N}s`,repeatCount:"indefinite"}):null]},A))}),o.jsx("rect",{x:a-S/2,y:l-14,width:S,height:b,rx:"3",fill:`url(#${w})`,stroke:"#64748b",strokeWidth:"1"}),o.jsx("rect",{x:a-S/2,y:l+4,width:S,height:b,rx:"3",fill:`url(#${M})`,stroke:"#64748b",strokeWidth:"1"}),o.jsx("circle",{cx:a-S/4,cy:l-8,r:3.5,fill:"#fbbf24"}),o.jsx("circle",{cx:a+S/4,cy:l+8,r:3.5,fill:"#fbbf24"}),r?o.jsx("rect",{x:a-S/2-4,y:l-16,width:S+8,height:b*2+16,rx:"6",stroke:"#ef4444",strokeWidth:"3",fill:"none",className:"animate-pulse"}):null]})}function CA(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 qA(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 MA({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 Ug(){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(xg,{className:"mr-0"}),a]}):null}const g0=2e3,TA=3e3,RA=3e3;function kA(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,S=f!=null&&a<=f;return{available:!0,percentDisplay:p,depleted:y,warnTriggered:S,barClass:y?"bg-red-500 animate-pulse":S?"bg-amber-400":"bg-emerald-500"}}function jf({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:S="default",driverLabel:b=null,hudForceMap:w=!1,hudMapPosition:M="top-center",hudLabelScale:N=1,fitParent:C=!1,overcurrentLimiter:A=null,showTurnCue:q=!1,turnTimerText:j=null,turnSeconds:k=null,isActiveDriver:X=!1,idleSkipSeconds:U=null}){const Y=h.useRef(null),z=h.useRef(null),I=h.useRef(null),G=h.useRef(null),te=h.useRef(null),Z=h.useRef(null),[W,se]=h.useState("idle"),[ue,ae]=h.useState(null),[B,P]=h.useState("idle"),[le,ce]=h.useState(null),[he,E]=h.useState(0),[O,_]=h.useState(0),[V,ee]=h.useState(!0),ne=i==="snapshot",re=x?.sensors,we=re?.batteryChargeMah??null,xe=y==="desktop",St=!xe,[Ra]=Ug(),Rl=w||St?!0:Ra,sa=kA(we,p),Mt=re?.wheelOvercurrents||null,ia=Mt==null?[]:Object.entries(Mt).filter(([,Ne])=>!!Ne).map(([Ne])=>Ne),Tt=A?.caps||null,Ks=A?.overcurrent?.groups||null,ka=typeof window<"u"&&new URLSearchParams(window.location.search).has("debugHud"),kl=h.useMemo(()=>{if(!Tt)return null;const Ne=Number.isFinite(Tt?.drive?.cap)?Tt.drive.cap:1,Xe=Number.isFinite(Tt?.aux?.cap)?Tt.aux.cap:1;return Math.max(0,Math.min(1,1-Math.min(Ne,Xe)))},[Tt]),ra=!!A?.isActive,sn=ia.length?ia:ra?["limiter"]:[],_a=kl??(ia.length?1:0),_l=!!sn.length;h.useEffect(()=>{ka&&console.log("[OvercurrentHUD]",{overlayVisible:_l,overlayMotors:sn,overlayFill:_a,limiterActive:ra,limiterCaps:Tt,limiterGroups:Ks,wheelOvercurrents:Mt})},[ka,_a,sn,_l,ra,Tt,Ks,Mt]);const tt=h.useCallback(()=>{clearTimeout(I.current),I.current=setTimeout(()=>E(Date.now()),g0)},[]),Dl=h.useCallback(()=>{clearTimeout(G.current),G.current=setTimeout(()=>_(Date.now()),g0)},[]),oa=h.useCallback(async()=>{const Ne=Y.current;if(Ne)try{Ne.muted=!0,await Ne.play()}catch{}},[]),Ol=h.useCallback((Ne=0)=>{if(m)return;clearTimeout(Z.current);const Xe=()=>{clearTimeout(Z.current),Z.current=setTimeout(()=>{m||Le()},TA)},Le=async()=>{const Ee=Y.current;if(Ee)try{await oa(),Ee.muted=!1,await Ee.play(),ee(!1)}catch{Ee.muted=!0,ee(!0),Xe()}};Z.current=setTimeout(Le,Ne)},[oa,m]);h.useEffect(()=>()=>{clearTimeout(I.current),clearTimeout(G.current),clearTimeout(Z.current),clearInterval(te.current)},[]),h.useEffect(()=>{W==="playing"&&Ol(0)},[W,Ol]),h.useEffect(()=>{ne&&(se("snapshot"),ae(null))},[ne]),h.useEffect(()=>{if(ne||!a?.url||!Y.current)return;let Ne=!0,Xe;const Le=setTimeout(()=>ee(!0),0),Ee=(Ce,Ue)=>{Ne&&(se(Ce),ae(Ue||null),Ce==="playing"&&oa(),["error","failed","disconnected","closed"].includes(Ce)&&tt())};return Xe=new m0({url:a.url,token:a.token,video:Y.current,onStatus:Ee}),Xe.start().catch(Ce=>{Ne&&(se("error"),ae(Ce.message),tt())}),()=>{Ne=!1,clearTimeout(Le),Xe?.stop()}},[ne,a?.url,a?.token,he,tt,oa]),h.useEffect(()=>{W==="stopped"&&a?.url&&tt()},[W,a?.url,tt]),h.useEffect(()=>{if(!l?.url||!z.current)return;let Ne=!0,Xe;const Le=(Ee,Ce)=>{Ne&&(ce(Ce||(Ee==="connected"?"connected":null)),P(Ue=>Ee==="connected"&&(Ue==="playing"||Ue==="connecting")||Ee==="new"?Ue:Ee),Ee==="playing"&&z.current?.play().catch(()=>{}),["error","failed","disconnected","closed"].includes(Ee)&&Dl())};return Xe=new m0({url:l.url,token:l.token,video:z.current,audioOnly:!0,onStatus:Le}),Xe.start().catch(Ee=>{Ne&&(P("error"),ce(Ee.message),Dl())}),()=>{Ne=!1,Xe?.stop()}},[l?.url,l?.token,O,Dl]),h.useEffect(()=>{const Ne=z.current;if(!l?.url||!Ne){clearInterval(te.current);return}if(!["connecting","connected","playing","paused"].includes(B)){clearInterval(te.current);return}const Le=()=>{const Ee=z.current;Ee&&(!Ee.paused&&!Ee.ended||Ee.play().then(()=>{P(Ce=>Ce==="connected"?"playing":Ce),ce(Ce=>Ce==="paused"?null:Ce)}).catch(Ce=>{ce(Ue=>Ue||Ce?.message||"autoplay blocked")}))};return Le(),te.current=setInterval(Le,RA),()=>clearInterval(te.current)},[l?.url,B]),h.useEffect(()=>{const Ne=z.current;if(!Ne)return;const Xe=()=>{P(Ue=>Ue==="error"?Ue:"playing"),ce(null)},Le=()=>{P(Ue=>["error","failed","disconnected","closed","stopped"].includes(Ue)?Ue:"paused"),ce(Ue=>Ue||"paused")},Ee=()=>{P(Ue=>Ue==="error"?Ue:"stopped"),ce(Ue=>Ue||"ended")},Ce=()=>{const{error:Ue}=Ne,Zr=Ue?.message||"audio error";P("error"),ce(Zr)};return Ne.addEventListener("play",Xe),Ne.addEventListener("pause",Le),Ne.addEventListener("ended",Ee),Ne.addEventListener("error",Ce),()=>{Ne.removeEventListener("play",Xe),Ne.removeEventListener("pause",Le),Ne.removeEventListener("ended",Ee),Ne.removeEventListener("error",Ce)}},[l?.url]);const Da=r?.error?`Error: ${r.error}`:r?.objectUrl?"snapshot":r?.status||"waiting",Kr=ne?Da:a?.url?W==="error"?`Error: ${ue||"unknown"}`:ue?`${W} (${ue})`:W:"waiting",Zs=l?.error?`Error: ${l.error}`:l?.url?B==="error"?`Error: ${le||"unknown"}`:le?`${B} (${le})`:B:null,Fs=S==="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:[ne?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:Y,muted:m||V,playsInline:!0,autoPlay:!0,controls:!1,className:"h-full w-full object-contain"}),o.jsx("audio",{ref:z,autoPlay:!0,hidden:!0}),q?o.jsx(zA,{mobileHud:St,turnSeconds:k,isActiveDriver:X,idleSkipSeconds:U}):null,o.jsx(BA,{frame:x,sensors:re,label:d,status:Kr,audioStatus:Zs,desktopLayout:xe,layoutFormat:y,variant:S,driverLabel:b,battery:sa,showTopDown:Rl,mobileHud:St,mapPosition:M,turnTimerText:j,labelScale:N}),o.jsx(VA,{compact:St}),ka?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:${_l?1:0} motors:${sn.length} fill:${Math.round(_a*100)}%`}):null,o.jsx(UA,{motors:sn,fill:_a,compact:St}),o.jsx(HA,{charge:we,config:p,compact:St}),Fs&&sa.available?o.jsx(DA,{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]}),!Fs&&o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(OA,{sensors:re}),o.jsx(_A,{visual:sa})]})]})}function _A({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 DA({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 OA({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),S=p<d/2?-1:1,b=`${y*100}%`,w=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:b,background:w,float:S===-1?"right":"left"}})})},p)})})}function BA({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:S=!1,mobileHud:b=!1,mapPosition:w="top-center",turnTimerText:M=null,labelScale:N=1}){l?.bumpsAndWheelDrops;const[C,A]=h.useState(()=>Date.now());h.useEffect(()=>{const P=setInterval(()=>A(Date.now()),150);return()=>clearInterval(P)},[]),a?.receivedAt&&C-a.receivedAt<200;const q=b,j=m==="mobile-portrait",k=q?"text-[0.45rem]":"text-[0.65rem]",X=q?"px-0.25 py-0.25":"px-1 py-0.5",U=q?"px-0.25 py-0.25":"px-0.5 py-0.5",Y=q?"text-[0.55rem]":"text-[0.8rem]",z=q?"left-0.5 top-0.5":"left-1 top-1",I=q?"text-[0.5rem]":"text-[0.7rem]",G=q?"px-0.5 py-0.25":"px-1 py-0.5",te=q?"left-0.5 top-1/2":"left-1 top-1/2",Z="bottom-0.5",W={transform:`translateX(-50%) scale(${N})`,transformOrigin:"center bottom"},se="240px",ue=j?.36:q?.45:.7,B={width:se,height:se,opacity:q?.85:.7,transform:w==="top-center"?`translateX(-50%) scale(${ue})`:`scale(${ue})`,transformOrigin:w==="bottom-left"?"bottom left":w==="top-center"?"top center":"top right",...w==="bottom-left"?{left:"0.25rem",bottom:"0.25rem"}:w==="top-center"?{left:"50%",top:"0.25rem"}:{right:"0.25rem",top:"0.25rem"}};if(x==="spectator"){const P=[["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||"--"]],le=!!l?.chargingSources?.homeBase,ce=l?.chargingState?.label||"",he=!!(ce&&ce.toLowerCase()!=="not charging"),E=l?.oiMode?.label||"Unknown",O=E.toLowerCase(),_=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",V=le?"bg-emerald-500/80 text-emerald-50":"bg-slate-700/70 text-slate-200",ee=he?"bg-emerald-500/80 text-emerald-50":le?"bg-amber-400/80 text-amber-950":"bg-slate-700/70 text-slate-200";return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:[o.jsx("div",{className:`absolute ${z} font-medium text-slate-100 ${k}`,children:o.jsxs("div",{className:"flex flex-col gap-0.5 leading-none",children:[o.jsxs("span",{children:["Status: ",r]}),f?o.jsxs("span",{children:["Audio: ",f]}):null]})}),o.jsx("div",{className:`absolute ${te} flex -translate-y-1/2 flex-col gap-0.5 bg-black/70 text-slate-100 ${k} ${X}`,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 ${V}`,children:le?"Docked":"Undocked"}),o.jsx("span",{className:`rounded px-1.5 py-0.5 ${ee}`,children:he?"Charging":"Not charging"}),o.jsxs("span",{className:`rounded px-1.5 py-0.5 ${_}`,children:["OI: ",E]})]}),P.map(([ne,re])=>o.jsxs("span",{className:"flex items-center justify-between gap-0.5",children:[o.jsx("span",{className:"text-slate-400",children:ne}),o.jsx("span",{className:"font-semibold text-white",children:re})]},ne))]})}),o.jsx("div",{className:`absolute ${Z} left-1/2`,style:W,children:o.jsxs("div",{className:`flex items-center gap-0.5 bg-black/80 text-slate-100 ${U} ${Y}`,children:[o.jsx("span",{className:"font-semibold text-white",children:i||"Unnamed Rover"}),p?o.jsxs("span",{className:"text-slate-300",children:["• ",p]}):null]})})]}),S?o.jsx("div",{className:"pointer-events-none absolute rounded",style:{...B},children:o.jsx(Fu,{sensors:l,size:240,overlay:!0})}):null]})}return o.jsxs("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:[o.jsx("div",{className:`absolute ${z} font-medium text-slate-100 ${k}`,children:o.jsxs("div",{className:"flex flex-col gap-0.5 leading-none",children:[o.jsxs("span",{children:["Status: ",r]}),f?o.jsxs("span",{children:["Audio: ",f]}):null]})}),M?o.jsx("div",{className:`absolute left-1/2 top-0.5 -translate-x-1/2 rounded bg-black/70 text-slate-100 ${G} ${I}`,children:M}):null,o.jsx("div",{className:`absolute ${Z} left-1/2`,style:W,children:o.jsx("div",{className:`flex gap-0.5 bg-black/80 text-slate-100 ${U} ${Y}`,children:o.jsxs("span",{children:['Rover: "',i||"Unnamed Rover",'"']})})}),S&&x!=="spectator"?o.jsx("div",{className:"pointer-events-none absolute rounded",style:{...B},children:o.jsx(Fu,{sensors:l,size:240,overlay:!0})}):null]})}function zA({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 LA={leftWheel:"Left wheel",rightWheel:"Right wheel",mainBrush:"Main brush",sideBrush:"Side brush",limiter:"Overcurrent limit"};function UA({motors:a,fill:l=0,compact:i=!1}){if(!a?.length)return null;const r=a.map(S=>LA[S]||S),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 HA({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 S=p?"Battery low! please dock and charge the rover soon.":"BATTERY VERY LOW, PLEASE DOCK THE ROVER AND CHARGE IMMEDIATELY!!",b=i?"p-2 top-6":"p-4 top-10",w=i?"text-sm":"text-2xl";return o.jsx("div",{className:`pointer-events-none absolute flex items-center justify-center bg-amber-900/60 left-1/2 -translate-x-1/2 ${b}`,children:o.jsx("div",{className:`text-center font-semibold text-white animate-pulse ${w}`,children:o.jsx("div",{children:S})})})}function VA({compact:a=!1}){const{session:l}=_e(),{sendMessage:i,onInputFocus:r,onInputBlur:f,blurChat:d,registerInputRef:m,setTypingActive:x}=pf(),{value:p}=dt("tts",{engine:"flite",voice:"rms",pitch:50}),[y,S]=h.useState(""),[b,w]=h.useState(!1),M=l?.role!=="spectator",N=l?.role==="spectator",C=l?.assignment?.roverId||null,q=!!h.useMemo(()=>l?.roster?.find(z=>String(z.id)===String(C))||null,[C,l?.roster])?.audio?.ttsEnabled,j=h.useMemo(()=>{if(!q)return null;const z=p?.engine==="espeak"?"espeak":"flite";if(z==="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:z,pitch:G}}const I=typeof p?.voice=="string"?p.voice:void 0;return{speak:!0,engine:z,voice:I}},[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",X=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",U=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 Y(z){if(z.preventDefault(),!M)return;const I=y.trim();if(I){w(!0);try{await i(I,j),S(""),d(),x(!1)}catch(G){alert(G.message)}finally{w(!1)}}}return N?null:o.jsxs("form",{onSubmit:Y,className:k,children:[o.jsx("input",{className:X,value:y,onChange:z=>{const I=z.target.value;S(I),x(!!I.trim())},onFocus:z=>{r(z),x(!!y.trim())},onBlur:z=>{f(z),x(!1)},onKeyDown:z=>{z.key==="Enter"&&!y.trim()&&(z.preventDefault(),d(),x(!1))},ref:z=>m(z,{target:"hud"}),placeholder:M?"Chat (TTS)":"Spectator",disabled:!M}),o.jsx("button",{type:"submit",disabled:!M||b,className:U,children:"Speak"})]})}function Nf({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,S]=h.useState(null),b=h.useRef({active:!1,roverId:null});h.useEffect(()=>{if(l?.mode!=="turns")return;const V=setInterval(()=>m(Date.now()),250);return()=>clearInterval(V)},[l?.mode]);const w=l?.assignment?.roverId,N=!!(w&&l?.roster?l.roster.find(V=>String(V.id)===String(w)):null)?.media?.audioPublishUrl,C=w?l?.turnQueues?.[w]:null,A=l?.socketId||null,q=w?l?.activeDrivers?.[w]:null,j=!!(A&&q===A),k=h.useMemo(()=>{const V=C?.queue||[];if(!V.length||!C?.current||V.length<=1)return null;const ee=V.findIndex(ne=>ne===C.current);return ee===-1?V[0]||null:V[(ee+1)%V.length]||null},[C?.queue,C?.current]),X=!!(A&&k===A),U=C?.deadline||null,Y=C?.idleDeadline||null,z=U?U-d:null,I=Y?Y-d:null,G=l?.mode==="turns"&&X&&z!=null&&z<=5e3&&z>0,te=l?.mode!=="turns"||j||G,Z=z!=null&&Number.isFinite(z)?Math.max(0,Math.ceil(z/1e3)):null,W=I!=null&&Number.isFinite(I)?Math.max(0,Math.ceil(I/1e3)):null,se=j?Z!=null?`${Z}s left`:null:X&&Z!=null?`Your turn in ${Z}s`:null,ue=w?[...te?[{type:"rover",id:w,key:w}]:[],...N?[{type:"rover",id:`${w}-audio`,key:`${w}-audio`}]:[]]:[],ae=bf(ue),B=w&&te?ae[w]:null,P=w&&N?ae[`${w}-audio`]:null,le=Sf(w?[w]:[],{enabled:!!w,version:l?.mode}),ce=w&&le[w]||null,he=Tl(w),E=w&&l?.roster?l.roster.find(V=>String(V.id)===String(w)):null,O=E?.battery??null,_=E?.name||(w?`Rover ${w}`:"");return h.useEffect(()=>{if(l?.mode!=="turns"){p(!1),S(null),b.current={active:!1,roverId:null};return}const V=b.current,ee=j&&!V.active,ne=j&&w&&w!==V.roverId;ee||ne?(p(!0),S(Date.now())):!j&&V.active&&(p(!1),S(null)),b.current={active:j,roverId:w}},[j,w,l?.mode]),h.useEffect(()=>{!x||!y||r>y&&p(!1)},[r,y,x]),o.jsx("section",{className:"panel",children:w?o.jsx(jf,{sessionInfo:B,videoMode:te?"whep":"snapshot",snapshotFeed:ce,audioSessionInfo:P,label:_,telemetryFrame:he,batteryConfig:O,layoutFormat:a,overcurrentLimiter:f,songNote:i?.note,qualityNotice:te?null:"Preview feed (low FPS) until your turn.",showTurnCue:x,turnTimerText:se,turnSeconds:Z,isActiveDriver:j,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 x0(...a){return a.filter(Boolean).join(" ")}function YA(a){const l=a?.batteryState?.percentDisplay;return l==null?"--":`${l}%`}function $A(a){return a?.batteryState?a.batteryState.urgentActive?"text-red-400":a.batteryState.warnActive?"text-amber-300":"text-emerald-300":"text-slate-400"}function GA({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:x0("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:x0("font-semibold",$A(f)),children:["Battery ",YA(f)]})]})]}),r?r(f):null]},f.id))})]})}function QA({keymap:a}){const{state:{roverId:l,camera:i},actions:{setServoAngle:r}}=ht(),f=i?.config,d=!!(l&&i?.enabled&&f),m=typeof f?.minAngle=="number"?f.minAngle:-30,x=typeof f?.maxAngle=="number"?f.maxAngle:30,p=typeof i?.angle=="number"?i.angle:typeof f?.homeAngle=="number"?f.homeAngle:(m+x)/2,[y,S]=h.useState(p),b=h.useRef(!1);h.useEffect(()=>{b.current||S(p)},[p]);const w=A=>{const q=Number.parseFloat(A.target.value);Number.isNaN(q)||(b.current=!0,S(q),r(q))},M=()=>{b.current=!1};if(!d)return null;const N=la(a?.cameraUp?.[0]),C=la(a?.cameraDown?.[0]);return o.jsxs("div",{className:"surface space-y-0.5 px-1 py-1 text-sm text-slate-200",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:Tu(p)})]}),o.jsxs("div",{children:[o.jsx("input",{type:"range",className:"w-full accent-emerald-400",min:m,max:x,step:.5,value:y,onChange:w,onMouseUp:M,onTouchEnd:M,onPointerUp:M}),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:[C?o.jsx(y0,{label:C}):null,Tu(m)]}),o.jsxs("span",{className:"flex items-center gap-0.5",children:[Tu(x),N?o.jsx(y0,{label:N}):null]})]})]})]})}function y0({label:a}){return o.jsx("span",{className:"rounded border border-white/40 px-1 text-[0.7rem] text-white",children:a})}function Tu(a){return typeof a!="number"||Number.isNaN(a)?"—":`${a>0?"+":""}${a.toFixed(1)}°`}function Ju({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 XA(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 S=0;return x===f?S=(d-m)/y%6:x===d?S=(m-f)/y+2:S=(f-d)/y+4,$r(Math.round(S*60))}function v0(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 b0(a){return a?Array.isArray(a.hsColor)?$r(Number(a.hsColor[0])):Array.isArray(a.rgbColor)?XA(a.rgbColor):0:0}function KA({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,S=y||!m,[b,w]=h.useState(()=>b0(a)),M=h.useRef(b),N=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||N.current)return;const U=b0(a);M.current=U,w(U)},[a.rgbColor,a.hsColor,m]);const A=U=>{const Y=$r(Number(U.target.value));M.current=Y,w(Y)},q=()=>{S||!r||r(a.id,v0(M.current))},j=U=>{U.stopPropagation()},X=`rgb(${(m?v0(M.current):[255,255,255]).join(",")})`;return o.jsxs("button",{type:"button",onClick:()=>i(a.id),disabled:y,className:`relative flex min-w-[10rem] flex-1 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(Ju,{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:j,onPointerDown:U=>{j(U),N.current=!0},onPointerUp:U=>{j(U),N.current=!1,q()},onPointerCancel:U=>{j(U),N.current=!1,q()},onKeyUp:U=>{j(U),q()},onBlur:q,children:o.jsx("div",{className:"relative w-full",children:o.jsx("input",{type:"range",min:"0",max:"360",step:"1",value:b,onChange:A,disabled:S,"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(Ju,{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:X}}),!m&&o.jsx("div",{className:"self-center text-xs font-semibold text-white/90",children:d?"Turn off":"Turn on"})]})}function Hg(){const{state:{keymap:a}}=ht(),{session:l,homeAssistantToggle:i,homeAssistantSetLightColor:r}=_e(),f=l?.homeAssistant,d=h.useMemo(()=>f?.entities||[],[f?.entities]),m=la(a?.homeAssistantOn?.[0]),x=la(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:"Light 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:"Light 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:"Light 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(S0,{label:m}):null]}),o.jsxs("span",{className:"flex items-center gap-0.5",children:[o.jsx("span",{children:"Off"}),x?o.jsx(S0,{label:x}):null]})]})]}),o.jsx(Ju,{label:p?"Connected":"Offline",tone:p?"success":"warn"})]}),o.jsx("div",{className:"flex flex-wrap gap-0.5",children:d.map(y=>o.jsx(KA,{entity:y,connected:p,onToggle:i,onSetColor:r},y.id))})]})}function S0({label:a}){return a?o.jsx("span",{className:"rounded border border-white/40 px-1 text-[0.7rem] text-white",children:a}):null}function Vg(){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(S){alert(S.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 ZA=[{key:"open",label:"Open"},{key:"turns",label:"Turns"},{key:"admin",label:"Admin"},{key:"lockdown",label:"Lockdown"}];function FA(){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,S=a?.communityGoal?.text||"",b=a?.communityGoal?.updatedAt||null,[w,M]=h.useState(S),N=a?.role==="admin"||a?.role==="lockdown"||a?.role==="lockdown-admin",C=a?.mode??"open",A=async(Y,z)=>{try{await l(Y,z),p(I=>({...I,[Y]:z}))}catch(I){alert(I.message)}},q=async Y=>{const z=Y.target.value;try{await i(z)}catch(I){alert(I.message)}},j=async Y=>{try{await r(Y,{force:!0})}catch(z){alert(z.message)}},k=async()=>{try{await f(w)}catch(Y){alert(Y.message)}},X=async()=>{try{await f(null)}catch(Y){alert(Y.message)}};h.useEffect(()=>{M(S)},[S]);const U=h.useMemo(()=>{const Y={};return m.forEach(z=>{Y[z.id]=x[z.id]??z.locked}),Y},[m,x]);return N?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:ZA.map(Y=>o.jsx("option",{value:Y.key,children:Y.label},Y.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"}),b?o.jsxs("span",{children:["Updated ",new Date(b).toLocaleString()]}):null]}),o.jsx("input",{type:"text",value:w,onChange:Y=>M(Y.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:X,className:"button-danger",children:"Clear"})]})]}),o.jsx(GA,{roster:m,renderActions:Y=>o.jsxs("div",{className:"flex flex-wrap gap-0.5 text-xs",children:[o.jsx("button",{type:"button",onClick:()=>A(Y.id,!U[Y.id]),className:"button-dark",children:U[Y.id]?"Unlock":"Lock"}),o.jsx("button",{type:"button",onClick:()=>j(Y.id),className:"button-dark",children:"Force"})]})}),o.jsx(JA,{health:y}),o.jsx(IA,{entries:d})]}):null}function JA({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 IA({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 WA=[{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 PA(a){return a.reduce((l,i)=>((l[i.group]||(l[i.group]=[])).push(i),l),{})}function ej(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(0,Math.min(500,i)):l}const wf=5,Vs=500,Ys=1,Ef=100;function tj(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(wf,Math.min(Vs,i)):l}function Mr(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(Ys,Math.min(Ef,i)):l}function nj(a){const i=(Mr(a,a)-Ys)/(Ef-Ys),r=Vs-i*(Vs-wf);return Math.round(r)}function aj(a){const l=tj(a,a),i=(Vs-l)/(Vs-wf),r=Ys+i*(Ef-Ys);return Math.round(r)}function lj(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=Xs(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 sj(){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(aj(d.tiltIntervalMs),en.keyboard.tiltSpeed):en.keyboard.tiltSpeed,[d.tiltIntervalMs,d.tiltSpeed]),x=h.useMemo(()=>PA(WA),[]),{active:p,startCapture:y,cancel:S}=lj((N,C)=>{l(N,C)}),b=h.useCallback(N=>a?.[N]?.[0]||Bs[N]?.[0]||"",[a]),w=h.useCallback((N,C)=>{const A=en.keyboard,q=ej(C,A[N]);f(j=>({...j??{},keyboard:{...j?.keyboard??A,[N]:q}}))},[f]),M=h.useCallback(N=>{const C=en.keyboard,A=Mr(N,C.tiltSpeed),q=nj(A);f(j=>({...j??{},keyboard:{...j?.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:N=>w("baseSpeed",N)}),o.jsx(vr,{label:"Turbo speed",description:"Used when holding the boost modifier",value:d.turboSpeed,onChange:N=>w("turboSpeed",N)}),o.jsx(vr,{label:"Precision speed",description:"Used when holding the precision modifier",value:d.precisionSpeed,onChange:N=>w("precisionSpeed",N)})]})]}),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(([N,C])=>o.jsxs("div",{className:"space-y-0.5 surface",children:[o.jsx("p",{className:"text-[0.75rem] text-slate-400",children:N}),o.jsx("div",{className:"space-y-0.5",children:C.map(A=>{const q=b(A.id),j=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:la(q)})]}),o.jsxs("div",{className:"flex items-center gap-0.5",children:[j&&o.jsx("button",{type:"button",onClick:()=>S(),className:"button-danger text-[0.7rem]",children:"Cancel"}),o.jsx("button",{type:"button",onClick:()=>y(A.id),className:`${j?"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:j?"Press a key…":"Change"})]})]},A.id)})})]},N))})]})}const Cn=new Intl.NumberFormat(void 0,{maximumFractionDigits:2}),ij=[{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"}],A0=.45,rj=.6;function Ds({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 oj(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 cj(a){return a.reduce((l,i)=>((l[i.section]||(l[i.section]=[])).push(i),l),{})}function uj(a,l){if(!a||a.length===0)return null;if(l){const i=a.find(r=>r.signature===l);if(i)return i}return a[0]}function fj(a){return{axes:Array.from(a.axes??[]),buttons:(a.buttons??[]).map(l=>({pressed:!!l?.pressed,value:typeof l?.value=="number"?l.value:l?.pressed?1:0}))}}function dj(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>A0).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>A0);return f?{kind:"axis",index:f.index,...i.invertDefaults??{}}:null}function hj(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>rj)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 mj(a,l,i){if(!a)return null;if(i.kind==="axis"||i.kind==="axisPair"){const r=dj(a,l,i);if(r)return r}return hj(a,l,i)}function pj(){const a=lA(),{value:l,save:i}=dt("gamepad",na),[r,f]=h.useState(null),d=h.useRef(null),m=h.useMemo(()=>cj(ij),[]),x=h.useMemo(()=>uj(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??na;if(q.profiles?.[p])return q;const j=q?.defaults?.profile??qn,k=qg(x,j);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=fj(x);return}const A=mj(x,d.current,r);A&&(i(q=>{const j=q??na,k=j.profiles?.[p]??j?.defaults?.profile??qn,X={...k,bindings:{...k.bindings??{},[r.id]:{...k.bindings?.[r.id]??{},kind:r.kind,sources:[A]}}};return{...j,profiles:{...j.profiles??{},[p]:X}}}),f(null))},[x,p,r,i]);const S=h.useCallback(A=>{i(q=>({...q??na,activeSignature:A||null}))},[i]),b=h.useCallback(A=>{i(q=>{const j=q??na,k=(p&&j.profiles?.[p])??j?.defaults?.profile??qn,X={...k,calibration:{...k.calibration??{},...A}};return p?{...j,profiles:{...j.profiles??{},[p]:X}}:{...j,defaults:{...j.defaults??{},profile:X}}})},[p,i]),w=h.useCallback((A,q)=>{i(j=>{const k=j??na,X=(p&&k.profiles?.[p])??k?.defaults?.profile??qn,U=q(X.bindings?.[A]??{}),Y={...X,bindings:{...X.bindings??{},[A]:U}};return p?{...k,profiles:{...k.profiles??{},[p]:Y}}:{...k,defaults:{...k.defaults??{},profile:Y}}})},[p,i]),M=h.useCallback(A=>{w(A.id,q=>({...q,sources:[]}))},[w]),N=h.useCallback((A,q)=>{w(A.id,j=>{const k=Array.isArray(j.sources)?[...j.sources]:[];if(!k[0])return j;const X={...k[0]};return q==="invertX"?X.invertX=!X.invertX:q==="invertY"?X.invertY=!X.invertY:X.invert=!X.invert,k[0]=X,{...j,sources:k}})},[w]),C=h.useMemo(()=>x?{outputs:Mg(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=>S(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(Ds,{label:"Drive deadzone",description:"Ignore small drive stick drift",min:0,max:.6,step:.01,value:y.calibration?.driveDeadzone??.18,onChange:A=>b({driveDeadzone:A})}),o.jsx(Ds,{label:"Camera deadzone",description:"Ignore small camera tilt drift",min:0,max:.4,step:.01,value:y.calibration?.cameraDeadzone??.08,onChange:A=>b({cameraDeadzone:A})}),o.jsx(Ds,{label:"Aux deadzone",description:"Ignore small trigger noise",min:0,max:.4,step:.01,value:y.calibration?.auxDeadzone??.05,onChange:A=>b({auxDeadzone:A})}),o.jsx(Ds,{label:"Side brush scale",description:"Scale side brush output",min:.3,max:1,step:.05,value:y.calibration?.auxSideScale??.55,onChange:A=>b({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=>b({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(Ds,{label:"Camera sensitivity",description:"Velocity mode degrees per second",min:10,max:180,step:5,value:y.calibration?.cameraSensitivity??60,onChange:A=>b({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(j=>{const X=y.bindings?.[j.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:j.label}),o.jsx("p",{className:"text-[0.65rem] text-slate-400",children:oj(X)})]}),o.jsxs("div",{className:"flex items-center gap-0.5",children:[j.kind==="axisPair"&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",disabled:!X,onClick:()=>N(j,"invertX"),className:"button-dark text-[0.7rem] font-medium disabled:opacity-50",children:"Invert X"}),o.jsx("button",{type:"button",disabled:!X,onClick:()=>N(j,"invertY"),className:"button-dark text-[0.7rem] font-medium disabled:opacity-50",children:"Invert Y"})]}),j.kind==="axis"&&o.jsx("button",{type:"button",disabled:!X,onClick:()=>N(j),className:"button-dark text-[0.7rem] font-medium disabled:opacity-50",children:"Invert"}),o.jsx("button",{type:"button",onClick:()=>M(j),className:"button-dark text-[0.7rem]",children:"Clear"}),o.jsx("button",{type:"button",onClick:()=>f(j),className:`${r?.id===j.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===j.id?"Waiting…":"Capture"})]})]},j.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 gj={drive:"Drive wheels",aux:"Aux motors"};function j0(a){return Number.isFinite(a)?`${Math.round(a*100)}%`:"--"}function xj({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 yj(){const{state:{roverId:a},overcurrentLimiter:l}=ht(),i=h.useMemo(()=>Al.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:gj[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:j0(f)})]}),o.jsx(xj,{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:j0(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 Yg=h.createContext(null);function $g(){const a=h.useContext(Yg);if(!a)throw new Error("Tabs components must be used within a <Tabs> provider.");return a}const N0={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"}},Gg="primary";function Cf(...a){return a.filter(Boolean).join(" ")}function qf({children:a,defaultTab:l,currentTab:i,onTabChange:r,variant:f=Gg}){const[d,m]=h.useState(l??null),[x,p]=h.useState([]),y=h.useCallback(M=>M?(p(N=>N.includes(M)?N:[...N,M]),()=>p(N=>N.includes(M)?N.filter(C=>C!==M):N)):()=>{},[]),S=i??d??x[0]??null;h.useEffect(()=>{l&&i===void 0&&m(l)},[l,i]);const b=h.useCallback(M=>{M&&(i===void 0&&m(M),r&&r(M))},[i,r]),w=h.useMemo(()=>({activeTab:S,setActiveTab:b,registerTab:y,variant:f}),[S,b,y,f]);return o.jsx(Yg.Provider,{value:w,children:a})}function Mf({children:a,className:l=""}){return o.jsx("div",{className:Cf("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}=$g();h.useEffect(()=>m(a),[a,m]);const p=N0[x]??N0[Gg],y=f===a,S=Cf(p.base,y?p.active:p.inactive,r?"cursor-not-allowed opacity-50":"",i);return o.jsx("button",{type:"button",className:S,onClick:()=>!r&&d(a),"aria-pressed":y,"aria-disabled":r,children:l})}function Tf({children:a,className:l=""}){return o.jsx("div",{className:Cf("mt-0 space-y-0.5",l),children:a})}function Zt({id:a,children:l,keepMounted:i=!1}){const{activeTab:r}=$g(),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 vj(){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 w0=300,E0=240;function bj(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 Sj(a){const i=a.map(r=>bj(r)).join(" ");return i.length>E0?`${i.slice(0,E0)}…`:i}function Aj(){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,S)=>{i(b=>{const w=[...b,{id:`${Date.now()}-${Math.random().toString(16).slice(2)}`,direction:p,event:y,payload:Sj(S),timestamp:new Date().toLocaleTimeString()}];return w.length>w0?w.slice(-w0):w})},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,...S)=>(m(y,...S),p(y,...S)),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 jj=[{key:"start",label:"Start OI"},{key:"safe",label:"Safe"},{key:"full",label:"Full"},{key:"passive",label:"Passive"},{key:"dock",label:"Dock"}];function Qg(){const{state:{roverId:a},actions:{sendOiCommand:l,setSensorStream:i}}=ht(),r=!!a,[f,d]=Ug(),m=ln(),{value:x,save:p}=dt("page",{hudMapDesktop:!1,connectionTransport:"websocket"}),y=x?.connectionTransport||"websocket",S=h.useMemo(()=>[{key:"start",label:"Enable stream",enable:!0},{key:"stop",label:"Disable stream",enable:!1}],[]),b=M=>{a&&i(M)},w=M=>{const N=M.target.value;p(C=>({...C??{},connectionTransport:N})),m?.io?.opts&&(m.io.opts.transports=N==="polling"?["polling"]:["websocket","polling"],m.disconnect(),m.connect())};return o.jsxs(qf,{defaultTab:"keybindings",children:[o.jsxs(Mf,{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(Tf,{children:[o.jsx(Zt,{id:"keybindings",children:o.jsx("div",{className:"space-y-0.5",children:o.jsx(sj,{})})}),o.jsx(Zt,{id:"controller",children:o.jsx("div",{className:"space-y-0.5",children:o.jsx(pj,{})})}),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:w,className:"field-input text-sm",children:[o.jsx("option",{value:"websocket",children:"WebSocket"}),o.jsx("option",{value:"polling",children:"Polling"})]})]}),o.jsx("p",{className:"text-xs text-slate-500",children:"Switching reconnects your session."})]})]})}),o.jsx(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:jj.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:S.map(M=>o.jsx("button",{type:"button",onClick:()=>b(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(Vg,{}),o.jsx(yj,{}),o.jsx(FA,{}),o.jsx(vj,{}),o.jsx(Aj,{})]})})]})]})}const C0={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 Nj(a){return C0[a]||C0.desktop}function Xg({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:la(i)})}function q0(a,l){return a.map((i,r)=>typeof i=="string"?o.jsx("span",{children:i},`text-${r}`):i?.action?o.jsx(Xg,{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 q0(a.segments,l);if(a&&typeof a=="object"){if(typeof a.text=="string")return a.text;if(Array.isArray(a))return q0(a,l)}return String(a??"")}function wj({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 Ej({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 Cj({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 qj({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(Xg,{actionId:i.action,keymap:l})]},i.action))})]})}function Mj({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(qj,{group:i,keymap:l},i.id))})]}):null}function Tj({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 M0({block:a,keymap:l}){if(!a)return null;switch(a.type){case"list":return o.jsx(Ej,{block:a,keymap:l});case"callout":return o.jsx(Cj,{block:a});case"keyboard":return o.jsx(Mj,{block:a,keymap:l});case"gamepad":return o.jsx(Tj,{block:a});default:return null}}function Kg({layout:a,keymap:l}){const i=h.useMemo(()=>Nj(a),[a]),r=l||{},f=i.main||[],d=i.aside||[];return o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(wj,{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(M0,{block:m,keymap:r},m.title||x))}),o.jsx("div",{className:"space-y-0.5",children:d.map((m,x)=>o.jsx(M0,{block:m,keymap:r},m.title||x))})]})]})}function Zg({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(Kg,{layout:a,keymap:i?.keymap||{}})]})}const Rj=["kal","rms","slt","ksp","bdl"],kj=Array.from({length:10},(a,l)=>l*10);function Qr({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:S,blurChat:b,setTypingActive:w}=pf(),{value:M,save:N}=dt("tts",{engine:"flite",voice:"rms",pitch:50}),[C,A]=h.useState(""),[q,j]=h.useState(!1),[k,X]=h.useState(!1),[U,Y]=h.useState(()=>M?.engine||"flite"),[z,I]=h.useState(()=>M?.voice||"rms"),[G,te]=h.useState(()=>Number.isFinite(M?.pitch)?M.pitch:50),Z=f?.role!=="spectator"||r,W=h.useRef(null),se=f?.assignment?.roverId||null,ae=!!h.useMemo(()=>f?.roster?.find(E=>String(E.id)===String(se))||null,[se,f?.roster])?.audio?.ttsEnabled,B=h.useMemo(()=>d.slice(-200),[d]),P=h.useMemo(()=>m||[],[m]);h.useEffect(()=>{W.current&&(W.current.scrollTop=W.current.scrollHeight)},[B,P]),h.useEffect(()=>{const E=M?.engine||"flite",O=M?.voice||"rms",_=Number.isFinite(M?.pitch)?M.pitch:50;U!==E&&Y(E),z!==O&&I(O),G!==_&&te(_)},[U,G,M?.engine,M?.pitch,M?.voice,z]),h.useEffect(()=>{X(!!ae)},[ae]);const le=h.useMemo(()=>!ae||!k?null:U==="espeak"?{speak:!0,engine:U,pitch:G}:{speak:!0,engine:U,voice:z},[U,G,k,ae,z]);async function ce(E){if(E.preventDefault(),!Z||a)return;const _=C.replace(/\\n/g,`
`).trim();if(_){j(!0);try{await x(_,le),A(""),b(),w(!1)}catch(V){alert(V.message)}finally{j(!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:[B.length===0&&P.length===0?o.jsx("p",{className:"text-sm text-slate-500",children:"No messages yet."}):B.map(E=>o.jsx(bg,{message:E},E.id)),P.map(E=>o.jsx(Sg,{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),w(!!O.trim())},onFocus:E=>{y(E),w(!!C.trim())},onBlur:E=>{S(E),w(!1)},onKeyDown:E=>{E.key==="Enter"&&!C.trim()&&(E.preventDefault(),b(),w(!1))},ref:E=>p(E,{target:"panel"}),placeholder:Z?"Type a message…":l?"":"Spectators cannot chat",disabled:!Z}),ae&&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=>X(E.target.checked),className:"accent-cyan-500"}),o.jsx("span",{children:"Speak"})]}),o.jsxs("select",{value:U,onChange:E=>{const O=E.target.value;Y(O),N(_=>({..._||{},engine:O}))},className:"field-input text-xs",children:[o.jsx("option",{value:"flite",children:"flite"}),o.jsx("option",{value:"espeak",children:"espeak"})]}),U==="flite"?o.jsx("select",{value:z,onChange:E=>{const O=E.target.value;I(O),N(_=>({..._||{},voice:O}))},className:"field-input text-xs",children:Rj.map(E=>o.jsx("option",{value:E,children:E},E))}):o.jsx("select",{value:G,onChange:E=>{const O=Number(E.target.value);te(O),N(_=>({..._||{},pitch:O}))},className:"field-input text-xs",children:kj.map(E=>o.jsxs("option",{value:E,children:["pitch ",E]},E))})]}),o.jsx("button",{type:"submit",disabled:!Z||q,className:"button-dark h-full disabled:opacity-50 self-stretch",children:q?"...":"Send"})]})]})}function Rf({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 S(b){if(b.preventDefault(),!y)return;const w=(d||"").trim().slice(0,32);if(w){p(!0);try{await i(w),f({nickname:w})}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:S,children:[o.jsx("input",{className:"field-input flex-1 min-w-0",value:d,onChange:b=>m(b.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 Fg({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(mS,{className:"mr-0"}),a]}):null}function _j({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(Rf,{compact:a})})})}function Dj(){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(Fg,{className:"h-full"})]})})}function Ru(...a){return a.filter(Boolean).join(" ")}function Oj(a){const l=a?.batteryState?.percentDisplay;return l==null?"--":`${l}%`}function Bj(a){return a?.batteryState?a.batteryState.urgentActive?"text-red-400":a.batteryState.warnActive?"text-amber-300":"text-emerald-300":"text-slate-400"}function zj(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 Lj(a,l){if(!a)return"";const i=a.nickname||a.socketId?.slice(0,6)||"unknown";return a.socketId&&a.socketId===l?`${i} (you)`:i}function Xr({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??{},S=l?.users??[],b=l?.socketId||null,w=h.useMemo(()=>Object.values(y||{}).some(A=>A?.deadline||A?.idleDeadline),[y]);h.useEffect(()=>{if(!w)return;const A=setInterval(()=>{m(Date.now())},1e3);return()=>clearInterval(A)},[w]);const M=h.useMemo(()=>{const A=new Set(p.map(j=>String(j.id))),q=Object.keys(y||{}).filter(j=>!A.has(String(j))).map(j=>({id:j,name:j,locked:!1,batteryState:null}));return[...p,...q]},[p,y]);async function N(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=>S.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),j=y?.[q]||null,k=j?.queue||[],X=j?.idleDeadline||j?.deadline||null,U=X&&X>d?Math.ceil((X-d)/1e3):X?0:null,Y=j?.current||null,z=Y?k.findIndex(B=>B===Y):-1,I=k.length>1?z>=0?k[(z+1)%k.length]:k[0]:null,G=!!(b&&Y&&Y===b),te=!!(b&&I&&I===b),Z=U!=null&&(G||te),W=!!A.locked,se=A.lockReason?`locked: ${A.lockReason}`:"locked",ue=W?se:r[q]?"...":"request",ae=x&&!W&&!r[q];return o.jsxs("li",{className:Ru("surface flex flex-wrap items-start justify-between gap-0.5",ae&&"cursor-pointer",W&&"bg-red-900/40"),onClick:()=>{ae&&N(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}),Z?o.jsx("span",{className:"rounded bg-slate-800 px-1 text-[0.7rem] text-slate-200",children:G?`${U}s left`:`Your turn in ${U}s`}):null]}),o.jsx("span",{className:Ru("text-[0.75rem] font-semibold",Bj(A)),children:Oj(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((B,P)=>{const le=C(B),ce=B===Y,he=!!(I&&B===I&&!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:`${zj(le.role)} font-semibold`,children:Lj(le,b)}),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}-${B}-${P}`)})})]}),x?o.jsx("button",{type:"button",onClick:B=>{B.stopPropagation(),N(A.id)},disabled:r[q]||W,className:Ru("button-dark disabled:opacity-40",W&&"bg-red-600/70 text-white hover:bg-red-600"),children:ue}):null]},A.id)})})]})}function Uj(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 Hj(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(),S=d?.role!=="spectator",b=d?.users??[],w=d?.socketId||null;h.useEffect(()=>{if(!S||!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(()=>{})},[S,d?.socketId,m,x.nickname]),h.useEffect(()=>{if(!y)return;const C=()=>{if(!S)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)},[S,m,y,x.nickname,d?.socketId]);const M=h.useMemo(()=>[...b].sort((C,A)=>C.socketId===w?-1:A.socketId===w?1:(C.nickname||"").localeCompare(A.nickname||"")),[w,b]),N=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(Rf,{compact:f})})}),o.jsxs("div",{className:"grid gap-0.5 sm:grid-cols-2 md:grid-cols-1",children:[o.jsx(Yr,{}),o.jsx(Fg,{})]})]}),!S&&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 ${N} ${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] ${Uj(C.role)}`,children:Hj(C,w)},C.socketId))})]})]})}function Vj(){const{state:{roverId:a}}=ht(),i=Tl(a)?.sensors||{};return o.jsx("section",{className:"panel-section",children:o.jsx("div",{className:"aspect-square w-full",children:o.jsx(Fu,{sensors:i})})})}function Yj(){const{state:{roverId:a,keymap:l}}=ht(),i=_g(a),r=i.docked&&!i.driving;return o.jsxs("section",{className:"panel-section flex h-full flex-col gap-0.5",children:[o.jsx(Dg,{layout:"desktop",expand:!0,driveDockState:i}),r?null:o.jsx(QA,{keymap:l})]})}function $j({layout:a,onOpenHelpOverlay:l}){return o.jsx("section",{className:"panel text-base",children:o.jsxs(qf,{defaultTab:"telemetry",children:[o.jsxs(Mf,{children:[o.jsx(Kt,{id:"telemetry",children:"Controls"}),o.jsx(Kt,{id:"help",children:"Help"}),o.jsx(Kt,{id:"settings",children:"Settings"})]}),o.jsxs(Tf,{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(Vj,{}),o.jsx(Yj,{})]}),o.jsxs("div",{className:"grid gap-0.5 grid-cols-[minmax(0,1fr)_minmax(0,0.9fr)_minmax(0,0.75fr)]",children:[o.jsx(Xr,{}),o.jsx(df,{panelId:"replay-sources-desktop",fillHeight:!0}),o.jsx(Dj,{})]}),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(Qr,{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(_j,{compact:!0})]})]}),o.jsx(Hg,{}),o.jsx(yf,{defaultOrientation:"horizontal",panelId:"rightpane-telemetry"})]})}),o.jsx(Zt,{id:"help",children:o.jsx(Zg,{layout:a,onOpenOverlay:l})}),o.jsx(Zt,{id:"settings",children:o.jsx(Qg,{})})]})]})})}const Gj=new Set(["admin","lockdown","lockdown-admin"]),Qj=new Set(["lockdown","lockdown-admin"]),Xj=new Set(["admin","lockdown"]);function Kj(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 Zj(){const{session:a}=_e(),l=a?.mode,i=a?.role,r=Xj.has(l),f=l==="lockdown"?Qj.has(i):Gj.has(i);if(!r||f)return null;const d=Kj(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(Vg,{})}),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(Qr,{}),o.jsx(Rf,{})]})]})})}const Fj="/assets/turn_alert-DVO8EZJa.mp3";function Jj(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 Ij(){const{session:a,pushAlert:l}=_e(),i=Jj(Fj),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 Wj({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 Jg="fullscreenPromptDismissed",Pj=new Set(["mobile-portrait","mobile-landscape"]),Ig=()=>{if(typeof window>"u")return null;try{return window.sessionStorage}catch{return null}},eN=()=>{const a=Ig();if(!a)return!1;try{return a.getItem(Jg)==="1"}catch{return!1}},T0=()=>{const a=Ig();if(a)try{a.setItem(Jg,"1")}catch{}},tN=()=>{if(typeof navigator>"u")return!1;const a=navigator.userAgent||navigator.platform||"";return/iphone|ipad|ipod/i.test(a)},nN=()=>{if(typeof document>"u")return!1;const a=document;return!!(a.fullscreenEnabled||a.webkitFullscreenEnabled||a.mozFullScreenEnabled||a.msFullscreenEnabled)};function aN(a){const l=Pj.has(a),[i,r]=h.useState(!1),[f,d]=h.useState("native"),m=h.useMemo(()=>tN(),[]),x=h.useCallback(()=>{if(!l){r(!1);return}if(eN()){r(!1);return}if(m){d("pwa-hint"),r(!0);return}if(!nN()){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 S=()=>{if(document.fullscreenElement){r(!1);return}x()};return document.addEventListener("fullscreenchange",S),document.addEventListener("webkitfullscreenchange",S),()=>{document.removeEventListener("fullscreenchange",S),document.removeEventListener("webkitfullscreenchange",S)}},[x]);const p=h.useCallback(()=>{T0(),r(!1)},[]),y=h.useCallback(async()=>{if(!l||m||typeof document>"u")return!1;const S=document.documentElement;if(!S)return!1;const b=S.requestFullscreen||S.webkitRequestFullscreen||S.mozRequestFullScreen||S.msRequestFullscreen;if(!b)return!1;try{const w=b.call(S);return w&&typeof w.then=="function"&&await w,T0(),r(!1),!0}catch(w){return console.warn("Failed to enter fullscreen",w),!1}},[m,l]);return h.useEffect(()=>{l||r(!1)},[l]),{visible:i,mode:f,enterFullscreen:y,dismiss:p}}function lN({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(Kg,{layout:l,keymap:d?.keymap||{}})})]})})}const sN=`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 iN(a){return a?a.charAt(0).toUpperCase()+a.slice(1):""}function rN(){const a=String(sN).split(/\r?\n/).map(i=>i.trim()).filter(Boolean);return a.length?(a[Math.floor(Math.random()*a.length)]||"").trim():""}function kf(){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=iN(rN()).slice(0,32);if(!m)return;(async()=>{try{await a(m)}catch{}finally{r({nickname:m})}})()},[r,a,i,l.nickname])}const ku=1e4,_u=28,oN=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(_u),[S,b]=h.useState(0),w=h.useRef(null),M=h.useRef(null),N=h.useRef(null);h.useEffect(()=>{if(!f){x(!1);return}if(x(!0),!d||!i)return;const j=Date.now();b(ku);const k=setTimeout(()=>x(!1),ku),X=setInterval(()=>{const U=Date.now()-j;b(Math.max(0,ku-U))},250);return()=>{clearTimeout(k),clearInterval(X)}},[f,d]),h.useEffect(()=>{if(!f)return;y(_u);let j=0;const k=()=>{const U=N.current,Y=M.current;if(!U||!Y)return;const z=U.clientWidth;if(!z)return;const I=Y.scrollWidth;if(!I)return;const G=Math.min(1,z/I),te=Math.max(oN,Math.floor(_u*G));y(te)};j=window.requestAnimationFrame(k);const X=new ResizeObserver(()=>{window.cancelAnimationFrame(j),j=window.requestAnimationFrame(k)});return w.current&&X.observe(w.current),()=>{window.cancelAnimationFrame(j),X.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(S/1e3):null,q=i?{onClick:()=>x(!1),role:"button",tabIndex:0}:{};return o.jsx("div",{ref:w,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:N,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 cN(){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 uN({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(Nf,{}),o.jsx(eS,{}),o.jsx(vf,{})]}),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($j,{layout:a,onOpenHelpOverlay:l})]})]})}function Wg({layout:a,onOpenHelpOverlay:l,roomPanelId:i,showTelemetry:r=!0}){return o.jsx("section",{className:"panel text-base",children:o.jsxs(qf,{defaultTab:"chat",children:[o.jsxs(Mf,{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(Tf,{children:[o.jsx(Zt,{id:"chat",children:o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(Qr,{}),o.jsx(Or,{})]})}),o.jsx(Zt,{id:"roomcontrols",children:o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(Hg,{}),o.jsx(yf,{panelId:i})]})}),o.jsx(Zt,{id:"help",children:o.jsx(Zg,{layout:a,onOpenOverlay:l})}),o.jsx(Zt,{id:"settings",children:o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(Qg,{}),o.jsx(vf,{})]})})]})]})})}function fN({onOpenHelpOverlay:a}){return o.jsxs("div",{className:"flex flex-col gap-0.5",children:[o.jsx(Nf,{layoutFormat:"mobile-portrait"}),o.jsx(mA,{}),o.jsxs("div",{className:"grid gap-0.5 grid-cols-[minmax(0,1fr)_minmax(0,1.4fr)]",children:[o.jsx(df,{panelId:"replay-sources-mobile-portrait"}),o.jsx(Xr,{})]}),o.jsx(Wg,{layout:"mobile-portrait",onOpenHelpOverlay:a,roomPanelId:"mobile-portrait-room"})]})}function dN({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(dA,{}),o.jsxs("div",{children:[o.jsx(Nf,{layoutFormat:"mobile-landscape"}),o.jsxs("div",{className:"grid gap-0.5 grid-cols-[minmax(0,1fr)_minmax(0,1.4fr)]",children:[o.jsx(df,{panelId:"replay-sources-mobile-landscape"}),o.jsx(Xr,{})]})]}),o.jsx(hA,{})]}),o.jsx("div",{className:"flex flex-col gap-0.5 pb-0",children:o.jsx(Wg,{layout:"mobile-landscape",onOpenHelpOverlay:a,roomPanelId:"mobile-landscape-room",showTelemetry:!1})})]})}function hN(){const a=cN(),l=a==="desktop",i=aN(a);return o.jsx("div",{className:`bg-black text-slate-100 ${l?"h-screen overflow-hidden":"min-h-screen"}`,children:o.jsx(ff,{children:o.jsx(mN,{layout:a,isDesktop:l,fullscreen:i})})})}function mN({layout:a,isDesktop:l,fullscreen:i}){kf();const{visible:r,mode:f,enterFullscreen:d,dismiss:m}=i,{value:x,status:p,save:y}=dt("help",{showOnLoad:!0}),[S,b]=h.useState(!1);h.useEffect(()=>{p==="ready"&&b(x?.showOnLoad!==!1)},[p,x?.showOnLoad]);const w=h.useCallback(()=>b(!0),[]),M=h.useCallback(()=>b(!1),[]),N=h.useCallback(A=>{const q=!!A;y(j=>({...j??{},showOnLoad:q})),q||b(!1)},[y]),C=h.useMemo(()=>l?o.jsx(uN,{layout:a,onOpenHelpOverlay:w}):a==="mobile-landscape"?o.jsx(dN,{onOpenHelpOverlay:w}):o.jsx(fN,{onOpenHelpOverlay:w}),[l,a,w]);return o.jsxs(US,{children:[o.jsx(ZS,{}),o.jsx(iA,{}),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(hf,{}),o.jsx(Ij,{}),o.jsx(Zj,{}),o.jsx(lN,{visible:S,layout:a,onClose:M,showOnLoad:x?.showOnLoad!==!1,onToggleShowOnLoad:N}),o.jsx(Wj,{visible:r,mode:f,onEnterFullscreen:d,onDismiss:m})]})}function Pg(){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 pN(){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 gN({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 xN({rover:a,frame:l,snapshotFeed:i,audioInfo:r,session:f}){const d=gN({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(jf,{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 yN({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(xN,{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 vN(){return o.jsx("section",{className:"min-h-0",children:o.jsx("div",{className:"surface min-h-[14rem] overflow-hidden",children:o.jsx(yf,{defaultOrientation:"horizontal",hideLayoutToggle:!0,hideHeader:!0,panelId:"spectator-secondary"})})})}function bN({className:a=""}){return o.jsx("div",{className:`panel ${a}`,children:o.jsx(vf,{})})}function SN(){const{session:a}=_e(),l=a?.mode==="lockdown";kf(),Pg();const i=pN(),r=uf(),f=a?.roster??[],d=Sf(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=bf(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",S=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",b="",w=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:S,children:[i?o.jsxs("div",{className:`${b} ${w} 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:b,children:o.jsx(Br,{layout:"desktop",dismissable:!1,className:"text-sm"})}),o.jsx("div",{className:`${b} ${i?`${w} overflow-y-auto`:""}`,children:o.jsx("div",{className:"panel h-full",children:o.jsx(Xr,{title:"Rovers"})})}),i?null:o.jsx("div",{className:`${b} flex-1 min-h-0`,children:o.jsx(Or,{hideNicknameForm:!0,hideHeader:!0,compact:!0,fillHeight:!0,className:"h-full"})}),o.jsx("div",{className:`${b} ${i?w:"flex-[1.1] min-h-0"}`,children:o.jsx(Qr,{allowSpectatorInput:!0,hideSpectatorNotice:!0,fillHeight:!0})}),o.jsx("div",{className:`${b} ${i?w:""}`,children:o.jsx(bN,{className:`${i?"h-full":"h-40"} overflow-hidden`})})]}),o.jsxs("section",{className:y,children:[o.jsx(yN,{roster:f,frames:r,snapshotFeeds:d,audioSources:x,session:a}),o.jsx(vN,{})]})]}),o.jsx(hf,{})]})}function AN(){return o.jsx(ff,{children:o.jsx(SN,{})})}const jN=2e4,NN=10800*1e3;function R0({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 wN({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 S=x-p;if(S<=0)return{percent:0,barClass:"bg-slate-700/40"};const b=(m-p)/S,w=Math.max(0,Math.min(1,b)),M=b<=0,N=y!=null&&m<=y;return{percent:w,barClass:M?"bg-red-500/40":N?"bg-amber-400/40":"bg-emerald-400/40"}}function EN(){const{session:a}=_e(),l=Pg();kf();const i=a?.mode==="lockdown",r=uf(),f=a?.roster??[],[d,m]=h.useState(0),x=a?.activeDrivers||{},p=h.useMemo(()=>f.filter(U=>x[U.id]),[f,x]),y=Sf(p.map(U=>U.id),{enabled:!i,version:a?.mode}),S=h.useMemo(()=>p.flatMap(U=>{if(!U?.id||!U.media?.audioPublishUrl)return[];const Y=String(U.id);return[{type:"rover",id:`${Y}-audio`,key:`${Y}-audio`}]}),[p]),b=bf(S,{enabled:!i,version:a?.mode}),w=h.useMemo(()=>{if(!p.length)return[];const U=p.filter(Y=>y[Y.id]?.objectUrl);return U.length?U:p},[p,y]),M=h.useMemo(()=>w.map(U=>({type:"rover",rover:U})),[w]),N=h.useMemo(()=>M.map(U=>`r:${U.rover.id}`).join("|"),[M]);h.useEffect(()=>{m(0)},[N]),h.useEffect(()=>{if(!M.length)return;const U=setInterval(()=>{m(Y=>(Y+1)%M.length)},jN);return()=>clearInterval(U)},[M.length,N]);const C=M.length?M[d%M.length]:null,A=C?.type==="rover"?C.rover:null,q=A&&y[A.id]||null,j=A&&b[`${A.id}-audio`]||null,k=A&&r[A.id]||null,X=A?R0({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(qN,{children:o.jsx(jf,{sessionInfo:null,videoMode:"snapshot",snapshotFeed:q,audioSessionInfo:j,label:A.name||A.id,telemetryFrame:k,batteryConfig:A.battery,layoutFormat:"mobile",hudVariant:"spectator",driverLabel:X,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(U=>{const Y=r[U.id]||null,z=R0({roverId:U.id,session:a}),I=wN({rover:U,frame:Y}),G=A?.id===U.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 ${I.barClass}`,style:{width:`${I.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:U.name||U.id}),o.jsx("div",{className:`text-5xl font-semibold ${G?"text-white":"text-slate-300"}`,children:z})]})]},U.id)}):o.jsx("div",{className:"flex h-full w-full items-center justify-center text-sm text-slate-500",children:"No rovers available."})})]})}function CN(){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())},NN);return()=>clearTimeout(a)},[]),o.jsx(ff,{children:o.jsxs(o.Fragment,{children:[o.jsx(EN,{}),o.jsx(hf,{scale:3})]})})}function qN({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})})})}Nv.createRoot(document.getElementById("root")).render(o.jsx(h.StrictMode,{children:o.jsx(K1,{children:o.jsx(F1,{children:o.jsx(J1,{children:o.jsx(VS,{children:o.jsx(Ub,{children:o.jsxs(gb,{children:[o.jsx(br,{path:"/",element:o.jsx(hN,{})}),o.jsx(br,{path:"/spectate",element:o.jsx(AN,{})}),o.jsx(br,{path:"/mini",element:o.jsx(CN,{})})]})})})})})})}));