Files
MultiRoombaRover/server/public/assets/index-CiK78C9b.js
T
2026-01-26 01:03:09 -05:00

120 lines
457 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 g of d.addedNodes)g.tagName==="LINK"&&g.rel==="modulepreload"&&r(g)}).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 fv(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var ru={exports:{}},Cs={};var Cp;function dv(){if(Cp)return Cs;Cp=1;var a=Symbol.for("react.transitional.element"),l=Symbol.for("react.fragment");function i(r,f,d){var g=null;if(d!==void 0&&(g=""+d),f.key!==void 0&&(g=""+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:g,ref:f!==void 0?f:null,props:d}}return Cs.Fragment=l,Cs.jsx=i,Cs.jsxs=i,Cs}var qp;function hv(){return qp||(qp=1,ru.exports=dv()),ru.exports}var o=hv(),ou={exports:{}},me={};var Mp;function mv(){if(Mp)return me;Mp=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"),g=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 T(q){return q===null||typeof q!="object"?null:(q=w&&q[w]||q["@@iterator"],typeof q=="function"?q:null)}var N={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,A={};function E(q,B,_){this.props=q,this.context=B,this.refs=A,this.updater=_||N}E.prototype.isReactComponent={},E.prototype.setState=function(q,B){if(typeof q!="object"&&typeof q!="function"&&q!=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,q,B,"setState")},E.prototype.forceUpdate=function(q){this.updater.enqueueForceUpdate(this,q,"forceUpdate")};function j(){}j.prototype=E.prototype;function k(q,B,_){this.props=q,this.context=B,this.refs=A,this.updater=_||N}var Q=k.prototype=new j;Q.constructor=k,C(Q,E.prototype),Q.isPureReactComponent=!0;var X=Array.isArray;function H(){}var z={H:null,A:null,T:null,S:null},I=Object.prototype.hasOwnProperty;function $(q,B,_){var V=_.ref;return{$$typeof:a,type:q,key:B,ref:V!==void 0?V:null,props:_}}function te(q,B){return $(q.type,B,q.props)}function Z(q){return typeof q=="object"&&q!==null&&q.$$typeof===a}function W(q){var B={"=":"=0",":":"=2"};return"$"+q.replace(/[=:]/g,function(_){return B[_]})}var ie=/\/+/g;function oe(q,B){return typeof q=="object"&&q!==null&&q.key!=null?W(""+q.key):B.toString(36)}function se(q){switch(q.status){case"fulfilled":return q.value;case"rejected":throw q.reason;default:switch(typeof q.status=="string"?q.then(H,H):(q.status="pending",q.then(function(B){q.status==="pending"&&(q.status="fulfilled",q.value=B)},function(B){q.status==="pending"&&(q.status="rejected",q.reason=B)})),q.status){case"fulfilled":return q.value;case"rejected":throw q.reason}}throw q}function O(q,B,_,V,ee){var ne=typeof q;(ne==="undefined"||ne==="boolean")&&(q=null);var ce=!1;if(q===null)ce=!0;else switch(ne){case"bigint":case"string":case"number":ce=!0;break;case"object":switch(q.$$typeof){case a:case l:ce=!0;break;case S:return ce=q._init,O(ce(q._payload),B,_,V,ee)}}if(ce)return ee=ee(q),ce=V===""?"."+oe(q,0):V,X(ee)?(_="",ce!=null&&(_=ce.replace(ie,"$&/")+"/"),O(ee,B,_,"",function(St){return St})):ee!=null&&(Z(ee)&&(ee=te(ee,_+(ee.key==null||q&&q.key===ee.key?"":(""+ee.key).replace(ie,"$&/")+"/")+ce)),B.push(ee)),1;ce=0;var we=V===""?".":V+":";if(X(q))for(var xe=0;xe<q.length;xe++)V=q[xe],ne=we+oe(V,xe),ce+=O(V,B,_,ne,ee);else if(xe=T(q),typeof xe=="function")for(q=xe.call(q),xe=0;!(V=q.next()).done;)V=V.value,ne=we+oe(V,xe++),ce+=O(V,B,_,ne,ee);else if(ne==="object"){if(typeof q.then=="function")return O(se(q),B,_,V,ee);throw B=String(q),Error("Objects are not valid as a React child (found: "+(B==="[object Object]"?"object with keys {"+Object.keys(q).join(", ")+"}":B)+"). If you meant to render a collection of children, use an array instead.")}return ce}function P(q,B,_){if(q==null)return q;var V=[],ee=0;return O(q,V,"","",function(ne){return B.call(_,ne,ee++)}),V}function le(q){if(q._status===-1){var B=q._result;B=B(),B.then(function(_){(q._status===0||q._status===-1)&&(q._status=1,q._result=_)},function(_){(q._status===0||q._status===-1)&&(q._status=2,q._result=_)}),q._status===-1&&(q._status=0,q._result=B)}if(q._status===1)return q._result.default;throw q._result}var fe=typeof reportError=="function"?reportError:function(q){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var B=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof q=="object"&&q!==null&&typeof q.message=="string"?String(q.message):String(q),error:q});if(!window.dispatchEvent(B))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",q);return}console.error(q)},ae={map:P,forEach:function(q,B,_){P(q,function(){B.apply(this,arguments)},_)},count:function(q){var B=0;return P(q,function(){B++}),B},toArray:function(q){return P(q,function(B){return B})||[]},only:function(q){if(!Z(q))throw Error("React.Children.only expected to receive a single React element child.");return q}};return me.Activity=b,me.Children=ae,me.Component=E,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(q){return z.H.useMemoCache(q)}},me.cache=function(q){return function(){return q.apply(null,arguments)}},me.cacheSignal=function(){return null},me.cloneElement=function(q,B,_){if(q==null)throw Error("The argument must be a React element, but you passed "+q+".");var V=C({},q.props),ee=q.key;if(B!=null)for(ne in B.key!==void 0&&(ee=""+B.key),B)!I.call(B,ne)||ne==="key"||ne==="__self"||ne==="__source"||ne==="ref"&&B.ref===void 0||(V[ne]=B[ne]);var ne=arguments.length-2;if(ne===1)V.children=_;else if(1<ne){for(var ce=Array(ne),we=0;we<ne;we++)ce[we]=arguments[we+2];V.children=ce}return $(q.type,ee,V)},me.createContext=function(q){return q={$$typeof:g,_currentValue:q,_currentValue2:q,_threadCount:0,Provider:null,Consumer:null},q.Provider=q,q.Consumer={$$typeof:d,_context:q},q},me.createElement=function(q,B,_){var V,ee={},ne=null;if(B!=null)for(V in B.key!==void 0&&(ne=""+B.key),B)I.call(B,V)&&V!=="key"&&V!=="__self"&&V!=="__source"&&(ee[V]=B[V]);var ce=arguments.length-2;if(ce===1)ee.children=_;else if(1<ce){for(var we=Array(ce),xe=0;xe<ce;xe++)we[xe]=arguments[xe+2];ee.children=we}if(q&&q.defaultProps)for(V in ce=q.defaultProps,ce)ee[V]===void 0&&(ee[V]=ce[V]);return $(q,ne,ee)},me.createRef=function(){return{current:null}},me.forwardRef=function(q){return{$$typeof:x,render:q}},me.isValidElement=Z,me.lazy=function(q){return{$$typeof:S,_payload:{_status:-1,_result:q},_init:le}},me.memo=function(q,B){return{$$typeof:y,type:q,compare:B===void 0?null:B}},me.startTransition=function(q){var B=z.T,_={};z.T=_;try{var V=q(),ee=z.S;ee!==null&&ee(_,V),typeof V=="object"&&V!==null&&typeof V.then=="function"&&V.then(H,fe)}catch(ne){fe(ne)}finally{B!==null&&_.types!==null&&(B.types=_.types),z.T=B}},me.unstable_useCacheRefresh=function(){return z.H.useCacheRefresh()},me.use=function(q){return z.H.use(q)},me.useActionState=function(q,B,_){return z.H.useActionState(q,B,_)},me.useCallback=function(q,B){return z.H.useCallback(q,B)},me.useContext=function(q){return z.H.useContext(q)},me.useDebugValue=function(){},me.useDeferredValue=function(q,B){return z.H.useDeferredValue(q,B)},me.useEffect=function(q,B){return z.H.useEffect(q,B)},me.useEffectEvent=function(q){return z.H.useEffectEvent(q)},me.useId=function(){return z.H.useId()},me.useImperativeHandle=function(q,B,_){return z.H.useImperativeHandle(q,B,_)},me.useInsertionEffect=function(q,B){return z.H.useInsertionEffect(q,B)},me.useLayoutEffect=function(q,B){return z.H.useLayoutEffect(q,B)},me.useMemo=function(q,B){return z.H.useMemo(q,B)},me.useOptimistic=function(q,B){return z.H.useOptimistic(q,B)},me.useReducer=function(q,B,_){return z.H.useReducer(q,B,_)},me.useRef=function(q){return z.H.useRef(q)},me.useState=function(q){return z.H.useState(q)},me.useSyncExternalStore=function(q,B,_){return z.H.useSyncExternalStore(q,B,_)},me.useTransition=function(){return z.H.useTransition()},me.version="19.2.0",me}var Tp;function Fu(){return Tp||(Tp=1,ou.exports=mv()),ou.exports}var h=Fu();const Ma=fv(h);var cu={exports:{}},qs={},uu={exports:{}},fu={};var Rp;function pv(){return Rp||(Rp=1,(function(a){function l(O,P){var le=O.length;O.push(P);e:for(;0<le;){var fe=le-1>>>1,ae=O[fe];if(0<f(ae,P))O[fe]=P,O[le]=ae,le=fe;else break e}}function i(O){return O.length===0?null:O[0]}function r(O){if(O.length===0)return null;var P=O[0],le=O.pop();if(le!==P){O[0]=le;e:for(var fe=0,ae=O.length,q=ae>>>1;fe<q;){var B=2*(fe+1)-1,_=O[B],V=B+1,ee=O[V];if(0>f(_,le))V<ae&&0>f(ee,_)?(O[fe]=ee,O[V]=le,fe=V):(O[fe]=_,O[B]=le,fe=B);else if(V<ae&&0>f(ee,le))O[fe]=ee,O[V]=le,fe=V;else break e}}return P}function f(O,P){var le=O.sortIndex-P.sortIndex;return le!==0?le:O.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 g=Date,x=g.now();a.unstable_now=function(){return g.now()-x}}var p=[],y=[],S=1,b=null,w=3,T=!1,N=!1,C=!1,A=!1,E=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function Q(O){for(var P=i(y);P!==null;){if(P.callback===null)r(y);else if(P.startTime<=O)r(y),P.sortIndex=P.expirationTime,l(p,P);else break;P=i(y)}}function X(O){if(C=!1,Q(O),!N)if(i(p)!==null)N=!0,H||(H=!0,W());else{var P=i(y);P!==null&&se(X,P.startTime-O)}}var H=!1,z=-1,I=5,$=-1;function te(){return A?!0:!(a.unstable_now()-$<I)}function Z(){if(A=!1,H){var O=a.unstable_now();$=O;var P=!0;try{e:{N=!1,C&&(C=!1,j(z),z=-1),T=!0;var le=w;try{t:{for(Q(O),b=i(p);b!==null&&!(b.expirationTime>O&&te());){var fe=b.callback;if(typeof fe=="function"){b.callback=null,w=b.priorityLevel;var ae=fe(b.expirationTime<=O);if(O=a.unstable_now(),typeof ae=="function"){b.callback=ae,Q(O),P=!0;break t}b===i(p)&&r(p),Q(O)}else r(p);b=i(p)}if(b!==null)P=!0;else{var q=i(y);q!==null&&se(X,q.startTime-O),P=!1}}break e}finally{b=null,w=le,T=!1}P=void 0}}finally{P?W():H=!1}}}var W;if(typeof k=="function")W=function(){k(Z)};else if(typeof MessageChannel<"u"){var ie=new MessageChannel,oe=ie.port2;ie.port1.onmessage=Z,W=function(){oe.postMessage(null)}}else W=function(){E(Z,0)};function se(O,P){z=E(function(){O(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(O){O.callback=null},a.unstable_forceFrameRate=function(O){0>O||125<O?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<O?Math.floor(1e3/O):5},a.unstable_getCurrentPriorityLevel=function(){return w},a.unstable_next=function(O){switch(w){case 1:case 2:case 3:var P=3;break;default:P=w}var le=w;w=P;try{return O()}finally{w=le}},a.unstable_requestPaint=function(){A=!0},a.unstable_runWithPriority=function(O,P){switch(O){case 1:case 2:case 3:case 4:case 5:break;default:O=3}var le=w;w=O;try{return P()}finally{w=le}},a.unstable_scheduleCallback=function(O,P,le){var fe=a.unstable_now();switch(typeof le=="object"&&le!==null?(le=le.delay,le=typeof le=="number"&&0<le?fe+le:fe):le=fe,O){case 1:var ae=-1;break;case 2:ae=250;break;case 5:ae=1073741823;break;case 4:ae=1e4;break;default:ae=5e3}return ae=le+ae,O={id:S++,callback:P,priorityLevel:O,startTime:le,expirationTime:ae,sortIndex:-1},le>fe?(O.sortIndex=le,l(y,O),i(p)===null&&O===i(y)&&(C?(j(z),z=-1):C=!0,se(X,le-fe))):(O.sortIndex=ae,l(p,O),N||T||(N=!0,H||(H=!0,W()))),O},a.unstable_shouldYield=te,a.unstable_wrapCallback=function(O){var P=w;return function(){var le=w;w=P;try{return O.apply(this,arguments)}finally{w=le}}}})(fu)),fu}var kp;function gv(){return kp||(kp=1,uu.exports=pv()),uu.exports}var du={exports:{}},ut={};var _p;function xv(){if(_p)return ut;_p=1;var a=Fu();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 g=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=g.T,S=r.p;try{if(g.T=null,r.p=2,p)return p()}finally{g.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,T=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:T}):S==="script"&&r.d.X(p,{crossOrigin:b,integrity:w,fetchPriority:T,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 g.H.useFormState(p,y,S)},ut.useFormStatus=function(){return g.H.useHostTransitionStatus()},ut.version="19.2.0",ut}var Dp;function yv(){if(Dp)return du.exports;Dp=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(),du.exports=xv(),du.exports}var Op;function vv(){if(Op)return qs;Op=1;var a=gv(),l=Fu(),i=yv();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 g(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 m=!1,v=c.child;v;){if(v===n){m=!0,n=c,s=u;break}if(v===s){m=!0,s=c,n=u;break}v=v.sibling}if(!m){for(v=u.child;v;){if(v===n){m=!0,n=u,s=c;break}if(v===s){m=!0,s=u,n=c;break}v=v.sibling}if(!m)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"),T=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),j=Symbol.for("react.consumer"),k=Symbol.for("react.context"),Q=Symbol.for("react.forward_ref"),X=Symbol.for("react.suspense"),H=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),$=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 ie=Symbol.for("react.client.reference");function oe(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ie?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case C:return"Fragment";case E:return"Profiler";case A:return"StrictMode";case X:return"Suspense";case H:return"SuspenseList";case $: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 Q: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:oe(e.type)||"Memo";case I:t=e._payload,e=e._init;try{return oe(e(t))}catch{}}return null}var se=Array.isArray,O=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},fe=[],ae=-1;function q(e){return{current:e}}function B(e){0>ae||(e.current=fe[ae],fe[ae]=null,ae--)}function _(e,t){ae++,fe[ae]=e.current,e.current=t}var V=q(null),ee=q(null),ne=q(null),ce=q(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)?Jm(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Jm(t),e=Im(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}B(V),_(V,e)}function xe(){B(V),B(ee),B(ne)}function St(e){e.memoizedState!==null&&_(ce,e);var t=V.current,n=Im(t,e.type);t!==n&&(_(ee,e),_(V,n))}function Ra(e){ee.current===e&&(B(V),B(ee)),ce.current===e&&(B(ce),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(G){var Y=G}Reflect.construct(e,[],J)}else{try{J.call()}catch(G){Y=G}e.call(J.prototype)}}else{try{throw Error()}catch(G){Y=G}(J=e())&&typeof J.catch=="function"&&J.catch(function(){})}}catch(G){if(G&&Y&&typeof G.stack=="string")return[G.stack,Y.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var c=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");c&&c.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var u=s.DetermineComponentFrameRoot(),m=u[0],v=u[1];if(m&&v){var M=m.split(`
`),U=v.split(`
`);for(c=s=0;s<M.length&&!M[s].includes("DetermineComponentFrameRoot");)s++;for(;c<U.length&&!U[c].includes("DetermineComponentFrameRoot");)c++;if(s===M.length||c===U.length)for(s=M.length-1,c=U.length-1;1<=s&&0<=c&&M[s]!==U[c];)c--;for(;1<=s&&0<=c;s--,c--)if(M[s]!==U[c]){if(s!==1||c!==1)do if(s--,c--,0>c||M[s]!==U[c]){var K=`
`+M[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,Xr=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:Ig,Ue=Math.log,Kr=Math.LN2;function Ig(e){return e>>>=0,e===0?32:31-(Ue(e)/Kr|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,m=e.pingedLanes;e=e.warmLanes;var v=s&134217727;return v!==0?(s=v&~u,s!==0?c=ca(s):(m&=v,m!==0?c=ca(m):n||(n=v&~e,n!==0&&(c=ca(n))))):(v=s&~u,v!==0?c=ca(v):m!==0?c=ca(m):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 Wg(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 Rf(){var e=Ws;return Ws<<=1,(Ws&62914560)===0&&(Ws=4194304),e}function Zr(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 Pg(e,t,n,s,c,u){var m=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,M=e.expirationTimes,U=e.hiddenUpdates;for(n=m&~n;0<n;){var K=31-Ce(n),J=1<<K;v[K]=0,M[K]=-1;var Y=U[K];if(Y!==null)for(U[K]=null,K=0;K<Y.length;K++){var G=Y[K];G!==null&&(G.lane&=-536870913)}n&=~J}s!==0&&kf(e,s,0),u!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=u&~(m&~t))}function kf(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 _f(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 Df(e,t){var n=t&-t;return n=(n&42)!==0?1:Fr(n),(n&(e.suspendedLanes|t))!==0?0:n}function Fr(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 Jr(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Of(){var e=P.p;return e!==0?e:(e=window.event,e===void 0?32:bp(e.type))}function Bf(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,Ir="__reactEvents$"+kn,ex="__reactListeners$"+kn,tx="__reactHandles$"+kn,zf="__reactResources$"+kn,Ll="__reactMarker$"+kn;function Wr(e){delete e[st],delete e[mt],delete e[Ir],delete e[ex],delete e[tx]}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=lp(e);e!==null;){if(n=e[st])return n;e=lp(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[zf];return t||(t=e[zf]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function at(e){e[Ll]=!0}var Lf=new Set,Uf={};function ua(e,t){Ua(e,t),Ua(e+"Capture",t)}function Ua(e,t){for(Uf[e]=t,e=0;e<t.length;e++)Lf.add(t[e])}var nx=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Hf={},Vf={};function ax(e){return kl.call(Vf,e)?!0:kl.call(Hf,e)?!1:nx.test(e)?Vf[e]=!0:(Hf[e]=!0,!1)}function ei(e,t,n){if(ax(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var s=t.toLowerCase().slice(0,5);if(s!=="data-"&&s!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function 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 Yf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function lx(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(m){n=""+m,u.call(this,m)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return n},setValue:function(m){n=""+m},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Pr(e){if(!e._valueTracker){var t=Yf(e)?"checked":"value";e._valueTracker=lx(e,t,""+e[t])}}function $f(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=Yf(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 sx=/[\n"\\]/g;function kt(e){return e.replace(sx,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function eo(e,t,n,s,c,u,m,v){e.name="",m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"?e.type=m:e.removeAttribute("type"),t!=null?m==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Rt(t)):e.value!==""+Rt(t)&&(e.value=""+Rt(t)):m!=="submit"&&m!=="reset"||e.removeAttribute("value"),t!=null?to(e,m,Rt(t)):n!=null?to(e,m,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 Gf(e,t,n,s,c,u,m,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)){Pr(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,m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(e.name=m),Pr(e)}function to(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 Qf(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 Xf(e,t,n,s){if(t==null){if(s!=null){if(n!=null)throw Error(r(92));if(se(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),Pr(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 ix=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 Kf(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||ix.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function Zf(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&&Kf(e,c,s)}else for(var u in t)t.hasOwnProperty(u)&&Kf(e,u,t[u])}function no(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 rx=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"]]),ox=/^[\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 ox.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function on(){}var ao=null;function lo(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 Ff(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(eo(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));eo(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&&$f(s)}break e;case"textarea":Qf(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Ha(e,!!n.multiple,t,!1)}}}var so=!1;function Jf(e,t,n){if(so)return e(t,n);so=!0;try{var s=e(t);return s}finally{if(so=!1,(Ya!==null||$a!==null)&&(Gi(),Ya&&(t=Ya,e=$a,$a=Ya=null,Ff(t),e)))for(t=0;t<e.length;t++)Ff(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"),io=!1;if(cn)try{var Vl={};Object.defineProperty(Vl,"passive",{get:function(){io=!0}}),window.addEventListener("test",Vl,Vl),window.removeEventListener("test",Vl,Vl)}catch{io=!1}var _n=null,ro=null,li=null;function If(){if(li)return li;var e,t=ro,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 m=n-e;for(s=1;s<=m&&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 Wf(){return!1}function pt(e){function t(n,s,c,u,m){this._reactName=n,this._targetInst=c,this.type=s,this.nativeEvent=u,this.target=m,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:Wf,this.isPropagationStopped=Wf,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}),cx=pt(Yl),oo,co,$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:fo,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"?(oo=e.screenX-$l.screenX,co=e.screenY-$l.screenY):co=oo=0,$l=e),oo)},movementY:function(e){return"movementY"in e?e.movementY:co}}),Pf=pt(oi),ux=b({},oi,{dataTransfer:0}),fx=pt(ux),dx=b({},Yl,{relatedTarget:0}),uo=pt(dx),hx=b({},fa,{animationName:0,elapsedTime:0,pseudoElement:0}),mx=pt(hx),px=b({},fa,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),gx=pt(px),xx=b({},fa,{data:0}),ed=pt(xx),yx={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},vx={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},bx={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Sx(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=bx[e])?!!t[e]:!1}function fo(){return Sx}var Ax=b({},Yl,{key:function(e){if(e.key){var t=yx[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"?vx[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:fo,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}}),jx=pt(Ax),Nx=b({},oi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),td=pt(Nx),wx=b({},Yl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:fo}),Ex=pt(wx),Cx=b({},fa,{propertyName:0,elapsedTime:0,pseudoElement:0}),qx=pt(Cx),Mx=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}),Tx=pt(Mx),Rx=b({},fa,{newState:0,oldState:0}),kx=pt(Rx),_x=[9,13,27,32],ho=cn&&"CompositionEvent"in window,Gl=null;cn&&"documentMode"in document&&(Gl=document.documentMode);var Dx=cn&&"TextEvent"in window&&!Gl,nd=cn&&(!ho||Gl&&8<Gl&&11>=Gl),ad=" ",ld=!1;function sd(e,t){switch(e){case"keyup":return _x.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function id(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ga=!1;function Ox(e,t){switch(e){case"compositionend":return id(t);case"keypress":return t.which!==32?null:(ld=!0,ad);case"textInput":return e=t.data,e===ad&&ld?null:e;default:return null}}function Bx(e,t){if(Ga)return e==="compositionend"||!ho&&sd(e,t)?(e=If(),li=ro=_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 nd&&t.locale!=="ko"?null:t.data;default:return null}}var zx={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 rd(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!zx[e.type]:t==="textarea"}function od(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 Lx(e){Gm(e,0)}function ci(e){var t=Ul(e);if($f(t))return e}function cd(e,t){if(e==="change")return t}var ud=!1;if(cn){var mo;if(cn){var po="oninput"in document;if(!po){var fd=document.createElement("div");fd.setAttribute("oninput","return;"),po=typeof fd.oninput=="function"}mo=po}else mo=!1;ud=mo&&(!document.documentMode||9<document.documentMode)}function dd(){Ql&&(Ql.detachEvent("onpropertychange",hd),Xl=Ql=null)}function hd(e){if(e.propertyName==="value"&&ci(Xl)){var t=[];od(t,Xl,e,lo(e)),Jf(Lx,t)}}function Ux(e,t,n){e==="focusin"?(dd(),Ql=t,Xl=n,Ql.attachEvent("onpropertychange",hd)):e==="focusout"&&dd()}function Hx(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ci(Xl)}function Vx(e,t){if(e==="click")return ci(t)}function Yx(e,t){if(e==="input"||e==="change")return ci(t)}function $x(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var At=typeof Object.is=="function"?Object.is:$x;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 md(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function pd(e,t){var n=md(e);e=0;for(var s;n;){if(n.nodeType===3){if(s=e+n.textContent.length,e<=t&&s>=t)return{node:n,offset:t-e};e=s}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=md(n)}}function gd(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?gd(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function xd(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 go(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 Gx=cn&&"documentMode"in document&&11>=document.documentMode,Qa=null,xo=null,Zl=null,yo=!1;function yd(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;yo||Qa==null||Qa!==ni(s)||(s=Qa,"selectionStart"in s&&go(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(xo,"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")},vo={},vd={};cn&&(vd=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(vo[e])return vo[e];if(!Xa[e])return e;var t=Xa[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in vd)return vo[e]=t[n];return e}var bd=ha("animationend"),Sd=ha("animationiteration"),Ad=ha("animationstart"),Qx=ha("transitionrun"),Xx=ha("transitionstart"),Kx=ha("transitioncancel"),jd=ha("transitionend"),Nd=new Map,bo="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(" ");bo.push("scrollEnd");function $t(e,t){Nd.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,So=0;function fi(){for(var e=Ka,t=So=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 m=s.pending;m===null?c.next=c:(c.next=m.next,m.next=c),s.pending=c}u!==0&&wd(n,c,u)}}function di(e,t,n,s){_t[Ka++]=e,_t[Ka++]=t,_t[Ka++]=n,_t[Ka++]=s,So|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function Ao(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 wd(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,Rc=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 Zx(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 Zx(e,t,n,s)}function jo(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 Ed(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 m=0;if(s=e,typeof e=="function")jo(e)&&(m=1);else if(typeof e=="string")m=Py(e,n,V.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case $:return e=jt(31,n,t,c),e.elementType=$,e.lanes=u,e;case C:return pa(n.children,c,u,t);case A:m=8,c|=24;break;case E:return e=jt(12,n,t,c|2),e.elementType=E,e.lanes=u,e;case X:return e=jt(13,n,t,c),e.elementType=X,e.lanes=u,e;case H:return e=jt(19,n,t,c),e.elementType=H,e.lanes=u,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case k:m=10;break e;case j:m=9;break e;case Q:m=11;break e;case z:m=14;break e;case I:m=16,s=null;break e}m=29,n=Error(r(130,e===null?"null":typeof e,"")),s=null}return t=jt(m,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 No(e,t,n){return e=jt(6,e,null,t),e.lanes=n,e}function Cd(e){var t=jt(18,null,null,0);return t.stateNode=e,t}function wo(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 qd=new WeakMap;function Dt(e,t){if(typeof e=="object"&&e!==null){var n=qd.get(e);return n!==void 0?n:(t={value:e,source:t,stack:ka(t)},qd.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 Md(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 m=c-c%5;u=(s&(1<<m)-1).toString(32),s>>=m,c-=m,Jt=1<<32-Ce(t)+c|n<<c|s,It=u+e}else Jt=1<<u|n<<c|s,It=e}function Eo(e){e.return!==null&&(fn(e,1),Md(e,1,0))}function Co(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 Td(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,qo=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)),qo}function Rd(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),Gf(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),Xf(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||Zm(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 kd(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 kd(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")||Xc(e.type,e.memoizedProps)),n=!n),n&&He&&Bn(e),kd(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));He=ap(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));He=ap(e)}else t===27?(t=He,Jn(e.type)?(e=Ic,Ic=null,He=e):He=t):He=it?Ut(e.stateNode.nextSibling):null;return!0}function ga(){He=it=null,Ae=!1}function Mo(){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 To=q(null),xa=null,dn=null;function zn(e,t,n){_(To,t._currentValue),t._currentValue=n}function hn(e){e._currentValue=To.current,B(To)}function Ro(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 ko(e,t,n,s){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var u=c.dependencies;if(u!==null){var m=c.child;u=u.firstContext;e:for(;u!==null;){var v=u;u=c;for(var M=0;M<t.length;M++)if(v.context===t[M]){u.lanes|=n,v=u.alternate,v!==null&&(v.lanes|=n),Ro(u.return,n,e),s||(m=null);break e}u=v.next}}else if(c.tag===18){if(m=c.return,m===null)throw Error(r(341));m.lanes|=n,u=m.alternate,u!==null&&(u.lanes|=n),Ro(m,n,e),m=null}else m=c.child;if(m!==null)m.return=c;else for(m=c;m!==null;){if(m===e){m=null;break}if(c=m.sibling,c!==null){c.return=m.return,m=c;break}m=m.return}c=m}}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 m=c.alternate;if(m===null)throw Error(r(387));if(m=m.memoizedProps,m!==null){var v=c.type;At(c.pendingProps.value,m.value)||(e!==null?e.push(v):e=[v])}}else if(c===ce.current){if(m=c.alternate,m===null)throw Error(r(387));m.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(js):e=[js])}c=c.return}e!==null&&ko(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 _d(xa,e)}function xi(e,t){return xa===null&&ya(e),_d(e,t)}function _d(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 Fx=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()})}},Jx=a.unstable_scheduleCallback,Ix=a.unstable_NormalPriority,Fe={$$typeof:k,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function _o(){return{controller:new Fx,data:new Map,refCount:0}}function Il(e){e.refCount--,e.refCount===0&&Jx(Ix,function(){e.controller.abort()})}var Wl=null,Do=0,Pa=0,el=null;function Wx(e,t){if(Wl===null){var n=Wl=[];Do=0,Pa=zc(),el={status:"pending",value:void 0,then:function(s){n.push(s)}}}return Do++,t.then(Dd,Dd),t}function Dd(){if(--Do===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 Px(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 Od=O.S;O.S=function(e,t){ym=tt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Wx(e,t),Od!==null&&Od(e,t)};var va=q(null);function Oo(){var e=va.current;return e!==null?e:ze.pooledCache}function yi(e,t){t===null?_(va,va.current):_(va,t.pool)}function Bd(){var e=Oo();return e===null?null:{parent:Fe._currentValue,pool:e}}var tl=Error(r(460)),Bo=Error(r(474)),vi=Error(r(542)),bi={then:function(){}};function zd(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Ld(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,Hd(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,Hd(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 Ud(){if(Sa===null)throw Error(r(459));var e=Sa;return Sa=null,e}function Hd(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=[]),Ld(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 Vd(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 m(D){return e&&D.alternate===null&&(D.flags|=67108866),D}function v(D,R,L,F){return R===null||R.tag!==6?(R=No(L,D.mode,F),R.return=D,R):(R=c(R,L),R.return=D,R)}function M(D,R,L,F){var de=L.type;return de===C?K(D,R,L.props.children,F,L.key):R!==null&&(R.elementType===de||typeof de=="object"&&de!==null&&de.$$typeof===I&&ba(de)===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 U(D,R,L,F){return R===null||R.tag!==4||R.stateNode.containerInfo!==L.containerInfo||R.stateNode.implementation!==L.implementation?(R=wo(L,D.mode,F),R.return=D,R):(R=c(R,L.children||[]),R.return=D,R)}function K(D,R,L,F,de){return R===null||R.tag!==7?(R=pa(L,D.mode,F,de),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=No(""+R,D.mode,L),R.return=D,R;if(typeof R=="object"&&R!==null){switch(R.$$typeof){case T:return L=mi(R.type,R.key,R.props,null,D.mode,L),es(L,R),L.return=D,L;case N:return R=wo(R,D.mode,L),R.return=D,R;case I:return R=ba(R),J(D,R,L)}if(se(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 Y(D,R,L,F){var de=R!==null?R.key:null;if(typeof L=="string"&&L!==""||typeof L=="number"||typeof L=="bigint")return de!==null?null:v(D,R,""+L,F);if(typeof L=="object"&&L!==null){switch(L.$$typeof){case T:return L.key===de?M(D,R,L,F):null;case N:return L.key===de?U(D,R,L,F):null;case I:return L=ba(L),Y(D,R,L,F)}if(se(L)||W(L))return de!==null?null:K(D,R,L,F,null);if(typeof L.then=="function")return Y(D,R,Si(L),F);if(L.$$typeof===k)return Y(D,R,xi(D,L),F);Ai(D,L)}return null}function G(D,R,L,F,de){if(typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint")return D=D.get(L)||null,v(R,D,""+F,de);if(typeof F=="object"&&F!==null){switch(F.$$typeof){case T:return D=D.get(F.key===null?L:F.key)||null,M(R,D,F,de);case N:return D=D.get(F.key===null?L:F.key)||null,U(R,D,F,de);case I:return F=ba(F),G(D,R,L,F,de)}if(se(F)||W(F))return D=D.get(L)||null,K(R,D,F,de,null);if(typeof F.then=="function")return G(D,R,L,Si(F),de);if(F.$$typeof===k)return G(D,R,L,xi(R,F),de);Ai(R,F)}return null}function re(D,R,L,F){for(var de=null,qe=null,ue=R,ge=R=0,Se=null;ue!==null&&ge<L.length;ge++){ue.index>ge?(Se=ue,ue=null):Se=ue.sibling;var Me=Y(D,ue,L[ge],F);if(Me===null){ue===null&&(ue=Se);break}e&&ue&&Me.alternate===null&&t(D,ue),R=u(Me,R,ge),qe===null?de=Me:qe.sibling=Me,qe=Me,ue=Se}if(ge===L.length)return n(D,ue),Ae&&fn(D,ge),de;if(ue===null){for(;ge<L.length;ge++)ue=J(D,L[ge],F),ue!==null&&(R=u(ue,R,ge),qe===null?de=ue:qe.sibling=ue,qe=ue);return Ae&&fn(D,ge),de}for(ue=s(ue);ge<L.length;ge++)Se=G(ue,D,ge,L[ge],F),Se!==null&&(e&&Se.alternate!==null&&ue.delete(Se.key===null?ge:Se.key),R=u(Se,R,ge),qe===null?de=Se:qe.sibling=Se,qe=Se);return e&&ue.forEach(function(ta){return t(D,ta)}),Ae&&fn(D,ge),de}function he(D,R,L,F){if(L==null)throw Error(r(151));for(var de=null,qe=null,ue=R,ge=R=0,Se=null,Me=L.next();ue!==null&&!Me.done;ge++,Me=L.next()){ue.index>ge?(Se=ue,ue=null):Se=ue.sibling;var ta=Y(D,ue,Me.value,F);if(ta===null){ue===null&&(ue=Se);break}e&&ue&&ta.alternate===null&&t(D,ue),R=u(ta,R,ge),qe===null?de=ta:qe.sibling=ta,qe=ta,ue=Se}if(Me.done)return n(D,ue),Ae&&fn(D,ge),de;if(ue===null){for(;!Me.done;ge++,Me=L.next())Me=J(D,Me.value,F),Me!==null&&(R=u(Me,R,ge),qe===null?de=Me:qe.sibling=Me,qe=Me);return Ae&&fn(D,ge),de}for(ue=s(ue);!Me.done;ge++,Me=L.next())Me=G(ue,D,ge,Me.value,F),Me!==null&&(e&&Me.alternate!==null&&ue.delete(Me.key===null?ge:Me.key),R=u(Me,R,ge),qe===null?de=Me:qe.sibling=Me,qe=Me);return e&&ue.forEach(function(uv){return t(D,uv)}),Ae&&fn(D,ge),de}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 T:e:{for(var de=L.key;R!==null;){if(R.key===de){if(de=L.type,de===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===de||typeof de=="object"&&de!==null&&de.$$typeof===I&&ba(de)===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 m(D);case N:e:{for(de=L.key;R!==null;){if(R.key===de)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=wo(L,D.mode,F),F.return=D,D=F}return m(D);case I:return L=ba(L),Be(D,R,L,F)}if(se(L))return re(D,R,L,F);if(W(L)){if(de=W(L),typeof de!="function")throw Error(r(150));return L=de.call(L),he(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=No(L,D.mode,F),F.return=D,D=F),m(D)):n(D,R)}return function(D,R,L,F){try{Pl=0;var de=Be(D,R,L,F);return nl=null,de}catch(ue){if(ue===tl||ue===vi)throw ue;var qe=jt(29,ue,null,D.mode);return qe.lanes=F,qe.return=D,qe}finally{}}}var Aa=Vd(!0),Yd=Vd(!1),Ln=!1;function zo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Lo(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),wd(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,_f(e,n)}}function Uo(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 m={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};u===null?c=u=m:u=u.next=m,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 Ho=!1;function ns(){if(Ho){var e=el;if(e!==null)throw e}}function as(e,t,n,s){Ho=!1;var c=e.updateQueue;Ln=!1;var u=c.firstBaseUpdate,m=c.lastBaseUpdate,v=c.shared.pending;if(v!==null){c.shared.pending=null;var M=v,U=M.next;M.next=null,m===null?u=U:m.next=U,m=M;var K=e.alternate;K!==null&&(K=K.updateQueue,v=K.lastBaseUpdate,v!==m&&(v===null?K.firstBaseUpdate=U:v.next=U,K.lastBaseUpdate=M))}if(u!==null){var J=c.baseState;m=0,K=U=M=null,v=u;do{var Y=v.lane&-536870913,G=Y!==v.lane;if(G?(be&Y)===Y:(s&Y)===Y){Y!==0&&Y===Pa&&(Ho=!0),K!==null&&(K=K.next={lane:0,tag:v.tag,payload:v.payload,callback:null,next:null});e:{var re=e,he=v;Y=t;var Be=n;switch(he.tag){case 1:if(re=he.payload,typeof re=="function"){J=re.call(Be,J,Y);break e}J=re;break e;case 3:re.flags=re.flags&-65537|128;case 0:if(re=he.payload,Y=typeof re=="function"?re.call(Be,J,Y):re,Y==null)break e;J=b({},J,Y);break e;case 2:Ln=!0}}Y=v.callback,Y!==null&&(e.flags|=64,G&&(e.flags|=8192),G=c.callbacks,G===null?c.callbacks=[Y]:G.push(Y))}else G={lane:Y,tag:v.tag,payload:v.payload,callback:v.callback,next:null},K===null?(U=K=G,M=J):K=K.next=G,m|=Y;if(v=v.next,v===null){if(v=c.shared.pending,v===null)break;G=v,v=G.next,G.next=null,c.lastBaseUpdate=G,c.shared.pending=null}}while(!0);K===null&&(M=J),c.baseState=M,c.firstBaseUpdate=U,c.lastBaseUpdate=K,u===null&&(c.shared.lanes=0),Qn|=m,e.lanes=m,e.memoizedState=J}}function $d(e,t){if(typeof e!="function")throw Error(r(191,e));e.call(t)}function Gd(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)$d(n[e],t)}var al=q(null),ji=q(0);function Qd(e,t){e=An,_(ji,e),_(al,t),An=e|t.baseLanes}function Vo(){_(ji,An),_(al,al.current)}function Yo(){An=ji.current,B(al),B(ji)}var Nt=q(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 $o(e){_(Ke,Ke.current),_(Nt,e),Lt===null&&(Lt=e)}function Xd(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){B(Nt),Lt===e&&(Lt=null),B(Ke)}var Ke=q(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||Fc(n)||Jc(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,ey=0;function Ge(){throw Error(r(321))}function Go(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!At(e[n],t[n]))return!1;return!0}function Qo(e,t,n,s,c,u){return mn=u,pe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,O.H=e===null||e.memoizedState===null?Mh:ic,ja=!1,u=n(s,c),ja=!1,ll&&(u=Zd(t,n,s,c)),Kd(e),u}function Kd(e){O.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 Zd(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)}O.H=Th,u=t(n,s)}while(ll);return u}function ty(){var e=O.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 Xo(){var e=Ei!==0;return Ei=0,e}function Ko(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Zo(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=Ld(sl,e,t),t=pe,(Je===null?t.memoizedState:Je.next)===null&&(t=t.alternate,O.H=t===null||t.memoizedState===null?Mh:ic),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 Fo(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 Jo(t,De,e)}function Jo(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 m=c.next;c.next=u.next,u.next=m}t.baseQueue=c=u,s.pending=null}if(u=e.baseState,c===null)e.memoizedState=u;else{t=c.next;var v=m=null,M=null,U=t,K=!1;do{var J=U.lane&-536870913;if(J!==U.lane?(be&J)===J:(mn&J)===J){var Y=U.revertLane;if(Y===0)M!==null&&(M=M.next={lane:0,revertLane:0,gesture:null,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null}),J===Pa&&(K=!0);else if((mn&Y)===Y){U=U.next,Y===Pa&&(K=!0);continue}else J={lane:0,revertLane:U.revertLane,gesture:null,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null},M===null?(v=M=J,m=u):M=M.next=J,pe.lanes|=Y,Qn|=Y;J=U.action,ja&&n(u,J),u=U.hasEagerState?U.eagerState:n(u,J)}else Y={lane:J,revertLane:U.revertLane,gesture:U.gesture,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null},M===null?(v=M=Y,m=u):M=M.next=Y,pe.lanes|=J,Qn|=J;U=U.next}while(U!==null&&U!==t);if(M===null?m=u:M.next=v,!At(u,e.memoizedState)&&(Ie=!0,K&&(n=el,n!==null)))throw n;e.memoizedState=u,e.baseState=m,e.baseQueue=M,s.lastRenderedState=u}return c===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function Io(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 m=c=c.next;do u=e(u,m.action),m=m.next;while(m!==c);At(u,t.memoizedState)||(Ie=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),n.lastRenderedState=u}return[u,s]}function Fd(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 m=!At((De||c).memoizedState,n);if(m&&(c.memoizedState=n,Ie=!0),c=c.queue,ec(Wd.bind(null,s,c,e),[e]),c.getSnapshot!==t||m||Je!==null&&Je.memoizedState.tag&1){if(s.flags|=2048,il(9,{destroy:void 0},Id.bind(null,s,c,n,t),null),ze===null)throw Error(r(349));u||(mn&127)!==0||Jd(s,t,n)}return n}function Jd(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 Id(e,t,n,s){t.value=n,t.getSnapshot=s,Pd(t)&&eh(e)}function Wd(e,t,n){return n(function(){Pd(t)&&eh(e)})}function Pd(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!At(e,n)}catch{return!0}}function eh(e){var t=ma(e,2);t!==null&&bt(t,e,2)}function Wo(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 th(e,t,n,s){return e.baseState=n,Jo(e,De,typeof s=="function"?s:pn)}function ny(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(m){u.listeners.push(m)}};O.T!==null?n(!0):u.isTransition=!1,s(u),n=t.pending,n===null?(u.next=t.pending=u,nh(t,u)):(u.next=n.next,t.pending=n.next=u)}}function nh(e,t){var n=t.action,s=t.payload,c=e.state;if(t.isTransition){var u=O.T,m={};O.T=m;try{var v=n(c,s),M=O.S;M!==null&&M(m,v),ah(e,t,v)}catch(U){Po(e,t,U)}finally{u!==null&&m.types!==null&&(u.types=m.types),O.T=u}}else try{u=n(c,s),ah(e,t,u)}catch(U){Po(e,t,U)}}function ah(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(s){lh(e,t,s)},function(s){return Po(e,t,s)}):lh(e,t,n)}function lh(e,t,n){t.status="fulfilled",t.value=n,sh(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,nh(e,n)))}function Po(e,t,n){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=n,sh(t),t=t.next;while(t!==s)}e.action=null}function sh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function ih(e,t){return t}function rh(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:ih,lastRenderedState:t},n.queue=s,n=Eh.bind(null,pe,s),s.dispatch=n,s=Wo(!1),u=sc.bind(null,pe,!1,s.queue),s=ft(),c={state:t,dispatch:null,action:e,pending:null},s.queue=c,n=ny.bind(null,pe,c,u,n),c.dispatch=n,s.memoizedState=e,[t,n,!1]}function oh(e){var t=Ze();return ch(t,De,e)}function ch(e,t,n){if(t=Jo(e,t,ih)[0],e=Mi(pn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=ss(t)}catch(m){throw m===tl?vi:m}else s=t;t=Ze();var c=t.queue,u=c.dispatch;return n!==t.memoizedState&&(pe.flags|=2048,il(9,{destroy:void 0},ay.bind(null,c,n),null)),[s,u,e]}function ay(e,t){e.action=t}function uh(e){var t=Ze(),n=De;if(n!==null)return ch(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 fh(){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&&Go(s,De.memoizedState.deps)?c.memoizedState=il(t,u,n,s):(pe.flags|=e,c.memoizedState=il(1|t,u,n,s))}function dh(e,t){Ti(8390656,8,e,t)}function ec(e,t){Ri(2048,8,e,t)}function ly(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 hh(e){var t=Ze().memoizedState;return ly({ref:t,nextImpl:e}),function(){if((Te&2)!==0)throw Error(r(440));return t.impl.apply(void 0,arguments)}}function mh(e,t){return Ri(4,2,e,t)}function ph(e,t){return Ri(4,4,e,t)}function gh(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 xh(e,t,n){n=n!=null?n.concat([e]):null,Ri(4,4,gh.bind(null,t,e),n)}function tc(){}function yh(e,t){var n=Ze();t=t===void 0?null:t;var s=n.memoizedState;return t!==null&&Go(t,s[1])?s[0]:(n.memoizedState=[e,t],e)}function vh(e,t){var n=Ze();t=t===void 0?null:t;var s=n.memoizedState;if(t!==null&&Go(t,s[1]))return s[0];if(s=e(),ja){Ee(!0);try{e()}finally{Ee(!1)}}return n.memoizedState=[s,t],s}function nc(e,t,n){return n===void 0||(mn&1073741824)!==0&&(be&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=bm(),pe.lanes|=e,Qn|=e,n)}function bh(e,t,n,s){return At(n,t)?n:al.current!==null?(e=nc(e,n,s),At(e,t)||(Ie=!0),e):(mn&42)===0||(mn&1073741824)!==0&&(be&261930)===0?(Ie=!0,e.memoizedState=n):(e=bm(),pe.lanes|=e,Qn|=e,t)}function Sh(e,t,n,s,c){var u=P.p;P.p=u!==0&&8>u?u:8;var m=O.T,v={};O.T=v,sc(e,!1,t,n);try{var M=c(),U=O.S;if(U!==null&&U(v,M),M!==null&&typeof M=="object"&&typeof M.then=="function"){var K=Px(M,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,m!==null&&v.types!==null&&(m.types=v.types),O.T=m}}function sy(){}function ac(e,t,n,s){if(e.tag!==5)throw Error(r(476));var c=Ah(e).queue;Sh(e,c,t,le,n===null?sy:function(){return jh(e),n(s)})}function Ah(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 jh(e){var t=Ah(e);t.next===null&&(t=e.alternate.memoizedState),is(e,t.next.queue,{},qt())}function lc(){return rt(js)}function Nh(){return Ze().memoizedState}function wh(){return Ze().memoizedState}function iy(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:_o()},e.payload=t;return}t=t.return}}function ry(e,t,n){var s=qt();n={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},ki(e)?Ch(t,n):(n=Ao(e,t,n,s),n!==null&&(bt(n,e,s),qh(n,t,s)))}function Eh(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))Ch(t,c);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var m=t.lastRenderedState,v=u(m,n);if(c.hasEagerState=!0,c.eagerState=v,At(v,m))return di(e,t,c,0),ze===null&&fi(),!1}catch{}finally{}if(n=Ao(e,t,c,s),n!==null)return bt(n,e,s),qh(n,t,s),!0}return!1}function sc(e,t,n,s){if(s={lane:2,revertLane:zc(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},ki(e)){if(t)throw Error(r(479))}else t=Ao(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 Ch(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 qh(e,t,n){if((n&4194048)!==0){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,_f(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 Mh={readContext:rt,use:qi,useCallback:function(e,t){return ft().memoizedState=[e,t===void 0?null:t],e},useContext:rt,useEffect:dh,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Ti(4194308,4,gh.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=ry.bind(null,pe,e),[s.memoizedState,e]},useRef:function(e){var t=ft();return e={current:e},t.memoizedState=e},useState:function(e){e=Wo(e);var t=e.queue,n=Eh.bind(null,pe,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:tc,useDeferredValue:function(e,t){var n=ft();return nc(n,e,t)},useTransition:function(){var e=Wo(!1);return e=Sh.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||Jd(s,t,n)}c.memoizedState=n;var u={value:n,getSnapshot:t};return c.queue=u,dh(Wd.bind(null,s,u,e),[e]),s.flags|=2048,il(9,{destroy:void 0},Id.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=ey++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:lc,useFormState:rh,useActionState:rh,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=sc.bind(null,pe,!0,n),n.dispatch=t,[e,t]},useMemoCache:Fo,useCacheRefresh:function(){return ft().memoizedState=iy.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)}}},ic={readContext:rt,use:qi,useCallback:yh,useContext:rt,useEffect:ec,useImperativeHandle:xh,useInsertionEffect:mh,useLayoutEffect:ph,useMemo:vh,useReducer:Mi,useRef:fh,useState:function(){return Mi(pn)},useDebugValue:tc,useDeferredValue:function(e,t){var n=Ze();return bh(n,De.memoizedState,e,t)},useTransition:function(){var e=Mi(pn)[0],t=Ze().memoizedState;return[typeof e=="boolean"?e:ss(e),t]},useSyncExternalStore:Fd,useId:Nh,useHostTransitionStatus:lc,useFormState:oh,useActionState:oh,useOptimistic:function(e,t){var n=Ze();return th(n,De,e,t)},useMemoCache:Fo,useCacheRefresh:wh};ic.useEffectEvent=hh;var Th={readContext:rt,use:qi,useCallback:yh,useContext:rt,useEffect:ec,useImperativeHandle:xh,useInsertionEffect:mh,useLayoutEffect:ph,useMemo:vh,useReducer:Io,useRef:fh,useState:function(){return Io(pn)},useDebugValue:tc,useDeferredValue:function(e,t){var n=Ze();return De===null?nc(n,e,t):bh(n,De.memoizedState,e,t)},useTransition:function(){var e=Io(pn)[0],t=Ze().memoizedState;return[typeof e=="boolean"?e:ss(e),t]},useSyncExternalStore:Fd,useId:Nh,useHostTransitionStatus:lc,useFormState:uh,useActionState:uh,useOptimistic:function(e,t){var n=Ze();return De!==null?th(n,De,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:Fo,useCacheRefresh:wh};Th.useEffectEvent=hh;function rc(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 oc={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 Rh(e,t,n,s,c,u,m){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,u,m):t.prototype&&t.prototype.isPureReactComponent?!Kl(n,s)||!Kl(c,u):!0}function kh(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&&oc.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 _h(e){ui(e)}function Dh(e){console.error(e)}function Oh(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 Bh(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 cc(e,t,n){return n=Un(n),n.tag=3,n.payload={element:null},n.callback=function(){_i(e,t)},n}function zh(e){return e=Un(e),e.tag=3,e}function Lh(e,t,n,s){var c=n.type.getDerivedStateFromError;if(typeof c=="function"){var u=s.value;e.payload=function(){return c(u)},e.callback=function(){Bh(t,n,s)}}var m=n.stateNode;m!==null&&typeof m.componentDidCatch=="function"&&(e.callback=function(){Bh(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 oy(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),Dc(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)),Dc(e,s,c)),!1}throw Error(r(435,n.tag))}return Dc(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!==qo&&(e=Error(r(422),{cause:s}),Jl(Dt(e,n)))):(s!==qo&&(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=cc(e.stateNode,s,c),Uo(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=cc(n.stateNode,s,e),Uo(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=zh(c),Lh(c,e,n,s),Uo(n,c),!1}n=n.return}while(n!==null);return!1}var uc=Error(r(461)),Ie=!1;function ot(e,t,n,s){t.child=e===null?Yd(t,null,n,s):Aa(t,e.child,n,s)}function Uh(e,t,n,s,c){n=n.render;var u=t.ref;if("ref"in s){var m={};for(var v in s)v!=="ref"&&(m[v]=s[v])}else m=s;return ya(t),s=Qo(e,t,n,m,u,c),v=Xo(),e!==null&&!Ie?(Ko(e,t,c),gn(e,t,c)):(Ae&&v&&Eo(t),t.flags|=1,ot(e,t,s,c),t.child)}function Hh(e,t,n,s,c){if(e===null){var u=n.type;return typeof u=="function"&&!jo(u)&&u.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=u,Vh(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,!yc(e,c)){var m=u.memoizedProps;if(n=n.compare,n=n!==null?n:Kl,n(m,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 Vh(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,yc(e,c))(e.flags&131072)!==0&&(Ie=!0);else return t.lanes=e.lanes,gn(e,t,c)}return fc(e,t,n,s,c)}function Yh(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 $h(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?Qd(t,u):Vo(),Xd(t);else return s=t.lanes=536870912,$h(e,t,u!==null?u.baseLanes|n:n,n,s)}else u!==null?(yi(t,u.cachePool),Qd(t,u),Yn(),t.memoizedState=null):(e!==null&&yi(t,null),Vo(),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 $h(e,t,n,s,c){var u=Oo();return u=u===null?null:{parent:Fe._currentValue,pool:u},t.memoizedState={baseLanes:n,cachePool:u},e!==null&&yi(t,null),Vo(),Xd(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 Gh(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 cy(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($o(t),(e=He)?(e=np(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=Cd(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 m=u.dehydrated;if($o(t),c)if(t.flags&256)t.flags&=-257,t=Gh(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&&(m=Df(s,n),m!==0&&m!==u.retryLane))throw u.retryLane=m,ma(e,m),bt(s,e,m),uc;Qi(),t=Gh(e,t,n)}else e=u.treeContext,He=Ut(m.nextSibling),it=t,Ae=!0,On=null,zt=!1,e!==null&&Td(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 fc(e,t,n,s,c){return ya(t),n=Qo(e,t,n,s,void 0,c),s=Xo(),e!==null&&!Ie?(Ko(e,t,c),gn(e,t,c)):(Ae&&s&&Eo(t),t.flags|=1,ot(e,t,n,c),t.child)}function Qh(e,t,n,s,c,u){return ya(t),t.updateQueue=null,n=Zd(t,s,n,c),Kd(e),s=Xo(),e!==null&&!Ie?(Ko(e,t,u),gn(e,t,u)):(Ae&&s&&Eo(t),t.flags|=1,ot(e,t,n,u),t.child)}function Xh(e,t,n,s,c){if(ya(t),t.stateNode===null){var u=Za,m=n.contextType;typeof m=="object"&&m!==null&&(u=rt(m)),u=new n(s,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=oc,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=s,u.state=t.memoizedState,u.refs={},zo(t),m=n.contextType,u.context=typeof m=="object"&&m!==null?rt(m):Za,u.state=t.memoizedState,m=n.getDerivedStateFromProps,typeof m=="function"&&(rc(t,n,m,s),u.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(m=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),m!==u.state&&oc.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,M=Na(n,v);u.props=M;var U=u.context,K=n.contextType;m=Za,typeof K=="object"&&K!==null&&(m=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||U!==m)&&kh(t,u,s,m),Ln=!1;var Y=t.memoizedState;u.state=Y,as(t,s,u,c),ns(),U=t.memoizedState,v||Y!==U||Ln?(typeof J=="function"&&(rc(t,n,J,s),U=t.memoizedState),(M=Ln||Rh(t,n,M,s,Y,U,m))?(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=U),u.props=s,u.state=U,u.context=m,s=M):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{u=t.stateNode,Lo(e,t),m=t.memoizedProps,K=Na(n,m),u.props=K,J=t.pendingProps,Y=u.context,U=n.contextType,M=Za,typeof U=="object"&&U!==null&&(M=rt(U)),v=n.getDerivedStateFromProps,(U=typeof v=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(m!==J||Y!==M)&&kh(t,u,s,M),Ln=!1,Y=t.memoizedState,u.state=Y,as(t,s,u,c),ns();var G=t.memoizedState;m!==J||Y!==G||Ln||e!==null&&e.dependencies!==null&&gi(e.dependencies)?(typeof v=="function"&&(rc(t,n,v,s),G=t.memoizedState),(K=Ln||Rh(t,n,K,s,Y,G,M)||e!==null&&e.dependencies!==null&&gi(e.dependencies))?(U||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(s,G,M),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(s,G,M)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||m===e.memoizedProps&&Y===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||m===e.memoizedProps&&Y===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=G),u.props=s,u.state=G,u.context=M,s=K):(typeof u.componentDidUpdate!="function"||m===e.memoizedProps&&Y===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||m===e.memoizedProps&&Y===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 Kh(e,t,n,s){return ga(),t.flags|=256,ot(e,t,n,s),t.child}var dc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function hc(e){return{baseLanes:e,cachePool:Bd()}}function mc(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Ct),e}function Zh(e,t,n){var s=t.pendingProps,c=!1,u=(t.flags&128)!==0,m;if((m=u)||(m=e!==null&&e.memoizedState===null?!1:(Ke.current&2)!==0),m&&(c=!0,t.flags&=-129),m=(t.flags&32)!==0,t.flags&=-33,e===null){if(Ae){if(c?Vn(t):Yn(),(e=He)?(e=np(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=Cd(e),n.return=t,t.child=n,it=t,He=null)):e=null,e===null)throw Bn(t);return Jc(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=hc(n),s.childLanes=mc(e,m,n),t.memoizedState=dc,os(null,s)):(Vn(t),pc(t,v))}var M=e.memoizedState;if(M!==null&&(v=M.dehydrated,v!==null)){if(u)t.flags&256?(Vn(t),t.flags&=-257,t=gc(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=hc(n),s.childLanes=mc(e,m,n),t.memoizedState=dc,t=os(null,s));else if(Vn(t),Jc(v)){if(m=v.nextSibling&&v.nextSibling.dataset,m)var U=m.dgst;m=U,s=Error(r(419)),s.stack="",s.digest=m,Jl({value:s,source:null,stack:null}),t=gc(e,t,n)}else if(Ie||Wa(e,t,n,!1),m=(n&e.childLanes)!==0,Ie||m){if(m=ze,m!==null&&(s=Df(m,n),s!==0&&s!==M.retryLane))throw M.retryLane=s,ma(e,s),bt(m,e,s),uc;Fc(v)||Qi(),t=gc(e,t,n)}else Fc(v)?(t.flags|=192,t.child=e.child,t=null):(e=M.treeContext,He=Ut(v.nextSibling),it=t,Ae=!0,On=null,zt=!1,e!==null&&Td(t,e),t=pc(t,s.children),t.flags|=4096);return t}return c?(Yn(),v=s.fallback,c=t.mode,M=e.child,U=M.sibling,s=un(M,{mode:"hidden",children:s.children}),s.subtreeFlags=M.subtreeFlags&65011712,U!==null?v=un(U,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=hc(n):(c=v.cachePool,c!==null?(M=Fe._currentValue,c=c.parent!==M?{parent:M,pool:M}:c):c=Bd(),v={baseLanes:v.baseLanes|n,cachePool:c}),s.memoizedState=v,s.childLanes=mc(e,m,n),t.memoizedState=dc,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&&(m=t.deletions,m===null?(t.deletions=[e],t.flags|=16):m.push(e)),t.child=n,t.memoizedState=null,n)}function pc(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 gc(e,t,n){return Aa(t,e.child,null,n),e=pc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Fh(e,t,n){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),Ro(e.return,t,n)}function xc(e,t,n,s,c,u){var m=e.memoizedState;m===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:n,tailMode:c,treeForkCount:u}:(m.isBackwards=t,m.rendering=null,m.renderingStartTime=0,m.last=s,m.tail=n,m.tailMode=c,m.treeForkCount=u)}function Jh(e,t,n){var s=t.pendingProps,c=s.revealOrder,u=s.tail;s=s.children;var m=Ke.current,v=(m&2)!==0;if(v?(m=m&1|2,t.flags|=128):m&=1,_(Ke,m),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&&Fh(e,n,t);else if(e.tag===19)Fh(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),xc(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}xc(t,!0,n,null,u,s);break;case"together":xc(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 yc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&gi(e)))}function uy(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,$o(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?Zh(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 Jh(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,Yh(e,t,n,t.pendingProps);case 24:zn(t,Fe,e.memoizedState.cache)}return gn(e,t,n)}function Ih(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Ie=!0;else{if(!yc(e,n)&&(t.flags&128)===0)return Ie=!1,uy(e,t,n);Ie=(e.flags&131072)!==0}else Ie=!1,Ae&&(t.flags&1048576)!==0&&Md(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")jo(e)?(s=Na(e,s),t.tag=1,t=Xh(null,t,e,s,n)):(t.tag=0,t=fc(null,t,e,s,n));else{if(e!=null){var c=e.$$typeof;if(c===Q){t.tag=11,t=Uh(null,t,e,s,n);break e}else if(c===z){t.tag=14,t=Hh(null,t,e,s,n);break e}}throw t=oe(e)||e,Error(r(306,t,""))}}return t;case 0:return fc(e,t,t.type,t.pendingProps,n);case 1:return s=t.type,c=Na(s,t.pendingProps),Xh(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,Lo(e,t),as(t,s,null,n);var m=t.memoizedState;if(s=m.cache,zn(t,Fe,s),s!==u.cache&&ko(t,[Fe],n,!0),ns(),s=m.element,u.isDehydrated)if(u={element:s,isDehydrated:!1,cache:m.cache},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){t=Kh(e,t,s,n);break e}else if(s!==c){c=Dt(Error(r(424)),t),Jl(c),t=Kh(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=Yd(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=op(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=op(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return St(t),e===null&&Ae&&(s=t.stateNode=sp(t.type,t.pendingProps,ne.current),it=t,zt=!0,c=He,Jn(t.type)?(Ic=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=Hy(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,m=e!==null?e.memoizedProps:null,s=u.children,Xc(c,u)?s=null:m!==null&&Xc(c,m)&&(t.flags|=32),t.memoizedState!==null&&(c=Qo(e,t,ty,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=Vy(n,t.pendingProps,zt),n!==null?(t.stateNode=n,it=t,He=null,e=!0):e=!1),e||Bn(t)),null;case 13:return Zh(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 Uh(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 Hh(e,t,t.type,t.pendingProps,n);case 15:return Vh(e,t,t.type,t.pendingProps,n);case 19:return Jh(e,t,n);case 31:return cy(e,t,n);case 22:return Yh(e,t,n,t.pendingProps);case 24:return ya(t),s=rt(Fe),e===null?(c=Oo(),c===null&&(c=ze,u=_o(),c.pooledCache=u,u.refCount++,u!==null&&(c.pooledCacheLanes|=n),c=u),t.memoizedState={parent:s,cache:c},zo(t),zn(t,Fe,c)):((e.lanes&n)!==0&&(Lo(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&&ko(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 vc(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(Nm())e.flags|=8192;else throw Sa=bi,Bo}else e.flags&=-16777217}function Wh(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!hp(t))if(Nm())e.flags|=8192;else throw Sa=bi,Bo}function zi(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Rf():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 fy(e,t,n){var s=t.pendingProps;switch(Co(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,Mo())),Ve(t),null;case 26:var c=t.type,u=t.memoizedState;return e===null?(xn(t),u!==null?(Ve(t),Wh(t,u)):(Ve(t),vc(t,c,null,s,n))):u?u!==e.memoizedState?(xn(t),Ve(t),Wh(t,u)):(Ve(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&xn(t),Ve(t),vc(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)?Rd(t):(e=sp(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))Rd(t);else{var m=Wi(ne.current);switch(u){case 1:u=m.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:u=m.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":u=m.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":u=m.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":u=m.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof s.is=="string"?m.createElement("select",{is:s.is}):m.createElement("select"),s.multiple?u.multiple=!0:s.size&&(u.size=s.size);break;default:u=typeof s.is=="string"?m.createElement(c,{is:s.is}):m.createElement(c)}}u[st]=t,u[mt]=s;e:for(m=t.child;m!==null;){if(m.tag===5||m.tag===6)u.appendChild(m.stateNode);else if(m.tag!==4&&m.tag!==27&&m.child!==null){m.child.return=m,m=m.child;continue}if(m===t)break e;for(;m.sibling===null;){if(m.return===null||m.return===t)break e;m=m.return}m.sibling.return=m.return,m=m.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),vc(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||Zm(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=Mo(),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=Mo(),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&&Vc(t.stateNode.containerInfo),Ve(t),null;case 10:return hn(t.type),Ve(t),null;case 19:if(B(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;)Ed(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),Yo(),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&&B(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 dy(e,t){switch(Co(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 B(Ke),null;case 4:return xe(),null;case 10:return hn(t.type),null;case 22:case 23:return wt(t),Yo(),e!==null&&B(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 Ph(e,t){switch(Co(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:B(Ke);break;case 10:hn(t.type);break;case 22:case 23:wt(t),Yo(),e!==null&&B(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,m=n.inst;s=u(),m.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 m=s.inst,v=m.destroy;if(v!==void 0){m.destroy=void 0,c=t;var M=n,U=v;try{U()}catch(K){ke(c,M,K)}}}s=s.next}while(s!==u)}}catch(K){ke(t,t.return,K)}}function em(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Gd(t,n)}catch(s){ke(e,e.return,s)}}}function tm(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 nm(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 bc(e,t,n){try{var s=e.stateNode;Dy(s,e.type,n,t),s[mt]=t}catch(c){ke(e,e.return,c)}}function am(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Jn(e.type)||e.tag===4}function Sc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||am(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 Ac(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(Ac(e,t,n),e=e.sibling;e!==null;)Ac(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 lm(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,jc=!1,sm=typeof WeakSet=="function"?WeakSet:Set,lt=null;function hy(e,t){if(e=e.containerInfo,Gc=sr,e=xd(e),go(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 m=0,v=-1,M=-1,U=0,K=0,J=e,Y=null;t:for(;;){for(var G;J!==n||c!==0&&J.nodeType!==3||(v=m+c),J!==u||s!==0&&J.nodeType!==3||(M=m+s),J.nodeType===3&&(m+=J.nodeValue.length),(G=J.firstChild)!==null;)Y=J,J=G;for(;;){if(J===e)break t;if(Y===n&&++U===c&&(v=m),Y===u&&++K===s&&(M=m),(G=J.nextSibling)!==null)break;J=Y,Y=J.parentNode}J=G}n=v===-1||M===-1?null:{start:v,end:M}}else n=null}n=n||{start:0,end:0}}else n=null;for(Qc={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 re=Na(n.type,c);e=s.getSnapshotBeforeUpdate(re,u),s.__reactInternalSnapshotBeforeUpdate=e}catch(he){ke(n,n.return,he)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)Zc(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Zc(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 im(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(m){ke(n,n.return,m)}else{var c=Na(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(m){ke(n,n.return,m)}}s&64&&em(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{Gd(e,t)}catch(m){ke(n,n.return,m)}}break;case 27:t===null&&s&4&&lm(n);case 26:case 5:bn(e,n),t===null&&s&4&&nm(n),s&512&&fs(n,n.return);break;case 12:bn(e,n);break;case 31:bn(e,n),s&4&&cm(e,n);break;case 13:bn(e,n),s&4&&um(e,n),s&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Ay.bind(null,n),Yy(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 rm(e){var t=e.alternate;t!==null&&(e.alternate=null,rm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Wr(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;)om(e,t,n),n=n.sibling}function om(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,ep(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),yl(e)):ep(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"&&tm(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 cm(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 um(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 my(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new sm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new sm),t;default:throw Error(r(435,e.tag))}}function Ui(e,t){var n=my(e);t.forEach(function(s){if(!n.has(s)){n.add(s);var c=jy.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,m=t,v=m;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));om(u,m,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;)fm(t,e),t=t.sibling}var Gt=null;function fm(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 m=fp("link","href",c).get(s+(n.href||""));if(m){for(var v=0;v<m.length;v++)if(u=m[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)){m.splice(v,1);break t}}u=c.createElement(s),ct(u,s,n),c.head.appendChild(u);break;case"meta":if(m=fp("meta","content",c).get(s+(n.content||""))){for(v=0;v<m.length;v++)if(u=m[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)){m.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 dp(c,e.type,e.stateNode);else e.stateNode=up(c,s,e.memoizedProps);else u!==s?(u===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):u.count--,s===null?dp(c,e.type,e.stateNode):up(c,s,e.memoizedProps)):s===null&&e.stateNode!==null&&bc(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&&bc(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(re){ke(e,e.return,re)}}s&4&&e.stateNode!=null&&(c=e.memoizedProps,bc(e,c,n!==null?n.memoizedProps:c)),s&1024&&(jc=!0);break;case 6:if(xt(t,e),yt(e),s&4){if(e.stateNode===null)throw Error(r(162));s=e.memoizedProps,n=e.stateNode;try{n.nodeValue=s}catch(re){ke(e,e.return,re)}}break;case 3:if(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(re){ke(e,e.return,re)}jc&&(jc=!1,dm(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 M=n!==null&&n.memoizedState!==null,U=yn,K=We;if(yn=U||c,We=K||M,xt(t,e),We=K,yn=U,yt(e),s&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(n===null||M||yn||We||wa(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){M=n=t;try{if(u=M.stateNode,c)m=u.style,typeof m.setProperty=="function"?m.setProperty("display","none","important"):m.display="none";else{v=M.stateNode;var J=M.memoizedProps.style,Y=J!=null&&J.hasOwnProperty("display")?J.display:null;v.style.display=Y==null||typeof Y=="boolean"?"":(""+Y).trim()}}catch(re){ke(M,M.return,re)}}}else if(t.tag===6){if(n===null){M=t;try{M.stateNode.nodeValue=c?"":M.memoizedProps}catch(re){ke(M,M.return,re)}}}else if(t.tag===18){if(n===null){M=t;try{var G=M.stateNode;c?tp(G,!0):tp(M.stateNode,!1)}catch(re){ke(M,M.return,re)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}s&4&&(s=e.updateQueue,s!==null&&(n=s.retryQueue,n!==null&&(s.retryQueue=null,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(am(s)){n=s;break}s=s.return}if(n==null)throw Error(r(160));switch(n.tag){case 27:var c=n.stateNode,u=Sc(e);Li(e,u,c);break;case 5:var m=n.stateNode;n.flags&32&&(Va(m,""),n.flags&=-33);var v=Sc(e);Li(e,v,m);break;case 3:case 4:var M=n.stateNode.containerInfo,U=Sc(e);Ac(e,U,M);break;default:throw Error(r(161))}}catch(K){ke(e,e.return,K)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function dm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;dm(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;)im(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"&&tm(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,m=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(U){ke(s,s.return,U)}if(s=u,c=s.updateQueue,c!==null){var v=s.stateNode;try{var M=c.shared.hiddenCallbacks;if(M!==null)for(c.shared.hiddenCallbacks=null,c=0;c<M.length;c++)$d(M[c],v)}catch(U){ke(s,s.return,U)}}n&&m&64&&em(u),fs(u,u.return);break;case 27:lm(u);case 26:case 5:Sn(c,u,n),n&&s===null&&m&4&&nm(u),fs(u,u.return);break;case 12:Sn(c,u,n);break;case 31:Sn(c,u,n),n&&m&4&&cm(c,u);break;case 13:Sn(c,u,n),n&&m&4&&um(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 Nc(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 wc(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;)hm(e,t,n,s),t=t.sibling}function hm(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,m=u.id,v=u.onPostCommit;typeof v=="function"&&v(m,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(M){ke(t,t.return,M)}}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,m=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&&Nc(m,t);break;case 24:Qt(e,t,n,s),c&2048&&wc(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,m=t,v=n,M=s,U=m.flags;switch(m.tag){case 0:case 11:case 15:rl(u,m,v,M,c),us(8,m);break;case 23:break;case 22:var K=m.stateNode;m.memoizedState!==null?K._visibility&2?rl(u,m,v,M,c):ds(u,m):(K._visibility|=2,rl(u,m,v,M,c)),c&&U&2048&&Nc(m.alternate,m);break;case 24:rl(u,m,v,M,c),c&&U&2048&&wc(m.alternate,m);break;default:rl(u,m,v,M,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&&Nc(s.alternate,s);break;case 24:ds(n,s),c&2048&&wc(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;)mm(e,t,n),e=e.sibling}function mm(e,t,n){switch(e.tag){case 26:ol(e,t,n),e.flags&hs&&e.memoizedState!==null&&ev(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 pm(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,xm(s,e)}pm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)gm(e),e=e.sibling}function gm(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,xm(s,e)}pm(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 xm(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(rm(s),s===n){lt=null;break e}if(c!==null){c.return=u,lt=c;break e}lt=u}}}var py={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}},gy=typeof WeakMap=="function"?WeakMap:Map,Te=0,ze=null,ye=null,be=0,Re=0,Et=null,Gn=!1,cl=!1,Ec=!1,An=0,Qe=0,Qn=0,Ea=0,Cc=0,Ct=0,ul=0,ps=null,vt=null,qc=!1,Vi=0,ym=0,Yi=1/0,$i=null,Xn=null,nt=0,Kn=null,fl=null,jn=0,Mc=0,Tc=null,vm=null,gs=0,Rc=null;function qt(){return(Te&2)!==0&&be!==0?be&-be:O.T!==null?zc():Of()}function bm(){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 Sm(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?vy(e,t):_c(e,t,!0),u=s;do{if(c===0){cl&&!s&&Zn(e,t,0,!1);break}else{if(n=e.current.alternate,u&&!xy(n)){c=_c(e,t,!1),u=!1;continue}if(c===2){if(u=t,e.errorRecoveryDisabledLanes&u)var m=0;else m=e.pendingLanes&-536870913,m=m!==0?m:m&536870912?536870912:0;if(m!==0){t=m;e:{var v=e;c=ps;var M=v.current.memoizedState.isDehydrated;if(M&&(dl(v,m).flags|=256),m=_c(v,m,!1),m!==2){if(Ec&&!M){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=m}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=Wm(Am.bind(null,s,n,vt,$i,qc,t,Ct,Ea,ul,Gn,u,"Throttled",-0,0),c);break e}Am(s,n,vt,$i,qc,t,Ct,Ea,ul,Gn,u,null,-0,0)}}break}while(!0);Pt(e)}function Am(e,t,n,s,c,u,m,v,M,U,K,J,Y,G){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},mm(t,u,J);var re=(u&62914560)===u?Vi-tt():(u&4194048)===u?ym-tt():0;if(re=tv(J,re),re!==null){jn=u,e.cancelPendingCommit=re(Tm.bind(null,e,t,u,n,s,c,m,v,M,K,J,null,Y,G)),Zn(e,u,m,!U);return}}Tm(e,t,u,n,s,c,m,v,M)}function xy(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&=~Cc,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),m=1<<u;s[u]=-1,c&=~m}n!==0&&kf(e,n,t)}function Gi(){return(Te&6)===0?(xs(0),!1):!0}function kc(){if(ye!==null){if(Re===0)var e=ye.return;else e=ye,dn=xa=null,Zo(e),nl=null,Pl=0,e=ye;for(;e!==null;)Ph(e.alternate,e),e=e.return;ye=null}}function dl(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,zy(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),jn=0,kc(),ze=e,ye=n=un(e.current,null),be=t,Re=0,Et=null,Gn=!1,cl=Bl(e,t),Ec=!1,ul=Ct=Cc=Ea=Qn=Qe=0,vt=ps=null,qc=!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 jm(e,t){pe=null,O.H=rs,t===tl||t===vi?(t=Ud(),Re=3):t===Bo?(t=Ud(),Re=4):Re=t===uc?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 Nm(){var e=Nt.current;return e===null?!0:(be&4194048)===be?Lt===null:(be&62914560)===be||(be&536870912)!==0?e===Lt:!1}function wm(){var e=O.H;return O.H=rs,e===null?rs:e}function Em(){var e=O.A;return O.A=py,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 _c(e,t,n){var s=Te;Te|=2;var c=wm(),u=Em();(ze!==e||be!==t)&&($i=null,dl(e,t)),t=!1;var m=Qe;e:do try{if(Re!==0&&ye!==null){var v=ye,M=Et;switch(Re){case 8:kc(),m=6;break e;case 3:case 2:case 9:case 6:Nt.current===null&&(t=!0);var U=Re;if(Re=0,Et=null,hl(e,v,M,U),n&&cl){m=0;break e}break;default:U=Re,Re=0,Et=null,hl(e,v,M,U)}}yy(),m=Qe;break}catch(K){jm(e,K)}while(!0);return t&&e.shellSuspendCounter++,dn=xa=null,Te=s,O.H=c,O.A=u,ye===null&&(ze=null,be=0,fi()),m}function yy(){for(;ye!==null;)Cm(ye)}function vy(e,t){var n=Te;Te|=2;var s=wm(),c=Em();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(zd(u)){Re=0,Et=null,qm(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:zd(u)?(Re=0,Et=null,qm(t)):(Re=0,Et=null,hl(e,t,u,7));break;case 5:var m=null;switch(ye.tag){case 26:m=ye.memoizedState;case 5:case 27:var v=ye;if(m?hp(m):v.stateNode.complete){Re=0,Et=null;var M=v.sibling;if(M!==null)ye=M;else{var U=v.return;U!==null?(ye=U,Xi(U)):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:kc(),Qe=6;break e;default:throw Error(r(462))}}by();break}catch(K){jm(e,K)}while(!0);return dn=xa=null,O.H=s,O.A=c,Te=n,ye!==null?0:(ze=null,be=0,fi(),Qe)}function by(){for(;ye!==null&&!_a();)Cm(ye)}function Cm(e){var t=Ih(e.alternate,e,An);e.memoizedProps=e.pendingProps,t===null?Xi(e):ye=t}function qm(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Qh(n,t,t.pendingProps,t.type,void 0,be);break;case 11:t=Qh(n,t,t.pendingProps,t.type.render,t.ref,be);break;case 5:Zo(t);default:Ph(n,t),t=ye=Ed(t,An),t=Ih(n,t,An)}e.memoizedProps=e.pendingProps,t===null?Xi(e):ye=t}function hl(e,t,n,s){dn=xa=null,Zo(t),nl=null,Pl=0;var c=t.return;try{if(oy(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))),Mm(t,e)):Xi(t)}function Xi(e){var t=e;do{if((t.flags&32768)!==0){Mm(t,Gn);return}e=t.return;var n=fy(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 Mm(e,t){do{var n=dy(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 Tm(e,t,n,s,c,u,m,v,M){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|=So,Pg(e,n,u,m,v,M),e===ze&&(ye=ze=null,be=0),fl=t,Kn=e,jn=n,Mc=u,Tc=c,vm=s,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Ny(Da,function(){return Om(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||s){s=O.T,O.T=null,c=P.p,P.p=2,m=Te,Te|=4;try{hy(e,t,n)}finally{Te=m,P.p=c,O.T=s}}nt=1,Rm(),km(),_m()}}function Rm(){if(nt===1){nt=0;var e=Kn,t=fl,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=O.T,O.T=null;var s=P.p;P.p=2;var c=Te;Te|=4;try{fm(t,e);var u=Qc,m=xd(e.containerInfo),v=u.focusedElem,M=u.selectionRange;if(m!==v&&v&&v.ownerDocument&&gd(v.ownerDocument.documentElement,v)){if(M!==null&&go(v)){var U=M.start,K=M.end;if(K===void 0&&(K=U),"selectionStart"in v)v.selectionStart=U,v.selectionEnd=Math.min(K,v.value.length);else{var J=v.ownerDocument||document,Y=J&&J.defaultView||window;if(Y.getSelection){var G=Y.getSelection(),re=v.textContent.length,he=Math.min(M.start,re),Be=M.end===void 0?he:Math.min(M.end,re);!G.extend&&he>Be&&(m=Be,Be=he,he=m);var D=pd(v,he),R=pd(v,Be);if(D&&R&&(G.rangeCount!==1||G.anchorNode!==D.node||G.anchorOffset!==D.offset||G.focusNode!==R.node||G.focusOffset!==R.offset)){var L=J.createRange();L.setStart(D.node,D.offset),G.removeAllRanges(),he>Be?(G.addRange(L),G.extend(R.node,R.offset)):(L.setEnd(R.node,R.offset),G.addRange(L))}}}}for(J=[],G=v;G=G.parentNode;)G.nodeType===1&&J.push({element:G,left:G.scrollLeft,top:G.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=!!Gc,Qc=Gc=null}finally{Te=c,P.p=s,O.T=n}}e.current=t,nt=2}}function km(){if(nt===2){nt=0;var e=Kn,t=fl,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=O.T,O.T=null;var s=P.p;P.p=2;var c=Te;Te|=4;try{im(e,t.alternate,t)}finally{Te=c,P.p=s,O.T=n}}nt=3}}function _m(){if(nt===4||nt===3){nt=0,_l();var e=Kn,t=fl,n=jn,s=vm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?nt=5:(nt=0,fl=Kn=null,Dm(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(Xn=null),Jr(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=O.T,c=P.p,P.p=2,O.T=null;try{for(var u=e.onRecoverableError,m=0;m<s.length;m++){var v=s[m];u(v.value,{componentStack:v.stack})}}finally{O.T=t,P.p=c}}(jn&3)!==0&&Ki(),Pt(e),c=e.pendingLanes,(n&261930)!==0&&(c&42)!==0?e===Rc?gs++:(gs=0,Rc=e):gs=0,xs(0)}}function Dm(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Il(t)))}function Ki(){return Rm(),km(),_m(),Om()}function Om(){if(nt!==5)return!1;var e=Kn,t=Mc;Mc=0;var n=Jr(jn),s=O.T,c=P.p;try{P.p=32>n?32:n,O.T=null,n=Tc,Tc=null;var u=Kn,m=jn;if(nt=0,fl=Kn=null,jn=0,(Te&6)!==0)throw Error(r(331));var v=Te;if(Te|=4,gm(u.current),hm(u,u.current,m,n),Te=v,xs(0,!1),Le&&typeof Le.onPostCommitFiberRoot=="function")try{Le.onPostCommitFiberRoot(Xe,u)}catch{}return!0}finally{P.p=c,O.T=s,Dm(e,t)}}function Bm(e,t,n){t=Dt(n,t),t=cc(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)Bm(e,e,n);else for(;t!==null;){if(t.tag===3){Bm(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=zh(2),s=Hn(t,n,2),s!==null&&(Lh(n,s,t,e),zl(s,2),Pt(s));break}}t=t.return}}function Dc(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new gy;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)||(Ec=!0,c.add(n),e=Sy.bind(null,e,t,n),t.then(e,e))}function Sy(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):Cc|=n,ul===be&&(ul=0)),Pt(e)}function zm(e,t){t===0&&(t=Rf()),e=ma(e,t),e!==null&&(zl(e,t),Pt(e))}function Ay(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),zm(e,n)}function jy(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),zm(e,n)}function Ny(e,t){return ra(e,t)}var Zi=null,ml=null,Oc=!1,Fi=!1,Bc=!1,Fn=0;function Pt(e){e!==ml&&e.next===null&&(ml===null?Zi=ml=e:ml=ml.next=e),Fi=!0,Oc||(Oc=!0,Ey())}function xs(e,t){if(!Bc&&Fi){Bc=!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 m=s.suspendedLanes,v=s.pingedLanes;u=(1<<31-Ce(42|e)+1)-1,u&=c&~(m&~v),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(n=!0,Vm(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,Vm(s,u));s=s.next}while(n);Bc=!1}}function wy(){Lm()}function Lm(){Fi=Oc=!1;var e=0;Fn!==0&&By()&&(e=Fn);for(var t=tt(),n=null,s=Zi;s!==null;){var c=s.next,u=Um(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 Um(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,c=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var m=31-Ce(u),v=1<<m,M=c[m];M===-1?((v&n)===0||(v&s)!==0)&&(c[m]=Wg(v,t)):M<=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),Jr(n)){case 2:case 8:n=Ol;break;case 32:n=Da;break;case 268435456:n=Zs;break;default:n=Da}return s=Hm.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 Hm(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:(Sm(e,s,t),Um(e,tt()),e.callbackNode!=null&&e.callbackNode===n?Hm.bind(null,e):null)}function Vm(e,t){if(Ki())return null;Sm(e,t,!0)}function Ey(){Ly(function(){(Te&6)!==0?ra(oa,wy):Lm()})}function zc(){if(Fn===0){var e=Pa;e===0&&(e=Js,Js<<=1,(Js&261888)===0&&(Js=256)),Fn=e}return Fn}function Ym(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:ai(""+e)}function $m(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 Cy(e,t,n,s,c){if(t==="submit"&&n&&n.stateNode===c){var u=Ym((c[mt]||null).action),m=s.submitter;m&&(t=(t=m[mt]||null)?Ym(t.formAction):m.getAttribute("formAction"),t!==null&&(u=t,m=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 M=m?$m(c,m):new FormData(c);ac(n,{pending:!0,data:M,method:c.method,action:u},null,M)}}else typeof u=="function"&&(v.preventDefault(),M=m?$m(c,m):new FormData(c),ac(n,{pending:!0,data:M,method:c.method,action:u},u,M))},currentTarget:c}]})}}for(var Lc=0;Lc<bo.length;Lc++){var Uc=bo[Lc],qy=Uc.toLowerCase(),My=Uc[0].toUpperCase()+Uc.slice(1);$t(qy,"on"+My)}$t(bd,"onAnimationEnd"),$t(Sd,"onAnimationIteration"),$t(Ad,"onAnimationStart"),$t("dblclick","onDoubleClick"),$t("focusin","onFocus"),$t("focusout","onBlur"),$t(Qx,"onTransitionRun"),$t(Xx,"onTransitionStart"),$t(Kx,"onTransitionCancel"),$t(jd,"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(" "),Ty=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ys));function Gm(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 m=s.length-1;0<=m;m--){var v=s[m],M=v.instance,U=v.currentTarget;if(v=v.listener,M!==u&&c.isPropagationStopped())break e;u=v,c.currentTarget=U;try{u(c)}catch(K){ui(K)}c.currentTarget=null,u=M}else for(m=0;m<s.length;m++){if(v=s[m],M=v.instance,U=v.currentTarget,v=v.listener,M!==u&&c.isPropagationStopped())break e;u=v,c.currentTarget=U;try{u(c)}catch(K){ui(K)}c.currentTarget=null,u=M}}}}function ve(e,t){var n=t[Ir];n===void 0&&(n=t[Ir]=new Set);var s=e+"__bubble";n.has(s)||(Qm(t,e,2,!1),n.add(s))}function Hc(e,t,n){var s=0;t&&(s|=4),Qm(n,e,s,t)}var Ji="_reactListening"+Math.random().toString(36).slice(2);function Vc(e){if(!e[Ji]){e[Ji]=!0,Lf.forEach(function(n){n!=="selectionchange"&&(Ty.has(n)||Hc(n,!1,e),Hc(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ji]||(t[Ji]=!0,Hc("selectionchange",!1,t))}}function Qm(e,t,n,s){switch(bp(t)){case 2:var c=lv;break;case 8:c=sv;break;default:c=nu}n=c.bind(null,t,n,e),c=void 0,!io||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 Yc(e,t,n,s,c){var u=s;if((t&1)===0&&(t&2)===0&&s!==null)e:for(;;){if(s===null)return;var m=s.tag;if(m===3||m===4){var v=s.stateNode.containerInfo;if(v===c)break;if(m===4)for(m=s.return;m!==null;){var M=m.tag;if((M===3||M===4)&&m.stateNode.containerInfo===c)return;m=m.return}for(;v!==null;){if(m=Ba(v),m===null)return;if(M=m.tag,M===5||M===6||M===26||M===27){s=u=m;continue e}v=v.parentNode}}s=s.return}Jf(function(){var U=u,K=lo(n),J=[];e:{var Y=Nd.get(e);if(Y!==void 0){var G=ri,re=e;switch(e){case"keypress":if(si(n)===0)break e;case"keydown":case"keyup":G=jx;break;case"focusin":re="focus",G=uo;break;case"focusout":re="blur",G=uo;break;case"beforeblur":case"afterblur":G=uo;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":G=Pf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":G=fx;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":G=Ex;break;case bd:case Sd:case Ad:G=mx;break;case jd:G=qx;break;case"scroll":case"scrollend":G=cx;break;case"wheel":G=Tx;break;case"copy":case"cut":case"paste":G=gx;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":G=td;break;case"toggle":case"beforetoggle":G=kx}var he=(t&4)!==0,Be=!he&&(e==="scroll"||e==="scrollend"),D=he?Y!==null?Y+"Capture":null:Y;he=[];for(var R=U,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&&he.push(vs(R,F,L))),Be)break;R=R.return}0<he.length&&(Y=new G(Y,re,null,n,K),J.push({event:Y,listeners:he}))}}if((t&7)===0){e:{if(Y=e==="mouseover"||e==="pointerover",G=e==="mouseout"||e==="pointerout",Y&&n!==ao&&(re=n.relatedTarget||n.fromElement)&&(Ba(re)||re[Oa]))break e;if((G||Y)&&(Y=K.window===K?K:(Y=K.ownerDocument)?Y.defaultView||Y.parentWindow:window,G?(re=n.relatedTarget||n.toElement,G=U,re=re?Ba(re):null,re!==null&&(Be=d(re),he=re.tag,re!==Be||he!==5&&he!==27&&he!==6)&&(re=null)):(G=null,re=U),G!==re)){if(he=Pf,F="onMouseLeave",D="onMouseEnter",R="mouse",(e==="pointerout"||e==="pointerover")&&(he=td,F="onPointerLeave",D="onPointerEnter",R="pointer"),Be=G==null?Y:Ul(G),L=re==null?Y:Ul(re),Y=new he(F,R+"leave",G,n,K),Y.target=Be,Y.relatedTarget=L,F=null,Ba(K)===U&&(he=new he(D,R+"enter",re,n,K),he.target=L,he.relatedTarget=Be,F=he),Be=F,G&&re)t:{for(he=Ry,D=G,R=re,L=0,F=D;F;F=he(F))L++;F=0;for(var de=R;de;de=he(de))F++;for(;0<L-F;)D=he(D),L--;for(;0<F-L;)R=he(R),F--;for(;L--;){if(D===R||R!==null&&D===R.alternate){he=D;break t}D=he(D),R=he(R)}he=null}else he=null;G!==null&&Xm(J,Y,G,he,!1),re!==null&&Be!==null&&Xm(J,Be,re,he,!0)}}e:{if(Y=U?Ul(U):window,G=Y.nodeName&&Y.nodeName.toLowerCase(),G==="select"||G==="input"&&Y.type==="file")var qe=cd;else if(rd(Y))if(ud)qe=Yx;else{qe=Hx;var ue=Ux}else G=Y.nodeName,!G||G.toLowerCase()!=="input"||Y.type!=="checkbox"&&Y.type!=="radio"?U&&no(U.elementType)&&(qe=cd):qe=Vx;if(qe&&(qe=qe(e,U))){od(J,qe,n,K);break e}ue&&ue(e,Y,U),e==="focusout"&&U&&Y.type==="number"&&U.memoizedProps.value!=null&&to(Y,"number",Y.value)}switch(ue=U?Ul(U):window,e){case"focusin":(rd(ue)||ue.contentEditable==="true")&&(Qa=ue,xo=U,Zl=null);break;case"focusout":Zl=xo=Qa=null;break;case"mousedown":yo=!0;break;case"contextmenu":case"mouseup":case"dragend":yo=!1,yd(J,n,K);break;case"selectionchange":if(Gx)break;case"keydown":case"keyup":yd(J,n,K)}var ge;if(ho)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?sd(e,n)&&(Se="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(Se="onCompositionStart");Se&&(nd&&n.locale!=="ko"&&(Ga||Se!=="onCompositionStart"?Se==="onCompositionEnd"&&Ga&&(ge=If()):(_n=K,ro="value"in _n?_n.value:_n.textContent,Ga=!0)),ue=Ii(U,Se),0<ue.length&&(Se=new ed(Se,e,null,n,K),J.push({event:Se,listeners:ue}),ge?Se.data=ge:(ge=id(n),ge!==null&&(Se.data=ge)))),(ge=Dx?Ox(e,n):Bx(e,n))&&(Se=Ii(U,"onBeforeInput"),0<Se.length&&(ue=new ed("onBeforeInput","beforeinput",null,n,K),J.push({event:ue,listeners:Se}),ue.data=ge)),Cy(J,e,U,n,K)}Gm(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 Ry(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Xm(e,t,n,s,c){for(var u=t._reactName,m=[];n!==null&&n!==s;){var v=n,M=v.alternate,U=v.stateNode;if(v=v.tag,M!==null&&M===s)break;v!==5&&v!==26&&v!==27||U===null||(M=U,c?(U=Hl(n,u),U!=null&&m.unshift(vs(n,U,M))):c||(U=Hl(n,u),U!=null&&m.push(vs(n,U,M)))),n=n.return}m.length!==0&&e.push({event:t,listeners:m})}var ky=/\r\n?/g,_y=/\u0000|\uFFFD/g;function Km(e){return(typeof e=="string"?e:""+e).replace(ky,`
`).replace(_y,"")}function Zm(e,t){return t=Km(t),Km(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":Zf(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=rx.get(n)||n,ei(e,n,s))}}function $c(e,t,n,s,c,u){switch(n){case"style":Zf(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(!Uf.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 m=n[u];if(m!=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,m,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=m=c=null,M=null,U=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":m=K;break;case"checked":M=K;break;case"defaultChecked":U=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)}}Gf(e,u,v,M,U,m,c,!1);return;case"select":ve("invalid",e),s=m=u=null;for(c in n)if(n.hasOwnProperty(c)&&(v=n[c],v!=null))switch(c){case"value":u=v;break;case"defaultValue":m=v;break;case"multiple":s=v;default:Oe(e,t,c,v,n,null)}t=u,n=m,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(m in n)if(n.hasOwnProperty(m)&&(v=n[m],v!=null))switch(m){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,m,v,n,null)}Xf(e,s,c,u);return;case"option":for(M in n)if(n.hasOwnProperty(M)&&(s=n[M],s!=null))switch(M){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:Oe(e,t,M,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(U in n)if(n.hasOwnProperty(U)&&(s=n[U],s!=null))switch(U){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:Oe(e,t,U,s,n,null)}return;default:if(no(t)){for(K in n)n.hasOwnProperty(K)&&(s=n[K],s!==void 0&&$c(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 Dy(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,m=null,v=null,M=null,U=null,K=null;for(G in n){var J=n[G];if(n.hasOwnProperty(G)&&J!=null)switch(G){case"checked":break;case"value":break;case"defaultValue":M=J;default:s.hasOwnProperty(G)||Oe(e,t,G,null,s,J)}}for(var Y in s){var G=s[Y];if(J=n[Y],s.hasOwnProperty(Y)&&(G!=null||J!=null))switch(Y){case"type":u=G;break;case"name":c=G;break;case"checked":U=G;break;case"defaultChecked":K=G;break;case"value":m=G;break;case"defaultValue":v=G;break;case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(r(137,t));break;default:G!==J&&Oe(e,t,Y,G,s,J)}}eo(e,m,v,M,U,K,u,c);return;case"select":G=m=v=Y=null;for(u in n)if(M=n[u],n.hasOwnProperty(u)&&M!=null)switch(u){case"value":break;case"multiple":G=M;default:s.hasOwnProperty(u)||Oe(e,t,u,null,s,M)}for(c in s)if(u=s[c],M=n[c],s.hasOwnProperty(c)&&(u!=null||M!=null))switch(c){case"value":Y=u;break;case"defaultValue":v=u;break;case"multiple":m=u;default:u!==M&&Oe(e,t,c,u,s,M)}t=v,n=m,s=G,Y!=null?Ha(e,!!n,Y,!1):!!s!=!!n&&(t!=null?Ha(e,!!n,t,!0):Ha(e,!!n,n?[]:"",!1));return;case"textarea":G=Y=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(m in s)if(c=s[m],u=n[m],s.hasOwnProperty(m)&&(c!=null||u!=null))switch(m){case"value":Y=c;break;case"defaultValue":G=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(r(91));break;default:c!==u&&Oe(e,t,m,c,s,u)}Qf(e,Y,G);return;case"option":for(var re in n)if(Y=n[re],n.hasOwnProperty(re)&&Y!=null&&!s.hasOwnProperty(re))switch(re){case"selected":e.selected=!1;break;default:Oe(e,t,re,null,s,Y)}for(M in s)if(Y=s[M],G=n[M],s.hasOwnProperty(M)&&Y!==G&&(Y!=null||G!=null))switch(M){case"selected":e.selected=Y&&typeof Y!="function"&&typeof Y!="symbol";break;default:Oe(e,t,M,Y,s,G)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var he in n)Y=n[he],n.hasOwnProperty(he)&&Y!=null&&!s.hasOwnProperty(he)&&Oe(e,t,he,null,s,Y);for(U in s)if(Y=s[U],G=n[U],s.hasOwnProperty(U)&&Y!==G&&(Y!=null||G!=null))switch(U){case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(r(137,t));break;default:Oe(e,t,U,Y,s,G)}return;default:if(no(t)){for(var Be in n)Y=n[Be],n.hasOwnProperty(Be)&&Y!==void 0&&!s.hasOwnProperty(Be)&&$c(e,t,Be,void 0,s,Y);for(K in s)Y=s[K],G=n[K],!s.hasOwnProperty(K)||Y===G||Y===void 0&&G===void 0||$c(e,t,K,Y,s,G);return}}for(var D in n)Y=n[D],n.hasOwnProperty(D)&&Y!=null&&!s.hasOwnProperty(D)&&Oe(e,t,D,null,s,Y);for(J in s)Y=s[J],G=n[J],!s.hasOwnProperty(J)||Y===G||Y==null&&G==null||Oe(e,t,J,Y,s,G)}function Fm(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Oy(){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,m=c.initiatorType,v=c.duration;if(u&&v&&Fm(m)){for(m=0,v=c.responseEnd,s+=1;s<n.length;s++){var M=n[s],U=M.startTime;if(U>v)break;var K=M.transferSize,J=M.initiatorType;K&&Fm(J)&&(M=M.responseEnd,m+=K*(M<v?1:(v-U)/(M-U)))}if(--s,t+=8*(u+m)/(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 Gc=null,Qc=null;function Wi(e){return e.nodeType===9?e:e.ownerDocument}function Jm(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 Im(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 Xc(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 Kc=null;function By(){var e=window.event;return e&&e.type==="popstate"?e===Kc?!1:(Kc=e,!0):(Kc=null,!1)}var Wm=typeof setTimeout=="function"?setTimeout:void 0,zy=typeof clearTimeout=="function"?clearTimeout:void 0,Pm=typeof Promise=="function"?Promise:void 0,Ly=typeof queueMicrotask=="function"?queueMicrotask:typeof Pm<"u"?function(e){return Pm.resolve(null).then(e).catch(Uy)}:Wm;function Uy(e){setTimeout(function(){throw e})}function Jn(e){return e==="head"}function ep(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 m=u.nextSibling,v=u.nodeName;u[Ll]||v==="SCRIPT"||v==="STYLE"||v==="LINK"&&u.rel.toLowerCase()==="stylesheet"||n.removeChild(u),u=m}}else n==="body"&&bs(e.ownerDocument.body);n=c}while(n);yl(t)}function tp(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 Zc(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":Zc(n),Wr(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function Hy(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 Vy(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 np(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 Fc(e){return e.data==="$?"||e.data==="$~"}function Jc(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Yy(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 Ic=null;function ap(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 lp(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 sp(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]);Wr(e)}var Ht=new Map,ip=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:$y,r:Gy,D:Qy,C:Xy,L:Ky,m:Zy,X:Jy,S:Fy,M:Iy};function $y(){var e=Nn.f(),t=Gi();return e||t}function Gy(e){var t=za(e);t!==null&&t.tag===5&&t.type==="form"?jh(t):Nn.r(e)}var pl=typeof document>"u"?null:document;function rp(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+'"]'),ip.has(c)||(ip.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 Qy(e){Nn.D(e),rp("dns-prefetch",e,null)}function Xy(e,t){Nn.C(e,t),rp("preconnect",e,t)}function Ky(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 Zy(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 Fy(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 m=c.get(u);if(!m){var v={loading:0,preload:null};if(m=s.querySelector(Ss(u)))v.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Ht.get(u))&&Wc(e,n);var M=m=s.createElement("link");at(M),ct(M,"link",e),M._p=new Promise(function(U,K){M.onload=U,M.onerror=K}),M.addEventListener("load",function(){v.loading|=1}),M.addEventListener("error",function(){v.loading|=2}),v.loading|=4,er(m,t,s)}m={type:"stylesheet",instance:m,count:1,state:v},c.set(u,m)}}}function Jy(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))&&Pc(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 Iy(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))&&Pc(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 op(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,m=u.get(e);if(m||(c=c.ownerDocument||c,m={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,m),(u=c.querySelector(Ss(e)))&&!u._p&&(m.instance=u,m.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||Wy(c,e,n,m.state))),t&&s===null)throw Error(r(528,""));return m}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 cp(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function Wy(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 up(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=cp(n),(c=Ht.get(c))&&Wc(s,c),u=(e.ownerDocument||e).createElement("link"),at(u);var m=u;return m._p=new Promise(function(v,M){m.onload=v,m.onerror=M}),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),Pc(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,m=0;m<s.length;m++){var v=s[m];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 Wc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Pc(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 fp(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 m=u.getAttribute(t)||"";m=e+m;var v=s.get(m);v?v.push(u):s.set(m,[u])}}return s}function dp(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function Py(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 hp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function ev(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=cp(s),(c=Ht.get(c))&&Wc(s,c),u=u.createElement("link"),at(u);var m=u;m._p=new Promise(function(v,M){m.onload=v,m.onerror=M}),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 eu=0;function tv(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&&eu===0&&(eu=62500*Oy());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>eu?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(nv,e),ar=null,nr.call(e))}function nv(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 m=c[u];(m.nodeName==="LINK"||m.getAttribute("media")!=="not all")&&(n.set(m.dataset.precedence,m),s=m)}s&&n.set(null,s)}c=t.instance,m=c.getAttribute("data-precedence"),u=n.get(m)||s,u===s&&n.set(null,c),n.set(m,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 av(e,t,n,s,c,u,m,v,M){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=Zr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Zr(0),this.hiddenUpdates=Zr(null),this.identifierPrefix=s,this.onUncaughtError=c,this.onCaughtError=u,this.onRecoverableError=m,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=M,this.incompleteTransitions=new Map}function mp(e,t,n,s,c,u,m,v,M,U,K,J){return e=new av(e,t,n,m,M,U,K,J,v),t=1,u===!0&&(t|=24),u=jt(3,null,null,t),e.current=u,u.stateNode=e,t=_o(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:s,isDehydrated:n,cache:t},zo(u),e}function pp(e){return e?(e=Za,e):Za}function gp(e,t,n,s,c,u){c=pp(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 xp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function tu(e,t){xp(e,t),(e=e.alternate)&&xp(e,t)}function yp(e){if(e.tag===13||e.tag===31){var t=ma(e,67108864);t!==null&&bt(t,e,67108864),tu(e,67108864)}}function vp(e){if(e.tag===13||e.tag===31){var t=qt();t=Fr(t);var n=ma(e,t);n!==null&&bt(n,e,t),tu(e,t)}}var sr=!0;function lv(e,t,n,s){var c=O.T;O.T=null;var u=P.p;try{P.p=2,nu(e,t,n,s)}finally{P.p=u,O.T=c}}function sv(e,t,n,s){var c=O.T;O.T=null;var u=P.p;try{P.p=8,nu(e,t,n,s)}finally{P.p=u,O.T=c}}function nu(e,t,n,s){if(sr){var c=au(s);if(c===null)Yc(e,t,s,ir,n),Sp(e,s);else if(rv(c,e,t,n,s))s.stopPropagation();else if(Sp(e,s),t&4&&-1<iv.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 m=ca(u.pendingLanes);if(m!==0){var v=u;for(v.pendingLanes|=2,v.entangledLanes|=2;m;){var M=1<<31-Ce(m);v.entanglements[1]|=M,m&=~M}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(),tu(u,2)}if(u=au(s),u===null&&Yc(e,t,s,ir,n),u===c)break;c=u}c!==null&&s.stopPropagation()}else Yc(e,t,s,null,n)}}function au(e){return e=lo(e),lu(e)}var ir=null;function lu(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=g(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 bp(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 Xr:return 32;case Zs:return 268435456;default:return 32}default:return 32}}var su=!1,In=null,Wn=null,Pn=null,Ns=new Map,ws=new Map,ea=[],iv="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 Sp(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&&yp(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function rv(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 Ap(e){var t=Ba(e.target);if(t!==null){var n=d(t);if(n!==null){if(t=n.tag,t===13){if(t=g(n),t!==null){e.blockedOn=t,Bf(e.priority,function(){vp(n)});return}}else if(t===31){if(t=x(n),t!==null){e.blockedOn=t,Bf(e.priority,function(){vp(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=au(e.nativeEvent);if(n===null){n=e.nativeEvent;var s=new n.constructor(n.type,n);ao=s,n.target.dispatchEvent(s),ao=null}else return t=za(n),t!==null&&yp(t),e.blockedOn=n,!1;t.shift()}return!0}function jp(e,t,n){rr(e)&&n.delete(t)}function ov(){su=!1,In!==null&&rr(In)&&(In=null),Wn!==null&&rr(Wn)&&(Wn=null),Pn!==null&&rr(Pn)&&(Pn=null),Ns.forEach(jp),ws.forEach(jp)}function or(e,t){e.blockedOn===t&&(e.blockedOn=null,su||(su=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,ov)))}var cr=null;function Np(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(lu(s||n)===null)continue;break}var u=za(n);u!==null&&(e.splice(t,3),t-=3,ac(u,{pending:!0,data:c,method:n.method,action:s},s,c))}}))}function yl(e){function t(M){return or(M,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);)Ap(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],m=c[mt]||null;if(typeof u=="function")m||Np(n);else if(m){var v=null;if(u&&u.hasAttribute("formAction")){if(c=u,m=u[mt]||null)v=m.formAction;else if(lu(c)!==null)continue}else v=m.action;typeof v=="function"?n[s+1]=v:(n.splice(s,3),s-=3),Np(n)}}}function wp(){function e(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(m){return c=m})},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 iu(e){this._internalRoot=e}ur.prototype.render=iu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));var n=t.current,s=qt();gp(n,s,e,t,null,null)},ur.prototype.unmount=iu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;gp(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=Of();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&&Ap(e)}};var Ep=l.version;if(Ep!=="19.2.0")throw Error(r(527,Ep,"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 cv={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:O,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(cv),Le=fr}catch{}}return qs.createRoot=function(e,t){if(!f(e))throw Error(r(299));var n=!1,s="",c=_h,u=Dh,m=Oh;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&&(m=t.onRecoverableError)),t=mp(e,1,!1,null,null,n,s,null,c,u,m,wp),e[Oa]=t.current,Vc(e),new iu(t)},qs.hydrateRoot=function(e,t,n){if(!f(e))throw Error(r(299));var s=!1,c="",u=_h,m=Dh,v=Oh,M=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&&(m=n.onCaughtError),n.onRecoverableError!==void 0&&(v=n.onRecoverableError),n.formState!==void 0&&(M=n.formState)),t=mp(e,1,!0,t,n??null,s,c,M,u,m,v,wp),t.context=pp(null),n=t.current,s=qt(),s=Fr(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,Vc(e),new ur(t)},qs.version="19.2.0",qs}var Bp;function bv(){if(Bp)return cu.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(),cu.exports=vv(),cu.exports}var Sv=bv();var zp="popstate";function Av(a={}){function l(r,f){let{pathname:d,search:g,hash:x}=r.location;return _u("",{pathname:d,search:g,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 Nv(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 jv(){return Math.random().toString(36).substring(2,10)}function Lp(a,l){return{usr:a.state,key:a.key,idx:l}}function _u(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||jv()}}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 Nv(a,l,i,r={}){let{window:f=document.defaultView,v5Compat:d=!1}=r,g=f.history,x="POP",p=null,y=S();y==null&&(y=0,g.replaceState({...g.state,idx:y},""));function S(){return(g.state||{idx:null}).idx}function b(){x="POP";let A=S(),E=A==null?null:A-y;y=A,p&&p({action:x,location:C.location,delta:E})}function w(A,E){x="PUSH";let j=_u(C.location,A,E);y=S()+1;let k=Lp(j,y),Q=C.createHref(j);try{g.pushState(k,"",Q)}catch(X){if(X instanceof DOMException&&X.name==="DataCloneError")throw X;f.location.assign(Q)}d&&p&&p({action:x,location:C.location,delta:1})}function T(A,E){x="REPLACE";let j=_u(C.location,A,E);y=S();let k=Lp(j,y),Q=C.createHref(j);g.replaceState(k,"",Q),d&&p&&p({action:x,location:C.location,delta:0})}function N(A){return wv(A)}let C={get action(){return x},get location(){return a(f,g)},listen(A){if(p)throw new Error("A history only accepts one active listener");return f.addEventListener(zp,b),p=A,()=>{f.removeEventListener(zp,b),p=null}},createHref(A){return l(f,A)},createURL:N,encodeLocation(A){let E=N(A);return{pathname:E.pathname,search:E.search,hash:E.hash}},push:w,replace:T,go(A){return g.go(A)}};return C}function wv(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 q0(a,l,i="/"){return Ev(a,l,i,!1)}function Ev(a,l,i,r){let f=typeof l=="string"?Cl(l):l,d=Tn(f.pathname||"/",i);if(d==null)return null;let g=M0(a);Cv(g);let x=null;for(let p=0;x==null&&p<g.length;++p){let y=Lv(d);x=Bv(g[p],y,r)}return x}function M0(a,l=[],i=[],r="",f=!1){let d=(g,x,p=f,y)=>{let S={relativePath:y===void 0?g.path||"":y,caseSensitive:g.caseSensitive===!0,childrenIndex:x,route:g};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);g.children&&g.children.length>0&&($e(g.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${b}".`),M0(g.children,l,w,b,p)),!(g.path==null&&!g.index)&&l.push({path:b,score:Dv(b,g.index),routesMeta:w})};return a.forEach((g,x)=>{if(g.path===""||!g.path?.includes("?"))d(g,x);else for(let p of T0(g.path))d(g,x,!0,p)}),l}function T0(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 g=T0(r.join("/")),x=[];return x.push(...g.map(p=>p===""?d:[d,p].join("/"))),f&&x.push(...g),x.map(p=>a.startsWith("/")&&p===""?"/":p)}function Cv(a){a.sort((l,i)=>l.score!==i.score?i.score-l.score:Ov(l.routesMeta.map(r=>r.childrenIndex),i.routesMeta.map(r=>r.childrenIndex)))}var qv=/^:[\w-]+$/,Mv=3,Tv=2,Rv=1,kv=10,_v=-2,Up=a=>a==="*";function Dv(a,l){let i=a.split("/"),r=i.length;return i.some(Up)&&(r+=_v),l&&(r+=Tv),i.filter(f=>!Up(f)).reduce((f,d)=>f+(qv.test(d)?Mv:d===""?Rv:kv),r)}function Ov(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 Bv(a,l,i=!1){let{routesMeta:r}=a,f={},d="/",g=[];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),g.push({params:f,pathname:Mn([d,b.pathname]),pathnameBase:$v(Mn([d,b.pathnameBase])),route:w}),b.pathnameBase!=="/"&&(d=Mn([d,b.pathnameBase]))}return g}function Tr(a,l){typeof a=="string"&&(a={path:a,caseSensitive:!1,end:!0});let[i,r]=zv(a.path,a.caseSensitive,a.end),f=l.match(i);if(!f)return null;let d=f[0],g=d.replace(/(.)\/+$/,"$1"),x=f.slice(1);return{params:r.reduce((y,{paramName:S,isOptional:b},w)=>{if(S==="*"){let N=x[w]||"";g=d.slice(0,d.length-N.length).replace(/(.)\/+$/,"$1")}const T=x[w];return b&&!T?y[S]=void 0:y[S]=(T||"").replace(/%2F/g,"/"),y},{}),pathname:d,pathnameBase:g,pattern:a}}function zv(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,(g,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 Lv(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 Uv=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Hv=a=>Uv.test(a);function Vv(a,l="/"){let{pathname:i,search:r="",hash:f=""}=typeof a=="string"?Cl(a):a,d;if(i)if(Hv(i))d=i;else{if(i.includes("//")){let g=i;i=i.replace(/\/\/+/g,"/"),Ft(!1,`Pathnames cannot have embedded double slashes - normalizing ${g} -> ${i}`)}i.startsWith("/")?d=Hp(i.substring(1),"/"):d=Hp(i,l)}else d=l;return{pathname:d,search:Gv(r),hash:Qv(f)}}function Hp(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 hu(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 Yv(a){return a.filter((l,i)=>i===0||l.route.path&&l.route.path.length>0)}function R0(a){let l=Yv(a);return l.map((i,r)=>r===l.length-1?i.pathname:i.pathnameBase)}function k0(a,l,i,r=!1){let f;typeof a=="string"?f=Cl(a):(f={...a},$e(!f.pathname||!f.pathname.includes("?"),hu("?","pathname","search",f)),$e(!f.pathname||!f.pathname.includes("#"),hu("#","pathname","hash",f)),$e(!f.search||!f.search.includes("#"),hu("#","search","hash",f)));let d=a===""||f.pathname==="",g=d?"/":f.pathname,x;if(g==null)x=i;else{let b=l.length-1;if(!r&&g.startsWith("..")){let w=g.split("/");for(;w[0]==="..";)w.shift(),b-=1;f.pathname=w.join("/")}x=b>=0?l[b]:"/"}let p=Vv(f,x),y=g&&g!=="/"&&g.endsWith("/"),S=(d||g===".")&&i.endsWith("/");return!p.pathname.endsWith("/")&&(y||S)&&(p.pathname+="/"),p}var Mn=a=>a.join("/").replace(/\/\/+/g,"/"),$v=a=>a.replace(/\/+$/,"").replace(/^\/*/,"/"),Gv=a=>!a||a==="?"?"":a.startsWith("?")?a:"?"+a,Qv=a=>!a||a==="#"?"":a.startsWith("#")?a:"#"+a;function Xv(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 _0=["POST","PUT","PATCH","DELETE"];new Set(_0);var Kv=["GET",..._0];new Set(Kv);var ql=h.createContext(null);ql.displayName="DataRouter";var zr=h.createContext(null);zr.displayName="DataRouterState";h.createContext(!1);var D0=h.createContext({isTransitioning:!1});D0.displayName="ViewTransition";var Zv=h.createContext(new Map);Zv.displayName="Fetchers";var Fv=h.createContext(null);Fv.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 Ju=h.createContext(null);Ju.displayName="RouteError";function Jv(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:g}=Qs(a,{relative:l}),x=d;return i!=="/"&&(x=d==="/"?i:Mn([i,d])),r.createHref({pathname:x,search:g,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 O0="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function B0(a){h.useContext(an).static||h.useLayoutEffect(a)}function Iv(){let{isDataRoute:a}=h.useContext(Rn);return a?ub():Wv()}function Wv(){$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(R0(r)),g=h.useRef(!1);return B0(()=>{g.current=!0}),h.useCallback((p,y={})=>{if(Ft(g.current,O0),!g.current)return;if(typeof p=="number"){i.go(p);return}let S=k0(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(R0(i));return h.useMemo(()=>k0(a,JSON.parse(f),r,l==="path"),[a,f,r,l])}function Pv(a,l){return z0(a,l)}function z0(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:g}=h.useContext(Rn),x=g[g.length-1],p=x?x.params:{},y=x?x.pathname:"/",S=x?x.pathnameBase:"/",b=x&&x.route;{let j=b&&b.path||"";L0(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(),T;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.`),T=j}else T=w;let N=T.pathname||"/",C=N;if(S!=="/"){let j=S.replace(/^\//,"").split("/");C="/"+N.replace(/^\//,"").split("/").slice(j.length).join("/")}let A=q0(a,{pathname:C});Ft(b||A!=null,`No routes matched location "${T.pathname}${T.search}${T.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 "${T.pathname}${T.search}${T.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 E=lb(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])})),g,i,r,f);return l&&E?h.createElement($s.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...T},navigationType:"POP"}},E):E}function eb(){let a=cb(),l=Xv(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},g=null;return console.error("Error handled by React Router default ErrorBoundary:",a),g=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,g)}var tb=h.createElement(eb,null),nb=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(Ju.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function ab({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 lb(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,g=i?.errors;if(g!=null){let S=d.findIndex(b=>b.route.id&&g?.[b.route.id]!==void 0);$e(S>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(g).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:T}=i,N=b.route.loader&&!w.hasOwnProperty(b.route.id)&&(!T||T[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 T,N=!1,C=null,A=null;i&&(T=g&&b.route.id?g[b.route.id]:void 0,C=b.route.errorElement||tb,x&&(p<0&&w===0?(L0("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 E=l.concat(d.slice(0,w+1)),j=()=>{let k;return T?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(ab,{match:b,routeContext:{outlet:S,matches:E,isDataRoute:i!=null},children:k})};return i&&(b.route.ErrorBoundary||b.route.errorElement||w===0)?h.createElement(nb,{location:i.location,revalidation:i.revalidation,component:C,error:T,children:j(),routeContext:{outlet:null,matches:E,isDataRoute:!0},onError:y}):j()},null)}function Iu(a){return`${a} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function sb(a){let l=h.useContext(ql);return $e(l,Iu(a)),l}function ib(a){let l=h.useContext(zr);return $e(l,Iu(a)),l}function rb(a){let l=h.useContext(Rn);return $e(l,Iu(a)),l}function Wu(a){let l=rb(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 ob(){return Wu("useRouteId")}function cb(){let a=h.useContext(Ju),l=ib("useRouteError"),i=Wu("useRouteError");return a!==void 0?a:l.errors?.[i]}function ub(){let{router:a}=sb("useNavigate"),l=Wu("useNavigate"),i=h.useRef(!1);return B0(()=>{i.current=!0}),h.useCallback(async(f,d={})=>{Ft(i.current,O0),i.current&&(typeof f=="number"?a.navigate(f):await a.navigate(f,{fromRouteId:l,...d}))},[a,l])}var Vp={};function L0(a,l,i){!l&&!Vp[a]&&(Vp[a]=!0,Ft(!1,i))}h.memo(fb);function fb({routes:a,future:l,state:i,unstable_onError:r}){return z0(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 db({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 g=a.replace(/^\/*/,"/"),x=h.useMemo(()=>({basename:g,navigator:f,static:d,future:{}}),[g,f,d]);typeof i=="string"&&(i=Cl(i));let{pathname:p="/",search:y="",hash:S="",state:b=null,key:w="default"}=i,T=h.useMemo(()=>{let N=Tn(p,g);return N==null?null:{location:{pathname:N,search:y,hash:S,state:b,key:w},navigationType:r}},[g,p,y,S,b,w,r]);return Ft(T!=null,`<Router basename="${g}"> 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.`),T==null?null:h.createElement(an.Provider,{value:x},h.createElement($s.Provider,{children:l,value:T}))}function hb({children:a,location:l}){return Pv(Du(a),l)}function Du(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,Du(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 g={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&&(g.children=Du(r.props.children,d)),i.push(g)}),i}var Sr="get",Ar="application/x-www-form-urlencoded";function Lr(a){return a!=null&&typeof a.tagName=="string"}function mb(a){return Lr(a)&&a.tagName.toLowerCase()==="button"}function pb(a){return Lr(a)&&a.tagName.toLowerCase()==="form"}function gb(a){return Lr(a)&&a.tagName.toLowerCase()==="input"}function xb(a){return!!(a.metaKey||a.altKey||a.ctrlKey||a.shiftKey)}function yb(a,l){return a.button===0&&(!l||l==="_self")&&!xb(a)}var dr=null;function vb(){if(dr===null)try{new FormData(document.createElement("form"),0),dr=!1}catch{dr=!0}return dr}var bb=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function mu(a){return a!=null&&!bb.has(a)?(Ft(!1,`"${a}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Ar}"`),null):a}function Sb(a,l){let i,r,f,d,g;if(pb(a)){let x=a.getAttribute("action");r=x?Tn(x,l):null,i=a.getAttribute("method")||Sr,f=mu(a.getAttribute("enctype"))||Ar,d=new FormData(a)}else if(mb(a)||gb(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=mu(a.getAttribute("formenctype"))||mu(x.getAttribute("enctype"))||Ar,d=new FormData(x,a),!vb()){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,g=a}return d&&f==="text/plain"&&(g=d,d=void 0),{action:r,method:i.toLowerCase(),encType:f,formData:d,body:g}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Pu(a,l){if(a===!1||a===null||typeof a>"u")throw new Error(l)}function Ab(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 jb(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 Nb(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 wb(a,l,i){let r=await Promise.all(a.map(async f=>{let d=l.routes[f.route.id];if(d){let g=await jb(d,i);return g.links?g.links():[]}return[]}));return Mb(r.flat(1).filter(Nb).filter(f=>f.rel==="stylesheet"||f.rel==="preload").map(f=>f.rel==="stylesheet"?{...f,rel:"prefetch",as:"style"}:{...f,rel:"prefetch"}))}function Yp(a,l,i,r,f,d){let g=(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)=>g(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(g(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 Eb(a,l,{includeHydrateFallback:i}={}){return Cb(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 Cb(a){return[...new Set(a)]}function qb(a){let l={},i=Object.keys(a).sort();for(let r of i)l[r]=a[r];return l}function Mb(a,l){let i=new Set;return new Set(l),a.reduce((r,f)=>{let d=JSON.stringify(qb(f));return i.has(d)||(i.add(d),r.push({key:d,link:f})),r},[])}function U0(){let a=h.useContext(ql);return Pu(a,"You must render this element inside a <DataRouterContext.Provider> element"),a}function Tb(){let a=h.useContext(zr);return Pu(a,"You must render this element inside a <DataRouterStateContext.Provider> element"),a}var ef=h.createContext(void 0);ef.displayName="FrameworkContext";function H0(){let a=h.useContext(ef);return Pu(a,"You must render this element inside a <HydratedRouter> element"),a}function Rb(a,l){let i=h.useContext(ef),[r,f]=h.useState(!1),[d,g]=h.useState(!1),{onFocus:x,onBlur:p,onMouseEnter:y,onMouseLeave:S,onTouchStart:b}=l,w=h.useRef(null);h.useEffect(()=>{if(a==="render"&&g(!0),a==="viewport"){let C=E=>{E.forEach(j=>{g(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(()=>{g(!0)},100);return()=>{clearTimeout(C)}}},[r]);let T=()=>{f(!0)},N=()=>{f(!1),g(!1)};return i?a!=="intent"?[d,w,{}]:[d,w,{onFocus:Ms(x,T),onBlur:Ms(p,N),onMouseEnter:Ms(y,T),onMouseLeave:Ms(S,N),onTouchStart:Ms(b,T)}]:[!1,w,{}]}function Ms(a,l){return i=>{a&&a(i),i.defaultPrevented||l(i)}}function kb({page:a,...l}){let{router:i}=U0(),r=h.useMemo(()=>q0(i.routes,a,i.basename),[i.routes,a,i.basename]);return r?h.createElement(Db,{page:a,matches:r,...l}):null}function _b(a){let{manifest:l,routeModules:i}=H0(),[r,f]=h.useState([]);return h.useEffect(()=>{let d=!1;return wb(a,l,i).then(g=>{d||f(g)}),()=>{d=!0}},[a,l,i]),r}function Db({page:a,matches:l,...i}){let r=Ta(),{manifest:f,routeModules:d}=H0(),{basename:g}=U0(),{loaderData:x,matches:p}=Tb(),y=h.useMemo(()=>Yp(a,l,p,f,r,"data"),[a,l,p,f,r]),S=h.useMemo(()=>Yp(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(E=>{let j=f.routes[E.route.id];!j||!j.hasLoader||(!y.some(k=>k.route.id===E.route.id)&&E.route.id in x&&d[E.route.id]?.shouldRevalidate||j.hasClientLoader?C=!0:N.add(E.route.id))}),N.size===0)return[];let A=Ab(a,g,"data");return C&&N.size>0&&A.searchParams.set("_routes",l.filter(E=>N.has(E.route.id)).map(E=>E.route.id).join(",")),[A.pathname+A.search]},[g,x,r,f,y,l,a,d]),w=h.useMemo(()=>Eb(S,f),[S,f]),T=_b(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})),T.map(({key:N,link:C})=>h.createElement("link",{key:N,nonce:i.nonce,...C})))}function Ob(...a){return l=>{a.forEach(i=>{typeof i=="function"?i(l):i!=null&&(i.current=l)})}}var V0=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{V0&&(window.__reactRouterVersion="7.9.6")}catch{}function Bb({basename:a,children:l,window:i}){let r=h.useRef();r.current==null&&(r.current=Av({window:i,v5Compat:!0}));let f=r.current,[d,g]=h.useState({action:f.action,location:f.location}),x=h.useCallback(p=>{h.startTransition(()=>g(p))},[g]);return h.useLayoutEffect(()=>f.listen(x),[f,x]),h.createElement(db,{basename:a,children:l,location:d.location,navigationType:d.action,navigator:f})}var Y0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,$0=h.forwardRef(function({onClick:l,discover:i="render",prefetch:r="none",relative:f,reloadDocument:d,replace:g,state:x,target:p,to:y,preventScrollReset:S,viewTransition:b,...w},T){let{basename:N}=h.useContext(an),C=typeof y=="string"&&Y0.test(y),A,E=!1;if(typeof y=="string"&&C&&(A=y,V0))try{let $=new URL(window.location.href),te=y.startsWith("//")?new URL($.protocol+y):new URL(y),Z=Tn(te.pathname,N);te.origin===$.origin&&Z!=null?y=Z+te.search+te.hash:E=!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=Jv(y,{relative:f}),[k,Q,X]=Rb(r,w),H=Hb(y,{replace:g,state:x,target:p,preventScrollReset:S,relative:f,viewTransition:b});function z($){l&&l($),$.defaultPrevented||H($)}let I=h.createElement("a",{...w,...X,href:A||j,onClick:E||d?l:z,ref:Ob(T,Q),target:p,"data-discover":!C&&i==="render"?"true":void 0});return k&&!C?h.createElement(h.Fragment,null,I,h.createElement(kb,{page:j})):I});$0.displayName="Link";var zb=h.forwardRef(function({"aria-current":l="page",caseSensitive:i=!1,className:r="",end:f=!1,style:d,to:g,viewTransition:x,children:p,...y},S){let b=Qs(g,{relative:y.relative}),w=Ta(),T=h.useContext(zr),{navigator:N,basename:C}=h.useContext(an),A=T!=null&&Qb(b)&&x===!0,E=N.encodeLocation?N.encodeLocation(b).pathname:b.pathname,j=w.pathname,k=T&&T.navigation&&T.navigation.location?T.navigation.location.pathname:null;i||(j=j.toLowerCase(),k=k?k.toLowerCase():null,E=E.toLowerCase()),k&&C&&(k=Tn(k,C)||k);const Q=E!=="/"&&E.endsWith("/")?E.length-1:E.length;let X=j===E||!f&&j.startsWith(E)&&j.charAt(Q)==="/",H=k!=null&&(k===E||!f&&k.startsWith(E)&&k.charAt(E.length)==="/"),z={isActive:X,isPending:H,isTransitioning:A},I=X?l:void 0,$;typeof r=="function"?$=r(z):$=[r,X?"active":null,H?"pending":null,A?"transitioning":null].filter(Boolean).join(" ");let te=typeof d=="function"?d(z):d;return h.createElement($0,{...y,"aria-current":I,className:$,ref:S,style:te,to:g,viewTransition:x},typeof p=="function"?p(z):p)});zb.displayName="NavLink";var Lb=h.forwardRef(({discover:a="render",fetcherKey:l,navigate:i,reloadDocument:r,replace:f,state:d,method:g=Sr,action:x,onSubmit:p,relative:y,preventScrollReset:S,viewTransition:b,...w},T)=>{let N=$b(),C=Gb(x,{relative:y}),A=g.toLowerCase()==="get"?"get":"post",E=typeof x=="string"&&Y0.test(x),j=k=>{if(p&&p(k),k.defaultPrevented)return;k.preventDefault();let Q=k.nativeEvent.submitter,X=Q?.getAttribute("formmethod")||g;N(Q||k.currentTarget,{fetcherKey:l,method:X,navigate:i,replace:f,state:d,relative:y,preventScrollReset:S,viewTransition:b})};return h.createElement("form",{ref:T,method:A,action:C,onSubmit:r?p:j,...w,"data-discover":!E&&a==="render"?"true":void 0})});Lb.displayName="Form";function Ub(a){return`${a} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function G0(a){let l=h.useContext(ql);return $e(l,Ub(a)),l}function Hb(a,{target:l,replace:i,state:r,preventScrollReset:f,relative:d,viewTransition:g}={}){let x=Iv(),p=Ta(),y=Qs(a,{relative:d});return h.useCallback(S=>{if(yb(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:g})}},[p,x,y,i,r,l,a,f,d,g])}var Vb=0,Yb=()=>`__${String(++Vb)}__`;function $b(){let{router:a}=G0("useSubmit"),{basename:l}=h.useContext(an),i=ob();return h.useCallback(async(r,f={})=>{let{action:d,method:g,encType:x,formData:p,body:y}=Sb(r,l);if(f.navigate===!1){let S=f.fetcherKey||Yb();await a.fetch(S,i,f.action||d,{preventScrollReset:f.preventScrollReset,formData:p,body:y,formMethod:f.method||g,formEncType:f.encType||x,flushSync:f.flushSync})}else await a.navigate(f.action||d,{preventScrollReset:f.preventScrollReset,formData:p,body:y,formMethod:f.method||g,formEncType:f.encType||x,replace:f.replace,state:f.state,fromRouteId:i,flushSync:f.flushSync,viewTransition:f.viewTransition})},[a,l,i])}function Gb(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})},g=Ta();if(a==null){d.search=g.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 Qb(a,{relative:l}={}){let i=h.useContext(D0);$e(i!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=G0("useViewTransitionState"),f=Qs(a,{relative:l});if(!i.isTransitioning)return!1;let d=Tn(i.currentLocation.pathname,r)||i.currentLocation.pathname,g=Tn(i.nextLocation.pathname,r)||i.nextLocation.pathname;return Tr(f.pathname,g)!=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 Ou={type:"error",data:"parser error"},Q0=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",X0=typeof ArrayBuffer=="function",K0=a=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(a):a&&a.buffer instanceof ArrayBuffer,tf=({type:a,data:l},i,r)=>Q0&&l instanceof Blob?i?r(l):$p(l,r):X0&&(l instanceof ArrayBuffer||K0(l))?i?r(l):$p(new Blob([l]),r):r(nn[a]+(l||"")),$p=(a,l)=>{const i=new FileReader;return i.onload=function(){const r=i.result.split(",")[1];l("b"+(r||""))},i.readAsDataURL(a)};function Gp(a){return a instanceof Uint8Array?a:a instanceof ArrayBuffer?new Uint8Array(a):new Uint8Array(a.buffer,a.byteOffset,a.byteLength)}let pu;function Xb(a,l){if(Q0&&a.data instanceof Blob)return a.data.arrayBuffer().then(Gp).then(l);if(X0&&(a.data instanceof ArrayBuffer||K0(a.data)))return l(Gp(a.data));tf(a,!1,i=>{pu||(pu=new TextEncoder),l(pu.encode(i))})}const Qp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Os=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let a=0;a<Qp.length;a++)Os[Qp.charCodeAt(a)]=a;const Kb=a=>{let l=a.length*.75,i=a.length,r,f=0,d,g,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)],g=Os[a.charCodeAt(r+1)],x=Os[a.charCodeAt(r+2)],p=Os[a.charCodeAt(r+3)],S[f++]=d<<2|g>>4,S[f++]=(g&15)<<4|x>>2,S[f++]=(x&3)<<6|p&63;return y},Zb=typeof ArrayBuffer=="function",nf=(a,l)=>{if(typeof a!="string")return{type:"message",data:Z0(a,l)};const i=a.charAt(0);return i==="b"?{type:"message",data:Fb(a.substring(1),l)}:jr[i]?a.length>1?{type:jr[i],data:a.substring(1)}:{type:jr[i]}:Ou},Fb=(a,l)=>{if(Zb){const i=Kb(a);return Z0(i,l)}else return{base64:!0,data:a}},Z0=(a,l)=>{switch(l){case"blob":return a instanceof Blob?a:new Blob([a]);case"arraybuffer":default:return a instanceof ArrayBuffer?a:a.buffer}},F0="",Jb=(a,l)=>{const i=a.length,r=new Array(i);let f=0;a.forEach((d,g)=>{tf(d,!1,x=>{r[g]=x,++f===i&&l(r.join(F0))})})},Ib=(a,l)=>{const i=a.split(F0),r=[];for(let f=0;f<i.length;f++){const d=nf(i[f],l);if(r.push(d),d.type==="error")break}return r};function Wb(){return new TransformStream({transform(a,l){Xb(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 gu;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 Pb(a,l){gu||(gu=new TextDecoder);const i=[];let r=0,f=-1,d=!1;return new TransformStream({transform(g,x){for(i.push(g);;){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(Ou);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(nf(d?p:gu.decode(p),l)),r=0}if(f===0||f>a){x.enqueue(Ou);break}}}})}const J0=4;function et(a){if(a)return e1(a)}function e1(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")(),t1="arraybuffer";function I0(a,...l){return l.reduce((i,r)=>(a.hasOwnProperty(r)&&(i[r]=a[r]),i),{})}const n1=Yt.setTimeout,a1=Yt.clearTimeout;function Hr(a,l){l.useNativeTimers?(a.setTimeoutFn=n1.bind(Yt),a.clearTimeoutFn=a1.bind(Yt)):(a.setTimeoutFn=Yt.setTimeout.bind(Yt),a.clearTimeoutFn=Yt.clearTimeout.bind(Yt))}const l1=1.33;function s1(a){return typeof a=="string"?i1(a):Math.ceil((a.byteLength||a.size)*l1)}function i1(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 W0(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function r1(a){let l="";for(let i in a)a.hasOwnProperty(i)&&(l.length&&(l+="&"),l+=encodeURIComponent(i)+"="+encodeURIComponent(a[i]));return l}function o1(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 c1 extends Error{constructor(l,i,r){super(l),this.description=i,this.context=r,this.type="TransportError"}}class af 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 c1(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=nf(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=r1(l);return i.length?"?"+i:""}}class u1 extends af{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)};Ib(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,Jb(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]=W0()),!this.supportsBinary&&!i.sid&&(i.b64=1),this.createUri(l,i)}}let P0=!1;try{P0=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const f1=P0;function d1(){}class h1 extends u1{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=I0(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=d1,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",Xp);else if(typeof addEventListener=="function"){const a="onpagehide"in Yt?"pagehide":"unload";addEventListener(a,Xp,!1)}}function Xp(){for(let a in tn.requests)tn.requests.hasOwnProperty(a)&&tn.requests[a].abort()}const m1=(function(){const a=eg({xdomain:!1});return a&&a.responseType!==null})();class p1 extends h1{constructor(l){super(l);const i=l&&l.forceBase64;this.supportsBinary=m1&&!i}request(l={}){return Object.assign(l,{xd:this.xd},this.opts),new tn(eg,this.uri(),l)}}function eg(a){const l=a.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!l||f1))return new XMLHttpRequest}catch{}if(!l)try{return new Yt[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const tg=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class g1 extends af{get name(){return"websocket"}doOpen(){const l=this.uri(),i=this.opts.protocols,r=tg?{}:I0(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(l,i,r)}catch(f){return this.emitReserved("error",f)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=l=>this.onClose({description:"websocket connection closed",context:l}),this.ws.onmessage=l=>this.onData(l.data),this.ws.onerror=l=>this.onError("websocket error",l)}write(l){this.writable=!1;for(let i=0;i<l.length;i++){const r=l[i],f=i===l.length-1;tf(r,this.supportsBinary,d=>{try{this.doWrite(r,d)}catch{}f&&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]=W0()),this.supportsBinary||(i.b64=1),this.createUri(l,i)}}const xu=Yt.WebSocket||Yt.MozWebSocket;class x1 extends g1{createSocket(l,i,r){return tg?new xu(l,i,r):i?new xu(l,i):new xu(l)}doWrite(l,i){this.ws.send(i)}}class y1 extends af{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=Pb(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=l.readable.pipeThrough(i).getReader(),f=Wb();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 g={type:"open"};this.query.sid&&(g.data=`{"sid":"${this.query.sid}"}`),this._writer.write(g).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 v1={websocket:x1,webtransport:y1,polling:p1},b1=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,S1=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Bu(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=b1.exec(a||""),d={},g=14;for(;g--;)d[S1[g]]=f[g]||"";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=A1(d,d.path),d.queryKey=j1(d,d.query),d}function A1(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 j1(a,l){const i={};return l.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,f,d){f&&(i[f]=d)}),i}const zu=typeof addEventListener=="function"&&typeof removeEventListener=="function",Nr=[];zu&&addEventListener("offline",()=>{Nr.forEach(a=>a())},!1);class aa extends et{constructor(l,i){if(super(),this.binaryType=t1,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=Bu(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=Bu(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=o1(this.opts.query)),zu&&(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=J0,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+=s1(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(),zu&&(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=J0;class N1 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 g=b=>{const w=new Error("probe error: "+b);w.transport=i.name,d(),this.emitReserved("upgradeError",w)};function x(){g("transport closed")}function p(){g("socket closed")}function y(b){i&&b.name!==i.name&&d()}const S=()=>{i.removeListener("open",f),i.removeListener("error",g),i.removeListener("close",x),this.off("close",p),this.off("upgrading",y)};i.once("open",f),i.once("error",g),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 w1=class extends N1{constructor(l,i={}){const r=typeof l=="object"?l:i;(!r.transports||r.transports&&typeof r.transports[0]=="string")&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(f=>v1[f]).filter(f=>!!f)),super(l,r)}};function E1(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=Bu(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 C1=typeof ArrayBuffer=="function",q1=a=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(a):a.buffer instanceof ArrayBuffer,ng=Object.prototype.toString,M1=typeof Blob=="function"||typeof Blob<"u"&&ng.call(Blob)==="[object BlobConstructor]",T1=typeof File=="function"||typeof File<"u"&&ng.call(File)==="[object FileConstructor]";function lf(a){return C1&&(a instanceof ArrayBuffer||q1(a))||M1&&a instanceof Blob||T1&&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(lf(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 R1(a){const l=[],i=a.data,r=a;return r.data=Lu(i,l),r.attachments=l.length,{packet:r,buffers:l}}function Lu(a,l){if(!a)return a;if(lf(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]=Lu(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]=Lu(a[r],l));return i}return a}function k1(a,l){return a.data=Uu(a.data,l),delete a.attachments,a}function Uu(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]=Uu(a[i],l);else if(typeof a=="object")for(const i in a)Object.prototype.hasOwnProperty.call(a,i)&&(a[i]=Uu(a[i],l));return a}const _1=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],D1=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 O1{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=R1(l),r=this.encodeAsString(i.packet),f=i.buffers;return f.unshift(r),f}}function Kp(a){return Object.prototype.toString.call(a)==="[object Object]"}class sf 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 B1(i),i.attachments===0&&super.emitReserved("decoded",i)):super.emitReserved("decoded",i)}else if(lf(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 g=l.substring(d,i);if(g!=Number(g)||l.charAt(i)!=="-")throw new Error("Illegal attachments");r.attachments=Number(g)}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 g=l.charAt(i);if(g==null||Number(g)!=g){--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(sf.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 Kp(i);case je.DISCONNECT:return i===void 0;case je.CONNECT_ERROR:return typeof i=="string"||Kp(i);case je.EVENT:case je.BINARY_EVENT:return Array.isArray(i)&&(typeof i[0]=="number"||typeof i[0]=="string"&&_1.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 B1{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=k1(this.reconPack,this.buffers);return this.finishedReconstruction(),i}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const z1=Object.freeze(Object.defineProperty({__proto__:null,Decoder:sf,Encoder:O1,get PacketType(){return je},protocol:D1},Symbol.toStringTag,{value:"Module"}));function Xt(a,l,i){return a.on(l,i),function(){a.off(l,i)}}const L1=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class ag 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(L1.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 g={type:je.EVENT,data:i};if(g.options={},g.options.compress=this.flags.compress!==!1,typeof i[i.length-1]=="function"){const S=this.ids++,b=i.pop();this._registerAckCallback(S,b),g.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(g),this.packet(g)):this.sendBuffer.push(g)),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),g=(...x)=>{this.io.clearTimeoutFn(d),i.apply(this,x)};g.withError=!0,this.acks[l]=g}emitWithAck(l,...i){return new Promise((r,f)=>{const d=(g,x)=>g?f(g):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 Hu 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||z1;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 w1(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()},g=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(g),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 ag(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=E1(a,l.path||"/socket.io"),r=i.source,f=i.id,d=i.path,g=Ts[f]&&d in Ts[f].nsps,x=l.forceNew||l["force new connection"]||l.multiplex===!1||g;let p;return x?p=new Hu(r,l):(Ts[f]||(Ts[f]=new Hu(r,l)),p=Ts[f]),i.query&&!l.query&&(l.query=i.queryKey),p.socket(i.path,l)}Object.assign(Er,{Manager:Hu,Socket:ag,io:Er,connect:Er});const lg="roverSettings",U1=3600*24*365;function H1(a){try{const l=decodeURIComponent(a??"");return JSON.parse(l)}catch(l){return console.warn("Failed to parse settings cookie",l),null}}function Vu(){if(typeof document>"u")return{};const a=`${lg}=`,l=document.cookie.split(";").map(r=>r.trim()).find(r=>r.startsWith(a));if(!l)return{};const i=l.substring(a.length);return H1(i)??{}}function Zp(a){if(typeof document>"u")return!1;try{const l=encodeURIComponent(JSON.stringify(a??{})),i=`${lg}=${l}; path=/; max-age=${U1}; samesite=strict`;return document.cookie=i,!0}catch(l){return console.warn("Failed to write settings cookie",l),!1}}const sg=window.location.origin;console.info("[socket] connecting to",sg);const V1=Vu(),Y1=V1?.page?.connectionTransport||"websocket",$1=Y1==="polling"?["polling"]:["websocket","polling"],rf=Er(sg,{transports:$1,timeout:15e3});rf.on("connect_error",a=>console.error("connect_error",a.code,a.message,a.data));const ig=h.createContext(rf),G1=({children:a})=>o.jsx(ig.Provider,{value:rf,children:a}),ln=()=>h.useContext(ig),rg=h.createContext({connected:!1,session:null,logs:[],adminLogs:[],login:async()=>{},setRole:async()=>{},requestControl:async()=>{},releaseControl:async()=>{},subscribeAll:async()=>{},homeAssistantToggle:async()=>{},homeAssistantSetState:async()=>{},setNickname:async()=>{},triggerReplay:async()=>{},setCommunityGoal:async()=>{}});function Q1(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 X1({children:a}){const l=ln(),i=Q1(l),[r,f]=h.useState(null),[d,g]=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(Q){f(Q)}function A(Q=[]){g(Q)}function E(Q){g(X=>[...X.slice(-199),Q])}function j(Q=[]){p(Q)}function k(Q){p(X=>[...X.slice(-199),Q])}return l.on("session:sync",C),l.on("log:init",A),l.on("log:entry",E),l.on("adminlog:init",j),l.on("adminlog:entry",k),l.on("alert:new",(Q={})=>{S(X=>[...X.slice(-49),{...Q,receivedAt:Date.now()}])}),()=>{l.off("session:sync",C),l.off("log:init",A),l.off("log:entry",E),l.off("adminlog:init",j),l.off("adminlog:entry",k),l.off("alert:new")}},[l]);const T=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}),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,...T}),[T,x,y,b,d,r]);return o.jsx(rg.Provider,{value:N,children:a})}function _e(){return h.useContext(rg)}const og=h.createContext({frames:{}});function K1({children:a}){const l=ln(),[i,r]=h.useState({});h.useEffect(()=>{function d({roverId:g,sensors:x={},frame:p={}}){g&&r(y=>({...y,[g]:{roverId:g,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(og.Provider,{value:f,children:a})}function of(){return h.useContext(og).frames}function Tl(a){const l=of();return a?l[a]??null:null}const Z1=650,F1={161:{red:!0},164:{green:!0},165:{force:!0},168:{red:!0,green:!0},169:{red:!0,force:!0},172:{green:!0,force:!0},173:{red:!0,green:!0,force:!0}};function yu(a){if(typeof a!="number"||a<=0)return null;const l=F1[a];return l?{code:a,...l}:null}function J1(a,l={}){const i=l.holdMs||Z1,[r,f]=h.useState({left:null,right:null,omni:null}),[d,g]=h.useState(0);return h.useEffect(()=>{const x=setInterval(()=>g(Date.now()),Math.max(i/2,100));return()=>clearInterval(x)},[i]),h.useEffect(()=>{const x=Date.now(),p=yu(a?.infraredCharacterLeft),y=yu(a?.infraredCharacterRight),S=yu(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 E=x-A.ts,j=E<=i;return{active:j,age:E,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,T=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:T,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 I1(){const{connected:a,session:l}=_e(),i=l?.assignment?.roverId,r=Tl(i),f=r?.sensors||{},d=J1(f),g=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(W1,{sensors:f,voltage:g,current:x,batteryTemp:p,charge:y,capacity:S}),o.jsx(P1,{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 W1({sensors:a,voltage:l,current:i,batteryTemp:r,charge:f,capacity:d}){const g=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:g}),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 P1({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}],g=[{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(eS,{sensors:a}),o.jsx(tS,{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:g.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 eS({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 tS({state:a}){if(!a)return null;const l=r=>{const f=[];return r?.red&&f.push("R"),r?.green&&f.push("G"),r?.force&&f.push("F"),f.length?f.join(""):"none"},i=r=>r?.age!=null?`${r.age}ms`:"--";return o.jsxs("div",{className:"text-[0.7rem] text-slate-400",children:[o.jsx("div",{children:`Left: ${a.left.code??"--"} (${l(a.left)}) · age ${i(a.left)}`}),o.jsx("div",{children:`Omni: ${a.omni.code??"--"} (${l(a.omni)}) · age ${i(a.omni)}`}),o.jsx("div",{children:`Right: ${a.right.code??"--"} (${l(a.right)}) · age ${i(a.right)}`})]})}const cg=h.createContext(null);function cf({children:a}){const[l,i]=h.useState(()=>({status:"loading",data:{}}));h.useEffect(()=>{const x=Vu();i({status:"ready",data:x??{}})},[]);const r=h.useCallback(()=>{const x=Vu();i({status:"ready",data:x??{}})},[]),f=h.useCallback(x=>{const p=Zp(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 Zp(w)?{status:"ready",data:w}:{...y,status:"error"}})},[]),g=h.useMemo(()=>({data:l.data,status:l.status,reload:r,saveAll:f,setNamespace:d}),[l,r,f,d]);return o.jsx(cg.Provider,{value:g,children:a})}function nS(){const a=h.useContext(cg);if(!a)throw new Error("useSettings must be used within SettingsProvider");return a}function dt(a,l={}){const{data:i,status:r,setNamespace:f}=nS(),d=i[a]??l??{},g=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:g,replace:x,reset:p}}function aS(a=[]){return a.map(l=>!l?.type||!l?.id?null:{type:l.type,id:String(l.id),label:l.label||String(l.id),key:`${l.type}:${l.id}`}).filter(Boolean)}function uf({panelId:a="replay-sources",fillHeight:l=!1}){const{session:i,triggerReplay:r}=_e(),f=aS(i?.replaySources||[]),{value:d,save:g}=dt("replaySources",{}),[x,p]=h.useState([]),[y,S]=h.useState(!1),[b,w]=h.useState(null),[T,N]=h.useState(null),C=i?.replay||null,[A,E]=h.useState(0),j=h.useMemo(()=>{const $=i?.assignment?.roverId;return $?[`rover:${$}`]:[]},[i?.assignment?.roverId]);h.useEffect(()=>{const $=d?.[a];if(Array.isArray($)&&$.length){p($);return}p(j)},[d?.[a],j,a]),h.useEffect(()=>{const $=new Set(f.map(te=>te.key));p(te=>te.filter(Z=>$.has(Z)))},[f]);const k=h.useMemo(()=>({rovers:f.filter($=>$.type==="rover"),rooms:f.filter($=>$.type==="room")}),[f]);h.useEffect(()=>{if(!C?.lastTriggeredAt||!C?.cooldownMs){E(0);return}const $=()=>{const Z=C.lastTriggeredAt+C.cooldownMs-Date.now();E(Math.max(0,Z))};$();const te=setInterval($,250);return()=>clearInterval(te)},[C?.lastTriggeredAt,C?.cooldownMs,C?.remainingMs]);const Q=y||i?.mode==="lockdown"||A>0||!x.length,X=$=>{p(te=>{const Z=te.includes($)?te.filter(W=>W!==$):[...te,$];return g(W=>({...W||{},[a]:Z})),Z}),N(null)},H=async()=>{if(!Q){S(!0),w(null),N(null);try{const $=x.map(te=>{const[Z,W]=te.split(":");return{type:Z,id:W}});await r($),N("Replay sent. Check the Discord replay channel.")}catch($){w($.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(Fp,{title:"Rovers",items:k.rovers,selected:x,onToggle:X}),o.jsx(Fp,{title:"Room Cams",items:k.rooms,selected:x,onToggle:X})]}),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:H,disabled:Q,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,T?o.jsx("div",{className:"text-xs text-emerald-300",children:T}):null]})]})}function Fp({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 ug={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Jp=Ma.createContext&&Ma.createContext(ug),lS=["attr","size","title"];function sS(a,l){if(a==null)return{};var i=iS(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 iS(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 Ip(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?Ip(Object(i),!0).forEach(function(r){rS(a,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(i)):Ip(Object(i)).forEach(function(r){Object.defineProperty(a,r,Object.getOwnPropertyDescriptor(i,r))})}return a}function rS(a,l,i){return l=oS(l),l in a?Object.defineProperty(a,l,{value:i,enumerable:!0,configurable:!0,writable:!0}):a[l]=i,a}function oS(a){var l=cS(a,"string");return typeof l=="symbol"?l:l+""}function cS(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 fg(a){return a&&a.map((l,i)=>Ma.createElement(l.tag,kr({key:i},l.attr),fg(l.child)))}function dg(a){return l=>Ma.createElement(uS,Rr({attr:kr({},a.attr)},l),fg(a.child))}function uS(a){var l=i=>{var{attr:r,size:f,title:d}=a,g=sS(a,lS),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,g,{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 Jp!==void 0?Ma.createElement(Jp.Consumer,null,i=>l(i)):l(ug)}function hg(a){return dg({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 fS(a){return dg({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 dS(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 hS(a){const l=new Date(a);return`${l.getHours().toString().padStart(2,"0")}:${l.getMinutes().toString().padStart(2,"0")}`}function Wp(a){return a.nickname||a.socketId?.slice(0,6)||"unknown"}function mS({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 mg({message:a}){const l=a.fromDiscord?`${a.discordGuildName||"Discord"} · ${Wp(a)}`:null;return o.jsxs(o.Fragment,{children:[a.fromDiscord?o.jsxs(o.Fragment,{children:[o.jsx(hg,{className:"h-3.5 w-3.5 text-indigo-200"}),o.jsx(mS,{guildIconUrl:a.discordGuildIconUrl,userAvatarUrl:a.discordUserAvatarUrl,label:l})]}):null,o.jsx("span",{className:`font-semibold text-[0.85rem] ${dS(a.role)}`,children:Wp(a)}),a.roverId&&o.jsx("span",{className:"rounded bg-slate-800 px-1 text-[0.7rem]",children:a.roverId})]})}function pg(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 gg({message:a}){return o.jsxs("div",{className:pg(a),children:[o.jsx(mg,{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:hS(a.ts)})]})}function xg({message:a}){return o.jsxs("div",{className:`${pg(a)} italic opacity-80 border-slate-600/40 bg-slate-900/40`,children:[o.jsx(mg,{message:a}),o.jsx("span",{className:"text-slate-300",children:"typing..."})]})}const pS=3e3,gS="#2196f3";function xS(a){return a.id?a.id:a.timestamp?`${a.timestamp}-${a.message}`:`${a.title||"alert"}-${a.message}`}function ff({scale:a=1}){const{alerts:l}=_e(),[i,r]=h.useState(()=>Date.now()),f=h.useMemo(()=>l.slice(-3).map(p=>({alert:p,key:xS(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<=pS);if(!d.length)return null;const g=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:g,children:d.map(p=>o.jsx(yS,{alert:p.alert},p.key))})}function Pp(a){const l=typeof a=="string"?a.trim():"",i=/^#?([0-9a-fA-F]{6})$/.exec(l);if(!i)return null;const r=i[1];return{r:parseInt(r.slice(0,2),16),g:parseInt(r.slice(2,4),16),b:parseInt(r.slice(4,6),16)}}function yS({alert:a}){if(a.kind==="chat"&&a.payload)return o.jsx(gg,{message:a.payload});if(a.kind==="chat-typing"&&a.payload)return o.jsx(xg,{message:a.payload});const l=Pp(a.color)||Pp(gS),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]},vu={maxSpeed:500,baseSpeed:250,boostSpeed:400},Yu=100,df=[31,127],Nl=60,$u=8,vS=250,bS={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"]},yg=[{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:Yu},{type:"oi",command:"dock"},{type:"pause",duration:Yu},{type:"oi",command:"full"}]},{id:"seek-dock",label:"Dock",description:"Send the seek dock command.",steps:[{type:"oi",command:"dock"}]}];function Gu(){return{vector:{x:0,y:0,boost:!1},speeds:{left:0,right:0},source:null,lastUpdatedAt:0}}function Qu(){return{main:0,side:0,vacuum:0}}function SS(){return{enabled:!1,angle:null,config:null}}function Cr(){return{note:Nl}}const e0={roverId:null,mode:"drive",drive:Gu(),aux:Qu(),camera:SS(),song:Cr(),lastControlIntentAt:0,macros:yg,keymap:Bs,inputs:{}};function AS(a,l){switch(l.type){case"control/set-rover":return{...a,roverId:l.payload??null,drive:l.payload?a.drive:Gu(),aux:l.payload?a.aux:Qu(),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:Gu(),aux:Qu(),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 jS(a={}){const l=El(a.x??0),i=El(a.y??0);return{x:l,y:i,boost:!!a.boost}}function NS(a={},l={}){const i=jS(a),r=typeof l.maxSpeed=="number"?l.maxSpeed:vu.maxSpeed,f=typeof l.baseSpeed=="number"?l.baseSpeed:vu.baseSpeed,d=typeof l.boostSpeed=="number"?l.boostSpeed:vu.boostSpeed,g=i.boost?d:f,x=i.y*g,p=i.x*g;return{vector:i,speeds:{left:wl(Math.round(x+p),-r,r),right:wl(Math.round(x-p),-r,r)}}}function wS(a){const l=Array.isArray(a)?a:[],i=String.fromCharCode(...l);if(typeof btoa=="function")return btoa(i);if(typeof Buffer<"u")return Buffer.from(l).toString("base64");throw new Error("No base64 encoder available")}function t0(a){return new Promise(l=>setTimeout(l,a))}function ES(a={}){const{driveTransform:l,auxTransform:i}=a,r=ln(),{session:f}=_e(),d=f?.assignment?.roverId,g=h.useMemo(()=>!d||!Array.isArray(f?.roster)?null:f.roster.find(j=>String(j.id)===String(d))||null,[d,f?.roster]),x=h.useMemo(()=>!g?.cameraServo||!g.cameraServo.enabled?null:g.cameraServo,[g]),p=h.useMemo(()=>!g?.nightVision||!g.nightVision.enabled?null:g.nightVision,[g]),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])},Q=l?l(k):k,X={left:Vt(Q?.left??0,[-500,500]),right:Vt(Q?.right??0,[-500,500])};return y({type:"drive",data:{driveDirect:X}}),X},[l,y,d]),w=h.useCallback(({main:j=0,side:k=0,vacuum:Q=0}={})=>{if(!d)return null;const X={main:Vt(j,bl.main),side:Vt(k,bl.side),vacuum:Vt(Q,bl.vacuum)},H=i?i(X):X,z={main:Vt(H?.main??0,bl.main),side:Vt(H?.side??0,bl.side),vacuum:Vt(H?.vacuum??0,bl.vacuum)};return y({type:"motors",data:{motorPwm:z}}),z},[i,y,d]),T=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"?bS[j]:null;return k?(y({type:"raw",data:{raw:wS(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":T(k.angle);break;case"pause":await t0(k.duration??Yu);break}if(k.delay||k.delayMs){const Q=k.delayMs??k.delay;typeof Q=="number"&&Q>0&&await t0(Q)}}},[d,N,b,w,T]),A=h.useCallback((j="toggle")=>!d||!p?null:(y({type:"nightVision",data:{nightVision:{action:j}}}),j),[y,p,d]),E=h.useCallback((j=[],k={})=>{if(!d)return null;const X=(Array.isArray(j)&&j.length>0?j:[{note:Nl,duration:$u}]).slice(0,16).map(H=>({note:Vt(Math.round(H?.note??Nl),df),duration:Vt(Math.round(H?.duration??$u),[1,255])}));return y({type:"song",data:{song:{notes:X,slot:k.slot,loop:k.loop}}}),X},[y,d]);return h.useMemo(()=>({roverId:d,rosterEntry:g,servoConfig:x,nightVision:p,emitCommand:y,enableSensorStream:S,sendDriveDirect:b,sendAuxMotors:w,sendServoAngle:T,sendOiCommand:N,sendNightVision:A,sendSong:E,runMacroSteps:C}),[d,g,x,p,y,S,b,w,T,N,A,C])}const CS={"{":"[","}":"]",":":";",'"':"'","<":",",">":".","?":"/","|":"\\",_:"-","+":"="},n0={"[":"BracketLeft","]":"BracketRight","\\":"Backslash",";":"Semicolon","'":"Quote",",":"Comma",".":"Period","/":"Slash","-":"Minus","=":"Equal","`":"Backquote"};function Xs(a){if(typeof a!="string")return"";const l=a.toLowerCase();return CS[l]??l}function qS(a){const l=Xs(a);if(!l)return null;if(n0[l])return n0[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 vg(a){const l=Xs(a);return l?`key:${l}`:null}function MS(a){const l=qS(a);return l?`code:${l}`:null}function a0(a){const l=new Set,i=vg(a?.key??"");i&&l.add(i);const r=a?.code?`code:${a.code}`:null;return r&&l.add(r),Array.from(l)}function TS(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 g=vg(String(d));g&&f.add(g);const x=MS(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"]}],RS={downRatePerSec:.15,upRatePerSec:.7,releaseDelaySec:1,outputRateMs:250};function l0(){return Al.reduce((a,l)=>(a[l.key]={cap:1,clearSec:0},a),{})}function s0(a){return Number.isFinite(a)?Math.max(0,Math.min(1,a)):0}function kS(a,l={}){const{session:i}=_e(),d=(Tl(a)?.sensors||{})?.wheelOvercurrents||{},g=h.useMemo(()=>({...RS,...l.config||{}}),[l.config]),[x,p]=h.useState(()=>l0()),y=h.useRef(typeof performance<"u"?performance.now():Date.now()),S=h.useRef(d);h.useEffect(()=>{S.current=d||{}},[d]),h.useEffect(()=>{p(l0())},[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 E=A/1e3;E<=0||p(j=>{let k=!1;const Q={},X=Number.isFinite(g.downRatePerSec)?Math.max(0,g.downRatePerSec):0,H=Number.isFinite(g.upRatePerSec)?Math.max(0,g.upRatePerSec):0,z=Number.isFinite(g.releaseDelaySec)?Math.max(0,g.releaseDelaySec):0;return Al.forEach(I=>{const $=j[I.key]||{cap:1,clearSec:0},te=Number.isFinite($.cap)?$.cap:1,Z=Number.isFinite($.clearSec)?$.clearSec:0,W=I.motors.some(O=>!!S.current?.[O]),ie=W?0:Z+E,oe=!W&&ie>=z,se=s0(W?te-X*E:oe?te+H*E:te);(Math.abs(se-te)>1e-4||Math.abs(ie-Z)>1e-4)&&(k=!0),Q[I.key]={cap:se,clearSec:ie}}),k?Q:j})},100);return()=>clearInterval(N)},[g.downRatePerSec,g.releaseDelaySec,g.upRatePerSec]);const b=h.useMemo(()=>{const N=Al.reduce((C,A)=>{const E=x?.[A.key],j=Number.isFinite(E?.cap)?E.cap:1;return C[A.key]=s0(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(E=>{N[E]=!!d?.[E]})});const C=Al.reduce((A,E)=>(A[E.key]=E.motors.some(j=>!!d?.[j]),A),{});return{motors:N,groups:C}},[d]),T=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:g,adminImmune:T}),[x,w,b,g,T])}function _S(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 DS(a={},l,i=!1){if(i||!l?.aux)return a;const r=typeof l.aux.main=="number"?l.aux.main:1,f=typeof l.aux.side=="number"?l.aux.side:1,d=typeof l.aux.vacuum=="number"?l.aux.vacuum:1;return r>=.999&&f>=.999&&d>=.999?a:{main:Math.round((a.main??0)*r),side:Math.round((a.side??0)*f),vacuum:Math.round((a.vacuum??0)*d)}}const bg=h.createContext(null);function i0(a){return Object.fromEntries(Object.entries(a||{}).map(([l,i])=>[l,Array.isArray(i)?[...i]:[]]))}function OS(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 BS({children:a}){const[l,i]=h.useReducer(AS,e0),r=h.useRef(null),f=h.useRef(!1),d=h.useRef(e0.camera.angle),{value:g,save:x}=dt("controls",{keymap:Bs,macros:yg}),{session:p,homeAssistantSetState:y}=_e(),S=p?.assignment?.roverId??null,b=kS(S),w=h.useCallback(_=>_S(_,b.scales,b.adminImmune),[b.adminImmune,b.scales]),T=h.useCallback(_=>DS(_,b.scales,b.adminImmune),[b.adminImmune,b.scales]),N=ES({driveTransform:w,auxTransform:T}),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,...g?.keymap||{}};i({type:"control/set-keymap",payload:_}),g?.macros&&i({type:"control/set-macros",payload:g.macros})},[g?.keymap,g?.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,ce=typeof d.current=="number"?wl(d.current,V,ee):null,we=ce??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:_})},[]),E=h.useCallback(()=>{i({type:"control/record-intent"})},[]),j=h.useRef(l.drive.speeds),k=h.useRef(l.aux),Q=h.useMemo(()=>JSON.stringify(b.scales),[b.scales]),X=h.useRef(0),H=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},ce=!!(ee.left||ee.right),we=!!(ne.main||ne.side||ne.vacuum);!ce&&!we||(ce&&V-X.current>=_&&(X.current=V,N.sendDriveDirect(ee)),we&&V-H.current>=_&&(H.current=V,N.sendAuxMotors(ne)))},[Q,b.adminImmune,b.config,b.isActive,N]);const z=h.useCallback((_,V={})=>{const ee=NS(_,V.speedOptions);i({type:"control/update-drive",payload:{...ee,source:V.source??null}}),E(),N.sendDriveDirect(ee.speeds)},[N,E]),I=h.useCallback((_={})=>{const V=N.sendAuxMotors(_)??_;i({type:"control/set-aux-motors",payload:V}),E()},[N,E]),$=h.useCallback((_,V)=>{if(!_)return!1;const ee=Xs(V);if(!ee)return!1;const ne=i0(l.keymap);return ne[_]=[ee],i({type:"control/set-keymap",payload:ne}),x(ce=>({...ce??{},keymap:ne})),!0},[l.keymap,x]),te=h.useCallback(()=>{const _=i0(Bs);i({type:"control/set-keymap",payload:_}),x(V=>({...V??{},keymap:_}))},[x]),Z=h.useCallback(_=>{if(!N.servoConfig)return;const V=OS(N.servoConfig,_);i({type:"control/set-camera-angle",payload:V}),N.sendServoAngle(V),d.current=V,E()},[N,E]),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]),ie=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]),oe=h.useCallback(async _=>{const V=l.macros.find(ee=>ee.id===_)||null;V&&(_==="drive-sequence"?(C(),p?.homeAssistant?.entities||(f.current=!0),E()):_==="seek-dock"&&E(),await N.runMacroSteps(V))},[N,E,p?.homeAssistant?.entities,l.macros,C]),se=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]),O=h.useCallback(_=>{N.sendOiCommand(_)},[N]),P=h.useCallback(_=>{N.roverId&&N.emitCommand({type:"sensorStream",data:{sensorStream:{enable:_}}})},[N]),le=h.useCallback(()=>{N.sendNightVision("toggle"),E()},[N,E]),fe=h.useCallback(_=>{const V=typeof _=="number"?_:Nl;return i({type:"control/set-song-note",payload:V}),V},[]),ae=h.useCallback((_,V)=>N.sendSong(_,V),[N]),q=h.useCallback((_,V)=>{i({type:"control/register-input-state",payload:{source:_,state:V}})},[]),B=h.useMemo(()=>({state:l,dispatch:i,pipeline:N,overcurrentLimiter:b,actions:{setMode:A,setDriveVector:z,setAuxMotors:I,setServoAngle:Z,nudgeServo:W,goServoHome:ie,runMacro:oe,stopAllMotion:se,sendOiCommand:O,setSensorStream:P,toggleNightVision:le,updateKeyBinding:$,resetKeyBindings:te,registerInputState:q,setSongNote:fe,sendSong:ae}}),[l,N,b,A,z,I,Z,W,ie,oe,se,O,P,le,$,te,q,fe,ae]);return o.jsx(bg.Provider,{value:B,children:a})}function ht(){const a=h.useContext(bg);if(!a)throw new Error("useControlSystem must be used within ControlSystemProvider");return a}const zS="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=",Sg=h.createContext({messages:[],typing:[],sendMessage:async()=>{},focusChat:()=>{},blurChat:()=>{},registerInputRef:()=>{},onInputFocus:()=>{},onInputBlur:()=>{},setTypingActive:()=>{},isChatFocused:!1});function LS({children:a}){const l=ln(),{session:i,pushAlert:r}=_e(),[f,d]=h.useState([]),[g,x]=h.useState([]),[p,y]=h.useState(!1),S=h.useRef(null),b=h.useRef(null),w=h.useRef(null),T=h.useRef(new Map),N=h.useRef(new Map),C=h.useRef({isTyping:!1,lastSent:0}),A=h.useCallback(()=>{const Z=Array.from(T.current.values()).sort((W,ie)=>W.lastUpdate-ie.lastUpdate).map(W=>W.payload);x(Z)},[]),E=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(zS),w.current.load()},[]);const j=h.useCallback(()=>{const Z=w.current;Z&&(Z.currentTime=0,Z.play().catch(()=>{}))},[]);h.useEffect(()=>{function Z(W={}){d(ie=>[...ie.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 ie=E(W);if(!ie)return;const oe=Date.now();if(W?.socketId&&i?.socketId&&W.socketId===i.socketId){W.isTyping||(T.current.delete(ie),A());return}if(W.isTyping){T.current.set(ie,{payload:W,expiresAt:oe+6e3,lastUpdate:oe});const se=N.current.get(ie)||0;oe-se>=2500&&(N.current.set(ie,oe),r?.({kind:"chat-typing",payload:W,id:`chat-typing-${ie}-${W.id||Math.random().toString(36).slice(2)}`,receivedAt:oe}))}else T.current.delete(ie);A()}return l.on("chat:typing",Z),()=>{l.off("chat:typing",Z)}},[r,A,E,i?.socketId,l]),h.useEffect(()=>{const Z=setInterval(()=>{const W=Date.now();let ie=!1;T.current.forEach((oe,se)=>{oe.expiresAt<=W&&(T.current.delete(se),ie=!0)}),ie&&A()},2e3);return()=>clearInterval(Z)},[A]),h.useEffect(()=>{function Z(W=[]){Array.isArray(W)&&d(ie=>{if(ie.length===0)return W.slice(-100);const oe=new Set(W.map(O=>O?.id));return[...W,...ie.filter(O=>O?.id&&!oe.has(O.id))].slice(-100)})}return l.on("chat:init",Z),()=>{l.off("chat:init",Z)}},[l]);const k=h.useCallback(Z=>{const W=!!Z,ie=Date.now(),oe=C.current,se=!W&&oe.isTyping;!(W&&(!oe.isTyping||ie-oe.lastSent>=3500))&&!se||(C.current={isTyping:W,lastSent:ie},l.emit("chat:typing",{isTyping:W}))},[l]),Q=h.useCallback((Z,W=null)=>new Promise((ie,oe)=>{l.emit("chat:send",{text:Z,tts:W},(se={})=>{se.error?oe(new Error(se.error)):ie(se)})}),[l]),X=h.useCallback((Z,W={})=>{(W?.target==="hud"?"hud":"panel")==="hud"?b.current=Z:S.current=Z},[]),H=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),[]),$=h.useCallback(()=>y(!1),[]),te=h.useMemo(()=>({messages:f,sendMessage:Q,focusChat:H,blurChat:z,registerInputRef:X,onInputFocus:I,onInputBlur:$,setTypingActive:k,typing:g,isChatFocused:p,selfSocketId:i?.socketId||null}),[z,H,p,f,$,I,X,Q,i?.socketId,k,g]);return o.jsx(Sg.Provider,{value:te,children:a})}function hf(){const a=h.useContext(Sg);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}},bu="keyboard",Su={x:0,y:0,boost:!1},Au={main:0,side:0,vacuum:0},r0=df[0],o0=df[1],mf=5,Us=500,Hs=1,pf=100;function ju(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(0,Math.min(500,i)):l}function US(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(mf,Math.min(Us,i)):l}function Ag(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(Hs,Math.min(pf,i)):l}function HS(a){const i=(Ag(a,a)-Hs)/(pf-Hs),r=Us-i*(Us-mf);return Math.round(r)}function VS(a){const l=US(a,a),i=(Us-l)/(Us-mf),r=Hs+i*(pf-Hs);return Math.round(r)}function YS(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 $S(a,l){const i=Pe(l.driveForward,a),r=Pe(l.driveBackward,a),f=Pe(l.driveLeft,a),d=Pe(l.driveRight,a),g=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:g&&!x}}function GS(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 QS(){const{state:a,actions:{setMode:l,setDriveVector:i,setAuxMotors:r,nudgeServo:f,runMacro:d,stopAllMotion:g,registerInputState:x,toggleNightVision:p,setSongNote:y,sendSong:S}}=ht(),{session:b,homeAssistantSetState:w}=_e(),{focusChat:T,blurChat:N,isChatFocused:C}=hf(),{value:A}=dt("inputs",en),E=h.useMemo(()=>TS(a.keymap),[a.keymap]),j=h.useMemo(()=>{const B=new Set;return Object.values(E).forEach(_=>{_&&_.forEach(V=>B.add(V))}),B},[E]),k=h.useMemo(()=>{const B=en.keyboard,_=A?.keyboard??{};return{baseSpeed:ju(_.baseSpeed,B.baseSpeed),turboSpeed:ju(_.turboSpeed,B.turboSpeed),precisionSpeed:ju(_.precisionSpeed,B.precisionSpeed)}},[A?.keyboard]),Q=h.useMemo(()=>{const B=en.keyboard,_=A?.keyboard??{},V=Ag(typeof _.tiltSpeed=="number"?_.tiltSpeed:typeof _.tiltIntervalMs=="number"?VS(_.tiltIntervalMs):B.tiltSpeed,B.tiltSpeed);return HS(V)},[A?.keyboard]),X=h.useMemo(()=>Math.abs(a.camera?.config?.nudgeDegrees||1),[a.camera?.config?.nudgeDegrees]),H=h.useRef(new Set),z=h.useRef(Su),I=h.useRef(Au),$=h.useRef(null),te=h.useRef(null),Z=h.useCallback(()=>{const B=new Set(H.current);Pe(E.boostModifier,B);const V=Pe(E.slowModifier,B)?{baseSpeed:k.precisionSpeed,boostSpeed:k.precisionSpeed}:{baseSpeed:k.baseSpeed,boostSpeed:k.turboSpeed},ee=$S(B,E),ne=GS(B,E);(ee.x!==z.current.x||ee.y!==z.current.y||ee.boost!==z.current.boost)&&(z.current=ee,i(ee,{source:bu,speedOptions:V})),(ne.main!==I.current.main||ne.side!==I.current.side||ne.vacuum!==I.current.vacuum)&&(I.current=ne,r(ne)),x(bu,{keys:Array.from(B),vector:ee,aux:ne})},[E,k,x,r,i]),W=h.useCallback(()=>{$.current&&(clearTimeout($.current),$.current=null)},[]),ie=h.useCallback(()=>{const B=new Set(H.current),_=Pe(E.cameraUp,B),V=Pe(E.cameraDown,B);return(_?1:0)-(V?1:0)},[E]),oe=h.useCallback(()=>{if(ie()===0){W();return}if($.current)return;const _=()=>{const V=ie();if(V===0){W();return}f(V*X),$.current=setTimeout(_,Q)};$.current=setTimeout(_,0)},[ie,f,Q,X,W]),se=h.useCallback(()=>{te.current&&(clearTimeout(te.current),te.current=null)},[]),O=h.useCallback(()=>{const B=new Set(H.current),_=Pe(E.songNoteUp,B),V=Pe(E.songNoteDown,B);return(_?1:0)-(V?1:0)},[E]),P=h.useCallback(B=>{if(B===0)return;let V=(typeof a.song?.note=="number"?a.song.note:Nl)+B;V>o0?V=r0:V<r0&&(V=o0);const ee=y(V);S([{note:ee,duration:$u}],{slot:0})},[S,y,a.song?.note]),le=h.useCallback(()=>{if(O()===0){se();return}if(te.current)return;const _=()=>{const V=O();if(V===0){se();return}P(V),te.current=setTimeout(_,vS)};te.current=setTimeout(_,0)},[O,se,P]),fe=h.useCallback(()=>{H.current.clear(),z.current=Su,I.current=Au,W(),se(),g(),x(bu,{keys:[],vector:Su,aux:Au})},[x,g,W,se]),ae=h.useCallback(B=>{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(B==="on"){const ne=ee.find(ce=>ce.state!=="on");ne&&w(ne.id,"on").catch(()=>{});return}if(B==="off")for(let ne=ee.length-1;ne>=0;ne-=1){const ce=ee[ne];if(ce.state==="on"){w(ce.id,"off").catch(()=>{});break}}}},[w,b?.homeAssistant]);h.useEffect(()=>{function B(ee){if(YS(ee))return;const ne=a0(ee);if(ne.length===0)return;const ce=new Set(ne);if(Pe(E.chatFocus,ce)){ee.preventDefault(),fe(),C||T();return}ne.some(xe=>j.has(xe))&&ee.preventDefault();const we=ne.filter(xe=>!H.current.has(xe));we.forEach(xe=>H.current.add(xe)),we.length>0&&(we.some(xe=>E.driveMacro?.has(xe))?(l("drive"),d("drive-sequence")):we.some(xe=>E.dockMacro?.has(xe))?(l("dock"),d("seek-dock")):we.some(xe=>E.nightVisionToggle?.has(xe))?p():we.some(xe=>E.homeAssistantOn?.has(xe))?ae("on"):we.some(xe=>E.homeAssistantOff?.has(xe))&&ae("off")),oe(),le(),Z()}function _(ee){a0(ee).forEach(ce=>H.current.delete(ce)),oe(),le(),Z()}function V(){fe()}return window.addEventListener("keydown",B),window.addEventListener("keyup",_),window.addEventListener("blur",V),()=>{window.removeEventListener("keydown",B),window.removeEventListener("keyup",_),window.removeEventListener("blur",V)}},[j,N,Z,oe,le,T,C,E.chatFocus,E.dockMacro,E.driveMacro,fe,d,l,g,se,ae]);const q=h.useRef(fe);return h.useEffect(()=>{q.current=fe},[fe]),h.useEffect(()=>{q.current()},[a.roverId]),h.useEffect(()=>()=>{W(),se()},[W,se]),null}const XS=1.6;function jg(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 KS(a){return JSON.parse(JSON.stringify(a??{}))}function Ng(a,l){const i=KS(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,XS):a}function Nu(a,l){const i=Math.abs(a);if(i<=l)return 0;const r=(i-l)/(1-l);return Math.sign(a)*r}function ZS(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 Xu(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 wu(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=Xu(a,i.index);if(!r)continue;return{value:qa(r.value),source:i}}}return{value:0,source:null}}function FS(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,g=i.invertY?-f:f;return{x:d,y:g,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=Xu(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=Xu(a,i.index);if(!r)continue;return{pressed:r.value>.5,source:i}}}return{pressed:!1,source:null}}function wg(a,l){const i=l?.bindings??{},r=l?.calibration??{},f=i.drive??{},d=FS(a,f.sources);let g=qa(d.x),x=qa(d.y);const p=Math.min(Math.max(r.driveDeadzone??.18,0),.8),y=ZS(g,x,p);g=_s(y.x,r.driveCurve),x=_s(y.y,r.driveCurve);const S=i.cameraTilt??{},b=wu(a,S.sources),w=Math.min(Math.max(r.cameraDeadzone??.08,0),.8);let T=Nu(qa(b.value),w);T=_s(T,r.cameraCurve);const N=Math.min(Math.max(r.auxDeadzone??.05,0),.6),C=i.mainBrush??{},A=wu(a,C.sources);let E=Nu(qa(A.value),N);E=_s(E,r.auxCurve);const j=i.sideBrush??{},k=wu(a,j.sources);let Q=Nu(qa(k.value),N);Q=_s(Q,r.auxCurve);const X=Ca(a,i.vacuum?.sources),H=Ca(a,i.allAux?.sources),z=Ca(a,i.mainReverse?.sources),I=Ca(a,i.sideReverse?.sources),$=Ca(a,i.driveMacro?.sources),te=Ca(a,i.dockMacro?.sources),Z=Ca(a,i.nightVisionToggle?.sources);return{driveVector:{x:g,y:x,boost:!1},cameraAxis:T,auxAxis:{main:E,side:Q},buttons:{vacuum:X.pressed,allAux:H.pressed,mainReverse:z.pressed,sideReverse:I.pressed,driveMacro:$.pressed,dockMacro:te.pressed,nightVisionToggle:Z.pressed},sources:{drive:d.source,cameraTilt:b.source,mainBrush:A.source,sideBrush:k.source,vacuum:X.source,allAux:H.source,mainReverse:z.source,sideReverse:I.source,driveMacro:$.source,dockMacro:te.source,nightVisionToggle:Z.source}}}const qr=new Set;let jl=null,Dr={pads:[],timestamp:0};function JS(){if(typeof navigator>"u"||!navigator.getGamepads)return[];const a=navigator.getGamepads();return a?Array.from(a).filter(Boolean):[]}function IS(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:jg(a)}}function WS(){Dr={pads:JS().map(IS),timestamp:typeof performance<"u"?performance.now():Date.now()},qr.forEach(l=>l(Dr))}function Eg(){WS(),jl=requestAnimationFrame(Eg)}function PS(){jl||(jl=requestAnimationFrame(Eg))}function eA(){jl&&(cancelAnimationFrame(jl),jl=null)}function Cg(a){return qr.add(a),PS(),a(Dr),()=>{qr.delete(a),qr.size===0&&eA()}}function tA(){const[a,l]=h.useState(Dr);return h.useEffect(()=>Cg(l),[]),a}const pr="gamepad",gr={x:0,y:0,boost:!1},xr={main:0,side:0,vacuum:0};function c0(a,l){return a&&l&&a.x===l.x&&a.y===l.y&&a.boost===l.boost}function u0(a,l){return a&&l&&a.main===l.main&&a.side===l.side&&a.vacuum===l.vacuum}function nA(a,l){if(!a||a.length===0)return null;if(l){const i=a.find(r=>r.signature===l);if(i)return i}return a[0]}function aA(){const{state:a,actions:{setMode:l,setDriveVector:i,setAuxMotors:r,setServoAngle:f,runMacro:d,toggleNightVision:g,registerInputState:x}}=ht(),{value:p,save:y}=dt("gamepad",na),S=h.useRef(new Set),b=h.useRef(gr),w=h.useRef(xr),T=h.useRef({main:!1,side:!1}),N=h.useRef(new Map),C=h.useRef(0),A=h.useRef(null),E=h.useCallback(X=>{const H=X.signature??jg(X);p?.profiles?.[H]||S.current.has(H)||(S.current.add(H),y(z=>{const I=z??na;if(I.profiles?.[H])return I;const $=I?.defaults?.profile??qn,te=Ng(X,$);return{...I,profiles:{...I.profiles??{},[H]:te}}}))},[p?.profiles,y]),j=h.useCallback((X,H)=>{const z=N.current.get(X)||!1;return N.current.set(X,H),H&&!z},[]),k=h.useCallback((X,H)=>{const z=a.camera?.config;if(!z)return;const I=typeof performance<"u"?performance.now():Date.now(),$=H?.cameraMode??"absolute",te=Math.max(1,Math.min(180,H?.cameraSensitivity??60));if($==="velocity"){const se=Math.min(50,I-C.current||16),O=X*te*(se/1e3);if(Math.abs(O)<.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)+O;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,ie=typeof z.homeAngle=="number"?z.homeAngle:(Z+W)/2,oe=X<0?ie+X*(ie-Z):ie+X*(W-ie);typeof A.current=="number"&&Math.abs(A.current-oe)<.35&&I-C.current<80||(C.current=I,A.current=oe,f(oe))},[f,a.camera?.angle,a.camera?.config]),Q=h.useMemo(()=>p?.activeSignature??null,[p?.activeSignature]);return h.useEffect(()=>Cg(X=>{const H=nA(X.pads,Q);if(!H){c0(b.current,gr)||(b.current=gr,i(gr,{source:pr})),u0(w.current,xr)||(w.current=xr,r(xr)),N.current=new Map,T.current={main:!1,side:!1},x(pr,{connected:!1});return}E(H);const z=H.signature,I=p?.profiles?.[z]??p?.defaults?.profile??qn,$=wg(H,I);c0($.driveVector,b.current)||(b.current=$.driveVector,i($.driveVector,{source:pr}));const te=I.calibration?.auxSideScale??.55,Z=Math.round(Math.min(Math.abs($.auxAxis.main),1)*127),W=Math.round(Math.min(Math.abs($.auxAxis.side),1)*127),ie=T.current.main?-Z:Z,oe=T.current.side?-Math.round(W*te):Math.round(W*te);let se={main:$.auxAxis.main!==0?ie:0,side:$.auxAxis.side!==0?oe:0,vacuum:$.buttons.vacuum?127:0};$.buttons.allAux&&(se={main:127,side:127,vacuum:127}),u0(se,w.current)||(w.current=se,r(se)),$.buttons.mainReverse&&j("mainReverse",!0)?T.current.main=!T.current.main:$.buttons.mainReverse||j("mainReverse",!1),$.buttons.sideReverse&&j("sideReverse",!0)?T.current.side=!T.current.side:$.buttons.sideReverse||j("sideReverse",!1),$.buttons.driveMacro&&j("driveMacro",!0)?(l("drive"),d("drive-sequence")):$.buttons.driveMacro||j("driveMacro",!1),$.buttons.dockMacro&&j("dockMacro",!0)?(l("dock"),d("seek-dock")):$.buttons.dockMacro||j("dockMacro",!1),$.buttons.nightVisionToggle&&j("nightVisionToggle",!0)?g():$.buttons.nightVisionToggle||j("nightVisionToggle",!1),Math.abs($.cameraAxis)>.001&&k($.cameraAxis,I.calibration),x(pr,{connected:!0,signature:z,id:H.id,index:H.index,axes:H.axes,buttons:H.buttons,drive:$.driveVector,aux:se,cameraAxis:$.cameraAxis,bindings:$.sources})}),[Q,E,p?.defaults?.profile,p?.profiles,j,k,x,d,r,i,l,g]),null}function qg(a){const l=a?.sensors||{},i=l.oiMode?.label||"Unknown",r=i.toLowerCase(),f=l.chargingState?.label||"",d=!!l.chargingSources?.homeBase,g=d&&f.toLowerCase()!=="not charging"&&f!=="";return{driving:r==="full",docked:d,charging:g,dockedNotCharging:d&&!g,dockingInProgress:!d&&!g&&r==="passive",oiLabel:i,chargingLabel:f}}function Mg(a){const l=Tl(a);return h.useMemo(()=>qg(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 f0({label:a}){return a?o.jsx("span",{className:"rounded border border-white/40 px-1 text-[0.7rem] text-white",children:a}):null}function Eu({label:a,tone:l}){const i=l==="emerald"?"border-emerald-200/70 bg-emerald-600/70 text-emerald-50":l==="amber"?"border-amber-200/70 bg-amber-600/70 text-amber-50":"border-indigo-200/70 bg-indigo-600/70 text-indigo-50";return o.jsx("span",{className:`rounded-full border px-0.5 py-0.15 text-[0.7rem] font-semibold ${i}`,children:a})}function lA({instructions:a,onConfirm:l,onCancel:i,pending:r}){return o.jsx("div",{className:"fixed inset-0 z-40 flex items-center justify-center bg-black/70 p-1",children:o.jsxs("div",{className:"surface w-full max-w-md space-y-0.5 border border-indigo-700 bg-indigo-950/90 p-1 text-slate-100 shadow-2xl",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("p",{className:"text-lg font-semibold text-indigo-50",children:"Dock Rover"}),o.jsx("p",{className:"text-sm text-slate-200",children:a.summary}),o.jsx(Ku,{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 Tg({layout:a="desktop",expand:l=!1,driveDockState:i}){const r=a==="mobile",{state:{roverId:f,keymap:d},actions:g}=ht(),x=Tl(f),p=i??qg(x),{driving:y,docked:S,charging:b,dockingInProgress:w}=p,[T,N]=h.useState(null),[C,A]=h.useState(!1),[E,j]=h.useState(!1),k=!f||T!==null,Q=!f||T!==null,X=la(d?.driveMacro?.[0]),H=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.",$={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":"—",ie=b?"good":S?"warn":"bad",oe=async()=>{if(!(!f||T)){N("drive");try{g.setMode("drive"),await g.runMacro("drive-sequence")}catch(ce){alert(ce.message)}finally{N(null)}}},se=async()=>{if(!(!f||T)){A(!1),j(!1),N("drive");try{g.setMode("drive"),await g.runMacro("drive-sequence")}catch(ce){alert(ce.message)}finally{N(null)}}},O=async()=>{if(!(!f||T)){N("dock");try{g.setMode("dock"),await g.runMacro("seek-dock")}catch(ce){alert(ce.message)}finally{N(null),A(!1),j(!1)}}},P=()=>{Q||(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",q="text-center items-center justify-between",B=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:se,disabled:k,className:`${le} ${ne} ${q} ${B} ${_}`,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:[X?o.jsx(f0,{label:X}):null,o.jsx(Eu,{label:"Click to start",tone:"emerald"})]})]}),o.jsx("p",{className:"text-sm text-emerald-50/90",children:$.summary}),o.jsx(Ku,{steps:$.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:ie})]})]});if(w){const ce={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:oe,className:`${le} ${ne} ${q} ${B} ${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(Eu,{label:"Click to return to driving mode",tone:"amber"})})]}),o.jsx("p",{className:"text-sm text-amber-50/90",children:ce.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:ie})]}),o.jsx(Ku,{steps:ce.steps,tone:"amber"})]})}return o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",disabled:Q,onClick:P,className:r?`flex w-full items-center justify-center ${le} ${q} ${B} ${ee}`:`${le} ${ne} ${q} ${B} ${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:[H?o.jsx(f0,{label:H}):null,o.jsx(Eu,{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:ie})]}),o.jsx("div",{className:"text-xs text-indigo-100/80",children:"Line up straight, about 1 foot away, before docking."})]})]}),E||!r&&C?o.jsx(lA,{instructions:z,pending:T==="dock",onCancel:()=>{j(!1),A(!1)},onConfirm:O}):null]})}function Ku({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",sA=80,iA=.15,rA=[{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 oA({disabled:a,layout:l,radius:i,onMove:r,onStop:f}){const d=h.useRef(null),g=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(()=>{g.current=null,y({active:!1,base:{x:0,y:0},knob:{x:0,y:0}}),f?.()},[f]),b=h.useCallback(C=>{if(a||g.current!==null)return;C.preventDefault();const A=d.current;if(!A)return;const E=A.getBoundingClientRect(),j=C.clientX-E.left,k=C.clientY-E.top;x.current={x:j,y:k},g.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||g.current!==C.pointerId)return;C.preventDefault();const A=d.current;if(!A)return;const E=A.getBoundingClientRect(),j=C.clientX-E.left,k=C.clientY-E.top,Q=j-x.current.x,X=k-x.current.y,H=Math.min(Math.hypot(Q,X),i),z=Math.atan2(X,Q),I=Math.cos(z)*H,$=Math.sin(z)*H,te={x:El(I/i),y:El(-$/i),boost:!1};y(Z=>({...Z,knob:{x:I,y:$}})),r?.(te)},[a,r]),T=h.useCallback(C=>{if(g.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:T,onPointerLeave:T,onPointerCancel:T,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 Rg({layout:a}){const{state:{roverId:l,camera:i},pipeline:r,actions:{setDriveVector:f,registerInputState:d,setServoAngle:g,toggleNightVision:x}}=ht(),p=Mg(l),y=p.docked&&!p.driving,S=!l,b=i?.config,w=!!(l&&i?.enabled&&b),T=!!(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,E=sA,j=iA,k=h.useRef({x:0,y:0,boost:!1});h.useEffect(()=>{S&&(k.current={x:0,y:0,boost:!1})},[S]);const Q=h.useCallback(($={})=>{if(S)return;const te={x:El($.x??0),y:El($.y??0),boost:!!$.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]),X=h.useCallback(()=>{if(S)return;const $={x:0,y:0,boost:!1};k.current=$,f($,{source:yr}),d(yr,{vector:$,lastEvent:"stop"})},[S,d,f]),H=$=>{if(!w)return;const te=Number($.target.value);Number.isNaN(te)||g(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(Tg,{layout:"mobile",expand:y,driveDockState:p}),y?null:o.jsxs(o.Fragment,{children:[T&&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:H,className:"mt-0 w-full accent-cyan-400"})]}),o.jsx(oA,{disabled:S,layout:a,radius:E,onMove:Q,onStop:X})]})]})}function kg({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]),g=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:rA.map(p=>o.jsx("button",{type:"button",disabled:f,onPointerDown:y=>{y.preventDefault(),d(p)},onPointerUp:()=>g(p),onPointerLeave:()=>g(p),onPointerCancel:()=>g(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 cA(){return o.jsx("div",{className:"flex h-full flex-col gap-0.5",children:o.jsx(kg,{orientation:"landscape"})})}function uA(){return o.jsx("div",{className:"flex h-full flex-col gap-0.5",children:o.jsx(Rg,{layout:"landscape"})})}function fA(){return o.jsx("section",{className:"panel",children:o.jsxs("div",{className:"grid grid-cols-2 gap-0.5 items-stretch",children:[o.jsx(kg,{orientation:"portrait"}),o.jsx(Rg,{layout:"portrait"})]})})}function dA(a=[],l={}){const i=ln(),{enabled:r=!0,version:f=null}=l,[d,g]=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),T=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(),g({})},[y]),h.useEffect(()=>{if(!r){x.current.forEach(j=>URL.revokeObjectURL(j)),x.current.clear(),g({});return}if(!S.current.length||!i)return;let N=!1;const C=S.current,A=(j={},k)=>{if(N||!j.id||!k)return;const Q=k.byteLength??k.length??0,X=Date.now(),H=T.current.get(j.id)||{count:0,totalBytes:0,lastLogAt:0},z={count:H.count+1,totalBytes:H.totalBytes+Q,lastLogAt:H.lastLogAt};if(!z.lastLogAt||X-z.lastLogAt>=1e4){const Z=z.count?z.totalBytes/z.count:0;console.log("[roomCamera]",j.id,`frame=${Q}B`,`avg=${Math.round(Z)}B`,`count=${z.count}`),z.lastLogAt=X}T.current.set(j.id,z);const I=new Blob([k],{type:"image/jpeg"}),$=URL.createObjectURL(I),te=x.current.get(j.id);te&&URL.revokeObjectURL(te),x.current.set(j.id,$),g(Z=>({...Z,[j.id]:{status:"playing",ts:j.ts||Date.now(),error:null,objectUrl:$}}))},E=(j={})=>{N||!j.id||g(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",E),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",E),x.current.forEach(j=>URL.revokeObjectURL(j)),x.current.clear()}},[i,y,r,b]),d}function hA({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 mA(){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 _g=["horizontal","vertical"];function Cu(a,l){return _g.includes(a)?a:l}function gf({defaultOrientation:a="horizontal",orientation:l,hideLayoutToggle:i=!1,hideHeader:r=!1,panelId:f=null}){const{session:d}=_e(),g=d?.roomCameras||[],x=dA(g.map(A=>({id:A.id}))),{value:p,save:y}=dt("roomCameraPanels",{}),[S,b]=h.useState(()=>Cu(f?p?.[f]:a,"horizontal"));h.useEffect(()=>{if(!f)return;const A=p?.[f];A&&b(Cu(A,"horizontal"))},[f,p?.[f]]);const w=l?Cu(l,"horizontal"):S,T=w==="vertical"?"flex flex-col gap-0.5":"grid gap-0.5 md:grid-cols-2",N=!i&&!l&&g.length>0,C=A=>{b(A),f&&y(E=>({...E||{},[f]:A}))};return g.length===0?o.jsx(mA,{}):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:g.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:_g.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:T,children:g.map(A=>{const E=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(hA,{feed:E,label:A.name||A.id})},A.id)})})]})}function xf(){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 pA(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 gA(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 yf(a=[],l={}){const i=ln(),{enabled:r=!0,version:f=null}=l,[d,g]=h.useState({}),x=h.useMemo(()=>Array.isArray(a)?gA(a.map(pA).filter(Boolean)):[],[a]),p=h.useMemo(()=>{const T=x.map(N=>`${N.type}:${N.id}:${N.key}`).join("|");return f?`${T}|v:${f}`:T},[x,f]),y=h.useRef([]),[S,b]=h.useState(0);return h.useEffect(()=>{if(!i)return;const T=()=>b(N=>N+1);return i.on("connect",T),()=>{i.off("connect",T)}},[i]),h.useEffect(()=>{y.current=x},[x]),h.useEffect(()=>{if(!p||!r){g({});return}const T=y.current;let N=!1;function C(A){const E=A.type==="room"?{roomCameraId:A.id}:{roverId:A.id};i.emit("video:request",E,(j={})=>{N||g(k=>({...k,[A.key]:j}))})}return T.forEach(A=>{C(A)}),()=>{N=!0}},[i,p,r,S]),h.useMemo(()=>{if(!p||!r)return{};const T={};return x.forEach(N=>{d[N.key]&&(T[N.key]=d[N.key])}),T},[p,d,x])}function vf(a=[],l={}){const i=ln(),{enabled:r=!0,version:f=null}=l,[d,g]=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),T=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(),g({})},[y]),h.useEffect(()=>{if(!r){x.current.forEach(j=>URL.revokeObjectURL(j)),x.current.clear(),g({});return}if(!S.current.length||!i)return;let N=!1;const C=S.current,A=(j={},k)=>{if(N||!j.id||!k)return;const Q=k.byteLength??k.length??0,X=Date.now(),H=T.current.get(j.id)||{count:0,totalBytes:0,lastLogAt:0},z={count:H.count+1,totalBytes:H.totalBytes+Q,lastLogAt:H.lastLogAt};if(!z.lastLogAt||X-z.lastLogAt>=1e4){const Z=z.count?z.totalBytes/z.count:0;console.log("[roverSnapshot]",j.id,`frame=${Q}B`,`avg=${Math.round(Z)}B`,`count=${z.count}`),z.lastLogAt=X}T.current.set(j.id,z);const I=new Blob([k],{type:"image/jpeg"}),$=URL.createObjectURL(I),te=x.current.get(j.id);te&&URL.revokeObjectURL(te),x.current.set(j.id,$),g(Z=>({...Z,[j.id]:{status:"playing",ts:j.ts||Date.now(),error:null,objectUrl:$}}))},E=(j={})=>{N||!j.id||g(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",E),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",E),x.current.forEach(j=>URL.revokeObjectURL(j)),x.current.clear()}},[i,y,r,b]),d}const xA={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"turn:your.turn.server:3478",username:"user",credential:"pass"}],bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"};function yA(a){if(typeof btoa=="function")return btoa(a);if(typeof Buffer<"u")return Buffer.from(a).toString("base64");throw new Error("No base64 encoder available")}function vA(a){if(!a)return{};const l=`${a}:${a}`;return{Authorization:`Basic ${yA(l)}`}}class d0{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(xA);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",...vA(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(g=>{"playoutDelayHint"in g&&(g.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 Zu({sensors:a={},variant:l="full",size:i,overlay:r=!1}){const f=i||(l==="mini"?190:260),d=f/2,g=f*.07,x=d,p=d+g,y=d*.8,S=y-4,b=y+4,w=y-14,T=y-6,N=y*.65,C=a?.bumpsAndWheelDrops||{},A=a?.wheelOvercurrents||{},E=a?.wheelLeftCurrentMa??0,j=a?.wheelRightCurrentMa??0,k=a?.sideBrushCurrentMa??0,Q=a?.mainBrushCurrentMa??0,X=6,H=C.bumpLeft?X:0,z=C.bumpRight?X:0,I=EA({count:6,totalSpan:140,gap:6,startAngle:-70}),$=["L","FL","CL","CR","FR","R"],te=[a?.lightBumpLeftSignal,a?.lightBumpFrontLeftSignal,a?.lightBumpCenterLeftSignal,a?.lightBumpCenterRightSignal,a?.lightBumpFrontRightSignal,a?.lightBumpRightSignal],Z=I.map((se,O)=>({label:$[O],start:se.start,end:se.end,value:te[O]})),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}],ie=te.filter(se=>se!=null),oe=ie.length?Math.max(...ie,1200):1200;return o.jsxs("div",{className:`${r?"relative":"surface relative p-1"}`,style:r?{width:`${f}px`,height:`${f}px`}:{height:"100%",width:"100%",aspectRatio:"1 / 1"},children:[r?null:o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"absolute left-1 top-1 text-xs text-slate-400",children:"Top-down"}),o.jsxs("div",{className:"absolute right-1 top-1 text-[0.65rem] text-slate-500",children:["0",oe]})]}),o.jsxs("svg",{width:"100%",height:"100%",viewBox:`0 0 ${f} ${f}`,preserveAspectRatio:"xMidYMid meet",className:"mx-auto block",children:[o.jsx("circle",{cx:x,cy:p,r:y,fill:"#0f172a",stroke:"#334155",strokeWidth:"2"}),o.jsx(h0,{cx:x-N,cy:p,current:E,drop:C.wheelDropLeft,overcurrent:A.leftWheel,label:"L"}),o.jsx(h0,{cx:x+N,cy:p,current:j,drop:C.wheelDropRight,overcurrent:A.rightWheel,label:"R"}),o.jsx(AA,{cx:x+y*.65,cy:p-y*.55,current:k,overcurrent:A.sideBrush}),o.jsx(jA,{cx:x,cy:p,current:Q,overcurrent:A.mainBrush,variant:l,dirtLeft:a?.dirtDetectLeft,dirtRight:a?.dirtDetect}),Z.map(se=>{const O=NA(se.value,oe),P=b+4,le=P+28;return o.jsx(bA,{cx:x,cy:p,rBase:le,rTip:P,startDeg:se.start,endDeg:se.end,color:O,value:se.value,max:oe},se.label)}),W.map(se=>{const O=wA(se.value,se.active);return o.jsx(qu,{cx:x,cy:p,rInner:w,rOuter:T,startDeg:se.start,endDeg:se.end,color:O,opacity:1,pulse:!!se.active},se.label)}),o.jsx(qu,{cx:x,cy:p,rInner:S-H,rOuter:b-H,startDeg:-70,endDeg:-6,color:C.bumpLeft?"#ef4444":"#475569",opacity:1,pulse:!!C.bumpLeft}),o.jsx(qu,{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 qu({cx:a,cy:l,rInner:i,rOuter:r,startDeg:f,endDeg:d,color:g,pulse:x=!1,opacity:p=1}){const y=(i+r)/2,S=r-i,b=SA(a,l,y,f,d);return o.jsxs(o.Fragment,{children:[o.jsx("path",{d:b,stroke:g,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 bA({cx:a,cy:l,rBase:i,rTip:r,startDeg:f,endDeg:d,color:g,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),T=i-(i-r)*w,N=zs(a,l,T,f),C=zs(a,l,T,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:g,opacity:1,stroke:"none"})}function SA(a,l,i,r,f){let d=r,g=f;g<=d&&(g+=360);const x=zs(a,l,i,d),p=zs(a,l,i,g);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=Dg(r);return{x:a+i*Math.cos(f),y:l+i*Math.sin(f)}}function Dg(a){return(a-90)*Math.PI/180}function bf(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 h0({cx:a,cy:l,current:i,drop:r,overcurrent:f,label:d}){const g=Math.abs(i),x=Vr(g/1200),p=bf(i,f),y=56,S=14,b=9,w=3,T=y*x,N=d==="L"?-1:1,C=N*(-b/2-w/2),A=N*(S/2+w/2),E=S+b+w+2,j=y+4;return o.jsxs("g",{transform:`translate(${a},${l})`,children:[o.jsx("rect",{x:-E/2,y:-j/2,width:E,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-T,width:S,height:T,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 AA({cx:a,cy:l,current:i,overcurrent:r}){const f=Math.abs(i),d=bf(i*3,r),g=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=Dg(p),S=a+g*Math.cos(y),b=l+g*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:g+8,stroke:"#ef4444",strokeWidth:"3",fill:"none",className:"animate-pulse"}):null]})}function jA({cx:a,cy:l,current:i,overcurrent:r,variant:f,dirtLeft:d,dirtRight:g}){const x=Math.abs(i),p=bf(i,r),y=1,S=96,b=12,w=`main-brush-pattern-a-${f}`,T=`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,T].map((A,E)=>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*(E===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(#${T})`,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 NA(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 wA(a,l){if(l)return"#ef4444";const i=Vr(a==null?0:a/4095),r=[47,55,69],f=[245,158,11],[d,g,x]=r.map((p,y)=>Math.round(p+(f[y]-p)*i));return`rgb(${d}, ${g}, ${x})`}function EA({count:a,totalSpan:l,gap:i,startAngle:r}){const d=(l-i*(a-1))/a,g=[];let x=r;for(let p=0;p<a;p+=1){const y=x+d;g.push({start:x,end:y}),x=y+i}return g}function Og(){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(hg,{className:"mr-0"}),a]}):null}const m0=2e3,CA=3e3,qA=3e3;function MA(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 g=(a-r)/d,x=Math.min(1,Math.max(0,g)),p=Math.round(x*100),y=g<=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 Sf({sessionInfo:a,audioSessionInfo:l,videoMode:i="whep",snapshotFeed:r=null,qualityNotice:f=null,label:d,forceMute:g=!1,telemetryFrame:x,batteryConfig:p,layoutFormat:y="desktop",hudVariant:S="default",driverLabel:b=null,hudForceMap:w=!1,hudMapPosition:T="top-center",hudLabelScale:N=1,fitParent:C=!1,overcurrentLimiter:A=null,showTurnCue:E=!1,turnTimerText:j=null,turnSeconds:k=null,isActiveDriver:Q=!1,idleSkipSeconds:X=null}){const H=h.useRef(null),z=h.useRef(null),I=h.useRef(null),$=h.useRef(null),te=h.useRef(null),Z=h.useRef(null),[W,ie]=h.useState("idle"),[oe,se]=h.useState(null),[O,P]=h.useState("idle"),[le,fe]=h.useState(null),[ae,q]=h.useState(0),[B,_]=h.useState(0),[V,ee]=h.useState(!0),ne=i==="snapshot",ce=x?.sensors,we=ce?.batteryChargeMah??null,xe=y==="desktop",St=!xe,[Ra]=Og(),Rl=w||St?!0:Ra,sa=MA(we,p),Mt=ce?.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(()=>q(Date.now()),m0)},[]),Dl=h.useCallback(()=>{clearTimeout($.current),$.current=setTimeout(()=>_(Date.now()),m0)},[]),oa=h.useCallback(async()=>{const Ne=H.current;if(Ne)try{Ne.muted=!0,await Ne.play()}catch{}},[]),Ol=h.useCallback((Ne=0)=>{if(g)return;clearTimeout(Z.current);const Xe=()=>{clearTimeout(Z.current),Z.current=setTimeout(()=>{g||Le()},CA)},Le=async()=>{const Ee=H.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,g]);h.useEffect(()=>()=>{clearTimeout(I.current),clearTimeout($.current),clearTimeout(Z.current),clearInterval(te.current)},[]),h.useEffect(()=>{W==="playing"&&Ol(0)},[W,Ol]),h.useEffect(()=>{ne&&(ie("snapshot"),se(null))},[ne]),h.useEffect(()=>{if(ne||!a?.url||!H.current)return;let Ne=!0,Xe;const Le=setTimeout(()=>ee(!0),0),Ee=(Ce,Ue)=>{Ne&&(ie(Ce),se(Ue||null),Ce==="playing"&&oa(),["error","failed","disconnected","closed"].includes(Ce)&&tt())};return Xe=new d0({url:a.url,token:a.token,video:H.current,onStatus:Ee}),Xe.start().catch(Ce=>{Ne&&(ie("error"),se(Ce.message),tt())}),()=>{Ne=!1,clearTimeout(Le),Xe?.stop()}},[ne,a?.url,a?.token,ae,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&&(fe(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 d0({url:l.url,token:l.token,video:z.current,audioOnly:!0,onStatus:Le}),Xe.start().catch(Ee=>{Ne&&(P("error"),fe(Ee.message),Dl())}),()=>{Ne=!1,Xe?.stop()}},[l?.url,l?.token,B,Dl]),h.useEffect(()=>{const Ne=z.current;if(!l?.url||!Ne){clearInterval(te.current);return}if(!["connecting","connected","playing","paused"].includes(O)){clearInterval(te.current);return}const Le=()=>{const Ee=z.current;Ee&&(!Ee.paused&&!Ee.ended||Ee.play().then(()=>{P(Ce=>Ce==="connected"?"playing":Ce),fe(Ce=>Ce==="paused"?null:Ce)}).catch(Ce=>{fe(Ue=>Ue||Ce?.message||"autoplay blocked")}))};return Le(),te.current=setInterval(Le,qA),()=>clearInterval(te.current)},[l?.url,O]),h.useEffect(()=>{const Ne=z.current;if(!Ne)return;const Xe=()=>{P(Ue=>Ue==="error"?Ue:"playing"),fe(null)},Le=()=>{P(Ue=>["error","failed","disconnected","closed","stopped"].includes(Ue)?Ue:"paused"),fe(Ue=>Ue||"paused")},Ee=()=>{P(Ue=>Ue==="error"?Ue:"stopped"),fe(Ue=>Ue||"ended")},Ce=()=>{const{error:Ue}=Ne,Kr=Ue?.message||"audio error";P("error"),fe(Kr)};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",Xr=ne?Da:a?.url?W==="error"?`Error: ${oe||"unknown"}`:oe?`${W} (${oe})`:W:"waiting",Zs=l?.error?`Error: ${l.error}`:l?.url?O==="error"?`Error: ${le||"unknown"}`:le?`${O} (${le})`:O: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:H,muted:g||V,playsInline:!0,autoPlay:!0,controls:!1,className:"h-full w-full object-contain"}),o.jsx("audio",{ref:z,autoPlay:!0,hidden:!0}),E?o.jsx(DA,{mobileHud:St,turnSeconds:k,isActiveDriver:Q,idleSkipSeconds:X}):null,o.jsx(_A,{frame:x,sensors:ce,label:d,status:Xr,audioStatus:Zs,desktopLayout:xe,layoutFormat:y,variant:S,driverLabel:b,battery:sa,showTopDown:Rl,mobileHud:St,mapPosition:T,turnTimerText:j,labelScale:N}),o.jsx(LA,{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(BA,{motors:sn,fill:_a,compact:St}),o.jsx(zA,{charge:we,config:p,compact:St}),Fs&&sa.available?o.jsx(RA,{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(kA,{sensors:ce}),o.jsx(TA,{visual:sa})]})]})}function TA({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 RA({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 kA({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,g=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:`${g}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 _A({frame:a,sensors:l,label:i,status:r,audioStatus:f,desktopLayout:d=!0,layoutFormat:g="desktop",variant:x="default",driverLabel:p=null,battery:y,showTopDown:S=!1,mobileHud:b=!1,mapPosition:w="top-center",turnTimerText:T=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 E=b,j=g==="mobile-portrait",k=E?"text-[0.45rem]":"text-[0.65rem]",Q=E?"px-0.25 py-0.25":"px-1 py-0.5",X=E?"px-0.25 py-0.25":"px-0.5 py-0.5",H=E?"text-[0.55rem]":"text-[0.8rem]",z=E?"left-0.5 top-0.5":"left-1 top-1",I=E?"text-[0.5rem]":"text-[0.7rem]",$=E?"px-0.5 py-0.25":"px-1 py-0.5",te=E?"left-0.5 top-1/2":"left-1 top-1/2",Z="bottom-0.5",W={transform:`translateX(-50%) scale(${N})`,transformOrigin:"center bottom"},ie="240px",oe=j?.36:E?.45:.7,O={width:ie,height:ie,opacity:E?.85:.7,transform:w==="top-center"?`translateX(-50%) scale(${oe})`:`scale(${oe})`,transformOrigin:w==="bottom-left"?"bottom left":w==="top-center"?"top center":"top right",...w==="bottom-left"?{left:"0.25rem",bottom:"0.25rem"}:w==="top-center"?{left:"50%",top:"0.25rem"}:{right:"0.25rem",top:"0.25rem"}};if(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,fe=l?.chargingState?.label||"",ae=!!(fe&&fe.toLowerCase()!=="not charging"),q=l?.oiMode?.label||"Unknown",B=q.toLowerCase(),_=B==="full"?"bg-emerald-500/80 text-emerald-50":B==="safe"?"bg-amber-400/80 text-amber-950":B==="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=ae?"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} ${Q}`,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:ae?"Charging":"Not charging"}),o.jsxs("span",{className:`rounded px-1.5 py-0.5 ${_}`,children:["OI: ",q]})]}),P.map(([ne,ce])=>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:ce})]},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 ${X} ${H}`,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:{...O},children:o.jsx(Zu,{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]})}),T?o.jsx("div",{className:`absolute left-1/2 top-0.5 -translate-x-1/2 rounded bg-black/70 text-slate-100 ${$} ${I}`,children:T}):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 ${X} ${H}`,children:o.jsxs("span",{children:['Rover: "',i||"Unnamed Rover",'"']})})}),S&&x!=="spectator"?o.jsx("div",{className:"pointer-events-none absolute rounded",style:{...O},children:o.jsx(Zu,{sensors:l,size:240,overlay:!0})}):null]})}function DA({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",g=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 ${g}`,children:["Idle skip in ",r,"s"]}):null]})})}const OA={leftWheel:"Left wheel",rightWheel:"Right wheel",mainBrush:"Main brush",sideBrush:"Side brush",limiter:"Overcurrent limit"};function BA({motors:a,fill:l=0,compact:i=!1}){if(!a?.length)return null;const r=a.map(S=>OA[S]||S),f=i?"w-[12rem] h-[3.5rem]":"w-[20rem] h-[7rem]",d=i?"px-2 py-1":"px-4 py-2",g=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 ${g} ${d}`,children:[o.jsx("div",{children:"OVERCURRENT"}),o.jsx("div",{className:`mt-0 font-medium text-white ${x}`,children:r.join(", ")})]})]})})}function zA({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,g=r-f;if(g<=0)return null;const p=(a-f)/g<=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 LA({compact:a=!1}){const{session:l}=_e(),{sendMessage:i,onInputFocus:r,onInputBlur:f,blurChat:d,registerInputRef:g,setTypingActive:x}=hf(),{value:p}=dt("tts",{engine:"flite",voice:"rms",pitch:50}),[y,S]=h.useState(""),[b,w]=h.useState(!1),T=l?.role!=="spectator",N=l?.role==="spectator",C=l?.assignment?.roverId||null,E=!!h.useMemo(()=>l?.roster?.find(z=>String(z.id)===String(C))||null,[C,l?.roster])?.audio?.ttsEnabled,j=h.useMemo(()=>{if(!E)return null;const z=p?.engine==="espeak"?"espeak":"flite";if(z==="espeak"){let $=Number.isFinite(p?.pitch)?Math.round(p.pitch):void 0;return typeof $=="number"&&($=Math.max(0,Math.min(99,$))),{speak:!0,engine:z,pitch:$}}const I=typeof p?.voice=="string"?p.voice:void 0;return{speak:!0,engine:z,voice:I}},[p?.engine,p?.pitch,p?.voice,E]),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",Q=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",X=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 H(z){if(z.preventDefault(),!T)return;const I=y.trim();if(I){w(!0);try{await i(I,j),S(""),d(),x(!1)}catch($){alert($.message)}finally{w(!1)}}}return N?null:o.jsxs("form",{onSubmit:H,className:k,children:[o.jsx("input",{className:Q,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=>g(z,{target:"hud"}),placeholder:T?"Chat (TTS)":"Spectator",disabled:!T}),o.jsx("button",{type:"submit",disabled:!T||b,className:X,children:"Speak"})]})}function Af({layoutFormat:a="desktop"}){const{session:l}=_e(),{state:{song:i,lastControlIntentAt:r},overcurrentLimiter:f}=ht(),[d,g]=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(()=>g(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,E=w?l?.activeDrivers?.[w]:null,j=!!(A&&E===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]),Q=!!(A&&k===A),X=C?.deadline||null,H=C?.idleDeadline||null,z=X?X-d:null,I=H?H-d:null,$=l?.mode==="turns"&&Q&&z!=null&&z<=5e3&&z>0,te=l?.mode!=="turns"||j||$,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,ie=j?Z!=null?`${Z}s left`:null:Q&&Z!=null?`Your turn in ${Z}s`:null,oe=w?[...te?[{type:"rover",id:w,key:w}]:[],...N?[{type:"rover",id:`${w}-audio`,key:`${w}-audio`}]:[]]:[],se=yf(oe),O=w&&te?se[w]:null,P=w&&N?se[`${w}-audio`]:null,le=vf(w?[w]:[],{enabled:!!w,version:l?.mode}),fe=w&&le[w]||null,ae=Tl(w),q=w&&l?.roster?l.roster.find(V=>String(V.id)===String(w)):null,B=q?.battery??null,_=q?.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(Sf,{sessionInfo:O,videoMode:te?"whep":"snapshot",snapshotFeed:fe,audioSessionInfo:P,label:_,telemetryFrame:ae,batteryConfig:B,layoutFormat:a,overcurrentLimiter:f,songNote:i?.note,qualityNotice:te?null:"Preview feed (low FPS) until your turn.",showTurnCue:x,turnTimerText:ie,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 p0(...a){return a.filter(Boolean).join(" ")}function UA(a){const l=a?.batteryState?.percentDisplay;return l==null?"--":`${l}%`}function HA(a){return a?.batteryState?a.batteryState.urgentActive?"text-red-400":a.batteryState.warnActive?"text-amber-300":"text-emerald-300":"text-slate-400"}function VA({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:p0("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:p0("font-semibold",HA(f)),children:["Battery ",UA(f)]})]})]}),r?r(f):null]},f.id))})]})}function YA({keymap:a}){const{state:{roverId:l,camera:i},actions:{setServoAngle:r}}=ht(),f=i?.config,d=!!(l&&i?.enabled&&f),g=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:(g+x)/2,[y,S]=h.useState(p),b=h.useRef(!1);h.useEffect(()=>{b.current||S(p)},[p]);const w=A=>{const E=Number.parseFloat(A.target.value);Number.isNaN(E)||(b.current=!0,S(E),r(E))},T=()=>{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:Mu(p)})]}),o.jsxs("div",{children:[o.jsx("input",{type:"range",className:"w-full accent-emerald-400",min:g,max:x,step:.5,value:y,onChange:w,onMouseUp:T,onTouchEnd:T,onPointerUp:T}),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(g0,{label:C}):null,Mu(g)]}),o.jsxs("span",{className:"flex items-center gap-0.5",children:[Mu(x),N?o.jsx(g0,{label:N}):null]})]})]})]})}function g0({label:a}){return o.jsx("span",{className:"rounded border border-white/40 px-1 text-[0.7rem] text-white",children:a})}function Mu(a){return typeof a!="number"||Number.isNaN(a)?"—":`${a>0?"+":""}${a.toFixed(1)}°`}function Bg({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-tight ${i}`,children:a})}function $A({entity:a,connected:l,onToggle:i}){const r=a.state==="unavailable"||!a.available,f=a.state==="on",d=r?"warn":f?"success":"muted",g=r?"Unavailable":f?"On":"Off",x=!l||r,p=r?"border-slate-800 bg-slate-900 text-slate-400 cursor-not-allowed":f?"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";return o.jsxs("button",{type:"button",onClick:()=>i(a.id),disabled:x,className:`flex min-w-[10rem] flex-1 items-center justify-between gap-0.5 rounded px-1 py-0.5 text-left transition-colors ${p} disabled:opacity-60 disabled:hover:bg-inherit`,children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("div",{className:"flex items-center gap-0.5 text-sm",children:o.jsx("span",{className:"truncate font-semibold text-white",children:a.name||a.id})}),o.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-slate-400",children:[o.jsx(Bg,{label:g,tone:d}),!l&&o.jsx("span",{className:"text-amber-200",children:" · Offline"})]})]}),o.jsx("div",{className:"text-xs font-semibold text-white/90",children:f?"Turn off":"Turn on"})]})}function zg(){const{state:{keymap:a}}=ht(),{session:l,homeAssistantToggle:i}=_e(),r=l?.homeAssistant,f=h.useMemo(()=>r?.entities||[],[r?.entities]),d=la(a?.homeAssistantOn?.[0]),g=la(a?.homeAssistantOff?.[0]);if(!r?.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(f.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 x=!!r?.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:f.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"}),d?o.jsx(x0,{label:d}):null]}),o.jsxs("span",{className:"flex items-center gap-0.5",children:[o.jsx("span",{children:"Off"}),g?o.jsx(x0,{label:g}):null]})]})]}),o.jsx(Bg,{label:x?"Connected":"Offline",tone:x?"success":"warn"})]}),o.jsx("div",{className:"flex flex-wrap gap-0.5",children:f.map(p=>o.jsx($A,{entity:p,connected:x,onToggle:i},p.id))})]})}function x0({label:a}){return a?o.jsx("span",{className:"rounded border border-white/40 px-1 text-[0.7rem] text-white",children:a}):null}function Lg(){const{login:a,setRole:l}=_e(),[i,r]=h.useState(""),[f,d]=h.useState(""),[g,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:g,className:"button-dark w-full disabled:opacity-50",children:g?"Logging in…":"Login"})]})]})}const GA=[{key:"open",label:"Open"},{key:"turns",label:"Turns"},{key:"admin",label:"Admin"},{key:"lockdown",label:"Lockdown"}];function QA(){const{session:a,lockRover:l,setMode:i,requestControl:r,setCommunityGoal:f,adminLogs:d}=_e(),g=h.useMemo(()=>a?.roster??[],[a?.roster]),[x,p]=h.useState({}),y=a?.health||null,S=a?.communityGoal?.text||"",b=a?.communityGoal?.updatedAt||null,[w,T]=h.useState(S),N=a?.role==="admin"||a?.role==="lockdown"||a?.role==="lockdown-admin",C=a?.mode??"open",A=async(H,z)=>{try{await l(H,z),p(I=>({...I,[H]:z}))}catch(I){alert(I.message)}},E=async H=>{const z=H.target.value;try{await i(z)}catch(I){alert(I.message)}},j=async H=>{try{await r(H,{force:!0})}catch(z){alert(z.message)}},k=async()=>{try{await f(w)}catch(H){alert(H.message)}},Q=async()=>{try{await f(null)}catch(H){alert(H.message)}};h.useEffect(()=>{T(S)},[S]);const X=h.useMemo(()=>{const H={};return g.forEach(z=>{H[z.id]=x[z.id]??z.locked}),H},[g,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:E,className:"field-input text-sm",children:GA.map(H=>o.jsx("option",{value:H.key,children:H.label},H.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:H=>T(H.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:Q,className:"button-danger",children:"Clear"})]})]}),o.jsx(VA,{roster:g,renderActions:H=>o.jsxs("div",{className:"flex flex-wrap gap-0.5 text-xs",children:[o.jsx("button",{type:"button",onClick:()=>A(H.id,!X[H.id]),className:"button-dark",children:X[H.id]?"Unlock":"Lock"}),o.jsx("button",{type:"button",onClick:()=>j(H.id),className:"button-dark",children:"Force"})]})}),o.jsx(XA,{health:y}),o.jsx(KA,{entries:d})]}):null}function XA({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(g=>g.stale).length,d=i.rooms.filter(g=>g.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(g=>o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{children:g.label}),o.jsxs("span",{className:g.ready?"text-emerald-300":"text-amber-300",children:[g.recentCount,"/",g.neededCount]})]},`${g.type}:${g.id}`))}),o.jsx("div",{className:"space-y-0.5 text-xs text-slate-300",children:i.rovers.map(g=>o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{children:g.name}),o.jsx("span",{className:g.stale?"text-amber-300":"text-emerald-300",children:g.stale?"stale":"ok"})]},`rover:${g.id}`))}),o.jsx("div",{className:"space-y-0.5 text-xs text-slate-300",children:i.rooms.map(g=>o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{children:g.name}),o.jsx("span",{className:g.stale?"text-amber-300":"text-emerald-300",children:g.error?"error":g.stale?"stale":"ok"})]},`room:${g.id}`))})]})}function KA({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 ZA=[{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 FA(a){return a.reduce((l,i)=>((l[i.group]||(l[i.group]=[])).push(i),l),{})}function JA(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(0,Math.min(500,i)):l}const jf=5,Vs=500,Ys=1,Nf=100;function IA(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(jf,Math.min(Vs,i)):l}function Mr(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(Ys,Math.min(Nf,i)):l}function WA(a){const i=(Mr(a,a)-Ys)/(Nf-Ys),r=Vs-i*(Vs-jf);return Math.round(r)}function PA(a){const l=IA(a,a),i=(Vs-l)/(Vs-jf),r=Ys+i*(Nf-Ys);return Math.round(r)}function ej(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:g=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:g,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 tj(){const{state:{keymap:a},actions:{updateKeyBinding:l,resetKeyBindings:i}}=ht(),{value:r,save:f}=dt("inputs",en),d={...en.keyboard,...r.keyboard??{}},g=h.useMemo(()=>typeof d.tiltSpeed=="number"?Mr(d.tiltSpeed,en.keyboard.tiltSpeed):typeof d.tiltIntervalMs=="number"?Mr(PA(d.tiltIntervalMs),en.keyboard.tiltSpeed):en.keyboard.tiltSpeed,[d.tiltIntervalMs,d.tiltSpeed]),x=h.useMemo(()=>FA(ZA),[]),{active:p,startCapture:y,cancel:S}=ej((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,E=JA(C,A[N]);f(j=>({...j??{},keyboard:{...j?.keyboard??A,[N]:E}}))},[f]),T=h.useCallback(N=>{const C=en.keyboard,A=Mr(N,C.tiltSpeed),E=WA(A);f(j=>({...j??{},keyboard:{...j?.keyboard??C,tiltSpeed:A,tiltIntervalMs:E}}))},[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:g,onChange:T,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 E=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(E)})]}),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}),nj=[{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"}],y0=.45,aj=.6;function Ds({label:a,description:l,min:i,max:r,step:f,value:d,onChange:g}){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=>g(Number(x.target.value)),className:"mt-0 w-full accent-emerald-400"})]})}function lj(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 sj(a){return a.reduce((l,i)=>((l[i.section]||(l[i.section]=[])).push(i),l),{})}function ij(a,l){if(!a||a.length===0)return null;if(l){const i=a.find(r=>r.signature===l);if(i)return i}return a[0]}function rj(a){return{axes:Array.from(a.axes??[]),buttons:(a.buttons??[]).map(l=>({pressed:!!l?.pressed,value:typeof l?.value=="number"?l.value:l?.pressed?1:0}))}}function oj(a,l,i){const r=(a.axes??[]).map((d,g)=>({index:g,delta:Math.abs((d??0)-(l.axes?.[g]??0)),value:d}));if(r.sort((d,g)=>g.delta-d.delta),i.kind==="axisPair"){const d=r.filter(g=>g.delta>y0).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>y0);return f?{kind:"axis",index:f.index,...i.invertDefaults??{}}:null}function cj(a,l,i){const r=a.buttons??[];for(let d=0;d<r.length;d+=1){const g=r[d],x=typeof g?.value=="number"?g.value:g?.pressed?1:0;if(g?.pressed||x>aj)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 g=f[d]??0,x=Math.abs(g-(l.axes?.[d]??0));if(Math.abs(g)>.7&&x>.5)return i.kind==="axis"?{kind:"axis",index:d,...i.invertDefaults??{}}:{kind:"axisButton",index:d,direction:g>=0?1:-1,threshold:.6}}return null}function uj(a,l,i){if(!a)return null;if(i.kind==="axis"||i.kind==="axisPair"){const r=oj(a,l,i);if(r)return r}return cj(a,l,i)}function fj(){const a=tA(),{value:l,save:i}=dt("gamepad",na),[r,f]=h.useState(null),d=h.useRef(null),g=h.useMemo(()=>sj(nj),[]),x=h.useMemo(()=>ij(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 E=A??na;if(E.profiles?.[p])return E;const j=E?.defaults?.profile??qn,k=Ng(x,j);return{...E,profiles:{...E.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=rj(x);return}const A=uj(x,d.current,r);A&&(i(E=>{const j=E??na,k=j.profiles?.[p]??j?.defaults?.profile??qn,Q={...k,bindings:{...k.bindings??{},[r.id]:{...k.bindings?.[r.id]??{},kind:r.kind,sources:[A]}}};return{...j,profiles:{...j.profiles??{},[p]:Q}}}),f(null))},[x,p,r,i]);const S=h.useCallback(A=>{i(E=>({...E??na,activeSignature:A||null}))},[i]),b=h.useCallback(A=>{i(E=>{const j=E??na,k=(p&&j.profiles?.[p])??j?.defaults?.profile??qn,Q={...k,calibration:{...k.calibration??{},...A}};return p?{...j,profiles:{...j.profiles??{},[p]:Q}}:{...j,defaults:{...j.defaults??{},profile:Q}}})},[p,i]),w=h.useCallback((A,E)=>{i(j=>{const k=j??na,Q=(p&&k.profiles?.[p])??k?.defaults?.profile??qn,X=E(Q.bindings?.[A]??{}),H={...Q,bindings:{...Q.bindings??{},[A]:X}};return p?{...k,profiles:{...k.profiles??{},[p]:H}}:{...k,defaults:{...k.defaults??{},profile:H}}})},[p,i]),T=h.useCallback(A=>{w(A.id,E=>({...E,sources:[]}))},[w]),N=h.useCallback((A,E)=>{w(A.id,j=>{const k=Array.isArray(j.sources)?[...j.sources]:[];if(!k[0])return j;const Q={...k[0]};return E==="invertX"?Q.invertX=!Q.invertX:E==="invertY"?Q.invertY=!Q.invertY:Q.invert=!Q.invert,k[0]=Q,{...j,sources:k}})},[w]),C=h.useMemo(()=>x?{outputs:wg(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(g).map(([A,E])=>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:E.map(j=>{const Q=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:lj(Q)})]}),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:!Q,onClick:()=>N(j,"invertX"),className:"button-dark text-[0.7rem] font-medium disabled:opacity-50",children:"Invert X"}),o.jsx("button",{type:"button",disabled:!Q,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:!Q,onClick:()=>N(j),className:"button-dark text-[0.7rem] font-medium disabled:opacity-50",children:"Invert"}),o.jsx("button",{type:"button",onClick:()=>T(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,E)=>o.jsxs("span",{className:"font-mono text-slate-300",children:["A",E,": ",Cn.format(A)]},`axis-${E}`))}),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,E)=>o.jsxs("span",{className:"font-mono text-slate-300",children:["B",E,": ",Cn.format(A.value)," ",A.pressed?"●":""]},`btn-${E}`))}),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 dj={drive:"Drive wheels",aux:"Aux motors"};function v0(a){return Number.isFinite(a)?`${Math.round(a*100)}%`:"--"}function hj({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 mj(){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,g=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:dj[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:v0(f)})]}),o.jsx(hj,{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:v0(g)})]})]})]},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 Ug=h.createContext(null);function Hg(){const a=h.useContext(Ug);if(!a)throw new Error("Tabs components must be used within a <Tabs> provider.");return a}const b0={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"}},Vg="primary";function wf(...a){return a.filter(Boolean).join(" ")}function Ef({children:a,defaultTab:l,currentTab:i,onTabChange:r,variant:f=Vg}){const[d,g]=h.useState(l??null),[x,p]=h.useState([]),y=h.useCallback(T=>T?(p(N=>N.includes(T)?N:[...N,T]),()=>p(N=>N.includes(T)?N.filter(C=>C!==T):N)):()=>{},[]),S=i??d??x[0]??null;h.useEffect(()=>{l&&i===void 0&&g(l)},[l,i]);const b=h.useCallback(T=>{T&&(i===void 0&&g(T),r&&r(T))},[i,r]),w=h.useMemo(()=>({activeTab:S,setActiveTab:b,registerTab:y,variant:f}),[S,b,y,f]);return o.jsx(Ug.Provider,{value:w,children:a})}function Cf({children:a,className:l=""}){return o.jsx("div",{className:wf("flex gap-0.5",l),children:a})}function Kt({id:a,children:l,className:i="",disabled:r=!1}){const{activeTab:f,setActiveTab:d,registerTab:g,variant:x}=Hg();h.useEffect(()=>g(a),[a,g]);const p=b0[x]??b0[Vg],y=f===a,S=wf(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 qf({children:a,className:l=""}){return o.jsx("div",{className:wf("mt-0 space-y-0.5",l),children:a})}function Zt({id:a,children:l,keepMounted:i=!1}){const{activeTab:r}=Hg(),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 pj(){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 S0=300,A0=240;function gj(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 xj(a){const i=a.map(r=>gj(r)).join(" ");return i.length>A0?`${i.slice(0,A0)}…`:i}function yj(){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:xj(S),timestamp:new Date().toLocaleTimeString()}];return w.length>S0?w.slice(-S0):w})},d=(p,...y)=>f("in",p,y),g=(p,...y)=>f("out",p,y);a.onAny(d);let x=null;if(typeof a.onAnyOutgoing=="function")a.onAnyOutgoing(g),x=()=>a.offAnyOutgoing(g);else{const p=a.emit.bind(a);a.emit=(y,...S)=>(g(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 vj=[{key:"start",label:"Start OI"},{key:"safe",label:"Safe"},{key:"full",label:"Full"},{key:"passive",label:"Passive"},{key:"dock",label:"Dock"}];function Yg(){const{state:{roverId:a},actions:{sendOiCommand:l,setSensorStream:i}}=ht(),r=!!a,[f,d]=Og(),g=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=T=>{a&&i(T)},w=T=>{const N=T.target.value;p(C=>({...C??{},connectionTransport:N})),g?.io?.opts&&(g.io.opts.transports=N==="polling"?["polling"]:["websocket","polling"],g.disconnect(),g.connect())};return o.jsxs(Ef,{defaultTab:"keybindings",children:[o.jsxs(Cf,{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(qf,{children:[o.jsx(Zt,{id:"keybindings",children:o.jsx("div",{className:"space-y-0.5",children:o.jsx(tj,{})})}),o.jsx(Zt,{id:"controller",children:o.jsx("div",{className:"space-y-0.5",children:o.jsx(fj,{})})}),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:T=>d(T.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:vj.map(T=>o.jsx("button",{type:"button",onClick:()=>l(T.key),disabled:!r,className:"button-dark text-xs disabled:opacity-30",children:T.label},T.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(T=>o.jsx("button",{type:"button",onClick:()=>b(T.enable),disabled:!r,className:"flex-1 button-dark text-xs disabled:opacity-30",children:T.label},T.key))}),!r&&o.jsx("p",{className:"text-xs text-slate-500",children:"Assign a rover to toggle streams."})]}),o.jsx(Lg,{}),o.jsx(mj,{}),o.jsx(QA,{}),o.jsx(pj,{}),o.jsx(yj,{})]})})]})]})}const j0={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 bj(a){return j0[a]||j0.desktop}function $g({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 N0(a,l){return a.map((i,r)=>typeof i=="string"?o.jsx("span",{children:i},`text-${r}`):i?.action?o.jsx($g,{actionId:i.action,keymap:l},`pill-${i.action}-${r}`):i?.text?o.jsx("span",{children:i.text},`span-${r}`):null)}function $r(a,l,i){if(typeof a=="string")return a;if(Array.isArray(a?.segments))return N0(a.segments,l);if(a&&typeof a=="object"){if(typeof a.text=="string")return a.text;if(Array.isArray(a))return N0(a,l)}return String(a??"")}function Sj({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:$r(i,l)},f)})})]}):null}function Aj({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:$r(i,l)},f)})})]})}function jj({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:$r(i,{})},`callout-${r}`))})]})}function Nj({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($g,{actionId:i.action,keymap:l})]},i.action))})]})}function wj({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(Nj,{group:i,keymap:l},i.id))})]}):null}function Ej({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:$r(l,{})},`gamepad-${i}`))})]}):null}function w0({block:a,keymap:l}){if(!a)return null;switch(a.type){case"list":return o.jsx(Aj,{block:a,keymap:l});case"callout":return o.jsx(jj,{block:a});case"keyboard":return o.jsx(wj,{block:a,keymap:l});case"gamepad":return o.jsx(Ej,{block:a});default:return null}}function Gg({layout:a,keymap:l}){const i=h.useMemo(()=>bj(a),[a]),r=l||{},f=i.main||[],d=i.aside||[];return o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(Sj,{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((g,x)=>o.jsx(w0,{block:g,keymap:r},g.title||x))}),o.jsx("div",{className:"space-y-0.5",children:d.map((g,x)=>o.jsx(w0,{block:g,keymap:r},g.title||x))})]})]})}function Qg({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(Gg,{layout:a,keymap:i?.keymap||{}})]})}const Cj=["kal","rms","slt","ksp","bdl"],qj=Array.from({length:10},(a,l)=>l*10);function Gr({hideInput:a=!1,hideSpectatorNotice:l=!1,fillHeight:i=!1}){const{session:r}=_e(),{messages:f,typing:d,sendMessage:g,registerInputRef:x,onInputFocus:p,onInputBlur:y,blurChat:S,setTypingActive:b}=hf(),{value:w,save:T}=dt("tts",{engine:"flite",voice:"rms",pitch:50}),[N,C]=h.useState(""),[A,E]=h.useState(!1),[j,k]=h.useState(!1),[Q,X]=h.useState(()=>w?.engine||"flite"),[H,z]=h.useState(()=>w?.voice||"rms"),[I,$]=h.useState(()=>Number.isFinite(w?.pitch)?w.pitch:50),te=r?.role!=="spectator",Z=h.useRef(null),W=r?.assignment?.roverId||null,oe=!!h.useMemo(()=>r?.roster?.find(ae=>String(ae.id)===String(W))||null,[W,r?.roster])?.audio?.ttsEnabled,se=h.useMemo(()=>f.slice(-200),[f]),O=h.useMemo(()=>d||[],[d]);h.useEffect(()=>{Z.current&&(Z.current.scrollTop=Z.current.scrollHeight)},[se,O]),h.useEffect(()=>{const ae=w?.engine||"flite",q=w?.voice||"rms",B=Number.isFinite(w?.pitch)?w.pitch:50;Q!==ae&&X(ae),H!==q&&z(q),I!==B&&$(B)},[Q,I,w?.engine,w?.pitch,w?.voice,H]),h.useEffect(()=>{k(!!oe)},[oe]);const P=h.useMemo(()=>!oe||!j?null:Q==="espeak"?{speak:!0,engine:Q,pitch:I}:{speak:!0,engine:Q,voice:H},[Q,I,j,oe,H]);async function le(ae){if(ae.preventDefault(),!te||a)return;const B=N.replace(/\\n/g,`
`).trim();if(B){E(!0);try{await g(B,P),C(""),S(),b(!1)}catch(_){alert(_.message)}finally{E(!1)}}}const fe=i?"flex-1 min-h-0 overflow-y-auto":"h-48 overflow-y-auto";return o.jsxs("section",{className:`panel-section space-y-0.5 text-base ${i?"flex h-full flex-col overflow-hidden":""}`,children:[o.jsxs("div",{className:`surface overflow-y-auto space-y-0.5 px-0 ${fe}`,ref:Z,children:[se.length===0&&O.length===0?o.jsx("p",{className:"text-sm text-slate-500",children:"No messages yet."}):se.map(ae=>o.jsx(gg,{message:ae},ae.id)),O.map(ae=>o.jsx(xg,{message:ae},`typing-${ae.typingId||ae.id}`))]}),!a&&o.jsxs("form",{className:"flex flex-wrap items-stretch gap-0.5",onSubmit:le,children:[o.jsx("input",{className:"field-input flex-1 min-w-[10rem]",value:N,onChange:ae=>{const q=ae.target.value;C(q),b(!!q.trim())},onFocus:ae=>{p(ae),b(!!N.trim())},onBlur:ae=>{y(ae),b(!1)},onKeyDown:ae=>{ae.key==="Enter"&&!N.trim()&&(ae.preventDefault(),S(),b(!1))},ref:ae=>x(ae,{target:"panel"}),placeholder:te?"Type a message…":l?"":"Spectators cannot chat",disabled:!te}),oe&&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:j,onChange:ae=>k(ae.target.checked),className:"accent-cyan-500"}),o.jsx("span",{children:"Speak"})]}),o.jsxs("select",{value:Q,onChange:ae=>{const q=ae.target.value;X(q),T(B=>({...B||{},engine:q}))},className:"field-input text-xs",children:[o.jsx("option",{value:"flite",children:"flite"}),o.jsx("option",{value:"espeak",children:"espeak"})]}),Q==="flite"?o.jsx("select",{value:H,onChange:ae=>{const q=ae.target.value;z(q),T(B=>({...B||{},voice:q}))},className:"field-input text-xs",children:Cj.map(ae=>o.jsx("option",{value:ae,children:ae},ae))}):o.jsx("select",{value:I,onChange:ae=>{const q=Number(ae.target.value);$(q),T(B=>({...B||{},pitch:q}))},className:"field-input text-xs",children:qj.map(ae=>o.jsxs("option",{value:ae,children:["pitch ",ae]},ae))})]}),o.jsx("button",{type:"submit",disabled:!te||A,className:"button-dark h-full disabled:opacity-50 self-stretch",children:A?"...":"Send"})]})]})}function Mf({compact:a=!1}){const{session:l,setNickname:i}=_e(),{value:r,save:f}=dt("profile",{nickname:""}),[d,g]=h.useState(r.nickname||""),[x,p]=h.useState(!1),y=l?.role!=="spectator";h.useEffect(()=>{g(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(T){alert(T.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=>g(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 Xg({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(fS,{className:"mr-0"}),a]}):null}function Mj({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(Mf,{compact:a})})})}function Tj(){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(Xg,{className:"h-full"})]})})}function Tu(...a){return a.filter(Boolean).join(" ")}function Rj(a){const l=a?.batteryState?.percentDisplay;return l==null?"--":`${l}%`}function kj(a){return a?.batteryState?a.batteryState.urgentActive?"text-red-400":a.batteryState.warnActive?"text-amber-300":"text-emerald-300":"text-slate-400"}function _j(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 Dj(a,l){if(!a)return"";const i=a.nickname||a.socketId?.slice(0,6)||"unknown";return a.socketId&&a.socketId===l?`${i} (you)`:i}function Qr({title:a="Rovers"}){const{session:l,requestControl:i}=_e(),[r,f]=h.useState({}),[d,g]=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(()=>{g(Date.now())},1e3);return()=>clearInterval(A)},[w]);const T=h.useMemo(()=>{const A=new Set(p.map(j=>String(j.id))),E=Object.keys(y||{}).filter(j=>!A.has(String(j))).map(j=>({id:j,name:j,locked:!1,batteryState:null}));return[...p,...E]},[p,y]);async function N(A){if(A){f(E=>({...E,[A]:!0}));try{await i(A)}catch(E){alert(E.message)}finally{f(E=>({...E,[A]:!1}))}}}const C=A=>S.find(E=>E.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}),T.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:T.map(A=>{const E=String(A.id),j=y?.[E]||null,k=j?.queue||[],Q=j?.idleDeadline||j?.deadline||null,X=Q&&Q>d?Math.ceil((Q-d)/1e3):Q?0:null,H=j?.current||null,z=H?k.findIndex(O=>O===H):-1,I=k.length>1?z>=0?k[(z+1)%k.length]:k[0]:null,$=!!(b&&H&&H===b),te=!!(b&&I&&I===b),Z=X!=null&&($||te),W=!!A.locked,ie=A.lockReason?`locked: ${A.lockReason}`:"locked",oe=W?ie:r[E]?"...":"request",se=x&&!W&&!r[E];return o.jsxs("li",{className:Tu("surface flex flex-wrap items-start justify-between gap-0.5",se&&"cursor-pointer",W&&"bg-red-900/40"),onClick:()=>{se&&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:$?`${X}s left`:`Your turn in ${X}s`}):null]}),o.jsx("span",{className:Tu("text-[0.75rem] font-semibold",kj(A)),children:Rj(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((O,P)=>{const le=C(O),fe=O===H,ae=!!(I&&O===I&&!fe),q=fe?"bg-sky-600 text-white ring-2 ring-amber-300":ae?"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] ${q}`,children:[o.jsx("span",{className:`${_j(le.role)} font-semibold`,children:Dj(le,b)}),fe&&o.jsx("span",{className:"text-[0.65rem] text-slate-200",children:"now"}),ae&&o.jsx("span",{className:"text-[0.65rem] text-emerald-100",children:"next"})]},`${E}-${O}-${P}`)})})]}),x?o.jsx("button",{type:"button",onClick:O=>{O.stopPropagation(),N(A.id)},disabled:r[E]||W,className:Tu("button-dark disabled:opacity-40",W&&"bg-red-600/70 text-white hover:bg-red-600"),children:oe}):null]},A.id)})})]})}function Oj(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 Bj(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:g}=_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;g(C).then(()=>{p.current=A}).catch(()=>{})},[S,d?.socketId,g,x.nickname]),h.useEffect(()=>{if(!y)return;const C=()=>{if(!S)return;const A=(x.nickname||"").trim();A&&g(A).then(()=>{p.current=d?.socketId||null}).catch(()=>{})};return y.on("connect",C),()=>y.off("connect",C)},[S,g,y,x.nickname,d?.socketId]);const T=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(Mf,{compact:f})})}),o.jsxs("div",{className:"grid gap-0.5 sm:grid-cols-2 md:grid-cols-1",children:[o.jsx(Yr,{}),o.jsx(Xg,{})]})]}),!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:T.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:T.length===0?o.jsx("p",{className:"text-sm text-slate-500",children:"Waiting for users…"}):T.map(C=>o.jsx("span",{className:`rounded bg-slate-800/80 px-1 py-0.25 text-[0.7rem] ${Oj(C.role)}`,children:Bj(C,w)},C.socketId))})]})]})}function zj(){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(Zu,{sensors:i})})})}function Lj(){const{state:{roverId:a,keymap:l}}=ht(),i=Mg(a),r=i.docked&&!i.driving;return o.jsxs("section",{className:"panel-section flex h-full flex-col gap-0.5",children:[o.jsx(Tg,{layout:"desktop",expand:!0,driveDockState:i}),r?null:o.jsx(YA,{keymap:l})]})}function Uj({layout:a,onOpenHelpOverlay:l}){return o.jsx("section",{className:"panel text-base",children:o.jsxs(Ef,{defaultTab:"telemetry",children:[o.jsxs(Cf,{children:[o.jsx(Kt,{id:"telemetry",children:"Controls"}),o.jsx(Kt,{id:"help",children:"Help"}),o.jsx(Kt,{id:"settings",children:"Settings"})]}),o.jsxs(qf,{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(zj,{}),o.jsx(Lj,{})]}),o.jsxs("div",{className:"grid gap-0.5 grid-cols-[minmax(0,1fr)_minmax(0,0.9fr)_minmax(0,0.75fr)]",children:[o.jsx(Qr,{}),o.jsx(uf,{panelId:"replay-sources-desktop",fillHeight:!0}),o.jsx(Tj,{})]}),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(Gr,{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(Mj,{compact:!0})]})]}),o.jsx(zg,{}),o.jsx(gf,{defaultOrientation:"horizontal",panelId:"rightpane-telemetry"})]})}),o.jsx(Zt,{id:"help",children:o.jsx(Qg,{layout:a,onOpenOverlay:l})}),o.jsx(Zt,{id:"settings",children:o.jsx(Yg,{})})]})]})})}const Hj=new Set(["admin","lockdown","lockdown-admin"]),Vj=new Set(["lockdown","lockdown-admin"]),Yj=new Set(["admin","lockdown"]);function $j(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 Gj(){const{session:a}=_e(),l=a?.mode,i=a?.role,r=Yj.has(l),f=l==="lockdown"?Vj.has(i):Hj.has(i);if(!r||f)return null;const d=$j(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(Lg,{})}),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(Gr,{}),o.jsx(Mf,{})]})]})})}const Qj="/assets/turn_alert-DVO8EZJa.mp3";function Xj(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 Kj(){const{session:a,pushAlert:l}=_e(),i=Xj(Qj),r=h.useRef(new Set),f=h.useMemo(()=>a?.turnQueues||{},[a?.turnQueues]),d=a?.socketId||null;return h.useEffect(()=>{if(!d)return;const g=[];Object.entries(f).forEach(([x,p])=>{!p||!p.current||p.current!==d||r.current.has(x)||(g.push(x),r.current.add(x))}),Object.keys(f).forEach(x=>{(!f[x]||f[x].current!==d)&&r.current.delete(x)}),g.length!==0&&(g.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 Zj({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 Kg="fullscreenPromptDismissed",Fj=new Set(["mobile-portrait","mobile-landscape"]),Zg=()=>{if(typeof window>"u")return null;try{return window.sessionStorage}catch{return null}},Jj=()=>{const a=Zg();if(!a)return!1;try{return a.getItem(Kg)==="1"}catch{return!1}},E0=()=>{const a=Zg();if(a)try{a.setItem(Kg,"1")}catch{}},Ij=()=>{if(typeof navigator>"u")return!1;const a=navigator.userAgent||navigator.platform||"";return/iphone|ipad|ipod/i.test(a)},Wj=()=>{if(typeof document>"u")return!1;const a=document;return!!(a.fullscreenEnabled||a.webkitFullscreenEnabled||a.mozFullScreenEnabled||a.msFullscreenEnabled)};function Pj(a){const l=Fj.has(a),[i,r]=h.useState(!1),[f,d]=h.useState("native"),g=h.useMemo(()=>Ij(),[]),x=h.useCallback(()=>{if(!l){r(!1);return}if(Jj()){r(!1);return}if(g){d("pwa-hint"),r(!0);return}if(!Wj()){r(!1);return}if(typeof document<"u"&&document.fullscreenElement){r(!1);return}d("native"),r(!0)},[g,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(()=>{E0(),r(!1)},[]),y=h.useCallback(async()=>{if(!l||g||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,E0(),r(!1),!0}catch(w){return console.warn("Failed to enter fullscreen",w),!1}},[g,l]);return h.useEffect(()=>{l||r(!1)},[l]),{visible:i,mode:f,enterFullscreen:y,dismiss:p}}function eN({visible:a,layout:l,onClose:i,showOnLoad:r,onToggleShowOnLoad:f}){if(!a)return null;const{state:d}=ht(),g=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:g,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(Gg,{layout:l,keymap:d?.keymap||{}})})]})})}const tN=`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 nN(a){return a?a.charAt(0).toUpperCase()+a.slice(1):""}function aN(){const a=String(tN).split(/\r?\n/).map(i=>i.trim()).filter(Boolean);return a.length?(a[Math.floor(Math.random()*a.length)]||"").trim():""}function Tf(){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 g=nN(aN()).slice(0,32);if(!g)return;(async()=>{try{await a(g)}catch{}finally{r({nickname:g})}})()},[r,a,i,l.nickname])}const Ru=1e4,ku=28,lN=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",[g,x]=h.useState(!1),[p,y]=h.useState(ku),[S,b]=h.useState(0),w=h.useRef(null),T=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(Ru);const k=setTimeout(()=>x(!1),Ru),Q=setInterval(()=>{const X=Date.now()-j;b(Math.max(0,Ru-X))},250);return()=>{clearTimeout(k),clearInterval(Q)}},[f,d]),h.useEffect(()=>{if(!f)return;y(ku);let j=0;const k=()=>{const X=N.current,H=T.current;if(!X||!H)return;const z=X.clientWidth;if(!z)return;const I=H.scrollWidth;if(!I)return;const $=Math.min(1,z/I),te=Math.max(lN,Math.floor(ku*$));y(te)};j=window.requestAnimationFrame(k);const Q=new ResizeObserver(()=>{window.cancelAnimationFrame(j),j=window.requestAnimationFrame(k)});return w.current&&Q.observe(w.current),()=>{window.cancelAnimationFrame(j),Q.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||!g)return null;const A=d?Math.ceil(S/1e3):null,E=i?{onClick:()=>x(!1),role:"button",tabIndex:0}:{};return o.jsx("div",{ref:w,className:C,style:{fontSize:`${p}px`,lineHeight:1.1},...E,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:T,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 sN(){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 iN({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(Af,{}),o.jsx(I1,{}),o.jsx(xf,{})]}),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(Uj,{layout:a,onOpenHelpOverlay:l})]})]})}function Fg({layout:a,onOpenHelpOverlay:l,roomPanelId:i,showTelemetry:r=!0}){return o.jsx("section",{className:"panel text-base",children:o.jsxs(Ef,{defaultTab:"chat",children:[o.jsxs(Cf,{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(qf,{children:[o.jsx(Zt,{id:"chat",children:o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(Gr,{}),o.jsx(Or,{})]})}),o.jsx(Zt,{id:"roomcontrols",children:o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(zg,{}),o.jsx(gf,{panelId:i})]})}),o.jsx(Zt,{id:"help",children:o.jsx(Qg,{layout:a,onOpenOverlay:l})}),o.jsx(Zt,{id:"settings",children:o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(Yg,{}),o.jsx(xf,{})]})})]})]})})}function rN({onOpenHelpOverlay:a}){return o.jsxs("div",{className:"flex flex-col gap-0.5",children:[o.jsx(Af,{layoutFormat:"mobile-portrait"}),o.jsx(fA,{}),o.jsxs("div",{className:"grid gap-0.5 grid-cols-[minmax(0,1fr)_minmax(0,1.4fr)]",children:[o.jsx(uf,{panelId:"replay-sources-mobile-portrait"}),o.jsx(Qr,{})]}),o.jsx(Fg,{layout:"mobile-portrait",onOpenHelpOverlay:a,roomPanelId:"mobile-portrait-room"})]})}function oN({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(cA,{}),o.jsxs("div",{children:[o.jsx(Af,{layoutFormat:"mobile-landscape"}),o.jsxs("div",{className:"grid gap-0.5 grid-cols-[minmax(0,1fr)_minmax(0,1.4fr)]",children:[o.jsx(uf,{panelId:"replay-sources-mobile-landscape"}),o.jsx(Qr,{})]})]}),o.jsx(uA,{})]}),o.jsx("div",{className:"flex flex-col gap-0.5 pb-0",children:o.jsx(Fg,{layout:"mobile-landscape",onOpenHelpOverlay:a,roomPanelId:"mobile-landscape-room",showTelemetry:!1})})]})}function cN(){const a=sN(),l=a==="desktop",i=Pj(a);return o.jsx("div",{className:`bg-black text-slate-100 ${l?"h-screen overflow-hidden":"min-h-screen"}`,children:o.jsx(cf,{children:o.jsx(uN,{layout:a,isDesktop:l,fullscreen:i})})})}function uN({layout:a,isDesktop:l,fullscreen:i}){Tf();const{visible:r,mode:f,enterFullscreen:d,dismiss:g}=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),[]),T=h.useCallback(()=>b(!1),[]),N=h.useCallback(A=>{const E=!!A;y(j=>({...j??{},showOnLoad:E})),E||b(!1)},[y]),C=h.useMemo(()=>l?o.jsx(iN,{layout:a,onOpenHelpOverlay:w}):a==="mobile-landscape"?o.jsx(oN,{onOpenHelpOverlay:w}):o.jsx(rN,{onOpenHelpOverlay:w}),[l,a,w]);return o.jsxs(BS,{children:[o.jsx(QS,{}),o.jsx(aA,{}),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(ff,{}),o.jsx(Kj,{}),o.jsx(Gj,{}),o.jsx(eN,{visible:S,layout:a,onClose:T,showOnLoad:x?.showOnLoad!==!1,onToggleShowOnLoad:N}),o.jsx(Zj,{visible:r,mode:f,onEnterFullscreen:d,onDismiss:g})]})}function Jg(){const{session:a,setRole:l,subscribeAll:i,connected:r}=_e(),[f,d]=h.useState(!1);return h.useEffect(()=>{let g=!1;async function x(){if(a?.mode==="lockdown"){d(!1);return}try{a?.role!=="spectator"&&await l("spectator"),await i(),g||d(!0)}catch(p){console.error("Failed to enter spectator mode",p),g||d(!1)}}return x(),()=>{g=!0}},[r,a?.mode,a?.role,l,i]),f}function fN(){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 dN({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,g=l?.turnQueues?.[a];return d==="turns"&&g?.current?`${f} (turns)`:f}function hN({rover:a,frame:l,snapshotFeed:i,audioInfo:r,session:f}){const d=dN({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(Sf,{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 mN({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(hN,{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 pN(){return o.jsx("section",{className:"min-h-0",children:o.jsx("div",{className:"surface min-h-[14rem] overflow-hidden",children:o.jsx(gf,{defaultOrientation:"horizontal",hideLayoutToggle:!0,hideHeader:!0,panelId:"spectator-secondary"})})})}function gN({className:a=""}){return o.jsx("div",{className:`panel ${a}`,children:o.jsx(xf,{})})}function xN(){const{session:a}=_e(),l=a?.mode==="lockdown";Tf(),Jg();const i=fN(),r=of(),f=a?.roster??[],d=vf(f.map(T=>T.id),{enabled:!l,version:a?.mode}),g=f.flatMap(T=>T.media?.audioPublishUrl?[{type:"rover",id:`${T.id}-audio`,key:`${T.id}-audio`}]:[]),x=yf(g,{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(Qr,{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(Gr,{hideInput:!0,hideSpectatorNotice:!0,fillHeight:!0})}),o.jsx("div",{className:`${b} ${i?w:""}`,children:o.jsx(gN,{className:`${i?"h-full":"h-40"} overflow-hidden`})})]}),o.jsxs("section",{className:y,children:[o.jsx(mN,{roster:f,frames:r,snapshotFeeds:d,audioSources:x,session:a}),o.jsx(pN,{})]})]}),o.jsx(ff,{})]})}function yN(){return o.jsx(cf,{children:o.jsx(xN,{})})}const vN=2e4,bN=10800*1e3;function C0({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,g=l?.turnQueues?.[a];return d==="turns"&&g?.current?`${f}`:f}function SN({rover:a,frame:l}){const i=a?.batteryState?.percentDisplay,r=a?.batteryState?.urgentActive??!1,f=a?.batteryState?.warnActive??!1,d=a?.battery??null,g=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(g==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=(g-p)/S,w=Math.max(0,Math.min(1,b)),T=b<=0,N=y!=null&&g<=y;return{percent:w,barClass:T?"bg-red-500/40":N?"bg-amber-400/40":"bg-emerald-400/40"}}function AN(){const{session:a}=_e(),l=Jg();Tf();const i=a?.mode==="lockdown",r=of(),f=a?.roster??[],[d,g]=h.useState(0),x=a?.activeDrivers||{},p=h.useMemo(()=>f.filter(X=>x[X.id]),[f,x]),y=vf(p.map(X=>X.id),{enabled:!i,version:a?.mode}),S=h.useMemo(()=>p.flatMap(X=>{if(!X?.id||!X.media?.audioPublishUrl)return[];const H=String(X.id);return[{type:"rover",id:`${H}-audio`,key:`${H}-audio`}]}),[p]),b=yf(S,{enabled:!i,version:a?.mode}),w=h.useMemo(()=>{if(!p.length)return[];const X=p.filter(H=>y[H.id]?.objectUrl);return X.length?X:p},[p,y]),T=h.useMemo(()=>w.map(X=>({type:"rover",rover:X})),[w]),N=h.useMemo(()=>T.map(X=>`r:${X.rover.id}`).join("|"),[T]);h.useEffect(()=>{g(0)},[N]),h.useEffect(()=>{if(!T.length)return;const X=setInterval(()=>{g(H=>(H+1)%T.length)},vN);return()=>clearInterval(X)},[T.length,N]);const C=T.length?T[d%T.length]:null,A=C?.type==="rover"?C.rover:null,E=A&&y[A.id]||null,j=A&&b[`${A.id}-audio`]||null,k=A&&r[A.id]||null,Q=A?C0({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(NN,{children:o.jsx(Sf,{sessionInfo:null,videoMode:"snapshot",snapshotFeed:E,audioSessionInfo:j,label:A.name||A.id,telemetryFrame:k,batteryConfig:A.battery,layoutFormat:"mobile",hudVariant:"spectator",driverLabel:Q,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(X=>{const H=r[X.id]||null,z=C0({roverId:X.id,session:a}),I=SN({rover:X,frame:H}),$=A?.id===X.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 ${$?"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 ${$?"text-white":"text-slate-200"}`,children:X.name||X.id}),o.jsx("div",{className:`text-5xl font-semibold ${$?"text-white":"text-slate-300"}`,children:z})]})]},X.id)}):o.jsx("div",{className:"flex h-full w-full items-center justify-center text-sm text-slate-500",children:"No rovers available."})})]})}function jN(){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())},bN);return()=>clearTimeout(a)},[]),o.jsx(cf,{children:o.jsxs(o.Fragment,{children:[o.jsx(AN,{}),o.jsx(ff,{scale:3})]})})}function NN({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})})})}Sv.createRoot(document.getElementById("root")).render(o.jsx(h.StrictMode,{children:o.jsx(G1,{children:o.jsx(X1,{children:o.jsx(K1,{children:o.jsx(LS,{children:o.jsx(Bb,{children:o.jsxs(hb,{children:[o.jsx(br,{path:"/",element:o.jsx(cN,{})}),o.jsx(br,{path:"/spectate",element:o.jsx(yN,{})}),o.jsx(br,{path:"/mini",element:o.jsx(jN,{})})]})})})})})})}));